PageSourceSearch

https://mystyle.ca/static/js/3970.e42707e5.chunk.js

js mystyle.ca collected 2026-10-02 01:19:50 UTC 35,308 bytes, 2 lines download raw bytes

1/*! For license information please see 3970.e42707e5.chunk.js.LICENSE.txt */
2"use strict";(globalThis.webpackChunkmystyle_app=globalThis.webpackChunkmystyle_app||[]).push([[3970],{13147(e,a,t){t.d(a,{A:()=>s});const s=(0,t(36230).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},31641(e,a,t){t.d(a,{A:()=>s});const s=(0,t(36230).A)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},70446(e,a,t){t.d(a,{A:()=>s});const s=(0,t(36230).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},86805(e,a,t){t.d(a,{A:()=>s});const s=(0,t(36230).A)("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]])},87786(e,a,t){t.d(a,{A:()=>n});var s=t(9950);const l="route-jsonld";function i(e,a){let t=document.querySelector(e);t||(t=document.createElement("meta"),document.head.appendChild(t));for(const[s,l]of Object.entries(a))t.setAttribute(s,l)}function r(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://"))return e;return`https://mystyle.ca${e.startsWith("/")?e:`/${e}`}`}function n(e){let{title:a,description:t,canonicalPath:n,imagePath:c="/logo512.png",imageAlt:o="MyStyle",ogType:d="website",jsonLd:m,breadcrumbs:u}=e;return(0,s.useEffect)(()=>{a&&(document.title=a,i('meta[name="title"]',{name:"title",content:a}),i('meta[property="og:title"]',{property:"og:title",content:a}),i('meta[name="twitter:title"]',{name:"twitter:title",content:a})),t&&(i('meta[name="description"]',{name:"description",content:t}),i('meta[property="og:description"]',{property:"og:description",content:t}),i('meta[name="twitter:description"]',{name:"twitter:description",content:t}));const e=r(n);e&&(!function(e,a){let t=document.querySelector(e);t||(t=document.createElement("link"),document.head.appendChild(t));for(const[s,l]of Object.entries(a))t.setAttribute(s,l)}('link[rel="canonical"]',{rel:"canonical",href:e}),i('meta[property="og:url"]',{property:"og:url",content:e}),i('meta[name="twitter:url"]',{name:"twitter:url",content:e})),i('meta[property="og:type"]',{property:"og:type",content:d}),i('meta[property="og:site_name"]',{property:"og:site_name",content:"MyStyle"}),i('meta[property="og:locale"]',{property:"og:locale",content:"en_US"});const s=r(c);s&&(i('meta[property="og:image"]',{property:"og:image",content:s}),i('meta[property="og:image:alt"]',{property:"og:image:alt",content:o}),i('meta[name="twitter:image"]',{name:"twitter:image",content:s}),i('meta[name="twitter:image:alt"]',{name:"twitter:image:alt",content:o})),i('meta[name="twitter:card"]',{name:"twitter:card",content:"summary_large_image"});let h=m;if(u&&u.length>0){const e={"@type":"BreadcrumbList",itemListElement:u.map((e,a)=>({"@type":"ListItem",position:a+1,name:e.name,item:e.url}))};if(h&&h["@graph"]){h["@graph"].some(e=>"BreadcrumbList"===e["@type"])||(h={...h,"@graph":[...h["@graph"],e]})}else h=h?{"@context":"https://schema.org","@graph":[h,e]}:{"@context":"https://schema.org","@graph":[e]}}return function(e){const a=`script#${l}`;let t=document.querySelector(a);e?(t||(t=document.createElement("script"),t.type="application/ld+json",t.id=l,document.head.appendChild(t)),t.textContent=JSON.stringify(e)):t&&t.remove()}(h),()=>{const e=document.getElementById(l);e&&e.remove()}},[a,t,n,c,o,d,m,u]),null}},98714(e,a,t){t.r(a),t.d(a,{default:()=>D});var s=t(9950),l=t(41420),i=t(27304),r=t(70446),n=t(31641),c=t(37455),o=t(87786),d=t(86805),m=t(96479),u=t(28017),h=t(52828),p=t(99189),g=t(13147),x=t(37656),b=t(36230);const f=(0,b.A)("cloud-upload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]),v=(0,b.A)("image-plus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);var y=t(44414);
2const j=["image/jpeg","image/png","image/webp","image/gif","image/heic"],N=[".jpg",".jpeg",".png",".webp",".gif",".heic"],w=10485760;const k=function(e){let{onImageSelected:a,onSelect:t,onOpenCamera:i,disabled:r=!1,className:n=""}=e;const[c,o]=(0,s.useState)(!1),[d,m]=(0,s.useState)(null),u=(0,s.useRef)(null),h=(0,s.useRef)(null),p=(0,s.useRef)(null),g=a||t,x=(0,s.useCallback)(e=>new Promise((a,t)=>{const s=new FileReader;s.onload=()=>a(s.result),s.onerror=t,s.readAsDataURL(e)}),[]),b=(0,s.useCallback)(e=>{const a=e.type.toLowerCase(),t=e.name.toLowerCase();return!(!a||!j.some(e=>a.includes(e.split("/")[1])))||(!!N.some(e=>t.endsWith(e))||!!a.startsWith("image/"))},[]),k=(0,s.useCallback)(e=>e.size<=w,[]),_=(0,s.useCallback)(async e=>{if(m(null),b(e))if(k(e))try{const a=await x(e),t=URL.createObjectURL(e);g&&g(a,t)}catch(a){m("Failed to process image. Please try again."),console.error("[ImageUploader] Error processing file:",a)}else m("File too large. Maximum size is 10MB.");else m("Invalid file type. Please upload an image (JPEG, PNG, WebP, GIF).")},[x,b,k,g]),C=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),r||o(!0)},[r]),S=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),r||o(!0)},[r]),A=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),o(!1)},[]),M=(0,s.useCallback)(e=>{var a;if(e.preventDefault(),e.stopPropagation(),o(!1),r)return;const t=null===(a=e.dataTransfer)||void 0===a?void 0:a.files;t&&t.length>0&&_(t[0])},[r,_]),I=(0,s.useCallback)(e=>{const a=e.target.files;a&&a.length>0&&_(a[0]),e.target.value=""},[_]),$=(0,s.useCallback)(e=>{var a;if(r)return;const t=null===(a=e.clipboardData)||void 0===a?void 0:a.items;if(t)for(const s of t)if(s.type.startsWith("image/")){e.preventDefault();const a=s.getAsFile();a&&_(a);break}},[r,_]),E=(0,s.useCallback)(()=>{!r&&u.current&&u.current.click()},[r]),R=(0,s.useCallback)(e=>{e.stopPropagation(),r||(i?i():h.current&&h.current.click())},[r,i]);return(0,s.useEffect)(()=>{const e=e=>$(e);return document.addEventListener("paste",e),()=>{document.removeEventListener("paste",e)}},[$]),(0,y.jsxs)("div",{ref:p,className:`image-uploader ${c?"image-uploader--dragging":""} ${r?"image-uploader--disabled":""} ${n}`,onDragOver:C,onDragEnter:S,onDragLeave:A,onDrop:M,onClick:E,onPaste:$,role:"button",tabIndex:r?-1:0,"aria-label":"Upload an image by clicking, dragging, or pasting","aria-disabled":r,"data-dragging":c?"true":"false",children:[(0,y.jsx)("input",{ref:u,type:"file",accept:"image/*",onChange:I,style:{display:"none"},"aria-hidden":"true"}),(0,y.jsx)("input",{ref:h,type:"file",accept:"image/*",capture:"environment",onChange:I,style:{display:"none"},"aria-hidden":"true"}),(0,y.jsx)("div",{className:"image-uploader__icon","aria-hidden":"true",children:c?(0,y.jsx)(f,{className:"h-10 w-10"}):(0,y.jsx)(l.A,{className:"h-10 w-10"})}),(0,y.jsx)("div",{className:"image-uploader__text",children:(0,y.jsx)("p",{className:"image-uploader__title",children:c?"Drop it here":"Snap or upload a clothing photo"})}),(0,y.jsxs)("div",{className:"image-uploader__actions",children:[(0,y.jsxs)("button",{type:"button",onClick:R,disabled:r,className:"image-uploader__camera-btn","aria-label":"Take a photo with camera",children:[(0,y.jsx)(l.A,{className:"h-4 w-4"}),"Take photo"]}),(0,y.jsxs)("button",{type:"button",onClick:E,disabled:r,className:"image-uploader__browse-btn","aria-label":"Choose an image from your device",children:[(0,y.jsx)(v,{className:"h-4 w-4"}),"Choose image"]})]}),(0,y.jsx)("p",{className:"image-uploader__hint",children:"Use the back camera for best fabric, fit, and detail detection."}),(0,y.jsx)("p",{className:"image-uploader__formats",children:"JPEG, PNG, WebP, GIF, HEIC up to 10MB. Paste also works on desktop."}),d&&(0,y.jsx)("div",{className:"image-uploader__error",role:"alert",children:d})]})},_=["#2196f3","#4caf50","#ff9800","#9c27b0","#f44336","#00bcd4","#ffeb3b","#795548"];const C=function(e){let{items:a,detectedItems:t,onItemSelect:l,onSelect:i,onItemClick:r,imageRef:n,selectedItem:c,className:o=""}=e;const[d,m]=(0,s.useState)({width:0,height:0}),u=a||t||[],h=l||i||r;(0,s.useEffect)(()=>{const e=()=>{null!==n&&void 0!==n&&n.current&&m({width:n.current.offsetWidth,height:n.current.offsetHeight})};return e(),window.addEventListener("resize",e),null!==n&&void 0!==n&&n.current&&n.current.addEventListener("load",e),()=>{window.removeEventListener("resize",e),null!==n&&void 0!==n&&n.current&&n.current.removeEventListener("load",e)}},[n]);const p=(0,s.useCallback)((e,a)=>{e.stopPropagation(),h&&h(a)},[h]),g=(0,s.useCallback)((e,a)=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),h&&h(a))},[h]),x=(0,s.useCallback)(e=>{if(!e||!d.width)return null;const{x:a,y:t,width:s,height:l}=e;return a<=100&&t<=100?{left:`${a}%`,top:`${t}%`,width:`${s}%`,height:`${l}%`}:{left:`${a}px`,top:`${t}px`,width:`${s}px`,height:`${l}px`}},[d]),b=(0,s.useCallback)(e=>_[e%_.length],[]);return u.length?(0,y.jsxs)("div",{className:`analysis-overlay ${o}`,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none"},role:"list","aria-label":"Detected fashion items",children:[u.map((e,a)=>{const t=e.boundingBox||e.bbox||e.coordinates||e.position,s=x(t),l=(null===c||void 0===c?void 0:c.id)===e.id,i=b(a),r=e.category||e.type||e.label||e.name;return s?(0,y.jsxs)("div",{className:"analysis-overlay__item "+(l?"analysis-overlay__item--selected":""),onClick:a=>p(a,e),onKeyPress:a=>g(a,e),tabIndex:0,role:"listitem","aria-label":`${r} - Click to search for similar items`,title:`${r}${e.color?` - ${e.color}`:""}${e.style?` - ${e.style}`:""}`,style:{position:"absolute",...s,border:`3px solid ${i}`,borderRadius:"4px",outline:l?"3px solid white":"none",boxShadow:l?`0 0 0 6px ${i}, 0 4px 12px rgba(0,0,0,0.3)`:"0 2px 8px rgba(0,0,0,0.2)",pointerEvents:"auto",cursor:"pointer",transition:"all 0.2s ease",zIndex:l?10:1},children:[(0,y.jsx)("div",{className:"analysis-overlay__label",style:{position:"absolute",top:"-28px",left:"-3px",background:i,color:"white",padding:"4px 8px",borderRadius:"4px 4px 0 0",fontSize:"12px",fontWeight:"600",whiteSpace:"nowrap",textTransform:"capitalize",boxShadow:"0 -2px 4px rgba(0,0,0,0.2)"},children:r}),e.confidence&&(0,y.jsxs)("div",{className:"analysis-overlay__confidence",style:{position:"absolute",bottom:"-24px",left:"-3px",background:"rgba(0,0,0,0.7)",color:"white",padding:"2px 6px",borderRadius:"0 0 4px 4px",fontSize:"10px"},children:[Math.round(100*e.confidence),"%"]}),(0,y.jsx)("div",{className:"analysis-overlay__highlight",style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:l?`${i}33`:"transparent",transition:"background 0.2s ease"}})]},e.id||`item-${a}`):null}),u.length>1&&(0,y.jsxs)("div",{className:"analysis-overlay__legend",style:{position:"absolute",bottom:"8px",right:"8px",background:"rgba(255,255,255,0.95)",padding:"8px 12px",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",pointerEvents:"auto",fontSize:"12px"},children:[(0,y.jsxs)("div",{style:{fontWeight:"600",marginBottom:"4px"},children:["Detected Items (",u.length,")"]}),u.map((e,a)=>{const t=e.category||e.type||e.label||e.name,s=b(a);return(0,y.jsxs)("div",{onClick:a=>p(a,e),style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",padding:"2px 0",opacity:(null===c||void 0===c?void 0:c.id)===e.id?1:.7},children:[(0,y.jsx)("span",{style:{width:"12px",height:"12px",background:s,borderRadius:"2px",border:(null===c||void 0===c?void 0:c.id)===e.id?"2px solid #333":"none"}}),(0,y.jsx)("span",{style:{textTransform:"capitalize"},children:t})]},e.id||`legend-${a}`)})]})]}):null},S={video:{facingMode:{ideal:"environment"},width:{ideal:1920},height:{ideal:1080}},audio:!1};function A(e){let{isOpen:a,onClose:t,onCapture:l,scanMode:i="single",onScanModeChange:r,onFallbackUpload:n}=e;const{status:c,stream:o,error:d,videoRef:m,start:u,stop:h,switchCamera:p,captureFrame:g}
2=function(){const[e,a]=(0,s.useState)("idle"),[t,l]=(0,s.useState)(null),[i,r]=(0,s.useState)(null),[n,c]=(0,s.useState)("environment"),o=(0,s.useRef)(null),d=(0,s.useRef)(null),m=(0,s.useRef)(!1),u=(0,s.useCallback)(()=>{o.current&&(o.current.getTracks().forEach(e=>e.stop()),o.current=null)},[]),h=(0,s.useCallback)(async()=>{if(!m.current){m.current=!0,r(null);try{const e={...S,video:{...S.video,facingMode:{ideal:n}}},t=await navigator.mediaDevices.getUserMedia(e);o.current=t,l(t),a("active")}catch(e){const t="NotAllowedError"===e.name?"Camera permission denied. Please allow camera access in your browser settings.":"NotFoundError"===e.name?"No camera found on this device.":`Camera error: ${e.message}`;r(t),a("error")}finally{m.current=!1}}},[n]),p=(0,s.useCallback)(()=>{u(),l(null),a("idle")},[u]),g=(0,s.useCallback)(async()=>{if(m.current)return;m.current=!0;const e="environment"===n?"user":"environment";c(e),u();try{const t={...S,video:{...S.video,facingMode:{ideal:e}}},s=await navigator.mediaDevices.getUserMedia(t);o.current=s,l(s),a("active")}catch(t){r(`Failed to switch camera: ${t.message}`),a("error")}finally{m.current=!1}},[n,u]),x=(0,s.useCallback)(e=>{if(!o.current)return null;if(d.current&&(d.current.readyState<2||0===d.current.videoWidth))return null;const a=o.current.getVideoTracks()[0],t=(null===a||void 0===a?void 0:a.getSettings())||{},s=(null===e||void 0===e?void 0:e.width)||t.width||1920,l=(null===e||void 0===e?void 0:e.height)||t.height||1080,i=document.createElement("canvas");i.width=s,i.height=l;const r=i.getContext("2d");return d.current&&r.drawImage(d.current,0,0,s,l),i.toDataURL("image/jpeg",.85)},[]);return(0,s.useEffect)(()=>()=>{u()},[u]),{status:e,stream:t,error:i,facingMode:n,videoRef:d,start:h,stop:p,switchCamera:g,captureFrame:x}}(),[x,b]=(0,s.useState)(!1),[f,v]=(0,s.useState)(!1);(0,s.useEffect)(()=>{a&&"idle"===c&&u()},[a,c,u]),(0,s.useEffect)(()=>{m.current&&o&&(m.current.srcObject=o)},[o,m]),(0,s.useEffect)(()=>{a&&"active"===c&&o||v(!1)},[a,c,o]);const j="active"===c&&f,N=(0,s.useCallback)(()=>{if(!j)return;const e=g();e&&(b(!0),setTimeout(()=>b(!1),300),l(e))},[j,g,l]),w=(0,s.useCallback)(()=>{h(),t()},[h,t]);return a?(0,y.jsxs)("div",{className:"camera-viewfinder",role:"dialog","aria-label":"Camera viewfinder","aria-modal":"true",children:["active"===c&&(0,y.jsx)("video",{ref:m,className:"camera-viewfinder__video",autoPlay:!0,playsInline:!0,muted:!0,onLoadedData:()=>v(!0),onCanPlay:()=>v(!0)}),"error"===c&&(0,y.jsx)("div",{className:"camera-viewfinder__error",children:(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{children:d}),(0,y.jsxs)("div",{style:{display:"flex",gap:12,marginTop:16,justifyContent:"center"},children:[(0,y.jsx)("button",{onClick:u,className:"camera-viewfinder__flip-btn",children:"Try again"}),n&&(0,y.jsx)("button",{onClick:n,className:"camera-viewfinder__flip-btn","aria-label":"Upload instead",children:"Upload instead"})]})]})}),(0,y.jsxs)("div",{className:"camera-viewfinder__top-bar",children:[(0,y.jsxs)("div",{className:"camera-viewfinder__mode-toggle",children:[(0,y.jsx)("button",{type:"button",className:"camera-viewfinder__mode-btn "+("single"===i?"camera-viewfinder__mode-btn--active":""),onClick:()=>r("single"),"aria-label":"Item mode","aria-pressed":"single"===i,children:"Item"}),(0,y.jsx)("button",{type:"button",className:"camera-viewfinder__mode-btn "+("outfit"===i?"camera-viewfinder__mode-btn--active":""),onClick:()=>r("outfit"),"aria-label":"Outfit mode","aria-pressed":"outfit"===i,children:"Outfit"})]}),(0,y.jsx)("button",{type:"button",className:"camera-viewfinder__close-btn",onClick:w,"aria-label":"Close camera",children:"\u2715"})]}),(0,y.jsxs)("div",{className:"camera-viewfinder__guide",children:[(0,y.jsx)("div",{className:"camera-viewfinder__bracket camera-viewfinder__bracket--tl","data-testid":"corner-bracket"}),(0,y.jsx)("div",{className:"camera-viewfinder__bracket camera-viewfinder__bracket--tr","data-testid":"corner-bracket"}),(0,y.jsx)("div",{className:"camera-viewfinder__bracket camera-viewfinder__bracket--bl","data-testid":"corner-bracket"}),(0,y.jsx)("div",{className:"camera-viewfinder__bracket camera-viewfinder__bracket--br","data-testid":"corner-bracket"})]}),(0,y.jsx)("div",{className:"camera-viewfinder__hint",children:"Point at any garment"}),(0,y.jsxs)("div",{className:"camera-viewfinder__bottom-bar",children:[(0,y.jsx)("div",{style:{width:44}}),(0,y.jsx)("button",{type:"button",className:"camera-viewfinder__shutter",onClick:N,"aria-label":"Capture photo",disabled:!j,children:(0,y.jsx)("div",{className:"camera-viewfinder__shutter-inner"})}),(0,y.jsx)("button",{type:"button",className:"camera-viewfinder__flip-btn",onClick:p,"aria-label":"Flip camera",children:"Flip"})]}),(0,y.jsx)("div",{className:"camera-viewfinder__flash "+(x?"camera-viewfinder__flash--active":"")})]}):null}function M(e){let{isOpen:a,capturedImage:t,analysis:l,detectedItems:i=[],loading:r=!1,selectedItem:n,onItemSelect:c,onFindSimilar:o,onRetake:d,onClose:m,onCustomRegion:u}=e;const h=(0,s.useRef)(null),p=(0,s.useCallback)(e=>{if(!u||!h.current)return;const a=h.current.getBoundingClientRect(),t=(e.clientX-a.left)/a.width*100,s=(e.clientY-a.top)/a.height*100;u({x:t,y:s,width:30,height:30})},[u]);if(!a)return null;const g=null!==l&&void 0!==l&&l.confidence?`${Math.round(100*l.confidence)}%`:null,x=["category","color","fabric","silhouette"].filter(e=>null===l||void 0===l?void 0:l[e]).map(e=>({key:e,value:l[e]}));return(0,y.jsxs)("div",{className:"capture-results",role:"dialog","aria-label":"Capture results","aria-modal":"true",children:[(0,y.jsxs)("div",{className:"capture-results__image-area",children:[(0,y.jsx)("img",{ref:h,src:t,alt:"Captured garment",onClick:p,style:u?{cursor:"crosshair"}:void 0}),i.length>0&&(0,y.jsx)(C,{items:i,onItemSelect:c,imageRef:h,selectedItem:n}),(0,y.jsx)("div",{className:"capture-results__top-bar",children:(0,y.jsx)("button",{type:"button",className:"capture-results__close-btn",onClick:m,"aria-label":"Close results",children:"\u2715"})})]}),(0,y.jsxs)("div",{className:"capture-results__panel",children:[(0,y.jsx)("div",{className:"capture-results__handle"}),r&&(0,y.jsxs)("div",{className:"capture-results__loading",children:[(0,y.jsx)("div",{className:"capture-results__loading-spinner"}),(0,y.jsx)("p",{children:"Analyzing garment..."})]}),!r&&l&&(0,y.jsxs)(y.Fragment,{children:[i.length>1&&(0,y.jsxs)("div",{className:"capture-results__items-count",children:[i.length," items detected"]}),(0,y.jsxs)("div",{className:"capture-results__header",children:[(0,y.jsx)("h2",{className:"capture-results__title",children:l.displayName||l.searchQuery||"Detected item"}),g&&(0,y.jsx)("span",{className:"capture-results__confidence",children:g})]}),l.summary&&(0,y.jsx)("p",{className:"capture-results__summary",children:l.summary}),x.length>0&&(0,y.jsx)("div",{className:"capture-results__chips",children:x.map(e=>{let{key:a,value:t}=e;return(0,y.jsx)("span",{className:"capture-results__chip",children:t},a)})}),(0,y.jsxs)("div",{className:"capture-results__actions",children:[(0,y.jsx)("button",{type:"button",className:"capture-results__btn-primary",onClick:()=>o(l),"aria-label":"Find similar items",children:"Find Similar"}),(0,y.jsx)("button",{type:"button",className:"capture-results__btn-secondary",onClick:d,"aria-label":"Retake photo",children:"Retake"})]})]})]})]})}const I=[["category","Category"],["subcategory","Type"],["color","Color"],["fabric","Fabric"],["texture","Texture"],["pattern","Pattern"],["silhouette","Silhouette"],["fit","Fit"],["season","Season"]];function $(e){return e?Array.isArray(e)?e.filter(Boolean):[e]:[]}function E(e){const a="number"===typeof e?e:.8;return`${Math.round(100*Math.max(0,Math.min(1,a)))}%`}function R(e){const a=String(e||"");return a?/\b(api[_ -]?key|authorization|bearer|token|secret|workspace|openrouter\.ai|sk-or-v1-)\b/i.test(a)?"Scan failed. Please try again shortly.":a.replace(/\bBearer\s+[A-Za-z0-9._~+/=-]{8,}\b/gi,"Bearer <redacted>").replace(/\b(sk-or-v1-[A-Za-z0-9_-]{8,}|or-[A-Za-z0-9_-]{8,})\b/g,"<redacted>").slice(0,240):"Scan failed. Please try again shortly."}function P(e){let{title:a,items:t}=e;return(0,y.jsxs)("div",{className:"clothcam-insight-card",children:[(0,y.jsx)("h4",{children:a}),(0,y.jsx)("ul",{children:t.slice(0,4).map(e=>(0,y.jsx)("li",{children:e},e))})]})}function F(e){let{product:a,onClick:t}=e;const s=a.title||a.name||"Fashion item",l=a.image||a.imageUrl||a.thumbnail||"/placeholder.png",i=a.retailer||a.store||a.source,r=a.visualSimilarity;return(0,y.jsxs)("button",{className:"clothcam-product-card",onClick:t,type:"button","aria-label":`${s}${a.price?` - ${a.price}`:""}`,children:[(0,y.jsx)("span",{className:"clothcam-product-image",children:(0,y.jsx)("img",{src:l,alt:s,loading:"lazy"})}),(0,y.jsxs)("span",{className:"clothcam-product-body",children:[(0,y.jsx)("strong",{children:s}),(0,y.jsx)("span",{children:"number"===typeof a.price?`$${a.price.toFixed(2)}`:a.price||"Price unavailable"}),i&&(0,y.jsx)("small",{children:i}),null!==r&&void 0!==r&&r.score?(0,y.jsxs)("em",{children:[r.score,"% visual match"]}):null]})]})}const L=function(e){let{onProductSelect:a,className:t="",budgetMode:l=!0,detectMultiple:n=!0}=e;
2const[o,b]=(0,s.useState)(n?"outfit":"single"),[f,v]=(0,s.useState)(null),[j,N]=(0,s.useState)(null),[w,_]=(0,s.useState)(!1),[S,L]=(0,s.useState)(null),[T,D]=(0,s.useState)(null),[z,U]=(0,s.useState)([]),[O,W]=(0,s.useState)([]),[q,B]=(0,s.useState)(null),[V,G]=(0,s.useState)(!1),[H,J]=(0,s.useState)(null),[Z,Q]=(0,s.useState)(!1),Y=(0,s.useRef)(null),K=(0,s.useCallback)(async e=>{if(e){_(!0),L(null);try{const a=await fetch("/api/visual-search",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:e,budgetMode:l,detectMultiple:"outfit"===o,scanMode:o,maxItems:5})}),t=await a.json();if(t.dailyLimitReached)throw new Error("Your available tries for today has elapsed. Come back tomorrow!");if(!a.ok||!t.success)throw new Error(t.error||"Visual search failed");D(t.analysis),U(t.products||t.results||t.searchResults||[]),W(t.items||t.detectedItems||[])}catch(a){const e=R(null===a||void 0===a?void 0:a.message);console.error("[VisualSearch] Error:",e),L(e)}finally{_(!1)}}},[l,o]),X=(0,s.useCallback)(async(e,a)=>{v(e),N(a),L(null),D(null),U([]),W([]),B(null),await K(e)},[K]),ee=(0,s.useCallback)(()=>{G(!0)},[]),ae=(0,s.useCallback)(()=>{G(!1)},[]),te=(0,s.useCallback)(async e=>{G(!1),J(e),Q(!0),L(null),D(null),U([]),W([]),B(null),await K(e)},[K]),se=(0,s.useCallback)(()=>{Q(!1),J(null),D(null),U([]),W([]),G(!0)},[]),le=(0,s.useCallback)(()=>{Q(!1),J(null)},[]),ie=(0,s.useCallback)(e=>{Q(!1),v(H),N(H),0===z.length&&H&&K(H)},[H,z.length,K]),re=(0,s.useCallback)(async e=>{if(H){_(!0);try{const a=await fetch("/api/visual-search",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:H,budgetMode:l,detectMultiple:!1,scanMode:"single",cropRegion:e})}),t=await a.json();if(!a.ok||!t.success)throw new Error(t.error||`HTTP ${a.status}`);D(t.analysis),U(t.products||[])}catch(a){L(R(a.message))}finally{_(!1)}}},[H,l]),ne=(0,s.useCallback)(e=>{B(e)},[]),ce=(0,s.useCallback)(e=>{a&&a(e)},[a]),oe=(0,s.useCallback)(()=>{v(null),N(null),D(null),U([]),W([]),B(null),L(null)},[]),de=(0,s.useCallback)(()=>{f&&K(f)},[f,K]),me=z.length,ue=$(null===T||void 0===T?void 0:T.stylingTips),he=$(null===T||void 0===T?void 0:T.careNotes),pe=$(null===T||void 0===T?void 0:T.visibleDetails),ge=$(null===T||void 0===T?void 0:T.occasions);return(0,y.jsxs)("section",{className:`visual-search clothcam-surface ${t}`,"aria-label":"ClothCam visual clothing search",children:[!j&&(0,y.jsxs)("div",{className:"clothcam-empty-state",children:[(0,y.jsxs)("div",{className:"clothcam-kicker",children:[(0,y.jsx)(i.A,{className:"h-4 w-4"}),"ClothCam"]}),(0,y.jsx)("h2",{children:"Scan a garment or a full outfit."}),(0,y.jsx)("p",{children:"Detect garment type, fabric cues, silhouette, styling angles, care hints, and similar products from one snap."}),(0,y.jsxs)("div",{className:"clothcam-mode-card","aria-label":"Choose scan mode",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{children:"Scan mode"}),(0,y.jsx)("strong",{children:"single"===o?"Single item focus":"Full outfit read"})]}),(0,y.jsxs)("div",{className:"clothcam-mode-toggle",children:[(0,y.jsxs)("button",{type:"button",onClick:()=>b("single"),className:"single"===o?"is-active":"","aria-pressed":"single"===o,children:[(0,y.jsx)(c.A,{className:"h-4 w-4"}),"Item"]}),(0,y.jsxs)("button",{type:"button",onClick:()=>b("outfit"),className:"outfit"===o?"is-active":"","aria-pressed":"outfit"===o,children:[(0,y.jsx)(d.A,{className:"h-4 w-4"}),"Outfit"]})]})]}),(0,y.jsx)(k,{onImageSelected:X,onOpenCamera:ee,disabled:w,"aria-label":"Upload image for ClothCam visual search"})]}),j&&(0,y.jsxs)("div",{className:"clothcam-grid",children:[(0,y.jsxs)("div",{className:"clothcam-preview-panel",children:[(0,y.jsxs)("div",{className:"clothcam-preview-header",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{className:"clothcam-eyebrow",children:"Live scan"}),(0,y.jsx)("h3",{children:"Captured garment"})]}),(0,y.jsx)("button",{onClick:oe,className:"clothcam-icon-button","aria-label":"Clear image and start over",children:(0,y.jsx)(m.A,{className:"h-5 w-5"})})]}),(0,y.jsxs)("div",{className:"clothcam-image-frame",children:[(0,y.jsx)("img",{ref:Y,src:j,alt:"Uploaded fashion item",className:"visual-search__image"}),O.length>0&&(0,y.jsx)(C,{items:O,onItemSelect:ne,imageRef:Y,selectedItem:q})]}),q&&(0,y.jsxs)("div",{className:"clothcam-selected-item",role:"status",children:[(0,y.jsx)(r.A,{className:"h-4 w-4"}),"Selected: ",q.category||q.type||q.name]})]}),(0,y.jsxs)("div",{className:"clothcam-results-panel",children:[w&&(0,y.jsxs)("div",{className:"clothcam-loading",role:"status","aria-live":"polite",children:[(0,y.jsx)(u.A,{className:"h-8 w-8 animate-pulse"}),(0,y.jsxs)("div",{children:[(0,y.jsx)("h3",{children:"Reading the garment..."}),(0,y.jsx)("p",{children:"Checking cut, color, texture, fabric cues, and styling context."})]})]}),S&&(0,y.jsxs)("div",{className:"clothcam-error",role:"alert",children:[(0,y.jsx)(h.A,{className:"h-5 w-5"}),(0,y.jsxs)("div",{children:[(0,y.jsx)("h3",{children:"Scan failed"}),(0,y.jsx)("p",{children:S}),(0,y.jsxs)("button",{onClick:de,className:"clothcam-secondary-button",children:[(0,y.jsx)(p.A,{className:"h-4 w-4"}),"Retry scan"]})]})]}),T&&!w&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"clothcam-analysis-card",children:[(0,y.jsxs)("div",{className:"clothcam-analysis-head",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{className:"clothcam-eyebrow",children:"Cloth DNA"}),(0,y.jsx)("h3",{children:T.displayName||T.searchQuery||"Detected item"})]}),(0,y.jsxs)("div",{className:"clothcam-confidence",children:[E(T.confidence),(0,y.jsx)("span",{children:"confidence"})]})]}),T.summary&&(0,y.jsx)("p",{className:"clothcam-summary",children:T.summary}),(0,y.jsx)("div",{className:"clothcam-detail-grid",children:I.map(e=>{let[a,t]=e;return null!==T&&void 0!==T&&T[a]?(0,y.jsxs)("div",{className:"clothcam-detail",children:[(0,y.jsx)("span",{children:t}),(0,y.jsx)("strong",{children:T[a]})]},a):null})}),pe.length>0&&(0,y.jsxs)("div",{className:"clothcam-chip-section",children:[(0,y.jsx)("h4",{children:"Visible details"}),(0,y.jsx)("div",{className:"clothcam-chip-row",children:pe.map(e=>(0,y.jsx)("span",{children:e},e))})]}),(0,y.jsx)("div",{className:"clothcam-note",children:"Fabric, era, and fit notes are AI inferences from visible cues, not brand-verified claims."})]}),(0,y.jsxs)("div",{className:"clothcam-insight-grid",children:[ue.length>0&&(0,y.jsx)(P,{title:"Style moves",items:ue}),ge.length>0&&(0,y.jsx)(P,{title:"Where it works",items:ge}),he.length>0&&(0,y.jsx)(P,{title:"Care watchouts",items:he})]})]})]})]}),me>0&&(0,y.jsxs)("div",{className:"clothcam-product-section",children:[(0,y.jsxs)("div",{className:"clothcam-section-title",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{className:"clothcam-eyebrow",children:"Shop the signal"}),(0,y.jsxs)("h3",{children:["Similar finds (",me,")"]})]}),(0,y.jsx)(g.A,{className:"h-5 w-5"})]}),(0,y.jsx)("div",{className:"clothcam-products",children:z.map((e,a)=>(0,y.jsx)(F,{product:e,onClick:()=>ce(e)},e.id||e.url||`product-${a}`))})]}),!w&&T&&0===me&&(0,y.jsxs)("div",{className:"clothcam-empty-results",children:[(0,y.jsx)(x.A,{className:"h-6 w-6"}),(0,y.jsx)("p",{children:"No matching products came back yet. Try a clearer photo or scan a single item."})]}),(0,y.jsx)(A,{isOpen:V,onClose:()=>G(!1),onCapture:te,scanMode:o,onScanModeChange:b,onFallbackUpload:ae}),(0,y.jsx)(M,{isOpen:Z,capturedImage:H,analysis:T,detectedItems:O,loading:w,selectedItem:q,onItemSelect:ne,onFindSimilar:ie,onRetake:se,onClose:le,onCustomRegion:re})]})},T=t.p+"static/media/hero-fashion-lab.f5cb79a5e47c2c020887.png";
2function D(){const[e,a]=(0,s.useState)(null);return(0,y.jsxs)("main",{className:"min-h-screen bg-[#f6f4ef] text-gray-950",children:[(0,y.jsx)(o.A,{title:"ClothCam | MyStyle",description:"Snap clothing to identify garment details, styling cues, fabric signals, and similar products.",canonicalPath:"/clothcam"}),(0,y.jsxs)("section",{className:"mx-auto flex max-w-7xl flex-col gap-4 px-4 py-4 sm:px-6 lg:px-8 lg:gap-6 lg:py-8",children:[(0,y.jsxs)("div",{className:"grid gap-4 lg:grid-cols-[1fr_360px] lg:items-end",children:[(0,y.jsxs)("div",{children:[(0,y.jsxs)("div",{className:"mb-3 inline-flex items-center gap-2 rounded-full bg-white px-3 py-2 text-xs font-extrabold uppercase text-teal-700 shadow-sm lg:mb-4",children:[(0,y.jsx)(l.A,{className:"h-4 w-4"}),"Mobile-first scan"]}),(0,y.jsx)("h1",{className:"max-w-4xl text-3xl font-black leading-none tracking-normal sm:text-5xl lg:text-6xl",children:"ClothCam reads the outfit before the tag does."}),(0,y.jsx)("p",{className:"mt-3 hidden max-w-2xl text-sm leading-6 text-gray-600 sm:block sm:text-base lg:mt-4 lg:leading-7",children:"Take a snap and get the useful layer: garment type, cut, fabric cues, texture, pattern, style moves, care watchouts, and similar products without making up fake social proof."})]}),(0,y.jsxs)("div",{className:"hidden gap-3 rounded-lg border border-black/10 bg-white p-4 shadow-sm lg:grid",children:[(0,y.jsxs)("div",{className:"relative overflow-hidden rounded-lg",children:[(0,y.jsx)("img",{src:T,alt:"Layered garments styled for ClothCam scanning",className:"h-44 w-full object-cover",loading:"lazy"}),(0,y.jsx)("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-t from-black/55 via-black/15 to-transparent"}),(0,y.jsx)("div",{className:"absolute bottom-0 left-0 right-0 px-3 py-2 text-xs font-bold uppercase tracking-wide text-white",children:"ClothCam editorial preview"})]}),(0,y.jsxs)("div",{className:"flex items-start gap-3",children:[(0,y.jsx)("span",{className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg bg-gray-950 text-white",children:(0,y.jsx)(i.A,{className:"h-5 w-5"})}),(0,y.jsxs)("div",{children:[(0,y.jsx)("h2",{className:"font-extrabold",children:"What makes it useful"}),(0,y.jsx)("p",{className:"mt-1 text-sm leading-6 text-gray-600",children:"Every field is either visible or clearly labeled as an AI inference, so the scan feels sharp without pretending to know more than the photo shows."})]})]}),(0,y.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm font-bold text-gray-700",children:[(0,y.jsx)("span",{className:"rounded-lg bg-teal-50 p-3 text-teal-800",children:"Fabric cues"}),(0,y.jsx)("span",{className:"rounded-lg bg-amber-50 p-3 text-amber-800",children:"Fit read"}),(0,y.jsx)("span",{className:"rounded-lg bg-rose-50 p-3 text-rose-800",children:"Style moves"}),(0,y.jsx)("span",{className:"rounded-lg bg-slate-100 p-3 text-slate-800",children:"Shop matches"})]})]})]}),(0,y.jsx)(L,{onProductSelect:e=>{a(e);const t=(null===e||void 0===e?void 0:e.url)||(null===e||void 0===e?void 0:e.link)||(null===e||void 0===e?void 0:e.productUrl);t&&/^https?:\/\//i.test(t)&&window.open(t,"_blank","noopener,noreferrer")},budgetMode:!0,detectMultiple:!0,className:"rounded-lg"}),e&&(0,y.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-teal-200 bg-teal-50 px-4 py-3 text-sm font-bold text-teal-900",role:"status",children:[(0,y.jsx)(r.A,{className:"h-4 w-4"}),"Selected ",e.title||e.name||"product",(e.url||e.link||e.productUrl)&&(0,y.jsx)(n.A,{className:"h-4 w-4"})]}),(0,y.jsxs)("div",{className:"grid gap-3 rounded-lg border border-black/10 bg-white p-4 shadow-sm lg:hidden",children:[(0,y.jsxs)("div",{className:"relative overflow-hidden rounded-lg",children:[(0,y.jsx)("img",{src:T,alt:"Layered garments styled for ClothCam scanning",className:"h-36 w-full object-cover",loading:"lazy"}),(0,y.jsx)("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-t from-black/50 via-black/10 to-transparent"}),(0,y.jsx)("div",{className:"absolute bottom-0 left-0 right-0 px-3 py-2 text-[11px] font-bold uppercase tracking-wide text-white",children:"ClothCam editorial preview"})]}),(0,y.jsxs)("div",{className:"flex items-start gap-3",children:[(0,y.jsx)("span",{className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg bg-gray-950 text-white",children:(0,y.jsx)(i.A,{className:"h-5 w-5"})}),(0,y.jsxs)("div",{children:[(0,y.jsx)("h2",{className:"font-extrabold",children:"What makes it useful"}),(0,y.jsx)("p",{className:"mt-1 text-sm leading-6 text-gray-600",children:"Every field is visible or labeled as an AI inference, so the scan stays sharp without pretending the photo says more than it does."})]})]}),(0,y.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm font-bold text-gray-700",children:[(0,y.jsx)("span",{className:"rounded-lg bg-teal-50 p-3 text-teal-800",children:"Fabric cues"}),(0,y.jsx)("span",{className:"rounded-lg bg-amber-50 p-3 text-amber-800",children:"Fit read"}),(0,y.jsx)("span",{className:"rounded-lg bg-rose-50 p-3 text-rose-800",children:"Style moves"}),(0,y.jsx)("span",{className:"rounded-lg bg-slate-100 p-3 text-slate-800",children:"Shop matches"})]})]}),(0,y.jsx)("div",{className:"grid gap-3 pb-4 sm:grid-cols-3",children:[["Snap clean","Use natural light and keep the full item in frame."],["Tap a box","When multiple pieces are detected, select one garment to focus the read."],["Use the details","Turn fabric, silhouette, and care notes into smarter saves and purchases."]].map(e=>{let[a,t]=e;return(0,y.jsxs)("div",{className:"rounded-lg border border-black/10 bg-white p-4",children:[(0,y.jsx)(c.A,{className:"mb-3 h-5 w-5 text-teal-700"}),(0,y.jsx)("h3",{className:"font-extrabold",children:a}),(0,y.jsx)("p",{className:"mt-1 text-sm leading-6 text-gray-600",children:t})]},a)})})]})]})}},99189(e,a,t){t.d(a,{A:()=>s});const s=(0,t(36230).A)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])}}]);

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.