@acedatacloud/nexior 3.330.16 → 3.330.17
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-DGSP7Ahw.js → ApiCodeButton-C-TuDkaQ.js} +1 -1
- package/dist/assets/{Artifacts-CCQi-J0V.js → Artifacts-CAtBDVlf.js} +1 -1
- package/dist/assets/{AskUserQuestionCard-CXfCSGQH.js → AskUserQuestionCard-Cuys_wGx.js} +1 -1
- package/dist/assets/{AudioPreview-BSZ6q1Re.js → AudioPreview-BVgoCdzr.js} +1 -1
- package/dist/assets/{Auth-OUlF2FEi.js → Auth-CciwNpei.js} +1 -1
- package/dist/assets/{Bare-CRrbqqvN.js → Bare-6UcYHMRi.js} +1 -1
- package/dist/assets/{BotPlaceholder-dvhs1bQC.js → BotPlaceholder-B7smvpFp.js} +1 -1
- package/dist/assets/{BottomFooter-CQ5nEYsP.js → BottomFooter-RUXVZGwY.js} +1 -1
- package/dist/assets/{Callback-DH1Y2oEV.js → Callback-C0Ydn4H1.js} +1 -1
- package/dist/assets/{CodeSnippet-C9gya5LN.js → CodeSnippet-DqLrz1Wv.js} +1 -1
- package/dist/assets/{Console-B2CTGBkn.js → Console-B26VcNaw.js} +1 -1
- package/dist/assets/{Consumption-DRd8XlSO.js → Consumption-xkYaAMt8.js} +1 -1
- package/dist/assets/{Conversation-CPNL1BOR.css → Conversation-C14-q0N_.css} +1 -1
- package/dist/assets/Conversation-CxdFImmt.js +1 -0
- package/dist/assets/{Conversation-CJIs7gFe.js → Conversation-DB0_hGsr.js} +1 -1
- package/dist/assets/{CopyToClipboard-CMRvafZB.js → CopyToClipboard-BZF25rbq.js} +1 -1
- package/dist/assets/Detail-Zk1rPY7x.js +2 -0
- package/dist/assets/Extra-Dg1tBzwS.js +1 -0
- package/dist/assets/{FilePreview-BoqdQ-sh.js → FilePreview-BXzr-WpS.js} +1 -1
- package/dist/assets/{Hailuo-FU8Biyn9.js → Hailuo-BSKElrxb.js} +1 -1
- package/dist/assets/{History-BEhLCyLr.js → History-CXuORIdo.js} +1 -1
- package/dist/assets/{ImagePreview-CK8FEzsq.js → ImagePreview-ChXS4xrI.js} +1 -1
- package/dist/assets/{ImageWrapper-Dl-ND9vN.js → ImageWrapper-CfeuntPz.js} +1 -1
- package/dist/assets/{Index-DyqoeIpV.js → Index-1oKBn5jA.js} +1 -1
- package/dist/assets/{Index-BT1KOZoD.js → Index-B1i4c-5X.js} +1 -1
- package/dist/assets/{Index-C1SoQot32.js → Index-B7kAQra12.js} +1 -1
- package/dist/assets/{Index-bNrxbg6F.js → Index-BCFhLFS_.js} +1 -1
- package/dist/assets/{Index-C94lfx8C.js → Index-BQuKZQOc.js} +1 -1
- package/dist/assets/{Index-hMPB5fh_2.js → Index-Bbo3be1U2.js} +1 -1
- package/dist/assets/{Index-uo2jLufH.js → Index-Br7kDlVt.js} +1 -1
- package/dist/assets/{Index-vmt5TvJe2.js → Index-BxwVxWRf2.js} +2 -2
- package/dist/assets/Index-CCsyu3Gn.js +1 -0
- package/dist/assets/Index-CMbZCy2P.js +1 -0
- package/dist/assets/{Index-CZAAh5Gp.js → Index-CNt37d0Z.js} +1 -1
- package/dist/assets/{Index-CG3_7xlo.js → Index-COkZ-i0g.js} +1 -1
- package/dist/assets/{Index-BvSGFjJW.js → Index-CRUfN3Jp.js} +1 -1
- package/dist/assets/{Index-9Em-z8F6.js → Index-C_OLMWnH.js} +1 -1
- package/dist/assets/{Index-m_YUrr7G.js → Index-CqWulTF1.js} +1 -1
- package/dist/assets/{Index-BJdNiwvV.js → Index-DG6Gm2Hg.js} +1 -1
- package/dist/assets/{Index-xWsyJ617.js → Index-DIp28UaH.js} +1 -1
- package/dist/assets/{Index-BWXbNuSZ.js → Index-D_iCPq-j.js} +1 -1
- package/dist/assets/{Index-B9bXzB5B.js → Index-Da3DLYFb.js} +1 -1
- package/dist/assets/{Index-DaFhLRXk.js → Index-De5l_iGi.js} +1 -1
- package/dist/assets/{Index-BcRCVnGK2.js → Index-DtsY3tVw2.js} +1 -1
- package/dist/assets/{Index-BCUw0bia.js → Index-Dugo_BEI.js} +1 -1
- package/dist/assets/{Index-BTMQTrmL.js → Index-KLzYQzap.js} +1 -1
- package/dist/assets/{Index-D8-YPlea2.js → Index-OL_nLKxo2.js} +1 -1
- package/dist/assets/{Index-COF9SsSp.js → Index-__HYwcEH.js} +1 -1
- package/dist/assets/{Index-BpMGX50C2.js → Index-bz2_Ah2j2.js} +1 -1
- package/dist/assets/{Index-CqbGxu7b.js → Index-j1Tf9fzv.js} +1 -1
- package/dist/assets/{Index-CsLxqCDP2.js → Index-keTCZH-u2.js} +1 -1
- package/dist/assets/{Index-O1WRNEa_.js → Index-nUNmBMMP.js} +1 -1
- package/dist/assets/{Index-BWqHniUn.js → Index-rigwuQQ_.js} +1 -1
- package/dist/assets/{Invitees-Dj8_HgvU.js → Invitees-DBbhhQO3.js} +1 -1
- package/dist/assets/List-09J-GsBD.js +1 -0
- package/dist/assets/{List-Bc7lOsvz.js → List-C0JMhANW.js} +1 -1
- package/dist/assets/List-DHE9IFTS.js +1 -0
- package/dist/assets/{LocalTools-CZgw2hDU.js → LocalTools-Cox62-0N.js} +1 -1
- package/dist/assets/LocalTools-uK79p81S.js +5 -0
- package/dist/assets/{Main-CDDQ8y-U.js → Main-DEiw0g8a.js} +1 -1
- package/dist/assets/Message-BOut2OMK.js +3 -0
- package/dist/assets/{Message-BuhMM9rS.css → Message-CfavcneZ.css} +1 -1
- package/dist/assets/{Model-DsaqN9nI.js → Model-CkIjXuiV.js} +1 -1
- package/dist/assets/{Navigator-tIKgiVK2.js → Navigator-CmNjXYs1.js} +4 -4
- package/dist/assets/{NotFound-DsRKQ4jD.js → NotFound-8tH8-Fvb.js} +1 -1
- package/dist/assets/{Pay-TrEd2MjF.js → Pay-Bx63WAFT.js} +1 -1
- package/dist/assets/{Player-BXImnRV7.js → Player-BGNjRu9P.js} +1 -1
- package/dist/assets/{Poivelle-B81t7re-.js → Poivelle-PhmV-fHe.js} +1 -1
- package/dist/assets/{PromptTextarea-slaeK0Wc.js → PromptTextarea-D2e6r_v-.js} +1 -1
- package/dist/assets/{RealtimeCall-B30hdTUz.js → RealtimeCall-Cc74xRwy.js} +1 -1
- package/dist/assets/ScheduledTasks-DXDFqtgP.css +1 -0
- package/dist/assets/ScheduledTasks-DenzNFCn.js +2 -0
- package/dist/assets/{Status-P0K-K3sa.js → Status-D3-S3L0F.js} +1 -1
- package/dist/assets/{Subscribe-CJIC3yAj.js → Subscribe-yQV3Tez9.js} +1 -1
- package/dist/assets/{TabSwitcher-Dqk0M6ce.js → TabSwitcher-PY1w3Dfv.js} +1 -1
- package/dist/assets/Tts-CDqrk1GC.js +1 -0
- package/dist/assets/{VideoPlayer-B8aq6dKu.js → VideoPlayer-BD_yOIBX.js} +1 -1
- package/dist/assets/{alert-BiY3OD0p.js → alert-BF99s01E.js} +1 -1
- package/dist/assets/arrow-down-CV61tTCN.js +1 -0
- package/dist/assets/{arrow-down-wide-narrow-rc0DbaXo.js → arrow-down-wide-narrow-B4Qi5Adf.js} +1 -1
- package/dist/assets/arrow-left-DigbQZpK.js +1 -0
- package/dist/assets/arrow-right-CzBZd8iF.js +1 -0
- package/dist/assets/arrow-up-Dnp6dBru.js +1 -0
- package/dist/assets/avatar-Mf0PYJkp.js +1 -0
- package/dist/assets/{basic-CjP7vRV7.js → basic-BBhi-3uV.js} +1 -1
- package/dist/assets/{box-BQ7-g5pH.js → box-PV6VuxAa.js} +1 -1
- package/dist/assets/{boxes-D0jlaEYy.js → boxes-CeZ9dfc6.js} +1 -1
- package/dist/assets/{brain-SPs9CzlV.js → brain-DLeXAPM6.js} +1 -1
- package/dist/assets/{chart-no-axes-combined-Cr00rIti.js → chart-no-axes-combined-D7gR9a0n.js} +1 -1
- package/dist/assets/{chat-zjUYRJR6.js → chat-B-weBYf6.js} +1 -1
- package/dist/assets/{chat-CfO0IkGR.js → chat-BFdByl9e.js} +1 -1
- package/dist/assets/{chat-UnmIg5OR.js → chat-BJ4g9MxG.js} +1 -1
- package/dist/assets/{chat-Dy_ia2t3.js → chat-BR2lwkqD.js} +1 -1
- package/dist/assets/{chat-BZAD82h7.js → chat-C3WaExAf.js} +1 -1
- package/dist/assets/{chat-CGm4BcSS.js → chat-CAYtAQqd.js} +1 -1
- package/dist/assets/{chat-BVR-USZS.js → chat-CDE2OtVx.js} +1 -1
- package/dist/assets/{chat-X4zY00AA.js → chat-CKaGv6kK.js} +1 -1
- package/dist/assets/{chat-CZxMDQsu.js → chat-CkehNgkV.js} +1 -1
- package/dist/assets/{chat-CyP5PoI4.js → chat-CwCMMOYe.js} +1 -1
- package/dist/assets/{chat-DkSuvbOb.js → chat-CwUzGEJn.js} +1 -1
- package/dist/assets/{chat-Cn_AD1Ed.js → chat-DDdrn2Mu.js} +1 -1
- package/dist/assets/{chat-CtsDqsXX.js → chat-DH63Ggq7.js} +1 -1
- package/dist/assets/{chat-CLaYnk1u.js → chat-DJujihIK.js} +1 -1
- package/dist/assets/{chat-B-h1NSzT.js → chat-DdIa5wd3.js} +1 -1
- package/dist/assets/{chat-Z-VrIgTr.js → chat-DjcMZAYY.js} +1 -1
- package/dist/assets/{chat-DPfxzFLt.js → chat-DtY_XJfI.js} +1 -1
- package/dist/assets/{chat-Bn0KonSB.js → chat-DyrLy9mX.js} +1 -1
- package/dist/assets/{chat-C0N_PIyo.js → chat-II48VVts.js} +1 -1
- package/dist/assets/check-COURkFWC.js +1 -0
- package/dist/assets/chevron-down-DUI2zMyA.js +1 -0
- package/dist/assets/chevron-right-DYMW3Qtt.js +1 -0
- package/dist/assets/circle-check-UGjLx4jm.js +1 -0
- package/dist/assets/clock-CzhmPsDw.js +1 -0
- package/dist/assets/{codingBridge-nf6Uscbm.js → codingBridge-CcvPftPQ.js} +2 -2
- package/dist/assets/{codingBridgeNotify-jdc9sha6.js → codingBridgeNotify-DE9EErMs.js} +2 -2
- package/dist/assets/{coins-CndR9V6r.js → coins-DIeu_Y_b.js} +1 -1
- package/dist/assets/{collapse-CTgn6Ihn.js → collapse-iEs5D1KO.js} +1 -1
- package/dist/assets/{constants-BnLsIjUW.js → constants-mcSzdyE5.js} +1 -1
- package/dist/assets/{copy-Dxj0t_Ws.js → copy-O-D82DON.js} +1 -1
- package/dist/assets/{createTaskActions-qZJXmEQl.js → createTaskActions-9IgZ-8m9.js} +1 -1
- package/dist/assets/{digitalhuman-Dwo6EMGw.js → digitalhuman-BS8HtsmF.js} +1 -1
- package/dist/assets/{dollar-sign-Bq_dqxff.js → dollar-sign-DQoerf1b.js} +1 -1
- package/dist/assets/{download-BN3yYMcY.js → download-BkNMppQo.js} +1 -1
- package/dist/assets/{drawer-ia4Su9NX.js → drawer-CxEfdDZv.js} +1 -1
- package/dist/assets/{dropdown-CMgFoiX_.js → dropdown-Ba1cLAfo.js} +1 -1
- package/dist/assets/{dropdown-CSAnEtNs.js → dropdown-DcbQaYun.js} +1 -1
- package/dist/assets/{ellipsis-B5o1nrUH.js → ellipsis-D68UeJHk.js} +1 -1
- package/dist/assets/{esm-fE5Np9Rd.js → esm-C8m8pjQb.js} +2 -2
- package/dist/assets/{esm-DlIxvule.js → esm-CeywmRrV.js} +1 -1
- package/dist/assets/{esm-eMwMIM0P.js → esm-D77omMPl.js} +2 -2
- package/dist/assets/esm-DO9UuFlh.js +1 -0
- package/dist/assets/{esm-C8_mz22l.js → esm-DUglswKu.js} +3 -3
- package/dist/assets/{esm-jpVFtTj3.js → esm-DsA4Damb.js} +1 -1
- package/dist/assets/{esm-CIwweLbX.js → esm-HoKZxrWF.js} +1 -1
- package/dist/assets/{external-link-MjGZt5Hc.js → external-link-DCVpgjAt.js} +1 -1
- package/dist/assets/{eye-SSWNou9D.js → eye-C5OpzthI.js} +1 -1
- package/dist/assets/{file-output-BOGs_BUc.js → file-output-hd8zT3ma.js} +1 -1
- package/dist/assets/{file-text-BW4TsEub.js → file-text-B7xk2lmK.js} +1 -1
- package/dist/assets/fish-DGMc5euF.js +1 -0
- package/dist/assets/{flux-DMS_eg6a.js → flux-DAwVm2O1.js} +1 -1
- package/dist/assets/{folder-BH1Ywi1a.js → folder-DWBfFswg.js} +1 -1
- package/dist/assets/gauge-Cq6lJMNb.js +1 -0
- package/dist/assets/{globe-BdVzn8qp.js → globe-0k5-wna3.js} +1 -1
- package/dist/assets/{grokvideo-Bi65gP6s.js → grokvideo-DCJo4oV8.js} +1 -1
- package/dist/assets/{pika-R8PlSot3.js → hailuo-v7SZQWUp.js} +1 -1
- package/dist/assets/{headphones-B0R5qMlo.js → headphones-GGteqWG2.js} +1 -1
- package/dist/assets/{history-DQT16yI0.js → history-DXW5R3sK.js} +1 -1
- package/dist/assets/{house-CkHqy124.js → house-Csci3bfs.js} +1 -1
- package/dist/assets/{i18n-QtILy3Ue.js → i18n-Dxpy-4Gk.js} +1 -1
- package/dist/assets/{image-BGXwtQYd.js → image-BO5XpnLh.js} +1 -1
- package/dist/assets/{index-BtNM5W1k.js → index-BSsxAJiU.js} +16 -16
- package/dist/assets/{index.browser.esm-BqbYMh3H.js → index.browser.esm-Cpd1Ik9j.js} +1 -1
- package/dist/assets/{index.es-CzuQCMKg.js → index.es-C-drxDQ6.js} +1 -1
- package/dist/assets/{info-CXWcObeg.js → info-BbNN_iNp.js} +1 -1
- package/dist/assets/{input-number-g06X3iNk.js → input-number-BIzn8YxY.js} +1 -1
- package/dist/assets/{key-round-BddZHlC3.js → key-round-Ymc5S4YH.js} +1 -1
- package/dist/assets/{kling-8pg4r7wg.js → kling-RT3zRuAA.js} +1 -1
- package/dist/assets/{languages-Bsa3sg-k.js → languages-UUZfC8iI.js} +1 -1
- package/dist/assets/{laptop-CEbmOX4O.js → laptop-DB9u86WQ.js} +1 -1
- package/dist/assets/{lightbulb-BMPw9KgR.js → lightbulb-4eHB4rud.js} +1 -1
- package/dist/assets/{link-TfquuvKc.js → link-itM6IuDf.js} +1 -1
- package/dist/assets/loader-circle-BiALhFz6.js +1 -0
- package/dist/assets/{qrart-D1r1Sl2M.js → luma-CrjkX7Hw.js} +1 -1
- package/dist/assets/{maestro-BGe8OQt1.js → maestro-BA_3MAbN.js} +1 -1
- package/dist/assets/{maestro-Cgf6Eb9a.js → maestro-XICLKX3k.js} +1 -1
- package/dist/assets/{mail-BkZbD9ea.js → mail-CF65BdQo.js} +1 -1
- package/dist/assets/{message-circle-JHwOHaqK.js → message-circle-7JoqCQl9.js} +1 -1
- package/dist/assets/{mic-Jj6UjtSQ.js → mic-BNE2YPs0.js} +1 -1
- package/dist/assets/{midjourney-BwEBsGPB.js → midjourney-CwXnM_Ba.js} +1 -1
- package/dist/assets/{mobileLocalExec-B-HYX9Pr.js → mobileLocalExec-B_WuqFqJ.js} +2 -2
- package/dist/assets/{mouse-pointer-2-DGJ3ydu-.js → mouse-pointer-2-C16rZmFa.js} +1 -1
- package/dist/assets/music-2-BJ-EGt9W.js +1 -0
- package/dist/assets/{nanobanana-BF2Jf99H.js → nanobanana-TQbItWZq.js} +1 -1
- package/dist/assets/{omni-DS1i2fuy.js → omni-CZoxeCQv.js} +1 -1
- package/dist/assets/{openaiimage-DdAKj6Z2.js → openaiimage-DN8O2j4H.js} +1 -1
- package/dist/assets/{pagination-B_zJatJQ.js → pagination-C7ZiwK9V.js} +1 -1
- package/dist/assets/{pagination-C6rVvcPs.js → pagination-CmdHn0iE.js} +2 -2
- package/dist/assets/{palette-DuMApK7s.js → palette-D_ekEajC.js} +1 -1
- package/dist/assets/{paperclip-siQb3iCT.js → paperclip-CRuC8rU8.js} +1 -1
- package/dist/assets/{pause-Uyj7qw_l.js → pause-QkMww5Yu.js} +1 -1
- package/dist/assets/{pencil-CurbnOzl.js → pencil-BU7xYmyS.js} +1 -1
- package/dist/assets/{sora-BUkrHk81.js → pika-CtYHYKQv.js} +1 -1
- package/dist/assets/{hailuo-Da2Gy7fR.js → pixverse-Cwa0FAUh.js} +1 -1
- package/dist/assets/play-DIlhF-U7.js +1 -0
- package/dist/assets/plus-BHch40Qf.js +1 -0
- package/dist/assets/{poivelle-Bah369AQ.js → poivelle-CD3siK8E.js} +1 -1
- package/dist/assets/{popover-CIhBv737.js → popover-C-S-6113.js} +1 -1
- package/dist/assets/{producer-549zKcDs.js → producer-DTntSYt_.js} +1 -1
- package/dist/assets/{luma-QXkucEy9.js → qrart-tgkHPkTy.js} +1 -1
- package/dist/assets/{realtime-DvN8MBYe.js → realtime-B8NRpJys.js} +1 -1
- package/dist/assets/{refresh-cw-ugTK1BC5.js → refresh-cw-CArr1mZy.js} +1 -1
- package/dist/assets/rotate-ccw-DuFbaMDC.js +1 -0
- package/dist/assets/rotate-cw-zPMS1h-y.js +1 -0
- package/dist/assets/{row-Dx_iV9xr.js → row-DHgAi9wF.js} +1 -1
- package/dist/assets/search-D7232wHh.js +1 -0
- package/dist/assets/{seedance-DxObGaFn.js → seedance-9yH_u2I_.js} +1 -1
- package/dist/assets/{seedream-Bnw5dxoU.js → seedream-zjd8Ovl-.js} +1 -1
- package/dist/assets/{select-na7s3bgQ.js → select-D-bIB0WH.js} +1 -1
- package/dist/assets/{serp-BxpLEGIy.js → serp-CqacvGAj.js} +1 -1
- package/dist/assets/{shield-CiGU20-4.js → shield-BME0TS8Z.js} +1 -1
- package/dist/assets/{shuffle-CPCMs7ef.js → shuffle-CKGNSLh1.js} +1 -1
- package/dist/assets/{slider-BzQ35Y6N.js → slider-ClwEi7Gh.js} +1 -1
- package/dist/assets/{sliders-horizontal-DIi7Ojxb.js → sliders-horizontal-DO-HEuEi.js} +1 -1
- package/dist/assets/{solana-wallets-FpxMFZId.js → solana-wallets-B8i1SLSd.js} +2 -2
- package/dist/assets/{solana-wallets-vue-BiGaqbvu.js → solana-wallets-vue-CpEvzr-_.js} +1 -1
- package/dist/assets/sora-1ekxnk7T.js +1 -0
- package/dist/assets/{sparkles-j8ZezNam.js → sparkles-D2OqJVjA.js} +1 -1
- package/dist/assets/square-CIpNtFKm.js +1 -0
- package/dist/assets/{suno-C2I0GK72.js → suno-BVNIN49v.js} +1 -1
- package/dist/assets/{switch-CAwqW-xW.js → switch-CYC0EnuT.js} +1 -1
- package/dist/assets/{table-DGa4FsY2.js → table-DoTtrLSL.js} +1 -1
- package/dist/assets/{tabs-C206DNmb.js → tabs-puj4wsas.js} +1 -1
- package/dist/assets/{tag-BB8eqZ-n.js → tag-Ct5EeqE7.js} +1 -1
- package/dist/assets/{taskDrawerMixin-C6xS_bci.js → taskDrawerMixin-CqMO2njP.js} +1 -1
- package/dist/assets/terminal-CG8cO3b_.js +1 -0
- package/dist/assets/{time-picker-BFtDI-NK.js → time-picker-TU7MUwlD.js} +1 -1
- package/dist/assets/{tooltip-PudHVhJv.js → tooltip-R5atdiIg.js} +1 -1
- package/dist/assets/{trash-2-Cz9KBrOE.js → trash-2-D9U95ZhU.js} +1 -1
- package/dist/assets/{triangle-alert-Dm3AU2Pk.js → triangle-alert-B8AJf438.js} +1 -1
- package/dist/assets/{upload-C-DZTzCm.js → upload-BFid7bP9.js} +1 -1
- package/dist/assets/{upload-BDgHWid0.js → upload-DmyuWAhM.js} +1 -1
- package/dist/assets/user-AwS4_8FM.js +1 -0
- package/dist/assets/{veo-iy2_A-nG.js → veo-CQbKB6K8.js} +1 -1
- package/dist/assets/{video-BiedsplO.js → video-Cvt5KMN1.js} +1 -1
- package/dist/assets/{volume-2-C1Z8oCxa.js → volume-2-CR6YHe7Z.js} +1 -1
- package/dist/assets/{wallet-3AK1cycc.js → wallet-DhMRxf4G.js} +1 -1
- package/dist/assets/{wan-7o3MGuRh.js → wan-BQPFLBBk.js} +1 -1
- package/dist/assets/{wand-sparkles-PR0DrnUh.js → wand-sparkles-J1dql9CA.js} +1 -1
- package/dist/assets/{web-D1KimMnN.js → web-BA-6H_74.js} +1 -1
- package/dist/assets/{web-ecg_f19V.js → web-BkCd1rRQ.js} +1 -1
- package/dist/assets/{web-C1_k7v7P.js → web-CusdJfOW.js} +1 -1
- package/dist/assets/{web-CoOUBSbh.js → web-DvVttK_T.js} +1 -1
- package/dist/assets/{web-CponquS9.js → web-DyD8eAXO.js} +1 -1
- package/dist/assets/{webextrator-DfW88e4x.js → webextrator-XkAoTHK8.js} +1 -1
- package/dist/assets/{zap-DzPWJlz0.js → zap-BptOZrqP.js} +1 -1
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/dist/assets/Conversation-C6AfJWGs.js +0 -1
- package/dist/assets/Detail-DVjhvMQb.js +0 -2
- package/dist/assets/Extra-CIDqzau_.js +0 -1
- package/dist/assets/Index-DS9DvWKp.js +0 -1
- package/dist/assets/Index-DdAJi_FC.js +0 -1
- package/dist/assets/List-B0yYOQF3.js +0 -1
- package/dist/assets/List-Dc3u9_nF.js +0 -1
- package/dist/assets/LocalTools-Cb_xAl5E.js +0 -5
- package/dist/assets/Message-sb5Soag3.js +0 -3
- package/dist/assets/ScheduledTasks-C228LZCp.js +0 -2
- package/dist/assets/ScheduledTasks-DLxiGSiq.css +0 -1
- package/dist/assets/Tts-BqnaHILF.js +0 -1
- package/dist/assets/arrow-down-CB-fuXIe.js +0 -1
- package/dist/assets/arrow-left-B5kQWUvN.js +0 -1
- package/dist/assets/arrow-right-FS1nN7uI.js +0 -1
- package/dist/assets/arrow-up-Bncedf94.js +0 -1
- package/dist/assets/avatar-B7Sg_BXu.js +0 -1
- package/dist/assets/check-CtBkgelb.js +0 -1
- package/dist/assets/chevron-down-CUOysLkQ.js +0 -1
- package/dist/assets/chevron-right-BmqV9saW.js +0 -1
- package/dist/assets/circle-check-Cv27UPw3.js +0 -1
- package/dist/assets/clock-BkUz3x1Q.js +0 -1
- package/dist/assets/esm-Csspc1Kf.js +0 -1
- package/dist/assets/fish-Cr7s4bxM.js +0 -1
- package/dist/assets/gauge-Cc_BhTTN.js +0 -1
- package/dist/assets/loader-circle-BiHunPwf.js +0 -1
- package/dist/assets/music-2-g9-CZVl2.js +0 -1
- package/dist/assets/pixverse-CsuvrPFM.js +0 -1
- package/dist/assets/play-CmMPlLIm.js +0 -1
- package/dist/assets/plus-Dpr8tTBL.js +0 -1
- package/dist/assets/rotate-ccw-ClQxvlRB.js +0 -1
- package/dist/assets/rotate-cw-COjaKq2D.js +0 -1
- package/dist/assets/search-DkB3Qh3s.js +0 -1
- package/dist/assets/square-Bx6DV4M_.js +0 -1
- package/dist/assets/terminal-BrlcLpm1.js +0 -1
- package/dist/assets/user-CVGGdNbS.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-na7s3bgQ.js";import{n as x,t as S}from"./tabs-C206DNmb.js";import{t as C}from"./upload-BDgHWid0.js";import{t as w}from"./tooltip-PudHVhJv.js";import{t as T}from"./alert-BiY3OD0p.js";import{n as E,r as D}from"./radio-DgDgyT2l.js";import{t as O}from"./drawer-ia4Su9NX.js";import{t as k}from"./input-number-g06X3iNk.js";import{t as A}from"./slider-BzQ35Y6N.js";import{t as j}from"./switch-CAwqW-xW.js";import{n as M}from"./taskDrawerMixin-C6xS_bci.js";import{t as ee}from"./clock-BkUz3x1Q.js";import{r as te,t as ne}from"./PromptTextarea-slaeK0Wc.js";import{t as re}from"./headphones-B0R5qMlo.js";import{t as ie}from"./info-CXWcObeg.js";import{t as ae}from"./lightbulb-BMPw9KgR.js";import{t as oe}from"./triangle-alert-Dm3AU2Pk.js";import{t as N}from"./upload-C-DZTzCm.js";import{t as P}from"./wand-sparkles-PR0DrnUh.js";import{ai as se,ci as ce,li as le,ui as F}from"./constants-BnLsIjUW.js";import{Ai as ue,Bt as de,E as I,Gt as L,Ht as fe,Mi as R,Un as z,Ut as B,Vi as V,Vt as H,_i as pe,ai as U,en as W,gr as G,hi as me,ni as he,vi as K}from"./index-BtNM5W1k.js";import{t as ge}from"./CopyToClipboard-CMRvafZB.js";import{t as _e}from"./FilePreview-BoqdQ-sh.js";import{t as q}from"./ImagePreview-CK8FEzsq.js";import{t as J}from"./Consumption-DRd8XlSO.js";import{a as Y,n as ve,r as ye,t as be}from"./pagination-C6rVvcPs.js";import{t as xe}from"./VideoPlayer-B8aq6dKu.js";import{t as Se}from"./ApiCodeButton-DGSP7Ahw.js";import{t as Ce}from"./BotPlaceholder-dvhs1bQC.js";import{n as we,t as Te}from"./AudioPreview-BSZ6q1Re.js";var Ee=v({name:`LayoutKling`,components:{MagicIcon:P,ElDrawer:O,ElButton:R},mixins:[M]}),De={class:`main flex flex-row flex-1 min-h-0`},Oe={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ke={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Ae(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,De,[e(`div`,Oe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ke,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var je=I(Ee,[[`render`,Ae],[`__scopeId`,`data-v-2d826924`]]),Me={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};function X(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,referenceVideo:!1,referenceImages:!1};case`kling-v1-6`:case`kling-v2-5-turbo`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v2-6`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:r===`pro`,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v2-master`:case`kling-v2-1-master`:return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v3`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:r!==`4k`,referenceVideo:!1,referenceImages:!1};case`kling-v3-omni`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1,referenceVideo:!0,referenceImages:!0};case`kling-o1`:return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1,referenceVideo:!0,referenceImages:!0};default:return Me}}var Z=`<<<video_1>>>`,Ne=/<<<image_\d+>>>/g;function Pe(e){return e?e.split(Z).join(` `).replace(/\s{2,}/g,` `).trim():``}function Fe(e){return e?e.replace(Ne,` `).replace(/\s{2,}/g,` `).trim():``}function Q(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=X(n,r,i),o=[];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`}),e.video_list?.length&&!a.referenceVideo&&o.push({field:`video_list`,i18nLabel:`kling.name.referenceVideo`}),e.image_list?.length&&!a.referenceImages&&o.push({field:`image_list`,i18nLabel:`kling.name.referenceImages`});let s=n===`kling-o1`||!!(e.image_list?.length||e.video_list?.length);return s&&e.cfg_scale!==void 0&&o.push({field:`cfg_scale`,i18nLabel:`kling.name.cfgScale`}),s&&e.negative_prompt&&o.push({field:`negative_prompt`,i18nLabel:`kling.name.negativePrompt`}),o}function Ie(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),e.field===`cfg_scale`&&(n.cfg_scale=void 0),e.field===`negative_prompt`&&(n.negative_prompt=void 0),e.field===`video_list`&&(n.video_list=void 0,n.prompt=Pe(n.prompt)),e.field===`image_list`&&(n.image_list=void 0,n.prompt=Fe(n.prompt));return n}var Le=v({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},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-o1`,label:`Kling O1`}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(se)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=Q(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await pe.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=Ie({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),K.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})}}}),Re={class:`field`},ze={class:`title font-bold`};function Be(t,n,r,a,o,u){let d=l(`el-option`),m=l(`el-select`);return g(),s(`div`,Re,[e(`h2`,ze,i(t.$t(`pika.name.model`)),1),(g(),f(m,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`pika.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(d,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Ve=I(Le,[[`render`,Be],[`__scopeId`,`data-v-a74e7f31`]]),He=v({name:`ModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Y},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 F.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=Q(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await pe.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=Ie({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),K.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})}}}),Ue={class:`field`},We={class:`header`},Ge={class:`title font-bold`},Ke={key:0,class:`opt-tip`};function qe(t,r,u,d,m,_){let v=l(`info-icon`),y=l(`el-option`),b=l(`el-select`);return g(),s(`div`,Ue,[e(`div`,We,[e(`h2`,Ge,i(t.$t(`kling.name.mode`)),1),a(v,{content:t.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(g(),f(b,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`kling.placeholder.select`),clearable:!0,onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(y,{key:t.value,label:t.label,value:t.value,disabled:t.disabled},{default:p(()=>[e(`span`,{class:n({"opt-disabled":t.disabled})},i(t.label),3),t.disabled&&t.disabledReason?(g(),s(`span`,Ke,i(t.disabledReason),1)):o(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Je=I(He,[[`render`,qe],[`__scopeId`,`data-v-9a8fa3c5`]]),Ye=[3,5,8,10,12,15],Xe=[5,10],Ze=[5],Qe=v({name:`DurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Y},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return F.includes(this.selectedModel)},allowedDurations(){return this.selectedModel===`kling-o1`?Ze:this.isV3Model?Ye:Xe},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:{selectedModel(){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=Q(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await pe.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=Ie({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),K.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})}}}),$e={class:`field`},et={class:`control`},tt={class:`label`},nt={class:`title font-bold`};function rt(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,$e,[e(`div`,et,[e(`div`,tt,[e(`h2`,nt,i(t.$t(`kling.name.duration`)),1),a(m,{content:t.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(g(),f(v,{key:t.revertKey,"model-value":t.selectValue,class:`value`,placeholder:t.$t(`kling.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.allowedDurations,e=>(g(),f(_,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var it=I(Qe,[[`render`,rt],[`__scopeId`,`data-v-496bf31c`]]),at=v({name:`RatioSelector`,data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug(`set ratio`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||=`1:1`}}),ot={class:`text-sm font-bold mb-2 block`},st={class:`items`},ct=[`onClick`],lt={class:`name`};function ut(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,ot,i(t.$t(`kling.name.ratio`)),1),e(`div`,st,[(g(!0),s(c,null,h(t.options,(r,a)=>(g(),s(`div`,{key:a,class:n({active:t.active===a,item:!0}),onClick:e=>t.value=r.value},[e(`div`,{class:n([`preview`,r.label])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,lt,i(r.label),1)],10,ct))),128))])])}var dt=I(at,[[`render`,ut],[`__scopeId`,`data-v-cdb14b2f`]]),ft=v({name:`StartImage`,components:{UploadIcon:N,ElUpload:C,ElButton:R,ElTooltip:w,InfoIcon:Y,ImagePreview:q},mixins:[B,H],emits:[`change`],data(){return{fileList:[],uploadUrl:U()+`/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(){}}},watch:{value(e){!e&&this.fileList.length>0&&(this.fileList=[])}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){K.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){K.error(this.$t(`kling.message.uploadReferencesError`))},onBeforeUpload(){let e=this.$store.state.kling?.config||{};if(e.video_list?.[0]?.refer_type===`base`)return K.warning(this.$t(`kling.message.baseVideoFrameConflict`)),!1;let t=e.video_list?.length?4:7;return(e.image_list?.length||0)+Number(!!e.end_image_url)+1>t?(K.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:t})),!1):!0},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.onSetStartImageUrl()}}}),pt={class:`relative`},mt={class:`flex min-h-8 items-center pr-20`},ht={class:`flex justify-start items-center`},gt={class:`text-sm font-bold`};function _t(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`el-upload`);return g(),s(`div`,pt,[e(`div`,mt,[e(`div`,ht,[e(`span`,gt,i(t.$t(`kling.name.startImage`)),1),a(h,{content:t.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:t.reachedLimit,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"before-upload":t.onBeforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(b,{content:t.$t(`kling.message.uploadReferencesExceed`),disabled:!t.reachedLimit,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.reachedLimit},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var vt=I(ft,[[`render`,_t],[`__scopeId`,`data-v-0220ed34`]]),yt=v({name:`EndImage`,components:{UploadIcon:N,ElUpload:C,ElButton:R,ElTooltip:w,ImagePreview:q,InfoIcon:Y},mixins:[B,H],data(){return{fileList:[],uploadUrl:U()+`/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 X(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(){if(!this.endImageSupported)return K.warning(this.$t(`kling.message.endImageNotSupported`)),!1;if(!this.hasStartImage)return K.warning(this.$t(`kling.message.endImageRequiresStart`)),!1;if(this.klingConfig.video_list?.[0]?.refer_type===`base`)return K.warning(this.$t(`kling.message.baseVideoFrameConflict`)),!1;let e=this.klingConfig.video_list?.length?4:7;return(this.klingConfig.image_list?.length||0)+2>e?(K.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:e})),!1):!0},onExceed(){K.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){K.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()},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.onSetEndImageUrl()}}}),bt={class:`relative`},xt={class:`flex min-h-8 items-center pr-20`},St={class:`flex justify-start items-center`},Ct={class:`text-sm font-bold`};function wt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`el-upload`);return g(),s(`div`,bt,[e(`div`,xt,[e(`div`,St,[e(`span`,Ct,i(t.$t(`kling.name.endImage`)),1),a(h,{content:t.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:t.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"before-upload":t.onBeforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(b,{content:t.uploadTooltip,disabled:!t.uploadDisabled,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.uploadDisabled},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Tt=I(yt,[[`render`,wt],[`__scopeId`,`data-v-b2eaa919`]]),Et=v({name:`ReferenceVideo`,components:{ElUpload:C,ElButton:R,ElRadioButton:E,ElRadioGroup:D,ElSwitch:j,InfoIcon:Y,FilePreview:_e,UploadIcon:N},mixins:[H],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},config(){return this.$store.state.kling?.config||{}},hasVideo(){return!!this.urls?.[0]},referenceType:{get(){return this.config.video_list?.[0]?.refer_type||`feature`},set(e){this.updateVideoOptions(e,this.keepOriginalSound)}},keepOriginalSound:{get(){return this.config.video_list?.[0]?.keep_original_sound===`yes`},set(e){this.updateVideoOptions(this.referenceType,e)}}},methods:{onExceed(){K.warning(this.$t(`kling.message.referenceVideoExceed`))},onError(){K.error(this.$t(`kling.message.referenceVideoError`))},beforeUpload(e){if((this.config.image_list?.length||0)+Number(!!this.config.start_image_url)+Number(!!this.config.end_image_url)>4)return K.error(this.$t(`kling.message.referenceVideoImageLimit`)),!1;let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<200;return t?n?!0:(K.error(this.$t(`kling.message.referenceVideoSizeExceed`)),!1):(K.error(this.$t(`kling.message.referenceVideoTypeFailed`)),!1)},ensurePromptToken(e){let t=this.$store.state.kling?.config,n=t?.prompt||``,r=n.includes(Z),i;if(e&&!r)i=n?`${n} ${Z}`:Z;else if(!e&&r)i=Pe(n);else return;this.$store.commit(`kling/setConfig`,{...t,prompt:i})},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,video_list:void 0}),this.ensurePromptToken(!1)},onSetVideoList(){let e=this.urls?.[0],t=e?[{video_url:e,refer_type:this.referenceType,keep_original_sound:this.keepOriginalSound?`yes`:`no`}]:void 0;this.$store.commit(`kling/setConfig`,{...this.config,video_list:t,generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0}),this.ensurePromptToken(!!e)},updateVideoOptions(e,t){let n=this.urls?.[0];n&&this.$store.commit(`kling/setConfig`,{...this.config,video_list:[{video_url:n,refer_type:e,keep_original_sound:t?`yes`:`no`}],...e===`base`?{start_image_url:void 0,end_image_url:void 0}:{},generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0})},async onSuccess(){this.onSetVideoList()}}}),Dt={class:`relative`},Ot={class:`flex min-h-8 items-center pr-20`},kt={class:`flex justify-start items-center`},At={class:`text-sm font-bold`},jt={key:0,class:`reference-options mt-3 flex flex-col gap-3`},Mt={class:`flex flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`},Nt={class:`text-sm`},Pt={class:`flex items-center justify-between gap-3`},Ft={class:`text-sm`};function It(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`el-radio-button`),S=l(`el-radio-group`),C=l(`el-switch`);return g(),s(`div`,Dt,[e(`div`,Ot,[e(`div`,kt,[e(`span`,At,i(t.$t(`kling.name.referenceVideo`)),1),a(h,{content:t.$t(`kling.description.omniReferenceVideo`)},null,8,[`content`])])]),a(b,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage===void 0?o(``,!0):(g(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferenceVideo`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`]),t.hasVideo?(g(),s(`div`,jt,[e(`div`,Mt,[e(`span`,Nt,i(t.$t(`kling.name.referenceVideoType`)),1),a(S,{modelValue:t.referenceType,"onUpdate:modelValue":n[1]||=e=>t.referenceType=e,size:`small`},{default:p(()=>[a(x,{value:`feature`},{default:p(()=>[r(i(t.$t(`kling.name.referenceVideoFeature`)),1)]),_:1}),a(x,{value:`base`},{default:p(()=>[r(i(t.$t(`kling.name.referenceVideoBase`)),1)]),_:1})]),_:1},8,[`modelValue`])]),e(`div`,Pt,[e(`span`,Ft,i(t.$t(`kling.name.keepOriginalSound`)),1),a(C,{modelValue:t.keepOriginalSound,"onUpdate:modelValue":n[2]||=e=>t.keepOriginalSound=e},null,8,[`modelValue`])])])):o(``,!0)])}var Lt=I(Et,[[`render`,It],[`__scopeId`,`data-v-7bb04cb4`]]),Rt=v({name:`KlingReferenceImages`,components:{ElButton:R,ElUpload:C,UploadIcon:N,ImagePreview:q,InfoIcon:Y},mixins:[B,H],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{config(){return this.$store.state.kling?.config||{}},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},frameCount(){return Number(!!this.config.start_image_url)+Number(!!this.config.end_image_url)},maxImages(){return this.config.video_list?.length?4:7},referenceLimit(){return Math.max(0,this.maxImages-this.frameCount)},remainingSlots(){return Math.max(0,this.referenceLimit-this.urls.length)},urls(){return this.fileList.map(e=>e.response?.file_url||e.url).filter(Boolean)},storeImages(){return this.config.image_list}},watch:{frameCount(){this.syncPromptTokens()},storeImages(e){!e?.length&&this.fileList.length>0&&(this.fileList=[])}},methods:{beforeUpload(){return this.remainingSlots===0?(this.onExceed(),!1):!0},onExceed(){K.warning(this.$t(`kling.message.referenceImagesExceed`,{count:this.remainingSlots}))},onError(){K.error(this.$t(`kling.message.referenceImagesError`))},clearOmniConflicts(e){return{...e,generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0}},syncPromptTokens(e){let t=e||this.config,n=[Fe(t.prompt),...this.urls.map((e,t)=>`<<<image_${this.frameCount+t+1}>>>`)].filter(Boolean).join(` `);n!==t.prompt&&this.$store.commit(`kling/setConfig`,{...t,prompt:n})},syncConfig(){let e=this.urls.length?this.urls.map(e=>({image_url:e})):void 0,t=this.clearOmniConflicts({...this.config,image_list:e});this.$store.commit(`kling/setConfig`,t),this.syncPromptTokens(t)},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.syncConfig()},onRemove(e,t){this.fileList.splice(e,1),t.url?.startsWith(`blob:`)&&URL.revokeObjectURL(t.url),this.syncConfig()}}}),zt={class:`relative`},Bt={class:`flex justify-between items-center`},Vt={class:`flex justify-start items-center`},Ht={class:`text-sm font-bold`},Ut={key:0,class:`file-list flex flex-wrap gap-2 mt-2`};function Wt(t,n,u,d,m,_){let v=l(`info-icon`),y=l(`UploadIcon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return g(),s(`div`,zt,[e(`div`,Bt,[e(`div`,Vt,[e(`span`,Ht,i(t.$t(`kling.name.referenceImages`)),1),a(v,{content:t.$t(`kling.description.referenceImages`)},null,8,[`content`])]),a(x,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg`,name:`file`,limit:t.referenceLimit,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[a(b,{round:``,type:`primary`,size:`small`,disabled:t.remainingSlots===0},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferenceImages`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`file-list`,`limit`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.fileList.length?(g(),s(`div`,Ut,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(S,{key:e.uid||e.url||n,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemove(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])):o(``,!0)])}var Gt=I(Rt,[[`render`,Wt]]),Kt=v({name:`CfgScaleSelector`,components:{ElSlider:A,InfoIcon:Y,ElInputNumber:k},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}}),qt={class:`flex justify-between`},Jt={class:`flex justify-start items-center`},Yt={class:`text-sm font-bold`},Xt={class:`flex justify-end items-center`},Zt={class:`w-full`};function Qt(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`),p=l(`el-slider`);return g(),s(`div`,null,[e(`div`,qt,[e(`div`,Jt,[e(`span`,Yt,i(t.$t(`kling.name.cfgScale`)),1),a(d,{content:t.$t(`kling.description.cfgScale`)},null,8,[`content`])]),e(`div`,Xt,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,Zt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var $t=I(Kt,[[`render`,Qt]]),en=v({name:`GenerateAudioSelector`,components:{ElSwitch:j,InfoIcon:Y},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(F.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})}}}),tn={class:`relative`},nn={class:`flex justify-between items-center`},rn={class:`flex justify-start items-center`},an={class:`text-sm font-bold`};function on(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,tn,[e(`div`,nn,[e(`div`,rn,[e(`span`,an,i(t.$t(`kling.name.generateAudio`)),1),a(d,{content:t.tooltipContent},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,disabled:!t.supported},null,8,[`modelValue`,`disabled`])])])}var sn=I(en,[[`render`,on]]),cn=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],ln=v({name:`CameraControlSelector`,components:{ElSelect:y,ElOption:b,ElSlider:A,ElInputNumber:k,InfoIcon:Y},data(){return{configKeys:cn}},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 X(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)}}}),un={class:`field`},dn={class:`header`},fn={class:`text-sm font-bold`},pn={key:0,class:`config-grid`},mn={class:`cfg-row-head`},hn={class:`cfg-name`};function gn(t,n,r,u,d,m){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`),b=l(`el-input-number`),x=l(`el-slider`);return g(),s(`div`,un,[e(`div`,dn,[e(`span`,fn,i(t.$t(`kling.name.cameraControl`)),1),a(_,{content:t.tooltipContent},null,8,[`content`])]),a(y,{modelValue:t.selectedTypeRaw,"onUpdate:modelValue":n[0]||=e=>t.selectedTypeRaw=e,class:`value`,placeholder:t.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:t.disabled},{default:p(()=>[(g(!0),s(c,null,h(t.typeOptions,e=>(g(),f(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),t.selectedType===`simple`&&!t.disabled?(g(),s(`div`,pn,[(g(!0),s(c,null,h(t.configKeys,n=>(g(),s(`div`,{key:n,class:`cfg-row`},[e(`div`,mn,[e(`span`,hn,i(t.$t(`kling.name.cc_${n}`)),1),a(b,{modelValue:t.configValues[n],"onUpdate:modelValue":e=>t.configValues[n]=e,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:e=>t.onNumberChange(n,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),a(x,{"model-value":t.configValues[n]??0,min:-1,max:1,step:.1,onInput:e=>t.onSliderChange(n,e)},null,8,[`model-value`,`onInput`])]))),128))])):o(``,!0)])}var _n=I(ln,[[`render`,gn],[`__scopeId`,`data-v-cd896060`]]),vn=[{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`]}],$=`, `;function yn(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${$}${t}`:t}function bn(e,t){if(!e||!t)return e||``;let n=[`${t}${$}`,`${$}${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 xn=v({name:`InspirationPills`,components:{CloseIcon:me},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return vn.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=bn(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),Sn={key:0,class:`pills`,role:`list`},Cn={class:`pill-text`},wn=[`aria-label`,`title`,`onClick`];function Tn(n,r,u,d,f,p){let m=l(`close-icon`);return n.selected.length>0?(g(),s(`div`,Sn,[(g(!0),s(c,null,h(n.selected,r=>(g(),s(`div`,{key:r,class:`pill`,role:`listitem`},[e(`span`,Cn,i(r),1),e(`button`,{type:`button`,class:`pill-remove`,"aria-label":n.$t(`kling.inspiration.removeChip`),title:n.$t(`kling.inspiration.removeChip`),onClick:t(e=>n.onRemove(r),[`stop`])},[a(m,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,wn)]))),128))])):o(``,!0)}var En=v({name:`PromptInput`,components:{IdeaIcon:ae,ElButton:R,PromptTextarea:ne,InspirationPills:I(xn,[[`render`,Tn],[`__scopeId`,`data-v-6be01bcf`]])},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 Dn(e,t,n,o,s,c){let u=l(`idea-icon`),d=l(`el-button`),m=l(`inspiration-pills`),h=l(`prompt-textarea`);return g(),f(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`kling.name.prompt`),info:e.$t(`kling.description.prompt`),placeholder:e.$t(`kling.placeholder.prompt`)},{actions:p(()=>[a(d,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:p(()=>[a(u,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:p(()=>[a(m)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var On=I(En,[[`render`,Dn],[`__scopeId`,`data-v-5754ae54`]]),kn=v({name:`NegativePromptInput`,components:{ElInput:V,InfoIcon:Y},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||=``}}),An={class:`field`},jn={class:`box`},Mn={class:`title font-bold`};function Nn(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,An,[e(`div`,jn,[e(`h2`,Mn,i(t.$t(`kling.name.negativePrompt`)),1),a(d,{content:t.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var Pn=I(kn,[[`render`,Nn],[`__scopeId`,`data-v-de98cf01`]]),Fn=v({name:`InspirationDrawer`,components:{Close:me,IdeaIcon:ae,ElDrawer:O,ElButton:R},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:vn}},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(bn(this.prompt,e)):this.setPrompt(yn(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=bn(e,t);this.setPrompt(e)}}}),In={class:`drawer-content`},Ln={class:`drawer-header`},Rn={class:`title-row`},zn={class:`title`},Bn={class:`hint`},Vn={key:0,class:`selected-bar`},Hn={class:`selected-text`},Un={class:`groups`},Wn={class:`group-title`},Gn={class:`chip-grid`},Kn=[`onClick`];function qn(t,u,d,m,_,v){let y=l(`idea-icon`),b=l(`close`),x=l(`el-button`),S=l(`el-drawer`);return g(),f(S,{modelValue:t.visible,"onUpdate:modelValue":u[1]||=e=>t.visible=e,direction:`rtl`,"with-header":!1,size:t.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:p(()=>[e(`div`,In,[e(`div`,Ln,[e(`div`,Rn,[a(y,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`span`,zn,i(t.$t(`kling.inspiration.title`)),1)]),a(x,{text:``,class:`close-btn`,"aria-label":t.$t(`common.button.close`),title:t.$t(`common.button.close`),onClick:u[0]||=e=>t.visible=!1},{default:p(()=>[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`])]),e(`div`,Bn,i(t.$t(`kling.inspiration.hint`)),1),t.selectedCount>0?(g(),s(`div`,Vn,[e(`span`,Hn,i(t.$t(`kling.inspiration.selectedSummary`,{count:t.selectedCount})),1),a(x,{text:``,size:`small`,class:`clear-btn`,onClick:t.onClearSelected},{default:p(()=>[r(i(t.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):o(``,!0),e(`div`,Un,[(g(!0),s(c,null,h(t.groups,r=>(g(),s(`div`,{key:r.groupKey,class:`group`},[e(`div`,Wn,i(t.$t(`kling.inspiration.group.${r.groupKey}`)),1),e(`div`,Gn,[(g(!0),s(c,null,h(r.chipKeys,e=>(g(),s(`button`,{key:e,type:`button`,class:n({chip:!0,active:t.isSelected(t.chipText(e))}),onClick:n=>t.onToggle(t.chipText(e))},i(t.chipText(e)),11,Kn))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var Jn=I(Fn,[[`render`,qn],[`__scopeId`,`data-v-8b2e6a5d`]]),Yn={"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-o1":`Kling O1`},Xn={std:`720p`,pro:`1080p`,"4k":`4K`},Zn=v({name:`SummaryChip`,components:{AudioIcon:re},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return Yn[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return Xn[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),Qn={class:`summary-chip`},$n=[`title`],er=[`title`],tr=[`title`],nr=[`title`],rr=[`title`];function ir(t,n,r,c,u,d){let f=l(`audio-icon`);return g(),s(`div`,Qn,[e(`span`,{class:`part`,title:t.$t(`kling.name.model`)},i(t.modelLabel),9,$n),n[0]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.duration`)},i(t.durationLabel),9,er),n[1]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.ratio`)},i(t.aspectRatio||`16:9`),9,tr),n[2]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.mode`)},i(t.modeLabel),9,nr),t.generateAudio?(g(),s(`span`,{key:0,class:`audio`,title:t.$t(`kling.name.generateAudio`)},[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,rr)):o(``,!0)])}var ar=v({name:`ConfigPanel`,components:{MagicIcon:P,ElButton:R,Consumption:J,PromptInput:On,NegativePromptInput:Pn,ModelSelector:Ve,ModeSelector:Je,DurationSelector:it,RatioSelector:dt,StartImage:vt,CfgScaleSelector:$t,GenerateAudioSelector:sn,CameraControlSelector:_n,InspirationDrawer:Jn,SummaryChip:I(Zn,[[`render`,ir],[`__scopeId`,`data-v-c800852a`]]),EndImage:Tt,ReferenceImages:Gt,ReferenceVideo:Lt},emits:[`generate`],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},capabilities(){return X(this.config?.model,this.config?.mode,this.config?.duration)},omniActive(){return this.config?.model===`kling-o1`||!!(this.config?.image_list?.length||this.config?.video_list?.length)},consumption(){return L(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),or={class:`flex flex-col h-full`},sr={class:`flex-1 overflow-y-auto p-5`},cr={class:`flex flex-col items-center justify-center px-5 pb-5`};function lr(t,n,c,u,d,m){let h=l(`prompt-input`),_=l(`model-selector`),v=l(`ratio-selector`),y=l(`reference-images`),b=l(`reference-video`),x=l(`start-image`),S=l(`end-image`),C=l(`duration-selector`),w=l(`mode-selector`),T=l(`generate-audio-selector`),E=l(`camera-control-selector`),D=l(`cfg-scale-selector`),O=l(`negative-prompt-input`),k=l(`summary-chip`),A=l(`consumption`),j=l(`magic-icon`),M=l(`el-button`),ee=l(`inspiration-drawer`);return g(),s(`div`,or,[e(`div`,sr,[a(h,{class:`mb-4`,onOpenInspiration:n[0]||=e=>t.inspirationOpen=!0}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),t.capabilities.referenceImages?(g(),f(y,{key:0,class:`mb-3`})):o(``,!0),t.capabilities.referenceVideo?(g(),f(b,{key:1,class:`mb-4`})):o(``,!0),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`}),a(w,{class:`mb-4`}),a(T,{class:`mb-4`}),t.omniActive?o(``,!0):(g(),f(E,{key:2,class:`mb-4`})),t.omniActive?o(``,!0):(g(),f(D,{key:3,class:`mb-4`})),t.omniActive?o(``,!0):(g(),f(O,{key:4,class:`mb-4`}))]),e(`div`,cr,[a(k),a(A,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(g(),f(M,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(j,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.extend`)),1)]),_:1},8,[`onClick`])):(g(),f(M,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(j,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generate`)),1)]),_:1},8,[`onClick`]))]),a(ee,{modelValue:t.inspirationOpen,"onUpdate:modelValue":n[1]||=e=>t.inspirationOpen=e},null,8,[`modelValue`])])}var ur=I(ar,[[`render`,lr]]),dr=v({name:`MotionImage`,components:{UploadIcon:N,ElUpload:C,ElButton:R,InfoIcon:Y,ImagePreview:q},mixins:[B,H],data(){return{fileList:[],uploadUrl:U()+`/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(){K.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){K.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()}}}),fr={class:`relative`},pr={class:`flex justify-between`},mr={class:`flex justify-start items-center`},hr={class:`text-sm font-bold`};function gr(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,fr,[e(`div`,pr,[e(`div`,mr,[e(`span`,hr,i(t.$t(`kling.name.motionImage`)),1),a(h,{content:t.$t(`kling.description.motionImage`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var _r=I(dr,[[`render`,gr],[`__scopeId`,`data-v-32f5471f`]]),vr=v({name:`MotionVideo`,components:{UploadIcon:N,ElUpload:C,ElButton:R,InfoIcon:Y,FilePreview:_e},mixins:[H],data(){return{fileList:[],uploadUrl:U()+`/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(){K.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){K.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:(K.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(K.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()}}}),yr={class:`relative`},br={class:`flex justify-between`},xr={class:`flex justify-start items-center`},Sr={class:`text-sm font-bold`};function Cr(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,yr,[e(`div`,br,[e(`div`,xr,[e(`span`,Sr,i(t.$t(`kling.name.motionVideo`)),1),a(h,{content:t.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),a(b,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage===void 0?o(``,!0):(g(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var wr=I(vr,[[`render`,Cr],[`__scopeId`,`data-v-80320d94`]]),Tr=v({name:`MotionPromptInput`,components:{ElInput:V,InfoIcon:Y},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),Er={class:`field`},Dr={class:`box`},Or={class:`title font-bold`};function kr(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,Er,[e(`div`,Dr,[e(`h2`,Or,i(t.$t(`kling.name.motionPrompt`)),1),a(d,{content:t.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Ar=I(Tr,[[`render`,kr],[`__scopeId`,`data-v-ca9fdbe5`]]),jr=`video`,Mr=v({name:`CharacterOrientationSelector`,components:{ElRadioGroup:D,ElRadioButton:E,InfoIcon:Y},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||jr},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=jr)}}),Nr={class:`field`},Pr={class:`header`},Fr={class:`text-sm font-bold`};function Ir(t,n,o,c,u,d){let f=l(`info-icon`),m=l(`el-radio-button`),h=l(`el-radio-group`);return g(),s(`div`,Nr,[e(`div`,Pr,[e(`span`,Fr,i(t.$t(`kling.name.characterOrientation`)),1),a(f,{content:t.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),a(h,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,size:`small`,class:`value`},{default:p(()=>[a(m,{label:`image`},{default:p(()=>[r(i(t.$t(`kling.name.orientationImage`)),1)]),_:1}),a(m,{label:`video`},{default:p(()=>[r(i(t.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var Lr=I(Mr,[[`render`,Ir],[`__scopeId`,`data-v-7a91195b`]]),Rr=`kling-v2-6`,zr=v({name:`MotionModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Y},computed:{options(){return[{value:`kling-v2-6`,label:`Kling 2.6`},{value:`kling-v3`,label:`Kling 3.0`}]},value:{get(){return this.$store.state.kling?.motionConfig?.model_name||Rr},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,model_name:e})}}},mounted(){this.$store.state.kling?.motionConfig?.model_name||(this.value=Rr)}}),Br={class:`field`},Vr={class:`header`},Hr={class:`title font-bold`};function Ur(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Br,[e(`div`,Vr,[e(`h2`,Hr,i(t.$t(`kling.name.motionModel`)),1),a(m,{content:t.$t(`kling.description.motionModel`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Wr=I(zr,[[`render`,Ur],[`__scopeId`,`data-v-480e8da2`]]),Gr=`std`,Kr=v({name:`MotionModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Y},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||Gr},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=Gr)}}),qr={class:`field`},Jr={class:`header`},Yr={class:`title font-bold`};function Xr(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,qr,[e(`div`,Jr,[e(`h2`,Yr,i(t.$t(`kling.name.mode`)),1),a(m,{content:t.$t(`kling.description.motionMode`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Zr=I(Kr,[[`render`,Xr],[`__scopeId`,`data-v-1295688c`]]),Qr=v({name:`KeepOriginalSoundSelector`,components:{ElSwitch:j,InfoIcon:Y},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`})}}}}),$r={class:`relative`},ei={class:`flex justify-between items-center`},ti={class:`flex justify-start items-center`},ni={class:`text-sm font-bold`};function ri(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,$r,[e(`div`,ei,[e(`div`,ti,[e(`span`,ni,i(t.$t(`kling.name.keepOriginalSound`)),1),a(d,{content:t.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e},null,8,[`modelValue`])])])}var ii=v({name:`MotionPanel`,components:{MagicIcon:P,ElButton:R,Consumption:J,MotionImage:_r,MotionVideo:wr,MotionPromptInput:Ar,CharacterOrientationSelector:Lr,MotionModelSelector:Wr,MotionModeSelector:Zr,KeepOriginalSoundSelector:I(Qr,[[`render`,ri]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return L({...this.motionConfig,duration:1},this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){let e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit(`generate`)}}}),ai={class:`flex flex-col h-full`},oi={class:`flex-1 overflow-y-auto p-5`},si={class:`flex flex-col items-center justify-center px-5 pb-5`};function ci(t,n,o,c,u,d){let f=l(`motion-image`),m=l(`motion-video`),h=l(`motion-prompt-input`),_=l(`character-orientation-selector`),v=l(`motion-model-selector`),y=l(`motion-mode-selector`),b=l(`keep-original-sound-selector`),x=l(`consumption`),S=l(`magic-icon`),C=l(`el-button`);return g(),s(`div`,ai,[e(`div`,oi,[a(f,{class:`mb-3`}),a(m,{class:`mb-3`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`})]),e(`div`,si,[a(x,{value:t.consumption,service:t.service,"rate-unit":t.$t(`kling.name.perSecond`),note:t.$t(`kling.message.motionPricingNote`)},null,8,[`value`,`service`,`rate-unit`,`note`]),a(C,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(S,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var li=I(ii,[[`render`,ci]]),ui=v({name:`KlingTabSwitcher`,components:{ElTabs:x,ElTabPane:S,ElTag:ue},props:{modelValue:{type:String,default:`videos`}},emits:[`update:modelValue`],computed:{tabs(){return[{value:`videos`,label:this.$t(`kling.tab.videoGeneration`)},{value:`motion`,label:this.$t(`kling.tab.motionControl`)},{value:`talking-photo`,label:this.$t(`kling.tab.talkingPhoto`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),di=[`title`],fi={class:`text`};function pi(t,n,a,u,d,m){let _=l(`el-tag`),v=l(`el-tab-pane`),y=l(`el-tabs`);return g(),f(y,{"model-value":t.modelValue,class:`kling-tabs scenario-tabs scenario-tabs--divided`,stretch:``,"onUpdate:modelValue":t.onUpdate},{default:p(()=>[(g(!0),s(c,null,h(t.tabs,t=>(g(),f(v,{key:t.value,name:t.value,disabled:t.disabled},{label:p(()=>[e(`span`,{class:`tab-label`,title:t.disabled?t.disabledReason:void 0},[e(`span`,fi,i(t.label),1),t.badge?(g(),f(_,{key:0,size:`small`,type:`warning`,class:`badge`},{default:p(()=>[r(i(t.badge),1)]),_:2},1024)):o(``,!0)],8,di)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var mi=I(ui,[[`render`,pi],[`__scopeId`,`data-v-4c7b6046`]]),hi={"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`},gi=v({name:`TalkingPhotoModelSelector`,components:{ElSelect:y,ElOption:b},data(){return{options:le.map(e=>({value:e,label:hi[e]||e}))}},computed:{value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.model||`kling-v2-1-master`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,model:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.model||(this.value=ce)}}),_i={class:`field`},vi={class:`title font-bold`};function yi(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,_i,[e(`h2`,vi,i(t.$t(`kling.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var bi=I(gi,[[`render`,yi],[`__scopeId`,`data-v-cbc83d11`]]),xi=v({name:`TalkingPhotoModeSelector`,components:{ElSelect:y,ElOption:b},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.mode||`pro`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,mode:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.mode||(this.value=`pro`)}}),Si={class:`field`},Ci={class:`title font-bold`};function wi(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Si,[e(`h2`,Ci,i(t.$t(`kling.name.mode`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ti=v({name:`TalkingPhotoPanel`,components:{MagicIcon:P,UploadIcon:N,ElUpload:C,ElButton:R,ElInput:V,Consumption:J,InfoIcon:Y,ImagePreview:q,ModelSelector:bi,ModeSelector:I(xi,[[`render`,wi],[`__scopeId`,`data-v-92525a1d`]])},mixins:[H],emits:[`generate`],data(){return{imageFiles:[],audioFiles:[],uploadUrl:U()+`/api/v1/files/`}},computed:{config(){return this.$store.state.kling?.talkingPhotoConfig||{}},audioUrl(){return this.config.audio_url},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},service(){return this.$store.state.kling?.service},consumption(){return L({...this.config,action:`talking-photo`},this.service?.cost)},canGenerate(){return!!(this.config.image_url&&this.config.audio_url)}},methods:{commit(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.config,...e})},onPromptChange(e){this.commit({prompt:e})},onImageExceed(){K.warning(this.$t(`kling.message.uploadReferencesExceed`))},onImageError(){K.error(this.$t(`kling.message.uploadReferencesError`))},onImageSuccess(e){this.commit({image_url:e?.file_url})},onImageRemove(e){this.imageFiles.splice(this.imageFiles.indexOf(e),1),this.commit({image_url:void 0})},onAudioExceed(){K.warning(this.$t(`kling.message.uploadAudioExceed`))},onAudioError(){K.error(this.$t(`kling.message.uploadAudioError`))},onAudioSuccess(e){this.commit({audio_url:e?.file_url})},onAudioRemove(){this.commit({audio_url:void 0})},onGenerate(){this.$emit(`generate`)}}}),Ei={class:`flex flex-col h-full`},Di={class:`flex-1 overflow-y-auto p-5`},Oi={class:`relative mb-4`},ki={class:`flex justify-start items-center`},Ai={class:`text-sm font-bold`},ji={class:`relative mb-4`},Mi={class:`flex justify-start items-center`},Ni={class:`text-sm font-bold`},Pi=[`src`],Fi={class:`mb-4`},Ii={class:`flex justify-start items-center`},Li={class:`text-sm font-bold`},Ri={class:`flex flex-col items-center justify-center px-5 pb-5`};function zi(t,n,c,u,d,m){let h=l(`model-selector`),_=l(`mode-selector`),v=l(`info-icon`),y=l(`image-preview`),b=l(`upload-icon`),x=l(`el-button`),S=l(`el-upload`),C=l(`el-input`),w=l(`consumption`),T=l(`magic-icon`);return g(),s(`div`,Ei,[e(`div`,Di,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),e(`div`,Oi,[e(`div`,ki,[e(`span`,Ai,i(t.$t(`kling.name.talkingPhotoImage`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoImage`)},null,8,[`content`])]),a(S,{ref:`imageUploader`,"file-list":t.imageFiles,"onUpdate:fileList":n[0]||=e=>t.imageFiles=e,name:`file`,accept:`.png,.jpg,.jpeg,.webp,.bmp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,headers:t.headers,"on-exceed":t.onImageExceed,"on-error":t.onImageError,"on-success":t.onImageSuccess},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(y,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onImageRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(b,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`])]),e(`div`,ji,[e(`div`,Mi,[e(`span`,Ni,i(t.$t(`kling.name.talkingPhotoAudio`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoAudio`)},null,8,[`content`])]),a(S,{ref:`audioUploader`,"file-list":t.audioFiles,"onUpdate:fileList":n[1]||=e=>t.audioFiles=e,name:`file`,accept:`.mp3,.wav,.m4a,.aac`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,headers:t.headers,"on-exceed":t.onAudioExceed,"on-error":t.onAudioError,"on-success":t.onAudioSuccess,"on-remove":t.onAudioRemove},{default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn`},{default:p(()=>[a(b,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadAudio`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`]),t.audioUrl?(g(),s(`audio`,{key:0,src:t.audioUrl,controls:``,class:`w-full mt-2`},null,8,Pi)):o(``,!0)]),e(`div`,Fi,[e(`div`,Ii,[e(`span`,Li,i(t.$t(`kling.name.talkingPhotoPrompt`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoPrompt`)},null,8,[`content`])]),a(C,{"model-value":t.config.prompt,type:`textarea`,rows:2,placeholder:t.$t(`kling.placeholder.talkingPhotoPrompt`),class:`mt-1`,"onUpdate:modelValue":t.onPromptChange},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])])]),e(`div`,Ri,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generateTalkingPhoto`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Bi=I(Ti,[[`render`,zi],[`__scopeId`,`data-v-1cf65bf0`]]),Vi=v({name:`TaskPreview`,components:{ChannelIcon:te,InfoIcon:ie,MagicIcon:P,TimeIcon:ee,WarningIcon:oe,CopyToClipboard:ge,ElAlert:T,VideoPlayer:xe,ElTooltip:w,ElButton:R,ImagePreview:q,VideoPreview:we,AudioPreview:Te,ApiCodeButton:Se},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{isFailure(){let e=this.modelValue?.response;return e?.success===!1||!!e?.error||e?.state===`failed`||e?.state===`cancelled`},isWaiting(){let e=this.modelValue?.response;return!e||!this.isFailure&&e.success!==!0&&!e.video_url},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,r=this.modelValue?.request?.image_url;return t&&e.push({url:t,name:`start-image`}),n&&e.push({url:n,name:`end-image`}),r&&e.push({url:r,name:`reference-image`}),e},referenceVideos(){let e=[],t=this.modelValue?.request?.video_url;t&&e.push({url:t,name:`reference-video`});let n=this.modelValue?.request?.video_list;return(Array.isArray(n)?n:[]).forEach((t,n)=>{t?.video_url&&e.push({url:t.video_url,name:`reference-video-${n+1}`})}),e},referenceAudios(){let e=this.modelValue?.request?.audio_url;return e?[{url:e,name:`reference-audio`}]:[]}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Hi={class:`preview`},Ui={class:`left`},Wi={class:`main`},Gi={class:`bot`},Ki={class:`datetime`},qi={class:`info`},Ji={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Yi={key:1,class:`prompt mt-2`},Xi={key:0},Zi={key:1},Qi={key:0,class:n({content:!0,failed:!0})},$i={key:0,class:`mb-4`},ea={key:1,class:n({operations:!0,"mt-2":!0})},ta={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},na={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ra={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ia={key:1,class:n({content:!0})},aa={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},oa={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sa={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ca={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},la={key:2,class:n({content:!0})},ua={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},da={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function fa(t,n,u,d,m,_){let v=l(`capability-presentation`),y=l(`image-preview`),b=l(`video-preview`),x=l(`audio-preview`),S=l(`video-player`),C=l(`el-button`),w=l(`el-tooltip`),T=l(`api-code-button`),E=l(`channel-icon`),D=l(`magic-icon`),O=l(`copy-to-clipboard`),k=l(`time-icon`),A=l(`el-alert`),j=l(`warning-icon`),M=l(`info-icon`);return g(),s(`div`,Hi,[e(`div`,Ui,[a(v,{capability:`kling`,part:`avatar`,class:`avatar`})]),e(`div`,Wi,[e(`div`,Gi,[a(v,{capability:`kling`,part:`name`}),e(`span`,Ki,i(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,qi,[t.referenceImages.length>0||t.referenceVideos.length>0||t.referenceAudios.length>0?(g(),s(`div`,Ji,[(g(!0),s(c,null,h(t.referenceImages,(e,t)=>(g(),f(y,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(t.referenceVideos,(e,t)=>(g(),f(b,{key:`video-${t}`,url:e.url,name:e.name},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(t.referenceAudios,(e,t)=>(g(),f(x,{key:`audio-${t}`,url:e.url,name:e.name},null,8,[`url`,`name`]))),128))])):o(``,!0),t.modelValue?.request?.prompt?(g(),s(`p`,Yi,[r(i(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?t.isWaiting?(g(),s(`span`,Zi,` - (`+i(t.$t(`kling.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,Xi,` - (`+i(t.$t(`kling.status.pending`))+`) `,1))])):o(``,!0)]),t.modelValue?.response?.success===!0&&!t.isFailure?(g(),s(`div`,Qi,[t.modelValue?.response.video_url?(g(),s(`div`,$i,[a(S,{src:t.modelValue?.response.video_url},null,8,[`src`])])):o(``,!0),t.modelValue?.response.success?(g(),s(`div`,ea,[a(w,{class:`box-item`,effect:`dark`,content:t.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:p(()=>[t.modelValue?.response.video_url?(g(),f(C,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:n[0]||=e=>t.onDownload(e,t.modelValue?.response.video_url)},{default:p(()=>[r(i(t.$t(`kling.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(T,{path:`/kling/videos`,body:t.modelValue?.request},null,8,[`body`])])):o(``,!0),a(A,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,ta,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.model`))+`: `+i(t.modelValue?.request?.model),1)]),e(`p`,na,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(O,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(g(),s(`p`,ra,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),t.isFailure?(g(),s(`div`,ia,[a(A,{closable:!1,class:`failure`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.failure`)),1)]),default:p(()=>[e(`p`,aa,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(O,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,oa,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.failureReason`))+`: `+i(t.modelValue?.response?.error?.message)+` `,1),a(O,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(g(),s(`p`,sa,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),t.modelValue?.response?.trace_id?(g(),s(`p`,ca,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.traceId`))+`: `+i(t.modelValue?.response?.trace_id)+` `,1),a(O,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),t.isWaiting?(g(),s(`div`,la,[a(A,{closable:!1,class:`info`},{template:p(()=>[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(t.modelValue?.response?`kling.status.processing`:`kling.status.pending`)),1)]),default:p(()=>[e(`p`,ua,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(O,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(g(),s(`p`,da,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.traceId`))+`: `+i(t.modelValue?.response?.trace_id)+` `,1),a(O,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var pa=v({name:`RecentPanel`,components:{TaskPreview:I(Vi,[[`render`,fa],[`__scopeId`,`data-v-d5f75276`]]),NoTasks:ye,BotPlaceholder:Ce,ScrollList:ve},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?.()}}}),ma={key:0},ha={key:2,class:`w-full h-full flex items-center justify-center`};function ga(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,ma,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`h-full w-full overflow-y-auto tasks`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,e=>(g(),f(m,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,ha,[a(v)])):o(``,!0)],64)}var _a=v({name:`KlingIndex`,components:{ConfigPanel:ur,MotionPanel:li,TalkingPhotoPanel:Bi,TabSwitcher:mi,Layout:je,RecentPanel:I(pa,[[`render`,ga]])},mixins:[fe],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===he.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===he.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},talkingPhotoConfig(){return this.$store.state.kling.talkingPhotoConfig},taskType(){return this.$store.state.kling.taskType||`videos`},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await be({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(!de(this.uploadTracker,e=>this.$t(e),e=>K.warning(e)))return;let{camera_control:e,...t}=this.config||{},n={...t,async:!0},r=Number(!!n.start_image_url)+Number(!!n.end_image_url),i=n.image_list?.length||0,a=n.video_list?.length?4:7;if(r+i>a){K.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:a}));return}if(n.video_list?.[0]?.refer_type===`base`&&(n.start_image_url||n.end_image_url||n.image_list?.some(({type:e})=>e))){K.warning(this.$t(`kling.message.baseVideoFrameConflict`));return}if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){K.warning(this.$t(`kling.message.endImageRequiresStart`));return}if(n.action||(n.video_id||t.video_url?n.action=`extend`:n.start_image_url?n.action=`image2video`:n.action=`text2video`),n.action===`text2video`&&n.end_image_url&&delete n.end_image_url,e?.type&&(n.camera_control={type:e.type,...e.type===`simple`&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,e])=>e!=null))}:{}}),!W())return;let o=this.credential?.token;if(!o){console.error(`no token specified`);return}K.info(this.$t(`kling.message.startingTask`)),G(`kling`,z.generate(n,{token:o})).then(()=>{K.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?K.error(this.$t(`kling.message.usedUp`)):K.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(!de(this.uploadTracker,e=>this.$t(e),e=>K.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){K.warning(this.$t(`kling.message.motionMissingInputs`));return}let t={image_url:e.image_url,video_url:e.video_url,character_orientation:e.character_orientation||`video`,mode:e.mode||`std`,keep_original_sound:e.keep_original_sound??`yes`,...e.model_name?{model_name:e.model_name}:{},...e.prompt?{prompt:e.prompt}:{},async:!0};if(!W())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}K.info(this.$t(`kling.message.startingTask`)),G(`kling`,z.motion(t,{token:n})).then(()=>{K.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?K.error(this.$t(`kling.message.usedUp`)):K.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},async onGenerateTalkingPhoto(){if(!de(this.uploadTracker,e=>this.$t(e),e=>K.warning(e)))return;let e=this.talkingPhotoConfig||{};if(!e.image_url||!e.audio_url){K.warning(this.$t(`kling.message.talkingPhotoMissingInputs`));return}let t={image_url:e.image_url,audio_url:e.audio_url,model:e.model||`kling-v2-1-master`,mode:e.mode||`pro`,...e.prompt?{prompt:e.prompt}:{},...e.duration?{duration:e.duration}:{},async:!0};if(!W())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}K.info(this.$t(`kling.message.startingTask`)),G(`kling`,z.talkingPhoto(t,{token:n})).then(()=>{K.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?K.error(this.$t(`kling.message.usedUp`)):K.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),va={class:`flex flex-col h-full`},ya={class:`flex-1 min-h-0`};function ba(t,n,r,i,s,c){let u=l(`tab-switcher`),d=l(`config-panel`),m=l(`motion-panel`),h=l(`talking-photo-panel`),_=l(`recent-panel`),v=l(`layout`);return g(),f(v,null,{config:p(()=>[e(`div`,va,[a(u,{"model-value":t.taskType,"onUpdate:modelValue":t.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),e(`div`,ya,[t.taskType===`videos`?(g(),f(d,{key:0,onGenerate:t.onGenerate},null,8,[`onGenerate`])):t.taskType===`motion`?(g(),f(m,{key:1,onGenerate:t.onGenerateMotion},null,8,[`onGenerate`])):t.taskType===`talking-photo`?(g(),f(h,{key:2,onGenerate:t.onGenerateTalkingPhoto},null,8,[`onGenerate`])):o(``,!0)])])]),result:p(()=>[a(_,{ref:`recentPanel`,loading:t.loadingMore,onReachTop:t.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var xa=I(_a,[[`render`,ba]]);export{xa as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-D-bIB0WH.js";import{n as x,t as S}from"./tabs-puj4wsas.js";import{t as C}from"./upload-DmyuWAhM.js";import{t as w}from"./tooltip-R5atdiIg.js";import{t as T}from"./alert-BF99s01E.js";import{n as E,r as D}from"./radio-DgDgyT2l.js";import{t as O}from"./drawer-CxEfdDZv.js";import{t as k}from"./input-number-BIzn8YxY.js";import{t as A}from"./slider-ClwEi7Gh.js";import{t as j}from"./switch-CYC0EnuT.js";import{n as M}from"./taskDrawerMixin-CqMO2njP.js";import{t as ee}from"./clock-CzhmPsDw.js";import{r as te,t as ne}from"./PromptTextarea-D2e6r_v-.js";import{t as re}from"./headphones-GGteqWG2.js";import{t as ie}from"./info-BbNN_iNp.js";import{t as ae}from"./lightbulb-4eHB4rud.js";import{t as oe}from"./triangle-alert-B8AJf438.js";import{t as N}from"./upload-BFid7bP9.js";import{t as P}from"./wand-sparkles-J1dql9CA.js";import{ai as se,ci as ce,li as le,ui as F}from"./constants-mcSzdyE5.js";import{Bt as ue,E as I,Gt as L,Ht as de,Mi as fe,Pi as R,Ui as z,Un as B,Ut as V,Vt as H,_i as pe,bi as U,en as W,ii as me,si as G,vr as K,yi as q}from"./index-BSsxAJiU.js";import{t as he}from"./CopyToClipboard-BZF25rbq.js";import{t as ge}from"./FilePreview-BXzr-WpS.js";import{t as J}from"./ImagePreview-ChXS4xrI.js";import{t as Y}from"./Consumption-xkYaAMt8.js";import{a as X,n as _e,r as ve,t as ye}from"./pagination-CmdHn0iE.js";import{t as be}from"./VideoPlayer-BD_yOIBX.js";import{t as xe}from"./ApiCodeButton-C-TuDkaQ.js";import{t as Se}from"./BotPlaceholder-B7smvpFp.js";import{n as Ce,t as we}from"./AudioPreview-BVgoCdzr.js";var Te=v({name:`LayoutKling`,components:{MagicIcon:P,ElDrawer:O,ElButton:R},mixins:[M]}),Ee={class:`main flex flex-row flex-1 min-h-0`},De={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Oe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ke(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,Ee,[e(`div`,De,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Oe,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Ae=I(Te,[[`render`,ke],[`__scopeId`,`data-v-2d826924`]]),je={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};function Z(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,referenceVideo:!1,referenceImages:!1};case`kling-v1-6`:case`kling-v2-5-turbo`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v2-6`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:r===`pro`,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v2-master`:case`kling-v2-1-master`:return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v3`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:r!==`4k`,referenceVideo:!1,referenceImages:!1};case`kling-v3-omni`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1,referenceVideo:!0,referenceImages:!0};case`kling-o1`:return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1,referenceVideo:!0,referenceImages:!0};default:return je}}var Q=`<<<video_1>>>`,Me=/<<<image_\d+>>>/g;function Ne(e){return e?e.split(Q).join(` `).replace(/\s{2,}/g,` `).trim():``}function Pe(e){return e?e.replace(Me,` `).replace(/\s{2,}/g,` `).trim():``}function Fe(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=Z(n,r,i),o=[];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`}),e.video_list?.length&&!a.referenceVideo&&o.push({field:`video_list`,i18nLabel:`kling.name.referenceVideo`}),e.image_list?.length&&!a.referenceImages&&o.push({field:`image_list`,i18nLabel:`kling.name.referenceImages`});let s=n===`kling-o1`||!!(e.image_list?.length||e.video_list?.length);return s&&e.cfg_scale!==void 0&&o.push({field:`cfg_scale`,i18nLabel:`kling.name.cfgScale`}),s&&e.negative_prompt&&o.push({field:`negative_prompt`,i18nLabel:`kling.name.negativePrompt`}),o}function Ie(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),e.field===`cfg_scale`&&(n.cfg_scale=void 0),e.field===`negative_prompt`&&(n.negative_prompt=void 0),e.field===`video_list`&&(n.video_list=void 0,n.prompt=Ne(n.prompt)),e.field===`image_list`&&(n.image_list=void 0,n.prompt=Pe(n.prompt));return n}var Le=v({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},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-o1`,label:`Kling O1`}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(se)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=Fe(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await q.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=Ie({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),U.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})}}}),Re={class:`field`},ze={class:`title font-bold`};function Be(t,n,r,a,o,u){let d=l(`el-option`),m=l(`el-select`);return g(),s(`div`,Re,[e(`h2`,ze,i(t.$t(`pika.name.model`)),1),(g(),f(m,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`pika.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(d,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Ve=I(Le,[[`render`,Be],[`__scopeId`,`data-v-a74e7f31`]]),He=v({name:`ModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},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 F.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=Fe(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await q.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=Ie({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),U.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})}}}),Ue={class:`field`},We={class:`header`},Ge={class:`title font-bold`},Ke={key:0,class:`opt-tip`};function qe(t,r,u,d,m,_){let v=l(`info-icon`),y=l(`el-option`),b=l(`el-select`);return g(),s(`div`,Ue,[e(`div`,We,[e(`h2`,Ge,i(t.$t(`kling.name.mode`)),1),a(v,{content:t.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(g(),f(b,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`kling.placeholder.select`),clearable:!0,onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(y,{key:t.value,label:t.label,value:t.value,disabled:t.disabled},{default:p(()=>[e(`span`,{class:n({"opt-disabled":t.disabled})},i(t.label),3),t.disabled&&t.disabledReason?(g(),s(`span`,Ke,i(t.disabledReason),1)):o(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Je=I(He,[[`render`,qe],[`__scopeId`,`data-v-9a8fa3c5`]]),Ye=[3,5,8,10,12,15],Xe=[5,10],Ze=[5],Qe=v({name:`DurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return F.includes(this.selectedModel)},allowedDurations(){return this.selectedModel===`kling-o1`?Ze:this.isV3Model?Ye:Xe},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:{selectedModel(){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=Fe(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await q.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=Ie({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),U.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})}}}),$e={class:`field`},et={class:`control`},tt={class:`label`},nt={class:`title font-bold`};function rt(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,$e,[e(`div`,et,[e(`div`,tt,[e(`h2`,nt,i(t.$t(`kling.name.duration`)),1),a(m,{content:t.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(g(),f(v,{key:t.revertKey,"model-value":t.selectValue,class:`value`,placeholder:t.$t(`kling.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.allowedDurations,e=>(g(),f(_,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var it=I(Qe,[[`render`,rt],[`__scopeId`,`data-v-496bf31c`]]),at=v({name:`RatioSelector`,data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug(`set ratio`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||=`1:1`}}),ot={class:`text-sm font-bold mb-2 block`},st={class:`items`},ct=[`onClick`],lt={class:`name`};function ut(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,ot,i(t.$t(`kling.name.ratio`)),1),e(`div`,st,[(g(!0),s(c,null,h(t.options,(r,a)=>(g(),s(`div`,{key:a,class:n({active:t.active===a,item:!0}),onClick:e=>t.value=r.value},[e(`div`,{class:n([`preview`,r.label])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,lt,i(r.label),1)],10,ct))),128))])])}var dt=I(at,[[`render`,ut],[`__scopeId`,`data-v-cdb14b2f`]]),ft=v({name:`StartImage`,components:{UploadIcon:N,ElUpload:C,ElButton:R,ElTooltip:w,InfoIcon:X,ImagePreview:J},mixins:[V,H],emits:[`change`],data(){return{fileList:[],uploadUrl:G()+`/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(){}}},watch:{value(e){!e&&this.fileList.length>0&&(this.fileList=[])}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){U.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){U.error(this.$t(`kling.message.uploadReferencesError`))},onBeforeUpload(){let e=this.$store.state.kling?.config||{};if(e.video_list?.[0]?.refer_type===`base`)return U.warning(this.$t(`kling.message.baseVideoFrameConflict`)),!1;let t=e.video_list?.length?4:7;return(e.image_list?.length||0)+Number(!!e.end_image_url)+1>t?(U.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:t})),!1):!0},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.onSetStartImageUrl()}}}),pt={class:`relative`},mt={class:`flex min-h-8 items-center pr-20`},ht={class:`flex justify-start items-center`},gt={class:`text-sm font-bold`};function _t(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`el-upload`);return g(),s(`div`,pt,[e(`div`,mt,[e(`div`,ht,[e(`span`,gt,i(t.$t(`kling.name.startImage`)),1),a(h,{content:t.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:t.reachedLimit,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"before-upload":t.onBeforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(b,{content:t.$t(`kling.message.uploadReferencesExceed`),disabled:!t.reachedLimit,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.reachedLimit},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var vt=I(ft,[[`render`,_t],[`__scopeId`,`data-v-0220ed34`]]),yt=v({name:`EndImage`,components:{UploadIcon:N,ElUpload:C,ElButton:R,ElTooltip:w,ImagePreview:J,InfoIcon:X},mixins:[V,H],data(){return{fileList:[],uploadUrl:G()+`/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 Z(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(){if(!this.endImageSupported)return U.warning(this.$t(`kling.message.endImageNotSupported`)),!1;if(!this.hasStartImage)return U.warning(this.$t(`kling.message.endImageRequiresStart`)),!1;if(this.klingConfig.video_list?.[0]?.refer_type===`base`)return U.warning(this.$t(`kling.message.baseVideoFrameConflict`)),!1;let e=this.klingConfig.video_list?.length?4:7;return(this.klingConfig.image_list?.length||0)+2>e?(U.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:e})),!1):!0},onExceed(){U.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){U.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()},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.onSetEndImageUrl()}}}),bt={class:`relative`},xt={class:`flex min-h-8 items-center pr-20`},St={class:`flex justify-start items-center`},Ct={class:`text-sm font-bold`};function wt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`el-upload`);return g(),s(`div`,bt,[e(`div`,xt,[e(`div`,St,[e(`span`,Ct,i(t.$t(`kling.name.endImage`)),1),a(h,{content:t.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:t.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"before-upload":t.onBeforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(b,{content:t.uploadTooltip,disabled:!t.uploadDisabled,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.uploadDisabled},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Tt=I(yt,[[`render`,wt],[`__scopeId`,`data-v-b2eaa919`]]),Et=v({name:`ReferenceVideo`,components:{ElUpload:C,ElButton:R,ElRadioButton:E,ElRadioGroup:D,ElSwitch:j,InfoIcon:X,FilePreview:ge,UploadIcon:N},mixins:[H],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},config(){return this.$store.state.kling?.config||{}},hasVideo(){return!!this.urls?.[0]},referenceType:{get(){return this.config.video_list?.[0]?.refer_type||`feature`},set(e){this.updateVideoOptions(e,this.keepOriginalSound)}},keepOriginalSound:{get(){return this.config.video_list?.[0]?.keep_original_sound===`yes`},set(e){this.updateVideoOptions(this.referenceType,e)}}},methods:{onExceed(){U.warning(this.$t(`kling.message.referenceVideoExceed`))},onError(){U.error(this.$t(`kling.message.referenceVideoError`))},beforeUpload(e){if((this.config.image_list?.length||0)+Number(!!this.config.start_image_url)+Number(!!this.config.end_image_url)>4)return U.error(this.$t(`kling.message.referenceVideoImageLimit`)),!1;let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<200;return t?n?!0:(U.error(this.$t(`kling.message.referenceVideoSizeExceed`)),!1):(U.error(this.$t(`kling.message.referenceVideoTypeFailed`)),!1)},ensurePromptToken(e){let t=this.$store.state.kling?.config,n=t?.prompt||``,r=n.includes(Q),i;if(e&&!r)i=n?`${n} ${Q}`:Q;else if(!e&&r)i=Ne(n);else return;this.$store.commit(`kling/setConfig`,{...t,prompt:i})},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,video_list:void 0}),this.ensurePromptToken(!1)},onSetVideoList(){let e=this.urls?.[0],t=e?[{video_url:e,refer_type:this.referenceType,keep_original_sound:this.keepOriginalSound?`yes`:`no`}]:void 0;this.$store.commit(`kling/setConfig`,{...this.config,video_list:t,generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0}),this.ensurePromptToken(!!e)},updateVideoOptions(e,t){let n=this.urls?.[0];n&&this.$store.commit(`kling/setConfig`,{...this.config,video_list:[{video_url:n,refer_type:e,keep_original_sound:t?`yes`:`no`}],...e===`base`?{start_image_url:void 0,end_image_url:void 0}:{},generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0})},async onSuccess(){this.onSetVideoList()}}}),Dt={class:`relative`},Ot={class:`flex min-h-8 items-center pr-20`},kt={class:`flex justify-start items-center`},At={class:`text-sm font-bold`},jt={key:0,class:`reference-options mt-3 flex flex-col gap-3`},Mt={class:`flex flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`},Nt={class:`text-sm`},Pt={class:`flex items-center justify-between gap-3`},Ft={class:`text-sm`};function It(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`el-radio-button`),S=l(`el-radio-group`),C=l(`el-switch`);return g(),s(`div`,Dt,[e(`div`,Ot,[e(`div`,kt,[e(`span`,At,i(t.$t(`kling.name.referenceVideo`)),1),a(h,{content:t.$t(`kling.description.omniReferenceVideo`)},null,8,[`content`])])]),a(b,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage===void 0?o(``,!0):(g(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferenceVideo`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`]),t.hasVideo?(g(),s(`div`,jt,[e(`div`,Mt,[e(`span`,Nt,i(t.$t(`kling.name.referenceVideoType`)),1),a(S,{modelValue:t.referenceType,"onUpdate:modelValue":n[1]||=e=>t.referenceType=e,size:`small`},{default:p(()=>[a(x,{value:`feature`},{default:p(()=>[r(i(t.$t(`kling.name.referenceVideoFeature`)),1)]),_:1}),a(x,{value:`base`},{default:p(()=>[r(i(t.$t(`kling.name.referenceVideoBase`)),1)]),_:1})]),_:1},8,[`modelValue`])]),e(`div`,Pt,[e(`span`,Ft,i(t.$t(`kling.name.keepOriginalSound`)),1),a(C,{modelValue:t.keepOriginalSound,"onUpdate:modelValue":n[2]||=e=>t.keepOriginalSound=e},null,8,[`modelValue`])])])):o(``,!0)])}var Lt=I(Et,[[`render`,It],[`__scopeId`,`data-v-7bb04cb4`]]),Rt=v({name:`KlingReferenceImages`,components:{ElButton:R,ElUpload:C,UploadIcon:N,ImagePreview:J,InfoIcon:X},mixins:[V,H],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{config(){return this.$store.state.kling?.config||{}},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},frameCount(){return Number(!!this.config.start_image_url)+Number(!!this.config.end_image_url)},maxImages(){return this.config.video_list?.length?4:7},referenceLimit(){return Math.max(0,this.maxImages-this.frameCount)},remainingSlots(){return Math.max(0,this.referenceLimit-this.urls.length)},urls(){return this.fileList.map(e=>e.response?.file_url||e.url).filter(Boolean)},storeImages(){return this.config.image_list}},watch:{frameCount(){this.syncPromptTokens()},storeImages(e){!e?.length&&this.fileList.length>0&&(this.fileList=[])}},methods:{beforeUpload(){return this.remainingSlots===0?(this.onExceed(),!1):!0},onExceed(){U.warning(this.$t(`kling.message.referenceImagesExceed`,{count:this.remainingSlots}))},onError(){U.error(this.$t(`kling.message.referenceImagesError`))},clearOmniConflicts(e){return{...e,generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0}},syncPromptTokens(e){let t=e||this.config,n=[Pe(t.prompt),...this.urls.map((e,t)=>`<<<image_${this.frameCount+t+1}>>>`)].filter(Boolean).join(` `);n!==t.prompt&&this.$store.commit(`kling/setConfig`,{...t,prompt:n})},syncConfig(){let e=this.urls.length?this.urls.map(e=>({image_url:e})):void 0,t=this.clearOmniConflicts({...this.config,image_list:e});this.$store.commit(`kling/setConfig`,t),this.syncPromptTokens(t)},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.syncConfig()},onRemove(e,t){this.fileList.splice(e,1),t.url?.startsWith(`blob:`)&&URL.revokeObjectURL(t.url),this.syncConfig()}}}),zt={class:`relative`},Bt={class:`flex justify-between items-center`},Vt={class:`flex justify-start items-center`},Ht={class:`text-sm font-bold`},Ut={key:0,class:`file-list flex flex-wrap gap-2 mt-2`};function Wt(t,n,u,d,m,_){let v=l(`info-icon`),y=l(`UploadIcon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return g(),s(`div`,zt,[e(`div`,Bt,[e(`div`,Vt,[e(`span`,Ht,i(t.$t(`kling.name.referenceImages`)),1),a(v,{content:t.$t(`kling.description.referenceImages`)},null,8,[`content`])]),a(x,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg`,name:`file`,limit:t.referenceLimit,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[a(b,{round:``,type:`primary`,size:`small`,disabled:t.remainingSlots===0},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferenceImages`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`file-list`,`limit`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.fileList.length?(g(),s(`div`,Ut,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(S,{key:e.uid||e.url||n,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemove(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])):o(``,!0)])}var Gt=I(Rt,[[`render`,Wt]]),Kt=v({name:`CfgScaleSelector`,components:{ElSlider:A,InfoIcon:X,ElInputNumber:k},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}}),qt={class:`flex justify-between`},Jt={class:`flex justify-start items-center`},Yt={class:`text-sm font-bold`},Xt={class:`flex justify-end items-center`},Zt={class:`w-full`};function Qt(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`),p=l(`el-slider`);return g(),s(`div`,null,[e(`div`,qt,[e(`div`,Jt,[e(`span`,Yt,i(t.$t(`kling.name.cfgScale`)),1),a(d,{content:t.$t(`kling.description.cfgScale`)},null,8,[`content`])]),e(`div`,Xt,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,Zt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var $t=I(Kt,[[`render`,Qt]]),en=v({name:`GenerateAudioSelector`,components:{ElSwitch:j,InfoIcon:X},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(F.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})}}}),tn={class:`relative`},nn={class:`flex justify-between items-center`},rn={class:`flex justify-start items-center`},an={class:`text-sm font-bold`};function on(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,tn,[e(`div`,nn,[e(`div`,rn,[e(`span`,an,i(t.$t(`kling.name.generateAudio`)),1),a(d,{content:t.tooltipContent},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,disabled:!t.supported},null,8,[`modelValue`,`disabled`])])])}var sn=I(en,[[`render`,on]]),cn=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],ln=v({name:`CameraControlSelector`,components:{ElSelect:y,ElOption:b,ElSlider:A,ElInputNumber:k,InfoIcon:X},data(){return{configKeys:cn}},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 Z(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)}}}),un={class:`field`},dn={class:`header`},fn={class:`text-sm font-bold`},pn={key:0,class:`config-grid`},mn={class:`cfg-row-head`},hn={class:`cfg-name`};function gn(t,n,r,u,d,m){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`),b=l(`el-input-number`),x=l(`el-slider`);return g(),s(`div`,un,[e(`div`,dn,[e(`span`,fn,i(t.$t(`kling.name.cameraControl`)),1),a(_,{content:t.tooltipContent},null,8,[`content`])]),a(y,{modelValue:t.selectedTypeRaw,"onUpdate:modelValue":n[0]||=e=>t.selectedTypeRaw=e,class:`value`,placeholder:t.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:t.disabled},{default:p(()=>[(g(!0),s(c,null,h(t.typeOptions,e=>(g(),f(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),t.selectedType===`simple`&&!t.disabled?(g(),s(`div`,pn,[(g(!0),s(c,null,h(t.configKeys,n=>(g(),s(`div`,{key:n,class:`cfg-row`},[e(`div`,mn,[e(`span`,hn,i(t.$t(`kling.name.cc_${n}`)),1),a(b,{modelValue:t.configValues[n],"onUpdate:modelValue":e=>t.configValues[n]=e,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:e=>t.onNumberChange(n,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),a(x,{"model-value":t.configValues[n]??0,min:-1,max:1,step:.1,onInput:e=>t.onSliderChange(n,e)},null,8,[`model-value`,`onInput`])]))),128))])):o(``,!0)])}var _n=I(ln,[[`render`,gn],[`__scopeId`,`data-v-cd896060`]]),vn=[{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`]}],$=`, `;function yn(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${$}${t}`:t}function bn(e,t){if(!e||!t)return e||``;let n=[`${t}${$}`,`${$}${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 xn=v({name:`InspirationPills`,components:{CloseIcon:pe},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return vn.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=bn(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),Sn={key:0,class:`pills`,role:`list`},Cn={class:`pill-text`},wn=[`aria-label`,`title`,`onClick`];function Tn(n,r,u,d,f,p){let m=l(`close-icon`);return n.selected.length>0?(g(),s(`div`,Sn,[(g(!0),s(c,null,h(n.selected,r=>(g(),s(`div`,{key:r,class:`pill`,role:`listitem`},[e(`span`,Cn,i(r),1),e(`button`,{type:`button`,class:`pill-remove`,"aria-label":n.$t(`kling.inspiration.removeChip`),title:n.$t(`kling.inspiration.removeChip`),onClick:t(e=>n.onRemove(r),[`stop`])},[a(m,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,wn)]))),128))])):o(``,!0)}var En=v({name:`PromptInput`,components:{IdeaIcon:ae,ElButton:R,PromptTextarea:ne,InspirationPills:I(xn,[[`render`,Tn],[`__scopeId`,`data-v-6be01bcf`]])},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 Dn(e,t,n,o,s,c){let u=l(`idea-icon`),d=l(`el-button`),m=l(`inspiration-pills`),h=l(`prompt-textarea`);return g(),f(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`kling.name.prompt`),info:e.$t(`kling.description.prompt`),placeholder:e.$t(`kling.placeholder.prompt`)},{actions:p(()=>[a(d,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:p(()=>[a(u,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:p(()=>[a(m)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var On=I(En,[[`render`,Dn],[`__scopeId`,`data-v-5754ae54`]]),kn=v({name:`NegativePromptInput`,components:{ElInput:z,InfoIcon:X},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||=``}}),An={class:`field`},jn={class:`box`},Mn={class:`title font-bold`};function Nn(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,An,[e(`div`,jn,[e(`h2`,Mn,i(t.$t(`kling.name.negativePrompt`)),1),a(d,{content:t.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var Pn=I(kn,[[`render`,Nn],[`__scopeId`,`data-v-de98cf01`]]),Fn=v({name:`InspirationDrawer`,components:{Close:pe,IdeaIcon:ae,ElDrawer:O,ElButton:R},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:vn}},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(bn(this.prompt,e)):this.setPrompt(yn(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=bn(e,t);this.setPrompt(e)}}}),In={class:`drawer-content`},Ln={class:`drawer-header`},Rn={class:`title-row`},zn={class:`title`},Bn={class:`hint`},Vn={key:0,class:`selected-bar`},Hn={class:`selected-text`},Un={class:`groups`},Wn={class:`group-title`},Gn={class:`chip-grid`},Kn=[`onClick`];function qn(t,u,d,m,_,v){let y=l(`idea-icon`),b=l(`close`),x=l(`el-button`),S=l(`el-drawer`);return g(),f(S,{modelValue:t.visible,"onUpdate:modelValue":u[1]||=e=>t.visible=e,direction:`rtl`,"with-header":!1,size:t.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:p(()=>[e(`div`,In,[e(`div`,Ln,[e(`div`,Rn,[a(y,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`span`,zn,i(t.$t(`kling.inspiration.title`)),1)]),a(x,{text:``,class:`close-btn`,"aria-label":t.$t(`common.button.close`),title:t.$t(`common.button.close`),onClick:u[0]||=e=>t.visible=!1},{default:p(()=>[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`])]),e(`div`,Bn,i(t.$t(`kling.inspiration.hint`)),1),t.selectedCount>0?(g(),s(`div`,Vn,[e(`span`,Hn,i(t.$t(`kling.inspiration.selectedSummary`,{count:t.selectedCount})),1),a(x,{text:``,size:`small`,class:`clear-btn`,onClick:t.onClearSelected},{default:p(()=>[r(i(t.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):o(``,!0),e(`div`,Un,[(g(!0),s(c,null,h(t.groups,r=>(g(),s(`div`,{key:r.groupKey,class:`group`},[e(`div`,Wn,i(t.$t(`kling.inspiration.group.${r.groupKey}`)),1),e(`div`,Gn,[(g(!0),s(c,null,h(r.chipKeys,e=>(g(),s(`button`,{key:e,type:`button`,class:n({chip:!0,active:t.isSelected(t.chipText(e))}),onClick:n=>t.onToggle(t.chipText(e))},i(t.chipText(e)),11,Kn))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var Jn=I(Fn,[[`render`,qn],[`__scopeId`,`data-v-8b2e6a5d`]]),Yn={"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-o1":`Kling O1`},Xn={std:`720p`,pro:`1080p`,"4k":`4K`},Zn=v({name:`SummaryChip`,components:{AudioIcon:re},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return Yn[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return Xn[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),Qn={class:`summary-chip`},$n=[`title`],er=[`title`],tr=[`title`],nr=[`title`],rr=[`title`];function ir(t,n,r,c,u,d){let f=l(`audio-icon`);return g(),s(`div`,Qn,[e(`span`,{class:`part`,title:t.$t(`kling.name.model`)},i(t.modelLabel),9,$n),n[0]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.duration`)},i(t.durationLabel),9,er),n[1]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.ratio`)},i(t.aspectRatio||`16:9`),9,tr),n[2]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.mode`)},i(t.modeLabel),9,nr),t.generateAudio?(g(),s(`span`,{key:0,class:`audio`,title:t.$t(`kling.name.generateAudio`)},[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,rr)):o(``,!0)])}var ar=v({name:`ConfigPanel`,components:{MagicIcon:P,ElButton:R,Consumption:Y,PromptInput:On,NegativePromptInput:Pn,ModelSelector:Ve,ModeSelector:Je,DurationSelector:it,RatioSelector:dt,StartImage:vt,CfgScaleSelector:$t,GenerateAudioSelector:sn,CameraControlSelector:_n,InspirationDrawer:Jn,SummaryChip:I(Zn,[[`render`,ir],[`__scopeId`,`data-v-c800852a`]]),EndImage:Tt,ReferenceImages:Gt,ReferenceVideo:Lt},emits:[`generate`],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},capabilities(){return Z(this.config?.model,this.config?.mode,this.config?.duration)},omniActive(){return this.config?.model===`kling-o1`||!!(this.config?.image_list?.length||this.config?.video_list?.length)},consumption(){return L(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),or={class:`flex flex-col h-full`},sr={class:`flex-1 overflow-y-auto p-5`},cr={class:`flex flex-col items-center justify-center px-5 pb-5`};function lr(t,n,c,u,d,m){let h=l(`prompt-input`),_=l(`model-selector`),v=l(`ratio-selector`),y=l(`reference-images`),b=l(`reference-video`),x=l(`start-image`),S=l(`end-image`),C=l(`duration-selector`),w=l(`mode-selector`),T=l(`generate-audio-selector`),E=l(`camera-control-selector`),D=l(`cfg-scale-selector`),O=l(`negative-prompt-input`),k=l(`summary-chip`),A=l(`consumption`),j=l(`magic-icon`),M=l(`el-button`),ee=l(`inspiration-drawer`);return g(),s(`div`,or,[e(`div`,sr,[a(h,{class:`mb-4`,onOpenInspiration:n[0]||=e=>t.inspirationOpen=!0}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),t.capabilities.referenceImages?(g(),f(y,{key:0,class:`mb-3`})):o(``,!0),t.capabilities.referenceVideo?(g(),f(b,{key:1,class:`mb-4`})):o(``,!0),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`}),a(w,{class:`mb-4`}),a(T,{class:`mb-4`}),t.omniActive?o(``,!0):(g(),f(E,{key:2,class:`mb-4`})),t.omniActive?o(``,!0):(g(),f(D,{key:3,class:`mb-4`})),t.omniActive?o(``,!0):(g(),f(O,{key:4,class:`mb-4`}))]),e(`div`,cr,[a(k),a(A,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(g(),f(M,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(j,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.extend`)),1)]),_:1},8,[`onClick`])):(g(),f(M,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(j,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generate`)),1)]),_:1},8,[`onClick`]))]),a(ee,{modelValue:t.inspirationOpen,"onUpdate:modelValue":n[1]||=e=>t.inspirationOpen=e},null,8,[`modelValue`])])}var ur=I(ar,[[`render`,lr]]),dr=v({name:`MotionImage`,components:{UploadIcon:N,ElUpload:C,ElButton:R,InfoIcon:X,ImagePreview:J},mixins:[V,H],data(){return{fileList:[],uploadUrl:G()+`/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(){U.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){U.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()}}}),fr={class:`relative`},pr={class:`flex justify-between`},mr={class:`flex justify-start items-center`},hr={class:`text-sm font-bold`};function gr(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,fr,[e(`div`,pr,[e(`div`,mr,[e(`span`,hr,i(t.$t(`kling.name.motionImage`)),1),a(h,{content:t.$t(`kling.description.motionImage`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var _r=I(dr,[[`render`,gr],[`__scopeId`,`data-v-32f5471f`]]),vr=v({name:`MotionVideo`,components:{UploadIcon:N,ElUpload:C,ElButton:R,InfoIcon:X,FilePreview:ge},mixins:[H],data(){return{fileList:[],uploadUrl:G()+`/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(){U.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){U.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:(U.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(U.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()}}}),yr={class:`relative`},br={class:`flex justify-between`},xr={class:`flex justify-start items-center`},Sr={class:`text-sm font-bold`};function Cr(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,yr,[e(`div`,br,[e(`div`,xr,[e(`span`,Sr,i(t.$t(`kling.name.motionVideo`)),1),a(h,{content:t.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),a(b,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage===void 0?o(``,!0):(g(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var wr=I(vr,[[`render`,Cr],[`__scopeId`,`data-v-80320d94`]]),Tr=v({name:`MotionPromptInput`,components:{ElInput:z,InfoIcon:X},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),Er={class:`field`},Dr={class:`box`},Or={class:`title font-bold`};function kr(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,Er,[e(`div`,Dr,[e(`h2`,Or,i(t.$t(`kling.name.motionPrompt`)),1),a(d,{content:t.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Ar=I(Tr,[[`render`,kr],[`__scopeId`,`data-v-ca9fdbe5`]]),jr=`video`,Mr=v({name:`CharacterOrientationSelector`,components:{ElRadioGroup:D,ElRadioButton:E,InfoIcon:X},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||jr},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=jr)}}),Nr={class:`field`},Pr={class:`header`},Fr={class:`text-sm font-bold`};function Ir(t,n,o,c,u,d){let f=l(`info-icon`),m=l(`el-radio-button`),h=l(`el-radio-group`);return g(),s(`div`,Nr,[e(`div`,Pr,[e(`span`,Fr,i(t.$t(`kling.name.characterOrientation`)),1),a(f,{content:t.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),a(h,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,size:`small`,class:`value`},{default:p(()=>[a(m,{label:`image`},{default:p(()=>[r(i(t.$t(`kling.name.orientationImage`)),1)]),_:1}),a(m,{label:`video`},{default:p(()=>[r(i(t.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var Lr=I(Mr,[[`render`,Ir],[`__scopeId`,`data-v-7a91195b`]]),Rr=`kling-v2-6`,zr=v({name:`MotionModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},computed:{options(){return[{value:`kling-v2-6`,label:`Kling 2.6`},{value:`kling-v3`,label:`Kling 3.0`}]},value:{get(){return this.$store.state.kling?.motionConfig?.model_name||Rr},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,model_name:e})}}},mounted(){this.$store.state.kling?.motionConfig?.model_name||(this.value=Rr)}}),Br={class:`field`},Vr={class:`header`},Hr={class:`title font-bold`};function Ur(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Br,[e(`div`,Vr,[e(`h2`,Hr,i(t.$t(`kling.name.motionModel`)),1),a(m,{content:t.$t(`kling.description.motionModel`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Wr=I(zr,[[`render`,Ur],[`__scopeId`,`data-v-480e8da2`]]),Gr=`std`,Kr=v({name:`MotionModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.motionConfig?.mode||Gr},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=Gr)}}),qr={class:`field`},Jr={class:`header`},Yr={class:`title font-bold`};function Xr(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,qr,[e(`div`,Jr,[e(`h2`,Yr,i(t.$t(`kling.name.mode`)),1),a(m,{content:t.$t(`kling.description.motionMode`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Zr=I(Kr,[[`render`,Xr],[`__scopeId`,`data-v-1295688c`]]),Qr=v({name:`KeepOriginalSoundSelector`,components:{ElSwitch:j,InfoIcon:X},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`})}}}}),$r={class:`relative`},ei={class:`flex justify-between items-center`},ti={class:`flex justify-start items-center`},ni={class:`text-sm font-bold`};function ri(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,$r,[e(`div`,ei,[e(`div`,ti,[e(`span`,ni,i(t.$t(`kling.name.keepOriginalSound`)),1),a(d,{content:t.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e},null,8,[`modelValue`])])])}var ii=v({name:`MotionPanel`,components:{MagicIcon:P,ElButton:R,Consumption:Y,MotionImage:_r,MotionVideo:wr,MotionPromptInput:Ar,CharacterOrientationSelector:Lr,MotionModelSelector:Wr,MotionModeSelector:Zr,KeepOriginalSoundSelector:I(Qr,[[`render`,ri]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return L({...this.motionConfig,duration:1},this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){let e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit(`generate`)}}}),ai={class:`flex flex-col h-full`},oi={class:`flex-1 overflow-y-auto p-5`},si={class:`flex flex-col items-center justify-center px-5 pb-5`};function ci(t,n,o,c,u,d){let f=l(`motion-image`),m=l(`motion-video`),h=l(`motion-prompt-input`),_=l(`character-orientation-selector`),v=l(`motion-model-selector`),y=l(`motion-mode-selector`),b=l(`keep-original-sound-selector`),x=l(`consumption`),S=l(`magic-icon`),C=l(`el-button`);return g(),s(`div`,ai,[e(`div`,oi,[a(f,{class:`mb-3`}),a(m,{class:`mb-3`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`})]),e(`div`,si,[a(x,{value:t.consumption,service:t.service,"rate-unit":t.$t(`kling.name.perSecond`),note:t.$t(`kling.message.motionPricingNote`)},null,8,[`value`,`service`,`rate-unit`,`note`]),a(C,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(S,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var li=I(ii,[[`render`,ci]]),ui=v({name:`KlingTabSwitcher`,components:{ElTabs:x,ElTabPane:S,ElTag:fe},props:{modelValue:{type:String,default:`videos`}},emits:[`update:modelValue`],computed:{tabs(){return[{value:`videos`,label:this.$t(`kling.tab.videoGeneration`)},{value:`motion`,label:this.$t(`kling.tab.motionControl`)},{value:`talking-photo`,label:this.$t(`kling.tab.talkingPhoto`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),di=[`title`],fi={class:`text`};function pi(t,n,a,u,d,m){let _=l(`el-tag`),v=l(`el-tab-pane`),y=l(`el-tabs`);return g(),f(y,{"model-value":t.modelValue,class:`kling-tabs scenario-tabs scenario-tabs--divided`,stretch:``,"onUpdate:modelValue":t.onUpdate},{default:p(()=>[(g(!0),s(c,null,h(t.tabs,t=>(g(),f(v,{key:t.value,name:t.value,disabled:t.disabled},{label:p(()=>[e(`span`,{class:`tab-label`,title:t.disabled?t.disabledReason:void 0},[e(`span`,fi,i(t.label),1),t.badge?(g(),f(_,{key:0,size:`small`,type:`warning`,class:`badge`},{default:p(()=>[r(i(t.badge),1)]),_:2},1024)):o(``,!0)],8,di)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var mi=I(ui,[[`render`,pi],[`__scopeId`,`data-v-4c7b6046`]]),hi={"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`},gi=v({name:`TalkingPhotoModelSelector`,components:{ElSelect:y,ElOption:b},data(){return{options:le.map(e=>({value:e,label:hi[e]||e}))}},computed:{value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.model||`kling-v2-1-master`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,model:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.model||(this.value=ce)}}),_i={class:`field`},vi={class:`title font-bold`};function yi(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,_i,[e(`h2`,vi,i(t.$t(`kling.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var bi=I(gi,[[`render`,yi],[`__scopeId`,`data-v-cbc83d11`]]),xi=v({name:`TalkingPhotoModeSelector`,components:{ElSelect:y,ElOption:b},computed:{options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`)},{value:`pro`,label:this.$t(`kling.name.modePro`)}]},value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.mode||`pro`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,mode:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.mode||(this.value=`pro`)}}),Si={class:`field`},Ci={class:`title font-bold`};function wi(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Si,[e(`h2`,Ci,i(t.$t(`kling.name.mode`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ti=v({name:`TalkingPhotoPanel`,components:{MagicIcon:P,UploadIcon:N,ElUpload:C,ElButton:R,ElInput:z,Consumption:Y,InfoIcon:X,ImagePreview:J,ModelSelector:bi,ModeSelector:I(xi,[[`render`,wi],[`__scopeId`,`data-v-92525a1d`]])},mixins:[H],emits:[`generate`],data(){return{imageFiles:[],audioFiles:[],uploadUrl:G()+`/api/v1/files/`}},computed:{config(){return this.$store.state.kling?.talkingPhotoConfig||{}},audioUrl(){return this.config.audio_url},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},service(){return this.$store.state.kling?.service},consumption(){return L({...this.config,action:`talking-photo`},this.service?.cost)},canGenerate(){return!!(this.config.image_url&&this.config.audio_url)}},methods:{commit(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.config,...e})},onPromptChange(e){this.commit({prompt:e})},onImageExceed(){U.warning(this.$t(`kling.message.uploadReferencesExceed`))},onImageError(){U.error(this.$t(`kling.message.uploadReferencesError`))},onImageSuccess(e){this.commit({image_url:e?.file_url})},onImageRemove(e){this.imageFiles.splice(this.imageFiles.indexOf(e),1),this.commit({image_url:void 0})},onAudioExceed(){U.warning(this.$t(`kling.message.uploadAudioExceed`))},onAudioError(){U.error(this.$t(`kling.message.uploadAudioError`))},onAudioSuccess(e){this.commit({audio_url:e?.file_url})},onAudioRemove(){this.commit({audio_url:void 0})},onGenerate(){this.$emit(`generate`)}}}),Ei={class:`flex flex-col h-full`},Di={class:`flex-1 overflow-y-auto p-5`},Oi={class:`relative mb-4`},ki={class:`flex justify-start items-center`},Ai={class:`text-sm font-bold`},ji={class:`relative mb-4`},Mi={class:`flex justify-start items-center`},Ni={class:`text-sm font-bold`},Pi=[`src`],Fi={class:`mb-4`},Ii={class:`flex justify-start items-center`},Li={class:`text-sm font-bold`},Ri={class:`flex flex-col items-center justify-center px-5 pb-5`};function zi(t,n,c,u,d,m){let h=l(`model-selector`),_=l(`mode-selector`),v=l(`info-icon`),y=l(`image-preview`),b=l(`upload-icon`),x=l(`el-button`),S=l(`el-upload`),C=l(`el-input`),w=l(`consumption`),T=l(`magic-icon`);return g(),s(`div`,Ei,[e(`div`,Di,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),e(`div`,Oi,[e(`div`,ki,[e(`span`,Ai,i(t.$t(`kling.name.talkingPhotoImage`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoImage`)},null,8,[`content`])]),a(S,{ref:`imageUploader`,"file-list":t.imageFiles,"onUpdate:fileList":n[0]||=e=>t.imageFiles=e,name:`file`,accept:`.png,.jpg,.jpeg,.webp,.bmp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,headers:t.headers,"on-exceed":t.onImageExceed,"on-error":t.onImageError,"on-success":t.onImageSuccess},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(y,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onImageRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(b,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`])]),e(`div`,ji,[e(`div`,Mi,[e(`span`,Ni,i(t.$t(`kling.name.talkingPhotoAudio`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoAudio`)},null,8,[`content`])]),a(S,{ref:`audioUploader`,"file-list":t.audioFiles,"onUpdate:fileList":n[1]||=e=>t.audioFiles=e,name:`file`,accept:`.mp3,.wav,.m4a,.aac`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,headers:t.headers,"on-exceed":t.onAudioExceed,"on-error":t.onAudioError,"on-success":t.onAudioSuccess,"on-remove":t.onAudioRemove},{default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn`},{default:p(()=>[a(b,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadAudio`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`]),t.audioUrl?(g(),s(`audio`,{key:0,src:t.audioUrl,controls:``,class:`w-full mt-2`},null,8,Pi)):o(``,!0)]),e(`div`,Fi,[e(`div`,Ii,[e(`span`,Li,i(t.$t(`kling.name.talkingPhotoPrompt`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoPrompt`)},null,8,[`content`])]),a(C,{"model-value":t.config.prompt,type:`textarea`,rows:2,placeholder:t.$t(`kling.placeholder.talkingPhotoPrompt`),class:`mt-1`,"onUpdate:modelValue":t.onPromptChange},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])])]),e(`div`,Ri,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generateTalkingPhoto`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Bi=I(Ti,[[`render`,zi],[`__scopeId`,`data-v-1cf65bf0`]]),Vi=v({name:`TaskPreview`,components:{ChannelIcon:te,InfoIcon:ie,MagicIcon:P,TimeIcon:ee,WarningIcon:oe,CopyToClipboard:he,ElAlert:T,VideoPlayer:be,ElTooltip:w,ElButton:R,ImagePreview:J,VideoPreview:Ce,AudioPreview:we,ApiCodeButton:xe},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{isFailure(){let e=this.modelValue?.response;return e?.success===!1||!!e?.error||e?.state===`failed`||e?.state===`cancelled`},isWaiting(){let e=this.modelValue?.response;return!e||!this.isFailure&&e.success!==!0&&!e.video_url},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,r=this.modelValue?.request?.image_url;return t&&e.push({url:t,name:`start-image`}),n&&e.push({url:n,name:`end-image`}),r&&e.push({url:r,name:`reference-image`}),e},referenceVideos(){let e=[],t=this.modelValue?.request?.video_url;t&&e.push({url:t,name:`reference-video`});let n=this.modelValue?.request?.video_list;return(Array.isArray(n)?n:[]).forEach((t,n)=>{t?.video_url&&e.push({url:t.video_url,name:`reference-video-${n+1}`})}),e},referenceAudios(){let e=this.modelValue?.request?.audio_url;return e?[{url:e,name:`reference-audio`}]:[]}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Hi={class:`preview`},Ui={class:`left`},Wi={class:`main`},Gi={class:`bot`},Ki={class:`datetime`},qi={class:`info`},Ji={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Yi={key:1,class:`prompt mt-2`},Xi={key:0},Zi={key:1},Qi={key:0,class:n({content:!0,failed:!0})},$i={key:0,class:`mb-4`},ea={key:1,class:n({operations:!0,"mt-2":!0})},ta={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},na={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ra={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ia={key:1,class:n({content:!0})},aa={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},oa={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sa={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ca={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},la={key:2,class:n({content:!0})},ua={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},da={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function fa(t,n,u,d,m,_){let v=l(`capability-presentation`),y=l(`image-preview`),b=l(`video-preview`),x=l(`audio-preview`),S=l(`video-player`),C=l(`el-button`),w=l(`el-tooltip`),T=l(`api-code-button`),E=l(`channel-icon`),D=l(`magic-icon`),O=l(`copy-to-clipboard`),k=l(`time-icon`),A=l(`el-alert`),j=l(`warning-icon`),M=l(`info-icon`);return g(),s(`div`,Hi,[e(`div`,Ui,[a(v,{capability:`kling`,part:`avatar`,class:`avatar`})]),e(`div`,Wi,[e(`div`,Gi,[a(v,{capability:`kling`,part:`name`}),e(`span`,Ki,i(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,qi,[t.referenceImages.length>0||t.referenceVideos.length>0||t.referenceAudios.length>0?(g(),s(`div`,Ji,[(g(!0),s(c,null,h(t.referenceImages,(e,t)=>(g(),f(y,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(t.referenceVideos,(e,t)=>(g(),f(b,{key:`video-${t}`,url:e.url,name:e.name},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(t.referenceAudios,(e,t)=>(g(),f(x,{key:`audio-${t}`,url:e.url,name:e.name},null,8,[`url`,`name`]))),128))])):o(``,!0),t.modelValue?.request?.prompt?(g(),s(`p`,Yi,[r(i(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?t.isWaiting?(g(),s(`span`,Zi,` - (`+i(t.$t(`kling.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,Xi,` - (`+i(t.$t(`kling.status.pending`))+`) `,1))])):o(``,!0)]),t.modelValue?.response?.success===!0&&!t.isFailure?(g(),s(`div`,Qi,[t.modelValue?.response.video_url?(g(),s(`div`,$i,[a(S,{src:t.modelValue?.response.video_url},null,8,[`src`])])):o(``,!0),t.modelValue?.response.success?(g(),s(`div`,ea,[a(w,{class:`box-item`,effect:`dark`,content:t.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:p(()=>[t.modelValue?.response.video_url?(g(),f(C,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:n[0]||=e=>t.onDownload(e,t.modelValue?.response.video_url)},{default:p(()=>[r(i(t.$t(`kling.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(T,{path:`/kling/videos`,body:t.modelValue?.request},null,8,[`body`])])):o(``,!0),a(A,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,ta,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.model`))+`: `+i(t.modelValue?.request?.model),1)]),e(`p`,na,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(O,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(g(),s(`p`,ra,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),t.isFailure?(g(),s(`div`,ia,[a(A,{closable:!1,class:`failure`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.failure`)),1)]),default:p(()=>[e(`p`,aa,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(O,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,oa,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.failureReason`))+`: `+i(t.modelValue?.response?.error?.message)+` `,1),a(O,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(g(),s(`p`,sa,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),t.modelValue?.response?.trace_id?(g(),s(`p`,ca,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.traceId`))+`: `+i(t.modelValue?.response?.trace_id)+` `,1),a(O,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),t.isWaiting?(g(),s(`div`,la,[a(A,{closable:!1,class:`info`},{template:p(()=>[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(t.modelValue?.response?`kling.status.processing`:`kling.status.pending`)),1)]),default:p(()=>[e(`p`,ua,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(O,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(g(),s(`p`,da,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.name.traceId`))+`: `+i(t.modelValue?.response?.trace_id)+` `,1),a(O,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var pa=v({name:`RecentPanel`,components:{TaskPreview:I(Vi,[[`render`,fa],[`__scopeId`,`data-v-d5f75276`]]),NoTasks:ve,BotPlaceholder:Se,ScrollList:_e},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?.()}}}),ma={key:0},ha={key:2,class:`w-full h-full flex items-center justify-center`};function ga(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,ma,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`h-full w-full overflow-y-auto tasks`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,e=>(g(),f(m,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,ha,[a(v)])):o(``,!0)],64)}var _a=v({name:`KlingIndex`,components:{ConfigPanel:ur,MotionPanel:li,TalkingPhotoPanel:Bi,TabSwitcher:mi,Layout:Ae,RecentPanel:I(pa,[[`render`,ga]])},mixins:[de],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===me.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===me.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},talkingPhotoConfig(){return this.$store.state.kling.talkingPhotoConfig},taskType(){return this.$store.state.kling.taskType||`videos`},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ye({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(!ue(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let{camera_control:e,...t}=this.config||{},n={...t,async:!0},r=Number(!!n.start_image_url)+Number(!!n.end_image_url),i=n.image_list?.length||0,a=n.video_list?.length?4:7;if(r+i>a){U.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:a}));return}if(n.video_list?.[0]?.refer_type===`base`&&(n.start_image_url||n.end_image_url||n.image_list?.some(({type:e})=>e))){U.warning(this.$t(`kling.message.baseVideoFrameConflict`));return}if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){U.warning(this.$t(`kling.message.endImageRequiresStart`));return}if(n.action||(n.video_id||t.video_url?n.action=`extend`:n.start_image_url?n.action=`image2video`:n.action=`text2video`),n.action===`text2video`&&n.end_image_url&&delete n.end_image_url,e?.type&&(n.camera_control={type:e.type,...e.type===`simple`&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,e])=>e!=null))}:{}}),!W())return;let o=this.credential?.token;if(!o){console.error(`no token specified`);return}U.info(this.$t(`kling.message.startingTask`)),K(`kling`,B.generate(n,{token:o})).then(()=>{U.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`kling.message.usedUp`)):U.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(!ue(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){U.warning(this.$t(`kling.message.motionMissingInputs`));return}let t={image_url:e.image_url,video_url:e.video_url,character_orientation:e.character_orientation||`video`,mode:e.mode||`std`,keep_original_sound:e.keep_original_sound??`yes`,...e.model_name?{model_name:e.model_name}:{},...e.prompt?{prompt:e.prompt}:{},async:!0};if(!W())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}U.info(this.$t(`kling.message.startingTask`)),K(`kling`,B.motion(t,{token:n})).then(()=>{U.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`kling.message.usedUp`)):U.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},async onGenerateTalkingPhoto(){if(!ue(this.uploadTracker,e=>this.$t(e),e=>U.warning(e)))return;let e=this.talkingPhotoConfig||{};if(!e.image_url||!e.audio_url){U.warning(this.$t(`kling.message.talkingPhotoMissingInputs`));return}let t={image_url:e.image_url,audio_url:e.audio_url,model:e.model||`kling-v2-1-master`,mode:e.mode||`pro`,...e.prompt?{prompt:e.prompt}:{},...e.duration?{duration:e.duration}:{},async:!0};if(!W())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}U.info(this.$t(`kling.message.startingTask`)),K(`kling`,B.talkingPhoto(t,{token:n})).then(()=>{U.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`kling.message.usedUp`)):U.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),va={class:`flex flex-col h-full`},ya={class:`flex-1 min-h-0`};function ba(t,n,r,i,s,c){let u=l(`tab-switcher`),d=l(`config-panel`),m=l(`motion-panel`),h=l(`talking-photo-panel`),_=l(`recent-panel`),v=l(`layout`);return g(),f(v,null,{config:p(()=>[e(`div`,va,[a(u,{"model-value":t.taskType,"onUpdate:modelValue":t.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),e(`div`,ya,[t.taskType===`videos`?(g(),f(d,{key:0,onGenerate:t.onGenerate},null,8,[`onGenerate`])):t.taskType===`motion`?(g(),f(m,{key:1,onGenerate:t.onGenerateMotion},null,8,[`onGenerate`])):t.taskType===`talking-photo`?(g(),f(h,{key:2,onGenerate:t.onGenerateTalkingPhoto},null,8,[`onGenerate`])):o(``,!0)])])]),result:p(()=>[a(_,{ref:`recentPanel`,loading:t.loadingMore,onReachTop:t.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var xa=I(_a,[[`render`,ba]]);export{xa as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{n as v,r as y,t as b}from"./select-na7s3bgQ.js";import{t as x}from"./upload-BDgHWid0.js";import{t as S}from"./tooltip-PudHVhJv.js";import{t as C}from"./alert-BiY3OD0p.js";import{t as w}from"./drawer-ia4Su9NX.js";import{t as T}from"./input-number-g06X3iNk.js";import{n as E}from"./taskDrawerMixin-C6xS_bci.js";import{t as D}from"./box-BQ7-g5pH.js";import{t as O}from"./clock-BkUz3x1Q.js";import{r as k,t as A}from"./PromptTextarea-slaeK0Wc.js";import{t as j}from"./image-BGXwtQYd.js";import{t as M}from"./info-CXWcObeg.js";import{t as N}from"./triangle-alert-Dm3AU2Pk.js";import{t as P}from"./upload-C-DZTzCm.js";import{t as F}from"./wand-sparkles-PR0DrnUh.js";import{t as ee}from"./zap-DzPWJlz0.js";import{Cn as te,En as I,Sn as ne,Tn as re,_n as L,bn as R,gn as z,mn as B,pn as ie,vn as V,xn as H,yn as U}from"./constants-BnLsIjUW.js";import{Bt as ae,E as W,Gt as oe,Ht as se,Mi as G,Ut as ce,Vt as le,_i as ue,ai as de,en as fe,gr as pe,ni as K,vi as q,wn as me}from"./index-BtNM5W1k.js";import{t as he}from"./CopyToClipboard-CMRvafZB.js";import{t as J}from"./ImagePreview-CK8FEzsq.js";import{t as ge}from"./Consumption-DRd8XlSO.js";import{a as Y,n as _e,r as ve,t as ye}from"./pagination-C6rVvcPs.js";import{t as be}from"./ApiCodeButton-DGSP7Ahw.js";import{t as xe}from"./BotPlaceholder-dvhs1bQC.js";import{t as Se}from"./ImageWrapper-Dl-ND9vN.js";var Ce=_({name:`LayoutSeedream`,components:{MagicIcon:F,ElDrawer:w,ElButton:G},mixins:[E]}),we={class:`main flex flex-row flex-1`},Te={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ee={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function De(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,we,[e(`div`,Te,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ee,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Oe=W(Ce,[[`render`,De],[`__scopeId`,`data-v-c10167d0`]]),ke=_({name:`SeedreamPromptInput`,components:{PromptTextarea:A},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 Ae(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var je=W(ke,[[`render`,Ae]]),Me={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 X(e){switch(e){case R:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case U:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case V:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case L:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case z:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:B[z],outputFormat:!1,tools:!1};case H:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:B[H],outputFormat:!1,tools:!1};default:return Me}}function Z(e,t){let n=X(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Ne=[`1K`,`2K`,`3K`,`4K`];function Pe(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=X(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();(Ne.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 Fe(e,t,n){let r={...e},i=X(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 Ie=_({name:`SeedreamImageInput`,components:{UploadIcon:P,ElUpload:x,ElButton:G,InfoIcon:Y,ImagePreview:J},mixins:[ce,le],data(){return{fileList:[],uploadUrl:de()+`/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 X(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(){q.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){q.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()}}}),Le={key:0},Re={class:`field`},ze={class:`label`},Be={class:`box`},Ve={class:`title font-bold`},He={class:`value`},Ue={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function We(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`upload-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return t.supported?(h(),s(`div`,Le,[e(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`h2`,Ve,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,He,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,Ue,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):o(``,!0)}var Ge=W(Ie,[[`render`,We],[`__scopeId`,`data-v-ac071e59`]]),Ke=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Y},data(){return{revertKey:0,options:[{value:R,label:this.$t(`seedream.model.seedream50pro`)},{value:U,label:this.$t(`seedream.model.seedream50`)},{value:V,label:this.$t(`seedream.model.seedream45`)},{value:L,label:this.$t(`seedream.model.seedream40`)},{value:z,label:this.$t(`seedream.model.seedream30t2i`)},{value:H,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(ie)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Pe(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await ue.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=Fe({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),q.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})}}}),qe={class:`field`},Je={class:`label`},Ye={class:`box`},Xe={class:`title font-bold`};function Ze(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,qe,[e(`div`,Je,[e(`div`,Ye,[e(`h2`,Xe,i(t.$t(`seedream.name.model`)),1),a(g,{content:t.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(h(),f(v,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`seedream.placeholder.select`),onChange:t.onChange},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Qe=W(Ke,[[`render`,Ze],[`__scopeId`,`data-v-6413c179`]]),$e=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:Y},data(){return{SEEDREAM_SIZE_ADAPTIVE:re,pixelOptions:te}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return X(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)}}}}),et={class:`field`},tt={class:`label`},nt={class:`box`},rt={class:`title font-bold`};function it(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`);return h(),s(`div`,et,[e(`div`,tt,[e(`div`,nt,[e(`h2`,rt,i(t.$t(`seedream.name.size`)),1),a(_,{content:t.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:p(()=>[t.capabilities.sizeTiers.length?(h(),f(y,{key:0,label:t.$t(`seedream.size.group.tier`)},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.sizeTiers,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),t.capabilities.sizeAdaptive?(h(),f(y,{key:1,label:t.$t(`seedream.size.group.adaptive`)},{default:p(()=>[(h(),f(v,{key:t.SEEDREAM_SIZE_ADAPTIVE,label:t.$t(`seedream.size.adaptive`),value:t.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:t.$t(`seedream.size.group.pixel`)},{default:p(()=>[(h(!0),s(c,null,m(t.pixelOptions,e=>(h(),f(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var at=W($e,[[`render`,it],[`__scopeId`,`data-v-dd7bd021`]]),ot=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:T,InfoIcon:Y},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(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)}}}),st={key:0,class:`field`},ct={class:`label`},lt={class:`box`},ut={class:`title font-bold`},dt={class:`value`};function ft(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,st,[e(`div`,ct,[e(`div`,lt,[e(`h2`,ut,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,dt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:t.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var pt=W(ot,[[`render`,ft],[`__scopeId`,`data-v-f079fd20`]]),mt=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Y},data(){return{options:[...ne]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(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)}}}}),ht={key:0,class:`field`},gt={class:`label`},_t={class:`box`},vt={class:`title font-bold`};function yt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,ht,[e(`div`,gt,[e(`div`,_t,[e(`h2`,vt,i(t.$t(`seedream.name.outputFormat`)),1),a(_,{content:t.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var bt=W(mt,[[`render`,yt],[`__scopeId`,`data-v-69ea4c07`]]),xt=_({name:`SeedreamSeedInput`,components:{ElInputNumber:T,InfoIcon:Y},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(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)}}}}),St={key:0,class:`field`},Ct={class:`label`},wt={class:`box`},Tt={class:`title font-bold`},Et={class:`value`};function Dt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,St,[e(`div`,Ct,[e(`div`,wt,[e(`h2`,Tt,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Et,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Ot=W(xt,[[`render`,Dt],[`__scopeId`,`data-v-10cdc1e0`]]),kt=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:T,InfoIcon:Y},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(this.config?.model).guidanceScale},defaultValue(){return X(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)}}}}),At={key:0,class:`field`},jt={class:`label`},Mt={class:`box`},Nt={class:`title font-bold`},Pt={class:`value`};function Ft(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,At,[e(`div`,jt,[e(`div`,Mt,[e(`h2`,Nt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Pt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var It=W(kt,[[`render`,Ft],[`__scopeId`,`data-v-7386f064`]]),Q=e=>{let t={...e||{}},n=Z(t.model,t.image);return delete t.action,t.watermark=!1,(n!==`edit`||!t.image?.length)&&delete t.image,t.size||delete t.size,t.sequential_image_generation!==`auto`&&delete t.sequential_image_generation_options,{...t,async:!0}},Lt=_({name:`SeedreamConfigPanel`,components:{MagicIcon:F,ElButton:G,PromptInput:je,Consumption:ge,ImageInput:Ge,ModelSelector:Qe,SizeSelector:at,MaxImagesSelector:pt,OutputFormatSelector:bt,SeedInput:Ot,GuidanceScaleInput:It},emits:[`generate`],computed:{action(){return Z(this.config?.model,this.config?.image)},capabilities(){return X(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=Q(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return oe({...e,action:this.action,model:I(e.model),input_image_count:e.image?.length||0,count:t},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Rt={class:`flex flex-col h-full`},zt={class:`flex-1 overflow-y-auto p-5`},Bt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Vt(t,n,c,u,d,m){let g=l(`model-selector`),_=l(`size-selector`),v=l(`max-images-selector`),y=l(`output-format-selector`),b=l(`seed-input`),x=l(`guidance-scale-input`),S=l(`prompt-input`),C=l(`image-input`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,Rt,[e(`div`,zt,[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`}),t.capabilities.image?(h(),f(C,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,Bt,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(E,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ht=W(Lt,[[`render`,Vt]]),Ut=_({name:`SeedreamTaskPreview`,components:{ApplicationIcon:D,ChannelIcon:k,ImageIcon:j,InfoIcon:M,LightningIcon:ee,MagicIcon:F,TimeIcon:O,WarningIcon:N,CopyToClipboard:he,ElAlert:C,ImageWrapper:Se,ElButton:G,ElTooltip:S,ImagePreview:J,ApiCodeButton:be},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return Q(this.modelValue?.request)},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 I(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)}}}),Wt={class:`preview`},Gt={class:`left`},Kt={class:`main`},qt={class:`bot`},Jt={class:`datetime`},Yt={class:`info`},Xt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Zt={key:1,class:`prompt mt-2`},Qt={key:0},$t={key:0,class:n({content:!0})},en={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},tn={key:1,class:n({content:!0,failed:!0})},nn={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},rn={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},an={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ln={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},un={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},_n={key:3,class:n({content:!0})},vn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function bn(u,d,g,_,v,y){let b=l(`capability-presentation`),x=l(`image-preview`),S=l(`time-icon`),C=l(`magic-icon`),w=l(`copy-to-clipboard`),T=l(`el-alert`),E=l(`image-wrapper`),D=l(`el-button`),O=l(`el-tooltip`),k=l(`api-code-button`),A=l(`application-icon`),j=l(`image-icon`),M=l(`lightning-icon`),N=l(`channel-icon`),P=l(`warning-icon`),F=l(`info-icon`);return h(),s(`div`,Wt,[e(`div`,Gt,[a(b,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,Kt,[e(`div`,qt,[a(b,{capability:`seedream`,part:`name`}),e(`span`,Jt,i(u.$dayjs.format(``+new Date(parseFloat((u.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Yt,[Array.isArray(u.modelValue?.request?.image)&&u.modelValue?.request?.image.length>0?(h(),s(`div`,Xt,[(h(!0),s(c,null,m(u.modelValue?.request?.image,(e,t)=>(h(),f(x,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(h(),s(`p`,Zt,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(h(),s(`span`,Qt,` - (`+i(u.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),u.modelValue?.response?u.modelValue?.response?.success===!0?(h(),s(`div`,tn,[e(`div`,nn,[(h(!0),s(c,null,m(u.images,(e,t)=>(h(),f(E,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,rn,[a(O,{class:`box-item`,effect:`dark`,content:u.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(D,{type:`info`,size:`small`,class:`btn-action`,onClick:d[0]||=t(e=>u.onEdit(u.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(u.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(k,{path:`/seedream/images`,body:u.apiRequest},null,8,[`body`])]),a(T,{closable:!1,class:`mt-2 success`},{default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,an,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,on,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,sn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,cn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(h(),s(`p`,$,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(w,{content:u.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):u.modelValue?.response?.success===!1?(h(),s(`div`,{key:2,class:n({content:!0,"mt-[15px]":!u.modelValue?.request?.prompt})},[a(T,{closable:!1,class:`failure`},{template:p(()=>[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failure`)),1)]),default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,un,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,dn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,fn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,pn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.error?.message?(h(),s(`p`,mn,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(w,{content:u.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),u.modelValue?.elapsed?(h(),s(`p`,hn,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,gn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(w,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})],2)):(h(),s(`div`,_n,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,vn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.trace_id?(h(),s(`p`,yn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(w,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,$t,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,en,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var xn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:W(Ut,[[`render`,bn],[`__scopeId`,`data-v-9c8af4df`]]),BotPlaceholder:xe,NoTasks:ve,ScrollList:_e},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Sn={key:0},Cn={key:2,class:`w-full h-full flex items-center justify-center`};function wn(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Sn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Cn,[a(v)])):o(``,!0)],64)}var Tn=_({name:`SeedreamIndex`,components:{ConfigPanel:Ht,Layout:Oe,RecentPanel:W(xn,[[`render`,wn]])},mixins:[se],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===K.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===K.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 ye({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(!ae(this.uploadTracker,e=>this.$t(e),e=>q.warning(e)))return;if(X(this.config?.model).imageRequired&&!this.config?.image?.length){q.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=Q(this.config);if(!fe())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}q.info(this.$t(`seedream.message.startingTask`)),pe(`seedream`,me.generate(e,{token:t})).then(()=>{q.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?q.error(this.$t(`seedream.message.usedUp`)):q.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function En(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Dn=W(Tn,[[`render`,En]]);export{Dn as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{n as v,r as y,t as b}from"./select-D-bIB0WH.js";import{t as x}from"./upload-DmyuWAhM.js";import{t as S}from"./tooltip-R5atdiIg.js";import{t as C}from"./alert-BF99s01E.js";import{t as w}from"./drawer-CxEfdDZv.js";import{t as T}from"./input-number-BIzn8YxY.js";import{n as E}from"./taskDrawerMixin-CqMO2njP.js";import{t as D}from"./box-PV6VuxAa.js";import{t as O}from"./clock-CzhmPsDw.js";import{r as k,t as A}from"./PromptTextarea-D2e6r_v-.js";import{t as j}from"./image-BO5XpnLh.js";import{t as M}from"./info-BbNN_iNp.js";import{t as N}from"./triangle-alert-B8AJf438.js";import{t as P}from"./upload-BFid7bP9.js";import{t as F}from"./wand-sparkles-J1dql9CA.js";import{t as ee}from"./zap-BptOZrqP.js";import{Cn as te,En as I,Sn as ne,Tn as re,_n as L,bn as R,gn as z,mn as B,pn as ie,vn as V,xn as H,yn as U}from"./constants-mcSzdyE5.js";import{Bt as ae,E as W,Gt as oe,Ht as se,Pi as G,Ut as ce,Vt as le,bi as K,en as ue,ii as q,si as de,vr as fe,wn as pe,yi as me}from"./index-BSsxAJiU.js";import{t as he}from"./CopyToClipboard-BZF25rbq.js";import{t as J}from"./ImagePreview-ChXS4xrI.js";import{t as ge}from"./Consumption-xkYaAMt8.js";import{a as Y,n as _e,r as ve,t as ye}from"./pagination-CmdHn0iE.js";import{t as be}from"./ApiCodeButton-C-TuDkaQ.js";import{t as xe}from"./BotPlaceholder-B7smvpFp.js";import{t as Se}from"./ImageWrapper-CfeuntPz.js";var Ce=_({name:`LayoutSeedream`,components:{MagicIcon:F,ElDrawer:w,ElButton:G},mixins:[E]}),we={class:`main flex flex-row flex-1`},Te={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ee={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function De(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,we,[e(`div`,Te,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ee,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Oe=W(Ce,[[`render`,De],[`__scopeId`,`data-v-c10167d0`]]),ke=_({name:`SeedreamPromptInput`,components:{PromptTextarea:A},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 Ae(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var je=W(ke,[[`render`,Ae]]),Me={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 X(e){switch(e){case R:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case U:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case V:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case L:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case z:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:B[z],outputFormat:!1,tools:!1};case H:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:B[H],outputFormat:!1,tools:!1};default:return Me}}function Z(e,t){let n=X(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Ne=[`1K`,`2K`,`3K`,`4K`];function Pe(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=X(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();(Ne.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 Fe(e,t,n){let r={...e},i=X(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 Ie=_({name:`SeedreamImageInput`,components:{UploadIcon:P,ElUpload:x,ElButton:G,InfoIcon:Y,ImagePreview:J},mixins:[ce,le],data(){return{fileList:[],uploadUrl:de()+`/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 X(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(){K.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){K.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()}}}),Le={key:0},Re={class:`field`},ze={class:`label`},Be={class:`box`},Ve={class:`title font-bold`},He={class:`value`},Ue={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function We(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`upload-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return t.supported?(h(),s(`div`,Le,[e(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`h2`,Ve,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,He,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,Ue,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):o(``,!0)}var Ge=W(Ie,[[`render`,We],[`__scopeId`,`data-v-ac071e59`]]),Ke=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Y},data(){return{revertKey:0,options:[{value:R,label:this.$t(`seedream.model.seedream50pro`)},{value:U,label:this.$t(`seedream.model.seedream50`)},{value:V,label:this.$t(`seedream.model.seedream45`)},{value:L,label:this.$t(`seedream.model.seedream40`)},{value:z,label:this.$t(`seedream.model.seedream30t2i`)},{value:H,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(ie)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Pe(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await me.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=Fe({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),K.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})}}}),qe={class:`field`},Je={class:`label`},Ye={class:`box`},Xe={class:`title font-bold`};function Ze(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,qe,[e(`div`,Je,[e(`div`,Ye,[e(`h2`,Xe,i(t.$t(`seedream.name.model`)),1),a(g,{content:t.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(h(),f(v,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`seedream.placeholder.select`),onChange:t.onChange},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Qe=W(Ke,[[`render`,Ze],[`__scopeId`,`data-v-6413c179`]]),$e=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:Y},data(){return{SEEDREAM_SIZE_ADAPTIVE:re,pixelOptions:te}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return X(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)}}}}),et={class:`field`},tt={class:`label`},nt={class:`box`},rt={class:`title font-bold`};function it(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`);return h(),s(`div`,et,[e(`div`,tt,[e(`div`,nt,[e(`h2`,rt,i(t.$t(`seedream.name.size`)),1),a(_,{content:t.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:p(()=>[t.capabilities.sizeTiers.length?(h(),f(y,{key:0,label:t.$t(`seedream.size.group.tier`)},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.sizeTiers,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),t.capabilities.sizeAdaptive?(h(),f(y,{key:1,label:t.$t(`seedream.size.group.adaptive`)},{default:p(()=>[(h(),f(v,{key:t.SEEDREAM_SIZE_ADAPTIVE,label:t.$t(`seedream.size.adaptive`),value:t.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:t.$t(`seedream.size.group.pixel`)},{default:p(()=>[(h(!0),s(c,null,m(t.pixelOptions,e=>(h(),f(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var at=W($e,[[`render`,it],[`__scopeId`,`data-v-dd7bd021`]]),ot=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:T,InfoIcon:Y},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(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)}}}),st={key:0,class:`field`},ct={class:`label`},lt={class:`box`},ut={class:`title font-bold`},dt={class:`value`};function ft(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,st,[e(`div`,ct,[e(`div`,lt,[e(`h2`,ut,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,dt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:t.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var pt=W(ot,[[`render`,ft],[`__scopeId`,`data-v-f079fd20`]]),mt=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Y},data(){return{options:[...ne]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(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)}}}}),ht={key:0,class:`field`},gt={class:`label`},_t={class:`box`},vt={class:`title font-bold`};function yt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,ht,[e(`div`,gt,[e(`div`,_t,[e(`h2`,vt,i(t.$t(`seedream.name.outputFormat`)),1),a(_,{content:t.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var bt=W(mt,[[`render`,yt],[`__scopeId`,`data-v-69ea4c07`]]),xt=_({name:`SeedreamSeedInput`,components:{ElInputNumber:T,InfoIcon:Y},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(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)}}}}),St={key:0,class:`field`},Ct={class:`label`},wt={class:`box`},Tt={class:`title font-bold`},Et={class:`value`};function Dt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,St,[e(`div`,Ct,[e(`div`,wt,[e(`h2`,Tt,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Et,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Ot=W(xt,[[`render`,Dt],[`__scopeId`,`data-v-10cdc1e0`]]),kt=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:T,InfoIcon:Y},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(this.config?.model).guidanceScale},defaultValue(){return X(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)}}}}),At={key:0,class:`field`},jt={class:`label`},Mt={class:`box`},Nt={class:`title font-bold`},Pt={class:`value`};function Ft(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,At,[e(`div`,jt,[e(`div`,Mt,[e(`h2`,Nt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Pt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var It=W(kt,[[`render`,Ft],[`__scopeId`,`data-v-7386f064`]]),Q=e=>{let t={...e||{}},n=Z(t.model,t.image);return delete t.action,t.watermark=!1,(n!==`edit`||!t.image?.length)&&delete t.image,t.size||delete t.size,t.sequential_image_generation!==`auto`&&delete t.sequential_image_generation_options,{...t,async:!0}},Lt=_({name:`SeedreamConfigPanel`,components:{MagicIcon:F,ElButton:G,PromptInput:je,Consumption:ge,ImageInput:Ge,ModelSelector:Qe,SizeSelector:at,MaxImagesSelector:pt,OutputFormatSelector:bt,SeedInput:Ot,GuidanceScaleInput:It},emits:[`generate`],computed:{action(){return Z(this.config?.model,this.config?.image)},capabilities(){return X(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=Q(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return oe({...e,action:this.action,model:I(e.model),input_image_count:e.image?.length||0,count:t},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Rt={class:`flex flex-col h-full`},zt={class:`flex-1 overflow-y-auto p-5`},Bt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Vt(t,n,c,u,d,m){let g=l(`model-selector`),_=l(`size-selector`),v=l(`max-images-selector`),y=l(`output-format-selector`),b=l(`seed-input`),x=l(`guidance-scale-input`),S=l(`prompt-input`),C=l(`image-input`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,Rt,[e(`div`,zt,[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`}),t.capabilities.image?(h(),f(C,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,Bt,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(E,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ht=W(Lt,[[`render`,Vt]]),Ut=_({name:`SeedreamTaskPreview`,components:{ApplicationIcon:D,ChannelIcon:k,ImageIcon:j,InfoIcon:M,LightningIcon:ee,MagicIcon:F,TimeIcon:O,WarningIcon:N,CopyToClipboard:he,ElAlert:C,ImageWrapper:Se,ElButton:G,ElTooltip:S,ImagePreview:J,ApiCodeButton:be},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return Q(this.modelValue?.request)},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 I(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)}}}),Wt={class:`preview`},Gt={class:`left`},Kt={class:`main`},qt={class:`bot`},Jt={class:`datetime`},Yt={class:`info`},Xt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Zt={key:1,class:`prompt mt-2`},Qt={key:0},$t={key:0,class:n({content:!0})},en={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},tn={key:1,class:n({content:!0,failed:!0})},nn={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},rn={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},an={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ln={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},un={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},_n={key:3,class:n({content:!0})},vn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function bn(u,d,g,_,v,y){let b=l(`capability-presentation`),x=l(`image-preview`),S=l(`time-icon`),C=l(`magic-icon`),w=l(`copy-to-clipboard`),T=l(`el-alert`),E=l(`image-wrapper`),D=l(`el-button`),O=l(`el-tooltip`),k=l(`api-code-button`),A=l(`application-icon`),j=l(`image-icon`),M=l(`lightning-icon`),N=l(`channel-icon`),P=l(`warning-icon`),F=l(`info-icon`);return h(),s(`div`,Wt,[e(`div`,Gt,[a(b,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,Kt,[e(`div`,qt,[a(b,{capability:`seedream`,part:`name`}),e(`span`,Jt,i(u.$dayjs.format(``+new Date(parseFloat((u.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Yt,[Array.isArray(u.modelValue?.request?.image)&&u.modelValue?.request?.image.length>0?(h(),s(`div`,Xt,[(h(!0),s(c,null,m(u.modelValue?.request?.image,(e,t)=>(h(),f(x,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(h(),s(`p`,Zt,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(h(),s(`span`,Qt,` - (`+i(u.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),u.modelValue?.response?u.modelValue?.response?.success===!0?(h(),s(`div`,tn,[e(`div`,nn,[(h(!0),s(c,null,m(u.images,(e,t)=>(h(),f(E,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,rn,[a(O,{class:`box-item`,effect:`dark`,content:u.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(D,{type:`info`,size:`small`,class:`btn-action`,onClick:d[0]||=t(e=>u.onEdit(u.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(u.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(k,{path:`/seedream/images`,body:u.apiRequest},null,8,[`body`])]),a(T,{closable:!1,class:`mt-2 success`},{default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,an,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,on,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,sn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,cn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(h(),s(`p`,$,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(w,{content:u.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):u.modelValue?.response?.success===!1?(h(),s(`div`,{key:2,class:n({content:!0,"mt-[15px]":!u.modelValue?.request?.prompt})},[a(T,{closable:!1,class:`failure`},{template:p(()=>[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failure`)),1)]),default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,un,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,dn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,fn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,pn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.error?.message?(h(),s(`p`,mn,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(w,{content:u.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),u.modelValue?.elapsed?(h(),s(`p`,hn,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,gn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(w,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})],2)):(h(),s(`div`,_n,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,vn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.trace_id?(h(),s(`p`,yn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(w,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,$t,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,en,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var xn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:W(Ut,[[`render`,bn],[`__scopeId`,`data-v-9c8af4df`]]),BotPlaceholder:xe,NoTasks:ve,ScrollList:_e},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Sn={key:0},Cn={key:2,class:`w-full h-full flex items-center justify-center`};function wn(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Sn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Cn,[a(v)])):o(``,!0)],64)}var Tn=_({name:`SeedreamIndex`,components:{ConfigPanel:Ht,Layout:Oe,RecentPanel:W(xn,[[`render`,wn]])},mixins:[se],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 ye({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(!ae(this.uploadTracker,e=>this.$t(e),e=>K.warning(e)))return;if(X(this.config?.model).imageRequired&&!this.config?.image?.length){K.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=Q(this.config);if(!ue())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}K.info(this.$t(`seedream.message.startingTask`)),fe(`seedream`,pe.generate(e,{token:t})).then(()=>{K.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?K.error(this.$t(`seedream.message.usedUp`)):K.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function En(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Dn=W(Tn,[[`render`,En]]);export{Dn as default};
|