"use strict";(globalThis.webpackChunkinfinity_hitab_client=globalThis.webpackChunkinfinity_hitab_client||[]).push([[4699],{93863:(e,t,i)=>{i.d(t,{Cu:()=>n,Pn:()=>o,bL:()=>s,vr:()=>l});var r=i(74003),a=i(79664);const s=async e=>{try{const t=await a.hj.get(`${r.H}art/models`,{},{_auth:!!e,timeout:3e5});return 0===t.code&&t.data?[null,t.data]:[t.message]}catch(e){return["网络错误，请重试"]}},l=e=>{const t=new AbortController;return[a.hj.post(`${r.H}art/generate`,e,{_auth:!0,timeout:3e5,controller:t}),t]},o=e=>{const t=new AbortController;return[a.hj.post(`${r.H}art/query`,e,{_auth:!0,timeout:3e5,controller:t}),t]},n=async e=>{try{const t=await a.hj.get(`${r.H}art/history`,e,{_auth:!0,timeout:3e5});return 0===t.code&&t.data?[null,t.data]:[t.message]}catch(e){return["网络错误，请重试"]}}},4699:(e,t,i)=>{i.r(t),i.d(t,{CurrentPage:()=>m,getThumbImage:()=>b,useAiDrawStore:()=>p});var r=i(84522),a=i(10435),s=i(5818),l=i(5900),o=i(93863),n=i(45503),c=i(32990),h=i(95329),d=i(96643),u=i(17319),g=i(62731);const m={Welcome:"welcome",Records:"records"},b=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/thumb512";return e.replace(/\/origin$/,t)},p=(0,a.Q_)(r.BU.aiDraw,{syncStorage:{watch:["modelList"]},state:()=>({modalShow:!1,modalFullScreen:!1,currentPage:m.Records,containerRect:{w:g.Pe.w,h:g.Pe.h},recordsLoading:!1,records:[],recordsLastId:"",recordsPageSize:20,showLargePic:!1,largePicUrl:"",input:"",pictureList:[],fidelity:l.sy[2],imageSize:{...l.MO},modelList:[],currentModel:null,generateCount:l.Oz[2],padList:[]}),getters:{},actions:{setModal(e){this.modalShow=e},setModalFullScreen(e){this.modalFullScreen=e},setShowLargePic(e,t){this.showLargePic=e,this.largePicUrl=t},setContainerRect(e){this.containerRect=e},async fetchImagineList(e){if(!(0,h.useUserStore)().isLogin)return this.currentPage=m.Welcome;this.recordsLoading=!0;const t={pageSize:this.recordsPageSize,key:"",...e||{}},[i,r]=await(0,o.Cu)(t);if(i||!r)return void(this.recordsLoading=!1);this.recordsLoading=!1;const{list:a,lastId:s}=r;return t.lastId?this.records=[...a.reverse(),...this.records]:(this.records=[...a.reverse()],setTimeout((()=>n.u.emit(c.e)))),this.recordsLastId=s,t.key||this.records.length?this.currentPage=m.Records:this.currentPage=m.Welcome,r},async upload(e){const[t,i]=await(0,d.Et)("user-art",e);if(!t&&i)return this.addToPictureList(i),!0;u.R.fail({message:"上传失败"})},addToPictureList(e){if(!e)return;this.pictureList.find((t=>t.imageUrl===e))||(this.pictureList=[{imageUrl:e}])},async getDrawModels(){var e;null!==(e=this.modelList)&&void 0!==e&&e.length&&(this.currentModel=this.modelList.find((e=>!e.disabled))||this.modelList[0]);const t=(0,h.useUserStore)(),[i,r]=await(0,o.bL)(t.isLogin);!i&&r&&(this.modelList=r.list||[],this.currentModel=this.modelList.find((e=>!e.disabled))||this.modelList[0])},replacePromptInInput(e){const t=this.input,[i]=(0,s.vK)(t);this.input=t.replace(i,`${e}${i?"":" "}`)},replaceParamsInInput(e){const t=this.input,[,i]=(0,s.vK)(t),r=i.find((t=>t[0]===e[0]));let a=` --${e[0]} ${e[1]}`;if(!r)return t||(a=a.trim()),this.input+=a;const l=` --${r[0]} ${r[1]}`;this.input=` ${t}`.replace(l,a).trimStart()}}})},5900:(e,t,i)=>{i.d(t,{Al:()=>u,MO:()=>s,OF:()=>c,Oz:()=>l,VB:()=>h,_G:()=>d,iu:()=>a,lj:()=>r,qs:()=>o,sy:()=>n});const r={0:{label:"1:2",width:36,height:72},10:{label:"9:16",width:40,height:72},20:{label:"2:3",width:48,height:72},30:{label:"3:4",width:54,height:72},40:{label:"5:6",width:60,height:72},50:{label:"1:1",width:72,height:72},60:{label:"6:5",width:72,height:60},70:{label:"4:3",width:72,height:54},80:{label:"3:2",width:72,height:48},90:{label:"16:9",width:72,height:40},100:{label:"2:1",width:72,height:36}},a={Portrait:"portrait",Square:"square",Landscape:"landscape"},s={type:a.Square,sliderValue:50,label:"1:1"},l=[{label:"4张",value:4},{label:"2张",value:2},{label:"1张",value:1}],o={ratio:{key:"ratio",label:"比例"},fidelity:{key:"fidelity",label:"参考强度"}},n=[{label:"强",value:1},{label:"较强",value:.75},{label:"中等",value:.5},{label:"较弱",value:.25},{label:"弱",value:0}],c="upscale",h="upscale_",d="variation",u="pad-picture"},45503:(e,t,i)=>{i.d(t,{u:()=>s});var r=i(59391);let a;!function(e){e.showReloadPage="showReloadPage",e.passModified="passModified"}(a||(a={}));const s=(0,r.Z)()},32990:(e,t,i)=>{i.d(t,{e:()=>a,u:()=>r});const r="imagine-query-task",a="imagine-to-bottom"},5818:(e,t,i)=>{i.d(t,{vK:()=>a});const r=/^--(chaos|ar|style|stylize|weird|v|niji|fast|cref|sref|speed|turbo|relax|q|quality)$/;function a(e){if("string"!=typeof e)return["",[]];const t=e.split(" "),i=Symbol(),a=Symbol(),s=[];let l=i,o="",n=null;return t.forEach((e=>{const t=r.test(e);if(t&&l===i&&(l=a),l===i)return o+=` ${e}`;if(l===a){if(t)return n=[e.slice(2),""],void s.push(n);if(0===n.length)return;n[1]=n[1]?n[1]+` ${e}`:e}})),[o.trim(),s]}}}]);