@acedatacloud/nexior 3.321.2 → 3.321.3

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 (151) hide show
  1. package/dist/assets/{ApiCodeButton-BvZxMZTH.js → ApiCodeButton-BSIwtZSr.js} +1 -1
  2. package/dist/assets/{Artifacts-EW-TFQzC.js → Artifacts-Cx39mn2A.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-DXvb5dvg.js → AskUserQuestionCard-C-mKX7Zy.js} +1 -1
  4. package/dist/assets/{Auth-De9w2Byk.js → Auth-Bry8235m.js} +1 -1
  5. package/dist/assets/{Bare-w-mDmV04.js → Bare-Cd0qixeZ.js} +1 -1
  6. package/dist/assets/{BotPlaceholder-D0xi2CsK.js → BotPlaceholder-CQK6dyT8.js} +1 -1
  7. package/dist/assets/{BottomFooter-BCX_oSt5.js → BottomFooter-7P6Xa6vL.js} +1 -1
  8. package/dist/assets/{Callback-B_UFUNZs.js → Callback-DSeU8UgL.js} +1 -1
  9. package/dist/assets/{CodeSnippet-DHYLghyA.js → CodeSnippet-7i9qUNkT.js} +1 -1
  10. package/dist/assets/{Console-DAlxmMwL.js → Console-DjIoOclm.js} +1 -1
  11. package/dist/assets/{Consumption-Dug1KpQy.js → Consumption-BbXEEfaa.js} +1 -1
  12. package/dist/assets/{Conversation-BfRVb85e.js → Conversation-D7i5pJ7-.js} +1 -1
  13. package/dist/assets/{Conversation-BIjIYTYL.js → Conversation-DU_KiSmj.js} +1 -1
  14. package/dist/assets/{CopyToClipboard-Dck5vBxW.js → CopyToClipboard-CU8Wt48G.js} +1 -1
  15. package/dist/assets/{Detail-Yx6eKOLw.js → Detail-fNFxltC3.js} +2 -2
  16. package/dist/assets/{Extra-i-xx4dcs.js → Extra-B4M5df76.js} +1 -1
  17. package/dist/assets/{FilePreview-CRNmVlzf.js → FilePreview-BeZjSmNt.js} +1 -1
  18. package/dist/assets/{Hailuo-BmpeCWK3.js → Hailuo-8g2dSm0u.js} +1 -1
  19. package/dist/assets/{History-BqtkaoPW.js → History-B-3lc7xm.js} +1 -1
  20. package/dist/assets/{ImagePreview-CAc8PlWR.js → ImagePreview-CeVbAkCH.js} +1 -1
  21. package/dist/assets/{ImageWrapper-Ry476ooj.js → ImageWrapper-DUxq5_k1.js} +1 -1
  22. package/dist/assets/{Index-DbolPS5a.js → Index-0jPIG5CH.js} +1 -1
  23. package/dist/assets/{Index-D0d2_NCt.js → Index-B7j0EQBP.js} +1 -1
  24. package/dist/assets/{Index-CHL03xvD.js → Index-BFhoP7ZF.js} +1 -1
  25. package/dist/assets/{Index-DFr91bKb.js → Index-BSWC2HQs.js} +1 -1
  26. package/dist/assets/{Index-DuscjAwS.js → Index-BcexC8jj.js} +1 -1
  27. package/dist/assets/{Index-dugV8AGu.js → Index-Bt7MM_Do.js} +1 -1
  28. package/dist/assets/{Index-BwmbDTIJ.js → Index-BwqsZ1k-.js} +1 -1
  29. package/dist/assets/{Index-BRYxjxIg.js → Index-C48BzbO9.js} +1 -1
  30. package/dist/assets/{Index-NAm7ncXG.js → Index-C_5IiyPG.js} +1 -1
  31. package/dist/assets/{Index-B5tc4Es1.js → Index-CahhcmWE.js} +1 -1
  32. package/dist/assets/{Index-BwgoTHR2.js → Index-Ccz5hygx.js} +1 -1
  33. package/dist/assets/{Index-BvAVurZA.js → Index-CfYqN18q.js} +1 -1
  34. package/dist/assets/{Index-CIuq-Dut.js → Index-Cl2UBYVD.js} +1 -1
  35. package/dist/assets/{Index-CFX9Rs7k.js → Index-Cl49huqF.js} +1 -1
  36. package/dist/assets/{Index-D4bkohm7.js → Index-CwHgU4DA.js} +1 -1
  37. package/dist/assets/{Index-Chbu_REr.js → Index-CxJRU1t2.js} +1 -1
  38. package/dist/assets/{Index-CLDATOT2.js → Index-D6yRoKdl.js} +1 -1
  39. package/dist/assets/{Index-Den27Thd.js → Index-DC1Lk2pO.js} +1 -1
  40. package/dist/assets/{Index-B-9sU9X4.js → Index-DR1drXfp.js} +1 -1
  41. package/dist/assets/{Index-Cge7IjV5.js → Index-D_Or7qDi.js} +1 -1
  42. package/dist/assets/{Index-B3lCHoBi.js → Index-DkOOLfXy.js} +1 -1
  43. package/dist/assets/{Index-BNsvB66G.js → Index-DzNFa6Nd.js} +1 -1
  44. package/dist/assets/{Index-aNoxkk7V.js → Index-T4MzLzu6.js} +1 -1
  45. package/dist/assets/{Index-DDIQOoEA.js → Index-ZEX2E0eV.js} +1 -1
  46. package/dist/assets/{Index-Dux69xGf.js → Index-ai8SC74l.js} +1 -1
  47. package/dist/assets/{Index-CYAemxWU.js → Index-ef5GindD.js} +1 -1
  48. package/dist/assets/{Index-B5cPdMCN.js → Index-hVtDovEP.js} +1 -1
  49. package/dist/assets/{Index-D7ImHubk.js → Index-sO3HcP2m.js} +1 -1
  50. package/dist/assets/{Invitees-CgXO0ll9.js → Invitees-BwmIdCYG.js} +1 -1
  51. package/dist/assets/{List-CZFJvzZZ.js → List-BU3eZiaK.js} +1 -1
  52. package/dist/assets/{List-CVFyZgNt.js → List-CY_cphw6.js} +1 -1
  53. package/dist/assets/{List-DTbQc9vp.js → List-DFsb0iFM.js} +1 -1
  54. package/dist/assets/{LocalTools-D2k18GLw.js → LocalTools-D3eOT6TY.js} +1 -1
  55. package/dist/assets/{LocalTools-u-dJmBc4.js → LocalTools-DV8liXGS.js} +1 -1
  56. package/dist/assets/{Main-DnCDGePR.js → Main-CvyteOzz.js} +1 -1
  57. package/dist/assets/{Message-DNm9Pq44.js → Message-C8VvOUa1.js} +1 -1
  58. package/dist/assets/{Model-va6D1uPH.js → Model-a_t5uFzA.js} +1 -1
  59. package/dist/assets/{Navigator-C7kPlTB0.js → Navigator-BsqsWNay.js} +3 -3
  60. package/dist/assets/{NoTasks-RVBrZ_bb.js → NoTasks-BiT26E2U.js} +1 -1
  61. package/dist/assets/{NotFound-D53_ceUZ.js → NotFound-WZW3QW_5.js} +1 -1
  62. package/dist/assets/{Pagination-BFyU2ccT.js → Pagination-B9c--E04.js} +1 -1
  63. package/dist/assets/{Pay-DfDaOZ0-.js → Pay-BnJFA1iM.js} +1 -1
  64. package/dist/assets/{Player-CekOtYKP.js → Player-Bs0yl8MR.js} +1 -1
  65. package/dist/assets/{PromptTextarea-gzCu7teW.js → PromptTextarea-Da3Adw2P.js} +1 -1
  66. package/dist/assets/{RealtimeCall-OXA6qrsg.js → RealtimeCall-oH2WzVSw.js} +1 -1
  67. package/dist/assets/{ScheduledTasks-CAFxHjCt.js → ScheduledTasks-miSI30QD.js} +1 -1
  68. package/dist/assets/{Status-BIPJT7fQ.js → Status-DSHPorh0.js} +1 -1
  69. package/dist/assets/{Subscribe-ByxvwQ3j.js → Subscribe-DB-vjqgd.js} +1 -1
  70. package/dist/assets/{TabSwitcher-CYeRK9Qj.js → TabSwitcher-BPGI5ceh.js} +1 -1
  71. package/dist/assets/{Tts-CJ-yWbWY.js → Tts-Hu1qhnPM.js} +1 -1
  72. package/dist/assets/{VideoPlayer-V3up_w3_.js → VideoPlayer-0hcpcBnn.js} +1 -1
  73. package/dist/assets/{VideoPreview-DtU2IjC-.js → VideoPreview-CVY_SZay.js} +1 -1
  74. package/dist/assets/{alert-Dd1AiDUe.js → alert-BP_NaFjc.js} +1 -1
  75. package/dist/assets/{avatar-D6uOB0Ud.js → avatar-62CXrKwb.js} +1 -1
  76. package/dist/assets/{basic-CKPXBbQp.js → basic-G8l4wBxr.js} +1 -1
  77. package/dist/assets/chat-BvGrxUT_.js +1 -0
  78. package/dist/assets/{chat-BGfo0nOf.js → chat-D0g7Vr88.js} +1 -1
  79. package/dist/assets/chat-D5HahGzg.js +1 -0
  80. package/dist/assets/{codingBridge-CGGqeZsJ.js → codingBridge-CKFNLAVK.js} +1 -1
  81. package/dist/assets/{codingBridgeNotify-kUv9z-Hj.js → codingBridgeNotify-Ds9Wv8hB.js} +2 -2
  82. package/dist/assets/{collapse-BDr5Tax1.js → collapse-CPf_gnA_.js} +1 -1
  83. package/dist/assets/{constants-cSF5AGUI.js → constants-2P9-grH4.js} +1 -1
  84. package/dist/assets/{createTaskActions-wRLojnDz.js → createTaskActions-Bng2sDrj.js} +1 -1
  85. package/dist/assets/{date-picker-B5Tqi03B.js → date-picker-DYM39a2Q.js} +1 -1
  86. package/dist/assets/{digitalhuman-8Wo9z_Jx.js → digitalhuman-ChYWqlXl.js} +1 -1
  87. package/dist/assets/{drawer-BwzaUz3d.js → drawer-CBfe4XvW.js} +1 -1
  88. package/dist/assets/{dropdown-CVMzYtIU.js → dropdown-2tAG_uuv.js} +1 -1
  89. package/dist/assets/{dropdown-Z0XE_A0a.js → dropdown-CcmAxxsP.js} +1 -1
  90. package/dist/assets/{esm-Dt7DxaNd.js → esm-19KMw_5P.js} +1 -1
  91. package/dist/assets/{esm-58oUtDGY.js → esm-BEkC_Kvc.js} +2 -2
  92. package/dist/assets/{esm-XVrjJT2X.js → esm-BqcPqWRa.js} +1 -1
  93. package/dist/assets/{esm-D8c1vb3l.js → esm-DD_kWip3.js} +1 -1
  94. package/dist/assets/{esm-DEBwYgHl.js → esm-DI0Yms6T.js} +2 -2
  95. package/dist/assets/esm-Dr-VDKYM.js +1 -0
  96. package/dist/assets/{esm-CtbzxB4u.js → esm-FWxkAh0K.js} +3 -3
  97. package/dist/assets/{fish-B8R5RzC4.js → fish-GOYoPFWJ.js} +1 -1
  98. package/dist/assets/{flux-Bj9Q3ZhV.js → flux-nfk9v2uU.js} +1 -1
  99. package/dist/assets/{grokvideo-ZF20MlRM.js → grokvideo-BAeuQ94c.js} +1 -1
  100. package/dist/assets/{hailuo-0LVSpj8A.js → hailuo-BLtqQBq0.js} +1 -1
  101. package/dist/assets/{headshots-CBOVe_11.js → headshots-CIAN_fIt.js} +1 -1
  102. package/dist/assets/{i18n-27iZn9gb.js → i18n-CRB-G8bn.js} +1 -1
  103. package/dist/assets/{image-qteqPy5H.js → image-CCLzQcZ9.js} +1 -1
  104. package/dist/assets/index-DYp9zzBh.js +570 -0
  105. package/dist/assets/{index.browser.esm-BvIffV5d.js → index.browser.esm-D1KC4gtK.js} +1 -1
  106. package/dist/assets/{index.es-oPc3AvSO.js → index.es-AcnoqPen.js} +1 -1
  107. package/dist/assets/{input-number-DClree2G.js → input-number-D1J0aWlh.js} +1 -1
  108. package/dist/assets/{kling-CPKPey_t.js → kling-BPjc2G2v.js} +1 -1
  109. package/dist/assets/{luma-D15qbJVx.js → luma-bvtcLrrp.js} +1 -1
  110. package/dist/assets/{maestro-BUOLk_kM.js → maestro-BNhanteN.js} +1 -1
  111. package/dist/assets/{midjourney-O2Y44jrv.js → midjourney-DPZK-fhb.js} +1 -1
  112. package/dist/assets/{mobileLocalExec-CQxhg18r.js → mobileLocalExec-scwAmVzL.js} +2 -2
  113. package/dist/assets/{nanobanana-DGb3Pl_a.js → nanobanana-l3b1YASY.js} +1 -1
  114. package/dist/assets/{openaiimage-CEJpTrfR.js → openaiimage-DtFLOUme.js} +1 -1
  115. package/dist/assets/{pagination-Cf6OU6TC.js → pagination-D3yr6QMB.js} +1 -1
  116. package/dist/assets/{pika-B5SfmstB.js → pika-BJyEKZsF.js} +1 -1
  117. package/dist/assets/{pixverse-Ygu03i_5.js → pixverse-CYP26BAw.js} +1 -1
  118. package/dist/assets/{popover-DgohGDWM.js → popover-DRg-0IQQ.js} +1 -1
  119. package/dist/assets/{producer-zePyQeHm.js → producer-BjcAaWmU.js} +1 -1
  120. package/dist/assets/{qrart-DhxPyTD-.js → qrart-CAFXXKgD.js} +1 -1
  121. package/dist/assets/{realtime-B9Z42aIg.js → realtime-x884XAYn.js} +1 -1
  122. package/dist/assets/{row-DnSqsbqr.js → row-CWb18ts7.js} +1 -1
  123. package/dist/assets/{seedance-C9A6jD6U.js → seedance-Bj5bZtPT.js} +1 -1
  124. package/dist/assets/{seedream-C_0l8MES.js → seedream-DqIK9iNq.js} +1 -1
  125. package/dist/assets/{select-D51kt1Zz.js → select-CTDC5uOC.js} +1 -1
  126. package/dist/assets/{serp-CZ3PVfii.js → serp-CjXQi2D4.js} +1 -1
  127. package/dist/assets/{slider-CyhY5gD6.js → slider-CnUiskZP.js} +1 -1
  128. package/dist/assets/{solana-wallets-BKsmsHO2.js → solana-wallets-BtZBpcmZ.js} +2 -2
  129. package/dist/assets/{solana-wallets-vue-BDFT9grA.js → solana-wallets-vue-DxXjLDZl.js} +1 -1
  130. package/dist/assets/{sora-DNM9gJF2.js → sora-DM9zVhVM.js} +1 -1
  131. package/dist/assets/{suno-c8ol7tXD.js → suno-Do4wznc8.js} +1 -1
  132. package/dist/assets/{switch-B-0uKYNM.js → switch-C8ewwQQI.js} +1 -1
  133. package/dist/assets/{table-DziuQ1uS.js → table-Cluqi0cG.js} +1 -1
  134. package/dist/assets/{tabs-DQMZGmkq.js → tabs--OFxJ-3l.js} +1 -1
  135. package/dist/assets/{time-picker-BOcFsJXS.js → time-picker-ByuXjWzs.js} +1 -1
  136. package/dist/assets/{tooltip-CJVX4lE9.js → tooltip-DzkWi5KW.js} +1 -1
  137. package/dist/assets/{upload-D94R1Rp8.js → upload-BtRsvcZP.js} +1 -1
  138. package/dist/assets/{veo-BRPRd1Ay.js → veo-CmBSr8Uy.js} +1 -1
  139. package/dist/assets/{wan-CBiEzeSI.js → wan-BXMtZFEl.js} +1 -1
  140. package/dist/assets/{web-BdjZG5Er.js → web-BCuyGGIl.js} +1 -1
  141. package/dist/assets/{web-DMbmGqbl.js → web-BcI4bkSJ.js} +1 -1
  142. package/dist/assets/{web-C3YBWnzg.js → web-DfzKIplp.js} +1 -1
  143. package/dist/assets/{web-Squj3Uzy.js → web-GtXLM6Ah.js} +1 -1
  144. package/dist/assets/{web-B2rjsS88.js → web-n3jHdbzt.js} +1 -1
  145. package/dist/assets/{webextrator-CStuy-KW.js → webextrator-DFIzAacI.js} +1 -1
  146. package/dist/index.html +3 -3
  147. package/package.json +1 -1
  148. package/dist/assets/chat-BsXC0hYB.js +0 -1
  149. package/dist/assets/chat-DgM3ljBB.js +0 -1
  150. package/dist/assets/esm-By2REu6v.js +0 -1
  151. package/dist/assets/index-CHBZTxdB.js +0 -570
