1import{i as ue,b as me,R as l,B as pe,a8 as S,T as V,t as he,ar as $,aq as U,an as z,a1 as j,a0 as de,dd as _e,u as fe,ai as ge,_ as ve}from"./BuQWImh-.js";import{d as q,c as _,r,j as xe,w as H,o as we,x as ye,y as u,z as n,A as m,f as v,R as f,L as x,D as e,J as w,E as k,b as X,F,C as M,B as b}from"./chunk-vue-TRwxe8i9.js";import{s as ke}from"./chunk-pinia-DfnRCC0j.js";import{T as be}from"./ToolForm-BVzlmH2Z.js";import{T as Te}from"./ToolCreateArea-CJbkIRlU.js";import{c as Ee}from"./dataExec-4m2jr2Je.js";import{u as Ce}from"./chunk-i18n-CEBPY5W3.js";import"./chunk-alioss-Co3x7qJ6.js";import"./chunk-fabric-NyCWrAO1.js";import"./ToolSwitch-DKQPDM_S.js";import"./ToolUpload-DvXa5AKr.js";import"./useCwcsUpload-CG_XoZbx.js";import"./TaskListByCategory-Bd-xdQir.js";import"./TaskAreaNew-CVFM6VTP.js";import"./mvAgentAudioHandoff-bUl2GcuQ.js";import"./TaskVideoResultItem-B5wQ4nlu.js";import"./agentRefinePlan-DmLfrv_V.js";import"./agentConfig-DEjPhl-I.js";import"./TaskRefineWithAgentBtn-B_9jQy2N.js";import"./AddToCharacterAction-DGPX20sG.js";import"./TaskSamplePanel-BuLQZqX2.js";const Ae=["src"],Oe=["src"],Ve={key:1,ref:"scaleOptionsRef",class:"flex w-full flex-col gap-3"},Fe={class:"text-sm font-bold px-1 mt-3 text-[--color-text-dynamic-white-secondary]"},Re={class:"upscaling-factor-disabled"},Ie={key:2,ref:"scaleOptionsRef",class:"flex w-full flex-col gap-3"},Pe={class:"text-sm font-bold px-1 mt-3 text-[--color-text-dynamic-white-secondary]"},Se={class:"version-toggle-wrap grid grid-cols-2 gap-1 p-1"},Ue=["onClick"],B=1500,Me=q({__name:"ImageEnhancer",setup(G){const g=ue(),{t:s}=Ce(),T=me(),{isResultCompare:J}=ke(T),h=_(()=>!g.value&&J.value),K=_(()=>s("ai_tools.title_imageEnhancer")),R=r(!1),Q=r(["https://images.media.io/media-ui/ai-tools/img_enhancer.png","https://images.media.io/media-ui/ai-tools/portrait_enhancer.png","https://images.media.io/media-ui/ai-tools/old_photo_restoration.png","https://images.media.io/media-ui/ai-tools/color_correction.png","https://images.media.io/media-ui/ai-tools/super_resolution.png"]),d=r(2),W=[{name:"2x",value:2},{name:"4x",value:4},{name:"8x",value:8}],I=r(null),D=_(()=>{const t=I.value;return!t?.width||!t?.height?!1:Math.max(t.width,t.height)>B}),Y=t=>t===8&&D.value;function Z(t,i){I.value=i?.width&&i?.height?{width:i.width,height:i.height}:null,d.value===8&&D.value&&(d.value=4)}function ee(){I.value=null}const E=r(2),P=_(()=>E.value===2),ae=[{name:"ai_tools.smart_enhancer_mode_lite",value:1},{name:"ai_tools.smart_enhancer_mode_pro",value:2}],y=new Map([[l.imgEnhancer,l.imgEnhancerV2],[l.portraitEnhancer,l.portraitEnhancerV2],[l.restoreOldPhotos,l.restoreOldPhotosV2],[l.colorCorrection,l.colorCorrectionV2]]),L=new Set([l.imgEnhancer]),p=xe([{name:"ai_tools.smart_enhancer",icon:"image-enhancer/enhancer",value:l.imgEnhancer,hot:!0},{name:"ai_tools.portrait_enhancer",icon:"image-enhancer/portrait_enhance",value:l.portraitEnhancer,hot:!1},{name:"ai_tools.restore_old_photos",icon:"image-enhancer/old_photo_resotration",value:l.restoreOldPhotos,hot:!1},{name:"ai_tools.color_correction",icon:"image-enhancer/color_correction2",value:l.colorCorrection,hot:!1},{name:"ai_tools.image_upscaler",icon:"image-enhancer/image_upscaler",value:l.imageUpscaler,hot:!1}]);let o=r(p[0].value);const C=pe(),oe=C.fullPath.indexOf("image-upscaler")>-1,te=C.fullPath.indexOf("restore-old-photos")>-1,le=C.fullPath.indexOf("portrait-enhancer")>-1,ne=C.fullPath.indexOf("smart-color-correction")>-1;oe?o=r(p[4].value):te?o=r(p[2].value):le?o=r(p[1].value):ne?o=r(p[3].value):o=r(p[0].value);const A=r(Ee(_e)),ie=A.value[0]?.options?.ruleSet?.[0]?.maxResolution;H([o,d],([t,i])=>{const a=A.value[0]?.options;if(!a?.ruleSet?.[0])return;const c=t===l.imageUpscaler&&i===8;a.ruleSet[0].maxResolution=c?{width:B,height:B}:ie,a.maxResolutionTip=c?s("ai_tool_form.upscale_8x_resolution_limit"):""},{immediate:!0});const N=_(()=>y.has(o.value)?!L.has(o.value)||P.value:!1),se=_(()=>N.value?{bill:{items:null,title:""},val:"3",trackInfo:{aiType:l.imgEnhancer,module:S.imageEnhancer}}:{bill:{items:null,title:""},val:"2",trackInfo:{aiType:l.imgEnhancer,module:S.imageEnhancer}}),re=async()=>{try{R.value=!0;let t=A.value[0]?.value||"";
1t&&t.includes("/")&&(t=t.slice(1));const i=await fe();await i.waitForAnonSync(),t=i.resolveFileId(t);const a=o.value===l.imageUpscaler?{file_link:t,Upscale:d.value}:{file_link:t};let c=o.value;N.value&&(c=y.get(c));const ce=c,De=await ge({user_data:{data:a,algorithm:c,module:S.imageEnhancer,compareData:{originalFileId:t},credits_number:P.value&&y.has(o.value)?3:2,num:ce,name:V.get(o.value),isFromAiTools:!0,pfunction:"tool_image_enhancer",pfunction_type:"ai_tool",pfunction_display:"function"}})}finally{R.value=!1}},O=_(()=>P.value&&y.has(o.value)?y.get(o.value):o.value);return H([o,E],()=>{T.currentAiToolTplData={num:O.value,name:V.get(o.value)}},{immediate:!1}),we(()=>{T.currentAiToolTplData={num:O.value,name:V.get(o.value)},he("miai_creation_interface_expose",{pworkflow:"core_process",button:"generate",miai_unit_code:O.value,miai_unit_name:V.get(o.value),pfunction:"tool_image_enhancer",pfunction_type:"ai_tool",pfunction_display:"function"},!1,!1,!1)}),ye(()=>{T.currentAiToolTplData=null}),(t,i)=>(n(),u("div",{class:x(["image-enhancer-page-container w-full flex h-full md:gap-4",[e(g)?"flex-col px-2":"flex-row"]])},[m("div",{class:x(["flex-none flex relative max-md:w-full",[(e(h),"md:w-[480px]")]])},[v(be,{"header-title":e(K),algorithm:e(O),"form-items":e(h)?void 0:e(A),"generate-visible":!e(h),generating:e(R),"bill-info":e(se),"bill-value-custom":!0,onGenerateHandle:re,onUploadFile:Z,onClearFile:ee},{"expand-after":f(()=>[m("div",{class:x(["flex flex-col gap-3",e(h)?"mt-8 gap-3":""])},[e(h)?w("",!0):(n(),u("div",{key:0,class:x(["text-sm font-bold px-1 mt-2 mode-header",{"mode-header-phone":e(g)}])},[m("span",null,k(e(s)("ai_tools.smart_enhancer_enhancement_type")),1)],2)),v(e($),{modelValue:e(o),"onUpdate:modelValue":i[0]||(i[0]=a=>X(o)?o.value=a:o=a),title:e(s)("ai_tool_form.modeSelectTitle"),"popper-model":e(g)?"bottom":"","popper-class":"image-enhancer-select-popper",placeholder:e(s)("common.please_select")},{prefix:f(({data:a})=>[a.icon?(n(),b(e(j),{key:0,name:a.icon,width:"24",height:"24",class:"inner-icon"},null,8,["name"])):w("",!0),m("span",null,k(a.label),1),e(p).find(c=>c.value===a.value)?.hot?(n(),u("img",{key:1,src:e(z)("/app_static/hot.png"),alt:"",class:"w-10 h-5"},null,8,Ae)):w("",!0)]),default:f(()=>[(n(!0),u(F,null,M(e(p),a=>(n(),b(e(U),{key:a.value,label:e(s)(a.name),value:a.value,icon:a.icon},{icon:f(()=>[v(e(j),{name:a.icon,width:"24",height:"24",class:x([e(o)===a.value?"text-[--color-text-dynamic-white-secondary]":"text-[--color-text-dynamic-white-tertiary]"])},null,8,["name","class"])]),"text-after":f(()=>[a.hot?(n(),u("img",{key:0,src:e(z)("/app_static/hot.png"),alt:"",class:"w-10 h-5 ml-1"},null,8,Oe)):w("",!0)]),_:2},1032,["label","value","icon"]))),128))]),_:1},8,["modelValue","title","popper-model","placeholder"]),e(o)===e(l).imageUpscaler&&!e(h)?(n(),u("div",Ve,[m("div",Fe,k(e(s)("ai_tool_form.scale_title")),1),v(e($),{modelValue:e(d),"onUpdate:modelValue":i[1]||(i[1]=a=>X(d)?d.value=a:null),title:e(s)("ai_tool_form.scale_title"),"popper-model":e(g)?"bottom":"","popper-class":"image-enhancer-select-popper",placeholder:e(s)("common.please_select")},{default:f(()=>[(n(),u(F,null,M(W,a=>(n(),u(F,{key:a.value},[Y(a.value)?(n(),b(e(de),{key:0,content:e(s)("ai_tool_form.upscale_8x_resolution_limit"),placement:"top",width:280},{default:f(()=>[m("div",Re,[v(e(U),{label:a.name,value:a.value},null,8,["label","value"])])]),_:2},1032,["content"])):(n(),b(e(U),{key:1,label:a.name,value:a.value},null,8,["label","value"]))],64))),64))]),_:1},8,["modelValue","title","popper-model","placeholder"])],512)):w("",!0),e(L).has(e(o))&&!e(h)?(n(),u("div",Ie,[m("div",Pe,k(e(s)("ai_tool_form.mode")),1),m("div",Se,[(n(),u(F,null,M(ae,a=>m("div",{key:a.value,class:x(["version-toggle-item flex items-center justify-center px-2 py-2 text-sm cursor-pointer",[e(E)===a.value?"is-selected font-bold":""]]),onClick:c=>E.value=a.value},k(e(s)(a.name)),11,Ue)),64))])],512)):w("",!0)],2)]),_:1},8,["header-title","algorithm","form-items","generate-visible","generating","bill-info"])],2),v(Te,{class:"w-full","task-categories":[e(l).imageEnhancer],"sample-list":e(Q),"is-image":!0},null,8,["task-categories","sample-list"])],2))}}),Be=Object.assign(ve(Me,[["__scopeId","data-v-028f5d84"]]),{__name:"EnhancerImageEnhancer"}),ia=q({__name:"image-enhancer",setup(G){return(g,s)=>(n(),b(Be))}});
1export{ia as default};
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.