import{r as u,R as E,j as v,a as M,F as fe,w as $e}from"./index.2b3b4b39.js";import{i as de,a as me,_ as Oe,b as Ae,c as Ie,d as re,e as pe,u as Me,f as _e,g as Te,h as j,m as he,j as Q,k as Re,w as te,l as R,n as I,S as Ne,o as ve,p as je,q as Be,r as We,s as ge,B as Pe,I as ze}from"./index.ece07dcd.js";import{a as De,r as ye,b as Ce}from"./axios.1fa0e28b.js";import"./utils.62547028.js";function ne(e){de&&(me(e)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof e)));var r=u.exports.useRef(e);r.current=u.exports.useMemo(function(){return e},[e]);var t=u.exports.useRef();return t.current||(t.current=function(){for(var i=[],a=0;a=r||b<0||C&&k>=o}function O(){var m=Y();if(S(m))return $(m);s=setTimeout(O,F(m))}function $(m){return s=void 0,x&&i?n(m):(i=a=void 0,g)}function _(){s!==void 0&&clearTimeout(s),y=0,i=f=a=s=void 0}function d(){return s===void 0?g:$(Y())}function h(){var m=Y(),b=S(m);if(i=arguments,a=this,f=m,b){if(s===void 0)return c(f);if(C)return clearTimeout(s),s=setTimeout(O,r),n(f)}return s===void 0&&(s=setTimeout(O,r)),g}return h.cancel=_,h.flush=d,h}var gt=vt,yt=gt,Ct=re,bt="Expected a function";function xt(e,r,t){var i=!0,a=!0;if(typeof e!="function")throw new TypeError(bt);return Ct(t)&&(i="leading"in t?!!t.leading:i,a="trailing"in t?!!t.trailing:a),yt(e,r,{leading:i,maxWait:r,trailing:a})}var wt=xt,Lt=function(){var e=pe(u.exports.useState({}),2),r=e[1];return u.exports.useCallback(function(){return r({})},[])},kt=Lt;function Ft(e,r){var t;de&&(me(e)||console.error("useThrottleFn expected parameter is a function, got ".concat(typeof e)));var i=Me(e),a=(t=r==null?void 0:r.wait)!==null&&t!==void 0?t:1e3,o=u.exports.useMemo(function(){return wt(function(){for(var g=[],s=0;s{const y=typeof s=="function"?s(o.current):s;if(!(!f&&y===o.current))return o.current=y,a(),i==null?void 0:i(y)});return[o.current,g]}function Ot(e,r){const t=ne(e);j(()=>{const i=r.current;if(!!i)if(window.ResizeObserver){let a;const o=new ResizeObserver(()=>{a=window.requestAnimationFrame(()=>t(i))});return o.observe(i),()=>{window.cancelAnimationFrame(a),o.disconnect()}}else t(i)},[r])}function At(e,r,t){const i=ne(e);u.exports.useEffect(()=>{const a=new MutationObserver(()=>{i()});if(!!r.current)return a.observe(r.current,t),()=>{a.disconnect()}},[r])}var xe={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"),P=Symbol.for("react.profiler"),z=Symbol.for("react.provider"),D=Symbol.for("react.context"),It=Symbol.for("react.server_context"),U=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),Mt=Symbol.for("react.offscreen"),we;we=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 P:case W:case K:case V:return e;default:switch(e=e&&e.$$typeof,e){case It:case D:case U:case H:case Z:case z:return e;default:return r}}case ae:return r}}}p.ContextConsumer=D;p.ContextProvider=z;p.Element=ie;p.ForwardRef=U;p.Fragment=B;p.Lazy=H;p.Memo=Z;p.Portal=ae;p.Profiler=P;p.StrictMode=W;p.Suspense=K;p.SuspenseList=V;p.isAsyncMode=function(){return!1};p.isConcurrentMode=function(){return!1};p.isContextConsumer=function(e){return L(e)===D};p.isContextProvider=function(e){return L(e)===z};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)===H};p.isMemo=function(e){return L(e)===Z};p.isPortal=function(e){return L(e)===ae};p.isProfiler=function(e){return L(e)===P};p.isStrictMode=function(e){return L(e)===W};p.isSuspense=function(e){return L(e)===K};p.isSuspenseList=function(e){return L(e)===V};p.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===B||e===P||e===W||e===K||e===V||e===Mt||typeof e=="object"&&e!==null&&(e.$$typeof===H||e.$$typeof===Z||e.$$typeof===z||e.$$typeof===D||e.$$typeof===U||e.$$typeof===we||e.getModuleId!==void 0)};p.typeOf=L;xe.exports=p;function _t(e,r){let t=0;function i(a){E.Children.forEach(a,o=>{xe.exports.isFragment(o)?i(o.props.children):(r(o,t),t+=1)})}i(e)}const w="adm-tabs",Tt=()=>null,Rt={activeLineMode:"auto",stretch:!0},Nt=e=>{var r;const t=he(Rt,e),i=u.exports.useRef(null),a=u.exports.useRef(null),o={};let g=null;const s=[];_t(t.children,(d,h)=>{if(!E.isValidElement(d))return;const m=d.key;if(typeof m!="string")return;h===0&&(g=m);const b=s.push(d);o[m]=b-1});const[f,y]=be({value:t.activeKey,defaultValue:(r=t.defaultActiveKey)!==null&&r!==void 0?r:g,onChange:d=>{var h;d!==null&&((h=t.onChange)===null||h===void 0||h.call(t,d))}}),[{x:l,width:C},x]=Q(()=>({x:0,width:0,config:{tension:300,clamp:!0}})),[{scrollLeft:n},c]=Q(()=>({scrollLeft:0,config:{tension:300,clamp:!0}})),[{leftMaskOpacity:F,rightMaskOpacity:S},O]=Q(()=>({leftMaskOpacity:0,rightMaskOpacity:0,config:{clamp:!0}}));function $(d=!1){const h=i.current;if(!h)return;const m=o[f];if(m===void 0){x.start({x:0,width:0,immediate:!0});return}const b=a.current;if(!b)return;const k=h.children.item(m+1),A=k.children.item(0),X=A.offsetLeft,q=A.offsetWidth,Le=k.offsetLeft,ke=k.offsetWidth,G=h.offsetWidth,oe=h.scrollWidth,Fe=h.scrollLeft,Se=b.offsetWidth;let T=0,J=0;if(t.activeLineMode==="auto"?(T=X,J=q):t.activeLineMode==="full"?(T=Le,J=ke):T=X+(q-Se)/2,x.start({x:T,width:J,immediate:d}),oe-G<=0)return;const Ee=ve(X-(G-q)/2,0,oe-G);c.start({scrollLeft:Ee,from:{scrollLeft:Fe},immediate:d})}j(()=>{$(!l.isAnimating)},[]),Re(()=>{$()},[f]),Ot(()=>{$(!l.isAnimating)},i),At(()=>{$(!l.isAnimating)},i,{subtree:!0,childList:!0,characterData:!0});const{run:_}=Ft((d=!1)=>{const h=i.current;if(!h)return;const m=h.scrollLeft,b=m>0,k=m+h.offsetWidth{_(!0)},[]),te(t,E.createElement("div",{className:w},E.createElement("div",{className:`${w}-header`},E.createElement(R.div,{className:I(`${w}-header-mask`,`${w}-header-mask-left`),style:{opacity:F}}),E.createElement(R.div,{className:I(`${w}-header-mask`,`${w}-header-mask-right`),style:{opacity:S}}),E.createElement(R.div,{className:`${w}-tab-list`,ref:i,scrollLeft:n,onScroll:_,role:"tablist"},E.createElement(R.div,{ref:a,className:`${w}-tab-line`,style:{width:t.activeLineMode==="fixed"?"var(--fixed-active-line-width, 30px)":C,x:l}}),s.map(d=>te(d.props,v("div",{className:I(`${w}-tab-wrapper`,{[`${w}-tab-wrapper-stretch`]:t.stretch}),children:v("div",{onClick:()=>{const{key:h}=d;d.props.disabled||h!=null&&y(h.toString())},className:I(`${w}-tab`,{[`${w}-tab-active`]:d.key===f,[`${w}-tab-disabled`]:d.props.disabled}),role:"tab","aria-selected":d.key===f,children:d.props.title})},d.key))))),s.map(d=>{if(d.props.children===void 0)return null;const h=d.key===f;return v(Ne,{active:h,forceRender:d.props.forceRender,destroyOnClose:d.props.destroyOnClose,children:v("div",{className:`${w}-content`,style:{display:h?"block":"none"},children:d.props.children})},d.key)})))};var ee=je(Nt,{Tab:Tt});const N="adm-input",jt={defaultValue:"",onlyShowClearWhenFocus:!0},Bt=u.exports.forwardRef((e,r)=>{const t=he(jt,e),[i,a]=be(t),[o,g]=u.exports.useState(!1),s=u.exports.useRef(!1),f=u.exports.useRef(null),{locale:y}=Be();u.exports.useImperativeHandle(r,()=>({clear:()=>{a("")},focus:()=>{var n;(n=f.current)===null||n===void 0||n.focus()},blur:()=>{var n;(n=f.current)===null||n===void 0||n.blur()},get nativeElement(){return f.current}}));const l=n=>{var c;t.onEnterPress&&(n.code==="Enter"||n.keyCode===13)&&t.onEnterPress(n),(c=t.onKeyDown)===null||c===void 0||c.call(t,n)};j(()=>{var n;if(!!t.enterKeyHint)return(n=f.current)===null||n===void 0||n.setAttribute("enterkeyhint",t.enterKeyHint),()=>{var c;(c=f.current)===null||c===void 0||c.removeAttribute("enterkeyhint")}},[t.enterKeyHint]);function C(){let n=i;t.type==="number"&&(n=n&&ve(parseFloat(n),t.min,t.max).toString()),n!==i&&a(n)}const x=(()=>!t.clearable||!i||t.readOnly?!1:t.onlyShowClearWhenFocus?o:!0)();return te(t,M("div",{className:I(`${N}`,t.disabled&&`${N}-disabled`),children:[v("input",{ref:f,className:`${N}-element`,value:i,onChange:n=>{a(n.target.value)},onFocus:n=>{var c;g(!0),(c=t.onFocus)===null||c===void 0||c.call(t,n)},onBlur:n=>{var c;g(!1),C(),(c=t.onBlur)===null||c===void 0||c.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:l,onKeyUp:t.onKeyUp,onCompositionStart:n=>{var c;s.current=!0,(c=t.onCompositionStart)===null||c===void 0||c.call(t,n)},onCompositionEnd:n=>{var c;s.current=!1,(c=t.onCompositionEnd)===null||c===void 0||c.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"]}),x&&v("div",{className:`${N}-clear`,onMouseDown:n=>{n.preventDefault()},onClick:()=>{var n,c;a(""),(n=t.onClear)===null||n===void 0||n.call(t),We()&&s.current&&(s.current=!1,(c=f.current)===null||c===void 0||c.blur())},"aria-label":y.Input.clear,children:v(Et,{})})]}))});var Wt=Bt;const Pt=e=>{const r={url:"https://wef4y-chat-js-server.hf.space/api/chat",data:{input:e},header:{Authorization:"Bearer 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"}};return De.post(r.url,r.data,{timeout:3e7,headers:{"Content-Type":"application/json;charset=UTF-8","with-credentials":!0,...r.header}})};function zt(){const[e,r]=u.exports.useState([]),[t,i]=u.exports.useState(""),a=()=>{t!==""&&(r([...e,{type:"0",value:t}]),i(""),Pt(t).then(o=>{console.log("chat",o.data),r([...e,{type:"1",value:o.data}])}))};return v(fe,{children:M("div",{className:"chat-container",children:[e&&e.map(o=>v("div",{className:o.type==="0"?"chat-container-msg-content-right":"chat-container-msg-content-left",children:v("div",{className:"chat-container-msg",children:o.value})})),v("div",{className:"chat-container-input",children:M(ge,{wrap:!0,children:[v(Wt,{placeholder:"\u8F93\u5165\u6587\u5B57",value:t,onChange:o=>{i(o)},onEnterPress:a}),v(Pe,{onClick:a,children:v($t,{fontSize:24})})]})})]})})}const Dt=e=>{let r={url:Ce.searchURL,data:{engine:"baidu",q:e,api_key:"83df36ff90429072fcd39b47811df999a8ed942f4f2492225fe6a7f494a07935"}};return ye.get(r)},Ut=e=>{let r={url:`${Ce.itemFilterURL}/output-images/`,data:{populate:"images",["filters[item_id][$eq]"]:e},header:{Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNjgwNDU1MTk2LCJleHAiOjE2ODMwNDcxOTZ9.aGgsBDn8uo5pxqINwms6doMU_EfF9rzkm96ZUsXuy0M"}};return ye.get(r)},Kt="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.",Vt="\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 ue={description:Kt,explanation:Vt,"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 Zt(){const[e,r]=u.exports.useState([]),t=()=>new Promise((a,o)=>{const g=ue["item in the closet"].map(s=>Ut(s==null?void 0:s.id));Promise.all(g).then(s=>{const f=s.map(y=>{var x,n,c,F;const l=y==null?void 0:y.data[0],C={id:l==null?void 0:l.id,url:((F=(c=(n=(x=l==null?void 0:l.attributes)==null?void 0:x.images)==null?void 0:n.data[0])==null?void 0:c.attributes)==null?void 0:F.url)||"",from:"closet",link:""};return C.url=`http://106.52.238.44:8080${C.url}`,C});a(f)}).catch(s=>o(s))}),i=()=>{const a=ue["item not in the closet"].map(o=>Dt(o));return new Promise((o,g)=>{Promise.all(a).then(s=>{const f=[];s.forEach(y=>{var C,x,n,c,F;const l=y==null?void 0:y.organic_results[2];if(l){if(l!=null&&l.related_images){const S={id:((x=(C=l==null?void 0:l.related_images)==null?void 0:C[0])==null?void 0:x.link)||"",url:((c=(n=l==null?void 0:l.related_images)==null?void 0:n[0])==null?void 0:c.image)||"",from:"not closet",link:((F=l==null?void 0:l.related_images[0])==null?void 0:F.link)||""};f.push(S)}else if(l!=null&&l.thumbnail){const S={id:(l==null?void 0:l.link)||"",url:(l==null?void 0:l.thumbnail)||"",from:"not closet",link:(l==null?void 0:l.link)||""};f.push(S)}}}),o(f)}).catch(s=>g(s))})};return u.exports.useEffect(()=>{(async()=>{const o=await t(),g=await i();r([...e,...o,...g])})()},[]),v(fe,{children:v("div",{className:"search-container",children:v("div",{className:"search-container-image",children:v(ge,{wrap:!0,children:e.map(a=>v(ze,{src:a.url},a.id))})})})})}var Ht="./assets/defaultImage.6ddd0d30.png";function Xt(e){const[r,t]=u.exports.useState(Ht),[i,a]=u.exports.useState(!1);return u.exports.useEffect(()=>{},[]),M("div",{className:"home",style:{backgroundImage:`url(${r})`},children:[v(St,{fontSize:32,onClick:()=>a(!i)}),!i&&M(ee,{children:[v(ee.Tab,{title:"\u7A7F\u642D",children:v(zt,{})},"chat"),v(ee.Tab,{title:"\u5355\u54C1",children:v(Zt,{})},"recommend")]})]})}var er=$e(Xt);export{er as default};