@@ -1 +1 @@
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{E as y}from"./use-deprecated-B-uvyrTL.js";import{r as b,t as x}from"./select-D51kt1Zz.js";import{n as S,t as C}from"./tabs-DQMZGmkq.js";import{t as w}from"./upload-D94R1Rp8.js";import{t as T}from"./tooltip-CJVX4lE9.js";import{t as E}from"./image-qteqPy5H.js";import{t as ee}from"./alert-Dd1AiDUe.js";import{n as D,r as O}from"./radio-Bj0tEwH8.js";import{t as k}from"./drawer-BwzaUz3d.js";import{t as A}from"./input-number-DClree2G.js";import{t as te}from"./slider-CyhY5gD6.js";import{t as ne}from"./switch-B-0uKYNM.js";import{ci as re,ii as ie,li as j,si as ae}from"./constants-cSF5AGUI.js";import{A as M,Gr as N,Hr as oe,Ht as P,Kt as F,Pn as I,Si as L,Ut as se,Vt as R,Wt as z,di as ce,en as B,ni as V,nr as H,pi as U,ti as W}from"./index-CHBZTxdB.js";import{t as G}from"./index.es-oPc3AvSO.js";import{t as le}from"./CopyToClipboard-Dck5vBxW.js";import{t as ue}from"./FilePreview-CRNmVlzf.js";import{t as K}from"./ImagePreview-CAc8PlWR.js";import{n as de}from"./taskDrawerMixin-DyAUhFEq.js";import{t as q}from"./Consumption-Dug1KpQy.js";import{i as J,n as fe,t as pe}from"./pagination-Cf6OU6TC.js";import{t as me}from"./VideoPlayer-V3up_w3_.js";import{t as he}from"./ApiCodeButton-BvZxMZTH.js";import{t as ge}from"./BotPlaceholder-D0xi2CsK.js";import{t as _e}from"./NoTasks-RVBrZ_bb.js";import{t as ve}from"./PromptTextarea-gzCu7teW.js";var ye=v({name:`LayoutKling`,components:{ElDrawer:k,ElButton:U,FontAwesomeIcon:G},mixins:[de]}),be={class:`main flex flex-row flex-1 min-h-0`},xe={class:`config w-[320px] flex-none h-full flex flex-col 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,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,be,[e(`div`,xe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Se,[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 we=M(ye,[[`render`,Ce],[`__scopeId`,`data-v-b87958dc`]]),Te={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};function Y(e,t,n){let r=t||`std`,i=n??5;switch(e){case`kling-v1`:return{text2video:!0,image2video:!0,endImage:i===5,audio:!1,motionControl:i===5};case`kling-v1-6`:case`kling-v2-5-turbo`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:!1,motionControl:!1};case`kling-v2-6`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:r===`pro`,motionControl:!1};case`kling-v2-master`:case`kling-v2-1-master`:return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};case`kling-v3`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:r!==`4k`};case`kling-v3-omni`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1};case`kling-video-o1`:return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1};default:return Te}}function X(e,t){if(!e)return[];let n=t.model??e.model,r=t.mode??e.mode,i=t.duration??e.duration;if(!n)return[];let a=Y(n,r,i),o=[];return e.end_image_url&&!a.endImage&&o.push({field:`end_image_url`,i18nLabel:`kling.name.endImage`}),e.generate_audio&&!a.audio&&o.push({field:`generate_audio`,i18nLabel:`kling.name.generateAudio`}),e.camera_control?.type&&(!a.motionControl||e.start_image_url)&&o.push({field:`camera_control`,i18nLabel:`kling.name.cameraControl`}),o}function Z(e,t){let n={...e};for(let e of t)e.field===`end_image_url`&&(n.end_image_url=void 0),e.field===`generate_audio`&&(n.generate_audio=!1),e.field===`camera_control`&&(n.camera_control=void 0);return n}var Ee=v({name:`ModelSelector`,components:{ElSelect:b,ElOption:x},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{revertKey:0,options:[{value:`kling-v3`,label:`v3`},{value:`kling-v3-omni`,label:`v3-Omni`},{value:`kling-v2-6`,label:`v2.6`},{value:`kling-v2-5-turbo`,label:`v2.5-Turbo`},{value:`kling-v2-1-master`,label:`v2.1-Master`},{value:`kling-v2-master`,label:`v2-Master`},{value:`kling-v1-6`,label:`v1.6`},{value:`kling-v1`,label:`v1`},{value:`kling-video-o1`,label:`Video-o1`}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(ie)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await W.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),V.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,model:e})}}}),De={class:`field`},Oe={class:`title font-bold`};function ke(t,n,r,a,o,u){let d=l(`el-option`),m=l(`el-select`);return g(),s(`div`,De,[e(`h2`,Oe,i(t.$t(`pika.name.model`)),1),(g(),f(m,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`pika.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(d,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Ae=M(Ee,[[`render`,ke],[`__scopeId`,`data-v-04059875`]]),je=v({name:`ModeSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:J},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},cameraControlSet(){return!!this.$store.state.kling?.config?.camera_control?.type},fourKReason(){return j.includes(this.selectedModel)?this.cameraControlSet?this.$t(`kling.description.mode4kIncompatibleCamera`):``:this.$t(`kling.description.mode4kRequiresV3`)},options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`),disabled:!1,disabledReason:``},{value:`pro`,label:this.$t(`kling.name.modePro`),disabled:!1,disabledReason:``},{value:`4k`,label:this.$t(`kling.name.mode4k`),disabled:!!this.fourKReason,disabledReason:this.fourKReason}]},value(){return this.$store.state.kling?.config?.mode}},watch:{fourKReason(e){e&&this.value===`4k`&&this.applyMode(`std`)}},mounted(){this.value||this.applyMode(`std`)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await W.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),V.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyMode(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,mode:e})}}}),Me={class:`field`},Ne={class:`header`},Pe={class:`title font-bold`},Fe={key:0,class:`opt-tip`};function Ie(t,r,u,d,m,_){let v=l(`info-icon`),y=l(`el-option`),b=l(`el-select`);return g(),s(`div`,Me,[e(`div`,Ne,[e(`h2`,Pe,i(t.$t(`kling.name.mode`)),1),a(v,{content:t.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(g(),f(b,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`kling.placeholder.select`),clearable:!0,onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(y,{key:t.value,label:t.label,value:t.value,disabled:t.disabled},{default:p(()=>[e(`span`,{class:n({"opt-disabled":t.disabled})},i(t.label),3),t.disabled&&t.disabledReason?(g(),s(`span`,Fe,i(t.disabledReason),1)):o(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Le=M(je,[[`render`,Ie],[`__scopeId`,`data-v-9a8fa3c5`]]),Re=[3,5,8,10,12,15],ze=[5,10],Be=v({name:`DurationSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:J},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return j.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?Re:ze},value(){return this.$store.state.kling?.config?.duration??5},selectValue(){let e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(5)?5:e[0]}},watch:{isV3Model(){this.allowedDurations.includes(this.value)||this.applyDuration(5)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(5)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await W.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),V.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyDuration(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,duration:e})}}}),Ve={class:`field`},He={class:`control`},Ue={class:`label`},We={class:`title font-bold`};function Ge(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Ve,[e(`div`,He,[e(`div`,Ue,[e(`h2`,We,i(t.$t(`kling.name.duration`)),1),a(m,{content:t.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(g(),f(v,{key:t.revertKey,"model-value":t.selectValue,class:`value`,placeholder:t.$t(`kling.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.allowedDurations,e=>(g(),f(_,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var Ke=M(Be,[[`render`,Ge],[`__scopeId`,`data-v-5ae55e28`]]),qe=v({name:`RatioSelector`,data(){return{options:[{value:`1:1`,label:`1:1`,width:20,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?.kling?.config?.aspect_ratio},set(e){console.debug(`set ratio`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||=`1:1`}}),Je={class:`text-sm font-bold mb-2 block`},Ye={class:`items`},Xe=[`onClick`],Ze={class:`name`};function Qe(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,Je,i(t.$t(`kling.name.ratio`)),1),e(`div`,Ye,[(g(!0),s(c,null,h(t.options,(r,a)=>(g(),s(`div`,{key:a,class:n({active:t.active===a,item:!0}),onClick:e=>t.value=r.value},[e(`div`,{class:n([`preview`,r.label])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,Ze,i(r.label),1)],10,Xe))),128))])])}var $e=M(qe,[[`render`,Qe],[`__scopeId`,`data-v-cdb14b2f`]]),et=v({name:`StartImage`,components:{ElUpload:w,ElButton:U,ElTooltip:T,InfoIcon:J,FontAwesomeIcon:G,ImagePreview:K},mixins:[z,P],emits:[`change`],data(){return{fileList:[],uploadUrl:N()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),tt={class:`relative`},nt={class:`flex justify-between`},rt={class:`flex justify-start items-center`},it={class:`text-sm font-bold`};function at(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-tooltip`),x=l(`el-upload`);return g(),s(`div`,tt,[e(`div`,nt,[e(`div`,rt,[e(`span`,it,i(t.$t(`kling.name.startImage`)),1),a(h,{content:t.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),a(x,{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,disabled:t.reachedLimit,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?(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(b,{content:t.$t(`kling.message.uploadReferencesExceed`),disabled:!t.reachedLimit,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.reachedLimit},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var ot=M(et,[[`render`,at],[`__scopeId`,`data-v-756dc269`]]),st=v({name:`EndImage`,components:{ElUpload:w,ElButton:U,ElTooltip:T,ImagePreview:K,InfoIcon:J,FontAwesomeIcon:G},mixins:[z,P],data(){return{fileList:[],uploadUrl:N()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},klingConfig(){return this.$store.state?.kling?.config||{}},endImageSupported(){return Y(this.klingConfig.model,this.klingConfig.mode,this.klingConfig.duration).endImage},hasStartImage(){return!!this.klingConfig.start_image_url},uploadDisabled(){return this.reachedLimit||!this.endImageSupported||!this.hasStartImage},uploadTooltip(){return this.endImageSupported?this.hasStartImage?this.reachedLimit?this.$t(`kling.message.uploadReferencesExceed`):``:this.$t(`kling.message.endImageRequiresStart`):this.$t(`kling.message.endImageNotSupported`)},storeValue(){return this.klingConfig.end_image_url},value:{get(){return this.storeValue},set(){}}},watch:{storeValue(e){!e&&this.fileList.length>0&&(this.fileList=[])},hasStartImage(e){!e&&this.storeValue&&(this.fileList=[],this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:void 0}))}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onBeforeUpload(){return this.endImageSupported?this.hasStartImage?!0:(V.warning(this.$t(`kling.message.endImageRequiresStart`)),!1):(V.warning(this.$t(`kling.message.endImageNotSupported`)),!1)},onExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ct={class:`relative`},lt={class:`flex justify-between`},ut={class:`flex justify-start items-center`},dt={class:`text-sm font-bold`};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-tooltip`),x=l(`el-upload`);return g(),s(`div`,ct,[e(`div`,lt,[e(`div`,ut,[e(`span`,dt,i(t.$t(`kling.name.endImage`)),1),a(h,{content:t.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),a(x,{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,disabled:t.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"before-upload":t.onBeforeUpload,"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?(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(b,{content:t.uploadTooltip,disabled:!t.uploadDisabled,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.uploadDisabled},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var pt=M(st,[[`render`,ft],[`__scopeId`,`data-v-c1b257e5`]]),mt=v({name:`CfgScaleSelector`,components:{ElSlider:te,InfoIcon:J,ElInputNumber:A},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug(`set cfg_scale`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||=0}}),ht={class:`flex justify-between`},gt={class:`flex justify-start items-center`},_t={class:`text-sm font-bold`},vt={class:`flex justify-end items-center`},yt={class:`w-full`};function bt(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`),p=l(`el-slider`);return g(),s(`div`,null,[e(`div`,ht,[e(`div`,gt,[e(`span`,_t,i(t.$t(`kling.name.cfgScale`)),1),a(d,{content:t.$t(`kling.description.cfgScale`)},null,8,[`content`])]),e(`div`,vt,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,yt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var xt=M(mt,[[`render`,bt]]),St=v({name:`GenerateAudioSelector`,components:{ElSwitch:ne,InfoIcon:J},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(j.includes(this.selectedModel)||this.selectedModel===`kling-v2-6`&&this.selectedMode===`pro`)},tooltipContent(){return this.supported?this.$t(`kling.description.generateAudio`):this.$t(`kling.description.generateAudioUnsupported`)},value:{get(){return this.supported?this.$store.state.kling?.config?.generate_audio??!1:!1},set(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,generate_audio:e})}}},watch:{supported(e){!e&&this.$store.state.kling?.config?.generate_audio&&this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,generate_audio:!1})}}}),Ct={class:`relative`},wt={class:`flex justify-between items-center`},Tt={class:`flex justify-start items-center`},Et={class:`text-sm font-bold`};function Dt(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,Ct,[e(`div`,wt,[e(`div`,Tt,[e(`span`,Et,i(t.$t(`kling.name.generateAudio`)),1),a(d,{content:t.tooltipContent},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,disabled:!t.supported},null,8,[`modelValue`,`disabled`])])])}var Ot=M(St,[[`render`,Dt]]),kt=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],At=v({name:`CameraControlSelector`,components:{ElSelect:b,ElOption:x,ElSlider:te,ElInputNumber:A,InfoIcon:J},data(){return{configKeys:kt}},computed:{typeOptions(){return[{value:``,label:this.$t(`kling.name.cameraTypeNone`)},{value:`simple`,label:this.$t(`kling.name.cameraTypeSimple`)},{value:`down_back`,label:this.$t(`kling.name.cameraTypeDownBack`)},{value:`forward_up`,label:this.$t(`kling.name.cameraTypeForwardUp`)},{value:`left_turn_forward`,label:this.$t(`kling.name.cameraTypeLeftTurnForward`)},{value:`right_turn_forward`,label:this.$t(`kling.name.cameraTypeRightTurnForward`)}]},selectedMode(){return this.$store.state.kling?.config?.mode||``},selectedModel(){return this.$store.state.kling?.config?.model||``},selectedDuration(){return this.$store.state.kling?.config?.duration},motionControlSupported(){return Y(this.selectedModel,this.selectedMode,this.selectedDuration).motionControl},hasStartImage(){return!!this.$store.state.kling?.config?.start_image_url},disabled(){return!this.motionControlSupported||this.hasStartImage},tooltipContent(){return this.motionControlSupported?this.hasStartImage?this.$t(`kling.description.cameraControlDisabledImage2Video`):this.$t(`kling.description.cameraControl`):this.$t(`kling.description.cameraControlNotSupported`)},selectedType(){return this.$store.state.kling?.config?.camera_control?.type},selectedTypeRaw:{get(){return this.selectedType??``},set(e){let t=this.$store.state.kling?.config||{};if(!e){let e={...t};delete e.camera_control,this.$store.commit(`kling/setConfig`,e);return}let n=e;this.$store.commit(`kling/setConfig`,{...t,camera_control:{type:n,config:n===`simple`?t.camera_control?.config||{}:void 0}})}},configValues(){return this.$store.state.kling?.config?.camera_control?.config||{}}},watch:{disabled(e){e&&this.selectedType!==void 0&&(this.selectedTypeRaw=``)}},methods:{writeConfig(e,t){let n=this.$store.state.kling?.config||{},r=n.camera_control||{type:`simple`},i={...r.config||{}};t==null?delete i[e]:i[e]=t,this.$store.commit(`kling/setConfig`,{...n,camera_control:{...r,type:`simple`,config:i}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),jt={class:`field`},Mt={class:`header`},Nt={class:`text-sm font-bold`},Pt={key:0,class:`config-grid`},Ft={class:`cfg-row-head`},It={class:`cfg-name`};function Lt(t,n,r,u,d,m){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`),b=l(`el-input-number`),x=l(`el-slider`);return g(),s(`div`,jt,[e(`div`,Mt,[e(`span`,Nt,i(t.$t(`kling.name.cameraControl`)),1),a(_,{content:t.tooltipContent},null,8,[`content`])]),a(y,{modelValue:t.selectedTypeRaw,"onUpdate:modelValue":n[0]||=e=>t.selectedTypeRaw=e,class:`value`,placeholder:t.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:t.disabled},{default:p(()=>[(g(!0),s(c,null,h(t.typeOptions,e=>(g(),f(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),t.selectedType===`simple`&&!t.disabled?(g(),s(`div`,Pt,[(g(!0),s(c,null,h(t.configKeys,n=>(g(),s(`div`,{key:n,class:`cfg-row`},[e(`div`,Ft,[e(`span`,It,i(t.$t(`kling.name.cc_${n}`)),1),a(b,{modelValue:t.configValues[n],"onUpdate:modelValue":e=>t.configValues[n]=e,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:e=>t.onNumberChange(n,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),a(x,{"model-value":t.configValues[n]??0,min:-1,max:1,step:.1,onInput:e=>t.onSliderChange(n,e)},null,8,[`model-value`,`onInput`])]))),128))])):o(``,!0)])}var Rt=M(At,[[`render`,Lt],[`__scopeId`,`data-v-cd896060`]]),zt=[{groupKey:`cameraMovements`,chipKeys:[`rotateAround`,`stationary`,`handheld`,`zoomOut`,`zoomIn`,`follow`,`panRight`,`tiltUp`,`tiltDown`,`orbit`]},{groupKey:`cameraSpeed`,chipKeys:[`speedSlow`,`speedMedium`,`speedFast`]},{groupKey:`shotType`,chipKeys:[`shotClose`,`shotMedium`,`shotLong`,`shotLowAngle`,`shotHighAngle`,`shotShallowDof`,`shotFront`,`shotProfile`,`shotCloseUp`,`shotDrone`]},{groupKey:`light`,chipKeys:[`lightSunlight`,`lightSoft`,`lightNeon`,`lightWarm`,`lightNature`,`lightCandle`,`lightCityNight`]},{groupKey:`frame`,chipKeys:[`frameRichDetails`,`frameSimpleBg`]},{groupKey:`atmosphere`,chipKeys:[`atmosphereMysterious`,`atmospherePeaceful`,`atmosphereHeartwarming`,`atmosphereVivid`,`atmosphereColorful`]}],Q=`, `;function Bt(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${Q}${t}`:t}function $(e,t){if(!e||!t)return e||``;let n=[`${t}${Q}`,`${Q}${t}`,t],r=e;for(let e of n)if(r.includes(e)){r=r.replace(e,``);break}return r.replace(/(?:,\s*)+$/,``).replace(/^(?:,\s*)+/,``)}var Vt=v({name:`InspirationPills`,components:{FontAwesomeIcon:G},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return zt.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selected(){let e=this.prompt;if(!e)return[];let t=[];for(let n of this.allChipTexts){let r=e.indexOf(n);r!==-1&&t.push({text:n,idx:r})}return t.sort((e,t)=>e.idx-t.idx).map(e=>e.text)}},methods:{onRemove(e){let t=$(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),Ht={key:0,class:`pills`,role:`list`},Ut={class:`pill-text`},Wt=[`aria-label`,`onClick`];function Gt(n,r,u,d,f,p){let m=l(`font-awesome-icon`);return n.selected.length>0?(g(),s(`div`,Ht,[(g(!0),s(c,null,h(n.selected,r=>(g(),s(`div`,{key:r,class:`pill`,role:`listitem`},[e(`span`,Ut,i(r),1),e(`button`,{type:`button`,class:`pill-remove`,"aria-label":n.$t(`kling.inspiration.removeChip`),onClick:t(e=>n.onRemove(r),[`stop`])},[a(m,{icon:`fa-solid fa-xmark`})],8,Wt)]))),128))])):o(``,!0)}var Kt=v({name:`PromptInput`,components:{ElButton:U,FontAwesomeIcon:G,PromptTextarea:ve,InspirationPills:M(Vt,[[`render`,Gt],[`__scopeId`,`data-v-5fc4fa65`]])},emits:[`open-inspiration`],computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||=``}});function qt(e,t,n,o,s,c){let u=l(`font-awesome-icon`),d=l(`el-button`),m=l(`inspiration-pills`),h=l(`prompt-textarea`);return g(),f(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`kling.name.prompt`),info:e.$t(`kling.description.prompt`),placeholder:e.$t(`kling.placeholder.prompt`)},{actions:p(()=>[a(d,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:p(()=>[a(u,{icon:`fa-regular fa-lightbulb`,class:`mr-1`}),r(` `+i(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:p(()=>[a(m)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var Jt=M(Kt,[[`render`,qt],[`__scopeId`,`data-v-c01fc1a6`]]),Yt=v({name:`NegativePromptInput`,components:{ElInput:L,InfoIcon:J},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug(`set prompt`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||=``}}),Xt={class:`field`},Zt={class:`box`},Qt={class:`title font-bold`};function $t(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,Xt,[e(`div`,Zt,[e(`h2`,Qt,i(t.$t(`kling.name.negativePrompt`)),1),a(d,{content:t.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var en=M(Yt,[[`render`,$t],[`__scopeId`,`data-v-de98cf01`]]),tn=v({name:`InspirationDrawer`,components:{ElDrawer:k,ElButton:U,FontAwesomeIcon:G},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:zt,Close:y}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit(`update:modelValue`,e)}},drawerSize(){return window.innerWidth<768?`100%`:`380px`},prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return this.groups.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selectedCount(){return this.allChipTexts.filter(e=>this.isSelected(e)).length}},methods:{chipText(e){return this.$t(`kling.inspiration.chip.${e}`)},isSelected(e){return e?this.prompt.includes(e):!1},setPrompt(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})},onToggle(e){e&&(this.isSelected(e)?this.setPrompt($(this.prompt,e)):this.setPrompt(Bt(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=$(e,t);this.setPrompt(e)}}}),nn={class:`drawer-content`},rn={class:`drawer-header`},an={class:`title-row`},on={class:`title`},sn={class:`hint`},cn={key:0,class:`selected-bar`},ln={class:`selected-text`},un={class:`groups`},dn={class:`group-title`},fn={class:`chip-grid`},pn=[`onClick`];function mn(t,u,d,m,_,v){let y=l(`font-awesome-icon`),b=l(`el-button`),x=l(`el-drawer`);return g(),f(x,{modelValue:t.visible,"onUpdate:modelValue":u[1]||=e=>t.visible=e,direction:`rtl`,"with-header":!1,size:t.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:p(()=>[e(`div`,nn,[e(`div`,rn,[e(`div`,an,[a(y,{icon:`fa-regular fa-lightbulb`,class:`mr-2`}),e(`span`,on,i(t.$t(`kling.inspiration.title`)),1)]),a(b,{text:``,icon:t.Close,class:`close-btn`,onClick:u[0]||=e=>t.visible=!1},null,8,[`icon`])]),e(`div`,sn,i(t.$t(`kling.inspiration.hint`)),1),t.selectedCount>0?(g(),s(`div`,cn,[e(`span`,ln,i(t.$t(`kling.inspiration.selectedSummary`,{count:t.selectedCount})),1),a(b,{text:``,size:`small`,class:`clear-btn`,onClick:t.onClearSelected},{default:p(()=>[r(i(t.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):o(``,!0),e(`div`,un,[(g(!0),s(c,null,h(t.groups,r=>(g(),s(`div`,{key:r.groupKey,class:`group`},[e(`div`,dn,i(t.$t(`kling.inspiration.group.${r.groupKey}`)),1),e(`div`,fn,[(g(!0),s(c,null,h(r.chipKeys,e=>(g(),s(`button`,{key:e,type:`button`,class:n({chip:!0,active:t.isSelected(t.chipText(e))}),onClick:n=>t.onToggle(t.chipText(e))},i(t.chipText(e)),11,pn))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var hn=M(tn,[[`render`,mn],[`__scopeId`,`data-v-7d457a69`]]),gn={"kling-v3":`v3`,"kling-v3-omni":`v3-Omni`,"kling-v2-6":`v2.6`,"kling-v2-5-turbo":`v2.5-Turbo`,"kling-v2-1-master":`v2.1-Master`,"kling-v2-master":`v2-Master`,"kling-v1-6":`v1.6`,"kling-v1":`v1`,"kling-video-o1":`Video-o1`},_n={std:`720p`,pro:`1080p`,"4k":`4K`},vn=v({name:`SummaryChip`,components:{FontAwesomeIcon:G},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return gn[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return _n[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),yn={class:`summary-chip`},bn=[`title`],xn=[`title`],Sn=[`title`],Cn=[`title`],wn=[`title`];function Tn(t,n,r,c,u,d){let f=l(`font-awesome-icon`);return g(),s(`div`,yn,[e(`span`,{class:`part`,title:t.$t(`kling.name.model`)},i(t.modelLabel),9,bn),n[0]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.duration`)},i(t.durationLabel),9,xn),n[1]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.ratio`)},i(t.aspectRatio||`16:9`),9,Sn),n[2]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.mode`)},i(t.modeLabel),9,Cn),t.generateAudio?(g(),s(`span`,{key:0,class:`audio`,title:t.$t(`kling.name.generateAudio`)},[a(f,{icon:`fa-solid fa-headphones`})],8,wn)):o(``,!0)])}var En=v({name:`ConfigPanel`,components:{ElButton:U,Consumption:q,FontAwesomeIcon:G,PromptInput:Jt,NegativePromptInput:en,ModelSelector:Ae,ModeSelector:Le,DurationSelector:Ke,RatioSelector:$e,StartImage:ot,CfgScaleSelector:xt,GenerateAudioSelector:Ot,CameraControlSelector:Rt,InspirationDrawer:hn,SummaryChip:M(vn,[[`render`,Tn],[`__scopeId`,`data-v-418a6733`]]),EndImage:pt},emits:[`generate`],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return F(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Dn={class:`flex flex-col h-full`},On={class:`flex-1 overflow-y-auto p-5`},kn={class:`flex flex-col items-center justify-center px-5 pb-5`};function An(t,n,o,c,u,d){let m=l(`prompt-input`),h=l(`model-selector`),_=l(`ratio-selector`),v=l(`start-image`),y=l(`end-image`),b=l(`duration-selector`),x=l(`mode-selector`),S=l(`generate-audio-selector`),C=l(`camera-control-selector`),w=l(`cfg-scale-selector`),T=l(`negative-prompt-input`),E=l(`summary-chip`),ee=l(`consumption`),D=l(`font-awesome-icon`),O=l(`el-button`),k=l(`inspiration-drawer`);return g(),s(`div`,Dn,[e(`div`,On,[a(m,{class:`mb-4`,onOpenInspiration:n[0]||=e=>t.inspirationOpen=!0}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-2`}),a(y,{class:`mb-2`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`}),a(w,{class:`mb-4`}),a(T,{class:`mb-4`})]),e(`div`,kn,[a(E),a(ee,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(g(),f(O,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(D,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`kling.button.extend`)),1)]),_:1},8,[`onClick`])):(g(),f(O,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(D,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`kling.button.generate`)),1)]),_:1},8,[`onClick`]))]),a(k,{modelValue:t.inspirationOpen,"onUpdate:modelValue":n[1]||=e=>t.inspirationOpen=e},null,8,[`modelValue`])])}var jn=M(En,[[`render`,An]]),Mn=v({name:`MotionImage`,components:{ElUpload:w,ElButton:U,InfoIcon:J,FontAwesomeIcon:G,ImagePreview:K},mixins:[z,P],data(){return{fileList:[],uploadUrl:N()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},mounted(){this.onSetImageUrl()},methods:{onExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,image_url:void 0})},onSetImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,image_url:e})},async onSuccess(){this.onSetImageUrl()}}}),Nn={class:`relative`},Pn={class:`flex justify-between`},Fn={class:`flex justify-start items-center`},In={class:`text-sm font-bold`};function Ln(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 g(),s(`div`,Nn,[e(`div`,Pn,[e(`div`,Fn,[e(`span`,In,i(t.$t(`kling.name.motionImage`)),1),a(h,{content:t.$t(`kling.description.motionImage`)},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,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.onRemove(e)},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(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Rn=M(Mn,[[`render`,Ln],[`__scopeId`,`data-v-e52eaf2f`]]),zn=v({name:`MotionVideo`,components:{ElUpload:w,ElButton:U,InfoIcon:J,FilePreview:ue,FontAwesomeIcon:G},mixins:[P],data(){return{fileList:[],uploadUrl:N()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},mounted(){this.onSetVideoUrl()},methods:{onExceed(){V.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){V.error(this.$t(`kling.message.uploadVideoError`))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,video_url:void 0})},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<100;return t?n?!0:(V.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(V.error(this.$t(`kling.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,video_url:e})},async onSuccess(){this.onSetVideoUrl()}}}),Bn={class:`relative`},Vn={class:`flex justify-between`},Hn={class:`flex justify-start items-center`},Un={class:`text-sm font-bold`};function Wn(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`file-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,Bn,[e(`div`,Vn,[e(`div`,Hn,[e(`span`,Un,i(t.$t(`kling.name.motionVideo`)),1),a(h,{content:t.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),a(b,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,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===void 0?o(``,!0):(g(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},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(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Gn=M(zn,[[`render`,Wn],[`__scopeId`,`data-v-7019a8d2`]]),Kn=v({name:`MotionPromptInput`,components:{ElInput:L,InfoIcon:J},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),qn={class:`field`},Jn={class:`box`},Yn={class:`title font-bold`};function Xn(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,qn,[e(`div`,Jn,[e(`h2`,Yn,i(t.$t(`kling.name.motionPrompt`)),1),a(d,{content:t.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Zn=M(Kn,[[`render`,Xn],[`__scopeId`,`data-v-ca9fdbe5`]]),Qn=`video`,$n=v({name:`CharacterOrientationSelector`,components:{ElRadioGroup:O,ElRadioButton:D,InfoIcon:J},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||Qn},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,character_orientation:e})}}},mounted(){this.$store.state.kling?.motionConfig?.character_orientation||(this.value=Qn)}}),er={class:`field`},tr={class:`header`},nr={class:`text-sm font-bold`};function rr(t,n,o,c,u,d){let f=l(`info-icon`),m=l(`el-radio-button`),h=l(`el-radio-group`);return g(),s(`div`,er,[e(`div`,tr,[e(`span`,nr,i(t.$t(`kling.name.characterOrientation`)),1),a(f,{content:t.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),a(h,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,size:`small`,class:`value`},{default:p(()=>[a(m,{label:`image`},{default:p(()=>[r(i(t.$t(`kling.name.orientationImage`)),1)]),_:1}),a(m,{label:`video`},{default:p(()=>[r(i(t.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var ir=M($n,[[`render`,rr],[`__scopeId`,`data-v-7a91195b`]]),ar=`kling-v2-6`,or=v({name:`MotionModelSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:J},computed:{options(){return[{value:`kling-v2-6`,label:`Kling 2.6`},{value:`kling-v3`,label:`Kling 3.0`}]},value:{get(){return this.$store.state.kling?.motionConfig?.model_name||ar},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,model_name:e})}}},mounted(){this.$store.state.kling?.motionConfig?.model_name||(this.value=ar)}}),sr={class:`field`},cr={class:`header`},lr={class:`title font-bold`};function ur(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,sr,[e(`div`,cr,[e(`h2`,lr,i(t.$t(`kling.name.motionModel`)),1),a(m,{content:t.$t(`kling.description.motionModel`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.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 dr=M(or,[[`render`,ur],[`__scopeId`,`data-v-480e8da2`]]),fr=`std`,pr=v({name:`MotionModeSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:J},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.motionConfig?.mode||fr},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=fr)}}),mr={class:`field`},hr={class:`header`},gr={class:`title font-bold`};function _r(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,mr,[e(`div`,hr,[e(`h2`,gr,i(t.$t(`kling.name.mode`)),1),a(m,{content:t.$t(`kling.description.motionMode`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.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 vr=M(pr,[[`render`,_r],[`__scopeId`,`data-v-1295688c`]]),yr=v({name:`KeepOriginalSoundSelector`,components:{ElSwitch:ne,InfoIcon:J},computed:{value:{get(){return(this.$store.state.kling?.motionConfig?.keep_original_sound??`yes`)===`yes`},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,keep_original_sound:e?`yes`:`no`})}}}}),br={class:`relative`},xr={class:`flex justify-between items-center`},Sr={class:`flex justify-start items-center`},Cr={class:`text-sm font-bold`};function wr(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,br,[e(`div`,xr,[e(`div`,Sr,[e(`span`,Cr,i(t.$t(`kling.name.keepOriginalSound`)),1),a(d,{content:t.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e},null,8,[`modelValue`])])])}var Tr=v({name:`MotionPanel`,components:{ElButton:U,FontAwesomeIcon:G,Consumption:q,MotionImage:Rn,MotionVideo:Gn,MotionPromptInput:Zn,CharacterOrientationSelector:ir,MotionModelSelector:dr,MotionModeSelector:vr,KeepOriginalSoundSelector:M(yr,[[`render`,wr]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return F({...this.motionConfig,duration:1},this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){let e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit(`generate`)}}}),Er={class:`flex flex-col h-full`},Dr={class:`flex-1 overflow-y-auto p-5`},Or={class:`flex flex-col items-center justify-center px-5 pb-5`};function kr(t,n,o,c,u,d){let f=l(`motion-image`),m=l(`motion-video`),h=l(`motion-prompt-input`),_=l(`character-orientation-selector`),v=l(`motion-model-selector`),y=l(`motion-mode-selector`),b=l(`keep-original-sound-selector`),x=l(`consumption`),S=l(`font-awesome-icon`),C=l(`el-button`);return g(),s(`div`,Er,[e(`div`,Dr,[a(f,{class:`mb-3`}),a(m,{class:`mb-3`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`})]),e(`div`,Or,[a(x,{value:t.consumption,service:t.service,"rate-unit":t.$t(`kling.name.perSecond`),note:t.$t(`kling.message.motionPricingNote`)},null,8,[`value`,`service`,`rate-unit`,`note`]),a(C,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(S,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Ar=M(Tr,[[`render`,kr]]),jr=v({name:`KlingTabSwitcher`,components:{ElTabs:S,ElTabPane:C,ElTag:ce},props:{modelValue:{type:String,default:`videos`}},emits:[`update:modelValue`],computed:{tabs(){return[{value:`videos`,label:this.$t(`kling.tab.videoGeneration`)},{value:`motion`,label:this.$t(`kling.tab.motionControl`)},{value:`talking-photo`,label:this.$t(`kling.tab.talkingPhoto`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),Mr=[`title`],Nr={class:`text`};function Pr(t,n,a,u,d,m){let _=l(`el-tag`),v=l(`el-tab-pane`),y=l(`el-tabs`);return g(),f(y,{"model-value":t.modelValue,class:`kling-tabs`,stretch:``,"onUpdate:modelValue":t.onUpdate},{default:p(()=>[(g(!0),s(c,null,h(t.tabs,t=>(g(),f(v,{key:t.value,name:t.value,disabled:t.disabled},{label:p(()=>[e(`span`,{class:`tab-label`,title:t.disabled?t.disabledReason:void 0},[e(`span`,Nr,i(t.label),1),t.badge?(g(),f(_,{key:0,size:`small`,type:`warning`,class:`badge`},{default:p(()=>[r(i(t.badge),1)]),_:2},1024)):o(``,!0)],8,Mr)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Fr=M(jr,[[`render`,Pr],[`__scopeId`,`data-v-fda33e4c`]]),Ir={"kling-v2-6":`v2.6`,"kling-v2-5-turbo":`v2.5-Turbo`,"kling-v2-1-master":`v2.1-Master`,"kling-v2-master":`v2-Master`,"kling-v1-6":`v1.6`,"kling-v1":`v1`},Lr=v({name:`TalkingPhotoModelSelector`,components:{ElSelect:b,ElOption:x},data(){return{options:re.map(e=>({value:e,label:Ir[e]||e}))}},computed:{value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.model||`kling-v2-1-master`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,model:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.model||(this.value=ae)}}),Rr={class:`field`},zr={class:`title font-bold`};function Br(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Rr,[e(`h2`,zr,i(t.$t(`kling.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Vr=M(Lr,[[`render`,Br],[`__scopeId`,`data-v-cbc83d11`]]),Hr=v({name:`TalkingPhotoModeSelector`,components:{ElSelect:b,ElOption:x},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.mode||`pro`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,mode:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.mode||(this.value=`pro`)}}),Ur={class:`field`},Wr={class:`title font-bold`};function Gr(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Ur,[e(`h2`,Wr,i(t.$t(`kling.name.mode`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Kr=v({name:`TalkingPhotoPanel`,components:{ElUpload:w,ElButton:U,ElInput:L,FontAwesomeIcon:G,Consumption:q,InfoIcon:J,ImagePreview:K,ModelSelector:Vr,ModeSelector:M(Hr,[[`render`,Gr],[`__scopeId`,`data-v-92525a1d`]])},mixins:[P],emits:[`generate`],data(){return{imageFiles:[],audioFiles:[],uploadUrl:N()+`/api/v1/files/`}},computed:{config(){return this.$store.state.kling?.talkingPhotoConfig||{}},audioUrl(){return this.config.audio_url},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},service(){return this.$store.state.kling?.service},consumption(){return F({...this.config,action:`talking-photo`},this.service?.cost)},canGenerate(){return!!(this.config.image_url&&this.config.audio_url)}},methods:{commit(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.config,...e})},onPromptChange(e){this.commit({prompt:e})},onImageExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onImageError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onImageSuccess(e){this.commit({image_url:e?.file_url})},onImageRemove(e){this.imageFiles.splice(this.imageFiles.indexOf(e),1),this.commit({image_url:void 0})},onAudioExceed(){V.warning(this.$t(`kling.message.uploadAudioExceed`))},onAudioError(){V.error(this.$t(`kling.message.uploadAudioError`))},onAudioSuccess(e){this.commit({audio_url:e?.file_url})},onAudioRemove(){this.commit({audio_url:void 0})},onGenerate(){this.$emit(`generate`)}}}),qr={class:`flex flex-col h-full`},Jr={class:`flex-1 overflow-y-auto p-5`},Yr={class:`relative mb-4`},Xr={class:`flex justify-start items-center`},Zr={class:`text-sm font-bold`},Qr={class:`relative mb-4`},$r={class:`flex justify-start items-center`},ei={class:`text-sm font-bold`},ti=[`src`],ni={class:`mb-4`},ri={class:`flex justify-start items-center`},ii={class:`text-sm font-bold`},ai={class:`flex flex-col items-center justify-center px-5 pb-5`};function oi(t,n,c,u,d,m){let h=l(`model-selector`),_=l(`mode-selector`),v=l(`info-icon`),y=l(`image-preview`),b=l(`font-awesome-icon`),x=l(`el-button`),S=l(`el-upload`),C=l(`el-input`),w=l(`consumption`);return g(),s(`div`,qr,[e(`div`,Jr,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),e(`div`,Yr,[e(`div`,Xr,[e(`span`,Zr,i(t.$t(`kling.name.talkingPhotoImage`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoImage`)},null,8,[`content`])]),a(S,{ref:`imageUploader`,"file-list":t.imageFiles,"onUpdate:fileList":n[0]||=e=>t.imageFiles=e,name:`file`,accept:`.png,.jpg,.jpeg,.webp,.bmp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,headers:t.headers,"on-exceed":t.onImageExceed,"on-error":t.onImageError,"on-success":t.onImageSuccess},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(y,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onImageRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(b,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`])]),e(`div`,Qr,[e(`div`,$r,[e(`span`,ei,i(t.$t(`kling.name.talkingPhotoAudio`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoAudio`)},null,8,[`content`])]),a(S,{ref:`audioUploader`,"file-list":t.audioFiles,"onUpdate:fileList":n[1]||=e=>t.audioFiles=e,name:`file`,accept:`.mp3,.wav,.m4a,.aac`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,headers:t.headers,"on-exceed":t.onAudioExceed,"on-error":t.onAudioError,"on-success":t.onAudioSuccess,"on-remove":t.onAudioRemove},{default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn`},{default:p(()=>[a(b,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`kling.button.uploadAudio`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`]),t.audioUrl?(g(),s(`audio`,{key:0,src:t.audioUrl,controls:``,class:`w-full mt-2`},null,8,ti)):o(``,!0)]),e(`div`,ni,[e(`div`,ri,[e(`span`,ii,i(t.$t(`kling.name.talkingPhotoPrompt`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoPrompt`)},null,8,[`content`])]),a(C,{"model-value":t.config.prompt,type:`textarea`,rows:2,placeholder:t.$t(`kling.placeholder.talkingPhotoPrompt`),class:`mt-1`,"onUpdate:modelValue":t.onPromptChange},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])])]),e(`div`,ai,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`kling.button.generateTalkingPhoto`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var si=M(Kr,[[`render`,oi],[`__scopeId`,`data-v-27261e35`]]),ci=v({name:`TaskPreview`,components:{ElImage:E,CopyToClipboard:le,FontAwesomeIcon:G,ElAlert:ee,VideoPlayer:me,ElTooltip:T,ElButton:U,ImagePreview:K,ApiCodeButton:he},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},referenceImages(){let e=[],t=this.modelValue?.request?.start_image_url,n=this.modelValue?.request?.end_image_url;return t&&e.push({url:t,name:`start-image`}),n&&e.push({url:n,name:`end-image`}),e}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),li={class:`preview`},ui={class:`left`},di={class:`main`},fi={class:`bot`},pi={class:`datetime`},mi={class:`info`},hi={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},gi={key:1,class:`prompt mt-2`},_i={key:0},vi={key:1},yi={key:0,class:n({content:!0,failed:!0})},bi={key:0,class:`mb-4`},xi={key:1,class:n({operations:!0,"mt-2":!0})},Si={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ci={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},wi={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ti={key:1,class:n({content:!0})},Ei={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Di={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Oi={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ki={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ai={key:2,class:n({content:!0})},ji={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mi={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ni(t,n,u,d,m,_){let v=l(`el-image`),y=l(`image-preview`),b=l(`video-player`),x=l(`el-button`),S=l(`el-tooltip`),C=l(`api-code-button`),w=l(`font-awesome-icon`),T=l(`copy-to-clipboard`),E=l(`el-alert`);return g(),s(`div`,li,[e(`div`,ui,[a(v,{src:`https://cdn.acedata.cloud/qpbbbb.jpg`,class:`avatar`})]),e(`div`,di,[e(`div`,fi,[r(i(t.$t(`kling.name.klingBot`))+` `,1),e(`span`,pi,i(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,mi,[t.referenceImages.length>0?(g(),s(`div`,hi,[(g(!0),s(c,null,h(t.referenceImages,(e,t)=>(g(),f(y,{key:t,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),t.modelValue?.request?.prompt?(g(),s(`p`,gi,[r(i(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?o(``,!0):(g(),s(`span`,_i,` - (`+i(t.$t(`kling.status.pending`))+`) `,1)),t.modelValue?.response?.state===`submitted`||t.modelValue?.response?.state===`processing`||t.modelValue?.response?.state===`pending`||t.modelValue?.response?.state===`completed`?(g(),s(`span`,vi,` - (`+i(t.$t(`kling.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),t.modelValue?.response?.success===!0?(g(),s(`div`,yi,[t.modelValue?.response.video_url?(g(),s(`div`,bi,[a(b,{src:t.modelValue?.response.video_url},null,8,[`src`])])):o(``,!0),t.modelValue?.response.success?(g(),s(`div`,xi,[a(S,{class:`box-item`,effect:`dark`,content:t.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:p(()=>[t.modelValue?.response.video_url?(g(),f(x,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:n[0]||=e=>t.onDownload(e,t.modelValue?.response.video_url)},{default:p(()=>[r(i(t.$t(`kling.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(C,{path:`/kling/videos`,body:t.modelValue?.request},null,8,[`body`])])):o(``,!0),a(E,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,Si,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.model`))+`: `+i(t.modelValue?.request?.model),1)]),e(`p`,Ci,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(T,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(g(),s(`p`,wi,[a(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),t.modelValue?.response?.success===!1?(g(),s(`div`,Ti,[a(E,{closable:!1,class:`failure`},{template:p(()=>[a(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.failure`)),1)]),default:p(()=>[e(`p`,Ei,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(T,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,Di,[a(w,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.failureReason`))+`: `+i(t.modelValue?.response?.error?.message)+` `,1),a(T,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(g(),s(`p`,Oi,[a(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),t.modelValue?.response?.trace_id?(g(),s(`p`,ki,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.traceId`))+`: `+i(t.modelValue?.response?.trace_id)+` `,1),a(T,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),t.modelValue?.response?.success===void 0?(g(),s(`div`,Ai,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.failure`)),1)]),default:p(()=>[e(`p`,ji,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(T,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(g(),s(`p`,Mi,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.traceId`))+`: `+i(t.modelValue?.response?.trace_id)+` `,1),a(T,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var Pi=v({name:`RecentPanel`,components:{TaskPreview:M(ci,[[`render`,Ni],[`__scopeId`,`data-v-c36bfd7f`]]),NoTasks:_e,BotPlaceholder:ge,ScrollList:fe},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Fi={key:0},Ii={key:2,class:`w-full h-full flex items-center justify-center`};function Li(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`,Fi,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{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: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`,Ii,[a(v)])):o(``,!0)],64)}var Ri=v({name:`KlingIndex`,components:{ConfigPanel:jn,MotionPanel:Ar,TalkingPhotoPanel:si,TabSwitcher:Fr,Layout:we,RecentPanel:M(Pi,[[`render`,Li]])},mixins:[se],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===oe.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===oe.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},talkingPhotoConfig(){return this.$store.state.kling.talkingPhotoConfig},taskType(){return this.$store.state.kling.taskType||`videos`},tasks(){return this.$store.state.kling.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 pe({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(){console.debug(`start onGetService`),await this.$store.dispatch(`kling/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`kling/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(`kling/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!R(this.uploadTracker,e=>this.$t(e),e=>V.warning(e)))return;let{camera_control:e,...t}=this.config||{},n={...t,async:!0};if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){V.warning(this.$t(`kling.message.endImageRequiresStart`));return}if(n.action||(n.video_id||t.video_url?n.action=`extend`:n.start_image_url?n.action=`image2video`:n.action=`text2video`),n.action===`text2video`&&n.end_image_url&&delete n.end_image_url,e?.type&&(n.camera_control={type:e.type,...e.type===`simple`&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,e])=>e!=null))}:{}}),!B())return;let r=this.credential?.token;if(!r){console.error(`no token specified`);return}V.info(this.$t(`kling.message.startingTask`)),H(`kling`,I.generate(n,{token:r})).then(()=>{V.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?V.error(this.$t(`kling.message.usedUp`)):V.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},async onTabChange(e){e!==this.taskType&&(await this.$store.dispatch(`kling/setTaskType`,e),await this.onGetTasks(),await this.onScrollDown())},async onGenerateMotion(){if(!R(this.uploadTracker,e=>this.$t(e),e=>V.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){V.warning(this.$t(`kling.message.motionMissingInputs`));return}let t={image_url:e.image_url,video_url:e.video_url,character_orientation:e.character_orientation||`video`,mode:e.mode||`std`,keep_original_sound:e.keep_original_sound??`yes`,...e.model_name?{model_name:e.model_name}:{},...e.prompt?{prompt:e.prompt}:{},async:!0};if(!B())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}V.info(this.$t(`kling.message.startingTask`)),H(`kling`,I.motion(t,{token:n})).then(()=>{V.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?V.error(this.$t(`kling.message.usedUp`)):V.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},async onGenerateTalkingPhoto(){if(!R(this.uploadTracker,e=>this.$t(e),e=>V.warning(e)))return;let e=this.talkingPhotoConfig||{};if(!e.image_url||!e.audio_url){V.warning(this.$t(`kling.message.talkingPhotoMissingInputs`));return}let t={image_url:e.image_url,audio_url:e.audio_url,model:e.model||`kling-v2-1-master`,mode:e.mode||`pro`,...e.prompt?{prompt:e.prompt}:{},...e.duration?{duration:e.duration}:{},async:!0};if(!B())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}V.info(this.$t(`kling.message.startingTask`)),H(`kling`,I.talkingPhoto(t,{token:n})).then(()=>{V.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?V.error(this.$t(`kling.message.usedUp`)):V.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),zi={class:`flex flex-col h-full`},Bi={class:`flex-1 min-h-0`};function Vi(t,n,r,i,s,c){let u=l(`tab-switcher`),d=l(`config-panel`),m=l(`motion-panel`),h=l(`talking-photo-panel`),_=l(`recent-panel`),v=l(`layout`);return g(),f(v,null,{config:p(()=>[e(`div`,zi,[a(u,{"model-value":t.taskType,"onUpdate:modelValue":t.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),e(`div`,Bi,[t.taskType===`videos`?(g(),f(d,{key:0,onGenerate:t.onGenerate},null,8,[`onGenerate`])):t.taskType===`motion`?(g(),f(m,{key:1,onGenerate:t.onGenerateMotion},null,8,[`onGenerate`])):t.taskType===`talking-photo`?(g(),f(h,{key:2,onGenerate:t.onGenerateTalkingPhoto},null,8,[`onGenerate`])):o(``,!0)])])]),result:p(()=>[a(_,{ref:`recentPanel`,loading:t.loadingMore,onReachTop:t.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Hi=M(Ri,[[`render`,Vi]]);export{Hi as default};
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{E as y}from"./use-deprecated-B-uvyrTL.js";import{r as b,t as x}from"./select-CTDC5uOC.js";import{n as S,t as C}from"./tabs--OFxJ-3l.js";import{t as w}from"./upload-BtRsvcZP.js";import{t as T}from"./tooltip-DzkWi5KW.js";import{t as E}from"./image-CCLzQcZ9.js";import{t as ee}from"./alert-BP_NaFjc.js";import{n as D,r as O}from"./radio-Bj0tEwH8.js";import{t as k}from"./drawer-CBfe4XvW.js";import{t as A}from"./input-number-D1J0aWlh.js";import{t as te}from"./slider-CnUiskZP.js";import{t as ne}from"./switch-C8ewwQQI.js";import{ci as re,ii as ie,li as j,si as ae}from"./constants-2P9-grH4.js";import{A as M,Gr as N,Hr as oe,Ht as P,Kt as F,Pn as I,Si as L,Ut as se,Vt as R,Wt as z,di as ce,en as B,ni as V,nr as H,pi as U,ti as W}from"./index-DYp9zzBh.js";import{t as G}from"./index.es-AcnoqPen.js";import{t as le}from"./CopyToClipboard-CU8Wt48G.js";import{t as ue}from"./FilePreview-BeZjSmNt.js";import{t as K}from"./ImagePreview-CeVbAkCH.js";import{n as de}from"./taskDrawerMixin-DyAUhFEq.js";import{t as q}from"./Consumption-BbXEEfaa.js";import{i as J,n as fe,t as pe}from"./pagination-D3yr6QMB.js";import{t as me}from"./VideoPlayer-0hcpcBnn.js";import{t as he}from"./ApiCodeButton-BSIwtZSr.js";import{t as ge}from"./BotPlaceholder-CQK6dyT8.js";import{t as _e}from"./NoTasks-BiT26E2U.js";import{t as ve}from"./PromptTextarea-Da3Adw2P.js";var ye=v({name:`LayoutKling`,components:{ElDrawer:k,ElButton:U,FontAwesomeIcon:G},mixins:[de]}),be={class:`main flex flex-row flex-1 min-h-0`},xe={class:`config w-[320px] flex-none h-full flex flex-col 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,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,be,[e(`div`,xe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Se,[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 we=M(ye,[[`render`,Ce],[`__scopeId`,`data-v-b87958dc`]]),Te={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};function Y(e,t,n){let r=t||`std`,i=n??5;switch(e){case`kling-v1`:return{text2video:!0,image2video:!0,endImage:i===5,audio:!1,motionControl:i===5};case`kling-v1-6`:case`kling-v2-5-turbo`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:!1,motionControl:!1};case`kling-v2-6`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:r===`pro`,motionControl:!1};case`kling-v2-master`:case`kling-v2-1-master`:return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};case`kling-v3`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:r!==`4k`};case`kling-v3-omni`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1};case`kling-video-o1`:return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1};default:return Te}}function X(e,t){if(!e)return[];let n=t.model??e.model,r=t.mode??e.mode,i=t.duration??e.duration;if(!n)return[];let a=Y(n,r,i),o=[];return e.end_image_url&&!a.endImage&&o.push({field:`end_image_url`,i18nLabel:`kling.name.endImage`}),e.generate_audio&&!a.audio&&o.push({field:`generate_audio`,i18nLabel:`kling.name.generateAudio`}),e.camera_control?.type&&(!a.motionControl||e.start_image_url)&&o.push({field:`camera_control`,i18nLabel:`kling.name.cameraControl`}),o}function Z(e,t){let n={...e};for(let e of t)e.field===`end_image_url`&&(n.end_image_url=void 0),e.field===`generate_audio`&&(n.generate_audio=!1),e.field===`camera_control`&&(n.camera_control=void 0);return n}var Ee=v({name:`ModelSelector`,components:{ElSelect:b,ElOption:x},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{revertKey:0,options:[{value:`kling-v3`,label:`v3`},{value:`kling-v3-omni`,label:`v3-Omni`},{value:`kling-v2-6`,label:`v2.6`},{value:`kling-v2-5-turbo`,label:`v2.5-Turbo`},{value:`kling-v2-1-master`,label:`v2.1-Master`},{value:`kling-v2-master`,label:`v2-Master`},{value:`kling-v1-6`,label:`v1.6`},{value:`kling-v1`,label:`v1`},{value:`kling-video-o1`,label:`Video-o1`}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(ie)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await W.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),V.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,model:e})}}}),De={class:`field`},Oe={class:`title font-bold`};function ke(t,n,r,a,o,u){let d=l(`el-option`),m=l(`el-select`);return g(),s(`div`,De,[e(`h2`,Oe,i(t.$t(`pika.name.model`)),1),(g(),f(m,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`pika.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(d,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Ae=M(Ee,[[`render`,ke],[`__scopeId`,`data-v-04059875`]]),je=v({name:`ModeSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:J},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},cameraControlSet(){return!!this.$store.state.kling?.config?.camera_control?.type},fourKReason(){return j.includes(this.selectedModel)?this.cameraControlSet?this.$t(`kling.description.mode4kIncompatibleCamera`):``:this.$t(`kling.description.mode4kRequiresV3`)},options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`),disabled:!1,disabledReason:``},{value:`pro`,label:this.$t(`kling.name.modePro`),disabled:!1,disabledReason:``},{value:`4k`,label:this.$t(`kling.name.mode4k`),disabled:!!this.fourKReason,disabledReason:this.fourKReason}]},value(){return this.$store.state.kling?.config?.mode}},watch:{fourKReason(e){e&&this.value===`4k`&&this.applyMode(`std`)}},mounted(){this.value||this.applyMode(`std`)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await W.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),V.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyMode(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,mode:e})}}}),Me={class:`field`},Ne={class:`header`},Pe={class:`title font-bold`},Fe={key:0,class:`opt-tip`};function Ie(t,r,u,d,m,_){let v=l(`info-icon`),y=l(`el-option`),b=l(`el-select`);return g(),s(`div`,Me,[e(`div`,Ne,[e(`h2`,Pe,i(t.$t(`kling.name.mode`)),1),a(v,{content:t.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(g(),f(b,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`kling.placeholder.select`),clearable:!0,onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(y,{key:t.value,label:t.label,value:t.value,disabled:t.disabled},{default:p(()=>[e(`span`,{class:n({"opt-disabled":t.disabled})},i(t.label),3),t.disabled&&t.disabledReason?(g(),s(`span`,Fe,i(t.disabledReason),1)):o(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Le=M(je,[[`render`,Ie],[`__scopeId`,`data-v-9a8fa3c5`]]),Re=[3,5,8,10,12,15],ze=[5,10],Be=v({name:`DurationSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:J},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return j.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?Re:ze},value(){return this.$store.state.kling?.config?.duration??5},selectValue(){let e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(5)?5:e[0]}},watch:{isV3Model(){this.allowedDurations.includes(this.value)||this.applyDuration(5)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(5)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await W.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),V.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyDuration(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,duration:e})}}}),Ve={class:`field`},He={class:`control`},Ue={class:`label`},We={class:`title font-bold`};function Ge(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Ve,[e(`div`,He,[e(`div`,Ue,[e(`h2`,We,i(t.$t(`kling.name.duration`)),1),a(m,{content:t.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(g(),f(v,{key:t.revertKey,"model-value":t.selectValue,class:`value`,placeholder:t.$t(`kling.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.allowedDurations,e=>(g(),f(_,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var Ke=M(Be,[[`render`,Ge],[`__scopeId`,`data-v-5ae55e28`]]),qe=v({name:`RatioSelector`,data(){return{options:[{value:`1:1`,label:`1:1`,width:20,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?.kling?.config?.aspect_ratio},set(e){console.debug(`set ratio`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||=`1:1`}}),Je={class:`text-sm font-bold mb-2 block`},Ye={class:`items`},Xe=[`onClick`],Ze={class:`name`};function Qe(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,Je,i(t.$t(`kling.name.ratio`)),1),e(`div`,Ye,[(g(!0),s(c,null,h(t.options,(r,a)=>(g(),s(`div`,{key:a,class:n({active:t.active===a,item:!0}),onClick:e=>t.value=r.value},[e(`div`,{class:n([`preview`,r.label])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,Ze,i(r.label),1)],10,Xe))),128))])])}var $e=M(qe,[[`render`,Qe],[`__scopeId`,`data-v-cdb14b2f`]]),et=v({name:`StartImage`,components:{ElUpload:w,ElButton:U,ElTooltip:T,InfoIcon:J,FontAwesomeIcon:G,ImagePreview:K},mixins:[z,P],emits:[`change`],data(){return{fileList:[],uploadUrl:N()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),tt={class:`relative`},nt={class:`flex justify-between`},rt={class:`flex justify-start items-center`},it={class:`text-sm font-bold`};function at(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-tooltip`),x=l(`el-upload`);return g(),s(`div`,tt,[e(`div`,nt,[e(`div`,rt,[e(`span`,it,i(t.$t(`kling.name.startImage`)),1),a(h,{content:t.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),a(x,{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,disabled:t.reachedLimit,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?(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(b,{content:t.$t(`kling.message.uploadReferencesExceed`),disabled:!t.reachedLimit,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.reachedLimit},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var ot=M(et,[[`render`,at],[`__scopeId`,`data-v-756dc269`]]),st=v({name:`EndImage`,components:{ElUpload:w,ElButton:U,ElTooltip:T,ImagePreview:K,InfoIcon:J,FontAwesomeIcon:G},mixins:[z,P],data(){return{fileList:[],uploadUrl:N()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},klingConfig(){return this.$store.state?.kling?.config||{}},endImageSupported(){return Y(this.klingConfig.model,this.klingConfig.mode,this.klingConfig.duration).endImage},hasStartImage(){return!!this.klingConfig.start_image_url},uploadDisabled(){return this.reachedLimit||!this.endImageSupported||!this.hasStartImage},uploadTooltip(){return this.endImageSupported?this.hasStartImage?this.reachedLimit?this.$t(`kling.message.uploadReferencesExceed`):``:this.$t(`kling.message.endImageRequiresStart`):this.$t(`kling.message.endImageNotSupported`)},storeValue(){return this.klingConfig.end_image_url},value:{get(){return this.storeValue},set(){}}},watch:{storeValue(e){!e&&this.fileList.length>0&&(this.fileList=[])},hasStartImage(e){!e&&this.storeValue&&(this.fileList=[],this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:void 0}))}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onBeforeUpload(){return this.endImageSupported?this.hasStartImage?!0:(V.warning(this.$t(`kling.message.endImageRequiresStart`)),!1):(V.warning(this.$t(`kling.message.endImageNotSupported`)),!1)},onExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ct={class:`relative`},lt={class:`flex justify-between`},ut={class:`flex justify-start items-center`},dt={class:`text-sm font-bold`};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-tooltip`),x=l(`el-upload`);return g(),s(`div`,ct,[e(`div`,lt,[e(`div`,ut,[e(`span`,dt,i(t.$t(`kling.name.endImage`)),1),a(h,{content:t.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),a(x,{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,disabled:t.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"before-upload":t.onBeforeUpload,"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?(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(b,{content:t.uploadTooltip,disabled:!t.uploadDisabled,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.uploadDisabled},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var pt=M(st,[[`render`,ft],[`__scopeId`,`data-v-c1b257e5`]]),mt=v({name:`CfgScaleSelector`,components:{ElSlider:te,InfoIcon:J,ElInputNumber:A},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug(`set cfg_scale`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||=0}}),ht={class:`flex justify-between`},gt={class:`flex justify-start items-center`},_t={class:`text-sm font-bold`},vt={class:`flex justify-end items-center`},yt={class:`w-full`};function bt(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`),p=l(`el-slider`);return g(),s(`div`,null,[e(`div`,ht,[e(`div`,gt,[e(`span`,_t,i(t.$t(`kling.name.cfgScale`)),1),a(d,{content:t.$t(`kling.description.cfgScale`)},null,8,[`content`])]),e(`div`,vt,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,yt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var xt=M(mt,[[`render`,bt]]),St=v({name:`GenerateAudioSelector`,components:{ElSwitch:ne,InfoIcon:J},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(j.includes(this.selectedModel)||this.selectedModel===`kling-v2-6`&&this.selectedMode===`pro`)},tooltipContent(){return this.supported?this.$t(`kling.description.generateAudio`):this.$t(`kling.description.generateAudioUnsupported`)},value:{get(){return this.supported?this.$store.state.kling?.config?.generate_audio??!1:!1},set(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,generate_audio:e})}}},watch:{supported(e){!e&&this.$store.state.kling?.config?.generate_audio&&this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,generate_audio:!1})}}}),Ct={class:`relative`},wt={class:`flex justify-between items-center`},Tt={class:`flex justify-start items-center`},Et={class:`text-sm font-bold`};function Dt(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,Ct,[e(`div`,wt,[e(`div`,Tt,[e(`span`,Et,i(t.$t(`kling.name.generateAudio`)),1),a(d,{content:t.tooltipContent},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,disabled:!t.supported},null,8,[`modelValue`,`disabled`])])])}var Ot=M(St,[[`render`,Dt]]),kt=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],At=v({name:`CameraControlSelector`,components:{ElSelect:b,ElOption:x,ElSlider:te,ElInputNumber:A,InfoIcon:J},data(){return{configKeys:kt}},computed:{typeOptions(){return[{value:``,label:this.$t(`kling.name.cameraTypeNone`)},{value:`simple`,label:this.$t(`kling.name.cameraTypeSimple`)},{value:`down_back`,label:this.$t(`kling.name.cameraTypeDownBack`)},{value:`forward_up`,label:this.$t(`kling.name.cameraTypeForwardUp`)},{value:`left_turn_forward`,label:this.$t(`kling.name.cameraTypeLeftTurnForward`)},{value:`right_turn_forward`,label:this.$t(`kling.name.cameraTypeRightTurnForward`)}]},selectedMode(){return this.$store.state.kling?.config?.mode||``},selectedModel(){return this.$store.state.kling?.config?.model||``},selectedDuration(){return this.$store.state.kling?.config?.duration},motionControlSupported(){return Y(this.selectedModel,this.selectedMode,this.selectedDuration).motionControl},hasStartImage(){return!!this.$store.state.kling?.config?.start_image_url},disabled(){return!this.motionControlSupported||this.hasStartImage},tooltipContent(){return this.motionControlSupported?this.hasStartImage?this.$t(`kling.description.cameraControlDisabledImage2Video`):this.$t(`kling.description.cameraControl`):this.$t(`kling.description.cameraControlNotSupported`)},selectedType(){return this.$store.state.kling?.config?.camera_control?.type},selectedTypeRaw:{get(){return this.selectedType??``},set(e){let t=this.$store.state.kling?.config||{};if(!e){let e={...t};delete e.camera_control,this.$store.commit(`kling/setConfig`,e);return}let n=e;this.$store.commit(`kling/setConfig`,{...t,camera_control:{type:n,config:n===`simple`?t.camera_control?.config||{}:void 0}})}},configValues(){return this.$store.state.kling?.config?.camera_control?.config||{}}},watch:{disabled(e){e&&this.selectedType!==void 0&&(this.selectedTypeRaw=``)}},methods:{writeConfig(e,t){let n=this.$store.state.kling?.config||{},r=n.camera_control||{type:`simple`},i={...r.config||{}};t==null?delete i[e]:i[e]=t,this.$store.commit(`kling/setConfig`,{...n,camera_control:{...r,type:`simple`,config:i}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),jt={class:`field`},Mt={class:`header`},Nt={class:`text-sm font-bold`},Pt={key:0,class:`config-grid`},Ft={class:`cfg-row-head`},It={class:`cfg-name`};function Lt(t,n,r,u,d,m){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`),b=l(`el-input-number`),x=l(`el-slider`);return g(),s(`div`,jt,[e(`div`,Mt,[e(`span`,Nt,i(t.$t(`kling.name.cameraControl`)),1),a(_,{content:t.tooltipContent},null,8,[`content`])]),a(y,{modelValue:t.selectedTypeRaw,"onUpdate:modelValue":n[0]||=e=>t.selectedTypeRaw=e,class:`value`,placeholder:t.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:t.disabled},{default:p(()=>[(g(!0),s(c,null,h(t.typeOptions,e=>(g(),f(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),t.selectedType===`simple`&&!t.disabled?(g(),s(`div`,Pt,[(g(!0),s(c,null,h(t.configKeys,n=>(g(),s(`div`,{key:n,class:`cfg-row`},[e(`div`,Ft,[e(`span`,It,i(t.$t(`kling.name.cc_${n}`)),1),a(b,{modelValue:t.configValues[n],"onUpdate:modelValue":e=>t.configValues[n]=e,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:e=>t.onNumberChange(n,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),a(x,{"model-value":t.configValues[n]??0,min:-1,max:1,step:.1,onInput:e=>t.onSliderChange(n,e)},null,8,[`model-value`,`onInput`])]))),128))])):o(``,!0)])}var Rt=M(At,[[`render`,Lt],[`__scopeId`,`data-v-cd896060`]]),zt=[{groupKey:`cameraMovements`,chipKeys:[`rotateAround`,`stationary`,`handheld`,`zoomOut`,`zoomIn`,`follow`,`panRight`,`tiltUp`,`tiltDown`,`orbit`]},{groupKey:`cameraSpeed`,chipKeys:[`speedSlow`,`speedMedium`,`speedFast`]},{groupKey:`shotType`,chipKeys:[`shotClose`,`shotMedium`,`shotLong`,`shotLowAngle`,`shotHighAngle`,`shotShallowDof`,`shotFront`,`shotProfile`,`shotCloseUp`,`shotDrone`]},{groupKey:`light`,chipKeys:[`lightSunlight`,`lightSoft`,`lightNeon`,`lightWarm`,`lightNature`,`lightCandle`,`lightCityNight`]},{groupKey:`frame`,chipKeys:[`frameRichDetails`,`frameSimpleBg`]},{groupKey:`atmosphere`,chipKeys:[`atmosphereMysterious`,`atmospherePeaceful`,`atmosphereHeartwarming`,`atmosphereVivid`,`atmosphereColorful`]}],Q=`, `;function Bt(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${Q}${t}`:t}function $(e,t){if(!e||!t)return e||``;let n=[`${t}${Q}`,`${Q}${t}`,t],r=e;for(let e of n)if(r.includes(e)){r=r.replace(e,``);break}return r.replace(/(?:,\s*)+$/,``).replace(/^(?:,\s*)+/,``)}var Vt=v({name:`InspirationPills`,components:{FontAwesomeIcon:G},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return zt.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selected(){let e=this.prompt;if(!e)return[];let t=[];for(let n of this.allChipTexts){let r=e.indexOf(n);r!==-1&&t.push({text:n,idx:r})}return t.sort((e,t)=>e.idx-t.idx).map(e=>e.text)}},methods:{onRemove(e){let t=$(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),Ht={key:0,class:`pills`,role:`list`},Ut={class:`pill-text`},Wt=[`aria-label`,`onClick`];function Gt(n,r,u,d,f,p){let m=l(`font-awesome-icon`);return n.selected.length>0?(g(),s(`div`,Ht,[(g(!0),s(c,null,h(n.selected,r=>(g(),s(`div`,{key:r,class:`pill`,role:`listitem`},[e(`span`,Ut,i(r),1),e(`button`,{type:`button`,class:`pill-remove`,"aria-label":n.$t(`kling.inspiration.removeChip`),onClick:t(e=>n.onRemove(r),[`stop`])},[a(m,{icon:`fa-solid fa-xmark`})],8,Wt)]))),128))])):o(``,!0)}var Kt=v({name:`PromptInput`,components:{ElButton:U,FontAwesomeIcon:G,PromptTextarea:ve,InspirationPills:M(Vt,[[`render`,Gt],[`__scopeId`,`data-v-5fc4fa65`]])},emits:[`open-inspiration`],computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||=``}});function qt(e,t,n,o,s,c){let u=l(`font-awesome-icon`),d=l(`el-button`),m=l(`inspiration-pills`),h=l(`prompt-textarea`);return g(),f(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`kling.name.prompt`),info:e.$t(`kling.description.prompt`),placeholder:e.$t(`kling.placeholder.prompt`)},{actions:p(()=>[a(d,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:p(()=>[a(u,{icon:`fa-regular fa-lightbulb`,class:`mr-1`}),r(` `+i(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:p(()=>[a(m)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var Jt=M(Kt,[[`render`,qt],[`__scopeId`,`data-v-c01fc1a6`]]),Yt=v({name:`NegativePromptInput`,components:{ElInput:L,InfoIcon:J},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug(`set prompt`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||=``}}),Xt={class:`field`},Zt={class:`box`},Qt={class:`title font-bold`};function $t(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,Xt,[e(`div`,Zt,[e(`h2`,Qt,i(t.$t(`kling.name.negativePrompt`)),1),a(d,{content:t.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var en=M(Yt,[[`render`,$t],[`__scopeId`,`data-v-de98cf01`]]),tn=v({name:`InspirationDrawer`,components:{ElDrawer:k,ElButton:U,FontAwesomeIcon:G},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:zt,Close:y}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit(`update:modelValue`,e)}},drawerSize(){return window.innerWidth<768?`100%`:`380px`},prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return this.groups.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selectedCount(){return this.allChipTexts.filter(e=>this.isSelected(e)).length}},methods:{chipText(e){return this.$t(`kling.inspiration.chip.${e}`)},isSelected(e){return e?this.prompt.includes(e):!1},setPrompt(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})},onToggle(e){e&&(this.isSelected(e)?this.setPrompt($(this.prompt,e)):this.setPrompt(Bt(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=$(e,t);this.setPrompt(e)}}}),nn={class:`drawer-content`},rn={class:`drawer-header`},an={class:`title-row`},on={class:`title`},sn={class:`hint`},cn={key:0,class:`selected-bar`},ln={class:`selected-text`},un={class:`groups`},dn={class:`group-title`},fn={class:`chip-grid`},pn=[`onClick`];function mn(t,u,d,m,_,v){let y=l(`font-awesome-icon`),b=l(`el-button`),x=l(`el-drawer`);return g(),f(x,{modelValue:t.visible,"onUpdate:modelValue":u[1]||=e=>t.visible=e,direction:`rtl`,"with-header":!1,size:t.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:p(()=>[e(`div`,nn,[e(`div`,rn,[e(`div`,an,[a(y,{icon:`fa-regular fa-lightbulb`,class:`mr-2`}),e(`span`,on,i(t.$t(`kling.inspiration.title`)),1)]),a(b,{text:``,icon:t.Close,class:`close-btn`,onClick:u[0]||=e=>t.visible=!1},null,8,[`icon`])]),e(`div`,sn,i(t.$t(`kling.inspiration.hint`)),1),t.selectedCount>0?(g(),s(`div`,cn,[e(`span`,ln,i(t.$t(`kling.inspiration.selectedSummary`,{count:t.selectedCount})),1),a(b,{text:``,size:`small`,class:`clear-btn`,onClick:t.onClearSelected},{default:p(()=>[r(i(t.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):o(``,!0),e(`div`,un,[(g(!0),s(c,null,h(t.groups,r=>(g(),s(`div`,{key:r.groupKey,class:`group`},[e(`div`,dn,i(t.$t(`kling.inspiration.group.${r.groupKey}`)),1),e(`div`,fn,[(g(!0),s(c,null,h(r.chipKeys,e=>(g(),s(`button`,{key:e,type:`button`,class:n({chip:!0,active:t.isSelected(t.chipText(e))}),onClick:n=>t.onToggle(t.chipText(e))},i(t.chipText(e)),11,pn))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var hn=M(tn,[[`render`,mn],[`__scopeId`,`data-v-7d457a69`]]),gn={"kling-v3":`v3`,"kling-v3-omni":`v3-Omni`,"kling-v2-6":`v2.6`,"kling-v2-5-turbo":`v2.5-Turbo`,"kling-v2-1-master":`v2.1-Master`,"kling-v2-master":`v2-Master`,"kling-v1-6":`v1.6`,"kling-v1":`v1`,"kling-video-o1":`Video-o1`},_n={std:`720p`,pro:`1080p`,"4k":`4K`},vn=v({name:`SummaryChip`,components:{FontAwesomeIcon:G},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return gn[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return _n[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),yn={class:`summary-chip`},bn=[`title`],xn=[`title`],Sn=[`title`],Cn=[`title`],wn=[`title`];function Tn(t,n,r,c,u,d){let f=l(`font-awesome-icon`);return g(),s(`div`,yn,[e(`span`,{class:`part`,title:t.$t(`kling.name.model`)},i(t.modelLabel),9,bn),n[0]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.duration`)},i(t.durationLabel),9,xn),n[1]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.ratio`)},i(t.aspectRatio||`16:9`),9,Sn),n[2]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.mode`)},i(t.modeLabel),9,Cn),t.generateAudio?(g(),s(`span`,{key:0,class:`audio`,title:t.$t(`kling.name.generateAudio`)},[a(f,{icon:`fa-solid fa-headphones`})],8,wn)):o(``,!0)])}var En=v({name:`ConfigPanel`,components:{ElButton:U,Consumption:q,FontAwesomeIcon:G,PromptInput:Jt,NegativePromptInput:en,ModelSelector:Ae,ModeSelector:Le,DurationSelector:Ke,RatioSelector:$e,StartImage:ot,CfgScaleSelector:xt,GenerateAudioSelector:Ot,CameraControlSelector:Rt,InspirationDrawer:hn,SummaryChip:M(vn,[[`render`,Tn],[`__scopeId`,`data-v-418a6733`]]),EndImage:pt},emits:[`generate`],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return F(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Dn={class:`flex flex-col h-full`},On={class:`flex-1 overflow-y-auto p-5`},kn={class:`flex flex-col items-center justify-center px-5 pb-5`};function An(t,n,o,c,u,d){let m=l(`prompt-input`),h=l(`model-selector`),_=l(`ratio-selector`),v=l(`start-image`),y=l(`end-image`),b=l(`duration-selector`),x=l(`mode-selector`),S=l(`generate-audio-selector`),C=l(`camera-control-selector`),w=l(`cfg-scale-selector`),T=l(`negative-prompt-input`),E=l(`summary-chip`),ee=l(`consumption`),D=l(`font-awesome-icon`),O=l(`el-button`),k=l(`inspiration-drawer`);return g(),s(`div`,Dn,[e(`div`,On,[a(m,{class:`mb-4`,onOpenInspiration:n[0]||=e=>t.inspirationOpen=!0}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-2`}),a(y,{class:`mb-2`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`}),a(w,{class:`mb-4`}),a(T,{class:`mb-4`})]),e(`div`,kn,[a(E),a(ee,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(g(),f(O,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(D,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`kling.button.extend`)),1)]),_:1},8,[`onClick`])):(g(),f(O,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(D,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`kling.button.generate`)),1)]),_:1},8,[`onClick`]))]),a(k,{modelValue:t.inspirationOpen,"onUpdate:modelValue":n[1]||=e=>t.inspirationOpen=e},null,8,[`modelValue`])])}var jn=M(En,[[`render`,An]]),Mn=v({name:`MotionImage`,components:{ElUpload:w,ElButton:U,InfoIcon:J,FontAwesomeIcon:G,ImagePreview:K},mixins:[z,P],data(){return{fileList:[],uploadUrl:N()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},mounted(){this.onSetImageUrl()},methods:{onExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,image_url:void 0})},onSetImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,image_url:e})},async onSuccess(){this.onSetImageUrl()}}}),Nn={class:`relative`},Pn={class:`flex justify-between`},Fn={class:`flex justify-start items-center`},In={class:`text-sm font-bold`};function Ln(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 g(),s(`div`,Nn,[e(`div`,Pn,[e(`div`,Fn,[e(`span`,In,i(t.$t(`kling.name.motionImage`)),1),a(h,{content:t.$t(`kling.description.motionImage`)},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,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.onRemove(e)},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(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Rn=M(Mn,[[`render`,Ln],[`__scopeId`,`data-v-e52eaf2f`]]),zn=v({name:`MotionVideo`,components:{ElUpload:w,ElButton:U,InfoIcon:J,FilePreview:ue,FontAwesomeIcon:G},mixins:[P],data(){return{fileList:[],uploadUrl:N()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},mounted(){this.onSetVideoUrl()},methods:{onExceed(){V.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){V.error(this.$t(`kling.message.uploadVideoError`))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,video_url:void 0})},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<100;return t?n?!0:(V.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(V.error(this.$t(`kling.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,video_url:e})},async onSuccess(){this.onSetVideoUrl()}}}),Bn={class:`relative`},Vn={class:`flex justify-between`},Hn={class:`flex justify-start items-center`},Un={class:`text-sm font-bold`};function Wn(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`file-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,Bn,[e(`div`,Vn,[e(`div`,Hn,[e(`span`,Un,i(t.$t(`kling.name.motionVideo`)),1),a(h,{content:t.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),a(b,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,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===void 0?o(``,!0):(g(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},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(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Gn=M(zn,[[`render`,Wn],[`__scopeId`,`data-v-7019a8d2`]]),Kn=v({name:`MotionPromptInput`,components:{ElInput:L,InfoIcon:J},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),qn={class:`field`},Jn={class:`box`},Yn={class:`title font-bold`};function Xn(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,qn,[e(`div`,Jn,[e(`h2`,Yn,i(t.$t(`kling.name.motionPrompt`)),1),a(d,{content:t.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Zn=M(Kn,[[`render`,Xn],[`__scopeId`,`data-v-ca9fdbe5`]]),Qn=`video`,$n=v({name:`CharacterOrientationSelector`,components:{ElRadioGroup:O,ElRadioButton:D,InfoIcon:J},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||Qn},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,character_orientation:e})}}},mounted(){this.$store.state.kling?.motionConfig?.character_orientation||(this.value=Qn)}}),er={class:`field`},tr={class:`header`},nr={class:`text-sm font-bold`};function rr(t,n,o,c,u,d){let f=l(`info-icon`),m=l(`el-radio-button`),h=l(`el-radio-group`);return g(),s(`div`,er,[e(`div`,tr,[e(`span`,nr,i(t.$t(`kling.name.characterOrientation`)),1),a(f,{content:t.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),a(h,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,size:`small`,class:`value`},{default:p(()=>[a(m,{label:`image`},{default:p(()=>[r(i(t.$t(`kling.name.orientationImage`)),1)]),_:1}),a(m,{label:`video`},{default:p(()=>[r(i(t.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var ir=M($n,[[`render`,rr],[`__scopeId`,`data-v-7a91195b`]]),ar=`kling-v2-6`,or=v({name:`MotionModelSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:J},computed:{options(){return[{value:`kling-v2-6`,label:`Kling 2.6`},{value:`kling-v3`,label:`Kling 3.0`}]},value:{get(){return this.$store.state.kling?.motionConfig?.model_name||ar},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,model_name:e})}}},mounted(){this.$store.state.kling?.motionConfig?.model_name||(this.value=ar)}}),sr={class:`field`},cr={class:`header`},lr={class:`title font-bold`};function ur(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,sr,[e(`div`,cr,[e(`h2`,lr,i(t.$t(`kling.name.motionModel`)),1),a(m,{content:t.$t(`kling.description.motionModel`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.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 dr=M(or,[[`render`,ur],[`__scopeId`,`data-v-480e8da2`]]),fr=`std`,pr=v({name:`MotionModeSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:J},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.motionConfig?.mode||fr},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=fr)}}),mr={class:`field`},hr={class:`header`},gr={class:`title font-bold`};function _r(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,mr,[e(`div`,hr,[e(`h2`,gr,i(t.$t(`kling.name.mode`)),1),a(m,{content:t.$t(`kling.description.motionMode`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.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 vr=M(pr,[[`render`,_r],[`__scopeId`,`data-v-1295688c`]]),yr=v({name:`KeepOriginalSoundSelector`,components:{ElSwitch:ne,InfoIcon:J},computed:{value:{get(){return(this.$store.state.kling?.motionConfig?.keep_original_sound??`yes`)===`yes`},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,keep_original_sound:e?`yes`:`no`})}}}}),br={class:`relative`},xr={class:`flex justify-between items-center`},Sr={class:`flex justify-start items-center`},Cr={class:`text-sm font-bold`};function wr(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,br,[e(`div`,xr,[e(`div`,Sr,[e(`span`,Cr,i(t.$t(`kling.name.keepOriginalSound`)),1),a(d,{content:t.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e},null,8,[`modelValue`])])])}var Tr=v({name:`MotionPanel`,components:{ElButton:U,FontAwesomeIcon:G,Consumption:q,MotionImage:Rn,MotionVideo:Gn,MotionPromptInput:Zn,CharacterOrientationSelector:ir,MotionModelSelector:dr,MotionModeSelector:vr,KeepOriginalSoundSelector:M(yr,[[`render`,wr]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return F({...this.motionConfig,duration:1},this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){let e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit(`generate`)}}}),Er={class:`flex flex-col h-full`},Dr={class:`flex-1 overflow-y-auto p-5`},Or={class:`flex flex-col items-center justify-center px-5 pb-5`};function kr(t,n,o,c,u,d){let f=l(`motion-image`),m=l(`motion-video`),h=l(`motion-prompt-input`),_=l(`character-orientation-selector`),v=l(`motion-model-selector`),y=l(`motion-mode-selector`),b=l(`keep-original-sound-selector`),x=l(`consumption`),S=l(`font-awesome-icon`),C=l(`el-button`);return g(),s(`div`,Er,[e(`div`,Dr,[a(f,{class:`mb-3`}),a(m,{class:`mb-3`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`})]),e(`div`,Or,[a(x,{value:t.consumption,service:t.service,"rate-unit":t.$t(`kling.name.perSecond`),note:t.$t(`kling.message.motionPricingNote`)},null,8,[`value`,`service`,`rate-unit`,`note`]),a(C,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(S,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Ar=M(Tr,[[`render`,kr]]),jr=v({name:`KlingTabSwitcher`,components:{ElTabs:S,ElTabPane:C,ElTag:ce},props:{modelValue:{type:String,default:`videos`}},emits:[`update:modelValue`],computed:{tabs(){return[{value:`videos`,label:this.$t(`kling.tab.videoGeneration`)},{value:`motion`,label:this.$t(`kling.tab.motionControl`)},{value:`talking-photo`,label:this.$t(`kling.tab.talkingPhoto`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),Mr=[`title`],Nr={class:`text`};function Pr(t,n,a,u,d,m){let _=l(`el-tag`),v=l(`el-tab-pane`),y=l(`el-tabs`);return g(),f(y,{"model-value":t.modelValue,class:`kling-tabs`,stretch:``,"onUpdate:modelValue":t.onUpdate},{default:p(()=>[(g(!0),s(c,null,h(t.tabs,t=>(g(),f(v,{key:t.value,name:t.value,disabled:t.disabled},{label:p(()=>[e(`span`,{class:`tab-label`,title:t.disabled?t.disabledReason:void 0},[e(`span`,Nr,i(t.label),1),t.badge?(g(),f(_,{key:0,size:`small`,type:`warning`,class:`badge`},{default:p(()=>[r(i(t.badge),1)]),_:2},1024)):o(``,!0)],8,Mr)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Fr=M(jr,[[`render`,Pr],[`__scopeId`,`data-v-fda33e4c`]]),Ir={"kling-v2-6":`v2.6`,"kling-v2-5-turbo":`v2.5-Turbo`,"kling-v2-1-master":`v2.1-Master`,"kling-v2-master":`v2-Master`,"kling-v1-6":`v1.6`,"kling-v1":`v1`},Lr=v({name:`TalkingPhotoModelSelector`,components:{ElSelect:b,ElOption:x},data(){return{options:re.map(e=>({value:e,label:Ir[e]||e}))}},computed:{value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.model||`kling-v2-1-master`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,model:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.model||(this.value=ae)}}),Rr={class:`field`},zr={class:`title font-bold`};function Br(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Rr,[e(`h2`,zr,i(t.$t(`kling.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Vr=M(Lr,[[`render`,Br],[`__scopeId`,`data-v-cbc83d11`]]),Hr=v({name:`TalkingPhotoModeSelector`,components:{ElSelect:b,ElOption:x},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.mode||`pro`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,mode:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.mode||(this.value=`pro`)}}),Ur={class:`field`},Wr={class:`title font-bold`};function Gr(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Ur,[e(`h2`,Wr,i(t.$t(`kling.name.mode`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Kr=v({name:`TalkingPhotoPanel`,components:{ElUpload:w,ElButton:U,ElInput:L,FontAwesomeIcon:G,Consumption:q,InfoIcon:J,ImagePreview:K,ModelSelector:Vr,ModeSelector:M(Hr,[[`render`,Gr],[`__scopeId`,`data-v-92525a1d`]])},mixins:[P],emits:[`generate`],data(){return{imageFiles:[],audioFiles:[],uploadUrl:N()+`/api/v1/files/`}},computed:{config(){return this.$store.state.kling?.talkingPhotoConfig||{}},audioUrl(){return this.config.audio_url},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},service(){return this.$store.state.kling?.service},consumption(){return F({...this.config,action:`talking-photo`},this.service?.cost)},canGenerate(){return!!(this.config.image_url&&this.config.audio_url)}},methods:{commit(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.config,...e})},onPromptChange(e){this.commit({prompt:e})},onImageExceed(){V.warning(this.$t(`kling.message.uploadReferencesExceed`))},onImageError(){V.error(this.$t(`kling.message.uploadReferencesError`))},onImageSuccess(e){this.commit({image_url:e?.file_url})},onImageRemove(e){this.imageFiles.splice(this.imageFiles.indexOf(e),1),this.commit({image_url:void 0})},onAudioExceed(){V.warning(this.$t(`kling.message.uploadAudioExceed`))},onAudioError(){V.error(this.$t(`kling.message.uploadAudioError`))},onAudioSuccess(e){this.commit({audio_url:e?.file_url})},onAudioRemove(){this.commit({audio_url:void 0})},onGenerate(){this.$emit(`generate`)}}}),qr={class:`flex flex-col h-full`},Jr={class:`flex-1 overflow-y-auto p-5`},Yr={class:`relative mb-4`},Xr={class:`flex justify-start items-center`},Zr={class:`text-sm font-bold`},Qr={class:`relative mb-4`},$r={class:`flex justify-start items-center`},ei={class:`text-sm font-bold`},ti=[`src`],ni={class:`mb-4`},ri={class:`flex justify-start items-center`},ii={class:`text-sm font-bold`},ai={class:`flex flex-col items-center justify-center px-5 pb-5`};function oi(t,n,c,u,d,m){let h=l(`model-selector`),_=l(`mode-selector`),v=l(`info-icon`),y=l(`image-preview`),b=l(`font-awesome-icon`),x=l(`el-button`),S=l(`el-upload`),C=l(`el-input`),w=l(`consumption`);return g(),s(`div`,qr,[e(`div`,Jr,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),e(`div`,Yr,[e(`div`,Xr,[e(`span`,Zr,i(t.$t(`kling.name.talkingPhotoImage`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoImage`)},null,8,[`content`])]),a(S,{ref:`imageUploader`,"file-list":t.imageFiles,"onUpdate:fileList":n[0]||=e=>t.imageFiles=e,name:`file`,accept:`.png,.jpg,.jpeg,.webp,.bmp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,headers:t.headers,"on-exceed":t.onImageExceed,"on-error":t.onImageError,"on-success":t.onImageSuccess},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(y,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onImageRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(b,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`])]),e(`div`,Qr,[e(`div`,$r,[e(`span`,ei,i(t.$t(`kling.name.talkingPhotoAudio`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoAudio`)},null,8,[`content`])]),a(S,{ref:`audioUploader`,"file-list":t.audioFiles,"onUpdate:fileList":n[1]||=e=>t.audioFiles=e,name:`file`,accept:`.mp3,.wav,.m4a,.aac`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,headers:t.headers,"on-exceed":t.onAudioExceed,"on-error":t.onAudioError,"on-success":t.onAudioSuccess,"on-remove":t.onAudioRemove},{default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn`},{default:p(()=>[a(b,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`kling.button.uploadAudio`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`]),t.audioUrl?(g(),s(`audio`,{key:0,src:t.audioUrl,controls:``,class:`w-full mt-2`},null,8,ti)):o(``,!0)]),e(`div`,ni,[e(`div`,ri,[e(`span`,ii,i(t.$t(`kling.name.talkingPhotoPrompt`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoPrompt`)},null,8,[`content`])]),a(C,{"model-value":t.config.prompt,type:`textarea`,rows:2,placeholder:t.$t(`kling.placeholder.talkingPhotoPrompt`),class:`mt-1`,"onUpdate:modelValue":t.onPromptChange},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])])]),e(`div`,ai,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`kling.button.generateTalkingPhoto`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var si=M(Kr,[[`render`,oi],[`__scopeId`,`data-v-27261e35`]]),ci=v({name:`TaskPreview`,components:{ElImage:E,CopyToClipboard:le,FontAwesomeIcon:G,ElAlert:ee,VideoPlayer:me,ElTooltip:T,ElButton:U,ImagePreview:K,ApiCodeButton:he},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},referenceImages(){let e=[],t=this.modelValue?.request?.start_image_url,n=this.modelValue?.request?.end_image_url;return t&&e.push({url:t,name:`start-image`}),n&&e.push({url:n,name:`end-image`}),e}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),li={class:`preview`},ui={class:`left`},di={class:`main`},fi={class:`bot`},pi={class:`datetime`},mi={class:`info`},hi={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},gi={key:1,class:`prompt mt-2`},_i={key:0},vi={key:1},yi={key:0,class:n({content:!0,failed:!0})},bi={key:0,class:`mb-4`},xi={key:1,class:n({operations:!0,"mt-2":!0})},Si={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ci={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},wi={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ti={key:1,class:n({content:!0})},Ei={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Di={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Oi={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ki={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ai={key:2,class:n({content:!0})},ji={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mi={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ni(t,n,u,d,m,_){let v=l(`el-image`),y=l(`image-preview`),b=l(`video-player`),x=l(`el-button`),S=l(`el-tooltip`),C=l(`api-code-button`),w=l(`font-awesome-icon`),T=l(`copy-to-clipboard`),E=l(`el-alert`);return g(),s(`div`,li,[e(`div`,ui,[a(v,{src:`https://cdn.acedata.cloud/qpbbbb.jpg`,class:`avatar`})]),e(`div`,di,[e(`div`,fi,[r(i(t.$t(`kling.name.klingBot`))+` `,1),e(`span`,pi,i(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,mi,[t.referenceImages.length>0?(g(),s(`div`,hi,[(g(!0),s(c,null,h(t.referenceImages,(e,t)=>(g(),f(y,{key:t,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),t.modelValue?.request?.prompt?(g(),s(`p`,gi,[r(i(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?o(``,!0):(g(),s(`span`,_i,` - (`+i(t.$t(`kling.status.pending`))+`) `,1)),t.modelValue?.response?.state===`submitted`||t.modelValue?.response?.state===`processing`||t.modelValue?.response?.state===`pending`||t.modelValue?.response?.state===`completed`?(g(),s(`span`,vi,` - (`+i(t.$t(`kling.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),t.modelValue?.response?.success===!0?(g(),s(`div`,yi,[t.modelValue?.response.video_url?(g(),s(`div`,bi,[a(b,{src:t.modelValue?.response.video_url},null,8,[`src`])])):o(``,!0),t.modelValue?.response.success?(g(),s(`div`,xi,[a(S,{class:`box-item`,effect:`dark`,content:t.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:p(()=>[t.modelValue?.response.video_url?(g(),f(x,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:n[0]||=e=>t.onDownload(e,t.modelValue?.response.video_url)},{default:p(()=>[r(i(t.$t(`kling.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(C,{path:`/kling/videos`,body:t.modelValue?.request},null,8,[`body`])])):o(``,!0),a(E,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,Si,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.model`))+`: `+i(t.modelValue?.request?.model),1)]),e(`p`,Ci,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(T,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(g(),s(`p`,wi,[a(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),t.modelValue?.response?.success===!1?(g(),s(`div`,Ti,[a(E,{closable:!1,class:`failure`},{template:p(()=>[a(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.failure`)),1)]),default:p(()=>[e(`p`,Ei,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(T,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,Di,[a(w,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.failureReason`))+`: `+i(t.modelValue?.response?.error?.message)+` `,1),a(T,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(g(),s(`p`,Oi,[a(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),t.modelValue?.response?.trace_id?(g(),s(`p`,ki,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.traceId`))+`: `+i(t.modelValue?.response?.trace_id)+` `,1),a(T,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),t.modelValue?.response?.success===void 0?(g(),s(`div`,Ai,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.failure`)),1)]),default:p(()=>[e(`p`,ji,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(T,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(g(),s(`p`,Mi,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`kling.name.traceId`))+`: `+i(t.modelValue?.response?.trace_id)+` `,1),a(T,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var Pi=v({name:`RecentPanel`,components:{TaskPreview:M(ci,[[`render`,Ni],[`__scopeId`,`data-v-c36bfd7f`]]),NoTasks:_e,BotPlaceholder:ge,ScrollList:fe},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Fi={key:0},Ii={key:2,class:`w-full h-full flex items-center justify-center`};function Li(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`,Fi,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{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: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`,Ii,[a(v)])):o(``,!0)],64)}var Ri=v({name:`KlingIndex`,components:{ConfigPanel:jn,MotionPanel:Ar,TalkingPhotoPanel:si,TabSwitcher:Fr,Layout:we,RecentPanel:M(Pi,[[`render`,Li]])},mixins:[se],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===oe.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===oe.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},talkingPhotoConfig(){return this.$store.state.kling.talkingPhotoConfig},taskType(){return this.$store.state.kling.taskType||`videos`},tasks(){return this.$store.state.kling.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 pe({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(){console.debug(`start onGetService`),await this.$store.dispatch(`kling/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`kling/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(`kling/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!R(this.uploadTracker,e=>this.$t(e),e=>V.warning(e)))return;let{camera_control:e,...t}=this.config||{},n={...t,async:!0};if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){V.warning(this.$t(`kling.message.endImageRequiresStart`));return}if(n.action||(n.video_id||t.video_url?n.action=`extend`:n.start_image_url?n.action=`image2video`:n.action=`text2video`),n.action===`text2video`&&n.end_image_url&&delete n.end_image_url,e?.type&&(n.camera_control={type:e.type,...e.type===`simple`&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,e])=>e!=null))}:{}}),!B())return;let r=this.credential?.token;if(!r){console.error(`no token specified`);return}V.info(this.$t(`kling.message.startingTask`)),H(`kling`,I.generate(n,{token:r})).then(()=>{V.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?V.error(this.$t(`kling.message.usedUp`)):V.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},async onTabChange(e){e!==this.taskType&&(await this.$store.dispatch(`kling/setTaskType`,e),await this.onGetTasks(),await this.onScrollDown())},async onGenerateMotion(){if(!R(this.uploadTracker,e=>this.$t(e),e=>V.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){V.warning(this.$t(`kling.message.motionMissingInputs`));return}let t={image_url:e.image_url,video_url:e.video_url,character_orientation:e.character_orientation||`video`,mode:e.mode||`std`,keep_original_sound:e.keep_original_sound??`yes`,...e.model_name?{model_name:e.model_name}:{},...e.prompt?{prompt:e.prompt}:{},async:!0};if(!B())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}V.info(this.$t(`kling.message.startingTask`)),H(`kling`,I.motion(t,{token:n})).then(()=>{V.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?V.error(this.$t(`kling.message.usedUp`)):V.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},async onGenerateTalkingPhoto(){if(!R(this.uploadTracker,e=>this.$t(e),e=>V.warning(e)))return;let e=this.talkingPhotoConfig||{};if(!e.image_url||!e.audio_url){V.warning(this.$t(`kling.message.talkingPhotoMissingInputs`));return}let t={image_url:e.image_url,audio_url:e.audio_url,model:e.model||`kling-v2-1-master`,mode:e.mode||`pro`,...e.prompt?{prompt:e.prompt}:{},...e.duration?{duration:e.duration}:{},async:!0};if(!B())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}V.info(this.$t(`kling.message.startingTask`)),H(`kling`,I.talkingPhoto(t,{token:n})).then(()=>{V.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?V.error(this.$t(`kling.message.usedUp`)):V.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),zi={class:`flex flex-col h-full`},Bi={class:`flex-1 min-h-0`};function Vi(t,n,r,i,s,c){let u=l(`tab-switcher`),d=l(`config-panel`),m=l(`motion-panel`),h=l(`talking-photo-panel`),_=l(`recent-panel`),v=l(`layout`);return g(),f(v,null,{config:p(()=>[e(`div`,zi,[a(u,{"model-value":t.taskType,"onUpdate:modelValue":t.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),e(`div`,Bi,[t.taskType===`videos`?(g(),f(d,{key:0,onGenerate:t.onGenerate},null,8,[`onGenerate`])):t.taskType===`motion`?(g(),f(m,{key:1,onGenerate:t.onGenerateMotion},null,8,[`onGenerate`])):t.taskType===`talking-photo`?(g(),f(h,{key:2,onGenerate:t.onGenerateTalkingPhoto},null,8,[`onGenerate`])):o(``,!0)])])]),result:p(()=>[a(_,{ref:`recentPanel`,loading:t.loadingMore,onReachTop:t.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Hi=M(Ri,[[`render`,Vi]]);export{Hi as default};
@@ -1 +1 @@
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-D51kt1Zz.js";import{t as b}from"./upload-D94R1Rp8.js";import{t as x}from"./tooltip-CJVX4lE9.js";import{t as S}from"./image-qteqPy5H.js";import{t as C}from"./alert-Dd1AiDUe.js";import{t as w}from"./drawer-BwzaUz3d.js";import{t as T}from"./switch-B-0uKYNM.js";import{$r as E,Jr as D,Qr as O,Xr as k,Yr as A,Zr as j,qr as M,ri as N,ti as ee}from"./constants-cSF5AGUI.js";import{A as P,Gr as F,Hr as I,Ht as L,Kt as te,Nn as ne,Si as R,Ut as z,Vt as B,Wt as V,en as H,ni as U,nr as W,pi as G}from"./index-CHBZTxdB.js";import{t as K}from"./index.es-oPc3AvSO.js";import{t as q}from"./CopyToClipboard-Dck5vBxW.js";import{t as J}from"./ImagePreview-CAc8PlWR.js";import{n as Y}from"./taskDrawerMixin-DyAUhFEq.js";import{t as X}from"./Consumption-Dug1KpQy.js";import{i as Z,n as re,t as ie}from"./pagination-Cf6OU6TC.js";import{t as Q}from"./VideoPlayer-V3up_w3_.js";import{t as ae}from"./ApiCodeButton-BvZxMZTH.js";import{t as oe}from"./BotPlaceholder-D0xi2CsK.js";import{t as se}from"./NoTasks-RVBrZ_bb.js";import{t as ce}from"./PromptTextarea-gzCu7teW.js";var le=_({name:`LayoutVeo`,components:{ElDrawer:w,ElButton:G,FontAwesomeIcon:K},mixins:[Y]}),ue={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)]`},fe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function pe(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,ue,[e(`div`,de,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,fe,[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 me=P(le,[[`render`,pe],[`__scopeId`,`data-v-12b82bc3`]]),he=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`veo2`,label:`veo2`},{value:`veo2-fast`,label:`veo2-fast`},{value:`veo3`,label:`veo3`},{value:`veo3-fast`,label:`veo3-fast`},{value:`veo31-fast`,label:`veo31-fast`},{value:`veo31`,label:`veo31`},{value:`veo31-fast-ingredients`,label:`veo31-fast-ingredients`}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=k}}),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(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.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=P(he,[[`render`,ve],[`__scopeId`,`data-v-a59d89c9`]]),be=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)},{value:`upsample`,label:this.$t(`veo.button.actionUpsample`)},{value:`extend`,label:this.$t(`veo.button.actionExtend`)},{value:`reshoot`,label:this.$t(`veo.button.actionReshoot`)},{value:`object_insert`,label:this.$t(`veo.button.actionObjectInsert`)},{value:`object_remove`,label:this.$t(`veo.button.actionObjectRemove`)}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||=M}}),xe={class:`field`},Se={class:`title font-bold`},Ce={class:`float-left`};function we(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(`veo.name.action`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),clearable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,t=>(h(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,Ce,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Te=P(be,[[`render`,we],[`__scopeId`,`data-v-f4d8785c`]]),Ee=_({name:`TranslationSelector`,components:{ElSwitch:T,InfoIcon:Z},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),De={class:`relative`},Oe={class:`flex justify-between`},ke={class:`flex justify-start items-center`},Ae={class:`text-sm font-bold`},je={class:`flex justify-end items-center`};function Me(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-switch`);return h(),o(`div`,De,[e(`div`,Oe,[e(`div`,ke,[e(`span`,Ae,r(t.$t(`veo.name.translation`)),1),i(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,je,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ne=P(Ee,[[`render`,Me]]),Pe=_({name:`AspectRatioSelector`,data(){return{options:[{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.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=D}}),Fe={class:`text-sm font-bold mb-2 block`},Ie={class:`items`},Le=[`onClick`],Re={class:`name`};function ze(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,Fe,r(n.$t(`veo.name.ratio`)),1),e(`div`,Ie,[(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`,Re,r(i.label),1)],10,Le))),128))])])}var Be=P(Pe,[[`render`,ze],[`__scopeId`,`data-v-28c472c4`]]),Ve=_({name:`VideoFromInput`,components:{VideoPlayer:Q},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.veo?.config}}}),He={class:`relative`},Ue={class:`flex mb-2`},We={class:`text-sm font-bold`};function Ge(t,n,i,s,l,u){let f=c(`video-player`);return h(),o(`div`,He,[e(`div`,Ue,[e(`span`,We,r(t.$t(`veo.name.action3`)),1)]),e(`div`,null,[t.config?.video_url?(h(),d(f,{key:0,src:t.config?.video_url},null,8,[`src`])):a(``,!0)])])}var Ke=P(Ve,[[`render`,Ge]]),qe=_({name:`VideoIdInput`,components:{ElInput:R},computed:{value:{get(){return this.$store.state.veo?.config?.video_id},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,video_id:e})}}}}),Je={class:`field`},Ye={class:`title font-bold`};function Xe(t,n,a,s,l,u){let d=c(`el-input`);return h(),o(`div`,Je,[e(`h2`,Ye,r(t.$t(`veo.name.videoId`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,type:`text`,placeholder:t.$t(`veo.placeholder.videoId`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var Ze=P(qe,[[`render`,Xe],[`__scopeId`,`data-v-6eba4026`]]),Qe=_({name:`StartEndImage`,components:{ElUpload:b,ElButton:G,InfoIcon:Z,FontAwesomeIcon:K,ImagePreview:J},mixins:[V,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?.veo?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){U.warning(this.$t(`veo.message.uploadReferencesExceed`))},onError(){U.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),$e={class:`relative`},et={class:`flex justify-between`},tt={class:`flex justify-start items-center`},nt={class:`text-sm font-bold`};function rt(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`,$e,[e(`div`,et,[e(`div`,tt,[e(`span`,nt,r(t.$t(`veo.name.startEndImage`)),1),i(g,{content:t.$t(`veo.description.uploadStartEndImage`)},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:2,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(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var it=P(Qe,[[`render`,rt],[`__scopeId`,`data-v-f9a79b4a`]]),at=_({name:`UpsampleActionSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return N.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.upsample_action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,upsample_action:e})}}},mounted(){this.value||=O}}),ot={class:`field`},st={class:`title font-bold`};function ct(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ot,[e(`h2`,st,r(t.$t(`veo.name.upsampleAction`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.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 lt=P(at,[[`render`,ct],[`__scopeId`,`data-v-8b74a7ae`]]),ut=_({name:`ExtendModelSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return E.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){(!this.value||!E.includes(this.value))&&(this.value=A)}}),dt={class:`field`},ft={class:`title font-bold`};function pt(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,dt,[e(`h2`,ft,r(t.$t(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.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 mt=P(ut,[[`render`,pt],[`__scopeId`,`data-v-cc3f9355`]]),ht=_({name:`MotionTypeSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return ee.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.motion_type},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,motion_type:e})}}},mounted(){this.value||=j}}),gt={class:`field`},_t={class:`title font-bold`};function vt(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,gt,[e(`h2`,_t,r(t.$t(`veo.name.motionType`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),filterable:``},{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 yt=P(ht,[[`render`,vt],[`__scopeId`,`data-v-3affff3c`]]),bt=_({name:`ImageMaskInput`,components:{ElInput:R},computed:{value:{get(){return this.$store.state.veo?.config?.image_mask},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,image_mask:e})}}}}),xt={class:`field`},St={class:`title font-bold`};function Ct(t,n,a,s,l,u){let d=c(`el-input`);return h(),o(`div`,xt,[e(`h2`,St,r(t.$t(`veo.name.imageMask`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,type:`text`,placeholder:t.$t(`veo.placeholder.imageMask`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var wt=P(bt,[[`render`,Ct],[`__scopeId`,`data-v-6cc27c68`]]),Tt=_({name:`PromptInput`,components:{PromptTextarea:ce},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Et(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(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Dt=P(Tt,[[`render`,Et]]),Ot=[`upsample`,`extend`,`reshoot`,`object_insert`,`object_remove`,`get1080p`],kt=[`text2video`,`image2video`,`ingredients2video`],At=_({name:`ConfigPanel`,components:{ElButton:G,Consumption:X,FontAwesomeIcon:K,PromptInput:Dt,ModelSelector:ye,StartEndImage:it,ActionSelector:Te,VideoFromInput:Ke,VideoIdInput:Ze,UpsampleActionSelector:lt,ExtendModelSelector:mt,MotionTypeSelector:yt,ImageMaskInput:wt,TranslationSelector:Ne,AspectRatioSelector:Be},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},consumption(){return te(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service},isPostProcessing(){return Ot.includes(this.config?.action??``)},isGeneration(){return kt.includes(this.config?.action??``)}},methods:{onGenerate(){this.$emit(`generate`)}}}),jt={class:`flex flex-col h-full`},Mt={class:`flex-1 overflow-y-auto p-5`},Nt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pt(t,l,u,p,m,g){let _=c(`action-selector`),v=c(`video-from-input`),y=c(`video-id-input`),b=c(`upsample-action-selector`),x=c(`extend-model-selector`),S=c(`prompt-input`),C=c(`motion-type-selector`),w=c(`image-mask-input`),T=c(`translation-selector`),E=c(`aspect-ratio-selector`),D=c(`model-selector`),O=c(`start-end-image`),k=c(`consumption`),A=c(`font-awesome-icon`),j=c(`el-button`);return h(),o(`div`,jt,[e(`div`,Mt,[i(_,{class:`mb-4`}),t.isPostProcessing?(h(),o(s,{key:0},[t.config?.video_url?(h(),d(v,{key:0,class:`mb-4`})):a(``,!0),i(y,{class:`mb-4`})],64)):a(``,!0),t.config?.action===`upsample`?(h(),d(b,{key:1,class:`mb-4`})):a(``,!0),t.config?.action===`extend`?(h(),d(x,{key:2,class:`mb-4`})):a(``,!0),t.config?.action===`extend`?(h(),d(S,{key:3,class:`mb-4`})):a(``,!0),t.config?.action===`reshoot`?(h(),d(C,{key:4,class:`mb-4`})):a(``,!0),t.config?.action===`object_insert`?(h(),d(S,{key:5,class:`mb-4`})):a(``,!0),t.config?.action===`object_insert`||t.config?.action===`object_remove`?(h(),d(w,{key:6,class:`mb-4`})):a(``,!0),t.config?.action===`object_remove`?(h(),d(S,{key:7,class:`mb-4`})):a(``,!0),t.isGeneration?(h(),o(s,{key:8},[i(T,{class:`mb-4`}),i(E,{class:`mb-4`}),i(S,{class:`mb-4`}),t.config?.action===`ingredients2video`?a(``,!0):(h(),d(D,{key:0,class:`mb-4`})),t.config?.action===`image2video`||t.config?.action===`ingredients2video`?(h(),d(O,{key:1,class:`mb-2`})):a(``,!0)],64)):a(``,!0)]),e(`div`,Nt,[i(k,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(j,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ft=P(At,[[`render`,Pt]]),It=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:q,FontAwesomeIcon:K,ElAlert:C,VideoPlayer:Q,ElTooltip:x,ElButton:G,ApiCodeButton:ae},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onPickAction(e,t,n,r){console.debug(`seed config from preview`,{action:n,upsampleAction:r,response:t}),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:n,video_id:t?.data?.[0]?.id,video_url:t?.data?.[0]?.video_url,...r?{upsample_action:r}:{}})},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Lt={class:`preview`},Rt={class:`left`},zt={class:`main`},Bt={class:`bot`},Vt={class:`datetime`},Ht={class:`info`},Ut={key:0,class:`prompt mt-2`},Wt={key:0},Gt={key:1},Kt={key:0,class:t({content:!0,failed:!0})},qt={key:0,class:`mb-4`},$={key:1,class:t({operations:!0,"mt-2":!0})},Jt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Zt={key:1,class:t({content:!0})},Qt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},en={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},nn={key:2,class:t({content:!0})},rn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function on(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`,Lt,[e(`div`,Rt,[i(g,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),e(`div`,zt,[e(`div`,Bt,[n(r(t.$t(`veo.name.veoBot`))+` `,1),e(`span`,Vt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Ht,[t.modelValue?.request?.prompt?(h(),o(`p`,Ut,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,Wt,` - (`+r(t.$t(`veo.status.pending`))+`) `,1)),Array.isArray(t.modelValue?.response?.data)&&t.modelValue?.response?.data[0]?.state===`running`?(h(),o(`span`,Gt,` - (`+r(t.$t(`veo.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,Kt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,qt,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,$,[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`1080p`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsample1080p`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:1,type:`info`,size:`small`,class:`btn-action`,onClick:s[1]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`4k`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsample4k`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:2,type:`info`,size:`small`,class:`btn-action`,onClick:s[2]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`gif`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsampleGif`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:3,type:`info`,size:`small`,class:`btn-action`,onClick:s[3]||=e=>t.onPickAction(e,t.modelValue?.response,`extend`)},{default:f(()=>[n(r(t.$t(`veo.button.actionExtend`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:4,type:`info`,size:`small`,class:`btn-action`,onClick:s[4]||=e=>t.onPickAction(e,t.modelValue?.response,`reshoot`)},{default:f(()=>[n(r(t.$t(`veo.button.actionReshoot`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:5,type:`info`,size:`small`,class:`btn-action`,onClick:s[5]||=e=>t.onPickAction(e,t.modelValue?.response,`object_insert`)},{default:f(()=>[n(r(t.$t(`veo.button.actionObjectInsert`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:6,type:`info`,size:`small`,class:`btn-action`,onClick:s[6]||=e=>t.onPickAction(e,t.modelValue?.response,`object_remove`)},{default:f(()=>[n(r(t.$t(`veo.button.actionObjectRemove`)),1)]),_:1})):a(``,!0),i(y,{class:`box-item`,effect:`dark`,content:t.$t(`veo.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[7]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`veo.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/veo/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,Jt,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,Yt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,Xt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,Zt,[i(C,{closable:!1,class:`failure`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,Qt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,$t,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,en,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,tn,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.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),t.modelValue?.response?.success===void 0?(h(),o(`div`,nn,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,rn,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(h(),o(`p`,an,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.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 sn=_({name:`RecentPanel`,components:{TaskPreview:P(It,[[`render`,on],[`__scopeId`,`data-v-9698fe5f`]]),NoTasks:se,BotPlaceholder:oe,ScrollList:re},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),cn={key:0},ln={key:2,class:`w-full h-full flex items-center justify-center`};function un(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`,cn,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{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: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`,ln,[i(v)])):a(``,!0)],64)}var dn=_({name:`VeoIndex`,components:{ConfigPanel:Ft,Layout:me,RecentPanel:P(sn,[[`render`,un]])},mixins:[z],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===I.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===I.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.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 ie({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(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/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(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!B(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let e={...this.config,async:!0};if(!H())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if(e.action===`image2video`&&!(e.image_urls&&e.image_urls.length>0)){U.warning(this.$t(`veo.message.imageRequired`));return}(!e.image_urls||e.image_urls.length===0)&&delete e.image_urls,U.info(this.$t(`veo.message.startingTask`)),W(`veo`,ne.generate(e,{token:t})).then(()=>{U.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`veo.message.usedUp`)):U.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function fn(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 pn=P(dn,[[`render`,fn]]);export{pn as default};
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-CTDC5uOC.js";import{t as b}from"./upload-BtRsvcZP.js";import{t as x}from"./tooltip-DzkWi5KW.js";import{t as S}from"./image-CCLzQcZ9.js";import{t as C}from"./alert-BP_NaFjc.js";import{t as w}from"./drawer-CBfe4XvW.js";import{t as T}from"./switch-C8ewwQQI.js";import{$r as E,Jr as D,Qr as O,Xr as k,Yr as A,Zr as j,qr as M,ri as N,ti as ee}from"./constants-2P9-grH4.js";import{A as P,Gr as F,Hr as I,Ht as L,Kt as te,Nn as ne,Si as R,Ut as z,Vt as B,Wt as V,en as H,ni as U,nr as W,pi as G}from"./index-DYp9zzBh.js";import{t as K}from"./index.es-AcnoqPen.js";import{t as q}from"./CopyToClipboard-CU8Wt48G.js";import{t as J}from"./ImagePreview-CeVbAkCH.js";import{n as Y}from"./taskDrawerMixin-DyAUhFEq.js";import{t as X}from"./Consumption-BbXEEfaa.js";import{i as Z,n as re,t as ie}from"./pagination-D3yr6QMB.js";import{t as Q}from"./VideoPlayer-0hcpcBnn.js";import{t as ae}from"./ApiCodeButton-BSIwtZSr.js";import{t as oe}from"./BotPlaceholder-CQK6dyT8.js";import{t as se}from"./NoTasks-BiT26E2U.js";import{t as ce}from"./PromptTextarea-Da3Adw2P.js";var le=_({name:`LayoutVeo`,components:{ElDrawer:w,ElButton:G,FontAwesomeIcon:K},mixins:[Y]}),ue={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)]`},fe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function pe(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,ue,[e(`div`,de,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,fe,[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 me=P(le,[[`render`,pe],[`__scopeId`,`data-v-12b82bc3`]]),he=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`veo2`,label:`veo2`},{value:`veo2-fast`,label:`veo2-fast`},{value:`veo3`,label:`veo3`},{value:`veo3-fast`,label:`veo3-fast`},{value:`veo31-fast`,label:`veo31-fast`},{value:`veo31`,label:`veo31`},{value:`veo31-fast-ingredients`,label:`veo31-fast-ingredients`}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=k}}),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(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.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=P(he,[[`render`,ve],[`__scopeId`,`data-v-a59d89c9`]]),be=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)},{value:`upsample`,label:this.$t(`veo.button.actionUpsample`)},{value:`extend`,label:this.$t(`veo.button.actionExtend`)},{value:`reshoot`,label:this.$t(`veo.button.actionReshoot`)},{value:`object_insert`,label:this.$t(`veo.button.actionObjectInsert`)},{value:`object_remove`,label:this.$t(`veo.button.actionObjectRemove`)}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||=M}}),xe={class:`field`},Se={class:`title font-bold`},Ce={class:`float-left`};function we(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(`veo.name.action`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),clearable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,t=>(h(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,Ce,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Te=P(be,[[`render`,we],[`__scopeId`,`data-v-f4d8785c`]]),Ee=_({name:`TranslationSelector`,components:{ElSwitch:T,InfoIcon:Z},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),De={class:`relative`},Oe={class:`flex justify-between`},ke={class:`flex justify-start items-center`},Ae={class:`text-sm font-bold`},je={class:`flex justify-end items-center`};function Me(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-switch`);return h(),o(`div`,De,[e(`div`,Oe,[e(`div`,ke,[e(`span`,Ae,r(t.$t(`veo.name.translation`)),1),i(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,je,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ne=P(Ee,[[`render`,Me]]),Pe=_({name:`AspectRatioSelector`,data(){return{options:[{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.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=D}}),Fe={class:`text-sm font-bold mb-2 block`},Ie={class:`items`},Le=[`onClick`],Re={class:`name`};function ze(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,Fe,r(n.$t(`veo.name.ratio`)),1),e(`div`,Ie,[(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`,Re,r(i.label),1)],10,Le))),128))])])}var Be=P(Pe,[[`render`,ze],[`__scopeId`,`data-v-28c472c4`]]),Ve=_({name:`VideoFromInput`,components:{VideoPlayer:Q},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.veo?.config}}}),He={class:`relative`},Ue={class:`flex mb-2`},We={class:`text-sm font-bold`};function Ge(t,n,i,s,l,u){let f=c(`video-player`);return h(),o(`div`,He,[e(`div`,Ue,[e(`span`,We,r(t.$t(`veo.name.action3`)),1)]),e(`div`,null,[t.config?.video_url?(h(),d(f,{key:0,src:t.config?.video_url},null,8,[`src`])):a(``,!0)])])}var Ke=P(Ve,[[`render`,Ge]]),qe=_({name:`VideoIdInput`,components:{ElInput:R},computed:{value:{get(){return this.$store.state.veo?.config?.video_id},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,video_id:e})}}}}),Je={class:`field`},Ye={class:`title font-bold`};function Xe(t,n,a,s,l,u){let d=c(`el-input`);return h(),o(`div`,Je,[e(`h2`,Ye,r(t.$t(`veo.name.videoId`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,type:`text`,placeholder:t.$t(`veo.placeholder.videoId`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var Ze=P(qe,[[`render`,Xe],[`__scopeId`,`data-v-6eba4026`]]),Qe=_({name:`StartEndImage`,components:{ElUpload:b,ElButton:G,InfoIcon:Z,FontAwesomeIcon:K,ImagePreview:J},mixins:[V,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?.veo?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){U.warning(this.$t(`veo.message.uploadReferencesExceed`))},onError(){U.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),$e={class:`relative`},et={class:`flex justify-between`},tt={class:`flex justify-start items-center`},nt={class:`text-sm font-bold`};function rt(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`,$e,[e(`div`,et,[e(`div`,tt,[e(`span`,nt,r(t.$t(`veo.name.startEndImage`)),1),i(g,{content:t.$t(`veo.description.uploadStartEndImage`)},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:2,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(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var it=P(Qe,[[`render`,rt],[`__scopeId`,`data-v-f9a79b4a`]]),at=_({name:`UpsampleActionSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return N.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.upsample_action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,upsample_action:e})}}},mounted(){this.value||=O}}),ot={class:`field`},st={class:`title font-bold`};function ct(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ot,[e(`h2`,st,r(t.$t(`veo.name.upsampleAction`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.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 lt=P(at,[[`render`,ct],[`__scopeId`,`data-v-8b74a7ae`]]),ut=_({name:`ExtendModelSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return E.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){(!this.value||!E.includes(this.value))&&(this.value=A)}}),dt={class:`field`},ft={class:`title font-bold`};function pt(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,dt,[e(`h2`,ft,r(t.$t(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.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 mt=P(ut,[[`render`,pt],[`__scopeId`,`data-v-cc3f9355`]]),ht=_({name:`MotionTypeSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return ee.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.motion_type},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,motion_type:e})}}},mounted(){this.value||=j}}),gt={class:`field`},_t={class:`title font-bold`};function vt(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,gt,[e(`h2`,_t,r(t.$t(`veo.name.motionType`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),filterable:``},{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 yt=P(ht,[[`render`,vt],[`__scopeId`,`data-v-3affff3c`]]),bt=_({name:`ImageMaskInput`,components:{ElInput:R},computed:{value:{get(){return this.$store.state.veo?.config?.image_mask},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,image_mask:e})}}}}),xt={class:`field`},St={class:`title font-bold`};function Ct(t,n,a,s,l,u){let d=c(`el-input`);return h(),o(`div`,xt,[e(`h2`,St,r(t.$t(`veo.name.imageMask`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,type:`text`,placeholder:t.$t(`veo.placeholder.imageMask`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var wt=P(bt,[[`render`,Ct],[`__scopeId`,`data-v-6cc27c68`]]),Tt=_({name:`PromptInput`,components:{PromptTextarea:ce},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Et(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(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Dt=P(Tt,[[`render`,Et]]),Ot=[`upsample`,`extend`,`reshoot`,`object_insert`,`object_remove`,`get1080p`],kt=[`text2video`,`image2video`,`ingredients2video`],At=_({name:`ConfigPanel`,components:{ElButton:G,Consumption:X,FontAwesomeIcon:K,PromptInput:Dt,ModelSelector:ye,StartEndImage:it,ActionSelector:Te,VideoFromInput:Ke,VideoIdInput:Ze,UpsampleActionSelector:lt,ExtendModelSelector:mt,MotionTypeSelector:yt,ImageMaskInput:wt,TranslationSelector:Ne,AspectRatioSelector:Be},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},consumption(){return te(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service},isPostProcessing(){return Ot.includes(this.config?.action??``)},isGeneration(){return kt.includes(this.config?.action??``)}},methods:{onGenerate(){this.$emit(`generate`)}}}),jt={class:`flex flex-col h-full`},Mt={class:`flex-1 overflow-y-auto p-5`},Nt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pt(t,l,u,p,m,g){let _=c(`action-selector`),v=c(`video-from-input`),y=c(`video-id-input`),b=c(`upsample-action-selector`),x=c(`extend-model-selector`),S=c(`prompt-input`),C=c(`motion-type-selector`),w=c(`image-mask-input`),T=c(`translation-selector`),E=c(`aspect-ratio-selector`),D=c(`model-selector`),O=c(`start-end-image`),k=c(`consumption`),A=c(`font-awesome-icon`),j=c(`el-button`);return h(),o(`div`,jt,[e(`div`,Mt,[i(_,{class:`mb-4`}),t.isPostProcessing?(h(),o(s,{key:0},[t.config?.video_url?(h(),d(v,{key:0,class:`mb-4`})):a(``,!0),i(y,{class:`mb-4`})],64)):a(``,!0),t.config?.action===`upsample`?(h(),d(b,{key:1,class:`mb-4`})):a(``,!0),t.config?.action===`extend`?(h(),d(x,{key:2,class:`mb-4`})):a(``,!0),t.config?.action===`extend`?(h(),d(S,{key:3,class:`mb-4`})):a(``,!0),t.config?.action===`reshoot`?(h(),d(C,{key:4,class:`mb-4`})):a(``,!0),t.config?.action===`object_insert`?(h(),d(S,{key:5,class:`mb-4`})):a(``,!0),t.config?.action===`object_insert`||t.config?.action===`object_remove`?(h(),d(w,{key:6,class:`mb-4`})):a(``,!0),t.config?.action===`object_remove`?(h(),d(S,{key:7,class:`mb-4`})):a(``,!0),t.isGeneration?(h(),o(s,{key:8},[i(T,{class:`mb-4`}),i(E,{class:`mb-4`}),i(S,{class:`mb-4`}),t.config?.action===`ingredients2video`?a(``,!0):(h(),d(D,{key:0,class:`mb-4`})),t.config?.action===`image2video`||t.config?.action===`ingredients2video`?(h(),d(O,{key:1,class:`mb-2`})):a(``,!0)],64)):a(``,!0)]),e(`div`,Nt,[i(k,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(j,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ft=P(At,[[`render`,Pt]]),It=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:q,FontAwesomeIcon:K,ElAlert:C,VideoPlayer:Q,ElTooltip:x,ElButton:G,ApiCodeButton:ae},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onPickAction(e,t,n,r){console.debug(`seed config from preview`,{action:n,upsampleAction:r,response:t}),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:n,video_id:t?.data?.[0]?.id,video_url:t?.data?.[0]?.video_url,...r?{upsample_action:r}:{}})},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Lt={class:`preview`},Rt={class:`left`},zt={class:`main`},Bt={class:`bot`},Vt={class:`datetime`},Ht={class:`info`},Ut={key:0,class:`prompt mt-2`},Wt={key:0},Gt={key:1},Kt={key:0,class:t({content:!0,failed:!0})},qt={key:0,class:`mb-4`},$={key:1,class:t({operations:!0,"mt-2":!0})},Jt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Zt={key:1,class:t({content:!0})},Qt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},en={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},nn={key:2,class:t({content:!0})},rn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function on(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`,Lt,[e(`div`,Rt,[i(g,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),e(`div`,zt,[e(`div`,Bt,[n(r(t.$t(`veo.name.veoBot`))+` `,1),e(`span`,Vt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Ht,[t.modelValue?.request?.prompt?(h(),o(`p`,Ut,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,Wt,` - (`+r(t.$t(`veo.status.pending`))+`) `,1)),Array.isArray(t.modelValue?.response?.data)&&t.modelValue?.response?.data[0]?.state===`running`?(h(),o(`span`,Gt,` - (`+r(t.$t(`veo.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,Kt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,qt,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,$,[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`1080p`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsample1080p`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:1,type:`info`,size:`small`,class:`btn-action`,onClick:s[1]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`4k`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsample4k`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:2,type:`info`,size:`small`,class:`btn-action`,onClick:s[2]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`gif`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsampleGif`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:3,type:`info`,size:`small`,class:`btn-action`,onClick:s[3]||=e=>t.onPickAction(e,t.modelValue?.response,`extend`)},{default:f(()=>[n(r(t.$t(`veo.button.actionExtend`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:4,type:`info`,size:`small`,class:`btn-action`,onClick:s[4]||=e=>t.onPickAction(e,t.modelValue?.response,`reshoot`)},{default:f(()=>[n(r(t.$t(`veo.button.actionReshoot`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:5,type:`info`,size:`small`,class:`btn-action`,onClick:s[5]||=e=>t.onPickAction(e,t.modelValue?.response,`object_insert`)},{default:f(()=>[n(r(t.$t(`veo.button.actionObjectInsert`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:6,type:`info`,size:`small`,class:`btn-action`,onClick:s[6]||=e=>t.onPickAction(e,t.modelValue?.response,`object_remove`)},{default:f(()=>[n(r(t.$t(`veo.button.actionObjectRemove`)),1)]),_:1})):a(``,!0),i(y,{class:`box-item`,effect:`dark`,content:t.$t(`veo.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[7]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`veo.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/veo/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,Jt,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,Yt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,Xt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,Zt,[i(C,{closable:!1,class:`failure`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,Qt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,$t,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,en,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,tn,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.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),t.modelValue?.response?.success===void 0?(h(),o(`div`,nn,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,rn,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(h(),o(`p`,an,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.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 sn=_({name:`RecentPanel`,components:{TaskPreview:P(It,[[`render`,on],[`__scopeId`,`data-v-9698fe5f`]]),NoTasks:se,BotPlaceholder:oe,ScrollList:re},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),cn={key:0},ln={key:2,class:`w-full h-full flex items-center justify-center`};function un(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`,cn,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{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: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`,ln,[i(v)])):a(``,!0)],64)}var dn=_({name:`VeoIndex`,components:{ConfigPanel:Ft,Layout:me,RecentPanel:P(sn,[[`render`,un]])},mixins:[z],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===I.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===I.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.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 ie({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(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/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(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!B(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let e={...this.config,async:!0};if(!H())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if(e.action===`image2video`&&!(e.image_urls&&e.image_urls.length>0)){U.warning(this.$t(`veo.message.imageRequired`));return}(!e.image_urls||e.image_urls.length===0)&&delete e.image_urls,U.info(this.$t(`veo.message.startingTask`)),W(`veo`,ne.generate(e,{token:t})).then(()=>{U.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`veo.message.usedUp`)):U.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function fn(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 pn=P(dn,[[`render`,fn]]);export{pn as default};