@acedatacloud/nexior 3.276.2 → 3.276.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.
- package/dist/assets/{ApiCodeButton-C8TdRvY9.js → ApiCodeButton-DpYCu-EK.js} +1 -1
- package/dist/assets/{AskUserQuestionCard-jb8bzPLa.js → AskUserQuestionCard-CFwxSrmZ.js} +1 -1
- package/dist/assets/{Auth-CevT-APY.js → Auth-7LLt4q3p.js} +1 -1
- package/dist/assets/{Bare-B1hu6q7Z.js → Bare-JAoG6sFQ.js} +1 -1
- package/dist/assets/{BotPlaceholder-DzIzZltA.js → BotPlaceholder-BVXWzbpi.js} +1 -1
- package/dist/assets/{BottomFooter-BIZMLZ5i.js → BottomFooter-BTcNTyiV.js} +1 -1
- package/dist/assets/{Callback-BnArHSvk.js → Callback-CW861dqy.js} +1 -1
- package/dist/assets/{Console-BqpoQ6Rt.js → Console-BOxYP152.js} +1 -1
- package/dist/assets/{Consumption-DLzGFeUT.js → Consumption-QfvilMcG.js} +1 -1
- package/dist/assets/{Conversation-BPaCX6gr.js → Conversation-C1Jb8AgW.js} +1 -1
- package/dist/assets/{CopyToClipboard-LZRed5aB.js → CopyToClipboard-C8gyDUMn.js} +1 -1
- package/dist/assets/{Detail-CnZ-bcZY.js → Detail-BMuX9lMp.js} +2 -2
- package/dist/assets/{Extra-D6o35zFO.js → Extra-BshQjZAE.js} +1 -1
- package/dist/assets/{FilePreview-Dj6VOjhF.js → FilePreview-sx756NB5.js} +1 -1
- package/dist/assets/{Hailuo-C2eHP_WO.js → Hailuo-y5ZOpsGB.js} +1 -1
- package/dist/assets/{History-BUdtyskA.js → History-CBejCufL.js} +1 -1
- package/dist/assets/{ImagePreview-B2FwyzyM.js → ImagePreview-DkXTeOKK.js} +1 -1
- package/dist/assets/{ImageWrapper-_6c4eeKK.js → ImageWrapper-3eqDS8_u.js} +1 -1
- package/dist/assets/{Index-BoG5tSrk.js → Index-05qa1gOC.js} +1 -1
- package/dist/assets/{Index-DgPyFPeb.js → Index-B8H2_z9_.js} +1 -1
- package/dist/assets/{Index-CECIU01b.js → Index-B9wup2zp.js} +1 -1
- package/dist/assets/{Index-C6amW6vz.js → Index-BCYh1z7D.js} +1 -1
- package/dist/assets/{Index-EpovLoMr.js → Index-BJ5FlOXw.js} +1 -1
- package/dist/assets/{Index-C9iJDxXm.js → Index-BJFLDUCM.js} +1 -1
- package/dist/assets/{Index-Dz4NPEQR.js → Index-BRWua7Pn.js} +1 -1
- package/dist/assets/{Index-BPbDPB0M.js → Index-BS_kWluw.js} +1 -1
- package/dist/assets/{Index-rG7e6yXk.js → Index-Be7Y4LIt.js} +1 -1
- package/dist/assets/{Index-CAAN1-_p.js → Index-Bi4e1Cno.js} +1 -1
- package/dist/assets/{Index-DIAtAXGz.js → Index-CEt4sPAp.js} +1 -1
- package/dist/assets/{Index-F3vpxi6E.js → Index-CKtL81ue.js} +1 -1
- package/dist/assets/{Index-BRMiltIw.js → Index-CLgbPHLC.js} +1 -1
- package/dist/assets/{Index-DXBSOAj0.js → Index-CpdPDUM5.js} +1 -1
- package/dist/assets/{Index-hX7fovd_.js → Index-D1ObDODx.js} +1 -1
- package/dist/assets/{Index-BqLQt-5m.js → Index-DREci_3x.js} +1 -1
- package/dist/assets/{Index-rQFLYHuV.js → Index-DbNh8zrA.js} +1 -1
- package/dist/assets/{Index-CD1M-uJN.js → Index-Di-zu-p8.js} +1 -1
- package/dist/assets/{Index-CUKPMLC-.js → Index-DlZMH8SN.js} +1 -1
- package/dist/assets/{Index-Cu81R2TY.js → Index-DuiQE6-J.js} +1 -1
- package/dist/assets/{Index-CkITI13f.js → Index-N6d4HE9o.js} +1 -1
- package/dist/assets/{Index-CZKWwYGB.js → Index-VyvPGs_5.js} +1 -1
- package/dist/assets/{Index-CzZR-m2_.js → Index-d635oMC0.js} +1 -1
- package/dist/assets/{Index-Bbr9Hgc0.js → Index-irgLZ7_Q.js} +1 -1
- package/dist/assets/{Index-BzP5ATX6.js → Index-twlRmX4y.js} +1 -1
- package/dist/assets/{Index-Bm2glD67.js → Index-vDMn1c6V.js} +1 -1
- package/dist/assets/{Invitees-BifLqHGu.js → Invitees-C0R3g-Zf.js} +1 -1
- package/dist/assets/{List-CIOMae5H.js → List-D6nFAmNC.js} +1 -1
- package/dist/assets/{List-Br93CnR9.js → List-DWwcbcPH.js} +1 -1
- package/dist/assets/{List-CMDhlz5R.js → List-DiYo0Int.js} +1 -1
- package/dist/assets/{Main-NAvdrrX0.js → Main-DXUAcE9k.js} +1 -1
- package/dist/assets/{Model-BUjfzCpS.js → Model-CqYI1sS8.js} +1 -1
- package/dist/assets/{Navigator-ym7KWo_7.js → Navigator-C2kRAciX.js} +1 -1
- package/dist/assets/{NoTasks-Bk9F1-iz.js → NoTasks-Dk1WXppl.js} +1 -1
- package/dist/assets/{NotFound-m9TVl0hk.js → NotFound-Bqzv83rR.js} +1 -1
- package/dist/assets/{Pagination-ZFaMc_mv.js → Pagination-DYjyzEjF.js} +1 -1
- package/dist/assets/{Pay-DD8YE5fV.js → Pay-DKdYx4a8.js} +1 -1
- package/dist/assets/{Player-CTNTmM4y.js → Player-5nZKlwHx.js} +1 -1
- package/dist/assets/{Seedance-VRmh5uYq.js → Seedance-CNYLui9X.js} +1 -1
- package/dist/assets/{Status-DvNWBZrq.js → Status-Dx6FNAbD.js} +1 -1
- package/dist/assets/{Subscribe-CgnDdnH3.js → Subscribe-Q4ATea2Y.js} +1 -1
- package/dist/assets/{TabSwitcher-BI7dOxCK.js → TabSwitcher-BRab7qRM.js} +1 -1
- package/dist/assets/{Tts-DX6zLgZp.js → Tts-DegoQTKa.js} +1 -1
- package/dist/assets/{VideoPlayer--5snxkv4.js → VideoPlayer-BLPGe-uP.js} +1 -1
- package/dist/assets/{avatar-DoKzF3gM.js → avatar-TKtEO4Yl.js} +1 -1
- package/dist/assets/{basic-BrTbjgdS.js → basic-Db4GCedU.js} +1 -1
- package/dist/assets/{chat-C8jjNDSm.js → chat-C6NbygCS.js} +1 -1
- package/dist/assets/codingBridge-Df_5ydBi.js +2 -0
- package/dist/assets/{codingBridgeNotify-B3rz48kE.js → codingBridgeNotify-4sUlZ3Lg.js} +2 -2
- package/dist/assets/{collapse-Ds9keFcU.js → collapse-BH0qROl8.js} +1 -1
- package/dist/assets/{createTaskActions-_LT4UGX1.js → createTaskActions-xgaPM_qk.js} +1 -1
- package/dist/assets/{date-picker-ye73-4_d.js → date-picker-DnWtfIDn.js} +1 -1
- package/dist/assets/{dropdown-ByGJfhDP.js → dropdown-BpL2qpyg.js} +1 -1
- package/dist/assets/{esm-DJ62h-fH.js → esm-D7H9sAYC.js} +3 -3
- package/dist/assets/{esm-BvAIkUfu.js → esm-D8MgG7kP.js} +1 -1
- package/dist/assets/{esm-L7PMWDOK.js → esm-DRVKxMaD.js} +2 -2
- package/dist/assets/esm-I-Ydzkdh.js +1 -0
- package/dist/assets/{esm-C2P77e7r.js → esm-SCvm8sjU.js} +2 -2
- package/dist/assets/{esm-UykDnDSA.js → esm-y0EduL6s.js} +1 -1
- package/dist/assets/{esm-BgbAZhOw.js → esm-yeJT_40P.js} +1 -1
- package/dist/assets/{fish-5YNJOUMS.js → fish-C13ospyo.js} +1 -1
- package/dist/assets/{flux-D8BMfN_b.js → flux-CuTQgrEI.js} +1 -1
- package/dist/assets/{grokvideo-DAEDe2lC.js → grokvideo-Cxkcup4s.js} +1 -1
- package/dist/assets/{hailuo-Ep2afX61.js → hailuo-ld7fCVPo.js} +1 -1
- package/dist/assets/{headshots-moxuhQ8q.js → headshots-BmUEgkoj.js} +1 -1
- package/dist/assets/{image-CUt2yKJT.js → image-CjzS-up0.js} +1 -1
- package/dist/assets/{index-Dzx62HWL.js → index-BY8YIwDb.js} +3 -3
- package/dist/assets/{index.browser.esm-DtVKnbsq.js → index.browser.esm-li52u8xd.js} +1 -1
- package/dist/assets/{index.es-BIezN10l.js → index.es-CH5vwGaN.js} +1 -1
- package/dist/assets/{input-number-CXFB1_xE.js → input-number-N0auilju.js} +1 -1
- package/dist/assets/{kling-C0C920Il.js → kling-COeQELLT.js} +1 -1
- package/dist/assets/{luma-btnACTNr.js → luma-sQSQhtbj.js} +1 -1
- package/dist/assets/{midjourney-CnVJEo9h.js → midjourney-CTQ-KItL.js} +1 -1
- package/dist/assets/{nanobanana-uQnyuVgy.js → nanobanana-C22a0oYN.js} +1 -1
- package/dist/assets/{openaiimage-B4szqKdR.js → openaiimage-Dq7MWBVX.js} +1 -1
- package/dist/assets/{pagination-t1m3PdtM.js → pagination-CjEVtILV.js} +1 -1
- package/dist/assets/{pika-B6ZkmISK.js → pika-DU0QitGG.js} +1 -1
- package/dist/assets/{pixverse-CMewIDDG.js → pixverse-C-xOT5MG.js} +1 -1
- package/dist/assets/{popover-Dggo6GYh.js → popover-1vWQQB0V.js} +1 -1
- package/dist/assets/{producer-CLqQs_Oy.js → producer-BGA_s87O.js} +1 -1
- package/dist/assets/{qrart-cUqnnNos.js → qrart-tF6e5Ure.js} +1 -1
- package/dist/assets/{row-Dpgq35ln.js → row-JqIo0dw3.js} +1 -1
- package/dist/assets/{seedance-iA_B79lT.js → seedance-CPhZgXeS.js} +1 -1
- package/dist/assets/{seedream-DSZGr5VZ.js → seedream-DueKINO1.js} +1 -1
- package/dist/assets/{select-Byt7Qw1F.js → select-B14L-681.js} +1 -1
- package/dist/assets/{serp-BML2l1cV.js → serp-DKsD2P4f.js} +1 -1
- package/dist/assets/{slider-Chudll8H.js → slider-ypi7YrnL.js} +1 -1
- package/dist/assets/{solana-wallets-DHdSmT1K.js → solana-wallets-B-Ar3QV5.js} +2 -2
- package/dist/assets/{solana-wallets-vue-F4mtRLNf.js → solana-wallets-vue-BxEXL9wo.js} +1 -1
- package/dist/assets/{sora-DBuX8eeJ.js → sora-Bvuj-CwF.js} +1 -1
- package/dist/assets/{suno-BnJ56a_f.js → suno-DBUXJjOG.js} +1 -1
- package/dist/assets/{switch-CqHzcX_8.js → switch-Dir3SgN_.js} +1 -1
- package/dist/assets/{tabs-DZcdINxf.js → tabs-CllsgUVI.js} +1 -1
- package/dist/assets/{upload-CDJi96y4.js → upload-CgRMUkQi.js} +1 -1
- package/dist/assets/{veo-Di_xCBIf.js → veo-DJcppRgO.js} +1 -1
- package/dist/assets/{wan-DChv5HaI.js → wan-CXX5Z70L.js} +1 -1
- package/dist/assets/{web-BlcKxuW2.js → web-AJVUYB9i.js} +1 -1
- package/dist/assets/{web-CKMhgTwv.js → web-B9iHXzqN.js} +1 -1
- package/dist/assets/{web-Hdenr60p.js → web-Bgfp9ZAB.js} +1 -1
- package/dist/assets/{web-CXAG0ZQx.js → web-Cr9qE3HH.js} +1 -1
- package/dist/assets/{web-CmEs3R8h.js → web-jBZ5VzL9.js} +1 -1
- package/dist/assets/{webextrator-CzvKAcAC.js → webextrator-CXlTr4A9.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/codingBridge-oM7Uohq5.js +0 -2
- package/dist/assets/esm-cc-LpyGe.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,Bt as t,D as n,E as r,Ht as i,M as a,N as o,O as s,P as c,Q as l,Ut as u,X as d,_ as f,et as p,k as m,lt as h,ut as g,x as _,y as v}from"./vendor-chart-mdwpew_o.js";import{t as y}from"./button-DWzbdjZV.js";import{E as b}from"./use-deprecated-CPfQu7wa.js";import{r as x,t as S}from"./select-Byt7Qw1F.js";import{n as C,t as w}from"./tabs-DZcdINxf.js";import{t as T}from"./upload-CDJi96y4.js";import{t as E}from"./tooltip-C3PYfh8V.js";import{t as D}from"./image-CUt2yKJT.js";import{t as O}from"./alert-BJj7gY4q.js";import{n as k,r as A}from"./radio-IJQsW93X.js";import{t as j}from"./drawer-BvYPSxXh.js";import{t as M}from"./input-number-CXFB1_xE.js";import{t as ee}from"./slider-Chudll8H.js";import{t as te}from"./switch-CqHzcX_8.js";import{_r as ne,br as N,pi as re}from"./constants-C-bSXdJ_.js";import{At as ie,E as P,Fn as F,Ir as I,Nt as L,Or as R,Ot as z,Pr as ae,Sr as B,jt as V,kr as H,kt as U,pn as W,yr as G}from"./index-Dzx62HWL.js";import{t as K}from"./index.es-BIezN10l.js";import{t as oe}from"./CopyToClipboard-LZRed5aB.js";import{t as se}from"./FilePreview-Dj6VOjhF.js";import{t as q}from"./ImagePreview-B2FwyzyM.js";import{n as ce}from"./taskDrawerMixin-Cr17Yxqk.js";import{t as le}from"./BotPlaceholder-DzIzZltA.js";import{i as J,n as ue,t as de}from"./pagination-t1m3PdtM.js";import{n as fe,t as pe}from"./NoTasks-Bk9F1-iz.js";import{t as me}from"./Consumption-DLzGFeUT.js";import{t as he}from"./ApiCodeButton-C8TdRvY9.js";import{t as ge}from"./VideoPlayer--5snxkv4.js";var _e=c({name:`LayoutKling`,components:{ElDrawer:j,ElButton:y,FontAwesomeIcon:K},mixins:[ce]}),ve={class:`main flex flex-row flex-1 min-h-0`},ye={class:`config w-[320px] flex-none h-full flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},be={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function xe(t,n,i,a,s,c){let l=p(`font-awesome-icon`),u=p(`el-button`),_=p(`el-drawer`);return d(),m(`div`,ve,[r(`div`,ye,[e(t.$slots,`config`,{},void 0,!0)]),r(`div`,be,[e(t.$slots,`result`,{},void 0,!0)]),g(o(u,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:h(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[f,!t.tasksEmpty]]),o(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:h(()=>[e(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Se=P(_e,[[`render`,xe],[`__scopeId`,`data-v-b87958dc`]]),Ce={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 Ce}}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 we=c({name:`ModelSelector`,components:{ElSelect:x,ElOption:S},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(ne)},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 R.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),H.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})}}}),Te={class:`field`},Ee={class:`title font-bold`};function De(e,t,i,a,o,s){let c=p(`el-option`),f=p(`el-select`);return d(),m(`div`,Te,[r(`h2`,Ee,u(e.$t(`pika.name.model`)),1),(d(),n(f,{key:e.revertKey,"model-value":e.value,class:`value`,placeholder:e.$t(`pika.placeholder.select`),onChange:e.onChange},{default:h(()=>[(d(!0),m(_,null,l(e.options,e=>(d(),n(c,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Oe=P(we,[[`render`,De],[`__scopeId`,`data-v-04059875`]]),ke=c({name:`ModeSelector`,components:{ElSelect:x,ElOption:S,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 N.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 R.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),H.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})}}}),Ae={class:`field`},je={class:`header`},Me={class:`title font-bold`},Ne={key:0,class:`opt-tip`};function Pe(e,i,a,c,f,g){let v=p(`info-icon`),y=p(`el-option`),b=p(`el-select`);return d(),m(`div`,Ae,[r(`div`,je,[r(`h2`,Me,u(e.$t(`kling.name.mode`)),1),o(v,{content:e.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(d(),n(b,{key:e.revertKey,"model-value":e.value,class:`value`,placeholder:e.$t(`kling.placeholder.select`),clearable:!0,onChange:e.onChange},{default:h(()=>[(d(!0),m(_,null,l(e.options,e=>(d(),n(y,{key:e.value,label:e.label,value:e.value,disabled:e.disabled},{default:h(()=>[r(`span`,{class:t({"opt-disabled":e.disabled})},u(e.label),3),e.disabled&&e.disabledReason?(d(),m(`span`,Ne,u(e.disabledReason),1)):s(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Fe=P(ke,[[`render`,Pe],[`__scopeId`,`data-v-9a8fa3c5`]]),Ie=[3,5,8,10,12,15],Le=[5,10],Re=c({name:`DurationSelector`,components:{ElSelect:x,ElOption:S,InfoIcon:J},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return N.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?Ie:Le},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 R.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),H.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})}}}),ze={class:`field`},Be={class:`control`},Ve={class:`label`},He={class:`title font-bold`};function Ue(e,t,i,a,s,c){let f=p(`info-icon`),g=p(`el-option`),v=p(`el-select`);return d(),m(`div`,ze,[r(`div`,Be,[r(`div`,Ve,[r(`h2`,He,u(e.$t(`kling.name.duration`)),1),o(f,{content:e.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(d(),n(v,{key:e.revertKey,"model-value":e.selectValue,class:`value`,placeholder:e.$t(`kling.placeholder.select`),onChange:e.onChange},{default:h(()=>[(d(!0),m(_,null,l(e.allowedDurations,e=>(d(),n(g,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var We=P(Re,[[`render`,Ue],[`__scopeId`,`data-v-5ae55e28`]]),Ge=c({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`}}),Ke={class:`text-sm font-bold mb-2 block`},qe={class:`items`},Je=[`onClick`],Ye={class:`name`};function Xe(e,n,a,o,s,c){return d(),m(`div`,null,[r(`span`,Ke,u(e.$t(`kling.name.ratio`)),1),r(`div`,qe,[(d(!0),m(_,null,l(e.options,(n,a)=>(d(),m(`div`,{key:a,class:t({active:e.active===a,item:!0}),onClick:t=>e.value=n.value},[r(`div`,{class:t([`preview`,n.label])},[r(`div`,{class:`rect`,style:i({width:n.width+`px`,height:n.height+`px`})},null,4)],2),r(`p`,Ye,u(n.label),1)],10,Je))),128))])])}var Ze=P(Ge,[[`render`,Xe],[`__scopeId`,`data-v-cdb14b2f`]]),Qe=c({name:`StartImage`,components:{ElUpload:T,ElButton:y,ElTooltip:E,InfoIcon:J,FontAwesomeIcon:K,ImagePreview:q},mixins:[V,U],emits:[`change`],data(){return{fileList:[],uploadUrl:B()+`/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(){H.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){H.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()}}}),$e={class:`relative`},et={class:`flex justify-between`},tt={class:`flex justify-start items-center`},nt={class:`text-sm font-bold`};function rt(e,t,i,c,l,f){let g=p(`info-icon`),_=p(`image-preview`),v=p(`font-awesome-icon`),y=p(`el-button`),b=p(`el-tooltip`),x=p(`el-upload`);return d(),m(`div`,$e,[r(`div`,et,[r(`div`,tt,[r(`span`,nt,u(e.$t(`kling.name.startImage`)),1),o(g,{content:e.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.reachedLimit,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:h(({file:t})=>[t.url&&t.percentage!==void 0?(d(),n(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):s(``,!0)]),default:h(()=>[o(b,{content:e.$t(`kling.message.uploadReferencesExceed`),disabled:!e.reachedLimit,placement:`top`},{default:h(()=>[r(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.reachedLimit},{default:h(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$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 it=P(Qe,[[`render`,rt],[`__scopeId`,`data-v-756dc269`]]),at=c({name:`EndImage`,components:{ElUpload:T,ElButton:y,ElTooltip:E,ImagePreview:q,InfoIcon:J,FontAwesomeIcon:K},mixins:[V,U],data(){return{fileList:[],uploadUrl:B()+`/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:(H.warning(this.$t(`kling.message.endImageRequiresStart`)),!1):(H.warning(this.$t(`kling.message.endImageNotSupported`)),!1)},onExceed(){H.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){H.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()}}}),ot={class:`relative`},st={class:`flex justify-between`},ct={class:`flex justify-start items-center`},lt={class:`text-sm font-bold`};function ut(e,t,i,c,l,f){let g=p(`info-icon`),_=p(`image-preview`),v=p(`font-awesome-icon`),y=p(`el-button`),b=p(`el-tooltip`),x=p(`el-upload`);return d(),m(`div`,ot,[r(`div`,st,[r(`div`,ct,[r(`span`,lt,u(e.$t(`kling.name.endImage`)),1),o(g,{content:e.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"before-upload":e.onBeforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:h(({file:t})=>[t.url&&t.percentage!==void 0?(d(),n(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):s(``,!0)]),default:h(()=>[o(b,{content:e.uploadTooltip,disabled:!e.uploadDisabled,placement:`top`},{default:h(()=>[r(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.uploadDisabled},{default:h(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$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 dt=P(at,[[`render`,ut],[`__scopeId`,`data-v-c1b257e5`]]),ft=c({name:`CfgScaleSelector`,components:{ElSlider:ee,InfoIcon:J,ElInputNumber:M},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}}),pt={class:`flex justify-between`},mt={class:`flex justify-start items-center`},ht={class:`text-sm font-bold`},gt={class:`flex justify-end items-center`},_t={class:`w-full`};function vt(e,t,n,i,a,s){let c=p(`info-icon`),l=p(`el-input-number`),f=p(`el-slider`);return d(),m(`div`,null,[r(`div`,pt,[r(`div`,mt,[r(`span`,ht,u(e.$t(`kling.name.cfgScale`)),1),o(c,{content:e.$t(`kling.description.cfgScale`)},null,8,[`content`])]),r(`div`,gt,[o(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,"controls-position":`right`},null,8,[`modelValue`])])]),r(`div`,_t,[o(f,{modelValue:e.value,"onUpdate:modelValue":t[1]||=t=>e.value=t,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var yt=P(ft,[[`render`,vt]]),bt=c({name:`GenerateAudioSelector`,components:{ElSwitch:te,InfoIcon:J},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(N.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})}}}),xt={class:`relative`},St={class:`flex justify-between items-center`},Ct={class:`flex justify-start items-center`},wt={class:`text-sm font-bold`};function Tt(e,t,n,i,a,s){let c=p(`info-icon`),l=p(`el-switch`);return d(),m(`div`,xt,[r(`div`,St,[r(`div`,Ct,[r(`span`,wt,u(e.$t(`kling.name.generateAudio`)),1),o(c,{content:e.tooltipContent},null,8,[`content`])]),o(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,disabled:!e.supported},null,8,[`modelValue`,`disabled`])])])}var Et=P(bt,[[`render`,Tt]]),Dt=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],Ot=c({name:`CameraControlSelector`,components:{ElSelect:x,ElOption:S,ElSlider:ee,ElInputNumber:M,InfoIcon:J},data(){return{configKeys:Dt}},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)}}}),kt={class:`field`},At={class:`header`},jt={class:`text-sm font-bold`},Mt={key:0,class:`config-grid`},Nt={class:`cfg-row-head`},Pt={class:`cfg-name`};function Ft(e,t,i,a,c,f){let g=p(`info-icon`),v=p(`el-option`),y=p(`el-select`),b=p(`el-input-number`),x=p(`el-slider`);return d(),m(`div`,kt,[r(`div`,At,[r(`span`,jt,u(e.$t(`kling.name.cameraControl`)),1),o(g,{content:e.tooltipContent},null,8,[`content`])]),o(y,{modelValue:e.selectedTypeRaw,"onUpdate:modelValue":t[0]||=t=>e.selectedTypeRaw=t,class:`value`,placeholder:e.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:e.disabled},{default:h(()=>[(d(!0),m(_,null,l(e.typeOptions,e=>(d(),n(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),e.selectedType===`simple`&&!e.disabled?(d(),m(`div`,Mt,[(d(!0),m(_,null,l(e.configKeys,t=>(d(),m(`div`,{key:t,class:`cfg-row`},[r(`div`,Nt,[r(`span`,Pt,u(e.$t(`kling.name.cc_${t}`)),1),o(b,{modelValue:e.configValues[t],"onUpdate:modelValue":n=>e.configValues[t]=n,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:n=>e.onNumberChange(t,n)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),o(x,{"model-value":e.configValues[t]??0,min:-1,max:1,step:.1,onInput:n=>e.onSliderChange(t,n)},null,8,[`model-value`,`onInput`])]))),128))])):s(``,!0)])}var It=P(Ot,[[`render`,Ft],[`__scopeId`,`data-v-cd896060`]]),Lt=[{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 Rt(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 zt=c({name:`InspirationPills`,components:{FontAwesomeIcon:K},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return Lt.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})}}}),Bt={key:0,class:`pills`,role:`list`},Vt={class:`pill-text`},Ht=[`aria-label`,`onClick`];function Ut(e,t,n,i,a,c){let f=p(`font-awesome-icon`);return e.selected.length>0?(d(),m(`div`,Bt,[(d(!0),m(_,null,l(e.selected,t=>(d(),m(`div`,{key:t,class:`pill`,role:`listitem`},[r(`span`,Vt,u(t),1),r(`button`,{type:`button`,class:`pill-remove`,"aria-label":e.$t(`kling.inspiration.removeChip`),onClick:v(n=>e.onRemove(t),[`stop`])},[o(f,{icon:`fa-solid fa-xmark`})],8,Ht)]))),128))])):s(``,!0)}var Wt=c({name:`PromptInput`,components:{ElButton:y,FontAwesomeIcon:K,PromptTextarea:fe,InspirationPills:P(zt,[[`render`,Ut],[`__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 Gt(e,t,r,i,s,c){let l=p(`font-awesome-icon`),f=p(`el-button`),m=p(`inspiration-pills`),g=p(`prompt-textarea`);return d(),n(g,{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:h(()=>[o(f,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:h(()=>[o(l,{icon:`fa-regular fa-lightbulb`,class:`mr-1`}),a(` `+u(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:h(()=>[o(m)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var Kt=P(Wt,[[`render`,Gt],[`__scopeId`,`data-v-c01fc1a6`]]),qt=c({name:`NegativePromptInput`,components:{ElInput:I,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||=``}}),Jt={class:`field`},Yt={class:`box`},Xt={class:`title font-bold`};function Zt(e,t,n,i,a,s){let c=p(`info-icon`),l=p(`el-input`);return d(),m(`div`,Jt,[r(`div`,Yt,[r(`h2`,Xt,u(e.$t(`kling.name.negativePrompt`)),1),o(c,{content:e.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),o(l,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var Qt=P(qt,[[`render`,Zt],[`__scopeId`,`data-v-de98cf01`]]),$t=c({name:`InspirationDrawer`,components:{ElDrawer:j,ElButton:y,FontAwesomeIcon:K},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:Lt,Close:b}},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(Rt(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=$(e,t);this.setPrompt(e)}}}),en={class:`drawer-content`},tn={class:`drawer-header`},nn={class:`title-row`},rn={class:`title`},an={class:`hint`},on={key:0,class:`selected-bar`},sn={class:`selected-text`},cn={class:`groups`},ln={class:`group-title`},un={class:`chip-grid`},dn=[`onClick`];function fn(e,i,c,f,g,v){let y=p(`font-awesome-icon`),b=p(`el-button`),x=p(`el-drawer`);return d(),n(x,{modelValue:e.visible,"onUpdate:modelValue":i[1]||=t=>e.visible=t,direction:`rtl`,"with-header":!1,size:e.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:h(()=>[r(`div`,en,[r(`div`,tn,[r(`div`,nn,[o(y,{icon:`fa-regular fa-lightbulb`,class:`mr-2`}),r(`span`,rn,u(e.$t(`kling.inspiration.title`)),1)]),o(b,{text:``,icon:e.Close,class:`close-btn`,onClick:i[0]||=t=>e.visible=!1},null,8,[`icon`])]),r(`div`,an,u(e.$t(`kling.inspiration.hint`)),1),e.selectedCount>0?(d(),m(`div`,on,[r(`span`,sn,u(e.$t(`kling.inspiration.selectedSummary`,{count:e.selectedCount})),1),o(b,{text:``,size:`small`,class:`clear-btn`,onClick:e.onClearSelected},{default:h(()=>[a(u(e.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):s(``,!0),r(`div`,cn,[(d(!0),m(_,null,l(e.groups,n=>(d(),m(`div`,{key:n.groupKey,class:`group`},[r(`div`,ln,u(e.$t(`kling.inspiration.group.${n.groupKey}`)),1),r(`div`,un,[(d(!0),m(_,null,l(n.chipKeys,n=>(d(),m(`button`,{key:n,type:`button`,class:t({chip:!0,active:e.isSelected(e.chipText(n))}),onClick:t=>e.onToggle(e.chipText(n))},u(e.chipText(n)),11,dn))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var pn=P($t,[[`render`,fn],[`__scopeId`,`data-v-7d457a69`]]),mn={"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`},hn={std:`720p`,pro:`1080p`,"4k":`4K`},gn=c({name:`SummaryChip`,components:{FontAwesomeIcon:K},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return mn[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return hn[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),_n={class:`summary-chip`},vn=[`title`],yn=[`title`],bn=[`title`],xn=[`title`],Sn=[`title`];function Cn(e,t,n,i,a,c){let l=p(`font-awesome-icon`);return d(),m(`div`,_n,[r(`span`,{class:`part`,title:e.$t(`kling.name.model`)},u(e.modelLabel),9,vn),t[0]||=r(`span`,{class:`dot`},`·`,-1),r(`span`,{class:`part`,title:e.$t(`kling.name.duration`)},u(e.durationLabel),9,yn),t[1]||=r(`span`,{class:`dot`},`·`,-1),r(`span`,{class:`part`,title:e.$t(`kling.name.ratio`)},u(e.aspectRatio||`16:9`),9,bn),t[2]||=r(`span`,{class:`dot`},`·`,-1),r(`span`,{class:`part`,title:e.$t(`kling.name.mode`)},u(e.modeLabel),9,xn),e.generateAudio?(d(),m(`span`,{key:0,class:`audio`,title:e.$t(`kling.name.generateAudio`)},[o(l,{icon:`fa-solid fa-headphones`})],8,Sn)):s(``,!0)])}var wn=c({name:`ConfigPanel`,components:{ElButton:y,Consumption:me,FontAwesomeIcon:K,PromptInput:Kt,NegativePromptInput:Qt,ModelSelector:Oe,ModeSelector:Fe,DurationSelector:We,RatioSelector:Ze,StartImage:it,CfgScaleSelector:yt,GenerateAudioSelector:Et,CameraControlSelector:It,InspirationDrawer:pn,SummaryChip:P(gn,[[`render`,Cn],[`__scopeId`,`data-v-418a6733`]]),EndImage:dt},emits:[`generate`],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return L(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Tn={class:`flex flex-col h-full`},En={class:`flex-1 overflow-y-auto p-5`},Dn={class:`flex flex-col items-center justify-center px-5 pb-5`};function On(e,t,i,s,c,l){let f=p(`prompt-input`),g=p(`model-selector`),_=p(`ratio-selector`),v=p(`start-image`),y=p(`end-image`),b=p(`duration-selector`),x=p(`mode-selector`),S=p(`generate-audio-selector`),C=p(`camera-control-selector`),w=p(`cfg-scale-selector`),T=p(`negative-prompt-input`),E=p(`summary-chip`),D=p(`consumption`),O=p(`font-awesome-icon`),k=p(`el-button`),A=p(`inspiration-drawer`);return d(),m(`div`,Tn,[r(`div`,En,[o(f,{class:`mb-4`,onOpenInspiration:t[0]||=t=>e.inspirationOpen=!0}),o(g,{class:`mb-4`}),o(_,{class:`mb-4`}),o(v,{class:`mb-2`}),o(y,{class:`mb-2`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`}),o(C,{class:`mb-4`}),o(w,{class:`mb-4`}),o(T,{class:`mb-4`})]),r(`div`,Dn,[o(E),o(D,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),e.config?.video_url!==void 0||e.config?.custom?(d(),n(k,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:h(()=>[o(O,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`kling.button.extend`)),1)]),_:1},8,[`onClick`])):(d(),n(k,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:h(()=>[o(O,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`kling.button.generate`)),1)]),_:1},8,[`onClick`]))]),o(A,{modelValue:e.inspirationOpen,"onUpdate:modelValue":t[1]||=t=>e.inspirationOpen=t},null,8,[`modelValue`])])}var kn=P(wn,[[`render`,On]]),An=c({name:`MotionImage`,components:{ElUpload:T,ElButton:y,InfoIcon:J,FontAwesomeIcon:K,ImagePreview:q},mixins:[V,U],data(){return{fileList:[],uploadUrl:B()+`/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(){H.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){H.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()}}}),jn={class:`relative`},Mn={class:`flex justify-between`},Nn={class:`flex justify-start items-center`},Pn={class:`text-sm font-bold`};function Fn(e,t,i,c,l,f){let g=p(`info-icon`),_=p(`image-preview`),v=p(`font-awesome-icon`),y=p(`el-button`),b=p(`el-upload`);return d(),m(`div`,jn,[r(`div`,Mn,[r(`div`,Nn,[r(`span`,Pn,u(e.$t(`kling.name.motionImage`)),1),o(g,{content:e.$t(`kling.description.motionImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:h(({file:t})=>[t.url&&t.percentage!==void 0?(d(),n(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`])):s(``,!0)]),default:h(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:h(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var In=P(An,[[`render`,Fn],[`__scopeId`,`data-v-e52eaf2f`]]),Ln=c({name:`MotionVideo`,components:{ElUpload:T,ElButton:y,InfoIcon:J,FilePreview:se,FontAwesomeIcon:K},mixins:[U],data(){return{fileList:[],uploadUrl:B()+`/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(){H.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){H.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:(H.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(H.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()}}}),Rn={class:`relative`},zn={class:`flex justify-between`},Bn={class:`flex justify-start items-center`},Vn={class:`text-sm font-bold`};function Hn(e,t,i,c,l,f){let g=p(`info-icon`),_=p(`file-preview`),v=p(`font-awesome-icon`),y=p(`el-button`),b=p(`el-upload`);return d(),m(`div`,Rn,[r(`div`,zn,[r(`div`,Bn,[r(`span`,Vn,u(e.$t(`kling.name.motionVideo`)),1),o(g,{content:e.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),o(b,{"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:h(({file:t})=>[t.percentage===void 0?s(``,!0):(d(),n(_,{key:0,url:t.url||t.response?.file_url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:h(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:h(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$t(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Un=P(Ln,[[`render`,Hn],[`__scopeId`,`data-v-7019a8d2`]]),Wn=c({name:`MotionPromptInput`,components:{ElInput:I,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})}}}}),Gn={class:`field`},Kn={class:`box`},qn={class:`title font-bold`};function Jn(e,t,n,i,a,s){let c=p(`info-icon`),l=p(`el-input`);return d(),m(`div`,Gn,[r(`div`,Kn,[r(`h2`,qn,u(e.$t(`kling.name.motionPrompt`)),1),o(c,{content:e.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),o(l,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Yn=P(Wn,[[`render`,Jn],[`__scopeId`,`data-v-ca9fdbe5`]]),Xn=`video`,Zn=c({name:`CharacterOrientationSelector`,components:{ElRadioGroup:A,ElRadioButton:k,InfoIcon:J},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||Xn},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=Xn)}}),Qn={class:`field`},$n={class:`header`},er={class:`text-sm font-bold`};function tr(e,t,n,i,s,c){let l=p(`info-icon`),f=p(`el-radio-button`),g=p(`el-radio-group`);return d(),m(`div`,Qn,[r(`div`,$n,[r(`span`,er,u(e.$t(`kling.name.characterOrientation`)),1),o(l,{content:e.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),o(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,size:`small`,class:`value`},{default:h(()=>[o(f,{label:`image`},{default:h(()=>[a(u(e.$t(`kling.name.orientationImage`)),1)]),_:1}),o(f,{label:`video`},{default:h(()=>[a(u(e.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var nr=P(Zn,[[`render`,tr],[`__scopeId`,`data-v-7a91195b`]]),rr=`std`,ir=c({name:`MotionModeSelector`,components:{ElSelect:x,ElOption:S,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||rr},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=rr)}}),ar={class:`field`},or={class:`header`},sr={class:`title font-bold`};function cr(e,t,i,a,s,c){let f=p(`info-icon`),g=p(`el-option`),v=p(`el-select`);return d(),m(`div`,ar,[r(`div`,or,[r(`h2`,sr,u(e.$t(`kling.name.mode`)),1),o(f,{content:e.$t(`kling.description.motionMode`)},null,8,[`content`])]),o(v,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`kling.placeholder.select`)},{default:h(()=>[(d(!0),m(_,null,l(e.options,e=>(d(),n(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var lr=P(ir,[[`render`,cr],[`__scopeId`,`data-v-1295688c`]]),ur=c({name:`KeepOriginalSoundSelector`,components:{ElSwitch:te,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`})}}}}),dr={class:`relative`},fr={class:`flex justify-between items-center`},pr={class:`flex justify-start items-center`},mr={class:`text-sm font-bold`};function hr(e,t,n,i,a,s){let c=p(`info-icon`),l=p(`el-switch`);return d(),m(`div`,dr,[r(`div`,fr,[r(`div`,pr,[r(`span`,mr,u(e.$t(`kling.name.keepOriginalSound`)),1),o(c,{content:e.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),o(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t},null,8,[`modelValue`])])])}var gr=c({name:`MotionPanel`,components:{ElButton:y,FontAwesomeIcon:K,Consumption:me,MotionImage:In,MotionVideo:Un,MotionPromptInput:Yn,CharacterOrientationSelector:nr,MotionModeSelector:lr,KeepOriginalSoundSelector:P(ur,[[`render`,hr]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return L(this.motionConfig,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`)}}}),_r={class:`flex flex-col h-full`},vr={class:`flex-1 overflow-y-auto p-5`},yr={class:`flex flex-col items-center justify-center px-5 pb-5`};function br(e,t,n,i,s,c){let l=p(`motion-image`),f=p(`motion-video`),g=p(`motion-prompt-input`),_=p(`character-orientation-selector`),v=p(`motion-mode-selector`),y=p(`keep-original-sound-selector`),b=p(`consumption`),x=p(`font-awesome-icon`),S=p(`el-button`);return d(),m(`div`,_r,[r(`div`,vr,[o(l,{class:`mb-3`}),o(f,{class:`mb-3`}),o(g,{class:`mb-4`}),o(_,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`})]),r(`div`,yr,[o(b,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(S,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canGenerate,onClick:e.onGenerate},{default:h(()=>[o(x,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var xr=P(gr,[[`render`,br]]),Sr=c({name:`KlingTabSwitcher`,components:{ElTabs:C,ElTabPane:w,ElTag:ae},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`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),Cr=[`title`],wr={class:`text`};function Tr(e,t,i,o,c,f){let g=p(`el-tag`),v=p(`el-tab-pane`),y=p(`el-tabs`);return d(),n(y,{"model-value":e.modelValue,class:`kling-tabs`,stretch:``,"onUpdate:modelValue":e.onUpdate},{default:h(()=>[(d(!0),m(_,null,l(e.tabs,e=>(d(),n(v,{key:e.value,name:e.value,disabled:e.disabled},{label:h(()=>[r(`span`,{class:`tab-label`,title:e.disabled?e.disabledReason:void 0},[r(`span`,wr,u(e.label),1),e.badge?(d(),n(g,{key:0,size:`small`,type:`warning`,class:`badge`},{default:h(()=>[a(u(e.badge),1)]),_:2},1024)):s(``,!0)],8,Cr)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Er=P(Sr,[[`render`,Tr],[`__scopeId`,`data-v-bf00c27e`]]),Dr=c({name:`TaskPreview`,components:{ElImage:D,CopyToClipboard:oe,FontAwesomeIcon:K,ElAlert:O,VideoPlayer:ge,ElTooltip:E,ElButton:y,ImagePreview:q,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`)}}}),Or={class:`preview`},kr={class:`left`},Ar={class:`main`},jr={class:`bot`},Mr={class:`datetime`},Nr={class:`info`},Pr={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Fr={key:1,class:`prompt mt-2`},Ir={key:0},Lr={key:1},Rr={key:0,class:t({content:!0,failed:!0})},zr={key:0,class:`mb-4`},Br={key:1,class:t({operations:!0,"mt-2":!0})},Vr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Hr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ur={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Wr={key:1,class:t({content:!0})},Gr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Kr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Jr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Yr={key:2,class:t({content:!0})},Xr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Qr(e,t,i,c,f,g){let v=p(`el-image`),y=p(`image-preview`),b=p(`video-player`),x=p(`el-button`),S=p(`el-tooltip`),C=p(`api-code-button`),w=p(`font-awesome-icon`),T=p(`copy-to-clipboard`),E=p(`el-alert`);return d(),m(`div`,Or,[r(`div`,kr,[o(v,{src:`https://cdn.acedata.cloud/qpbbbb.jpg`,class:`avatar`})]),r(`div`,Ar,[r(`div`,jr,[a(u(e.$t(`kling.name.klingBot`))+` `,1),r(`span`,Mr,u(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),r(`div`,Nr,[e.referenceImages.length>0?(d(),m(`div`,Pr,[(d(!0),m(_,null,l(e.referenceImages,(e,t)=>(d(),n(y,{key:t,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128))])):s(``,!0),e.modelValue?.request?.prompt?(d(),m(`p`,Fr,[a(u(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?s(``,!0):(d(),m(`span`,Ir,` - (`+u(e.$t(`kling.status.pending`))+`) `,1)),e.modelValue?.response?.state===`submitted`||e.modelValue?.response?.state===`processing`||e.modelValue?.response?.state===`pending`||e.modelValue?.response?.state===`completed`?(d(),m(`span`,Lr,` - (`+u(e.$t(`kling.status.processing`))+`) `,1)):s(``,!0)])):s(``,!0)]),e.modelValue?.response?.success===!0?(d(),m(`div`,Rr,[e.modelValue?.response.video_url?(d(),m(`div`,zr,[o(b,{src:e.modelValue?.response.video_url},null,8,[`src`])])):s(``,!0),e.modelValue?.response.success?(d(),m(`div`,Br,[o(S,{class:`box-item`,effect:`dark`,content:e.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:h(()=>[e.modelValue?.response.video_url?(d(),n(x,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:t[0]||=t=>e.onDownload(t,e.modelValue?.response.video_url)},{default:h(()=>[a(u(e.$t(`kling.button.download`)),1)]),_:1})):s(``,!0)]),_:1},8,[`content`]),o(C,{path:`/kling/videos`,body:e.modelValue?.request},null,8,[`body`])])):s(``,!0),o(E,{closable:!1,class:`mt-2 success`},{default:h(()=>[r(`p`,Vr,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.model`))+`: `+u(e.modelValue?.request?.model),1)]),r(`p`,Hr,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(T,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(d(),m(`p`,Ur,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):s(``,!0)]),_:1})])):s(``,!0),e.modelValue?.response?.success===!1?(d(),m(`div`,Wr,[o(E,{closable:!1,class:`failure`},{template:h(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.failure`)),1)]),default:h(()=>[r(`p`,Gr,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(T,{content:e.modelValue?.id},null,8,[`content`])]),r(`p`,Kr,[o(w,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.failureReason`))+`: `+u(e.modelValue?.response?.error?.message)+` `,1),o(T,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(d(),m(`p`,qr,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):s(``,!0),e.modelValue?.response?.trace_id?(d(),m(`p`,Jr,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(T,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):s(``,!0)]),_:1})])):s(``,!0),e.modelValue?.response?.success===void 0?(d(),m(`div`,Yr,[o(E,{closable:!1,class:`info`},{template:h(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.failure`)),1)]),default:h(()=>[r(`p`,Xr,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(T,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.response?.trace_id?(d(),m(`p`,Zr,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(T,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):s(``,!0)]),_:1})])):s(``,!0)])])}var $r=c({name:`RecentPanel`,components:{TaskPreview:P(Dr,[[`render`,Qr],[`__scopeId`,`data-v-422e2570`]]),NoTasks:pe,BotPlaceholder:le,ScrollList:ue},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?.()}}}),ei={key:0},ti={key:2,class:`w-full h-full flex items-center justify-center`};function ni(e,t,r,i,a,c){let u=p(`bot-placeholder`),f=p(`task-preview`),g=p(`scroll-list`),v=p(`no-tasks`);return d(),m(_,null,[e.tasks?.items===void 0?(d(),m(`div`,ei,[o(u)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(d(),n(g,{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:h(()=>[(d(!0),m(_,null,l(e.tasks?.items,e=>(d(),n(f,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):s(``,!0),e.tasks?.items?.length===0?(d(),m(`div`,ti,[o(v)])):s(``,!0)],64)}var ri=P($r,[[`render`,ni]]),ii=re(`kling`),ai=c({name:`KlingIndex`,components:{ConfigPanel:kn,MotionPanel:xr,TabSwitcher:Er,Layout:Se,RecentPanel:ri},mixins:[ie],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===G.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===G.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},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 de({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(!z(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let{camera_control:e,...t}=this.config||{},n={...t,callback_url:ii};if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){H.warning(this.$t(`kling.message.endImageRequiresStart`));return}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))}:{}});let r=this.credential?.token;if(!r){console.error(`no token specified`);return}H.info(this.$t(`kling.message.startingTask`)),F(`kling`,W.generate(n,{token:r})).then(()=>{H.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?H.error(this.$t(`kling.message.usedUp`)):H.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(!z(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){H.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.prompt?{prompt:e.prompt}:{},callback_url:ii},n=this.credential?.token;if(!n){console.error(`no token specified`);return}H.info(this.$t(`kling.message.startingTask`)),F(`kling`,W.motion(t,{token:n})).then(()=>{H.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?H.error(this.$t(`kling.message.usedUp`)):H.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),oi={class:`flex flex-col h-full`},si={class:`flex-1 min-h-0`};function ci(e,t,i,a,c,l){let u=p(`tab-switcher`),f=p(`config-panel`),m=p(`motion-panel`),g=p(`recent-panel`),_=p(`layout`);return d(),n(_,null,{config:h(()=>[r(`div`,oi,[o(u,{"model-value":e.taskType,"onUpdate:modelValue":e.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),r(`div`,si,[e.taskType===`videos`?(d(),n(f,{key:0,onGenerate:e.onGenerate},null,8,[`onGenerate`])):e.taskType===`motion`?(d(),n(m,{key:1,onGenerate:e.onGenerateMotion},null,8,[`onGenerate`])):s(``,!0)])])]),result:h(()=>[o(g,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var li=P(ai,[[`render`,ci]]);export{li as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,Bt as t,D as n,E as r,Ht as i,M as a,N as o,O as s,P as c,Q as l,Ut as u,X as d,_ as f,et as p,k as m,lt as h,ut as g,x as _,y as v}from"./vendor-chart-mdwpew_o.js";import{t as y}from"./button-DWzbdjZV.js";import{E as b}from"./use-deprecated-CPfQu7wa.js";import{r as x,t as S}from"./select-B14L-681.js";import{n as C,t as w}from"./tabs-CllsgUVI.js";import{t as T}from"./upload-CgRMUkQi.js";import{t as E}from"./tooltip-C3PYfh8V.js";import{t as D}from"./image-CjzS-up0.js";import{t as O}from"./alert-BJj7gY4q.js";import{n as k,r as A}from"./radio-IJQsW93X.js";import{t as j}from"./drawer-BvYPSxXh.js";import{t as M}from"./input-number-N0auilju.js";import{t as ee}from"./slider-ypi7YrnL.js";import{t as te}from"./switch-Dir3SgN_.js";import{_r as ne,br as N,pi as re}from"./constants-C-bSXdJ_.js";import{At as ie,E as P,Fn as F,Ir as I,Nt as L,Or as R,Ot as z,Pr as ae,Sr as B,jt as V,kr as H,kt as U,pn as W,yr as G}from"./index-BY8YIwDb.js";import{t as K}from"./index.es-CH5vwGaN.js";import{t as oe}from"./CopyToClipboard-C8gyDUMn.js";import{t as se}from"./FilePreview-sx756NB5.js";import{t as q}from"./ImagePreview-DkXTeOKK.js";import{n as ce}from"./taskDrawerMixin-Cr17Yxqk.js";import{t as le}from"./BotPlaceholder-BVXWzbpi.js";import{i as J,n as ue,t as de}from"./pagination-CjEVtILV.js";import{n as fe,t as pe}from"./NoTasks-Dk1WXppl.js";import{t as me}from"./Consumption-QfvilMcG.js";import{t as he}from"./ApiCodeButton-DpYCu-EK.js";import{t as ge}from"./VideoPlayer-BLPGe-uP.js";var _e=c({name:`LayoutKling`,components:{ElDrawer:j,ElButton:y,FontAwesomeIcon:K},mixins:[ce]}),ve={class:`main flex flex-row flex-1 min-h-0`},ye={class:`config w-[320px] flex-none h-full flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},be={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function xe(t,n,i,a,s,c){let l=p(`font-awesome-icon`),u=p(`el-button`),_=p(`el-drawer`);return d(),m(`div`,ve,[r(`div`,ye,[e(t.$slots,`config`,{},void 0,!0)]),r(`div`,be,[e(t.$slots,`result`,{},void 0,!0)]),g(o(u,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:h(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[f,!t.tasksEmpty]]),o(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:h(()=>[e(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Se=P(_e,[[`render`,xe],[`__scopeId`,`data-v-b87958dc`]]),Ce={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 Ce}}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 we=c({name:`ModelSelector`,components:{ElSelect:x,ElOption:S},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(ne)},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 R.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),H.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})}}}),Te={class:`field`},Ee={class:`title font-bold`};function De(e,t,i,a,o,s){let c=p(`el-option`),f=p(`el-select`);return d(),m(`div`,Te,[r(`h2`,Ee,u(e.$t(`pika.name.model`)),1),(d(),n(f,{key:e.revertKey,"model-value":e.value,class:`value`,placeholder:e.$t(`pika.placeholder.select`),onChange:e.onChange},{default:h(()=>[(d(!0),m(_,null,l(e.options,e=>(d(),n(c,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Oe=P(we,[[`render`,De],[`__scopeId`,`data-v-04059875`]]),ke=c({name:`ModeSelector`,components:{ElSelect:x,ElOption:S,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 N.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 R.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),H.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})}}}),Ae={class:`field`},je={class:`header`},Me={class:`title font-bold`},Ne={key:0,class:`opt-tip`};function Pe(e,i,a,c,f,g){let v=p(`info-icon`),y=p(`el-option`),b=p(`el-select`);return d(),m(`div`,Ae,[r(`div`,je,[r(`h2`,Me,u(e.$t(`kling.name.mode`)),1),o(v,{content:e.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(d(),n(b,{key:e.revertKey,"model-value":e.value,class:`value`,placeholder:e.$t(`kling.placeholder.select`),clearable:!0,onChange:e.onChange},{default:h(()=>[(d(!0),m(_,null,l(e.options,e=>(d(),n(y,{key:e.value,label:e.label,value:e.value,disabled:e.disabled},{default:h(()=>[r(`span`,{class:t({"opt-disabled":e.disabled})},u(e.label),3),e.disabled&&e.disabledReason?(d(),m(`span`,Ne,u(e.disabledReason),1)):s(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Fe=P(ke,[[`render`,Pe],[`__scopeId`,`data-v-9a8fa3c5`]]),Ie=[3,5,8,10,12,15],Le=[5,10],Re=c({name:`DurationSelector`,components:{ElSelect:x,ElOption:S,InfoIcon:J},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return N.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?Ie:Le},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 R.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),H.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})}}}),ze={class:`field`},Be={class:`control`},Ve={class:`label`},He={class:`title font-bold`};function Ue(e,t,i,a,s,c){let f=p(`info-icon`),g=p(`el-option`),v=p(`el-select`);return d(),m(`div`,ze,[r(`div`,Be,[r(`div`,Ve,[r(`h2`,He,u(e.$t(`kling.name.duration`)),1),o(f,{content:e.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(d(),n(v,{key:e.revertKey,"model-value":e.selectValue,class:`value`,placeholder:e.$t(`kling.placeholder.select`),onChange:e.onChange},{default:h(()=>[(d(!0),m(_,null,l(e.allowedDurations,e=>(d(),n(g,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var We=P(Re,[[`render`,Ue],[`__scopeId`,`data-v-5ae55e28`]]),Ge=c({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`}}),Ke={class:`text-sm font-bold mb-2 block`},qe={class:`items`},Je=[`onClick`],Ye={class:`name`};function Xe(e,n,a,o,s,c){return d(),m(`div`,null,[r(`span`,Ke,u(e.$t(`kling.name.ratio`)),1),r(`div`,qe,[(d(!0),m(_,null,l(e.options,(n,a)=>(d(),m(`div`,{key:a,class:t({active:e.active===a,item:!0}),onClick:t=>e.value=n.value},[r(`div`,{class:t([`preview`,n.label])},[r(`div`,{class:`rect`,style:i({width:n.width+`px`,height:n.height+`px`})},null,4)],2),r(`p`,Ye,u(n.label),1)],10,Je))),128))])])}var Ze=P(Ge,[[`render`,Xe],[`__scopeId`,`data-v-cdb14b2f`]]),Qe=c({name:`StartImage`,components:{ElUpload:T,ElButton:y,ElTooltip:E,InfoIcon:J,FontAwesomeIcon:K,ImagePreview:q},mixins:[V,U],emits:[`change`],data(){return{fileList:[],uploadUrl:B()+`/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(){H.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){H.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()}}}),$e={class:`relative`},et={class:`flex justify-between`},tt={class:`flex justify-start items-center`},nt={class:`text-sm font-bold`};function rt(e,t,i,c,l,f){let g=p(`info-icon`),_=p(`image-preview`),v=p(`font-awesome-icon`),y=p(`el-button`),b=p(`el-tooltip`),x=p(`el-upload`);return d(),m(`div`,$e,[r(`div`,et,[r(`div`,tt,[r(`span`,nt,u(e.$t(`kling.name.startImage`)),1),o(g,{content:e.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.reachedLimit,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:h(({file:t})=>[t.url&&t.percentage!==void 0?(d(),n(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):s(``,!0)]),default:h(()=>[o(b,{content:e.$t(`kling.message.uploadReferencesExceed`),disabled:!e.reachedLimit,placement:`top`},{default:h(()=>[r(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.reachedLimit},{default:h(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$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 it=P(Qe,[[`render`,rt],[`__scopeId`,`data-v-756dc269`]]),at=c({name:`EndImage`,components:{ElUpload:T,ElButton:y,ElTooltip:E,ImagePreview:q,InfoIcon:J,FontAwesomeIcon:K},mixins:[V,U],data(){return{fileList:[],uploadUrl:B()+`/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:(H.warning(this.$t(`kling.message.endImageRequiresStart`)),!1):(H.warning(this.$t(`kling.message.endImageNotSupported`)),!1)},onExceed(){H.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){H.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()}}}),ot={class:`relative`},st={class:`flex justify-between`},ct={class:`flex justify-start items-center`},lt={class:`text-sm font-bold`};function ut(e,t,i,c,l,f){let g=p(`info-icon`),_=p(`image-preview`),v=p(`font-awesome-icon`),y=p(`el-button`),b=p(`el-tooltip`),x=p(`el-upload`);return d(),m(`div`,ot,[r(`div`,st,[r(`div`,ct,[r(`span`,lt,u(e.$t(`kling.name.endImage`)),1),o(g,{content:e.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"before-upload":e.onBeforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:h(({file:t})=>[t.url&&t.percentage!==void 0?(d(),n(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):s(``,!0)]),default:h(()=>[o(b,{content:e.uploadTooltip,disabled:!e.uploadDisabled,placement:`top`},{default:h(()=>[r(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.uploadDisabled},{default:h(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$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 dt=P(at,[[`render`,ut],[`__scopeId`,`data-v-c1b257e5`]]),ft=c({name:`CfgScaleSelector`,components:{ElSlider:ee,InfoIcon:J,ElInputNumber:M},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}}),pt={class:`flex justify-between`},mt={class:`flex justify-start items-center`},ht={class:`text-sm font-bold`},gt={class:`flex justify-end items-center`},_t={class:`w-full`};function vt(e,t,n,i,a,s){let c=p(`info-icon`),l=p(`el-input-number`),f=p(`el-slider`);return d(),m(`div`,null,[r(`div`,pt,[r(`div`,mt,[r(`span`,ht,u(e.$t(`kling.name.cfgScale`)),1),o(c,{content:e.$t(`kling.description.cfgScale`)},null,8,[`content`])]),r(`div`,gt,[o(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,"controls-position":`right`},null,8,[`modelValue`])])]),r(`div`,_t,[o(f,{modelValue:e.value,"onUpdate:modelValue":t[1]||=t=>e.value=t,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var yt=P(ft,[[`render`,vt]]),bt=c({name:`GenerateAudioSelector`,components:{ElSwitch:te,InfoIcon:J},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(N.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})}}}),xt={class:`relative`},St={class:`flex justify-between items-center`},Ct={class:`flex justify-start items-center`},wt={class:`text-sm font-bold`};function Tt(e,t,n,i,a,s){let c=p(`info-icon`),l=p(`el-switch`);return d(),m(`div`,xt,[r(`div`,St,[r(`div`,Ct,[r(`span`,wt,u(e.$t(`kling.name.generateAudio`)),1),o(c,{content:e.tooltipContent},null,8,[`content`])]),o(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,disabled:!e.supported},null,8,[`modelValue`,`disabled`])])])}var Et=P(bt,[[`render`,Tt]]),Dt=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],Ot=c({name:`CameraControlSelector`,components:{ElSelect:x,ElOption:S,ElSlider:ee,ElInputNumber:M,InfoIcon:J},data(){return{configKeys:Dt}},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)}}}),kt={class:`field`},At={class:`header`},jt={class:`text-sm font-bold`},Mt={key:0,class:`config-grid`},Nt={class:`cfg-row-head`},Pt={class:`cfg-name`};function Ft(e,t,i,a,c,f){let g=p(`info-icon`),v=p(`el-option`),y=p(`el-select`),b=p(`el-input-number`),x=p(`el-slider`);return d(),m(`div`,kt,[r(`div`,At,[r(`span`,jt,u(e.$t(`kling.name.cameraControl`)),1),o(g,{content:e.tooltipContent},null,8,[`content`])]),o(y,{modelValue:e.selectedTypeRaw,"onUpdate:modelValue":t[0]||=t=>e.selectedTypeRaw=t,class:`value`,placeholder:e.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:e.disabled},{default:h(()=>[(d(!0),m(_,null,l(e.typeOptions,e=>(d(),n(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),e.selectedType===`simple`&&!e.disabled?(d(),m(`div`,Mt,[(d(!0),m(_,null,l(e.configKeys,t=>(d(),m(`div`,{key:t,class:`cfg-row`},[r(`div`,Nt,[r(`span`,Pt,u(e.$t(`kling.name.cc_${t}`)),1),o(b,{modelValue:e.configValues[t],"onUpdate:modelValue":n=>e.configValues[t]=n,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:n=>e.onNumberChange(t,n)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),o(x,{"model-value":e.configValues[t]??0,min:-1,max:1,step:.1,onInput:n=>e.onSliderChange(t,n)},null,8,[`model-value`,`onInput`])]))),128))])):s(``,!0)])}var It=P(Ot,[[`render`,Ft],[`__scopeId`,`data-v-cd896060`]]),Lt=[{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 Rt(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 zt=c({name:`InspirationPills`,components:{FontAwesomeIcon:K},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return Lt.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})}}}),Bt={key:0,class:`pills`,role:`list`},Vt={class:`pill-text`},Ht=[`aria-label`,`onClick`];function Ut(e,t,n,i,a,c){let f=p(`font-awesome-icon`);return e.selected.length>0?(d(),m(`div`,Bt,[(d(!0),m(_,null,l(e.selected,t=>(d(),m(`div`,{key:t,class:`pill`,role:`listitem`},[r(`span`,Vt,u(t),1),r(`button`,{type:`button`,class:`pill-remove`,"aria-label":e.$t(`kling.inspiration.removeChip`),onClick:v(n=>e.onRemove(t),[`stop`])},[o(f,{icon:`fa-solid fa-xmark`})],8,Ht)]))),128))])):s(``,!0)}var Wt=c({name:`PromptInput`,components:{ElButton:y,FontAwesomeIcon:K,PromptTextarea:fe,InspirationPills:P(zt,[[`render`,Ut],[`__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 Gt(e,t,r,i,s,c){let l=p(`font-awesome-icon`),f=p(`el-button`),m=p(`inspiration-pills`),g=p(`prompt-textarea`);return d(),n(g,{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:h(()=>[o(f,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:h(()=>[o(l,{icon:`fa-regular fa-lightbulb`,class:`mr-1`}),a(` `+u(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:h(()=>[o(m)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var Kt=P(Wt,[[`render`,Gt],[`__scopeId`,`data-v-c01fc1a6`]]),qt=c({name:`NegativePromptInput`,components:{ElInput:I,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||=``}}),Jt={class:`field`},Yt={class:`box`},Xt={class:`title font-bold`};function Zt(e,t,n,i,a,s){let c=p(`info-icon`),l=p(`el-input`);return d(),m(`div`,Jt,[r(`div`,Yt,[r(`h2`,Xt,u(e.$t(`kling.name.negativePrompt`)),1),o(c,{content:e.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),o(l,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var Qt=P(qt,[[`render`,Zt],[`__scopeId`,`data-v-de98cf01`]]),$t=c({name:`InspirationDrawer`,components:{ElDrawer:j,ElButton:y,FontAwesomeIcon:K},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:Lt,Close:b}},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(Rt(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=$(e,t);this.setPrompt(e)}}}),en={class:`drawer-content`},tn={class:`drawer-header`},nn={class:`title-row`},rn={class:`title`},an={class:`hint`},on={key:0,class:`selected-bar`},sn={class:`selected-text`},cn={class:`groups`},ln={class:`group-title`},un={class:`chip-grid`},dn=[`onClick`];function fn(e,i,c,f,g,v){let y=p(`font-awesome-icon`),b=p(`el-button`),x=p(`el-drawer`);return d(),n(x,{modelValue:e.visible,"onUpdate:modelValue":i[1]||=t=>e.visible=t,direction:`rtl`,"with-header":!1,size:e.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:h(()=>[r(`div`,en,[r(`div`,tn,[r(`div`,nn,[o(y,{icon:`fa-regular fa-lightbulb`,class:`mr-2`}),r(`span`,rn,u(e.$t(`kling.inspiration.title`)),1)]),o(b,{text:``,icon:e.Close,class:`close-btn`,onClick:i[0]||=t=>e.visible=!1},null,8,[`icon`])]),r(`div`,an,u(e.$t(`kling.inspiration.hint`)),1),e.selectedCount>0?(d(),m(`div`,on,[r(`span`,sn,u(e.$t(`kling.inspiration.selectedSummary`,{count:e.selectedCount})),1),o(b,{text:``,size:`small`,class:`clear-btn`,onClick:e.onClearSelected},{default:h(()=>[a(u(e.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):s(``,!0),r(`div`,cn,[(d(!0),m(_,null,l(e.groups,n=>(d(),m(`div`,{key:n.groupKey,class:`group`},[r(`div`,ln,u(e.$t(`kling.inspiration.group.${n.groupKey}`)),1),r(`div`,un,[(d(!0),m(_,null,l(n.chipKeys,n=>(d(),m(`button`,{key:n,type:`button`,class:t({chip:!0,active:e.isSelected(e.chipText(n))}),onClick:t=>e.onToggle(e.chipText(n))},u(e.chipText(n)),11,dn))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var pn=P($t,[[`render`,fn],[`__scopeId`,`data-v-7d457a69`]]),mn={"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`},hn={std:`720p`,pro:`1080p`,"4k":`4K`},gn=c({name:`SummaryChip`,components:{FontAwesomeIcon:K},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return mn[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return hn[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),_n={class:`summary-chip`},vn=[`title`],yn=[`title`],bn=[`title`],xn=[`title`],Sn=[`title`];function Cn(e,t,n,i,a,c){let l=p(`font-awesome-icon`);return d(),m(`div`,_n,[r(`span`,{class:`part`,title:e.$t(`kling.name.model`)},u(e.modelLabel),9,vn),t[0]||=r(`span`,{class:`dot`},`·`,-1),r(`span`,{class:`part`,title:e.$t(`kling.name.duration`)},u(e.durationLabel),9,yn),t[1]||=r(`span`,{class:`dot`},`·`,-1),r(`span`,{class:`part`,title:e.$t(`kling.name.ratio`)},u(e.aspectRatio||`16:9`),9,bn),t[2]||=r(`span`,{class:`dot`},`·`,-1),r(`span`,{class:`part`,title:e.$t(`kling.name.mode`)},u(e.modeLabel),9,xn),e.generateAudio?(d(),m(`span`,{key:0,class:`audio`,title:e.$t(`kling.name.generateAudio`)},[o(l,{icon:`fa-solid fa-headphones`})],8,Sn)):s(``,!0)])}var wn=c({name:`ConfigPanel`,components:{ElButton:y,Consumption:me,FontAwesomeIcon:K,PromptInput:Kt,NegativePromptInput:Qt,ModelSelector:Oe,ModeSelector:Fe,DurationSelector:We,RatioSelector:Ze,StartImage:it,CfgScaleSelector:yt,GenerateAudioSelector:Et,CameraControlSelector:It,InspirationDrawer:pn,SummaryChip:P(gn,[[`render`,Cn],[`__scopeId`,`data-v-418a6733`]]),EndImage:dt},emits:[`generate`],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return L(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Tn={class:`flex flex-col h-full`},En={class:`flex-1 overflow-y-auto p-5`},Dn={class:`flex flex-col items-center justify-center px-5 pb-5`};function On(e,t,i,s,c,l){let f=p(`prompt-input`),g=p(`model-selector`),_=p(`ratio-selector`),v=p(`start-image`),y=p(`end-image`),b=p(`duration-selector`),x=p(`mode-selector`),S=p(`generate-audio-selector`),C=p(`camera-control-selector`),w=p(`cfg-scale-selector`),T=p(`negative-prompt-input`),E=p(`summary-chip`),D=p(`consumption`),O=p(`font-awesome-icon`),k=p(`el-button`),A=p(`inspiration-drawer`);return d(),m(`div`,Tn,[r(`div`,En,[o(f,{class:`mb-4`,onOpenInspiration:t[0]||=t=>e.inspirationOpen=!0}),o(g,{class:`mb-4`}),o(_,{class:`mb-4`}),o(v,{class:`mb-2`}),o(y,{class:`mb-2`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`}),o(C,{class:`mb-4`}),o(w,{class:`mb-4`}),o(T,{class:`mb-4`})]),r(`div`,Dn,[o(E),o(D,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),e.config?.video_url!==void 0||e.config?.custom?(d(),n(k,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:h(()=>[o(O,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`kling.button.extend`)),1)]),_:1},8,[`onClick`])):(d(),n(k,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:h(()=>[o(O,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`kling.button.generate`)),1)]),_:1},8,[`onClick`]))]),o(A,{modelValue:e.inspirationOpen,"onUpdate:modelValue":t[1]||=t=>e.inspirationOpen=t},null,8,[`modelValue`])])}var kn=P(wn,[[`render`,On]]),An=c({name:`MotionImage`,components:{ElUpload:T,ElButton:y,InfoIcon:J,FontAwesomeIcon:K,ImagePreview:q},mixins:[V,U],data(){return{fileList:[],uploadUrl:B()+`/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(){H.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){H.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()}}}),jn={class:`relative`},Mn={class:`flex justify-between`},Nn={class:`flex justify-start items-center`},Pn={class:`text-sm font-bold`};function Fn(e,t,i,c,l,f){let g=p(`info-icon`),_=p(`image-preview`),v=p(`font-awesome-icon`),y=p(`el-button`),b=p(`el-upload`);return d(),m(`div`,jn,[r(`div`,Mn,[r(`div`,Nn,[r(`span`,Pn,u(e.$t(`kling.name.motionImage`)),1),o(g,{content:e.$t(`kling.description.motionImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:h(({file:t})=>[t.url&&t.percentage!==void 0?(d(),n(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`])):s(``,!0)]),default:h(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:h(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var In=P(An,[[`render`,Fn],[`__scopeId`,`data-v-e52eaf2f`]]),Ln=c({name:`MotionVideo`,components:{ElUpload:T,ElButton:y,InfoIcon:J,FilePreview:se,FontAwesomeIcon:K},mixins:[U],data(){return{fileList:[],uploadUrl:B()+`/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(){H.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){H.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:(H.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(H.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()}}}),Rn={class:`relative`},zn={class:`flex justify-between`},Bn={class:`flex justify-start items-center`},Vn={class:`text-sm font-bold`};function Hn(e,t,i,c,l,f){let g=p(`info-icon`),_=p(`file-preview`),v=p(`font-awesome-icon`),y=p(`el-button`),b=p(`el-upload`);return d(),m(`div`,Rn,[r(`div`,zn,[r(`div`,Bn,[r(`span`,Vn,u(e.$t(`kling.name.motionVideo`)),1),o(g,{content:e.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),o(b,{"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:h(({file:t})=>[t.percentage===void 0?s(``,!0):(d(),n(_,{key:0,url:t.url||t.response?.file_url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:h(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:h(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$t(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Un=P(Ln,[[`render`,Hn],[`__scopeId`,`data-v-7019a8d2`]]),Wn=c({name:`MotionPromptInput`,components:{ElInput:I,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})}}}}),Gn={class:`field`},Kn={class:`box`},qn={class:`title font-bold`};function Jn(e,t,n,i,a,s){let c=p(`info-icon`),l=p(`el-input`);return d(),m(`div`,Gn,[r(`div`,Kn,[r(`h2`,qn,u(e.$t(`kling.name.motionPrompt`)),1),o(c,{content:e.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),o(l,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Yn=P(Wn,[[`render`,Jn],[`__scopeId`,`data-v-ca9fdbe5`]]),Xn=`video`,Zn=c({name:`CharacterOrientationSelector`,components:{ElRadioGroup:A,ElRadioButton:k,InfoIcon:J},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||Xn},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=Xn)}}),Qn={class:`field`},$n={class:`header`},er={class:`text-sm font-bold`};function tr(e,t,n,i,s,c){let l=p(`info-icon`),f=p(`el-radio-button`),g=p(`el-radio-group`);return d(),m(`div`,Qn,[r(`div`,$n,[r(`span`,er,u(e.$t(`kling.name.characterOrientation`)),1),o(l,{content:e.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),o(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,size:`small`,class:`value`},{default:h(()=>[o(f,{label:`image`},{default:h(()=>[a(u(e.$t(`kling.name.orientationImage`)),1)]),_:1}),o(f,{label:`video`},{default:h(()=>[a(u(e.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var nr=P(Zn,[[`render`,tr],[`__scopeId`,`data-v-7a91195b`]]),rr=`std`,ir=c({name:`MotionModeSelector`,components:{ElSelect:x,ElOption:S,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||rr},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=rr)}}),ar={class:`field`},or={class:`header`},sr={class:`title font-bold`};function cr(e,t,i,a,s,c){let f=p(`info-icon`),g=p(`el-option`),v=p(`el-select`);return d(),m(`div`,ar,[r(`div`,or,[r(`h2`,sr,u(e.$t(`kling.name.mode`)),1),o(f,{content:e.$t(`kling.description.motionMode`)},null,8,[`content`])]),o(v,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`kling.placeholder.select`)},{default:h(()=>[(d(!0),m(_,null,l(e.options,e=>(d(),n(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var lr=P(ir,[[`render`,cr],[`__scopeId`,`data-v-1295688c`]]),ur=c({name:`KeepOriginalSoundSelector`,components:{ElSwitch:te,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`})}}}}),dr={class:`relative`},fr={class:`flex justify-between items-center`},pr={class:`flex justify-start items-center`},mr={class:`text-sm font-bold`};function hr(e,t,n,i,a,s){let c=p(`info-icon`),l=p(`el-switch`);return d(),m(`div`,dr,[r(`div`,fr,[r(`div`,pr,[r(`span`,mr,u(e.$t(`kling.name.keepOriginalSound`)),1),o(c,{content:e.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),o(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t},null,8,[`modelValue`])])])}var gr=c({name:`MotionPanel`,components:{ElButton:y,FontAwesomeIcon:K,Consumption:me,MotionImage:In,MotionVideo:Un,MotionPromptInput:Yn,CharacterOrientationSelector:nr,MotionModeSelector:lr,KeepOriginalSoundSelector:P(ur,[[`render`,hr]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return L(this.motionConfig,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`)}}}),_r={class:`flex flex-col h-full`},vr={class:`flex-1 overflow-y-auto p-5`},yr={class:`flex flex-col items-center justify-center px-5 pb-5`};function br(e,t,n,i,s,c){let l=p(`motion-image`),f=p(`motion-video`),g=p(`motion-prompt-input`),_=p(`character-orientation-selector`),v=p(`motion-mode-selector`),y=p(`keep-original-sound-selector`),b=p(`consumption`),x=p(`font-awesome-icon`),S=p(`el-button`);return d(),m(`div`,_r,[r(`div`,vr,[o(l,{class:`mb-3`}),o(f,{class:`mb-3`}),o(g,{class:`mb-4`}),o(_,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`})]),r(`div`,yr,[o(b,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(S,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canGenerate,onClick:e.onGenerate},{default:h(()=>[o(x,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var xr=P(gr,[[`render`,br]]),Sr=c({name:`KlingTabSwitcher`,components:{ElTabs:C,ElTabPane:w,ElTag:ae},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`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),Cr=[`title`],wr={class:`text`};function Tr(e,t,i,o,c,f){let g=p(`el-tag`),v=p(`el-tab-pane`),y=p(`el-tabs`);return d(),n(y,{"model-value":e.modelValue,class:`kling-tabs`,stretch:``,"onUpdate:modelValue":e.onUpdate},{default:h(()=>[(d(!0),m(_,null,l(e.tabs,e=>(d(),n(v,{key:e.value,name:e.value,disabled:e.disabled},{label:h(()=>[r(`span`,{class:`tab-label`,title:e.disabled?e.disabledReason:void 0},[r(`span`,wr,u(e.label),1),e.badge?(d(),n(g,{key:0,size:`small`,type:`warning`,class:`badge`},{default:h(()=>[a(u(e.badge),1)]),_:2},1024)):s(``,!0)],8,Cr)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Er=P(Sr,[[`render`,Tr],[`__scopeId`,`data-v-bf00c27e`]]),Dr=c({name:`TaskPreview`,components:{ElImage:D,CopyToClipboard:oe,FontAwesomeIcon:K,ElAlert:O,VideoPlayer:ge,ElTooltip:E,ElButton:y,ImagePreview:q,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`)}}}),Or={class:`preview`},kr={class:`left`},Ar={class:`main`},jr={class:`bot`},Mr={class:`datetime`},Nr={class:`info`},Pr={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Fr={key:1,class:`prompt mt-2`},Ir={key:0},Lr={key:1},Rr={key:0,class:t({content:!0,failed:!0})},zr={key:0,class:`mb-4`},Br={key:1,class:t({operations:!0,"mt-2":!0})},Vr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Hr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ur={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Wr={key:1,class:t({content:!0})},Gr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Kr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Jr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Yr={key:2,class:t({content:!0})},Xr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Qr(e,t,i,c,f,g){let v=p(`el-image`),y=p(`image-preview`),b=p(`video-player`),x=p(`el-button`),S=p(`el-tooltip`),C=p(`api-code-button`),w=p(`font-awesome-icon`),T=p(`copy-to-clipboard`),E=p(`el-alert`);return d(),m(`div`,Or,[r(`div`,kr,[o(v,{src:`https://cdn.acedata.cloud/qpbbbb.jpg`,class:`avatar`})]),r(`div`,Ar,[r(`div`,jr,[a(u(e.$t(`kling.name.klingBot`))+` `,1),r(`span`,Mr,u(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),r(`div`,Nr,[e.referenceImages.length>0?(d(),m(`div`,Pr,[(d(!0),m(_,null,l(e.referenceImages,(e,t)=>(d(),n(y,{key:t,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128))])):s(``,!0),e.modelValue?.request?.prompt?(d(),m(`p`,Fr,[a(u(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?s(``,!0):(d(),m(`span`,Ir,` - (`+u(e.$t(`kling.status.pending`))+`) `,1)),e.modelValue?.response?.state===`submitted`||e.modelValue?.response?.state===`processing`||e.modelValue?.response?.state===`pending`||e.modelValue?.response?.state===`completed`?(d(),m(`span`,Lr,` - (`+u(e.$t(`kling.status.processing`))+`) `,1)):s(``,!0)])):s(``,!0)]),e.modelValue?.response?.success===!0?(d(),m(`div`,Rr,[e.modelValue?.response.video_url?(d(),m(`div`,zr,[o(b,{src:e.modelValue?.response.video_url},null,8,[`src`])])):s(``,!0),e.modelValue?.response.success?(d(),m(`div`,Br,[o(S,{class:`box-item`,effect:`dark`,content:e.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:h(()=>[e.modelValue?.response.video_url?(d(),n(x,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:t[0]||=t=>e.onDownload(t,e.modelValue?.response.video_url)},{default:h(()=>[a(u(e.$t(`kling.button.download`)),1)]),_:1})):s(``,!0)]),_:1},8,[`content`]),o(C,{path:`/kling/videos`,body:e.modelValue?.request},null,8,[`body`])])):s(``,!0),o(E,{closable:!1,class:`mt-2 success`},{default:h(()=>[r(`p`,Vr,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.model`))+`: `+u(e.modelValue?.request?.model),1)]),r(`p`,Hr,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(T,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(d(),m(`p`,Ur,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):s(``,!0)]),_:1})])):s(``,!0),e.modelValue?.response?.success===!1?(d(),m(`div`,Wr,[o(E,{closable:!1,class:`failure`},{template:h(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.failure`)),1)]),default:h(()=>[r(`p`,Gr,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(T,{content:e.modelValue?.id},null,8,[`content`])]),r(`p`,Kr,[o(w,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.failureReason`))+`: `+u(e.modelValue?.response?.error?.message)+` `,1),o(T,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(d(),m(`p`,qr,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):s(``,!0),e.modelValue?.response?.trace_id?(d(),m(`p`,Jr,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(T,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):s(``,!0)]),_:1})])):s(``,!0),e.modelValue?.response?.success===void 0?(d(),m(`div`,Yr,[o(E,{closable:!1,class:`info`},{template:h(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.failure`)),1)]),default:h(()=>[r(`p`,Xr,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(T,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.response?.trace_id?(d(),m(`p`,Zr,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(T,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):s(``,!0)]),_:1})])):s(``,!0)])])}var $r=c({name:`RecentPanel`,components:{TaskPreview:P(Dr,[[`render`,Qr],[`__scopeId`,`data-v-422e2570`]]),NoTasks:pe,BotPlaceholder:le,ScrollList:ue},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?.()}}}),ei={key:0},ti={key:2,class:`w-full h-full flex items-center justify-center`};function ni(e,t,r,i,a,c){let u=p(`bot-placeholder`),f=p(`task-preview`),g=p(`scroll-list`),v=p(`no-tasks`);return d(),m(_,null,[e.tasks?.items===void 0?(d(),m(`div`,ei,[o(u)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(d(),n(g,{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:h(()=>[(d(!0),m(_,null,l(e.tasks?.items,e=>(d(),n(f,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):s(``,!0),e.tasks?.items?.length===0?(d(),m(`div`,ti,[o(v)])):s(``,!0)],64)}var ri=P($r,[[`render`,ni]]),ii=re(`kling`),ai=c({name:`KlingIndex`,components:{ConfigPanel:kn,MotionPanel:xr,TabSwitcher:Er,Layout:Se,RecentPanel:ri},mixins:[ie],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===G.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===G.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},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 de({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(!z(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let{camera_control:e,...t}=this.config||{},n={...t,callback_url:ii};if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){H.warning(this.$t(`kling.message.endImageRequiresStart`));return}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))}:{}});let r=this.credential?.token;if(!r){console.error(`no token specified`);return}H.info(this.$t(`kling.message.startingTask`)),F(`kling`,W.generate(n,{token:r})).then(()=>{H.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?H.error(this.$t(`kling.message.usedUp`)):H.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(!z(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){H.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.prompt?{prompt:e.prompt}:{},callback_url:ii},n=this.credential?.token;if(!n){console.error(`no token specified`);return}H.info(this.$t(`kling.message.startingTask`)),F(`kling`,W.motion(t,{token:n})).then(()=>{H.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?H.error(this.$t(`kling.message.usedUp`)):H.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),oi={class:`flex flex-col h-full`},si={class:`flex-1 min-h-0`};function ci(e,t,i,a,c,l){let u=p(`tab-switcher`),f=p(`config-panel`),m=p(`motion-panel`),g=p(`recent-panel`),_=p(`layout`);return d(),n(_,null,{config:h(()=>[r(`div`,oi,[o(u,{"model-value":e.taskType,"onUpdate:modelValue":e.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),r(`div`,si,[e.taskType===`videos`?(d(),n(f,{key:0,onGenerate:e.onGenerate},null,8,[`onGenerate`])):e.taskType===`motion`?(d(),n(m,{key:1,onGenerate:e.onGenerateMotion},null,8,[`onGenerate`])):s(``,!0)])])]),result:h(()=>[o(g,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var li=P(ai,[[`render`,ci]]);export{li as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,Bt as t,D as n,E as r,M as i,N as a,O as o,P as s,Q as c,Ut as l,X as u,_ as d,et as f,k as p,lt as m,ut as h,x as g,y as _}from"./vendor-chart-mdwpew_o.js";import{t as v}from"./button-DWzbdjZV.js";import{n as y,r as b,t as x}from"./select-Byt7Qw1F.js";import{t as S}from"./upload-CDJi96y4.js";import{t as C}from"./tooltip-C3PYfh8V.js";import{t as w}from"./image-CUt2yKJT.js";import{t as T}from"./alert-BJj7gY4q.js";import{t as E}from"./drawer-BvYPSxXh.js";import{t as D}from"./input-number-CXFB1_xE.js";import{t as ee}from"./switch-CqHzcX_8.js";import{$t as O,Qt as k,an as A,in as j,ln as te,nn as M,on as ne,pi as N,rn as P,sn as F,tn as I,un as L}from"./constants-C-bSXdJ_.js";import{$t as re,At as ie,E as R,Fn as z,Nt as B,Or as V,Ot as H,Sr as U,jt as W,kr as G,kt as K,yr as q}from"./index-Dzx62HWL.js";import{t as J}from"./index.es-BIezN10l.js";import{t as Y}from"./CopyToClipboard-LZRed5aB.js";import{t as X}from"./ImagePreview-B2FwyzyM.js";import{n as ae}from"./taskDrawerMixin-Cr17Yxqk.js";import{t as oe}from"./BotPlaceholder-DzIzZltA.js";import{i as Z,n as se,t as ce}from"./pagination-t1m3PdtM.js";import{n as le,t as ue}from"./NoTasks-Bk9F1-iz.js";import{t as de}from"./Consumption-DLzGFeUT.js";import{t as fe}from"./ApiCodeButton-C8TdRvY9.js";import{t as pe}from"./ImageWrapper-_6c4eeKK.js";var me=s({name:`LayoutSeedream`,components:{ElDrawer:E,ElButton:v,FontAwesomeIcon:J},mixins:[ae]}),he={class:`main flex flex-row flex-1`},ge={class:`config w-[320px] h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},_e={class:`result h-full p-6 flex-1 flex flex-col bg-[var(--app-content-bg)]`};function ve(t,n,i,o,s,c){let l=f(`font-awesome-icon`),g=f(`el-button`),_=f(`el-drawer`);return u(),p(`div`,he,[r(`div`,ge,[e(t.$slots,`config`,{},void 0,!0)]),r(`div`,_e,[e(t.$slots,`result`,{},void 0,!0)]),h(a(g,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[a(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[d,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:m(()=>[e(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ye=R(me,[[`render`,ve],[`__scopeId`,`data-v-2a1715d6`]]),be=s({name:`SeedreamPromptInput`,components:{PromptTextarea:le},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function xe(e,t,r,i,a,o){let s=f(`prompt-textarea`);return u(),n(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Se=R(be,[[`render`,xe]]),Ce={image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};function Q(e){switch(e){case j:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case P:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case M:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case I:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:O[I],outputFormat:!1,tools:!1};case A:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:O[A],outputFormat:!1,tools:!1};default:return Ce}}var we=[`1K`,`2K`,`3K`,`4K`];function Te(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Q(n),i=[];Array.isArray(e.image)&&e.image.length>0&&!r.image&&i.push({field:`image`,i18nLabel:`seedream.name.imageUrls`});let a=typeof e.size==`string`?e.size:void 0;if(a){let e=a.toUpperCase();(we.includes(e)&&!r.sizeTiers.includes(e)||a===`adaptive`&&!r.sizeAdaptive)&&i.push({field:`size`,i18nLabel:`seedream.name.size`})}return e.sequential_image_generation===`auto`&&!r.groupGeneration&&i.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&e.seed!==null&&!r.seed&&i.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&e.guidance_scale!==null&&!r.guidanceScale&&i.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!r.outputFormat&&i.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),Array.isArray(e.tools)&&e.tools.length>0&&!r.tools&&i.push({field:`tools`,i18nLabel:`seedream.name.tools`}),i}function Ee(e,t,n){let r={...e},i=Q(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var De=s({name:`SeedreamImageInput`,components:{ElUpload:S,ElButton:v,InfoIcon:Z,ImagePreview:X,FontAwesomeIcon:J},mixins:[W,K],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.seedream?.config?.image},model(){return this.$store.state.seedream?.config?.model},supported(){return Q(this.model).image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){G.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){G.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),Oe={key:0},ke={class:`field`},Ae={class:`label`},je={class:`box`},Me={class:`title font-bold`},Ne={class:`value`},Pe={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Fe(e,t,s,d,h,_){let v=f(`info-icon`),y=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-upload`),S=f(`image-preview`);return e.supported?(u(),p(`div`,Oe,[r(`div`,ke,[r(`div`,Ae,[r(`div`,je,[r(`h2`,Me,l(e.$t(`seedream.name.imageUrls`)),1),a(v,{content:e.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),r(`div`,Ne,[a(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-change":e.onChange,"on-remove":e.onRemove,headers:e.headers},{default:m(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:m(()=>[a(y,{icon:`fa-solid fa-upload`,class:`mr-1`}),i(` `+l(e.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),r(`div`,Pe,[(u(!0),p(g,null,c(e.fileList,(t,r)=>(u(),n(S,{key:t.uid||t?.response?.file_url||t.url||r,url:t.url||t?.response?.file_url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemovePreview(r,t)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):o(``,!0)}var Ie=R(De,[[`render`,Fe],[`__scopeId`,`data-v-6ef4c2e4`]]),Le=s({name:`SeedreamModelSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:Z},data(){return{revertKey:0,options:[{value:j,label:this.$t(`seedream.model.seedream50`)},{value:P,label:this.$t(`seedream.model.seedream45`)},{value:M,label:this.$t(`seedream.model.seedream40`)},{value:I,label:this.$t(`seedream.model.seedream30t2i`)},{value:A,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(k)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Te(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await V.confirm(this.$t(`seedream.message.featureNotSupportedBody`,{fields:r}),this.$t(`seedream.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`seedream.button.confirmContinue`),cancelButtonText:this.$t(`seedream.button.cancelSwitch`),type:`warning`});let i=Ee({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),G.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),Re={class:`field`},ze={class:`label`},Be={class:`box`},Ve={class:`title font-bold`};function He(e,t,i,o,s,d){let h=f(`info-icon`),_=f(`el-option`),v=f(`el-select`);return u(),p(`div`,Re,[r(`div`,ze,[r(`div`,Be,[r(`h2`,Ve,l(e.$t(`seedream.name.model`)),1),a(h,{content:e.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(u(),n(v,{key:e.revertKey,"model-value":e.value,class:`value`,placeholder:e.$t(`seedream.placeholder.select`),onChange:e.onChange},{default:m(()=>[(u(!0),p(g,null,c(e.options,e=>(u(),n(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Ue=R(Le,[[`render`,He],[`__scopeId`,`data-v-8892a12c`]]),We=s({name:`SeedreamSizeSelector`,components:{ElSelect:b,ElOption:x,ElOptionGroup:y,InfoIcon:Z},data(){return{SEEDREAM_SIZE_ADAPTIVE:te,pixelOptions:F}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Q(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),Ge={class:`field`},Ke={class:`label`},qe={class:`box`},Je={class:`title font-bold`};function Ye(e,t,i,s,d,h){let _=f(`info-icon`),v=f(`el-option`),y=f(`el-option-group`),b=f(`el-select`);return u(),p(`div`,Ge,[r(`div`,Ke,[r(`div`,qe,[r(`h2`,Je,l(e.$t(`seedream.name.size`)),1),a(_,{content:e.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:m(()=>[e.capabilities.sizeTiers.length?(u(),n(y,{key:0,label:e.$t(`seedream.size.group.tier`)},{default:m(()=>[(u(!0),p(g,null,c(e.capabilities.sizeTiers,e=>(u(),n(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),e.capabilities.sizeAdaptive?(u(),n(y,{key:1,label:e.$t(`seedream.size.group.adaptive`)},{default:m(()=>[(u(),n(v,{key:e.SEEDREAM_SIZE_ADAPTIVE,label:e.$t(`seedream.size.adaptive`),value:e.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:e.$t(`seedream.size.group.pixel`)},{default:m(()=>[(u(!0),p(g,null,c(e.pixelOptions,e=>(u(),n(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var Xe=R(We,[[`render`,Ye],[`__scopeId`,`data-v-dd7bd021`]]),Ze=s({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:D,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),Qe={key:0,class:`field`},$e={class:`label`},et={class:`box`},tt={class:`title font-bold`},nt={class:`value`};function rt(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-input-number`);return e.supported?(u(),p(`div`,Qe,[r(`div`,$e,[r(`div`,et,[r(`h2`,tt,l(e.$t(`seedream.name.maxImages`)),1),a(d,{content:e.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),r(`div`,nt,[a(m,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,min:1,max:e.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var it=R(Ze,[[`render`,rt],[`__scopeId`,`data-v-f079fd20`]]),at=s({name:`SeedreamOutputFormatSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:Z},data(){return{options:[...ne]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),ot={key:0,class:`field`},st={class:`label`},ct={class:`box`},lt={class:`title font-bold`};function ut(e,t,i,s,d,h){let _=f(`info-icon`),v=f(`el-option`),y=f(`el-select`);return e.supported?(u(),p(`div`,ot,[r(`div`,st,[r(`div`,ct,[r(`h2`,lt,l(e.$t(`seedream.name.outputFormat`)),1),a(_,{content:e.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`seedream.placeholder.select`)},{default:m(()=>[(u(!0),p(g,null,c(e.options,e=>(u(),n(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var dt=R(at,[[`render`,ut],[`__scopeId`,`data-v-69ea4c07`]]),ft=s({name:`SeedreamSeedInput`,components:{ElInputNumber:D,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),pt={key:0,class:`field`},mt={class:`label`},ht={class:`box`},gt={class:`title font-bold`},_t={class:`value`};function vt(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-input-number`);return e.supported?(u(),p(`div`,pt,[r(`div`,mt,[r(`div`,ht,[r(`h2`,gt,l(e.$t(`seedream.name.seed`)),1),a(d,{content:e.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),r(`div`,_t,[a(m,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var yt=R(ft,[[`render`,vt],[`__scopeId`,`data-v-10cdc1e0`]]),bt=s({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:D,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).guidanceScale},defaultValue(){return Q(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),xt={key:0,class:`field`},St={class:`label`},Ct={class:`box`},wt={class:`title font-bold`},Tt={class:`value`};function Et(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-input-number`);return e.supported?(u(),p(`div`,xt,[r(`div`,St,[r(`div`,Ct,[r(`h2`,wt,l(e.$t(`seedream.name.guidanceScale`)),1),a(d,{content:e.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),r(`div`,Tt,[a(m,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Dt=R(bt,[[`render`,Et],[`__scopeId`,`data-v-7386f064`]]),Ot=s({name:`SeedreamWatermarkSwitch`,components:{ElSwitch:ee,InfoIcon:Z},computed:{value:{get(){let e=this.$store.state.seedream?.config?.watermark;return e===void 0?!1:!!e},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,watermark:e})}}}}),kt={class:`field`},At={class:`label`},jt={class:`box`},Mt={class:`title font-bold`},Nt={class:`value`};function Pt(e,t,n,i,o,s){let c=f(`info-icon`),d=f(`el-switch`);return u(),p(`div`,kt,[r(`div`,At,[r(`div`,jt,[r(`h2`,Mt,l(e.$t(`seedream.name.watermark`)),1),a(c,{content:e.$t(`seedream.description.watermark`),class:`info`},null,8,[`content`])])]),r(`div`,Nt,[a(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t},null,8,[`modelValue`])])])}var Ft=s({name:`SeedreamConfigPanel`,components:{ElButton:v,FontAwesomeIcon:J,PromptInput:Se,Consumption:de,ImageInput:Ie,ModelSelector:Ue,SizeSelector:Xe,MaxImagesSelector:it,OutputFormatSelector:dt,SeedInput:yt,GuidanceScaleInput:Dt,WatermarkSwitch:R(Ot,[[`render`,Pt],[`__scopeId`,`data-v-9e2abf0f`]])},emits:[`generate`],computed:{config(){return this.$store.state.seedream?.config},consumption(){let e={...this.config||{}},t=Array.isArray(e?.image)&&e.image.length>0,n=e?.sequential_image_generation===`auto`?Math.max(1,Math.floor(e?.sequential_image_generation_options?.max_images||1)):1;return B({...e,action:t?`edit`:`generate`,model:L(e?.model),count:n},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),It={class:`flex flex-col h-full`},Lt={class:`flex-1 overflow-y-auto p-5`},Rt={class:`flex flex-col items-center justify-center px-5 pb-5`};function zt(e,t,n,o,s,c){let d=f(`model-selector`),h=f(`size-selector`),g=f(`max-images-selector`),_=f(`output-format-selector`),v=f(`seed-input`),y=f(`guidance-scale-input`),b=f(`watermark-switch`),x=f(`prompt-input`),S=f(`image-input`),C=f(`consumption`),w=f(`font-awesome-icon`),T=f(`el-button`);return u(),p(`div`,It,[r(`div`,Lt,[a(d,{class:`mb-4`}),a(h,{class:`mb-4`}),a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`})]),r(`div`,Rt,[a(C,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),a(T,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:m(()=>[a(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Bt=R(Ft,[[`render`,zt]]),Vt=s({name:`SeedreamTaskPreview`,components:{ElImage:w,CopyToClipboard:Y,FontAwesomeIcon:J,ElAlert:T,ImageWrapper:pe,ElButton:v,ElTooltip:C,ImagePreview:X,ApiCodeButton:fe},props:{modelValue:{type:Object,required:!0}},computed:{isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{shortModel(e){return L(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Ht={class:`preview`},Ut={class:`left`},Wt={class:`main`},Gt={class:`bot`},Kt={class:`datetime`},qt={class:`info`},Jt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Yt={key:1,class:`prompt mt-2`},Xt={key:0},Zt={key:0,class:t({content:!0})},Qt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$t={key:1,class:t({content:!0,failed:!0})},en={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},tn={class:t({operations:!0,"mt-2":!0,"mb-2":!0})},nn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},rn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:2,class:t({content:!0})},ln={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},un={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},gn={key:3,class:t({content:!0})},_n={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function yn(e,t,s,d,h,v){let y=f(`el-image`),b=f(`image-preview`),x=f(`font-awesome-icon`),S=f(`copy-to-clipboard`),C=f(`el-alert`),w=f(`image-wrapper`),T=f(`el-button`),E=f(`el-tooltip`),D=f(`api-code-button`);return u(),p(`div`,Ht,[r(`div`,Ut,[a(y,{src:`https://cdn.acedata.cloud/9egrbn.png`,class:`avatar`})]),r(`div`,Wt,[r(`div`,Gt,[i(l(e.$t(`seedream.name.seedreamBot`))+` `,1),r(`span`,Kt,l(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),r(`div`,qt,[Array.isArray(e.modelValue?.request?.image)&&e.modelValue?.request?.image.length>0?(u(),p(`div`,Jt,[(u(!0),p(g,null,c(e.modelValue?.request?.image,(e,t)=>(u(),n(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),e.modelValue?.request?.prompt?(u(),p(`p`,Yt,[i(l(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?o(``,!0):(u(),p(`span`,Xt,` - (`+l(e.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),e.modelValue?.response?e.modelValue?.response?.success===!0?(u(),p(`div`,$t,[r(`div`,en,[(u(!0),p(g,null,c(e.images,(e,t)=>(u(),n(w,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),r(`div`,tn,[a(E,{class:`box-item`,effect:`dark`,content:e.$t(`common.button.edit`),placement:`top-start`},{default:m(()=>[a(T,{type:`info`,size:`small`,class:`btn-action`,onClick:t[0]||=_(t=>e.onEdit(e.images?.[0]?.image_url),[`stop`])},{default:m(()=>[i(l(e.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(D,{path:`/seedream/images`,body:e.modelValue?.request},null,8,[`body`])]),a(C,{closable:!1,class:`mt-2 success`},{default:m(()=>[e.modelValue?.request?.model?(u(),p(`p`,nn,[a(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.model`))+`: `+l(e.shortModel(e.modelValue?.request?.model)),1)])):o(``,!0),e.modelValue?.request?.size?(u(),p(`p`,rn,[a(x,{icon:`fa-solid fa-image`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.size`))+`: `+l(e.modelValue?.request?.size),1)])):o(``,!0),r(`p`,an,[a(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.task`))+`: `+l(e.isEdit?e.$t(`seedream.name.edits`):e.$t(`seedream.name.generate`)),1)]),r(`p`,on,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),a(S,{content:e.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),e.modelValue?.elapsed?(u(),p(`p`,sn,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.elapsed`))+`: `+l(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e.modelValue?.response?.trace_id?(u(),p(`p`,cn,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.traceId`))+`: `+l(e.modelValue?.response?.trace_id)+` `,1),a(S,{content:e.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):e.modelValue?.response?.success===!1?(u(),p(`div`,$,[a(C,{closable:!1,class:`failure`},{template:m(()=>[a(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.failure`)),1)]),default:m(()=>[e.modelValue?.request?.model?(u(),p(`p`,ln,[a(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.model`))+`: `+l(e.shortModel(e.modelValue?.request?.model)),1)])):o(``,!0),e.modelValue?.request?.size?(u(),p(`p`,un,[a(x,{icon:`fa-solid fa-image`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.size`))+`: `+l(e.modelValue?.request?.size),1)])):o(``,!0),r(`p`,dn,[a(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.task`))+`: `+l(e.isEdit?e.$t(`seedream.name.edits`):e.$t(`seedream.name.generate`)),1)]),r(`p`,fn,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),a(S,{content:e.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e.modelValue?.response?.error?.message?(u(),p(`p`,pn,[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.failureReason`))+`: `+l(e.modelValue?.response?.error?.message)+` `,1),a(S,{content:e.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),e.modelValue?.elapsed?(u(),p(`p`,mn,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.elapsed`))+`: `+l(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e.modelValue?.response?.trace_id?(u(),p(`p`,hn,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.traceId`))+`: `+l(e.modelValue?.response?.trace_id)+` `,1),a(S,{content:e.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(u(),p(`div`,gn,[a(C,{closable:!1,class:`info`},{template:m(()=>[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.status`)),1)]),default:m(()=>[r(`p`,_n,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),a(S,{content:e.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e.modelValue?.response?.trace_id?(u(),p(`p`,vn,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.traceId`))+`: `+l(e.modelValue?.response?.trace_id)+` `,1),a(S,{content:e.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(u(),p(`div`,Zt,[a(C,{closable:!1,class:`info`},{template:m(()=>[a(x,{icon:`fa-regular fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`seedream.status.pending`)),1)]),default:m(()=>[r(`p`,Qt,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),a(S,{content:e.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var bn=s({name:`SeedreamRecentPanel`,components:{TaskPreview:R(Vt,[[`render`,yn],[`__scopeId`,`data-v-1b4654bc`]]),BotPlaceholder:oe,NoTasks:ue,ScrollList:se},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),xn={key:0},Sn={key:2,class:`w-full h-full flex items-center justify-center`};function Cn(e,t,r,i,s,l){let d=f(`bot-placeholder`),h=f(`task-preview`),_=f(`scroll-list`),v=f(`no-tasks`);return u(),p(g,null,[e.tasks?.items===void 0?(u(),p(`div`,xn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(u(),n(_,{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:m(()=>[(u(!0),p(g,null,c(e.tasks?.items,e=>(u(),n(h,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(u(),p(`div`,Sn,[a(v)])):o(``,!0)],64)}var wn=R(bn,[[`render`,Cn]]),Tn=N(`seedream`),En=s({name:`SeedreamIndex`,components:{ConfigPanel:Bt,Layout:ye,RecentPanel:wn},mixins:[ie],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===q.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ce({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!H(this.uploadTracker,e=>this.$t(e),e=>G.warning(e)))return;let e={...this.config||{}};!(Array.isArray(e?.image)&&e.image.length>0)&&`image`in e&&delete e.image,e?.size||delete e.size;let t={...e,callback_url:Tn},n=this.credential?.token;if(!n){console.error(`no token specified`);return}G.info(this.$t(`seedream.message.startingTask`)),z(`seedream`,re.generate(t,{token:n})).then(()=>{G.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?G.error(this.$t(`seedream.message.usedUp`)):G.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Dn(e,t,r,i,o,s){let c=f(`config-panel`),l=f(`recent-panel`),d=f(`layout`);return u(),n(d,null,{config:m(()=>[a(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[a(l,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var On=R(En,[[`render`,Dn]]);export{On as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,Bt as t,D as n,E as r,M as i,N as a,O as o,P as s,Q as c,Ut as l,X as u,_ as d,et as f,k as p,lt as m,ut as h,x as g,y as _}from"./vendor-chart-mdwpew_o.js";import{t as v}from"./button-DWzbdjZV.js";import{n as y,r as b,t as x}from"./select-B14L-681.js";import{t as S}from"./upload-CgRMUkQi.js";import{t as C}from"./tooltip-C3PYfh8V.js";import{t as w}from"./image-CjzS-up0.js";import{t as T}from"./alert-BJj7gY4q.js";import{t as E}from"./drawer-BvYPSxXh.js";import{t as D}from"./input-number-N0auilju.js";import{t as ee}from"./switch-Dir3SgN_.js";import{$t as O,Qt as k,an as A,in as j,ln as te,nn as M,on as ne,pi as N,rn as P,sn as F,tn as I,un as L}from"./constants-C-bSXdJ_.js";import{$t as re,At as ie,E as R,Fn as z,Nt as B,Or as V,Ot as H,Sr as U,jt as W,kr as G,kt as K,yr as q}from"./index-BY8YIwDb.js";import{t as J}from"./index.es-CH5vwGaN.js";import{t as Y}from"./CopyToClipboard-C8gyDUMn.js";import{t as X}from"./ImagePreview-DkXTeOKK.js";import{n as ae}from"./taskDrawerMixin-Cr17Yxqk.js";import{t as oe}from"./BotPlaceholder-BVXWzbpi.js";import{i as Z,n as se,t as ce}from"./pagination-CjEVtILV.js";import{n as le,t as ue}from"./NoTasks-Dk1WXppl.js";import{t as de}from"./Consumption-QfvilMcG.js";import{t as fe}from"./ApiCodeButton-DpYCu-EK.js";import{t as pe}from"./ImageWrapper-3eqDS8_u.js";var me=s({name:`LayoutSeedream`,components:{ElDrawer:E,ElButton:v,FontAwesomeIcon:J},mixins:[ae]}),he={class:`main flex flex-row flex-1`},ge={class:`config w-[320px] h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},_e={class:`result h-full p-6 flex-1 flex flex-col bg-[var(--app-content-bg)]`};function ve(t,n,i,o,s,c){let l=f(`font-awesome-icon`),g=f(`el-button`),_=f(`el-drawer`);return u(),p(`div`,he,[r(`div`,ge,[e(t.$slots,`config`,{},void 0,!0)]),r(`div`,_e,[e(t.$slots,`result`,{},void 0,!0)]),h(a(g,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[a(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[d,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:m(()=>[e(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ye=R(me,[[`render`,ve],[`__scopeId`,`data-v-2a1715d6`]]),be=s({name:`SeedreamPromptInput`,components:{PromptTextarea:le},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function xe(e,t,r,i,a,o){let s=f(`prompt-textarea`);return u(),n(s,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Se=R(be,[[`render`,xe]]),Ce={image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};function Q(e){switch(e){case j:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case P:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case M:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case I:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:O[I],outputFormat:!1,tools:!1};case A:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:O[A],outputFormat:!1,tools:!1};default:return Ce}}var we=[`1K`,`2K`,`3K`,`4K`];function Te(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Q(n),i=[];Array.isArray(e.image)&&e.image.length>0&&!r.image&&i.push({field:`image`,i18nLabel:`seedream.name.imageUrls`});let a=typeof e.size==`string`?e.size:void 0;if(a){let e=a.toUpperCase();(we.includes(e)&&!r.sizeTiers.includes(e)||a===`adaptive`&&!r.sizeAdaptive)&&i.push({field:`size`,i18nLabel:`seedream.name.size`})}return e.sequential_image_generation===`auto`&&!r.groupGeneration&&i.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&e.seed!==null&&!r.seed&&i.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&e.guidance_scale!==null&&!r.guidanceScale&&i.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!r.outputFormat&&i.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),Array.isArray(e.tools)&&e.tools.length>0&&!r.tools&&i.push({field:`tools`,i18nLabel:`seedream.name.tools`}),i}function Ee(e,t,n){let r={...e},i=Q(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var De=s({name:`SeedreamImageInput`,components:{ElUpload:S,ElButton:v,InfoIcon:Z,ImagePreview:X,FontAwesomeIcon:J},mixins:[W,K],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.seedream?.config?.image},model(){return this.$store.state.seedream?.config?.model},supported(){return Q(this.model).image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){G.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){G.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),Oe={key:0},ke={class:`field`},Ae={class:`label`},je={class:`box`},Me={class:`title font-bold`},Ne={class:`value`},Pe={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Fe(e,t,s,d,h,_){let v=f(`info-icon`),y=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-upload`),S=f(`image-preview`);return e.supported?(u(),p(`div`,Oe,[r(`div`,ke,[r(`div`,Ae,[r(`div`,je,[r(`h2`,Me,l(e.$t(`seedream.name.imageUrls`)),1),a(v,{content:e.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),r(`div`,Ne,[a(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,"on-change":e.onChange,"on-remove":e.onRemove,headers:e.headers},{default:m(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:m(()=>[a(y,{icon:`fa-solid fa-upload`,class:`mr-1`}),i(` `+l(e.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),r(`div`,Pe,[(u(!0),p(g,null,c(e.fileList,(t,r)=>(u(),n(S,{key:t.uid||t?.response?.file_url||t.url||r,url:t.url||t?.response?.file_url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemovePreview(r,t)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):o(``,!0)}var Ie=R(De,[[`render`,Fe],[`__scopeId`,`data-v-6ef4c2e4`]]),Le=s({name:`SeedreamModelSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:Z},data(){return{revertKey:0,options:[{value:j,label:this.$t(`seedream.model.seedream50`)},{value:P,label:this.$t(`seedream.model.seedream45`)},{value:M,label:this.$t(`seedream.model.seedream40`)},{value:I,label:this.$t(`seedream.model.seedream30t2i`)},{value:A,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(k)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Te(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await V.confirm(this.$t(`seedream.message.featureNotSupportedBody`,{fields:r}),this.$t(`seedream.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`seedream.button.confirmContinue`),cancelButtonText:this.$t(`seedream.button.cancelSwitch`),type:`warning`});let i=Ee({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),G.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),Re={class:`field`},ze={class:`label`},Be={class:`box`},Ve={class:`title font-bold`};function He(e,t,i,o,s,d){let h=f(`info-icon`),_=f(`el-option`),v=f(`el-select`);return u(),p(`div`,Re,[r(`div`,ze,[r(`div`,Be,[r(`h2`,Ve,l(e.$t(`seedream.name.model`)),1),a(h,{content:e.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(u(),n(v,{key:e.revertKey,"model-value":e.value,class:`value`,placeholder:e.$t(`seedream.placeholder.select`),onChange:e.onChange},{default:m(()=>[(u(!0),p(g,null,c(e.options,e=>(u(),n(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Ue=R(Le,[[`render`,He],[`__scopeId`,`data-v-8892a12c`]]),We=s({name:`SeedreamSizeSelector`,components:{ElSelect:b,ElOption:x,ElOptionGroup:y,InfoIcon:Z},data(){return{SEEDREAM_SIZE_ADAPTIVE:te,pixelOptions:F}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Q(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),Ge={class:`field`},Ke={class:`label`},qe={class:`box`},Je={class:`title font-bold`};function Ye(e,t,i,s,d,h){let _=f(`info-icon`),v=f(`el-option`),y=f(`el-option-group`),b=f(`el-select`);return u(),p(`div`,Ge,[r(`div`,Ke,[r(`div`,qe,[r(`h2`,Je,l(e.$t(`seedream.name.size`)),1),a(_,{content:e.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:m(()=>[e.capabilities.sizeTiers.length?(u(),n(y,{key:0,label:e.$t(`seedream.size.group.tier`)},{default:m(()=>[(u(!0),p(g,null,c(e.capabilities.sizeTiers,e=>(u(),n(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),e.capabilities.sizeAdaptive?(u(),n(y,{key:1,label:e.$t(`seedream.size.group.adaptive`)},{default:m(()=>[(u(),n(v,{key:e.SEEDREAM_SIZE_ADAPTIVE,label:e.$t(`seedream.size.adaptive`),value:e.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:e.$t(`seedream.size.group.pixel`)},{default:m(()=>[(u(!0),p(g,null,c(e.pixelOptions,e=>(u(),n(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var Xe=R(We,[[`render`,Ye],[`__scopeId`,`data-v-dd7bd021`]]),Ze=s({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:D,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),Qe={key:0,class:`field`},$e={class:`label`},et={class:`box`},tt={class:`title font-bold`},nt={class:`value`};function rt(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-input-number`);return e.supported?(u(),p(`div`,Qe,[r(`div`,$e,[r(`div`,et,[r(`h2`,tt,l(e.$t(`seedream.name.maxImages`)),1),a(d,{content:e.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),r(`div`,nt,[a(m,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,min:1,max:e.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var it=R(Ze,[[`render`,rt],[`__scopeId`,`data-v-f079fd20`]]),at=s({name:`SeedreamOutputFormatSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:Z},data(){return{options:[...ne]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),ot={key:0,class:`field`},st={class:`label`},ct={class:`box`},lt={class:`title font-bold`};function ut(e,t,i,s,d,h){let _=f(`info-icon`),v=f(`el-option`),y=f(`el-select`);return e.supported?(u(),p(`div`,ot,[r(`div`,st,[r(`div`,ct,[r(`h2`,lt,l(e.$t(`seedream.name.outputFormat`)),1),a(_,{content:e.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`seedream.placeholder.select`)},{default:m(()=>[(u(!0),p(g,null,c(e.options,e=>(u(),n(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var dt=R(at,[[`render`,ut],[`__scopeId`,`data-v-69ea4c07`]]),ft=s({name:`SeedreamSeedInput`,components:{ElInputNumber:D,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),pt={key:0,class:`field`},mt={class:`label`},ht={class:`box`},gt={class:`title font-bold`},_t={class:`value`};function vt(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-input-number`);return e.supported?(u(),p(`div`,pt,[r(`div`,mt,[r(`div`,ht,[r(`h2`,gt,l(e.$t(`seedream.name.seed`)),1),a(d,{content:e.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),r(`div`,_t,[a(m,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var yt=R(ft,[[`render`,vt],[`__scopeId`,`data-v-10cdc1e0`]]),bt=s({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:D,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).guidanceScale},defaultValue(){return Q(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),xt={key:0,class:`field`},St={class:`label`},Ct={class:`box`},wt={class:`title font-bold`},Tt={class:`value`};function Et(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-input-number`);return e.supported?(u(),p(`div`,xt,[r(`div`,St,[r(`div`,Ct,[r(`h2`,wt,l(e.$t(`seedream.name.guidanceScale`)),1),a(d,{content:e.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),r(`div`,Tt,[a(m,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Dt=R(bt,[[`render`,Et],[`__scopeId`,`data-v-7386f064`]]),Ot=s({name:`SeedreamWatermarkSwitch`,components:{ElSwitch:ee,InfoIcon:Z},computed:{value:{get(){let e=this.$store.state.seedream?.config?.watermark;return e===void 0?!1:!!e},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,watermark:e})}}}}),kt={class:`field`},At={class:`label`},jt={class:`box`},Mt={class:`title font-bold`},Nt={class:`value`};function Pt(e,t,n,i,o,s){let c=f(`info-icon`),d=f(`el-switch`);return u(),p(`div`,kt,[r(`div`,At,[r(`div`,jt,[r(`h2`,Mt,l(e.$t(`seedream.name.watermark`)),1),a(c,{content:e.$t(`seedream.description.watermark`),class:`info`},null,8,[`content`])])]),r(`div`,Nt,[a(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t},null,8,[`modelValue`])])])}var Ft=s({name:`SeedreamConfigPanel`,components:{ElButton:v,FontAwesomeIcon:J,PromptInput:Se,Consumption:de,ImageInput:Ie,ModelSelector:Ue,SizeSelector:Xe,MaxImagesSelector:it,OutputFormatSelector:dt,SeedInput:yt,GuidanceScaleInput:Dt,WatermarkSwitch:R(Ot,[[`render`,Pt],[`__scopeId`,`data-v-9e2abf0f`]])},emits:[`generate`],computed:{config(){return this.$store.state.seedream?.config},consumption(){let e={...this.config||{}},t=Array.isArray(e?.image)&&e.image.length>0,n=e?.sequential_image_generation===`auto`?Math.max(1,Math.floor(e?.sequential_image_generation_options?.max_images||1)):1;return B({...e,action:t?`edit`:`generate`,model:L(e?.model),count:n},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),It={class:`flex flex-col h-full`},Lt={class:`flex-1 overflow-y-auto p-5`},Rt={class:`flex flex-col items-center justify-center px-5 pb-5`};function zt(e,t,n,o,s,c){let d=f(`model-selector`),h=f(`size-selector`),g=f(`max-images-selector`),_=f(`output-format-selector`),v=f(`seed-input`),y=f(`guidance-scale-input`),b=f(`watermark-switch`),x=f(`prompt-input`),S=f(`image-input`),C=f(`consumption`),w=f(`font-awesome-icon`),T=f(`el-button`);return u(),p(`div`,It,[r(`div`,Lt,[a(d,{class:`mb-4`}),a(h,{class:`mb-4`}),a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`})]),r(`div`,Rt,[a(C,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),a(T,{type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:m(()=>[a(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Bt=R(Ft,[[`render`,zt]]),Vt=s({name:`SeedreamTaskPreview`,components:{ElImage:w,CopyToClipboard:Y,FontAwesomeIcon:J,ElAlert:T,ImageWrapper:pe,ElButton:v,ElTooltip:C,ImagePreview:X,ApiCodeButton:fe},props:{modelValue:{type:Object,required:!0}},computed:{isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{shortModel(e){return L(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Ht={class:`preview`},Ut={class:`left`},Wt={class:`main`},Gt={class:`bot`},Kt={class:`datetime`},qt={class:`info`},Jt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Yt={key:1,class:`prompt mt-2`},Xt={key:0},Zt={key:0,class:t({content:!0})},Qt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$t={key:1,class:t({content:!0,failed:!0})},en={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},tn={class:t({operations:!0,"mt-2":!0,"mb-2":!0})},nn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},rn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:2,class:t({content:!0})},ln={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},un={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},gn={key:3,class:t({content:!0})},_n={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function yn(e,t,s,d,h,v){let y=f(`el-image`),b=f(`image-preview`),x=f(`font-awesome-icon`),S=f(`copy-to-clipboard`),C=f(`el-alert`),w=f(`image-wrapper`),T=f(`el-button`),E=f(`el-tooltip`),D=f(`api-code-button`);return u(),p(`div`,Ht,[r(`div`,Ut,[a(y,{src:`https://cdn.acedata.cloud/9egrbn.png`,class:`avatar`})]),r(`div`,Wt,[r(`div`,Gt,[i(l(e.$t(`seedream.name.seedreamBot`))+` `,1),r(`span`,Kt,l(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),r(`div`,qt,[Array.isArray(e.modelValue?.request?.image)&&e.modelValue?.request?.image.length>0?(u(),p(`div`,Jt,[(u(!0),p(g,null,c(e.modelValue?.request?.image,(e,t)=>(u(),n(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),e.modelValue?.request?.prompt?(u(),p(`p`,Yt,[i(l(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?o(``,!0):(u(),p(`span`,Xt,` - (`+l(e.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),e.modelValue?.response?e.modelValue?.response?.success===!0?(u(),p(`div`,$t,[r(`div`,en,[(u(!0),p(g,null,c(e.images,(e,t)=>(u(),n(w,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),r(`div`,tn,[a(E,{class:`box-item`,effect:`dark`,content:e.$t(`common.button.edit`),placement:`top-start`},{default:m(()=>[a(T,{type:`info`,size:`small`,class:`btn-action`,onClick:t[0]||=_(t=>e.onEdit(e.images?.[0]?.image_url),[`stop`])},{default:m(()=>[i(l(e.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(D,{path:`/seedream/images`,body:e.modelValue?.request},null,8,[`body`])]),a(C,{closable:!1,class:`mt-2 success`},{default:m(()=>[e.modelValue?.request?.model?(u(),p(`p`,nn,[a(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.model`))+`: `+l(e.shortModel(e.modelValue?.request?.model)),1)])):o(``,!0),e.modelValue?.request?.size?(u(),p(`p`,rn,[a(x,{icon:`fa-solid fa-image`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.size`))+`: `+l(e.modelValue?.request?.size),1)])):o(``,!0),r(`p`,an,[a(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.task`))+`: `+l(e.isEdit?e.$t(`seedream.name.edits`):e.$t(`seedream.name.generate`)),1)]),r(`p`,on,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),a(S,{content:e.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),e.modelValue?.elapsed?(u(),p(`p`,sn,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.elapsed`))+`: `+l(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e.modelValue?.response?.trace_id?(u(),p(`p`,cn,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.traceId`))+`: `+l(e.modelValue?.response?.trace_id)+` `,1),a(S,{content:e.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):e.modelValue?.response?.success===!1?(u(),p(`div`,$,[a(C,{closable:!1,class:`failure`},{template:m(()=>[a(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.failure`)),1)]),default:m(()=>[e.modelValue?.request?.model?(u(),p(`p`,ln,[a(x,{icon:`fa-solid fa-cube`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.model`))+`: `+l(e.shortModel(e.modelValue?.request?.model)),1)])):o(``,!0),e.modelValue?.request?.size?(u(),p(`p`,un,[a(x,{icon:`fa-solid fa-image`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.size`))+`: `+l(e.modelValue?.request?.size),1)])):o(``,!0),r(`p`,dn,[a(x,{icon:`fa-solid fa-bolt`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.task`))+`: `+l(e.isEdit?e.$t(`seedream.name.edits`):e.$t(`seedream.name.generate`)),1)]),r(`p`,fn,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),a(S,{content:e.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e.modelValue?.response?.error?.message?(u(),p(`p`,pn,[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.failureReason`))+`: `+l(e.modelValue?.response?.error?.message)+` `,1),a(S,{content:e.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),e.modelValue?.elapsed?(u(),p(`p`,mn,[a(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.elapsed`))+`: `+l(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e.modelValue?.response?.trace_id?(u(),p(`p`,hn,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.traceId`))+`: `+l(e.modelValue?.response?.trace_id)+` `,1),a(S,{content:e.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(u(),p(`div`,gn,[a(C,{closable:!1,class:`info`},{template:m(()=>[a(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.status`)),1)]),default:m(()=>[r(`p`,_n,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),a(S,{content:e.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e.modelValue?.response?.trace_id?(u(),p(`p`,vn,[a(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.traceId`))+`: `+l(e.modelValue?.response?.trace_id)+` `,1),a(S,{content:e.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(u(),p(`div`,Zt,[a(C,{closable:!1,class:`info`},{template:m(()=>[a(x,{icon:`fa-regular fa-clock`,class:`mr-1`}),i(` `+l(e.$t(`seedream.status.pending`)),1)]),default:m(()=>[r(`p`,Qt,[a(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),i(` `+l(e.$t(`seedream.name.taskId`))+`: `+l(e.modelValue?.id)+` `,1),a(S,{content:e.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var bn=s({name:`SeedreamRecentPanel`,components:{TaskPreview:R(Vt,[[`render`,yn],[`__scopeId`,`data-v-1b4654bc`]]),BotPlaceholder:oe,NoTasks:ue,ScrollList:se},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),xn={key:0},Sn={key:2,class:`w-full h-full flex items-center justify-center`};function Cn(e,t,r,i,s,l){let d=f(`bot-placeholder`),h=f(`task-preview`),_=f(`scroll-list`),v=f(`no-tasks`);return u(),p(g,null,[e.tasks?.items===void 0?(u(),p(`div`,xn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(u(),n(_,{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:m(()=>[(u(!0),p(g,null,c(e.tasks?.items,e=>(u(),n(h,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(u(),p(`div`,Sn,[a(v)])):o(``,!0)],64)}var wn=R(bn,[[`render`,Cn]]),Tn=N(`seedream`),En=s({name:`SeedreamIndex`,components:{ConfigPanel:Bt,Layout:ye,RecentPanel:wn},mixins:[ie],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===q.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ce({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!H(this.uploadTracker,e=>this.$t(e),e=>G.warning(e)))return;let e={...this.config||{}};!(Array.isArray(e?.image)&&e.image.length>0)&&`image`in e&&delete e.image,e?.size||delete e.size;let t={...e,callback_url:Tn},n=this.credential?.token;if(!n){console.error(`no token specified`);return}G.info(this.$t(`seedream.message.startingTask`)),z(`seedream`,re.generate(t,{token:n})).then(()=>{G.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?G.error(this.$t(`seedream.message.usedUp`)):G.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Dn(e,t,r,i,o,s){let c=f(`config-panel`),l=f(`recent-panel`),d=f(`layout`);return u(),n(d,null,{config:m(()=>[a(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[a(l,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var On=R(En,[[`render`,Dn]]);export{On as default};
|