1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5c90c7a6-44c2-4e53-bc43-2cc389c9751e",e._sentryDebugIdIdentifier="sentry-dbid-5c90c7a6-44c2-4e53-bc43-2cc389c9751e")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4087],{27751:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/studio",function(){return r(24874)}])},42842:function(e,t,r){"use strict";r.d(t,{g:function(){return u}});var n=r(85893),a=r(67294),l=r(44524),o=r(6391),i=r(29310),s=r(27951),d=r(42029);function c(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(Boolean).join(" ")}function u(e){let[t,r]=(0,a.useState)([]),[u,m]=(0,a.useState)(""),{name:f,label:p=f,onChange:h,isUploading:g=!1,squareImageRequired:x=!1,smallDropArea:v=!1,className:y}=e,b=(0,a.useCallback)(e=>{m("");let t=e=>new Promise((t,r)=>{if(e.size>10485760){r("File is too large. Please upload a file less than 10MB.");return}let n=new Image;n.src=URL.createObjectURL(e),n.onload=()=>{x&&(n.width!==n.height||n.width<1024)?r("Image does not meet size requirements. Please upload a square image that is at least 1024px by 1024px."):t(e)},n.onerror=()=>{r("Error loading image.")}});Promise.all(e.map(e=>x?t(e).catch(e=>{var t;return t="imageUploadValidationFailed",d.cM.error("Upload Error",{message:e}),m(e),s.Z.track(t),r([]),h([]),null}):Promise.resolve(e))).then(e=>{let t=e.filter(e=>null!==e);t.length>0&&(r(t.map(e=>({...e,preview:URL.createObjectURL(e)}))),h(t))})},[]),{acceptedFiles:w,getRootProps:j,getInputProps:N,isDragActive:_,fileRejections:k}=(0,l.uI)({maxFiles:1,maxSize:10485760,multiple:!1,onDrop:b,accept:e.accept}),S=k.length>0&&k[0].file.size>10485760;return(0,n.jsx)("div",{className:c(g||(null==t?void 0:t.length)>0?"":"border-2 border-dashed border-gray-300 transition-all duration-300 ease-in-out",_?"border-violet-600 shadow-violet":"","flex justify-center rounded-xl mx-auto","w-full h-full flex flex-col",y),children:(null==t?void 0:t.length)&&!S?(0,n.jsx)("div",{className:"grid grid-cols-1 gap-1",children:t.map(e=>(0,n.jsxs)("div",{className:"flex relative items-center justify-center",children:[g&&(0,n.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center backdrop-blur-sm bg-gray-300 bg-opacity-50 z-10 rounded-xl",children:[(0,n.jsxs)("svg",{className:"animate-spin -ml-1 mr-3 h-6 w-6 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,n.jsx)("p",{className:"text-white font-bold text-xl",children:"Uploading..."})]}),(0,n.jsxs)("div",{className:"max-w-full overflow-hidden rounded-xl relative",children:[(0,n.jsx)("img",{src:e.preview,alt:e.name,onLoad:()=>{URL.revokeObjectURL(e.preview)},className:"object-contain max-h-[150px] md:max-h-[200px] xl:max-h-[250px] 2xl:max-h-[350px] mx-auto"}),!g&&(0,n.jsx)("button",{onClick:n=>{r(t.filter(t=>t!==e)),h(t.filter(t=>t!==e))},className:"absolute top-1 right-1 inline-flex items-center rounded-full border border-gray-100 backdrop-blur-sm px-1.5 py-1.5 text-xs font-medium text-red-500 shadow-sm hover:bg-gray-300 hover:bg-opacity-50 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2",children:(0,n.jsx)(i.Z,{className:"h-4 w-4","aria-hidden":"true"})})]})]},e.name))}):(0,n.jsxs)("div",{...j(),className:"flex flex-col justify-center items-center space-y-1 text-center p-4 w-full flex-grow bg-gray-50 rounded-xl",children:[(0,n.jsx)("input",{...N()}),(0,n.jsx)("div",{className:"flex text-sm text-gray-500 relative cursor-pointer rounded-md font-medium focus-within:outline-none focus-within:ring-2 focus-within:ring-violet-700 focus-within:ring-offset-2 hover:text-violet-700",children:_?(0,n.jsx)("span",{children:"Drop your image here"}):(0,n.jsx)("div",{className:c(v?"flex-col":null,"flex items-center"),children:v?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.Z,{className:"text-violet-800"}),(0,n.jsxs)("button",{type:"button",className:"w-full pt-1 px-3.5 text-xs font-semibold text-violet-800 hover:text-violet-700 whitespace-normal",children:["Click to upload",(0,n.jsx)("span",{className:"text-slate-500 hover:text-violet-700 text-xs font-normal ml-1",children:"or drag and drop"})]})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"inline-flex items-center gap-x-2 rounded-md bg-vi
1olet-800 py-2.5 px-3.5 text-sm font-semibold text-white shadow-sm hover:bg-violet-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-violet-800",children:[(0,n.jsx)("svg",{className:"-ml-0.5 h-8 w-8",stroke:"currentColor",fill:"none",viewBox:"0 0 48 48","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}),"Select an image"]}),(0,n.jsx)("div",{className:"hidden sm:inline-flex ml-2",children:"or drag and drop your image here."})]})})}),S&&(0,n.jsx)("p",{className:"text-sm text-red-500",children:"File is too large. Please upload a file less than 10MB."}),u&&(0,n.jsx)("p",{className:"text-sm text-red-500",children:u}),(0,n.jsx)("p",{className:"text-xs text-slate-500",children:"PNG, JPG, or WebP (up to 10MB)"})]})})}},6689:function(e,t,r){"use strict";var n=r(85893);r(67294);var a=r(83639),l=r(14902);t.Z=e=>{let{children:t}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"h-full min-h-screen lg:h-screen w-screen flex overflow-hidden",children:(0,n.jsxs)("div",{className:"relative flex min-h-screen h-full w-full grow overflow-y-auto",children:[(0,n.jsx)(a.Z,{className:"fixed top-0 h-12 z-50 w-full"}),(0,n.jsx)("div",{className:"pt-12 h-full min-h-screen w-full flex flex-col grow lg:flex-row ",children:t})]})}),(0,n.jsx)(l.x,{closeButton:!0})]})}},80569:function(e,t,r){"use strict";r.d(t,{z:function(){return d}});var n=r(85893),a=r(67294),l=r(88426),o=r(12003),i=r(12423);let s=(0,o.j)("inline-flex items-center justify-center gap-2 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 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{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=a.forwardRef((e,t)=>{let{className:r,variant:a,size:o,asChild:d=!1,...c}=e,u=d?l.g7:"button";return(0,n.jsx)(u,{className:(0,i.cn)(s({variant:a,size:o,className:r})),ref:t,...c})});d.displayName="Button"},74500:function(e,t,r){"use strict";r.d(t,{O:function(){return l}});var n=r(85893),a=r(12423);function l(e){let{className:t,...r}=e;return(0,n.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-md bg-muted",t),...r})}},58266:function(e,t,r){"use strict";async function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"png",r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"blob",a=new FormData;a.append("image_file",e),a.append("format",t),r&&a.append("crop","true");let l={method:"POST",headers:{Accept:"".concat("blob"===n?"image/png":"application/json"),"x-api-key":"e72a0aeeff40ba2a116a5d1df0538068fd78d9e5"}};l.body=a;let o=await fetch("https://sdk.photoroom.com/v1/segment",l);if(!o.ok){let e=await o.json();throw console.log("Error removing background",e),Error(e.detail)}return"blob"===n?await o.blob():await o.json()}r.d(t,{Z:function(){return n}})},98151:function(e,t,r){"use strict";async function n(e,t){var r=new FormData;r.append("file",e),r.append("upload_preset",t),r.append("options",'{"resource_type": "image"}');try{let e=await fetch("https://api.cloudinary.com/v1_1/dzhiiiavj/image/upload",{method:"POST",body:r});if(!e.ok)throw Error("Upload failed with status: ".concat(e.status));return await e.json()}catch(e){throw console.error("Cloudinary upload error:",e),e}}r.d(t,{Z:function(){return n}})},24874:function(e,t,r){"use strict";r.r(t),r.d(t,{__N_SSP:function(){return F},default:function(){return D}});var n=r(85893),a=r(6689),l=r(67294),o=r(42842),i=r(75198),s=r(44348),d=r(84053),c=r(80569),u=r(41664),m=r.n(u);let f=l.forwardRef(function(e,t){let{title:r,titleId:n,...a}=e;return l.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":n},a),r?l.createElement("title",{id:n},r):null,l.createElement("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))});var p=r(74500);let h=[{id:1,name:"Honey",category:"Jar",url:"http://res.cloudinary.com/dzhiiiavj/image/upload/v1687991072/uploads_bgremoved/x5sbtjeldrjm6gwzi9w3.png",public_id:"uploads_bgremoved/x5sbtjeldrjm6gwzi9w3",asset_id:"384b2971ffc9eeca2228807dbd28ff4a",width:"745",height:"820",format:"png",original_filename:"image (28)"},{id:2,name:"Lotion",category:"Bottle",url:"http://res.cloudinary.com/dzhiiiavj/image/upload/v1687991328/uploads_bgremoved/sykozzlhq3ff2hjdohfy.png",public_id:"uploads_bgremoved/sykozzlhq3ff2hjdohfy",asset_id:"c993edac050fd1e63364331690fa2dd3",width:"405",height:"613",format:"png",original_filename:"image (29)"},{id:3,name:"Chiwi",category:"Package",url:"http://res.cloudinary.com/dzhiiiavj/image/upload/v1687991844/uploads_bgremoved/rn8shorhrwqsodffr7ib.png",public_id:"uploads_bgremoved/rn8shorhrwqsodffr7ib",asset_id:"d3fc2a374793d91915d29a5fd1266647",width:"683",height:"931",format:"png",original_filename:"image (30)"}];function g(e){let{imageHandler:t,setLoadingSampleImage:r,handleSampleUploadContinue:a}=e,[o,u]=(0,l.useState)([]),{user:g}=(0,s.aF)(),x=(0,d.useSupabaseClient)(),[v,y]=(0,l.useState)(!1);async function b(e){r(!0);let n=await t(e);a(e.name,e.category,n)}return(0,l.useEffect)(()=>{let e=async()=>{y(!0);let{data:e,error:t}=await x.from("products").select("name, category, uploaded_photos(uploaded_photo_id, public_id, url, product_id, width, height)").eq("profile_id",g.id).order("created_at",{ascending:!1}
1).not("category","is",null).not("name","is",null).limit(3);if(t){console.error(t);return}e.length>0&&u(e.map(e=>{var t,r,n,a,l,o;let{name:i,category:s,uploaded_photos:d}=e,c=null===(t=d[0])||void 0===t?void 0:t.public_id,u=null===(r=d[0])||void 0===r?void 0:r.uploaded_photo_id,m=null===(n=d[0])||void 0===n?void 0:n.url;return{name:i,category:s,public_id:c,uploaded_photo_id:u,url:m,product_id:null===(a=d[0])||void 0===a?void 0:a.product_id,width:null===(l=d[0])||void 0===l?void 0:l.width,height:null===(o=d[0])||void 0===o?void 0:o.height}})),y(!1)};g&&e()},[g,x]),(0,n.jsx)("div",{className:"text-center",children:(0,n.jsx)("div",{className:"flex items-center justify-center w-full mx-auto",children:(0,n.jsx)("div",{className:"relative w-full max-w-xl",children:v&&0===o.length?(0,n.jsx)("div",{className:"grid grid-cols-3 gap-4 p-2",children:[void 0,void 0,void 0].map((e,t)=>(0,n.jsx)("div",{className:"relative",children:(0,n.jsx)("div",{className:"flex flex-col items-center cursor-pointer text-gray-900 hover:ring-inset hover:ring-1 hover:ring-gray-300 hover:rounded-lg hover:bg-white hover:shadow-sm",children:(0,n.jsx)(p.O,{className:"object-scale-down p-6 h-full w-full rounded-xl mr-2 h-28 w-28"})})},t))}):0===o.length?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"text-center mx-auto font-medium text-sm",children:"Choose a sample product to try"}),(0,n.jsx)("div",{className:"grid grid-cols-3 gap-4 p-2",children:h.map(e=>(0,n.jsx)("div",{className:"relative",children:(0,n.jsx)("div",{className:"flex flex-col items-center cursor-pointer text-gray-900 aspect-w-1 aspect-h-1 hover:ring-inset hover:ring-1 hover:ring-gray-300 hover:rounded-lg hover:bg-white hover:shadow-sm",children:(0,n.jsx)(i.bz,{src:e.public_id,width:512,height:512,alt:"",className:"object-scale-down p-6 rounded-xl mr-2 h-full w-full",onClick:()=>b(e)})})},e.id))})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"text-center mx-auto font-medium text-sm",children:"Recently Uploaded Products"}),(0,n.jsxs)("div",{className:"grid grid-cols-4 gap-4 p-2",children:[o.map(e=>(0,n.jsx)("div",{className:"relative",children:(0,n.jsx)(m(),{href:"/studio/".concat(e.uploaded_photo_id),children:(0,n.jsx)("div",{className:"flex flex-col items-center cursor-pointer text-gray-900 aspect-w-1 aspect-h-1 hover:ring-inset hover:ring-1 hover:ring-gray-300 hover:rounded-lg hover:bg-white hover:shadow-sm",children:(0,n.jsx)(i.bz,{src:e.public_id,width:512,height:512,alt:"",className:"object-scale-down w-full h-full p-6 rounded-xl mr-2",onClick:()=>b(e)})})})},e.uploaded_photo_id)),(0,n.jsx)("div",{className:"relative flex items-center h-28",children:(0,n.jsx)(m(),{href:"/products",children:(0,n.jsxs)(c.z,{variant:"outline",className:"relative flex items-center cursor-pointer text-gray-900 hover:ring-inset hover:ring-1 hover:ring-gray-300 hover:rounded-lg hover:bg-white hover:shadow-sm w-full",children:["View all",(0,n.jsx)(f,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})]})})})]})]})})})})}var x=r(35147),v=r(11163),y=r(27951),b=r(93967),w=r.n(b),j=r(25675),N=r.n(j);let _=[{title:"An Introductory Guide to ProductShots.ai",coverImage:"/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2Fbdznejuf%2Fproduction%2F44f3ddb2030db64ccf1b45a8a607657c6576f339-2000x1000.jpg%3Fw%3D2000%26h%3D1000%26fit%3Dmax%26auto%3Dformat&w=3840&q=75",slug:"generating-product-photography-with-ai-an-in-depth-guide-to-productshots-ai"},{title:"Using Scene Guides to Better Control AI Product Photoshoots",coverImage:"/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2Fbdznejuf%2Fproduction%2Fe6ce24b853f7b105909582a39f70267c307854e6-2000x1000.jpg%3Fw%3D2000%26h%3D1000%26fit%3Dmax%26auto%3Dformat&w=3840&q=75",slug:"ai-product-photos-composition"},{title:"Directing AI Photoshoots with Prompts",coverImage:"/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2Fbdznejuf%2Fproduction%2F963362444924c3c3aad1667f3ecb20d66ce78def-2000x1000.jpg%3Fw%3D2000%26h%3D1000%26fit%3Dmax%26auto%3Dformat&w=3840&q=75",slug:"prompting-ai-photos"}];function k(e){let{handleAcceptedImage:t,handleSampleImage:r,isUploading:a,newlyUploadedPhotoData:i}=e,{isTrialUser:c}=(0,s.aF)();console.log(c);let[u,f]=(0,l.useState)(null),[p,h]=(0,l.useState)(null),[b,j]=(0,l.useState)(!1),[k,S]=(0,l.useState)(!1),[P,C]=(0,l.useState)(!1);(0,l.useEffect)(()=>{a&&!b&&C(!0)},[a]),(0,l.useEffect)(()=>{null==i&&!a&&P&&(C(!1),f(null),h(null))},[i]);let E=(0,v.useRouter)(),I=(0,d.useSupabaseClient)();async function F(){if(i){S(!0);let{error:e}=await I.from("products").update({name:u,category:p}).eq("product_id",i.product_id);e&&console.log(e),y.Z.track("productShotAdded",{product_id:i.product_id,uploaded_photo_id:i.uploaded_photo_id,product_name:u,product_category:p}),E.push("/studio/".concat(i.uploaded_photo_id,"/?newUpload=true"))}}async function D(e,t,r){if(r){S(!0);let{error:n}=await I.from("products").update({name:e,category:t}).eq("product_id",r.product_id);n&&console.log(n),y.Z.track("sampleProductShotAdded",{product_id:r.product_id,uploaded_photo_id:r.uploaded_photo_id,product_name:e,product_category:t}),E.push("/studio/".concat(r.uploaded_photo_id))}}return(0,n.jsxs)("div",{className:"flex flex-col lg:flex-row lg:space-x-4 h-full",children:[b&&(0,n.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center backdrop-blur-sm bg-gray-500 bg-opacity-50 z-10 rounded-xl",children:[(0,n.jsxs)("svg",{className:"animate-spin -ml-1 mr-3 h-6 w-6 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,n.jsx)("p",{className:"text-white font-bold text-xl",children:"Loading Product..."})]}),(0,n.jsxs)("div",{className:"w-full m-auto px-2 lg:px-20 lg:basis-8/12",children:[(0,n.jsxs)("div",{className:"m-4 sm:my-8",children:[(0,n.jsx)("h1",{className:"text-xl md:text-3xl mb-4 font-bold leading-tight tracking-tight text-gray-900 text-center",children:"Start by uploading your productâs photo"}),(0,n.jsx)(o.g,{accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg"],"image/webp":[".webp"]},name:"images",onChange:t,isUploading:a})]}),P?(0,n.jsxs)("div",{className:"mt-6 w-full flex flex-col sm:flex-row space-y-4 sm:sp
1ace-x-4 sm:space-y-0 sm:space-x-4 items-center sm:items-end max-w-2xl mx-auto",children:[(0,n.jsxs)("div",{className:"w-full sm:flex-1",children:[(0,n.jsx)("label",{htmlFor:"first-name",className:"block text-sm font-medium leading-6 text-gray-900",children:(0,n.jsx)("span",{children:"Product Name"})}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)("input",{type:"text",name:"name",id:"name",onChange:e=>f(e.target.value),placeholder:"Your products name",className:"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"})})]}),(0,n.jsxs)("div",{className:"w-full sm:flex-1",children:[(0,n.jsxs)("div",{className:"flex",children:[(0,n.jsx)("label",{htmlFor:"last-name",className:"flex-auto text-sm font-medium leading-6 text-gray-900",children:(0,n.jsx)("span",{children:"Describe the category of your product"})}),(0,n.jsx)("span",{className:"text-sm leading-6 text-red-500 ml-1",id:"productCategory-required",children:"*"})]}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)("input",{type:"text",name:"productCategory",id:"productCategory",onChange:e=>h(e.target.value),placeholder:"Blue leather bag, gray shampoo bottle, gold jewelry...",className:"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"})})]}),(0,n.jsx)("div",{className:"w-full sm:flex-shrink-0 sm:w-auto text-center mt-4",children:(0,n.jsx)(x.z,{disabled:null==i||null==p||""===p.trim(),loading:k,onClick:F,className:"disabled:bg-opacity-30",children:"Continue"})})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"relative m-4",children:[(0,n.jsx)("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true",children:(0,n.jsx)("div",{className:"w-full border-t border-gray-300"})}),(0,n.jsx)("div",{className:"relative flex justify-center",children:(0,n.jsx)("span",{className:"bg-gray-50 px-4 text-gray-600",children:"OR"})})]}),(0,n.jsx)("div",{className:"m-4 sm:my-8 text-center",children:(0,n.jsx)(g,{imageHandler:r,handleSampleUploadContinue:D,setLoadingSampleImage:j})})]})]}),(0,n.jsxs)("div",{className:"lg:basis-4/12 bg-gray-100 my-4 rounded-lg bg-white mt-6 border border-gray-100 p-6 relative justify-center",children:[c?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h2",{className:"font-bold text-xl text-violet-900 text-center",children:"Welcome to ProductShots!"}),(0,n.jsx)("p",{className:"text-sm text-gray-700 mt-2",children:"Use ProductShots free for 10 generations (or 40 images generated) - when you have run out of generation credits, your photos are still yours to keep forever. So, letâs create some incredible AI generated photos!"}),(0,n.jsx)("p",{className:"text-sm text-gray-700 mt-2 italic",children:"*Tip: you can always view your credit usage at the top bar"}),(0,n.jsx)("div",{className:"inset-0 flex items-center mt-4","aria-hidden":"true",children:(0,n.jsx)("div",{className:"w-full border-t border-violet-300"})})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"text-sm text-gray-700 mt-2",children:"Learn how to get the most out of your ProductShots account"}),(0,n.jsx)("div",{className:"inset-0 flex items-center my-4","aria-hidden":"true",children:(0,n.jsx)("div",{className:"w-full border-t border-violet-300"})}),_.map((e,t)=>(0,n.jsx)(m(),{href:"/blog/".concat(e.slug),passHref:!0,target:"_blank",children:(0,n.jsxs)("div",{className:"cursor-pointer border rounded-md p-1 mb-4 bg-gray-50 hover:bg-white hover:shadow-sm",children:[(0,n.jsx)("h3",{className:"mb-2 text-lg leading-snug text-center",children:e.title}),(0,n.jsx)("div",{className:"rounded-md",children:(0,n.jsx)("div",{className:"sm:mx-0",children:(0,n.jsx)("div",{className:w()("shadow-small",{"transition-shadow duration-200 hover:shadow-medium":e.slug}),children:(0,n.jsx)(N(),{className:"h-auto w-full rounded-md max-w-[300px] mx-auto",width:1e3,height:500,alt:e.title,src:e.coverImage,sizes:"100vw",priority:!1})})})})]})}
1,e.title))]}),c&&(0,n.jsxs)("div",{className:"lg:absolute lg:bottom-0 lg:left-1/2 lg:transform lg:-translate-x-1/2 my-4 mx-auto w-full max-w-xl px-4",children:[(0,n.jsx)("h3",{className:"font-semibold text-xl text-violet-700 text-center mt-4",children:"Ready for more?"}),(0,n.jsx)("p",{className:"text-sm text-gray-700 mt-2 text-center",children:"Upgrade to a paid plan to get unlimited generations and more! From $9/month for a limited time"}),(0,n.jsx)(x.z,{className:"mt-4 w-full",variant:"solidLightLarge",href:"/pricing",children:"Upgrade plan"})]})]})]})}var S=r(98151),P=r(58266);async function C(e){if(!("image/png"===e.type||"image/webp"===e.type||"image/heif"===e.type))return!1;{let t=new Image,r=new FileReader,n=new Promise((n,a)=>{r.onload=function(e){t.src=e.target.result,t.onload=function(){let e=document.createElement("canvas");e.width=t.width,e.height=t.height;let r=e.getContext("2d");r.drawImage(t,0,0);let a=r.getImageData(0,0,e.width,e.height);for(let e=0;e<a.data.length;e+=4)a.data[e+3]<255&&n(!0);n(!1)}},r.onerror=function(e){console.error("Error reading image file: ",e),a(e)},r.readAsDataURL(e)});try{return await n}catch(e){throw console.error("Error reading image file: ",e),e}}}var E=r(64712);function I(){let{user:e}=(0,s.aF)(),[t,r]=(0,l.useState)(!1),[a,o]=(0,l.useState)(null);async function i(e){if(!e||0===e.length){o(null);return}r(!0),await (0,S.Z)(e[0],"user_product_upload");let t=await C(e[0]),n=null;if(t)n=e[0];else try{n=await (0,P.Z)(e[0])}catch(e){throw E.Am.error("Error Removing Background",{description:e}),r(!1),Error("Error removing background from image: "+e)}y.Z.track("imageUploaded");let a=await (0,S.Z)(n,"user_product_upload_bgremoved"),l=await c(a);return o(l.data),r(!1),l.data}let d=(0,l.useCallback)(async e=>{r(!0);let t=null;if(e.product_id)o(e),t=e;else{let r=await c(e);o(r.data),t=r.data}return r(!1),t},[]);async function c(t){let{asset_id:r,public_id:n,width:a,height:l,format:o,url:i,original_filename:s}=t,d=await fetch("/api/images/upload",{method:"POST",body:JSON.stringify({asset_id:r,public_id:n,width:a,height:l,format:o,url:i,original_filename:s,user_id:e.id})});return await d.json()}return(0,n.jsx)("div",{className:"flex h-full w-screen flex justify-center items-center",children:e&&(0,n.jsx)(k,{handleAcceptedImage:i,handleSampleImage:d,isUploading:t,newlyUploadedPhotoData:a})})}var F=!0;function D(){let e=(0,v.useRouter)(),{userDetails:t,subscriptionPlan:r,updateUserDetails:o}=(0,s.aF)(),i=(0,l.useRef)(!1),d=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{if(t&&"true"===e.query.onboarded&&!d.current){y.Z.track("signup",{userId:t.id,userEmail:t.email}),fetch("/api/notifications/newProfile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t.id})}),window.gr&&window.gr("track","conversion",{email:t.email}),d.current=!0;let{onboarded:r,...n}=e.query;e.replace({pathname:e.pathname,query:n},void 0,{scroll:!1})}},[t,e.query.onboarded,r]),(0,l.useEffect)(()=>{t&&"Trial"!==r&&"complete"===e.query.checkout&&!i.current&&(y.Z.track("purchase",{userId:t.id,userEmail:t.email,subscription_plan:r}),i.current=!0)},[t,e.query.checkout,r]),(0,l.useEffect)(()=>{t&&r&&y.Z.identify(t.id,{email:t.email,name:t.full_name,organization:t.organization,organization_id:t.organization_id,subscription_plan:r,website:t.website,role:t.role,outcome:t.outcome,ecom_platform:t.ecom_platform,referral_source:t.referral_source})},[]),(0,n.jsx)(a.Z,{children:(0,n.jsx)(I,{})})}},93967:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=l(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return a.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var r in e)n.call(e,r)&&e[r]&&(t=l(t,r));return t}(r)))}return e}function l(e,t){return t?e?e+" "+t:e+t:e}e.exports?(a.default=a,e.exports=a):void 0!==(r=(function(){return a}).apply(t,[]))&&(e.exports=r)}()},28771:function(e,t,r){"use strict";r.d(t,{F:function(){return l},e:function(){return o}});var n=r(67294);function a(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function l(...e){return t=>{let r=!1,n=e.map(e=>{let n=a(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():a(e[t],null)}}}}function o(...e){return n.useCallback(l(...e),e)}},88426:function(e,t,r){"use strict";r.d(t,{g7:function(){return o}});var n=r(67294),a=r(28771),l=r(85893),o=n.forwardRef((e,t)=>
1{let{children:r,...a}=e,o=n.Children.toArray(r),s=o.find(d);if(s){let e=s.props.children,r=o.map(t=>t!==s?t:n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null);return(0,l.jsx)(i,{...a,ref:t,children:n.isValidElement(e)?n.cloneElement(e,void 0,r):null})}return(0,l.jsx)(i,{...a,ref:t,children:r})});o.displayName="Slot";var i=n.forwardRef((e,t)=>{let{children:r,...l}=e;if(n.isValidElement(r)){let e,o;let i=(e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?r.ref:(e=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?r.props.ref:r.props.ref||r.ref;return n.cloneElement(r,{...function(e,t){let r={...t};for(let n in t){let a=e[n],l=t[n];/^on[A-Z]/.test(n)?a&&l?r[n]=(...e)=>{l(...e),a(...e)}:a&&(r[n]=a):"style"===n?r[n]={...a,...l}:"className"===n&&(r[n]=[a,l].filter(Boolean).join(" "))}return{...e,...r}}(l,r.props),ref:t?(0,a.F)(t,i):i})}return n.Children.count(r)>1?n.Children.only(null):null});i.displayName="SlotClone";var s=({children:e})=>(0,l.jsx)(l.Fragment,{children:e});function d(e){return n.isValidElement(e)&&e.type===s}},12003:function(e,t,r){"use strict";r.d(t,{j:function(){return o}});var n=r(90512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=n.W,o=(e,t)=>r=>{var n;if((null==t?void 0:t.variants)==null)return l(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(e=>{let t=null==r?void 0:r[e],n=null==i?void 0:i[e];if(null===t)return null;let l=a(t)||a(n);return o[e][l]}),d=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return l(e,s,null==t?void 0:null===(n=t.compoundVariants)||void 0===n?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...i,...d}[t]):({...i,...d})[t]===r})?[...e,r,n]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},83216:function(e,t,r){"use strict";let n,a;r.d(t,{p:function(){return C}});var l,o=r(67294),i=r(46978),s=r(13114),d=r(65141),c=r(78405),u=r(20476),m=r(37726),f=r(28277),p=r(14371),h=r(5750);let g=null!=(l=o.startTransition)?l:function(e){e()};var x=r(72118),v=((n=v||{})[n.Open=0]="Open",n[n.Closed=1]="Closed",n),y=((a=y||{})[a.ToggleDisclosure=0]="ToggleDisclosure",a[a.CloseDisclosure=1]="CloseDisclosure",a[a.SetButtonId=2]="SetButtonId",a[a.SetPanelId=3]="SetPanelId",a[a.LinkPanel=4]="LinkPanel",a[a.UnlinkPanel=5]="UnlinkPanel",a);let b={0:e=>({...e,disclosureState:(0,f.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},4:e=>!0===e.linkedPanel?e:{...e,linkedPanel:!0},5:e=>!1===e.linkedPanel?e:{...e,linkedPanel:!1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId}},w=(0,o.createContext)(null);function j(e){let t=(0,o.useContext)(w);if(null===t){let t=Error("<".concat(e," /> is missing a parent <Disclosure /> component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,j),t}return t}w.displayName="DisclosureContext";let N=(0,o.createContext)(null);N.displayName="DisclosureAPIContext";let _=(0,o.createContext)(null);function k(e,t){return(0,f.E)(t.type,b,e,t)}
1_.displayName="DisclosurePanelContext";let S=o.Fragment,P=h.AN.RenderStrategy|h.AN.Static,C=Object.assign((0,h.yV)(function(e,t){let{defaultOpen:r=!1,...n}=e,a=(0,o.useRef)(null),l=(0,c.T)(t,(0,c.h)(e=>{a.current=e},void 0===e.as||e.as===o.Fragment)),s=(0,o.useRef)(null),d=(0,o.useRef)(null),m=(0,o.useReducer)(k,{disclosureState:r?0:1,linkedPanel:!1,buttonRef:d,panelRef:s,buttonId:null,panelId:null}),[{disclosureState:g,buttonId:x},v]=m,y=(0,i.z)(e=>{v({type:1});let t=(0,p.r)(a);if(!t||!x)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(x):t.getElementById(x);null==r||r.focus()}),b=(0,o.useMemo)(()=>({close:y}),[y]),j=(0,o.useMemo)(()=>({open:0===g,close:y}),[g,y]);return o.createElement(w.Provider,{value:m},o.createElement(N.Provider,{value:b},o.createElement(u.up,{value:(0,f.E)(g,{0:u.ZM.Open,1:u.ZM.Closed})},(0,h.sY)({ourProps:{ref:l},theirProps:n,slot:j,defaultTag:S,name:"Disclosure"}))))}),{Button:(0,h.yV)(function(e,t){let r=(0,s.M)(),{id:n="headlessui-disclosure-button-".concat(r),...a}=e,[l,u]=j("Disclosure.Button"),f=(0,o.useContext)(_),p=null!==f&&f===l.panelId,g=(0,o.useRef)(null),v=(0,c.T)(g,t,p?null:l.buttonRef),y=(0,h.Y2)();(0,o.useEffect)(()=>{if(!p)return u({type:2,buttonId:n}),()=>{u({type:2,buttonId:null})}},[n,u,p]);let b=(0,i.z)(e=>{var t;if(p){if(1===l.disclosureState)return;switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),u({type:0}),null==(t=l.buttonRef.current)||t.focus()}}else switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),u({type:0})}}),w=(0,i.z)(e=>{e.key===x.R.Space&&e.preventDefault()}),N=(0,i.z)(t=>{var r;(0,m.P)(t.currentTarget)||e.disabled||(p?(u({type:0}),null==(r=l.buttonRef.current)||r.focus()):u({type:0}))}),k=(0,o.useMemo)(()=>({open:0===l.disclosureState}),[l]),S=(0,d.f)(e,g),P=p?{ref:v,type:S,onKeyDown:b,onClick:N}:{ref:v,id:n,type:S,"aria-expanded":0===l.disclosureState,"aria-controls":l.linkedPanel?l.panelId:void 0,onKeyDown:b,onKeyUp:w,onClick:N};return(0,h.sY)({mergeRefs:y,ourProps:P,theirProps:a,slot:k,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,h.yV)(function(e,t){let r=(0,s.M)(),{id:n="headlessui-disclosure-panel-".concat(r),...a}=e,[l,i]=j("Disclosure.Panel"),{close:d}=function e(t){let r=(0,o.useContext)(N);if(null===r){let r=Error("<".concat(t," /> is missing a parent <Disclosure /> component."));throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),m=(0,h.Y2)(),f=(0,c.T)(t,l.panelRef,e=>{g(()=>i({type:e?4:5}))});(0,o.useEffect)(()=>(i({type:3,panelId:n}),()=>{i({type:3,panelId:null})}),[n,i]);let p=(0,u.oJ)(),x=null!==p?(p&u.ZM.Open)===u.ZM.Open:0===l.disclosureState,v=(0,o.useMemo)(()=>({open:0===l.disclosureState,close:d}),[l,d]);return o.createElement(_.Provider,{value:l.panelId},(0,h.sY)({mergeRefs:m,ourProps:{ref:f,id:n},theirProps:a,slot:v,defaultTag:"div",features:P,visible:x,name:"Disclosure.Panel"}))})})},84305:function(e,t,r){"use strict";r.d(t,{i:function(){return l}});var n=r(67294),a=r(14371);function l(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.useMemo)(()=>(0,a.r)(...t),[...t])}},65141:function(e,t,r){"use strict";r.d(t,{f:function(){return o}});var n=r(67294),a=r(62922);function l(e){var t;if(e.type)return e.type;let r=null!=(t=e.as)?t:"button";if("string"==typeof r&&"button"===r.toLowerCase())return"button"}function o(e,t){let[r,o]=(0,n.useState)(()=>l(e));return(0,a.e)(()=>{o(l(e))},[e.type,e.as]),(0,a.e)(()=>{r||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&o("button")},[r,t]),r}}},function(e){e.O(0,[8388,8159,1664,5675,290,5198,4597,7423,7159,6544,3639,2888,9774,179],function(){return e(e.s=27751)}),_N_E=e.O()}]);
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.