PageSourceSearch

https://tatship.com/_next/static/chunks/785-86394cb07994e49f.js

js tatship.com collected 2026-09-24 10:28:54 UTC 25,605 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[785],{13557:function(e,t,a){a.d(t,{d:function(){return o},z:function(){return d}});var s=a(85893),l=a(67294),r=a(88426),i=a(12003),n=a(46283);let o=(0,i.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=l.forwardRef((e,t)=>{let{className:a,variant:l,size:i,asChild:d=!1,...c}=e,u=d?r.g7:"button";return(0,s.jsx)(u,{className:(0,n.cn)(o({variant:l,size:i,className:a})),ref:t,...c})});d.displayName="Button"},524:function(e,t,a){a.d(t,{I:function(){return i}});var s=a(85893),l=a(67294),r=a(46283);let i=l.forwardRef((e,t)=>{let{className:a,type:l,...i}=e;return(0,s.jsx)("input",{type:l,className:(0,r.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...i})});i.displayName="Input"},79031:function(e,t,a){a.d(t,{Tu:function(){return SheetHeader},aM:function(){return c},ue:function(){return g},yo:function(){return d}});var s=a(85893),l=a(67294),r=a(12854),i=a(12003),n=a(41352),o=a(46283);let d=r.fC,c=r.xz;r.x8;let u=r.h_,m=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsx)(r.aV,{className:(0,o.cn)("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l,ref:t})});m.displayName=r.aV.displayName;let f=(0,i.j)("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4  border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),g=l.forwardRef((e,t)=>{let{side:a="right",className:l,children:i,...d}=e;return(0,s.jsxs)(u,{children:[(0,s.jsx)(m,{}),(0,s.jsxs)(r.VY,{ref:t,className:(0,o.cn)(f({side:a}),l),...d,children:[i,(0,s.jsxs)(r.x8,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,s.jsx)(n.Z,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});g.displayName=r.VY.displayName;let SheetHeader=e=>{let{className:t,...a}=e;return(0,s.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...a})};SheetHeader.displayName="SheetHeader";let x=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsx)(r.Dx,{ref:t,className:(0,o.cn)("text-lg font-semibold text-foreground",a),...l})});x.displayName=r.Dx.displayName;let h=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsx)(r.dk,{ref:t,className:(0,o.cn)("text-sm text-muted-foreground",a),...l})});h.displayName=r.dk.displayName},81186:function(e,t,a){a.d(t,{O:function(){return Skeleton}});var s=a(85893),l=a(46283);function Skeleton(e){let{className:t,...a}=e;return(0,s.jsx)("div",{className:(0,l.cn)("animate-pulse rounded-md bg-muted",t),...a})}},9081:function(e,t,a){a.d(t,{r:function(){return n}});var s=a(85893),l=a(67294),r=a(60761),i=a(46283);let n=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsx)(r.fC,{className:(0,i.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...l,ref:t,children:(0,s.jsx)(r.bU,{className:(0,i.cn)("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})})});n.displayName=r.fC.displayName},46117:function(e,t,a){a.d(t,{SP:function(){return d},dr:function(){return o},mQ:function(){return n},nU:function(){return c}});var s=a(85893),l=a(67294),r=a(46962),i=a(46283);let n=r.fC,o=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsx)(r.aV,{ref:t,className:(0,i.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",a),...l})});o.displayName=r.aV.displayName;let d=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsx)(r.xz,{ref:t,className:(0,i.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",a),...l})});d.displayName=r.xz.displayName;let c=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsx)(r.VY,{ref:t,className:(0,i.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",a),...l})});c.displayName=r.VY.displayName},84604:function(e,t,a){a.d(t,{g:function(){return i}});var s=a(85893),l=a(67294),r=a(46283);let i=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsx)("textarea",{className:(0,r.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...l})});i.displayName="Textarea"},49039:function(e,t,a){var s=a(85893),l=a(67294),r=a(79031),i=a(524),n=a(46117),o=a(13557),d=a(81186),c=a(88773),u=a(43),m=a(36316),f=a(28142),g=a(9081),x=a(86896),h=a(80691),p=a(15690);t.Z=e=>{let{references:t=[],design_id:a,open:b,onClose:v,onSelect:y,widget_id:j="ref-finder",pubKey:N,merchant:w,defaultStep:k=null}=e,S=(0,x.Z)(),[_,M]=(0,l.useState)(k||"menu"),[C,U]=(0,l.useState)("instagram"),[P,R]=(0,l.useState)(""),[T,F]=(0,l.useState)(!1),[D,Z]=(0,l.useState)([]),[z,E]=(0,l.useState)(""),[V,B]=(0,l.useState)([]),[I,A]=(0,l.useState)(!1),[W,H]=(0,l.useState)(""),[O,Y]=(0,l.useState)(!1),[L,q]=(0,l.useState)(!1),[Q,K]=(0,l.useState)(!1),[X,G]=(0,l.useState)(""),[J,$]=(0,l.useState)(null),[ee,et]=(0,l.useState)(!1),[ea,es]=(0,l.useState)(!1),[el,er]=(0,l.useState)(""),ei=(0,l.useRef)(null),[en,eo]=(0,l.useState)(!1),[ed,ec]=(0,l.useState)(""),[eu,em]=(0,l.useState)([]),[ef,eg]=(0,l.useState)(1),[ex,eh]=(0,l.useState)(1),[ep,eb]=(0,l.useState)(!0),[ev,ey]=(0,l.useState)(!1);(0,l.useEffect)(()=>{k&&M(k)},[k]);let fetchPortfolio=async e=>{if(null==w?void 0:w.merchant_id){1===e?eo(!0):ey(!0),ec("");try{let{data:t}=await u.Z.get("/file/public/find",{params:{merchant_id:null==w?void 0:w.merchant_id,page:e}});1===e?em(t.files.rows):em(e=>[...e,...t.files.rows]),eb(e<t.files.totalNumOfPage),eg(e)}catch(e){ec("Failed to load portfolio. Please try again.")}finally{eo(!1),ey(!1)}}};(0,l.useEffect)(()=>{console.log("step",_,null==w?void 0:w.merchant_id),"portfolio"===_&&(null==w?void 0:w.merchant_id)&&(console.log("fetching portfolio"),fetchPortfolio(1))},[_,null==w?void 0:w.merchant_id]);let handleSearch=async()=>{F(!0),E("");try{let{data:e}=await u.Z.post("/design/".concat(a?"sharable/":"","search-ref"),{design_id:a,query:P,searchMode:C},{timeout:15e3});Z(e.results||[])}catch(e){E("Search failed. Try again.")}finally{F(!1)}};(0,l.useEffect)(()=>{if(V.length>0){let e=V[0];e.cdnUrl&&($(e),Y(!0))}},[V]);let handleFileSelect=async e=>{var t;let a=e.target,s=null===(t=a.files)||void 0===t?void 0:t[0];if(setTimeout(()=>{try{a.value=""}catch(e){}},0),s){er(""),es(!0);try{let e=await (0,h.Ax)(s,800),t=await (0,p.rN)(e),a=(0,c.Z)();await handleConfirmUpload([{uuid:a,cdnUrl:t,name:"".concat(a,".jpg")}])}catch(e){er("Upload failed. Please try again.")}finally{es(!1)}}},handleConfirmUpload=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(!J&&0===e.length)return;G("");let t=e.length>0?e[0]:{...J};if(L){K(!0);try{await u.Z.post("/trial/sharable/remove-background",{input_file_url:t.cdnUrl.includes("ucarecdn.com")?t.cdnUrl+"-/resize/800x/"+t.name:t.cdnUrl,output_filename:"".concat(t.uuid||(0,c.Z)(),".png"),upload_only:!1,design_id:a},{timeout:3e4}),t.cdnUrl="https://static.tatship.com/image_output/".concat(t.uuid||(0,c.Z)(),".png"),t.background_removed=!0}catch(e){G("Failed to remove background. Please try again."),K(!1);return}K(!1)}y({uuid:t.uuid||(0,c.Z)(),cdnUrl:t.cdnUrl,graphic_mode:"upload",...t}),v(),M("menu"),B([]),Y(!1),$(null)},handleRemoveBackground=async e=>{G(""),K(!0);try{return await u.Z.post("/trial/sharable/remove-background",{input_file_url:e.cdnUrl.includes("ucarecdn.com")?e.cdnUrl+"-/resize/800x/"+e.name:e.cdnUrl,output_filename:"".concat(e.uuid||(0,c.Z)(),".png"),upload_only:!1,design_id:a},{timeout:3e4}),e.cdnUrl="https://static.tatship.com/image_output/".concat(e.uuid||(0,c.Z)(),".png"),e.background_removed=!0,e}catch(e){return G("Failed to remove background. Please try again."),null}finally{K(!1)}},handleAddFromSearch=async e=>{A(!0),H("");try{let t={};{let s=await u.Z.post("/design/".concat(a?"sharable/":"","upload-by-url"),{url:"instagram"===C?e.thumbnail:e.original,backup_url:e.thumbnail,design_id:a}),l=s.data;t={uuid:e.uuid||(0,c.Z)(),cdnUrl:l.Location,graphic_mode:"search",...e,...l}}$(t),et(!0)}catch(e){H("Failed to fetch HD image. Please try again.")}finally{A(!1)}},handlePreviewConfirm=async()=>
1{if(!J)return;let e={...J};if(L){let t=await handleRemoveBackground(e);if(!t)return;e=t}y(e),v(),et(!1),$(null),q(!1)};return(0,s.jsx)(r.yo,{open:b,onOpenChange:e=>{e||v()},children:(0,s.jsxs)(r.ue,{side:"top",className:"h-screen w-screen max-w-none p-0 flex flex-col border-t",children:[I&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-black/60",children:(0,s.jsxs)("div",{className:"bg-white rounded-xl shadow-xl p-8 flex flex-col items-center",children:[(0,s.jsx)(m.Z,{className:"animate-spin w-10 h-10 text-gray-700 mb-4"}),(0,s.jsx)("div",{className:"text-lg font-semibold mb-2",children:S.formatMessage({id:"page.trypage.imageLoading"})}),(0,s.jsx)("div",{className:"text-gray-500 text-sm text-center max-w-xs",children:S.formatMessage({id:"page.trypage.imageProcessing"})})]})}),"menu"===_&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-8 bg-white p-6",children:[(0,s.jsx)("h2",{className:"text-2xl font-bold mb-0 tracking-tight",children:S.formatMessage({id:"page.tattooReferenceFinder.title"})}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 lg:gap-8 gap-4 w-full max-w-lg lg:max-w-3xl",children:[(0,s.jsxs)("button",{className:"bg-gray-100 hover:bg-gray-200 transition rounded-xl p-4 lg:p-8 flex flex-col items-center shadow group",onClick:()=>M("upload"),children:[(0,s.jsx)("span",{className:"lg:text-4xl text-3xl mb-2",children:"\uD83D\uDCE4"}),(0,s.jsx)("span",{className:"lg:text-lg text-md font-semibold",children:S.formatMessage({id:"page.trypage.upload"})}),(0,s.jsx)("span",{className:"text-gray-500 mt-2 text-xs lg:text-sm",children:S.formatMessage({id:"page.refImageFinder.upload.description"})})]}),(0,s.jsxs)("button",{className:"bg-gray-100 hover:bg-gray-200 transition rounded-xl p-4 lg:p-8 flex flex-col items-center shadow group",onClick:()=>M("search"),children:[(0,s.jsx)("span",{className:"lg:text-4xl text-3xl mb-2",children:"\uD83D\uDD0D"}),(0,s.jsx)("span",{className:"lg:text-lg text-md font-semibold",children:S.formatMessage({id:"page.trypage.search"})}),(0,s.jsx)("span",{className:"text-gray-500 mt-2 text-xs lg:text-sm",children:S.formatMessage({id:"createTrialPage.searchInstruction"})})]}),(null==t?void 0:t.length)>0&&(0,s.jsxs)("button",{className:"bg-gray-100 hover:bg-gray-200 transition rounded-xl p-4 lg:p-8 flex flex-col items-center shadow group",onClick:()=>M("references"),children:[(0,s.jsx)("span",{className:"lg:text-4xl text-3xl mb-2",children:"\uD83D\uDCDA"}),(0,s.jsx)("span",{className:"lg:text-lg text-md font-semibold",children:S.formatMessage({id:"page.consult.savedRef"})}),(0,s.jsx)("span",{className:"text-gray-500 mt-2 text-xs lg:text-sm",children:S.formatMessage({id:"page.consult.savedRefDesc"})})]}),(null==w?void 0:w.merchant_id)&&(0,s.jsxs)("button",{className:"bg-gray-100 hover:bg-gray-200 transition rounded-xl p-4 lg:p-8 flex flex-col items-center shadow group",onClick:()=>M("portfolio"),children:[(0,s.jsx)("span",{className:"lg:text-4xl text-3xl mb-2",children:"\uD83C\uDFA8"}),(0,s.jsx)("span",{className:"lg:text-lg text-md font-semibold",children:S.formatMessage({id:"page.trypage.preset"})}),(0,s.jsx)("span",{className:"text-gray-500 mt-2 text-xs lg:text-sm",children:S.formatMessage({id:"page.trypage.preset"})})]})]})]}),"upload"===_&&(0,s.jsxs)("div",{className:"flex flex-col h-full bg-white",children:[!k&&(0,s.jsx)("div",{className:"flex items-center p-4 border-b",children:(0,s.jsxs)("button",{className:"mr-4 text-base text-gray-500 hover:text-gray-800",onClick:()=>{M("menu"),Y(!1),$(null),B([])},children:["← ",S.formatMessage({id:"designWidget.back"})]})}),(0,s.jsx)("div",{className:"flex-1 flex items-center justify-center ",children:O&&J?(0,s.jsxs)("div",{className:"flex flex-col items-center gap-6 w-full max-w-md mx-auto p-6",children:[(0,s.jsx)("img",{src:(L&&J.background_removed,J.cdnUrl),alt:"Preview",className:"bg-gray-100 w-full max-h-64 object-contain rounded-xl mb-2"}),a&&(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(g.r,{checked:L,onCheckedChange:q,id:"remove-bg-switch"}),(0,s.jsx)("label",{htmlFor:"remove-bg-switch",className:"text-sm",children:S.formatMessage({id:"refFinder.autoRemoveBgSwitch"})})]}),X&&(0,s.jsx)("div",{className:"text-red-500 text-sm mb-2",children:X}),(0,s.jsx)(o.z,{className:"rounded-full w-full",disabled:Q,children:Q?S.formatMessage({id:"page.trypage.removingBackgroun
1d"}):S.formatMessage({id:"refFinder.selectReference"})}),(0,s.jsx)(o.z,{variant:"outline",className:"rounded-full w-full",onClick:()=>{Y(!1),$(null),B([])},children:S.formatMessage({id:"createTrialPage.resetImage"})})]}):(0,s.jsxs)("div",{className:"min-w-[300px] p-8",children:[(0,s.jsx)("div",{className:"mb-4 flex-1 flex justify-center",children:(0,s.jsx)("h3",{className:"text-xl font-semibold text-center",children:S.formatMessage({id:"page.trypage.upload"})})}),(0,s.jsx)("h5",{className:"text-sm text-gray-500 mb-4 text-center",children:S.formatMessage({id:"page.refImageFinder.upload.description"})}),(0,s.jsx)("input",{ref:ei,type:"file",accept:"image/*,.heic,.heif",className:"hidden",onChange:handleFileSelect}),(0,s.jsxs)("button",{onClick:()=>{var e;return null===(e=ei.current)||void 0===e?void 0:e.click()},disabled:ea,className:"group w-full mx-auto flex items-center justify-center gap-2.5 py-3.5 px-6 rounded-2xl bg-gray-900 hover:bg-gray-800 active:scale-[0.98] disabled:opacity-60 disabled:active:scale-100 text-white font-medium text-sm transition-all shadow-lg shadow-gray-900/20",children:[ea?(0,s.jsx)(m.Z,{className:"w-4 h-4 animate-spin"}):(0,s.jsx)(f.Z,{className:"w-4 h-4 opacity-70 group-hover:opacity-100 transition-opacity"}),S.formatMessage({id:ea?"page.trypage.loading":"page.trypage.upload"})]}),el&&(0,s.jsx)("p",{className:"text-xs text-red-500 text-center mt-3",children:el})]})})]}),"search"===_&&(0,s.jsxs)("div",{className:"flex flex-col h-full bg-white",children:[(0,s.jsx)("div",{className:"flex items-center p-4 border-b",children:(0,s.jsxs)("button",{className:"mr-4 text-gray-500 hover:text-gray-800",onClick:()=>M("menu"),children:["← ",S.formatMessage({id:"designWidget.back"})]})}),(0,s.jsxs)("div",{className:"flex flex-col flex-1 items-center p-4 sm:p-4 gap-2 h-full",children:[(0,s.jsx)("div",{className:"mb-3"}),(0,s.jsx)(n.mQ,{defaultValue:C,onValueChange:e=>U(e),children:(0,s.jsxs)(n.dr,{children:[(0,s.jsx)(n.SP,{value:"instagram",children:S.formatMessage({id:"createTrialPage.searchMode.instagram"})}),(0,s.jsx)(n.SP,{value:"pinterest",children:S.formatMessage({id:"createTrialPage.searchMode.pinterest"})}),(0,s.jsx)(n.SP,{value:"google",children:S.formatMessage({id:"createTrialPage.searchMode.everything"})})]})}),(0,s.jsxs)("div",{className:"flex w-full max-w-md gap-2 mt-2",children:[(0,s.jsx)(i.I,{className:"flex-1",placeholder:S.formatMessage({id:"createTrialPage.searchPlaceholder"}),value:P,onChange:e=>R(e.target.value),onKeyDown:e=>{"Enter"===e.key&&handleSearch()}}),(0,s.jsx)(o.z,{onClick:handleSearch,disabled:T||!P,children:T?S.formatMessage({id:"createTrialPage.searchingStatus"}):S.formatMessage({id:"createTrialPage.searchButtonText"})})]}),z&&(0,s.jsx)("div",{className:"text-red-500 text-sm mt-2",children:z}),(0,s.jsxs)("div",{className:"flex-1 w-full max-w-5xl mx-auto overflow-y-auto mt-4 pb-4",children:[T||I?(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6",children:Array.from({length:6}).map((e,t)=>(0,s.jsx)(d.O,{className:"h-64 w-full rounded-lg"},t))}):(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6",children:D.map((e,t)=>(0,s.jsxs)("div",{className:"p-4 flex flex-col items-center",children:[(0,s.jsx)("img",{src:e.thumbnail,alt:e.title,className:"w-full h-56 object-contain bg-gray-100 rounded mb-2"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mb-1 text-center w-full line-clamp-2",children:e.title}),a&&(0,s.jsxs)("a",{href:e.link,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-900 hover:text-blue-800 transition-colors duration-200 underline mb-2",children:[S.formatMessage({id:"chatWidget.source"}),": ",C.charAt(0).toUpperCase()+C.slice(1)]}),!a&&(0,s.jsxs)("div",{onClick:()=>{(0,h.q_)(e.link)},className:"text-xs text-gray-500 text-center w-full line-clamp-2 pb-4 pt-2 underline",children:[S.formatMessage({id:"chatWidget.source"}),": ",C.charAt(0).toUpperCase()+C.slice(1)]}),(0,s.jsx)(o.z,{variant:"outline",className:"w-full max-w-56 mt-auto rounded-full border-black text-black",onClick:()=>handleAddFromSearch(e),disabled:I,children:I?S.formatMessage({id:"page.trypage.imageLoading"}):S.formatMessage({id:"refFinder.selectReference"})})]},t))}),W&&(0,s.jsx)("div",{className:"text-red-500 text-sm mt-2",children:W})]})]})]}),"references"===_&&(0,s.jsxs)("div",{className:"flex flex-col h-full bg-white",children:[(0,s.jsx)("div",{className:"flex items-center p-4 border-b",children:(0,s.jsxs)("button",{className:"mr-4 text-gray-500 hover:text-gray-800",onClick:()=>M("menu"),children:["← ",S.formatMessage({id:"designWidget.back"})]})}),(0,s.jsxs)("div",{className:"flex-1 p-4",children:[(0,s.jsx)("h3",{className:"text-xl font-semibold mb-4 text-center",children:S.formatMessage({id:"page.consult.savedRef"})}),(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6",children:t.map((e,t)=>{var a;return(0,s.jsxs)("div",{className:"p-4 flex flex-col items-center",children:[(0,s.jsx)("img",{src:null==e?void 0:null===(a=e.original_file_info)||void 0===a?void 0:a.cdnUrl,alt:e.title||"Reference",className:"w-full h-56 object-contain bg-gray-100 rounded mb-2"}),(0,s.jsx)(o.z,{variant:"outline",className:"w-full mt-auto rounded-full border-black text-black max-w-56 mt-4",onClick:()=>{$(e.original_file_info),et(!0)},children:S.formatMessage({id:"refFinder.selectReference"})})]},t)})})]})]}),"portfolio"===_&&(0,s.jsxs)("div",{className:"flex flex-col h-full bg-white",children:[(0,s.jsx)("div",{className:"flex items-center p-4 border-b",children:(0,s.jsxs)("button",{className:"mr-4 text-gray-500 hover:text-gray-800",onClick:()=>M("menu"),children:["← ",S.formatMessage({id:"designWidget.back"})]})}),(0,s.jsxs)("div",{className:"flex flex-col flex-1 items-center p-2 sm:p-4 gap-2 h-full",children:[(0,s.jsx)("div",{className:"my-4",children:(0,s.jsx)("h3",{className:"text-sm font-semibold text-center",children:S.formatMessage({id:"page.trypage.preset"})})}),(0,s.jsxs)("div",{className:"flex-1 w-full max-w-5xl mx-auto overflow-y-auto mt-4 pb-4",onScroll:e=>{let{scrollTop:t,scrollHeight:a,clientHeight:s}=e.currentTarget;a-t<=1.5*s&&!ev&&ep&&fetchPortfolio(ef+1)},children:[en?(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6",children:Array.from({length:6}).map((e,t)=>(0,s.jsx)(d.O,{className:"h-64 w-full rounded-lg"},t))}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6 pb-12",children:eu.map((e,t)=>{var a;return(0,s.jsxs)("div",{className:"p-4 flex flex-col items-center",children:[(0,s.jsx)("img",{src:null==e?void 0:null===(a=e.file_obj)||void 0===a?void 0:a.cdnUrl,alt:e.file_name_local||"Portfolio work",className:"w-full h-56 object-contain bg-gray-100 rounded mb-2"}),(0,s.jsx)(o.z,{variant:"outline",className:"w-full mt-auto rounded-full",onClick:()=>{var t;$({uuid:e.uuid||(0,c.Z)(),cdnUrl:null==e?void 0:null===(t=e.file_obj)||void 0===t?void 0:t.cdnUrl,graphic_mode:"portfolio",...e}),et(!0)},children:S.formatMessage({id:"refFinder.selectReference"})})]},t)})}),ev&&(0,s.jsx)("div",{className:"flex justify-center mt-6",children:(0,s.jsx)(m.Z,{className:"animate-spin w-6 h-6 text-gray-500"})})]}),ed&&(0,s.jsx)("div",{className:"text-red-500 text-sm mt-2 text-center",children:ed})]})]})]}),ee&&J&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:(0,s.jsxs)("div",{className:"bg-white rounded-xl shadow-xl p-8 flex flex-col items-center max-w-md w-full mx-4",children:[(0,s.jsx)("img",{src:(L&&J.background_removed,J.cdnUrl),alt:"Preview",className:"bg-gray-100 w-full max-h-64 object-contain rounded-xl mb-4"}),a&&(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,s.jsx)(g.r,{checked:L,onCheckedChange:q,id:"remove-bg-switch"}),(0,s.jsx)("label",{htmlFor:"remove-bg-switch",className:"text-sm",children:S.formatMessage({id:"refFinder.autoRemoveBgSwitch"})})]}),X&&(0,s.jsx)("div",{className:"text-red-500 text-sm mb-4",children:X}),(0,s.jsx)(o.z,{className:"rounded-full w-full mb-2",onClick:handlePreviewConfirm,disabled:Q,children:Q?S.formatMessage({id:"page.trypage.removingBackgroun
1d"}):S.formatMessage({id:"refFinder.selectReference"})}),(0,s.jsx)(o.z,{variant:"outline",className:"rounded-full w-full",onClick:()=>{et(!1),$(null),q(!1)},children:S.formatMessage({id:"preset.closeButtonText"})})]})})]})})}},68578:function(e,t,a){a.d(t,{E2:function(){return n},Eb:function(){return r},_R:function(){return l},e9:function(){return i},yY:function(){return s}});let s="5554127570263484bba9",l="5554127570263484bba9",r="2080dd4e48a11ba3ab74",i="425a95f1c2ed828555d9",n=[{model:"basic",name:"basic",price:1},{model:"detailed",name:"detailed",price:4}]},15690:function(e,t,a){a.d(t,{EV:function(){return uploadImageUrlToS3},Xi:function(){return i},rN:function(){return resolveImageUrlForUpload},yj:function(){return uploadDataUrlToS3}});var s=a(88773),l=a(43),r=a(80691);let i="/design/get-upload-url";async function uploadBlobToS3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=e.type||"image/jpeg",r=(a.split("/")[1]||"jpg").replace("jpeg","jpg"),{data:n}=await l.Z.post(t.presignPath||i,{content_type:a,ext:r});if(!(null==n?void 0:n.uploadUrl)||!(null==n?void 0:n.publicUrl))throw Error("presign_failed");let o=await fetch(n.uploadUrl,{method:"PUT",body:e,headers:{"Content-Type":a}});if(!o.ok)throw Error("s3_put_failed_".concat(o.status));
1return{uuid:n.uuid||(0,s.Z)(),key:n.key,cdnUrl:n.publicUrl}}async function uploadDataUrlToS3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return uploadBlobToS3((0,r.kD)(e),t)}async function uploadImageUrlToS3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=await fetch(e);if(!a.ok)throw Error("image_fetch_failed_".concat(a.status));return uploadBlobToS3(await a.blob(),t)}async function resolveImageUrlForUpload(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e.startsWith("data:")){let{cdnUrl:a}=await uploadDataUrlToS3(e,t);return a}return e}}}]);

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.