import{r as l,R as E,j as g,a as N,F as fe,w as $e}from"./index.bd3517ca.js";import{i as me,a as pe,_ as Ae,b as Ie,c as Me,d as re,e as he,u as Te,f as Re,g as Ne,h as j,m as ge,j as Q,k as je,w as te,l as T,n as A,S as Be,o as ve,p as We,q as ze,r as De,s as Ce,I as Pe,B as Ue}from"./index.c5d86e93.js";import{r as ye,a as be,b as we}from"./axios.a426b7c9.js";import"./utils.62547028.js";function ne(e){me&&(pe(e)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof e)));var r=l.exports.useRef(e);r.current=l.exports.useMemo(function(){return e},[e]);var t=l.exports.useRef();return t.current||(t.current=function(){for(var i=[],s=0;s=r||w<0||b&&k>=c}function O(){var m=Y();if(F(m))return S(m);a=setTimeout(O,_(m))}function S(m){return a=void 0,C&&i?n(m):(i=s=void 0,v)}function I(){a!==void 0&&clearTimeout(a),y=0,i=d=s=a=void 0}function f(){return a===void 0?v:S(Y())}function h(){var m=Y(),w=F(m);if(i=arguments,s=this,d=m,w){if(a===void 0)return u(d);if(b)return clearTimeout(a),a=setTimeout(O,r),n(d)}return a===void 0&&(a=setTimeout(O,r)),v}return h.cancel=I,h.flush=f,h}var Ct=vt,yt=Ct,bt=re,wt="Expected a function";function xt(e,r,t){var i=!0,s=!0;if(typeof e!="function")throw new TypeError(wt);return bt(t)&&(i="leading"in t?!!t.leading:i,s="trailing"in t?!!t.trailing:s),yt(e,r,{leading:i,maxWait:r,trailing:s})}var Lt=xt,kt=function(){var e=he(l.exports.useState({}),2),r=e[1];return l.exports.useCallback(function(){return r({})},[])},_t=kt;function Ft(e,r){var t;me&&(pe(e)||console.error("useThrottleFn expected parameter is a function, got ".concat(typeof e)));var i=Te(e),s=(t=r==null?void 0:r.wait)!==null&&t!==void 0?t:1e3,c=l.exports.useMemo(function(){return Lt(function(){for(var v=[],a=0;a{const y=typeof a=="function"?a(c.current):a;if(!(!d&&y===c.current))return c.current=y,s(),i==null?void 0:i(y)});return[c.current,v]}function At(e,r){const t=ne(e);j(()=>{const i=r.current;if(!!i)if(window.ResizeObserver){let s;const c=new ResizeObserver(()=>{s=window.requestAnimationFrame(()=>t(i))});return c.observe(i),()=>{window.cancelAnimationFrame(s),c.disconnect()}}else t(i)},[r])}function It(e,r,t){const i=ne(e);l.exports.useEffect(()=>{const s=new MutationObserver(()=>{i()});if(!!r.current)return s.observe(r.current,t),()=>{s.disconnect()}},[r])}var Le={exports:{}},p={};/** * @license React * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ie=Symbol.for("react.element"),ae=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),D=Symbol.for("react.provider"),P=Symbol.for("react.context"),Mt=Symbol.for("react.server_context"),U=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),Tt=Symbol.for("react.offscreen"),ke;ke=Symbol.for("react.module.reference");function L(e){if(typeof e=="object"&&e!==null){var r=e.$$typeof;switch(r){case ie:switch(e=e.type,e){case B:case z:case W:case q:case Z:return e;default:switch(e=e&&e.$$typeof,e){case Mt:case P:case U:case V:case K:case D:return e;default:return r}}case ae:return r}}}p.ContextConsumer=P;p.ContextProvider=D;p.Element=ie;p.ForwardRef=U;p.Fragment=B;p.Lazy=V;p.Memo=K;p.Portal=ae;p.Profiler=z;p.StrictMode=W;p.Suspense=q;p.SuspenseList=Z;p.isAsyncMode=function(){return!1};p.isConcurrentMode=function(){return!1};p.isContextConsumer=function(e){return L(e)===P};p.isContextProvider=function(e){return L(e)===D};p.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===ie};p.isForwardRef=function(e){return L(e)===U};p.isFragment=function(e){return L(e)===B};p.isLazy=function(e){return L(e)===V};p.isMemo=function(e){return L(e)===K};p.isPortal=function(e){return L(e)===ae};p.isProfiler=function(e){return L(e)===z};p.isStrictMode=function(e){return L(e)===W};p.isSuspense=function(e){return L(e)===q};p.isSuspenseList=function(e){return L(e)===Z};p.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===B||e===z||e===W||e===q||e===Z||e===Tt||typeof e=="object"&&e!==null&&(e.$$typeof===V||e.$$typeof===K||e.$$typeof===D||e.$$typeof===P||e.$$typeof===U||e.$$typeof===ke||e.getModuleId!==void 0)};p.typeOf=L;Le.exports=p;function Rt(e,r){let t=0;function i(s){E.Children.forEach(s,c=>{Le.exports.isFragment(c)?i(c.props.children):(r(c,t),t+=1)})}i(e)}const x="adm-tabs",Nt=()=>null,jt={activeLineMode:"auto",stretch:!0},Bt=e=>{var r;const t=ge(jt,e),i=l.exports.useRef(null),s=l.exports.useRef(null),c={};let v=null;const a=[];Rt(t.children,(f,h)=>{if(!E.isValidElement(f))return;const m=f.key;if(typeof m!="string")return;h===0&&(v=m);const w=a.push(f);c[m]=w-1});const[d,y]=xe({value:t.activeKey,defaultValue:(r=t.defaultActiveKey)!==null&&r!==void 0?r:v,onChange:f=>{var h;f!==null&&((h=t.onChange)===null||h===void 0||h.call(t,f))}}),[{x:o,width:b},C]=Q(()=>({x:0,width:0,config:{tension:300,clamp:!0}})),[{scrollLeft:n},u]=Q(()=>({scrollLeft:0,config:{tension:300,clamp:!0}})),[{leftMaskOpacity:_,rightMaskOpacity:F},O]=Q(()=>({leftMaskOpacity:0,rightMaskOpacity:0,config:{clamp:!0}}));function S(f=!1){const h=i.current;if(!h)return;const m=c[d];if(m===void 0){C.start({x:0,width:0,immediate:!0});return}const w=s.current;if(!w)return;const k=h.children.item(m+1),$=k.children.item(0),X=$.offsetLeft,G=$.offsetWidth,_e=k.offsetLeft,Fe=k.offsetWidth,H=h.offsetWidth,se=h.scrollWidth,Ee=h.scrollLeft,Se=w.offsetWidth;let M=0,J=0;if(t.activeLineMode==="auto"?(M=X,J=G):t.activeLineMode==="full"?(M=_e,J=Fe):M=X+(G-Se)/2,C.start({x:M,width:J,immediate:f}),se-H<=0)return;const Oe=ve(X-(H-G)/2,0,se-H);u.start({scrollLeft:Oe,from:{scrollLeft:Ee},immediate:f})}j(()=>{S(!o.isAnimating)},[]),je(()=>{S()},[d]),At(()=>{S(!o.isAnimating)},i),It(()=>{S(!o.isAnimating)},i,{subtree:!0,childList:!0,characterData:!0});const{run:I}=Ft((f=!1)=>{const h=i.current;if(!h)return;const m=h.scrollLeft,w=m>0,k=m+h.offsetWidth{I(!0)},[]),te(t,E.createElement("div",{className:x},E.createElement("div",{className:`${x}-header`},E.createElement(T.div,{className:A(`${x}-header-mask`,`${x}-header-mask-left`),style:{opacity:_}}),E.createElement(T.div,{className:A(`${x}-header-mask`,`${x}-header-mask-right`),style:{opacity:F}}),E.createElement(T.div,{className:`${x}-tab-list`,ref:i,scrollLeft:n,onScroll:I,role:"tablist"},E.createElement(T.div,{ref:s,className:`${x}-tab-line`,style:{width:t.activeLineMode==="fixed"?"var(--fixed-active-line-width, 30px)":b,x:o}}),a.map(f=>te(f.props,g("div",{className:A(`${x}-tab-wrapper`,{[`${x}-tab-wrapper-stretch`]:t.stretch}),children:g("div",{onClick:()=>{const{key:h}=f;f.props.disabled||h!=null&&y(h.toString())},className:A(`${x}-tab`,{[`${x}-tab-active`]:f.key===d,[`${x}-tab-disabled`]:f.props.disabled}),role:"tab","aria-selected":f.key===d,children:f.props.title})},f.key))))),a.map(f=>{if(f.props.children===void 0)return null;const h=f.key===d;return g(Be,{active:h,forceRender:f.props.forceRender,destroyOnClose:f.props.destroyOnClose,children:g("div",{className:`${x}-content`,style:{display:h?"block":"none"},children:f.props.children})},f.key)})))};var ee=We(Bt,{Tab:Nt});const R="adm-input",Wt={defaultValue:"",onlyShowClearWhenFocus:!0},zt=l.exports.forwardRef((e,r)=>{const t=ge(Wt,e),[i,s]=xe(t),[c,v]=l.exports.useState(!1),a=l.exports.useRef(!1),d=l.exports.useRef(null),{locale:y}=ze();l.exports.useImperativeHandle(r,()=>({clear:()=>{s("")},focus:()=>{var n;(n=d.current)===null||n===void 0||n.focus()},blur:()=>{var n;(n=d.current)===null||n===void 0||n.blur()},get nativeElement(){return d.current}}));const o=n=>{var u;t.onEnterPress&&(n.code==="Enter"||n.keyCode===13)&&t.onEnterPress(n),(u=t.onKeyDown)===null||u===void 0||u.call(t,n)};j(()=>{var n;if(!!t.enterKeyHint)return(n=d.current)===null||n===void 0||n.setAttribute("enterkeyhint",t.enterKeyHint),()=>{var u;(u=d.current)===null||u===void 0||u.removeAttribute("enterkeyhint")}},[t.enterKeyHint]);function b(){let n=i;t.type==="number"&&(n=n&&ve(parseFloat(n),t.min,t.max).toString()),n!==i&&s(n)}const C=(()=>!t.clearable||!i||t.readOnly?!1:t.onlyShowClearWhenFocus?c:!0)();return te(t,N("div",{className:A(`${R}`,t.disabled&&`${R}-disabled`),children:[g("input",{ref:d,className:`${R}-element`,value:i,onChange:n=>{s(n.target.value)},onFocus:n=>{var u;v(!0),(u=t.onFocus)===null||u===void 0||u.call(t,n)},onBlur:n=>{var u;v(!1),b(),(u=t.onBlur)===null||u===void 0||u.call(t,n)},id:t.id,placeholder:t.placeholder,disabled:t.disabled,readOnly:t.readOnly,maxLength:t.maxLength,minLength:t.minLength,max:t.max,min:t.min,autoComplete:t.autoComplete,autoFocus:t.autoFocus,pattern:t.pattern,inputMode:t.inputMode,type:t.type,name:t.name,autoCapitalize:t.autoCapitalize,autoCorrect:t.autoCorrect,onKeyDown:o,onKeyUp:t.onKeyUp,onCompositionStart:n=>{var u;a.current=!0,(u=t.onCompositionStart)===null||u===void 0||u.call(t,n)},onCompositionEnd:n=>{var u;a.current=!1,(u=t.onCompositionEnd)===null||u===void 0||u.call(t,n)},onClick:t.onClick,step:t.step,role:t.role,"aria-valuenow":t["aria-valuenow"],"aria-valuemax":t["aria-valuemax"],"aria-valuemin":t["aria-valuemin"],"aria-label":t["aria-label"]}),C&&g("div",{className:`${R}-clear`,onMouseDown:n=>{n.preventDefault()},onClick:()=>{var n,u;s(""),(n=t.onClear)===null||n===void 0||n.call(t),De()&&a.current&&(a.current=!1,(u=d.current)===null||u===void 0||u.blur())},"aria-label":y.Input.clear,children:g(Ot,{})})]}))});var Dt=zt;function ue(e){const{messages:r}=e;return g(fe,{children:g("div",{className:"chat-container",children:r&&r.map(t=>g("div",{className:t.type==="0"?"chat-container-msg-content-right":"chat-container-msg-content-left",children:g("div",{className:"chat-container-msg",children:t.value})}))})})}const Pt=e=>{let r={url:be.searchURL,data:{engine:"baidu",q:e,api_key:"83df36ff90429072fcd39b47811df999a8ed942f4f2492225fe6a7f494a07935"}};return ye.get(r)},Ut=e=>{let r={url:`${be.itemFilterURL}/output-images/`,data:{populate:"images",["filters[item_id][$eq]"]:e},header:{Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNjgwNDU1MTk2LCJleHAiOjE2ODMwNDcxOTZ9.aGgsBDn8uo5pxqINwms6doMU_EfF9rzkm96ZUsXuy0M"}};return ye.get(r)},qt="A young lady is wearing a beige knit sweater, a black shirt, black suit pants and a black blazer for a professional yet soft look.",Zt="\u8FD9\u5957\u642D\u914D\u5145\u5206\u8003\u8651\u5230\u4E86\u5929\u6C14\u3001\u6E29\u5EA6\u3001\u5DE5\u4F5C\u573A\u666F\u548C\u67D4\u548C\u98CE\u683C\uFF0C\u5C55\u73B0\u4E86\u4F60\u7684\u4E2A\u6027\u548C\u54C1\u5473\u3002\u7C73\u8272\u9488\u7EC7\u6BDB\u8863\u5916\u642D\u767D\u8272\u886C\u886B\uFF0C\u6253\u9020\u6E29\u99A8\u67D4\u548C\u7684\u611F\u89C9\uFF0C\u540C\u65F6\u642D\u914D\u9ED1\u8272\u9AD8\u8170\u5BBD\u817F\u88E4\uFF0C\u5C55\u73B0\u804C\u573A\u4F18\u96C5\u6C14\u8D28\u3002\u5916\u642D\u4E00\u4EF6\u9ED1\u8272\u897F\u88C5\u5916\u5957\uFF0C\u4F7F\u6574\u4F53\u9020\u578B\u66F4\u52A0\u804C\u573A\u6B63\u5F0F\uFF0C\u53C8\u4E0D\u5931\u67D4\u548C\u98CE\u683C\u3002";var de={description:qt,explanation:Zt,"item in the closet":[{id:"white-t-shirt",item:"Beige knit sweater"},{id:"white-t-shirt",item:"Black blazer"}],"item not in the closet":["black shirt","black suit pants"]};function Kt(){const[e,r]=l.exports.useState([]),t=()=>new Promise((s,c)=>{const v=de["item in the closet"].map(a=>Ut(a==null?void 0:a.id));Promise.all(v).then(a=>{const d=a.map(y=>{var C,n,u,_;const o=y==null?void 0:y.data[0],b={id:o==null?void 0:o.id,url:((_=(u=(n=(C=o==null?void 0:o.attributes)==null?void 0:C.images)==null?void 0:n.data[0])==null?void 0:u.attributes)==null?void 0:_.url)||"",from:"closet",link:""};return b.url=`http://106.52.238.44:8080${b.url}`,b});s(d)}).catch(a=>c(a))}),i=()=>{const s=de["item not in the closet"].map(c=>Pt(c));return new Promise((c,v)=>{Promise.all(s).then(a=>{const d=[];a.forEach(y=>{var b,C,n,u,_;const o=y==null?void 0:y.organic_results[2];if(o){if(o!=null&&o.related_images){const F={id:((C=(b=o==null?void 0:o.related_images)==null?void 0:b[0])==null?void 0:C.link)||"",url:((u=(n=o==null?void 0:o.related_images)==null?void 0:n[0])==null?void 0:u.image)||"",from:"not closet",link:((_=o==null?void 0:o.related_images[0])==null?void 0:_.link)||""};d.push(F)}else if(o!=null&&o.thumbnail){const F={id:(o==null?void 0:o.link)||"",url:(o==null?void 0:o.thumbnail)||"",from:"not closet",link:(o==null?void 0:o.link)||""};d.push(F)}}}),c(d)}).catch(a=>v(a))})};return l.exports.useEffect(()=>{(async()=>{const c=await t(),v=await i();r([...e,...c,...v])})()},[]),g(fe,{children:g("div",{className:"search-container",children:g("div",{className:"search-container-image",children:g(Ce,{wrap:!0,children:e.map(s=>g(Pe,{src:s.url},s.id))})})})})}const Vt=e=>{let r={url:"https://wef4y-stable-diffusion-webui-controlnet-docker.hf.space/sdapi/v1/txt2img",data:{prompt:"(8k, RAW photo, best quality, masterpiece:1.2), (realistic, photo-realistic:1.37),(Kpop idol), (aegyo sal:1), cute, professional lighting, photon mapping, radiosity, physically-based rendering, , standing,(simple white background:1.3),Fujifilm XT3,"+e,enable_hr:!1,denoising_strength:.7,firstphase_width:0,firstphase_height:0,hr_scale:2,hr_upscaler:"",hr_second_pass_steps:0,hr_resize_x:0,hr_resize_y:0,styles:[],seed:-1,subseed:-1,subseed_strength:0,seed_resize_from_h:-1,seed_resize_from_w:-1,sampler_name:"DPM++ SDE Karras",batch_size:1,n_iter:1,steps:24,cfg_scale:8,width:512,height:768,restore_faces:!1,tiling:!1,negative_prompt:"paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans, lowres,bad anatomy,bad hands, text, error, missing fingers,extra digit, fewer digits, cropped, worstquality, low quality, normal quality,jpegartifacts,signature, watermark, username,blurry,bad feet,cropped,poorly drawn hands,poorly drawn face,mutation,deformed,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,extra fingers,fewer digits,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,polar lowres,bad body,bad proportions,gross proportions,text,error,missing fingers,missing arms,missing legs,extra digit,wrinkle, NSFW, nude",eta:0,s_churn:0,s_tmax:0,s_tmin:0,s_noise:1,override_settings:{},override_settings_restore_afterwards:!0,script_args:[],sampler_index:"DPM++ SDE Karras"},header:{Authorization:"Bearer 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"}};return we.post(r.url,r.data,{timeout:3e7,headers:{"Content-Type":"application/json;charset=UTF-8","with-credentials":!0,...r.header}})},Xt=e=>{const r={url:"https://wef4y-chat-js-server.hf.space/api/chat",data:{input:e},header:{Authorization:"Bearer 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"}};return we.post(r.url,r.data,{timeout:3e7,headers:{"Content-Type":"application/json;charset=UTF-8","with-credentials":!0,...r.header}})};var Gt="./assets/defaultImage.6ddd0d30.png";function Ht(e){const[r,t]=l.exports.useState(Gt),[i,s]=l.exports.useState(!1),[c,v]=l.exports.useState(""),[a,d]=l.exports.useState([]),[y,o]=l.exports.useState(!0),b=()=>{c!==""&&(d(C=>[...C,{type:"0",value:c}]),v(""),Xt(c).then(C=>{setTimeout(()=>{d(n=>{var u;return[...n,{type:"1",value:((u=C.data)==null?void 0:u.response)||""}]})},30)}))};return l.exports.useEffect(()=>{Vt("A young lady is wearing a white button-down shirt, a black midi skirt, light brown pumps, and a beige trench coat for a professional and elegant look.").then(C=>{C&&t("data:image/png;base64,"+C.data.images[0])})},[]),N("div",{className:"home",style:{backgroundImage:`url(${r})`},children:[g(Et,{fontSize:32,onClick:()=>s(!i)}),!i&&N(ee,{onChange:C=>{o(C==="chat")},children:[g(ee.Tab,{title:"\u7A7F\u642D",children:g(ue,{messages:a})},"chat"),g(ee.Tab,{title:"\u5355\u54C1",children:g(Kt,{})},"recommend")]}),i&&y&&g(ue,{messages:a}),y&&g("div",{className:"chat-container-input",children:N(Ce,{children:[g(St,{fontSize:24}),g(Dt,{placeholder:"\u8F93\u5165\u6587\u5B57",value:c,onChange:C=>{v(C)},onEnterPress:b}),g(Ue,{onClick:b,children:g($t,{fontSize:24})})]})})]})}var rr=$e(Ht);export{rr as default};