@acedatacloud/nexior 3.329.8 → 3.329.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/dist/assets/{ApiCodeButton-BC32HjSV.js → ApiCodeButton-DGspQCne.js} +1 -1
  2. package/dist/assets/{Artifacts-DKjKyVdv.js → Artifacts-RXKnwjz-.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-DgLFPwAH.js → AskUserQuestionCard-COBORalu.js} +1 -1
  4. package/dist/assets/{AudioPreview-CYOTie5B.js → AudioPreview-Cjm1qjl_.js} +1 -1
  5. package/dist/assets/{Auth-vOCuM3sW.js → Auth-D_0zDgEA.js} +1 -1
  6. package/dist/assets/{Bare-BLRzSK2o.js → Bare-CmKvjYfD.js} +1 -1
  7. package/dist/assets/{BotPlaceholder-DUmSXjV2.js → BotPlaceholder-BaGJrvP1.js} +1 -1
  8. package/dist/assets/{BottomFooter-BpymEQVl.js → BottomFooter-CKgJfxEA.js} +1 -1
  9. package/dist/assets/{Callback-DzahET-v.js → Callback-BlyfdYEO.js} +1 -1
  10. package/dist/assets/{CodeSnippet-CPDNiEq_.js → CodeSnippet-BNeYfLCp.js} +1 -1
  11. package/dist/assets/{Console-BOrFPPzU.js → Console-CcydTGpJ.js} +1 -1
  12. package/dist/assets/{Consumption-CT3vH0XB.js → Consumption-DAfEEkV0.js} +1 -1
  13. package/dist/assets/{Conversation-Cl7iqFoS.js → Conversation-B-nNF1fN.js} +1 -1
  14. package/dist/assets/Conversation-C4sGCl5z.js +1 -0
  15. package/dist/assets/Conversation-GNsnGM3x.css +1 -0
  16. package/dist/assets/{CopyToClipboard-CiHwDWdZ.js → CopyToClipboard-BBWmrDvx.js} +1 -1
  17. package/dist/assets/{Detail-BegLPabI.js → Detail-DdT5mRu_.js} +2 -2
  18. package/dist/assets/Extra-DcQ1OySr.js +1 -0
  19. package/dist/assets/{FilePreview-DEU6ICRQ.js → FilePreview-BfotHNC4.js} +1 -1
  20. package/dist/assets/{Hailuo-CjfNaPT0.js → Hailuo-CZRm6RCv.js} +1 -1
  21. package/dist/assets/{History-DngH5FP5.js → History-Cs9BEzo-.js} +1 -1
  22. package/dist/assets/{ImagePreview-B4O2PRej.js → ImagePreview-CJE56Esk.js} +1 -1
  23. package/dist/assets/{ImageWrapper-BiOnDKop.js → ImageWrapper-BtiRJPKW.js} +1 -1
  24. package/dist/assets/{Index-aWPm-ng8.js → Index-7MtLTvjs.js} +1 -1
  25. package/dist/assets/Index-BV4xpBOc.js +1 -0
  26. package/dist/assets/{Index-CGJQfE4Z.js → Index-BZ9gj6Xn.js} +1 -1
  27. package/dist/assets/{Index-BtlQm_Cq.js → Index-BaB2aoIe.js} +1 -1
  28. package/dist/assets/{Index-CFifY2bK.js → Index-BsTGoTOb.js} +1 -1
  29. package/dist/assets/Index-C6Co5Kut.js +1 -0
  30. package/dist/assets/{Index-CwxbCBoy.js → Index-CA6YJz_v.js} +1 -1
  31. package/dist/assets/Index-CDEvbKHV.js +1 -0
  32. package/dist/assets/{Index-TAN1SpTZ.js → Index-CDxBVpsY.js} +1 -1
  33. package/dist/assets/{Index-BAD2iNtB.js → Index-CGnqaYNC.js} +1 -1
  34. package/dist/assets/Index-CQM6690b.js +1 -0
  35. package/dist/assets/{Index-Dy97mY59.js → Index-CZmNN4i1.js} +1 -1
  36. package/dist/assets/Index-CryhzamZ.js +1 -0
  37. package/dist/assets/{Index-FfT-_vse.js → Index-D6Q0LttT.js} +1 -1
  38. package/dist/assets/Index-DDhRsq4R.js +1 -0
  39. package/dist/assets/{Index-DMkRaBFe.js → Index-DK90Vi58.js} +1 -1
  40. package/dist/assets/Index-DQi--MMP.js +1 -0
  41. package/dist/assets/{Index-CcQkzKjn.js → Index-Defu1fwa.js} +1 -1
  42. package/dist/assets/Index-DgqMnF2y.js +1 -0
  43. package/dist/assets/Index-DicjREs3.js +1 -0
  44. package/dist/assets/{Index-CYtGvFEP.js → Index-DszBfAn2.js} +1 -1
  45. package/dist/assets/{Index-CPXKL37O.js → Index-IIQ7wZGt.js} +1 -1
  46. package/dist/assets/Index-QdgQQNW5.js +1 -0
  47. package/dist/assets/{Index-WmNKfsdM.js → Index-TRnL3KT5.js} +1 -1
  48. package/dist/assets/{Index-BLGgpppK.js → Index-Z9JugP_K.js} +1 -1
  49. package/dist/assets/{Index-B348_0Av.js → Index-kSViP_56.js} +1 -1
  50. package/dist/assets/{Index-Dj6rD-h9.js → Index-nGN1vbE9.js} +2 -2
  51. package/dist/assets/Index-qF_2Wd2g.js +1 -0
  52. package/dist/assets/{Index-BSX0w4s6.js → Index-s7PR3dRx.js} +1 -1
  53. package/dist/assets/{Invitees-XvsN9WG8.js → Invitees-DMaKAFFe.js} +1 -1
  54. package/dist/assets/{List-BSneSpYi.js → List-Br6k9Tp2.js} +1 -1
  55. package/dist/assets/{List-BOLSl8AG.js → List-D9NiHTVi.js} +1 -1
  56. package/dist/assets/{List-C0ct-UNl.js → List-Dio8PztR.js} +1 -1
  57. package/dist/assets/{LocalTools-BpwlqKpV.js → LocalTools-BOuWVt4R.js} +3 -3
  58. package/dist/assets/{LocalTools-D5KzgZVz.js → LocalTools-IIO7ueaX.js} +1 -1
  59. package/dist/assets/{Main-FuO2EmFv.js → Main-BTQgtI8x.js} +1 -1
  60. package/dist/assets/{Message-DI74tn-I.js → Message-ByAPJsqV.js} +2 -2
  61. package/dist/assets/Model-B7XvGVyC.js +1 -0
  62. package/dist/assets/{Navigator-Cr7IDsuj.js → Navigator-DT2XnYO4.js} +4 -4
  63. package/dist/assets/{NotFound-BJrXFgLI.js → NotFound-D9CtRxnj.js} +1 -1
  64. package/dist/assets/{Pay-ChGMaC09.js → Pay-B49jlRB6.js} +1 -1
  65. package/dist/assets/{Player-DawP26dK.js → Player-DtaH2oxS.js} +1 -1
  66. package/dist/assets/{PromptTextarea-BPxTMTZS.js → PromptTextarea-CvdjJhVh.js} +1 -1
  67. package/dist/assets/{RealtimeCall-C2sYc4L3.js → RealtimeCall-DgEYevkE.js} +1 -1
  68. package/dist/assets/{ScheduledTasks-B8Mo88-w.js → ScheduledTasks-CHzGAdeZ.js} +2 -2
  69. package/dist/assets/{Status-CPxTYJd0.js → Status-CzWTm_Li.js} +1 -1
  70. package/dist/assets/{Subscribe-BB8OH0tw.js → Subscribe-CWKKvBDQ.js} +1 -1
  71. package/dist/assets/{TabSwitcher-1O3pcZtC.js → TabSwitcher-C--QwGKY.js} +1 -1
  72. package/dist/assets/Tts-BVKd4aF_.js +1 -0
  73. package/dist/assets/{VideoPlayer-Dj55QgnI.js → VideoPlayer-BUBn3OUd.js} +1 -1
  74. package/dist/assets/{alert-wKUpquj9.js → alert-Dwk1cmIg.js} +1 -1
  75. package/dist/assets/avatar-AYT20WXS.js +1 -0
  76. package/dist/assets/{basic-DfgM6j1x.js → basic-CNJQ-9s3.js} +1 -1
  77. package/dist/assets/{chat-C23vBUtj.js → chat-c--oyizg.js} +1 -1
  78. package/dist/assets/{codingBridge-CNetM0F3.js → codingBridge-DOTR5ey5.js} +2 -2
  79. package/dist/assets/{codingBridgeNotify-DiZpNxZW.js → codingBridgeNotify-C7bCny15.js} +2 -2
  80. package/dist/assets/{collapse-B2tKW5A0.js → collapse-ZEBxA-pL.js} +1 -1
  81. package/dist/assets/{createTaskActions-DviTxUyn.js → createTaskActions-BKzqp6Rg.js} +1 -1
  82. package/dist/assets/{date-picker-Bz197WP1.js → date-picker-C19ju9Cu.js} +1 -1
  83. package/dist/assets/{digitalhuman-Chk_4fO4.js → digitalhuman-B_t68ub5.js} +1 -1
  84. package/dist/assets/{drawer-DEaLiSBF.js → drawer-GvrpLfKt.js} +1 -1
  85. package/dist/assets/{dropdown-BSfFhoRR.js → dropdown-B6H-kLGb.js} +1 -1
  86. package/dist/assets/{dropdown-CsXIP4Qz.js → dropdown-D0H8nDj8.js} +1 -1
  87. package/dist/assets/{esm-n4KTwreV.js → esm-CRO50hS5.js} +1 -1
  88. package/dist/assets/{esm-aqiy0m05.js → esm-CwWjc9l7.js} +1 -1
  89. package/dist/assets/{esm-BzYzTA8B.js → esm-DTutmJIQ.js} +3 -3
  90. package/dist/assets/esm-DU4for1p.js +1 -0
  91. package/dist/assets/{esm-BoOccttv.js → esm-DVqBOzVr.js} +2 -2
  92. package/dist/assets/{esm-gi3rZ4_R.js → esm-DZ0N_cvw.js} +1 -1
  93. package/dist/assets/{esm-gE7B5HLP.js → esm-HJle8pQq.js} +2 -2
  94. package/dist/assets/fish-hr4g0eWe.js +1 -0
  95. package/dist/assets/{flux-DSBF8yCU.js → flux-W76NOA73.js} +1 -1
  96. package/dist/assets/{grokvideo-CXtpWYDx.js → grokvideo-DgFmw5pl.js} +1 -1
  97. package/dist/assets/{hailuo-D6_oVX1y.js → hailuo-CdnqAr2C.js} +1 -1
  98. package/dist/assets/{image-_L6s8L1x.js → image-YJeVEMsR.js} +1 -1
  99. package/dist/assets/{index-DCQpsPX6.js → index-CGmTZItr.js} +15 -15
  100. package/dist/assets/{index.browser.esm-C_rfaTOZ.js → index.browser.esm-DI2v96pn.js} +1 -1
  101. package/dist/assets/{index.es-BRyhJDi0.js → index.es-0UW6le61.js} +1 -1
  102. package/dist/assets/{input-number-Bvc1KjWf.js → input-number-DPRw7cDK.js} +1 -1
  103. package/dist/assets/{kling-CxHsv4mC.js → kling-CZkI90sG.js} +1 -1
  104. package/dist/assets/{luma-8GBFfWe9.js → luma-1i20mh6a.js} +1 -1
  105. package/dist/assets/{maestro--FtawBTv.js → maestro-dyyJ2NWX.js} +1 -1
  106. package/dist/assets/{midjourney-CJEkd3EZ.js → midjourney-CDNzuouA.js} +1 -1
  107. package/dist/assets/{mobileLocalExec-CemCIOTM.js → mobileLocalExec-DqvteJLq.js} +2 -2
  108. package/dist/assets/{nanobanana-C7_g306K.js → nanobanana-Ct1sWtLD.js} +1 -1
  109. package/dist/assets/{omni-Cpzd_Xsr.js → omni-BMPaSE__.js} +1 -1
  110. package/dist/assets/{openaiimage-BsnkSbOV.js → openaiimage-DLL26VcO.js} +1 -1
  111. package/dist/assets/{pagination-B2z7KdmK.js → pagination-BqJHSmW4.js} +2 -2
  112. package/dist/assets/{pagination-Dsh58R_E.js → pagination-Dp7PYsKz.js} +1 -1
  113. package/dist/assets/{sora-rEugCAh_.js → pika-DTdLDJ4M.js} +1 -1
  114. package/dist/assets/{pika-CIY8UjYC.js → pixverse-CM470Vki.js} +1 -1
  115. package/dist/assets/{popover-BfIJRbiB.js → popover-Btt3bdEi.js} +1 -1
  116. package/dist/assets/{producer-Dj7J41lF.js → producer-CtBY7zVd.js} +1 -1
  117. package/dist/assets/{qrart-CsDbA9I-.js → qrart-B-vrFWR7.js} +1 -1
  118. package/dist/assets/realtime-TBM88yF0.js +1 -0
  119. package/dist/assets/{row-CycYv6er.js → row-kgzhnw2k.js} +1 -1
  120. package/dist/assets/{seedance-Bn8qml67.js → seedance-CdPlSyGQ.js} +1 -1
  121. package/dist/assets/{seedream-XgqIJ0FY.js → seedream-BaVuQZrf.js} +1 -1
  122. package/dist/assets/{select-CFpHaJD4.js → select-BktK--V_.js} +1 -1
  123. package/dist/assets/{serp-D79voLb2.js → serp-BsQ-z0Ss.js} +1 -1
  124. package/dist/assets/{slider-DOOIN-EB.js → slider-BIxh-I1a.js} +1 -1
  125. package/dist/assets/{solana-wallets-DVL3k8o6.js → solana-wallets-hoywCK88.js} +2 -2
  126. package/dist/assets/{solana-wallets-vue-Dm97bIee.js → solana-wallets-vue-eNNjqwtC.js} +1 -1
  127. package/dist/assets/sora-Dgz5D3w-.js +1 -0
  128. package/dist/assets/{suno-CPdGGnZA.js → suno-5ouwiCcw.js} +1 -1
  129. package/dist/assets/{switch-B5F7c-ty.js → switch-CJnGNxo1.js} +1 -1
  130. package/dist/assets/{table-DkxZvfS5.js → table-CGV-Q8wK.js} +1 -1
  131. package/dist/assets/{tabs-9VZlsdBZ.js → tabs-BqkM19Q4.js} +1 -1
  132. package/dist/assets/{time-picker-DkM37cjh.js → time-picker-DIsoI1Eg.js} +1 -1
  133. package/dist/assets/{tooltip-CpPZ5Dyr.js → tooltip-CvEPotyQ.js} +1 -1
  134. package/dist/assets/{upload-CdatH6gG.js → upload-CUgJRfvf.js} +1 -1
  135. package/dist/assets/{veo-IRgb_mM8.js → veo-DNCw_zfL.js} +1 -1
  136. package/dist/assets/{wan-BaP9uCTB.js → wan-D8AaJQN-.js} +1 -1
  137. package/dist/assets/{web-C_mUTrJM.js → web-BoE-dYgh.js} +1 -1
  138. package/dist/assets/{web-DUHlBt-D.js → web-BrN1_z9O.js} +1 -1
  139. package/dist/assets/{web-zIM4SVVz.js → web-Bvvb0Lgk.js} +1 -1
  140. package/dist/assets/{web-Bhmkq_ln.js → web-C3P0phDP.js} +1 -1
  141. package/dist/assets/{web-Yjj51GzI.js → web-sQLqnMnj.js} +1 -1
  142. package/dist/assets/webextrator-CUE8PWA-.js +1 -0
  143. package/dist/index.html +1 -1
  144. package/package.json +1 -1
  145. package/dist/assets/Conversation-6STLxTT-.js +0 -1
  146. package/dist/assets/Conversation-QKrp9JQK.css +0 -1
  147. package/dist/assets/Extra-CRRuHg3i.js +0 -1
  148. package/dist/assets/Index-B3kD0AyC.js +0 -1
  149. package/dist/assets/Index-BL4vbp7H.js +0 -1
  150. package/dist/assets/Index-C2yMmwXU.js +0 -1
  151. package/dist/assets/Index-CEjRbHSf.js +0 -1
  152. package/dist/assets/Index-CXxqstXX.js +0 -1
  153. package/dist/assets/Index-Cov5tWF1.js +0 -1
  154. package/dist/assets/Index-D7wV0tY7.js +0 -1
  155. package/dist/assets/Index-Df6C3_oT.js +0 -1
  156. package/dist/assets/Index-QxSnBi8c.js +0 -1
  157. package/dist/assets/Index-oajwMfuE.js +0 -1
  158. package/dist/assets/Index-pVDjrN_f.js +0 -1
  159. package/dist/assets/Model-iINM5J6v.js +0 -1
  160. package/dist/assets/Tts-C5EdkAg_.js +0 -1
  161. package/dist/assets/avatar-C7iyOLkD.js +0 -1
  162. package/dist/assets/esm-BLeTFYxM.js +0 -1
  163. package/dist/assets/fish-q59_Fb5Z.js +0 -1
  164. package/dist/assets/pixverse-DC5a0fo9.js +0 -1
  165. package/dist/assets/realtime-ChLfOHhG.js +0 -1
  166. package/dist/assets/webextrator-BE-FHeck.js +0 -1
