2 lines
9.8 KiB
JavaScript
2 lines
9.8 KiB
JavaScript
var x=(e,t,r)=>new Promise((f,s)=>{var i=n=>{try{u(r.next(n))}catch(d){s(d)}},l=n=>{try{u(r.throw(n))}catch(d){s(d)}},u=n=>n.done?f(n.value):Promise.resolve(n.value).then(i,l);u((r=r.apply(e,t)).next())});import{g as W}from"./index-rGiEpfDR.js";import{_ as X}from"./index.vue_vue_type_script_setup_true_lang-28AeU4-K.js";import{_ as G}from"./index.vue_vue_type_script_setup_true_lang-spiX5Hkk.js";import{_ as J}from"./list.vue_vue_type_script_setup_true_lang-BOv_03QY.js";import{_ as Y}from"./index.vue_vue_type_script_setup_true_lang-CuYXsMrM.js";import{_ as q}from"./index.vue_vue_type_script_setup_true_lang-CKw4LUC2.js";import{m as Q,aF as K,_ as c,r as Z,s as k,l as $,b0 as ee,bM as te,bN as ae,i as oe,y as le,j as P,h as H,bO as A,bP as ne,I as T,g as ie,bQ as re,bR as se}from"./bootstrap-CvQmCMXe.js";import{m as D,b9 as g,w as de,aa as N,aW as ue,j as v,n as j,bl as O,v as me,ab as w,b2 as R,bJ as ce,ae as I,u as E,ac as M}from"../jse/index-index-CAIAj58w.js";import{_ as fe}from"./page.vue_vue_type_script_setup_true_lang-DpWvHppH.js";import{a as p,A as ve}from"./biz-ai-enum-CqA6Ev1u.js";import"./index-BagzF1_1.js";import"./index-N1LaNM7Z.js";import"./AlertBuilder-ywMKWwtZ.js";import"./circle-check-big-CU1CMFMA.js";import"./x-B6h5hUdY.js";import"./card.vue_vue_type_script_setup_true_lang-CksWkBQy.js";import"./detail.vue_vue_type_script_setup_true_lang-CaiiBfKr.js";import"./use-drawer-DQzS3pNb.js";function L(e,t){return{[`${e}, ${e}:hover, ${e}:focus`]:{color:t.colorTextDisabled,cursor:"not-allowed"}}}function B(e){return{backgroundColor:e.bgColorSelected,boxShadow:e.boxShadow}}const be=c({overflow:"hidden"},k),ge=e=>{const{componentCls:t}=e;return{[t]:c(c(c(c(c({},Z(e)),{display:"inline-block",padding:e.segmentedContainerPadding,color:e.labelColor,backgroundColor:e.bgColor,borderRadius:e.borderRadius,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,[`${t}-group`]:{position:"relative",display:"flex",alignItems:"stretch",justifyItems:"flex-start",width:"100%"},[`&${t}-rtl`]:{direction:"rtl"},[`&${t}-block`]:{display:"flex"},[`&${t}-block ${t}-item`]:{flex:1,minWidth:0},[`${t}-item`]:{position:"relative",textAlign:"center",cursor:"pointer",transition:`color ${e.motionDurationMid} ${e.motionEaseInOut}`,borderRadius:e.borderRadiusSM,"&-selected":c(c({},B(e)),{color:e.labelColorHover}),"&::after":{content:'""',position:"absolute",width:"100%",height:"100%",top:0,insetInlineStart:0,borderRadius:"inherit",transition:`background-color ${e.motionDurationMid}`,pointerEvents:"none"},[`&:hover:not(${t}-item-selected):not(${t}-item-disabled)`]:{color:e.labelColorHover,"&::after":{backgroundColor:e.bgColorHover}},"&-label":c({minHeight:e.controlHeight-e.segmentedContainerPadding*2,lineHeight:`${e.controlHeight-e.segmentedContainerPadding*2}px`,padding:`0 ${e.segmentedPaddingHorizontal}px`},be),"&-icon + *":{marginInlineStart:e.marginSM/2},"&-input":{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:0,opacity:0,pointerEvents:"none"}},[`${t}-thumb`]:c(c({},B(e)),{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:"100%",padding:`${e.paddingXXS}px 0`,borderRadius:e.borderRadiusSM,[`& ~ ${t}-item:not(${t}-item-selected):not(${t}-item-disabled)::after`]:{backgroundColor:"transparent"}}),[`&${t}-lg`]:{borderRadius:e.borderRadiusLG,[`${t}-item-label`]:{minHeight:e.controlHeightLG-e.segmentedContainerPadding*2,lineHeight:`${e.controlHeightLG-e.segmentedContainerPadding*2}px`,padding:`0 ${e.segmentedPaddingHorizontal}px`,fontSize:e.fontSizeLG},[`${t}-item, ${t}-thumb`]:{borderRadius:e.borderRadius}},[`&${t}-sm`]:{borderRadius:e.borderRadiusSM,[`${t}-item-label`]:{minHeight:e.controlHeightSM-e.segmentedContainerPadding*2,lineHeight:`${e.controlHeightSM-e.segmentedContainerPadding*2}px`,padding:`0 ${e.segmentedPaddingHorizontalSM}px`},[`${t}-item, ${t}-thumb`]:{borderRadius:e.borderRadiusXS}}}),L(`&-disabled ${t}-item`,e)),L(`${t}-item-disabled`,e)),{[`${t}-thumb-motion-appear-active`]:{transition:`transform ${e.motionDurationSlow} ${e.motionEaseInOut}, width ${e.motionDurationSlow} ${e.motionEaseInOut}`,willChange:"transform, width"}})}},he=Q("Segmented",e=>{const{lineWidthBold:t,lineWidth:r,colorTextLabel:f,colorText:s,colorFillSecondary:i,colorBgLayout:l,colorBgElevated:u}=e,n=K(e,{segmentedPaddingHorizontal:e.controlPaddingHorizontal-r,segmentedPaddingHorizontalSM:e.controlPaddingHorizontalSM-r,segmentedContainerPadding:t,labelColor:f,labelColorHover:s,bgColor:l,bgColorHover:i,bgColorSelected:u});return[ge(n)]}),z=e=>e?{left:e.offsetLeft,right:e.parentElement.clientWidth-e.clientWidth-e.offsetLeft,width:e.clientWidth}:null,C=e=>e!==void 0?`${e}px`:void 0,pe=D({props:{value:$(),getValueIndex:$(),prefixCls:$(),motionName:$(),onMotionStart:$(),onMotionEnd:$(),direction:$(),containerRef:$()},emits:["motionStart","motionEnd"],setup(e,t){let{emit:r}=t;const f=g(),s=a=>{var o;const _=e.getValueIndex(a),y=(o=e.containerRef.value)===null||o===void 0?void 0:o.querySelectorAll(`.${e.prefixCls}-item`)[_];return(y==null?void 0:y.offsetParent)&&y},i=g(null),l=g(null);de(()=>e.value,(a,o)=>{const _=s(o),y=s(a),U=z(_),F=z(y);i.value=U,l.value=F,r(_&&y?"motionStart":"motionEnd")},{flush:"post"});const u=N(()=>{var a,o;return e.direction==="rtl"?C(-((a=i.value)===null||a===void 0?void 0:a.right)):C((o=i.value)===null||o===void 0?void 0:o.left)}),n=N(()=>{var a,o;return e.direction==="rtl"?C(-((a=l.value)===null||a===void 0?void 0:a.right)):C((o=l.value)===null||o===void 0?void 0:o.left)});let d;const b=a=>{clearTimeout(d),j(()=>{a&&(a.style.transform="translateX(var(--thumb-start-left))",a.style.width="var(--thumb-start-width)")})},h=a=>{d=setTimeout(()=>{a&&(te(a,`${e.motionName}-appear-active`),a.style.transform="translateX(var(--thumb-active-left))",a.style.width="var(--thumb-active-width)")})},m=a=>{i.value=null,l.value=null,a&&(a.style.transform=null,a.style.width=null,ae(a,`${e.motionName}-appear-active`)),r("motionEnd")},S=N(()=>{var a,o;return{"--thumb-start-left":u.value,"--thumb-start-width":C((a=i.value)===null||a===void 0?void 0:a.width),"--thumb-active-left":n.value,"--thumb-active-width":C((o=l.value)===null||o===void 0?void 0:o.width)}});return ue(()=>{clearTimeout(d)}),()=>{const a={ref:f,style:S.value,class:[`${e.prefixCls}-thumb`]};return v(ee,{appear:!0,onBeforeEnter:b,onEnter:h,onAfterEnter:m},{default:()=>[!i.value||!l.value?null:v("div",a,null)]})}}});function Se(e){return e.map(t=>typeof t=="object"&&t!==null?t:{label:t==null?void 0:t.toString(),title:t==null?void 0:t.toString(),value:t})}const $e=()=>({prefixCls:String,options:ie(),block:T(),disabled:T(),size:ne(),value:c(c({},re([String,Number])),{required:!0}),motionName:String,onChange:A(),"onUpdate:value":A()}),V=(e,t)=>{let{slots:r,emit:f}=t;const{value:s,disabled:i,payload:l,title:u,prefixCls:n,label:d=r.label,checked:b,className:h}=e,m=S=>{i||f("change",S,s)};return v("label",{class:H({[`${n}-item-disabled`]:i},h)},[v("input",{class:`${n}-item-input`,type:"radio",disabled:i,checked:b,onChange:m},null),v("div",{class:`${n}-item-label`,title:typeof u=="string"?u:""},[typeof d=="function"?d({value:s,disabled:i,payload:l,title:u}):d!=null?d:s])])};V.inheritAttrs=!1;const ye=D({name:"ASegmented",inheritAttrs:!1,props:oe($e(),{options:[],motionName:"thumb-motion"}),slots:Object,setup(e,t){let{emit:r,slots:f,attrs:s}=t;const{prefixCls:i,direction:l,size:u}=le("segmented",e),[n,d]=he(i),b=O(),h=O(!1),m=N(()=>Se(e.options)),S=(a,o)=>{e.disabled||(r("update:value",o),r("change",o))};return()=>{const a=i.value;return n(v("div",P(P({},s),{},{class:H(a,{[d.value]:!0,[`${a}-block`]:e.block,[`${a}-disabled`]:e.disabled,[`${a}-lg`]:u.value=="large",[`${a}-sm`]:u.value=="small",[`${a}-rtl`]:l.value==="rtl"},s.class),ref:b}),[v("div",{class:`${a}-group`},[v(pe,{containerRef:b,prefixCls:a,value:e.value,motionName:`${a}-${e.motionName}`,direction:l.value,getValueIndex:o=>m.value.findIndex(_=>_.value===o),onMotionStart:()=>{h.value=!0},onMotionEnd:()=>{h.value=!1}},null),m.value.map(o=>v(V,P(P({key:o.value,prefixCls:a,checked:o.value===e.value,onChange:S},o),{},{className:H(o.className,`${a}-item`,{[`${a}-item-selected`]:o.value===e.value&&!h.value}),disabled:!!e.disabled||!!o.disabled}),f))])]))}}}),_e=se(ye),Ce={class:"absolute inset-0 m-4 flex h-full w-full flex-row"},xe={class:"left-0 mr-4 flex w-96 flex-col rounded-lg bg-card p-4"},we={class:"flex justify-center"},Re={class:"mt-8 h-full overflow-y-auto"},Ie={class:"flex-1 bg-card"},Je=D({__name:"index",setup(e){const t=g(),r=g(),f=g(),s=g(),i=g(),l=g("common"),u=[{label:"通用",value:"common"},{label:"DALL3 绘画",value:p.OPENAI},{label:"MJ 绘画",value:p.MIDJOURNEY},{label:"SD 绘图",value:p.STABLE_DIFFUSION}],n=g([]);function d(){return x(this,null,function*(){})}function b(){return x(this,null,function*(){yield t.value.getImageList()})}function h(m){return x(this,null,function*(){switch(l.value=m.platform,yield j(),m.platform){case p.MIDJOURNEY:{f.value.settingValues(m);break}case p.OPENAI:{r.value.settingValues(m);break}case p.STABLE_DIFFUSION:{s.value.settingValues(m);break}}})}return me(()=>x(null,null,function*(){n.value=yield W(ve.IMAGE)})),(m,S)=>(R(),w(E(fe),{"auto-content-height":""},{default:ce(()=>[I("div",Ce,[I("div",xe,[I("div",we,[v(E(_e),{value:l.value,"onUpdate:value":S[0]||(S[0]=a=>l.value=a),options:u},null,8,["value"])]),I("div",Re,[l.value==="common"?(R(),w(X,{key:0,ref_key:"commonRef",ref:i,models:n.value,onOnDrawComplete:b},null,8,["models"])):M("",!0),l.value===E(p).OPENAI?(R(),w(G,{key:1,ref_key:"dall3Ref",ref:r,models:n.value,onOnDrawStart:d,onOnDrawComplete:b},null,8,["models"])):M("",!0),l.value===E(p).MIDJOURNEY?(R(),w(Y,{key:2,ref_key:"midjourneyRef",ref:f,models:n.value},null,8,["models"])):M("",!0),l.value===E(p).STABLE_DIFFUSION?(R(),w(q,{key:3,ref_key:"stableDiffusionRef",ref:s,models:n.value,onOnDrawComplete:b},null,8,["models"])):M("",!0)])]),I("div",Ie,[v(J,{ref_key:"imageListRef",ref:t,onOnRegeneration:h},null,512)])])]),_:1}))}});export{Je as default};
|