PageSourceSearch

https://hix.ai/cdn/_next/static/chunks/3f90g_ywcenb_.js?dpl=caeb3f7576cede78962678e87458b3b879430978

js hix.ai collected 2026-10-01 11:30:20 UTC 317,906 bytes, 301 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,708478,672112,993772,82262,969127,468988,754280,801199,477136,619564,250475,571740,543010,26509,401122,457590,248722,301283,628857,188631,713772,844572,628269,2292,157091,563986,931208,162147,296426,7419,603944,627997,185029,831628,74428,405415,775678,e=>{"use strict";var t=e.i(659638),i=e.i(752844);e.s(["useChatAguiSceneInputContribution",0,function(e,a){let n=(0,i.useOptionalChatAguiFeatureModules)();return(0,t.useMemo)(()=>(function(e,t,i){for(let a of e){let e=a.chatInput?.sceneInput;if(!e||e.chatType!==t)continue;if(!e.composer&&!e.footer)throw Error(`Scene input "${a.key}" must register composer or footer`);let n=e.composer&&(!e.composer.containerTypes||e.composer.containerTypes.includes(i))?e.composer:void 0,r=e.footer&&(!e.footer.containerTypes||e.footer.containerTypes.includes(i))?e.footer:void 0;if(n||r)return{chatType:e.chatType,...n?{composer:n}:{},...r?{footer:r}:{}}}})(n,e,a),[e,a,n])}],708478);var a=e.i(335390),n=e.i(110258),r=e.i(881598),l=e.i(729888),o=e.i(588775),s=e.i(90041),d=e.i(63919);function u(e){return!!e&&"object"==typeof e&&"configType"in e&&e.configType===d.EGenerationConfigType.Ref2VideoV2}function c(e){return u(e)?{aspectRatio:e.aspectRatio,numOutputs:e.videoNum,length:e.duration,resolution:e.resolution,mode:e.mode,quality:e.quality,modelName:e.videoModel,variant:"ingredients"}:{aspectRatio:e.aspectRatio,numOutputs:e.numOutputs,length:e.length,resolution:e.resolution,mode:e.mode,quality:e.quality,style:e.style,modelName:e.modelName,variant:e.variant||void 0}}e.s(["useFormValueManager",0,function(){let{setStorage:e}=(0,s.useUpdateMediaModelUrl)(),t=(0,l.useChatStore)(e=>e.getSetFunction());return{saveFormValue:(0,n.useMemoizedFn)((i,n)=>{(0,a.match)(n).with(r.EAgentType.AI_IMAGE,()=>{let{aspectRatio:a,numOutputs:n,style:r,modelName:l,resolution:s,quality:d,mode:u}=i;t(e=>{e.formValueMap[o.EChatInputType.AI_IMAGE]={aspectRatio:a,numOutputs:n,resolution:s,quality:d,mode:u,style:r,modelName:l}}),l&&e(o.EChatInputType.AI_IMAGE,l)}).with(r.EAgentType.AI_VIDEO,()=>{let a=c(i);t(e=>{e.formValueMap[o.EChatInputType.AI_VIDEO]=a}),a.modelName&&e(o.EChatInputType.AI_VIDEO,a.modelName)}).with(r.EAgentType.AI_WRITER,()=>{let{output_format:e,text_length:a}=i;t(t=>{t.formValueMap[o.EChatInputType.AI_WRITER]={output_format:e,text_length:a}})}).with(r.EAgentType.AI_SLIDES,()=>{let{slidesAspectRatio:e,slidesMode:a}=i;t(t=>{t.formValueMap[o.EChatInputType.AI_SLIDES]={slidesMode:a,slidesAspectRatio:e}})}).otherwise(()=>{})})}}],672112);var m=e.i(452234),p=e.i(122633),f=e.i(2362);e.i(17335);var h=e.i(508861),g=e.i(408224);e.s(["useWriterSlidesDefaultValues",0,function(e,i={}){let{enabled:a=!0,restoreWriterWithoutChatId:n=!0}=i,r=(0,h.useChatContainerContext)(e=>e.chatType),s=(0,h.useChatContainerContext)(e=>e.chatId),d=(0,f.useLatestSearchParams)(),u=d?.get("slidesMode"),c=(0,l.useChatStore)(e=>{if(!s)return g.DEFAULT_WRITER_FORM_VALUES;let t=e.historyList.find(e=>e.id===s)?.extra_data;return(0,g.resolveWriterFormValues)([e.chatInfoByGetChatDetail?.extra_data,t,e.formValueMap[o.EChatInputType.AI_WRITER]])}),x=(0,l.useChatStore)(e=>{if(!s)return m.DEFAULT_SLIDES_FORM_VALUES;let t=e.historyList.find(e=>e.id===s)?.extra_data,i=e.chatInfoByGetChatDetail,a=i?.id===s;return a||void 0!==t?(0,m.resolveSlidesFormValues)([a?i?.extra_data:void 0,t]):(0,m.resolveSlidesFormValues)([e.formValueMap[o.EChatInputType.AI_SLIDES]])}),y=(0,t.useMemo)(()=>(0,m.resolveHomeSlidesFormValuesFromSlidesModeQuery)(u),[u]);(0,t.useEffect)(()=>{if(!a)return;if(r===o.EChatInputType.AI_WRITER){if(!s&&!n)return;e.setFieldsValue(c);return}if(r!==o.EChatInputType.AI_SLIDES)return;let t=function(){try{return(0,m.resolveSlidesAspectRatio)(window.localStorage.getItem(p.HIX_CHAT_KEYS.SLIDES_ASPECT_RATIO))}catch{return(0,m.resolveSlidesAspectRatio)(void 0)}}();s?e.setFieldsValue({...x,slidesAspectRatio:x.slidesAspectRatio??t}):e.setFieldsValue({...y,slidesAspectRatio:t})},[r,a,e,s,y,x,c,n])}],993772);var x=e.i(826253);let y=[o.EChatInputType.GENERIC,o.EChatInputType.GENERIC_IMAGE,o.EChatInputType.GENERIC_VIDEO,o.EChatInputType.DEEP_RESEARCH,o.EChatInputType.AI_SLIDES,o.EChatInputType.AI_WRITER];e.s(["useThinkingDefaultValue",0,function(e,i={}){let{enabled:a=!0}=i,n=(0,h.useChatContainerContext)(e=>e.chatType),r=(0,h.useChatContainerContext)(e=>e.chatId),o=y.includes(n),s=(0,l.useChatStore)(e=>null!=r?e.generalAgentMessageMetaByChatId[r]?.thinking:void 0),d=(0,t.useRef)(null),u=`${n}:${r??"new"}`;(0,x.useIsomorphicLayoutEffect)(()=>
1{if(!a||!o){d.current=null;return}if("boolean"==typeof s){e.getFieldValue("thinking")!==s&&e.setFieldValue("thinking",s),d.current=null;return}if(d.current===u)return;let t=window.localStorage.getItem(p.HIX_CHAT_KEYS.THINKING_MODE)??!1;e.setFieldValue("thinking","true"===t),d.current=u},[a,e,s,u,o])}],82262);var I=e.i(986721),C=e.i(793995);e.i(874967);var E=e.i(11460),v=e.i(696524);e.i(243046);var _=e.i(939189),b=e.i(130631),T=e.i(305412),N=e.i(386948),M=e.i(736373),S=e.i(811169),k=e.i(854655);e.i(94823);var A=e.i(383488),w=e.i(661412),j=e.i(902667),F=e.i(774914),R=e.i(782228),L=e.i(37097),V=e.i(908918),D=e.i(165621),O=e.i(267276);e.i(697036);var P=e.i(577107),z=e.i(648320),U=e.i(673533),G=e.i(644019),H=e.i(149598),B=e.i(729497),W=e.i(918234),$=e.i(281541),q=e.i(274191),K=e.i(758304),X=e.i(109519),Y=e.i(21216),Q=e.i(647878),J=e.i(696650);function Z(e){let{similarInfo:i}=(0,J.useFormSimilarState)(e),{projectId:a}=(0,w.useCurrentProjectScope)(),n=(0,h.useChatContainerContext)(e=>e.chatId),r=a&&!i?.share_id?i?.reference_id??null:null,l=(0,t.useMemo)(()=>r?[r]:[],[r]),o=(0,Q.useChatReferenceEnables)({chatIds:l,scopeId:a?`draft:${a}:${n??""}`:null});return{referenceId:r,isDeleted:!!(r&&o?.[r]===!1)}}e.s(["useProjectChatReference",0,Z],969127);var ee=e.i(32696),et=e.i(166101),ei=e.i(584526),ea=e.i(483666),en=e.i(102642);let er=(0,t.memo)(function({open:e,title:t,description:i,actionLabel:a,onCancel:n,onConfirm:r,afterClose:l}){return(0,et.jsx)(en.default,{width:460,centered:!0,destroyOnClose:!0,closable:!0,maskClosable:!0,title:null,footer:null,open:e,headerClassName:"!mb-0 !hidden !p-0",contentClassName:"!px-6 !py-5",bodyClassName:"!p-0",onCancel:n,afterClose:l,children:(0,et.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,et.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,et.jsx)("div",{className:"pr-8 text-base font-medium leading-6 text-f-text",children:t}),(0,et.jsx)("div",{className:"text-sm leading-5 text-f-text-secondary",children:i})]}),(0,et.jsx)(ea.default,{color:"modalConfirm",block:!0,size:"sm",rounded:"md",className:"h-8 font-medium",onClick:r,children:a})]})})});var el=e.i(43676),eo=e.i(74751),es=e.i(782046),ed=e.i(325528),eu=e.i(559228),ec=e.i(959021),em=e.i(554690),ep=e.i(16865),ef=e.i(462797),eh=e.i(634585),eg=e.i(556303),ex=e.i(303566);function ey(e){return e.isStartEndFrame&&e.imageCount>2}function eI(e){return e.withImageTail||"frames"===e.variant||e.files.some(e=>2===e.frame)}e.s(["isStartEndFrameImageOverflow",0,ey,"isStartEndFrameMode",0,eI],468988);function eC(e){let t=0,i=0,a=0,n=e.reduce((e,n)=>{if(!n.url)return e;let r=e.length+1;if(n.webPage)return e.push({type:"link",name:n.webPage.title.slice(0,64),link:n.webPage.url,order:r}),e;if((0,em.isImageFile)(n))return t+=1,e.push({type:"image",name:`Image ${t}`,image:n.url,order:r}),e;if((0,em.isVideoFile)(n))return i+=1,e.push({type:"video",name:`Video ${i}`,video:n.url,order:r}),e;if((0,em.isAudioFile)(n))return a+=1,e.push({type:"audio",name:`Audio ${a}`,audio:n.url,order:r}),e;let l=n.name.split(".").pop()?.toLowerCase(),o=eh.WAN_V3_0_DOC_FORMATS.find(e=>e===l);return o&&e.push({type:"file",name:n.name.slice(0,64),file:n.url,format:o,order:r}),e},[]);return n.length?n:void 0}function eE(e,t){if(!("modelName"in e)||!e.modelName||!Object.values(d.EVideoModel).includes(e.modelName))return null;if((0,eg.isOmniReferenceModeByChatType)(o.EChatInputType.AI_VIDEO,e.modelName,"variant"in e?e.variant:void 0)){let i=eC(t);return i?function(e,t){if((0,eg.isHixChatWanV3Point0Model)(e.modelName)){let i=t.some(e=>"file"===e.type||"link"===e.type);return{configType:d.EGenerationConfigType.Ref2VideoV2,videoModel:e.modelName,mode:e.mode,quality:e.quality,prompt:e.inputValue,duration:e.length,resolution:e.resolution,aspectRatio:e.aspectRatio,videoNum:e.numOutputs||1,refs:t,generateAudio:!0,...i?{enable_thinking:!0}:{}}}let i=t.filter(e=>"file"!==e.type&&"link"!==e.type);if(e.modelName===d.EVideoModel.GEMINI_OMNI_1_1_FLASH)return{configType:d.EGenerationConfigType.Ref2VideoV2,videoModel:d.EVideoModel.GEMINI_OMNI_1_1_FLASH,mode:e.mode,quality:e.quality,prompt:e.inputValue,duration:e.length,resolution:e.resolution,aspectRatio:e.aspectRatio,videoNum:e.numOutputs||1,refs:i};if(e.modelName===d.EVideoModel.MINIMAX_HAILUO_03)return{configType:d.EGenerationConfigType.Ref2VideoV2,videoModel:d.EVideoModel.MINIMAX_HAILUO_03,mode:e.mode,quality:e.quality,prompt:e.inputValue,duration:e.length,resolution:e.resolution,aspectRatio:e.aspectRatio,videoNum:e.numOutputs||1,refs:i};if(e.modelName===d.EVideoModel.SEEDANCE_2_5)return{configType:d.EGenerationConfigType.Ref2VideoV2,videoModel:d.EVideoModel.SEEDANCE_2_5,mode:e.mode,quality:e.quality,prompt:e.inputValue,duration:e.length,resolution:e.resolution,aspectRatio:e.aspectRatio,videoNum:e.numOutputs||1,refs:i,generateAudio:!0};let a=e.resolution,n=!!i.find(e=>"video"===e.type);return{configType:d.EGenerationConfigType.Ref2VideoV2,videoModel:e.modelName,mode:e.mode,quality:e.quality,prompt:e.inputValue,duration:e.length,resolution:a,aspectRatio:e.aspectRatio,videoNum:e.numOutputs||1,refs:i,generateAudio:(e.modelName!==d.EVideoModel.KLING_V3_OMNI||!n)&&ex.GENERATE_AUDIO_MODELS.includes(e.modelName)}}(e,i):null}let i=t.find(e=>(0,em.isVideoFile)(e));if(!i||e?.variant==="ingredients"){let i=t.filter(e=>!!e.url).filter(e=>(0,em.isImageFile)(e));return ey({imageCount:i.length,isStartEndFrame:eI({files:i,variant:e.variant,withImageTail:!1})})?null:{modelName:e.modelName,aspectRatio:e.aspectRatio,length:e.length,numOutputs:e.numOutputs||1,mode:e.mode,quality:e.quality,prompt:e.inputValue,templateId:e?.templateInfo?.templateId,templateCode:e?.templateInfo?.templateCode,entryCode:e?.entryCode,images:e?.modelName!==d.EVideoModel.VIDEO_AGENT&&i.length?i.map(e=>e.url):void 0,style:e?.style,resolution:e?.resolution,imageTail:i.find(e=>2===e.frame)?.url,variant:e?.variant==="text"?void 0:e?.variant,...ex.GENERATE_AUDIO_MODELS.includes(e.modelName)?{generateAudio:!0}:{}}}return{modelName:e.modelName,video:i.url,style:e?.style,numOutputs:e.numOutputs||1,prompt:e.inputValue}}e.s(["getOmniReferenceRefs",0,eC,"videoTransformToPayload",0,eE],754280);var ev=e.i(934444),e_=e.i(577193),eb=e.i(985589),eT=e.i(870844),eN=e.i(80683),eM=e.i(236706),eS=e.i(622983),ek=e.i(979506);function eA(e){let{chatId:t,containerType:i}=(0,h.useChatContainerContext)(e=>({chatId:e.chatId,containerType:e.containerType})),a=(0,l.useChatStore)(e),n=(0,ek.useSlidesPptDataSource)(t=>
1({activeSessionId:t.pptLiveBuffer?.sessionId??t.pptSnapshotBuffer?.sessionId??t.ownerSessionId,activePptScopeKey:t.activePptScopeKey,visiblePreviewScopeKey:t.visiblePreviewScopeKey,value:e(t)}),eS.shallow),r=i===o.EChatContainerType.SHARE||i===o.EChatContainerType.SHARE_FILE,s=n.activeSessionId===(t??void 0),d=!!n.visiblePreviewScopeKey&&n.visiblePreviewScopeKey===n.activePptScopeKey;return!r&&d&&s?n.value:a}e.s(["useChatPptCanvasDataSource",0,eA],801199);var ew=e.i(22451),ej=e.i(384285),eF=e.i(556560);function eR(e){if(!e)return;let t=Number(e.x),i=Number(e.y),a=Number(e.width),n=Number(e.height);if(Number.isFinite(t)&&Number.isFinite(i)&&Number.isFinite(a)&&Number.isFinite(n)&&!(a<=0)&&!(n<=0))return{x_min:Math.round(t),y_min:Math.round(i),x_max:Math.round(t+a),y_max:Math.round(i+n)}}function eL(e){switch(e.type){case"html_element":return(0,eF.pick)(e,["type","artifact_id","page_order","tag","text","outer_html","thumbnail_url","reference_tag","instruction"]);case"ocr_text":return(0,eF.pick)(e,["type","artifact_id","canvas_node_id","page_order","text","bbox","reference_tag","instruction","replacement_text"]);case"comment":return(0,eF.pick)(e,["type","artifact_id","canvas_node_id","page_order","region","instruction"]);case"artifact":return(0,eF.pick)(e,["type","artifact_id","canvas_node_id"]);case"storyboard_text":switch(e.section){case"script":return{type:"storyboard_text",artifact_id:e.artifact_id,section:"script",..."string"==typeof e.text?{text:e.text}:{}};case"all":return{type:"storyboard_text",artifact_id:e.artifact_id,section:"all",..."string"==typeof e.text?{text:e.text}:{}};case"shot":return{type:"storyboard_text",artifact_id:e.artifact_id,section:"shot",shot_index:e.shot_index,..."string"==typeof e.text?{text:e.text}:{}};default:return e}case"storyboard_media":return{type:"storyboard_media",artifact_id:e.artifact_id,child_artifact_id:e.child_artifact_id};case"storyboard_node":switch(e.node_kind){case"subject":return{type:"storyboard_node",artifact_id:e.artifact_id,node_kind:"subject",subject_id:e.subject_id,reference_tag:"retry"};case"scene_reference":return{type:"storyboard_node",artifact_id:e.artifact_id,node_kind:"scene_reference",shot_index:e.shot_index,reference_tag:"retry"};case"shot_preview":return{type:"storyboard_node",artifact_id:e.artifact_id,node_kind:"shot_preview",shot_index:e.shot_index,reference_tag:"retry"};case"bgm":return{type:"storyboard_node",artifact_id:e.artifact_id,node_kind:"bgm",reference_tag:"retry"};default:return e}default:return e}}e.i(658475);var eV=e.i(437132);function eD(e){return{thinking:!0===e.thinking}}var eO=e.i(660068),eP=e.i(858980),ez=e.i(708763),eU=e.i(857799),eG=e.i(582458),eH=e.i(184885),eB=e.i(372522),eW=e.i(98902),e$=e.i(157139),eq=e.i(508652),eK=e.i(825228),eX=e.i(100323);let eY=new Set(Object.values(eU.EUpscaleScale));var eQ=e.i(381009);class eJ extends Error{reason;constructor(e){super(e),this.name="PrepareGenericEraseReferenceError",this.reason=e}}async function eZ({imageUrl:e,maskBase64:t,signal:i,uploadAction:a}){let n,r,l,o;if(!e||!t)throw new eJ("missing-params");let s=(o=(l=(r=(0,em.resolveBasename)(e)||"image").lastIndexOf("."))>0?r.slice(0,l):r,`${o}-erase-selection.png`);try{n=await (0,eQ.createImageEraseSelectionPreviewBlob)({imageUrl:e,maskBase64:t})}catch{throw new eJ("preview-failed")}let d=new File([n],s,{type:"image/png"}),u="";try{let{url:e}=await a({file:d,filename:d.name,type:"image",signal:i});u=e}catch{if(i?.aborted)throw new eJ("aborted");throw new eJ("upload-failed")}return{...(0,em.getFileItem)({name:s,url:u}),size:d.size,lastModified:d.lastModified,type:"image/png"}}var e0=e.i(547123),e1=e.i(586618),e2=e.i(864894),e8=e.i(410408);function e5(){let{i18n:e,_:i}=(0,ei.useLingui)(),{modelList:a}=(0,l.useChatStore)(e=>({modelList:e.modelListMap[o.EChatInputType.AI_CHAT]}));return{replaceDeprecatedBot:(0,t.useCallback)(e=>{let t=ex.TEXT_MODEL_REPLACE_MAP[e?.name||""];return t?a.find(e=>e.name===t):null},[a]),showDeprecatedToast:(0,t.useCallback)(t=>{let i=t?.name;t&&i&&e8.message.warning(e._({id:"flPi50",values:{name:i}}))},[i])}}e.s(["useReplaceDeprecatedBot",0,e5],477136);var e4=e.i(1916);
1e.s(["default",0,function({form:e,onBeforeSubmit:s,onSaveFormValue:f,onBeforeFetch:x}){let{setInputValue:y,chatType:Q}=(0,Y.useChatInput)(),{referenceId:J,isDeleted:eh}=Z(e),{chatDetail:eg,selectedBotIds:ey,updateState:eI}=(0,l.useChatStore)(e=>({chatDetail:e.chatDetail,selectedBotIds:e.selectedBotIds,updateState:e.updateState})),[eC,ek]=(0,t.useState)(!1),{chatId:eF,agentMode:eQ}=(0,h.useChatContainerContext)(e=>({chatId:e.chatId??null,agentMode:e.agentMode??"legacy"})),{isSignIn:e8,restrictMultiModelChat:e6}=function(){let{status:e}=(0,q.useAuthState)(),{plan:i}=(0,t.useContext)($.SubProductLayoutContext),a={isActiveSub:i?.isActiveSub===!0,isSignIn:"signed-in"===e,isSignedOut:"signed-out"===e,planLoading:i?.loading===!0};return{isSignIn:a.isSignIn,restrictMultiModelChat:(0,K.shouldRestrictFreeUserMultiModelChat)(a)}}(),{ensureHixChatLogin:e3}=(0,M.useEnsureHixChatLogin)(),{showMultiModelPaywall:e7,multiModelPaywallGuide:e9}=function(){let{i18n:e,_:i}=(0,ei.useLingui)(),{showQuotaExceededModal:a}=(0,el.useQuotaExceededModalAction)(),{setAgentChatTrackStorage:r}=(0,eo.useStorageTrackAgentChat)(),{showPaywallGuide:l,paywallGuide:o}=function({title:e,description:i,actionLabel:a,onConfirm:r}){let[l,o]=(0,t.useState)(!1),s=(0,t.useRef)(!1),d=(0,t.useRef)(r);d.current=r;let u=(0,n.useMemoizedFn)(()=>{s.current=!1,o(!0)}),c=(0,n.useMemoizedFn)(()=>{s.current=!1,o(!1)}),m=(0,n.useMemoizedFn)(()=>{s.current=!0,o(!1)}),p=(0,n.useMemoizedFn)(()=>{s.current&&(s.current=!1,d.current())});return{showPaywallGuide:u,paywallGuide:(0,et.jsx)(er,{open:l,title:e,description:i,actionLabel:a,onCancel:c,onConfirm:m,afterClose:p})}}({title:(void 0)??e._({id:"TTA-0t"}),description:(void 0)??e._({id:"rfcvXV"}),actionLabel:(void 0)??e._({id:"2ZBPvc"}),onConfirm:(void 0)??a});return{showMultiModelPaywall:(0,n.useMemoizedFn)(()=>{r({location:"aichat_multi_model"}),l()}),multiModelPaywallGuide:o}}(),{persistWriterFormValue:te}=function({chatId:e,chatType:t,onSaveFormValue:i}){return{persistWriterFormValue:(0,n.useMemoizedFn)(a=>{a&&[o.EChatInputType.AI_WRITER,o.EChatInputType.AI_SLIDES].includes(t)&&(i(a,t===o.EChatInputType.AI_WRITER?r.EAgentType.AI_WRITER:r.EAgentType.AI_SLIDES),e&&l.chatStoreInstance.getState().getSetFunction()(e=>{let i=(0,es.mergeAguiThreadExtraData)(e.chatInfoByGetChatDetail?.extra_data,a);t===o.EChatInputType.AI_SLIDES&&(0,E.isObjectRecord)(i)&&i.entryProfile===_.EGeneralSubType.SLIDES&&!("slidesMode"in a)&&delete i.slidesMode,e.chatInfoByGetChatDetail&&(e.chatInfoByGetChatDetail.extra_data=i)}))})}}({chatId:eF,chatType:Q,onSaveFormValue:f}),{run:tt,cancel:ti}=(0,I.useDebounceFn)(e=>{void 0!==e.inputValue&&y(e.inputValue,"chat")},{wait:300}),ta=(0,n.useMemoizedFn)(e=>{if(tt(e),Q!==o.EChatInputType.AI_WRITER||!(0,E.isObjectRecord)(e))return;let t={};Object.values(r.EWriterOutputFormat).includes(e.output_format)&&(t.output_format=e.output_format),Object.values(r.EWriterTextLength).includes(e.text_length)&&(t.text_length=e.text_length),Object.keys(t).length>0&&te(t)}),{handleReset:tn,isSimilarStyle:tr,clearSimilar:tl}=function({form:e,onBeforeSubmit:i,cancelDebounce:s}){let{chatType:m}=(0,h.useChatContainerContext)(e=>({chatType:e.chatType})),{clearFileList:p}=(0,b.useUploadFileList)(),{setInputValue:f}=(0,Y.useChatInput)(),{handleToolSubmit:x}=function({chatType:e,onBeforeSubmit:i}){let a=(0,l.useChatStore)(e=>(0,W.getCurrentChatAgentType)(e)),s=(0,h.useChatContainerContextStore)(),{submitGenericTool:u}=function({onBeforeSubmit:e}){let{sendMessageWithFiles:i}=(0,B.default)(),a=(0,h.useChatContainerContextStore)(),r=(0,l.useChatStore)(e=>e.updateState),o=(0,eT.useUploadAction)(),s=(0,t.useRef)(null),u=(0,n.useMemoizedFn)(e=>{r("isPrepareWait",e),ew.chatEventBus.emit("setCanvasEditorPreparing",e)}),c=(0,n.useMemoizedFn)(async e=>{(await (0,k.getAntdMessageApi)()).error(e)}),m=(0,n.useMemoizedFn)(e=>!e||a?.getState()?.chatId===e),p=(0,n.useMemoizedFn)(()=>{let e=s.current;e&&(e.abort(),s.current=null,u(!1))});return(0,ej.useChatIdListener)(p),{submitGenericTool:(0,n.useMemoizedFn)(async t=>{let{fileItem:n,extraData:r}=t;if(r?.processType===d.EProcessConfigType.ImageUncrop){if(!n?.url)return;await e?.(),await i({content:t.question,fileList:[n]});return}if(r?.processType===d.EProcessConfigType.ImageObjectRemover){let l;if(!n?.url||!r.maskBase64)return;let d=a?.getState()?.chatId??void 0;p(),u(!0);let f=new AbortController;s.current=f;try{l=await eZ({imageUrl:n.url,maskBase64:r.maskBase64,signal:f.
1signal,uploadAction:o})}catch(e){if(e instanceof eJ&&"aborted"===e.reason)return void u(!1);await c(function(e){if(e instanceof eJ)switch(e.reason){case"preview-failed":return"Failed to prepare the erase selection reference.";case"upload-failed":return"Failed to upload the erase selection reference."}return"Failed to prepare erase request."}(e)),u(!1);return}finally{s.current===f&&(s.current=null)}if(u(!1),!m(d)||(t.onPrepared?.(),!m(d))||(await e?.(),!m(d)))return;await i({content:"Erase the area highlighted in red in this image. Preserve everything else.",fileList:[l]});return}n?.url&&(await e?.(),await i({content:t.question,fileList:[n]}))})}}({onBeforeSubmit:i}),{submitSessionTool:c}=function({onBeforeSubmit:e}){let t=(0,h.useChatContainerContextStore)(),{sendNewSession:i}=(0,e0.default)();return{submitSessionTool:(0,n.useMemoizedFn)(async a=>{let{fileItem:n,...r}=a,{chatId:l}=t?.getState()??{};l&&(a.onPrepared?.(),await e?.(),i({...r,chatId:l},{chatFileList:n?[n]:void 0}))})}}({onBeforeSubmit:i});return{handleToolSubmit:(0,n.useMemoizedFn)(async t=>{let{agentMode:i}=s?.getState?.()??{};"agui"===i||e===o.EChatInputType.GENERIC||a===r.EAgentType.GENERAL_AGENT?await u(t):await c(t)})}}({chatType:m,onBeforeSubmit:i}),y=(0,n.useMemoizedFn)((t,i)=>{e.resetFields(["inputValue"]);let a=i||"";e.setFieldsValue({inputValue:a,selectedSkills:[],similarInfo:null,pptAiEditTarget:null,pptAiEditTargets:void 0,pptAiEditMarkedTargets:void 0,humanizeDocumentReference:null,slidesTemplateInfo:null,...m===o.EChatInputType.AI_WRITER?g.DEFAULT_WRITER_FORM_VALUES:{}}),ew.chatEventBus.emit("pptAiEditExitRequested"),s(),f(a,"chat"),t&&p()});(0,eO.useLogoutListener)(()=>{y(!0)});let{isSimilarStyle:I,clearSimilar:E}=function({form:e,chatType:i,onHandleTool:s,handleResetForm:m,onBeforeProgrammaticInputValueSet:p}){let f,h;f=(0,n.useMemoizedFn)(t=>{if(!t)return void e?.setFieldsValue({pptAiEditTarget:null,pptAiEditTargets:void 0,pptAiEditMarkedTargets:void 0});let i=function(e){let t="string"==typeof e.selectionRef?e.selectionRef.trim():"";if(!t)return null;let i=e.boundingBox&&"object"==typeof e.boundingBox&&!Array.isArray(e.boundingBox)?e.boun
1dingBox:void 0,a=i?{x:Number(i.x),y:Number(i.y),width:Number(i.width),height:Number(i.height)}:void 0,n=!!a&&[a.x,a.y,a.width,a.height].every(e=>Number.isFinite(e)),r=Number(e.xRatio),l=Number(e.yRatio),o=Number(e.clientX),s=Number(e.clientY),d=Number(e.contentWidth),u=Number(e.contentHeight);return{slideId:e.slideId,order:e.order,deckId:e.deckId,fileGeneratedId:e.fileGeneratedId,sessionId:e.sessionId,artifactId:e.artifactId,canvasNodeId:e.canvasNodeId,selectionKind:e.selectionKind,contractVersion:e.contractVersion,selectionRef:t,tagName:e.tagName,hasSelectedImage:e.hasSelectedImage,currentSrc:e.currentSrc,elementId:e.elementId,elementType:e.elementType,html:e.html,previewStatus:e.previewStatus,thumbnailDataUrl:e.thumbnailDataUrl,boundingBox:n?a:void 0,xRatio:Number.isFinite(r)?r:void 0,yRatio:Number.isFinite(l)?l:void 0,clientX:Number.isFinite(o)?o:void 0,clientY:Number.isFinite(s)?s:void 0,contentWidth:Number.isFinite(d)?d:void 0,contentHeight:Number.isFinite(u)?u:void 0}}(t),a=e?.getFieldValue("pptAiEditMarkedTargets"),n=!!a?.length,r=i?.selectionKind==="ocr-text-block"||i?.selectionKind==="point-comment"||!!("string"==typeof i?.selectionRef&&i.selectionRef.startsWith("nano-mark:")),l=i&&Array.isArray(a)&&a.some(e=>e.target.selectionRef===i.selectionRef),o=!!i&&n&&r,s=l?a.map(e=>e.target.selectionRef===i.selectionRef?{...e,target:i}:e):o?a:void 0;i?.html&&(0,v.recordPptAiEditDebugSelection)({selectionRef:i.selectionRef,elementId:i.elementId,elementType:i.elementType,selectedElementHtml:i.html,targetSnapshot:i}),e?.setFieldsValue({pptAiEditTarget:i,pptAiEditTargets:s?.map(e=>e.target),pptAiEditMarkedTargets:s})}),h=(0,n.useMemoizedFn)(()=>{e?.setFieldsValue({pptAiEditTarget:null,pptAiEditTargets:void 0,pptAiEditMarkedTargets:void 0}),ew.chatEventBus.emit("pptAiEditExitRequested")}),(0,ej.useChatIdListener)(()=>{h()}),(0,eW.useListenEvents)(ew.chatEventBus,{pptAiEditTargetSelected:f,mediaCanvasAiEditApplyRequested:()=>{e?.submit()},mediaCanvasAiEditMarksRemoved:({markIds:t})=>{let i=new Set(t),a=e?.getFieldValue("pptAiEditMarkedTargets"),n=a?.filter(e=>!i.has(e.markId)).map((e,t)=>({...e,markNumber:t+1}));e?.setFieldsValue({pptAiEditTarget:n?.[0]?.target??null,pptAiEditTargets:n?.map(e=>e.target),pptAiEditMarkedTargets:n?.length?n:void 0})},closeCanvasPreview:h,closeFilePreview:h});let[g,x]=(0,t.useState)(!1),{isSignIn:y}=(0,eG.useSessionInfo)(),{signUp:I}=(0,eH.useAppUIModal)(),E=(0,ei.useLingui)(),{getWatermarkUrl:_}=(0,eB.useWatermarkUrl)(),{setFileList:T,setInputValue:N,setIsAiBackgroundActive:M,storeSet:S,modelListMap:k}=(0,l.useChatStore)(e=>({setFileList:e.setFileList,setInputValue:e.setInputValue,setIsAiBackgroundActive:e.setIsAiBackgroundActive,storeSet:e.getSetFunction(),modelListMap:e.modelListMap})),A=ez.Form.useWatch("modelName",e),{handleAIWriter:w}=function(e){let t=ez.Form.useFormInstance(),{setInputValue:i}=(0,l.useChatStore)(e=>({setInputValue:e.setInputValue})),a=e||t;return{handleAIWriter:(0,n.useMemoizedFn)(e=>{if(!e||!a)return;let t={inputValue:e.prompt};void 0!==e.output_format&&(t.output_format=e.output_format),void 0!==e.text_length&&(t.text_length=e.text_length),a.setFieldsValue(t),i(e.prompt,"chat")})}}(e),{onAddSlidesTemplateFile:j}=(0,b.useUploadFileList)(e),F=(0,n.useMemoizedFn)(e=>{T(e.map(em.getFileItem),"chat")}),{setTemplateInfo:R,templateInfo:L}=(0,eq.useFormTemplate)(e),{handleAiBackground:V,handleErase:D,handleOutpaint:O,handleRemoveBg:P,handleUpscale:z}=function(e){let{isSignIn:t,onHandleTool:i,setFileList:a,setIsAiBackgroundActive:l,showSignUp:o,translate:s}=e,u=(0,eT.useUploadAction)(),c=(0,n.useMemoizedFn)(e=>{if(!(e&&("image"===e.type||"video"===e.type)&&e.url?.trim()&&("image"===e.type?"number"==typeof e.scaleValue&&Number.isFinite(e.scaleValue)&&e.scaleValue>0:eY.has(String(e.scaleValue)))))return void(0,ed.devLog)("upscale invalid payload=====>",e);if((0,ed.devLog)("upscale=====>",e),!t)return void o({showQuotaExceededTitle:!0});let a="image"===e.type,n=a?C.i18n._({id:"yk_W4a",values:{0:e.scaleValue}}):C.i18n._({id:"tCw0af",values:{0:ep.HIX_CHAT_UPSCALE_NUMBER_MAP[e.scaleValue]}});i?.({question:s(n),agentType:a?r.EAgentType.AI_IMAGE_TOOL:r.EAgentType.AI_VIDEO_TOOL,extraData:a?{processType:d.EProcessConfigType.ImageUpscale,imageUrl:e.url,scale:e.scaleValue}:{processType:d.EGenerationConfigType.Upscale,videoUrl:e.url,scale:e.scaleValue},fileItem:(0,em.getFileItem)({name:e.url,url:e.url})})}),m=(0,n.useMemoizedFn)(e=>{if(!e)return;if((0,ed.devLog)("outpaint=====>",e),!t)return void o({showQuotaExceededTitle:!0});let a=e.preset&&"custom"!==e.preset?e.preset:(()=>{let t=e.resize?.width||0,i=e.resize?.height||0,a=e.extend?.left||0,n=e.extend?.right||0,r=e.extend?.top||0,l=e.extend?.bottom||0,o=t+a+n,s=i+r+l;if(!o||!s)return C.i18n._({id:"Vne-Q6"});let d=o/s,u=[{label:"1:1",value:1},{label:"2:3",value:2/3},{label:"3:2",value:1.5},{label:"4:3",value:4/3},{label:"3:4",value:3/4},{label:"16:9",value:16/9},{label:"9:16",value:9/16}].map(e=>({...e,diff:Math.abs(d-e.value)/e.value})).sort((e,t)=>
1e.diff-t.diff)[0];if(u&&u.diff<=.025)return u.label;let c=Math.max(1,Math.round(Math.abs(o))),m=Math.max(1,Math.round(Math.abs(s)));return Number.isFinite(c)&&Number.isFinite(m)?`${c}\xd7${m} px`:C.i18n._({id:"Vne-Q6"})})(),n=C.i18n._({id:"7TRrR5",values:{ratioText:a}});i?.({question:s(n),agentType:r.EAgentType.AI_IMAGE_TOOL,extraData:{processType:d.EProcessConfigType.ImageUncrop,imageUrl:e.imageUrl,resize:{width:e.resize.width,height:e.resize.height},extend:{left:e.extend.left,right:e.extend.right,up:e.extend.top,down:e.extend.bottom}},fileItem:(0,em.getFileItem)({name:e.imageUrl,url:e.imageUrl})})}),p=(0,n.useMemoizedFn)(async e=>{let t=await fetch(e);if(!t.ok)throw Error(`Image fetch failed with status ${t.status}`);let i=await t.blob(),a=(0,eb.createUploadFileFromBlob)({blob:i,sourceName:e,fallbackName:`erase-source-${Date.now()}`}),n=await (0,eb.prepareImageUploadFile)({file:a,maxSizeMB:50,overflowSizeLimitBytes:0x3200000,overflowCompression:{maxSizeMB:50,maxWidthOrHeight:4096}}),{url:r}=await u({file:n,filename:n.name,type:"image"});if(!r)throw Error("Image upload URL is empty");return{url:r,fileName:n.name}}),f=(0,n.useMemoizedFn)(async e=>{if(!e?.imageUrl)return;if((0,ed.devLog)("erase=====>",e),!t)return void o({showQuotaExceededTitle:!0});let a=e.imageUrl,n=e.imageUrl;try{let t=await p(e.imageUrl);a=t.url,n=t.fileName}catch(e){(0,ed.devLog)("[IMAGE_ERASE] prepare source failed, fallback to original",e)}i?.({question:"Erase selected portion",agentType:r.EAgentType.AI_IMAGE_TOOL,extraData:{processType:d.EProcessConfigType.ImageObjectRemover,imageUrl:a,originUrl:a,maskBase64:e.maskBase64??""},fileItem:(0,em.getFileItem)({name:n,url:a}),onPrepared:e.onPrepared})});return{handleAiBackground:(0,n.useMemoizedFn)(e=>{if(e&&e.imageUrl){if((0,ed.devLog)("aiBackground=====>",e),!t)return void o({showQuotaExceededTitle:!0});a([{name:e.imageUrl,url:e.imageUrl,frame:1}]),l(!0)}}),handleErase:f,handleOutpaint:m,handleRemoveBg:(0,n.useMemoizedFn)(e=>{if(!e)return;if((0,ed.devLog)("removeBg=====>",e),!t)return void o({showQuotaExceededTitle:!0});let a=e.videoUrl?C.i18n._({id:"xiZ6Mb"}):C.i18n._({id:"0eLG-u"}),n=!!e.videoUrl,l=e.videoUrl??e.url;if(!l)return;let s={...(0,em.getFileItem)({name:l,url:l}),url:l};i?.({question:a,agentType:n?r.EAgentType.AI_VIDEO_TOOL:r.EAgentType.AI_IMAGE_TOOL,extraData:n?{processType:d.EGenerationConfigType.VideoObjectRemover,videoUrl:l}:{processType:d.EProcessConfigType.ImageBackgroundRemover,imageUrl:l},fileItem:s})}),handleUpscale:c}}({isSignIn:y,onHandleTool:s,setFileList:F,setIsAiBackgroundActive:M,showSignUp:e=>{I.show(e)},translate:e=>E.i18n._(e)}),U=(0,n.useMemoizedFn)(()=>{ex.AGENT_MODELS.includes(A)&&e?.setFieldValue("modelName",i===o.EChatInputType.AI_VIDEO?ep.DEFAULT_VIDEO_MODEL_NAME:ec.EImageModel.NanoBanana2Google)}),G=(0,n.useMemoizedFn)(t=>{if(!t)return;let{generationConfig:i,generationTemplate:a}=t.generateRecord;if(!i)return;(0,ed.devLog)("create similar=====>",t),R(null),T([],"chat"),x(!0);let n=i?.prompt||"",r=function(e){if(![d.EGenerationConfigType.Image2Image,d.EGenerationConfigType.Img2Video,d.EGenerationConfigType.Text2Image,d.EGenerationConfigType.Text2Video].includes(e?.configType))return null;let t=e.modelName||e.videoModel;return t&&[d.EVideoModel.POLLO_V1_5,d.EVideoModel.POLLO_V1_6].includes(t)?d.EVideoModel.HIX_V2_0:t===d.EVideoModel.WAN2_5_I2I_PREVIEW?d.EVideoModel.WAN2_5_T2I_PREVIEW:Object.values(ec.EImageModel).includes(t)||Object.values(d.EVideoModel).includes(t)?t:null}(i);e?.setFieldsValue({similarInfo:void 0,aspectRatio:i.aspectRatio||a?.aspectRatio,style:i.style,resolution:i.resolution,length:i.length,numOutputs:i.numOutputs||1,inputValue:n,slidesTemplateInfo:null}),N(n,"chat"),r&&e?.setFieldValue("modelName",r);let l=i.templateId&&a;l&&(R({templateId:a.id,templateCode:a.templateCode,title:a.title,coverImg:"",coverVideo:"",assetsNum:i?.assets?.length||1,videoType:t.generateRecord.processType}),N(n,"chat"),U());let o=i?.imageUrls||i?.templateImage||i?.assets?.map(e=>e.url)||(i?.image?[i.image,i.imageTail]:[]);if(Array.isArray(o)){let e=!!i.imageTail||l;
1F(o.filter(Boolean).map((t,i)=>({name:t,url:t,frame:e?i+1:1})))}}),H=(0,n.useMemoizedFn)(t=>{(0,ed.devLog)("agent similar=====>",t),R(null),T([],"chat"),N("","chat"),e?.setFieldsValue({aspectRatio:void 0,style:void 0,resolution:void 0,length:void 0,numOutputs:void 0,inputValue:"",templateInfo:null,similarInfo:t,slidesTemplateInfo:null})}),B=(0,n.useMemoizedFn)(({data:t,files:i})=>{var a;if(!t)return;(0,ed.devLog)("edit=====>",t),x(!0);let n=u(t)?c(t):void 0,r=n?{...t,...n}:t;n&&S(e=>{e.formValueMap[o.EChatInputType.AI_VIDEO]={...e.formValueMap[o.EChatInputType.AI_VIDEO],...n}});let l="imageTail"in t&&!!t.imageTail,s=i?.map((e,i)=>{let a=e.webPage||(0,e$.resolvePersistedWebPage)(t,e.url),n=(0,em.getFileItem)({name:a?.title||e.name,url:e.url,size:e.size,frame:l?i+1:1});return a?{...n,name:a.title,type:"text/html",url:a.url,webPage:a}:n})||[],d=(a=t.prompt||"",(0,eK.getReferenceMediaItems)(s).sort((e,t)=>t.token.length-e.token.length).reduce((e,t)=>{let i=(0,eX.serializeReferenceToken)((0,eK.toReferenceMediaOption)(t)),a=`@${t.token}`,n=e.replaceAll(a,i);return t.mediaType?n.replaceAll(t.token,i):n},a));e?.setFieldsValue({...r,inputValue:d}),N(d,"chat"),T(s,"chat")}),W=(0,n.useMemoizedFn)(e=>{let t=_({url:e?.url,noWatermarkUrl:e?.no_watermark_url});!t||(F([{name:`${e?.file_generated_id||"video-to-video"}.mp4`,url:t,frame:1}]),x(!1),L&&R(null))}),$=(0,n.useMemoizedFn)(t=>{t&&((0,ed.devLog)("template=====>",t),e?.setFieldsValue({similarInfo:void 0,slidesTemplateInfo:null}),R(t),U())}),q=(0,n.useMemoizedFn)(t=>{t&&Object.entries(t).forEach(([t,i])=>{let a="inputValue"===t&&"string"==typeof i?i:null;if(null!==a&&p?.(),(0,eS.shallow)(i,e?.getFieldValue(t))){null!==a&&N(a,"chat");return}(0,ed.devLog)("setFieldsValue=====>",t,i),e?.setFieldValue(t,i),null!==a&&N(a,"chat")})}),K=(0,n.useMemoizedFn)(t=>{j(t)&&e?.setFieldsValue({similarInfo:null,slidesTemplateInfo:t})});(0,eW.useListenEvents)(ew.chatEventBus,{updateChatForm:t=>{e&&t&&(ew.chatEventBus.emit("setIsPreviewFullScreen",!1),(0,a.match)(t).with({type:"similar",data:{type:"media"}},({data:e})=>G(e.data)).with({type:"similar",data:{type:"slides"}},({data:e})=>H(e.data)).with({type:"similar",data:{type:"agent_image"}},({data:e})=>H(e.data)).with({type:"similar",data:{type:"agent_video"}},({data:e})=>H(e.data)).with({type:"similar",data:{type:"agent_writer"}},({data:e})=>H(e.data)).with({type:"similar",data:{type:"agent_deep_research"}},({data:e})=>H(e.data)).with({type:"similar",data:{type:"general_agent"}},({data:e})=>H(e.data)).with({type:"edit"},B).with({type:"video-to-video"},({data:e})=>W(e)).with({type:"upscale"},({data:e})=>z(e)).with({type:"removeBg"},({data:e})=>P(e)).with({type:"outpaint"},({data:e})=>O(e)).with({type:"erase"},({data:e})=>D(e)).with({type:"aiBackground"},({data:e})=>V(e)).with({type:"template"},({data:e})=>$(e)).with({type:"aiWriter"},({data:e})=>w(e)).with({type:"slidesTemplate"},({data:e})=>K(e)).with({type:"setFieldsValue"},({data:e})=>q(e)).exhaustive())},resetChatForm:m});let X=(0,n.useMemoizedFn)(()=>{x(!1),R(null),e?.resetFields(["similarInfo","pptAiEditTarget","pptAiEditTargets","pptAiEditMarkedTargets","slidesTemplateInfo"])}),Y=(0,eP.useLatest)(L);return(0,t.useEffect)(()=>{let e=Y.current;(i!==o.EChatInputType.AI_IMAGE||e?.videoType!==eU.ECreateVideoType.Template2Image)&&(i!==o.EChatInputType.AI_VIDEO||e?.videoType!==eU.ECreateVideoType.TEMPLATE)&&e&&R(null)},[i,R,Y]),(0,t.useEffect)(()=>{A&&(i===o.EChatInputType.AI_IMAGE||i===o.EChatInputType.AI_VIDEO)&&k[i]?.some(e=>e.modelName===A)&&S(e=>{e.formValueMap[i].modelName=A})},[i,A,k,S]),{isSimilarStyle:g,clearSimilar:X}}({form:e,chatType:m,onHandleTool:x,handleResetForm:y,onBeforeProgrammaticInputValueSet:s});return{handleReset:y,isSimilarStyle:I,clearSimilar:E}}({form:e,onBeforeSubmit:s,cancelDebounce:ti}),{onFormSubmit:to}=function({form:e,handleReset:i,isSimilarStyle:s,clearSimilar:d,onBeforeSubmit:u,onSaveFormValue:c,onBeforeFetch:m}){let{chatType:p}=(0,h.useChatContainerContext)(e=>({chatType:e.chatType})),f=(0,h.useChatContainerContextStore)(),{fileList:g,clearFileList:x}=(0,b.useUploadFileList)(),{isAdChatBot:y,bot:I,updateState:C,setSessionList:E,set:v}=(0,Y.useChatInput)(),{ensureHixChatLogin:_}=(0,M.useEnsureHixChatLogin)(),{canSendMessage:T}=(0,e1.useCanSendMessage)(),{createAndSendNewChat:N,sendNewSession:k}=(0,e0.default)(),{functionDetail:w}=function(){let{chatType:e,functionAreaList:i}=(0,h.useChatContainerContext)(e=>({chatType:e.chatType,functionAreaList:e.functionAreaList}));return{functionDetail:(0,t.useMemo)(()=>(0,a.match)(e).with(o.EChatInputType.AI_IMAGE,()=>i?.find(e=>e.path===e4.URLS.HIXChat.agent_ai_image)).with(o.EChatInputType.AI_VIDEO,()=>i?.find(e=>e.path===e4.URLS.HIXChat.agent_ai_video)).with(o.EChatInputType.DEEP_RESEARCH,()=>i?.find(e=>e.path===e4.URLS.HIXChat.agent_deep_research)).with(o.EChatInputType.AI_SLIDES,()=>i?.find(e=>e.path===e4.URLS.HIXChat.agent_ai_slides)).otherwise(()=>null),[e,i])}}(),{replaceDeprecatedBot:j}
1=e5(),{setIsAiBackgroundActive:F}=(0,l.useChatStore)(e=>({setIsAiBackgroundActive:e.setIsAiBackgroundActive})),{botId:R,finalBot:L}=(0,t.useMemo)(()=>{if(p===o.EChatInputType.AI_CHAT){let e=(I?.type==="system"?j(I):null)||I;return{botId:e?.id||1,finalBot:e}}return{botId:w?.bot_id||1,finalBot:null}},[p,j,I,w]);return{onFormSubmit:(0,n.useMemoizedFn)(async({inputValue:t,agentType:a,extraData:n,chatType:h,reference:b,canSendEmptyMessage:M,onAfterRouter:w})=>{let j=(0,A.removeTemplateMarkers)(t);if(!y&&!_(h??p)||!T({text:j,canSendEmptyMessage:!!g.length||M,withCreditCondition:!1,agentType:a,modelName:e.getFieldValue("modelName")}))return;let{chatId:V,containerType:D}=f?.getState()??{};if((a===r.EAgentType.AI_IMAGE||a===r.EAgentType.AI_IMAGE_TOOL)&&F(!1),i(),await u?.(),n&&a&&c(n,a),V)C("isPrepareWait",!0),await k({question:j,chatId:V,fileUrls:g?.length?g.map(e=>e.url):void 0,agentType:a,extraData:n,isSimilarStyle:s},{chatFileList:g,onBeforeFetch:()=>{x(),d()},onFirstEvent:()=>{C("isPrepareWait",!1)}});else{if(!I?.id&&p===o.EChatInputType.AI_CHAT)return;let e=D===o.EChatContainerType.SHARE&&(0,e2.extractPathParam)((0,e2.getPathname)(),"share")||null,{selectedBotIds:t,chatDetail:i}=l.chatStoreInstance.getState(),r=(0,X.collectChatDetailBranchBotIds)(i?(0,X.getChatDetailBranches)(i):void 0),u=(0,K.resolveAiChatCreateBotIds)({selectedBotIds:t,conversationBotIds:r}),c=p===o.EChatInputType.AI_CHAT&&u.length>=2,f=(0,K.resolveAiChatShareContinue)({shareId:e,createBotIds:u,conversationBotIds:r});await N({question:j,...c?{botIds:u}:{botId:R},chatType:h,agentType:a,extraData:n,isSimilarStyle:s,reference:b,...f&&e?{shareId:e}:{}},{chatFileList:g,onCreateChat:e=>{f&&u.length<=1&&E(t=>t.map(t=>({...t,chat_id:e})),"chat"),y&&S.trackEmitter.emit("track-event",{name:"afs_chat_click"})},onBeforeFetch:()=>{x(),d(),m?.()},clearSessionListOnBeforeCreate:!f,onAfterRouter:()=>{w?.(),p===o.EChatInputType.AI_CHAT&&v(e=>{if(!L)return;let t=l.chatStoreInstance.getState().bot,i=l.chatStoreInstance.getState().modelInfoMap[o.EChatInputType.AI_CHAT];L.id!==t?.id&&(e.bot=L),L.url!==i?.url&&(e.modelInfoMap[o.EChatInputType.AI_CHAT]={name:L.name,icon_class_name:L.icon_class_name,icon_url:L.icon_url,type:L.type,url:L.url})})}})}})}}({form:e,handleReset:tn,isSimilarStyle:tr,clearSimilar:tl,onBeforeSubmit:s,onSaveFormValue:f,onBeforeFetch:x}),{onFormSubmit:ts}=function({handleReset:e,onBeforeSubmit:t,onBeforeFetch:r}){let l,s=(0,h.useChatContainerContext)(e=>e.chatId??null),{fileList:d,clearFileList:u}=(0,b.useUploadFileList)(),{ensureHixChatLogin:c}=(0,M.useEnsureHixChatLogin)(),f=(0,h.useChatContainerContextStore)(),g=(0,F.useOptionalMediaCanvasReferenceController)(),x=(0,i.useOptionalChatAguiReferenceMentionResolver)(),y=(0,n.useMemoizedFn)(e=>(0,D.formatAguiSerializedInput)(e,x)),{projectId:I}=(0,w.useCurrentProjectScope)(),{sendMessageWithFiles:E}=(0,B.default)(),{prepareRecommendationSend:v}=(l=(0,P.useOptionalFeatureStoresApi)(),{prepareRecommendationSend:(0,n.useMemoizedFn)(e=>{if(!l?.[G.FOLLOW_UP_SUGGESTIONS_FEATURE_KEY])return;let t=(0,U.bindChatAguiFeatureStores)(l,[H.followUpSuggestionsFeature])[G.FOLLOW_UP_SUGGESTIONS_FEATURE_KEY].getState();if(!t.activeRunId)return;let i=t.activeRunId,a=t.suggestionsByRunId[i];if(!a?.length)return;let n=a.flatMap((a,n)=>{if(!e.includes(a.text))return[];let r=(0,z.buildFollowUpSuggestionTrackEvent)({suggestion:a,index:n,artifactTypes:t.artifactTypes,runId:i,method:"send_recommendation"});return r?[r]:[]});if(n.length)return()=>{n.forEach(e=>S.trackEmitter.emit("track-event",e))}})});return{onFormSubmit:(0,n.useMemoizedFn)(async({inputValue:i,textParts:n,replica:l,chatType:h,deferResetUntilLoading:x,onAfterRouter:b,entryProfile:M,imageConfig:w,activeConnectors:F,selectedSkills:D,extraData:P,abortOnChatIdChangeFrom:z,forceNewThread:U,reference:G,canSendEmptyMessage:H,hideArtifactReferences:B,onAfterCreateChat:W,onAfterEnterLoading:$},{onAfterCreateChat:q}={})=>{let K=M===_.EGeneralSubType.SLIDES&&f?.getState().containerType===o.EChatContainerType.HOME_ENTRY?(0,O.getSlidesEntryQuickAction)(D)?.startTaskTrackField1:void 0,X=Array.from(new Set([...D??[],...(0,N.getReferencedSkillNames)(i)]));if(X.length>N.CHAT_REFERENCED_SKILLS_LIMIT)return void(await (0,k.getAntdMessageApi)()).warning(N.CHAT_REFERENCED_SKILLS_LIMIT_MESSAGE);if((0,T.getSerializedProjectReferenceCount)(i)>T.CHAT_PROJECT_REFERENCE_LIMIT){(await (0,k.getAntdMessageApi)()).error((0,T.getProjectReferenceLimitMessage)()),I&&(0,j.trackProject)({type:"input_box",id:I,method:"limit_toast",location:"input_box"});return}let Y=n?.map(y),Q=function(e){var t;
1let i,a=(0,A.extractSerializedReferences)(e.inputValue).filter(e=>"canvas_node"===e.kind),{existingArtifactMarkers:n,existingUserInput:r}=function(e){if(!e?.length)return{existingArtifactMarkers:[],existingUserInput:""};let t=[],i=[];for(let a of e){let e=function(e){try{let t=R.GeneralAgentReferenceArtifactMarkerSchema.safeParse(JSON.parse(e));return t.success?t.data:null}catch{return null}}(a);e?t.push(e):i.push(a)}return{existingArtifactMarkers:t,existingUserInput:i.join("")}}(e.textParts),l=r||e.formatSerializedInput(e.inputValue);if(0===a.length)return{artifactMarkerConflict:!1,invalidReferenceLabels:[],referenceLimitExceeded:!1,prompt:l};if(n.length>1)return{artifactMarkerConflict:!0,invalidReferenceLabels:[],referenceLimitExceeded:!1,prompt:l};if(a.length>V.MEDIA_CANVAS_REFERENCE_LIMIT)return{artifactMarkerConflict:!1,invalidReferenceLabels:[],referenceLimitExceeded:!0,prompt:l};let o=new Set(e.options.filter(e=>!e.disabled||e.selected).map(e=>e.id)),s=o.size>0,d=a.map(e=>({artifactId:(0,L.getReferencePayloadString)(e.payload,"artifactId"),nodeId:(0,L.getReferencePayloadString)(e.payload,"nodeId"),reference:e})),u=d.filter(e=>!!e.artifactId&&!!e.nodeId&&(!s||o.has(e.reference.id))),c=new Set(u.map(({reference:e})=>e.id)),m=d.filter(({reference:e})=>!c.has(e.id)).map(({reference:e})=>e.label);if(m.length>0)return{artifactMarkerConflict:!1,invalidReferenceLabels:m,referenceLimitExceeded:!1,prompt:l};let p=n[0],f=(t=[...u.map(({artifactId:e,nodeId:t})=>({type:"artifact",artifact_id:e,canvas_node_id:t})),...p?.references??[]],i=new Set,t.filter(e=>"artifact"!==e.type||!i.has(e.artifact_id)&&(i.add(e.artifact_id),!0))),h=R.GeneralAgentReferenceArtifactMarkerSchema.safeParse({__reference_artifact__:!0,references:f,...p?.hide_references!==void 0?{hide_references:p.hide_references}:{}});if(!h.success)return{artifactMarkerConflict:!0,invalidReferenceLabels:[],referenceLimitExceeded:!1,prompt:l};let g=r||l,x=[JSON.stringify(h.data),...g?[g]:[]];return{artifactMarkerConflict:!1,invalidReferenceLabels:[],referenceLimitExceeded:!1,prompt:g,textParts:x}}({inputValue:i,options:g?.options??[],textParts:Y,formatSerializedInput:y});if(Q.artifactMarkerConflict)return void(await (0,k.getAntdMessageApi)()).error((0,V.getMediaCanvasReferenceMarkerConflictMessage)());if(Q.referenceLimitExceeded)return void(await (0,k.getAntdMessageApi)()).error((0,V.getMediaCanvasReferenceLimitMessage)());if(Q.invalidReferenceLabels.length>0)return void(await (0,k.getAntdMessageApi)()).error(C.i18n._({id:"rgIZAK"}));let J=Q.prompt,Z=function({inputValue:e,prompt:t,textParts:i}){let a=(0,A.extractSerializedReferences)(e),n=new Set;for(let e of a){let t=e.payload?.projectOutputId;"project_output"===e.kind&&"string"==typeof t&&n.add(t)}return 0===n.size?i:[JSON.stringify({__reference_project__:!0,references:Array.from(n,e=>({type:"project_output",output_id:e}))}),...i?.length?i:t?[t]:[]]}({inputValue:i,prompt:J,textParts:Q.textParts??Y}),ee=void 0!==z;if(!c(h))return;let et=f?.getState().chatId??null;if(ee&&et!==z)return"aborted";let ei=v(J),ea=d.slice(),en=!!x,er=en||$||ei?()=>{en&&(e(),u()),ei?.(),$?.()}:void 0;en||e(),await t?.(),await r?.();let el=f?.getState().chatId??null;if(ee&&el!==z)return"aborted";let eo=ea.find(e=>e.slidesTemplate)?.slidesTemplate?.id;eo&&S.trackEmitter.emit("track-event",{name:"slides_templates",location:"slides_template_submit",...!U&&s?{id:s}:{},type:eo}),en||u();let es=void 0!==M?{...P??{},entryProfile:M}:P,ed=(0,a.match)({replica:l,reference:G}).returnType().with({replica:a.P.not(a.P.nullish)},({replica:e})=>e).with({reference:{reference_id:a.P.when(e=>!!e)}},({reference:e})=>({reference:{referenceId:e.reference_id,...e.share_id&&{shareId:e.share_id},...e.name&&{name:e.name},...e.artifact_card_id&&{artifactCardId:e.artifact_card_id}}})).otherwise(()=>void 0),eu=W||q?async e=>{W?.(e),await q?.()}:void 0,ec=b||eu||er?{...b?{onAfterRouter:b}:{},...eu?{onAfterCreateChat:eu}:{},...er?{onAfterEnterLoading:er}:{}}:void 0,em=await E({content:J,...Z?.length?{textParts:Z}:{},fileList:ea,...void 0!==F?{activeConnectors:F}:{},selectedSkills:X,...K?{startTaskTrackField1:K}:{},...w?{imageConfig:w}:{},...ed&&{replica:ed},...B?{hideArtifactReferences:!0}:{},...es&&{extraData:es},...U&&{forceNewThread:U}}
1,ec);if(em&&es?.entryProfile===_.EGeneralSubType.SLIDES&&function(e){try{window.localStorage.setItem(p.HIX_CHAT_KEYS.SLIDES_ASPECT_RATIO,e)}catch{}}((0,m.resolveSlidesAspectRatio)("slidesAspectRatio"in es?es.slidesAspectRatio:void 0)),em&&I){let e=(0,T.getSerializedProjectReferenceCount)(i);e>0&&(0,j.trackProject)({type:"input_box",id:I,method:"send_with_output_files",value:e});let t=(0,j.joinProjectTrackItemNames)(X);t&&(0,j.trackProject)({type:"input_box",id:I,method:"send_with_skill",itemName:t})}return em?"submitted":"aborted"})}}({handleReset:tn,onBeforeSubmit:s,onBeforeFetch:x}),{showLegacyAgentConfirm:td,legacyAgentConfirmModal:tu}=function(){let{i18n:e,_:i}=(0,ei.useLingui)(),[a,r]=(0,t.useState)(!1),[l,o]=(0,t.useState)(null),[s,d]=(0,t.useState)(!1),u=(0,t.useRef)(null),c=(0,t.useRef)(null),m=(0,n.useMemoizedFn)(()=>{r(!1),o(null),d(!1)}),p=(0,n.useMemoizedFn)(()=>{let e=u.current;u.current=null,c.current=null,m(),e?.()}),f=(0,n.useMemoizedFn)(async()=>{if(c.current)try{d(!0),await c.current();let e=u.current;u.current=null,c.current=null,m(),e?.()}catch{d(!1)}}),h=(0,n.useMemoizedFn)(({agentType:e,onOk:t})=>new Promise(i=>{u.current=i,c.current=t,o(e),d(!1),r(!0)})),g=l?ee.SESSION_TYPE_I18N_KEYS[l]:"";return{showLegacyAgentConfirm:h,legacyAgentConfirmModal:(0,et.jsx)(en.default,{open:a,onCancel:p,centered:!0,destroyOnClose:!0,closable:!s,maskClosable:!s,footer:()=>(0,et.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,et.jsx)(ea.default,{color:"modalCancel",rounded:"sm",onClick:p,className:"px-5 py-1 text-sm leading-5",disabled:s,children:e._({id:"dEgA5A"})}),(0,et.jsx)(ea.default,{color:"modalConfirm",rounded:"sm",onClick:()=>{f()},className:"px-5 py-1 text-sm leading-5",loading:s,children:e._({id:"76hVmY"})})]}),title:(0,et.jsx)("div",{className:"text-base font-semibold",children:e._({id:"M5rEN5"})}),children:(0,et.jsx)("div",{className:"text-sm leading-5 text-f-text-secondary",children:e._({id:"Gy1vN2",values:{sessionTypeLabel:g}})})})}}(),tc=(0,n.useMemoizedFn)(async e=>{if((e.reference?.reference_id??e.replica?.reference?.referenceId)===J&&eh)return(await (0,k.getAntdMessageApi)()).error(C.i18n._({id:"NkIpil"})),"aborted";let t=(0,K.resolveFreeUserMultiModelSendGate)({chatType:Q,isSignIn:e8,restrictMultiModelChat:e6,selectedBotCount:ey.length,isMultiColumnConversation:(0,X.isMultiColumnChatList)(eg?.chats)});switch(t){case"continue":break;case"login":if(!e3(e.chatType??Q))return;break;case"paywall":e7();return;default:return t}let i=eF?(0,W.getCurrentChatAgentType)(l.chatStoreInstance.getState()):null,a=e.agentType===r.EAgentType.AI_IMAGE_TOOL&&("agui"===eQ||i===r.EAgentType.GENERAL_AGENT),n=!!e.textParts?.length||!!e.deferResetUntilLoading||(0,T.getSerializedProjectReferenceCount)(e.inputValue)>0,s=void 0!==e.entryProfile||Q===o.EChatInputType.GENERIC||n||a;if((0,v.logPptAiEditDebug)("submit-route-decision",{chatId:eF,chatType:Q,agentMode:eQ,currentAgentType:i,hasEntryProfile:void 0!==e.entryProfile,hasTextParts:!!e.textParts?.length,deferResetUntilLoading:!!e.deferResetUntilLoading,isAguiAiImageToolSubmit:a,shouldUseAgui:s}),eF&&(0,ee.isLegacyAgentType)(i)){let t={};return await td({agentType:i,onOk:()=>new Promise((a,n)=>{let r=!1;te(e.extraData),ts({...e,entryProfile:e.entryProfile??ee.AGENT_TYPE_TO_ENTRY_PROFILE[i],forceNewThread:!0},{onAfterCreateChat:()=>{r=!0,t.value="submitted",a()}}).then(e=>{if("aborted"===e){t.value="aborted",a();return}r||n(Error("createChatFailed"))}).catch(n)})}),t.value}return s?(te(e.extraData),ts(e)):to(e)}),{onFormFinish:tm}=function({onFormSubmit:e,form:s,prepareEditorLockedSubmit:u,finishEditorLockedSubmit:c}){let{chatId:p,chatType:f}=(0,h.useChatContainerContext)(e=>({chatId:e.chatId??null,chatType:e.chatType})),{submitImage:g,submitVideo:x}=function({onFormSubmit:e}){let{fileList:t}=(0,b.useUploadFileList)(),{handelHiddenModel:i}=(0,ev.default)(),a=(0,l.useChatStore)(e=>e.isAiBackgroundActive);return{submitImage:(0,n.useMemoizedFn)(n=>{let l=n.activeConnectors,s={...n,inputValue:(0,A.removeTemplateMarkers)(n.inputValue)};if(a){let i=t.find(e=>!!e.url&&(0,em.isImageFile)(e));if(!i?.url)return;e({inputValue:n.inputValue,agentType:r.EAgentType.AI_IMAGE_TOOL,extraData:{processType:d.EProcessConfigType.ImageBackgroun
1dChanger,imageUrl:i.url,prompt:s.inputValue},...void 0!==l?{activeConnectors:l}:{},chatType:o.EChatInputType.AI_IMAGE});return}let u=n.similarInfo,c="modelName"in s?(0,ef.pickBy)({modelName:s.modelName,aspectRatio:s.aspectRatio,numOutputs:s.numOutputs||1,quality:"quality"in s&&void 0!==s.quality?s.quality:void 0,background:"background"in s&&void 0!==s.background?s.background:void 0,mode:s.mode,prompt:s.inputValue,templateId:s?.templateInfo?.templateId,templateCode:s?.templateInfo?.templateCode,resolution:s?.resolution,style:s?.style,images:s?.modelName!==d.EVideoModel.IMAGE_AGENT&&t?.length?t.filter(e=>!!e.url).map(e=>e.url):void 0,referenceId:s?.similarInfo?.reference_id},e=>void 0!==e):null,m=c?.templateId;if(c&&c.modelName){let t=i({modelName:c.modelName,returnOriginalModel:!0,isSetStorage:!0});if(t===ec.EImageModel.IMAGE_AGENT&&!m)return void e({inputValue:n.inputValue,entryProfile:_.EGeneralSubType.IMAGE,extraData:{...c,modelName:t},...void 0!==l?{activeConnectors:l}:{},...u?{reference:u}:{},canSendEmptyMessage:!!u?.reference_id,chatType:o.EChatInputType.AI_IMAGE});e({inputValue:n.inputValue,agentType:r.EAgentType.AI_IMAGE,extraData:{...c,modelName:t},...void 0!==l?{activeConnectors:l}:{},...u?{reference:u}:{},canSendEmptyMessage:!!u?.reference_id,chatType:o.EChatInputType.AI_IMAGE})}}),submitVideo:(0,n.useMemoizedFn)(a=>{let n=a.activeConnectors,l=eE({...a,inputValue:(0,A.removeTemplateMarkers)(a.inputValue)},t);if(l){if("videoModel"in l&&l.videoModel){i({modelName:l.videoModel,isSetStorage:!0}),e({inputValue:a.inputValue,agentType:r.EAgentType.AI_VIDEO,extraData:l,chatType:o.EChatInputType.AI_VIDEO});return}if("modelName"in l&&l.modelName){let t=l.modelName===d.EVideoModel.VIDEO_AGENT?ep.DEFAULT_VIDEO_MODEL_NAME:l.modelName,s=i({modelName:t,returnOriginalModel:!0,isSetStorage:!0})??t;e({inputValue:a.inputValue,agentType:r.EAgentType.AI_VIDEO,extraData:{...l,modelName:s},...void 0!==n?{activeConnectors:n}:{},chatType:o.EChatInputType.AI_VIDEO})}}})}}({onFormSubmit:e}),{submitDeepResearch:y,submitSlides:I,submitWriter:C,submitGenericVideo:E,submitFallbackChat:T}=function({onFormSubmit:e}){let t=(0,n.useMemoizedFn)(t=>{let i=t.similarInfo,a=t.activeConnectors;e({inputValue:t.inputValue,entryProfile:_.EGeneralSubType.DEEP_RESEARCH,extraData:eD(t),...void 0!==a?{activeConnectors:a}:{},...i?{reference:i}:{},canSendEmptyMessage:!!i?.reference_id,chatType:o.EChatInputType.DEEP_RESEARCH})}),i=(0,n.useMemoizedFn)(t=>{let i,a,n,r,l,s=(i=t.similarInfo,a=i?.reference_id,n=!!t.slidesTemplateInfo?.templateId,r=(0,m.normalizeSlidesFormMode)("slidesMode"in t?t.slidesMode:void 0),l=(0,m.resolveSlidesAspectRatio)(t.slidesAspectRatio),a?{extraData:{referenceId:a,...r?{slidesMode:r}:{},slidesAspectRatio:l},reference:{cover:i?.cover,name:i?.name,reference_id:a,share_id:i?.share_id,from_id:i?.from_id},canSendEmptyMessage:!0}:{extraData:{...r?{slidesMode:r}:{},slidesAspectRatio:l},canSendEmptyMessage:n}),d=t.activeConnectors;e({inputValue:t.inputValue,entryProfile:_.EGeneralSubType.SLIDES,chatType:o.EChatInputType.AI_SLIDES,selectedSkills:t.selectedSkills,...s,...void 0!==d?{activeConnectors:d}:{},extraData:{...s.extraData??{},...eD(t)}})}),a=(0,n.useMemoizedFn)(t=>{if("output_format"in t){let i=t.similarInfo,a=t.activeConnectors;e({inputValue:t.inputValue,entryProfile:_.EGeneralSubType.WRITER,extraData:{output_format:t.output_format,text_length:t.text_length,...eD(t)},...void 0!==a?{activeConnectors:a}:{},...i?{reference:i}:{},canSendEmptyMessage:!!i?.reference_id,chatType:o.EChatInputType.AI_WRITER})}});return{submitDeepResearch:t,submitSlides:i,submitWriter:a,submitGenericVideo:(0,n.useMemoizedFn)(async t=>{let i=t.similarInfo,a=t.activeConnectors;return await e({inputValue:t.inputValue,entryProfile:_.EGeneralSubType.VIDEO,extraData:eD(t),...void 0!==a?{activeConnectors:a}:{},...i?{reference:i}:{},canSendEmptyMessage:!!i?.reference_id,chatType:o.EChatInputType.GENERIC_VIDEO})}),submitFallbackChat:(0,n.useMemoizedFn)(t=>{let i=t.activeConnectors;e({inputValue:t.inputValue,...void 0!==i?{activeConnectors:i}:{},chatType:o.EChatInputType.AI_CHAT})})}}({onFormSubmit:e}),{submitPptAiEdit:N}=function({onFormSubmit:e,prepareEditorLockedSubmit:a,finishEditorLockedSubmit:r}){let l=eA(e=>
1e.pptLiveBuffer?.slides??null),o=(0,h.useChatContainerContextStore)(),s=(0,i.useOptionalChatAguiReferenceMentionResolver)(),d=(0,n.useMemoizedFn)(e=>(0,D.formatAguiSerializedInput)(e,s)),u=(0,t.useRef)(new Map),c=(0,eT.useUploadAction)(),m=(0,t.useRef)(null),p=(0,t.useRef)(null),f=(0,n.useMemoizedFn)(()=>{m.current?.abort(),m.current=null,p.current?.(),p.current=null});(0,ej.useChatIdListener)(f);let g=(0,n.useMemoizedFn)(async(e,t)=>{let i=function(e){if("string"!=typeof e)return;let t=e.trim();if(t)return t}(e);if(!i||t?.aborted)return;if(/^https?:\/\//i.test(i))return i;if(!i.startsWith("data:"))return;let a=u.current.get(i);if(a)return a;try{let e=(0,eb.createUploadFileFromBlob)({blob:(0,e_.base64ToBlob)(i),fallbackName:`ppt-ai-edit-thumbnail-${Date.now()}`}),a=await (0,eb.prepareImageUploadFile)({file:e,maxSizeMB:.5,maxWidthOrHeight:1024,fileType:"image/webp",initialQuality:.7});if(t?.aborted)return;let{url:n}=await c({file:a,filename:a.name,type:"image",signal:t});if(t?.aborted)return;if(n)return u.current.set(i,n),n}catch{}});return{submitPptAiEdit:(0,n.useMemoizedFn)(async({formValues:t,selectedPptAiEditTarget:i,pptAiEditTargetsForSubmitMode:n,pptAiEditMarkedTargetsForSubmitMode:s,sceneContribution:u})=>{let c,f,h="string"==typeof t.inputValue?t.inputValue:"",x=(0,A.removeTemplateMarkers)((0,A.removeSerializedReferencesByKind)(h,"canvas_node")),y=d(h),I=t.similarInfo,C=[];Array.isArray(n)?C=n.filter(e=>!!e):i&&(C=[i]);let E=new Map;Array.isArray(s)&&s.forEach(e=>{let t="string"==typeof e.target.selectionRef?e.target.selectionRef.trim():"";t&&E.set(t,e)});let b="string"==typeof i?.selectionRef?i.selectionRef.trim():"",T=C.length>0,N=o?.getState().chatId??null,M="string"==typeof i?.html?i.html.trim():"",S=M?(0,v.withPptAiEditDebugActionData)({selectedElementHtml:M}):void 0;if(T&&a){if(!a())return;m.current=f=new AbortController,c=()=>{r?.(),p.current===c&&(p.current=null),c=void 0},p.current=c}try{let a=l??[],n=new Map,r=[];for(let e of C){let t,l=String(e.slideId),o=a.find(e=>{let t=String(e.renderId??e.id);return String(e.id)===l||t===l}),s=!o&&"number"==typeof e.order&&Number.isFinite(e.order)?a.find(t=>t.order===e.order):void 0,d=o??s,u="string"==typeof e.html?e.html.trim():"",c="string"==typeof d?.content?d.content:"",m="string"==typeof e.elementId?e.elementId.trim():"",p=(m.length>0?function(e){if("function"==typeof window.DOMParser&&e.slideContent&&e.elementId)try{let t=new window.DOMParser().parseFromString(e.slideContent,"text/html").getElementById(e.elementId),i=t?.outerHTML;return"string"==typeof i&&i.trim().length>0?i:void 0}catch{return}}({slideContent:c,elementId:m}):void 0)||(u.length>0?e.html:void 0),f=String(d?.renderId??d?.id??e.slideId);if(n.has(f)){r.push({target:e,referenceArtifactId:n.get(f),shouldDropSelectedElementHtml:!1,selectedElementHtml:p});continue}d&&"string"==typeof d.id?t=d.id:"string"==typeof e.slideId&&(t=e.slideId),e.selectionRef===i?.selectionRef&&t&&String(t)!==String(e.slideId)&&ew.chatEventBus.emit("pptAiEditTargetSelected",{...e,slideId:t}),t&&n.set(f,t),r.push({target:e,referenceArtifactId:t,shouldDropSelectedElementHtml:!1,selectedElementHtml:p})}let s=[];if(r.length>0)for(let e of r){let t,{target:i,referenceArtifactId:a,shouldDropSelectedElementHtml:n,selectedElementHtml:r}=e;if(!a)continue;let l=await g(i.thumbnailDataUrl||i.currentSrc,f?.signal);if(f?.signal.aborted||(o?.getState().chatId??null)!==N)return;let d="string"==typeof i.selectionRef?i.selectionRef.trim():"",u=d?E.get(d):void 0;"point-comment"!==i.selectionKind&&(u?.markMode==="ai-edit"?t="ai-edit":u?.markMode==="edit-text"&&(t="edit-text"));let c={artifactId:a,canvasNodeId:i.canvasNodeId,pageOrder:i.canvasNodeId?void 0:i.order,selectionKind:i.selectionKind,selectedBoundingBox:i.boundingBox,requestPrompt:x};!n&&"string"==typeof r&&r&&(c.selectedElementHtml=r),"string"==typeof i.tagName&&(c.selectedTagName=i.tagName),"string"==typeof i.elementType&&(c.selectedElementType=i.elementType),l&&(c.selectedThumbnailUrl=l);let m=function(e){let{artifactId:t,canvasNodeId:i,pageOrder:a,selectionKind:n,selectedBoundingBox:r,selectedElementHtml:l,selectedTagName:o,selectedElementType:s,selectedThumbnailUrl:d,requestPrompt:u}=e,c=l&&l.replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi," ").replace(/<style[\s\S]*?>[\s\S]*?<\/style>/gi," ").replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()||void 0,m=eR(r),p="number"==typeof a&&Number.isFinite(a)&&a>=0?Math.floor(a):void 0,f="number"==typeof p?{page_order:p}:{};if("ocr-text-block"===n&&c&&m)return{type:"ocr_text",artifact_id:t,...i?{canvas_node_id:i}:{},...f,text:c,bbox:m};if("point-comment"===n&&m){let e=c??("string"==typeof u?u.trim():"");return{type:"comment",artifact_id:t,...i?{canvas_node_id:i}:{},...f,region:m,...e?{instruction:e}:{}}}if(l){let e=o?o.toLowerCase():void 0,i={type:"html_element",artifact_id:t,...f,outer_html:l};return e&&(i.tag=e),s&&(i.element_type=s),c&&(i.text=c),d&&(i.thumbnail_url=d),i}return{type:"artifact",artifact_id:t}}(c),p="string"==typeof u?.markPrompt?u.markPrompt.trim():"",h=(()=>{switch(m.type){case"ocr_text":return{...m,..."ai-edit"===t&&p?{instruction:p}:{},..."edit-text"===t&&p?{replacement_text:p}:{},...t?{reference_tag:t}:{}};case"html_element":return{...m,..."ai-edit"===t&&p?{instruction:p}:{},...t?{reference_tag:t}:{}};default:return m}})();s.push(h)}let d=s.map(eL);i&&b&&function(e){let{prompt:t,selectedTarget:i,selectedTargetSelectionRef:a}=e,n=eR(i.boundingBox),r=(0,eV.resolvePptAiEditRequestMode)({selectionRef:a,selectionKind:i.selectionKind,elementType:i.elementType}),l=(0,eV.buildPptAiEditModePayload)({editMode:r,target:{...i,selectionRef:a}});ew.chatEventBus.emit("pptAiEditRequested",{prompt:t,editMode:r,modePayload:l,target:{...i,selectionRef:a},context:{deckId:i.deckId,fileGeneratedId:i.fileGeneratedId,sessionId:i.sessionId,artifactId:i.artifactId}}),(0,ed.devLog)("[PPT_NANO_EDIT] submit-requested",{selectionRef:a,selectionKind:i.selectionKind,elementType:i.elementType,deckId:i.deckId,slideId:i.slideId,artifactId:i.artifactId,boundingBox:i.boundingBox,artifactPixelBox:n}),(0,v.logPptAiEditDebug)("ppt-ai-edit-requested",{promptLength:t.length,selectionRef:a,deckId:i.deckId,fileGeneratedId:i.fileGeneratedId,sessionId:i.sessionId,artifactId:i.artifactId,editMode:r,selectionKind:i.selectionKind,contractVersion:i.contractVersion,boundingBox:i.boundingBox,artifactPixelBox:n})}({prompt:x,selectedTarget:i,selectedTargetSelectionRef:b});let m=d.length>0?[JSON.stringify({__reference_artifact__:!0,references:d}),...y.trim()?[y]:[]]:void 0,p=(0,eM.isScheduledTaskEntryProfile)(o?.getState().generalAgentEntryProfile),M={...u,inputValue:h,extraData:{...(S?{actionData:S}:void 0)??{},...{thinking:!0===t.thinking},timezone:(0,eN.getBrowserTimezone)()},...void 0!==t.activeConnectors?{activeConnectors:t.activeConnectors}:{},...T?{abortOnChatIdChangeFrom:N}:{},...m?{textParts:m}:{},...I?{reference:I}:{},...C.length>0?{canSendEmptyMessage:!0}:{},...p?{entryProfile:_.EGeneralSubType.SCHEDULED_TASK}:{}};if(!T)return void await e(M);await e({...M,deferResetUntilLoading:!0,onAfterEnterLoading:c})}finally{T&&ew.chatEventBus.emit("pptAiEditSubmitSettled"),m.current===f&&(m.current=null),p.current===c&&(p.current=null),c?.()}})}}({chatId:p,onFormSubmit:e,prepareEditorLockedSubmit:u,finishEditorLockedSubmit:c}),{submitHumanizeDocument:M}=function({onFormSubmit:e,form:t}){return{submitHumanizeDocument:(0,n.useMemoizedFn)(async({formValues:i,humanizeDocumentReference:a,sceneContribution:n})=>{let r="string"==typeof i.inputValue?i.inputValue:"",l={type:"artifact",artifact_id:a.artifactId};await e({...n,inputValue:r,...void 0!==i.activeConnectors?{activeConnectors:i.activeConnectors}:{},textParts:[JSON.stringify({__reference_artifact__:!0,references:[l]}),r],hideArtifactReferences:!0}),t.setFieldValue("humanizeDocumentReference",null)})}}({onFormSubmit:e,form:s}),S=(0,eu.useChatAguiChatInputSubmitRoutes)();return{onFormFinish:(0,n.useMemoizedFn)(async t=>{(0,ed.devLog)("formValues",t);let i=s.getFieldValue("pptAiEditTarget"),n=s.getFieldValue("pptAiEditTargets"),r=s.getFieldValue("pptAiEditMarkedTargets"),l=s.getFieldValue("humanizeDocumentReference"),d=t.humanizeDocumentReference??l,u=i??t.pptAiEditTarget,c=!!d||!!u||Array.isArray(n)&&n.length>0,m=S.find(e=>e.matches(t,{hasHostOwnedReference:c})),p=!!m,h=!p&&!!d,v=!p&&!h&&(!!u||Array.isArray(n)&&n.length>0),_=p?void 0:function(e,t){for(let i of e){let e=i.contribute?.(t);if(e)return e}}(S,t),b=f;(p||v||h)&&(b=o.EChatInputType.GENERIC),await (0,a.match)(b).with(o.EChatInputType.AI_IMAGE,()=>{g(t)}).with(o.EChatInputType.AI_VIDEO,()=>{x(t)}).with(o.EChatInputType.DEEP_RESEARCH,()=>{y(t)}).with(o.EChatInputType.AI_SLIDES,()=>{I(t)}).with(o.EChatInputType.AI_WRITER,()=>{C(t)}).with(o.EChatInputType.GENERIC_VIDEO,()=>E(t)).with(o.EChatInputType.GENERIC_IMAGE,()=>{throw Error("Image chat input submit route is not registered")}).with(o.EChatInputType.GENERIC,async()=>m?m.submit({formValues:t,onFormSubmit:e}):d&&!v?M({formValues:t,humanizeDocumentReference:d,sceneContribution:_}):N({formValues:t,selectedPptAiEditTarget:u,pptAiEditTargetsForSubmitMode:n,pptAiEditMarkedTargetsForSubmitMode:r,sceneContribution:_})).otherwise(()=>{T(t)})})}}({onFormSubmit:tc,form:e,prepareEditorLockedSubmit:(0,n.useMemoizedFn)(()=>!!e3(o.EChatInputType.GENERIC)&&(ek(!0),eI("isPrepareWait",!0),!0)),finishEditorLockedSubmit:(0,n.useMemoizedFn)(()=>{ek(!1),eI("isPrepareWait",!1)})});return{onFormFinish:tm,handleInputValueChange:ta,handleReset:tn,legacyAgentConfirmModal:tu,isEditorInteractionLocked:eC,multiModelPaywallGuide:e9}}],619564);var e6=e.i(987010),e3=e.i(35711),e7=e.i(484699),e9=e.i(107701),te=e.i(282620),tt=e.i(314206),ti=e.i(950839),ta=e.i(11846),tn=e.i(221457),tr=e.i(362420),tl=e.i(162709),to=e.i(259911);function ts(){let e=(0,tt.default)(),i=(0,ti.useNoRefreshUpdateChatByUrl)(),{chatId:r,chatType:s,containerType:d,selectedSkillFunctionValue:u,setChatContainerContext:c,updateContext:m}=(0,h.useChatContainerContext)(e=>({chatId:e.chatId,chatType:e.chatType,containerType:e.containerType,selectedSkillFunctionValue:e.selectedSkillFunctionValue,setChatContainerContext:e.getSetFunction(),updateContext:e.updateContext})),p=(0,l.useChatStore)(e=>e.getSetFunction()),g=(0,ta.useIsFrontContainer)(),x=(0,to.useLatestPathname)(),y=(0,f.useLatestSearchParams)(),I=(0,t.useMemo)(()=>
1[e4.URLS.HIXChat.photo_effects,e4.URLS.HIXChat.video_effects,e4.URLS.HIXChat.video_template,e4.URLS.HIXChat.image_template,"/hub"].some(e=>(0,e2.equalsOrStartsWithPath)(x,e)),[x]),C=tu(),v=(0,n.useMemoizedFn)(()=>{r&&p(e=>{let t=e.generalAgentMessageMetaByChatId[r];t&&(t.entry_profile=null);let i=e.chatInfoByGetChatDetail?.extra_data;(0,E.isObjectRecord)(i)&&(delete i.entryProfile,delete i.subType)})}),_=(0,n.useMemoizedFn)(async()=>{if(C&&!I){if(e?.resetFields(["similarInfo"]),u){v(),c(e=>{(0,eM.clearGeneralAgentEntryState)(e)});let e=d===o.EChatContainerType.CHAT_LIST&&x!==tl.SKILL_FUNCTION_ROUTE,t=g&&(0,e2.checkIsSkillCmsPagePath)(x);if(e)return void await i(tl.SKILL_FUNCTION_ROUTE,{chatType:tl.SKILL_FUNCTION_CHAT_TYPE,agentMode:tl.SKILL_FUNCTION_AGENT_MODE});if(x===tl.SKILL_FUNCTION_ROUTE&&y?.has(tl.SKILL_FUNCTION_QUERY_KEY)){let e=new URLSearchParams(y);e.delete(tl.SKILL_FUNCTION_QUERY_KEY);let t=e.toString();await i(`${x}${t?`?${t}`:""}`,{replace:!0,chatType:tl.SKILL_FUNCTION_CHAT_TYPE,agentMode:tl.SKILL_FUNCTION_AGENT_MODE});return}return void(t&&await i(e4.URLS.HIXChat.index))}if(d===o.EChatContainerType.PROJECT_ENTRY||d===o.EChatContainerType.SKILLS)return void m("chatType",o.EChatInputType.GENERIC);if(r&&(0,a.match)(s).with(o.EChatInputType.GENERIC_IMAGE,()=>!0).with(o.EChatInputType.GENERIC_VIDEO,()=>!0).with(o.EChatInputType.DEEP_RESEARCH,()=>!0).with(o.EChatInputType.AI_SLIDES,()=>!0).with(o.EChatInputType.AI_WRITER,()=>!0).otherwise(()=>!1)){v(),c(e=>{e.chatType=o.EChatInputType.GENERIC,e.agentMode="agui",e.showcaseFilter=(0,tr.getDefaultShowcaseFilter)(o.EChatInputType.GENERIC)});return}g&&(x===e4.URLS.HIXChat.ask_ai||x===e4.URLS.HIXChat.ai_coding)||await i(g?e4.URLS.HIXChat.index:e4.URLS.HIXChat.home),m("chatType",o.EChatInputType.GENERIC)}});return{isDisabled:I,clearEmbedPrefix:_}}function td(e){return(0,a.match)(e).with(o.EChatInputType.GENERIC_IMAGE,()=>(0,et.jsx)(ei.Trans,{id:"hG89Ed"})).with(o.EChatInputType.GENERIC_VIDEO,()=>(0,et.jsx)(ei.Trans,{id:"vSJd18"})).with(o.EChatInputType.DEEP_RESEARCH,()=>(0,et.jsx)(ei.Trans,{id:"bdztP2"})).with(o.EChatInputType.AI_SLIDES,()=>(0,et.jsx)(ei.Trans,{id:"Wn7BNn"})).with(o.EChatInputType.AI_WRITER,()=>(0,et.jsx)(ei.Trans,{id:"TbjyhA"})).with(o.EChatInputType.AI_CHAT,()=>(0,et.jsx)(ei.Trans,{id:"V-Qj-q"})).with(o.EChatInputType.AI_IMAGE,()=>(0,et.jsx)(ei.Trans,{id:"h9JkZm"})).with(o.EChatInputType.AI_VIDEO,()=>(0,et.jsx)(ei.Trans,{id:"FbVmUt"})).otherwise(()=>null)}function tu(){let e=(0,h.useChatContainerContext)(e=>e.chatType),i=(0,tn.useSelectedSkillFunction)();return(0,t.useMemo)(()=>e===tl.SKILL_FUNCTION_CHAT_TYPE&&i?i.content:td(e),[e,i])}e.s(["getEmbedPrefixContent",0,td,"useClearEmbedPrefixAction",0,ts,"useEmbedPrefixContent",0,tu],250475);var tc=e.i(206942),tm=e.i(616405);e.s(["default",0,function({slateEditorProps:e,disableUploadState:i,maxLength:a,form:n,editorKey:r,onEditorFocusChange:l,editorEnhancement:s,disableEditorInteraction:d,editorAutoFocus:u}){let{signUp:c}=(0,eH.useAppUIModal)(),m=(0,e3.useHixChatLoadingState)({exclude:["isGenerating"]}),{isSignIn:p}=(0,eG.useSessionInfo)(),f=(0,h.useChatContainerContext)(e=>e.containerType),g=![o.EChatContainerType.INDEX_ENTRY,o.EChatContainerType.HOME_ENTRY,o.EChatContainerType.SCHEDULED_TASKS].includes(f),x=r||ep.HIX_CHAT_FORM_MEDIA_KEYS.NORMAL;(0,e9.useRegisterChatForm)(x,n);let{slateEditorRef:y,editor:I,focus:C}=(0,e7.useChatFormEditor)(x,{autoFocus:u??g}),E=(0,te.useChatFormPlaceholder)({form:n}),v=(0,eK.useReferenceMediaMode)(n),{clearEmbedPrefix:_}=ts(),{handlePasteFile:T}=(0,b.useUploadFileList)(n),{editorProps:N,slateProps:M,wrapperClassName:S,restSlateEditorProps:k}=(0,t.useMemo)(()=>{let{editorProps:t,slateProps:i,wrapperClassName:a,...n}=e||{};return{editorProps:t,slateProps:i,wrapperClassName:tm.tw`${a}`,restSlateEditorProps:n}},[e]),{onChange:A,...w}=M||{};return{formEditorProps:(0,t.useMemo)(()=>({editor:I,mediaReferenceConfig:s?.mediaReferenceConfig,slateProps:{onChange:A,...w},editorProps:{maxLength:a,placeholder:E,onKeyDown:e=>{if(m){"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||e.preventDefault();return}
1!e6.Node.string(I)&&["Escape"].includes(e.key)&&f===o.EChatContainerType.HOME_ENTRY&&_()},onPaste:async e=>{let t=e.clipboardData.files.length>0;if(t&&v)return void e.preventDefault();if(t&&!i){if(!p)return void c.show({});e.preventDefault(),T(e)}},onCopy:e=>{if(e.preventDefault(),!I.selection)return;let t=e6.Editor.fragment(I,I.selection),i=(0,tc.serializeFragmentForCopy)(t);e.clipboardData.setData("text/plain",i)},...N,onFocus:e=>{l?.(!0),N?.onFocus?.(e)},onBlur:e=>{l?.(!1),N?.onBlur?.(e)},disabled:d||N?.disabled},wrapperClassName:S,...k,mentionOptions:[...k.mentionOptions??[],...s?.mentionOptions??[]]}),[_,f,i,d,I,N,s?.mediaReferenceConfig,s?.mentionOptions,T,m,p,v,a,l,E,k,w,c,A,S]),slateEditorRef:y,focus:C}}],571740);var tp=e.i(965200);e.s(["useHumanizeDocumentRequest",0,function({form:e,isFormDisabled:t,onFormFinish:i}){let a=(0,n.useMemoizedFn)(a=>{if(t)return;let n=(0,tp.getHumanizeDocumentPrompt)();i({...e.getFieldsValue(!0),inputValue:n,pptAiEditTarget:null,pptAiEditTargets:void 0,pptAiEditMarkedTargets:void 0,humanizeDocumentReference:a})});(0,eW.useListenEvents)(ew.chatEventBus,{requestHumanizeDocument:a})}],543010);var tf=e.i(405621);function th(e){let t=ez.Form.useFormInstance(),i=e??t;return{pptAiEditTarget:ez.Form.useWatch("pptAiEditTarget",{form:i,preserve:!0})??i?.getFieldValue?.("pptAiEditTarget"),pptAiEditMarkedTargets:ez.Form.useWatch("pptAiEditMarkedTargets",{form:i,preserve:!0})??i?.getFieldValue?.("pptAiEditMarkedTargets")}}e.s(["useFormPptAiEditTarget",0,function(e){let t,i,a,r,l,o=th(e),s=(t=ez.Form.useFormInstance(),i=(0,n.useMemoizedFn)(i=>{(e??t).setFieldsValue({pptAiEditTarget:i})}),a=(0,n.useMemoizedFn)(i=>{let a=i?.length?i:void 0;(e??t).setFieldsValue({pptAiEditMarkedTargets:a,pptAiEditTargets:a?.map(e=>e.target)})}),r=(0,n.useMemoizedFn)(()=>{(e??t).setFieldsValue({pptAiEditTarget:null,pptAiEditTargets:void 0,pptAiEditMarkedTargets:void 0})}),l=(0,n.useMemoizedFn)(()=>{r(),ew.chatEventBus.emit("pptAiEditExitRequested")}),{setPptAiEditTarget:i,setPptAiEditMarkedTargets:a,clearPptAiEditReferences:r,clearPptAiEditState:l});return{...o,...s}},"useFormPptAiEditTargetState",0,th],26509),e.s(["DEFAULT_PROMPT_WORD_LENGTH",0,8e3,"useFormValidate",0,function({promptWordLength:e,mediaTypeDisableSendButton:i,form:a,enableAiBackgroundValidate:n=!1,enablePptAiEditValidate:r=!1}){let s,d,u,{canSend:c,fileList:m,hasFailedFile:p,isUploading:f,maxLength:g,similarInfo:x}=function({promptWordLength:e,form:t,mediaTypeDisableSendButton:i}){let{fileList:a,isUploadFinished:n,hasFailedFile:r}=(0,b.useUploadFileList)(),l=a.length>0&&!n,o=(0,tf.useCanSend)(),{similarInfo:s}=(0,J.useFormSimilarState)(t);return{canSend:o,fileList:a,hasFailedFile:r,isUploading:l,maxLength:"number"==typeof e?e||8e3:void 0,similarInfo:s,mediaTypeDisableSendButton:i}}({promptWordLength:e,form:a,mediaTypeDisableSendButton:i}),y=(s=(0,h.useChatContainerContext)(e=>e.chatType),d=(0,l.useChatStore)(e=>e.isAiBackgroundActive),u=n&&d&&s===o.EChatInputType.AI_IMAGE,(0,t.useCallback)(e=>{if(u)return e>0},[u])),I=function({enabled:e,form:i}){let{pptAiEditTarget:a,pptAiEditMarkedTargets:n}=th(i);return(0,t.useCallback)(()=>{if(e){if(a||(n?.length??0)>0){let e=[a,...(n??[]).map(e=>e.target)];if(e.some(e=>e?.previewStatus==="loading")||e.some(e=>{if(!e||!(("string"==typeof e.selectionRef?e.selectionRef.trim():"").includes("layout-root")||"string"==typeof e.elementType&&"slide"===e.elementType.trim().toLowerCase()))return!1;let t="string"==typeof e.thumbnailDataUrl?e.thumbnailDataUrl.trim():"",i="string"==typeof e.currentSrc?e.currentSrc.trim():"";return!(t||i)}))return!1}if(("string"==typeof a?.selectionRef?a.selectionRef.trim():"").startsWith("nano-mark:")||(n?.length??0)>0)return!0}},[e,n,a])}({enabled:r,form:a}),C=(0,t.useCallback)(e=>{if(!c||f||p||i)return!1;let t=(0,A.getSlateInputCharacterText)(e.inputValue??"").trim().length;if("number"==typeof g&&t>g)return!1;let a=y(t);if("boolean"==typeof a)return a;if(x?.reference_id)return!0;let n=I();return"boolean"==typeof n?n:m.length>0||!!t},[c,f,p,i,m.length,g,x?.reference_id,y,I]),E=!!C(a.getFieldsValue());return{maxLength:g,formValidate:C,isFormValidatePass:E}}],401122);var tg=e.i(223025);let tx=(0,t.createContext)({isChatListLoading:!1,setIsChatListLoading:()=>{}});function ty({children:e,...t}){return(0,et.jsx)(tx.Provider,{value:t,children:e})}e.s(["ChatFormNormalContextProvider",0,ty,"useChatFormNormalContext",0,function(){return(0,t.useContext)(tx)}],457590);var tI=e.i(982952);let tC=(0,t.memo)(function(e){let{topSlot:t,bottomSlot:i,wrapperClassName:a}=e;return(0,et.jsxs)("div",{className:tI.cls`flex flex-col gap-2 empty:hidden ${a}`,children:[t,i]})});e.s(["default",0,function({form:e,isChatListLoading:t,isFormDisabled:i,onFormFinish:a,handleInputValueChange:n,chatInputValue:r,initialValues:l,className:o,boxContainerClassName:s,boxClassName:d,formHeaderTopSlot:u,formHeaderBottomSlot:c,formHeaderWrapperClassName:m,customValuesValidate:p,slateEditorProps:f,slateEditorRef:h,editFormItemProps:g,formRight:x,boxHeader:y,boxFooter:I,formFooter:C,renderFormContent:E,contentId:v,legacyAgentConfirmModal:_,multiModelPaywallGuide:b}){return(0,et.jsx)(ty,{isChatListLoading:t,children:(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)(tg.default,{form:e,formProps:{onFinish:e=>{i||a(e)},className:tm.tw`relative ${o}`,initialValues:{inputValue:l?.inputValue??r,...l},onValuesChange:n},editFormItemProps:g,customValuesValidate:p,slateEditorProps:f,slateEditorRef:h,boxContainerClassName:s,boxClassName:tm.tw`${d}`,formRight:x,formHeader:(0,et.jsx)(tC,{wrapperClassName:tm.tw`${m}`,topSlot:u,bottomSlot:c}),boxHeader:y,boxFooter:I,formFooter:C,renderFormContent:E,contentId:v}),_,b]})})}],248722);var tE=e.i(430931);e.s(["default",0,function({Component:e,...t}){let i=(0,h.useChatContainerContext)(e=>e.containerType);return(0,et.jsx)(e,{...t,className:i===o.EChatContainerType.INDEX_ENTRY?tE.INDEX_ENTRY_SCENE_INPUT_POSITION:i===o.EChatContainerType.HOME_ENTRY?tE.SCENE_INPUT_SLOT_HEIGHT.WITH_SECONDARY_CONTENT:tE.SCENE_INPUT_SLOT_HEIGHT.DEFAULT})}],301283),e.i(3246);var tv=e.i(870116),t_=e.i(56410),tb=e.i(200448),tT=e.i(449450);e.i(473430);var tN=e.i(147841);function tM(e){return"string"==typeof e?{guideCard:e,promptExample:e}:e}async function tS(e){try{let t=await fetch(e,{method:"HEAD"});if(!t.ok)return;let i=t.headers.get("content-length"),a=i?Number(i):void 0;return"number"==typeof a&&Number.isFinite(a)?a:void 0}catch{return}}e.s(["default",0,function({form:e,editorKey:i,isEditorFocused:a=!1,canShow:r=!0,promptChatType:s}){let u=(0,to.useLatestPathname)(),{chatType:c,containerType:m}=(0,h.useChatContainerContext)(e=>({chatType:e.chatType,containerType:e.containerType})),p=(0,tn.useSelectedSkillFunction)(),f=c===tl.SKILL_FUNCTION_CHAT_TYPE&&p,g=(0,tT.useIsScheduledTaskInputMode)(),x=(0,tT.useScheduledTaskFunction)(),y=((0,ei.useLingui)(),{[o.EChatInputType.AI_CHAT]:[{guideCard:C.i18n._({id:"OiW1lV"}),promptExample:C.i18n._({id:"ScsNoX"})},{guideCard:C.i18n._({id:"yl4vZ4"}),promptExample:C.i18n._({id:"jzEpFJ"})},{guideCard:C.i18n._({id:"Jj-dsD"}),promptExample:C.i18n._({id:"gmlA2M"})},{guideCard:C.i18n._({id:"Vh-hCe"}),promptExample:C.i18n._({id:"mR_N4_"})}],[o.EChatInputType.GENERIC_IMAGE]:[{guideCard:C.i18n._({id:"Kw_W2_"}),promptExample:C.i18n._({id:"6DI6EP"})},{guideCard:C.i18n._({id:"VN4Ttg"}),promptExample:C.i18n._({id:"Nw-DFD"})},{guideCard:C.i18n._({id:"_ECsFT"}),promptExample:C.i18n._({id:"T70bhl"})},{guideCard:C.i18n._({id:"Yo0cKq"}),promptExample:C.i18n._({id:"8X2G2s"})}],[o.EChatInputType.GENERIC_VIDEO]:[{guideCard:C.i18n._({id:"Q7xbBj"}),promptExample:C.i18n._({id:"hPVmJZ"})},{guideCard:C.i18n._({id:"vyCYLS"}),promptExample:C.i18n._({id:"XsbRNQ"})},{guideCard:C.i18n._({id:"yTIFXj"}),promptExample:C.i18n._({id:"_ZCVH9"})},{guideCard:C.i18n._({id:"GasSkB"}),promptExample:C.i18n._({id:"r_aBgo"})}],[o.EChatInputType.DEEP_RESEARCH]:[{guideCard:C.i18n._({id:"xrz33d"}),promptExample:C.i18n._({id:"4COu2o"})},{guideCard:C.i18n._({id:"ilhh0y"}),promptExample:C.i18n._({id:"Nuebg1"})},{guideCard:C.i18n._({id:"q3a8xB"}),promptExample:C.i18n._({id:"1t7nVp"})},{guideCard:C.i18n._({id:"7XfgJR"}),promptExample:C.i18n._({id:"0CYv0R"})}],[o.EChatInputType.AI_SLIDES]:[{guideCard:C.i18n._({id:"3XojiB"}),promptExample:C.i18n._({id:"xYUSyd"})},{guideCard:C.i18n._({id:"9BA8e_"}),promptExample:C.i18n._({id:"RTU_E7"})},{guideCard:C.i18n._({id:"tfWVhS"}),promptExample:C.i18n._({id:"vtYo-Y"})},{guideCard:C.i18n._({id:"2uDEV9"}),promptExample:C.i18n._({id:"IFq24C"})}],[o.EChatInputType.AI_WRITER]:[{guideCard:C.i18n._({id:"_b3SSi"}),promptExample:C.i18n._({id:"b5q_68"})},{guideCard:C.i18n._({id:"jQe095"}),promptExample:C.i18n._({id:"UBQ7ng"})},{guideCard:C.i18n._({id:"-hlhiC"}),promptExample:C.i18n._({id:"N6GnVv"})},{guideCard:C.i18n._({id:"PiDttL"}),promptExample:C.i18n._({id:"cmJL32"})}],[o.EChatInputType.GENERIC]:[{guideCard:C.i18n._({id:"AkrlFb"}),promptExample:C.i18n._({id:"A2TVjg"})},{guideCard:C.i18n._({id:"P3Dp2F"}),promptExample:C.i18n._({id:"-qHHcy"})},{guideCard:C.i18n._({id:"Ktud0g"}),promptExample:C.i18n._({id:"arwFW7"})},{guideCard:C.i18n._({id:"gYLZ6Y"}),promptExample:C.i18n._({id:"jiBZnr"})}],[o.EChatInputType.AI_IMAGE]:[],[o.EChatInputType.AI_VIDEO]:[]}),{setInputValue:I}=(0,Y.useChatInput)(),{onAddUploadedFile:E}=(0,b.useUploadFileList)(e),[v,_]=(0,t.useState)(!1),T=(0,t.useRef)(null),N=i===ep.FRONT_ENTRY_FLOAT_EDITOR_KEY,M=u===e4.URLS.HIXChat.home||m===o.EChatContainerType.SCHEDULED_TASKS&&g,S=ez.Form.useWatch("inputValue",e),k=ez.Form.useWatch("modelName",e),A=(0,l.useChatStore)(e=>e.fileListMap.chat.length),w=(0,t.useMemo)(()=>
1g?x?.prompts:f?p.prompts:y[s??c],[c,y,g,f,s,x,p]),j=(0,t.useMemo)(()=>w?.map(tM),[w]),F=!!S,R=(0,t.useMemo)(()=>c===o.EChatInputType.AI_IMAGE?k===d.EVideoModel.IMAGE_AGENT:c!==o.EChatInputType.AI_VIDEO||k===d.EVideoModel.VIDEO_AGENT,[c,k]),L=(0,t.useMemo)(()=>r&&M&&!N&&a&&!v&&R&&!F&&!A&&!!j?.length,[r,A,F,a,N,v,M,j?.length,R]);(0,t_.useUpdateEffect)(()=>{_(!1)},[c,g,k,u,p]),(0,t_.useUpdateEffect)(()=>{a||_(!1)},[a]),(0,t.useEffect)(()=>{let e=T.current?.closest("[data-scheduled-task-formbox]");if(e)return L?(e.style.borderBottomLeftRadius="0px",e.style.borderBottomRightRadius="0px"):(e.style.borderBottomLeftRadius="",e.style.borderBottomRightRadius=""),()=>{e.style.borderBottomLeftRadius="",e.style.borderBottomRightRadius=""}},[L]);let V=(0,n.useMemoizedFn)(async t=>{_(!0);let{promptExample:a,fileUrls:n}=t;e.setFieldValue("inputValue",a),I(a,"chat"),requestAnimationFrame(()=>{tN.chatFormEditorMedia.focus(i||ep.HIX_CHAT_FORM_MEDIA_KEYS.NORMAL,{cursor:"end"})}),(await Promise.all(n?.map(async e=>({name:(0,em.resolveBasename)(e),url:e,size:await tS(e)}))??[])).forEach(e=>{E({name:e.name,url:e.url,size:e.size})})}),{activeIndex:D,setActiveIndex:O}=(0,tb.useKeyboardListNavigation)({enabled:L,items:j,onSelect:e=>{V(e)}});return(0,et.jsx)("ul",{ref:T,role:"listbox","aria-hidden":!L,className:tm.tw`
2        flex flex-col bg-f-bg-container 
3        rounded-b-[20px] absolute left-[-1px] z-[10] w-[calc(100%+2px)] top-full gap-1 border border-f-border overflow-hidden transition-all duration-200 ease-out
4        ${L?"h-[144px] py-[10px] opacity-100":"h-[0px] opacity-0"}
5      `,children:j?.map((e,t)=>(0,et.jsxs)("li",{role:"option","aria-selected":t===D,className:tm.tw`
6            group/item flex items-center justify-between text-f-text-secondary
7            px-3 py-1.5 text-xs leading-4 cursor-pointer
8            ${t===D&&"bg-f-bg-elevated text-f-text"}
9          `,onMouseDown:e=>{e.preventDefault()},onMouseEnter:()=>{O(t)},onClick:t=>{t.stopPropagation(),V(e)},children:[(0,et.jsx)("span",{className:"line-clamp-1 flex-1",children:e.guideCard}),(0,et.jsx)(tv.IconItem,{className:tm.tw`
10              hidden md:block size-4 shrink-0  i-cus--hix2-arrow-right-up
11              ${t===D&&"block"}
12            `})]},e.guideCard||t))})}],628857);var tk=e.i(457079);e.s(["GenerateConnectorsForm",()=>tk.default],188631);var tA=e.i(380707),tw=e.i(956289),tj=e.i(861512),tF=e.i(999605),tR=e.i(321089),tL=e.i(645217);function tV(e){let{getDropContainer:i,className:a,children:n,disabled:r,ref:l,onSuccess:o,...s}=e,[d,u]=(0,t.useState)(),c=(0,t.useRef)(null),[m,p]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{let e=i?.();d!==e&&u(e)},[i,u]),(0,t.useEffect)(()=>{if(d){let e=e=>e.dataTransfer?.types?.includes("Files")&&!document.querySelector('[data-disable-global-file-drop="true"]'),t=t=>{e(t)&&p(!0)},i=t=>{e(t)&&t.preventDefault()},a=e=>{e.relatedTarget||p(!1)},n=t=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{p(!1)},100),e(t)&&t.preventDefault()};return document.addEventListener("dragenter",t),document.addEventListener("dragover",i),document.addEventListener("dragleave",a),document.addEventListener("drop",n),()=>{document.removeEventListener("dragenter",t),document.removeEventListener("dragover",i),document.removeEventListener("dragleave",a),document.removeEventListener("drop",n)}}},[!!d]),i&&d&&!r?(0,tR.createPortal)((0,et.jsxs)("div",{className:tm.tw`fixed inset-0 z-[1314] ${a}`,style:{display:m?"block":"none"},children:[(0,et.jsx)("div",{style:{backdropFilter:"blur(20px)"},className:"absolute inset-0 bg-white bg-opacity-30"}),(0,et.jsx)(tF.Upload.Dragger,{showUploadList:!1,multiple:!0,name:"file",beforeUpload:(e,t)=>(o?.({fileList:e,frame:1,selectedCount:t.length}),!1),...s,accept:void 0,ref:l,style:{padding:0,border:0,background:"transparent"},children:n||(0,et.jsxs)("div",{className:"flex flex-col items-center justify-center",children:[(0,et.jsx)("p",{className:"flex justify-center",children:(0,et.jsx)(tL.default,{src:"/images/chat/cus-hix-drag.webp",alt:"hix-drag",width:120,height:96})}),(0,et.jsx)("p",{className:"text-f-text text-base font-semibold mt-4",children:C.i18n._({id:"ONWvwQ"})}),(0,et.jsx)("p",{className:"text-f-text-secondary text-sm mt-3",children:C.i18n._({id:"F21nWs"})})]})})]}),d):null}var tD=e.i(586885);let tO=t.default.memo(function(e){let{disabled:t,tooltipProps:i,...a}=e,{aspectOptions:n}=(0,tj.useModelAspect)(),r=(0,tw.useIsGenericSendMode)(),l=(0,h.useChatContainerContext)(e=>e.chatType),s=r||l===o.EChatInputType.AI_CHAT;return(0,et.jsx)(et.Fragment,{children:(0,et.jsxs)(tA.default,{tooltipProps:{title:(0,et.jsx)("p",{className:"text-xs",children:t?C.i18n._({id:"Kv9TSU"}):C.i18n._({id:"UrgsSr"})}),placement:s?"topLeft":"top",...i},children:[s?(0,et.jsx)(tD.ChatUpload,{...a,disabled:t,aspectOptions:n}):(0,et.jsx)(tD.ChatUpload,{...a,disabled:t,aspectOptions:n,children:(0,et.jsxs)(ea.default,{disabled:t,variant:"default",className:"gap-x-1 whitespace-nowrap",children:[(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-add-image size-[18px]"}),C.i18n._({id:"ONWvwQ"})]})}),(0,et.jsx)("div",{children:(0,et.jsx)(tV,{...a,disabled:t,className:"border-none",getDropContainer:()=>document.body})})]})})});e.s(["default",0,tO],713772);var tP=e.i(929891);e.i(575780);var tz=e.i(728327),tU=e.i(620685),tG=e.i(153149);let tH={[o.EChatInputType.AI_CHAT]:{badgeClassName:"bg-[#EEFBFF]",foregroundClassName:"text-f-blue-5"},[o.EChatInputType.AI_IMAGE]:{badgeClassName:"bg-[#FFF4E9]",foregroundClassName:"!text-[#FF8D24]"},[o.EChatInputType.AI_VIDEO]:{badgeClassName:"bg-[#F5F5FF]",foregroundClassName:"!text-[#2C2FD4]"},[o.EChatInputType.GENERIC_IMAGE]:{badgeClassName:"bg-[#FFF8ED]",foregroundClassName:"!text-[#E3971F]"},[o.EChatInputType.GENERIC_VIDEO]:{badgeClassName:"bg-[#F3E9FF]",foregroundClassName:"!text-[#8A38F5]"},[o.EChatInputType.DEEP_RESEARCH]:{badgeClassName:"bg-[#EEF6FF]",foregroundClassName:"!text-[#007AFF]"},[o.EChatInputType.AI_SLIDES]:{badgeClassName:"bg-f-red-1",foregroundClassName:"text-f-red-6"},[o.EChatInputType.AI_WRITER]:{badgeClassName:"bg-[#F2FFEE]",foregroundClassName:"!text-[#409B3F]"}};e.s(["ChatModeBadge",0,function(){let{chatId:e,chatType:i,containerType:a}=(0,h.useChatContainerContext)(e=>({chatId:e.chatId??null,chatType:e.chatType,containerType:e.containerType})),n=(0,ti.useNoRefreshUpdateChatByUrl)(),s=(0,tn.useSelectedSkillFunction)(),d=(0,tT.useScheduledTaskFunction)(),{chatInfoAgentType:u,chatInfoExtraData:c,chatDetailAgentType:m,chatDetailExtraData:p}=(0,l.useChatStore)(e=>({chatInfoAgentType:e.chatInfoByGetChatDetail?.agent_type,chatInfoExtraData:e.chatInfoByGetChatDetail?.extra_data,chatDetailAgentType:e.chatDetail?.agent_type,chatDetailExtraData:e.chatDetail?.extra_data})),f=(0,t.useMemo)(()=>e?(0,tz.getScheduledTaskExecutionMetaFromExtraData)(e,c??p):null,[p,e,c]),g=u===r.EAgentType.SCHEDULED_TASK||m===r.EAgentType.SCHEDULED_TASK,x=a===o.EChatContainerType.SCHEDULED_TASKS,y=(0,tT.useIsScheduledTaskInputMode)(),{deactivateScheduledTaskInputMode:I}=(0,tT.useScheduledTaskInputModeActions)(),{clearEmbedPrefix:C,isDisabled:E}=ts(),v=tu(),_=(0,t.useMemo)(()=>s?.style?{badgeClassName:"",foregroundClassName:"",style:{backgroundColor:`${s.style}1A`,color:s.style}}:{badgeClassName:"bg-[#F5F5FF]",foregroundClassName:"text-f-text"},[s]),b=(0,t.useCallback)(async()=>{(e||x)&&await n(e4.URLS.HIXChat.home,{chatType:o.EChatInputType.GENERIC}),I()},[e,I,x,n]),T=(0,et.jsx)(tG.ChatModeBadgeButton,{icon:(0,et.jsx)(tU.IconItem,{className:tI.cls`size-[18px] text-[#0082EE] ${d?.icon_key??"i-cus--hix2-schedule-task"}`}),label:d?.content??(0,et.jsx)(ei.Trans,{id:"8OiyFS"}),badgeClassName:"bg-[#F1F8FF]",foregroundClassName:"text-[#0082EE]",isDisabled:!1,onClear:b});if(x||g||f)return T;if(i===o.EChatInputType.GENERIC)return y?T:s&&v?(0,et.jsx)(tG.ChatModeBadgeButton,{icon:(0,et.jsx)(tU.IconItem,{className:tI.cls`size-[18px] ${s.icon_key}`}),label:v,badgeClassName:_.badgeClassName,foregroundClassName:_.foregroundClassName,style:_.style,isDisabled:E,onClear:C}):null;if(!v)return null;let N=tH[i];return(0,et.jsx)(tG.ChatModeBadgeButton,{icon:(0,et.jsx)(tP.default,{chatType:i,className:tI.cls`size-[18px] ${N.foregroundClassName}`}),label:v,badgeClassName:N.badgeClassName,foregroundClassName:N.foregroundClassName,isDisabled:E,onClear:C})}],844572);var tB=e.i(422569),tW=e.i(533676),t$=e.i(417668);let tq={internet:"i-cus--hix2-globe",news:"i-cus--hix2-news",academic:"i-cus--hix2-academic"};e.s(["ChatNetWork",0,function(e){let{className:i,disabled:a}=e,n=[{name:tB.NetWorkType.Web,icon:"i-cus--hix2-globe",desc:C.i18n._({id:"XIbbJE"})},{name:tB.NetWorkType.News,icon:"i-cus--hix2-news",desc:C.i18n._({id:"DVG11M"})}
12,{name:tB.NetWorkType.Academic,icon:"i-cus--hix2-academic",desc:C.i18n._({id:"xAOwkk"})}],{netWorkType:r,updateStates:o}=(0,l.useChatStore)(e=>({netWorkType:e.netWorkType,updateStates:e.updateState})),s={internet:C.i18n._({id:"cKiG0Z"}),news:C.i18n._({id:"qdyV_M"}),academic:C.i18n._({id:"ChasOQ"})},[d,u]=(0,t.useState)(!1),[c,m]=(0,t.useState)(!1);return(0,et.jsx)(tW.default,{open:d,onOpenChange:e=>{e||(u(!1),m(!1))},content:()=>(0,et.jsx)("ul",{className:"flex flex-col w-[306px] gap-1 xs:w-56",children:n.map(e=>(0,et.jsxs)("li",{onClick:()=>{e.name===r?o("netWorkType",null):o("netWorkType",e.name),setTimeout(()=>{u(!1),m(!1)},100)},className:tI.cls`
13              flex flex-col items-start gap-1 cursor-pointer rounded-xl p-2 group hover:bg-f-bg-layout
14              ${r===e.name&&"bg-f-bg-layout"}
15            `,children:[(0,et.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,et.jsxs)("p",{className:tI.cls`flex items-center gap-1 text-sm leading-5 font-semibold ${r===e.name?"text-f-text":"text-f-text-secondary"} group-hover:text-f-text`,children:[(0,et.jsx)(tv.IconItem,{className:`
16                    ${e.icon} shrink-0 size-[18px] group-hover:text-f-text
17                    ${r===e.name?"text-f-text":"text-f-text-secondary "}
18                  `}),s[e.name]]}),(0,et.jsx)(t$.default,{checked:r===e.name})]}),(0,et.jsx)("p",{className:"text-f-text-tertiary text-xs",children:e.desc})]},e.name))}),placement:"bottomLeft",trigger:["click"],children:(0,et.jsx)("span",{children:(0,et.jsx)(tA.default,{tooltipProps:{open:c&&!d,onOpenChange:m,title:(0,et.jsx)("p",{className:"text-xs",children:C.i18n._({id:"_ZRC9t"})})},children:(0,et.jsxs)(ea.default,{variant:"default",color:"default",disabled:a,className:tm.tw`
19              rounded-full gap-1 p-[7px] overflow-hidden
20              ${r?"text-[#007AFF] hover:!text-[#007AFF] disabled:!text-[#007AFF] px-[10px]":"disabled:!text-[#000000D9]"}
21              ${i}
22            `,onClick:e=>{e.stopPropagation(),a||u(!0)},children:[(0,et.jsx)(tv.IconItem,{className:`${tq[r??"internet"]} size-[18px] shrink-0`}),r?(0,et.jsx)("span",{className:"select-none",children:s[r]}):null]})})})})}],628269);var tK=e.i(104873);e.s(["ChatForceCompression",0,function(){let[e,i]=(0,t.useState)(tK.isAiChatForceCompressionEnabled);return(0,et.jsx)(tA.default,{title:"Force context compression",children:(0,et.jsxs)(ea.default,{variant:"default",color:"default",className:tm.tw`
23          rounded-full gap-1 p-[7px] overflow-hidden
24          ${e?"text-[#007AFF] hover:!text-[#007AFF] px-[10px]":""}
25        `,onClick:t=>{t.stopPropagation();let a=!e;(0,tK.setAiChatForceCompressionEnabled)(a),i(a)},children:[(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-sent size-[18px] shrink-0"}),e&&(0,et.jsx)("span",{className:"select-none",children:"Compress"})]})})}],2292);var tX=e.i(263700),tY=e.i(105147),tQ=e.i(473406),tJ=e.i(795756);e.s(["default",0,({onRecognizing:e,disabled:i,className:a=""})=>{let{isRecording:r,setIsRecording:o}=(0,l.useChatStore)(e=>({isRecording:e.isRecording,setIsRecording:e.setIsRecording})),s=(0,e3.useHixChatLoadingState)(),[d,u]=(0,t.useState)(!1),[c,m]=(0,t.useState)(!1),p=(0,tQ.useLocale)(),{startSttFromMic:f,stopSttFromMic:h,isLoading:g}=(0,tY.useSttFromMic)({onRecognized:t=>{e?.(t)},onListening:e=>{o(e)},onError:()=>{u(!0),o(!1)}}),x=(0,n.useMemoizedFn)(()=>{r&&(o(!1),h())}),y=async()=>{if(!g){if(r)return void x();try{let e=tJ.langArr.find(e=>e.abbr===p);f({speechLocale:e?.lang||"en-US"})}catch(e){(0,ed.devLog)("err",e),u(!0),o(!1)}}};(0,t.useEffect)(()=>(s&&x(),()=>{x()}),[s,x]);let I=(0,n.useMemoizedFn)(()=>{u(!1),m(!1)}),E=(0,et.jsxs)("div",{className:"relative flex w-[568px] max-w-[calc(100vw-32px)] flex-col items-start rounded-[18px] border border-f-border bg-f-bg-base px-6 py-5 shadow-[0_1px_3px_0_rgba(28,39,49,0.10)]",children:[(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-x absolute right-6 top-5 size-6 cursor-pointer text-f-text-quaternary hover:text-f-text",onClick:e=>{e.stopPropagation(),I()}}),(0,et.jsxs)("div",{className:"flex w-full items-start gap-4 pr-10",children:[(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-microphone-close mt-0.5 size-6 shrink-0 text-f-error-hover"}),(0,et.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,et.jsx)("p",{className:"text-f-text text-base font-medium leading-6",children:C.i18n._({id:"bJcxcs"})}),(0,et.jsx)("p",{className:"mt-3 text-sm leading-5 text-f-text-secondary",children:(0,et.jsx)(ei.Trans,{id:"OHkIlI"})})]})]}),(0,et.jsx)("div",{className:"mt-5 flex w-full justify-end",children:(0,et.jsx)(ea.default,{color:"modalConfirm",className:"h-[32px] w-[72px] rounded-[8px] text-xs",onClick:e=>{e.stopPropagation(),I()},children:C.i18n._({id:"zga9sT"})})})]});return(0,et.jsx)("div",{className:tI.cls`${a} relative`,children:(0,et.jsx)(tX.Popover,{content:E,title:null,trigger:["click"],open:d,onOpenChange:e=>{e||I()},placement:"topRight",arrow:!1,overlayClassName:"[&_.coco-popover-inner]:bg-transparent [&_.coco-popover-inner]:p-0 [&_.coco-popover-inner]:shadow-none",overlayInnerStyle:{borderRadius:"18px",padding:0},children:(0,et.jsx)("div",{children:(0,et.jsx)(tA.default,{tooltipProps:{open:c&&!d,onOpenChange:m,title:r?C.i18n._({id:"pJ_IRc"}):C.i18n._({id:"IJaotC"})},children:(0,et.jsx)(ea.default,{disabled:i||g,color:"default",onClick:e=>{e.stopPropagation(),i||y()},className:tm.tw`${a} p-2 rounded-full border-none`,children:(0,et.jsx)(tv.IconItem,{className:tI.cls`${g?"i-cus--hix2-loading animate-spin":r?"i-cus--hix2-soundwave":"i-cus--hix2-microphone"} size-[18px] text-f-text`})})})})})})}],157091);var tZ=e.i(200562);e.i(490297);var t0=e.i(832172),t1=e.i(563758),t2=e.i(267786),t8=e.i(187674),t5=e.i(503373),t4=e.i(591129),t6=e.i(351380),t3=e.i(65268),t7=e.i(687294),t9=e.i(718451),ie=e.i(655112),it=e.i(730738),ii=e.i(187132),ia=e.i(499164),ir=e.i(722864),il=e.i(640724),io=e.i(334448),is=e.i(913707),id=e.i(704731),iu=e.i(172535);function ic(e,t){return tI.cls`
26    flex shrink-0 items-center justify-center border bg-f-bg-base text-sm hover:border-f-border-hover hover:bg-f-bg-hover
27    ${"project"===t?"h-8 rounded-md border-f-border-secondary px-3 py-1.5 leading-5":"h-[30px] rounded-lg border-f-border py-2 px-1.5 leading-4"}
28    ${e?"font-medium text-f-text bg-f-bg-layout":"text-f-text-tertiary"}
29  `}function im({activeCategory:e,items:i,variant:a="default",onChange:n}){let r=(0,t.useRef)(null),l=(0,t.useRef)(null),[o,s]=(0,t.useState)(i.length);(0,x.useIsomorphicLayoutEffect)(()=>{let e=r.current,t=l.current;if(!e||!t)return;let a=Array.from(t.querySelectorAll("[data-category-tab]")),n=t.querySelector("[data-category-more]");if(a.length!==i.length||!n)return;let o=()=>{let i=e.getBoundingClientRect().width,r=Number.parseFloat(getComputedStyle(t).columnGap
29)||0,l=a.map(e=>e.getBoundingClientRect().width);if(l.reduce((e,t)=>e+t,0)+r*Math.max(0,l.length-1)<=i)return void s(e=>e===l.length?e:l.length);let o=Math.max(0,i-n.getBoundingClientRect().width-r),d=0,u=0;for(let e of l){let t=u+(d>0?r:0)+e;if(t>o)break;u=t,d+=1}s(e=>e===d?e:d)};o();let d=new ResizeObserver(o);return d.observe(e),d.observe(n),a.forEach(e=>d.observe(e)),()=>d.disconnect()},[i.length]);let d=Math.min(o,i.length),u=i.slice(0,d),c=i.slice(d),m=c.some(t=>t.key===e);return(0,et.jsxs)("div",{ref:r,className:"relative flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden",children:[u.length?(0,et.jsx)("div",{role:"tablist","aria-label":C.i18n._({id:"WLJZAK"}),className:"flex min-w-0 items-center gap-1.5",children:u.map(t=>{let i=t.key===e;return(0,et.jsx)("button",{type:"button",role:"tab","aria-selected":i,onClick:()=>n(t.key),className:ic(i,a),children:(0,et.jsx)(iu.default,{children:t.label})},t.key)})}):null,c.length?(0,et.jsx)(id.default,{trigger:["click"],placement:"bottomRight",overlayStyle:{minWidth:160},menu:{items:c.map(e=>({key:e.key,label:e.label,onClick:()=>n(e.key)})),selectable:!0,selectedKeys:m?[e]:[]},children:(0,et.jsx)("button",{type:"button","aria-label":C.i18n._({id:"zbACj2"}),className:ic(m,a),children:(0,et.jsx)(tv.IconItem,{className:tI.cls`size-4 ${"project"===a?"i-cus--hix2-right":"i-cus--hix2-more"}`})})}):null,(0,et.jsxs)("div",{ref:l,"aria-hidden":"true",className:"invisible pointer-events-none absolute left-0 top-0 flex w-max items-center gap-1.5",children:[i.map(t=>(0,et.jsx)("span",{"data-category-tab":!0,className:ic(t.key===e,a),children:(0,et.jsx)(iu.default,{children:t.label})},t.key)),(0,et.jsx)("span",{"data-category-more":!0,className:ic(!1,a),children:(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-more size-4"})})]})]})}function ip({activeCategory:e,variant:t="default",searchQuery:i,onCategoryChange:a,onSearchChange:n}){let{i18n:r,_:l}=(0,ei.useLingui)(),o=[{key:is.SKILL_MARKETPLACE_ALL_FILTER.key,label:r._(is.SKILL_MARKETPLACE_ALL_FILTER.message)},...is.SKILL_MARKETPLACE_CATEGORIES.map(e=>({key:e.key,label:r._(e.message)}))];return(0,et.jsxs)("div",{className:tI.cls`flex min-w-0 items-center justify-between sm:flex-col sm:items-stretch ${"project"===t?"gap-3":"gap-4"}`,children:[(0,et.jsx)(im,{activeCategory:e,items:o,variant:t,onChange:a}),(0,et.jsxs)("label",{className:tI.cls`flex shrink-0 items-center rounded-lg border border-f-border bg-f-bg-base focus-within:border-f-text sm:w-full ${"project"===t?"h-8 w-[200px] gap-1 px-1.5":"h-[30px] w-52 gap-1.5 px-2"}`,children:[(0,et.jsx)(tv.IconItem,{className:tI.cls`i-cus--hix2-search shrink-0 text-f-text-tertiary ${"project"===t?"size-[18px]":"size-4"}`}),(0,et.jsx)("span",{className:"sr-only",children:(0,et.jsx)(ei.Trans,{id:"BlLxpG"})}),(0,et.jsx)("input",{type:"search",value:i,placeholder:C.i18n._({id:"A1taO8"}),onChange:e=>n(e.target.value),className:tI.cls`min-w-0 flex-1 border-0 bg-transparent p-0 text-f-text outline-none placeholder:text-f-text-tertiary ${"project"===t?"text-sm leading-5":"text-xs leading-4"}`})]})]})}function ih({added:e,adding:t,disabled:i,onAdd:a}){return e?(0,et.jsx)("span",{className:"shrink-0 text-sm leading-5 text-f-text-quaternary",children:(0,et.jsx)(ei.Trans,{id:"hp8OtS"})}):(0,et.jsxs)(ea.default,{"aria-label":C.i18n._({id:"MVvf-R"}),disabled:i,loading:t,color:"text",rounded:"sm",padding:"none",loadingClassName:"size-4",loadingTransition:!1,className:"h-[26px] shrink-0 gap-0.5 border border-f-border-secondary px-1.5 text-sm leading-5 text-f-text-secondary group-hover:enabled:!border-f-text group-hover:enabled:!bg-f-text group-hover:enabled:!text-f-text-light",onClick:a,children:[t?null:(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-add-image size-4 shrink-0"}),(0,et.jsx)(ei.Trans,{id:"m16xKo"})]})}function ig(e){return e.project.referenced}function ix(e){let t=new Set;for(let i of e){if("official"===i.basic.sourceType){i.project.referenced&&t.add(i.basic.skillName);continue}t.add(i.basic.skillName)}return t}function iy(e){return e.state.removable?["download","edit","replace"]:e.state.readOnly?["download","edit","replace","delete"]:"official"===e.basic.sourceType?["download","edit","replace"]:void 0}e.s(["default",0,ip],563986);var iI=e.i(748155),iC=e.i(214698);function iE(e){return"official"===e.basic.sourceType&&!e.state.available&&!e.project.referenced}let iv=(0,ie.default)(()=>
29e.A(152364),{loadableGenerated:{modules:[664454]},ssr:!1}),i_=[{key:"user",label:(0,et.jsx)("span",{className:"whitespace-nowrap",children:(0,et.jsx)(ei.Trans,{id:"y2NFB-"})})},{key:"official",label:(0,et.jsx)("span",{className:"whitespace-nowrap",children:(0,et.jsx)(ei.Trans,{id:"2PVDkk"})})},{key:"marketplace",label:(0,et.jsx)("span",{className:"whitespace-nowrap",children:(0,et.jsx)(ei.Trans,{id:"hr5ulg"})})}];function ib(e){let{activeTab:i,location:a,open:n,projectId:r,onCancel:l,onChangeTab:o}=e,[s,d]=(0,t.useState)(null),[u,c]=(0,t.useState)(!1),[m]=(0,t.useState)(()=>new Map),p=function(e){let{activeTab:i,location:a,open:n,projectId:r}=e,{user:l}=(0,t8.useAccountContext)(),o=(0,tQ.useLocale)(),s=t9.api.useUtils(),{failedAddSkillMessage:d,getImportErrorMessage:u}=(0,iI.useSkillImportErrorMessages)(),[c,m]=(0,t.useState)(()=>new Set),p=(0,t.useRef)(new Set),[f,h]=(0,t.useState)(()=>new Map),[g,x]=(0,t.useState)(null),[y,I]=(0,t.useState)("all"),[E,v]=(0,t.useState)(""),_=(0,t5.getLanguageByCode)(o).code,b=n&&l.isSignIn&&!!l.userId,T=t9.api.skillHub.listSkills.useInfiniteQuery({projectId:r,scene:"marketplace"===i?"marketplace":"manage",source:"marketplace"===i?"all":i,limit:"marketplace"===i?void 0:20,language:_},{enabled:b,getNextPageParam:e=>e.nextCursor??void 0}),N=t9.api.skillHub.listSkills.useQuery({projectId:r,scene:"picker",language:_},{enabled:!!l.userId}),M=t9.api.skillHub.forkSkill.useMutation(),S=(0,t.useMemo)(()=>(T.data?.pages.flatMap(e=>(0,t4.selectSkillCardModels)(e))??[]).map(e=>{let t=f.get(e.basic.skillName);return void 0===t?e:{...e,project:{...e.project,referenced:t===e.basic.skillId}}}).filter(e=>!iE(e)||ig(e)),[f,T.data]),k=(0,t.useMemo)(()=>"marketplace"===i?(0,t4.selectSkillCardModels)({skills:(0,iC.selectMarketplaceSkills)(S,{activeCategory:y,searchQuery:E})}):S,[y,i,E,S]),A=(0,t.useMemo)(()=>{if(!N.data)return new Set;let e=ix((0,t4.selectSkillCardModels)(N.data));return f.forEach((t,i)=>e.add(i)),e},[f,N.data]),w=(0,t.useMemo)(()=>g?[{skillName:g.basic.skillName}]:[],[g]);(0,t7.useRefetchProjectQueryForUser)(l.userId,b,T.refetch);let F=(0,t.useCallback)(async e=>{if(p.current.has(e.basic.skillName))return;p.current.add(e.basic.skillName),m(new Set(p.current));let t="marketplace"===i?"explore_skill":"official"===e.basic.sourceType?"official":"my_skill";try{let i;try{i=await M.mutateAsync({projectId:r,skillIds:[e.basic.skillId]})}catch(i){(0,j.trackProject)({id:r,type:"add_a_skill",method:"add_skill_entry_click",status:1,itemName:e.basic.displayName,field2:t,location:a,errorMsg:(0,j.getProjectTrackErrorMsg)(i)}),e8.message.error(d);return}if(i.error){(0,j.trackProject)({id:r,type:"add_a_skill",method:"add_skill_entry_click",status:1,itemName:e.basic.displayName,field2:t,location:a,errorMsg:(0,j.getProjectTrackErrorMsg)(i.error)}),e8.message.error(u(i.error,d));return}let n=i.results.find(e=>"failed"===e.status);if(n?.error){(0,j.trackProject)({id:r,type:"add_a_skill",method:"add_skill_entry_click",status:1,itemName:e.basic.displayName,field2:t,location:a,errorMsg:(0,j.getProjectTrackErrorMsg)(n.error)}),e8.message.error(u(n.error,d));return}let l=i.results.find(e=>"success"===e.status);l&&h(t=>new Map(t).set(e.basic.skillName,e.basic.skillId)),(0,j.trackProject)({id:r,type:"add_a_skill",method:"add_skill_entry_click",status:0,itemName:e.basic.displayName,field2:t,location:a}),await s.skillHub.listSkills.invalidate({projectId:r}),l?.isReplace?e8.message.success(C.i18n._({id:"6DMJQt",values:{0:l.skillName}})):e8.message.success(C.i18n._({id:"jhdhBh"}))}finally{p.current.delete(e.basic.skillName),m(new Set(p.current))}},[i,s.skillHub.listSkills,d,M,u,a,r]),R=(0,t.useCallback)(async e=>{if(!(iE(e)||ig(e)||!N.data||c.has(e.basic.skillName))){if(!ig(e)&&A.has(e.basic.skillName))return void x(e);await F(e)}},[c,F,A,N.data]),L=(0,t.useCallback)(()=>{g&&p.current.has(g.basic.skillName)||x(null)},[g]),V=(0,t.useCallback)(async()=>{if(g)try{await F(g)}finally{x(null)}},[F,g]);return{activeCategory:y,setActiveCategory:I,searchQuery:E,setSearchQuery:v,addDisabled:!N.data,addingSkillNames:c,skills:k,addSkill:R,fetchNextPage:T.fetchNextPage,hasNextPage:T.hasNextPage,isFetchingNextPage:T.isFetchingNextPage,isError:T.isError||N.isError,refetch:()=>Promise.all([T.refetch(),N.refetch()]),isLoading:T.isInitialLoading||T.isFetching&&!S.length,replaceConfirmLoading:null!==g&&c.has(g.basic.skillName),replaceConfirmSkills:w,handleCancelReplaceConfirm:L,handleConfirmReplaceSkill:V}}({activeTab:i,location:a,open:n,projectId:r}),f=e=>{let t=ig(e),a=p.addingSkillNames.has(e.basic.skillName);return{header:(0,et.jsx)(ih,{added:t,adding:a,disabled:p.addDisabled,onAdd:()=>p.addSkill(e)}),footer:"marketplace"===i&&e.marketplace.contributor?(0,et.jsx)("span",{className:"ml-auto truncate text-xs leading-4 text-f-text-secondary",children:(0,et.jsx)(ei.Trans,{id:"hGDVDa",values:{0:e.marketplace.contributor}})}):void 0}};return(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)(ir.default,{open:n,width:900,onCancel:l,contentClassName:"relative flex h-[min(600px,calc(100dvh-40px))] flex-col overflow-hidden px-5 pt-5 text-f-text",modalClassName:"project-skill-source-modal",children:(0,et.jsx)(ia.default,{activeKey:i,tabConfigs:i_,onChange:o,renderTabContent:e=>e.key===i?(0,et.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:["marketplace"===i?(0,et.jsx)("div",{className:"mb-5 shrink-0",children:(0,et.jsx)(ip,{variant:"project",activeCategory:p.activeCategory,searchQuery:p.searchQuery,onCategoryChange:p.setActiveCategory,onSearchChange:p.setSearchQuery})}):null,p.isError?(0,et.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-3 text-center",children:[(0,et.jsx)("p",{className:"text-sm leading-5 text-f-text-tertiary",children:(0,et.jsx)(ei.Trans,{id:"pbgyQA"})}),(0,et.jsx)(ea.default,{color:"outline",rounded:"md",onClick:()=>p.refetch(),children:(0,et.jsx)(ei.Trans,{id:"KDw4GX"})})]}):(0,et.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto scrollbar-mini-hover",children:[(0,et.jsx)(ii.default,{compact:!0,emptyClassName:"min-h-0 px-6 py-0",cardSize:"md",emptyDescription:"marketplace"===i?(0,et.jsx)(ei.Trans,{id:"iVdfuW"}):(0,et.jsx)(ei.Trans,{id:"RIJSXw"}),gridClassName:"grid-cols-3 pb-5 xl:grid-cols-2 md:grid-cols-1",loading:p.isLoading,skills:p.skills,showOfficialIcon:"user"!==i,renderActions:f,onSkillClick:e=>{d(e),c(!0)}}),(0,et.jsx)(io.default,{hasNextPage:p.hasNextPage,isFetchingNextPage:p.isFetchingNextPage,onLoadMore:()=>p.fetchNextPage()})]})]}):null})}),s?"official"===s.basic.sourceType?(0,et.jsx)(it.default,{open:n&&u,maskClosable:!0,skill:s,afterClose:()=>d(null),onCancel:()=>c(!1)}):(0,et.jsx)(iv,{open:n&&u,maskClosable:!0,previewOnly:!0,packageCache:m,skill:s,skillName:s.basic.skillName,afterClose:()=>d(null),onCancel:()=>c(!1)}):null,(0,et.jsx)(il.default,{open:p.replaceConfirmSkills.length>0,skills:p.replaceConfirmSkills,confirmLoading:p.replaceConfirmLoading,onCancel:p.handleCancelReplaceConfirm,onConfirm:p.handleConfirmReplaceSkill})]})}var iT=e.i(74742),iN=e.i(147144),iM=e.i(951203),iS=e.i(169420);let ik={official:{icon:"i-cus--hix2-official",label:(0,et.jsx)(ei.Trans,{id:"T_sba9"})},user:{icon:"i-cus--hix2-account",label:(0,et.jsx)(ei.Trans,{id:"OTmBvE"})},marketplace:{icon:"i-cus--hix2-skill-02",label:(0,et.jsx)(ei.Trans,{id:"FLZTI5"})}};function iA(e){let{sources:t,onCloseMenu:i,onOpenSource:a}=e,n=tI.cls`
30    reset-popover-button-style flex w-full items-center gap-2 rounded-lg font-normal
31              px-2 py-2 text-left text-sm leading-5 text-f-text-secondary hover:bg-f-bg-hover hover:text-f-text
32  `;return(0,et.jsx)(et.Fragment,{children:t.map(e=>(0,et.jsxs)("button",{type:"button",className:n,onClick:()=>{i(),window.setTimeout(()=>a(e),0)},children:[(0,et.jsx)(tv.IconItem,{className:tI.cls`${ik[e].icon} size-[18px] shrink-0`}),ik[e].label]},e))})}function iw(e){let{appearance:i,includeOfficial:a,projectId:n,onBeforeCreateWithHix:r,onOpenSource:l}=e,{createWithHix:o}=(0,iS.useSkillChatActions)(),[s,d]=(0,t.useState)(!1),u="icon"===i?"add":"create"===i?"modal_create":"upload",c=e=>{d(e)};return(0,et.jsx)(t2.default,{projectId:n,trackLocation:u,additionalActions:{upload:(0,et.jsx)(iA,{sources:a?["official","user"]:["user"],onCloseMenu:()=>d(!1),onOpenSource:e=>l(e,u)}),"import-repository":(0,et.jsx)(iA,{sources:["marketplace"],onCloseMenu:()=>d(!1),onOpenSource:e=>l(e,u)})},onCloseMenu:()=>d(!1),onCreateWithHix:()=>{(0,j.trackProject)({id:n,type:"add_a_skill",method:"add_skill_entry_click",field2:"create_with_hix",location:u}),r?.(),o({skipHomeNavigation:!0})},children:({actionMenu:e})=>(0,et.jsx)(id.default,{open:s,trigger:["click"],placement:"bottomRight",menu:{items:[]},dropdownRender:()=>e,overlayClassName:"!rounded-[12px] p-2",overlayStyle:{minWidth:220},onOpenChange:c,children:"icon"===i?(0,et.jsx)(ea.default,{"aria-label":"Add project skill",rounded:"sm",padding:"xs",className:"size-[22px] text-f-text-secondary",children:(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-add-image size-[18px]"})}):"create"===i?(0,et.jsxs)(ea.default,{color:"modalConfirm",padding:"sm",rounded:"md",size:"sm",className:"h-8 gap-1.5 px-2 !font-semibold text-f-text-light",children:[(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-add-image size-4"}),(0,et.jsx)(ei.Trans,{id:"oV_fNn"}),(0,et.jsx)(tv.IconItem,{className:tI.cls`transition-transform duration-200 i-cus--hix2-right size-4 text-f-text-light ${s?"rotate-90":""}`})]}):(0,et.jsxs)(ea.default,{color:"outline",padding:"sm",rounded:"md",size:"md",className:"h-7 px-1.5 !border-f-border",children:[(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-upload size-4"}),(0,et.jsx)(ei.Trans,{id:"ONWvwQ"}),(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-down size-4"})]})})})}e.s(["default",0,iw],931208);var ij=e.i(719654),iF=e.i(926405),iR=e.i(899596);function iL(e,t,i){"download"===t?(0,j.trackProject)({id:e,type:"manage_skill",method:"download_click",itemName:i.basic.displayName,location:"skill_modal"}):"replace"===t?(0,j.trackProject)({id:e,type:"manage_skill",method:"replace_click",itemName:i.basic.displayName,location:"skill_modal"}):"edit"===t&&(0,j.trackProject)({id:e,type:"manage_skill",method:"edit_with_HIX_AI_click",itemName:i.basic.displayName,location:"skill_modal"})}let iV=(0,ie.default)(()=>
32e.A(152364),{loadableGenerated:{modules:[664454]},ssr:!1});function iD(e){let{open:i,projectId:a,onCancel:n,onOpenSource:r}=e,l=function(e){let{onCloseManager:i,open:a,projectId:n}=e,{user:r}=(0,t8.useAccountContext)(),l=(0,tQ.useLocale)(),o=t9.api.useUtils(),[s,d]=(0,t.useReducer)(ij.skillModalReducer,ij.EMPTY_SKILL_MODAL_STATE),u=a&&r.isSignIn&&!!r.userId,c=t9.api.skillHub.listSkills.useInfiniteQuery({projectId:n,scene:"manage",source:"all",limit:20,language:(0,t5.getLanguageByCode)(l).code},{enabled:u,getNextPageParam:e=>e.nextCursor??void 0}),m=(0,t.useMemo)(()=>c.data?.pages.flatMap(e=>(0,t4.selectSkillCardModels)(e))??[],[c.data]),p=t9.api.skillHub.setSkillState.useMutation(),f=t9.api.skillHub.delete.useMutation(),{downloadingSkillNames:h,downloadSkill:g}=(0,iF.useSkillDownloadAction)(n),{editWithHix:x,trySkill:y}=(0,iS.useSkillChatActions)();(0,t7.useRefetchProjectQueryForUser)(r.userId,u,c.refetch),(0,t.useEffect)(()=>{a||d({type:"closeAll"})},[a]);let I=(0,t.useCallback)(()=>o.skillHub.listSkills.invalidate({projectId:n}),[o.skillHub.listSkills,n]),E="delete"===s.type||"upload"===s.type?s.returnTo:s,v="preview"===E.type?m.find(e=>e.basic.skillName===E.skill.basic.skillName)??E.skill:null,_="detail"===E.type?m.find(e=>e.basic.skillName===E.skill.basic.skillName)??E.skill:null,{togglingSkillNames:b,toggleSkill:T}=(0,iR.useSkillToggleAction)(async(e,t)=>{await p.mutateAsync({projectId:n,skillName:e,enabled:t}),await I()}),N=(0,t.useCallback)(e=>{if(!e.state.readOnly)return T(e.basic.skillName,!e.state.enabled)},[T]),M=(0,t.useCallback)(e=>{d({type:"closeAll"}),i(),y(e,{skipHomeNavigation:!0})},[i,y]),S=(0,t.useCallback)((e,t)=>{if(!iy(t)?.includes(e)){if("download"===e)return void g(t.basic.skillName);if("edit"===e){d({type:"closeAll"}),i(),x(t,{skipHomeNavigation:!0});return}if("replace"===e)return void d({type:"openUpload",mode:"replace",targetSkillId:t.basic.skillName});"delete"===e&&d({type:"openDelete",skillId:t.basic.skillName})}},[g,x,i]),k=(0,t.useCallback)(async()=>{if("delete"===s.type)try{await f.mutateAsync({projectId:n,skillName:s.skillId}),(0,j.trackProject)({id:n,type:"manage_skill",method:"delete_click",status:0,itemName:s.skillId,location:"skill_modal"}),d({type:"closeAll"}),e8.message.success(C.i18n._({id:"Qx8jKC"})),I()}catch(e){(0,j.trackProject)({id:n,type:"manage_skill",method:"delete_click",status:1,itemName:s.skillId,location:"skill_modal",errorMsg:(0,j.getProjectTrackErrorMsg)(e)})}},[f,s,n,I]),A=(0,t.useCallback)(async e=>{await I(),d({type:"closeLayer"})},[I]);return{deleteConfirmOpen:"delete"===s.type,deleteConfirmLoading:f.isPending,downloadingSkillNames:h,togglingSkillNames:b,isLoading:c.isInitialLoading||c.isFetching&&!m.length,modalState:s,previewSkill:v,skillDetail:_,skills:m,fetchNextPage:c.fetchNextPage,hasNextPage:c.hasNextPage,isFetchingNextPage:c.isFetchingNextPage,onCancelDelete:()=>d({type:"closeLayer"}),onCancelLayer:()=>d({type:"closeLayer"}),onCancelPreview:()=>d({type:"closeAll"}),onConfirmDelete:k,onMoreAction:S,onOpenSkill:e=>d({type:"official"===e.basic.sourceType?"openDetail":"openPreview",skill:e}),onToggleSkill:N,onTrySkill:M,onUploadSuccess:A}}({onCloseManager:n,open:i,projectId:a}),[o]=(0,t.useState)(()=>new Map);return(0,et.jsxs)(et.Fragment,{children:[(0,et.jsxs)(ir.default,{open:i,width:900,onCancel:n,contentClassName:"relative flex h-[min(600px,calc(100dvh-40px))] flex-col overflow-hidden p-5 text-f-text",modalClassName:"project-skills-manager-modal",children:[(0,et.jsxs)("header",{className:"flex shrink-0 flex-col gap-1 pb-5 pr-8",children:[(0,et.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,et.jsx)("h2",{className:"min-w-0 text-base font-medium leading-6 text-f-text",children:(0,et.jsx)(ei.Trans,{id:"hnkcda"})}),(0,et.jsx)(iw,{appearance:"create",includeOfficial:!0,projectId:a,onBeforeCreateWithHix:n,onOpenSource:r})]}),(0,et.jsx)("p",{className:"text-xs leading-4 text-f-text-tertiary",children:(0,et.jsx)(ei.Trans,{id:"7YB9qU"})})]}),(0,et.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto scrollbar-mini-hover",children:[(0,et.jsx)(ii.default,{gridClassName:"grid-cols-3 xl:grid-cols-2 md:grid-cols-1",loading:l.isLoading,skills:l.skills,showOfficialIcon:!0,onSkillClick:l.onOpenSkill,renderActions:e=>{let t=e.state.readOnly,i=e.state.removable,n=(0,et.jsx)(iT.SkillEnableSwitch,{disabled:t||i,disabledTooltip:t&&!i?(0,et.jsx)(ei.Trans,{id:"u4UoX2"}):void 0,enabled:!i&&e.state.enabled,loading:l.togglingSkillNames.has(e.basic.skillName),onToggle:()=>{(0,j.trackProject)({id:a,type:"manage_skill",method:e.state.enabled?"disable_skill_click":"enable_skill_click",itemName:e.basic.displayName,location:"skill_modal"}),l.onToggleSkill(e)}});return i?{header:n,footer:(0,et.jsx)(iT.SkillCardRemoveButton,{onRemove:()=>l.onMoreAction("delete",e)}
32)}:{header:n,footer:(0,et.jsx)(iT.MySkillCardActions,{hiddenActionKeys:iy(e),loadingActionKey:l.downloadingSkillNames.has(e.basic.skillName)?"download":null,onTry:()=>{(0,j.trackProject)({id:a,type:"manage_skill",method:"try_click",itemName:e.basic.displayName,location:"skill_modal"}),l.onTrySkill(e)},onMoreAction:t=>{iL(a,t,e),l.onMoreAction(t,e)}})}}}),(0,et.jsx)(io.default,{hasNextPage:l.hasNextPage,isFetchingNextPage:l.isFetchingNextPage,onLoadMore:()=>l.fetchNextPage()})]})]}),(0,et.jsx)(iM.default,{open:"upload"===l.modalState.type,mode:"upload"===l.modalState.type?l.modalState.mode:"create",projectId:a,targetSkillId:"upload"===l.modalState.type?l.modalState.targetSkillId:void 0,onCancel:l.onCancelLayer,onSuccess:l.onUploadSuccess}),(0,et.jsx)(iN.default,{open:l.deleteConfirmOpen,loading:l.deleteConfirmLoading,onCancel:l.onCancelDelete,onConfirm:()=>l.onConfirmDelete()}),(0,et.jsx)(it.default,{open:!!l.skillDetail,skill:l.skillDetail,onCancel:l.onCancelPreview,onTry:e=>{(0,j.trackProject)({id:a,type:"manage_skill",method:"try_click",itemName:e.basic.displayName,location:"skill_modal"}),l.onTrySkill(e)}}),l.previewSkill?(0,et.jsx)(iV,{open:!0,downloadLoading:l.downloadingSkillNames.has(l.previewSkill.basic.skillName),enabled:l.previewSkill.state.enabled,hiddenActionKeys:iy(l.previewSkill),packageCache:o,projectId:a,skill:l.previewSkill,skillName:l.previewSkill.basic.skillName,toggleDisabled:l.previewSkill.state.readOnly,toggleLoading:l.togglingSkillNames.has(l.previewSkill.basic.skillName),onCancel:l.onCancelPreview,onMoreAction:(e,t)=>{iL(a,e,t),l.onMoreAction(e,t)},onMoreMenuClick:()=>void 0,onToggleSkill:e=>{let t=l.skills.find(t=>t.basic.skillName===e);t&&((0,j.trackProject)({id:a,type:"manage_skill",method:t.state.enabled?"disable_skill_click":"enable_skill_click",itemName:t.basic.displayName,location:"skill_modal"}),l.onToggleSkill(t))},onTry:e=>{(0,j.trackProject)({id:a,type:"manage_skill",method:"try_click",itemName:e.basic.displayName,location:"skill_modal"}),l.onTrySkill(e)}}):null]})}let iO=(0,t.createContext)(null);function iP(){return(0,t.useContext)(iO)}e.s(["default",0,function(e){let{children:i,projectId:a}=e,n=(0,t6.useDestinationIdentity)(),r="ready"===n.kind,l="ready"===n.kind?n.projectId:void 0,o=(0,t3.getDestinationWriteTarget)(n)?.projectId,{user:s}=(0,t8.useAccountContext)(),d=(0,tQ.useLocale)(),[u,c]=(0,t.useState)(!1),[m,p]=(0,t.useState)(null),[f,h]=(0,t.useState)("modal_create"),[g,x]=(0,t.useState)(a);g!==a&&(x(a),c(!1),p(null),h("modal_create")),!r&&u&&c(!1),r||null===m||p(null);let y=!!l&&s.isSignIn&&!!s.userId,I=(0,t5.getLanguageByCode)(d).code,C=l??a,E=t9.api.skillHub.listSkills.useQuery({projectId:C,scene:"picker",language:I},{enabled:y,select:t4.selectSkillCardModels}),v=t9.api.skillHub.listSkills.useQuery({projectId:C,scene:"manage",source:"all",available:!0,limit:100,language:I},{enabled:y,select:t4.selectSkillCardModels});(0,t7.useRefetchProjectQueryForUser)(s.userId,y,E.refetch),(0,t7.useRefetchProjectQueryForUser)(s.userId,y,v.refetch);let _=(0,t.useMemo)(()=>({isLoading:!l||E.isInitialLoading,managedSkillsLoading:!l||v.isInitialLoading,projectId:a,writeProjectId:o,skills:l?E.data??[]:[],managedSkills:l?v.data??[]:[],openManager:()=>{o&&c(!0)},openSource:(e,t)=>{o&&(p(e),h(t))}}),[l,v.data,v.isInitialLoading,a,E.data,E.isInitialLoading,o]);return(0,et.jsxs)(iO.Provider,{value:_,children:[i,o&&u?(0,et.jsx)(iD,{open:!0,projectId:o,onCancel:()=>c(!1),onOpenSource:(e,t)=>{p(e),h(t)}}):null,o&&null!==m?(0,et.jsx)(ib,{activeTab:m,location:f,open:!0,projectId:o,onCancel:()=>p(null),onChangeTab:p}):null]})},"useProjectSkillsScope",0,iP],162147);var iz=e.i(175216),iU=e.i(647086),iG=e.i(117406),iH=e.i(471452),iB=e.i(546283),iW=e.i(435654);function i$(e){return"string"==typeof e.basic.displayName&&e.basic.displayName.trim()?e.basic.displayName:e.basic.skillName}function iq(e){let{description:t}=e;return(0,et.jsx)("p",{className:"m-0 max-h-[min(400px,calc(100dvh-24px))] overflow-y-auto px-2 py-1.5 text-xs font-normal leading-5 text-f-text-secondary scrollbar-mini-hover",children:t})}function iK(e){let{className:i,listClassName:a,searchQuery:n="",showDescriptionPopover:r=!0,skills:l,onSelectSkill:o}=e,s=(0,iH.useScreen)("md"),[d,u]=(0,t.useState)(),c=(0,t.useRef)(!1),{run:m,cancel:p}=(0,I.useDebounceFn)(e=>u(e),{wait:200}),{run:f,cancel:h}=(0,I.useDebounceFn)(()=>u(void 0),{wait:200}),{run:g}=(0,I.useDebounceFn)(()=>{c.current=!1},{wait:150}),x=(0,t.useMemo)(()=>(0,iB.sortSkillsByUpdatedAtDesc)(function(e,t){if(!t)return e;let i=t.toLowerCase();return e.filter(e=>!!i$(e).toLowerCase().includes(i)||e.basic.skillName.toLowerCase().includes(i))}(l,n)),[n,l]);if(0===x.length)return n?(0,et.jsxs)("div",{className:tI.cls`
33            inline-flex h-[255px] min-h-0 max-w-[323px] !flex-none flex-col items-center justify-center gap-2
34            ${i}
35          `,role:"status",children:[(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-search size-6 shrink-0 text-f-text-disabled"}),(0,et.jsx)("span",{className:"text-sm font-normal leading-5 text-f-text-quaternary",children:(0,et.jsx)(ei.Trans,{id:"AxPAXW"})})]}):null;let y=tI.cls`
36    reset-popover-button-style flex min-h-7 w-full min-w-0 items-center gap-1 rounded-lg border-0 bg-transparent px-2 py-1 text-left text-sm font-normal leading-5 text-f-text-secondary outline-none
37    hover:bg-f-bg-hover hover:text-f-text
38  `;return(0,et.jsx)("div",{className:tI.cls`
39        inline-flex min-h-0 max-w-[323px] flex-col gap-2
40        ${i}
41      `,children:(0,et.jsx)("div",{className:tI.cls`
42          inline-flex max-h-[340px] min-h-0 w-full flex-col gap-0.5
43          overflow-y-auto overflow-x-hidden scrollbar-mini-hover
44          ${a}
45        `,role:"listbox","aria-label":"Skills",onScroll:()=>{c.current=!0,g(),p(),h(),u(void 0)},children:x.map(e=>{let t="official"===e.basic.sourceType,i=i$(e),a=!s&&r&&null!=e.basic.displayDescription,l=(0,et.jsxs)("button",{type:"button",role:"option","aria-selected":!1,className:y,onClick:()=>o(e),onMouseEnter:()=>{h(),p(),c.current||d!==e.basic.skillName&&(u(void 0),a&&m(e.basic.skillName))},onMouseLeave:()=>{p(),f()},children:[(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-skill-02 size-[18px] shrink-0"}),(0,et.jsx)("span",{className:"min-w-0 truncate max-w-full",children:(0,iW.highlightMatchedText)(i,n)}),t?(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-official size-[18px] shrink-0 text-f-text-tertiary"}):null]},e.basic.skillName);return a&&d===e.basic.skillName?(0,et.jsx)(tW.default,{open:!0,trigger:[],placement:"rightTop",autoAdjustOverflow:!0,align:{offset:[20,0]},content:(0,et.jsx)("div",{onMouseEnter:h,onMouseLeave:f,children:(0,et.jsx)(iq,{description:e.basic.displayDescription})}),rootClassName:"!w-[342px] !max-h-[min(400px,calc(100dvh-24px))] !overflow-hidden !rounded-lg !border-0 !p-0 !shadow-effects-xl",children:(0,et.jsx)("div",{className:"w-full min-w-0",children:l})},e.basic.skillName):l})})})}function iX(e){let{actionsDisabled:i=!1,createActionMenu:a,createMenuOpen:n,isLoading:r=!1,maxHeight:l=460,onCreateMenuOpenChange:o,onOpenSkillsManager:s,onSelectSkill:d,skills:u}=e,{isMobile:c}=(0,iG.useIsMobile)(),[m,p]=(0,t.useState)(""),f=u.length>0,h=tI.cls`
46    reset-popover-button-style flex w-full items-center gap-3 rounded-lg border-0 bg-transparent px-2 py-1.5 text-left text-sm font-normal leading-5
47    ${i?"cursor-not-allowed text-f-text-tertiary opacity-60":"text-f-text-secondary hover:bg-f-bg-hover hover:text-f-text"}
48  `;return(0,et.jsxs)("div",{className:"inline-flex w-full min-h-0 max-w-[323px] flex-col gap-2 overflow-hidden",style:{maxHeight:l},children:[r?(0,et.jsxs)("div",{className:"flex items-center justify-center gap-2 py-3 text-sm text-f-text-tertiary",children:[(0,et.jsx)(tv.IconItem,{className:"i-svg-spinners--180-ring-with-bg size-4"}),(0,et.jsx)(ei.Trans,{id:"Z3FXyt"})]}):f?(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)(iU.default,{value:m,onChange:p}),(0,et.jsx)(iK,{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",listClassName:"!max-h-none min-h-0 min-w-0 flex-1",searchQuery:m,skills:u,onSelectSkill:d}),(0,et.jsx)("div",{className:"h-px w-full shrink-0 bg-f-border"})]}):null,(0,et.jsxs)("div",{className:"flex w-full shrink-0 flex-col gap-0.5",children:[(0,et.jsx)(tW.default,{open:n&&!i,trigger:c?["click"]:["hover"],placement:c?"topRight":"rightTop",align:c?{offset:[0,-4]}:{offset:[16,0]},content:a,destroyTooltipOnHide:!0,rootClassName:"!w-max !rounded-xl !border-f-border !p-0 !shadow-effects-m",onOpenChange:o,children:(0,et.jsxs)("button",{type:"button",disabled:i,className:h,children:[(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-add-image size-[18px] shrink-0"}),(0,et.jsxs)("span",{className:"flex items-center justify-between flex-1 gap-3",children:[(0,et.jsx)("span",{className:"whitespace-nowrap",children:(0,et.jsx)(ei.Trans,{id:"StFqiS"})}),(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-right size-[18px] shrink-0"})]})]})}),(0,et.jsxs)("button",{type:"button",disabled:i,className:h,onClick:s,children:[(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-manage size-[18px] shrink-0"}),(0,et.jsx)("span",{className:"whitespace-nowrap",children:(0,et.jsx)(ei.Trans,{id:"xzH02Y"})})]})]})]})}var iY=e.i(448267),iQ=e.i(225971);let iJ=(0,t.forwardRef)((e,t)=>{let{className:i,referencedSkillCount:a,...n}=e,r=a>0,l=(0,t1.useSkipInitialPresenceAnimation)(r);return(0,et.jsxs)(ea.default,{ref:t,htmlType:"button",color:"default",variant:"outline","aria-label":"Open skills",className:tm.tw`rounded-full gap-0 py-[5px] px-[6px] overflow-hidden ${i}`,...n,children:[(0,et.jsx)("div",{className:"flex h-5 items-center justify-center",children:(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-skill-02 size-[18px] shrink-0"})}),(0,et.jsx)(tZ.AnimatePresence,{initial:!1,children:r&&(0,et.jsx)(t0.MotionCountBadge,{skipInitialMountAnimation:l,value:a},"skill-count-badge")})]})});e.s(["default",0,function(e){let{disabled:i}=e,a=(0,t6.useDestinationIdentity)(),n=iP(),{createMenuOpen:r,onCloseCreateMenu:o,onCreateMenuOpenChange:s,onMainOpenChange:d,onOpenSkillsManager:u,onSelectSkill:c,open:m,referencedSkillCount:p}=function(e,i){let a=ez.Form.useFormInstance(),n=(0,t6.useDestinationIdentity)(),r=(0,t3.getDestinationWriteTarget)(n)?.projectId,{accountModal:o}=(0,eH.useAppUIModal)(),{setInputValue:s}=(0,l.useChatStore)(e=>({setInputValue:e.setInputValue})),[d,u]=(0,t.useState)(!1),[c,m]=(0,t.useState)(!1),[p,f]=(0,t.useState)(r);"ready"!==n.kind&&c&&m(!1),"ready"===n.kind&&p!==r&&(f(r),m(!1));let h=ez.Form.useWatch("inputValue",a),g=(0,t.useMemo)(()=>(0,N.getReferencedSkillNames)(h),[h]),x=(0,t.useRef)(null),y=(0,t.useRef)(!1),I=g.length;return(0,t.useEffect)(()=>()=>{null!==x.current&&window.clearTimeout(x.current)},[]),{createMenuOpen:c,open:d,referencedSkillCount:I,onCloseCreateMenu:()=>{y.current=!0,null!==x.current&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>{y.current=!1,x.current=null},250),(0,tR.flushSync)(()=>{m(!1),u(!1)})},onCreateMenuOpenChange:e=>{!(e&&(y.current||"ready"!==n.kind||i?.isLoading))&&(m(e),e&&u(!0))},onMainOpenChange:t=>{if(e){u(!1),m(!1);return}if((!t||!y.current)&&(t||!c)){if(t&&!d)if(r){let e=i?(0,j.joinProjectTrackItemNames)([...ix(i.skills)]):void 0;(0,j.trackProject)({type:"input_box",id:r,method:"skills_click",location:"input_box",...e?{itemName:e}:{}})}else(0,iz.trackSkillReference)("open_picker");u(t),t||m(!1)}},onOpenSkillsManager:()=>{if(i){if(!r)return;(0,j.trackProject)({type:"input_box",id:r,method:"manage_skill_click",location:"input_box"}),u(!1),i.openManager();return}(0,iz.trackSkillReference)("manage_skill_click"),u(!1),o.show({activeTab:iY.EAccountLayoutLeftMenu.Skills})},onSelectSkill:e=>{if("ready"!==n.kind)return;let t=a.getFieldValue("inputValue");if((0,N.isReferencedSkillLimitExceeded)(t,e.basic.skillName)){r?(0,j.trackProject)({type:"input_box",id:r,method:"skill_limit_toast",location:"input_box"}):(0,iz.trackSkillReference)("limit_toast"),e8.message.warning(N.CHAT_REFERENCED_SKILLS_LIMIT_MESSAGE);return}let i=(0,iQ.createSkillReferenceOption)(e);if(!i)return;let l=(0,eX.serializeReferenceToken)(i),o=`${l} `;
48if(t){let e=t.endsWith(" ")?"":" ";o=`${t}${e}${l} `}a.setFieldValue("inputValue",o),s(o,"chat"),r?(0,j.trackProject)({type:"input_box",id:r,method:"add_skill_reference",location:"input_box",itemName:e.basic.skillName}):(0,iz.trackSkillReference)("add_skill_reference"),u(!1),requestAnimationFrame(()=>{tN.chatFormEditorMedia.focus(ep.HIX_CHAT_FORM_MEDIA_KEYS.NORMAL,{cursor:"end"})})}}}(i,n),f=(0,l.useChatStore)(e=>e.skillList),{createWithHix:h}=(0,iS.useSkillChatActions)(),g=(0,t.useMemo)(()=>{let e;return n?.skills??(e=f.map(e=>(0,t4.toSkillCardModel)(e)),(0,iB.sortSkillsByUpdatedAtDesc)(e))},[n?.skills,f]),y=!!n?.isLoading,I="ready"!==a.kind||y,C=(0,t.useRef)(null),E=function(e,i){let[a,n]=(0,t.useState)(460);return(0,x.useIsomorphicLayoutEffect)(()=>{if(!e)return void n(460);let t=()=>{let e=i.current;if(!e)return;let{bottom:t,top:a}=e.getBoundingClientRect();n(Math.min(460,Math.max(120,Math.max(a-16-24,window.innerHeight-t-16-24))))};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[e,i]),a}(m,C),v=e=>{let t=(0,et.jsx)(iX,{actionsDisabled:I,createActionMenu:e,createMenuOpen:r,isLoading:y,maxHeight:E,skills:g,onCreateMenuOpenChange:s,onOpenSkillsManager:u,onSelectSkill:c});return(0,et.jsx)(tW.default,{open:m,trigger:["click"],placement:"bottomLeft",autoAdjustOverflow:!0,content:t,destroyTooltipOnHide:!0,rootClassName:tI.cls`
49          !w-[min(300px,calc(100vw-32px))] desktop-lg:!w-[min(240px,calc(100vw-32px))]
50          !max-h-[min(486px,calc(100dvh-24px))]
51          !overflow-hidden !rounded-[18px] !border-f-border !p-3 !shadow-effects-m
52          md:!left-1/2 md:!-translate-x-1/2
53        `,onOpenChange:d,children:(0,et.jsx)("span",{ref:C,className:"inline-flex",children:(0,et.jsx)(iJ,{disabled:i,referencedSkillCount:p})})})};return"ready"!==a.kind?v(null):(0,et.jsx)(t2.default,{labelVariant:"chat",projectId:a.projectId,trackLocation:n?"input_box":void 0,onAction:e=>{let t="ready"===a.kind?a.projectId:void 0;if("create-with-hix-ai"===e)return void(n&&t?(0,j.trackProject)({type:"input_box",id:t,method:"click_create_with_hix",location:"input_box"}):(0,iz.trackSkillReference)("create_with_hix_click"));if(!n){if("upload"===e)return void(0,iz.trackSkillReference)("upload_skill_click");"import-repository"===e&&(0,iz.trackSkillReference)("import_repository_click")}},onCloseMenu:o,onCreateWithHix:()=>n?h({skipHomeNavigation:!0}):h(),children:({actionMenu:e})=>v(e)})}],296426);var iZ=e.i(894649);e.s(["default",0,function({fileList:e}){let t=ez.Form.useFormInstance(),{setInputValue:i}=(0,Y.useChatInput)(),{referenceMediaItems:a,isReferenceMediaMode:r}=(0,eK.useReferenceMediaAvailability)(t,e),l=(0,n.useMemoizedFn)(e=>{let a=(0,eX.serializeReferenceToken)((0,eK.toReferenceMediaOption)(e)),n=t.getFieldValue("inputValue")||"",r=n&&!/\s$/.test(n)?" ":"",l=`${n}${r}${a} `;t.setFieldValue("inputValue",l),i(l,"chat"),requestAnimationFrame(()=>{tN.chatFormEditorMedia.focus(ep.HIX_CHAT_FORM_MEDIA_KEYS.NORMAL,{cursor:"end"})})});return r?(0,et.jsx)(tW.default,{trigger:"click",placement:"bottomLeft",rootClassName:"p-0",content:a.length?(0,et.jsx)("div",{className:"flex flex-col max-h-[280px] overflow-y-auto scrollbar-mini",children:a.map(e=>(0,et.jsx)(iZ.default,{file:e.file,token:e.token,mediaType:e.mediaType,onClick:()=>{l(e)}},e.token))}):null,children:(0,et.jsx)(ea.default,{variant:"default",className:"whitespace-nowrap size-8 p-0",children:(0,et.jsx)(tv.IconItem,{className:"i-cus--hix2-at size-[18px]"})})}):null}],7419);var i0=e.i(975061),i1=e.i(964212);let i2=(0,ie.default)(()=>e.A(321196),{loadableGenerated:{modules:[122483]},ssr:!1}),i8=(0,ie.default)(()=>e.A(4214),{loadableGenerated:{modules:[278083]},ssr:!1}),i5="style";e.s(["default",0,function(e){let{chatType:i=o.EChatInputType.AI_IMAGE,disabled:n}=e,[r,l]=(0,t.useState)(!1),{isMounted:s}=(0,i1.useIsMounted)(),d=ez.Form.useFormInstance(),u=ez.Form.useWatch(i5,d),c=(0,tQ.useLocale)(),{data:m,isFetching:p}=t9.api.aiImage.styles.useQuery({locale:c},{enabled:!!c&&i===o.EChatInputType.AI_IMAGE,initialData:[]}),{data:f,isFetching:h}=t9.api.aiVideo.styles.useQuery({locale:c,styleType:"video2video"},{enabled:!!c&&i===o.EChatInputType.AI_VIDEO,initialData:[]}),g=(0,t.useMemo)(()=>(0,a.match)(i).with(o.EChatInputType.AI_IMAGE,()=>m?.find(e=>e.styleValue===u)?.styleName).with(o.EChatInputType.AI_VIDEO,()=>f?.find(e=>e.code===u)?.label).otherwise(()=>C.i18n._({id:"1CalO6"})),[i,m,f,u]);return(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)(ez.Form.Item,{name:i5,noStyle:!0,children:(0,et.jsxs)(ea.default,{variant:"default",className:"whitespace-nowrap",disabled:n,onClick:()=>{n||l(!0)},children:[(0,et.jsx)(tv.IconItem,{className:"i-cus--hix-style size-[18px]"}),(0,et.jsx)("span",{className:"flex-1 w-max",children:g||C.i18n._({id:"1CalO6"})})]})}),(0,et.jsx)(i0.default,{className:"text-f-text-secondary",title:C.i18n._({id:"efYq-t"}),open:r,onCancel:()=>l(!1),width:980,footer:null,forceRender:s,classNames:{header:"[&_.coco-modal-title]:text-f-text-secondary"},children:(0,a.match)(i).with(o.EChatInputType.AI_IMAGE,()=>(0,et.jsx)(i2,{value:u,styles:m,isFetching:p,onFixValue:e=>{d.setFieldValue(i5,e),l(!1)},onChange:e=>{d.setFieldValue(i5,e),l(!1)},className:"h-[70vh]"})).with(o.EChatInputType.AI_VIDEO,()=>(0,et.jsx)(i8,{value:u,styles:f?.filter(e=>!!e.video),isFetching:h,onFixValue:e=>{d.setFieldValue(i5,e),l(!1)},onChange:e=>{d.setFieldValue(i5,e),l(!1)},className:"h-[70vh]"})).otherwise(()=>null)})]})}],603944);var i4=e.i(27664);e.s(["default",0,function(e){var i;let{disabled:n}=e,{templateInfo:r,setTemplateInfo:l}=(0,eq.useFormTemplate)(),o=(0,to.useLatestPathname)(),s=(0,ti.useNoRefreshUpdateChatByUrl)(),d=(0,e2.equalsOrStartsWithPath)(o,e4.URLS.HIXChat.video_effects),u=(0,e2.equalsOrStartsWithPath)(o,e4.URLS.HIXChat.photo_effects),c=(i=r?.coverVideo)&&/\.(mp4|webm|ogg|mov)(\?.*)?$/i.test(i)?r?.coverVideo:void 0,m=(0,t.useMemo)(()=>(0,et.jsxs)(ea.default,{type:"button",variant:"default",className:"relative group/effect whitespace-nowrap",disabled:n,children:[(0,et.jsx)(tv.IconItem,{className:"i-cus--hix-style size-[18px]"}),r?.title,(0,et.jsx)("span",{className:tm.tw`
54            absolute rounded-full
55            items-center justify-center bg-white
56            cursor-pointer text-f-text-tertiary hover:text-f-text
57            border border-f-border top-[4px] right-[4px] size-4
58            hidden group-hover/effect:flex
59          `,onClick:e=>{!n&&(e.stopPropagation(),e.preventDefault(),l(null),d&&s(e4.URLS.HIXChat.video_effects),u&&s(e4.URLS.HIXChat.photo_effects))},children:(0,et.jsx)(tv.IconItem,{className:tI.cls`i-com--x size-full`})})]}),[n,r,l,d,u,s]);return r?(0,et.jsx)(ez.Form.Item,{name:"templateInfo",noStyle:!0,children:r?.coverImg||r?.coverVideo?(0,et.jsx)(tW.default,{trigger:["click","hover"],content:(0,et.jsx)("div",{className:tI.cls`h-[100px]`,style:{aspectRatio:`${r.width||351}
59/${r.height||264}`},children:(0,a.match)(c).with(a.P.string,e=>(0,et.jsx)(i4.default,{wrapperClass:"size-full",src:e,autoPlay:!0,className:tI.cls`size-full object-cover rounded-lg`})).otherwise(()=>r.coverImg?(0,et.jsx)(tL.default,{src:r.coverImg,alt:r.title,fill:!0,className:tI.cls`size-full object-cover rounded-lg`}):null)}),children:m}):m}):null}],627997),e.s(["useFormVariant",0,function({chatType:e,modelName:i,variant:a}){return{...(0,t.useMemo)(()=>{let t={isVariant:!1,isFrames:!1,isIngredients:!1};return i&&e===o.EChatInputType.AI_VIDEO&&ep.FRAMES_MODEL_LIST.includes(i)&&(t.isVariant=!0,"frames"===a&&(t.isFrames=!0),"ingredients"===a&&(t.isIngredients=!0)),t},[e,i,a])}}],185029);var i6=e.i(715699),i3=e.i(602477);function i7(e){let{dropdownWidth:t,triggerRef:i,offsetY:a=6,alwaysAlignToContainer:r=!1,matchContainerWidth:l=!1}=e,{containerRef:o}=(0,i3.useChatFormContainer)(),s=(0,i6.useSize)(o),d=s?.width??0,u=(0,n.useMemoizedFn)(()=>{let e=o?.current,a=i?.current;if(!e)return null;let n=e.getBoundingClientRect(),s=n.width,d=n.left;if(l||r||s<=t||!a)return{maxWidth:s,alignToContainer:!0,containerLeft:d};let u=a.getBoundingClientRect().left;if(!(u>=d&&u<d+s))return{maxWidth:s,alignToContainer:!0,containerLeft:d};let c=Math.min(t,s);return{maxWidth:s,alignToContainer:s-(u-d)<c,containerLeft:d}}),c=(0,n.useMemoizedFn)(()=>{let e=u();if(!e||!e.alignToContainer)return{offset:[0,a]};let n=i?.current,r=o?.current;if(!n||!r)return{offset:[0,a]};let s=n.getBoundingClientRect(),d=r.getBoundingClientRect(),c=l?d.width:Math.min(t,d.width),m=(d.width-c)/2;return{offset:[d.left+m-s.left,a]}});return{calculateAlign:u,getDropdownAlign:c,getMaxWidthStyle:(0,n.useMemoizedFn)(()=>d||void 0),containerRef:o,containerWidth:d}}e.s(["useDropdownAlign",0,i7],831628),e.s(["ChatTooltip",0,function(e){let{children:i,rootClassName:a,content:n,onOpenChange:r,disabled:l,...o}=e,[s,d]=(0,t.useState)(!1),u=(0,t.useRef)(null),{getDropdownAlign:c,containerRef:m,containerWidth:p}=i7({dropdownWidth:526,triggerRef:u}),f=n?(0,et.jsx)("div",{onClick:e=>e.stopPropagation(),children:n}):void 0,h=p?{"--dropdown-max-width":`${p}px`}:void 0;return(0,et.jsx)("span",{ref:u,className:"inline-flex",children:(0,et.jsx)(tX.Popover,{open:s,onOpenChange:e=>{l||(d(e),r?.(e))},placement:"bottomLeft",arrow:!1,trigger:["click"],content:f,align:m?c():void 0,rootClassName:tm.tw`
60          [&_.coco-popover-inner]:!p-3
61          [&_.coco-popover-inner]:!shadow-effects-m
62          [&_.coco-popover-inner]:!rounded-[18px]
63          [&_.coco-popover-inner]:border
64          [&_.coco-popover-inner]:border-f-border
65          [&_.coco-popover-inner]:w-[526px]
66          [&_.coco-popover-inner]:bg-f-bg-base
67          ${p?"[&_.coco-popover-inner]:!max-w-[var(--dropdown-max-width)]":"[&_.coco-popover-inner]:max-w-[calc(100vw-32px)] md:!left-1/2 md:!-translate-x-1/2"}
68          ${a??""}
69        `,overlayStyle:h,...o,children:i})})}],74428),e.s(["ParamCard",0,function(e){let{title:t,children:i,className:a}=e;return(0,et.jsxs)("div",{className:tI.cls`flex flex-col gap-2 ${a}`,children:[(0,et.jsx)("div",{className:"text-f-text-tertiary text-xs",children:t}),i]})}],405415),e.s(["aspectRatioIcons",0,{auto:"i-cus--hix2-1-1","1:1":"i-cus--hix2-1-1","16:27":"i-cus--hix2-16-27","27:16":"i-cus--hix2-27-16","8:9":"i-cus--hix2-8-9","9:8":"i-cus--hix2-9-8","16:9":"i-cus--hix2-16-9","9:16":"i-cus--hix2-9-16","5:3":"i-cus--hix2-5-3","3:5":"i-cus--hix2-3-5","4:3":"i-cus--hix2-4-3","3:4":"i-cus--hix2-3-4","3:2":"i-cus--hix2-3-2","2:3":"i-cus--hix2-2-3","9:21":"i-cus--hix2-21-9","21:9":"i-cus--hix2-9-21","4:5":"i-cus--hix2-5-4","5:4":"i-cus--hix2-4-5"},"defaultLengths",0,[{label:"5s",value:5}],"defaultResolutions",0,[{label:"480P",value:"480P"}],"templateDefaultAspectRatio",0,[{label:"1:1",value:"1:1"},{label:"2:3",value:"2:3"},{label:"3:2",value:"3:2"}],"templateDefaultNumOutputs",0,[{label:"1",disabled:!1,disableTips:"",value:"1"}]],775678)},133669,341572,e=>{"use strict";function t(e){return Math.min(...e.map(e=>e.sort))}function i(e){return[...e].sort((e,t)=>t.sort-e.sort)}function a(e){return i(e)}function n(e){return Object.entries(e).map(([e,i])=>({manufacturer:e,records:a(i),priority:t(i)})).sort((e,t)=>
69e.priority-t.priority)}e.s(["getFirstModelPriority",0,t,"sortModelsByPriorityDesc",0,i],341572),e.s(["flattenSortedModelManagementGroups",0,function(e){return n(e).flatMap(e=>e.records)},"sortModelManagementGroups",0,n,"sortModelManagementRecordsByPriorityDesc",0,a],133669)},661594,e=>{e.v({"credits-tip-arrow-nudge":"index-module-scss-module__qSCLbW__credits-tip-arrow-nudge","credits-tip-arrow-nudge-rtl":"index-module-scss-module__qSCLbW__credits-tip-arrow-nudge-rtl",tipArrow:"index-module-scss-module__qSCLbW__tipArrow",tipButton:"index-module-scss-module__qSCLbW__tipButton",tipText:"index-module-scss-module__qSCLbW__tipText"})},443362,e=>{"use strict";var t=e.i(166101),i=e.i(932900),a=e.i(426023),n=e.i(105757),r=e.i(584526),l=e.i(335390),o=e.i(184885),s=e.i(582458),d=e.i(588775),u=e.i(661594),c=e.i(659638),m=e.i(616405),p=e.i(982952);let f={opacity:0,y:16},h={opacity:1,y:0},g={duration:.46,ease:[.16,1,.3,1]};e.s(["default",0,function({chatType:e}){let{isSignIn:x,sessionLoading:y}=(0,s.useSessionInfo)(),{signUp:I}=(0,o.useAppUIModal)(),C=(0,n.useReducedMotion)(),E=(0,c.useRef)(null),v=(0,a.useInView)(E,{once:!0,amount:.2}),_=(0,l.match)(e).with(d.EChatInputType.GENERIC,()=>(0,t.jsx)(r.Trans,{id:"2GcoXd"})).with(d.EChatInputType.DEEP_RESEARCH,()=>(0,t.jsx)(r.Trans,{id:"Le5r4P"})).with(d.EChatInputType.AI_CHAT,()=>(0,t.jsx)(r.Trans,{id:"zij13w"})).with(l.P.union(d.EChatInputType.AI_IMAGE,d.EChatInputType.GENERIC_IMAGE),()=>(0,t.jsx)(r.Trans,{id:"YG-A9K"})).with(d.EChatInputType.AI_SLIDES,()=>(0,t.jsx)(r.Trans,{id:"QFFoGr"})).with(d.EChatInputType.AI_WRITER,()=>(0,t.jsx)(r.Trans,{id:"n8aRFG"})).otherwise(()=>null),b=!y&&v,T=b?h:f;return _&&(y||!x)?(0,t.jsx)("div",{ref:E,"aria-hidden":!b,className:m.tw`
70        relative z-[1] min-h-11 w-full
71        ${!b&&"pointer-events-none"}
72      `,children:(0,t.jsxs)(i.motion.button,{type:"button",onClick:()=>{I.show({showQuotaExceededTitle:!1})},tabIndex:b?0:-1,initial:!C&&f,animate:T,transition:C?{duration:0}:g,className:p.cls`
73          ${u.default.tipButton}
74          relative mb-[-18px] flex min-h-[62px] w-full items-center gap-2
75          rounded-t-[20px] bg-f-bg-container px-4 pt-3 pb-[30px]
76          text-left text-sm leading-5 text-f-text
77        `,children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"i-cus--hix2-gift size-5 shrink-0",style:{background:"linear-gradient(90deg, #FFC300, #FF5E00)"}}),(0,t.jsx)("span",{className:u.default.tipText,children:_}),(0,t.jsx)("span",{"aria-hidden":!0,className:p.cls`
78            ${u.default.tipArrow}
79            i-cus--hix2-arrow-right size-[18px] shrink-0 rtl:rotate-180
80          `})]})}):null}])},433645,582602,955861,570689,339819,102001,143967,87135,344967,979050,113482,457968,977254,791214,e=>{"use strict";var t=e.i(166101),i=e.i(708763),a=e.i(683883),n=e.i(729888),r=e.i(588775),l=e.i(554690),o=e.i(63919),s=e.i(7419),d=e.i(603944),u=e.i(627997),c=e.i(185029),m=e.i(508652),p=e.i(74428);e.i(3246);var f=e.i(870116),h=e.i(518173),g=e.i(659638),x=e.i(483666),y=e.i(405415),I=e.i(237452),C=e.i(584526),E=e.i(775678),v=e.i(49897),_=e.i(696100),b=e.i(784660);let T={token:{colorBgElevated:"var(--f-bg-base)",colorPrimary:"#000000"},components:{Slider:{railSize:4,handleSize:8,handleSizeHover:8,handleLineWidth:2,handleLineWidthHover:2,railBg:"var(--f-border-secondary)",railHoverBg:"var(--f-border-secondary)",trackBg:"var(--f-text)",trackHoverBg:"var(--f-text)",handleColor:"#000000",handleActiveColor:"#000000",handleActiveOutlineColor:"transparent"}}};function N(e){let{options:i,value:a,onChange:n}=e,r=(0,g.useMemo)(()=>i.filter(e=>!e.disabled),[i]),l=(0,g.useMemo)(()=>{let e=i.reduce((e,t,i)=>t.disabled?e:i,-1);return e>=0&&e<i.length-1&&i.slice(0,e+1).every(e=>!e.disabled)?i:r},[r,i]),o=l.findIndex(e=>e.value===a),s=o>=0&&!l[o]?.disabled?o:0,[d,u]=(0,g.useState)(),c=d&&d.sourceValue===a?d.index:s,m=(0,g.useRef)(s);if(!r.length)return null;let p=l[c];return(0,t.jsx)(_.ConfigProvider,{theme:T,children:(0,t.jsxs)("div",{className:"flex h-10 items-center gap-2 rounded-xl bg-f-bg-container px-3 py-1",children:[(0,t.jsx)(b.Slider,{"aria-label":"Video length",className:"!m-0 flex-1",min:0,max:l.length-1,step:1,tooltip:{open:!1},value:c,onChange:e=>{let t=l[e];t&&!t.disabled&&(m.current=e,u({sourceValue:a,index:e}))},onChangeComplete:()=>{let e=l[m.current];e&&!e.disabled&&e.value!==a&&n?.(e.value)}}),(0,t.jsx)("span",{className:"shrink-0 text-center text-sm leading-5 text-f-text-tertiary",children:p?.label})]})})}var M=e.i(982952);let S={aspectRatio:(0,t.jsx)(C.Trans,{id:"A8094e"}),resolution:(0,t.jsx)(C.Trans,{id:"FmN5me"}),length:(0,t.jsx)(C.Trans,{id:"Jk5_ft"}),numOutputs:(0,t.jsx)(C.Trans,{id:"Oc_hDS"}),quality:(0,t.jsx)(C.Trans,{id:"d3IqDh"})},k={numOutputs:Number};function A(e){return(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-1 py-2 pointer-events-none",children:[(0,t.jsx)(f.IconItem,{className:M.cls`${E.aspectRatioIcons[e.value]||"i-cus--hix-1-1"} size-5 pointer-events-none`}),(0,t.jsx)("span",{className:"text-xs pointer-events-none",children:"auto"===e.value?(0,t.jsx)(C.Trans,{id:"R9Khdg"}):e.label})]})}function w(e){return String(e.label).toUpperCase()}function j(e){let{name:i,list:a,control:n="segmented",value:r,title:l,renderLabel:o,transformValue:s,onChange:d}=e,u=l??S[i],c=o??("aspectRatio"===i?A:"resolution"===i?w:void 0),m=s??k[i],p=("aspectRatio"===i?(0,v.sortAspectRatioOptions)(a):a).map(e=>({label:c?c(e):e.label,value:m?m(e.value):e.value,disabled:e.disabled})),f=m&&null!=r?m(r):r;return(0,t.jsx)(y.ParamCard,{title:u,children:"slider"===n?(0,t.jsx)(N,{options:p,value:f,onChange:d}):(0,t.jsx)(I.ChatSegmented,{options:p,value:f,onChange:d})})}function F(e){let{items:i}=e;return(0,t.jsx)("div",{className:"flex shrink-0 flex-col gap-2",children:i.map(e=>(0,t.jsx)(j,{...e},e.name))})}
80var R=e.i(596391),L=e.i(128350),V=e.i(662038);function D(){let{i18n:e,_:t}=(0,C.useLingui)();return{resolveParameterTitle:(t,i)=>"background"===t?e._({id:"GtJbUa"}):i,resolveOptionLabel:(t,i,a)=>{if("background"!==t)return a;switch(i){case"transparent":return e._({id:"sQyiWm"});case"opaque":return e._({id:"8ZYfnr"});case"auto":return e._({id:"R9Khdg"});default:return a}}}}function O({fields:e,disabled:i}){let{resolveParameterTitle:a,resolveOptionLabel:n}=D();return(0,t.jsx)(t.Fragment,{children:e.map(({key:e,...r})=>(0,t.jsx)(y.ParamCard,{title:a(e,V.MODEL_CUSTOM_PARAMETER_DEFINITIONS[e]?.label??e),children:(0,t.jsx)(L.default,{parameterKey:e,...r,disabled:i,resolveOptionLabel:(t,i)=>n(e,t,i)})},e))})}function P(e,t){let a=i.Form.useFormInstance(),{resolveOptionLabel:n}=D(),r=i.Form.useWatch([],{form:a,preserve:!0}),l=(0,g.useRef)([]),o=(0,g.useMemo)(()=>Object.entries(t??{}),[t]);(0,g.useEffect)(()=>{for(let e of l.current)t?.[e]||a.setFieldValue(e,void 0);for(let[e,t]of(l.current=o.map(([e])=>e),o)){let i=a.getFieldValue(e),n=(0,V.resolveModelParameterOptions)(e,t.options);n.some(e=>e.value===i)||a.setFieldValue(e,t.default??n[0]?.value)}},[o,a,e,t]);let s=o.map(([e,t])=>{let i=r?.[e],a=(0,V.resolveModelParameterOptions)(e,t.options),l=a.find(e=>e.value===i)??a.find(e=>e.value===t.default)??a[0];return{key:e,value:l?n(e,l.value,l.label):void 0}});return{fields:o.map(([e,t])=>{let i=r?.[e];return{key:e,config:t,value:"string"==typeof i?i:void 0,onChange:t=>a.setFieldValue(e,t)}}),labelItems:s}}var z=e.i(110258),U=e.i(56410);function G(e){let{fieldName:t,fieldOptions:a,initValue:n,transformValue:r}=e,l=i.Form.useFormInstance(),o=(0,g.useRef)(!1),s=(0,g.useRef)(),d=(0,g.useRef)(!1),[u,c]=(0,g.useState)(()=>{let e=l.getFieldValue(t)??n;return r&&void 0!==e?r(e):e}),m=i.Form.useWatch(t,l);return(0,U.useUpdateEffect)(()=>{if(o.current){o.current=!1;return}void 0===m||c(r?r(m):m)},[m]),(0,g.useEffect)(()=>{a?.length&&queueMicrotask(()=>{let e=e=>r?r(e):e,i=e(l.getFieldValue(t)),o=void 0===n?void 0:e(n),u=d.current&&s.current!==o,m=void 0===o?void 0:a.find(t=>e(t.value)===o&&!t.disabled);if((!d.current||u)&&(s.current=o,d.current=!0),u&&m){l.setFieldValue(t,o),c(o);return}let p=a.find(t=>e(t.value)===i);if(p&&!p.disabled)return void c(i);if(!p||p.disabled){let i=m??a.find(e=>!e.disabled);if(i){let a=e(i.value);l.setFieldValue(t,a),c(a)}}})},[a,l,t,n,r]),{value:u,onChange:(0,z.useMemoizedFn)(e=>{let i=r?r(e):e;o.current=!0,c(i),l.setFieldValue(t,i)})}}let H={resolution:e=>String(e).toUpperCase(),length:e=>-1===e?"Auto":`${e}s`},B={aspectRatio:e=>E.aspectRatioIcons[String(e)]||"i-cus--hix-1-1",quality:()=>""};function W(e){let{i18n:t,_:i}=(0,C.useLingui)(),a=t._({id:"R9Khdg"});return(0,g.useMemo)(()=>{let t=[],i=[];for(let n of e){let{fieldName:e,fieldOptions:r,formParam:l,defaultIcon:o,control:s,formatLabel:d}=n;if(r?.length&&(i.push({name:e,list:r,control:s,value:l.value,onChange:l.onChange}),null!=l.value)){let i=d??H[e],n=B[e],s=r.find(e=>e.value===l.value);t.push({key:e,value:"aspectRatio"===e&&"auto"===l.value?a:i?i(l.value):s?.label??String(l.value),icon:n?n(l.value):o})}}return{labelItems:t,paramItems:i}},[a,e])}let $=e=>Number(e),q=()=>null;function K(e){let{modelName:a,parameterConfiguration:n,aspectRatioField:r,resolutionField:l,lengthField:o,numOutputsField:s,aspectRatioInitValue:d,resolutionInitValue:u,lengthInitValue:c,numOutputsInitValue:m,useLengthSlider:y,disabled:I}=e,[C,E]=(0,g.useState)(!1),v=P(a,n),_=G({fieldName:"aspectRatio",fieldOptions:r,initValue:d}),b=G({fieldName:"resolution",fieldOptions:l,initValue:u}),T=G({fieldName:"length",fieldOptions:o,initValue:c}),N=G({fieldName:"numOutputs",fieldOptions:s,initValue:m,transformValue:$}),{labelItems:S,paramItems:k}=W([{fieldName:"aspectRatio",fieldOptions:r,formParam:_,defaultIcon:""},{fieldName:"resolution",fieldOptions:l,formParam:b,defaultIcon:"i-cus--hix2-hd"},{fieldName:"length",fieldOptions:o,formParam:T,defaultIcon:"i-cus--hix-time",control:y?"slider":"segmented"},{fieldName:"numOutputs",fieldOptions:s,formParam:N,defaultIcon:"i-cus--hix-video-more"}]),A=[...v.labelItems.filter(e=>"mode"===e.key),...S,...v.labelItems.filter(e=>"quality"===e.key),...v.labelItems.filter(e=>"mode"!==e.key&&"quality"!==e.key)];return 0===A.length?null:(0,t.jsx)(p.ChatTooltip,{disabled:I,content:(0,t.jsxs)("div",{className:"flex flex-col gap-2 max-h-[45vh] overflow-y-auto scrollbar-mini-hover",children:[(0,t.jsx)(O,{fields:v.fields.filter(e=>"mode"===e.key),disabled:I}),(0,t.jsx)(F,{items:k}),(0,t.jsx)(O,{fields:v.fields.filter(e=>"quality"===e.key),disabled:I}),(0,t.jsx)(O,{fields:v.fields.filter(e=>"mode"!==e.key&&"quality"!==e.key),disabled:I})]}),onOpenChange:e=>{E(e)},children:(0,t.jsxs)(x.default,{variant:"default",className:M.cls`whitespace-nowrap gap-2 ${I?"opacity-50 pointer-events-none":""}`,children:[A.map((e,a)=>(0,t.jsxs)(g.Fragment,{children:[(0,t.jsx)(i.Form.Item,{name:e.key,preserve:!n?.[e.key]&&void 0,noStyle:!0,children:(0,t.jsx)(q,{})}),(0,t.jsxs)("span",{children:[e.value,"numOutputs"===e.key?" Video":""]}),a<A.length-1&&(0,t.jsx)(h.Divider,{type:"vertical",className:"!border-s-f-border !mx-0 !h-4 !top-0"})]},e.key)),(0,t.jsx)(f.IconItem,{className:M.cls`size-[18px] shrink-0 i-cus--hix2-down transition-all duration-200 ${C?"rotate-180":""}`})]})})}let X=e=>Number(e),Y=()=>null;function Q(e){let{modelName:a,parameterConfiguration:n,aspectRatioField:r,resolutionField:l,numOutputsField:o,aspectRatioInitValue:s,resolutionInitValue:d,numOutputsInitValue:u,disabled:c}=e,[m,y]=(0,g.useState)(!1),I=P(a,n),C=G({fieldName:"aspectRatio",fieldOptions:r,initValue:s}),E=G({fieldName:"resolution",fieldOptions:l,initValue:d}
80),v=G({fieldName:"numOutputs",fieldOptions:o,initValue:u,transformValue:X}),{labelItems:_,paramItems:b}=W([{fieldName:"aspectRatio",fieldOptions:r,formParam:C,defaultIcon:""},{fieldName:"resolution",fieldOptions:l,formParam:E,defaultIcon:"i-cus--hix2-hd"},{fieldName:"numOutputs",fieldOptions:o,formParam:v,defaultIcon:"i-cus--hix-img-more"}]),T=[...I.labelItems.filter(e=>"mode"===e.key),..._,...I.labelItems.filter(e=>"quality"===e.key),...I.labelItems.filter(e=>"mode"!==e.key&&"quality"!==e.key)];return 0===T.length?null:(0,t.jsx)(p.ChatTooltip,{disabled:c,content:(0,t.jsxs)("div",{className:"flex flex-col gap-2 max-h-[45vh] overflow-y-auto scrollbar-mini-hover",children:[(0,t.jsx)(O,{fields:I.fields.filter(e=>"mode"===e.key),disabled:c}),(0,t.jsx)(F,{items:b}),(0,t.jsx)(O,{fields:I.fields.filter(e=>"quality"===e.key),disabled:c}),(0,t.jsx)(O,{fields:I.fields.filter(e=>"mode"!==e.key&&"quality"!==e.key),disabled:c})]}),onOpenChange:e=>{y(e)},children:(0,t.jsxs)(x.default,{variant:"default",className:M.cls`gap-2 whitespace-nowrap ${c?"opacity-50 pointer-events-none":""}`,children:[T.map((e,a)=>(0,t.jsxs)(g.Fragment,{children:[(0,t.jsx)(i.Form.Item,{name:e.key,preserve:!n?.[e.key]&&void 0,noStyle:!0,children:(0,t.jsx)(Y,{})}),(0,t.jsxs)("span",{children:[e.value," ","numOutputs"===e.key?"Img":""]}),a<T.length-1&&(0,t.jsx)(h.Divider,{type:"vertical",className:"!border-s-f-border !mx-0 !h-4 !top-0"})]},e.key)),(0,t.jsx)(f.IconItem,{className:M.cls`size-[18px] shrink-0 i-cus--hix2-down transition-all duration-200 ${m?"rotate-180":""}`})]})})}var J=e.i(884533),Z=e.i(16865),ee=e.i(363152),et=e.i(552850);let ei=et.EVeo2AspectRatio.RATIO16x9,ea=et.EVeo3Point1Duration.DURATION8;var en=e.i(959021);function er({lengthField:e,resolutionField:t,length:i,resolution:a,disableParametersRules:n,key:r}){return n&&n.forEach(n=>{"length"===n.key&&(t=t.map(e=>({...e,disabled:n.value===i&&n.affect.some(t=>t.value===e.value)})),e=e.map(e=>({...e,disabled:e.value===n.value&&n.affect.some(e=>"string"==typeof e.value&&e?.value?.toUpperCase()===a?.toUpperCase())}))),"resolution"===n.key&&(e=e.map(e=>({...e,disabled:n.value.toUpperCase()===a?.toUpperCase()&&n.affect.some(t=>t.value===e.value)})),t=t.map(e=>({...e,disabled:e.value===n.value&&n.affect.some(e=>e.value===i)})))}),"length"===r?e:t}let el={[en.EImageModel.PolloImageV2]:"standard"},eo=et.EVeo2AspectRatio.RATIO16x9,es=et.EVeo3Point1Duration.DURATION8,ed=[et.EVeo2AspectRatio.RATIO16x9,et.EVeo2AspectRatio.RATIO9x16],eu=Array.from({length:8},(e,t)=>{let i=t+3;return{label:`${i}s`,value:i}});function ec(e){let{fileCount:t,isVariant:i,modelList:a,modelName:n,variant:r}=e,l=a.find(e=>e.modelName===n),o=t?l?.imageFormConfig:l?.textFormConfig||l?.imageFormConfig,s=i?"text"===r?l?.textFormConfig||l?.imageFormConfig:l?.imageFormConfig||l?.textFormConfig:o;return{fields:s?.fields,disableParametersRules:s?.fieldRules?.disableParametersRules}}function em(e){let{fileCount:t,isVariant:i,modelList:a,modelName:n,variant:r}=e;return(0,g.useMemo)(()=>ec({fileCount:t,isVariant:i,modelList:a,modelName:n,variant:r}),[t,i,a,n,r])}e.s(["isVideoModelResolutionSupported",0,function(e){let{resolution:t,...i}=e,a=ec(i).fields?.find(e=>"resolution"===e.key)?.options?.items?.filter(e=>!e.disabled);return!a?.length||a.some(e=>e.value===t)},"useVideoModelFormConfig",0,em],582602);var ep=e.i(556303),ef=e.i(634585);let eh=ef.EWanV3Point0Duration.DURATION2,eg=()=>null;e.s(["default",0,function(){let{fileList:e,modelList:p,savedModelName:f}=(0,n.useChatStore)(e=>({fileList:e.fileListMap.chat,modelList:e.modelListMap[r.EChatInputType.AI_VIDEO],savedModelName:e.formValueMap[r.EChatInputType.AI_VIDEO]?.modelName})),h=i.Form.useFormInstance(),{templateInfo:x}=(0,m.useFormTemplate)(h),y=i.Form.useWatch("length",h),I=i.Form.useWatch("resolution",h),C=i.Form.useWatch("modelName",h),v=i.Form.useWatch("variant",h),_=(0,g.useMemo)(()=>C||p.find(e=>e.modelName===f)?.modelName||p.find(e=>e.modelName===Z.DEFAULT_VIDEO_MODEL_NAME)?.modelName||p.find(e=>e.isDefault)?.modelName||p[0]?.modelName,[p,C,f]),b=_===o.EVideoModel.VIDEO_AGENT,T=(0,J.useIsOmniReferenceMode)(_,v),N="frames"===v&&[o.EVideoModel.SEEDANCE_2_0,o.EVideoModel.SEEDANCE_2_0_FAST,o.EVideoModel.SEEDANCE_2_5,o.EVideoModel.MINIMAX_HAILUO_03].includes(_),M=_===o.EVideoModel.VEO3_1&&"ingredients"===v,S=[o.EVideoModel.GEMINI_OMNI_FLASH,o.EVideoModel.GEMINI_OMNI_1_1_FLASH].includes(_)&&"ingredients"===v,k=e.some(e=>(0,l.isImageFile)(e)),A=e.some(e=>(0,l.isVideoFile)(e)),w=e.some(e=>(0,l.isVideoFile)(e)&&"success"===e.uploadStatus),j=!T&&A,F=x||j?void 0:p.find(e=>e.modelName===_)?.parameterConfiguration,R=_===o.EVideoModel.KLING_V3_OMNI&&"ingredients"===v&&w,{isVariant:L}=(0,c.useFormVariant)({chatType:r.EChatInputType.AI_VIDEO,modelName:_,variant:v}),V=em({fileCount:e.length,isVariant:L,modelList:p,modelName:_,variant:v}),{enabled:D,initialLength:O,lengthOptions:P}
80=function(e){let{configuredInitialLength:t,fileList:a,length:n,modelName:r}=e,o=i.Form.useFormInstance(),s=(0,ep.isHixChatWanV3Point0Model)(r),d=(0,g.useMemo)(()=>{if(!s)return ef.WAN_V3_0_MAX_TOTAL_SECONDS;let e=a.reduce((e,t)=>(0,l.isVideoFile)(t)?e+(t.metadata?.duration||0):e,0);return Math.floor(ef.WAN_V3_0_MAX_TOTAL_SECONDS-e+ef.WAN_V3_0_MEDIA_SECONDS_TOLERANCE)},[s,a]),u=(0,g.useMemo)(()=>{let e;return s?(e=Math.min(ef.WAN_V3_0_MAX_TOTAL_SECONDS,Math.floor(d)),Array.from({length:ef.WAN_V3_0_MAX_TOTAL_SECONDS-eh+1},(t,i)=>{let a=eh+i;return{label:`${a}s`,value:a,disabled:a>e}})):void 0},[s,d]),c=(0,g.useMemo)(()=>{let e=Math.max(eh,d),i=Number(t);return Number.isFinite(i)&&i>=eh?Math.min(i,e):eh},[t,d]);return(0,g.useEffect)(()=>{let e=Number(n);if(!s||void 0===n||e>=eh&&e<=d)return;let t=Math.max(eh,d);o.setFieldValue("length",e>d?t:c)},[s,o,c,n,d]),{enabled:s,initialLength:c,lengthOptions:u}}({configuredInitialLength:V.fields?.find(e=>"length"===e.key)?.value,fileList:e,length:y,modelName:_}),z=function(e){let{disableParametersRules:t,fields:i,isGeminiOmniReferenceMode:a,isVeo31ReferenceMode:n,isVideoGenerated:r,isWanV3Point0VideoModel:l,length:o,resolution:s,templateInfo:d,useKlingV3OmniVideoReferenceLengths:u,variant:c,wanV3Point0InitialLength:m,wanV3Point0LengthOptions:p}=e;return(0,g.useMemo)(()=>{let e=e=>i?.find(t=>t.key===e),f=e("length"),h=e("resolution"),g=e("aspectRatio"),x=e("numOutputs"),y=f?.options?.items||[],I=h?.options?.items||[],C=g?.options?.items;d&&(C=d.supportedAspectRatio?.map(e=>({label:e,value:e}))),n&&(C=C?.filter(e=>e.value===eo)),a&&(C=C?.filter(e=>ed.includes(e.value)));let v=er({lengthField:y,resolutionField:I,disableParametersRules:t,length:Number(o),resolution:s?.toUpperCase()||"",key:"resolution"});r&&(v=E.defaultResolutions);let _=er({lengthField:y,resolutionField:I,disableParametersRules:t,length:Number(o),resolution:s?.toUpperCase()||"",key:"length"});(r||d)&&(_=E.defaultLengths),p&&(_=p),(u||a)&&(_=eu),n&&(_=_.filter(e=>e.value===es));let b=u||a||n||l?_:function({lengthField:e,disableParametersRules:t,variant:i}){if(!e?.length)return e;let a=function(e,t,i){if(!e?.length)return[];let a=[];return e.forEach(e=>{e.key!==t||void 0===e.value||e.affect?.some(e=>i[e.key]===e.value)&&a.push(e.value)}),a}(t,"length",{variant:i});return a.length?e.map(e=>({...e,disabled:e.disabled||a.includes(e.value)})):e}({lengthField:_,disableParametersRules:t,variant:c});return{aspectRatioField:C,aspectRatioInitValue:g?.value,resolutionField:v,resolutionInitValue:h?.value,lengthField:b,lengthInitValue:a?5:l?m:f?.value,numOutputsField:d?void 0:x?.options?.items,numOutputsInitValue:x?.value}},[t,i,a,n,r,l,o,s,d,u,c,m,p])}({...V,isGeminiOmniReferenceMode:S,isVeo31ReferenceMode:M,isVideoGenerated:j,isWanV3Point0VideoModel:D,length:y,resolution:I,templateInfo:x,useKlingV3OmniVideoReferenceLengths:R,variant:v,wanV3Point0InitialLength:O,wanV3Point0LengthOptions:P}),{aspectRatioField:U,aspectRatioInitValue:G,lengthInitValue:H}=z,B=!!(V.fields||x),W=k&&"ingredients"!==v&&!N,$=W&&!!U?.length,q=function(e){let{aspectRatioField:t,aspectRatioInitValue:i,hideAspectRatio:a,isVideoAgentModel:n,isVideoGenerated:r,isWanV3Point0VideoModel:l,lengthField:s,lengthInitValue:d,modelName:u,numOutputsField:c,numOutputsInitValue:m,resolutionField:p,resolutionInitValue:f,usingTemplate:h}=e;return(0,g.useMemo)(()=>r?{numOutputsField:n?void 0:c,numOutputsInitValue:n?void 0:m,useLengthSlider:!1}:{aspectRatioField:a?void 0:t,aspectRatioInitValue:i,resolutionField:h?void 0:p,resolutionInitValue:h?void 0:f,lengthField:s,lengthInitValue:d,numOutputsField:n?void 0:c,numOutputsInitValue:n?void 0:m,useLengthSlider:u===o.EVideoModel.SEEDANCE_2_5||l},[t,i,a,n,r,l,s,d,u,c,m,p,f,h])}({...z,hideAspectRatio:W,isVideoAgentModel:b,isVideoGenerated:j,isWanV3Point0VideoModel:D,modelName:_,usingTemplate:!!x});return(!function(e){let{aspectRatioInitValue:t,enabled:i,form:a,lengthInitValue:n}=e,r=(0,g.useRef)(i);(0,g.useEffect)(()=>{if(i){r.current=!0,a.setFieldsValue({aspectRatio:ei,length:ea});return}r.current&&(r.current=!1,a.setFieldsValue({aspectRatio:t,length:n}))},[t,i,a,n])}({aspectRatioInitValue:G,enabled:M,form:h,lengthInitValue:H}),!function(e){let{aspectRatioOptions:t,fileList:i,form:a}=e;(0,g.useEffect)(()=>{let e=i.find(e=>(0,l.isImageFile)(e));if(!t?.length||!e?.originFileObj)return;let n=e.originFileObj,r=!0;return(async()=>{let{width:e,height:i}=await (0,ee.getImageWidthAndHeight)(n),l=Number.parseInt(String(e/i*100)),o=t.find(e=>{let[t,i]=String(e.value).split(":").map(Number);return Number.parseInt(String(t/i*100))===l})?.value;r&&o&&a.setFieldValue("aspectRatio",o)})(),()=>{r=!1}},[t,i,a])}({aspectRatioOptions:U,fileList:e,form:h}),B)?(0,t.jsxs)(t.Fragment,{children:[!b&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(K,{...q,modelName:_,parameterConfiguration:F}),$&&(0,t.jsx)(i.Form.Item,{name:"aspectRatio",noStyle:!0,children:(0,t.jsx)(eg,{})})]}),(0,t.jsx)(u.default,{}),(0,t.jsx)(s.default,{fileList:e}),!x&&j&&(0,t.jsx)(d.default,{chatType:r.EChatInputType.AI_VIDEO})]}):(0,t.jsx)(a.Skeleton.Input,{active:!0,size:"small",style:{width:80,height:32,borderRadius:10}})}],433645);let ex=[en.EImageModel.StableDiffusion3,en.EImageModel.WAN2_5_T2I_PREVIEW,en.EImageModel.QWEN_IMAGE];e.s(["default",0,function(e){let{disabled:o}=e,{fileList:s,modelList:c,savedModelName:p}=(0,n.useChatStore)(e=>
80({fileList:e.fileListMap.chat,modelList:e.modelListMap[r.EChatInputType.AI_IMAGE],savedModelName:e.formValueMap[r.EChatInputType.AI_IMAGE]?.modelName})),h=i.Form.useFormInstance(),x=i.Form.useWatch("modelName",h),y=(0,g.useMemo)(()=>x||c.find(e=>e.modelName===p)?.modelName||c.find(e=>e.modelName===Z.DEFAULT_IMAGE_MODEL_NAME)?.modelName||c.find(e=>e.isDefault)?.modelName||c[0]?.modelName,[c,x,p]),I=y===en.EImageModel.IMAGE_AGENT,C=s.some(e=>(0,l.isImageFile)(e))&&ex.includes(y),{templateInfo:v}=(0,m.useFormTemplate)(h),{fields:_,disableParametersRules:b,parameterConfiguration:T}=(0,g.useMemo)(()=>{let e=c.find(e=>e.modelName===y),t=s.length?e?.imageFormConfig:e?.textFormConfig||e?.imageFormConfig;return{fields:t?.fields,parameterConfiguration:e?.parameterConfiguration,disableParametersRules:t?.fieldRules?.disableParametersRules}},[c,y,s.length]),{aspectRatioField:N,aspectRatioInitValue:S,numOutputsField:k,numOutputsInitValue:A,resolutionField:w,resolutionInitValue:j,styleField:F}=(0,g.useMemo)(()=>{let e=_?.find(e=>"aspectRatio"===e.key),t=_?.find(e=>"numOutputs"===e.key),i=_?.find(e=>"resolution"===e.key),a=i?.options?.items;return{aspectRatioField:v?.supportedAspectRatio?.length?E.templateDefaultAspectRatio:e?.options?.items,aspectRatioInitValue:e?.value,numOutputsField:v?E.templateDefaultNumOutputs:t?.options?.items,numOutputsInitValue:t?.value,resolutionField:function({resolutionField:e,disableParametersRules:t,modelName:i}){let a=i?el[i]:void 0;return a&&t?.length&&e?.length?e.map(e=>{let i=t.find(t=>"resolution"===t.key&&t.value?.toUpperCase()===e.value?.toUpperCase()),n=i?.affect?.some(e=>"mode"===e.key&&e.value?.toLowerCase()===a.toLowerCase())??!1;return{...e,disabled:n}}):e}({resolutionField:a||[],disableParametersRules:b,modelName:y}),resolutionInitValue:i?.value,styleField:_?.find(e=>"style"===e.key)}},[_,v,y,b]);return(0,t.jsx)(t.Fragment,{children:_||v||I?(0,t.jsxs)(t.Fragment,{children:[!I&&(0,t.jsx)(Q,{aspectRatioField:C?void 0:N,aspectRatioInitValue:S,resolutionField:v?void 0:w,resolutionInitValue:v?void 0:j,numOutputsField:k,numOutputsInitValue:A,parameterConfiguration:T,modelName:y,disabled:o}),F&&!v&&(0,t.jsx)(d.default,{disabled:o}),(0,t.jsx)(u.default,{disabled:o}),I&&(0,t.jsxs)("div",{className:M.cls`
81                rounded-[10px] py-1.5 px-2.5 whitespace-nowrap
82                text-f-text-secondary text-sm flex items-center gap-x-1 cursor-default
83              `,children:[(0,t.jsx)(f.IconItem,{className:"i-com--logo-openai  size-[18px]"}),"GPT Image 2.0"]})]}):(0,t.jsx)(a.Skeleton.Input,{active:!0,size:"small",style:{width:80,height:32,borderRadius:10}})})}],955861);var ey=e.i(793995),eI=e.i(269430),eC=e.i(303566);e.i(473430);var eE=e.i(147841);e.i(17335);var ev=e.i(508861),e_=e.i(718451);e.s(["default",0,function(e){let{className:a,disabled:n}=e,l=i.Form.useFormInstance(),o=i.Form.useWatch("inputValue",l),s=i.Form.useWatch("modelName",l),d=(0,ev.useChatContainerContext)(e=>e.chatType),{mutateAsync:u,isLoading:c}=e_.api.aiVideo.generateDescription.useMutation(),m=async()=>{if(n||!o)return;let e=await u({description:o});e?.data?.length&&(l.resetFields(["inputValue"]),l.setFieldValue("inputValue",e.data[0]),eE.chatFormEditorMedia.focus(Z.HIX_CHAT_FORM_MEDIA_KEYS.NORMAL,{cursor:"end"}))};return eC.AGENT_MODELS.includes(s)||[r.EChatInputType.AI_VIDEO,r.EChatInputType.AI_IMAGE].includes(d)&&!s?null:(0,t.jsx)(eI.Tooltip,{title:ey.i18n._({id:"AikYXv"}),overlayInnerStyle:{fontSize:12},children:(0,t.jsx)(x.default,{variant:"outline",className:M.cls`whitespace-nowrap font-semibold ${a}`,disabled:n||!o||c,onClick:()=>{m()},children:(0,t.jsx)(f.IconItem,{className:M.cls`${c?"i-cus--hix2-loading animate-spin":"i-cus--hix-change"} size-[18px]`})})})}],570689);var eb=e.i(380707),eT=e.i(881598);let eN="text_length",eM=function(e){let{disabled:a}=e,[n,r]=(0,g.useState)(!1),[l,o]=(0,g.useState)(!1),s=(0,C.useLingui)(),d=(0,g.useMemo)(()=>[{label:s.i18n._(ey.i18n._({id:"R9Khdg"})),value:eT.EWriterTextLength.AUTO,icon:"i-cus--hix2-rich-auto",text:s.i18n._(ey.i18n._({id:"o7LK1h"}))},{label:s.i18n._(ey.i18n._({id:"TmtoNh"})),value:eT.EWriterTextLength.NORMAL,icon:"i-cus--hix2-regular-text",text:s.i18n._(ey.i18n._({id:"zPQ-V3"}))},{label:s.i18n._(ey.i18n._({id:"UF8ozp"})),value:eT.EWriterTextLength.LONG,icon:"i-cus--hix-long-text",text:s.i18n._(ey.i18n._({id:"GCi9Fi"}))}],[s]),{value:u,onChange:c}=G({fieldName:eN,fieldOptions:d,initValue:eT.EWriterTextLength.AUTO}),m=(0,g.useMemo)(()=>d.find(e=>e.value===u),[u,d]);return(0,t.jsx)(i.Form.Item,{name:eN,noStyle:!0,children:(0,t.jsx)(eb.default,{title:m?.text,tooltipProps:{open:l,onOpenChange:e=>{n||o(e)}},children:(0,t.jsx)(R.default,{options:d,onChange:e=>{r(!1),c(e)},onOpenChange:e=>{r(e),e&&o(!1)},hasSuffix:!0,placement:"bottomLeft",boxClassName:"w-[180px]",iconClassName:M.cls`size-[18px]`,value:u,children:(0,t.jsxs)(x.default,{variant:"default",disabled:a,className:M.cls`
84              text-f-text-secondary whitespace-nowrap  
85              'hover:text-f-text-secondary
86            `,children:[(0,t.jsx)(f.IconItem,{className:M.cls`${m?.icon} size-[18px]`}),m?.label,(0,t.jsx)(f.IconItem,{className:M.cls`i-cus--hix2-down size-[18px] transition-all duration-200 ${n?"rotate-180":""}`})]})})})})};var eS=e.i(263700),ek=e.i(645217),eA=e.i(616405);let ew="output_format",ej=function(e){let{disabled:a}=e,n=(0,C.useLingui)(),[r,l]=(0,g.useState)(!1),[o,s]=(0,g.useState)(!1),d=(0,g.useMemo)(()=>[{label:n.i18n._(ey.i18n._({id:"NP5Nbf"})),desc:n.i18n._(ey.i18n._({id:"PKGbk_"})),value:eT.EWriterOutputFormat.HTML,icon:"i-cus--hix2-rich-text",image:"/images/chat/rich-text.png"},{label:n.i18n._(ey.i18n._({id:"u6Hp4N"})),desc:n.i18n._(ey.i18n._({id:"93unhV"})),value:eT.EWriterOutputFormat.MARKDOWN,icon:"i-cus--hix2-markdown",image:"/images/chat/markdown.png"}],[n]),{value:u,onChange:c}=G({fieldName:ew,fieldOptions:d,initValue:eT.EWriterOutputFormat.HTML}),m=(0,g.useMemo)(()=>d.find(e=>e.value===u),[u,d]);return(0,t.jsx)(i.Form.Item,{name:ew,noStyle:!0,children:(0,t.jsx)(eS.Popover,{content:m&&(0,t.jsxs)("div",{className:"p-1.5 flex flex-col gap-y-[6px]",children:[(0,t.jsx)("div",{className:"text-xs text-f-text-secondary",children:m?.desc}),(0,t.jsx)(ek.default,{src:m?.image,width:158,height:120,className:"w-[158px] h-auto rounded-md",alt:m?.label})]}),rootClassName:eA.tw`[&_.coco-popover-inner]:!p-[6px] [&_.coco-popover-inner]:!shadow-effects-m [&_.coco-popover-inner]:!rounded-[12px] [&_.coco-popover-inner]:border [&_.coco-popover-inner]:bg-f-bg-base [&_.coco-popover-inner]:border-f-border`,arrow:!1,trigger:["hover"],open:o,onOpenChange:e=>{r||s(e)},children:(0,t.jsx)(R.default,{options:d,onChange:e=>{c(e),l(!1)},onOpenChange:e=>{l(e),e&&s(!1)},placement:"bottomLeft",boxClassName:"w-[200px]",hasSuffix:!0,iconClassName:M.cls`size-[18px]`,value:u,children:(0,t.jsxs)(x.default,{variant:"default",disabled:a,className:M.cls`
87              text-f-text-secondary whitespace-nowrap  
88              hover:text-f-text-secondary
89            `,children:[(0,t.jsx)(f.IconItem,{className:M.cls`${m?.icon} size-[18px]`}),m?.label,(0,t.jsx)(f.IconItem,{className:M.cls`i-cus--hix2-down size-[18px] transition-all duration-200 ${r?"rotate-180":""}`})]})})})})};e.s(["default",0,function(e){let{disabled:i}=e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ej,{disabled:i}),(0,t.jsx)(eM,{disabled:i})]})}],339819),e.i(243046);var eF=e.i(939189),eR=e.i(452234);let eL="slidesMode",eV="slidesMode",eD="slidesAspectRatio",eO=()=>null,eP=[{label:"16:9",description:(0,t.jsx)(C.Trans,{id:"ARvWk4"}),value:eF.ESlidesAspectRatio.WIDESCREEN,icon:E.aspectRatioIcons[eF.ESlidesAspectRatio.WIDESCREEN]},{label:"4:3",description:(0,t.jsx)(C.Trans,{id:"Wrh45_"}),value:eF.ESlidesAspectRatio.STANDARD,icon:E.aspectRatioIcons[eF.ESlidesAspectRatio.STANDARD]}],ez=[{label:(0,t.jsx)(C.Trans,{id:"TJBHlP"}),value:"default",icon:"i-cus--hix2-professional"},{label:(0,t.jsx)(C.Trans,{id:"0xD_Jm"}),value:"creative",icon:"i-cus--hix2-creative"}];function eU({disabled:e,className:a}){let n=i.Form.useFormInstance(),r=i.Form.useWatch(eV,n)??n.getFieldValue(eV),l=i.Form.useWatch(eD,n),o=(0,eR.resolveSlidesAspectRatio)(l??n.getFieldValue(eD)),{currentValue:s,updateSlidesMode:d}=function(e){let{form:t,slidesMode:i}
89=e,a=i?"creative":"default",n=(0,eR.normalizeSlidesFormMode)(i);return(0,g.useEffect)(()=>{i!==n&&t.setFieldValue(eL,n)},[t,i,n]),{currentValue:a,updateSlidesMode:e=>{"default"===e?t.setFieldValue(eL,void 0):t.setFieldValue(eL,eT.ESlidesMode.GPT_IMAGE_2)}}}({form:n,slidesMode:r}),u=eP.find(e=>e.value===o)??eP[0];return(0,t.jsxs)("div",{className:eA.tw`inline-flex shrink-0 items-center gap-1 ${a||""}`,children:[(0,t.jsx)("div",{className:eA.tw`
90          inline-flex items-center gap-1 rounded-full bg-f-bg-layout p-[3px]
91          ${e?"opacity-60":""}
92        `,children:ez.map(i=>{let a=i.value,n=s===a,r=(0,t.jsxs)("button",{type:"button",disabled:e,onClick:()=>{!e&&a!==s&&d(a)},className:M.cls`
93                flex items-center gap-1 rounded-full px-1.5 py-[3px] text-sm leading-5 transition-colors
94                ${n?"bg-white text-f-text shadow-[0_1px_3px_rgba(17,24,39,0.08)]":"text-f-text-tertiary hover:text-f-text"}
95                ${e?"cursor-not-allowed":"cursor-pointer"}
96              `,children:[(0,t.jsx)(f.IconItem,{className:M.cls`${i.icon} size-[18px]`}),(0,t.jsx)("span",{children:i.label})]});return"creative"!==a?(0,t.jsx)("div",{children:r},a):(0,t.jsx)(eb.default,{showTooltip:!0,tooltipProps:{mouseLeaveDelay:0,align:{offset:[12,-4]},overlayInnerStyle:{padding:"8px 6px"}},title:(0,t.jsx)(C.Trans,{id:"srwZ0V"}),children:(0,t.jsx)("span",{children:r})},a)})}),(0,t.jsx)(R.default,{options:eP,value:o,onChange:t=>{e||n.setFieldValue(eD,t)},renderOption:(e,i)=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.IconItem,{className:M.cls`${e.icon} size-[18px] shrink-0`}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col justify-center",children:[(0,t.jsx)("span",{className:M.cls`w-full truncate text-sm leading-5 ${i?"text-f-text":"text-f-text-secondary"}`,children:e.label}),(0,t.jsx)("span",{className:"w-full truncate text-xs leading-4 text-f-text-tertiary",children:e.description})]})]}),contentClassName:"w-max min-w-[226px] max-w-[min(320px,calc(100vw-32px))] gap-y-0.5",boxClassName:"!gap-x-2 !px-2 !py-1.5 rounded-lg",placement:"bottomLeft",children:i=>(0,t.jsxs)("button",{type:"button",disabled:e,className:M.cls`
97              inline-flex h-8 shrink-0 items-center justify-center gap-1 overflow-hidden
98              rounded-full px-2.5 py-1.5 text-sm leading-5 text-f-text-secondary
99              transition-colors
100              ${i?"bg-f-bg-hover":"hover:bg-f-bg-hover"}
101              ${e?"cursor-not-allowed opacity-60":"cursor-pointer"}
102            `,children:[(0,t.jsx)(f.IconItem,{className:M.cls`${u.icon} size-[18px] shrink-0`}),(0,t.jsx)("span",{children:u.label}),(0,t.jsx)(f.IconItem,{className:M.cls`i-cus--hix2-down size-[18px] shrink-0 text-f-text-secondary transition-transform duration-200 ${i?"rotate-180":""}`})]})})]})}e.s(["default",0,function(e){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.Form.Item,{name:eV,noStyle:!0,children:(0,t.jsx)(eO,{})}),(0,t.jsx)(i.Form.Item,{name:eD,noStyle:!0,children:(0,t.jsx)(eO,{})}),(0,t.jsx)(eU,{...e})]})}],102001);var eG=e.i(620685),eH=e.i(362420),eB=e.i(250475),eW=e.i(809438),e$=e.i(661412),eq=e.i(902667);e.s(["default",0,function({disabled:e,className:a}){let l=i.Form.useFormInstance(),{setInputValue:o}=(0,n.useChatStore)(e=>({setInputValue:e.setInputValue})),{chatId:s,chatType:d,containerType:u,setChatContainerContext:c}=(0,ev.useChatContainerContext)(e=>({chatId:e.chatId,chatType:e.chatType,containerType:e.containerType,setChatContainerContext:e.getSetFunction()})),{projectId:m}=(0,e$.useCurrentProjectScope)(),p=(0,g.useMemo)(()=>[{key:"AI Slides",icon:"i-cus--hix2-ai-slides",chatType:r.EChatInputType.AI_SLIDES,projectMethod:"slides_click"},{key:"AI Video",icon:"i-cus--hix2-video",chatType:r.EChatInputType.GENERIC_VIDEO,projectMethod:"video_click"},{key:"AI Image",icon:"i-cus--hix2-image",chatType:r.EChatInputType.GENERIC_IMAGE,projectMethod:"image_click"},{key:"AI Writer",icon:"i-cus--hix2-writing",chatType:r.EChatInputType.AI_WRITER,projectMethod:"docs_click"},{key:"Deep Research",icon:"i-cus--hix2-creative",chatType:r.EChatInputType.DEEP_RESEARCH,projectMethod:"research_click"}],[]),f=(0,g.useCallback)(t=>{if(e||d===t.chatType)return;m?(0,eq.trackProject)({type:"input_box",id:m,method:t.projectMethod}):(0,eW.trackClickFunctionButton)({key:t.key,buttonUrl:window.location.pathname});let i=l.getFieldValue("inputValue");void 0!==i&&o(i,"chat"),c(e=>{e.chatType=t.chatType,e.showcaseFilter=(0,eH.getDefaultShowcaseFilter)(t.chatType),s&&(e.agentMode="agui")}),[r.EChatContainerType.INDEX_ENTRY,r.EChatContainerType.HOME_ENTRY].includes(u)&&requestAnimationFrame(()=>{eE.chatFormEditorMedia.focus(Z.HIX_CHAT_FORM_MEDIA_KEYS.NORMAL,{cursor:"end"})})},[s,d,u,e,l,m,c,o]);return u===r.EChatContainerType.SCHEDULED_TASKS?null:(0,t.jsx)("div",{className:eA.tw`flex items-center gap-1 pr-5 ${a}`,children:p.map(i=>(0,t.jsxs)("button",{type:"button",disabled:e,title:i.key,onClick:e=>{e.stopPropagation(),f(i)},className:M.cls`
103            py-[5px] px-[10px] gap-1 border border-f-border flex items-center
104            rounded-[60px] select-none text-f-text-secondary whitespace-nowrap
105            transition-colors
106            ${d===i.chatType?"bg-f-bg-hover text-f-text":"hover:bg-f-bg-hover"}
107            ${e?"cursor-not-allowed opacity-50":"cursor-pointer"}
108          `,children:[(0,t.jsx)(eG.IconItem,{className:eA.tw`size-[18px] ${i.icon}`}),(0,t.jsx)("span",{className:"leading-5 text-sm",children:(0,eB.getEmbedPrefixContent)(i.chatType)})]},i.key))})}],143967);var eK=e.i(255034),eX=e.i(831628);let eY={Free:1,New:2,Hot:3},eQ={Free:M.cls`bg-f-secondary-hover`,New:M.cls`bg-[linear-gradient(90deg,#FE4C4E_0%,#FE57BB_48%,#7959F6_100%)]`,Hot:M.cls`bg-gradient-to-r from-[#FFA600] to-[#FF1D11]`},eJ={Free:(0,t.jsx)(C.Trans,{id:"2POOFK"}),New:(0,t.jsx)(C.Trans,{id:"isRobC"}),Hot:(0,t.jsx)(C.Trans,{id:"Jd58Fo"})};function eZ({marks:e,className:i}){if(!e||0===e.length)return null;let a=[...e].sort((e,t)=>eY[e]-eY[t])[0];if(!a)return null;let n="New"===a;return(0,t.jsxs)("span",{className:eA.tw`
109        relative inline-flex items-center justify-center rounded-full text-f-text-light
110        ${n?"overflow-hidden px-1 pb-0.5 pt-px":"px-[6px] py-[1px] font-semibold"}
111        ${eQ[a]}
112        ${i}
113      `,children:[n&&(0,t.jsx)("span",{"aria-hidden":!0,className:M.cls`
114            absolute inset-0 rounded-[inherit]
115            bg-[conic-gradient(from_163.61deg_at_50%_0%,rgba(255,255,255,0)_0deg,rgba(255,255,255,0.2)_358.63deg,rgba(255,255,255,0)_360deg)]
116          `}),(0,t.jsx)("span",{className:M.cls`
117          relative inline-flex items-center
118          ${n?"-left-px h-3 w-[22px] shrink-0 justify-center text-center text-[10px] font-semibold italic leading-[normal]":"origin-center scale-[0.833] text-xs"}
119        `,children:eJ[a]}),n&&(0,t.jsx)("span",{"aria-hidden":!0,className:M.cls`
120            pointer-events-none absolute inset-0 rounded-[inherit]
121            shadow-[inset_-1px_-1px_2px_0px_rgba(255,255,255,0.25),inset_1px_1px_3px_0px_rgba(255,255,255,0.25)]
122          `})]})}e.s(["default",0,eZ],87135);var e0=e.i(34183);function e1({icon:e,label:i,marks:a,iconUrl:n,isActive:r}){let l=n??e;return(0,t.jsxs)("div",{className:eA.tw`
123        flex items-center gap-[6px] md:gap-1 w-full
124        text-sm font-normal text-f-text md:text-xs
125        ${r?"font-medium":""}
126      `,children:[!!l&&(0,t.jsx)("div",{className:"flex size-[18px] items-center justify-center rounded-md bg-f-bg-container",children:(0,t.jsx)(e0.default,{icon:l,alt:i,size:"lg"})}),(0,t.jsx)("span",{className:"flex-1 truncate line-clamp-1",children:i}),(0,t.jsx)(eZ,{marks:a,className:"md:hidden"})]})}function e2({icon:e,label:i,marks:a,disabled:n}){return(0,t.jsxs)("div",{className:eA.tw`
127        flex items-center gap-[6px] md:gap-1 w-full
128        text-sm font-normal text-f-text md:text-xs
129        ${n?"cursor-not-allowed opacity-40":""}
130      `,children:[!!e&&(0,t.jsx)("div",{className:"flex size-[18px] items-center justify-center rounded-md bg-f-bg-container",children:(0,t.jsx)(e0.default,{icon:e,alt:i,size:"lg"})}),(0,t.jsx)("span",{className:"flex-1 truncate line-clamp-1",children:i}),(0,t.jsx)(eZ,{marks:a})]})}let e8=M.cls`
131  [&_.coco-cascader-menu]:scrollbar-mini-hover
132`,e5=M.cls`
133  !w-auto
134  [&_.coco-select-selector]:!h-auto
135  [&_.coco-select-selector]:!min-h-0
136  [&_.coco-select-selector]:!border-transparent
137  [&_.coco-select-selector]:!bg-transparent
138  [&_.coco-select-selector]:!p-0
139  [&_.coco-select-selector]:!shadow-none
140  [&_.coco-select-selection-item]:!p-0
141  [&_.coco-select-selection-item]:!leading-none
142  [&.coco-select-focused_.coco-select-selector]:!shadow-none
143  [&.coco-select-focused_.coco-select-selector]:!border-transparent
144`,e4=M.cls`
145  !bg-white
146  border
147  !border-f-border
148  !rounded-xl
149  !shadow-effects-m
150
151  [&_.coco-cascader-menus]:!w-full
152  [&_.coco-cascader-menus]:!h-[360px]
153  md:[&_.coco-cascader-menus]:!h-[300px]
154  [&_.coco-cascader-menus]:p-2
155  [&_.coco-cascader-menus]:!flex
156  [&_.coco-cascader-menus]:!gap-3
157
158  [&_.coco-cascader-menu]:!h-full
159  [&_.coco-cascader-menu]:!flex-grow-0
160  [&_.coco-cascader-menu:nth-child(1)]:border-none
161  [&_.coco-cascader-menu:nth-child(1)]:!p-0
162  [&_.coco-cascader-menu:nth-child(1)]:!w-[min(190px,45%)]
163  md:[&_.coco-cascader-menu:nth-child(1)]:!w-[min(150px,40%)]
164
165  [&_.coco-cascader-menu:nth-child(2)]:!w-0
166  [&_.coco-cascader-menu:nth-child(2)]:!flex-1
167  [&_.coco-cascader-menu:nth-child(2)]:!rounded-lg
168  [&_.coco-cascader-menu:nth-child(2)]:!border
169  [&_.coco-cascader-menu:nth-child(2)]:!border-f-border
170
171
172  [&_.coco-cascader-menu-item-content]:!w-full
173
174
175  [&_.coco-cascader-menu-item]:!shrink-0
176  [&_.coco-cascader-menu-item]:rounded-lg
177  [&_.coco-cascader-menu-item]:!px-2
178  [&_.coco-cascader-menu-item]:!py-[6px]
179  [&_.coco-cascader-menu-item-active]:!bg-f-bg-hover
180  [&_.coco-cascader-menu-item:hover]:!bg-f-bg-hover
181  [&_.coco-cascader-menu-item-expand-icon]:!hidden
182`;function e6(e){let t=e.data;return t&&"object"==typeof t&&"modelName"in t&&"string"==typeof t.modelName?t.modelName:e.value}e.s(["getModelOptionModelName",0,e6],344967);
182let e3=(0,g.forwardRef)(function({value:e,onChange:i,options:a,disabled:n,className:r,popupClassName:l,placeholder:o,showPoweredBy:s,onDropdownVisibleChange:d,...u},c){let m=(0,g.useRef)(null),{getDropdownAlign:p,containerRef:h,containerWidth:y}=(0,eX.useDropdownAlign)({dropdownWidth:480,triggerRef:m}),[I,E]=(0,g.useState)(null),[v,_]=(0,g.useState)(!1),b=(0,z.useMemoizedFn)(e=>{_(e),e?E(h?p():{offset:[0,6]}):E(null),d?.(e)}),{cascaderValue:T,selectedModel:N}=(0,g.useMemo)(()=>{if(!e||!a.length)return{cascaderValue:void 0,selectedModel:null};for(let t of a){let i=t.children?.find(t=>e6(t)===e);if(i)return{cascaderValue:[t.value,i.value],selectedModel:i}}return{cascaderValue:void 0,selectedModel:null}},[e,a]),S=(0,z.useMemoizedFn)((e,t)=>{let a=e[1];if("string"!=typeof a)return;let n=t[1];i?.(n?e6(n):a,n?.data)});return(0,t.jsx)("span",{ref:m,className:"inline-flex",...u,children:(0,t.jsx)(eK.Cascader,{ref:c,expandTrigger:"hover",suffixIcon:null,allowClear:!1,disabled:n,placeholder:o,placement:"bottomLeft",dropdownAlign:I??(h?p():{offset:[0,6]}),className:r,rootClassName:e5,popupClassName:eA.tw`
183          ${e4}
184          ${e8}
185          ${l}
186        `,dropdownStyle:{minWidth:Math.min(500,y||500)},dropdownRender:e=>(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"px-3 pt-2 text-xs text-f-text-secondary",children:(0,t.jsx)(C.Trans,{id:"__nm2_"})}),e]}),displayRender:()=>{let{icon:e,label:i}=N||{};return(0,t.jsxs)(x.default,{variant:"default",disabled:n,className:"whitespace-nowrap min-w-max shrink-0",children:[s&&(0,t.jsx)("div",{className:M.cls`
187                    border-r border-f-border pr-1 text-xs font-semibold
188                    bg-[linear-gradient(94.78deg,#18BAFF_0%,#3A7EFF_100%)]
189                    bg-clip-text text-transparent
190                  `,children:(0,t.jsx)(C.Trans,{id:"g2UNkE"})}),(0,t.jsx)(e0.default,{icon:e,alt:i,size:"lg"}),i,(0,t.jsx)(f.IconItem,{className:M.cls`size-[18px] shrink-0 i-cus--hix2-down transition-transform duration-300 ${v?"rotate-180":""}`})]})},optionRender:e=>{let{isLeaf:i,label:a,icon:n,iconUrl:r,marks:l,value:o,disabled:s}=e;if(i)return(0,t.jsx)(e2,{icon:n,label:a,marks:l,disabled:s});let d=T?.[0]===o;return(0,t.jsx)(e1,{icon:n,iconUrl:r,label:a,marks:l,isActive:d})},value:T,options:a,onChange:S,onDropdownVisibleChange:b})})});e.s(["default",0,e3],979050);let e7={[o.EVideoModel.SEEDANCE_2_0]:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("div",{children:(0,t.jsx)(C.Trans,{id:"M0WtZG"})}),(0,t.jsx)("div",{children:(0,t.jsx)(C.Trans,{id:"Y5mNAo"})})]}),[o.EVideoModel.SEEDANCE_2_0_FAST]:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("div",{children:(0,t.jsx)(C.Trans,{id:"M0WtZG"})}),(0,t.jsx)("div",{children:(0,t.jsx)(C.Trans,{id:"Y5mNAo"})})]}),agentWithChat:(0,t.jsx)("div",{children:(0,t.jsx)(C.Trans,{id:"8AzS40"})}),agentWithoutChat:(0,t.jsx)("div",{children:(0,t.jsx)(C.Trans,{id:"qWdW4p"})})},e9="modelName",te=[...eC.AGENT_MODELS];e.s(["FORM_FIELD_NAME",0,e9,"modelTips",0,e7,"showTooltipModels",0,te],113482);var tt=e.i(826253),ti=e.i(864894),ta=e.i(473406);function tn(e){let{query:t}=(0,ta.useRouter)();return(0,ti.getQueryParamByKey)(e,t)}e.s(["useLatestQuery",0,tn],457968);var tr=e.i(50603),tl=e.i(934444);let to=[r.EChatContainerType.SHARE,r.EChatContainerType.CHAT_LIST],ts=[eT.EAgentType.AGENT_IMAGE,eT.EAgentType.AGENT_VIDEO],td={[en.EImageModel.NanoBanana2Google]:en.EImageModel.Gemini31FlashImage};function tu(e,t){let i;if(!t)return;let a=td[i=en.EImageModel[t]||o.EVideoModel[t]||t]||i;return e.find(e=>e.modelName===a)?.modelName}e.s(["useModelSelector",0,function({type:e,entryInitialModelName:t,form:i}){let{containerType:a,isChatList:s,agentMode:d}=(0,ev.useChatContainerContext)(e=>({containerType:e.containerType,isChatList:to.includes(e.containerType),agentMode:e.agentMode??"legacy"})),u=tn(e9),{handelHiddenModel:c}=(0,tl.default)(),{templateInfo:p}=(0,m.useFormTemplate)(i),f=!!p,{modelName:h}=(0,tr.useResolvedMediaFormValues)(i),{modelList:x,disableSelect:y,initModelName:I,isAgent:C}=(0,n.useChatStore)((0,g.useCallback)(t=>{let i,n,s,d,u,c,m,p,g,x,y,I;return i=to.includes(a),n=a===r.EChatContainerType.SHARE?t.sessionListMap.share?.[0]?.content:t.sessionListMap.chat?.[0]?.content,s=n?.agentType&&ts.includes(n?.agentType),d=t.chatInfoByGetChatDetail?.agent_type&&ts.includes(t.chatInfoByGetChatDetail?.agent_type),u=!!(s||d),c=t.modelListMap[e]||[],m=t.fileListMap.chat||[],p=t.formValueMap[e],g=t.isAiBackgroun
190dActive,x=m.some(l.isVideoFile),y=e===r.EChatInputType.AI_IMAGE&&h===o.EVideoModel.IMAGE_AGENT&&x,I=e===r.EChatInputType.AI_VIDEO&&!!(h&&Z.REFERENCE_VIDEO_MODEL_LIST.includes(h)),{modelList:c,disableSelect:!!(f||x&&!y&&!I||g&&e===r.EChatInputType.AI_IMAGE||i&&u),initModelName:function({modelList:e,formValue:t,type:i,isChatList:a}){if(!a){let t=tu(e,(0,ep.getLocalModelMap)()[i]);if(t)return t}let n=tu(e,t?.modelName);return n?n:e.find(e=>e.isDefault)?.modelName||e[0]?.modelName}({modelList:c,formValue:p,type:e,isChatList:i}),isAgent:u}},[e,f,a,h])),E=(0,g.useMemo)(()=>tu(x,u),[x,u]),v=(0,g.useMemo)(()=>tu(x,t),[t,x]),_=v??E??I,b=h??_,T=(0,g.useMemo)(()=>{if(!b||!x?.length)return;let e=c({modelName:b,returnOriginalModel:!0});return x.find(t=>t.modelName===e)},[x,b,c]),N=(0,g.useMemo)(()=>x?.length?x.map(e=>({modelName:e.modelName,label:e.modelLabel,value:e.modelName,icon:e.icon,generationModes:e.generationModes})):[],[x]),M=(0,g.useRef)(null),S=(0,g.useRef)(null);return(0,tt.useIsomorphicLayoutEffect)(()=>{if(_){let t=i.getFieldValue(e9),a=M.current,n=S.current,r=x.some(e=>e.modelName===t),l=null!==n&&n!==e;if(!t||!r||l||null!==a&&a!==_)try{i.setFieldValue(e9,_)}catch(e){console.warn("Failed to set initial model name:",e)}M.current=_,S.current=e}},[I,v,E,_,h,b,i,e,x]),{modelList:N,modelItem:T,modelName:b,disableSelect:y||s&&(C||s&&"agui"===d)}}],977254),e.s(["useModelTooltip",0,function(e){let[t,i]=(0,g.useState)(!1),a=(0,g.useRef)(null),n=(0,g.useRef)(!1),r=(0,ev.useChatContainerContext)(e=>e.chatId),l=(0,z.useMemoizedFn)((e,t)=>{n.current||(e&&te.includes(t)?i(!0):i(!1))}),o=(0,z.useMemoizedFn)(e=>{te.includes(e)&&(n.current=!0,i(!0),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i(!1),n.current=!1},3e3))});return(0,g.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),{showTooltip:t,overlay:(0,g.useMemo)(()=>{if(e)return eC.AGENT_MODELS.includes(e)?r?e7.agentWithChat:e7.agentWithoutChat:e7[e]||void 0},[e,r]),handleTooltipChange:l,handleModelChange:o,setShowTooltip:i}}],791214)},49897,e=>{"use strict";function t(e){let[t,i]=String(e).split(":").map(Number);return{width:t,height:i}}e.s(["sortAspectRatioOptions",0,function(e){return[...e].sort((e,i)=>{let a=t(e.value),n=t(i.value);return a.width!==n.width?a.width-n.width:a.height-n.height})}])},869791,e=>{e.v({ImageCard:"index-module-scss-module__Fz5IsG__ImageCard","tilted-card-caption":"index-module-scss-module__Fz5IsG__tilted-card-caption","tilted-card-figure":"index-module-scss-module__Fz5IsG__tilted-card-figure","tilted-card-img":"index-module-scss-module__Fz5IsG__tilted-card-img","tilted-card-inner":"index-module-scss-module__Fz5IsG__tilted-card-inner","tilted-card-mobile-alert":"index-module-scss-module__Fz5IsG__tilted-card-mobile-alert","tilted-card-overlay":"index-module-scss-module__Fz5IsG__tilted-card-overlay"})},682133,551754,312533,e=>{"use strict";var t,i=e.i(166101),a=e.i(708763),n=e.i(321089),r=e.i(200562),l=e.i(932900),o=e.i(105757),s=e.i(679093),d=e.i(826253),u=e.i(858980),c=e.i(110258),m=e.i(206533),p=e.i(471452),f=e.i(413886),h=e.i(98902),g=e.i(269137),x=e.i(16865),y=e.i(659638);e.i(17335);var I=e.i(508861),C=e.i(588775),E=e.i(224412),v=e.i(247227),_=e.i(708478),b=e.i(35711),T=e.i(21216),N=e.i(672112),M=e.i(993772),S=e.i(82262),k=e.i(729888),A=e.i(619564),w=e.i(571740),j=e.i(543010),F=e.i(401122),R=e.i(248722),L=e.i(301283),V=e.i(628857),D=e.i(422569),O=e.i(384285),P=e.i(596804);e.i(60769);var z=e.i(188631),U=e.i(713772),G=e.i(844572),H=e.i(628269),B=e.i(2292),W=e.i(157091),$=e.i(296426),q=e.i(433645),K=e.i(955861),X=e.i(570689),Y=e.i(405621);e.i(473430);var Q=e.i(147841),J=e.i(339819),Z=e.i(102001),ee=e.i(143967),et=e.i(335390),ei=e.i(683883),ea=e.i(579969),en=e.i(380707),er=e.i(303566),el=e.i(130631),eo=e.i(457590),es=e.i(979050),ed=e.i(113482),eu=e.i(977254),ec=e.i(791214),em=e.i(133669),ep=e.i(484278);function ef(e){let{type:t,entryInitialModelName:n,className:r}=e,l=a.Form.useFormInstance(),{isChatListLoading:o}=(0,eo.useChatFormNormalContext)(),s=(0,I.useChatContainerContext)(e=>e.containerType),{isHixAiComHost:d}=(0,ea.useHixBypassInfo)(),{clearFileList:u}=(0,el.useUploadFileList)(),m=(0,k.useChatStore)(e=>e.modelManagementGroupedMap[t]),{modelList:p,modelName:f,disableSelect:h}=(0,eu.useModelSelector)({type:t,entryInitialModelName:n,form:l}),g=(0,y.useMemo)(()=>0!==p.length&&m?function(e){let{groupedModels:t,modelList:i}=e,a=new Map(i.map(e=>[e.value,e])),n=[];
190return(0,em.sortModelManagementGroups)(t).forEach(e=>{var t;let i=(0,em.sortModelManagementRecordsByPriorityDesc)(e.records);if(!i.length)return;let r=i.flatMap(e=>(0,ep.toMarks)(e.rightIcon)??[]);n.push({label:e.manufacturer,value:(t=e.manufacturer,`manufacturer:${t}`),iconUrl:i[0]?.modelManufacturerIcon,marks:(0,ep.pickTopMarks)(r),isLeaf:!1,children:i.map(e=>{var t;let i;return i=a.get(e.modelName)??{modelName:e.modelName,label:e.modelLabel,value:e.modelName,icon:e.iconClassName},{label:e.modelLabel,value:(t=e.modelName,`model:${t}`),icon:e.iconClassName,marks:(0,ep.toMarks)(e.rightIcon),isLeaf:!0,disabled:i.disabled,data:{...i,modelName:e.modelName}}})})}),n}({groupedModels:m,modelList:p}):[],[m,p]),{showTooltip:x,overlay:E,handleTooltipChange:v,handleModelChange:_,setShowTooltip:b}=(0,ec.useModelTooltip)(f),T=(0,y.useRef)(!1),N=(0,c.useMemoizedFn)((e,t)=>{if(!e||h)return;let i=t?.modelName??e;if(t?.disabled)return;let a=f!==i,n=er.AGENT_MODELS.includes(f);a&&u(),a&&n&&l.setFieldValue("similarInfo",void 0),l.setFieldValue(ed.FORM_FIELD_NAME,i),_(i)});return 0===p.length||!m||s===C.EChatContainerType.CHAT_LIST&&o?(0,i.jsx)(ei.Skeleton.Button,{style:{width:"9rem",height:"32px",borderRadius:"10px"},active:!0}):(0,i.jsx)(a.Form.Item,{name:ed.FORM_FIELD_NAME,noStyle:!0,children:(0,i.jsx)(en.default,{tooltipProps:{open:x&&!!E,onOpenChange:e=>{T.current||v(e,f)},overlay:E},children:(0,i.jsx)(es.default,{value:f,onChange:N,options:g,disabled:h,className:r,showPoweredBy:d,onDropdownVisibleChange:e=>{T.current=e,e&&b(!1)}})})})}var eh=e.i(584526),eg=e.i(429387),ex=e.i(811169),ey=e.i(1916),eI=e.i(102642),eC=e.i(259911),eE=e.i(457968),ev=e.i(867567),e_=e.i(758304),eb=e.i(754822),eT=e.i(90041),eN=e.i(11846),eM=e.i(169710),eS=e.i(704731),ek=e.i(616405);let eA="70dvw",ew="45dvh",ej=ek.tw`
191  flex h-[min(max-content,45dvh)] max-h-[45dvh] flex-col overflow-hidden
192`,eF=ek.tw`
193  max-h-[min(360px,calc(45dvh-4.75rem))]
194`,eR=ek.tw`
195  max-h-[min(246px,45dvh)]
196`,eL="hoverOrScroll";function eV(e){return`model-group-multi-selector-flyout-depth-${e}`}let eD=[14,0],eO={adjustX:!1,adjustY:!1,shiftY:!0},eP="open",ez="closed",eU="model-group-multi-selector-selected-models",eG="model-group-multi-selector-group",eH=ek.tw`
197  flex h-9 w-full items-center gap-1.5 rounded-xl px-2 text-left
198  text-sm font-normal text-f-text-secondary
199`;var eB=e.i(793995),eW=e.i(410408),e$=e.i(831628);function eq(e){throw Error("Unhandled SelectorNode.kind")}function eK(e){let t=[];for(let i of e)switch(i.kind){case"section":case"group":t.push(...eK(i.children));break;case"leaf":t.push(i);break;default:eq(i)}return t}function eX(e,t){let i=t.trim().toLowerCase(),a=new Set,n=[];for(let t of e)(!i||t.label.toLowerCase().includes(i))&&(a.has(t.modelName)||(a.add(t.modelName),n.push(t)));return n}function eY(e,t){for(let i of e)switch(i.kind){case"section":case"group":{let e=eY(i.children,t);if(e)return e;break}case"leaf":if(i.modelName===t)return i;break;default:eq(i)}}function eQ(e,t){for(let i of e){if(i.id===t)return i;switch(i.kind){case"section":case"group":{let e=eQ(i.children,t);if(e)return e;break}case"leaf":break;default:eq(i)}}}function eJ(e){let t=[];for(let i of e)switch(i.kind){case"section":t.push(...eJ(i.children));break;case"group":case"leaf":t.push(i);break;default:eq(i)}return t}var eZ=e.i(919699);let e0=(0,y.createContext)(null);function e1(){let e=(0,y.useContext)(e0);if(!e)throw Error("ModelGroupMultiSelector.* must be used within <ModelGroupMultiSelector.Root>");return e}function e2({dropdownWidth:e,isCompact:t,value:a,onChange:n,onOpenChange:r,nodes:l,max:o=4,children:u}){let m=(0,y.useId)(),p=(0,y.useRef)(null),f=(0,y.useRef)(null),h=(0,y.useRef)(null),g=(0,y.useRef)(new Map),x=(0,y.useRef)(0),[I,C]=(0,y.useState)(""),[E,v]=(0,y.useState)(!1),[_,b]=(0,y.useState)(null),[T,N]=(0,y.useState)(null),{getDropdownAlign:M,containerRef:S,containerWidth:k}=(0,e$.useDropdownAlign)({dropdownWidth:e,triggerRef:p,matchContainerWidth:t}),A=(0,y.useMemo)(()=>t?function e(t){let i=[];for(let a of t)switch(a.kind){case"section":i.push({...a,children:e(a.children)});break;case"group":i.push({kind:"section",id:a.id,title:a.label,children:e(a.children)});break;case"leaf":i.push(a);break;default:eq(a)}return i}(l):l,[t,l]),w=(0,c.useMemoizedFn)(()=>{C(""),b(null)}),j=(0,c.useMemoizedFn)(e=>
199{if(e!==E&&r?.(e),e){E||(w(),N(S?M():{offset:[0,6]})),v(!0);return}v(!1)}),F=(0,c.useMemoizedFn)(e=>{let t=e[0];if(!t)return Promise.resolve(!1);let i=n(e,{first:t,firstData:eY(l,t)?.data});return null==i||"boolean"==typeof i?Promise.resolve(!1!==i):(x.current+=1,i.then(e=>{let t=!1!==e;return t&&j(!1),t}).finally(()=>{x.current-=1}))}),R=(0,c.useMemoizedFn)(e=>{let t=a.includes(e);return t&&a.length<=1?(ex.trackEmitter.emit("track-event",{name:"ai_chat_model_selector",method:"limit_click"}),eW.message.info(eB.i18n._({id:"uHJ14q"})),Promise.resolve(!1)):!t&&a.length>=o?(eW.message.info(eB.i18n._({id:"9LiVC_"})),Promise.resolve(!1)):F(t?a.filter(t=>t!==e):[...a,e]).then(e=>(e&&ex.trackEmitter.emit("track-event",{name:"ai_chat_model_selector",method:t?"remove_model":"select_model"}),e))}),L=(0,c.useMemoizedFn)(e=>{e.trim()?(e!==I&&ex.trackEmitter.emit("track-event",{name:"ai_chat_model_selector",method:"search_model"}),C(e)):w()}),V=(0,y.useMemo)(()=>!E||I.trim()||t?[]:function(e,t){if(!t)return[];let i=(e,a)=>{for(let n of e){if(n.id===t)return"group"===n.kind?[...a,n.id]:a;switch(n.kind){case"section":{let e=i(n.children,a);if(void 0!==e)return e;break}case"group":{let e=i(n.children,[...a,n.id]);if(void 0!==e)return e;break}case"leaf":break;default:eq(n)}}};return i(e,[])??[]}(l,_),[_,t,l,E,I]),D=V.at(-1)??null,{handlePointerInteraction:O,updateActiveId:P}=function({open:e,query:t,nodes:i,activeId:a,openGroupPath:n,setOpen:r,setQuery:l,setActiveId:o,toggle:u}){let m=(0,y.useRef)(!1),p=()=>!1,f=(0,c.useMemoizedFn)((e,t)=>{e!==a&&(m.current="keyboard-boundary"===t||"keyboard-next"===t||"seed"===t,o(e))}),h=(0,c.useMemoizedFn)(()=>{m.current=!1}),g=(0,c.useMemoizedFn)(e=>{let t=eJ(e.children),i=(0,eZ.findBoundaryInteractiveItemIndex)(t,1,p),a=t[i];a&&f(a.id,"keyboard-boundary")}),x=(0,c.useMemoizedFn)(o=>{if(!e||o.isComposing)return;let{key:s}=o,d=o.target;if(d instanceof Element&&d.closest(`[data-slot="${eU}"]`)&&"Escape"!==s)return;let c=function(e,t,i){for(let a=t.length-1;a>=0;a-=1){let n=t[a];if(!n)continue;let r=eQ(e,n);if(r?.kind!=="group")continue;let l=eJ(r.children);if(l.some(e=>e.id===i))return{groupId:n,rows:l}}return null}(i,n,a),m=n.at(-1)??null,h=n.length>1?n[n.length-2]??null:null;if("Escape"===s)return(o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation(),c)?void f(c.groupId,"keyboard-next"):h&&a===m?void f(h,"keyboard-next"):t.trim()?void l(""):void r(!1);let x=t.trim().length>0,y=eJ(i),I=eX(eK(i),t),C=x?I:c?.rows??y;if("ArrowDown"===s||"ArrowUp"===s){o.preventDefault();let e="ArrowDown"===s?1:-1,t=(0,eZ.findInteractiveItemIndex)(C,e=>e.id===a,p),i=t<0?(0,eZ.findBoundaryInteractiveItemIndex)(C,e,p):(0,eZ.findNextInteractiveItemIndex)(C,t,e,p),n=C[i];n&&f(n.id,t<0?"keyboard-boundary":"keyboard-next");return}if(!x&&"ArrowRight"===s){let e=C.find(e=>e.id===a);e?.kind==="group"&&(o.preventDefault(),g(e));return}if(!x&&"ArrowLeft"===s){if(c){o.preventDefault(),f(c.groupId,"keyboard-next");return}h&&a===m&&(o.preventDefault(),f(h,"keyboard-next"));return}if("Enter"===s||" "===s){let e=C.find(e=>e.id===a);if(" "===s&&o.target instanceof HTMLInputElement||(o.preventDefault(),!e))return;switch(e.kind){case"leaf":u(e.modelName);break;case"group":x||g(e);break;default:throw Error(`Unhandled interactive node: ${e}`)}}});return(0,s.useEventListener)("keydown",x,{capture:!0,enable:e}),(0,d.useIsomorphicLayoutEffect)(()=>{if(!e||!t.trim())return;let a=eX(eK(i),t)[0];f(a?.id??null,"seed")},[e,t]),(0,d.useIsomorphicLayoutEffect)(()=>{if(!e||!a||!m.current)return;m.current=!1;let t=document.querySelector(`.${eS.HIX_DROPDOWN_OVERLAY_CLASS} [data-selector-row-id="${CSS.escape(a)}"]`);t?.scrollIntoView({block:"nearest"})},[a,e,n,t]),{handlePointerInteraction:h,updateActiveId:f}}({open:E,query:I,nodes:A,activeId:_,openGroupPath:V,setOpen:j,setQuery:L,setActiveId:b,toggle:R});(0,s.useEventListener)("pointerdown",e=>{if(!E||x.current>0)return;let t=e.target;!(t instanceof Node)||p.current?.contains(t)||f.current?.contains(t)||t instanceof Element&&t.closest(`.${eS.HIX_DROPDOWN_OVERLAY_CLASS}`)||j(!1)},{capture:!0,enable:E});let z=(0,y.useMemo)(()=>({value:a,query:I,open:E,activeId:_,openGroupPath:V,openGroupId:D,max:o,nodes:l,browseNodes:A,isCompact:t,dropdownWidth:e,lockedAlign:T,containerWidth:k}),[_,A,k,e,t,T,o,l,E,D,V,I,a]),U=(0,y.useMemo)(()=>({toggle:R,setQuery:L,setOpen:j,updateActiveId:P,handlePointerInteraction:O}),[O,j,L,R,P]),G=(0,y.useMemo)(()=>({contentId:m,triggerRef:p,popupRef:f,searchInputRef:h,groupFlyoutContentRef:g,getDropdownAlign:M}),[m,M]),H=(0,y.useMemo)(()=>({state:z,actions:U,meta:G}),[U,G,z]);return(0,i.jsx)(e0.Provider,{value:H,children:u})}function e8(e){let t=e.closest("[data-chat-form-footer-popup-host]");if(!t)throw Error("Compact ModelGroupMultiSelector requires a ChatFormFooter popup host.");return t}let e5=(0,y.forwardRef)(({children:e,className:t,onClick:a,onMouseDown:n,style:r,...l},o)=>{let{actions:s,meta:d,state:u}=e1(),c=u.containerWidth>0,m=c?u.isCompact?u.containerWidth:Math.min(u.dropdownWidth,u.containerWidth):u.dropdownWidth;return(0,i.jsx)(eS.default,{open:u.open,trigger:[],destroyPopupOnHide:!0,placement:"bottomLeft",align:u.lockedAlign??d.getDropdownAlign(),getPopupContainer:u.isCompact?e8:void 0,rootClassName:ej,overlayStyle:{width:c?m:`min(${m}px, ${eA}
199)`,height:`min(max-content, ${ew})`,maxWidth:c?m:eA,maxHeight:ew,minWidth:0},onOpenChange:e=>{e||s.setOpen(!1)},dropdownRender:()=>(0,i.jsx)("div",{...l,ref:(0,eM.mergeRefs)([d.popupRef,o]),id:d.contentId,"data-slot":"model-group-multi-selector-content","data-state":u.open?eP:ez,className:ek.tw`flex h-full max-h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden bg-f-bg-base gap-1 p-2.5 ${t}`,style:r,onMouseDown:e=>{e.stopPropagation(),n?.(e)},onClick:e=>{e.stopPropagation(),a?.(e)},children:e}),children:(0,i.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0"})})}),e4=(0,y.forwardRef)(({className:e,...t},a)=>(0,i.jsx)("hr",{...t,ref:a,"data-slot":"model-group-multi-selector-divider",className:ek.tw`mx-1 h-px shrink-0 border-0 bg-f-border ${e}`}));e.i(3246);var e6=e.i(870116);let e3=(0,y.forwardRef)(({children:e,className:t,...a},n)=>(0,i.jsxs)("div",{...a,ref:n,"data-slot":"model-group-multi-selector-empty",className:ek.tw`flex min-h-0 flex-1 flex-col items-center py-9 justify-center gap-2 text-sm text-f-text-quaternary ${t}`,children:[(0,i.jsx)(e6.IconItem,{className:"i-cus--hix2-search size-6"}),e??(0,i.jsx)(eh.Trans,{id:"AxPAXW"})]}));var e7=e.i(87135);function e9(e,t){return i=>{e?.(i),null!==i&&"object"==typeof i&&"defaultPrevented"in i&&i.defaultPrevented||t?.(i)}}var te=e.i(435654),tt=e.i(34183);function ti(e,t){return{selected:t.value.includes(e.modelName),active:t.activeId===e.id,disabled:!1,query:t.query}}var ta=e.i(982952);function tn({icon:e,alt:t}){return(0,i.jsx)("span",{className:"flex size-[22px] shrink-0 items-center justify-center",children:(0,i.jsx)(tt.default,{icon:e,alt:t,size:"lg",className:"!size-[22px]"})})}function tr({selected:e}){return(0,i.jsx)(e6.IconItem,{className:ta.cls`
200        size-5 shrink-0
201        ${e?"i-cus--hix2-check-fill text-f-text":"i-cus--hix2-unselected-box text-f-text-tertiary"}
202      `})}let tl=(0,y.forwardRef)(function({children:e,className:t,disabled:a,inlineMark:n,node:r,onClick:l,onMouseDown:o,onMouseMove:s,...d},u){var c;let{actions:m,state:p}=e1(),f=ti(r,p),h=f.query.trim(),g=f.disabled||a,x=h?(0,te.highlightMatchedText)(r.label,h):r.label;return(0,i.jsx)("button",{...d,ref:u,type:"button",role:"option","aria-selected":f.selected,"aria-disabled":g||void 0,"data-slot":"model-group-multi-selector-item","data-selector-row-id":r.id,disabled:g,className:ta.cls`
203        ${eH}
204        ${f.active?"bg-f-bg-hover !text-f-text":"!text-f-text-secondary"}
205        ${g?"cursor-not-allowed opacity-50":"cursor-pointer"}
206        ${t}
207      `,onMouseDown:e9(o,e=>{e.preventDefault()}),onMouseMove:e9(s,()=>{g||(m.handlePointerInteraction(),m.updateActiveId(r.id,"mouse-move"))}),onClick:e9(l,()=>{m.toggle(r.modelName)}),children:(c=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(tn,{icon:r.icon,alt:r.label}),n?(0,i.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[(0,i.jsx)("span",{className:"min-w-0 truncate",children:x}),(0,i.jsx)(e7.default,{marks:r.marks,className:"shrink-0"})]}):(0,i.jsx)("span",{className:"min-w-0 flex-1 truncate",children:x}),(0,i.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[!n&&(0,i.jsx)(e7.default,{marks:r.marks,className:"shrink-0"}),(0,i.jsx)(tr,{selected:f.selected})]})]}),"function"==typeof e?e(f):e??c)})}),to=(0,y.forwardRef)(function({children:e,className:t,inlineMark:a,node:n,onClick:r,onMouseDown:l,onMouseMove:o,...s},u){let c,m,p,{actions:f,meta:h,state:g}=e1(),x=(c=new Set(g.value),m=new Set,(p=e=>{switch(e.kind){case"section":case"group":e.children.forEach(p);break;case"leaf":c.has(e.modelName)&&m.add(e.modelName);break;default:eq(e)}})(n),m.size),y=g.activeId===n.id,I=g.openGroupPath.includes(n.id);return null!=e?h.groupFlyoutContentRef.current.set(n.id,e):h.groupFlyoutContentRef.current.delete(n.id),(0,d.useIsomorphicLayoutEffect)(()=>()=>{h.groupFlyoutContentRef.current.delete(n.id)},[h.groupFlyoutContentRef,n.id]),(0,i.jsxs)("button",{...s,ref:u,type:"button","aria-haspopup":"true","aria-expanded":I,"data-slot":eG,"data-state":I?eP:ez,"data-selector-row-id":n.id,className:ta.cls`
208        reset-popover-button-style
209        ${eH}
210        ${y?"bg-f-bg-hover !text-f-text":"!text-f-text-secondary"}
211        ${t}
212      `,onMouseDown:e9(l,e=>{e.preventDefault()}),onMouseMove:e9(o,()=>{f.handlePointerInteraction(),f.updateActiveId(n.id,"mouse-move")}),onClick:e9(r,()=>{f.updateActiveId(n.id,"mouse-move")}),children:[(0,i.jsx)(tn,{icon:n.icon,alt:n.label}),a?(0,i.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,i.jsx)("span",{className:"min-w-0 truncate",children:n.label}),(0,i.jsx)(e7.default,{marks:n.marks,className:"shrink-0"})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"min-w-0 flex-1 truncate",children:n.label}),(0,i.jsx)(e7.default,{marks:n.marks,className:"shrink-0"})]}),x>0&&(0,i.jsxs)("span",{className:"shrink-0 text-xs leading-4 text-f-text-tertiary",children:[x," ",(0,i.jsx)(eh.Trans,{id:"-6YAwo"})]}),(0,i.jsx)(e6.IconItem,{className:"i-cus--hix2-right size-5 shrink-0 text-f-text-tertiary"})]})}),ts=(0,y.forwardRef)(({children:e,className:t,...a},n)=>(0,i.jsx)("div",{...a,ref:n,"data-slot":"model-group-multi-selector-header",className:ek.tw`flex shrink-0 items-center gap-2 px-1 py-1 ${t}`,children:e}));var td=e.i(862196),tu=e.i(166060);function tc(e,t){var i;return{...i={...t,viewport:ek.tw`min-h-0 ${e} ${t?.viewport}`},scrollbar:ek.tw`${tu.default.scrollbar} ${i?.scrollbar}`}}let tm=(0,y.forwardRef)(function({children:e,className:t,empty:a,...n},r){let{actions:l,state:o}=e1(),s=(0,y.useMemo)(()=>eX(eK(o.nodes),o.query),[o.nodes,o.query]);return(0,i.jsxs)("div",{...n,ref:r,"data-slot":"model-group-multi-selector-search-results",className:ek.tw`mt-1 flex min-h-0 flex-1 flex-col ${t}`,children:[(0,i.jsx)("div",{className:"shrink-0 px-1 py-1 text-xs leading-4 text-f-text-tertiary",children:(0,i.jsx)(eh.Trans,{id:"5WYZKZ"})}
212),0===s.length?a??(0,i.jsx)(e3,{}):(0,i.jsx)(td.default,{className:ek.tw`min-h-0 flex-1 ${eF}`,classNames:tc(eF),scrollbarVisibility:eL,viewportProps:{onWheel:l.handlePointerInteraction},children:s.map(t=>{let a=ti(t,o);return e?(0,i.jsx)(y.Fragment,{children:e(t,a)},t.modelName):(0,i.jsx)(tl,{inlineMark:!0,node:t},t.modelName)})})]})}),tp=(0,y.forwardRef)(function({children:e,className:t,node:a,...n},r){return(0,i.jsxs)("div",{...n,ref:r,"data-slot":"model-group-multi-selector-section",className:t,children:[(0,i.jsx)("div",{className:"sticky top-0 z-[1] bg-f-bg-base px-1 py-1 text-xs leading-4 text-f-text-tertiary",children:a.title}),e]})});function tf({inlineMark:e,node:t}){switch(t.kind){case"section":return(0,i.jsx)(tp,{node:t,children:t.children.map(t=>(0,i.jsx)(tf,{inlineMark:e,node:t},t.id))});case"group":return(0,i.jsx)(to,{inlineMark:e,node:t});case"leaf":return(0,i.jsx)(tl,{inlineMark:e,node:t});default:throw Error(`Unhandled SelectorNode.kind: ${t}`)}}let th=(0,y.forwardRef)(function({children:e,className:t,classNames:a,viewportProps:n,...r},l){let{actions:o,state:s}=e1(),{onWheel:d,...u}=n??{};return(0,i.jsx)(td.default,{...r,ref:l,"data-slot":"model-group-multi-selector-tree",className:ek.tw`mt-1 flex min-h-0 flex-1 flex-col ${eF} ${t}`,classNames:tc(eF,a),scrollbarVisibility:eL,viewportProps:{...u,onWheel:e9(d,o.handlePointerInteraction)},children:s.browseNodes.map(t=>(0,i.jsx)(y.Fragment,{children:e?e(t):(0,i.jsx)(tf,{inlineMark:!0,node:t})},t.id))})});var tg=e.i(696100),tx=e.i(533676);let ty="model-group-multi-selector-flyout-host",tI=0;function tC(){if("u"<typeof document)throw TypeError("ensureFlyoutPortalHost requires document");let e=document.getElementById(ty);if(e)return e;let t=document.createElement("div");return t.id=ty,t.style.position="fixed",t.style.inset="0",t.style.overflow="hidden",t.style.pointerEvents="none",t.style.zIndex=String(1060),document.body.appendChild(t),t}function tE(e,t){if(!e||!t)return null;let i=t.querySelector(`[data-slot="${eG}"][data-selector-row-id="${CSS.escape(e)}"]`);return i?.getBoundingClientRect()??null}var tv=e.i(636737);let t_={token:{motion:!1}};function tb({depth:e,groupId:t,open:a,onClosed:r}){let{actions:l,meta:o,state:s}=e1(),u=(0,y.useRef)(null),m=(0,y.useRef)(void 0),p=(0,y.useRef)(null),f=(0,y.useRef)(!1),h=eQ(s.nodes,t),g=h?.kind==="group"?h:void 0,x=(0,c.useMemoizedFn)(()=>{var t;return t=o.popupRef.current,0===e?t:document.querySelector(`.${eV(e-1)}`)}),I=(0,c.useMemoizedFn)(e=>{if(o.popupRef.current?.contains(e))return!0;let t=document.getElementById(ty);return t?.contains(e)??!1}),C=function(e,t,i){let[a,n]=(0,y.useState)(null),r=(0,c.useMemoizedFn)(()=>{if(!e)return void n(e=>e?null:e);let i=tE(e,t());n(t=>{var a;return i?t?.id===e&&((a=t.rect)===i||a&&i&&a.top===i.top&&a.left===i.left&&a.width===i.width&&a.height===i.height)?t:{id:e,rect:i}:t?.id===e?null:t})});return((0,d.useIsomorphicLayoutEffect)(()=>{if(r(),!e)return;let t=e=>{let{target:t}=e;t instanceof Node&&i(t)&&r()};return document.addEventListener("scroll",t,!0),window.addEventListener("resize",r),()=>{document.removeEventListener("scroll",t,!0),window.removeEventListener("resize",r)}},[i,e,r]),(0,d.useIsomorphicLayoutEffect)(()=>{if(!e)return;let t=document.getElementById(ty);if(!t)return;let i=new MutationObserver(()=>{r()});return i.observe(t,{childList:!0,subtree:!0}),()=>{i.disconnect()}},[e,r]),e)?a?.id===e?a.rect:tE(e,t()):null}(a?g?.id??null:null,x,I);g&&(m.current=g),a&&C&&(p.current=C);let E=g??m.current,v=(a?C:null)??p.current;a&&E&&v&&(f.current=!0),(0,d.useIsomorphicLayoutEffect)(()=>(tI+=1,tC(),()=>{!((tI=Math.max(0,tI-1))>0)&&"u">typeof document&&document.getElementById(ty)?.remove()}),[]),(0,d.useIsomorphicLayoutEffect)(()=>{a&&E&&v&&u.current?.forceAlign()},[v,a,E]),(0,d.useIsomorphicLayoutEffect)(()=>{a||f.current||r(e)},[e,r,a]);let _=(0,c.useMemoizedFn)(t=>{t||a||r(e)});if("u"<typeof document||!f.current||!E||!v)return null;let b=o.groupFlyoutContentRef.current.get(E.id),T={position:"fixed",top:v.top,left:v.left,width:v.width,height:v.height,pointerEvents:"none"};return(0,n.createPortal)((0,i.jsx)(tg.ConfigProvider,{theme:t_,children:(0,i.jsx)(tx.default,{ref:u,open:a,trigger:[],placement:"rightTop",destroyTooltipOnHide:!0,autoAdjustOverflow:!1,align:{offset:eD,overflow:eO},getPopupContainer:tC,zIndex:1060+e,rootClassName:ta.cls`${eS.HIX_DROPDOWN_OVERLAY_CLASS} pointer-events-auto ${eV(e)} ${tv.default.flyout}`,content:(0,i.jsx)(td.default,{className:ek.tw`min-h-0 flex-1 ${eR}`,classNames:tc(eR),scrollbarVisibility:eL,viewportProps:{onWheel:l.handlePointerInteraction},children:b??E.children.map(e=>(0,i.jsx)(tf,{node:e},e.id))},E.id),afterOpenChange:_,children:(0,i.jsx)("span",{"aria-hidden":!0,
212className:"pointer-events-none",style:T})})}),tC())}let tT=(0,y.forwardRef)(({children:e,className:t,...a},n)=>{let{meta:r,state:l}=e1(),{layers:o,markDepthClosed:s}=function(e){let t=e.join("\0"),i=(0,y.useRef)([]),[a,n]=(0,y.useState)({key:"",layers:[]});e.length>0&&e.length>=i.current.length&&(i.current=[...e]);let{layers:r}=a;if(a.key!==t){var l;l=i.current,n({key:t,layers:r=0===e.length?l.map(e=>({groupId:e,open:!1})):e.length>=l.length?e.map(e=>({groupId:e,open:!0})):l.map((t,i)=>({groupId:e[i]??t,open:i<e.length}))})}return{layers:r,markDepthClosed:(0,c.useMemoizedFn)(e=>{n(t=>{if(e<t.layers.length-1)return t;let a=t.layers.filter(e=>e.open);return i.current=a.map(e=>e.groupId),{key:t.key,layers:a}})})}}(l.openGroupPath);return(0,i.jsxs)("span",{...a,ref:(0,eM.mergeRefs)([r.triggerRef,n]),"data-slot":"model-group-multi-selector","data-state":l.open?eP:ez,className:ek.tw`relative inline-flex ${t}`,children:[e,o.map((e,t)=>(0,i.jsx)(tb,{depth:t,groupId:e.groupId,open:e.open,onClosed:s},t))]})}),tN=(0,y.forwardRef)(function({children:e,dropdownWidth:t=429,isCompact:a,max:n,nodes:r,onChange:l,onOpenChange:o,value:s,...d},u){return(0,i.jsx)(e2,{dropdownWidth:t,isCompact:a,max:n,nodes:r,value:s,onChange:l,onOpenChange:o,children:(0,i.jsx)(tT,{...d,ref:u,children:e})},`${a?"compact":"grouped"}-${t}`)}),tM=(0,y.forwardRef)(({className:e,onChange:t,placeholder:a,...n},r)=>{let{i18n:l,_:o}=(0,eh.useLingui)(),{actions:s,meta:d,state:u}=e1();return(0,y.useEffect)(()=>{d.searchInputRef.current?.focus({preventScroll:!0})},[d.searchInputRef]),(0,i.jsxs)("label",{"data-slot":"model-group-multi-selector-search",className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,i.jsx)(e6.IconItem,{className:"i-cus--hix2-search size-[18px] shrink-0 text-f-text-secondary"}),(0,i.jsx)("input",{...n,ref:(0,eM.mergeRefs)([d.searchInputRef,r]),value:u.query,placeholder:a??l._({id:"bbEe1Z",values:{0:u.max}}),className:ek.tw`min-w-0 flex-1 bg-transparent text-xs leading-4 text-f-text outline-none placeholder:text-f-text-quaternary ${e}`,onChange:e9(t,e=>{s.setQuery(e.target.value)})})]})}),tS=(0,y.forwardRef)(({children:e,className:t,...a},n)=>{let{state:r}=e1();return(0,i.jsx)("div",{...a,ref:n,"data-slot":"model-group-multi-selector-selection-count",className:ek.tw`shrink-0 text-xs leading-4 text-f-text ${t}`,children:e??`(${r.value.length}/${r.max})`})});var tk=e.i(483666);e.i(490297);var tA=e.i(872517),tA=tA,tw=e.i(832172),tj=e.i(563758);let tF=(0,y.forwardRef)(({className:e,...t},a)=>(0,i.jsx)("div",{...t,ref:a,"data-slot":"model-group-multi-selector-powered-by",className:ek.tw`
213        border-r border-f-border pr-1 text-xs font-semibold
214        bg-[linear-gradient(94.78deg,#18BAFF_0%,#3A7EFF_100%)]
215        bg-clip-text text-transparent
216        ${e}
217      `,children:(0,i.jsx)(eh.Trans,{id:"g2UNkE"})}));function tR({open:e}){return(0,i.jsx)(e6.IconItem,{className:ta.cls`size-[18px] shrink-0 i-cus--hix2-down transition-transform duration-300 ${e?"rotate-180":""}`})}let tL={duration:.18,ease:[.22,1,.36,1]};function tV({alt:e,animateChanges:t,frames:a,skipInitialMountAnimation:n}){return(0,i.jsx)(r.AnimatePresence,{initial:!1,children:a.length>0&&(0,i.jsx)(tA.default,{className:"pointer-events-none",contentClassName:"items-center",skipInitialMeasureAnimation:n,children:(0,i.jsx)(r.AnimatePresence,{initial:!1,mode:"popLayout",children:a.map((n,r)=>(0,i.jsx)(l.motion.span,{layout:!!t&&"position",initial:!!t&&{opacity:0,scale:.6},animate:{opacity:1,scale:1,marginRight:r<a.length-1?-6:0},exit:t?{opacity:0,scale:.6,marginRight:0}:void 0,transition:tL,className:ta.cls`
218                  flex size-5 shrink-0 items-center justify-center overflow-hidden
219                  rounded-md border border-f-border bg-f-bg-base leading-none
220                `,style:{zIndex:r},children:(0,i.jsx)(tt.default,{icon:n.icon,alt:0===r?e??"":"",size:"lg",className:"block rounded-[5px]"})},n.id))})},"model-icon-stack")})}let tD=(0,y.forwardRef)(({children:e,className:t,onClick:a,...n},r)=>{let{actions:l,meta:o,state:s}=e1();return(0,i.jsx)(tk.default,{variant:"default",padding:"lg",...n,ref:r,"data-slot":"model-group-multi-selector-trigger","data-state":s.open?eP:ez,"aria-expanded":s.open,"aria-haspopup":"dialog","aria-controls":o.contentId,className:ek.tw`min-w-max shrink-0 overflow-hidden whitespace-nowrap rounded-full ${t}`,onClick:e9(a,()=>l.setOpen(!s.open)),children:e})}),tO=(0,y.forwardRef)(function(e,t){let{children:a,...n}=e,{state:l}=e1(),o=l.value.length,s=(0,y.useRef)(o),d=0===s.current&&1===o,u=l.value[0],c=l.value.map(e=>eY(l.nodes,e)),m=function(e,t=3){let i=[];for(let a of e)if(a?.icon&&(i.push({id:a.modelName,icon:a.icon}),i.length>=t))break;return i}(c,l.max),p=c.map((e,t)=>e?.label??l.value[t]??u),f=p.length-1,h=f>0,g=p[0],x=(0,tj.useSkipInitialPresenceAnimation)(m.length>0),I=(0,tj.useSkipInitialPresenceAnimation)(h),C=function(e){let[t,i]=(0,y.useState)(!1);return e&&t&&i(!1),{open:t&&!e,onPointerEnter:()=>{e||i(!0)},onPointerLeave:()=>{i(!1)}}}(l.open);return(0,y.useEffect)(()=>{s.current=o},[o]),(0,i.jsx)(en.default,{title:p.join("、"),tooltipProps:{open:h&&C.open,trigger:[],destroyTooltipOnHide:!0},children:(0,i.jsxs)(tD,{...n,ref:t,onPointerEnter:e9(n.onPointerEnter,C.onPointerEnter),onPointerLeave:e9(n.onPointerLeave,C.onPointerLeave),children:[a,0===l.value.length?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(e6.IconItem,{className:"i-cus--hix2-add-image size-5 shrink-0"}),(0,i.jsx)("span",{className:"inline-flex items-center",children:(0,i.jsx)(eh.Trans,{id:"ecD24z"})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(tV,{frames:m,alt:g,animateChanges:h,skipInitialMountAnimation:x||d}),(0,i.jsxs)("span",{className:"inline-flex items-center",children:[g,(0,i.jsx)(r.AnimatePresence,{initial:!1,children:h&&(0,i.jsx)(tw.MotionCountBadge,{prefix:"+",skipInitialMountAnimation:I,value:f},"model-count-badge")})]})]}),(0,i.jsx)(tR,{open:l.open})]})})}),tP=Object.assign(tO,{Single:tO,Stack:tO,PoweredBy:tF}),tz=function(){let{i18n:e,_:t}=(0,eh.useLingui)(),{actions:a,meta:n,state:r}=e1(),l=(0,y.useRef)(new Map),o=(0,y.useRef)(null);return((0,d.useIsomorphicLayoutEffect)(()=>{let e=o.current;if(!e)return;if(r.query.trim()){o.current=null,n.searchInputRef.current?.focus({preventScroll:!0});return}if(r.value.includes(e.modelName))return;o.current=null;let t=r.value[e.index]??r.value[e.index-1],i=t?l.current.get(t):void 0;i?i.focus({preventScroll:!0}):n.searchInputRef.current?.focus({preventScroll:!0})},[n.searchInputRef,r.query,r.value]),r.query.trim()||0===r.value.length)?null:(0,i.jsxs)("div",{"data-slot":eU,className:"-mx-0.5 flex shrink-0 flex-col gap-2.5 py-1 mt-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2.5 px-1.5 text-xs leading-4",children:[(0,i.jsx)("span",{className:"text-f-text-tertiary",children:(0,i.jsx)(eh.Trans,{id:"p-8lX5"})}),(0,i.jsx)(tS,{})]}),(0,i.jsx)("div",{className:"mx-1 flex min-w-0 flex-wrap items-center gap-2 select-none",children:r.value.map((t,n)=>{let s=eY(r.nodes,t),d=s?.label??t;return(0,i.jsxs)("button",{ref:e=>{e?l.current.set(t,e):l.current.delete(t)},type:"button","aria-label":e._({id:"HND1q3",values:{label:d}}),className:"group/selected-model flex h-7 shrink-0 cursor-pointer items-center gap-1 whitespace-nowrap rounded-full bg-f-bg-container px-2 py-1 text-sm leading-5 text-f-text-secondary hover:bg-f-bg-hover",onDragStart:e=>{e.preventDefault()},onMouseDown:e=>{e.preventDefault()},onPointerDown:()=>{o.current=null},onClick:e=>{let i=0===e.detail&&document.activeElement===e.currentTarget?{modelName:t,index:n}:null;o.current=i;let r=a.toggle(t);i&&r.then(e=>{e||o.current!==i||(o.current=null)})},children:[(0,i.jsxs)("span",{className:"relative size-[18px] shrink-0",children:[(0,i.jsx)(tt.default,{icon:s?.icon,alt:"",size:"lg",className:"absolute inset-0 group-hover/selected-model:opacity-0 group-focus-visible/selected-model:opacity-0 md:opacity-0"}),(0,i.jsx)(e6.IconItem,{className:"i-cus--hix2-x absolute inset-0 m-auto size-4 text-f-text-tertiary opacity-0 group-hover/selected-model:opacity-100 group-focus-visible/selected-model:opacity-100 md:opacity-100"})]}),(0,i.jsx)("span",{children:d})]},t)})})]})},tU=function({children:e}){let{state:t}=e1(),a=(0,y.useMemo)(()=>eX(eK(t.nodes),t.query),[t.nodes,t.query]),n=t.query.trim()?"search":"tree";return e?(0,i.jsx)(i.Fragment,{children:e({mode:n,query:t.query,nodes:t.nodes,leaves:a})}):(0,i.jsx)("div",{className:ek.tw`flex min-h-0 flex-1 flex-col`,children:"search"===n?(0,i.jsx)(tm,{}):(0,i.jsx)(th,{})})};var tG=e.i(344967),tH=((t={})["gpt-5-mini"]="GPT-5 mini",t["claude-sonnet-4-5"]="Claude Sonnet 4.5",t["claude-haiku-4-5"]="Claude Haiku 4.5",t["claude-opus-4-1"]="Claude Opus 4.1",t["gemini-2-5-flash"]="Gemini 2.5 Flash",t["gpt-5"]="GPT-5",t["gpt-5-nano"]="GPT-5 nano",t["gemini-2-5-pro"]="Gemini 2.5 Pro",t["claude-sonnet-4"]="Claude Sonnet 4",t["gpt-4.1"]="GPT-4.1",t["openai-o3"]="OpenAI o3",t["claude-opus-4"]="Claude Opus 4",t["openai-o4-mini"]="OpenAI o4-mini",t["grok-3"]="Grok-3",t["openai-o1"]="OpenAI o1",t["openai-o1-mini"]="OpenAI o1-mini",t["grok-2"]="Grok-2",t["claude-3-7-sonnet"]="Claude 3.7 Sonnet",t["claude-3-5-h
220aiku"]="Claude 3.5 Haiku",t["openai-o3-mini"]="OpenAI o3-mini",t.chatgpt="ChatGPT",t["gpt-4o"]="GPT-4o",t["gpt-4o-mini"]="GPT-4o mini",t["gpt-4"]="GPT-4",t.claude="Claude",t["gpt-4.1-mini"]="GPT-4.1 mini",t.gemini="Gemini",t["deepseek-r1"]="DeepSeek-R1",t.deepseek="DeepSeek",t["deepseek-v3"]="DeepSeek-V3",t["gpt-5-4-pro"]="GPT-5.4 Pro",t["gpt-5-4"]="GPT-5.4",t["gpt-5-3-codex"]="GPT-5.3-Codex",t["gpt-5-2-pro"]="GPT-5.2 Pro",t["gpt-5-2"]="GPT-5.2",t["gpt-5-1"]="GPT-5.1",t["claude-opus-4-5"]="Claude Opus 4.5",t["claude-sonnet-4-6"]="Claude Sonnet 4.6",t["claude-opus-4-6"]="Claude Opus 4.6",t["gemini-3-pro"]="Gemini 3 Pro",t["gemini-3-1-pro"]="Gemini 3.1 Pro",t["gemini-3-flash"]="Gemini 3 Flash",t["deepseek-v3-2"]="DeepSeek-V3.2",t["deepseek-v4-pro"]="DeepSeek-V4-Pro",t["deepseek-v4-flash"]="DeepSeek-V4-Flash",t["deepseek-r2"]="DeepSeek-R2",t["claude-opus-4-7"]="Claude Opus 4.7",t["gpt-5-5"]="GPT-5.5",t["gemini-3-5-flash"]="Gemini 3.5 Flash",t["gpt-5-6-sol"]="GPT-5.6 Sol",t["gpt-5-6-terra"]="GPT-5.6 Terra",t["gpt-5-6-luna"]="GPT-5.6 Luna",t);function tB(e){return e.replace(/^\//,"")}let tW={[tH.chatgpt]:tH["gpt-5-2"],[tH.claude]:tH["claude-sonnet-4-6"],[tH.deepseek]:tH["deepseek-v3-2"],[tH.gemini]:tH["gemini-3-1-pro"]};var t$=e.i(321920),tq=e.i(447854),tK=e.i(896661),tX=e.i(131347);let tY="hix-chat-compare-models-tooltip-seen";function tQ(){(0,tX.tryCatchSync)(()=>{localStorage.setItem(tY,"1")})}var tJ=e.i(473406);let tZ=Number.parseInt(eg.screens.md.max,10),t0=Number.parseInt(eg.screens.lg.max,10);function t1(e){let{className:t,skeletonClassName:a}=e,{push:n}=(0,tJ.useRouter)(),{isCompact:r,dropdownWidth:l}=(0,eb.useChatCanvasContentWidth)(e=>({isCompact:null!=e&&e<=tZ,dropdownWidth:null!=e&&e<=t0?360:429})),{isHixAiComHost:o}=(0,ea.useHixBypassInfo)(),{chatBotModelGroups:s,modelInfo:d,storeModelList:u,storeFeaturedModels:m,selectedBotIds:p,set:f}=(0,k.useChatStore)(e=>({chatBotModelGroups:e.chatBotModelGroups,modelInfo:e.modelInfoMap[C.EChatInputType.AI_CHAT],storeModelList:e.modelListMap[C.EChatInputType.AI_CHAT],storeFeaturedModels:e.featuredModels,selectedBotIds:e.selectedBotIds,set:e.getSetFunction()})),h=(0,eN.useIsFrontContainer)(),g=(0,y.useMemo)(()=>h?u:u.filter(e=>!er.DEPRECATED_TEXT_MODELS.has(e.name)),[u,h]),x=(0,y.useMemo)(()=>h?m:m.filter(e=>!er.DEPRECATED_TEXT_MODELS.has(e.name)),[m,h]),E=(0,y.useMemo)(()=>h?s:s.map(e=>({...e,bots:e.bots.filter(e=>!er.DEPRECATED_TEXT_MODELS.has(e.name))})).filter(e=>e.bots.length),[s,h]),v=(0,y.useMemo)(()=>E.length?E.filter(e=>e.bots.length).map(e=>{let t=e.bots.flatMap(e=>(0,ep.toMarks)(e.rightIcon)??[]);return{label:e.modelManufacturers,value:e.modelManufacturers,iconUrl:e.modelManufacturerIcon,marks:(0,ep.pickTopMarks)(t),isLeaf:!1,children:e.bots.map(e=>({label:e.name,value:String(e.id),icon:e.icon_url||e.icon_class_name||"",marks:(0,ep.toMarks)(e.rightIcon),isLeaf:!0,data:{...e,modelName:e.name}}))}}):function(e){let{modelList:t,getModelData:i}=e,a=new Map;return t.forEach((e,t)=>{let i=e.modelManufacturers||"",n=a.get(i);n?n.models.push(e):a.set(i,{modelManufacturerIcon:e.modelManufacturerIcon||void 0,models:[e],sort:t})}),Array.from(a.entries()).sort((e,t)=>e[1].sort-t[1].sort).map(([e,t])=>{let a=t.models.flatMap(e=>(0,ep.toMarks)(e.rightIcon)??[]);return{label:e,value:e,iconUrl:t.modelManufacturerIcon,marks:(0,ep.pickTopMarks)(a),isLeaf:!1,children:t.models.map(e=>({label:e.name,value:String(e.id),icon:e.icon_url||e.icon_class_name||"",marks:(0,ep.toMarks)(e.rightIcon),isLeaf:!0,data:i(e)}))}})}({modelList:g,getModelData:e=>({...e,modelName:e.name})}),[g,E]),{containerType:_,entryInitialChatModelNames:b}=(0,I.useChatContainerContext)(e=>({containerType:e.containerType,entryInitialChatModelNames:e.entryInitialChatModelNames})),T=(0,eC.useLatestPathname)(),N=function(e){let t=(0,y.useRef)(null),i=(0,y.useRef)(!1),[a]=(0,tq.useInViewport)(e?t:null),[n,{setTrue:r,setFalse:l}]=(0,t$.useBoolean)(!1),o=(0,tK.useTimeout)(()=>
220{if(!e||!a||i.current)return;let{data:t}=(0,tX.tryCatchSync)(()=>localStorage.getItem(tY));"1"!==t&&(tQ(),r())},e&&a?200:void 0),s=(0,c.useMemoizedFn)(()=>{o(),e&&!i.current&&(i.current=!0,tQ()),l()});return(0,y.useEffect)(()=>{e&&a||l()},[e,l,a]),{triggerRef:t,open:e&&!!a&&n,dismiss:s}}(!(0,C.isChatOrShareContainer)(_)&&g.length>0),{createChat:M}=(0,ev.useCreateNewHIXChat)(),{i18n:S,_:A}=(0,eh.useLingui)(),[w,j]=eI.default.useModal(),F=(0,eE.useLatestQuery)("modelName"),R=b?.trim()||null,L=R||F,V=(0,y.useMemo)(()=>(function(e,t){let i=[],a=new Set;for(let n of(0,e_.splitCommaTokens)(e)){let e=function(e,t){let i=tH[e]??e,a=tB(e);return t.find(t=>t.name===i||t.name===e||!!t.url&&(tB(t.url)===a||t.url===e))}(n,t);if(!e)continue;let r="number"==typeof e.id?String(e.id):e.url||e.name;if(!(!r||a.has(r))&&(a.add(r),i.push(e),i.length>=4))break}return i})(L,g),[L,g]),D=V[0],{handleUpdateBotUrl:O}=(0,eT.useUpdateBotUrl)(),P=(0,y.useRef)(!1);!function({handleUpdateBotUrl:e,hasUserChangedRef:t,modelInfoUrl:i,persistSelection:a=!0,queryModels:n}){let{selectedBotIds:r,set:l}=(0,k.useChatStore)(e=>({selectedBotIds:e.selectedBotIds,set:e.getSetFunction()}));(0,y.useEffect)(()=>{if(t.current||0===n.length)return;let o=(0,e_.collectChatBotIds)(n);(0,e_.areChatBotIdListsEqual)(o,r)||(a?(0,e_.writeChatSelectedBots)(l,n):l(e=>{e.selectedBotIds=o}));let s=n[0],d=s?.url;d&&i!==d&&(a?e(d):l(e=>{e.bot=s,e.modelInfoMap[C.EChatInputType.AI_CHAT]={name:s.name,icon_class_name:s.icon_class_name,icon_url:s.icon_url,type:s.type,url:d}}))},[e,t,i,a,n,r,l])}({handleUpdateBotUrl:O,hasUserChangedRef:P,modelInfoUrl:d?.url,queryModels:V,persistSelection:!R});let z=(0,y.useMemo)(()=>d&&D&&d.url!==D.url?d:D||d||(0,e_.getConfiguredDefaultChatBot)(g)||g?.[0],[d,D,g]);!function({cascaderOptions:e,displayModel:t,handleUpdateBotUrl:i,hasUserChangedRef:a,modelList:n,queryModels:r}){let{selectedBotIds:l,set:o}=(0,k.useChatStore)(e=>({selectedBotIds:e.selectedBotIds,set:e.getSetFunction()})),s=(0,y.useMemo)(()=>!t?.name||!e.length||e.some(e=>e.children?.some(e=>(0,tG.getModelOptionModelName)(e)===t.name)),[t?.name,e]);(0,y.useEffect)(()=>{var d;let u;if(s||!n.length)return;let c=(d=t?.name,function(e,t){if(!e)return;let i=tW[e];if(i)return t.find(e=>e.name===i)?.url}(d,n)||(u=e.flatMap(e=>e.children.flatMap(e=>{let t=n.find(t=>String(t.id)===e.value);return t?.url?[t]:[]})),(0,e_.getConfiguredDefaultChatBot)(u)?.url)||function(e,t){let i=e[0]?.children?.[0]?.value;if(i)return t.find(e=>String(e.id)===i)?.url}(e,n));if(!c)return;let m=n.find(e=>e.url===c);m&&(a.current=!0,i(c),(0,e_.writeChatSelectedBots)(o,(0,e_.replaceChatSelectionPrimary)(r.length>0?r:(0,e_.resolveChatBotsByIds)(l,n),m,t)))},[e,t,i,a,s,n,r,l,o])}({cascaderOptions:v,displayModel:z,handleUpdateBotUrl:O,hasUserChangedRef:P,modelList:g,queryModels:V});let U=(0,y.useMemo)(()=>{var e;let t,a,n;return e=v,t=x.map(e=>({kind:"leaf",id:`featured:${e.id}`,label:e.name,icon:e.icon_url||e.icon_class_name||"",marks:(0,ep.toMarks)(e.rightIcon),modelName:e.name,data:{...e,modelName:e.name}})),a=e.map(e=>({kind:"group",id:e.value,label:e.label,icon:e.iconUrl||e.icon,children:e.children.map(e=>({kind:"leaf",id:e.value,label:e.label,icon:e.icon,marks:e.marks,modelName:(0,tG.getModelOptionModelName)(e),data:e.data}))})),n=[],t.length>0&&n.push({kind:"section",id:"featured",title:(0,i.jsx)(eh.Trans,{id:"mUB3zx"}),children:t}),n.push({kind:"section",id:"all",title:(0,i.jsx)(eh.Trans,{id:"f87SjU"}),children:a}),n},[v,x]),G=(0,y.useMemo)(()=>{if(p.length>0){let e=p.map(e=>g.find(t=>t.id===e)?.name).filter(e=>!!e);if(e.length>0)return e}let e=z?.name;return e?[e]:[]},[p,g,z?.name]),H=h&&_!==C.EChatContainerType.INDEX_ENTRY&&T!==ey.URLS.HIXChat.ask_ai,B=(e,t)=>{var i,a;let r;P.current=!0,(0,e_.writeChatSelectedBots)(f,(i=t.firstData,e.flatMap(e=>{let t=g.find(t=>t.name===e);return t?[t]:i?.name===e?[i]:[]}))),t.first!==z?.name&&(t.first,a=t.firstData,(r=a?.url)&&(O(r),P.current=!0,H&&n(r,void 0,{shallow:!1}))),(_===C.EChatContainerType.CHAT_LIST||_===C.EChatContainerType.SHARE)&&M({needUpdateBotUrl:!1,chatType:C.EChatInputType.AI_CHAT,shouldFocus:_===C.EChatContainerType.SHARE})};return 0===g.length?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ei.Skeleton.Button,{className:a,style:{width:"9rem",height:"32px",borderRadius:999},active:!0}),j]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(tN,{dropdownWidth:l,isCompact:r,value:G,nodes:U,max:4,className:t,onChange:(e,t)=>
220_===C.EChatContainerType.CHAT_LIST||_===C.EChatContainerType.SHARE?w.confirm({title:S._({id:"BQXoAa"}),content:S._({id:"mTmD7g"}),okText:S._({id:"7VpPHA"}),cancelText:S._({id:"dEgA5A"}),onOk:()=>{ex.trackEmitter.emit("track-event",{name:"ai_chat_model_selector",method:"change_model_click"}),B(e,t)}}):(B(e,t),!0),onOpenChange:e=>{e&&(N.dismiss(),ex.trackEmitter.emit("track-event",{name:"ai_chat_model_selector",method:"open_selector"}))},children:[(0,i.jsx)(en.default,{title:S._({id:"LIikbt"}),tooltipProps:{open:N.open,trigger:[],arrow:!0,destroyTooltipOnHide:!0,overlayInnerStyle:{whiteSpace:"nowrap"}},children:(0,i.jsx)(tP,{ref:N.triggerRef,onClick:N.dismiss,onPointerEnter:()=>{G.length>1&&N.dismiss()},children:o?(0,i.jsx)(tP.PoweredBy,{}):null})}),(0,i.jsxs)(e5,{children:[(0,i.jsx)(ts,{children:(0,i.jsx)(tM,{})}),(0,i.jsx)(e4,{}),(0,i.jsx)(tz,{}),(0,i.jsx)(tU,{})]})]}),j]})}function t2(e){let{className:t}=e,{chatType:a,containerType:n,entryInitialModelName:r}=(0,I.useChatContainerContext)(e=>({chatType:e.chatType,containerType:e.containerType,entryInitialModelName:e.entryInitialModelName})),l=(0,y.useMemo)(()=>(0,et.match)(a).with(et.P.union(C.EChatInputType.AI_IMAGE,C.EChatInputType.AI_VIDEO),()=>(0,i.jsx)(ef,{type:a,entryInitialModelName:r})).with(et.P.union(C.EChatInputType.AI_CHAT),()=>(0,i.jsx)(t1,{className:t})).otherwise(()=>null),[a,t,r]);return!l||[C.EChatContainerType.BOT_ENTRY].includes(n)?null:(0,i.jsx)("div",{className:ek.tw`flex ${t}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),children:l})}var t8=e.i(63919),t5=e.i(857799),t4=e.i(554690),t6=e.i(881598),t3=e.i(19511),t7=e.i(979721),t9=e.i(78389),ie=e.i(934444),it=e.i(115130),ii=e.i(754280),ia=e.i(884533),ir=e.i(185029),il=e.i(582602),io=e.i(718451);let is=(0,y.memo)(function(){let e=(0,I.useChatContainerContext)(e=>e.chatType),{handelHiddenModel:t}=(0,ie.default)(),{bot:n,isAdvanced:r,fileList:l,modelListMap:o}=(0,k.useChatStore)(e=>({bot:e.chatDetail?.bot||e.bot,isAdvanced:(0,t9.isAdvancedModeV2)(e.chatDetail?.bot||e.bot),fileList:e.fileListMap.chat,modelListMap:e.modelListMap})),s=a.Form.useWatch([]),d=s?.templateInfo,u=(0,ia.useIsOmniReferenceMode)(s?.modelName,s?.variant),{isVariant:c}=(0,ir.useFormVariant)({chatType:e,modelName:s?.modelName,variant:s?.variant}),m=(0,y.useMemo)(()=>e===C.EChatInputType.AI_VIDEO||e===C.EChatInputType.AI_IMAGE?o[e].find(e=>e.modelName===s?.modelName):null,[o,s?.modelName,e]),p=(0,y.useMemo)(()=>[C.EChatInputType.AI_VIDEO,C.EChatInputType.AI_IMAGE].includes(e),[e]),f=(0,y.useMemo)(()=>s?.modelName&&[C.EChatInputType.AI_VIDEO,C.EChatInputType.AI_IMAGE].includes(e)?er.AGENT_MODELS.includes(s?.modelName)?null:d?d.videoType:u?t5.ECreateVideoType.Ref:(0,et.match)(e).with(C.EChatInputType.AI_VIDEO,()=>s?.variant==="frames"||s?.variant==="ingredients"?t5.ECreateVideoType.IMAGE:m&&"modelType"in m?0===l.length&&m?.textFormConfig?t5.ECreateVideoType.TEXT:t5.ECreateVideoType.IMAGE:null).with(C.EChatInputType.AI_IMAGE,()=>{let e=m&&"modelType"in m?0===l.length&&m?.textFormConfig?t5.ECreateVideoType.Text2Image:t5.ECreateVideoType.Image2Image:null;return e===t5.ECreateVideoType.Image2Image&&m?.modelName===t8.EVideoModel.WAN2_5_T2I_PREVIEW?t5.ECreateVideoType.Text2Image:e}).otherwise(()=>null):null,[s?.modelName,s?.variant,m,e,d,l?.length,u]),h=(0,y.useMemo)(()=>{let t=l?.find(e=>(0,t4.isVideoFile)(e));if(e===C.EChatInputType.AI_VIDEO&&t&&!u)return t.metadata?.duration||3},[l,e,u]),g=s?.length??h??(e===C.EChatInputType.AI_VIDEO?t5.EVideoDuration.DURATION5:void 0),x=e===C.EChatInputType.AI_VIDEO&&void 0===g,E=s?.numOutputs?Number(s?.numOutputs):1,v=e!==C.EChatInputType.AI_VIDEO||(0,il.isVideoModelResolutionSupported)({fileCount:l.length,isVariant:c,modelList:o[C.EChatInputType.AI_VIDEO],modelName:s?.modelName,resolution:s?.resolution,variant:s?.variant}),{data:_,isInitialLoading:b}=io.api.aiVideo.getGenerationCredit.useQuery({taskType:h?t5.ECreateVideoType.Video:f,templateId:d?.templateId,generationConfig:{model:t({modelName:s?.modelName,returnOriginalModel:!0}),resolution:s?.resolution,length:g,generateAudio:e===C.EChatInputType.AI_VIDEO?![t8.EVideoModel.QWEN_IMAGE,t8.EVideoModel.MINIMAX_HAILUO_02,t8.EVideoModel.MINIMAX_HAILUO_03,t8.EVideoModel.MINIMAX_HAILUO_03_MAX,t8.EVideoModel.GEMINI_OMNI_1_1_FLASH,t8.EVideoModel.SEEDANCE].includes(s?.modelName):void 0,...u?{configType:t8.EGenerationConfigType.Ref2VideoV2,refs:(0,ii.getOmniReferenceRefs)(l)||[]}:{},...s?.mode&&{mode:s.mode}
220,quality:s?.quality,aspectRatio:s?.aspectRatio},actualDuration:h,numOutputs:E},{enabled:!!f&&p&&!x&&v}),{botName:T,costCount:N}=(0,y.useMemo)(()=>{let t=(0,it.getAgentTypeFromChatType)(e),i=t?t===t6.EAgentType.DEEPRESEARCH?70:100*(t===t6.EAgentType.AI_WRITER):null;return i?{botName:"",costCount:i}:(0,et.match)(e).with(et.P.union(C.EChatInputType.AI_IMAGE,C.EChatInputType.AI_VIDEO),()=>({botName:m&&"modelLabel"in m?m.modelLabel:"",costCount:_?.discountedCost??_?.cost??0})).otherwise(()=>({botName:n?.name,costCount:n?.advanced_credit||n?.credit||0}))},[e,n,m,_]);return er.AGENT_MODELS.includes(s?.modelName)||e===C.EChatInputType.AI_WRITER?null:b?(0,i.jsxs)("div",{className:"flex h-8 items-center gap-1 px-[6px] py-[2px]",children:[(0,i.jsx)("span",{className:"i-cus--hix2-credit size-4"}),(0,i.jsx)(ei.Skeleton.Button,{active:!0,className:"!min-w-[1.7rem]",style:{width:"1.7rem",height:"16px",borderRadius:"16px",lineHeight:"16px",verticalAlign:"middle"}})]}):(0,i.jsx)(t3.default,{onlyCredits:!0,isPPT:n?.url===t7.CHAT_PPT_URL,perMessageCreditCostCount:N,lineThroughCost:_?.discountedCost?_?.cost:void 0,botName:T||"",specialCreditCount:n?.advanced_credit,specialCreditText:"",isAdvanced:r||p||[C.EChatInputType.DEEP_RESEARCH,C.EChatInputType.AI_SLIDES].includes(e),buttonClassName:"cursor-default px-0 hover:bg-transparent hover:text-f-text-secondary text-f-text-secondary"})});var id=e.i(56410),iu=e.i(508652),ic=e.i(596391);let im="variant",ip=()=>null;function ih(){let e=a.Form.useFormInstance(),t=a.Form.useWatch("modelName",e),n=a.Form.useWatch(im,e),r=(0,I.useChatContainerContext)(e=>e.chatType),{isVariant:l}=(0,ir.useFormVariant)({chatType:r,modelName:t}),{templateInfo:o}=(0,iu.useFormTemplate)(e),s=(0,eh.useLingui)(),d=(0,k.useChatStore)(e=>e.isCanvasOpen),[u,c]=(0,y.useState)(!1),m=(0,y.useMemo)(()=>{let e=[{label:s.i18n._(eB.i18n._({id:"j2xOpA"}
220)),value:"text",icon:"i-cus--hix2-text-to-video",disabled:!1},{label:s.i18n._(eB.i18n._({id:"z8dFOB"})),value:"frames",icon:"i-cus--hix2-frame",disabled:!1},{label:s.i18n._(eB.i18n._({id:"fcafS4"})),value:"ingredients",icon:"i-cus--hix2-video-refer",disabled:!1}],i=t===t8.EVideoModel.GEMINI_OMNI_FLASH;return e.map(e=>"frames"===e.value&&i?{...e,label:s.i18n._(eB.i18n._({id:"2drj7S"})),icon:"i-cus--hix2-image-to-video"}:"ingredients"===e.value&&x.REFERENCE_VIDEO_MODEL_LIST.includes(t)?{...e,label:s.i18n._(eB.i18n._({id:"f6IJx-"}))}:e)},[s,t]),p=(0,y.useMemo)(()=>m.find(e=>!e.disabled),[m]),f=n||p?.value,h=(0,y.useMemo)(()=>m.find(e=>e.value===f),[f,m]);return((0,id.useUpdateEffect)(()=>{d&&u&&c(!1)},[d,u]),!l||o)?null:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.Form.Item,{name:im,initialValue:"ingredients",noStyle:!0,children:(0,i.jsx)(ip,{})}),(0,i.jsx)(ic.default,{options:m,value:f,onChange:t=>{e.setFieldValue(im,t)},contentClassName:"min-w-[50px] gap-y-0.5",boxClassName:ta.cls`rounded-lg`,iconClassName:ta.cls`size-[18px]`,placement:"bottomLeft",onOpenChange:e=>{c(e)},children:(0,i.jsxs)(tk.default,{variant:"default",className:"whitespace-nowrap",children:[(0,i.jsx)(e6.IconItem,{className:ta.cls`${h?.icon} size-[18px]`}),h?.label,(0,i.jsx)(e6.IconItem,{className:ta.cls`size-[18px] shrink-0 i-cus--hix2-down transition-all duration-200 ${u?"rotate-180":""}`})]})})]})}let ig="thinking",ix=()=>null;function iy(){let e=a.Form.useFormInstance(),t=a.Form.useWatch(ig,e),n=(0,eh.useLingui)(),{isChatListLoading:r}=(0,eo.useChatFormNormalContext)(),l=(0,y.useMemo)(()=>[{label:n.i18n._(eB.i18n._({id:"D79cZK"})),value:!1},{label:n.i18n._(eB.i18n._({id:"AUV-TY"})),value:!0}],[n]),o=t?l[1]:l[0];return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.Form.Item,{name:ig,noStyle:!0,children:(0,i.jsx)(ix,{})}),(0,i.jsx)(ic.default,{options:l,value:!!t,onChange:t=>{e.setFieldValue(ig,t)},contentClassName:"min-w-[112px] gap-y-0.5",boxClassName:"rounded-[12px]",unselectedOptionClassName:"text-f-text-secondary",className:"[&_.coco-popover-inner]:!rounded-[18px]",placement:"bottomLeft",hasSuffix:!0,children:e=>(0,i.jsxs)(tk.default,{variant:"default",className:ta.cls`whitespace-nowrap rounded-full ${e?"bg-f-bg-hover":""}`,loading:r,loadingClassName:"size-[18px]",children:[o.label,!r&&(0,i.jsx)(e6.IconItem,{className:ta.cls`size-[18px] shrink-0 i-cus--hix2-down transition-all duration-200 ${e?"rotate-180":""}`})]})})]})}var iI=e.i(426608),iC=e.i(788719),iE=e.i(420532),iE=iE,iv=e.i(755322);e.i(697036);var i_=e.i(781025),ib=e.i(779828),iT=e.i(577107),iN=e.i(138491),iM=e.i(298706),iS=e.i(97429),ik=e.i(315058);let iA=iS.z.object({success:iS.z.literal(!0)}).strict(),iw="Failed to request AI Chat generation cancellation.";async function ij(e){try{let t=await fetch(ik.HIX_CHAT_API.AI_CHAT_CANCEL,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatId:e})});if(401===t.status&&window.dispatchEvent(new Event("TRPC_401")),!t.ok||!iA.safeParse(await t.json()).success)throw Error(iw)}catch{throw Error(iw)}}async function iF(e){await Promise.all(e.map(e=>ij(e)))}function iR(e,t){return null!==e&&null!==t&&e.chatId===t.chatId&&e.requestOwner===t.requestOwner}function iL(e){let t=e?.answers.at(-1);return t?.components?.some(e=>e.type===iM.aiChatGenerationStoppedComponent.type&&e.code===iM.aiChatGenerationStoppedComponent.code)===!0}function iV(e){return Object.entries(e.abortControllersByChatId).filter(([,e])=>!e.signal.aborted).map(([e,t])=>({chatId:e,requestOwner:t}))}function iD(e){let t=e.chatDetail?.chats;if(t&&t.length>1)return t.every(e=>iL(e.data.at(-1)));let i=e.sessionListMap.chat;return iL((null!=e.currentActiveSessionId?i.find(t=>t.id===e.currentActiveSessionId):void 0)??i.at(-1))}var iO=e.i(547123),iP=e.i(901497),iz=e.i(281541),iU=e.i(184885),iG=e.i(950839);let{confirm:iH}=iP.Modal;var iB=e.i(696650);let iW="size-[18px]",i$=y.default.memo(function(e){let{disabledSendButton:t=!1,showGuide:n=!1}=e,{bot:r,isGenerating:l,isPrepareWait:o}=(0,k.useChatStore)(e=>({bot:e.bot,isGenerating:e.isGenerating,isPrepareWait:e.isPrepareWait})),s=(0,iv.useGetChatId)(),d=(0,b.useHixChatLoadingState)(),{botType:u,chatType:m,agentMode:p}=(0,I.useChatContainerContext)(e=>({botType:e.botType,chatType:e.chatType,agentMode:e.agentMode??"legacy"})),{stopChat:f}=(0,iO.default)(),{onStopConfirm:h,disableStopInfo:g}=function(){let{i18n:e,_:t}=(0,eh.useLingui)(),a=(0,iG.useNoRefreshUpdateChatByUrl)(),{plan:n,appName:r}=(0,iz.useSubProductInfo)(),{upgradePlan:l}=(0,iU.useAppUIModal)(),{isHixChatMaxPlanActive:o}=n,{chatId:s,chatType:d}=(0,I.useChatContainerContext)(e=>({chatId:e.chatId,chatType:e.chatType})),u=function(){let e=(0,I.useChatContainerContext)(e=>e.chatType),{i18n:t,_:i}=(0,eh.useLingui)(),a=(0,y.useMemo)(()=>i=>{let a=i.sessionListMap.chat;if(e===C.EChatInputType.DEEP_RESEARCH){let e=a.some(e=>e.isStream&&!!e.cancelledMap);return e?{isStopping:e,stopText:t._({id:"yDxt1p"})}:null}return null},[e,i]);return(0,k.useChatStore)(a)}(),m=(0,k.useChatStore)(e=>e.getSetFunction()),{mutateAsync:p}=io.api.agent.cancelTask.useMutation(),f=(0,c.useMemoizedFn)((e,t)=>{e&&t&&m(i=>{i.sessionListMap.chat=i.sessionListMap.chat.map(i=>i.id===e?{...i,cancelledMap:{[t]:!0}}:i)})}),h=(0,y.useRef)(null),g=(0,c.useMemoizedFn)(e=>{h.current=iH({...e,icon:null,title:(0,i.jsx)("div",{className:"text-base font-semibold text-f-text",children:e.title}),centered:!0,closable:!0,className:"[&_.ant-btn-default]:!text-f-text",maskClosable:!0,content:(0,i.jsx)("div",{className:"text-sm text-f-text-secondary leading-5",children:e.content})})}),x=(0,y.useRef)(!1),E=function(){let e=(0,I.useChatContainerContext)(e=>e.chatType),{i18n:t,_:i}=(0,eh.useLingui)();return(0,y.useMemo)(()=>{let i={okText:t._({id:"ygCKqB"}),cancelText:t._({id:"eAiA63"})};return(0,et.match)(e).with(C.EChatInputType.AI_SLIDES,()=>({title:t._({id:"crWxU6"}),content:t._({id:"qzEVF4"}),...i})).with(C.EChatInputType.AI_VIDEO,()=>({title:t._({id:"zmQhTe"}),content:t._({id:"4ab2rV"}),...i})).with(C.EChatInputType.AI_IMAGE,()=>({title:t._({id:"35I6Um"}),content:t._({id:"nhB1uT"}),...i})).otherwise(()=>({title:t._({id:"ZRnLzw"}),content:t._({id:"N60q1Q"}),...i}))},[e,i])}(),v=(0,c.useMemoizedFn)(async()=>new Promise(t=>{let i=k.chatStoreInstance.getState().sessionListMap.chat.find(e=>e.isStream),a=i?.answers.at(-1)?.id,n=i?.id;if(!a||!s){eW.message.info(e._({id:"eyvNfs"})),t(!0);return}p({chatId:s,detailId:a.toString()},{onSuccess:e=>{e?.message&&eW.message.info(e.message),e?.status==="cancelled"&&f(n,a),t(!0)}})}));return{onStopConfirm:(0,c.useMemoizedFn)(()=>{[C.EChatInputType.AI_VIDEO,C.EChatInputType.AI_IMAGE].includes(d)?v():g({title:E.title,content:E.content,okText:E.okText,cancelText:E.cancelText,cancelButtonProps:{onClick:()=>{x.current=!0,h.current?.destroy()}},onOk:async()=>v(),afterClose:()=>{x.current&&(x.current=!1,a(ey.URLS.HIXChat.home,{chatType:d}))}})}),onLimitConfirm:(0,y.useCallback)(()=>
220{g({title:e._({id:"adJzE6"}),content:o?e._({id:"hmVHYO"}):e._({id:"uZxS8w"}),okText:o?e._({id:"GJyalC"}):e._({id:"IURrEe"}),cancelText:o?null:e._({id:"PBxg_E"}),onOk:()=>{o||l.show({appName:r})}})},[r,o,l,t,g]),disableStopInfo:u}}(),{onStopConfirm:x,isStoppingGeneralAgent:E,stopConfirmModal:v}=function(){let{i18n:e,_:t}=(0,eh.useLingui)(),{cancel:a}=(0,i_.useAgentActions)(),n=(0,ib.useAgentStoreApi)(),r=(0,iT.useFeatureStoresApi)(),l=(0,ib.useAgentStore)(e=>e.runId),o=(0,ib.useAgentStore)(e=>e.isRunning),[s,d]=(0,y.useState)(!1),[u,m]=(0,y.useState)(null),p=(0,c.useMemoizedFn)(()=>{d(!1)}),f=(0,c.useMemoizedFn)(()=>{d(!0)}),h=(0,c.useMemoizedFn)(()=>{let{threadId:e,runId:t,messages:i}=n.getState(),l=Object.values(r.subAgent.getState().activeRunsById);p(),m(t),e&&ex.trackEmitter.emit("track-event",{name:"click_pause_agent",id:e,...(0,iN.buildPauseAgentTrackPayload)({messages:i,activeSubAgentRuns:l})}),a({interruptStream:!1})});return{onStopConfirm:f,isStoppingGeneralAgent:!!u&&u===l&&o,stopConfirmModal:(0,i.jsx)(eI.default,{open:s,onCancel:p,onOk:h,title:(0,i.jsx)("div",{className:"text-base font-semibold",children:e._({id:"3OC0T1"})}),okText:e._({id:"IgrLD_"}),cancelText:e._({id:"dEgA5A"}),centered:!0,destroyOnClose:!0,closable:!0,maskClosable:!0,footer:()=>(0,i.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,i.jsx)(tk.default,{color:"modalCancel",rounded:"sm",onClick:p,className:"px-5 py-1 text-sm leading-5",children:e._({id:"dEgA5A"})}),(0,i.jsx)(tk.default,{color:"modalConfirm",rounded:"sm",onClick:h,className:"px-5 py-1 text-sm leading-5",children:e._({id:"IgrLD_"})})]}),children:(0,i.jsx)("div",{className:"text-sm leading-5 text-f-text-secondary",children:e._({id:"AJCUbq"})})})}}(),{onStopConfirm:_,isAiChatCancelPending:T,isAiChatStopped:N,isAiChatCancelBusy:M,stopConfirmModal:S}=function(){let{i18n:e,_:t}=(0,eh.useLingui)(),a=(0,I.useChatContainerContextStore)(),{chatId:n,chatType:r,agentMode:l}=(0,I.useChatContainerContext)(e=>({chatId:e.chatId??null,chatType:e.chatType,agentMode:e.agentMode??"legacy"})),o=(0,k.useChatStore)(e=>({inFlightTargets:iV(e),isChatLoading:e.isChatLoading,isPrepareWait:e.isPrepareWait,isStopped:iD(e)})),[s,d]=(0,y.useState)(null),u=(0,y.useRef)(null),[m,p]=(0,y.useState)(null),f=(0,c.useMemoizedFn)(e=>{let t=a?.getState(),i=k.chatStoreInstance.getState(),n=t?.chatId===e.chatId||i.chatDetail?.chats?.some(t=>t.chatInfo.id===e.chatId)===!0||i.abortControllersByChatId[e.chatId]===e.requestOwner;return t?.chatType===C.EChatInputType.AI_CHAT&&"agui"!==t.agentMode&&n&&i.abortControllersByChatId[e.chatId]===e.requestOwner&&i.isChatLoading&&!e.requestOwner.signal.aborted}),h=(0,c.useMemoizedFn)(e=>{let t=k.chatStoreInstance.getState();return f(e)&&!t.isPrepareWait&&!iD(t)}),g=(0,c.useMemoizedFn)(e=>{iR(u.current,e)&&(u.current=null,p(t=>iR(t,e)?null:t))}),x=(0,c.useMemoizedFn)(()=>{d(null)}),E=(0,c.useMemoizedFn)(()=>{let e=iV(k.chatStoreInstance.getState()),t=u.current;if(t&&!f(t)&&g(t),!e.length||u.current)return;let i=e[0];h(i)&&d(i)}),v=(0,c.useMemoizedFn)(async()=>{if(s){if(u.current||!h(s))return void x();if(x(),u.current=s,p(s),!iR(u.current,s)||!h(s))return void g(s);try{let e=iV(k.chatStoreInstance.getState());k.chatStoreInstance.getState().abortAllChatFetches(),await iF(e.map(e=>e.chatId))}catch{g(s),h(s)&&eW.message.error(e._({id:"J-lE4a"}))}}});(0,y.useEffect)(()=>{s&&!h(s)&&d(null);let e=u.current;e&&!f(e)&&g(e)},[o.isChatLoading,o.isPrepareWait,o.isStopped,o.inFlightTargets,l,n,r,g,s,h,f]);let _=o.inFlightTargets[0]??null,b=r===C.EChatInputType.AI_CHAT&&"agui"!==l&&!!n&&o.inFlightTargets.length>0&&o.isChatLoading,T=b&&iR(m,_),N=b&&o.isStopped,M=T||N||b&&o.isPrepareWait;return{onStopConfirm:E,isAiChatCancelPending:T,isAiChatStopped:N,isAiChatCancelBusy:M,stopConfirmModal:(0,i.jsx)(eI.default,{open:null!==s,onCancel:x,onOk:()=>v(),title:(0,i.jsx)("div",{className:"text-base font-semibold",children:e._({id:"YeK6T-"})}),okText:e._({id:"ygCKqB"}),cancelText:e._({id:"dEgA5A"}),centered:!0,destroyOnClose:!0,closable:!0,maskClosable:!0,footer:()=>(0,i.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,i.jsx)(tk.default,{color:"modalCancel",rounded:"sm",onClick:x,className:"px-5 py-1 text-sm leading-5",children:e._({id:"dEgA5A"})}),(0,i.jsx)(tk.default,{color:"modalConfirm",rounded:"sm",onClick:()=>v(),className:"px-5 py-1 text-sm leading-5",children:e._({id:"ygCKqB"})})]}),children:(0,i.jsx)("div",{className:"text-sm leading-5 text-f-text-secondary",children:e._({id:"HsjZp9"})})})}}(),A=a.Form.useFormInstance(),w=a.Form.useWatch("modelName",A),{similarInfo:j}=(0,iB.useFormSimilarState)(),F="agui"===p,R=m===C.EChatInputType.AI_CHAT&&"agui"!==p,L=R&&M,V=R&&(T||N),D=!!s,O=!D&&d,P="ad"===u,z=(0,y.useMemo)(()=>[C.EChatInputType.DEEP_RESEARCH,C.EChatInputType.AI_SLIDES,C.EChatInputType.AI_WRITER].includes(m)||er.AGENT_MODELS.includes(w),[m,w]),U=(0,y.useMemo)(()=>D&&d&&!o&&r?.url!==t7.CHAT_PPT_URL&&!l,[D,d,o,r?.url,l]),G=!U&&t||O,H=d&&U,B=(0,y.useCallback)(()=>d?!U||E||L?(0,i.jsx)(e6.IconItem,{className:`${iW} i-cus--hix2-loading text-f-text animate-spin`}):(0,i.jsx)(e6.IconItem,{className:`${iW} i-cus--hix2-stop text-f-text`}):(0,i.jsx)(e6.IconItem,{className:`${iW} i-cus--hix2-arrow-up ${P?"!size-6":""}`}),[d,U,P,E,L]),W=(0,y.useCallback)(()=>{let e=G||o||l||g?.isStopping||E||L,t=P?"transition-none":"transition-colors duration-200";return`size-[32px] flex items-center rounded-[20px] justify-center ${e?"bg-f-bg-disabled cursor-not-allowed text-f-text-disabled":"bg-f-primary curs
220or-pointer text-f-text hover:bg-f-primary-hover active:bg-f-primary-active"} ${t}`},[G,o,l,g?.isStopping,E,L,P]),$=(0,c.useMemoizedFn)(e=>{if(H){e.stopPropagation(),e.preventDefault(),(0,et.match)({isGeneralAgentConfirmed:F,isLegacyAiChat:R,chatType:m,isTaskChat:z}).with({isGeneralAgentConfirmed:!0},()=>x).with({isLegacyAiChat:!0},()=>_).with({isTaskChat:!0},()=>h).otherwise(()=>f)();return}G&&e.stopPropagation()}),q=(0,y.useCallback)(()=>U||V?F?eB.i18n._({id:"IgrLD_"}):R?eB.i18n._({id:"ygCKqB"}):z?g?.stopText||eB.i18n._({id:"IgrLD_"}):eB.i18n._({id:"ygCKqB"}):j?.reference_id?eB.i18n._({id:"tqvVPW"}):eB.i18n._({id:"JlFcis"}),[U,V,F,R,z,g?.stopText,j?.reference_id]),K=(0,i.jsx)("button",{title:"submit",type:"submit",onClick:$,disabled:G&&!H||g?.isStopping||E||R&&(o||M),className:W(),children:B()}),X=n?(0,i.jsx)(iE.default,{children:(0,i.jsx)(iC.BorderGlowWrapper,{children:K})}):K;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(en.default,{tooltipProps:{autoAdjustOverflow:!0,title:q()},children:(0,i.jsx)("div",{children:X})}),v,S]})}),iq=y.default.memo(function(e){let{uploadFileProps:t,sendButtonShowGuide:n=!1,disabledSendButton:r=!1,actions:l,onClick:o,className:s,leftAddon:d}=e,{updateStates:u,chatFileList:c,isAiBackgroundActive:m}=(0,k.useChatStore)(e=>({updateStates:e.updateState,chatFileList:e.fileListMap.chat,isAiBackgroundActive:e.isAiBackgroundActive}));(0,O.useChatIdListener)(()=>{u("netWorkType",D.NetWorkType.Web)});let{chatType:p}=(0,I.useChatContainerContext)(e=>({chatType:e.chatType})),f=function(e){let{isRecording:t,setInputValue:n}=(0,k.useChatStore)(e=>({isRecording:e.isRecording,setInputValue:e.setInputValue})),r=a.Form.useFormInstance(),{isModelBotDisabled:l}=(0,P.useModelBotMetaState)(),o=(0,b.useHixChatLoadingState)(),{isChatListLoading:s}=(0,eo.useChatFormNormalContext)(),d=(0,Y.useCanSend)();return(0,y.useMemo)(()=>[{key:"upload",isLoading:!1,disabled:o||t||e.uploadFileProps?.disabled||!d,render:t=>(0,i.jsx)(U.default,{...e.uploadFileProps,tooltipProps:{...e.uploadFileProps.tooltipProps,...o&&{open:!1}},disabled:o||t?.disabled,className:"p-[7px] rounded-full group/upload hover:bg-f-bg-hover",iconClassName:"size-[18px]"})},{key:"chatMode",render:()=>(0,i.jsx)(G.ChatModeBadge,{})},{key:"skills",disabled:t,render:e=>(0,i.jsx)($.default,{disabled:e?.disabled})},{key:"modelSelector",render:()=>(0,i.jsx)(t2,{})},{key:"videoVariant",disabled:!d,render:()=>(0,i.jsx)(ih,{})},{key:"network",disabled:l||o||s||t||!d,render:e=>(0,i.jsx)(H.ChatNetWork,{disabled:e?.disabled})},{key:"forceCompression",render:()=>(0,i.jsx)(B.ChatForceCompression,{})},{key:"modelCredits",position:"right",render:()=>(0,i.jsx)(is,{})},{key:"thinkingMode",position:"right",render:()=>(0,i.jsx)(iy,{})},{key:"speech",position:"right",render:e=>(0,i.jsx)(W.default,{disabled:e?.disabled,onRecognizing:e=>{let t=r.getFieldValue("inputValue")+e;r.setFieldValue("inputValue",t),n(t,"chat"),Q.chatFormEditorMedia.focus(x.HIX_CHAT_FORM_MEDIA_KEYS.NORMAL,{cursor:"end"})}})},{key:"videoForm",disabled:!d,render:()=>(0,i.jsx)(q.default,{})},{key:"imageForm",disabled:!d,render:e=>(0,i.jsx)(K.default,{disabled:e?.disabled})},{key:"writerForm",disabled:!d,render:e=>(0,i.jsx)(J.default,{disabled:e?.disabled})},{key:"slidesForm",disabled:o||!d,render:e=>(0,i.jsx)(Z.default,{disabled:e?.disabled})},{key:"genericForm",disabled:!d,render:e=>(0,i.jsx)(ee.default,{disabled:e?.disabled})},{key:"aiPrompt",disabled:o||!d,render:e=>(0,i.jsx)(X.default,{disabled:e?.disabled})},{key:"connectorsForm",disabled:!d,render:e=>(0,i.jsx)(z.GenerateConnectorsForm,{disabled:e?.disabled})}],[d,r,o,s,l,t,e.uploadFileProps,n])}({uploadFileProps:t}),h=m&&p===C.EChatInputType.AI_IMAGE,g=(0,y.useCallback)(e=>{e.stopPropagation()},[]),E=(0,y.useCallback)(e=>{e.target!==e.currentTarget&&e.stopPropagation()},[]),{leftActions:v,rightActions:_}=(0,y.useMemo)(()=>{let e=(l?.filter(e=>!e.isHidden)??[]).flatMap(e=>{let t=f.find(t=>t.key===e.key);return t?[t]:[]}).map(e=>h&&("upload"===e.key||"imageForm"===e.key||"aiPrompt"===e.key)?{...e,disabled:!0}:e);return{leftActions:e.filter(e=>"right"!==e.position),rightActions:e.filter(e=>"right"===e.position)}},[l,f,h]);(0,y.useEffect)(()=>{c?.length&&u("netWorkType",null)},[c?.length,u]);let T=(0,y.useCallback)(e=>e.map(e=>(0,i.jsx)(y.default.Fragment,{children:e.render({disabled:e.disabled,isActive:e.isActive,isLoading:e.isLoading})},e.key)),[]);return(0,i.jsxs)("div",{"data-scheduled-task-footer":!0,"data-chat-form-footer-popup-host":!0,onClick:o,className:ek.tw`relative w-full min-w-0 cursor-text gap-x-2 flex items-center justify-between ${s||""}`,children:[(0,i.jsx)(iI.default,{className:"min-w-0 flex-1 select-none relative",children:(0,i.jsxs)("div",{onClick:E,className:"flex items-center gap-x-1",children:[T(v),d]})}),(0,i.jsxs)("div",{onClick:g,className:"shrink-0 flex items-center gap-x-[10px]",children:[T(_),(0,i.jsx)(i$,{disabledSendButton:r,showGuide:n})]})]})});function iK(){let e=(0,I.useChatContainerContext)(e=>!!e.chatId),t=(0,b.useHixChatLoadingState)(),{isAdChatBot:i}=(0,T.useChatInput)();return(0,c.useMemoizedFn)((a,n)=>{let r=!!((a.getFieldValue("inputValue")||"").trim()&&!a.getFieldError("inputValue")?.length),l=!e,o=i&&r&&!t&&l;return{isInputValueValid:r,isDemoPage:l,shouldShowGuideForAdBot:o,sendButtonShowGuide:o&&!n}})}function iX({disableUpload:e,disabledSend:t,className:n,editorKey:r,actions:l,leftAddon:o,children:s}){let{uploadProps:d}=(0,el.useUploadFileList)(),{footerActions:u}=(0,T.useChatInput)(),m=iK(),p=(0,y.useMemo)(()=>({...d,disabled:e}),[d,e]),f=(0,c.useMemoizedFn)(()=>{Q.chatFormEditorMedia.focus(r||x.HIX_CHAT_FORM_MEDIA_KEYS.NORMAL)});return(0,i.jsx)(a.Form.Item,{noStyle:!0,shouldUpdate:!0,children:e=>{let{sendButtonShowGuide:a}=m(e,t);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(iq,{sendButtonShowGuide:a,disabledSendButton:t,uploadFileProps:p,onClick:f,actions:l??u,leftAddon:o,className:n}),s?.(e)]})}})}function iY({isEditorFocused:e=!1,sceneInputContribution:t,...a}){let n=t?.composer?.Component;return(0,i.jsx)(iX,{...a,leftAddon:n?(0,i.jsx)(n,{}):void 0,children:n=>(0,i.jsx)(V.default,{form:n,editorKey:a.editorKey,isEditorFocused:e,canShow:!t?.footer?.replacesHomeFocusPrompts})})}var iQ=e.i(33308),iJ=e.i(45843);function iZ(){let{fileList:e,onDeleteFile:t}=(0,el.useUploadFileList)(),a=(0,b.useHixChatLoadingState)(),n=e.find(t4.isSlidesTemplateFile),r=e.filter(e=>!(0,t4.isSlidesTemplateFile)(e));return!e.length||a?null:(0,i.jsx)(iQ.default,{fileList:r,onDeleteFile:t,hideTipText:!0,beforeItems:n?(0,i.jsx)(iJ.default,{file:n,onDeleteFile:t}):null})}var i0=e.i(245387),i1=e.i(2362),i2=e.i(686873),i8=e.i(362420),i5=e.i(969127);let i4=(0,y.createContext)(null);function i6({children:e,...t}){let a=(0,f.useShallowCompareMemo)(()=>t,[t]);return(0,i.jsx)(i4.Provider,{value:a,children:e})}function i3({onClick:e,onClose:t,className:n,clickPreview:r,classNames:l}){let[o,s]=(0,y.useState)(!1),{similarInfo:d,setSimilarInfo:u}=(0,iB.useFormSimilar)(),{isDeleted:c}=(0,i5.useProjectChatReference)(),m=(0,b.useHixChatLoadingState)(),p=(0,eC.useLatestPathname)(),f=(0,i1.useLatestSearchParams)(),{title:h}=l||{},g=(0,i2.useOpenChatReference)(),x=(0,iG.useNoRefreshUpdateChatByUrl)(),{chatType:C,agentMode:E,updateContext:v}=(0,I.useChatContainerContext)(e=>({chatType:e.chatType,agentMode:e.agentMode,updateContext:e.updateContext}));if(!d)return null;let _=d.share_id||d.reference_id||r;return(0,i.jsx)(a.Form.Item,{name:"similarInfo",noStyle:!0,children:(0,i.jsx)(i6,{visible:o,setVisible:s,children:(0,i.jsx)("div",{className:ek.tw`
221            p-2 rounded-xl bg-f-bg-container flex gap-2 relative group/similar cursor-auto
222            ${_&&"cursor-pointer"}
223            ${n}
224          `,onClick:()=>{(e?.(),r)?s(!0):g({referenceId:d?.reference_id,shareId:d?.share_id,artifactCardId:d?.artifact_card_id,fileGeneratedId:d?.from_id})},children:(0,i.jsxs)("div",{className:"flex-1 flex  gap-2 group/similar",children:[(0,i.jsx)(e6.IconItem,{className:"i-cus--hix2-quote size-6 md:size-4 rtl:rotate-180"}),(0,i.jsx)("div",{className:ek.tw`
225                flex-1 line-clamp-1 text-sm text-f-text-secondary
226                ${c&&"line-through"}
227                ${!c&&_&&"group-hover/similar:underline"}
228                ${h}
229              `,children:d.name}),!m&&(0,i.jsx)(tk.default,{className:"group-hover/similar:flex hidden sm:flex",padding:"xs",rounded:"md",onClick:e=>{e.stopPropagation(),e.preventDefault(),u(null),s(!1),v("showcaseFilter",(0,i8.getDefaultShowcaseFilter)(C)),x((0,i0.getRouteWithoutReferenceQuery)(p,f),{replace:!0,chatType:C,agentMode:E}),t?.()},children:(0,i.jsx)(e6.IconItem,{className:ta.cls` i-cus--hix2-x size-5`})})]})})})})}var i7=e.i(26509),i9=e.i(22451),ae=e.i(451155),at=e.i(933348);let ai=(0,y.memo)(function(e){let{items:t,activeMarkId:a,className:n,showModePrefix:r=!0,isLoading:l=!1,onSelect:o,onRemove:s}=e;return(0,i.jsx)("div",{className:ek.tw`min-w-0 max-w-full ${n}
229`,children:(0,i.jsx)(iI.default,{className:"min-w-0 w-full select-none relative",children:(0,i.jsxs)("div",{className:"flex items-center gap-x-3 pe-1",children:[t.map(e=>{let t=a===e.markId,n="point-comment"===e.target.selectionKind,d=r&&!n,u="";return d&&"ai-edit"===e.markMode?u=eB.i18n._({id:"DLqjHP"}):d&&"edit-text"===e.markMode&&(u=eB.i18n._({id:"t0ndPY"})),(0,i.jsxs)("div",{className:ta.cls`
230                  group relative min-w-0 w-fit max-w-[220px] shrink-0 rounded-[12px]
231                  ${!t&&o?"hover:bg-f-bg-layout":""}
232                `,children:[(0,i.jsxs)("button",{type:"button",className:ta.cls`
233                    flex w-full min-w-0 max-w-full items-center gap-2 rounded-[12px] bg-[#F2F2F4] px-2 py-2 text-left
234                    ${o?"":"cursor-default"}
235                  `,onClick:()=>{o?.(e)},children:[(0,i.jsx)(at.ReferenceMarkerBadge,{value:e.markNumber}),(0,i.jsxs)("span",{className:"min-w-0 flex-1 truncate text-sm font-normal leading-5 text-[rgba(0,0,0,0.85)] [font-feature-settings:'liga'_off,'clig'_off]",children:[u&&(0,i.jsxs)("span",{className:"text-[rgba(0,0,0,0.85)]",children:[u," "]}),e.markLabel||eB.i18n._({id:"zhukSX"})]})]}),!l&&s&&(0,i.jsx)("button",{type:"button",className:"absolute -right-1 -top-1 inline-flex size-4 items-center justify-center rounded-full bg-[#0A0C11] text-white shadow-effects-s transition-colors hover:bg-[rgba(10,12,17,0.85)]",onPointerDown:e=>{e.stopPropagation()},onClick:t=>{t.stopPropagation(),s(e)},children:(0,i.jsx)(e6.IconItem,{className:"i-com--x size-3"})})]},e.markId)}),(0,i.jsx)("div",{"aria-hidden":"true",className:"h-px w-10 shrink-0"})]})})})});function aa(e){return[...e].sort((e,t)=>e.markNumber-t.markNumber).map((e,t)=>({...e,markNumber:t+1}))}function an({onClose:e,className:t,mode:n="auto"}){let{pptAiEditTarget:r,pptAiEditMarkedTargets:l,setPptAiEditTarget:o,setPptAiEditMarkedTargets:s,clearPptAiEditReferences:d,clearPptAiEditState:u}=(0,i7.useFormPptAiEditTarget)(),c=(0,I.useChatContainerContext)(e=>e.chatId??null),m=(0,b.useHixChatLoadingState)();(0,y.useEffect)(()=>{if(!(r||l?.length))return;let e="string"==typeof c?c.trim():"",t=["string"==typeof r?.sessionId?r.sessionId.trim():"",...(l??[]).map(e=>"string"==typeof e.target.sessionId?e.target.sessionId.trim():"")].filter(Boolean);e&&t.length>0&&t.some(t=>t!==e)&&u()},[c,u,l,r]);let p=(0,y.useMemo)(()=>r?(0,ae.resolveTargetName)(r):"",[r]);(0,h.useListenEvents)(i9.chatEventBus,{pptNanoMarkSaved:t=>{let i=function(e){let t="string"==typeof e.markId?e.markId.trim():"";if(!t)return null;let i="string"==typeof e.markLabel&&e.markLabel.trim().length>0?e.markLabel.trim():eB.i18n._({id:"zhukSX"}),a="ai-edit"===e.markMode?"ai-edit":"edit-text",n="string"==typeof e.markPrompt?e.markPrompt:void 0;return{markId:t,markNumber:Number.isFinite(e.markNumber)&&e.markNumber>0?Math.floor(e.markNumber):1,markLabel:i,markMode:a,...n?{markPrompt:n}:{},target:{slideId:e.slideId,order:e.order,deckId:e.deckId,fileGeneratedId:e.fileGeneratedId,sessionId:e.sessionId,artifactId:e.artifactId,canvasNodeId:e.canvasNodeId,selectionKind:e.selectionKind,contractVersion:e.contractVersion,selectionRef:e.selectionRef,tagName:e.tagName,hasSelectedImage:e.hasSelectedImage,currentSrc:e.currentSrc,elementId:e.elementId,elementType:e.elementType,html:e.html,previewStatus:e.previewStatus,thumbnailDataUrl:e.thumbnailDataUrl,boundingBox:e.boundingBox,xRatio:e.xRatio,yRatio:e.yRatio,clientX:e.clientX,clientY:e.clientY,contentWidth:e.contentWidth,contentHeight:e.contentHeight}}}(t);if(!i)return;let a=l??[];s(aa(a.some(e=>e.markId===i.markId)?a.map(e=>e.markId===i.markId?i:e):[...a,i])),o(i.target),e?.()},pptNanoDraftSelectionClosed:({slideId:e,blockId:t,selectionKind:i})=>{if(!r||i&&r.selectionKind!==i||null!=e&&String(r.slideId)!==String(e)||t&&r.elementId!==t)return;let a=l?.length?aa(l):void 0;s(a),o(a?.[0]?.target??null)},closeCanvasPreview:u,closeFilePreview:u});let f=(0,ae.isPptAiNanoTarget)(r),g=(0,y.useMemo)(()=>!!r&&(0,ae.isNanoSelectionRef)(r.selectionRef),[r]),x=(0,y.useMemo)(()=>{if(l?.length)return aa(l);if(r&&g){let e="string"==typeof r.selectionRef?r.selectionRef.trim():"";return[{markId:((0,ae.extractNanoMarkId)(r.selectionRef)??e)||"nano-mark-fallback",markNumber:1,markLabel:p||eB.i18n._({id:"zhukSX"}),markMode:"edit-text",target:r}]}return[]},[g,l,r,p]),C=x.length>0,E=(0,y.useMemo)(()=>{let e=(0,ae.extractNanoMarkId)(r?.selectionRef);return e||(x[0]?.markId??null)},[x,r?.selectionRef]),v=C&&"normal"!==n,_=!!r&&!f&&"nano"!==n;return v||_?v?(0,i.jsx)(a.Form.Item,{name:"pptAiEditTarget",noStyle:!0,children:(0,i.jsx)(ai,{items:x,activeMarkId:E,className:t,isLoading:m,onSelect:t=>{if(E!==t.markId&&o(t.target),t.target.canvasNodeId){i9.chatEventBus.emit("mediaCanvasAiEditMarkLocateRequested",{markId:t.markId,nodeId:t.target.canvasNodeId}),e?.();return}i9.chatEventBus.emit("pptNanoMarkLocateRequested",{markId:t.markId,slideId:t.target.slideId,canvasNodeId:t.target.canvasNodeId,order:t.target.order,selectionRef:t.target.selectionRef,xRatio:t.target.xRatio,yRatio:t.target.yRatio,boundingBox:t.target.boundingBox}),e?.()},onRemove:t=>{var i;let a;i=t.markId,i9.chatEventBus.emit("pptNanoEditorFocusChanged",{}),0===(a=aa(x.filter(e=>e.markId!==i))).length?d():(s(a),E===i&&o(a[0].target)),i9.chatEventBus.emit("pptNanoMark
235Removed",{markId:i}),e?.()}})}):(0,i.jsx)(a.Form.Item,{name:"pptAiEditTarget",noStyle:!0,children:(0,i.jsx)(ae.PptAiTargetPreviewCard,{target:r,className:t,title:eB.i18n._({id:"f3OllL"}),dismissible:!m,onClear:()=>{r&&i9.chatEventBus.emit("pptAiEditTargetClearRequested",r),d(),e?.()}})}):null}function ar({onFocus:e}){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(i3,{onClose:e}),(0,i.jsx)(iZ,{}),(0,i.jsx)(an,{onClose:e,mode:"nano"})]})}function al({onBeforeSubmit:e,className:t,boxContainerClassName:n,boxClassName:r,initialValues:l,slateEditorProps:o,editorAutoFocus:s,onBeforeFetch:d,formHeaderTopSlot:u,formHeaderBottomSlot:c,formHeaderWrapperClassName:m,isChatListLoading:p,form:f,renderFormContent:h,editorKey:g,contentId:x,enableDefaultValues:V=!0,enableSceneInput:D=!0,showSceneInputFooter:O=!0}){let[P]=a.Form.useForm(f),[z,U]=(0,y.useState)(!1),{chatInputValue:G,chatType:H,bot:B}=(0,T.useChatInput)(),W=(0,I.useChatContainerContext)(e=>e.containerType),$=(0,_.useChatAguiSceneInputContribution)(H,W),q=D?$:void 0,K=q?.footer?.Component,X=(0,b.useHixChatLoadingState)(),Y=(0,k.useChatStore)(e=>e.fileListMap.chat),Q=(0,k.useChatStore)(e=>e.isFormDisabled),J=Y?.length??0,{saveFormValue:Z}=(0,N.useFormValueManager)();(0,M.useWriterSlidesDefaultValues)(P,{enabled:V}),(0,S.useThinkingDefaultValue)(P,{enabled:V});let ee=H===C.EChatInputType.AI_CHAT||W===C.EChatContainerType.BOT_ENTRY?B?.promptWordLength:F.DEFAULT_PROMPT_WORD_LENGTH,et=v.hixChatUploadFileMaxCount,ei=(0,E.useComputed)(()=>J>=et||X),{formValidate:ea,isFormValidatePass:en,maxLength:er}=(0,F.useFormValidate)({promptWordLength:ee,form:P,mediaTypeDisableSendButton:!1,enablePptAiEditValidate:!0}),{onFormFinish:el,handleInputValueChange:eo,legacyAgentConfirmModal:es,isEditorInteractionLocked:ed,multiModelPaywallGuide:eu}=(0,A.default)({form:P,onBeforeSubmit:e,onSaveFormValue:Z,onBeforeFetch:d}),{formEditorProps:ec,slateEditorRef:em,focus:ep}=(0,w.default)({slateEditorProps:o,editorAutoFocus:s,disableUploadState:ei,disableEditorInteraction:ed,maxLength:er,form:P,editorKey:g,onEditorFocusChange:U});return(0,j.useHumanizeDocumentRequest)({form:P,isFormDisabled:Q,onFormFinish:el}),(0,i.jsx)(R.default,{form:P,isChatListLoading:p,isFormDisabled:Q,onFormFinish:el,handleInputValueChange:eo,chatInputValue:G,initialValues:l,className:t,boxContainerClassName:n,boxClassName:r,formHeaderTopSlot:u,formHeaderBottomSlot:c,formHeaderWrapperClassName:m,customValuesValidate:ea,slateEditorProps:ec,slateEditorRef:em,boxHeader:(0,i.jsx)(ar,{onFocus:ep}),boxFooter:(0,i.jsx)(iY,{className:"h-auto",disableUpload:ei,disabledSend:!en||Q,editorKey:g,isEditorFocused:z,sceneInputContribution:q}),formFooter:K&&O?(0,i.jsx)(L.default,{Component:K,form:P,disableUpload:ei}):void 0,renderFormContent:h,contentId:x,legacyAgentConfirmModal:es,multiModelPaywallGuide:eu})}function ao({isEditorFocused:e=!1,...t}){return(0,i.jsx)(iX,{...t,children:a=>(0,i.jsx)(V.default,{form:a,editorKey:t.editorKey,isEditorFocused:e})})}function as(){return(0,i.jsx)(iZ,{})}function ad({onBeforeSubmit:e,className:t,boxContainerClassName:n,boxClassName:r,initialValues:l,slateEditorProps:o,editorAutoFocus:s,onBeforeFetch:d,formHeaderTopSlot:u,formHeaderBottomSlot:c,formHeaderWrapperClassName:m,isChatListLoading:p,form:f,renderFormContent:h,editorKey:g,contentId:x}){let[I]=a.Form.useForm(f),[C,_]=(0,y.useState)(!1),{chatInputValue:M,bot:S}=(0,T.useChatInput)(),L=(0,b.useHixChatLoadingState)(),V=(0,k.useChatStore)(e=>e.fileListMap.chat),D=(0,k.useChatStore)(e=>e.isFormDisabled),O=v.hixChatUploadFileMaxCount,P=V?.length??0,{saveFormValue:z}=(0,N.useFormValueManager)(),U=S?.promptWordLength??F.DEFAULT_PROMPT_WORD_LENGTH,G=(0,E.useComputed)(()=>P>=O||L),{formValidate:H,isFormValidatePass:B,maxLength:W}=(0,F.useFormValidate)({promptWordLength:U,form:I,mediaTypeDisableSendButton:!1,enablePptAiEditValidate:!0}),{onFormFinish:$,handleInputValueChange:q,legacyAgentConfirmModal:K,isEditorInteractionLocked:X,multiModelPaywallGuide:Y}=(0,A.default)({form:I,onBeforeSubmit:e,onSaveFormValue:z,onBeforeFetch:d}),{formEditorProps:Q,slateEditorRef:J}=(0,w.default)({slateEditorProps:o,editorAutoFocus:s,disableUploadState:G,disableEditorInteraction:X,maxLength:W,form:I,editorKey:g,onEditorFocusChange:_});return(0,j.useHumanizeDocumentRequest)({form:I,isFormDisabled:D,onFormFinish:$}),(0,i.jsx)(R.default,{form:I,isChatListLoading:p,isFormDisabled:D,onFormFinish:$,handleInputValueChange:q,chatInputValue:M,initialValues:l,className:t,boxContainerClassName:n,boxClassName:r,formHeaderTopSlot:u,formHeaderBottomSlot:c,formHeaderWrapperClassName:m,customValuesValidate:H,slateEditorProps:Q,slateEditorRef:J,boxHeader:(0,i.jsx)(as,{}),boxFooter:(0,i.jsx)(ao,{className:"h-auto",disableUpload:G,disabledSend:!B||D,editorKey:g,isEditorFocused:C}),renderFormContent:h,contentId:x,legacyAgentConfirmModal:K,multiModelPaywallGuide:Y})}e.s(["default",0,an],551754);var au=e.i(640689),ac=e.i(655112),am=e.i(630564);let ap=(0,ac.default)(()=>e.A(918935),{loadableGenerated:{modules:[641791]},ssr:!1});function af(e){let{className:t}=e,[a,n]=(0,y.useState)(!1),r=(0,y.useRef)(null),l=(0,I.useChatContainerContext)(e=>e.chatType),o=(0,p.useScreen)("md");return(0,am.useClickAway)(()=>{a&&n(!1)},r),(0,y.useEffect)(()=>{let e=e=>{r.current&&!r.current.contains(e.target)&&a&&n(!1)};return document.addEventListener("submit",e,!0),()=>{document.removeEventListener("submit",e,!0)}},[a]),(0,i.jsxs)("div",{className:"flex items-start",children:[(0,i.jsx)(tk.default,{type:"button",className:ek.tw`flex items-center size-7 p-0 gap-1 ${t} `,onClick:e=>{e.stopPropagation(),e.preventDefault(),n(!a)},children:(0,i.jsx)(e6.IconItem,{className:ta.cls`${!a?"i-cus--hix2-enlarge-2":"i-cus--hix2-reduce-2"} size-4`})}),(0,i.jsx)("div",{className:ta.cls`
236          w-full p-3  overflow-hidden bg-white border border-f-border rounded-[20px]
237          absolute left-0 transition-all duration-300
238          ${a?"opacity-100 z-[3] bottom-[calc(100%+12px)] max-h-[1000px]":"bottom-[
238100%] max-h-[1px] opacity-0 z-[-1]"}
239        `,ref:r,style:{boxShadow:"0px 20px 38px 0px #1C273124"},children:l===C.EChatInputType.AI_IMAGE?(0,i.jsx)(ap,{columnWidth:o?110:150,className:"flex flex-col h-full",waterfallClassName:"h-[400px] md:h-[40vh] overflow-y-auto beautify-scroll w-full"},"image"):(0,i.jsx)(ap,{columnWidth:o?110:150,className:"flex flex-col h-full",waterfallClassName:"h-[400px] md:h-[40vh] overflow-y-auto beautify-scroll w-full"},"video")})]})}var ah=e.i(986721),ag=e.i(325528);let ax="by-model-page-local-form-values";var ay=e.i(841952),ay=ay,aI=e.i(2115),aC=e.i(462797),aE=e.i(50603),av=e.i(556303),a_=e.i(468988),ab=e.i(706073);let aT={numOutputs:4},aN=function(e,t,i={}){let{enabled:n=!0}=i,r=(0,I.useChatContainerContext)(e=>e.chatType),l=(0,I.useChatContainerContext)(e=>e.chatId),{setInputValue:o}=(0,T.useChatInput)(),s=(0,k.useChatStore)(e=>e.getSetFunction()),d=(0,k.useChatStore)(e=>e.formValueMap),u=(0,k.useChatStore)(e=>e.fileListMap.chat),c=!!a.Form.useWatch("inputValue",e),{modelName:m,variant:p}=(0,aE.useResolvedMediaFormValues)(e),f=a.Form.useWatch("templateInfo",e)||null,{isVariant:h,isIngredients:g}=(0,ir.useFormVariant)({chatType:r,modelName:m,variant:p}),E=(0,y.useRef)(p),{modelInfo:v}=(0,ab.useModelInfo)(m),_=function({chatType:e,templateInfo:t,isVariant:i,variant:a,modelInfo:n,fileList:r}){return{...(0,y.useMemo)(()=>{if(![C.EChatInputType.AI_IMAGE,C.EChatInputType.AI_VIDEO].includes(e)||e===C.EChatInputType.AI_IMAGE&&n?.modelName===t8.EVideoModel.IMAGE_AGENT)return{hasImageFrame:!1,assetsNum:1,isStartAndEnd:!1};if(t)return{hasImageFrame:!0,assetsNum:t?.assetsNum||1,isStartAndEnd:!1};if(i)return{hasImageFrame:!!a&&"text"!==a,assetsNum:"frames"===a?2:3,isStartAndEnd:"frames"===a};let l=n?.imageFormConfig;if(l&&(!n?.textFormConfig||r.length&&e===C.EChatInputType.AI_VIDEO)){let e=l.fields?.find(e=>"image"===e.key);return{hasImageFrame:!(e?.options?.maxNum>3),assetsNum:e?.options?.withImageTail?2:1,isStartAndEnd:!!e?.options?.withImageTail}}return{hasImageFrame:!1,assetsNum:1,isStartAndEnd:!1}},[e,t,i,a,n,r])}}({chatType:r,templateInfo:f,isVariant:h,variant:p,modelInfo:v,fileList:u}),b=function({chatType:e,modelInfo:t,fileList:i,templateInfo:a,variant:n}){let r=(0,ia.useIsOmniReferenceMode)(t?.modelName,n);return(0,y.useMemo)(()=>{let n=!r&&i.some(e=>(0,t4.isVideoFile)(e));return{disableUpload:(0,et.match)({chatType:e,modelName:t?.modelName,templateInfo:a}).with({templateInfo:et.P.nonNullable},({templateInfo:e})=>i.length>=(e.assetsNum||1)).with({chatType:et.P.union(C.EChatInputType.DEEP_RESEARCH,C.EChatInputType.AI_WRITER,C.EChatInputType.GENERIC)},()=>!1).with({chatType:C.EChatInputType.AI_IMAGE,modelName:t8.EVideoModel.IMAGE_AGENT},()=>!1).with({chatType:et.P.union(C.EChatInputType.AI_IMAGE,C.EChatInputType.AI_VIDEO)},()=>!t?.imageFormConfig||n).otherwise(()=>!1),isVideoUpload:n}},[e,t,i,a,r])}({chatType:r,modelInfo:v,fileList:u,templateInfo:f,variant:p}),S=function({chatType:e,fileList:t,templateInfo:i,isIngredients:a,hasInputValue:n,modelInfo:r,assetsNum:l,hasImageFrame:o,variant:s}){let d=(0,ia.useIsOmniReferenceMode)(r?.modelName,s);return(0,y.useMemo)(()=>{if(r?.modelName===t8.EVideoModel.IMAGE_AGENT)return!1;let u=t.filter(t4.isImageFile);if(d){let e=(0,av.isHixChatWanV3Point0Model)(r?.modelName);return!t.some(t=>(0,t4.isImageFile)(t)||(0,t4.isVideoFile)(t)||e&&(t.webPage||!(0,t4.isAudioFile)(t)&&!(0,t4.isImageFile)(t)&&!(0,t4.isVideoFile)(t)))||!n}if(t.some(e=>(0,t4.isVideoFile)(e)))return!1;if(i)return t.length<(i?.assetsNum||1);if(a)return!t.length||!n;let c=function({chatType:e,fileListLength:t,variant:i}){return e===C.EChatInputType.AI_IMAGE?t?"imageToImage":"textToImage":e!==C.EChatInputType.AI_VIDEO?null:"frames"===i?"firstAndLastFrameToVideo":"ingredients"===i?"imageToVideo":"text"!==i&&t?"singleFrameToVideo":"textToVideo"}({chatType:e,fileListLength:t.length,variant:s}),m=c&&r?.generationModeRules?.[c];if(m?.requireMedia&&!t.length||m?.requirePrompt&&!n)return!0;let p=t.length?r?.imageFormConfig:r?.textFormConfig||r?.imageFormConfig,f=p?.fields?.find(e=>"prompt"===e.key);if(f&&!m&&!0!==f.allowSubmitWithoutPrompt&&!n)return!0;let h=r?.imageFormConfig?.fields?.find(e=>"image"===e.key),g=(0,a_.isStartEndFrameMode)({files:u,variant:s,withImageTail:!!h?.options?.withImageTail});return!!(0,a_.isStartEndFrameImageOverflow)({imageCount:u.length,isStartEndFrame:g})||(g&&u.length?!u.some(e=>1===e.frame):!!(u.length<l)&&!!o)},[e,t,i,a,n,r,l,o,d,s])}({chatType:r,fileList:u,templateInfo:f,isIngredients:g,hasInputValue:c,modelInfo:v,assetsNum:t,hasImageFrame:_.hasImageFrame,variant:p}
239),{saveFormValue:A}=(0,N.useFormValueManager)();(0,M.useWriterSlidesDefaultValues)(e,{enabled:n,restoreWriterWithoutChatId:!1}),(0,y.useEffect)(()=>{e&&n&&(0,et.match)(r).with(C.EChatInputType.AI_IMAGE,()=>{l&&e.setFieldsValue({...aT,...d[C.EChatInputType.AI_IMAGE]})}).with(C.EChatInputType.AI_VIDEO,()=>{if(!l)return;let t=d[C.EChatInputType.AI_VIDEO],i=t?.modelName;i===t8.EVideoModel.VIDEO_AGENT&&(i=x.DEFAULT_VIDEO_MODEL_NAME),e.setFieldsValue({...aT,numOutputs:1,...t,modelName:i||x.DEFAULT_VIDEO_MODEL_NAME,variant:t?.variant||void 0})}).otherwise(()=>{})},[r,n,e,l,d]),(0,y.useEffect)(()=>{u.length>0&&v&&s(e=>{v?.imageFormConfig?e.fileListMap.chat=e.fileListMap.chat.slice(0,t):e.fileListMap.chat=[]})},[u.length,v,t,s]),(0,y.useEffect)(()=>{if(!h||!p||!E.current){E.current=p;return}E.current!==p&&(e.setFieldValue("inputValue",""),o("","chat"),s(e=>{e.fileListMap.chat=[]}),E.current=p)},[e,h,s,o,p]),(0,y.useEffect)(()=>{r===C.EChatInputType.AI_VIDEO&&m&&!h&&void 0!==p&&(e.setFieldValue("variant",void 0),E.current=void 0)},[r,e,h,m,p]);let w=v?.promptWordLength;return{..._,...b,mediaTypeDisableSendButton:S,promptWordLength:w,saveFormValue:A}};var aM=e.i(414343),aS=e.i(825228);function ak({disableUpload:e,showImageFrame:t,form:a,disabledSend:n,className:r,editorKey:l,isEditorFocused:o=!1}){let{chatType:s,footerActions:d}=(0,T.useChatInput)(),{modelName:u}=(0,aE.useResolvedMediaFormValues)(a),{isVariant:c}=(0,ir.useFormVariant)({chatType:s,modelName:u}),m=(0,y.useMemo)(()=>s===C.EChatInputType.AI_IMAGE?u===t8.EVideoModel.IMAGE_AGENT:s!==C.EChatInputType.AI_VIDEO||u===t8.EVideoModel.VIDEO_AGENT,[s,u]),p=(0,y.useMemo)(()=>s===C.EChatInputType.AI_IMAGE?u===t8.EVideoModel.IMAGE_AGENT?C.EChatInputType.GENERIC_IMAGE:void 0:s===C.EChatInputType.AI_VIDEO&&u===t8.EVideoModel.VIDEO_AGENT?C.EChatInputType.GENERIC_VIDEO:void 0,[s,u]),f=(0,y.useMemo)(()=>d.map(e=>"upload"===e.key?{...e,isHidden:t||c}:e),[d,t,c]);return(0,i.jsx)(iX,{actions:f,className:r,disableUpload:e,disabledSend:n,editorKey:l,children:e=>(0,i.jsx)(V.default,{form:e,editorKey:l,isEditorFocused:o,canShow:m,promptChatType:p})})}var aA=e.i(527562),aw=e.i(37654),aj=e.i(808852),aF=e.i(904296),aR=e.i(975061),aL=e.i(715699),aV=e.i(548822);class aD{constructor(){this.componentControls=new Set}subscribe(e){return this.componentControls.add(e),()=>this.componentControls.delete(e)}start(e,t){this.componentControls.forEach(i=>{i.start(e.nativeEvent||e,t)})}}let aO=()=>new aD;var aP=e.i(645217),az=e.i(271613),aU=e.i(460742);let aG=function(e,t){let i=(0,aU.useMotionValue)(e),a=(0,aU.useMotionValue)(0),n=(0,y.useRef)(!1);(0,y.useEffect)(()=>{i.set(e)},[e,i]);let{minWidth:r,maxWidth:l,onResize:o,startTime:s,endTime:d,trackLength:u,videoDuration:c}=t,m=(0,y.useCallback)((e,t)=>{n.current=!0;let s=t.delta.x,d=i.get(),u=a.get(),c=Math.round(Math.max(r,Math.min(l,d-s))),m=Math.round(u+(d-c));if(m<0){let e=u+d-(m=0),t=(0,az.clamp)(e,r,l);i.set(t)}else{let e=(0,az.clamp)(c,r,l);i.set(e)}a.set(m),o?.(m,c)},[r,l,a,i,o]),p=(0,y.useCallback)((e,t)=>{n.current=!0;let s=t.delta.x,d=i.get(),c=a.get(),m=Math.round(Math.min(l,Math.max(r,d+s)));c+m>u&&(m=u-c),m=(0,az.clamp)(m,r,l),i.set(m),o?.(c,m)},[l,r,i,o,a,u]);return(0,y.useEffect)(()=>{if(!n.current&&void 0!==s&&void 0!==d&&d>s){let t=(d-s)/c*u+10,n=s/c*u;a.set(n);let o=(0,az.clamp)(t,r,l);i.set(Math.min(o,e))}},[s,d,a,i,u,c,l,r,e]),{dragOffset:a,dragSliderWidth:i,handleLeftResize:m,handleRightResize:p,setIsDragging:(0,y.useCallback)(e=>{n.current=e},[])}},aH=e=>{let{videoDuration:t=0,audioDuration:a=0,maxClipDuration:n,minClipDuration:r=1,onRangeChange:o,sliderWayClassName:s,allowRightResize:d=!0,allowLeftResize:u=!0,allowEntiretyDrag:c=!0,renderWave:m,indicator:p,startTime:f,endTime:h,useValidRange:g}=e,{i18n:x,_:I}=(0,eh.useLingui)(),C=(0,y.useRef)(null),E=(0,aV.useConstant)(aO),v=(0,aL.useSize)(C),_=(0,y.useRef)(0),b=v?.width||0,T=n?Math.min(t,n):t,N=Math.min(T/a*b+10,b),M=Math.min(r/a*b+10,b),S=(e,t)=>{let i=t-10,l=e/b*a;_.current=l;let s=(e+i)/b*a,d=s-l;if(d<r&&(s=l+r,d=r,s>a)){_.current=(s=a)-r,o?.(s-r,s);return}n&&(1>Math.abs(i-n/a*b)||d>n)&&(s=l+n,d=n),g&&n&&d>T&&(s=l+T,d=T),s>a&&(d=(s=a)-l),o?.(l,s)},{dragOffset:k,dragSliderWidth:A,handleLeftResize:w,handleRightResize:j,setIsDragging:F}=aG(N,{minWidth:M,maxWidth:N,startTime:f,endTime:h,trackLength:b,videoDuration:t,onResize:(e,t)=>
239{S(e,t)}});return(0,i.jsxs)(l.motion.div,{ref:C,className:"relative size-full h-14 w-full",children:[m?m():(0,i.jsx)(aP.default,{fill:!0,priority:!0,src:"/images/tools/waveform.png",className:"select-none object-cover",alt:x._({id:"r0l6cX"})}),p,(0,i.jsx)(l.motion.div,{dragMomentum:!1,dragConstraints:C,style:{x:k,width:A,touchAction:"none"},drag:c,onDragStart:()=>{F(!0)},onDrag:()=>{let e=k.get(),t=Math.max(M,A.get());S(Math.min(b-t,Math.max(0,e)),t)},onDragEnd:()=>{F(!1)},dragElastic:0,dragListener:!1,dragControls:E,className:ta.cls`absolute inset-y-0 z-[2] rounded-md ${s}`,children:(0,i.jsxs)("div",{className:"border-f-primary relative size-full rounded-md border bg-transparent",children:[(0,i.jsx)(l.motion.span,{onPointerDown:e=>{u&&e.currentTarget.setPointerCapture(e.pointerId)},onPointerUp:e=>{if(u){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}F(!1)}},onPointerCancel:e=>{if(u){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}F(!1)}},onPanStart:()=>{u&&F(!0)},onPan:(e,t)=>{u&&w(e,t)},onPanEnd:()=>{u&&F(!1)},style:{touchAction:"none"},className:ta.cls`
240              bg-f-primary absolute inset-y-0 start-0 z-[3]
241              flex w-1.5 items-center justify-center
242              rounded-s-md hover:cursor-w-resize
243            `,children:u&&(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 4 12",className:"h-3 w-1",children:(0,i.jsx)("path",{stroke:"#fff",d:"M1 0v12M3 0v12"})})}),(0,i.jsx)(l.motion.div,{onPanStart:e=>{E.start(e)},className:ta.cls`
244              text-f-text-secondary
245              flex size-full cursor-pointer items-center
246              justify-start rounded-md bg-[#2FEBBF]
247              bg-opacity-[6%] ps-2 text-xs
248            `}),(0,i.jsx)(l.motion.span,{onPointerDown:e=>{d&&e.currentTarget.setPointerCapture(e.pointerId)},onPointerUp:e=>{if(d){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}F(!1)}},onPointerCancel:e=>{if(d){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}F(!1)}},onPanStart:()=>{d&&F(!0)},onPan:(e,t)=>{d&&j(e,t)},onPanEnd:()=>{d&&F(!1)},style:{touchAction:"none"},className:ta.cls`
249              bg-f-primary absolute inset-y-0 end-0 z-[3]
250              flex w-1.5 items-center justify-center
251              rounded-e-md hover:cursor-e-resize
252            `,children:d&&(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 4 12",className:"h-3 w-1",children:(0,i.jsx)("path",{stroke:"#fff",d:"M1 0v12M3 0v12"})})})]})})]})},aB=function(e){let{children:t,extra:a,className:n,playing:r,contentClassName:l,onClick:o,showBottomInfo:s=!0,renderBottomInfo:d,fileName:u,audioCurrentTime:c,rangeStart:m=0}=e,p=r&&"number"==typeof c&&m>=0?Math.max(0,c-m):void 0;return(0,i.jsxs)("div",{className:ek.tw`user-select-none flex w-full flex-col ${n}`,children:[d?d({fileName:u,playedTime:p}):s&&(0,i.jsxs)("div",{className:"text-f-text-quaternary mb-1 justify-between flex w-full select-none items-center gap-2 text-xs",children:[(0,i.jsx)("span",{className:"block truncate",children:u||"--"}),void 0!==p&&p>0&&(0,i.jsxs)("span",{className:"shrink-0",children:[(0,aF.formatMediaTime)(p,{pad:!1}),"s"]})]}),(0,i.jsxs)("div",{className:ek.tw`bg-f-bg-base flex h-14 w-full min-w-0 items-center overflow-hidden rounded-md`,children:[(0,i.jsx)("div",{onClick:e=>{e.stopPropagation(),o?.(e)},className:ta.cls`flex h-full w-10 shrink-0 cursor-pointer items-center justify-center rounded-s-md`,children:(0,i.jsx)(e6.IconItem,{className:ta.cls`${r?"i-cus--hix2-pause":"i-cus--hix2-play"} size-4 text-f-text`})}),(0,i.jsx)("div",{className:ek.tw`min-w-0 flex-1 ${l}`,children:t}),a]})]})},aW=t=>{let{onCancel:a,open:n,onClose:r,onClipSuccess:l,maxClipDuration:o,minClipDuration:s=1,tipTitle:d,showTimeInfo:m=!1,confirmButtonText:p,...f}=t,{i18n:h,_:g}=(0,eh.useLingui)(),x=n.value,I="data"in n?n.data:void 0,{mutateAsync:C,isLoading:E}=io.api.aiVideo.cropAudio.useMutation({onError:()=>{eW.message.error(h._({id:"RG40Ne"}))}}),v=function(t){var i;let a,{src:n,volume:r=1,loop:l=!1,onLoad:o}=t,s=(0,y.useRef)(),d=(0,y.useRef)(),m=(0,y.useRef)(),[p,f]=(0,y.useState)(null),[h,g]=(0,y.useState)(null),[x,I]=(0,y.useState)(),[C,E]=(0,y.useState)(!1),[v,_]=(0,y.useState)(!1),b=(0,u.useLatest)(o),T=(0,c.useMemoizedFn)(e=>{if(!s.current)return;E(!0);let t=new s.current({...e,html5:!0});t.on("load",()=>{f(t.duration()),E(!1),b.current?.(t)}),t.on("loaderror",(t,i)=>{aw.logger.error(`Load audio [${e.src}] error`,i),I(i),E(!1)});let i=()=>{g(t.seek());let e=t.playing();e&&(_(e),requestAnimationFrame(i))};t.on("play",i),t.on("pause",()=>{_(!1)}),t.on("end",()=>{g(null),_(!1)}),t.on("stop",()=>{g(null),_(!1)}),d.current=t});a=(0,y.useRef)(),i=()=>{e.A(283841).then(e=>{a.current=e.default.Howl,(e=>{s.current=e,n&&T({src:n,volume:r,loop:l})})(e.default.Howl)})},(0,y.useEffect)(()=>{"complete"===document.readyState?setTimeout(()=>{(0,aj.createIC)(i,void 0)}
252,0):window.addEventListener("load",()=>{(0,aj.createIC)(i,void 0)})},[]),(0,y.useEffect)(()=>{if(n)return T({src:n,volume:r,loop:l}),()=>{d.current?.unload()}},[JSON.stringify(n)]),(0,y.useEffect)(()=>{d.current&&d.current.volume(r)},[r]),(0,y.useEffect)(()=>{d.current&&d.current.loop(l)},[l]);let N=(0,c.useMemoizedFn)(()=>{d.current&&(d.current.playing()?d.current.pause():d.current.play())}),M=(0,c.useMemoizedFn)((e=0)=>{d.current&&(d.current.seek(e),d.current.play())}),S=(0,c.useMemoizedFn)((e=0)=>{d.current&&(d.current.playing()?d.current.pause():M(e))}),k=(0,c.useMemoizedFn)(()=>{setTimeout(()=>{d.current?.play(),d.current?.playing||k()})}),A=(0,c.useMemoizedFn)((e,t)=>{if(!d.current)return;m.current&&(d.current.off("play",m.current),m.current=void 0),d.current.stop();let i=d.current.duration();M(i>0?Math.min(e,i-.01):e);let a=()=>{d.current&&(d.current.seek()>=t?(d.current?.pause(),d.current?.off("play",a),m.current=void 0):requestAnimationFrame(a))};m.current=a,d.current.on("play",a)}),w=(0,c.useMemoizedFn)((e,t)=>{d.current&&(d.current.playing()?d.current.pause():A(e,t))});return{howlRef:d,duration:p,currentTime:h,error:x,loading:C,playing:v,togglePlay:N,playFrom:M,togglePlayFrom:S,playIt:k,playDuration:A,togglePlayDuration:w}}({src:I?.audioSrc||""}),[_,b]=(0,y.useState)({start:0,end:0}),T=e=>{let t=Math.floor(e/3600),i=Math.floor(e%3600/60),a=Math.floor(e%60),n=Math.floor(e%1*1e3);return`${t.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}:${a}.${n.toString().padStart(3,"0")}`},N=async()=>{let e=I?.audioUrl||I?.audioSrc,t=_.start,i=_.end,a=I?.fileName;if(!e||!(0,aA.isNumber)(t)||!(0,aA.isNumber)(i))return;let n=await C({audioUrl:e,start:T(t),end:T(i)});n.cropAudioUrl?l?.(n.cropAudioUrl,t,i,a||""):eW.message.error(h._({id:"RG40Ne"})),r?.()},M=(0,c.useMemoizedFn)(()=>{if(!I?.audioDuration||!I?.videoDuration)return;let e=o?Math.min(I.videoDuration,o):I.videoDuration;if((0,aA.isNumber)(I.initialStartTime)&&(0,aA.isNumber)(I.initialEndTime)&&I.initialStartTime>=0&&I.initialEndTime<=I.audioDuration&&I.initialEndTime>I.initialStartTime){let t=Math.max(0,I.initialStartTime),i=Math.min(I.audioDuration,I.initialEndTime),a=i-t;a>e?i=t+e:a<s&&(i=Math.min(t+s,I.audioDuration)),b({start:t,end:i})}else b({start:0,end:Math.min(I.audioDuration,e)})});(0,y.useEffect)(()=>{I?.audioDuration&&I?.videoDuration&&M()},[I?.audioDuration,I?.videoDuration,I?.initialStartTime,I?.initialEndTime,M]);let{run:S,cancel:k}=(0,ah.useDebounceFn)((e,t)=>{(0,aA.isNumber)(e)&&(0,aA.isNumber)(t)&&v.playDuration(e,t)},{wait:500}),A=(0,c.useMemoizedFn)((e,t)=>{let i=v.playing||v.howlRef.current?.playing();b({start:e,end:t}),i&&(0,aA.isNumber)(e)&&(0,aA.isNumber)(t)&&(k(),v.howlRef.current?.pause(),S(e,t))});return(0,i.jsxs)(aR.default,{...f,open:x,width:520,onCancel:a,footer:null,maskClosable:!1,destroyOnClose:!0,centered:!0,wrapClassName:"[&_.coco-modal-content]:!bg-f-bg-base [&_.coco-modal-content]:p-5",children:[(0,i.jsx)("p",{className:"text-f-text-secondary text-sm font-semibold md:text-base",children:d||(0,i.jsx)(eh.Trans,{id:"FKwZob"})}),(0,i.jsx)("div",{className:ta.cls`bg-f-bg-container mt-[10px] rounded-lg p-3`,children:(0,i.jsx)(aB,{playing:v.playing,onClick:()=>{let{start:e,end:t}=_;(0,aA.isNumber)(e)&&(0,aA.isNumber)(t)&&v.togglePlayDuration(e,t)},fileName:I?.fileName,audioCurrentTime:v.currentTime,rangeStart:_.start,children:(0,i.jsx)(aH,{videoDuration:I?.videoDuration,audioDuration:I?.audioDuration,maxClipDuration:o,minClipDuration:s,startTime:_.start,endTime:_.end,onRangeChange:A})})}),m&&(0,i.jsxs)("div",{className:ta.cls`text-f-text-tertiary text-sm mt-[10px] flex select-none items-center justify-between text-xs`,children:[(0,i.jsxs)("span",{children:[(0,aF.formatTimeToMMSS)(_.start)," -"," ",(0,aF.formatTimeToMMSS)(_.end)]}),(0,i.jsxs)("span",{children:[(0,i.jsx)(eh.Trans,{id:"lkz6PL"}),":"," ",(0,aF.formatTimeToMMSS)(_.end-_.start)]})]}),(0,i.jsxs)("div",{className:"flex justify-end gap-3 mt-4",children:[(0,i.jsx)(tk.default,{onClick:e=>{a?.(e)},className:ta.cls`py-2 px-4 text-xs font-medium`,color:"modalCancel",children:h._({id:"dEgA5A"})}),(0,i.jsx)(tk.default,{loading:E,onClick:()=>{N()},className:ta.cls`py-2 px-4 text-xs font-medium`,color:"modalConfirm",children:(0,i.jsx)("span",{children:p||(0,i.jsx)(eh.Trans,{id:"7VpPHA"})})})]})]})};var a$=e.i(870844),aq=e.i(714261),aK=e.i(541170),aX=e.i(190081),aY=e.i(964534),aQ=e.i(367409),aJ=e.i(88758);function aZ({file:e,mediaType:t}){return t===aq.EMediaUploadType.RESOURCE?(0,i.jsx)(aQ.default,{file:e}):"success"===e.uploadStatus&&e.url?t===aq.EMediaUploadType.IMAGE?(0,i.jsx)(aX.Image,{src:e.url,alt:e.name,className:"!w-full !h-full object-cover rounded-[12px]",preview:!0}):t===aq.EMediaUploadType.VIDEO?(0,i.jsx)(aY.default,{className:"size-full z-1 rounded-[12px]",url:e.url,showDuration:!0,videoProps:{muted:!0,autoPlay:!0,preload:"auto"}}):(0,i.jsx)(aJ.default,{className:"w-[120px] rounded-[12px]",file:e}):(0,i.jsx)("div",{className:"size-full flex items-center justify-center bg-f-bg-container-secondary",children:(0,i.jsx)(e6.IconItem,{className:"i-cus--hix2-loading animate-spin size-5 text-f-text-quaternary"})})}function a0({file:e,mediaItem:t,onDeleteFile:a}){let n=t.type===aq.EMediaUploadType.RESOURCE||!e.isUploading&&!!e.type?.toLowerCase().includes("audio")&&"success"===e.uploadStatus;return(0,i.jsxs)("div",{className:ek.tw`
253        shrink-0 rounded-xl
254        relative group/file-item
255        [&_.coco-image-mask]:hidden [&_.ant-image-mask]:hidden
256        [&_.coco-image]:!size-full ${n?"":"bg-f-bg-elevated size-[48px]"}
257      `,children:[(0,i.jsx)(aZ,{file:e,mediaType:t.type}),(0,i.jsx)(aK.default,{className:ta.cls`
258          hidden group-hover/file-item:flex
259          ${t.type===aq.EMediaUploadType.RESOURCE?"-right-[7px] -top-[7px]":"-right-1 -top-1"}
260        `,onClick:()=>{a?.(e)}})]})}var a1=e.i(586885);function a2({loading:e,mediaItem:t,onUpload:a}){return(0,i.jsx)(en.default,{title:function(e){switch(e){case aq.EMediaUploadType.IMAGE:return eB.i18n._({id:"6MxxvO"});case aq.EMediaUploadType.VIDEO:return eB.i18n._({id:"o_gPVf"});case aq.EMediaUploadType.AUDIO:return eB.i18n._({id:"nBdqGI"});case aq.EMediaUploadType.RESOURCE:return eB.i18n._({id:"tEfJ-L"})}}(t.type),children:(0,i.jsxs)("div",{className:ek.tw`
261          size-[48px] shrink-0 rounded-xl border border-f-border bg-white relative cursor-pointer hover:bg-f-bg-hover
262          flex flex-col items-center justify-center text-f-text-tertiary
263        `,children:[(0,i.jsx)(e6.IconItem,{className:ta.cls`${e?"i-cus--hix2-loading animate-spin":t.icon} size-4`}),e?null:(0,i.jsx)(a1.ChatUpload,{accept:t.accept,className:"size-full",multiple:!1,uploadClassName:"absolute left-0 top-0 size-full opacity-0 [&_.coco-upload]:size-full",onSuccess:({fileList:e})=>{a(e,t)}})]})})}let a8=y.default.memo(function(e){let{mediaItem:t,currentFiles:a,onDeleteFile:n,onUpload:r,loading:l,totalCount:o,maxTotalCount:s,renderUploadTrigger:d}=e,u=a.length<t.maxCount&&o<s;return(0,i.jsxs)(i.Fragment,{children:[a.map(e=>(0,i.jsx)(a0,{file:e,mediaItem:t,onDeleteFile:n}
263,e.uid)),u&&d?d():u?(0,i.jsx)(a2,{loading:l,mediaItem:t,onUpload:r}):null]})}),a5=ek.tw`
264  flex h-9 w-full items-center gap-2 rounded-xl p-2 text-sm font-normal leading-5
265`;function a4({config:e,onAddUrl:t,onUpload:a}){let[n,r]=(0,y.useState)(!1),[l,o]=(0,y.useState)(!1),s=(0,i.jsxs)("div",{className:"group/resource-list flex w-[184px] flex-col gap-0.5",children:[(0,i.jsx)("p",{className:"text-xs text-f-text-tertiary mb-0.5",children:"Add file/url"}),(0,i.jsx)(a1.ChatUpload,{accept:e.accept,multiple:!1,uploadClassName:ek.tw`
266          !block !w-full
267          [&_.ant-upload]:!block [&_.ant-upload]:!w-full [&_.ant-upload>div]:!w-full
268          [&_.coco-upload]:!block [&_.coco-upload]:!w-full [&_.coco-upload>div]:!w-full
269        `,onSuccess:({fileList:e})=>{o(!1),r(!1),a(e)},children:(0,i.jsxs)("button",{type:"button",className:ek.tw`
270            ${a5} bg-f-bg-layout text-f-text
271            group-hover/resource-list:bg-transparent hover:!bg-f-bg-layout
272          `,children:[(0,i.jsx)(e6.IconItem,{className:"i-cus--hix2-upload-local size-5 shrink-0"}),(0,i.jsx)("span",{children:eB.i18n._({id:"2IXDgU"})})]})}),(0,i.jsxs)("button",{type:"button",className:ek.tw`
273          ${a5} text-f-text-secondary hover:bg-f-bg-layout
274        `,onClick:()=>{o(!1),r(!1),t()},children:[(0,i.jsx)(e6.IconItem,{className:"i-cus--hix2-link size-5 shrink-0"}),(0,i.jsx)("span",{children:eB.i18n._({id:"dn-x7E"})})]})]});return(0,i.jsx)(en.default,{title:eB.i18n._({id:"tEfJ-L"}),tooltipProps:{open:l&&!n,onOpenChange:e=>{o(e&&!n)}},children:(0,i.jsx)(tx.default,{content:s,placement:"bottomLeft",trigger:"click",open:n,onOpenChange:r,rootClassName:ek.tw`
275          [&_.ant-popover-inner]:!rounded-[18px] [&_.ant-popover-inner]:!p-0
276          [&_.coco-popover-inner]:!rounded-[18px] [&_.coco-popover-inner]:!p-0
277        `,children:(0,i.jsx)("button",{type:"button","aria-label":eB.i18n._({id:"tEfJ-L"}),onClick:()=>{o(!1)},className:ek.tw`
278            flex size-12 shrink-0 items-center justify-center rounded-xl border border-f-border bg-white
279            text-f-text-tertiary hover:bg-f-bg-hover
280          `,children:(0,i.jsx)(e6.IconItem,{className:"i-cus--hix2-hyperlink-add size-[18px]"})})})})}var a6=e.i(139636);let a3={retry:!1,trpc:{context:{errorMessage:!1}}},a7=(0,y.memo)(function({onAddReferenceWebPage:e,onClose:t}){let[a,n]=(0,y.useState)(""),[r,l]=(0,y.useState)(""),{addReferenceWebPage:o,isLoading:s}=function(e){let t=io.api.useUtils(),i=(0,y.useRef)(!1),[a,n]=(0,y.useState)(!1);return{addReferenceWebPage:(0,c.useMemoizedFn)(async a=>{let r;if(i.current)return"pending";try{if(r=new URL(a.trim()),!["http:","https:"].includes(r.protocol))return"invalid-url"}catch{return"invalid-url"}i.current=!0,n(!0);try{let i=r.toString(),a=await t.aiVideo.getReferenceWebPageMetadata.fetch({url:i},a3),n=a.title||r.hostname;return e({url:i,title:n,description:a.description,favicon:a.favicon})?"success":"limit-reached"}catch(t){let e;return(e=t instanceof Error?t.message.toLowerCase():"").includes("page is too large")?"page-too-large":e.includes("timeout")||e.includes("timed out")?"request-timeout":e.includes("does not point to an html page")?"unsupported-page":"parse-failed"}finally{i.current=!1,n(!1)}}),isLoading:a}}(e),d=()=>{s||t()},u=async()=>{let e=await o(a);"success"===e?t():"invalid-url"===e?l(eB.i18n._({id:"XCGO0R"})):"page-too-large"===e?l(eB.i18n._({id:"CifTfb"})):"request-timeout"===e?l(eB.i18n._({id:"FIqszW"})):"unsupported-page"===e?l(eB.i18n._({id:"iV3ZH8"})):"parse-failed"===e?l(eB.i18n._({id:"7i-5jQ"})):"limit-reached"===e&&l(eB.i18n._({id:"zvGvxn"}))};return(0,i.jsxs)(eI.default,{open:!0,title:eB.i18n._({id:"dn-x7E"}),width:568,centered:!0,destroyOnClose:!0,confirmLoading:s,contentClassName:"!rounded-[20px] !p-5",headerClassName:ek.tw`
281        !mb-3
282        [&_.ant-modal-title]:!text-base [&_.ant-modal-title]:!font-medium [&_.ant-modal-title]:!leading-6
283        [&_.coco-modal-title]:!text-base [&_.coco-modal-title]:!font-medium [&_.coco-modal-title]:!leading-6
284      `,footerClassName:"!mt-3",onCancel:d,footer:()=>(0,i.jsxs)("div",{className:"flex justify-end gap-2.5",children:[(0,i.jsx)(tk.default,{className:"h-8 w-[70px] text-xs leading-4",color:"modalCancel",padding:"none",rounded:"md",disabled:s,onClick:d,children:eB.i18n._({id:"dEgA5A"})}),(0,i.jsx)(tk.default,{className:"h-8 w-[70px] text-xs leading-4",color:"modalConfirm",padding:"none",rounded:"md",loading:s,onClick:()=>{u()},children:eB.i18n._({id:"7VpPHA"})})]}),children:[(0,i.jsx)(a6.Input,{autoFocus:!0,className:ek.tw`
285          h-10 rounded-md !border-none !bg-f-bg-elevated px-3 text-sm leading-5 !shadow-none
286          hover:!bg-f-bg-elevated focus:!bg-f-bg-elevated focus:!shadow-none
287        `,value:a,status:r?"error":void 0,placeholder:eB.i18n._({id:"92mXBa"}),onChange:e=>{n(e.target.value),l("")},onPressEnter:()=>{u()}}),r?(0,i.jsx)("div",{className:"mt-1 text-xs text-f-red-6",children:r}):null]})});var a9=e.i(908831),ne=e.i(30177),nt=e.i(203486);let ni=new Set(["mp4","mov","webm"]),na={h264:"H.264",h265:"H.265"},nn={aac:"AAC",mp3:"MP3"};function nr(e,t){switch(t){case aq.EMediaUploadType.IMAGE:return e.filter(e=>(0,t4.isImageFile)(e));case aq.EMediaUploadType.VIDEO:return e.filter(e=>(0,t4.isVideoFile)(e));case aq.EMediaUploadType.AUDIO:return e.filter(e=>(0,t4.isAudioFile)(e));case aq.EMediaUploadType.RESOURCE:return e.filter(e=>e.webPage||!(0,t4.isImageFile)(e)&&!(0,t4.isVideoFile)(e)&&!(0,t4.isAudioFile)(e));default:return[]}}function nl(e,t){return e.map(e=>t[e]).join(" or ")}async function no(e,t){let i;if(t.maxSize&&e.size>1024*t.maxSize*1024)return{isValid:!1,errorMessage:eB.i18n._({id:"bNz-ht",values:{0:t.label.toLowerCase(),1:t.maxSize}})};try{if(t.type===aq.EMediaUploadType.VIDEO)if(t.videoRequirements){let a=await (0,nt.getIsoBmffVideoMetadata)(e),n=function(e,t){let i=t.videoRequirements;if(i){if("unknown"===e.videoCodec||!i.videoCodecs.includes(e.videoCodec)){let e=nl(i.videoCodecs,na);return eB.i18n._({id:"OXr6nF",values:{allowedCodecs:e}})}if(e.audioCodec&&("unknown"===e.audioCodec||!i.audioCodecs.includes(e.audioCodec))){let e=nl(i.audioCodecs,nn);return eB.i18n._({id:"v43eEi",values:{allowedCodecs:e}})}if(e.frameRate<i.frameRate.min-.001||e.frameRate>i.frameRate.max+.001)return eB.i18n._({id:"ri7emJ",values:{0:i.frameRate.min,1:i.frameRate.max}})}if(t.minVideoWidthAndHeight&&t.maxVideoWidthAndHeight&&(e.width<t.minVideoWidthAndHeight||e.height<t.minVideoWidthAndHeight||e.width>t.maxVideoWidthAndHeight||e.height>t.maxVideoWidthAndHeight))return eB.i18n._({id:"gupcwY",values:{0:t.minVideoWidthAndHeight,1:t.maxVideoWidthAndHeight}});if(t.minAspectRatio&&t.maxAspectRatio){let i=e.width/e.height;if(i<=t.minAspectRatio||i>=t.maxAspectRatio)return eB.i18n._({id:"EZ9gRU",values:{0:t.minAspectRatio,1:t.maxAspectRatio}})}return null}(a,t);if(n)return{isValid:!1,errorMessage:n};i=a}else i=t.allowUnreadableMetadata&&!ni.has(e.name.split(".").pop()?.toLowerCase()??"")?{duration:0}:await (0,ne.getVideoMetadata)(e);else i=t.type===aq.EMediaUploadType.AUDIO?await (0,ne.getAudioMetadata)(e):{duration:0}}catch{if(t.type===aq.EMediaUploadType.VIDEO&&t.allowUnreadableMetadata)return{isValid:!0,metadata:{duration:0}};return{isValid:!1,errorMessage:t.type===aq.EMediaUploadType.VIDEO?eB.i18n._({id:"ukpbaR"}):void 0}}return i.duration&&t.minDuration&&i.duration<t.minDuration-.05?{isValid:!1,errorMessage:eB.i18n._({id:"I6EuOA",values:{0:t.label.toLowerCase(),1:t.minDuration}})}:i.duration&&t.maxFileDuration&&i.duration>t.maxFileDuration+.05?{isValid:!1,errorMessage:eB.i18n._({id:"6NR-s0",values:{0:t.label.toLowerCase(),1:t.maxFileDuration}})}:{isValid:!0,metadata:i}}let ns=y.default.memo(function(e){let{className:t}=e,n=a.Form.useFormInstance(),{modelName:r,variant:l}=(0,aE.useResolvedMediaFormValues)(n),{fileList:o,onAddUploadedFile:s,onDeleteFile:d,onUploadFile:u,onAddReferenceWebPage:c}=(0,el.useUploadFileList)(),m=(0,a$.useUploadAction)(),[p,f]=(0,y.useState)({value:!1}),[h,g]=(0,y.useState)(!1),[x,I]=(0,y.useState)(!1),C=(0,y.useRef)(),E=(0,y.useRef)(),v=o.length,{items:_,maxTotalCount:b,referenceResource:T}=(0,y.useMemo)(()=>(0,a9.getMediaUploadConfig)({modelName:r,variant:l}),[r,l]),N=nr(o,aq.EMediaUploadType.RESOURCE),M=N[0],S=T?{type:aq.EMediaUploadType.RESOURCE,icon:"i-cus--hix2-hyperlink-add",label:"File or URL",maxCount:T.maxCount,maxSize:T.maxSize,accept:T.accept}:null,k=_.find(e=>e.type===aq.EMediaUploadType.AUDIO),A=()=>{E.current&&(URL.revokeObjectURL(E.current),E.current=void 0),C.current=void 0,f({value:!1})},w=async(e,t,i)=>{let a;if(!t.maxDuration)return;E.current&&(URL.revokeObjectURL(E.current),E.current=void 0);let n=URL.createObjectURL(e);g(!0);try{a=(await m({file:e,filename:e.name,type:"file"})).url}catch{eW.message.error(eB.i18n._({id:"b3Thhd"})),URL.revokeObjectURL(n);return}finally{g(!1)}C.current=e,E.current=n,f({value:!0,data:{videoDuration:t.maxDuration,audioSrc:n,audioUrl:a,audioDuration:i,fileName:e.name,initialStartTime:0,initialEndTime:t.maxDuration}})},j=e=>{let t=_.find(e=>e.type===aq.EMediaUploadType.IMAGE),i=t?.maxCountWithVideo;if(!i)return e.maxCount;let a=nr(o,aq.EMediaUploadType.IMAGE),n=nr(o,aq.EMediaUploadType.VIDEO);return e.type===aq.EMediaUploadType.IMAGE&&n.length>0?i:e.type===aq.EMediaUploadType.VIDEO&&a.length>i?0:e.maxCount},F=async(e,t)=>{let i=nr(o,t.type),a=j(t);if(v>=b)return void eW.message.error(eB.i18n._({id:"Ih55mC",values:{maxTotalCount:b}}));if(a<=0)return void eW.message.error(eB.i18n._({id:"OckCSR"}));if(i.length>=a)return void eW.message.error(eB.i18n._({id:"H3UZYU",values:{currentMaxCount:a,0:t.label.toLowerCase()}}));let n=await no(e,t);if(!n.isValid){n.errorMessage&&eW.message.error(n.errorMessage);return}let{duration:r}=n.metadata;r&&t.maxDuration&&i.reduce((e,t)=>
287e+(t.metadata?.duration||0),0)+r>t.maxDuration?function({currentFiles:e,duration:t,mediaItem:i}){return i.type===aq.EMediaUploadType.AUDIO&&0===e.length&&!!i.maxDuration&&t>i.maxDuration}({currentFiles:i,duration:r,mediaItem:t})?await w(e,t,r):eW.message.error(eB.i18n._({id:"yPVHcB",values:{0:t.label.toLowerCase(),1:t.maxDuration}})):await u([e])},R=async e=>{!T||M?eW.message.error(eB.i18n._({id:"zvGvxn"})):await u([e])};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(iI.default,{className:ek.tw`min-w-0 select-none relative ${t||""}`,children:(0,i.jsxs)("div",{className:"flex items-center gap-x-2",children:[_.map(e=>{let t=nr(o,e.type),a=j(e),n=a===e.maxCount?e:{...e,maxCount:a};return(0,i.jsx)(a8,{currentFiles:t,mediaItem:n,onDeleteFile:d,onUpload:F,totalCount:v,maxTotalCount:b,loading:e.type===aq.EMediaUploadType.AUDIO&&h},n.type)}),S&&T?(0,i.jsx)(a8,{currentFiles:N,mediaItem:S,onDeleteFile:d,onUpload:e=>{R(e)},totalCount:v,maxTotalCount:b,renderUploadTrigger:()=>(0,i.jsx)(a4,{config:T,onAddUrl:()=>{I(!0)},onUpload:e=>{R(e)}})}):null,(0,i.jsx)("div",{"aria-hidden":"true",className:"h-px w-10 shrink-0"})]})}),(0,i.jsx)(aW,{open:p,maxClipDuration:k?.maxDuration,minClipDuration:k?.minDuration,showTimeInfo:!0,onCancel:A,onClose:A,onClipSuccess:(e,t,i,a)=>{let n;n=C.current,e&&n&&s({name:a||n.name,url:e,metadata:{duration:"number"==typeof t&&"number"==typeof i?i-t:0}})}}),x?(0,i.jsx)(a7,{onAddReferenceWebPage:c,onClose:()=>{I(!1)}}):null]})});var nd=e.i(861512),nu=e.i(169042),nc=e.i(23705),nm=e.i(677062),np=e.i(316208),nf=e.i(90140),nh=e.i(327118);function ng(e,t={}){let{isStatic:i}=(0,y.useContext)(nc.MotionConfigContext),a=(0,y.useRef)(null),n=(0,aU.useMotionValue)((0,nu.isMotionValue)(e)?e.get():e),r=()=>{a.current&&a.current.stop()};return(0,y.useInsertionEffect)(()=>n.attach((e,l)=>{if(i)return l(e);if(r(),a.current=(0,np.animateValue)({keyframes:[n.get(),e],velocity:n.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...t,onUpdate:l}),!nh.frameData.isProcessing){let e=performance.now()-nh.frameData.timestamp;e<30&&(a.current.time=(0,nf.millisecondsToSeconds)(e))}return n.get()},r),[JSON.stringify(t)]),(0,nm.useIsomorphicLayoutEffect)(()=>{if((0,nu.isMotionValue)(e))return e.on("change",e=>n.set(parseFloat(e)))},[n]),n}var nx=e.i(869791);let ny={damping:30,stiffness:100,mass:2},nI=(0,y.forwardRef)((e,t)=>{let{imageHeight:a="48px",imageWidth:n="48px",scaleOnHover:r=1.1,rotateAmplitude:o=14,children:s,className:d,tip:u,disable:c=!1}=e,m=(0,aU.useMotionValue)(0),p=(0,aU.useMotionValue)(0),f=ng((0,aU.useMotionValue)(0),ny),h=ng((0,aU.useMotionValue)(0),ny),g=ng(1,ny),x=ng(0),I=ng(0,{stiffness:350,damping:30,mass:1}),[C,E]=(0,y.useState)(0),v=(0,y.useRef)(null),_=(0,y.useCallback)(()=>{x.set(0),g.set(1),f.set(0),h.set(0),I.set(0)},[x,I,f,h,g]);return(0,y.useImperativeHandle)(t,()=>({reset:_}),[_]),(0,i.jsx)("figure",{ref:v,className:ta.cls`
288        ${nx.default.ImageMotionCard}
289        ${d}
290      `,onMouseMove:function(e){if(c||!v.current)return;let t=v.current.getBoundingClientRect(),i=e.clientX-t.left-t.width/2,a=e.clientY-t.top-t.height/2,n=-(a/(t.height/2)*o),r=i/(t.width/2)*o;f.set(n),h.set(r),m.set(e.clientX-t.left),p.set(e.clientY-t.top);let l=a-C;I.set(-(.6*l)),E(a)},onMouseEnter:function(){c||(g.set(r),x.set(1))},onMouseLeave:_,children:(0,i.jsx)(l.motion.div,{className:"tilted-card-inner",style:{width:n,height:a,rotateX:f,rotateY:h,scale:g},children:s})})});nI.displayName="ImageMotionCard";let nC=(0,y.memo)(function(e){let{file:t,text:a,fileType:n,onDeleteFile:r,uploadProps:l,tip:o}=e,[s,d]=(0,y.useState)(!1),[u,c]=(0,y.useState)(!1),[m,p]=(0,y.useState)(!1),f=(0,y.useRef)(null),h=e=>{c(e),e&&(d(!1),f.current?.reset(),p(!0))},{aspectOptions:g}=(0,nd.useModelAspect)();return(0,i.jsx)(en.default,{title:t?eB.i18n._({id:"5SrRXH"}):o,tooltipProps:{open:s,onOpenChange:e=>{u||d(e)}},children:(0,i.jsx)(y.default.Fragment,{children:(0,i.jsx)(nI,{ref:f,className:"!size-[48px]",disable:m,children:(0,i.jsx)("div",{className:ek.tw`
291              flex flex-col items-center relative group/file-item justify-center
292              rounded-xl [&_.coco-image-mask]:hidden [&_.ant-image-mask]:hidden shrink-0
293              size-full [&_.coco-image]:!size-full
294              ${!t?"cursor-not-allowed border border-f-border":"cursor-pointer bg-f-bg-elevated"}
295            `,children:(0,et.match)(!!t).with(!0,()=>(0,i.jsxs)(i.Fragment,{children:[(0,et.match)(t?.uploadStatus).with("success",()=>(0,i.jsx)(i.Fragment,{children:t?.url?(0,i.jsx)(aX.Image,{src:t.url,alt:t.name,className:"!w-full !h-full object-cover rounded-[11px]",preview:{visible:u,onVisibleChange:h,afterOpenChange(e){e||p(!1)}}}):(0,i.jsx)(e6.IconItem,{className:ta.cls`i-cus--img-fail size-6}`})})).otherwise(()=>(0,i.jsx)(e6.IconItem,{className:ta.cls`i-cus--hix2-loading animate-spin size-6`})),(0,i.jsx)(aK.default,{className:"-top-1 -right-1 hidden group-hover/file-item:flex",onClick:()=>{t&&r?.(t)}})]})).otherwise(()=>(0,i.jsxs)(i.Fragment,{children:[a?(0,i.jsx)("span",{className:"text-[11px] text-[#111827A6]",children:a}):(0,i.jsx)(e6.IconItem,{className:ta.cls`i-cus--hix2-upload-image size-4 text-[#111827A6]`}
295),(0,i.jsx)(a1.ChatUpload,{className:"size-full",fileType:n,uploadClassName:"absolute cursor-pointer left-0 top-0 size-full z-[2] opacity-0 [&_.coco-upload]:size-full",aspectOptions:g,onBeforeCrop:()=>{p(!0)},onAfterCrop:()=>{p(!1)},...l})]}))},t?.uid||n)})})})});function nE(e){let{fileList:t,className:n,assetsNum:r,isStartAndEnd:l,uploadProps:o,onDeleteFile:s,onTransferImage:d,onClick:u}=e,m=(0,c.useMemoizedFn)((e,t)=>{let i="",a="";return t?(i=1===e?eB.i18n._({id:"UMvHkU"}):eB.i18n._({id:"PlWCvX"}),a=1===e?eB.i18n._({id:"tXkhj_"}):eB.i18n._({id:"xDr_ct"})):i=eB.i18n._({id:"ISKWIA"}),{tip:i,text:a}}),p={...o,accept:o?.accept?o.accept.split(",").filter(e=>!v.hixChatUploadVideoFormat.includes(e)).join(","):""},f=r>2,h=l&&r>1,g=a.Form.useFormInstance();return(0,aS.useReferenceMediaMode)(g)?(0,i.jsx)(ns,{}):(0,i.jsxs)("div",{className:ek.tw`flex gap-x-1 items-center ${n}`,onClick:u,children:[(f?t:Array.from({length:r})).map((e,a)=>{let n=f?1:a+1,{tip:l,text:o}=m(n,h);return(0,i.jsxs)(y.default.Fragment,{children:[(0,i.jsx)(nC,{file:f?e:t.find(e=>e.frame===n),text:o,onDeleteFile:s,fileType:n,uploadProps:p,tip:l}),a<r-1?(0,i.jsx)(i.Fragment,{children:(0,et.match)(h).with(!0,()=>(0,i.jsx)(e6.IconItem,{onClick:d,className:ta.cls`i-com--transfer hover:text-f-text cursor-pointer size-[18px] text-f-text-quaternary`})).otherwise(()=>2===r?(0,i.jsx)(e6.IconItem,{className:ta.cls`i-cus--hix2-add-image size-[18px] text-f-text-quaternary`}):null)}):null]},a)}),f&&t.length<r?(0,i.jsx)(nC,{onDeleteFile:s,fileType:t.length+1,uploadProps:p,tip:eB.i18n._({id:"ISKWIA"})}):null]})}function nv(e){let{showImageFrame:t,isStartAndEnd:a,assetsNum:n,onFocus:r}=e,{fileList:l,uploadProps:o,onDeleteFile:s,onTransferImage:d}=(0,el.useUploadFileList)();return(0,i.jsxs)(i.Fragment,{children:[t&&(0,i.jsx)(nE,{fileList:l,className:"",isStartAndEnd:a,assetsNum:n,onDeleteFile:s,onTransferImage:d,uploadProps:{...o,multiple:!1},onClick:r}),!t&&(0,i.jsx)(iZ,{})]})}function n_({onBeforeSubmit:e,className:t,boxContainerClassName:n,boxClassName:r,initialValues:l,slateEditorProps:o,editorAutoFocus:s,onBeforeFetch:d,formHeaderTopSlot:c,formHeaderBottomSlot:m,formHeaderWrapperClassName:p,isChatListLoading:f,form:h,renderFormContent:g,editorKey:v,contentId:_,enableDefaultValues:N=!0}){let[M]=a.Form.useForm(h),[S,L]=(0,y.useState)(!1),{chatInputValue:V,chatType:D,setInputValue:O}=(0,T.useChatInput)(),z=(0,b.useHixChatLoadingState)(),U=(0,k.useChatStore)(e=>e.fileListMap.chat),G=(0,k.useChatStore)(e=>e.isAiBackgroundActive),H=(0,k.useChatStore)(e=>e.isFormDisabled),B=(0,I.useChatContainerContext)(e=>!!e.chatId),{isModelBotDisabled:W}=(0,P.useModelBotMetaState)(),{modelName:$,variant:q}=(0,aE.useResolvedMediaFormValues)(M),{maxCount:K}=(0,aM.useUploadLimit)({modelName:$,form:M,variant:q}),X=U?.length??0,{hasImageFrame:Y,saveFormValue:Q,disableUpload:J,mediaTypeDisableSendButton:Z,isVideoUpload:ee,isStartAndEnd:et,promptWordLength:ei}=aN(M,K,{enabled:N}),ea=Y&&!ee,en=(0,E.useComputed)(()=>X>=K||z||W||J),{formValidate:eo,isFormValidatePass:es,maxLength:ed}=(0,F.useFormValidate)({promptWordLength:ei,form:M,mediaTypeDisableSendButton:Z,enableAiBackgroundValidate:!0,enablePptAiEditValidate:!0}),eu=function({form:e}){let{fileList:t}=(0,el.useUploadFileList)(e),{modelName:i,variant:a}=(0,aE.useResolvedMediaFormValues)(e),n=(0,ia.useIsOmniReferenceMode)(i,a),{referenceMediaItems:r,shouldShowReferenceMedia:l}=(0,aS.useReferenceMediaAvailability)(e,t),o=(0,y.useMemo)(()=>l?r.map(aS.toReferenceMediaOption):[],[r,l]),s=(0,y.useMemo)(()=>({enabled:n,options:o}),[n,o]);return{mentionOptions:o,mediaReferenceConfig:s}}({form:M}),{onFormFinish:ec,handleInputValueChange:em,legacyAgentConfirmModal:ep,isEditorInteractionLocked:ef,multiModelPaywallGuide:eh}=(0,A.default)({form:M,onBeforeSubmit:e,onSaveFormValue:Q,onBeforeFetch:d}),{formEditorProps:eg,slateEditorRef:ex,focus:ey}=(0,w.default)({slateEditorProps:o,editorAutoFocus:s,disableUploadState:en,disableEditorInteraction:ef,maxLength:ed,form:M,editorKey:v,onEditorFocusChange:L,editorEnhancement:eu});return!function({form:e,onRestore:t}){let i=(0,eE.useLatestQuery)("customType"),a=(0,y.useRef)(!1),n=(0,u.useLatest)(t),r=(0,I.useChatContainerContext)(e=>e.chatType),{set:l,modelList:o}=(0,k.useChatStore)(e=>({set:e.getSetFunction(),modelList:e.modelListMap[r]})),s=(0,ah.useDebounceFn)(e=>{let{form:t,modelList:i,set:l}=e;if(!l||!i||!t)return;let o=(()=>{try{let e=localStorage.getItem(ax);return e?JSON.parse(e):null}catch(e){return(0,ag.devLog)("getStoredValues error:",e),null}})();if(!o)return void(0,ag.devLog)("No stored values found for modelPage");if((0,ag.devLog)("Restoring modelPage values:",o),r===C.EChatInputType.AI_IMAGE){let{modelName:e,imageUrl:a,prompt:n,aspectRatio:r,numOutputs:s,style:d}=o;e&&i.find(t=>t.modelName===e)&&(t.setFieldValue("modelName",e),(0,ag.devLog)("Restored AI Image model:",e)),n&&(t.setFieldValue("inputValue",n),(0,ag.devLog)("Restored prompt:",n)),a&&(l(e=>{e.fileListMap.chat=[(0,t4.getFileItem)({name:a,url:a})]}),(0,ag.devLog)("Restored image:",a));let u={};r&&(u.aspectRatio=r),s&&(u.numOutputs=s),d&&(u.style=d),Object.keys(u).length>0&&(t.setFieldsValue(u),(0,ag.devLog)("Restored other fields:",u))}else if(r===C.EChatInputType.AI_VIDEO){let{videoModel:e,image:a,imageTail:n,prompt:r,aspectRatio:s,numOutputs:d,length:u,resolution:c}=o;e&&i.find(t=>t.modelName===e)&&(t.setFieldValue("modelName",e),x.FRAMES_MODEL_LIST.includes(e)&&a&&t.setFieldValue("variant","frames"),(0,ag.devLog)("Restored AI Video model:",e)),r&&(t.setFieldValue("inputValue",r),(0,ag.devLog)("Restored prompt:",r));let m=[];a&&m.push((0,t4.getFileItem)({name:a,url:a})),n&&m.push((0,t4.getFileItem)({name:n,url:n,frame:2})),m.length>0&&(l(e=>{e.fileListMap.chat=m}),(0,ag.devLog)("Restored video images:",m));let p={};s&&(p.aspectRatio=s),d&&(p.numOutputs=d),u&&(p.length=u),c&&(p.resolution=c),Object.keys(p).length>0&&(t.setFieldsValue(p),(0,ag.devLog)("Restored other fields:",p))}a.current=!1;try{localStorage.removeItem(ax)}catch(e){(0,ag.devLog)("clearStoredValues error:",e)}n.current?.()},{wait:200});(0,y.useEffect)(()=>{"modelPage"===i&&e&&o.length>
2950&&l&&s.run({form:e,modelList:o,set:l})},[i,e,o,l])}({form:M,onRestore:()=>{ey({cursor:"end"})}}),!function({form:e,onRestore:t}){let{cmsTemplateData:i,chatType:a}=(0,I.useChatContainerContext)(e=>({cmsTemplateData:e.pageData?.cmsTemplateData||e.pageData?.templateData,chatType:e.chatType})),n=(0,y.useRef)(!1),{set:r}=(0,k.useChatStore)(e=>({set:e.getSetFunction()})),l=(0,u.useLatest)(t),{setTemplateInfo:o}=(0,iu.useFormTemplate)(e),s=(0,y.useCallback)(e=>{let t={aspectRatio:i?.aspectRatio,inputValue:i?.prompt,style:i?.style,numOutputs:i?.numOutputs};return e===C.EChatInputType.AI_VIDEO?{...t,length:i?.length,resolution:i?.resolution}:t},[i]),d=(0,y.useCallback)(e=>{let t={aspectRatio:i?.aspectRatio,numOutputs:i?.numOutputs,style:i?.style};return e===C.EChatInputType.AI_VIDEO?{...t,length:i?.length,resolution:i?.resolution}:t},[i]),c=(0,y.useCallback)(()=>{if(!i||n.current)return;(0,ag.devLog)("Restoring CMS template values:",i);let t=(0,aC.pickBy)(s(a),ay.default);o(i),Object.keys(t).length>0&&(e.setFieldsValue(t),(0,ag.devLog)(`Restored ${a} fields:`,t),r(e=>{let t=(0,aC.pickBy)(d(a),ay.default);(a===C.EChatInputType.AI_IMAGE||a===C.EChatInputType.AI_VIDEO)&&(e.formValueMap[a]=(0,aI.merge)({},e.formValueMap[a],t))})),n.current=!0,l.current?.()},[i,a,e,r,l,s,d,o]);(0,y.useEffect)(()=>{i&&!n.current&&c()},[i,c]),(0,y.useEffect)(()=>{n.current=!1},[i?.id])}({form:M,onRestore:()=>{ey({cursor:"end"})}}),(0,j.useHumanizeDocumentRequest)({form:M,isFormDisabled:H,onFormFinish:ec}),(0,au.useReceiveContentMsg)({onReceiveContent:e=>{try{let t=JSON.parse(e),i=t?.textFiles?.text??"";M.setFieldValue("inputValue",i),O(i,"chat")}catch(e){}}}),(0,i.jsx)(R.default,{form:M,isChatListLoading:f,isFormDisabled:H,onFormFinish:ec,handleInputValueChange:em,chatInputValue:V,initialValues:l,className:t,boxContainerClassName:n,boxClassName:r,formHeaderTopSlot:c,formHeaderBottomSlot:m,formHeaderWrapperClassName:p,editFormItemProps:G&&D===C.EChatInputType.AI_IMAGE?{rules:[{required:!0,message:"Required"}]}:void 0,customValuesValidate:eo,slateEditorProps:eg,slateEditorRef:ex,formRight:B&&$&&!er.AGENT_MODELS.includes($)?(0,i.jsx)(af,{}):void 0,boxHeader:(0,i.jsx)(nv,{showImageFrame:ea,isStartAndEnd:et,assetsNum:K,onFocus:ey}),boxFooter:(0,i.jsx)(ak,{className:"h-auto",disableUpload:en,disabledSend:!es||H,showImageFrame:ea,form:M,editorKey:v,isEditorFocused:S}),renderFormContent:g,contentId:_,legacyAgentConfirmModal:ep,multiModelPaywallGuide:eh})}let nb=(0,y.memo)(function(e){let t=(0,I.useChatContainerContext)(e=>e.chatType);return t===C.EChatInputType.AI_IMAGE||t===C.EChatInputType.AI_VIDEO?(0,i.jsx)(n_,{...e}):t===C.EChatInputType.AI_CHAT?(0,i.jsx)(ad,{...e}):(0,i.jsx)(al,{...e})});e.s(["default",0,nb],312533);var nT=e.i(237447),nN=e.i(243837),nM=e.i(367311);let nS=(0,y.createContext)(null);var nk=e.i(183529);let nA=e=>!e.isLayoutDirty&&e.willUpdate(!1),nw=({children:e,id:t,inherit:i=!0})=>{let a=(0,y.useContext)(nM.LayoutGroupContext),n=(0,y.useContext)(nS),[r,l]=(0,nk.useForceUpdate)(),o=(0,y.useRef)(null),s=a.id||n;if(null===o.current){let e,n,r,l;(!0==(!0===(l=i))||"id"===l)&&s&&(t=t?s+"-"+t:s),o.current={id:t,group:!0===i&&a.group||(e=new Set,n=new WeakMap,{add:t=>{e.add(t),n.set(t,t.addEventListener("willUpdate",r))},remove:t=>{e.delete(t);let i=n.get(t);i&&(i(),n.delete(t)),r()},dirty:r=()=>e.forEach(nA)})}}let d=(0,y.useMemo)(()=>({...o.current,forceRender:r}),[l]);return y.createElement(nM.LayoutGroupContext.Provider,{value:d},e)},nj=(0,y.forwardRef)(({children:e,className:t,...a},n)=>{let r=(0,o.useReducedMotion)(),s=(0,aI.merge)({},{layout:"position",initial:{opacity:0,filter:r?"none":"blur(4px)"},animate:{opacity:1,filter:r?"none":"blur(0px)"},exit:{opacity:0,filter:r?"none":"blur(4px)",transition:{duration:.15}},style:{transform:"translateZ(0)",backfaceVisibility:"hidden"}},a);return(0,i.jsx)(l.motion.div,{ref:n,className:ek.tw`w-full h-full will-change-contents flex items-center justify-center overflow-hidden ${t}`,...s,children:e})});nj.displayName="ContentWrapper";let nF={type:"spring",damping:25,stiffness:282},nR=function({components:e,value:t,initialAnimatedConfig:a,className:n,contentProps:o,transition:s=nF,...d}){let{animatedConfig:u,render:c,contentProps:m,className:p,transition:f,...h}=e[t],g={rest:(0,aI.merge)({},d,h),transition:(0,aI.merge)({},s,f),contentProps:(0,aI.merge)({},o,m)};return(0,i.jsx)(nw,{children:(0,i.jsx)(l.motion.div,{layout:!0,initial:a||!1,animate:u,transition:g.transition,className:ek.tw`relative overflow-hidden ${n} ${p}`,...g.rest,children:(0,i.jsx)(r.AnimatePresence,{mode:"popLayout",initial:!1,children:(0,i.jsx)(nj,{...g.contentProps,children:c(t)},t)}
295)})})};var nL=e.i(282620),nV=e.i(998131);e.i(94823);var nD=e.i(206942),nO=e.i(752844);function nP({item:e}){let t,a=(0,nO.useOptionalChatAguiReferenceMentionResolver)(),n="reference"===e.type?a?.(e.payload):void 0;return"reference"===e.type&&"skill"===e.payload.kind?(0,i.jsx)(nV.SkillReferenceTokenView,{label:n?.label??e.payload.label}):(t="text"===e.type?e.content:"input"===e.type?e.value||e.placeholder||"":"select"===e.type?e.value||e.options?.[0]?.value||"":"mention"===e.type?e.payload.name||"":n?.label||e.payload.label||"",(0,i.jsx)(i.Fragment,{children:t.replace(/\n/g," ")}))}let nz=function({form:e}){let t=(0,nL.useChatFormPlaceholder)({form:e}),n=a.Form.useWatch("inputValue",e),r=n?.trim(),l=(0,y.useMemo)(()=>r?(0,nD.parseSlateString)(r):[],[r]);return(0,i.jsxs)("p",{className:ek.tw`
296        line-clamp-1 flex-1 text-f-text leading-6 whitespace-pre-wrap break-all h-6 caret-f-primary relative
297      `,children:[l.map((e,t)=>(0,i.jsx)(nP,{item:e},t)),0===l.length&&(0,i.jsx)("span",{className:"absolute inset-0 pointer-events-none text-sm opacity-[0.333] line-clamp-1 translate-y-0.5",children:t})]})};var nU=e.i(805966),nG=e.i(80658),nH=e.i(173663);let nB=function({form:e}){let{fileList:t,onDeleteFile:a}=(0,el.useUploadFileList)(e),n=(0,nU.useCreation)(()=>new Set,[]),r=t[t.length-1];return r?(0,t4.isSlidesTemplateFile)(r)?(0,i.jsx)(iJ.SlidesTemplateReferenceItemView,{name:r.slidesTemplate.name,coverImageUrl:r.slidesTemplate.coverImageUrl,variant:"mini",onClose:()=>a(r)}):(0,i.jsx)(nG.FileListProvider,{value:{fileList:t,animatedUidSet:n,onDeleteFile:a},children:(0,i.jsx)(nH.default,{index:t.length-1,isMini:!0})}):null},nW=(0,y.memo)(function({form:e,boxClassName:t,onClick:n}){let r=iK(),{bot:l,chatType:o}=(0,T.useChatInput)(),s=(0,I.useChatContainerContext)(e=>e.containerType),d=a.Form.useWatch("modelName",e),{modelInfo:u}=(0,ab.useModelInfo)(d),c=[C.EChatInputType.AI_IMAGE,C.EChatInputType.AI_VIDEO].includes(o)?u?.promptWordLength:o===C.EChatInputType.AI_CHAT||s===C.EChatContainerType.BOT_ENTRY?l?.promptWordLength:F.DEFAULT_PROMPT_WORD_LENGTH,{isFormValidatePass:m}=(0,F.useFormValidate)({promptWordLength:c,form:e,mediaTypeDisableSendButton:!1});return(0,i.jsxs)("div",{className:ek.tw`
298        bg-f-bg-base cursor-text p-3 w-full gap-2
299        relative flex items-center justify-between h-full
300        ${t}
301      `,onClick:n,children:[(0,i.jsxs)("div",{className:"flex-1 flex items-center gap-1 h-full float-left-input",children:[(0,i.jsx)(G.ChatModeBadge,{}),(0,i.jsx)(nB,{form:e}),(0,i.jsx)(nz,{form:e})]}),(0,i.jsx)("div",{className:"flex items-end h-full",onClick:e=>e.stopPropagation(),children:(0,i.jsx)(a.Form.Item,{noStyle:!0,shouldUpdate:!0,children:e=>{let t=!m,{sendButtonShowGuide:a}=r(e,t);return(0,i.jsx)(i$,{disabledSendButton:t,showGuide:a})}})})]})}),n$=(0,y.memo)(function({form:e,content:t,editorKey:a,sizeTarget:n,scrollTarget:r}){var l;let o,d,[u,m]=(0,y.useState)("float"),[p,f]=(0,y.useState)(!1),I="expanded"!==u||p?"overflow-hidden":"overflow-visible",C=(0,y.useRef)(!1),E=(0,y.useRef)(null),v=(0,g.useContentScrollContainer)(),_=r??v,{maxWidth:b,floatWidth:T,expandedWidth:N}=(l=n??v??document.documentElement,o=(0,aL.useSize)(l),(0,y.useMemo)(()=>{let e=o?.width,t=e?`${Math.min(.95*e,800)}px`:"calc(100vw - 40px)";return{maxWidth:t,floatWidth:e?Math.min(.85*e,500):500,expandedWidth:e?Math.min(.95*e,800):800}},[o?.width])),{getContentSize:M}=(d=(0,y.useRef)(null),(0,y.useEffect)(()=>{let e=document.getElementById(x.HIX_CHAT_FORM_MEDIA_KEYS.BASE_CONTENT_ID);return e&&(d.current=e),()=>{d.current=null}},[]),{getContentSize:(0,c.useMemoizedFn)(()=>{if(!d.current)return{width:0,height:0};let e=d.current.getBoundingClientRect();return{width:e.width,height:e.height}})}),S=(0,c.useMemoizedFn)(()=>{C.current=!1,f(!0),m("expanded")}),k=(0,c.useMemoizedFn)(()=>{C.current=!0,f(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{m("float")})})}),A=(0,c.useMemoizedFn)(e=>{!(e?.target instanceof Node&&(E.current?.contains(e.target)||e.target instanceof Element&&e.target.closest(".coco-select-dropdown, .coco-cascader-dropdown, .coco-dropdown, .coco-popover, .coco-tooltip")))&&("expanded"!==u||p||k())});(0,s.useEventListener)("wheel",A,{target:_,passive:!0}),function(e,t){let{target:i,noScroll:a}=t||{},n=(0,y.useRef)(0),r=(0,c.useMemoizedFn)(e);(0,s.useEventListener)("touchstart",e=>{n.current=e.touches[0].clientY},{target:i}),(0,s.useEventListener)("touchmove",e=>{let t=e.touches[0].clientY,i=n.current-t;n.current=t,a&&e.cancelable&&e.preventDefault();let l=new WheelEvent("wheel",{deltaY:i,bubbles:!0,cancelable:!0,view:window});Object.defineProperty(l,"preventDefault",{value:()=>{e.cancelable&&e.preventDefault()}}),Object.defineProperty(l,"stopPropagation",{value:()=>{e.stopPropagation()}}),r(l)},{target:i,passive:!a})}(A,{target:_}),(0,h.useListenEvents)(nN.chatContainerEventBus,{floatFormExpanded:()=>{let e=e=>{requestAnimationFrame(()=>{e?.(),Q.chatFormEditorMedia.focus(a,{cursor:"end",immediate:!0})})};"expanded"===u?e(()=>{f(!1)}):(S(),e())},floatFormFloat:k});let w=(0,y.useRef)(!0),j=(0,c.useMemoizedFn)(e=>{"expanded"===u&&C.current||(f(!1),C.current=!1,w.current=!1,e?.width===N&&Q.chatFormEditorMedia.focus(a,{cursor:"end",immediate:!0}))});return(0,i.jsx)("div",{ref:E,children:(0,i.jsx)(nR,{value:u,initialAnimatedConfig:{width:T,height:58},transition:p?void 0:{duration:0}
301,className:"mx-auto shadow-effects-m bg-f-bg-base border-[1px] border-f-border",style:{maxWidth:b,borderRadius:20},onAnimationComplete:j,components:{float:{contentProps:{transition:w.current?{duration:0}:void 0,exit:{transition:{duration:0}}},animatedConfig:{width:T,height:58},render:()=>(0,i.jsx)(nW,{form:e,onClick:S})},expanded:{className:I,contentProps:{className:I},animatedConfig:{width:N,height:p&&M().height||"auto"},render:()=>t}}})})}),nq={duration:.4,ease:[.16,1,.3,1]},nK=(0,y.memo)(function(e){let{form:t,boxClassName:a,visible:C=!0,floatStrategy:E={type:"auto"},sizeTarget:v,..._}=e,b=(0,y.useRef)(null),T=(0,y.useRef)(null),N=(0,g.useContentScrollContainer)(),M=(0,o.useReducedMotion)(),S=(0,I.useChatContainerContext)(e=>e.containerType),A=(0,k.useChatStore)(e=>e.foldState.isFold),[w,j]=(0,y.useState)(!1),[F,R]=(0,y.useState)(!1),L=window,V="u"<typeof document?null:document.documentElement,D=(0,p.getTargetElement)(v),O="window"===E.type||!N||(0,nT.isFullPageEntryContainerType)(S),P=O?null:N,z=O?V:N,U=O?D??V:P??D??V,G=z??void 0,[H,B]=(0,y.useState)(null),W=(0,c.useMemoizedFn)(()=>{let e=D?.getBoundingClientRect();if(!e)return void B(null);let t={left:`${e.left}px`,width:`${e.width}px`};B(e=>e?.left===t.left&&e?.width===t.width?e:t)});(0,d.useIsomorphicLayoutEffect)(()=>{let e=O?document.body:document.getElementById("chat-canvas");e&&(T.current=e,j(!0))},[O]),(0,d.useIsomorphicLayoutEffect)(()=>{if(!O)return void B(null);if(W(),"u"<typeof ResizeObserver)return;let e=new ResizeObserver(()=>{requestAnimationFrame(()=>{W()})});return D&&e.observe(D),P&&P!==D&&e.observe(P),()=>{e.disconnect()}},[P,A,D,O,W]),(0,s.useEventListener)("resize",()=>{O&&W()},{target:L,passive:!0});let $=(0,u.useLatest)(R),q=(0,c.useMemoizedFn)(()=>{if(!b.current||!C)return void $.current?.(!1);let e=b.current.getBoundingClientRect();if(O)return void $.current?.(e.bottom<0);if(!P)return void $.current?.(!1);let t=P.getBoundingClientRect();$.current?.(e.bottom<t.top)});(0,s.useEventListener)("scroll",q,{target:P,passive:!0}),(0,s.useEventListener)("scroll",q,{target:O?L:null,passive:!0}),(0,y.useEffect)(()=>{q()},[C,q]);let K=C&&F;(0,y.useEffect)(()=>{nN.chatContainerEventBus.emit("setHideContainerBackTop",!K)},[K]),(0,m.useUnmount)(()=>{nN.chatContainerEventBus.emit("setHideContainerBackTop",!0)});let X=(0,c.useMemoizedFn)(e=>(0,i.jsx)(n$,{form:t,content:e,editorKey:x.FRONT_ENTRY_FLOAT_EDITOR_KEY,sizeTarget:U,scrollTarget:G}));(0,h.useListenEvents)(nN.chatContainerEventBus,{checkFloatFormFixed:e=>{e(K)}});let Y=(0,f.useShallowCompareMemo)(()=>(0,i.jsx)("div",{className:ek.tw`${O?"fixed":"absolute"} bottom-7 z-30 ${O?"":"translate-x-[-50%]"}`,style:O?H??void 0:{left:"50%"},children:(0,i.jsx)("div",{className:ek.tw`${O?"flex w-full justify-center":""}`,children:(0,i.jsx)(r.AnimatePresence,{children:K&&(0,i.jsx)(l.motion.div,{layout:"position",layoutDependency:H,initial:{y:"100%",opacity:0,scale:.7},animate:{y:0,opacity:1,scale:1},exit:{y:"100%",opacity:0,scale:.7},transition:{type:"spring",stiffness:400,damping:30,layout:M?{duration:0}:nq},className:"h-auto will-change-transform",children:(0,i.jsx)(nb,{contentId:x.HIX_CHAT_FORM_MEDIA_KEYS.FLOAT_CONTENT_ID,form:t,enableDefaultValues:!1,boxClassName:ek.tw`${a} shadow-none border-none w-full`,className:"w-fit",renderFormContent:X,boxContainerClassName:"flex-1",editorKey:x.FRONT_ENTRY_FLOAT_EDITOR_KEY,..._,showSceneInputFooter:!1})})})})}),[K,t,a,H,X,_,M,O]);return C?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{ref:b,className:"h-0"}),w&&T.current&&(0,n.createPortal)(Y,T.current)]}):null}),nX=(0,y.memo)(function(e){let{enabled:t=!0,floatStrategy:n={type:"auto"},wrapperClassName:r,renderBaseForm:l,form:o,...s}=e,[d]=a.Form.useForm(o),u=(0,y.useRef)(null),c=(0,y.useMemo)(()=>({...s,form:d}),[d,s]),m=(0,y.useMemo)(()=>(0,i.jsx)(nb,{...c}),[c]),p=l?l(m):m;return(0,i.jsxs)("div",{ref:u,className:r,children:[p,t&&(0,i.jsx)(nK,{...c,form:d,visible:!0,floatStrategy:n,sizeTarget:u})]})});e.s(["default",0,nX],682133)},166060,e=>{e.v({scrollbar:"scroll-area-module-scss-module__apGFCW__scrollbar"})},636737,e=>{e.v({flyout:"flyout-module-scss-module__7bbwua__flyout"})},484278,e=>{"use strict";let t={1:"Free",2:"New",3:"Hot"},i={Free:1,New:2,Hot:3};e.s(["pickTopMarks",0,function(e){let t=e.sort((e,t)=>
301i[e]-i[t])[0];return t?[t]:void 0},"toMarks",0,function(e){if(!e)return;let i=t[e];return i?[i]:void 0}])}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.