import{j as c,ao as ae,a0 as Ee,k as ie,Y as J,b as Se,g as Ce,ac as Ae}from"./main-5057ff34.js";import{r as S,R as N,e as Pe}from"./chunk-react-162a731f.js";import{c as Oe}from"./chunk-index-89b7ba38.js";import{D as se}from"./chunk-index-4d24fc93.js";import{m as H,G as E,e as w,i as ce,ao as we,s as le,f as ue,I as je,aB as Re,aC as ke,B as de,L as Fe,a8 as _e,aD as T}from"./chunk-material-ui-eb5bb5f8.js";import{S as Me}from"./chunk-index-b4f9c953.js";import{b as Ne}from"./chunk-index-3462efa3.js";import{D as Ie}from"./chunk-index-a1788cfb.js";import{U as He}from"./chunk-index-72204a8f.js";import{i as De}from"./chunk-generateUtilityClasses-54aa0b46.js";import{r as Be}from"./chunk-createSvgIcon-76c2431e.js";import{g as pe}from"./chunk-lodash-6114c6d4.js";const ze=H(t=>({sizeBlock:{marginBlockEnd:9,"@media (max-width: 280px)":{maxWidth:"100%",flexBasis:"100%"}},baseText:{fontFamily:"TTFirsNeue-Light, sans-serif","& > $baseText":{paddingLeft:t.spacing(2),whiteSpace:"nowrap"}},chooseSizeBlock:{cursor:"pointer",marginBlockEnd:9,"& p":{color:"#1e6ee4"}}}),{name:"CurrentSize"});function Le({sizeTitle:t,isShowPickSizeButton:e,pickSizeButtonTitle:n,gridSizeContent:r}){const o=ze(),[a,l]=S.useState(!1),i=()=>l(!1),s=()=>l(!0);return c.jsxs(c.Fragment,{children:[c.jsx(E,{item:!0,xs:4,classes:{root:o.sizeBlock},children:c.jsxs(w,{classes:{root:o.baseText},component:"p",variant:"body1",color:"secondary",children:["Размер:",c.jsx(w,{classes:{root:o.baseText},component:"span",variant:"body1",color:"primary",children:t})]})}),e&&c.jsxs(c.Fragment,{children:[c.jsx(E,{item:!0,xs:"auto",sm:5,md:"auto",onClick:s,className:o.chooseSizeBlock,children:c.jsx(w,{classes:{root:o.baseText},variant:"body1",children:n||"Подобрать размер"})}),c.jsx(se,{open:a,onClose:i,onCloseIcon:i,dialogTitle:n||"Подобрать размер",scroll:"paper",maxWidth:!1,children:c.jsx(E,{container:!0,children:c.jsx(E,{item:!0,xs:12,children:r})})})]})]})}const Ue=H(t=>({baseText:{fontFamily:"TTFirsNeue-Light, sans-serif","& > $baseText":{paddingLeft:t.spacing(2)}}}),{name:"CurrentSize"}),We=({colorName:t})=>{const e=Ue();return t?c.jsx(E,{item:!0,xs:12,children:c.jsxs(w,{classes:{root:e.baseText},component:"p",variant:"body1",color:"secondary",children:["Цвет:",c.jsx(w,{classes:{root:e.baseText},component:"span",variant:"body1",color:"primary",children:t})]})}):null},$e=H(t=>({sizesChip:{width:78,height:40,borderRadius:10,margin:0,fontSize:"1rem","&:after":{content:'""',position:"absolute",top:0,left:0,width:"200%",height:"180%",background:`linear-gradient(to top right, transparent calc(49% - 1px), #E0E3E6 calc(49.5% - 1px), #E0E3E6 calc(48.5% + 1px), transparent calc(48% + 1px))`},"& span":{paddingInline:7}},CardPreviewSizeBtn:{minWidth:71,minHeight:32,color:t.color.black100,borderRadius:10,backgroundColor:"#FFFFFF","@media (min-width: 1656px)":{minWidth:87,minHeight:35}},sizesChipOutline:{borderColor:t.color.black40,overflow:"hidden","&:after":{content:'""',position:"absolute",top:0,left:0,width:"200%",height:"180%",background:`linear-gradient(to top right, transparent calc(48.5% - 1px), #E0E3E6 calc(49% - 1px), #E0E3E6 calc(48% + 1px), transparent calc(46% + 1px))`},"&:hover":{"background-color":"#FFFFFF !important"}},noQuantity:{color:t.color.black40,borderColor:t.color.black40},popover:{pointerEvents:"none"},paper:{maxWidth:230,padding:"8px 12px",borderRadius:4},popoverText:{fontSize:t.typography.pxToRem(14)},dialogRoot:{minWidth:300,maxWidth:400,padding:24,"& .MuiDialogContent-dividers":{overflow:"initial",border:"none"},"& .MuiDialogTitle-root":{padding:0,"margin-block-end":24,"& h2":{fontSize:"20px",lineHeight:"30px"}}}}),{name:"NoQuantitySize"}),Xt=t=>{const e=$e(),[n,r]=S.useState(null),[o,a]=S.useState(!1),[l,i]=S.useState(!1),[s,u]=S.useState(""),d=P=>{r(P.currentTarget)},p=()=>{r(null)},m=P=>{a(!0)},h=!!n,g=()=>a(!1),[b,{isLoading:x}]=ae(),y=()=>{b({email:s,product_id:t.product_id}).unwrap().then(({})=>{i(P=>!0)})},A=P=>{u(P.target.value)};return c.jsxs(c.Fragment,{children:[c.jsx(ce,{"aria-owns":h?"mouse-over-popover":void 0,"aria-haspopup":"true",clickable:!0,onMouseEnter:d,onMouseLeave:p,variant:"outlined",classes:{root:t.productPreview?e.CardPreviewSizeBtn:e.sizesChip,outlinedPrimary:Oe([e.sizesChipOutline,e.noQuantity])},onClick:m,color:"primary",label:t.sizeTitle}),c.jsx(we,{open:h,className:e.popover,style:{top:10},classes:{paper:e.paper},anchorEl:n,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},elevation:0,onClose:p,disableRestoreFocus:!0,children:c.jsx(w,{variant:"body1",classes:{root:e.popoverText},children:"Кликните РЅР° размер для возможности подписаться РЅР° его поступления"})}),c.jsx(se,{open:o,PaperProps:{classes:{root:e.dialogRoot}},scroll:"paper",onClose:g,onCloseIcon:g,dialogTitle:l?"Товар добавлен РІ РїРѕРґРїРёСЃРєРё":"Подписаться РЅР° товар",children:c.jsxs(E,{container:!0,item:!0,spacing:3,children:[!l&&c.jsxs(c.Fragment,{children:[c.jsx(We,{colorName:t.colorName}),c.jsx(Le,{sizeTitle:t.sizeTitle}),c.jsx(E,{item:!0,xs:12,children:c.jsx(le,{required:!0,fullWidth:!0,placeholder:"email",type:"email",onChange:A,value:s})})]}),l&&c.jsx(E,{item:!0,xs:12,children:c.jsx(w,{children:"РњС‹ сообщим вам, РєРѕРіРґР° РѕРЅ поступит РЅР° склад"})}),c.jsx(E,{item:!0,xs:12,children:c.jsx(ue,{color:"default",variant:"contained",fullWidth:!0,onClick:l?g:y,children:l?"Готово":"Подписаться"})})]})})]})},qe=H(t=>({productRoot:{position:"relative",paddingBottom:t.spacing(5),"&:hover $favoriteIconStyle":{display:"block"}},productSmall:{width:280,"@media (max-width: 1440px)":{width:256},"@media (max-width: 1280px)":{width:256}},productMedium:{width:325,"@media (max-width: 1440px)":{width:256},"@media (max-width: 1280px)":{width:256}},productBig:{width:"100%","@media (max-width: 1440px)":{width:"100%"},"@media (max-width: 1280px)":{width:"100%"},"@media (max-width: 479px)":{width:"100%"}},productMain:{width:"100%","@media (max-width: 1440px)":{width:"100%"},"@media (max-width: 1280px)":{width:"100%"},"@media (max-width: 479px)":{width:"100%"}},containerLink:{height:"inherit"},badgeGrid:{display:"flex",flexDirection:"column",alignItems:"start",position:"absolute",left:"8px",top:"8px",zIndex:1,textTransform:"uppercase","& div":{height:24,fontSize:t.typography.pxToRem(14)},"& div + div":{marginBlockStart:15}},badgeStyle:{borderRadius:9,backgroundColor:t.color.black0,border:"1px solid currentcolor"},badgeSoon:{color:"#b1dff1"},badgeNew:{color:"#1e6ee4"},productImgGrid:{width:"100%",display:"flex",justifyContent:"center","@media (min-width: 540px)":{marginBlockEnd:15}},imgHover:{" :first-child":{display:"block"},"& :last-child":{display:"none"},"&:hover :first-child":{display:"none"},"&:hover :last-child":{display:"block"}},productImg:{objectFit:"contain"},productImgTechno:{width:"20%",position:"absolute",bottom:"-5%"},setNoQuantity:{flexDirection:"column","& svg":{margin:"0 !important"}},sizeContainer:{position:"absolute",left:0,bottom:0,padding:"0 10px",zIndex:1e3},sizeBtn:{minWidth:71,minHeight:32,color:t.color.black100,borderRadius:10,backgroundColor:"#FFFFFF","@media (min-width: 1656px)":{minWidth:87,minHeight:35}},sizeBtnClickable:{"&$sizeBtnOutlined":{"&:hover, &:focus":{backgroundColor:"#F0F3F6"}}},favoriteIconStyle:{display:"none",color:"#E0E3E6"},productPageFavoriteIconStyle:{color:t.color.black100},sizeBtnOutlined:{borderColor:t.color.black40},favoriteIcon:{margin:"16px 16px 0 0",right:0,position:"absolute",zIndex:2e3},btnAddToWish:{borderColor:t.color.black100,borderWidth:"1.25px",borderStyle:"solid",borderRadius:"1rem",width:"100%",padding:16,height:"100%"},paper:{maxWidth:230,padding:"8px 12px",borderRadius:4},popoverText:{fontSize:t.typography.pxToRem(14)},customPaperStyle:{width:"230px",padding:"8px 12px",borderRadius:"4px",position:"absolute",zIndex:1,backgroundColor:"#fff",border:"1px solid rgba(0, 16, 61, 0.16)",opacity:1,transform:"none",transition:"opacity 232ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 155ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",boxShadow:"0px 5px 5px -3px rgb(0 0 0 / 20%), 0px 8px 10px 1px rgb(0 0 0 / 14%), 0px 3px 14px 2px rgb(0 0 0 / 12%)"},productPopUpPosition:{transform:"translateX(-50%)",left:"50%"},catalogPopUpPosition:{top:"32px",left:"50%",transform:"translateX(-50%)"}}),{name:"CardPreview"}),Ye=({wishListItem:t,open:e,handleClose:n})=>c.jsx(Me,{open:e,onClose:n,title:"Товар добавлен РІ избранное",children:c.jsx(c.Fragment,{children:!Array.isArray(t==null?void 0:t.data)&&c.jsx(Ne,{sku:t==null?void 0:t.data.SKU_ID,itemName:t==null?void 0:t.data.NAME,link:t==null?void 0:t.data.URL,imgPath:t==null?void 0:t.data.IMAGE.PATH,color:t==null?void 0:t.data.COLOR,size:t==null?void 0:t.data.SIZE,currentPrice:t==null?void 0:t.data.PRICES.RETAIL.PRICE_DISPLAY})})}),Ge=({event:t,inWishlist:e,handleDeleteWishlist:n,handleClick:r,colorRef:o,setClickOnWishListIcon:a,setOpenUserAuth:l,setOpenPopUp:i})=>e?n():(r(o),t.preventDefault(),a&&a(!0),l(!0),i(!0)),Qe=t=>{var e;(e=t==null?void 0:t.current)==null||e.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})},Vt=({setClickOnWishListIcon:t,inWishlist:e,productSku:n,isUserAuth:r,addWishList:o,wishListItem:a,colorRef:l,parentRef:i,type:s})=>{const[u]=Ee(),d=()=>{u({url:Se.user.wishlist.delete,...Ce({SITE_ID:"lid",bitrix_sessid:"bitrix_sessid"}),id:n})},[p,m]=S.useState(!1),[h,g]=N.useState(!1),[b,x]=S.useState(!1),y=qe(),A=s==="productPage",P=A?y.productPageFavoriteIconStyle:y.favoriteIconStyle,F=A?y.btnAddToWish:y.favoriteIcon,U=A?y.productPopUpPosition:y.catalogPopUpPosition,D=ie(R=>R.userAuth.authScreen),ye=!e&&r&&h,be=a==null?void 0:a.data;S.useEffect(()=>{const R=q=>{var Z;i!=null&&i.current&&!((Z=i==null?void 0:i.current)!=null&&Z.contains(q.target))&&(g(!1),t&&t(!1))};return document.addEventListener("mousedown",R),()=>{document.removeEventListener("mousedown",R)}},[i]),S.useEffect(()=>{o&&(m(o),g(!1))},[o]);const xe=(R,q)=>{q!=="clickaway"&&m(!1)};return c.jsxs(c.Fragment,{children:[c.jsx(je,{onClick:R=>{Ge({event:R,inWishlist:e,handleDeleteWishlist:d,handleClick:Qe,colorRef:l,setClickOnWishListIcon:t,setOpenUserAuth:x,setOpenPopUp:g})},classes:{root:F},type:"button",color:"secondary",children:e&&c.jsx(Re,{color:"primary"})||c.jsx(ke,{className:P})}),ye&&c.jsx(de,{className:`${y.customPaperStyle} ${U}`,children:c.jsx(w,{variant:"body1",classes:{root:y.popoverText},children:"Чтобы добавить товар РІ избранное кликните РЅР° цвет, затем РЅР° размер."})}),be&&c.jsx(Ye,{wishListItem:a,open:p,handleClose:xe}),!r&&c.jsx(Ie,{isWrapped:!0,showCloseIcon:!0,open:b,onClose:()=>x(!1),handlerCloseIcon:()=>x(!1),closeIconPosition:"right",anchor:"right",title:J[D].title,subTitle:J[D].subTitle,children:c.jsx(He,{})})]})};var V={},Xe=De;Object.defineProperty(V,"__esModule",{value:!0});var fe=V.default=void 0,Ve=Xe(Be()),K=c;fe=V.default=(0,Ve.default)([(0,K.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),(0,K.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime");const Ze=H(()=>({mainBlock:{width:"100%"},soonGrid:{width:"48%"},boxStyle:{display:"flex",flexWrap:"wrap",justifyContent:"center",alignItems:"center",fontSize:"1rem",fontFamily:"TTFirsNeue-Regular,sans-serif",fontWeight:300,lineHeight:"24px",textTransform:"none",padding:9,"& .MuiLink-root:hover":{color:"#3A474E",borderBottom:"1px #3A474E dashed"},"& .MuiLink-underlineAlways":{color:"#1e6ee4",borderBottom:"1px #1e6ee4 dashed",textDecoration:"none"}},soonLogo:{marginInlineEnd:7,color:"#1e6ee4"},soonText:{fontFamily:"CirceWebBold,sans-serif",fontSize:"1.1rem",marginBlockStart:1,color:"#1e6ee4",fontWeight:550},subscribedText:{marginBlockEnd:15},dialogRoot:{minWidth:300,maxWidth:400,padding:24,"& .MuiDialogContent-dividers":{overflow:"initial",border:"none"},"& .MuiDialogTitle-root":{padding:0,"margin-block-end":24,"& h2":{fontSize:"20px",lineHeight:"30px"}}}}),{name:"ComingSoon"}),Zt=({productId:t,selectedColor:e,isComingSoon:n,setIsComingSoon:r})=>{var F,U,D;const o=Ze(),[a,l]=S.useState(!1),[i,s]=S.useState(!1),[u,d]=S.useState(""),[p]=ae(),m=ie(_=>_.userAuth.isAuth),h=e?"РЎРљРћР Рћ":"Нет РІ наличии",{data:g}=Ae(),b=(D=(U=(F=g==null?void 0:g.data)==null?void 0:F.MAIN)==null?void 0:U.PROFILE)==null?void 0:D.EMAIL,x=()=>l(!0),y=()=>{l(!1),n&&r(!1)},A=()=>{p({email:u,product_id:t}).unwrap().then(_=>{if(_.status==="error")return s(!1);s(!0)})},P=_=>{d(_.target.value)};return S.useEffect(()=>{n&&l(!0)},[]),S.useEffect(()=>d(m?b:""),[m,b]),c.jsxs(E,{item:!0,container:!0,spacing:3,classes:{root:o.mainBlock},children:[!n&&c.jsxs(c.Fragment,{children:[c.jsxs(E,{item:!0,container:!0,direction:"row",classes:{root:o.soonGrid},children:[e&&c.jsx(fe,{className:o.soonLogo}),c.jsx(w,{className:o.soonText,children:h})]}),c.jsx(de,{className:o.boxStyle,onClick:x,children:c.jsx(Fe,{href:"#",underline:"always",children:"Хочу узнать Рѕ поступлении"})})]}),c.jsx(_e,{open:a,PaperProps:{classes:{root:o.dialogRoot}},scroll:"paper",onClose:y,dialogTitle:i?"Товар добавлен РІ РїРѕРґРїРёСЃРєРё":"Подписаться РЅР° товар",children:c.jsxs(E,{container:!0,item:!0,spacing:3,children:[!i&&c.jsx(c.Fragment,{children:c.jsxs(E,{item:!0,xs:12,children:[c.jsx(w,{className:o.subscribedText,children:"Ртот товар СЃРєРѕСЂРѕ поступит РІ продажу. Хотите узнать РѕР± этом первыми? Пожалуйста, оставьте СЃРІРѕР№ e-mail для оповещения."}),c.jsx(le,{required:!0,fullWidth:!0,placeholder:"email",type:"email",onChange:P,value:u})]})}),i&&c.jsx(E,{item:!0,container:!0,justifyContent:"center",xs:12,children:c.jsx(w,{children:"РњС‹ сообщим вам, РєРѕРіРґР° РѕРЅ поступит РЅР° склад"})}),c.jsx(E,{item:!0,xs:12,children:c.jsx(ue,{color:"default",variant:"contained",fullWidth:!0,onClick:i?()=>y():A,children:i?"Готово":"Подписаться"})})]})})]})};function Je(t){if(t&&t.indexOf("/")>-1){const[e,n]=t.split("/");return`linear-gradient(90deg, ${e} 0%, ${n} 100%)`}return t}const Ke=H(t=>({chipStyle:{fontFamily:"TTFirsNeue-Light, sans-serif",fontSize:16}}),{name:"Badge"}),Jt=t=>{const e=Ke(),{badge_text:n,badge_text_color:r,badge_background_color:o}=t,a={color:r,background:Je(o)};return c.jsx(ce,{classes:{root:e.chipStyle},style:a,label:n})};function et(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var me=S,tt=et(me);function ee(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rt(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var nt=!!(typeof window<"u"&&window.document&&window.document.createElement);function ot(t,e,n){if(typeof t!="function")throw new Error("Expected reducePropsToState to be a function.");if(typeof e!="function")throw new Error("Expected handleStateChangeOnClient to be a function.");if(typeof n<"u"&&typeof n!="function")throw new Error("Expected mapStateOnServer to either be undefined or a function.");function r(o){return o.displayName||o.name||"Component"}return function(a){if(typeof a!="function")throw new Error("Expected WrappedComponent to be a React component.");var l=[],i;function s(){i=t(l.map(function(d){return d.props})),u.canUseDOM?e(i):n&&(i=n(i))}var u=function(d){rt(p,d);function p(){return d.apply(this,arguments)||this}p.peek=function(){return i},p.rewind=function(){if(p.canUseDOM)throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");var g=i;return i=void 0,l=[],g};var m=p.prototype;return m.UNSAFE_componentWillMount=function(){l.push(this),s()},m.componentDidUpdate=function(){s()},m.componentWillUnmount=function(){var g=l.indexOf(this);l.splice(g,1),s()},m.render=function(){return tt.createElement(a,this.props)},p}(me.PureComponent);return ee(u,"displayName","SideEffect("+r(a)+")"),ee(u,"canUseDOM",nt),u}}var at=ot;const it=pe(at);var st=typeof Element<"u",ct=typeof Map=="function",lt=typeof Set=="function",ut=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function W(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,o;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!W(t[r],e[r]))return!1;return!0}var a;if(ct&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;for(a=t.entries();!(r=a.next()).done;)if(!W(r.value[1],e.get(r.value[0])))return!1;return!0}if(lt&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(ut&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf&&typeof t.valueOf=="function"&&typeof e.valueOf=="function")return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString&&typeof t.toString=="function"&&typeof e.toString=="function")return t.toString()===e.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,o[r]))return!1;if(st&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((o[r]==="_owner"||o[r]==="__v"||o[r]==="__o")&&t.$$typeof)&&!W(t[o[r]],e[o[r]]))return!1;return!0}return t!==t&&e!==e}var dt=function(e,n){try{return W(e,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const pt=pe(dt);var k={BODY:"bodyAttributes",HTML:"htmlAttributes",TITLE:"titleAttributes"},f={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title"};Object.keys(f).map(function(t){return f[t]});var v={CHARSET:"charset",CSS_TEXT:"cssText",HREF:"href",HTTPEQUIV:"http-equiv",INNER_HTML:"innerHTML",ITEM_PROP:"itemprop",NAME:"name",PROPERTY:"property",REL:"rel",SRC:"src",TARGET:"target"},$={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},L={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate"},ft=Object.keys($).reduce(function(t,e){return t[$[e]]=e,t},{}),mt=[f.NOSCRIPT,f.SCRIPT,f.STYLE],O="data-react-helmet",ht=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Tt=function(){function t(e,n){for(var r=0;r<n.length;r++){var o=n[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),C=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},vt=function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},te=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},yt=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:t},G=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return n===!1?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},bt=function(e){var n=I(e,f.TITLE),r=I(e,L.TITLE_TEMPLATE);if(r&&n)return r.replace(/%s/g,function(){return Array.isArray(n)?n.join(""):n});var o=I(e,L.DEFAULT_TITLE);return n||o||void 0},xt=function(e){return I(e,L.ON_CHANGE_CLIENT_STATE)||function(){}},Y=function(e,n){return n.filter(function(r){return typeof r[e]<"u"}).map(function(r){return r[e]}).reduce(function(r,o){return C({},r,o)},{})},Et=function(e,n){return n.filter(function(r){return typeof r[f.BASE]<"u"}).map(function(r){return r[f.BASE]}).reverse().reduce(function(r,o){if(!r.length)for(var a=Object.keys(o),l=0;l<a.length;l++){var i=a[l],s=i.toLowerCase();if(e.indexOf(s)!==-1&&o[s])return r.concat(o)}return r},[])},B=function(e,n,r){var o={};return r.filter(function(a){return Array.isArray(a[e])?!0:(typeof a[e]<"u"&&Pt("Helmet: "+e+' should be of type "Array". Instead found type "'+ht(a[e])+'"'),!1)}).map(function(a){return a[e]}).reverse().reduce(function(a,l){var i={};l.filter(function(m){for(var h=void 0,g=Object.keys(m),b=0;b<g.length;b++){var x=g[b],y=x.toLowerCase();n.indexOf(y)!==-1&&!(h===v.REL&&m[h].toLowerCase()==="canonical")&&!(y===v.REL&&m[y].toLowerCase()==="stylesheet")&&(h=y),n.indexOf(x)!==-1&&(x===v.INNER_HTML||x===v.CSS_TEXT||x===v.ITEM_PROP)&&(h=x)}if(!h||!m[h])return!1;var A=m[h].toLowerCase();return o[h]||(o[h]={}),i[h]||(i[h]={}),o[h][A]?!1:(i[h][A]=!0,!0)}).reverse().forEach(function(m){return a.push(m)});for(var s=Object.keys(i),u=0;u<s.length;u++){var d=s[u],p=Pe({},o[d],i[d]);o[d]=p}return a},[]).reverse()},I=function(e,n){for(var r=e.length-1;r>=0;r--){var o=e[r];if(o.hasOwnProperty(n))return o[n]}return null},St=function(e){return{baseTag:Et([v.HREF,v.TARGET],e),bodyAttributes:Y(k.BODY,e),defer:I(e,L.DEFER),encode:I(e,L.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Y(k.HTML,e),linkTags:B(f.LINK,[v.REL,v.HREF],e),metaTags:B(f.META,[v.NAME,v.CHARSET,v.HTTPEQUIV,v.PROPERTY,v.ITEM_PROP],e),noscriptTags:B(f.NOSCRIPT,[v.INNER_HTML],e),onChangeClientState:xt(e),scriptTags:B(f.SCRIPT,[v.SRC,v.INNER_HTML],e),styleTags:B(f.STYLE,[v.CSS_TEXT],e),title:bt(e),titleAttributes:Y(k.TITLE,e)}},Q=function(){var t=Date.now();return function(e){var n=Date.now();n-t>16?(t=n,e(n)):setTimeout(function(){Q(e)},0)}}(),re=function(e){return clearTimeout(e)},Ct=typeof window<"u"?window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||Q:global.requestAnimationFrame||Q,At=typeof window<"u"?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||re:global.cancelAnimationFrame||re,Pt=function(e){return console&&typeof console.warn=="function"&&console.warn(e)},z=null,Ot=function(e){z&&At(z),e.defer?z=Ct(function(){ne(e,function(){z=null})}):(ne(e),z=null)},ne=function(e,n){var r=e.baseTag,o=e.bodyAttributes,a=e.htmlAttributes,l=e.linkTags,i=e.metaTags,s=e.noscriptTags,u=e.onChangeClientState,d=e.scriptTags,p=e.styleTags,m=e.title,h=e.titleAttributes;X(f.BODY,o),X(f.HTML,a),wt(m,h);var g={baseTag:M(f.BASE,r),linkTags:M(f.LINK,l),metaTags:M(f.META,i),noscriptTags:M(f.NOSCRIPT,s),scriptTags:M(f.SCRIPT,d),styleTags:M(f.STYLE,p)},b={},x={};Object.keys(g).forEach(function(y){var A=g[y],P=A.newTags,F=A.oldTags;P.length&&(b[y]=P),F.length&&(x[y]=g[y].oldTags)}),n&&n(),u(e,b,x)},he=function(e){return Array.isArray(e)?e.join(""):e},wt=function(e,n){typeof e<"u"&&document.title!==e&&(document.title=he(e)),X(f.TITLE,n)},X=function(e,n){var r=document.getElementsByTagName(e)[0];if(r){for(var o=r.getAttribute(O),a=o?o.split(","):[],l=[].concat(a),i=Object.keys(n),s=0;s<i.length;s++){var u=i[s],d=n[u]||"";r.getAttribute(u)!==d&&r.setAttribute(u,d),a.indexOf(u)===-1&&a.push(u);var p=l.indexOf(u);p!==-1&&l.splice(p,1)}for(var m=l.length-1;m>=0;m--)r.removeAttribute(l[m]);a.length===l.length?r.removeAttribute(O):r.getAttribute(O)!==i.join(",")&&r.setAttribute(O,i.join(","))}},M=function(e,n){var r=document.head||document.querySelector(f.HEAD),o=r.querySelectorAll(e+"["+O+"]"),a=Array.prototype.slice.call(o),l=[],i=void 0;return n&&n.length&&n.forEach(function(s){var u=document.createElement(e);for(var d in s)if(s.hasOwnProperty(d))if(d===v.INNER_HTML)u.innerHTML=s.innerHTML;else if(d===v.CSS_TEXT)u.styleSheet?u.styleSheet.cssText=s.cssText:u.appendChild(document.createTextNode(s.cssText));else{var p=typeof s[d]>"u"?"":s[d];u.setAttribute(d,p)}u.setAttribute(O,"true"),a.some(function(m,h){return i=h,u.isEqualNode(m)})?a.splice(i,1):l.push(u)}),a.forEach(function(s){return s.parentNode.removeChild(s)}),l.forEach(function(s){return r.appendChild(s)}),{oldTags:a,newTags:l}},ge=function(e){return Object.keys(e).reduce(function(n,r){var o=typeof e[r]<"u"?r+'="'+e[r]+'"':""+r;return n?n+" "+o:o},"")},jt=function(e,n,r,o){var a=ge(r),l=he(n);return a?"<"+e+" "+O+'="true" '+a+">"+G(l,o)+"</"+e+">":"<"+e+" "+O+'="true">'+G(l,o)+"</"+e+">"},Rt=function(e,n,r){return n.reduce(function(o,a){var l=Object.keys(a).filter(function(u){return!(u===v.INNER_HTML||u===v.CSS_TEXT)}).reduce(function(u,d){var p=typeof a[d]>"u"?d:d+'="'+G(a[d],r)+'"';return u?u+" "+p:p},""),i=a.innerHTML||a.cssText||"",s=mt.indexOf(e)===-1;return o+"<"+e+" "+O+'="true" '+l+(s?"/>":">"+i+"</"+e+">")},"")},Te=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.keys(e).reduce(function(r,o){return r[$[o]||o]=e[o],r},n)},kt=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.keys(e).reduce(function(r,o){return r[ft[o]||o]=e[o],r},n)},Ft=function(e,n,r){var o,a=(o={key:n},o[O]=!0,o),l=Te(r,a);return[N.createElement(f.TITLE,l,n)]},_t=function(e,n){return n.map(function(r,o){var a,l=(a={key:o},a[O]=!0,a);return Object.keys(r).forEach(function(i){var s=$[i]||i;if(s===v.INNER_HTML||s===v.CSS_TEXT){var u=r.innerHTML||r.cssText;l.dangerouslySetInnerHTML={__html:u}}else l[s]=r[i]}),N.createElement(e,l)})},j=function(e,n,r){switch(e){case f.TITLE:return{toComponent:function(){return Ft(e,n.title,n.titleAttributes)},toString:function(){return jt(e,n.title,n.titleAttributes,r)}};case k.BODY:case k.HTML:return{toComponent:function(){return Te(n)},toString:function(){return ge(n)}};default:return{toComponent:function(){return _t(e,n)},toString:function(){return Rt(e,n,r)}}}},ve=function(e){var n=e.baseTag,r=e.bodyAttributes,o=e.encode,a=e.htmlAttributes,l=e.linkTags,i=e.metaTags,s=e.noscriptTags,u=e.scriptTags,d=e.styleTags,p=e.title,m=p===void 0?"":p,h=e.titleAttributes;return{base:j(f.BASE,n,o),bodyAttributes:j(k.BODY,r,o),htmlAttributes:j(k.HTML,a,o),link:j(f.LINK,l,o),meta:j(f.META,i,o),noscript:j(f.NOSCRIPT,s,o),script:j(f.SCRIPT,u,o),style:j(f.STYLE,d,o),title:j(f.TITLE,{title:m,titleAttributes:h},o)}},Mt=function(e){var n,r;return r=n=function(o){vt(a,o);function a(){return gt(this,a),yt(this,o.apply(this,arguments))}return a.prototype.shouldComponentUpdate=function(i){return!pt(this.props,i)},a.prototype.mapNestedChildrenToProps=function(i,s){if(!s)return null;switch(i.type){case f.SCRIPT:case f.NOSCRIPT:return{innerHTML:s};case f.STYLE:return{cssText:s}}throw new Error("<"+i.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")},a.prototype.flattenArrayTypeChildren=function(i){var s,u=i.child,d=i.arrayTypeChildren,p=i.newChildProps,m=i.nestedChildren;return C({},d,(s={},s[u.type]=[].concat(d[u.type]||[],[C({},p,this.mapNestedChildrenToProps(u,m))]),s))},a.prototype.mapObjectTypeChildren=function(i){var s,u,d=i.child,p=i.newProps,m=i.newChildProps,h=i.nestedChildren;switch(d.type){case f.TITLE:return C({},p,(s={},s[d.type]=h,s.titleAttributes=C({},m),s));case f.BODY:return C({},p,{bodyAttributes:C({},m)});case f.HTML:return C({},p,{htmlAttributes:C({},m)})}return C({},p,(u={},u[d.type]=C({},m),u))},a.prototype.mapArrayTypeChildrenToProps=function(i,s){var u=C({},s);return Object.keys(i).forEach(function(d){var p;u=C({},u,(p={},p[d]=i[d],p))}),u},a.prototype.warnOnInvalidChildren=function(i,s){return!0},a.prototype.mapChildrenToProps=function(i,s){var u=this,d={};return N.Children.forEach(i,function(p){if(!(!p||!p.props)){var m=p.props,h=m.children,g=te(m,["children"]),b=kt(g);switch(u.warnOnInvalidChildren(p,h),p.type){case f.LINK:case f.META:case f.NOSCRIPT:case f.SCRIPT:case f.STYLE:d=u.flattenArrayTypeChildren({child:p,arrayTypeChildren:d,newChildProps:b,nestedChildren:h});break;default:s=u.mapObjectTypeChildren({child:p,newProps:s,newChildProps:b,nestedChildren:h});break}}}),s=this.mapArrayTypeChildrenToProps(d,s),s},a.prototype.render=function(){var i=this.props,s=i.children,u=te(i,["children"]),d=C({},u);return s&&(d=this.mapChildrenToProps(s,d)),N.createElement(e,d)},Tt(a,null,[{key:"canUseDOM",set:function(i){e.canUseDOM=i}}]),a}(N.Component),n.propTypes={base:T.object,bodyAttributes:T.object,children:T.oneOfType([T.arrayOf(T.node),T.node]),defaultTitle:T.string,defer:T.bool,encodeSpecialCharacters:T.bool,htmlAttributes:T.object,link:T.arrayOf(T.object),meta:T.arrayOf(T.object),noscript:T.arrayOf(T.object),onChangeClientState:T.func,script:T.arrayOf(T.object),style:T.arrayOf(T.object),title:T.string,titleAttributes:T.object,titleTemplate:T.string},n.defaultProps={defer:!0,encodeSpecialCharacters:!0},n.peek=e.peek,n.rewind=function(){var o=e.rewind();return o||(o=ve({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),o},r},Nt=function(){return null},It=it(St,Ot,ve)(Nt),oe=Mt(It);oe.renderStatic=oe.rewind;export{Jt as B,We as C,oe as H,Xt as N,Vt as W,Le as a,Zt as b,Je as g,qe as s};