(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,419874,e=>{"use strict";var t=e.i(162115),a=e.i(869931),s=e.i(666023),r=e.i(26012),n=e.i(893936),i=e.i(942347);e.i(816688);var l=e.i(675066),o=e.i(189299),d=e.i(654313),u=e.i(543870),c=e.i(242860),p=e.i(744704),m=e.i(432961),h=e.i(449980),f=e.i(379415),g=e.i(543753),b=e.i(137667),x=e.i(459760),y=e.i(447301),C=e.i(141696),v=e.i(935139);e.i(237855);var w=e.i(297162),k=e.i(481162),j=e.i(955371);let L=(0,i.memo)(e=>{let{data:a,content:s,currentTab:r}=e;return(0,t.jsxs)(t.Fragment,{children:["RESULT"===r&&(0,t.jsxs)("div",{className:"space-y-3 p-4",children:[a?.resultText&&(0,t.jsx)(f.Markdown,{content:a?.resultText||""}),!!a?.files?.length&&(0,t.jsx)("div",{className:"flex flex-col gap-2",children:a?.files.map(e=>(0,t.jsxs)("div",{className:"system-xs-regular flex flex-col gap-1",children:[(0,t.jsx)("div",{className:"py-1 text-text-tertiary ",children:e.varName}),(0,t.jsx)(w.FileList,{files:e.list,showDeleteAction:!1,showDownloadAction:!0,canPreview:!0})]},e.varName))})]}),"DETAIL"===r&&s&&(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)(k.default,{readOnly:!0,title:(0,t.jsx)("div",{children:"JSON OUTPUT"}),language:j.CodeLanguage.json,value:s,isJSONStringifyBeauty:!0})})]})}),_=e=>{let{isWorkflow:w,workflowProcessData:k,className:j,isError:S,onRetry:N,content:I,messageId:M,isLoading:A,isResponding:R,moreLikeThis:F,isInWebApp:T=!1,feedback:D,onFeedback:V,onSave:P,depth:E=1,isMobile:H,appSourceType:$,installedAppId:B,taskId:U,controlClearMoreLikeThis:Z,supportFeedback:O,isShowTextToSpeech:W,hideProcessDetail:q,siteInfo:z,inSidePanel:J}=e,{t:G}=(0,l.useTranslation)(),K=(0,n.useParams)(),X=1===E,Q=$===y.AppSourceType.tryApp,[Y,ee]=(0,i.useState)(""),[et,ea]=(0,i.useState)(null),[es,er]=(0,i.useState)({rating:null}),{config:en}=(0,m.useChatContext)(),ei=(0,o.useStore)(e=>e.setCurrentLogItem),el=(0,o.useStore)(e=>e.setShowPromptLogModal),eo=async e=>{await (0,y.updateFeedback)({url:`/messages/${et}/feedbacks`,body:{rating:e.rating}},$,B),er(e)},[ed,{setTrue:eu,setFalse:ec}]=(0,s.useBoolean)(!1),ep=async()=>{if(ed||!M)return void b.default.notify({type:"warning",message:G("errorMessage.waitForResponse",{ns:"appDebug"})});eu();let e=await (0,y.fetchMoreLikeThis)(M,$,B);ee(e.answer),er({rating:null}),ea(e.id),ec()};(0,i.useEffect)(()=>{Z&&(ea(null),ee(""))},[Z]),(0,i.useEffect)(()=>{A&&ea(null)},[A]);let em=async()=>{let e=await (0,x.fetchTextGenerationMessage)({appId:K.appId,messageId:M});ei(Array.isArray(e.message)?{...e,log:[...e.message,..."assistant"!==e.message[e.message.length-1].role?[{role:"assistant",text:e.answer,files:e.message_files?.filter(e=>"assistant"===e.belongs_to)||[]}]:[]]}:{...e,log:["string"==typeof e.message?{text:e.message}:e.message]}),el(!0)},[eh,ef]=(0,i.useState)("DETAIL"),eg=!!k?.resultText||!!k?.files?.length||k?.humanInputFormDataList&&k?.humanInputFormDataList.length>0||k?.humanInputFilledFormDataList&&k?.humanInputFilledFormDataList.length>0,eb=async e=>{ef(e)};(0,i.useEffect)(()=>{k?.resultText||k?.files?.length||k?.humanInputFormDataList&&k?.humanInputFormDataList.length>0||k?.humanInputFilledFormDataList&&k?.humanInputFilledFormDataList.length>0?eb("RESULT"):eb("DETAIL")},[k?.files?.length,k?.resultText,k?.humanInputFormDataList,k?.humanInputFilledFormDataList]);let ex=(0,i.useCallback)(async(e,t)=>{$===y.AppSourceType.installedApp?await (0,C.submitHumanInputForm)(e,t):await (0,y.submitHumanInputForm)(e,t)},[$]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,v.cn)("relative",!X&&"mt-3",j),children:[A&&(0,t.jsx)("div",{className:(0,v.cn)("flex h-10 items-center",!J&&"rounded-2xl border-t border-divider-subtle bg-chat-bubble-bg"),children:(0,t.jsx)(h.default,{type:"area"})}),!A&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,v.cn)("relative",!J&&"rounded-2xl border-t border-divider-subtle bg-chat-bubble-bg"),children:[k&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,v.cn)("p-3",eg&&"border-b border-divider-subtle"),children:[U&&(0,t.jsxs)("div",{className:(0,v.cn)("system-2xs-medium-uppercase mb-2 flex items-center text-text-accent-secondary",S&&"text-text-destructive"),children:[(0,t.jsx)(a.RiPlayList2Line,{className:"mr-1 h-3 w-3"}),(0,t.jsx)("span",{children:G("generation.execution",{ns:"share"})}),(0,t.jsx)("span",{className:"px-1",children:"·"}),(0,t.jsx)("span",{children:U})]}),z&&k&&(0,t.jsx)(p.default,{data:k,expand:k.expand,hideProcessDetail:q,hideInfo:q,readonly:!z.show_workflow_steps}),eg&&(0,t.jsxs)("div",{className:"flex items-center space-x-6 px-1",children:[(0,t.jsx)("div",{className:(0,v.cn)("system-sm-semibold-uppercase cursor-pointer border-b-2 border-transparent py-3 text-text-tertiary","RESULT"===eh&&"border-util-colors-blue-brand-blue-brand-600 text-text-primary"),onClick:()=>eb("RESULT"),children:G("result",{ns:"runLog"})}),(0,t.jsx)("div",{className:(0,v.cn)("system-sm-semibold-uppercase cursor-pointer border-b-2 border-transparent py-3 text-text-tertiary","DETAIL"===eh&&"border-util-colors-blue-brand-blue-brand-600 text-text-primary"),onClick:()=>eb("DETAIL"),children:G("detail",{ns:"runLog"})})]})]}),!S&&(0,t.jsxs)(t.Fragment,{children:["RESULT"===eh&&k.humanInputFormDataList&&k.humanInputFormDataList.length>0&&(0,t.jsx)("div",{className:"px-4 pt-4",children:(0,t.jsx)(c.default,{humanInputFormDataList:k.humanInputFormDataList,onHumanInputFormSubmit:ex})}),"RESULT"===eh&&k.humanInputFilledFormDataList&&k.humanInputFilledFormDataList.length>0&&(0,t.jsx)("div",{className:"px-4 pt-4",children:(0,t.jsx)(u.default,{humanInputFilledFormDataList:k.humanInputFilledFormDataList})}),(0,t.jsx)(L,{data:k,content:I,currentTab:eh})]})]}),!k&&U&&(0,t.jsxs)("div",{className:(0,v.cn)("system-2xs-medium-uppercase sticky left-0 top-0 flex w-full items-center rounded-t-2xl bg-components-actionbar-bg p-4 pb-3 text-text-accent-secondary",S&&"text-text-destructive"),children:[(0,t.jsx)(a.RiPlayList2Line,{className:"mr-1 h-3 w-3"}),(0,t.jsx)("span",{children:G("generation.execution",{ns:"share"})}),(0,t.jsx)("span",{className:"px-1",children:"·"}),(0,t.jsx)("span",{children:`${U}${E>1?`-${E-1}`:""}`})]}),S&&(0,t.jsx)("div",{className:"body-lg-regular p-4 pt-0 text-text-quaternary",children:G("generation.batchFailed.outputPlaceholder",{ns:"share"})}),!k&&!S&&"string"==typeof I&&(0,t.jsx)("div",{className:(0,v.cn)("p-4",U&&"pt-0"),children:(0,t.jsx)(f.Markdown,{content:I})})]}),(0,t.jsxs)("div",{className:(0,v.cn)("system-xs-regular relative mt-1 h-4 px-4 text-text-quaternary",H&&(et||ed)&&E<3&&"pl-10"),children:[!w&&(0,t.jsxs)("span",{children:[I?.length," ",G("unit.char",{ns:"common"})]}),(0,t.jsxs)("div",{className:"absolute bottom-1 right-2 flex items-center",children:[!T&&$!==y.AppSourceType.installedApp&&!R&&(0,t.jsx)("div",{className:"ml-1 flex items-center gap-0.5 rounded-[10px] border-[0.5px] border-components-actionbar-border bg-components-actionbar-bg p-0.5 shadow-md backdrop-blur-sm",children:(0,t.jsx)(d.default,{disabled:S||!M,onClick:em,children:(0,t.jsx)(a.RiFileList3Line,{className:"h-4 w-4"})})}),(0,t.jsxs)("div",{className:"ml-1 flex items-center gap-0.5 rounded-[10px] border-[0.5px] border-components-actionbar-border bg-components-actionbar-bg p-0.5 shadow-md backdrop-blur-sm",children:[F&&!Q&&(0,t.jsx)(d.default,{state:3===E?d.ActionButtonState.Disabled:d.ActionButtonState.Default,disabled:3===E,onClick:ep,children:(0,t.jsx)(a.RiSparklingLine,{className:"h-4 w-4"})}),W&&!Q&&(0,t.jsx)(g.default,{id:M,voice:en?.text_to_speech?.voice}),("RESULT"===eh&&k?.resultText||!w)&&(0,t.jsx)(d.default,{disabled:S||!M,onClick:()=>{let e=w?k?.resultText:I;"string"==typeof e?(0,r.default)(e):(0,r.default)(JSON.stringify(e)),b.default.notify({type:"success",message:G("actionMsg.copySuccessfully",{ns:"common"})})},children:(0,t.jsx)(a.RiClipboardLine,{className:"h-4 w-4"})}),T&&S&&(0,t.jsx)(d.default,{onClick:N,children:(0,t.jsx)(a.RiResetLeftLine,{className:"h-4 w-4"})}),T&&!w&&!Q&&(0,t.jsx)(d.default,{disabled:S||!M,onClick:()=>{P?.(M)},children:(0,t.jsx)(a.RiBookmark3Line,{className:"h-4 w-4"})})]}),(O||T)&&!w&&!Q&&!S&&M&&(0,t.jsxs)("div",{className:"ml-1 flex items-center gap-0.5 rounded-[10px] border-[0.5px] border-components-actionbar-border bg-components-actionbar-bg p-0.5 shadow-md backdrop-blur-sm",children:[!D?.rating&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.default,{onClick:()=>V?.({rating:"like"}),children:(0,t.jsx)(a.RiThumbUpLine,{className:"h-4 w-4"})}),(0,t.jsx)(d.default,{onClick:()=>V?.({rating:"dislike"}),children:(0,t.jsx)(a.RiThumbDownLine,{className:"h-4 w-4"})})]}),D?.rating==="like"&&(0,t.jsx)(d.default,{state:d.ActionButtonState.Active,onClick:()=>V?.({rating:null}),children:(0,t.jsx)(a.RiThumbUpLine,{className:"h-4 w-4"})}),D?.rating==="dislike"&&(0,t.jsx)(d.default,{state:d.ActionButtonState.Destructive,onClick:()=>V?.({rating:null}),children:(0,t.jsx)(a.RiThumbDownLine,{className:"h-4 w-4"})})]})]})]}),!X&&(0,t.jsxs)("div",{className:(0,v.cn)("absolute top-[-32px] flex h-[33px] w-4 justify-center",H?"left-[17px]":"left-[50%] translate-x-[-50%]"),children:[(0,t.jsx)("div",{className:"h-full w-0.5 bg-divider-regular"}),(0,t.jsx)("div",{className:(0,v.cn)("absolute left-0 flex h-4 w-4 items-center justify-center rounded-2xl border-[0.5px] border-divider-subtle bg-util-colors-blue-blue-500 shadow-xs",H?"top-[3.5px]":"top-2"),children:(0,t.jsx)(a.RiSparklingFill,{className:"h-3 w-3 text-text-primary-on-surface"})})]})]})]}),(et||ed)&&E<3&&(0,t.jsx)(_,{isInWebApp:T,content:Y,messageId:et,depth:E+1,moreLikeThis:!0,onFeedback:eo,isLoading:ed,feedback:es,onSave:P,isShowTextToSpeech:W,isMobile:H,appSourceType:$,installedAppId:B,controlClearMoreLikeThis:Z,isWorkflow:w,siteInfo:z,taskId:U})]})},S=i.memo(_);e.s(["default",0,S],419874)},680884,e=>{"use strict";e.s(["formatBooleanInputs",0,(e,t)=>{if(!e)return t;let a={...t};return e.forEach(e=>{"checkbox"===e.type&&(a[e.key]=!!a[e.key])}),a},"promptVariablesToUserInputsForm",0,e=>{let t=[];return e.filter(e=>{let{key:t,name:a}=e;return t&&t.trim()&&a&&a.trim()}).forEach(e=>{"string"===e.type||"paragraph"===e.type?t.push({["string"===e.type?"text-input":"paragraph"]:{label:e.name,variable:e.key,required:!1!==e.required,max_length:e.max_length,default:"",hide:e.hide}}):"number"===e.type||"checkbox"===e.type?t.push({[e.type]:{label:e.name,variable:e.key,required:!1!==e.required,default:"",hide:e.hide}}):"select"===e.type?t.push({select:{label:e.name,variable:e.key,required:!1!==e.required,options:e.options,default:e.default??"",hide:e.hide}}):t.push({external_data_tool:{label:e.name,variable:e.key,enabled:e.enabled,type:e.type,config:e.config,required:e.required,icon:e.icon,icon_background:e.icon_background,hide:e.hide}})}),t},"userInputsFormToPromptVariables",0,(e,t)=>{if(!e)return[];let a=[];return e.forEach(e=>{let[s,r]=e.paragraph?["paragraph",e.paragraph]:e["text-input"]?["string",e["text-input"]]:e.number?["number",e.number]:e.checkbox?["boolean",e.checkbox]:e.file?["file",e.file]:e["file-list"]?["file-list",e["file-list"]]:e.external_data_tool?[e.external_data_tool.type,e.external_data_tool]:e.json_object?["json_object",e.json_object]:["select",e.select||{}],n=t===r?.variable;"string"===s||"paragraph"===s?a.push({key:r.variable,name:r.label,required:r.required,type:s,max_length:r.max_length,options:[],is_context_var:n,hide:r.hide,default:r.default}):"number"===s?a.push({key:r.variable,name:r.label,required:r.required,type:s,options:[],hide:r.hide,default:r.default}):"boolean"===s?a.push({key:r.variable,name:r.label,required:r.required,type:"checkbox",options:[],hide:r.hide,default:r.default}):"select"===s?a.push({key:r.variable,name:r.label,required:r.required,type:"select",options:r.options,is_context_var:n,hide:r.hide,default:r.default}):"file"===s?a.push({key:r.variable,name:r.label,required:r.required,type:s,config:{allowed_file_types:r.allowed_file_types,allowed_file_extensions:r.allowed_file_extensions,allowed_file_upload_methods:r.allowed_file_upload_methods,number_limits:1},hide:r.hide,default:r.default}):"file-list"===s?a.push({key:r.variable,name:r.label,required:r.required,type:s,config:{allowed_file_types:r.allowed_file_types,allowed_file_extensions:r.allowed_file_extensions,allowed_file_upload_methods:r.allowed_file_upload_methods,number_limits:r.max_length},hide:r.hide,default:r.default}):a.push({key:r.variable,name:r.label,required:r.required,type:r.type,enabled:r.enabled,config:r.config,icon:r.icon,icon_background:r.icon_background,is_context_var:n,hide:r.hide})}),a}])},581367,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},children:[{type:"element",name:"path",attributes:{d:"M10.3567 3.56405L10.2334 3.84689C10.1432 4.05396 9.8568 4.05396 9.76655 3.84689L9.6433 3.56405C9.42355 3.05973 9.02775 2.6582 8.53385 2.43854L8.154 2.26961C7.94865 2.17826 7.94865 1.8794 8.154 1.78806L8.5126 1.62857C9.0192 1.40325 9.4221 0.986865 9.63805 0.465414L9.76465 0.159767C9.8529 -0.0532556 10.1471 -0.0532556 10.2353 0.159767L10.3619 0.465414C10.5779 0.986865 10.9808 1.40325 11.4874 1.62857L11.846 1.78806C12.0514 1.8794 12.0514 2.17826 11.846 2.26961L11.4662 2.43854C10.9723 2.6582 10.5764 3.05973 10.3567 3.56405ZM4.25 3H3.25V9H4.25V3ZM2 5H1V7H2V5ZM6.5 1H5.5V11H6.5V1ZM8.75 4H7.75V9H8.75V4ZM11 5H10V7H11V5Z",fill:"currentColor"},children:[]}]},name:"AudioSupportIcon"})},233222,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},children:[{type:"element",name:"path",attributes:{d:"M10.5 4V10.4966C10.5 10.7751 10.2776 11 10.0033 11H1.9967C1.72248 11 1.5 10.778 1.5 10.5041V1.4959C1.5 1.22766 1.72435 1 2.00111 1H7.4984L10.5 4ZM9.5 4.5H7V2H2.5V10H9.5V4.5ZM4 3.5H5.5V4.5H4V3.5ZM4 5.5H8V6.5H4V5.5ZM4 7.5H8V8.5H4V7.5Z",fill:"currentColor"},children:[]}]},name:"DocumentSupportIcon"})},131986,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"g",attributes:{id:"box-sparkle, magic box"},children:[{type:"element",name:"g",attributes:{id:"Icon"},children:[{type:"element",name:"path",attributes:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9.76205 2.07424C9.99723 2.21897 10.0706 2.52694 9.92583 2.76212L8.85632 4.50007H9.5C9.77614 4.50007 10 4.72393 10 5.00007V9.00007C10 10.1046 9.10457 11.0001 8 11.0001H4C2.89543 11.0001 2 10.1046 2 9.00007V5.00007C2 4.72393 2.22386 4.50007 2.5 4.50007H7.68214L9.07417 2.23802C9.2189 2.00284 9.52687 1.92952 9.76205 2.07424ZM5 6.50007C4.72386 6.50007 4.5 6.72393 4.5 7.00007C4.5 7.27621 4.72386 7.50007 5 7.50007H7C7.27614 7.50007 7.5 7.27621 7.5 7.00007C7.5 6.72393 7.27614 6.50007 7 6.50007H5Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M5.92504 1.53733C5.97342 1.51314 6.01265 1.47391 6.03684 1.42553L6.27597 0.947279C6.3681 0.763016 6.63105 0.763017 6.72318 0.947279L6.96231 1.42553C6.9865 1.47391 7.02573 1.51314 7.07411 1.53733L7.55236 1.77646C7.73663 1.86859 7.73663 2.13154 7.55236 2.22367L7.07411 2.4628C7.02573 2.48699 6.9865 2.52622 6.96231 2.5746L6.72318 3.05285C6.63105 3.23711 6.3681 3.23711 6.27597 3.05285L6.03684 2.5746C6.01265 2.52622 5.97342 2.48699 5.92504 2.4628L5.44679 2.22367C5.26253 2.13154 5.26253 1.86859 5.44679 1.77646L5.92504 1.53733Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M3.25837 2.37067C3.30676 2.34648 3.34599 2.30724 3.37018 2.25886L3.52597 1.94728C3.6181 1.76302 3.88105 1.76302 3.97318 1.94728L4.12898 2.25886C4.15317 2.30724 4.1924 2.34648 4.24078 2.37067L4.55236 2.52646C4.73662 2.61859 4.73663 2.88154 4.55236 2.97367L4.24078 3.12946C4.1924 3.15365 4.15317 3.19289 4.12898 3.24127L3.97318 3.55285C3.88105 3.73711 3.6181 3.73711 3.52597 3.55285L3.37018 3.24127C3.34599 3.19289 3.30676 3.15365 3.25837 3.12946L2.94679 2.97367C2.76253 2.88154 2.76253 2.61859 2.94679 2.52646L3.25837 2.37067Z",fill:"currentColor"},children:[]}]}]}]},name:"MagicBox"})},235490,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"g",attributes:{id:"eye-sparkle, magic eyes"},children:[{type:"element",name:"path",attributes:{id:"Icon","fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.0338 5.05688C9.75366 3.05335 7.90203 1.99999 6.00017 2C4.09831 2.00001 2.24669 3.05341 0.966566 5.05693C0.599687 5.63113 0.599686 6.36892 0.966566 6.94312C2.24669 8.94665 4.09832 10 6.00018 10C7.90204 9.99999 9.75366 8.94659 11.0338 6.94307C11.4007 6.36887 11.4007 5.63108 11.0338 5.05688ZM5.77639 4.44721L5.3706 5.2588C5.34641 5.30718 5.30718 5.34641 5.2588 5.3706L4.44721 5.77639C4.26295 5.86852 4.26295 6.13148 4.44721 6.22361L5.2588 6.6294C5.30718 6.65359 5.34641 6.69282 5.3706 6.7412L5.77639 7.55279C5.86852 7.73705 6.13148 7.73705 6.22361 7.55279L6.6294 6.7412C6.65359 6.69282 6.69282 6.65359 6.7412 6.6294L7.55279 6.22361C7.73705 6.13148 7.73705 5.86852 7.55279 5.77639L6.7412 5.3706C6.69282 5.34641 6.65359 5.30718 6.6294 5.2588L6.22361 4.44721C6.13148 4.26295 5.86852 4.26295 5.77639 4.44721Z",fill:"currentColor"},children:[]}]}]},name:"MagicEyes"})},240899,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"g",attributes:{id:"magic-wand-2, magic stick, star"},children:[{type:"element",name:"g",attributes:{id:"Icon"},children:[{type:"element",name:"path",attributes:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.27056 1.77151C8.811 1.23107 9.68723 1.23107 10.2277 1.77151C10.7681 2.31195 10.7681 3.18818 10.2277 3.72862L3.72767 10.2286C3.18723 10.7691 2.31101 10.7691 1.77056 10.2286C1.23012 9.68818 1.23012 8.81195 1.77056 8.27151L8.27056 1.77151ZM9.52056 2.47862C9.37065 2.3287 9.12759 2.3287 8.97767 2.47862L8.08122 3.37506L8.62412 3.91796L9.52056 3.02151C9.67048 2.87159 9.67048 2.62853 9.52056 2.47862Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M4.92504 1.03733C4.97342 1.01314 5.01265 0.973911 5.03684 0.92553L5.27597 0.447279C5.3681 0.263016 5.63105 0.263017 5.72318 0.447279L5.96231 0.92553C5.9865 0.973911 6.02573 1.01314 6.07411 1.03733L6.55236 1.27646C6.73663 1.36859 6.73663 1.63154 6.55236 1.72367L6.07411 1.9628C6.02573 1.98699 5.9865 2.02622 5.96231 2.0746L5.72318 2.55285C5.63105 2.73711 5.3681 2.73711 5.27597 2.55285L5.03684 2.0746C5.01265 2.02622 4.97342 1.98699 4.92504 1.9628L4.44679 1.72367C4.26253 1.63154 4.26253 1.36859 4.44679 1.27646L4.92504 1.03733Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M9.42504 6.53733C9.47342 6.51314 9.51265 6.47391 9.53684 6.42553L9.77597 5.94728C9.8681 5.76302 10.1311 5.76302 10.2232 5.94728L10.4623 6.42553C10.4865 6.47391 10.5257 6.51314 10.5741 6.53733L11.0524 6.77646C11.2366 6.86859 11.2366 7.13154 11.0524 7.22367L10.5741 7.4628C10.5257 7.48699 10.4865 7.52622 10.4623 7.5746L10.2232 8.05285C10.1311 8.23711 9.8681 8.23711 9.77597 8.05285L9.53684 7.5746C9.51265 7.52622 9.47342 7.48699 9.42504 7.4628L8.94679 7.22367C8.76253 7.13154 8.76253 6.86859 8.94679 6.77646L9.42504 6.53733Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M2.42504 3.53733C2.47342 3.51314 2.51265 3.47391 2.53684 3.42553L2.77597 2.94728C2.8681 2.76302 3.13105 2.76302 3.22318 2.94728L3.46231 3.42553C3.4865 3.47391 3.52573 3.51314 3.57411 3.53733L4.05236 3.77646C4.23663 3.86859 4.23663 4.13154 4.05236 4.22367L3.57411 4.4628C3.52573 4.48699 3.4865 4.52622 3.46231 4.5746L3.22318 5.05285C3.13105 5.23711 2.8681 5.23711 2.77597 5.05285L2.53684 4.5746C2.51265 4.52622 2.47342 4.48699 2.42504 4.4628L1.94679 4.22367C1.76253 4.13154 1.76253 3.86859 1.94679 3.77646L2.42504 3.53733Z",fill:"currentColor"},children:[]}]}]}]},name:"MagicWand"})},739309,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"g",attributes:{id:"microphone-01"},children:[{type:"element",name:"g",attributes:{id:"Solid"},children:[{type:"element",name:"path",attributes:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.00008 0.666016C6.52732 0.666016 5.33341 1.85992 5.33341 3.33268V7.99935C5.33341 9.47211 6.52732 10.666 8.00008 10.666C9.47284 10.666 10.6667 9.47211 10.6667 7.99935V3.33268C10.6667 1.85992 9.47284 0.666016 8.00008 0.666016Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M4.00008 6.66602C4.00008 6.29783 3.7016 5.99935 3.33341 5.99935C2.96522 5.99935 2.66675 6.29783 2.66675 6.66602V7.99935C2.66675 10.7195 4.70319 12.9641 7.33466 13.2916C7.33384 13.3052 7.33341 13.3189 7.33341 13.3327V13.9993H5.33341C4.96522 13.9993 4.66675 14.2978 4.66675 14.666C4.66675 15.0342 4.96522 15.3327 5.33341 15.3327H10.6667C11.0349 15.3327 11.3334 15.0342 11.3334 14.666C11.3334 14.2978 11.0349 13.9993 10.6667 13.9993H8.66675V13.3327C8.66675 13.3189 8.66633 13.3052 8.6655 13.2916C11.297 12.9641 13.3334 10.7195 13.3334 7.99935V6.66602C13.3334 6.29783 13.0349 5.99935 12.6667 5.99935C12.2986 5.99935 12.0001 6.29783 12.0001 6.66602V7.99935C12.0001 10.2085 10.2092 11.9993 8.00008 11.9993C5.79094 11.9993 4.00008 10.2085 4.00008 7.99935V6.66602Z",fill:"currentColor"},children:[]}]}]}]},name:"Microphone01"})},95787,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"g",attributes:{id:"play"},children:[{type:"element",name:"path",attributes:{id:"Solid","fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.00312 1.40109C4.0091 1.40508 4.0151 1.40907 4.02111 1.41309L9.29548 4.92933C9.44809 5.03105 9.58959 5.12537 9.69827 5.21301C9.81168 5.30448 9.94538 5.43132 10.0223 5.61687C10.124 5.86212 10.124 6.13775 10.0223 6.38301C9.94538 6.56856 9.81168 6.6954 9.69827 6.78686C9.5896 6.8745 9.44811 6.96881 9.2955 7.07053L4.00314 10.5988C3.8166 10.7232 3.64886 10.835 3.50652 10.9121C3.36409 10.9893 3.16859 11.0775 2.9404 11.0639C2.64852 11.0465 2.3789 10.9022 2.20249 10.669C2.06458 10.4867 2.02952 10.2751 2.01474 10.1138C1.99997 9.95254 1.99999 9.75094 2 9.52674L2 2.49475C2 2.48752 2 2.48031 2 2.47313C1.99999 2.24893 1.99997 2.04733 2.01474 1.88612C2.02952 1.72479 2.06458 1.5132 2.20249 1.33089C2.3789 1.0977 2.64852 0.953401 2.9404 0.935973C3.16859 0.922349 3.36409 1.01055 3.50652 1.08774C3.64885 1.16488 3.81659 1.27672 4.00312 1.40109Z",fill:"currentColor"},children:[]}]}]},name:"Play"})},660921,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"g",attributes:{id:"robot, bot"},children:[{type:"element",name:"path",attributes:{id:"Icon","fill-rule":"evenodd","clip-rule":"evenodd",d:"M6 0.5C6.27614 0.5 6.5 0.723858 6.5 1V1.5H8.5C9.32843 1.5 10 2.17157 10 3V5.5C10 5.94425 9.80688 6.34339 9.5 6.61805V7.29289L10.3536 8.14645C10.5488 8.34171 10.5488 8.65829 10.3536 8.85355C10.1583 9.04882 9.84171 9.04882 9.64645 8.85355L9.34052 8.54762C8.89526 9.96884 7.56805 11 6 11C4.43195 11 3.10474 9.96884 2.65948 8.54762L2.35355 8.85355C2.15829 9.04882 1.84171 9.04882 1.64645 8.85355C1.45118 8.65829 1.45118 8.34171 1.64645 8.14645L2.5 7.29289V6.61805C2.19313 6.34339 2 5.94425 2 5.5V3C2 2.17157 2.67157 1.5 3.5 1.5H5.5V1C5.5 0.723858 5.72386 0.5 6 0.5ZM3.5 2.5C3.22386 2.5 3 2.72386 3 3V5.5C3 5.77614 3.22386 6 3.5 6H8.5C8.77614 6 9 5.77614 9 5.5V3C9 2.72386 8.77614 2.5 8.5 2.5H3.5ZM4.5 3.5C4.77614 3.5 5 3.72386 5 4V4.5C5 4.77614 4.77614 5 4.5 5C4.22386 5 4 4.77614 4 4.5V4C4 3.72386 4.22386 3.5 4.5 3.5ZM7.5 3.5C7.77614 3.5 8 3.72386 8 4V4.5C8 4.77614 7.77614 5 7.5 5C7.22386 5 7 4.77614 7 4.5V4C7 3.72386 7.22386 3.5 7.5 3.5Z",fill:"currentColor"},children:[]}]}]},name:"Robot"})},360506,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"path",attributes:{d:"M5 2C5.55228 2 6 2.44772 6 3V7C6 7.55228 5.55228 8 5 8C4.44772 8 4 7.55228 4 7V3C4 2.44772 4.44772 2 5 2Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M6 15.8293C7.16519 15.4175 8 14.3062 8 13C8 11.3431 6.65685 10 5 10C3.34315 10 2 11.3431 2 13C2 14.3062 2.83481 15.4175 4 15.8293L4 21C4 21.5523 4.44772 22 5 22C5.55229 22 6 21.5523 6 21L6 15.8293Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M13 15C13 14.4477 12.5523 14 12 14C11.4477 14 11 14.4477 11 15V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V15Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2C12.5523 2 13 2.44772 13 3V6.17071C14.1652 6.58254 15 7.69378 15 9C15 10.6569 13.6569 12 12 12C10.3431 12 9 10.6569 9 9C9 7.69378 9.83481 6.58254 11 6.17071V3C11 2.44772 11.4477 2 12 2Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M22 15C22 16.3062 21.1652 17.4175 20 17.8293V21C20 21.5523 19.5523 22 19 22C18.4477 22 18 21.5523 18 21V17.8293C16.8348 17.4175 16 16.3062 16 15C16 13.3431 17.3431 12 19 12C20.6569 12 22 13.3431 22 15Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M19 2C19.5523 2 20 2.44772 20 3V9C20 9.55228 19.5523 10 19 10C18.4477 10 18 9.55228 18 9V3C18 2.44772 18.4477 2 19 2Z",fill:"currentColor"},children:[]}]},name:"Sliders02"})},588509,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"g",attributes:{"clip-path":"url(#clip0_109_6694)"},children:[{type:"element",name:"path",attributes:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0 2.86666C0 2.05664 0.656649 1.39999 1.46667 1.39999H5.86667C6.67668 1.39999 7.33333 2.05664 7.33333 2.86666C7.33333 3.27167 7.00501 3.59999 6.6 3.59999C6.19499 3.59999 5.86667 3.27167 5.86667 2.86666H4.4V7.99999C4.80501 7.99999 5.13333 8.32831 5.13333 8.73332C5.13333 9.13833 4.80501 9.46666 4.4 9.46666H2.93333C2.52832 9.46666 2.2 9.13833 2.2 8.73332C2.2 8.32831 2.52832 7.99999 2.93333 7.99999V2.86666H1.46667C1.46667 3.27167 1.13834 3.59999 0.733333 3.59999C0.328324 3.59999 0 3.27167 0 2.86666Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M13.8205 0.782296C13.7434 0.62811 13.5233 0.62811 13.4462 0.782296C12.9664 1.74206 12.8754 1.83302 11.9156 2.3129C11.7615 2.39 11.7615 2.61003 11.9156 2.68712C12.8754 3.167 12.9664 3.25797 13.4462 4.21773C13.5233 4.37191 13.7434 4.37191 13.8205 4.21773C14.3003 3.25797 14.3913 3.167 15.3511 2.68712C15.5053 2.61003 15.5053 2.39 15.3511 2.3129C14.3913 1.83302 14.3003 1.74206 13.8205 0.782296Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M9.79394 2.25319C9.71404 2.09337 9.48596 2.09337 9.40605 2.25319C9.04994 2.96543 8.96544 3.04993 8.2532 3.40605C8.09338 3.48595 8.09338 3.71402 8.2532 3.79393C8.96544 4.15005 9.04994 4.23455 9.40606 4.94679C9.48596 5.10661 9.71404 5.10661 9.79394 4.94679C10.1501 4.23455 10.2346 4.15005 10.9468 3.79393C11.1066 3.71402 11.1066 3.48595 10.9468 3.40605C10.2346 3.04993 10.1501 2.96543 9.79394 2.25319Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{d:"M2.75377 11.049C2.67668 10.8948 2.45665 10.8948 2.37956 11.049C1.89969 12.0087 1.80872 12.0997 0.848971 12.5796C0.694788 12.6566 0.694787 12.8767 0.848971 12.9538C1.80872 13.4336 1.89969 13.5246 2.37956 14.4844C2.45665 14.6385 2.67668 14.6385 2.75377 14.4844C3.23365 13.5246 3.32461 13.4336 4.28436 12.9538C4.43855 12.8767 4.43855 12.6566 4.28436 12.5796C3.32461 12.0997 3.23365 12.0087 2.75377 11.049Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M14.6741 8.65106C14.8886 8.50146 15.1837 8.55405 15.3333 8.76853C15.7614 9.38226 16.0125 10.1292 16.0125 10.9333C16.0125 11.7375 15.7614 12.4844 15.3333 13.0981C15.1837 13.3126 14.8886 13.3652 14.6741 13.2156C14.4596 13.066 14.407 12.7708 14.5567 12.5564C14.8775 12.0964 15.0656 11.5375 15.0656 10.9333C15.0656 10.3291 14.8775 9.77025 14.5567 9.31028C14.407 9.09581 14.4596 8.80066 14.6741 8.65106Z",fill:"currentColor"},children:[]},{type:"element",name:"path",attributes:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.5674 6.53771C12.794 6.51987 13.0155 6.61161 13.1632 6.78449C13.2954 6.93929 13.3164 7.12549 13.3244 7.21587C13.3334 7.31718 13.3334 7.44301 13.3333 7.57103C13.3333 7.57691 13.3333 7.58278 13.3333 7.58866L13.3333 14.3C13.3334 14.428 13.3334 14.5539 13.3244 14.6552C13.3164 14.7455 13.2954 14.9317 13.1632 15.0865C13.0155 15.2594 12.794 15.3512 12.5674 15.3333C12.3644 15.3173 12.2179 15.2005 12.1484 15.1423C12.0704 15.077 11.9814 14.988 11.8909 14.8975L10.3795 13.3861C10.3357 13.3423 10.3137 13.3205 10.2971 13.3053L10.2958 13.3041L10.2941 13.3041C10.2716 13.303 10.2407 13.3029 10.1787 13.3029L9.34101 13.3029C9.22151 13.3029 9.10513 13.3029 9.00657 13.2949C8.89833 13.286 8.77062 13.2652 8.6421 13.1997C8.46392 13.1089 8.31906 12.964 8.22827 12.7859C8.16279 12.6574 8.14192 12.5296 8.13308 12.4214C8.12503 12.3228 8.12504 12.2065 8.12505 12.087V9.79916C8.12505 9.79413 8.12505 9.78909 8.12505 9.78406C8.12504 9.66456 8.12503 9.54819 8.13308 9.44963C8.14192 9.34139 8.16279 9.21368 8.22827 9.08517C8.31906 8.90699 8.46392 8.76212 8.6421 8.67133C8.77062 8.60585 8.89833 8.58498 9.00657 8.57614C9.10512 8.56809 9.2215 8.5681 9.341 8.56812C9.34603 8.56812 9.35106 8.56812 9.3561 8.56812H10.1787C10.2407 8.56812 10.2716 8.56801 10.2941 8.56698L10.2958 8.5669L10.2971 8.56575C10.3137 8.55058 10.3357 8.52877 10.3795 8.48491L11.8784 6.98602C11.8826 6.98186 11.8867 6.97771 11.8909 6.97355C11.9814 6.88302 12.0704 6.79403 12.1484 6.72874C12.2179 6.67049 12.3644 6.55368 12.5674 6.53771Z",fill:"currentColor"},children:[]}]},{type:"element",name:"defs",attributes:{},children:[{type:"element",name:"clipPath",attributes:{id:"clip0_109_6694"},children:[{type:"element",name:"rect",attributes:{width:"16",height:"16",fill:"white"},children:[]}]}]}]},name:"Speaker"})},720076,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},children:[{type:"element",name:"g",attributes:{id:"stop-circle"},children:[{type:"element",name:"path",attributes:{id:"Solid","fill-rule":"evenodd","clip-rule":"evenodd",d:"M9.99992 0.833984C4.93731 0.833984 0.833252 4.93804 0.833252 10.0007C0.833252 15.0633 4.93731 19.1673 9.99992 19.1673C15.0625 19.1673 19.1666 15.0633 19.1666 10.0007C19.1666 4.93804 15.0625 0.833984 9.99992 0.833984ZM6.75741 7.12232C6.66658 7.30058 6.66658 7.53394 6.66658 8.00065V12.0006C6.66658 12.4674 6.66658 12.7007 6.75741 12.879C6.83731 13.0358 6.96479 13.1633 7.12159 13.2432C7.29985 13.334 7.53321 13.334 7.99992 13.334H11.9999C12.4666 13.334 12.7 13.334 12.8782 13.2432C13.035 13.1633 13.1625 13.0358 13.2424 12.879C13.3333 12.7007 13.3333 12.4674 13.3333 12.0006V8.00065C13.3333 7.53394 13.3333 7.30058 13.2424 7.12232C13.1625 6.96552 13.035 6.83804 12.8782 6.75814C12.7 6.66732 12.4666 6.66732 11.9999 6.66732H7.99992C7.53321 6.66732 7.29985 6.66732 7.12159 6.75814C6.96479 6.83804 6.83731 6.96552 6.75741 7.12232Z",fill:"currentColor"},children:[]}]}]},name:"StopCircle"})},870896,e=>{e.v({icon:{type:"element",isRootNode:!0,name:"svg",attributes:{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},children:[{type:"element",name:"path",attributes:{d:"M10.2334 4.3469L10.3567 4.06406C10.5764 3.55974 10.9723 3.15821 11.4662 2.93854L11.846 2.76961C12.0514 2.67827 12.0514 2.37941 11.846 2.28806L11.4874 2.12857C10.9808 1.90326 10.5779 1.48687 10.3619 0.965415L10.2353 0.659765C10.1471 0.446745 9.8529 0.446745 9.76465 0.659765L9.63805 0.965415C9.4221 1.48687 9.0192 1.90326 8.5126 2.12857L8.154 2.28806C7.94865 2.37941 7.94865 2.67827 8.154 2.76961L8.53385 2.93854C9.02775 3.15821 9.42355 3.55974 9.6433 4.06406L9.76655 4.3469C9.8568 4.55396 10.1432 4.55396 10.2334 4.3469ZM1.4959 1.5H7V2.5H4V9.5H8V4.5H9V5.5H10H11V10.0033C11 10.2776 10.7723 10.5 10.5041 10.5H1.4959C1.22203 10.5 1 10.2775 1 10.0033V1.9967C1 1.72238 1.22766 1.5 1.4959 1.5ZM2 2.5V3.5H3V2.5H2ZM2 4.5V5.5H3V4.5H2ZM2 6.5V7.5H3V6.5H2ZM9 6.5V7.5H10V6.5H9ZM2 8.5V9.5H3V8.5H2ZM9 8.5V9.5H10V8.5H9Z",fill:"currentColor"},children:[]}]},name:"VideoSupportIcon"})},992280,835633,926122,e=>{"use strict";var t=e.i(162115),a=e.i(807324);e.i(581367),e.i(233222);var s=e.i(131986);let r=e=>{let{ref:r,...n}=e;return(0,t.jsx)(a.default,{...n,ref:r,data:s.default})};r.displayName="MagicBox",e.s(["default",0,r],835633),e.i(235490),e.i(240899),e.i(739309),e.i(95787),e.i(660921),e.i(360506),e.i(588509);var n=e.i(720076);let i=e=>{let{ref:s,...r}=e;return(0,t.jsx)(a.default,{...r,ref:s,data:n.default})};i.displayName="StopCircle",e.s(["default",0,i],926122),e.i(870896),e.s([],992280)},447301,e=>{"use strict";var t,a=e.i(925521),s=e.i(367916),r=e.i(680173),n=((t={}).webApp="webApp",t.installedApp="installedApp",t.tryApp="tryApp",t);let i={webApp:"",installedApp:"installed-apps",tryApp:"trial-apps"};function l(e){return"webApp"===e}function o(e,t){let a=!l(t);switch(e){case"get":return a?s.get:s.getPublic;case"post":return a?s.post:s.postPublic;case"patch":return a?s.patch:s.patchPublic;case"del":return a?s.del:s.delPublic}}function d(e,t,a){return"webApp"!==t?`${i[t]}/${a}/${e.startsWith("/")?e.slice(1):e}`:e}let u=async function(e,t,a){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return o("post",a)(d(`chat-messages/${t}/stop`,a,s))},c=async function(e,t,a){let{onData:r,onCompleted:n,onError:i,onMessageReplace:o,getAbortController:u}=t,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return(0,s.ssePost)(d("completion-messages",a,c),{body:{...e,response_mode:"streaming"}},{onData:r,onCompleted:n,isPublicAPI:l(a),onError:i,onMessageReplace:o,getAbortController:u})},p=async function(e,t,a){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return(0,s.ssePost)(d("workflows/run",a,r),{body:{...e,response_mode:"streaming"}},{...t,isPublicAPI:l(a)})},m=async function(e,t,a){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(t)return o("post",a)(d(`workflows/tasks/${t}/stop`,a,s))},h=async()=>(0,s.getPublic)("/site"),f=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;return o("get",e)(d("conversations",e,t),{params:{limit:r||20,...a?{last_id:a}:{},...void 0!==s?{pinned:s}:{}}})},g=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0;return o("patch",e)(d(`conversations/${a}/pin`,e,t))},b=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0;return o("patch",e)(d(`conversations/${a}/unpin`,e,t))},x=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0;return o("del",e)(d(`conversations/${a}`,e,t))},y=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;return o("post",e)(d(`conversations/${a}/name`,e,t),{body:{name:s}})},C=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0;return o("post",e)(d(`conversations/${a}/name`,e,t),{body:{auto_generate:!0}})},v=async function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return o("get",t)(d("messages",t,a),{params:{conversation_id:e,limit:20,last_id:""}})},w=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return o("get",e)(d("parameters",e,t))},k=async(e,t)=>o("get","webApp")(d("/enterprise/sso/saml/login","webApp",""),{params:{app_code:e,redirect_url:t}}),j=async(e,t)=>o("get","webApp")(d("/enterprise/sso/oidc/login","webApp",""),{params:{app_code:e,redirect_url:t}}),L=async(e,t)=>o("get","webApp")(d("/enterprise/sso/oauth2/login","webApp",""),{params:{app_code:e,redirect_url:t}}),_=async(e,t)=>o("get","webApp")(d("/enterprise/sso/members/saml/login","webApp",""),{params:{app_code:e,redirect_url:t}}),S=async(e,t)=>o("get","webApp")(d("/enterprise/sso/members/oidc/login","webApp",""),{params:{app_code:e,redirect_url:t}}),N=async(e,t)=>o("get","webApp")(d("/enterprise/sso/members/oauth2/login","webApp",""),{params:{app_code:e,redirect_url:t}}),I=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return o("get",e)(d("meta",e,t))},M=async function(e,t){let{url:a,body:s}=e,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return o("post",t)(d(a,t,r),{body:s})},A=async function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return o("get",t)(d(`/messages/${e}/more-like-this`,t,a),{params:{response_mode:"blocking"}})},R=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return o("get",e)(d("/saved-messages",e,t),{},{silent:!0})},F=async e=>{let{userId:t,appCode:n}=e,i=new Headers;i.append(a.WEB_APP_SHARE_CODE_HEADER_NAME,n);let l=(0,r.getWebAppAccessToken)();l&&i.append("Authorization",`Bearer ${l}`);let o=new URLSearchParams;t&&o.append("user_id",t);let d=`/passport?${o.toString()}`;return(0,s.getPublic)(d,{headers:i})};e.s(["AppSourceType",()=>n,"audioToText",0,(e,t,a)=>o("post",t)(e,{body:a},{bodyStringify:!1,deleteContentType:!0}),"delConversation",0,x,"fetchAccessToken",0,F,"fetchAppInfo",0,h,"fetchAppMeta",0,I,"fetchAppParams",0,w,"fetchChatList",0,v,"fetchConversations",0,f,"fetchMembersOAuth2SSOUrl",0,N,"fetchMembersOIDCSSOUrl",0,S,"fetchMembersSAMLSSOUrl",0,_,"fetchMoreLikeThis",0,A,"fetchSavedMessage",0,R,"fetchSuggestedQuestions",0,function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return o("get",t)(d(`/messages/${e}/suggested-questions`,t,a))},"fetchWebOAuth2SSOUrl",0,L,"fetchWebOIDCSSOUrl",0,j,"fetchWebSAMLSSOUrl",0,k,"generationConversationName",0,C,"getAppAccessModeByAppCode",0,e=>(0,s.getPublic)(`/webapp/access-mode?appCode=${e}`),"getHumanInputForm",0,e=>(0,s.getPublic)(`/form/human_input/${e}`),"getUrl",()=>d,"getUserCanAccess",0,(e,t)=>t?(0,s.get)(`/enterprise/webapp/permission?appId=${e}`):(0,s.getPublic)(`/webapp/permission?appId=${e}`),"pinConversation",0,g,"removeMessage",0,function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return o("del",t)(d(`/saved-messages/${e}`,t,a))},"renameConversation",0,y,"saveMessage",0,function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return o("post",t)(d("/saved-messages",t,a),{body:{message_id:e}})},"sendCompletionMessage",0,c,"sendWorkflowMessage",0,p,"stopChatMessageResponding",0,u,"stopWorkflowMessage",0,m,"submitHumanInputForm",0,(e,t)=>(0,s.postPublic)(`/form/human_input/${e}`,{body:t}),"textToAudioStream",0,(e,t,a,s)=>o("post",t)(e,{body:s,header:a},{needAllResponseContent:!0}),"unpinConversation",0,b,"updateFeedback",0,M])},141696,e=>{"use strict";var t=e.i(367916),a=e.i(935914);let s=async(e,s,r)=>(0,t.get)(`${(0,a.getFlowPrefix)(e)}/${s}/workflows/draft/variables`,{params:{page:r,limit:100}}),r=async(e,t)=>{let{items:a,total:r}=await s(e,t,1);if(r<=100)return a;let n=Math.ceil(r/100),i=[];for(let a=2;a<=n;a++)i.push(s(e,t,a));return(await Promise.all(i)).forEach(e=>{let{items:t}=e;a.push(...t)}),a},n=async(e,s,r)=>{let{items:n}=await (0,t.get)(`${(0,a.getFlowPrefix)(e)}/${s}/workflows/draft/nodes/${r}/variables`);return n};e.s(["fetchAllInspectVars",0,r,"fetchCurrentValueOfConversationVariable",0,e=>{let{url:a,params:s}=e;return(0,t.get)(a,{params:s})},"fetchHumanInputNodeStepRunForm",0,(e,a)=>(0,t.post)(`${e}/preview`,{body:a}),"fetchNodeDefault",0,function(e,a){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,t.get)(`apps/${e}/workflows/default-workflow-block-configs/${a}`,{params:{q:JSON.stringify(s)}})},"fetchNodeInspectVars",0,n,"fetchNodesDefaultConfigs",0,e=>(0,t.get)(e),"fetchPipelineNodeDefault",0,function(e,a){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,t.get)(`rag/pipelines/${e}/workflows/default-workflow-block-configs/${a}`,{params:{q:JSON.stringify(s)}})},"fetchPublishedWorkflow",0,e=>(0,t.get)(e),"fetchWorkflowDraft",0,e=>(0,t.get)(e,{},{silent:!0}),"getIterationSingleNodeRunUrl",0,(e,t,s,r)=>`${(0,a.getFlowPrefix)(e)}/${s}/${t?"advanced-chat/":""}workflows/draft/iteration/nodes/${r}/run`,"getLoopSingleNodeRunUrl",0,(e,t,s,r)=>`${(0,a.getFlowPrefix)(e)}/${s}/${t?"advanced-chat/":""}workflows/draft/loop/nodes/${r}/run`,"singleNodeRun",0,(e,s,r,n)=>(0,t.post)(`${(0,a.getFlowPrefix)(e)}/${s}/workflows/draft/nodes/${r}/run`,{body:n}),"stopWorkflowRun",0,e=>(0,t.post)(e),"submitHumanInputForm",0,(e,a)=>(0,t.post)(`/form/human_input/${e}`,{body:a}),"submitHumanInputNodeStepRunForm",0,(e,a)=>(0,t.post)(`${e}/run`,{body:a}),"syncWorkflowDraft",0,e=>{let{url:a,params:s}=e;return(0,t.post)(a,{body:s},{silent:!0})}])},153935,e=>{"use strict";var t=e.i(586657),a=e.i(137667),s=e.i(447301);class r{mediaSource;audio;audioContext;sourceBuffer;cacheBuffers=[];pauseTimer=null;msgId;msgContent=null;voice=void 0;isLoadData=!1;url;isPublic;callback;constructor(e,t,s,r,n,i){this.audioContext=new AudioContext,this.msgId=s,this.msgContent=r,this.url=e,this.isPublic=t,this.voice=n,this.callback=i;const l=window.ManagedMediaSource||window.MediaSource;l||a.default.notify({message:"Your browser does not support audio streaming, if you are using an iPhone, please update to iOS 17.1 or later.",type:"error"}),this.mediaSource=l?new l:null,this.audio=new Audio,this.setCallback(i),window.MediaSource||(this.audio.disableRemotePlayback=!0,this.audio.controls=!0),this.audio.src=this.mediaSource?URL.createObjectURL(this.mediaSource):"",this.audio.autoplay=!0,this.audioContext.createMediaElementSource(this.audio).connect(this.audioContext.destination),this.listenMediaSource("audio/mpeg")}resetMsgId(e){this.msgId=e}listenMediaSource(e){this.mediaSource?.addEventListener("sourceopen",()=>{this.sourceBuffer||(this.sourceBuffer=this.mediaSource?.addSourceBuffer(e))})}setCallback(e){this.callback=e,e&&(this.audio.addEventListener("ended",()=>{e("ended")},!1),this.audio.addEventListener("paused",()=>{e("paused")},!0),this.audio.addEventListener("loaded",()=>{e("loaded")},!0),this.audio.addEventListener("play",()=>{e("play")},!0),this.audio.addEventListener("timeupdate",()=>{e("timeupdate")},!0),this.audio.addEventListener("loadeddate",()=>{e("loadeddate")},!0),this.audio.addEventListener("canplay",()=>{e("canplay")},!0),this.audio.addEventListener("error",()=>{e("error")},!0))}async loadAudio(){try{let e=await (0,s.textToAudioStream)(this.url,this.isPublic?s.AppSourceType.webApp:s.AppSourceType.installedApp,{content_type:"audio/mpeg"},{message_id:this.msgId,streaming:!0,voice:this.voice,text:this.msgContent});200!==e.status&&(this.isLoadData=!1,this.callback&&this.callback("error"));let t=e.body.getReader();for(;;){let{value:e,done:a}=await t.read();if(a){this.receiveAudioData(e);break}this.receiveAudioData(e)}}catch{this.isLoadData=!1,this.callback?.("error")}}playAudio(){this.isLoadData?("suspended"===this.audioContext.state?this.audioContext.resume().then(e=>{this.audio.play(),this.callback?.("play")}):this.audio.ended&&(this.audio.play(),this.callback?.("play")),this.callback?.("play")):(this.isLoadData=!0,this.loadAudio())}theEndOfStream(){let e=setInterval(()=>{this.sourceBuffer?.updating||(this.mediaSource?.endOfStream(),clearInterval(e))},10)}finishStream(){let e=setInterval(()=>{if(this.cacheBuffers.length||(this.theEndOfStream(),clearInterval(e)),this.cacheBuffers.length&&!this.sourceBuffer?.updating){let e=this.cacheBuffers.shift();this.sourceBuffer?.appendBuffer(e)}},10)}async playAudioWithAudio(e){let a=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!e||!e.length)return void this.finishStream();let s=t.Buffer.from(e,"base64");this.receiveAudioData(new Uint8Array(s)),a&&(this.isLoadData=!0,this.audio.paused?this.audioContext.resume().then(e=>{this.audio.play(),this.callback?.("play")}):this.audio.ended?(this.audio.play(),this.callback?.("play")):this.audio.played||(this.audio.play(),this.callback?.("play")))}pauseAudio(){this.callback?.("paused"),this.audio.pause(),this.audioContext.suspend()}receiveAudioData(e){if(!e)return void this.finishStream();let t=this.byteArrayToArrayBuffer(e);if(!t.byteLength){this.mediaSource?.readyState==="open"&&this.finishStream();return}if(this.sourceBuffer?.updating)this.cacheBuffers.push(t);else if(this.cacheBuffers.length&&!this.sourceBuffer?.updating){this.cacheBuffers.push(t);let e=this.cacheBuffers.shift();this.sourceBuffer?.appendBuffer(e)}else this.sourceBuffer?.appendBuffer(t)}byteArrayToArrayBuffer(e){let t=new ArrayBuffer(e.length);return new Uint8Array(t).set(e),t}}class n{static instance;audioPlayers=null;msgId;static getInstance(){return n.instance||(n.instance=new n,this.instance=n.instance),n.instance}getAudioPlayer(e,t,a,s,n,i){if(this.msgId&&this.msgId===a&&this.audioPlayers)return this.audioPlayers.setCallback(i),this.audioPlayers;if(this.audioPlayers)try{this.audioPlayers.pauseAudio(),this.audioPlayers.cacheBuffers=[],this.audioPlayers.sourceBuffer?.abort()}catch{}return this.msgId=a,this.audioPlayers=new r(e,t,a,s,n,i),this.audioPlayers}resetMsgId(e){this.msgId=e,this.audioPlayers?.resetMsgId(e)}}e.s(["AudioPlayerManager",()=>n],153935)},836755,(e,t,a)=>{e.e,t.exports=function(e,t,a){e=e||{};var s=t.prototype,r={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function n(e,t,a,r){return s.fromToBase(e,t,a,r)}a.en.relativeTime=r,s.fromToBase=function(t,s,n,i,l){for(var o,d,u,c=n.$locale().relativeTime||r,p=e.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],m=p.length,h=0;h0,g<=f.r||!f.r){g<=1&&h>0&&(f=p[h-1]);var b=c[f.l];l&&(g=l(""+g)),d="string"==typeof b?b.replace("%d",g):b(g,s,f.l,u);break}}if(s)return d;var x=u?c.future:c.past;return"function"==typeof x?x(d):x.replace("%s",d)},s.to=function(e,t){return n(e,t,this,!0)},s.from=function(e,t){return n(e,t,this)};var i=function(e){return e.$u?a.utc():a()};s.toNow=function(e){return this.to(i(this),e)},s.fromNow=function(e){return this.from(i(this),e)}}},323963,(e,t,a)=>{e.e,t.exports=function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)}}},702444,(e,t,a)=>{e.e,t.exports={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],a=e%100;return"["+e+(t[(a-20)%10]||t[a]||t[0])+"]"}}},290062,328507,e=>{"use strict";var t,a,s=e.i(676315),r=e.i(323963),n=e.i(836755),i=e.i(751625),l=((t={}).WebApp="webapp",t.Email="email",t.Slack="slack",t.Teams="teams",t.Discord="discord",t),o=((a={}).Primary="primary",a.Default="default",a.Accent="accent",a.Ghost="ghost",a);e.s(["DeliveryMethodType",()=>l,"UserActionButtonType",()=>o],328507),e.i(702444),e.i(48444),e.i(22928),e.i(571058),s.default.extend(i.default),s.default.extend(n.default),s.default.extend(r.default);let d={"en-US":"en","zh-Hans":"zh-cn","ja-JP":"ja","nl-NL":"nl"};e.s(["getButtonStyle",0,e=>e===o.Primary?"primary":e===o.Default?"secondary":e===o.Accent?"secondary-accent":e===o.Ghost?"ghost":void 0,"getRelativeTime",0,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US",a=d[t]??"en";return s.default.utc(e).locale(a).fromNow()},"initializeInputs",0,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a={};return e.forEach(e=>{"text-input"===e.type||"paragraph"===e.type?a[e.output_variable_name]="variable"===e.default.type?t[e.output_variable_name]||"":e.default.value:a[e.output_variable_name]=void 0}),a},"isRelativeTimeSameOrAfter",0,e=>s.default.utc(e).isSameOrAfter((0,s.default)()),"splitByOutputVar",0,e=>e.split(/(\{\{#\$output\.[^#]+#\}\})/g).filter(e=>e.length>0)],290062)},50196,e=>{"use strict";var t=e.i(162115),a=e.i(942347),s=e.i(379415),r=e.i(873517);let n=a.memo(e=>{let{content:n,formInputFields:i,inputs:l,onInputChange:o}=e,d=(0,a.useMemo)(()=>{let e;return(e=/\{\{#\$output\.([^#]+)#\}\}/.exec(n))?e[1]:""},[n]),u=(0,a.useMemo)(()=>i.find(e=>e.output_variable_name===d),[i,d]);return/\{\{#\$output\.[^#]+#\}\}/.test(n)?u?(0,t.jsx)("div",{className:"py-3",children:"paragraph"===u.type&&(0,t.jsx)(r.default,{className:"h-[104px] sm:text-xs",value:l[d],onChange:e=>{o(d,e.target.value)},"data-testid":"content-item-textarea"})}):null:(0,t.jsx)(s.Markdown,{content:n})});e.s(["default",0,n])},910605,e=>{"use strict";var t=e.i(27808);e.s(["FileUploaderInAttachmentWrapper",()=>t.default])},371784,e=>{"use strict";var t=e.i(162115),a=e.i(942347);e.i(816688);var s=e.i(675066),r=e.i(324935);let n=a.memo(e=>{let{value:n,onChange:i,name:l,required:o,readonly:d}=e,{t:u}=(0,s.useTranslation)(),c=(0,a.useCallback)(()=>{i(!n)},[n,i]);return(0,t.jsxs)("div",{className:"flex h-6 items-center gap-2",children:[(0,t.jsx)(r.default,{className:"!h-4 !w-4",checked:!!n,onCheck:c,disabled:d}),(0,t.jsxs)("div",{className:"system-sm-medium flex items-center gap-1 text-text-secondary",children:[l,!o&&(0,t.jsx)("span",{className:"system-xs-regular text-text-tertiary",children:u("panel.optional",{ns:"workflow"})})]})]})});e.s(["default",0,n])},189107,e=>{"use strict";var t=e.i(162115),a=e.i(942347);e.i(816688);var s=e.i(675066);e.i(47690);var r=e.i(223751),r=r;e.i(644896);var n=e.i(541983),i=e.i(391185),l=e.i(648404),o=e.i(330276),d=e.i(151094);let u=/^(https?|ftp):\/\//,c=e=>{let{onUpload:r,disabled:n}=e,{t:i}=(0,s.useTranslation)(),[o,c]=(0,a.useState)(""),p=i("imageUploader.pasteImageLinkInputPlaceholder",{ns:"common"});return(0,t.jsxs)("div",{className:"flex h-8 items-center rounded-lg border border-components-panel-border bg-components-panel-bg pl-1.5 pr-1 shadow-xs",children:[(0,t.jsx)("input",{type:"text",className:"mr-0.5 h-[18px] grow appearance-none bg-transparent px-1 text-[13px] text-text-primary outline-none",value:o,onChange:e=>c(e.target.value),placeholder:p||"","data-testid":"image-link-input"}),(0,t.jsx)(d.default,{variant:"primary",size:"small",disabled:!o||n,onClick:()=>{n||r({type:l.TransferMethod.remote_url,_id:`${Date.now()}`,fileId:"",progress:u.test(o)?0:-1,url:o})},children:i("operation.ok",{ns:"common"})})]})};e.i(793622);var p=e.i(259509),m=e.i(998020),h=e.i(421001),f=e.i(935139);let g=e=>{let{list:r,readonly:n,onRemove:i,onReUpload:o,onImageLinkLoadSuccess:d,onImageLinkLoadError:u}=e,{t:c}=(0,s.useTranslation)(),[g,b]=(0,a.useState)("");return(0,t.jsxs)("div",{className:"flex flex-wrap","data-testid":"image-list",children:[r.map(e=>(0,t.jsxs)("div",{className:"group relative mr-1 rounded-lg border-[0.5px] border-black/5",children:[e.type===l.TransferMethod.local_file&&100!==e.progress&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"absolute inset-0 z-[1] flex items-center justify-center bg-black/30",style:{left:e.progress>-1?`${e.progress}%`:0},children:-1===e.progress&&(0,t.jsx)("span",{className:"i-custom-vender-line-arrows-refresh-ccw-01 h-5 w-5 text-white",onClick:()=>o?.(e._id),"data-testid":"retry-icon"})}),e.progress>-1&&(0,t.jsxs)("span",{className:"absolute left-[50%] top-[50%] z-[1] translate-x-[-50%] translate-y-[-50%] text-sm text-white mix-blend-lighten",children:[e.progress,"%"]})]}),e.type===l.TransferMethod.remote_url&&100!==e.progress&&(0,t.jsxs)("div",{className:` absolute inset-0 z-[1] flex items-center justify-center rounded-lg border ${-1===e.progress?"border-[#DC6803] bg-[#FEF0C7]":"border-transparent bg-black/[0.16]"} `,"data-testid":"image-error-container",children:[e.progress>-1&&(0,t.jsx)("span",{className:"i-ri-loader-2-line h-5 w-5 animate-spin text-white","data-testid":"image-loader"}),-1===e.progress&&(0,t.jsx)(h.default,{popupContent:c("imageUploader.pasteImageLinkInvalid",{ns:"common"}),children:(0,t.jsx)(p.AlertTriangle,{className:"h-4 w-4 text-[#DC6803]"})})]}),(0,t.jsx)("img",{className:"h-16 w-16 cursor-pointer rounded-lg border-[0.5px] border-black/5 object-cover",alt:e.file?.name,onLoad:()=>{e.type===l.TransferMethod.remote_url&&d&&-1!==e.progress&&d(e._id)},onError:()=>{e.type===l.TransferMethod.remote_url&&u&&u(e._id)},src:e.type===l.TransferMethod.remote_url?e.url:e.base64Url,onClick:()=>100===e.progress&&b(e.type===l.TransferMethod.remote_url?e.url:e.base64Url)}),!n&&(0,t.jsx)("button",{type:"button",className:(0,f.cn)("absolute -right-[9px] -top-[9px] z-10 h-[18px] w-[18px] items-center justify-center","rounded-2xl shadow-lg hover:bg-state-base-hover",-1===e.progress?"flex":"hidden group-hover:flex"),onClick:()=>i?.(e._id),"data-testid":"remove-button",children:(0,t.jsx)("span",{className:"i-ri-close-line h-3 w-3 text-text-tertiary"})})]},e._id)),g&&(0,t.jsx)(m.default,{url:g,onCancel:()=>b(""),title:""})]})},b=e=>{let{children:s,onUpload:r,closePopover:n,limit:i,disabled:d}=e,[u,c]=(0,a.useState)(!1),{handleLocalFileUpload:p}=(0,o.useLocalFileUploader)({limit:i,onUpload:r,disabled:d});return(0,t.jsxs)("div",{className:"relative",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[s(u),(0,t.jsx)("input",{"data-testid":"local-file-input",className:"absolute inset-0 block w-full cursor-pointer text-[0] opacity-0 disabled:cursor-not-allowed",onClick:e=>e.target.value="",type:"file",accept:l.ALLOW_FILE_EXTENSIONS.map(e=>`.${e}`).join(","),onChange:e=>{let t=e.target.files?.[0];t&&(p(t),n?.())},disabled:d})]})},x=e=>{let{onUpload:n,disabled:l}=e,{t:o}=(0,s.useTranslation)(),[d,u]=(0,a.useState)(!1);return(0,t.jsxs)(i.PortalToFollowElem,{open:d,onOpenChange:u,placement:"top-start",children:[(0,t.jsx)(i.PortalToFollowElemTrigger,{onClick:()=>{l||u(e=>!e)},children:(0,t.jsxs)("div",{className:` relative flex h-8 items-center justify-center rounded-lg bg-components-button-tertiary-bg px-3 text-xs text-text-tertiary hover:bg-components-button-tertiary-bg-hover ${l?"cursor-not-allowed":"cursor-pointer"} `,children:[(0,t.jsx)(r.default,{className:"mr-2 h-4 w-4"}),o("imageUploader.pasteImageLink",{ns:"common"})]})}),(0,t.jsx)(i.PortalToFollowElemContent,{className:"z-10",children:(0,t.jsx)("div",{className:"w-[320px] rounded-lg border-[0.5px] border-components-panel-border bg-components-panel-bg p-2 shadow-lg",children:(0,t.jsx)(c,{onUpload:e=>{u(!1),n(e)}})})})]})};e.s(["default",0,e=>{let{settings:r,onFilesChange:i,disabled:d}=e,{t:u}=(0,s.useTranslation)(),{files:c,onUpload:p,onRemove:m,onImageLinkLoadError:h,onImageLinkLoadSuccess:f,onReUpload:y}=(0,o.useImageFiles)();(0,a.useEffect)(()=>{i(c)},[c]);let C=(0,t.jsx)(b,{onUpload:p,disabled:c.length>=r.number_limits||d,limit:+r.image_file_size_limit,children:e=>(0,t.jsxs)("div",{className:` flex h-8 cursor-pointer items-center justify-center rounded-lg bg-components-button-tertiary-bg px-3 text-xs text-text-tertiary ${e&&"hover:bg-components-button-tertiary-bg-hover"} `,children:[(0,t.jsx)(n.ImagePlus,{className:"mr-2 h-4 w-4"}),u("imageUploader.uploadFromComputer",{ns:"common"})]})}),v=(0,t.jsx)(x,{onUpload:p,disabled:c.length>=r.number_limits||d});return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"mb-1",children:(0,t.jsx)(g,{list:c,onRemove:m,onReUpload:y,onImageLinkLoadError:h,onImageLinkLoadSuccess:f})}),(0,t.jsx)("div",{className:`grid gap-1 ${2===r.transfer_methods.length?"grid-cols-2":"grid-cols-1"}`,"data-testid":"upload-actions",children:r.transfer_methods.map(e=>e===l.TransferMethod.local_file?(0,t.jsx)(a.Fragment,{children:C},l.TransferMethod.local_file):e===l.TransferMethod.remote_url?(0,t.jsx)(a.Fragment,{children:v},l.TransferMethod.remote_url):null)})]})}],189107)},366892,e=>{"use strict";var t=e.i(162115),a=e.i(942347),s=e.i(935139);let r=a.memo(e=>{let{items:a,value:r,itemClassName:n,itemWrapClassName:i,activeItemClassName:l,onChange:o}=e,d=e=>{let{id:a,name:d,icon:u,extra:c,disabled:p}=e;return(0,t.jsxs)("div",{"data-testid":`tab-header-item-${a}`,className:(0,s.cn)("relative flex cursor-pointer items-center border-b-2 border-transparent pb-2 pt-2.5 system-md-semibold",a===r?(0,s.cn)("border-components-tab-active text-text-primary",l):"text-text-tertiary",p&&"cursor-not-allowed opacity-30",i),onClick:()=>!p&&o(a),children:[u||"",(0,t.jsx)("div",{className:(0,s.cn)("ml-2",n),children:d}),c||""]},a)};return(0,t.jsxs)("div",{"data-testid":"tab-header",className:"flex justify-between",children:[(0,t.jsx)("div",{"data-testid":"tab-header-left",className:"flex space-x-4",children:a.filter(e=>!e.isRight).map(d)}),(0,t.jsx)("div",{"data-testid":"tab-header-right",className:"flex space-x-4",children:a.filter(e=>e.isRight).map(d)})]})});e.s(["default",0,r])},210807,e=>{"use strict";var t=e.i(162115),a=e.i(123980),s=e.i(942347),r=e.i(419874),n=e.i(151094),i=e.i(449980),l=e.i(137667),o=e.i(869931);e.i(816688);var d=e.i(675066);let u=s.memo(()=>{let{t:e}=(0,d.useTranslation)();return(0,t.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center",children:[(0,t.jsx)(o.RiSparklingFill,{className:"h-12 w-12 text-text-empty-state-icon"}),(0,t.jsx)("div",{className:"system-sm-regular mt-2 text-text-quaternary",children:e("generation.noData",{ns:"share"})})]})});var c=e.i(666023),p=e.i(447301);let m=(e,t)=>{switch(t.type){case"reset":return{currentTaskId:null,isStopping:!1};case"setCurrentTaskId":return{...e,currentTaskId:"function"==typeof t.value?t.value(e.currentTaskId):t.value};case"setIsStopping":return{...e,isStopping:"function"==typeof t.value?t.value(e.isStopping):t.value}}};var h=e.i(925521),f=e.i(842090),g=e.i(223314),b=e.i(648404),x=e.i(680884);let y=e=>e.some(e=>e.transfer_method===b.TransferMethod.local_file&&!e.upload_file_id);var C=e.i(805735),v=e.i(390622),w=e.i(367916);let k=()=>({status:v.WorkflowRunningStatus.Running,tracing:[],expand:!1,resultText:""}),j=(e,t)=>(0,C.produce)(e??k(),t),L=(e,t)=>e.node_id===t.node_id&&(e.execution_metadata?.parallel_id===t.execution_metadata?.parallel_id||e.parallel_id===t.execution_metadata?.parallel_id),_=e=>e?.length?e:[[]],S=(e,t)=>j(e,e=>{e.expand=!0,e.tracing.push({...t,details:_(t.details),status:v.NodeRunningStatus.Running,expand:!0})}),N=(e,t)=>j(e,e=>{e.expand=!0;let a=e.tracing.find(e=>L(e,t));a&&(a.details=_(a.details),a.details.push([]))}),I=(e,t)=>j(e,e=>{e.expand=!0;let a=e.tracing.findIndex(e=>L(e,t));a>-1&&(e.tracing[a]={...t,expand:!!t.error})}),M=(e,t)=>j(e,e=>{e.status=t,[v.WorkflowRunningStatus.Stopped,v.WorkflowRunningStatus.Failed].includes(t)&&(e=>{if(!e)return;let t=e=>{[v.NodeRunningStatus.Running,v.NodeRunningStatus.Waiting].includes(e.status)&&(e.status=v.NodeRunningStatus.Stopped),e.details?.forEach(e=>e.forEach(t)),e.retryDetail?.forEach(t),e.parallelDetail?.children?.forEach(t)};e.forEach(t)})(e.tracing)}),A=s.memo(e=>{let{isWorkflow:o,isCallBatchAPI:d,isPC:C,isMobile:_,appSourceType:A,appId:R,isError:F,isShowTextToSpeech:T,promptConfig:D,moreLikeThisEnabled:V,inputs:P,controlSend:E,controlRetry:H,controlStopResponding:$,onShowRes:B,handleSaveMessage:U,taskId:Z,onCompleted:O,visionConfig:W,completionFiles:q,siteInfo:z,onRunStart:J,onRunControlChange:G,hideInlineStopButton:K=!1}=e,{notify:X}=l.default,Q=(e=>{let{appId:t,appSourceType:a,controlStopResponding:r,isWorkflow:n,notify:i,onRunControlChange:l}=e,[o,{setTrue:d,setFalse:u}]=(0,c.useBoolean)(!1),[h,f]=(0,s.useState)(""),g=(0,s.useRef)(""),[b,x]=(0,s.useState)(),y=(0,s.useRef)(void 0),[C,v]=(0,s.useState)(null),[w,k]=(0,s.useState)({rating:null}),[j,L]=(0,s.useState)(0),_=(0,s.useRef)(null),[{currentTaskId:S,isStopping:N},I]=(0,s.useReducer)(m,{currentTaskId:null,isStopping:!1}),M=(0,s.useCallback)(e=>{I({type:"setCurrentTaskId",value:e})},[]),A=(0,s.useCallback)(e=>{I({type:"setIsStopping",value:e})},[]),R=(0,s.useCallback)(e=>{g.current=e,f(e)},[]),F=(0,s.useCallback)(()=>g.current,[]),T=(0,s.useCallback)(e=>{y.current=e,x(e)},[]),D=(0,s.useCallback)(()=>y.current,[]),V=(0,s.useCallback)(()=>{I({type:"reset"}),_.current=null,l?.(null)},[l]),P=(0,s.useCallback)(()=>{v(null),k({rating:null}),R(""),T(void 0),V()},[V,R,T]),E=(0,s.useCallback)(async e=>{await (0,p.updateFeedback)({url:`/messages/${C}/feedbacks`,body:{rating:e.rating,content:e.content}},a,t),k(e)},[t,a,C]),H=(0,s.useCallback)(async()=>{if(S&&!N){A(!0);try{n?await (0,p.stopWorkflowMessage)(t,S,a,t||""):await (0,p.stopChatMessageResponding)(t,S,a,t||""),_.current?.abort()}catch(e){i({type:"error",message:e instanceof Error?e.message:String(e)})}finally{A(!1)}}},[t,a,S,N,n,i,A]),$=(0,s.useCallback)(()=>{L(Date.now())},[]);return(0,s.useEffect)(()=>{let e=()=>{_.current?.abort()};return r&&(e(),u(),V()),e},[r,V,u]),(0,s.useEffect)(()=>{if(l){if(o&&S)return void l({onStop:H,isStopping:N});l(null)}},[S,H,o,N,l]),{abortControllerRef:_,clearMoreLikeThis:$,completionRes:h,controlClearMoreLikeThis:j,currentTaskId:S,feedback:w,getCompletionRes:F,getWorkflowProcessData:D,handleFeedback:E,handleStop:H,isResponding:o,isStopping:N,messageId:C,prepareForNewRun:P,resetRunState:V,setCompletionRes:R,setCurrentTaskId:M,setIsStopping:A,setMessageId:v,setRespondingFalse:u,setRespondingTrue:d,setWorkflowProcessData:T,workflowProcessData:b}})({appId:R,appSourceType:A,controlStopResponding:$,isWorkflow:o,notify:X,onRunControlChange:G}),{handleSend:Y}=(e=>{let{appId:t,appSourceType:a,completionFiles:r,controlRetry:n,controlSend:i,inputs:l,isCallBatchAPI:o,isPC:d,isWorkflow:u,notify:c,onCompleted:m,onRunStart:C,onShowRes:_,promptConfig:A,runState:R,t:F,taskId:T,visionConfig:D}=e,{clearMoreLikeThis:V}=R,P=(0,s.useCallback)(async()=>{if(R.isResponding)return c({type:"info",message:F("errorMessage.waitForResponse",{ns:"appDebug"})}),!1;let e=(e=>{let{completionFiles:t,inputs:a,isCallBatchAPI:s,promptConfig:r,t:n}=e;if(s)return{canSend:!0};let i=r?.prompt_variables;if(!i?.length)return y(t)?{canSend:!1,notification:{type:"info",message:n("errorMessage.waitForFileUpload",{ns:"appDebug"})}}:{canSend:!0};let l=i.filter(e=>{let{key:t,name:a,required:s,type:r}=e;return"boolean"!==r&&"checkbox"!==r&&(!t||!t.trim()||!a||!a.trim()||null==s||s)}),o=l.find(e=>{var t;return null==(t=a[e.key])||("file-list"===e.type?!Array.isArray(t)||0===t.length:!!["string","paragraph","number","json_object","select"].includes(e.type)&&"string"==typeof t&&""===t.trim())})?.name;return o?{canSend:!1,notification:{type:"error",message:n("errorMessage.valueOfVarRequired",{ns:"appDebug",key:o})}}:y(t)?{canSend:!1,notification:{type:"info",message:n("errorMessage.waitForFileUpload",{ns:"appDebug"})}}:{canSend:!0}})({completionFiles:r,inputs:l,isCallBatchAPI:o,promptConfig:A,t:F});if(!e.canSend)return c(e.notification),!1;let s=(e=>{let{completionFiles:t,inputs:a,promptConfig:s,visionConfig:r}=e,n={...(0,x.formatBooleanInputs)(s?.prompt_variables,a)};return s?.prompt_variables.forEach(e=>{let t=n[e.key];if("file"===e.type&&t&&"object"==typeof t&&!Array.isArray(t)){n[e.key]=(0,g.getProcessedFiles)([t])[0];return}"file-list"===e.type&&Array.isArray(t)&&t.length>0&&(n[e.key]=(0,g.getProcessedFiles)(t))}),{inputs:n,...r.enabled&&t.length>0?{files:t.map(e=>e.transfer_method===b.TransferMethod.local_file?{...e,url:""}:e)}:{}}})({completionFiles:r,inputs:l,promptConfig:A,visionConfig:D});R.prepareForNewRun(),d||(_(),C()),R.setRespondingTrue();let n=!1,i=!1,V=[],P="";if((async()=>{await (0,f.sleep)(h.TEXT_GENERATION_TIMEOUT_MS),n||(R.setRespondingFalse(),m(R.getCompletionRes(),T,!1),R.resetRunState(),i=!0)})(),u){let e=(e=>{let{getCompletionRes:t,getWorkflowProcessData:a,isPublicAPI:s,isTimedOut:r,markEnded:n,notify:i,onCompleted:l,resetRunState:o,setCompletionRes:d,setCurrentTaskId:u,setIsStopping:c,setMessageId:p,setRespondingFalse:m,setWorkflowProcessData:h,t:f,taskId:b}=e,x="",y=()=>{m(),o(),l(t(),b,!1),n()},C={isPublicAPI:s,onWorkflowStarted:e=>{let{workflow_run_id:t,task_id:s}=e,r=a();r?.tracing.length?h(j(r,e=>{e.expand=!0,e.status=v.WorkflowRunningStatus.Running})):(x=t,u(s||null),c(!1),h(k()))},onIterationStart:e=>{let{data:t}=e;h(S(a(),t))},onIterationNext:e=>{let{data:t}=e;h(N(a(),t))},onIterationFinish:e=>{let{data:t}=e;h(I(a(),t))},onLoopStart:e=>{let{data:t}=e;h(S(a(),t))},onLoopNext:e=>{let{data:t}=e;h(N(a(),t))},onLoopFinish:e=>{let{data:t}=e;h(I(a(),t))},onNodeStarted:e=>{var t;let{data:s}=e;h((t=a(),s.iteration_id||s.loop_id?t:j(t,e=>{e.expand=!0;let t=e.tracing.findIndex(e=>e.node_id===s.node_id),a={...s,status:v.NodeRunningStatus.Running,expand:!0};t>-1?e.tracing[t]=a:e.tracing.push(a)})))},onNodeFinished:e=>{var t;let{data:s}=e;h((t=a(),s.iteration_id||s.loop_id?t:j(t,e=>{let t=e.tracing.findIndex(e=>L(e,s));t>-1&&(e.tracing[t]={...e.tracing[t].extras?{extras:e.tracing[t].extras}:{},...s,expand:!!s.error})})))},onWorkflowFinished:e=>{let s,u,{data:c}=e;if(r())return void i({type:"warning",message:f("warningMessage.timeoutExceeded",{ns:"appDebug"})});if(c.status===v.WorkflowRunningStatus.Stopped){h(M(a(),v.WorkflowRunningStatus.Stopped)),y();return}if(c.error){i({type:"error",message:c.error}),h(M(a(),v.WorkflowRunningStatus.Failed)),y();return}if(h((s=a(),u=c.outputs,j(s,e=>{e.status=v.WorkflowRunningStatus.Succeeded,e.files=(0,g.getFilesInLogs)(u||[])}))),d((e=>{if(null==e)return"";if("string"==typeof e)return e;try{return JSON.stringify(e)??""}catch{return String(e)}})(c.outputs)),c.outputs){let e=Object.keys(c.outputs);1===e.length&&"string"==typeof c.outputs[e[0]]&&h(j(a(),t=>{t.resultText=c.outputs[e[0]]}))}m(),o(),p(x),l(t(),b,!0),n()},onTextChunk:e=>{let t,{data:{text:s}}=e;h((t=a(),j(t,e=>{e.resultText=`${e.resultText||""}${s}`})))},onTextReplace:e=>{let t,{data:{text:s}}=e;h((t=a(),j(t,e=>{e.resultText=s})))},onHumanInputRequired:e=>{let t,{data:s}=e;h((t=a(),j(t,e=>{if(e.humanInputFormDataList){let t=e.humanInputFormDataList.findIndex(e=>e.node_id===s.node_id);t>-1?e.humanInputFormDataList[t]=s:e.humanInputFormDataList.push(s)}else e.humanInputFormDataList=[s];let t=e.tracing.findIndex(e=>e.node_id===s.node_id);t>-1&&(e.tracing[t].status=v.NodeRunningStatus.Paused)})))},onHumanInputFormFilled:e=>{let t,{data:s}=e;h((t=a(),j(t,e=>{if(e.humanInputFormDataList?.length){let t=e.humanInputFormDataList.findIndex(e=>e.node_id===s.node_id);t>-1&&e.humanInputFormDataList.splice(t,1)}e.humanInputFilledFormDataList?e.humanInputFilledFormDataList.push(s):e.humanInputFilledFormDataList=[s]})))},onHumanInputFormTimeout:e=>{let t,{data:s}=e;h((t=a(),j(t,e=>{if(!e.humanInputFormDataList?.length)return;let t=e.humanInputFormDataList.findIndex(e=>e.node_id===s.node_id);t>-1&&(e.humanInputFormDataList[t].expiration_time=s.expiration_time)})))},onWorkflowPaused:e=>{let{data:t}=e;x=t.workflow_run_id,(0,w.sseGet)(`/workflow/${t.workflow_run_id}/events`,{},C),h(j(a(),e=>{e.expand=!1,e.status=v.WorkflowRunningStatus.Paused}))}};return C})({getCompletionRes:R.getCompletionRes,getWorkflowProcessData:R.getWorkflowProcessData,isPublicAPI:a===p.AppSourceType.webApp,isTimedOut:()=>i,markEnded:()=>{n=!0},notify:c,onCompleted:m,resetRunState:R.resetRunState,setCompletionRes:R.setCompletionRes,setCurrentTaskId:R.setCurrentTaskId,setIsStopping:R.setIsStopping,setMessageId:R.setMessageId,setRespondingFalse:R.setRespondingFalse,setWorkflowProcessData:R.setWorkflowProcessData,t:F,taskId:T});return(0,p.sendWorkflowMessage)(s,e,a,t).catch(e=>{R.setRespondingFalse(),R.resetRunState(),c({type:"error",message:e instanceof Error?e.message:String(e)})}),!0}return(0,p.sendCompletionMessage)(s,{onData:(e,t,a)=>{let{messageId:s,taskId:r}=a;P=s,r&&""!==r.trim()&&R.setCurrentTaskId(e=>e??r),V.push(e),R.setCompletionRes(V.join(""))},onCompleted:()=>{i?c({type:"warning",message:F("warningMessage.timeoutExceeded",{ns:"appDebug"})}):(R.setRespondingFalse(),R.resetRunState(),R.setMessageId(P),m(R.getCompletionRes(),T,!0),n=!0)},onMessageReplace:e=>{V=[e.answer],R.setCompletionRes(V.join(""))},onError:()=>{i?c({type:"warning",message:F("warningMessage.timeoutExceeded",{ns:"appDebug"})}):(R.setRespondingFalse(),R.resetRunState(),m(R.getCompletionRes(),T,!1),n=!0)},getAbortController:e=>{R.abortControllerRef.current=e}},a,t),!0},[t,a,r,l,o,d,u,c,m,C,_,A,R,F,T,D]),E=(0,s.useRef)(P);return(0,s.useEffect)(()=>{E.current=P},[P]),(0,s.useEffect)(()=>{i&&(E.current(),V())},[V,i]),(0,s.useEffect)(()=>{n&&E.current()},[n]),{handleSend:P}})({appId:R,appSourceType:A,completionFiles:q,controlRetry:H,controlSend:E,inputs:P,isCallBatchAPI:d,isPC:C,isWorkflow:o,notify:X,onCompleted:O,onRunStart:J,onShowRes:B,promptConfig:D,runState:Q,t:a.t,taskId:Z,visionConfig:W}),ee=!Q.completionRes,et=()=>(0,t.jsxs)(t.Fragment,{children:[!K&&Q.isResponding&&Q.currentTaskId&&(0,t.jsx)("div",{className:`mb-3 flex ${C?"justify-end":"justify-center"}`,children:(0,t.jsxs)(n.default,{variant:"secondary",disabled:Q.isStopping,onClick:Q.handleStop,children:[Q.isStopping?(0,t.jsx)("span",{"aria-hidden":!0,className:"i-ri-loader-2-line mr-[5px] h-3.5 w-3.5 animate-spin"}):(0,t.jsx)("span",{"aria-hidden":!0,className:"i-ri-stop-circle-fill mr-[5px] h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-xs font-normal",children:(0,a.t)("operation.stopResponding",{ns:"appDebug"})})]})}),(0,t.jsx)(r.default,{isWorkflow:o,workflowProcessData:Q.workflowProcessData,isError:F,onRetry:Y,content:Q.completionRes,messageId:Q.messageId,isInWebApp:!0,moreLikeThis:V,onFeedback:Q.handleFeedback,feedback:Q.feedback,onSave:U,isMobile:_,appSourceType:A,installedAppId:R,isLoading:!1,taskId:d?Z<10?`0${Z}`:`${Z}`:void 0,controlClearMoreLikeThis:Q.controlClearMoreLikeThis,isShowTextToSpeech:T,hideProcessDetail:!0,siteInfo:z})]});return(0,t.jsxs)(t.Fragment,{children:[!d&&!o&&(Q.isResponding&&!Q.completionRes?(0,t.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,t.jsx)(i.default,{type:"area"})}):(0,t.jsx)(t.Fragment,{children:ee?(0,t.jsx)(u,{}):et()})),!d&&o&&(Q.isResponding&&!Q.workflowProcessData?(0,t.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,t.jsx)(i.default,{type:"area"})}):Q.workflowProcessData?et():(0,t.jsx)(u,{})),d&&et()]})});e.s(["default",0,A],210807)},874914,e=>{"use strict";var t,a=((t={}).pending="pending",t.running="running",t.completed="completed",t.failed="failed",t);e.s(["TaskStatus",()=>a])},727163,e=>{"use strict";var t=e.i(162115),a=e.i(869931),s=e.i(942347);e.i(816688);var r=e.i(675066),n=e.i(151094);e.i(237855);var i=e.i(910605);e.i(992280);var l=e.i(926122),l=l,o=e.i(189107),d=e.i(291631),u=e.i(299951),c=e.i(873517),p=e.i(371784),m=e.i(481162),h=e.i(955371),f=e.i(271743),g=e.i(935139);let b=s.memo(e=>{let{promptConfig:b,inputs:x,inputsRef:y,onInputsChange:C,onSend:v,visionConfig:w,onVisionFilesChange:k,runControl:j}=e,{t:L}=(0,r.useTranslation)(),_=(0,f.default)()===f.MediaType.pc,[S,N]=(0,s.useState)(!1),I=!!j,M=L("generation.stopRun",{ns:"share",defaultValue:"Stop Run"}),A=(0,s.useCallback)(e=>{I&&(e.preventDefault(),j?.onStop?.())},[I,j]),R=(0,s.useCallback)(e=>{C(e),y.current=e},[C,y]);return(0,s.useEffect)(()=>{if(S)return;let e={};b.prompt_variables.forEach(t=>{"select"===t.type?e[t.key]=t.default:"string"===t.type||"paragraph"===t.type?e[t.key]=t.default||"":"number"===t.type?e[t.key]=t.default??"":"checkbox"===t.type?e[t.key]=t.default||!1:"file"===t.type?e[t.key]=void 0:"file-list"===t.type?e[t.key]=[]:e[t.key]=void 0}),C(e),N(!0)},[b.prompt_variables,C]),(0,t.jsx)("div",{className:"",children:(0,t.jsx)("section",{children:(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),v()},children:[null!=x&&0!==Object.keys(x).length&&S?b.prompt_variables.filter(e=>!0!==e.hide).map(e=>(0,t.jsxs)("div",{className:"mt-4 w-full",children:["checkbox"!==e.type&&(0,t.jsxs)("div",{className:"system-md-semibold flex h-6 items-center gap-1 text-text-secondary",children:[(0,t.jsx)("div",{className:"truncate",children:e.name}),!e.required&&(0,t.jsx)("span",{className:"system-xs-regular text-text-tertiary",children:L("panel.optional",{ns:"workflow"})})]}),(0,t.jsxs)("div",{className:"mt-1",children:["select"===e.type&&(0,t.jsx)(u.default,{className:"w-full",defaultValue:x[e.key],onSelect:t=>{R({...y.current,[e.key]:t.value})},items:(e.options||[]).map(e=>({name:e,value:e})),allowSearch:!1}),"string"===e.type&&(0,t.jsx)(d.default,{type:"text",placeholder:e.name,value:x[e.key],onChange:t=>{R({...y.current,[e.key]:t.target.value})},maxLength:e.max_length}),"paragraph"===e.type&&(0,t.jsx)(c.default,{className:"h-[104px] sm:text-xs",placeholder:e.name,value:x[e.key],onChange:t=>{R({...y.current,[e.key]:t.target.value})}}),"number"===e.type&&(0,t.jsx)(d.default,{type:"number",placeholder:e.name,value:x[e.key],onChange:t=>{R({...y.current,[e.key]:t.target.value})}}),"checkbox"===e.type&&(0,t.jsx)(p.default,{name:e.name||e.key,value:!!x[e.key],required:e.required,onChange:t=>{R({...y.current,[e.key]:t})}}),"file"===e.type&&(0,t.jsx)(i.FileUploaderInAttachmentWrapper,{value:x[e.key]&&"object"==typeof x[e.key]&&!Array.isArray(x[e.key])?[x[e.key]]:[],onChange:t=>{R({...y.current,[e.key]:t[0]})},fileConfig:{...e.config,fileUploadConfig:w.fileUploadConfig}}),"file-list"===e.type&&(0,t.jsx)(i.FileUploaderInAttachmentWrapper,{value:Array.isArray(x[e.key])?x[e.key]:[],onChange:t=>{R({...y.current,[e.key]:t})},fileConfig:{...e.config,fileUploadConfig:w.fileUploadConfig}}),"json_object"===e.type&&(0,t.jsx)(m.default,{language:h.CodeLanguage.json,value:x[e.key],onChange:t=>{R({...y.current,[e.key]:t})},noWrapper:!0,className:"bg h-[80px] overflow-y-auto rounded-[10px] bg-components-input-bg-normal p-1",placeholder:(0,t.jsx)("div",{className:"whitespace-pre",children:"string"==typeof e.json_schema?e.json_schema:JSON.stringify(e.json_schema||"",null,2)})})]})]},e.key)):null,w?.enabled&&(0,t.jsxs)("div",{className:"mt-4 w-full",children:[(0,t.jsx)("div",{className:"system-md-semibold flex h-6 items-center text-text-secondary",children:L("imageUploader.imageUpload",{ns:"common"})}),(0,t.jsx)("div",{className:"mt-1",children:(0,t.jsx)(o.default,{settings:w,onFilesChange:e=>k(e.filter(e=>-1!==e.progress).map(e=>({type:"image",transfer_method:e.type,url:e.url,upload_file_id:e.fileId})))})})]}),(0,t.jsx)("div",{className:"mb-3 mt-6 w-full",children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)(n.default,{onClick:()=>{let e={};b.prompt_variables.forEach(t=>{"string"===t.type||"paragraph"===t.type||"number"===t.type?e[t.key]="":"checkbox"===t.type?e[t.key]=!1:e[t.key]=void 0}),C(e)},disabled:!1,children:(0,t.jsx)("span",{className:"text-[13px]",children:L("operation.clear",{ns:"common"})})}),(0,t.jsx)(n.default,{className:(0,g.cn)(!_&&"grow"),type:I?"button":"submit",variant:I?"secondary":"primary",disabled:I&&j?.isStopping,onClick:A,"data-testid":I?"stop-button":"run-button",children:I?(0,t.jsxs)(t.Fragment,{children:[j?.isStopping?(0,t.jsx)(a.RiLoader2Line,{className:"mr-1 h-4 w-4 shrink-0 animate-spin","aria-hidden":"true"}):(0,t.jsx)(l.default,{className:"mr-1 h-4 w-4 shrink-0","aria-hidden":"true"}),(0,t.jsx)("span",{className:"text-[13px]",children:M})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.RiPlayLargeLine,{className:"mr-1 h-4 w-4 shrink-0","aria-hidden":"true"}),(0,t.jsx)("span",{className:"text-[13px]",children:L("generation.run",{ns:"share"})})]})})]})})]})})})});e.s(["default",0,b],727163)}]);