(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[544],{14293:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/remove-background",function(){return n(28737)}])},29674:function(e,t,n){"use strict";var a=n(85893),o=n(67294),s=n(32512),r=n(454),i=n(51755);t.Z=e=>{let{handleAiPhoto:t,toast:n,setImageSrc:l,setLoading:c,params:u}=e,[d,p]=(0,o.useState)(null),m=(0,o.useCallback)(async e=>{if(c(!0),e&&e.length>0){let a=e[0];a&&(p(a),l(URL.createObjectURL(a)));let o=new FileReader;o.onloadend=async e=>{let a=await t(o);(null==a?void 0:a.error)&&n.error(a.error),l(e.target.result),p(null),c(!1)},o.readAsDataURL(a)}else console.log("No file selected"),c(!1)},[u]),{getRootProps:f,getInputProps:h,isDragActive:g}=(0,s.uI)({onDrop:m});return(0,a.jsxs)("div",{...f(),className:"dropzone ".concat(g?"active":""," flex w-full cursor-pointer justify-center border-2 border-zinc-100/50 border-dashed rounded-2xl p-10 text-white backdrop-blur-sm"),children:[(0,a.jsx)("input",{...h()}),g?(0,a.jsx)("p",{className:"font-semibold",children:"Thả h\xecnh tại đ\xe2y..."}):(0,a.jsx)("div",{className:"flex items-center font-sans text-xl font-semibold",children:null!==d?(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("p",{className:"font-semibold mb-4",children:["Đang xử l\xfd ",d.name,"..."]}),(0,a.jsx)(i.W,{size:"sm",isIndeterminate:!0,"aria-label":"Loading...",classNames:{base:"max-w-full",track:"drop-shadow-md border border-default",indicator:"bg-gradient-to-r from-black via-gray-500 to-white",label:"tracking-wider font-medium text-default-600",value:"text-foreground/60"}})]}):(0,a.jsxs)("div",{className:"flex flex-col justify-center content-center items-center",children:[(0,a.jsx)(r.IRQ,{className:"ml-2 text-3xl"}),(0,a.jsx)("span",{className:"text-base mt-2 animate-shine",children:"Chọn ảnh từ thiết bị hoặc k\xe9o v\xe0 thả"}),(0,a.jsx)("span",{className:" text-small mt-2 font-thin",children:"K\xedch thước ảnh tối đa 10MB"})]})})]})}},28737:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return y},default:function(){return v}});var a=n(85893),o=n(80903),s=n(91444);n(30928);var r=n(29204),i=n(25675),l=n.n(i),c=n(37840),u=n(75829),d=n(55958),p=n(67294),m=n(94853),f=n(29674),h=n(84059),g=n(5434),y=!0;function v(e){let{user:t}=e,[n,i]=(0,p.useState)("/images/portrait/".concat(Math.floor(6*Math.random())+1,".jpg")),[y,v]=(0,p.useState)(null),[T,b]=(0,p.useState)(!1),E=async e=>{var t,n,a,o,i;b(!0),v(null);try{let o=e.result.replace("data:image/png;base64,","").replace("data:image/jpeg;base64,","").replace("data:image/jpg;base64,","").replace("data:image/webp;base64,",""),i=await (0,h.B0)(o),l={image:null==i?void 0:null===(n=i.data)||void 0===n?void 0:null===(t=n.data)||void 0===t?void 0:t.display_url},u=await c.Z.removeBackground(l);if((null==u?void 0:u.status)===r.WE.Ok&&(null==u?void 0:u.data)){let e="data:image/png;base64,".concat(u.data.output);v(e)}else s.Am.error(null==u?void 0:null===(a=u.data)||void 0===a?void 0:a.error);return null==u?void 0:u.data}catch(e){return{error:(null==e?void 0:null===(i=e.response)||void 0===i?void 0:null===(o=i.data)||void 0===o?void 0:o.error)||(null==e?void 0:e.message)}}};return(0,a.jsxs)(u.Z,{title:"Remove Background - t\xe1ch nền ảnh nhanh ch\xf3ng bằng AI chỉ với 1 click | Photone.vn",description:"Remove background l\xe0 c\xf4ng cụ gi\xfap bạn t\xe1ch chủ thể khỏi nền của bức ảnh nhanh ch\xf3ng chỉ với 1 click. T\xe1ch nền ảnh bằng AI gi\xfap bạn tiết kiệm thời gian v\xe0 c\xf4ng sức. Thử ngay!",children:[(0,a.jsx)(d.w,{user:t}),(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsx)(s.Ix,{position:"top-right",autoClose:5e3,hideProgressBar:!1,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"}),(0,a.jsx)(s.Ix,{}),(0,a.jsxs)("h1",{className:"md:text-5xl text-2xl text-white relative inset-0 z-50 text-center uppercase font-bold mt-4",children:["\uD83D\uDC68‍\uD83D\uDCBB ",(0,a.jsx)("span",{className:"animate-shine",children:"REMOVE BACKGROUND"})]}),(0,a.jsxs)("div",{className:"w-full p-4 bg-gray-400/50 rounded-2xl my-8 flex content-center items-center justify-center",children:[(0,a.jsx)("div",{className:"absolute inset-0 filter blur-3xl",children:(0,a.jsx)("img",{src:n,alt:"Blurred Background",className:"w-full h-full object-cover z-30"})}),(0,a.jsx)("div",{className:"w-full md:w-1/2 border-2 border-zinc-100/50 p-1",children:(0,a.jsxs)("div",{className:"relative z-40",children:[T?(0,a.jsx)(m.c,{color:"default",labelColor:"foreground",className:"absolute top-2 right-2 z-50 cursor-pointer opacity-80"}):(0,a.jsx)("a",{href:y,download:"photone_vn_removed_background.png",target:"_blank",rel:"noopener noreferrer",children:(0,a.jsx)(g.SHT,{size:30,className:"absolute top-2 right-2 z-50 cursor-pointer opacity-80"})}),null!==y?(0,a.jsx)(l(),{src:y,alt:"Original Image",width:800,height:600,className:""}):(0,a.jsx)(l(),{src:n,alt:"Original Image",width:800,height:600,className:""})]})})]}),(0,a.jsx)("div",{className:"w-full flex justify-center",children:(0,a.jsx)("div",{className:"w-full",children:(0,a.jsx)("div",{className:"pt-0 sm:pt-0",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{htmlFor:"af-submit-app-upload-images",className:"inline-block text-sm font-medium text-gray-800 mt-2.5 dark:text-gray-200",children:"Tải l\xean h\xecnh để xử l\xfd"}),(0,a.jsx)(f.Z,{handleAiPhoto:E,setImageSrc:i,setLoading:b,toast:s.Am,paramrs:[]})]})})})}),(0,a.jsx)("div",{className:"flex w-full gap-4 justify-center mt-8",children:(0,a.jsx)(o.C,{keys:["command","shift"],children:"N"})})]})]})}},37840:function(e,t,n){"use strict";var a=n(5121),o=n(31341),s=n(83454);s.env.UTIL_API_BASE_URL;let r=s.env.AI21_LAB_API_KEY||"nknvd3wiDKkYgTBgI1CNDDKdahS3B6EO",i=s.env.GOOGLE_GEMINI_API_KEY||"AIzaSyByQTvwO24v9_-b3JJQakFjOJPUckz0BPU";t.Z={beautyPhoto:async e=>await a.default.post("/api/ai/beauty-ai",e),removeBackground:async e=>await a.default.post("/api/ai/remove-background",e),faceAdapterPhoto:async e=>await a.default.post("/api/ai/face-ai",e),generateAIPhoto:async e=>await a.default.post("/api/ai/sdxl",e),generateAIPhotoFree:async e=>await a.default.post("/api/ai/sdxl-free",e),async handleAIChat(e){let t=n(97218);return await t.post("https://api.ai21.com/studio/v1/j2-ultra/chat",{messages:e,system:"",numResults:1,epoch:0,maxTokens:1024,temperature:.7,topP:1,presencePenalty:{scale:1,applyToNumbers:!0,applyToPunctuations:!0,applyToStopwords:!0,applyToWhitespaces:!0,applyToEmojis:!0},countPenalty:{scale:1,applyToNumbers:!0,applyToPunctuations:!0,applyToStopwords:!0,applyToWhitespaces:!0,applyToEmojis:!0},frequencyPenalty:{scale:1,applyToNumbers:!0,applyToPunctuations:!0,applyToStopwords:!0,applyToWhitespaces:!0,applyToEmojis:!0},stopSequences:[]},{headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"}}).then(e=>e).catch(e=>e)},async googleGeminiChat(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,a=new o.$D(i),s=a.getGenerativeModel({model:"gemini-pro"}),r=s.startChat({history:t,generationConfig:{maxOutputTokens:n}});return await r.sendMessageStream(e)}}},84059:function(e,t,n){"use strict";n.d(t,{B0:function(){return p},Lh:function(){return d},OQ:function(){return r},ey:function(){return m},o0:function(){return l},r1:function(){return i},yD:function(){return c}});var a=n(59304),o=n(80096),s=n(5121);n(60490);let r=(0,a.eI)("https://gcnybuvwaftpozfgwlhs.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImdjbnlidXZ3YWZ0cG96Zmd3bGhzIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcwMzkxODYxOSwiZXhwIjoyMDE5NDk0NjE5fQ.LYmSr5SBHH5SSM5edAuohIszz7vN5npldvZQKcLM_Zo"),i=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?o.ce[Math.floor(Math.random()*o.ce.length)]:o.ce[0]},l=e=>{let t=new Date(e);return"".concat(t.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})," (").concat(t.toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"numeric"}),")")},c=e=>{let t=new Date(e);return"".concat(t.toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"numeric"}))},u=e=>Math.floor(Math.random()*(e+1)),d=(e,t)=>{let n=[],a=e.length;if(t>a)throw Error("Count cannot be greater than array length");for(;n.length<t;){let t=u(a-1),o=e[t];n.includes(o)||n.push(o)}return n},p=async e=>{let t=new FormData;return t.append("image",e),await s.default.post("https://api.imgbb.com/1/upload?expiration=600&key=".concat("ea5fd1b4ef57db65d797e1058ed7457e"),t)};function m(e,t){let n=[];for(;n.length<t;){let t=Math.floor(Math.random()*(null==e?void 0:e.length));n.includes(t)||n.push(t)}return n.map(t=>e[t])}},30928:function(){},91444:function(e,t,n){"use strict";n.d(t,{Ix:function(){return x},Am:function(){return L}});var a=n(67294),o=function(){for(var e,t,n=0,a="";n<arguments.length;)(e=arguments[n++])&&(t=function e(t){var n,a,o="";if("string"==typeof t||"number"==typeof t)o+=t;else if("object"==typeof t){if(Array.isArray(t))for(n=0;n<t.length;n++)t[n]&&(a=e(t[n]))&&(o&&(o+=" "),o+=a);else for(n in t)t[n]&&(o&&(o+=" "),o+=n)}return o}(e))&&(a&&(a+=" "),a+=t);return a};let s=e=>"number"==typeof e&&!isNaN(e),r=e=>"string"==typeof e,i=e=>"function"==typeof e,l=e=>r(e)||i(e)?e:null,c=e=>(0,a.isValidElement)(e)||r(e)||i(e)||s(e);function u(e){let{enter:t,exit:n,appendPosition:o=!1,collapse:s=!0,collapseDuration:r=300}=e;return function(e){let{children:i,position:l,preventExitTransition:c,done:u,nodeRef:d,isIn:p}=e,m=o?`${t}--${l}`:t,f=o?`${n}--${l}`:n,h=(0,a.useRef)(0);return(0,a.useLayoutEffect)(()=>{let e=d.current,t=m.split(" "),n=a=>{a.target===d.current&&(e.dispatchEvent(new Event("d")),e.removeEventListener("animationend",n),e.removeEventListener("animationcancel",n),0===h.current&&"animationcancel"!==a.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",n),e.addEventListener("animationcancel",n)},[]),(0,a.useEffect)(()=>{let e=d.current,t=()=>{e.removeEventListener("animationend",t),s?function(e,t,n){void 0===n&&(n=300);let{scrollHeight:a,style:o}=e;requestAnimationFrame(()=>{o.minHeight="initial",o.height=a+"px",o.transition=`all ${n}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,n)})})}(e,u,r):u()};p||(c?t():(h.current=1,e.className+=` ${f}`,e.addEventListener("animationend",t)))},[p]),a.createElement(a.Fragment,null,i)}}function d(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}let p={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){let n=this.list.get(e).filter(e=>e!==t);return this.list.set(e,n),this}return this.list.delete(e),this},cancelEmit(e){let t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach(t=>{let n=setTimeout(()=>{t(...[].slice.call(arguments,1))},0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(n)})}},m=e=>{let{theme:t,type:n,...o}=e;return a.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===t?"currentColor":`var(--toastify-icon-color-${n})`,...o})},f={info:function(e){return a.createElement(m,{...e},a.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return a.createElement(m,{...e},a.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return a.createElement(m,{...e},a.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return a.createElement(m,{...e},a.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return a.createElement("div",{className:"Toastify__spinner"})}};function h(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function g(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function y(e){let{closeToast:t,theme:n,ariaLabel:o="close"}=e;return a.createElement("button",{className:`Toastify__close-button Toastify__close-button--${n}`,type:"button",onClick:e=>{e.stopPropagation(),t(e)},"aria-label":o},a.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},a.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function v(e){let{delay:t,isRunning:n,closeToast:s,type:r="default",hide:l,className:c,style:u,controlledProgress:d,progress:p,rtl:m,isIn:f,theme:h}=e,g=l||d&&0===p,y={...u,animationDuration:`${t}ms`,animationPlayState:n?"running":"paused",opacity:g?0:1};d&&(y.transform=`scaleX(${p})`);let v=o("Toastify__progress-bar",d?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${h}`,`Toastify__progress-bar--${r}`,{"Toastify__progress-bar--rtl":m}),T=i(c)?c({rtl:m,type:r,defaultClassName:v}):o(v,c);return a.createElement("div",{role:"progressbar","aria-hidden":g?"true":"false","aria-label":"notification timer",className:T,style:y,[d&&p>=1?"onTransitionEnd":"onAnimationEnd"]:d&&p<1?null:()=>{f&&s()}})}let T=e=>{let{isRunning:t,preventExitTransition:n,toastRef:s,eventHandlers:r}=function(e){let[t,n]=(0,a.useState)(!1),[o,s]=(0,a.useState)(!1),r=(0,a.useRef)(null),l=(0,a.useRef)({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,c=(0,a.useRef)(e),{autoClose:u,pauseOnHover:d,closeToast:p,onClick:m,closeOnClick:f}=e;function y(t){if(e.draggable){"touchstart"===t.nativeEvent.type&&t.nativeEvent.preventDefault(),l.didMove=!1,document.addEventListener("mousemove",E),document.addEventListener("mouseup",x),document.addEventListener("touchmove",E),document.addEventListener("touchend",x);let n=r.current;l.canCloseOnClick=!0,l.canDrag=!0,l.boundingRect=n.getBoundingClientRect(),n.style.transition="",l.x=h(t.nativeEvent),l.y=g(t.nativeEvent),"x"===e.draggableDirection?(l.start=l.x,l.removalDistance=n.offsetWidth*(e.draggablePercent/100)):(l.start=l.y,l.removalDistance=n.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent/100))}}function v(t){if(l.boundingRect){let{top:n,bottom:a,left:o,right:s}=l.boundingRect;"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&l.x>=o&&l.x<=s&&l.y>=n&&l.y<=a?b():T()}}function T(){n(!0)}function b(){n(!1)}function E(n){let a=r.current;l.canDrag&&a&&(l.didMove=!0,t&&b(),l.x=h(n),l.y=g(n),l.delta="x"===e.draggableDirection?l.x-l.start:l.y-l.start,l.start!==l.x&&(l.canCloseOnClick=!1),a.style.transform=`translate${e.draggableDirection}(${l.delta}px)`,a.style.opacity=""+(1-Math.abs(l.delta/l.removalDistance)))}function x(){document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",x),document.removeEventListener("touchmove",E),document.removeEventListener("touchend",x);let t=r.current;if(l.canDrag&&l.didMove&&t){if(l.canDrag=!1,Math.abs(l.delta)>l.removalDistance)return s(!0),void e.closeToast();t.style.transition="transform 0.2s, opacity 0.2s",t.style.transform=`translate${e.draggableDirection}(0)`,t.style.opacity="1"}}(0,a.useEffect)(()=>{c.current=e}),(0,a.useEffect)(()=>(r.current&&r.current.addEventListener("d",T,{once:!0}),i(e.onOpen)&&e.onOpen((0,a.isValidElement)(e.children)&&e.children.props),()=>{let e=c.current;i(e.onClose)&&e.onClose((0,a.isValidElement)(e.children)&&e.children.props)}),[]),(0,a.useEffect)(()=>(e.pauseOnFocusLoss&&(document.hasFocus()||b(),window.addEventListener("focus",T),window.addEventListener("blur",b)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",T),window.removeEventListener("blur",b))}),[e.pauseOnFocusLoss]);let I={onMouseDown:y,onTouchStart:y,onMouseUp:v,onTouchEnd:v};return u&&d&&(I.onMouseEnter=b,I.onMouseLeave=T),f&&(I.onClick=e=>{m&&m(e),l.canCloseOnClick&&p()}),{playToast:T,pauseToast:b,isRunning:t,preventExitTransition:o,toastRef:r,eventHandlers:I}}(e),{closeButton:l,children:c,autoClose:u,onClick:d,type:p,hideProgressBar:m,closeToast:f,transition:T,position:b,className:E,style:x,bodyClassName:I,bodyStyle:N,progressClassName:w,progressStyle:_,updateId:C,role:O,progress:k,rtl:L,toastId:j,deleteToast:R,isIn:M,isLoading:P,iconOut:B,closeOnClick:S,theme:A}=e,D=o("Toastify__toast",`Toastify__toast-theme--${A}`,`Toastify__toast--${p}`,{"Toastify__toast--rtl":L},{"Toastify__toast--close-on-click":S}),z=i(E)?E({rtl:L,position:b,type:p,defaultClassName:D}):o(D,E),$=!!k||!u,F={closeToast:f,type:p,theme:A},Z=null;return!1===l||(Z=i(l)?l(F):(0,a.isValidElement)(l)?(0,a.cloneElement)(l,F):y(F)),a.createElement(T,{isIn:M,done:R,position:b,preventExitTransition:n,nodeRef:s},a.createElement("div",{id:j,onClick:d,className:z,...r,style:x,ref:s},a.createElement("div",{...M&&{role:O},className:i(I)?I({type:p}):o("Toastify__toast-body",I),style:N},null!=B&&a.createElement("div",{className:o("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!P})},B),a.createElement("div",null,c)),Z,a.createElement(v,{...C&&!$?{key:`pb-${C}`}:{},rtl:L,theme:A,delay:u,isRunning:t,isIn:M,closeToast:f,hide:m,type:p,style:_,className:w,controlledProgress:$,progress:k||0})))},b=function(e,t){return void 0===t&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},E=u(b("bounce",!0)),x=(u(b("slide",!0)),u(b("zoom")),u(b("flip")),(0,a.forwardRef)((e,t)=>{let{getToastToRender:n,containerRef:u,isToastActive:m}=function(e){let[,t]=(0,a.useReducer)(e=>e+1,0),[n,o]=(0,a.useState)([]),u=(0,a.useRef)(null),m=(0,a.useRef)(new Map).current,h=e=>-1!==n.indexOf(e),g=(0,a.useRef)({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:h,getToast:e=>m.get(e)}).current;function y(e){let{containerId:t}=e,{limit:n}=g.props;!n||t&&g.containerId!==t||(g.count-=g.queue.length,g.queue=[])}function v(e){o(t=>null==e?[]:t.filter(t=>t!==e))}function T(){let{toastContent:e,toastProps:t,staleId:n}=g.queue.shift();E(e,t,n)}function b(e,n){var o,h;let{delay:y,staleId:b,...x}=n;if(!c(e)||!u.current||g.props.enableMultiContainer&&x.containerId!==g.props.containerId||m.has(x.toastId)&&null==x.updateId)return;let{toastId:I,updateId:N,data:w}=x,{props:_}=g,C=()=>v(I),O=null==N;O&&g.count++;let k={..._,style:_.toastStyle,key:g.toastKey++,...Object.fromEntries(Object.entries(x).filter(e=>{let[t,n]=e;return null!=n})),toastId:I,updateId:N,data:w,closeToast:C,isIn:!1,className:l(x.className||_.toastClassName),bodyClassName:l(x.bodyClassName||_.bodyClassName),progressClassName:l(x.progressClassName||_.progressClassName),autoClose:!x.isLoading&&(o=x.autoClose,h=_.autoClose,!1===o||s(o)&&o>0?o:h),deleteToast(){let e=d(m.get(I),"removed");m.delete(I),p.emit(4,e);let n=g.queue.length;if(g.count=null==I?g.count-g.displayedToast:g.count-1,g.count<0&&(g.count=0),n>0){let e=null==I?g.props.limit:1;if(1===n||1===e)g.displayedToast++,T();else{let t=e>n?n:e;g.displayedToast=t;for(let e=0;e<t;e++)T()}}else t()}};k.iconOut=function(e){let{theme:t,type:n,isLoading:o,icon:l}=e,c=null,u={theme:t,type:n};return!1===l||(i(l)?c=l(u):(0,a.isValidElement)(l)?c=(0,a.cloneElement)(l,u):r(l)||s(l)?c=l:o?c=f.spinner():n in f&&(c=f[n](u))),c}(k),i(x.onOpen)&&(k.onOpen=x.onOpen),i(x.onClose)&&(k.onClose=x.onClose),k.closeButton=_.closeButton,!1===x.closeButton||c(x.closeButton)?k.closeButton=x.closeButton:!0===x.closeButton&&(k.closeButton=!c(_.closeButton)||_.closeButton);let L=e;(0,a.isValidElement)(e)&&!r(e.type)?L=(0,a.cloneElement)(e,{closeToast:C,toastProps:k,data:w}):i(e)&&(L=e({closeToast:C,toastProps:k,data:w})),_.limit&&_.limit>0&&g.count>_.limit&&O?g.queue.push({toastContent:L,toastProps:k,staleId:b}):s(y)?setTimeout(()=>{E(L,k,b)},y):E(L,k,b)}function E(e,t,n){let{toastId:a}=t;n&&m.delete(n);let s={content:e,props:t};m.set(a,s),o(e=>[...e,a].filter(e=>e!==n)),p.emit(4,d(s,null==s.props.updateId?"added":"updated"))}return(0,a.useEffect)(()=>(g.containerId=e.containerId,p.cancelEmit(3).on(0,b).on(1,e=>u.current&&v(e)).on(5,y).emit(2,g),()=>{m.clear(),p.emit(3,g)}),[]),(0,a.useEffect)(()=>{g.props=e,g.isToastActive=h,g.displayedToast=n.length}),{getToastToRender:function(t){let n=new Map,a=Array.from(m.values());return e.newestOnTop&&a.reverse(),a.forEach(e=>{let{position:t}=e.props;n.has(t)||n.set(t,[]),n.get(t).push(e)}),Array.from(n,e=>t(e[0],e[1]))},containerRef:u,isToastActive:h}}(e),{className:h,style:g,rtl:y,containerId:v}=e;return(0,a.useEffect)(()=>{t&&(t.current=u.current)},[]),a.createElement("div",{ref:u,className:"Toastify",id:v},n((e,t)=>{let n=t.length?{...g}:{...g,pointerEvents:"none"};return a.createElement("div",{className:function(e){let t=o("Toastify__toast-container",`Toastify__toast-container--${e}`,{"Toastify__toast-container--rtl":y});return i(h)?h({position:e,rtl:y,defaultClassName:t}):o(t,l(h))}(e),style:n,key:`container-${e}`},t.map((e,n)=>{let{content:o,props:s}=e;return a.createElement(T,{...s,isIn:m(s.toastId),style:{...s.style,"--nth":n+1,"--len":t.length},key:`toast-${s.key}`},o)}))}))}));x.displayName="ToastContainer",x.defaultProps={position:"top-right",transition:E,autoClose:5e3,closeButton:y,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let I,N=new Map,w=[],_=1;function C(e,t){return N.size>0?p.emit(0,e,t):w.push({content:e,options:t}),t.toastId}function O(e,t){return{...t,type:t&&t.type||e,toastId:t&&(r(t.toastId)||s(t.toastId))?t.toastId:""+_++}}function k(e){return(t,n)=>C(t,O(e,n))}function L(e,t){return C(e,O("default",t))}L.loading=(e,t)=>C(e,O("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),L.promise=function(e,t,n){let a,{pending:o,error:s,success:l}=t;o&&(a=r(o)?L.loading(o,n):L.loading(o.render,{...n,...o}));let c={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},u=(e,t,o)=>{if(null==t)return void L.dismiss(a);let s={type:e,...c,...n,data:o},i=r(t)?{render:t}:t;return a?L.update(a,{...s,...i}):L(i.render,{...s,...i}),o},d=i(e)?e():e;return d.then(e=>u("success",l,e)).catch(e=>u("error",s,e)),d},L.success=k("success"),L.info=k("info"),L.error=k("error"),L.warning=k("warning"),L.warn=L.warning,L.dark=(e,t)=>C(e,O("default",{theme:"dark",...t})),L.dismiss=e=>{N.size>0?p.emit(1,e):w=w.filter(t=>null!=e&&t.options.toastId!==e)},L.clearWaitingQueue=function(e){return void 0===e&&(e={}),p.emit(5,e)},L.isActive=e=>{let t=!1;return N.forEach(n=>{n.isToastActive&&n.isToastActive(e)&&(t=!0)}),t},L.update=function(e,t){void 0===t&&(t={}),setTimeout(()=>{let n=function(e,t){let{containerId:n}=t,a=N.get(n||I);return a&&a.getToast(e)}(e,t);if(n){let{props:a,content:o}=n,s={delay:100,...a,...t,toastId:t.toastId||e,updateId:""+_++};s.toastId!==e&&(s.staleId=e);let r=s.render||o;delete s.render,C(r,s)}},0)},L.done=e=>{L.update(e,{progress:1})},L.onChange=e=>(p.on(4,e),()=>{p.off(4,e)}),L.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},L.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},p.on(2,e=>{I=e.containerId||e,N.set(I,e),w.forEach(e=>{p.emit(0,e.content,e.options)}),w=[]}).on(3,e=>{N.delete(e.containerId||e),0===N.size&&p.off(0).off(1).off(5)})}},function(e){e.O(0,[7237,2488,6063,8962,445,1664,2248,9304,490,7367,2114,5675,3143,96,9774,2888,179],function(){return e(e.s=14293)}),_N_E=e.O()}]);