@acedatacloud/nexior 3.272.0 → 3.272.1
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-8Hg0Weqj.js → ApiCodeButton-DmgbbHgv.js} +1 -1
- package/dist/assets/{AskUserQuestionCard-C3X1DtiX.js → AskUserQuestionCard-BqHFLywL.js} +5 -5
- package/dist/assets/AskUserQuestionCard-CaxXoCO4.css +1 -0
- package/dist/assets/{Auth-Tq9DJTLE.js → Auth-DeCYgNQ-.js} +1 -1
- package/dist/assets/{Bare-Cg7OqWQF.js → Bare-D2g7TWIi.js} +1 -1
- package/dist/assets/{BotPlaceholder-DuWkJHz7.js → BotPlaceholder-DdLK7DwC.js} +1 -1
- package/dist/assets/{BottomFooter-cvbYx_c6.js → BottomFooter-CjIfHdMh.js} +1 -1
- package/dist/assets/{Callback-D4-XGr38.js → Callback-8uKnd5gW.js} +1 -1
- package/dist/assets/{Console-CPKYd2h1.js → Console-fIjEqCjc.js} +1 -1
- package/dist/assets/{Consumption-CVy36l-D.js → Consumption-DiPiwllg.js} +1 -1
- package/dist/assets/{Conversation-zt1QOxko.js → Conversation-BUelWx1T.js} +1 -1
- package/dist/assets/{CopyToClipboard-16GJr0qC.js → CopyToClipboard-BvqdtQdo.js} +1 -1
- package/dist/assets/{Detail-C83rJ3A0.js → Detail-CkvtJk79.js} +2 -2
- package/dist/assets/{Extra-DK6PKUii.js → Extra-Bet8UHnl.js} +1 -1
- package/dist/assets/{FilePreview-CMxjg6m_.js → FilePreview-BhfWzt3j.js} +1 -1
- package/dist/assets/{Hailuo-CL9q-o2s.js → Hailuo-DaImuNaU.js} +1 -1
- package/dist/assets/{History-CczVtof_.js → History-Buz6IbGa.js} +1 -1
- package/dist/assets/{ImagePreview-4aD6mCco.js → ImagePreview-Cel1agBC.js} +1 -1
- package/dist/assets/{ImageWrapper-DQRRlNky.js → ImageWrapper-D4L76WuX.js} +1 -1
- package/dist/assets/{Index-D9aVjDSP.js → Index-B3YHu4KC.js} +1 -1
- package/dist/assets/{Index-DLvjUxhF.js → Index-B5G49g-6.js} +1 -1
- package/dist/assets/{Index-xRMVS3o_.js → Index-B949lS_I.js} +1 -1
- package/dist/assets/{Index-BmFlCd86.js → Index-BjrTSkOB.js} +1 -1
- package/dist/assets/{Index-CH7mKWIx.js → Index-BkT_hdus.js} +1 -1
- package/dist/assets/{Index-BTN9pqFD2.js → Index-C16XGcSA2.js} +1 -1
- package/dist/assets/{Index-C8nOQFa9.js → Index-C50ClBNG.js} +1 -1
- package/dist/assets/{Index-Coy2BQHB.js → Index-C82mVBtq.js} +1 -1
- package/dist/assets/{Index-BS_1ZKxC.js → Index-CSs5_J7s.js} +1 -1
- package/dist/assets/{Index-_3hINuq2.js → Index-Ckikz9nL.js} +1 -1
- package/dist/assets/{Index-l6aVEYMA.js → Index-Cog_vg19.js} +1 -1
- package/dist/assets/{Index-DnpPvTAX.js → Index-CwCsz8IS.js} +1 -1
- package/dist/assets/{Index-DgJY57Jq.js → Index-D56Gl5U0.js} +1 -1
- package/dist/assets/{Index-Bn8-eauV.js → Index-DFTWHLYR.js} +1 -1
- package/dist/assets/{Index-BPaBFFTe.js → Index-DWk_ajm7.js} +1 -1
- package/dist/assets/{Index-uGSj6m82.js → Index-DZkgTeM-.js} +1 -1
- package/dist/assets/{Index-DysXfjZx.js → Index-DkoJlXL0.js} +1 -1
- package/dist/assets/{Index-DKS6grLB.js → Index-DoThKXvJ.js} +1 -1
- package/dist/assets/{Index-C6ysjHtz.js → Index-DzzuviGC.js} +1 -1
- package/dist/assets/{Index-Cgsnve5E.js → Index-K8gO-aDG.js} +1 -1
- package/dist/assets/{Index-Bak3wknb.js → Index-ME4gEbg6.js} +1 -1
- package/dist/assets/{Index-D68B6ix82.js → Index-RJ2QKasP2.js} +1 -1
- package/dist/assets/{Index-CatSgqSu.js → Index-a__Lr50W.js} +1 -1
- package/dist/assets/{Index-D0dxO4zN.js → Index-n0QQo3Ww.js} +1 -1
- package/dist/assets/{Index-B-E_y-pw2.js → Index-ua_TP9VB2.js} +1 -1
- package/dist/assets/{Invitees-D2u4Ik13.js → Invitees-DbZu96Ko.js} +1 -1
- package/dist/assets/{List-B9py6E9i.js → List-CFcHC1BQ.js} +1 -1
- package/dist/assets/{List-DyZY3GW6.js → List-CeQcmnkV.js} +1 -1
- package/dist/assets/{List-2zAyILVz.js → List-DVafqPMb.js} +1 -1
- package/dist/assets/{Main-BI3uKNGA.js → Main-CHVTmTmi.js} +1 -1
- package/dist/assets/{Model-DU7zOb-x.js → Model-9Iq2_30B.js} +1 -1
- package/dist/assets/{Navigator-BxULRuSY.js → Navigator-DQw6TS7u.js} +1 -1
- package/dist/assets/{NoTasks-BMBpS8O_.js → NoTasks-BvxBJO_n.js} +1 -1
- package/dist/assets/{NotFound-BACRZ5Yv.js → NotFound-Ces6ZqID.js} +1 -1
- package/dist/assets/{Pagination-BbK0Kubg.js → Pagination-CARpmT0K.js} +1 -1
- package/dist/assets/{Pay-BHP7gTMz.js → Pay-Dz29D1-Q.js} +1 -1
- package/dist/assets/{Player-C-JiQcGw.js → Player-BT1OJI1o.js} +1 -1
- package/dist/assets/{Status-_NFSQga5.js → Status-Co7VN9Zl.js} +1 -1
- package/dist/assets/{Subscribe-BC61Fl45.js → Subscribe-BkDoXW1c.js} +1 -1
- package/dist/assets/{TabSwitcher-CLXz2z2S.js → TabSwitcher-C3Kf0k0t.js} +1 -1
- package/dist/assets/{Tts-BgOJJjF4.js → Tts-B9a3WBQB.js} +1 -1
- package/dist/assets/{VideoPlayer-Qc7k-3La.js → VideoPlayer-BBb01skM.js} +1 -1
- package/dist/assets/{avatar-gSjZmP8o.js → avatar-B-kgl6b8.js} +1 -1
- package/dist/assets/{basic-BKj6DAns.js → basic-NQnNaDEK.js} +1 -1
- package/dist/assets/{chat-CMwhnvit.js → chat-CCUl7-iP.js} +1 -1
- package/dist/assets/{codingBridge-CkI9T9_S.js → codingBridge-D2GU6WEK.js} +1 -1
- package/dist/assets/{collapse-RHvn9B7u.js → collapse-DCoJLlkZ.js} +1 -1
- package/dist/assets/{createTaskActions-WgvOzAxX.js → createTaskActions-CirZ3ZjL.js} +1 -1
- package/dist/assets/{date-picker--ZqvuNIO.js → date-picker-DTkfZEzy.js} +1 -1
- package/dist/assets/{dropdown-DuboFwxv.js → dropdown-ApRxFZDH.js} +1 -1
- package/dist/assets/{esm-CpiKqaVZ.js → esm-BL86PSOV.js} +3 -3
- package/dist/assets/{esm-Ck17hZlI.js → esm-CQp8gSdR.js} +2 -2
- package/dist/assets/{esm-B2xXBlk8.js → esm-D6UTzOcl.js} +1 -1
- package/dist/assets/{esm-CSsFnkjy.js → esm-DCuOb9aF.js} +1 -1
- package/dist/assets/{esm-stn8a0er.js → esm-DLn8-aqC.js} +1 -1
- package/dist/assets/{fish-BT8xC0Mo.js → fish-D0XwmhC6.js} +1 -1
- package/dist/assets/{flux-Dt9VuJAO.js → flux-Cq1tftwS.js} +1 -1
- package/dist/assets/{hailuo-kfUxc4ko.js → hailuo-BnEyKSHm.js} +1 -1
- package/dist/assets/{headshots-iaO819_l.js → headshots-BPvvGwtB.js} +1 -1
- package/dist/assets/{image-CokNERba.js → image-DvjKNoxC.js} +1 -1
- package/dist/assets/{index-Ux3Ldhqb.js → index-Bpg44eWB.js} +3 -3
- package/dist/assets/{index.browser.esm-CztA9bhm.js → index.browser.esm-DzBgLs84.js} +1 -1
- package/dist/assets/{index.es-DA4X-U-q.js → index.es-D2Gtib5p.js} +1 -1
- package/dist/assets/{input-number-BNMZAR_X.js → input-number-Oh-d0JaX.js} +1 -1
- package/dist/assets/{kling-QUOOZhtk.js → kling-xSsQUjlg.js} +1 -1
- package/dist/assets/{luma-D6z1rxbU.js → luma-DDiKGWVj.js} +1 -1
- package/dist/assets/{midjourney-Cgfvl2yv.js → midjourney-Cd-twOLj.js} +1 -1
- package/dist/assets/{nanobanana-DMvCv-Nn.js → nanobanana-DxY6uqP0.js} +1 -1
- package/dist/assets/{openaiimage-BxTGmRSV.js → openaiimage-BpVpztMb.js} +1 -1
- package/dist/assets/{pagination-Cqd54t6s.js → pagination-BlR28kYu.js} +1 -1
- package/dist/assets/{pika-LzG3vvcY.js → pika-D6ek_DUA.js} +1 -1
- package/dist/assets/{pixverse-ChDLkYev.js → pixverse-NGrvOUF9.js} +1 -1
- package/dist/assets/{popover-Co1-Mo-L.js → popover-CcRl4vxr.js} +1 -1
- package/dist/assets/{producer-bC4G8qfX.js → producer-CvJ733bR.js} +1 -1
- package/dist/assets/{qrart-CYMS_ivJ.js → qrart-BBOZfldd.js} +1 -1
- package/dist/assets/{row-DFhFPP85.js → row-pgH1L2rc.js} +1 -1
- package/dist/assets/{seedance-CXoE4hu6.js → seedance-DfYwbJeD.js} +1 -1
- package/dist/assets/{seedream-CgSaq9am.js → seedream-C7tpvM_U.js} +1 -1
- package/dist/assets/{select-DKxozijX.js → select-BR8DyZel.js} +1 -1
- package/dist/assets/{serp-DwIIxVjj.js → serp-BPd5r_IS.js} +1 -1
- package/dist/assets/{slider-BzGULsiS.js → slider-BZdPs70x.js} +1 -1
- package/dist/assets/{solana-wallets-g2bKvN4P.js → solana-wallets-C5d77CHX.js} +2 -2
- package/dist/assets/{solana-wallets-vue-C69IHF1L.js → solana-wallets-vue-Cy6CKdZs.js} +1 -1
- package/dist/assets/{sora-CVvJj9bW.js → sora-BHfbeScD.js} +1 -1
- package/dist/assets/{suno-BhaqzltH.js → suno-BSfRKrHj.js} +1 -1
- package/dist/assets/{switch-B0qMUnX2.js → switch-D1UMnFeG.js} +1 -1
- package/dist/assets/{tabs-BgpkhqCl.js → tabs-DecpaDdx.js} +1 -1
- package/dist/assets/{upload-DnNyu5wB.js → upload-DD2n4P3p.js} +1 -1
- package/dist/assets/{veo-DV9Talsa.js → veo-DRL8dCBY.js} +1 -1
- package/dist/assets/{wan-DQvQy9v4.js → wan-BCPd-DA5.js} +1 -1
- package/dist/assets/{web-tsd_3fpH.js → web-CVcqWo5X.js} +1 -1
- package/dist/assets/{web-DPG6_k6a.js → web-D_OeX-rD.js} +1 -1
- package/dist/assets/{web-DPuM_RDy.js → web-DqbD1cTl.js} +1 -1
- package/dist/assets/{web-CpYn5lRB.js → web-VzzrXY4l.js} +1 -1
- package/dist/assets/{webextrator-C-bzkF7m.js → webextrator-DjFiPf2q.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/AskUserQuestionCard-BRVY8u28.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{Bt as e,D as t,E as n,M as r,N as i,O as a,P as o,Q as s,Ut as c,X as l,et as u,k as d,lt as f,tt as p,ut as m,v as h,x as g,y as _}from"./vendor-chart-Df3WBvr0.js";import{t as v}from"./button-Diu_mJ2H.js";import{t as y}from"./upload-DnNyu5wB.js";import{t as b}from"./drawer-B42T8GMw.js";import{n as x,r as S,t as C}from"./dropdown-DuboFwxv.js";import{t as w}from"./popover-Co1-Mo-L.js";import{At as T,E,Er as D,Nr as O,Pt as k,Tr as A,gr as j,kr as M,yr as ee}from"./index-Ux3Ldhqb.js";import"./vendor-highlight-mMg7GAOR.js";import{t as N}from"./index.es-DA4X-U-q.js";import{n as te,t as ne}from"./AskUserQuestionCard-C3X1DtiX.js";var re=o({name:`CodingBridgeNodeList`,components:{ElButton:v,FontAwesomeIcon:N},emits:[`pair`],computed:{nodes(){return this.$store.state.codingBridge?.nodes??[]},currentNodeId(){return this.$store.state.codingBridge?.currentNodeId},connection(){return this.$store.state.codingBridge?.connection??`disconnected`},connectionLabel(){return this.$t(`codingBridge.connection.${this.connection}`)},connectionDotClass(){switch(this.connection){case`connected`:return`bg-[var(--el-color-success)]`;case`connecting`:return`bg-[var(--el-color-warning)]`;case`error`:return`bg-[var(--el-color-danger)]`;default:return`bg-[var(--app-text-subtle)]`}}},methods:{onSelect(e){this.$store.dispatch(`codingBridge/selectNode`,e)},onRefresh(){this.$store.dispatch(`codingBridge/getNodes`)},async onDelete(e){try{await A.confirm(this.$t(`codingBridge.nodeList.removeConfirm`,{name:e.name}),this.$t(`codingBridge.nodeList.remove`),{confirmButtonText:this.$t(`codingBridge.nodeList.remove`),cancelButtonText:this.$t(`common.button.cancel`),type:`warning`})}catch{return}try{await this.$store.dispatch(`codingBridge/deleteNode`,e.node_id),D.success(this.$t(`codingBridge.nodeList.removeSuccess`))}catch{D.error(this.$t(`codingBridge.nodeList.removeFailed`))}}}}),P={class:`node-list flex flex-col h-full bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},F={class:`flex items-center justify-between px-4 py-3 border-b border-[var(--app-border-subtle)]`},I={class:`flex items-center gap-2 font-medium`},L={class:`flex items-center gap-1`},R={class:`flex items-center gap-2 px-4 py-2 text-xs border-b border-[var(--app-border-subtle)]`},z={class:`text-[var(--app-text-subtle)]`},B={class:`flex-1 overflow-y-auto`},V={key:0,class:`p-6 text-center text-sm text-[var(--app-text-subtle)]`},H={class:`mb-3`},U={key:1,class:`list-none m-0 p-0`},W=[`onClick`],G={class:`flex-1 min-w-0`},K={class:`flex items-center gap-2`},q={class:`truncate font-medium`},J=[`title`],Y={class:`text-xs text-[var(--app-text-subtle)] truncate`};function X(t,a,o,p,m,h){let v=u(`font-awesome-icon`),y=u(`el-button`);return l(),d(`div`,P,[n(`div`,F,[n(`div`,I,[i(v,{icon:`fa-solid fa-laptop-code`}),n(`span`,null,c(t.$t(`codingBridge.nodeList.title`)),1)]),n(`div`,L,[i(y,{circle:``,size:`small`,title:t.$t(`codingBridge.nodeList.refresh`),onClick:t.onRefresh},{default:f(()=>[i(v,{icon:`fa-solid fa-rotate-right`})]),_:1},8,[`title`,`onClick`]),i(y,{type:`primary`,circle:``,size:`small`,title:t.$t(`codingBridge.nodeList.pair`),onClick:a[0]||=e=>t.$emit(`pair`)},{default:f(()=>[i(v,{icon:`fa-solid fa-plus`})]),_:1},8,[`title`])])]),n(`div`,R,[n(`span`,{class:e([`inline-block w-2 h-2 rounded-full`,t.connectionDotClass])},null,2),n(`span`,z,c(t.connectionLabel),1)]),n(`div`,B,[t.nodes.length?(l(),d(`ul`,U,[(l(!0),d(g,null,s(t.nodes,r=>(l(),d(`li`,{key:r.node_id,class:e([`group flex items-center gap-3 px-4 py-3 cursor-pointer border-b border-[var(--app-border-subtle)] hover:bg-[var(--app-content-bg)]`,{"bg-[var(--app-content-bg)]":r.node_id===t.currentNodeId}]),onClick:e=>t.onSelect(r.node_id)},[i(v,{icon:`fa-solid fa-desktop`,class:`text-[var(--app-text-subtle)]`}),n(`div`,G,[n(`div`,K,[n(`span`,q,c(r.name),1),n(`span`,{class:e([`inline-block w-2 h-2 rounded-full flex-none`,r.status===`online`?`bg-[var(--el-color-success)]`:`bg-[var(--app-text-subtle)]`]),title:r.status===`online`?t.$t(`codingBridge.status.online`):t.$t(`codingBridge.status.offline`)},null,10,J)]),n(`div`,Y,c(r.status===`online`?t.$t(`codingBridge.status.online`):t.$t(`codingBridge.status.offline`)),1)]),i(y,{class:`opacity-0 group-hover:opacity-100`,text:``,circle:``,size:`small`,title:t.$t(`codingBridge.nodeList.remove`),onClick:_(e=>t.onDelete(r),[`stop`])},{default:f(()=>[i(v,{icon:`fa-solid fa-trash`})]),_:1},8,[`title`,`onClick`])],10,W))),128))])):(l(),d(`div`,V,[n(`p`,H,c(t.$t(`codingBridge.nodeList.empty`)),1),i(y,{type:`primary`,round:``,size:`small`,onClick:a[1]||=e=>t.$emit(`pair`)},{default:f(()=>[i(v,{icon:`fa-solid fa-plus`,class:`mr-1`}),r(` `+c(t.$t(`codingBridge.nodeList.pairFirst`)),1)]),_:1})]))])])}var ie=E(re,[[`render`,X]]),ae=e=>{let t=e?.questions;return Array.isArray(t)&&t.length>0&&t.every(e=>e&&typeof e.question==`string`&&Array.isArray(e.options))},Z=e=>e?(e.tool||``).toLowerCase()===`askuserquestion`?!0:ae(e.input):!1,oe=e=>({questions:e.input?.questions??[]}),se=o({name:`CodingBridgeTranscriptItem`,directives:{highlight:k},components:{FontAwesomeIcon:N,VueMarkdown:te},props:{event:{type:Object,required:!0}},computed:{commandText(){let e=this.event.input;if(!e)return``;for(let t of[`command`,`cmd`,`script`]){let n=e[t];if(typeof n==`string`&&n.trim())return n}return``},filePath(){let e=this.event.input;if(!e)return``;for(let t of[`file_path`,`filePath`,`path`,`notebook_path`,`filename`]){let n=e[t];if(typeof n==`string`&&n.trim())return n}return``},toolDescription(){let e=this.event.input?.description;return typeof e==`string`?e:``},toolIcon(){if(this.commandText)return`fa-solid fa-terminal`;let e=(this.event.tool??``).toLowerCase();return/read|cat|view/.test(e)?`fa-solid fa-file-lines`:/write|edit|create|update|insert/.test(e)?`fa-solid fa-pen`:/grep|glob|search|find|list/.test(e)?`fa-solid fa-magnifying-glass`:`fa-solid fa-code`},questionLines(){let e=(this.event.tool??``).toLowerCase(),t=this.event.input?.questions;return!(e===`askuserquestion`||Array.isArray(t))||!Array.isArray(t)?[]:t.filter(e=>e&&typeof e.question==`string`).map(e=>({header:typeof e.header==`string`?e.header:``,question:e.question}))},inputText(){let e=this.event.input;if(!e)return``;let t={};for(let[n,r]of Object.entries(e))n===`timeout`||n===`description`||(t[n]=r);if(Object.keys(t).length===0)return``;try{return JSON.stringify(t,null,2)}catch{return String(e)}},resultText(){let e=this.event.content;return typeof e==`string`&&e.length>0?e:`—`},resultLabel(){let e=[];return this.event.is_error?e.push(this.$t(`codingBridge.transcript.turnFailed`)):e.push(this.$t(`codingBridge.transcript.turnDone`)),typeof this.event.cost_usd==`number`&&this.event.cost_usd>0&&e.push(`$${this.event.cost_usd.toFixed(4)}`),e.join(` · `)},hasAttachments(){return!!this.event.attachments?.length},noticeText(){let e=this.event.subtype,t=this.event.command;if(t){if(e===`slash_unavailable`)return this.$t(`codingBridge.notice.slashUnavailable`,{command:t});if(e===`slash_codex_unsupported`)return this.$t(`codingBridge.notice.slashCodexUnsupported`,{command:t})}return this.event.text||``}}}),ce={key:0,class:`flex justify-end`},le={class:`max-w-[85%] rounded-lg px-3 py-2 bg-[var(--el-color-primary)] text-white whitespace-pre-wrap break-words`},ue=[`src`],de=[`href`],fe=[`src`],pe={key:1,class:`flex h-9 w-9 items-center justify-center rounded bg-white/15`},me={class:`min-w-0 truncate`},he={key:2},ge={key:2,class:`whitespace-pre-wrap break-words italic text-[var(--app-text-subtle)] border-l-2 border-[var(--app-border-subtle)] pl-3`},_e={key:3,class:`overflow-hidden rounded-md bg-[var(--app-sidebar-bg)] border border-[var(--app-border-subtle)]`},ve={class:`flex items-center gap-2 px-2.5 py-1.5 font-medium text-[var(--app-text-subtle)]`},ye={key:0,class:`min-w-0 truncate text-xs font-normal opacity-70`},be={key:0,class:`flex flex-col gap-1.5 px-2.5 pb-2`},xe={key:0,class:`font-medium text-[var(--app-text)]`},Se={class:`whitespace-pre-wrap break-words text-[var(--app-text-subtle)]`},Ce={key:1,class:`px-2.5 pb-2`},we={class:`flex gap-2 overflow-x-auto rounded border border-[var(--app-border-subtle)] bg-[var(--app-content-bg)] px-2.5 py-1.5 font-mono text-xs`},Te={class:`whitespace-pre-wrap break-words`},Ee={key:2,class:`px-2.5 pb-2 font-mono text-xs break-all text-[var(--app-text-subtle)]`},De={key:3,class:`m-0 overflow-x-auto whitespace-pre-wrap break-words px-2.5 pb-2 text-xs text-[var(--app-text-subtle)]`},Oe={key:5,class:`flex items-center gap-2 text-xs text-[var(--app-text-subtle)]`},ke={key:6,class:`flex items-start gap-2 rounded-md bg-[var(--app-sidebar-bg)] border border-[var(--app-border-subtle)] text-[var(--app-text-subtle)] px-3 py-2 text-xs`},Ae={class:`whitespace-pre-wrap break-words`},je={key:7,class:`rounded-md bg-[var(--el-color-danger-light-9)] text-[var(--el-color-danger)] px-3 py-2 whitespace-pre-wrap break-words`};function Me(r,o,f,h,_,v){let y=u(`font-awesome-icon`),b=u(`vue-markdown`),x=p(`highlight`);return l(),d(`div`,{class:e([`transcript-item text-sm leading-relaxed`,`kind-${r.event.kind}`])},[r.event.kind===`prompt`?(l(),d(`div`,ce,[n(`div`,le,[r.event.images&&r.event.images.length?(l(),d(`div`,{key:0,class:e([`flex flex-wrap gap-1.5`,{"mb-1.5":r.event.text||r.hasAttachments}])},[(l(!0),d(g,null,s(r.event.images,(e,t)=>(l(),d(`img`,{key:t,src:e,class:`w-16 h-16 rounded object-cover`,alt:``},null,8,ue))),128))],2)):a(``,!0),r.hasAttachments?(l(),d(`div`,{key:1,class:e([`flex flex-wrap gap-1.5`,{"mb-1.5":r.event.text}])},[(l(!0),d(g,null,s(r.event.attachments,(e,t)=>(l(),d(`a`,{key:`${e.url}-${t}`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`flex max-w-[220px] items-center gap-2 rounded-md bg-white/15 px-2 py-1.5 text-xs text-white hover:bg-white/20`},[e.type===`image`?(l(),d(`img`,{key:0,src:e.url,class:`h-9 w-9 rounded object-cover`,alt:``},null,8,fe)):(l(),d(`span`,pe,[i(y,{icon:`fa-solid fa-file`})])),n(`span`,me,c(e.name||e.url),1)],8,de))),128))],2)):a(``,!0),r.event.text?(l(),d(`span`,he,c(r.event.text),1)):a(``,!0)])])):r.event.kind===`text`?m((l(),t(b,{key:1,source:r.event.text||``,class:`markdown-body bg-transparent text-[var(--app-text)]`},null,8,[`source`])),[[x]]):r.event.kind===`thinking`?(l(),d(`div`,ge,c(r.event.text),1)):r.event.kind===`tool_use`?(l(),d(`div`,_e,[n(`div`,ve,[i(y,{icon:r.toolIcon,class:`text-[var(--el-color-primary)]`},null,8,[`icon`]),n(`span`,null,c(r.event.tool),1),r.toolDescription?(l(),d(`span`,ye,c(r.toolDescription),1)):a(``,!0)]),r.questionLines.length?(l(),d(`div`,be,[(l(!0),d(g,null,s(r.questionLines,(e,t)=>(l(),d(`div`,{key:t,class:`rounded border border-[var(--app-border-subtle)] bg-[var(--app-content-bg)] px-2.5 py-1.5 text-xs`},[e.header?(l(),d(`div`,xe,c(e.header),1)):a(``,!0),n(`div`,Se,c(e.question),1)]))),128))])):r.commandText?(l(),d(`div`,Ce,[n(`div`,we,[o[0]||=n(`span`,{class:`select-none text-[var(--el-color-success)]`},`$`,-1),n(`span`,Te,c(r.commandText),1)])])):r.filePath?(l(),d(`div`,Ee,c(r.filePath),1)):r.inputText?(l(),d(`pre`,De,c(r.inputText),1)):a(``,!0)])):r.event.kind===`tool_result`?(l(),d(`div`,{key:4,class:e([`overflow-hidden rounded-md`,r.event.is_error?`bg-[var(--el-color-danger-light-9)]`:`bg-[var(--app-sidebar-bg)]`])},[n(`pre`,{class:e([`m-0 max-h-72 overflow-auto whitespace-pre-wrap break-words px-2.5 py-2 font-mono text-xs`,r.event.is_error?`text-[var(--el-color-danger)]`:`text-[var(--app-text-subtle)]`])},c(r.resultText),3)],2)):r.event.kind===`result`?(l(),d(`div`,Oe,[i(y,{icon:r.event.is_error?`fa-solid fa-xmark`:`fa-solid fa-check`},null,8,[`icon`]),n(`span`,null,c(r.resultLabel),1)])):r.event.kind===`notice`?(l(),d(`div`,ke,[i(y,{icon:`fa-solid fa-circle-info`,class:`mt-0.5 flex-none text-[var(--el-color-primary)]`}),n(`span`,Ae,c(r.noticeText),1)])):r.event.kind===`error`?(l(),d(`div`,je,c(r.event.text),1)):a(``,!0)],2)}var Ne=E(se,[[`render`,Me],[`__scopeId`,`data-v-805ee49c`]]),Pe=o({name:`CodingBridgeDirectoryDialog`,components:{ElDialog:M,ElButton:v,FontAwesomeIcon:N},props:{visible:{type:Boolean,default:!1},initialPath:{type:String,default:``}},emits:[`update:visible`,`select`],computed:{listing(){return this.$store.state.codingBridge?.directory},loading(){return this.$store.state.codingBridge?.directoryLoading===!0},directories(){return(this.listing?.entries??[]).filter(e=>e.type===`dir`)},files(){return(this.listing?.entries??[]).filter(e=>e.type===`file`)},isEmpty(){return!!this.listing&&!this.listing.error&&(this.listing.entries??[]).length===0}},methods:{onOpen(){this.$store.dispatch(`codingBridge/browseDir`,this.initialPath||void 0)},onVisibleChange(e){this.$emit(`update:visible`,e),e||this.$store.dispatch(`codingBridge/clearDirectory`)},openDir(e){this.$store.dispatch(`codingBridge/browseDir`,e)},goParent(){this.listing?.parent&&this.$store.dispatch(`codingBridge/browseDir`,this.listing.parent)},refresh(){this.$store.dispatch(`codingBridge/browseDir`,this.listing?.path||this.initialPath||void 0)},chooseCurrent(){this.listing&&!this.listing.error&&(this.$emit(`select`,this.listing.path),this.onVisibleChange(!1))}}}),Fe={class:`flex flex-col gap-2`},Ie={class:`flex items-center gap-2 min-w-0`},Le={class:`text-xs text-[var(--app-text-subtle)] truncate flex-1`,dir:`ltr`},Re={class:`h-72 overflow-y-auto border border-[var(--app-border-subtle)] rounded-md divide-y divide-[var(--app-border-subtle)]`},ze={key:0,class:`h-full flex items-center justify-center text-sm text-[var(--app-text-subtle)]`},Be={key:1,class:`h-full flex items-center justify-center text-sm text-[var(--el-color-danger)]`},Ve=[`onClick`],He={class:`truncate`,dir:`ltr`},Ue={class:`truncate`,dir:`ltr`},We={key:0,class:`h-full flex items-center justify-center text-sm text-[var(--app-text-subtle)] py-8`},Ge={key:0,class:`text-[11px] text-[var(--app-text-subtle)] px-1`},Ke={class:`flex items-center justify-end gap-2`};function qe(e,o,p,m,h,_){let v=u(`font-awesome-icon`),y=u(`el-button`),b=u(`el-dialog`);return l(),t(b,{"model-value":e.visible,title:e.$t(`codingBridge.directory.title`),width:`520px`,"append-to-body":``,"onUpdate:modelValue":e.onVisibleChange,onOpen:e.onOpen},{footer:f(()=>[n(`div`,Ke,[i(y,{round:``,onClick:o[0]||=t=>e.onVisibleChange(!1)},{default:f(()=>[r(c(e.$t(`common.button.cancel`)),1)]),_:1}),i(y,{type:`primary`,round:``,disabled:!e.listing||!!e.listing.error,onClick:e.chooseCurrent},{default:f(()=>[r(c(e.$t(`codingBridge.directory.choose`)),1)]),_:1},8,[`disabled`,`onClick`])])]),default:f(()=>[n(`div`,Fe,[n(`div`,Ie,[i(y,{size:`small`,circle:``,disabled:!e.listing||!e.listing.parent||e.loading,title:e.$t(`codingBridge.directory.up`),onClick:e.goParent},{default:f(()=>[i(v,{icon:`fa-solid fa-arrow-up`})]),_:1},8,[`disabled`,`title`,`onClick`]),n(`span`,Le,c(e.listing?e.listing.path:`…`),1),i(y,{size:`small`,circle:``,disabled:e.loading,title:e.$t(`codingBridge.directory.refresh`),onClick:e.refresh},{default:f(()=>[i(v,{icon:`fa-solid fa-rotate-right`,spin:e.loading},null,8,[`spin`])]),_:1},8,[`disabled`,`title`,`onClick`])]),n(`div`,Re,[e.loading&&!e.listing?(l(),d(`div`,ze,c(e.$t(`codingBridge.directory.loading`)),1)):e.listing&&e.listing.error?(l(),d(`div`,Be,c(e.listing.error),1)):(l(),d(g,{key:2},[(l(!0),d(g,null,s(e.directories,t=>(l(),d(`button`,{key:t.path,type:`button`,class:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[var(--app-content-hover-bg)]`,onClick:n=>e.openDir(t.path)},[i(v,{icon:`fa-solid fa-folder`,class:`text-[var(--el-color-warning)]`}),n(`span`,He,c(t.name),1)],8,Ve))),128)),(l(!0),d(g,null,s(e.files,e=>(l(),d(`div`,{key:e.path,class:`w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--app-text-subtle)]`},[i(v,{icon:`fa-solid fa-file`}),n(`span`,Ue,c(e.name),1)]))),128)),e.isEmpty?(l(),d(`div`,We,c(e.$t(`codingBridge.directory.empty`)),1)):a(``,!0)],64))]),e.listing&&e.listing.truncated?(l(),d(`p`,Ge,c(e.$t(`codingBridge.directory.truncated`)),1)):a(``,!0)])]),_:1},8,[`model-value`,`title`,`onUpdate:modelValue`,`onOpen`])}var Je=E(Pe,[[`render`,qe]]),Ye=`data:image/svg+xml,%3csvg%20fill='%23D97757'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClaude%3c/title%3e%3cpath%20d='m4.7144%2015.9555%204.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608%201.5179.1032%202.2767.1578%201.6514.0972%202.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973%209.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686%201.9064%201.4754%202.4893%201.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335%206.6997%200l.9957.1336.419.3642.6192%201.4147%201.0018%202.2282%201.5543%203.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853%201.8517-.5586%202.9021-.3643%201.9429h.2125l.2429-.2429.9835-1.3053%201.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759%201.1293-.34%201.1657-1.0625%201.3478-.8804%201.1414-1.2628%201.7-.7893%201.36.0729.1093.1882-.0183%202.8535-.607%201.5421-.2794%201.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607%201.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929%201.0686%202.0035%201.8092%202.5075%202.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496%202.3436%203.5214.1214%201.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38%2017.959l-1.1414-1.9428-.1397.079-.674%207.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328%201.9672-2.1796%202.9446-1.7243%201.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889%202.386-3.0357%201.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385%204.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429%201.9064-1.3114Z'/%3e%3c/svg%3e`,Xe=`data:image/svg+xml,%3csvg%20fill='%23000000'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eOpenAI%3c/title%3e%3cpath%20d='M22.282%209.821a5.985%205.985%200%200%200-.516-4.91%206.046%206.046%200%200%200-6.51-2.9A6.065%206.065%200%200%200%204.981%204.18a5.985%205.985%200%200%200-3.998%202.9%206.046%206.046%200%200%200%20.743%207.097%205.98%205.98%200%200%200%20.51%204.911%206.051%206.051%200%200%200%206.515%202.9A5.985%205.985%200%200%200%2013.26%2024a6.056%206.056%200%200%200%205.772-4.206%205.99%205.99%200%200%200%203.997-2.9%206.056%206.056%200%200%200-.747-7.073zM13.26%2022.43a4.476%204.476%200%200%201-2.876-1.04l.141-.081%204.779-2.758a.795.795%200%200%200%20.392-.681v-6.737l2.02%201.168a.071.071%200%200%201%20.038.052v5.583a4.504%204.504%200%200%201-4.494%204.494zM3.6%2018.304a4.47%204.47%200%200%201-.535-3.014l.142.085%204.783%202.759a.771.771%200%200%200%20.78%200l5.843-3.369v2.332a.08.08%200%200%201-.033.062L9.74%2019.95a4.5%204.5%200%200%201-6.14-1.646zM2.34%207.896a4.485%204.485%200%200%201%202.366-1.973V11.6a.766.766%200%200%200%20.388.676l5.815%203.355-2.02%201.168a.076.076%200%200%201-.071%200l-4.83-2.786A4.504%204.504%200%200%201%202.34%207.872zm16.597%203.855l-5.833-3.387L15.119%207.2a.076.076%200%200%201%20.071%200l4.83%202.791a4.494%204.494%200%200%201-.676%208.105v-5.678a.79.79%200%200%200-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776%200%200%200-.785%200L9.409%209.23V6.897a.066.066%200%200%201%20.028-.061l4.83-2.787a4.5%204.5%200%200%201%206.68%204.66zm-12.64%204.135l-2.02-1.164a.08.08%200%200%201-.038-.057V6.075a4.5%204.5%200%200%201%207.375-3.453l-.142.08L8.704%205.46a.795.795%200%200%200-.393.681zm1.097-2.365l2.602-1.5%202.607%201.5v2.999l-2.597%201.5-2.607-1.5z'/%3e%3c/svg%3e`,Ze=50*1024*1024,Q=10,Qe={claude:{src:Ye,invertOnDark:!1},codex:{src:Xe,invertOnDark:!0}},$e=o({name:`CodingBridgeSessionView`,components:{ElInput:O,ElButton:v,ElPopover:w,ElDropdown:C,ElDropdownMenu:S,ElDropdownItem:x,ElUpload:y,FontAwesomeIcon:N,TranscriptItem:Ne,DirectoryDialog:Je,AskUserQuestionCard:ne},mixins:[T],emits:[`history`],data(){return{prompt:``,cwd:``,model:``,customModelDraft:``,permissionMode:`default`,provider:`claude`,effort:``,directoryVisible:!1,slashMenuOpen:!1,slashActiveIndex:0,attachmentFileList:[],uploadUrl:ee()+`/api/v1/files/`,maxAttachments:Q}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},currentNodeId(){return this.$store.state.codingBridge?.currentNodeId},currentNode(){return this.$store.state.codingBridge?.nodes?.find(e=>e.node_id===this.currentNodeId)},nodeOnline(){return this.currentNode?.status===`online`},currentSessionId(){return this.$store.state.codingBridge?.currentSessionId},currentSession(){let e=this.currentSessionId;return e?this.$store.state.codingBridge?.sessions?.[e]:void 0},events(){let e=this.currentSessionId;return e?this.$store.state.codingBridge?.events?.[e]??[]:[]},pendingQuestion(){let e=this.currentSessionId;if(!e)return;let t=(this.$store.state.codingBridge?.permissions??[]).find(t=>t.session_id===e&&Z(t));return t?{request_id:t.request_id,payload:oe(t)}:void 0},isNewSession(){return!this.currentSessionId},readonly(){return this.currentSession?.readonly===!0},resumeHint(){return!!this.currentSession?.provider&&!this.currentSession?.started&&!this.readonly},replayLabel(){return!this.currentSession?.provider||this.currentSession?.started?``:this.currentSession.provider===`codex`?this.$t(`codingBridge.history.codexLabel`):this.$t(`codingBridge.history.claudeLabel`)},running(){let e=this.currentSession?.status;return e===`running`||e===`starting`},connected(){return this.$store.state.codingBridge?.connection===`connected`},attachments(){return(this.attachmentFileList||[]).map(e=>{let t=e.response?.file_url||(typeof e.url==`string`&&!e.url.startsWith(`blob:`)?e.url:``);if(!t)return;let n=e.raw,r=n?.type||e.mime_type||``;return{type:this.isImageAttachment(e)?`image`:`file`,url:t,name:e.name,mime_type:r,size:n?.size}}).filter(e=>!!e)},uploadingAttachments(){return(this.attachmentFileList||[]).some(e=>this.isAttachmentUploading(e))},canSend(){return(!!this.prompt.trim()||this.attachments.length>0)&&!this.uploadingAttachments&&this.connected&&this.nodeOnline&&this.currentProviderAvailable},composerHint(){return this.uploadingAttachments?this.$t(`codingBridge.session.uploadingAttachment`):this.providerCaps.length&&!this.currentProviderAvailable?this.$t(`codingBridge.session.providerUnavailableHint`,{name:this.providerName(this.provider)}):this.resumeHint?this.$t(`codingBridge.history.resumeHint`):this.$t(`codingBridge.session.enterHint`)},nodeCapabilities(){let e=this.currentNodeId;return e?this.$store.state.codingBridge?.capabilities?.[e]:void 0},providerCaps(){return this.nodeCapabilities?.providers??[]},currentProviderCap(){return this.providerCaps.find(e=>e.name===this.provider)},currentProviderAvailable(){return this.providerCaps.length?this.currentProviderCap?.available!==!1:!0},providerOptions(){return this.providerCaps.length?this.providerCaps.map(e=>({value:e.name,label:e.label,available:e.available!==!1})):[{label:this.$t(`codingBridge.session.providerClaude`),value:`claude`,available:!0},{label:this.$t(`codingBridge.session.providerCodex`),value:`codex`,available:!0}]},modelOptions(){return this.currentProviderCap?.models??[]},allowCustomModel(){return this.currentProviderCap?.allow_custom_model??!0},effortOptions(){let e=this.currentProviderCap?.efforts;return(e&&e.length?e:[``]).map(e=>({value:e,label:this.effortLabel(e)}))},permissionModeOptions(){let e=this.currentProviderCap?.permission_modes;return(e&&e.length?e:[`default`,`acceptEdits`,`plan`,`bypassPermissions`]).map(e=>({value:e,label:this.permissionModeLabel(e)}))},sessionMeta(){let e=this.currentSession;if(!e)return``;let t=[];return e.provider&&t.push(this.providerName(e.provider)),e.cwd&&t.push(e.cwd),e.model&&t.push(e.model),t.join(` · `)},activeProviderName(){return this.currentSession?.provider||this.provider},slashCommands(){let e=this.activeProviderName;return this.providerCaps.find(t=>t.name===e)?.commands??[]},slashMatches(){let e=this.prompt.match(/^\/(\S*)$/);if(!e)return[];let t=e[1].toLowerCase();return this.slashCommands.filter(e=>[e.name,...e.aliases??[]].some(e=>e.toLowerCase().startsWith(t))).slice(0,8)},slashMenuVisible(){return this.slashMenuOpen&&this.slashMatches.length>0}},watch:{events(){this.scrollToBottom()},pendingQuestion(){this.scrollToBottom()},currentSessionId(){this.scrollToBottom(),this.syncSessionSettings()},currentNodeId(){this.requestCapabilities()},providerCaps(){if(!this.isNewSession||!this.providerCaps.length)return;let e=this.providerCaps.find(e=>e.name===this.provider);if(!e||e.available===!1){let e=this.providerCaps.find(e=>e.available!==!1);e&&(this.provider=e.name)}},provider(){this.isNewSession&&(this.model=``,this.effort=``)},prompt(e){this.slashMenuOpen=/^\/\S*$/.test(e),this.slashActiveIndex>=this.slashMatches.length&&(this.slashActiveIndex=0)}},mounted(){this.requestCapabilities(),this.syncSessionSettings()},methods:{requestCapabilities(){this.currentNodeId&&this.$store.dispatch(`codingBridge/getCapabilities`,this.currentNodeId)},effortLabel(e){let t={"":`codingBridge.session.effortDefault`,low:`codingBridge.session.effortLow`,medium:`codingBridge.session.effortMedium`,high:`codingBridge.session.effortHigh`,max:`codingBridge.session.effortMax`}[e];return t?this.$t(t):e},permissionModeLabel(e){let t={default:`codingBridge.session.permissionModeDefault`,acceptEdits:`codingBridge.session.permissionModeAcceptEdits`,plan:`codingBridge.session.permissionModePlan`,bypassPermissions:`codingBridge.session.permissionModeBypass`}[e];return t?this.$t(t):e},providerName(e){let t=this.providerCaps.find(t=>t.name===e);return t?t.label:e===`codex`?this.$t(`codingBridge.session.providerCodex`):this.$t(`codingBridge.session.providerClaude`)},providerIcon(e){return Qe[e]??null},syncSessionSettings(){let e=this.currentSession;e&&(e.provider&&(this.provider=e.provider),this.model=e.model??``,this.customModelDraft=``,e.cwd&&(this.cwd=e.cwd))},selectModel(e){this.model=e,this.customModelDraft=``,this.closeModelPopover()},applyCustomModel(){let e=this.customModelDraft.trim();e&&(this.model=e,this.customModelDraft=``,this.closeModelPopover())},closeModelPopover(){this.$refs.modelPopover?.hide?.()},onComposerEnter(e){let t=e;t.isComposing||t.keyCode===229||t.shiftKey||t.ctrlKey||t.metaKey||t.altKey||(t.preventDefault(),this.onSend())},onComposerKeydown(e){let t=e;if(this.slashMenuVisible&&!t.isComposing&&t.keyCode!==229){if(t.key===`ArrowDown`){t.preventDefault(),this.moveSlash(1);return}if(t.key===`ArrowUp`){t.preventDefault(),this.moveSlash(-1);return}if(t.key===`Escape`){t.preventDefault(),this.slashMenuOpen=!1;return}if(t.key===`Tab`||t.key===`Enter`&&!t.shiftKey){t.preventDefault(),this.applySlash(this.slashMatches[this.slashActiveIndex]);return}}t.key===`Enter`&&this.onComposerEnter(t)},moveSlash(e){let t=this.slashMatches.length;t&&(this.slashActiveIndex=(this.slashActiveIndex+e+t)%t)},applySlash(e){e&&(this.prompt=`/${e.name} `,this.slashMenuOpen=!1,this.slashActiveIndex=0)},onSend(){if(!this.canSend)return;let e=this.attachments;this.$store.dispatch(`codingBridge/sendPrompt`,{prompt:this.prompt,cwd:this.cwd,model:this.model,permissionMode:this.permissionMode,provider:this.provider,effort:this.effort,attachments:e.length?e:void 0}),this.prompt=``,this.slashMenuOpen=!1,this.slashActiveIndex=0,this.clearAttachments()},onAnswerQuestion(e){this.$store.dispatch(`codingBridge/answerQuestion`,{request_id:e.tool_use_id,output:e.output})},onSkipQuestion(e){this.$store.dispatch(`codingBridge/resolvePermission`,{request_id:e.tool_use_id,decision:`deny`})},beforeAttachmentUpload(e){return this.attachmentFileList.length>=Q?(D.warning(this.$t(`codingBridge.session.attachmentLimit`,{count:Q})),!1):e.size>Ze?(D.warning(this.$t(`codingBridge.session.attachmentTooLarge`)),!1):!0},onAttachmentChange(e){if(!e.url&&e.raw&&this.isImageAttachment(e))try{e.url=URL.createObjectURL(e.raw)}catch{}},onAttachmentSuccess(e,t){e?.file_url&&(this.revokeBlobUrl(t),t.url=e.file_url,t.response=e)},onAttachmentError(){D.error(this.$t(`codingBridge.session.attachmentUploadError`))},onAttachmentExceed(){D.warning(this.$t(`codingBridge.session.attachmentLimit`,{count:Q}))},onTriggerAttachmentUpload(){this.$nextTick(()=>{let e=this.$refs.uploader?.$el;(e?.querySelector(`input.el-upload__input`)||e?.querySelector(`input[type="file"]`))?.click()})},isAttachmentUploading(e){return e.status===`ready`||e.status===`uploading`},isImageAttachment(e){return(e.raw?.type||``).startsWith(`image/`)?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name||e.url||``)},attachmentPreviewUrl(e){return this.isImageAttachment(e)&&(e.url||e.response?.file_url)||``},removeAttachment(e,t){this.revokeBlobUrl(t),this.attachmentFileList.splice(e,1)},clearAttachments(){for(let e of this.attachmentFileList)this.revokeBlobUrl(e);this.attachmentFileList=[]},revokeBlobUrl(e){if(e.url?.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}},onInterrupt(){this.$store.dispatch(`codingBridge/interruptSession`)},openDirectory(){this.directoryVisible=!0},onDirectorySelect(e){this.cwd=e},onNewSession(){this.$store.dispatch(`codingBridge/newSession`),this.cwd=``,this.model=``,this.customModelDraft=``,this.permissionMode=`default`,this.provider=`claude`,this.effort=``,this.prompt=``,this.slashMenuOpen=!1,this.slashActiveIndex=0,this.clearAttachments()},scrollToBottom(){this.$nextTick(()=>{let e=this.$refs.transcript;e&&(e.scrollTop=e.scrollHeight)})}}}),et={class:`session-view flex flex-col h-full bg-[var(--app-content-bg)]`},tt={key:0,class:`flex-1 flex flex-col items-center justify-center text-center p-8 text-[var(--app-text-subtle)]`},nt={class:`text-sm`},rt={class:`flex items-center justify-between gap-3 px-5 py-3 border-b border-[var(--app-border-subtle)]`},it={class:`min-w-0`},at={class:`flex items-center gap-2 font-medium`},ot={class:`truncate`},st={key:0,class:`text-xs text-[var(--app-text-subtle)] truncate`},ct={key:0,class:`text-[var(--el-color-primary)]`},lt={class:`flex items-center gap-2 flex-none`},ut={key:0,class:`px-5 py-2 text-xs bg-[var(--el-color-warning-light-9)] text-[var(--el-color-warning)] border-b border-[var(--app-border-subtle)]`},dt={ref:`transcript`,class:`flex-1 overflow-y-auto px-5 py-4 flex flex-col gap-3`},ft={key:0,class:`m-auto text-center text-sm text-[var(--app-text-subtle)]`},pt={class:`border-t border-[var(--app-border-subtle)] p-3`},mt={key:0,class:`flex items-center gap-2 text-xs text-[var(--app-text-subtle)] px-1 py-2`},ht={class:`cb-composer rounded-2xl border border-[var(--app-border-subtle)] bg-[var(--app-content-bg)] px-3 py-2.5 transition-colors focus-within:border-[var(--el-color-primary-light-5)]`},gt={key:0,class:`flex flex-wrap gap-2 pb-2`},_t=[`src`,`alt`],vt={key:1,class:`flex h-8 w-8 items-center justify-center rounded bg-[var(--app-content-bg)]`},yt=[`title`],bt={key:2,class:`text-[10px] text-[var(--app-text-subtle)]`},xt=[`title`,`onClick`],St={key:1,class:`cb-slash-menu`},Ct=[`onMousedown`,`onMouseenter`],wt={class:`cb-slash-menu__name`},Tt={key:0,class:`cb-slash-menu__hint`},Et={key:1,class:`cb-slash-menu__desc`},Dt={ref:`attachmentUploadTrigger`,class:`block h-0 w-0`,"aria-hidden":`true`},Ot={class:`mt-1.5 flex items-center gap-1.5`},kt=[`title`],At={class:`flex min-w-0 flex-1 flex-wrap items-center gap-1.5`},jt={type:`button`,class:`cb-pill`},Mt=[`src`],Nt={class:`truncate`},Pt=[`src`],Ft={key:1,class:`ml-1 text-xs opacity-60`},It={key:1,class:`cb-pill cb-pill--static`},Lt=[`src`],Rt={class:`truncate`},zt={type:`button`,class:`cb-pill`},Bt={class:`truncate`},Vt={class:`cb-model-menu`},Ht={class:`truncate`},Ut=[`onClick`],Wt={class:`truncate`},Gt={key:0,class:`cb-model-custom`},Kt={type:`button`,class:`cb-pill`},qt={class:`truncate`},Jt={type:`button`,class:`cb-pill`},Yt={class:`truncate`},Xt={type:`button`,class:`cb-pill`},Zt={class:`truncate`},Qt=[`title`,`aria-label`],$t={key:3,class:`cb-pill cb-pill--static`},en={class:`truncate`},tn={class:`text-[11px] text-[var(--app-text-subtle)] mt-1 px-1`};function nn(o,p,m,v,y,b){let x=u(`font-awesome-icon`),S=u(`el-button`),C=u(`transcript-item`),w=u(`ask-user-question-card`),T=u(`el-input`),E=u(`el-upload`),D=u(`el-dropdown-item`),O=u(`el-dropdown-menu`),k=u(`el-dropdown`),A=u(`el-popover`),j=u(`directory-dialog`);return l(),d(`div`,et,[o.currentNode?(l(),d(g,{key:1},[n(`div`,rt,[n(`div`,it,[n(`div`,at,[n(`span`,ot,c(o.currentNode.name),1),n(`span`,{class:e([`inline-block w-2 h-2 rounded-full flex-none`,o.nodeOnline?`bg-[var(--el-color-success)]`:`bg-[var(--app-text-subtle)]`])},null,2)]),o.currentSession?(l(),d(`div`,st,[n(`span`,null,c(o.sessionMeta),1),o.replayLabel?(l(),d(`span`,ct,` · `+c(o.replayLabel),1)):a(``,!0)])):a(``,!0)]),n(`div`,lt,[i(S,{size:`small`,round:``,onClick:p[0]||=e=>o.$emit(`history`)},{default:f(()=>[i(x,{icon:`fa-solid fa-clock-rotate-left`,class:`mr-1`}),r(` `+c(o.$t(`codingBridge.history.button`)),1)]),_:1}),o.currentSessionId?(l(),t(S,{key:0,size:`small`,round:``,onClick:o.onNewSession},{default:f(()=>[i(x,{icon:`fa-solid fa-plus`,class:`mr-1`}),r(` `+c(o.$t(`codingBridge.session.newSession`)),1)]),_:1},8,[`onClick`])):a(``,!0)])]),o.nodeOnline?a(``,!0):(l(),d(`div`,ut,c(o.$t(`codingBridge.session.deviceOffline`)),1)),n(`div`,dt,[o.events.length?a(``,!0):(l(),d(`div`,ft,c(o.$t(`codingBridge.session.startHint`)),1)),(l(!0),d(g,null,s(o.events,e=>(l(),t(C,{key:e.id,event:e},null,8,[`event`]))),128)),o.pendingQuestion?(l(),t(w,{key:o.pendingQuestion.request_id,"tool-use-id":o.pendingQuestion.request_id,payload:o.pendingQuestion.payload,onSubmit:o.onAnswerQuestion,onSkip:o.onSkipQuestion},null,8,[`tool-use-id`,`payload`,`onSubmit`,`onSkip`])):a(``,!0)],512),n(`div`,pt,[o.readonly?(l(),d(`div`,mt,[i(x,{icon:`fa-solid fa-eye`}),n(`span`,null,c(o.$t(`codingBridge.history.readonly`)),1),i(S,{class:`ml-auto`,size:`small`,round:``,onClick:o.onNewSession},{default:f(()=>[r(c(o.$t(`codingBridge.session.newSession`)),1)]),_:1},8,[`onClick`])])):(l(),d(g,{key:1},[n(`div`,ht,[o.attachmentFileList.length?(l(),d(`div`,gt,[(l(!0),d(g,null,s(o.attachmentFileList,(e,t)=>(l(),d(`div`,{key:e.uid||e.name||t,class:`group relative flex max-w-[220px] items-center gap-2 rounded-md border border-[var(--app-border-subtle)] bg-[var(--app-sidebar-bg)] px-2 py-1.5 text-xs`},[o.attachmentPreviewUrl(e)?(l(),d(`img`,{key:0,src:o.attachmentPreviewUrl(e),class:`h-8 w-8 rounded object-cover`,alt:o.$t(`codingBridge.session.attachmentImageAlt`)},null,8,_t)):(l(),d(`span`,vt,[i(x,{icon:`fa-solid fa-file`})])),n(`span`,{class:`min-w-0 flex-1 truncate`,title:e.name},c(e.name),9,yt),o.isAttachmentUploading(e)?(l(),d(`span`,bt,c(Math.round(e.percentage||0))+`% `,1)):a(``,!0),n(`button`,{type:`button`,class:`flex h-5 w-5 items-center justify-center rounded-full text-[var(--app-text-subtle)] hover:bg-[var(--app-content-hover-bg)] hover:text-[var(--el-color-danger)]`,title:o.$t(`codingBridge.session.removeAttachment`),onClick:n=>o.removeAttachment(t,e)},[i(x,{icon:`fa-solid fa-xmark`})],8,xt)]))),128))])):a(``,!0),o.slashMenuVisible?(l(),d(`ul`,St,[(l(!0),d(g,null,s(o.slashMatches,(t,r)=>(l(),d(`li`,{key:t.name,class:e([`cb-slash-menu__item`,{"cb-slash-menu__item--active":r===o.slashActiveIndex}]),onMousedown:_(e=>o.applySlash(t),[`prevent`]),onMouseenter:e=>o.slashActiveIndex=r},[n(`span`,wt,`/`+c(t.name),1),t.argument_hint?(l(),d(`span`,Tt,c(t.argument_hint),1)):a(``,!0),t.description?(l(),d(`span`,Et,c(t.description),1)):a(``,!0)],42,Ct))),128))])):a(``,!0),i(T,{modelValue:o.prompt,"onUpdate:modelValue":p[1]||=e=>o.prompt=e,type:`textarea`,autosize:{minRows:2,maxRows:12},resize:`none`,class:`cb-composer__input`,placeholder:o.$t(`codingBridge.session.promptPlaceholder`),onKeydown:o.onComposerKeydown},null,8,[`modelValue`,`placeholder`,`onKeydown`]),i(E,{ref:`uploader`,"file-list":o.attachmentFileList,"onUpdate:fileList":p[2]||=e=>o.attachmentFileList=e,class:`h-0 w-0 overflow-hidden opacity-0`,name:`file`,action:o.uploadUrl,headers:o.headers,multiple:!0,limit:o.maxAttachments,"show-file-list":!1,"before-upload":o.beforeAttachmentUpload,"on-change":o.onAttachmentChange,"on-success":o.onAttachmentSuccess,"on-error":o.onAttachmentError,"on-exceed":o.onAttachmentExceed},{default:f(()=>[n(`span`,Dt,null,512)]),_:1},8,[`file-list`,`action`,`headers`,`limit`,`before-upload`,`on-change`,`on-success`,`on-error`,`on-exceed`]),n(`div`,Ot,[n(`button`,{type:`button`,class:`cb-icon-btn`,title:o.$t(`codingBridge.session.attachFile`),onClick:p[3]||=(...e)=>o.onTriggerAttachmentUpload&&o.onTriggerAttachmentUpload(...e)},[i(x,{icon:`fa-solid fa-paperclip`})],8,kt),n(`div`,At,[o.isNewSession?(l(),t(k,{key:0,trigger:`click`,onCommand:p[4]||=e=>o.provider=e},{dropdown:f(()=>[i(O,null,{default:f(()=>[(l(!0),d(g,null,s(o.providerOptions,n=>(l(),t(D,{key:n.value,command:n.value,disabled:!n.available},{default:f(()=>[i(x,{icon:`fa-solid fa-check`,class:e([`mr-2`,n.value===o.provider?`opacity-100`:`opacity-0`])},null,8,[`class`]),o.providerIcon(n.value)?(l(),d(`img`,{key:0,src:o.providerIcon(n.value).src,class:e([`cb-pill__brand mr-1.5`,{"cb-pill__brand--invert":o.providerIcon(n.value).invertOnDark}]),alt:``},null,10,Pt)):a(``,!0),r(` `+c(n.label)+` `,1),n.available?a(``,!0):(l(),d(`span`,Ft,c(o.$t(`codingBridge.session.providerUnavailable`)),1))]),_:2},1032,[`command`,`disabled`]))),128))]),_:1})]),default:f(()=>[n(`button`,jt,[o.providerIcon(o.provider)?(l(),d(`img`,{key:0,src:o.providerIcon(o.provider).src,class:e([`cb-pill__brand`,{"cb-pill__brand--invert":o.providerIcon(o.provider).invertOnDark}]),alt:``},null,10,Mt)):(l(),t(x,{key:1,icon:`fa-solid fa-code`,class:`cb-pill__icon`})),n(`span`,Nt,c(o.providerName(o.provider)),1),i(x,{icon:`fa-solid fa-chevron-down`,class:`cb-pill__caret`})])]),_:1})):(l(),d(`span`,It,[o.providerIcon(o.currentSession?.provider||`claude`)?(l(),d(`img`,{key:0,src:o.providerIcon(o.currentSession?.provider||`claude`).src,class:e([`cb-pill__brand`,{"cb-pill__brand--invert":o.providerIcon(o.currentSession?.provider||`claude`).invertOnDark}]),alt:``},null,10,Lt)):(l(),t(x,{key:1,icon:`fa-solid fa-code`,class:`cb-pill__icon`})),n(`span`,Rt,c(o.providerName(o.currentSession?.provider||`claude`)),1)])),i(A,{ref:`modelPopover`,trigger:`click`,placement:`top-start`,width:260},{reference:f(()=>[n(`button`,zt,[i(x,{icon:`fa-solid fa-brain`,class:`cb-pill__icon`}),n(`span`,Bt,c(o.model||o.$t(`codingBridge.session.modelDefault`)),1),i(x,{icon:`fa-solid fa-chevron-down`,class:`cb-pill__caret`})])]),default:f(()=>[n(`div`,Vt,[n(`button`,{type:`button`,class:`cb-model-option`,onClick:p[5]||=e=>o.selectModel(``)},[i(x,{icon:`fa-solid fa-check`,class:e([`cb-model-option__check`,o.model?`opacity-0`:`opacity-100`])},null,8,[`class`]),n(`span`,Ht,c(o.$t(`codingBridge.session.modelDefault`)),1)]),(l(!0),d(g,null,s(o.modelOptions,t=>(l(),d(`button`,{key:t.value,type:`button`,class:`cb-model-option`,onClick:e=>o.selectModel(t.value)},[i(x,{icon:`fa-solid fa-check`,class:e([`cb-model-option__check`,t.value===o.model?`opacity-100`:`opacity-0`])},null,8,[`class`]),n(`span`,Wt,c(t.label),1)],8,Ut))),128)),o.allowCustomModel?(l(),d(`div`,Gt,[i(T,{modelValue:o.customModelDraft,"onUpdate:modelValue":p[6]||=e=>o.customModelDraft=e,size:`small`,placeholder:o.$t(`codingBridge.session.modelPlaceholder`),onKeyup:h(o.applyCustomModel,[`enter`])},{append:f(()=>[i(S,{disabled:!o.customModelDraft.trim(),onClick:o.applyCustomModel},{default:f(()=>[i(x,{icon:`fa-solid fa-check`})]),_:1},8,[`disabled`,`onClick`])]),_:1},8,[`modelValue`,`placeholder`,`onKeyup`])])):a(``,!0)])]),_:1},512),o.isNewSession?(l(),d(g,{key:2},[o.effortOptions.length>1?(l(),t(k,{key:0,trigger:`click`,onCommand:p[7]||=e=>o.effort=e},{dropdown:f(()=>[i(O,null,{default:f(()=>[(l(!0),d(g,null,s(o.effortOptions,n=>(l(),t(D,{key:n.value,command:n.value},{default:f(()=>[i(x,{icon:`fa-solid fa-check`,class:e([`mr-2`,n.value===o.effort?`opacity-100`:`opacity-0`])},null,8,[`class`]),r(` `+c(n.label),1)]),_:2},1032,[`command`]))),128))]),_:1})]),default:f(()=>[n(`button`,Kt,[i(x,{icon:`fa-solid fa-gauge-high`,class:`cb-pill__icon`}),n(`span`,qt,c(o.effortLabel(o.effort)),1),i(x,{icon:`fa-solid fa-chevron-down`,class:`cb-pill__caret`})])]),_:1})):a(``,!0),i(k,{trigger:`click`,onCommand:p[8]||=e=>o.permissionMode=e},{dropdown:f(()=>[i(O,null,{default:f(()=>[(l(!0),d(g,null,s(o.permissionModeOptions,n=>(l(),t(D,{key:n.value,command:n.value},{default:f(()=>[i(x,{icon:`fa-solid fa-check`,class:e([`mr-2`,n.value===o.permissionMode?`opacity-100`:`opacity-0`])},null,8,[`class`]),r(` `+c(n.label),1)]),_:2},1032,[`command`]))),128))]),_:1})]),default:f(()=>[n(`button`,Jt,[i(x,{icon:`fa-solid fa-shield-halved`,class:`cb-pill__icon`}),n(`span`,Yt,c(o.permissionModeLabel(o.permissionMode)),1),i(x,{icon:`fa-solid fa-chevron-down`,class:`cb-pill__caret`})])]),_:1}),i(A,{trigger:`click`,placement:`top-start`,width:320},{reference:f(()=>[n(`button`,Xt,[i(x,{icon:`fa-solid fa-folder-open`,class:`cb-pill__icon`}),n(`span`,Zt,c(o.cwd||o.$t(`codingBridge.session.cwdDefault`)),1),i(x,{icon:`fa-solid fa-chevron-down`,class:`cb-pill__caret`})])]),default:f(()=>[i(T,{modelValue:o.cwd,"onUpdate:modelValue":p[12]||=e=>o.cwd=e,size:`small`,clearable:``,class:`cb-cwd-input`,placeholder:o.$t(`codingBridge.session.cwdPlaceholder`)},{suffix:f(()=>[n(`span`,{class:`cb-cwd-browse`,role:`button`,tabindex:`0`,title:o.$t(`codingBridge.directory.title`),"aria-label":o.$t(`codingBridge.directory.title`),onClick:p[9]||=(...e)=>o.openDirectory&&o.openDirectory(...e),onKeydown:[p[10]||=h(_((...e)=>o.openDirectory&&o.openDirectory(...e),[`prevent`]),[`enter`]),p[11]||=h(_((...e)=>o.openDirectory&&o.openDirectory(...e),[`prevent`]),[`space`])]},[i(x,{icon:`fa-solid fa-folder-open`})],40,Qt)]),_:1},8,[`modelValue`,`placeholder`])]),_:1})],64)):a(``,!0),!o.isNewSession&&o.currentSession?.cwd?(l(),d(`span`,$t,[i(x,{icon:`fa-solid fa-folder-open`,class:`cb-pill__icon`}),n(`span`,en,c(o.currentSession?.cwd),1)])):a(``,!0)]),o.running?(l(),t(S,{key:0,circle:``,onClick:o.onInterrupt},{default:f(()=>[i(x,{icon:`fa-solid fa-stop`})]),_:1},8,[`onClick`])):a(``,!0),i(S,{type:`primary`,round:``,disabled:!o.canSend,onClick:o.onSend},{default:f(()=>[r(c(o.$t(`codingBridge.session.send`)),1)]),_:1},8,[`disabled`,`onClick`])])]),n(`p`,tn,c(o.composerHint),1)],64))])],64)):(l(),d(`div`,tt,[i(x,{icon:`fa-solid fa-laptop-code`,class:`text-4xl mb-3`}),n(`p`,nt,c(o.$t(`codingBridge.session.noDevice`)),1)])),i(j,{visible:o.directoryVisible,"onUpdate:visible":p[13]||=e=>o.directoryVisible=e,"initial-path":o.cwd,onSelect:o.onDirectorySelect},null,8,[`visible`,`initial-path`,`onSelect`])])}var rn=E($e,[[`render`,nn],[`__scopeId`,`data-v-6318a784`]]),an=o({name:`CodingBridgePairDialog`,components:{ElDialog:M,ElInput:O,ElButton:v,FontAwesomeIcon:N},props:{visible:{type:Boolean,default:!1},initialCode:{type:String,default:``}},emits:[`update:visible`],data(){return{code:``}},computed:{claiming(){return this.$store.state.codingBridge?.status?.claimPair===j.Request}},watch:{visible(e){e&&this.initialCode&&(this.code=this.initialCode)},initialCode(e){e&&(this.code=e)}},methods:{async onClaim(){let e=this.code.trim();if(e)try{let t=await this.$store.dispatch(`codingBridge/claimPair`,e);D.success(this.$t(`codingBridge.pair.success`,{name:t})),this.code=``,this.$emit(`update:visible`,!1)}catch(e){let t=e?.response?.status;t===404?D.error(this.$t(`codingBridge.pair.invalidCode`)):t===409?D.error(this.$t(`codingBridge.pair.usedCode`)):D.error(this.$t(`codingBridge.pair.failed`))}}}}),on={class:`content`},sn={class:`text-sm text-[var(--app-text-subtle)] mb-4`},cn={class:`steps list-none m-0 p-0 mb-4`},ln={class:`flex gap-3 mb-3`},un={class:`flex-1 min-w-0`},dn={class:`text-sm mb-1`},fn={class:`flex gap-3 mb-3`},pn={class:`flex-1 min-w-0`},mn={class:`text-sm mb-1`},hn={class:`flex gap-3`},gn={class:`flex-1 min-w-0`},_n={class:`text-sm`};function vn(e,a,o,s,d,p){let m=u(`el-input`),g=u(`font-awesome-icon`),_=u(`el-button`),v=u(`el-dialog`);return l(),t(v,{"model-value":e.visible,width:`520px`,title:e.$t(`codingBridge.pair.title`),center:``,"onUpdate:modelValue":a[1]||=t=>e.$emit(`update:visible`,t)},{default:f(()=>[n(`div`,on,[n(`p`,sn,c(e.$t(`codingBridge.pair.intro`)),1),n(`ol`,cn,[n(`li`,ln,[a[3]||=n(`span`,{class:`step-index`},`1`,-1),n(`div`,un,[n(`p`,dn,c(e.$t(`codingBridge.pair.step1`)),1),a[2]||=n(`code`,{class:`cmd`},`pip install coding-bridge-agent`,-1)])]),n(`li`,fn,[a[5]||=n(`span`,{class:`step-index`},`2`,-1),n(`div`,pn,[n(`p`,mn,c(e.$t(`codingBridge.pair.step2`)),1),a[4]||=n(`code`,{class:`cmd`},`coding-bridge-agent up`,-1)])]),n(`li`,hn,[a[6]||=n(`span`,{class:`step-index`},`3`,-1),n(`div`,gn,[n(`p`,_n,c(e.$t(`codingBridge.pair.step3`)),1)])])]),i(m,{modelValue:e.code,"onUpdate:modelValue":a[0]||=t=>e.code=t,size:`large`,class:`mb-3`,placeholder:e.$t(`codingBridge.pair.codePlaceholder`),clearable:``,onKeyup:h(e.onClaim,[`enter`])},null,8,[`modelValue`,`placeholder`,`onKeyup`]),i(_,{type:`primary`,round:``,class:`w-full`,loading:e.claiming,disabled:!e.code.trim(),onClick:e.onClaim},{default:f(()=>[i(g,{icon:`fa-solid fa-link`,class:`mr-1`}),r(` `+c(e.$t(`codingBridge.pair.claim`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])])]),_:1},8,[`model-value`,`title`])}var yn=E(an,[[`render`,vn],[`__scopeId`,`data-v-3d1ed01f`]]),bn=o({name:`CodingBridgePermissionDialog`,components:{ElDialog:M,ElButton:v,FontAwesomeIcon:N},computed:{request(){return(this.$store.state.codingBridge?.permissions??[]).find(e=>!Z(e))},hasInput(){return!!this.request?.input&&Object.keys(this.request.input).length>0},inputText(){try{return JSON.stringify(this.request?.input,null,2)}catch{return String(this.request?.input??``)}}},methods:{onAllow(){this.request&&this.$store.dispatch(`codingBridge/resolvePermission`,{request_id:this.request.request_id,decision:`allow`})},onDeny(){this.request&&this.$store.dispatch(`codingBridge/resolvePermission`,{request_id:this.request.request_id,decision:`deny`})}}}),xn={key:0,class:`content`},Sn={class:`text-sm text-[var(--app-text-subtle)] mb-3`},Cn={class:`rounded-md border border-[var(--app-border-subtle)] p-3 mb-3`},wn={class:`flex items-center gap-2 font-medium`},Tn={key:0,class:`text-xs text-[var(--app-text-subtle)] mt-1`},En={key:1,class:`mt-2 text-xs overflow-x-auto whitespace-pre-wrap break-words text-[var(--app-text-subtle)] max-h-[200px]`},Dn={class:`flex justify-end gap-2`};function On(e,o,s,p,m,h){let g=u(`font-awesome-icon`),_=u(`el-button`),v=u(`el-dialog`);return l(),t(v,{"model-value":!!e.request,width:`480px`,title:e.$t(`codingBridge.permission.title`),"close-on-click-modal":!1,"show-close":!1,center:``},{footer:f(()=>[n(`div`,Dn,[i(_,{round:``,onClick:e.onDeny},{default:f(()=>[i(g,{icon:`fa-solid fa-xmark`,class:`mr-1`}),r(` `+c(e.$t(`codingBridge.permission.deny`)),1)]),_:1},8,[`onClick`]),i(_,{type:`primary`,round:``,onClick:e.onAllow},{default:f(()=>[i(g,{icon:`fa-solid fa-check`,class:`mr-1`}),r(` `+c(e.$t(`codingBridge.permission.allow`)),1)]),_:1},8,[`onClick`])])]),default:f(()=>[e.request?(l(),d(`div`,xn,[n(`p`,Sn,c(e.$t(`codingBridge.permission.subtitle`)),1),n(`div`,Cn,[n(`div`,wn,[i(g,{icon:`fa-solid fa-code`}),n(`span`,null,c(e.request.display_name||e.request.title||e.request.tool),1)]),e.request.description?(l(),d(`p`,Tn,c(e.request.description),1)):a(``,!0),e.hasInput?(l(),d(`pre`,En,c(e.inputText),1)):a(``,!0)])])):a(``,!0)]),_:1},8,[`model-value`,`title`])}var kn=E(bn,[[`render`,On]]),An=o({name:`CodingBridgeHistoryDrawer`,components:{ElDrawer:b,ElButton:v,FontAwesomeIcon:N},props:{visible:{type:Boolean,default:!1}},emits:[`update:visible`],computed:{currentNodeId(){return this.$store.state.codingBridge?.currentNodeId},loading(){return this.$store.state.codingBridge?.status?.getHistory===j.Request},sessions(){let e=this.currentNodeId;return[...e?this.$store.state.codingBridge?.history?.[e]??[]:[]].sort((e,t)=>(t.updated_at??0)-(e.updated_at??0))}},watch:{visible(e){e&&this.currentNodeId&&this.$store.dispatch(`codingBridge/getHistory`,this.currentNodeId)}},methods:{refresh(){this.currentNodeId&&this.$store.dispatch(`codingBridge/getHistory`,this.currentNodeId)},open(e){this.currentNodeId&&(this.$store.dispatch(`codingBridge/getHistoryDetail`,{node_id:this.currentNodeId,provider:e.provider,session_id:e.session_id}),this.$emit(`update:visible`,!1))},formatTime(e){try{return new Date(e).toLocaleString()}catch{return``}}}}),jn={class:`flex flex-col h-full`},Mn={class:`flex items-center justify-between mb-3`},Nn={class:`text-xs text-[var(--app-text-subtle)] m-0`},$={key:0,class:`m-auto text-sm text-[var(--app-text-subtle)]`},Pn={key:1,class:`m-auto text-sm text-[var(--app-text-subtle)]`},Fn={key:2,class:`m-auto text-sm text-[var(--app-text-subtle)] text-center`},In={key:3,class:`list-none m-0 p-0 flex-1 overflow-y-auto flex flex-col gap-2`},Ln=[`onClick`],Rn={class:`flex items-center gap-2 mb-1`},zn={class:`text-sm font-medium truncate flex-1`},Bn={class:`text-[11px] text-[var(--app-text-subtle)] truncate`},Vn={key:0},Hn={key:1},Un={class:`text-[11px] text-[var(--app-text-subtle)] mt-0.5`},Wn={key:0},Gn={key:1};function Kn(o,p,m,h,_,v){let y=u(`font-awesome-icon`),b=u(`el-button`),x=u(`el-drawer`);return l(),t(x,{"model-value":o.visible,direction:`rtl`,size:`380px`,title:o.$t(`codingBridge.history.title`),"onUpdate:modelValue":p[0]||=e=>o.$emit(`update:visible`,e)},{default:f(()=>[n(`div`,jn,[n(`div`,Mn,[n(`p`,Nn,c(o.$t(`codingBridge.history.intro`)),1),i(b,{size:`small`,round:``,loading:o.loading,onClick:o.refresh},{default:f(()=>[o.loading?a(``,!0):(l(),t(y,{key:0,icon:`fa-solid fa-rotate-right`,class:`mr-1`})),r(` `+c(o.$t(`codingBridge.history.refresh`)),1)]),_:1},8,[`loading`,`onClick`])]),o.currentNodeId?o.loading&&!o.sessions.length?(l(),d(`div`,Pn,c(o.$t(`codingBridge.history.loading`)),1)):o.sessions.length?(l(),d(`ul`,In,[(l(!0),d(g,null,s(o.sessions,t=>(l(),d(`li`,{key:t.provider+`:`+t.session_id,class:`item rounded-lg p-3 cursor-pointer border border-[var(--app-border-subtle)]`,onClick:e=>o.open(t)},[n(`div`,Rn,[n(`span`,{class:e([`provider-tag`,t.provider])},c(t.provider===`codex`?`Codex`:`Claude`),3),n(`span`,zn,c(t.title),1)]),n(`div`,Bn,[t.cwd?(l(),d(`span`,Vn,c(t.cwd),1)):a(``,!0),t.git_branch?(l(),d(`span`,Hn,` · `+c(t.git_branch),1)):a(``,!0)]),n(`div`,Un,[t.updated_at?(l(),d(`span`,Wn,c(o.formatTime(t.updated_at)),1)):a(``,!0),t.message_count?(l(),d(`span`,Gn,` · `+c(o.$t(`codingBridge.history.messages`,{count:t.message_count})),1)):a(``,!0)])],8,Ln))),128))])):(l(),d(`div`,Fn,c(o.$t(`codingBridge.history.empty`)),1)):(l(),d(`div`,$,c(o.$t(`codingBridge.session.noDevice`)),1))])]),_:1},8,[`model-value`,`title`])}var qn=o({name:`CodingBridgeIndex`,components:{ElButton:v,ElDrawer:b,FontAwesomeIcon:N,NodeList:ie,SessionView:rn,PairDialog:yn,PermissionDialog:kn,HistoryDrawer:E(An,[[`render`,Kn],[`__scopeId`,`data-v-3414881a`]])},data(){return{drawer:!1,pairVisible:!1,historyVisible:!1,initialCode:``}},mounted(){this.$store.dispatch(`codingBridge/connect`),this.$store.dispatch(`codingBridge/getNodes`);let e=this.$route.query.code;typeof e==`string`&&e&&(this.initialCode=e,this.pairVisible=!0)},beforeUnmount(){this.$store.dispatch(`codingBridge/disconnect`)},methods:{openPair(){this.initialCode=``,this.pairVisible=!0},openPairFromDrawer(){this.drawer=!1,this.openPair()}}}),Jn={class:`coding-bridge flex flex-row h-full relative`};function Yn(e,t,n,r,a,o){let s=u(`node-list`),c=u(`session-view`),p=u(`font-awesome-icon`),m=u(`el-button`),h=u(`el-drawer`),g=u(`pair-dialog`),_=u(`permission-dialog`),v=u(`history-drawer`);return l(),d(`div`,Jn,[i(s,{class:`sidebar w-[300px] flex-none`,onPair:e.openPair},null,8,[`onPair`]),i(c,{class:`flex-1 min-w-0`,onHistory:t[0]||=t=>e.historyVisible=!0}),i(m,{circle:``,class:`menu`,onClick:t[1]||=t=>e.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-laptop-code`})]),_:1}),i(h,{modelValue:e.drawer,"onUpdate:modelValue":t[2]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`300px`,class:`drawer`},{default:f(()=>[i(s,{onPair:e.openPairFromDrawer},null,8,[`onPair`])]),_:1},8,[`modelValue`]),i(g,{visible:e.pairVisible,"onUpdate:visible":t[3]||=t=>e.pairVisible=t,"initial-code":e.initialCode},null,8,[`visible`,`initial-code`]),i(_),i(v,{visible:e.historyVisible,"onUpdate:visible":t[4]||=t=>e.historyVisible=t},null,8,[`visible`])])}var Xn=E(qn,[[`render`,Yn],[`__scopeId`,`data-v-3a406429`]]);export{Xn as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{Bt as e,D as t,E as n,M as r,N as i,O as a,P as o,Q as s,Ut as c,X as l,et as u,k as d,lt as f,tt as p,ut as m,v as h,x as g,y as _}from"./vendor-chart-Df3WBvr0.js";import{t as v}from"./button-Diu_mJ2H.js";import{t as y}from"./upload-DD2n4P3p.js";import{t as b}from"./drawer-B42T8GMw.js";import{n as x,r as S,t as C}from"./dropdown-ApRxFZDH.js";import{t as w}from"./popover-CcRl4vxr.js";import{At as T,E,Er as D,Nr as O,Pt as k,Tr as A,gr as j,kr as M,yr as ee}from"./index-Bpg44eWB.js";import"./vendor-highlight-mMg7GAOR.js";import{t as N}from"./index.es-D2Gtib5p.js";import{n as te,t as ne}from"./AskUserQuestionCard-BqHFLywL.js";var re=o({name:`CodingBridgeNodeList`,components:{ElButton:v,FontAwesomeIcon:N},emits:[`pair`],computed:{nodes(){return this.$store.state.codingBridge?.nodes??[]},currentNodeId(){return this.$store.state.codingBridge?.currentNodeId},connection(){return this.$store.state.codingBridge?.connection??`disconnected`},connectionLabel(){return this.$t(`codingBridge.connection.${this.connection}`)},connectionDotClass(){switch(this.connection){case`connected`:return`bg-[var(--el-color-success)]`;case`connecting`:return`bg-[var(--el-color-warning)]`;case`error`:return`bg-[var(--el-color-danger)]`;default:return`bg-[var(--app-text-subtle)]`}}},methods:{onSelect(e){this.$store.dispatch(`codingBridge/selectNode`,e)},onRefresh(){this.$store.dispatch(`codingBridge/getNodes`)},async onDelete(e){try{await A.confirm(this.$t(`codingBridge.nodeList.removeConfirm`,{name:e.name}),this.$t(`codingBridge.nodeList.remove`),{confirmButtonText:this.$t(`codingBridge.nodeList.remove`),cancelButtonText:this.$t(`common.button.cancel`),type:`warning`})}catch{return}try{await this.$store.dispatch(`codingBridge/deleteNode`,e.node_id),D.success(this.$t(`codingBridge.nodeList.removeSuccess`))}catch{D.error(this.$t(`codingBridge.nodeList.removeFailed`))}}}}),P={class:`node-list flex flex-col h-full bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},F={class:`flex items-center justify-between px-4 py-3 border-b border-[var(--app-border-subtle)]`},I={class:`flex items-center gap-2 font-medium`},L={class:`flex items-center gap-1`},R={class:`flex items-center gap-2 px-4 py-2 text-xs border-b border-[var(--app-border-subtle)]`},z={class:`text-[var(--app-text-subtle)]`},B={class:`flex-1 overflow-y-auto`},V={key:0,class:`p-6 text-center text-sm text-[var(--app-text-subtle)]`},H={class:`mb-3`},U={key:1,class:`list-none m-0 p-0`},W=[`onClick`],G={class:`flex-1 min-w-0`},K={class:`flex items-center gap-2`},q={class:`truncate font-medium`},J=[`title`],Y={class:`text-xs text-[var(--app-text-subtle)] truncate`};function X(t,a,o,p,m,h){let v=u(`font-awesome-icon`),y=u(`el-button`);return l(),d(`div`,P,[n(`div`,F,[n(`div`,I,[i(v,{icon:`fa-solid fa-laptop-code`}),n(`span`,null,c(t.$t(`codingBridge.nodeList.title`)),1)]),n(`div`,L,[i(y,{circle:``,size:`small`,title:t.$t(`codingBridge.nodeList.refresh`),onClick:t.onRefresh},{default:f(()=>[i(v,{icon:`fa-solid fa-rotate-right`})]),_:1},8,[`title`,`onClick`]),i(y,{type:`primary`,circle:``,size:`small`,title:t.$t(`codingBridge.nodeList.pair`),onClick:a[0]||=e=>t.$emit(`pair`)},{default:f(()=>[i(v,{icon:`fa-solid fa-plus`})]),_:1},8,[`title`])])]),n(`div`,R,[n(`span`,{class:e([`inline-block w-2 h-2 rounded-full`,t.connectionDotClass])},null,2),n(`span`,z,c(t.connectionLabel),1)]),n(`div`,B,[t.nodes.length?(l(),d(`ul`,U,[(l(!0),d(g,null,s(t.nodes,r=>(l(),d(`li`,{key:r.node_id,class:e([`group flex items-center gap-3 px-4 py-3 cursor-pointer border-b border-[var(--app-border-subtle)] hover:bg-[var(--app-content-bg)]`,{"bg-[var(--app-content-bg)]":r.node_id===t.currentNodeId}]),onClick:e=>t.onSelect(r.node_id)},[i(v,{icon:`fa-solid fa-desktop`,class:`text-[var(--app-text-subtle)]`}),n(`div`,G,[n(`div`,K,[n(`span`,q,c(r.name),1),n(`span`,{class:e([`inline-block w-2 h-2 rounded-full flex-none`,r.status===`online`?`bg-[var(--el-color-success)]`:`bg-[var(--app-text-subtle)]`]),title:r.status===`online`?t.$t(`codingBridge.status.online`):t.$t(`codingBridge.status.offline`)},null,10,J)]),n(`div`,Y,c(r.status===`online`?t.$t(`codingBridge.status.online`):t.$t(`codingBridge.status.offline`)),1)]),i(y,{class:`opacity-0 group-hover:opacity-100`,text:``,circle:``,size:`small`,title:t.$t(`codingBridge.nodeList.remove`),onClick:_(e=>t.onDelete(r),[`stop`])},{default:f(()=>[i(v,{icon:`fa-solid fa-trash`})]),_:1},8,[`title`,`onClick`])],10,W))),128))])):(l(),d(`div`,V,[n(`p`,H,c(t.$t(`codingBridge.nodeList.empty`)),1),i(y,{type:`primary`,round:``,size:`small`,onClick:a[1]||=e=>t.$emit(`pair`)},{default:f(()=>[i(v,{icon:`fa-solid fa-plus`,class:`mr-1`}),r(` `+c(t.$t(`codingBridge.nodeList.pairFirst`)),1)]),_:1})]))])])}var ie=E(re,[[`render`,X]]),ae=e=>{let t=e?.questions;return Array.isArray(t)&&t.length>0&&t.every(e=>e&&typeof e.question==`string`&&Array.isArray(e.options))},Z=e=>e?(e.tool||``).toLowerCase()===`askuserquestion`?!0:ae(e.input):!1,oe=e=>({questions:e.input?.questions??[]}),se=o({name:`CodingBridgeTranscriptItem`,directives:{highlight:k},components:{FontAwesomeIcon:N,VueMarkdown:te},props:{event:{type:Object,required:!0}},computed:{commandText(){let e=this.event.input;if(!e)return``;for(let t of[`command`,`cmd`,`script`]){let n=e[t];if(typeof n==`string`&&n.trim())return n}return``},filePath(){let e=this.event.input;if(!e)return``;for(let t of[`file_path`,`filePath`,`path`,`notebook_path`,`filename`]){let n=e[t];if(typeof n==`string`&&n.trim())return n}return``},toolDescription(){let e=this.event.input?.description;return typeof e==`string`?e:``},toolIcon(){if(this.commandText)return`fa-solid fa-terminal`;let e=(this.event.tool??``).toLowerCase();return/read|cat|view/.test(e)?`fa-solid fa-file-lines`:/write|edit|create|update|insert/.test(e)?`fa-solid fa-pen`:/grep|glob|search|find|list/.test(e)?`fa-solid fa-magnifying-glass`:`fa-solid fa-code`},questionLines(){let e=(this.event.tool??``).toLowerCase(),t=this.event.input?.questions;return!(e===`askuserquestion`||Array.isArray(t))||!Array.isArray(t)?[]:t.filter(e=>e&&typeof e.question==`string`).map(e=>({header:typeof e.header==`string`?e.header:``,question:e.question}))},inputText(){let e=this.event.input;if(!e)return``;let t={};for(let[n,r]of Object.entries(e))n===`timeout`||n===`description`||(t[n]=r);if(Object.keys(t).length===0)return``;try{return JSON.stringify(t,null,2)}catch{return String(e)}},resultText(){let e=this.event.content;return typeof e==`string`&&e.length>0?e:`—`},resultLabel(){let e=[];return this.event.is_error?e.push(this.$t(`codingBridge.transcript.turnFailed`)):e.push(this.$t(`codingBridge.transcript.turnDone`)),typeof this.event.cost_usd==`number`&&this.event.cost_usd>0&&e.push(`$${this.event.cost_usd.toFixed(4)}`),e.join(` · `)},hasAttachments(){return!!this.event.attachments?.length},noticeText(){let e=this.event.subtype,t=this.event.command;if(t){if(e===`slash_unavailable`)return this.$t(`codingBridge.notice.slashUnavailable`,{command:t});if(e===`slash_codex_unsupported`)return this.$t(`codingBridge.notice.slashCodexUnsupported`,{command:t})}return this.event.text||``}}}),ce={key:0,class:`flex justify-end`},le={class:`max-w-[85%] rounded-lg px-3 py-2 bg-[var(--el-color-primary)] text-white whitespace-pre-wrap break-words`},ue=[`src`],de=[`href`],fe=[`src`],pe={key:1,class:`flex h-9 w-9 items-center justify-center rounded bg-white/15`},me={class:`min-w-0 truncate`},he={key:2},ge={key:2,class:`whitespace-pre-wrap break-words italic text-[var(--app-text-subtle)] border-l-2 border-[var(--app-border-subtle)] pl-3`},_e={key:3,class:`overflow-hidden rounded-md bg-[var(--app-sidebar-bg)] border border-[var(--app-border-subtle)]`},ve={class:`flex items-center gap-2 px-2.5 py-1.5 font-medium text-[var(--app-text-subtle)]`},ye={key:0,class:`min-w-0 truncate text-xs font-normal opacity-70`},be={key:0,class:`flex flex-col gap-1.5 px-2.5 pb-2`},xe={key:0,class:`font-medium text-[var(--app-text)]`},Se={class:`whitespace-pre-wrap break-words text-[var(--app-text-subtle)]`},Ce={key:1,class:`px-2.5 pb-2`},we={class:`flex gap-2 overflow-x-auto rounded border border-[var(--app-border-subtle)] bg-[var(--app-content-bg)] px-2.5 py-1.5 font-mono text-xs`},Te={class:`whitespace-pre-wrap break-words`},Ee={key:2,class:`px-2.5 pb-2 font-mono text-xs break-all text-[var(--app-text-subtle)]`},De={key:3,class:`m-0 overflow-x-auto whitespace-pre-wrap break-words px-2.5 pb-2 text-xs text-[var(--app-text-subtle)]`},Oe={key:5,class:`flex items-center gap-2 text-xs text-[var(--app-text-subtle)]`},ke={key:6,class:`flex items-start gap-2 rounded-md bg-[var(--app-sidebar-bg)] border border-[var(--app-border-subtle)] text-[var(--app-text-subtle)] px-3 py-2 text-xs`},Ae={class:`whitespace-pre-wrap break-words`},je={key:7,class:`rounded-md bg-[var(--el-color-danger-light-9)] text-[var(--el-color-danger)] px-3 py-2 whitespace-pre-wrap break-words`};function Me(r,o,f,h,_,v){let y=u(`font-awesome-icon`),b=u(`vue-markdown`),x=p(`highlight`);return l(),d(`div`,{class:e([`transcript-item text-sm leading-relaxed`,`kind-${r.event.kind}`])},[r.event.kind===`prompt`?(l(),d(`div`,ce,[n(`div`,le,[r.event.images&&r.event.images.length?(l(),d(`div`,{key:0,class:e([`flex flex-wrap gap-1.5`,{"mb-1.5":r.event.text||r.hasAttachments}])},[(l(!0),d(g,null,s(r.event.images,(e,t)=>(l(),d(`img`,{key:t,src:e,class:`w-16 h-16 rounded object-cover`,alt:``},null,8,ue))),128))],2)):a(``,!0),r.hasAttachments?(l(),d(`div`,{key:1,class:e([`flex flex-wrap gap-1.5`,{"mb-1.5":r.event.text}])},[(l(!0),d(g,null,s(r.event.attachments,(e,t)=>(l(),d(`a`,{key:`${e.url}-${t}`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`flex max-w-[220px] items-center gap-2 rounded-md bg-white/15 px-2 py-1.5 text-xs text-white hover:bg-white/20`},[e.type===`image`?(l(),d(`img`,{key:0,src:e.url,class:`h-9 w-9 rounded object-cover`,alt:``},null,8,fe)):(l(),d(`span`,pe,[i(y,{icon:`fa-solid fa-file`})])),n(`span`,me,c(e.name||e.url),1)],8,de))),128))],2)):a(``,!0),r.event.text?(l(),d(`span`,he,c(r.event.text),1)):a(``,!0)])])):r.event.kind===`text`?m((l(),t(b,{key:1,source:r.event.text||``,class:`markdown-body bg-transparent text-[var(--app-text)]`},null,8,[`source`])),[[x]]):r.event.kind===`thinking`?(l(),d(`div`,ge,c(r.event.text),1)):r.event.kind===`tool_use`?(l(),d(`div`,_e,[n(`div`,ve,[i(y,{icon:r.toolIcon,class:`text-[var(--el-color-primary)]`},null,8,[`icon`]),n(`span`,null,c(r.event.tool),1),r.toolDescription?(l(),d(`span`,ye,c(r.toolDescription),1)):a(``,!0)]),r.questionLines.length?(l(),d(`div`,be,[(l(!0),d(g,null,s(r.questionLines,(e,t)=>(l(),d(`div`,{key:t,class:`rounded border border-[var(--app-border-subtle)] bg-[var(--app-content-bg)] px-2.5 py-1.5 text-xs`},[e.header?(l(),d(`div`,xe,c(e.header),1)):a(``,!0),n(`div`,Se,c(e.question),1)]))),128))])):r.commandText?(l(),d(`div`,Ce,[n(`div`,we,[o[0]||=n(`span`,{class:`select-none text-[var(--el-color-success)]`},`$`,-1),n(`span`,Te,c(r.commandText),1)])])):r.filePath?(l(),d(`div`,Ee,c(r.filePath),1)):r.inputText?(l(),d(`pre`,De,c(r.inputText),1)):a(``,!0)])):r.event.kind===`tool_result`?(l(),d(`div`,{key:4,class:e([`overflow-hidden rounded-md`,r.event.is_error?`bg-[var(--el-color-danger-light-9)]`:`bg-[var(--app-sidebar-bg)]`])},[n(`pre`,{class:e([`m-0 max-h-72 overflow-auto whitespace-pre-wrap break-words px-2.5 py-2 font-mono text-xs`,r.event.is_error?`text-[var(--el-color-danger)]`:`text-[var(--app-text-subtle)]`])},c(r.resultText),3)],2)):r.event.kind===`result`?(l(),d(`div`,Oe,[i(y,{icon:r.event.is_error?`fa-solid fa-xmark`:`fa-solid fa-check`},null,8,[`icon`]),n(`span`,null,c(r.resultLabel),1)])):r.event.kind===`notice`?(l(),d(`div`,ke,[i(y,{icon:`fa-solid fa-circle-info`,class:`mt-0.5 flex-none text-[var(--el-color-primary)]`}),n(`span`,Ae,c(r.noticeText),1)])):r.event.kind===`error`?(l(),d(`div`,je,c(r.event.text),1)):a(``,!0)],2)}var Ne=E(se,[[`render`,Me],[`__scopeId`,`data-v-805ee49c`]]),Pe=o({name:`CodingBridgeDirectoryDialog`,components:{ElDialog:M,ElButton:v,FontAwesomeIcon:N},props:{visible:{type:Boolean,default:!1},initialPath:{type:String,default:``}},emits:[`update:visible`,`select`],computed:{listing(){return this.$store.state.codingBridge?.directory},loading(){return this.$store.state.codingBridge?.directoryLoading===!0},directories(){return(this.listing?.entries??[]).filter(e=>e.type===`dir`)},files(){return(this.listing?.entries??[]).filter(e=>e.type===`file`)},isEmpty(){return!!this.listing&&!this.listing.error&&(this.listing.entries??[]).length===0}},methods:{onOpen(){this.$store.dispatch(`codingBridge/browseDir`,this.initialPath||void 0)},onVisibleChange(e){this.$emit(`update:visible`,e),e||this.$store.dispatch(`codingBridge/clearDirectory`)},openDir(e){this.$store.dispatch(`codingBridge/browseDir`,e)},goParent(){this.listing?.parent&&this.$store.dispatch(`codingBridge/browseDir`,this.listing.parent)},refresh(){this.$store.dispatch(`codingBridge/browseDir`,this.listing?.path||this.initialPath||void 0)},chooseCurrent(){this.listing&&!this.listing.error&&(this.$emit(`select`,this.listing.path),this.onVisibleChange(!1))}}}),Fe={class:`flex flex-col gap-2`},Ie={class:`flex items-center gap-2 min-w-0`},Le={class:`text-xs text-[var(--app-text-subtle)] truncate flex-1`,dir:`ltr`},Re={class:`h-72 overflow-y-auto border border-[var(--app-border-subtle)] rounded-md divide-y divide-[var(--app-border-subtle)]`},ze={key:0,class:`h-full flex items-center justify-center text-sm text-[var(--app-text-subtle)]`},Be={key:1,class:`h-full flex items-center justify-center text-sm text-[var(--el-color-danger)]`},Ve=[`onClick`],He={class:`truncate`,dir:`ltr`},Ue={class:`truncate`,dir:`ltr`},We={key:0,class:`h-full flex items-center justify-center text-sm text-[var(--app-text-subtle)] py-8`},Ge={key:0,class:`text-[11px] text-[var(--app-text-subtle)] px-1`},Ke={class:`flex items-center justify-end gap-2`};function qe(e,o,p,m,h,_){let v=u(`font-awesome-icon`),y=u(`el-button`),b=u(`el-dialog`);return l(),t(b,{"model-value":e.visible,title:e.$t(`codingBridge.directory.title`),width:`520px`,"append-to-body":``,"onUpdate:modelValue":e.onVisibleChange,onOpen:e.onOpen},{footer:f(()=>[n(`div`,Ke,[i(y,{round:``,onClick:o[0]||=t=>e.onVisibleChange(!1)},{default:f(()=>[r(c(e.$t(`common.button.cancel`)),1)]),_:1}),i(y,{type:`primary`,round:``,disabled:!e.listing||!!e.listing.error,onClick:e.chooseCurrent},{default:f(()=>[r(c(e.$t(`codingBridge.directory.choose`)),1)]),_:1},8,[`disabled`,`onClick`])])]),default:f(()=>[n(`div`,Fe,[n(`div`,Ie,[i(y,{size:`small`,circle:``,disabled:!e.listing||!e.listing.parent||e.loading,title:e.$t(`codingBridge.directory.up`),onClick:e.goParent},{default:f(()=>[i(v,{icon:`fa-solid fa-arrow-up`})]),_:1},8,[`disabled`,`title`,`onClick`]),n(`span`,Le,c(e.listing?e.listing.path:`…`),1),i(y,{size:`small`,circle:``,disabled:e.loading,title:e.$t(`codingBridge.directory.refresh`),onClick:e.refresh},{default:f(()=>[i(v,{icon:`fa-solid fa-rotate-right`,spin:e.loading},null,8,[`spin`])]),_:1},8,[`disabled`,`title`,`onClick`])]),n(`div`,Re,[e.loading&&!e.listing?(l(),d(`div`,ze,c(e.$t(`codingBridge.directory.loading`)),1)):e.listing&&e.listing.error?(l(),d(`div`,Be,c(e.listing.error),1)):(l(),d(g,{key:2},[(l(!0),d(g,null,s(e.directories,t=>(l(),d(`button`,{key:t.path,type:`button`,class:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[var(--app-content-hover-bg)]`,onClick:n=>e.openDir(t.path)},[i(v,{icon:`fa-solid fa-folder`,class:`text-[var(--el-color-warning)]`}),n(`span`,He,c(t.name),1)],8,Ve))),128)),(l(!0),d(g,null,s(e.files,e=>(l(),d(`div`,{key:e.path,class:`w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--app-text-subtle)]`},[i(v,{icon:`fa-solid fa-file`}),n(`span`,Ue,c(e.name),1)]))),128)),e.isEmpty?(l(),d(`div`,We,c(e.$t(`codingBridge.directory.empty`)),1)):a(``,!0)],64))]),e.listing&&e.listing.truncated?(l(),d(`p`,Ge,c(e.$t(`codingBridge.directory.truncated`)),1)):a(``,!0)])]),_:1},8,[`model-value`,`title`,`onUpdate:modelValue`,`onOpen`])}var Je=E(Pe,[[`render`,qe]]),Ye=`data:image/svg+xml,%3csvg%20fill='%23D97757'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClaude%3c/title%3e%3cpath%20d='m4.7144%2015.9555%204.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608%201.5179.1032%202.2767.1578%201.6514.0972%202.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973%209.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686%201.9064%201.4754%202.4893%201.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335%206.6997%200l.9957.1336.419.3642.6192%201.4147%201.0018%202.2282%201.5543%203.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853%201.8517-.5586%202.9021-.3643%201.9429h.2125l.2429-.2429.9835-1.3053%201.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759%201.1293-.34%201.1657-1.0625%201.3478-.8804%201.1414-1.2628%201.7-.7893%201.36.0729.1093.1882-.0183%202.8535-.607%201.5421-.2794%201.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607%201.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929%201.0686%202.0035%201.8092%202.5075%202.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496%202.3436%203.5214.1214%201.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38%2017.959l-1.1414-1.9428-.1397.079-.674%207.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328%201.9672-2.1796%202.9446-1.7243%201.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889%202.386-3.0357%201.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385%204.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429%201.9064-1.3114Z'/%3e%3c/svg%3e`,Xe=`data:image/svg+xml,%3csvg%20fill='%23000000'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eOpenAI%3c/title%3e%3cpath%20d='M22.282%209.821a5.985%205.985%200%200%200-.516-4.91%206.046%206.046%200%200%200-6.51-2.9A6.065%206.065%200%200%200%204.981%204.18a5.985%205.985%200%200%200-3.998%202.9%206.046%206.046%200%200%200%20.743%207.097%205.98%205.98%200%200%200%20.51%204.911%206.051%206.051%200%200%200%206.515%202.9A5.985%205.985%200%200%200%2013.26%2024a6.056%206.056%200%200%200%205.772-4.206%205.99%205.99%200%200%200%203.997-2.9%206.056%206.056%200%200%200-.747-7.073zM13.26%2022.43a4.476%204.476%200%200%201-2.876-1.04l.141-.081%204.779-2.758a.795.795%200%200%200%20.392-.681v-6.737l2.02%201.168a.071.071%200%200%201%20.038.052v5.583a4.504%204.504%200%200%201-4.494%204.494zM3.6%2018.304a4.47%204.47%200%200%201-.535-3.014l.142.085%204.783%202.759a.771.771%200%200%200%20.78%200l5.843-3.369v2.332a.08.08%200%200%201-.033.062L9.74%2019.95a4.5%204.5%200%200%201-6.14-1.646zM2.34%207.896a4.485%204.485%200%200%201%202.366-1.973V11.6a.766.766%200%200%200%20.388.676l5.815%203.355-2.02%201.168a.076.076%200%200%201-.071%200l-4.83-2.786A4.504%204.504%200%200%201%202.34%207.872zm16.597%203.855l-5.833-3.387L15.119%207.2a.076.076%200%200%201%20.071%200l4.83%202.791a4.494%204.494%200%200%201-.676%208.105v-5.678a.79.79%200%200%200-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776%200%200%200-.785%200L9.409%209.23V6.897a.066.066%200%200%201%20.028-.061l4.83-2.787a4.5%204.5%200%200%201%206.68%204.66zm-12.64%204.135l-2.02-1.164a.08.08%200%200%201-.038-.057V6.075a4.5%204.5%200%200%201%207.375-3.453l-.142.08L8.704%205.46a.795.795%200%200%200-.393.681zm1.097-2.365l2.602-1.5%202.607%201.5v2.999l-2.597%201.5-2.607-1.5z'/%3e%3c/svg%3e`,Ze=50*1024*1024,Q=10,Qe={claude:{src:Ye,invertOnDark:!1},codex:{src:Xe,invertOnDark:!0}},$e=o({name:`CodingBridgeSessionView`,components:{ElInput:O,ElButton:v,ElPopover:w,ElDropdown:C,ElDropdownMenu:S,ElDropdownItem:x,ElUpload:y,FontAwesomeIcon:N,TranscriptItem:Ne,DirectoryDialog:Je,AskUserQuestionCard:ne},mixins:[T],emits:[`history`],data(){return{prompt:``,cwd:``,model:``,customModelDraft:``,permissionMode:`default`,provider:`claude`,effort:``,directoryVisible:!1,slashMenuOpen:!1,slashActiveIndex:0,attachmentFileList:[],uploadUrl:ee()+`/api/v1/files/`,maxAttachments:Q}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},currentNodeId(){return this.$store.state.codingBridge?.currentNodeId},currentNode(){return this.$store.state.codingBridge?.nodes?.find(e=>e.node_id===this.currentNodeId)},nodeOnline(){return this.currentNode?.status===`online`},currentSessionId(){return this.$store.state.codingBridge?.currentSessionId},currentSession(){let e=this.currentSessionId;return e?this.$store.state.codingBridge?.sessions?.[e]:void 0},events(){let e=this.currentSessionId;return e?this.$store.state.codingBridge?.events?.[e]??[]:[]},pendingQuestion(){let e=this.currentSessionId;if(!e)return;let t=(this.$store.state.codingBridge?.permissions??[]).find(t=>t.session_id===e&&Z(t));return t?{request_id:t.request_id,payload:oe(t)}:void 0},isNewSession(){return!this.currentSessionId},readonly(){return this.currentSession?.readonly===!0},resumeHint(){return!!this.currentSession?.provider&&!this.currentSession?.started&&!this.readonly},replayLabel(){return!this.currentSession?.provider||this.currentSession?.started?``:this.currentSession.provider===`codex`?this.$t(`codingBridge.history.codexLabel`):this.$t(`codingBridge.history.claudeLabel`)},running(){let e=this.currentSession?.status;return e===`running`||e===`starting`},connected(){return this.$store.state.codingBridge?.connection===`connected`},attachments(){return(this.attachmentFileList||[]).map(e=>{let t=e.response?.file_url||(typeof e.url==`string`&&!e.url.startsWith(`blob:`)?e.url:``);if(!t)return;let n=e.raw,r=n?.type||e.mime_type||``;return{type:this.isImageAttachment(e)?`image`:`file`,url:t,name:e.name,mime_type:r,size:n?.size}}).filter(e=>!!e)},uploadingAttachments(){return(this.attachmentFileList||[]).some(e=>this.isAttachmentUploading(e))},canSend(){return(!!this.prompt.trim()||this.attachments.length>0)&&!this.uploadingAttachments&&this.connected&&this.nodeOnline&&this.currentProviderAvailable},composerHint(){return this.uploadingAttachments?this.$t(`codingBridge.session.uploadingAttachment`):this.providerCaps.length&&!this.currentProviderAvailable?this.$t(`codingBridge.session.providerUnavailableHint`,{name:this.providerName(this.provider)}):this.resumeHint?this.$t(`codingBridge.history.resumeHint`):this.$t(`codingBridge.session.enterHint`)},nodeCapabilities(){let e=this.currentNodeId;return e?this.$store.state.codingBridge?.capabilities?.[e]:void 0},providerCaps(){return this.nodeCapabilities?.providers??[]},currentProviderCap(){return this.providerCaps.find(e=>e.name===this.provider)},currentProviderAvailable(){return this.providerCaps.length?this.currentProviderCap?.available!==!1:!0},providerOptions(){return this.providerCaps.length?this.providerCaps.map(e=>({value:e.name,label:e.label,available:e.available!==!1})):[{label:this.$t(`codingBridge.session.providerClaude`),value:`claude`,available:!0},{label:this.$t(`codingBridge.session.providerCodex`),value:`codex`,available:!0}]},modelOptions(){return this.currentProviderCap?.models??[]},allowCustomModel(){return this.currentProviderCap?.allow_custom_model??!0},effortOptions(){let e=this.currentProviderCap?.efforts;return(e&&e.length?e:[``]).map(e=>({value:e,label:this.effortLabel(e)}))},permissionModeOptions(){let e=this.currentProviderCap?.permission_modes;return(e&&e.length?e:[`default`,`acceptEdits`,`plan`,`bypassPermissions`]).map(e=>({value:e,label:this.permissionModeLabel(e)}))},sessionMeta(){let e=this.currentSession;if(!e)return``;let t=[];return e.provider&&t.push(this.providerName(e.provider)),e.cwd&&t.push(e.cwd),e.model&&t.push(e.model),t.join(` · `)},activeProviderName(){return this.currentSession?.provider||this.provider},slashCommands(){let e=this.activeProviderName;return this.providerCaps.find(t=>t.name===e)?.commands??[]},slashMatches(){let e=this.prompt.match(/^\/(\S*)$/);if(!e)return[];let t=e[1].toLowerCase();return this.slashCommands.filter(e=>[e.name,...e.aliases??[]].some(e=>e.toLowerCase().startsWith(t))).slice(0,8)},slashMenuVisible(){return this.slashMenuOpen&&this.slashMatches.length>0}},watch:{events(){this.scrollToBottom()},pendingQuestion(){this.scrollToBottom()},currentSessionId(){this.scrollToBottom(),this.syncSessionSettings()},currentNodeId(){this.requestCapabilities()},providerCaps(){if(!this.isNewSession||!this.providerCaps.length)return;let e=this.providerCaps.find(e=>e.name===this.provider);if(!e||e.available===!1){let e=this.providerCaps.find(e=>e.available!==!1);e&&(this.provider=e.name)}},provider(){this.isNewSession&&(this.model=``,this.effort=``)},prompt(e){this.slashMenuOpen=/^\/\S*$/.test(e),this.slashActiveIndex>=this.slashMatches.length&&(this.slashActiveIndex=0)}},mounted(){this.requestCapabilities(),this.syncSessionSettings()},methods:{requestCapabilities(){this.currentNodeId&&this.$store.dispatch(`codingBridge/getCapabilities`,this.currentNodeId)},effortLabel(e){let t={"":`codingBridge.session.effortDefault`,low:`codingBridge.session.effortLow`,medium:`codingBridge.session.effortMedium`,high:`codingBridge.session.effortHigh`,max:`codingBridge.session.effortMax`}[e];return t?this.$t(t):e},permissionModeLabel(e){let t={default:`codingBridge.session.permissionModeDefault`,acceptEdits:`codingBridge.session.permissionModeAcceptEdits`,plan:`codingBridge.session.permissionModePlan`,bypassPermissions:`codingBridge.session.permissionModeBypass`}[e];return t?this.$t(t):e},providerName(e){let t=this.providerCaps.find(t=>t.name===e);return t?t.label:e===`codex`?this.$t(`codingBridge.session.providerCodex`):this.$t(`codingBridge.session.providerClaude`)},providerIcon(e){return Qe[e]??null},syncSessionSettings(){let e=this.currentSession;e&&(e.provider&&(this.provider=e.provider),this.model=e.model??``,this.customModelDraft=``,e.cwd&&(this.cwd=e.cwd))},selectModel(e){this.model=e,this.customModelDraft=``,this.closeModelPopover()},applyCustomModel(){let e=this.customModelDraft.trim();e&&(this.model=e,this.customModelDraft=``,this.closeModelPopover())},closeModelPopover(){this.$refs.modelPopover?.hide?.()},onComposerEnter(e){let t=e;t.isComposing||t.keyCode===229||t.shiftKey||t.ctrlKey||t.metaKey||t.altKey||(t.preventDefault(),this.onSend())},onComposerKeydown(e){let t=e;if(this.slashMenuVisible&&!t.isComposing&&t.keyCode!==229){if(t.key===`ArrowDown`){t.preventDefault(),this.moveSlash(1);return}if(t.key===`ArrowUp`){t.preventDefault(),this.moveSlash(-1);return}if(t.key===`Escape`){t.preventDefault(),this.slashMenuOpen=!1;return}if(t.key===`Tab`||t.key===`Enter`&&!t.shiftKey){t.preventDefault(),this.applySlash(this.slashMatches[this.slashActiveIndex]);return}}t.key===`Enter`&&this.onComposerEnter(t)},moveSlash(e){let t=this.slashMatches.length;t&&(this.slashActiveIndex=(this.slashActiveIndex+e+t)%t)},applySlash(e){e&&(this.prompt=`/${e.name} `,this.slashMenuOpen=!1,this.slashActiveIndex=0)},onSend(){if(!this.canSend)return;let e=this.attachments;this.$store.dispatch(`codingBridge/sendPrompt`,{prompt:this.prompt,cwd:this.cwd,model:this.model,permissionMode:this.permissionMode,provider:this.provider,effort:this.effort,attachments:e.length?e:void 0}),this.prompt=``,this.slashMenuOpen=!1,this.slashActiveIndex=0,this.clearAttachments()},onAnswerQuestion(e){this.$store.dispatch(`codingBridge/answerQuestion`,{request_id:e.tool_use_id,output:e.output})},onSkipQuestion(e){this.$store.dispatch(`codingBridge/resolvePermission`,{request_id:e.tool_use_id,decision:`deny`})},beforeAttachmentUpload(e){return this.attachmentFileList.length>=Q?(D.warning(this.$t(`codingBridge.session.attachmentLimit`,{count:Q})),!1):e.size>Ze?(D.warning(this.$t(`codingBridge.session.attachmentTooLarge`)),!1):!0},onAttachmentChange(e){if(!e.url&&e.raw&&this.isImageAttachment(e))try{e.url=URL.createObjectURL(e.raw)}catch{}},onAttachmentSuccess(e,t){e?.file_url&&(this.revokeBlobUrl(t),t.url=e.file_url,t.response=e)},onAttachmentError(){D.error(this.$t(`codingBridge.session.attachmentUploadError`))},onAttachmentExceed(){D.warning(this.$t(`codingBridge.session.attachmentLimit`,{count:Q}))},onTriggerAttachmentUpload(){this.$nextTick(()=>{let e=this.$refs.uploader?.$el;(e?.querySelector(`input.el-upload__input`)||e?.querySelector(`input[type="file"]`))?.click()})},isAttachmentUploading(e){return e.status===`ready`||e.status===`uploading`},isImageAttachment(e){return(e.raw?.type||``).startsWith(`image/`)?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name||e.url||``)},attachmentPreviewUrl(e){return this.isImageAttachment(e)&&(e.url||e.response?.file_url)||``},removeAttachment(e,t){this.revokeBlobUrl(t),this.attachmentFileList.splice(e,1)},clearAttachments(){for(let e of this.attachmentFileList)this.revokeBlobUrl(e);this.attachmentFileList=[]},revokeBlobUrl(e){if(e.url?.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}},onInterrupt(){this.$store.dispatch(`codingBridge/interruptSession`)},openDirectory(){this.directoryVisible=!0},onDirectorySelect(e){this.cwd=e},onNewSession(){this.$store.dispatch(`codingBridge/newSession`),this.cwd=``,this.model=``,this.customModelDraft=``,this.permissionMode=`default`,this.provider=`claude`,this.effort=``,this.prompt=``,this.slashMenuOpen=!1,this.slashActiveIndex=0,this.clearAttachments()},scrollToBottom(){this.$nextTick(()=>{let e=this.$refs.transcript;e&&(e.scrollTop=e.scrollHeight)})}}}),et={class:`session-view flex flex-col h-full bg-[var(--app-content-bg)]`},tt={key:0,class:`flex-1 flex flex-col items-center justify-center text-center p-8 text-[var(--app-text-subtle)]`},nt={class:`text-sm`},rt={class:`flex items-center justify-between gap-3 px-5 py-3 border-b border-[var(--app-border-subtle)]`},it={class:`min-w-0`},at={class:`flex items-center gap-2 font-medium`},ot={class:`truncate`},st={key:0,class:`text-xs text-[var(--app-text-subtle)] truncate`},ct={key:0,class:`text-[var(--el-color-primary)]`},lt={class:`flex items-center gap-2 flex-none`},ut={key:0,class:`px-5 py-2 text-xs bg-[var(--el-color-warning-light-9)] text-[var(--el-color-warning)] border-b border-[var(--app-border-subtle)]`},dt={ref:`transcript`,class:`flex-1 overflow-y-auto px-5 py-4 flex flex-col gap-3`},ft={key:0,class:`m-auto text-center text-sm text-[var(--app-text-subtle)]`},pt={class:`border-t border-[var(--app-border-subtle)] p-3`},mt={key:0,class:`flex items-center gap-2 text-xs text-[var(--app-text-subtle)] px-1 py-2`},ht={class:`cb-composer rounded-2xl border border-[var(--app-border-subtle)] bg-[var(--app-content-bg)] px-3 py-2.5 transition-colors focus-within:border-[var(--el-color-primary-light-5)]`},gt={key:0,class:`flex flex-wrap gap-2 pb-2`},_t=[`src`,`alt`],vt={key:1,class:`flex h-8 w-8 items-center justify-center rounded bg-[var(--app-content-bg)]`},yt=[`title`],bt={key:2,class:`text-[10px] text-[var(--app-text-subtle)]`},xt=[`title`,`onClick`],St={key:1,class:`cb-slash-menu`},Ct=[`onMousedown`,`onMouseenter`],wt={class:`cb-slash-menu__name`},Tt={key:0,class:`cb-slash-menu__hint`},Et={key:1,class:`cb-slash-menu__desc`},Dt={ref:`attachmentUploadTrigger`,class:`block h-0 w-0`,"aria-hidden":`true`},Ot={class:`mt-1.5 flex items-center gap-1.5`},kt=[`title`],At={class:`flex min-w-0 flex-1 flex-wrap items-center gap-1.5`},jt={type:`button`,class:`cb-pill`},Mt=[`src`],Nt={class:`truncate`},Pt=[`src`],Ft={key:1,class:`ml-1 text-xs opacity-60`},It={key:1,class:`cb-pill cb-pill--static`},Lt=[`src`],Rt={class:`truncate`},zt={type:`button`,class:`cb-pill`},Bt={class:`truncate`},Vt={class:`cb-model-menu`},Ht={class:`truncate`},Ut=[`onClick`],Wt={class:`truncate`},Gt={key:0,class:`cb-model-custom`},Kt={type:`button`,class:`cb-pill`},qt={class:`truncate`},Jt={type:`button`,class:`cb-pill`},Yt={class:`truncate`},Xt={type:`button`,class:`cb-pill`},Zt={class:`truncate`},Qt=[`title`,`aria-label`],$t={key:3,class:`cb-pill cb-pill--static`},en={class:`truncate`},tn={class:`text-[11px] text-[var(--app-text-subtle)] mt-1 px-1`};function nn(o,p,m,v,y,b){let x=u(`font-awesome-icon`),S=u(`el-button`),C=u(`transcript-item`),w=u(`ask-user-question-card`),T=u(`el-input`),E=u(`el-upload`),D=u(`el-dropdown-item`),O=u(`el-dropdown-menu`),k=u(`el-dropdown`),A=u(`el-popover`),j=u(`directory-dialog`);return l(),d(`div`,et,[o.currentNode?(l(),d(g,{key:1},[n(`div`,rt,[n(`div`,it,[n(`div`,at,[n(`span`,ot,c(o.currentNode.name),1),n(`span`,{class:e([`inline-block w-2 h-2 rounded-full flex-none`,o.nodeOnline?`bg-[var(--el-color-success)]`:`bg-[var(--app-text-subtle)]`])},null,2)]),o.currentSession?(l(),d(`div`,st,[n(`span`,null,c(o.sessionMeta),1),o.replayLabel?(l(),d(`span`,ct,` · `+c(o.replayLabel),1)):a(``,!0)])):a(``,!0)]),n(`div`,lt,[i(S,{size:`small`,round:``,onClick:p[0]||=e=>o.$emit(`history`)},{default:f(()=>[i(x,{icon:`fa-solid fa-clock-rotate-left`,class:`mr-1`}),r(` `+c(o.$t(`codingBridge.history.button`)),1)]),_:1}),o.currentSessionId?(l(),t(S,{key:0,size:`small`,round:``,onClick:o.onNewSession},{default:f(()=>[i(x,{icon:`fa-solid fa-plus`,class:`mr-1`}),r(` `+c(o.$t(`codingBridge.session.newSession`)),1)]),_:1},8,[`onClick`])):a(``,!0)])]),o.nodeOnline?a(``,!0):(l(),d(`div`,ut,c(o.$t(`codingBridge.session.deviceOffline`)),1)),n(`div`,dt,[o.events.length?a(``,!0):(l(),d(`div`,ft,c(o.$t(`codingBridge.session.startHint`)),1)),(l(!0),d(g,null,s(o.events,e=>(l(),t(C,{key:e.id,event:e},null,8,[`event`]))),128)),o.pendingQuestion?(l(),t(w,{key:o.pendingQuestion.request_id,"tool-use-id":o.pendingQuestion.request_id,payload:o.pendingQuestion.payload,onSubmit:o.onAnswerQuestion,onSkip:o.onSkipQuestion},null,8,[`tool-use-id`,`payload`,`onSubmit`,`onSkip`])):a(``,!0)],512),n(`div`,pt,[o.readonly?(l(),d(`div`,mt,[i(x,{icon:`fa-solid fa-eye`}),n(`span`,null,c(o.$t(`codingBridge.history.readonly`)),1),i(S,{class:`ml-auto`,size:`small`,round:``,onClick:o.onNewSession},{default:f(()=>[r(c(o.$t(`codingBridge.session.newSession`)),1)]),_:1},8,[`onClick`])])):(l(),d(g,{key:1},[n(`div`,ht,[o.attachmentFileList.length?(l(),d(`div`,gt,[(l(!0),d(g,null,s(o.attachmentFileList,(e,t)=>(l(),d(`div`,{key:e.uid||e.name||t,class:`group relative flex max-w-[220px] items-center gap-2 rounded-md border border-[var(--app-border-subtle)] bg-[var(--app-sidebar-bg)] px-2 py-1.5 text-xs`},[o.attachmentPreviewUrl(e)?(l(),d(`img`,{key:0,src:o.attachmentPreviewUrl(e),class:`h-8 w-8 rounded object-cover`,alt:o.$t(`codingBridge.session.attachmentImageAlt`)},null,8,_t)):(l(),d(`span`,vt,[i(x,{icon:`fa-solid fa-file`})])),n(`span`,{class:`min-w-0 flex-1 truncate`,title:e.name},c(e.name),9,yt),o.isAttachmentUploading(e)?(l(),d(`span`,bt,c(Math.round(e.percentage||0))+`% `,1)):a(``,!0),n(`button`,{type:`button`,class:`flex h-5 w-5 items-center justify-center rounded-full text-[var(--app-text-subtle)] hover:bg-[var(--app-content-hover-bg)] hover:text-[var(--el-color-danger)]`,title:o.$t(`codingBridge.session.removeAttachment`),onClick:n=>o.removeAttachment(t,e)},[i(x,{icon:`fa-solid fa-xmark`})],8,xt)]))),128))])):a(``,!0),o.slashMenuVisible?(l(),d(`ul`,St,[(l(!0),d(g,null,s(o.slashMatches,(t,r)=>(l(),d(`li`,{key:t.name,class:e([`cb-slash-menu__item`,{"cb-slash-menu__item--active":r===o.slashActiveIndex}]),onMousedown:_(e=>o.applySlash(t),[`prevent`]),onMouseenter:e=>o.slashActiveIndex=r},[n(`span`,wt,`/`+c(t.name),1),t.argument_hint?(l(),d(`span`,Tt,c(t.argument_hint),1)):a(``,!0),t.description?(l(),d(`span`,Et,c(t.description),1)):a(``,!0)],42,Ct))),128))])):a(``,!0),i(T,{modelValue:o.prompt,"onUpdate:modelValue":p[1]||=e=>o.prompt=e,type:`textarea`,autosize:{minRows:2,maxRows:12},resize:`none`,class:`cb-composer__input`,placeholder:o.$t(`codingBridge.session.promptPlaceholder`),onKeydown:o.onComposerKeydown},null,8,[`modelValue`,`placeholder`,`onKeydown`]),i(E,{ref:`uploader`,"file-list":o.attachmentFileList,"onUpdate:fileList":p[2]||=e=>o.attachmentFileList=e,class:`h-0 w-0 overflow-hidden opacity-0`,name:`file`,action:o.uploadUrl,headers:o.headers,multiple:!0,limit:o.maxAttachments,"show-file-list":!1,"before-upload":o.beforeAttachmentUpload,"on-change":o.onAttachmentChange,"on-success":o.onAttachmentSuccess,"on-error":o.onAttachmentError,"on-exceed":o.onAttachmentExceed},{default:f(()=>[n(`span`,Dt,null,512)]),_:1},8,[`file-list`,`action`,`headers`,`limit`,`before-upload`,`on-change`,`on-success`,`on-error`,`on-exceed`]),n(`div`,Ot,[n(`button`,{type:`button`,class:`cb-icon-btn`,title:o.$t(`codingBridge.session.attachFile`),onClick:p[3]||=(...e)=>o.onTriggerAttachmentUpload&&o.onTriggerAttachmentUpload(...e)},[i(x,{icon:`fa-solid fa-paperclip`})],8,kt),n(`div`,At,[o.isNewSession?(l(),t(k,{key:0,trigger:`click`,onCommand:p[4]||=e=>o.provider=e},{dropdown:f(()=>[i(O,null,{default:f(()=>[(l(!0),d(g,null,s(o.providerOptions,n=>(l(),t(D,{key:n.value,command:n.value,disabled:!n.available},{default:f(()=>[i(x,{icon:`fa-solid fa-check`,class:e([`mr-2`,n.value===o.provider?`opacity-100`:`opacity-0`])},null,8,[`class`]),o.providerIcon(n.value)?(l(),d(`img`,{key:0,src:o.providerIcon(n.value).src,class:e([`cb-pill__brand mr-1.5`,{"cb-pill__brand--invert":o.providerIcon(n.value).invertOnDark}]),alt:``},null,10,Pt)):a(``,!0),r(` `+c(n.label)+` `,1),n.available?a(``,!0):(l(),d(`span`,Ft,c(o.$t(`codingBridge.session.providerUnavailable`)),1))]),_:2},1032,[`command`,`disabled`]))),128))]),_:1})]),default:f(()=>[n(`button`,jt,[o.providerIcon(o.provider)?(l(),d(`img`,{key:0,src:o.providerIcon(o.provider).src,class:e([`cb-pill__brand`,{"cb-pill__brand--invert":o.providerIcon(o.provider).invertOnDark}]),alt:``},null,10,Mt)):(l(),t(x,{key:1,icon:`fa-solid fa-code`,class:`cb-pill__icon`})),n(`span`,Nt,c(o.providerName(o.provider)),1),i(x,{icon:`fa-solid fa-chevron-down`,class:`cb-pill__caret`})])]),_:1})):(l(),d(`span`,It,[o.providerIcon(o.currentSession?.provider||`claude`)?(l(),d(`img`,{key:0,src:o.providerIcon(o.currentSession?.provider||`claude`).src,class:e([`cb-pill__brand`,{"cb-pill__brand--invert":o.providerIcon(o.currentSession?.provider||`claude`).invertOnDark}]),alt:``},null,10,Lt)):(l(),t(x,{key:1,icon:`fa-solid fa-code`,class:`cb-pill__icon`})),n(`span`,Rt,c(o.providerName(o.currentSession?.provider||`claude`)),1)])),i(A,{ref:`modelPopover`,trigger:`click`,placement:`top-start`,width:260},{reference:f(()=>[n(`button`,zt,[i(x,{icon:`fa-solid fa-brain`,class:`cb-pill__icon`}),n(`span`,Bt,c(o.model||o.$t(`codingBridge.session.modelDefault`)),1),i(x,{icon:`fa-solid fa-chevron-down`,class:`cb-pill__caret`})])]),default:f(()=>[n(`div`,Vt,[n(`button`,{type:`button`,class:`cb-model-option`,onClick:p[5]||=e=>o.selectModel(``)},[i(x,{icon:`fa-solid fa-check`,class:e([`cb-model-option__check`,o.model?`opacity-0`:`opacity-100`])},null,8,[`class`]),n(`span`,Ht,c(o.$t(`codingBridge.session.modelDefault`)),1)]),(l(!0),d(g,null,s(o.modelOptions,t=>(l(),d(`button`,{key:t.value,type:`button`,class:`cb-model-option`,onClick:e=>o.selectModel(t.value)},[i(x,{icon:`fa-solid fa-check`,class:e([`cb-model-option__check`,t.value===o.model?`opacity-100`:`opacity-0`])},null,8,[`class`]),n(`span`,Wt,c(t.label),1)],8,Ut))),128)),o.allowCustomModel?(l(),d(`div`,Gt,[i(T,{modelValue:o.customModelDraft,"onUpdate:modelValue":p[6]||=e=>o.customModelDraft=e,size:`small`,placeholder:o.$t(`codingBridge.session.modelPlaceholder`),onKeyup:h(o.applyCustomModel,[`enter`])},{append:f(()=>[i(S,{disabled:!o.customModelDraft.trim(),onClick:o.applyCustomModel},{default:f(()=>[i(x,{icon:`fa-solid fa-check`})]),_:1},8,[`disabled`,`onClick`])]),_:1},8,[`modelValue`,`placeholder`,`onKeyup`])])):a(``,!0)])]),_:1},512),o.isNewSession?(l(),d(g,{key:2},[o.effortOptions.length>1?(l(),t(k,{key:0,trigger:`click`,onCommand:p[7]||=e=>o.effort=e},{dropdown:f(()=>[i(O,null,{default:f(()=>[(l(!0),d(g,null,s(o.effortOptions,n=>(l(),t(D,{key:n.value,command:n.value},{default:f(()=>[i(x,{icon:`fa-solid fa-check`,class:e([`mr-2`,n.value===o.effort?`opacity-100`:`opacity-0`])},null,8,[`class`]),r(` `+c(n.label),1)]),_:2},1032,[`command`]))),128))]),_:1})]),default:f(()=>[n(`button`,Kt,[i(x,{icon:`fa-solid fa-gauge-high`,class:`cb-pill__icon`}),n(`span`,qt,c(o.effortLabel(o.effort)),1),i(x,{icon:`fa-solid fa-chevron-down`,class:`cb-pill__caret`})])]),_:1})):a(``,!0),i(k,{trigger:`click`,onCommand:p[8]||=e=>o.permissionMode=e},{dropdown:f(()=>[i(O,null,{default:f(()=>[(l(!0),d(g,null,s(o.permissionModeOptions,n=>(l(),t(D,{key:n.value,command:n.value},{default:f(()=>[i(x,{icon:`fa-solid fa-check`,class:e([`mr-2`,n.value===o.permissionMode?`opacity-100`:`opacity-0`])},null,8,[`class`]),r(` `+c(n.label),1)]),_:2},1032,[`command`]))),128))]),_:1})]),default:f(()=>[n(`button`,Jt,[i(x,{icon:`fa-solid fa-shield-halved`,class:`cb-pill__icon`}),n(`span`,Yt,c(o.permissionModeLabel(o.permissionMode)),1),i(x,{icon:`fa-solid fa-chevron-down`,class:`cb-pill__caret`})])]),_:1}),i(A,{trigger:`click`,placement:`top-start`,width:320},{reference:f(()=>[n(`button`,Xt,[i(x,{icon:`fa-solid fa-folder-open`,class:`cb-pill__icon`}),n(`span`,Zt,c(o.cwd||o.$t(`codingBridge.session.cwdDefault`)),1),i(x,{icon:`fa-solid fa-chevron-down`,class:`cb-pill__caret`})])]),default:f(()=>[i(T,{modelValue:o.cwd,"onUpdate:modelValue":p[12]||=e=>o.cwd=e,size:`small`,clearable:``,class:`cb-cwd-input`,placeholder:o.$t(`codingBridge.session.cwdPlaceholder`)},{suffix:f(()=>[n(`span`,{class:`cb-cwd-browse`,role:`button`,tabindex:`0`,title:o.$t(`codingBridge.directory.title`),"aria-label":o.$t(`codingBridge.directory.title`),onClick:p[9]||=(...e)=>o.openDirectory&&o.openDirectory(...e),onKeydown:[p[10]||=h(_((...e)=>o.openDirectory&&o.openDirectory(...e),[`prevent`]),[`enter`]),p[11]||=h(_((...e)=>o.openDirectory&&o.openDirectory(...e),[`prevent`]),[`space`])]},[i(x,{icon:`fa-solid fa-folder-open`})],40,Qt)]),_:1},8,[`modelValue`,`placeholder`])]),_:1})],64)):a(``,!0),!o.isNewSession&&o.currentSession?.cwd?(l(),d(`span`,$t,[i(x,{icon:`fa-solid fa-folder-open`,class:`cb-pill__icon`}),n(`span`,en,c(o.currentSession?.cwd),1)])):a(``,!0)]),o.running?(l(),t(S,{key:0,circle:``,onClick:o.onInterrupt},{default:f(()=>[i(x,{icon:`fa-solid fa-stop`})]),_:1},8,[`onClick`])):a(``,!0),i(S,{type:`primary`,round:``,disabled:!o.canSend,onClick:o.onSend},{default:f(()=>[r(c(o.$t(`codingBridge.session.send`)),1)]),_:1},8,[`disabled`,`onClick`])])]),n(`p`,tn,c(o.composerHint),1)],64))])],64)):(l(),d(`div`,tt,[i(x,{icon:`fa-solid fa-laptop-code`,class:`text-4xl mb-3`}),n(`p`,nt,c(o.$t(`codingBridge.session.noDevice`)),1)])),i(j,{visible:o.directoryVisible,"onUpdate:visible":p[13]||=e=>o.directoryVisible=e,"initial-path":o.cwd,onSelect:o.onDirectorySelect},null,8,[`visible`,`initial-path`,`onSelect`])])}var rn=E($e,[[`render`,nn],[`__scopeId`,`data-v-6318a784`]]),an=o({name:`CodingBridgePairDialog`,components:{ElDialog:M,ElInput:O,ElButton:v,FontAwesomeIcon:N},props:{visible:{type:Boolean,default:!1},initialCode:{type:String,default:``}},emits:[`update:visible`],data(){return{code:``}},computed:{claiming(){return this.$store.state.codingBridge?.status?.claimPair===j.Request}},watch:{visible(e){e&&this.initialCode&&(this.code=this.initialCode)},initialCode(e){e&&(this.code=e)}},methods:{async onClaim(){let e=this.code.trim();if(e)try{let t=await this.$store.dispatch(`codingBridge/claimPair`,e);D.success(this.$t(`codingBridge.pair.success`,{name:t})),this.code=``,this.$emit(`update:visible`,!1)}catch(e){let t=e?.response?.status;t===404?D.error(this.$t(`codingBridge.pair.invalidCode`)):t===409?D.error(this.$t(`codingBridge.pair.usedCode`)):D.error(this.$t(`codingBridge.pair.failed`))}}}}),on={class:`content`},sn={class:`text-sm text-[var(--app-text-subtle)] mb-4`},cn={class:`steps list-none m-0 p-0 mb-4`},ln={class:`flex gap-3 mb-3`},un={class:`flex-1 min-w-0`},dn={class:`text-sm mb-1`},fn={class:`flex gap-3 mb-3`},pn={class:`flex-1 min-w-0`},mn={class:`text-sm mb-1`},hn={class:`flex gap-3`},gn={class:`flex-1 min-w-0`},_n={class:`text-sm`};function vn(e,a,o,s,d,p){let m=u(`el-input`),g=u(`font-awesome-icon`),_=u(`el-button`),v=u(`el-dialog`);return l(),t(v,{"model-value":e.visible,width:`520px`,title:e.$t(`codingBridge.pair.title`),center:``,"onUpdate:modelValue":a[1]||=t=>e.$emit(`update:visible`,t)},{default:f(()=>[n(`div`,on,[n(`p`,sn,c(e.$t(`codingBridge.pair.intro`)),1),n(`ol`,cn,[n(`li`,ln,[a[3]||=n(`span`,{class:`step-index`},`1`,-1),n(`div`,un,[n(`p`,dn,c(e.$t(`codingBridge.pair.step1`)),1),a[2]||=n(`code`,{class:`cmd`},`pip install coding-bridge-agent`,-1)])]),n(`li`,fn,[a[5]||=n(`span`,{class:`step-index`},`2`,-1),n(`div`,pn,[n(`p`,mn,c(e.$t(`codingBridge.pair.step2`)),1),a[4]||=n(`code`,{class:`cmd`},`coding-bridge-agent up`,-1)])]),n(`li`,hn,[a[6]||=n(`span`,{class:`step-index`},`3`,-1),n(`div`,gn,[n(`p`,_n,c(e.$t(`codingBridge.pair.step3`)),1)])])]),i(m,{modelValue:e.code,"onUpdate:modelValue":a[0]||=t=>e.code=t,size:`large`,class:`mb-3`,placeholder:e.$t(`codingBridge.pair.codePlaceholder`),clearable:``,onKeyup:h(e.onClaim,[`enter`])},null,8,[`modelValue`,`placeholder`,`onKeyup`]),i(_,{type:`primary`,round:``,class:`w-full`,loading:e.claiming,disabled:!e.code.trim(),onClick:e.onClaim},{default:f(()=>[i(g,{icon:`fa-solid fa-link`,class:`mr-1`}),r(` `+c(e.$t(`codingBridge.pair.claim`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])])]),_:1},8,[`model-value`,`title`])}var yn=E(an,[[`render`,vn],[`__scopeId`,`data-v-3d1ed01f`]]),bn=o({name:`CodingBridgePermissionDialog`,components:{ElDialog:M,ElButton:v,FontAwesomeIcon:N},computed:{request(){return(this.$store.state.codingBridge?.permissions??[]).find(e=>!Z(e))},hasInput(){return!!this.request?.input&&Object.keys(this.request.input).length>0},inputText(){try{return JSON.stringify(this.request?.input,null,2)}catch{return String(this.request?.input??``)}}},methods:{onAllow(){this.request&&this.$store.dispatch(`codingBridge/resolvePermission`,{request_id:this.request.request_id,decision:`allow`})},onDeny(){this.request&&this.$store.dispatch(`codingBridge/resolvePermission`,{request_id:this.request.request_id,decision:`deny`})}}}),xn={key:0,class:`content`},Sn={class:`text-sm text-[var(--app-text-subtle)] mb-3`},Cn={class:`rounded-md border border-[var(--app-border-subtle)] p-3 mb-3`},wn={class:`flex items-center gap-2 font-medium`},Tn={key:0,class:`text-xs text-[var(--app-text-subtle)] mt-1`},En={key:1,class:`mt-2 text-xs overflow-x-auto whitespace-pre-wrap break-words text-[var(--app-text-subtle)] max-h-[200px]`},Dn={class:`flex justify-end gap-2`};function On(e,o,s,p,m,h){let g=u(`font-awesome-icon`),_=u(`el-button`),v=u(`el-dialog`);return l(),t(v,{"model-value":!!e.request,width:`480px`,title:e.$t(`codingBridge.permission.title`),"close-on-click-modal":!1,"show-close":!1,center:``},{footer:f(()=>[n(`div`,Dn,[i(_,{round:``,onClick:e.onDeny},{default:f(()=>[i(g,{icon:`fa-solid fa-xmark`,class:`mr-1`}),r(` `+c(e.$t(`codingBridge.permission.deny`)),1)]),_:1},8,[`onClick`]),i(_,{type:`primary`,round:``,onClick:e.onAllow},{default:f(()=>[i(g,{icon:`fa-solid fa-check`,class:`mr-1`}),r(` `+c(e.$t(`codingBridge.permission.allow`)),1)]),_:1},8,[`onClick`])])]),default:f(()=>[e.request?(l(),d(`div`,xn,[n(`p`,Sn,c(e.$t(`codingBridge.permission.subtitle`)),1),n(`div`,Cn,[n(`div`,wn,[i(g,{icon:`fa-solid fa-code`}),n(`span`,null,c(e.request.display_name||e.request.title||e.request.tool),1)]),e.request.description?(l(),d(`p`,Tn,c(e.request.description),1)):a(``,!0),e.hasInput?(l(),d(`pre`,En,c(e.inputText),1)):a(``,!0)])])):a(``,!0)]),_:1},8,[`model-value`,`title`])}var kn=E(bn,[[`render`,On]]),An=o({name:`CodingBridgeHistoryDrawer`,components:{ElDrawer:b,ElButton:v,FontAwesomeIcon:N},props:{visible:{type:Boolean,default:!1}},emits:[`update:visible`],computed:{currentNodeId(){return this.$store.state.codingBridge?.currentNodeId},loading(){return this.$store.state.codingBridge?.status?.getHistory===j.Request},sessions(){let e=this.currentNodeId;return[...e?this.$store.state.codingBridge?.history?.[e]??[]:[]].sort((e,t)=>(t.updated_at??0)-(e.updated_at??0))}},watch:{visible(e){e&&this.currentNodeId&&this.$store.dispatch(`codingBridge/getHistory`,this.currentNodeId)}},methods:{refresh(){this.currentNodeId&&this.$store.dispatch(`codingBridge/getHistory`,this.currentNodeId)},open(e){this.currentNodeId&&(this.$store.dispatch(`codingBridge/getHistoryDetail`,{node_id:this.currentNodeId,provider:e.provider,session_id:e.session_id}),this.$emit(`update:visible`,!1))},formatTime(e){try{return new Date(e).toLocaleString()}catch{return``}}}}),jn={class:`flex flex-col h-full`},Mn={class:`flex items-center justify-between mb-3`},Nn={class:`text-xs text-[var(--app-text-subtle)] m-0`},$={key:0,class:`m-auto text-sm text-[var(--app-text-subtle)]`},Pn={key:1,class:`m-auto text-sm text-[var(--app-text-subtle)]`},Fn={key:2,class:`m-auto text-sm text-[var(--app-text-subtle)] text-center`},In={key:3,class:`list-none m-0 p-0 flex-1 overflow-y-auto flex flex-col gap-2`},Ln=[`onClick`],Rn={class:`flex items-center gap-2 mb-1`},zn={class:`text-sm font-medium truncate flex-1`},Bn={class:`text-[11px] text-[var(--app-text-subtle)] truncate`},Vn={key:0},Hn={key:1},Un={class:`text-[11px] text-[var(--app-text-subtle)] mt-0.5`},Wn={key:0},Gn={key:1};function Kn(o,p,m,h,_,v){let y=u(`font-awesome-icon`),b=u(`el-button`),x=u(`el-drawer`);return l(),t(x,{"model-value":o.visible,direction:`rtl`,size:`380px`,title:o.$t(`codingBridge.history.title`),"onUpdate:modelValue":p[0]||=e=>o.$emit(`update:visible`,e)},{default:f(()=>[n(`div`,jn,[n(`div`,Mn,[n(`p`,Nn,c(o.$t(`codingBridge.history.intro`)),1),i(b,{size:`small`,round:``,loading:o.loading,onClick:o.refresh},{default:f(()=>[o.loading?a(``,!0):(l(),t(y,{key:0,icon:`fa-solid fa-rotate-right`,class:`mr-1`})),r(` `+c(o.$t(`codingBridge.history.refresh`)),1)]),_:1},8,[`loading`,`onClick`])]),o.currentNodeId?o.loading&&!o.sessions.length?(l(),d(`div`,Pn,c(o.$t(`codingBridge.history.loading`)),1)):o.sessions.length?(l(),d(`ul`,In,[(l(!0),d(g,null,s(o.sessions,t=>(l(),d(`li`,{key:t.provider+`:`+t.session_id,class:`item rounded-lg p-3 cursor-pointer border border-[var(--app-border-subtle)]`,onClick:e=>o.open(t)},[n(`div`,Rn,[n(`span`,{class:e([`provider-tag`,t.provider])},c(t.provider===`codex`?`Codex`:`Claude`),3),n(`span`,zn,c(t.title),1)]),n(`div`,Bn,[t.cwd?(l(),d(`span`,Vn,c(t.cwd),1)):a(``,!0),t.git_branch?(l(),d(`span`,Hn,` · `+c(t.git_branch),1)):a(``,!0)]),n(`div`,Un,[t.updated_at?(l(),d(`span`,Wn,c(o.formatTime(t.updated_at)),1)):a(``,!0),t.message_count?(l(),d(`span`,Gn,` · `+c(o.$t(`codingBridge.history.messages`,{count:t.message_count})),1)):a(``,!0)])],8,Ln))),128))])):(l(),d(`div`,Fn,c(o.$t(`codingBridge.history.empty`)),1)):(l(),d(`div`,$,c(o.$t(`codingBridge.session.noDevice`)),1))])]),_:1},8,[`model-value`,`title`])}var qn=o({name:`CodingBridgeIndex`,components:{ElButton:v,ElDrawer:b,FontAwesomeIcon:N,NodeList:ie,SessionView:rn,PairDialog:yn,PermissionDialog:kn,HistoryDrawer:E(An,[[`render`,Kn],[`__scopeId`,`data-v-3414881a`]])},data(){return{drawer:!1,pairVisible:!1,historyVisible:!1,initialCode:``}},mounted(){this.$store.dispatch(`codingBridge/connect`),this.$store.dispatch(`codingBridge/getNodes`);let e=this.$route.query.code;typeof e==`string`&&e&&(this.initialCode=e,this.pairVisible=!0)},beforeUnmount(){this.$store.dispatch(`codingBridge/disconnect`)},methods:{openPair(){this.initialCode=``,this.pairVisible=!0},openPairFromDrawer(){this.drawer=!1,this.openPair()}}}),Jn={class:`coding-bridge flex flex-row h-full relative`};function Yn(e,t,n,r,a,o){let s=u(`node-list`),c=u(`session-view`),p=u(`font-awesome-icon`),m=u(`el-button`),h=u(`el-drawer`),g=u(`pair-dialog`),_=u(`permission-dialog`),v=u(`history-drawer`);return l(),d(`div`,Jn,[i(s,{class:`sidebar w-[300px] flex-none`,onPair:e.openPair},null,8,[`onPair`]),i(c,{class:`flex-1 min-w-0`,onHistory:t[0]||=t=>e.historyVisible=!0}),i(m,{circle:``,class:`menu`,onClick:t[1]||=t=>e.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-laptop-code`})]),_:1}),i(h,{modelValue:e.drawer,"onUpdate:modelValue":t[2]||=t=>e.drawer=t,direction:`ltr`,"with-header":!1,size:`300px`,class:`drawer`},{default:f(()=>[i(s,{onPair:e.openPairFromDrawer},null,8,[`onPair`])]),_:1},8,[`modelValue`]),i(g,{visible:e.pairVisible,"onUpdate:visible":t[3]||=t=>e.pairVisible=t,"initial-code":e.initialCode},null,8,[`visible`,`initial-code`]),i(_),i(v,{visible:e.historyVisible,"onUpdate:visible":t[4]||=t=>e.historyVisible=t},null,8,[`visible`])])}var Xn=E(qn,[[`render`,Yn],[`__scopeId`,`data-v-3a406429`]]);export{Xn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,Bt as t,D as n,E as r,Ht as i,M as a,N as o,O as s,P as c,Q as l,Ut as u,X as d,et as f,k as p,lt as m,x as h,y as g}from"./vendor-chart-Df3WBvr0.js";import{t as _}from"./button-Diu_mJ2H.js";import{E as v}from"./use-deprecated-BhaeS12t.js";import{r as y,t as b}from"./select-DKxozijX.js";import{n as x,t as S}from"./tabs-BgpkhqCl.js";import{t as C}from"./upload-DnNyu5wB.js";import{t as w}from"./tooltip-hII4wDEz.js";import{t as T}from"./image-CokNERba.js";import{t as E}from"./alert-Cs6WDxgv.js";import{n as D,r as O}from"./radio-ClH7NqRe.js";import{t as k}from"./drawer-B42T8GMw.js";import{t as A}from"./input-number-BNMZAR_X.js";import{t as ee}from"./slider-BzGULsiS.js";import{t as j}from"./switch-B0qMUnX2.js";import{Jr as te,Qn as ne,tr as M}from"./constants-vDFRJTq6.js";import{At as N,Dt as P,E as F,Er as I,Mt as L,Nn as R,Nr as z,Ot as B,Tr as V,dn as H,gr as U,jr as re,kt as ie,yr as W}from"./index-Ux3Ldhqb.js";import{t as G}from"./index.es-DA4X-U-q.js";import{t as ae}from"./CopyToClipboard-16GJr0qC.js";import{t as oe}from"./FilePreview-CMxjg6m_.js";import{t as K}from"./ImagePreview-4aD6mCco.js";import{t as se}from"./BotPlaceholder-DuWkJHz7.js";import{i as q,n as ce,t as le}from"./pagination-Cqd54t6s.js";import{n as ue,t as de}from"./NoTasks-BMBpS8O_.js";import{t as J}from"./Consumption-CVy36l-D.js";import{t as fe}from"./ApiCodeButton-8Hg0Weqj.js";import{t as pe}from"./VideoPlayer-Qc7k-3La.js";var me=c({name:`LayoutKling`,components:{ElDrawer:k,ElButton:_,FontAwesomeIcon:G},data(){return{drawer:!1}}}),he={class:`main flex flex-row flex-1 min-h-0`},ge={class:`config w-[320px] flex-none h-full flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},_e={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ve(t,n,i,a,s,c){let l=f(`font-awesome-icon`),u=f(`el-button`),h=f(`el-drawer`);return d(),p(`div`,he,[r(`div`,ge,[e(t.$slots,`config`,{},void 0,!0)]),r(`div`,_e,[e(t.$slots,`result`,{},void 0,!0)]),o(u,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1}),o(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:m(()=>[e(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ye=F(me,[[`render`,ve],[`__scopeId`,`data-v-be4bb0df`]]),be={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};function Y(e,t,n){let r=t||`std`,i=n??5;switch(e){case`kling-v1`:return{text2video:!0,image2video:!0,endImage:i===5,audio:!1,motionControl:i===5};case`kling-v1-6`:case`kling-v2-5-turbo`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:!1,motionControl:!1};case`kling-v2-6`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:r===`pro`,motionControl:!1};case`kling-v2-master`:case`kling-v2-1-master`:return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};case`kling-v3`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:r!==`4k`};case`kling-v3-omni`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1};case`kling-video-o1`:return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1};default:return be}}function X(e,t){if(!e)return[];let n=t.model??e.model,r=t.mode??e.mode,i=t.duration??e.duration;if(!n)return[];let a=Y(n,r,i),o=[];return e.end_image_url&&!a.endImage&&o.push({field:`end_image_url`,i18nLabel:`kling.name.endImage`}),e.generate_audio&&!a.audio&&o.push({field:`generate_audio`,i18nLabel:`kling.name.generateAudio`}),e.camera_control?.type&&(!a.motionControl||e.start_image_url)&&o.push({field:`camera_control`,i18nLabel:`kling.name.cameraControl`}),o}function Z(e,t){let n={...e};for(let e of t)e.field===`end_image_url`&&(n.end_image_url=void 0),e.field===`generate_audio`&&(n.generate_audio=!1),e.field===`camera_control`&&(n.camera_control=void 0);return n}var xe=c({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-video-o1`,label:`Video-o1`}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(ne)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await V.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),I.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})}}}),Se={class:`field`},Ce={class:`title font-bold`};function we(e,t,i,a,o,s){let c=f(`el-option`),g=f(`el-select`);return d(),p(`div`,Se,[r(`h2`,Ce,u(e.$t(`pika.name.model`)),1),(d(),n(g,{key:e.revertKey,"model-value":e.value,class:`value`,placeholder:e.$t(`pika.placeholder.select`),onChange:e.onChange},{default:m(()=>[(d(!0),p(h,null,l(e.options,e=>(d(),n(c,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Te=F(xe,[[`render`,we],[`__scopeId`,`data-v-04059875`]]),Ee=c({name:`ModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:q},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 M.includes(this.selectedModel)?this.cameraControlSet?this.$t(`kling.description.mode4kIncompatibleCamera`):``:this.$t(`kling.description.mode4kRequiresV3`)},options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`),disabled:!1,disabledReason:``},{value:`pro`,label:this.$t(`kling.name.modePro`),disabled:!1,disabledReason:``},{value:`4k`,label:this.$t(`kling.name.mode4k`),disabled:!!this.fourKReason,disabledReason:this.fourKReason}]},value(){return this.$store.state.kling?.config?.mode}},watch:{fourKReason(e){e&&this.value===`4k`&&this.applyMode(`std`)}},mounted(){this.value||this.applyMode(`std`)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await V.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),I.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})}}}),De={class:`field`},Oe={class:`header`},ke={class:`title font-bold`},Ae={key:0,class:`opt-tip`};function je(e,i,a,c,g,_){let v=f(`info-icon`),y=f(`el-option`),b=f(`el-select`);return d(),p(`div`,De,[r(`div`,Oe,[r(`h2`,ke,u(e.$t(`kling.name.mode`)),1),o(v,{content:e.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(d(),n(b,{key:e.revertKey,"model-value":e.value,class:`value`,placeholder:e.$t(`kling.placeholder.select`),clearable:!0,onChange:e.onChange},{default:m(()=>[(d(!0),p(h,null,l(e.options,e=>(d(),n(y,{key:e.value,label:e.label,value:e.value,disabled:e.disabled},{default:m(()=>[r(`span`,{class:t({"opt-disabled":e.disabled})},u(e.label),3),e.disabled&&e.disabledReason?(d(),p(`span`,Ae,u(e.disabledReason),1)):s(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Me=F(Ee,[[`render`,je],[`__scopeId`,`data-v-9a8fa3c5`]]),Ne=[3,5,8,10,12,15],Pe=[5,10],Fe=c({name:`DurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:q},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return M.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?Ne:Pe},value(){return this.$store.state.kling?.config?.duration??5},selectValue(){let e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(5)?5:e[0]}},watch:{isV3Model(){this.allowedDurations.includes(this.value)||this.applyDuration(5)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(5)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await V.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),I.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})}}}),Ie={class:`field`},Le={class:`control`},Re={class:`label`},ze={class:`title font-bold`};function Be(e,t,i,a,s,c){let g=f(`info-icon`),_=f(`el-option`),v=f(`el-select`);return d(),p(`div`,Ie,[r(`div`,Le,[r(`div`,Re,[r(`h2`,ze,u(e.$t(`kling.name.duration`)),1),o(g,{content:e.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(d(),n(v,{key:e.revertKey,"model-value":e.selectValue,class:`value`,placeholder:e.$t(`kling.placeholder.select`),onChange:e.onChange},{default:m(()=>[(d(!0),p(h,null,l(e.allowedDurations,e=>(d(),n(_,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var Ve=F(Fe,[[`render`,Be],[`__scopeId`,`data-v-5ae55e28`]]),He=c({name:`RatioSelector`,data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug(`set ratio`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||=`1:1`}}),Ue={class:`text-sm font-bold mb-2 block`},We={class:`items`},Ge=[`onClick`],Ke={class:`name`};function qe(e,n,a,o,s,c){return d(),p(`div`,null,[r(`span`,Ue,u(e.$t(`kling.name.ratio`)),1),r(`div`,We,[(d(!0),p(h,null,l(e.options,(n,a)=>(d(),p(`div`,{key:a,class:t({active:e.active===a,item:!0}),onClick:t=>e.value=n.value},[r(`div`,{class:t([`preview`,n.label])},[r(`div`,{class:`rect`,style:i({width:n.width+`px`,height:n.height+`px`})},null,4)],2),r(`p`,Ke,u(n.label),1)],10,Ge))),128))])])}var Je=F(He,[[`render`,qe],[`__scopeId`,`data-v-cdb14b2f`]]),Ye=c({name:`StartImage`,components:{ElUpload:C,ElButton:_,ElTooltip:w,InfoIcon:q,FontAwesomeIcon:G,ImagePreview:K},mixins:[N,B],emits:[`change`],data(){return{fileList:[],uploadUrl:W()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){I.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){I.error(this.$t(`kling.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Xe={class:`relative`},Ze={class:`flex justify-between`},Qe={class:`flex justify-start items-center`},$e={class:`text-sm font-bold`};function et(e,t,i,c,l,h){let g=f(`info-icon`),_=f(`image-preview`),v=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-tooltip`),x=f(`el-upload`);return d(),p(`div`,Xe,[r(`div`,Ze,[r(`div`,Qe,[r(`span`,$e,u(e.$t(`kling.name.startImage`)),1),o(g,{content:e.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.reachedLimit,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:t})=>[t.url&&t.percentage!==void 0?(d(),n(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):s(``,!0)]),default:m(()=>[o(b,{content:e.$t(`kling.message.uploadReferencesExceed`),disabled:!e.reachedLimit,placement:`top`},{default:m(()=>[r(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.reachedLimit},{default:m(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var tt=F(Ye,[[`render`,et],[`__scopeId`,`data-v-756dc269`]]),nt=c({name:`EndImage`,components:{ElUpload:C,ElButton:_,ElTooltip:w,ImagePreview:K,InfoIcon:q,FontAwesomeIcon:G},mixins:[N,B],data(){return{fileList:[],uploadUrl:W()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},klingConfig(){return this.$store.state?.kling?.config||{}},endImageSupported(){return Y(this.klingConfig.model,this.klingConfig.mode,this.klingConfig.duration).endImage},hasStartImage(){return!!this.klingConfig.start_image_url},uploadDisabled(){return this.reachedLimit||!this.endImageSupported||!this.hasStartImage},uploadTooltip(){return this.endImageSupported?this.hasStartImage?this.reachedLimit?this.$t(`kling.message.uploadReferencesExceed`):``:this.$t(`kling.message.endImageRequiresStart`):this.$t(`kling.message.endImageNotSupported`)},storeValue(){return this.klingConfig.end_image_url},value:{get(){return this.storeValue},set(){}}},watch:{storeValue(e){!e&&this.fileList.length>0&&(this.fileList=[])},hasStartImage(e){!e&&this.storeValue&&(this.fileList=[],this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:void 0}))}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onBeforeUpload(){return this.endImageSupported?this.hasStartImage?!0:(I.warning(this.$t(`kling.message.endImageRequiresStart`)),!1):(I.warning(this.$t(`kling.message.endImageNotSupported`)),!1)},onExceed(){I.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){I.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()}}}),rt={class:`relative`},it={class:`flex justify-between`},at={class:`flex justify-start items-center`},ot={class:`text-sm font-bold`};function st(e,t,i,c,l,h){let g=f(`info-icon`),_=f(`image-preview`),v=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-tooltip`),x=f(`el-upload`);return d(),p(`div`,rt,[r(`div`,it,[r(`div`,at,[r(`span`,ot,u(e.$t(`kling.name.endImage`)),1),o(g,{content:e.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"before-upload":e.onBeforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:t})=>[t.url&&t.percentage!==void 0?(d(),n(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):s(``,!0)]),default:m(()=>[o(b,{content:e.uploadTooltip,disabled:!e.uploadDisabled,placement:`top`},{default:m(()=>[r(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.uploadDisabled},{default:m(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var ct=F(nt,[[`render`,st],[`__scopeId`,`data-v-c1b257e5`]]),lt=c({name:`CfgScaleSelector`,components:{ElSlider:ee,InfoIcon:q,ElInputNumber:A},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug(`set cfg_scale`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||=0}}),ut={class:`flex justify-between`},dt={class:`flex justify-start items-center`},ft={class:`text-sm font-bold`},pt={class:`flex justify-end items-center`},mt={class:`w-full`};function ht(e,t,n,i,a,s){let c=f(`info-icon`),l=f(`el-input-number`),m=f(`el-slider`);return d(),p(`div`,null,[r(`div`,ut,[r(`div`,dt,[r(`span`,ft,u(e.$t(`kling.name.cfgScale`)),1),o(c,{content:e.$t(`kling.description.cfgScale`)},null,8,[`content`])]),r(`div`,pt,[o(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,"controls-position":`right`},null,8,[`modelValue`])])]),r(`div`,mt,[o(m,{modelValue:e.value,"onUpdate:modelValue":t[1]||=t=>e.value=t,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var gt=F(lt,[[`render`,ht]]),_t=c({name:`GenerateAudioSelector`,components:{ElSwitch:j,InfoIcon:q},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(M.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})}}}),vt={class:`relative`},yt={class:`flex justify-between items-center`},bt={class:`flex justify-start items-center`},xt={class:`text-sm font-bold`};function St(e,t,n,i,a,s){let c=f(`info-icon`),l=f(`el-switch`);return d(),p(`div`,vt,[r(`div`,yt,[r(`div`,bt,[r(`span`,xt,u(e.$t(`kling.name.generateAudio`)),1),o(c,{content:e.tooltipContent},null,8,[`content`])]),o(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,disabled:!e.supported},null,8,[`modelValue`,`disabled`])])])}var Ct=F(_t,[[`render`,St]]),wt=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],Tt=c({name:`CameraControlSelector`,components:{ElSelect:y,ElOption:b,ElSlider:ee,ElInputNumber:A,InfoIcon:q},data(){return{configKeys:wt}},computed:{typeOptions(){return[{value:``,label:this.$t(`kling.name.cameraTypeNone`)},{value:`simple`,label:this.$t(`kling.name.cameraTypeSimple`)},{value:`down_back`,label:this.$t(`kling.name.cameraTypeDownBack`)},{value:`forward_up`,label:this.$t(`kling.name.cameraTypeForwardUp`)},{value:`left_turn_forward`,label:this.$t(`kling.name.cameraTypeLeftTurnForward`)},{value:`right_turn_forward`,label:this.$t(`kling.name.cameraTypeRightTurnForward`)}]},selectedMode(){return this.$store.state.kling?.config?.mode||``},selectedModel(){return this.$store.state.kling?.config?.model||``},selectedDuration(){return this.$store.state.kling?.config?.duration},motionControlSupported(){return Y(this.selectedModel,this.selectedMode,this.selectedDuration).motionControl},hasStartImage(){return!!this.$store.state.kling?.config?.start_image_url},disabled(){return!this.motionControlSupported||this.hasStartImage},tooltipContent(){return this.motionControlSupported?this.hasStartImage?this.$t(`kling.description.cameraControlDisabledImage2Video`):this.$t(`kling.description.cameraControl`):this.$t(`kling.description.cameraControlNotSupported`)},selectedType(){return this.$store.state.kling?.config?.camera_control?.type},selectedTypeRaw:{get(){return this.selectedType??``},set(e){let t=this.$store.state.kling?.config||{};if(!e){let e={...t};delete e.camera_control,this.$store.commit(`kling/setConfig`,e);return}let n=e;this.$store.commit(`kling/setConfig`,{...t,camera_control:{type:n,config:n===`simple`?t.camera_control?.config||{}:void 0}})}},configValues(){return this.$store.state.kling?.config?.camera_control?.config||{}}},watch:{disabled(e){e&&this.selectedType!==void 0&&(this.selectedTypeRaw=``)}},methods:{writeConfig(e,t){let n=this.$store.state.kling?.config||{},r=n.camera_control||{type:`simple`},i={...r.config||{}};t==null?delete i[e]:i[e]=t,this.$store.commit(`kling/setConfig`,{...n,camera_control:{...r,type:`simple`,config:i}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),Et={class:`field`},Dt={class:`header`},Ot={class:`text-sm font-bold`},kt={key:0,class:`config-grid`},At={class:`cfg-row-head`},jt={class:`cfg-name`};function Mt(e,t,i,a,c,g){let _=f(`info-icon`),v=f(`el-option`),y=f(`el-select`),b=f(`el-input-number`),x=f(`el-slider`);return d(),p(`div`,Et,[r(`div`,Dt,[r(`span`,Ot,u(e.$t(`kling.name.cameraControl`)),1),o(_,{content:e.tooltipContent},null,8,[`content`])]),o(y,{modelValue:e.selectedTypeRaw,"onUpdate:modelValue":t[0]||=t=>e.selectedTypeRaw=t,class:`value`,placeholder:e.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:e.disabled},{default:m(()=>[(d(!0),p(h,null,l(e.typeOptions,e=>(d(),n(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),e.selectedType===`simple`&&!e.disabled?(d(),p(`div`,kt,[(d(!0),p(h,null,l(e.configKeys,t=>(d(),p(`div`,{key:t,class:`cfg-row`},[r(`div`,At,[r(`span`,jt,u(e.$t(`kling.name.cc_${t}`)),1),o(b,{modelValue:e.configValues[t],"onUpdate:modelValue":n=>e.configValues[t]=n,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:n=>e.onNumberChange(t,n)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),o(x,{"model-value":e.configValues[t]??0,min:-1,max:1,step:.1,onInput:n=>e.onSliderChange(t,n)},null,8,[`model-value`,`onInput`])]))),128))])):s(``,!0)])}var Nt=F(Tt,[[`render`,Mt],[`__scopeId`,`data-v-cd896060`]]),Pt=[{groupKey:`cameraMovements`,chipKeys:[`rotateAround`,`stationary`,`handheld`,`zoomOut`,`zoomIn`,`follow`,`panRight`,`tiltUp`,`tiltDown`,`orbit`]},{groupKey:`cameraSpeed`,chipKeys:[`speedSlow`,`speedMedium`,`speedFast`]},{groupKey:`shotType`,chipKeys:[`shotClose`,`shotMedium`,`shotLong`,`shotLowAngle`,`shotHighAngle`,`shotShallowDof`,`shotFront`,`shotProfile`,`shotCloseUp`,`shotDrone`]},{groupKey:`light`,chipKeys:[`lightSunlight`,`lightSoft`,`lightNeon`,`lightWarm`,`lightNature`,`lightCandle`,`lightCityNight`]},{groupKey:`frame`,chipKeys:[`frameRichDetails`,`frameSimpleBg`]},{groupKey:`atmosphere`,chipKeys:[`atmosphereMysterious`,`atmospherePeaceful`,`atmosphereHeartwarming`,`atmosphereVivid`,`atmosphereColorful`]}],Q=`, `;function Ft(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${Q}${t}`:t}function $(e,t){if(!e||!t)return e||``;let n=[`${t}${Q}`,`${Q}${t}`,t],r=e;for(let e of n)if(r.includes(e)){r=r.replace(e,``);break}return r.replace(/(?:,\s*)+$/,``).replace(/^(?:,\s*)+/,``)}var It=c({name:`InspirationPills`,components:{FontAwesomeIcon:G},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return Pt.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selected(){let e=this.prompt;if(!e)return[];let t=[];for(let n of this.allChipTexts){let r=e.indexOf(n);r!==-1&&t.push({text:n,idx:r})}return t.sort((e,t)=>e.idx-t.idx).map(e=>e.text)}},methods:{onRemove(e){let t=$(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),Lt={key:0,class:`pills`,role:`list`},Rt={class:`pill-text`},zt=[`aria-label`,`onClick`];function Bt(e,t,n,i,a,c){let m=f(`font-awesome-icon`);return e.selected.length>0?(d(),p(`div`,Lt,[(d(!0),p(h,null,l(e.selected,t=>(d(),p(`div`,{key:t,class:`pill`,role:`listitem`},[r(`span`,Rt,u(t),1),r(`button`,{type:`button`,class:`pill-remove`,"aria-label":e.$t(`kling.inspiration.removeChip`),onClick:g(n=>e.onRemove(t),[`stop`])},[o(m,{icon:`fa-solid fa-xmark`})],8,zt)]))),128))])):s(``,!0)}var Vt=c({name:`PromptInput`,components:{ElButton:_,FontAwesomeIcon:G,PromptTextarea:ue,InspirationPills:F(It,[[`render`,Bt],[`__scopeId`,`data-v-5fc4fa65`]])},emits:[`open-inspiration`],computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ht(e,t,r,i,s,c){let l=f(`font-awesome-icon`),p=f(`el-button`),h=f(`inspiration-pills`),g=f(`prompt-textarea`);return d(),n(g,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`kling.name.prompt`),info:e.$t(`kling.description.prompt`),placeholder:e.$t(`kling.placeholder.prompt`)},{actions:m(()=>[o(p,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:m(()=>[o(l,{icon:`fa-regular fa-lightbulb`,class:`mr-1`}),a(` `+u(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:m(()=>[o(h)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var Ut=F(Vt,[[`render`,Ht],[`__scopeId`,`data-v-c01fc1a6`]]),Wt=c({name:`NegativePromptInput`,components:{ElInput:z,InfoIcon:q},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||=``}}),Gt={class:`field`},Kt={class:`box`},qt={class:`title font-bold`};function Jt(e,t,n,i,a,s){let c=f(`info-icon`),l=f(`el-input`);return d(),p(`div`,Gt,[r(`div`,Kt,[r(`h2`,qt,u(e.$t(`kling.name.negativePrompt`)),1),o(c,{content:e.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),o(l,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var Yt=F(Wt,[[`render`,Jt],[`__scopeId`,`data-v-de98cf01`]]),Xt=c({name:`InspirationDrawer`,components:{ElDrawer:k,ElButton:_,FontAwesomeIcon:G},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:Pt,Close:v}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit(`update:modelValue`,e)}},drawerSize(){return window.innerWidth<768?`100%`:`380px`},prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return this.groups.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selectedCount(){return this.allChipTexts.filter(e=>this.isSelected(e)).length}},methods:{chipText(e){return this.$t(`kling.inspiration.chip.${e}`)},isSelected(e){return e?this.prompt.includes(e):!1},setPrompt(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})},onToggle(e){e&&(this.isSelected(e)?this.setPrompt($(this.prompt,e)):this.setPrompt(Ft(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=$(e,t);this.setPrompt(e)}}}),Zt={class:`drawer-content`},Qt={class:`drawer-header`},$t={class:`title-row`},en={class:`title`},tn={class:`hint`},nn={key:0,class:`selected-bar`},rn={class:`selected-text`},an={class:`groups`},on={class:`group-title`},sn={class:`chip-grid`},cn=[`onClick`];function ln(e,i,c,g,_,v){let y=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-drawer`);return d(),n(x,{modelValue:e.visible,"onUpdate:modelValue":i[1]||=t=>e.visible=t,direction:`rtl`,"with-header":!1,size:e.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:m(()=>[r(`div`,Zt,[r(`div`,Qt,[r(`div`,$t,[o(y,{icon:`fa-regular fa-lightbulb`,class:`mr-2`}),r(`span`,en,u(e.$t(`kling.inspiration.title`)),1)]),o(b,{text:``,icon:e.Close,class:`close-btn`,onClick:i[0]||=t=>e.visible=!1},null,8,[`icon`])]),r(`div`,tn,u(e.$t(`kling.inspiration.hint`)),1),e.selectedCount>0?(d(),p(`div`,nn,[r(`span`,rn,u(e.$t(`kling.inspiration.selectedSummary`,{count:e.selectedCount})),1),o(b,{text:``,size:`small`,class:`clear-btn`,onClick:e.onClearSelected},{default:m(()=>[a(u(e.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):s(``,!0),r(`div`,an,[(d(!0),p(h,null,l(e.groups,n=>(d(),p(`div`,{key:n.groupKey,class:`group`},[r(`div`,on,u(e.$t(`kling.inspiration.group.${n.groupKey}`)),1),r(`div`,sn,[(d(!0),p(h,null,l(n.chipKeys,n=>(d(),p(`button`,{key:n,type:`button`,class:t({chip:!0,active:e.isSelected(e.chipText(n))}),onClick:t=>e.onToggle(e.chipText(n))},u(e.chipText(n)),11,cn))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var un=F(Xt,[[`render`,ln],[`__scopeId`,`data-v-7d457a69`]]),dn={"kling-v3":`v3`,"kling-v3-omni":`v3-Omni`,"kling-v2-6":`v2.6`,"kling-v2-5-turbo":`v2.5-Turbo`,"kling-v2-1-master":`v2.1-Master`,"kling-v2-master":`v2-Master`,"kling-v1-6":`v1.6`,"kling-v1":`v1`,"kling-video-o1":`Video-o1`},fn={std:`720p`,pro:`1080p`,"4k":`4K`},pn=c({name:`SummaryChip`,components:{FontAwesomeIcon:G},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return dn[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return fn[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),mn={class:`summary-chip`},hn=[`title`],gn=[`title`],_n=[`title`],vn=[`title`],yn=[`title`];function bn(e,t,n,i,a,c){let l=f(`font-awesome-icon`);return d(),p(`div`,mn,[r(`span`,{class:`part`,title:e.$t(`kling.name.model`)},u(e.modelLabel),9,hn),t[0]||=r(`span`,{class:`dot`},`·`,-1),r(`span`,{class:`part`,title:e.$t(`kling.name.duration`)},u(e.durationLabel),9,gn),t[1]||=r(`span`,{class:`dot`},`·`,-1),r(`span`,{class:`part`,title:e.$t(`kling.name.ratio`)},u(e.aspectRatio||`16:9`),9,_n),t[2]||=r(`span`,{class:`dot`},`·`,-1),r(`span`,{class:`part`,title:e.$t(`kling.name.mode`)},u(e.modeLabel),9,vn),e.generateAudio?(d(),p(`span`,{key:0,class:`audio`,title:e.$t(`kling.name.generateAudio`)},[o(l,{icon:`fa-solid fa-headphones`})],8,yn)):s(``,!0)])}var xn=c({name:`ConfigPanel`,components:{ElButton:_,Consumption:J,FontAwesomeIcon:G,PromptInput:Ut,NegativePromptInput:Yt,ModelSelector:Te,ModeSelector:Me,DurationSelector:Ve,RatioSelector:Je,StartImage:tt,CfgScaleSelector:gt,GenerateAudioSelector:Ct,CameraControlSelector:Nt,InspirationDrawer:un,SummaryChip:F(pn,[[`render`,bn],[`__scopeId`,`data-v-418a6733`]]),EndImage:ct},emits:[`generate`],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return L(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Sn={class:`flex flex-col h-full`},Cn={class:`flex-1 overflow-y-auto p-5`},wn={class:`flex flex-col items-center justify-center px-5 pb-5`};function Tn(e,t,i,s,c,l){let h=f(`prompt-input`),g=f(`model-selector`),_=f(`ratio-selector`),v=f(`start-image`),y=f(`end-image`),b=f(`duration-selector`),x=f(`mode-selector`),S=f(`generate-audio-selector`),C=f(`camera-control-selector`),w=f(`cfg-scale-selector`),T=f(`negative-prompt-input`),E=f(`summary-chip`),D=f(`consumption`),O=f(`font-awesome-icon`),k=f(`el-button`),A=f(`inspiration-drawer`);return d(),p(`div`,Sn,[r(`div`,Cn,[o(h,{class:`mb-4`,onOpenInspiration:t[0]||=t=>e.inspirationOpen=!0}),o(g,{class:`mb-4`}),o(_,{class:`mb-4`}),o(v,{class:`mb-2`}),o(y,{class:`mb-2`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`}),o(C,{class:`mb-4`}),o(w,{class:`mb-4`}),o(T,{class:`mb-4`})]),r(`div`,wn,[o(E),o(D,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),e.config?.video_url!==void 0||e.config?.custom?(d(),n(k,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:m(()=>[o(O,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`kling.button.extend`)),1)]),_:1},8,[`onClick`])):(d(),n(k,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:m(()=>[o(O,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`kling.button.generate`)),1)]),_:1},8,[`onClick`]))]),o(A,{modelValue:e.inspirationOpen,"onUpdate:modelValue":t[1]||=t=>e.inspirationOpen=t},null,8,[`modelValue`])])}var En=F(xn,[[`render`,Tn]]),Dn=c({name:`MotionImage`,components:{ElUpload:C,ElButton:_,InfoIcon:q,FontAwesomeIcon:G,ImagePreview:K},mixins:[N,B],data(){return{fileList:[],uploadUrl:W()+`/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(){I.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){I.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()}}}),On={class:`relative`},kn={class:`flex justify-between`},An={class:`flex justify-start items-center`},jn={class:`text-sm font-bold`};function Mn(e,t,i,c,l,h){let g=f(`info-icon`),_=f(`image-preview`),v=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-upload`);return d(),p(`div`,On,[r(`div`,kn,[r(`div`,An,[r(`span`,jn,u(e.$t(`kling.name.motionImage`)),1),o(g,{content:e.$t(`kling.description.motionImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:t})=>[t.url&&t.percentage!==void 0?(d(),n(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`])):s(``,!0)]),default:m(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:m(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Nn=F(Dn,[[`render`,Mn],[`__scopeId`,`data-v-e52eaf2f`]]),Pn=c({name:`MotionVideo`,components:{ElUpload:C,ElButton:_,InfoIcon:q,FilePreview:oe,FontAwesomeIcon:G},mixins:[B],data(){return{fileList:[],uploadUrl:W()+`/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(){I.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){I.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:(I.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(I.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()}}}),Fn={class:`relative`},In={class:`flex justify-between`},Ln={class:`flex justify-start items-center`},Rn={class:`text-sm font-bold`};function zn(e,t,i,c,l,h){let g=f(`info-icon`),_=f(`file-preview`),v=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-upload`);return d(),p(`div`,Fn,[r(`div`,In,[r(`div`,Ln,[r(`span`,Rn,u(e.$t(`kling.name.motionVideo`)),1),o(g,{content:e.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),o(b,{"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:t})=>[t.percentage===void 0?s(``,!0):(d(),n(_,{key:0,url:t.url||t.response?.file_url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:m(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:m(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$t(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Bn=F(Pn,[[`render`,zn],[`__scopeId`,`data-v-7019a8d2`]]),Vn=c({name:`MotionPromptInput`,components:{ElInput:z,InfoIcon:q},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),Hn={class:`field`},Un={class:`box`},Wn={class:`title font-bold`};function Gn(e,t,n,i,a,s){let c=f(`info-icon`),l=f(`el-input`);return d(),p(`div`,Hn,[r(`div`,Un,[r(`h2`,Wn,u(e.$t(`kling.name.motionPrompt`)),1),o(c,{content:e.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),o(l,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Kn=F(Vn,[[`render`,Gn],[`__scopeId`,`data-v-ca9fdbe5`]]),qn=`video`,Jn=c({name:`CharacterOrientationSelector`,components:{ElRadioGroup:O,ElRadioButton:D,InfoIcon:q},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||qn},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,character_orientation:e})}}},mounted(){this.$store.state.kling?.motionConfig?.character_orientation||(this.value=qn)}}),Yn={class:`field`},Xn={class:`header`},Zn={class:`text-sm font-bold`};function Qn(e,t,n,i,s,c){let l=f(`info-icon`),h=f(`el-radio-button`),g=f(`el-radio-group`);return d(),p(`div`,Yn,[r(`div`,Xn,[r(`span`,Zn,u(e.$t(`kling.name.characterOrientation`)),1),o(l,{content:e.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),o(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,size:`small`,class:`value`},{default:m(()=>[o(h,{label:`image`},{default:m(()=>[a(u(e.$t(`kling.name.orientationImage`)),1)]),_:1}),o(h,{label:`video`},{default:m(()=>[a(u(e.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var $n=F(Jn,[[`render`,Qn],[`__scopeId`,`data-v-7a91195b`]]),er=`std`,tr=c({name:`MotionModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:q},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||er},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=er)}}),nr={class:`field`},rr={class:`header`},ir={class:`title font-bold`};function ar(e,t,i,a,s,c){let g=f(`info-icon`),_=f(`el-option`),v=f(`el-select`);return d(),p(`div`,nr,[r(`div`,rr,[r(`h2`,ir,u(e.$t(`kling.name.mode`)),1),o(g,{content:e.$t(`kling.description.motionMode`)},null,8,[`content`])]),o(v,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`kling.placeholder.select`)},{default:m(()=>[(d(!0),p(h,null,l(e.options,e=>(d(),n(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var or=F(tr,[[`render`,ar],[`__scopeId`,`data-v-1295688c`]]),sr=c({name:`KeepOriginalSoundSelector`,components:{ElSwitch:j,InfoIcon:q},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`})}}}}),cr={class:`relative`},lr={class:`flex justify-between items-center`},ur={class:`flex justify-start items-center`},dr={class:`text-sm font-bold`};function fr(e,t,n,i,a,s){let c=f(`info-icon`),l=f(`el-switch`);return d(),p(`div`,cr,[r(`div`,lr,[r(`div`,ur,[r(`span`,dr,u(e.$t(`kling.name.keepOriginalSound`)),1),o(c,{content:e.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),o(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t},null,8,[`modelValue`])])])}var pr=c({name:`MotionPanel`,components:{ElButton:_,FontAwesomeIcon:G,Consumption:J,MotionImage:Nn,MotionVideo:Bn,MotionPromptInput:Kn,CharacterOrientationSelector:$n,MotionModeSelector:or,KeepOriginalSoundSelector:F(sr,[[`render`,fr]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return L(this.motionConfig,this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){let e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit(`generate`)}}}),mr={class:`flex flex-col h-full`},hr={class:`flex-1 overflow-y-auto p-5`},gr={class:`flex flex-col items-center justify-center px-5 pb-5`};function _r(e,t,n,i,s,c){let l=f(`motion-image`),h=f(`motion-video`),g=f(`motion-prompt-input`),_=f(`character-orientation-selector`),v=f(`motion-mode-selector`),y=f(`keep-original-sound-selector`),b=f(`consumption`),x=f(`font-awesome-icon`),S=f(`el-button`);return d(),p(`div`,mr,[r(`div`,hr,[o(l,{class:`mb-3`}),o(h,{class:`mb-3`}),o(g,{class:`mb-4`}),o(_,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`})]),r(`div`,gr,[o(b,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(S,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canGenerate,onClick:e.onGenerate},{default:m(()=>[o(x,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var vr=F(pr,[[`render`,_r]]),yr=c({name:`KlingTabSwitcher`,components:{ElTabs:x,ElTabPane:S,ElTag:re},props:{modelValue:{type:String,default:`videos`}},emits:[`update:modelValue`],computed:{tabs(){return[{value:`videos`,label:this.$t(`kling.tab.videoGeneration`)},{value:`motion`,label:this.$t(`kling.tab.motionControl`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),br=[`title`],xr={class:`text`};function Sr(e,t,i,o,c,g){let _=f(`el-tag`),v=f(`el-tab-pane`),y=f(`el-tabs`);return d(),n(y,{"model-value":e.modelValue,class:`kling-tabs`,stretch:``,"onUpdate:modelValue":e.onUpdate},{default:m(()=>[(d(!0),p(h,null,l(e.tabs,e=>(d(),n(v,{key:e.value,name:e.value,disabled:e.disabled},{label:m(()=>[r(`span`,{class:`tab-label`,title:e.disabled?e.disabledReason:void 0},[r(`span`,xr,u(e.label),1),e.badge?(d(),n(_,{key:0,size:`small`,type:`warning`,class:`badge`},{default:m(()=>[a(u(e.badge),1)]),_:2},1024)):s(``,!0)],8,br)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Cr=F(yr,[[`render`,Sr],[`__scopeId`,`data-v-bf00c27e`]]),wr=c({name:`TaskPreview`,components:{ElImage:T,CopyToClipboard:ae,FontAwesomeIcon:G,ElAlert:E,VideoPlayer:pe,ElTooltip:w,ElButton:_,ImagePreview:K,ApiCodeButton:fe},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},referenceImages(){let e=[],t=this.modelValue?.request?.start_image_url,n=this.modelValue?.request?.end_image_url;return t&&e.push({url:t,name:`start-image`}),n&&e.push({url:n,name:`end-image`}),e}},methods:{onDownload(e,t){e.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Tr={class:`preview`},Er={class:`left`},Dr={class:`main`},Or={class:`bot`},kr={class:`datetime`},Ar={class:`info`},jr={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Mr={key:1,class:`prompt mt-2`},Nr={key:0},Pr={key:1},Fr={key:0,class:t({content:!0,failed:!0})},Ir={key:0,class:`mb-4`},Lr={key:1,class:t({operations:!0,"mt-2":!0})},Rr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},zr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Br={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Vr={key:1,class:t({content:!0})},Hr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ur={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Wr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Gr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Kr={key:2,class:t({content:!0})},qr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Jr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Yr(e,t,i,c,g,_){let v=f(`el-image`),y=f(`image-preview`),b=f(`video-player`),x=f(`el-button`),S=f(`el-tooltip`),C=f(`api-code-button`),w=f(`font-awesome-icon`),T=f(`copy-to-clipboard`),E=f(`el-alert`);return d(),p(`div`,Tr,[r(`div`,Er,[o(v,{src:`https://cdn.acedata.cloud/qpbbbb.jpg`,class:`avatar`})]),r(`div`,Dr,[r(`div`,Or,[a(u(e.$t(`kling.name.klingBot`))+` `,1),r(`span`,kr,u(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),r(`div`,Ar,[e.referenceImages.length>0?(d(),p(`div`,jr,[(d(!0),p(h,null,l(e.referenceImages,(e,t)=>(d(),n(y,{key:t,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128))])):s(``,!0),e.modelValue?.request?.prompt?(d(),p(`p`,Mr,[a(u(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?s(``,!0):(d(),p(`span`,Nr,` - (`+u(e.$t(`kling.status.pending`))+`) `,1)),e.modelValue?.response?.state===`submitted`||e.modelValue?.response?.state===`processing`||e.modelValue?.response?.state===`pending`||e.modelValue?.response?.state===`completed`?(d(),p(`span`,Pr,` - (`+u(e.$t(`kling.status.processing`))+`) `,1)):s(``,!0)])):s(``,!0)]),e.modelValue?.response?.success===!0?(d(),p(`div`,Fr,[e.modelValue?.response.video_url?(d(),p(`div`,Ir,[o(b,{src:e.modelValue?.response.video_url},null,8,[`src`])])):s(``,!0),e.modelValue?.response.success?(d(),p(`div`,Lr,[o(S,{class:`box-item`,effect:`dark`,content:e.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:m(()=>[e.modelValue?.response.video_url?(d(),n(x,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:t[0]||=t=>e.onDownload(t,e.modelValue?.response.video_url)},{default:m(()=>[a(u(e.$t(`kling.button.download`)),1)]),_:1})):s(``,!0)]),_:1},8,[`content`]),o(C,{path:`/kling/videos`,body:e.modelValue?.request},null,8,[`body`])])):s(``,!0),o(E,{closable:!1,class:`mt-2 success`},{default:m(()=>[r(`p`,Rr,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.model`))+`: `+u(e.modelValue?.request?.model),1)]),r(`p`,zr,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(T,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(d(),p(`p`,Br,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):s(``,!0)]),_:1})])):s(``,!0),e.modelValue?.response?.success===!1?(d(),p(`div`,Vr,[o(E,{closable:!1,class:`failure`},{template:m(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.failure`)),1)]),default:m(()=>[r(`p`,Hr,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(T,{content:e.modelValue?.id},null,8,[`content`])]),r(`p`,Ur,[o(w,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.failureReason`))+`: `+u(e.modelValue?.response?.error?.message)+` `,1),o(T,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(d(),p(`p`,Wr,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):s(``,!0),e.modelValue?.response?.trace_id?(d(),p(`p`,Gr,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(T,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):s(``,!0)]),_:1})])):s(``,!0),e.modelValue?.response?.success===void 0?(d(),p(`div`,Kr,[o(E,{closable:!1,class:`info`},{template:m(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.failure`)),1)]),default:m(()=>[r(`p`,qr,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(T,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.response?.trace_id?(d(),p(`p`,Jr,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(T,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):s(``,!0)]),_:1})])):s(``,!0)])])}var Xr=c({name:`RecentPanel`,components:{TaskPreview:F(wr,[[`render`,Yr],[`__scopeId`,`data-v-422e2570`]]),NoTasks:de,BotPlaceholder:se,ScrollList:ce},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?.()}}}),Zr={key:0},Qr={key:2,class:`w-full h-full flex items-center justify-center`};function $r(e,t,r,i,a,c){let u=f(`bot-placeholder`),g=f(`task-preview`),_=f(`scroll-list`),v=f(`no-tasks`);return d(),p(h,null,[e.tasks?.items===void 0?(d(),p(`div`,Zr,[o(u)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(d(),n(_,{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:m(()=>[(d(!0),p(h,null,l(e.tasks?.items,e=>(d(),n(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):s(``,!0),e.tasks?.items?.length===0?(d(),p(`div`,Qr,[o(v)])):s(``,!0)],64)}var ei=F(Xr,[[`render`,$r]]),ti=te(`kling`),ni=c({name:`KlingIndex`,components:{ConfigPanel:En,MotionPanel:vr,TabSwitcher:Cr,Layout:ye,RecentPanel:ei},mixins:[ie],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===U.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===U.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},taskType(){return this.$store.state.kling.taskType||`videos`},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await le({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(!P(this.uploadTracker,e=>this.$t(e),e=>I.warning(e)))return;let{camera_control:e,...t}=this.config||{},n={...t,callback_url:ti};if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){I.warning(this.$t(`kling.message.endImageRequiresStart`));return}n.action||(n.video_id||t.video_url?n.action=`extend`:n.start_image_url?n.action=`image2video`:n.action=`text2video`),n.action===`text2video`&&n.end_image_url&&delete n.end_image_url,e?.type&&(n.camera_control={type:e.type,...e.type===`simple`&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,e])=>e!=null))}:{}});let r=this.credential?.token;if(!r){console.error(`no token specified`);return}I.info(this.$t(`kling.message.startingTask`)),R(`kling`,H.generate(n,{token:r})).then(()=>{I.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?I.error(this.$t(`kling.message.usedUp`)):I.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(!P(this.uploadTracker,e=>this.$t(e),e=>I.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){I.warning(this.$t(`kling.message.motionMissingInputs`));return}let t={image_url:e.image_url,video_url:e.video_url,character_orientation:e.character_orientation||`video`,mode:e.mode||`std`,keep_original_sound:e.keep_original_sound??`yes`,...e.prompt?{prompt:e.prompt}:{},callback_url:ti},n=this.credential?.token;if(!n){console.error(`no token specified`);return}I.info(this.$t(`kling.message.startingTask`)),R(`kling`,H.motion(t,{token:n})).then(()=>{I.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?I.error(this.$t(`kling.message.usedUp`)):I.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),ri={class:`flex flex-col h-full`},ii={class:`flex-1 min-h-0`};function ai(e,t,i,a,c,l){let u=f(`tab-switcher`),p=f(`config-panel`),h=f(`motion-panel`),g=f(`recent-panel`),_=f(`layout`);return d(),n(_,null,{config:m(()=>[r(`div`,ri,[o(u,{"model-value":e.taskType,"onUpdate:modelValue":e.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),r(`div`,ii,[e.taskType===`videos`?(d(),n(p,{key:0,onGenerate:e.onGenerate},null,8,[`onGenerate`])):e.taskType===`motion`?(d(),n(h,{key:1,onGenerate:e.onGenerateMotion},null,8,[`onGenerate`])):s(``,!0)])])]),result:m(()=>[o(g,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var oi=F(ni,[[`render`,ai]]);export{oi as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,Bt as t,D as n,E as r,Ht as i,M as a,N as o,O as s,P as c,Q as l,Ut as u,X as d,et as f,k as p,lt as m,x as h,y as g}from"./vendor-chart-Df3WBvr0.js";import{t as _}from"./button-Diu_mJ2H.js";import{E as v}from"./use-deprecated-BhaeS12t.js";import{r as y,t as b}from"./select-BR8DyZel.js";import{n as x,t as S}from"./tabs-DecpaDdx.js";import{t as C}from"./upload-DD2n4P3p.js";import{t as w}from"./tooltip-hII4wDEz.js";import{t as T}from"./image-DvjKNoxC.js";import{t as E}from"./alert-Cs6WDxgv.js";import{n as D,r as O}from"./radio-ClH7NqRe.js";import{t as k}from"./drawer-B42T8GMw.js";import{t as A}from"./input-number-Oh-d0JaX.js";import{t as ee}from"./slider-BZdPs70x.js";import{t as j}from"./switch-D1UMnFeG.js";import{Jr as te,Qn as ne,tr as M}from"./constants-vDFRJTq6.js";import{At as N,Dt as P,E as F,Er as I,Mt as L,Nn as R,Nr as z,Ot as B,Tr as V,dn as H,gr as U,jr as re,kt as ie,yr as W}from"./index-Bpg44eWB.js";import{t as G}from"./index.es-D2Gtib5p.js";import{t as ae}from"./CopyToClipboard-BvqdtQdo.js";import{t as oe}from"./FilePreview-BhfWzt3j.js";import{t as K}from"./ImagePreview-Cel1agBC.js";import{t as se}from"./BotPlaceholder-DdLK7DwC.js";import{i as q,n as ce,t as le}from"./pagination-BlR28kYu.js";import{n as ue,t as de}from"./NoTasks-BvxBJO_n.js";import{t as J}from"./Consumption-DiPiwllg.js";import{t as fe}from"./ApiCodeButton-DmgbbHgv.js";import{t as pe}from"./VideoPlayer-BBb01skM.js";var me=c({name:`LayoutKling`,components:{ElDrawer:k,ElButton:_,FontAwesomeIcon:G},data(){return{drawer:!1}}}),he={class:`main flex flex-row flex-1 min-h-0`},ge={class:`config w-[320px] flex-none h-full flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},_e={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ve(t,n,i,a,s,c){let l=f(`font-awesome-icon`),u=f(`el-button`),h=f(`el-drawer`);return d(),p(`div`,he,[r(`div`,ge,[e(t.$slots,`config`,{},void 0,!0)]),r(`div`,_e,[e(t.$slots,`result`,{},void 0,!0)]),o(u,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[o(l,{icon:`fa-solid fa-magic`})]),_:1}),o(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:m(()=>[e(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ye=F(me,[[`render`,ve],[`__scopeId`,`data-v-be4bb0df`]]),be={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};function Y(e,t,n){let r=t||`std`,i=n??5;switch(e){case`kling-v1`:return{text2video:!0,image2video:!0,endImage:i===5,audio:!1,motionControl:i===5};case`kling-v1-6`:case`kling-v2-5-turbo`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:!1,motionControl:!1};case`kling-v2-6`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:r===`pro`,motionControl:!1};case`kling-v2-master`:case`kling-v2-1-master`:return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};case`kling-v3`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:r!==`4k`};case`kling-v3-omni`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1};case`kling-video-o1`:return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1};default:return be}}function X(e,t){if(!e)return[];let n=t.model??e.model,r=t.mode??e.mode,i=t.duration??e.duration;if(!n)return[];let a=Y(n,r,i),o=[];return e.end_image_url&&!a.endImage&&o.push({field:`end_image_url`,i18nLabel:`kling.name.endImage`}),e.generate_audio&&!a.audio&&o.push({field:`generate_audio`,i18nLabel:`kling.name.generateAudio`}),e.camera_control?.type&&(!a.motionControl||e.start_image_url)&&o.push({field:`camera_control`,i18nLabel:`kling.name.cameraControl`}),o}function Z(e,t){let n={...e};for(let e of t)e.field===`end_image_url`&&(n.end_image_url=void 0),e.field===`generate_audio`&&(n.generate_audio=!1),e.field===`camera_control`&&(n.camera_control=void 0);return n}var xe=c({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-video-o1`,label:`Video-o1`}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(ne)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await V.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),I.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})}}}),Se={class:`field`},Ce={class:`title font-bold`};function we(e,t,i,a,o,s){let c=f(`el-option`),g=f(`el-select`);return d(),p(`div`,Se,[r(`h2`,Ce,u(e.$t(`pika.name.model`)),1),(d(),n(g,{key:e.revertKey,"model-value":e.value,class:`value`,placeholder:e.$t(`pika.placeholder.select`),onChange:e.onChange},{default:m(()=>[(d(!0),p(h,null,l(e.options,e=>(d(),n(c,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Te=F(xe,[[`render`,we],[`__scopeId`,`data-v-04059875`]]),Ee=c({name:`ModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:q},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 M.includes(this.selectedModel)?this.cameraControlSet?this.$t(`kling.description.mode4kIncompatibleCamera`):``:this.$t(`kling.description.mode4kRequiresV3`)},options(){return[{value:`std`,label:this.$t(`kling.name.modeStd`),disabled:!1,disabledReason:``},{value:`pro`,label:this.$t(`kling.name.modePro`),disabled:!1,disabledReason:``},{value:`4k`,label:this.$t(`kling.name.mode4k`),disabled:!!this.fourKReason,disabledReason:this.fourKReason}]},value(){return this.$store.state.kling?.config?.mode}},watch:{fourKReason(e){e&&this.value===`4k`&&this.applyMode(`std`)}},mounted(){this.value||this.applyMode(`std`)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await V.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),I.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})}}}),De={class:`field`},Oe={class:`header`},ke={class:`title font-bold`},Ae={key:0,class:`opt-tip`};function je(e,i,a,c,g,_){let v=f(`info-icon`),y=f(`el-option`),b=f(`el-select`);return d(),p(`div`,De,[r(`div`,Oe,[r(`h2`,ke,u(e.$t(`kling.name.mode`)),1),o(v,{content:e.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(d(),n(b,{key:e.revertKey,"model-value":e.value,class:`value`,placeholder:e.$t(`kling.placeholder.select`),clearable:!0,onChange:e.onChange},{default:m(()=>[(d(!0),p(h,null,l(e.options,e=>(d(),n(y,{key:e.value,label:e.label,value:e.value,disabled:e.disabled},{default:m(()=>[r(`span`,{class:t({"opt-disabled":e.disabled})},u(e.label),3),e.disabled&&e.disabledReason?(d(),p(`span`,Ae,u(e.disabledReason),1)):s(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var Me=F(Ee,[[`render`,je],[`__scopeId`,`data-v-9a8fa3c5`]]),Ne=[3,5,8,10,12,15],Pe=[5,10],Fe=c({name:`DurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:q},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return M.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?Ne:Pe},value(){return this.$store.state.kling?.config?.duration??5},selectValue(){let e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(5)?5:e[0]}},watch:{isV3Model(){this.allowedDurations.includes(this.value)||this.applyDuration(5)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(5)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=X(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await V.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=Z({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),I.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})}}}),Ie={class:`field`},Le={class:`control`},Re={class:`label`},ze={class:`title font-bold`};function Be(e,t,i,a,s,c){let g=f(`info-icon`),_=f(`el-option`),v=f(`el-select`);return d(),p(`div`,Ie,[r(`div`,Le,[r(`div`,Re,[r(`h2`,ze,u(e.$t(`kling.name.duration`)),1),o(g,{content:e.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(d(),n(v,{key:e.revertKey,"model-value":e.selectValue,class:`value`,placeholder:e.$t(`kling.placeholder.select`),onChange:e.onChange},{default:m(()=>[(d(!0),p(h,null,l(e.allowedDurations,e=>(d(),n(_,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var Ve=F(Fe,[[`render`,Be],[`__scopeId`,`data-v-5ae55e28`]]),He=c({name:`RatioSelector`,data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug(`set ratio`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||=`1:1`}}),Ue={class:`text-sm font-bold mb-2 block`},We={class:`items`},Ge=[`onClick`],Ke={class:`name`};function qe(e,n,a,o,s,c){return d(),p(`div`,null,[r(`span`,Ue,u(e.$t(`kling.name.ratio`)),1),r(`div`,We,[(d(!0),p(h,null,l(e.options,(n,a)=>(d(),p(`div`,{key:a,class:t({active:e.active===a,item:!0}),onClick:t=>e.value=n.value},[r(`div`,{class:t([`preview`,n.label])},[r(`div`,{class:`rect`,style:i({width:n.width+`px`,height:n.height+`px`})},null,4)],2),r(`p`,Ke,u(n.label),1)],10,Ge))),128))])])}var Je=F(He,[[`render`,qe],[`__scopeId`,`data-v-cdb14b2f`]]),Ye=c({name:`StartImage`,components:{ElUpload:C,ElButton:_,ElTooltip:w,InfoIcon:q,FontAwesomeIcon:G,ImagePreview:K},mixins:[N,B],emits:[`change`],data(){return{fileList:[],uploadUrl:W()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){I.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){I.error(this.$t(`kling.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Xe={class:`relative`},Ze={class:`flex justify-between`},Qe={class:`flex justify-start items-center`},$e={class:`text-sm font-bold`};function et(e,t,i,c,l,h){let g=f(`info-icon`),_=f(`image-preview`),v=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-tooltip`),x=f(`el-upload`);return d(),p(`div`,Xe,[r(`div`,Ze,[r(`div`,Qe,[r(`span`,$e,u(e.$t(`kling.name.startImage`)),1),o(g,{content:e.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.reachedLimit,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:t})=>[t.url&&t.percentage!==void 0?(d(),n(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):s(``,!0)]),default:m(()=>[o(b,{content:e.$t(`kling.message.uploadReferencesExceed`),disabled:!e.reachedLimit,placement:`top`},{default:m(()=>[r(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.reachedLimit},{default:m(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var tt=F(Ye,[[`render`,et],[`__scopeId`,`data-v-756dc269`]]),nt=c({name:`EndImage`,components:{ElUpload:C,ElButton:_,ElTooltip:w,ImagePreview:K,InfoIcon:q,FontAwesomeIcon:G},mixins:[N,B],data(){return{fileList:[],uploadUrl:W()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},klingConfig(){return this.$store.state?.kling?.config||{}},endImageSupported(){return Y(this.klingConfig.model,this.klingConfig.mode,this.klingConfig.duration).endImage},hasStartImage(){return!!this.klingConfig.start_image_url},uploadDisabled(){return this.reachedLimit||!this.endImageSupported||!this.hasStartImage},uploadTooltip(){return this.endImageSupported?this.hasStartImage?this.reachedLimit?this.$t(`kling.message.uploadReferencesExceed`):``:this.$t(`kling.message.endImageRequiresStart`):this.$t(`kling.message.endImageNotSupported`)},storeValue(){return this.klingConfig.end_image_url},value:{get(){return this.storeValue},set(){}}},watch:{storeValue(e){!e&&this.fileList.length>0&&(this.fileList=[])},hasStartImage(e){!e&&this.storeValue&&(this.fileList=[],this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:void 0}))}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onBeforeUpload(){return this.endImageSupported?this.hasStartImage?!0:(I.warning(this.$t(`kling.message.endImageRequiresStart`)),!1):(I.warning(this.$t(`kling.message.endImageNotSupported`)),!1)},onExceed(){I.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){I.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()}}}),rt={class:`relative`},it={class:`flex justify-between`},at={class:`flex justify-start items-center`},ot={class:`text-sm font-bold`};function st(e,t,i,c,l,h){let g=f(`info-icon`),_=f(`image-preview`),v=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-tooltip`),x=f(`el-upload`);return d(),p(`div`,rt,[r(`div`,it,[r(`div`,at,[r(`span`,ot,u(e.$t(`kling.name.endImage`)),1),o(g,{content:e.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),o(x,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:e.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"before-upload":e.onBeforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:t})=>[t.url&&t.percentage!==void 0?(d(),n(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.fileList.splice(e.fileList.indexOf(t),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):s(``,!0)]),default:m(()=>[o(b,{content:e.uploadTooltip,disabled:!e.uploadDisabled,placement:`top`},{default:m(()=>[r(`span`,null,[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:e.uploadDisabled},{default:m(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1},8,[`disabled`])])]),_:1},8,[`content`,`disabled`])]),_:1},8,[`file-list`,`disabled`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var ct=F(nt,[[`render`,st],[`__scopeId`,`data-v-c1b257e5`]]),lt=c({name:`CfgScaleSelector`,components:{ElSlider:ee,InfoIcon:q,ElInputNumber:A},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug(`set cfg_scale`,e),this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||=0}}),ut={class:`flex justify-between`},dt={class:`flex justify-start items-center`},ft={class:`text-sm font-bold`},pt={class:`flex justify-end items-center`},mt={class:`w-full`};function ht(e,t,n,i,a,s){let c=f(`info-icon`),l=f(`el-input-number`),m=f(`el-slider`);return d(),p(`div`,null,[r(`div`,ut,[r(`div`,dt,[r(`span`,ft,u(e.$t(`kling.name.cfgScale`)),1),o(c,{content:e.$t(`kling.description.cfgScale`)},null,8,[`content`])]),r(`div`,pt,[o(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,"controls-position":`right`},null,8,[`modelValue`])])]),r(`div`,mt,[o(m,{modelValue:e.value,"onUpdate:modelValue":t[1]||=t=>e.value=t,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var gt=F(lt,[[`render`,ht]]),_t=c({name:`GenerateAudioSelector`,components:{ElSwitch:j,InfoIcon:q},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},supported(){return!!(M.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})}}}),vt={class:`relative`},yt={class:`flex justify-between items-center`},bt={class:`flex justify-start items-center`},xt={class:`text-sm font-bold`};function St(e,t,n,i,a,s){let c=f(`info-icon`),l=f(`el-switch`);return d(),p(`div`,vt,[r(`div`,yt,[r(`div`,bt,[r(`span`,xt,u(e.$t(`kling.name.generateAudio`)),1),o(c,{content:e.tooltipContent},null,8,[`content`])]),o(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,disabled:!e.supported},null,8,[`modelValue`,`disabled`])])])}var Ct=F(_t,[[`render`,St]]),wt=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],Tt=c({name:`CameraControlSelector`,components:{ElSelect:y,ElOption:b,ElSlider:ee,ElInputNumber:A,InfoIcon:q},data(){return{configKeys:wt}},computed:{typeOptions(){return[{value:``,label:this.$t(`kling.name.cameraTypeNone`)},{value:`simple`,label:this.$t(`kling.name.cameraTypeSimple`)},{value:`down_back`,label:this.$t(`kling.name.cameraTypeDownBack`)},{value:`forward_up`,label:this.$t(`kling.name.cameraTypeForwardUp`)},{value:`left_turn_forward`,label:this.$t(`kling.name.cameraTypeLeftTurnForward`)},{value:`right_turn_forward`,label:this.$t(`kling.name.cameraTypeRightTurnForward`)}]},selectedMode(){return this.$store.state.kling?.config?.mode||``},selectedModel(){return this.$store.state.kling?.config?.model||``},selectedDuration(){return this.$store.state.kling?.config?.duration},motionControlSupported(){return Y(this.selectedModel,this.selectedMode,this.selectedDuration).motionControl},hasStartImage(){return!!this.$store.state.kling?.config?.start_image_url},disabled(){return!this.motionControlSupported||this.hasStartImage},tooltipContent(){return this.motionControlSupported?this.hasStartImage?this.$t(`kling.description.cameraControlDisabledImage2Video`):this.$t(`kling.description.cameraControl`):this.$t(`kling.description.cameraControlNotSupported`)},selectedType(){return this.$store.state.kling?.config?.camera_control?.type},selectedTypeRaw:{get(){return this.selectedType??``},set(e){let t=this.$store.state.kling?.config||{};if(!e){let e={...t};delete e.camera_control,this.$store.commit(`kling/setConfig`,e);return}let n=e;this.$store.commit(`kling/setConfig`,{...t,camera_control:{type:n,config:n===`simple`?t.camera_control?.config||{}:void 0}})}},configValues(){return this.$store.state.kling?.config?.camera_control?.config||{}}},watch:{disabled(e){e&&this.selectedType!==void 0&&(this.selectedTypeRaw=``)}},methods:{writeConfig(e,t){let n=this.$store.state.kling?.config||{},r=n.camera_control||{type:`simple`},i={...r.config||{}};t==null?delete i[e]:i[e]=t,this.$store.commit(`kling/setConfig`,{...n,camera_control:{...r,type:`simple`,config:i}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),Et={class:`field`},Dt={class:`header`},Ot={class:`text-sm font-bold`},kt={key:0,class:`config-grid`},At={class:`cfg-row-head`},jt={class:`cfg-name`};function Mt(e,t,i,a,c,g){let _=f(`info-icon`),v=f(`el-option`),y=f(`el-select`),b=f(`el-input-number`),x=f(`el-slider`);return d(),p(`div`,Et,[r(`div`,Dt,[r(`span`,Ot,u(e.$t(`kling.name.cameraControl`)),1),o(_,{content:e.tooltipContent},null,8,[`content`])]),o(y,{modelValue:e.selectedTypeRaw,"onUpdate:modelValue":t[0]||=t=>e.selectedTypeRaw=t,class:`value`,placeholder:e.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:e.disabled},{default:m(()=>[(d(!0),p(h,null,l(e.typeOptions,e=>(d(),n(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),e.selectedType===`simple`&&!e.disabled?(d(),p(`div`,kt,[(d(!0),p(h,null,l(e.configKeys,t=>(d(),p(`div`,{key:t,class:`cfg-row`},[r(`div`,At,[r(`span`,jt,u(e.$t(`kling.name.cc_${t}`)),1),o(b,{modelValue:e.configValues[t],"onUpdate:modelValue":n=>e.configValues[t]=n,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:n=>e.onNumberChange(t,n)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),o(x,{"model-value":e.configValues[t]??0,min:-1,max:1,step:.1,onInput:n=>e.onSliderChange(t,n)},null,8,[`model-value`,`onInput`])]))),128))])):s(``,!0)])}var Nt=F(Tt,[[`render`,Mt],[`__scopeId`,`data-v-cd896060`]]),Pt=[{groupKey:`cameraMovements`,chipKeys:[`rotateAround`,`stationary`,`handheld`,`zoomOut`,`zoomIn`,`follow`,`panRight`,`tiltUp`,`tiltDown`,`orbit`]},{groupKey:`cameraSpeed`,chipKeys:[`speedSlow`,`speedMedium`,`speedFast`]},{groupKey:`shotType`,chipKeys:[`shotClose`,`shotMedium`,`shotLong`,`shotLowAngle`,`shotHighAngle`,`shotShallowDof`,`shotFront`,`shotProfile`,`shotCloseUp`,`shotDrone`]},{groupKey:`light`,chipKeys:[`lightSunlight`,`lightSoft`,`lightNeon`,`lightWarm`,`lightNature`,`lightCandle`,`lightCityNight`]},{groupKey:`frame`,chipKeys:[`frameRichDetails`,`frameSimpleBg`]},{groupKey:`atmosphere`,chipKeys:[`atmosphereMysterious`,`atmospherePeaceful`,`atmosphereHeartwarming`,`atmosphereVivid`,`atmosphereColorful`]}],Q=`, `;function Ft(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${Q}${t}`:t}function $(e,t){if(!e||!t)return e||``;let n=[`${t}${Q}`,`${Q}${t}`,t],r=e;for(let e of n)if(r.includes(e)){r=r.replace(e,``);break}return r.replace(/(?:,\s*)+$/,``).replace(/^(?:,\s*)+/,``)}var It=c({name:`InspirationPills`,components:{FontAwesomeIcon:G},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return Pt.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selected(){let e=this.prompt;if(!e)return[];let t=[];for(let n of this.allChipTexts){let r=e.indexOf(n);r!==-1&&t.push({text:n,idx:r})}return t.sort((e,t)=>e.idx-t.idx).map(e=>e.text)}},methods:{onRemove(e){let t=$(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),Lt={key:0,class:`pills`,role:`list`},Rt={class:`pill-text`},zt=[`aria-label`,`onClick`];function Bt(e,t,n,i,a,c){let m=f(`font-awesome-icon`);return e.selected.length>0?(d(),p(`div`,Lt,[(d(!0),p(h,null,l(e.selected,t=>(d(),p(`div`,{key:t,class:`pill`,role:`listitem`},[r(`span`,Rt,u(t),1),r(`button`,{type:`button`,class:`pill-remove`,"aria-label":e.$t(`kling.inspiration.removeChip`),onClick:g(n=>e.onRemove(t),[`stop`])},[o(m,{icon:`fa-solid fa-xmark`})],8,zt)]))),128))])):s(``,!0)}var Vt=c({name:`PromptInput`,components:{ElButton:_,FontAwesomeIcon:G,PromptTextarea:ue,InspirationPills:F(It,[[`render`,Bt],[`__scopeId`,`data-v-5fc4fa65`]])},emits:[`open-inspiration`],computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ht(e,t,r,i,s,c){let l=f(`font-awesome-icon`),p=f(`el-button`),h=f(`inspiration-pills`),g=f(`prompt-textarea`);return d(),n(g,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`kling.name.prompt`),info:e.$t(`kling.description.prompt`),placeholder:e.$t(`kling.placeholder.prompt`)},{actions:m(()=>[o(p,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:m(()=>[o(l,{icon:`fa-regular fa-lightbulb`,class:`mr-1`}),a(` `+u(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:m(()=>[o(h)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var Ut=F(Vt,[[`render`,Ht],[`__scopeId`,`data-v-c01fc1a6`]]),Wt=c({name:`NegativePromptInput`,components:{ElInput:z,InfoIcon:q},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||=``}}),Gt={class:`field`},Kt={class:`box`},qt={class:`title font-bold`};function Jt(e,t,n,i,a,s){let c=f(`info-icon`),l=f(`el-input`);return d(),p(`div`,Gt,[r(`div`,Kt,[r(`h2`,qt,u(e.$t(`kling.name.negativePrompt`)),1),o(c,{content:e.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),o(l,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var Yt=F(Wt,[[`render`,Jt],[`__scopeId`,`data-v-de98cf01`]]),Xt=c({name:`InspirationDrawer`,components:{ElDrawer:k,ElButton:_,FontAwesomeIcon:G},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:Pt,Close:v}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit(`update:modelValue`,e)}},drawerSize(){return window.innerWidth<768?`100%`:`380px`},prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return this.groups.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selectedCount(){return this.allChipTexts.filter(e=>this.isSelected(e)).length}},methods:{chipText(e){return this.$t(`kling.inspiration.chip.${e}`)},isSelected(e){return e?this.prompt.includes(e):!1},setPrompt(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:e})},onToggle(e){e&&(this.isSelected(e)?this.setPrompt($(this.prompt,e)):this.setPrompt(Ft(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=$(e,t);this.setPrompt(e)}}}),Zt={class:`drawer-content`},Qt={class:`drawer-header`},$t={class:`title-row`},en={class:`title`},tn={class:`hint`},nn={key:0,class:`selected-bar`},rn={class:`selected-text`},an={class:`groups`},on={class:`group-title`},sn={class:`chip-grid`},cn=[`onClick`];function ln(e,i,c,g,_,v){let y=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-drawer`);return d(),n(x,{modelValue:e.visible,"onUpdate:modelValue":i[1]||=t=>e.visible=t,direction:`rtl`,"with-header":!1,size:e.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:m(()=>[r(`div`,Zt,[r(`div`,Qt,[r(`div`,$t,[o(y,{icon:`fa-regular fa-lightbulb`,class:`mr-2`}),r(`span`,en,u(e.$t(`kling.inspiration.title`)),1)]),o(b,{text:``,icon:e.Close,class:`close-btn`,onClick:i[0]||=t=>e.visible=!1},null,8,[`icon`])]),r(`div`,tn,u(e.$t(`kling.inspiration.hint`)),1),e.selectedCount>0?(d(),p(`div`,nn,[r(`span`,rn,u(e.$t(`kling.inspiration.selectedSummary`,{count:e.selectedCount})),1),o(b,{text:``,size:`small`,class:`clear-btn`,onClick:e.onClearSelected},{default:m(()=>[a(u(e.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):s(``,!0),r(`div`,an,[(d(!0),p(h,null,l(e.groups,n=>(d(),p(`div`,{key:n.groupKey,class:`group`},[r(`div`,on,u(e.$t(`kling.inspiration.group.${n.groupKey}`)),1),r(`div`,sn,[(d(!0),p(h,null,l(n.chipKeys,n=>(d(),p(`button`,{key:n,type:`button`,class:t({chip:!0,active:e.isSelected(e.chipText(n))}),onClick:t=>e.onToggle(e.chipText(n))},u(e.chipText(n)),11,cn))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var un=F(Xt,[[`render`,ln],[`__scopeId`,`data-v-7d457a69`]]),dn={"kling-v3":`v3`,"kling-v3-omni":`v3-Omni`,"kling-v2-6":`v2.6`,"kling-v2-5-turbo":`v2.5-Turbo`,"kling-v2-1-master":`v2.1-Master`,"kling-v2-master":`v2-Master`,"kling-v1-6":`v1.6`,"kling-v1":`v1`,"kling-video-o1":`Video-o1`},fn={std:`720p`,pro:`1080p`,"4k":`4K`},pn=c({name:`SummaryChip`,components:{FontAwesomeIcon:G},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return dn[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return fn[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),mn={class:`summary-chip`},hn=[`title`],gn=[`title`],_n=[`title`],vn=[`title`],yn=[`title`];function bn(e,t,n,i,a,c){let l=f(`font-awesome-icon`);return d(),p(`div`,mn,[r(`span`,{class:`part`,title:e.$t(`kling.name.model`)},u(e.modelLabel),9,hn),t[0]||=r(`span`,{class:`dot`},`·`,-1),r(`span`,{class:`part`,title:e.$t(`kling.name.duration`)},u(e.durationLabel),9,gn),t[1]||=r(`span`,{class:`dot`},`·`,-1),r(`span`,{class:`part`,title:e.$t(`kling.name.ratio`)},u(e.aspectRatio||`16:9`),9,_n),t[2]||=r(`span`,{class:`dot`},`·`,-1),r(`span`,{class:`part`,title:e.$t(`kling.name.mode`)},u(e.modeLabel),9,vn),e.generateAudio?(d(),p(`span`,{key:0,class:`audio`,title:e.$t(`kling.name.generateAudio`)},[o(l,{icon:`fa-solid fa-headphones`})],8,yn)):s(``,!0)])}var xn=c({name:`ConfigPanel`,components:{ElButton:_,Consumption:J,FontAwesomeIcon:G,PromptInput:Ut,NegativePromptInput:Yt,ModelSelector:Te,ModeSelector:Me,DurationSelector:Ve,RatioSelector:Je,StartImage:tt,CfgScaleSelector:gt,GenerateAudioSelector:Ct,CameraControlSelector:Nt,InspirationDrawer:un,SummaryChip:F(pn,[[`render`,bn],[`__scopeId`,`data-v-418a6733`]]),EndImage:ct},emits:[`generate`],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return L(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Sn={class:`flex flex-col h-full`},Cn={class:`flex-1 overflow-y-auto p-5`},wn={class:`flex flex-col items-center justify-center px-5 pb-5`};function Tn(e,t,i,s,c,l){let h=f(`prompt-input`),g=f(`model-selector`),_=f(`ratio-selector`),v=f(`start-image`),y=f(`end-image`),b=f(`duration-selector`),x=f(`mode-selector`),S=f(`generate-audio-selector`),C=f(`camera-control-selector`),w=f(`cfg-scale-selector`),T=f(`negative-prompt-input`),E=f(`summary-chip`),D=f(`consumption`),O=f(`font-awesome-icon`),k=f(`el-button`),A=f(`inspiration-drawer`);return d(),p(`div`,Sn,[r(`div`,Cn,[o(h,{class:`mb-4`,onOpenInspiration:t[0]||=t=>e.inspirationOpen=!0}),o(g,{class:`mb-4`}),o(_,{class:`mb-4`}),o(v,{class:`mb-2`}),o(y,{class:`mb-2`}),o(b,{class:`mb-4`}),o(x,{class:`mb-4`}),o(S,{class:`mb-4`}),o(C,{class:`mb-4`}),o(w,{class:`mb-4`}),o(T,{class:`mb-4`})]),r(`div`,wn,[o(E),o(D,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),e.config?.video_url!==void 0||e.config?.custom?(d(),n(k,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:m(()=>[o(O,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`kling.button.extend`)),1)]),_:1},8,[`onClick`])):(d(),n(k,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:m(()=>[o(O,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`kling.button.generate`)),1)]),_:1},8,[`onClick`]))]),o(A,{modelValue:e.inspirationOpen,"onUpdate:modelValue":t[1]||=t=>e.inspirationOpen=t},null,8,[`modelValue`])])}var En=F(xn,[[`render`,Tn]]),Dn=c({name:`MotionImage`,components:{ElUpload:C,ElButton:_,InfoIcon:q,FontAwesomeIcon:G,ImagePreview:K},mixins:[N,B],data(){return{fileList:[],uploadUrl:W()+`/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(){I.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){I.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()}}}),On={class:`relative`},kn={class:`flex justify-between`},An={class:`flex justify-start items-center`},jn={class:`text-sm font-bold`};function Mn(e,t,i,c,l,h){let g=f(`info-icon`),_=f(`image-preview`),v=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-upload`);return d(),p(`div`,On,[r(`div`,kn,[r(`div`,An,[r(`span`,jn,u(e.$t(`kling.name.motionImage`)),1),o(g,{content:e.$t(`kling.description.motionImage`)},null,8,[`content`])])]),o(b,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:e.uploadUrl,"list-type":`picture`,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:t})=>[t.url&&t.percentage!==void 0?(d(),n(_,{key:0,url:t.url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`])):s(``,!0)]),default:m(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:m(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Nn=F(Dn,[[`render`,Mn],[`__scopeId`,`data-v-e52eaf2f`]]),Pn=c({name:`MotionVideo`,components:{ElUpload:C,ElButton:_,InfoIcon:q,FilePreview:oe,FontAwesomeIcon:G},mixins:[B],data(){return{fileList:[],uploadUrl:W()+`/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(){I.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){I.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:(I.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(I.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()}}}),Fn={class:`relative`},In={class:`flex justify-between`},Ln={class:`flex justify-start items-center`},Rn={class:`text-sm font-bold`};function zn(e,t,i,c,l,h){let g=f(`info-icon`),_=f(`file-preview`),v=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-upload`);return d(),p(`div`,Fn,[r(`div`,In,[r(`div`,Ln,[r(`span`,Rn,u(e.$t(`kling.name.motionVideo`)),1),o(g,{content:e.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),o(b,{"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:t})=>[t.percentage===void 0?s(``,!0):(d(),n(_,{key:0,url:t.url||t.response?.file_url,name:t.name,percentage:t.percentage,onRemove:n=>e.onRemove(t)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:m(()=>[o(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:m(()=>[o(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),a(` `+u(e.$t(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Bn=F(Pn,[[`render`,zn],[`__scopeId`,`data-v-7019a8d2`]]),Vn=c({name:`MotionPromptInput`,components:{ElInput:z,InfoIcon:q},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),Hn={class:`field`},Un={class:`box`},Wn={class:`title font-bold`};function Gn(e,t,n,i,a,s){let c=f(`info-icon`),l=f(`el-input`);return d(),p(`div`,Hn,[r(`div`,Un,[r(`h2`,Wn,u(e.$t(`kling.name.motionPrompt`)),1),o(c,{content:e.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),o(l,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,rows:3,type:`textarea`,class:`prompt`,placeholder:e.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Kn=F(Vn,[[`render`,Gn],[`__scopeId`,`data-v-ca9fdbe5`]]),qn=`video`,Jn=c({name:`CharacterOrientationSelector`,components:{ElRadioGroup:O,ElRadioButton:D,InfoIcon:q},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||qn},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,character_orientation:e})}}},mounted(){this.$store.state.kling?.motionConfig?.character_orientation||(this.value=qn)}}),Yn={class:`field`},Xn={class:`header`},Zn={class:`text-sm font-bold`};function Qn(e,t,n,i,s,c){let l=f(`info-icon`),h=f(`el-radio-button`),g=f(`el-radio-group`);return d(),p(`div`,Yn,[r(`div`,Xn,[r(`span`,Zn,u(e.$t(`kling.name.characterOrientation`)),1),o(l,{content:e.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),o(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,size:`small`,class:`value`},{default:m(()=>[o(h,{label:`image`},{default:m(()=>[a(u(e.$t(`kling.name.orientationImage`)),1)]),_:1}),o(h,{label:`video`},{default:m(()=>[a(u(e.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var $n=F(Jn,[[`render`,Qn],[`__scopeId`,`data-v-7a91195b`]]),er=`std`,tr=c({name:`MotionModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:q},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||er},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=er)}}),nr={class:`field`},rr={class:`header`},ir={class:`title font-bold`};function ar(e,t,i,a,s,c){let g=f(`info-icon`),_=f(`el-option`),v=f(`el-select`);return d(),p(`div`,nr,[r(`div`,rr,[r(`h2`,ir,u(e.$t(`kling.name.mode`)),1),o(g,{content:e.$t(`kling.description.motionMode`)},null,8,[`content`])]),o(v,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`kling.placeholder.select`)},{default:m(()=>[(d(!0),p(h,null,l(e.options,e=>(d(),n(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var or=F(tr,[[`render`,ar],[`__scopeId`,`data-v-1295688c`]]),sr=c({name:`KeepOriginalSoundSelector`,components:{ElSwitch:j,InfoIcon:q},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`})}}}}),cr={class:`relative`},lr={class:`flex justify-between items-center`},ur={class:`flex justify-start items-center`},dr={class:`text-sm font-bold`};function fr(e,t,n,i,a,s){let c=f(`info-icon`),l=f(`el-switch`);return d(),p(`div`,cr,[r(`div`,lr,[r(`div`,ur,[r(`span`,dr,u(e.$t(`kling.name.keepOriginalSound`)),1),o(c,{content:e.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),o(l,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t},null,8,[`modelValue`])])])}var pr=c({name:`MotionPanel`,components:{ElButton:_,FontAwesomeIcon:G,Consumption:J,MotionImage:Nn,MotionVideo:Bn,MotionPromptInput:Kn,CharacterOrientationSelector:$n,MotionModeSelector:or,KeepOriginalSoundSelector:F(sr,[[`render`,fr]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return L(this.motionConfig,this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){let e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit(`generate`)}}}),mr={class:`flex flex-col h-full`},hr={class:`flex-1 overflow-y-auto p-5`},gr={class:`flex flex-col items-center justify-center px-5 pb-5`};function _r(e,t,n,i,s,c){let l=f(`motion-image`),h=f(`motion-video`),g=f(`motion-prompt-input`),_=f(`character-orientation-selector`),v=f(`motion-mode-selector`),y=f(`keep-original-sound-selector`),b=f(`consumption`),x=f(`font-awesome-icon`),S=f(`el-button`);return d(),p(`div`,mr,[r(`div`,hr,[o(l,{class:`mb-3`}),o(h,{class:`mb-3`}),o(g,{class:`mb-4`}),o(_,{class:`mb-4`}),o(v,{class:`mb-4`}),o(y,{class:`mb-4`})]),r(`div`,gr,[o(b,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),o(S,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canGenerate,onClick:e.onGenerate},{default:m(()=>[o(x,{icon:`fa-solid fa-magic`,class:`mr-2`}),a(` `+u(e.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var vr=F(pr,[[`render`,_r]]),yr=c({name:`KlingTabSwitcher`,components:{ElTabs:x,ElTabPane:S,ElTag:re},props:{modelValue:{type:String,default:`videos`}},emits:[`update:modelValue`],computed:{tabs(){return[{value:`videos`,label:this.$t(`kling.tab.videoGeneration`)},{value:`motion`,label:this.$t(`kling.tab.motionControl`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),br=[`title`],xr={class:`text`};function Sr(e,t,i,o,c,g){let _=f(`el-tag`),v=f(`el-tab-pane`),y=f(`el-tabs`);return d(),n(y,{"model-value":e.modelValue,class:`kling-tabs`,stretch:``,"onUpdate:modelValue":e.onUpdate},{default:m(()=>[(d(!0),p(h,null,l(e.tabs,e=>(d(),n(v,{key:e.value,name:e.value,disabled:e.disabled},{label:m(()=>[r(`span`,{class:`tab-label`,title:e.disabled?e.disabledReason:void 0},[r(`span`,xr,u(e.label),1),e.badge?(d(),n(_,{key:0,size:`small`,type:`warning`,class:`badge`},{default:m(()=>[a(u(e.badge),1)]),_:2},1024)):s(``,!0)],8,br)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Cr=F(yr,[[`render`,Sr],[`__scopeId`,`data-v-bf00c27e`]]),wr=c({name:`TaskPreview`,components:{ElImage:T,CopyToClipboard:ae,FontAwesomeIcon:G,ElAlert:E,VideoPlayer:pe,ElTooltip:w,ElButton:_,ImagePreview:K,ApiCodeButton:fe},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},referenceImages(){let e=[],t=this.modelValue?.request?.start_image_url,n=this.modelValue?.request?.end_image_url;return t&&e.push({url:t,name:`start-image`}),n&&e.push({url:n,name:`end-image`}),e}},methods:{onDownload(e,t){e.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Tr={class:`preview`},Er={class:`left`},Dr={class:`main`},Or={class:`bot`},kr={class:`datetime`},Ar={class:`info`},jr={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Mr={key:1,class:`prompt mt-2`},Nr={key:0},Pr={key:1},Fr={key:0,class:t({content:!0,failed:!0})},Ir={key:0,class:`mb-4`},Lr={key:1,class:t({operations:!0,"mt-2":!0})},Rr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},zr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Br={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Vr={key:1,class:t({content:!0})},Hr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ur={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Wr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Gr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Kr={key:2,class:t({content:!0})},qr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Jr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Yr(e,t,i,c,g,_){let v=f(`el-image`),y=f(`image-preview`),b=f(`video-player`),x=f(`el-button`),S=f(`el-tooltip`),C=f(`api-code-button`),w=f(`font-awesome-icon`),T=f(`copy-to-clipboard`),E=f(`el-alert`);return d(),p(`div`,Tr,[r(`div`,Er,[o(v,{src:`https://cdn.acedata.cloud/qpbbbb.jpg`,class:`avatar`})]),r(`div`,Dr,[r(`div`,Or,[a(u(e.$t(`kling.name.klingBot`))+` `,1),r(`span`,kr,u(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),r(`div`,Ar,[e.referenceImages.length>0?(d(),p(`div`,jr,[(d(!0),p(h,null,l(e.referenceImages,(e,t)=>(d(),n(y,{key:t,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128))])):s(``,!0),e.modelValue?.request?.prompt?(d(),p(`p`,Mr,[a(u(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?s(``,!0):(d(),p(`span`,Nr,` - (`+u(e.$t(`kling.status.pending`))+`) `,1)),e.modelValue?.response?.state===`submitted`||e.modelValue?.response?.state===`processing`||e.modelValue?.response?.state===`pending`||e.modelValue?.response?.state===`completed`?(d(),p(`span`,Pr,` - (`+u(e.$t(`kling.status.processing`))+`) `,1)):s(``,!0)])):s(``,!0)]),e.modelValue?.response?.success===!0?(d(),p(`div`,Fr,[e.modelValue?.response.video_url?(d(),p(`div`,Ir,[o(b,{src:e.modelValue?.response.video_url},null,8,[`src`])])):s(``,!0),e.modelValue?.response.success?(d(),p(`div`,Lr,[o(S,{class:`box-item`,effect:`dark`,content:e.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:m(()=>[e.modelValue?.response.video_url?(d(),n(x,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:t[0]||=t=>e.onDownload(t,e.modelValue?.response.video_url)},{default:m(()=>[a(u(e.$t(`kling.button.download`)),1)]),_:1})):s(``,!0)]),_:1},8,[`content`]),o(C,{path:`/kling/videos`,body:e.modelValue?.request},null,8,[`body`])])):s(``,!0),o(E,{closable:!1,class:`mt-2 success`},{default:m(()=>[r(`p`,Rr,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.model`))+`: `+u(e.modelValue?.request?.model),1)]),r(`p`,zr,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(T,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(d(),p(`p`,Br,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):s(``,!0)]),_:1})])):s(``,!0),e.modelValue?.response?.success===!1?(d(),p(`div`,Vr,[o(E,{closable:!1,class:`failure`},{template:m(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.failure`)),1)]),default:m(()=>[r(`p`,Hr,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(T,{content:e.modelValue?.id},null,8,[`content`])]),r(`p`,Ur,[o(w,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.failureReason`))+`: `+u(e.modelValue?.response?.error?.message)+` `,1),o(T,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(d(),p(`p`,Wr,[o(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.elapsed`))+`: `+u(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):s(``,!0),e.modelValue?.response?.trace_id?(d(),p(`p`,Gr,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(T,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):s(``,!0)]),_:1})])):s(``,!0),e.modelValue?.response?.success===void 0?(d(),p(`div`,Kr,[o(E,{closable:!1,class:`info`},{template:m(()=>[o(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.failure`)),1)]),default:m(()=>[r(`p`,qr,[o(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.taskId`))+`: `+u(e.modelValue?.id)+` `,1),o(T,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.response?.trace_id?(d(),p(`p`,Jr,[o(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),a(` `+u(e.$t(`kling.name.traceId`))+`: `+u(e.modelValue?.response?.trace_id)+` `,1),o(T,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])):s(``,!0)]),_:1})])):s(``,!0)])])}var Xr=c({name:`RecentPanel`,components:{TaskPreview:F(wr,[[`render`,Yr],[`__scopeId`,`data-v-422e2570`]]),NoTasks:de,BotPlaceholder:se,ScrollList:ce},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?.()}}}),Zr={key:0},Qr={key:2,class:`w-full h-full flex items-center justify-center`};function $r(e,t,r,i,a,c){let u=f(`bot-placeholder`),g=f(`task-preview`),_=f(`scroll-list`),v=f(`no-tasks`);return d(),p(h,null,[e.tasks?.items===void 0?(d(),p(`div`,Zr,[o(u)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(d(),n(_,{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:m(()=>[(d(!0),p(h,null,l(e.tasks?.items,e=>(d(),n(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):s(``,!0),e.tasks?.items?.length===0?(d(),p(`div`,Qr,[o(v)])):s(``,!0)],64)}var ei=F(Xr,[[`render`,$r]]),ti=te(`kling`),ni=c({name:`KlingIndex`,components:{ConfigPanel:En,MotionPanel:vr,TabSwitcher:Cr,Layout:ye,RecentPanel:ei},mixins:[ie],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===U.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===U.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},taskType(){return this.$store.state.kling.taskType||`videos`},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await le({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(!P(this.uploadTracker,e=>this.$t(e),e=>I.warning(e)))return;let{camera_control:e,...t}=this.config||{},n={...t,callback_url:ti};if(!n.video_id&&!t.video_url&&!n.start_image_url&&n.end_image_url){I.warning(this.$t(`kling.message.endImageRequiresStart`));return}n.action||(n.video_id||t.video_url?n.action=`extend`:n.start_image_url?n.action=`image2video`:n.action=`text2video`),n.action===`text2video`&&n.end_image_url&&delete n.end_image_url,e?.type&&(n.camera_control={type:e.type,...e.type===`simple`&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,e])=>e!=null))}:{}});let r=this.credential?.token;if(!r){console.error(`no token specified`);return}I.info(this.$t(`kling.message.startingTask`)),R(`kling`,H.generate(n,{token:r})).then(()=>{I.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?I.error(this.$t(`kling.message.usedUp`)):I.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(!P(this.uploadTracker,e=>this.$t(e),e=>I.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){I.warning(this.$t(`kling.message.motionMissingInputs`));return}let t={image_url:e.image_url,video_url:e.video_url,character_orientation:e.character_orientation||`video`,mode:e.mode||`std`,keep_original_sound:e.keep_original_sound??`yes`,...e.prompt?{prompt:e.prompt}:{},callback_url:ti},n=this.credential?.token;if(!n){console.error(`no token specified`);return}I.info(this.$t(`kling.message.startingTask`)),R(`kling`,H.motion(t,{token:n})).then(()=>{I.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?I.error(this.$t(`kling.message.usedUp`)):I.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),ri={class:`flex flex-col h-full`},ii={class:`flex-1 min-h-0`};function ai(e,t,i,a,c,l){let u=f(`tab-switcher`),p=f(`config-panel`),h=f(`motion-panel`),g=f(`recent-panel`),_=f(`layout`);return d(),n(_,null,{config:m(()=>[r(`div`,ri,[o(u,{"model-value":e.taskType,"onUpdate:modelValue":e.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),r(`div`,ii,[e.taskType===`videos`?(d(),n(p,{key:0,onGenerate:e.onGenerate},null,8,[`onGenerate`])):e.taskType===`motion`?(d(),n(h,{key:1,onGenerate:e.onGenerateMotion},null,8,[`onGenerate`])):s(``,!0)])])]),result:m(()=>[o(g,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var oi=F(ni,[[`render`,ai]]);export{oi as default};
|