1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5139,1433,5465,7941],{30460:function(e,t,a){var r={"./feedback.json":[14269,4269],"./ghibliAi.json":[10163,163],"./tool.json":[69891,9891]};function l(e){if(!a.o(r,e))return Promise.resolve().then(function(){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=r[e],l=t[0];return a.e(t[1]).then(function(){return a.t(l,19)})}l.keys=function(){return Object.keys(r)},l.id=30460,e.exports=l},86731:function(e,t,a){var r={"./ar/feedback.json":[87952,7952],"./ar/ghibliAi.json":[69918,9918],"./ar/tool.json":[11158,1158],"./de/feedback.json":[5760,5760],"./de/ghibliAi.json":[84309,4309],"./de/tool.json":[26877,6877],"./en/feedback.json":[14269,4269],"./en/ghibliAi.json":[10163,163],"./en/tool.json":[69891,9891],"./es/feedback.json":[89259,9259],"./es/ghibliAi.json":[29511,9511],"./es/tool.json":[42996,2996],"./fa/feedback.json":[9762,7644],"./fa/ghibliAi.json":[8449,8449],"./fa/tool.json":[9931,9931],"./fr/feedback.json":[49576,9576],"./fr/ghibliAi.json":[94695,4695],"./fr/tool.json":[48969,8969],"./hi/feedback.json":[69881,9881],"./hi/ghibliAi.json":[74801,4801],"./hi/tool.json":[86459,6459],"./id/feedback.json":[26442,6442],"./id/ghibliAi.json":[64897,4897],"./id/tool.json":[83199,3199],"./it/feedback.json":[15215,5215],"./it/ghibliAi.json":[17654,7654],"./it/tool.json":[40886,886],"./ja/feedback.json":[94536,4536],"./ja/ghibliAi.json":[19069,9069],"./ja/tool.json":[3570,3570],"./ko/feedback.json":[11892,1892],"./ko/ghibliAi.json":[38453,8453],"./ko/tool.json":[80354,354],"./nl/feedback.json":[72040,2040],"./nl/ghibliAi.json":[90124,124],"./nl/tool.json":[4587,4587],"./pt/feedback.json":[88974,8974],"./pt/ghibliAi.json":[14266,4266],"./pt/tool.json":[41576,1576],"./ru/feedback.json":[54231,4231],"./ru/ghibliAi.json":[48158,8158],"./ru/tool.json":[81477,1477],"./tr/feedback.json":[40778,778],"./tr/ghibliAi.json":[85657,5657],"./tr/tool.json":[6613,6613],"./vi/feedback.json":[29955,9955],"./vi/ghibliAi.json":[29079,9079],"./vi/tool.json":[41201,1201],"./zh-CN/feedback.json":[66682,6682],"./zh-CN/ghibliAi.json":[61012,1012],"./zh-CN/tool.json":[3917,3917]};function l(e){if(!a.o(r,e))return Promise.resolve().then(function(){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=r[e],l=t[0];return a.e(t[1]).then(function(){return a.t(l,19)})}l.keys=function(){return Object.keys(r)},l.id=86731,e.exports=l},31186:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/[...path]",function(){return a(99856)}])},21973:function(e,t,a){"use strict";var r=a(18788).Symbol;e.exports=r},42362:function(e,t,a){"use strict";var r=a(21973),l=a(22746),s=a(25935),n=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":n&&n in Object(e)?l(e):s(e)}},80946:function(e,t,a){"use strict";var r=a(87589),l=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(l,""):e}},52957:function(e,t,a){"use strict";var r="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g;e.exports=r},22746:function(e,t,a){"use strict";var r=a(21973),l=Object.prototype,s=l.hasOwnProperty,n=l.toString,i=r?r.toStringTag:void 0;e.exports=function(e){var t=s.call(e,i),a=e[i];try{e[i]=void 0;var r=!0}catch(e){}var l=n.call(e);return r&&(t?e[i]=a:delete e[i]),l}},25935:function(e){"use strict";var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},18788:function(e,t,a){"use strict";var r=a(52957),l="object"==typeof self&&self&&self.Object===Object&&self,s=r||l||Function("return this")();e.exports=s},87589:function(e){"use strict";var t=/\s/;e.exports=function(e){for(var a=e.length;a--&&t.test(e.charAt(a)););return a}},88237:function(e,t,a){"use strict";var r=a(88300),l=a(62118),s=a(35733),n=Math.max,i=Math.min;e.exports=function(e,t,a){var o,d,c,u,p,m,g=0,h=!1,x=!1,f=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var a=o,r=d;return o=d=void 0,g=t,u=e.apply(r,a)}function v(e){var a=e-m,r=e-g;return void 0===m||a>=t||a<0||x&&r>=c}function b(){var e,a,r,s=l();if(v(s))return w(s);p=setTimeout(b,(e=s-m,a=s-g,r=t-e,x?i(r,c-a):r))}function w(e){return(p=void 0,f&&o)?y(e):(o=d=void 0,u)}function j(){var e,a=l(),r=v(a);if(o=arguments,d=this,m=a,r){if(void 0===p)return g=e=m,p=setTimeout(b,t),h?y(e):u;if(x)return clearTimeout(p),p=setTimeout(b,t),y(m)}return void 0===p&&(p=setTimeout(b,t)),u}return t=s(t)||0,r(a)&&(h=!!a.leading,c=(x="maxWait"in a)?n(s(a.maxWait)||0,t):c,f="trailing"in a?!!a.trailing:f),j.cancel=function(){void 0!==p&&clearTimeout(p),g=0,o=m=
1d=p=void 0},j.flush=function(){return void 0===p?u:w(l())},j}},88300:function(e){"use strict";e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},38482:function(e){"use strict";e.exports=function(e){return null!=e&&"object"==typeof e}},18775:function(e,t,a){"use strict";var r=a(42362),l=a(38482);e.exports=function(e){return"symbol"==typeof e||l(e)&&"[object Symbol]"==r(e)}},62118:function(e,t,a){"use strict";var r=a(18788);e.exports=function(){return r.Date.now()}},35733:function(e,t,a){"use strict";var r=a(80946),l=a(88300),s=a(18775),n=0/0,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,d=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(s(e))return n;if(l(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=l(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var a=o.test(e);return a||d.test(e)?c(e.slice(2),a?2:8):i.test(e)?n:+e}},82312:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var r=a(90170);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return t.filter((e,t,a)=>!!e&&""!==e.trim()&&a.indexOf(e)===t).join(" ").trim()};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,r.forwardRef)((e,t)=>{let{color:a="currentColor",size:l=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:d="",children:c,iconNode:u,...p}=e;return(0,r.createElement)("svg",{ref:t,...n,width:l,height:l,stroke:a,strokeWidth:o?24*Number(i)/Number(l):i,className:s("lucide",d),...p},[...u.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(c)?c:[c]])}),o=(e,t)=>{let a=(0,r.forwardRef)((a,n)=>{let{className:o,...d}=a;return(0,r.createElement)(i,{ref:n,iconNode:t,className:s("lucide-".concat(l(e)),o),...d})});return a.displayName="".concat(e),a}},69903:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},12486:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},43028:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},65585:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},63479:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},97083:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},29567:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},34731:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])},67207:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},48904:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},42508:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},48672:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},42579:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]])},41799:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
1],["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"}]])},9773:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(82312).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},49333:function(e,t,a){"use strict";a.d(t,{PF:function(){return d},Sg:function(){return o},m5:function(){return i}});var r=a(19609);let l=e=>e&&"object"==typeof e&&!Array.isArray(e),s=(e,t,a)=>{let r={};l(e)&&Object.entries(e).forEach(e=>{let[t,a]=e;if(t){if("string"==typeof a&&a.trim()){r[t]=a.trim();return}if(l(a)){let e=a.text||a.title||a.content||a.message||"";"string"==typeof e&&e.trim()&&(r[t]=e.trim())}}});let s=t||"en",n="string"==typeof a&&a.trim()?a.trim():"";return n&&!r[s]&&(r[s]=n),r},n=e=>{if(!e)return null;let t=e;for(;"string"==typeof t;){let e=t.trim();if(!e)return null;try{t=JSON.parse(e)}catch(e){return null}}if(!l(t))return null;let a=t.language||t.locale||"en",r=t.title||t.message||t.text||"",n=s(t.translations||t.copyMap||t.textI18n,a,r),i=(t.linkUrl||t.jumpUrl||t.url||"").trim(),o="string"==typeof t.buttonText&&t.buttonText.trim()?t.buttonText.trim():"";return Object.keys(n).length?{enabled:!1!==t.enabled&&!1!==t.isEnabled&&0!==t.status,position:t.position||"HEADER_TOP",linkUrl:i,jumpType:"blank"===t.jumpType?"blank":"self",buttonText:o,translations:n}:null},i={getRecordSuccessRate:()=>(0,r.Z)({url:"/client/v1/userRecord/getSuccessRate",method:"get"})},o=async()=>{try{let e=await fetch("".concat("https://api.kie.ai","/client/v1/advertisement/top-carousel"),{method:"GET"}),t=await e.json().catch(()=>null);if(!e.ok||!t||!t.data)return null;return t.data}catch(e){return null}},d=async()=>{try{let e=await fetch("".concat("https://api.kie.ai","/client/v1/advertisement/top-banner?siteType=kie.ai"),{method:"GET"}),t=await e.json().catch(()=>null);if(!e.ok||!t||200!==t.code||!t.data)return null;return n(t.data)}catch(e){return null}}},25307:function(e,t,a){"use strict";a.d(t,{W:function(){return s}});var r=a(39696),l=a(65117);function s(e){let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,l.Z)("relative z-[1] mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",t),...a})}},7510:function(e,t,a){"use strict";a.d(t,{Z:function(){return p}});var r=a(39696),l=a(90170),s=a(32324),n=a(47524),i=a(75464),o=a(54644),d=a.n(o),c=a(56156),u=a(67045);function p(e){let{carouselSecondaryPageList:t,listCarouselCommon:a}=e,{t:o}=(0,c.Z)("common"),{theme:p,setTheme:m}=(0,n.F)(),[g,h]=(0,l.useState)(!1),x=o("footer.list",{},{returnObjects:!0});return((0,l.useEffect)(()=>{h(!0)},[]),g)?(0,r.jsx)("footer",{className:"relative flex w-full flex-col",children:(0,r.jsxs)("div",{className:"mx-auto flex w-full max-w-7xl flex-col items-start justify-between gap-6 px-6 py-12 lg:px-8",children:[(0,r.jsxs)("div",{className:"grid grid-cols-[auto_auto] justify-between gap-8 sm:grid-cols-[auto_auto_auto] lg:grid-cols-[auto_auto_auto_auto_auto]",children:[x.map((e,t)=>(0,r.jsxs)("div",{className:"flex flex-col items-start font-semibold lg:col-span-1",children:[(0,r.jsx)("div",{className:"mb-4 lg:mt-0",children:(0,r.jsx)("p",{children:e.title})}),(0,r.jsx)("div",{className:"grid w-full grid-cols-1",children:e.child.map((e,t)=>(0,r.jsx)(d(),{href:e.hrefUrl,target:e.target,title:e.label,className:"truncate py-2 text-sm font-normal text-default-500 transition hover:text-default-800",children:e.label},t))})]},t)),(0,r.jsxs)("div",{className:"flex flex-col items-start font-semibold",children:[(0,r.jsx)("div",{className:"mb-4 lg:mt-0",children:(0,r.jsx)("p",{children:"RESOURCES"})}),t&&(0,r.jsx)("div",{className:"grid w-full grid-cols-1 gap-2 md:grid-cols-2 lg:gap-x-6",children:t.map((e,t)=>(0,r.jsx)(d(),{href:(0,u.n)(e.path),title:e.title,className:"truncate py-2 text-sm font-normal text-default-500 transition hover:text-default-800",children:e.title},t))})]}),a&&(0,r.jsxs)("div",{className:"flex flex-col items-start font-semibold",children:[(0,r.jsx)("div",{className:"mb-4 lg:mt-0",children:(0,r.jsx)("p",{children:"Market"})}),(0,r.jsx)("div",{className:"grid w-full grid-cols-1 gap-2 md:grid-cols-2 lg:gap-x-6",children:a.map((e,t)=>(0,r.jsx)(d(),{href:(0,u.n)(e.path),title:e.title,className:"truncate py-2 text-sm font-normal text-default-500 transition hover:text-default-800",children:e.title},t))})]})]}),(0,r.jsxs)("div",{className:"mx-auto w-full border-t border-default-100 pt-4 md:flex md:items-center md:justify-between",children:[(0,r.jsx)("div",{className:"flex flex-col items-center justify-center gap-2 md:order-2 md:items-end",children:(0,r.jsx)(s.A,{isIconOnly:!0,radius:"full",variant:"light",onPress:()=>{m("light"===p?"dark":"light")},children:(0,r.jsx)(i.JO,{className:"text-default-500",icon:"light"===p?"solar:moon-linear":"solar:sun-linear",width:24})})}),(0,r.jsxs)("div",{className:"mt-4 md:order-1 md:mt-0",children:[(0,r.jsx)("div",{className:"flex items-center justify-center gap-3 md:justify-start",children:(0,r.jsx)("div",{className:"flex items-center",children:(0,r.jsx)("span",{className:"text-small font-medium",children:"KIE AI"})})}),(0,r.jsx)("p",{className:"mt-1 text-center text-tiny text-default-400 md:text-start",children:"\xa9 2025 kie.ai Inc. All rights reserved."})]})]})]})}):null}},6924:function(e,t,a){"use strict";a.d(t,{Hb:function(){return s},TT:function(){return n},t5:function(){return l}});var r=a(39696);let l=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],l=t;if(a){let a=null==e?void 0:e.locale;"en"!==a&&(l="/".concat(a).concat(t))}return(0,r.jsx)("link",{rel:"canonical",href:"".concat("https://kie.ai").concat(l||"/")})},s=(e,t,a)=>{let l="/"===t?"":t,s=((null==e?void 0:e.locales)||[]).map(e=>{if(a&&!a.includes(e))return null;let t=("en"===e?"":"/".concat(e))+l;return(0,r.jsx)("link",{rel:"alternate",hrefLang:e,href:"https://kie.ai"+(t||"/")},e)}
1).filter(Boolean);return a&&s.push((0,r.jsx)("link",{rel:"alternate",hrefLang:"x-default",href:"https://kie.ai"+(l||"/")},"x-default")),s},n=(e,t,a)=>{let l=e;a&&!a.includes(e)&&(l="en");let s=t;return"en"!==l&&(s="/".concat(l).concat(t)),(0,r.jsx)("link",{rel:"canonical",href:"".concat("https://kie.ai").concat(s||"/")})}},17941:function(e,t,a){"use strict";var r=a(39696),l=a(90170),s=a(25043),n=a.n(s),i=a(98452),o=a(50753),d=a(81472),c=a(52830),u=a(78474),p=a(55710),m=a(29565),g=a(74111),h=a(62566),x=a(9933),f=a(72895),y=a(1786),v=a(32324),b=a(41315),w=a(49764),j=a(84140),k=a(47524),N=a(68237),E=a(56156),C=a(36380),I=a.n(C),S=a(76260),A=a(51763),P=a(27220),D=a(82950),T=a(82135),_=a(3580),R=a(57427),F=a(68702);let M=n()(()=>Promise.all([a.e(2045),a.e(2278),a.e(6179),a.e(2365),a.e(7596)]).then(a.bind(a,2365)),{loadableGenerated:{webpack:()=>[2365]},ssr:!1}),O=n()(()=>a.e(1105).then(a.bind(a,31105)),{loadableGenerated:{webpack:()=>[31105]},ssr:!1});t.Z=(0,T.Pi)(function(e){let{supportedLanguages:t,navigationData:a,hideGetStarted:s}=e,{t:n}=(0,E.Z)("common"),{t:C}=(0,E.Z)("get-started"),{userStore:T}=(0,P.o)(),{theme:L,setTheme:B}=(0,k.F)(),[U,Z]=(0,l.useState)(!1),[z,q]=(0,l.useState)(!1),[K,G]=(0,l.useState)(!1),[W,V]=(0,l.useState)(!1),H=()=>{V(!0),G(!0)},J=(0,N.useRouter)(),{lang:$}=(0,E.Z)("common"),[Y,X]=(0,l.useState)(!1),[Q,ee]=(0,l.useState)(!0),[et,ea]=(0,l.useState)(!0),er=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!J.isReady)return;let e=new URLSearchParams(window.location.search),t=Array.from(e.keys());if(e.has("ref")&&1===t.length){let t=e.get("ref");T.setRefCode(t),J.replace(J.asPath.split("?")[0],void 0,{shallow:!0}),setTimeout(()=>{H()},0)}},[J]),(0,l.useEffect)(()=>{T.loadUserInfo().then(()=>{let e=J.asPath;(e.startsWith("/login")||e.startsWith("/signup"))&&J.push("/market")}),T.getIpAddress()},[]),(0,l.useEffect)(()=>{Z(!0)},[]),(0,l.useEffect)(()=>{let e=()=>{let e=window.scrollY;X(e>.5*window.innerHeight),ea(e<=300)};return window.addEventListener("scroll",e),e(),()=>{window.removeEventListener("scroll",e)}},[]),(0,l.useEffect)(()=>{if(!U)return;let e=er.current;if(!e)return;let t=()=>{document.documentElement.style.setProperty("--app-header-height","".concat(e.offsetHeight,"px"))};if(t(),"undefined"==typeof ResizeObserver)return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t);let a=new ResizeObserver(t);return a.observe(e),()=>a.disconnect()},[U]);let el=e=>{(0,F.A)(e);let{pathname:t,query:a,asPath:r}=J;J.push({pathname:t,query:a},r,{locale:e}),q(!1)};return((0,l.useEffect)(()=>{let e=e=>{z&&!e.target.closest("#lang-menu-container")&&q(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[z]),U)?(J.asPath.includes("/suno-api"),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{ref:er,className:"fixed left-0 top-0 z-40 w-full",children:[(0,r.jsx)(R.Z,{}),(0,r.jsxs)(h.R,{classNames:{base:"w-full bg-default-50 backdrop-blur-md",item:"data-[active=true]:text-primary",wrapper:"px-4 sm:px-6 py-6 max-w-full"},height:"60px",children:[(0,r.jsx)(x.H,{children:(0,r.jsx)("div",{className:"flex items-center",children:(0,r.jsxs)(g.O,{href:"/",className:"text-lg font-bold text-foreground",children:[(0,r.jsx)(I(),{src:"/logo-icon.webp",alt:"kie.ai",width:50,height:50,unoptimized:!0,className:"mr-2 h-auto w-8"}),(0,r.jsx)("p",{className:"hidden font-bold text-inherit md:inline-block",children:"KIE API"})]})})}),(0,r.jsx)(f.U,{className:"ml-4 hidden h-12 w-full max-w-fit gap-6 rounded-full bg-content2 px-4 text-sm dark:bg-content1 lg:flex",justify:"start",children:a&&(0,r.jsx)(_.YA,{navigationData:a,titleClassName:"w-max flex gap-2 text-[15px] text-default-700 text-inherit transition duration-500 hover:opacity-80"})}),(0,r.jsxs)(f.U,{className:"ml-auto flex h-12 max-w-fit items-center gap-2 rounded-full p-0 md:gap-0 lg:bg-content2 lg:px-1 lg:dark:bg-content1",justify:"end",children:[(0,r.jsx)(y.k,{className:"inline-flex",children:(0,r.jsx)(v.A,{isIconOnly:!0,radius:"full",variant:"light",onPress:()=>{B("light"===L?"dark":"light")},children:(0,r.jsx)(j.JO,{className:"text-default-500",icon:"light"===L?"solar:moon-linear":"solar:sun-linear",width:24})})}),!(t&&0===t.length)&&(0,r.jsx)(y.k,{className:"inline-flex",children:(0,r.jsxs)("div",{className:"relative",id:"lang-menu-container",children:[(0,r.jsx)(v.A,{isIconOnly:!0,radius:"full",variant:"light",onPress:()=>{q(!z)},children:(0,r.jsx)(j.JO,{className:"text-default-500",icon:"material-symbols:translate",width:24})}),z&&(0,r.jsx)("div",{className:"fixed right-4 top-20 z-[999999] w-48 rounded-md border-none bg-default-50 shadow-lg ring-1 ring-black ring-opacity-5",style:{position:"fixed",zIndex:999999,pointerEvents:"auto"},children:(0,r.jsx)("div",{className:"p-2",children:S.F.filter(e=>!t||t.includes(e.code)).map(e=>(0,r.jsx)("button",{onClick:()=>el(e.code),className:"block w-full rounded-xl px-4 py-2 text-left text-sm transition ".concat(e.code===$?"bg-default-100 text-default-700":"text-default-500 hover:bg-accent hover:text-default-700"),children:e.name},e.code))})})]})}),!s&&(0,r.jsx)(y.k,{className:"inline-flex",children:T.user?(0,r.jsx)(e=>{var t,a,l;let{isMobile:s}=e;return(0,r.jsxs)(i.F,{placement:"bottom-end",children:[(0,r.jsx)(o.S,{children:(0,r.jsx)("button",{className:(0,d.cn)("mb-3 outline-none transition-transform",s?"h-8 w-8":"mt-1 h-8 w-8"),children:(0,r.jsx)(c.O,{color:"success",content:"",placement:"bottom-right",shape:"circle",children:(0,r.jsx)(u.h,{size:"sm",src:(null===(t=T.user)||void 0===t?void 0:t.avatar)||"/images/svg/default-avatar.svg"})})})}),(0,r.jsxs)(p.a,{"aria-label":"Profile Actions",variant:"flat",children:[(0,r.jsxs)(m.W,{className:"h-14 gap-2",children:[(0,r.jsx)("p",{className:"font-semibold",children:null===(a=T.user)||void 0===a?void 0:a.nickname}),(0,r.jsx)("p",{className:"font-semibold",children:null===(l=T.user)||void 0===l?void 0:l.email})]},"profile"),(0,r.jsx)(m.W,{as:g.O,href:"/market",children:(0,r.jsx)("span",{className:"text-default-700",children:"Market"})},"dashboard"),(0,r.jsxs)(m.W,{color:"danger",onPress:()=>{T.logout().then(()=>{J.reload()})},children:[n("logout.title")," ",(0,r.jsx)(D.Z,{size:6,loading:T.logoutLoading,color:"#0284C7"})]},"logout")]})]})},{isMobile:!1}):(0,r.jsx)(v.A,{className:"w-auto min-w-10 px-0 font-medium text-foreground md:px-2",radius:"full",variant:"light",onPress:()=>H(),children:C("nav.getStarted")})}),(0,r.jsx)(b.L,{className:"ml-2 text-[var(--akr-color-text-primary)] lg:hidden"})]}),(0,r.jsx)(w.$,{className:"bg-white pt-6",children:a&&(0,r.jsx)(_.gS,{navigationData:a})})]})]}),T.openGoogleOneTapLogin&&(0,r.jsx)(A.Z,{}),T.openDiscordModel&&(0,r.jsx)(O,{}),W&&(0,r.jsx)(M,{isOpen:K,onClose:()=>G(!1),onLoginSuccess:()=>{T.loadUserInfo()}})]})):null})},10841:function(e,t,a){"use strict";var r=a(39696);a(90170);var l=a(32324),s=a(84140),n=a(56156),i=a(68237),o=a(36380),d=a.n(o);t.Z=()=>{let{t:e}=(0,n.Z)("common"),t=(0,i.useRouter)();return(0,r.jsx)("div",{className:"mx-auto w-full p-8",children:(0,r.jsxs)("div",{className:"space-y-6 text-center",children:[(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)("div",{className:"flex h-16 w-16 items-center justify-center",children:(0,r.jsx)(d(),{width:100,height:100,src:"/logo-icon.webp",alt:"Kie AI Logo",className:"h-12 w-12 object-contain"})})}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("h2",{className:"text-3xl font-bold text-foreground",children:e("pricing.cta.title")}),(0,r.jsx)("p",{className:"mx-auto max-w-2xl text-lg text-default-500",children:e("pricing.cta.description")})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-6 py-6 md:grid-cols-3",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,r.jsx)(s.JO,{icon:"material-symbols:credit-card",className:"text-2xl text-blue-500"}),(0,r.jsx)("h3",{className:"font-semibold text-foreground",children:e("pricing.cta.features.billing.title")}),(0,r.jsx)("p",{className:"text-center text-sm text-default-500",children:e("pricing.cta.features.billing.description")})]}),(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,r.jsx)(s.JO,{icon:"material-symbols:analytics",className:"text-2xl text-green-500"}),(0,r.jsx)("h3",{className:"font-semibold text-foreground",children:e("pricing.cta.features.analytics.title")}),(0,r.jsx)("p",{className:"text-center text-sm text-default-500",children:e("pricing.cta.features.analytics.description")})]}),(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,r.jsx)(s.JO,{icon:"material-symbols:api",className:"text-2xl text-purple-500"}),(0,r.jsx)("h3",{className:"font-semibold text-foreground",children:e("pricing.cta.features.api.title")}),(0,r.jsx)("p",{className:"text-center text-sm text-default-500",children:e("pricing.cta.features.api.description")})]})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(l.A,{size:"lg",color:"primary",variant:"solid",className:"px-8 py-3 text-lg font-semibold",onPress:()=>{t.push("/market")},startContent:(0,r.jsx)(s.JO,{icon:"material-symbols:arrow-forward",className:"text-xl"}),children:e("pricing.cta.button")}),(0,r.jsx)("p",{className:"text-sm text-default-400",children:e("pricing.cta.note")})]})]})})}},51615:function(e,t,a){"use strict";a.d(t,{g:function(){return x}});var r,l=a(39696),s=a(90170),n=(0,s.forwardRef)(({as:e="div",...t},a)=>
1(0,l.jsx)(e,{...t,ref:a})),i="cf-turnstile-script",o="onloadTurnstileCallback",d=e=>!!document.getElementById(e),c=({render:e="explicit",onLoadCallbackName:t=o,scriptOptions:{nonce:a="",defer:r=!0,async:l=!0,id:s="",appendTo:n,onError:c,crossOrigin:u=""}={}})=>{let p=s||i;if(d(p))return;let m=document.createElement("script");m.id=p,m.src=`https://challenges.cloudflare.com/turnstile/v0/api.js?onload=${t}&render=${e}`,document.querySelector(`script[src="${m.src}"]`)||(m.defer=!!r,m.async=!!l,a&&(m.nonce=a),u&&(m.crossOrigin=u),c&&(m.onerror=c,delete window[t]),("body"===n?document.body:document.getElementsByTagName("head")[0]).appendChild(m))},u={normal:{width:300,height:65},compact:{width:150,height:140},invisible:{width:0,height:0,overflow:"hidden"},flexible:{minWidth:300,width:"100%",height:65},interactionOnly:{width:"fit-content",height:"auto",display:"flex"}},p="unloaded",m=new Promise((e,t)=>{r={resolve:e,reject:t},"ready"===p&&e(void 0)}),g=(e=o)=>("unloaded"===p&&(p="loading",window[e]=()=>{r.resolve(),p="ready",delete window[e]}),m),h=(0,s.forwardRef)((e,t)=>{let{scriptOptions:a,options:r={},siteKey:m,onWidgetLoad:h,onSuccess:x,onExpire:f,onError:y,onBeforeInteractive:v,onAfterInteractive:b,onUnsupported:w,onTimeout:j,onLoadScript:k,id:N,style:E,as:C="div",injectScript:I=!0,...S}=e,A=r.size,P=(0,s.useCallback)(()=>typeof A>"u"?{}:"execute"===r.execution?u.invisible:"interaction-only"===r.appearance?u.interactionOnly:u[A],[r.execution,A,r.appearance]),[D,T]=(0,s.useState)(P()),_=(0,s.useRef)(null),[R,F]=(0,s.use
1State)(!1),M=(0,s.useRef)(),O=(0,s.useRef)(!1),L=N||"cf-turnstile",B=a?.id||i,U=function(e=i){let[t,a]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let t=()=>{d(e)&&a(!0)},r=new MutationObserver(t);return r.observe(document,{childList:!0,subtree:!0}),t(),()=>{r.disconnect()}},[e]),t}(B),Z=a?.onLoadCallbackName||o,z=r.appearance||"always",q=(0,s.useMemo)(()=>({sitekey:m,action:r.action,cData:r.cData,callback:e=>{O.current=!0,x?.(e)},"error-callback":y,"expired-callback":f,"before-interactive-callback":v,"after-interactive-callback":b,"unsupported-callback":w,theme:r.theme||"auto",language:r.language||"auto",tabindex:r.tabIndex,"response-field":r.responseField,"response-field-name":r.responseFieldName,size:function(e){if("invisible"!==e&&"interactionOnly"!==e)return e}(A),retry:r.retry||"auto","retry-interval":r.retryInterval||8e3,"refresh-expired":r.refreshExpired||"auto","refresh-timeout":r.refreshTimeout||"auto",execution:r.execution||"render",appearance:r.appearance||"always","feedback-enabled":r.feedbackEnabled||!0,"timeout-callback":j}),[r.action,r.appearance,r.cData,r.execution,r.language,r.refreshExpired,r.responseField,r.responseFieldName,r.retry,r.retryInterval,r.tabIndex,r.theme,r.feedbackEnabled,r.refreshTimeout,m,A]),K=(0,s.useCallback)(()=>"u">typeof window&&!!window.turnstile,[]);return(0,s.useEffect)(function(){I&&!R&&c({onLoadCallbackName:Z,scriptOptions:{...a,id:B}})},[I,R,a,B]),(0,s.useEffect)(function(){"ready"!==p&&g(Z).then(()=>F(!0)).catch(console.error)},[]),(0,s.useEffect)(function(){if(!_.current||!R)return;let e=!1;return(async()=>{if(e||!_.current)return;let t=window.turnstile.render(_.current,q);M.current=t,M.current&&h?.(M.current)})(),()=>{e=!0,M.current&&(window.turnstile.remove(M.current),O.current=!1)}},[L,R,q]),(0,s.useImperativeHandle)(t,()=>{let{turnstile:e}=window;return{getResponse(){if(!e?.getResponse||!M.current||!K()){console.warn("Turnstile has not been loaded");return}return e.getResponse(M.current)},getResponsePromise:async(e=3e4,t=100)=>new Promise((a,r)=>{let l,s=async()=>{if(O.current&&window.turnstile&&M.current)try{let e=window.turnstile.getResponse(M.current);return l&&clearTimeout(l),e?a(e):r(Error("No response received"))}catch(e){return l&&clearTimeout(l),console.warn("Failed to get response",e),r(Error("Failed to get response"))}l||(l=setTimeout(()=>{l&&clearTimeout(l),r(Error("Timeout"))},e)),await new Promise(e=>setTimeout(e,t)),await s()};s()}),reset(){if(!e?.reset||!M.current||!K()){console.warn("Turnstile has not been loaded");return}"execute"===r.execution&&T(u.invisible);try{O.current=!1,e.reset(M.current)}catch(e){console.warn(`Failed to reset Turnstile widget ${M}`,e)}},remove(){if(!e?.remove||!M.current||!K()){console.warn("Turnstile has not been loaded");return}T(u.invisible),O.current=!1,e.remove(M.current),M.current=null},render(){if(!e?.render||!_.current||!K()||M.current){console.warn("Turnstile has not been loaded or container not found");return}let t=e.render(_.current,q);return M.current=t,M.current&&h?.(M.current),"execute"!==r.execution&&T(A?u[A]:{}),t},execute(){if("execute"!==r.execution){console.warn('Execution mode is not set to "execute"');return}if(!e?.execute||!_.current||!M.current||!K()){console.warn("Turnstile has not been loaded or container not found");return}e.execute(_.current,q),T(A?u[A]:{})},isExpired:()=>e?.isExpired&&M.current&&K()?e.isExpired(M.current):(console.warn("Turnstile has not been loaded"),!1)}},[M,r.execution,A,q,_,K,R,h]),(0,s.useEffect)(()=>{U&&!R&&window.turnstile&&F(!0)},[R,U]),(0,s.useEffect)(()=>{T(P())},[r.execution,A,z]),(0,s.useEffect)(()=>{U&&"function"==typeof k&&k()},[U]),(0,l.jsx)(n,{ref:_,as:C,id:L,style:{...D,...E},...S})});function x(e){let{verifyChatLoading:t=!0,success:a}=e,r=(0,s.useRef)(),[n,i]=(0,s.useState)("");return(0,s.useEffect)(()=>{if(t){var e,l,s;if("solved"===n){let t=null===(e=r.current)||void 0===e?void 0:e.getResponse();t?(a(t),i("expired")):null===(l=r.current)||void 0===l||l.reset()}else""!==n&&(null===(s=r.current)||void 0===s||s.reset())}},[t,n]),(0,l.jsx)(h,{ref:r,siteKey:"0x4AAAAAADXCaP3WwHA7OCle",onError:()=>i("error"),onSuccess:()=>i("solved"),onExpire:()=>i("expired"),options:{size:"normal",theme:"light"}})}h.displayName="Turnstile"},61277:function(e,t,a){"use strict";a.d(t,{n:function(){return P}});var r=a(39696),l=a(90170),s=a(82135),n=a(12732),i=a(12245),o=a(26716),d=a(18492),c=a(56156),u=a(27220),p=a(44965),m=a(66461);
1let g=[{id:1,label:"Forest Scenery",before:"https://static.aiquickdraw.com/images/ghibli/0-1.webp?v=1",after:"https://static.aiquickdraw.com/images/ghibli/0-2.webp?v=1"},{id:2,label:"City Landscape",before:"https://static.aiquickdraw.com/images/ghibli/1-1.webp?v=1",after:"https://static.aiquickdraw.com/images/ghibli/1-2.webp?v=1"},{id:3,label:"Portrait",before:"https://static.aiquickdraw.com/images/ghibli/2-1.webp?v=1",after:"https://static.aiquickdraw.com/images/ghibli/2-2.webp?v=1"}];function h(e){let{fileInputRef:t}=e,[a,s]=(0,l.useState)(0),[n,i]=(0,l.useState)(0),{t:o}=(0,c.Z)("ghibliAi");(0,l.useEffect)(()=>{let e=setInterval(()=>{i(e=>(e+1)%g.length)},8e3);return()=>clearInterval(e)},[]),(0,l.useEffect)(()=>{let e=localStorage.getItem("ghibliAIUsageCount");e&&s(parseInt(e,10))},[]);let d=e=>{"next"===e?i(e=>(e+1)%g.length):i(e=>0===e?g.length-1:e-1)};return(0,r.jsxs)("div",{className:"flex w-full flex-col items-center space-y-4",children:[(0,r.jsxs)("div",{className:"relative w-full",children:[(0,r.jsxs)("div",{className:"flex w-full items-center justify-center",children:[(0,r.jsx)("div",{className:"flex-none px-2",children:(0,r.jsx)("button",{onClick:()=>d("prev"),className:"flex h-10 w-10 items-center justify-center rounded-full bg-default-100 shadow-md hover:bg-default-100","aria-label":o("image.default.prevExample"),children:(0,r.jsx)("span",{className:"rotate-180 transform",children:"â"})})}),(0,r.jsx)("div",{className:"relative w-auto max-w-[500px] flex-1 overflow-hidden",children:(0,r.jsx)("div",{className:"flex transition-transform duration-500 ease-in-out",style:{width:"".concat(100*g.length,"%"),transform:"translateX(-".concat(100/g.length*n,"%)")},children:g.map((e,t)=>(0,r.jsx)("div",{className:"w-full",style:{width:"".concat(100/g.length,"%")},children:(0,r.jsx)(m.rI,{beforeImage:e.before,afterImage:e.after})},t))})}),(0,r.jsx)("div",{className:"flex-none px-2",children:(0,r.jsx)("button",{onClick:()=>d("next"),className:"flex h-10 w-10 items-center justify-center rounded-full bg-default-100 shadow-md hover:bg-default-100","aria-label":o("image.default.nextExample"),children:(0,r.jsx)("span",{children:"â"})})})]}),(0,r.jsx)("div",{className:"mt-2 flex justify-center space-x-2",children:g.map((e,t)=>(0,r.jsx)("button",{onClick:()=>i(t),className:"h-2 w-2 rounded-full ".concat(t===n?"bg-blue-500":"bg-default-300")},t))})]}),(0,r.jsxs)("div",{className:"mt-4 text-center",children:[(0,r.jsx)("p",{className:"text-lg font-medium text-default-600",children:o("image.default.title")}),(0,r.jsx)("p",{className:"mt-2 text-sm text-default-500",children:o("image.default.description")})]}),(0,r.jsx)("div",{className:"mt-4 w-full max-w-md",children:(0,r.jsx)("button",{className:"w-full rounded-lg border border-blue-500 px-4 py-3 font-medium text-blue-600 transition-colors hover:bg-default-50",onClick:()=>{t&&t.current&&t.current.click()},children:o("image.default.uploadButton")})})]})}var x=a(53070),f=a(49650),y=a(18604),v=a(18595),b=a(84140),w=a(2365),j=a(68237),k=a(25043),N=a.n(k),E=a(10929),C=a(36380),I=a.n(C);let S=(0,s.Pi)(e=>{var t,a;let{}=e,{t:s}=(0,c.Z)("ghibliAi"),{t:m}=(0,c.Z)("dashboard"),{userStore:g}=(0,u.o)(),k=(0,j.useRouter)(),[N,C]=(0,l.useState)(null),[S,A]=(0,l.useState)(""),[P,D]=(0,l.useState)(!1),T=(0,l.useRef)(null),[_,R]=(0,l.useState)(null),[F,M]=(0,l.useState)(!1),[O,L]=(0,l.useState)([]),[B,U]=(0,l.useState)([]),[Z,z]=(0,l.useState)("3:2"),[q,K]=(0,l.useState)(!1),G=e=>{let t=e[0];if(t){if(t.size>5242880){d.ZP.error("Image size cannot exceed 5MB");return}if(!["image/png","image/jpeg","image/jpg","image/webp"].includes(t.type)){d.ZP.error("Only PNG, JPG, JPEG and WEBP image formats are supported");return}M(!0),(0,p._R)(t,"kieai/ghibli-ai").then(e=>{R(e),M(!1)}).catch(e=>{console.error("Error uploading file:",e),d.ZP.error("Upload failed, please try again"),M(!1)})}};(0,l.useEffect)(()=>{B.length>0&&(G(B),U([]))},[B]),(0,l.useEffect)(()=>{O.length>0&&G(O)},[O]);let W=async()=>{if(!g.user){K(!0);return}if(!g.user.apiKey){d.ZP.error(m("toast.apiKeyEmpty")),k.push("/api-key");return}P||(D(!0),(0,v.Z)({headers:{Authorization:"Bearer ".concat(g.user.apiKey),"Content-Type":"application/json"},url:"".concat("https://api.kie.ai","/api/v1/gpt4o-image/generate"),method:"POST",data:{fileUrl:_,prompt:S,size:Z,callBackUrl:"playground"}}).then(e=>{g.loadUserInfo(),200===e.data.code?V(e.data.data.taskId):(D(!1),d.ZP.error(e.data.msg))}).catch(e=>{console.log(e),D(!1),d.ZP.error(e.message||s("toast.serverAbnormal"))}))},V=e=>{(0,v.Z)({headers:{Authorization:"Bearer ".concat(g.user.apiKey),"Content-Type":"application/x-www-form-urlencoded"},url:"".concat("https://api.kie.ai","/api/v1/gpt4o-image/record-info?taskId=").concat(e),method:"GET"}).then(t=>{if(200===t.data.code){let a=t.data.data;C(a),"SUCCESS"===a.status?(g.loadUserInfo(),D(!1)):"CREATE_TASK_FAILED"===a.status||"GENERATE_FAILED"===a.status?(g.loadUserInfo(),D(!1),a.errorMessage||C({...a,errorMessage:"GENERATE_FAILED"===a.status?"GENERATE FAILED":"CREATE TASK FAILED"})):setTimeout(()=>{V(e)},1500)}else 429===t.data.code?(d.ZP.error(t.data.msg),setTimeout(()=>{V(e)},2e3)):(d.ZP.error(t.data.msg),D(!1),C({status:"GENERATE_FAILED",errorCode:t.data.code,errorMessage:t.data.msg||"Server Error ".concat(t.data.code,", please try again later")}))}).catch(e=>{console.log(e),d.ZP.error(s("toast.serverAbnormal")),D(!1),C({status:"GENERATE_FAILED",errorCode:0,errorMessage:e.message||"Server Error, please try again later"})})},H=e=>{(0,o.$)(e)};return(0,r.jsxs)("div",{id:"operationContent",className:"relative h-full w-full overflow-hidden rounded-2xl border border-default-200 dark:border-default-100 lg:h-[84vh]",children:[(0,r.jsxs)("div",{className:"h-full w-full",children:[(0,r.jsx)("div",{className:"absolute right-2 top-2 z-[999] flex justify-end",children:(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-full bg-blue-500/10 px-3 py-1.5 text-default-600 shadow-sm backdrop-blur-md dark:bg-white/20",children:[(0,r.jsx)("span",{className:"text-sm",children:m("playground.credits")}),(0,r.jsx)("span",{className:"text-base font-bold text-blue-500 dark:text-blue-300",children:(null===(a=g.user)||void 0===a?void 0:null===(t=a.credits)||void 0===t?void 0:t.toLocaleStr
1ing())||0}),(0,r.jsx)(b.JO,{icon:"solar:medal-star-bold",className:"h-5 w-5 text-amber-500"})]})}),(0,r.jsxs)("div",{className:"flex h-full w-full flex-col items-start lg:flex-row",children:[(0,r.jsx)("div",{className:"h-full w-full bg-default-50 text-sm lg:w-[30%]",children:(0,r.jsxs)("div",{className:"flex h-full w-full flex-col p-4",children:[(0,r.jsx)("div",{className:"h-full px-2 lg:flex-1 lg:overflow-y-auto",children:(0,r.jsxs)("div",{className:"mx-auto flex w-full flex-col items-start gap-6",children:[(0,r.jsx)("div",{className:"w-full",children:(0,r.jsxs)("div",{className:(0,E.cn)("relative flex aspect-[2/1] w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed text-center transition duration-500 hover:border-blue-500",_?"border-blue-500":"border-default-200"),onClick:()=>{var e;return null===(e=T.current)||void 0===e?void 0:e.click()},onDrop:e=>{e.preventDefault();let t=e.dataTransfer.files,a=[];for(let e=0;e<t.length;e++){let r=t[e];if("image/jpeg"===r.type||"image/png"===r.type||"image/jpg"===r.type){a.push(r);break}}a.length>0?L([...a]):L([])},onDragOver:e=>{e.preventDefault()},onPaste:e=>{e.preventDefault();let t=e.clipboardData.items,a=[...B];for(let e=0;e<t.length;e++){let r=t[e];if("file"===r.kind&&("image/jpeg"===r.type||"image/png"===r.type||"image/jpg"===r.type)){let e=r.getAsFile();a.push(e);break}}a.length>0&&U(a)},children:[_?(0,r.jsxs)("div",{className:"flex h-full w-full items-center justify-center",children:[(0,r.jsx)("img",{src:_,alt:"Preview",className:"h-auto max-h-full w-auto max-w-full"}),(0,r.jsx)("button",{className:"absolute right-1 top-1 inline-flex h-6 w-6 items-center justify-center rounded-full bg-default-500 text-default-100 shadow-md transition duration-500 hover:opacity-80",onClick:e=>{e.stopPropagation(),R(null),T.current&&(T.current.value=null)},children:(0,r.jsx)(x.Z,{width:16})})]}):(0,r.jsx)("div",{className:"flex flex-col items-center justify-center gap-2 py-6",children:F?(0,r.jsx)("div",{className:"flex flex-col items-center justify-center",children:(0,r.jsx)(n.Z,{color:"#006fee",size:10,margin:5})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.Z,{className:"mx-auto h-10 w-10 text-default-400"}),(0,r.jsx)("p",{className:"text-sm text-default-600",children:s("image.clickToUpload")}),(0,r.jsx)("p",{className:"text-xs text-default-500",children:s("image.fileFormats")})]})}),(0,r.jsx)("input",{type:"file",ref:T,onChange:e=>G(e.target.files),accept:"image/*",className:"hidden"})]})}),(0,r.jsxs)("div",{className:"w-full",children:[(0,r.jsx)("label",{className:"mb-2 block text-sm font-medium text-default-700",children:s("image.prompt")}),(0,r.jsx)("textarea",{className:"w-full rounded-lg border-none bg-transparent p-3 outline-none ring-2 ring-default-200 placeholder:text-default-300 focus:border-blue-500 focus:ring-blue-500",placeholder:s("image.placeholder.prompt"),rows:3,value:S,onChange:e=>A(e.target.value)})]}),(0,r.jsxs)("div",{className:"w-full",children:[(0,r.jsx)("label",{className:"mb-2 block text-sm font-medium text-default-700",children:"Ratio"}),(0,r.jsxs)("div",{className:"flex cursor-pointer items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"relative flex w-full cursor-pointer items-center justify-center gap-1 rounded-md border border-default-200 p-2 text-zinc-800 hover:bg-default-50 ".concat("3:2"==Z?"border-2 !border-blue-500 bg-default-100":""),style:{whiteSpace:"nowrap"},onClick:()=>{z("3:2")},children:[(0,r.jsx)(b.JO,{icon:"mdi:aspect-ratio",className:"h-5 w-5 text-default-600"}),(0,r.jsx)("span",{className:"text-xs font-medium text-default-600",children:"3:2"})]}),(0,r.jsxs)("div",{className:"relative flex w-full cursor-pointer items-center justify-center gap-1 rounded-md border border-default-200 p-2 text-zinc-800 hover:bg-default-50 ".concat("2:3"==Z?"border-2 !border-blue-500 bg-default-100":""),style:{whiteSpace:"nowrap"},onClick:()=>{z("2:3")},children:[(0,r.jsx)(b.JO,{icon:"mdi:aspect-ratio",className:"h-5 w-5 rotate-90 transform text-default-600"}),(0,r.jsx)("span",{className:"text-xs font-medium text-default-600",children:"2:3"})]}),(0,r.jsxs)("div",{className:"relative flex w-full cursor-pointer items-center justify-center gap-1 rounded-md border border-default-200 p-2 text-zinc-800 hover:bg-default-50 ".concat("1:1"==Z?"border-2 !border-blue-500 bg-default-100":""),style:{whiteSpace:"nowrap"},onClick:()=>{z("1:1")},children:[(0,r.jsx)(b.JO,{icon:"material-symbols:crop-square-outline",className:"h-5 w-5 transform text-default-600"}),(0,r.jsx)("span",{className:"text-xs font-medium text-default-600",children:"1:1"})]})]})]})]})}),(0,r.jsx)("div",{className:"mt-4 w-full",children:(0,r.jsxs)("button",{className:"w-full rounded-lg px-4 py-3 text-center font-semibold text-white transition duration-500 ".concat(P?"cursor-not-allowed bg-blue-500":"bg-blue-500 hover:opacity-80"),onClick:()=>{W()},disabled:P,children:[P?s("image.generating"):m("video.generateBtn"),P&&(0,r.jsx)(n.Z,{color:"var(--tool-color-primary-contrast)",margin:0,size:6})]})})]})}),(0,r.jsx)("div",{className:(0,E.cn)("relative flex w-full flex-col items-center overflow-y-auto lg:h-full lg:w-[70%]",N?"justify-between":"justify-center"),children:(0,r.jsxs)("div",{className:"relative flex w-full items-center justify-center p-4 lg:p-2",children:[!N&&(0,r.jsx)("div",{className:"w-full",children:(0,r.jsx)(h,{fileInputRef:T})}),N&&"GENERATING"===N.status&&(0,r.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2 lg:h-96",children:[(0,r.jsx)(I(),{width:100,height:100,src:"https://file.aiquickdraw.com/custom-page/image/1732175809855wx6c4ezf.webp",alt:"image",className:"w-24 animate-bounce"}),(0,r.jsxs)("p",{className:"flex w-full items-center justify-center gap-1 text-blue-500",children:[s("image.generating")," ",Math.round(100*(N.progress||0)),"%",(0,r.jsx)(i.Z,{color:"#006fee",size:18})]})]}),N&&"SUCCESS"===N.status&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"relative flex h-full w-full flex-col items-center justify-center",children:(0,r.jsx)("div",{className:"grid ".concat(1===N.response.resultUrls.length?"grid-cols-1":"grid-cols-2"," gap-4"),children:N.response&&N.response.resultUrls.map((e,t)=>(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("img",{className:"h-auto max-h-[60vh] w-auto max-w-full rounded-xl object-contain ".concat(1===N.response.resultUrls.length?"h-full w-full":""),src:e,alt:"Record image"}),(0,r.jsx)("div",{className:"absolute bottom-[0.25rem] right-[0.25rem] cursor-pointer",children:(0,r.jsx)(y.Z,{onClick:()=>{H(e)},icon:"download",className:"w-8 rounded-md bg-[#545454c9] fill-[var(--tool-color-text-primary)] p-1 transition duration-500 group-hover:fill-[var(--tool-color-primary-contrast)]"})})]},t))})})}),N&&("GENERATE_FAILED"===N.status||"CREATE_TASK_FAILED"===N.status)&&(0,r.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4",children:[(0,r.jsx)(y.Z,{icon:"failed",className:"w-20"}),(0,r.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-1.5 px-4 text-center",children:[(0,r.jsx)("p",{className:"text-amber-500",children:N.errorMessage||s("image.state.failed")}),(0,r.jsx)("p",{className:"txt-xs text-amber-500",children:s("playground.generationFailedCredits")})]})]})]})})]})]}),(0,r.jsx)(w.default,{isOpen:q,onClose:()=>K(!1)})]})}),A=N()(()=>Promise.resolve(S),{ssr:!1}),P=(0,s.Pi)(()=>(0,r.jsx)("div",{className:"relative h-full w-full",children:(0,r.jsx)("div",{className:"relative flex w-full flex-col items-start justify-between overflow-hidden lg:h-full lg:flex-row lg:gap-8",children:(0,r.jsx)(A,{})})}))},80684:function(e,t,a){"use strict";a.d(t,{u:function(){return P}});var r=a(39696),l=a(82135),s=a(90170),n=a(18604),i=a(18595),o=a(59213),d=a(12732),c=a(12245),u=a(2453),p=a(44965),m=a(26716),g=a(18492),h=a(56156),x=a(27220),f=a(84140),y=a(2365),v=a(93219),b=a(68237),w=a(19266),j=a(53070),k=a(49650),N=a(4993),E=a(10929),C=a(36380),I=a.n(C);let S=[{videoUrl:"https://file.aiquickdraw.com/custom-page/akr/section-images/1755165674424x1b4oail.mp4"},{videoUrl:"https://file.aiquickdraw.com/custom-page/akr/section-images/17551656895566y0oseck.mp4"},{videoUrl:"https://file.aiquickdraw.com/custom-page/akr/section-images/17551657186411z6hm2ga.mp4"},{videoUrl:"https://file.aiquickdraw.com/custom-page/akr/section-images/17551657317626957bcbm.mp4"}],A=(0,l.Pi)(e=>{var t,a,l,C;let{}=e,{t:A}=(0,h.Z)("dashboard"),P=(0,b.useRouter)(),{userStore:D}
1=(0,x.o)(),[T,_]=(0,s.useState)(""),[R,F]=(0,s.useState)(!1),[M,O]=(0,s.useState)([]),[L,B]=(0,s.useState)([]),[U,Z]=(0,s.useState)(null),[z,q]=(0,s.useState)(!1),[K,G]=(0,s.useState)(!1),[W,V]=(0,s.useState)(0),[H,J]=(0,s.useState)(""),[$,Y]=(0,s.useState)(""),[X,Q]=(0,s.useState)(!1),ee=(0,s.useRef)(null),et=(0,s.useRef)(null),[ea,er]=(0,s.useState)(!1),el=e=>{let t=e[0];if(t){if(t.size>10485760){g.Am.error("Video size cannot exceed ".concat(10,"MB"));return}if(!["video/mp4","video/avi","video/mov","video/wmv","video/flv","video/webm"].includes(t.type)){g.Am.error("Only MP4, AVI, MOV, WMV, FLV and WEBM video formats are supported");return}F(!0),(0,p._R)(t,"kie-ai/veo3-video").then(e=>{_(e),F(!1)}).catch(e=>{console.error("Error uploading file:",e),g.Am.error("Upload failed, please try again"),F(!1)})}};(0,s.useEffect)(()=>{L.length>0&&(el(L),B([]))},[L]),(0,s.useEffect)(()=>{M.length>0&&el(M)},[M]);let es=async()=>{G(!0);try{await (0,m.$)(en()),G(!1)}catch(e){G(!1)}},en=()=>{if(U&&"success"===U.state){let e=U.response||U,t=(null==e?void 0:e.resultUrls)||(null==e?void 0:e.result_urls)||(null==e?void 0:e.resultUrl);if(Array.isArray(t)&&t.length>0)return t[0];if("string"==typeof t&&t)return t}return""},ei=e=>{let t=setInterval(async()=>{try{let a=await (0,i.Z)({headers:{Authorization:"Bearer ".concat(D.user.apiKey),"Content-Type":"application/x-www-form-urlencoded"},url:"".concat("https://api.kie.ai","/api/v1/modify/record-info?taskId=").concat(e),method:"GET"});if(200===a.data.code){let e=a.data.data,r=e.successFlag,l=e.response||e,s=(null==l?void 0:l.resultUrls)||(null==l?void 0:l.result_urls)||(null==l?void 0:l.resultUrl),n={...e,state:0===r?"generating":1===r?"success":"fail",response:l,videoInfo:l?{videoUrl:Array.isArray(s)?s[0]||null:"string"==typeof s?s:null}:null};if(Z(n),0===e.successFlag){if(et.current){let e=Date.now()-et.current;V(Math.floor(Math.min(e/36e4*99,99)))}}else q(!1),clearInterval(t),1===e.successFlag&&V(100)}else clearInterval(t),q(!1),g.Am.error(a.data.msg)}catch(e){console.log(e),clearInterval(t),q(!1)}},1500)},eo=async()=>{if(!D.user){er(!0);return}if(!D.user.apiKey){g.Am.error(A("toast.apiKeyEmpty")),P.push("/api-key");return}if(!H){g.Am.error(A("toast.promptEmpty"));return}if(!T){g.Am.error(A("toast.videoEmpty"));return}if(!z){U&&Z(null),V(0),q(!0);try{var e;let t=await (0,i.Z)({headers:{Authorization:"Bearer ".concat(null===(e=D.user)||void 0===e?void 0:e.apiKey),"Content-Type":"application/json"},url:"".concat("https://api.kie.ai","/api/v1/modify/generate"),method:"POST",data:{prompt:H,callBackUrl:"playground",waterMark:$,videoUrl:T}});200===t.data.code?(ei(t.data.data.taskId),D.loadUserInfo(),et.current=Date.now()):(402===t.data.code?Q(!0):g.Am.error(t.data.msg),q(!1))}catch(e){console.log(e),q(!1),g.Am.error(A("toast.serverAbnormal"))}}};return(0,r.jsxs)("div",{className:"relative h-full w-full",children:[D.user&&(0,r.jsx)("div",{className:"absolute right-0 top-0 flex justify-end",children:(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-lg bg-gradient-to-r from-violet-50 to-indigo-50 px-3 py-1.5 shadow-sm",children:[(0,r.jsxs)("span",{className:"text-sm font-medium text-default-400",children:[A("playground.credits"),":"]}),(0,r.jsx)("span",{className:"bg-gradient-to-r from-violet-600 to-indigo-600 bg-clip-text text-base font-bold text-transparent",children:(null===(a=D.user)||void 0===a?void 0:null===(t=a.credits)||void 0===t?void 0:t.toLocaleString())||0}),(0,r.jsx)(f.JO,{icon:"solar:medal-star-bold",className:"h-5 w-5 text-amber-500"})]})}),(0,r.jsx)("div",{className:"mt-6 h-full w-full lg:mt-0",children:(0,r.jsxs)("div",{className:"flex h-full w-full flex-col items-start rounded-xl bg-[rgba(var(--tool-color-rgb),0.02)] lg:flex-row",children:[(0,r.jsx)("div",{className:"w-full text-sm lg:h-full lg:w-[30%]",children:(0,r.jsxs)("div",{className:"w-full flex-col lg:flex lg:h-full",children:[(0,r.jsxs)("div",{className:"flex flex-col items-start gap-2 overflow-auto p-4 pt-1",children:[(0,r.jsx)("div",{className:"flex w-full flex-col items-start space-y-2",children:(0,r.jsxs)("div",{className:"w-full rounded-lg bg-[var(--tool-color-background)] p-2.5 text-[var(--tool-color-text-primary)]",children:[(0,r.jsxs)("label",{className:"mb-2 inline-flex w-full items-center gap-1 text-sm font-medium",children:[A("video.label.video"),(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)("div",{className:(0,E.cn)("relative flex aspect-[2/1] w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed text-center transition duration-500 hover:border-blue-500",T?"border-blue-500":"border-default-200"),onClick:()=>{var e;return null===(e=ee.current)||void 0===e?void 0:e.click()},onDrop:e=>{e.preventDefault();let t=e.dataTransfer.files,a=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.type.startsWith("video/")){a.push(r);break}}a.length>0?O([...a]):O([])},onDragOver:e=>{e.preventDefault()},onPaste:e=>{e.preventDefault();let t=e.clipboardData.items,a=[...L];for(let e=0;e<t.length;e++){let r=t[e];if("file"===r.kind&&r.type.startsWith("video/")){let e=r.getAsFile();a.push(e);break}}a.length>0&&B(a)},children:[T?(0,r.jsxs)("div",{className:"flex h-full w-full items-center justify-center",children:[(0,r.jsx)("video",{src:T,className:"h-auto max-h-full w-auto max-w-full",autoPlay:!0,loop:!0,muted:!0}
1),(0,r.jsx)("button",{className:"absolute right-1 top-1 inline-flex h-6 w-6 items-center justify-center rounded-full bg-default-500 text-default-100 shadow-md transition duration-500 hover:opacity-80",onClick:e=>{e.stopPropagation(),_(""),ee.current&&(ee.current.value=null)},children:(0,r.jsx)(j.Z,{width:16})})]}):(0,r.jsx)("div",{className:"flex flex-col items-center justify-center gap-2 py-6",children:R?(0,r.jsx)("div",{className:"flex flex-col items-center justify-center",children:(0,r.jsx)(d.Z,{color:"#006fee",size:10,margin:5})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k.Z,{className:"mx-auto h-10 w-10 text-default-400"}),(0,r.jsx)("p",{className:"text-sm text-default-600",children:A("video.placeholder.video")}),(0,r.jsx)("p",{className:"text-xs text-default-500",children:A("video.label.supportedVideo",{maxSize:10})})]})}),(0,r.jsx)("input",{type:"file",ref:ee,onChange:e=>el(e.target.files),accept:"video/*",className:"hidden"})]})]})}),(0,r.jsx)("div",{className:"flex w-full flex-col items-start space-y-2",children:(0,r.jsxs)("div",{className:"w-full rounded-lg bg-[var(--tool-color-background)] p-2.5 text-[var(--tool-color-text-primary)]",children:[(0,r.jsxs)("label",{className:"mb-2 block w-full gap-1 text-sm font-medium",children:[A("video.label.motionPrompt"),(0,r.jsx)("span",{className:"text-red-500",children:" *"})]}),(0,r.jsx)("div",{className:"relative w-full",children:(0,r.jsx)("textarea",{value:H,onChange:e=>J(e.target.value),placeholder:A("video.placeholder.motionPrompt"),className:"h-24 w-full resize-none overflow-y-auto rounded-lg border-none bg-[rgba(var(--tool-color-rgb),0.02)] p-2 text-sm outline outline-1 -outline-offset-1 outline-transparent placeholder:text-xs placeholder:text-[var(--tool-color-text-placeholder)] hover:outline-[var(--tool-color-primary)] focus:outline-[var(--tool-color-primary)] lg:h-36"})})]})}),(0,r.jsx)("div",{className:"flex w-full flex-col items-start space-y-2",children:(0,r.jsxs)("div",{className:"w-full rounded-lg bg-[var(--tool-color-background)] p-2.5 text-[var(--tool-color-text-primary)]",children:[(0,r.jsx)("label",{className:"mb-2 block w-full gap-1 text-sm font-medium",children:A("video.label.watermark")||"Watermark"}),(0,r.jsx)("div",{className:"relative w-full",children:(0,r.jsx)("input",{type:"text",value:$,onChange:e=>Y(e.target.value),placeholder:A("video.placeholder.watermark")||"Enter watermark text (
1optional)",className:"h-10 w-full rounded-lg border-none bg-[rgba(var(--tool-color-rgb),0.02)] p-2 text-sm outline outline-1 -outline-offset-1 outline-transparent placeholder:text-xs placeholder:text-[var(--tool-color-text-placeholder)] hover:outline-[var(--tool-color-primary)] focus:outline-[var(--tool-color-primary)]"})})]})})]}),(0,r.jsx)("div",{className:"flex flex-col gap-3 px-4",children:(0,r.jsxs)("button",{onClick:eo,className:"inline-flex w-full cursor-pointer items-center justify-center gap-2 rounded-full bg-gradient-to-t from-[var(--tool-color-primary-dark)] to-[var(--tool-color-primary-light)] px-2 py-2.5 text-center text-white transition duration-500 hover:scale-95",children:[D.user&&D.user.consumeCreditsMap&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-white",children:[(0,r.jsx)(N.Z,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"text-sm",children:(null===(C=D.user)||void 0===C?void 0:null===(l=C.consumeCreditsMap)||void 0===l?void 0:l.luma_modify_generate)||50}),(0,r.jsx)("span",{className:"ml-2 h-4 w-[1px] bg-white/30"})]}),A("video.generateBtn"),z&&(0,r.jsx)(d.Z,{color:"var(--tool-color-primary-contrast)",size:6})]})})]})}),(0,r.jsx)("div",{className:"relative m-auto flex w-full flex-col items-center justify-center lg:h-[80vh] lg:w-[70%]",children:(0,r.jsx)("div",{className:"relative flex h-full w-full items-center justify-center p-4 lg:p-2",children:(()=>{if(U)switch(U.state){case"success":return(0,r.jsxs)("div",{className:"flex w-full flex-col items-center justify-center",children:[(0,r.jsx)("video",{className:"m-0 max-h-[200px] rounded-xl lg:max-h-[450px]",autoPlay:!0,muted:!0,controls:!0,children:(0,r.jsx)("source",{src:en(),type:"video/mp4"})}),(0,r.jsx)("div",{className:"absolute bottom-5 right-5 aspect-square w-8 rounded-xl bg-[var(--tool-color-primary)] backdrop-blur-md lg:bg-[rgba(var(--tool-color-rgb),0.05)] ".concat(K?"cursor-not-allowed":"group cursor-pointer transition duration-500 lg:hover:bg-[var(--tool-color-primary)]"," inline-flex items-center justify-center"),children:K?(0,r.jsx)(o.Z,{color:"var(--tool-color-text-primary)",size:14}):(0,r.jsx)(n.Z,{onClick:es,icon:"download",className:"w-5 fill-[var(--tool-color-primary-contrast)] transition duration-500 lg:fill-[var(--tool-color-text-primary)] lg:group-hover:fill-[var(--tool-color-primary-contrast)]"})})]});case"wait":return(0,r.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,r.jsx)(n.Z,{icon:"logo",className:"w-20 animate-bounce fill-[var(--tool-color-primary)]"}),(0,r.jsxs)("p",{className:"flex w-full items-center justify-center gap-1 text-[var(--tool-color-text-primary)]",children:[A("video.waitingStart"),(0,r.jsx)(d.Z,{color:"var(--tool-color-text-primary)",size:4})]})]});case"queuing":return(0,r.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,r.jsx)(n.Z,{icon:"logo",className:"w-20 animate-bounce fill-[var(--tool-color-primary)]"}),(0,r.jsxs)("p",{className:"flex w-full items-center justify-center gap-1 text-[var(--tool-color-text-primary)]",children:[A("video.queue"),(0,r.jsx)(c.Z,{color:"var(--tool-color-text-primary)",size:18})]})]});case"generating":return(0,r.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,r.jsxs)("div",{className:"relative w-2/3 overflow-hidden rounded-xl",children:[(0,r.jsx)(I(),{width:100,height:100,src:"https://file.aiquickdraw.com/custom-page/image/1733384621863dr5jxiyq.webp",alt:"image",className:"w-full opacity-20"}),(0,r.jsx)("div",{className:"absolute left-1/2 top-1/2 inline-block -translate-x-1/2 -translate-y-1/2",children:(0,r.jsx)(u.Z,{size:60,color:"var(--tool-color-primary)"})})]}),(0,r.jsxs)("p",{className:"flex w-full items-center justify-center gap-2 text-[var(--tool-color-text-primary)]",children:[A("video.generationProgress"),(0,r.jsxs)("span",{className:"font-semibold text-[var(--tool-color-primary)]",children:[W,"%"]})]}),(0,r.jsx)("p",{className:"mt-1 w-full whitespace-pre-wrap break-words px-3 text-center text-sm text-default-500 md:px-10",children:A("video.generatingTime",{time:"6-7"})})]});case"fail":return(0,r.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4",children:[(0,r.jsx)(n.Z,{icon:"generate_failed",className:"w-20 fill-amber-500"}),(0,r.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-1.5 px-4 text-center",children:[(0,r.jsx)("p",{className:"text-amber-500",children:A("video.failed")}),U.errorMessage&&(0,r.jsx)("p",{className:"-mt-4 text-amber-500",children:U.errorMessage}),(0,r.jsx)("p",{className:"txt-xs text-amber-500",children:A("playground.generationFailedCredits")})]})]});default:return null}return(0,r.jsx)("div",{className:"mt-[10vh] flex h-full w-full flex-col items-center justify-start p-4 lg:p-8",children:(0,r.jsx)(w.$,{videos:S})})})()})})]})}),(0,r.jsx)(y.default,{isOpen:ea,onClose:()=>er(!1)}),(0,r.jsx)(v.Z,{isOpen:X,onClose:()=>Q(!1)})]})}),P=(0,l.Pi)(()=>(0,r.jsx)("div",{className:"relative w-full",children:(0,r.jsx)("div",{className:"flex w-full flex-col items-start justify-between overflow-hidden lg:h-full lg:flex-row lg:gap-8",children:(0,r.jsx)(A,{})})}))},32915:function(e,t,a){"use strict";a.d(t,{M9:function(){return C},ZP:function(){return I}});var r=a(39696),l=a(90170),s=a(5270),n=a.n(s),i=a(6924);a(66461);var o=a(68237),d=a(7510),c=a(28500),u=a(62668);a(51615);var p=a(27220),m=a(35397),g=a(82135);
1class h extends Error{constructor(e,t=500,a=null,r){super(e),this.name="ApiError",this.data=a,this.code=t,this.details=r,Object.setPrototypeOf(this,h.prototype)}get msg(){return this.message}}async function x(e,t){switch(t){case"text":return e.text();case"blob":return e.blob();case"arrayBuffer":return e.arrayBuffer();default:return e.json()}}class f{constructor(e={}){this.requestInterceptors=[],this.responseInterceptors=[],this.config={baseURL:"",timeout:6e4,headers:{"Content-Type":"application/json"},...e},e.requestInterceptors&&(this.requestInterceptors=e.requestInterceptors),e.responseInterceptors&&(this.responseInterceptors=e.responseInterceptors),this.addRequestInterceptor(async e=>{let t=function(e){if("u">typeof window){let t=document.cookie.split("; ");for(let a=0;a<t.length;a++){let r=t[a].split("=");if(r[0]===e)return decodeURIComponent(r[1])}}return""}("authorization");if(t){if(e.headers||(e.headers={}),e.headers instanceof Headers){let t={};e.headers.forEach((e,a)=>{t[a]=e}),e.headers=t}e.headers.authorization=t}return e})}addRequestInterceptor(e){this.requestInterceptors.push(e)}addResponseInterceptor(e){this.responseInterceptors.push(e)}async request(e,t={}){try{var a,r;let l,s,n={...t,baseURL:t.baseURL||this.config.baseURL,timeout:t.timeout||this.config.timeout,headers:function(...e){let t=new Headers;return e.forEach(e=>{e&&new Headers(e).forEach((e,a)=>{t.set(a,e)})}),t}(this.config.headers,t.headers)};for(let e of this.requestInterceptors)n=await e(n);let i=(a=n.baseURL||"",r=n.params,l=!a&&/^https?:\/\//.test(e)?new URL(e):new URL(e,a),r&&Object.keys(r).forEach(e=>{let t=r[e];null!=t&&l.searchParams.append(e,String(t))}),l.toString()),{signal:o,clear:d}=function(e){let t;let a=new AbortController;return e&&e>0&&(t=setTimeout(()=>{a.abort()},e)),{signal:a.signal,clear:()=>{t&&clearTimeout(t)}}}(n.timeout),c=await fetch(i,{...n,signal:o});if(d(),!c.ok)throw Error(`HTTP error! status: ${c.status}`);let u=await x(c,n.responseType);if("json"===(n.responseType||"json")){if(u&&"object"==typeof u&&"code"in u){if(200!==u.code)throw new h(u.message||u.msg||"API request failed",u.code,u.data||null,u);s={data:u.data,success:!0,code:u.code,message:u.message||u.msg}}else s={data:u,success:!0,code:200}}else s={data:u,code:200,success:!0};for(let e of this.responseInterceptors)s=await e(s);return s}catch(e){throw e instanceof h?e:new h(e instanceof Error?e.message:"Unknown error",500,null,e)}}async get(e,t){return this.request(e,{...t,method:"GET"})}async post(e,t,a){return this.request(e,{...a,method:"POST",body:t?JSON.stringify(t):void 0})}async put(e,t,a){return this.request(e,{...a,method:"PUT",body:t?JSON.stringify(t):void 0})}async delete(e,t){return this.request(e,{...t,method:"DELETE"})}async patch(e,t,a){return this.request(e,{...a,method:"PATCH",body:t?JSON.stringify(t):void 0})}}let y=new f;y.get.bind(y),y.post.bind(y),y.put.bind(y),y.delete.bind(y),y.patch.bind(y),a(49517),a(95777),a(37452),a(34611),a(23236);var v=a(82937);a(10929),a(49333);var b=a(17941);a(3580);var w=a(10841),j=a(2649),k=a(95866),N=a(38489);let E=(0,g.Pi)(e=>{var t,a,s,g,h,x;let{pageInfo:f,navigationData:y,listCarouselCommon:E,carouselSecondaryPageList:C}=e,I=m.locales.filter(e=>(f.successLanguages||[]).includes(e)),S=(0,o.useRouter)(),{userStore:A}=(0,p.o)(),[P,D]=(0,l.useState)(!1);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n(),{children:[(0,r.jsx)("title",{children:null===(s=f.content)||void 0===s?void 0:null===(a=s.root)||void 0===a?void 0:null===(t=a.props)||void 0===t?void 0:t.title}),(0,r.jsx)("meta",{name:"description",content:null===(x=f.content)||void 0===x?void 0:null===(h=x.root)||void 0===h?void 0:null===(g=h.props)||void 0===g?void 0:g.description}),(0,i.TT)(S.locale,f.path,I),(0,i.Hb)(S,f.path,I)]}),(0,r.jsx)(b.Z,{supportedLanguages:I,navigationData:y}),(0,r.jsx)("div",{className:"relative h-full w-full pt-20",children:(0,r.jsx)("main",{className:"h-full",children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Xx,{pageData:f,language:S.locale,userInfo:null,siteConfig:{domain:"kie.ai",apiUrl:"https://platform.kie.ai",logoUrl:"/logo.png"},openLoginModal:()=>D(!0),openRechargeModal:()=>D(!0),createTurnstile:e=>{let{verifyLoading:t,onSuccess:a}=e;return(0,r.jsx)(u.n,{verifyLoading:t,success:a,siteKey:A.user?"7fba9ed0-f184-4c12-9e2e-2584ee14cd78":"6520ce9c-a8b2-4cbe-b698-687e90448dec"})},createPayInfo:e=>(0,r.jsx)(w.Z,{}),baseUrl:"https://platform.kie.ai",createChatContentMarkdown:e=>(0,r.jsx)(v.Z,{children:e}),openTransformImage:!0}),(0,r.jsx)(d.Z,{carouselSecondaryPageList:C,listCarouselCommon:E})]})})}),(0,r.jsx)(j.R,{isOpen:P,onClose:()=>D(!1),size:"5xl",children:(0,r.jsx)(k.A,{children:(0,r.jsx)(N.I,{className:"py-14",children:(0,r.jsx)(w.Z,{})})})})]})}),C="DynamicPage";var I=E},76260:function(e,t,a){"use strict";a.d(t,{F:function(){return r}});let r=[{name:"English",code:"en"},{name:"ç®ä½ä¸æ",code:"zh-CN"},{name:"Espa\xf1ol",code:"es"},{name:"Fran\xe7ais",code:"fr"},{name:"Deutsch",code:"de"},{name:"Ð ÑÑÑкий",code:"ru"},{name:"æ¥æ¬èª",code:"ja"},{name:"Ø§ÙØ¹Ø±Ø¨ÙØ©",code:"ar"},{name:"Portugu\xeas",code:"pt"},{name:"Italiano",code:"it"},{name:"Bahasa Indonesia",code:"id"},{name:"Nederlands",code:"nl"},{name:"Tiếng Viá»t",code:"vi"},{name:"T\xfcrk\xe7e",code:"tr"},{name:"íêµì´",code:"ko"},{name:"ÙØ§Ø±Ø³Û",code:"fa"},{name:"हिनà¥à¤¦à¥",code:"hi"}]},57427:function(e,t,a){"use strict";a.d(t,{Z:function(){return p}});var r=a(39696),l=a(90170),s=a(74111),n=a(32324),i=a(84140),o=a(56156),d=a(49333);let c=e=>{let t=[];return e&&(t.push(e),e.includes("-")&&t.push(e.split("-")[0])),t.push("en"),[...new Set(t.filter(Boolean))]},u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(!e||"object"!=typeof e)return"";for(let a of c(t)){let t=e[a];if("string"==typeof t&&t.trim())return t.trim()}let a=Object.values(e).find(e=>"string"==typeof e&&e.trim());return"string"==typeof a?a.trim():""};function p(){let{t:e,lang:t}=(0,o.Z)("common"),[a,c]=(0,l.useState)(!1),[p,m]=(0,l.useState)(null),g=(0,l.useCallback)(()=>{c(!0)},[]);(0,l.useEffect)(()=>{let e=!0;return(async()=>{let t=await (0,d.PF)();e&&m(t||null)})(),()=>{e=!1}},[]);let h=(0,l.useMemo)(()=>u(null==p?void 0:p.translations,t),[p,t]);if((0,l.useEffect)(()=>{c(!1)},[null==p?void 0:p.linkUrl,null==p?void 0:p.buttonText,h]),a||!(null==p?void 0:p.enabled)||!h)return null;let x="blank"===p.jumpType,f=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.JO,{icon:"iconoir:sound-high-solid",className:"h-3 w-3 shrink-0 md:h-4 md:w-4","aria-hidden":!0}),(0,r.jsx)("span",{children:h}),p.buttonText?(0,r.jsx)("span",{className:"rounded-full bg-white/15 px-2 py-0.5 text-[11px] font-semibold text-white/95 md:text-xs",children:p.buttonText}):null]});return(0,r.jsx)("section",{className:"relative z-[1] w-full bg-gradient-to-r from-blue-500 via-sky-600 to-indigo-700 p-1.5 md:p-3",role:"region","aria-label":e("topBanner.regionAria"),children:(0,r.jsxs)("div",{className:"relative flex items-center justify-center pr-10 md:pr-12",children:[p.linkUrl?(0,r.jsx)(s.O,{href:p.linkUrl,target:x?"_blank":void 0,rel:x?"noopener noreferrer":void 0,className:"flex items-center gap-2 text-left text-xs font-semibold leading-snug text-gray-100 underline-offset-2 hover:underline md:text-sm","aria-label":e("topBanner.linkAria"),children:f}):(0,r.jsx)("div",{className:"flex items-center gap-2 text-left text-xs font-semibold leading-snug text-gray-100 md:text-sm",children:f}),(0,r.jsx)(n.A,{isIconOnly:!0,size:"sm",variant:"light",radius:"full","aria-label":e("topBanner.closeAria"),onPress:g,className:"absolute right-2 top-1/2 h-8 min-w-8 -translate-y-1/2 text-default-200 hover:bg-white/20",children:(0,r.jsx)(i.JO,{icon:"mdi:close",className:"text-lg","aria-hidden":!0})})]})})}},45883:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var r=a(39696),l=a(90170),s=a(53070),n=a(73868),i=a(2374);function o(e){let{imageUrl:t,fileType:a="image",setIsPreviewOpen:o,overlayClassName:d=""}=e,[c,u]=(0,l.useState)(!0),[p,m]=(0,l.useState)(!1);(0,l.useEffect)(()=>{u(!0),m(!1)},[t]);let g=()=>{u(!1)},h=()=>{u(!1),m(!0)};return(0,r.jsxs)("div",{className:"fixed inset-0 ".concat(d||"z-50"," flex items-center justify-center bg-black/80 p-4 backdrop-blur-sm"),onClick:()=>o(!1),children:[(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),o(!1)},className:"absolute right-4 top-4 z-10 flex h-10 w-10 items-center justify-center rounded-full bg-white/10 text-white backdrop-blur-sm transition-colors hover:bg-white/20",children:(0,r.jsx)(s.Z,{className:"h-5 w-5"})}),(0,r.jsxs)("div",{className:"relative max-h-[90vh] max-w-full",onClick:e=>e.stopPropagation(),children:[c&&(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3",children:[(0,r.jsx)(n.Z,{className:"h-8 w-8 animate-spin text-white"}),(0,r.jsx)("p",{className:"text-sm text-white/80",children:"å è½½ä¸..."})]}),p&&(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3",children:[(0,r.jsx)(i.Z,{className:"h-12 w-12 text-white/60"}),(0,r.jsx)("p",{className:"text-sm text-white/80",children:"å¾çå 载失败"}),(0,r.jsx)("button",{onClick:()=>{m(!1),u(!0);let e=document.querySelector("img[data-preview-image]");
1e&&(e.src=t+"?t="+Date.now())},className:"mt-2 rounded-lg bg-white/20 px-4 py-2 text-sm text-white transition-colors hover:bg-white/30",children:"éè¯"})]}),"image"===a&&!p&&(0,r.jsx)("img",{"data-preview-image":!0,src:t,alt:"Preview",className:"h-auto max-h-[90vh] w-auto max-w-full object-contain shadow-2xl transition-opacity duration-300 ".concat(c?"opacity-0":"opacity-100"),onLoad:g,onError:h,style:{display:c?"none":"block"}}),"video"===a&&!p&&(0,r.jsx)("video",{src:t,className:"h-auto max-h-[90vh] w-auto max-w-full object-contain shadow-2xl transition-opacity duration-300 ".concat(c?"opacity-0":"opacity-100"),controls:!0,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,onLoadedData:g,onError:h,style:{display:c?"none":"block"}})]})]})}},60151:function(e,t,a){"use strict";var r=a(39696);a(90170);var l=a(69395),s=a(80328),n=a(17305);a(13891),a(49517),a(95777),a(37452),a(34611),a(23236);let i=e=>{if(!e)return null;if("object"==typeof e)return e;try{return JSON.parse(e)}catch(e){return null}};t.Z=function(e){let{aggregateRating:t,contentData:a,userPath:o,path:d}=e;if(!a)return null;let c=[o,d].filter(Boolean).join("/");return(0,r.jsxs)("section",{id:"readme","aria-labelledby":"readme-title",className:"mt-10 min-w-0 scroll-mt-28",children:[(0,r.jsxs)("header",{className:"mb-4 flex items-start gap-3 px-1 sm:items-center",children:[(0,r.jsx)("div",{"aria-hidden":"true",className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-gray-200 bg-gray-50 text-gray-600 shadow-sm dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",children:(0,r.jsx)(n.Z,{className:"h-5 w-5",strokeWidth:1.8})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h2",{id:"readme-title",className:"text-xl font-semibold tracking-tight text-gray-950 dark:text-white",children:"README"}),c&&(0,r.jsxs)("p",{className:"mt-0.5 text-sm leading-6 text-gray-500 dark:text-gray-400",children:["Complete guide to using"," ",(0,r.jsx)("span",{className:"break-all font-medium text-gray-700 dark:text-gray-300",children:c})]})]})]}),(0,r.jsxs)("div",{className:"relative left-1/2 w-[100dvw] min-w-0 -translate-x-1/2 border-y border-gray-200/80 bg-white dark:border-gray-700 dark:bg-gray-800",children:[(0,r.jsx)("div",{className:"h-px w-full bg-gradient-to-r from-transparent via-gray-300/70 to-transparent dark:via-gray-600/70"}),(0,r.jsx)("div",{className:"w-full min-w-0 overflow-x-auto",children:(0,r.jsx)(l.Hr,{config:s.Z0,data:a,metadata:{openTransformImage:!0,aggregateRating:i(t)}})})]})]})}},47451:function(e,t,a){"use strict";let r,l,s,n,i;a.d(t,{Z:function(){return ns}});var o,d,c,u,p,m,g,h,x,f,y,v,b,w,j,k,N=a(39696),E=a(90170),C=a(17941),I=a(4993),S=a(67629),A=a(63698),P=a(31749),D=a(84140),T=a(80356),_=a(27220),R=a(94721),F=a(99953),M=a(98452),O=a(50753),L=a(55710),B=a(29565);let U=async e=>{let t=await fetch("https://api.kie.ai"+"/api/v1/playground/getGroupPlayGroundModelData?model=".concat(e));return await t.json()};var Z=a(83460),z=a(44568);let q=e=>{try{return JSON.parse(e||"{}")}catch(e){return{}}},K=e=>{var t,a,r,l,s,n,i,o,d,c,u,p,m,g;let{type:h,props:x}=e||{};if(!x)return[];let f=x.note||x.placeholder||"";if("PlaygroundFrameUploader"===h){let e=(0,Z.RV)(x),{primaryKey:n,secondaryKey:i}=(0,Z.LB)(x),o=(0,Z.hD)(x.acceptedFileTypes);if("single"===x.fieldMode)return n?[{key:n,type:"array",required:!!(null===(t=e[0])||void 0===t?void 0:t.required),description:x.actionDescription||f||"Frame image URLs (array; first item = start frame, second item = end frame).",maxFileSize:x.maxFileSize,acceptedFileTypes:o}]:[];let d=[];return n&&d.push({key:n,type:"string",required:!!(null===(a=e[0])||void 0===a?void 0:a.required),description:[null===(r=e[0])||void 0===r?void 0:r.label,f].filter(Boolean).join(". "),maxFileSize:x.maxFileSize,acceptedFileTypes:o}),i&&d.push({key:i,type:"string",required:!!(null===(l=e[1])||void 0===l?void 0:l.required),description:[null===(s=e[1])||void 0===s?void 0:s.label,f].filter(Boolean).join(". "),maxFileSize:x.maxFileSize,acceptedFileTypes:o}),d}if("PlaygroundKlingShots"===h){let e=x.multiShotsKey||"multi_shots",t=x.promptKey||"prompt",a=x.durationKey||"duration",r=x.multiPromptKey||"multi_prompt",l=x.elementsKey||"kling_elements",s=null!==(n=x.maxShots)&&void 0!==n?n:5,h=null!==(i=x.totalMax)&&void 0!==i?i:15,f=null!==(o=x.perShotMin)&&void 0!==o?o:1,y=null!==(d=x.perShotMax)&&void 0!==d?d:12,v=null!==(c=x.singleMin)&&void 0!==c?c:3,b=null!==(u=x.singleMax)&&void 0!==u?u:15,w=(0,z.pb)(x);return[{key:e,type:"boolean",required:!1,description:"Whether to use multi-shot mode. true enables multi-shot mode, false enables single-shot mode.",defaultValue:!1},{key:t,type:"string",required:!1,description:"Shot prompt text. Takes effect when `".concat(e,"` is false. Max ").concat(null!==(p=x.promptMaxLength)&&void 0!==p?p:2500," characters.")},...w?[]:[{key:a,type:"number",required:!1,description:"Total duration in seconds. Single-shot mode range: ".concat(v,"-").concat(b,"; in multi-shot mode this is the sum of each shot's duration.")}],{key:r,type:"array",required:!1,description:w?"Array of {prompt} shots. Takes effect when `".concat(e,"` is true. Max ").concat(s," shots, prompt max ").concat(null!==(m=x.multiPromptMaxLength)&&void 0!==m?m:500," characters per shot."):"Array of {prompt, duration} shots. Takes effect when `".concat(e,"` is true. Max ").concat(s," shots, total duration ⤠").concat(h,"s, each shot ").concat(f,"-").concat(y,"s, prompt max ").concat(null!==(g=x.multiPromptMaxLength)&&void 0!==g?g:500," characters per shot."),skipInExample:!0},{key:l,type:"array",required:!1,description:"Referenced elements. Each item: {name, description, element_input_urls, element_input_audio_urls?, start_time?, end_time?}.",defaultValue:[]}]}if("PlaygroundArrayForm"===h){let e=f;if("object"===x.itemType&&Array.isArray(x.objectSchema)){let t=x.objectSchema.map(e=>"".concat(e.key,"(").concat(e.valueType||"string",")")).join(", ");e=[f,"Each item: {".concat(t,"}
1")].filter(Boolean).join(" ")}return[{key:x.parameterKey,type:"array",required:!!x.required,description:e,min:x.minLength,max:x.maxLength}]}return"PlaygroundUniversalForm"===h||"PlaygroundColorPalette"===h||"PlaygroundBBoxEditor"===h||"PlaygroundSunoVoice"===h?[{key:x.parameterKey,type:"PlaygroundSunoVoice"===h?"object":"array",required:!!x.required,description:[f,"(complex structure â see the Run with API example for the exact shape)"].filter(Boolean).join(" "),skipInExample:!0}]:[{key:x.parameterKey,type:W(h,x.multiple),componentType:h,required:!!x.required,description:"".concat("PlaygroundFileUpload"===h?"Please provide the URL of the uploaded file, ":"").concat(f),maxLength:x.maxLength,maxFileSize:x.maxFileSize,acceptedFileTypes:x.acceptedFileTypes,multiple:x.multiple,min:x.min,max:x.max,step:x.step,selectOption:x.selectOption,radioOptions:x.radioOptions,defaultValue:x.defaultValue}]},G=async e=>{let{userPath:t,path:a,playgroundData:r}=e,{formContent:l,outputMediaType:s,outputMediaUrls:n,resultObjectText:i}=q(r),o=t+(a?"/"+a:""),d=(o.split("/").pop()||"AI Model").replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase()),c="# ".concat(d," API Documentation\n\n> Generate content using the ").concat(d," model\n\n## Overview\n\nThis document describes how to use the ").concat(d," model for content generation. The process consists of two steps:\n1. Create a generation task\n2. Query task status and results\n\n## Authentication\n\nAll API requests require a Bearer Token in the request header:\n\n```\nAuthorization: Bearer YOUR_API_KEY\n```\n\nGet API Key:\n1. Visit [API Key Management Page](https://kie.ai/api-key) to get your API Key\n2. Add to request header: `Authorization: Bearer YOUR_API_KEY`\n\n---\n\n## 1. Create Generation Task\n\n### API Information\n- **URL**: `POST https://api.kie.ai/api/v1/jobs/createTask`\n- **Content-Type**: `application/json`\n\n### Request Parameters\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| model | string | Yes | Model name, format: `").concat(o,'` |\n| input | object | Yes | Input parameters object |\n| callBackUrl | string | No | Callback URL for task completion notifications. If provided, the system will send POST requests to this URL when the task completes (success or fail). If not provided, no callback notifications will be sent. Example: `"https://your-domain.com/api/callback"` |\n\n### Model Parameter\n\nThe `model` parameter specifies which AI model to use for content generation.\n\n| Property | Value | Description |\n|----------|-------|-------------|\n| **Format** | `').concat(o,"` | The exact model identifier for this API |\n| **Type** | string | Must be passed as a string value |\n| **Required** | Yes | This parameter is mandatory for all requests |\n\n> **Note**: The model parameter must match exactly as shown above. Different models have different capabilities and parameter requirements.\n\n### Callback URL Parameter\n\nThe `callBackUrl` parameter allows you to receive automatic notifications when your task completes.\n\n| Property | Value | Description |\n|----------|-------|-------------|\n| **Purpose** | Task completion notification | Receive real-time updates when your task finishes |\n| **Method** | POST request | The system sends POST requests to your callback URL |\n| **Timing** | When task completes | Notifications sent for both success and failure states |\n| **Content** | Query Task API response | Callback content structure is identical to the Query Task API response |\n| **Parameters** | Complete request data | The `param` field contains the complete Create Task request parameters, not just the input section |\n| **Optional** | Yes | If not provided, no callback notifications will be sent |\n\n**Important Notes:**\n- The callback content structure is identical to the Query Task API response\n- The `param` field contains the complete Create Task request parameters, not just the input section \n- If `callBackUrl` is not provided, no callback notifications will be sent\n\n### input Object Parameters\n\n"),u=(l||[]).flatMap(K);
1u.forEach(e=>{let{key:t,type:a,required:r,description:l,maxLength:s,maxFileSize:n,acceptedFileTypes:i,multiple:o,defaultValue:d,selectOption:u,radioOptions:p,min:m,max:g,step:h}=e;t&&(c+="#### ".concat(t,"\n")+"- **Type**: `".concat(a,"`\n")+"- **Required**: ".concat(r?"Yes":"No","\n")+"- **Description**: ".concat(l,"\n"),s&&(c+="- **Max Length**: ".concat(s," characters\n")),n&&(c+="- **Max File Size**: ".concat(n,"MB\n")),i&&i.length>0&&(c+="- **Accepted File Types**: ".concat(i.join(", "),"\n")),o&&(c+="- **Multiple Files**: Yes\n"),void 0!==m&&void 0!==g&&(c+="- **Range**: ".concat(m," - ").concat(g),h&&(c+=" (step: ".concat(h,")")),c+="\n"),u&&u.length>0&&(c+="- **Options**:\n",u.forEach(e=>{c+=" - `".concat(e.value,"`: ").concat(e.label).concat(e.description?" (".concat(e.description,")"):"","\n")})),p&&p.length>0&&(c+="- **Options**:\n",p.forEach(e=>{c+=" - `".concat(e.value,"`: ").concat(e.label,"\n")})),null!=d&&(c+="- **Default Value**: `".concat(JSON.stringify(d),"`\n")),c+="\n")}),c+='### Request Example\n\n```json\n{\n "model": "'.concat(o,'",\n "input": {\n');let p=u.filter(e=>e.key&&!e.skipInExample);p.forEach((e,t)=>{let a=V(e);c+=' "'.concat(e.key,'": ').concat(JSON.stringify(a)),t<p.length-1&&(c+=","),c+="\n"}),c+=' }\n}\n```\n### Response Example\n\n```json\n{\n "code": 200,\n "msg": "success",\n "data": {\n "taskId": "281e5b0*********************f39b9"\n }\n}\n```\n\n### Response Parameters\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| code | integer | Response status code, 200 indicates success |\n| msg | string | Response message |\n| data.taskId | string | Task ID for querying task status |\n\n---\n\n## 2. Query Task Status\n\n### API Information\n- **URL**: `GET https://api.kie.ai/api/v1/jobs/recordInfo`\n- **Parameter**: `taskId` (passed via URL parameter)\n\n### Request Example\n```\nGET https://api.kie.ai/api/v1/jobs/recordInfo?taskId=281e5b0*********************f39b9\n```\n';let m={model:o,input:{}};p.forEach(e=>{m.input[e.key]=V(e)});let g="";return s&&("image"===s||"media"===s||"video"===s?g=JSON.stringify({resultUrls:(null==n?void 0:n.map(e=>e.mediaUrl))||[]}):"text"===s&&(g=JSON.stringify({resultObject:i?q(i):{}}))),c+='\n### Response Example\n\n```json\n{\n "code": 200,\n "msg": "success",\n "data": {\n "taskId": "281e5b0*********************f39b9",\n "model": "'.concat(o,'",\n "state": "waiting",\n "param": "').concat(JSON.stringify(m).replace(/"/g,'\\"'),'",\n "resultJson": "').concat(g.replace(/"/g,'\\"'),'",\n "failCode": null,\n "failMsg": null,\n "costTime": null,\n "completeTime": null,\n "createTime": 1757584164490\n }\n}\n```\n\n### Response Parameters\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| code | integer | Response status code, 200 indicates success |\n| msg | string | Response message |\n| data.taskId | string | Task ID |\n| data.model | string | Model name used |\n| data.state | string | Task status: `waiting`(waiting), `success`(success), `fail`(fail) |\n| data.param | string | Task parameters (JSON string) |\n| data.resultJson | string | Task result (JSON string, available when task is success). Structure depends on outputMediaType: `{resultUrls: []}` for image/media/video, `{resultObject: {}}` for text |\n| data.failCode | string | Failure code (available when task fails) |\n| data.failMsg | string | Failure message (available when task fails) |\n| data.costTime | integer | Task duration in milliseconds (available when task is success) |\n| data.completeTime | integer | Completion timestamp (available when task is success) |\n| data.createTime | integer | Creation timestamp |\n\n---\n\n## Usage Flow\n\n1. **Create Task**: Call `POST https://api.kie.ai/api/v1/jobs/createTask` to create a generation task\n2. **Get Task ID**: Extract `taskId` from the response\n3. **Wait for Results**: \n - If you provided a `callBackUrl`, wait for the callback notification\n - If no `callBackUrl`, poll status by calling `GET https://api.kie.ai/api/v1/jobs/recordInfo`\n4. **Get Results**: When `state` is `success`, extract generation results from `resultJson`\n\n## Error Codes\n\n| Status Code | Description |\n|-------------|-------------|\n| 200 | Request successful |\n| 400 | Invalid request parameters |\n| 401 | Authentication failed, please check API Key |\n| 402 | Insufficient account balance |\n| 404 | Resource not found |\n| 422 | Parameter validation failed |\n| 429 | Request rate limit exceeded |\n| 500 | Internal server error |\n\n')},W=(e,t)=>{switch(e){case"PlaygroundInputNumber":case"PlaygroundSlider":return"number";case"PlaygroundFileUpload":if(t)return"array";return"string";case"PlaygroundSwitch":return"boolean";case"PlaygroundArrayForm":return"array";default:return"string"}},V=e=>{let t=e.defaultValue;return"PlaygroundFileUpload"===e.componentType&&Array.isArray(t)||("PlaygroundTextarea"===e.componentType?t=t||"Enter your prompt here...":"number"===e.type?t=null!=t?t:42:"boolean"===e.type?t=void 0===t||t:"array"!==e.type||Array.isArray(t)?"string"===e.type&&null==t&&(t=""):t=[]),t},H=async e=>{try{let t=await U(e);if(200===t.code)return{data:await G(t.data),msg:"success"};return{data:t.msg,msg:"fail"}}catch(e){return console.error(e),{data:e.message,msg:"fail"}}};var J=a(18492);function $(e){let{model:t,className:a=""}=e,[r,l]=(0,E.useState)(!1),[s,n]=(0,E.useState)(!1),[i,o]=(0,E.useState)(!1),[d,c]=(0,E.useState)({}),u=async()=>
1{if(!s&&!i){n(!0),o(!1);try{let e=d[t];e||(e=await H(t),c({...d,[t]:e})),"success"===e.msg?(await navigator.clipboard.writeText(e.data),n(!1),o(!0),setTimeout(()=>{o(!1)},2e3)):n(!1)}catch(e){console.error("Failed to copy markdown:",e),J.ZP.error("Failed to copy markdown"),n(!1)}}};return(0,N.jsxs)("div",{className:"flex min-w-[165px] items-center rounded-lg border border-gray-300 bg-white shadow-sm dark:border-gray-600 dark:bg-gray-800 ".concat(a),children:[(0,N.jsxs)("button",{onClick:u,disabled:s||i,className:"flex items-center rounded-bl-lg rounded-tl-lg px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 focus:outline-none disabled:cursor-not-allowed dark:text-gray-300 dark:hover:rounded-bl-lg dark:hover:rounded-tl-lg dark:hover:bg-gray-600 ".concat(s||i?"cursor-not-allowed":""),children:[s?(0,N.jsx)(D.JO,{icon:"svg-spinners:90-ring-with-bg",className:"mr-2 h-4 w-4 text-gray-600 dark:text-white"}):i?(0,N.jsx)(D.JO,{icon:"solar:check-circle-bold",className:"mr-2 h-4 w-4 text-green-600"}):(0,N.jsx)(D.JO,{icon:"solar:copy-bold",className:"mr-2 h-4 w-4"}),"Copy page"]}),(0,N.jsx)("div",{className:"h-6 w-px bg-gray-300 dark:bg-gray-600"}),(0,N.jsxs)(M.F,{onOpenChange:l,placement:"bottom-end",shouldBlockScroll:!1,children:[(0,N.jsx)(O.S,{children:(0,N.jsx)("button",{className:"flex items-center justify-center px-2 py-2 text-gray-700 transition-colors dark:text-gray-300",children:(0,N.jsx)(R.Z,{className:"h-4 w-4 transition-transform duration-200 ease-in-out ".concat(r?"rotate-180":"rotate-0")})})}),(0,N.jsxs)(L.a,{"aria-label":"Copy page options",className:"min-w-[280px]",children:[(0,N.jsx)(B.W,{className:"rounded-lg px-3 py-3 hover:bg-gray-100 dark:hover:bg-gray-700",startContent:(0,N.jsx)(D.JO,{icon:"solar:copy-bold",className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),children:(0,N.jsxs)("button",{className:"flex flex-col",disabled:s,onClick:u,children:[(0,N.jsx)("span",{className:"text-left font-medium text-gray-900 dark:text-white",children:"Copy page"}),(0,N.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Copy page as Markdown for LLMs"})]})},"copy-page"),(0,N.jsx)(B.W,{className:"rounded-lg px-3 py-3 hover:bg-gray-100 dark:hover:bg-gray-700",onPress:()=>{window.open("/model/".concat(t,".md"),"_blank")},startContent:(0,N.jsx)(D.JO,{icon:"solar:document-text-bold",className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),endContent:(0,N.jsx)(F.Z,{className:"h-4 w-4 text-gray-400"}),children:(0,N.jsxs)("div",{className:"flex flex-col",children:[(0,N.jsx)("span",{className:"font-medium text-gray-900 dark:text-white",children:"View as Markdown"}),(0,N.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"View this page as plain text"})]})},"view-markdown"),(0,N.jsx)(B.W,{className:"rounded-lg px-3 py-3 hover:bg-gray-100 dark:hover:bg-gray-700",startContent:(0,N.jsx)(D.JO,{icon:"simple-icons:openai",className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),onPress:()=>{window.open("https://chatgpt.com/?hints=search&prompt=Read+from+https://kie.ai/model/".concat(t,".md+so+I+can+ask+questions+about+it."),"_blank")},endContent:(0,N.jsx)(F.Z,{className:"h-4 w-4 text-gray-400"}),children:(0,N.jsxs)("div",{className:"flex flex-col",children:[(0,N.jsx)("span",{className:"font-medium text-gray-900 dark:text-white",children:"Open in ChatGPT"}),(0,N.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Ask questions about this page"})]})},"open-chatgpt"),(0,N.jsx)(B.W,{className:"rounded-lg px-3 py-3 hover:bg-gray-100 dark:hover:bg-gray-700",startContent:(0,N.jsx)(D.JO,{icon:"simple-icons:anthropic",className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),onPress:()=>{window.open("https://claude.ai/new?q=Read from https://kie.ai/model/".concat(t,".md so I can ask questions about it."),"_blank")},endContent:(0,N.jsx)(F.Z,{className:"h-4 w-4 text-gray-400"}),children:(0,N.jsxs)("div",{className:"flex flex-col",children:[(0,N.jsx)("span",{className:"font-medium text-gray-900 dark:text-white",children:"Open in Claude"}),(0,N.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Ask questions about this page"})]})},"open-claude")]})]})]})}var Y=a(82135),X=a(56156),Q=a(19609),ee=(0,Y.Pi)(function(e){var t,a,r;let{onTabChange:l,path:s,userPath:n,readmeData:i,hasPlaygroundData:o=!1,isFalOrReplicate:d=!0,sameGroupPlaygroundPageData:c=[],setCurrentPageData:u,pricingDescCn:p,pricingDesc:m,currentPageData:g,handlePageNavigation:h}=e,{userStore:x}=(0,_.o)(),[f,y]=(0,E.useState)(!1),{t:v}=(0,X.Z)("dashboard"),[b,w]=(0,E.useState)([]),[j,k]=(0,E.useState)(!1),C=()=>
1{l("api")},R=async e=>{k(!0);try{let t=await Q.Z.get("/api/v1/monitor/success-rate",{params:{model:e}});200===t.code?w(t.data):J.ZP.error(t.msg)}catch(e){J.ZP.error(e.message),console.log(e)}finally{k(!1)}},F=e=>({"Gemini 3.5 Flash OpenAI":"Gemini 3.5 Flash (openai)","Gemini 3 Flash":"Gemini 3 Flash (openai)","gemini-3-flash":"gemini-3-flash-openai","Gemini 3 Flash V1betamodels":"Gemini 3 Flash","gemini-3-flash-v1betamodels":"gemini-3-flash","Gemini 2.5 Flash":"Gemini 2.5 Flash (openai)","gemini-2.5-flash":"gemini-2.5-flash-openai","Gemini 2.5 Pro":"Gemini 2.5 Pro (openai)","gemini-2.5-pro":"gemini-2.5-pro-openai","Gemini 3 Pro":"Gemini 3 Pro (openai)","gemini-3-pro":"gemini-3-pro-openai","Gemini 3.1 Pro":"Gemini 3.1 Pro (openai)","gemini-3.1-pro":"gemini-3.1-pro-openai","GPT 5.4":"GPT 5.4 (response)","gpt-5-4":"gpt-5-4-openai-resp","GPT 5.5":"GPT 5.5 (response)","gpt-5-5":"gpt-5-5-openai-resp"})[e]||e,M=s?"".concat(n,"/").concat(s):n;(0,E.useEffect)(()=>{(null==x?void 0:x.user)&&0!==x.user.renewalFrequency&&M&&R(M)},[n,s,M,null==x?void 0:x.user]);let[O,L]=(0,E.useState)(null);(0,E.useEffect)(()=>{b.length>0&&L(b[b.length-1])},[b]);let B=async()=>{let e=F(n),t=s?"".concat(e,"/").concat(s):e;try{await navigator.clipboard.writeText(t),y(!0),setTimeout(()=>y(!1),2e3)}catch(e){}},U=(e,t)=>{let a=new URL(window.location),r=t?"".concat(e,"/").concat(t):e;a.searchParams.set("model",r),window.history.pushState({...window.history.state},"",a.toString())},Z=e=>e?e.replace(/-/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):"",z=e=>{if(null==e||""===e)return"";"string"==typeof e&&/^\d+$/.test(e)&&(e=parseInt(e,10));let t=new Date("number"==typeof e&&e<1e12?1e3*e:e);if(Number.isNaN(t.getTime()))return String(e);let a=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),l=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),n=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return"".concat(a,"-").concat(r,"-").concat(l," ").concat(s,":").concat(n,":").concat(i)},q=(null==c?void 0:c.map(e=>({key:"".concat(e.userPath,"/").concat(e.path||""),label:Z(e.path||e.userPath),userPath:e.userPath,path:e.path})))||[],K="".concat(n,"/").concat(s||""),G=n+(s?"/"+s:""),W=(0,E.useMemo)(()=>0===b.length?null:b.map((e,t)=>{var a,r;let l=null==e.successRate&&null==e.errorRate;return(0,N.jsx)("div",{className:"h-full flex-1 opacity-0",style:{animation:"barSpread 0.5s ease-out forwards",animationDelay:"".concat(8*Math.abs(t-72),"ms")},children:(0,N.jsx)("div",{onMouseEnter:()=>L(e),className:"flex h-full w-full origin-center cursor-pointer flex-col transition-all duration-200 ease-in-out hover:z-10 hover:scale-y-[1.8]",children:l?(0,N.jsx)("div",{className:"rounded-[1px] bg-gray-400/70 hover:bg-gray-400 dark:bg-gray-500/70 dark:hover:bg-gray-500",style:{flex:1}}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{className:"rounded-t-[1px] ".concat(e.isNormal?"bg-emerald-500/70 hover:bg-emerald-400":"bg-emerald-500"),style:{flex:null!==(a=e.successRate)&&void 0!==a?a:0}}),(null!==(r=e.errorRate)&&void 0!==r?r:0)>0&&(0,N.jsx)("div",{className:"rounded-b-[1px] bg-rose-500 shadow-[0_0_8px_rgba(244,63,94,0.4)]",style:{flex:e.errorRate}})]})})},e.id)}),[b]),V=(0,E.useMemo)(()=>!["gemini-omni-character","gemini-omni-audio"].includes(G)&&(null==x?void 0:x.user)&&0!==x.user.renewalFrequency&&b.length>0,[G,x.user,b.length]);return(0,N.jsxs)("div",{className:"w-full border-b border-gray-200 bg-white pb-2 dark:border-gray-700 dark:bg-gray-800",style:{marginTop:"var(--app-header-height, 5rem)"},children:[(0,N.jsx)("style",{dangerouslySetInnerHTML:{__html:"\n @keyframes barSpread {\n 0% { opacity: 0; transform: scaleY(0); }\n 100% { opacity: 1; transform: scaleY(1); }\n }\n "}}),(0,N.jsxs)("div",{className:"mx-auto flex max-w-7xl flex-col items-start gap-4 px-6 pb-2 pt-14 lg:px-8",children:[(0,N.jsxs)("div",{className:"flex w-full flex-col items-start justify-between md:flex-row",children:[(0,N.jsx)("div",{className:"min-w-0 flex-1",children:(0,N.jsxs)("div",{className:"mb-4 flex w-full items-start space-x-3 md:items-center",children:[(0,N.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-blue-600 md:h-12 md:w-12",children:(0,N.jsx)(I.Z,{className:"h-6 w-6 text-white"})}),(0,N.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,N.jsxs)("div",{className:"mb-2 flex items-center space-x-2",children:[(0,N.jsx)("div",{className:"text-xl font-bold text-gray-900 dark:text-white md:text-3xl",children:s?(0,N.jsxs)("div",{children:[(0,N.jsxs)("span",{className:"text-gray-500 dark:text-gray-400",children:[F(n)," /"," "]}),s]}):(0,N.jsxs)("span",{className:"text-gray-500 dark:text-gray-400",children:[F(n)," "]})}),(0,N.jsx)("button",{onClick:B,className:"flex items-center justify-center rounded-lg p-2 text-gray-500 transition-all hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-gray-200",children:f?(0,N.jsx)(S.Z,{className:"h-5 w-5 text-green-600"}):(0,N.jsx)(A.Z,{className:"h-5 w-5"})})]}),(0,N.jsx)("div",{className:"flex w-full flex-wrap items-center justify-start gap-x-4 gap-y-2 text-sm",children:(0,N.jsx)("span",{className:"rounded-full border border-blue-200 bg-blue-50 px-3 py-1 text-blue-700 dark:border-blue-700 dark:bg-blue-900/20 dark:text-blue-300",children:"Commercial use"})})]})]})}),(o||!d)&&(0,N.jsxs)("div",{className:"ml-12 flex min-w-[200px] flex-col items-end space-y-3 md:ml-8",children:[(0,N.jsxs)("button",{onClick:()=>C(),className:"flex min-w-[165px] items-center rounded-lg bg-blue-600 px-6 py-2.5 text-sm font-medium text-white shadow-sm transition-all hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",children:[(0,N.jsx)(P.Z,{className:"mr-2 h-4 w-4"}),"Run with API"]}),((null==g?void 0:g.channel)==="fal_request"||(null==g?void 0:g.channel)==="replicate_request")&&(0,N.jsx)($,{model:G})]})]}),(0,N.jsx)("p",{className:"max-w-4xl whitespace-pre-line text-base leading-relaxed text-gray-600 dark:text-gray-300",children:null==i?void 0:null===(a=i.root)||void 0===a?void 0:null===(t=a.props)||void 0===t?void 0:t.tagline})]}),(0,N.jsxs)("div",{className:"mx-auto max-w-7xl px-6 py-4 lg:px-8",children:[q&&q.length>1&&(0,N.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,N.jsx)("div",{className:"flex-shrink-0 text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Model Type:"}),(0,N.jsx)("div",{className:"flex flex-wrap gap-2",children:q.map(e=>{let t=e.key===K;return(0,N.jsx)("button",{onClick:()=>{t||(w([]),k(!1),L(null),U(e.userPath,e.path),h(e.userPath,e.path))},className:"rounded-lg border px-4 py-2 text-sm font-medium transition-all duration-200 ".concat(t?"cursor-default border-blue-500 bg-blue-500 text-white shadow-md":"border-gray-300 bg-white text-gray-700 hover:border-blue-500 hover:bg-blue-50 hover:text-blue-700 hover:shadow-sm dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300 dark:hover:border-blue-400 dark:hover:bg-gray-600 dark:hover:text-blue-300"),children:(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)("span",{children:F(e.label)}),t&&(0,N.jsx)(D.JO,{icon:"solar:check-circle-bold",className:"h-4 w-4"})]})},e.key)})})]}),m&&(0,N.jsxs)("div",{className:"flex items-start space-x-2 text-sm text-gray-500 dark:text-gray-400",children:[(0,N.jsx)(D.JO,{icon:"carbon:pricing-consumption",className:"mt-0.5 h-5 w-5 flex-shrink-0 text-amber-500"}),(0,N.jsxs)("span",{className:"whitespace-pre-wrap break-words",children:["Pricing:"," ",(null===(r=x.user)||void 0===r?void 0:r.billingType)===1&&p?p:m]})]}),V&&(0,N.jsx)(N.Fragment,{children:(0,N.jsxs)("div",{className:"group/monitor mt-4 w-full",children:[(0,N.jsxs)("div",{className:"mb-4 flex min-h-[32px] items-end justify-between",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)("span",{className:"text-[10px] font-bold uppercase tracking-widest text-gray-500 opacity-70",children:"24H Status Monitor"}),(0,N.jsx)(T.e,{content:"Only 200 and 500 status codes are counted. Failures caused by other reasons (such as content moderation blocks, invalid file formats, or other 4xx errors) are excluded from the statistics.",placement:"top",className:"max-w-xs text-xs",children:(0,N.jsx)("span",{className:"inline-flex cursor-help items-center text-gray-500 opacity-70",children:(0,N.jsx)(D.JO,{icon:"mdi:information-outline",className:"h-3.5 w-3.5"})})})]}),O&&!j&&(0,N.jsx)("div",{className:"text-xs font-medium transition-all duration-200",children:null==O.successRate&&null==O.errorRate?(0,N.jsxs)("span",{className:"flex items-center gap-1.5 rounded border border-gray-200 bg-gray-100 px-2 py-0.5 text-gray-500 shadow-sm dark:border-gray-600 dark:bg-gray-700 dark:text-gray-400",children:[(0,N.jsx)("span",{className:"h-2 w-2 rounded-full bg-gray-400 dark:bg-gray-500"}),z(O.start),null!=O.end&&" ââ ".concat(z(O.end))," ","- No Data"]}):(0,N.jsxs)("span",{className:"flex items-center gap-1.5 rounded border border-gray-200 bg-gray-50 px-2 py-0.5
1shadow-sm dark:border-gray-600 dark:bg-gray-700",children:[(0,N.jsx)("span",{className:"h-2 w-2 rounded-full bg-emerald-500"}),(0,N.jsxs)("span",{className:"text-gray-600 dark:text-gray-300",children:[z(O.start)," ââ"," ",z(O.end)," -"]}),(0,N.jsxs)("span",{className:"text-emerald-600 dark:text-emerald-400",children:["Success:",O.successRate,"%"]})]})})]}),(0,N.jsx)("div",{className:"group flex h-10 w-full items-center gap-[2px] py-2 transition-opacity duration-300 ".concat(j?"opacity-30":"opacity-100"),children:W})]})})]})]})}),et=a(27596);let ea=(0,et.Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),er=(0,et.Z)("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),el=(0,et.Z)("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);var es=a(17305),en=a(25629);let ei=[{id:"playground",label:"Playground",icon:ea,type:"page"},{id:"market-examples",label:"Examples",icon:er,type:"anchor"},{id:"similar",label:"Similar",icon:el,type:"anchor"},{id:"readme",label:"README",icon:es.Z,type:"anchor"},{id:"api",label:"API",icon:en.Z,type:"page"}],eo=(e,t)=>{let a=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e).trim());return Number.isFinite(a)?a:t},ed=()=>{var e;return eo("--app-header-height",80)+((null===(e=document.querySelector("[data-tab-navigation]"))||void 0===e?void 0:e.getBoundingClientRect().height)||57)+8},ec=e=>{e&&window.scrollTo({top:e.getBoundingClientRect().top+window.scrollY-ed(),behavior:"smooth"})};function eu(e){let{activeTab:t,onTabChange:a,availableTabs:r=["playground","api"],hasExamplesData:l=!1,hasReadmeData:s=!1,hasModelInternalLinks:n=!1,isFalOrReplicate:i=!0,hasPlaygroundData:o=!1,model:d="",isCustomModel:c=!1,currentPageData:u={}}=e,[p,m]=(0,E.useState)(t),g=(0,E.useCallback)(e=>d&&"playground"!==e&&"api"!==e&&"readme"!==e&&"similar"!==e?"".concat(d,"-").concat(e):e,[d]),h=ei.filter(e=>"playground"===e.id?o&&r.includes("playground"):"market-examples"===e.id?!c&&i&&l&&r.includes("playground"):"readme"===e.id?s&&r.includes("playground"):"similar"===e.id?n&&r.includes("playground"):r.includes(e.id));(0,E.useEffect)(()=>{m(t)},[t]),(0,E.useEffect)(()=>{let e=()=>{if("playground"!==t)return;let e=[];o&&e.push("playground"),l&&e.push("market-examples"),n&&e.push("similar"),s&&e.push("readme");let a="playground";for(let t of e){let e=g(t),r=document.getElementById(e);if(r){let e=r.getBoundingClientRect(),l=ed();if(e.top<=l&&e.bottom>=l){a=t;break}}}a!==p&&m(a)};if("playground"===t&&o)return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},[t,p,l,n,s,o,g]);let x=e=>{if("api"===e.id){m("api"),a("api"),setTimeout(()=>window.scrollTo({top:0,behavior:"smooth"}),0);return}m(e.id);let r=g(e.id);if("anchor"===e.type&&"playground"===t||"playground"==e.id){let e=document.getElementById(r);e&&ec(e)}if("anchor"===e.type){if("playground"!==t)a("playground"),setTimeout(()=>{let e=document.getElementById(r);e&&ec(e)},100);else{let e=document.getElementById(r);e&&ec(e)}}else"page"===e.type&&(a(e.id),setTimeout(()=>{window.scrollTo({top:0,behavior:"smooth"})},0))};return(0,N.jsx)("div",{"data-tab-navigation":!0,className:"sticky z-30 border-b border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800",style:{to
1p:"var(--app-header-height, 5rem)"},children:(0,N.jsx)("div",{className:"mx-auto max-w-7xl px-6 lg:px-8",children:(0,N.jsx)("nav",{className:"flex w-full space-x-8 overflow-x-auto","aria-label":"Tabs",children:h.map(e=>{let t=e.icon,a=p===e.id;return(0,N.jsxs)("button",{onClick:()=>x(e),className:"".concat(a?"border-blue-500 text-blue-600 dark:border-blue-400 dark:text-blue-400":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-600 dark:hover:text-gray-300"," flex items-center border-b-2 px-1 py-4 text-sm font-medium transition-all"),children:[(0,N.jsx)(t,{className:"mr-2 h-4 w-4"}),e.label]},e.id)})})})})}var ep=a(93893),em=a(49787),eg=a(64351),eh=a(79646),ex=a(61277),ef=a(96507),ey=a(38508),ev=a(80684),eb=a(65351),ew=a(94204),ej=a(23698),ek=a(32324);let eN=(0,et.Z)("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var eE=a(51765),eC=a(36380),eI=a.n(eC),eS=a(87375),eA=a(2374);let eP=(0,et.Z)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var eD=a(73868);let eT={defaultFormat:{image:["image/jpeg","image/png","image/webp","image/gif","image/svg+xml","image/bmp"],video:["video/mp4","video/webm","video/ogg","video/quicktime","video/x-msvideo","video/x-matroska","video/x-ms-wmv","video/x-flv","video/3gpp"],audio:["audio/mpeg","audio/mp3","audio/wav","audio/wave","audio/x-wav","audio/ogg","audio/vorbis","audio/mp4","audio/x-m4a","audio/flac","audio/aac","audio/x-aac","audio/x-ms-wma","audio/webm"],document:["application/pdf"],other:[]}},e_=[".jpg",".jpeg",".png",".webp",".gif"],eR=[".mp4",".mov",".avi",".webm",".wmv",".mkv"],eF=[".mp3",".wav",".ogg",".m4a",".flac",".aac",".wma"],eM=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx"],eO=[".zip",".rar",".md",".txt",".json"],eL=e=>"string"==typeof e&&e?e.replace(/https?:\/\/[^\s<>"')\]]+/g,(e,t,a)=>{var r;if("]("===a.slice(Math.max(0,t-2),t))return e;let l=(null===(r=e.match(/[.,!?;:]+$/))||void 0===r?void 0:r[0])||"",s=l?e.slice(0,-l.length):e;return s?"[".concat(s,"](").concat(s,")").concat(l):e}):e,eB="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAIAAoDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAv/xAAhEAACAQMDBQAAAAAAAAAAAAABAgMABAUGIWEREiMxUf/EABUBAQEAAAAAAAAAAAAAAAAAAAMF/8QAGhEAAgIDAAAAAAAAAAAAAAAAAAECEgMRkf/aAAwDAQACEQADAD8HklItgH+HaH9bcfaSXWGaRmknyJckliyjqTzSlT54b6bk+h0R//9k=";function eU(e){var t,a,r,l,s,n,i,o,d,c;let{message:u,isStreaming:p=!1,streamContent:m="",onPreviewImage:g}=e,h=(null==u?void 0:u.role)==="user",x=(null==u?void 0:u.isTransientError)===!0,[f,y]=(0,E.useState)(!1),[v,b]=(0,E.useState)(new Set),w=(null==u?void 0:u.reasoningContent)||"",j=null!==(a=null!==(t=null==u?void 0:u.creditsConsumed)&&void 0!==t?t:null==u?void 0:u.credits_consumed)&&void 0!==a?a:null,k=null!==(l=null!==(r=null==u?void 0:u.promptTokens)&&void 0!==r?r:null==u?void 0:u.prompt_tokens)&&void 0!==l?l:null,C=null!==(n=null!==(s=null==u?void 0:u.cachedTokens)&&void 0!==s?s:null==u?void 0:u.cached_tokens)&&void 0!==n?n:null,I=null!==(o=null!==(i=null==u?void 0:u.completionTokens)&&void 0!==i?i:null==u?void 0:u.completion_tokens)&&void 0!==o?o:null,P=(null!==(c=null!==(d=null==u?void 0:u.reasoningTokens)&&void 0!==d?d:null==u?void 0:u.reasoning_tokens)&&void 0!==c?c:null)||null,[T,_]=(0,E.useState)(p);(0,E.useEffect)(()=>{w&&(p?_(!0):_(!1))},[p,w]);let R=e=>{if("string"==typeof e)return{text:e,files:[]};if(Array.isArray(e)){var t;return{text:(null===(t=e.find(e=>"text"===e.type))||void 0===t?void 0:t.text)||"",files:e.filter(e=>"image_url"===e.type||"video_url"===e.type||"audio_url"===e.type||"doc_url"===e.type||"other_url"===e.type).map(e=>{var t;return{type:e.type,url:null===(t=e[e.type])||void 0===t?void 0:t.url}}).filter(e=>e.url)}}return{text:"",files:[]}},F=async()=>{let{text:e}
1=R(null==u?void 0:u.content),t=p&&!h?m:e;if(!t){J.ZP.error("No content to copy");return}try{await navigator.clipboard.writeText(t),y(!0),J.ZP.success("Copied to clipboard"),setTimeout(()=>{y(!1)},2e3)}catch(e){J.ZP.error("Failed to copy")}},M=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image";g&&g(e,t)},O=e=>{let t=e.substring(e.lastIndexOf("."));return e_.includes(t)?"image":eR.includes(t)?"video":eF.includes(t)?"audio":eM.includes(t)?"document":eO.includes(t)?"other":"image"},{text:L,files:B}=R(null==u?void 0:u.content),U=p&&!h?m:L,Z=x?eL(U):U,z=B.filter(e=>"image"===O(e.url)),q=B.filter(e=>"video"===O(e.url)),K=B.filter(e=>"audio"===O(e.url)),G=B.filter(e=>"document"===O(e.url)),W=B.filter(e=>"other"===O(e.url));return(0,N.jsxs)("div",{className:"flex w-full gap-4 ".concat(h?"justify-end":"justify-start"),children:[!h&&(0,N.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-gray-300 bg-white shadow-sm dark:border-gray-600 dark:bg-gray-800",children:(0,N.jsx)(eI(),{src:"/logo-icon.webp",alt:"KIE AI",width:32,height:32,className:"h-full w-full object-cover"})}),(0,N.jsxs)("div",{className:"group relative max-w-[75%] ".concat(h?"rounded-2xl rounded-tr-sm bg-blue-500 px-4 py-2.5 text-white shadow-sm":x?"rounded-2xl rounded-tl-sm border-2 border-amber-300 bg-amber-50 px-4 py-3 text-amber-950 shadow-md shadow-amber-100 dark:border-amber-500/70 dark:bg-amber-950/40 dark:text-amber-100 dark:shadow-amber-950/30":"space-y-2 rounded-2xl rounded-tl-sm bg-gray-100 px-4 py-3 shadow-sm dark:border dark:border-gray-600/50 dark:bg-gray-700/50"),children:[!h&&x&&(0,N.jsxs)("div",{className:"mb-3 flex items-center gap-2 border-b border-amber-200 pb-2.5 dark:border-amber-500/40",children:[(0,N.jsx)(eS.Z,{className:"h-5 w-5 shrink-0 text-amber-600 dark:text-amber-400"}),(0,N.jsx)("span",{className:"text-sm font-semibold text-amber-700 dark:text-amber-300",children:"Request failed"})]}),h&&z.length>0&&(0,N.jsx)("div",{className:"mb-2 space-y-2",children:z.map((e,t)=>{let a=v.has(e.url);return(0,N.jsx)("div",{onClick:()=>!a&&M(e.url,O(e.url)),className:"group/image relative cursor-pointer overflow-hidden rounded-lg bg-gray-50 dark:bg-gray-800/50",style:{maxWidth:"400px",maxHeight:"300px",minHeight:"150px"},children:a?(0,N.jsxs)("div",{className:"flex min-h-[150px] flex-col items-center justify-center gap-2 rounded-lg bg-gray-100 p-6 dark:bg-gray-800",children:[(0,N.jsx)(eA.Z,{className:"h-12 w-12 text-gray-400 dark:text-gray-500"}),(0,N.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Failed to load image"})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{className:"pointer-events-none flex h-full min-h-[150px] items-center justify-center",children:(0,N.jsx)(eI(),{src:e.url,alt:"User uploaded image ".concat(t+1),width:400,height:300,className:"pointer-events-none max-h-[300px] max-w-[400px] object-contain transition-transform duration-200 group-hover/image:scale-105",placeholder:"blur",blurDataURL:eB,loading:"lazy",unoptimized:!0,onError:()=>{b(t=>new Set(t).add(e.url))}})}),(0,N.jsx)("div",{className:"pointer-events-none absolute inset-0 bg-black/0 transition-colors duration-200 group-hover/image:bg-black/5"})]})},t)})}),h&&(q.length>0||K.length>0||G.length>0||W.length>0)&&(0,N.jsxs)("div",{className:"mb-2 flex flex-wrap gap-2",children:[q.map((e,t)=>(0,N.jsxs)("div",{onClick:()=>M(e.url,O(e.url)),className:"group/video relative cursor-pointer overflow-hidden rounded-lg bg-gray-50 dark:bg-gray-800/50",style:{maxWidth:"400px",maxHeight:"300px",minHeight:"150px"},children:[(0,N.jsx)("div",{className:"flex h-full min-h-[150px] items-center justify-center",children:(0,N.jsx)("video",{src:e.url,className:"max-h-[300px] max-w-[400px] object-contain transition-transform duration-200 group-hover/video:scale-105",controls:!0,preload:"metadata",children:"Your browser does not support the video element."})}),(0,N.jsx)("div",{className:"pointer-events-none absolute inset-0 bg-black/0 transition-colors duration-200 group-hover/video:bg-black/5"})]},"video-".concat(t))),K.map((e,t)=>(0,N.jsxs)("div",{className:"group/audio flex items-center gap-3 rounded-lg border border-gray-200 bg-white/50 px-4 py-3 transition-colors hover:bg-white/80 dark:border-gray-600 dark:bg-gray-600/50 dark:hover:bg-gray-600/80",style:{maxWidth:"600px",width:"100%"},children:[(0,N.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-blue-100 dar
1k:bg-blue-900/30",children:(0,N.jsx)(D.JO,{icon:"solar:music-note-bold",width:20,height:20,className:"text-blue-600 dark:text-blue-400"})}),(0,N.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[(0,N.jsx)("div",{className:"flex items-center gap-2",children:(0,N.jsx)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Audio File"})}),(0,N.jsx)("div",{className:"w-full min-w-[300px]",children:(0,N.jsx)("audio",{src:e.url,className:"h-8 w-full",controls:!0,preload:"metadata",children:"Your browser does not support the audio element."})})]})]},"audio-".concat(t))),G.map((e,t)=>(0,N.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-white/50 px-3 py-2 text-xs transition-colors hover:bg-white/80 dark:border-gray-600 dark:bg-gray-600/50 dark:hover:bg-gray-600/80",children:[(0,N.jsx)(D.JO,{icon:"solar:document-bold",width:16,height:16}),(0,N.jsx)("span",{children:"Document"})]},"doc-".concat(t))),W.map((e,t)=>(0,N.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-white/50 px-3 py-2 text-xs transition-colors hover:bg-white/80 dark:border-gray-600 dark:bg-gray-600/50 dark:hover:bg-gray-600/80",children:[(0,N.jsx)(D.JO,{icon:"solar:file-bold",width:16,height:16}),(0,N.jsx)("span",{children:"File"})]},"other-".concat(t)))]}),!h&&w&&(0,N.jsx)("div",{className:"mb-3",children:T?(0,N.jsxs)("div",{className:"rounded-lg border border-gray-200 dark:border-gray-700",children:[(0,N.jsxs)("button",{onClick:()=>_(!T),className:"flex w-full items-center justify-between gap-2 rounded-lg px-3 py-2 text-sm text-gray-600 transition-colors hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-gray-200",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(D.JO,{icon:"solar:lightbulb-linear",width:18,height:18,className:"shrink-0 text-gray-500 dark:text-gray-400"}),(0,N.jsx)("span",{className:"flex-1 text-left",children:"Thinking Process"})]}),(0,N.jsx)(eP,{className:"h-4 w-4 text-gray-500 transition-transform duration-200 dark:text-gray-400"})]}),(0,N.jsx)("div",{className:"overflow-hidden transition-all duration-300 ease-in-out",style:{maxHeight:T?"1000px":"0",opacity:T?1:0},children:(0,N.jsx)("div",{className:"max-h-[1000px] overflow-y-auto border-t border-gray-200 px-3 py-3 dark:border-gray-700",children:(0,N.jsx)("div",{className:"prose prose-sm dark:prose-invert prose-p:my-2 prose-pre:my-2 prose-pre:rounded-lg prose-pre:bg-gray-100 prose-pre:text-gray-900 dark:prose-pre:bg-gray-900 dark:prose-pre:text-gray-100 max-w-none text-gray-700 dark:text-gray-300",children:(0,N.jsx)(eE.UG,{components:{code(e){let{inline:t,className:a,children:r,...l}=e;return t?(0,N.jsx)("code",{className:"rounded bg-gray-100 px-1.5 py-0.5 font-mono text-xs dark:bg-gray-700",...l,children:r}):(0,N.jsx)("code",{className:a,...l,children:r})},p(e){let{children:t,...a}=e;return(0,N.jsx)("p",{className:"my-2 leading-relaxed",...a,children:t})}},children:w})})})})]}):(0,N.jsxs)("button",{onClick:()=>_(!T),className:"flex w-full items-center gap-2 rounded-lg border border-gray-200 px-3 py-2 text-sm text-gray-600 transition-colors hover:text-gray-900 dark:border-gray-700 dark:text-gray-400 dark:hover:text-gray-200",children:[(0,N.jsx)(D.JO,{icon:"solar:lightbulb-linear",width:18,height:18,className:"shrink-0 text-gray-500 dark:text-gray-400"}),(0,N.jsx)("span",{className:"flex-1 text-left text-sm text-gray-600 dark:text-gray-400",children:"Thinking Process"}),(0,N.jsx)(D.JO,{icon:"solar:alt-arrow-right-linear",width:16,height:16,className:"shrink-0 text-gray-400 transition-transform duration-200 dark:text-gray-500"})]})}),U&&(0,N.jsx)("div",{className:"".concat(h?"text-sm leading-relaxed":"prose prose-sm dark:prose-invert prose-p:my-2 prose-pre:my-2 prose-pre:rounded-lg prose-pre:bg-gray-200 prose-pre:text-gray-900 dark:prose-pre:bg-gray-900 dark:prose-pre:text-gray-100 max-w-none"),children:h?(0,N.jsx)("div",{className:"whitespace-pre-wrap break-words",children:U}):(0,N.jsx)(eE.UG,{components:{code(e){let{inline:t,className:a,children:r,...l}=e;return t?(0,N.jsx)("code",{className:"rounded bg-white px-1 py-0.5 text-sm dark:bg-gray-700",...l,children:r}):(0,N.jsx)("code",{className:a,...l,children:r})},img(e){let{src:t,alt:a,...r}=e,l=t||"";return v.has(l)?(0,N.jsxs)("div",{className:"my-2 flex min-h-[300px] flex-col items-center justify-center gap-2 rounded-lg border border-gray-200 bg-gray-100 p-6 dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsx)(eA.Z,{className:"h-12 w-12 text-gray-400 dark:text-gray-500"}),(0,N.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Failed to load image"})]}):(0,N.jsx)(eI(),{onClick:()=>M(l,O(l)),src:l,alt:a||"Image",width:500,height:350,className:"h-auto w-full cursor-pointer object-cover",placeholder:"blur",blurDataURL:eB,loading:"lazy",unoptimized:!0,onError:()=>{b(e=>new Set(e).add(l))},...r})},a(e){let{href:t,children:a,...r}=e;return x?(0,N.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"font-medium !text-amber-700 underline decoration-amber-400 underline-offset-2 dark:!text-amber-300 dark:decoration-amber-500",...r,children:a}):(0,N.jsx)("a",{href:t,...r,children:a})}},children:Z})}),!h&&z.length>0&&(0,N.jsx)("div",{className:"space-y-2",children:z.map((e,t)=>{let a=v.has(e);return(0,N.jsx)("div",{onClick:()=>!a&&M(e,O(e)),className:"cursor-pointer overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700",children:a?(0,N.jsxs)("div",{className:"flex min-h-[300px] flex-col items-center justify-center gap-2 rounded-lg bg-gray-100 p-6 dark:bg-gray-800",children:[(0,N.jsx)(eA.Z,{className:"h-12 w-12 text-gray-400 dark:text-gray-500"}),(0,N.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Failed to load image"})]}):(0,N.jsx)(eI(),{src:e,alt:"AI generated image ".concat(t+1),width:500,height:350,className:"h-auto w-full object-cover",placeholder:"blur",blurDataURL:eB,loading:"lazy",unoptimized:!0,onError:()=>{b(t=>new Set(t).add(e))}})},t)})}),p&&!h&&!U&&(0,N.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400",children:[(0,N.jsx)(eD.Z,{className:"h-4 w-4 animate-spin"}),(0,N.jsx)("span",{children:"Thinking..."})]}),p&&!h&&U&&(0,N.jsx)("span",{className:"inline-block h-4 w-0.5 animate-pulse bg-blue-500"}),!h&&!x&&U&&!p&&(0,N.jsx)("div",{className:"mt-2 flex justify-end",children:(0,N.jsx)("button",{onClick:F,className:"flex h-7 items-center gap-1.5 rounded-lg border border-gray-200 bg-white px-2.5 text-xs text-gray-600 shadow-sm transition-colors hover:bg-gray-50 hover:text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-gray-200",title:"Copy message",children:f?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(S.Z,{className:"h-3.5 w-3.5 text-green-500"}),(0,N.jsx)("span",{children:"Copied"})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(A.Z,{className:"h-3.5 w-3.5"}),(0,N.jsx)("span",{children:"Copy"})]})})}),!h&&!p&&(null!==j||null!==k||null!==C||null!==I||null!==P)&&(0,N.jsx)("div",{className:"mt-2 border-t border-gray-200/60 pt-2 dark:border-gray-700/60",children:(0,N.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[null!==k&&(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)(D.JO,{icon:"mdi:user",width:14,height:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),(0,N.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Input Tokens:"}),(0,N.jsx)("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:k})]}),null!==C&&(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)(D.JO,{icon:"mdi:cached",width:14,height:14,className:"shrink-0 text-purple-400 dark:text-purple-500"}),(0,N.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Cached Tokens:"}),(0,N.jsx)("span",{className:"text-xs font-medium text-purple-500 dark:text-purple-400",children:C})]}),null!==I&&(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)(D.JO,{icon:"mdi:robot",width:14,height:14,className:"shrink-0 text-green-400 dark:text-green-500"}),(0,N.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Output Tokens:"}),(0,N.jsx)("span",{className:"text-xs font-medium text-green-500 dark:text-green-400",children:I})]}),null!==P&&(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)(D.JO,{icon:"mdi:lightbulb-on-outline",width:14,height:14,className:"shrink-0 text-amber-400 dark:text-amber-500"}),(0,N.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Reasoning Tokens:"}),(0,N.jsx)("span",{className:"text-xs font-medium text-amber-500 dark:text-amber-400",children:P})]}),null!==j&&(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)(D.JO,{icon:"solar:medal-star-bold",width:14,height:14,className:"shrink-0 text-blue-400 dark:text-blue-500"}),(0,N.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Credit Consumption:"}),(0,N.jsx)("span",{className:"text-xs font-medium text-blue-500 dark:text-blue-400",children:j}),(0,N.jsx)("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"(1 credit=$0.005)"})]})]})})]}),h&&(0,N.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-gray-300 text-gray-600 dark:border-gray-600 dark:text-gray-400",children:(0,N.jsx)(D.JO,{icon:"mdi:user",width:20,height:20})})]})}function eZ(e){let{messages:t=[],transientErrorMessage:a=null,isGenerating:r=!1,streamContent:l="",streamReasoningContent:s="",onPreviewImage:n}=e,{t:i}
1=(0,X.Z)(),o=(0,E.useRef)(null),d=(0,E.useRef)(!0),[c,u]=(0,E.useState)(!1),p=(0,E.useRef)(0);(0,E.useEffect)(()=>{(t.length>0||a)&&setTimeout(()=>{m()},300)},[t.length,a]);let m=()=>{let e=o.current;if(e)try{e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),d.current=!0,u(!1)}catch(e){}},g=()=>{let e=o.current;if(!e)return;let t=e.scrollTop,a=p.current;p.current=t;let r=e.scrollHeight-(e.scrollTop+e.clientHeight);a-t>=3?(d.current=!1,u(!0)):r<=10&&(d.current=!0,u(!1))};return(0,E.useEffect)(()=>{let e=o.current;if(e)return p.current=e.scrollTop,e.addEventListener("scroll",g),()=>e.removeEventListener("scroll",g)},[]),(0,E.useEffect)(()=>{if(r){var e;let t,a,r;let l=setInterval((e=()=>{d.current&&m()},function(){for(var l=arguments.length,s=Array(l),n=0;n<l;n++)s[n]=arguments[n];t?(clearTimeout(a),a=setTimeout(()=>{Date.now()-r>=100&&(e.apply(this,s),r=Date.now())},100-(Date.now()-r))):(e.apply(this,s),r=Date.now(),t=!0)}),10);return()=>{clearInterval(l)}}},[r]),(0,N.jsxs)("div",{className:"relative flex w-full flex-1 flex-col overflow-y-auto",children:[(0,N.jsxs)(ej.o,{ref:o,className:"flex h-full w-full flex-col gap-6 px-4 py-6",children:[0===t.length&&!r&&!a&&(0,N.jsxs)("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[(0,N.jsx)("div",{className:"mb-6 flex h-12 w-12 items-center justify-center rounded-2xl bg-slate-100 shadow-sm dark:bg-slate-700",children:(0,N.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-8 w-8 text-slate-300 dark:text-slate-500",children:(0,N.jsx)("path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"})})}),(0,N.jsx)("h3",{className:"text-gray-500 dark:text-gray-300",children:i("common:chat.emptyStateTitle")})]}),t.map((e,t)=>(0,N.jsx)(eU,{message:e,onPreviewImage:n},t)),r&&(0,N.jsx)(eU,{message:{role:"assistant",content:l,...s?{reasoningContent:s}:{}},isStreaming:!0,streamContent:l,onPreviewImage:n}),!r&&a&&(0,N.jsx)(eU,{message:a,onPreviewImage:n},"transient-error")]}),c&&t.length>0&&(0,N.jsx)(ek.A,{isIconOnly:!0,className:"absolute bottom-4 right-4 z-10 rounded-full bg-blue-500 shadow-lg hover:bg-blue-600",onPress:m,children:(0,N.jsx)(eN,{className:"h-5 w-5 text-white"})})]})}var ez=a(53070),eq=a(10929),eK=a(44965),eG=a(45883);let eW={},eV=e=>{if(Array.isArray(e))for(let t of e)t&&t.model&&(eW[t.model]=t)},eH=e=>{var t;return null===(t=eW[e])||void 0===t?void 0:t.format};function eJ(e){var t,a;let r=eW[e];return r?{googleSearch:!!(null===(t=r.search)||void 0===t?void 0:t.supported),structuredOutput:!!r.structuredOutput,functionCalling:!!r.functionCalling,thinking:!!r.thinking,thinkingLevel:!!(null===(a=r.reasoningEffort)||void 0===a?void 0:a.supported),stream:!!r.stream}:{googleSearch:!1,structuredOutput:!1,functionCalling:!1,thinking:!1,thinkingLevel:!1,stream:!1}}let e$=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return null==e||!e.stream||!!t},eY=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return e$(eW[e],t)},eX=e=>{var t,a,r;return null!==(r=null===(a=eW[e])||void 0===a?void 0:null===(t=a.search)||void 0===t?void 0:t.requestToolName)&&void 0!==r?r:null},eQ=e=>{var t,a;return(null===(a=eW[e])||void 0===a?void 0:null===(t=a.search)||void 0===t?void 0:t.label)==="webAccess"},e0=e=>{var t,a;let r=null===(a=eW[e])||void 0===a?void 0:null===(t=a.reasoningEffort)||void 0===t?void 0:t.levels;return Array.isArray(r)?r:[]},e1=e=>{var t,a;return(null===(a=eW[e])||void 0===a?void 0:null===(t=a.reasoningEffort)||void 0===t?void 0:t.default)||"high"},e2=e=>{var t,a;return!!(null===(a=eW[e])||void 0===a?void 0:null===(t=a.reasoningEffort)||void 0===t?void 0:t.appliesToRequest)},e5=e=>{var t,a,r,l,s;return{supported:!!(null===(a=eW[e])||void 0===a?void 0:null===(t=a.maxTokens)||void 0===t?void 0:t.supported),default:null!==(s=null===(l=eW[e])||void 0===l?void 0:null===(r=l.maxTokens)||void 0===r?void 0:r.default)&&void 0!==s?s:null}},e4=e=>{var t;let a=eW[e];return!a||!!(null===(t=a.input)||void 0===t?void 0:t.fileUpload)},e3=e=>{var t;return!!(null===(t=eW[e])||void 0===t?void 0:t.cachedTokens)},e6=e=>{var t;return!!(null===(t=eW[e])||void 0===t?void 0:t.thinkingWithoutProcess)},e7=e=>{var t;return(null===(t=eW[e])||void 0===t?void 0:t.endpoint)||"/api/v1/responses"},e9=e=>{var t,a;return!!(null===(a=eW[e])||void 0===a?void 0:null===(t=a.input)||void 0===t?void 0:t.imageOnly)},e8=e=>{for(let t of Object.values(eW)){let a=t.display||{};if(t.model===e&&a.idAlias)return a.idAlias;if(a.sourceLabel===e&&a.labelAlias)return a.labelAlias}return e};function te(e){let{onSend:t,disabled:a=!1,isGenerating:r=!1,consumeCredit:l=0,creditLoading:s=!1,supportFileUpload:n=!0,chooseFormat:i="defaultFormat",currentModel:o=""}=e,[d,c]=(0,E.useState)(""),[u,p]=(0,E.useState)([]),[m,g]=(0,E.useState)(!1),[h,x]=(0,E.useState)(!1),[f,y]=(0,E.useState)(""),[v,b]=(0,E.useState)(""),[w,j]=(0,E.useState)(!1),k=(0,E.useRef)(null),C=(0,E.useRef)(null),S=d.trim().length>0||u.length>0,A=()=>{let e=k.current;if(e){e.style.height="auto";let t=Math.min(e.scrollHeight,120);e.style.height="".concat(t,"px")}};(0,E.useEffect)(()=>{A()},[d]),(0,E.useEffect)(()=>{let e=e=>{"Escape"===e.key&&h&&x(!1)};
1return h&&(document.addEventListener("keydown",e),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",e),document.body.style.overflow="unset"}},[h]);let P=async e=>{let t=Array.from(e.target.files||[]);if(0===t.length)return;if(e9(o)){var a;let e=(null===(a=eT[i])||void 0===a?void 0:a.image)||[];if(t.filter(t=>!t.type||!e.includes(t.type.toLowerCase())).length>0){J.ZP.error("This model only supports image uploads");return}}let r=F(t);if(!r.valid){J.ZP.error(r.message);return}if(u.length+t.length>5){J.ZP.error("Maximum ".concat(5," files allowed"));return}g(!0);let l=J.ZP.loading("Uploading ".concat(t.length," file(s)..."));try{let e=t.map(e=>(0,eK._R)(e,"kieai/openrouter-chat")),a=(await Promise.all(e)).map((e,a)=>({url:e,name:t[a].name,type:t[a].type,size:t[a].size})).filter(e=>e.url);a.length>0?(p(e=>[...e,...a]),J.ZP.dismiss(l),J.ZP.success("".concat(a.length," file(s) uploaded successfully"))):(J.ZP.dismiss(l),J.ZP.error("File upload failed, please try again"))}catch(e){J.ZP.dismiss(l),J.ZP.error("File upload failed, please try again")}finally{g(!1),C.current&&(C.current.value="")}},T=async e=>{var t,a;if(!n)return;let r=null===(t=e.clipboardData)||void 0===t?void 0:t.items;if(!r)return;let l=[];for(let e=0;e<r.length;e++){let t=r[e];if("file"===t.kind){let e=t.getAsFile();e&&l.push(e)}}if(l.length>0){if(e.preventDefault(),e9(o)){let e=(null===(a=eT[i])||void 0===a?void 0:a.image)||[];if(l.filter(t=>!t.type||!e.includes(t.type.toLowerCase())).length>0){J.ZP.error("This model only supports image uploads");return}}let t=F(l);if(!t.valid){J.ZP.error(t.message);return}if(u.length+l.length>5){J.ZP.error("Maximum ".concat(5," files allowed"));return}g(!0);let r=J.ZP.loading("Uploading ".concat(l.length," pasted file(s)..."));try{let e=l.map(e=>(0,eK._R)(e,"kieai/openrouter-chat")),t=(await Promise.all(e)).map((e,t)=>({url:e,name:l[t].name,type:l[t].type,size:l[t].size})).filter(e=>e.url);t.length>0?(p(e=>[...e,...t]),J.ZP.dismiss(r),J.ZP.success("".concat(t.length," file(s) uploaded successfully"))):(J.ZP.dismiss(r),J.ZP.error("File upload failed, please try again"))}catch(e){J.ZP.dismiss(r),J.ZP.error("File upload failed, please try again")}finally{g(!1)}}},_=e=>{p(t=>t.filter((t,a)=>a!==e))},R=(e,t)=>{y(e),x(!0),b(t)},F=e=>{let t=[];if(e.forEach(e=>{let a=e.type.toLowerCase(),r=!1;a.startsWith("image/")?r=eT[i].image.includes(a):a.startsWith("video/")?r=eT[i].video.includes(a):a.startsWith("audio/")?r=eT[i].audio.includes(a):a.includes("pdf")||a.includes("word")||a.includes("document")||a.includes("officedocument")||a.includes("excel")||a.includes("spreadsheet")||a.includes("text/plain")||a.includes("text/csv")?r=eT[i].document.includes(a):("application/zip"===a||"application/x-rar-compressed"===a||"application/json"===a)&&(r=eT[i].other.includes(a)),r||t.push(e)}),t.length>0){let e=t.map(e=>e.type).join(", ");return{valid:!1,invalidFiles:t,message:"Unsupported file type: ".concat(e)}}return{valid:!0,invalidFiles:[],message:""}},M=e=>e.startsWith("image/")?"solar:gallery-bold":e.startsWith("video/")?"solar:videocamera-bold":e.startsWith("audio/")?"solar:music-library-2-bold":e.includes("pdf")?"solar:document-bold":e.includes("word")?"solar:document-text-bold":e.includes("excel")||e.includes("spreadsheet")?"solar:documents-bold":"solar:file-bold",O=async()=>{if(!d.trim()&&0===u.length){J.ZP.error("Please enter text or upload files");return}let e=d.trim(),a=[...u],r={text:e,files:a.map(e=>({url:e.url,name:e.name,type:e.type}))};c(""),p([]),k.current&&(k.current.style.height="auto");try{await t(r)}catch(t){c(e),p(a),k.current&&A()}};return(0,N.jsxs)("div",{className:"sticky bottom-0 z-20 flex items-center justify-end gap-3 bg-white p-4 dark:bg-gray-800",children:[(0,N.jsxs)("div",{className:"group relative flex w-full flex-col rounded-2xl border border-gray-200 bg-white transition-all focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500 dark:border-gray-700 dark:bg-gray-900",children:[(0,N.jsx)("textarea",{ref:k,value:d,onChange:e=>{c(e.target.value)},onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(w||(e.preventDefault(),O()))},onPaste:T,onCompositionStart:()=>{j(!0)},onCompositionEnd:()=>{j(!1)},placeholder:"Send a message",disabled:a||r,rows:1,className:"w-full resize-none border-none bg-transparent px-4 py-3 text-sm text-gray-900 outline-none placeholder:text-gray-400 dark:text-white dark:placeholder:text-gray-500",style:{minHeight:"48px",maxHeight:"160px"}}),(0,N.jsxs)("div",{className:"flex items-end justify-between px-3 pb-3",children:[(0,N.jsxs)("div",{className:"no-scrollbar flex items-center gap-2 overflow-x-auto",children:[(0,N.jsx)("button",{onClick:()=>{var e;return null===(e=C.current)||void 0===e?void 0:e.click()},disabled:a||r||m,className:"flex h-8 w-8 shrink-0 items-center justify-center rounded bg-gray-100 text-gray-500 transition-colors hover:bg-gray-200 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700",children:m?(0,N.jsx)(eD.Z,{className:"h-4 w-4 animate-spin"}):(0,N.jsx)(D.JO,{icon:"solar:paperclip-linear",width:18,height:18})}),u.length>0&&(0,N.jsx)("div",{className:"flex gap-2",children:u.map((e,t)=>{let a=e.type.startsWith("image/"),r=e.type.startsWith("video/");return e.type.startsWith("audio/"),(0,N.jsxs)("div",{className:"relative shrink-0",children:[a?(0,N.jsx)("div",{className:"h-8 w-8 overflow-hidden rounded border border-gray-200 dark:border-gray-700",children:(0,N.jsx)(eI(),{src:e.url,alt:e.name,width:32,height:32,className:"h-full w-full cursor-pointer object-cover",onClick:()=>R(e.url,"image")})}):r?(0,N.jsx)("div",{className:"h-8 w-8 overflow-hidden rounded border border-gray-200 dark:border-gray-700",children:(0,N.jsx)("video",{src:e.url,alt:e.name,width:32,height:32,className:"h-full w-full cursor-pointer object-cover",onClick:()=>R(e.url,"video")})}):(0,N.jsxs)("div",{className:"flex h-8 items-center gap-1 rounded border border-gray-200 bg-gray-50 px-2 dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsx)(D.JO,{icon:M(e.type),className:"text-blue-500",width:14}),(0,N.jsx)("span",{className:"max-w-[60px] truncate text-[10px]",children:e.name})]}),(0,N.jsx)("button",{onClick:()=>_(t),className:"z-10s absolute -right-0.5 -top-0.5 flex h-3 w-3 items-center justify-center rounded-full bg-gray-500 text-white shadow-sm hover:bg-red-500",children:(0,N.jsx)(ez.Z,{className:"h-2.5 w-2.5"})})]},t)})})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[!!l&&(0,N.jsxs)("div",{className:"mr-1 flex items-center gap-1 text-[11px] text-gray-500 dark:text-gray-400",children:[(0,N.jsx)(I.Z,{className:"h-3 w-3 text-yellow-500"}),(0,N.jsx)("span",{children:s?(0,N.jsx)(eD.Z,{className:"h-2 w-2 animate-spin"}):l})]}),(0,N.jsx)(ek.A,{onPress:O,isDisabled:a||r||!S,className:(0,eq.cn)("h-8 w-8 min-w-[32px] rounded p-0 transition-colors",S?"bg-blue-500 text-white hover:bg-blue-600":"bg-gray-200 text-gray-500 dark:bg-gray-700 dark:text-gray-50"),children:r?(0,N.jsx)(eD.Z,{className:"h-4 w-4 animate-spin"}):(0,N.jsx)(D.JO,{icon:"mingcute:send-fill",width:18,height:18})})]})]})]}),(0,N.jsx)("input",{ref:C,accept:Object.keys(eT[i]).map(e=>{let t=eT[i][e];return t.length>0?t.join(","):null}).filter(e=>null!==e).join(","),type:"file",multiple:!0,onChange:P,className:"hidden"}),h&&f&&(0,N.jsx)(eG.Z,{imageUrl:f,fileType:v,setIsPreviewOpen:x})]})}var tt=a(2365),ta=a(69194),tr=a(25411),tl=a(23318),ts=a(82045),tn=a(65117),ti=a(2649),to=a(95866),td=a(1993),tc=a(38489),tu=a(44421),tp=a(99245),tm=a(47524),tg=e=>{let{isOpen:t,onClose:a,onSave:r,initialData:l,selectedModel:s}=e,{t:n}
1=(0,X.Z)("dashboard"),{theme:i}=(0,tm.F)(),[o,d]=(0,E.useState)(""),c=(0,E.useRef)(null),u="claude"===eH(s)?'{\n "type": "object",\n "properties": {\n "name": {"type": "string"},\n "email": {"type": "string"},\n "plan_interest": {"type": "string"},\n "demo_requested": {"type": "boolean"}\n },\n "required": ["name", "email", "plan_interest", "demo_requested"],\n "additionalProperties": false\n }':n("chat.structuredOutputModal.placeholder");return(0,N.jsx)(ti.R,{isOpen:t,onClose:a,size:"3xl",scrollBehavior:"inside",classNames:{base:"border border-gray-200 dark:border-gray-700 shadow-2xl",header:"border-b border-gray-100 dark:border-gray-800",footer:"border-t border-gray-100 dark:border-gray-800"},children:(0,N.jsxs)(to.A,{children:[(0,N.jsxs)(td.k,{className:"flex flex-col gap-1",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)("span",{children:n("chat.structuredOutputModal.title")}),(0,N.jsx)(D.JO,{icon:"lucide:info",className:"text-gray-400",width:16})]}),(0,N.jsx)("p",{className:"text-sm font-normal text-gray-500",children:n("chat.structuredOutputModal.description")})]}),(0,N.jsxs)(tc.I,{children:[(0,N.jsx)("div",{className:"mb-4",children:(0,N.jsx)("div",{className:"inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50/50 p-1 dark:border-gray-700 dark:bg-gray-800/50",children:(0,N.jsxs)("div",{className:"flex items-center gap-2 rounded-md px-3 py-1 shadow-sm",children:[(0,N.jsx)("div",{className:"h-2 w-2 rounded-full bg-black dark:bg-white"}),(0,N.jsx)("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:n("chat.structuredOutputModal.codeEditor")})]})})}),(0,N.jsxs)("div",{className:"relative h-[400px] w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700",children:[!o&&(0,N.jsxs)("div",{className:"pointer-events-none absolute left-[16px] top-[16px] z-10",children:[(0,N.jsx)("div",{className:"mb-2 text-sm text-gray-400 dark:text-gray-500",children:n("chat.structuredOutputModal.pressTabHint")}),(0,N.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-sm text-gray-400 dark:text-gray-500",children:u})]}),(0,N.jsx)(tp.default,{height:"100%",defaultLanguage:"json",value:o,onChange:d,onMount:(e,a)=>{c.current=e,setTimeout(()=>{e.updateOptions({padding:{top:16,bottom:16,left:16,right:16},lineDecorationsWidth:16})},0),t&&setTimeout(()=>{e.focus()},300),e.addCommand(a.KeyCode.Tab,()=>{let t=e.getValue();if(t&&""!==t.trim()){let t=e.getSelection();t&&e.executeEdits("insert-tab",[{range:t,text:" "}])}else e.setValue(u),d(u),setTimeout(()=>{e.getAction("editor.action.formatDocument").run()},100)})},theme:"dark"===i?"vs-dark":"vs",options:{minimap:{enabled:!1},fontSize:14,scrollBeyondLastLine:!1,lineNumbers:"off",glyphMargin:!1,folding:!1,lineDecorationsWidth:16,lineNumbersMinChars:0,tabSize:2,padding:{top:16,bottom:16,left:16,right:16},renderLineHighlight:"none"}})]})]}),(0,N.jsxs)(tu.R,{children:[(0,N.jsx)(ek.A,{variant:"light",onPress:()=>{d("")},children:n("chat.structuredOutputModal.reset")}),(0,N.jsx)(ek.A,{color:"primary",variant:"flat",onPress:()=>{try{let e=""===o.trim()?{}:JSON.parse(o);r(e),a(),J.ZP.success(n("chat.structuredOutputModal.saveSuccess"))}catch(e){J.ZP.error(n("chat.structuredOutputModal.invalidJson"))}},className:"bg-blue-500 text-white",children:n("chat.structuredOutputModal.save")})]})]})})},th=e=>{let{isOpen:t,onClose:a,onSave:r,initialData:l,selectedModel:s}=e,{t:n}=(0,X.Z)("dashboard"),{theme:i}=(0,tm.F)(),[o,d]=(0,E.useState)(""),c=(0,E.useRef)(null),u=eH(s),p="response"===u?'[\n {\n "type": "function",\n "name": "get_current_weather",\n "description": "Get the current weather in a given location",\n "parameters": {\n "type": "object",\n "properties": {\n "location": {\n "type": "string",\n "description": "The city and state, e.g. San Francisco, CA"\n },\n "unit": {\n "type": "string",\n "enum": ["celsius", "fahrenheit"]\n }\n },\n "required": ["location", "unit"]\n }\n }\n]':"gemini"===u?'[\n {\n "functionDeclarations": [\n {\n "name": "get_weather_forecast",\n "description": "Gets the current weather temperature for a given location.",\n "parameters": {\n "type": "OBJECT",\n "properties": {\n "location": {\n "type": "STRING"\n }\n },\n "required": ["location"]\n }\n },\n {\n "name": "set_thermostat_temperature",\n "description": "Sets the thermostat to a desired temperature.",\n "parameters": {\n "type": "OBJECT",\n "properties": {\n "temperature": {\n "type": "NUMBER"\n }\n },\n "required": ["temperature"]\n }\n }\n ]\n }\n]':"claude"===u?'[\n {\n "name": "get_current_weather",\n "description": "Get the current weather in a given location",\n "input_schema": {\n "type": "object",\n "properties": {\n "location": {\n "type": "string",\n "description": "The city and state, e.g. San Francisco, CA"\n }\n },\n "required": ["location"]\n }\n }\n]':n("chat.functionCallingModal.placeholder");return(0,N.jsx)(ti.R,{isOpen:t,onClose:a,size:"3xl",scrollBehavior:"inside",classNames:{base:"border border-gray-200 dark:border-gray-700 shadow-2xl",header:"border-b border-gray-100 dark:border-gray-800",footer
1:"border-t border-gray-100 dark:border-gray-800"},children:(0,N.jsxs)(to.A,{children:[(0,N.jsxs)(td.k,{className:"flex flex-col gap-1",children:[(0,N.jsx)("div",{className:"flex items-center gap-2",children:(0,N.jsx)("span",{children:n("chat.functionCallingModal.title")})}),(0,N.jsx)("p",{className:"text-sm font-normal text-gray-500",children:n("chat.functionCallingModal.description")})]}),(0,N.jsxs)(tc.I,{children:[(0,N.jsx)("div",{className:"mb-4",children:(0,N.jsx)("div",{className:"inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50/50 p-1 dark:border-gray-700 dark:bg-gray-800/50",children:(0,N.jsxs)("div",{className:"flex items-center gap-2 rounded-md px-3 py-1 shadow-sm",children:[(0,N.jsx)("div",{className:"h-2 w-2 rounded-full bg-black dark:bg-white"}),(0,N.jsx)("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:n("chat.functionCallingModal.codeEditor")})]})})}),(0,N.jsxs)("div",{className:"relative h-[400px] w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700",children:[!o&&(0,N.jsxs)("div",{className:"pointer-events-none absolute left-[16px] top-[16px] z-10",children:[(0,N.jsx)("div",{className:"mb-2 text-sm text-gray-400 dark:text-gray-500",children:n("chat.functionCallingModal.pressTabHint")}),(0,N.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-sm text-gray-400 dark:text-gray-500",children:p})]}),(0,N.jsx)(tp.default,{height:"100%",defaultLanguage:"json",value:o,onChange:d,onMount:(e,a)=>{c.current=e,setTimeout(()=>{e.updateOptions({padding:{top:16,bottom:16,left:16,right:16},lineDecorationsWidth:16})},0),t&&setTimeout(()=>{e.focus()},300),e.addCommand(a.KeyCode.Tab,()=>{let t=e.getValue();if(t&&""!==t.trim()){let t=e.getSelection();t&&e.executeEdits("insert-tab",[{range:t,text:" "}])}else e.setValue(p),d(p),setTimeout(()=>{e.getAction("editor.action.formatDocument").run()},100)})},theme:"dark"===i?"vs-dark":"vs",options:{minimap:{enabled:!1},fontSize:14,scrollBeyondLastLine:!1,lineNumbers:"off",glyphMargin:!1,folding:!1,lineDecorationsWidth:16,lineNumbersMinChars:0,tabSize:2,padding:{top:16,bottom:16,left:16,right:16},renderLineHighlight:"none"}})]})]}),(0,N.jsxs)(tu.R,{children:[(0,N.jsx)(ek.A,{variant:"light",onPress:()=>{d("")},children:n("chat.functionCallingModal.reset")}),(0,N.jsx)(ek.A,{color:"primary",variant:"flat",onPress:()=>{try{let e=""===o.trim()?[]:JSON.parse(o);r(e),a(),J.ZP.success(n("chat.functionCallingModal.saveSuccess"))}catch(e){J.ZP.error(n("chat.functionCallingModal.invalidJson"))}},className:"bg-blue-500 text-white",children:n("chat.functionCallingModal.save")})]})]})})},tx=e=>{let{isOpen:t,onClose:a,onConfirm:r}=e;return(0,N.jsx)(ti.R,{isOpen:t,onClose:a,placement:"center",backdrop:"blur",classNames:{base:"max-w-md border border-gray-200 dark:border-gray-700 shadow-2xl",header:"border-b border-gray-100 dark:border-gray-800 pb-4",body:"py-6",footer:"border-t border-gray-100 dark:border-gray-800 pt-4"},children:(0,N.jsx)(to.A,{children:e=>(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(td.k,{className:"flex flex-col gap-1",children:(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(D.JO,{icon:"lucide:alert-triangle",className:"text-amber-500 dark:text-amber-400",width:20,height:20}),(0,N.jsx)("span",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Memory Demo â Increased Token Usage"})]})}),(0,N.jsx)(tc.I,{children:(0,N.jsxs)("div",{className:"space-y-3 text-sm leading-relaxed text-gray-600 dark:text-gray-400",children:[(0,N.jsx)("p",{children:"For demonstration purposes, we simply append the entire chat history to every request. No context-management optimisation (trimming, summarisation, RAG, etc.) is applied."}),(0,N.jsx)("p",{children:"As a result, enabling Memory can significantly increase input-token consumption. In production, please manage context on your side."})]})}),(0,N.jsx)(tu.R,{children:(0,N.jsx)(ek.A,{color:"primary",onPress:()=>{null==r||r(),e()},className:"min-w-[120px] font-medium",children:"Got it"})})]})})})};let tf=e=>e8(e);var ty=function(e){let{selectedModel:t,onModelChange:a,memoryEnabled:r=!1,onMemoryChange:l,codexStreamingEnabled:s=!0,onCodexStreamingChange:n,googleSearchEnabled:i=!0,onGoogleSearchChange:o,structuredOutputEnabled:d=!1,onStructuredOutputChange:c,codeExecutionEnabled:u=!1,onCodeExecutionChange:p,functionCallingEnabled:m=!1,onFunctionCallingChange:g,urlContextEnabled:h=!1,onUrlContextChange:x,includeThoughtsEnabled:f=!0,onIncludeThoughtsChange:y,reasoningEffort:v="high",onReasoningEffortChange:b,claudeMaxTokens:w="",onClaudeMaxTokensChange:j,structuredOutputData:k=null,onStructuredOutputDataChange:C,functionCallingData:I=[],onFunctionCallingDataChange:S,modelOptions:A}=e,{t:P}=(0,X.Z)("dashboard"),_=(0,E.useRef)(null),{isOpen:R,onOpen:F,onClose:M}=(0,ew.q)(),{isOpen:O,onOpen:L,onClose:B}=(0,ew.q)(),{isOpen:U,onOpen:Z,onClose:z}=(0,ew.q)(),[q,K]=(0,E.useState)(!0),G=(0,E.useMemo)(()=>Object.values(eJ(t)).some(e=>e),[t]),W=(0,E.useMemo)(()=>eJ(t),[t]),V=(0,E.useMemo)(()=>e5(t),[t]),H=(0,E.useMemo)(()=>eQ(t),[t]),J=(0,E.useMemo)(()=>e0(t),[t]),$=(0,E.useMemo)(()=>new Set([t]),[t]),Y=u||m&&W.functionCalling;d&&W.structuredOutput||m&&W.functionCalling;let Q=d&&W.structuredOutput||u||i&&W.googleSearch||h,ee=m&&W.functionCalling;return m&&W.functionCalling,(0,N.jsxs)("div",{ref:_,className:"w-80 flex-shrink-0 overflow-y-auto border-r border-gray-200 p-6 dark:border-gray-700",children:[(0,N.jsxs)("div",{className:"mb-6",children:[(0,N.jsx)("label",{className:"mb-2 block text-xs font-semibold uppercase tracking-wide text-gray-700 dark:text-gray-300",children:P("chat.model")}),1===A.length?(0,N.jsx)("div",{className:"rounded-lg border border-gray-300 bg-white px-3 py-2 dark:border-gray-600 dark:bg-gray-700",children:(0,N.jsx)("span",{className:"text-sm text-gray-900 dark:text-white",children:tf(A[0].label)})}):(0,N.jsx)(ta.g,{selectionMode:"single",disallowEmptySelection:!0,selectedKeys:$,disableAnimation:!0,onSelectionChange:e=>{let t=Array.from(e)[0];t&&a&&a(t)},popoverProps:{disableAnimation:!0,shouldBlockScroll:!1,placement:"bottom",portalContainer:_.current,scrollShadowProps:{isEnabled:!1}},listboxProps:{disableAnimation:!0},classNames:{trigger:"bg-white dark:bg-gray-700 border-gray-300 dark:border-gray-600",value:"text-gray-900 dark:text-white"},children:A.map(e=>(0,N.jsx)(tr.R,{textValue:tf(e.label),children:tf(e.label)},e.key))})]}),(0,N.jsxs)("div",{className:"mb-6",children:[(0,N.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,N.jsx)("label",{className:"block text-xs font-semibold uppercase tracking-wide text-gray-700 dark:text-gray-300",children:P("chat.memory")}),(0,N.jsx)(tl.i,{size:"sm",isSelected:r,onValueChange:e=>{e&&!r?Z():null==l||l(e)},classNames:{wrapper:"group-data-[selected=true]:bg-blue-500",thumb:"group-data-[selected=true]:bg-white dark:group-data-[selected=true]:bg-black"}})]}),(0,N.jsx)("p",{className:"text-xs leading-relaxed text-gray-500 dark:text-gray-400",children:P(r?"chat.memoryEnabledDesc":"chat.memoryDisabledDesc")})]}),G&&(0,N.jsxs)("div",{className:"mb-6",children:[(0,N.jsxs)("div",{className:"mb-4 flex cursor-pointer items-center justify-between",onClick:()=>K(!q),children:[(0,N.jsx)("label",{className:"block cursor-pointer text-xs font-semibold uppercase tracking-wide text-gray-700 dark:text-gray-300",children:P("chat.tools")}),(0,N.jsx)("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:(0,N.jsx)(D.JO,{icon:q?"lucide:chevron-up":"lucide:chevron-down",className:"text-gray-600 dark:text-gray-400",width:14})})]}),q&&(0,N.jsxs)("div",{className:"flex flex-col gap-4",children:[W.structuredOutput&&(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsx)(T.e,{content:P("chat.structuredOutputsTooltip"),placement:"left",children:(0,N.jsx)("span",{className:"cursor-help text-sm text-gray-700 dark:text-gray-300",children:P("chat.structuredOutputs")})}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(ek.A,{variant:"light",size:"sm",className:(0,tn.Z)("h-7 min-w-0 px-3 font-semibold transition-colors",d?"bg-transparent text-black hover:bg-gray-100 dark:text-white dark:hover:bg-gray-800":"text-default-500 dark:text-default-600"),onPress:F,isDisabled:!d,children:P("chat.edit")}),(0,N.jsx)(tl.i,{size:"sm",isSelected:d,onValueChange:c,isDisabled:Y,classNames:{wrapper:"group-data-[selected=true]:bg-blue-500",thumb:"group-data-[selected=true]:bg-white dark:group-data-[selected=true]:bg-black"}})]})]}),W.functionCalling&&(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsx)(T.e,{content:(0,N.jsxs)("div",{className:"text-xs",children:[(0,N.jsx)("div",{children:P("chat.functionCallingTooltip")}),(0,N.jsx)("div",{className:"text-gray-400",children:P("chat.functionCallingIncompatible")})]}),placement:"left",children:(0,N.jsx)("span",{className:"cursor-help text-sm text-gray-700 dark:text-gray-300",children:P("chat.functionCalling")})}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(ek.A,{variant:"light",size:"sm",className:(0,tn.Z)("h-7 min-w-0 px-3 font-semibold transition-colors",m?"bg-transparent text-black hover:bg-gray-100 dark:text-white dark:hover:bg-gray-800":"text-default-500 dark:text-default-600"),onPress:L,isDisabled:!m,children:P("chat.edit")}),(0,N.jsx)(tl.i,{size:"sm",isSelected:m,onValueChange:g,isDisabled:Q,classNames:{wrapper:"group-data-[selected=true]:bg-blue-500",thumb:"group-data-[selected=true]:bg-white dark:group-data-[selected=true]:bg-black"}})]})]}),W.googleSearch&&(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,N.jsx)(T.e,{content:P(H?"chat.webAccessTooltip":"chat.googleSearchTooltip"),placement:"left",children:(0,N.jsx)("span",{className:"cursor-help text-sm text-gray-700 dark:text-gray-300",children:P(H?"chat.webAccess":"chat.groundingGoogleSearch")})}),i&&!H&&(0,N.jsxs)("div",{className:"flex items-center gap-1 text-[11px] text-gray-500",children:[(0,N.jsx)("span",{children:P("chat.source")}),(0,N.jsx)(D.JO,{icon:"logos:google-icon",width:12}),(0,N.jsx)("span",{children:P("chat.googleSearchLabel")})]})]}),(0,N.jsx)(tl.i,{size:"sm",isSelected:i,onValueChange:o,isDisabled:ee,classNames:{wrapper:"group-data-[selected=true]:bg-blue-500",thumb:"group-data-[selected=true]:bg-white dark:group-data-[selected=true]:bg-black"}})]}),W.thinking&&(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsx)(T.e,{content:P(e6(t)?"chat.thinkingProcessTooltipWithoutThinkingProcess":"chat.thinkingProcessTooltip"),placement:"left",children:(0,N.jsx)("span",{className:"cursor-help text-sm text-gray-700 dark:text-gray-300",children:P(e6(t)?"chat.thinkingProcessWithoutThinkingProcess":"chat.thinkingProcess")})}),(0,N.jsx)(tl.i,{size:"sm",isSelected:f,onValueChange:y,classNames:{wrapper:"group-data-[selected=true]:bg-blue-500",thumb:"group-data-[selected=true]:bg-white dark:group-data-[selected=true]:bg-black"}})]}),W.thinkingLevel&&J.length>0&&(0,N.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,N.jsx)("div",{children:(0,N.jsx)(T.e,{content:P("chat.reasoningEffortTooltip"),placement:"right",children:(0,N.jsx)("span",{className:"inline-block cursor-help text-sm text-gray-700 dark:text-gray-300",children:P("chat.reasoningEffort")})})}),(0,N.jsx)("div",{className:(0,tn.Z)("grid w-full gap-2",J.length>=4?"grid-cols-3":"grid-cols-2"),children:J.map(e=>(0,N.jsx)("button",{type:"button",onClick:()=>null==b?void 0:b(e),className:(0,tn.Z)("flex items-center justify-center rounded-lg border-2 px-3 py-2 text-sm font-medium transition-all",v===e?"border-blue-500 bg-blue-50 text-blue-600 dar
1k:border-blue-400 dark:bg-blue-900/20 dark:text-blue-400":"border-gray-200 bg-white text-gray-700 hover:border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300 dark:hover:border-gray-500"),children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),V.supported&&(0,N.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,N.jsx)("div",{className:"min-w-0 pt-2",children:(0,N.jsx)(T.e,{content:P("chat.maxTokensTooltip"),placement:"right",children:(0,N.jsx)("span",{className:"inline-block cursor-help text-sm text-gray-700 dark:text-gray-300",children:P("chat.maxTokens")})})}),(0,N.jsx)(ts.Y,{type:"number",min:1,value:w,onValueChange:e=>{let t=e.replace(/[^\d]/g,"");null==j||j(t)},placeholder:V.default?String(V.default):"",className:"max-w-[90px] flex-shrink-0",size:"sm",classNames:{inputWrapper:"min-h-8 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600",input:"text-xs text-gray-900 dark:text-white",description:"text-xs text-gray-500 dark:text-gray-400"}})]}),W.stream&&(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsx)(T.e,{content:P("chat.codexStreamingTooltip"),placement:"left",children:(0,N.jsx)("span",{className:"cursor-help text-sm text-gray-700 dark:text-gray-300",children:P("chat.codexStreaming")})}),(0,N.jsx)(tl.i,{size:"sm",isSelected:!!s,onValueChange:e=>null==n?void 0:n(e),classNames:{wrapper:"group-data-[selected=true]:bg-blue-500",thumb:"group-data-[selected=true]:bg-white dark:group-data-[selected=true]:bg-black"}})]})]})]}),(0,N.jsx)(tg,{isOpen:R,onClose:M,onSave:C,initialData:k,selectedModel:t}),(0,N.jsx)(th,{isOpen:O,onClose:B,onSave:S,initialData:I,selectedModel:t}),(0,N.jsx)(tx,{isOpen:U,onClose:z,onConfirm:()=>null==l?void 0:l(!0)})]})},tv=(0,Y.Pi)(function(e){let{models:t,currentModel:a,messages:r=[],transientErrorMessage:l=null,onSendMessage:s,isGenerating:n=!1,streamContent:i="",streamReasoningContent:o="",consumeCredit:d=0,creditLoading:c=!1,supportFileUpload:u=!0,chooseFormat:p,isConcatHistory:m,setIsConcatHistory:g,onModelChange:h}=e,{userStore:x}=(0,_.o)(),{isOpen:f,onOpen:y,onClose:v}=(0,ew.q)(),[b,w]=(0,E.useState)(!1),[j,k]=(0,E.useState)(""),[C,I]=(0,E.useState)("image"),[S,A]=(0,E.useState)(a||t[0]||""),[P,D]=(0,E.useState)(!1),[T,R]=(0,E.useState)(!1),[F,M]=(0,E.useState)(!1),[O,L]=(0,E.useState)(!0),[B,U]=(0,E.useState)(!1),[Z,z]=(0,E.useState)(!0),[q,K]=(0,E.useState)(()=>e1(a||t[0]||"")),[G,W]=(0,E.useState)(null),[V,H]=(0,E.useState)([]),[J,$]=(0,E.useState)(!0),[Y,X]=(0,E.useState)(""),Q=t.map(e=>({key:e,label:e}));(0,E.useEffect)(()=>{a&&t.includes(a)?A(e=>e!==a?a:e):t.length>0&&!a&&A(t[0])},[a,t]),(0,E.useEffect)(()=>{K(e1(S||a||t[0]||""))},[S,a]);let ee=(0,E.useCallback)(async e=>{if(!x.user)throw y(),Error("User not logged in");if(s)return await s(e,S,{googleSearchEnabled:O,structuredOutputEnabled:P,structuredOutputData:G,codeExecutionEnabled:T,functionCallingEnabled:F,functionCallingData:V,urlContextEnabled:B,includeThoughtsEnabled:Z,reasoningEffort:q,codexStreamingEnabled:J,claudeMaxTokens:Y})},[x.user,s,y,S,O,P,G,T,F,V,B,Z,q,J,Y]),et=(0,E.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image";k(e),I(t),w(!0)},[]);return(0,N.jsxs)("div",{className:"flex h-full rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsx)(ty,{selectedModel:S,onModelChange:e=>{A(e),t.length>1&&h&&h(e)},memoryEnabled:m||!1,onMemoryChange:e=>{g(e)},codexStreamingEnabled:J,onCodexStreamingChange:$,googleSearchEnabled:O,onGoogleSearchChange:e=>{L(e)},structuredOutputEnabled:P,onStructuredOutputChange:D,codeExecutionEnabled:T,onCodeExecutionChange:R,functionCallingEnabled:F,onFunctionCallingChange:M,urlContextEnabled:B,onUrlContextChange:U,includeThoughtsEnabled:Z,onIncludeThoughtsChange:z,reasoningEffort:q,onReasoningEffortChange:K,claudeMaxTokens:Y,onClaudeMaxTokensChange:X,structuredOutputData:G,onStructuredOutputDataChange:W,functionCallingData:V,onFunctionCallingDataChange:H,modelOptions:Q}),(0,N.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,N.jsx)(eZ,{messages:r,transientErrorMessage:l,isGenerating:n,streamContent:i,streamReasoningContent:o,onPreviewImage:et}),(0,N.jsx)(te,{currentModel:S||a,onSend:ee,disabled:!1,isGenerating:n,consumeCredit:d,creditLoading:c,supportFileUpload:u,chooseFormat:p})]}),(0,N.jsx)(tt.default,{isOpen:f,onClose:v,onLoginSuccess:()=>{x.loadUserInfo()}}),b&&j&&(0,N.jsx)(eG.Z,{imageUrl:j,fileType:C,setIsPreviewOpen:w})]})});let tb=e=>{switch(eH(e)){case"response":return eb.kU.CODEX;case"gemini":return eb.kU.GEMINI;case"claude":return eb.kU.CLAUDE;default:return}};var tw=(0,Y.Pi)(function(e){let{pageData:t,currentPageData:a,onModelChange:r}=e,{userStore:l}=(0,_.o)(),{t:s}
1=(0,X.Z)("common");eV(((null==t?void 0:t.groupData)||[]).map(e=>null==e?void 0:e.chatModelConfig).filter(Boolean));let n=(null==t?void 0:t.groupData)&&Array.isArray(t.groupData)?t.groupData.map(e=>(null==e?void 0:e.path)||(null==e?void 0:e.model)).filter(Boolean):[],i=(null==a?void 0:a.path)||(null==a?void 0:a.model)||n[0]||"",o=e4(i),[d,c]=(0,E.useState)("defaultFormat"),[u,p]=(0,E.useState)([]),[m,g]=(0,E.useState)(null),[h,x]=(0,E.useState)(!1),[f,y]=(0,E.useState)(""),[v,b]=(0,E.useState)(""),w=(0,E.useRef)(""),j=(0,E.useRef)(""),k=(0,E.useRef)(null),C=(0,E.useRef)(null),I=(0,E.useRef)(null),S=(0,E.useRef)(null),A=(0,E.useRef)(null),[P,D]=(0,E.useState)(!1),T=async function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",{googleSearchEnabled:l=!1,structuredOutputEnabled:s=!1,structuredOutputData:n=null,functionCallingEnabled:i=!1,functionCallingData:o=[],includeThoughtsEnabled:d=!0,reasoningEffort:c="high",codexStreamingEnabled:u=!0,claudeMaxTokens:p=""}=a,m="response"===eH(r),g="gemini"===eH(r),h="claude"===eH(r),x=eJ(r),f=eY(r,u),y=!!c&&x.thinkingLevel&&e2(r);if(m){let a={model:r,stream:f,input:B(t,e,P)},d=[],u=eX(r);l&&x.googleSearch&&u&&d.push({type:u}),i&&x.functionCalling&&Array.isArray(o)&&o.length>0&&d.push(...o),d.length>0&&(a.tools=d,d.some(e=>"function"===e.type)&&(a.tool_choice="auto")),y&&(a.reasoning={effort:c}),s&&n&&x.structuredOutput&&Object.keys(n).length>0&&(a.text={format:{type:"json_schema",name:"structured_output",strict:!0,schema:n}});let p=Z(t);return p.content.forEach(e=>{"image_url"!==e.type&&"text"!==e.type&&(e.image_url={url:e[e.type].url},delete e[e.type],e.type="image_url")}),{requestData:a,userMessage:p}}if(g){let a=Z(t);a.content.forEach(e=>{"image_url"!==e.type&&"text"!==e.type&&(e.image_url={url:e[e.type].url},delete e[e.type],e.type="image_url")});let r={stream:f,contents:M(t,e,P)};l&&x.googleSearch&&(r.tools=[{googleSearch:{}}]),i&&x.functionCalling&&Array.isArray(o)&&o.length>0&&(r.tools=r.tools||[],r.tools.push(...o));let s={};return x.thinking&&(s.includeThoughts=!!d),y&&(s.thinkingLevel=c),Object.keys(s).length>0&&(r.generationConfig={...r.generationConfig,thinkingConfig:s}),{requestData:r,userMessage:a}}if(h){let a=O(t,e,P),l=Number.parseInt(String(p||"").trim(),10),c=e5(r),u={model:r,messages:a,stream:f,system:"You are a helpful AI assistant."};if(c.supported){var v;u.max_tokens=Number.isFinite(l)&&l>0?l:null!==(v=c.default)&&void 0!==v?v:4096}i&&x.functionCalling&&Array.isArray(o)&&o.length>0&&(u.tools=u.tools||[],u.tools.push(...o)),s&&n&&x.structuredOutput&&Object.keys(n).length>0&&(u.output_config={format:{type:"json_schema",schema:n}}),x.thinking&&d&&(u.thinkingFlag=!0);let m=Z(t);return m.content.forEach(e=>{"image_url"!==e.type&&"text"!==e.type&&(e.image_url={url:e[e.type].url},delete e[e.type],e.type="image_url")}),{requestData:u,userMessage:m}}let b=Z(t);b.content.forEach(e=>{"image_url"!==e.type&&"text"!==e.type&&(e.image_url={url:e[e.type].url},delete e[e.type],e.type="image_url")});let w={stream:f,messages:P?e.concat(b):b},j=[],k=eX(r);return l&&x.googleSearch&&k&&j.push({type:"function",function:{name:k}}),s&&n&&x.structuredOutput&&(w.response_format={type:"json_schema",json_schema:{name:"structured_output",strict:!0,schema:n}}),i&&x.functionCalling&&Array.isArray(o)&&o.length>0&&j.push(...o),j.length>0&&(w.tools=j),x.thinking&&d&&(w.include_thoughts=!0),y&&(w.reasoning_effort=c),{requestData:w,userMessage:b}},R=e=>e.startsWith("image/")?"image_url":e.startsWith("video/")?"video_url":e.startsWith("audio/")?"audio_url":e.includes("pdf")||e.includes("word")||e.includes("document")||e.includes("excel")||e.includes("spreadsheet")||e.includes("text")?"doc_url":"other_url",F=(e,t)=>e&&(e.startsWith("http://")||e.startsWith("https://"))?{file_data:{mime_type:t||"image/jpeg",file_uri:e}}:null,M=(e,t,a)=>{var r,l;let{text:s,files:n=[]}=e,i=[];for(let e of(s&&s.trim()&&i.push({text:s.trim()}),n))if(null===(r=e.type)||void 0===r?void 0:r.startsWith("image/")){let t=F(e.url,e.type);t&&i.push(t)}0===i.length&&i.push({text:""});let o={role:"user",parts:i};if(!a)return[o];let d=[];for(let e of t){let t="assistant"===e.role?"model":"user",a=[];if("string"==typeof e.content)a=[{text:e.content}];else if(Array.isArray(e.content)){for(let t of e.content)if("text"===t.type&&t.text&&a.push({text:t.text}),"image_url"===t.type&&(null===(l=t.image_url)||void 0===l?void 0:l.url)){let e=F(t.image_url.url);e&&a.push(e)}0===a.length&&(a=[{text:""}])}d.push({role:t,parts:a})}return d.push(o),d},O=(e,t,a)=>{var r,l;let{text:s,files:n=[]}=e,i=[];for(let e of(s&&s.trim()&&i.push({type:"text",text:s.trim()}),n))(null===(r=e.type)||void 0===r?void 0:r.startsWith("image/"))&&e.url&&i.push({type:"image",source:{type:"url",url:e.url}});0===i.length&&i.push({type:"text",text:""});let o={role:"user",content:i};if(!a)return[o];let d=[];for(let e of t){let t="assistant"===e.role?"assistant":"user",a=[];if("string"==typeof e.content)a=[{type:"text",text:e.content}];else if(Array.isArray(e.content)){for(let t of e.content)"text"===t.type&&t.text&&a.push({type:"text",text:t.text}),"image_url"===t.type&&(null===(l=t.image_url)||void 0===l?void 0:l.url)&&a.push({type:"image",source:{type:"url",url:t.image_url.url}});0===a.length&&(a=[{type:"text",text:""}])}d.push({role:t,content:a})}return d.push(o),d},L=e=>{let{text:t,files:a=[]}=e,r=[];return t&&t.trim()&&r.push({type:"input_text",text:t.trim()}
1),a.forEach(e=>{e.url&&(e.type&&e.type.startsWith("image/")?r.push({type:"input_image",image_url:e.url}):r.push({type:"input_file",file_url:e.url}))}),0===r.length&&r.push({type:"input_text",text:""}),r},B=(e,t,a)=>{let r={role:"user",content:L(e)};return a?[...t.map(e=>U(e)).filter(Boolean),r]:[r]},U=e=>{let t="assistant"===e.role?"assistant":"user",a=[];if("string"==typeof e.content)a.push({type:"assistant"===t?"output_text":"input_text",text:e.content});else if(Array.isArray(e.content))for(let n of e.content){var r,l,s;"text"===n.type&&n.text?a.push({type:"assistant"===t?"output_text":"input_text",text:n.text}):"user"===t&&"image_url"===n.type&&(null===(r=n.image_url)||void 0===r?void 0:r.url)?a.push({type:"input_image",image_url:n.image_url.url}):"user"===t&&"doc_url"===n.type&&(null===(l=n.doc_url)||void 0===l?void 0:l.url)?a.push({type:"input_file",file_url:n.doc_url.url}):"user"===t&&n.type&&(null===(s=n[n.type])||void 0===s?void 0:s.url)&&a.push({type:"input_file",file_url:n[n.type].url})}return 0===a.length?null:{role:t,content:a}},Z=e=>{let{text:t,files:a=[]}=e;if(!o)return{role:"user",content:t||""};{let e=[t?{type:"text",text:t}:null,...a.map(e=>{let t=R(e.type);return{type:t,[t]:{url:e.url}}})].filter(Boolean);return{role:"user",content:e.length>0?e:[{type:"text",text:""}]}}},z=async function(e,t){var a;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(h){let e=Error("Please wait for the current message to complete");throw J.ZP.error(e.message),e}if(!(null===(a=e.text)||void 0===a?void 0:a.trim())&&(!e.files||0===e.files.length)){let e=Error("Please enter a message or upload files");throw J.ZP.error(e.message),e}g(null);let{requestData:n,userMessage:i}=await T(u,e,r,t);return p([...u,i]),x(!0),y(""),b(""),w.current="",j.current="",k.current=null,C.current=null,I.current=null,S.current=null,A.current=null,new Promise((e,a)=>{var r;let i;let o=!1,d="response"===eH(t),c="gemini"===eH(t),u="claude"===eH(t),m=tb(t);i=d?e7(t):c?"/gemini/v1/models/".concat(t,":streamGenerateContent"):u?"/claude/v1/messages":void 0,(0,eb.p)({apiKey:null===(r=l.user)||void 0===r?void 0:r.apiKey,requestData:n,model:t,customEndpoint:i,...m&&{streamFormat:m},onMessage:(e,t,a)=>{y(e=>{let a=e+t;return w.current=a,a}),a&&(j.current+=a,b(j.current))},onError:e=>{if(console.log("onError called",{error:e,isResolvedOrRejected:o}),o){console.warn("onError: already resolved/rejected, this should not happen");return}o=!0,console.log("onError: setting isResolvedOrRejected = true, proceeding with error handling"),x(!1),y(""),b(""),w.current="",j.current="",k.current=null,C.current=null,I.current=null,S.current=null,A.current=null,p(e=>e.slice(0,-1));let t=(null==e?void 0:e.displayInChat)===!0,r=t&&e.message||s("generateError.generateRequest");t&&g({role:"assistant",content:[{type:"text",text:r}],isTransientError:!0}),J.ZP.error(r),a(e)},onComplete:(a,r,l,s,n,i,d)=>{o||(o=!0,null!=l&&(k.current=l),null!=s&&(C.current=s),e3(t)&&null!=n&&(I.current=n),null!=i&&(S.current=i),null!=d&&(A.current=d),x(!1),setTimeout(()=>{let t=null!=r?String(r):w.current;t||j.current||!a||(t="```json\n".concat(String(a).trim(),"\n```"));let l={role:"assistant",content:[{type:"text",text:t}],...j.current?{reasoningContent:j.current}:{},...null!==k.current?{creditsConsumed:k.current}:{},...null!==C.current?{promptTokens:C.current}:{},...null!==I.current?{cachedTokens:I.current}:{},...null!==S.current?{completionTokens:S.current}:{},...null!==A.current?{reasoningTokens:A.current}:{}};p(e=>[...e,l]),y(""),b(""),w.current="",j.current="",k.current=null,C.current=null,I.current=null,S.current=null,A.current=null,e()},0))}}).catch(e=>{if(console.log(".catch() triggered",{isResolvedOrRejected:o,error:e}),o){console.log(".catch(): already resolved/rejected, skipping");return}o=!0,x(!1),y(""),b(""),w.current="",j.current="",k.current=null,C.current=null,I.current=null,S.current=null,A.current=null,p(e=>e.slice(0,-1));let t=(null==e?void 0:e.displayInChat)===!0,r=t&&e.message||s("generateError.generateRequest");t&&g({role:"assistant",content:[{type:"text",text:r}],isTransientError:!0}),J.ZP.error(r),a(e)})})},q=(e,t)=>
1{let a=new URL(window.location),r=t?"".concat(e,"/").concat(t):e;a.searchParams.set("model",r),window.history.pushState({...window.history.state},"",a.toString())};return(0,N.jsx)("div",{className:"h-[calc(100vh-200px)] min-h-[600px]",children:(0,N.jsx)(tv,{models:n,currentModel:i,messages:u,transientErrorMessage:m,onSendMessage:z,isGenerating:h,streamContent:f,streamReasoningContent:v,supportFileUpload:o,onClearChat:()=>{h||(p([]),g(null),y(""),b(""),w.current="",j.current="",k.current=null,totalTokensRef.current=null)},chooseFormat:d,isConcatHistory:P,setIsConcatHistory:D,onModelChange:e=>{if(n.length>1&&r&&(null==t?void 0:t.groupData)){let a=t.groupData.find(t=>((null==t?void 0:t.path)||(null==t?void 0:t.model))===e);a&&(q(a.userPath,a.path),r(a.userPath+(a.path?"/"+a.path:"")))}}})})}),tj=a(89998),tk=a(25043);let tN=a.n(tk)()(()=>Promise.resolve().then(a.bind(a,99245)),{loadableGenerated:{webpack:()=>[99245]},ssr:!1,loading:()=>(0,N.jsx)("div",{className:"flex h-64 items-center justify-center rounded-lg border border-gray-300 bg-gray-50 dark:border-gray-600 dark:bg-gray-700",children:(0,N.jsx)("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Loading JSON viewer..."})})});var tE=e=>{let{InputPanelContent:t,OutputPanelContent:a,run:r,formData:l,outputData:s,generating:n,credit:i,layoutRatio:o="50-50"}=e,[d,c]=(0,E.useState)("Form"),[u,p]=(0,E.useState)("Preview"),[m,g]=(0,E.useState)(!1),h=(0,E.useRef)(null),x=(e,t)=>{h.current=t,t.editor.defineTheme("custom-dark",{base:"vs-dark",inherit:!0,rules:[{token:"string.key.json",foreground:"9CDCFE"},{token:"string.value.json",foreground:"CE9178"},{token:"number.json",foreground:"B5CEA8"},{token:"keyword.json",foreground:"569CD6"}],colors:{"editor.background":"#374151","editor.foreground":"#F3F4F6","editorLineNumber.foreground":"#6B7280","editor.selectionBackground":"#4B5563","editor.inactiveSelectionBackground":"#374151"}}),t.editor.defineTheme("custom-light",{base:"vs",inherit:!0,rules:[{token:"string.key.json",foreground:"0451A5"},{token:"string.value.json",foreground:"A31515"},{token:"number.json",foreground:"098658"},{token:"keyword.json",foreground:"0000FF"}],colors:{"editor.background":"#F9FAFB","editor.foreground":"#1F2937","editorLineNumber.foreground":"#9CA3AF","editor.selectionBackground":"#E5E7EB","editor.inactiveSelectionBackground":"#F3F4F6"}}),t.editor.setTheme(m?"custom-dark":"custom-light")};(0,E.useEffect)(()=>{let e=()=>{g(document.documentElement.classList.contains("dark"))};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]),(0,E.useEffect)(()=>{h.current&&h.current.editor.setTheme(m?"custom-dark":"custom-light")},[m,h.current]);let f=e=>{try{return JSON.stringify(e,null,2)}catch(e){return""}};return(0,N.jsxs)("div",{className:"grid grid-cols-1 gap-6 ".concat("40-60"===o?"lg:grid-cols-[40%_60%]":"lg:grid-cols-2"),children:[(0,N.jsxs)("div",{className:"rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsx)("div",{className:"border-b border-gray-200 p-4 dark:border-gray-700",children:(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsx)("div",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Input"}),(0,N.jsx)("div",{className:"flex rounded-lg bg-gray-100 p-1 dark:bg-gray-700",children:["Form","JSON"].map(e=>(0,N.jsx)("button",{onClick:()=>c(e),className:"".concat(d===e?"bg-white text-gray-900 shadow-sm dark:bg-gray-600 dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"," rounded-md px-3 py-1.5 text-sm font-medium transition-all"),children:e},e))})]})}),(0,N.jsxs)("div",{className:"space-y-6 p-6 pb-0 ".concat("Form"===d?"block":"hidden"),children:[t&&(E.isValidElement(t)?t:(0,N.jsx)(t,{})),(0,N.jsx)("div",{className:"sticky bottom-0 flex items-center justify-end gap-3 border-t border-gray-200 bg-white pb-6 pt-4 dark:border-gray-700 dark:bg-gray-800",children:(0,N.jsx)(ek.A,{color:"primary",onPress:r,isDisabled:n,isLoading:n,className:"bg-blue-500 text-white hover:bg-blue-400",children:n?(0,N.jsx)(N.Fragment,{children:"Generating..."}):(0,N.jsx)(N.Fragment,{children:i>0?(0,N.jsxs)("span",{className:"inline-flex items-center gap-1 text-white opacity-80",children:[(0,N.jsx)(I.Z,{className:"h-4 w-4"}),i," Credits"]}):"Run"})})})]}),(0,N.jsxs)("div",{className:"p-6 pt-2 ".concat("JSON"===d?"block":"hidden"),children:[(0,N.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,N.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Input Data"}),(0,N.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(f(l)),J.ZP.success("Copied to clipboard")},className:"flex items-center gap-2 rounded-lg px-3 py-1.5 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700",children:"Copy"})]}),(0,N.jsx)("div",{className:"overflow-hidden rounded-lg border border-gray-200 dark:border-gray-600",children:(0,N.jsx)(tN,{height:320,language:"json",value:f(l),onMount:x,options:{readOnly:!0,stickyScroll:{enabled:!1},minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,tabSize:2,wordWrap:"on",lineNumbers:"on",folding:!0,bracketPairColorization:{enabled:!0},padding:{top:8,bottom:8},roundedSelection:!1,scrollbar:{vertical:"auto",horizontal:"auto"},contextmenu:!1,selectOnLineNumbers:!1,automaticLayout:!0}})})]})]}),(0,N.jsxs)("div",{className:"rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsx)("div",{className:"border-b border-gray-200 p-4 dark:border-gray-700",children:(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsx)("div",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Output"}),(0,N.jsx)("div",{className:"flex rounded-lg bg-gray-100 p-1 dark:bg-gray-700",children:["Preview","JSON"].map(e=>(0,N.jsx)("button",{onClick:()=>p(e),className:"".concat(u===e?"bg-white text-gray-900 shadow-sm dark:bg-gray-600 dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"," rounded-md px-3 py-1.5 text-sm font-medium transition-all"),children:e},e))})]})}),(0,N.jsx)("div",{className:"space-y-6 p-6 pb-0 ".concat("Preview"===u?"block":"hidden"),children:a&&(E.isValidElement(a)?a:(0,N.jsx)(a,{}))}),(0,N.jsxs)("div",{className:"p-6 pt-2 ".concat("JSON"===u?"block":"hidden"),children:[(0,N.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,N.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Output Data"}),(0,N.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(f(s)),J.ZP.success("Copied to clipboard")},className:"flex items-center gap-2 rounded-lg px-3 py-1.5 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700",children:"Copy"})]}),(0,N.jsx)("div",{className:"rounded-lg border border-gray-200 dark:border-gray-600",children:(0,N.jsx)(tN,{height:320,language:"json",value:f(s),onMount:x,options:{stickyScroll:{enabled:!1},readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,tabSize:2,wordWrap:"on",lineNumbers:"on",folding:!0,bracketPairColorization:{enabled:!0},padding:{top:8,bottom:8},roundedSelection:!1,scrollbar:{vertical:"auto",horizontal:"auto"},contextmenu:!1,selectOnLineNumbers:!1,automaticLayout:!0}})})]})]})]})},tC=a(18595),tI=a(18604),tS=a(12732),tA=a(82950),tP=a(12245),tD=a(170
177),tT=a(68937),t_=a(4367);function tR(e){let{recordDetails:t,progress:a,generating:r}=e,[l,s]=(0,E.useState)(null),[n,i]=(0,E.useState)(!1),o=(0,E.useRef)(null);(0,E.useEffect)(()=>{var e,a;let r=(null==t?void 0:null===(e=t.response)||void 0===e?void 0:e.sunoData)||(null==t?void 0:null===(a=t.completeData)||void 0===a?void 0:a.data)||[];if(0===r.length){s(null);return}s(e=>{if(!e)return r[0];let t=r.find(t=>t.id===e.id);return t?t.audioUrl!==e.audioUrl||t.sourceStreamAudioUrl!==e.sourceStreamAudioUrl||t.streamAudioUrl!==e.streamAudioUrl?t:e:r[0]})},[t]);let d=e=>{if((0,tT.o)(e)){if(l&&l.id===e.id){var t;null===(t=o.current)||void 0===t||t.autoPlayPause()}else s({...e})}};return(0,N.jsx)("div",{className:"relative m-auto flex w-full flex-col items-center justify-center lg:h-[80vh] lg:w-[100%]",children:(0,N.jsx)("div",{className:"flex w-full flex-1 flex-col-reverse items-start justify-between overflow-y-auto p-4 lg:h-full lg:flex-row",children:(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-start gap-2",children:[(()=>{var e,a;if(t_.Ti.includes(null==t?void 0:t.status)||(null==t?void 0:t.state)===3)return(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 whitespace-pre-line py-6 text-center text-rose-600",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"failed",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-1.5 px-4 text-center",children:[(0,N.jsx)("p",{className:"text-rose-600",children:"Generation Failed"}),t.errorMessage&&(0,N.jsx)("p",{className:"text-rose-600",children:t.errorMessage}),(0,N.jsx)("p",{className:"text-xs text-rose-500",children:"Credits will not be deducted for failed generations"})]})]});if(!t||0===Object.keys(t).length||!t.status)return r?(0,N.jsxs)("div",{className:"flex w-full flex-col items-center",children:[(0,N.jsxs)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 shadow-sm dark:bg-gray-800",children:[(0,N.jsx)("span",{className:"aspect-square w-20 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsxs)("div",{className:"flex flex-1 flex-col items-start gap-2",children:[(0,N.jsx)("span",{className:"h-6 w-40 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsx)("span",{className:"h-6 w-1/2 rounded-lg bg-gray-200 dark:bg-gray-700"})]})]}),r&&(0,N.jsx)("div",{className:"flex w-full items-center justify-center py-6",children:(0,N.jsx)(tS.Z,{loading:!0,color:"#3b82f6",size:10})})]}):(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:[(0,N.jsx)(tA.Z,{loading:r,color:"#3b82f6",size:10}),(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"music",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Transform your thoughts into songs instantly and unleash your creativity!"})]});let s=(null===(e=t.response)||void 0===e?void 0:e.sunoData)||(null===(a=t.completeData)||void 0===a?void 0:a.data)||[];return s.length>0?(0,N.jsx)("div",{className:"flex w-full flex-col items-start rounded-xl p-3 shadow-sm",children:s.map((e,t,a)=>(0,N.jsxs)(E.Fragment,{children:[(0,N.jsx)("div",{onClick:()=>d(e),className:"flex w-full cursor-pointer items-center break-words transition-colors hover:bg-gray-50 dark:hover:bg-gray-800",children:(0,N.jsxs)("div",{className:"flex w-full items-start gap-2",children:[(0,N.jsxs)("div",{className:"relative aspect-square w-20 overflow-hidden rounded-lg",children:[e.imageUrl?(0,N.jsx)("img",{src:e.imageUrl,alt:"cover",className:"h-full w-full rounded-lg object-cover"}):(0,N.jsx)("span",{className:"inline-block h-20 w-20 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,tT.o)(e)?(0,N.jsx)(N.Fragment,{children:n&&(null==l?void 0:l.id)===e.id?(0,N.jsx)("span",{className:"absolute left-1/2 top-1/2 inline-flex h-8 w-8 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-black/20 backdrop-blur-sm",children:(0,N.jsx)(tI.Z,{icon:"music_pause",className:"w-4 fill-neutral-50"})}):(0,N.jsx)("span",{className:"absolute left-1/2 top-1/2 inline-flex h-8 w-8 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-black/20 backdrop-blur-sm",children:(0,N.jsx)(tI.Z,{icon:"music_play",className:"w-4 fill-neutral-50"})})}):(0,N.jsx)("span",{className:"absolute left-0 top-0 inline-flex h-full w-full items-center justify-center bg-black/5 backdrop-blur-sm",children:(0,N.jsx)(tP.Z,{color:"var(--tool-color-primary-contrast)",size:26})})]}),(0,N.jsxs)("div",{className:"flex max-w-[70%] flex-1 flex-col items-start gap-1",children:[(0,N.jsx)("p",{className:"w-full truncate font-medium text-gray-900 dark:text-white",children:e.title||"Untitled"}),(0,N.jsxs)("div",{className:"flex w-full flex-col items-start gap-2 text-sm",children:[e.tags&&(0,N.jsx)("p",{className:"max-w-full truncate rounded-full border border-blue-500 px-2 py-0.5 text-xs text-blue-500",children:e.tags}),e.artist&&(0,N.jsx)("p",{className:"w-full truncate text-xs text-gray-500 dark:text-gray-400",children:e.artist})]})]})]})}),t<a.length-1&&(0,N.jsx)("span",{className:"my-3 h-[1px] w-full bg-gray-200 dark:bg-gray-700"})]},e.id||t))}):(0,N.jsx)("div",{className:"flex w-full flex-col items-start rounded-xl p-3 shadow-sm",children:(0,N.jsxs)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 dark:bg-gray-800",children:[(0,N.jsx)("span",{className:"aspect-square w-20 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsxs)("div",{className:"flex flex-1 flex-col items-start gap-2",children:[(0,N.jsx)("span",{className:"h-6 w-40 rounded-lg bg-gray-200 dark:bg-gray-700"}
1),(0,N.jsx)("span",{className:"h-6 w-1/2 rounded-lg bg-gray-200 dark:bg-gray-700"})]})]})})})(),(0,tT.o)(l)&&(0,N.jsx)("div",{className:"sticky bottom-0 left-0 w-full border-t border-gray-200 bg-white py-4 dark:border-gray-700 dark:bg-gray-800 lg:relative",children:(0,N.jsx)(tD.Z,{ref:o,audioItem:l,setIsPlaying:i,className:"w-full rounded-lg border-gray-200 bg-white p-4 dark:border-gray-600 dark:bg-gray-800"})}),a&&!(0,tT.o)(l)&&(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2 px-4 py-2",children:[(0,N.jsx)("div",{className:"relative h-1.5 w-full rounded-full bg-gray-200 dark:bg-gray-700",children:(0,N.jsx)("span",{style:{width:"".concat(a,"%")},className:"absolute left-0 top-0 h-full rounded-full bg-blue-500"})}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-center gap-1 text-xs text-blue-500",children:[(0,N.jsx)(tP.Z,{color:"#3b82f6",size:14}),(0,N.jsx)("span",{children:"It takes 20-40 second to generate, please wait patiently"})]})]}),(null==l?void 0:l.prompt)&&(0,N.jsx)("div",{className:"w-full whitespace-pre-line break-words pb-28 leading-7 text-gray-900 dark:text-gray-100",children:l.prompt})]})})})}var tF=a(50318),tM=a(19701),tO=a.n(tM);function tL(e,t){let a=0,r=0,l=0;for(let s=0;s<e.length;s++)a<=t&&(r=s,l=a),e.charCodeAt(s)>127?a+=2:a+=1;return{length:a,lastIndex:r,realLength:l}}function tB(e){let{value:t="",onChange:a,onBlur:r,rows:l=6,placeholder:s="",className:n="",maxLength:i=1e3,disabled:o=!1,clampStrategy:d}=e,c=(e,t)=>(function(e,t){if(!e)return{value:"",trimmed:!1};let a=e,r=!1,l=tL(a,t);for(;l.length>t&&a;)r=!0,l=tL(a=a.slice(0,Math.max(l.lastIndex,0)),t);return{value:a,trimmed:r}})(e,t);(0,E.useEffect)(()=>{let{value:e,trimmed:r}=(d||c)(t||"",i);r&&e!==t&&"function"==typeof a&&a({target:{value:e}})},[i,t,d,a]);let u=function(e,t){let a=Math.min(tL(e||"",t).length,t);return t-a}(t,i);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)("div",{className:"jsx-1da940b33ef551d3 "+"flex w-full flex-col items-start overflow-hidden rounded-lg border border-gray-300 focus-within:border-2 focus-within:border-blue-500 dark:border-gray-600 ".concat(n),children:[(0,N.jsx)("textarea",{value:t,onChange:e=>{var t,r;let{value:l}=(d||c)(null!==(r=null==e?void 0:null===(t=e.target)||void 0===t?void 0:t.value)&&void 0!==r?r:"",i);"function"==typeof a&&a({...e,target:{...(null==e?void 0:e.target)||{},value:l}})},onBlur:e=>{var t,a;let{value:l}=(d||c)(null!==(a=null==e?void 0:null===(t=e.target)||void 0===t?void 0:t.value)&&void 0!==a?a:"",i);"function"==typeof r&&r({...e,target:{...(null==e?void 0:e.target)||{},value:l}})},rows:l,placeholder:s,disabled:o,className:"jsx-1da940b33ef551d3 scrollable-textarea w-full resize-none overflow-y-auto bg-transparent p-2 text-sm text-gray-900 outline-none placeholder:text-gray-400 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-gray-700 dark:text-white dark:placeholder:text-gray-500"}),(0,N.jsxs)("div",{className:"jsx-1da940b33ef551d3 w-full px-2 py-1 text-xs text-gray-500",children:[i-u,"/",i]})]}),(0,N.jsx)(tO(),{id:"1da940b33ef551d3",children:".scrollable-textarea{scrollbar-width:thin;scrollbar-color:#9ca3af transparent}.scrollable-textarea::-webkit-scrollbar{width:8px}.scrollable-textarea::-webkit-scrollbar-track{background:transparent}.scrollable-textarea::-webkit-scrollbar-thumb{background-color:#9ca3af;-webkit-border-radius:9999px;-moz-border-radius:9999px;border-radius:9999px}.dark .scrollable-textarea::-webkit-scrollbar-thumb{background-color:#4b5563}"})]})}var tU=a(53222),tZ=function(e){let{label:t,required:a=!1,name:r,value:l="",onChange:s,onBlur:n,placeholder:i="",description:o="",type:d="text",className:c=""}=e;return(0,N.jsxs)("div",{className:c,children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:[t,a&&(0,N.jsx)("span",{className:"text-red-500",children:" *"})]}),(0,N.jsx)("input",{type:d,name:r,value:l,onChange:s,onBlur:n,placeholder:i,className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),o&&(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:o})})]})};function tz(e){let{label:t,options:a=[],value:r,onChange:l,description:s,required:n=!1,name:i,className:o=""}=e,d=e=>{let t=a.find(t=>t.value===e);(null==t||!t.disabled)&&l&&l(e,i)};return(0,E.useEffect)(()=>
1{if(r&&a.length>0){let e=a.find(e=>e.value===r);if(null==e?void 0:e.disabled){let e=a.find(e=>!e.disabled);e&&l?l(e.value,i):l&&l(void 0,i)}}},[r,a,l,i]),(0,N.jsxs)("div",{className:o,children:[t&&(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:[t,n&&(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("div",{className:"flex cursor-pointer items-center gap-2 overflow-x-auto pb-2",children:a.map(e=>{let t=r===e.value,a=e.disabled;return(0,N.jsx)("button",{type:"button",disabled:a,onClick:()=>d(e.value),className:"flex h-[40px] min-w-[66px] items-center justify-center space-x-2 rounded-lg border-2 p-3 transition-all ".concat(t&&!a?"border-blue-500 bg-blue-50 dark:border-blue-400 dark:bg-blue-900/20":a?"cursor-not-allowed border-gray-300 bg-gray-100 opacity-50 dark:border-gray-600 dark:bg-gray-800":"border-gray-200 bg-white dark:border-gray-600 dark:bg-gray-700"," ").concat(a?"":"hover:border-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20"),children:(0,N.jsx)("span",{className:"text-sm font-medium ".concat(t&&!a?"text-blue-600 dark:text-blue-400":a?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300"),children:e.label})},e.value)})}),s&&(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s})})]})}var tq=function(e){let{label:t,value:a,onChange:r,onBlur:l,min:s=0,max:n=1,step:i=.01,initialValue:o=.65,required:d=!1,clearable:c=!d}=e,u=null===a||""===a?"":null!=a?a:o,[p,m]=(0,E.useState)(u),g=(0,E.useRef)(""!==u&&Number.isFinite(Number(u))?Number(u):o),h=c&&!d;(0,E.useEffect)(()=>{let e=null===a||""===a?"":null!=a?a:o;m(e),""!==e&&Number.isFinite(Number(e))&&(g.current=Number(e))},[a,o]);let x=(0,E.useMemo)(()=>null==p||""===p?0:(Number(p)-s)/(n-s)*100,[p,s,n]);return(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 flex items-center justify-between text-sm font-medium text-gray-700 dark:text-gray-300",children:(0,N.jsxs)("span",{children:[t,d&&(0,N.jsx)("span",{className:"ml-1 text-red-500",children:"*"})]})}),(0,N.jsxs)("div",{className:"flex items-center gap-3",children:[(0,N.jsx)("div",{className:"flex-1",children:(0,N.jsx)("input",{type:"range",min:s,max:n,step:i,value:""===p||null===p?s:Number(p),onChange:e=>{let t=Number(e.target.value);m(t),g.current=t,r(t)},onMouseUp:e=>l&&l(Number(e.target.value)),className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 dark:bg-gray-600",style:{background:"linear-gradient(to right, #3B82F6 0%, #3B82F6 ".concat(x,"%, #e5e7eb ").concat(x,"%, #e5e7eb 100%)")}})}),(0,N.jsx)("div",{className:"w-16",children:(0,N.jsx)("input",{type:"number",min:s,max:n,step:i,value:p,onChange:e=>{let t=e.target.value;if(""===t){m(""),r(null);return}let a=Number(t);if(!Number.isFinite(a)){m(t);return}m(Math.max(s,Math.min(n,a)))},onBlur:()=>{if(""===p){if(d){let e=g.current;m(e),r(e),l&&l(e);return}r(null),l&&l(null);return}let e=Number(p);if(!Number.isFinite(e)){if(d){let e=g.current;m(e),r(e),l&&l(e)}else m(""),r(null),l&&l(null);return}let t=Math.max(s,Math.min(n,e)),a=Math.round((t-s)/i);t=s+a*i,t=Math.max(s,Math.min(n,t));let o=(i.toString().split(".")[1]||"").length;m(t=Number(t.toFixed(o))),g.current=t,l&&l(t)},required:d,className:"w-full appearance-none rounded-lg border border-gray-300 bg-white px-2 py-1 text-center text-sm text-gray-900 [-moz-appearance:textfield] focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"})}),h&&(0,N.jsx)("button",{type:"button",onClick:()=>{h&&(m(""),r(null),l&&l(null))},className:"flex h-7 w-7 items-center justify-center rounded border border-gray-300 bg-white text-gray-500 hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-400 dark:hover:bg-gray-600",children:(0,N.jsx)(D.JO,{icon:"carbon:close",className:"h-4 w-4"})})]})]})},tK=a(54443);let tG=["mp4","mov","webm"],tW={imageUrls:5,videoUrls:1,audioUrls:10},tV=e=>Array.isArray(e)?e.length:0,tH=e=>String(null!=e?e:"").trim()?1:0,tJ=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{exclude:t=[]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=a=>t.includes(a)?0:tV(e[a]),r=t.includes("lyrics")||!!e.instrumental;return(t.includes("style")?0:tH(e.style))+(r?0:tH(e.lyrics))+a("imageUrls")+a("videoUrls")+a("audioUrls")},t$=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return 1===tH(e[t])||10>tJ(e,{exclude:[t]})},tY=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;return Math.max(0,Math.min(null!==(e=tW[a])&&void 0!==e?e:10,10-tJ(t,{exclude:[a]})))},tX=(e,t,a)=>{if(!e||!String(e.type||"").startsWith("".concat(t,"/")))return!1;if(!Array.isArray(a)||0===a.length)return!0;let r=String(e.name||"").toLowerCase().split(".").pop();return a.includes(r)},tQ=(e,t)=>!!e&&(!t||t<=0||e.size<=t),t0=(e,t,a)=>!Number.isFinite(e)||e<=0||(!(t>0)||!(e<t))&&(!(a>0)||!(e>a)),t1=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"audio";return new Promise(a=>{var r;if(!e||"undefined"==typeof document||"function"!=typeof(null===(r=URL)||void 0===r?void 0:r.createObjectURL)){a(NaN);return}let l=URL.createObjectURL(e),s=document.createElement("video"===t?"video":"audio"),n=e=>{URL.revokeObjectURL(l),a(e)};s.preload="metadata",s.onloadedmetadata=()=>n(s.duration),s.onerror=()=>n(NaN),s.src=l})},t2=e=>!e||e<=0?"":"".concat(Math.round(e/1024/1024),"MB"),t5=e=>!e||e<=0?"":e>=60?"".concat(Math.round(e/60),"min"):"".concat(e,"s");var t4=function(e){let{label:t,urls:a=[],onChange:r,mediaType:l="audio",accept:s,extensions:n,maxFiles:i=1/0,maxSize:o=0,minDuration:d=0,maxDuration:c=0,bucket:u="kie-ai/market"}=e,p=(0,E.useRef)(null),[m,g]=(0,E.useState)(!1),[h,x]=(0,E.useState)({}),f=Number.isFinite(i),y=d>0||c>0,v=f&&a.length>=i,b=v&&a.length>0,w=t2(o),j=y?"".concat(t5(d)||"0s"," - ").concat(t5(c)||"â"):"",k="video"===l,C=()=>{p.current&&(p.current.value="")},I=async e=>{let t=Array.from(e.target.files||[]);if(t.length){if(f&&a.length+t.length>i){J.ZP.error("You can upload up to ".concat(i," ").concat(l," file").concat(i>1?"s":"")),C();return}if(t.find(e=>
1!tX(e,l,n)||!tQ(e,o))){J.ZP.error(w?"Please upload valid ".concat(l," files up to ").concat(w," each"):"Please upload valid ".concat(l," files")),C();return}g(!0);try{if(y&&(await Promise.all(t.map(e=>t1(e,l)))).some(e=>!t0(e,d,c))){J.ZP.error("".concat(k?"Video":"Audio"," duration must be ").concat(j));return}let e=await Promise.all(t.map(e=>(0,eK._R)(e,u))),s=[...a,...e],n=f?s.slice(0,i):s;x(a=>{let r={...a};return e.forEach((e,a)=>{var l;r[e]=(null===(l=t[a])||void 0===l?void 0:l.name)||""}),r}),null==r||r(n),J.ZP.success("".concat(k?"Video":"Audio"," uploaded successfully"))}catch(e){J.ZP.error("Failed to upload ".concat(l," files"))}finally{g(!1),C()}}},S=e=>{null==r||r(a.filter((t,a)=>a!==e))};return(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:t}),!b&&(0,N.jsx)("button",{type:"button",onClick:()=>{var e;return null===(e=p.current)||void 0===e?void 0:e.click()},disabled:m||v,className:"flex h-32 w-full flex-col items-center justify-center rounded-lg border-2 border-dashed border-gray-300 text-sm text-gray-600 transition-colors hover:border-blue-400 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-600 dark:text-gray-400",children:m?(0,N.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,N.jsx)("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-gray-300 border-t-blue-500"}),(0,N.jsx)("span",{className:"text-sm text-gray-500",children:"Uploading..."})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(D.JO,{icon:k?"carbon:video":"carbon:music",className:"mb-2 text-3xl text-gray-400"}),v?(0,N.jsxs)("span",{children:[k?"Video":"Audio"," limit reached"]}):(0,N.jsxs)("span",{children:["Click to upload ",l," file",f&&1===i?"":"s"]}),(0,N.jsx)("span",{className:"mt-1 text-xs text-gray-500",children:[(null==n?void 0:n.length)?n.join(" / ").toUpperCase():"",w?"Max ".concat(w," each"):"No size limit",f?"up to ".concat(i):"no count limit",j].filter(Boolean).join(", ")})]})}),(0,N.jsx)("input",{ref:p,type:"file",accept:s,onChange:I,multiple:!f||i>1,className:"hidden","data-testid":"".concat(l,"-upload-input")}),a.length>0&&(0,N.jsx)("ul",{className:"mt-3 space-y-2",children:a.map((e,t)=>(0,N.jsxs)("li",{className:"flex items-center justify-between gap-3 rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 dark:border-gray-600 dark:bg-gray-700",children:[(0,N.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,N.jsx)(D.JO,{icon:k?"carbon:video":"carbon:music",className:"shrink-0 text-xl text-blue-500"}),(0,N.jsx)("span",{className:"truncate text-xs text-gray-700 dark:text-gray-200",children:h[e]||e})]}),(0,N.jsx)("button",{type:"button",onClick:()=>S(t),className:"shrink-0 rounded-full p-1 text-red-500 transition-colors hover:bg-red-50 dark:hover:bg-red-900/20","aria-label":"Remove ".concat(l," ").concat(t+1),children:(0,N.jsx)(D.JO,{icon:"carbon:close",className:"h-4 w-4"})})]},e))})]})},t3=a(61978);let t6=["imageUrls","videoUrls","audioUrls"];var t7=function(e){var t;let{formData:a,setFormData:r}=e,[l,s]=(0,E.useState)([]),[n,i]=(0,E.useState)([]),[o,d]=(0,E.useState)(!1),c=(0,E.useRef)(null);(0,E.useEffect)(()=>{a&&0!==Object.keys(a).length?Array.isArray(a.imageUrls)&&a.imageUrls.length>0&&i(a.imageUrls.slice(0,5)):r({model:t_.aC[0].type,customMode:!1,instrumental:!1,prompt:"",lyrics:"",title:"",style:"",negativeTags:"",personaId:"",personaModel:"",vocalGender:"m",audioWeight:.65,styleWeight:.65,weirdnessConstraint:.65,variety:t_.cZ,imageUrls:[],videoUrls:[],audioUrls:[]})},[]);let u=async e=>{let t=Array.from(e.target.files||[]);if(!t.length)return;let l=v-n.length;if(t.length>l){J.ZP.error("You can upload up to ".concat(v," images"));return}if(t.find(e=>!(0,t3.DS)(e)||!(0,t3.rK)(e))){J.ZP.error("Images must be JPEG, JPG, PNG, or WEBP files up to 10MB each");return}d(!0);try{let e=await Promise.all(t.map(e=>(0,eK._R)(e,"kie-ai/market"))),l=[...(null==a?void 0:a.imageUrls)||[],...e].slice(0,v);s(e=>[...e,...t]),i(l),r(e=>({...e||{},imageUrls:l})),J.ZP.success("Cover images uploaded successfully")}catch(e){J.ZP.error("Failed to upload cover images")}finally{d(!1),c.current&&(c.current.value="")}},p=(e,t)=>{r(a=>({...a,[e]:t}))},m=(e,t)=>
1{r(a=>({...a||{},[e]:t}))},g=(e,t)=>{let a="customMode"===e&&t,l="instrumental"===e&&t;r(r=>({...r||{},[e]:t,...a?Object.fromEntries(t6.map(e=>[e,[]])):{},...l?{lyrics:""}:{}})),a&&(s([]),i([]))},h=t_.aC.find(e=>e.type===((null==a?void 0:a.model)||t_.aC[0].type))||t_.aC[0],x=(null==a?void 0:a.customMode)&&h.prompt_maxlength||3e3,f=h.style_maxlength||200,y=tJ(a),v=tY(a,"imageUrls"),b=tY(a,"videoUrls"),w=tY(a,"audioUrls"),j=!(null==a?void 0:a.customMode)&&!t$(a,"style"),k=!(null==a?void 0:a.customMode)&&!t$(a,"lyrics");return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsx)(tU.Z,{label:"Model",options:t_.aC,value:null==a?void 0:a.model,onChange:e=>{m("model",e)},onBlur:e=>p("model",e),getOptionValue:e=>e.type,getOptionLabel:e=>e.title,maxHeight:320,required:!0}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,N.jsx)("div",{className:"flex flex-1 items-center gap-1 text-sm font-medium text-gray-700 dark:text-gray-300",children:(0,N.jsx)("span",{children:"Custom Mode"})}),(0,N.jsx)("div",{className:"inline-flex items-center justify-end gap-2",children:(0,N.jsx)(tF.rs,{checked:null==a?void 0:a.customMode,onChange:e=>g("customMode",e),className:"group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition duration-500 ease-in-out focus:outline-none data-[checked]:bg-blue-500",children:(0,N.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5"})})})]}),!(null==a?void 0:a.customMode)&&(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"imageUrls"}),(0,N.jsx)(tK.Z,{fileInputRef:c,uploadedFiles:l,previewUrls:n,uploadLoading:o,onFileChange:u,onRemoveFile:e=>{let t=n.filter((t,a)=>a!==e);s(t=>t.filter((t,a)=>a!==e)),i(t),r(e=>({...e||{},imageUrls:t}))},accept:t3.r8,maxFiles:v})]}),(0,N.jsx)(t4,{label:"videoUrls",mediaType:"video",urls:(null==a?void 0:a.videoUrls)||[],onChange:e=>m("videoUrls",e),accept:"video/mp4,video/quicktime,video/webm",extensions:tG,maxFiles:b,maxSize:104857600}),(0,N.jsx)(t4,{label:"audioUrls",mediaType:"audio",urls:(null==a?void 0:a.audioUrls)||[],onChange:e=>m("audioUrls",e),accept:"audio/mpeg,audio/wav,audio/ogg,audio/mp4,audio/flac,audio/aac",maxFiles:w,maxSize:524288e3,minDuration:6,maxDuration:1800}),(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Attachments used ".concat(y,"/").concat(10," (style, lyrics, images, video and audio combined)")})]}),!(null==a?void 0:a.customMode)&&(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Song Description"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.prompt)||"",onChange:e=>m("prompt",e.target.value),onBlur:e=>p("prompt",e.target.value),rows:4,maxLength:x,placeholder:"Describe the style of music and the topic you want."})]}),(0,N.jsxs)("div",{className:"space-y-4",children:[(null==a?void 0:a.customMode)&&(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Title"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.title)||"",onChange:e=>m("title",e.target.value),onBlur:e=>p("title",e.target.value),rows:1,maxLength:80,placeholder:"Enter a title"})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["Style of Music ",(null==a?void 0:a.customMode)&&(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(tB,{value:(null==a?void 0:a.style)||"",onChange:e=>m("style",e.target.value),onBlur:e=>p("style",e.target.value),rows:3,maxLength:f,disabled:j,placeholder:j?"Attachment limit reached":"Enter style of music"})]}),(null==a?void 0:a.customMode)&&(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"negativeTags"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.negativeTags)||"",onChange:e=>m("negativeTags",e.target.value),onBlur:e=>p("negativeTags",e.target.value),rows:3,maxLength:1e3,placeholder:"Styles or traits to avoid"})]}),(null==a?void 0:a.customMode)&&(0,t_.uB)(null==a?void 0:a.model,"durationEnable")&&(0,N.jsx)(tq,{label:"duration",value:null==a?void 0:a.duration,onChange:e=>m("duration",e),onBlur:e=>p("duration",e),min:10,max:360,step:1,initialValue:20}),(0,N.jsx)(tZ,{label:"Persona ID",name:"personaId",value:(null==a?void 0:a.personaId)||"",onChange:e=>m("personaId",e.target.value),onBlur:e=>p("personaId",e.target.value),placeholder:"Enter persona ID"}
1),(null==a?void 0:a.personaId)&&(0,N.jsx)(tz,{label:"personaModel",name:"personaModel",options:[{value:"style_persona",label:"Style Persona"},{value:"voice_persona",label:"Voice Persona",disabled:!(0,t_.uB)(null==a?void 0:a.model,"voicePersonaEnable")}],value:null==a?void 0:a.personaModel,onChange:e=>m("personaModel",e)})]}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,N.jsx)("div",{className:"flex flex-1 items-center gap-1 text-sm font-medium text-gray-700 dark:text-gray-300",children:(0,N.jsx)("span",{children:"Instrumental"})}),(0,N.jsx)("div",{className:"inline-flex items-center justify-end gap-2",children:(0,N.jsx)(tF.rs,{checked:null==a?void 0:a.instrumental,onChange:e=>g("instrumental",e),className:"group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition duration-500 ease-in-out focus:outline-none data-[checked]:bg-blue-500",children:(0,N.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5"})})})]}),!(null==a?void 0:a.instrumental)&&(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Lyrics"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.lyrics)||"",onChange:e=>m("lyrics",e.target.value),onBlur:e=>p("lyrics",e.target.value),rows:6,maxLength:5e3,disabled:k,placeholder:k?"Attachment limit reached":"Write your own lyrics, two verses (8 lines) for the best result"})]}),(null==a?void 0:a.customMode)&&(0,N.jsx)(tU.Z,{label:"vocalGender",options:t_.I8,value:null==a?void 0:a.vocalGender,onChange:e=>{m("vocalGender",e)},onBlur:e=>p("vocalGender",e),variant:"simple"}),(null==a?void 0:a.customMode)&&(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsx)(tq,{label:"audioWeight",value:null==a?void 0:a.audioWeight,onChange:e=>m("audioWeight",e),onBlur:e=>p("audioWeight",e),min:0,max:1,step:.05,initialValue:.65}),(0,N.jsx)(tq,{label:"styleWeight",value:null==a?void 0:a.styleWeight,onChange:e=>m("styleWeight",e),onBlur:e=>p("styleWeight",e),min:0,max:1,step:.01,initialValue:.65}),(0,N.jsx)(tq,{label:"weirdnessConstraint",value:null==a?void 0:a.weirdnessConstraint,onChange:e=>m("weirdnessConstraint",e),onBlur:e=>p("weirdnessConstraint",e),min:0,max:1,step:.01,initialValue:.65}),(0,N.jsx)(tU.Z,{label:"variety",options:t_.wg,value:null!==(t=null==a?void 0:a.variety)&&void 0!==t?t:t_.cZ,onChange:e=>m("variety",e),onBlur:e=>p("variety",e)})]})]})};let t9=e=>null==e||""===e,t8=(e,t,a)=>{if(t9(a))return e;let r=Number(a);if(!Number.isFinite(r))throw Error("".concat(t," must be a valid number"));return e[t]=r,e},ae=(e,t)=>Array.isArray(e)?Number.isFinite(t)?e.slice(0,Math.max(0,t)):e:[],at=e=>Number(Number(e).toFixed(2)),aa=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.customMode){let{duration:t,audioWeight:a,styleWeight:r,weirdnessConstraint:l,variety:s,lyrics:n,...i}=e;delete i.imageUrls,delete i.videoUrls,delete i.audioUrls,delete i.prompt;let o=Number(t),d={...i,negativeTags:e.negativeTags||"",personaId:e.personaId||"",lyrics:n||"",callBackUrl:"playground"};t8(d,"audioWeight",a),d.styleWeight=at(t9(r)?t_.y1:r),d.weirdnessConstraint=at(t9(l)?t_.By:l);let c=Number(s);d.variety=!t9(s)&&Number.isInteger(c)&&c>=0&&c<=4?c:t_.cZ;let u=!t9(t)&&Number.isInteger(o)&&o>=10&&o<=360;return(0,t_.uB)(e.model,"durationEnable")&&u&&(d.duration=o),d}return{model:e.model||t_.aC[0].type,customMode:e.customMode,prompt:e.prompt||"",instrumental:e.instrumental||!1,imageUrls:ae(e.imageUrls,tY(e,"imageUrls")),videoUrls:ae(e.videoUrls,tY(e,"videoUrls")),audioUrls:ae(e.audioUrls,tY(e,"audioUrls")),style:e.style||"",lyrics:e.lyrics||"",personaId:e.personaId||"",personaModel:e.personaModel||"",callBackUrl:"playground"}};var ar=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({...t_.fo||{},personaModel:"style_persona"}),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),[u,p]=(0,E.useState)(null),[m,g]=(0,E.useState)({});(0,E.useEffect)(()=>
1{g(aa(r))},[r]);let h=async e=>{if(!d){n(null),o({}),c(!0);try{var t;if(e.customMode){if(!e.style)throw Error("Please enter style of music");if((0,t_.uB)(e.model,"durationEnable")&&!t9(e.duration)){let t=Number(e.duration);if(!Number.isInteger(t)||t<10||t>360)throw Error("Duration must be an integer between 10 and 360")}}else if(tJ(e)>10)throw Error("You can use up to ".concat(10," attachments in total"));let r=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate"),method:"post",data:aa(e),headers:{Authorization:"Bearer ".concat(null===(t=a.user)||void 0===t?void 0:t.apiKey)}});if(o(r.data||{}),200!==r.data.code)throw Error(r.data.msg||"Failed to initialize task");let l=r.data.data.taskId,s=0,i=setInterval(()=>{var e;let t=Math.max(1,Math.min(Math.floor(s++/40*100),99));p(t),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(null===(e=a.user)||void 0===e?void 0:e.apiKey)},params:{taskId:l}}).then(e=>{if(o(e.data||{}),200!==e.data.code)throw Error(e.data.msg||"Polling request failed");let t=e.data.data,a=t.data||t;n(a),"SUCCESS"===a.status?(c(!1),p(null),clearInterval(i)):["CREATE_TASK_FAILED","GENERATE_AUDIO_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(a.status)&&(c(!1),p(null),clearInterval(i))}).catch(e=>{J.ZP.error(e.message||"Polling request failed")})},2e3)}catch(e){c(!1),J.ZP.error(e.message||"Polling request failed")}}},x=t_.aC.find(e=>e.type===r.model);return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(t7,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(tR,{recordDetails:s,progress:u,generating:d}),run:()=>h(r),formData:m,outputData:i,generating:d,credit:(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e[null==x?void 0:x.creditName])||0})});function al(e){var t;let{recordDetails:a,progress:r,generating:l}=e,s=async e=>{try{J.ZP.loading("Downloading video...");let t=await fetch(e),a=await t.blob(),r=window.URL.createObjectURL(a),l=document.createElement("a");l.href=r,l.download="music-video-".concat(Date.now(),".mp4"),document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(r),J.ZP.dismiss(),J.ZP.success("Video downloaded successfully!")}catch(e){J.ZP.dismiss(),J.ZP.error("Failed to download video"),console.error("Download error:",e)}};return(0,N.jsx)("div",{className:"relative m-auto flex w-full flex-col items-center justify-center lg:h-[80vh] lg:w-[100%]",children:(0,N.jsx)("div",{className:"flex w-full flex-1 flex-col-reverse items-start justify-between overflow-y-auto p-4 lg:h-full lg:flex-row",children:(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-start gap-2",children:[(()=>{var e;if((null==a?void 0:a.successFlag)==="CREATE_TASK_FAILED"||(null==a?void 0:a.successFlag)==="GENERATE_MP4_FAILED")return(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 whitespace-pre-line py-6 text-center text-rose-600",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"failed",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{children:"Generation Failed"}),(null==a?void 0:a.errorMessage)&&(0,N.jsx)("p",{className:"text-sm text-gray-500",children:a.errorMessage})]});if(!a)return l?(0,N.jsxs)("div",{className:"flex w-full flex-col items-center",children:[(0,N.jsx)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 shadow-sm dark:bg-gray-800",children:(0,N.jsx)("span",{className:"aspect-video w-full rounded-lg bg-gray-200 dark:bg-gray-700"})}),l&&(0,N.jsx)("div",{className:"flex w-full items-center justify-center py-6",children:(0,N.jsx)(tS.Z,{loading:!0,color:"#3b82f6",size:10})})]}):(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:[(0,N.jsx)(tA.Z,{loading:l,color:"#3b82f6",size:10}),(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"music video",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Create a video with visualizations based on your generated music track."})]});let t=null==a?void 0:null===(e=a.response)||void 0===e?void 0:e.videoUrl;return t?(0,N.jsxs)("div",{className:"flex h-[inherit] w-full flex-col items-end gap-4 roun
1ded-xl p-3 shadow-sm",children:[(0,N.jsx)("div",{className:"relative flex h-[90%] w-full items-center justify-center",children:(0,N.jsx)("video",{src:t,controls:!0,className:"h-full w-auto rounded-lg",children:"Your browser does not support the video tag."})}),(0,N.jsx)("button",{onClick:()=>s(a.response.videoUrl),className:"flex h-9 w-9 items-center justify-center rounded-lg bg-primary text-white opacity-70 transition duration-500 hover:opacity-100",title:"Download video",children:(0,N.jsx)(D.JO,{icon:"material-symbols:download",className:"h-5 w-5"})})]}):(0,N.jsx)("div",{className:"flex w-full flex-col items-start rounded-xl p-3 shadow-sm",children:(0,N.jsx)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 dark:bg-gray-800",children:(0,N.jsx)("span",{className:"aspect-video w-full rounded-lg bg-gray-200 dark:bg-gray-700"})})})})(),r&&!(null==a?void 0:null===(t=a.response)||void 0===t?void 0:t.videoUrl)&&(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2 px-4 py-2",children:[(0,N.jsx)("div",{className:"relative h-1.5 w-full rounded-full bg-gray-200 dark:bg-gray-700",children:(0,N.jsx)("span",{style:{width:"".concat(r,"%")},className:"absolute left-0 top-0 h-full rounded-full bg-blue-500"})}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-center gap-1 text-xs text-blue-500",children:[(0,N.jsx)(tP.Z,{color:"#3b82f6",size:14}),(0,N.jsx)("span",{children:"Generating music video, please wait patiently..."})]})]})]})})})}function as(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({taskId:"",audioId:"",author:"",domainName:""})},[]);let r=(e,t)=>{a(a=>({...a,[e]:t}))},l=(e,t)=>{a(a=>({...a||{},[e]:t}))};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["Task ID ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.taskId)||"",onChange:e=>l("taskId",e.target.value),onBlur:e=>r("taskId",e.target.value),placeholder:"Enter music generation task ID (e.g., taskId_774b9aa0422f)",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:'Task ID from a completed "Generate Music" or "Extend Music" task'})})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["Audio ID ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.audioId)||"",onChange:e=>l("audioId",e.target.value),onBlur:e=>r("audioId",e.target.value),placeholder:"Enter audio ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Audio ID from the completed music generation result"})})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Author"}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.author)||"",onChange:e=>l("author",e.target.value),onBlur:e=>r("author",e.target.value),placeholder:"Enter artist or creator name (e.g., DJ Electronic)",maxLength:50,className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Artist or creator name to display as a signature on the video cover (max 50 characters)"})})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Domain Name"}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.domainName)||"",onChange:e=>l("domainName",e.target.value),onBlur:e=>r("domainName",e.target.value),placeholder:"Enter website or brand (e.g., music.example.com)",maxLength:50,className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Website or brand to display as a watermark at the bottom of the video (max 50 characters)"})})]})]})}var an=(0,Y.Pi)(()=>{var e;let{userStore:t}=(0,_.o)(),[a,r]=(0,E.useState)({}),[l,s]=(0,E.useState)(null),[n,i]=(0,E.useState)({}),[o,d]=(0,E.useState)(!1),[c,u]=(0,E.useState)(null),p=async e=>{if(!o){d(!0),i({});try{var a;if(!e.taskId)throw J.ZP.error("Please enter task ID"),Error("Please enter task ID");if(!e.audioId)throw J.ZP.error("Please enter audio ID"),Error("Please enter audio ID");let r={taskId:e.taskId,audioId:e.audioId,callBackUrl:"".concat("https://api.kie.ai","/callback")};e.author&&(r.author=e.author),e.domainName&&(r.domainName=e.domainName);let l=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/mp4/generate"),method:"post",data:r,headers:{Authorization:"Bearer ".concat(null===(a=t.user)||void 0===a?void 0:a.apiKey)}});if(i(l.data||{}),200!==l.data.code){let e=l.data.msg||"Failed to initialize music video task";throw J.ZP.error(e),Error(e)}let n=l.data.data.taskId,o=0,c=setInterval(()=>{var e;let a=Math.max(1,Math.min(Math.floor(o++/60*100),99));
1u(a),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/mp4/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(null===(e=t.user)||void 0===e?void 0:e.apiKey)},params:{taskId:n}}).then(e=>{if(i(e.data||{}),200!==e.data.code)throw Error("Polling request failed");let t=e.data.data;s(t),"SUCCESS"===t.successFlag?(d(!1),u(100),clearInterval(c)):("CREATE_TASK_FAILED"===t.successFlag||"GENERATE_MP4_FAILED"===t.successFlag)&&(d(!1),u(null),clearInterval(c))}).catch(()=>{})},2e3)}catch(e){d(!1),e.message.includes("Please enter")||console.error("Music video generation error:",e)}}};return(0,E.useCallback)(()=>(0,N.jsx)(as,{formData:a,setFormData:r}),[a]),(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(as,{formData:a,setFormData:r}),OutputPanelContent:(0,N.jsx)(al,{recordDetails:l,progress:c,generating:o}),run:()=>p(a),formData:a,outputData:n,generating:o,credit:((null===(e=t.user)||void 0===e?void 0:e.consumeCreditsMap)||{})["suno-mp4-generate"]||4})}),ai=function(e){let{fileInputRef:t,uploadedFile:a=null,previewUrl:r=null,uploadLoading:l=!1,onFileChange:s,onRemoveFile:n,disabled:i=!1,accept:o="audio/*",maxSize:d="Max 200MB",className:c=""}=e;return(0,N.jsxs)("div",{className:c,children:[(0,N.jsx)("input",{ref:t,type:"file",accept:o,onChange:s,disabled:i,className:"hidden"}),a||r?(0,N.jsxs)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-600 dark:bg-gray-700",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsxs)("div",{className:"flex items-center gap-3",children:[(0,N.jsx)(D.JO,{icon:"carbon:music",className:"text-2xl text-blue-500"}),(0,N.jsxs)("div",{children:[(0,N.jsx)("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(null==a?void 0:a.name)||"Audio file uploaded"}),a&&(0,N.jsxs)("p",{className:"text-xs text-gray-500",children:[(a.size/1024/1024).toFixed(2)," MB"]})]})]}),n&&(0,N.jsx)("button",{onClick:n,className:"rounded-full p-1 text-red-500 transition-colors hover:bg-red-50 dark:hover:bg-red-900/20",children:(0,N.jsx)(D.JO,{icon:"carbon:close",className:"h-5 w-5"})})]}),r&&(0,N.jsx)("audio",{src:r,controls:!0,className:"mt-3 w-full",children:"Your browser does not support the audio tag."})]}):(0,N.jsx)("div",{onClick:()=>{if(!i){var e;null===(e=t.current)||void 0===e||e.click()}},className:"flex h-32 w-full flex-col items-center justify-center rounded-lg border-2 border-dashed border-gray-300 transition-colors dark:border-gray-600 ".concat(i?"cursor-not-allowed opacity-50":"cursor-pointer hover:border-blue-400"),children:l?(0,N.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,N.jsx)("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-gray-300 border-t-blue-500"}),(0,N.jsx)("span",{className:"text-sm text-gray-500",children:"Uploading..."})]}):i?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(D.JO,{icon:"carbon:locked",className:"mb-2 text-3xl text-gray-400"}),(0,N.jsx)("span",{className:"text-sm text-gray-500",children:"File upload disabled"}),(0,N.jsx)("span",{className:"mt-1 text-xs text-gray-400",children:"Remove the Audio ID to upload a file"})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(D.JO,{icon:"carbon:music",className:"mb-2 text-3xl text-gray-400"}),(0,N.jsx)("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Click to upload audio file"}),(0,N.jsxs)("span",{className:"mt-1 text-xs text-gray-500",children:["MP3, WAV, OGG, M4A, FLAC, AAC (",d,")"]})]})})]})};let ao=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={uploadUrl:e.uploadUrl,customMode:!0,instrumental:e.instrumental||!1,model:e.model||t_.aC[0].type,style:e.style||"",title:e.title||"",callBackUrl:"playground"};e.instrumental||(t.lyrics=e.lyrics||""),e.negativeTags&&(t.negativeTags=e.negativeTags),e.vocalGender&&(t.vocalGender=e.vocalGender),t8(t,"styleWeight",e.styleWeight),t8(t,"weirdnessConstraint",e.weirdnessConstraint),t8(t,"audioWeight",e.audioWeight),(0,t_.uB)(e.model,"durationEnable")&&!t9(e.duration)&&t8(t,"duration",e.duration),e.personaId&&(t.personaId=e.personaId,e.personaModel&&(t.personaModel=e.personaModel));let a=Number(e.variety);return t.variety=!t9(e.variety)&&Number.isInteger(a)&&a>=0&&a<=4?a:t_.cZ,t};function ad(e){var t;let{formData:a,setFormData:r}=e,[l,s]=(0,E.useState)(!1),[n,i]=(0,E.useState)(null),o=(0,E.useRef)(null);(0,E.useEffect)(()=>{a&&0!==Object.keys(a).length?a.uploadUrl&&i(a.uploadUrl):r({uploadUrl:"",instrumental:!1,lyrics:"",title:"",style:"",model:t_.aC[0].type,negativeTags:"",vocalGender:"",styleWeight:.5,weirdnessConstraint:.5,audioWeight:.5,personaId:"",personaModel:"style_persona",duration:20,variety:t_.cZ})},[]);let d=(e,t)=>{let a=0,r=-1;for(let l=0;l<e.length;l++){let s=e.charCodeAt(l)>127?2:1;if(a+s<=t)a+=s,r=l;else break}return{length:a,lastIndex:r}},c=(e,t)=>{if(!e)return"";let a=d(e,t);return -1===a.lastIndex?"":a.length<=t&&a.lastIndex===e.length-1?e:e.substring(0,a.lastIndex+1)},u=(e,t)=>
1{r(a=>({...a,[e]:t}))},p=()=>{let e=(null==a?void 0:a.model)||t_.aC[0].type,t=t_.aC.find(t=>t.type===e)||t_.aC[0];return{prompt:t.prompt_maxlength||3e3,style:t.style_maxlength||200,title:t.title_maxlength||100}},m=(e,t)=>{let a=t;if("string"==typeof t){var l;let{prompt:r,style:s,title:n}=p(),i=null!==(l=({lyrics:r,title:n,style:s})[e])&&void 0!==l?l:null;null!==i&&(a=c(t,i))}r(t=>({...t||{},[e]:a}))},g=(e,t)=>{r(a=>({...a||{},[e]:t}))},h=async e=>{var t;let a=null===(t=e.target.files)||void 0===t?void 0:t[0];if(a){if(!["audio/mpeg","audio/wav","audio/x-wav","audio/aac","audio/mp4","audio/ogg","audio/flac","audio/x-m4a"].includes(a.type)){J.ZP.error("Please upload a valid audio file (MP3, WAV, AAC, OGG, FLAC, M4A)");return}if(a.size>209715200){J.ZP.error("Audio file size cannot exceed 200MB");return}s(!0);try{let e=await (0,eK._R)(a,"kie-ai/market");if(!e)throw Error("Upload failed");let t=URL.createObjectURL(a);m("uploadUrl",e),u("uploadUrl",e),i(t),J.ZP.success("Audio file uploaded successfully")}catch(e){J.ZP.error("Failed to upload audio file")}finally{s(!1),o.current&&(o.current.value="")}}},x=p(),f=x.prompt,y=x.style,v=x.title,b=((e,t)=>{if(!e)return t;let a=0;for(let t=0;t<e.length;t++)a+=e.charCodeAt(t)>127?2:1;return Math.max(0,t-a)})((null==a?void 0:a.title)||"",v);return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsx)(tU.Z,{label:"Model",options:t_.aC,value:null==a?void 0:a.model,onChange:e=>{m("model",e)},onBlur:e=>u("model",e),getOptionValue:e=>e.type,getOptionLabel:e=>e.title,maxHeight:320,required:!0}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["Upload Audio File ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(ai,{fileInputRef:o,previewUrl:n,uploadLoading:l,onFileChange:h,onRemoveFile:()=>{i(null),m("uploadUrl",""),u("uploadUrl",""),o.current&&(o.current.value="")}})]}),(0,N.jsxs)("div",{className:"space-y-4",children:[(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Title"}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.title)||"",onChange:e=>m("title",e.target.value),onBlur:e=>u("title",e.target.value),placeholder:"Enter a title",maxLength:v,className:"h-10 w-full rounded-lg border border-gray-300 bg-white px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsxs)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[v-b,"/",v]})})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Style of Music"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.style)||"",onChange:e=>m("style",e.target.value),onBlur:e=>u("style",e.target.value),rows:3,maxLength:y,placeholder:"Enter style of music (e.g., jazz, classical, electronic)"})]}),(0,t_.uB)(null==a?void 0:a.model,"durationEnable")&&(0,N.jsx)(tq,{label:"duration",value:null==a?void 0:a.duration,onChange:e=>m("duration",e),onBlur:e=>u("duration",e),min:10,max:360,step:1,initialValue:20})]}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,N.jsx)("div",{className:"flex flex-1 items-center gap-1 text-sm font-medium text-gray-700 dark:text-gray-300",children:(0,N.jsx)("span",{children:"Instrumental"})}),(0,N.jsx)("div",{className:"inline-flex items-center justify-end gap-2",children:(0,N.jsx)(tF.rs,{checked:null==a?void 0:a.instrumental,onChange:e=>g("instrumental",e),className:"group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition duration-500 ease-in-out focus:outline-none data-[checked]:bg-blue-500",children:(0,N.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5"})})})]}),!(null==a?void 0:a.instrumental)&&(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Lyrics"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.lyrics)||"",onChange:e=>m("lyrics",e.target.value),onBlur:e=>u("lyrics",e.target.value),rows:6,maxLength:f,placeholder:"Write your own lyrics"})]}),(0,N.jsxs)("div",{className:"space-y-4 border-t border-gray-200 pt-4 dark:border-gray-700",children:[(0,N.jsx)("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Optional Parameters"}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Negative Tags"}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.negativeTags)||"",onChange:e=>m("negativeTags",e.target.value),onBlur:e=>u("negativeTags",e.target.value),placeholder:"Music styles to exclude (e.g., heavy metal, strong drums)",className:"h-10 w-full rounded-lg border border-gray-300 bg-white px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsx)(tU.Z,{label:"Vocal Gender",options:[{value:"",label:"Not specified"},{value:"m",label:"Male (m)"},{value:"f",label:"Female (f)"}
1],value:null==a?void 0:a.vocalGender,onChange:e=>{m("vocalGender",e),u("vocalGender",e)},variant:"simple"}),(0,N.jsx)(tq,{label:"Style Weight",value:null==a?void 0:a.styleWeight,onChange:e=>m("styleWeight",e),onBlur:e=>u("styleWeight",e),min:0,max:1,step:.01,initialValue:.5}),(0,N.jsx)(tq,{label:"Weirdness Constraint",value:null==a?void 0:a.weirdnessConstraint,onChange:e=>m("weirdnessConstraint",e),onBlur:e=>u("weirdnessConstraint",e),min:0,max:1,step:.01,initialValue:.5}),(0,N.jsx)(tq,{label:"Audio Weight",value:null==a?void 0:a.audioWeight,onChange:e=>m("audioWeight",e),onBlur:e=>u("audioWeight",e),min:0,max:1,step:.01,initialValue:.5}),(0,N.jsx)(tU.Z,{label:"variety",options:t_.wg,value:null!==(t=null==a?void 0:a.variety)&&void 0!==t?t:t_.cZ,onChange:e=>m("variety",e),onBlur:e=>u("variety",e)}),(0,N.jsx)(tZ,{label:"personaId",name:"personaId",value:(null==a?void 0:a.personaId)||"",onChange:e=>m("personaId",e.target.value),onBlur:e=>u("personaId",e.target.value),placeholder:"persona_123"}),(null==a?void 0:a.personaId)&&(0,N.jsx)(tz,{label:"personaModel",name:"personaModel",options:[{value:"style_persona",label:"Style Persona"},{value:"voice_persona",label:"Voice Persona",disabled:!(0,t_.uB)(null==a?void 0:a.model,"voicePersonaEnable")}],value:null==a?void 0:a.personaModel,onChange:e=>m("personaModel",e)})]})]})}var ac=(0,Y.Pi)(()=>{var e;let{userStore:t}=(0,_.o)(),[a,r]=(0,E.useState)({}),[l,s]=(0,E.useState)(null),[n,i]=(0,E.useState)({}),[o,d]=(0,E.useState)(!1),[c,u]=(0,E.useState)(null),p=async e=>{if(!o){d(!0),s(null),i({});try{var a,r,l,n;if(!e.uploadUrl)throw Error("Please upload an audio file");if((0,t_.uB)(e.model,"durationEnable")&&!t9(e.duration)){let t=Number(e.duration);if(!Number.isInteger(t)||t<10||t>360)throw Error("Duration must be an integer between 10 and 360")}let o=null==t?void 0:null===(a=t.user)||void 0===a?void 0:a.apiKey;if(!o)throw Error("Please login and set your API key");let c=ao(e),p=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/upload-cover"),method:"post",data:c,headers:{Authorization:"Bearer ".concat(o)}});if(i(p.data||{}),(null===(r=p.data)||void 0===r?void 0:r.code)!==200)throw Error((null===(n=p.data)||void 0===n?void 0:n.msg)||"Failed to initialize task");let m=(null===(l=p.data)||void 0===l?void 0:l.data)||{},g=m.taskId||m.id||m.taskid;if(!g)throw Error("No taskId returned");let h=0,x=setInterval(()=>{let e=Math.max(1,Math.min(Math.floor(h++/40*100),99));u(e),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(o)},params:{taskId:g}}).then(e=>{var t;if(i(e.data||{}),(null===(t=e.data)||void 0===t?void 0:t.code)!==200)throw Error("Polling request failed");let a=e.data.data,r=a.data||a;s(r),"SUCCESS"===r.status?(d(!1),u(null),clearInterval(x)):1===r.state?(d(!1),u(null),clearInterval(x)):(t_.Ti.includes(r.status)||3===r.state)&&(d(!1),u(null),clearInterval(x))}).catch(()=>{})},2e3);return{taskId:g}}catch(e){d(!1),u(null),J.ZP.error(e.message||"Failed to generate cover audio")}}};return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(ad,{formData:a,setFormData:r}),OutputPanelContent:(0,N.jsx)(tR,{recordDetails:l,progress:c,generating:o}),run:()=>p(a),formData:a,outputData:n,generating:o,credit:((null===(e=t.user)||void 0===e?void 0:e.consumeCreditsMap)||{}).suno_upload_cover_v4||12})});let au=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={uploadUrl:e.uploadUrl,defaultParamFlag:!0,instrumental:e.instrumental||!1,style:e.style||"",title:e.title||"",continueAt:e.continueAt||60,model:e.model||t_.aC[0].type,negativeTags:e.negativeTags||"",callBackUrl:"playground",personaId:e.personaId||"",personaModel:e.personaModel||"",channel:"MUSIC"};e.instrumental||(t.lyrics=e.lyrics||"",t.vocalGender=e.vocalGender||"m"),t8(t,"styleWeight",e.styleWeight),t8(t,"weirdnessConstraint",e.weirdnessConstraint),t8(t,"audioWeight",e.audioWeight);let a=Number(e.variety);return t.variety=!t9(e.variety)&&Number.isInteger(a)&&a>=0&&a<=4?a:t_.cZ,t};function ap(e){var t;let{formData:a,setFormData:r}=e,[l,s]=(0,E.useState)(!1),[n,i]=(0,E.useState)(null),[o,d]=(0,E.useState)(""),c=(0,E.useRef)(null);(0,E.useEffect)(()=>{a&&0!==Object.keys(a).length?(null==a?void 0:a.uploadUrl)&&d(a.uploadUrl):r({uploadUrl:"",instrumental:!1,lyrics:"",style:"",title:"",continueAt:60,model:t_.aC[0].type,negativeTags:"",callBackUrl:"playground",vocalGender:"m",styleWeight:.65,weirdnessConstraint:.65,audioWeight:.65,variety:t_.cZ,personaId:"",personaModel:"style_persona"})},[]);let u=(e,t)=>
1{r(a=>({...a||{},[e]:t}))},p=(e,t)=>{r(a=>({...a||{},[e]:t}))},m=(e,t)=>{r(a=>({...a||{},[e]:t}))},g=async e=>{let t=e.target.files[0];if(!t)return;if(!t_.YO.some(e=>t.type===e||t.name.toLowerCase().endsWith(e.split("/")[1]))){J.ZP.error("Please upload a valid audio file (MP3, WAV, OGG, M4A, FLAC, AAC)");return}if(t.size>209715200){J.ZP.error("File size exceeds 200MB limit");return}s(!0);let a=J.ZP.loading("Uploading audio file...");try{let e=await (0,eK._R)(t,"kie-ai/market"),l=URL.createObjectURL(t);d(l),i(t),r(t=>({...t||{},uploadUrl:e})),J.ZP.dismiss(a),J.ZP.success("Audio file uploaded successfully")}catch(e){J.ZP.dismiss(a),J.ZP.error("Upload failed, please try again")}finally{s(!1)}},h=t_.aC.find(e=>e.type===((null==a?void 0:a.model)||t_.aC[0].type))||t_.aC[0],x=h.prompt_maxlength||3e3,f=h.style_maxlength||200;return(0,N.jsx)(N.Fragment,{children:(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsx)(tU.Z,{label:"model",options:t_.aC,value:null==a?void 0:a.model,onChange:e=>{p("model",e)},onBlur:e=>u("model",e),getOptionValue:e=>e.type,getOptionLabel:e=>e.title,maxHeight:320,required:!0}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["uploadUrl ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(ai,{fileInputRef:c,uploadedFile:n,previewUrl:o,uploadLoading:l,onFileChange:g,onRemoveFile:()=>{i(null),d(""),r(e=>({...e||{},uploadUrl:""})),c.current&&(c.current.value="")},accept:"audio/*",maxSize:"Max 200MB"})]}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,N.jsx)("div",{className:"flex flex-1 items-center gap-1 text-sm font-medium text-gray-700 dark:text-gray-300",children:(0,N.jsx)("span",{children:"instrumental"})}),(0,N.jsx)("div",{className:"inline-flex items-center justify-end gap-2",children:(0,N.jsx)(tF.rs,{checked:null==a?void 0:a.instrumental,onChange:e=>m("instrumental",e),className:"group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition duration-500 ease-in-out focus:outline-none data-[checked]:bg-blue-500",children:(0,N.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5"})})})]}),!(null==a?void 0:a.instrumental)&&(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"lyrics"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.lyrics)||"",onChange:e=>p("lyrics",e.target.value),onBlur:e=>u("lyrics",e.target.value),rows:6,placeholder:"Write the lyrics for the extended part",maxLength:x})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"title"}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.title)||"",onChange:e=>p("title",e.target.value),onBlur:e=>u("title",e.target.value),placeholder:"Enter a title",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"style"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.style)||"",onChange:e=>p("style",e.target.value),onBlur:e=>u("style",e.target.value),rows:6,placeholder:"Enter style of music",maxLength:f})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"continueAt"}),(0,N.jsx)("input",{type:"number",value:(null==a?void 0:a.continueAt)||60,onChange:e=>p("continueAt",Number(e.target.value)),onBlur:e=>u("continueAt",Number(e.target.value)),min:"0",placeholder:"60",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),!(null==a?void 0:a.instrumental)&&(0,N.jsx)(tU.Z,{label:"vocalGender",options:t_.I8,value:null==a?void 0:a.vocalGender,onCh
1ange:e=>{p("vocalGender",e)},onBlur:e=>u("vocalGender",e),variant:"simple"}),(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(tq,{label:"styleWeight",value:null==a?void 0:a.styleWeight,onChange:e=>p("styleWeight",e),onBlur:e=>u("styleWeight",e),min:0,max:1,step:.01,initialValue:.65}),(0,N.jsx)(tq,{label:"weirdnessConstraint",value:null==a?void 0:a.weirdnessConstraint,onChange:e=>p("weirdnessConstraint",e),onBlur:e=>u("weirdnessConstraint",e),min:0,max:1,step:.01,initialValue:.65}),(0,N.jsx)(tq,{label:"audioWeight",value:null==a?void 0:a.audioWeight,onChange:e=>p("audioWeight",e),onBlur:e=>u("audioWeight",e),min:0,max:1,step:.01,initialValue:.65}),(0,N.jsx)(tU.Z,{label:"variety",options:t_.wg,value:null!==(t=null==a?void 0:a.variety)&&void 0!==t?t:t_.cZ,onChange:e=>p("variety",e),onBlur:e=>u("variety",e)}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"negativeTags"}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.negativeTags)||"",onChange:e=>p("negativeTags",e.target.value),onBlur:e=>u("negativeTags",e.target.value),placeholder:"Enter negative tags",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"personaId"}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.personaId)||"",onChange:e=>p("personaId",e.target.value),onBlur:e=>u("personaId",e.target.value),placeholder:"Enter persona ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(null==a?void 0:a.personaId)&&(0,N.jsx)(tz,{label:"personaModel",name:"personaModel",options:[{value:"style_persona",label:"Style Persona"},{value:"voice_persona",label:"Voice Persona",disabled:!(0,t_.uB)(null==a?void 0:a.model,"voicePersonaEnable")}],value:null==a?void 0:a.personaModel,onChange:e=>p("personaModel",e)})]})]})})}var am=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)(null),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),[u,p]=(0,E.useState)(null),m=async e=>{if(!d){c(!0),n(null),o({}),p(null);try{var t;if(!e.uploadUrl)throw Error("Please upload an audio file");let r=null===(t=a.user)||void 0===t?void 0:t.apiKey;if(!r)throw Error("Please login and set your API key");let l=au(e),s=await fetch("".concat("https://api.kie.ai","/api/v1/generate/upload-extend"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)},body:JSON.stringify(l)}),i=null;try{i=await s.json()}catch(e){i={}}if(o(i),!s.ok||(null==i?void 0:i.code)!==200)throw Error((null==i?void 0:i.msg)||"Failed to initialize task");let d=null==i?void 0:i.data,u="";if("string"==typeof d?u=d:d&&"object"==typeof d&&(u=d.taskId||d.taskid||""),u||(u=(null==i?void 0:i.taskId)||(null==i?void 0:i.taskid)||""),!u)throw Error("No taskid returned");let m=0,g=setInterval(()=>{let e=Math.max(1,Math.min(Math.floor(m++/40*100),99));p(e),fetch("".concat("https://api.kie.ai","/api/v1/generate/record-info?taskId=").concat(encodeURIComponent(u)),{headers:{Authorization:"Bearer ".concat(r)}}).then(async e=>{let t=null;try{t=await e.json()}catch(e){t={}}if(o(t),200!==t.code)throw Error(t.msg||"Polling request failed");let a=t.data||t,r=a.data||a;n(r),"SUCCESS"===r.status?(c(!1),p(null),clearInterval(g)):["CREATE_TASK_FAILED","GENERATE_AUDIO_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(r.status)&&(c(!1),p(null),clearInterval(g))}).catch(e=>{J.ZP.error(e.message||"Polling request failed")})},2e3)}catch(e){c(!1),J.ZP.error(e.message||"Failed to extend audio")}}},g=(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e.suno_upload_extend_v4)||12;return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(ap,{formData:r,setFormData:l}
1),OutputPanelContent:(0,N.jsx)(tR,{recordDetails:s,progress:u,generating:d}),run:()=>m(r),formData:r,outputData:i,generating:d,credit:g})});function ag(e){var t;let{recordDetails:a,progress:r,converting:l}=e;return(0,N.jsx)("div",{className:"relative m-auto flex w-full flex-col items-center justify-center lg:h-[80vh] lg:w-[100%]",children:(0,N.jsx)("div",{className:"flex w-full flex-1 flex-col-reverse items-start justify-between overflow-y-auto p-4 lg:h-full lg:flex-row",children:(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-start gap-2",children:[(null==a?void 0:a.successFlag)&&["CREATE_TASK_FAILED","GENERATE_WAV_FAILED","CALLBACK_EXCEPTION"].includes(a.successFlag)?(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 whitespace-pre-line py-6 text-center text-rose-600",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"failed",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{children:"Conversion Failed"}),a.errorMessage&&(0,N.jsx)("p",{className:"text-sm text-gray-500",children:a.errorMessage})]}):a?"SUCCESS"===a.successFlag&&(null===(t=a.response)||void 0===t?void 0:t.audioWavUrl)?(0,N.jsx)("div",{className:"flex w-full flex-col items-start rounded-xl p-4 shadow-sm",children:(0,N.jsxs)("div",{className:"flex w-full items-center gap-3 bg-white dark:bg-gray-800",children:[(0,N.jsx)("audio",{src:a.response.audioWavUrl,controls:!0,className:"flex-1",children:"Your browser does not support the audio tag."}),(0,N.jsx)("button",{onClick:()=>{let e=document.createElement("a");e.href=a.response.audioWavUrl,e.download="converted_audio_".concat(a.taskId,".wav"),document.body.appendChild(e),e.click(),document.body.removeChild(e)},className:"flex h-10 w-10 items-center justify-center rounded-lg bg-blue-500 text-white transition-colors hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800",title:"Download audio file",children:(0,N.jsx)(D.JO,{icon:"material-symbols:download",className:"h-5 w-5"})})]})}):(0,N.jsx)("div",{className:"flex w-full flex-col items-start rounded-xl p-3 shadow-sm",children:(0,N.jsxs)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 dark:bg-gray-800",children:[(0,N.jsx)("span",{className:"aspect-square w-20 rounded-lg bg-gray-200 dark:bg-gray-700",children:(0,N.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,N.jsx)(tP.Z,{color:"#3b82f6",size:26})})}),(0,N.jsxs)("div",{className:"flex flex-1 flex-col items-start gap-2",children:[(0,N.jsx)("span",{className:"h-6 w-40 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsx)("span",{className:"h-6 w-1/2 rounded-lg bg-gray-200 dark:bg-gray-700"})]})]})}):l?(0,N.jsx)("div",{className:"flex w-full flex-col items-center",children:l&&(0,N.jsx)("div",{className:"flex w-full items-center justify-center py-6",children:(0,N.jsx)(tS.Z,{loading:!0,color:"#3b82f6",size:10})})}):(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:[(0,N.jsx)(tA.Z,{loading:l,color:"#3b82f6",size:10}),(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"audio convert",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Convert your audio to WAV format for better compatibility!"})]}),r&&(null==a?void 0:a.successFlag)==="PENDING"&&(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2 px-4 py-2",children:[(0,N.jsx)("div",{className:"relative h-1.5 w-full rounded-full bg-gray-200 dark:bg-gray-700",children:(0,N.jsx)("span",{style:{width:"".concat(r,"%")},className:"absolute left-0 top-0 h-full rounded-full bg-blue-500"})}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-center gap-1 text-xs text-blue-500",children:[(0,N.jsx)(tP.Z,{color:"#3b82f6",size:14}),(0,N.jsx)("span",{children:"Converting to WAV format, please wait patiently"})]})]})]})})})}function ah(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({taskId:"",audioId:""})},[]);let r=(e,t)=>{a(a=>({...a,[e]:t}))},l=(e,t)=>
1{a(a=>({...a||{},[e]:t}))};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["Task ID ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.taskId)||"",onChange:e=>l("taskId",e.target.value),onBlur:e=>r("taskId",e.target.value),placeholder:"Enter task ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["Audio ID ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.audioId)||"",onChange:e=>l("audioId",e.target.value),onBlur:e=>r("audioId",e.target.value),placeholder:"Enter audio ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]})]})}var ax=(0,Y.Pi)(()=>{var e;let{userStore:t}=(0,_.o)(),[a,r]=(0,E.useState)({}),[l,s]=(0,E.useState)(null),[n,i]=(0,E.useState)({}),[o,d]=(0,E.useState)(!1),[c,u]=(0,E.useState)(null),p=async e=>{if(!o){d(!0),i({});try{var a,r;if(!e.taskId)throw Error("Please enter task ID");if(!e.audioId)throw Error("Please enter audio ID");if(!(null===(a=t.user)||void 0===a?void 0:a.apiKey))throw Error("Please login and set your API key");let l={taskId:e.taskId,audioId:e.audioId,format:"wav",callBackUrl:"playground"},n=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/wav/generate"),method:"post",data:l,headers:{Authorization:"Bearer ".concat(null===(r=t.user)||void 0===r?void 0:r.apiKey)}});if(i(n.data||{}),200!==n.data.code)throw Error(n.data.msg||"Failed to initialize conversion task");let o=n.data.data.taskId,c=0,p=setInterval(()=>{var e;let a=Math.max(1,Math.min(Math.floor(c++/30*100),99));u(a),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/wav/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(null===(e=t.user)||void 0===e?void 0:e.apiKey)},params:{taskId:o}}).then(e=>{if(i(e.data||{}),200!==e.data.code)throw Error("Polling request failed");let t=e.data.data;s(t),"SUCCESS"===t.successFlag?(d(!1),u(null),clearInterval(p),J.ZP.success("Audio conversion completed successfully!")):["CREATE_TASK_FAILED","GENERATE_WAV_FAILED","CALLBACK_EXCEPTION"].includes(t.successFlag)&&(d(!1),u(null),clearInterval(p),J.ZP.error(t.errorMessage||"Audio conversion failed"))}).catch(e=>{console.error("Polling error:",e)})},2e3)}catch(e){d(!1),J.ZP.error(e.message||"An error occurred during conversion")}}};return(0,E.useCallback)(()=>(0,N.jsx)(ah,{formData:a,setFormData:r}),[a]),(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(ah,{formData:a,setFormData:r}),OutputPanelContent:(0,N.jsx)(ag,{recordDetails:l,progress:c,converting:o}),run:()=>p(a),formData:a,outputData:n,generating:o,credit:((null===(e=t.user)||void 0===e?void 0:e.consumeCreditsMap)||{}).suno_wav_generate||.4})});let af=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a={audioId:t.audioId,model:t.model||t_.aC[0].type,defaultParamFlag:!0,instrumental:t.instrumental||!1,style:t.style||"",title:t.title||"",continueAt:t.continueAt,callBackUrl:"playground"};(null===(e=t.taskId)||void 0===e?void 0:e.trim())&&(a.taskId=t.taskId.trim()),!t.instrumental&&(a.lyrics=t.lyrics||"",t.vocalGender&&(a.vocalGender=t.vocalGender));let r=Number(t.variety);return a.variety=!t9(t.variety)&&Number.isInteger(r)&&r>=0&&r<=4?r:t_.cZ,t8(a,"styleWeight",t.styleWeight),t8(a,"weirdnessConstraint",t.weirdnessConstraint),t8(a,"audioWeight",t.audioWeight),t.negativeTags&&(a.negativeTags=t.negativeTags),t.personaId&&(a.personaId=t.personaId,t.personaModel&&(a.personaModel=t.personaModel)),a};function ay(e){var t;let{formData:a,setFormData:r}=e;(0,E.useEffect)(()=>{a&&0!==Object.keys(a).length||r({model:t_.aC[0].type,instrumental:!1,audioId:"",taskId:"",lyrics:"",style:"",title:"",continueAt:60,vocalGender:"m",variety:t_.cZ,styleWeight:.65,weirdnessConstraint:.65,audioWeight:.65,negativeTags:"",personaId:"",personaModel:"style_persona"})},[]);let l=(e,t)=>
1{r(a=>({...a,[e]:t}))},s=(e,t)=>{r(a=>({...a||{},[e]:t}))},n=(e,t)=>{r(a=>({...a||{},[e]:t}))},i=t_.aC.find(e=>e.type===((null==a?void 0:a.model)||t_.aC[0].type))||t_.aC[0],o=i.prompt_maxlength||3e3,d=i.style_maxlength||200,c=i.title_maxlength||100;return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsx)(tZ,{label:"taskId",name:"taskId",value:(null==a?void 0:a.taskId)||"",onChange:e=>s("taskId",e.target.value),onBlur:e=>l("taskId",e.target.value),placeholder:"Enter music generation task ID",description:"Task ID from the original music generation. Optional."}),(0,N.jsx)(tU.Z,{label:"Model",options:t_.aC,value:null==a?void 0:a.model,onChange:e=>{s("model",e)},onBlur:e=>l("model",e),getOptionValue:e=>e.type,getOptionLabel:e=>e.title,maxHeight:320,required:!0}),(0,N.jsx)(tZ,{label:"Audio ID",required:!0,name:"audioId",value:(null==a?void 0:a.audioId)||"",onChange:e=>s("audioId",e.target.value),onBlur:e=>l("audioId",e.target.value),placeholder:"Enter audio ID"}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,N.jsx)("div",{className:"flex flex-1 items-center gap-1 text-sm font-medium text-gray-700 dark:text-gray-300",children:(0,N.jsx)("span",{children:"Instrumental"})}),(0,N.jsx)("div",{className:"inline-flex items-center justify-end gap-2",children:(0,N.jsx)(tF.rs,{checked:null==a?void 0:a.instrumental,onChange:e=>n("instrumental",e),className:"group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition duration-500 ease-in-out focus:outline-none data-[checked]:bg-blue-500",children:(0,N.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5"})})})]}),(0,N.jsxs)(N.Fragment,{children:[!(null==a?void 0:a.instrumental)&&(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"lyrics"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.lyrics)||"",onChange:e=>s("lyrics",e.target.value),onBlur:e=>l("lyrics",e.target.value),rows:6,maxLength:o,placeholder:"Write the lyrics for the extended part"})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"style"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.style)||"",onChange:e=>s("style",e.target.value),onBlur:e=>l("style",e.target.value),rows:4,placeholder:"Enter style of music",maxLength:d})]}),(0,N.jsx)(tZ,{label:"title",name:"title",value:(null==a?void 0:a.title)||"",onChange:e=>{let t=e.target.value;t.length<=c&&s("title",t)},onBlur:e=>l("title",e.target.value),placeholder:"Enter a title for the extended music",description:"Maximum ".concat(c," characters")}),(0,N.jsx)(tZ,{label:"continueAt",required:!0,name:"continueAt",type:"number",value:(null==a?void 0:a.continueAt)||60,onChange:e=>s("continueAt",Number(e.target.value)),onBlur:e=>l("continueAt",Number(e.target.value)),placeholder:"60",description:"Audio start extension time point (in seconds). Must be greater than 0 and less than the total duration of the generated audio."}),!(null==a?void 0:a.instrumental)&&(0,N.jsx)(tU.Z,{label:"vocalGender",options:t_.I8,value:null==a?void 0:a.vocalGender,onChange:e=>{s("vocalGender",e)},onBlur:e=>l("vocalGender",e),variant:"simple"}),(0,N.jsx)(tq,{label:"styleWeight",value:null==a?void 0:a.styleWeight,onChange:e=>s("styleWeight",e),onBlur:e=>l("styleWeight",e),min:0,max:1,step:.01,initialValue:.65}),(0,N.jsx)(tq,{label:"weirdnessConstraint",value:null==a?void 0:a.weirdnessConstraint,onChange:e=>s("weirdnessConstraint",e),onBlur:e=>l("weirdnessConstraint",e),min:0,max:1,step:.01,initialValue:.65}),(0,N.jsx)(tq,{label:"audioWeight",value:null==a?void 0:a.audioWeight,onChange:e=>s("audioWeight",e),onBlur:e=>l("audioWeight",e),min:0,max:1,step:.01,initialValue:.65}),(0,N.jsx)(tU.Z,{label:"variety",options:t_.wg,value:null!==(t=null==a?void 0:a.variety)&&void 0!==t?t:t_.cZ,onChange:e=>s("variety",e),onBlur:e=>l("variety",e)}),(0,N.jsx)(tZ,{label:"negativeTags",name:"negativeTags",value:(null==a?void 0:a.negativeTags)||"",onChange:e=>s("negativeTags",e.target.value),onBlur:e=>l("negativeTags",e.target.value),placeholder:"Enter negative tags"}),(0,N.jsx)(tZ,{label:"personaId",name:"personaId",value:(null==a?void 0:a.personaId)||"",onChange:e=>s("personaId",e.target.value),onBlur:e=>l("personaId",e.target.value),placeholder:"Enter persona ID",description:"Apply a personaId to the generated music. Generate personaId at Generate Persona."}
1),(null==a?void 0:a.personaId)&&(0,N.jsx)(tz,{label:"personaModel",name:"personaModel",options:[{value:"style_persona",label:"Style Persona"},{value:"voice_persona",label:"Voice Persona",disabled:!(0,t_.uB)(null==a?void 0:a.model,"voicePersonaEnable")}],value:null==a?void 0:a.personaModel,onChange:e=>s("personaModel",e)})]})]})}var av=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),[u,p]=(0,E.useState)(null),m=async e=>{if(!d){n(null),o({}),c(!0);try{var t;if(!e.audioId)throw Error("Please enter audio ID");if(!e.continueAt||e.continueAt<=0)throw Error("Please enter a valid continueAt value (greater than 0)");let r=af(e),l=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/extend"),method:"post",data:r,headers:{Authorization:"Bearer ".concat(null===(t=a.user)||void 0===t?void 0:t.apiKey)}});if(o(l.data||{}),200!==l.data.code)throw Error(l.data.message||"Failed to initialize task");let s=l.data.data.taskId,i=0,d=setInterval(()=>{var e;let t=Math.max(1,Math.min(Math.floor(i++/40*100),99));p(t),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(null===(e=a.user)||void 0===e?void 0:e.apiKey)},params:{taskId:s}}).then(e=>{if(o(e.data||{}),200!==e.data.code)throw Error("Polling request failed");let t=e.data.data,a=t.data||t;n(a),"SUCCESS"===a.status?(c(!1),p(null),clearInterval(d)):["CREATE_TASK_FAILED","GENERATE_AUDIO_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(a.status)&&(c(!1),p(null),clearInterval(d))}).catch(()=>{})},2e3)}catch(e){c(!1),p(null),J.ZP.error(e.message||"Generation failed")}}},g=t_.aC.find(e=>e.type===r.model);return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(ay,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(tR,{recordDetails:s,progress:u,generating:d}),run:()=>m(r),formData:r,outputData:i,generating:d,credit:(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e[null==g?void 0:g.creditExtendName])||0})});let ab=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={uploadUrl:e.uploadUrl,model:e.model||t_.aC[0].type,callBackUrl:e.callBackUrl||"playground",title:e.title,tags:e.tags,negativeTags:e.negativeTags,vocalGender:e.vocalGender||"m",lyrics:e.lyrics||""};t8(t,"styleWeight",e.styleWeight),t8(t,"weirdnessConstraint",e.weirdnessConstraint),t8(t,"audioWeight",e.audioWeight);let a=Number(e.variety);return t.variety=!t9(e.variety)&&Number.isInteger(a)&&a>=0&&a<=4?a:t_.cZ,t};function aw(e){var t;let{formData:a,setFormData:r}=e,[l,s]=(0,E.useState)(!1),[n,i]=(0,E.useState)(null),[o,d]=(0,E.useState)(""),c=(0,E.useRef)(null);(0,E.useEffect)(()=>{a&&0!==Object.keys(a).length?(null==a?void 0:a.uploadUrl)&&d(a.uploadUrl):r({uploadUrl:"",model:t_.aC[0].type,title:"",tags:"",negativeTags:"",lyrics:"",vocalGender:"m",styleWeight:.65,weirdnessConstraint:.65,audioWeight:.65,variety:t_.cZ,callBackUrl:"playground"})},[]);let u=(e,t)=>{r(a=>({...a||{},[e]:t}))},p=(e,t)=>{r(a=>({...a||{},[e]:t}))},m=async e=>{let t=e.target.files[0];if(!t)return;if(!t_.YO.some(e=>t.type===e||t.name.toLowerCase().endsWith(e.split("/")[1]))){J.ZP.error("Please upload a valid audio file (MP3, WAV, OGG, M4A, FLAC, AAC)");return}if(t.size>209715200){J.ZP.error("File size exceeds 200MB limit");return}s(!0);let a=J.ZP.loading("Uploading audio file...");try{let e=await (0,eK._R)(t,"kieai/market"),r=URL.createObjectURL(t);d(r),i(t),p("uploadUrl",e),J.ZP.dismiss(a),J.ZP.success("Audio file uploaded successfully")}catch(e){J.ZP.dismiss(a),J.ZP.error("Upload failed, please try again")}finally{s(!1)}};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsx)(tU.Z,{label:"Model",options:t_.aC,value:null==a?void 0:a.model,onChange:e=>{p("model",e),r(t=>({...t,model:e}))},onBlur:e=>u("model",e),getOptionValue:e=>e.type,getOptionLabel:e=>e.title,maxHeight:320,required:!0}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["uploadUrl ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(ai,{fileInputRef:c,uploadedFile:n,previewUrl:o,uploadLoading:l,onFileChange:m,onRemoveFile:()=>{i(null),d(""),p("uploadUrl",""),r(e=>({...e,uploadUrl:""})),c.current&&(c.current.value="")},accept:"audio/*",maxSize:"Max 200MB"})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["title ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.title)||"",onChange:e=>p("title",e.target.value),onBlur:e=>u("title",e.target.value),placeholder:"Enter a title",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["tags ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.tags)||"",onChange:e=>p("tags",e.target.value),onBlur:e=>u("tags",e.target.value),placeholder:"Enter tags",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["negativeTags ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.negativeTags)||"",onChange:e=>p("negativeTags",e.target.value),onBlur:e=>u("negativeTags",e.target.value),placeholder:"Enter negative tags",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"lyrics"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.lyrics)||"",onChange:e=>p("lyrics",e.target.value),onBlur:e=>u("lyrics",e.target.value),rows:6,maxLength:5e3,placeholder:"Write your own lyrics"})]}),(0,N.jsx)(tU.Z,{label:"vocalGender",options:t_.I8,value:null==a?void 0:a.vocalGender,onCh
1ange:e=>{p("vocalGender",e),r(t=>({...t,vocalGender:e}))},onBlur:e=>u("vocalGender",e),variant:"simple"}),(0,N.jsx)(tq,{label:"styleWeight",value:null==a?void 0:a.styleWeight,onChange:e=>p("styleWeight",e),onBlur:e=>u("styleWeight",e),min:0,max:1,step:.05,initialValue:.65}),(0,N.jsx)(tq,{label:"weirdnessConstraint",value:null==a?void 0:a.weirdnessConstraint,onChange:e=>p("weirdnessConstraint",e),onBlur:e=>u("weirdnessConstraint",e),min:0,max:1,step:.05,initialValue:.65}),(0,N.jsx)(tq,{label:"audioWeight",value:null==a?void 0:a.audioWeight,onChange:e=>p("audioWeight",e),onBlur:e=>u("audioWeight",e),min:0,max:1,step:.05,initialValue:.65}),(0,N.jsx)(tU.Z,{label:"variety",options:t_.wg,value:null!==(t=null==a?void 0:a.variety)&&void 0!==t?t:t_.cZ,onChange:e=>p("variety",e),onBlur:e=>u("variety",e)})]})}var aj=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),[u,p]=(0,E.useState)(null),m=async e=>{if(!d){c(!0),n(null),o({}),p(null);try{var t;if(!e.uploadUrl)throw Error("Please upload an audio file");if(!e.title)throw Error("Please enter a title");if(!e.tags)throw Error("Please enter tags");if(!e.negativeTags)throw Error("Please enter negative tags");if(!e.callBackUrl)throw Error("callBackUrl is required");let r=null===(t=a.user)||void 0===t?void 0:t.apiKey;if(!r)throw Error("Please login and set your API key");let l=ab(e),s=await fetch("".concat("https://api.kie.ai","/api/v1/generate/add-instrumental"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)},body:JSON.stringify(l)}),i=null;try{i=await s.json()}catch(e){i=null}if(o(i||{}),!s.ok||(null==i?void 0:i.code)!==200)throw Error((null==i?void 0:i.msg)||"Failed to initialize task");let d=null==i?void 0:i.data,u="";if("string"==typeof d?u=d:d&&"object"==typeof d&&(u=d.taskId||d.taskid||""),u||(u=(null==i?void 0:i.taskId)||(null==i?void 0:i.taskid)||""),!u)throw Error("No taskid returned");let m=0,g=setInterval(()=>{let e=Math.max(1,Math.min(Math.floor(m++/40*100),99));p(e),fetch("".concat("https://api.kie.ai","/api/v1/generate/record-info?taskId=").concat(encodeURIComponent(u)),{headers:{Authorization:"Bearer ".concat(r)}}).then(e=>e.json()).then(e=>{if(o(e||{}),200!==e.code)throw Error(e.msg||"Polling request failed");let t=e.data||e,a=t.data||t;n(a),"SUCCESS"===a.status?(c(!1),p(null),clearInterval(g)):["CREATE_TASK_FAILED","GENERATE_AUDIO_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(a.status)&&(c(!1),p(null),clearInterval(g))}).catch(e=>{J.ZP.error(e.message||"Polling request failed")})},2e3)}catch(e){c(!1),J.ZP.error(e.message||"Failed to add instrumental")}}},g=(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e.suno_add_instrumental_v45_plus)||12;return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(aw,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(tR,{recordDetails:s,progress:u,generating:d}),run:()=>m(r),formData:r,outputData:i,generating:d,credit:g})}),ak=a(88237),aN=a.n(ak);let aE=e=>{let t=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"][e%12];return"".concat(t).concat(Math.floor(e/12)-1)};function aC(e){let{instruments:t}=e,[a,r]=(0,E.useState)(0),[l,s]=(0,E.useState)(100),n=(0,E.useRef)(null);if(!t||0===t.length)return null;let i=t[a],o=(null==i?void 0:i.notes)||[],d=Math.max(...o.map(e=>e.end),10),c=Math.min(...o.map(e=>e.pitch),21),u=Math.max(...o.map(e=>e.pitch),108),p=d*l,m=u-c+1,g=12*m,h=[],x=d>30?5:d>10?2:1;for(let e=0;e<=Math.ceil(d);e+=x)h.push(e);let f=[];for(let e=c;e<=u;e++){let t=aE(e);t.startsWith("C")&&f.push({pitch:e,name:t})}let y=e=>{let t=e/127;return"hsl(".concat(210,", ").concat(70+30*t,"%, ").concat(50+20*t,"%)")};return(0,N.jsxs)("div",{className:"w-full space-y-4",children:[(0,N.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 rounded-lg border border-gray-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(D.JO,{icon:"mdi:music-note",className:"text-xl text-blue-500"}),(0,N.jsx)("select",{value:a,onChange:e=>r(Number(e.target.value)),className:"rounded-lg border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white",children:t.map((e,t)=>(0,N.jsxs)("option",{value:t,children:[e.name," (",e.notes.length," notes)"]},t))})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(D.JO,{icon:"mdi:magnify-minus",className:"text-gray-600 dark:text-gray-400"}),(0,N.jsx)("input",{type:"range",min:"50",max:"200",value:l,onCh
1ange:e=>s(Number(e.target.value)),className:"h-2 w-32 cursor-pointer rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsx)(D.JO,{icon:"mdi:magnify-plus",className:"text-gray-600 dark:text-gray-400"}),(0,N.jsxs)("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:[l,"%"]})]}),(0,N.jsxs)("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[(0,N.jsxs)("span",{children:["Duration: ",d.toFixed(2),"s"]}),(0,N.jsxs)("span",{children:["Notes: ",o.length]}),(0,N.jsxs)("span",{children:["Range: ",aE(c)," - ",aE(u)]})]})]}),(0,N.jsxs)("div",{className:"overflow-hidden rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsxs)("div",{className:"flex border-b border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-900",children:[(0,N.jsx)("div",{className:"w-16 flex-shrink-0 border-r border-gray-200 bg-gray-100 px-2 py-2 text-xs font-medium text-gray-600 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400",children:"Time"}),(0,N.jsx)("div",{ref:n,className:"relative flex-1 overflow-x-auto",style:{maxWidth:"calc(100vw - 200px)"},children:(0,N.jsx)("div",{className:"relative",style:{width:p,height:"32px"},children:h.map(e=>(0,N.jsx)("div",{className:"absolute top-0 border-l border-gray-300 dark:border-gray-600",style:{left:e*l,height:"100%"},children:(0,N.jsxs)("span",{className:"ml-1 text-xs text-gray-600 dark:text-gray-400",children:[e,"s"]})},e))})})]}),(0,N.jsxs)("div",{className:"flex",children:[(0,N.jsx)("div",{className:"w-16 flex-shrink-0 overflow-hidden border-r border-gray-200 bg-gray-100 dark:border-gray-700 dark:bg-gray-800",children:(0,N.jsx)("div",{style:{height:g},children:Array.from({length:m},(e,t)=>{let a=u-t,r=aE(a),l=r.startsWith("C");return(0,N.jsx)("div",{className:"flex items-center justify-end border-b px-2 ".concat(l?"border-gray-300 bg-gray-200 dark:border-gray-600 dark:bg-gray-700":"border-gray-100 dark:border-gray-800"),style:{height:12},children:l&&(0,N.jsx)("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:r})},a)})})}),(0,N.jsx)("div",{className:"relative flex-1 overflow-auto",style:{maxWidth:"calc(100vw - 200px)"},children:(0,N.jsxs)("div",{className:"relative bg-gray-50 dark:bg-gray-900",style:{width:p,height:g},children:[Array.from({length:m},(e,t)=>{let a=u-t,r=aE(a).startsWith("C");return(0,N.jsx)("div",{className:"absolute w-full border-b ".concat(r?"border-gray-300 dark:border-gray-600":"border-gray-100 dark:border-gray-800"),style:{top:12*t,height:12}},a)}),h.map(e=>(0,N.jsx)("div",{className:"absolute h-full border-l border-gray-200 dark:border-gray-700",style:{left:e*l}},e)),o.map((e,t)=>{let a=e.start*l,r=Math.max((e.end-e.start)*l,2),s=(u-e.pitch)*12,n=y(e.velocity);return(0,N.jsx)("div",{className:"group absolute cursor-pointer rounded-sm border border-gray-700 transition-all hover:z-10 hover:shadow-lg",style:{left:"".concat(a,"px"),top:"".concat(s,"px"),width:"".concat(r,"px"),height:"".concat(11,"px"),backgroundColor:n},title:"".concat(aE(e.pitch)," | ").concat(e.start.toFixed(2),"s - ").concat(e.end.toFixed(2),"s | Velocity: ").concat(e.velocity),children:(0,N.jsx)("div",{className:"absolute inset-0 bg-white opacity-0 transition-opacity group-hover:opacity-20"})},t)})]})})]})]}),(0,N.jsxs)("div",{className:"flex items-center justify-center gap-6 text-xs text-gray-600 dark:text-gray-400",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)("div",{className:"h-3 w-8 rounded",style:{backgroundColor:y(30)}}),(0,N.jsx)("span",{children:"Low Velocity"})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)("div",{className:"h-3 w-8 rounded",style:{backgroundColor:y(80)}}),(0,N.jsx)("span",{children:"Medium Velocity"})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)("div",{className:"h-3 w-8 rounded",style:{backgroundColor:y(127)}}),(0,N.jsx)("span",{children:"High Velocity"})]})]})]})}function aI(e){let{recordDetails:t,progress:a,generating:r}=e;return(0,N.jsx)("div",{className:"relative m-auto flex w-full flex-col items-center justify-center lg:h-[80vh] lg:w-[100%]",children:(0,N.jsx)("div",{className:"flex w-full flex-1 flex-col-reverse items-start justify-between overflow-y-auto p-4 lg:h-full lg:flex-row",children:(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-start gap-2",children:[(()=>{if((null==t?void 0:t.successFlag)===2||(null==t?void 0:t.successFlag)===3)return(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 whitespace-pre-line py-6 text-center text-rose-600",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"failed",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{children:"Generation Failed"}),(null==t?void 0:t.errorMessage)&&(0,N.jsx)("p",{className:"text-sm text-gray-500",children:t.errorMessage})]});if(!t||!t.midiData)return r?(0,N.jsxs)("div",{className:"flex w-full flex-col items-center",children:[(0,N.jsx)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 shadow-sm dark:bg-gray-800",children:(0,N.jsxs)("div",{className:"w-full space-y-2",children:[(0,N.jsx)("div",{className:"h-4 w-3/4 rounded bg-gray-200 dark:bg-gray-700"}),(0,N.jsx)("div",{className:"h-4 w-full rounded bg-gray-200 dark:bg-gray-700"}),(0,N.jsx)("div",{className:"h-4 w-5/6 rounded bg-gray-200 dark:bg-gray-700"})]})}),r&&(0,N.jsx)("div",{className:"flex w-full items-center justify-center py-6",children:(0,N.jsx)(tS.Z,{loading:!0,color:"#3b82f6",size:10})})]}):(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:[(0,N.jsx)(tA.Z,{loading:r,color:"#3b82f6",size:10}),(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"midi generation",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Convert separated audio tracks into MIDI format with detailed note information for each instrument."})]});let e=null==t?void 0:t.midiData,a=(null==e?void 0:e.instruments)||[];return a.length>0?(0,N.jsx)("div",{className:"flex h-full w-full flex-col gap-4 overflow-y-auto pr-2",children:(0,N.jsxs)("div",{className:"bg-white dark:bg-gray-800",children:[(0,N.jsx)("b",{className:"mb-4 inline-block text-lg font-semibold text-gray-900 dark:text-gray-100",children:"MIDI Sequencer"}),(0,N.jsx)(aC,{instruments:a})]})}):(0,N.jsx)("div",{className:"flex w-full flex-col items-start rounded-xl p-3 shadow-sm",children:(0,N.jsx)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 dark:bg-gray-800",children:(0,N.jsxs)("div",{className:"w-full space-y-2",children:[(0,N.jsx)("div",{className:"h-4 w-3/4 rounded bg-gray-200 dark:bg-gray-700"}),(0,N.jsx)("div",{className:"h-4 w-full rounded bg-gray-200 dark:bg-gray-700"})]})})})})(),a&&(null==t?void 0:t.successFlag)!==1&&(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2 px-4 py-2",children:[(0,N.jsx)("div",{className:"relative h-1.5 w-full rounded-full bg-gray-200 dark:bg-gray-700",children:(0,N.jsx)("span",{style:{width:"".concat(a,"%")},className:"absolute left-0 top-0 h-full rounded-full bg-blue-500"})}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-center gap-1 text-xs text-blue-500",children:[(0,N.jsx)(tP.Z,{color:"#3b82f6",size:14}),(0,N.jsx)("span",{children:"Generating MIDI, please wait patiently..."})]})]})]})})})}function aS(e){let{formData:t,setFormData:a}=e,{userStore:r}=(0,_.o)(),[l,s]=(0,E.useState)([]),[n,i]=(0,E.useState)(!1),[o,d]=(0,E.useState)(!1),c=(0,E.useRef)(null);(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({taskId:"",audioId:""})},[]);let u=(0,E.useCallback)(async e=>{var t,l,n,o,d,c,u,p;if(!e||""===e.trim()){s([]),a(e=>({...e,audioId:""}));return}i(!0);try{let i=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/vocal-removal/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(null===(t=r.user)||void 0===t?void 0:t.apiKey)},params:{taskId:e.trim()}});if((null===(l=i.data)||void 0===l?void 0:l.code)===200&&(null===(d=i.data)||void 0===d?void 0:null===(o=d.data)||void 0===o?void 0:null===(n=o.response)||void 0===n?void 0:n.originData)){let e=i.data.data.response.originData;s(e),1===e.length?a(t=>
1({...t,audioId:e[0].id})):a(e=>({...e,audioId:""}))}else s([]),a(e=>({...e,audioId:""})),J.ZP.error((null===(c=i.data)||void 0===c?void 0:c.msg)||"Failed to fetch audio data")}catch(e){console.error("Error fetching origin data:",e),s([]),a(e=>({...e,audioId:""})),J.ZP.error((null===(p=e.response)||void 0===p?void 0:null===(u=p.data)||void 0===u?void 0:u.msg)||"Failed to fetch audio data")}finally{i(!1)}},[a]),p=(0,E.useMemo)(()=>aN()(u,500),[u]);(0,E.useEffect)(()=>()=>{p.cancel()},[p]);let m=(e,t)=>{a(a=>({...a||{},[e]:t})),"taskId"===e&&(c.current&&o&&(c.current.pause(),d(!1)),t&&""!==t.trim()?(a(e=>({...e,audioId:""})),s([]),p(t)):(s([]),a(e=>({...e,audioId:""})))),"audioId"===e&&c.current&&o&&(c.current.pause(),d(!1))};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["Task ID ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsxs)("div",{className:"relative",children:[(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.taskId)||"",onChange:e=>m("taskId",e.target.value),placeholder:"Enter task ID from vocal separation",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),n&&(0,N.jsx)("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:(0,N.jsx)(tA.Z,{color:"#3b82f6",size:8})})]}),(0,N.jsx)("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:"Task ID from a completed vocal separation. This should be the taskId returned from the Vocal & Instrument Stem Separation endpoint."})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Audio ID"}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsxs)("select",{value:(null==t?void 0:t.audioId)||"",onChange:e=>m("audioId",e.target.value),className:"h-10 flex-1 rounded-lg border border-gray-300 bg-white px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400",children:[(0,N.jsx)("option",{value:"",children:"Select an audio track"}),l.map(e=>(0,N.jsx)("option",{value:e.id,children:e.stem_type_group_name},e.id))]}),(null==t?void 0:t.audioId)&&(()=>{let e=l.find(e=>e.id===t.audioId);return(null==e?void 0:e.audio_url)&&(0,N.jsx)("button",{type:"button",onClick:()=>{c.current&&(o?(c.current.pause(),d(!1)):(c.current.play(),d(!0)))},className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg border border-gray-300 bg-white text-gray-700 transition-colors hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600",title:o?"Pause":"Play",children:(0,N.jsx)(D.JO,{icon:o?"mdi:pause":"mdi:play",className:"h-5 w-5"})})})()]}),(null==t?void 0:t.audioId)&&(()=>{let e=l.find(e=>e.id===t.audioId),a=null==e?void 0:e.audio_url;return a&&(0,N.jsx)("audio",{ref:c,src:a,onEnded:()=>d(!1),onPause:()=>d(!1),onPlay:()=>d(!0),className:"hidden"},t.audioId)})(),(0,N.jsx)("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:"Select the audio track to convert to MIDI format. Please fill in the Task ID field first."})]})]})}var aA=(0,Y.Pi)(()=>{let{userStore:e}=(0,_.o)(),[t,a]=(0,E.useState)({}),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)(!1),[d,c]=(0,E.useState)(null),u=async t=>{if(!i){l(null),n({}),o(!0);try{var a;if(!t.taskId)throw J.ZP.error("Please enter task ID"),Error("Please enter task ID");let r={taskId:t.taskId,audioId:t.audioId,callBackUrl:"playground"},s=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/midi/generate"),method:"post",data:r,headers:{Authorization:"Bearer ".concat(null===(a=e.user)||void 0===a?void 0:a.apiKey)}});if(n(s.data||{}),200!==s.data.code){let e=s.data.msg||"Failed to initialize MIDI generation task";throw J.ZP.error(e),Error(e)}let i=s.data.data.taskId,d=0,u=setInterval(()=>{var t;let a=Math.max(1,Math.min(Math.floor(d++/60*100),99));c(a),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/midi/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(null===(t=e.user)||void 0===t?void 0:t.apiKey)},params:{taskId:i}}).then(e=>{if(n(e.data||{}),200!==e.data.code){let t=e.data.msg||"Polling request failed";throw J.ZP.error(t),Error(t)}let t=e.data.data;if(l(t),1===t.successFlag)o(!1),c(100),setTimeout(()=>c(null),500),clearInterval(u),J.ZP.success("MIDI generation completed successfully!");else if(2===t.successFlag||3===t.successFlag){o(!1),c(null),clearInterval(u);let e=t.errorMessage||"MIDI generation failed";J.ZP.error(e)}}).catch(e=>{})},2e3)}catch(e){o(!1),e.message.includes("Please enter")||J.ZP.error(e.message||"Failed to generate MIDI")}}};return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(aS,{formData:t,setFormData:a}
1),OutputPanelContent:(0,N.jsx)(aI,{recordDetails:r,progress:d,generating:i}),run:()=>u(t),formData:t,outputData:s,generating:i,credit:0})});function aP(e){let{recordDetails:t,progress:a,separating:r,separationType:l,stemName:s}=e;return(0,N.jsx)("div",{className:"relative m-auto flex w-full flex-col items-center justify-center lg:h-[80vh] lg:w-[100%]",children:(0,N.jsx)("div",{className:"flex w-full flex-1 flex-col-reverse items-start justify-between overflow-y-auto p-4 lg:h-full lg:flex-row",children:(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-start gap-2",children:[(()=>{if((null==t?void 0:t.successFlag)&&["CREATE_TASK_FAILED","GENERATE_AUDIO_FAILED","CALLBACK_EXCEPTION"].includes(t.successFlag))return(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 whitespace-pre-line py-6 text-center text-rose-600",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"failed",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{children:"Separation Failed"}),t.errorMessage&&(0,N.jsx)("p",{className:"text-sm text-gray-500",children:t.errorMessage})]});if(!t)return r?(0,N.jsx)("div",{className:"flex w-full flex-col items-center",children:r&&(0,N.jsx)("div",{className:"flex w-full items-center justify-center py-6",children:(0,N.jsx)(tS.Z,{loading:!0,color:"#3b82f6",size:10})})}):(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:[(0,N.jsx)(tA.Z,{loading:r,color:"#3b82f6",size:10}),(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"stem separation",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Separate vocals and instruments from your audio tracks with AI!"})]});if("SUCCESS"===t.successFlag&&t.response){let e=t.response,a=(()=>{let t=[],a="string"==typeof s?s.trim().toLowerCase():"",r={vocal:"mdi:microphone",vocals:"mdi:microphone","backing vocals":"mdi:microphone-variant",drums:"mdi:drum",drum:"mdi:drum",bass:"mdi:guitar-electric",guitar:"mdi:guitar-acoustic",piano:"mdi:piano",keyboard:"mdi:keyboard",percussion:"mdi:drum-kit",strings:"mdi:violin",synth:"mdi:sine-wave",effects:"mdi:waveform",fx:"mdi:waveform",brass:"mdi:trumpet",woodwinds:"mdi:saxophone",synthesize:"mdi:sine-wave"},n=e=>{let t="".concat(e||"").trim().toLowerCase();return r[t]?r[t]:"mdi:music-circle"};if("split_stem_advanced"===l&&Array.isArray(e.originData)&&e.originData.length>0){let t=new Map;if(e.originData.forEach((e,r)=>{let l=(null==e?void 0:e.extract)||{},s=(null==e?void 0:e.remove)||{},i="".concat(l.stem_type_group_name||"").trim(),o="".concat(s.stem_type_group_name||"").trim(),d=i||o||"Stem ".concat(r+1),c=i.toLowerCase(),u=o.toLowerCase(),p=d.toLowerCase();if(!(!a||p===a||i&&c===a||o&&u===a))return;let m=d.toLowerCase();t.has(m)||t.set(m,{name:d,icon:n(d),pairs:[]});let g=r+1;t.get(m).pairs.push({id:"".concat(m,"-").concat(g),pairIndex:g,extract:{url:l.audio_url,name:i||d,task:l.stem_task||""},remove:{url:s.audio_url,name:o||d,task:s.stem_task||""}})}),t.size>0)return{mode:"grouped",groups:Array.from(t.values())}}if("separate_vocal"===l)e.vocalUrl&&t.push({name:"Vocals",url:e.vocalUrl,icon:"mdi:microphone"}),e.instrumentalUrl&&t.push({name:"Instrumental",url:e.instrumentalUrl,icon:"mdi:music"});else if("split_stem"===l||"split_stem_advanced"===l){let r=[{key:"vocalUrl",name:"Vocals",icon:"mdi:microphone"},{key:"backingVocalsUrl",name:"Backing Vocals",icon:"mdi:microphone-variant"},{key:"drumsUrl",name:"Drums",icon:"mdi:drum"},{key:"bassUrl",name:"Bass",icon:"mdi:guitar-electric"},{key:"guitarUrl",name:"Guitar",icon:"mdi:guitar-acoustic"},{key:"pianoUrl",name:"Piano",icon:"mdi:piano"},{key:"keyboardUrl",name:"Keyboard",icon:"mdi:keyboard"},{key:"percussionUrl",name:"Percussion",icon:"mdi:drum-kit"},{key:"stringsUrl",name:"Strings",icon:"mdi:violin"},{key:"synthUrl",name:"Synthesizer",icon:"mdi:sine-wave"},{key:"fxUrl",name:"Effects",icon:"mdi:waveform"},{key:"brassUrl",name:"Brass",icon:"mdi:trumpet"},{key:"woodwindsUrl",name:"Woodwinds",icon:"mdi:saxophone"}];r.forEach(r=>{if(e[r.key]){let l=a&&r.name.toLowerCase()===a;(!a||l)&&t.push({name:r.name,url:e[r.key],icon:r.icon})}}),a&&0===t.length&&r.forEach(a=>{e[a.key]&&t.push({name:a.name,url:e[a.key],icon:a.icon})})}return{mode:"list",list:t}})(),r=(e,a)=>{let r=document.createElement("a");r.href=e,r.download="".concat(a,"_").concat(t.taskId,".mp3"),document.body.appendChild(r),r.click(),document.body.removeChild(r)};if("grouped"===a.mode)return(0,N.jsx)("div",{className:"flex w-full flex-col gap-3 rounded-xl",children:a.groups.map(e=>(0,N.jsxs)("div",{className:"w-full rounded-xl border border-gray-200 bg-gray-50 p-3 dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(D.JO,{icon:e.icon,className:"h-5 w-5 text-blue-500"}),(0,N.jsx)("span",{className:"font-medium text-gray-900 dark:text-white",children:e.name})]}),(0,N.jsx)("span",{className:"rounded-full bg-blue-100 px-2 py-0.5 text-xs text-blue-600 dar
1k:bg-blue-900/40 dark:text-blue-300",children:e.pairs.length})]}),(0,N.jsx)("div",{className:"space-y-2",children:e.pairs.map(e=>(0,N.jsxs)("div",{className:"rounded-lg border border-gray-200 bg-white p-2 dark:border-gray-700 dark:bg-gray-900",children:[(0,N.jsxs)("p",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400",children:["Set ",e.pairIndex]}),e.extract.url?(0,N.jsxs)("div",{className:"mb-2",children:[(0,N.jsx)("p",{className:"mb-1 text-xs text-gray-500 dark:text-gray-400",children:"Extract"}),(0,N.jsxs)("div",{className:"flex w-full items-center gap-3",children:[(0,N.jsx)("audio",{src:e.extract.url,controls:!0,className:"flex-1",children:"Your browser does not support the audio tag."}),(0,N.jsx)("button",{onClick:()=>r(e.extract.url,"".concat(e.extract.name," Extract")),className:"flex h-9 w-9 items-center justify-center rounded-lg bg-blue-500 text-white transition-colors hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800",title:"Download ".concat(e.extract.name," Extract"),children:(0,N.jsx)(D.JO,{icon:"material-symbols:download",className:"h-4 w-4"})})]})]}):null,e.remove.url?(0,N.jsxs)("div",{children:[(0,N.jsx)("p",{className:"mb-1 text-xs text-gray-500 dark:text-gray-400",children:"Remove"}),(0,N.jsxs)("div",{className:"flex w-full items-center gap-3",children:[(0,N.jsx)("audio",{src:e.remove.url,controls:!0,className:"flex-1",children:"Your browser does not support the audio tag."}),(0,N.jsx)("button",{onClick:()=>r(e.remove.url,"".concat(e.remove.name," Remove")),className:"flex h-9 w-9 items-center justify-center rounded-lg bg-blue-500 text-white transition-colors hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800",title:"Download ".concat(e.remove.name," Remove"),children:(0,N.jsx)(D.JO,{icon:"material-symbols:download",className:"h-4 w-4"})})]})]}):null]},e.id))})]},e.name))});let n=a.list||[];return(0,N.jsx)("div",{className:"flex w-full flex-col items-start rounded-xl shadow-sm",children:n.map((e,t)=>(0,N.jsxs)("div",{className:"flex w-full flex-col gap-2 rounded-lg bg-gray-50 p-3 dark:bg-gray-800",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(D.JO,{icon:e.icon,className:"h-5 w-5 text-blue-500"}),(0,N.jsx)("span",{className:"font-medium text-gray-900 dark:text-white",children:e.name})]}),(0,N.jsxs)("div",{className:"flex w-full items-center gap-3",children:[(0,N.jsx)("audio",{src:e.url,controls:!0,className:"flex-1",children:"Your browser does not support the audio tag."}),(0,N.jsx)("button",{onClick:()=>r(e.url,e.name),className:"flex h-10 w-10 items-center justify-center rounded-lg bg-blue-500 text-white transition-colors hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800",title:"Download ".concat(e.name),children:(0,N.jsx)(D.JO,{icon:"material-symbols:download",className:"h-4 w-4"})})]})]},t))})}return(0,N.jsx)("div",{className:"flex w-full flex-col items-start rounded-xl p-3 shadow-sm",children:(0,N.jsxs)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 dark:bg-gray-800",children:[(0,N.jsx)("span",{className:"aspect-square w-20 rounded-lg bg-gray-200 dark:bg-gray-700",children:(0,N.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,N.jsx)(tP.Z,{color:"#3b82f6",size:26})})}),(0,N.jsxs)("div",{className:"flex flex-1 flex-col items-start gap-2",children:[(0,N.jsx)("span",{className:"h-6 w-40 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsx)("span",{className:"h-6 w-1/2 rounded-lg bg-gray-200 dark:bg-gray-700"})]})]})})})(),a&&(null==t?void 0:t.successFlag)==="PENDING"&&(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2 px-4 py-2",children:[(0,N.jsx)("div",{className:"relative h-1.5 w-full rounded-full bg-gray-200 dark:bg-gray-700",children:(0,N.jsx)("span",{style:{width:"".concat(a,"%")},className:"absolute left-0 top-0 h-full rounded-full bg-blue-500"})}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-center gap-1 text-xs text-blue-500",children:[(0,N.jsx)(tP.Z,{color:"#3b82f6",size:14}),(0,N.jsx)("span",{children:"split_stem"===l||"split_stem_advanced"===l?"Separating instruments and vocals, please wait patiently":"Separating vocals and accompaniment, please wait patiently"})]})]})]})})})}function aD(e){var t,a,r;let{formData:l,setFormData:s,useUploadedAudio:n,setUseUploadedAudio:i}=e,[o,d]=(0,E.useState)(!1),[c,u]=(0,E.useState)(null),[p,m]=(0,E.useState)(!1),[g,h]=(0,E.useState)(null),[x,f]=(0,E.useState)((null==l?void 0:l.audioUrl)||""),y=(0,E.useRef)(null),v=(0,E.useRef)(null);(0,E.useEffect)(()=>{let e=e=>{y.current&&!y.current.contains(e.target)&&d(!1)};return o&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[o]),(0,E.useEffect)(()=>{l&&0!==Object.keys(l).length?l.audioUrl&&(i(!0),f(l.audioUrl),s(e=>{let t={...e||{}};return delete t.taskId,{...t,callBackUrl:t.callBackUrl||"playground"}})):s({taskId:"",audioId:"",type:"separate_vocal",stemName:""})},[]);let b=(e,t)=>{s(a=>({...a,[e]:t}))},w=(e,t)=>{s(a=>({...a||{},[e]:t}))},j=async e=>{var t;let a=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!a)return;if(![...t_.YO,"audio/mp4","audio/x-m4a"].some(e=>{let t=e.split("/")[1];return a.type===e||a.name.toLowerCase().endsWith(".".concat(t))})){J.ZP.error("Please upload a valid audio file (MP3, WAV, OGG, M4A, FLAC, AAC)");return}if(a.size>20971520){J.ZP.error("File size exceeds 20MB limit");return}m(!0);let r=J.ZP.loading("Uploading audio file...");try{let e=await (0,eK._R)(a,"kie-ai/market");if(!e)throw Error("Upload failed");h(a),f(URL.createObjectURL(a)),w("audioUrl",e),b("audioUrl",e),J.ZP.dismiss(r),J.ZP.success("Audio file uploaded successfully")}catch(e){J.ZP.dismiss(r),J.ZP.error(e.message||"Upload failed, please try again")}finally{m(!1),v.current&&(v.current.value="")}},k=[{value:"separate_vocal",title:"Vocal Separation",desc:"Separate vocals and accompaniment into two tracks"},{value:"split_stem",title:"Multi-Stem Separation",desc:"Separate various instruments and vocals into multiple tracks"},{value:"split_stem_advanced",title:"Advanced Split",desc:"Advanced multi-stem separation with more detailed instrument tracks"}],C=!!(null==l?void 0:null===(t=l.audioUrl)||void 0===t?void 0:t.trim()),I=!!(null==l?void 0:null===(a=l.audioId)||void 0===a?void 0:a.trim()),S=C&&I;return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,N.jsx)("div",{className:"flex flex-1 flex-col gap-1",children:(0,N.jsx)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Use uploaded custom audio"})}),(0,N.jsx)(tF.rs,{checked:n,onChange:e=>{if(i(e),e){s(e=>{let t={...e||{}};
1return delete t.taskId,{...t,audioUrl:t.audioUrl||"",audioId:t.audioId||"",callBackUrl:t.callBackUrl||"playground"}});return}h(null),f(""),v.current&&(v.current.value=""),s(e=>{let t={...e||{}};return delete t.audioUrl,delete t.model,{...t,taskId:t.taskId||"",audioId:t.audioId||"",callBackUrl:t.callBackUrl||"playground"}})},className:"group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition duration-500 ease-in-out focus:outline-none data-[checked]:bg-blue-500",children:(0,N.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5"})})]}),n?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-blue-200 bg-blue-50 px-3 py-2.5 text-xs text-blue-700 dark:border-blue-800/60 dark:bg-blue-900/20 dark:text-blue-300",children:[(0,N.jsx)(D.JO,{icon:"carbon:information",className:"mt-0.5 h-4 w-4 shrink-0"}),(0,N.jsxs)("p",{children:[(0,N.jsx)("span",{className:"font-medium",children:"Choose one audio source."})," Upload an audio file or enter an Audio ID. These two options cannot be used together."]})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"audioUrl"}),(0,N.jsx)(ai,{fileInputRef:v,uploadedFile:g,previewUrl:x,uploadLoading:p,onFileChange:j,onRemoveFile:()=>{h(null),f(""),w("audioUrl",""),b("audioUrl",""),v.current&&(v.current.value="")},disabled:I,accept:"audio/*",maxSize:"Max 20MB"})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Audio ID"}),(0,N.jsx)("input",{type:"text",value:(null==l?void 0:l.audioId)||"",onChange:e=>w("audioId",e.target.value),onBlur:e=>b("audioId",e.target.value),placeholder:"Enter audio ID from callback data",disabled:C,className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400 dark:disabled:bg-gray-800 dark:disabled:text-gray-500"})]}),(0,N.jsxs)("div",{role:"status","aria-live":"polite",className:"flex items-center gap-2 text-xs ".concat(S?"text-amber-600 dark:text-amber-400":C||I?"text-emerald-600 dark:text-emerald-400":"text-gray-500 dark:text-gray-400"),children:[(0,N.jsx)(D.JO,{icon:S?"carbon:warning":C||I?"carbon:checkmark-outline":"carbon:information",className:"h-4 w-4 shrink-0"}),(0,N.jsx)("span",{children:S?"Only one audio source can be used. Please remove either the audio file or the Audio ID.":C?"Using uploaded audio. Audio ID is disabled.":I?"Using Audio ID. File upload is disabled.":"Please provide either an audio file or an Audio ID."})]})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["Task ID ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==l?void 0:l.taskId)||"",onChange:e=>w("taskId",e.target.value),onBlur:e=>b("taskId",e.target.value),placeholder:"Enter task ID from music generation",required:!0,className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["Audio ID ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==l?void 0:l.audioId)||"",onChange:e=>w("audioId",e.target.value),onBlur:e=>b("audioId",e.target.value),placeholder:"Enter audio ID from callback data",required:!0,className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]})]}),(0,N.jsxs)("div",{className:"relative",ref:y,children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Separation Type"}),(0,N.jsxs)("button",{type:"button",onClick:()=>d(e=>!e),className:"flex w-full items-center justify-between rounded-lg border border-[rgba(156,163,175,0.4)] bg-transparent px-4 py-2.5 text-left transition-colors hover:border-blue-400 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-700",children:[(0,N.jsx)("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:(null===(r=k.find(e=>e.value===(null==l?void 0:l.type)))||void 0===r?void 0:r.title)||"Select separation type"}),(0,N.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"h-4 w-4 text-gray-500 transition-transform ".concat(o?"rotate-180":""),children:(0,N.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),o&&(0,N.jsx)("div",{className:"absolute left-0 right-0 top-full z-50 mt-2 max-h-80 overflow-y-auto rounded-lg border border-[rgba(156,163,175,0.3)] bg-white shadow-lg dark:border-gray-700 dark:bg-gray-800",children:k.map(e=>(0,N.jsx)("button",{type:"button",onClick:()=>{s(t=>({...t||{},type:e.value,stemName:"split_stem_advanced"===e.value&&(null==t?void 0:t.stemName)||""})),d(!1)},onMouseEnter:()=>u(e.value),onMouseLeave:()=>u(null),className:"w-full px-4 py-3 text-left transition-colors hover:bg-gray-50 dark:hover:bg-gray-700 ".concat((null==l?void 0:l.type)===e.value?"bg-gray-50 dark:bg-gray-700":""),children:(0,N.jsxs)("div",{className:"flex flex-col",children:[(0,N.jsx)("span",{className:"text-sm font-semibold ".concat((null==l?void 0:l.type)===e.value||c===e.value?"text-blue-600 dar
1k:text-blue-400":"text-gray-700 dark:text-gray-100"),children:e.title}),(0,N.jsx)("span",{className:"mt-1 text-xs leading-5 text-gray-500 dark:text-gray-400",children:e.desc})]})},e.value))})]}),(null==l?void 0:l.type)==="split_stem_advanced"&&(0,N.jsx)(tU.Z,{label:(0,N.jsxs)(N.Fragment,{children:["Stem Name ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),options:t_.hW,value:(null==l?void 0:l.stemName)||"",onChange:e=>w("stemName",e),placeholder:"Select stem name",searchable:!0,searchPlaceholder:"Search stem names",maxHeight:300})]})}var aT=(0,Y.Pi)(()=>{let{userStore:e}=(0,_.o)(),[t,a]=(0,E.useState)({}),[r,l]=(0,E.useState)(null),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)(!1),[d,c]=(0,E.useState)(null),[u,p]=(0,E.useState)("separate_vocal"),[m,g]=(0,E.useState)(""),[h,x]=(0,E.useState)(!1),f=async t=>{if(!i)try{var a,r,s,d,u,m;let i=null===(a=t.audioUrl)||void 0===a?void 0:a.trim(),x=null===(r=t.taskId)||void 0===r?void 0:r.trim(),f=null===(s=t.audioId)||void 0===s?void 0:s.trim();if(h){if(i&&f)throw Error("Please use either audio URL or audio ID, not both");if(!i&&!f)throw Error("Please upload an audio file or enter audio ID")}else{if(!x)throw Error("Please enter task ID");if(!f)throw Error("Please enter audio ID")}if("split_stem_advanced"===t.type&&!(null===(d=t.stemName)||void 0===d?void 0:d.trim()))throw Error("Please select a stem name");if(!(null===(u=e.user)||void 0===u?void 0:u.apiKey))throw Error("Please login and set your API key");let y=t.type||"separate_vocal";o(!0),l(null),n({}),c(null),p(y),g((null==t?void 0:t.stemName)||"");let v={type:y,stemName:"split_stem_advanced"===y&&t.stemName||void 0,callBackUrl:"playground"};h?i?v.audioUrl=i:v.audioId=f:(v.taskId=x,v.audioId=f);let b=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/vocal-removal/generate"),method:"post",data:v,headers:{Authorization:"Bearer ".concat(null===(m=e.user)||void 0===m?void 0:m.apiKey)}});if(n(b.data||{}),200!==b.data.code)throw Error(b.data.msg||"Failed to initialize separation task");let w=b.data.data.taskId,j=0,k=setInterval(()=>{var t;let a=Math.max(1,Math.min(Math.floor(j++/60*100),99));c(a),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/vocal-removal/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(null===(t=e.user)||void 0===t?void 0:t.apiKey)},params:{taskId:w}}).then(e=>{if(n(e.data||{}),200!==e.data.code)throw Error("Polling request failed");let t=e.data.data;l(t),"SUCCESS"===t.successFlag?(o(!1),c(null),clearInterval(k),J.ZP.success("Music separation completed successfully!")):["CREATE_TASK_FAILED","GENERATE_AUDIO_FAILED","CALLBACK_EXCEPTION"].includes(t.successFlag)&&(o(!1),c(null),clearInterval(k),J.ZP.error(t.errorMessage||"Music separation failed"))}).catch(e=>{console.error("Polling error:",e)})},2e3)}catch(e){o(!1),J.ZP.error(e.message||"An error occurred during separation")}};return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(aD,{formData:t,setFormData:a,useUploadedAudio:h,setUseUploadedAudio:x}),OutputPanelContent:(0,N.jsx)(aP,{recordDetails:r,progress:d,separating:i,separationType:u,stemName:m}),run:()=>f(t),formData:t,outputData:s,generating:i,credit:(()=>{var a;let r=(null===(a=e.user)||void 0===a?void 0:a.consumeCreditsMap)||{},l=(null==t?void 0:t.type)||"separate_vocal";return"string"==typeof(null==t?void 0:t.stemName)&&t.stemName.trim(),r["split_stem_advanced"===l?"vocal-removal-split-stem-advanced":"split_stem"===l?"vocal-removal-split-stem":"vocal-removal-separate-vocal"]||10})()})});let a_=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={uploadUrl:e.uploadUrl,model:e.model||t_.aC[0].type,callBackUrl:e.callBackUrl||"playground",title:e.title,style:e.style,lyrics:e.lyrics||"",negativeTags:e.negativeTags,vocalGender:e.vocalGender||"m"};t8(t,"styleWeight",e.styleWeight),t8(t,"weirdnessConstraint",e.weirdnessConstraint),t8(t,"audioWeight",e.audioWeight);let a=Number(e.variety);return t.variety=!t9(e.variety)&&Number.isInteger(a)&&a>=0&&a<=4?a:t_.cZ,t};function aR(e){var t;let{formData:a,setFormData:r}=e,[l,s]=(0,E.useState)(!1),[n,i]=(0,E.useState)(null),[o,d]=(0,E.useState)(""),c=(0,E.useRef)(null);(0,E.useEffect)(()=>{a&&0!==Object.keys(a).length?(null==a?void 0:a.uploadUrl)&&d(a.uploadUrl):r({uploadUrl:"",model:t_.aC[0].type,title:"",style:"",lyrics:"",negativeTags:"",vocalGender:"m",styleWeight:.65,weirdnessConstraint:.65,audioWeight:.65,variety:t_.cZ,callBackUrl:"playground"})},[]);let u=(e,t)=>
1{r(a=>({...a||{},[e]:t}))},p=(e,t)=>{r(a=>({...a||{},[e]:t}))},m=async e=>{let t=e.target.files[0];if(!t)return;if(!t_.YO.some(e=>t.type===e||t.name.toLowerCase().endsWith(e.split("/")[1]))){J.ZP.error("Please upload a valid audio file (MP3, WAV, OGG, M4A, FLAC, AAC)");return}if(t.size>209715200){J.ZP.error("File size exceeds 200MB limit");return}s(!0);let a=J.ZP.loading("Uploading audio file...");try{let e=await (0,eK._R)(t,"kieai/market"),r=URL.createObjectURL(t);d(r),i(t),p("uploadUrl",e),J.ZP.dismiss(a),J.ZP.success("Audio file uploaded successfully")}catch(e){J.ZP.dismiss(a),J.ZP.error("Upload failed, please try again")}finally{s(!1)}},g=t_.aC.find(e=>e.type===((null==a?void 0:a.model)||t_.aC[0].type))||t_.aC[0],h=g.prompt_maxlength||3e3,x=g.style_maxlength||200;return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsx)(tU.Z,{label:"Model",options:t_.aC,value:null==a?void 0:a.model,onChange:e=>{p("model",e)},onBlur:e=>u("model",e),getOptionValue:e=>e.type,getOptionLabel:e=>e.title,maxHeight:320,required:!0}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["uploadUrl ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(ai,{fileInputRef:c,uploadedFile:n,previewUrl:o,uploadLoading:l,onFileChange:m,onRemoveFile:()=>{i(null),d(""),p("uploadUrl",""),r(e=>({...e,uploadUrl:""})),c.current&&(c.current.value="")},accept:"audio/*",maxSize:"Max 200MB"})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["title ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.title)||"",onChange:e=>p("title",e.target.value),onBlur:e=>u("title",e.target.value),placeholder:"Enter a title",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["style ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(tB,{value:(null==a?void 0:a.style)||"",onChange:e=>p("style",e.target.value),onBlur:e=>u("style",e.target.value),rows:4,placeholder:"Enter style of music",maxLength:x})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"lyrics"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.lyrics)||"",onChange:e=>p("lyrics",e.target.value),onBlur:e=>u("lyrics",e.target.value),rows:6,placeholder:"Write your own lyrics",maxLength:h})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["negativeTags ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.negativeTags)||"",onChange:e=>p("negativeTags",e.target.value),onBlur:e=>u("negativeTags",e.target.value),placeholder:"Enter negative tags",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsx)(tU.Z,{label:"vocalGender",options:t_.I8,value:null==a?void 0:a.vocalGender,onChange:e=>{p("vocalGender",e)},onBlur:e=>u("vocalGender",e),variant:"simple"}),(0,N.jsx)(tq,{label:"styleWeight",value:null==a?void 0:a.styleWeight,onChange:e=>p("styleWeight",e),onBlur:e=>u("styleWeight",e),min:0,max:1,step:.05,initialValue:.65}),(0,N.jsx)(tq,{label:"weirdnessConstraint",value:null==a?void 0:a.weirdnessConstraint,onChange:e=>p("weirdnessConstraint",e),onBlur:e=>u("weirdnessConstraint",e),min:0,max:1,step:.05,initialValue:.65}),(0,N.jsx)(tq,{label:"audioWeight",value:null==a?void 0:a.audioWeight,onChange:e=>p("audioWeight",e),onBlur:e=>
1u("audioWeight",e),min:0,max:1,step:.05,initialValue:.65}),(0,N.jsx)(tU.Z,{label:"variety",options:t_.wg,value:null!==(t=null==a?void 0:a.variety)&&void 0!==t?t:t_.cZ,onChange:e=>p("variety",e),onBlur:e=>u("variety",e)})]})}var aF=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),[u,p]=(0,E.useState)(null),m=async e=>{if(!d){c(!0),n(null),o({}),p(null);try{var t;if(!e.uploadUrl)throw Error("Please upload an audio file");if(!e.title)throw Error("Please enter a title");if(!e.style)throw Error("Please enter style");if(!e.negativeTags)throw Error("Please enter negative tags");let r=null===(t=a.user)||void 0===t?void 0:t.apiKey;if(!r)throw Error("Please login and set your API key");let l=a_(e),s=await fetch("".concat("https://api.kie.ai","/api/v1/generate/add-vocals"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)},body:JSON.stringify(l)}),i=null;try{i=await s.json()}catch(e){i=null}if(o(i||{}),!s.ok||(null==i?void 0:i.code)!==200)throw Error((null==i?void 0:i.msg)||"Failed to initialize task");let d=null==i?void 0:i.data,u="";if("string"==typeof d?u=d:d&&"object"==typeof d&&(u=d.taskId||d.taskid||""),u||(u=(null==i?void 0:i.taskId)||(null==i?void 0:i.taskid)||""),!u)throw Error("No taskid returned");let m=0,g=setInterval(()=>{let e=Math.max(1,Math.min(Math.floor(m++/40*100),99));p(e),fetch("".concat("https://api.kie.ai","/api/v1/generate/record-info?taskId=").concat(encodeURIComponent(u)),{headers:{Authorization:"Bearer ".concat(r)}}).then(e=>e.json()).then(e=>{if(o(e||{}),200!==e.code)throw Error(e.msg||"Polling request failed");let t=e.data||e,a=t.data||t;n(a),"SUCCESS"===a.status?(c(!1),p(null),clearInterval(g)):["CREATE_TASK_FAILED","GENERATE_AUDIO_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(a.status)&&(c(!1),p(null),clearInterval(g))}).catch(e=>{J.ZP.error(e.message||"Polling request failed")})},2e3)}catch(e){c(!1),J.ZP.error(e.message||"Failed to add vocals")}}},g=(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e.suno_add_vocals_v45_plus)||12;return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(aR,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(tR,{recordDetails:s,progress:u,generating:d}),run:()=>m(r),formData:r,outputData:i,generating:d,credit:g})}),aM=a(64842),aO=a(72860),aL=a(57571);function aB(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({taskId:"",audioId:""})},[]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))};return(0,N.jsx)("div",{className:"space-y-6 lg:w-[100%]",children:(0,N.jsxs)("div",{className:"space-y-5",children:[(0,N.jsx)(tZ,{label:"taskId",required:!0,name:"taskId",value:(null==t?void 0:t.taskId)||"",onChange:e=>r("taskId",e.target.value),placeholder:"Enter music generation task ID",description:"Unique identifier of the music generation task."}),(0,N.jsx)(tZ,{label:"audioId",required:!0,name:"audioId",value:(null==t?void 0:t.audioId)||"",onChange:e=>r("audioId",e.target.value),placeholder:"Enter audio ID",description:"Unique identifier of the specific audio track."})]})})}function aU(e){let{recordDetails:t,generating:a}=e;return t&&0!==Object.keys(t).length?"FAILED"===t.status||t.errorMessage?(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2 whitespace-pre-line py-6 text-center text-rose-600 lg:h-[80vh]",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"failed",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-1.5 px-4 text-center",children:[(0,N.jsx)("p",{className:"text-rose-600",children:"Retrieval Failed"}),t.errorMessage&&(0,N.jsx)("p",{className:"text-rose-600",children:t.errorMessage}),(0,N.jsx)("p",{className:"text-xs text-rose-500",children:"Credits will not be deducted for failed requests"})]})]}):(0,N.jsx)("div",{className:"relative m-auto flex w-full flex-col items-center justify-center lg:h-[80vh] lg:w-[100%]",children:(0,N.jsx)("div",{className:"flex w-full flex-1 flex-col items-start overflow-y-auto p-4 lg:h-full",children:(0,N.jsxs)("div",{className:"w-full space-y-6",children:[(0,N.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,N.jsx)(a
1M.w,{className:"border-none bg-blue-50/40 shadow-none dark:bg-blue-900/10",children:(0,N.jsxs)(aO.G,{className:"flex flex-row items-center gap-3.5 p-4",children:[(0,N.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-blue-100/50 text-blue-600 dark:bg-blue-800/30 dark:text-blue-400",children:(0,N.jsx)(D.JO,{icon:"lucide:target",className:"h-5 w-5"})}),(0,N.jsxs)("div",{children:[(0,N.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-wider text-blue-500/60 dark:text-blue-400/50",children:"Accuracy"}),(0,N.jsxs)("p",{className:"text-xl font-black text-blue-700 dark:text-blue-300",children:[(100*(t.hootCer||0)).toFixed(1),"%"]})]})]})}),(0,N.jsx)(aM.w,{className:"border-none bg-indigo-50/40 shadow-none dark:bg-indigo-900/10",children:(0,N.jsxs)(aO.G,{className:"flex flex-row items-center gap-3.5 p-4",children:[(0,N.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-indigo-100/50 text-indigo-600 dark:bg-indigo-800/30 dark:text-indigo-400",children:(0,N.jsx)(D.JO,{icon:"lucide:radio-tower",className:"h-5 w-5"})}),(0,N.jsxs)("div",{children:[(0,N.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-wider text-indigo-500/60 dark:text-indigo-400/50",children:"Streamed"}),(0,N.jsx)("p",{className:"text-xl font-black text-indigo-700 dark:text-indigo-300",children:t.isStreamed?"Yes":"No"})]})]})})]}),t.alignedWords&&t.alignedWords.length>0&&(0,N.jsxs)("div",{className:"rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-200 bg-gray-50/50 px-4 py-3 dark:border-gray-700 dark:bg-gray-800/50",children:[(0,N.jsx)("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Synchronized Lyrics"}),(0,N.jsxs)(aL.z,{size:"sm",variant:"flat",color:"primary",className:"h-5 px-1.5 text-[10px] font-bold",children:[t.alignedWords.length," SEGMENTS"]})]}),(0,N.jsx)(ej.o,{className:"max-h-[500px] p-0",hideScrollBar:!0,children:(0,N.jsx)("div",{className:"divide-y divide-gray-100 dark:divide-gray-700/50",children:t.alignedWords.map((e,t)=>(0,N.jsxs)("div",{className:"group flex items-start gap-4 p-4 transition-all hover:bg-gray-50/50 dark:hover:bg-gray-700/30",children:[(0,N.jsx)("div",{className:"w-12 flex-shrink-0 pt-0.5",children:(0,N.jsxs)("div",{className:"font-mono text-[11px] font-bold text-blue-500/60 transition-colors group-hover:text-blue-500",children:[e.startS.toFixed(2),"s"]})}),(0,N.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,N.jsx)("div",{className:"whitespace-pre-line break-words text-sm leading-7 text-gray-900 dark:text-gray-100",children:e.word}),(0,N.jsxs)("div",{className:"mt-1 flex items-center gap-3",children:[(0,N.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-gray-400",children:[(0,N.jsx)(D.JO,{icon:"lucide:timer",className:"h-3 w-3"}),(e.endS-e.startS).toFixed(2),"s"]}),!1===e.success&&(0,N.jsx)("span",{className:"text-[10px] font-bold text-rose-500",children:"FAILED"})]})]})]},t))})})]})]})})}):a?(0,N.jsxs)("div",{className:"flex w-full flex-col items-center lg:h-[80vh]",children:[(0,N.jsxs)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 shadow-sm dark:bg-gray-800",children:[(0,N.jsx)("span",{className:"aspect-square w-20 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsxs)("div",{className:"flex flex-1 flex-col items-start gap-2",children:[(0,N.jsx)("span",{className:"h-6 w-40 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsx)("span",{className:"h-6 w-1/2 rounded-lg bg-gray-200 dark:bg-gray-700"})]})]}),a&&(0,N.jsx)("div",{className:"flex w-full items-center justify-center py-6",children:(0,N.jsx)(tS.Z,{loading:!0,color:"#3b82f6",size:10})})]}):(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-4 p-4 lg:h-[80vh]",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"lyrics",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Retrieve synchronized lyrics with precise timestamps for music tracks. Both Task ID and Audio ID are required."})]})}var aZ=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({taskId:"",audioId:""}),[s,n]=(0,E.useState)(null),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),u=async()=>{var e,t,l;if(d)return;if(!(null===(e=r.taskId)||void 0===e?void 0:e.trim())){J.ZP.error("Please enter a Task ID");return}if(!(null===(t=r.audioId)||void 0===t?void 0:t.trim())){J.ZP.error("Please enter an Audio ID");return}let s=null===(l=a.user)||void 0===l?void 0:l.apiKey;if(!s){J.ZP.error("Please login and set your API key");return}c(!0),n(null),o({});try{let e=await fetch("".concat("https://api.kie.ai","/api/v1/generate/get-timestamped-lyrics"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(s)},body:JSON.stringify({taskId:r.taskId.trim(),audioId:r.audioId.trim()})}
1),t=await e.json();if(o(t||{}),!e.ok||(null==t?void 0:t.code)!==200)throw Error((null==t?void 0:t.msg)||"Failed to retrieve lyrics");n(t.data),J.ZP.success("Lyrics retrieved successfully")}catch(e){n({status:"FAILED",errorMessage:e.message||"An error occurred"}),J.ZP.error(e.message||"An error occurred")}finally{c(!1)}},p=(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e.suno_get_lyrics)||.5;return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(aB,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(aU,{recordDetails:s,generating:d}),run:u,formData:r,outputData:i,generating:d,credit:p})});function az(e){var t,a;let{recordDetails:r,generating:l}=e;if(["CREATE_TASK_FAILED","GENERATE_COVER_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(null==r?void 0:r.status))return(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 whitespace-pre-line py-6 text-center text-rose-600 lg:h-[60vh]",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"failed",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-1.5 px-4 text-center",children:[(0,N.jsx)("p",{className:"text-rose-600",children:"Generation Failed"}),r.errorMessage&&(0,N.jsx)("p",{className:"text-rose-600",children:r.errorMessage}),(0,N.jsx)("p",{className:"text-xs text-rose-500",children:"Credits will not be deducted for failed generations"})]})]});if(!r||0===Object.keys(r).length||!r.status)return l?(0,N.jsxs)("div",{className:"flex w-full flex-col items-center lg:h-[60vh]",children:[(0,N.jsxs)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 shadow-sm dark:bg-gray-800",children:[(0,N.jsx)("span",{className:"aspect-square w-20 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsxs)("div",{className:"flex flex-1 flex-col items-start gap-2",children:[(0,N.jsx)("span",{className:"h-6 w-40 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsx)("span",{className:"h-6 w-1/2 rounded-lg bg-gray-200 dark:bg-gray-700"})]})]}),l&&(0,N.jsx)("div",{className:"flex w-full items-center justify-center py-6",children:(0,N.jsx)("div",{className:"flex h-8 w-8 animate-spin rounded-full border-b-2 border-blue-500"})})]}):(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4 lg:h-[60vh]",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"cover",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Generate personalized cover images for your music!"})]});let s=(null===(t=r.response)||void 0===t?void 0:t.sunoData)||(null===(a=r.completeData)||void 0===a?void 0:a.data)||[];return s.length>0?(0,N.jsx)("div",{className:"flex w-full flex-col items-start rounded-xl p-3 shadow-sm lg:h-[60vh]",children:(0,N.jsx)("div",{className:"grid w-full grid-cols-1 gap-4 md:grid-cols-2",children:s.map((e,t)=>(0,N.jsxs)("div",{className:"flex flex-col items-center gap-3 rounded-lg bg-gray-50 p-4 dark:bg-gray-800",children:[(0,N.jsx)("div",{className:"relative aspect-square w-full max-w-sm overflow-hidden rounded-lg",children:e.imageUrl?(0,N.jsx)("img",{src:e.imageUrl,alt:"Cover ".concat(t+1),className:"h-full w-full object-cover"}):(0,N.jsx)("div",{className:"h-full w-full rounded-lg bg-gray-200 dark:bg-gray-700"})}),(0,N.jsxs)("div",{className:"flex flex-col items-center gap-1 text-center",children:[(0,N.jsx)("p",{className:"font-medium text-gray-900 dark:text-white",children:e.title||"Cover Image ".concat(t+1)}),e.tags&&(0,N.jsx)("p",{className:"rounded-full border border-blue-500 px-2 py-0.5 text-xs text-blue-500",children:e.tags}),e.imageUrl&&(0,N.jsx)("a",{href:e.imageUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-500 underline hover:text-blue-600",children:"View Full Size"})]})]},e.id||t))})}):(0,N.jsx)("div",{className:"flex w-full flex-col items-start rounded-xl p-3 shadow-sm lg:h-[60vh]",children:(0,N.jsxs)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 dark:bg-gray-800",children:[(0,N.jsx)("span",{className:"aspect-square w-20 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsxs)("div",{className:"flex flex-1 flex-col items-start gap-2",children:[(0,N.jsx)("span",{className:"h-6 w-40 rounded-lg bg-gray-200 dark:bg-gray-700"}
1),(0,N.jsx)("span",{className:"h-6 w-1/2 rounded-lg bg-gray-200 dark:bg-gray-700"})]})]})})}function aq(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({taskId:"",callBackUrl:"playground"})},[]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))},l=(e,t)=>{a(a=>({...a||{},[e]:t}))};return(0,N.jsx)("div",{className:"space-y-6",children:(0,N.jsx)(tZ,{label:"taskId",required:!0,name:"taskId",value:(null==t?void 0:t.taskId)||"",onChange:e=>l("taskId",e.target.value),onBlur:e=>r("taskId",e.target.value),placeholder:"Enter music generation task ID",description:"Task ID from a completed music generation task"})})}var aK=(0,Y.Pi)(()=>{let{userStore:e}=(0,_.o)(),[t,a]=(0,E.useState)({}),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)(!1),[d,c]=(0,E.useState)(null),u=async t=>{if(!i){l(null),n({}),o(!0);try{var a;if(!t.taskId)throw Error("Please enter task ID");let r=null===(a=e.user)||void 0===a?void 0:a.apiKey;if(!r)throw Error("Please login and set your API key");let s={taskId:t.taskId,callBackUrl:t.callBackUrl||"playground"},i=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/suno/cover/generate"),method:"post",data:s,headers:{Authorization:"Bearer ".concat(r)}});if(n(i.data||{}),200!==i.data.code)throw Error(i.data.msg||"Failed to create cover generation task");let d=i.data.data.taskId;if(!d)throw Error("Failed to get task ID from response");let u=0,p=setInterval(()=>{let e=Math.max(1,Math.min(Math.floor(u++/30*100),99));c(e),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/suno/cover/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(r)},params:{taskId:d}}).then(e=>{var t,a,r;if(n(e.data||{}),200!==e.data.code)throw Error(e.data.msg||"Polling request failed");let s=e.data.data,i=s.data||s;if(200===e.data.code&&(null===(t=e.data.data)||void 0===t?void 0:t.successFlag)===1&&(null===(r=e.data.data)||void 0===r?void 0:null===(a=r.response)||void 0===a?void 0:a.images)&&Array.isArray(e.data.data.response.images)){let t=e.data.data.response.images.map((e,t)=>({id:"cover-".concat(t+1),imageUrl:e,title:"Cover Image ".concat(t+1),tags:"Generated Cover"}));l({status:"SUCCESS",response:{sunoData:t},completeData:{data:t}}),o(!1),c(null),clearInterval(p),J.ZP.success("Cover generated successfully");return}if(501===e.data.code){let t={status:"GENERATE_COVER_FAILED",errorMessage:e.data.msg||"Cover generation failed"};l(t),o(!1),c(null),clearInterval(p),J.ZP.error(e.data.msg||"Cover generation failed");return}l(i),"SUCCESS"===i.status?(o(!1),c(null),clearInterval(p),J.ZP.success("Cover generated successfully")):["CREATE_TASK_FAILED","GENERATE_COVER_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(i.status)&&(o(!1),c(null),clearInterval(p),J.ZP.error(i.errorMessage||"Cover generation failed"))}).catch(()=>{})},2e3)}catch(e){o(!1),J.ZP.error(e.message||"Failed to create cover generation task")}}};return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(aq,{formData:t,setFormData:a}),OutputPanelContent:(0,N.jsx)(az,{recordDetails:r,progress:d,generating:i}),run:()=>u(t),formData:t,outputData:s,generating:i,credit:0})}),aG=function(e){let{startLabel:t,endLabel:a,startName:r,endName:l,startValue:s,endValue:n,onStartChange:i,onEndChange:o,onStartBlur:d,onEndBlur:c,startPlaceholder:u="",endPlaceholder:p="",startDescription:m="",endDescription:g="",required:h=!1,min:x,max:f,step:y=.01,minRange:v,maxRange:b,className:w=""}=e,j=null!=s&&null!=n,k=j?n-s:null,E=j&&s>=n,C=void 0!==v&&!E&&null!==k&&k<v,I=void 0!==b&&!E&&null!==k&&k>b,S=e=>(0,N.jsxs)(N.Fragment,{children:[E&&(0,N.jsx)("p",{className:"mt-1 text-xs text-red-500",children:e}),C&&(0,N.jsxs)("p",{className:"mt-1 text-xs text-red-500",children:["Range cannot be less than ",v]}),I&&(0,N.jsxs)("p",{className:"mt-1 text-xs text-red-500",children:["Range cannot be greater than ",b]})]});return(0,N.jsxs)("div",{className:"grid grid-cols-2 gap-4 ".concat(w),children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:[t,h&&(0,N.jsx)("span",{className:"text-red-500",children:" *"})]}),(0,N.jsx)("input",{type:"number",name:r,step:y,min:void 0!==x?x:void 0,max:void 0!==f?f:void 0,value:null!=s?s:"",onCh
1ange:e=>{let t=parseFloat(e.target.value)||0;i&&i(t)},onBlur:e=>{let t=parseFloat(e.target.value)||0;d&&d(t)},placeholder:u,className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),m&&(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:m})}),S("Start value must be less than end value")]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:[a,h&&(0,N.jsx)("span",{className:"text-red-500",children:" *"})]}),(0,N.jsx)("input",{type:"number",name:l,step:y,min:void 0!==x?x:void 0,max:void 0!==f?f:void 0,value:null!=n?n:"",onChange:e=>{let t=parseFloat(e.target.value)||0;o&&o(t)},onBlur:e=>{let t=parseFloat(e.target.value)||0;c&&c(t)},placeholder:p,className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),g&&(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g})}),S("End value must be greater than start value")]})]})};function aW(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({taskId:"",audioId:"",name:"",description:"",vocalStart:0,vocalEnd:20,style:""})},[]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))},l=(e,t)=>{a(a=>({...a||{},[e]:t}))};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["taskId ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.taskId)||"",onChange:e=>l("taskId",e.target.value),onBlur:e=>r("taskId",e.target.value),placeholder:"Enter music generation task ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Task ID from music generation (generate, extend, cover, upload-extend)"})})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["audioId ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.audioId)||"",onChange:e=>l("audioId",e.target.value),onBlur:e=>r("audioId",e.target.value),placeholder:"Enter audio ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Audio ID from the completed music generation task"})})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["name ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.name)||"",onChange:e=>l("name",e.target.value),onBlur:e=>r("name",e.target.value),placeholder:"Electronic Pop Singer",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Name for the Persona"})})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["description ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("textarea",{value:(null==t?void 0:t.description)||"",onChange:e=>l("description",e.target.value),onBlur:e=>r("description",e.target.value),placeholder:"A modern electronic music style pop singer, skilled in dynamic rhythms and synthesizer tones",rows:3,className:"w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Detailed description of the Persona's musical characteristics"})})]}),(0,N.jsx)(aG,{startLabel:"vocalStart",endLabel:"vocalEnd",startName:"vocalStart",endName:"vocalEnd",startValue:null==t?void 0:t.vocalStart,endValue:null==t?void 0:t.vocalEnd,onStartChange:e=>l("vocalStart",e),onEndChange:e=>l("vocalEnd",e),onStartBlur:e=>r("vocalStart",e),onEndBlur:e=>r("vocalEnd",e),startPlaceholder:"10",endPlaceholder:"20",startDescription:"Start time (seconds)",endDescription:"End time (seconds)",required:!0,min:0,step:.
101,minRange:10,maxRange:30}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"style"}),(0,N.jsx)(tB,{value:(null==t?void 0:t.style)||"",onChange:e=>l("style",e.target.value),onBlur:e=>r("style",e.target.value),rows:3,maxLength:200,placeholder:"Enter style description (optional)"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Style description for the Persona (optional)"})})]})]})}function aV(e){let{outputData:t,generating:a}=e;if(!t||0===Object.keys(t).length||!t.data)return a?(0,N.jsxs)("div",{className:"flex w-full flex-col items-center",children:[(0,N.jsxs)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 shadow-sm dark:bg-gray-800",children:[(0,N.jsx)("span",{className:"aspect-square w-20 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsxs)("div",{className:"flex flex-1 flex-col items-start gap-2",children:[(0,N.jsx)("span",{className:"h-6 w-40 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsx)("span",{className:"h-6 w-1/2 rounded-lg bg-gray-200 dark:bg-gray-700"})]})]}),a&&(0,N.jsx)("div",{className:"flex w-full items-center justify-center py-6",children:(0,N.jsx)("div",{className:"flex h-8 w-8 animate-spin rounded-full border-b-2 border-blue-500"})})]}):(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"persona",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Create personalized music Personas for your generated music!"})]});if(t&&"number"==typeof t.code&&200!==t.code)return(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 whitespace-pre-line py-6 text-center text-rose-600",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"failed",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-1.5 px-4 text-center",children:[(0,N.jsx)("p",{className:"text-rose-600",children:"Generation Failed"}),t.msg&&(0,N.jsx)("p",{className:"text-rose-600",children:t.msg}),(0,N.jsx)("p",{className:"text-xs text-rose-500",children:"Credits will not be deducted for failed generations"})]})]});let r=t.data;return(0,N.jsx)("div",{className:"flex w-full flex-col items-start rounded-xl p-3 shadow-sm",children:(0,N.jsxs)("div",{className:"w-full rounded-lg bg-gray-50 p-4 dark:bg-gray-800",children:[(0,N.jsx)("h3",{className:"mb-3 text-lg font-semibold text-gray-900 dark:text-white",children:"Persona Created Successfully"}),(0,N.jsxs)("div",{className:"space-y-3",children:[(0,N.jsxs)("div",{children:[(0,N.jsx)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Persona ID:"}),(0,N.jsx)("p",{className:"mt-1 rounded bg-gray-100 p-2 font-mono text-sm text-gray-900 dark:bg-gray-700 dark:text-white",children:r.personaId})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Name:"}),(0,N.jsx)("p",{className:"mt-1 rounded bg-gray-100 p-2 text-sm text-gray-900 dark:bg-gray-700 dark:text-white",children:r.name})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Description:"}),(0,N.jsx)("p",{className:"mt-1 rounded bg-gray-100 p-2 text-sm text-gray-900 dark:bg-gray-700 dark:text-white",children:r.description})]})]}),(0,N.jsx)("div",{className:"mt-4 rounded bg-blue-50 p-3 dark:bg-blue-900/20",children:(0,N.jsxs)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:[(0,N.jsx)("strong",{children:"Note:"})," This personaId can be used in subsequent music generation requests to create music with similar style characteristics."]})})]})})}var aH=(0,Y.Pi)(()=>{let{userStore:e}=(0,_.o)(),[t,a]=(0,E.useState)({}),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)(!1),i=async t=>{if(!s){n(!0),l({});try{var a;if(!t.taskId)throw Error("Please enter task ID");if(!t.audioId)throw Error("Please enter audio ID");if(!t.name||""===t.name.trim())throw Error("Please enter persona name");if(!t.description||""===t.description.trim())throw Error("Please enter persona description");if(void 0===t.vocalStart||null===t.vocalStart)throw Error("Please specify start time");if(void 0===t.vocalEnd||null===t.vocalEnd)throw Error("Please specify end time");if(t.vocalStart>=t.vocalEnd)throw Error("Start time must be less than end time");let r=t.vocalEnd-t.vocalStart;if(r<10||r>30)throw Error("Time range must be between 10 and 30 seconds");let s=null===(a=e.user)||void 0===a?void 0:a.apiKey;if(!s)throw Error("Please login and set your API key");let i={taskId:t.taskId,audioId:t.audioId,name:t.name.trim(),description:t.description.trim(),vocalStart:t.vocalStart,vocalEnd:t.vocalEnd};t.style&&""!==t.style.trim()&&(i.style=t.style.trim());let o=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/generate-persona"),method:"post",data:i,headers:{Authorization:"Bearer ".concat(s)}});if(l(o.data||{}),200!==o.data.code)throw Error(o.data.msg||"Failed to create persona");n(!1),J.ZP.success("Persona created successfully")}catch(e){l({code:500,msg:e.message||"Failed to create persona"}),n(!1),J.ZP.error(e.message||"Failed to create persona")}}};return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(aW,{formData:t,setFormData:a}),OutputPanelContent:(0,N.jsx)(aV,{outputData:r,generating:s}),run:()=>i(t),formData:t,outputData:r,generating:s,credit:0})}),aJ=a(90034);let a$={createTask:"/api/v1/voice/validate",getValidateInfo:"/api/v1/voice/validate-info",submitValidation:"/api/v1/voice/generate",getResult:"/api/v1/voice/record-info",checkAvailability:"/api/v1/voice/check-voice",regenerate:"/api/v1/voice/regenerate"},aY={idle:{label:"Not Started",tone:"slate",description:"Start by creating a voice generation task from the source audio."},wait_processing:{label:"Waiting For Validate Text",tone:"amber",description:"The backend is preparing the validation sentence for this task."},processing_validate:{label:"Generating Validate Text",tone:"amber",description:"Validation text is still being prepared. Refresh again in a moment."},processing_validate_fail:{label:"Validate Text Failed",tone:"rose",description:"The backend failed while generating the validation sentence."},wait_validating:{label:"Waiting For Verification",tone:"blue",description:"Upload or record the verification audio, then wait for validation."},success:{label:"Voice Ready",tone:"emerald",description:"The voice has been generated successfully."},fail:{label:"Voice Generation Failed",tone:"rose",description:"The backend finished with an error. Review the message and retry."}},aX=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;
1codecs=opus"],aQ=e=>aY[e]||aY.idle,a0=e=>{let t=Number(e)||0;return"".concat(Math.floor(t/60),":").concat((t%60).toString().padStart(2,"0"))},a1=e=>e?e.includes("mp4")?"m4a":e.includes("ogg")?"ogg":"webm":"webm";function a2(e){let{title:t,subtitle:a,children:r}=e;return(0,N.jsxs)("section",{className:"rounded-xl border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsxs)("div",{className:"mb-4",children:[(0,N.jsx)("h3",{className:"text-base font-semibold text-gray-900 dark:text-white",children:t}),a&&(0,N.jsx)("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:a})]}),(0,N.jsx)("div",{className:"space-y-4",children:r})]})}function a5(e){let{label:t,required:a=!1}=e;return(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:[t,a&&(0,N.jsx)("span",{className:"text-red-500",children:" *"})]})}function a4(e){let{label:t,value:a,placeholder:r,onChange:l,onCopy:s,readOnly:n=!1}=e;return(0,N.jsxs)("div",{children:[(0,N.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,N.jsx)(a5,{label:t}),a&&(0,N.jsx)("button",{type:"button",onClick:s,className:"text-xs font-medium text-blue-600 transition hover:text-blue-500 dark:text-blue-300",children:"Copy"})]}),(0,N.jsx)("input",{type:"text",value:a||"",onChange:l,readOnly:n,placeholder:r,className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 font-mono text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]})}function a3(e){let{children:t,onClick:a,loading:r=!1,disabled:l=!1,tone:s="primary",icon:n,fullWidth:i=!1}=e;return(0,N.jsxs)("button",{type:"button",onClick:a,disabled:l||r,className:"inline-flex h-10 items-center justify-center gap-2 rounded-lg px-4 text-sm font-medium transition ".concat(i?"w-full":""," ").concat("secondary"===s?"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 dark:hover:bg-gray-600":"bg-blue-500 text-white hover:bg-blue-400"," ").concat(l||r?"cursor-not-allowed opacity-60":""),children:[r?(0,N.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):n&&(0,N.jsx)(D.JO,{icon:n,className:"h-4 w-4"}),(0,N.jsx)("span",{children:t})]})}function a6(e){let{data:t}=e;return(0,N.jsx)("pre",{className:"max-h-[70vh] overflow-auto rounded-xl bg-gray-50 p-4 text-xs leading-6 text-gray-800 dark:bg-gray-900 dark:text-gray-100",children:JSON.stringify(t||{},null,2)})}let a7=Array.from({length:96},(e,t)=>.1+(t>=62&&t<=72?.035+.012*Math.sin(1.6*t):0));function a9(e,t,a){return Math.min(Math.max(e,t),a)}function a8(e){let t=Math.max(0,Number(e)||0),a=Math.floor(t/60);return"".concat(String(a).padStart(2,"0"),":").concat((t-60*a).toFixed(1).padStart(4,"0"))}function re(e){let t=Number(e)||0;if(t>=60&&Number.isInteger(t/60))return"".concat(t/60,"m");if(t>=60){let e=Math.floor(t/60);return"".concat(e,":").concat(String(Math.round(t-60*e)).padStart(2,"0"))}return"".concat(Number.isInteger(t)?t:t.toFixed(1),"s")}let rt=E.memo(function(e){let{peaks:t,height:a=136,minBarHeight:r=16,maxBarScale:l=82,containerClassName:s="",barClassName:n="bg-[#687385]",barWidthClassName:i="w-[3px]",gapClassName:o="gap-[4px]"}=e;return(0,N.jsx)("div",{className:"flex items-center overflow-hidden ".concat(o," ").concat(s),style:{height:"".concat(a,"px")},children:t.map((e,t)=>(0,N.jsx)("span",{className:"".concat(i," shrink-0 rounded-full ").concat(n),style:{height:"".concat(Math.max(r,e*l),"%"),opacity:.92}},t))})});function ra(e){let{peaks:t,isRecording:a}=e,r=(null==t?void 0:t.length)?t:a7;return a?(0,N.jsx)("div",{className:"flex h-[108px] w-full items-center justify-center overflow-hidden",children:(0,N.jsx)(rt,{peaks:r,height:92,minBarHeight:a?8:12,maxBarScale:a?82:24,containerClassName:"w-full justify-center",barClassName:a?"bg-[#8a95a7]":"bg-white/28",barWidthClassName:"w-[4px]",gapClassName:"gap-[3px]"})}):(0,N.jsx)("div",{className:"flex h-[108px] w-full items-center justify-center overflow-hidden",children:(0,N.jsx)(rt,{peaks:a7,height:92,minBarHeight:7,maxBarScale:42,containerClassName:"w-[76%] justify-center",barClassName:"bg-[#8a95a7]",barWidthClassName:"w-[4px]",gapClassName:"gap-[4px]"})})}function rr(e){let{duration:t,peaks:a,start:r,end:l,onStartChange:s,onEndChange:n,currentTime:i=0,playheadControlRef:o,onSeek:d,isLoading:c=!1,minSelectionDuration:u=3,maxSelectionDuration:p=30}=e,m=(0,E.useRef)(null),g=(0,E.useRef)(null),h=(0,E.useRef)(0),x=(0,E.useRef)(i),f=(0,E.useRef)(null),y=(0,E.useRef)({mode:null,pointerId:null,startX:0,anchorTime:0,startTime:0,endTime:0,didMove:!1,justFinishedDragging:!1}),v=Number(t)||0,b=v>0?r/v*100:0,w=v>0?l/v*100:0,j=Math.max(0,l-r),k=()=>{var e;return(null===(e=m.current)||void 0===e?void 0:e.offsetWidth)||1},C=e=>e/k()*v,I=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x.current;if(x.current=a9(t,0,v),!g.current||!v)return;let a=h.current||(null===(e=m.current)||void 0===e?void 0:e.offsetWidth)||k(),r=x.current/v*a;g.current.style.transform="translate3d(".concat(r,"px, 0, 0)")},S=(e,t)=>{s(Number(e.toFixed(1))),n(Number(t.toFixed(1)))},A=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!v)return;let r=a9(e,0,v),l=a9(t,0,v);if(l<r&&([r,l]=[l,r],a="start"===a?"end":"start"),l-r<u&&("start"===a?r=Math.max(0,l-u):l=Math.min(v,r+u)),l-r>p&&("start"===a?r=Math.max(0,l-p):l=Math.min(v,r+p)),l>v){let e=l-v;l=v,r=Math.max(0,r-e)}if(r<0){let e=Math.abs(r);r=0,l=Math.min(v,l+e)}S(r,l)},P=e=>t=>{if(!v||!m.current)return;let a=m.current.getBoundingClientRect(),s=a9(t.clientX-a.left,0,a.width);t.preventDefault(),t.stopPropagation(),y.current.mode=e,y.current.pointerId=t.pointerId,y.current.startX=s,y.current.startTime=r,y.current.endTime=l,y.current.didMove=!1};return(0,E.useEffect)(()=>{let e=e=>{if(!m.current||!v||c||!y.current.mode||null!==y.current.pointerId&&e.pointerId!==y.current.pointerId)return;let t=m.current.getBoundingClientRect(),a=a9(e.clientX-t.left,0,t.width),r=a9(C(a),0,v),l=Math.abs(a-y.current.startX);if("pending-create"===y.current.mode){if(l<6)return;e.preventDefault(),y.current.didMove=!0,y.current.mode="create";let t=y.current.anchorTime;A(Math.min(t,r),Math.max(t,r),r>=t?"end":"start");return}if(l>=6&&(y.current.didMove=!0),"create"===y.current.mode){e.preventDefault();let t=y.current.anchorTime;A(Math.min(t,r),Math.max(t,r),r>=t?"end":"start");return}if("resize-left"===y.current.mode){e.preventDefault(),A(r,y.current.endTime,"start");return}if("resize-right"===y.current.mode){e.preventDefault(),A(y.current.startTime,r,"end");return}if("move"===y.current.mode){e.preventDefault();
1let t=(a-y.current.startX)/k()*Math.max(v,1),r=y.current.endTime-y.current.startTime,l=y.current.startTime+t,s=y.current.endTime+t;l<0&&(s-=l,l=0),s>v&&(l-=s-v,s=v),s-l!==r&&(s=Math.min(v,l+r)),S(l,s);return}},t=()=>{y.current.didMove&&(y.current.justFinishedDragging=!0,f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{y.current.justFinishedDragging=!1},0)),y.current.mode=null,y.current.pointerId=null,y.current.didMove=!1};return window.addEventListener("pointermove",e,{passive:!1}),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t),f.current&&clearTimeout(f.current)}},[t,l,c,p,u,d,n,s,v,r]),(0,E.useEffect)(()=>{if(!m.current)return;let e=()=>{var e;h.current=(null===(e=m.current)||void 0===e?void 0:e.offsetWidth)||0,I()};if(e(),"undefined"==typeof ResizeObserver)return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e);let t=new ResizeObserver(e);return t.observe(m.current),()=>t.disconnect()},[v]),(0,E.useEffect)(()=>{I(i)},[i,v]),(0,E.useEffect)(()=>{if(o)return o.current={setTime:I},()=>{var e;(null===(e=o.current)||void 0===e?void 0:e.setTime)===I&&(o.current=null)}},[o,v]),(0,N.jsxs)("div",{className:"space-y-1.5",children:[(0,N.jsxs)("div",{ref:m,onPointerDown:c?void 0:e=>{if(!m.current||!v||c)return;let t=m.current.getBoundingClientRect(),a=a9(e.clientX-t.left,0,t.width);y.current.pointerId=e.pointerId,y.current.startX=a,y.current.startTime=r,y.current.endTime=l,y.current.anchorTime=C(a),y.current.didMove=!1,y.current.mode="pending-create"},onClick:c?void 0:e=>{if(!m.current||!v||c||"function"!=typeof d)return;if(y.current.justFinishedDragging){e.preventDefault(),e.stopPropagation();return}let t=m.current.getBoundingClientRect(),a=a9(e.clientX-t.left,0,t.width);d(a9(C(a),0,v))},className:"voice-waveform-container relative overflow-hidden rounded-[12px] border border-white/10 bg-[#18181b] px-3",style:{touchAction:"none"},children:[c?(0,N.jsxs)("div",{className:"flex h-[136px] flex-col items-center justify-center",children:[(0,N.jsx)("span",{className:"h-8 w-8 animate-spin rounded-full border-2 border-white/15 border-t-white"}),(0,N.jsx)("p",{className:"mt-3 text-sm font-medium text-white/85",children:"Loading waveform..."})]}):(0,N.jsx)(rt,{peaks:a,height:136,minBarHeight:16,maxBarScale:82}),c?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{ref:g,className:"pointer-events-none absolute inset-y-3 z-[5] w-px bg-white/70 shadow-[0_0_10px_rgba(255,255,255,0.22)]",style:{left:0}}),(0,N.jsx)("div",{className:"bg-[#ffd84d]/16 pointer-events-none absolute inset-y-3 z-10 rounded-[10px] shadow-[0_0_0_1px_rgba(255,224,102,0.38)]",style:{left:"".concat(b,"%"),width:"".concat(Math.max(w-b,0),"%")},children:(0,N.jsx)("span",{className:"absolute inset-0 rounded-[10px] bg-[#ffe76f]/10"})}),(0,N.jsx)("button",{type:"button",onPointerDown:e=>{if(!m.current||!v||c)return;let t=m.current.getBoundingClientRect(),a=a9(e.clientX-t.left,0,t.width);e.preventDefault(),e.stopPropagation(),y.current.pointerId=e.pointerId,y.current.startX=a,y.current.startTime=r,y.current.endTime=l,y.current.didMove=!1,y.current.mode="move"},onClick:e=>e.stopPropagation(),className:"absolute inset-y-3 z-[15] cursor-move rounded-[10px] bg-transparent",style:{left:"".concat(b,"%"),width:"".concat(Math.max(w-b,0),"%"),touchAction:"none"}}),(0,N.jsx)("button",{type:"button",onPointerDown:P("resize-left"),onClick:e=>e.stopPropagation(),className:"absolute inset-y-0 z-20 w-4 -translate-x-1/2 cursor-ew-resize bg-transparent",style:{left:"".concat(b,"%"),touchAction:"none"},children:(0,N.jsx)("span",{className:"absolute inset-y-[18px] left-1/2 w-[3px] -translate-x-1/2 rounded-full bg-[#ffe04f] shadow-[0_0_14px_rgba(255,224,79,0.92)]"})}),(0,N.jsx)("button",{type:"button",onPointerDown:P("resize-right"),onClick:e=>e.stopPropagation(),className:"absolute inset-y-0 z-20 w-4 -translate-x-1/2 cursor-ew-resize bg-transparent",style:{left:"".concat(w,"%"),touchAction:"none"},children:(0,N.jsx)("span",{className:"absolute inset-y-[18px] left-1/2 w-[3px] -translate-x-1/2 roun
1ded-full bg-[#ffe04f] shadow-[0_0_14px_rgba(255,224,79,0.92)]"})})]})]}),(0,N.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 text-[12px]",children:[(0,N.jsx)("span",{className:"text-white/42",children:"From"}),(0,N.jsx)("span",{className:"text-white/88 rounded-[10px] bg-[#2b2b31] px-2.5 py-1",children:a8(r)}),(0,N.jsx)("span",{className:"text-white/35",children:"-"}),(0,N.jsx)("span",{className:"text-white/88 rounded-[10px] bg-[#2b2b31] px-2.5 py-1",children:a8(l)}),(0,N.jsxs)("span",{className:"text-[12px] font-medium text-fuchsia-300",children:[j.toFixed(1),"s selected"]})]}),(0,N.jsx)("div",{className:"text-white/36 text-[11px] leading-4",children:"Click to seek. Drag on empty waveform to redraw, or drag the selection to adjust a ".concat(re(u),"-").concat(re(p)," range.")})]})}function rl(e){let{fileInputRef:t,onFileChange:a,showRangeSelector:r}=e;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("input",{ref:t,type:"file",accept:"audio/*",onChange:a,className:"hidden"}),(0,N.jsxs)("button",{type:"button",onClick:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.click()},className:"border-white/12 flex h-[220px] w-full flex-col items-center justify-center rounded-[14px] border border-dashed bg-white/[0.03] px-6 text-center transition hover:border-white/20 hover:bg-white/[0.06]",children:[(0,N.jsx)("span",{className:"inline-flex h-12 w-12 items-center justify-center rounded-[10px] bg-white/[0.06] text-white/80",children:(0,N.jsx)(D.JO,{icon:"solar:cloud-upload-line-duotone",className:"h-7 w-7"})}),(0,N.jsx)("p",{className:"mt-4 text-base font-medium text-white",children:"Click to upload audio"}),(0,N.jsx)("p",{className:"mt-2 max-w-[420px] text-sm text-white/45",children:r?"Supports common audio formats. The waveform will load here and let you choose a range immediately.":"Supports common audio formats. Upload a clip here and continue to the next step."})]})]})}function rs(e){let{duration:t,start:a,end:r,onStartChange:l,onEndChange:s,minSelectionDuration:n,maxSelectionDuration:i}=e;return(0,N.jsxs)("div",{className:"space-y-2",children:[(0,N.jsx)("div",{className:"flex items-start justify-between gap-4",children:(0,N.jsxs)("div",{className:"min-w-0",children:[(0,N.jsx)("p",{className:"truncate text-base font-medium text-white",children:"Processing recorded audio..."}),(0,N.jsx)("p",{className:"mt-1 text-sm text-white/40",children:"Preparing waveform"})]})}),(0,N.jsx)(rr,{duration:t,peaks:[],start:a,end:r,onStartChange:l,onEndChange:s,minSelectionDuration:n,maxSelectionDuration:i,isLoading:!0})]})}function rn(e){let{isRecording:t,isStoppingRecording:a,recordingSeconds:r,requestPermissionLoading:l,liveRecordingPeaks:s,onToggleRecording:n,recordAction:i}=e,o=(0,E.useRef)(!1);return(0,N.jsxs)("div",{className:"flex min-h-[260px] flex-col items-center justify-center",children:[(0,N.jsx)(ra,{peaks:s,isRecording:t}),(0,N.jsx)("div",{className:"text-white/34 mt-3 min-h-[18px] text-center text-[11px] font-medium uppercase tracking-[0.12em]",children:l?"Requesting microphone access...":a?"Processing recording...":t?"Recording ".concat(a0(r)):"\xa0"}),(0,N.jsxs)("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[(0,N.jsx)("button",{type:"button",onPointerDown:e=>{!t||l||a||(o.current=!0,e.preventDefault(),e.stopPropagation(),null==n||n())},onClick:e=>{if(o.current){o.current=!1,e.preventDefault(),e.stopPropagation();return}null==n||n()},disabled:l||a,className:"inline-flex h-16 w-16 items-center justify-center rounded-[12px] text-white transition ".concat(t?"bg-orange-500 shadow-[0_0_0_8px_rgba(249,115,22,0.22)] hover:bg-orange-400":"bg-[#ff6a18] shadow-[0_0_0_8px_rgba(255,106,24,0.16)] hover:bg-[#ff7c36]"," disabled:cursor-not-allowed disabled:opacity-55"),children:a?(0,N.jsx)("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-white/30 border-t-white"}):(0,N.jsx)(D.JO,{icon:t?"solar:pause-bold":"solar:microphone-3-bold",className:"h-7 w-7"})}),i]})]})}function ri(e){let{file:t,previewUrl:a,metadataLoading:r,duration:l,showRangeSelector:s,start:n,end:i,onStartChange:o,onEndChange:d,onRemoveFile:c,minSelectionDuration:u=3,maxSelectionDuration:p=30}=e,m=(0,E.useRef)(null),g=(0,E.useRef)(null),h=(0,E.useRef)(null),[x,f]=(0,E.useState)(0),[y,v]=(0,E.useState)(!1),{peaks:b,loading:w,error:j}=function(e){let{file:t,previewUrl:a,enabled:r=!0,count:l=180}
1=e,[s,n]=(0,E.useState)([]),[i,o]=(0,E.useState)(!1),[d,c]=(0,E.useState)(!1);return(0,E.useEffect)(()=>{if(!r||!t&&!a){n([]),o(!1),c(!1);return}let e=window.AudioContext||window.webkitAudioContext;if(!e){n([]),o(!1),c(!0);return}let s=!1,i=null,d=null;return(e=>{if("function"==typeof window.requestIdleCallback){d=window.requestIdleCallback(e,{timeout:900});return}d=window.setTimeout(e,120)})(async()=>{o(!0),c(!1);try{let r=t?await t.arrayBuffer():await fetch(a).then(e=>{if(!e.ok)throw Error("Failed to load audio preview");return e.arrayBuffer()});if(s)return;i=new e;let o=await i.decodeAudioData(r.slice(0));if(s)return;n(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:180,a=(null==e?void 0:e.numberOfChannels)||0,r=(null==e?void 0:e.length)||0,l=Math.max(12,Math.min(t,r||t));if(!a||!r)return Array.from({length:l},()=>.08);let s=Array.from({length:a},(t,a)=>e.getChannelData(a)),n=Math.max(1,Math.floor(r/l)),i=[];for(let e=0;e<l;e+=1){let t=e*n,o=e===l-1?r:Math.min(r,t+n),d=0,c=0,u=0;for(let e=t;e<o;e+=1){let t=0;for(let r=0;r<a;r+=1){let a=Math.abs(s[r][e]||0);a>t&&(t=a)}t>d&&(d=t),c+=t*t,u+=1}let p=u?Math.sqrt(c/u):0;i.push(Math.max(.75*d,1.45*p))}let o=Math.max(...i,0);return o<=0?Array.from({length:l},()=>.08):i.map(e=>a9(Math.pow(e/o,.72),.08,1))}(o,l))}catch(e){s||(n([]),c(!0))}finally{i&&"closed"!==i.state&&i.close().catch(()=>{}),s||o(!1)}}),()=>{s=!0,d&&("function"==typeof window.cancelIdleCallback?window.cancelIdleCallback(d):window.clearTimeout(d)),i&&"closed"!==i.state&&i.close().catch(()=>{})}},[l,r,t,a]),{peaks:s,loading:i,error:d}}({file:t,previewUrl:a,enabled:!!(t||a)});(0,E.useEffect)(()=>{let e=m.current;if(!e)return;let t=()=>{g.current&&(window.cancelAnimationFrame(g.current),g.current=null)},a=()=>{var t;null===(t=h.current)||void 0===t||t.setTime(e.currentTime||0),e.paused||e.ended||(g.current=window.requestAnimationFrame(a))},r=()=>{var r;t(),null===(r=h.current)||void 0===r||r.setTime(e.currentTime||0),g.current=window.requestAnimationFrame(a)},l=()=>{var t;let a=e.currentTime||0;f(a),null===(t=h.current)||void 0===t||t.setTime(a)},s=()=>{(e.paused||e.ended)&&f(e.currentTime||0)},n=()=>{v(!0),r()},i=()=>{var a;v(!1),t();let r=e.currentTime||0;f(r),null===(a=h.current)||void 0===a||a.setTime(r)},o=()=>{var a;v(!1),t();let r=e.currentTime||0;f(r),null===(a=h.current)||void 0===a||a.setTime(r)};return e.addEventListener("loadedmetadata",l),e.addEventListener("timeupdate",s),e.addEventListener("play",n),e.addEventListener("pause",i),e.addEventListener("ended",o),()=>{e.removeEventListener("loadedmetadata",l),e.removeEventListener("timeupdate",s),e.removeEventListener("play",n),e.removeEventListener("pause",i),e.removeEventListener("ended",o),t(),e.pause()}},[a]),(0,E.useEffect)(()=>{var e;f(0),null===(e=h.current)||void 0===e||e.setTime(0),v(!1)},[a]);let k=e=>{var t;let a=m.current;if(!a)return;let r=a9(e,0,l||a.duration||0);a.currentTime=r,f(r),null===(t=h.current)||void 0===t||t.setTime(r)},C=async()=>{let e=m.current;if(!e)return;if(y){e.pause();return}let t=l||e.duration||0;if(t>0&&e.currentTime>=t-.05){var a;e.currentTime=0,f(0),null===(a=h.current)||void 0===a||a.setTime(0)}try{await e.play()}catch(e){}};return(0,N.jsxs)("div",{className:"space-y-2",children:[(0,N.jsx)("audio",{ref:m,src:a,preload:"metadata",className:"hidden"}),(0,N.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,N.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,N.jsx)("button",{type:"button",onClick:C,className:"text-white/82 inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/[0.04] transition hover:bg-white/[0.08] hover:text-white","aria-label":y?"Pause audio":"Play audio",children:(0,N.jsx)(D.JO,{icon:y?"solar:pause-bold":"solar:play-bold",className:"h-5 w-5 ".concat(y?"":"translate-x-[1px]")})}),(0,N.jsxs)("div",{className:"min-w-0",children:[(0,N.jsx)("p",{className:"truncate text-base font-medium text-white",children:(null==t?void 0:t.name)||"Selected audio"}),(null==t?void 0:t.size)?(0,N.jsxs)("p",{className:"mt-1 text-sm text-white/40",children:[(t.size/1024/1024).toFixed(2)," MB"]}):null]})]}),(0,N.jsx)("button",{type:"button",onClick:c,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-[10px] text-white/55 transition hover:bg-white/10 hover:text-white",children:(0,N.jsx)(D.JO,{icon:"solar:close-circle-line-duotone",className:"h-5 w-5"})})]}),s&&(r||w)?(0,N.jsx)(rr,{duration:l,peaks:b,start:n,end:i,onStartChange:o,onEndChange:d,currentTime:x,playheadControlRef:h,onSeek:k,minSelectionDuration:u,maxSelectionDuration:p,isLoading:!0}):j?(0,N.jsx)("div",{className:"rounded-[12px] border border-rose-400/25 bg-rose-500/10 px-5 py-6 text-sm text-rose-100",children:"Unable to parse this audio waveform. Please upload or record the clip again."}):s?l>0?(0,N.jsx)(rr,{duration:l,peaks:b,start:n,end:i,onStartChange:o,onEndChange:d,currentTime:x,playheadControlRef:h,onSeek:k,minSelectionDuration:u,maxSelectionDuration:p}):(0,N.jsx)("div",{className:"rounded-[12px] border border-rose-400/25 bg-rose-500/10 px-5 py-6 text-sm text-rose-100",children:"Unable to read the audio duration. Please upload or record the clip again."}):(0,N.jsxs)("div",{className:"rounded-[12px] border border-white/10 bg-[#18181b] px-4 py-4",children:[(0,N.jsx)(rt,{peaks:b,height:124,minBarHeight:14,maxBarScale:78}),(0,N.jsx)("p",{className:"mt-4 text-sm text-white/50",children:"The audio stays in this card so you can continue whenever you're ready."})]})]})}var ro=function(e){let{type:t,fileInputRef:a,file:r,previewUrl:l,metadataLoading:s=!1,duration:n=0,start:i=0,end:o=3,onStartChange:d,onEndChange:c,onFileChange:u,onRemoveFile:p,requestPermissionLoading:m=!1,isRecording:g=!1,isStoppingRecording:h=!1,recordingSeconds:x=0,liveRecordingPeaks:f=[],onToggleRecording:y,recordAction:v,showRangeSelector:b=!1,minSelectionDuration:w=3,maxSelectionDuration:j=30,className:k=""}=e,E=!!(r||l),C=!E&&s&&b;return(0,N.jsx)("div",{className:"mt-6 rounded-[14px] border border-white/10 bg-white/[0.04] p-4 ".concat(k),children:C?(0,N.jsx)(rs,{duration:n,start:i,end:o,onStartChange:d,onEndChange:c,minSelectionDuration:w,maxSelectionDuration:j}):E?(0,N.jsx)(ri,{file:r,previewUrl:l,metadataLoading:s,duration:n,showRangeSelector:b,start:i,end:o,onStartChange:d,onEndChange:c,onRemoveFile:p,minSelectionDuration:w,maxSelectionDuration:j}):"record"===t?(0,N.jsx)(rn,{isRecording:g,isStoppingRecording:h,recordingSeconds:x,requestPermissionLoading:m,liveRecordingPeaks:f,onToggleRecording:y,recordAction:v}):(0,N.jsx)(rl,{fileInputRef:a,onFileChange:u,showRangeSelector:b})})};let rd={RETRY_TASK:"retry_task",SOURCE_CHOICE:"source_choice",SOURCE_UPLOAD:"source_upload",SOURCE_RECORD:"source_record",WAITING_VALIDATE:"waiting_validate",VERIFY_CHOICE:"verify_choice",VERIFY_UPLOAD:"verify_upload",VERIFY_RECORD:"verify_record",READY:"ready"},rc={voiceName:"",description:"",style:"",singerSkillLevel:"beginner",language:"en",taskId:"",voiceId:"",sourceUploadUrl:"",sourceAudioName:"",vocalStart:0,vocalEnd:0,validateInfo:"",verifyUploadUrl:"",verifyAudioName:""},ru=["mp3","wav","ogg","m4a","flac","aac","webm"],rp="playground",rm=[{value:"en",label:"English"},{value:"zh",label:"Chinese"},{value:"es",label:"Spanish"},{value:"fr",label:"French"},{value:"pt",label:"Portuguese"},{value:"de",label:"German"},{value:"ja",label:"Japanese"},{value:"ko",label:"Korean"},{value:"hi",label:"Hindi"},{value:"ru",label:"Russian"}
1],rg=[{value:"beginner",label:"Beginner"},{value:"intermediate",label:"Intermediate"},{value:"advanced",label:"Advanced"},{value:"professional",label:"Professional"}],rh="inline-flex h-11 items-center justify-center rounded-full bg-white px-5 text-sm font-semibold text-gray-900 transition hover:bg-white/90 disabled:cursor-not-allowed disabled:opacity-50";function rx(){return Array.from({length:96},()=>.08)}function rf(){return new Promise(e=>{window.requestAnimationFrame(()=>window.requestAnimationFrame(e))})}function ry(e){return"string"==typeof e&&e.toLowerCase().includes("fail")}function rv(e){let t=Math.max(0,Number(e)||0);return{safeDuration:t,minSelectionDuration:10,maxSelectionDuration:240,defaultEnd:t>0?Math.min(t,10):0}}function rb(e,t,a){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"end",{safeDuration:l,minSelectionDuration:s,maxSelectionDuration:n,defaultEnd:i}=rv(a);if(!l)return{start:0,end:i};let o=Math.min(Math.max(Number(e)||0,0),l),d=Math.min(Math.max(Number(t)||0,0),l);if(d||(d=i),d<o&&([o,d]=[d,o],r="start"===r?"end":"start"),d-o<s&&("start"===r?o=Math.max(0,d-s):d=Math.min(l,o+s)),d-o>n&&("start"===r?o=Math.max(0,d-n):d=Math.min(l,o+n)),d>l){let e=d-l;d=l,o=Math.max(0,o-e)}if(o<0){let e=Math.abs(o);o=0,d=Math.min(l,d+e)}return{start:Number(o.toFixed(1)),end:Number(d.toFixed(1))}}function rw(e){let{icon:t,title:a,subtitle:r,onClick:l}=e;return(0,N.jsx)("button",{type:"button",onClick:l,className:"rounded-[24px] border border-white/10 bg-white/[0.04] p-5 text-left transition hover:border-white/20 hover:bg-white/[0.08]",children:(0,N.jsxs)("div",{className:"flex items-center gap-3",children:[(0,N.jsx)("span",{className:"inline-flex h-11 w-11 items-center justify-center rounded-full bg-white/5 text-white",children:(0,N.jsx)(D.JO,{icon:t,className:"h-5 w-5"})}),(0,N.jsxs)("div",{children:[(0,N.jsx)("p",{className:"text-sm font-semibold text-white",children:a}),(0,N.jsx)("p",{className:"mt-1 text-xs leading-5 text-white/55",children:r})]})]})})}function rj(e){let{isOpen:t,onClose:a,stage:r,workflowMode:l="generate",formData:s,workflowStatus:n,workflowErrorMessage:i,loadingState:o,sourceDraftFile:d,sourceDraftPreviewUrl:c,verifyDraftFile:u,verifyDraftPreviewUrl:p,sourceInputRef:m,verifyInputRef:g,onChooseSourceMode:h,onChooseVerifyMode:x,onSourceFileChange:f,onVerifyFileChange:y,onResetSourceDraft:v,onResetVerifyDraft:b,onResetWorkflow:w,onTaskIdChange:j,onLanguageChange:k,onStartRetry:E,onToggleRecording:C,onPrepareSource:I,onConfirmVerification:S,isRecording:A,isStoppingRecording:P,recordingTarget:T,recordingSeconds:_,liveRecordingPeaks:R,sourceDuration:F,sourceWaveformLoading:M,isSourceRangeValid:O,onSourceRangeStartChange:L,onSourceRangeEndChange:B}=e,U=[rd.SOURCE_UPLOAD,rd.SOURCE_RECORD,rd.VERIFY_UPLOAD,rd.VERIFY_RECORD].includes(r),Z=A||P,{t:z}=(0,X.Z)("common"),q=aQ(n),K=ry(n),G="regenerate"===l,{minSelectionDuration:W,maxSelectionDuration:V}=rv(F),H=c&&F>0&&F<W?"Source audio must be at least ".concat(W," seconds."):"",J=()=>(0,N.jsx)("div",{className:"mt-5 flex justify-center",children:(0,N.jsxs)("label",{className:"flex items-center gap-3 rounded-full border border-white/10 bg-white/[0.04] px-4 py-2",children:[(0,N.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-[0.12em] text-white/45",children:"Language"}),(0,N.jsx)("select",{value:s.language,onChange:e=>k(e.target.value),className:"min-w-[132px] appearance-none border-0 bg-transparent pr-2 text-sm font-medium text-white outline-none",children:rm.map(e=>(0,N.jsx)("option",{value:e.value,className:"bg-[#15171c] text-white",children:e.label},e.value))})]})});return(0,N.jsx)(ti.R,{isOpen:t,onClose:a,placement:"center",backdrop:"blur",size:"5xl",isDismissable:!A&&!P,hideCloseButton:!0,scrollBehavior:"inside",children:(0,N.jsxs)(to.A,{className:"flex h-[80vh] max-h-[600px] max-w-[1080px] flex-col overflow-hidden rounded-[24px] border border-white/10 bg-[#15171c] text-white shadow-[0_24px_120px_rgba(0,0,0,0.45)]",children:[(0,N.jsx)(td.k,{className:"px-5 pb-0 pt-5",children:(0,N.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,N.jsx)("button",{type:"button",onClick:()=>
1{if(!Z){if(r===rd.SOURCE_UPLOAD||r===rd.SOURCE_RECORD){(d||c)&&v(),h(null);return}(r===rd.VERIFY_UPLOAD||r===rd.VERIFY_RECORD)&&((u||p)&&b(),x(null))}},className:"".concat("inline-flex h-9 w-9 items-center justify-center rounded-[10px] border border-white/10 bg-white/[0.03] text-white/72 transition hover:bg-white/[0.08] hover:text-white"," ").concat(U&&!Z?"":U?"cursor-not-allowed opacity-35":"pointer-events-none opacity-0"),"aria-label":"Go back",disabled:!U||Z,children:(0,N.jsx)(D.JO,{icon:"solar:alt-arrow-left-line-duotone",className:"h-[18px] w-[18px]"})}),(0,N.jsx)("button",{type:"button",onClick:a,className:"inline-flex h-8 w-8 items-center justify-center text-white/62 transition hover:text-white disabled:cursor-not-allowed disabled:opacity-35","aria-label":"Close modal",disabled:Z,children:(0,N.jsxs)("span",{className:"relative h-4 w-4",children:[(0,N.jsx)("span",{className:"absolute left-0 top-1/2 h-[1.5px] w-full -translate-y-1/2 rotate-45 rounded-full bg-current"}),(0,N.jsx)("span",{className:"absolute left-0 top-1/2 h-[1.5px] w-full -translate-y-1/2 -rotate-45 rounded-full bg-current"})]})})]})}),(0,N.jsx)(tc.I,{className:"flex min-h-0 flex-1 flex-col px-7 pb-7 pt-2",children:(()=>{switch(r){case rd.RETRY_TASK:return(0,N.jsxs)("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-2xl flex-1 flex-col items-center justify-center text-center",children:[(0,N.jsx)("span",{className:"inline-flex h-14 w-14 items-center justify-center rounded-full border border-white/10 bg-white/[0.04] text-white",children:(0,N.jsx)(D.JO,{icon:"solar:restart-circle-line-duotone",className:"h-7 w-7"})}),(0,N.jsx)("p",{className:"mt-8 text-3xl font-semibold text-white",children:"Start Retry"}),(0,N.jsx)("p",{className:"mt-4 max-w-xl text-sm leading-6 text-white/55",children:"Enter the previous taskId, then regenerate a new validation phrase."}),(0,N.jsxs)("div",{className:"mt-10 w-full text-left",children:[(0,N.jsx)("label",{className:"mb-2 block text-xs font-semibold uppercase tracking-[0.12em] text-white/45",children:"taskId"}),(0,N.jsx)("input",{type:"text",value:s.taskId||"",onChange:e=>null==j?void 0:j(e.target.value),onKeyDown:e=>{"Enter"===e.key&&String(s.taskId||"").trim()&&!o.regenerateValidate&&(null==E||E())},placeholder:"Enter taskId",className:"placeholder:text-white/32 h-12 w-full rounded-[12px] border border-white/10 bg-white/[0.04] px-4 text-sm text-white outline-none transition focus:border-white/25"})]}),(0,N.jsx)("button",{type:"button",onClick:E,disabled:!String(s.taskId||"").trim()||o.regenerateValidate,className:"".concat(rh," mt-8 min-w-[148px]"),children:o.regenerateValidate?"Starting...":"Start Retry"})]});case rd.SOURCE_CHOICE:if(G)return null;return(0,N.jsxs)("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-3xl flex-1 flex-col items-center justify-center text-center",children:[(0,N.jsx)("p",{className:"text-4xl font-semibold text-white",children:"Choose Audio Source"}),(0,N.jsxs)("div",{className:"mt-12 grid w-full max-w-2xl gap-4 md:grid-cols-2",children:[(0,N.jsx)(rw,{icon:"solar:microphone-3-line-duotone",title:"Record",subtitle:"Record audio directly in your browser",onClick:()=>h("record")}),(0,N.jsx)(rw,{icon:"solar:cloud-upload-line-duotone",title:"Upload Audio",subtitle:"Upload an existing local audio file",onClick:()=>h("upload")})]}),(0,N.jsx)("p",{className:"mx-auto mt-10 w-full text-center text-sm leading-6 text-white/60",children:z("voicePersona.verifyRecord.tip")})]});case rd.SOURCE_UPLOAD:return(0,N.jsxs)("div",{className:"mx-auto w-full max-w-4xl pb-2 pt-2",children:[(0,N.jsxs)("div",{className:"text-center",children:[(0,N.jsx)("p",{className:"text-3xl font-semibold text-white",children:"Upload Audio"}),(0,N.jsx)("p",{className:"mx-auto mt-3 w-full text-center text-sm leading-6 text-white/60",children:z("voicePersona.verifyRecord.tip")})]}),J(),(0,N.jsx)(ro,{type:"upload",fileInputRef:m,file:d,previewUrl:c,metadataLoading:M,duration:F,start:s.vocalStart,end:s.vocalEnd,onStartChange:L,onEndChange:B,onFileChange:f,onRemoveFile:v,minSelectionDuration:W,maxSelectionDuration:V,showRangeSelector:!0}),H?(0,N.jsx)("p",{className:"mt-3 rounded-[10px] border border-rose-400/20 bg-rose-500/10 px-3 py-2 text-sm text-rose-100",children:H}):null,c?(0,N.jsx)("div",{className:"mt-8 flex justify-end",children:(0,N.jsx)("button",{type:"button",onClick:I,disabled:!d||!O||o.prepareSource||M||!F,className:rh,children:o.prepareSource?"Preparing...":"Next"})}):null]});case rd.SOURCE_RECORD:return(0,N.jsxs)("div",{className:"mx-auto w-full max-w-4xl pb-2 pt-2",children:[(0,N.jsxs)("div",{className:"text-center",children:[(0,N.jsx)("p",{className:"text-3xl font-semibold text-white",children:"Record Audio"}),(0,N.jsx)("p",{className:"mx-auto mt-3 w-full text-center text-sm leading-6 text-white/60",children:z("voicePersona.verifyRecord.tip")})]}),J(),(0,N.jsx)(ro,{type:"record",file:d,previewUrl:c,metadataLoading:M,duration:F,start:s.vocalStart,end:s.vocalEnd,onStartChange:L,onEndChange:B,onRemoveFile:v,requestPermissionLoading:o.permission,isRecording:A&&"source"===T,isStoppingRecording:P,recordingSeconds:_,liveRecordingPeaks:R,onToggleRecording:()=>C("source"),minSelectionDuration:W,maxSelectionDuration:V,showRangeSelector:!0}),H?(0,N.jsx)("p",{className:"mt-3 rounded-[10px] border border-rose-400/20 bg-rose-500/10 px-3 py-2 text-sm text-rose-100",children:H}):null,c?(0,N.jsx)("div",{className:"mt-8 flex justify-end",children:(0,N.jsx)("button",{type:"button",onClick:I,disabled:!d||!O||o.prepareSource||M||!F,className:rh,children:o.prepareSource?"Preparing...":"Next"})}):null]});case rd.WAITING_VALIDATE:return K?(0,N.jsxs)("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-2xl flex-1 flex-col items-center justify-center text-center",children:[(0,N.jsx)("span",{className:"bg-rose-500/12 inline-flex h-14 w-14 items-center justify-center rounded-full border border-rose-300/25 text-rose-200",children:(0,N.jsx)(D.JO,{icon:"solar:danger-circle-line-duotone",className:"h-7 w-7"})}),(0,N.jsx)("p",{className:"mt-8 text-3xl font-semibold text-white",children:"Validation Failed"}),(0,N.jsx)("p",{className:"mt-4 max-w-xl text-sm leading-6 text-white/55",children:i||q.description}),(0,N.jsx)("p",{className:"mt-6 rounded-full border border-white/10 px-4 py-2 font-mono text-sm text-white/70",children:s.taskId||"taskId"}),(0,N.jsx)("button",{type:"button",onClick:w,className:"".concat(rh," mt-8"),children:"Start Over"})]}):(0,N.jsxs)("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-2xl flex-1 flex-col items-center justify-center text-center",children:[(0,N.jsx)("div",{className:"h-14 w-14 animate-spin rounded-full border-4 border-white/15 border-t-white"}),(0,N.jsx)("p",{className:"mt-8 text-3xl font-semibold text-white",children:"Fetching Validation Phrase"}),(0,N.jsx)("p",{className:"mt-4 text-sm leading-6 text-white/55",children:"You'll move to the validation step automatically when it's ready."}),(0,N.jsx)("p",{className:"mt-6 rounded-full border border-white/10 px-4 py-2 font-mono text-sm text-white/70",children:s.taskId||"taskId"})]});case rd.VERIFY_CHOICE:return(0,N.jsxs)("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-3xl flex-1 flex-col items-center justify-center text-center",children:[(0,N.jsx)("p",{className:"text-3xl font-semibold text-white",children:"Choose a Verification Method"}),(0,N.jsx)("p",{className:"mt-4 max-w-2xl text-sm leading-7 text-white/70",children:s.validateInfo||"Waiting for phrase..."}),(0,N.jsxs)("div",{className:"mt-12 grid w-full max-w-2xl gap-4 md:grid-cols-2",children:[(0,N.jsx)(rw,{icon:"solar:microphone-3-line-duotone",title:"Record",subtitle:"Read the validation phrase directly",onClick:()=>x("record")}),(0,N.jsx)(rw,{icon:"solar:cloud-upload-line-duotone",title:"Upload Audio",subtitle:"Upload a prerecorded validation clip",onClick:()=>x("upload")})]})]});case rd.VERIFY_UPLOAD:return(0,N.jsxs)("div",{className:"mx-auto w-full max-w-4xl pb-2 pt-2",children:[(0,N.jsxs)("div",{className:"text-center",children:[(0,N.jsx)("p",{className:"text-3xl font-semibold text-white",children:"Upload Audio"}),(0,N.jsx)("p",{className:"mt-4 text-sm leading-7 text-white/70",children:s.validateInfo||"Waiting for phrase..."})]}),(0,N.jsx)(ro,{type:"upload",fileInputRef:g,file:u,previewUrl:p,onFileChange:y,onRemoveFile:b}),p?(0,N.jsx)("div",{className:"mt-8 flex justify-end",children:(0,N.jsx)("button",{type:"button",onClick:S,disabled:!u||o.prepareVerify,className:rh,children:"Confirm"})}):null]});case rd.VERIFY_RECORD:return(0,N.jsxs)("div",{className:"mx-auto w-full max-w-4xl pb-2 pt-2",children:[(0,N.jsxs)("div",{className:"text-center",children:[(0,N.jsx)("p",{className:"text-3xl font-semibold text-white",children:"Read This Phrase"}),(0,N.jsx)("p",{className:"mx-auto mt-4 max-w-2xl rounded-[10px] border border-white/10 bg-white/[0.04] px-5 py-4 text-base font-medium leading-7 text-white",children:s.validateInfo||"Waiting for phrase..."}),(0,N.jsx)("p",{className:"mx-auto mt-3 w-full text-center text-sm leading-6 text-white/60",children:z("voicePersona.verifyRecord.tip")})]}),(0,N.jsx)("input",{ref:g,type:"file",accept:"audio/*",onChange:y,className:"hidden"}),(0,N.jsx)(ro,{type:"record",file:u,previewUrl:p,onRemoveFile:b,requestPermissionLoading:o.permission,isRecording:A&&"verify"===T,isStoppingRecording:P,recordingSeconds:_,liveRecordingPeaks:R,onToggleRecording:()=>C("verify")}),p?(0,N.jsx)("div",{className:"mt-8 flex justify-end",children:(0,N.jsx)("button",{type:"button",onClick:S,disabled:!u||o.prepareVerify,className:rh,children:"Confirm"})}):null]});case rd.READY:return(0,N.jsxs)("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-2xl flex-1 flex-col items-center justify-center text-center",children:[(0,N.jsx)("span",{className:"inline-flex h-16 w-16 items-center justify-center rounded-full bg-emerald-500/20 text-emerald-200",children:(0,N.jsx)(D.JO,{icon:"solar:check-circle-line-duotone",className:"h-8 w-8"})}),(0,N.jsx)("p",{className:"mt-8 text-3xl font-semibold text-white",children:"Validation Complete"}),(0,N.jsx)("p",{className:"mt-4 text-sm leading-6 text-white/55",children:"Click confirm to return to the main page and finish generation."}),(0,N.jsx)("button",{type:"button",onClick:a,className:"".concat(rh," mt-10"),children:"Confirm"})]});default:return null}})()})]})})}var rk=(0,Y.Pi)(function(){let{workflowMode:e="generate"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{userStore:t}=(0,_.o)(),[a,r]=(0,E.useState)(rc),[l,s]=(0,E.useState)("idle"),[n,i]=(0,E.useState)(""),[o,d]=(0,E.useState)(!1),[c,u]=(0,E.useState)(rd.SOURCE_CHOICE),[p,m]=(0,E.useState)("unknown"),[g,h]=(0,E.useState)({}),[x,f]=(0,E.useState)("Overview"),[y,v]=(0,E.useState)(!1),[b,w]=(0,E.useState)({permission:!1,prepareSource:!1,getValidateInfo:!1,prepareVerify:!1,generateVoice:!1,regenerateValidate:!1}),[j,k]=(0,E.useState)(null),[C,I]=(0,E.useState)(null),[S,A]=(0,E.useState)(null),[P,T]=(0,E.useState)(""),[R,F]=(0,E.useState)(0),[M,O]=(0,E.useState)(!1),[L,B]=(0,E.useState)(null),[U,Z]=(0,E.useState)(""),[z,q]=(0,E.useState)(!1),[K,G]=(0,E.useState)(!1),[W,V]=(0,E.useState)(null),[H,$]=(0,E.useState)(0),[Y,X]=(0,E.useState)(()=>rx()),Q=(0,E.useRef)(null),ee=(0,E.useRef)(null),et=(0,E.useRef)(null),ea=(0,E.useRef)(null),er=(0,E.useRef)(null),el=(0,E.useRef)(null),es=(0,E.useRef)(0),en=(0,E.useRef)(0),ei=(0,E.useRef)(null),eo=(0,E.useRef)(null),ed=(0,E.useRef)(null),ec=(0,E.useRef)(null),eu=(0,E.useRef)(0),ep=(0,E.useRef)(rx()),em=(0,E.useRef)(!1),eg=(0,E.useRef)(null),eh=(0,E.useRef)(null),ex="regenerate"===e,ef=(e,t)=>{w(a=>({...a,[e]:t}))},ey=e=>{r(t=>({...t,...e}))},ev=e=>{e.current&&(clearInterval(e.current),e.current=null)},eb=e=>{(null==e?void 0:e.startsWith("blob:"))&&URL.revokeObjectURL(e)},ew=()=>{let e=rx();ep.current=e,X(e)},ej=()=>
1{if(ei.current&&(cancelAnimationFrame(ei.current),ei.current=null),ec.current){try{ec.current.disconnect()}catch(e){}ec.current=null}if(eo.current){let e=eo.current;eo.current=null,e.close().catch(()=>{})}ed.current=null,eu.current=0},ek=e=>{let t=window.AudioContext||window.webkitAudioContext;if(!t||!e){ew();return}ej(),ew();try{let a=new t,r=a.createAnalyser();r.fftSize=2048,r.smoothingTimeConstant=.72;let l=a.createMediaStreamSource(e);l.connect(r),a.resume().catch(()=>{});let s=new Float32Array(r.fftSize);eo.current=a,ed.current=r,ec.current=l,eu.current=0;let n=e=>{let t=ed.current;if(t){if(!eu.current||e-eu.current>=31.25){t.getFloatTimeDomainData(s);let a=0,r=0;for(let e=0;e<s.length;e+=1){let t=Math.abs(s[e]||0);t>a&&(a=t),r+=t*t}let l=s.length?Math.sqrt(r/s.length):0,n=Math.min(Math.max(Math.max(2.6*a,4.8*l),.08),1),i=[...ep.current.slice(1),Number(n.toFixed(3))];ep.current=i,X(i),eu.current=e}ei.current=window.requestAnimationFrame(n)}};ei.current=window.requestAnimationFrame(n)}catch(e){ej(),ew()}},eN=()=>{ej(),ea.current&&(ea.current.getTracks().forEach(e=>e.stop()),ea.current=null),et.current=null,er.current=null,ew()};(0,E.useEffect)(()=>((async()=>{var e,t,a;if(!(null===(t=navigator)||void 0===t?void 0:null===(e=t.mediaDevices)||void 0===e?void 0:e.getUserMedia)){m("unsupported");return}if(!(null===(a=navigator.permissions)||void 0===a?void 0:a.query)){m("prompt");return}try{let e=await navigator.permissions.query({name:"microphone"});m(e.state||"prompt"),e.onchange=()=>m(e.state||"prompt")}catch(e){m("prompt")}})(),()=>{ev(el),ev(eg),ev(eh),eN(),eb(P),eb(U)}),[]),(0,E.useEffect)(()=>(ev(eg),o&&c===rd.WAITING_VALIDATE&&!b.regenerateValidate&&a.taskId&&!a.validateInfo&&["wait_processing","processing_validate"].includes(l)&&(eg.current=setInterval(()=>{eZ({silent:!0})},3e3)),()=>ev(eg)),[o,c,b.regenerateValidate,a.taskId,a.validateInfo,l]),(0,E.useEffect)(()=>(ev(eh),y&&a.taskId&&!a.voiceId&&["wait_processing","processing_validate","wait_validating"].includes(l)&&(eh.current=setInterval(()=>{ez({silent:!0})},3e3)),()=>ev(eh)),[y,a.taskId,a.voiceId,l]);let eE=e=>{let t=Number.isFinite(e)&&e>0?e:0;F(t),O(!1),r(e=>{if(!t)return e;let a=rb(e.vocalStart,e.vocalEnd,t);return{...e,vocalStart:a.start,vocalEnd:a.end}})};(0,E.useEffect)(()=>{if(!P){F(0),O(!1);return}O(!0);let e=document.createElement("audio");e.preload="metadata",e.src=P;let t=()=>{eE((Number.isFinite(e.duration)?e.duration:0)||en.current)},a=()=>{eE(en.current)};return e.addEventListener("loadedmetadata",t),e.addEventListener("error",a),()=>{e.removeEventListener("loadedmetadata",t),e.removeEventListener("error",a),e.src=""}},[P]);let eC=()=>{var e;let a=null===(e=t.user)||void 0===e?void 0:e.apiKey;if(!a)throw Error("Please login and set your API key");return a},eI=e=>{var t,a;if(!e)throw Error("Please select an audio file");let r=(null===(t=e.name)||void 0===t?void 0:t.toLowerCase())||"",l=r.includes(".")?r.split(".").pop():"";if(!((null===(a=e.type)||void 0===a?void 0:a.startsWith("audio/"))||t_.YO.includes(e.type)||ru.includes(l)))throw Error("Please upload a valid audio file (MP3, WAV, OGG, M4A, FLAC, AAC)");if(e.size>209715200)throw Error("File size exceeds 200MB limit")},eS=async function(e,t){var a,r,l,s;let{data:n,params:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=eC(),d=await (0,tC.Z)({url:"".concat("https://api.kie.ai").concat(t),method:e,data:n,params:i,headers:{Authorization:"Bearer ".concat(o)},validateStatus:()=>!0});if(h(d.data||{}),d.status<200||d.status>=300||(null===(a=d.data)||void 0===a?void 0:a.code)!==200)throw Error((null===(l=d.data)||void 0===l?void 0:l.msg)||(null===(s=d.data)||void 0===s?void 0:s.errorMessage)||d.statusText||"Request failed (".concat(d.status,")"));return(null===(r=d.data)||void 0===r?void 0:r.data)||{}},eA=async e=>(eI(e),(0,eK._R)(e,"kieai/market")),eP=(e,t)=>{r(a=>{let r=R||Math.max(a.vocalEnd||0,10),l=rb("start"===e?t:a.vocalStart,"end"===e?t:a.vocalEnd,r,"start"===e?"start":"end");return{...a,vocalStart:l.start,vocalEnd:l.end}})},eD=()=>{es.current+=1,eb(U),B(null),Z(""),ef("prepareVerify",!1),ey({verifyAudioName:"",verifyUploadUrl:"",voiceId:""}),v(!1),ee.current&&(ee.current.value="")},eT=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;eI(e);let a=Number.isFinite(t)&&t>0?t:0;en.current=a,eb(P),A(e),T(URL.createObjectURL(e)),F(a),O(!0),ey({sourceAudioName:e.n
1ame,sourceUploadUrl:"",taskId:"",validateInfo:"",verifyUploadUrl:"",verifyAudioName:"",voiceId:"",vocalStart:0,vocalEnd:0}),s("idle"),i(""),v(!1),I(null),eD()},e_=e=>{eI(e),eb(U),B(e),Z(URL.createObjectURL(e)),ey({verifyAudioName:e.name,verifyUploadUrl:"",voiceId:""}),v(!1)},eR=()=>{eb(P),en.current=0,A(null),T(""),F(0),O(!1),ey({sourceAudioName:"",sourceUploadUrl:"",taskId:"",validateInfo:"",verifyUploadUrl:"",verifyAudioName:"",voiceId:"",vocalStart:0,vocalEnd:0}),s("idle"),i(""),v(!1),I(null),eD(),Q.current&&(Q.current.value="")},eF=()=>{ev(eg),ev(eh),eR(),ey({taskId:"",voiceId:"",sourceUploadUrl:"",validateInfo:"",verifyUploadUrl:""}),k(null),I(null),u(ex?rd.RETRY_TASK:rd.SOURCE_CHOICE),d(!1),i("")},eM=async()=>{var e,t;if(!(null===(t=navigator)||void 0===t?void 0:null===(e=t.mediaDevices)||void 0===e?void 0:e.getUserMedia))return m("unsupported"),J.ZP.error("This browser does not support microphone recording"),!1;ef("permission",!0);try{return(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop()),m("granted"),J.ZP.success("Microphone permission granted"),!0}catch(e){return m("denied"),J.ZP.error("Microphone permission was denied"),!1}finally{ef("permission",!1)}},eO=()=>"undefined"==typeof MediaRecorder?"":aX.find(e=>MediaRecorder.isTypeSupported(e))||"",eL=()=>{let e=et.current;return!!(e&&"inactive"!==e.state)},eB=async e=>{if(!(em.current||z||K||eL())){em.current=!0;try{if(!("granted"===p||await eM()))return;let t=await navigator.mediaDevices.getUserMedia({audio:!0}),a=eO(),r=a?new MediaRecorder(t,{mimeType:a}):new MediaRecorder(t),l=[];r.ondataavailable=e=>{e.data&&e.data.size>0&&l.push(e.data)},r.onstop=async()=>{let t=er.current||Date.now(),s=!1;ev(el),q(!1),V(null);try{if(0===l.length)throw Error("No audio was captured");let n=Math.max(0,(Date.now()-t)/1e3),i="source"===e?10:3;if(n<i)throw Error("".concat("source"===e?"Source":"Validation"," recording must be at least ").concat(i," seconds. Please record again."));"source"===e&&(F(n),O(!0)),await rf(),await function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:350;return new Promise(t=>{if("function"==typeof window.requestIdleCallback){window.requestIdleCallback(t,{timeout:e});return}window.setTimeout(t,0)})}(),eN(),s=!0;let o=a||r.mimeType||"audio/webm",d=a1(o),c=new File([new Blob(l,{type:o})],"".concat(e,"-audio-").concat(Date.now(),".").concat(d),{type:o,lastModified:Date.now()});"source"===e?(eT(c,n),J.ZP.success("Source recording is ready")):(e_(c),J.ZP.success("Validation recording is ready"))}catch(t){"source"===e&&O(!1),J.ZP.error(t.message||"Failed to process the recording")}finally{s||eN(),G(!1)}},r.onerror=()=>{ev(el),q(!1),V(null),eN(),G(!1),J.ZP.error("Recording failed")},et.current=r,ea.current=t,$(0),V(e),q(!0),er.current=Date.now(),ek(t),r.start(1e3),el.current=setInterval(()=>{$(e=>e+1)},1e3)}catch(e){eN(),J.ZP.error("Unable to access the microphone")}finally{em.current=!1}}},eU=e=>{let t=et.current;if(K)return;if(!t||"inactive"===t.state){em.current=!1,ev(el),q(!1),V(null);return}let a=W||e;(0,aJ.flushSync)(()=>{ev(el),G(!0),q(!1),V(null),"source"===a&&O(!0)}),rf().then(()=>{try{"inactive"!==t.state&&t.stop()}catch(e){eN(),"source"===a&&O(!1),G(!1),J.ZP.error("Failed to stop recording")}})},eZ=async function(){let{silent:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(!a.taskId.trim())throw Error("Task id is missing");ef("getValidateInfo",!0);let t=await eS("get",a$.getValidateInfo,{params:{taskId:a.taskId.trim()}});if(ey({taskId:t.taskId||a.taskId,validateInfo:t.validateInfo||a.validateInfo}),t.status&&s(t.status),i(t.errorMessage||""),ry(t.status)){u(rd.WAITING_VALIDATE),e||J.ZP.error(t.errorMessage||"Validation phrase failed");return}(t.validateInfo||"wait_validating"===t.status)&&(I("record"),u(rd.VERIFY_RECORD)),!e&&t.validateInfo&&J.ZP.success("Validation phrase is ready")}catch(a){let t=a.message||"Failed to get the validation phrase";ev(eg),s("processing_validate_fail"),i(t),u(rd.WAITING_VALIDATE),e||J.ZP.error(t)}finally{ef("getValidateInfo",!1)}},ez=async function(){let{silent:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(!a.taskId.trim())throw Error("Task id is missing");let t=await eS("get",a$.getResult,{params:{taskId:a.taskId.trim()}});ey({taskId:t.taskId||a.taskId,voiceId:t.voiceId||a.voiceId}),t.status&&s(t.status),i(t.errorMessage||"");let r=t.voiceId||"success"===t.status||ry(t.status);r&&(v(!1),ef("generateVoice",!1)),y&&!ry(t.status)&&r?J.ZP.success("Voice generated"):e||J.ZP.success("Voice status refreshed")}catch(a){let t=a.message||"Failed to fetch voice status";v(!1),s("fail"),i(t),ef("generateVoice",!1),e||J.ZP.error(t)}},eq=async()=>
1{if(!b.regenerateValidate)try{let e=String(a.taskId||"").trim();if(!e)throw Error("Task id is missing");ev(eg),ev(eh),eD(),v(!1),ef("generateVoice",!1),ef("regenerateValidate",!0),s("wait_processing"),i(""),I("record"),u(rd.WAITING_VALIDATE),d(!0),ey({validateInfo:"",verifyUploadUrl:"",verifyAudioName:"",voiceId:""});let t=await eS("post",a$.regenerate,{data:{taskId:e}}),r="string"==typeof t?t:t.taskId||t.task_id||"",l="object"==typeof t&&(t.validateInfo||t.validate_info)||"",n="object"==typeof t&&t.status||"",o="object"==typeof t&&t.errorMessage||"",c=n||(l?"wait_validating":"wait_processing");if(ey({taskId:r||e,validateInfo:l}),s(c),i(o),f("Overview"),ry(c)){u(rd.WAITING_VALIDATE),J.ZP.error(o||"Validation phrase failed");return}l||"wait_validating"===c?(u(rd.VERIFY_RECORD),J.ZP.success("Validation phrase is ready")):(u(rd.WAITING_VALIDATE),J.ZP.success("Validation phrase regeneration started"))}catch(t){let e=t.message||"Failed to regenerate validation phrase";s("processing_validate_fail"),i(e),u(rd.WAITING_VALIDATE),d(!0),J.ZP.error(e)}finally{ef("regenerateValidate",!1)}},eG=async()=>{try{if(!S)throw Error("Please upload or record the source audio first");if(a.vocalStart>=a.vocalEnd)throw Error("Start time must be less than end time");let e=Number(a.vocalEnd)-Number(a.vocalStart),{minSelectionDuration:t,maxSelectionDuration:r}=rv(R);if(e<t||e>r)throw Error("Time range must stay between ".concat(t," seconds and 4 minutes"));ef("prepareSource",!0),i("");let l=J.ZP.loading("Uploading source audio..."),n="";try{n=await eA(S)}finally{J.ZP.dismiss(l)}let o=await eS("post",a$.createTask,{data:{voiceUrl:n,vocalStartS:Number(a.vocalStart),vocalEndS:Number(a.vocalEnd),language:a.language,callBackUrl:rp}});if(ey({sourceUploadUrl:n,sourceAudioName:S.name,taskId:o.taskId||"",validateInfo:o.validateInfo||"",verifyUploadUrl:"",verifyAudioName:"",voiceId:""}),s(o.status||"wait_processing"),i(o.errorMessage||""),v(!1),ry(o.status)){u(rd.WAITING_VALIDATE),J.ZP.error(o.errorMessage||"Validation phrase failed");return}o.validateInfo||"wait_validating"===o.status?(I("record"),u(rd.VERIFY_RECORD)):u(rd.WAITING_VALIDATE),f("Overview"),J.ZP.success(o.validateInfo?"Validation phrase is ready":"Source audio is ready, waiting for validation phrase")}catch(e){s("fail"),i(e.message||"Failed to prepare the source audio"),J.ZP.error(e.message||"Failed to prepare the source audio")}finally{ef("prepareSource",!1)}},eW=async function(){let{showReadyStage:e=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=es.current+1;es.current=t;try{if(!L)throw Error("Please upload or record the validation audio first");ef("prepareVerify",!0),i("");let a=await eA(L);if(es.current!==t)return;ey({verifyUploadUrl:a,verifyAudioName:L.name}),s("wait_validating"),e&&u(rd.READY),f("Overview"),J.ZP.success("Validation audio is ready")}catch(e){if(es.current!==t)return;i(e.message||"Failed to prepare the validation audio"),J.ZP.error(e.message||"Failed to prepare the validation audio")}finally{es.current===t&&ef("prepareVerify",!1)}},eV=async()=>{try{if(!a.taskId.trim())throw Error("Please finish the audio popup first");if(!a.verifyUploadUrl)throw Error("Validation audio is not ready yet");ef("generateVoice",!0);let e={taskId:a.taskId.trim(),verifyUrl:a.verifyUploadUrl,callBackUrl:rp,singerSkillLevel:a.singerSkillLevel||"beginner"};a.voiceName.trim()&&(e.voiceName=a.voiceName.trim()),a.description.trim()&&(e.description=a.description.trim()),a.style.trim()&&(e.style=a.style.trim());let t=await eS("post",a$.submitValidation,{data:e});ey({taskId:t.taskId||a.taskId,voiceId:""});let r=t.status||"wait_processing";s(r),i(t.errorMessage||""),v("success"!==r&&!ry(r)),f("Overview"),ry(r)?(ef("generateVoice",!1),J.ZP.error(t.errorMessage||"Voice generation failed")):"success"===r||t.voiceId?(ey({taskId:t.taskId||a.taskId,voiceId:t.voiceId||""}),v(!1),ef("generateVoice",!1),J.ZP.success("Voice generated")):J.ZP.success("Voice generation started")}catch(e){v(!1),i(e.message||"Failed to generate the voice"),J.ZP.error(e.message||"Failed to generate the voice"),ef("generateVoice",!1)}},eH=()=>
1{a.verifyUploadUrl?u(rd.READY):a.validateInfo?(u("upload"===C?rd.VERIFY_UPLOAD:rd.VERIFY_RECORD),C||I("record")):ex&&(!a.taskId||"idle"===l)?u(rd.RETRY_TASK):a.taskId?u(rd.WAITING_VALIDATE):"upload"===j?u(rd.SOURCE_UPLOAD):"record"===j?u(rd.SOURCE_RECORD):u(rd.SOURCE_CHOICE),d(!0)},eJ=Number(a.vocalEnd)-Number(a.vocalStart),{minSelectionDuration:e$,maxSelectionDuration:eY}=rv(R),eX=eJ>=e$&&eJ<=eY&&Number(a.vocalEnd)>Number(a.vocalStart),eQ=a.sourceAudioName||(null==S?void 0:S.name)||"Recorded source audio",e0=ex?"Regenerate Voice":"Generate Voice",e1=ex?"Enter a previous taskId in the popup, regenerate the validation phrase, then finish the voice generation here.":"Prepare the source and validation audio in the popup, then finish the self-built voice generation here.",e2=ex?"Start Retry":"Select Audio",e5=!!a.verifyUploadUrl,e4=!!a.validateInfo,e3=!!(L||U),e6=ry(l),e7=e6&&!!a.taskId,e9=ex&&!!a.taskId&&!e4&&["wait_processing","processing_validate","wait_validating"].includes(l),e8=aQ(l),te=e5||e3||e4||e7||e9||b.prepareVerify||b.regenerateValidate,tt=b.regenerateValidate?"Regenerating validation phrase...":e9?"Fetching validation phrase...":e6?e8.label:b.prepareVerify?"Uploading validation audio...":e5?"Validation audio ready":e3?"Validation audio selected":e4?"Validation phrase ready":eQ,ta=b.regenerateValidate?"A new validation phrase task is starting. The popup will move forward automatically.":e9?"The retry task is running. The popup will move to the reading step when the phrase is ready.":e6?"Generate a new validation phrase, then read the new phrase to continue.":b.prepareVerify?"The upload is running in the background. You can re-read or clear this step if needed.":e5?"Ready to generate. Re-read the phrase if you want to replace this validation clip.":e3?"Confirm this clip in the popup, or re-read the phrase to replace it.":e4?"Read the validation phrase to continue.":"Click to review the popup flow.",tr="fail"===l?"fail":a.voiceId||"Not ready yet";return(0,N.jsxs)("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[48%_52%]",children:[(0,N.jsx)("div",{className:"space-y-6",children:(0,N.jsxs)(a2,{title:e0,subtitle:e1,children:[te?(0,N.jsxs)("div",{className:"flex items-center gap-3 rounded-2xl border border-gray-300 bg-gray-50 px-5 py-4 transition hover:border-blue-400 hover:bg-blue-50 dark:border-gray-700 dark:bg-gray-900 dark:hover:border-blue-500 dark:hover:bg-gray-800",children:[(0,N.jsx)("span",{className:"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-blue-100 text-blue-600 dark:bg-blue-500/15 dark:text-blue-300",children:b.prepareVerify?(0,N.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):(0,N.jsx)(D.JO,{icon:e6?"solar:danger-circle-line-duotone":e5?"solar:check-circle-line-duotone":"solar:microphone-3-line-duotone",className:"h-5 w-5"})}),(0,N.jsxs)("button",{type:"button",onClick:eH,disabled:b.prepareVerify||b.regenerateValidate,className:"min-w-0 flex-1 text-left disabled:cursor-default",children:[(0,N.jsx)("p",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:tt}),(0,N.jsx)("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:ta})]}),e4||e7?(0,N.jsx)("button",{type:"button",onClick:e7?eq:()=>{eD(),I("record"),u(rd.VERIFY_RECORD),d(!0)},disabled:b.regenerateValidate,className:"inline-flex h-9 shrink-0 items-center justify-center rounded-lg border border-gray-300 px-3 text-xs font-semibold text-gray-700 transition hover:bg-gray-100 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700",children:e7?"Re-generate":"Re-read"}):null,(0,N.jsx)("button",{type:"button",onClick:eF,className:"ml-4 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-gray-500 transition hover:bg-gray-200 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white","aria-label":"Clear audio",children:(0,N.jsx)(D.JO,{icon:"solar:close-circle-line-duotone",className:"h-5 w-5"})})]}):(0,N.jsx)("button",{type:"button",onClick:eH,className:"flex h-20 w-full items-center justify-center rounded-2xl border-2 border-dashed border-gray-300 bg-gray-50 text-sm font-semibold text-gray-700 transition hover:border-blue-400 hover:bg-blue-50 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:border-blue-500 dark:hover:bg-gray-800 dark:hover:text-blue-300",children:e2}),(0,N.jsxs)("div",{children:[(0,N.jsx)(a5,{label:"voiceName"}),(0,N.jsx)("input",{type:"text",value:a.voiceName,onChange:e=>ey({voiceName:e.target.value}),placeholder:"My Voice",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)(a5,{label:"style"}),(0,N.jsx)("input",{type:"text",value:a.style,onChange:e=>ey({style:e.target.value}),placeholder:"Pop, Female Vocal",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)(a5,{label:"singerSkillLevel"}),(0,N.jsx)("select",{value:a.singerSkillLevel||"beginner",onChange:e=>ey({singerSkillLevel:e.target.value}),className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400",children:rg.map(e=>(0,N.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)(a5,{label:"description"}),(0,N.jsx)("textarea",{value:a.description,onChange:e=>ey({description:e.target.value}),placeholder:"created from uploaded voice",rows:3,className:"w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]}),(0,N.jsx)("button",{type:"button",onClick:eV,disabled:!a.taskId||!a.verifyUploadUrl||b.generateVoice||y,className:"inline-flex h-11 w-full items-center justify-center rounded-lg bg-blue-500 px-4 text-sm font-semibold text-white transition hover:bg-blue-400 disabled:cursor-not-allowed disabled:opacity-50",children:b.generateVoice||y?"Generating...":"Generate Voice"})]})}),(0,N.jsxs)("section",{className:"rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[(0,N.jsx)("div",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Output"}),(0,N.jsx)("div",{className:"flex rounded-lg bg-gray-100 p-1 dark:bg-gray-700",children:["Overview","JSON"].map(e=>(0,N.jsx)("button",{type:"button",onClick:()=>f(e),className:"rounded-md px-3 py-1.5 text-sm font-medium transition ".concat(x===e?"bg-white text-gray-900 shadow-sm dark:bg-gray-600 dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-300 dark:hover:text-white"),children:e},e))})]}),"Overview"===x?(0,N.jsxs)("div",{className:"space-y-5 p-5",children:[(0,N.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,N.jsxs)("div",{className:"rounded-xl border border-gray-200 p-4 dark:border-gray-700",children:[(0,N.jsx)("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:ex?"Retry Task":"Source Audio"}),ex?(0,N.jsx)("p",{className:"mt-3 break-all font-mono text-sm leading-6 text-gray-600 dark:text-gray-300",children:a.taskId||"Enter a taskId in the popup to start retry."}):P?(0,N.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,N.jsx)("p",{className:"truncate text-sm text-gray-600 dark:text-gray-300",children:eQ}),(0,N.jsx)("audio",{src:P,controls:!0,className:"w-full",children:"Your browser does not support the audio tag."})]}):(0,N.jsx)("p",{className:"mt-3 text-sm leading-6 text-gray-500 dark:text-gray-400",children:"The source clip will appear after the popup finishes."})]}),(0,N.jsxs)("div",{className:"rounded-xl border border-gray-200 p-4 dark:border-gray-700",children:[(0,N.jsx)("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Validation Phrase"}),(0,N.jsx)("p",{className:"mt-3 text-sm leading-7 text-gray-600 dark:text-gray-300",children:a.validateInfo||"The validation phrase will appear here after the popup starts the task."})]})]}),(0,N.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,N.jsxs)("div",{className:"rounded-xl border border-gray-200 p-4 dark:border-gray-700",children:[(0,N.jsx)("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Validation Audio"}),U?(0,N.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,N.jsx)("p",{className:"truncate text-sm text-gray-600 dark:text-gray-300",children:a.verifyAudioName||"Recorded validation audio"}),(0,N.jsx)("audio",{src:U,controls:!0,className:"w-full",children:"Your browser does not support the audio tag."})]}):(0,N.jsx)("p",{className:"mt-3 text-sm leading-6 text-gray-500 dark:text-gray-400",children:"The validation clip will appear here after the popup completes."})]}),(0,N.jsxs)("div",{className:"rounded-xl border border-gray-200 p-4 dark:border-gray-700",children:[(0,N.jsx)("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Voice Result"}),(0,N.jsxs)("div",{className:"mt-3 space-y-3 text-sm text-gray-600 dark:text-gray-300",children:[(0,N.jsxs)("p",{children:[(0,N.jsx)("span",{className:"font-medium text-gray-900 dark:text-white",children:"taskId:"})," ",a.taskId||"Not created yet"]}),(0,N.jsxs)("p",{children:[(0,N.jsx)("span",{className:"font-medium text-gray-900 dark:text-white",children:"voiceId:"})," ",(0,N.jsx)("span",{className:"fail"===l?"font-medium text-rose-600 dar
1k:text-rose-300":"",children:tr})]}),"fail"===l?(0,N.jsxs)("p",{className:"leading-6 text-rose-600 dark:text-rose-300",children:[(0,N.jsx)("span",{className:"font-medium",children:"errorMessage:"})," ",n||"Voice generation failed"]}):null]})]})]})]}):(0,N.jsx)("div",{className:"p-5",children:(0,N.jsx)(a6,{data:g})})]}),(0,N.jsx)(rj,{isOpen:o,onClose:()=>{z||K||d(!1)},stage:c,workflowMode:e,formData:a,workflowStatus:l,workflowErrorMessage:n,loadingState:b,sourceDraftFile:S,sourceDraftPreviewUrl:P,verifyDraftFile:L,verifyDraftPreviewUrl:U,sourceInputRef:Q,verifyInputRef:ee,onChooseSourceMode:e=>{k(e),"upload"===e?u(rd.SOURCE_UPLOAD):"record"===e?u(rd.SOURCE_RECORD):u(rd.SOURCE_CHOICE)},onChooseVerifyMode:e=>{I(e),"upload"===e?u(rd.VERIFY_UPLOAD):"record"===e?u(rd.VERIFY_RECORD):u(rd.VERIFY_CHOICE)},onSourceFileChange:e=>{var t;let a=null===(t=e.target.files)||void 0===t?void 0:t[0];if(a)try{eT(a)}catch(e){J.ZP.error(e.message||"Failed to select the source audio")}},onVerifyFileChange:e=>{var t;let a=null===(t=e.target.files)||void 0===t?void 0:t[0];if(a)try{e_(a)}catch(e){J.ZP.error(e.message||"Failed to select the validation audio")}},onResetSourceDraft:eR,onResetVerifyDraft:eD,onResetWorkflow:eF,onTaskIdChange:e=>ey({taskId:e}),onLanguageChange:e=>ey({language:e}),onStartRetry:eq,onToggleRecording:e=>{if(!K){if(eL()||z&&(!W||W===e)){eU(e);return}eB(e)}},onPrepareSource:eG,onConfirmVerification:()=>{L&&!b.prepareVerify&&(d(!1),eW({showReadyStage:!1}))},isRecording:z,isStoppingRecording:K,recordingTarget:W,recordingSeconds:H,liveRecordingPeaks:Y,sourceDuration:R,sourceWaveformLoading:M,isSourceRangeValid:eX,onSourceRangeStartChange:e=>eP("start",e),onSourceRangeEndChange:e=>eP("end",e)})]})}),rN=(0,Y.Pi)(()=>{let{userStore:e}=(0,_.o)(),[t,a]=(0,E.useState)(""),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)("Overview"),[i,o]=(0,E.useState)(!1),[d,c]=(0,E.useState)(null),u=async()=>{if(t)try{await navigator.clipboard.writeText(t),J.ZP.success("taskId copied")}catch(e){J.ZP.error("Failed to copy taskId")}},p=async()=>{let a=t.trim();try{var r,s,i,d,u;if(!a)throw Error("Please enter a taskId");if(!(null===(r=e.user)||void 0===r?void 0:r.apiKey))throw Error("Please login and set your API key");o(!0);let t=await (0,tC.Z)({url:"".concat("https://api.kie.ai").concat(a$.checkAvailability),method:"post",data:{task_id:a},headers:{Authorization:"Bearer ".concat(e.user.apiKey)}});if(l(t.data||{}),(null===(s=t.data)||void 0===s?void 0:s.code)!==200)throw Error((null===(u=t.data)||void 0===u?void 0:u.msg)||"Failed to query voice availability");let p=null===(d=t.data)||void 0===d?void 0:null===(i=d.data)||void 0===i?void 0:i.isAvailable;c("boolean"==typeof p?p:null),n("Overview"),J.ZP.success(p?"This voice is available":"Availability checked")}catch(e){c(null),J.ZP.error(e.message||"Failed to query voice availability")}finally{o(!1)}};return(0,N.jsx)("div",{className:"space-y-6",children:(0,N.jsxs)("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-[44%_56%]",children:[(0,N.jsxs)(a2,{title:"Query Voice Availability",subtitle:"Enter the generated taskId and query the voice availability result.",children:[(0,N.jsx)(a4,{label:"taskId",value:t,placeholder:"xxx_task_id_xxx",onChange:e=>a(e.target.value),onCopy:u}),(0,N.jsx)(a3,{fullWidth:!0,icon:"solar:verified-check-line-duotone",loading:i,onClick:p,disabled:!t.trim(),children:"Check Availability"})]}),(0,N.jsxs)("section",{className:"rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[(0,N.jsx)("div",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Output"}),(0,N.jsx)("div",{className:"flex rounded-lg bg-gray-100 p-1 dark:bg-gray-700",children:["Overview","JSON"].map(e=>(0,N.jsx)("button",{type:"button",onClick:()=>n(e),className:"rounded-md px-3 py-1.5 text-sm font-medium transition ".concat(s===e?"bg-white text-gray-900 shadow-sm dark:bg-gray-600 dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-300 dark:hover:text-white"),children:e},e))})]}),"Overview"===s?(0,N.jsx)("div",{className:"p-5",children:(0,N.jsxs)("div",{className:"rounded-xl border p-5 text-sm ".concat(!0===d?"border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-700/60 dark:bg-emerald-900/20 dark:text-emerald-200":!1===d?"border-rose-200 bg-rose-50 text-rose-700 dark:border-rose-700/60 dark:bg-rose-900/20 dark:text-rose-200":"border-slate-200 bg-slate-50 text-slate-700 dark:border-slate-700 dark:bg-slate-800/80 dark:text-slate-200"),children:[(0,N.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-base font-semibold",children:[(0,N.jsx)(D.JO,{icon:!0===d?"solar:check-circle-line-duotone":!1===d?"solar:close-circle-line-duotone":"solar:info-circle-line-duotone",className:"h-5 w-5"}),(0,N.jsx)("span",{children:!0===d?"Available":!1===d?"Unavailable":"Not Checked"})]}),(0,N.jsx)("p",{className:"leading-6",children:null===d?"Run the query to see whether this voice is available.":d?"The backend says this voice can be used now.":"The backend says this voice is not available yet."})]})}):(0,N.jsx)("div",{className:"p-5",children:(0,N.jsx)(a6,{data:r})})]})]})})}),rE=()=>(0,N.jsx)(rk,{workflowMode:"regenerate"});let rC=function(){var e,t,a,r,l,s,n,i;let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},d=null===(e=o.uploadUrl)||void 0===e?void 0:e.trim(),c=null===(t=o.taskId)||void 0===t?void 0:t.trim(),u=null===(a=o.audioId)||void 0===a?void 0:a.trim(),p=null===(r=o.model)||void 0===r?void 0:r.trim(),m={...d||p&&!c?{uploadUrl:d,model:p}:{taskId:c,audioId:u},prompt:(null===(l=o.prompt)||void 0===l?void 0:l.trim())||"",tags:(null===(s=o.tags)||void 0===s?void 0:s.trim())||"",title:(null===(n=o.title)||void 0===n?void 0:n.trim())||"",fullLyrics:(null===(i=o.fullLyrics)||void 0===i?void 0:i.trim())||"",lyrics:o.lyrics||"",infillStartS:o.infillStartS,infillEndS:o.infillEndS,vocalGender:o.vocalGender||"m",callBackUrl:o.callBackUrl||"playground"};o.negativeTags&&""!==o.negativeTags.trim()&&(m.negativeTags=o.negativeTags.trim()),t8(m,"styleWeight",o.styleWeight),t8(m,"weirdnessConstraint",o.weirdnessConstraint),t8(m,"audioWeight",o.audioWeight),o.personaId&&(m.personaId=o.personaId,m.personaModel=o.personaModel||"style_persona");let g=Number(o.variety);return m.variety=!t9(o.variety)&&Number.isInteger(g)&&g>=0&&g<=4?g:t_.cZ,m};function rI(e){var t;let{formData:a,setFormData:r}=e,[l,s]=(0,E.useState)(!!(null==a?void 0:a.uploadUrl)),[n,i]=(0,E.useState)(!1),[o,d]=(0,E.useState)(null),[c,u]=(0,E.useState)((null==a?void 0:a.uploadUrl)||""),p=(0,E.useRef)(null);(0,E.useEffect)(()=>{a&&0!==Object.keys(a).length?a.uploadUrl&&(s(!0),u(a.uploadUrl),r(e=>{let t={...e||{}};
1return delete t.taskId,delete t.audioId,{...t,model:t.model||t_.aC[0].type,callBackUrl:t.callBackUrl||"playground"}})):r({taskId:"",audioId:"",prompt:"",tags:"",title:"",infillStartS:0,infillEndS:10,negativeTags:"",fullLyrics:"",lyrics:"",vocalGender:"m",styleWeight:.65,weirdnessConstraint:.65,audioWeight:.65,variety:t_.cZ,personaId:"",personaModel:"style_persona",callBackUrl:"playground"})},[]);let m=(e,t)=>{r(a=>({...a||{},[e]:t}))},g=(e,t)=>{r(a=>({...a||{},[e]:t}))},h=async e=>{var t;let a=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!a)return;if(![...t_.YO,"audio/mp4","audio/x-m4a"].some(e=>{let t=e.split("/")[1];return a.type===e||a.name.toLowerCase().endsWith(".".concat(t))})){J.ZP.error("Please upload a valid audio file (MP3, WAV, OGG, M4A, FLAC, AAC)");return}if(a.size>209715200){J.ZP.error("File size exceeds 200MB limit");return}i(!0);let r=J.ZP.loading("Uploading audio file...");try{let e=await (0,eK._R)(a,"kie-ai/market");if(!e)throw Error("Upload failed");let t=URL.createObjectURL(a);d(a),u(t),g("uploadUrl",e),m("uploadUrl",e),J.ZP.dismiss(r),J.ZP.success("Audio file uploaded successfully")}catch(e){J.ZP.dismiss(r),J.ZP.error(e.message||"Upload failed, please try again")}finally{i(!1),p.current&&(p.current.value="")}};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,N.jsx)("div",{className:"flex flex-1 flex-col gap-1",children:(0,N.jsx)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Use uploaded custom audio"})}),(0,N.jsx)(tF.rs,{checked:l,onChange:e=>{if(s(e),e){r(e=>{let t={...e||{}};return delete t.taskId,delete t.audioId,{...t,uploadUrl:t.uploadUrl||"",model:t.model||t_.aC[0].type,callBackUrl:t.callBackUrl||"playground"}});return}d(null),u(""),p.current&&(p.current.value=""),r(e=>{let t={...e||{}};return delete t.uploadUrl,delete t.model,{...t,taskId:t.taskId||"",audioId:t.audioId||"",callBackUrl:t.callBackUrl||"playground"}})},className:"group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition duration-500 ease-in-out focus:outline-none data-[checked]:bg-blue-500",children:(0,N.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5"})})]}),l?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["uploadUrl ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(ai,{fileInputRef:p,uploadedFile:o,previewUrl:c,uploadLoading:n,onFileChange:h,onRemoveFile:()=>{d(null),u(""),g("uploadUrl",""),m("uploadUrl",""),p.current&&(p.current.value="")},accept:"audio/*",maxSize:"Max 200MB"})]}),(0,N.jsx)(tU.Z,{label:"model ",options:t_.aC,value:null==a?void 0:a.model,onChange:e=>g("model",e),onBlur:e=>m("model",e),getOptionValue:e=>e.type,getOptionLabel:e=>e.title,maxHeight:320,required:!0})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["taskId ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.taskId)||"",onChange:e=>g("taskId",e.target.value),onBlur:e=>m("taskId",e.target.value),placeholder:"Enter music generation task ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Original music task ID"})})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["audioId ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.audioId)||"",onChange:e=>g("audioId",e.target.value),onBlur:e=>m("audioId",e.target.value),placeholder:"Enter audio ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Audio ID to replace"})})]})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["prompt ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("textarea",{value:(null==a?void 0:a.prompt)||"",onChange:e=>g("prompt",e.target.value),onBlur:e=>m("prompt",e.target.value),placeholder:"A calm and relaxing piano track.",rows:3,className:"w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Prompt describing the replacement segment content"})})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["tags ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.tags)||"",onChange:e=>g("tags",e.target.value),onBlur:e=>m("tags",e.target.value),placeholder:"Jazz",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Music style tags"})})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["title ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.title)||"",onChange:e=>g("title",e.target.value),onBlur:e=>m("title",e.target.value),placeholder:"Relaxing Piano",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Music title"})})]}),(0,N.jsx)(aG,{startLabel:"infillStartS",endLabel:"infillEndS",startName:"infillStartS",endName:"infillEndS",startValue:null==a?void 0:a.infillStartS,endValue:null==a?void 0:a.infillEndS,onStartChange:e=>g("infillStartS",e),onEndChange:e=>g("infillEndS",e),onStartBlur:e=>m("infillStartS",e),onEndBlur:e=>m("infillEndS",e),startPlaceholder:"10.5",endPlaceholder:"20.75",startDescription:"Start time (seconds)",endDescription:"End time (seconds)",required:!0,min:0,step:.
101,minRange:10}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"negativeTags"}),(0,N.jsx)("input",{type:"text",value:(null==a?void 0:a.negativeTags)||"",onChange:e=>g("negativeTags",e.target.value),onBlur:e=>m("negativeTags",e.target.value),placeholder:"Rock",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Music styles to exclude (optional)"})})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["fullLyrics ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("textarea",{value:(null==a?void 0:a.fullLyrics)||"",onChange:e=>g("fullLyrics",e.target.value),onBlur:e=>m("fullLyrics",e.target.value),placeholder:"[Verse 1]\nOriginal lyrics here\n[Chorus]\nModified lyrics for this section\n[Verse 2]\nMore original lyrics",rows:6,className:"w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Complete lyrics after modification"})})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"lyrics"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.lyrics)||"",onChange:e=>g("lyrics",e.target.value),onBlur:e=>m("lyrics",e.target.value),rows:6,maxLength:5e3,placeholder:"Write your own lyrics"})]}),(0,N.jsx)(tU.Z,{label:"vocalGender",options:t_.I8,value:(null==a?void 0:a.vocalGender)||"m",onChange:e=>g("vocalGender",e),onBlur:e=>m("vocalGender",e),variant:"simple"}),(0,N.jsx)(tq,{label:"styleWeight",value:null==a?void 0:a.styleWeight,onChange:e=>g("styleWeight",e),onBlur:e=>m("styleWeight",e),min:0,max:1,step:.01,initialValue:.65}),(0,N.jsx)(tq,{label:"weirdnessConstraint",value:null==a?void 0:a.weirdnessConstraint,onChange:e=>g("weirdnessConstraint",e),onBlur:e=>m("weirdnessConstraint",e),min:0,max:1,step:.01,initialValue:.65}),(0,N.jsx)(tq,{label:"audioWeight",value:null==a?void 0:a.audioWeight,onChange:e=>g("audioWeight",e),onBlur:e=>m("audioWeight",e),min:0,max:1,step:.01,initialValue:.65}),(0,N.jsx)(tU.Z,{label:"variety",options:t_.wg,value:null!==(t=null==a?void 0:a.variety)&&void 0!==t?t:t_.cZ,onChange:e=>g("variety",e),onBlur:e=>m("variety",e)}),(0,N.jsx)(tZ,{label:"personaId",name:"personaId",value:(null==a?void 0:a.personaId)||"",onChange:e=>g("personaId",e.target.value),onBlur:e=>m("personaId",e.target.value),placeholder:"Enter persona ID"}),(null==a?void 0:a.personaId)&&(0,N.jsx)(tz,{label:"personaModel",name:"personaModel",options:[{value:"style_persona",label:"Style Persona"},{value:"voice_persona",label:"Voice Persona",disabled:!(0,t_.uB)(null==a?void 0:a.model,"voicePersonaEnable")}],value:(null==a?void 0:a.personaModel)||"style_persona",onChange:e=>g("personaModel",e)})]})}var rS=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),[u,p]=(0,E.useState)(null),m=async e=>{if(!d){n(null),o({}),c(!0);try{var t,r,l,s,i;let d=null===(t=e.uploadUrl)||void 0===t?void 0:t.trim(),u=null===(r=e.taskId)||void 0===r?void 0:r.trim(),m=null===(l=e.audioId)||void 0===l?void 0:l.trim(),g=null===(s=e.model)||void 0===s?void 0:s.trim();if(d||g&&!u){if(!d)throw Error("Please upload an audio file");if(!g)throw Error("Please select model")}else{if(!u)throw Error("Please enter task ID");if(!m)throw Error("Please enter audio ID")}if(!e.prompt||""===e.prompt.trim())throw Error("Please enter a prompt for the replacement segment");
1if(!e.tags||""===e.tags.trim())throw Error("Please enter music style tags");if(!e.title||""===e.title.trim())throw Error("Please enter music title");if(!e.fullLyrics||""===e.fullLyrics.trim())throw Error("Please enter full lyrics");if(void 0===e.infillStartS||null===e.infillStartS)throw Error("Please specify start time");if(void 0===e.infillEndS||null===e.infillEndS)throw Error("Please specify end time");if(e.infillStartS>=e.infillEndS)throw Error("Start time must be less than end time");if(e.infillEndS-e.infillStartS<10)throw Error("Replacement duration must be at least 10 seconds");let h=null===(i=a.user)||void 0===i?void 0:i.apiKey;if(!h)throw Error("Please login and set your API key");let x=rC(e),f=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/replace-section"),method:"post",data:x,headers:{Authorization:"Bearer ".concat(h)}});if(o(f.data||{}),200!==f.data.code)throw Error(f.data.msg||"Failed to create replace section task");let y=f.data.data||{},v=y.taskId||y.taskid||y.id;if(!v)throw Error("Failed to get task ID from response");let b=0,w=setInterval(()=>{let e=Math.max(1,Math.min(Math.floor(b++/40*100),99));p(e),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(h)},params:{taskId:v}}).then(e=>{if(o(e.data||{}),200!==e.data.code)throw Error(e.data.msg||"Polling request failed");let t=e.data.data,a=t.data||t;n(a),"SUCCESS"===a.status?(c(!1),p(null),clearInterval(w),J.ZP.success("Section replaced successfully")):["CREATE_TASK_FAILED","GENERATE_AUDIO_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(a.status)&&(c(!1),p(null),clearInterval(w),J.ZP.error(a.errorMessage||"Section replacement failed"))}).catch(e=>{c(!1),p(null),clearInterval(w),J.ZP.error(e.message||"Polling request failed")})},2e3)}catch(e){c(!1),p(null),J.ZP.error(e.message||"Failed to create replace section task")}}},g=(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e.suno_replace_section)||5;return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(rI,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(tR,{recordDetails:s,progress:u,generating:d}),run:()=>m(r),formData:r,outputData:i,generating:d,credit:g})});function rA(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({prompt:""})},[]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))},l=(e,t)=>{a(a=>({...a,[e]:t}))};return(0,N.jsx)("div",{className:"space-y-6",children:(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["Prompt ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(tB,{value:(null==t?void 0:t.prompt)||"",onChange:e=>r("prompt",e.target.value),onBlur:e=>l("prompt",e.target.value),rows:6,maxLength:200,placeholder:"A nostalgic song about childhood memories and growing up in a small town"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Describe the theme, style, or subject of the desired lyrics. Maximum 200 characters."})})]})})}function rP(e){var t,a,r;let{recordDetails:l,progress:s,generating:n}=e;if(!l||0===Object.keys(l).length||!l.status)return n?(0,N.jsxs)("div",{className:"flex w-full flex-col items-center lg:h-[80vh]",children:[(0,N.jsxs)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 shadow-sm dark:bg-gray-800",children:[(0,N.jsx)("span",{className:"aspect-square w-20 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsxs)("div",{className:"flex flex-1 flex-col items-start gap-2",children:[(0,N.jsx)("span",{className:"h-6 w-40 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsx)("span",{className:"h-6 w-1/2 rounded-lg bg-gray-200 dark:bg-gray-700"})]})]}),n&&(0,N.jsx)("div",{className:"flex w-full items-center justify-center py-6",children:(0,N.jsx)(tS.Z,{loading:!0,color:"#3b82f6",size:10})})]}):(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4 lg:h-[80vh]",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"lyrics",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Generate creative lyrics content based on a text prompt. Multiple variations of lyrics will be generated for each request."})]});if(["CREATE_TASK_FAILED","GENERATE_LYRICS_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(null==l?void 0:l.status))return(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 whitespace-pre-line py-6 text-center text-rose-600 lg:h-[80vh]",children:[(0,N.jsx)("img",{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"failed",width:20,height:20,className:"aspect-square w-36"}),(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-1.5 px-4 text-center",children:[(0,N.jsx)("p",{className:"text-rose-600",children:"Generation Failed"}),l.errorMessage&&(0,N.jsx)("p",{className:"text-rose-600",children:l.errorMessage}),(0,N.jsx)("p",{className:"text-xs text-rose-500",children:"Credits will not be deducted for failed generations"})]})]});let i=(null==l?void 0:null===(t=l.response)||void 0===t?void 0:t.data)||(null==l?void 0:null===(r=l.data)||void 0===r?void 0:null===(a=r.response)||void 0===a?void 0:a.data)||(null==l?void 0:l.data)||[];return i.length>0?(0,N.jsx)("div",{className:"relative m-auto flex w-full flex-col items-center justify-center lg:h-[80vh] lg:w-[100%]",children:(0,N.jsx)("div",{className:"flex w-full flex-1 flex-col items-start overflow-y-auto p-4 lg:h-full",children:(0,N.jsx)("div",{className:"w-full space-y-6",children:i.map((e,t)=>(0,N.jsxs)("div",{className:"rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsxs)("div",{className:"border-b border-gray-200 bg-gray-50/50 px-4 py-3 dark:border-gray-700 dark:bg-gray-800/50",children:[(0,N.jsx)("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:e.title||"Lyrics ".concat(t+1)}),e.status&&(0,N.jsx)("span",{className:"mt-1 inline-block rounded-full px-2 py-0.5 text-xs ".concat("complete"===e.status?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"),children:"complete"===e.status?"Complete":e.status})]}),(0,N.jsxs)("div",{className:"p-4",children:[(0,N.jsx)("div",{className:"whitespace-pre-line break-words text-sm leading-7 text-gray-900 dark:text-gray-100",children:e.text||e.lyrics||""}),e.errorMessage&&(0,N.jsx)("div",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:e.errorMessage})]})]},t))})})}):(0,N.jsxs)("div",{className:"flex w-full flex-col items-start rounded-xl p-3 shadow-sm lg:h-[80vh]",children:[(0,N.jsxs)("div",{className:"flex w-full items-start gap-2 rounded-lg bg-gray-50 p-4 dark:bg-gray-800",children:[(0,N.jsx)("span",{className:"aspect-square w-20 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsxs)("div",{className:"flex flex-1 flex-col items-start gap-2",children:[(0,N.jsx)("span",{className:"h-6 w-40 rounded-lg bg-gray-200 dark:bg-gray-700"}
1),(0,N.jsx)("span",{className:"h-6 w-1/2 rounded-lg bg-gray-200 dark:bg-gray-700"})]})]}),s&&(0,N.jsxs)("div",{className:"mt-4 flex w-full flex-col items-center justify-center gap-2 px-4 py-2",children:[(0,N.jsx)("div",{className:"relative h-1.5 w-full rounded-full bg-gray-200 dark:bg-gray-700",children:(0,N.jsx)("span",{style:{width:"".concat(s,"%")},className:"absolute left-0 top-0 h-full rounded-full bg-blue-500"})}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-center gap-1 text-xs text-blue-500",children:[(0,N.jsx)(tP.Z,{color:"#3b82f6",size:14}),(0,N.jsx)("span",{children:"Generating lyrics, please wait patiently..."})]})]})]})}var rD=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),[u,p]=(0,E.useState)(null),m=async e=>{if(!d){n(null),o({}),c(!0),p(null);try{var t;if(!e.prompt||""===e.prompt.trim())throw Error("Please enter a prompt");let r=null===(t=a.user)||void 0===t?void 0:t.apiKey;if(!r)throw Error("Please login and set your API key");let l={prompt:e.prompt.trim(),callBackUrl:"playground"},s=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/lyrics"),method:"post",data:l,headers:{Authorization:"Bearer ".concat(r)}});if(o(s.data||{}),200!==s.data.code)throw Error(s.data.msg||"Failed to initialize task");let i=s.data.data.taskId,d=0,u=setInterval(()=>{let e=Math.max(1,Math.min(Math.floor(d++/40*100),99));p(e),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/lyrics/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(r)},params:{taskId:i}}).then(e=>{var t;if(o(e.data||{}),200!==e.data.code)throw Error(e.data.msg||"Polling request failed");let a=e.data.data;n(a);let r=((null==a?void 0:null===(t=a.response)||void 0===t?void 0:t.data)||[]).some(e=>"complete"===e.status&&e.text);"SUCCESS"===a.status?(c(!1),p(null),clearInterval(u),r&&J.ZP.success("Lyrics generated successfully")):["CREATE_TASK_FAILED","GENERATE_LYRICS_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(a.status)&&(c(!1),p(null),clearInterval(u),J.ZP.error(a.errorMessage||"Lyrics generation failed"))}).catch(e=>{console.error("Polling error:",e)})},2e3)}catch(e){c(!1),p(null),J.ZP.error(e.message||"Failed to generate lyrics")}}};return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(rA,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(rP,{recordDetails:s,progress:u,generating:d}),run:()=>m(r),formData:r,outputData:i,generating:d,credit:(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e.suno_create_lyric)||0})});function rT(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({content:""})},[t,a]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))};return(0,N.jsx)("div",{className:"space-y-6",children:(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["content ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(tB,{value:(null==t?void 0:t.content)||"",onChange:e=>r("content",e.target.value),placeholder:"e.g. Create a melodic, emotional deep house song featuring organic textures and hypnotic rhythms...",rows:8,maxLength:3e3})]})})}function r_(e){let{recordDetails:t,generating:a}=e;return a?(0,N.jsxs)("div",{className:"flex h-64 flex-col items-center justify-center space-y-4 lg:h-[80vh]",children:[(0,N.jsx)(tS.Z,{color:"#3b82f6",size:10}),(0,N.jsx)("p",{className:"text-sm text-gray-500",children:"Refining your music style..."})]}):t&&t.result?(0,N.jsxs)("div",{className:"space-y-6 lg:h-[80vh]",children:[(0,N.jsxs)("div",{className:"flex flex-wrap gap-4",children:[(0,N.jsxs)("div",{className:"flex-1 rounded-xl bg-blue-50/50 p-4 dark:bg-blue-900/10",children:[(0,N.jsx)("h3",{className:"mb-1 text-xs font-medium text-blue-600 dark:text-blue-400",children:"Status"}),(0,N.jsx)("p",{className:"text-sm font-semibold text-blue-700 dark:text-blue-300",children:"Successfully Refined"})]}),void 0!==t.creditsConsumed&&(0,N.jsxs)("div",{className:"flex-1 rounded-xl bg-purple-50/50 p-4 dark:bg-purple-900/10",children:[(0,N.jsx)("h3",{className:"mb-1 text-xs font-medium text-purple-600 dar
1k:text-purple-400",children:"Credits Used"}),(0,N.jsx)("p",{className:"text-xl font-bold text-purple-700 dark:text-purple-300",children:t.creditsConsumed})]})]}),(0,N.jsxs)("div",{className:"rounded-xl border border-gray-200 dark:border-gray-700",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-200 bg-gray-50/50 px-4 py-3 dark:border-gray-700 dark:bg-gray-800/50",children:[(0,N.jsx)("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"Refined Style Result"}),(0,N.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(t.result),J.ZP.success("Copied to clipboard")},className:"flex items-center gap-1.5 text-xs font-medium text-blue-600 transition-colors hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:[(0,N.jsx)(D.JO,{icon:"solar:copy-bold-duotone",className:"h-4 w-4"}),"Copy"]})]}),(0,N.jsx)("div",{className:"max-h-[400px] overflow-y-auto p-4",children:(0,N.jsx)("div",{className:"whitespace-pre-wrap text-sm leading-relaxed text-gray-900 dark:text-gray-100",children:t.result})})]})]}):(0,N.jsxs)("div",{className:"flex h-64 flex-col items-center justify-center space-y-4 text-center text-gray-500 lg:h-[80vh]",children:[(0,N.jsx)(eI(),{src:"https://file.aiquickdraw.com/custom-page/image/17331216325012ytt9r73.webp",alt:"empty",width:128,height:128,className:"aspect-square w-32"}),(0,N.jsx)("p",{className:"max-w-xs px-4 text-sm",children:"Your refined music style will appear here. Enter a description and click 'Run' to start."})]})}var rR=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({content:""}),[s,n]=(0,E.useState)(null),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),u=async()=>{var e,t;if(d)return;if(!(null===(e=r.content)||void 0===e?void 0:e.trim())){J.ZP.error("Please enter a style description");return}let l=null===(t=a.user)||void 0===t?void 0:t.apiKey;if(!l){J.ZP.error("Please login and set your API key");return}c(!0),n(null),o({});try{let e=await fetch("".concat("https://api.kie.ai","/api/v1/style/generate"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(l)},body:JSON.stringify({content:r.content.trim()})}),t=await e.json();if(o(t||{}),!e.ok||(null==t?void 0:t.code)!==200)throw Error((null==t?void 0:t.msg)||"Failed to refine style");let a=t.data||{};if("2"===a.successFlag)throw Error(a.errorMessage||"Refining failed");n(a),J.ZP.success("Style refined successfully")}catch(e){J.ZP.error(e.message||"An error occurred")}finally{c(!1)}},p=(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e.suno_style_ai_generate)||0;return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(rT,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(r_,{recordDetails:s,generating:d}),run:u,formData:r,outputData:i,generating:d,credit:p})});let rF=e=>{let{items:t,onChange:a,maxItems:r=5,label:l="character_id_list",itemLabel:s="characterInput.character",placeholder:n="characterInput.inputPlaceholder",addButtonText:i="characterInput.clickToAdd",description:o}=e,[d,c]=(0,E.useState)(t||[""]);(0,E.useEffect)(()=>{void 0===t&&c([""])},[t]);let u=e=>{c(e),a(e.filter(Boolean))},{t:p}=(0,X.Z)("dashboard"),m=(0,E.useRef)([]),g=(0,E.useRef)(d.length),h=(e,t)=>{let a=[...d];a[e]=t,u(a)},x=e=>{u(d.filter((t,a)=>a!==e))};(0,E.useEffect)(()=>{if(d.length>g.current){let e=d.length-1;setTimeout(()=>{m.current[e]&&m.current[e].focus()},0)}g.current=d.length},[d.length]);let f=d.length<r;return(0,N.jsxs)("div",{className:"space-y-2",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsx)("label",{className:"text-base font-medium text-gray-700 dark:text-gray-300",children:l}),(0,N.jsxs)("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[d.length,"/",r]})]}),(0,N.jsxs)("div",{className:"space-y-3",children:[d.map((e,t)=>(0,N.jsxs)("div",{className:"relative rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800",children:[(0,N.jsxs)("div",{className:"mb-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:[s.includes(".")?p(s):s," ",t+1]}),(0,N.jsx)("input",{ref:e=>
1m.current[t]=e,type:"text",value:e,onChange:e=>h(t,e.target.value),placeholder:n.includes(".")?p(n):n,className:"w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("button",{onClick:()=>x(t),className:"absolute right-2 top-2 rounded p-1 text-gray-400 hover:bg-gray-200 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300",type:"button",children:(0,N.jsx)(ez.Z,{size:16})})]},t)),f&&(0,N.jsxs)("div",{className:"relative cursor-pointer rounded-lg border border-dashed border-gray-300 bg-gray-50 p-4 dark:border-gray-600 dark:bg-gray-800",onClick:()=>{d.length<r&&u([...d,""])},children:[(0,N.jsxs)("div",{className:"mb-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:[s.includes(".")?p(s):s," ",d.length+1]}),(0,N.jsx)("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:i.includes(".")?p(i):i})]})]}),o&&(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:o})]})};function rM(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({audioIds:[]})},[]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))};return(0,N.jsx)("div",{className:"space-y-6",children:(0,N.jsx)(rF,{items:(null==t?void 0:t.audioIds)||[""],onChange:e=>{r("audioIds",e)},maxItems:2,label:"Audio IDs",itemLabel:"Audio",placeholder:"Enter audio ID",addButtonText:"Click to add audio ID",description:"Enter up to 2 audio IDs to mashup lyrics from multiple audio tracks."})})}var rO=(0,Y.Pi)(()=>{let{userStore:e}=(0,_.o)(),[t,a]=(0,E.useState)({}),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)(!1),[d,c]=(0,E.useState)(null),u=async t=>{if(!i){l(null),n({}),o(!0),c(null);try{var a;if(!t.audioIds||0===t.audioIds.length)throw Error("Please enter at least one audio ID");if(t.audioIds.length>2)throw Error("Maximum 2 audio IDs allowed");let r=t.audioIds.filter(e=>e&&""!==e.trim());if(0===r.length)throw Error("Please enter at least one valid audio ID");let s=null===(a=e.user)||void 0===a?void 0:a.apiKey;if(!s)throw Error("Please login and set your API key");let i=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/lyrics/mashup"),method:"post",data:{audioIds:r,callBackUrl:"playground"},headers:{Authorization:"Bearer ".concat(s)}});if(n(i.data||{}),200!==i.data.code)throw Error(i.data.msg||"Failed to initialize task");let d=i.data.data.taskId,u=0,p=setInterval(()=>{let e=Math.max(1,Math.min(Math.floor(u++/40*100),99));c(e),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/lyrics/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(s)},params:{taskId:d}}).then(e=>{var t;if(n(e.data||{}),200!==e.data.code)throw Error(e.data.msg||"Polling request failed");let a=e.data.data;l(a);let r=((null==a?void 0:null===(t=a.response)||void 0===t?void 0:t.data)||[]).some(e=>"complete"===e.status&&e.text);"SUCCESS"===a.status?(o(!1),c(null),clearInterval(p),r&&J.ZP.success("Mashup lyrics generated successfully")):["CREATE_TASK_FAILED","GENERATE_LYRICS_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(a.status)&&(o(!1),c(null),clearInterval(p),J.ZP.error(a.errorMessage||"Mashup lyrics generation failed"))}).catch(e=>{console.error("Polling error:",e)})},2e3)}catch(e){o(!1),c(null),J.ZP.error(e.message||"Failed to generate mashup lyrics")}}};return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(rM,{formData:t,setFormData:a}),OutputPanelContent:(0,N.jsx)(rP,{recordDetails:r,progress:d,generating:i}),run:()=>u(t),formData:t,outputData:s,generating:i,credit:0})}),rL=function(e){let{uploadUrls:t=[],onUploadUrlsChange:a,required:r=!1,label:l="Audio Files",description:s="Upload up to 2 audio files",minFiles:n=2,maxFiles:i=2,bucket:o="kieai/market",className:d=""}=e,c=Math.min(n,i),u=Math.max(n,i),p=(0,E.useRef)([]);if(p.current.length<u)for(;p.current.length<u;)p.current.push(E.createRef());else p.current.length>u&&(p.current=p.current.slice(0,u));let m=p.current,[g,h]=(0,E.useState)(c),[x,f]=(0,E.useState)(Array.from({length:u},()=>!1)),[y,v]=(0,E.useState)(Array.from({length:u},()=>null)),[b,w]=(0,E.useState)(Array.from({length:u},()=>"")),j=(0,E.useRef)(t),k=(0,E.useRef)(g);(0,E.useEffect)(()=>{j.current=t},[t]),(0,E.useEffect)(()=>{k.current=g},[g]),(0,E.useEffect)(()=>{w(e=>Array.from({length:u},(a,r)=>{let l=t[r];return l&&""!==l.trim()?e[r]||l:""}));let e=t.filter(e=>e&&""!==e.trim()).length;h(t=>{let a=Math.max(c,Math.min(u,Math.max(t,e+1)));return a<=u?a:t})},[t,u,c]);let C=(0,E.useCallback)(async(e,t)=>{let r=e.target.files[0];if(!r)return;if(!t_.YO.some(e=>r.type===e||r.name.toLowerCase().endsWith(e.split("/")[1]))){J.ZP.error("Please upload a valid audio file (MP3, WAV, OGG, M4A, FLAC, AAC)");return}if(r.size>209715200){J.ZP.error("File size exceeds 200MB limit");return}let l=j.current;if(l.filter(e=>e&&""!==e.trim()).length>=u&&!l[t]){J.ZP.error("Maximum ".concat(u," files allowed"));return}f(e=>{let a=[...e];return a[t]=!0,a});let s=J.ZP.loading("Uploading audio file ".concat(t+1,"..."));try{let e=await (0,eK._R)(r,o),l=URL.createObjectURL(r);v(e=>{let a=[...e];for(;a.length<=t;)a.push(null);return a[t]=r,a}),w(e=>{let a=[...e];for(;a.length<=t;)a.push("");return a[t]=l,a});let n=[...j.current];for(;n.length<=t;)n.push("");n[t]=e,a&&a(n);let i=n.filter(e=>e&&""!==e.trim()).length,d=k.current;i>=d&&d<u&&h(d+1),J.ZP.dismiss(s),J.ZP.success("Audio file ".concat(t+1," uploaded successfully"))}catch(e){J.ZP.dismiss(s),J.ZP.error("Upload failed, please try again")}finally{f(e=>{let a=[...e];return a[t]=!1,a}
1)}},[u,o,a]),I=(0,E.useCallback)(e=>{let t=j.current,r=k.current;if(w(t=>(t[e]&&URL.revokeObjectURL(t[e]),t)),r>c){v(t=>{let a=[...t];for(let t=e;t<r-1;t++)a[t]=a[t+1];return a[r-1]=null,a}),w(t=>{let a=[...t];for(let t=e;t<r-1;t++)a[t]=a[t+1];return a[r-1]&&a[r-1]!==a[r-2]&&URL.revokeObjectURL(a[r-1]),a[r-1]="",a}),h(r-1);let l=[...t];for(let t=e;t<r-1;t++)l[t]=l[t+1];l[r-1]="";let s=l.slice(0,r-1);a&&a(s)}else{v(t=>{let a=[...t];return a[e]=null,a}),w(t=>{let a=[...t];return a[e]="",a});let r=[...t];r[e]="",a&&a(r)}m[e]&&m[e].current&&(m[e].current.value="")},[c,m,a]);return(0,N.jsxs)("div",{className:d,children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:[l,r&&(0,N.jsx)("span",{className:"text-red-500",children:" *"})]}),(0,N.jsx)("div",{className:"space-y-4",children:Array.from({length:g},(e,t)=>(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-xs font-medium text-gray-600 dark:text-gray-400",children:["Audio ",t+1]}),(0,N.jsx)(ai,{fileInputRef:m[t],uploadedFile:y[t]||null,previewUrl:b[t]||"",uploadLoading:x[t]||!1,onFileChange:e=>C(e,t),onRemoveFile:()=>I(t),accept:"audio/mpeg,audio/wav,audio/ogg",maxSize:"Max 200MB"})]},t))}),s&&(0,N.jsx)("div",{className:"mt-2",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s})})]})};function rB(e){var t;let{formData:a,setFormData:r}=e;(0,E.useEffect)(()=>{a&&0!==Object.keys(a).length||r({model:t_.aC[0].type,lyrics:"",title:"",style:"",personaId:"",personaModel:"style_persona",vocalGender:"m",audioWeight:.65,styleWeight:.65,weirdnessConstraint:.65,variety:t_.cZ,uploadUrlList:[]})},[]);let l=(e,t)=>{r(a=>({...a,[e]:t}))},s=(e,t)=>{r(a=>({...a||{},[e]:t}))},n=(t_.aC.find(e=>e.type===((null==a?void 0:a.model)||t_.aC[0].type))||t_.aC[0]).style_maxlength||200;return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsx)(tU.Z,{label:"Model",options:t_.aC,value:null==a?void 0:a.model,onChange:e=>{s("model",e)},onBlur:e=>l("model",e),getOptionValue:e=>e.type,getOptionLabel:e=>e.title,maxHeight:320,required:!0}),(0,N.jsx)(rL,{uploadUrls:(null==a?void 0:a.uploadUrlList)||[],onUploadUrlsChange:e=>{s("uploadUrlList",e)},required:!0,label:"Audio Files",description:"Upload up to 2 audio files to mashup music from multiple audio tracks.",minFiles:2,maxFiles:2}),(0,N.jsxs)("div",{className:"space-y-4",children:[(0,N.jsx)(tZ,{label:"Title",required:!0,name:"title",value:(null==a?void 0:a.title)||"",onChange:e=>s("title",e.target.value),onBlur:e=>l("title",e.target.value),placeholder:"Enter a title"}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["Style of Music ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(tB,{value:(null==a?void 0:a.style)||"",onChange:e=>s("style",e.target.value),onBlur:e=>l("style",e.target.value),rows:3,maxLength:n,placeholder:"Enter style of music"})]}),(0,t_.uB)(null==a?void 0:a.model,"durationEnable")&&(0,N.jsx)(tq,{label:"duration",value:null==a?void 0:a.duration,onChange:e=>s("duration",e),onBlur:e=>l("duration",e),min:10,max:360,step:1,initialValue:20})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Lyrics"}),(0,N.jsx)(tB,{value:(null==a?void 0:a.lyrics)||"",onChange:e=>s("lyrics",e.target.value),onBlur:e=>l("lyrics",e.target.value),rows:6,maxLength:5e3,placeholder:"Write your own lyrics, two verses (8 lines) for the best result"})]}),(0,N.jsx)(tU.Z,{label:"vocalGender",options:t_.I8,value:(null==a?void 0:a.vocalGender)||"m",onChange:e=>s("vocalGender",e),onBlur:e=>l("vocalGender",e),variant:"simple"}),(0,N.jsx)(tq,{label:"audioWeight",value:null==a?void 0:a.audioWeight,onChange:e=>s("audioWeight",e),onBlur:e=>l("audioWeight",e),min:0,max:1,step:.05,initialValue:.65}),(0,N.jsx)(tq,{label:"styleWeight",value:null==a?void 0:a.styleWeight,onChange:e=>s("styleWeight",e),onBlur:e=>l("styleWeight",e),min:0,max:1,step:.05,initialValue:.65}),(0,N.jsx)(tq,{label:"weirdnessConstraint",value:null==a?void 0:a.weirdnessConstraint,onChange:e=>s("weirdnessConstraint",e),onBlur:e=>
1l("weirdnessConstraint",e),min:0,max:1,step:.05,initialValue:.65}),(0,N.jsx)(tU.Z,{label:"variety",options:t_.wg,value:null!==(t=null==a?void 0:a.variety)&&void 0!==t?t:t_.cZ,onChange:e=>s("variety",e),onBlur:e=>l("variety",e)}),(0,N.jsx)(tZ,{label:"personaId",name:"personaId",value:(null==a?void 0:a.personaId)||"",onChange:e=>s("personaId",e.target.value),onBlur:e=>l("personaId",e.target.value),placeholder:"Enter persona ID"}),(null==a?void 0:a.personaId)&&(0,N.jsx)(tz,{label:"personaModel",name:"personaModel",options:[{value:"style_persona",label:"Style Persona"},{value:"voice_persona",label:"Voice Persona",disabled:!(0,t_.uB)(null==a?void 0:a.model,"voicePersonaEnable")}],value:(null==a?void 0:a.personaModel)||"style_persona",onChange:e=>s("personaModel",e)})]})}let rU=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={uploadUrlList:e.uploadUrlList||[],model:e.model||t_.aC[0].type,callBackUrl:"playground",title:e.title||"",style:e.style||"",lyrics:e.lyrics||"",vocalGender:e.vocalGender||"m"};t8(t,"audioWeight",e.audioWeight),t8(t,"styleWeight",e.styleWeight),t8(t,"weirdnessConstraint",e.weirdnessConstraint);let a=Number(e.duration),r=!t9(e.duration)&&Number.isInteger(a)&&a>=10&&a<=360;(0,t_.uB)(e.model,"durationEnable")&&r&&(t.duration=a),e.personaId&&(t.personaId=e.personaId,t.personaModel=e.personaModel||"style_persona");let l=Number(e.variety);return t.variety=!t9(e.variety)&&Number.isInteger(l)&&l>=0&&l<=4?l:t_.cZ,t};var rZ=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)(t_.KD||{}),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),[u,p]=(0,E.useState)(null),[m,g]=(0,E.useState)({});(0,E.useEffect)(()=>{g(rU(r))},[r]);let h=async e=>{if(!d){n(null),o({}),c(!0);try{var t,r,l,s;if(!e.uploadUrlList||0===e.uploadUrlList.length)throw Error("Please upload at least one valid audio file");if(e.uploadUrlList.length>2)throw Error("Maximum 2 audio files allowed");if(e.uploadUrlList.filter(e=>!e||""===e.trim()).length)throw Error("Please upload two valid audio files");if(!e.title||!e.style)throw Error("Please enter title and style of music");if((0,t_.uB)(e.model,"durationEnable")&&!t9(e.duration)){let t=Number(e.duration);if(!Number.isInteger(t)||t<10||t>360)throw Error("Duration must be an integer between 10 and 360")}let i=null===(t=a.user)||void 0===t?void 0:t.apiKey;if(!i)throw Error("Please login and set your API key");let d=rU(e),u=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/mashup"),method:"post",data:d,headers:{Authorization:"Bearer ".concat(i)}});if(o(u.data||{}),200!==u.data.code)throw Error(u.data.msg||"Failed to initialize task");let m=null===(r=u.data)||void 0===r?void 0:r.data,g="";if("string"==typeof m?g=m:m&&"object"==typeof m&&(g=m.taskId||m.taskid||""),g||(g=(null===(l=u.data)||void 0===l?void 0:l.taskId)||(null===(s=u.data)||void 0===s?void 0:s.taskid)||""),!g)throw Error("No taskId returned");let h=0,x=setInterval(()=>{let e=Math.max(1,Math.min(Math.floor(h++/40*100),99));p(e),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(i)},params:{taskId:g}}).then(e=>{if(o(e.data||{}),200!==e.data.code)throw Error(e.data.msg||"Polling request failed");let t=e.data.data||e.data,a=t.data||t;n(a),"SUCCESS"===a.status?(c(!1),p(null),clearInterval(x)):["CREATE_TASK_FAILED","GENERATE_AUDIO_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(a.status)&&(c(!1),p(null),clearInterval(x))}).catch(e=>{J.ZP.error(e.message||"Polling request failed")})},4e3)}catch(e){c(!1),J.ZP.error(e.message||"Failed to mashup")}}},x=t_.aC.find(e=>e.type===r.model);return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(rB,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(tR,{recordDetails:s,progress:u,generating:d}),run:()=>h(r),formData:m,outputData:i,generating:d,credit:(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e[null==x?void 0:x.creditMashupName])||0})});let rz=t_.aC.filter(e=>e.creditRemasterName),rq=[{value:"Subtle",label:"Subtle"},{value:"Normal",label:"Normal"},{value:"High",label:"High"}
1];function rK(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({model:rz[0].type,audioId:"",quality:"Normal"})},[]);let r=(e,t)=>{a(a=>({...a,[e]:t}))},l=(e,t)=>{a(a=>({...a||{},[e]:t}))},s=(0,t_.uB)(null==t?void 0:t.model,"qualityEnable");return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsx)(tU.Z,{label:"Model",options:rz,value:null==t?void 0:t.model,onChange:e=>{l("model",e)},onBlur:e=>r("model",e),getOptionValue:e=>e.type,getOptionLabel:e=>e.title,maxHeight:320,required:!0}),(0,N.jsx)(tZ,{label:"Audio ID",required:!0,name:"audioId",value:(null==t?void 0:t.audioId)||"",onChange:e=>l("audioId",e.target.value),onBlur:e=>r("audioId",e.target.value),placeholder:"Enter audio ID"}),s&&(0,N.jsx)(tU.Z,{label:"Quality",options:rq,value:null==t?void 0:t.quality,onChange:e=>{l("quality",e)},onBlur:e=>r("quality",e),getOptionValue:e=>e.value,getOptionLabel:e=>e.label,variant:"simple"})]})}var rG=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),[u,p]=(0,E.useState)(null),m=async e=>{if(!d){n(null),o({}),c(!0);try{var t;if(!e.audioId)throw Error("Please enter audio ID");let r={audioId:e.audioId,model:e.model||rz[0].type,callBackUrl:"playground"};(0,t_.uB)(e.model,"qualityEnable")&&e.quality&&(r.quality=e.quality);let l=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/remaster"),method:"post",data:r,headers:{Authorization:"Bearer ".concat(null===(t=a.user)||void 0===t?void 0:t.apiKey)}});if(o(l.data||{}),200!==l.data.code)throw Error(l.data.message||"Failed to initialize task");let s=l.data.data.taskId,i=0,d=setInterval(()=>{var e;let t=Math.max(1,Math.min(Math.floor(i++/40*100),99));p(t),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(null===(e=a.user)||void 0===e?void 0:e.apiKey)},params:{taskId:s}}).then(e=>{if(o(e.data||{}),200!==e.data.code)throw Error("Polling request failed");let t=e.data.data,a=t.data||t;n(a),"SUCCESS"===a.status?(c(!1),p(null),clearInterval(d)):["CREATE_TASK_FAILED","GENERATE_AUDIO_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(a.status)&&(c(!1),p(null),clearInterval(d))}).catch(()=>{})},2e3)}catch(e){c(!1),p(null),J.ZP.error(e.message||"Generation failed")}}},g=rz.find(e=>e.type===r.model);return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(rK,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(tR,{recordDetails:s,progress:u,generating:d}),run:()=>m(r),formData:r,outputData:i,generating:d,credit:(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e[null==g?void 0:g.creditRemasterName])||0})});let rW=t_.aC.filter(e=>e.soundsEnable).map(e=>({value:e.type,label:e.title,creditSoundsName:e.creditSoundsName})),rV=[{value:"Any",label:"Any"},{value:"Cm",label:"Cm"},{value:"C#m",label:"C#m"},{value:"Dm",label:"Dm"},{value:"D#m",label:"D#m"},{value:"Em",label:"Em"},{value:"Fm",label:"Fm"},{value:"F#m",label:"F#m"},{value:"Gm",label:"Gm"},{value:"G#m",label:"G#m"},{value:"Am",label:"Am"},{value:"A#m",label:"A#m"},{value:"Bm",label:"Bm"},{value:"C",label:"C"},{value:"C#",label:"C#"},{value:"D",label:"D"},{value:"D#",label:"D#"},{value:"E",label:"E"},{value:"F",label:"F"},{value:"F#",label:"F#"},{value:"G",label:"G"},{value:"G#",label:"G#"},{value:"A",label:"A"},{value:"A#",label:"A#"},{value:"B",label:"B"}];function rH(e){var t;let{formData:a,setFormData:r}=e;(0,E.useEffect)(()=>{a&&0!==Object.keys(a).length||r({model:"V6",prompt:"",grabLyrics:!1,sound_loop:!1,sound_tempo:null,sound_key:"Any"})},[]);let l=(e,t)=>{r(a=>({...a||{},[e]:t}))},s=(e,t)=>{r(a=>({...a||{},[e]:t}))},n=(e,t)=>{r(a=>({...a||{},[e]:t}))};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsx)(tU.Z,{label:"Model",options:rW,value:null==a?void 0:a.model,onChange:e=>s("model",e),onBlur:e=>l("model",e),getOptionValue:e=>e.value,getOptionLabel:e=>e.label,variant:"simple",required:!0}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["prompt ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(tB,{value:(null==a?void 0:a.prompt)||"",onChange:e=>s("prompt",e.target.value),onBlur:e=>l("prompt",e.target.value),rows:6,maxLength:500,placeholder:"Describe the sound effect you want to generate"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"sounds task type supports up to 500 characters."})})]}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,N.jsxs)("div",{className:"flex flex-1 flex-col items-start gap-1",children:[(0,N.jsx)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"grabLyrics"}),(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Whether to fetch lyric subtitles after generation is completed."})]}),(0,N.jsx)("div",{className:"inline-flex items-center justify-end gap-2",children:(0,N.jsx)(tF.rs,{checked:!!(null==a?void 0:a.grabLyrics),onChange:e=>n("grabLyrics",e),className:"group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition duration-500 ease-in-out focus:outline-none data-[checked]:bg-blue-500",children:(0,N.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5"})})})]}),(0,N.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,N.jsxs)("div",{className:"flex flex-1 flex-col items-start gap-1",children:[(0,N.jsx)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"sound_loop"}),(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Whether to loop the generated sound."})]}),(0,N.jsx)("div",{className:"inline-flex items-center justify-end gap-2",children:(0,N.jsx)(tF.rs,{checked:!!(null==a?void 0:a.sound_loop),onChange:e=>n("sound_loop",e),className:"group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition duration-500 ease-in-out focus:outline-none data-[checked]:bg-blue-500",children:(0,N.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5"})})})]}),(0,N.jsx)(tZ,{label:"sound_tempo",type:"number",name:"sound_tempo",value:null!==(t=null==a?void 0:a.sound_tempo)&&void 0!==t?t:"",onChange:e=>{let t=e.target.value;s("sound_tempo",""===t?null:Number(t))},onBlur:e=>{let t=e.target.value;l("sound_tempo",""===t?null:Number(t))}
1,placeholder:"Auto",description:"BPM, valid range is 1-300. Empty means Auto."}),(0,N.jsx)(tU.Z,{label:"sound_key",options:rV,value:null==a?void 0:a.sound_key,onChange:e=>s("sound_key",e),onBlur:e=>l("sound_key",e),getOptionValue:e=>e.value,getOptionLabel:e=>e.label,variant:"simple",maxHeight:240})]})}var rJ=(0,Y.Pi)(()=>{var e,t,a;let{userStore:r}=(0,_.o)(),[l,s]=(0,E.useState)({}),[n,i]=(0,E.useState)({}),[o,d]=(0,E.useState)({}),[c,u]=(0,E.useState)(!1),[p,m]=(0,E.useState)(null),g=async e=>{if(!c){i(null),d({}),u(!0),m(null);try{var t,a;let l=(null==e?void 0:null===(t=e.prompt)||void 0===t?void 0:t.trim())||"",s=(null==e?void 0:e.model)||"V6",n=null==e?void 0:e.sound_tempo,o=(null==e?void 0:e.sound_key)||"Any";if(!l)throw Error("Please enter prompt");if("boolean"!=typeof(null==e?void 0:e.grabLyrics))throw Error("Please set grabLyrics");if(l.length>500)throw Error("Prompt cannot exceed 500 characters");if(null!=n){if(Number.isNaN(Number(n)))throw Error("sound_tempo must be a number");if(1>Number(n)||Number(n)>300)throw Error("sound_tempo must be between 1 and 300")}let c=null===(a=r.user)||void 0===a?void 0:a.apiKey;if(!c)throw Error("Please login and set your API key");let p={model:s,prompt:l,grabLyrics:!!(null==e?void 0:e.grabLyrics),sound_loop:!!(null==e?void 0:e.sound_loop),sound_key:o,callBackUrl:"playground"};null!=n&&(p.sound_tempo=Number(n));let g=await (0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/sounds"),method:"post",data:p,headers:{Authorization:"Bearer ".concat(c)}});if(d(g.data||{}),200!==g.data.code)throw Error(g.data.msg||g.data.message||"Failed to initialize task");let h=g.data.data.taskId,x=0,f=setInterval(()=>{let e=Math.max(1,Math.min(Math.floor(x++/40*100),99));m(e),(0,tC.Z)({url:"".concat("https://api.kie.ai","/api/v1/generate/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(c)},params:{taskId:h}}).then(e=>{if(d(e.data||{}),200!==e.data.code)throw Error(e.data.msg||"Polling request failed");let t=e.data.data,a=t.data||t;i(a),"SUCCESS"===a.status?(u(!1),m(null),clearInterval(f),J.ZP.success("Generated successfully")):["CREATE_TASK_FAILED","GENERATE_AUDIO_FAILED","CALLBACK_EXCEPTION","SENSITIVE_WORD_ERROR"].includes(a.status)&&(u(!1),m(null),clearInterval(f))}).catch(()=>{})},2e3)}catch(e){u(!1),m(null),J.ZP.error(e.message||"Generation failed")}}},h=null===(e=rW.find(e=>e.value===(null==l?void 0:l.model)))||void 0===e?void 0:e.creditSoundsName,x=null===(a=r.user)||void 0===a?void 0:null===(t=a.consumeCreditsMap)||void 0===t?void 0:t[h];return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(rH,{formData:l,setFormData:s}),OutputPanelContent:(0,N.jsx)(tR,{recordDetails:n,progress:p,generating:c}),run:()=>g(l),formData:l,outputData:o,generating:c,credit:x})});let r$=e=>Array.isArray(e)?e.map(e=>({...e,id:(null==e?void 0:e.id)||"",title:(null==e?void 0:e.title)||"",audioUrl:(null==e?void 0:e.audioUrl)||(null==e?void 0:e.audio_url)||"",errorMessage:(null==e?void 0:e.error)||(null==e?void 0:e.errorMessage)||""})):[],rY=e=>{var t;return Array.isArray(e)?r$(e):r$((null==e?void 0:null===(t=e.response)||void 0===t?void 0:t.sunoData)||(null==e?void 0:e.data)||[])},rX=e=>"string"==typeof(null==e?void 0:e.data)&&e.data?e.data:(null==e?void 0:e.msg)||(null==e?void 0:e.message)||"Recovery failed";function rQ(e){var t,a;let{formData:r,setFormData:l}=e;(0,E.useEffect)(()=>{r&&0!==Object.keys(r).length||l({task_id:"",call_back_url:""})},[]);let s=(e,t)=>{l(a=>({...a||{},[e]:t}))},n=(e,t)=>{l(a=>({...a||{},[e]:t}))};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsx)(tZ,{label:"task_id",required:!0,name:"task_id",value:null!==(t=null==r?void 0:r.task_id)&&void 0!==t?t:"",onChange:e=>s("task_id",e.target.value),onBlur:e=>n("task_id",e.target.value),placeholder:"Enter the original Suno generation task id",description:"The task id of the original Suno generation task whose music links you want to recover."}),(0,N.jsx)(tZ,{label:"call_back_url",required:!0,name:"call_back_url",value:null!==(a=null==r?void 0:r.call_back_url)&&void 0!==a?a:"",onChange:e=>s("call_back_url",e.target.value),onBlur:e=>n("call_back_url",e.target.value),placeholder:"https://example.com/callback",description:"Callback url notified when the task finishes. The recovery result is pushed to this address."})]})}var r0=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),[u,p]=(0,E.useState)(null),m=(0,E.useRef)(null);(0,E.useEffect)(()=>()=>{m.current&&(clearInterval(m.current),m.current=null)},[]);let g=()=>{m.current&&(clearInterval(m.current),m.current=null),c(!1),p(null)},h=e=>{g(),n({status:"GENERATE_AUDIO_FAILED",errorMessage:e}),J.ZP.error(e)},x=e=>{let t=e.filter(e=>e.audioUrl),a=e.filter(e=>!e.audioUrl);if(0===t.length){var r;h((null===(r=a[0])||void 0===r?void 0:r.errorMessage)||"No audio url was recovered");return}g(),n({status:"SUCCESS",response:{sunoData:t}}),J.ZP.success("Recovered successfully"),a.length>0&&J.ZP.error("".concat(a.length," item(s) failed, see the JSON tab for details"))},f=e=>{if(201===e.code)return;if(200!==e.code){h(rX(e));return}let t=e.data,a=Array.isArray(t)?"":(null==t?void 0:t.status)||"";if(t_.Ti.includes(a)){h((null==t?void 0:t.errorMessage)||"Recovery failed");return}if(a&&"SUCCESS"!==a)return;let r=rY(t);(0!==r.length||a)&&x(r)},y=(e,t)=>{let a=0;m.current=setInterval(()=>{p(Math.max(1,Math.min(Math.floor(a++/40*100),99))),(0,tC.Z)({url:"".concat("https://api.kie.ai").concat("/api/v1/suno/recovery/record-info"),method:"get",headers:{Authorization:"Bearer ".concat(t)},params:{task_id:e}}).then(e=>{let t=e.data||{};o(t),f(t)}).catch(()=>{})},2e3)},v=async e=>{if(!d){m.current&&(clearInterval(m.current),m.current=null),n(null),o({}),c(!0),p(null);try{var t,r,l,s,i,u,g;let n=(null==e?void 0:null===(t=e.task_id)||void 0===t?void 0:t.trim())||"";if(!n)throw Error("Please enter task_id");let d=null===(r=a.user)||void 0===r?void 0:r.apiKey;if(!d)throw Error("Please login and set your API key");let c=(null==e?void 0:null===(l=e.call_back_url)||void 0===l?void 0:l.trim())||"";if(!c)throw Error("Please enter call_back_url");let p=await (0,tC.Z)({url:"".concat("https://api.kie.ai").concat("/api/v1/suno/recovery"),method:"post",data:{task_id:n,call_back_url:c},headers:{Authorization:"Bearer ".concat(d)}});if(o(p.data||{}),(null===(s=p.data)||void 0===s?void 0:s.code)!==200)throw Error((null===(u=p.data)||void 0===u?void 0:u.msg)||(null===(g=p.data)||void 0===g?void 0:g.message)||"Failed to initialize task");
1let m=null===(i=p.data)||void 0===i?void 0:i.data,h="string"==typeof m?m:(null==m?void 0:m.taskId)||(null==m?void 0:m.task_id)||"";if(!h)throw Error("Task id is missing in the response");y(h,d)}catch(e){c(!1),p(null),J.ZP.error(e.message||"Recovery failed")}}};return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(rQ,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(tR,{recordDetails:s,progress:u,generating:d}),run:()=>v(r),formData:r,outputData:i,generating:d,credit:(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e.suno_restore_link)||0})}),r1=e=>{let{pageData:t}=e;switch(t.model){case"ai-music-api/extend":return(0,N.jsx)(av,{pageData:t});case"ai-music-api/generate":return(0,N.jsx)(ar,{pageData:t});case"ai-music-api/create-music-video":return(0,N.jsx)(an,{pageData:t});case"ai-music-api/upload-and-cover-audio":return(0,N.jsx)(ac,{pageData:t});case"ai-music-api/upload-and-extend-audio":return(0,N.jsx)(am,{pageData:t});case"ai-music-api/convert-to-wav-format":return(0,N.jsx)(ax,{pageData:t});case"ai-music-api/add-instrumental":return(0,N.jsx)(aj,{pageData:t});case"ai-music-api/generate-midi-from-audio":return(0,N.jsx)(aA,{pageData:t});case"ai-music-api/separate-vocals":return(0,N.jsx)(aT,{pageData:t});case"ai-music-api/add-vocals":return(0,N.jsx)(aF,{pageData:t});case"ai-music-api/timeStamped-lyrics":return(0,N.jsx)(aZ,{pageData:t});case"ai-music-api/cover-generate":return(0,N.jsx)(aK,{pageData:t});case"ai-music-api/generate-persona":return(0,N.jsx)(aH,{pageData:t});case"ai-music-api/generate-voice":return(0,N.jsx)(rk,{pageData:t});case"ai-music-api/check-voice":return(0,N.jsx)(rN,{pageData:t});case"ai-music-api/regenerate-voice":return(0,N.jsx)(rE,{pageData:t});case"ai-music-api/replace-section":return(0,N.jsx)(rS,{pageData:t});case"ai-music-api/generate-lyrics":return(0,N.jsx)(rD,{pageData:t});case"ai-music-api/boost-music-style":return(0,N.jsx)(rR,{pageData:t});case"ai-music-api/mashup-lyrics":return(0,N.jsx)(rO,{pageData:t});case"ai-music-api/mashup":return(0,N.jsx)(rZ,{pageData:t});case"ai-music-api/remaster":return(0,N.jsx)(rG,{pageData:t});case"ai-music-api/sounds":return(0,N.jsx)(rJ,{pageData:t});case"ai-music-api/suno-recovery-audio":return(0,N.jsx)(r0,{pageData:t});default:return(0,N.jsx)(tj.h,{})}},r2=a(76546);function r5(e){let{recordDetails:t,generating:a}=e,[r,l]=(0,E.useState)(!1),s=async e=>{if(e){l(!0);try{J.ZP.loading("Downloading video...");let t=await fetch(e),a=await t.blob(),r=window.URL.createObjectURL(a),l=document.createElement("a");l.href=r,l.download="video-".concat(Date.now(),".mp4"),document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(r),J.ZP.dismiss(),J.ZP.success("Video downloaded successfully!")}catch(e){J.ZP.dismiss(),J.ZP.error("Failed to download video")}finally{l(!1)}}};return(0,N.jsx)("div",{className:"relative m-auto flex w-full flex-col items-center justify-center lg:h-[60vh] lg:w-[100%]",children:(0,N.jsx)("div",{className:"flex w-full flex-1 flex-col-reverse items-start justify-between overflow-y-auto p-4 lg:h-full lg:flex-row",children:(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-start gap-2",children:(()=>{var e,l,n,i;if((null==t?void 0:t.successFlag)===3||(null==t?void 0:t.status)==="FAILED"||(null==t?void 0:t.errorMessage))return(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 whitespace-pre-line py-6 text-center text-rose-600",children:[(0,N.jsx)(eI(),{src:"https://static.aiquickdraw.com/tools/example/1769078665776_Hn1MMDiA.png",alt:"failed",width:144,height:144,className:"aspect-square w-36"}),(0,N.jsx)("p",{children:"Generation Failed"}),(null==t?void 0:t.errorMessage)&&(0,N.jsx)("p",{className:"text-sm text-gray-500",children:t.errorMessage})]});if(!t)return a?(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,N.jsxs)("div",{className:"relative w-2/3 overflow-hidden rounded-xl",children:[(0,N.jsx)(eI(),{width:600,height:600,src:"https://file.aiquickdraw.com/custom-page/image/1733384621863dr5jxiyq.webp",alt:"processing",className:"w-full"}),(0,N.jsx)("div",{className:"absolute left-1/2 top-1/2 inline-block -translate-x-1/2 -translate-y-1/2",children:(0,N.jsx)("div",{className:"h-16 w-16 animate-spin rounded-full border-4 border-blue-500 border-t-transparent"})})]}),(0,N.jsx)("p",{className:"flex w-full items-center justify-center gap-2 text-gray-600 dark:text-gray-400",children:"Processing video conversion..."}),(0,N.jsx)("p",{className:"mt-1 w-full whitespace-pre-wrap break-words px-3 text-center text-sm text-gray-500 dark:text-gray-500",children:"This may take 1-3 minutes"})]})}):(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:[(0,N.jsx)(eI(),{src:"https://static.aiquickdraw.com/tools/example/1769078665776_Hn1MMDiA.png",alt:"video placeholder",width:144,height:144,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Enter a task ID to get the video version of your video."})]});let o=(null==t?void 0:null===(e=t.full_result_urls)||void 0===e?void 0:e[0])||(null==t?void 0:t.videoUrl)||(null==t?void 0:t.resultUrl)||(null==t?void 0:null===(l=t.resultUrls)||void 0===l?void 0:l[0])||(null==t?void 0:null===(i=t.response)||void 0===i?void 0:null===(n=i.resultUrls)||void 0===n?void 0:n[0]);return o?(0,N.jsxs)("div",{className:"flex h-[inherit] w-full flex-col items-end gap-4 roun
1ded-xl p-3 shadow-sm",children:[(0,N.jsx)("div",{className:"relative flex w-full items-center justify-center",children:(0,N.jsx)("video",{src:o,controls:!0,className:"h-full w-auto rounded-lg",children:"Your browser does not support the video tag."})}),(0,N.jsx)("button",{onClick:()=>s(o),disabled:r,className:"flex h-9 w-9 items-center justify-center rounded-lg bg-primary text-white opacity-70 transition duration-500 hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-50",title:"Download video",children:r?(0,N.jsx)("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,N.jsx)(D.JO,{icon:"material-symbols:download",className:"h-5 w-5"})})]}):(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,N.jsxs)("div",{className:"relative w-2/3 overflow-hidden rounded-xl",children:[(0,N.jsx)(eI(),{width:600,height:600,src:"https://file.aiquickdraw.com/custom-page/image/1733384621863dr5jxiyq.webp",alt:"processing",className:"w-full"}),(0,N.jsx)("div",{className:"absolute left-1/2 top-1/2 inline-block -translate-x-1/2 -translate-y-1/2",children:(0,N.jsx)("div",{className:"h-16 w-16 animate-spin rounded-full border-4 border-blue-500 border-t-transparent"})})]}),(0,N.jsx)("p",{className:"flex w-full items-center justify-center gap-2 text-gray-600 dark:text-gray-400",children:"Converting to video..."}),(0,N.jsx)("p",{className:"mt-1 w-full whitespace-pre-wrap break-words px-3 text-center text-sm text-gray-500 dark:text-gray-500",children:"This may take 1-3 minutes"})]})})})()})})})}function r4(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({taskId:"",index:0,callBackUrl:"playground"})},[]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))},l=(e,t)=>{a(a=>({...a||{},[e]:t}))};return(0,N.jsx)("div",{className:"space-y-6",children:(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["taskId ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.taskId)||"",onChange:e=>l("taskId",e.target.value),onBlur:e=>r("taskId",e.target.value),placeholder:"Enter video generation task ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Task ID from a completed video generation task"})})]})})}var r3=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)(null),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),u=e=>{var t,a;return(null==e?void 0:e.resultUrl)||(null==e?void 0:null===(t=e.resultUrls)||void 0===t?void 0:t[0])||(null==e?void 0:e.result_url)||(null==e?void 0:null===(a=e.result_url)||void 0===a?void 0:a[0])},p=e=>"string"==typeof e?e:e&&"object"==typeof e&&(e.taskId||e.taskid)||"",m=e=>{c(!1),n({successFlag:3,status:"FAILED",errorMessage:e.message||"Failed to get 1080p video"}),J.ZP.error(e.message||"Failed to get 1080p video")},g=async e=>{if(!d){c(!0),n(null),o({});try{var t;if(!e.taskId)throw Error("Please enter task ID");let r=null===(t=a.user)||void 0===t?void 0:t.apiKey;if(!r)throw Error("Please login and set your API key");let l={taskId:e.taskId,index:e.index||0},s=await fetch("".concat("https://api.kie.ai","/api/v1/veo/get-1080p-video?").concat(new URLSearchParams(l)),{method:"GET",headers:{Authorization:"Bearer ".concat(r)}}),i=null;try{i=await s.json()}catch(e){i={}}o(i);let d=null==i?void 0:i.data,m=u(d),g=p(d)||(null==i?void 0:i.taskId)||(null==i?void 0:i.taskid)||"";if(m){n({successFlag:1,videoUrl:m,...d}),c(!1),J.ZP.success("1080p video retrieved successfully");return}if(g){c(!1),(0,J.ZP)("1080p video is being generated. Please wait a while and try again later.");return}throw s.ok&&null!=i&&i.code,Error((null==i?void 0:i.msg)||"Failed to get 1080p video")}catch(e){m(e)}}},h=(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e["veo-get-1080p-video"])||5;return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(r4,{formData:r,setFormData:l}
1),OutputPanelContent:(0,N.jsx)(r5,{recordDetails:s,generating:d}),run:()=>g(r),formData:r,outputData:i,generating:d,credit:h,layoutRatio:"40-60"})});function r6(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({taskId:"",index:0,callBackUrl:"playground"})},[]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))},l=(e,t)=>{a(a=>({...a||{},[e]:t}))};return(0,N.jsx)("div",{className:"space-y-6",children:(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["taskId ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.taskId)||"",onChange:e=>l("taskId",e.target.value),onBlur:e=>r("taskId",e.target.value),placeholder:"Enter video generation task ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Task ID from a completed video generation task"})})]})})}var r7=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)(null),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),u=async e=>{if(!d){c(!0),n(null),o({});try{var t,r,l;if(!e.taskId)throw Error("Please enter task ID");let s=null===(t=a.user)||void 0===t?void 0:t.apiKey;if(!s)throw Error("Please login and set your API key");let i={taskId:e.taskId,index:e.index||0,callBackUrl:e.callBackUrl||"playground"},d=await fetch("".concat("https://api.kie.ai","/api/v1/veo/get-4k-video"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(s)},body:JSON.stringify(i)}),u=null;try{u=await d.json()}catch(e){u={}}o(u);let p=null==u?void 0:u.data,m=(null==p?void 0:p.resultUrl)||(null==p?void 0:null===(r=p.resultUrls)||void 0===r?void 0:r[0])||(null==p?void 0:p.result_url)||(null==p?void 0:null===(l=p.result_url)||void 0===l?void 0:l[0]);if(m){n({successFlag:1,videoUrl:m,...p}),c(!1),J.ZP.success("4K video retrieved successfully");return}if(!d.ok||(null==u?void 0:u.code)!==200)throw Error((null==u?void 0:u.msg)||"Failed to get 4K video");let g="";if("string"==typeof p?g=p:p&&"object"==typeof p&&(g=p.taskId||p.taskid||""),g||(g=(null==u?void 0:u.taskId)||(null==u?void 0:u.taskid)||""),!g)throw Error("No task ID returned");let h=setInterval(()=>{fetch("".concat("https://api.kie.ai","/api/v1/veo/record-info?taskId=").concat(encodeURIComponent(g)),{headers:{Authorization:"Bearer ".concat(s)}}).then(async e=>{let t=null;try{t=await e.json()}catch(e){t={}}if(o(t),200!==t.code)throw Error(t.msg||"Polling request failed");let a=t.data||t,r=a.data||a;n(r),1===r.successFlag?(c(!1),clearInterval(h),J.ZP.success("4K video conversion completed")):(3===r.successFlag||["CREATE_TASK_FAILED","GENERATE_VIDEO_FAILED","CONVERT_FAILED","CALLBACK_EXCEPTION"].includes(r.status))&&(c(!1),clearInterval(h),J.ZP.error(r.errorMessage||"4K video conversion failed"))}).catch(e=>{J.ZP.error(e.message||"Polling request failed")})},5e3)}catch(e){c(!1),n({successFlag:3,status:"FAILED",errorMessage:e.message||"Failed to get 4K video"}),J.ZP.error(e.message||"Failed to get 4K video")}}},p=(null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e["veo-get-4k-video"])||120;return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(r6,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(r5,{recordDetails:s,generating:d}),run:()=>u(r),formData:r,outputData:i,generating:d,credit:p,layoutRatio:"40-60"})}),r9=a(50830),r8=a(93219),le=a(68237);function lt(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({model:"fast",taskId:"",prompt:"",seeds:"",watermark:""})},[]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))},l=(e,t)=>{a(a=>({...a||{},[e]:t}))};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["taskId ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.taskId)||"",onChange:e=>l("taskId",e.target.value),onBlur:e=>r("taskId",e.target.value),placeholder:"Enter original video generation task ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"The taskId must be a valid taskId returned from the video generation interface. Note: Video generated after 1080P cannot be extended."})})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["prompt ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("textarea",{value:(null==t?void 0:t.prompt)||"",onChange:e=>l("prompt",e.target.value),onBlur:e=>r("prompt",e.target.value),placeholder:"Describe how you want the video to be extended, including actions, scene changes, style, etc.",rows:4,className:"w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Describe the text prompt for extending the video content."})})]}),(0,N.jsx)(tz,{label:"model",options:[{value:"lite",label:"Lite"},{value:"fast",label:"Fast"}
1,{value:"quality",label:"Quality"}],value:(null==t?void 0:t.model)||"fast",onChange:(e,t)=>{l(t||"model",e),r(t||"model",e)},required:!0,name:"model"}),(0,N.jsx)("div",{className:"flex w-full flex-col items-start space-y-2",children:(0,N.jsx)("div",{className:"w-full rounded-lg text-[var(--tool-color-text-primary)] dark:text-white",children:(0,N.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,N.jsxs)("label",{className:"mb-2 flex w-full items-center justify-start gap-1 text-sm font-medium",children:[(0,N.jsx)("span",{children:"seedsï¼optionalï¼"}),(0,N.jsx)(r9.pn,{delayDuration:100,skipDelayDuration:200,children:(0,N.jsxs)(r9.u,{children:[(0,N.jsx)(r9.aJ,{children:(0,N.jsx)(D.JO,{icon:"material-symbols:help-rounded",width:16,className:"text-default-400 dark:text-white"})}),(0,N.jsx)(r9._v,{side:"top",sideOffset:18,className:"ml-1 w-[300px] p-3 md:w-[500px]",children:(0,N.jsx)("span",{className:"text-xs text-default-200 dark:text-white",children:"Used to control the randomness of the generated content. The value range is from 10000 to 99999."})})]})})]}),(0,N.jsx)("input",{"aria-label":"Seeds value",className:"w-64 rounded-small border-medium border-transparent bg-default-100 px-2 py-1 text-right text-small font-medium text-default-700 outline-none transition-colors hover:border-primary focus:border-primary dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:hover:border-blue-400 dark:focus:border-blue-400",type:"number",min:"10000",max:"99999",value:(null==t?void 0:t.seeds)||"",placeholder:"please input seed",onChange:e=>l("seeds",e.target.value),onBlur:e=>{let t=Number(e.target.value);isNaN(t)||t<1e4||t>99999?(l("seeds",""),r("seeds","")):r("seeds",e.target.value)},onKeyDown:e=>{if("Enter"===e.key){let e=Number(null==t?void 0:t.seeds);(isNaN(e)||e<1e4||e>99999)&&(l("seeds",""),r("seeds",""))}}})]})})}),(0,N.jsxs)("div",{children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:"watermark"}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.watermark)||"",onChange:e=>l("watermark",e.target.value),onBlur:e=>r("watermark",e.target.value),placeholder:"Enter watermark text (
1optional)",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"If provided, the watermark will be added to the generated video."})})]})]})}var la=(0,Y.Pi)(()=>{var e,t,a,r,l,s;let{t:n}=(0,X.Z)("dashboard"),i=(0,le.useRouter)(),{userStore:o}=(0,_.o)(),[d,c]=(0,E.useState)({}),[u,p]=(0,E.useState)(null),[m,g]=(0,E.useState)({}),[h,x]=(0,E.useState)(!1),[f,y]=(0,E.useState)(!1),[v,b]=(0,E.useState)(!1),w=(0,E.useRef)(null),j=e=>{let t=setInterval(async()=>{try{let r=await (0,tC.Z)({headers:{Authorization:"Bearer ".concat(o.user.apiKey),"Content-Type":"application/x-www-form-urlencoded"},url:"".concat("https://api.kie.ai","/api/v1/veo/record-info?taskId=").concat(e),method:"GET"});if(200===r.data.code){var a;let e=r.data.data,l=null==e?void 0:e.response,s=(null==l?void 0:null===(a=l.fullResultUrls)||void 0===a?void 0:a.length)>0?l.fullResultUrls:null==l?void 0:l.resultUrls,n={...e,state:0===e.successFlag?"generating":1===e.successFlag?"success":"fail",videoInfo:l?{videoUrl:(null==s?void 0:s[0])||null}:null,resultUrls:s||[],videoUrl:(null==s?void 0:s[0])||null};p(n),g(r.data),0===e.successFlag?w.current&&(Date.now(),w.current):(x(!1),clearInterval(t),1===e.successFlag&&J.ZP.success("Video extension completed"))}else clearInterval(t),x(!1),J.ZP.error(r.data.msg)}catch(e){clearInterval(t),x(!1)}},1500)},k=async e=>{if(!o.user){y(!0);return}if(!o.user.apiKey){J.ZP.error(n("toast.apiKeyEmpty")),i.push("/api-key");return}if(!e.taskId){J.ZP.error("Please enter task ID");return}if(!e.prompt){J.ZP.error("Please enter prompt");return}if(e.seeds&&(e.seeds<1e4||e.seeds>99999)){J.ZP.error("Seeds must be between 10000 and 99999");return}if(h)return;u&&p(null),x(!0),g({});let t={taskId:e.taskId,prompt:e.prompt,model:e.model};e.seeds&&(t.seeds=Number(e.seeds)),e.watermark&&(t.watermark=e.watermark);try{var a;let e=await (0,tC.Z)({headers:{Authorization:"Bearer ".concat(null===(a=o.user)||void 0===a?void 0:a.apiKey),"Content-Type":"application/json"},url:"".concat("https://api.kie.ai","/api/v1/veo/extend"),method:"POST",data:t});if(200===e.data.code){let t=e.data.data,a="";if("string"==typeof t?a=t:t&&"object"==typeof t&&(a=t.taskId||t.taskid||""),a||(a=e.data.taskId||e.data.taskid||""),!a){J.ZP.error("No task ID returned"),x(!1);return}j(a),o.loadUserInfo(),w.current=Date.now()}else 402===e.data.code?b(!0):J.ZP.error(e.data.msg),x(!1)}catch(e){x(!1),J.ZP.error(n("toast.serverAbnormal"))}},C="quality"===d.model?(null===(t=o.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e["veo-video-extend-quality"])||250:"lite"===d.model?(null===(r=o.user)||void 0===r?void 0:null===(a=r.consumeCreditsMap)||void 0===a?void 0:a["veo-video-extend-lite"])||30:(null===(s=o.user)||void 0===s?void 0:null===(l=s.consumeCreditsMap)||void 0===l?void 0:l["veo-video-extend"])||60;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(lt,{formData:d,setFormData:c}),OutputPanelContent:(0,N.jsx)(r5,{recordDetails:u,generating:h}),run:()=>k(d),formData:d,outputData:m,generating:h,credit:C,layoutRatio:"40-60"}),(0,N.jsx)(tt.default,{isOpen:f,onClose:()=>y(!1)}),(0,N.jsx)(r8.Z,{isOpen:v,onClose:()=>b(!1)})]})}),lr=e=>{let{pageData:t}=e;switch(t.model){case"veo/get-1080p-video":return(0,N.jsx)(r3,{pageData:t});case"veo/get-4k-video":return(0,N.jsx)(r7,{pageData:t});case"veo/extend":return(0,N.jsx)(la,{pageData:t});default:return(0,N.jsx)(r2.A,{})}},ll=a(2104),ls=a(72594),ln=a(97796),li=a(32162),lo=a(29270);let ld=(0,Y.Pi)(e=>{var t;let{t:a}=(0,X.Z)("dashboard"),{userStore:r}=(0,_.o)(),[l,s]=(0,E.useState)(""),[n,i]=(0,E.useState)(!1),[o,d]=(0,E.useState)(""),[c,u]=(0,E.useState)(null),[p,m]=(0,E.useState)("mj_txt2img"),[g,h]=(0,E.useState)("1:1"),[x,f]=(0,E.useState)(""),[y,v]=(0,E.useState)(""),[b,w]=(0,E.useState)(100),[j,k]=(0,E.useState)(0),[C,I]=(0,E.useState)(0),[S,A]=(0,E.useState)("7"),[P,T]=(0,E.useState)("fast"),[R,F]=(0,E.useState)(!1),[M,O]=(0,E.useState)(!1),L=e=>{let t=e.target.files[0];t&&(u(t),i(!0),Z([t]).then(e=>{d(e),i(!1)}).catch(e=>{console.error("Error uploading file:",e),J.ZP.error("Upload failed, please try again"),i(!1)}))};async function B(){var e;let t={prompt:l,fileUrl:o,taskType:p,callBackUrl:x,waterMark:y,enableTranslation:R};return"mj_video"!==p&&(t.aspectRatio=g,t.stylization=b,t.weirdness=j,t.variety=C,t.version=S,t.speed=P),"mj_video"===p&&(t.videoBatchSize=4),await (0,tC.Z)({headers:{Authorization:"Bearer ".concat(null===(e=r.user)||void 0===e?void 0:e.apiKey)},url:"".concat("https://api.kie.ai","/api/v1/mj/generate"),method:"post",data:t})}let U="mj_img2img"===p||"mj_video"===p,Z=async e=>{let t=e[0];if(t){if(t.size>5242880){J.ZP.error("Image size cannot exceed 5MB");return}if(!["image/png","image/jpeg","image/jpg","image/webp"].includes(t.type)){J.ZP.error("Only PNG, JPG, JPEG and WEBP image formats are supported");return}return await (0,eK._R)(t,"kie-ai/mj")}},z=(0,E.useMemo)(()=>{var e,t;let a=null!==(t=null==r?void 0:null===(e=r.user)||void 0===e?void 0:e.consumeCreditsMap)&&void 0!==t?t:{mj_video_fast:40,mj_video_relaxed:20,mj_video_turbo:70,mj_img2img_fast:8,mj_img2img_relaxed:4,mj_img2img_turbo:12,mj_txt2img_fast:8,mj_txt2img_relaxed:4,mj_txt2img_turbo:12},l="relaxed"==P?"relax":P;return a["".concat(p,"_").concat(l)]||0},[p,P,null==r?void 0:null===(t=r.user)||void 0===t?void 0:t.consumeCreditsMap]);return(0,N.jsxs)("div",{className:"relative flex h-full w-full flex-col items-start bg-default-50",children:[(0,N.jsxs)("div",{className:"flex w-full flex-1 flex-col items-start gap-4 overflow-y-auto p-4 lg:p-6",children:[(0,N.jsxs)("div",{className:"flex w-full flex-col items-start",children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-default-700",children:["taskType ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("div",{className:"flex w-full flex-row gap-2",children:[{key:"mj_txt2img",label:"Text to Image"},{key:"mj_img2img",label:"Image to Image"},{key:"mj_video",label:"Image to Video"}].map(e=>(0,N.jsxs)("div",{className:"relative flex flex-1 cursor-pointer items-center justify-center gap-1 rounded-md border border-default-200 p-2 text-zinc-800 hover:bg-default-50 ".concat(p==e.key?"border-2 !border-blue-500 bg-default-100":""),onClick:()=>{m(e.key)},children:[(0,N.jsx)(D.JO,{icon:e.icon,className:"h-5 w-5 text-default-600 ".concat("9:16"==e.value?"rotate-90":"")}),(0,N.jsx)("span",{className:"text-nowrap text-xs font-medium text-default-600",children:e.label})]},e.value))}),(0,N.jsx)("p",{className:"mt-1 text-xs text-default-500",children:a("mj.tasktype")})]}),"mj_video"!==p&&(0,N.jsxs)("div",{className:"flex w-full flex-col items-start",children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-default-700",children:"speed"}),(0,N.jsx)("div",{className:"flex w-full flex-row gap-2",children:[{key:"relaxed",label:"relaxed"},{key:"fast",label:"fast"},{key:"turbo",label:"turbo"}].map(e=>(0,N.jsxs)("div",{className:"relative flex flex-1 cursor-pointer items-center justify-center gap-1 rounded-md border border-default-200 p-2 text-zinc-800 hover:bg-default-50 ".concat(P==e.key?"border-2 !border-blue-500 bg-default-100":""),onClick:()=>{T(e.key)},children:[(0,N.jsx)(D.JO,{icon:e.icon,className:"h-5 w-5 text-default-600 ".concat("9:16"==e.value?"rotate-90":"")}),(0,N.jsx)("span",{className:"text-nowrap text-xs font-medium text-default-600",children:e.label})]},e.value))}),(0,N.jsx)("p",{className:"mt-1 text-xs text-default-500",children:a("modelgenerationspeed")})]}),(0,N.jsxs)("div",{className:"flex w-full flex-col items-start",children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-default-700",children:["prompt ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(ll.Y,{placeholder:"a happy dog running in the park",value:l,onCh
1ange:e=>s(e.target.value),minRows:3,className:"w-full"}),(0,N.jsx)("p",{className:"mt-1 text-xs text-default-500",children:a("mj.textpromptforimagegeneration")})]}),(0,N.jsx)("div",{className:"flex w-full flex-col items-start space-y-2",children:(0,N.jsx)("div",{className:"w-full rounded-lg text-[var(--tool-color-text-primary)]",children:(0,N.jsxs)("div",{className:"flex w-full items-center justify-between gap-2",children:[(0,N.jsxs)("div",{className:"flex flex-1 items-center gap-1",children:[(0,N.jsx)("label",{className:"text-sm font-medium text-default-700",children:"enableTranslation"}),(0,N.jsx)(r9.pn,{delayDuration:100,skipDelayDuration:200,children:(0,N.jsxs)(r9.u,{children:[(0,N.jsx)(r9.aJ,{children:(0,N.jsx)(lo.n,{icon:"hover_tips",className:"w-4 fill-neutral-400"})}),(0,N.jsx)(r9._v,{className:"ml-1 max-w-[200px]",children:(0,N.jsx)("p",{children:a("playground.mj.tips")})})]})})]}),(0,N.jsx)("button",{className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none ".concat(R?"bg-blue-500":"bg-gray-200"),onClick:()=>F(!R),children:(0,N.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white transition-transform ".concat(R?"translate-x-6":"translate-x-1")})})]})})}),U&&(0,N.jsxs)("div",{className:"flex w-full flex-col items-start",children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-default-700",children:["fileUrl ",U&&(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)(ts.Y,{placeholder:"https://example.com/image.jpg",value:o,onChange:e=>d(e.target.value),className:"mb-2 w-full"}),(0,N.jsx)("div",{onDragOver:e=>{e.preventDefault(),e.stopPropagation(),O(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),O(!1)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),O(!1),e.dataTransfer.files&&e.dataTransfer.files.length>0&&L({target:{files:e.dataTransfer.files}})},className:"w-full ".concat(M?"border-blue-400 bg-blue-50":""),children:(0,N.jsx)(aM.w,{className:"h-48 w-full border-2 border-dashed border-default-300 transition-colors hover:border-default-400",children:(0,N.jsx)(aO.G,{className:"h-full w-full p-2",children:c||o?(0,N.jsx)("div",{className:"relative h-full w-full",children:(0,N.jsxs)("div",{className:"relative mx-auto flex aspect-square h-full w-full max-w-xs items-center justify-center",children:[(0,N.jsx)("img",{src:o||function(e){try{return URL.createObjectURL(e)}catch(e){return""}}(c),alt:"Uploaded image",className:"h-auto max-h-full w-auto max-w-full rounded-lg object-cover"}),(0,N.jsx)(ek.A,{isIconOnly:!0,variant:"solid",color:"danger",className:"absolute right-2 top-2 h-6 w-6 min-w-6",onPress:()=>{u(null),d("")},children:(0,N.jsx)(D.JO,{icon:"carbon:close",className:"h-4 w-4"})})]})}):(0,N.jsx)(N.Fragment,{children:n?(0,N.jsx)("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-6",children:(0,N.jsx)("div",{className:"flex flex-col items-center justify-center",children:(0,N.jsx)(tS.Z,{color:"#006fee",size:10,margin:5})})}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("input",{type:"file",accept:"image/*",onChange:L,className:"hidden",id:"file-upload"}),(0,N.jsxs)("label",{htmlFor:"file-upload",className:"flex h-full w-full cursor-pointer flex-col items-center justify-center",children:[(0,N.jsx)(D.JO,{icon:"carbon:cloud-upload",className:"mb-2 text-2xl text-default-400"}),(0,N.jsx)("span",{className:"text-sm text-default-600",children:M?"ææ½å°æ¤å¤ä¸ä¼ å¾ç":a("video.placeholder.image")})]})]})})})})}),c&&(0,N.jsxs)("p",{className:"mt-1 text-xs text-default-500",children:[c.name,",",(c.size/1024/1024).toFixed(2)," MB"]})]}),"mj_video"!==p&&(0,N.jsxs)("div",{className:"flex w-full flex-col items-start",children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-default-700",children:"aspectRatio"}),(0,N.jsx)(ta.g,{selectedKeys:[g],onSelectionChange:e=>{let t=Array.from(e)[0];t&&h(t)},className:"w-full",children:[{key:"1:2",label:"1:2"},{key:"9:16",label:"9:16"},{key:"2:3",label:"2:3"},{key:"3:4",label:"3:4"},{key:"5:6",label:"5:6"},{key:"6:5",label:"6:5"},{key:"4:3",label:"4:3"},{key:"3:2",label:"3:2"},{key:"1:1",label:"1:1"},{key:"16:9",label:"16:9"},{key:"2:1",label:"2:1"}].map(e=>(0,N.jsx)(tr.R,{value:e.key,children:e.label},e.key))}),(0,N.jsx)("p",{className:"mt-1 text-xs text-default-500",children:a("mj.aspectratioforthegeneratedimage")})]}),"mj_video"!==p&&(0,N.jsxs)("div",{className:"flex w-full flex-col items-start",children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-default-700",children:"version"}),(0,N.jsx)(ta.g,{selectedKeys:[S],onSelectionChange:e=>{let t=Array.from(e)[0];t&&A(t)},className:"w-full",children:[{key:"7",label:"Version 7"},{key:"6.1",label:"Version 6.1"},{key:"6",label:"Version 6"},{key:"5.2",label:"Version 5.2"},{key:"5.1",label:"Version 5.1"},{key:"niji6",label:"Niji 6"}
1,{key:"niji7",label:"Niji 7"}].map(e=>(0,N.jsx)(tr.R,{value:e.key,children:e.label},e.key))}),(0,N.jsx)("p",{className:"mt-1 text-xs text-default-500",children:"Version (7, 6.1, 6, 5.2, 5.1, niji6, niji7)"})]}),"mj_video"!==p&&(0,N.jsxs)("div",{className:"flex w-full flex-col items-start",children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-default-700",children:["stylization ",(0,N.jsx)("span",{className:"text-xs text-default-500",children:"(0-1000)"})]}),(0,N.jsx)(ls.L,{size:"sm",step:10,minValue:0,maxValue:1e3,value:b,onChange:w,className:"w-full",showSteps:!1,showTooltip:!0,showOutline:!0,disableThumbScale:!0}),(0,N.jsxs)("p",{className:"mt-1 text-xs text-default-500",children:[a("mj.stylization")," (0-1000)"]})]}),"mj_video"!==p&&(0,N.jsxs)("div",{className:"flex w-full flex-col items-start",children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-default-700",children:["weirdness ",(0,N.jsx)("span",{className:"text-xs text-default-500",children:"(0-3000)"})]}),(0,N.jsx)(ls.L,{size:"sm",step:10,minValue:0,maxValue:3e3,value:j,onChange:k,className:"w-full",showSteps:!1,showTooltip:!0,showOutline:!0,disableThumbScale:!0}),(0,N.jsxs)("p",{className:"mt-1 text-xs text-default-500",children:[a("mj.weirdness")," (0-3000)"]})]}),("mj_txt2img"===p||"mj_img2img"===p)&&(0,N.jsxs)("div",{className:"flex w-full flex-col items-start",children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-default-700",children:["variety ",(0,N.jsx)("span",{className:"text-xs text-default-500",children:"(0-100)"})]}),(0,N.jsx)(ls.L,{size:"sm",step:5,minValue:0,maxValue:100,value:C,onChange:I,className:"w-full",showSteps:!1,showTooltip:!0,showOutline:!0,disableThumbScale:!0}),(0,N.jsxs)("p",{className:"mt-1 text-xs text-default-500",children:[a("mj.varietyDescription")," (0-100)"]})]}),(0,N.jsxs)("div",{className:"flex w-full flex-col items-start",children:[(0,N.jsx)("label",{className:"mb-2 block text-sm font-medium text-default-700",children:"waterMark"}),(0,N.jsx)(ts.Y,{placeholder:"my watermark",value:y,onChange:e=>v(e.target.value),className:"w-full"}),(0,N.jsx)("p",{className:"mt-1 text-xs text-default-500",children:a("mj.watermarkidentifieroptional")})]})]}),(0,N.jsxs)("div",{className:"w-full p-4 lg:px-6",children:[(0,N.jsx)(ln.j,{className:"my-4"}),(0,N.jsxs)("div",{className:"flex gap-2",children:[(0,N.jsx)(ek.A,{variant:"light",onPress:()=>{s(""),d(""),u(null),m("mj_txt2img"),h("1:1"),f(""),v(""),w(100),k(0),I(0),A("7"),T("fast"),F(!1)},className:"flex-1",children:"Reset"}),(0,N.jsx)(ek.A,{color:"primary",onPress:()=>{var t,s;return U&&!o?J.ZP.error(a("pleasefillimage")):l?void("generating"!==e.generatingState&&(null===(t=e.setTaskId)||void 0===t||t.call(e,null),null===(s=e.setGeneratingState)||void 0===s||s.call(e,"generating"),B().then(t=>{var a,l,s;let n=t.data;if(402===n.code){J.ZP.error(n.msg),null===(l=e.setGeneratingState)||void 0===l||l.call(e,"fail");return}if(200!==n.code){J.ZP.error(n.msg||t.msg),null===(s=e.setGeneratingState)||void 0===s||s.call(e,"fail");return}null===(a=e.setTaskId)||void 0===a||a.call(e,n.data.taskId),r.loadUserInfo()}).catch(t=>{var a;t.msg&&J.ZP.error(t.msg),null===(a=e.setGeneratingState)||void 0===a||a.call(e,"fail")}))):J.ZP.error(a("pleasefillprompt"))},className:"flex-1",disabled:"generating"===e.generatingState,children:"generating"===e.generatingState?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("span",{className:"loader mr-2"})," ",a("billing.loading")]}):(0,N.jsxs)(N.Fragment,{children:["Run"," ",(0,N.jsxs)("div",{className:"inline-flex items-center justify-center opacity-60",children:[(0,N.jsx)("span",{className:"mr-1.5 h-3 w-[1px] bg-primary-foreground opacity-50"}),(0,N.jsx)(li.Z,{size:14}),(0,N.jsx)("span",{className:"pl-1",children:z})]})]})})]})]})]})});var lc=a(62302),lu=a(51835),lp=a(23459),lm=Object.create,lg=Object.defineProperty,lh=Object.defineProperties,lx=Object.getOwnPropertyDescriptor,lf=Object.getOwnPropertyDescriptors,ly=Object.getOwnPropertyNames,lv=Object.getOwnPropertySymbols,lb=Object.getPrototypeOf,lw=Object.prototype.hasOwnProperty,lj=Object.prototype.propertyIsEnumerable,lk=(e,t,a)=>t in e?lg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,lN=(e,t)=>{for(var a in t||(t={}))lw.call(t,a)&&lk(e,a,t[a]);if(lv)for(var a of lv(t))lj.call(t,a)&&lk(e,a,t[a]);return e},lE=(e,t)=>lh(e,lf(t)),lC=(e,t)=>{var a={};for(var r in e)lw.call(e,r)&&0>t.indexOf(r)&&(a[r]=e[r]);if(null!=e&&lv)for(var r of lv(e))0>t.indexOf(r)&&lj.call(e,r)&&(a[r]=e[r]);return a},lI=(i=null!=(s=(r={"../../node_modules/.pnpm/[email protected]_patch_hash=vrxx3pzkik6jpmgpayxfjunetu/node_modules/prismjs/prism.js"(e,t){var a=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,a={},r={util:{encode:function e(t){return t instanceof l?new l(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(t,a){var l,s;switch(a=a||{},r.util.type(t)){case"Object":if(a[s=r.util.objId(t)])return a[s];for(var n in l={},a[s]=l,t)t.hasOwnProperty(n)&&(l[n]=e(t[n],a));return l;case"Array":if(a[s=r.util.objId(t)])return a[s];return l=[],a[s]=l,t.forEach(function(t,r){l[r]=e(t,a)}),l;default:return t}},getLanguage:function(t){for(;t;){var a=e.exec(t.className);if(a)return a[1].toLowerCase();t=t.parentElement}return"none"},setLanguage:function(t,a){t.className=t.className.replace(RegExp(e,"gi"),""),t.classList.add("language-"+a)},isActive:function(e,t,a){for(var r="no-"+t;e;){var l=e.classList;if(l.contains(t))return!0;
1if(l.contains(r))return!1;e=e.parentElement}return!!a}},languages:{plain:a,plaintext:a,text:a,txt:a,extend:function(e,t){var a=r.util.clone(r.languages[e]);for(var l in t)a[l]=t[l];return a},insertBefore:function(e,t,a,l){var s=(l=l||r.languages)[e],n={};for(var i in s)if(s.hasOwnProperty(i)){if(i==t)for(var o in a)a.hasOwnProperty(o)&&(n[o]=a[o]);a.hasOwnProperty(i)||(n[i]=s[i])}var d=l[e];return l[e]=n,r.languages.DFS(r.languages,function(t,a){a===d&&t!=e&&(this[t]=n)}),n},DFS:function e(t,a,l,s){s=s||{};var n=r.util.objId;for(var i in t)if(t.hasOwnProperty(i)){a.call(t,i,t[i],l||i);var o=t[i],d=r.util.type(o);"Object"!==d||s[n(o)]?"Array"!==d||s[n(o)]||(s[n(o)]=!0,e(o,a,i,s)):(s[n(o)]=!0,e(o,a,null,s))}}},plugins:{},highlight:function(e,t,a){var s={code:e,grammar:t,language:a};if(r.hooks.run("before-tokenize",s),!s.grammar)throw Error('The language "'+s.language+'" has no grammar.');return s.tokens=r.tokenize(s.code,s.grammar),r.hooks.run("after-tokenize",s),l.stringify(r.util.encode(s.tokens),s.language)},tokenize:function(e,t){var a=t.rest;if(a){for(var o in a)t[o]=a[o];delete t.rest}var d=new n;return i(d,d.head,e),function e(t,a,n,o,d,c){for(var u in n)if(n.hasOwnProperty(u)&&n[u]){var p=n[u];p=Array.isArray(p)?p:[p];for(var m=0;m<p.length;++m){if(c&&c.cause==u+","+m)return;var g=p[m],h=g.inside,x=!!g.lookbehind,f=!!g.greedy,y=g.alias;if(f&&!g.pattern.global){var v=g.pattern.toString().match(/[imsuy]*$/)[0];g.pattern=RegExp(g.pattern.source,v+"g")}for(var b=g.pattern||g,w=o.next,j=d;w!==a.tail&&(!c||!(j>=c.reach));j+=w.value.length,w=w.next){var k,N=w.value;if(a.length>t.length)return;if(!(N instanceof l)){var E=1;if(f){if(!(k=s(b,j,t,x))||k.index>=t.length)break;var C=k.index,I=k.index+k[0].length,S=j;for(S+=w.value.length;C>=S;)S+=(w=w.next).value.length;if(S-=w.value.length,j=S,w.value instanceof l)continue;for(var A=w;A!==a.tail&&(S<I||"string"==typeof A.value);A=A.next)E++,S+=A.value.length;E--,N=t.slice(j,S),k.index-=j}else if(!(k=s(b,0,N,x)))continue;var C=k.index,P=k[0],D=N.slice(0,C),T=N.slice(C+P.length),_=j+N.length;c&&_>c.reach&&(c.reach=_);var R=w.prev;if(D&&(R=i(a,R,D),j+=D.length),function(e,t,a){for(var r=t.next,l=0;l<a&&r!==e.tail;l++)r=r.next;t.next=r,r.prev=t,e.length-=l}(a,R,E),w=i(a,R,new l(u,h?r.tokenize(P,h):P,y,P)),T&&i(a,w,T),E>1){var F={cause:u+","+m,reach:_};e(t,a,n,w.prev,j,F),c&&F.reach>c.reach&&(c.reach=F.reach)}}}}}}(e,d,t,d.head,0),function(e){for(var t=[],a=e.head.next;a!==e.tail;)t.push(a.value),a=a.next;return t}(d)},hooks:{all:{},add:function(e,t){var a=r.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=r.hooks.all[e];if(a&&a.length)for(var l,s=0;l=a[s++];)l(t)}},Token:l};function l(e,t,a,r){this.type=e,this.content=t,this.alias=a,this.length=0|(r||"").length}function s(e,t,a,r){e.lastIndex=t;var l=e.exec(a);if(l&&r&&l[1]){var s=l[1].length;l.index+=s,l[0]=l[0].slice(s)}return l}function n(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function i(e,t,a){var r=t.next,l={value:a,prev:t,next:r};return t.next=l,r.prev=l,e.length++,l}return l.stringify=function e(t,a){if("string"==typeof t)return t;if(Array.isArray(t)){var l="";return t.forEach(function(t){l+=e(t,a)}),l}var s={type:t.type,content:e(t.content,a),tag:"span",classes:["token",t.type],attributes:{},language:a},n=t.alias;n&&(Array.isArray(n)?Array.prototype.push.apply(s.classes,n):s.classes.push(n)),r.hooks.run("wrap",s);var i="";for(var o in s.attributes)i+=" "+o+'="'+(s.attributes[o]||"").replace(/"/g,""")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'"'+i+">"+s.content+"</"+s.tag+">"},r}();t.exports=a,a.default=a}},function(){return l||(0,r[ly(r)[0]])((l={exports:{}}).exports,l),l.exports})())?lm(lb(s)):{},((e,t,a,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of ly(t))lw.call(e,l)||l===a||lg(e,l,{get:()=>t[l],enumerable:!(r=lx(t,l))||r.enumerable});return e})(!n&&s&&s.__esModule?i:lg(i,"default",{value:s,enumerable:!0}),s));lI.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>
1\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},lI.languages.markup.tag.inside["attr-value"].inside.entity=lI.languages.markup.entity,lI.languages.markup.doctype.inside["internal-subset"].inside=lI.languages.markup,lI.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(lI.languages.markup.tag,"addInlined",{value:function(e,t){var a={},a=(a["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:lI.languages[t]},a.cdata=/^<!\[CDATA\[|\]\]>$/i,{"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:a}}),t=(a["language-"+t]={pattern:/[\s\S]+/,inside:lI.languages[t]},{});t[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:a},lI.languages.insertBefore("markup","cdata",t)}}),Object.defineProperty(lI.languages.markup.tag,"addAttribute",{value:function(e,t){lI.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:lI.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),lI.languages.html=lI.languages.markup,lI.languages.mathml=lI.languages.markup,lI.languages.svg=lI.languages.markup,lI.languages.xml=lI.languages.extend("markup",{}),lI.languages.ssml=lI.languages.xml,lI.languages.atom=lI.languages.xml,lI.languages.rss=lI.languages.xml,o={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},c=RegExp((c="(?:[^\\\\-]|"+(d=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/).source+")")+"-"+c),u={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"},lI.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:c,inside:{escape:d,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":o,"char-set":{pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},escape:d}},"special-escape":o,"char-set":{pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":u}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:d,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,alias:"punctuation",inside:{"group-name":u}},{pattern:/\)/,alias:"punctuation"}],quantifier:{pattern:/(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,alias:"number"},alternation:{pattern:/\|/,alias:"keyword"}},lI.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},lI.languages.javascript=lI.languages.extend("clike",{"class-name":[lI.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?
1:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),lI.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,lI.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:lI.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:lI.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:lI.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:lI.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:lI.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),lI.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:lI.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),lI.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),lI.languages.markup&&(lI.languages.markup.tag.addInlined("script","javascript"),lI.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),lI.languages.js=lI.languages.javascript,lI.languages.actionscript=lI.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),lI.languages.actionscript["class-name"].alias="function",delete lI.languages.actionscript.parameter,delete lI.languages.actionscript["literal-property"],lI.languages.markup&&lI.languages.insertBefore("actionscript","string",{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:lI.languages.markup}}),p=/#(?!\{).+/,m={pattern:/#\{[^}]+\}/,alias:"variable"},lI.languages.coffeescript=lI.languages.extend("javascript",{comment:p,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0}
1,{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:m}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),lI.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:p,interpolation:m}}}),lI.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:lI.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:m}}]}),lI.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete lI.languages.coffeescript["template-string"],lI.languages.coffee=lI.languages.coffeescript,Object.defineProperty(g=lI.languages.javadoclike={parameter:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m,lookbehind:!0},keyword:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,lookbehind:!0},punctuation:/[{}]/},"addSupport",{value:function(e,t){(e="string"==typeof e?[e]:e).forEach(function(e){var a=function(e){e.inside||(e.inside={}),e.inside.rest=t},r="doc-comment";if(l=lI.languages[e]){var l,s=l[r];if((s=s||(l=lI.languages.insertBefore(e,"comment",{"doc-comment":{pattern:/(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,lookbehind:!0,alias:"comment"}}))[r])instanceof RegExp&&(s=l[r]={pattern:s}),Array.isArray(s))for(var n=0,i=s.length;n<i;n++)s[n]instanceof RegExp&&(s[n]={pattern:s[n]}),a(s[n]);else a(s)}})}}),g.addSupport(["java","javascript","php"],g),h=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,lI.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+h.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+h.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+h.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+h.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:h,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},lI.languages.css.atrule.inside.rest=lI.languages.css,(h=lI.languages.markup)&&(h.tag.addInlined("style","css"),h.tag.addAttribute("style","css")),function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,t=(e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+t.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[t,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}}),{pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0}),a={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"}
1,color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|RebeccaPurple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:a,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,number:a})}(lI),function(e){var t=/[*&][^\s[\]{},]+/,a=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+a.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+a.source+")?)",l=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),s=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function n(e,t){return t=(t||"").replace(/m/g,"")+"m",RegExp(/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return e}),t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+l+"|"+s+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:n(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:n(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:n(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:n(s),lookbehind:!0,greedy:!0},number:{pattern:n(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:a,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(lI),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function a(e){return e=e.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,l=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),s=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source,n=(e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+l+s+"(?:"+l+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+l+s+")(?:"+l+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+l+")"+s+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+l+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}
1|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:a(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:a(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:a(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:a(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(t){["url","bold","italic","strike","code-snippet"].forEach(function(a){t!==a&&(e.languages.markdown[t].inside.content.inside[a]=e.languages.markdown[a])})}),e.hooks.add("after-tokenize",function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var a=0,r=t.length;a<r;a++){var l,s=t[a];"code"!==s.type?e(s.content):(l=s.content[1],s=s.content[3],l&&s&&"code-language"===l.type&&"code-block"===s.type&&"string"==typeof l.content&&(l=l.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),l="language-"+(l=(/[a-z][\w-]*/i.exec(l)||[""])[0].toLowerCase()),s.alias?"string"==typeof s.alias?s.alias=[s.alias,l]:s.alias.push(l):s.alias=[l]))}}(e.tokens)}),e.hooks.add("wrap",function(t){if("code-block"===t.type){for(var a="",r=0,l=t.classes.length;r<l;r++){var s=t.classes[r],s=/language-(.+)/.exec(s);if(s){a=s[1];break}}var d,c=e.languages[a];c?t.content=e.highlight((0,t.content).replace(n,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(e,t){return"#"===(t=t.toLowerCase())[0]?o("x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1))):i[t]||e}),c,a):a&&"none"!==a&&e.plugins.autoloader&&(d="md-"+new Date().valueOf()+"-"+Math.floor(1e16*Math.random()),t.attributes.id=d,e.plugins.autoloader.loadLanguages(a,function(){var t=document.getElementById(d);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[a],a))}))}}),RegExp(e.languages.markup.tag.pattern.source,"gi")),i={amp:"&",lt:"<",gt:">",quot:'"'},o=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(lI),lI.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:lI.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},lI.hooks.add("after-tokenize",function(e){if("graphql"===e.language)for(var t=e.tokens.filter(function(e){return"string"!=typeof e&&"comment"!==e.type&&"scalar"!==e.type}),a=0;a<t.length;){var r=t[a++];if("keyword"===r.type&&"mutation"===r.content){var l=[];
1if(c(["definition-mutation","punctuation"])&&"("===t[a+1].content){a+=2;var s=u(/^\($/,/^\)$/);if(-1===s)continue;for(;a<s;a++){var n=t[a+0];"variable"===n.type&&(p(n,"variable-input"),l.push(n.content))}a=s+1}if(c(["punctuation","property-query"])&&"{"===t[a+0].content&&(p(t[++a+0],"property-mutation"),0<l.length)){var i=u(/^\{$/,/^\}$/);if(-1!==i)for(var o=a;o<i;o++){var d=t[o];"variable"===d.type&&0<=l.indexOf(d.content)&&p(d,"variable-input")}}}}function c(e,r){r=r||0;for(var l=0;l<e.length;l++){var s=t[a+(l+r)];if(!s||s.type!==e[l])return}return 1}function u(e,r){for(var l=1,s=a;s<t.length;s++){var n=t[s],i=n.content;if("punctuation"===n.type&&"string"==typeof i){if(e.test(i))l++;else if(r.test(i)&&0==--l)return s}}return -1}function p(e,t){var a=e.alias;a?Array.isArray(a)||(e.alias=a=[a]):e.alias=a=[],a.push(t)}}),lI.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript["template-string"],a=t.pattern.source,r=t.inside.interpolation,l=r.inside["interpolation-punctuation"],s=r.pattern.source;function n(t,r){if(e.languages[t])return{pattern:RegExp("((?:"+r+")\\s*)"+a),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function i(t,a,r){return t={code:t,grammar:a,language:r},e.hooks.run("before-tokenize",t),t.tokens=e.tokenize(t.code,t.grammar),e.hooks.run("after-tokenize",t),t.tokens}
1e.languages.javascript["template-string"]=[n("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),n("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),n("svg",/\bsvg/.source),n("markdown",/\b(?:markdown|md)/.source),n("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),n("sql",/\bsql/.source),t].filter(Boolean);var o={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};e.hooks.add("after-tokenize",function(t){t.language in o&&function t(a){for(var n=0,o=a.length;n<o;n++){var d,c,u,p=a[n];"string"!=typeof p&&(Array.isArray(d=p.content)?"template-string"===p.type?(p=d[1],3===d.length&&"string"!=typeof p&&"embedded-code"===p.type&&(c=function e(t){return"string"==typeof t?t:Array.isArray(t)?t.map(e).join(""):e(t.content)}(p),p=Array.isArray(p=p.alias)?p[0]:p,u=e.languages[p])&&(d[1]=function(t,a,n){var o=e.tokenize(t,{interpolation:{pattern:RegExp(s),lookbehind:!0}}),d=0,c={},o=i(o.map(function(e){if("string"==typeof e)return e;for(var a,r,e=e.content;-1!==t.indexOf((r=d++,a="___"+n.toUpperCase()+"_"+r+"___")););return c[a]=e,a}).join(""),a,n),u=Object.keys(c);return d=0,function t(a){for(var s=0;s<a.length;s++){if(d>=u.length)return;var n,o,p,m,g,h,x,f=a[s];"string"==typeof f||"string"==typeof f.content?(n=u[d],-1!==(x=(h="string"==typeof f?f:f.content).indexOf(n))&&(++d,o=h.substring(0,x),g=c[n],p=void 0,(m={})["interpolation-punctuation"]=l,3===(m=e.tokenize(g,m)).length&&((p=[1,1]).push.apply(p,i(m[1],e.languages.javascript,"javascript")),m.splice.apply(m,p)),p=new e.Token("interpolation",m,r.alias,g),m=h.substring(x+n.length),g=[],o&&g.push(o),g.push(p),m&&(t(h=[m]),g.push.apply(g,h)),"string"==typeof f?(a.splice.apply(a,[s,1].concat(g)),s+=g.length-1):f.content=g)):Array.isArray(x=f.content)?t(x):t([x])}}(o),new e.Token(n,o,"language-"+n,t)}(c,u,p))):t(d):"string"!=typeof d&&t([d]))}}(t.tokens)})}(lI),lI.languages.typescript=lI.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),lI.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete lI.languages.typescript.parameter,delete lI.languages.typescript["literal-property"],x=lI.languages.extend("typescript",{}),delete x["class-name"],lI.languages.typescript["class-name"].inside=x,lI.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:x}}}}),lI.languages.ts=lI.languages.typescript,f=lI.languages.javascript,v="(@(?:arg|argument|param|property)\\s+(?:"+(y=/\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})+\}/.source)+"\\s+)?)",lI.languages.jsdoc=lI.languages.extend("javadoclike",{parameter:{pattern:RegExp(v+/(?:(?!\s)[$\w\xA0-\uFFFF.])+(?=\s|$)/.source),lookbehind:!0,inside:{punctuation:/\./}}}),lI.languages.insertBefore("jsdoc","keyword",{"optional-parameter":{pattern:RegExp(v+/\[(?:(?!\s)[$\w\xA0-\uFFFF.])+(?:=[^[\]]+)?\](?=\s|$)/.source),lookbehind:!0,inside:{parameter:{pattern:/(^\[)[$\w\xA0-\uFFFF\.]+/,lookbehind:!0,inside:{punctuation:/\./}},code:{pattern:/(=)[\s\S]*(?=\]$)/,lookbehind:!0,inside:f,alias:"language-javascript"},punctuation:/[=[\]]/}},"class-name":[{pattern:RegExp(/(@(?:augments|class|extends|interface|memberof!?|template|this|typedef)\s+(?:<TYPE>\s+)?)[A-Z]\w*(?:\.[A-Z]\w*)*/.source.replace(/<TYPE>/g,function(){return y})),lookbehind:!0,inside:{punctuation:/\./}},{pattern:RegExp("(@[a-z]+\\s+)"+y),lookbehind:!0,inside:{string:f.string,number:f.number,boolean:f.boolean,keyword:lI.languages.typescript.keyword,operator:/=>|\.\.\.|[&|?:*]/,punctuation:/[.,;=<>{}()[\]]/}}],example:{pattern:/(@example\s+(?!\s))(?:[^@\s]|\s+(?!\s))+?(?=\s*(?:\*\s
1*)?(?:@\w|\*\/))/,lookbehind:!0,inside:{code:{pattern:/^([\t ]*(?:\*\s*)?)\S.*$/m,lookbehind:!0,inside:f,alias:"language-javascript"}}}}),lI.languages.javadoclike.addSupport("javascript",lI.languages.jsdoc),lI.languages.flow=lI.languages.extend("javascript",{}),lI.languages.insertBefore("flow","keyword",{type:[{pattern:/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,alias:"class-name"}]}),lI.languages.flow["function-variable"].pattern=/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i,delete lI.languages.flow.parameter,lI.languages.insertBefore("flow","operator",{"flow-punctuation":{pattern:/\{\||\|\}/,alias:"punctuation"}}),Array.isArray(lI.languages.flow.keyword)||(lI.languages.flow.keyword=[lI.languages.flow.keyword]),lI.languages.flow.keyword.unshift({pattern:/(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,lookbehind:!0},{pattern:/(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,lookbehind:!0}),lI.languages.n4js=lI.languages.extend("javascript",{keyword:/\b(?:Array|any|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/}),lI.languages.insertBefore("n4js","constant",{annotation:{pattern:/@+\w+/,alias:"operator"}}),lI.languages.n4jsd=lI.languages.n4js,function(e){function t(e,t){return RegExp(e.replace(/<ID>/g,function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source}),t)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?<ID>/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var a=["function","function-variable","method","method-variable","property-access"],r=0;r<a.length;r++){var l=a[r],s=e.languages.javascript[l],l=(s="RegExp"===e.util.type(s)?e.languages.javascript[l]={pattern:s}:s).inside||{};(s.inside=l)["maybe-class-name"]=/^[A-Z][\s\S]*/}}(lI),function(e){var t=e.util.clone(e.languages.javascript),a=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,l=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function s(e,t){return RegExp(e=e.replace(/<S>/g,function(){return a}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return l}),t)}l=s(l).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=s(/<\/?(?:[\w.:-]+(?:<S>
1+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:s(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:s(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var n=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(n).join(""):""};e.hooks.add("after-tokenize",function(t){"jsx"!==t.language&&"tsx"!==t.language||function t(a){for(var r=[],l=0;l<a.length;l++){var s=a[l],i=!1;"string"!=typeof s&&("tag"===s.type&&s.content[0]&&"tag"===s.content[0].type?"</"===s.content[0].content[0].content?0<r.length&&r[r.length-1].tagName===n(s.content[0].content[1])&&r.pop():"/>"!==s.content[s.content.length-1].content&&r.push({tagName:n(s.content[0].content[1]),openedBraces:0}):0<r.length&&"punctuation"===s.type&&"{"===s.content?r[r.length-1].openedBraces++:0<r.length&&0<r[r.length-1].openedBraces&&"punctuation"===s.type&&"}"===s.content?r[r.length-1].openedBraces--:i=!0),(i||"string"==typeof s)&&0<r.length&&0===r[r.length-1].openedBraces&&(i=n(s),l<a.length-1&&("string"==typeof a[l+1]||"plain-text"===a[l+1].type)&&(i+=n(a[l+1]),a.splice(l+1,1)),0<l&&("string"==typeof a[l-1]||"plain-text"===a[l-1].type)&&(i=n(a[l-1])+i,a.splice(l-1,1),l--),a[l]=new e.Token("plain-text",i,null,i)),s.content&&"string"!=typeof s.content&&t(s.content)}}(t.tokens)})}(lI),b=lI.util.clone(lI.languages.typescript),(lI.languages.tsx=lI.languages.extend("jsx",b),delete lI.languages.tsx.parameter,delete lI.languages.tsx["literal-property"],b=lI.languages.tsx.tag).pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+b.pattern.source+")",b.pattern.flags),b.lookbehind=!0,lI.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},lI.languages.swift["string-literal"].forEach(function(e){e.inside.interpolation.inside=lI.languages.swift}),lI.languages.kotlin=lI.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?
1:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete lI.languages.kotlin["class-name"],w={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:lI.languages.kotlin}},lI.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:w},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:w},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete lI.languages.kotlin.string,lI.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),lI.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),lI.languages.kt=lI.languages.kotlin,lI.languages.kts=lI.languages.kotlin,lI.languages.c=lI.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),lI.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),lI.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},lI.languages.c.string],char:lI.languages.c.char,comment:lI.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:lI.languages.c}}}}),lI.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete lI.languages.c.boolean,lI.languages.objectivec=lI.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete lI.languages.objectivec["class-name"],lI.languages.objc=lI.languages.objectivec,lI.languages.reason=lI.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),lI.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete lI.languages.reason.function,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,a=0;a<2;a++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return/[^\s\S]/.source}),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}
vendor: 4,124 bytes, line 1
1],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(lI),lI.languages.go=lI.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),lI.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete lI.languages.go["class-name"],j=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,k=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return j.source}),lI.languages.cpp=lI.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return j.source})),lookbehind:!0}
vendor: 7,547 bytes, line 1
1,/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:j,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),lI.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return k})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),lI.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:lI.languages.cpp}}}}),lI.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),lI.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:lI.languages.extend("cpp",{})}}),lI.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},lI.languages.cpp["base-clause"]),lI.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},lI.languages.python["string-interpolation"].inside.interpolation.inside.rest=lI.languages.python,lI.languages.py=lI.languages.python,lI.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},lI.languages.webmanifest=lI.languages.json,((e,t)=>{for(var a in t)lg(e,a,{get:t[a],enumerable:!0})})({},{dracula:()=>lS,duotoneDark:()=>lA,duotoneLight:()=>lP,github:()=>lD,gruvboxMaterialDark:()=>lH,gruvboxMaterialLight:()=>lJ,jettwaveDark:()=>lK,jettwaveLight:()=>lG,nightOwl:()=>lT,nightOwlLight:()=>l_,oceanicNext:()=>lM,okaidia:()=>lO,oneDark:()=>lW,oneLight:()=>lV,palenight:()=>lL,shadesOfPurple:()=>lB,synthwave84:()=>lU,ultramin:()=>lZ,vsDark:()=>lz,vsLight:()=>lq});var lS={plain:{color:"#F8F8F2",backgroundColor:"#282A36"},styles:[{types:["prolog","constant","builtin"],style:{color:"rgb(189, 147, 249)"}},{types:["inserted","function"],style:{color:"rgb(80, 250, 123)"}},{types:["deleted"],style:{color:"rgb(255, 85, 85)"}},{types:["changed"],style:{color:"rgb(255, 184, 108)"}},{types:["punctuation","symbol"],style:{color:"rgb(248, 248, 242)"}},{types:["string","char","tag","selector"],style:{color:"rgb(255, 121, 198)"}},{types:["keyword","variable"],style:{color:"rgb(189, 147, 249)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(98, 114, 164)"}},{types:["attr-name"],style:{color:"rgb(241, 250, 140)"}}]},lA={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]},lP={plain:{backgroundColor:"#faf8f5",color:"#728fcb"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#b6ad9a"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#063289"}},{types:["property","function"],style:{color:"#b29762"}},{types:["tag-id","selector","atrule-id"],style:{color:"#2d2006"}},{types:["attr-name"],style:{color:"#896724"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule"],style:{color:"#728fcb"}},{types:["placeholder","variable"],style:{color:"#93abdc"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#896724"}}]},lD={plain:{color:"#393A34",backgroundColor:"#f6f8fa"},styles:[{types:["comment","prolog","doctype","cdata"],style:{color:"#999988",fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}},{types:["string","attr-value"],style:{color:"#e3116c"}},{types:["punctuation","operator"],style:{color:"#393A34"}},{types:["entity","url","symbol","number","boolean","variable","constant","property","regex","inserted"],style:{color:"#36acaa"}},{types:["atrule","keyword","attr-name","selector"],style:{color:"#00a4db"}},{types:["function","deleted","tag"],style:{color:"#d73a49"}}
vendor: 7,900 bytes, line 1
1,{types:["function-variable"],style:{color:"#6f42c1"}},{types:["tag","selector","keyword"],style:{color:"#00009f"}}]},lT={plain:{color:"#d6deeb",backgroundColor:"#011627"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)",fontStyle:"italic"}},{types:["inserted","attr-name"],style:{color:"rgb(173, 219, 103)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(99, 119, 119)",fontStyle:"italic"}},{types:["string","url"],style:{color:"rgb(173, 219, 103)"}},{types:["variable"],style:{color:"rgb(214, 222, 235)"}},{types:["number"],style:{color:"rgb(247, 140, 108)"}},{types:["builtin","char","constant","function"],style:{color:"rgb(130, 170, 255)"}},{types:["punctuation"],style:{color:"rgb(199, 146, 234)"}},{types:["selector","doctype"],style:{color:"rgb(199, 146, 234)",fontStyle:"italic"}},{types:["class-name"],style:{color:"rgb(255, 203, 139)"}},{types:["tag","operator","keyword"],style:{color:"rgb(127, 219, 202)"}},{types:["boolean"],style:{color:"rgb(255, 88, 116)"}},{types:["property"],style:{color:"rgb(128, 203, 196)"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)"}}]},l_={plain:{color:"#403f53",backgroundColor:"#FBFBFB"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)",fontStyle:"italic"}},{types:["inserted","attr-name"],style:{color:"rgb(72, 118, 214)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(152, 159, 177)",fontStyle:"italic"}},{types:["string","builtin","char","constant","url"],style:{color:"rgb(72, 118, 214)"}},{types:["variable"],style:{color:"rgb(201, 103, 101)"}},{types:["number"],style:{color:"rgb(170, 9, 130)"}},{types:["punctuation"],style:{color:"rgb(153, 76, 195)"}},{types:["function","selector","doctype"],style:{color:"rgb(153, 76, 195)",fontStyle:"italic"}},{types:["class-name"],style:{color:"rgb(17, 17, 17)"}},{types:["tag"],style:{color:"rgb(153, 76, 195)"}},{types:["operator","property","keyword","namespace"],style:{color:"rgb(12, 150, 155)"}},{types:["boolean"],style:{color:"rgb(188, 84, 84)"}}]},lR="#c5a5c5",lF="#8dc891",lM={plain:{backgroundColor:"#282c34",color:"#ffffff"},styles:[{types:["attr-name"],style:{color:lR}},{types:["attr-value"],style:{color:lF}},{types:["comment","block-comment","prolog","doctype","cdata","shebang"],style:{color:"#999999"}},{types:["property","number","function-name","constant","symbol","deleted"],style:{color:"#5a9bcf"}},{types:["boolean"],style:{color:"#ff8b50"}},{types:["tag"],style:{color:"#fc929e"}},{types:["string"],style:{color:lF}},{types:["punctuation"],style:{color:lF}},{types:["selector","char","builtin","inserted"],style:{color:"#D8DEE9"}},{types:["function"],style:{color:"#79b6f2"}},{types:["operator","entity","url","variable"],style:{color:"#d7deea"}},{types:["keyword"],style:{color:lR}},{types:["atrule","class-name"],style:{color:"#FAC863"}},{types:["important"],style:{fontWeight:"400"}},{types:["bold"],style:{fontWeight:"bold"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}}]},lO={plain:{color:"#f8f8f2",backgroundColor:"#272822"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"#f92672",fontStyle:"italic"}},{types:["inserted"],style:{color:"rgb(173, 219, 103)",fontStyle:"italic"}},{types:["comment"],style:{color:"#8292a2",fontStyle:"italic"}},{types:["string","url"],style:{color:"#a6e22e"}},{types:["variable"],style:{color:"#f8f8f2"}},{types:["number"],style:{color:"#ae81ff"}},{types:["builtin","char","constant","function","class-name"],style:{color:"#e6db74"}},{types:["punctuation"],style:{color:"#f8f8f2"}},{types:["selector","doctype"],style:{color:"#a6e22e",fontStyle:"italic"}},{types:["tag","operator","keyword"],style:{color:"#66d9ef"}},{types:["boolean"],style:{color:"#ae81ff"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)",opacity:.7}},{types:["tag","property"],style:{color:"#f92672"}},{types:["attr-name"],style:{color:"#a6e22e !important"}},{types:["doctype"],style:{color:"#8292a2"}},{types:["rule"],style:{color:"#e6db74"}}]},lL={plain:{color:"#bfc7d5",backgroundColor:"#292d3e"},styles:[{types:["comment"],style:{color:"rgb(105, 112, 152)",fontStyle:"italic"}},{types:["string","inserted"],style:{color:"rgb(195, 232, 141)"}},{types:["number"],style:{color:"rgb(247, 140, 108)"}},{types:["builtin","char","constant","function"],style:{color:"rgb(130, 170, 255)"}},{types:["punctuation","selector"],style:{color:"rgb(199, 146, 234)"}},{types:["variable"],style:{color:"rgb(191, 199, 213)"}},{types:["class-name","attr-name"],style:{color:"rgb(255, 203, 107)"}},{types:["tag","deleted"],style:{color:"rgb(255, 85, 114)"}},{types:["operator"],style:{color:"rgb(137, 221, 255)"}},{types:["boolean"],style:{color:"rgb(255, 88, 116)"}},{types:["keyword"],style:{fontStyle:"italic"}},{types:["doctype"],style:{color:"rgb(199, 146, 234)",fontStyle:"italic"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)"}},{types:["url"],style:{color:"rgb(221, 221, 221)"}}]},lB={plain:{color:"#9EFEFF",backgroundColor:"#2D2A55"},styles:[{types:["changed"],style:{color:"rgb(255, 238, 128)"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)"}},{types:["inserted"],style:{color:"rgb(173, 219, 103)"}},{types:["comment"],style:{color:"rgb(179, 98, 255)",fontStyle:"italic"}},{types:["punctuation"],style:{color:"rgb(255, 255, 255)"}},{types:["constant"],style:{color:"rgb(255, 98, 140)"}},{types:["string","url"],style:{color:"rgb(165, 255, 144)"}},{types:["variable"],style:{color:"rgb(255, 238, 128)"}},{types:["number","boolean"],style:{color:"rgb(255, 98, 140)"}},{types:["attr-name"],style:{color:"rgb(255, 180, 84)"}},{types:["keyword","operator","property","namespace","tag","selector","doctype"],style:{color:"rgb(255, 157, 0)"}},{types:["builtin","char","constant","function","class-name"],style:{color:"rgb(250, 208, 0)"}}]},lU={plain:{backgroundColor:"linear-gradient(to bottom, #2a2139 75%, #34294f)",backgroundImage:"#34294f",color:"#f92aad",textShadow:"0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3"},styles:[{types:["comment","block-comment","prolog","doctype","cdata"],style:{color:"#495495",fontStyle:"italic"}},{types:["punctuation"],style:{color:"#ccc"}},{types:["tag","attr-name","namespace","number","unit","hexcode","deleted"],style:{color:"#e2777a"}},{types:["property","selector"],style:{color:"#72f1b8",textShadow:"0 0 2px #100c0f, 0 0 10px #257c5575, 0 0 35px #21272475"}},{types:["function-name"],style:{color:"#6196cc"}},{types:["boolean","selector-id","function"],style:{color:"#fdfdfd",textShadow:"0 0 2px #001716, 0 0 3px #03edf975, 0 0 5px #03edf975, 0 0 8px #03edf975"}},{types:["class-name","maybe-class-name","builtin"],style:{color:"#fff5f6",textShadow:"0 0 2px #000, 0 0 10px #fc1f2c75, 0 0 5px #fc1f2c75, 0 0 25px #fc1f2c75"}},{types:["constant","symbol"],style:{color:"#f92aad",textShadow:"0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3"}},{types:["important","atrule","keyword","selector-class"],style:{color:"#f4eee4",textShadow:"0 0 2px #393a33, 0 0 8px #f39f0575, 0 0 2px #f39f0575"}},{types:["string","char","attr-value","regex","variable"],style:{color:"#f87c32"}},{types:["parameter"],style:{fontStyle:"italic"}},{types:["entity","url"],style:{color:"#67cdcc"}},{types:["operator"],style:{color:"ffffffee"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["entity"],style:{cursor:"help"}},{types:["inserted"],style:{color:"green"}}]},lZ={plain:{color:"#282a2e",backgroundColor:"#ffffff"},styles:[{types:["comment"],style:{color:"rgb(197, 200, 198)"}},{types:["string","number","builtin","variable"],style:{color:"rgb(150, 152, 150)"}},{types:["class-name","function","tag","attr-name"],style:{color:"rgb(40, 42, 46)"}}]}
1,lz={plain:{color:"#9CDCFE",backgroundColor:"#1E1E1E"},styles:[{types:["prolog"],style:{color:"rgb(0, 0, 128)"}},{types:["comment"],style:{color:"rgb(106, 153, 85)"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"rgb(86, 156, 214)"}},{types:["number","inserted"],style:{color:"rgb(181, 206, 168)"}},{types:["constant"],style:{color:"rgb(100, 102, 149)"}},{types:["attr-name","variable"],style:{color:"rgb(156, 220, 254)"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"rgb(206, 145, 120)"}},{types:["selector"],style:{color:"rgb(215, 186, 125)"}},{types:["tag"],style:{color:"rgb(78, 201, 176)"}},{types:["tag"],languages:["markup"],style:{color:"rgb(86, 156, 214)"}},{types:["punctuation","operator"],style:{color:"rgb(212, 212, 212)"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"rgb(220, 220, 170)"}},{types:["class-name"],style:{color:"rgb(78, 201, 176)"}},{types:["char"],style:{color:"rgb(209, 105, 105)"}}]},lq={plain:{color:"#000000",backgroundColor:"#ffffff"},styles:[{types:["comment"],style:{color:"rgb(0, 128, 0)"}},{types:["builtin"],style:{color:"rgb(0, 112, 193)"}},{types:["number","variable","inserted"],style:{color:"rgb(9, 134, 88)"}},{types:["operator"],style:{color:"rgb(0, 0, 0)"}},{types:["constant","char"],style:{color:"rgb(129, 31, 63)"}}
1,{types:["tag"],style:{color:"rgb(128, 0, 0)"}},{types:["attr-name"],style:{color:"rgb(255, 0, 0)"}},{types:["deleted","string"],style:{color:"rgb(163, 21, 21)"}},{types:["changed","punctuation"],style:{color:"rgb(4, 81, 165)"}},{types:["function","keyword"],style:{color:"rgb(0, 0, 255)"}},{types:["class-name"],style:{color:"rgb(38, 127, 153)"}}]},lK={plain:{color:"#f8fafc",backgroundColor:"#011627"},styles:[{types:["prolog"],style:{color:"#000080"}},{types:["comment"],style:{color:"#6A9955"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"#569CD6"}},{types:["number","inserted"],style:{color:"#B5CEA8"}},{types:["constant"],style:{color:"#f8fafc"}},{types:["attr-name","variable"],style:{color:"#9CDCFE"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"#cbd5e1"}},{types:["selector"],style:{color:"#D7BA7D"}},{types:["tag"],style:{color:"#0ea5e9"}},{types:["tag"],languages:["markup"],style:{color:"#0ea5e9"}},{types:["punctuation","operator"],style:{color:"#D4D4D4"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"#7dd3fc"}},{types:["class-name"],style:{color:"#0ea5e9"}},{types:["char"],style:{color:"#D16969"}}]},lG={plain:{color:"#0f172a",backgroundColor:"#f1f5f9"},styles:[{types:["prolog"],style:{color:"#000080"}},{types:["comment"],style:{color:"#6A9955"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"#0c4a6e"}},{types:["number","inserted"],style:{color:"#B5CEA8"}},{types:["constant"],style:{color:"#0f172a"}},{types:["attr-name","variable"],style:{color:"#0c4a6e"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"#64748b"}},{types:["selector"],style:{color:"#D7BA7D"}},{types:["tag"],style:{color:"#0ea5e9"}},{types:["tag"],languages:["markup"],style:{color:"#0ea5e9"}},{types:["punctuation","operator"],style:{color:"#475569"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"#0e7490"}},{types:["class-name"],style:{color:"#0ea5e9"}},{types:["char"],style:{color:"#D16969"}}]},lW={plain:{backgroundColor:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)"},styles:[{types:["comment","prolog","cdata"],style:{color:"hsl(220, 10%, 40%)"}},{types:["doctype","punctuation","entity"],style:{color:"hsl(220, 14%, 71%)"}},{types:["attr-name","class-name","maybe-class-name","boolean","constant","number","atrule"],style:{color:"hsl(29, 54%, 61%)"}},{types:["keyword"],style:{color:"hsl(286, 60%, 67%)"}},{types:["property","tag","symbol","deleted","important"],style:{color:"hsl(355, 65%, 65%)"}},{types:["selector","string","char","builtin","inserted","regex","attr-value"],style:{color:"hsl(95, 38%, 62%)"}},{types:["variable","operator","function"],style:{color:"hsl(207, 82%, 66%)"}},{types:["url"],style:{color:"hsl(187, 47%, 55%)"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"hsl(220, 14%, 71%)"}}]},lV={plain:{backgroundColor:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)"},styles:[{types:["comment","prolog","cdata"],style:{color:"hsl(230, 4%, 64%)"}},{types:["doctype","punctuation","entity"],style:{color:"hsl(230, 8%, 24%)"}},{types:["attr-name","class-name","boolean","constant","number","atrule"],style:{color:"hsl(35, 99%, 36%)"}},{types:["keyword"],style:{color:"hsl(301, 63%, 40%)"}},{types:["property","tag","symbol","deleted","important"],style:{color:"hsl(5, 74%, 59%)"}},{types:["selector","string","char","builtin","inserted","regex","attr-value","punctuation"],style:{color:"hsl(119, 34%, 47%)"}},{types:["variable","operator","function"],style:{color:"hsl(221, 87%, 60%)"}},{types:["url"],style:{color:"hsl(198, 99%, 37%)"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"hsl(230, 8%, 24%)"}}]},lH={plain:{color:"#ebdbb2",backgroundColor:"#292828"},styles:[{types:["imports","class-name","maybe-class-name","constant","doctype","builtin","function"],style:{color:"#d8a657"}},{types:["property-access"],style:{color:"#7daea3"}},{types:["tag"],style:{color:"#e78a4e"}},{types:["attr-name","char","url","regex"],style:{color:"#a9b665"}},{types:["attr-value","string"],style:{color:"#89b482"}},{types:["comment","prolog","cdata","operator","inserted"],style:{color:"#a89984"}},{types:["delimiter","boolean","keyword","selector","important","atrule","property","variable","deleted"],style:{color:"#ea6962"}},{types:["entity","number","symbol"],style:{color:"#d3869b"}}]},lJ={plain:{color:"#654735",backgroundColor:"#f9f5d7"},styles:[{types:["delimiter","boolean","keyword","selector","important","atrule","property","variable","deleted"],style:{color:"#af2528"}},{types:["imports","class-name","maybe-class-name","constant","doctype","builtin"],style:{color:"#b4730e"}},{types:["string","attr-value"],style:{color:"#477a5b"}},{types:["property-access"],style:{color:"#266b79"}},{types:["function","attr-name","char","url"],style:{color:"#72761e"}},{types:["tag"],style:{color:"#b94c07"}},{types:["comment","prolog","cdata","operator","inserted"],style:{color:"#a89984"}},{types:["entity","number","symbol"],style:{color:"#924f79"}}]},l$=e=>(0,E.useCallback)(t=>{var{className:a,style:r,line:l}=t;let s=lE(lN({},lC(t,["className","style","line"])),{className:(0,tn.Z)("token-line",a)});return"object"==typeof e&&"plain"in e&&(s.style=e.plain),"object"==typeof r&&(s.style=lN(lN({},s.style||{}),r)),s},[e]),lY=e=>{let t=(0,E.useCallback)(({types:t,empty:a})=>{if(null!=e)return 1===t.length&&"plain"===t[0]?null!=a?{display:"inline-block"}:void 0:1===t.length&&null!=a?e[t[0]]:Object.assign(null!=a?{display:"inline-block"}:{},...t.map(t=>e[t]))},[e]);return(0,E.useCallback)(e=>{var{token:a,className:r,style:l}=e;let s=lE(lN({},lC(e,["token","className","style"])),{className:(0,tn.Z)("token",...a.types,r),children:a.content,style:t(a)});return null!=l&&(s.style=lN(lN({},s.style||{}),l)),s},[t])},lX=/\r\n|\r|\n/,lQ=e=>{0===e.length?e.push({types:["plain"],content:"\n",empty:!0}):1===e.length&&""===e[0].content&&(e[0].content="\n",e[0].empty=!0)},l0=(e,t)=>{let a=e.length;return a>0&&e[a-1]===t?e:e.concat(t)},l1=e=>{let t=[[]],a=[e],r=[0],l=[e.length],s=0,n=0,i=[],o=[i];for(;n>-1;){for(;(s=r[n]++)<l[n];){let e;let d=t[n],c=a[n][s];if("string"==typeof c?(d=n>0?d:["plain"],e=c):(d=l0(d,c.type),c.alias&&(d=l0(d,c.alias)),e=c.content),"string"!=typeof e){n++,t.push(d),a.push(e),r.push(0),l.push(e.length);continue}let u=e.split(lX),p=u.length;i.push({types:d,content:u[0]});for(let e=1;e<p;e++)lQ(i),o.push(i=[]),i.push({types:d,content:u[e]})}n--,t.pop(),a.pop(),r.pop(),l.pop()}return lQ(i),o},l2=({prism:e,code:t,grammar:a,language:r})=>(0,E.useMemo)(()=>
1{if(null==a)return l1([t]);let l={code:t,grammar:a,language:r,tokens:[]};return e.hooks.run("before-tokenize",l),l.tokens=e.tokenize(t,a),e.hooks.run("after-tokenize",l),l1(l.tokens)},[t,a,r,e]),l5=(e,t)=>{let{plain:a}=e,r=e.styles.reduce((e,a)=>{let{languages:r,style:l}=a;return r&&!r.includes(t)||a.types.forEach(t=>{let a=lN(lN({},e[t]),l);e[t]=a}),e},{});return r.root=a,r.plain=lE(lN({},a),{backgroundColor:void 0}),r},l4=({children:e,language:t,code:a,theme:r,prism:l})=>{let s=t.toLowerCase(),n=l5(r,s),i=l$(n),o=lY(n),d=l.languages[s];return e({tokens:l2({prism:l,language:s,code:a,grammar:d}),className:`prism-code language-${s}`,style:null!=n?n.root:{},getLineProps:i,getTokenProps:o})},l3=e=>(0,E.createElement)(l4,lE(lN({},e),{prism:e.prism||lI,theme:e.theme||lz,code:e.code,language:e.language})),l6=a(6690);let l7=e=>{let{data:t}=e,a=t?JSON.stringify(t,null,2):"{}";return(0,N.jsxs)(l9,{className:"mx-auto h-full w-full",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-100/10 px-6 py-4 pb-3",children:[(0,N.jsx)("div",{className:"flex items-center gap-3",children:(0,N.jsx)("span",{className:"text-sm text-gray-100",children:"JSON"})}),(0,N.jsx)(se,{code:a})]}),(0,N.jsx)("div",{className:"relative h-[500px] w-full overflow-x-auto p-4",children:(0,N.jsx)(l8,{code:a,language:"json",theme:void 0})}),(0,N.jsx)("span",{className:"absolute left-0 top-1/2 h-48 w-[1px] -translate-y-1/2 animate-pulse bg-gradient-to-b from-green-500/0 via-green-800 to-green-500/0"})]})},l9=e=>{let{className:t,children:a}=e;return(0,N.jsx)(lp.E.div,{transition:{duration:.5,ease:"easeInOut",delay:.25},className:"relative h-full w-full overflow-hidden rounded-2xl border border-default-200 bg-[#1E1E1E] ".concat(t),children:a})},l8=e=>{let{code:t,language:a,theme:r}=e;return(0,N.jsx)(l3,{theme:r,code:t,language:a,children:e=>{let{style:t,tokens:a,getLineProps:r,getTokenProps:l}=e;return(0,N.jsx)("pre",{style:t,className:"text-left text-sm",children:a.map((e,t)=>(0,N.jsx)("div",{...r({line:e}),children:e.map((e,t)=>(0,N.jsx)("span",{...l({token:e})},t))},t))})}})},se=e=>{let{code:t}=e;return(0,N.jsxs)(ek.A,{variant:"solid",color:"primary",size:"sm",onPress:()=>{let e=async()=>{await navigator.clipboard.writeText(t)};J.ZP.promise(e(),{loading:"Copying...",success:"Copied to clipboard! \uD83D\uDC4C",error:"Copy failed \uD83E\uDD2F",style:{background:"#1e293b",color:"#f8fafc",border:"1px solid #334155"}})},className:"w-fit",children:[(0,N.jsx)(l6.C3L,{className:"mr-1 inline-block"})," Copy"]})};var st=e=>{let{data:t}=e;return(0,N.jsx)("div",{className:"relative w-full overflow-hidden text-default-200",children:(0,N.jsx)(l7,{data:t})})},sa=a(26716);let sr={taskId:"90d4d1a967e5d85d22ddb07f6251520c",taskType:"mj_txt2img",paramJson:'{"aspectRatio":"1:1","callBackUrl":"","fileUrl":"","prompt":"Generate an Orl\xe9ans landscape image","speed":"fast","stylization":100,"taskType":"mj_txt2img","version":"7","waterMark":"","weirdness":0}',completeTime:1752803807e3,resultInfoJson:{resultUrls:[{resultUrl:"https://tempfile.aiquickdraw.com/v/90d4d1a967e5d85d22ddb07f6251520c_0_0.jpeg"},{resultUrl:"https://tempfile.aiquickdraw.com/v/90d4d1a967e5d85d22ddb07f6251520c_0_1.jpeg"},{resultUrl:"https://tempfile.aiquickdraw.com/v/90d4d1a967e5d85d22ddb07f6251520c_0_2.jpeg"},{resultUrl:"https://tempfile.aiquickdraw.com/v/90d4d1a967e5d85d22ddb07f6251520c_0_3.jpeg"}]},successFlag:1,createTime:1752803564e3,errorCode:null,errorMessage:null},sl=["/images/pay/landscape_0.jpeg","/images/pay/landscape_1.jpeg","/images/pay/landscape_2.jpeg","/images/pay/landscape_3.jpeg"],ss=(0,Y.Pi)(e=>{var t,a;let{generatingState:r,taskId:l,setGeneratingState:s}=e,{t:n}=(0,X.Z)("dashboard"),{userStore:i}=(0,_.o)(),[o,d]=(0,E.useState)("preview"),[c,u]=(0,E.useState)(sl),[p,m]=(0,E.useState)(null),[g,h]=(0,E.useState)(sr);(0,E.useEffect)(()=>{let e=0;return"generating"===r&&l&&(e=setInterval(()=>{f(l).then(t=>{!0===t?(s("success"),clearInterval(e)):!1===t&&(s("fail"),clearInterval(e))}).catch(()=>{s("fail"),clearInterval(e)})},2e3)),()=>e&&clearInterval(e)},[r,l]);let x=e=>{e&&(0,sa.$)(e)},f=async e=>{let t=await (0,tC.Z)({headers:{Authorization:"Bearer ".concat(i.user.apiKey),"Content-Type":"application/x-www-form-urlencoded"},url:"".concat("https://api.kie.ai","/api/v1/mj/record-info?taskId=").concat(e),method:"GET"}),a=t.data.data;if(h(a||{}),3===a.successFlag||200!=t.data.code)return!1;if(1===a.successFlag){var r;return u((null===(r=a.resultInfoJson)||void 0===r?void 0:r.resultUrls).map(e=>e.resultUrl)),m(a.createTime),!0}};return(0,N.jsx)("div",{className:"relative h-full w-full bg-default-100",children:(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-start gap-4 overflow-y-auto p-4 lg:px-6 lg:py-4",children:[(0,N.jsxs)("div",{className:"mb-3 flex w-full items-center justify-between gap-2 border-b border-divider",children:[(0,N.jsxs)(lc.n,{selectedKey:o,onSelectionChange:d,variant:"underlined",classNames:{tabList:"gap-6 w-full relative rounded-none p-0",cursor:"w-full bg-primary",tab:"max-w-fit px-0 h-12",tabContent:"group-data-[selected=true]:text-primary"},children:[(0,N.jsx)(lu.r,{title:"Preview"},"preview"),(0,N.jsx)(lu.r,{title:"JSON"},"json")]}),(0,N.jsxs)("div",{className:"inline-flex items-center justify-center gap-1 rounded-lg bg-amber-500/10 px-4 py-2 text-sm text-amber-500",children:[(0,N.jsx)(li.Z,{size:14})," ",(null===(a=i.user)||void 0===a?void 0:null===(t=a.credits)||void 0===t?void 0:t.toLocaleStr
1ing())||0]})]}),(0,N.jsxs)("div",{className:"flex w-full flex-1 flex-col gap-4",children:["preview"===o?(0,N.jsx)(N.Fragment,{children:(0,N.jsx)(aM.w,{className:"mb-4 h-auto bg-black",children:(0,N.jsx)(aO.G,{className:"relative aspect-square p-0",children:"generating"===r?(0,N.jsx)("div",{className:"flex h-full items-center justify-center bg-default-200",children:(0,N.jsxs)("div",{className:"flex flex-col items-center justify-center text-center",children:[(0,N.jsx)(D.JO,{icon:"eos-icons:loading",className:"mb-2 text-4xl text-default-500"}),(0,N.jsx)("p",{className:"text-default-600",children:n("video.generationProgress")})]})}):"fail"===r?(0,N.jsx)("div",{className:"flex h-full items-center justify-center bg-default-200",children:(0,N.jsxs)("div",{className:"flex flex-col items-center justify-center text-center",children:[(0,N.jsx)(D.JO,{icon:"fluent:image-off-24-regular",className:"mb-2 h-8 w-8 text-rose-600"}),(0,N.jsx)("p",{className:"text-rose-600",children:n("video.failed")})]})}):c.length>0?(0,N.jsx)("div",{className:"grid h-full w-full grid-cols-2 grid-rows-2",children:c.slice(0,4).map((e,t)=>{let a="string"==typeof e&&(e.endsWith(".mp4")||e.endsWith(".webm"));return(0,N.jsxs)("div",{className:"group relative h-full w-full overflow-hidden",children:[a?(0,N.jsx)("video",{src:e,controls:!0,className:"h-full w-full rounded-none object-cover transition-transform duration-300 group-hover:scale-105"}):(0,N.jsx)(eI(),{width:960,height:100,quality:p?0:85,src:e,alt:"Generated image ".concat(t+1),className:"h-full w-full rounded-none object-cover transition-transform duration-300 group-hover:scale-105",removeWrapper:!0}),c!=sl&&(0,N.jsx)("div",{className:"absolute bottom-2 right-2 z-[99] opacity-50 transition duration-300 group-hover:opacity-100",children:(0,N.jsx)("button",{color:"primary",onClick:()=>x(e),className:"inline-flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-primary-foreground backdrop-blur-md",children:(0,N.jsx)(D.JO,{icon:"carbon:download",className:"h-4 w-4"})})})]},t)})}):(0,N.jsx)("div",{className:"flex h-full items-center justify-center bg-default-200",children:(0,N.jsxs)("div",{className:"flex flex-col items-center justify-center text-center",children:[(0,N.jsx)(D.JO,{icon:"carbon:image",className:"mb-2 text-4xl text-default-400"}),(0,N.jsx)("p",{className:"text-default-600",children:n("video.waitingStart")})]})})})})}):(0,N.jsx)(N.Fragment,{children:(0,N.jsx)(aM.w,{className:"h-auto w-full",children:(0,N.jsx)(aO.G,{className:"h-auto w-full p-0",children:(0,N.jsx)(st,{data:g})})})}),(0,N.jsx)("div",{className:"flex w-full flex-col items-start gap-2",children:"success"===r&&(0,N.jsx)("div",{className:"w-full",children:(0,N.jsxs)("p",{className:"text-sm text-default-600",children:["Generated in"," ",(0,N.jsx)("span",{className:"font-semibold text-default-800",children:new Date(p).toLocaleString()||"3.8 seconds"})]})})})]})]})})}),sn=(0,Y.Pi)(()=>{let[e,t]=(0,E.useState)("example"),[a,r]=(0,E.useState)();return(0,N.jsx)("div",{className:"relative h-full w-full",children:(0,N.jsxs)("div",{className:"flex h-full w-full flex-col overflow-hidden rounded-2xl lg:h-[84vh] lg:flex-row",children:[(0,N.jsx)("div",{className:"w-full flex-shrink-0 border-r border-default-200 lg:w-2/5 xl:w-1/3",children:(0,N.jsx)(ld,{generatingState:e,setGeneratingState:t,setTaskId:r})}),(0,N.jsx)("div",{className:"w-full flex-1 overflow-y-auto lg:w-3/5 xl:w-2/3",children:(0,N.jsx)(ss,{generatingState:e,taskId:a,setGeneratingState:t})})]})})});function si(e){let{recordDetails:t,generating:a}=e,[r,l]=(0,E.useState)(!1),s=async e=>{if(e){l(!0);try{J.ZP.loading("Downloading video...");let t=await fetch(e),a=await t.blob(),r=window.URL.createObjectURL(a),l=document.createElement("a");l.href=r,l.download="video-".concat(Date.now(),".mp4"),document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(r),J.ZP.dismiss(),J.ZP.success("Video downloaded successfully!")}catch(e){J.ZP.dismiss(),J.ZP.error("Failed to download video")}finally{l(!1)}}};return(0,N.jsx)("div",{className:"relative m-auto flex w-full flex-col items-center justify-center lg:h-[60vh] lg:w-[100%]",children:(0,N.jsx)("div",{className:"flex w-full flex-1 flex-col-reverse items-start justify-between overflow-y-auto p-4 lg:h-full lg:flex-row",children:(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-start gap-2",children:(()=>{var e,l,n;if((null==t?void 0:t.successFlag)===3)return(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 whitespace-pre-line py-6 text-center text-rose-600",children:[(0,N.jsx)(eI(),{src:"https://static.aiquickdraw.com/tools/example/1769078665776_Hn1MMDiA.png",alt:"failed",width:144,height:144,className:"aspect-square w-36"}),(0,N.jsx)("p",{children:"Generation Failed"}),(null==t?void 0:t.errorMessage)&&(0,N.jsx)("p",{className:"text-sm text-gray-500",children:t.errorMessage}),(null==t?void 0:t.failCode)&&(0,N.jsxs)("p",{className:"text-xs text-gray-400",children:["Error Code: ",t.failCode]})]});if((null==t?void 0:t.successFlag)===void 0)return a?(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,N.jsxs)("div",{className:"relative w-2/3 overflow-hidden rounded-xl",children:[(0,N.jsx)(eI(),{width:600,height:600,src:"https://file.aiquickdraw.com/custom-page/image/1733384621863dr5jxiyq.webp",alt:"processing",className:"w-full"}),(0,N.jsx)("div",{className:"absolute left-1/2 top-1/2 inline-block -translate-x-1/2 -translate-y-1/2",children:(0,N.jsx)("div",{className:"h-16 w-16 animate-spin rounded-full border-4 border-blue-500 border-t-transparent"})})]}),(0,N.jsx)("p",{className:"flex w-full items-center justify-center gap-2 text-gray-600 dark:text-gray-400",children:"Processing video conversion..."}),(0,N.jsx)("p",{className:"mt-1 w-full whitespace-pre-wrap break-words px-3 text-center text-sm text-gray-500 dark:text-gray-500",children:"This may take 1-3 minutes"})]})}):(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:[(0,N.jsx)(eI(),{src:"https://static.aiquickdraw.com/tools/example/1769078665776_Hn1MMDiA.png",alt:"video placeholder",width:144,height:144,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Enter a task ID to get the video version of your video."})]});if((null==t?void 0:t.successFlag)===0)return(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,N.jsxs)("div",{className:"relative w-2/3 overflow-hidden rounded-xl",children:[(0,N.jsx)(eI(),{width:600,height:600,src:"https://file.aiquickdraw.com/custom-page/image/1733384621863dr5jxiyq.webp",alt:"processing",className:"w-full"}),(0,N.jsx)("div",{className:"absolute left-1/2 top-1/2 inline-block -translate-x-1/2 -translate-y-1/2",children:(0,N.jsx)("div",{className:"h-16 w-16 animate-spin rounded-full border-4 border-blue-500 border-t-transparent"})})]}),(0,N.jsxs)("p",{className:"flex w-full items-center justify-center gap-2 text-gray-600 dark:text-gray-400",children:["wait"===t.state&&"Task submitted, waiting to queue...","queueing"===t.state&&"Task in queue, waiting to start...","generating"===t.state&&"Generating video..."]}),(0,N.jsx)("p",{className:"mt-1 w-full whitespace-pre-wrap break-words px-3 text-center text-sm text-gray-500 dark:text-gray-500",children:"This may take 1-3 minutes"})]})});let i=null==t?void 0:null===(n=t.resultInfoJson)||void 0===n?void 0:null===(l=n.resultUrls)||void 0===l?void 0:null===(e=l[0])||void 0===e?void 0:e.resultUrl;return 1===t.successFlag?(0,N.jsxs)("div",{className:"flex h-[inherit] w-full flex-col items-end gap-4 roun
1ded-xl p-3 shadow-sm",children:[(0,N.jsx)("div",{className:"relative flex w-full items-center justify-center",children:(0,N.jsx)("video",{src:i,controls:!0,className:"h-full w-auto rounded-lg",children:"Your browser does not support the video tag."})}),(0,N.jsx)("button",{onClick:()=>s(i),disabled:r,className:"flex h-9 w-9 items-center justify-center rounded-lg bg-primary text-white opacity-70 transition duration-500 hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-50",title:"Download video",children:r?(0,N.jsx)("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,N.jsx)(D.JO,{icon:"material-symbols:download",className:"h-5 w-5"})})]}):(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,N.jsxs)("div",{className:"relative w-2/3 overflow-hidden rounded-xl",children:[(0,N.jsx)(eI(),{width:600,height:600,src:"https://file.aiquickdraw.com/custom-page/image/1733384621863dr5jxiyq.webp",alt:"processing",className:"w-full"}),(0,N.jsx)("div",{className:"absolute left-1/2 top-1/2 inline-block -translate-x-1/2 -translate-y-1/2",children:(0,N.jsx)("div",{className:"h-16 w-16 animate-spin rounded-full border-4 border-blue-500 border-t-transparent"})})]}),(0,N.jsx)("p",{className:"flex w-full items-center justify-center gap-2 text-gray-600 dark:text-gray-400",children:"Generating video..."}),(0,N.jsx)("p",{className:"mt-1 w-full whitespace-pre-wrap break-words px-3 text-center text-sm text-gray-500 dark:text-gray-500",children:"This may take 1-3 minutes"})]})})})()})})})}function so(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({prompt:"",taskType:"mj_video_extend_manual",taskId:"",index:0,waterMark:"",callBackUrl:"playground"})},[]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))},l=(e,t)=>{a(a=>({...a||{},[e]:t}))};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsx)(tz,{label:"taskType",options:[{value:"mj_video_extend_manual",label:"mj_video_extend_manual"},{value:"mj_video_extend_auto",label:"mj_video_extend_auto"}],value:null==t?void 0:t.taskType,onChange:(e,t)=>
1{l(t,e),r(t,e)},name:"taskType",description:"Choose extension mode: manual requires a prompt, auto uses AI continuation",required:!0}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["prompt"," ",(null==t?void 0:t.taskType)==="mj_video_extend_auto"?"":(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("textarea",{value:(null==t?void 0:t.prompt)||"",onChange:e=>l("prompt",e.target.value),onBlur:e=>r("prompt",e.target.value),placeholder:"Continue the scene with the spacecraft accelerating into a colorful nebula with dynamic light trails",rows:3,className:"w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Describe how to extend/continue the video scene"})})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["taskId ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.taskId)||"",onChange:e=>l("taskId",e.target.value),onBlur:e=>r("taskId",e.target.value),placeholder:"Enter Task ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Task ID from a completed MJ video generation"})})]}),(0,N.jsx)(tz,{label:"index",options:[{value:0,label:"0"},{value:1,label:"1"},{value:2,label:"2"},{value:3,label:"3"}],value:null==t?void 0:t.index,onChange:(e,t)=>
1{l(t,e),r(t,e)},name:"index",description:"Index of the video to extend",required:!0}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["waterMark ",(0,N.jsx)("span",{className:"text-gray-400",children:"(Optional)"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.waterMark)||"",onChange:e=>l("waterMark",e.target.value),onBlur:e=>r("waterMark",e.target.value),placeholder:"Enter watermark identifier",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]})]})}var sd=(0,Y.Pi)(()=>{var e,t;let{userStore:a}=(0,_.o)(),[r,l]=(0,E.useState)({}),[s,n]=(0,E.useState)(null),[i,o]=(0,E.useState)({}),[d,c]=(0,E.useState)(!1),u=async e=>{if(!d){c(!0),n(null),o({});try{var t,r;if("mj_video_extend_manual"===e.taskType){if(!e.prompt||""===e.prompt.trim())throw Error("Please enter a continuation prompt for manual extension");if(e.prompt.length>2e3)throw Error("Prompt must not exceed 2000 characters")}if(!e.taskId)throw Error("Please enter task ID");if(void 0===e.index||null===e.index)throw Error("Please specify the video index to extend");let l=null===(t=a.user)||void 0===t?void 0:t.apiKey;if(!l)throw Error("Please login and set your API key");let s={prompt:e.prompt,taskType:e.taskType||"mj_video_extend_manual",taskId:e.taskId,index:e.index||0,waterMark:e.waterMark||"",callBackUrl:e.callBackUrl||"playground"},i=await fetch("".concat("https://api.kie.ai","/api/v1/mj/generateVideoExtend"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(l)},body:JSON.stringify(s)}),d=null;try{d=await i.json()}catch(e){d={}}if(o(d),!i.ok)throw Error((null==d?void 0:d.msg)||"Failed to create video extend task");let u=null==d?void 0:null===(r=d.data)||void 0===r?void 0:r.taskId;if(!u)throw Error("Failed to get task ID from response");let p=0,m=1/0,g=async()=>{p++;try{let e=await fetch("".concat("https://api.kie.ai","/api/v1/mj/record-info?taskId=").concat(u),{method:"GET",headers:{Authorization:"Bearer ".concat(l)}}),t=null;if(t=await e.json(),o(t),n(t.data),e.ok&&(null==t?void 0:t.data)){let e=t.data;if(1===e.successFlag){n(e),c(!1),J.ZP.success("Video extended successfully");return}if(3===e.successFlag){n(e),c(!1),J.ZP.error(e.errorMessage||"Failed to create video extend task");return}}if(p<m)setTimeout(g,2e3);else throw Error("Video extend timeout")}catch(e){p>=m&&(n({successFlag:3,status:"FAILED",errorMessage:e.message||"Video extend timeout"}),J.ZP.error(e.message||"Video extend timeout"),c(!1))}};setTimeout(g,2e3)}catch(e){n({successFlag:3,status:"FAILED",errorMessage:e.message||"Failed to create video extend task"}),J.ZP.error(e.message||"Failed to create video extend task"),c(!1)}}},p=(null==r?void 0:r.taskType)==="mj_video_extend_manual"?"mj_video_extend_manual":(null==r?void 0:r.taskType)==="mj_video_extend_auto"?"mj_video_extend_auto":null,m=p?null===(t=a.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e[p]:60;return(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(so,{formData:r,setFormData:l}),OutputPanelContent:(0,N.jsx)(si,{recordDetails:s,generating:d}),run:()=>u(r),formData:r,outputData:i,generating:d,credit:m,layoutRatio:"40-60"})});let sc=["/images/pay/landscape_0.jpeg","/images/pay/landscape_1.jpeg","/images/pay/landscape_2.jpeg","/images/pay/landscape_3.jpeg"],su=(0,Y.Pi)(e=>{let{recordDetails:t,generating:a}=e,[r,l]=(0,E.useState)(sc),[s,n]=(0,E.useState)(null);(0,E.useEffect)(()=>{if((null==t?void 0:t.successFlag)===1){var e;let a=null===(e=t.resultInfoJson)||void 0===e?void 0:e.resultUrls;a&&a.length>0&&(l(a.map(e=>e.resultUrl||e)),n(t.createTime))}},[t]);let i=e=>{e&&(0,sa.$)(e)};return(0,N.jsx)("div",{className:"relative m-auto flex w-full flex-col items-center justify-center lg:h-[60vh] lg:w-[100%]",children:(0,N.jsx)("div",{className:"flex w-full flex-1 flex-col-reverse items-start justify-between overflow-y-auto p-4 lg:h-full lg:flex-row",children:(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-start gap-2",children:(()=>
1{if((null==t?void 0:t.successFlag)===3||(null==t?void 0:t.status)==="FAILED"||(null==t?void 0:t.errorMessage))return(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 whitespace-pre-line py-6 text-center text-rose-600",children:[(0,N.jsx)(eI(),{src:"https://static.aiquickdraw.com/tools/example/1769396070473_AIx8c9Ug.webp",alt:"failed",width:144,height:144,className:"aspect-square w-36"}),(0,N.jsx)("p",{children:"Generation Failed"}),(null==t?void 0:t.errorMessage)&&(0,N.jsx)("p",{className:"text-sm text-gray-500",children:t.errorMessage})]});if(a&&(!t||1!==t.successFlag))return(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,N.jsxs)("div",{className:"relative w-2/3 overflow-hidden rounded-xl",children:[(0,N.jsx)(eI(),{width:600,height:600,src:"https://file.aiquickdraw.com/custom-page/image/1733384621863dr5jxiyq.webp",alt:"processing",className:"w-full object-contain"}),(0,N.jsx)("div",{className:"absolute inset-0 bg-white/20 dark:bg-white/30"}),(0,N.jsx)("div",{className:"absolute left-1/2 top-1/2 inline-block -translate-x-1/2 -translate-y-1/2",children:(0,N.jsx)("div",{className:"h-16 w-16 animate-spin rounded-full border-4 border-blue-500 border-t-transparent"})})]}),(0,N.jsx)("p",{className:"flex w-full items-center justify-center gap-2 text-gray-600 dark:text-gray-400",children:"Generating images..."}),(0,N.jsx)("p",{className:"mt-1 w-full whitespace-pre-wrap break-words px-3 text-center text-sm text-gray-500 dark:text-gray-500",children:"This may take 1-2 minutes"})]})});if(r.length>0&&r!==sc){let e=r.length;return(0,N.jsxs)("div",{className:"flex h-[inherit] w-full flex-col items-end gap-4 rounded-xl p-3 shadow-sm",children:[(0,N.jsx)("div",{className:"relative flex min-h-[380px] w-full flex-1 items-center justify-center",children:1===e?(0,N.jsx)("div",{className:"flex w-full items-center justify-center p-6",children:(0,N.jsxs)("div",{className:"group relative max-w-lg overflow-hidden rounded-lg",children:[(0,N.jsx)(eI(),{width:600,height:600,quality:s?0:85,src:r[0],alt:"Generated image",className:"w-full rounded-lg object-contain transition-transform duration-300 group-hover:scale-105",removeWrapper:!0}),(0,N.jsx)("div",{className:"absolute bottom-2 right-2 z-[99] opacity-50 transition duration-300 group-hover:opacity-100",children:(0,N.jsx)("button",{onClick:()=>i(r[0]),className:"inline-flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-white opacity-70 transition duration-500 hover:opacity-100",title:"Download image",children:(0,N.jsx)(D.JO,{icon:"material-symbols:download",className:"h-5 w-5"})})})]})}):(0,N.jsx)("div",{className:"grid h-full w-full grid-cols-2 grid-rows-2 gap-2",children:r.slice(0,4).map((e,t)=>(0,N.jsxs)("div",{className:"group relative h-full w-full overflow-hidden rounded-lg",children:[(0,N.jsx)(eI(),{width:960,height:100,quality:s?0:85,src:e,alt:"Generated image ".concat(t+1),className:"h-full w-full rounded-lg object-cover transition-transform duration-300 group-hover:scale-105",removeWrapper:!0}),(0,N.jsx)("div",{className:"absolute bottom-2 right-2 z-[99] opacity-50 transition duration-300 group-hover:opacity-100",children:(0,N.jsx)("button",{onClick:()=>i(e),className:"inline-flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-white opacity-70 transition duration-500 hover:opacity-100",title:"Download image",children:(0,N.jsx)(D.JO,{icon:"material-symbols:download",className:"h-5 w-5"})})})]},t))})}),s&&(0,N.jsx)("div",{className:"w-full text-center",children:(0,N.jsxs)("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Generated at ",new Date(s).toLocaleString()]})})]})}return(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:[(0,N.jsx)(eI(),{src:"https://static.aiquickdraw.com/tools/example/1769396070473_AIx8c9Ug.webp",alt:"image placeholder",width:144,height:144,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Configure your parameters and click Run to generate images."})]})})()})})})});function sp(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({taskId:"",imageIndex:0,waterMark:""})},[]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))},l=(e,t)=>
1{a(a=>({...a||{},[e]:t}))};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["taskId ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.taskId)||"",onChange:e=>l("taskId",e.target.value),onBlur:e=>r("taskId",e.target.value),placeholder:"Enter Task ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Task ID returned from MJ generation task"})})]}),(0,N.jsx)(tz,{label:"imageIndex",options:[{value:0,label:"0"},{value:1,label:"1"},{value:2,label:"2"},{value:3,label:"3"}],value:null==t?void 0:t.imageIndex,onChange:e=>{let t=parseInt(e,10);l("imageIndex",t),r("imageIndex",t)},description:"Image index for the 4 generated images, range 0-3",required:!0,name:"imageIndex"}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["waterMark ",(0,N.jsx)("span",{className:"text-gray-400",children:"(Optional)"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.waterMark)||"",onChange:e=>l("waterMark",e.target.value),onBlur:e=>r("waterMark",e.target.value),placeholder:"Enter watermark identifier",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]})]})}var sm=(0,Y.Pi)(()=>{var e,t;let{t:a}=(0,X.Z)("dashboard"),r=(0,le.useRouter)(),{userStore:l}=(0,_.o)(),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)(null),[d,c]=(0,E.useState)({}),[u,p]=(0,E.useState)(!1),[m,g]=(0,E.useState)(!1),[h,x]=(0,E.useState)(!1),f=(0,E.useRef)(null),y=e=>{let t=setInterval(async()=>{try{var a,r;let s=null===(a=l.user)||void 0===a?void 0:a.apiKey;if(!s){clearInterval(t),p(!1);return}let n=await (0,tC.Z)({headers:{Authorization:"Bearer ".concat(s),"Content-Type":"application/x-www-form-urlencoded"},url:"".concat("https://api.kie.ai","/api/v1/mj/record-info?taskId=").concat(e),method:"GET"});if(200===n.data.code){let e=n.data.data;c(n.data),o(e),0===e.successFlag||(1===e.successFlag?(p(!1),clearInterval(t),f.current=null,J.ZP.success("MJ Generate Image Vary completed")):3===e.successFlag&&(p(!1),clearInterval(t),f.current=null,J.ZP.error(e.errorMessage||"Failed to generate image vary")))}else clearInterval(t),f.current=null,p(!1),J.ZP.error((null===(r=n.data)||void 0===r?void 0:r.msg)||"Failed to get task status")}catch(e){clearInterval(t),f.current=null,p(!1),J.ZP.error(e.message||"Failed to get task status")}},1500);f.current=t};(0,E.useEffect)(()=>()=>{f.current&&(clearInterval(f.current),f.current=null)},[]);let v=async e=>{var t,s,n,d;if(!l.user){g(!0);return}if(!l.user.apiKey){J.ZP.error(a("toast.apiKeyEmpty")),r.push("/api-key");return}if(!(null===(t=e.taskId)||void 0===t?void 0:t.trim())){J.ZP.error("Please enter taskId");return}if(u)return;f.current&&(clearInterval(f.current),f.current=null),i&&o(null),p(!0),c({});let m={taskId:e.taskId.trim(),imageIndex:Number(null!==(n=e.imageIndex)&&void 0!==n?n:1),callBackUrl:"playground"};(null===(s=e.waterMark)||void 0===s?void 0:s.trim())&&(m.waterMark=e.waterMark.trim());try{let e=await (0,tC.Z)({headers:{Authorization:"Bearer ".concat(null===(d=l.user)||void 0===d?void 0:d.apiKey),"Content-Type":"application/json"},url:"".concat("https://api.kie.ai","/api/v1/mj/generateVary"),method:"POST",data:m});if(200===e.data.code){let t=e.data.data,a="";if("string"==typeof t?a=t:t&&"object"==typeof t&&(a=t.taskId||t.task_id||t.id||""),a||(a=e.data.taskId||e.data.task_id||""),!a){J.ZP.error("No task ID returned"),p(!1);return}y(a),l.loadUserInfo()}else 402===e.data.code?x(!0):J.ZP.error(e.data.msg||"Failed to generate image vary"),p(!1)}catch(e){p(!1),J.ZP.error(a("toast.serverAbnormal"))}},b=(null===(t=l.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e.mj_vary)||12;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(sp,{formData:s,setFormData:n}
1),OutputPanelContent:(0,N.jsx)(su,{recordDetails:i,generating:u}),run:()=>v(s),formData:s,outputData:d,generating:u,credit:b,layoutRatio:"40-60"}),(0,N.jsx)(tt.default,{isOpen:m,onClose:()=>g(!1)}),(0,N.jsx)(r8.Z,{isOpen:h,onClose:()=>x(!1)})]})});function sg(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({taskId:"",imageIndex:0,waterMark:""})},[]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))},l=(e,t)=>{a(a=>({...a||{},[e]:t}))};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["taskId ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.taskId)||"",onChange:e=>l("taskId",e.target.value),onBlur:e=>r("taskId",e.target.value),placeholder:"Enter Task ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Task ID returned from MJ generation task"})})]}),(0,N.jsx)(tz,{label:"imageIndex",options:[{value:0,label:"0"},{value:1,label:"1"},{value:2,label:"2"},{value:3,label:"3"}],value:null==t?void 0:t.imageIndex,onChange:(e,t)=>
1{let a=parseInt(e,10);l(t,a),r(t,a)},name:"imageIndex",description:"Image index for the 4 generated images, range 0-3",required:!0}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["waterMark ",(0,N.jsx)("span",{className:"text-gray-400",children:"(Optional)"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.waterMark)||"",onChange:e=>l("waterMark",e.target.value),onBlur:e=>r("waterMark",e.target.value),placeholder:"Enter watermark identifier",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]})]})}var sh=(0,Y.Pi)(()=>{var e,t;let{t:a}=(0,X.Z)("dashboard"),r=(0,le.useRouter)(),{userStore:l}=(0,_.o)(),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)(null),[d,c]=(0,E.useState)({}),[u,p]=(0,E.useState)(!1),[m,g]=(0,E.useState)(!1),[h,x]=(0,E.useState)(!1),f=(0,E.useRef)(null),y=e=>{let t=setInterval(async()=>{try{var a,r;let s=null===(a=l.user)||void 0===a?void 0:a.apiKey;if(!s){clearInterval(t),p(!1);return}let n=await (0,tC.Z)({headers:{Authorization:"Bearer ".concat(s),"Content-Type":"application/x-www-form-urlencoded"},url:"".concat("https://api.kie.ai","/api/v1/mj/record-info?taskId=").concat(e),method:"GET"});if(200===n.data.code){let e=n.data.data;c(n.data),o(e),0===e.successFlag||(1===e.successFlag?(p(!1),clearInterval(t),f.current=null,J.ZP.success("MJ Generate Image Upscale completed")):3===e.successFlag&&(p(!1),clearInterval(t),f.current=null,J.ZP.error(e.errorMessage||"Failed to generate image upscale")))}else clearInterval(t),f.current=null,p(!1),J.ZP.error((null===(r=n.data)||void 0===r?void 0:r.msg)||"Failed to get task status")}catch(e){clearInterval(t),f.current=null,p(!1),J.ZP.error(e.message||"Failed to get task status")}},1500);f.current=t};(0,E.useEffect)(()=>()=>{f.current&&(clearInterval(f.current),f.current=null)},[]);let v=async e=>{var t,s,n,d;if(!l.user){g(!0);return}if(!l.user.apiKey){J.ZP.error(a("toast.apiKeyEmpty")),r.push("/api-key");return}if(!(null===(t=e.taskId)||void 0===t?void 0:t.trim())){J.ZP.error("Please enter taskId");return}if(u)return;f.current&&(clearInterval(f.current),f.current=null),i&&o(null),p(!0),c({});let m={taskId:e.taskId.trim(),imageIndex:Number(null!==(n=e.imageIndex)&&void 0!==n?n:0),callBackUrl:"playground"};(null===(s=e.waterMark)||void 0===s?void 0:s.trim())&&(m.waterMark=e.waterMark.trim());try{let e=await (0,tC.Z)({headers:{Authorization:"Bearer ".concat(null===(d=l.user)||void 0===d?void 0:d.apiKey),"Content-Type":"application/json"},url:"".concat("https://api.kie.ai","/api/v1/mj/generateUpscale"),method:"POST",data:m});if(200===e.data.code){let t=e.data.data,a="";if("string"==typeof t?a=t:t&&"object"==typeof t&&(a=t.taskId||t.task_id||t.id||""),a||(a=e.data.taskId||e.data.task_id||""),!a){J.ZP.error("No task ID returned"),p(!1);return}y(a),l.loadUserInfo()}else 402===e.data.code?x(!0):J.ZP.error(e.data.msg||"Failed to generate image upscale"),p(!1)}catch(e){p(!1),J.ZP.error(a("toast.serverAbnormal"))}},b=(null===(t=l.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e.mj_upscale)||12;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(sg,{formData:s,setFormData:n}),OutputPanelContent:(0,N.jsx)(su,{recordDetails:i,generating:u}),run:()=>v(s),formData:s,outputData:d,generating:u,credit:b,layoutRatio:"40-60"}),(0,N.jsx)(tt.default,{isOpen:m,onClose:()=>g(!1)}),(0,N.jsx)(r8.Z,{isOpen:h,onClose:()=>x(!1)})]})}),sx=e=>{let{pageData:t}=e;switch(t.model){case"midjourney/extend":return(0,N.jsx)(sd,{pageData:t});case"midjourney/upscale":return(0,N.jsx)(sh,{pageData:t});case"midjourney/vary":return(0,N.jsx)(sm,{pageData:t});default:return(0,N.jsx)(sn,{})}};function sf(e){let{recordDetails:t,generating:a}=e,[r,l]=(0,E.useState)(!1),s=async e=>{if(e){l(!0);try{J.ZP.loading("Downloading video...");let t=await fetch(e),a=await t.blob(),r=window.URL.createObjectURL(a),l=document.createElement("a");l.href=r,l.download="video-".concat(Date.now(),".mp4"),document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(r),J.ZP.dismiss(),J.ZP.success("Video downloaded successfully!")}catch(e){J.ZP.dismiss(),J.ZP.error("Failed to download video")}finally{l(!1)}}};return(0,N.jsx)("div",{className:"relative m-auto flex w-full flex-col items-center justify-center lg:h-[60vh] lg:w-[100%]",children:(0,N.jsx)("div",{className:"flex w-full flex-1 flex-col-reverse items-start justify-between overflow-y-auto p-4 lg:h-full lg:flex-row",children:(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-start gap-2",children:(()=>{var e,l,n,i,o;if((null==t?void 0:t.state)==="fail"||(null==t?void 0:t.successFlag)===3||(null==t?void 0:t.status)==="FAILED"||(null==t?void 0:t.errorMessage))return(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 whitespace-pre-line py-6 text-center text-rose-600",children:[(0,N.jsx)(eI(),{src:"https://static.aiquickdraw.com/tools/example/1769078665776_Hn1MMDiA.png",alt:"failed",width:144,height:144,className:"aspect-square w-36"}),(0,N.jsx)("p",{children:"Generation Failed"}),(null==t?void 0:t.errorMessage)&&(0,N.jsx)("p",{className:"text-sm text-gray-500",children:t.errorMessage}),(null==t?void 0:t.failCode)&&(0,N.jsxs)("p",{className:"text-xs text-gray-400",children:["Error Code: ",t.failCode]})]});if(!t)return a?(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,N.jsxs)("div",{className:"relative w-2/3 overflow-hidden rounded-xl",children:[(0,N.jsx)(eI(),{width:600,height:600,src:"https://file.aiquickdraw.com/custom-page/image/1733384621863dr5jxiyq.webp",alt:"processing",className:"w-full"}),(0,N.jsx)("div",{className:"absolute left-1/2 top-1/2 inline-block -translate-x-1/2 -translate-y-1/2",children:(0,N.jsx)("div",{className:"h-16 w-16 animate-spin rounded-full border-4 border-blue-500 border-t-transparent"})})]}),(0,N.jsx)("p",{className:"flex w-full items-center justify-center gap-2 text-gray-600 dark:text-gray-400",children:"Processing video conversion..."}),(0,N.jsx)("p",{className:"mt-1 w-full whitespace-pre-wrap break-words px-3 text-center text-sm text-gray-500 dark:text-gray-500",children:"This may take 1-3 minutes"})]})}):(0,N.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:[(0,N.jsx)(eI(),{src:"https://static.aiquickdraw.com/tools/example/1769078665776_Hn1MMDiA.png",alt:"video placeholder",width:144,height:144,className:"aspect-square w-36"}),(0,N.jsx)("p",{className:"w-full whitespace-pre-line break-all text-center text-sm leading-7 text-gray-600 dark:text-gray-400",children:"Enter a task ID to get the video version of your video."})]});if("wait"===t.state||"queueing"===t.state||"generating"===t.state)return(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,N.jsxs)("div",{className:"relative w-2/3 overflow-hidden rounded-xl",children:[(0,N.jsx)(eI(),{width:600,height:600,src:"https://file.aiquickdraw.com/custom-page/image/1733384621863dr5jxiyq.webp",alt:"processing",className:"w-full"}),(0,N.jsx)("div",{className:"absolute left-1/2 top-1/2 inline-block -translate-x-1/2 -translate-y-1/2",children:(0,N.jsx)("div",{className:"h-16 w-16 animate-spin rounded-full border-4 border-blue-500 border-t-transparent"})})]}),(0,N.jsxs)("p",{className:"flex w-full items-center justify-center gap-2 text-gray-600 dark:text-gray-400",children:["wait"===t.state&&"Task submitted, waiting to queue...","queueing"===t.state&&"Task in queue, waiting to start...","generating"===t.state&&"Generating video..."]}),(0,N.jsx)("p",{className:"mt-1 w-full whitespace-pre-wrap break-words px-3 text-center text-sm text-gray-500 dark:text-gray-500",children:"This may take 1-3 minutes"})]})});let d=(null==t?void 0:t.videoUrl)||(null==t?void 0:null===(e=t.videoInfo)||void 0===e?void 0:e.videoUrl)||(null==t?void 0:t.resultUrl)||(null==t?void 0:null===(l=t.resultUrls)||void 0===l?void 0:l[0])||(null==t?void 0:null===(i=t.response)||void 0===i?void 0:null===(n=i.resultUrls)||void 0===n?void 0:n[0]);if(d){let e=(null==t?void 0:t.expireFlag)===1;return(0,N.jsxs)("div",{className:"flex h-[inherit] w-full flex-col items-end gap-4 roun
1ded-xl p-3 shadow-sm",children:[e&&(0,N.jsx)("div",{className:"w-full rounded-lg bg-yellow-50 p-3 text-center text-sm text-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-400",children:"Video link has expired (valid for 14 days)"}),(0,N.jsx)("div",{className:"relative flex w-full items-center justify-center",children:(0,N.jsx)("video",{src:d,controls:!0,className:"h-full w-auto rounded-lg",poster:(null==t?void 0:null===(o=t.videoInfo)||void 0===o?void 0:o.imageUrl)||"https://file.aiquickdraw.com/custom-page/image/1733384621863dr5jxiyq.webp",children:"Your browser does not support the video tag."})}),(0,N.jsx)("button",{onClick:()=>s(d),disabled:r||e,className:"flex h-9 w-9 items-center justify-center rounded-lg bg-primary text-white opacity-70 transition duration-500 hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-50",title:e?"Video expired":"Download video",children:r?(0,N.jsx)("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,N.jsx)(D.JO,{icon:"material-symbols:download",className:"h-5 w-5"})})]})}return"success"!==t.state||d?(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,N.jsxs)("div",{className:"relative w-2/3 overflow-hidden rounded-xl",children:[(0,N.jsx)(eI(),{width:100,height:100,src:"https://file.aiquickdraw.com/custom-page/image/1733384621863dr5jxiyq.webp",alt:"processing",className:"w-full"}),(0,N.jsx)("div",{className:"absolute left-1/2 top-1/2 inline-block -translate-x-1/2 -translate-y-1/2",children:(0,N.jsx)("div",{className:"h-16 w-16 animate-spin rounded-full border-4 border-blue-500 border-t-transparent"})})]}),(0,N.jsx)("p",{className:"flex w-full items-center justify-center gap-2 text-gray-600 dark:text-gray-400",children:"Processing..."}),(0,N.jsx)("p",{className:"mt-1 w-full whitespace-pre-wrap break-words px-3 text-center text-sm text-gray-500 dark:text-gray-500",children:"This may take 1-3 minutes"})]})}):(0,N.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-4",children:(0,N.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:[(0,N.jsxs)("div",{className:"relative w-2/3 overflow-hidden rounded-xl",children:[(0,N.jsx)(eI(),{width:100,height:100,src:"https://file.aiquickdraw.com/custom-page/image/1733384621863dr5jxiyq.webp",alt:"processing",className:"w-full"}),(0,N.jsx)("div",{className:"absolute left-1/2 top-1/2 inline-block -translate-x-1/2 -translate-y-1/2",children:(0,N.jsx)("div",{className:"h-16 w-16 animate-spin rounded-full border-4 border-blue-500 border-t-transparent"})})]}),(0,N.jsx)("p",{className:"flex w-full items-center justify-center gap-2 text-gray-600 dark:text-gray-400",children:"Preparing video..."}),(0,N.jsx)("p",{className:"mt-1 w-full whitespace-pre-wrap break-words px-3 text-center text-sm text-gray-500 dark:text-gray-500",children:"This may take 1-3 minutes"})]})})})()})})})}function sy(e){let{formData:t,setFormData:a}=e;(0,E.useEffect)(()=>{t&&0!==Object.keys(t).length||a({taskId:"",prompt:"",quality:"720p",waterMark:""})},[]);let r=(e,t)=>{a(a=>({...a||{},[e]:t}))},l=(e,t)=>{a(a=>({...a||{},[e]:t}))};return(0,N.jsxs)("div",{className:"space-y-6",children:[(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["taskId ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.taskId)||"",onChange:e=>l("taskId",e.target.value),onBlur:e=>r("taskId",e.target.value),placeholder:"Enter original video generation task ID",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"The taskId must be a valid taskId returned from the video generation interface. Note: Video generated after 1080P cannot be extended."})})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["prompt ",(0,N.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,N.jsx)("textarea",{value:(null==t?void 0:t.prompt)||"",onChange:e=>l("prompt",e.target.value),onBlur:e=>r("prompt",e.target.value),placeholder:"Describe how you want the video to be extended, including actions, scene changes, style, etc.",rows:4,className:"w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"}),(0,N.jsx)("div",{className:"mt-1 space-y-1",children:(0,N.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Describe the text prompt for extending the video content."})})]}
1),(0,N.jsx)(tz,{label:"quality",options:[{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}],value:(null==t?void 0:t.quality)||"720p",onChange:e=>{l("quality",e),r("quality",e)},description:"Video resolution.",required:!0,name:"quality"}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:["waterMark ",(0,N.jsx)("span",{className:"text-gray-400",children:"(Optional)"})]}),(0,N.jsx)("input",{type:"text",value:(null==t?void 0:t.waterMark)||"",onChange:e=>l("waterMark",e.target.value),onBlur:e=>r("waterMark",e.target.value),placeholder:"Enter watermark identifier",className:"h-10 w-full rounded-lg border border-gray-300 px-3 py-2.5 text-sm text-gray-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"})]})]})}var sv=(0,Y.Pi)(()=>{var e,t;let{t:a}=(0,X.Z)("dashboard"),r=(0,le.useRouter)(),{userStore:l}=(0,_.o)(),[s,n]=(0,E.useState)({}),[i,o]=(0,E.useState)(null),[d,c]=(0,E.useState)({}),[u,p]=(0,E.useState)(!1),[m,g]=(0,E.useState)(!1),[h,x]=(0,E.useState)(!1),f=(0,E.useRef)(null),y=e=>{let t=setInterval(async()=>{try{let r=await (0,tC.Z)({headers:{Authorization:"Bearer ".concat(l.user.apiKey),"Content-Type":"application/json"},url:"".concat("https://api.kie.ai","/api/v1/runway/record-detail?taskId=").concat(e),method:"GET"});if(200===r.data.code){var a;let e=r.data.data,l=e.state||"generating",s={...e,state:l,videoUrl:(null===(a=e.videoInfo)||void 0===a?void 0:a.videoUrl)||null,videoInfo:e.videoInfo||null,errorMessage:e.failMsg||null,failCode:e.failCode||null,expireFlag:e.expireFlag||0};if(o(s),c(r.data),"wait"===l||"queueing"===l||"generating"===l)f.current&&(Date.now(),f.current);else if(p(!1),clearInterval(t),"success"===l)J.ZP.success("Video extension completed");else if("fail"===l){let t=e.failMsg||"Video extension failed";J.ZP.error(t)}}else clearInterval(t),p(!1),J.ZP.error(r.data.msg||"Failed to get video details")}catch(e){clearInterval(t),p(!1),J.ZP.error("Failed to get video details")}},1500)},v=async e=>{if(!l.user){g(!0);return}if(!l.user.apiKey){J.ZP.error(a("toast.apiKeyEmpty")),r.push("/api-key");return}if(!e.taskId){J.ZP.error("Please enter task ID");return}if(!e.prompt){J.ZP.error("Please enter prompt");return}if(!e.quality){J.ZP.error("Please select quality");return}if("720p"!==e.quality&&"1080p"!==e.quality){J.ZP.error("Quality must be 720p or 1080p");return}if(u)return;i&&o(null),p(!0),c({});let t={taskId:e.taskId,prompt:e.prompt,quality:e.quality};void 0!==e.waterMark&&null!==e.waterMark?t.waterMark=e.waterMark:t.waterMark="",t.callBackUrl="playground";try{var s;let e=await (0,tC.Z)({headers:{Authorization:"Bearer ".concat(null===(s=l.user)||void 0===s?void 0:s.apiKey),"Content-Type":"application/json"},url:"".concat("https://api.kie.ai","/api/v1/runway/extend"),method:"POST",data:t});if(200===e.data.code){let t=e.data.data,a="";if("string"==typeof t?a=t:t&&"object"==typeof t&&(a=t.taskId||t.taskid||""),a||(a=e.data.taskId||e.data.taskid||""),!a){J.ZP.error("No task ID returned"),p(!1);return}y(a),l.loadUserInfo(),f.current=Date.now()}else 402===e.data.code?x(!0):J.ZP.error(e.data.msg),p(!1)}catch(e){p(!1),J.ZP.error(a("toast.serverAbnormal"))}},b=(null==s?void 0:s.quality)==="720p"?"runway-extend-5s-720p":(null==s?void 0:s.quality)==="1080p"?"runway-extend-5s-1080p":null,w=b?(null===(t=l.user)||void 0===t?void 0:null===(e=t.consumeCreditsMap)||void 0===e?void 0:e[b])||((null==s?void 0:s.quality)==="720p"?12:30):12;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(tE,{InputPanelContent:(0,N.jsx)(sy,{formData:s,setFormData:n}),OutputPanelContent:(0,N.jsx)(sf,{recordDetails:i,generating:u}),run:()=>v(s),formData:s,outputData:d,generating:u,credit:w,layoutRatio:"40-60"}),(0,N.jsx)(tt.default,{isOpen:m,onClose:()=>g(!1)}),(0,N.jsx)(r8.Z,{isOpen:h,onClose:()=>x(!1)})]})}),sb=a(50654),sw=e=>{let{pageData:t}=e;return"runway/extend-ai-video"===t.model?(0,N.jsx)(sv,{pageData:t}):(0,N.jsx)(sb.x,{})};function sj(e){var t;let{pageData:a,playgroundData:r,examplesData:l,userPath:s,path:n,handlePageNavigation:i,fullPageData:o}=e,{record:d,generating:c,credit:u,creditLoading:p,handleGenerator:m,getCredit:g}=(0,eh.g)();return(0,N.jsx)(N.Fragment,{children:(0,N.jsx)("div",{id:"market-playground",children:(null==a?void 0:a.channel)==="custom_veo3"?(0,N.jsx)(lr,{pageData:a}):(null==a?void 0:a.channel)==="custom_runway"?(0,N.jsx)(sw,{pageData:a}):(null==a?void 0:a.channel)==="custom_suno"?(0,N.jsx)(r1,{pageData:a}):(null==a?void 0:a.channel)==="custom_4o_image"?(0,N.jsx)(ex.n,{}):(null==a?void 0:a.channel)==="custom_flux_kontext"?(0,N.jsx)(ef.n,{}):(null==a?void 0:a.channel)==="custom_midjourney"?(0,N.jsx)(sx,{pageData:a}):(null==a?void 0:a.channel)==="custom_runway_alpeh"?(0,N.jsx)(ey.n,{}):(null==a?void 0:a.channel)==="custom_luma_modify"?(0,N.jsx)(ev.u,{}):(null==a?void 0:a.channel)==="chat"?(0,N.jsx)(tw,{pageData:o,currentPageData:a,onModelChange:i}):(0,N.jsxs)(N.Fragment,{children:[r&&(0,N.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[(0,N.jsx)(ep.Z,{onGenerator:(e,t)=>
1m(e,t,a,s+(n?"/"+n:"")),onChangeOption:e=>g(e,a),creditLoading:p,generating:c,formContent:r.formContent,linkageRules:r.linkageRules||[],consumeCredit:u,model:s+(n?"/"+n:""),handlePageNavigation:i}),(0,N.jsx)(em.Z,{record:d,progressDuration:r.progressDuration,generating:c,mediaType:r.outputMediaType,resultData:r.outputMediaUrls,resultObjectText:r.resultObjectText||"",model:s+(n?"/"+n:"")})]}),r&&l&&(null==l?void 0:null===(t=l.examples)||void 0===t?void 0:t.length)>0&&(0,N.jsx)(eg.Z,{playgroundData:r,examplesData:l,model:null==a?void 0:a.model})]})})})}var sk=a(60151),sN=a(54644),sE=a.n(sN);let sC=e=>{let t=(null==e?void 0:e.groupName)?"".concat(e.groupName," "):"";return"".concat(sS(e)||"AI"," ").concat(t,"AI Model")},sI=e=>Array.isArray(null==e?void 0:e.taskType)?e.taskType.filter(Boolean):(null==e?void 0:e.taskType)?[e.taskType]:(null==e?void 0:e.groupName)?[e.groupName]:[],sS=e=>(null==e?void 0:e.title)||(null==e?void 0:e.groupName)||"",sA=e=>{let t=(null==e?void 0:e.path)?String(e.path).replace(/^\/|\/$/g,""):"";return t?"/".concat(t):""},sP=e=>{let t=String(e||"").trim().toLowerCase().replace(/&/g,"and").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t?"/market/".concat(t):"/market"},sD=e=>!!e&&/\.(mp4|webm|mov|m4v)(\?.*)?$/i.test(e),sT=e=>{var t,a,r,l,s;if((null==e?void 0:e.code)&&200!==e.code)return[];let n=(null==e?void 0:e.data)||e||{};return[{key:"same-task",taskTypeList:(null===(t=n.sameTaskType)||void 0===t?void 0:t.taskTypeList)||[],models:(null===(a=n.sameTaskType)||void 0===a?void 0:a.sameTaskTypeGroupList)||[]},{key:"same-brand",taskType:null===(r=n.sameProvider)||void 0===r?void 0:r.provider,models:(null===(l=n.sameProvider)||void 0===l?void 0:l.sameProviderGroupList)||[]},{key:"latest-popular",models:(null===(s=n.latestAndHot)||void 0===s?void 0:s.latestAndHotGroupList)||[]}].filter(e=>{let t=Array.isArray(e.models)?e.models.filter(Boolean):[],a=["same-task","same-brand"].includes(e.key);return t.length>0&&(!a||t.length>=3)}).map(e=>{let t=Array.isArray(e.models)?e.models.filter(Boolean).slice(0,4):[];return{...e,models:t}})},s_="text-blue-500 transition-colors hover:text-blue-600 dark:text-blue-500 dark:hover:text-blue-600",sR=e=>{if((null==e?void 0:e.key)==="same-task"){let t=Array.isArray(e.taskTypeList)?e.taskTypeList.filter(Boolean):[];return(0,N.jsxs)(N.Fragment,{children:["Explore more"," ",t.length>0?t.map((e,t)=>(0,N.jsxs)(E.Fragment,{children:[t>0&&"ã",(0,N.jsx)(sE(),{href:sP(e),target:"_blank",rel:"noopener noreferrer",className:s_,children:e})]},e)):"AI"," ","models"]})}if((null==e?void 0:e.key)==="same-brand"){let t=e.taskType||"Google";return(0,N.jsxs)(N.Fragment,{children:["More AI models from"," ",(0,N.jsx)(sE(),{href:sP(t),target:"_blank",rel:"noopener noreferrer",className:s_,children:t})]})}return(null==e?void 0:e.key)==="latest-popular"?"Latest and popular AI models":(null==e?void 0:e.title)||""},sF={backgroundImage:"linear-gradient(rgba(59,130,246,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(59,130,246,0.04) 1px, transparent 1px)",backgroundSize:"40px 40px"},sM=e=>{let{model:t}=e,a=sA(t),r=sS(t);return(sI(t),a&&r)?(0,N.jsxs)("article",{className:"kie-model-card group relative overflow-hidden rounded-xl border border-blue-500/20 transition-all duration-300 hover:border-blue-400/60 hover:shadow-[0_0_24px_rgba(59,130,246,0.22)]",children:[(0,N.jsx)("span",{className:"absolute right-2.5 top-2.5 z-20 h-2 w-2 rounded-full bg-blue-500 shadow-[0_0_10px_3px_rgba(59,130,246,0.7)]"}),(0,N.jsx)("div",{className:"kie-scan-sweep pointer-events-none absolute inset-0 z-10 opacity-0 transition-opacity duration-200 group-hover:opacity-100"}),(0,N.jsxs)("a",{href:a,"aria-label":"View ".concat(r),className:"block overflow-hidden",children:[t.coverLink&&sD(t.coverLink)&&(0,N.jsx)("video",{src:t.coverLink,muted:!0,loop:!0,playsInline:!0,preload:"metadata","aria-label":sC(t),onMouseEnter:e=>{e.currentTarget.play().catch(()=>{})},onMouseLeave:e=>{e.currentTarget.pause(),e.currentTarget.currentTime=0},className:"aspect-video w-full bg-[#0a0e1a] object-cover transition-transform duration-500 ease-out group-hover:scale-105"}),t.coverLink&&!sD(t.coverLink)&&(0,N.jsx)("img",{src:t.coverLink,alt:sC(t),loading:"lazy",className:"aspect-video w-full bg-[#0a0e1a] object-cover transition-transform duration-500 ease-out group-hover:scale-105"}),!t.coverLink&&(0,N.jsx)("div",{className:"aspect-video w-full bg-[#0a0e1a]"})]}),(0,N.jsxs)("div",{className:"p-3",children:[t.provider&&(0,N.jsxs)("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] uppercase tracking-widest text-blue-600/80",children:[(0,N.jsx)("span",{className:"h-1 w-1 rounded-full bg-blue-500","aria-hidden":"true"}),(0,N.jsx)("span",{children:t.provider})]}),(0,N.jsx)("div",{className:"font-semibold leading-snug",children:(0,N.jsx)("a",{href:a,className:"hover:text-blue-600",children:r})})]})]}):null},sO=e=>{let{section:t}
1=e,a=Array.isArray(null==t?void 0:t.models)?t.models.filter(Boolean):[],r=sR(t);return r&&0!==a.length?(0,N.jsxs)("section",{className:"space-y-5","aria-labelledby":"model-links-".concat(t.key),children:[(0,N.jsx)("div",{id:"model-links-".concat(t.key),className:"text-xl font-semibold tracking-wide",children:r}),(0,N.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(e=>(0,N.jsx)(sM,{model:e},e.id||e.href))})]}):null};function sL(e){let{data:t}=e,a=sT(t);return 0===a.length?null:(0,N.jsx)("aside",{id:"similar",className:"mx-auto mb-8 mt-10 rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",style:sF,children:(0,N.jsx)("div",{className:"space-y-10 p-6 lg:p-8",children:a.map(e=>(0,N.jsx)(sO,{section:e},e.key||e.title))})})}var sB=a(5270),sU=a.n(sB),sZ=a(7510),sz=a(6924);a(66461);var sq=a(35397);function sK(e){return"string"==typeof e&&e.startsWith("https://docs.kie.ai")}function sG(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"light";if(!e)return"";try{let a=new URL(e),r=a.search?"&":"?";return"".concat("/api/docs-proxy").concat(a.pathname).concat(a.search).concat(r,"theme=").concat("dark"===t?"dark":"light")}catch(e){return""}}function sW(){return"undefined"==typeof document?"light":document.documentElement.classList.contains("dark")?"dark":"light"}function sV(){let e="rounded-md bg-gray-200 dark:bg-gray-700";return(0,N.jsx)("div",{"data-testid":"doc-skeleton",className:"absolute inset-0 animate-pulse overflow-hidden bg-white p-8 dark:bg-gray-900",children:(0,N.jsxs)("div",{className:"flex gap-8",children:[(0,N.jsxs)("div",{className:"min-w-0 flex-1 space-y-5",children:[(0,N.jsx)("div",{className:"h-8 w-2/5 ".concat(e)}),(0,N.jsx)("div",{className:"h-10 w-1/3 rounded-lg bg-gray-200 dark:bg-gray-700"}),(0,N.jsxs)("div",{className:"space-y-3 pt-4",children:[(0,N.jsx)("div",{className:"h-4 w-full ".concat(e)}),(0,N.jsx)("div",{className:"h-4 w-11/12 ".concat(e)}),(0,N.jsx)("div",{className:"h-4 w-3/4 ".concat(e)})]}),(0,N.jsx)("div",{className:"h-28 w-full rounded-xl bg-gray-100 dark:bg-gray-800"}),(0,N.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,N.jsx)("div",{className:"h-4 w-5/6 ".concat(e)}),(0,N.jsx)("div",{className:"h-4 w-2/3 ".concat(e)})]})]}),(0,N.jsxs)("div",{className:"hidden w-[340px] shrink-0 space-y-4 lg:block",children:[(0,N.jsx)("div",{className:"h-48 w-full rounded-xl bg-gray-100 dark:bg-gray-800"}),(0,N.jsx)("div",{className:"h-40 w-full rounded-xl bg-gray-100 dark:bg-gray-800"})]})]})})}a(67968).Hs,a(49333),a(3580);var sH=(0,Y.Pi)(function(e){var t;let{apiDocumentUrl:a,active:r=!0}=e,{userStore:l}=(0,_.o)(),s=(null===(t=l.user)||void 0===t?void 0:t.apiKey)||"",[n]=(0,E.useState)(sW),i=(0,E.useMemo)(()=>sG(a,n),[a,n]),[o,d]=(0,E.useState)(r),[c,u]=(0,E.useState)([]),[p,m]=(0,E.useState)(()=>new Set),g=(0,E.useRef)(new Map),h=p.has(i),x=(0,E.useCallback)(e=>{e&&m(t=>t.has(e)?t:new Set(t).add(e))},[]);return((0,E.useEffect)(()=>{if(o)return;if(r){d(!0);return}let e=()=>{},t=setTimeout(()=>{if("function"==typeof window.requestIdleCallback){let t=window.requestIdleCallback(()=>d(!0));e=()=>{var e,a;return null===(e=(a=window).cancelIdleCallback)||void 0===e?void 0:e.call(a,t)}}else d(!0)},2e3);return()=>{clearTimeout(t),e()}},[r,o]),(0,E.useEffect)(()=>{o&&i&&u(e=>e[e.length-1]===i?e:e.filter(e=>e!==i).concat(i).slice(-3))},[o,i]),(0,E.useEffect)(()=>{m(e=>{let t=new Set(Array.from(e).filter(e=>c.includes(e)));return t.size===e.size?e:t})},[c]),(0,E.useEffect)(()=>{if(!o)return;let e=e=>{var t;if(e.origin!==window.location.origin||(null===(t=e.data)||void 0===t?void 0:t.type)!=="kie-doc-ready")return;let a=Array.from(g.current.entries()).find(t=>{let[,a]=t;return(null==a?void 0:a.contentWindow)===e.source});a&&x(a[0])};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[o,x]),(0,E.useEffect)(()=>{if(!o||!i||h)return;let e=setTimeout(()=>x(i),15e3);return()=>clearTimeout(e)},[o,i,h,x]),(0,E.useEffect)(()=>{var e,t;h&&(null===(t=g.current.get(i))||void 0===t||null===(e=t.contentWindow)||void 0===e||e.postMessage({type:"kie-set-token",token:s},window.location.origin))},[h,s,i]),(0,E.useEffect)(()=>
1{if("undefined"==typeof document)return;let e=document.documentElement,t=new MutationObserver(()=>{let t=e.classList.contains("dark")?"dark":"light";g.current.forEach(e=>{var a;null==e||null===(a=e.contentWindow)||void 0===a||a.postMessage({type:"kie-set-theme",theme:t},window.location.origin)})});return t.observe(e,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]),(0,E.useEffect)(()=>{var e,t;r&&!h&&(null===(t=g.current.get(i))||void 0===t||null===(e=t.contentWindow)||void 0===e||e.postMessage({type:"kie-recheck"},window.location.origin))},[r,h,i]),i)?(0,N.jsxs)("div",{className:"overflow-hidden rounded-xl bg-white dark:bg-gray-900 ".concat(r?"relative":"pointer-events-none absolute left-0 top-0 -z-10 w-full"),style:{height:"calc(100vh - 160px)",minHeight:640,visibility:r?"visible":"hidden"},children:[r&&!h&&(0,N.jsx)(sV,{}),c.map(e=>{let t=e===i;return(0,N.jsx)("iframe",{ref:t=>{t?g.current.set(e,t):g.current.delete(e)},src:e,title:"API Reference","data-current":t?"true":"false","aria-hidden":t?void 0:"true",className:"absolute inset-0 h-full w-full",style:{border:"none",visibility:t?"visible":"hidden",pointerEvents:t?"auto":"none",opacity:t&&!h?0:1,transition:"opacity 0.2s ease"}},e)})]}):null}),sJ=a(29445);let s$="https://kie.ai";function sY(e){return e?String(e).split("-").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function sX(e,t,a){return a?"".concat(s$,"/").concat(e,"?model=").concat(a,"#").concat(t):"".concat(s$,"/").concat(e,"/#").concat(t)}function sQ(e){let t=null==e?void 0:e.aggregateRating,a=null;if("string"==typeof t&&t.trim())try{a=JSON.parse(t)}catch(e){a=null}else t&&"object"==typeof t&&(a=t);return a&&a.ratingValue?{"@type":"AggregateRating",bestRating:"5",worstRating:"1",...a}:{"@type":"AggregateRating",ratingValue:"4.9",ratingCount:"3250",bestRating:"5",worstRating:"1"}}function s0(){return{"@type":"Organization","@id":"".concat(s$,"/#organization"),name:"KIE AI",url:s$,logo:"".concat(s$,"/logo.png")}}function s1(e){return{"@type":"BreadcrumbList","@id":"".concat(s$,"/").concat(e,"/#breadcrumb"),itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:s$},{"@type":"ListItem",position:2,name:"APIs market of Kie AI",item:"".concat(s$,"/market")},{"@type":"ListItem",position:3,name:"".concat(sY(e)," Suite")}]}}function s2(e,t){var a;let{path:r,groupData:l=[]}=e||{},s=sY(r),n=(null===(a=l[0])||void 0===a?void 0:a.model)||"";return{"@type":"HowTo","@id":sX(r,"howto",t),name:"How to use ".concat(s," API on KIE.ai"),description:"A universal guide to call any model within the ".concat(s," suite."),step:[{"@type":"HowToStep",name:"Get your API Key",text:"Log in to your KIE AI dashboard and copy your Bearer Token."},{"@type":"HowToStep",name:"Send Request",text:"Set the model parameter to your desired endpoint (e.g., ".concat(n,") and send a POST request.")},{"@type":"HowToStep",name:"Receive Result",text:"Listen to your callBackUrl or poll the Task ID."}]}}function s5(e,t){let{path:a,groupData:r=[]}=e||{},l=sY(a),s=(t?r.find(e=>e.model===t):r[0])||{},n=JSON.stringify({model:s.model||t||"",input:function(e){let t=(null==e?void 0:e.formContent)||[];if(!Array.isArray(t)||0===t.length)return{};try{return(0,sJ.HU)((0,sJ.Fx)(t),t)}catch(e){return{}}}(s.playgroundData)}),i=t?"cURL Request Example for ".concat(sY(s.path||s.userPath||"")):"General Request Example for ".concat(l," Suite");return{"@type":"SoftwareSourceCode","@id":sX(a,"sourcecode",t),name:i,programmingLanguage:"cURL",codeSampleType:"Snippet",text:"curl -X POST https://api.kie.ai/api/v1/jobs/createTask -H 'Content-Type: application/json' -H 'Authorization: Bearer YOUR_API_KEY' "+"-d '".concat(n,"'")}}let s4="Hello!";function s3(e){return(null==e?void 0:e.channel)==="chat"}function s6(e,t){let{path:a,groupData:r=[]}=e||{},l=sY(a),s=(t?r.find(e=>e.model===t):r[0])||{},{endpoint:n,body:i}=function(e,t){let a=(null==t?void 0:t.format)||"openai",r=e$(t);if("response"===a)return{endpoint:(null==t?void 0:t.endpoint)||"/api/v1/responses",body:{model:e,stream:r,input:[{role:"user",content:[{type:"input_text",text:s4}]}]}};if("gemini"===a)return{endpoint:"/gemini/v1/models/".concat(e,":streamGenerateContent"),body:{stream:r,contents:[{role:"user",parts:[{text:s4}]}]}};if("claude"===a){var l,s;return{endpoint:"/claude/v1/messages",body:{model:e,messages:[{role:"user",content:[{type:"text",text:s4}]}],max_tokens:null!==(s=null==t?void 0:null===(l=t.maxTokens)||void 0===l?void 0:l.default)&&void 0!==s?s:4096,stream:r,system:"You are a helpful AI assistant."}}}return{endpoint:"/".concat(e,"/v1/chat/completions"),body:{stream:r,messages:[{role:"user",content:[{type:"text",text:s4}]}]}}}(s.path||s.model||t||"",s.chatModelConfig),o="curl -X POST ".concat("https://api.kie.ai").concat(n," ")+"-H 'Content-Type: application/json' -H 'Authorization: Bearer YOUR_API_KEY' "+"-d '".concat(JSON.stringify(i),"'"),d=t?"cURL Request Example for ".concat(sY(s.path||s.userPath||"")):"General Request Example for ".concat(l," Suite");return{"@type":"SoftwareSourceCode","@id":sX(a,"sourcecode",t),name:d,programmingLanguage:"cURL",codeSampleType:"Snippet",text:o}}let s7=["items","faqs","subSections","questions"];function s9(e){return"string"!=typeof e?"":e.replace(/<[^>]*>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/\s+/g," ").trim()}function s8(e){var t,a,r,l;let s=(null==e?void 0:e.props)?e.props:e||{},n=null!==(a=null!==(t=s.question)&&void 0!==t?t:s.title)&&void 0!==a?a:"",i=null!==(l=null!==(r=s.answer)&&void 0!==r?r:s.content)&&void 0!==l?l:"";return{question:s9(n),answer:s9(i)}}function ne(e){let t=null==e?void 0:e.content;if(!Array.isArray(t))return[];let a=[];
1return t.forEach(e=>{if(!e||"string"!=typeof e.type||!/faq/i.test(e.type))return;let t=e.props||{},r=s7.find(e=>Array.isArray(t[e]));if(r){t[r].forEach(e=>{let{question:t,answer:r}=s8(e);t&&r&&a.push({question:t,answer:r})});return}let{question:l,answer:s}=s8(e);l&&s&&a.push({question:l,answer:s})}),a}function nt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,r=(Array.isArray(t)?t:[]).filter(e=>e&&e.question&&e.answer);return 0===r.length?null:{"@type":"FAQPage","@id":sX(e,"faq",a),mainEntity:r.map(e=>({"@type":"Question",name:e.question,acceptedAnswer:{"@type":"Answer",text:e.answer}}))}}var na=a(49977);let nr=new Set(["custom_veo3","custom_runway","custom_suno","custom_4o_image","custom_flux_kontext","custom_midjourney","custom_runway_alpeh","custom_luma_modify"]),nl=e=>{if(!e)return!1;if(nr.has(e.channel))return!0;let t=e.model||"";return t.endsWith("gemini-omni-character")||t.endsWith("gemini-omni-audio")||"bytedance/seedance-2-asset"===t};var ns=(0,na.Pi)(function(e){var t,a,r,l,s,n,i,o,d,c,u;let{pageData:p,carouselSecondaryPageList:m,listCarouselCommon:g,navigationData:h}=e,x=(0,le.useRouter)(),f=sq.locales.filter(e=>(p.supportLanguages||[]).includes(e)),[y,v]=(0,E.useState)(""),[b,w]=(0,E.useState)(!1),[j,k]=(0,E.useState)(!1),[I,S]=(0,E.useState)(!1),[A,P]=(0,E.useState)(!1),[D,T]=(0,E.useState)(!1),[_,R]=(0,E.useState)(null);(0,E.useEffect)(()=>{var e;if((null==p?void 0:null===(e=p.groupData)||void 0===e?void 0:e.length)>0){let{model:e}=x.query;e&&p.groupData.find(t=>t.model===e)?(v(e),w(!0)):(v(p.groupData[0].model),w(!1))}},[p,x.query]),(0,E.useEffect)(()=>{var e;if((null==p?void 0:null===(e=p.groupData)||void 0===e?void 0:e.length)>0){let e=p.groupData.find(e=>e.model===y);k(!!(null==e?void 0:e.playgroundData)||["custom_veo3","custom_runway","custom_suno","custom_4o_image","custom_flux_kontext","custom_midjourney","custom_runway_alpeh","custom_luma_modify","chat"].includes(null==e?void 0:e.channel)),S(!!(null==e?void 0:e.examplesData)),T((null==e?void 0:e.channel)==="fal_request"||(null==e?void 0:e.channel)==="replicate_request"),R(e)}else k(!1),S(!1),T(!1),R(null);P(!!(null==p?void 0:p.readmeData))},[y,p]);let F=["playground","api"],[M,O]=(0,E.useState)(F[0]||"playground"),L=(0,E.useMemo)(()=>sK(null==_?void 0:_.apiDocumentUrl),[_]),B=(0,E.useMemo)(()=>((null==p?void 0:p.groupData)||[]).map(e=>null==e?void 0:e.apiDocumentUrl).filter(sK),[p]),[U]=(0,E.useState)(sW);!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{enabled:a=!0,theme:r="light"}=t,l=Array.isArray(e)?e.filter(Boolean).join("|"):"";(0,E.useEffect)(()=>{let e;if(!a||!l||"function"!=typeof window.fetch)return;let t=l.split("|").map(e=>sG(e,r)).filter(Boolean).slice(0,8);if(0===t.length)return;let s=new AbortController,n=!1,i=a=>{n||a>=t.length||window.fetch(t[a],{signal:s.signal,priority:"low"}).then(e=>e.arrayBuffer()).catch(()=>{}).then(()=>{n||(e=setTimeout(()=>i(a+1),600))})};return e=setTimeout(()=>i(0),5e3),()=>{n=!0,clearTimeout(e),s.abort()}},[l,a,r])}(B,{theme:U});let Z=e=>{if("api"===e&&!L){window.open("https://docs.kie.ai","_blank");return}O(e)};(0,E.useMemo)(()=>{eV(((null==p?void 0:p.groupData)||[]).map(e=>null==e?void 0:e.chatModelConfig).filter(Boolean))},[p]);let z=(0,E.useMemo)(()=>{var e,t;if(!y)return!1;let a=null==p?void 0:null===(e=p.groupData)||void 0===e?void 0:e.find(e=>e.model===y);return(null==a?void 0:null===(t=a.chatModelConfig)||void 0===t?void 0:t.format)==="claude"},[y,p]),q=null==p?void 0:p.internalLinksInfo,K=(0,E.useMemo)(()=>sT(q).length>0,[q]),G=!nl(b?_:null==p?void 0:null===(t=p.groupData)||void 0===t?void 0:t[0]),W=1===Number(null==p?void 0:p.showPartialFlag);return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(sU(),{children:[(0,N.jsx)("title",{children:null==p?void 0:null===(l=p.readmeData)||void 0===l?void 0:null===(r=l.root)||void 0===r?void 0:null===(a=r.props)||void 0===a?void 0:a.title}),(0,N.jsx)("meta",{name:"description",content:null==p?void 0:null===(i=p.readmeData)||void 0===i?void 0:null===(n=i.root)||void 0===n?void 0:null===(s=n.props)||void 0===s?void 0:s.description}),z&&(0,N.jsx)("meta",{name:"googlebot",content:"noindex, nofollow"}),(0,sz.TT)(x.locale,"/".concat((null==p?void 0:p.path)?null==p?void 0:p.path:""),f),(0,sz.Hb)(x,"/".concat((null==p?void 0:p.path)?null==p?void 0:p.path:""),f),B.length>
10&&(0,N.jsx)("link",{rel:"preconnect",href:"https://file-assets.apidog.com",crossOrigin:"anonymous"}),G&&(0,N.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(b?function(e,t){let{path:a,readmeData:r,groupData:l=[]}=e||{},s=ne(r),n=s3(l.find(e=>e.model===t))?s6(e,t):s5(e,t);return{"@context":"https://schema.org","@graph":[s0(),s1(a),function(e,t){let{path:a,groupData:r=[]}=e||{},l=r.find(e=>e.model===t)||{},s=sY(l.path||l.userPath||""),n="".concat(s$,"/").concat(a,"?model=").concat(t),i="".concat(s$,"/").concat(a);return{"@type":["SoftwareApplication","WebAPI"],"@id":"".concat(n,"#api"),name:"".concat(s," API"),identifier:t,applicationCategory:"DeveloperApplication",operatingSystem:"Cloud-based",provider:{"@id":"".concat(s$,"/#organization")},url:n,description:l.seoDescription||"",isPartOf:{"@type":"WebAPI","@id":"".concat(i,"/#api"),name:"".concat(sY(a)," Suite"),url:i},aggregateRating:sQ(e),offers:{"@type":"Offer","@id":"".concat(n,"#offer"),priceCurrency:"USD",price:"0.00",url:"".concat(s$,"/pricing"),name:"Pay-as-you-go (Credit-based)",description:l.pricingDesc||""}}}(e,t),s2(e,t),n,nt(a,s,t)].filter(Boolean)}}(p,y):function(e){let{path:t,readmeData:a,groupData:r=[]}=e||{},l=ne(a),s=s3(r[0])?s6(e):s5(e);return{"@context":"https://schema.org","@graph":[s0(),s1(t),function(e){var t;let{path:a,groupData:r=[]}=e||{},l="".concat(s$,"/").concat(a),s=(null===(t=r[0])||void 0===t?void 0:t.model)||"",n=r.map(e=>{let t=e.model||e.userPath+(e.path?"/"+e.path:"");return{"@type":"WebAPI","@id":"".concat(l,"?model=").concat(t,"#api"),name:sY(e.path||e.userPath)+" API",identifier:t}});return{"@type":["SoftwareApplication","WebAPI"],"@id":"".concat(l,"/#api"),name:"".concat(sY(a)," API Suite"),identifier:s,applicationCategory:"DeveloperApplication",operatingSystem:"Cloud-based",provider:{"@id":"".concat(s$,"/#organization")},url:l,description:(null==e?void 0:e.seoDescription)||"",isSimilarTo:function(e){var t,a;let r=null==e?void 0:null===(a=e.internalLinksInfo)||void 0===a?void 0:null===(t=a.sameTaskType)||void 0===t?void 0:t.sameTaskTypeGroupList;return Array.isArray(r)?r.map(e=>null==e?void 0:e.path).filter(Boolean).slice(0,5).map(e=>({"@id":"".concat(s$,"/").concat(e,"/#api")})):[]}(e),hasPart:n,aggregateRating:sQ(e),offers:{"@type":"Offer","@id":"".concat(l,"/#offer"),priceCurrency:"USD",price:"0.00",url:"".concat(s$,"/pricing"),name:"Pay-as-you-go (Credit-based)",description:"Pricing varies by sub-model. High-tier top-ups (+10% bonus). (1 USD = 200 Credits)"}}}(e),s2(e),s,nt(t,l)].filter(Boolean)}}(p))}})]}),(0,N.jsxs)("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[(0,N.jsx)(C.Z,{supportedLanguages:f,navigationData:h}),!W&&(0,N.jsx)(ee,{onTabChange:Z,path:null==_?void 0:_.path,userPath:null==_?void 0:_.userPath,readmeData:null==p?void 0:p.readmeData,consumeCredit:null==_?void 0:_.consumeCredit,hasPlaygroundData:j,isFalOrReplicate:D,sameGroupPlaygroundPageData:(null==p?void 0:p.groupData)||[],setCurrentPageData:R,currentPageData:_,pricingDesc:null==_?void 0:_.pricingDesc,pricingDescCn:null==_?void 0:_.pricingDescCn,handlePageNavigation:(e,t)=>{v(e+(t?"/"+t:"")),w(!0)}}),!W&&F.length>1&&(0,N.jsx)(eu,{currentPageData:_,activeTab:M,onTabChange:Z,availableTabs:F,hasExamplesData:I,hasReadmeData:A,hasModelInternalLinks:K,isFalOrReplicate:D,hasPlaygroundData:j,model:y,isCustomModel:["elevenlabs/text-to-dialogue-v3"].includes(y)}),(0,N.jsxs)("main",{className:"mx-auto max-w-7xl px-6 py-8 lg:px-8",style:W?{paddingTop:"calc(var(--app-header-height, 5rem) + 2rem)"}:void 0,children:[!W&&(0,N.jsx)("div",{className:"playground"===M?"block":"hidden",children:null==p?void 0:null===(o=p.groupData)||void 0===o?void 0:o.map(e=>(0,N.jsx)("div",{className:e.model===y?"block":"hidden",children:(0,N.jsx)(sj,{pageData:e,playgroundData:e.playgroundData,examplesData:e.examplesData,path:e.path,userPath:e.userPath,handlePageNavigation:e=>{v(e)},fullPageData:p})},e.model))}),!W&&"playground"===M&&K&&(0,N.jsx)(sL,{data:q}),(W||"playground"===M)&&(null==p?void 0:p.readmeData)&&(null==p?void 0:null===(u=p.readmeData)||void 0===u?void 0:null===(c=u.root)||void 0===c?void 0:null===(d=c.props)||void 0===d?void 0:d.readmeVisible)!==!1&&(0,N.jsx)(sk.Z,{aggregateRating:null==p?void 0:p.aggregateRating,contentData:null==p?void 0:p.readmeData,path:null==_?void 0:_.path,userPath:null==_?void 0:_.userPath}),!W&&L&&(0,N.jsx)(sH,{apiDocumentUrl:null==_?void 0:_.apiDocumentUrl,active:"api"===M})]}),(0,N.jsx)(sZ.Z,{carouselSecondaryPageList:m,listCarouselCommon:g,navigationData:h})]})]})})},99856:function(e,t,a){"use strict";a.r(t),a.d(t,{__N_SSP:function(){return b},default:function(){return w},runtime:function(){return j}});var r=a(39696);a(90170);var l=a(5270),s=a.n(l),n=a(68237),i=a(66461),o=a(6924),d=a(25307),c=a(17941),u=a(7510),p=e=>{var t,a;let{pageInfo:l,carouselSecondaryPageList:p,listCarouselCommon:m,navigationData:g}=e,h=(0,n.useRouter)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s(),{children:[(0,r.jsx)("title",{children:null===(t=l.pageData)||void 0===t?void 0:t.seoTitle}),(0,r.jsx)("meta",{name:"description",content:null===(a=l.pageData)||void 0===a?void 0:a.seoDescription}),(0,o.t5)(h,"/".concat(l.path),!0),(0,o.Hb)(h,"/".concat(l.path))]}),(0,r.jsx)(c.Z,{navigationData:g}),(0,r.jsxs)("div",{className:"relative min-h-screen overflow-hidden",children:[(0,r.jsx)("main",{className:"relative pb-10 pt-24 lg:pt-32",children:(0,r.jsx)(d.W,{children:(0,r.jsx)(i.ZP,{pageConfig:l.page
1Config,pageData:l.pageData})})}),(0,r.jsx)(u.Z,{carouselSecondaryPageList:p,listCarouselCommon:m,navigationData:g})]})]})};a(49333);var m=e=>{let{pageType:t,pageData:a,carouselSecondaryPageList:l,navigationData:s,listCarouselCommon:n}=e;return"newSecondary"===t?(0,r.jsx)(p,{pageInfo:a,carouselSecondaryPageList:l,navigationData:s,listCarouselCommon:n}):null},g=a(47451),h=a(35397),x=a(82937),f=a(51615);a(3580);var y=function(e){var t,a;let{pageInfo:l,carouselSecondaryPageList:d,navigationData:p,listCarouselCommon:m}=e,g=(0,n.useRouter)(),y=h.locales.filter(e=>(l.successLanguages||[]).includes(e));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s(),{children:[(0,r.jsx)("title",{children:null===(t=l.pageData)||void 0===t?void 0:t.seoTitle}),(0,r.jsx)("meta",{name:"description",content:null===(a=l.pageData)||void 0===a?void 0:a.seoDescription}),(0,o.TT)(g.locale,"/".concat(l.path),y),(0,o.Hb)(g,"/".concat(l.path),y)]}),(0,r.jsxs)("div",{className:"grid min-h-screen grid-rows-[auto_1fr_auto]",children:[(0,r.jsx)(c.Z,{supportedLanguages:y,navigationData:p}),(0,r.jsxs)("div",{className:"w-full",children:[(0,r.jsx)("div",{"aria-hidden":"true",className:"fixed inset-x-0 top-3 z-[-1] h-full w-full transform-gpu overflow-hidden blur-3xl md:h-auto md:w-auto md:px-10",children:(0,r.jsx)("div",{className:"mx-auto aspect-[1920/720] w-full bg-gradient-to-tr from-blue-300 to-sky-300 opacity-100",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%);"}})}),(0,r.jsx)("main",{children:(0,r.jsx)(i.co,{language:g.locale,pageInfo:l,createTurnstile:e=>{let{verifyLoading:t,onSuccess:a}=e;return(0,r.jsx)(f.g,{verifyChatLoading:t,success:a})},createChatContentMarkdown:e=>(0,r.jsx)(x.Z,{children:e})})}),(0,r.jsx)(u.Z,{carouselSecondaryPageList:d,listCarouselCommon:m,navigationData:p})]})]})]})},v=a(32915),b=!0,w=function(e){let{pageType:t,isMultiLevel:a}=e;return a?(0,r.jsx)(g.Z,{...e}):"features"===t?(0,r.jsx)(y,{...e}):t===v.M9?(0,r.jsx)(v.ZP,{...e}):(0,r.jsx)(m,{...e})};let j="experimental-edge"},67045:function(e,t,a){"use strict";a.d(t,{n:function(){return r}});let r=e=>e?/^([a-z]+:)?\/\//i.test(e)||/^(mailto:|tel:|#)/i.test(e)?e:"/".concat(String(e).replace(/^\/+/,"")):"/"},68702:function(e,t,a){"use strict";function r(e){"undefined"!=typeof document&&e&&(document.cookie="".concat("NEXT_LOCALE","=").concat(encodeURIComponent(e),"; path=/; max-age=").concat(31536e3,"; samesite=lax"))}a.d(t,{A:function(){return r}})},24863:function(){},82963:function(){},87809:function(e,t,a){"use strict";a.d(t,{A:function(){return E}});var[r,l]=(0,a(27261).k)({name:"ButtonGroupContext",strict:!1}),s=a(30010),n=a(45896),i=a(90170),o=a(98055),d=a(43256),c=a(33800),u=a(22823),p=a(80061),m=a(13241),g=a(96079),h=a(69751),x=a(81472),f=a(39696),y=(0,g.Gp)((e,t)=>{let{slots:a,classNames:r,label:l,variant:o,getSpinnerProps:d}=function(e){var t,a;let[r,l]=(0,g.oe)(e,h.l.variantKeys),o=(0,s.w)(),d=null!=(a=null!=(t=null==e?void 0:e.variant)?t:null==o?void 0:o.spinnerVariant)?a:"default",{children:c,className:u,classNames:p,label:m,...f}=r,y=(0,i.useMemo)(()=>(0,h.l)({...l,variant:d}),[(0,n.Xx)(l),d]),v=(0,x.cn)(null==p?void 0:p.base,u),b=m||c,w=(0,i.useMemo)(()=>b&&"string"==typeof b?b:f["aria-label"]?"":"Loading",[c,b,f["aria-label"]]),j=(0,i.useCallback)(()=>({"aria-label":w,className:y.base({class:v}),...f}),[w,y,v,f]);return{label:b,slots:y,classNames:p,variant:d,getSpinnerProps:j}}({...e});return"wave"===o||"dots"===o?(0,f.jsxs)("div",{ref:t,...d(),children:[(0,f.jsx)("div",{className:a.wrapper({class:null==r?void 0:r.wrapper}),children:[void 0,void 0,void 0].map((e,t)=>(0,f.jsx)("i",{className:a.dots({class:null==r?void 0:r.dots}),style:{"--dot-index":t}},`dot-${t}`))}),l&&(0,f.jsx)("span",{className:a.label({class:null==r?void 0:r.label}),children:l})]}):"simple"===o?(0,f.jsxs)("div",{ref:t,...d(),children:[(0,f.jsxs)("svg",{className:a.wrapper({class:null==r?void 0:r.wrapper}),fill:"none",viewBox:"0 0 24 24",children:[(0,f.jsx)("circle",{className:a.circle1({class:null==r?void 0:r.circle1}),cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,f.jsx)("path",{className:a.circle2({class:null==r?void 0:r.circle2}),d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",fill:"
1currentColor"})]}),l&&(0,f.jsx)("span",{className:a.label({class:null==r?void 0:r.label}),children:l})]}):"spinner"===o?(0,f.jsxs)("div",{ref:t,...d(),children:[(0,f.jsx)("div",{className:a.wrapper({class:null==r?void 0:r.wrapper}),children:[...Array(12)].map((e,t)=>(0,f.jsx)("i",{className:a.spinnerBars({class:null==r?void 0:r.spinnerBars}),style:{"--bar-index":t}},`star-${t}`))}),l&&(0,f.jsx)("span",{className:a.label({class:null==r?void 0:r.label}),children:l})]}):(0,f.jsxs)("div",{ref:t,...d(),children:[(0,f.jsxs)("div",{className:a.wrapper({class:null==r?void 0:r.wrapper}),children:[(0,f.jsx)("i",{className:a.circle1({class:null==r?void 0:r.circle1})}),(0,f.jsx)("i",{className:a.circle2({class:null==r?void 0:r.circle2})})]}),l&&(0,f.jsx)("span",{className:a.label({class:null==r?void 0:r.label}),children:l})]})});y.displayName="HeroUI.Spinner";var v=a(70662),b=a(66673),w=a(62185),j=()=>a.e(409).then(a.bind(a,80409)).then(e=>e.default),k=e=>{let{ripples:t=[],motionProps:a,color:r="currentColor",style:l,onClear:s}=e;return(0,f.jsx)(f.Fragment,{children:t.map(e=>{let t=(0,n.uZ)(.01*e.size,.2,e.size>100?.75:.5);return(0,f.jsx)(v.X,{features:j,children:(0,f.jsx)(b.M,{mode:"popLayout",children:(0,f.jsx)(w.m.span,{animate:{transform:`translate(${e.x}px, ${e.y}px) scale(2)`,opacity:0},className:"heroui-ripple",exit:{opacity:0},initial:{transform:`translate(${e.x}px, ${e.y}px) scale(0)`,opacity:.35},style:{position:"absolute",backgroundColor:r,borderRadius:"100%",transformOrigin:"center",pointerEvents:"none",overflow:"hidden",inset:0,zIndex:0,width:`${e.size}px`,height:`${e.size}px`,...l},transition:{duration:t},onAnimationComplete:()=>{s(e.key)},...a})})},e.key)})})};k.displayName="HeroUI.Ripple";var N=(0,g.Gp)((e,t)=>{let{Component:a,domRef:r,children:g,spinnerSize:h,spinner:x=(0,f.jsx)(y,{color:"current",size:h}),spinnerPlacement:v,startContent:b,endContent:w,isLoading:j,disableRipple:N,getButtonProps:E,getRippleProps:C,isIconOnly:I}=function(e){var t,a,r,g,h,x,f,y,v;let b=l(),w=(0,s.w)(),j=!!b,{ref:k,as:N,children:E,startContent:C,endContent:I,autoFocus:S,className:A,spinner:P,isLoading:D=!1,disableRipple:T,fullWidth:_=null!=(t=null==b?void 0:b.fullWidth)&&t,radius:R=null==b?void 0:b.radius,size:F=null!=(a=null==b?void 0:b.size)?a:"md",color:M=null!=(r=null==b?void 0:b.color)?r:"default",variant:O=null!=(g=null==b?void 0:b.variant)?g:"solid",disableAnimation:L=null!=(x=null!=(h=null==b?void 0:b.disableAnimation)?h:null==w?void 0:w.disableAnimation)&&x,isDisabled:B=null!=(f=null==b?void 0:b.isDisabled)&&f,isIconOnly:U=null!=(y=null==b?void 0:b.isIconOnly)&&y,spinnerPlacement:Z="start",onPress:z,onClick:q,...K}=e,G=N||"button",W="string"==typeof G,V=(0,d.gy)(k),H=null!=(v=null!=T?T:null==w?void 0:w.disableRipple)?v:L,{isFocusVisible:J,isFocused:$,focusProps:Y}=(0,o.F)({autoFocus:S}),X=B||D,Q=(0,i.useMemo)(()=>(0,u.L)({size:F,color:M,variant:O,radius:R,fullWidth:_,isDisabled:X,isInGroup:j,disableAnimation:L,isIconOnly:U,className:A}),[F,M,O,R,_,X,j,U,L,A]),{onPress:ee,onClear:et,ripples:ea}=function(e={}){let[t,a]=(0,i.useState)([]),r=(0,i.useCallback)(e=>{let t=e.target,r=Math.max(t.clientWidth,t.clientHeight);a(t=>[...t,{key:(0,n.QI)(t.length.toString()),size:r,x:e.x-r/2,y:e.y-r/2}])},[]);return{ripples:t,onClear:(0,i.useCallback)(e=>{a(t=>t.filter(t=>t.key!==e))},[]),onPress:r,...e}}(),er=(0,i.useCallback)(e=>{H||X||L||!V.current||ee(e)},[H,X,L,V,ee]),{buttonProps:el,isPressed:es}=(0,p.j)({elementType:N,isDisabled:X,onPress:(0,n.tS)(z,er),onClick:q,...K},V),{isHovered:en,hoverProps:ei}=(0,m.X)({isDisabled:X}),eo=(0,i.useCallback)((e={})=>({"data-disabled":(0,n.PB)(X),"data-focus":(0,n.PB)($),"data-pressed":(0,n.PB)(es),"data-focus-visible":(0,n.PB)(J),"data-hover":(0,n.PB)(en),"data-loading":(0,n.PB)(D),...(0,n.dG)(el,Y,ei,(0,c.z)(K,{enabled:W}),(0,c.z)(e)),className:Q}),[D,X,$,es,W,J,en,el,Y,ei,K,Q]),ed=e=>(0,i.isValidElement)(e)?(0,i.cloneElement)(e,{"aria-hidden":!0,focusable:!1}):null,ec=ed(C);return{Component:G,children:E,domRef:V,spinner:P,styles:Q,startContent:ec,endContent:ed(I),isLoading:D,spinnerPlacement:Z,spinnerSize:(0,i.useMemo)(()=>({sm:"sm",md:"sm",lg:"md"}
1)[F],[F]),disableRipple:H,getButtonProps:eo,getRippleProps:(0,i.useCallback)(()=>({ripples:ea,onClear:et}),[ea,et]),isIconOnly:U}}({...e,ref:t});return(0,f.jsxs)(a,{ref:r,...E(),children:[b,j&&"start"===v&&x,j&&I?null:g,j&&"end"===v&&x,w,!N&&(0,f.jsx)(k,{...C()})]})});N.displayName="HeroUI.Button";var E=N},52471:function(e,t,a){"use strict";a.d(t,{S:function(){return m}});var r=a(37143),l=a(39478),s=a(90170),n=(e,t)=>{var a;let r=[];return[null==(a=s.Children.map(e,e=>(0,s.isValidElement)(e)&&e.type===t?(r.push(e),null):e))?void 0:a.filter(Boolean),r.length>=0?r:void 0]},i=a(80061),o=a(87809),d=a(45896),c=a(39696),u=e=>{var t;let{triggerRef:a,getTriggerProps:r}=(0,l.l)(),{children:u,...p}=e,m=(0,s.useMemo)(()=>"string"==typeof u?(0,c.jsx)("p",{children:u}):s.Children.only(u),[u]),g=null!=(t=m.props.ref)?t:m.ref,{onPress:h,isDisabled:x,...f}=(0,s.useMemo)(()=>r((0,d.dG)(p,m.props),g),[r,m.props,p,g]),[,y]=n(u,o.A),{buttonProps:v}=(0,i.j)({onPress:h,isDisabled:x},a),b=(0,s.useMemo)(()=>(null==y?void 0:y[0])!==void 0,[y]);return b||delete f.preventFocusOnPress,(0,s.cloneElement)(m,(0,d.dG)(f,b?{onPress:h,isDisabled:x}:v))};u.displayName="HeroUI.PopoverTrigger";var p=e=>{let{getMenuTriggerProps:t}=(0,r.t)(),{children:a,...l}=e;return(0,c.jsx)(u,{...t(l),children:a})};p.displayName="HeroUI.DropdownTrigger";var m=p},37143:function(e,t,a){"use strict";a.d(t,{K:function(){return r},t:function(){return l}});var[r,l]=(0,a(27261).k)({name:"DropdownContext",errorMessage:"useDropdownContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Dropdown />`"})},10439:function(e,t,a){"use strict";a.d(t,{F:function(){return L}});var r=a(37143),l=a(30010),s=a(95625),n=a(90170),i={};i={"ar-AE":{longPressMessage:`\u{627}\u{636}\u{63A}\u{637} \u{645}\u{637}\u{648}\u{644}\u{627}\u{64B} \u{623}\u{648} \u{627}\u{636}\u{63A}\u{637} \u{639}\u{644}\u{649} Alt + \u{627}\u{644}\u{633}\u{647}\u{645} \u{644}\u{623}\u{633}\u{641}\u{644} \u{644}\u{641}\u{62A}\u{62D} \u{627}\u{644}\u{642}\u{627}\u{626}\u{645}\u{629}`},"bg-BG":{longPressMessage:`\u{41D}\u{430}\u{442}\u{438}\u{441}\u{43D}\u{435}\u{442}\u{435} \u{43F}\u{440}\u{43E}\u{434}\u{44A}\u{43B}\u{436}\u{438}\u{442}\u{435}\u{43B}\u{43D}\u{43E} \u{438}\u{43B}\u{438} \u{43D}\u{430}\u{442}\u{438}\u{441}\u{43D}\u{435}\u{442}\u{435} Alt+ \u{441}\u{442}\u{440}\u{435}\u{43B}\u{43A}\u{430} \u{43D}\u{430}\u{434}\u{43E}\u{43B}\u{443}, \u{437}\u{430} \u{434}\u{430} \u{43E}\u{442}\u{432}\u{43E}\u{440}\u{438}\u{442}\u{435} \u{43C}\u{435}\u{43D}\u{44E}\u{442}\u{43E}`},"cs-CZ":{longPressMessage:`Dlouh\xfdm stiskem nebo stisknut\xedm kl\xe1ves Alt + \u{161}ipka dol\u{16F} otev\u{159}ete nab\xeddku`},"da-DK":{longPressMessage:`Langt tryk eller tryk p\xe5 Alt + pil ned for at \xe5bne menuen`},"de-DE":{longPressMessage:`Dr\xfccken Sie lange oder dr\xfccken Sie Alt + Nach-unten, um das Men\xfc zu \xf6ffnen`},"el-GR":{longPressMessage:`\u{3A0}\u{3B9}\u{3AD}\u{3C3}\u{3C4}\u{3B5} \u{3C0}\u{3B1}\u{3C1}\u{3B1}\u{3C4}\u{3B5}\u{3C4}\u{3B1}\u{3BC}\u{3AD}\u{3BD}\u{3B1} \u{3AE} \u{3C0}\u{3B1}\u{3C4}\u{3AE}\u{3C3}\u{3C4}\u{3B5} Alt + \u{3BA}\u{3AC}\u{3C4}\u{3C9} \u{3B2}\u{3AD}\u{3BB}\u{3BF}\u{3C2} \u{3B3}\u{3B9}\u{3B1} \u{3BD}\u{3B1} \u{3B1}\u{3BD}\u{3BF}\u{3AF}\u{3BE}\u{3B5}\u{3C4}\u{3B5} \u{3C4}\u{3BF} \u{3BC}\u{3B5}\u{3BD}\u{3BF}\u{3CD}`},"en-US":{longPressMessage:"Long press or press Alt + ArrowDown to open menu"},"es-ES":{longPressMessage:`Mantenga pulsado o pulse Alt + flecha abajo para abrir el men\xfa`},"et-EE":{longPressMessage:`Men\xfc\xfc avamiseks vajutage pikalt v\xf5i vajutage klahve Alt + allanool`},"fi-FI":{longPressMessage:`Avaa valikko painamalla pohjassa tai n\xe4pp\xe4inyhdistelm\xe4ll\xe4 Alt + Alanuoli`},"fr-FR":{longPressMessage:`Appuyez de mani\xe8re prolong\xe9e ou appuyez sur Alt\xa0+\xa0Fl\xe8che vers le bas pour ouvrir le menu.`},"he-IL":{longPressMessage:`\u{5DC}\u{5D7}\u{5E5} \u{5DC}\u{5D7}\u{5D9}\u{5E6}\u{5D4} \u{5D0}\u{5E8}\u{5D5}\u{5DB}\u{5D4} \u{5D0}\u{5D5} \u{5D4}\u{5E7}\u{5E9} Alt + ArrowDown \u{5DB}\u{5D3}\u{5D9} \u{5DC}\u{5E4}\u{5EA}\u{5D5}\u{5D7} \u{5D0}\u{5EA} \u{5D4}\u{5EA}\u{5E4}\u{5E8}\u{5D9}\u{5D8}`},"hr-HR":{longPressMessage:"Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika"},"hu-HU":{longPressMessage:`Nyomja meg hosszan, vagy nyomja meg az Alt + lefele ny\xedl gombot a men\xfc megnyit\xe1s\xe1hoz`},"it-IT":{longPressMessage:`Premi a lungo o premi Alt + Freccia gi\xf9 per aprire il menu`},"ja-JP":{longPressMessage:`\u{9577}\u{62BC}\u{3057}\u{307E}\u{305F}\u{306F} Alt+\u{4E0B}\u{77E2}\u{5370}\u{30AD}\u{30FC}\u{3067}\u{30E1}\u{30CB}\u{30E5}\u{30FC}\u{3092}\u{958B}\u{304F}`},"ko-KR":{longPressMessage:`\u{AE38}\u{AC8C} \u{B204}\u{B974}\u{AC70}\u{B098} Alt + \u{C544}\u{B798}\u{CABD} \u{D654}\u{C0B4}\u{D45C}\u{B97C} \u{B20C}\u{B7EC} \u{BA54}\u{B274} \u{C5F4}\u{AE30}`},"lt-LT":{longPressMessage:`Nor\u{117}dami atidaryti meniu, nuspaud\u{119} palaikykite arba paspauskite \u{201E}Alt + ArrowDown\u{201C}.`},"lv-LV":{longPressMessage:`Lai atv\u{113}rtu izv\u{113}lni, turiet nospiestu vai nospiediet tausti\u{146}u kombin\u{101}ciju Alt + lejupv\u{113}rst\u{101} bulti\u{146}a`},"nb-NO":{longPressMessage:`Langt trykk eller trykk Alt + PilNed for \xe5 \xe5pne menyen`},"nl-NL":{longPressMessage:"Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen"},"pl-PL":{longPressMessage:`Naci\u{15B}nij i przytrzymaj lub naci\u{15B}nij klawisze Alt + Strza\u{142}ka w d\xf3\u{142}, aby otworzy\u{107} menu`},"pt-BR":{longPressMessage:"Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu"},"pt-PT":{longPressMessage:"Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu"},"ro-RO":{longPressMessage:`Ap\u{103}sa\u{21B}i lung sau ap\u{103}sa\u{21B}i pe Alt + s\u{103}geat\u{103} \xeen jos pentru a deschide meniul`},"ru-RU":{longPressMessage:`\u{41D}\u{430}\u{436}\u{43C}\u{438}\u{442}\u{435} \u{438} \u{443}\u{434}\u{435}\u{440}\u{436}\u{438}\u{432}\u{430}\u{439}\u{442}\u{435} \u{438}\u{43B}\u{438} \u{43D}\u{430}\u{436}\u{43C}\u{438}\u{442}\u{435} Alt + \u{421}\u{442}\u{440}\u{435}\u{43B}\u{43A}\u{430} \u{432}\u{43D}\u{438}\u{437}, \u{447}\u{442}\u{43E}\u{431}\u{44B} \u{43E}\u{442}\u{43A}\u{440}\u{44B}\u{442}\u{44C} \u{43C}\u{435}\u{43D}\u{44E}`},"sk-SK":{longPressMessage:`Ponuku otvor\xedte dlh\xfdm stla\u{10D}en\xedm alebo stla\u{10D}en\xedm kl\xe1vesu Alt + kl\xe1vesu so \u{161}\xedpkou nadol`},"sl-SI":{longPressMessage:`Za odprtje menija pritisnite in dr\u{17E}ite gumb ali pritisnite Alt+pu\u{161}\u{10D}ica navzdol`},"sr-SP":{longPressMessage:"Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni"},"sv-SE":{longPressMessage:`H\xe5ll nedtryckt eller tryck p\xe5 Alt + pil ned\xe5t f\xf6r att \xf6ppna menyn`}
1,"tr-TR":{longPressMessage:`Men\xfcy\xfc a\xe7mak i\xe7in uzun bas\u{131}n veya Alt + A\u{15F}a\u{11F}\u{131} Ok tu\u{15F}una bas\u{131}n`},"uk-UA":{longPressMessage:`\u{414}\u{43E}\u{432}\u{433}\u{43E} \u{430}\u{431}\u{43E} \u{437}\u{432}\u{438}\u{447}\u{430}\u{439}\u{43D}\u{43E} \u{43D}\u{430}\u{442}\u{438}\u{441}\u{43D}\u{456}\u{442}\u{44C} \u{43A}\u{43E}\u{43C}\u{431}\u{456}\u{43D}\u{430}\u{446}\u{456}\u{44E} \u{43A}\u{43B}\u{430}\u{432}\u{456}\u{448} Alt \u{456} \u{441}\u{442}\u{440}\u{456}\u{43B}\u{43A}\u{430} \u{432}\u{43D}\u{438}\u{437}, \u{449}\u{43E}\u{431} \u{432}\u{456}\u{434}\u{43A}\u{440}\u{438}\u{442}\u{438} \u{43C}\u{435}\u{43D}\u{44E}`},"zh-CN":{longPressMessage:`\u{957F}\u{6309}\u{6216}\u{6309} Alt + \u{5411}\u{4E0B}\u{65B9}\u{5411}\u{952E}\u{4EE5}\u{6253}\u{5F00}\u{83DC}\u{5355}`},"zh-TW":{longPressMessage:`\u{9577}\u{6309}\u{6216}\u{6309} Alt+\u{5411}\u{4E0B}\u{9375}\u{4EE5}\u{958B}\u{555F}\u{529F}\u{80FD}\u{8868}`}};var o=a(17782),d=a(45776),c=a(36755),u=a(82883),p=a(52485),m=a(97812),g=a(81472),h=a(45896),x=a(62978),f=(e,t)=>{if(e){let a=Array.isArray(e.children)?e.children:[...(null==e?void 0:e.items)||[]];if(a&&a.length)return a.find(e=>{if(e&&e.key===t)return e})||{}}return null},y=(e,t,a)=>{let r=a||f(e,t);return r&&r.props&&"closeOnSelect"in r.props?r.props.closeOnSelect:null==e?void 0:e.closeOnSelect},v=a(39478),b=a(25379),w=new WeakMap,j=[],k=a(9785),N=a(43079),E=a(61422),C=a(43256),I=a(13682),S=a(98055),A=a(5110),P=a(68472),D=a(96079),T=a(44218),_=a(59540),R=a(66673),F=a(39696),M=(0,D.Gp)((e,t)=>{let{children:a,...r}=e,s=function(e){var t,a,r;let s=(0,l.w)(),[i,d]=(0,D.oe)(e,T.v.variantKeys),{as:c,ref:u,children:p,state:m,triggerRef:x,scrollRef:f,defaultOpen:y,onOpenChange:v,isOpen:_,isNonModal:R=!0,shouldFlip:F=!0,containerPadding:M=12,shouldBlockScroll:O=!1,isDismissable:L=!0,shouldCloseOnBlur:B,portalContainer:U,updatePositionDeps:Z,dialogProps:z,placement:q="top",triggerType:K="dialog",showArrow:G=!1,offset:W=7,crossOffset:V=0,boundaryElement:H,isKeyboardDismissDisabled:J,shouldCloseOnInteractOutside:$,shouldCloseOnScroll:Y,triggerAnchorPoint:X,motionProps:Q,className:ee,classNames:et,onClose:ea,...er}=i,el=(0,C.gy)(u),es=(0,n.useRef)(null),en=(0,n.useRef)(!1),ei=x||es,eo=null!=(a=null!=(t=e.disableAnimation)?t:null==s?void 0:s.disableAnimation)&&a,ed=(0,I.d)({isOpen:_,defaultOpen:y,onOpenChange:e=>{null==v||v(e),e||null==ea||ea()}}),ec=m||ed,{popoverProps:eu,underlayProps:ep,placement:em}=function(e,t){let{groupRef:a,triggerRef:r,popoverRef:l,showArrow:s,offset:i=7,crossOffset:o=0,scrollRef:d,shouldFlip:c,boundaryElement:u,isDismissable:p=!0,shouldCloseOnBlur:m=!0,shouldCloseOnScroll:g=!0,placement:x="top",containerPadding:f,shouldCloseOnInteractOutside:y,isNonModal:v,isKeyboardDismissDisabled:C,updatePositionDeps:I=[],...S}=e,A=null==v||v,P="SubmenuTrigger"===S.trigger,{overlayProps:D,underlayProps:T}
1=(0,E.S)({isOpen:t.isOpen,onClose:t.close,shouldCloseOnBlur:m,isDismissable:p||P,isKeyboardDismissDisabled:C,shouldCloseOnInteractOutside:y||(e=>{var t;return!(null==(t=r.current)?void 0:t.contains(e))}),disableOutsideEvents:!A},l),{overlayProps:_,arrowProps:R,placement:F,updatePosition:M,triggerAnchorPoint:O}=(0,k.t)({...S,shouldFlip:c,crossOffset:o,targetRef:r,overlayRef:l,isOpen:t.isOpen,scrollRef:d,boundaryElement:u,containerPadding:f,placement:(0,b.Yx)(x),offset:s?i+3:i,onClose:A&&!P&&g?t.close:()=>{}});return(0,N.G)(()=>{I.length&&M()},I),(0,n.useEffect)(()=>{var e,r;if(t.isOpen&&l.current)return A?function(e){let t=j[j.length-1];if(t&&!t.visibleNodes.has(e))return t.visibleNodes.add(e),()=>{t.visibleNodes.delete(e)}}(null!=(e=null==a?void 0:a.current)?e:l.current):function(e,t=document.body){let a=new Set(e),r=new Set,l=e=>{for(let t of e.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))a.add(t);let t=e=>{if(a.has(e)||e.parentElement&&r.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let t of a)if(e.contains(t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},l=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),n=t(e);if(n===NodeFilter.FILTER_ACCEPT&&s(e),n!==NodeFilter.FILTER_REJECT){let e=l.nextNode();for(;null!=e;)s(e),e=l.nextNode()}},s=e=>{var t;let a=null!=(t=w.get(e))?t:0;("true"!==e.getAttribute("aria-hidden")||0!==a)&&(0===a&&e.setAttribute("aria-hidden","true"),r.add(e),w.set(e,a+1))};j.length&&j[j.length-1].disconnect(),l(t);let n=new MutationObserver(e=>{for(let t of e)if("childList"===t.type&&0!==t.addedNodes.length&&![...a,...r].some(e=>e.contains(t.target))){for(let e of t.removedNodes)e instanceof Element&&(a.delete(e),r.delete(e));for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&("true"===e.dataset.liveAnnouncer||"true"===e.dataset.reactAriaTopLayer)?a.add(e):e instanceof Element&&l(e)}});n.observe(t,{childList:!0,subtree:!0});let i={visibleNodes:a,hiddenNodes:r,observe(){n.observe(t,{childList:!0,subtree:!0})},disconnect(){n.disconnect()}};return j.push(i),()=>{for(let e of(n.disconnect(),r)){let t=w.get(e);null!=t&&(1===t?(e.removeAttribute("aria-hidden"),w.delete(e)):w.set(e,t-1))}i===j[j.length-1]?(j.pop(),j.length&&j[j.length-1].observe()):j.splice(j.indexOf(i),1)}}([null!=(r=null==a?void 0:a.current)?r:l.current])},[A,t.isOpen,l,a]),{popoverProps:(0,h.dG)(D,_),arrowProps:R,underlayProps:T,placement:F,triggerAnchorPoint:O}}({triggerRef:ei,isNonModal:R,popoverRef:el,placement:q,offset:W,scrollRef:f,isDismissable:L,shouldCloseOnBlur:B,boundaryElement:H,crossOffset:V,shouldFlip:F,containerPadding:M,updatePositionDeps:Z,isKeyboardDismissDisabled:J,shouldCloseOnScroll:Y,shouldCloseOnInteractOutside:$,triggerAnchorPoint:X},ec),eg=(0,n.useMemo)(()=>em?(0,b.Yv)(em,q)?em:q:null,[em,q]),{triggerProps:eh}=function(e,t,a){let r,{type:l}=e,{isOpen:s}=t;(0,n.useEffect)(()=>{a&&a.current&&(0,A.v).set(a.current,t.close)}),"menu"===l?r=!0:"listbox"===l&&(r="listbox");let i=(0,o.Me)();return{triggerProps:{"aria-haspopup":r,"aria-expanded":s,"aria-controls":s?i:void 0,onPress:t.toggle},overlayProps:{id:i}}}({type:K},ec,ei),{isFocusVisible:ex,isFocused:ef,focusProps:ey}=(0,S.F)(),ev=(0,n.useMemo)(()=>(0,T.v)({...d}),[(0,h.Xx)(d)]),eb=(0,g.cn)(null==et?void 0:et.base,ee),ew={"--trigger-anchor-point":X?`${X.x}px ${X.y}px`:void 0};(0,P.t)({isDisabled:!(O&&ec.isOpen)});let ej=(0,n.useCallback)((e={})=>({"data-slot":"content","data-open":(0,h.PB)(ec.isOpen),"data-arrow":(0,h.PB)(G),"data-placement":em?(0,b.sK)(em,q):void 0,className:ev.content({class:(0,g.cn)(null==et?void 0:et.content,e.className)})}),[ev,ec.isOpen,G,eg,q,et,em]),ek=(0,n.useCallback)(t=>{var a;let r;return"touch"===t.pointerType&&((null==e?void 0:e.backdrop)==="blur"||(null==e?void 0:e.backdrop)==="opaque")?r=setTimeout(()=>{en.current=!0},100):en.current=!0,null==(a=eh.onPress)||a.call(eh,t),()=>{clearTimeout(r)}},[null==eh?void 0:eh.onPress]),eN=(0,n.useCallback)((e={},t=null)=>{let{isDisabled:a,...r}=e;return{"data-slot":"trigger",...(0,h.dG)({"aria-haspopup":"dialog"},eh,r),onPress:ek,isDisabled:a,className:ev.trigger({class:(0,g.cn)(null==et?void 0:et.trigger,e.className),isTriggerDisabled:a}),ref:(0,h.lq)(t,ei)}},[ec,eh,ek,ei]),eE=(0,n.useCallback)((e={})=>({"data-slot":"backdrop",className:ev.backdrop({class:null==et?void 0:et.backdrop}),onClick:e=>{if(!en.current){e.preventDefault();return}ec.close(),en.current=!1},...ep,...e}),[ev,ec.isOpen,et,ep]);return{state:ec,Component:c||"div",children:p,classNames:et,showArrow:G,triggerRef:ei,placement:eg,isNonModal:R,popoverRef:el,portalContainer:U,isOpen:ec.isOpen,onClose:ec.close,disableAnimation:eo,shouldBlockScroll:O,backdrop:null!=(r=e.backdrop)?r:"transparent",motionProps:Q,getBackdropProps:eE,getPopoverProps:(e={})=>({ref:el,...(0,h.dG)(eu,er,e),style:(0,h.dG)(eu.style,er.style,e.style)}),getTriggerProps:eN,getDialogProps:(e={})=>({"data-slot":"base","data-open":(0,h.PB)(ec.isOpen),"data-focus":(0,h.PB)(ef),"data-arrow":(0,h.PB)(G),"data-focus-visible":(0,h.PB)(ex),"data-placement":em?(0,b.sK)(em,q):void 0,...(0,h.dG)(ey,z,e),className:ev.base({class:(0,g.cn)(eb)}),style:{outline:"none",...ew}}),getContentProps:ej}}({...r,ref:t}),[i,d]=n.Children.toArray(a),c=(0,F.jsx)(_.aV,{portalContainer:s.portalContainer,children:d});return(0,F.jsxs)(v.H,{value:s,children:[i,s.disableAnimation&&s.isOpen?c:(0,F.jsx)(R.M,{children:s.isOpen?c:null})]})});M.displayName="HeroUI.Popover";var O=e=>{let{children:t,...a}=e,f=function(e){var t;let a=(0,l.w)(),{as:r,triggerRef:f,isOpen:v,defaultOpen:b,onOpenChange:w,isDisabled:j,type:k="menu",trigger:N="press",placement:E="bottom",closeOnSelect:C=!0,shouldBlockScroll:I=!0,classNames:S,disableAnimation:A=null!=(t=null==a?void 0:a.disableAnimation)&&t,onClose:P,className:D,...T}=e,_=(0,n.useRef)(null),R=f||_,F=(0,n.useRef)(null),M=(0,n.useRef)(null),O=function(e){let t=(0,s.d)(e),[a,r]=(0,n.use
1State)(null),[l,i]=(0,n.useState)([]),o=()=>{i([]),t.close()};return{focusStrategy:a,...t,open(e=null){r(e),t.open()},toggle(e=null){r(e),t.toggle()},close(){o()},expandedKeysStack:l,openSubmenu:(e,t)=>{i(a=>t>a.length?a:[...a.slice(0,t),e])},closeSubmenu:(e,t)=>{i(a=>a[t]===e?a.slice(0,t):a)}}}({trigger:N,isOpen:v,defaultOpen:b,onOpenChange:e=>{null==w||w(e),e||null==P||P()}}),{menuTriggerProps:L,menuProps:B}=function(e,t,a){var r;let{type:l="menu",isDisabled:s,trigger:n="press"}=e,m=(0,o.Me)(),{triggerProps:g,overlayProps:h}=(0,p.I)({type:l},t,a),x=(0,u.q)((r=i)&&r.__esModule?r.default:r,"@react-aria/menu"),{longPressProps:f}=(0,c.T)({isDisabled:s||"longPress"!==n,accessibilityDescription:x.format("longPressMessage"),onLongPressStart(){t.close()},onLongPress(){t.open("first")}});return delete g.onPress,{menuTriggerProps:{...g,..."press"===n?{preventFocusOnPress:!0,onPressStart(e){"touch"===e.pointerType||"keyboard"===e.pointerType||s||((0,d.A)(e.target),t.open("virtual"===e.pointerType?"first":null))},onPress(e){"touch"!==e.pointerType||s||((0,d.A)(e.target),t.toggle())}}:f,id:m,onKeyDown:e=>{if(!s&&("longPress"!==n||e.altKey)&&a&&a.current)switch(e.key){case"Enter":case" ":if("longPress"===n||e.isDefaultPrevented())return;case"ArrowDown":"continuePropagation"in e||e.stopPropagation(),e.preventDefault(),t.toggle("first");break;case"ArrowUp":"continuePropagation"in e||e.stopPropagation(),e.preventDefault(),t.toggle("last");break;default:"continuePropagation"in e&&e.continuePropagation()}}},menuProps:{...h,"aria-labelledby":m,autoFocus:t.focusStrategy||!0,onClose:t.close}}}({type:k,trigger:N,isDisabled:j},O,R),U=(0,n.useMemo)(()=>(0,m.j6)({className:D}),[D]),Z=e=>{(void 0===e||e)&&C&&O.close()};return{Component:r||"div",menuRef:F,menuProps:B,closeOnSelect:C,onClose:O.close,autoFocus:O.focusStrategy||!0,disableAnimation:A,getPopoverProps:(e={})=>({state:O,placement:E,ref:M,disableAnimation:A,shouldBlockScroll:I,scrollRef:F,triggerRef:R,...(0,h.dG)(T,e),classNames:{...S,...e.classNames,content:(0,g.cn)(U,null==S?void 0:S.content,e.className)}}),getMenuProps:(e,t=null)=>({ref:(0,x.l)(t,F),menuProps:B,closeOnSelect:C,...(0,h.dG)(e,{onAction:(t,a)=>{Z(y(e,t,a))},onClose:O.close})}),getMenuTriggerProps:(e={})=>{let{onPress:t,onPressStart:a,...r}=L;return(0,h.dG)(r,{isDisabled:j},e)}}}(a),[v,b]=n.Children.toArray(t);return(0,F.jsx)(r.K,{value:f,children:(0,F.jsxs)(M,{...f.getPopoverProps(),children:[v,b]})})};O.displayName="HeroUI.Dropdown";var L=O},27884:function(e,t,a){"use strict";a.d(t,{a:function(){return ev}});var r=a(37143),l=a(39478),s=a(90170),n=a(67647),i=a(14778),o=a(70662),d=a(62185),c=a(25379),u=a(44405),p=a(39696),m=()=>a.e(409).then(a.bind(a,80409)).then(e=>e.default),g=e=>{let{as:t,children:a,className:r,...g}=e,{Component:h,placement:x,backdrop:f,motionProps:y,disableAnimation:v,getPopoverProps:b,getDialogProps:w,getBackdropProps:j,getContentProps:k,isNonModal:N,onClose:E}=(0,l.l)(),C=(0,s.useRef)(null),{dialogProps:I,titleProps:S}=(0,u.R)({},C),A=w({ref:C,...I,...g}),P=a&&(0,p.jsxs)(p.Fragment,{children:[!N&&(0,p.jsx)(n.U,{onDismiss:E}),(0,p.jsx)(t||h||"div",{...A,children:(0,p.jsx)("div",{...k({className:r}),children:"function"==typeof a?a(S):a})}),(0,p.jsx)(n.U,{onDismiss:E})]}),D=(0,s.useMemo)(()=>"transparent"===f?null:v?(0,p.jsx)("div",{...j()}):(0,p.jsx)(o.X,{features:m,children:(0,p.jsx)(d.m.div,{animate:"enter",exit:"exit",initial:"exit",variants:i.y7.fade,...j()})}),[f,v,j]),T=x?(0,c.VS)("center"===x?"top":x):void 0,_=(0,p.jsx)(p.Fragment,{children:v?P:(0,p.jsx)(o.X,{features:m,children:(0,p.jsx)(d.m.div,{animate:"enter",exit:"exit",initial:"initial",style:T,variants:i.y7.scaleSpringOpacity,...y,children:P})})});return(0,p.jsxs)("div",{...b(),children:[D,_]})};g.displayName="HeroUI.PopoverContent";var h=a(89301),x=a(96079);function f(e){let{isSelected:t,disableAnimation:a,...r}=e;return(0,p.jsx)("svg",{"aria-hidden":"true","data-selected":t,role:"presentation",viewBox:"0 0 17 18",...r,children:(0,p.jsx)("polyline",{fill:"none",points:"1 9 7 14 15 4",stroke:"currentColor",strokeDasharray:22,strokeDashoffset:t?44:66,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,style:a?{}:{transition:"stroke-dashoffset 200ms ease"}})})}var y=a(32839),v=a(81472),b=a(30010),w=a(98055),j=a(45896);let k=new WeakMap;var N=a(93940),E=a(17782),C=a(74503),I=a(65754),S=a(90735),A=a(63366),P=a(31848),D=a(6159),T=a(72141),_=a(29392),R=a(68662),F=a(39505),M=a(13241),O=a(62799),L=a(78984),B=a(14482),U=a(44227);let Z=null,z=new Set,q=new Map,K=!1,G=!1;function W(e,t){for(let a of z)a(e,t)}function V(e){K=!0,N.nG.isOpening||e.metaKey||!(0,L.V5)()&&e.altKey||e.ctrlKey||"Control"
1===e.key||"Shift"===e.key||"Meta"===e.key||(Z="keyboard",W("keyboard",e))}function H(e){Z="pointer","pointerType"in e&&e.pointerType,("mousedown"===e.type||"pointerdown"===e.type)&&(K=!0,W("pointer",e))}function J(e){!N.nG.isOpening&&(0,B.Z)(e)&&(K=!0,Z="virtual")}function $(e){(0,C.NI)(e)!==window&&(0,C.NI)(e)!==document&&!O.uR&&e.isTrusted&&(K||G||(Z="virtual",W("virtual",e)),K=!1,G=!1)}function Y(){O.uR||(K=!1,G=!0)}function X(e){if("undefined"==typeof window||"undefined"==typeof document||q.get((0,U.kR)(e)))return;let t=(0,U.kR)(e),a=(0,U.r3)(e),r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){K=!0,r.apply(this,arguments)},a.addEventListener("keydown",V,!0),a.addEventListener("keyup",V,!0),a.addEventListener("click",J,!0),t.addEventListener("focus",$,!0),t.addEventListener("blur",Y,!1),"undefined"!=typeof PointerEvent&&(a.addEventListener("pointerdown",H,!0),a.addEventListener("pointermove",H,!0),a.addEventListener("pointerup",H,!0)),t.addEventListener("beforeunload",()=>{Q(e)},{once:!0}),q.set(t,{focus:r})}let Q=(e,t)=>{let a=(0,U.kR)(e),r=(0,U.r3)(e);t&&r.removeEventListener("DOMContentLoaded",t),q.has(a)&&(a.HTMLElement.prototype.focus=q.get(a).focus,r.removeEventListener("keydown",V,!0),r.removeEventListener("keyup",V,!0),r.removeEventListener("click",J,!0),a.removeEventListener("focus",$,!0),a.removeEventListener("blur",Y,!1),"undefined"!=typeof PointerEvent&&(r.removeEventListener("pointerdown",H,!0),r.removeEventListener("pointermove",H,!0),r.removeEventListener("pointerup",H,!0)),q.delete(a))};"undefined"!=typeof document&&function(e){let t;let a=(0,U.r3)(void 0);"loading"!==a.readyState?X(void 0):(t=()=>{X(void 0)},a.addEventListener("DOMContentLoaded",t)),()=>Q(e,t)}();let ee={prefix:String(Math.round(1e10*Math.random())),current:0},et=(s.createContext(ee),s.createContext(!1));function ea(){return!1}function er(){return!0}function el(e){return()=>{}}"undefined"!=typeof window&&window.document&&window.document.createElement,new WeakMap,s.useId;var es=a(33800),en=e=>{let{Component:t,slots:a,classNames:r,rendered:l,shortcut:n,description:i,isSelectable:o,isSelected:d,isDisabled:c,selectedIcon:u,startContent:m,endContent:g,disableAnimation:h,hideSelectedIcon:O,getItemProps:L,getLabelProps:B,getDescriptionProps:U,getKeyboardShortcutProps:z,getSelectedIconProps:q}=function(e){var t,a;let r=(0,b.w)(),[l,n]=(0,x.oe)(e,y.D9.variantKeys),{as:i,item:o,state:d,shortcut:c,description:u,startContent:p,endContent:m,isVirtualized:g,selectedIcon:h,className:f,classNames:O,onAction:L,autoFocus:B,onPress:U,onPressStart:z,onPressUp:q,onPressEnd:K,onPressChange:G,onHoverStart:W,onHoverChange:V,onHoverEnd:H,hideSelectedIcon:J=!1,isReadOnly:$=!1,closeOnSelect:Y,onClose:X,onClick:Q,...ee}=l,en=null!=(a=null!=(t=e.disableAnimation)?t:null==r?void 0:r.disableAnimation)&&a,ei=(0,s.useRef)(null),eo=i||((null==ee?void 0:ee.href)?"a":"li"),ed="string"==typeof eo,{rendered:ec,key:eu}=o,ep=d.disabledKeys.has(eu)||e.isDisabled,em="none"!==d.selectionManager.selectionMode,eg=!("function"==typeof s.useSyncExternalStore?s.useSyncExternalStore(el,ea,er):(0,s.useContext)(et))&&"undefined"!=typeof window&&window.screen.width<=700,{isFocusVisible:eh,focusProps:ex}=(0,w.F)({autoFocus:B}),{isPressed:ef,isFocused:ey,isSelected:ev,isDisabled:eb,menuItemProps:ew,labelProps:ej,descriptionProps:ek,keyboardShortcutProps:eN}=function(e,t,a){var r,l;let{id:n,key:i,closeOnSelect:o,shouldCloseOnSelect:d,isVirtualized:c,"aria-haspopup":u,onPressStart:p,onPressUp:m,onPress:g,onPressChange:h,onPressEnd:x,onClick:f,onHoverStart:y,onHoverChange:v,onHoverEnd:b,onKeyDown:w,onKeyUp:j,onFocus:M,onFocusChange:O,onBlur:L,selectionManager:B=t.selectionManager}=e,U=!!u,Z=U&&"true"===e["aria-expanded"],z=null!==(r=e.isDisabled)&&void 0!==r?r:B.isDisabled(i),q=null!==(l=e.isSelected)&&void 0!==l?l:B.isSelected(i),K=k.get(t),G=t.collection.getItem(i),W=e.onClose||K.onClose,V=(0,N.tv)(),H=()=>{var t;!U&&((null==G?void 0:null===(t=G.props)||void 0===t?void 0:t.onAction)?G.props.onAction():e.onAction&&e.onAction(i),K.onAction&&(0,K.onAction)(i))},J="menuitem";U||("single"===B.selectionMode?J="menuitemradio":"multiple"!==B.selectionMode||(J="menuitemcheckbox"));let $=(0,E.mp)(),Y=(0,E.mp)(),X=(0,E.mp)(),Q={id:n,"aria-disabled":z||void 0,role:J,"aria-label":e["aria-label"],"aria-labelledby":$,"aria-describedby":[e["aria-describedby"],Y,X].filter(
1Boolean).join(" ")||void 0,"aria-controls":e["aria-controls"],"aria-haspopup":u,"aria-expanded":e["aria-expanded"]};if("none"===B.selectionMode||U||(Q["aria-checked"]=q),c){let e=Number(null==G?void 0:G.index);Q["aria-posinset"]=Number.isNaN(e)?void 0:e+1,Q["aria-setsize"]=(0,A.i)(t.collection)}let ee=(0,s.useRef)(!1),et=(0,s.useRef)(null),{itemProps:ea,isFocused:er}=(0,F.C)({id:n,selectionManager:B,key:i,ref:a,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,linkBehavior:"none",shouldUseVirtualFocus:K.shouldUseVirtualFocus}),{pressProps:el,isPressed:es}=(0,P.r)({onPressStart:p,onPress:g,onPressUp:e=>{"keyboard"!==e.pointerType&&(et.current={pointerType:e.pointerType}),"mouse"!==e.pointerType||ee.current||e.target.click(),null==m||m(e)},onPressChange:e=>{null==h||h(e),ee.current=e},onPressEnd:x,isDisabled:z}),{hoverProps:en}=(0,D.X)({isDisabled:z,onHoverStart(e){(0,T.E)()||Z&&u||(B.setFocused(!0),B.setFocusedKey(i)),null==y||y(e)},onHoverChange:v,onHoverEnd:b}),{keyboardProps:ei}=(0,_.v)({onKeyDown:e=>{if(e.repeat){e.continuePropagation();return}switch(e.key){case" ":et.current={pointerType:"keyboard",key:" "},(0,C.NI)(e).click(),(0,T._w)("keyboard");break;case"Enter":et.current={pointerType:"keyboard",key:"Enter"},"A"!==(0,C.NI)(e).tagName&&(0,C.NI)(e).click(),(0,T._w)("keyboard");break;default:U||e.continuePropagation(),null==w||w(e)}},onKeyUp:j}),{focusableProps:eo}=(0,R.kc)({onBlur:L,onFocus:M,onFocusChange:O},a),ed=(0,I.z)(null==G?void 0:G.props);delete ed.id;let ec=(0,N.eY)(null==G?void 0:G.props);return{menuItemProps:{...Q,...(0,S.d)(ed,ec,U?{onFocus:ea.onFocus,"data-collection":ea["data-collection"],"data-key":ea["data-key"]}:ea,el,en,ei,eo,K.shouldUseVirtualFocus||U?{onMouseDown:e=>e.preventDefault()}:void 0,z?void 0:{onClick:e=>{var t,a,r;null==f||f(e),H(),(0,N.Gc)(e,V,G.props.href,null==G?void 0:G.props.routerOptions);let l=(null===(t=et.current)||void 0===t?void 0:t.pointerType)==="keyboard"?(null===(a=et.current)||void 0===a?void 0:a.key)==="Enter"||"none"===B.selectionMode||B.isLink(i):"multiple"!==B.selectionMode||B.isLink(i);l=null!==(r=null!=d?d:o)&&void 0!==r?r:l,W&&!U&&l&&W(),et.current=null}}),tabIndex:null!=ea.tabIndex&&Z&&!K.shouldUseVirtualFocus?-1:ea.tabIndex},labelProps:{id:$},descriptionProps:{id:Y},keyboardShortcutProps:{id:X},isFocused:er,isFocusVisible:er&&B.isFocused&&(0,T.E)()&&!Z,isSelected:q,isPressed:es,isDisabled:z}}({key:eu,onClose:X,isDisabled:ep,onPress:(0,s.useCallback)(e=>{null==Q||Q(e),null==U||U(e)},[Q,U]),onPressStart:z,onPressUp:q,onPressEnd:K,onPressChange:G,"aria-label":l["aria-label"],closeOnSelect:Y,isVirtualized:g,onAction:L},d,ei),{hoverProps:eE,isHovered:eC}=(0,M.X)({isDisabled:eb,onHoverStart(e){"pointer"!==Z||(d.selectionManager.setFocused(!0),d.selectionManager.setFocusedKey(eu)),null==W||W(e)},onHoverChange:V,onHoverEnd:H}),eI=ew,eS=(0,s.useMemo)(()=>(0,y.D9)({...n,isDisabled:eb,disableAnimation:en,hasTitleTextChild:"string"==typeof ec,hasDescriptionTextChild:"string"==typeof u}),[(0,j.Xx)(n),eb,en,ec,u]),eA=(0,v.cn)(null==O?void 0:O.base,f);$&&(eI=(0,j.Os)(eI));let eP=(0,s.useCallback)((e={})=>({"aria-hidden":(0,j.PB)(!0),"data-disabled":(0,j.PB)(eb),className:eS.selectedIcon({class:null==O?void 0:O.selectedIcon}),...e}),[eb,eS,O]);return{Component:eo,domRef:ei,slots:eS,classNames:O,isSelectable:em,isSelected:ev,isDisabled:eb,rendered:ec,shortcut:c,description:u,startContent:p,endContent:m,selectedIcon:h,disableAnimation:en,getItemProps:(e={})=>({ref:ei,...(0,j.dG)($?{}:ex,(0,es.z)(ee,{enabled:ed}),eI,eE,e),"data-focus":(0,j.PB)(ey),"data-selectable":(0,j.PB)(em),"data-hover":(0,j.PB)(eg?eC||ef:eC),"data-disabled":(0,j.PB)(eb),"data-selected":(0,j.PB)(ev),"data-pressed":(0,j.PB)(ef),"data-focus-visible":(0,j.PB)(eh),className:eS.base({class:(0,v.cn)(eA,e.className)})}),getLabelProps:(e={})=>({...(0,j.dG)(ej,e),className:eS.title({class:null==O?void 0:O.title})}),hideSelectedIcon:J,getDescriptionProps:(e={})=>({...(0,j.dG)(ek,e),className:eS.description({class:null==O?void 0:O.description})}),getKeyboardShortcutProps:(e={})=>({...(0,j.dG)(eN,e),className:eS.shortcut({class:null==O?void 0:O.shortcut})}),getSelectedIconProps:eP}}(e),K=(0,s.useMemo)(()=>{let e=(0,p.jsx)(f,{disableAnimation:h,isSelected:d});return"function"==typeof u?u({icon:e,isSelected:d,isDisabled:c}):u||e},[u,d,c,h]);return(0,p.jsxs)(t,{...L(),children:[m,i?(0,p.jsxs)("div",{className:a.wrapper({class:null==r?void 0:r.wrapper}),children:[(0,p.jsx)("span",{...B(),children:l}),(0,p.jsx)("span",{...U(),children:i})]}):(0,p.jsx)("span",{...B(),children:l}),n&&(0,p.jsx)("kbd",{...z(),children:n}),o&&!O&&(0,p.jsx)("span",{...q(),children:K}),g]})};en.displayName="HeroUI.MenuItem";var ei=a(62861),eo=(0,x.Gp)((e,t)=>{let{Component:a,getDividerProps:r}=function(e){var t;let a,r;let{as:l,className:n,orientation:i,...o}=e,d=l||"hr";"hr"===d&&"vertical"===i&&(d="div");let{separatorProps:c}=(t={elementType:"string"==typeof d?d:"hr",orientation:i},r=(0,es.z)(t,{enabled:"string"==typeof t.elementType}),("vertical"===t.orientation&&(a="vertical"),"hr"!==t.elementType)?{separatorProps:{...r,role:"separator","aria-orientation":a}}:{separatorProps:r}),u=(0,s.useMemo)(()=>(0,ei.q)({orientation:i,className:n}),[i,n]);return{Component:d,getDividerProps:(0,s.useCallback)((e={})=>({className:u,role:"separator","data-orientation":i,...c,...o,...e}),[u,i,c,o])}}({...e});return(0,p.jsx)(a,{ref:t,...r()})});eo.displayName="HeroUI.Divider";var ed=(0,x.Gp)(({item:e,state:t,as:a,variant:r,color:l,disableAnimation:n,onAction:i,closeOnSelect:o,className:d,classNames:c,showDivider:u=!1,hideSelectedIcon:m,dividerProps:g={},itemClasses:h,title:x,...f},b)=>{let w=(0,s.useMemo)(()=>(0,y.Dk)(),[]),k=(0,v.cn)(null==c?void 0:c.base,d),N=(0,v.cn)(null==c?void 0:c.divider,null==g?void 0:g.className),{itemProps:C,headingProps:I,groupProps:S}=function(e){let{heading:t,"aria-label":a}=e,r=(0,E.Me)();return{itemProps:{role:"presentation"},headingProps:t?{id:r,role:"presentation"}:{},groupProps:{role:"group","aria-label":a,"aria-labelledby":t?r:void 0}}}({heading:e.rendered,"aria-label":e["aria-label"]});return(0,p.jsxs)(a||"li",{"data-slot":"base",...(0,j.dG)(C,f),className:w.base({class:k}),children:[e.rendered&&(0,p.jsx)("span",{...I,className:w.heading({class:null==c?void 0:c.heading}),"data-slot":"heading",children:e.rendered}),(0,p.jsxs)("ul",{...S,className:w.group({class:null==c?void 0:c.group}),"data-has-title":!!e.rendered,"data-slot":"group",children:[[...e.childNodes].map(e=>{let{key:a,props:s}=e,d=(0,p.jsx)(en,{classNames:h,closeOnSelect:o,color:l,disableAnimation:n,hideSelectedIcon:m,item:e,state:t,variant:r,onAction:i,...s},a);return e.wrapper&&(d=e.wrapper(d)),d}),u&&(0,p.jsx)(eo,{as:"li",className:w.divider({class:N}),...g})]})]})});ed.displayName="HeroUI.MenuSection";var ec=a(65616);class eu{*[Symbol.iterator](){yield*this.iterable}get size(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){var t;let a=this.keyMap.get(e);return a&&null!==(t=a.prevKey)&&void 0!==t?t:null}getKeyAfter(e){var t;let a=this.keyMap.get(e);return a&&null!==(t=a.nextKey)&&void 0!==t?t:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){var t;return null!==(t=this.keyMap.get(e))&&void 0!==t?t:null}at(e){let t=[...this.getKeys()];return this.getItem(t[e])}constructor(e,{expandedKeys:t}={}){var a;this.keyMap=new Map,this.firstKey=null,this.lastKey=null,this.iterable=e,t=t||new Set;let r=e=>{if(this.keyMap.set(e.key,e),e.childNodes&&("section"===e.type||t.has(e.key)))for(let t of e.childNodes)r(t)};for(let t of e)r(t);let l=null,s=0;for(let[e,t]of this.keyMap)l?(l.nextKey=e,t.prevKey=l.key):(this.firstKey=e,t.prevKey=void 0),"item"===t.type&&(t.index=s++),(l=t).nextKey=void 0;this.lastKey=null!==(a=null==l?void 0:l.key)&&void 0!==a?a:null}}var ep=a(42306),em=a(48135),eg=a(50010),eh=a(59442),ex=a(43256),ef=a(96389),ey=(0,x.Gp)(function(e,t){let{Component:a,state:r,closeOnSelect:l,color:n,disableAnimation:i,hideSelectedIcon:o,hideEmptyContent:d,variant:c,onClose:u,topContent:m,bottomContent:g,itemClasses:h,getBaseProps:x,getListProps:f,getEmptyContentProps:w}=function(e){var t;let a=(0,b.w)(),{as:r,ref:l,variant:n,color:i,children:o,disableAnimation:d=null!=(t=null==a?void 0:a.disableAnimation)&&t,onAction:c,closeOnSelect:u,itemClasses:p,className:m,state:g,topContent:h,bottomContent:x,hideEmptyContent:f=!1,hideSelectedIcon:w=!1,emptyContent:j="No items.",menuProps:N,onClose:E,classNames:C,...A}
1=e,P=r||"ul",D=(0,ex.gy)(l),T="string"==typeof P,_=function(e){let{onExpandedChange:t}=e,[a,r]=(0,eh.z)(e.expandedKeys?new Set(e.expandedKeys):void 0,e.defaultExpandedKeys?new Set(e.defaultExpandedKeys):new Set,t),l=(0,ep.q)(e),n=(0,s.useMemo)(()=>e.disabledKeys?new Set(e.disabledKeys):new Set,[e.disabledKeys]),i=(0,eg.K)(e,(0,s.useCallback)(e=>new eu(e,{expandedKeys:a}),[a]),null);return(0,s.useEffect)(()=>{null==l.focusedKey||i.getItem(l.focusedKey)||l.setFocusedKey(null)},[i,l.focusedKey]),{collection:i,expandedKeys:a,disabledKeys:n,toggleKey:e=>{let t;r(((t=new Set(a)).has(e)?t.delete(e):t.add(e),t))},setExpandedKeys:r,selectionManager:new em.Z(i,l)}}({...A,...N,children:o}),R=g||_,{menuProps:F}=function(e,t,a){let{shouldFocusWrap:r=!0,onKeyDown:l,onKeyUp:s,...n}=e;e["aria-label"]||e["aria-labelledby"];let i=(0,I.z)(e,{labelable:!0}),{listProps:o}=(0,ec._)({...n,ref:a,selectionManager:t.selectionManager,collection:t.collection,disabledKeys:t.disabledKeys,shouldFocusWrap:r,linkBehavior:"override"});return k.set(t,{onClose:e.onClose,onAction:e.onAction,shouldUseVirtualFocus:e.shouldUseVirtualFocus}),{menuProps:(0,S.d)(i,{onKeyDown:l,onKeyUp:s},{role:"menu",...o,onKeyDown:t=>{var a;("Escape"!==t.key||e.shouldUseVirtualFocus)&&(null===(a=o.onKeyDown)||void 0===a||a.call(o,t))}})}}({...A,...N,onAction:c},R,D),M=(0,s.useMemo)(()=>(0,y.GI)({className:m}),[m]),O=(0,v.cn)(null==C?void 0:C.base,m);return{Component:P,state:R,variant:n,color:i,disableAnimation:d,onClose:E,topContent:h,bottomContent:x,closeOnSelect:u,className:m,itemClasses:p,getBaseProps:(e={})=>({ref:D,"data-slot":"base",className:M.base({class:O}),...(0,es.z)(A,{enabled:T}),...e}),getListProps:(e={})=>({"data-slot":"list",className:M.list({class:null==C?void 0:C.list}),...F,...e}),hideEmptyContent:f,hideSelectedIcon:w,getEmptyContentProps:(e={})=>({children:j,className:M.emptyContent({class:null==C?void 0:C.emptyContent}),...e})}}({...e,ref:t}),j=(0,p.jsxs)(a,{...f(),children:[!r.collection.size&&!d&&(0,p.jsx)("li",{children:(0,p.jsx)("div",{...w()})}),[...r.collection].map(e=>{let t={closeOnSelect:l,color:n,disableAnimation:i,item:e,state:r,variant:c,onClose:u,hideSelectedIcon:o,...e.props},a=(0,ef.z)(h,null==t?void 0:t.classNames);if("section"===e.type)return(0,p.jsx)(ed,{...t,itemClasses:a},e.key);let s=(0,p.jsx)(en,{...t,classNames:a},e.key);return e.wrapper&&(s=e.wrapper(s)),s})]});return(0,p.jsxs)("div",{...x(),children:[m,j,g]})}),ev=(0,x.Gp)(function(e,t){let{getMenuProps:a}=(0,r.t)();return(0,p.jsx)(g,{children:(0,p.jsx)(h.MT,{contain:!0,restoreFocus:!0,children:(0,p.jsx)(ey,{...a(e,t)})})})})},67667:function(e,t,a){"use strict";a.d(t,{W:function(){return s}});var r=a(90170);function l(e){return null}l.getCollectionNode=function*(e,t){let{childItems:a,title:l,children:s}=e,n=e.title||e.children,i=e.textValue||("string"==typeof n?n:"")||e["aria-label"]||"";i||null==t||t.suppressTextValueWarning,yield{type:"item",props:e,rendered:n,textValue:i,"aria-label":e["aria-label"],hasChildNodes:null!=e.hasChildItems?e.hasChildItems:!!(e.childItems||e.title&&r.Children.count(e.children)>0),*childNodes(){if(a)for(let e of a)yield{type:"item",value:e};else if(l){let e=[];r.Children.forEach(s,t=>{e.push({type:"item",element:t})}),yield*e}}}};var s=l},11433:function(e,t,a){"use strict";a.d(t,{g:function(){return P}});var r,l=a(12995),s=a(13377),n=a(39696),i=(0,l.Gp)((e,t)=>{let{as:a,activePage:r,...l}=e,i=(0,s.gy)(t);return(0,n.jsx)(a||"span",{ref:i,"aria-hidden":!0,...l,children:r})});i.displayName="HeroUI.PaginationCursor";var o=a(90170),d=a(39541),c=a(11292),u=a(14369),p=a(77254),m=a(90768),g=a(29192),h=a(14254),x=a(26039),f=(0,l.Gp)((e,t)=>{let{Component:a,children:r,getItemProps:l}=function(e){let{as:t,ref:a,value:r,children:l,isActive:n,isDisabled:i,onPress:f,onClick:y,getAriaLabel:v,className:b,...w}=e,j=!!(null==e?void 0:e.href),k=t||j?"a":"li",N="string"==typeof k,E=(0,s.gy)(a),C=(0,c.tv)(),I=(0,o.useMemo)(()=>n?`${null==v?void 0:v(r)} active`:null==v?void 0:v(r),[r,n]),{isPressed:S,pressProps:A}=(0,g.r)({isDisabled:i,onPress:f}),{focusProps:P,isFocused:D,isFocusVisible:T}=(0,x.F)({}),{isHovered:_,hoverProps:R}=(0,h.X)({isDisabled:i});return{Component:k,children:l,ariaLabel:I,isFocused:D,isFocusVisible:T,getItemProps:(e={})=>({ref:E,role:"button",tabIndex:i?-1:0,"aria-label":I,"aria-current":(0,d.PB)(n),"aria-disabled":(0,d.PB)(i),"data-disabled":(0,d.PB)(i),"data-active":(0,d.PB)(n),"data-focus":(0,d.PB)(D),"data-hover":(0,d.PB)(_),"data-pressed":(0,d.PB)(S),"data-focus-visible":(0,d.PB)(T),...(0,u.d)(e,A,P,R,
1(0,m.z)(w,{enabled:N})),className:(0,d.Wy)(b,e.className),onClick:t=>{(0,p.t)(null==A?void 0:A.onClick,y)(t),!C.isNative&&t.currentTarget instanceof HTMLAnchorElement&&t.currentTarget.href&&!t.isDefaultPrevented()&&(0,c.b0)(t.currentTarget,t)&&e.href&&(t.preventDefault(),C.open(t.currentTarget,t,e.href,e.routerOptions))}})}}({...e,ref:t});return(0,n.jsx)(a,{...l(),children:r})});f.displayName="HeroUI.PaginationItem";var y=a(23576),v=((r=v||{}).DOTS="dots",r.PREV="prev",r.NEXT="next",r),b=a(72654),w=a(90185),j=a(85414),k=a(55349),N=a(55683),E=(0,k.tv)({slots:{base:["p-2.5","-m-2.5","overflow-x-scroll","scrollbar-hide"],wrapper:["flex","flex-nowrap","h-fit","max-w-fit","relative","gap-1","items-center","overflow-visible"],item:["tap-highlight-transparent","select-none","touch-none"],prev:"",next:"",cursor:["absolute","flex","overflow-visible","items-center","justify-center","origin-center","left-0","select-none","touch-none","pointer-events-none","z-20"],forwardIcon:["hidden","group-hover:block","group-data-[focus-visible=true]:block","data-[before=true]:rotate-180"],ellipsis:"group-hover:hidden group-data-[focus-visible=true]:hidden",chevronNext:"rotate-180"},variants:{variant:{bordered:{item:["border-medium","border-default","bg-transparent","data-[hover=true]:bg-default-100"]},light:{item:"bg-transparent"},flat:{},faded:{item:["border-medium","border-default"]}},color:{default:{cursor:j.J.solid.default},primary:{cursor:j.J.solid.primary},secondary:{cursor:j.J.solid.secondary},success:{cursor:j.J.solid.success},warning:{cursor:j.J.solid.warning},danger:{cursor:j.J.solid.danger}},size:{sm:{},md:{},lg:{}},radius:{none:{},sm:{},md:{},lg:{},full:{}},isCompact:{true:{wrapper:"gap-0 shadow-sm",item:["shadow-none","first-of-type:rounded-e-none","last-of-type:rounded-s-none","[&:not(:first-of-type):not(:last-of-type)]:rounded-none"],prev:"!rounded-e-none",next:"!rounded-s-none"}},isDisabled:{true:{base:"opacity-disabled pointer-events-none"}},showShadow:{true:{}},disableCursorAnimation:{true:{cursor:"hidden"}},disableAnimation:{true:{item:"transition-none",cursor:"transition-none"},false:{item:["data-[pressed=true]:scale-[0.97]","transition-transform-background"],cursor:["data-[moving=true]:transition-transform","!data-[moving=true]:duration-300","opacity-0","data-[moving]:opacity-100"]}}},defaultVariants:{variant:"flat",color:"primary",size:"md",radius:"md",isCompact:!1,isDisabled:!1,showShadow:!1,disableCursorAnimation:!1},compoundVariants:[{showShadow:!0,color:"default",class:{cursor:[j.J.shadow.default,"shadow-md"]}},{showShadow:!0,color:"primary",class:{cursor:[j.J.shadow.primary,"shadow-md"]}},{showShadow:!0,color:"secondary",class:{cursor:[j.J.shadow.secondary,"shadow-md"]}},{showShadow:!0,color:"success",class:{cursor:[j.J.shadow.success,"shadow-md"]}},{showShadow:!0,color:"warning",class:{cursor:[j.J.shadow.warning,"shadow-md"]}},{showShadow:!0,color:"danger",class:{cursor:[j.J.shadow.danger,"shadow-md"]}},{isCompact:!0,variant:"bordered",class:{item:"[&:not(:first-of-type)]:ms-[calc(theme(borderWidth.2)*-1)]"}},{disableCursorAnimation:!0,color:"default",class:{item:["data-[active=true]:bg-default-400","data-[active=true]:border-default-400","data-[active=true]:text-default-foreground"]}},{disableCursorAnimation:!0,color:"primary",class:{item:["data-[active=true]:bg-primary","data-[active=true]:border-primary","data-[active=true]:text-primary-foreground"]}},{disableCursorAnimation:!0,color:"secondary",class:{item:["data-[active=true]:bg-secondary","data-[active=true]:border-secondary","data-[active=true]:text-secondary-foreground"]}},{disableCursorAnimation:!0,color:"success",class:{item:["data-[active=true]:bg-success","data-[active=true]:border-success","data-[active=true]:text-success-foreground"]}},{disableCursorAnimation:!0,color:"warning",class:{item:["data-[active=true]:bg-warning","data-[active=true]:border-warning","data-[active=true]:text-warning-foreground"]}},{disableCursorAnimation:!0,color:"danger",class:{item:["data-[active=true]:bg-danger","data-[active=true]:border-danger","data-[active=true]:text-danger-foreground"]}},{disableCursorAnimation:!0,showShadow:!0,color:"default",class:{item:["data-[active=true]:shadow-md","data-[active=true]:shadow-default/50"]}},{disableCursorAnimation:!0,showShadow:!0,color:"primary",class:{item:["data-[active=true]:shadow-md","data-[active=true]:shadow-primary/40"]}},{disableCursorAnimation:!0,showShadow:!0,color:"secondary",class:{item:["data-[active=true]:shadow-md","data-[active=true]:shadow-secondary/40"]}},{disableCursorAnimation:!0,showShadow:!0,color:"success",class:{item:["data-[active=true]:shadow-md","data-[active=true]:shadow-success/40"]}},{disableCursorAnimation:!0,showShadow:!0,color:"warning",class:{item:["data-[active=true]:shadow-md","data-[active=true]:shadow-warning/40"]}},{disableCursorAnimation:!0,showShadow:!0,color:"danger",class:{item:["data-[active=true]:shadow-md","data-[active=true]:shadow-danger/40"]}}],compoundSlots:[{slots:["item","prev","next"],class:["flex","flex-wrap","truncate","box-border","outline-none","items-center","justify-center","text-default-foreground",...N.Dh,"data-[disabled=true]:text-default-300","data-[disabled=true]:pointer-events-none"]},{slots:["item","prev","next"],variant:["flat","bordered","faded"],class:["shadow-sm"]},{slots:["item","prev","next"],variant:"flat",class:["bg-default-100","[&[data-hover=true]:not([data-active=true])]:bg-default-200","active:bg-default-300"]},{slots:["item","prev","next"],variant:"faded",class:["bg-default-50","[&[data-hover=true]:not([data-active=true])]:bg-default-100","active:bg-default-200"]},{slots:["item","prev","next"],variant:"light",class:["[&[data-hover=true]:not([data-active=true])]:bg-default-100","active:bg-default-200"]},{slots:["item","cursor","prev","next"],size:"sm",class:"min-w-8 w-8 h-8 text-tiny"},{slots:["item","cursor","prev","next"],size:"md",class:"min-w-9 w-9 h-9 text-small"},{slots:["item","cursor","prev","next"],size:"lg",class:"min-w-10 w-10 h-10 text-medium"},{slots:["wrapper","item","cursor","prev","next"],radius:"none",class:"rounded-none"},{slots:["wrapper","item","cursor","prev","next"],radius:"sm",class:"rounded-small"},{slots:["wrapper","item","cursor","prev","next"],radius:"md",class:"rounded-medium"},{slots:["wrapper","item","cursor","prev","next"],radius:"lg",class:"rounded-large"},{slots:["wrapper","item","cursor","prev","next"],radius:"full",class:"rounded-full"}]}),C=a(54886),I=e=>(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",height:"1em",shapeRendering:"geometricPrecision",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",viewBox:"0 0 24 24",width:"1em",...e,children:[(0,n.jsx)("circle",{cx:"12",cy:"12",fill:"
1currentColor",r:"1"}),(0,n.jsx)("circle",{cx:"19",cy:"12",fill:"currentColor",r:"1"}),(0,n.jsx)("circle",{cx:"5",cy:"12",fill:"currentColor",r:"1"})]}),S=e=>(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",focusable:"false",height:"1em",role:"presentation",shapeRendering:"geometricPrecision",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",viewBox:"0 0 24 24",width:"1em",...e,children:[(0,n.jsx)("path",{d:"M13 17l5-5-5-5"}),(0,n.jsx)("path",{d:"M6 17l5-5-5-5"})]}),A=(0,l.Gp)((e,t)=>{let{Component:a,dotsJump:r,slots:c,classNames:u,total:p,range:m,loop:g,activePage:h,disableCursorAnimation:x,disableAnimation:j,renderItem:k,onNext:N,onPrevious:A,setPage:P,getItemAriaLabel:D,getItemRef:T,getBaseProps:_,getWrapperProps:R,getItemProps:F,getCursorProps:M}=function(e){var t,a,r,n;let i=(0,b.w)(),[c,u]=(0,l.oe)(e,E.variantKeys),{as:p,ref:m,classNames:g,dotsJump:h=5,loop:x=!1,showControls:f=!1,total:j=1,initialPage:k=1,page:N,siblings:C,boundaries:I,onChange:S,className:A,renderItem:P,getItemAriaLabel:D,...T}=c,_=(0,s.gy)(m),R=(0,o.useRef)(null),F=(0,o.useRef)(),M=(0,o.useRef)(),O=null!=(a=null!=(t=null==e?void 0:e.disableAnimation)?t:null==i?void 0:i.disableAnimation)&&a,L=null!=(n=null!=(r=null==e?void 0:e.disableCursorAnimation)?r:O)&&n;function B(){return F.current||(F.current=new Map),F.current}function U(e,t){let a=B();e?a.set(t,e):a.delete(t)}let{range:Z,activePage:z,setPage:q,previous:K,next:G,first:W,last:V}=function(e){let{page:t,total:a,siblings:r=1,boundaries:l=1,initialPage:s=1,showControls:n=!1,onChange:i}=e,[c,u]=(0,o.useState)(t||s),{direction:p}=(0,y.j)(),m=e=>{u(e),i&&i(e)};(0,o.useEffect)(()=>{t&&t!==c&&u(t)},[t]);let g=(0,o.useCallback)(e=>{e<=0?m(1):e>a?m(a):m(e)},[a,c,m]),h=(0,o.useCallback)(e=>n?["prev",...e,"next"]:e,["rtl"===p,n]);return{range:(0,o.useMemo)(()=>{if(2*r+3+2*l>=a)return h((0,d.w6)(1,a));let e=Math.max(c-r,l),t=Math.min(c+r,a-l),s=e>l+2,n=t<a-(l+1);if(!s&&n){let e=2*r+l+2;return h([...(0,d.w6)(1,e),"dots",...(0,d.w6)(a-(l-1),a)])}if(s&&!n){let e=l+1+2*r;return h([...(0,d.w6)(1,l),"dots",...(0,d.w6)(a-e,a)])}return h([...(0,d.w6)(1,l),"dots",...(0,d.w6)(e,t),"dots",...(0,d.w6)(a-l+1,a)])},[a,c,r,l,h]),activePage:c,setPage:g,next:()=>g(c+1),previous:()=>g(c-1),first:()=>g(1),last:()=>g(a)}}({page:N,total:j,initialPage:k,siblings:C,boundaries:I,showControls:f,onChange:S}),[H,J]=function({threshold:e=0,root:t=null,rootMargin:a="0%",isEnabled:r=!0,freezeOnceVisible:l=!1,initialIsIntersecting:s=!1,onChange:n}={}){var i;let[d,c]=(0,o.useState)(null),[u,p]=(0,o.useState)(()=>({isIntersecting:s,entry:void 0})),m=(0,o.useRef)();m.current=n;let g=(null==(i=u.entry)?void 0:i.isIntersecting)&&l;(0,o.useEffect)(()=>{let s;if(!r||!d||!("IntersectionObserver"in window)||g)return;let n=new IntersectionObserver(e=>{let t=Array.isArray(n.thresholds)?n.thresholds:[n.thresholds];e.forEach(e=>{let a=e.isIntersecting&&t.some(t=>e.intersectionRatio>=t);p({isIntersecting:a,entry:e}),m.current&&m.current(a,e),a&&l&&s&&(s(),s=void 0)})},{threshold:e,root:t,rootMargin:a});return n.observe(d),()=>{n.disconnect()}},[d,r,JSON.stringify(e),t,a,g,l]);let h=(0,o.useRef)(null);(0,o.useEffect)(()=>{var e;d||null==(e=u.entry)||!e.target||l||g||h.current===u.entry.target||(h.current=u.entry.target,p({isIntersecting:s,entry:void 0}))},[d,u.entry,l,g,s]);let x=[c,!!u.isIntersecting,u.entry];return x.ref=x[0],x.isIntersecting=x[1],x.entry=x[2],x}();(0,o.useEffect)(()=>{_.current&&H(_.current)},[_.current]);let $=(0,o.useRef)(z);(0,o.useEffect)(()=>{z&&!O&&J&&function(e,t){let a=B().get(e);if(!a||!R.current)return;M.current&&clearTimeout(M.current),(0,w.Z)(a,{scrollMode:"always",behavior:"smooth",block:"start",inline:"start",boundary:_.current});let{offsetLeft:r}=a;if(t){R.current.setAttribute("data-moving","false"),R.current.style.transform=`translateX(${r}px) scale(1)`;return}R.current.setAttribute("data-moving","true"),R.current.style.transform=`translateX(${r}px) scale(1.1)`,M.current=setTimeout(()=>{R.current&&(R.current.style.transform=`translateX(${r}px) scale(1)`),M.current=setTimeout(()=>{var e;null==(e=R.current)||e.setAttribute("data-moving","false"),M.current&&clearTimeout(
1M.current)},300)},300)}(z,z===$.current),$.current=z},[N,z,O,L,J,e.dotsJump,e.isCompact,e.showControls]);let Y=(0,o.useMemo)(()=>E({...u,disableAnimation:O,disableCursorAnimation:L}),[(0,d.Xx)(u),L,O]),X=(0,d.Wy)(null==g?void 0:g.base,A);return{Component:p||"nav",showControls:f,dotsJump:h,slots:Y,classNames:g,loop:x,total:j,range:Z,activePage:z,getItemRef:U,disableAnimation:O,disableCursorAnimation:L,setPage:q,onPrevious:()=>x&&1===z?V():K(),onNext:()=>x&&z===j?W():G(),renderItem:P,getBaseProps:(e={})=>({...e,ref:_,role:"navigation","aria-label":e["aria-label"]||"pagination navigation","data-slot":"base","data-controls":(0,d.PB)(f),"data-loop":(0,d.PB)(x),"data-dots-jump":h,"data-total":j,"data-active-page":z,className:Y.base({class:(0,d.Wy)(X,null==e?void 0:e.className)}),...T}),getWrapperProps:(e={})=>({...e,"data-slot":"wrapper",className:Y.wrapper({class:(0,d.Wy)(null==g?void 0:g.wrapper,null==e?void 0:e.className)})}),getItemProps:(e={})=>({...e,ref:t=>U(t,e.value),"data-slot":"item",isActive:e.value===z,className:Y.item({class:(0,d.Wy)(null==g?void 0:g.item,null==e?void 0:e.className)}),onPress:()=>{e.value!==z&&q(e.value)}}),getCursorProps:(e={})=>({...e,ref:R,activePage:z,"data-slot":"cursor",className:Y.cursor({class:(0,d.Wy)(null==g?void 0:g.cursor,null==e?void 0:e.className)})}),getItemAriaLabel:e=>{if(e){if(D)return D(e);switch(e){case v.DOTS:return"dots element";case v.PREV:return"previous page button";case v.NEXT:return"next page button";case"first":return"first page button";case"last":return"last page button";default:return`pagination item ${e}`}}}}}({...e,ref:t}),{direction:O}=(0,y.j)(),L="rtl"===O,B=(0,o.useCallback)(e=>e===v.PREV&&!L||e===v.NEXT&&L?(0,n.jsx)(C.D,{}):(0,n.jsx)(C.D,{className:c.chevronNext({class:null==u?void 0:u.chevronNext})}),[c,L]),U=(0,o.useCallback)(e=>(0,n.jsx)(f,{className:c.prev({class:null==u?void 0:u.prev}),"data-slot":"prev",getAriaLabel:D,isDisabled:!g&&1===h,value:e,onPress:A,children:B(v.PREV)},v.PREV),[c,u,g,h,L,p,D,A]),Z=(0,o.useCallback)(e=>(0,n.jsx)(f,{className:c.next({class:(0,d.Wy)(null==u?void 0:u.next)}),"data-slot":"next",getAriaLabel:D,isDisabled:!g&&h===p,value:e,onPress:N,children:B(v.NEXT)},v.NEXT),[c,u,g,h,L,p,D,N]),z=(0,o.useCallback)((e,t)=>{let a=t<m.indexOf(h);if(k&&"function"==typeof k){let l="number"==typeof e?e:t;e===v.NEXT&&(l=h+1),e===v.PREV&&(l=h-1),e===v.DOTS&&(l=a?h-r>=1?h-r:1:h+r<=p?h+r:p);let s={[v.PREV]:B(v.PREV),[v.NEXT]:B(v.NEXT),[v.DOTS]:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(I,{className:null==c?void 0:c.ellipsis({class:null==u?void 0:u.ellipsis})}),(0,n.jsx)(S,{className:null==c?void 0:c.forwardIcon({class:null==u?void 0:u.forwardIcon}),"data-before":(0,d.PB)(a)})]})};return k({value:e,index:t,key:`${e}-${t}`,page:l,total:p,children:"number"==typeof e?e:s[e],activePage:h,dotsJump:r,isBefore:a,isActive:e===h,isPrevious:e===h-1,isNext:e===h+1,isFirst:1===e,isLast:e===p,onNext:N,onPrevious:A,setPage:P,onPress:()=>P(l),ref:"number"==typeof e?t=>T(t,e):void 0,className:c.item({class:null==u?void 0:u.item}),getAriaLabel:D})}return e===v.PREV?U(e):e===v.NEXT?Z(e):e===v.DOTS?(0,n.jsxs)(f,{className:c.item({class:(0,d.Wy)(null==u?void 0:u.item,"group")}),"data-slot":"item",getAriaLabel:D,value:e,onPress:()=>a?P(h-r>=1?h-r:1):P(h+r<=p?h+r:p),children:[(0,n.jsx)(I,{className:null==c?void 0:c.ellipsis({class:null==u?void 0:u.ellipsis})}),(0,n.jsx)(S,{className:null==c?void 0:c.forwardIcon({class:null==u?void 0:u.forwardIcon}),"data-before":(0,d.PB)(L?!a:a)})]},v.DOTS+a):(0,o.createElement)(f,{...F({value:e}),key:e,getAriaLabel:D},e)},[L,h,r,F,g,m,k,c,u,p,D,N,A,P,U,Z]);return(0,n.jsx)(a,{..._(),children:(0,n.jsxs)("ul",{...R(),children:[!x&&!j&&(0,n.jsx)(i,{...M()}),m.map(z)]})})});A.displayName="HeroUI.Pagination";var P=A},39478:function(e,t,a){"use strict";a.d(t,{H:function(){return r},l:function(){return l}});var[r,l]=(0,a(27261).k)({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Popover />`"})},33800:function(e,t,a){"use strict";a.d(t,{z:function(){return o}});var r=new Set(["id","type","style","title","role","tabIndex","htmlFor","width","height","abbr","accept","acceptCharset","accessKey","action","allowFullScreen","allowTransparency","alt","async","autoComplete","autoF
1ocus","autoPlay","cellPadding","cellSpacing","challenge","charset","checked","cite","class","className","cols","colSpan","command","content","contentEditable","contextMenu","controls","coords","crossOrigin","data","dateTime","default","defer","dir","disabled","download","draggable","dropzone","encType","enterKeyHint","for","form","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","headers","hidden","high","href","hrefLang","httpEquiv","icon","inputMode","isMap","itemId","itemProp","itemRef","itemScope","itemType","kind","label","lang","list","loop","manifest","max","maxLength","media","mediaGroup","method","min","minLength","multiple","muted","name","noValidate","open","optimum","pattern","ping","placeholder","poster","preload","radioGroup","referrerPolicy","readOnly","rel","required","rows","rowSpan","sandbox","scope","scoped","scrolling","seamless","selected","shape","size","sizes","slot","sortable","span","spellCheck","src","srcDoc","srcSet","start","step","target","translate","typeMustMatch","useMap","value","wmode","wrap"]),l=new Set(["onCopy","onCut","onPaste","onLoad","onError","onWheel","onScroll","onCompositionEnd","onCompositionStart","onCompositionUpdate","onKeyDown","onKeyPress","onKeyUp","onFocus","onBlur","onChange","onInput","onSubmit","onClick","onContextMenu","onDoubleClick","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onPointerDown","onPointerEnter","onPointerLeave","onPointerUp","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionEnd"]),s=/^(data-.*)$/,n=/^(aria-.*)$/,i=/^(on[A-Z].*)$/;function o(e,t={}){let{labelable:a=!0,enabled:o=!0,propNames:d,omitPropNames:c,omitEventNames:u,omitDataProps:p,omitEventProps:m}=t,g={};if(!o)return e;for(let t in e)!((null==c?void 0:c.has(t))||(null==u?void 0:u.has(t))&&i.test(t)||i.test(t)&&!l.has(t)||p&&s.test(t)||m&&i.test(t))&&(Object.prototype.hasOwnProperty.call(e,t)&&(r.has(t)||a&&n.test(t)||(null==d?void 0:d.has(t))||s.test(t))||i.test(t))&&(g[t]=e[t]);return g}},62302:function(e,t,a){"use strict";a.d(t,{n:function(){return U}});var r=a(12995),l=a(13377),s=a(39541),n=a(14369);let i=new WeakMap;function o(e,t,a){if(!e)return"";"string"==typeof t&&(t=t.replace(/\s+/g,""));let r=i.get(e);return`${r}-${a}-${t}`}var d=a(96039),c=a(98230),u=a(26039),p=a(39696),m=(0,r.Gp)((e,t)=>{var a,r;let{as:i,tabKey:m,destroyInactiveTabPanel:g,state:h,className:x,slots:f,classNames:y,...v}=e,b=(0,l.gy)(t),{tabPanelProps:w}=function(e,t,a){var r;let l=(0,c.p)(a)?void 0:0,s=o(t,null!==(r=e.id)&&void 0!==r?r:null==t?void 0:t.selectedKey,"tabpanel"),i=(0,d.b)({...e,id:s,"aria-labelledby":o(t,null==t?void 0:t.selectedKey,"tab")});return{tabPanelProps:(0,n.d)(i,{tabIndex:l,role:"tabpanel","aria-describedby":e["aria-describedby"],"aria-details":e["aria-details"]})}}({...e,id:String(m)},h,b),{focusProps:j,isFocused:k,isFocusVisible:N}=(0,u.F)(),E=h.selectedItem,C=h.collection.getItem(m).props.children,I=(0,s.Wy)(null==y?void 0:y.panel,x,null==(a=null==E?void 0:E.props)?void 0:a.className),S=m===(null==E?void 0:E.key);return C&&(S||!g)?(0,p.jsx)(i||"div",{ref:b,"data-focus":k,"data-focus-visible":N,"data-inert":S?void 0:"true",inert:(0,s.UE)(!S),...S&&(0,n.d)(w,j,v),className:null==(r=f.panel)?void 0:r.call(f,{class:I}),"data-slot":"panel",children:C}):null});m.displayName="HeroUI.TabPanel";var g=a(71462),h=a(90768),x=a(77254),f=a(90185),y=a(27825),v=a(11292),b=a(39505),w=a(14254),j=a(70662),k=a(80813),N=a(62185),E=a(65),C=(0,r.Gp)((e,t)=>{var a;let{className:r,as:i,item:d,state:c,classNames:m,isDisabled:C,listRef:I,slots:S,motionProps:A,disableAnimation:P,disableCursorAnimation:D,shouldSelectOnPressUp:T,onClick:_,tabRef:R,...F}=e,{key:M}=d,O=(0,l.gy)(t),L=i||(e.href?"a":"button"),{tabProps:B,isSelected:U,isDisabled:Z,isPressed:z}=function(e,t,a){let{key:r,isDisabled:l,shouldSelectOnPressUp:s}=e,{selectionManager:i,selectedKey:d}=t,c=r===d,u=l||t.isDisabled||t.selectionManager.isDisabled(r),{itemProps:p,isPressed:m}=(0,b.C)({selectionManager:i,key:r,ref:a,isDisabled:u,shouldSelectOnPressUp:s,linkBehavior:"selection"}
1),g=o(t,r,"tab"),h=o(t,r,"tabpanel"),{tabIndex:x}=p,f=t.collection.getItem(r),w=(0,y.z)(null==f?void 0:f.props,{labelable:!0});delete w.id;let j=(0,v.eY)(null==f?void 0:f.props);return{tabProps:(0,n.d)(w,j,p,{id:g,"aria-selected":c,"aria-disabled":u||void 0,"aria-controls":c?h:void 0,tabIndex:u?void 0:x,role:"tab"}),isSelected:c,isDisabled:u,isPressed:m}}({key:M,isDisabled:C,shouldSelectOnPressUp:T},c,O);null==e.children&&delete B["aria-controls"];let q=C||Z,{focusProps:K,isFocused:G,isFocusVisible:W}=(0,u.F)(),{hoverProps:V,isHovered:H}=(0,w.X)({isDisabled:q}),J=(0,s.Wy)(null==m?void 0:m.tab,r),[,$]=(0,E.t)({rerender:!0});return(0,p.jsxs)(L,{ref:(0,g.l)(O,R),"data-disabled":(0,s.PB)(Z),"data-focus":(0,s.PB)(G),"data-focus-visible":(0,s.PB)(W),"data-hover":(0,s.PB)(H),"data-hover-unselected":(0,s.PB)((H||z)&&!U),"data-pressed":(0,s.PB)(z),"data-selected":(0,s.PB)(U),"data-slot":"tab",...(0,n.d)(B,q?{}:{...K,...V},(0,h.z)(F,{enabled:"string"==typeof L,omitPropNames:new Set(["title"])}),{onClick:()=>{(0,x.t)(_,B.onClick),(null==O?void 0:O.current)&&(null==I?void 0:I.current)&&(0,f.Z)(O.current,{scrollMode:"if-needed",behavior:"smooth",block:"end",inline:"end",boundary:null==I?void 0:I.current})}}),className:null==(a=S.tab)?void 0:a.call(S,{class:J}),title:null==F?void 0:F.titleValue,type:"button"===L?"button":void 0,children:[U&&!P&&!D&&$?(0,p.jsx)(j.X,{features:k.g,children:(0,p.jsx)(N.m.span,{className:S.cursor({class:null==m?void 0:m.cursor}),"data-slot":"cursor",layoutDependency:!1,layoutId:"cursor",transition:{type:"spring",bounce:.15,duration:.5},...A})}):null,(0,p.jsx)("div",{className:S.tabContent({class:null==m?void 0:m.tabContent}),"data-slot":"tabContent",children:d.rendered})]})});C.displayName="HeroUI.Tab";var I=a(72654),S=a(85414),A=a(55349),P=a(55683),D=(0,A.tv)({slots:{base:"inline-flex",tabList:["flex","p-1","h-fit","gap-2","items-center","flex-nowrap","overflow-x-scroll","scrollbar-hide","bg-default-100"],tab:["z-0","w-full","px-3","py-1","flex","group","relative","justify-center","items-center","outline-none","cursor-pointer","transition-opacity","tap-highlight-transparent","data-[disabled=true]:cursor-not-allowed","data-[disabled=true]:opacity-30","data-[hover-unselected=true]:opacity-disabled",...P.Dh],tabContent:["relative","z-10","text-inherit","whitespace-nowrap","transition-colors","text-default-500","group-data-[selected=true]:text-foreground"],cursor:["absolute","z-0","bg-white"],panel:["py-3","px-1","outline-none","data-[inert=true]:hidden",...P.Dh],tabWrapper:[]},variants:{variant:{solid:{cursor:"inset-0"},light:{tabList:"bg-transparent dark:bg-transparent",cursor:"inset-0"},underlined:{tabList:"bg-transparent dark:bg-transparent",cursor:"h-[2px] w-[80%] bottom-0 shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]"},bordered:{tabList:"bg-transparent dark:bg-transparent border-medium border-default-200 shadow-sm",cursor:"inset-0"}},color:{default:{},primary:{},secondary:{},success:{},warning:{},danger:{}},size:{sm:{tabList:"rounded-medium",tab:"h-7 text-tiny rounded-small",cursor:"rounded-small"},md:{tabList:"rounded-medium",tab:"h-8 text-small rounded-small",cursor:"rounded-small"},lg:{tabList:"rounded-large",tab:"h-9 text-medium rounded-medium",cursor:"rounded-medium"}},radius:{none:{tabList:"rounded-none",tab:"rounded-none",cursor:"rounded-none"},sm:{tabList:"rounded-medium",tab:"rounded-small",cursor:"rounded-small"},md:{tabList:"rounded-medium",tab:"rounded-small",cursor:"rounded-small"},lg:{tabList:"rounded-large",tab:"rounded-medium",cursor:"rounded-medium"},full:{tabList:"rounded-full",tab:"rounded-full",cursor:"rounded-full"}},fullWidth:{true:{base:"w-full",tabList:"w-full"}},isDisabled:{true:{tabList:"opacity-disabled pointer-events-none"}},disableAnimation:{true:{tab:"transition-none",tabContent:"transition-none"}},placement:{top:{},start:{tabList:"flex-col",panel:"py-0 px-3",tabWrapper:"flex"},end:{tabList:"flex-col",panel:"py-0 px-3",tabWrapper:"flex flex-row-reverse"},bottom:{tabWrapper:"flex flex-col-reverse"}}},defaultVariants:{color:"default",variant:"solid",size:"md",fullWidth:!1,isDisabled:!1},compoundVariants:[{variant:["solid","bordered","light"],color:"default",class:{curs
1or:["bg-background","dark:bg-default","shadow-small"],tabContent:"group-data-[selected=true]:text-default-foreground"}},{variant:["solid","bordered","light"],color:"primary",class:{cursor:S.J.solid.primary,tabContent:"group-data-[selected=true]:text-primary-foreground"}},{variant:["solid","bordered","light"],color:"secondary",class:{cursor:S.J.solid.secondary,tabContent:"group-data-[selected=true]:text-secondary-foreground"}},{variant:["solid","bordered","light"],color:"success",class:{cursor:S.J.solid.success,tabContent:"group-data-[selected=true]:text-success-foreground"}},{variant:["solid","bordered","light"],color:"warning",class:{cursor:S.J.solid.warning,tabContent:"group-data-[selected=true]:text-warning-foreground"}},{variant:["solid","bordered","light"],color:"danger",class:{cursor:S.J.solid.danger,tabContent:"group-data-[selected=true]:text-danger-foreground"}},{variant:"underlined",color:"default",class:{cursor:"bg-foreground",tabContent:"group-data-[selected=true]:text-foreground"}},{variant:"underlined",color:"primary",class:{cursor:"bg-primary",tabContent:"group-data-[selected=true]:text-primary"}},{variant:"underlined",color:"secondary",class:{cursor:"bg-secondary",tabContent:"group-data-[selected=true]:text-secondary"}},{variant:"underlined",color:"success",class:{cursor:"bg-success",tabContent:"group-data-[selected=true]:text-success"}},{variant:"underlined",color:"warning",class:{cursor:"bg-warning",tabContent:"group-data-[selected=true]:text-warning"}},{variant:"underlined",color:"danger",class:{cursor:"bg-danger",tabContent:"group-data-[selected=true]:text-danger"}},{disableAnimation:!0,variant:"underlined",class:{tab:["after:content-['']","after:absolute","after:bottom-0","after:h-[2px]","after:w-[80%]","after:opacity-0","after:shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]","data-[selected=true]:after:opacity-100"]}},{disableAnimation:!0,color:"default",variant:["solid","bordered","light"],class:{tab:"data-[selected=true]:bg-default data-[selected=true]:text-default-foreground"}},{disableAnimation:!0,color:"primary",variant:["solid","bordered","light"],class:{tab:"data-[selected=true]:bg-primary data-[selected=true]:text-primary-foreground"}},{disableAnimation:!0,color:"secondary",variant:["solid","bordered","light"],class:{tab:"data-[selected=true]:bg-secondary data-[selected=true]:text-secondary-foreground"}},{disableAnimation:!0,color:"success",variant:["solid","bordered","light"],class:{tab:"data-[selected=true]:bg-success data-[selected=true]:text-success-foreground"}},{disableAnimation:!0,color:"warning",variant:["solid","bordered","light"],class:{tab:"data-[selected=true]:bg-warning data-[selected=true]:text-warning-foreground"}},{disableAnimation:!0,color:"danger",variant:["solid","bordered","light"],class:{tab:"data-[selected=true]:bg-danger data-[selected=true]:text-danger-foreground"}},{disableAnimation:!0,color:"default",variant:"underlined",class:{tab:"data-[selected=true]:after:bg-foreground"}},{disableAnimation:!0,color:"primary",variant:"underlined",class:{tab:"data-[selected=true]:after:bg-primary"}},{disableAnimation:!0,color:"secondary",variant:"underlined",class:{tab:"data-[selected=true]:after:bg-secondary"}},{disableAnimation:!0,color:"success",variant:"underlined",class:{tab:"data-[selected=true]:after:bg-success"}},{disableAnimation:!0,color:"warning",variant:"underlined",class:{tab:"data-[selected=true]:after:bg-warning"}},{disableAnimation:!0,color:"danger",variant:"underlined",class:{tab:"data-[selected=true]:after:bg-danger"}}],compoundSlots:[{variant:"underlined",slots:["tab","tabList","cursor"],class:["rounded-none"]}]}),T=a(90170),_=a(14214);function R(e,t){let a=null;if(e){var r,l,s,n;for(a=e.getFirstKey();null!=a&&(t.has(a)||(null===(l=e.getItem(a))||void 0===l?void 0:null===(r=l.props)||void 0===r?void 0:r.isDisabled))&&a!==e.getLastKey();)a=e.getKeyAfter(a);null!=a&&(t.has(a)||(null===(n=e.getItem(a))||void 0===n?void 0:null===(s=n.props)||void 0===s?void 0:s.isDisabled))&&a===e.getLastKey()&&(a=e.getFirstKey())}return a}class F{getKeyLeftOf(e){return this.flipDirection?this.getNextKey(e):this.getPreviousKey(e)}getKeyRightOf(e){return this.flipDirection?this.getPreviousKey(e):this.getNextKey(e)}isDisabled(e){var t,a;return this.disabledKeys.has(e)||!!(null===(a=this.collection.getItem(e))||void 0===a?void 0:null===(t=a.props)||void 0===t?void 0:t.isDisabled)}getFirstKey(){let e=this.collection.getFirstKey();return null!=e&&this.isDisabled(e)&&(e=this.getNextKey(e)),e}getLastKey(){let e=this.collection.getLastKey();return null!=e&&this.isDisabled(e)&&(e=this.getPreviousKey(e)),e}
1getKeyAbove(e){return this.tabDirection?null:this.getPreviousKey(e)}getKeyBelow(e){return this.tabDirection?null:this.getNextKey(e)}getNextKey(e){do null==(e=this.collection.getKeyAfter(e))&&(e=this.collection.getFirstKey());while(this.isDisabled(e));return e}getPreviousKey(e){do null==(e=this.collection.getKeyBefore(e))&&(e=this.collection.getLastKey());while(this.isDisabled(e));return e}constructor(e,t,a,r=new Set){this.collection=e,this.flipDirection="rtl"===t&&"horizontal"===a,this.disabledKeys=r,this.tabDirection="horizontal"===a}}var M=a(34801),O=a(48099),L=a(19768),B=a(64142),U=(0,r.Gp)(function(e,t){let{Component:a,values:o,state:c,destroyInactiveTabPanel:u,getBaseProps:g,getTabListProps:x,getWrapperProps:f}=function(e){var t,a,o;let c=(0,I.w)(),[u,p]=(0,r.oe)(e,D.variantKeys),{ref:m,as:g,className:x,classNames:f,children:y,disableCursorAnimation:v,motionProps:b,isVertical:w=!1,shouldSelectOnPressUp:j=!0,destroyInactiveTabPanel:k=!0,...N}=u,E=g||"div",C="string"==typeof E,S=(0,l.gy)(m),A=null!=(a=null!=(t=null==e?void 0:e.disableAnimation)?t:null==c?void 0:c.disableAnimation)&&a,P=function(e){var t,a;let r=(0,_.B)({...e,suppressTextValueWarning:!0,defaultSelectedKey:null!==(a=null!==(t=e.defaultSelectedKey)&&void 0!==t?t:R(e.collection,e.disabledKeys?new Set(e.disabledKeys):new Set))&&void 0!==a?a:void 0}),{selectionManager:l,collection:s,selectedKey:n}=r,i=(0,T.useRef)(n);return(0,T.useEffect)(()=>{let e=n;(l.isEmpty||null==e||!s.getItem(e))&&null!=(e=R(s,r.disabledKeys))&&l.setSelectedKeys([e]),(null==e||null!=l.focusedKey)&&(l.isFocused||e===i.current)||l.setFocusedKey(e),i.current=e}),{...r,isDisabled:e.isDisabled||!1}}({children:y,...N}),{tabListProps:B}=function(e,t,a){let{orientation:r="horizontal",keyboardActivation:l="automatic"}=e,{collection:s,selectionManager:o,disabledKeys:c}=t,{direction:u}=(0,O.j)(),p=(0,T.useMemo)(()=>new F(s,u,r,c),[s,c,r,u]),{collectionProps:m}=(0,L.g)({ref:a,selectionManager:o,keyboardDelegate:p,selectOnFocus:"automatic"===l,disallowEmptySelection:!0,scrollRef:a,linkBehavior:"selection"}),g=(0,M.Me)();i.set(t,g);let h=(0,d.b)({...e,id:g});return{tabListProps:{...(0,n.d)(m,h),role:"tablist","aria-orientation":r,tabIndex:void 0}}}(N,P,S),U=(0,T.useMemo)(()=>D({...p,disableAnimation:A,...w?{placement:"start"}:{}}),[(0,s.Xx)(p),A,w]),Z=(0,s.Wy)(null==f?void 0:f.base,x),z=(0,T.useMemo)(()=>({state:P,slots:U,classNames:f,motionProps:b,disableAnimation:A,listRef:S,shouldSelectOnPressUp:j,disableCursorAnimation:v,isDisabled:null==e?void 0:e.isDisabled}),[P,U,S,b,A,v,j,null==e?void 0:e.isDisabled,f]),q=(0,T.useCallback)(e=>({"data-slot":"base",className:U.base({class:(0,s.Wy)(Z,null==e?void 0:e.className)}),...(0,n.d)((0,h.z)(N,{enabled:C}),e)}),[Z,N,U]),K=null!=(o=p.placement)?o:w?"start":"top",G=(0,T.useCallback)(e=>({"data-slot":"tabWrapper",className:U.tabWrapper({class:(0,s.Wy)(null==f?void 0:f.tabWrapper,null==e?void 0:e.className)}),"data-placement":K,"data-vertical":w||"start"===K||"end"===K?"vertical":"horizontal"}),[f,U,K,w]),W=(0,T.useCallback)(e=>({ref:S,"data-slot":"tabList",className:U.tabList({class:(0,s.Wy)(null==f?void 0:f.tabList,null==e?void 0:e.className)}),...(0,n.d)(B,e)}),[S,B,f,U]);return{Component:E,domRef:S,state:P,values:z,destroyInactiveTabPanel:k,getBaseProps:q,getTabListProps:W,getWrapperProps:G}}({...e,ref:t}),y=(0,T.useId)(),v=!e.disableAnimation&&!e.disableCursorAnimation,b={state:c,listRef:o.listRef,slots:o.slots,classNames:o.classNames,isDisabled:o.isDisabled,motionProps:o.motionProps,disableAnimation:o.disableAnimation,shouldSelectOnPressUp:o.shouldSelectOnPressUp,disableCursorAnimation:o.disableCursorAnimation},w=[...c.collection].map(e=>(0,p.jsx)(C,{item:e,...b,...e.props},e.key)),j=(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{...g(),children:(0,p.jsx)(a,{...x(),children:v?(0,p.jsx)(B.S,{id:y,children:w}):w})}),[...c.collection].map(e=>(0,p.jsx)(m,{classNames:o.classNames,destroyInactiveTabPanel:u,slots:o.slots,state:o.state,tabKey:e.key},e.key))]});return"placement"in e||"isVertical"in e?(0,p.jsx)("div",{...f(),children:j}):j})},51835:function(e,t,a){"use strict";a.d(t,{r:function(){return r}});var r=a(92481).c},13241:function(e,t,a){"use strict";a.d(t,{X:function(){return u}});var r=a(67646),l=a(74503),s=a(44227),n=a(90170);let i=!1,o=0;function d(e){"touch"===e.pointerType&&(i=!0,setTimeout(()=>{i=!1},50))}function c(){if("undefined"!=typeof document)return 0===o&&"undefined"!=typeof PointerEvent&&document.addEventListener("pointerup",d),o++,()=>{--o>0||"undefined"==typeof PointerEvent||document.removeEventListener("pointerup",d)}}function u(e){let{onHoverStart:t,onHoverChange:a,onHoverEnd:o,isDisabled:d}
1=e,[u,p]=(0,n.useState)(!1),m=(0,n.useRef)({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;(0,n.useEffect)(c,[]);let{addGlobalListener:g,removeAllGlobalListeners:h}=(0,r.x)(),{hoverProps:x,triggerHoverEnd:f}=(0,n.useMemo)(()=>{let e=(e,n)=>{if(m.pointerType=n,d||"touch"===n||m.isHovered||!(0,l.bE)(e.currentTarget,(0,l.NI)(e)))return;m.isHovered=!0;let i=e.currentTarget;m.target=i,g((0,s.r3)((0,l.NI)(e)),"pointerover",e=>{m.isHovered&&m.target&&!(0,l.bE)(m.target,(0,l.NI)(e))&&r(e,e.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:i,pointerType:n}),a&&a(!0),p(!0)},r=(e,t)=>{let r=m.target;m.pointerType="",m.target=null,"touch"!==t&&m.isHovered&&r&&(m.isHovered=!1,h(),o&&o({type:"hoverend",target:r,pointerType:t}),a&&a(!1),p(!1))},n={};return"undefined"!=typeof PointerEvent&&(n.onPointerEnter=t=>{i&&"mouse"===t.pointerType||e(t,t.pointerType)},n.onPointerLeave=e=>{!d&&(0,l.bE)(e.currentTarget,(0,l.NI)(e))&&r(e,e.pointerType)}),{hoverProps:n,triggerHoverEnd:r}},[t,a,o,d,m,g,h]);return(0,n.useEffect)(()=>{d&&f({currentTarget:m.target},m.pointerType)},[d]),{hoverProps:x,isHovered:u}}},77654:function(e,t,a){"use strict";a.d(t,{gb:function(){return s},xQ:function(){return l}});let r=null;function l(e,t="assertive",a=7e3){r?r.announce(e,t,a):(r=new n,("boolean"==typeof IS_REACT_ACT_ENVIRONMENT?IS_REACT_ACT_ENVIRONMENT:"undefined"!=typeof jest)?r.announce(e,t,a):setTimeout(()=>{(null==r?void 0:r.isAttached())&&(null==r||r.announce(e,t,a))},100))}function s(e){r&&r.clear(e)}class n{isAttached(){var e;return null===(e=this.node)||void 0===e?void 0:e.isConnected}createLog(e){let t=document.createElement("div");return t.setAttribute("role","log"),t.setAttribute("aria-live",e),t.setAttribute("aria-relevant","additions"),t}destroy(){this.node&&(document.body.removeChild(this.node),this.node=null)}announce(e,t="assertive",a=7e3){var r,l;if(!this.node)return;let s=document.createElement("div");"object"==typeof e?(s.setAttribute("role","img"),s.setAttribute("aria-labelledby",e["aria-labelledby"])):s.textContent=e,"assertive"===t?null===(r=this.assertiveLog)||void 0===r||r.appendChild(s):null===(l=this.politeLog)||void 0===l||l.appendChild(s),""!==e&&setTimeout(()=>{s.remove()},a)}clear(e){this.node&&((!e||"assertive"===e)&&this.assertiveLog&&(this.assertiveLog.innerHTML=""),(!e||"polite"===e)&&this.politeLog&&(this.politeLog.innerHTML=""))}constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,"undefined"!=typeof document&&(this.node=document.createElement("div"),this.node.dataset.liveAnnouncer="true",Object.assign(this.node.style,{border:0,clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"}),this.assertiveLog=this.createLog("assertive"),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog("polite"),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}}},28500:function(e,t,a){"use strict";a.d(t,{Bc:function(){return r.U},D_:function(){return r.W},Fu:function(){return r.X},Ln:function(){return r.R},Sf:function(){return r.S},Xx:function(){return r.Q},Z0:function(){return r.Y}});var r=a(73971)},64142:function(e,t,a){"use strict";a.d(t,{S:function(){return p}});var r=a(39696),l=a(90170),s=a(76418);let n=(0,l.createContext)(null);var i=a(61834),o=a(78735);let d=e=>!e.isLayoutDirty&&e.willUpdate(!1),c=e=>!0===e,u=e=>c(!0===e)||"id"===e,p=({children:e,id:t,inherit:a=!0})=>{let p=(0,l.useContext)(s.p),m=(0,l.useContext)(n),[g,h]=function(){let e=function(){let e=(0,l.useRef)(!1);return(0,o.L)(()=>(e.current=!0,()=>{e.current=!1}),[]),e}(),[t,a]=(0,l.useState)(0),r=(0,l.useCallback)(()=>{e.current&&a(t+1)},[t]);return[(0,l.useCallback)(()=>i.Wi.postRender(r),[r]),t]}(),x=(0,l.useRef)(null),f=p.id||m;null===x.current&&(u(a)&&f&&(t=t?f+"-"+t:f),x.current={id:t,group:c(a)&&p.group||function(){let e=new Set,t=new WeakMap,a=()=>e.forEach(d);return{add:r=>{e.add(r),t.set(r,r.addEventListener("willUpdate",a))},remove:r=>{e.delete(r);let l=t.get(r);l&&(l(),t.delete(r)),a()},dirty:a}}()});let y=(0,l.useMemo)(()=>({...x.current,forceRender:g}),[h]);return(0,r.jsx)(s.p.Provider,{value:y,children:e})}},98230:function(e,t,a){"use strict";a.d(t,{p:function(){return n}});var r=a(87392),l=a(24333),s=a(90170);
1function n(e,t){let a=t?.isDisabled,[n,i]=(0,s.useState)(!1);return(0,l.b)(()=>{if(e?.current&&!a){let t=()=>{e.current&&i(!!(0,r.QL)(e.current,{tabbable:!0}).nextNode())};t();let a=new MutationObserver(t);return a.observe(e.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{a.disconnect()}}}),!a&&n}},16001:function(e,t,a){"use strict";a.d(t,{y:function(){return s}});var r=a(45177),l=a(90170);function s(e,t,a){let s=(0,r.i)(e=>{a&&!e.defaultPrevented&&a(t)});(0,l.useEffect)(()=>{let t=e?.current?.form;return t?.addEventListener("reset",s),()=>{t?.removeEventListener("reset",s)}},[e])}},47369:function(e,t,a){"use strict";a.d(t,{Y:function(){return r}});class r extends Set{constructor(e,t,a){super(e),e instanceof r?(this.anchorKey=t??e.anchorKey,this.currentKey=a??e.currentKey):(this.anchorKey=t??null,this.currentKey=a??null)}}},31062:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});var r=a(44869),l=a(47369);class s{constructor(e,t,a){this.collection=e,this.state=t,this.allowsCellSelection=a?.allowsCellSelection??!1,this._isSelectAll=null,this.layoutDelegate=a?.layoutDelegate||null,this.fullCollection=a?.fullCollection||null}get selectionMode(){return this.state.selectionMode}get disallowEmptySelection(){return this.state.disallowEmptySelection}get selectionBehavior(){return this.state.selectionBehavior}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}get isFocused(){return this.state.isFocused}setFocused(e){this.state.setFocused(e)}get focusedKey(){return this.state.focusedKey}get childFocusStrategy(){return this.state.childFocusStrategy}setFocusedKey(e,t){(null==e||this.collection.getItem(e))&&this.state.setFocusedKey(e,t)}get selectedKeys(){return"all"===this.state.selectedKeys?new Set(this.getSelectAllKeys()):this.state.selectedKeys}get rawSelection(){return this.state.selectedKeys}isSelected(e){if("none"===this.state.selectionMode)return!1;let t=this.getKey(e);return null!=t&&("all"===this.state.selectedKeys?this.canSelectItem(t):this.state.selectedKeys.has(t))}get isEmpty(){return"all"!==this.state.selectedKeys&&0===this.state.selectedKeys.size}get isSelectAll(){if(this.isEmpty)return!1;if("all"===this.state.selectedKeys)return!0;if(null!=this._isSelectAll)return this._isSelectAll;let e=this.getSelectAllKeys(),t=this.state.selectedKeys;return this._isSelectAll=e.every(e=>t.has(e)),this._isSelectAll}get firstSelectedKey(){let e=null;for(let t of this.state.selectedKeys){let a=this.collection.getItem(t);(!e||a&&0>(0,r.eg)(this.collection,a,e))&&(e=a)}return e?.key??null}get lastSelectedKey(){let e=null;for(let t of this.state.selectedKeys){let a=this.collection.getItem(t);(!e||a&&(0,r.eg)(this.collection,a,e)>0)&&(e=a)}return e?.key??null}get disabledKeys(){return this.state.disabledKeys}get disabledBehavior(){return this.state.disabledBehavior}extendSelection(e){let t;if("none"===this.selectionMode)return;if("single"===this.selectionMode){this.replaceSelection(e);return}let a=this.getKey(e);if(null!=a){if("all"===this.state.selectedKeys)t=new l.Y([a],a,a);else{let e=this.state.selectedKeys,r=e.anchorKey??a;for(let s of(t=new l.Y(e,r,a),this.getKeyRange(r,e.currentKey??a)))t.delete(s);for(let e of this.getKeyRange(a,r))this.canSelectItem(e)&&t.add(e)}this.state.setSelectedKeys(t)}}getKeyRange(e,t){let a=this.collection.getItem(e),l=this.collection.getItem(t);return a&&l?0>=(0,r.eg)(this.collection,a,l)?this.getKeyRangeInternal(e,t):this.getKeyRangeInternal(t,e):[]}getKeyRangeInternal(e,t){if(this.layoutDelegate?.getKeyRange)return this.layoutDelegate.getKeyRange(e,t);let a=[],r=e;for(;null!=r;){let e=this.collection.getItem(r);if(e&&("item"===e.type||"cell"===e.type&&this.allowsCellSelection)&&a.push(r),r===t)return a;r=this.collection.getKeyAfter(r)}return[]}getKey(e){let t=this.collection.getItem(e);if(!t||"cell"===t.type&&this.allowsCellSelection)return e;for(;t&&"item"!==t.type&&null!=t.parentKey;)t=this.collection.getItem(t.parentKey);return t&&"item"===t.type?t.key:null}toggleSelection(e){if("none"===this.selectionMode)return;if("single"===this.selectionMode&&!this.isSelected(e)){this.replaceSelection(e);return}let t=this.getKey(e);if(null==t)return;
1let a=new l.Y("all"===this.state.selectedKeys?this.getSelectAllKeys():this.state.selectedKeys);a.has(t)?a.delete(t):this.canSelectItem(t)&&(a.add(t),a.anchorKey=t,a.currentKey=t),this.disallowEmptySelection&&0===a.size||this.state.setSelectedKeys(a)}replaceSelection(e){if("none"===this.selectionMode)return;let t=this.getKey(e);if(null==t)return;let a=this.canSelectItem(t)?new l.Y([t],t,t):new l.Y;this.state.setSelectedKeys(a)}setSelectedKeys(e){if("none"===this.selectionMode)return;let t=new l.Y;for(let a of e){let e=this.getKey(a);if(null!=e&&(t.add(e),"single"===this.selectionMode))break}this.state.setSelectedKeys(t)}getSelectAllKeys(){let e=this.fullCollection??this.collection,t=[],a=l=>{for(;null!=l;){if(this.canSelectItemIn(l,e)){let s=e.getItem(l);s?.type==="item"&&t.push(l),s?.hasChildNodes&&(this.allowsCellSelection||"item"!==s.type)&&a(r.l8(r._P(s,e))?.key??null)}l=e.getKeyAfter(l)}};return a(e.getFirstKey()),t}selectAll(){this.isSelectAll||"multiple"!==this.selectionMode||this.state.setSelectedKeys("all")}clearSelection(){!this.disallowEmptySelection&&("all"===this.state.selectedKeys||this.state.selectedKeys.size>0)&&this.state.setSelectedKeys(new l.Y)}toggleSelectAll(){this.isSelectAll?this.clearSelection():this.selectAll()}select(e,t){"none"!==this.selectionMode&&("single"===this.selectionMode?this.isSelected(e)&&!this.disallowEmptySelection?this.toggleSelection(e):this.replaceSelection(e):"toggle"===this.selectionBehavior||t&&("touch"===t.pointerType||"virtual"===t.pointerType)?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys)return!0;let t=this.selectedKeys;if(e.size!==t.size)return!1;for(let a of e)if(!t.has(a))return!1;for(let a of t)if(!e.has(a))return!1;return!0}canSelectItem(e){return this.canSelectItemIn(e,this.collection)}canSelectItemIn(e,t){if("none"===this.state.selectionMode||this.state.disabledKeys.has(e))return!1;let a=t.getItem(e);return!(!a||a?.props?.isDisabled)&&("cell"!==a.type||!!this.allowsCellSelection)}isDisabled(e){let t=this.collection.getItem(e);return"all"===this.state.disabledBehavior&&(this.state.disabledKeys.has(e)||!!t?.props?.isDisabled)&&t?.props?.disabledBehavior!=="selection"}isLink(e){return!!this.collection.getItem(e)?.props?.href}getItemProps(e){return this.collection.getItem(e)?.props}withCollection(e){return new s(e,this.state,{allowsCellSelection:this.allowsCellSelection,layoutDelegate:this.layoutDelegate||void 0,fullCollection:this.fullCollection??this.collection})}}},7165:function(e,t,a){"use strict";a.d(t,{q:function(){return n}});var r=a(47369),l=a(59442),s=a(90170);function n(e){let{selectionMode:t="none",disallowEmptySelection:a=!1,allowDuplicateSelectionEvents:n,selectionBehavior:o="toggle",disabledBehavior:d="all"}=e,c=(0,s.useRef)(!1),[,u]=(0,s.useState)(!1),p=(0,s.useRef)(null),m=(0,s.useRef)(null),[,g]=(0,s.useState)(null),h=(0,s.useMemo)(()=>i(e.selectedKeys),[e.selectedKeys]),x=(0,s.useMemo)(()=>i(e.defaultSelectedKeys,new r.Y),[e.defaultSelectedKeys]),[f,y]=(0,l.z)(h,x,e.onSelectionChange),v=(0,s.useMemo)(()=>e.disabledKeys?new Set(e.disabledKeys):new Set,[e.disabledKeys]),[b,w]=(0,s.useState)(o);"replace"===o&&"toggle"===b&&"object"==typeof f&&0===f.size&&w("replace");let j=(0,s.useRef)(o);return(0,s.useEffect)(()=>{o!==j.current&&(w(o),j.current=o)},[o]),{selectionMode:t,disallowEmptySelection:a,selectionBehavior:b,setSelectionBehavior:w,get isFocused(){return c.current},setFocused(e){c.current=e,u(e)},get focusedKey(){return p.current},get childFocusStrategy(){return m.current},setFocusedKey(e,t="first"){p.current=e,m.current=t,g(e)},selectedKeys:f,setSelectedKeys(e){(n||!function(e,t){if(e.size!==t.size)return!1;for(let a of e)if(!t.has(a))return!1;return!0}(e,f))&&y(e)},disabledKeys:v,disabledBehavior:d}}function i(e,t){return e?"all"===e?"all":new r.Y(e):t}},90185:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});let r=e=>"object"==typeof e&&null!=e&&1===e.nodeType,l=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,s=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let a=getComputedStyle(e,null);
1return l(a.overflowY,t)||l(a.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},n=(e,t,a,r,l,s,n,i)=>s<e&&n>t||s>e&&n<t?0:s<=e&&i<=a||n>=t&&i>=a?s-e-r:n>t&&i<a||s<e&&i>a?n-t+l:0,i=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},o=(e,t)=>{var a,l,o,d;if("undefined"==typeof document)return[];let{scrollMode:c,block:u,inline:p,boundary:m,skipOverflowHiddenElements:g}=t,h="function"==typeof m?m:e=>e!==m;if(!r(e))throw TypeError("Invalid target");let x=document.scrollingElement||document.documentElement,f=[],y=e;for(;r(y)&&h(y);){if((y=i(y))===x){f.push(y);break}null!=y&&y===document.body&&s(y)&&!s(document.documentElement)||null!=y&&s(y,g)&&f.push(y)}let v=null!=(l=null==(a=window.visualViewport)?void 0:a.width)?l:innerWidth,b=null!=(d=null==(o=window.visualViewport)?void 0:o.height)?d:innerHeight,{scrollX:w,scrollY:j}=window,{height:k,width:N,top:E,right:C,bottom:I,left:S}=e.getBoundingClientRect(),{top:A,right:P,bottom:D,left:T}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),_="start"===u||"nearest"===u?E-A:"end"===u?I+D:E+k/2-A+D,R="center"===p?S+N/2-T+P:"end"===p?C+P:S-T,F=[];for(let e=0;e<f.length;e++){let t=f[e],{height:a,width:r,top:l,right:i,bottom:o,left:d}=t.getBoundingClientRect();if("if-needed"===c&&E>=0&&S>=0&&I<=b&&C<=v&&(t===x&&!s(t)||E>=l&&I<=o&&S>=d&&C<=i))break;let m=getComputedStyle(t),g=parseInt(m.borderLeftWidth,10),h=parseInt(m.borderTopWidth,10),y=parseInt(m.borderRightWidth,10),A=parseInt(m.borderBottomWidth,10),P=0,D=0,T="offsetWidth"in t?t.offsetWidth-t.clientWidth-g-y:0,M="offsetHeight"in t?t.offsetHeight-t.clientHeight-h-A:0,O="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,L="offsetHeight"in t?0===t.offsetHeight?0:a/t.offsetHeight:0;if(x===t)P="start"===u?_:"end"===u?_-b:"nearest"===u?n(j,j+b,b,h,A,j+_,j+_+k,k):_-b/2,D="start"===p?R:"center"===p?R-v/2:"end"===p?R-v:n(w,w+v,v,g,y,w+R,w+R+N,N),P=Math.max(0,P+j),D=Math.max(0,D+w);else{P="start"===u?_-l-h:"end"===u?_-o+A+M:"nearest"===u?n(l,o,a,h,A+M,_,_+k,k):_-(l+a/2)+M/2,D="start"===p?R-d-g:"center"===p?R-(d+r/2)+T/2:"end"===p?R-i+y+T:n(d,i,r,g,y+T,R,R+N,N);let{scrollLeft:e,scrollTop:s}=t;P=0===L?0:Math.max(0,Math.min(s+P/L,t.scrollHeight-a/L+M)),D=0===O?0:Math.max(0,Math.min(e+D/O,t.scrollWidth-r/O+T)),_+=s-P,R+=e-D}F.push({el:t,top:P,left:D})}return F},d=e=>!1===e?{block:"end",inline:"nearest"}:e===Object(e)&&0!==Object.keys(e).length?e:{block:"start",inline:"nearest"};function c(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(o(e,t));let a="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:r,top:l,left:s}of o(e,d(t)))r.scroll({top:l,left:s,behavior:a})}},32162:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(27596).Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},17305:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(27596).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},2374:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(27596).Z)("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]])},87375:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(27596).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},31749:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(27596).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},55852:function(e,t,a){"use strict";a.d(t,{w_:function(){return c}});var r=a(90170),l={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},s=r.createContext&&r.createContext(l),n=["attr","size","title"];function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e}).apply(this,arguments)}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function d(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};
1t%2?o(Object(a),!0).forEach(function(t){var r,l;r=t,l=a[t],(r=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var r=a.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(r))in e?Object.defineProperty(e,r,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[r]=l}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function c(e){return t=>r.createElement(u,i({attr:d({},e.attr)},t),function e(t){return t&&t.map((t,a)=>r.createElement(t.tag,d({key:a},t.attr),e(t.child)))}(e.child))}function u(e){var t=t=>{var a,{attr:l,size:s,title:o}=e,c=function(e,t){if(null==e)return{};var a,r,l=function(e,t){if(null==e)return{};var a={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;a[r]=e[r]}return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)a=s[r],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}(e,n),u=s||t.size||"1em";return t.className&&(a=t.className),e.className&&(a=(a?a+" ":"")+e.className),r.createElement("svg",i({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,l,c,{className:a,style:d(d({color:e.color||t.color},t.style),e.style),height:u,width:u,xmlns:"http://www.w3.org/2000/svg"}),o&&r.createElement("title",null,o),e.children)};return void 0!==s?r.createElement(s.Consumer,null,e=>t(e)):t(l)}}},function(e){e.O(0,[5704,2788,3086,8314,2826,768,2241,1951,2004,2324,5464,4285,6380,5143,1472,9591,7829,2015,4644,2045,1347,2278,6179,7410,2929,3663,7747,5054,7120,8747,4310,4340,813,2972,9194,7397,1765,3132,6358,2858,5436,8163,7593,3850,3894,4810,8242,2365,8799,5845,1669,2937,5793,304,6546,9998,8508,4351,6507,654,2888,9774,179],function(){return e(e.s=31186)}),_N_E=e.O()}]);
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.