@@ -1 +0,0 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,S as c,T as l,at as u,bt as d,ht as f,it as p,j as m,mt as h,qt as g,rt as _,tt as v,x as y,z as b}from"./vendor-chart-Dw-P17PN.js";import{I as x,b as S,nt as C}from"./use-deprecated-B-uvyrTL.js";import{r as w,t as T}from"./select-CFpHaJD4.js";import{t as E}from"./upload-CdatH6gG.js";import{t as D}from"./image-_L6s8L1x.js";import{t as O}from"./alert-wKUpquj9.js";import{t as k}from"./drawer-DEaLiSBF.js";import{t as A}from"./input-number-Bvc1KjWf.js";import{t as j}from"./switch-B5F7c-ty.js";import{Ar as M,Br as ee,Dr as te,Hr as ne,Ir as N,Nr as P,Or as F,Rr as re,Tr as ie,jr as ae,kr as oe,zr as se}from"./constants-BC87sw1I.js";import{Cn as I,G as L,Hi as R,_i as z,_n as B,bi as V,bn as H,ji as U,jr as W,tr as G,yn as K}from"./index-DCQpsPX6.js";import{t as q}from"./index.es-BRyhJDi0.js";import{t as ce}from"./CopyToClipboard-CiHwDWdZ.js";import{t as le}from"./FilePreview-DEU6ICRQ.js";import{t as ue}from"./ImagePreview-B4O2PRej.js";import{n as de}from"./taskDrawerMixin-DyAUhFEq.js";import{a as fe,n as pe,r as me,t as he}from"./pagination-B2z7KdmK.js";import{t as ge}from"./VideoPlayer-Dj55QgnI.js";import{t as _e}from"./ApiCodeButton-BC32HjSV.js";import{t as ve}from"./BotPlaceholder-DUmSXjV2.js";import{t as ye}from"./PromptTextarea-BPxTMTZS.js";import{n as be,t as xe}from"./AudioPreview-CYOTie5B.js";import{a as J,i as Se,n as Ce,o as we,s as Te,t as Ee}from"./maestro-CT7R6ujs.js";var De=b({name:`LayoutMaestro`,components:{ElDrawer:k,ElButton:R,FontAwesomeIcon:q},mixins:[de]}),Oe={class:`main flex flex-row flex-1`},ke={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function je(t,n,r,i,o,c){let l=u(`font-awesome-icon`),d=u(`el-button`),m=u(`el-drawer`);return v(),s(`div`,Oe,[e(`div`,ke,[p(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ae,[p(t.$slots,`result`,{},void 0,!0)]),f(a(d,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:h(()=>[a(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[y,!t.tasksEmpty]]),a(m,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:h(()=>[p(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Me=L(De,[[`render`,je],[`__scopeId`,`data-v-91db2b6f`]]),Ne=b({name:`MaestroFileUrlsInput`,components:{ElUpload:E,ElButton:R,FontAwesomeIcon:q},data(){return{fileList:[],uploadUrl:V()+`/api/v1/files/`,MAESTRO_FILE_ACCEPT:re,MAESTRO_FILE_LIMIT:6}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},value(){return this.$store.state.maestro?.config?.file_urls||[]}},watch:{value:{immediate:!0,handler(e){let t=new Map(this.fileList.map(e=>[e?.response?.file_url||e.url,e])),n=e.map(e=>t.get(e)||{name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}}),r=this.fileList.filter(e=>!(e?.response?.file_url||e.url));this.fileList=[...n,...r]}}},methods:{onExceed(){U.warning(this.$t(`maestro.message.uploadExceed`))},onError(){U.error(this.$t(`maestro.message.uploadError`))},onChange(){let e=this.fileList.map(e=>e?.response?.file_url||e.url).filter(e=>!!e);this.$store.commit(`maestro/setConfig`,{...this.$store.state.maestro?.config,file_urls:e})}}});function Pe(e,t,n,o,c,l){let d=u(`font-awesome-icon`),f=u(`el-button`),p=u(`el-upload`);return v(),s(`div`,null,[a(p,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,accept:e.MAESTRO_FILE_ACCEPT,name:`file`,class:`w-full`,limit:e.MAESTRO_FILE_LIMIT,multiple:!0,action:e.uploadUrl,headers:e.headers,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onChange,"on-remove":e.onChange},{default:h(()=>[a(f,{size:`small`,round:``},{default:h(()=>[a(d,{icon:`fa-solid fa-paperclip`,class:`mr-1`}),r(` `+i(e.$t(`maestro.button.uploadFiles`)),1)]),_:1})]),_:1},8,[`file-list`,`accept`,`limit`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`])])}var Fe=L(Ne,[[`render`,Pe]]),Ie={"9:16":{width:15,height:26},"16:9":{width:26,height:15},"1:1":{width:20,height:20}},Le=b({name:`ConfigPanel`,components:{ElButton:R,ElSelect:w,ElOption:T,ElInputNumber:A,ElAlert:O,ElSwitch:j,InfoIcon:fe,PromptTextarea:ye,FileUrlsInput:Fe,FontAwesomeIcon:q},emits:[`generate`],data(){return{MAESTRO_MIN_DURATION:1,MAESTRO_MAX_DURATION:600,MAESTRO_ALLOWED_QUALITIES:te,MAESTRO_ALLOWED_SCENARIOS:F,MAESTRO_SCENARIO_THUMBNAILS:ee,MAESTRO_ALLOWED_STYLES:oe,MAESTRO_ALLOWED_VOICES:M,playing:!1,audioEl:null}},computed:{config(){return this.$store.state.maestro?.config},service(){return this.$store.state.maestro?.service},ratioOptions(){return ie.map(e=>({value:e,...Ie[e]??{width:20,height:20}}))},isRemixing(){let e=this.config?.action;return!!e&&e!==`generate`&&!!this.config?.ref_task_id},refTaskId(){return this.config?.ref_task_id},needsVideoUpload(){if(!this.scenarioCustomizationEnabled)return!1;let e=this.config?.scenario;return!e||!ne.includes(e)?!1:!(this.config?.file_urls||[]).some(e=>I(e))},canGenerate(){return!!this.prompt?.trim()&&!this.needsVideoUpload},prompt:{get(){return this.config?.prompt},set(e){this.update({prompt:e})}},langs:{get(){return J(this.config?.langs)},set(e){this.update({langs:J(e)})}},languageOptions(){return Se(this.$i18n.locale)},additionalLanguageOptions(){return this.languageOptions.filter(e=>e.value!==this.primaryLanguage)},primaryLanguage:{get(){return this.langs[0]||P[0]},set(e){this.update({langs:Te(this.langs,e)})}},additionalLanguages:{get(){return this.langs.slice(1)},set(e){this.update({langs:we(this.langs,e)})}},aspect:{get(){return this.config?.aspect},set(e){this.update({aspect:e})}},duration:{get(){return this.config?.duration},set(e){let t=Math.min(600,Math.max(1,Math.round(typeof e==`number`&&!Number.isNaN(e)?e:30)));this.update({duration:t})}},quality:{get(){return this.config?.quality},set(e){this.update({quality:e})}},scenarioCustomizationEnabled:{get(){return this.config?.scenario_customization_enabled??!1},set(e){this.update({scenario_customization_enabled:e})}},styleCustomizationEnabled:{get(){return this.config?.style_customization_enabled??!1},set(e){this.update({style_customization_enabled:e})}},voiceCustomizationEnabled:{get(){return this.config?.voice_customization_enabled??!1},set(e){e||this.stopSample(),this.update({voice_customization_enabled:e})}},scenario:{get(){return this.config?.scenario},set(e){this.update({scenario:e})}},style:{get(){return this.config?.style},set(e){let t=e?.trim();this.update({style:!t||t.toLowerCase()===`auto`?N:t})}},voice:{get(){return this.config?.voice},set(e){this.stopSample(),this.update({voice:e||`warm-female`})}},currentSample(){return M.find(e=>e.key===this.voice)?.sample}},watch:{voiceCustomizationEnabled(e){e||this.stopSample()},voice(){this.stopSample()}},mounted(){this.update({action:this.config?.action??`generate`,langs:J(this.config?.langs),aspect:this.config?.aspect??`9:16`,duration:this.config?.duration??30,quality:this.config?.quality??`standard`})},beforeUnmount(){this.stopSample()},methods:{update(e){this.$store.commit(`maestro/setConfig`,{...this.config,...e})},onClearRemix(){this.update({action:ae,ref_task_id:void 0})},onToggleSample(){let e=this.currentSample;if(e){if(this.audioEl||(this.audioEl=d(new Audio),this.audioEl.addEventListener(`ended`,()=>{this.playing=!1})),this.playing){this.audioEl.pause(),this.playing=!1;return}this.audioEl.src!==e&&(this.audioEl.src=e),this.audioEl.currentTime=0,this.audioEl.play().then(()=>{this.playing=!0}).catch(()=>{this.playing=!1})}},stopSample(){this.audioEl&&(this.audioEl.pause(),this.audioEl.currentTime=0),this.playing=!1},onGenerate(){this.$emit(`generate`)}}}),Re={class:`flex flex-col h-full`},ze={class:`flex-1 overflow-y-auto p-5`},Be={class:`text-xs mb-1`},Ve={class:`field-block mb-5`},He={class:`field-head`},Ue={class:`field-title font-bold`},We={class:`field-block mb-5`},Ge={class:`field-head`},Ke={class:`field-title font-bold`},qe={class:`language-picker`},Je={class:`language-role language-role--primary`},Ye={class:`language-role-label`},Xe={class:`language-role`},Ze={class:`language-role-label`},Qe={class:`field-block mb-5`},$e={class:`field-head`},et={class:`field-title font-bold`},tt=[`aria-label`],nt=[`aria-checked`,`aria-label`,`onClick`,`onKeydown`],rt={class:`ratio-preview`},it={class:`ratio-name`},at={class:`field-row mb-4`},ot={class:`field-head`},st={class:`field-title font-bold`},ct={class:`field-row`},lt={class:`field-head`},ut={class:`field-title font-bold`},dt={class:`custom-field`},ft={class:`custom-field-header mb-2`},pt={class:`field-head`},mt={class:`field-title font-bold`},ht=[`aria-label`,`aria-disabled`],gt=[`aria-checked`,`aria-disabled`,`aria-label`,`tabindex`,`onClick`,`onKeydown`],_t={class:`scenario-thumb`},vt=[`src`,`alt`],yt={class:`scenario-name`},bt={class:`custom-field`},xt={class:`custom-field-header mb-2`},St={class:`field-head`},Ct={class:`field-title font-bold`},wt={class:`custom-field`},Tt={class:`custom-field-header mb-2`},Et={class:`field-head`},Dt={class:`field-title font-bold`},Ot={class:`voice-row`},kt={class:`flex flex-col items-center justify-center px-5 pb-5`};function At(d,f,p,y,b,x){let S=u(`font-awesome-icon`),C=u(`el-button`),w=u(`el-alert`),T=u(`prompt-textarea`),E=u(`info-icon`),D=u(`file-urls-input`),O=u(`el-option`),k=u(`el-select`),A=u(`el-input-number`),j=u(`el-switch`);return v(),s(`div`,Re,[e(`div`,ze,[d.isRemixing?(v(),m(w,{key:0,closable:!1,type:`info`,class:`mb-5`},{default:h(()=>[e(`p`,Be,[a(S,{icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`}),r(` `+i(d.$t(`maestro.name.remixing`))+`: `+i(d.refTaskId),1)]),a(C,{size:`small`,text:``,onClick:d.onClearRemix},{default:h(()=>[r(i(d.$t(`maestro.button.cancelRemix`)),1)]),_:1},8,[`onClick`])]),_:1})):o(``,!0),a(T,{modelValue:d.prompt,"onUpdate:modelValue":f[0]||=e=>d.prompt=e,class:`mb-5`,title:d.$t(`maestro.name.prompt`),info:d.$t(`maestro.description.prompt`),placeholder:d.$t(`maestro.placeholder.prompt`),"min-rows":6},null,8,[`modelValue`,`title`,`info`,`placeholder`]),e(`div`,Ve,[e(`div`,He,[e(`h2`,Ue,i(d.$t(`maestro.name.files`)),1),a(E,{content:d.$t(`maestro.description.files`),class:`ml-1`},null,8,[`content`])]),a(D)]),e(`div`,We,[e(`div`,Ge,[e(`h2`,Ke,i(d.$t(`maestro.name.langs`)),1),a(E,{content:d.$t(`maestro.description.langs`),class:`ml-1`},null,8,[`content`])]),e(`div`,qe,[e(`label`,Je,[e(`span`,Ye,i(d.$t(`maestro.name.primaryLanguage`)),1),a(k,{modelValue:d.primaryLanguage,"onUpdate:modelValue":f[1]||=e=>d.primaryLanguage=e,class:`w-full`},{default:h(()=>[(v(!0),s(l,null,_(d.languageOptions,e=>(v(),m(O,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),e(`label`,Xe,[e(`span`,Ze,i(d.$t(`maestro.name.additionalLanguages`)),1),a(k,{modelValue:d.additionalLanguages,"onUpdate:modelValue":f[2]||=e=>d.additionalLanguages=e,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,placeholder:d.$t(`maestro.placeholder.additionalLanguages`),class:`w-full`},{default:h(()=>[(v(!0),s(l,null,_(d.additionalLanguageOptions,e=>(v(),m(O,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])]),e(`div`,Qe,[e(`div`,$e,[e(`h2`,et,i(d.$t(`maestro.name.aspect`)),1)]),e(`div`,{class:`ratio-items`,role:`radiogroup`,"aria-label":d.$t(`maestro.name.aspect`)},[(v(!0),s(l,null,_(d.ratioOptions,r=>(v(),s(`div`,{key:r.value,class:n([`ratio-item`,{active:d.aspect===r.value}]),role:`radio`,"aria-checked":d.aspect===r.value,"aria-label":r.value,tabindex:`0`,onClick:e=>d.aspect=r.value,onKeydown:[c(t(e=>d.aspect=r.value,[`prevent`]),[`enter`]),c(t(e=>d.aspect=r.value,[`prevent`]),[`space`])]},[e(`div`,rt,[e(`div`,{class:`ratio-rect`,style:g({width:r.width+`px`,height:r.height+`px`})},null,4)]),e(`p`,it,i(r.value),1)],42,nt))),128))],8,tt)]),e(`div`,at,[e(`div`,ot,[e(`h2`,st,i(d.$t(`maestro.name.duration`)),1),a(E,{content:d.$t(`maestro.description.duration`),class:`ml-1`},null,8,[`content`])]),a(A,{modelValue:d.duration,"onUpdate:modelValue":f[3]||=e=>d.duration=e,class:`field-control`,min:d.MAESTRO_MIN_DURATION,max:d.MAESTRO_MAX_DURATION,step:5,"controls-position":`right`},null,8,[`modelValue`,`min`,`max`])]),e(`div`,ct,[e(`div`,lt,[e(`h2`,ut,i(d.$t(`maestro.name.quality`)),1),a(E,{content:d.$t(`maestro.description.quality`),class:`ml-1`},null,8,[`content`])]),a(k,{modelValue:d.quality,"onUpdate:modelValue":f[4]||=e=>d.quality=e,class:`field-control`},{default:h(()=>[(v(!0),s(l,null,_(d.MAESTRO_ALLOWED_QUALITIES,e=>(v(),m(O,{key:e,label:d.$t(`maestro.option.quality.${e}`),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),e(`div`,dt,[e(`div`,ft,[e(`div`,pt,[e(`h2`,mt,i(d.$t(`maestro.name.customizeScenario`)),1),a(E,{content:d.$t(`maestro.description.scenario`),class:`ml-1`},null,8,[`content`])]),a(j,{modelValue:d.scenarioCustomizationEnabled,"onUpdate:modelValue":f[5]||=e=>d.scenarioCustomizationEnabled=e,"aria-label":d.$t(`maestro.name.customizeScenario`)},null,8,[`modelValue`,`aria-label`])]),e(`div`,{class:n([`scenario-cards`,{"is-disabled":!d.scenarioCustomizationEnabled}]),role:`radiogroup`,"aria-label":d.$t(`maestro.name.scenario`),"aria-disabled":!d.scenarioCustomizationEnabled},[(v(!0),s(l,null,_(d.MAESTRO_ALLOWED_SCENARIOS,r=>(v(),s(`div`,{key:r,class:n([`scenario-card`,{active:d.scenarioCustomizationEnabled&&d.scenario===r,disabled:!d.scenarioCustomizationEnabled}]),role:`radio`,"aria-checked":d.scenarioCustomizationEnabled&&d.scenario===r,"aria-disabled":!d.scenarioCustomizationEnabled,"aria-label":d.$t(`maestro.option.scenario.${r}`),tabindex:d.scenarioCustomizationEnabled?0:-1,onClick:e=>d.scenarioCustomizationEnabled&&(d.scenario=r),onKeydown:[c(t(e=>d.scenarioCustomizationEnabled&&(d.scenario=r),[`prevent`]),[`enter`]),c(t(e=>d.scenarioCustomizationEnabled&&(d.scenario=r),[`prevent`]),[`space`])]},[e(`div`,_t,[e(`img`,{src:d.MAESTRO_SCENARIO_THUMBNAILS[r],alt:d.$t(`maestro.option.scenario.${r}`),loading:`lazy`},null,8,vt)]),e(`p`,yt,i(d.$t(`maestro.option.scenario.${r}`)),1)],42,gt))),128))],10,ht),d.needsVideoUpload?(v(),m(w,{key:0,title:d.$t(`maestro.message.captionsNeedVideo`),type:`warning`,closable:!1,"show-icon":``,class:`mt-2`},null,8,[`title`])):o(``,!0)]),e(`div`,bt,[e(`div`,xt,[e(`div`,St,[e(`h2`,Ct,i(d.$t(`maestro.name.customizeStyle`)),1),a(E,{content:d.$t(`maestro.description.style`),class:`ml-1`},null,8,[`content`])]),a(j,{modelValue:d.styleCustomizationEnabled,"onUpdate:modelValue":f[6]||=e=>d.styleCustomizationEnabled=e,"aria-label":d.$t(`maestro.name.customizeStyle`)},null,8,[`modelValue`,`aria-label`])]),a(k,{modelValue:d.style,"onUpdate:modelValue":f[7]||=e=>d.style=e,class:`w-full`,filterable:``,"allow-create":``,"default-first-option":``,disabled:!d.styleCustomizationEnabled,"aria-label":d.$t(`maestro.name.customizeStyle`),placeholder:d.$t(`maestro.placeholder.select`)},{default:h(()=>[(v(!0),s(l,null,_(d.MAESTRO_ALLOWED_STYLES,e=>(v(),m(O,{key:e,label:d.$t(`maestro.option.style.${e}`),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`disabled`,`aria-label`,`placeholder`])]),e(`div`,wt,[e(`div`,Tt,[e(`div`,Et,[e(`h2`,Dt,i(d.$t(`maestro.name.customizeVoice`)),1),a(E,{content:d.$t(`maestro.description.voice`),class:`ml-1`},null,8,[`content`])]),a(j,{modelValue:d.voiceCustomizationEnabled,"onUpdate:modelValue":f[8]||=e=>d.voiceCustomizationEnabled=e,"aria-label":d.$t(`maestro.name.customizeVoice`)},null,8,[`modelValue`,`aria-label`])]),e(`div`,Ot,[a(k,{modelValue:d.voice,"onUpdate:modelValue":f[9]||=e=>d.voice=e,class:`voice-select`,disabled:!d.voiceCustomizationEnabled,"aria-label":d.$t(`maestro.name.customizeVoice`),placeholder:d.$t(`maestro.placeholder.select`)},{default:h(()=>[(v(!0),s(l,null,_(d.MAESTRO_ALLOWED_VOICES,e=>(v(),m(O,{key:e.key,label:d.$t(`maestro.option.voice.${e.key}`),value:e.key},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`disabled`,`aria-label`,`placeholder`]),a(C,{class:`voice-play`,disabled:!d.voiceCustomizationEnabled||!d.currentSample,title:d.$t(`maestro.button.preview`),onClick:d.onToggleSample},{default:h(()=>[a(S,{icon:d.playing?`fa-solid fa-pause`:`fa-solid fa-play`},null,8,[`icon`])]),_:1},8,[`disabled`,`title`,`onClick`])])])]),e(`div`,kt,[a(C,{type:`primary`,class:`btn w-full`,round:``,disabled:!d.canGenerate,onClick:d.onGenerate},{default:h(()=>[a(S,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(d.$t(`maestro.button.generate`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var jt=L(Le,[[`render`,At],[`__scopeId`,`data-v-0e7c2918`]]),Mt=50,Nt=1e4,Y=new Map,X=new Map,Pt=(e,t)=>{if(Y.set(e,t),Y.size>Mt){let e=Y.keys().next().value;e&&Y.delete(e)}};async function Ft(e,t){let n=`${t.credentialKey}:${e}`,r=Y.get(n);if(r)return r;let i=X.get(n);if(i)return i.promise;let a=new AbortController,o,s={controller:a,promise:void 0},c=G.task(e,{token:t.token,signal:a.signal}).then(({data:e})=>{if(!a.signal.aborted)return Pt(n,e),e}).catch(t=>{a.signal.aborted||console.warn(`failed to load maestro remix reference task`,e,t)}),l=new Promise(e=>{o=window.setTimeout(()=>{a.abort(),e(void 0)},Nt)});return s.promise=Promise.race([c,l]).finally(()=>{o!==void 0&&window.clearTimeout(o),X.get(n)===s&&X.delete(n)}),X.set(n,s),s.promise}var Z=[`plan`,`source`,`voice`,`compose`,`render`,`deliver`];function Q(e){if(!e)return-1;let t=e.toLowerCase(),n=Z.indexOf(t);return n>=0?n:/plan|storyboard|script|brief/.test(t)?0:/source|search|image|photo|asset|media/.test(t)?1:/voice|tts|audio|narrat/.test(t)?2:/compose|composit|build|layout|scene/.test(t)?3:/render|encode/.test(t)?4:/deliver|upload|cdn|complete|done|finish/.test(t)?5:-1}var It=b({name:`ProgressSteps`,components:{ElIcon:C,Loading:x,Check:S},props:{modelValue:{type:Object,required:!0}},computed:{currentIndex(){let e=this.modelValue?.response?.data?.progress||[],t=-1;for(let n of e)t=Math.max(t,Q(n?.stage));return t=Math.max(t,Q(this.modelValue?.response?.data?.stage)),Math.max(t,0)},detail(){let e=this.modelValue?.response?.data;if(e?.activity)return e.activity;let t=e?.progress||[];for(let e=t.length-1;e>=0;e--)if(t[e]?.message)return t[e]?.message},steps(){return Z.map(e=>({key:e}))}},methods:{stateOf(e){let t=this.currentIndex;return e<t?`done`:e===t?`active`:`pending`}}}),Lt={class:`progress-steps`,"aria-live":`polite`},Rt=[`aria-current`],zt={class:`ico`},Bt={class:`txt`},Vt={key:0,class:`detail`};function Ht(t,r,c,d,f,p){let g=u(`loading`),y=u(`el-icon`),b=u(`check`);return v(),s(`div`,Lt,[(v(!0),s(l,null,_(t.steps,(r,c)=>(v(),s(`div`,{key:r.key,class:n([`step`,t.stateOf(c)]),"aria-current":c===t.currentIndex?`step`:void 0},[e(`span`,zt,[c===t.currentIndex?(v(),m(y,{key:0,class:`is-loading`,"aria-label":t.$t(`maestro.step.${r.key}`)},{default:h(()=>[a(g)]),_:1},8,[`aria-label`])):c<t.currentIndex?(v(),m(y,{key:1},{default:h(()=>[a(b)]),_:1})):o(``,!0)]),e(`span`,Bt,i(t.$t(`maestro.step.${r.key}`)),1)],10,Rt))),128)),t.detail?(v(),s(`p`,Vt,i(t.detail),1)):o(``,!0)])}var Ut=L(It,[[`render`,Ht],[`__scopeId`,`data-v-86e2e559`]]),Wt=[`succeeded`,`failed`],Gt=[1e3,3e3],Kt=b({name:`TaskPreview`,components:{ElImage:D,CopyToClipboard:ce,FontAwesomeIcon:q,ElAlert:O,VideoPlayer:ge,ElButton:R,ApiCodeButton:_e,ImagePreview:ue,AudioPreview:xe,VideoPreview:be,FilePreview:le,ProgressSteps:Ut},props:{modelValue:{type:Object,required:!0}},data(){return{MAESTRO_LOGO:se,fetchedReferenceTask:void 0,fetchedReferenceKey:void 0,referenceLoadAttempt:0,referenceLoadFailed:!1,referenceLoadTimer:void 0,referenceLoadVersion:0}},computed:{variants(){return this.modelValue?.response?.data?.variants||[]},files(){let e=[...this.modelValue?.request?.file_urls||[]];if(this.referenceTaskId)for(let t of this.referenceTask?.response?.data?.variants||[])t.output_url&&e.push(t.output_url);return[...new Set(e)].filter(e=>!!e).map(e=>{let t=e.split(`?`)[0].split(`#`)[0],n=H(t)?`image`:I(t)?`video`:K(t)?`audio`:`file`;return{url:e,name:this.fileName(t),kind:n}})},referenceTaskId(){let e=this.modelValue?.request;return e?.action===`remix`?e?.ref_task_id:void 0},referenceLoadKey(){let e=this.$store.state.maestro?.credential,t=e?.token;if(!(!this.referenceTaskId||!t))return JSON.stringify([this.referenceTaskId,e?.id||e?.user_id||t,t])},referenceTask(){if(this.referenceTaskId)return this.$store.state.maestro?.tasks?.items?.find(e=>e.id===this.referenceTaskId)||(this.fetchedReferenceKey===this.referenceLoadKey?this.fetchedReferenceTask:void 0)},isTerminal(){return Wt.includes(this.modelValue?.status||``)},traceId(){return this.modelValue?.trace_id||this.modelValue?.response?.trace_id},progressPct(){let e=this.modelValue?.response?.data?.progress,t=e?.length?e[e.length-1]:void 0;return typeof t?.pct==`number`?t.pct:void 0},progressText(){return this.progressPct===void 0?this.statusLabel:`${this.progressPct}%`},statusLabel(){let e=`maestro.status.${this.modelValue?.status||`pending`}`,t=this.$t(e);return t===e?this.$t(`maestro.status.processing`):t},failureReason(){let e=this.modelValue?.response?.error;if(e)return typeof e==`string`?e:e?.message},requestParams(){let e=this.modelValue?.request;if(!e)return[];let t=[];return e.action&&t.push({icon:`fa-solid fa-wand-magic-sparkles`,label:this.$t(`maestro.name.mode`),value:this.optionLabel(`maestro.option.action`,e.action)}),e.scenario&&t.push({icon:`fa-solid fa-clapperboard`,label:this.$t(`maestro.name.scenario`),value:this.optionLabel(`maestro.option.scenario`,e.scenario)}),e.style&&t.push({icon:`fa-solid fa-palette`,label:this.$t(`maestro.name.style`),value:this.optionLabel(`maestro.option.style`,e.style)}),e.quality&&t.push({icon:`fa-solid fa-gauge-high`,label:this.$t(`maestro.name.quality`),value:this.optionLabel(`maestro.option.quality`,e.quality)}),e.aspect&&t.push({icon:`fa-solid fa-expand`,label:this.$t(`maestro.name.aspect`),value:e.aspect}),e.duration&&t.push({icon:`fa-solid fa-clock`,label:this.$t(`maestro.name.duration`),value:`${e.duration}s`}),e.langs?.length&&t.push({icon:`fa-solid fa-language`,label:this.$t(`maestro.name.langs`),value:e.langs.join(` · `)}),t}},watch:{referenceLoadKey:{immediate:!0,handler(e){this.resetReferenceLoad(),e&&!this.referenceTask&&this.loadReferenceTask(e)}}},beforeUnmount(){this.resetReferenceLoad()},methods:{resetReferenceLoad(){this.referenceLoadTimer!==void 0&&window.clearTimeout(this.referenceLoadTimer),this.referenceLoadTimer=void 0,this.referenceLoadVersion+=1,this.referenceLoadAttempt=0,this.referenceLoadFailed=!1,this.fetchedReferenceTask=void 0,this.fetchedReferenceKey=void 0},async loadReferenceTask(e){if(e!==this.referenceLoadKey||this.referenceTask)return;let t=this.$store.state.maestro?.credential,n=t?.token,r=this.referenceTaskId;if(!r||!n)return;let i=t?.id||t?.user_id||n,a=this.referenceLoadVersion;this.referenceLoadAttempt+=1;let o=await Ft(r,{token:n,credentialKey:i});if(a!==this.referenceLoadVersion||e!==this.referenceLoadKey)return;if(o){this.fetchedReferenceTask=o,this.fetchedReferenceKey=e,this.referenceLoadFailed=!1;return}let s=Gt[this.referenceLoadAttempt-1];s===void 0?this.referenceLoadFailed=!0:this.referenceLoadTimer=window.setTimeout(()=>{this.referenceLoadTimer=void 0,this.loadReferenceTask(e)},s)},retryReferenceTask(){let e=this.referenceLoadKey;this.resetReferenceLoad(),e&&this.loadReferenceTask(e)},optionLabel(e,t){let n=`${e}.${t}`,r=this.$t(n);return r===n?t:r},fileName(e){let t=e.substring(e.lastIndexOf(`/`)+1);try{return decodeURIComponent(t)||e}catch{return t||e}},onDownload(e,t){e?.stopPropagation(),window.open(t,`_blank`)},onRemix(){if(!this.modelValue)return;let e=Ce(this.$store.state.maestro?.config,this.modelValue);this.$store.commit(`maestro/setConfig`,e),U.info(this.$t(`maestro.message.remixLoaded`))}}}),qt={class:`preview`},Jt={class:`left`},Yt={class:`main`},Xt={class:`bot`},Zt={class:`datetime`},Qt={class:`info`},$t={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},en=[`href`,`title`],tn={key:1,class:`reference-load-failed flex items-center gap-1 mt-2 text-xs text-[var(--el-text-color-secondary)]`},nn={key:2,class:`prompt mt-2`},rn={key:0,class:`progress-pct`},an={key:0,class:`content`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},cn={key:1,class:`content`},$={class:`text-xs text-[var(--el-text-color-secondary)] mb-1`},ln={key:0},un={class:`operations`},dn={key:0},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},hn={key:2,class:`content`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function bn(t,c,d,f,p,g){let y=u(`el-image`),b=u(`image-preview`),x=u(`video-preview`),S=u(`audio-preview`),C=u(`file-preview`),w=u(`font-awesome-icon`),T=u(`el-button`),E=u(`progress-steps`),D=u(`copy-to-clipboard`),O=u(`el-alert`),k=u(`video-player`),A=u(`api-code-button`);return v(),s(`div`,qt,[e(`div`,Jt,[a(y,{src:t.MAESTRO_LOGO,class:`avatar`},null,8,[`src`])]),e(`div`,Yt,[e(`div`,Xt,[r(i(t.$t(`maestro.name.maestroBot`))+` `,1),e(`span`,Zt,i(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Qt,[t.files.length?(v(),s(`div`,$t,[(v(!0),s(l,null,_(t.files,(e,t)=>(v(),s(l,{key:t},[e.kind===`image`?(v(),m(b,{key:0,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`])):e.kind===`video`?(v(),m(x,{key:1,url:e.url,name:e.name},null,8,[`url`,`name`])):e.kind===`audio`?(v(),m(S,{key:2,url:e.url,name:e.name},null,8,[`url`,`name`])):(v(),s(`a`,{key:3,href:e.url,title:e.name,target:`_blank`,rel:`noopener noreferrer`,class:`shrink-0 no-underline`},[a(C,{name:e.name,closable:!1},null,8,[`name`])],8,en))],64))),128))])):o(``,!0),t.referenceLoadFailed&&t.referenceTaskId&&!t.referenceTask?(v(),s(`div`,tn,[a(w,{icon:`fa-solid fa-circle-info`}),e(`span`,null,i(t.$t(`maestro.name.files`))+`: `+i(t.$t(`maestro.name.failure`)),1),a(T,{class:`reference-retry`,size:`small`,text:``,circle:``,title:t.$t(`codingBridge.session.retry`),"aria-label":t.$t(`codingBridge.session.retry`),onClick:t.retryReferenceTask},{default:h(()=>[a(w,{icon:`fa-solid fa-rotate-right`})]),_:1},8,[`title`,`aria-label`,`onClick`])])):o(``,!0),t.modelValue?.request?.prompt?(v(),s(`p`,nn,[r(i(t.modelValue?.request?.prompt)+` `,1),t.isTerminal?o(``,!0):(v(),s(`span`,rn,` · `+i(t.progressText),1))])):o(``,!0)]),t.isTerminal?o(``,!0):(v(),s(`div`,an,[a(O,{closable:!1,class:`mt-2 processing`},{default:h(()=>[a(E,{"model-value":t.modelValue},null,8,[`model-value`]),(v(!0),s(l,null,_(t.requestParams,(e,t)=>(v(),s(`p`,{key:`param-${t}`,class:n([`text-[var(--el-text-color-regular)] text-xs mb-2`,{"mt-3":t===0}])},[a(w,{icon:e.icon,class:`mr-1`},null,8,[`icon`]),r(` `+i(e.label)+`: `+i(e.value),1)],2))),128)),e(`p`,on,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(D,{content:t.modelValue?.id},null,8,[`content`])]),t.traceId?(v(),s(`p`,sn,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.traceId`))+`: `+i(t.traceId)+` `,1),a(D,{content:t.traceId},null,8,[`content`])])):o(``,!0)]),_:1})])),t.modelValue?.response?.success===!0&&t.variants.length?(v(),s(`div`,cn,[(v(!0),s(l,null,_(t.variants,(t,n)=>(v(),s(`div`,{key:n,class:`mb-4`},[e(`p`,$,[a(w,{icon:`fa-solid fa-language`,class:`mr-1`}),r(i(t.lang),1),t.title?(v(),s(`span`,ln,` · `+i(t.title),1)):o(``,!0)]),t.output_url?(v(),m(k,{key:0,src:t.output_url},null,8,[`src`])):o(``,!0)]))),128)),e(`div`,un,[(v(!0),s(l,null,_(t.variants,(e,n)=>(v(),s(l,{key:n},[e.output_url?(v(),m(T,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:n=>t.onDownload(n,e.output_url)},{default:h(()=>[a(w,{icon:`fa-solid fa-download`,class:`mr-1`}),r(` `+i(t.$t(`maestro.button.download`)),1),t.variants.length>1?(v(),s(`span`,dn,` · `+i(e.lang),1)):o(``,!0)]),_:2},1032,[`onClick`])):o(``,!0)],64))),128)),a(T,{size:`small`,type:`primary`,class:`btn-action`,onClick:t.onRemix},{default:h(()=>[a(w,{icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`}),r(` `+i(t.$t(`maestro.button.remix`)),1)]),_:1},8,[`onClick`]),a(A,{path:`/maestro/videos`,body:t.modelValue?.request},null,8,[`body`])]),a(O,{closable:!1,class:`mt-2 success`},{default:h(()=>[(v(!0),s(l,null,_(t.requestParams,(e,t)=>(v(),s(`p`,{key:`param-${t}`,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},[a(w,{icon:e.icon,class:`mr-1`},null,8,[`icon`]),r(` `+i(e.label)+`: `+i(e.value),1)]))),128)),e(`p`,fn,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(D,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(v(),s(`p`,pn,[a(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),t.traceId?(v(),s(`p`,mn,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.traceId`))+`: `+i(t.traceId)+` `,1),a(D,{content:t.traceId},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),t.modelValue?.response?.success===!1?(v(),s(`div`,hn,[a(O,{closable:!1,class:`failure`},{template:h(()=>[a(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.failure`)),1)]),default:h(()=>[(v(!0),s(l,null,_(t.requestParams,(e,t)=>(v(),s(`p`,{key:`param-${t}`,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},[a(w,{icon:e.icon,class:`mr-1`},null,8,[`icon`]),r(` `+i(e.label)+`: `+i(e.value),1)]))),128)),e(`p`,gn,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(D,{content:t.modelValue?.id},null,8,[`content`])]),t.failureReason?(v(),s(`p`,_n,[a(w,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.failureReason`))+`: `+i(t.failureReason),1)])):o(``,!0),t.modelValue?.elapsed?(v(),s(`p`,vn,[a(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),t.traceId?(v(),s(`p`,yn,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.traceId`))+`: `+i(t.traceId)+` `,1),a(D,{content:t.traceId},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var xn=b({name:`RecentPanel`,components:{TaskPreview:L(Kt,[[`render`,bn],[`__scopeId`,`data-v-55b17645`]]),NoTasks:me,BotPlaceholder:ve,ScrollList:pe},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.maestro?.tasks,items:this.$store.state.maestro?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Sn={key:0},Cn={key:2,class:`w-full h-full flex items-center justify-center`};function wn(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),p=u(`scroll-list`),g=u(`no-tasks`);return v(),s(l,null,[e.tasks?.items===void 0?(v(),s(`div`,Sn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(v(),m(p,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:h(()=>[(v(!0),s(l,null,_(e.tasks?.items,(e,t)=>(v(),m(f,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(v(),s(`div`,Cn,[a(g)])):o(``,!0)],64)}var Tn=b({name:`MaestroIndex`,components:{ConfigPanel:jt,Layout:Me,RecentPanel:L(xn,[[`render`,wn]])},inject:[`initialized`],data(){return{job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.maestro?.status?.getApplications===z.Request},tasksLoading(){return this.$store.state.maestro?.status?.getTasks===z.Request||this.fetchingTasks},credential(){return this.$store.state.maestro.credential},config(){return this.$store.state.maestro.config},tasks(){return this.$store.state.maestro.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await he({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`maestro/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`maestro/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){let e=Ee(this.config);if(!B())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}U.info(this.$t(`maestro.message.startingTask`)),W(`maestro`,G.generate(e,{token:t})).then(()=>{U.success(this.$t(`maestro.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`maestro.message.usedUp`)):U.error(this.$t(`maestro.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function En(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return v(),m(l,null,{config:h(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:h(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Dn=L(Tn,[[`render`,En]]);export{Dn as default};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-CFpHaJD4.js";import{t as b}from"./upload-CdatH6gG.js";import{t as x}from"./tooltip-CpPZ5Dyr.js";import{t as S}from"./image-_L6s8L1x.js";import{t as C}from"./alert-wKUpquj9.js";import{t as w}from"./drawer-DEaLiSBF.js";import{t as T}from"./input-number-Bvc1KjWf.js";import{t as ee}from"./slider-DOOIN-EB.js";import{cr as te,dr as E,lr as D,ur as O}from"./constants-BC87sw1I.js";import{$n as k,G as A,Hi as j,_i as M,_n as N,an as P,bi as F,cn as I,in as L,ji as R,jr as z,on as B,rn as V}from"./index-DCQpsPX6.js";import{t as H}from"./index.es-BRyhJDi0.js";import{t as U}from"./CopyToClipboard-CiHwDWdZ.js";import{t as W}from"./ImagePreview-B4O2PRej.js";import{n as G}from"./taskDrawerMixin-DyAUhFEq.js";import{t as K}from"./Consumption-CT3vH0XB.js";import{a as q,n as J,r as Y,t as X}from"./pagination-B2z7KdmK.js";import{t as Z}from"./VideoPlayer-Dj55QgnI.js";import{t as Q}from"./ApiCodeButton-BC32HjSV.js";import{t as ne}from"./BotPlaceholder-DUmSXjV2.js";import{t as re}from"./PromptTextarea-BPxTMTZS.js";var ie=_({name:`LayoutPixverse`,components:{ElDrawer:w,ElButton:j,FontAwesomeIcon:H},mixins:[G]}),ae={class:`main flex flex-row flex-1`},oe={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},se={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ce(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,ae,[e(`div`,oe,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,se,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var le=A(ie,[[`render`,ce],[`__scopeId`,`data-v-e688a015`]]),ue=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`v3.5`,label:`v3.5`},{value:`v4`,label:`v4`},{value:`v4.5`,label:`v4.5`}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||=D}}),de={class:`field`},fe={class:`title font-bold`};function pe(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,de,[e(`h2`,fe,r(t.$t(`pixverse.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var me=A(ue,[[`render`,pe],[`__scopeId`,`data-v-e8f337ca`]]),he=_({name:`QualitySelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`360p`,label:`360p`},{value:`540p`,label:`540p`},{value:`720p`,label:`720p`},{value:`1080p`,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||=E}}),ge={class:`field`},_e={class:`title font-bold`};function ve(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ge,[e(`h2`,_e,r(t.$t(`pixverse.name.quality`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ye=A(he,[[`render`,ve],[`__scopeId`,`data-v-64aeaae9`]]),be=_({name:`MotionSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`normal`,label:this.$t(`pixverse.name.motion1`)},{value:`fast`,label:this.$t(`pixverse.name.motion2`)}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||=O}}),xe={class:`field`},Se={class:`title font-bold`};function Ce(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,xe,[e(`h2`,Se,r(t.$t(`pixverse.name.motion`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var we=A(be,[[`render`,Ce],[`__scopeId`,`data-v-94237408`]]),Te=_({name:`StyleSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`cyberpunk`,label:this.$t(`pixverse.name.style1`)},{value:`anime`,label:this.$t(`pixverse.name.style2`)},{value:`comic`,label:this.$t(`pixverse.name.style3`)},{value:`clay`,label:this.$t(`pixverse.name.style4`)},{value:`3d_animation`,label:this.$t(`pixverse.name.style5`)},{value:`realistic`,label:this.$t(`pixverse.name.style6`)}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||=``}}),Ee={class:`field`},De={class:`title font-bold`};function Oe(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,Ee,[e(`h2`,De,r(t.$t(`pixverse.name.style`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ke=A(Te,[[`render`,Oe],[`__scopeId`,`data-v-64e17b3c`]]),Ae=_({name:`SeedSelector`,components:{ElSlider:ee,InfoIcon:q,ElInputNumber:T},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug(`set seed`,e),this.$store.commit(`pixverse/setConfig`,{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||=void 0}}),je={class:`flex justify-between`},Me={class:`flex justify-start items-center`},Ne={class:`text-sm font-bold`},Pe={class:`flex justify-end items-center`},Fe={class:`w-full`};function Ie(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-input-number`),p=c(`el-slider`);return h(),o(`div`,null,[e(`div`,je,[e(`div`,Me,[e(`span`,Ne,r(t.$t(`pixverse.name.seed`)),1),i(d,{content:t.$t(`pixverse.description.seed`)},null,8,[`content`])]),e(`div`,Pe,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,Fe,[i(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:0,max:1e3,step:1},null,8,[`modelValue`])])])}var Le=A(Ae,[[`render`,Ie]]),Re=_({name:`DurationSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:5,label:`5s`},{value:8,label:`8s`}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||=5}}),ze={class:`field`},Be={class:`title font-bold`};function Ve(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ze,[e(`h2`,Be,r(t.$t(`pixverse.name.duration`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var He=A(Re,[[`render`,Ve],[`__scopeId`,`data-v-065c77ef`]]),Ue=_({name:`RatioSelector`,data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`4:3`,label:`4:3`,width:20,height:15},{value:`3:4`,label:`3:4`,width:15,height:20},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.pixverse.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||=te}}),We={class:`text-sm font-bold mb-2 block`},Ge={class:`items`},Ke=[`onClick`],qe={class:`name`};function Je(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,We,r(n.$t(`pixverse.name.aspectRatio`)),1),e(`div`,Ge,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.label])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,qe,r(i.label),1)],10,Ke))),128))])])}var Ye=A(Ue,[[`render`,Je],[`__scopeId`,`data-v-53038264`]]),Xe=_({name:`StartImage`,components:{ElUpload:b,ElButton:j,InfoIcon:q,FontAwesomeIcon:H,ImagePreview:W},mixins:[B,L],emits:[`change`],data(){return{fileList:[],uploadUrl:F()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){R.warning(this.$t(`pixverse.message.uploadReferencesExceed`))},onError(){R.error(this.$t(`pixverse.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`pixverse/setConfig`,{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Ze={class:`relative`},Qe={class:`flex justify-between`},$e={class:`flex justify-start items-center`},et={class:`text-sm font-bold`};function tt(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,Ze,[e(`div`,Qe,[e(`div`,$e,[e(`span`,et,r(t.$t(`pixverse.name.startImage`)),1),i(g,{content:t.$t(`pixverse.description.uploadStartImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:5,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`pixverse.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var nt=A(Xe,[[`render`,tt],[`__scopeId`,`data-v-0d570ad7`]]),rt=_({name:`PromptInput`,components:{PromptTextarea:re},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||=``}});function it(e,t,n,r,i,a){let o=c(`prompt-textarea`);return h(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`pixverse.name.prompt`),info:e.$t(`pixverse.description.prompt`),placeholder:e.$t(`pixverse.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var at=_({name:`ConfigPanel`,components:{ElButton:j,FontAwesomeIcon:H,PromptInput:A(rt,[[`render`,it]]),ModelSelector:me,QualitySelector:ye,MotionSelector:we,StyleSelector:ke,DurationSelector:He,StartImage:nt,SeedSelector:Le,RatioSelector:Ye,Consumption:K},emits:[`generate`],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return I(this.config,this.service?.cost)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),ot={class:`flex flex-col h-full`},st={class:`flex-1 overflow-y-auto p-5`},ct={class:`flex flex-col items-center justify-center px-5 pb-5`};function lt(t,a,s,l,u,d){let p=c(`prompt-input`),m=c(`model-selector`),g=c(`style-selector`),_=c(`ratio-selector`),v=c(`motion-selector`),y=c(`quality-selector`),b=c(`start-image`),x=c(`seed-selector`),S=c(`duration-selector`),C=c(`consumption`),w=c(`font-awesome-icon`),T=c(`el-button`);return h(),o(`div`,ot,[e(`div`,st,[i(p,{class:`mb-4`}),i(m,{class:`mb-4`}),i(g,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),i(y,{class:`mb-4`}),i(b,{class:`mb-2`}),i(x,{class:`mb-4`}),i(S,{class:`mb-4`})]),e(`div`,ct,[i(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`pixverse.button.generate`)),1)]),_:1},8,[`onClick`])])])}var ut=A(at,[[`render`,lt]]),dt=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:U,FontAwesomeIcon:H,ElAlert:C,VideoPlayer:Z,ElTooltip:x,ElButton:j,ApiCodeButton:Q},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),ft={class:`preview`},pt={class:`left`},mt={class:`main`},ht={class:`bot`},gt={class:`datetime`},_t={class:`info`},vt={key:0,class:`prompt mt-2`},yt={key:0},bt={key:1},xt={key:0,class:t({content:!0,failed:!0})},St={key:0,class:`mb-4`},Ct={key:1,class:t({operations:!0,"mt-2":!0})},wt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:1,class:t({content:!0})},Dt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function jt(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,ft,[e(`div`,pt,[i(g,{src:`https://cdn.acedata.cloud/viy61r.jpg`,class:`avatar`})]),e(`div`,mt,[e(`div`,ht,[n(r(t.$t(`pixverse.name.pixverseBot`))+` `,1),e(`span`,gt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,_t,[t.modelValue?.request?.prompt?(h(),o(`p`,vt,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,yt,` - (`+r(t.$t(`pixverse.status.pending`))+`) `,1)),t.modelValue?.response?.data&&(t.modelValue?.response?.data[0]?.state===`processing`||t.modelValue?.response?.data[0]?.state===`pending`)?(h(),o(`span`,bt,` - (`+r(t.$t(`pixverse.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,xt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,St,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,Ct,[i(y,{class:`box-item`,effect:`dark`,content:t.$t(`pixverse.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`pixverse.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/pixverse/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,wt,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,Tt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,Et,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,$,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.failure`)),1)]),default:f(()=>[e(`p`,Dt,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),e(`p`,Ot,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,kt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,At,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var Mt=_({name:`RecentPanel`,components:{TaskPreview:A(dt,[[`render`,jt],[`__scopeId`,`data-v-dd3037dc`]]),NoTasks:Y,BotPlaceholder:ne,ScrollList:J},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Nt={key:0},Pt={key:2,class:`w-full h-full flex items-center justify-center`};function Ft(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,Nt,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`h-full w-full overflow-y-auto tasks`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,Pt,[i(v)])):a(``,!0)],64)}var It=_({name:`PixverseIndex`,components:{ConfigPanel:ut,Layout:le,RecentPanel:A(Mt,[[`render`,Ft]])},mixins:[P],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pixverse?.status?.getApplications===M.Request},tasksLoading(){return this.$store.state.pixverse?.status?.getTasks===M.Request||this.fetchingTasks},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await X({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`pixverse/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`pixverse/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`pixverse/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!V(this.uploadTracker,e=>this.$t(e),e=>R.warning(e)))return;let e={...this.config,async:!0};if(!N())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}R.info(this.$t(`pixverse.message.startingTask`)),z(`pixverse`,k.generate(e,{token:t})).then(()=>{R.success(this.$t(`pixverse.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?R.error(this.$t(`pixverse.message.usedUp`)):R.error(this.$t(`pixverse.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Lt(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Rt=A(It,[[`render`,Lt]]);export{Rt as default};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{n as v,r as y,t as b}from"./select-CFpHaJD4.js";import{t as x}from"./upload-CdatH6gG.js";import{t as S}from"./tooltip-CpPZ5Dyr.js";import{t as C}from"./image-_L6s8L1x.js";import{t as w}from"./alert-wKUpquj9.js";import{t as T}from"./drawer-DEaLiSBF.js";import{t as E}from"./input-number-Bvc1KjWf.js";import{t as D}from"./switch-B5F7c-ty.js";import{Cn as O,En as k,Sn as ee,Tn as te,_n as A,bn as j,gn as M,mn as N,pn as ne,vn as P,xn as F,yn as I}from"./constants-BC87sw1I.js";import{Ai as L,G as R,Hi as z,Vn as re,_i as B,_n as ie,an as V,bi as H,cn as U,in as W,ji as G,jr as K,on as q,rn as J}from"./index-DCQpsPX6.js";import{t as Y}from"./index.es-BRyhJDi0.js";import{t as ae}from"./CopyToClipboard-CiHwDWdZ.js";import{t as X}from"./ImagePreview-B4O2PRej.js";import{n as oe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as se}from"./Consumption-CT3vH0XB.js";import{a as Z,n as ce,r as le,t as ue}from"./pagination-B2z7KdmK.js";import{t as de}from"./ApiCodeButton-BC32HjSV.js";import{t as fe}from"./BotPlaceholder-DUmSXjV2.js";import{t as pe}from"./PromptTextarea-BPxTMTZS.js";import{t as me}from"./ImageWrapper-BiOnDKop.js";var he=_({name:`LayoutSeedream`,components:{ElDrawer:T,ElButton:z,FontAwesomeIcon:Y},mixins:[oe]}),ge={class:`main flex flex-row flex-1`},_e={class:`config w-[320px] h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ve={class:`result h-full p-6 flex-1 flex flex-col bg-[var(--app-content-bg)]`};function ye(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,ge,[e(`div`,_e,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ve,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var be=R(he,[[`render`,ye],[`__scopeId`,`data-v-2a1715d6`]]),xe=_({name:`SeedreamPromptInput`,components:{PromptTextarea:pe},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Se(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ce=R(xe,[[`render`,Se]]),we={image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};function Q(e){switch(e){case j:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case I:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case P:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case A:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case M:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:N[M],outputFormat:!1,tools:!1};case F:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:N[F],outputFormat:!1,tools:!1};default:return we}}var Te=[`1K`,`2K`,`3K`,`4K`];function Ee(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Q(n),i=[];Array.isArray(e.image)&&e.image.length>0&&!r.image&&i.push({field:`image`,i18nLabel:`seedream.name.imageUrls`});let a=typeof e.size==`string`?e.size:void 0;if(a){let e=a.toUpperCase();(Te.includes(e)&&!r.sizeTiers.includes(e)||a===`adaptive`&&!r.sizeAdaptive)&&i.push({field:`size`,i18nLabel:`seedream.name.size`})}return e.sequential_image_generation===`auto`&&!r.groupGeneration&&i.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&e.seed!==null&&!r.seed&&i.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&e.guidance_scale!==null&&!r.guidanceScale&&i.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!r.outputFormat&&i.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),Array.isArray(e.tools)&&e.tools.length>0&&!r.tools&&i.push({field:`tools`,i18nLabel:`seedream.name.tools`}),i}function De(e,t,n){let r={...e},i=Q(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var Oe=_({name:`SeedreamImageInput`,components:{ElUpload:x,ElButton:z,InfoIcon:Z,ImagePreview:X,FontAwesomeIcon:Y},mixins:[q,W],data(){return{fileList:[],uploadUrl:H()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.seedream?.config?.image},model(){return this.$store.state.seedream?.config?.model},supported(){return Q(this.model).image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){G.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){G.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),ke={key:0},Ae={class:`field`},je={class:`label`},Me={class:`box`},Ne={class:`title font-bold`},Pe={class:`value`},Fe={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ie(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`font-awesome-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return t.supported?(h(),s(`div`,ke,[e(`div`,Ae,[e(`div`,je,[e(`div`,Me,[e(`h2`,Ne,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Pe,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{icon:`fa-solid fa-upload`,class:`mr-1`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,Fe,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):o(``,!0)}var Le=R(Oe,[[`render`,Ie],[`__scopeId`,`data-v-6ef4c2e4`]]),Re=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{revertKey:0,options:[{value:j,label:this.$t(`seedream.model.seedream50pro`)},{value:I,label:this.$t(`seedream.model.seedream50`)},{value:P,label:this.$t(`seedream.model.seedream45`)},{value:A,label:this.$t(`seedream.model.seedream40`)},{value:M,label:this.$t(`seedream.model.seedream30t2i`)},{value:F,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(ne)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Ee(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await L.confirm(this.$t(`seedream.message.featureNotSupportedBody`,{fields:r}),this.$t(`seedream.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`seedream.button.confirmContinue`),cancelButtonText:this.$t(`seedream.button.cancelSwitch`),type:`warning`});let i=De({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),G.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),ze={class:`field`},Be={class:`label`},Ve={class:`box`},He={class:`title font-bold`};function Ue(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,ze,[e(`div`,Be,[e(`div`,Ve,[e(`h2`,He,i(t.$t(`seedream.name.model`)),1),a(g,{content:t.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(h(),f(v,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`seedream.placeholder.select`),onChange:t.onChange},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var We=R(Re,[[`render`,Ue],[`__scopeId`,`data-v-6413c179`]]),Ge=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:Z},data(){return{SEEDREAM_SIZE_ADAPTIVE:te,pixelOptions:O}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Q(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),Ke={class:`field`},qe={class:`label`},Je={class:`box`},Ye={class:`title font-bold`};function Xe(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`);return h(),s(`div`,Ke,[e(`div`,qe,[e(`div`,Je,[e(`h2`,Ye,i(t.$t(`seedream.name.size`)),1),a(_,{content:t.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:p(()=>[t.capabilities.sizeTiers.length?(h(),f(y,{key:0,label:t.$t(`seedream.size.group.tier`)},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.sizeTiers,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),t.capabilities.sizeAdaptive?(h(),f(y,{key:1,label:t.$t(`seedream.size.group.adaptive`)},{default:p(()=>[(h(),f(v,{key:t.SEEDREAM_SIZE_ADAPTIVE,label:t.$t(`seedream.size.adaptive`),value:t.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:t.$t(`seedream.size.group.pixel`)},{default:p(()=>[(h(!0),s(c,null,m(t.pixelOptions,e=>(h(),f(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var Ze=R(Ge,[[`render`,Xe],[`__scopeId`,`data-v-dd7bd021`]]),Qe=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),$e={key:0,class:`field`},et={class:`label`},tt={class:`box`},nt={class:`title font-bold`},rt={class:`value`};function it(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,$e,[e(`div`,et,[e(`div`,tt,[e(`h2`,nt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,rt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:t.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var at=R(Qe,[[`render`,it],[`__scopeId`,`data-v-f079fd20`]]),ot=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[...ee]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),st={key:0,class:`field`},ct={class:`label`},lt={class:`box`},ut={class:`title font-bold`};function dt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,st,[e(`div`,ct,[e(`div`,lt,[e(`h2`,ut,i(t.$t(`seedream.name.outputFormat`)),1),a(_,{content:t.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var ft=R(ot,[[`render`,dt],[`__scopeId`,`data-v-69ea4c07`]]),pt=_({name:`SeedreamSeedInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),mt={key:0,class:`field`},ht={class:`label`},gt={class:`box`},_t={class:`title font-bold`},vt={class:`value`};function yt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,mt,[e(`div`,ht,[e(`div`,gt,[e(`h2`,_t,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,vt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var bt=R(pt,[[`render`,yt],[`__scopeId`,`data-v-10cdc1e0`]]),xt=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).guidanceScale},defaultValue(){return Q(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),St={key:0,class:`field`},Ct={class:`label`},wt={class:`box`},Tt={class:`title font-bold`},Et={class:`value`};function Dt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,St,[e(`div`,Ct,[e(`div`,wt,[e(`h2`,Tt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Et,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Ot=R(xt,[[`render`,Dt],[`__scopeId`,`data-v-7386f064`]]),kt=_({name:`SeedreamWatermarkSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{value:{get(){let e=this.$store.state.seedream?.config?.watermark;return e===void 0?!1:!!e},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,watermark:e})}}}}),At={class:`field`},jt={class:`label`},Mt={class:`box`},Nt={class:`title font-bold`},Pt={class:`value`};function Ft(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,At,[e(`div`,jt,[e(`div`,Mt,[e(`h2`,Nt,i(t.$t(`seedream.name.watermark`)),1),a(d,{content:t.$t(`seedream.description.watermark`),class:`info`},null,8,[`content`])])]),e(`div`,Pt,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e},null,8,[`modelValue`])])])}var It=_({name:`SeedreamConfigPanel`,components:{ElButton:z,FontAwesomeIcon:Y,PromptInput:Ce,Consumption:se,ImageInput:Le,ModelSelector:We,SizeSelector:Ze,MaxImagesSelector:at,OutputFormatSelector:ft,SeedInput:bt,GuidanceScaleInput:Ot,WatermarkSwitch:R(kt,[[`render`,Ft],[`__scopeId`,`data-v-9e2abf0f`]])},emits:[`generate`],computed:{config(){return this.$store.state.seedream?.config},consumption(){let e={...this.config||{}},t=Array.isArray(e?.image)&&e.image.length>0,n=e?.sequential_image_generation===`auto`?Math.max(1,Math.floor(e?.sequential_image_generation_options?.max_images||1)):1;return U({...e,action:t?`edit`:`generate`,model:k(e?.model),count:n},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Lt={class:`flex flex-col h-full`},Rt={class:`flex-1 overflow-y-auto p-5`},zt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Bt(t,n,o,c,u,d){let f=l(`model-selector`),m=l(`size-selector`),g=l(`max-images-selector`),_=l(`output-format-selector`),v=l(`seed-input`),y=l(`guidance-scale-input`),b=l(`watermark-switch`),x=l(`prompt-input`),S=l(`image-input`),C=l(`consumption`),w=l(`font-awesome-icon`),T=l(`el-button`);return h(),s(`div`,Lt,[e(`div`,Rt,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`})]),e(`div`,zt,[a(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Vt=R(It,[[`render`,Bt]]),Ht=_({name:`SeedreamTaskPreview`,components:{ElImage:C,CopyToClipboard:ae,FontAwesomeIcon:Y,ElAlert:w,ImageWrapper:me,ElButton:z,ElTooltip:S,ImagePreview:X,ApiCodeButton:de},props:{modelValue:{type:Object,required:!0}},computed:{isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{shortModel(e){return k(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Ut={class:`preview`},Wt={class:`left`},Gt={class:`main`},Kt={class:`bot`},qt={class:`datetime`},Jt={class:`info`},Yt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Xt={key:1,class:`prompt mt-2`},Zt={key:0},Qt={key:0,class:n({content:!0})},$t={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},en={key:1,class:n({content:!0,failed:!0})},tn={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},nn={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},rn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ln={key:2,class:n({content:!0})},un={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},_n={key:3,class:n({content:!0})},vn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function bn(n,u,d,g,_,v){let y=l(`el-image`),b=l(`image-preview`),x=l(`font-awesome-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`),w=l(`image-wrapper`),T=l(`el-button`),E=l(`el-tooltip`),D=l(`api-code-button`);return h(),s(`div`,Ut,[e(`div`,Wt,[a(y,{src:`https://cdn.acedata.cloud/9egrbn.png`,class:`avatar`})]),e(`div`,Gt,[e(`div`,Kt,[r(i(n.$t(`seedream.name.seedreamBot`))+` `,1),e(`span`,qt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Jt,[Array.isArray(n.modelValue?.request?.image)&&n.modelValue?.request?.image.length>0?(h(),s(`div`,Yt,[(h(!0),s(c,null,m(n.modelValue?.request?.image,(e,t)=>(h(),f(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,Xt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,Zt,` - (`+i(n.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(h(),s(`div`,en,[e(`div`,tn,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(w,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,nn,[a(E,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(T,{type:`info`,size:`small`,class:`btn-action`,onClick:u[0]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(D,{path:`/seedream/images`,body:n.modelValue?.request},null,8,[`body`])]),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,rn,[a(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,an,[a(x,{icon:`fa-solid fa-image`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,on,[a(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,sn,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,cn,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,$,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(h(),s(`div`,ln,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,un,[a(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,dn,[a(x,{icon:`fa-solid fa-image`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,fn,[a(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,pn,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(h(),s(`p`,mn,[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(h(),s(`p`,hn,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,gn,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,_n,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,vn,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(h(),s(`p`,yn,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Qt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(x,{icon:`fa-regular fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,$t,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var xn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:R(Ht,[[`render`,bn],[`__scopeId`,`data-v-1b4654bc`]]),BotPlaceholder:fe,NoTasks:le,ScrollList:ce},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Sn={key:0},Cn={key:2,class:`w-full h-full flex items-center justify-center`};function wn(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Sn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Cn,[a(v)])):o(``,!0)],64)}var Tn=_({name:`SeedreamIndex`,components:{ConfigPanel:Vt,Layout:be,RecentPanel:R(xn,[[`render`,wn]])},mixins:[V],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===B.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===B.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ue({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!J(this.uploadTracker,e=>this.$t(e),e=>G.warning(e)))return;let e={...this.config||{}};!(Array.isArray(e?.image)&&e.image.length>0)&&`image`in e&&delete e.image,e?.size||delete e.size;let t={...e,async:!0};if(!ie())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}G.info(this.$t(`seedream.message.startingTask`)),K(`seedream`,re.generate(t,{token:n})).then(()=>{G.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?G.error(this.$t(`seedream.message.usedUp`)):G.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function En(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Dn=R(Tn,[[`render`,En]]);export{Dn as default};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-CFpHaJD4.js";import{t as x}from"./upload-CdatH6gG.js";import{t as S}from"./tooltip-CpPZ5Dyr.js";import{t as C}from"./image-_L6s8L1x.js";import{t as w}from"./alert-wKUpquj9.js";import{t as T}from"./drawer-DEaLiSBF.js";import{t as E}from"./input-number-Bvc1KjWf.js";import{t as D}from"./switch-B5F7c-ty.js";import{$t as O,Gt as k,Jt as A,Kt as j,Qt as ee,Xt as te,Yt as ne,Zt as M,an as N,cn as P,en as F,fn as I,in as re,ln as L,nn as ie,on as ae,rn as oe,sn as se,tn as ce,un as R}from"./constants-BC87sw1I.js";import{Bn as z,G as B,Hi as V,_i as H,_n as U,an as W,bi as G,cn as le,in as K,ji as q,jr as ue,on as J,rn as de}from"./index-DCQpsPX6.js";import{t as Y}from"./index.es-BRyhJDi0.js";import{t as fe}from"./CopyToClipboard-CiHwDWdZ.js";import{t as X}from"./ImagePreview-B4O2PRej.js";import{n as pe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as me}from"./Consumption-CT3vH0XB.js";import{a as Z,n as he,r as ge,t as _e}from"./pagination-B2z7KdmK.js";import{t as ve}from"./VideoPlayer-Dj55QgnI.js";import{t as ye}from"./ApiCodeButton-BC32HjSV.js";import{t as be}from"./BotPlaceholder-DUmSXjV2.js";import{t as xe}from"./PromptTextarea-BPxTMTZS.js";import{t as Se}from"./ImageWrapper-BiOnDKop.js";import{n as Ce,t as we}from"./AudioPreview-CYOTie5B.js";var Te=v({name:`LayoutSeedance`,components:{ElDrawer:T,ElButton:V,FontAwesomeIcon:Y},mixins:[pe]}),Ee={class:`main flex flex-row flex-1`},De={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Oe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ke(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,Ee,[e(`div`,De,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Oe,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{icon:`fa-solid fa-magic`})]),_:1},512),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Ae=B(Te,[[`render`,ke],[`__scopeId`,`data-v-ec312952`]]),je=v({name:`SeedancePromptInput`,components:{PromptTextarea:xe},computed:{prompt:{get(){return this.$store.state.seedance?.config?.prompt},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Me(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedance.name.prompt`),info:e.$t(`seedance.description.prompt`),placeholder:e.$t(`seedance.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ne=B(je,[[`render`,Me]]),Pe=v({name:`SeedanceModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[{value:F,label:this.$t(`seedance.model.seedance20`)},{value:ce,label:this.$t(`seedance.model.seedance20Fast`)},{value:ie,label:this.$t(`seedance.model.seedance20Mini`)},{value:O,label:this.$t(`seedance.model.seedance15pro`)},{value:M,label:this.$t(`seedance.model.seedance10pro`)},{value:ee,label:this.$t(`seedance.model.seedance10proFast`)},{value:te,label:this.$t(`seedance.model.seedance10liteT2v`)},{value:ne,label:this.$t(`seedance.model.seedance10liteI2v`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.model},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,model:e})}}},mounted(){this.value||=k}}),Fe={class:`field`},Ie={class:`label`},Le={class:`box`},Re={class:`title font-bold`};function ze(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Fe,[e(`div`,Ie,[e(`div`,Le,[e(`h2`,Re,i(t.$t(`seedance.name.model`)),1),a(m,{content:t.$t(`seedance.description.model`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedance.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Be=B(Pe,[[`render`,ze],[`__scopeId`,`data-v-deb4c429`]]),Ve=v({name:`SeedanceDurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return I(this.model)},options(){let e=[];this.capability.supportsAutoDuration&&e.push({value:-1,label:`${this.$t(`seedance.placeholder.seed`)} (-1)`});for(let t=this.capability.minDuration;t<=this.capability.maxDuration;t++)e.push({value:t,label:`${t}s`});return e},value:{get(){return this.$store.state.seedance?.config?.duration},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,duration:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=5},methods:{clampValue(){let e=this.value;e!==void 0&&!(e===-1&&this.capability.supportsAutoDuration)&&(e<this.capability.minDuration||e>this.capability.maxDuration)&&(this.value=5)}}}),He={class:`field`},Ue={class:`label`},We={class:`box`},Ge={class:`title font-bold`};function Ke(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,He,[e(`div`,Ue,[e(`div`,We,[e(`h2`,Ge,i(t.$t(`seedance.name.duration`)),1),a(m,{content:t.$t(`seedance.description.duration`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedance.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var qe=B(Ve,[[`render`,Ke],[`__scopeId`,`data-v-d61cc21b`]]),Q={[L]:0,[R]:1,[P]:2,"4k":3},Je=v({name:`SeedanceResolutionSelector`,components:{InfoIcon:Z,ElTooltip:S},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return I(this.model)},options(){let e=[{value:L,label:`480p`},{value:R,label:`720p`},{value:P,label:`1080p`},{value:`4k`,label:`4k`}],t=Q[this.capability.maxResolution]??Q[`1080p`];return e.map(e=>({...e,disabled:Q[e.value]>t}))},value:{get(){return this.$store.state.seedance?.config?.resolution},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,resolution:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=this.capability.defaultResolution||`720p`},methods:{onSelect(e){e.disabled||(this.value=e.value)},clampValue(){let e=this.value,t=this.options.find(t=>t.value===e);(!e||t&&t.disabled)&&(this.value=this.capability.defaultResolution||`720p`)}}}),Ye={class:`resolution`},Xe={class:`header`},Ze={class:`title font-bold`},Qe={class:`items`},$e=[`onClick`];function et(t,r,o,u,d,m){let _=l(`info-icon`),v=l(`el-tooltip`);return g(),s(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`seedance.name.resolution`)),1),a(_,{content:t.$t(`seedance.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,Qe,[(g(!0),s(c,null,h(t.options,r=>(g(),f(v,{key:r.value,content:t.$t(`seedance.message.resolutionNotSupported`),disabled:!r.disabled,placement:`top`},{default:p(()=>[e(`div`,{class:n([`item`,{active:t.value===r.value,disabled:r.disabled}]),onClick:e=>t.onSelect(r)},i(r.label),11,$e)]),_:2},1032,[`content`,`disabled`]))),128))])])}var tt=B(Je,[[`render`,et],[`__scopeId`,`data-v-db7e8aff`]]),nt=v({name:`SeedanceRatioSelector`,components:{InfoIcon:Z},computed:{options(){return[{value:re,label:`16:9`,w:32,h:18},{value:ae,label:`9:16`,w:18,h:32},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`1:1`,label:`1:1`,w:24,h:24},{value:N,label:`21:9`,w:34,h:14},{value:se,label:this.$t(`seedance.ratio.adaptive`),w:0,h:0}]},value:{get(){return this.$store.state.seedance?.config?.ratio},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,ratio:e})}}},mounted(){this.value||=j}}),rt={class:`ratio`},it={class:`header`},at={class:`title font-bold`},ot={class:`items`},st=[`onClick`],ct={class:`preview`},lt={key:1,class:`rect rect-auto`},ut={class:`name`};function dt(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,rt,[e(`div`,it,[e(`h2`,at,i(t.$t(`seedance.name.ratio`)),1),a(p,{content:t.$t(`seedance.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,ot,[(g(!0),s(c,null,h(t.options,r=>(g(),s(`div`,{key:r.value,class:n([`item`,{active:t.value===r.value}]),onClick:e=>t.value=r.value},[e(`div`,ct,[r.w&&r.h?(g(),s(`div`,{key:0,class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)):(g(),s(`div`,lt,`A`))]),e(`div`,ut,i(r.label),1)],10,st))),128))])])}var ft=B(nt,[[`render`,dt],[`__scopeId`,`data-v-8ddec2dd`]]),pt=v({name:`SeedanceGenerateAudioSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{isSupported(){let e=this.$store.state.seedance?.config?.model;return I(e).acceptsAudio},value:{get(){return this.$store.state.seedance?.config?.generate_audio??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,generate_audio:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),mt={key:0,class:`field`},ht={class:`label`},gt={class:`box`},_t={class:`title font-bold`},vt={class:`value`};function yt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-switch`);return t.isSupported?(g(),s(`div`,mt,[e(`div`,ht,[e(`div`,gt,[e(`h2`,_t,i(t.$t(`seedance.name.generateAudio`)),1),a(f,{content:t.$t(`seedance.description.generateAudio`),class:`info`},null,8,[`content`])])]),e(`div`,vt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):o(``,!0)}var bt=B(pt,[[`render`,yt],[`__scopeId`,`data-v-df51dfbd`]]),xt=v({name:`SeedanceCameraFixedSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{value:{get(){return this.$store.state.seedance?.config?.camerafixed??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,camerafixed:e})}}},mounted(){this.$store.state.seedance?.config?.camerafixed===void 0&&(this.value=!1)}}),St={class:`field`},Ct={class:`label`},wt={class:`box`},Tt={class:`title font-bold`},Et={class:`value`};function Dt(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,St,[e(`div`,Ct,[e(`div`,wt,[e(`h2`,Tt,i(t.$t(`seedance.name.cameraFixed`)),1),a(d,{content:t.$t(`seedance.description.cameraFixed`),class:`info`},null,8,[`content`])])]),e(`div`,Et,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])}var Ot=B(xt,[[`render`,Dt],[`__scopeId`,`data-v-ae777d61`]]),kt=v({name:`SeedanceFirstFrameImage`,components:{ElUpload:x,ElButton:V,InfoIcon:Z,FontAwesomeIcon:Y,ImagePreview:X},mixins:[J,K],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return I(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsImage"(e){e||(this.fileList=[],this.onSetFirstFrameUrl())}},methods:{onExceed(){q.warning(this.$t(`seedance.message.uploadExceed`))},onError(){q.error(this.$t(`seedance.message.uploadError`))},onSetFirstFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`first_frame`);e&&t.push({url:e,role:`first_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetFirstFrameUrl()},async onRemove(){this.onSetFirstFrameUrl()}}}),At={key:0,class:`relative`},jt={class:`flex justify-between`},Mt={class:`flex justify-start items-center`},Nt={class:`text-sm font-bold`},Pt={key:0,class:`required-badge`};function Ft(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsImage?(g(),s(`div`,At,[e(`div`,jt,[e(`div`,Mt,[e(`span`,Nt,i(t.$t(`seedance.name.firstFrame`)),1),t.capability.requiresImage?(g(),s(`span`,Pt,i(t.$t(`seedance.name.required`)),1)):o(``,!0),a(h,{content:t.$t(`seedance.description.firstFrame`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var It=B(kt,[[`render`,Ft],[`__scopeId`,`data-v-e2597f23`]]),Lt=v({name:`SeedanceLastFrameImage`,components:{ElUpload:x,ElButton:V,ImagePreview:X,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[J,K],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return I(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsLastFrame"(e){e||(this.fileList=[],this.onSetLastFrameUrl())}},methods:{onExceed(){q.warning(this.$t(`seedance.message.uploadExceed`))},onError(){q.error(this.$t(`seedance.message.uploadError`))},onSetLastFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`last_frame`);e&&t.push({url:e,role:`last_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetLastFrameUrl()},async onRemove(){this.onSetLastFrameUrl()}}}),Rt={key:0,class:`relative`},zt={class:`flex justify-between`},Bt={class:`flex justify-start items-center`},Vt={class:`text-sm font-bold`};function Ht(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsLastFrame?(g(),s(`div`,Rt,[e(`div`,zt,[e(`div`,Bt,[e(`span`,Vt,i(t.$t(`seedance.name.lastFrame`)),1),a(h,{content:t.$t(`seedance.description.lastFrame`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var Ut=B(Lt,[[`render`,Ht],[`__scopeId`,`data-v-3a191e51`]]),Wt=v({name:`SeedanceReferenceImage`,components:{ElUpload:x,ElButton:V,InfoIcon:Z,FontAwesomeIcon:Y,ImagePreview:X},mixins:[J,K],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return I(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceImage"(e){e||(this.fileList=[],this.onSetReferenceImageUrls())}},methods:{onExceed(){q.warning(this.$t(`seedance.message.uploadExceed`))},onError(){q.error(this.$t(`seedance.message.uploadError`))},onSetReferenceImageUrls(){let e=(this.urls||[]).filter(Boolean),t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`reference_image`);e.forEach(e=>t.push({url:e,role:`reference_image`})),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetReferenceImageUrls()},async onRemove(){this.onSetReferenceImageUrls()}}}),Gt={key:0,class:`relative`},Kt={class:`flex justify-between`},qt={class:`flex justify-start items-center`},Jt={class:`text-sm font-bold`};function Yt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsReferenceImage?(g(),s(`div`,Gt,[e(`div`,Kt,[e(`div`,qt,[e(`span`,Jt,i(t.$t(`seedance.name.referenceImage`)),1),a(h,{content:t.$t(`seedance.description.referenceImage`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var Xt=B(Wt,[[`render`,Yt],[`__scopeId`,`data-v-230a67f6`]]),Zt=v({name:`SeedanceReferenceAudio`,components:{ElUpload:x,ElButton:V,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[K],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return I(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceAudio"(e){e||(this.fileList=[],this.onSetReferenceAudios())}},methods:{onExceed(){q.warning(this.$t(`seedance.message.uploadExceed`))},onError(){q.error(this.$t(`seedance.message.uploadError`))},onSetReferenceAudios(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,audios:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceAudios()},async onRemove(){this.onSetReferenceAudios()}}}),Qt={key:0,class:`relative`},$t={class:`flex justify-between`},en={class:`flex justify-start items-center`},tn={class:`text-sm font-bold`};function nn(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`font-awesome-icon`),_=l(`el-button`),v=l(`el-upload`);return t.capability.acceptsReferenceAudio?(g(),s(`div`,Qt,[e(`div`,$t,[e(`div`,en,[e(`span`,tn,i(t.$t(`seedance.name.referenceAudio`)),1),a(m,{content:t.$t(`seedance.description.referenceAudio`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.mp3,.wav,.m4a,.aac,.ogg,.flac`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`text`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(h,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var rn=B(Zt,[[`render`,nn],[`__scopeId`,`data-v-49515675`]]),an=v({name:`SeedanceReferenceVideo`,components:{ElUpload:x,ElButton:V,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[K],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return I(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceVideo"(e){e||(this.fileList=[],this.onSetReferenceVideos())}},methods:{onExceed(){q.warning(this.$t(`seedance.message.uploadExceed`))},onError(){q.error(this.$t(`seedance.message.uploadError`))},onSetReferenceVideos(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,videos:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceVideos()},async onRemove(){this.onSetReferenceVideos()}}}),on={key:0,class:`relative`},sn={class:`flex justify-between`},cn={class:`flex justify-start items-center`},ln={class:`text-sm font-bold`};function un(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`font-awesome-icon`),_=l(`el-button`),v=l(`el-upload`);return t.capability.acceptsReferenceVideo?(g(),s(`div`,on,[e(`div`,sn,[e(`div`,cn,[e(`span`,ln,i(t.$t(`seedance.name.referenceVideo`)),1),a(m,{content:t.$t(`seedance.description.referenceVideo`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.mp4,.mov,.webm,.mkv,.avi`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`text`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(h,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var dn=B(an,[[`render`,un],[`__scopeId`,`data-v-b212c474`]]),fn=v({name:`SeedanceReturnLastFrameSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{model(){return this.$store.state.seedance?.config?.model},isSupported(){return I(this.model).acceptsReturnLastFrame},value:{get(){return this.$store.state.seedance?.config?.return_last_frame},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,return_last_frame:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),pn={key:0,class:`field`},mn={class:`label`},hn={class:`box`},gn={class:`title font-bold`},_n={class:`value`};function vn(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-switch`);return t.isSupported?(g(),s(`div`,pn,[e(`div`,mn,[e(`div`,hn,[e(`h2`,gn,i(t.$t(`seedance.name.returnLastFrame`)),1),a(f,{content:t.$t(`seedance.description.returnLastFrame`),class:`info`},null,8,[`content`])])]),e(`div`,_n,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):o(``,!0)}var yn=B(fn,[[`render`,vn],[`__scopeId`,`data-v-edea5451`]]),bn=v({name:`SeedanceSeedInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{value:{get(){let e=this.$store.state.seedance?.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.$store.state.seedance?.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedance/setConfig`,t)}}}}),xn={class:`field`},Sn={class:`label`},Cn={class:`box`},wn={class:`title font-bold`},Tn={class:`value`};function En(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`);return g(),s(`div`,xn,[e(`div`,Sn,[e(`div`,Cn,[e(`h2`,wn,i(t.$t(`seedance.name.seed`)),1),a(d,{content:t.$t(`seedance.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Tn,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])}var Dn=v({name:`SeedanceConfigPanel`,components:{ElButton:V,FontAwesomeIcon:Y,PromptInput:Ne,ModelSelector:Be,DurationSelector:qe,ResolutionSelector:tt,RatioSelector:ft,GenerateAudioSwitch:bt,CameraFixedSwitch:Ot,ReturnLastFrameSwitch:yn,SeedInput:B(bn,[[`render`,En],[`__scopeId`,`data-v-685a9869`]]),FirstFrameImage:It,LastFrameImage:Ut,ReferenceImage:Xt,ReferenceAudio:rn,ReferenceVideo:dn,Consumption:me},emits:[`generate`],computed:{config(){return this.$store.state.seedance?.config},consumption(){return le(this.config,this.service?.cost)},service(){return this.$store.state.seedance?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),On={class:`flex flex-col h-full`},kn={class:`flex-1 overflow-y-auto p-5`},An={class:`flex flex-col items-center justify-center px-5 pb-5`};function jn(t,n,o,c,u,d){let f=l(`prompt-input`),m=l(`model-selector`),h=l(`ratio-selector`),_=l(`resolution-selector`),v=l(`duration-selector`),y=l(`generate-audio-switch`),b=l(`camera-fixed-switch`),x=l(`return-last-frame-switch`),S=l(`seed-input`),C=l(`first-frame-image`),w=l(`last-frame-image`),T=l(`reference-image`),E=l(`reference-audio`),D=l(`reference-video`),O=l(`consumption`),k=l(`font-awesome-icon`),A=l(`el-button`);return g(),s(`div`,On,[e(`div`,kn,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-2`}),a(w,{class:`mb-2`}),a(T,{class:`mb-2`}),a(E,{class:`mb-2`}),a(D,{class:`mb-2`})]),e(`div`,An,[a(O,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(A,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(k,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`seedance.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Mn=B(Dn,[[`render`,jn]]),Nn=v({name:`SeedanceTaskPreview`,components:{ElImage:C,CopyToClipboard:fe,FontAwesomeIcon:Y,ElAlert:w,VideoPlayer:ve,ElTooltip:S,ElButton:V,ImageWrapper:Se,ImagePreview:X,AudioPreview:we,VideoPreview:Ce,ApiCodeButton:ye},props:{modelValue:{type:Object,required:!0}},data(){return{seedanceLogo:A}},computed:{video(){return this.modelValue?.response?.data},apiCodeBody(){let e=this.modelValue?.request;if(!e)return e;let{service_tier:t,...n}=e;return n},promptText(){let e=this.modelValue?.request;if(e?.prompt)return e.prompt;let t=e?.content?.find(e=>e?.type===`text`&&e?.text);return t?.text?t.text:this.video?.prompt},referenceImages(){let e=this.collectImages();if(e.length===0)return[];let t=[],n=e.find(e=>e?.role===`first_frame`);n?.url&&t.push({url:n.url,name:`first-frame`});let r=e.find(e=>e?.role===`last_frame`);return r?.url&&t.push({url:r.url,name:`last-frame`}),e.forEach((e,n)=>{e?.url&&e.role!==`first_frame`&&e.role!==`last_frame`&&t.push({url:e.url,name:e.role||`image-${n}`})}),t},referenceAudios(){let e=this.modelValue?.request,t=(e?.audios??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`audio_url`&&e?.audio_url?.url&&t.push(e.audio_url.url)}),t},referenceVideos(){let e=this.modelValue?.request,t=(e?.videos??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`video_url`&&e?.video_url?.url&&t.push(e.video_url.url)}),t}},methods:{collectImages(){let e=this.modelValue?.request,t=Array.isArray(e?.images)?[...e.images]:[];return(e?.content??[]).forEach(e=>{e?.type===`image_url`&&e?.image_url?.url&&t.push({url:e.image_url.url,role:e.role})}),t},onDownload(e){window.open(e,`_blank`)}}}),Pn={class:`preview`},Fn={class:`left`},In={class:`main`},Ln={class:`bot`},Rn={class:`datetime`},zn={class:`info`},Bn={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Vn={key:1,class:`prompt mt-2`},Hn={key:0},Un={key:1},Wn={key:0,class:n({content:!0})},Gn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Kn={key:1,class:n({content:!0})},qn={key:0,class:`mb-4`},Jn={key:1,class:`mb-4`},Yn={key:2,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},Xn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Qn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$n={key:0},er={key:1},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},nr={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},rr={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ir={key:2,class:n({content:!0})},ar={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},or={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},lr={key:3,class:n({content:!0})},ur={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function fr(n,u,d,m,_,v){let y=l(`el-image`),b=l(`image-preview`),x=l(`audio-preview`),S=l(`video-preview`),C=l(`font-awesome-icon`),w=l(`copy-to-clipboard`),T=l(`el-alert`),E=l(`video-player`),D=l(`image-wrapper`),O=l(`el-button`),k=l(`el-tooltip`),A=l(`api-code-button`);return g(),s(`div`,Pn,[e(`div`,Fn,[a(y,{src:n.seedanceLogo,class:`avatar`},null,8,[`src`])]),e(`div`,In,[e(`div`,Ln,[r(i(n.$t(`seedance.name.seedanceBot`))+` `,1),e(`span`,Rn,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,zn,[n.referenceImages.length>0||n.referenceAudios.length>0||n.referenceVideos.length>0?(g(),s(`div`,Bn,[(g(!0),s(c,null,h(n.referenceImages,(e,t)=>(g(),f(b,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceAudios,(e,t)=>(g(),f(x,{key:`audio-${t}`,url:e,name:`audio-${t+1}`},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceVideos,(e,t)=>(g(),f(S,{key:`video-${t}`,url:e,name:`video-${t+1}`},null,8,[`url`,`name`]))),128))])):o(``,!0),n.promptText?(g(),s(`p`,Vn,[r(i(n.promptText)+` `,1),n.modelValue?.response?n.video?.status===`processing`||n.video?.status===`pending`?(g(),s(`span`,Un,` - (`+i(n.$t(`seedance.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,Hn,` - (`+i(n.$t(`seedance.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,Kn,[n.video?.video_url?(g(),s(`div`,qn,[a(E,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.last_frame_url?(g(),s(`div`,Jn,[a(D,{src:n.video?.last_frame_url,"raw-src":n.video?.last_frame_url},null,8,[`src`,`raw-src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Yn,[a(k,{class:`box-item`,effect:`dark`,content:n.$t(`seedance.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(O,{type:`info`,size:`small`,class:`btn-action`,onClick:u[0]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`seedance.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(A,{path:`/seedance/videos`,body:n.apiCodeBody},null,8,[`body`])])):o(``,!0),a(T,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,Xn,[a(C,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.video?.duration?(g(),s(`p`,Zn,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.duration`))+`: `+i(n.video?.duration)+`s `,1)])):o(``,!0),n.video?.resolution?(g(),s(`p`,Qn,[a(C,{icon:`fa-solid fa-expand`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.resolution`))+`: `+i(n.video?.resolution)+` `,1),n.video?.ratio?(g(),s(`span`,$n,` · `+i(n.video?.ratio),1)):o(``,!0),n.video?.framespersecond?(g(),s(`span`,er,` · `+i(n.video?.framespersecond)+`fps`,1)):o(``,!0)])):o(``,!0),n.modelValue?.request?.generate_audio?(g(),s(`p`,$,[a(C,{icon:`fa-solid fa-volume-up`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.generateAudio`))+`: `+i(n.$t(`seedance.button.on`)),1)])):o(``,!0),e(`p`,tr,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,nr,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,rr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(g(),s(`div`,ir,[a(T,{closable:!1,class:`failure`},{template:p(()=>[a(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.failure`)),1)]),default:p(()=>[e(`p`,ar,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,or,[a(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(w,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(g(),s(`p`,sr,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,cr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,lr,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.status`)),1)]),default:p(()=>[e(`p`,ur,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(g(),s(`p`,dr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,Wn,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(C,{icon:`fa-regular fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.status.pending`)),1)]),default:p(()=>[e(`p`,Gn,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var pr=v({name:`SeedanceRecentPanel`,components:{TaskPreview:B(Nn,[[`render`,fr],[`__scopeId`,`data-v-f340ebf6`]]),BotPlaceholder:be,NoTasks:ge,ScrollList:he},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedance?.tasks,items:this.$store.state.seedance?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),mr={key:0},hr={key:2,class:`w-full h-full flex items-center justify-center`};function gr(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,mr,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,e=>(g(),f(m,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,hr,[a(v)])):o(``,!0)],64)}var _r=v({name:`SeedanceIndex`,components:{ConfigPanel:Mn,Layout:Ae,RecentPanel:B(pr,[[`render`,gr]])},mixins:[W],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.seedance?.status?.getApplications===H.Request},tasksLoading(){return this.$store.state.seedance?.status?.getTasks===H.Request||this.fetchingTasks},credential(){return this.$store.state.seedance?.credential},config(){return this.$store.state.seedance?.config},tasks(){return this.$store.state.seedance?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await _e({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`seedance/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`seedance/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!de(this.uploadTracker,e=>this.$t(e),e=>q.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.images)){e.images=e.images.filter(e=>!!e?.url);let t=e.images.some(e=>e?.role===`first_frame`),n=e.images.some(e=>e?.role===`last_frame`);!t&&n&&(e.images=e.images.map(e=>e?.role===`last_frame`?{...e,role:`first_frame`}:e))}let t=Array.isArray(e?.images)&&e.images.length>0;if(!t&&`images`in e&&delete e.images,`service_tier`in e&&delete e.service_tier,e?.model&&!oe[e.model]){q.warning(this.$t(`seedance.message.modelUnsupported`));return}let n=I(e?.model);if(n.requiresImage&&!t){q.warning(this.$t(`seedance.message.modelRequiresImage`));return}if(!n.acceptsImage&&t){q.warning(this.$t(`seedance.message.modelRejectsImage`));return}if(!n.acceptsText&&!t){q.warning(this.$t(`seedance.message.modelRequiresImage`));return}!n.acceptsAudio&&e.generate_audio&&(e.generate_audio=!1),!n.acceptsReturnLastFrame&&e.return_last_frame&&(e.return_last_frame=!1),!n.acceptsLastFrame&&t&&(e.images=e.images.filter(e=>e?.role!==`last_frame`)),n.acceptsReferenceAudio&&Array.isArray(e?.audios)&&(e.audios=e.audios.filter(e=>e?.url)),(!n.acceptsReferenceAudio||!Array.isArray(e?.audios)||e.audios.length===0)&&delete e.audios,n.acceptsReferenceVideo&&Array.isArray(e?.videos)&&(e.videos=e.videos.filter(e=>e?.url)),(!n.acceptsReferenceVideo||!Array.isArray(e?.videos)||e.videos.length===0)&&delete e.videos,!n.acceptsReferenceImage&&Array.isArray(e?.images)&&(e.images=e.images.filter(e=>e?.role!==`reference_image`),e.images.length===0&&delete e.images);let r=Array.isArray(e?.images)&&e.images.some(e=>e?.role===`reference_image`);if(Array.isArray(e?.audios)&&e.audios.length>0&&!r){q.warning(this.$t(`seedance.message.audioRequiresReferenceImage`));return}let i={...e,async:!0};if(!U())return;let a=this.credential?.token;if(!a){console.error(`no token specified`);return}q.info(this.$t(`seedance.message.startingTask`)),ue(`seedance`,z.generate(i,{token:a})).then(()=>{q.success(this.$t(`seedance.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?q.error(this.$t(`seedance.message.usedUp`)):q.error(this.$t(`seedance.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function vr(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var yr=B(_r,[[`render`,vr]]);export{yr as default};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,T as o,at as s,ht as c,it as l,j as u,mt as d,rt as f,tt as p,x as m,z as h}from"./vendor-chart-Dw-P17PN.js";import{r as g,t as _}from"./select-CFpHaJD4.js";import{t as v}from"./upload-CdatH6gG.js";import{t as y}from"./image-_L6s8L1x.js";import{t as b}from"./alert-wKUpquj9.js";import{n as x,r as S}from"./radio-Bj0tEwH8.js";import{t as C}from"./drawer-DEaLiSBF.js";import{t as w}from"./progress-BfXLGwWW.js";import{Cr as T,_r as E,br as D,gr as ee,hr as te,mr as O,xr as k}from"./constants-BC87sw1I.js";import{G as A,Hi as j,Zi as ne,_i as M,_n as N,bi as P,cn as F,er as I,ji as L,jr as R}from"./index-DCQpsPX6.js";import{t as z}from"./index.es-BRyhJDi0.js";import{t as B}from"./CopyToClipboard-CiHwDWdZ.js";import{n as V}from"./taskDrawerMixin-DyAUhFEq.js";import{t as H}from"./Consumption-CT3vH0XB.js";import{a as U,n as W,r as G,t as K}from"./pagination-B2z7KdmK.js";import{t as q}from"./VideoPlayer-Dj55QgnI.js";import{t as J}from"./ApiCodeButton-BC32HjSV.js";import{t as Y}from"./BotPlaceholder-DUmSXjV2.js";var X=h({name:`LayoutDigitalHuman`,components:{ElDrawer:C,ElButton:j,FontAwesomeIcon:z},mixins:[V]}),Z={class:`main flex flex-row flex-1`},re={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ie={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ae(t,n,i,o,u,f){let h=s(`font-awesome-icon`),g=s(`el-button`),_=s(`el-drawer`);return p(),a(`div`,Z,[e(`div`,re,[l(t.$slots,`config`,{},void 0,!0)]),e(`div`,ie,[l(t.$slots,`result`,{},void 0,!0)]),c(r(g,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:d(()=>[r(h,{icon:`fa-solid fa-user`})]),_:1},512),[[m,!t.tasksEmpty]]),r(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:d(()=>[l(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var oe=A(X,[[`render`,ae],[`__scopeId`,`data-v-b03e40b3`]]),se=h({name:`DigitalHumanFileInput`,components:{ElUpload:v,ElButton:j,FontAwesomeIcon:z},props:{accept:{type:String,default:``},buttonText:{type:String,default:``},icon:{type:String,default:`fa-solid fa-upload`}},emits:[`change`],data(){return{fileList:[],uploadUrl:P()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}}},methods:{onExceed(e){let t=this.$refs.uploader;t?.clearFiles();let n=e[0];n&&(t?.handleStart?.(n),t?.submit?.())},onError(){L.error(this.$t(`digitalhuman.message.uploadError`))},onChange(){let e=this.fileList?.[0]?.response?.file_url;this.$emit(`change`,e)}}});function ce(e,i,o,c,l,u){let f=s(`font-awesome-icon`),m=s(`el-button`),h=s(`el-upload`);return p(),a(`div`,null,[r(h,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":i[0]||=t=>e.fileList=t,accept:e.accept,name:`file`,class:`w-full`,limit:1,action:e.uploadUrl,headers:e.headers,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onChange,"on-remove":e.onChange},{default:d(()=>[r(m,{size:`small`,round:``},{default:d(()=>[r(f,{icon:e.icon,class:`mr-1`},null,8,[`icon`]),t(` `+n(e.buttonText),1)]),_:1})]),_:1},8,[`file-list`,`accept`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`])])}var Q=A(se,[[`render`,ce]]),le=3e3,ue=60,de=h({name:`VoiceClone`,components:{ElButton:j,ElSelect:g,ElOption:_,ElAlert:b,FileInput:Q,FontAwesomeIcon:z},data(){return{sampleUrl:void 0,lang:`zh`,cloning:!1,destroyed:!1,runId:0,DIGITALHUMAN_ALLOWED_LANGS:te,DIGITALHUMAN_AUDIO_ACCEPT:E}},computed:{credentialToken(){return this.$store.state.digitalhuman?.credential?.token},voiceId(){return this.$store.state.digitalhuman?.config?.voice_id}},watch:{lang(){this.invalidate()}},beforeUnmount(){this.destroyed=!0,this.runId++},methods:{onSampleChange(e){this.sampleUrl=e,this.invalidate()},invalidate(){this.runId++,this.cloning=!1,this.voiceId&&this.setVoiceId(void 0)},isStale(e){return this.destroyed||e!==this.runId},setVoiceId(e){this.$store.commit(`digitalhuman/setConfig`,{...this.$store.state.digitalhuman?.config,voice_id:e})},sleep(e){return new Promise(t=>setTimeout(t,e))},async onClone(){let e=this.credentialToken;if(!this.sampleUrl||!e)return;let t=++this.runId;this.cloning=!0,this.setVoiceId(void 0);try{let{data:n}=await I.cloneVoice({audio_url:this.sampleUrl,lang:this.lang},{token:e});if(this.isStale(t))return;if(n?.voice_id){this.onCloned(n.voice_id);return}if(n?.task_id)await this.pollVoice(n.task_id,e,t);else throw Error(`no task`)}catch{this.isStale(t)||L.error(this.$t(`digitalhuman.message.voiceCloneFailed`))}finally{this.isStale(t)||(this.cloning=!1)}},async pollVoice(e,t,n){for(let r=0;r<ue;r++){if(this.isStale(n)||(await this.sleep(le),this.isStale(n)))return;let{data:r}=await I.pollTask(e,{token:t});if(this.isStale(n))return;if(r?.voice_id){this.onCloned(r.voice_id);return}if(r?.state===`failed`)throw Error(`clone failed`)}throw Error(`timeout`)},onCloned(e){this.setVoiceId(e),L.success(this.$t(`digitalhuman.message.voiceCloneSuccess`))}}}),fe={class:`voice-clone`},pe={class:`text-xs text-[var(--el-text-color-secondary)] mb-2`},me={class:`flex flex-row items-center gap-2 mb-2`},he={class:`text-xs mb-0`};function ge(c,l,m,h,g,_){let v=s(`file-input`),y=s(`el-option`),b=s(`el-select`),x=s(`font-awesome-icon`),S=s(`el-button`),C=s(`el-alert`);return p(),a(`div`,fe,[e(`p`,pe,n(c.$t(`digitalhuman.description.voiceClone`)),1),e(`div`,me,[r(v,{accept:c.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":c.$t(`digitalhuman.button.uploadSample`),icon:`fa-solid fa-microphone`,onChange:c.onSampleChange},null,8,[`accept`,`button-text`,`onChange`]),r(b,{modelValue:c.lang,"onUpdate:modelValue":l[0]||=e=>c.lang=e,size:`small`,class:`!w-[90px]`},{default:d(()=>[(p(!0),a(o,null,f(c.DIGITALHUMAN_ALLOWED_LANGS,e=>(p(),u(y,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),r(S,{size:`small`,type:`primary`,round:``,loading:c.cloning,disabled:!c.sampleUrl||c.cloning,onClick:c.onClone},{default:d(()=>[r(x,{icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`}),t(` `+n(c.cloning?c.$t(`digitalhuman.button.cloning`):c.$t(`digitalhuman.button.clone`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`]),c.voiceId?(p(),u(C,{key:0,closable:!1,type:`success`,class:`mt-2`},{default:d(()=>[e(`p`,he,[r(x,{icon:`fa-solid fa-check`,class:`mr-1`}),t(` `+n(c.$t(`digitalhuman.name.voiceReady`))+`: `+n(c.voiceId),1)])]),_:1})):i(``,!0)])}var _e=h({name:`ConfigPanel`,components:{ElButton:j,ElInput:ne,ElRadioGroup:S,ElRadioButton:x,Consumption:H,InfoIcon:U,FileInput:Q,VoiceClone:A(de,[[`render`,ge]]),FontAwesomeIcon:z},emits:[`generate`],data(){return{faceMode:`video`,voiceMode:`audio`,DIGITALHUMAN_ALLOWED_ENGINES:O,DIGITALHUMAN_ALLOWED_RESOLUTIONS:ee,DIGITALHUMAN_VIDEO_ACCEPT:T,DIGITALHUMAN_IMAGE_ACCEPT:D,DIGITALHUMAN_AUDIO_ACCEPT:E}},computed:{config(){return this.$store.state.digitalhuman?.config},service(){return this.$store.state.digitalhuman?.service},consumption(){return F(this.config,this.service?.cost)},canGenerate(){let e=this.faceMode===`video`?!!this.config?.video_url:!!this.config?.image_url,t=this.voiceMode===`audio`?!!this.config?.audio_url:!!this.config?.text?.trim()&&!!this.config?.voice_id;return e&&t},text:{get(){return this.config?.text},set(e){this.update({text:e})}},engine:{get(){return this.config?.engine},set(e){this.update({engine:e})}},resolution:{get(){return this.config?.resolution},set(e){this.update({resolution:e})}}},mounted(){this.config?.image_url&&!this.config?.video_url&&(this.faceMode=`photo`),(this.config?.text||this.config?.voice_id)&&(this.voiceMode=`text`),this.update({engine:this.config?.engine??`latentsync`,resolution:this.config?.resolution??`720p`})},methods:{update(e){this.$store.commit(`digitalhuman/setConfig`,{...this.config,...e})},onFaceModeChange(e){this.update(e===`video`?{image_url:void 0}:{video_url:void 0})},onVoiceModeChange(e){this.update(e===`audio`?{text:void 0,voice_id:void 0}:{audio_url:void 0})},onFaceVideoChange(e){this.update({video_url:e})},onFacePhotoChange(e){this.update({image_url:e})},onAudioChange(e){this.update({audio_url:e})},onGenerate(){let e=this.config||{},t={engine:e.engine,resolution:e.resolution};this.faceMode===`video`?t.video_url=e.video_url:t.image_url=e.image_url,this.voiceMode===`audio`?t.audio_url=e.audio_url:(t.text=e.text,t.voice_id=e.voice_id),this.$emit(`generate`,t)}}}),ve={class:`flex flex-col h-full`},ye={class:`flex-1 overflow-y-auto p-5`},be={class:`field-block mb-5`},xe={class:`field-head`},Se={class:`field-title font-bold`},Ce={class:`field-block mb-5`},we={class:`field-head`},Te={class:`field-title font-bold`},Ee={class:`field-block mb-5`},De={class:`field-head`},Oe={class:`field-title font-bold`},ke={class:`field-block`},Ae={class:`field-head`},je={class:`field-title font-bold`},Me={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ne(i,c,l,m,h,g){let _=s(`info-icon`),v=s(`el-radio-button`),y=s(`el-radio-group`),b=s(`file-input`),x=s(`el-input`),S=s(`voice-clone`),C=s(`consumption`),w=s(`font-awesome-icon`),T=s(`el-button`);return p(),a(`div`,ve,[e(`div`,ye,[e(`div`,be,[e(`div`,xe,[e(`h2`,Se,n(i.$t(`digitalhuman.name.face`)),1),r(_,{content:i.$t(`digitalhuman.description.face`),class:`ml-1`},null,8,[`content`])]),r(y,{modelValue:i.faceMode,"onUpdate:modelValue":c[0]||=e=>i.faceMode=e,class:`w-full mb-2`,onChange:i.onFaceModeChange},{default:d(()=>[r(v,{value:`video`},{default:d(()=>[t(n(i.$t(`digitalhuman.name.faceVideo`)),1)]),_:1}),r(v,{value:`photo`},{default:d(()=>[t(n(i.$t(`digitalhuman.name.facePhoto`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),i.faceMode===`video`?(p(),u(b,{key:0,accept:i.DIGITALHUMAN_VIDEO_ACCEPT,"button-text":i.$t(`digitalhuman.button.uploadVideo`),icon:`fa-solid fa-film`,onChange:i.onFaceVideoChange},null,8,[`accept`,`button-text`,`onChange`])):(p(),u(b,{key:1,accept:i.DIGITALHUMAN_IMAGE_ACCEPT,"button-text":i.$t(`digitalhuman.button.uploadPhoto`),icon:`fa-solid fa-image`,onChange:i.onFacePhotoChange},null,8,[`accept`,`button-text`,`onChange`]))]),e(`div`,Ce,[e(`div`,we,[e(`h2`,Te,n(i.$t(`digitalhuman.name.voice`)),1)]),r(y,{modelValue:i.voiceMode,"onUpdate:modelValue":c[1]||=e=>i.voiceMode=e,class:`w-full mb-2`,onChange:i.onVoiceModeChange},{default:d(()=>[r(v,{value:`audio`},{default:d(()=>[t(n(i.$t(`digitalhuman.name.voiceAudio`)),1)]),_:1}),r(v,{value:`text`},{default:d(()=>[t(n(i.$t(`digitalhuman.name.voiceText`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),i.voiceMode===`audio`?(p(),u(b,{key:0,accept:i.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":i.$t(`digitalhuman.button.uploadAudio`),icon:`fa-solid fa-music`,onChange:i.onAudioChange},null,8,[`accept`,`button-text`,`onChange`])):(p(),a(o,{key:1},[r(x,{modelValue:i.text,"onUpdate:modelValue":c[2]||=e=>i.text=e,type:`textarea`,rows:4,placeholder:i.$t(`digitalhuman.placeholder.text`),class:`mb-2`},null,8,[`modelValue`,`placeholder`]),r(S)],64))]),e(`div`,Ee,[e(`div`,De,[e(`h2`,Oe,n(i.$t(`digitalhuman.name.engine`)),1)]),r(y,{modelValue:i.engine,"onUpdate:modelValue":c[3]||=e=>i.engine=e,class:`w-full`},{default:d(()=>[(p(!0),a(o,null,f(i.DIGITALHUMAN_ALLOWED_ENGINES,e=>(p(),u(v,{key:e,value:e},{default:d(()=>[t(n(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])]),e(`div`,ke,[e(`div`,Ae,[e(`h2`,je,n(i.$t(`digitalhuman.name.resolution`)),1)]),r(y,{modelValue:i.resolution,"onUpdate:modelValue":c[4]||=e=>i.resolution=e,class:`w-full`},{default:d(()=>[(p(!0),a(o,null,f(i.DIGITALHUMAN_ALLOWED_RESOLUTIONS,e=>(p(),u(v,{key:e,value:e},{default:d(()=>[t(n(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])])]),e(`div`,Me,[r(C,{value:i.consumption,service:i.service},null,8,[`value`,`service`]),r(T,{type:`primary`,class:`btn w-full`,round:``,disabled:!i.canGenerate,onClick:i.onGenerate},{default:d(()=>[r(w,{icon:`fa-solid fa-user`,class:`mr-2`}),t(` `+n(i.$t(`digitalhuman.button.generate`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Pe=A(_e,[[`render`,Ne],[`__scopeId`,`data-v-0908bd0e`]]),Fe=h({name:`TaskPreview`,components:{ElImage:y,CopyToClipboard:B,FontAwesomeIcon:z,ElAlert:b,ElProgress:w,VideoPlayer:q,ElButton:j,ApiCodeButton:J},props:{modelValue:{type:Object,required:!0}},data(){return{DIGITALHUMAN_LOGO:k}},computed:{status(){return this.modelValue?.status||this.modelValue?.response?.state||`pending`},isSuccess(){return[`succeed`,`succeeded`].includes(this.status)||!!this.modelValue?.response?.video_url},isFailure(){return[`failed`,`dead`].includes(this.status)||this.modelValue?.response?.success===!1},isTerminal(){return this.isSuccess||this.isFailure},videoUrl(){return this.modelValue?.response?.video_url},progressPct(){let e=this.modelValue?.response?.progress;return typeof e==`number`?e:0},voiceLabel(){return this.modelValue?.request?.audio_url?this.$t(`digitalhuman.name.audioDriven`):this.$t(`digitalhuman.name.textDriven`)},faceLabel(){return this.modelValue?.request?.image_url?this.$t(`digitalhuman.name.facePhoto`):this.$t(`digitalhuman.name.faceVideo`)},faceIcon(){return this.modelValue?.request?.image_url?`fa-solid fa-image`:`fa-solid fa-film`},engineLabel(){return this.modelValue?.request?.engine||this.modelValue?.response?.engine||`latentsync`},statusLabel(){let e=`digitalhuman.status.${this.status}`,t=this.$t(e);return t===e?this.$t(`digitalhuman.status.processing`):t},failureReason(){let e=this.modelValue?.response?.error;if(e)return typeof e==`string`?e:e?.message}},methods:{onDownload(e,t){e?.stopPropagation(),window.open(t,`_blank`)}}}),Ie={class:`preview`},Le={class:`left`},Re={class:`main`},ze={class:`bot`},Be={class:`datetime`},Ve={class:`info`},He={key:0,class:`prompt mt-2`},Ue={key:0},We={key:1,class:`prompt mt-2`},Ge={key:0},Ke={class:`text-xs text-[var(--el-text-color-secondary)] mb-1`},qe={class:`ml-2`},Je={key:0,class:`content`},$={class:`text-xs text-[var(--el-text-color-secondary)] mb-1`},Ye={key:1,class:`content`},Xe={class:`operations mt-2`},Ze={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Qe={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$e={key:2,class:`content`},et={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function nt(o,c,l,f,m,h){let g=s(`el-image`),_=s(`font-awesome-icon`),v=s(`el-progress`),y=s(`video-player`),b=s(`el-button`),x=s(`api-code-button`),S=s(`copy-to-clipboard`),C=s(`el-alert`);return p(),a(`div`,Ie,[e(`div`,Le,[r(g,{src:o.DIGITALHUMAN_LOGO,class:`avatar`},null,8,[`src`])]),e(`div`,Re,[e(`div`,ze,[t(n(o.$t(`digitalhuman.name.bot`))+` `,1),e(`span`,Be,n(o.$dayjs.format(``+new Date(parseFloat((o.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Ve,[o.modelValue?.request?.text?(p(),a(`p`,He,[t(n(o.modelValue?.request?.text)+` `,1),o.isTerminal?i(``,!0):(p(),a(`span`,Ue,` - (`+n(o.statusLabel)+`) `,1))])):(p(),a(`p`,We,[t(n(o.voiceLabel)+` `,1),o.isTerminal?i(``,!0):(p(),a(`span`,Ge,` - (`+n(o.statusLabel)+`) `,1))])),e(`p`,Ke,[r(_,{icon:o.faceIcon,class:`mr-1`},null,8,[`icon`]),t(n(o.faceLabel)+` `,1),e(`span`,qe,[r(_,{icon:`fa-solid fa-sliders`,class:`mr-1`}),t(n(o.engineLabel),1)])])]),o.isTerminal?i(``,!0):(p(),a(`div`,Je,[e(`p`,$,n(o.statusLabel),1),r(v,{percentage:o.progressPct,"stroke-width":6},null,8,[`percentage`])])),o.isSuccess?(p(),a(`div`,Ye,[o.videoUrl?(p(),u(y,{key:0,src:o.videoUrl},null,8,[`src`])):i(``,!0),e(`div`,Xe,[o.videoUrl?(p(),u(b,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=e=>o.onDownload(e,o.videoUrl)},{default:d(()=>[t(n(o.$t(`digitalhuman.button.download`)),1)]),_:1})):i(``,!0),r(x,{path:`/digital-human/videos`,body:o.modelValue?.request},null,8,[`body`])]),r(C,{closable:!1,class:`mt-2 success`},{default:d(()=>[e(`p`,Ze,[r(_,{icon:`fa-solid fa-user`,class:`mr-1`}),t(` `+n(o.$t(`digitalhuman.name.taskId`))+`: `+n(o.modelValue?.id)+` `,1),r(S,{content:o.modelValue?.id},null,8,[`content`])]),o.modelValue?.elapsed?(p(),a(`p`,Qe,[r(_,{icon:`fa-solid fa-clock`,class:`mr-1`}),t(` `+n(o.$t(`digitalhuman.name.elapsed`))+`: `+n(o.modelValue?.elapsed?.toFixed(2))+`s `,1)])):i(``,!0)]),_:1})])):i(``,!0),o.isFailure?(p(),a(`div`,$e,[r(C,{closable:!1,class:`failure`},{template:d(()=>[r(_,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),t(` `+n(o.$t(`digitalhuman.name.failure`)),1)]),default:d(()=>[e(`p`,et,[r(_,{icon:`fa-solid fa-user`,class:`mr-1`}),t(` `+n(o.$t(`digitalhuman.name.taskId`))+`: `+n(o.modelValue?.id)+` `,1),r(S,{content:o.modelValue?.id},null,8,[`content`])]),o.failureReason?(p(),a(`p`,tt,[r(_,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),t(` `+n(o.$t(`digitalhuman.name.failureReason`))+`: `+n(o.failureReason),1)])):i(``,!0)]),_:1})])):i(``,!0)])])}var rt=h({name:`RecentPanel`,components:{TaskPreview:A(Fe,[[`render`,nt],[`__scopeId`,`data-v-da5f1dfb`]]),NoTasks:G,BotPlaceholder:Y,ScrollList:W},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.digitalhuman?.tasks,items:this.$store.state.digitalhuman?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),it={key:0},at={key:2,class:`w-full h-full flex items-center justify-center`};function ot(e,t,n,c,l,m){let h=s(`bot-placeholder`),g=s(`task-preview`),_=s(`scroll-list`),v=s(`no-tasks`);return p(),a(o,null,[e.tasks?.items===void 0?(p(),a(`div`,it,[r(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(p(),u(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:d(()=>[(p(!0),a(o,null,f(e.tasks?.items,(e,t)=>(p(),u(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):i(``,!0),e.tasks?.items?.length===0?(p(),a(`div`,at,[r(v)])):i(``,!0)],64)}var st=h({name:`DigitalHumanIndex`,components:{ConfigPanel:Pe,Layout:oe,RecentPanel:A(rt,[[`render`,ot]])},inject:[`initialized`],data(){return{job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.digitalhuman?.status?.getApplications===M.Request},tasksLoading(){return this.$store.state.digitalhuman?.status?.getTasks===M.Request||this.fetchingTasks},credential(){return this.$store.state.digitalhuman.credential},config(){return this.$store.state.digitalhuman.config},tasks(){return this.$store.state.digitalhuman.tasks}},watch:{initialized:{async handler(e){window.clearInterval(this.job),e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await K({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`digitalhuman/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`digitalhuman/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(e){if(!N())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}L.info(this.$t(`digitalhuman.message.startingTask`)),R(`digitalhuman`,I.generate(e,{token:t})).then(()=>{L.success(this.$t(`digitalhuman.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?L.error(this.$t(`digitalhuman.message.usedUp`)):L.error(this.$t(`digitalhuman.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function ct(e,t,n,i,a,o){let c=s(`config-panel`),l=s(`recent-panel`),f=s(`layout`);return p(),u(f,null,{config:d(()=>[r(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:d(()=>[r(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var lt=A(st,[[`render`,ct]]);export{lt as default};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{t as v}from"./upload-CdatH6gG.js";import{t as y}from"./tooltip-CpPZ5Dyr.js";import{t as b}from"./image-_L6s8L1x.js";import{t as x}from"./alert-wKUpquj9.js";import{t as S}from"./drawer-DEaLiSBF.js";import{t as C}from"./switch-B5F7c-ty.js";import"./constants-BC87sw1I.js";import{G as w,Hi as T,_i as E,_n as D,an as O,bi as k,cn as A,in as j,ji as M,jr as N,on as P,or as ee,rn as te}from"./index-DCQpsPX6.js";import{t as F}from"./index.es-BRyhJDi0.js";import{t as I}from"./CopyToClipboard-CiHwDWdZ.js";import{t as L}from"./FilePreview-DEU6ICRQ.js";import{t as R}from"./ImagePreview-B4O2PRej.js";import{n as z}from"./taskDrawerMixin-DyAUhFEq.js";import{t as B}from"./Consumption-CT3vH0XB.js";import{a as V,n as H,r as U,t as W}from"./pagination-B2z7KdmK.js";import{t as G}from"./VideoPlayer-Dj55QgnI.js";import{t as K}from"./ApiCodeButton-BC32HjSV.js";import{t as q}from"./BotPlaceholder-DUmSXjV2.js";import{t as J}from"./PromptTextarea-BPxTMTZS.js";var Y=_({name:`LayoutLuma`,components:{ElDrawer:S,ElButton:T,FontAwesomeIcon:F},mixins:[z]}),X={class:`main flex flex-row flex-1`},Z={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Q={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ne(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,X,[e(`div`,Z,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Q,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`,class:`drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var re=w(Y,[[`render`,ne],[`__scopeId`,`data-v-da4bcd3a`]]),ie=_({name:`EnhancementSelector`,components:{ElSwitch:C,InfoIcon:V},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug(`set enhancement`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=!0)}}),ae={class:`relative`},oe={class:`flex justify-between`},se={class:`flex justify-start items-center`},ce={class:`text-sm font-bold`},le={class:`flex justify-end items-center`};function ue(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,ae,[e(`div`,oe,[e(`div`,se,[e(`span`,ce,i(t.$t(`luma.name.enhancement`)),1),a(d,{content:t.$t(`luma.description.enhancement`)},null,8,[`content`])]),e(`div`,le,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var de=w(ie,[[`render`,ue]]),fe=_({name:`CustomSelector`,components:{ElSwitch:C,InfoIcon:V},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug(`set custom`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),pe={class:`relative`},me={class:`flex justify-between`},he={class:`flex justify-start items-center`},ge={class:`text-sm font-bold`},_e={class:`flex justify-end items-center`};function ve(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,pe,[e(`div`,me,[e(`div`,he,[e(`span`,ge,i(t.$t(`luma.name.custom`)),1),a(d,{content:t.$t(`luma.description.custom`)},null,8,[`content`])]),e(`div`,_e,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var ye=w(fe,[[`render`,ve]]),be=_({name:`LoopSelector`,components:{ElSwitch:C,InfoIcon:V},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug(`set loop`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),xe={class:`relative`},Se={class:`flex justify-between`},Ce={class:`flex justify-start items-center`},we={class:`text-sm font-bold`},Te={class:`flex justify-end items-center`};function Ee(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,xe,[e(`div`,Se,[e(`div`,Ce,[e(`span`,we,i(t.$t(`luma.name.loop`)),1),a(d,{content:t.$t(`luma.description.loop`)},null,8,[`content`])]),e(`div`,Te,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var De=w(be,[[`render`,Ee]]),Oe=_({name:`EndImage`,components:{ElUpload:v,ElButton:T,ImagePreview:R,InfoIcon:V,FontAwesomeIcon:F},mixins:[P,j],data(){return{fileList:[],uploadUrl:k()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onExceed(){M.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){M.error(this.$t(`luma.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ke={class:`relative`},Ae={class:`flex justify-between`},je={class:`flex justify-start items-center`},Me={class:`text-sm font-bold`};function Ne(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,ke,[e(`div`,Ae,[e(`div`,je,[e(`span`,Me,i(t.$t(`luma.name.endImageUrl`)),1),a(g,{content:t.$t(`luma.description.endImageUrl`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:5,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(h(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`luma.button.uploadEndImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Pe=w(Oe,[[`render`,Ne],[`__scopeId`,`data-v-cd768b26`]]),Fe=_({name:`StartImage`,components:{ElUpload:v,ElButton:T,ImagePreview:R,InfoIcon:V,FontAwesomeIcon:F},mixins:[P,j],data(){return{fileList:[],uploadUrl:k()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){M.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){M.error(this.$t(`luma.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Ie={class:`relative`},Le={class:`flex justify-between`},Re={class:`flex justify-start items-center`},ze={class:`text-sm font-bold`};function Be(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Ie,[e(`div`,Le,[e(`div`,Re,[e(`span`,ze,i(t.$t(`luma.name.startImageUrl`)),1),a(g,{content:t.$t(`luma.description.startImageUrl`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:5,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`luma.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Ve=w(Fe,[[`render`,Be],[`__scopeId`,`data-v-4d03e978`]]),He=_({name:`UploadVideo`,components:{ElUpload:v,ElButton:T,InfoIcon:V,FilePreview:L,FontAwesomeIcon:F},mixins:[j],data(){return{fileList:[],uploadUrl:k()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.luma?.config?.video_url},set(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||=void 0},methods:{onExceed(){M.warning(this.$t(`luma.message.uploadVideoExceed`))},onError(){M.error(this.$t(`luma.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`,n=e.size/1024/1024<10;return t?n?!0:(M.error(this.$t(`luma.message.uploadVideoSizeExceed`)),!1):(M.error(this.$t(`luma.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e,action:`extend`})},async onSuccess(){this.onSetVideoUrl()}}}),Ue={class:`relative`},We={class:`flex justify-between`},Ge={class:`flex justify-start items-center`},Ke={class:`text-sm font-bold`};function qe(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`file-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Ue,[e(`div`,We,[e(`div`,Ge,[e(`span`,Ke,i(t.$t(`luma.name.videoUrl`)),1),a(g,{content:t.$t(`luma.description.videoUrl`)},null,8,[`content`])])]),a(b,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`luma.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Je=w(He,[[`render`,qe],[`__scopeId`,`data-v-b4c637fa`]]),Ye=_({name:`PromptInput`,components:{PromptTextarea:J},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Xe(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`luma.name.prompt`),info:e.$t(`luma.description.prompt`),placeholder:e.$t(`luma.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ze=w(Ye,[[`render`,Xe]]),Qe=_({name:`ExtendFromInput`,components:{VideoPlayer:G},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.luma?.config}}}),$e={class:`relative`},et={class:`flex mb-2`},tt={class:`text-sm font-bold`};function nt(t,n,r,a,c,u){let d=l(`video-player`);return h(),s(`div`,$e,[e(`div`,et,[e(`span`,tt,i(t.$t(`luma.name.extend`)),1)]),e(`div`,null,[t.config?.video_url?(h(),f(d,{key:0,src:t.config?.video_url},null,8,[`src`])):o(``,!0)])])}var rt=_({name:`ConfigPanel`,components:{LoopSelector:De,StartImageInput:Ve,EndImageInput:Pe,EnhancementSelector:de,ElButton:T,FontAwesomeIcon:F,PromptInput:Ze,ExtendFromInput:w(Qe,[[`render`,nt]]),CustomSelector:ye,UploadVideo:Je,Consumption:B},emits:[`generate`],computed:{config(){return this.$store.state.luma?.config},consumption(){return A(this.config,this.service?.cost)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),it={class:`flex flex-col h-full`},at={class:`flex-1 overflow-y-auto p-5`},ot={class:`flex flex-col items-center justify-center px-5 pb-5`};function st(t,n,c,u,d,m){let g=l(`extend-from-input`),_=l(`prompt-input`),v=l(`custom-selector`),y=l(`upload-video`),b=l(`start-image-input`),x=l(`end-image-input`),S=l(`enhancement-selector`),C=l(`loop-selector`),w=l(`consumption`),T=l(`font-awesome-icon`),E=l(`el-button`);return h(),s(`div`,it,[e(`div`,at,[t.config?.video_id||t.config?.video_url?(h(),f(g,{key:0,class:`mb-4`})):o(``,!0),a(_,{class:`mb-4`}),t.config?.video_id?o(``,!0):(h(),f(v,{key:1,class:`mb-4`})),t.config?.custom?(h(),f(y,{key:2,class:`mb-4`})):o(``,!0),!(t.config?.video_id||t.config?.video_url)&&!t.config?.custom?(h(),f(b,{key:3,class:`mb-4`})):o(``,!0),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`})]),e(`div`,ot,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(h(),f(E,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`luma.button.extend`)),1)]),_:1},8,[`onClick`])):(h(),f(E,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`luma.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var ct=w(rt,[[`render`,st]]),lt=_({name:`TaskPreview`,components:{ElImage:b,CopyToClipboard:I,FontAwesomeIcon:F,ElAlert:x,VideoPlayer:G,ElTooltip:y,ElButton:T,ApiCodeButton:K},props:{modelValue:{type:Object,required:!0}},emits:[`extend`],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{onExtend(e,t){console.debug(`set config`,t),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_id:t.video_id,prompt:t.prompt,action:`extend`,thumbnail_url:t.thumbnail_url,video_url:t.video_url}),this.$emit(`extend`)},onDownload(e){window.open(e,`_blank`)}}}),ut={class:`preview`},dt={class:`left`},ft={class:`main`},pt={class:`bot`},mt={class:`datetime`},ht={class:`info`},gt={key:0,class:`prompt mt-2`},_t={key:0},vt={key:1},yt={key:0,class:n({content:!0,failed:!0})},bt={key:0,class:`mb-4`},xt={key:1,class:n({operations:!0,"mt-2":!0,"mb-4":!0})},St={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ct={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},wt={key:1,class:n({content:!0})},Tt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ot={key:2,class:n({content:!0})},kt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function At(n,c,u,d,f,m){let g=l(`el-image`),_=l(`video-player`),v=l(`el-button`),y=l(`el-tooltip`),b=l(`api-code-button`),x=l(`font-awesome-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`);return h(),s(`div`,ut,[e(`div`,dt,[a(g,{src:`https://cdn.acedata.cloud/ahjfwi.png`,class:`avatar`})]),e(`div`,ft,[e(`div`,pt,[r(i(n.$t(`luma.name.lumaBot`))+` `,1),e(`span`,mt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,ht,[n.modelValue?.request?.prompt?(h(),s(`p`,gt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,_t,` - (`+i(n.$t(`luma.status.pending`))+`) `,1)),n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`span`,vt,` - (`+i(n.$t(`luma.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,yt,[n.modelValue.response.video_url?(h(),s(`div`,bt,[a(_,{src:n.modelValue.response.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response&&!n.config?.custom?(h(),s(`div`,xt,[a(y,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.extendVideo`),placement:`top-start`},{default:p(()=>[a(v,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=t(e=>n.onExtend(e,n.modelValue?.response),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.extend`)),1)]),_:1})]),_:1},8,[`content`]),a(y,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(v,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onDownload(n.modelValue?.response?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(b,{path:`/luma/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,St,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Ct,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.state===`failed`||n.modelValue?.response?.success===!1?(h(),s(`div`,wt,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.failure`)),1)]),default:p(()=>[e(`p`,Tt,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Et,[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,$,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,Dt,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.traceId`))+`: `+i(n.modelValue?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),!n.modelValue?.response||n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`div`,Ot,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.failure`)),1)]),default:p(()=>[e(`p`,kt,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var jt=_({name:`RecentPanel`,components:{BotPlaceholder:q,TaskPreview:w(lt,[[`render`,At],[`__scopeId`,`data-v-9c354ffe`]]),NoTasks:U,ScrollList:H},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`,`extend`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Mt={key:0},Nt={key:2,class:`w-full h-full flex items-center justify-center`};function Pt(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Mt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[1]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,n=>(h(),f(g,{key:n.id,"model-value":n,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Nt,[a(v)])):o(``,!0)],64)}var Ft=_({name:`LumaIndex`,components:{ConfigPanel:ct,Layout:re,RecentPanel:w(jt,[[`render`,Pt]])},mixins:[O],inject:[`initialized`],emits:[`extend`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.luma?.status?.getApplications===E.Request},tasksLoading(){return this.$store.state.luma?.status?.getTasks===E.Request||this.fetchingTasks},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await W({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`luma/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`luma/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){console.debug(`scrolling down`),await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`luma/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!te(this.uploadTracker,e=>this.$t(e),e=>M.warning(e)))return;let e={...this.config,async:!0};if(!this.hasText(e.prompt)){M.error(this.$t(`luma.message.promptRequired`));return}if(e.prompt=e.prompt?.trim(),!D())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}M.info(this.$t(`luma.message.startingTask`)),N(`luma`,ee.generate(e,{token:t})).then(()=>{M.success(this.$t(`luma.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?M.error(this.$t(`luma.message.usedUp`)):M.error(this.$t(`luma.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0}}});function It(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`loading`,`onReachTop`])]),_:1})}var Lt=w(Ft,[[`render`,It]]);export{Lt as default};