import{r as e}from"./rolldown-runtime-DCMCV6zW.js";import{F as t,x as n}from"./vendor-primevue-DxVRNMbC.js";import{A as r,D as i,F as a,I as o,It as s,O as c,R as l,Rt as u,Vt as d,_t as f,at as p,et as m,gt as h,j as g,k as _,l as v,xt as y}from"./vendor-vue-core-X6q-rGJs.js";import{t as b}from"./types-DW97iHDr.js";import{n as x}from"./vendor-i18n-B5g6Drzm.js";import{t as S}from"./telemetry-KciZP3tz.js";import{t as C}from"./Button-C7dWyQyS.js";import{B as w,Vt as T,W as E,hr as D,i as O,o as k}from"./dialogService-Cqui0UMO.js";import{t as A}from"./_plugin-vue_export-helper-fSAtQzP-.js";import{t as j}from"./graphHasMissingNodes-DBqICxdS.js";var M=[`aria-label`],N=1,P=A(l({__name:`BatchCountEdit`,setup(e){let{batchCount:n}=v(T()),r=O(),a=i(()=>r.get(`Comfy.QueueButton.BatchCountLimit`)),handleClick=e=>{let t;if(e){let e=n.value-1;t=Math.min(e*2,a.value)}else{let e=n.value+1;t=Math.floor(e/2)}n.value=t};return(e,r)=>{let i=p(`tooltip`);return f((m(),g(`div`,{class:`batch-count`,"aria-label":e.$t(`menu.batchCount`)},[o(s(t),{modelValue:s(n),"onUpdate:modelValue":r[0]||=e=>y(n)?n.value=e:null,class:`w-14`,min:N,max:a.value,fluid:``,"show-buttons":``,pt:{incrementButton:{class:`w-6`,onmousedown:()=>{handleClick(!0)}},decrementButton:{class:`w-6`,onmousedown:()=>{handleClick(!1)}}}},null,8,[`modelValue`,`max`,`pt`])],8,M)),[[i,{value:e.$t(`menu.batchCount`),showDelay:600},void 0,{bottom:!0}]])}}}),[[`__scopeId`,`data-v-19217ad4`]]),F={class:`queue-button-group flex`},I=A(l({__name:`ComfyQueueButton`,setup(e){let t=E(),{mode:l,batchCount:y}=v(T()),O=w(),A=i(()=>j(k.rootGraph,O.nodeDefsByName)),{t:M}=x(),N=i(()=>{let e={disabled:{key:`disabled`,label:M(`menu.run`),tooltip:M(`menu.disabledTooltip`),command:()=>{l.value=`disabled`}},change:{key:`change`,label:`${M(`menu.run`)} (${M(`menu.onChange`)})`,tooltip:M(`menu.onChangeTooltip`),command:()=>{S()?.trackUiButtonClicked({button_id:`queue_mode_option_run_on_change_selected`}),l.value=`change`}}};return b||(e.instant={key:`instant`,label:`${M(`menu.run`)} (${M(`menu.instant`)})`,tooltip:M(`menu.instantTooltip`),command:()=>{S()?.trackUiButtonClicked({button_id:`queue_mode_option_run_instant_selected`}),l.value=`instant`}}),e}),I=i(()=>N.value[l.value]||N.value.disabled),L=i(()=>Object.values(N.value)),R=i(()=>A.value?`icon-[lucide--triangle-alert]`:t.shiftDown?`icon-[lucide--list-start]`:l.value===`disabled`?`icon-[lucide--play]`:l.value===`instant`?`icon-[lucide--fast-forward]`:l.value===`change`?`icon-[lucide--step-forward]`:`icon-[lucide--play]`),z=i(()=>A.value?M(`menu.runWorkflowDisabled`):t.shiftDown?M(`menu.runWorkflowFront`):M(`menu.runWorkflow`)),B=D(),queuePrompt=async e=>{let t=`shiftKey`in e&&e.shiftKey?`Comfy.QueuePromptFront`:`Comfy.QueuePrompt`;y.value>1&&S()?.trackUiButtonClicked({button_id:`queue_run_multiple_batches_submitted`}),await B.execute(t,{metadata:{subscribe_to_run:!1,trigger_source:`button`}})};return(e,t)=>{let i=p(`tooltip`);return m(),g(`div`,F,[f((m(),_(s(n),{class:`comfyui-queue-button`,label:String(I.value?.label??``),severity:`primary`,size:`small`,model:L.value,"data-testid":`queue-button`,onClick:queuePrompt},{icon:h(()=>[c(`i`,{class:u(R.value)},null,2)]),item:h(({item:e})=>[f((m(),_(C,{variant:e.key===s(l)?`primary`:`secondary`,size:`sm`,class:`w-full justify-start`},{default:h(()=>[e.icon?(m(),g(`i`,{key:0,class:u(e.icon)},null,2)):r(``,!0),a(` `+d(String(e.label??``)),1)]),_:2},1032,[`variant`])),[[i,{value:e.tooltip,showDelay:600}]])]),_:1},8,[`label`,`model`])),[[i,{value:z.value,showDelay:600},void 0,{bottom:!0}]]),o(P)])}}}),[[`__scopeId`,`data-v-214102f7`]]);export{I as t};
//# sourceMappingURL=ComfyQueueButton-CJRzkjTx.js.map