MailPoet Newsletters (New) - Version 3.86.0

Version Description

  • 2022-04-05 =
  • Improved: apply form success message styles also on Captcha confirmation page;
  • Fixed: potential "Call to undefined method" error.
Download this release

Release Info

Developer MailPoet
Plugin Icon 128x128 MailPoet Newsletters (New)
Version 3.86.0
Comparing to
See all releases

Code changes from version 3.85.1 to 3.86.0

assets/dist/js/admin.5289a933.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! For license information please see admin.5289a933.js.LICENSE.txt */
2
+ (self.webpackChunkMailPoet3=self.webpackChunkMailPoet3||[]).push([[328],{49868:function(){jQuery.AsyncQueue=function(){var e,t,n,r,a=this,s=[],o=!1;return r=function(){var e=s.shift();e?(e.apply(a,[a]),!1===o&&r()):t&&t.apply(a)},this.onFailure=function(t){e=t},this.onComplete=function(e){t=e},this.add=function(e){return s.push(e),this},this.storeData=function(e){return n=e,this},this.lastCallbackData=function(){return n},this.run=function(){o=!1,r()},this.pause=function(){return o=!0,this},this.failure=function(){if(o=!0,e){var t=[a];for(i=0;i<arguments.length;i++)t.push(arguments[i]);e.apply(a,t)}},this}},78537:function(e,t,n){"use strict";var r={};n.r(r),n.d(r,{canUseWooSubscriptions:function(){return fo},findFiltersValueForSegment:function(){return Io},getAvailableFilters:function(){return jo},getCustomFieldsList:function(){return bo},getErrors:function(){return Zo},getMembershipPlans:function(){return co},getNewslettersList:function(){return ho},getProductCategories:function(){return mo},getProducts:function(){return lo},getSegment:function(){return yo},getSegmentFilter:function(){return _o},getStaticSegmentsList:function(){return wo},getSubscriberCount:function(){return xo},getSubscriptionProducts:function(){return uo},getWooCommerceCountries:function(){return vo},getWooCommerceCurrencySymbol:function(){return go},getWordpressRoles:function(){return po}});var a={};n.r(a),n.d(a,{handleSave:function(){return qo},pageLoaded:function(){return Fo},setErrors:function(){return Oo},setSegment:function(){return Eo},updateSegment:function(){return Ro},updateSegmentFilter:function(){return Ao},updateSegmentFilterFromEvent:function(){return Mo},updateSegmentFromEvent:function(){return Po},updateSubscriberCount:function(){return Lo}});var s={};n.r(s),n.d(s,{LOAD_SEGMENT:function(){return Uo},SAVE_SEGMENT:function(){return Vo}});var i=n(52524),o=n.n(i),l=n(73727),c=n(5977),d=n(65311),u=n.n(d),p=n(62948),m=n(78596),h=n.n(m),f=n(45697),g=n.n(f),v=n(57744),b=n(57578),y=n(15451),w=function(e){let{children:t,dimension:n,segments:r,strings:a}=e;return(0,y.jsxs)("div",{className:"mailpoet-tags",children:[t,r&&r.map((e=>(0,y.jsx)(b.Z,{dimension:n,variant:"list",children:e.name},e.name))),a&&a.map((e=>(0,y.jsx)(b.Z,{dimension:n,variant:"list",children:e},e)))]})},x=n(33160),_=n(57040),Z=n(44845),j=n(45993),I=n(59050);n(20454);class S extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"getFieldId",(e=>{const t=e||this.props;return t.field.id||t.field.name})),(0,Z.Z)(this,"getSelectedValues",(()=>{if(void 0!==this.props.field.selected)return this.props.field.selected(this.props.item);if(void 0!==this.props.item&&void 0!==this.props.field.name){if(!this.allowMultipleValues())return this.props.item[this.props.field.name];if(I.ZP.isArray(this.props.item[this.props.field.name]))return this.props.item[this.props.field.name].map((e=>e.id))}return null})),(0,Z.Z)(this,"getItems",(()=>{let e;return void 0!==window[`mailpoet_${this.props.field.endpoint}`]?e=window[`mailpoet_${this.props.field.endpoint}`]:void 0!==this.props.field.values&&(e=this.props.field.values),I.ZP.isArray(e)&&void 0!==this.props.field.filter&&(e=e.filter(this.props.field.filter)),e})),(0,Z.Z)(this,"getLabel",(e=>void 0!==this.props.field.getLabel?this.props.field.getLabel(e,this.props.item):e.name)),(0,Z.Z)(this,"getSearchLabel",(e=>void 0!==this.props.field.getSearchLabel?this.props.field.getSearchLabel(e,this.props.item):null)),(0,Z.Z)(this,"getValue",(e=>void 0!==this.props.field.getValue?this.props.field.getValue(e,this.props.item):e.id)),(0,Z.Z)(this,"getCount",(e=>void 0!==this.props.field.getCount?this.props.field.getCount(e,this.props.item):null)),(0,Z.Z)(this,"getTag",(e=>void 0!==this.props.field.getTag?this.props.field.getTag(e,this.props.item):null)),(0,Z.Z)(this,"setupSelect2",(()=>{if(this.isSelect2Initialized())return;const e=e=>{let t="";return e.tag&&(t+=`<span class="mailpoet-form-select2-tag">${e.tag}</span>`),t+=`<span class="mailpoet-form-select2-text"><span>${e.text}</span></span>`,e.count&&(t+=`<span class="mailpoet-form-select2-count">${e.count}</span>`),t};let t={disabled:this.props.disabled||!1,width:this.props.width||"",placeholder:{id:"",text:this.props.field.placeholder},dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:e,templateSelection:e};const n=this.props.field.remoteQuery||null;if(n)t=Object.assign(t,{ajax:{url:window.ajaxurl,type:"POST",dataType:"json",data:function(e){return{action:"mailpoet",api_version:window.mailpoet_api_version,token:window.mailpoet_token,endpoint:n.endpoint,method:n.method,data:Object.assign(n.data,{query:e.term})}},processResults:function(e){let t;return t=I.ZP.has(e,"data")?e.data.map((e=>({id:e.id||e.value,text:e.name||e.text}))):[],{results:t}}},minimumInputLength:n.minimumInputLength||2});else if(void 0!==this.props.field.getCount||void 0!==this.props.field.getTag){const e=this.getItems(this.props.field);let n=this.getSelectedValues()||[];Array.isArray(n)||(n=[n]);const r=e.map((e=>{const t=this.getValue(e);return{id:t,tag:this.getTag(e),text:this.getLabel(e),count:this.getCount(e),selected:n.indexOf(t)>-1}}));t=Object.assign(t,{data:r})}void 0!==this.props.field.extendSelect2Options&&(t=Object.assign(t,this.props.field.extendSelect2Options));const r=u()(`#${this.selectRef.current.id}`).select2(t);let a=!1;r.on("select2:unselecting",(()=>{a=!0})),r.on("select2:opening",(e=>{!0===a&&(a=!1,e.preventDefault())})),r.on("change",this.handleChange)})),(0,Z.Z)(this,"resetSelect2",(()=>{this.destroySelect2(),this.setupSelect2()})),(0,Z.Z)(this,"destroySelect2",(()=>{this.isSelect2Initialized()&&(u()(`#${this.selectRef.current.id}`).select2("destroy"),this.cleanupAfterSelect2())})),(0,Z.Z)(this,"cleanupAfterSelect2",(()=>{u()(`#${this.selectRef.current.id}`).find("option:not(.default)").remove(),u()(`#${this.selectRef.current.id}`).off("select2:unselecting").off("select2:opening")})),(0,Z.Z)(this,"allowMultipleValues",(()=>!0===this.props.field.multiple)),(0,Z.Z)(this,"isSelect2Initialized",(()=>!0===u()(`#${this.selectRef.current.id}`).hasClass("select2-hidden-accessible"))),(0,Z.Z)(this,"isSelect2Component",(()=>this.allowMultipleValues()||this.props.field.forceSelect2)),(0,Z.Z)(this,"handleChange",(e=>{if(void 0===this.props.onValueChange)return;const t=u()(`#${this.selectRef.current.id}`).children(":selected").map((function(){return{id:u()(this).val(),text:u()(this).text()}})),n=this.props.field.multiple?I.ZP.pluck(t,"id"):I.ZP.pluck(t,"id").toString(),r=this.transformChangedValue(n,t);this.props.onValueChange({target:{value:r,name:this.props.field.name,id:e.target.id}})})),(0,Z.Z)(this,"transformChangedValue",((e,t)=>"function"==typeof this.props.field.transformChangedValue?this.props.field.transformChangedValue.call(this,e,t):e)),(0,Z.Z)(this,"insertEmptyOption",(()=>{if(!this.allowMultipleValues())return this.props.field.placeholder?(0,y.jsx)("option",{className:"default"}):void 0})),this.selectRef=(0,j.createRef)()}componentDidMount(){this.isSelect2Component()&&this.setupSelect2()}componentDidUpdate(e){void 0!==this.props.item&&void 0!==e.item&&this.props.item.id!==e.item.id&&u()(`#${this.selectRef.current.id}`).val(this.getSelectedValues()).trigger("change"),this.isSelect2Initialized()&&this.getFieldId(this.props)!==this.getFieldId(e)&&void 0!==this.props.field.resetSelect2OnUpdate&&this.resetSelect2()}componentWillUnmount(){this.isSelect2Component()&&this.destroySelect2()}render(){const e=this.getItems(this.props.field),t=this.getSelectedValues(),n=e.map((e=>{const t=this.getLabel(e),n=this.getSearchLabel(e),r=this.getValue(e);return(0,y.jsx)("option",{className:"default",value:r,title:n,children:t},`option-${e.id}`)}));return(0,y.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,y.jsxs)("select",{id:this.getFieldId(),ref:this.selectRef,disabled:this.props.field.disabled,"data-placeholder":this.props.field.placeholder,multiple:this.props.field.multiple,defaultValue:t,...this.props.field.validation,children:[this.insertEmptyOption(),n]})})}}S.propTypes={onValueChange:g().func,field:g().shape({name:g().string.isRequired,values:g().oneOfType([g().object,g().array]),getLabel:g().func,resetSelect2OnUpdate:g().bool,selected:g().func,endpoint:g().string,filter:g().func,getSearchLabel:g().func,getValue:g().func,getCount:g().func,getTag:g().func,placeholder:g().string,remoteQuery:g().object,extendSelect2Options:g().object,multiple:g().bool,forceSelect2:g().bool,transformChangedValue:g().func,disabled:g().bool,validation:g().shape({"data-parsley-required":g().bool,"data-parsley-required-message":g().string,"data-parsley-type":g().string,"data-parsley-errors-container":g().string,maxLength:g().number})}).isRequired,item:g().object,disabled:g().bool,width:g().string},S.defaultProps={onValueChange:function(){},disabled:!1,width:"",item:void 0};var C=S,T=n(27273),k=n.n(T),N=n(38287),D=function(){if(!p.Z.subscribersLimitReached)return null;const e=p.Z.hasValidApiKey,t=p.Z.I18n.t("subscribersLimitNoticeTitle").replace("[subscribersLimit]",p.Z.subscribersLimit),n=p.Z.I18n.t(e?"yourPlanLimit":"freeVersionLimit").replace("[subscribersLimit]",p.Z.subscribersLimit),r=e?p.Z.MailPoetComUrlFactory.getUpgradeUrl(p.Z.pluginPartialKey):p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount+1),a=k()(p.Z.I18n.t("youCanDisableWPUsersList"),/\[link](.*?)\[\/link]/g,(e=>(0,y.jsx)("a",{href:"?page=mailpoet-segments",children:e},"goToSegments")));return(0,y.jsxs)(N.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,y.jsx)("h3",{children:t}),(0,y.jsxs)("p",{children:[n," ",p.Z.I18n.t("youNeedToUpgrade"),"active"===p.Z.wpSegmentState?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("br",{}),a]}):null]}),(0,y.jsxs)("p",{children:[(0,y.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:r,children:p.Z.I18n.t("upgradeNow")}),e&&(0,y.jsxs)(y.Fragment,{children:[" ",(0,y.jsx)("button",{type:"button",className:"button",onClick:async()=>{await p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:p.Z.I18n.t("refreshMySubscribers")})]})]})]})},E=function(e){let{mssKeyInvalid:t,subscribersCount:n}=e;return t?(0,y.jsxs)(N.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,y.jsx)("h3",{children:p.Z.I18n.t("allSendingPausedHeader")}),(0,y.jsx)("p",{children:k()(p.Z.I18n.t("allSendingPausedBody"),/\[link\](.*?)\[\/link\]/g,(e=>(0,y.jsx)("a",{href:"?page=mailpoet-settings#premium",children:e},"check-sending")))}),(0,y.jsx)("p",{children:(0,y.jsx)("a",{href:`https://account.mailpoet.com?s=${n}`,className:"button button-primary",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("allSendingPausedLink")})})]}):null},O=n(30653),R=function(){if(!p.Z.emailVolumeLimitReached)return null;const e=p.Z.I18n.t("emailVolumeLimitNoticeTitle").replace("[emailVolumeLimit]",p.Z.emailVolumeLimit),t=p.Z.I18n.t("youReachedEmailVolumeLimit").replace("[emailVolumeLimit]",p.Z.emailVolumeLimit),n=p.Z.MailPoetComUrlFactory.getUpgradeUrl(p.Z.pluginPartialKey),r=new Date,a=new Date(r.getFullYear(),r.getMonth()+1,1);let s=k()(p.Z.I18n.t("toContinueUpgradeYourPlanOrWaitUntil"),/\[link](.*?)\[\/link]/g,(e=>(0,y.jsx)("a",{target:"_blank",rel:"noreferrer",href:n,children:e},e)));return s=k()(s,/<b>\[date]<\/b>\./g,(()=>(0,O.ZP)(`<b>${p.Z.Date.short(a)}</b>.`))),(0,y.jsxs)(N.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,y.jsx)("h3",{children:e}),(0,y.jsxs)("p",{children:[t,(0,y.jsx)("br",{}),s]}),(0,y.jsxs)("p",{children:[(0,y.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:n,children:p.Z.I18n.t("upgradeNow")})," ",(0,y.jsx)("button",{type:"button",className:"button",onClick:async()=>{await p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:p.Z.I18n.t("refreshMyEmailVolumeLimit")})]})]})};function A(e){let{cacheCalculation:t}=e;const[n,r]=(0,j.useState)(!1),[a,s]=(0,j.useState)([]),i=(new Date).getTime()-new Date(t).getTime(),o=Math.floor(i/1e3/60);return(0,y.jsxs)("div",{className:"mailpoet-subscribers-cache-notice",children:[k()(p.Z.I18n.t("subscribersCountWereCalculatedWithMinutesAgo"),/<abbr>(.*?)<\/abbr>/,((e,n)=>(0,y.jsx)("abbr",{title:t,children:e.replace(/(\{\$mins\}|\$mins)/i,String(o))},n))),(0,y.jsx)(v.Z,{className:"mailpoet-subscribers-cache-notice-button",type:"button",variant:"secondary",dimension:"small",onClick:()=>{r(!0),p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"settings",action:"recalculateSubscribersCountsCache"}).done((()=>{window.location.reload()})).fail((e=>{s(e.errors.map((e=>e.message))),r(!1)}))},withSpinner:n,children:p.Z.I18n.t("recalculateNow")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),a.length>0&&(0,y.jsx)(N.Z,{type:"error",children:a.map((e=>(0,y.jsx)("p",{children:e},e)))})]})}var P=n(49793),M=n.n(P),L=function(e){let{subscribersInPlan:t,subscribersInPlanLimit:n}=e;if(!1===t)return null;const r=n?(0,y.jsx)("b",{children:p.Z.I18n.t("subscribersInPlanCount").replace("%1$d",t.toLocaleString()).replace("%2$d",n.toLocaleString())},"subscribers_count"):(0,y.jsx)("b",{children:t},"subscribers_count");return(0,y.jsxs)("div",{className:"mailpoet-subscribers-in-plan",children:[k()(p.Z.I18n.t("subscribersInPlan"),"%s",(()=>r))," ",(0,y.jsx)(M(),{tooltip:p.Z.I18n.t("subscribersInPlanTooltip"),place:"right"}),(0,y.jsx)("span",{className:"mailpoet-subscribers-in-plan-spacer",children:" "})]})},F=n(99181),q=(0,y.jsx)("svg",{viewBox:"4 4 16 16",children:(0,y.jsx)("path",{d:"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"})});function $(e){let{location:t}=e;return(0,y.jsxs)(F.Q,{children:[(0,y.jsxs)(l.rU,{className:"mailpoet-button button-secondary",to:{pathname:"/new",state:{backUrl:t?.pathname}},children:[q,(0,y.jsx)("span",{"data-automation-id":"add-new-subscribers-button",children:p.Z.I18n.t("new")})]}),(0,y.jsx)("a",{className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-import","data-automation-id":"import-subscribers-button",children:p.Z.I18n.t("import")}),(0,y.jsx)("a",{id:"mailpoet_export_button",className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-export",children:p.Z.I18n.t("export")})]})}$.propTypes={location:g().object.isRequired};var U=(0,c.withRouter)($),V=n(53423);function W(e){let{id:t,engagementScore:n}=e;const r={unknown:{name:p.Z.I18n.t("unknownBadgeName"),type:"unknown",tooltipTitle:p.Z.I18n.t("unknownBadgeTooltip"),tooltipText:p.Z.I18n.t("tooltipUnknown")},excellent:{name:p.Z.I18n.t("excellentBadgeName"),type:"excellent",tooltipTitle:p.Z.I18n.t("excellentBadgeTooltip"),tooltipText:p.Z.I18n.t("tooltipExcellent")},good:{name:p.Z.I18n.t("goodBadgeName"),type:"good",tooltipTitle:p.Z.I18n.t("goodBadgeTooltip"),tooltipText:p.Z.I18n.t("tooltipGood")},average:{name:p.Z.I18n.t("averageBadgeName"),type:"average",tooltipTitle:p.Z.I18n.t("averageBadgeTooltip"),tooltipText:p.Z.I18n.t("tooltipAverage")}},a=`badge-${t}`;let s;s=null==n?r.unknown:n<20?r.average:n<50?r.good:r.excellent;const i=(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"mailpoet-listing-stats-tooltip-title",children:s.tooltipTitle.toUpperCase()}),(0,y.jsx)("div",{className:"mailpoet-listing-stats-tooltip-description",children:p.Z.I18n.t("engagementScoreDescription")}),(0,y.jsxs)("div",{className:"mailpoet-listing-stats-tooltip-content",children:[(0,y.jsx)(V.Z,{type:"unknown",name:p.Z.I18n.t("unknownBadgeName")})," : ",r.unknown.tooltipText,(0,y.jsx)("br",{}),(0,y.jsx)(V.Z,{type:"excellent",name:p.Z.I18n.t("excellentBadgeName")})," : ",r.excellent.tooltipText,(0,y.jsx)("br",{}),(0,y.jsx)(V.Z,{type:"good",name:p.Z.I18n.t("goodBadgeName")})," : ",r.good.tooltipText,(0,y.jsx)("br",{}),(0,y.jsx)(V.Z,{type:"average",name:p.Z.I18n.t("averageBadgeName")})," : ",r.average.tooltipText]})]},`tooltip-${a}`);return(0,y.jsxs)("div",{className:"mailpoet-listing-stats-opened-clicked",children:[null!=n&&(0,y.jsxs)("div",{className:"mailpoet-listing-stats-percentages",children:[n.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),"%"]}),(0,y.jsx)("div",{children:(0,y.jsx)(V.Z,{isInverted:!0,type:s.type,name:s.name,tooltip:i,tooltipId:a,tooltipPlace:"top"})})]})}const Y=p.Z.trackingConfig.emailTrackingEnabled,B=[{name:"email",label:p.Z.I18n.t("subscriber"),sortable:!0},{name:"status",label:p.Z.I18n.t("status"),sortable:!0},{name:"segments",label:p.Z.I18n.t("lists")},{name:"statistics",label:p.Z.I18n.t("statisticsColumn"),display:Y},{name:"created_at",label:p.Z.I18n.t("subscribedOn"),sortable:!0}],H={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneSubscriberTrashed"):p.Z.I18n.t("multipleSubscribersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneSubscriberDeleted"):p.Z.I18n.t("multipleSubscribersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneSubscriberRestored"):p.Z.I18n.t("multipleSubscribersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onNoItemsFound:e=>"bounced"===e&&!window.mailpoet_premium_active&&!window.mailpoet_mss_active&&(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{children:p.Z.I18n.t("bouncedSubscribersHelp")}),(0,y.jsx)("p",{children:(0,y.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",className:"button-primary",children:p.Z.I18n.t("bouncedSubscribersPremiumButtonText")})})]})},z=(e,t,n,r)=>(0,y.jsxs)(_.Z,{title:r,onRequestClose:t,isDismissible:!0,children:[(0,y.jsx)(C,{field:n}),(0,y.jsx)("span",{className:"mailpoet-gap-half"}),(0,y.jsx)(v.Z,{onClick:e,dimension:"small",variant:"secondary",children:p.Z.I18n.t("apply")})]}),K=[{name:"moveToList",label:p.Z.I18n.t("moveToList"),onSelect:function(e,t){return z(e,t,{id:"move_to_segment",name:"move_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},p.Z.I18n.t("moveToList"))},getData:function(){return{segment_id:Number(u()("#move_to_segment").val())}},onSuccess:function(e){p.Z.Notice.success(p.Z.I18n.t("multipleSubscribersMovedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"addToList",label:p.Z.I18n.t("addToList"),onSelect:function(e,t){return z(e,t,{id:"add_to_segment",name:"add_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},p.Z.I18n.t("addToList"))},getData:function(){return{segment_id:Number(u()("#add_to_segment").val())}},onSuccess:function(e){p.Z.Notice.success(p.Z.I18n.t("multipleSubscribersAddedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromList",label:p.Z.I18n.t("removeFromList"),onSelect:function(e,t){return z(e,t,{id:"remove_from_segment",name:"remove_from_segment",endpoint:"segments",filter:function(e){return!("default"!==e.type)}},p.Z.I18n.t("removeFromList"))},getData:function(){return{segment_id:Number(u()("#remove_from_segment").val())}},onSuccess:function(e){p.Z.Notice.success(p.Z.I18n.t("multipleSubscribersRemovedFromList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromAllLists",label:p.Z.I18n.t("removeFromAllLists"),onSuccess:function(e){p.Z.Notice.success(p.Z.I18n.t("multipleSubscribersRemovedFromAllLists").replace("%1$d",Number(e.meta.count).toLocaleString()))}},{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:H.onTrash},{name:"unsubscribe",label:p.Z.I18n.t("unsubscribe"),onSelect:(e,t,n)=>{const r="all"!==n.selection?n.selected_ids.length:n.count;return(0,y.jsxs)(_.Z,{title:p.Z.I18n.t("unsubscribe"),onRequestClose:t,isDismissible:!0,children:[(0,y.jsx)("p",{children:p.Z.I18n.t("unsubscribeConfirm").replace("%s",r.toLocaleString())}),(0,y.jsx)("span",{className:"mailpoet-gap-half"}),(0,y.jsx)(v.Z,{onClick:e,dimension:"small",variant:"secondary",automationId:"bulk-unsubscribe-confirm",children:p.Z.I18n.t("apply")})]})}}],G=[{name:"statistics",label:p.Z.I18n.t("statsListingActionTitle"),link:function(e,t){return(0,y.jsx)(l.rU,{to:{pathname:`/stats/${e.id}`,state:{backUrl:t?.pathname}},children:p.Z.I18n.t("statsListingActionTitle")})}},{name:"edit",label:p.Z.I18n.t("edit"),link:function(e,t){return(0,y.jsx)(l.rU,{to:{pathname:`/edit/${e.id}`,state:{backUrl:t?.pathname}},children:p.Z.I18n.t("edit")})}},{name:"sendConfirmationEmail",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("resendConfirmationEmail"),display:function(e){return"unconfirmed"===e.status&&e.count_confirmations<window.mailpoet_max_confirmation_emails},onClick:function(e){return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"subscribers",action:"sendConfirmationEmail",data:{id:e.id}}).done((()=>p.Z.Notice.success(p.Z.I18n.t("oneConfirmationEmailSent")))).fail((e=>p.Z.Notice.showApiErrorNotice(e)))}},{name:"trash",className:"mailpoet-hide-on-mobile"}],Q=e=>0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user);function X(e){let{match:t}=e;const n=(0,c.useLocation)();return(0,y.jsxs)("div",{children:[(0,y.jsx)(U,{}),(0,y.jsx)(L,{subscribersInPlan:p.Z.subscribersCount,subscribersInPlanLimit:p.Z.subscribersLimit}),(0,y.jsx)(D,{}),(0,y.jsx)(R,{}),(0,y.jsx)(E,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,y.jsx)(A,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:n,params:t.params,endpoint:"subscribers",onRenderItem:(e,t)=>{const r=h()("manage-column","column-primary","has-row-actions","column-username");let a="";switch(e.status){case"subscribed":a=p.Z.I18n.t("subscribed");break;case"unconfirmed":a=p.Z.I18n.t("unconfirmed");break;case"unsubscribed":a=p.Z.I18n.t("unsubscribed");break;case"inactive":a=p.Z.I18n.t("inactive");break;case"bounced":a=p.Z.I18n.t("bounced");break;default:a="Invalid"}const s=[];return e.subscriptions.length>0&&e.subscriptions.forEach((e=>{const t=(e=>{let t=!1;return window.mailpoet_segments.forEach((n=>{n.id===e&&(t=n)})),t})(e.segment_id);!1!==t&&"subscribed"===e.status&&s.push(t)})),(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:r,children:[(0,y.jsx)(l.rU,{className:"mailpoet-listing-title",to:{pathname:`/edit/${e.id}`,state:{backUrl:n?.pathname}},children:e.email}),(0,y.jsxs)("div",{className:"mailpoet-listing-subtitle",children:[e.first_name," ",e.last_name]}),t]}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("status"),children:a}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("lists"),children:(0,y.jsx)(w,{segments:s,dimension:"large"})}),!0===Y?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("statisticsColumn"),children:(0,y.jsx)("div",{className:"mailpoet-listing-stats",children:(0,y.jsx)("a",{href:`#/stats/${e.id}`,children:(0,y.jsx)(W,{id:e.id,engagementScore:e.engagement_score})},`stats-link-${e.id}`)})}):null,(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("subscribedOn"),children:[p.Z.Date.short(e.created_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.created_at)]})]})},columns:B,bulk_actions:K,item_actions:G,messages:H,sort_by:"created_at",sort_order:"desc",isItemDeletable:Q})]})}X.propTypes={match:g().shape({params:g().object}).isRequired};var J=X,ee=n(30381),te=n.n(ee),ne=n(17123),re=n.n(ne),ae=n(60017);class se extends j.Component{render(){const e=this.props.field.name||null,t=this.props.item||{};let n,r;this.props.onValueChange instanceof Function&&(n=t[this.props.field.name],n=void 0===n?this.props.field.defaultValue||"":n),!n&&this.props.field.defaultValue&&(r=this.props.field.defaultValue);let a=this.props.field.id||null;!a&&this.props.field.name&&(a=`field_${this.props.field.name}`);let s=this.props.field.className||null;return s||this.props.field.size||(s="regular-text"),(0,y.jsx)(ae.Z,{type:"text",disabled:void 0!==this.props.field.disabled&&this.props.field.disabled(this.props.item),className:s,size:"auto"!==this.props.field.size&&this.props.field.size>0?this.props.field.size:null,name:e,id:a,value:n,defaultValue:r,placeholder:this.props.field.placeholder,onChange:this.props.onValueChange,customLabel:this.props.field.customLabel,tooltip:this.props.field.tooltip,...this.props.field.validation})}}se.propTypes={onValueChange:g().func,field:g().shape({name:g().string.isRequired,defaultValue:g().string,id:g().string,className:g().string,size:g().oneOfType([g().string,g().number]),disabled:g().func,placeholder:g().string,validation:g().shape({"data-parsley-required":g().bool,"data-parsley-required-message":g().string,"data-parsley-type":g().string,"data-parsley-errors-container":g().string,maxLength:g().number}),customLabel:g().string,tooltip:g().string}).isRequired,item:g().object.isRequired},se.defaultProps={onValueChange:function(){}};var ie=se,oe=n(97972);function le(e){return(0,y.jsx)(oe.Z,{type:"text",name:e.field.name,id:`field_${e.field.name}`,value:e.item[e.field.name],placeholder:e.field.placeholder,defaultValue:e.field.defaultValue,onChange:e.onValueChange,className:e.field.className,customLabel:e.field.customLabel,tooltip:e.field.tooltip,...e.field.validation})}le.propTypes={item:g().object.isRequired,field:g().shape({name:g().string,placeholder:g().string,defaultValue:g().string,validation:g().shape({"data-parsley-required":g().bool,"data-parsley-required-message":g().string,"data-parsley-type":g().string,"data-parsley-errors-container":g().string,maxLength:g().number}),className:g().string,customLabel:g().string,tooltip:g().string}).isRequired,onValueChange:g().func.isRequired};var ce=le,de=n(2141);class ue extends j.Component{render(){if(void 0===this.props.field.values)return!1;let e,t=!1,n=!1,r=!1;void 0!==this.props.field.placeholder&&(n=(0,y.jsx)("option",{value:"",children:this.props.field.placeholder})),void 0!==this.props.field.filter&&(t=this.props.field.filter),I.ZP.isFunction(this.props.field.sortBy)&&(r=this.props.field.sortBy),e=r?I.ZP.map(I.ZP.sortBy(I.ZP.pairs(this.props.field.values),(e=>r(e[0],e[1]))),(e=>e[0])):Object.keys(this.props.field.values);const a=e.filter((e=>!1===t||t(this.props.item,e))).map((e=>(0,y.jsx)("option",{value:e,children:this.props.field.values[e]},`option-${e}`)));return(0,y.jsxs)(de.Z,{name:this.props.field.name,id:`field_${this.props.field.name}`,value:this.props.item[this.props.field.name]||"",onChange:this.props.onValueChange,automationId:this.props.automationId,...this.props.field.validation,children:[n,a]})}}ue.propTypes={onValueChange:g().func,field:g().shape({name:g().string.isRequired,values:g().objectOf(g().string),placeholder:g().string,filter:g().func,sortBy:g().func,validation:g().shape({"data-parsley-required":g().bool,"data-parsley-required-message":g().string,"data-parsley-type":g().string,"data-parsley-errors-container":g().string,maxLength:g().number})}).isRequired,item:g().object.isRequired,automationId:g().string},ue.defaultProps={automationId:"",onValueChange:function(){}};var pe=ue,me=n(84868);class he extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"onValueChange",((e,t)=>this.props.onValueChange(t))),this.onValueChange=this.onValueChange.bind(this)}render(){if(void 0===this.props.field.values)return!1;const e=this.props.item[this.props.field.name],t=Object.keys(this.props.field.values).map((t=>(0,y.jsx)("p",{children:(0,y.jsx)(me.Z,{checked:e===t,value:t,onCheck:this.onValueChange,name:this.props.field.name,children:this.props.field.values[t]})},`radio-${t}`)));return(0,y.jsx)("div",{children:t})}}he.propTypes={onValueChange:g().func,field:g().shape({name:g().string.isRequired,values:g().objectOf(g().string)}).isRequired,item:g().object.isRequired},he.defaultProps={onValueChange:function(){}};var fe=he,ge=n(16277);class ve extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"onValueChange",((e,t)=>(t.target.value=e?"1":"0",this.props.onValueChange(t)))),this.onValueChange=this.onValueChange.bind(this)}render(){if(void 0===this.props.field.values)return!1;const e=!!Number(this.props.item[this.props.field.name]),t=Object.keys(this.props.field.values).map((t=>(0,y.jsx)("p",{children:(0,y.jsx)(ge.Z,{value:"1",checked:e,name:this.props.field.name,onCheck:this.onValueChange,children:this.props.field.values[t]})},`checkbox-${t}`)));return(0,y.jsx)("div",{children:t})}}ve.propTypes={onValueChange:g().func.isRequired,field:g().shape({name:g().string.isRequired,values:g().objectOf(g().string)}).isRequired,item:g().object.isRequired};var be=ve;function ye(e){const t=[];void 0!==e.placeholder&&t.push((0,y.jsx)("option",{value:"",children:e.placeholder},0));const n=te()().year();for(let e=n;e>=n-100;e-=1)t.push((0,y.jsx)("option",{value:e,children:e},e));return(0,y.jsx)(de.Z,{isMinWidth:!0,name:`${e.name}[year]`,value:e.year,onChange:e.onValueChange,children:t})}function we(e){const t=[];void 0!==e.placeholder&&t.push((0,y.jsx)("option",{value:"",children:e.placeholder},0));for(let n=1;n<=12;n+=1)t.push((0,y.jsx)("option",{value:n,children:e.monthNames[n-1]},n));return(0,y.jsx)(de.Z,{isMinWidth:!0,name:`${e.name}[month]`,value:e.month,onChange:e.onValueChange,children:t})}function xe(e){const t=[];void 0!==e.placeholder&&t.push((0,y.jsx)("option",{value:"",children:e.placeholder},0));for(let e=1;e<=31;e+=1)t.push((0,y.jsx)("option",{value:e,children:e},e));return(0,y.jsx)(de.Z,{isMinWidth:!0,name:`${e.name}[day]`,value:e.day,onChange:e.onValueChange,children:t})}ye.propTypes={name:g().string.isRequired,placeholder:g().string.isRequired,onValueChange:g().func.isRequired,year:g().oneOfType([g().string,g().number]).isRequired},we.propTypes={name:g().string.isRequired,placeholder:g().string.isRequired,onValueChange:g().func.isRequired,month:g().oneOfType([g().string,g().number]).isRequired,monthNames:g().arrayOf(g().string).isRequired},xe.propTypes={name:g().string.isRequired,placeholder:g().string.isRequired,onValueChange:g().func.isRequired,day:g().oneOfType([g().string,g().number]).isRequired};class _e extends j.Component{constructor(e){super(e),this.state={year:"",month:"",day:""},this.onValueChange=this.onValueChange.bind(this)}componentDidMount(){this.extractDateParts()}componentDidUpdate(e){void 0!==this.props.item&&void 0!==e.item&&this.props.item.id!==e.item.id&&this.extractDateParts()}onValueChange(e){const t=e.target.name.match(/(.*?)\[(.*?)\]/);let n=null,r=null;if(null!==t&&3===t.length){[,n,r]=t;const a=Number(e.target.value);this.setState({[`${r}`]:a},(()=>{this.props.onValueChange({target:{name:n,value:this.formatValue()}})}))}}formatValue(){let e;switch(this.props.field.params.date_type){case"year_month_day":e={year:this.state.year,month:this.state.month,day:this.state.day};break;case"year_month":e={year:this.state.year,month:this.state.month};break;case"month":e={month:this.state.month};break;case"year":e={year:this.state.year};break;default:e={value:"invalid type"}}return e}extractDateParts(){const e=void 0!==this.props.item[this.props.field.name]?this.props.item[this.props.field.name].trim():"";if(""===e)return;const t=te()(e);this.setState({year:t.format("YYYY"),month:t.format("M"),day:t.format("D")})}render(){const e=window.mailpoet_month_names||[];let t=(window.mailpoet_date_formats||{})[this.props.field.params.date_type][0];this.props.field.params.date_format&&(t=this.props.field.params.date_format);const n=t.split("/").map((t=>{switch(t){case"YYYY":return(0,y.jsx)(ye,{onValueChange:this.onValueChange,name:this.props.field.name,year:this.state.year,placeholder:this.props.field.year_placeholder},"year");case"MM":return(0,y.jsx)(we,{onValueChange:this.onValueChange,name:this.props.field.name,month:this.state.month,monthNames:e,placeholder:this.props.field.month_placeholder},"month");case"DD":return(0,y.jsx)(xe,{onValueChange:this.onValueChange,name:this.props.field.name,day:this.state.day,placeholder:this.props.field.day_placeholder},"day");default:return(0,y.jsx)("div",{children:"Invalid date type"})}}));return(0,y.jsx)("div",{children:n})}}_e.propTypes={item:g().object.isRequired,field:g().shape({name:g().string,day_placeholder:g().string,month_placeholder:g().string,year_placeholder:g().string,params:g().object}).isRequired,onValueChange:g().func.isRequired};var Ze=_e,je=n(22529);class Ie extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"renderField",(e=>{let t,n=!1;e.field.description&&(n=(0,y.jsx)("p",{className:"description",children:e.field.description}));let r=e.field;switch(void 0!==e.field.field&&(r=u().merge(r,e.field.field)),r.type){case"text":t=(0,y.jsx)(ie,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"textarea":t=(0,y.jsx)(ce,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"select":t=(0,y.jsx)(pe,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"radio":t=(0,y.jsx)(fe,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"checkbox":t=(0,y.jsx)(be,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"selection":t=(0,y.jsx)(C,{onValueChange:e.onValueChange,field:e.field,automationId:e.automationId,inline:e.inline,description:e.description,item:e.item},`selection-field-${r.name}`);break;case"date":t=(0,y.jsx)(Ze,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"reactComponent":t=(0,y.jsx)(e.field.component,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"empty":break;default:t="invalid"}return(0,y.jsxs)("div",{className:"mailpoet-form-field",children:[t,n]},`field-${e.index||0}`)}))}render(){let e=!1;e=void 0!==this.props.field.fields?this.props.field.fields.map(((e,t)=>this.renderField({index:t,field:e,item:this.props.item,onValueChange:this.props.onValueChange||!1}))):this.renderField(this.props);let t=!1;this.props.field.label&&(t=(0,y.jsx)(je.Z,{level:4,children:(0,y.jsx)("label",{htmlFor:`field_${this.props.field.name}`,children:this.props.field.label})}));let n=!1;return this.props.field.tip&&(n=(0,y.jsx)("p",{className:"mailpoet-form-description",children:this.props.field.tip})),(0,y.jsxs)("div",{className:`mailpoet-form-field-${this.props.field.name} form-field-row-${this.props.field.name}`,children:[t,n,e]})}}Ie.propTypes={onValueChange:g().func,field:g().shape({name:g().string.isRequired,values:g().objectOf(g().string),tip:g().oneOfType([g().array,g().string]),label:g().string,fields:g().arrayOf(g().object),description:g().string}).isRequired,item:g().object.isRequired},Ie.defaultProps={onValueChange:function(){}};var Se=Ie,Ce=n(62698);class Te extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"getValues",(()=>this.props.item||this.state.item)),(0,Z.Z)(this,"getErrors",(()=>this.props.errors||this.state.errors)),(0,Z.Z)(this,"loadItem",(e=>{this.setState({loading:!0}),this.props.endpoint&&p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:this.props.endpoint,action:"get",data:{id:e}}).done((e=>{this.setState({loading:!1,item:e.data}),"function"==typeof this.props.onItemLoad&&this.props.onItemLoad(e.data)})).fail((()=>{this.setState({loading:!1,item:{}},(function(){this.props.history.push("/lists")}))}))})),(0,Z.Z)(this,"handleSubmit",(e=>{if(e.preventDefault(),void 0!==this.props.isValid&&!1===this.props.isValid())return;this.setState({loading:!0});const t={};this.props.fields.forEach((e=>{void 0!==e.fields?e.fields.forEach((e=>{t[e.name]=this.state.item[e.name]})):t[e.name]=this.state.item[e.name]})),void 0!==this.props.params.id&&(t.id=this.props.params.id),this.props.endpoint&&p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:this.props.endpoint,action:"save",data:t}).always((()=>{this.setState({loading:!1})})).done((()=>{void 0!==this.props.onSuccess?this.props.onSuccess():this.props.history.push("/"),void 0!==this.props.params.id?this.props.messages.onUpdate():this.props.messages.onCreate()})).fail((e=>{e.errors.length>0&&this.setState({errors:e.errors})}))})),(0,Z.Z)(this,"handleValueChange",(e=>{const{name:t,value:n}=e.target;return this.props.onChange?this.props.onChange(e):(this.setState((e=>{const r=e.item;return r[t]=n,{item:r}})),!0)})),this.formRef=(0,j.createRef)(),this.state={loading:!1,errors:[],item:{}}}componentDidMount(){void 0!==this.props.params.id?this.loadItem(this.props.params.id):re()((()=>{this.setState({item:u()(".mailpoet_form").mailpoetSerializeObject()})}))}componentDidUpdate(e){void 0===this.props.params.id&&e.location.pathname!==this.props.location.pathname&&(re()((()=>{this.setState({loading:!1,item:{}})})),void 0===this.props.item&&this.formRef.current.reset())}render(){let e;void 0!==this.getErrors()&&(e=this.getErrors().map((e=>(0,y.jsx)("div",{className:"mailpoet_notice notice inline error is-dismissible",children:(0,y.jsx)("p",{children:e.message})},`error-${e.message}`))));const t=h()("mailpoet_form",{mailpoet_form_loading:this.state.loading||this.props.loading});let n=!1,r=!1;void 0!==this.props.beforeFormContent&&(n=this.props.beforeFormContent(this.getValues())),void 0!==this.props.afterFormContent&&(r=this.props.afterFormContent(this.getValues()));const a=this.props.fields.map((e=>{let t=this.handleValueChange;return e.onBeforeChange&&(t=t=>(e.onBeforeChange(t),this.handleValueChange(t))),(0,y.jsx)(Se,{field:e,item:this.getValues(),onValueChange:t,automationId:e.automationId},`field-${e.name}`)}));let s=!1;return s=this.props.children?this.props.children:(0,y.jsx)(Ce.Button,{type:"submit",isDisabled:this.state.loading,children:p.Z.I18n.t("save")}),(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"mailpoet-form-content-around",children:n}),(0,y.jsxs)("form",{id:this.props.id,ref:this.formRef,className:t,onSubmit:void 0!==this.props.onSubmit?this.props.onSubmit:this.handleSubmit,"data-automation-id":this.props.automationId,children:[e,(0,y.jsxs)("div",{className:"mailpoet-form-grid",children:[a,(0,y.jsx)("div",{className:"mailpoet-form-actions",children:s})]})]}),(0,y.jsx)("div",{className:"mailpoet-form-content-around",children:r})]})}}Te.propTypes={params:g().shape({id:g().string}),location:g().shape({pathname:g().string}),item:g().object,errors:g().arrayOf(g().object),endpoint:g().string,fields:g().arrayOf(g().object),messages:g().shape({onUpdate:g().func,onCreate:g().func}),loading:g().bool,children:g().array,id:g().string,automationId:g().string,beforeFormContent:g().func,afterFormContent:g().func,onItemLoad:g().func,isValid:g().func,onChange:g().func,onSubmit:g().func,onSuccess:g().func,history:g().shape({push:g().func.isRequired}).isRequired},Te.defaultProps={params:{},location:{},errors:void 0,fields:void 0,item:void 0,onItemLoad:void 0,isValid:void 0,onSuccess:void 0,onChange:void 0,loading:!1,beforeFormContent:void 0,afterFormContent:void 0,children:void 0,id:"",onSubmit:void 0,automationId:"",messages:{onUpdate:()=>{},onCreate:()=>{}},endpoint:void 0};var ke=(0,c.withRouter)(Te),Ne=n(86529),De=n(71014);const Ee=[{name:"email",label:p.Z.I18n.t("email"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"first_name",label:p.Z.I18n.t("firstname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"last_name",label:p.Z.I18n.t("lastname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"status",label:p.Z.I18n.t("status"),type:"select",automationId:"subscriber-status",values:{subscribed:p.Z.I18n.t("subscribed"),unconfirmed:p.Z.I18n.t("unconfirmed"),unsubscribed:p.Z.I18n.t("unsubscribed"),inactive:p.Z.I18n.t("inactive"),bounced:p.Z.I18n.t("bounced")}},{name:"segments",label:p.Z.I18n.t("lists"),type:"selection",placeholder:p.Z.I18n.t("selectList"),tip:p.Z.I18n.t("welcomeEmailTip"),api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,selected:function(e){return!1===Array.isArray(e.subscriptions)?null:e.subscriptions.filter((e=>"subscribed"===e.status)).map((e=>e.segment_id))},filter:function(e){return!e.deleted_at&&"default"===e.type},getLabel:function(e){return e.name},getCount:function(e){return e.subscribers},getSearchLabel:function(e,t){let n="";return void 0!==t.subscriptions&&t.subscriptions.forEach((t=>{if(e.id===t.segment_id&&(n=e.name,"unsubscribed"===t.status)){const e=p.Z.Date.format(t.updated_at);n+=" (%1$s)".replace("%1$s",p.Z.I18n.t("unsubscribedOn").replace("%1$s",e))}})),n}}];(window.mailpoet_custom_fields||[]).forEach((e=>{const t={name:`cf_${e.id}`,label:e.name,type:e.type};switch(e.params&&(t.params=e.params,e.params.values&&(t.values=e.params.values)),e.type){case"date":t.year_placeholder=p.Z.I18n.t("year"),t.month_placeholder=p.Z.I18n.t("month"),t.day_placeholder=p.Z.I18n.t("day");break;case"select":t.placeholder="-";break;default:t.placeholder=""}Ee.push(t)}));const Oe={onUpdate:function(){p.Z.Notice.success(p.Z.I18n.t("subscriberUpdated"))},onCreate:function(){p.Z.Notice.success(p.Z.I18n.t("subscriberAdded")),p.Z.trackEvent("Subscribers > Add new")}};function Re(e){if(Number(e.wp_user_id)>0)return(0,y.jsx)("p",{className:"description",children:k()(p.Z.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,((t,n)=>(0,y.jsx)("a",{href:`user-edit.php?user_id=${e.wp_user_id}`,children:t},n)))})}function Ae(e){return(0,y.jsxs)(y.Fragment,{children:[e?.unsubscribes?.map((e=>{const t=te()(e.createdAt.date).format("dddd MMMM Do YYYY [at] h:mm:ss a");let n;return n="admin"===e.source?p.Z.I18n.t("unsubscribedAdmin").replace("%1$d",t).replace("%2$d",e.meta):"manage"===e.source?p.Z.I18n.t("unsubscribedManage").replace("%1$d",t):"newsletter"===e.source?k()(p.Z.I18n.t("unsubscribedNewsletter").replace("%1$d",t),/\[link\]/g,((t,n)=>(0,y.jsx)("a",{href:`admin.php?page=mailpoet-newsletter-editor&id=${e.newsletterId}`,children:e.newsletterSubject},n))):p.Z.I18n.t("unsubscribedUnknown").replace("%1$d",t),(0,y.jsx)("p",{className:"description",children:n},n)})),(0,y.jsxs)("p",{className:"description",children:[(0,y.jsx)("strong",{children:p.Z.I18n.t("tip")})," ",p.Z.I18n.t("customFieldsTip")]})]})}function Pe(e){let{match:t}=e;const n=(0,c.useLocation)(),r=(0,c.useHistory)(),a=n.state?.backUrl||"/";return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(De.Z,{}),(0,y.jsxs)(je.Z,{level:1,className:"mailpoet-title",children:[(0,y.jsx)("span",{children:p.Z.I18n.t("subscriber")}),(0,y.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:a,children:p.Z.I18n.t("backToList")})]}),(0,y.jsx)(D,{}),(0,y.jsx)(ke,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:Ee,params:t.params,messages:Oe,beforeFormContent:Re,afterFormContent:Ae,onSuccess:()=>r.push(a)})]})}Pe.propTypes={match:g().shape({params:g().shape({id:g().string}).isRequired}).isRequired};var Me=Pe,Le=n(5830),Fe=n(71304);function qe(e){let{email:t}=e;const n=(0,c.useLocation)().state?.backUrl||"/";return(0,y.jsxs)(je.Z,{level:1,className:"mailpoet-title",children:[(0,y.jsx)("span",{children:p.Z.I18n.t("statsHeading").replace("%s",t)}),(0,y.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:n,children:p.Z.I18n.t("backToList")})]})}var $e=n(83213);function Ue(e){let{totalSent:t,open:n,machineOpen:r,click:a,subscriber:s}=e,i=0,o=0,l=0,c=0;const d=t-(n+r),u=t>0;return u&&(i=Math.round(n/t*100),o=Math.round(r/t*100),l=Math.round(a/t*100),c=Math.round(d/t*100)),(0,y.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,y.jsx)("div",{className:"mailpoet-listing",children:(0,y.jsx)("table",{className:"mailpoet-listing-table",children:(0,y.jsxs)("tbody",{children:[(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:p.Z.I18n.t("statsSentEmail")}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:t.toLocaleString()})}),(0,y.jsx)("td",{})]}),(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:(0,y.jsx)(b.Z,{children:p.Z.I18n.t("statsOpened")})}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:n.toLocaleString()})}),(0,y.jsx)("td",{children:u&&(0,y.jsxs)(y.Fragment,{children:[i,"%"]})})]}),(0,y.jsxs)("tr",{children:[(0,y.jsxs)("td",{children:[(0,y.jsx)(b.Z,{children:p.Z.I18n.t("statsMachineOpened")}),(0,y.jsx)($e.Z,{tooltip:k()(p.Z.I18n.t("statsMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,y.jsx)("span",{style:{pointerEvents:"all"},children:(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/368-what-are-machine-opens",target:"_blank","data-beacon-article":"6124b7fb21ef206e5592e188",rel:"noopener noreferrer",children:e},"kb-link")},"machine-opened-info")))})]}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:r.toLocaleString()})}),(0,y.jsx)("td",{children:u&&(0,y.jsxs)(y.Fragment,{children:[o,"%"]})})]}),(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:(0,y.jsx)(b.Z,{isInverted:!0,children:p.Z.I18n.t("statsClicked")})}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:a.toLocaleString()})}),(0,y.jsx)("td",{children:u&&(0,y.jsxs)(y.Fragment,{children:[l,"%"]})})]}),(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:p.Z.I18n.t("statsNotClicked")}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:d.toLocaleString()})}),(0,y.jsx)("td",{children:u&&(0,y.jsxs)(y.Fragment,{children:[c,"%"]})})]}),(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:p.Z.I18n.t("statisticsColumn")}),(0,y.jsx)("td",{children:(0,y.jsx)("div",{className:"mailpoet-listing-stats",children:(0,y.jsx)(W,{id:s.id,engagementScore:s.engagement_score})})}),(0,y.jsx)("td",{})]})]})})})})}function Ve(e){let{revenueValue:t,count:n,averageRevenueValue:r}=e;return(0,y.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,y.jsx)("div",{className:"mailpoet-listing",children:(0,y.jsx)("table",{className:"mailpoet-listing-table",children:(0,y.jsxs)("tbody",{children:[(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:"Orders created"}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:n.toLocaleString()})})]}),(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:"Total revenue"}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:t})})]}),(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:"Average revenue"}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:r})})]})]})})})})}var We=n(11645),Ye=n.n(We),Be=n(58901);function He(e){let{limitReached:t,limitValue:n,subscribersCountTowardsLimit:r,premiumActive:a,hasValidApiKey:s,hasPremiumSupport:i}=e;return(0,y.jsxs)("table",{className:"mailpoet-listing-table","data-automation-id":"subscriber-stats-no-access",children:[(0,y.jsx)("thead",{children:(0,y.jsxs)("tr",{children:[(0,y.jsx)("th",{children:p.Z.I18n.t("email")}),(0,y.jsx)("th",{children:p.Z.I18n.t("columnAction")}),(0,y.jsx)("th",{children:p.Z.I18n.t("columnCount")}),(0,y.jsx)("th",{children:p.Z.I18n.t("columnActionOn")})]})}),(0,y.jsx)("tbody",{children:(0,y.jsx)("tr",{children:(0,y.jsx)("td",{colSpan:4,children:(0,y.jsx)("div",{className:"mailpoet-subscriber-stats-no-access-content",children:(0,y.jsx)(Be.Z,{title:a&&t?p.Z.I18n.t("upgradeRequired"):p.Z.I18n.t("premiumFeature"),message:(()=>{let e=p.Z.I18n.t("premiumRequired");return a?(e=i?p.Z.I18n.t("planLimitReached"):p.Z.I18n.t("freeLimitReached"),(0,y.jsx)("p",{children:k()(e,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?r:n))})):(0,y.jsx)("p",{children:k()(e,/\[link](.*?)\[\/link]/g,(e=>(0,y.jsx)("a",{href:p.Z.premiumLink,children:e},e)))})})(),actionButton:a&&t?(0,y.jsx)(v.Z,{href:s?p.Z.MailPoetComUrlFactory.getUpgradeUrl():p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(r+1),children:p.Z.I18n.t("premiumBannerCtaUpgrade")}):(0,y.jsx)(v.Z,{href:p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount,p.Z.currentWpUserEmail,null,{utm_medium:"stats",utm_campaign:"signup"}),children:p.Z.I18n.t("premiumBannerCtaFree")})})})})})})]})}function ze(e){let{params:t,location:n}=e;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:4,children:p.Z.I18n.t("openedEmailsHeading")}),!p.Z.premiumActive||p.Z.subscribersLimitReached?(0,y.jsx)(He,{limitReached:p.Z.subscribersLimitReached,limitValue:p.Z.subscribersLimit,subscribersCountTowardsLimit:p.Z.subscribersCount,premiumActive:p.Z.premiumActive,hasValidApiKey:p.Z.hasValidApiKey,hasPremiumSupport:p.Z.hasPremiumSupport}):Ye().applyFilters("mailpoet_subscribers_opened_emails_stats",t,n)]})}function Ke(){const e=(0,c.useRouteMatch)(),t=(0,c.useLocation)(),[n,r]=(0,j.useState)(null),[a,s]=(0,j.useState)(!0),i=(0,Fe.S)(window).notices.error;return(0,j.useEffect)((()=>{p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"subscriberStats",action:"get",data:{subscriber_id:e.params.id}}).done((e=>{r(e.data),s(!1)})).fail((e=>{s(!1),e.errors.length>0&&i((0,y.jsx)(y.Fragment,{children:e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message)))}),{scroll:!0})}))}),[e.params.id,i]),a?(0,y.jsx)(Le.Z,{}):(0,y.jsxs)("div",{className:"mailpoet-subscriber-stats",children:[(0,y.jsx)(qe,{email:n.email}),(0,y.jsxs)("p",{children:[p.Z.I18n.t("lastEngagement"),": ",n.last_engagement?p.Z.Date.format(n.last_engagement):p.Z.I18n.t("never")]}),(0,y.jsxs)("div",{className:"mailpoet-subscriber-stats-summary-grid",children:[(0,y.jsx)(Ue,{click:n.click,open:n.open,machineOpen:n.machine_open,totalSent:n.total_sent,subscriber:{id:Number(e.params.id),engagement_score:n.engagement_score}}),n.woocommerce&&(0,y.jsx)(Ve,{averageRevenueValue:n.woocommerce.formatted_average,count:n.woocommerce.count,revenueValue:n.woocommerce.formatted})]}),(0,y.jsx)(ze,{params:e.params,location:t})]})}var Ge=n(93726);function Qe(){return(0,y.jsx)(Fe.k.Provider,{value:(0,Fe.S)(window),children:(0,y.jsxs)(l.UT,{children:[(0,y.jsx)(Ge.Z,{}),(0,y.jsxs)(c.Switch,{children:[(0,y.jsx)(c.Route,{path:"/new",component:Me}),(0,y.jsx)(c.Route,{path:"/edit/:id",component:Me}),(0,y.jsx)(c.Route,{path:"/stats/:id/(.*)?",component:Ke}),(0,y.jsx)(c.Route,{path:"*",component:J})]})]})})}const Xe=document.getElementById("subscribers_container");Xe&&o().render((0,y.jsx)(Qe,{}),Xe);var Je=n(68345);class et extends j.PureComponent{render(){const e=this.props.event,t=e.soon;let n;if(this.props.premium)n=(0,y.jsx)("a",{href:"?page=mailpoet-premium",target:"_blank",children:p.Z.I18n.t("premiumFeatureLink")});else if(e.actionButtonLink&&e.actionButtonTitle)n=(0,y.jsx)("a",{href:e.actionButtonLink,target:"_blank",rel:"noopener noreferrer",children:e.actionButtonTitle});else{const r=t?null:I.ZP.partial(this.props.eventsConfigurator,e.slug);n=(0,y.jsx)(v.Z,{disabled:t,onClick:r,role:"presentation",automationId:`create_${e.slug}`,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),r())},children:e.actionButtonTitle||p.Z.I18n.t("setUp")})}return(0,y.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,y.jsx)("div",{className:"mailpoet-newsletter-type-image",children:e.badge&&(0,y.jsx)(Je.Z,{title:e.badge.text})}),(0,y.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,y.jsxs)(je.Z,{level:4,children:[e.title," ",e.soon&&`(${p.Z.I18n.t("soon")})`]}),(0,y.jsx)("p",{children:e.description}),(0,y.jsx)("div",{className:"mailpoet-flex-grow"}),(0,y.jsx)("div",{className:"mailpoet-newsletter-type-action",children:n})]})]})}}et.defaultProps={premium:!1},et.propTypes={premium:g().bool,eventsConfigurator:g().func.isRequired,event:g().shape({slug:g().string.isRequired,actionButtonLink:g().string,title:g().string.isRequired,soon:g().bool,badge:g().shape({style:g().string,text:g().string}),description:g().string.isRequired,actionButtonTitle:g().string}).isRequired};var tt=et;class nt extends j.Component{constructor(e){super(e),this.email=this.props.email,this.emailEvents=this.email.events,this.eventsConfigurator=this.eventsConfigurator.bind(this)}eventsConfigurator(e){p.Z.trackEvent("Emails > Automatic Type selected",{"Email type":e}),this.props.history.push(`/new/${this.email.slug}/${e}/conditions`)}render(){return I.ZP.map(this.emailEvents,((e,t)=>(0,y.jsx)(tt,{premium:this.email.premium,event:e,eventsConfigurator:this.eventsConfigurator},t)))}}nt.propTypes={email:g().shape({title:g().string.isRequired,slug:g().string.isRequired,premium:g().bool}).isRequired,history:g().shape({push:g().func.isRequired}).isRequired};var rt=(0,c.withRouter)(nt),at={woocommerce:(0,y.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 120 71",style:{enableBackground:"new 0 0 120 71"},children:[(0,y.jsx)("path",{fill:"#9ca6cc",d:"M11.4,0.7h97.1c6.1,0,11.1,4.9,11.1,11v36.7c0,6.1-5,11-11.1,11H73.7L78.5,71l-21-11.6h-46 c-6.1,0-11.1-4.9-11.1-11V11.7C0.3,5.7,5.3,0.7,11.4,0.7z"}),(0,y.jsx)("path",{fill:"#fff",d:"M7.2,10.7c0.7-0.9,1.7-1.4,3.1-1.5c2.5-0.2,3.9,1,4.2,3.5c1.5,10,3.2,18.5,4.9,25.5l10.6-20 c1-1.8,2.2-2.8,3.6-2.9c2.1-0.1,3.4,1.2,4,4c1.2,6.4,2.8,11.8,4.6,16.4c1.3-12.2,3.4-21,6.4-26.4c0.7-1.3,1.8-2,3.2-2.1 c1.1-0.1,2.1,0.2,3.1,1c0.9,0.7,1.4,1.6,1.5,2.7c0,0.9-0.1,1.6-0.5,2.3c-1.9,3.5-3.4,9.3-4.7,17.3c-1.2,7.8-1.6,13.9-1.4,18.3 c0.1,1.2-0.1,2.3-0.6,3.2c-0.6,1.1-1.5,1.6-2.6,1.7c-1.3,0.1-2.6-0.5-3.8-1.8c-4.5-4.6-8.1-11.4-10.7-20.5c-3.2,6.1-5.5,10.8-7,13.8 c-2.9,5.4-5.3,8.2-7.3,8.4c-1.3,0.1-2.4-1-3.4-3.3C11.9,44.1,9.3,32,6.4,14C6.2,12.7,6.5,11.6,7.2,10.7z M111.3,18.3 c-1.7-3-4.3-4.9-7.8-5.6c-0.9-0.2-1.8-0.3-2.6-0.3c-4.7,0-8.4,2.4-11.4,7.2c-2.5,4.1-3.8,8.6-3.8,13.5c0,3.7,0.8,6.9,2.3,9.5 c1.7,3,4.3,4.9,7.8,5.6c0.9,0.2,1.8,0.3,2.6,0.3c4.7,0,8.5-2.4,11.4-7.2c2.5-4.1,3.8-8.6,3.8-13.6C113.7,24,112.9,20.9,111.3,18.3z M105.2,31.6c-0.7,3.2-1.9,5.5-3.7,7.1c-1.4,1.2-2.7,1.8-3.9,1.5c-1.2-0.2-2.1-1.2-2.9-3.1c-0.6-1.5-0.9-3-0.9-4.4 c0-1.2,0.1-2.4,0.3-3.5c0.4-2,1.3-3.9,2.6-5.7c1.6-2.4,3.3-3.3,5-3c1.2,0.2,2.1,1.2,2.9,3.1c0.6,1.5,0.9,3,0.9,4.4 C105.6,29.3,105.5,30.5,105.2,31.6z M81,18.3c-1.7-3-4.4-4.9-7.8-5.6c-0.9-0.2-1.8-0.3-2.6-0.3c-4.7,0-8.4,2.4-11.4,7.2 c-2.5,4.1-3.8,8.6-3.8,13.5c0,3.7,0.8,6.9,2.3,9.5c1.7,3,4.3,4.9,7.8,5.6c0.9,0.2,1.8,0.3,2.6,0.3c4.7,0,8.5-2.4,11.4-7.2 c2.5-4.1,3.8-8.6,3.8-13.6C83.3,24,82.5,20.9,81,18.3z M74.8,31.6c-0.7,3.2-1.9,5.5-3.7,7.1c-1.4,1.2-2.7,1.8-3.9,1.5 c-1.2-0.2-2.1-1.2-2.9-3.1c-0.6-1.5-0.9-3-0.9-4.4c0-1.2,0.1-2.4,0.3-3.5c0.4-2,1.3-3.9,2.6-5.7c1.6-2.4,3.3-3.3,5-3 c1.2,0.2,2.1,1.2,2.9,3.1c0.6,1.5,0.9,3,0.9,4.4C75.2,29.3,75.1,30.5,74.8,31.6z"})]})},st=n(33687),it=function(e){let{errors:t}=e;return t.length<1?null:(0,y.jsx)(N.Z,{type:"error",closable:!1,children:t.map((e=>(0,y.jsx)("p",{children:e.message},e.message)))})},ot=n(62210);function lt(e){let{filter:t,history:n,hideClosingButton:r=!1,hideScreenOptions:a=!0}=e;const[s,i]=(0,j.useState)(!1),o=e=>{void 0!==e&&(n.push(`/new/${e}`),p.Z.trackEvent("Emails > Type selected",{"Email type":e}))},l=async()=>{p.Z.trackEvent("Emails > Type selected",{"Email type":"wc_transactional"});let e=window.mailpoet_woocommerce_transactional_email_id;if(!e)try{e=(await p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"settings",action:"set",data:{"woocommerce.use_mailpoet_editor":1}})).data.woocommerce.transactional_email_id,p.Z.trackEvent("Emails > WooCommerce email customizer enabled")}catch(e){return(0,ot.q)(e)&&e.errors.length>0?(0,y.jsx)(it,{errors:e.errors}):null}return window.location.href=`?page=mailpoet-newsletter-editor&id=${e}`,null},c=e=>{const t=!0===window.mailpoet_is_new_user?"mailpoet_badge mailpoet_badge_video":"mailpoet_badge mailpoet_badge_video mailpoet_badge_video_grey";return(0,y.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,y.jsx)("div",{className:"mailpoet-newsletter-type-image"}),(0,y.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,y.jsxs)(je.Z,{level:4,children:[e.title," ",e.beta?`(${p.Z.I18n.t("beta")})`:""]}),(0,y.jsx)("p",{children:e.description}),e.videoGuide&&(0,y.jsxs)("a",{className:t,href:e.videoGuide,"data-beacon-article":e.videoGuideBeacon,target:"_blank",rel:"noopener noreferrer",children:[(0,y.jsx)("span",{className:"dashicons dashicons-format-video"}),p.Z.I18n.t("seeVideoGuide")]}),(0,y.jsx)("div",{className:"mailpoet-flex-grow"}),(0,y.jsx)("div",{className:"mailpoet-newsletter-type-action",children:e.action})]})]},e.slug)},d=I.ZP.partial((e=>{i(!0),p.Z.trackEvent("Emails > Type selected",{"Email type":e}),p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"newsletters",action:"create",data:{type:e,subject:p.Z.I18n.t("draftNewsletterTitle")}}).done((e=>{n.push(`/template/${e.data.id}`)})).fail((e=>(i(!1),e.errors.length>0?(0,y.jsx)(it,{errors:e.errors}):null)))}),"standard"),u=I.ZP.partial(o,"notification"),m=I.ZP.partial(o,"welcome"),h=I.ZP.partial(o,"re-engagement"),f=[{slug:"standard",title:p.Z.I18n.t("regularNewsletterTypeTitle"),description:p.Z.I18n.t("regularNewsletterTypeDescription"),action:(0,y.jsx)(v.Z,{automationId:"create_standard",onClick:d,tabIndex:0,withSpinner:s,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),d())},children:p.Z.I18n.t("create")})},{slug:"welcome",title:p.Z.I18n.t("welcomeNewsletterTypeTitle"),description:p.Z.I18n.t("welcomeNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/254-video-guide-to-welcome-emails",videoGuideBeacon:"5b05ebf20428635ba8b2aa53",action:(0,y.jsx)(v.Z,{onClick:m,automationId:"create_welcome",withSpinner:s,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),m())},tabIndex:0,children:p.Z.I18n.t("setUp")})},{slug:"notification",title:p.Z.I18n.t("postNotificationNewsletterTypeTitle"),description:p.Z.I18n.t("postNotificationNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/210-video-guide-to-post-notifications",videoGuideBeacon:"59ba6fb3042863033a1cd5a5",action:(0,y.jsx)(v.Z,{automationId:"create_notification",onClick:u,withSpinner:s,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),u())},children:p.Z.I18n.t("setUp")})},{slug:"re_engagement",title:p.Z.I18n.t("tabReEngagementTitle"),description:p.Z.I18n.t("reEngagementDescription"),action:(0,y.jsx)(v.Z,{automationId:"create_notification",onClick:h,withSpinner:s,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),h())},children:p.Z.I18n.t("setUp")})}];let g=Ye().applyFilters("mailpoet_newsletters_types",[...f],this);t&&(g=g.filter(t));const b=p.Z.Ajax.constructGetUrl({api_version:p.Z.apiVersion,endpoint:"newsletterTemplates",action:"getAll"});return(0,y.jsxs)(y.Fragment,{children:[a&&(0,y.jsx)(De.Z,{}),(0,y.jsx)("link",{rel:"prefetch",href:window.mailpoet_editor_javascript_url,as:"script"}),(0,y.jsxs)("div",{className:"mailpoet-newsletter-types",children:[!r&&(0,y.jsx)("div",{className:"mailpoet-newsletter-types-close",children:(0,y.jsx)("button",{type:"button",onClick:()=>n.push("/"),className:"mailpoet-modal-close",children:st.Z})}),g.map((e=>c(e)),this),(()=>{if(!window.mailpoet_woocommerce_automatic_emails)return[];let e=window.mailpoet_woocommerce_automatic_emails;return t&&(e=I.ZP.filter(e,t)),I.ZP.map(e,(e=>{const r=e;return(0,y.jsxs)(j.Fragment,{children:[!t&&(0,y.jsxs)("div",{className:"mailpoet-newsletter-types-separator",children:[(0,y.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"}),(0,y.jsx)("div",{className:"mailpoet-newsletter-types-separator-logo",children:at[r.slug]||null}),(0,y.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"})]}),(0,y.jsx)(rt,{email:r,history:n}),"woocommerce"===r.slug&&(p.Z.isWoocommerceActive?[{slug:"wc_transactional",title:p.Z.I18n.t("wooCommerceCustomizerTypeTitle"),description:p.Z.I18n.t("wooCommerceCustomizerTypeDescription"),action:(0,y.jsx)(v.Z,{automationId:"customize_woocommerce",onClick:l,tabIndex:0,onKeyDown:async e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),await l())},children:p.Z.I18n.t("customize")})}]:[]).map((e=>c(e)),this)]},r.slug)}))})()]}),(0,y.jsx)("link",{rel:"prefetch",href:b,as:"fetch"})]})}lt.defaultProps={filter:null,hideScreenOptions:!0,hideClosingButton:!1};var ct=(0,c.withRouter)(lt),dt=n(21526),ut=(0,c.withRouter)((e=>(0,y.jsx)(dt.Z,{...e}))),pt=n(80416),mt=n(12912),ht=n(9185);class ft extends j.Component{constructor(e){super(e),this.onPreview=this.onPreview.bind(this),this.onDelete=this.onDelete.bind(this),this.onSelect=this.onSelect.bind(this)}onDelete(){const{id:e,name:t,beforeDelete:n,afterDelete:r}=this.props;(0,ht.Z)({message:p.Z.I18n.t("confirmTemplateDeletion").replace("%1$s",t),onConfirm:()=>{n(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"delete",data:{id:e}}).done((()=>{r(!0,e)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}})}onPreview(){p.Z.Modal.popup({title:this.props.name,template:'<img src="{{ thumbnail }}" />',data:this.props})}onSelect(){const{newsletterId:e,name:t,beforeSelect:n,afterSelect:r}=this.props;n(),p.Z.trackEvent("Emails > Template selected",{"Email name":t}),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:{id:e,template_id:this.props.id}}).done((e=>{r(!0,e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}render(){const{index:e,name:t,thumbnail:n,readonly:r}=this.props;let a="";return"string"==typeof n&&n.length>0&&(a=(0,y.jsxs)("a",{className:"mailpoet-template-preview",href:"#",onClick:e=>{e.preventDefault(),this.onPreview(e)},children:[(0,y.jsx)("div",{className:"mailpoet-template-thumbnail",children:n?(0,y.jsx)("img",{src:n,alt:p.Z.I18n.t("templatePreview"),loading:"lazy"}):""}),(0,y.jsx)("div",{className:"mailpoet-template-preview-overlay",children:(0,y.jsx)(v.Z,{children:p.Z.I18n.t("zoom")})})]})),(0,y.jsx)(mt.Z,{label:t,onSelect:this.onSelect,onDelete:!1===r?this.onDelete:void 0,automationId:`select_template_${e}`,className:"mailpoet-template-two-lines",children:a})}}ft.contextType=Fe.k,ft.propTypes={index:g().number.isRequired,id:g().number.isRequired,newsletterId:g().string.isRequired,name:g().string.isRequired,thumbnail:g().string,readonly:g().bool.isRequired,beforeDelete:g().func.isRequired,afterDelete:g().func.isRequired,beforeSelect:g().func.isRequired,afterSelect:g().func.isRequired},ft.defaultProps={thumbnail:null};var gt=ft;class vt extends j.Component{constructor(e){super(e),this.fileRef=(0,j.createRef)(),this.handleSubmit=this.handleSubmit.bind(this)}handleSubmit(e){if(e.preventDefault(),I.ZP.size(this.fileRef.current.files)<=0)return!1;const t=I.ZP.first(this.fileRef.current.files),n=new FileReader;return n.onload=e=>{try{this.saveTemplate(JSON.parse(e.target.result)),p.Z.trackEvent("Emails > Template imported")}catch(e){this.context.notices.error((0,y.jsx)("p",{children:p.Z.I18n.t("templateFileMalformedError")}))}},n.readAsText(t),!0}saveTemplate(e){const t=e,{beforeImport:n,afterImport:r}=this.props;I.ZP.isUndefined(t.body)||(t.body=JSON.stringify(t.body));try{t.categories=JSON.parse(t.categories)}catch(e){t.categories=[]}-1===t.categories.indexOf("saved")&&t.categories.push("saved"),-1===t.categories.indexOf("standard")&&-1===t.categories.indexOf("welcome")&&-1===t.categories.indexOf("notification")&&t.categories.push("standard"),t.categories=JSON.stringify(t.categories),n(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:t}).done((e=>{r(!0,e.data)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}render(){return(0,y.jsxs)("div",{className:"mailpoet-template-import",children:[(0,y.jsxs)("h4",{children:[p.Z.I18n.t("importTemplateTitle"),(0,y.jsx)(M(),{tooltip:p.Z.I18n.t("helpTooltipTemplateUpload"),place:"right",className:"tooltip-help-import-template"})]}),(0,y.jsxs)("form",{onSubmit:this.handleSubmit,children:[(0,y.jsx)("input",{type:"file",placeholder:p.Z.I18n.t("selectJsonFileToUpload"),ref:this.fileRef}),(0,y.jsx)("p",{className:"submit",children:(0,y.jsx)("input",{className:"button button-primary",type:"submit",value:p.Z.I18n.t("upload")})})]})]})}}vt.contextType=Fe.k,vt.propTypes={beforeImport:g().func.isRequired,afterImport:g().func.isRequired};var bt=vt;const yt=[];window.mailpoet_newsletters_templates_recently_sent_count&&yt.push({name:"recent",label:p.Z.I18n.t("recentlySent")}),yt.push({name:"standard",label:p.Z.I18n.t("tabStandardTitle")},{name:"welcome",label:p.Z.I18n.t("tabWelcomeTitle")},{name:"notification",label:p.Z.I18n.t("tabNotificationTitle")},{name:"re_engagement",label:p.Z.I18n.t("tabReEngagementTitle")},{name:"blank",label:p.Z.I18n.t("tabBlankTitle")}),window.mailpoet_woocommerce_active&&yt.push({name:"woocommerce",label:p.Z.I18n.t("tabWoocommerceTitle")}),yt.push({name:"saved",label:p.Z.I18n.t("savedTemplates")});class wt extends j.Component{constructor(e){super(e),this.state={loading:!0,templates:{},emailType:null,selectedTab:""},this.templates={},this.addTemplate=this.addTemplate.bind(this),this.afterTemplateDelete=this.afterTemplateDelete.bind(this),this.afterTemplateSelect=this.afterTemplateSelect.bind(this),this.afterTemplateImport=this.afterTemplateImport.bind(this)}componentDidMount(){p.Z.Ajax.get({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"getAll"}).done((e=>{0===e.data.length&&(e.data=[{name:p.Z.I18n.t("mailpoetGuideTemplateTitle"),categories:'["welcome", "notification", "standard", "woocommerce"]',readonly:!0}]),e.data.forEach(this.addTemplate),this.sortTemplates()})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})})).always((()=>{this.selectInitialTab()}))}addTemplate(e){const t=yt.map((e=>e.name));let n;-1===t.indexOf("woocommerce")&&t.push("woocommerce");try{n=JSON.parse(e.categories).filter((e=>-1!==t.indexOf(e)))}catch(e){n=[]}0===n.length&&n.push("saved"),n.forEach((t=>{void 0===this.templates[t]&&(this.templates[t]=[]),this.templates[t].unshift(e)}))}sortTemplates(){const e=["welcome","notification","standard"];Object.keys(this.templates).forEach((t=>{this.templates[t].sort(((n,r)=>{if(e.includes(t)){if(n.categories.includes('"blank"')&&!r.categories.includes('"blank"'))return-1;if(!n.categories.includes('"blank"')&&r.categories.includes('"blank"'))return 1}return n.id<r.id?1:-1}))}))}selectInitialTab(){let e,t="standard";p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:this.props.match.params.id}}).done((n=>{e=n.data.type,"automatic"===e&&(e=n.data.options.group||e),window.mailpoet_newsletters_templates_recently_sent_count?t="recent":I.ZP.findWhere(yt,{name:n.data.type})?t=n.data.type:"automatic"===n.data.type&&I.ZP.findWhere(yt,{name:n.data.options.group})&&(t=n.data.options.group)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})})).always((()=>{this.setState({templates:this.templates,emailType:e,selectedTab:t,loading:!1})}))}afterTemplateDelete(e,t){e&&Object.keys(this.templates).forEach((e=>{this.templates[e]=this.templates[e].filter((e=>e.id!==t))})),this.setState({templates:this.templates,loading:!1})}afterTemplateSelect(e,t){e?window.location=(e=>`admin.php?page=mailpoet-newsletter-editor&id=${e}`)(t):this.setState({loading:!1})}afterTemplateImport(e,t){e&&this.addTemplate(t),this.setState({templates:this.templates,selectedTab:e?"saved":"import",loading:!1})}render(){if(this.state.loading)return(0,y.jsx)(Le.Z,{});const e=yt.concat({name:"import",label:p.Z.I18n.t("tabImportTitle")}).map((e=>Object.assign(e,{automationId:`templates-${e.name.replace(/\s+/g,"-").toLowerCase()}`})));let t=null;if("import"===this.state.selectedTab)t=(0,y.jsx)(bt,{beforeImport:()=>this.setState({loading:!0}),afterImport:this.afterTemplateImport});else{let e=this.state.templates[this.state.selectedTab]||[];e=0===e.length?this.state.loading?null:(0,y.jsx)("p",{children:p.Z.I18n.t("noTemplates")}):e.map(((e,t)=>(0,y.jsx)(gt,{index:t,newsletterId:this.props.match.params.id,beforeDelete:()=>this.setState({loading:!0}),afterDelete:this.afterTemplateDelete,beforeSelect:()=>this.setState({loading:!0}),afterSelect:this.afterTemplateSelect,id:e.id,name:e.name,thumbnail:e.thumbnail,readonly:e.readonly},e.id))),t=e}return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(ut,{emailType:this.state.emailType,automationId:"email_template_selection_heading"}),(0,y.jsxs)("div",{className:"mailpoet-templates",children:[(0,y.jsx)(pt.Z,{categories:e,active:this.state.selectedTab,onSelect:e=>this.setState({selectedTab:e})}),t]})]})}}wt.contextType=Fe.k,wt.propTypes={match:g().shape({params:g().shape({id:g().string}).isRequired}).isRequired};var xt=wt,_t=n(11830),Zt=n(9198),jt=n.n(Zt),It=function(e){var t;let{dimension:n,isFullWidth:r,iconStart:a,iconEnd:s,...i}=e;return(0,y.jsxs)("div",{className:h()("mailpoet-datepicker mailpoet-form-input",{[`mailpoet-form-input-${n}`]:n,"mailpoet-disabled":i.disabled,"mailpoet-full-width":r}),children:[a,(0,y.jsx)(jt(),{useWeekdaysShort:!0,calendarStartDay:null!==(t=i.calendarStartDay)&&void 0!==t?t:p.Z.wpWeekStartsOn,...i}),s]})},St=n(4958),Ct=n(16245),Tt=n.n(Ct);const kt={abbreviated:[p.Z.I18n.t("januaryShort"),p.Z.I18n.t("februaryShort"),p.Z.I18n.t("marchShort"),p.Z.I18n.t("aprilShort"),p.Z.I18n.t("mayShort"),p.Z.I18n.t("juneShort"),p.Z.I18n.t("julyShort"),p.Z.I18n.t("augustShort"),p.Z.I18n.t("septemberShort"),p.Z.I18n.t("octoberShort"),p.Z.I18n.t("novemberShort"),p.Z.I18n.t("decemberShort")],wide:[p.Z.I18n.t("january"),p.Z.I18n.t("february"),p.Z.I18n.t("march"),p.Z.I18n.t("april"),p.Z.I18n.t("may"),p.Z.I18n.t("june"),p.Z.I18n.t("july"),p.Z.I18n.t("august"),p.Z.I18n.t("september"),p.Z.I18n.t("october"),p.Z.I18n.t("november"),p.Z.I18n.t("december")]},Nt={narrow:[p.Z.I18n.t("sundayMin"),p.Z.I18n.t("mondayMin"),p.Z.I18n.t("tuesdayMin"),p.Z.I18n.t("wednesdayMin"),p.Z.I18n.t("thursdayMin"),p.Z.I18n.t("fridayMin"),p.Z.I18n.t("saturdayMin")],abbreviated:[p.Z.I18n.t("sundayShort"),p.Z.I18n.t("mondayShort"),p.Z.I18n.t("tuesdayShort"),p.Z.I18n.t("wednesdayShort"),p.Z.I18n.t("thursdayShort"),p.Z.I18n.t("fridayShort"),p.Z.I18n.t("saturdayShort")],wide:[p.Z.I18n.t("sunday"),p.Z.I18n.t("monday"),p.Z.I18n.t("tuesday"),p.Z.I18n.t("wednesday"),p.Z.I18n.t("thursday"),p.Z.I18n.t("friday"),p.Z.I18n.t("saturday")]};St.Z.localize.month=Tt()({values:kt,defaultWidth:"wide"}),St.Z.localize.day=Tt()({values:Nt,defaultWidth:"wide"}),St.Z.options.weekStartsOn=void 0!==p.Z.wpWeekStartsOn?p.Z.wpWeekStartsOn:1,(0,Zt.registerLocale)("mailpoet",St.Z);class Dt extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"onChange",((e,t)=>{const n=t,r=this.getStorageDate(e);n.target.name=this.getFieldName(),n.target.value=r,this.props.onChange(n)})),(0,Z.Z)(this,"getFieldName",(()=>this.props.name||"date")),(0,Z.Z)(this,"getDisplayDateFormat",(e=>p.Z.Date.convertFormat(e).replace(/D/g,"d").replace(/Y/g,"y").replace(/\[/g,"").replace(/\]/g,""))),(0,Z.Z)(this,"getDate",(e=>{const t={parseFormat:this.props.storageFormat};return p.Z.Date.toDate(e,t)})),(0,Z.Z)(this,"getStorageDate",(e=>{const t={format:this.props.storageFormat};return p.Z.Date.format(e,t)}))}render(){return(0,y.jsx)(It,{name:this.getFieldName(),selected:this.getDate(this.props.value),dateFormat:this.getDisplayDateFormat(this.props.displayFormat),disabled:this.props.disabled,onChange:this.onChange,minDate:this.getDate(window.mailpoet_current_date),maxDate:this.props.maxDate,locale:"mailpoet",...this.props.validation})}}Dt.propTypes={displayFormat:g().string.isRequired,onChange:g().func.isRequired,name:g().string,storageFormat:g().string.isRequired,value:g().string.isRequired,disabled:g().bool.isRequired,validation:g().shape({"data-parsley-required":g().bool,"data-parsley-required-message":g().string,"data-parsley-type":g().string,"data-parsley-errors-container":g().string,maxLength:g().number}).isRequired,maxDate:g().instanceOf(Date)},Dt.defaultProps={name:"date",maxDate:null};var Et=Dt;class Ot extends j.Component{render(){const e=Object.keys(this.props.timeOfDayItems).map((e=>(0,y.jsx)("option",{value:e,children:this.props.timeOfDayItems[e]},`option-${this.props.timeOfDayItems[e]}`)));return(0,y.jsx)(de.Z,{name:this.props.name||"time",value:this.props.value,disabled:this.props.disabled,onChange:this.props.onChange,isMinWidth:!0,...this.props.validation,children:e})}}Ot.propTypes={timeOfDayItems:g().objectOf(g().string).isRequired,name:g().string,value:g().string.isRequired,disabled:g().bool,onChange:g().func.isRequired,validation:g().object},Ot.defaultProps={name:"time",disabled:!1,validation:{}};var Rt=Ot;class At extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"DATE_TIME_SEPARATOR"," "),(0,Z.Z)(this,"getDateTime",(()=>[this.state.date,this.state.time].join(this.DATE_TIME_SEPARATOR))),(0,Z.Z)(this,"buildStateFromProps",(e=>{const t=e.value||this.props.defaultDateTime,[n,r]=t.split(this.DATE_TIME_SEPARATOR);return{date:n,time:r}})),(0,Z.Z)(this,"handleChange",(e=>{const t={};t[e.target.name]=e.target.value,this.setState(t,this.propagateChange)})),(0,Z.Z)(this,"propagateChange",(()=>{this.props.onChange&&this.props.onChange({target:{name:this.props.name||"",value:this.getDateTime()}})})),this.state=this.buildStateFromProps(e)}componentDidUpdate(e){this.props.value===e.value&&this.props.defaultDateTime===e.defaultDateTime||re()((()=>{this.setState(this.buildStateFromProps(this.props))}))}render(){return(0,y.jsxs)(_t.r.Column,{className:"mailpoet-datetime-container",children:[(0,y.jsx)(Et,{name:"date",value:this.state.date,onChange:this.handleChange,displayFormat:this.props.dateDisplayFormat,storageFormat:this.props.dateStorageFormat,disabled:this.props.disabled,validation:this.props.dateValidation,maxDate:this.props.maxDate}),(0,y.jsx)(Rt,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems})]})}}At.propTypes={value:g().string,defaultDateTime:g().string.isRequired,dateDisplayFormat:g().string.isRequired,dateStorageFormat:g().string.isRequired,onChange:g().func,name:g().string,disabled:g().bool,dateValidation:g().object.isRequired,timeValidation:g().any,timeOfDayItems:g().objectOf(g().string).isRequired,maxDate:g().instanceOf(Date)},At.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0,value:void 0,maxDate:null};var Pt=At,Mt=n(43246);class Lt extends j.Component{constructor(e){super(e),this.state={emailAddress:e.item.sender_address},this.onChange=this.onChange.bind(this)}onChange(e){this.setState({emailAddress:e.target.value.toLowerCase()}),this.props.onValueChange({...e,target:{...e.target,name:e.target.name,value:e.target.value.toLowerCase()}})}render(){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(ie,{item:{...this.props.item,sender_address:this.state.emailAddress},field:this.props.field,onValueChange:this.onChange}),(0,y.jsx)("div",{className:"regular-text",children:(0,y.jsx)(Mt.Z,{emailAddress:this.state.emailAddress,mssActive:window.mailpoet_mss_active})})]})}}Lt.propTypes={field:g().object.isRequired,item:g().shape({sender_address:g().string.isRequired}).isRequired,onValueChange:g().func},Lt.defaultProps={onValueChange:function(){}};var Ft=Lt;const qt=I.ZP.once((()=>p.Z.trackEvent("User has typed a GA campaign name"))),$t=k()(p.Z.I18n.t("gaCampaignTip"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,y.jsxs)("span",{children:[(0,y.jsx)("br",{}),(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/187-track-your-newsletters-subscribers-in-google-analytics","data-beacon-article":"58b597d12c7d3a576d359144",target:"_blank",rel:"noopener noreferrer",className:"mailpoet-link",children:e})]},t)));var Ut={name:"ga_campaign",label:p.Z.I18n.t("gaCampaignLine"),tip:$t,type:"text",onBeforeChange:qt},Vt=function(e){let{dimension:t,onCheck:n,automationId:r,className:a,...s}=e;return(0,y.jsxs)("label",{className:h()({[a]:a,"mailpoet-form-toggle":!0,[`mailpoet-form-toggle-${t}`]:t,"mailpoet-disabled":s.disabled}),"data-automation-id":r,children:[(0,y.jsx)("input",{type:"checkbox",onChange:e=>n(e.target.checked,e),...s}),(0,y.jsx)("span",{className:"mailpoet-form-toggle-control"})]})};let Wt,Yt;!function(e){e.Standard="standard",e.Automatic="automatic",e.Welcome="welcome",e.Notification="notification",e.NotificationHistory="notification_history",e.WCTransactional="wc_transactional",e.ReEngagement="re_engagement"}(Wt||(Wt={})),function(e){e.Draft="draft",e.Scheduled="scheduled",e.Sending="sending",e.Sent="sent",e.Active="active"}(Yt||(Yt={}));const Bt=window.mailpoet_current_time||"00:00",Ht=`${window.mailpoet_tomorrow_date} 08:00:00`,zt=window.mailpoet_schedule_time_of_day,Kt=window.mailpoet_date_display_format,Gt=window.mailpoet_date_storage_format;class Qt extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"getCurrentValue",(()=>{var e;return{isScheduled:"0",scheduledAt:Ht,...null!==(e=this.props.item?.[this.props.field.name])&&void 0!==e?e:{}}})),(0,Z.Z)(this,"getDateValidation",(()=>({"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("noScheduledDateError"),"data-parsley-errors-container":"#mailpoet_scheduling"}))),(0,Z.Z)(this,"isScheduled",(()=>"1"===this.getCurrentValue().isScheduled)),(0,Z.Z)(this,"handleCheckboxChange",((e,t)=>{const n={...t};n.target.value=t.target.checked?"1":"0",this.handleValueChange(n)})),(0,Z.Z)(this,"handleValueChange",(e=>{const t=this.getCurrentValue(),n={};n[e.target.name]=e.target.value,this.props.onValueChange({target:{name:this.props.field.name,value:{...t,...n}}})}))}render(){let e;const t=new Date;return t.setFullYear(t.getFullYear()+5),this.isScheduled()&&(e=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("span",{className:"mailpoet-form-schedule-time",children:[p.Z.I18n.t("websiteTimeIs")," ",Bt]}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("div",{id:"mailpoet_scheduling",children:(0,y.jsx)(Pt,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:Ht,timeOfDayItems:zt,dateDisplayFormat:Kt,dateStorageFormat:Gt,maxDate:t})})]})),(0,y.jsxs)("div",{children:[(0,y.jsx)(Vt,{checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onCheck:this.handleCheckboxChange,automationId:"email-schedule-checkbox"}),e]})}}let Xt=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:p.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:p.Z.I18n.t("subjectLine"),tooltip:p.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:p.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:p.Z.I18n.t("preheaderLine"),tooltip:`${p.Z.I18n.t("preheaderLineTip1")} ${p.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"segments",label:p.Z.I18n.t("segments"),tip:p.Z.I18n.t("segmentsTip"),type:"selection",placeholder:p.Z.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems()||[];return e.map((e=>t.find((t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("noSegmentsSelectedError")}},{name:"options",label:p.Z.I18n.t("scheduleIt"),type:"reactComponent",component:Qt},{name:"sender",label:p.Z.I18n.t("sender"),tip:p.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:p.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:p.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Ut,{name:"reply-to",label:p.Z.I18n.t("replyTo"),tip:p.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:p.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:p.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Xt=Ye().applyFilters("mailpoet_newsletters_3rd_step_fields",Xt);var Jt={getFields:()=>Xt,getSendButtonOptions:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=te()(window.mailpoet_current_date_time),n="object"==typeof e.options&&"1"===e.options?.isScheduled&&p.Z.Date.isInFuture(e.options?.scheduledAt,t),r={value:n?p.Z.I18n.t("schedule"):p.Z.I18n.t("send")};return e.status!==Yt.Sent&&e.status!==Yt.Sending||(r.disabled="disabled"),r}};const en=window.mailpoet_time_format||"H:i",tn={immediate:p.Z.I18n.t("delayImmediately"),hours:p.Z.I18n.t("delayHoursAfter"),days:p.Z.I18n.t("delayDaysAfter"),weeks:p.Z.I18n.t("delayWeeksAfter")},nn={daily:p.Z.I18n.t("daily"),weekly:p.Z.I18n.t("weekly"),monthly:p.Z.I18n.t("monthly"),nthWeekDay:p.Z.I18n.t("monthlyEvery"),immediately:p.Z.I18n.t("immediately")},rn=I.ZP.object(I.ZP.map(I.ZP.times(24,(e=>3600*e)),(e=>{const t=new Date(null);return t.setSeconds(e),[e,p.Z.Date.format(t,{format:en,offset:0})]}))),an={0:p.Z.I18n.t("sunday"),1:p.Z.I18n.t("monday"),2:p.Z.I18n.t("tuesday"),3:p.Z.I18n.t("wednesday"),4:p.Z.I18n.t("thursday"),5:p.Z.I18n.t("friday"),6:p.Z.I18n.t("saturday")},sn=I.ZP.object(I.ZP.map(I.ZP.times(28,(e=>e)),(e=>{const t={0:p.Z.I18n.t("first"),1:p.Z.I18n.t("second"),2:p.Z.I18n.t("third")};let n;return n=void 0!==t[e]?t[e]:p.Z.I18n.t("nth").replace("%1$d",e+1),[e+1,n]}))),on={1:p.Z.I18n.t("first"),2:p.Z.I18n.t("second"),3:p.Z.I18n.t("third"),L:p.Z.I18n.t("last")},ln={name:"intervalType",values:nn},cn={name:"timeOfDay",values:rn},dn={name:"weekDay",values:an},un={name:"monthDay",values:sn},pn={name:"nthWeekDay",values:on};class mn extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,Z.Z)(this,"handleValueChanges",(e=>{const t=this.getCurrentValue();return this.props.onValueChange({target:{name:this.props.field.name,value:I.ZP.extend({},t,e)}})})),(0,Z.Z)(this,"handleIntervalChange",(e=>{const t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),this.handleValueChanges(n)})),(0,Z.Z)(this,"handleTimeOfDayChange",(e=>this.handleValueChanges({timeOfDay:e.target.value}))),(0,Z.Z)(this,"handleWeekDayChange",(e=>this.handleValueChanges({weekDay:e.target.value}))),(0,Z.Z)(this,"handleMonthDayChange",(e=>this.handleValueChanges({monthDay:e.target.value}))),(0,Z.Z)(this,"handleNthWeekDayChange",(e=>this.handleValueChanges({nthWeekDay:e.target.value})))}render(){const e=this.getCurrentValue();let t,n,r,a;return"immediately"!==e.intervalType&&(t=(0,y.jsx)(pe,{field:cn,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==e.intervalType&&"nthWeekDay"!==e.intervalType||(n=(0,y.jsx)(pe,{field:dn,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===e.intervalType&&(r=(0,y.jsx)(pe,{field:un,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===e.intervalType&&(a=(0,y.jsx)(pe,{field:pn,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),(0,y.jsxs)("div",{children:[(0,y.jsx)(pe,{field:ln,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[a,r,n,t]}),"immediately"!==e.intervalType&&(0,y.jsx)("div",{className:"mailpoet-gap"})]})}}mn.propTypes={item:g().object.isRequired,field:g().shape({name:g().string}).isRequired,onValueChange:g().func.isRequired};var hn=mn;let fn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:p.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:p.Z.I18n.t("subjectLine"),tooltip:p.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:p.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:p.Z.I18n.t("preheaderLine"),tooltip:`${p.Z.I18n.t("preheaderLineTip1")} ${p.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:p.Z.I18n.t("selectFrequency"),type:"reactComponent",component:hn},{name:"segments",label:p.Z.I18n.t("segments"),tip:p.Z.I18n.t("segmentsTip"),type:"selection",placeholder:p.Z.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return I.ZP.map(e,(e=>I.ZP.find(t,(t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:p.Z.I18n.t("sender"),tip:p.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:p.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:p.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Ut,{name:"reply-to",label:p.Z.I18n.t("replyTo"),tip:p.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:p.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:p.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];fn=Ye().applyFilters("mailpoet_newsletters_3rd_step_fields",fn);var gn={getFields:function(){return fn},getSendButtonOptions:function(){return{value:p.Z.I18n.t("activate")}}};const vn=window.mailpoet_roles||{},bn=I.ZP.filter(window.mailpoet_segments||[],(e=>"default"===e.type)),yn={name:"event",values:{segment:p.Z.I18n.t("onSubscriptionToList"),user:p.Z.I18n.t("onWPUserRegistration")}},wn={name:"segment",placeholder:p.Z.I18n.t("selectSegmentPlaceholder"),forceSelect2:!0,values:bn,getCount:e=>parseInt(e.subscribers,10).toLocaleString(),getLabel:e=>e.name,getValue:e=>e.id},xn={name:"role",values:vn},_n={name:"afterTimeNumber",size:3,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":p.Z.I18n.t("emailCanBeScheduledUpToFiveYears")}},Zn={name:"afterTimeType",values:tn};class jn extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,Z.Z)(this,"handleValueChange",((e,t)=>{const n=this.getCurrentValue(),r={};let a=t;return"afterTimeNumber"===e&&(a=parseInt(t,10),a=Number.isNaN(a)?"":a),r[e]=a,this.props.onValueChange({target:{name:this.props.field.name,value:I.ZP.extend({},n,r)}})})),(0,Z.Z)(this,"handleEventChange",(e=>this.handleValueChange("event",e.target.value))),(0,Z.Z)(this,"handleSegmentChange",(e=>this.handleValueChange("segment",e.target.value))),(0,Z.Z)(this,"handleRoleChange",(e=>this.handleValueChange("role",e.target.value))),(0,Z.Z)(this,"handleAfterTimeNumberChange",(e=>this.handleValueChange("afterTimeNumber",e.target.value))),(0,Z.Z)(this,"handleAfterTimeTypeChange",(e=>this.handleValueChange("afterTimeType",e.target.value)))}render(){const e=this.getCurrentValue();let t,n;return t="user"===e.event?(0,y.jsx)(pe,{field:xn,item:this.getCurrentValue(),onValueChange:this.handleRoleChange}):(0,y.jsx)(C,{field:wn,item:this.getCurrentValue(),onValueChange:this.handleSegmentChange}),"immediate"!==e.afterTimeType&&(n=(0,y.jsx)(ie,{field:_n,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeNumberChange})),(0,y.jsxs)("div",{children:[(0,y.jsx)(pe,{field:yn,item:this.getCurrentValue(),onValueChange:this.handleEventChange}),(0,y.jsx)("div",{className:"mailpoet-gap"}),t,(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[n,(0,y.jsx)(pe,{field:Zn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeTypeChange})]}),(0,y.jsx)("div",{className:"mailpoet-form-errors"}),(0,y.jsx)("div",{className:"mailpoet-gap"})]})}}jn.propTypes={history:g().shape({push:g().func.isRequired}).isRequired,item:g().object.isRequired,field:g().shape({name:g().string}).isRequired,onValueChange:g().func.isRequired};var In=(0,c.withRouter)(jn);let Sn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:p.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:p.Z.I18n.t("subjectLine"),tooltip:p.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:p.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:p.Z.I18n.t("preheaderLine"),tooltip:`${p.Z.I18n.t("preheaderLineTip1")} ${p.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:p.Z.I18n.t("selectEventToSendWelcomeEmail"),type:"reactComponent",component:In},Ut,{name:"sender",label:p.Z.I18n.t("sender"),tip:p.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:p.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:p.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:p.Z.I18n.t("replyTo"),tip:p.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:p.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:p.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Sn=Ye().applyFilters("mailpoet_newsletters_3rd_step_fields",Sn);var Cn={getFields:function(){return Sn},getSendButtonOptions:function(){return{value:p.Z.I18n.t("activate")}}};class Tn extends j.Component{constructor(e){super(e);const{item:t,event:n}=this.props;this.handleChange=this.handleChange.bind(this);const r=t.afterTimeType||n.defaultAfterTimeType||"immediate",a="minutes"===r?30:1,s=t.afterTimeNumber||a;this.state={afterTimeType:r,afterTimeNumber:s},t.afterTimeNumber===s&&t.afterTimeType===r||this.propagateChange(this.state)}handleChange(e,t){let{value:n}=e.target;"afterTimeNumber"===t&&(n=parseInt(e.target.value,10),n=Number.isNaN(n)?null:n);const r={[t]:n},{afterTimeType:a}=this.state;"afterTimeType"===t&&a!==n&&("minutes"===a&&(r.afterTimeNumber=1),"minutes"===n&&(r.afterTimeNumber=30)),this.setState(r,this.propagateChange(r))}displayAfterTimeTypeOptions(){const{event:e}=this.props;let t=tn;e.timeDelayValues&&(t=Object.entries(e.timeDelayValues).reduce(((e,t)=>{let[n,r]=t;return e[n]=r.text,e}),{}));const{afterTimeType:n}=this.state,r={field:{id:"scheduling_time_interval",name:"scheduling_time_interval",forceSelect2:!0,values:I.ZP.map(t,((e,t)=>({name:e,id:t}))),extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>n},onValueChange:I.ZP.partial(this.handleChange,I.ZP,"afterTimeType")};return(0,y.jsx)(C,{field:r.field,onValueChange:r.onValueChange})}displayAfterTimeNumberField(){const{afterTimeNumberSize:e,event:t}=this.props,{afterTimeType:n,afterTimeNumber:r}=this.state;if("immediate"===n)return null;if(t.timeDelayValues&&t.timeDelayValues[n]&&!t.timeDelayValues[n].displayAfterTimeNumberField)return null;const a={field:{id:"scheduling_time_duration",name:"scheduling_time_duration",defaultValue:r?r.toString():"",size:e,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":p.Z.I18n.t("emailCanBeScheduledUpToFiveYears")}},item:{},onValueChange:I.ZP.partial(this.handleChange,I.ZP,"afterTimeNumber")};return(0,y.jsx)(ie,{field:a.field,item:a.item,onValueChange:a.onValueChange})}propagateChange(e){const{onValueChange:t}=this.props;t&&t(e)}render(){const{event:e}=this.props;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[this.displayAfterTimeNumberField(),this.displayAfterTimeTypeOptions()]}),(0,y.jsx)("div",{className:"mailpoet-form-errors"}),(0,y.jsx)("div",{className:"mailpoet-gap"}),e.schedulingReadMoreLink&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("a",{href:e.schedulingReadMoreLink.link,target:"_blank",rel:"noopener noreferrer",className:"event-scheduling-read-more-link",children:e.schedulingReadMoreLink.text}),(0,y.jsx)("div",{className:"mailpoet-gap"})]})]})}}Tn.propTypes={item:g().shape({afterTimeType:g().string.isRequired,afterTimeNumber:g().number}).isRequired,afterTimeNumberSize:g().number,onValueChange:g().func,event:g().shape({defaultAfterTimeType:g().string,timeDelayValues:g().objectOf(g().shape({text:g().string,displayAfterTimeNumberField:g().bool})),schedulingReadMoreLink:g().shape({link:g().string.isRequired,text:g().string.isRequired})}).isRequired},Tn.defaultProps={afterTimeNumberSize:3,onValueChange:null};var kn=Tn;function Nn(e){const t=e&&e.values?e.values:[];return t?t.map((e=>({id:e.id,name:e.name}))):t}var Dn=function(e){let{eventOptions:t,eventSlug:n,selected:r,onValueChange:a}=e;function s(e){a&&a({eventOptionValue:e.target.value})}return(0,y.jsx)("div",{children:(0,y.jsx)("div",{className:"event-option-selection",children:function(){if(!t)return t;const e={field:{name:`event_options_${n}`,forceSelect2:!0,endpoint:t.endpoint,resetSelect2OnUpdate:!0,values:Nn(t),multiple:t.multiple||!1,placeholder:t.placeholder||!1,transformChangedValue:(e,t)=>I.ZP.map(t,(e=>({id:e.id,name:e.text}))),selected:()=>r,getLabel:I.ZP.property("name"),getValue:I.ZP.property("id"),validation:{"data-parsley-required":!0}},onValueChange:s,item:{action:""}};return"product_categories"===t.endpoint&&(e.field.name="category_ids",e.item={action:"purchasedCategory"}),"products"===t.endpoint&&(e.field.name="product_ids",e.item={action:"purchasedProduct"}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(C,{field:e.field,onValueChange:e.onValueChange,item:e.item}),(0,y.jsx)("div",{className:"mailpoet-gap"})]})}()})})};class En extends j.Component{constructor(e){super(e);const{field:t}=e;this.handleChange=this.handleChange.bind(this),this.email=t.email,this.emailOptions=t.emailOptions,this.events=I.ZP.indexBy(this.email.events,"slug"),this.segments=I.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const n=this.events[this.emailOptions.event],r=this.emailOptions.afterTimeType||n.defaultAfterTimeType||"immediate";this.state={event:n,afterTimeType:r,eventSlug:this.emailOptions.event,eventOptionValue:null,afterTimeNumber:this.emailOptions.afterTimeNumber||1,segment:this.emailOptions.segment?this.emailOptions.segment:null}}handleChange(e){const{afterTimeNumber:t}=this.state,n=e;n.afterTimeType&&"immediate"===n.afterTimeType?n.afterTimeNumber=null:!n.afterTimeType||n.afterTimeNumber||t||(n.afterTimeNumber=1),this.setState(e,this.propagateChange)}displayScheduling(){const{afterTimeNumber:e,afterTimeType:t,event:n}=this.state,r={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return(0,y.jsx)(kn,{item:r.item,event:r.event,onValueChange:r.onValueChange})}displaySegments(){const{segment:e}=this.state;if("user"===this.emailOptions.sendTo)return null;const t={field:{id:"segments",forceSelect2:!0,values:this.segments,extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>e},onValueChange:e=>this.handleChange({segment:e.target.value})};return(0,y.jsx)("div",{className:"event-segment-selection",children:(0,y.jsx)(C,{field:t.field,onValueChange:t.onValueChange})})}displayEventOptions(){const{event:e,eventSlug:t}=this.state;let n;try{n=JSON.parse(this.emailOptions.meta||null)}catch(e){n=this.emailOptions.meta||null}const r={emailSlug:this.email.slug,eventSlug:t,onValueChange:this.handleChange,eventOptions:e.options||null};return n&&n.option&&("remote"===r.eventOptions.type&&(r.eventOptions.values=n.option),r.selected=I.ZP.map(n.option,(e=>e.id))),(0,y.jsx)(Dn,{emailSlug:r.emailSlug,eventSlug:r.eventSlug,eventOptions:r.eventOptions,onValueChange:r.onValueChange,selected:r.selected})}displayHeader(){const{event:e}=this.state;return e.title}propagateChange(){const{eventSlug:e,afterTimeType:t,afterTimeNumber:n,segment:r,eventOptionValue:a}=this.state,{onValueChange:s}=this.props;if(!s)return;const i={group:this.email.slug,event:e,afterTimeType:t};n&&(i.afterTimeNumber=n),r&&(i.segment=r),a&&(i.meta=JSON.stringify({option:this.state.eventOptionValue})),s({target:{name:"options",value:i}})}render(){return(0,y.jsxs)("div",{children:[(0,y.jsx)(je.Z,{level:5,children:this.displayHeader()}),this.displayEventOptions(),this.displaySegments(),this.displayScheduling()]})}}En.propTypes={field:g().shape({email:g().shape({events:g().object.isRequired}).isRequired,emailOptions:g().object.isRequired}).isRequired,onValueChange:g().func},En.defaultProps={onValueChange:null};var On=En;const Rn=window.mailpoet_woocommerce_automatic_emails||[];var An={getFields:function(e){return(e=>{const t=Rn[e.options.group];if(!t)return!1;const n=e.options;return[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:p.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:p.Z.I18n.t("subjectLine"),tooltip:p.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:p.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:p.Z.I18n.t("preheaderLine"),tooltip:`${p.Z.I18n.t("preheaderLineTip1")} ${p.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:p.Z.I18n.t("sendAutomaticEmailWhenHeading").replace("%1s",t.title),type:"reactComponent",component:On,email:t,emailOptions:n},Ut,{name:"sender",label:p.Z.I18n.t("sender"),tip:p.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:p.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"text",placeholder:p.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:p.Z.I18n.t("replyTo"),tip:p.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:p.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:p.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}]})(e)},getSendButtonOptions:function(){return{value:p.Z.I18n.t("activate")}}},Pn=n(78230),Mn=n(68041);function Ln(e){let{afterTimeNumber:t,afterTimeType:n,updateAfterTimeNumber:r,updateAfterTimeType:a,inactiveSubscribersPeriod:s}=e;const i="weeks"===n?7:30,o=Number(t)*i;let l=s;return 365===s&&(l=360),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:4,children:p.Z.I18n.t("selectEventToSendReEngagementEmail")}),(0,y.jsxs)(_t.r.CenteredRow,{className:"mailpoet-re-engagement-scheduling",children:[(0,y.jsx)("p",{children:p.Z.I18n.t("reEngagementTextPre")}),(0,y.jsx)(ae.Z,{type:"text",placeholder:p.Z.I18n.t("reEngagementAterTimeNumberPlaceholder"),value:t,onChange:(0,Mn.z2)(r)}),(0,y.jsxs)(de.Z,{value:n,onChange:(0,Mn.z2)(a),children:[(0,y.jsx)("option",{value:"weeks",children:"weeks"}),(0,y.jsx)("option",{value:"months",children:"months"})]})]}),!!s&&l<=o&&(0,y.jsx)("p",{className:"mailpoet-re-engagement-scheduling-note",children:k()(p.Z.I18n.t("reEngagementEmailWarning").replace("{$months}",`${Math.floor(s/30)}`),/\[link\](.*?)\[\/link\]/g,(e=>(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/264-inactive-subscribers",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"5cbf19622c7d3a026fd3efe1",children:e},"link")))})]})}const Fn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:p.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:p.Z.I18n.t("subjectLine"),tooltip:p.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:p.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:p.Z.I18n.t("preheaderLine"),tooltip:`${p.Z.I18n.t("preheaderLineTip1")} ${p.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",type:"reactComponent",component:function(e){return(0,y.jsx)(Ln,{afterTimeNumber:e.item.options.afterTimeNumber.toString(),afterTimeType:e.item.options.afterTimeType,inactiveSubscribersPeriod:Number(p.Z.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:t=>{e.onValueChange({target:{name:"options",value:(0,Pn.assoc)("afterTimeNumber",t,e.item.options)}})},updateAfterTimeType:t=>{e.onValueChange({target:{name:"options",value:(0,Pn.assoc)("afterTimeType",t,e.item.options)}})}})}},{name:"segments",label:p.Z.I18n.t("segments"),tip:p.Z.I18n.t("segmentsTip"),type:"selection",placeholder:p.Z.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:p.Z.apiVersion,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at&&"dynamic"!==e.type},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return(0,Pn.map)((e=>(0,Pn.find)((t=>t.id===e),t)),e)},validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:p.Z.I18n.t("sender"),tip:p.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:p.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:p.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:p.Z.I18n.t("replyTo"),tip:p.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:p.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:p.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]},Ut],qn={getFields:()=>Fn,getSendButtonOptions:()=>({value:p.Z.I18n.t("activate")})};var $n=n(7358),Un=n(31304),Vn=n.n(Un);const Wn=window.mailpoet_woocommerce_automatic_emails||[],Yn=(e,t)=>`${Vn()(t,{lower:!0}).replace(/[^a-z0-9]+/g,"-").replace(/-$/,"")||"newsletter"}_${e}`;function Bn(e){let t,n;return e&&e.body&&e.body.content&&(n=e.body.content,t=JSON.stringify(e.body.content),!n.blocks||!Array.isArray(n.blocks)||0===n.blocks.length)?p.Z.I18n.t("newsletterIsEmpty"):window.mailpoet_mss_active&&t.indexOf("[link:subscription_unsubscribe_url]")<0&&t.indexOf("[link:subscription_unsubscribe]")<0?p.Z.I18n.t("unsubscribeLinkMissing"):"re_engagement"===e.type&&t.indexOf("[link:subscription_re_engage_url]")<0?p.Z.I18n.t("reEngageLinkMissing"):"notification"===e.type&&t.indexOf('"type":"automatedLatestContent"')<0&&t.indexOf('"type":"automatedLatestContentLayout"')<0?p.Z.I18n.t("automatedLatestContentMissing"):"standard"===e.type&&"sent"===e.status?p.Z.I18n.t("emailAlreadySent"):"re_engagement"!==e.type||p.Z.trackingConfig.emailTrackingEnabled?void 0:(0,y.jsx)("span",{style:{pointerEvents:"all"},children:k()(p.Z.I18n.t("reEngagementEmailsDisableIfTrackingIs"),/\[link\](.*?)\[\/link\]/g,(e=>(0,y.jsx)("a",{href:"?page=mailpoet-settings#/advanced",rel:"noopener noreferrer",children:e},"advancedSettingsTabLink")))})}class Hn extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"getFieldsByNewsletter",(e=>this.getSubtype(e).getFields(e))),(0,Z.Z)(this,"getSendButtonOptions",(()=>this.getSubtype(this.state.item).getSendButtonOptions(this.state.item))),(0,Z.Z)(this,"getSubtype",(e=>{switch(e.type){case"notification":return gn;case"welcome":return Cn;case"re_engagement":return qn;case"automatic":if(Wn[e.options.group])return An;default:return Jt}})),(0,Z.Z)(this,"getThumbnailPromise",(e=>this.state.thumbnailPromise?this.state.thumbnailPromise:(0,$n.W0)(e))),(0,Z.Z)(this,"isValid",(()=>u()("#mailpoet_newsletter").parsley().isValid())),(0,Z.Z)(this,"isValidFromAddress",(async()=>{if("MailPoet"!==window.mailpoet_mta_method)return!0;const e=await this.loadAuthorizedEmailAddresses(),t=this.state.item.sender_address;return-1!==e.indexOf(t)})),(0,Z.Z)(this,"showInvalidFromAddressError",(()=>{const e=this.state.item.sender_address;let t=k()(p.Z.I18n.t("newsletterInvalidFromAddress"),"%1$s",(()=>e));t=k()(t,/\[link\](.*?)\[\/link\]/g,(t=>`<a href="https://account.mailpoet.com/authorization?email=${encodeURIComponent(e)}" target="_blank" rel="noopener noreferrer">${t}</a>`)),u()("#field_sender_address").parsley().addError("invalidFromAddress",{message:t.join(""),updateClass:!0}),p.Z.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"})})),(0,Z.Z)(this,"removeInvalidFromAddressError",(()=>{u()("#field_sender_address").parsley().removeError("invalidFromAddress",{updateClass:!0})})),(0,Z.Z)(this,"loadItem",(e=>(this.setState({loading:!0}),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done((e=>{const t="draft"===e.data.status?this.getThumbnailPromise(e.meta.preview_url):null,n=e.data;n.ga_campaign||(n.ga_campaign=Yn(n.id,n.subject)),this.setState({item:e.data,fields:this.getFieldsByNewsletter(e.data),thumbnailPromise:t,validationError:Bn(e.data)})})).fail((()=>{this.setState({item:{}},(()=>{this.props.history.push("/new")}))}))))),(0,Z.Z)(this,"saveTemplate",((e,t)=>{this.getThumbnailPromise(e.meta.preview_url).then((n=>{p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:{newsletter_id:e.data.id,name:e.data.subject,thumbnail_data:n,body:JSON.stringify(e.data.body),categories:'["recent"]'}}).fail((e=>{this.showError(e),this.setState({loading:!1}),p.Z.Modal.loading(!1)})),t()})).catch((e=>{this.showError({errors:[e]})}))})),(0,Z.Z)(this,"loadAuthorizedEmailAddresses",(async()=>"MailPoet"!==window.mailpoet_mta_method?[]:(await p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])),(0,Z.Z)(this,"handleSend",(e=>(e.preventDefault(),this.removeInvalidFromAddressError(),this.isValid()?(p.Z.Modal.loading(!0),this.isValidFromAddress().then((t=>t?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((e=>{switch(e.data.type){case"notification":case"welcome":case"automatic":case"re_engagement":return this.activateNewsletter(e);default:return this.sendNewsletter(e)}})).fail((e=>{this.showError(e),this.setState({loading:!1}),p.Z.Modal.loading(!1)})):(this.showInvalidFromAddressError(),p.Z.Modal.loading(!1))))):u()("#mailpoet_newsletter").parsley().validate()))),(0,Z.Z)(this,"sendNewsletter",(e=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"add",data:{newsletter_id:this.state.item.id}}).done((t=>{this.saveTemplate(e,(()=>{if(window.mailpoet_show_congratulate_after_first_newsletter)return p.Z.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);this.props.history.push(`/${this.state.item.type||""}`),"scheduled"===t.data.status?(this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("newsletterHasBeenScheduled")})),p.Z.trackEvent("Emails > Newsletter sent",{scheduled:!0})):(this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("newsletterBeingSent")}),{id:"mailpoet_notice_being_sent"}),p.Z.trackEvent("Emails > Newsletter sent",{scheduled:!1})),p.Z.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),p.Z.Modal.loading(!1)})))),(0,Z.Z)(this,"activateNewsletter",(e=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:this.props.match.params.id,status:"active"}}).done((t=>{this.saveTemplate(e,(()=>{if(window.mailpoet_show_congratulate_after_first_newsletter)return p.Z.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);const e=this.state.item.options;this.props.history.push("automatic"===this.state.item.type?`/${e.group}`:`/${this.state.item.type||""}`),"automatic"===this.state.item.type&&Wn[e.group]?this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("automaticEmailActivated").replace("%1s",Wn[e.group].title)})):"welcome"===t.data.type?(this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("welcomeEmailActivated")})),p.Z.trackEvent("Emails > Welcome email activated",{"List type":e.event,Delay:`${e.afterTimeNumber} ${e.afterTimeType}`})):"notification"===t.data.type&&(this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("postNotificationActivated")})),p.Z.trackEvent("Emails > Post notifications activated",{Frequency:e.intervalType})),p.Z.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),p.Z.Modal.loading(!1)})))),(0,Z.Z)(this,"handleResume",(e=>(e.preventDefault(),this.isValid()?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((()=>{p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:this.state.item.id}}).done((()=>{this.props.history.push(`/${this.state.item.type||""}`),this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("newsletterSendingHasBeenResumed")}))})).fail((e=>{this.showError(e)}))})).fail((e=>{this.showError(e)})).always((()=>{this.setState({loading:!1})})):u()("#mailpoet_newsletter").parsley().validate(),!1))),(0,Z.Z)(this,"handleSave",(e=>{e.preventDefault(),this.saveNewsletter(e).done((()=>{this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("newsletterUpdated")}))})).done((()=>{const e="automatic"===this.state.item.type?this.state.item.options.group:this.state.item.type;this.props.history.push(`/${e||""}`)})).fail((e=>{this.showError(e)}))})),(0,Z.Z)(this,"handleRedirectToDesign",(e=>{e.preventDefault();const t=e.target.href;this.saveNewsletter(e).done((()=>{this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("newsletterUpdated")}))})).done((()=>{window.location=t})).fail((e=>{this.showError(e)}))})),(0,Z.Z)(this,"saveNewsletter",(()=>{const e=this.state.item;e.queue=void 0,this.setState({loading:!0});const t=I.ZP.omit(e,["body","created_at","deleted_at","hash","status","updated_at","type"]);return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:t})})),(0,Z.Z)(this,"showError",(e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})})),(0,Z.Z)(this,"handleFormChange",(e=>{const t=e.target.name,n=e.target.value;return this.setState((e=>{const r=e.item,a=r.subject,s=r.ga_campaign;return r[t]=n,"subject"===t&&s===Yn(r.id,a)&&(r.ga_campaign=Yn(r.id,n)),"reply_to_address"===t&&(r[t]=n.toLowerCase()),{item:r}})),!0})),this.state={fields:[],item:{},loading:!0,thumbnailPromise:null}}componentDidMount(){this.loadItem(this.props.match.params.id).always((()=>{this.setState({loading:!1})})),u()("#mailpoet_newsletter").parsley()}componentDidUpdate(e){this.props.match.params.id!==e.match.params.id&&this.loadItem(this.props.match.params.id).always((()=>{this.setState({loading:!1})}))}render(){const e="sending"===this.state.item.status&&this.state.item.queue&&"paused"===this.state.item.queue.status,t=this.state.fields.map((t=>{const n=t;return"segments"!==t.name&&"options"!==t.name||(n.disabled=e),n})),n=this.getSendButtonOptions(),r=!(!window.mailpoet_subscribers_limit_reached&&!window.mailpoet_mss_key_pending_approval&&void 0===this.state.validationError);let a=this.state.item.type;return"automatic"===a&&(a=this.state.item.options.group||a),(0,y.jsxs)("div",{className:"mailpoet-form-send-email",children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(ut,{emailType:a,automationId:"newsletter_send_heading"}),(0,y.jsxs)(ke,{id:"mailpoet_newsletter",fields:t,automationId:"newsletter_send_form",item:this.state.item,loading:this.state.loading,onChange:this.handleFormChange,onSubmit:this.handleSave,children:[(0,y.jsxs)(_t.r.CenteredRow,{className:"send-newsletter-buttons",children:[(0,y.jsx)(Ce.Button,{variant:"secondary",type:"submit",automationId:"email-save-draft",children:p.Z.I18n.t("saveDraftAndClose")}),e?(0,y.jsx)(Ce.Button,{type:"button",onClick:this.handleResume,isDisabled:r,automationId:"email-resume",children:p.Z.I18n.t("resume")}):(0,y.jsx)(Ce.Button,{type:"button",onClick:this.handleSend,...n,isDisabled:r,automationId:"email-submit",children:n.value||p.Z.I18n.t("send")}),void 0!==this.state.validationError&&(0,y.jsx)(M(),{tooltip:(0,y.jsx)("div",{children:this.state.validationError}),tooltipId:"helpTooltipSendEmail"})]}),(0,y.jsxs)("p",{children:[p.Z.I18n.t("orSimply")," ",(0,y.jsx)("a",{className:"mailpoet-link",href:`?page=mailpoet-newsletter-editor&id=${this.props.match.params.id}`,onClick:this.handleRedirectToDesign,children:p.Z.I18n.t("goBackToDesign")}),"."]}),window.mailpoet_mss_key_pending_approval&&(0,y.jsx)("div",{className:"mailpoet_error",children:k()(p.Z.I18n.t("pendingKeyApprovalNotice"),/\[link\](.*?)\[\/link\]/g,(e=>(0,y.jsx)("a",{href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer",children:e},"pendingKeyApprovalNoticeLink")))})]})]})}}Hn.contextType=Fe.k,Hn.propTypes={match:g().shape({params:g().shape({id:g().string}).isRequired}).isRequired,history:g().shape({push:g().func.isRequired}).isRequired};var zn=(0,c.withRouter)(Hn);function Kn(e){const[t,n]=(0,j.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:0,children:p.Z.I18n.t("congratulationsSuccessHeader")}),(0,y.jsx)(je.Z,{level:3,children:(r=e.newsletter,"welcome"===r.type?p.Z.I18n.t("congratulationsWelcomeEmailSuccessBody"):"notification"===r.type?p.Z.I18n.t("congratulationsPostNotificationSuccessBody"):"automatic"===r.type?p.Z.I18n.t("congratulationsWooSuccessBody"):"scheduled"===r.status?p.Z.I18n.t("congratulationsScheduleSuccessBody"):p.Z.I18n.t("congratulationsSendSuccessBody"))}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)("img",{src:e.illustrationImageUrl,alt:"",width:"500"}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)(Ce.Button,{type:"button",dimension:"small",onClick:()=>{e.successClicked(),n(!0)},withSpinner:t,children:p.Z.I18n.t("close")})]});var r}Kn.propTypes={successClicked:g().func.isRequired,illustrationImageUrl:g().string.isRequired,newsletter:g().shape({status:g().string.isRequired,type:g().string.isRequired}).isRequired};var Gn=Kn;function Qn(e){return(0,y.jsxs)("div",{className:"mailpoet-wizard-step",children:[(0,y.jsx)("div",{className:"mailpoet-wizard-step-illustration",children:(0,y.jsx)("img",{src:e.illustrationUrl,width:"500",alt:""})}),(0,y.jsx)("div",{className:"mailpoet-wizard-step-content",children:e.children})]})}Qn.propTypes={illustrationUrl:g().string.isRequired,children:g().oneOfType([g().arrayOf(g().node),g().node]).isRequired};var Xn=Qn,Jn=function(e){let{children:t,isOrdered:n}=e;const r=n?"ol":"ul";return(0,y.jsx)(r,{className:`mailpoet-${r}`,children:t})};function er(){return(0,y.jsxs)(Jn,{children:[(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSList1")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSList2")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSList4")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSList5")})]})}function tr(){return(0,y.jsxs)(Jn,{children:[(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSNotFreeList1")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSNotFreeList2")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSNotFreeList3")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSNotFreeList4")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSNotFreeList5")})]})}function nr(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)(v.Z,{isFullWidth:!0,href:e.mailpoetAccountUrl,target:"_blank",rel:"noopener noreferrer",onClick:t=>{t.preventDefault(),window.open(e.mailpoetAccountUrl),e.next()},children:e.nextButtonText}),(0,y.jsx)(v.Z,{isFullWidth:!0,variant:"tertiary",onClick:e.next,onKeyDown:t=>{["keydown","keypress"].includes(t.type)&&["Enter"," "].includes(t.key)&&(t.preventDefault(),e.next())},withSpinner:e.nextWithSpinner,children:p.Z.I18n.t("welcomeWizardMSSNoThanks")})]})}function rr(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("welcomeWizardMSSFreeTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("p",{children:p.Z.I18n.t("welcomeWizardMSSFreeSubtitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)(je.Z,{level:5,children:[p.Z.I18n.t("welcomeWizardMSSFreeListTitle"),":"]}),(0,y.jsx)(er,{}),(0,y.jsx)(nr,{mailpoetAccountUrl:p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount,p.Z.currentWpUserEmail,"starter",{utm_medium:"onboarding",utm_campaign:"purchase"}),next:e.next,nextButtonText:p.Z.I18n.t("welcomeWizardMSSFreeButton")})]})}function ar(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("welcomeWizardMSSNotFreeTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("p",{children:[p.Z.I18n.t("welcomeWizardMSSNotFreeSubtitle"),":"]}),(0,y.jsx)(tr,{}),(0,y.jsx)(nr,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next,nextButtonText:p.Z.I18n.t("welcomeWizardMSSNotFreeButton")})]})}function sr(e){return e.subscribersCount<1e3?(0,y.jsx)(rr,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next}):(0,y.jsx)(ar,{mailpoetAccountUrl:e.purchaseUrl,next:e.next})}nr.propTypes={mailpoetAccountUrl:g().string.isRequired,next:g().func.isRequired,nextButtonText:g().string.isRequired,nextWithSpinner:g().bool},nr.defaultProps={nextWithSpinner:!1},rr.propTypes={next:g().func.isRequired},ar.propTypes={mailpoetAccountUrl:g().string.isRequired,next:g().func.isRequired},sr.propTypes={next:g().func.isRequired,subscribersCount:g().number.isRequired,mailpoetAccountUrl:g().string.isRequired,purchaseUrl:g().string.isRequired};var ir=sr,or=function(e){const[t,n]=(0,j.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:(r=e.newsletter.type,{standard:p.Z.I18n.t("congratulationsMSSPitchHeader"),welcome:p.Z.I18n.t("congratulationsMSSPitchHeaderAutomated"),notification:p.Z.I18n.t("congratulationsMSSPitchHeaderAutomated"),woocommerce:p.Z.I18n.t("congratulationsMSSPitchHeaderAutomated")}[r]||p.Z.I18n.t("congratulationsMSSPitchHeaderAutomated"))}),(0,y.jsx)(Xn,{illustrationUrl:e.MSSPitchIllustrationUrl,children:(0,y.jsxs)("div",{className:"mailpoet-welcome-wizard-step-content",children:[(0,y.jsx)(je.Z,{level:4,children:p.Z.I18n.t("congratulationsMSSPitchSubHeader")}),(0,y.jsx)("p",{children:p.Z.I18n.t(e.subscribersCount<1e3?"welcomeWizardMSSFreeSubtitle":"welcomeWizardMSSNotFreeSubtitle")}),(0,y.jsxs)(je.Z,{level:5,children:[p.Z.I18n.t("welcomeWizardMSSFreeListTitle"),":"]}),(0,y.jsx)(er,{}),(0,y.jsx)(nr,{mailpoetAccountUrl:e.purchaseUrl,next:()=>{e.onFinish(),n(!0)},nextButtonText:p.Z.I18n.t("welcomeWizardMSSFreeButton"),nextWithSpinner:t})]})})]});var r};function lr(e){return window.has_mss_key_specified?(0,y.jsx)(Gn,{successClicked:e.successClicked,illustrationImageUrl:e.illustrationImageUrl,newsletter:e.newsletter}):(0,y.jsx)(or,{MSSPitchIllustrationUrl:e.MSSPitchIllustrationUrl,onFinish:e.successClicked,subscribersCount:e.subscribersCount,purchaseUrl:e.purchaseUrl,newsletter:e.newsletter})}lr.propTypes={successClicked:g().func.isRequired,illustrationImageUrl:g().string.isRequired,MSSPitchIllustrationUrl:g().string.isRequired,newsletter:g().shape({status:g().string.isRequired,type:g().string.isRequired}).isRequired,subscribersCount:g().number.isRequired,purchaseUrl:g().string.isRequired};var cr=lr;function dr(e){const[t,n]=(0,j.useState)(!1);return(0,y.jsxs)("div",{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("congratulationsSendFailHeader")}),(0,y.jsx)(je.Z,{level:3,children:k()(p.Z.I18n.t("congratulationsSendFailExplain"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,y.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://kb.mailpoet.com/article/231-sending-does-not-work","data-beacon-article":"5a0257ac2c7d3a272c0d7ad6",children:e},t)))}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)("img",{src:window.mailpoet_congratulations_error_image,alt:"",width:"500"}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)(Ce.Button,{dimension:"small",type:"button",onClick:()=>{e.failClicked(),n(!0)},withSpinner:t,children:p.Z.I18n.t("close")})]})}dr.propTypes={failClicked:g().func.isRequired};var ur=dr,pr=n(63438);function mr(e){return(0,y.jsx)("div",{className:"mailpoet-congratulate-loading",children:e.showRichLoadingScreen&&(0,y.jsxs)("div",{children:[(0,y.jsx)(je.Z,{level:0,children:p.Z.I18n.t("congratulationsLoadingHeader")}),(0,y.jsx)(je.Z,{level:3,children:p.Z.I18n.t("congratulationsLoadingBody")}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)(pr.Z,{size:64})]})})}mr.propTypes={showRichLoadingScreen:g().bool.isRequired};var hr=mr;const fr=Math.floor(4*Math.random());function gr(){return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:{show_congratulate_after_first_newsletter:!1}}).always((()=>{window.location=window.mailpoet_main_page}))}class vr extends j.Component{constructor(e){super(e),this.state={loading:!0,newsletter:null,testingPassed:!1,timeStart:te()(),minimumLoadingTimePassed:!1},this.tick=this.tick.bind(this)}componentDidMount(){this.loadNewsletter(this.props.match.params.id),this.tick()}componentDidUpdate(e){e.match.params.id!==this.props.match.params.id&&this.loadNewsletter(this.props.match.params.id)}tick(){te()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),te()().subtract(6,"seconds").isAfter(this.state.timeStart)&&this.setState({minimumLoadingTimePassed:!0}),!this.state.loading&&this.state.minimumLoadingTimePassed||setTimeout(this.tick,2e3)}loadNewsletter(e){p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done((e=>this.newsletterLoaded(e.data)))}newsletterLoaded(e){"standard"!==e.type||"scheduled"===e.status?this.setState({newsletter:e,loading:!1,minimumLoadingTimePassed:!0}):"sent"===e.status||"sending"===e.status?this.setState({newsletter:e,loading:!1,testingPassed:!0}):this.setState({newsletter:e})}renderContent(){return this.state.loading||!this.state.minimumLoadingTimePassed?(e=!this.state.newsletter,(0,y.jsx)(hr,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:gr,showRichLoadingScreen:e})):this.state.error?(p.Z.trackEvent("Cron testing done",{"Cron is working":"false"}),(0,y.jsx)(ur,{failClicked:()=>{window.location=window.mailpoet_main_page}})):(t=this.state.newsletter,this.state.testingPassed&&p.Z.trackEvent("Cron testing done",{"Cron is working":"true"}),(0,y.jsx)(cr,{illustrationImageUrl:window.mailpoet_congratulations_success_images[fr],MSSPitchIllustrationUrl:window.mailpoet_congratulations_success_images[fr],successClicked:gr,newsletter:t,isWoocommerceActive:window.mailpoet_woocommerce_active,subscribersCount:window.mailpoet_subscribers_count,purchaseUrl:p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount,p.Z.currentWpUserEmail,"starter",{utm_medium:"first-newsletter-congratulations",utm_campaign:"purchase"})}));var e,t}render(){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("style",{dangerouslySetInnerHTML:{__html:"body { background: #fff; overflow-x: hidden; }"}}),(0,y.jsxs)("div",{className:"mailpoet-congratulate",children:[(0,y.jsx)("div",{className:"mailpoet-gap-large"}),this.renderContent()]})]})}}vr.propTypes={match:g().shape({params:g().shape({id:g().string}).isRequired}).isRequired};var br=vr;class yr extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"showTemplateSelection",(e=>{this.props.history.push(`/template/${e}`)}))}componentDidMount(){p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"standard"}}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}render(){return(0,y.jsx)("div",{children:(0,y.jsx)(ut,{emailType:"standard",automationId:"standard_newsletter_creation_heading"})})}}yr.contextType=Fe.k,yr.propTypes={history:g().shape({push:g().func.isRequired}).isRequired};var wr=(0,c.withRouter)(yr);const xr={name:"options",type:"reactComponent",component:hn};class _r extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"handleValueChange",(e=>{const t=this.state;t[e.target.name]=e.target.value,this.setState(t)})),(0,Z.Z)(this,"handleNext",(()=>{p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:I.ZP.extend({},this.state,{type:"notification",subject:p.Z.I18n.t("draftPostNotificationTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))})),(0,Z.Z)(this,"showTemplateSelection",(e=>{this.props.history.push(`/template/${e}`)})),this.state={options:{intervalType:"daily",timeOfDay:0,weekDay:1,monthDay:0,nthWeekDay:1}}}render(){return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(ut,{emailType:"notification",automationId:"post_notification_creation_heading"}),(0,y.jsxs)(_t.r.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,y.jsx)(je.Z,{level:4,children:p.Z.I18n.t("selectFrequency")}),(0,y.jsx)(hn,{item:this.state,field:xr,onValueChange:this.handleValueChange}),(0,y.jsx)(v.Z,{isFullWidth:!0,onClick:this.handleNext,type:"button",children:p.Z.I18n.t("next")})]})]})}}_r.contextType=Fe.k,_r.propTypes={history:g().shape({push:g().func.isRequired}).isRequired};var Zr=(0,c.withRouter)(_r);const jr={name:"options",label:"Event",type:"reactComponent",component:In};class Ir extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"isValid",(()=>u()("#welcome_scheduling").parsley().isValid())),(0,Z.Z)(this,"validate",(()=>u()("#welcome_scheduling").parsley().validate()));let t=window.mailpoet_segments||[],n=1;t=t.filter((e=>"default"===e.type)),I.ZP.size(t)>0&&(n=I.ZP.first(t).id),this.state={options:{event:"segment",segment:n,role:"subscriber",afterTimeNumber:1,afterTimeType:"immediate"}},this.handleValueChange=this.handleValueChange.bind(this),this.handleNext=this.handleNext.bind(this)}handleValueChange(e){const{state:t}=this;t[e.target.name]=e.target.value,this.setState(t)}handleNext(e){e.preventDefault(),this.isValid()?p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:I.ZP.extend({},this.state,{type:"welcome",subject:p.Z.I18n.t("draftNewsletterTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})):this.validate()}showTemplateSelection(e){this.props.history.push(`/template/${e}`)}render(){return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(ut,{emailType:"welcome",automationId:"welcome_email_creation_heading"}),(0,y.jsxs)(_t.r.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,y.jsx)(je.Z,{level:4,children:p.Z.I18n.t("selectEventToSendWelcomeEmail")}),(0,y.jsxs)("form",{id:"welcome_scheduling",children:[(0,y.jsx)(In,{item:this.state,field:jr,onValueChange:this.handleValueChange}),(0,y.jsx)(v.Z,{isFullWidth:!0,type:"submit",onClick:this.handleNext,children:p.Z.I18n.t("next")})]})]})]})}}Ir.propTypes={history:g().shape({push:g().func.isRequired}).isRequired};var Sr=Ir;class Cr extends j.Component{static getEventOptions(e){return e.options||null}static getEventOptionsFirstValue(e){return e&&I.ZP.isArray(e.values)&&e.values[0].id?e.values[0].id:null}constructor(e){super(e),(0,Z.Z)(this,"isValid",(()=>!u()("#newsletter_scheduling").parsley()||u()("#newsletter_scheduling").parsley().isValid())),(0,Z.Z)(this,"validate",(()=>{u()("#newsletter_scheduling").parsley()&&u()("#newsletter_scheduling").parsley().validate()})),(0,Z.Z)(this,"resetValidationErrors",(()=>{u()("#newsletter_scheduling").parsley()&&u()("#newsletter_scheduling").parsley().reset()}));const{email:t,name:n}=e;this.handleChange=this.handleChange.bind(this),this.handleNextStep=this.handleNextStep.bind(this),this.email=t,this.emailEvents=this.email.events,this.segments=I.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const r=this.getEvent(n),a=this.constructor.getEventOptions(r),s=this.constructor.getEventOptionsFirstValue(a);this.state={event:r,eventSlug:r.slug,eventOptionValue:s,segment:r.sendToLists?this.getFirstSegment():null,afterTimeType:r.defaultAfterTimeType||"immediate",afterTimeNumber:null}}handleChange(e){const{segment:t,afterTimeNumber:n}=this.state,r=e;if(r.eventSlug){r.event=this.getEvent(r.eventSlug),r.segment=r.event.sendToLists?t||this.getFirstSegment():null;const e=this.constructor.getEventOptions(r.event);r.eventOptionValue=e?this.constructor.getEventOptionsFirstValue(e):null}r.afterTimeType&&"immediate"===r.afterTimeType?r.afterTimeNumber=null:!r.afterTimeType||r.afterTimeNumber||n||(r.afterTimeNumber=1),this.setState(r),this.resetValidationErrors(),this.isValid()&&this.validate()}handleNextStep(e){if(e.preventDefault(),!this.isValid())return void this.validate();const{history:t}=this.props,{eventSlug:n,afterTimeType:r,afterTimeNumber:a,event:s,segment:i,eventOptionValue:o}=this.state,l={group:this.email.slug,event:n,afterTimeType:r};a&&(l.afterTimeNumber=a),l.sendTo=s.sendToLists?"segment":"user",i&&(l.segment=i),o&&(l.meta=JSON.stringify({option:o})),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"automatic",subject:p.Z.I18n.t("draftNewsletterTitle"),options:l}}).done((e=>{p.Z.trackEvent("Emails > New Automatic Email Created",{"Event type":l.event,"Schedule type":l.afterTimeType,"Schedule value":l.afterTimeNumber}),t.push(`/template/${e.data.id}`)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}getEvent(e){return this.emailEvents[e]}getFirstSegment(){return I.ZP.isArray(this.segments)&&this.segments[0].id?this.segments[0].id:null}displayHeader(){const{event:e}=this.state;return e.title}displayEventOptions(){const{eventSlug:e,event:t}=this.state,n={emailSlug:this.email.slug,eventSlug:e,eventOptions:this.constructor.getEventOptions(t),onValueChange:this.handleChange};return(0,y.jsx)(Dn,{emailSlug:n.emailSlug,eventSlug:n.eventSlug,eventOptions:n.eventOptions,onValueChange:n.onValueChange})}displaySegments(){const{event:e}=this.state;if(!e.sendToLists)return null;const t={field:{id:"segments",forceSelect2:!0,values:this.segments,extendSelect2Options:{minimumResultsForSearch:1/0}},onValueChange:e=>this.handleChange({segment:e.target.value})};return(0,y.jsx)("div",{className:"event-segment-selection",children:(0,y.jsx)(C,{field:t.field,onValueChange:t.onValueChange})})}displayScheduling(){const{afterTimeNumber:e,afterTimeType:t,event:n}=this.state,r={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return(0,y.jsx)(kn,{item:r.item,event:r.event,onValueChange:r.onValueChange})}displayEventTip(){const{event:e}=this.state;return e.tip?(0,y.jsxs)("p",{className:"description",children:[(0,y.jsx)("strong",{children:p.Z.I18n.t("tip")})," ",e.tip]}):null}render(){return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(ut,{emailType:"woocommerce",automationId:"woocommerce_email_creation_heading"}),(0,y.jsx)(_t.r.Column,{align:"center",className:"mailpoet-schedule-email",children:(0,y.jsxs)("form",{id:"newsletter_scheduling",children:[(0,y.jsx)(je.Z,{level:4,children:this.displayHeader()}),(0,y.jsx)("div",{children:this.displayEventOptions()}),(0,y.jsx)("div",{children:this.displaySegments()}),(0,y.jsx)("div",{children:this.displayScheduling()}),(0,y.jsx)(v.Z,{isFullWidth:!0,onClick:this.handleNextStep,type:"submit",children:p.Z.I18n.t("next")})]})}),this.displayEventTip()]})}}Cr.contextType=Fe.k,Cr.propTypes={history:g().shape({push:g().func.isRequired}).isRequired,name:g().string.isRequired,email:g().shape({title:g().string.isRequired,slug:g().string.isRequired}).isRequired};var Tr=Cr,kr=n(45853),Nr=n(19013),Dr=n(13882);function Er(e){return(0,Dr.Z)(1,arguments),(0,Nr.default)(e).getTime()<Date.now()}var Or=n(77349),Rr=n(36948);function Ar(e,t){return(0,Dr.Z)(2,arguments),(0,Nr.default)(e).getTime()-(0,Nr.default)(t).getTime()}var Pr={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function Mr(e){return e?Pr[e]:Pr.trunc}var Lr=n(44732),Fr=n(65221);function qr(e){let{percentage:t}=e;const n=16*Math.PI,r=n*(t/100),a=n-r;return(0,y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"8",className:"mailpoet-listing-status-percentage-background"}),(0,y.jsx)("circle",{r:"8",cx:"12",cy:"12",fill:"none",strokeDashoffset:n/4,strokeDasharray:`${r} ${a}`,className:"mailpoet-listing-status-percentage"})]})}function $r(){return(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:(0,y.jsx)("path",{className:"mailpoet-listing-status-scheduled-icon",strokeLinecap:"round",d:"M12 7L12 12 15 15"})})}var Ur=function(e){let{scheduledFor:t,processed:n,total:r,isPaused:a,status:s}=e;const i=!t&&!n&&!r,o=t&&function(e){return(0,Dr.Z)(1,arguments),(0,Nr.default)(e).getTime()>Date.now()}(t),l=(!t||Er(t))&&n<r,c=(!t||Er(t))&&n>=r,d="sent"===s&&void 0===r;let u=0,m=(0,Lr.Z)("notSentYet");if(o){const e=p.Z.Date.short(t),n=p.Z.Date.time(t),r=new Date,a=(0,Or.default)(r,1),s=p.Z.Date.short(r)===e,i=p.Z.Date.short(a)===e;if(s||i){const t=Math.random().toString(36).substring(2,15),r=s?(0,Lr.Z)("today"):(0,Lr.Z)("tomorrow");m=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{"data-tip":!0,"data-for":t,children:r}),(0,y.jsx)(Fr.Z,{place:"right",id:t,children:e}),(0,y.jsx)("br",{}),n]})}else m=(0,y.jsxs)(y.Fragment,{children:[e,(0,y.jsx)("br",{}),n]});const o=720,l=function(e,t,n){(0,Dr.Z)(2,arguments);var r=Ar(e,t)/Rr.yJ;return Mr(null==n?void 0:n.roundingMethod)(r)}(t,r);u=l<o?l/o*100:100}else l?(m=`${p.Z.Num.toLocaleFixed(n)} / ${p.Z.Num.toLocaleFixed(r)}`,u=n/r*100):c?(m=`${p.Z.Num.toLocaleFixed(r)} / ${p.Z.Num.toLocaleFixed(r)}`,u=100):d&&(m=(0,Lr.Z)("sent"),u=100);return!a||c||d||(m=(0,Lr.Z)("paused")),(0,y.jsxs)("div",{className:h()({"mailpoet-listing-status":!0,"mailpoet-listing-status-unknown":i,"mailpoet-listing-status-scheduled":o,"mailpoet-listing-status-in-progress":l,"mailpoet-listing-status-sent":c||d}),children:[o&&(0,y.jsx)($r,{}),(0,y.jsx)(qr,{percentage:u}),(0,y.jsx)("div",{className:"mailpoet-listing-status-label",children:m})]})};const Vr=g().shape({status:g().string,count_processed:g().string.isRequired,count_total:g().string.isRequired,scheduled_at:g().string}),Wr=g().shape({id:g().number.isRequired,sent_at:g().string,status:g().string.isRequired,queue:g().oneOfType([Vr,g().bool])});function Yr(e){let{newsletter:t}=e;const[n,r]=(0,j.useState)("paused"===t.queue.status),[a,s]=(0,j.useState)([]);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(it,{errors:a}),n&&(0,y.jsx)(v.Z,{dimension:"small",onClick:()=>{s([]),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:t.id}}).done((()=>r(!1))).fail((e=>s(e.errors)))},children:p.Z.I18n.t("resume")}),!n&&(0,y.jsx)(v.Z,{dimension:"small",onClick:()=>{s([]),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"pause",data:{newsletter_id:t.id}}).done((()=>r(!0))).fail((e=>s(e.errors)))},children:p.Z.I18n.t("pause")})]})}function Br(e){let{newsletter:t,mailerLog:n}=e,r=t.sent_at||t.queue.scheduled_at;r&&(r=(0,kr.default)(r,"yyyy-MM-dd HH:mm:ss",new Date));const a=t.queue&&"scheduled"!==t.queue.status,s="paused"===n.status,i=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.rU,{to:`/sending-status/${t.id}`,"data-automation-id":`sending_status_${t.id}`,children:(0,y.jsx)(Ur,{processed:parseInt(t.queue.count_processed,10),scheduledFor:r,total:parseInt(t.queue.count_total,10),isPaused:s,status:t.status})}),"completed"!==t.queue.status&&!s&&(0,y.jsx)(Yr,{newsletter:t})]}),o=(0,y.jsx)(Ur,{scheduledFor:r,isPaused:"scheduled"===t.queue.status&&s,status:t.status});return(0,y.jsxs)(y.Fragment,{children:[a&&i,!a&&o]})}Yr.propTypes={newsletter:Wr.isRequired},Br.propTypes={newsletter:Wr.isRequired,mailerLog:g().shape({status:g().string}).isRequired};var Hr=Br;const zr={opened:{badgeRanges:[30,10,0],badgeTypes:["excellent","good","average"],tooltipText:[p.Z.I18n.t("openedStatTooltipExcellent"),p.Z.I18n.t("openedStatTooltipGood"),p.Z.I18n.t("openedStatTooltipAverage")]},clicked:{badgeRanges:[3,1,0],badgeTypes:["excellent","good","average"],tooltipText:[p.Z.I18n.t("clickedStatTooltipExcellent"),p.Z.I18n.t("clickedStatTooltipGood"),p.Z.I18n.t("clickedStatTooltipAverage")]}},Kr=(e,t)=>{const n=zr[e]||null;if(!n)return null;if(t<0||t>100)return null;const r=n.badgeRanges.length;for(let e=0;e<r;e+=1)if(t>n.badgeRanges[e])return n.badgeTypes[e];return n.badgeTypes[r-1]};function Gr(e){const t={excellent:{name:p.Z.I18n.t("excellentBadgeName"),tooltipTitle:p.Z.I18n.t("excellentBadgeTooltip")},good:{name:p.Z.I18n.t("goodBadgeName"),tooltipTitle:p.Z.I18n.t("goodBadgeTooltip")},average:{name:p.Z.I18n.t("averageBadgeName"),tooltipTitle:p.Z.I18n.t("averageBadgeTooltip")}},n=Kr(e.stat,e.rate),r=t[n]||null;if(!r)return null;const a=zr[e.stat]||null;if(!a)return null;const s=e.tooltipId||null,i=(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"mailpoet-listing-stats-tooltip-title",children:r.tooltipTitle.toUpperCase()}),(0,y.jsxs)("div",{className:"mailpoet-listing-stats-tooltip-content",children:[(0,y.jsx)(V.Z,{type:"excellent",name:t.excellent.name})," : ",a.tooltipText[0],(0,y.jsx)("br",{}),(0,y.jsx)(V.Z,{type:"good",name:t.good.name})," : ",a.tooltipText[1],(0,y.jsx)("br",{}),(0,y.jsx)(V.Z,{type:"average",name:t.average.name})," : ",a.tooltipText[2]]})]},`tooltip-${s}`);return(0,y.jsx)(V.Z,{isInverted:e.isInverted,type:n,name:r.name,tooltip:i,tooltipId:s,tooltipPlace:e.tooltipPlace})}Gr.defaultProps={isInverted:!0};var Qr=function(e){let{opened:t,clicked:n,revenues:r,hideBadges:a,newsletterId:s,wrapContentInLink:i}=e;const o=p.Z.Num.toLocaleFixed(t,1),l=p.Z.Num.toLocaleFixed(n,1);let c=(0,y.jsxs)("div",{className:"mailpoet-listing-stats-opened-clicked",children:[(0,y.jsxs)("div",{className:"mailpoet-listing-stats-percentages",children:[l,"%",(0,y.jsx)("br",{}),(0,y.jsxs)("span",{className:"mailpoet-listing-stats-percentages-opens",children:[o,"%"]})]}),!a&&(0,y.jsx)("div",{children:(0,y.jsx)(Gr,{stat:"clicked",rate:n,tooltipId:`clicked-${s||"0"}`})})]}),d=null;if(r){const e=`revenues-${s||"0"}`;d=(0,y.jsxs)("div",{children:[(0,y.jsx)(b.Z,{"data-tip":!0,"data-for":e,children:r}),(0,y.jsx)(Fr.Z,{place:"top",multiline:!0,id:e,children:(0,y.jsx)("div",{className:"mailpoet-listing-stats-tooltip-content",children:p.Z.I18n.t("revenueStatsTooltipShort")})})]})}return i&&(c=i(c,"opened-and-clicked"),d=i(d,"revenue")),(0,y.jsxs)("div",{className:"mailpoet-listing-stats",children:[c,d]})},Xr=n(93723);function Jr(e){let{newsletter:t,isSent:n,currentTime:r}=e,a=n;if(void 0===a&&(a=t.statistics&&t.queue&&"scheduled"!==t.queue.status),!a)return null;const s={link:`/stats/${t.id}`,onClick:Ye().applyFilters("mailpoet_newsletters_listing_stats_tracking",Xr.gP)},i=Number(t.total_sent||t.queue.count_processed);let o,c,d,u,m,h=0,f=0,g=null;i>0&&(h=100*t.statistics.clicked/i,f=100*t.statistics.opened/i,g=t.statistics.revenue),void 0!==r?(o=6,c=t.queue.scheduled_at||t.queue.created_at,d=te()(r).diff(te()(c),"hours"),u=d<o,m=!0):(u=!1,m=!1);const v=i>=20&&t.statistics.opened>=5&&!u,w=(e,n)=>((e,t,n,r)=>r<=0||!t.link?e:t.externalLink?(0,y.jsx)("a",{href:t.link,onClick:t.onClick||null,children:e},`stats-${n}`):(0,y.jsx)(l.rU,{to:t.link,onClick:t.onClick||null,children:e},`stats-${n}`))(e,s,`${n}-${t.id}`,i),x=(0,y.jsx)(Qr,{opened:f,clicked:h,revenues:g&&g.value>0?g.formatted:null,hideBadges:!v,newsletterId:t.id,wrapContentInLink:w}),_=(0,y.jsxs)(y.Fragment,{children:[x,u&&w((0,y.jsx)(b.Z,{className:"mailpoet-listing-stats-too-early",dimension:"large",variant:"excellent",isInverted:!0,children:p.Z.I18n.t("checkBackInHours").replace("%1$d",o-d)}),"check-back")]});let Z;return m&&f<5&&d>=24&&i>=10&&(Z=(0,y.jsx)("div",{children:(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/191-how-to-improve-my-open-and-click-rates","data-beacon-article":"58f671152c7d3a057f8858e8",target:"_blank",rel:"noopener noreferrer",className:"mailpoet_stat_link_small",children:p.Z.I18n.t("improveThisLinkText")})})),(0,y.jsxs)(y.Fragment,{children:[_,Z]})}const ea=g().shape({clicked:g().number,opened:g().number,unsubscribed:g().number,revenue:g().shape({count:g().number,currency:g().string,formatted:g().string,value:g().number})}),ta=g().shape({status:g().string,count_processed:g().string.isRequired,count_total:g().string.isRequired,created_at:g().string,scheduled_at:g().string});Jr.propTypes={newsletter:g().shape({id:g().number.isRequired,queue:g().oneOfType([ta,g().bool]),total_sent:g().number,statistics:g().oneOfType([ea,g().bool])}).isRequired,isSent:g().bool,currentTime:g().string},Jr.defaultProps={isSent:void 0,currentTime:void 0};var na=Jr;const ra=p.Z.trackingConfig.emailTrackingEnabled,aa={onNoItemsFound:(e,t)=>p.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterTrashed"):p.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterDeleted"):p.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterRestored"):p.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},sa=[{name:"subject",label:p.Z.I18n.t("subject"),sortable:!0},{name:"status",label:p.Z.I18n.t("status")},{name:"segments",label:p.Z.I18n.t("lists")},{name:"statistics",label:p.Z.I18n.t("statistics"),display:ra},{name:"sent_at",label:p.Z.I18n.t("sentOn"),sortable:!0}],ia=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:aa.onTrash}],oa=e=>{const t=()=>{window.location.href=`?page=mailpoet-newsletter-editor&id=${e.id}`};e.queue&&"sending"===e.status&&null===e.queue.status?(0,ht.Z)({message:p.Z.I18n.t("confirmEdit"),onConfirm:t}):t()};let la=[{name:"view",link:function(e){return(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("edit"),onClick:oa},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:function(e,t){return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{p.Z.Notice.success(p.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];la=(0,Xr.y8)(la);class ca extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"renderItem",((e,t,n)=>{const r=h()("manage-column","column-primary","has-row-actions");return(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:r,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:"#",onClick:t=>{t.preventDefault(),oa(e)},children:e.queue.newsletter_rendered_subject||e.subject}),t]}),(0,y.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":p.Z.I18n.t("status"),children:(0,y.jsx)(Hr,{newsletter:e,mailerLog:n.mta_log})}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("lists"),children:(0,y.jsx)(w,{segments:e.segments,dimension:"large"})}),!0===ra?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("statistics"),children:(0,y.jsx)(na,{newsletter:e,currentTime:n.current_time})}):null,(0,y.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("sentOn"),children:e.sent_at?(0,y.jsxs)(y.Fragment,{children:[p.Z.Date.short(e.sent_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.sent_at)]}):null})]})})),(0,Z.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,y.jsxs)(y.Fragment,{children:[0===this.state.newslettersCount&&(0,y.jsx)(ct,{filter:e=>"standard"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"standard",base_url:"standard",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:sa,bulk_actions:ia,item_actions:la,messages:aa,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,Xr._X)(e),(0,Xr.bF)(e)}})]})}}ca.contextType=Fe.k,ca.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var da=(0,c.withRouter)(ca);const ua=window.mailpoet_roles||{},pa=window.mailpoet_segments||{},ma=p.Z.trackingConfig.emailTrackingEnabled,ha={onNoItemsFound:(e,t)=>p.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterTrashed"):p.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterDeleted"):p.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterRestored"):p.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},fa=[{name:"subject",label:p.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:p.Z.I18n.t("settings")},{name:"statistics",label:p.Z.I18n.t("statistics"),display:ma},{name:"status",label:p.Z.I18n.t("status"),width:145},{name:"updated_at",label:p.Z.I18n.t("lastModifiedOn"),sortable:!0}],ga=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:ha.onTrash}];let va=[{name:"view",link:function(e){return(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("preview")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:(e,t)=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{p.Z.Notice.success(p.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("edit"),onClick:Xr.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];va=(0,Xr.y8)(va);class ba extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"updateStatus",((e,t)=>{t.persist(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&p.Z.Notice.success(p.Z.I18n.t("welcomeEmailActivated")),this.forceUpdate()})).fail((n=>{p.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,Z.Z)(this,"renderStatus",(e=>{const t=p.Z.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString()),n=p.Z.I18n.t("scheduledToXSubscribers").replace("%1$d",e.total_scheduled.toLocaleString());return(0,y.jsxs)("div",{children:[(0,y.jsx)(Vt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,y.jsxs)("p",{className:"mailpoet-listing-stats-description",children:[(0,y.jsx)(l.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})," ",(0,y.jsx)("br",{}),n]})]})})),(0,Z.Z)(this,"renderSettings",(e=>{let t,n,r;switch(e.options.event){case"user":t="mailpoet_all"===e.options.role?p.Z.I18n.t("welcomeEventWPUserAnyRole"):k()(p.Z.I18n.t("welcomeEventWPUserWithRole"),'"%1$s"',((t,n)=>(0,y.jsx)(b.Z,{variant:"list",children:ua[e.options.role]},n)));break;default:if(r=I.ZP.find(pa,(t=>Number(t.id)===Number(e.options.segment))),void 0===r)return(0,y.jsx)(l.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:p.Z.I18n.t("sendingToSegmentsNotSpecified")});t=k()(p.Z.I18n.t("welcomeEventSegment"),'"%1$s"',((e,t)=>(0,y.jsx)(b.Z,{variant:"list",children:r.name},t)))}if(t&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":n=p.Z.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":n=p.Z.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":n=p.Z.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":n=p.Z.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:n=p.Z.I18n.t("sendingDelayInvalid")}return(0,y.jsxs)("span",{children:[t,n&&(0,y.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,y.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,y.jsx)($r,{})}),n]})]})})),(0,Z.Z)(this,"renderItem",((e,t)=>{const n=h()("manage-column","column-primary","has-row-actions");return(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:n,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("settings"),children:this.renderSettings(e)}),!0===ma?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("statistics"),children:(0,y.jsx)(na,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("status"),children:this.renderStatus(e)}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("lastModifiedOn"),children:[p.Z.Date.short(e.updated_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.updated_at)]})]})})),(0,Z.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,y.jsxs)(y.Fragment,{children:[0===this.state.newslettersCount&&(0,y.jsx)(ct,{filter:e=>"welcome"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"welcome",base_url:"welcome",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:fa,bulk_actions:ga,item_actions:va,messages:ha,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,Xr._X)(e),(0,Xr.bF)(e)}})]})}}ba.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var ya=(0,c.withRouter)(ba);const wa={onNoItemsFound:(e,t)=>p.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterTrashed"):p.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterDeleted"):p.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterRestored"):p.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},xa=[{name:"subject",label:p.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:p.Z.I18n.t("settings")},{name:"history",label:p.Z.I18n.t("history"),width:100},{name:"status",label:p.Z.I18n.t("status"),width:100},{name:"updated_at",label:p.Z.I18n.t("lastModifiedOn"),sortable:!0}],_a=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:wa.onTrash}],Za=[{name:"view",link:function(e){return(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("edit"),onClick:Xr.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:function(e,t){return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{p.Z.Notice.success(p.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class ja extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"updateStatus",((e,t)=>{t.persist(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&p.Z.Notice.success(p.Z.I18n.t("postNotificationActivated")),this.forceUpdate()})).fail((n=>{p.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,Z.Z)(this,"renderStatus",(e=>(0,y.jsx)(Vt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}))),(0,Z.Z)(this,"renderSettings",(e=>{let t;if(0===e.segments.length)return(0,y.jsx)(l.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:p.Z.I18n.t("sendingToSegmentsNotSpecified")});const n=k()(p.Z.I18n.t("sendTo"),"%1$s",((t,n)=>(0,y.jsx)(w,{segments:e.segments},n)));switch(e.options.intervalType){case"daily":t=p.Z.I18n.t("sendDaily").replace("%1$s",rn[e.options.timeOfDay]);break;case"weekly":t=p.Z.I18n.t("sendWeekly").replace("%1$s",an[e.options.weekDay]).replace("%2$s",rn[e.options.timeOfDay]);break;case"monthly":t=p.Z.I18n.t("sendMonthly").replace("%1$s",sn[e.options.monthDay]).replace("%2$s",rn[e.options.timeOfDay]);break;case"nthWeekDay":t=p.Z.I18n.t("sendNthWeekDay").replace("%1$s",on[e.options.nthWeekDay]).replace("%2$s",an[e.options.weekDay]).replace("%3$s",rn[e.options.timeOfDay]);break;case"immediately":t=p.Z.I18n.t("sendImmediately");break;default:t="Invalid sending frequency"}return(0,y.jsxs)("span",{children:[n,(0,y.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,y.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,y.jsx)($r,{})}),t]})]})})),(0,Z.Z)(this,"renderHistoryLink",(e=>0===Number(e.children_count)?(0,y.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small mailpoet-listing-notification-status",children:p.Z.I18n.t("notSentYet")}):(0,y.jsxs)(l.rU,{className:"mailpoet-nowrap","data-automation-id":`history-${e.id}`,to:`/notification/history/${e.id}`,children:[(0,y.jsx)(v.Z,{className:"mailpoet-hide-on-mobile",dimension:"small",children:p.Z.I18n.t("viewHistory")}),(0,y.jsx)(v.Z,{className:"mailpoet-show-on-mobile mailpoet-listing-notification-status",dimension:"small",variant:"secondary",children:p.Z.I18n.t("viewHistory")})]}))),(0,Z.Z)(this,"renderItem",((e,t)=>{const n=h()("manage-column","column-primary","has-row-actions");return(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:n,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("settings"),children:this.renderSettings(e)}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("history"),children:this.renderHistoryLink(e)}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("status"),children:this.renderStatus(e)}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("lastModifiedOn"),children:[p.Z.Date.short(e.updated_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.updated_at)]})]})})),(0,Z.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,y.jsxs)(y.Fragment,{children:[0===this.state.newslettersCount&&(0,y.jsx)(ct,{filter:e=>"notification"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"notification",base_url:"notification",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:xa,bulk_actions:_a,item_actions:Za,messages:wa,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,Xr._X)(e),(0,Xr.bF)(e)}})]})}}ja.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var Ia=(0,c.withRouter)(ja);const Sa=p.Z.trackingConfig.emailTrackingEnabled,Ca={onNoItemsFound:(e,t)=>p.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterTrashed"):p.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterDeleted"):p.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterRestored"):p.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},Ta=[{name:"subject",label:p.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:p.Z.I18n.t("settings")},{name:"statistics",label:p.Z.I18n.t("statistics"),display:Sa},{name:"status",label:p.Z.I18n.t("status"),width:145},{name:"updated_at",label:p.Z.I18n.t("lastModifiedOn"),sortable:!0}],ka=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:Ca.onTrash}];let Na=[{name:"view",link:function(e){return(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("preview")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:(e,t)=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{p.Z.Notice.success(p.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("edit"),onClick:Xr.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Na=(0,Xr.y8)(Na);class Da extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"updateStatus",((e,t)=>{t.persist(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&p.Z.Notice.success(p.Z.I18n.t("reEngagementEmailActivated")),this.forceUpdate()})).fail((n=>{p.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,Z.Z)(this,"renderStatus",(e=>{const t=p.Z.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString());return(0,y.jsxs)("div",{children:[(0,y.jsx)(Vt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,y.jsx)("p",{className:"mailpoet-listing-stats-description",children:(0,y.jsx)(l.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})})]})})),(0,Z.Z)(this,"renderSettings",(e=>{if(0===e.segments.length)return(0,y.jsx)(l.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:p.Z.I18n.t("sendingToSegmentsNotSpecified")});const t=k()(p.Z.I18n.t("sendTo"),"%1$s",((t,n)=>(0,y.jsx)(w,{segments:e.segments},n)));let n="reEngagementFrequencyMonth";e.options.afterTimeNumber>1&&"months"===e.options.afterTimeType?n="reEngagementFrequencyMonths":e.options.afterTimeNumber>1&&"weeks"===e.options.afterTimeType?n="reEngagementFrequencyWeeks":1===e.options.afterTimeNumber&&"weeks"===e.options.afterTimeType&&(n="reEngagementFrequencyWeek");const r=p.Z.I18n.t("reEngagementSettings").replace("{$count}",e.options.afterTimeNumber).replace("{$frequency}",p.Z.I18n.t(n));return(0,y.jsxs)("span",{children:[t,(0,y.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,y.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,y.jsx)($r,{})}),r]})]})})),(0,Z.Z)(this,"renderItem",((e,t)=>{const n=h()("manage-column","column-primary","has-row-actions");return(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:n,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("settings"),children:this.renderSettings(e)}),!0===Sa?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("statistics"),children:(0,y.jsx)(na,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("status"),children:this.renderStatus(e)}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("lastModifiedOn"),children:[p.Z.Date.short(e.updated_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.updated_at)]})]})})),(0,Z.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,y.jsxs)(y.Fragment,{children:[0===this.state.newslettersCount&&(0,y.jsx)(ct,{filter:e=>"re_engagement"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"re_engagement",base_url:"re_engagement",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Ta,bulk_actions:ka,item_actions:Na,messages:Ca,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,Xr._X)(e),(0,Xr.bF)(e)}})]})}}Da.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var Ea=(0,c.withRouter)(Da);const Oa=p.Z.trackingConfig.emailTrackingEnabled,Ra=[{name:"subject",label:p.Z.I18n.t("subject")},{name:"status",label:p.Z.I18n.t("status")},{name:"segments",label:p.Z.I18n.t("lists")},{name:"statistics",label:p.Z.I18n.t("statistics"),display:Oa},{name:"sent_at",label:p.Z.I18n.t("sentOn"),sortable:!0}],Aa={onNoItemsFound:(e,t)=>p.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterTrashed"):p.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterDeleted"):p.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterRestored"):p.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},Pa=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:Aa.onTrash}],Ma=(0,Xr.y8)([{name:"view",link:function(e){return(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("preview")})}},{name:"trash",className:"mailpoet-hide-on-mobile"}]),La=(e,t,n)=>{const r=h()("manage-column","column-primary","has-row-actions");return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("td",{className:r,children:[(0,y.jsx)("strong",{children:(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:e.queue.newsletter_rendered_subject||e.subject})}),t]}),(0,y.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":p.Z.I18n.t("status"),children:(0,y.jsx)(Hr,{newsletter:e,mailerLog:n.mta_log})}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("lists"),children:(0,y.jsx)(w,{segments:e.segments,dimension:"large"})}),!0===Oa?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("statistics"),children:(0,y.jsx)(na,{newsletter:e,currentTime:n.current_time})}):null,(0,y.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("sentOn"),children:e.sent_at?(0,y.jsxs)(y.Fragment,{children:[p.Z.Date.short(e.sent_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.sent_at)]}):null})]})};function Fa(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:"/notification",children:p.Z.I18n.t("backToPostNotifications")}),(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:e.location,params:{...e.match.params,parentId:e.parentId},endpoint:"newsletters",type:"notification_history",base_url:"notification/history/:parentId",onRenderItem:La,columns:Ra,messages:Aa,item_actions:Ma,bulk_actions:Pa,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{(0,Xr._X)(e),(0,Xr.bF)(e)}})]})}Fa.propTypes={parentId:g().string.isRequired,location:g().shape({pathname:g().string}).isRequired,match:g().shape({params:g().shape({id:g().node}).isRequired}).isRequired};var qa=(0,c.withRouter)(Fa);const $a=[{name:"subscriber_id",label:p.Z.I18n.t("subscriber"),sortable:!0},{name:"status",label:p.Z.I18n.t("sendingStatus")},{name:"failureReason",label:p.Z.I18n.t("failureReason")}],Ua={onNoItemsFound:()=>p.Z.I18n.t("noSendingTaskFound")};function Va(e){const[t,n]=(0,j.useState)({id:e.match.params.id,subject:"",sent:!1});return(0,j.useEffect)((()=>{p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:t.id}}).done((e=>n({id:t.id,subject:e.data.subject,sent:null!==e.data.sent_at}))).fail((e=>p.Z.Notice.showApiErrorNotice(e)))}),[t.id]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("h1",{children:p.Z.I18n.t("sendingStatusTitle")}),(0,y.jsx)(Ha,{newsletter:t}),(0,y.jsx)(Ba,{location:e.location,params:e.match.params})]})}Va.propTypes={location:g().shape({pathname:g().string}).isRequired,match:g().shape({params:g().shape({id:g().string.isRequired}).isRequired}).isRequired};const Wa=(e,t)=>e.location.pathname===t.location.pathname&&e.params.id===t.params.id,Ya=e=>(0,y.jsx)("div",{children:(0,y.jsx)(za,{...e})}),Ba=(0,j.memo)((e=>{let{location:t,params:n}=e;return(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:t,params:n,endpoint:"sending_task_subscribers",base_url:"sending-status/:id",onRenderItem:Ya,getListingItemKey:e=>`${e.taskId}-${e.subscriberId}`,columns:$a,messages:Ua,auto_refresh:!0,sort_by:"failed",sort_order:"desc",afterGetItems:e=>{(0,Xr._X)(e),(0,Xr.bF)(e)}})}),Wa);function Ha(e){let{newsletter:t}=e;return t.id&&t.subject&&t.sent?(0,y.jsx)("p",{children:(0,y.jsx)(l.rU,{to:`/stats/${t.id}`,children:t.subject})}):null}function za(e){let{error:t,failed:n,taskId:r,processed:a,email:s,subscriberId:i,lastName:o,firstName:l}=e;const c=h()("manage-column","column-primary","has-row-actions");let d=p.Z.I18n.t("unprocessed");return a&&(d=n?(0,y.jsxs)("span",{children:[p.Z.I18n.t("failed"),(0,y.jsx)("br",{}),(0,y.jsx)("a",{className:"button",href:"#",onClick:e=>{e.preventDefault(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sending_task_subscribers",action:"resend",data:{taskId:r,subscriberId:i}}).done((()=>window.mailpoet_listing.forceUpdate())).fail((e=>p.Z.Notice.showApiErrorNotice(e)))},children:p.Z.I18n.t("resend")})]}):p.Z.I18n.t("sent")),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("td",{"data-automation-id":`name_${r}_${i}`,className:c,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-subscribers#/edit/${i}`,children:s}),(0,y.jsx)("div",{className:"mailpoet-listing-subtitle",children:`${l} ${o}`})]}),(0,y.jsx)("td",{className:"column","data-automation-id":`status_${r}_${i}`,"data-colname":p.Z.I18n.t("sendingStatus"),children:d}),(0,y.jsx)("td",{className:"column","data-automation-id":`error_${r}_${i}`,"data-colname":p.Z.I18n.t("failureReason"),children:t})]})}Ba.propTypes={location:g().shape({pathname:g().string}).isRequired,params:g().shape({id:g().string.isRequired}).isRequired},Ha.propTypes={newsletter:g().shape({id:g().string,subject:g().string,sent:g().bool})},Ha.defaultProps={newsletter:{id:null,subject:null,sent:!1}},za.propTypes={error:g().string,email:g().string.isRequired,failed:g().number.isRequired,taskId:g().number.isRequired,lastName:g().string.isRequired,firstName:g().string.isRequired,processed:g().number.isRequired,subscriberId:g().number.isRequired},za.defaultProps={error:""};var Ka=Va;const Ga=p.Z.trackingConfig.emailTrackingEnabled,Qa=window.mailpoet_woocommerce_automatic_emails||{},Xa={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterTrashed"):p.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterDeleted"):p.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterRestored"):p.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},Ja=[{name:"subject",label:p.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:p.Z.I18n.t("settings")},{name:"statistics",label:p.Z.I18n.t("statistics"),display:Ga},{name:"status",label:p.Z.I18n.t("status"),width:145},{name:"updated_at",label:p.Z.I18n.t("lastModifiedOn"),sortable:!0}],es=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:Xa.onTrash}];let ts=[{name:"view",link:function(e){return(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("edit"),onClick:Xr.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:(e,t)=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{p.Z.Notice.success(p.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"trash",className:"mailpoet-hide-on-mobile"}];ts=(0,Xr.y8)(ts);class ns extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"updateStatus",((e,t)=>{t.persist(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{if("active"===e.data.status){const e=t.target.getAttribute("data-group"),n=Qa[e];p.Z.Notice.success(p.Z.I18n.t("automaticEmailActivated").replace("%1s",n.title))}this.forceUpdate()})).fail((n=>{p.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,Z.Z)(this,"renderStatus",(e=>{const t=parseInt(e.total_sent,10)>-1?p.Z.I18n.t("sentToXCustomers").replace("%1$d",e.total_sent.toLocaleString()):null;return(0,y.jsxs)("div",{children:[(0,y.jsx)(Vt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,"data-group":e.options.group,dimension:"small",defaultChecked:"active"===e.status}),(0,y.jsxs)("p",{className:"mailpoet-listing-notification-status",children:[t&&(0,y.jsx)(l.rU,{to:`/sending-status/${e.id}`,children:t}),!t&&(0,y.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small",children:p.Z.I18n.t("notSentYet")})]})]})})),(0,Z.Z)(this,"renderSettings",(e=>{const t=Qa[e.options.group].events[e.options.event];let n;try{n=JSON.parse(e.options.meta||null)}catch(t){n=e.options.meta||null}const r=n&&n.option?I.ZP.pluck(n.option,"name"):[];if(n&&I.ZP.isEmpty(r))return(0,y.jsx)("span",{className:"mailpoet-listing-error",children:p.Z.I18n.t("automaticEmailEventOptionsNotConfigured")});let a,s;if(a=r.length>1&&"listingScheduleDisplayTextPlural"in t?k()(t.listingScheduleDisplayTextPlural,"%s",((e,t)=>(0,y.jsx)(w,{strings:r},t))):k()(t.listingScheduleDisplayText,"%s",((e,t)=>(0,y.jsx)(w,{strings:r},t))),a&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":s=p.Z.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":s=p.Z.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":s=p.Z.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":s=p.Z.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:s=p.Z.I18n.t("sendingDelayInvalid")}return(0,y.jsxs)("span",{children:[a,s&&(0,y.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,y.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,y.jsx)($r,{})}),s]})]})})),(0,Z.Z)(this,"renderItem",((e,t)=>{const n=h()("manage-column","column-primary","has-row-actions");return(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:n,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("settings"),children:this.renderSettings(e)}),!0===Ga?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("statistics"),children:(0,y.jsx)(na,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("status"),children:this.renderStatus(e)}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("lastModifiedOn"),children:[p.Z.Date.short(e.updated_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.updated_at)]})]})})),(0,Z.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={eventCounts:{},newslettersCount:void 0},this.afterGetItems=this.afterGetItems.bind(this)}afterGetItems(e){(0,Xr._X)(e),this.countEmailTypes(e)}countEmailTypes(e){const t={woocommerce_product_purchased:0,woocommerce_product_purchased_in_category:0,woocommerce_first_purchase:0};if(Array.isArray(e.items)){const n=e.items.map((e=>e.options.event)).reduce(((e,t)=>(e[t]?e[t]+=1:e[t]=1,e)),t);this.setState({eventCounts:n})}}renderWarning(){const{eventCounts:e}=this.state;return e.woocommerce_product_purchased+e.woocommerce_product_purchased_in_category+e.woocommerce_first_purchase?"1"===window.mailpoet_woocommerce_optin_on_checkout?null:(0,y.jsxs)("div",{className:"notice error",children:[(0,y.jsx)("p",{children:p.Z.I18n.t("wooCommerceEmailsWarning")}),(0,y.jsx)("p",{children:(0,y.jsx)("a",{href:"?page=mailpoet-settings#woocommerce",children:p.Z.I18n.t("wooCommerceEmailsWarningLink")})})]}):null}render(){const{match:e,location:t}=this.props;return(0,y.jsxs)(y.Fragment,{children:[this.renderWarning(),0===this.state.newslettersCount&&(0,y.jsx)(ct,{filter:e=>"woocommerce"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:t,params:e.params,endpoint:"newsletters",type:"automatic",base_url:"woocommerce",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Ja,bulk_actions:es,item_actions:ts,messages:Xa,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}this.afterGetItems(e)}})]})}}ns.propTypes={match:g().shape({params:g().shape({tab:g().string}).isRequired}).isRequired,location:g().object.isRequired};var rs=(0,c.withRouter)(ns),as=function(){return(0,y.jsx)(y.Fragment,{children:(0,y.jsx)("style",{dangerouslySetInnerHTML:{__html:".wrap { margin: 0 !important; }"}})})},ss=n(4840),is=n(53681);const os=e=>{const t=e<.1?2:1;return p.Z.Num.toLocaleFixed(e,t)};function ls(e){let{newsletter:t,isWoocommerceActive:n}=e;const r=t.total_sent||0;let a=0,s=0,i=0,o=0,l=0;r>0&&(a=100*t.statistics.clicked/r,s=100*t.statistics.opened/r,i=100*t.statistics.machineOpened/r,o=100*t.statistics.unsubscribed/r,l=100*t.statistics.bounced/r);const c=os(a),d=os(s),u=os(i),m=os(o),h=os(l),f=r>=20&&t.statistics.opened>=5,g=(0,y.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,y.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[d,"% "]}),p.Z.I18n.t("percentageOpened")]}),v=(0,y.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,y.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[u,"% "]}),p.Z.I18n.t("percentageMachineOpened"),(0,y.jsx)($e.Z,{tooltip:k()(p.Z.I18n.t("percentageMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,y.jsx)("span",{style:{pointerEvents:"all"},children:(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/368-what-are-machine-opens",target:"_blank","data-beacon-article":"6124b7fb21ef206e5592e188",rel:"noopener noreferrer",children:e},"kb-link")},"machine-opened-tooltip")))})]}),b=(0,y.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,y.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[m,"% "]}),p.Z.I18n.t("percentageUnsubscribed")]}),w=(0,y.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,y.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[h,"% "]}),p.Z.I18n.t("percentageBounced")]}),x=Kr("clicked",a),_=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-statistics-value",children:[(0,y.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${x}`,children:[c,"% "]}),p.Z.I18n.t("percentageClicked")]}),f&&(0,y.jsx)(Gr,{isInverted:!1,stat:"clicked",rate:a,tooltipId:`clicked-${t.id||"0"}`,tooltipPlace:"right"})]});return(0,y.jsxs)("div",{className:"mailpoet-stats-general",children:[(0,y.jsxs)(_t.r.ThreeColumns,{className:"mailpoet-stats-general-top-row",children:[(0,y.jsx)("div",{children:(0,y.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[p.Z.I18n.t("statsTotalSent"),": ",(0,y.jsx)("span",{className:"mailpoet-statistics-value-number",children:r.toLocaleString()})]})}),(0,y.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:b}),(0,y.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:w})]}),(0,y.jsxs)(_t.r.ThreeColumns,{children:[(0,y.jsx)("div",{children:_}),(0,y.jsxs)("div",{className:"mailpoet-statistics-with-left-separator",children:[g,v]}),n&&(0,y.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:Ye().applyFilters("mailpoet_newsletters_revenues_stats",null,t.statistics.revenue)}),!n&&(0,y.jsx)("div",{})]}),(0,y.jsx)("p",{className:"mailpoet-stats-general-read-more",children:(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/190-whats-a-good-email-open-rate",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"58f671152c7d3a057f8858e8",children:p.Z.I18n.t("readMoreOnStats")})})]})}function cs(e){let{newsletter:t}=e;const n=t.queue.scheduled_at||t.queue.created_at;return(0,y.jsxs)(_t.r.ThreeColumns,{className:"mailpoet-stats-info",children:[(0,y.jsxs)("div",{className:"mailpoet-grid-span-two-columns",children:[(0,y.jsx)(je.Z,{level:1,children:t.subject}),(0,y.jsx)("div",{children:(0,y.jsxs)("b",{children:[p.Z.Date.short(n)," • ",p.Z.Date.time(n)]})}),Array.isArray(t.segments)&&t.segments.length&&(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{className:"mailpoet-stats-info-key",children:p.Z.I18n.t("statsToSegments")}),": ",(0,y.jsx)(w,{dimension:"large",segments:t.segments})]})]}),(0,y.jsxs)("div",{className:"mailpoet-stats-info-sender-preview",children:[(0,y.jsxs)("div",{children:[(0,y.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,y.jsxs)("span",{className:"mailpoet-stats-info-key",children:[p.Z.I18n.t("statsFromAddress"),": "]}),t.sender_address?t.sender_address:"-"]}),(0,y.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,y.jsxs)("span",{className:"mailpoet-stats-info-key",children:[p.Z.I18n.t("statsReplyToAddress"),": "]}),t.reply_to_address?t.reply_to_address:"-"]}),(0,y.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,y.jsxs)("span",{className:"mailpoet-stats-info-key",children:[p.Z.I18n.t("googleAnalytics"),": "]}),t.ga_campaign?t.ga_campaign:"-"]})]}),(0,y.jsx)("div",{children:(0,y.jsx)(Ce.Button,{href:t.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("statsPreviewNewsletter")})})]})]})}function ds(){const e=(0,y.jsx)(v.Z,{href:p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount,p.Z.currentWpUserEmail,"starter",{utm_medium:"stats",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("premiumBannerCtaFree")}),t=(0,y.jsxs)("p",{children:[p.Z.I18n.t("premiumBannerDescription")," ",(0,y.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",children:p.Z.I18n.t("learnMore")}),"."]});return(0,y.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,y.jsx)(Be.Z,{title:p.Z.I18n.t("premiumFeature"),message:t,actionButton:e})})}var us=function(){if(!window.mailpoet_display_detailed_stats)return(0,y.jsx)(ds,{});if(window.mailpoet_subscribers_limit_reached){const e=window.mailpoet_has_valid_api_key,t=p.Z.I18n.t("upgradeRequired"),n=p.Z.I18n.t(e?"newsletterYourPlanLimit":"newsletterFreeVersionLimit").replace("[subscribersLimit]",window.mailpoet_subscribers_limit).replace("[subscribersCount]",window.mailpoet_subscribers_count),r=e?"https://account.mailpoet.com/upgrade":`https://account.mailpoet.com/?s=${window.mailpoet_subscribers_count+1}`;return(0,y.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,y.jsx)(Be.Z,{title:t,message:(0,y.jsx)("p",{children:n}),actionButton:(0,y.jsx)(v.Z,{target:"_blank",rel:"noopener noreferrer",href:r,children:p.Z.I18n.t("upgradeNow")})})})}return null},ps=(0,c.withRouter)((function(e){let{match:t,history:n,location:r}=e;const[a,s]=(0,j.useState)({item:void 0,loading:!0}),i=(0,j.useCallback)((e=>{s({loading:!0,item:a.item}),p.Z.Modal.loading(!0),p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:window.mailpoet_display_detailed_stats?"stats":"newsletters",action:window.mailpoet_display_detailed_stats?"get":"getWithStats",data:{id:e}}).always((()=>{p.Z.Modal.loading(!1)})).done((e=>{s({loading:!1,item:e.data})})).fail((e=>{p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0}),s({loading:!1}),n.push("/")}))}),[n,a.item]);(0,j.useEffect)((()=>{window.scrollTo(0,0),a.item?.id!==t.params.id&&i(t.params.id)}),[t.params.id,i,a.item]);const{item:o,loading:l}=a,c=o;return l?null:c?.subject&&!c?.queue?(0,y.jsx)("div",{children:(0,y.jsx)(je.Z,{level:1,children:c.subject})}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(De.Z,{}),(0,y.jsx)(as,{}),(0,y.jsx)(F.Q,{}),(0,y.jsxs)("div",{className:"mailpoet-stats-page",children:[(0,y.jsx)(E,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,y.jsx)(cs,{newsletter:c}),(0,y.jsx)(ls,{newsletter:c,isWoocommerceActive:p.Z.isWoocommerceActive}),(0,y.jsxs)(ss.Z,{activeKey:"clicked",children:[(0,y.jsx)(is.Z,{title:p.Z.I18n.t("clickedLinks"),children:Ye().applyFilters("mailpoet_newsletters_clicked_links_table",(0,y.jsx)(us,{}),c.clicked_links)},"clicked"),Ye().applyFilters("mailpoet_newsletters_purchased_products",null,c),(0,y.jsx)(is.Z,{title:p.Z.I18n.t("subscriberEngagement"),children:Ye().applyFilters("mailpoet_newsletters_subscriber_engagement",(0,y.jsx)(us,{}),r,t.params,c)},"engagement"),(0,y.jsx)(is.Z,{title:p.Z.I18n.t("bounces"),automationId:"bounces-tab",children:Ye().applyFilters("mailpoet_newsletters_bounces",(0,y.jsx)(us,{}),r,t.params)},"bounces")]})]})]})})),ms=n(48228),hs=n(97762),fs=n(87903),gs=n.n(fs);function vs(e){const t=e.installedDaysAgo,n=t>30?p.Z.I18n.t("reviewRequestUsingForMonths").replace("[months]",Math.round(t/30)):p.Z.I18n.t("reviewRequestUsingForDays").replace("[days]",t);return(0,y.jsxs)("div",{className:"mailpoet_review_request",children:[(0,y.jsx)("img",{src:e.reviewRequestIllustrationUrl,height:"280",width:"280",alt:""}),(0,y.jsx)("h2",{children:p.Z.I18n.t("reviewRequestHeading")}),(0,y.jsx)("p",{children:p.Z.I18n.t("reviewRequestDidYouKnow").replace("[username]",e.username)}),(0,y.jsx)("p",{children:n}),(0,y.jsx)("p",{children:(0,y.jsx)("a",{href:"http://bit.ly/2Bi124o",target:"_blank",rel:"noopener noreferrer",className:"button button-primary",children:p.Z.I18n.t("reviewRequestRateUsNow")})}),(0,y.jsx)("p",{children:(0,y.jsx)("a",{id:"mailpoet_review_request_not_now",children:p.Z.I18n.t("reviewRequestNotNow")})})]})}vs.propTypes={installedDaysAgo:g().number.isRequired,reviewRequestIllustrationUrl:g().string.isRequired,username:g().string.isRequired};var bs=vs;let ys=null;const ws=()=>((0,j.useLayoutEffect)((()=>{window.mailpoet_display_nps_poll&&p.Z.libs3rdPartyEnabled&&(ys||(ys=p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"analytics",action:"getTrackingData"})),ys).then((e=>{let{data:t}=e;return(e=>{let t;t=window.mailpoet_display_nps_form?"EqOgKsgZd832Sz9w":window.mailpoet_is_new_user?"6L479eVPXk7pBn6S":"k0aJAsQAWI2ERyGv",gs()({writeKey:t,userId:window.mailpoet_current_wp_user.ID+window.mailpoet_site_url,traits:{name:window.mailpoet_current_wp_user.user_nicename,email:window.mailpoet_current_wp_user.user_email,mailpoetVersion:window.mailpoet_version,mailpoetPremiumIsActive:window.mailpoet_premium_active,createdAt:e.installedAtIso,newslettersSent:e.newslettersSent,welcomeEmails:e.welcomeEmails,postnotificationEmails:e.postnotificationEmails,woocommerceEmails:e.woocommerceEmails,subscribers:e.subscribers,lists:e.lists,sendingMethod:e.sendingMethod,woocommerceIsInstalled:e.woocommerceIsInstalled},events:{submit:e=>{e.rating>=9&&e.completed&&p.Z.Modal.popup({width:800,template:hs.renderToString(bs({username:window.mailpoet_current_wp_user_firstname||window.mailpoet_current_wp_user.user_login,reviewRequestIllustrationUrl:window.mailpoet_review_request_illustration_url,installedDaysAgo:window.mailpoet_installed_days_ago})),onInit:()=>{document.getElementById("mailpoet_review_request_not_now").addEventListener("click",(()=>p.Z.Modal.close()))}})}}})})(t)}))}),[]),null);var xs=e=>function(t){return ws(),(0,y.jsx)(e,{...t})},_s=function(){return(0,y.jsx)(F.Q,{children:(0,y.jsxs)(l.rU,{id:"mailpoet-new-email",className:"mailpoet-button button-secondary",to:"/new",onClick:()=>p.Z.trackEvent("Emails > Add New"),"data-automation-id":"new_email",children:[q,(0,y.jsx)("span",{children:p.Z.I18n.t("new")})]})})},Zs=(0,c.withRouter)((function(e){let{children:t,location:n}=e;return null!==(0,dt.X)(n)||(e=>e.hash.match(/^#\/new/)||e.pathname.match(/^\/new/))(n)?null:t})),js=function(e){let{mailpoetInstalledDaysAgo:t,sendTransactionalEmails:n,mtaMethod:r,noticeDismissed:a,apiVersion:s}=e;const[i,o]=(0,j.useState)(!1),l=()=>{p.Z.Ajax.post({api_version:s,endpoint:"UserFlags",action:"set",data:{transactional_emails_opt_in_notice_dismissed:"1"}})};return t<30||n||"PHPMail"===r||"1"===a||i?null:(0,y.jsxs)(N.Z,{type:"success",timeout:!1,onClose:l,children:[(0,y.jsx)("h3",{children:p.Z.I18n.t("transactionalEmailNoticeTitle")}),(0,y.jsxs)("p",{children:[p.Z.I18n.t("transactionalEmailNoticeBody")," ",(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/292-choose-how-to-send-your-wordpress-websites-emails",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("transactionalEmailNoticeBodyReadMore")})]}),(0,y.jsx)("p",{children:(0,y.jsx)("button",{type:"button",className:"button",onClick:()=>{o(!0),p.Z.Ajax.post({api_version:s,endpoint:"settings",action:"set",data:{send_transactional_emails:"1"}}),l()},children:p.Z.I18n.t("transactionalEmailNoticeCTA")})})]})};const Is=window.mailpoet_woocommerce_automatic_emails||[],Ss=xs((()=>{const{parentId:e}=(0,c.useParams)();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Zs,{children:(0,y.jsx)(_s,{})}),(0,y.jsxs)(ms.Z,{activeKey:"standard",routerType:"switch-only",onSwitch:e=>(e=>p.Z.trackEvent(`Tab Emails > ${e} clicked`))(e),automationId:"newsletters_listing_tabs",children:[(0,y.jsx)(is.Z,{route:"standard/(.*)?",title:p.Z.I18n.t("tabStandardTitle"),automationId:`tab-${p.Z.I18n.t("tabStandardTitle")}`,children:(0,y.jsx)(da,{})},"standard"),(0,y.jsx)(is.Z,{route:"welcome/(.*)?",title:p.Z.I18n.t("tabWelcomeTitle"),automationId:`tab-${p.Z.I18n.t("tabWelcomeTitle")}`,children:(0,y.jsx)(ya,{})},"welcome"),(0,y.jsx)(is.Z,{route:"notification/(.*)?",title:p.Z.I18n.t("tabNotificationTitle"),automationId:`tab-${p.Z.I18n.t("tabNotificationTitle")}`,children:e?(0,y.jsx)(qa,{parentId:e}):(0,y.jsx)(Ia,{})},"notification"),(0,y.jsx)(is.Z,{route:"re_engagement/(.*)?",title:p.Z.I18n.t("tabReEngagementTitle"),automationId:`tab-${p.Z.I18n.t("tabReEngagementTitle")}`,children:(0,y.jsx)(Ea,{})},"re_engagement"),window.mailpoet_woocommerce_active&&I.ZP.map(Is,(e=>(0,y.jsx)(is.Z,{route:`${e.slug}/(.*)?`,title:e.title,automationId:`tab-${e.title}`,children:(0,y.jsx)(rs,{})},e.slug)))]})]})}));function Cs(e){let{history:t}=e;return(0,y.jsx)(ct,{history:t,hideClosingButton:0===window.mailpoet_newsletters_count})}Cs.propTypes={history:g().shape({push:g().func.isRequired}).isRequired};const Ts=[...(()=>{const e=[];return I.ZP.each(Is,(t=>{e.push({path:`/${t.slug}/(.*)?`,component:Ss});const{events:n}=t;I.ZP.isObject(n)&&I.ZP.each(n,(n=>{e.push({path:`/new/${t.slug}/${n.slug}/conditions`,render:e=>{const r={...e,email:t,name:n.slug};return(0,y.jsx)(Tr,{...r})}})})),e.push({path:`/new/${t.slug}`,render:e=>{const n={...e,email:t};return(0,y.jsx)(rt,{...n})}})})),e})(),{path:"/notification/history/:parentId/(.*)?",component:Ss},{path:"/(standard|welcome|notification|re_engagement)/(.*)?",component:Ss},{path:"/new/standard",component:wr},{path:"/new/notification",component:Zr},{path:"/new/welcome",component:Sr},{path:"/new/re-engagement",component:function(){let e="";p.Z.settings.deactivate_subscriber_after_inactive_days&&(e=(Math.floor(Number(p.Z.settings.deactivate_subscriber_after_inactive_days)/30)-1).toString());const[t,n]=(0,j.useState)({afterTimeNumber:e,afterTimeType:"months"}),[r,a]=(0,j.useState)([]),[s,i]=(0,j.useState)(!1),o=(0,c.useHistory)();return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),r&&(0,y.jsx)(it,{errors:r}),(0,y.jsx)(ut,{emailType:"re_engagement",automationId:"re_engagement_heading_creation_heading"}),(0,y.jsxs)(_t.r.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,y.jsx)(Ln,{afterTimeNumber:t.afterTimeNumber,afterTimeType:t.afterTimeType,inactiveSubscribersPeriod:Number(p.Z.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:(0,Pn.compose)([n,(0,Pn.assoc)("afterTimeNumber",Pn.__,t)]),updateAfterTimeType:(0,Pn.compose)([n,(0,Pn.assoc)("afterTimeType",Pn.__,t)])}),(0,y.jsx)(v.Z,{isFullWidth:!0,onClick:()=>(a([]),i(!0),void p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"newsletters",action:"create",data:{type:"re_engagement",subject:p.Z.I18n.t("draftNewsletterTitle"),options:t}}).done((e=>{var t;t=e.data.id,o.push(`/template/${t}`)})).fail((e=>{i(!1),e.errors&&a(e.errors)}))),type:"button",isDisabled:!t.afterTimeNumber||s,withSpinner:s,children:p.Z.I18n.t("next")})]})]})}},{path:"/new",component:Cs},{name:"template",path:"/template/:id",component:xt},{path:"/send/congratulate/:id",component:br},{path:"/send/:id",component:zn},{path:"/sending-status/:id/(.*)?",component:Ka},{path:"/stats/:id/(.*)?",component:ps}];function ks(){return(0,y.jsx)(Fe.k.Provider,{value:(0,Fe.S)(window),children:(0,y.jsxs)(l.UT,{children:[(0,y.jsx)(Ge.Z,{}),(0,y.jsx)(D,{}),(0,y.jsx)(R,{}),(0,y.jsx)(js,{mailpoetInstalledDaysAgo:window.mailpoet_installed_days_ago,sendTransactionalEmails:window.mailpoet_send_transactional_emails,mtaMethod:window.mailpoet_mta_method,apiVersion:window.mailpoet_api_version,noticeDismissed:window.mailpoet_transactional_emails_opt_in_notice_dismissed}),(0,y.jsx)(E,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,y.jsxs)(c.Switch,{children:[(0,y.jsx)(c.Route,{exact:!0,path:"/",render:()=>(0,y.jsx)(c.Redirect,{to:0===window.mailpoet_newsletters_count?"/new":"/standard"})}),Ts.map((e=>(0,y.jsx)(c.Route,{path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render},e.path)))]})]})})}const Ns=document.getElementById("newsletters_container");Ns&&(window.mailpoet_listing=o().render((0,y.jsx)(ks,{}),Ns));const Ds=e=>"wp_users"===e.type,Es=e=>"woocommerce_users"===e.type,Os=e=>Ds(e)||Es(e),Rs=p.Z.trackingConfig.emailTrackingEnabled,As=[{name:"name",label:p.Z.I18n.t("name"),sortable:!0},{name:"description",label:p.Z.I18n.t("description")},{name:"average_subscriber_score",label:p.Z.I18n.t("listScore"),display:Rs},{name:"subscribed",label:p.Z.I18n.t("subscribed"),className:"mailpoet-listing-column-narrow"},{name:"unconfirmed",label:p.Z.I18n.t("unconfirmed"),className:"mailpoet-listing-column-narrow"},{name:"unsubscribed",label:p.Z.I18n.t("unsubscribed"),className:"mailpoet-listing-column-narrow"},{name:"inactive",label:p.Z.I18n.t("inactive"),className:"mailpoet-listing-column-narrow"},{name:"bounced",label:p.Z.I18n.t("bounced"),className:"mailpoet-listing-column-narrow"},{name:"created_at",label:p.Z.I18n.t("createdOn"),sortable:!0}],Ps={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneSegmentTrashed"):p.Z.I18n.t("multipleSegmentsTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneSegmentDeleted"):p.Z.I18n.t("multipleSegmentsDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneSegmentRestored"):p.Z.I18n.t("multipleSegmentsRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},Ms=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:Ps.onTrash}],Ls=e=>!Os(e),Fs=[{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return(0,y.jsx)(l.rU,{to:`/edit/${e.id}`,children:p.Z.I18n.t("edit")})},display:function(e){return!Os(e)}},{name:"duplicate_segment",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:(e,t)=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"duplicate",data:{id:e.id}}).done((e=>{p.Z.Notice.success(p.Z.I18n.t("listDuplicated").replace("%1$s",e.data.name)),t()})).fail((e=>{p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),display:function(e){return!Os(e)}},{name:"read_more",className:"mailpoet-hide-on-mobile",link:function(){return(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/133-the-wordpress-users-list",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("readMore")})},display:function(e){return Ds(e)}},{name:"synchronize_segment",label:p.Z.I18n.t("forceSync"),onClick:function(e,t){p.Z.Modal.loading(!0),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"synchronize",data:{type:e.type}}).done((()=>{let n=p.Z.I18n.t("listSynchronized").replace("%1$s",e.name);"woocommerce_users"===e.type&&(n=p.Z.I18n.t("listSynchronizationWasScheduled").replace("%1$s",e.name)),p.Z.Modal.loading(!1),p.Z.Notice.success(n),t()})).fail((e=>{p.Z.Modal.loading(!1),e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},display:function(e){return Ds(e)||Es(e)}},{name:"view_subscribers",link:function(e){return(0,y.jsx)("a",{href:e.subscribers_url,"data-automation-id":`view_subscribers_${e.name}`,children:p.Z.I18n.t("viewSubscribers")})}},{name:"trash",className:"mailpoet-hide-on-mobile",display:function(e){return!Es(e)}}];class qs extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"renderItem",((e,t)=>{const n=h()("manage-column","column-primary","has-row-actions"),r=Number(e.subscribers_count.subscribed||0),a=Number(e.subscribers_count.unconfirmed||0),s=Number(e.subscribers_count.unsubscribed||0),i=Number(e.subscribers_count.inactive||0),o=Number(e.subscribers_count.bounced||0);let c;return c=Os(e)?(0,y.jsx)("span",{className:"mailpoet-listing-title",children:e.name}):(0,y.jsx)(l.rU,{className:"mailpoet-listing-title",to:`/edit/${e.id}`,children:e.name}),(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:n,"data-automation-id":`segment_name_${e.name}`,children:[c,t]}),(0,y.jsx)("td",{"data-colname":p.Z.I18n.t("description"),children:(0,y.jsx)("abbr",{children:e.description})}),Rs?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("averageScore"),children:(0,y.jsx)("div",{className:"mailpoet-listing-stats",children:(0,y.jsx)(W,{id:e.id,engagementScore:e.average_engagement_score})})}):null,(0,y.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("subscribed"),children:(0,y.jsx)("abbr",{children:r.toLocaleString()})}),(0,y.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("unconfirmed"),children:(0,y.jsx)("abbr",{children:a.toLocaleString()})}),(0,y.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("unsubscribed"),children:(0,y.jsx)("abbr",{children:s.toLocaleString()})}),(0,y.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("inactive"),children:(0,y.jsx)("abbr",{children:i.toLocaleString()})}),(0,y.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("bounced"),children:(0,y.jsx)("abbr",{children:o.toLocaleString()})}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("createdOn"),children:[p.Z.Date.short(e.created_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.created_at)]})]})}))}render(){return(0,y.jsx)("div",{className:"mailpoet-segments-listing",children:(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:Ps,search:!1,endpoint:"segments",base_url:"lists",onRenderItem:this.renderItem,columns:As,bulk_actions:Ms,item_actions:Fs,sort_by:"name",sort_order:"asc",isItemDeletable:Ls,isItemToggleable:Ds})})}}qs.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var $s=(0,c.withRouter)(qs);const Us=[{name:"name",label:p.Z.I18n.t("name"),type:"text"},{name:"description",label:p.Z.I18n.t("description"),type:"textarea",tip:p.Z.I18n.t("segmentDescriptionTip")}],Vs={onUpdate:function(){p.Z.Notice.success(p.Z.I18n.t("segmentUpdated"))},onCreate:function(){p.Z.Notice.success(p.Z.I18n.t("segmentAdded")),p.Z.trackEvent("Lists > Add new")}};function Ws(e){return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(De.Z,{}),(0,y.jsxs)(je.Z,{level:1,className:"mailpoet-title",children:[(0,y.jsx)("span",{children:p.Z.I18n.t("segment")}),(0,y.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:"/",children:p.Z.I18n.t("backToList")})]}),(0,y.jsx)(D,{}),(0,y.jsx)(ke,{endpoint:"segments",fields:Us,params:e.match.params,messages:Vs})]})}Ws.propTypes={match:g().shape({params:g().shape({id:g().string}).isRequired}).isRequired};var Ys=Ws,Bs=n(41882),Hs=n(94878),zs=n(1030),Ks=n(96486),Gs=n.n(Ks),Qs=n(66067);function Xs(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[])?.map((e=>{const t=e.sent_at?p.Z.Date.format(e.sent_at):p.Z.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}}));return(0,j.useEffect)((()=>{n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t),n.action===Qs.EmailActionTypes.MACHINE_OPENED&&n.operator===Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t)}),[n.action,n.operator,t,r]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{isFullWidth:!0,value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),n.action!==Qs.EmailActionTypes.MACHINE_OPENED?(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")}):null]},"select")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:p.Z.I18n.t("selectNewsletterPlaceholder"),options:s,automationId:"segment-email",value:(0,Pn.filter)((e=>{if(!n.newsletters)return;const t=e.value;return-1!==n.newsletters.indexOf(t)}),s),onChange:e=>{r({newsletters:(0,Pn.map)("value",e)},t)}})})]})}const Js=e=>!!e;function ei(e){return p.Z.I18n.t("emailActionOpensDaysSentence").split(/({days})/gim).map(e)}function ti(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");return(0,j.useEffect)((()=>{void 0===n.operator&&r({operator:"more"},t)}),[r,n,t]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(s=e=>"{condition}"===e?(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,y.jsx)("option",{value:"more",children:p.Z.I18n.t("moreThan")}),(0,y.jsx)("option",{value:"less",children:p.Z.I18n.t("lessThan")}),(0,y.jsx)("option",{value:"equals",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"not_equals",children:p.Z.I18n.t("notEquals")})]},"select"):"{opens}"===e?(0,y.jsx)(ae.Z,{type:"number",value:n.opens||"","data-automation-id":"segment-number-of-opens",onChange:e=>{a("opens",t,e)},min:"0",placeholder:p.Z.I18n.t("emailActionOpens")},"input"):"string"==typeof e&&e.trim().length>1?(0,y.jsx)("div",{children:e},"opens"):null,p.Z.I18n.t("emailActionOpensSentence").split(/({condition})|({opens})|(\b[a-zA-Z]+\b)/gim).map(s))}),(0,y.jsx)(_t.r.CenteredRow,{children:ei((e=>"{days}"===e?(0,y.jsx)(ae.Z,{type:"number",value:n.days||"","data-automation-id":"segment-number-of-days",onChange:e=>{a("days",t,e)},min:"0",placeholder:p.Z.I18n.t("emailActionDays")},"input"):"string"==typeof e&&e.trim().length>1?(0,y.jsx)("div",{children:e},e):null))})]});var s}const ni=[{value:Qs.EmailActionTypes.OPENS_ABSOLUTE_COUNT,label:p.Z.I18n.t("emailActionOpensAbsoluteCount"),group:Qs.SegmentTypes.Email},{value:Qs.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT,label:p.Z.I18n.t("emailActionMachineOpensAbsoluteCount"),group:Qs.SegmentTypes.Email},{value:Qs.EmailActionTypes.OPENED,label:p.Z.I18n.t("emailActionOpened"),group:Qs.SegmentTypes.Email},{value:Qs.EmailActionTypes.MACHINE_OPENED,label:p.Z.I18n.t("emailActionMachineOpened"),group:Qs.SegmentTypes.Email},{value:Qs.EmailActionTypes.CLICKED,label:p.Z.I18n.t("emailActionClicked"),group:Qs.SegmentTypes.Email},{value:Qs.EmailActionTypes.CLICKED_ANY,label:p.Z.I18n.t("emailActionClickedAnyEmail"),group:Qs.SegmentTypes.Email}],ri={[Qs.EmailActionTypes.OPENS_ABSOLUTE_COUNT]:ti,[Qs.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT]:ti,[Qs.EmailActionTypes.CLICKED]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),[i,o]=(0,j.useState)([]),[l,c]=(0,j.useState)([]),[d,u]=(0,j.useState)(!1),m=s?.map((e=>{const t=e.sent_at?p.Z.Date.format(e.sent_at):p.Z.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}})),h=(0,j.useCallback)((()=>{var e;Js(n.newsletter_id)&&(c([]),e=n.newsletter_id,o([]),u(!0),p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"newsletter_links",action:"get",data:{newsletterId:e}}).then((e=>{const{data:t}=e,n=t.map((e=>({value:e.id,label:e.url})));u(!1),c(n)})).fail((e=>{o(e.errors)})))}),[n.newsletter_id]);return(0,j.useEffect)((()=>{h()}),[h,n.newsletter_id]),(0,j.useEffect)((()=>{n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t)}),[n.operator,t,r]),(0,y.jsxs)(y.Fragment,{children:[i.length>0&&(0,y.jsx)(it,{errors:i}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectNewsletterPlaceholder"),options:m,value:(0,Pn.find)(["value",n.newsletter_id],m),onChange:e=>{r({newsletter_id:e.value,link_ids:[]},t)},automationId:"segment-email"})}),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{isMinWidth:!0,value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select-operator"),d&&(0,y.jsx)("span",{children:p.Z.I18n.t("loadingDynamicSegmentItems")}),!d&&Js(n.newsletter_id)&&(0,y.jsx)(zs.Z,{isMulti:!0,dimension:"small",isFullWidth:!0,automationId:"segment-link-select",placeholder:p.Z.I18n.t("allLinksPlaceholder"),options:l.length?l:[{value:0,label:p.Z.I18n.t("noLinksHint"),isDisabled:!0}],value:(0,Pn.filter)((e=>!!n.link_ids&&-1!==n.link_ids.indexOf(e.value)),l),onChange:e=>{r({link_ids:(e||[]).map((e=>e.value))},t)}})]})]})},[Qs.EmailActionTypes.OPENED]:Xs,[Qs.EmailActionTypes.MACHINE_OPENED]:Xs,[Qs.EmailActionTypes.CLICKED_ANY]:null};var ai;!function(e){e.NUMBER_OF_ORDERS="numberOfOrders",e.PURCHASED_CATEGORY="purchasedCategory",e.PURCHASED_PRODUCT="purchasedProduct",e.TOTAL_SPENT="totalSpent",e.CUSTOMER_IN_COUNTRY="customerInCountry"}(ai||(ai={}));const si=[{value:ai.CUSTOMER_IN_COUNTRY,label:p.Z.I18n.t("wooCustomerInCountry"),group:Qs.SegmentTypes.WooCommerce},{value:ai.NUMBER_OF_ORDERS,label:p.Z.I18n.t("wooNumberOfOrders"),group:Qs.SegmentTypes.WooCommerce},{value:ai.PURCHASED_CATEGORY,label:p.Z.I18n.t("wooPurchasedCategory"),group:Qs.SegmentTypes.WooCommerce},{value:ai.PURCHASED_PRODUCT,label:p.Z.I18n.t("wooPurchasedProduct"),group:Qs.SegmentTypes.WooCommerce},{value:ai.TOTAL_SPENT,label:p.Z.I18n.t("wooTotalSpent"),group:Qs.SegmentTypes.WooCommerce}],ii=[ai.PURCHASED_PRODUCT,ai.PURCHASED_CATEGORY];function oi(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");(0,j.useEffect)((()=>{n.action===Qs.SubscriberActionTypes.WORDPRESS_ROLE&&n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t)}),[r,n,t]);const s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getWordpressRoles()),[]).map((e=>({value:e.role_id,label:e.role_name})));return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{isFullWidth:!0,value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,automationId:"segment-wordpress-role",placeholder:p.Z.I18n.t("selectUserRolePlaceholder"),options:s,value:(0,Pn.filter)((e=>{if(n.wordpressRole)return-1!==n.wordpressRole.indexOf(e.value)}),s),onChange:e=>{r({wordpressRole:(0,Pn.map)("value",e)},t)}})})]})}let li;!function(e){e.HIGHER_THAN="higherThan",e.LOWER_THAN="lowerThan",e.EQUALS="equals",e.NOT_EQUALS="not_equals",e.UNKNOWN="unknown",e.NOT_UNKNOWN="not_unknown"}(li||(li={}));const ci=[li.HIGHER_THAN,li.LOWER_THAN,li.EQUALS,li.NOT_EQUALS,li.UNKNOWN,li.NOT_UNKNOWN];var di=n(23855),ui=n(12274);let pi;!function(e){e.BEFORE="before",e.AFTER="after",e.ON="on",e.NOT_ON="notOn",e.IN_THE_LAST="inTheLast",e.NOT_IN_THE_LAST="notInTheLast"}(pi||(pi={}));const mi=[pi.BEFORE,pi.AFTER,pi.ON,pi.NOT_ON,pi.IN_THE_LAST,pi.NOT_IN_THE_LAST],hi=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return p.Z.Date.format(e,{format:"Y-m-d"})}},fi=e=>{const t=(0,di.default)(e);if((0,ui.default)(t))return t};function gi(e){return"string"==typeof e.value&&e.value.length>0&&("equals"===e.operator||"contains"===e.operator||"not_equals"===e.operator||"more_than"===e.operator||"less_than"===e.operator)}function vi(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:r,updateSegmentFilter:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");return(0,j.useEffect)((()=>{void 0===n.operator&&a({operator:"equals",value:""},t)}),[a,n,t]),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{automationId:"text-custom-field-operator",value:n.operator,onChange:e=>{r("operator",t,e)},children:[(0,y.jsx)("option",{value:"equals",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"not_equals",children:p.Z.I18n.t("notEquals")}),(0,y.jsx)("option",{value:"contains",children:p.Z.I18n.t("contains")}),(0,y.jsx)("option",{value:"more_than",children:p.Z.I18n.t("moreThan")}),(0,y.jsx)("option",{value:"less_than",children:p.Z.I18n.t("lessThan")})]},"select"),(0,y.jsx)(ae.Z,{"data-automation-id":"text-custom-field-value",value:n.value||"",onChange:e=>{r("value",t,e)},placeholder:p.Z.I18n.t("value")},"input")]})}function bi(e){return"string"==typeof e.value&&e.value.length>0}function yi(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),a=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),s=(0,Pn.find)({id:Number(n.custom_field_id)},a);if(!s)return null;const i=s.params;if(!i||!Array.isArray(i.values))return null;const o=i.values.map((e=>({value:e.value,label:e.value})));return(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectValue"),options:o,value:n.value?{value:n.value,label:n.value}:null,onChange:e=>{r({value:e.value,operator:"equals"},t)},automationId:"segment-wordpress-role"})}var wi=n(95570),xi=n(49546);const _i=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return(0,xi.default)(e,"yyyy-MM-dd 00:00:00")}},Zi=e=>{const t=(0,di.default)(e);if((0,ui.default)(t))return t},ji={month:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,j.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Pn.assign)(n,{value:"2017-01-01 00:00:00"}),r)}),[t,n,r]),(0,y.jsxs)(de.Z,{value:n.value,onChange:e=>{t((0,Pn.assign)(n,{value:e.target.value}),r)},children:[(0,y.jsx)("option",{value:"2017-01-01 00:00:00",children:p.Z.I18n.t("january")}),(0,y.jsx)("option",{value:"2017-02-01 00:00:00",children:p.Z.I18n.t("february")}),(0,y.jsx)("option",{value:"2017-03-01 00:00:00",children:p.Z.I18n.t("march")}),(0,y.jsx)("option",{value:"2017-04-01 00:00:00",children:p.Z.I18n.t("april")}),(0,y.jsx)("option",{value:"2017-05-01 00:00:00",children:p.Z.I18n.t("may")}),(0,y.jsx)("option",{value:"2017-06-01 00:00:00",children:p.Z.I18n.t("june")}),(0,y.jsx)("option",{value:"2017-07-01 00:00:00",children:p.Z.I18n.t("july")}),(0,y.jsx)("option",{value:"2017-08-01 00:00:00",children:p.Z.I18n.t("august")}),(0,y.jsx)("option",{value:"2017-09-01 00:00:00",children:p.Z.I18n.t("september")}),(0,y.jsx)("option",{value:"2017-10-01 00:00:00",children:p.Z.I18n.t("october")}),(0,y.jsx)("option",{value:"2017-11-01 00:00:00",children:p.Z.I18n.t("november")}),(0,y.jsx)("option",{value:"2017-12-01 00:00:00",children:p.Z.I18n.t("december")})]},"select")},year:function(e){let{onChange:t,item:n,filterIndex:r}=e;const a=(0,wi.default)(new Date);return(0,j.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Pn.assign)(n,{value:`${a}-01-01 00:00:00`,operator:"equals"}),r)}),[a,t,n,r]),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>{t((0,Pn.assign)(n,{operator:e.target.value}),r)},children:[(0,y.jsx)("option",{value:"equals",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"before",children:p.Z.I18n.t("before")}),(0,y.jsx)("option",{value:"after",children:p.Z.I18n.t("after")})]},"select-operator"),(0,y.jsx)(de.Z,{value:n.value,onChange:e=>{t((0,Pn.assign)(n,{value:e.target.value}),r)},children:(0,Pn.range)(0,100).map((e=>(0,y.jsx)("option",{value:a-e+"-01-01 00:00:00",children:a-e},a-e)))},"select-year")]})},year_month:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,j.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Pn.assign)(n,{value:`${(0,xi.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),r)}),[t,n,r]),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>{t((0,Pn.assign)(n,{operator:e.target.value}),r)},children:[(0,y.jsx)("option",{value:"equals",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"before",children:p.Z.I18n.t("before")}),(0,y.jsx)("option",{value:"after",children:p.Z.I18n.t("after")})]},"select-operator"),(0,y.jsx)(It,{onChange:e=>t((0,Pn.assign)(n,{value:_i(e)}),r),selected:n.value?Zi(n.value):void 0,dateFormat:"MM/yyyy",showMonthYearPicker:!0})]})},year_month_day:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,j.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Pn.assign)(n,{value:`${(0,xi.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),r)}),[t,n,r]),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>{t((0,Pn.assign)(n,{operator:e.target.value}),r)},children:[(0,y.jsx)("option",{value:"equals",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"before",children:p.Z.I18n.t("before")}),(0,y.jsx)("option",{value:"after",children:p.Z.I18n.t("after")})]},"select-operator"),(0,y.jsx)(It,{dateFormat:"MMM d, yyyy",onChange:e=>t((0,Pn.assign)(n,{value:_i(e)}),r),selected:n.value?Zi(n.value):void 0})]})}};var Ii;!function(e){e.DATE="date",e.TEXT="text",e.TEXTAREA="textarea",e.RADIO="radio",e.CHECKBOX="checkbox",e.SELECT="select"}(Ii||(Ii={}));const Si={[Ii.TEXT]:gi,[Ii.TEXTAREA]:gi,[Ii.RADIO]:bi,[Ii.SELECT]:bi,[Ii.CHECKBOX]:function(e){return"1"===e.value||"0"===e.value},[Ii.DATE]:function(e){return("month"===e.date_type||!("string"!=typeof e.operator||e.operator.length<1))&&"string"==typeof e.value&&e.value.length>1}},Ci={[Ii.TEXT]:vi,[Ii.TEXTAREA]:vi,[Ii.RADIO]:yi,[Ii.SELECT]:yi,[Ii.CHECKBOX]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:r,updateSegmentFilter:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");return(0,j.useEffect)((()=>{"1"!==n.value&&"0"!==n.value&&a({operator:"equals",value:"1"},t)}),[a,n,t]),(0,y.jsxs)(de.Z,{value:n.value,onChange:e=>r("value",t,e),children:[(0,y.jsx)("option",{value:"1",children:p.Z.I18n.t("checked")}),(0,y.jsx)("option",{value:"0",children:p.Z.I18n.t("unchecked")})]},"select")},[Ii.DATE]:function(e){let{customField:t,filterIndex:n}=e;const r=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(n)),[n]),{updateSegmentFilter:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");(0,j.useEffect)((()=>{r.date_type!==t.params.date_type&&a({date_type:t.params.date_type,value:""},n)}),[r.date_type,a,t.params.date_type,n]);const s=ji[t.params.date_type];return s?(0,y.jsx)(s,{item:r,onChange:a,filterIndex:n}):null}},Ti=[{value:Qs.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD,label:p.Z.I18n.t("mailpoetCustomField"),group:Qs.SegmentTypes.WordPressRole},{value:Qs.SubscriberActionTypes.SUBSCRIBER_SCORE,label:p.Z.I18n.t("subscriberScore"),group:Qs.SegmentTypes.WordPressRole},{value:Qs.SubscriberActionTypes.SUBSCRIBED_DATE,label:p.Z.I18n.t("subscribedDate"),group:Qs.SegmentTypes.WordPressRole},{value:Qs.SubscriberActionTypes.SUBSCRIBED_TO_LIST,label:p.Z.I18n.t("subscribedToList"),group:Qs.SegmentTypes.WordPressRole},{value:Qs.SubscriberActionTypes.WORDPRESS_ROLE,label:p.Z.I18n.t("segmentsSubscriber"),group:Qs.SegmentTypes.WordPressRole}],ki={[Qs.SubscriberActionTypes.WORDPRESS_ROLE]:oi,[Qs.SubscriberActionTypes.SUBSCRIBER_SCORE]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");return(0,j.useEffect)((()=>{ci.includes(n.operator)||r({operator:li.HIGHER_THAN},t),n.operator!==li.HIGHER_THAN&&n.operator!==li.LOWER_THAN&&n.operator!==li.EQUALS&&n.operator!==li.NOT_EQUALS||void 0!==n.value||r({value:""},t),n.operator!==li.UNKNOWN&&n.operator!==li.NOT_UNKNOWN||r({value:null},t)}),[r,n,t]),(0,y.jsx)(_t.r.CenteredRow,{children:(s=e=>"{condition}"===e?(0,y.jsxs)(de.Z,{value:n.operator,automationId:"segment-subscriber-score-operator",onChange:e=>{a("operator",t,e)},children:[(0,y.jsx)("option",{value:li.HIGHER_THAN,children:p.Z.I18n.t("higherThan")}),(0,y.jsx)("option",{value:li.LOWER_THAN,children:p.Z.I18n.t("lowerThan")}),(0,y.jsx)("option",{value:li.EQUALS,children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:li.NOT_EQUALS,children:p.Z.I18n.t("notEquals")}),(0,y.jsx)("option",{value:li.UNKNOWN,children:p.Z.I18n.t("unknown")}),(0,y.jsx)("option",{value:li.NOT_UNKNOWN,children:p.Z.I18n.t("notUnknown")})]},"select"):"{score}"===e?(n.operator===li.HIGHER_THAN||n.operator===li.LOWER_THAN||n.operator===li.EQUALS||n.operator===li.NOT_EQUALS)&&(0,y.jsx)(ae.Z,{type:"number",value:n.value||"","data-automation-id":"segment-subscriber-score-value",onChange:e=>{a("value",t,e)},min:"0",placeholder:p.Z.I18n.t("subscriberScorePlaceholder")},"input"):"string"==typeof e&&e.trim().length>0?n.operator!==li.UNKNOWN&&n.operator!==li.NOT_UNKNOWN&&(0,y.jsx)("div",{children:e},"score"):null,p.Z.I18n.t("subscriberScoreSentence").split(/({condition})|({score})|(\b%\b)/gim).map(s))});var s},[Qs.SubscriberActionTypes.SUBSCRIBED_DATE]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");return(0,j.useEffect)((()=>{mi.includes(n.operator)||r({operator:pi.BEFORE},t),n.operator!==pi.BEFORE&&n.operator!==pi.AFTER&&n.operator!==pi.ON&&n.operator!==pi.NOT_ON||void 0!==fi(n.value)&&/^\d+-\d+-\d+$/.test(n.value)||r({value:hi(new Date)},t),n.operator!==pi.IN_THE_LAST&&n.operator!==pi.NOT_IN_THE_LAST||"string"!=typeof n.value||/^\d*$/.exec(n.value)||r({value:""},t)}),[r,n,t]),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,y.jsx)("option",{value:pi.BEFORE,children:p.Z.I18n.t("before")}),(0,y.jsx)("option",{value:pi.AFTER,children:p.Z.I18n.t("after")}),(0,y.jsx)("option",{value:pi.ON,children:p.Z.I18n.t("on")}),(0,y.jsx)("option",{value:pi.NOT_ON,children:p.Z.I18n.t("notOn")}),(0,y.jsx)("option",{value:pi.IN_THE_LAST,children:p.Z.I18n.t("inTheLast")}),(0,y.jsx)("option",{value:pi.NOT_IN_THE_LAST,children:p.Z.I18n.t("notInTheLast")})]},"select"),(n.operator===pi.BEFORE||n.operator===pi.AFTER||n.operator===pi.ON||n.operator===pi.NOT_ON)&&(0,y.jsx)(It,{dateFormat:"MMM d, yyyy",onChange:e=>{r({value:hi(e)},t)},selected:n.value?fi(n.value):void 0}),(n.operator===pi.IN_THE_LAST||n.operator===pi.NOT_IN_THE_LAST)&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(ae.Z,{type:"number",value:n.value,onChange:e=>{a("value",t,e)},min:"1",placeholder:p.Z.I18n.t("daysPlaceholder")},"input"),(0,y.jsx)("span",{children:p.Z.I18n.t("daysPlaceholder")})]})]})},[Qs.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),a=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),s=(0,Pn.find)({id:Number(n.custom_field_id)},a),i=a.map((e=>({value:e.id.toString(),label:e.name}))),o=Ci[n.custom_field_type];return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{children:(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectCustomFieldPlaceholder"),options:i,automationId:"select-custom-field",value:(0,Pn.find)((e=>{if(n.custom_field_id)return n.custom_field_id===e.value}),i),onChange:e=>{const n=(0,Pn.find)({id:Number(e.value)},a);n&&r({custom_field_id:e.value,custom_field_type:n.type,operator:void 0,value:void 0},t)}})}),(0,y.jsx)("div",{children:o&&(0,y.jsx)(o,{customField:s,filterIndex:t})})]})},[Qs.SubscriberActionTypes.SUBSCRIBED_TO_LIST]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),r=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getStaticSegmentsList()),[]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:s}=(0,Bs.Z)("mailpoet-dynamic-segments-form");(0,j.useEffect)((()=>{n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.NONE&&a({operator:Qs.AnyValueTypes.ANY},t)}),[a,n,t]);const i=r.map((e=>({value:e.id,label:e.name})));return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{isFullWidth:!0,value:n.operator,onChange:e=>{s("operator",t,e)},children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:p.Z.I18n.t("searchLists"),options:i,value:(0,Pn.filter)((e=>{if(!n.segments)return;const t=e.value;return-1!==n.segments.indexOf(t)}),i),onChange:e=>{a({segments:(0,Pn.map)("value",e)},t)}})})]})}};var Ni;!function(e){e.MEMBER_OF="isMemberOf"}(Ni||(Ni={}));const Di=[{value:Ni.MEMBER_OF,label:p.Z.I18n.t("segmentsActiveMembership"),group:Qs.SegmentTypes.WooCommerceMembership}];var Ei;!function(e){e.ACTIVE_SUBSCRIPTIONS="hasActiveSubscription"}(Ei||(Ei={}));const Oi=[{value:Ei.ACTIVE_SUBSCRIPTIONS,label:p.Z.I18n.t("segmentsActiveSubscription"),group:Qs.SegmentTypes.WooCommerceSubscription}],Ri={[Qs.SegmentTypes.Email]:function(e){return!!Object.values(Qs.EmailActionTypes).some((t=>t===e.action))&&(e.action===Qs.EmailActionTypes.CLICKED_ANY||(e.action===Qs.EmailActionTypes.CLICKED?!!e.newsletter_id:e.action!==Qs.EmailActionTypes.OPENS_ABSOLUTE_COUNT&&e.action!==Qs.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT?Array.isArray(e.newsletters)&&e.newsletters.length>0:!!e.days&&!!e.opens&&!!e.operator))},[Qs.SegmentTypes.WooCommerce]:function(e){if(!Object.values(ai).some((t=>t===e.action)))return!1;const t=void 0===e.category_ids||0===e.category_ids.length||!e.operator;if(e.action===ai.PURCHASED_CATEGORY&&t)return!1;const n=void 0===e.product_ids||0===e.product_ids.length||!e.operator;if(e.action===ai.PURCHASED_PRODUCT&&n)return!1;const r=void 0===e.country_code||0===e.country_code.length;if(e.action===ai.CUSTOMER_IN_COUNTRY&&r)return!1;const a=!e.number_of_orders_count||!e.number_of_orders_days||!e.number_of_orders_type;return!(e.action===ai.NUMBER_OF_ORDERS&&a||!(e.action!==ai.TOTAL_SPENT||e.total_spent_amount&&e.total_spent_days&&e.total_spent_type))},[Qs.SegmentTypes.WordPressRole]:function(e){return e.action&&e.action!==Qs.SubscriberActionTypes.WORDPRESS_ROLE?e.action===Qs.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD?function(e){const t=Si[e.custom_field_type];return!!t&&t(e)}(e):e.action===Qs.SubscriberActionTypes.SUBSCRIBER_SCORE?function(e){if(e.operator===li.HIGHER_THAN||e.operator===li.LOWER_THAN||e.operator===li.EQUALS||e.operator===li.NOT_EQUALS){const t=Number(e.value),n=Number(parseFloat(e.value));return!Number.isNaN(t)&&!Number.isNaN(n)&&t>=0&&t<=100}return e.operator===li.UNKNOWN||e.operator===li.NOT_UNKNOWN}(e):e.action===Qs.SubscriberActionTypes.SUBSCRIBED_TO_LIST?function(e){return(e.operator===Qs.AnyValueTypes.ANY||e.operator===Qs.AnyValueTypes.ALL||e.operator===Qs.AnyValueTypes.NONE)&&Array.isArray(e.segments)&&e.segments.length>0}(e):!(!e.operator||!e.value)&&(e.operator===pi.BEFORE||e.operator===pi.AFTER||e.operator===pi.ON||e.operator===pi.NOT_ON?/^\d+-\d+-\d+$/.test(e.value):(e.operator===pi.IN_THE_LAST||e.operator===pi.NOT_IN_THE_LAST)&&(/^\d+$/.test(e.value)&&Number(e.value)>0)):Array.isArray(e.wordpressRole)&&e.wordpressRole.length>0},[Qs.SegmentTypes.WooCommerceMembership]:function(e){const t=!e.plan_ids||!e.plan_ids.length||!e.operator;return e.action!==Ni.MEMBER_OF||!t},[Qs.SegmentTypes.WooCommerceSubscription]:function(e){const t=!e.product_ids||!e.product_ids.length||!e.operator;return e.action!==Ei.ACTIVE_SUBSCRIPTIONS||!t}};function Ai(e){return!(e.length<1)&&0===e.map((e=>void 0!==Ri[e.segmentType]&&Ri[e.segmentType](e))).filter((e=>!1===e)).length}let Pi,Mi;function Li(){const e=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),{updateSubscriberCount:n}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),r=JSON.stringify(e),a=(0,j.useRef)(1),s=(0,j.useRef)(null),i=(0,j.useRef)(!1),o=(0,j.useRef)((0,Ks.debounce)((function e(t){if(i.current)return void(s.current=t);s.current=null,a.current+=1;const r=a.current;i.current=!0,function(e){const t={filters:e.filters,filters_connect:e.filters_connect};return Gs().isEqual(t,Pi)?Promise.resolve(Mi):(Pi={filters:[...e.filters],filters_connect:e.filters_connect},p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"dynamic_segments",action:"getCount",data:e,timeout:2e4}).then((e=>{const{data:t}=e;return Mi={count:t.count,errors:void 0},Mi})))}(t).then((t=>{if(i.current=!1,s.current)return void e(s.current);if(r!==a.current)return;const o={loading:!1};t&&(o.count=t.count,o.errors=t.errors),n(o)}),(e=>{i.current=!1;const t={},r=e.errors.map((e=>e.message));t.loading=!1,t.count=void 0,t.errors=r,n(t)}))}),2e3,{trailing:!0}));return(0,j.useEffect)((()=>{Ai(e.filters)?(n({loading:!0,count:void 0,errors:void 0}),(0,o.current)(e)):n({count:void 0,loading:!1})}),[e,r,n]),t.errors?(0,y.jsx)("div",{className:"mailpoet-form-field",children:(0,y.jsxs)("span",{className:"mailpoet-form-error-message",children:[p.Z.I18n.t("dynamicSegmentSizeCalculatingTimeout")," ",(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/237-guide-to-subscriber-segmentation?utm_source=plugin&utm_medium=segments","data-beacon-article":"5a574bd92c7d3a194368233e",target:"_blank",className:"mailpoet-form-error-message",rel:"noopener noreferrer",children:p.Z.I18n.t("learnMore")})]})}):t.loading||void 0!==t.count?t.loading?(0,y.jsx)("div",{className:"mailpoet-form-field",children:(0,y.jsx)("span",{className:"mailpoet-form-notice-message",children:p.Z.I18n.t("dynamicSegmentSizeIsCalculated")})}):(0,y.jsx)("div",{className:"mailpoet-form-field",children:(0,y.jsx)("span",{className:"mailpoet-form-notice-message",children:p.Z.I18n.t("dynamicSegmentSize").replace("%1$d",t.count.toLocaleString())})}):(0,y.jsx)("span",{})}const Fi={[Qs.SegmentTypes.Email]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),r=ri[n.action];return r?(0,y.jsx)(r,{filterIndex:t}):null},[Qs.SegmentTypes.WooCommerce]:e=>{let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getProductCategories()),[]),i=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCountries()),[]),o=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getProducts()),[]),l=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCurrencySymbol()),[]),c=o.map((e=>({value:e.id,label:e.name}))),d=s.map((e=>({value:e.id,label:e.name}))),u=i.map((e=>({value:e.code,label:e.name})));let m;return(0,j.useEffect)((()=>{void 0===n.number_of_orders_type&&n.action===ai.NUMBER_OF_ORDERS&&r({number_of_orders_type:"="},t),void 0===n.total_spent_type&&n.action===ai.TOTAL_SPENT&&r({total_spent_type:">"},t),ii.includes(n.action)&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t),n.action===ai.CUSTOMER_IN_COUNTRY&&n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t)}),[r,n,t]),n.action===ai.PURCHASED_PRODUCT?m=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>r({operator:e.target.value},t),automationId:"select-operator",children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select-operator")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectWooPurchasedProduct"),options:c,value:(0,Pn.filter)((e=>{if(void 0!==n.product_ids&&0!==n.product_ids.length)return-1!==n.product_ids.indexOf(e.value)}),c),onChange:e=>r({product_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-products"},"select-segment-products")})]}):n.action===ai.PURCHASED_CATEGORY?m=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>r({operator:e.target.value},t),automationId:"select-operator",children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select-operator")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectWooPurchasedCategory"),options:d,value:(0,Pn.filter)((e=>{if(void 0!==n.category_ids&&0!==n.category_ids.length)return-1!==n.category_ids.indexOf(e.value)}),d),onChange:e=>r({category_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-category"},"select-segment-category")})]}):n.action===ai.NUMBER_OF_ORDERS?m=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{value:n.number_of_orders_type,onChange:e=>{a("number_of_orders_type",t,e)},automationId:"select-number-of-orders-type",children:[(0,y.jsx)("option",{value:"=",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"!=",children:p.Z.I18n.t("notEquals")}),(0,y.jsx)("option",{value:">",children:p.Z.I18n.t("moreThan")}),(0,y.jsx)("option",{value:"<",children:p.Z.I18n.t("lessThan")})]},"select"),(0,y.jsx)(ae.Z,{"data-automation-id":"input-number-of-orders-count",type:"number",min:0,value:n.number_of_orders_count||"",placeholder:p.Z.I18n.t("wooNumberOfOrdersCount"),onChange:e=>{a("number_of_orders_count",t,e)}}),(0,y.jsx)("div",{children:p.Z.I18n.t("wooNumberOfOrdersOrders")})]}),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsx)("div",{children:p.Z.I18n.t("inTheLast")}),(0,y.jsx)(ae.Z,{"data-automation-id":"input-number-of-orders-days",type:"number",min:1,value:n.number_of_orders_days||"",placeholder:p.Z.I18n.t("daysPlaceholder"),onChange:e=>{a("number_of_orders_days",t,e)}}),(0,y.jsx)("div",{children:p.Z.I18n.t("days")})]})]}):n.action===ai.TOTAL_SPENT?m=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{value:n.total_spent_type,onChange:e=>{a("total_spent_type",t,e)},automationId:"select-total-spent-type",children:[(0,y.jsx)("option",{value:"=",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"!=",children:p.Z.I18n.t("notEquals")}),(0,y.jsx)("option",{value:">",children:p.Z.I18n.t("moreThan")}),(0,y.jsx)("option",{value:"<",children:p.Z.I18n.t("lessThan")})]},"select"),(0,y.jsx)(ae.Z,{"data-automation-id":"input-total-spent-amount",type:"number",min:0,step:.01,value:n.total_spent_amount||"",placeholder:p.Z.I18n.t("wooTotalSpentAmount"),onChange:e=>{a("total_spent_amount",t,e)}}),(0,y.jsx)("div",{children:l})]}),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsx)("div",{children:p.Z.I18n.t("inTheLast")}),(0,y.jsx)(ae.Z,{"data-automation-id":"input-total-spent-days",type:"number",min:1,value:n.total_spent_days||"",placeholder:p.Z.I18n.t("daysPlaceholder"),onChange:e=>{a("total_spent_days",t,e)}}),(0,y.jsx)("div",{children:p.Z.I18n.t("days")})]})]}):n.action===ai.CUSTOMER_IN_COUNTRY&&(m=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>r({operator:e.target.value},t),automationId:"select-operator-country",children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select-operator-country")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:p.Z.I18n.t("selectWooCountry"),options:u,value:(0,Pn.filter)((e=>{if(n.country_code)return-1!==n.country_code.indexOf(e.value)}),u),onChange:e=>r({country_code:(e||[]).map((e=>e.value))},t),automationId:"select-segment-country"},"select-segment-country")})]})),m},[Qs.SegmentTypes.WordPressRole]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);let r;return r=n.action?ki[n.action]:oi,r?(0,y.jsx)(r,{filterIndex:t}):null},[Qs.SegmentTypes.WooCommerceMembership]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getMembershipPlans()),[]).map((e=>({value:e.id,label:e.name})));return(0,j.useEffect)((()=>{n.action===Ni.MEMBER_OF&&n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t)}),[r,n,t]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select-operator")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectWooMembership"),options:s,value:(0,Pn.filter)((e=>!!n.plan_ids&&-1!==n.plan_ids.indexOf(e.value)),s),onChange:e=>r({plan_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-plans"},"select-segment-membership-plan")})]})},[Qs.SegmentTypes.WooCommerceSubscription]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriptionProducts()),[]).map((e=>({value:e.id,label:e.name})));return(0,j.useEffect)((()=>{n.action===Ei.ACTIVE_SUBSCRIPTIONS&&n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t)}),[r,n,t]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select-operator")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectWooSubscription"),options:s,value:(0,Pn.filter)((e=>!!n.product_ids&&-1!==n.product_ids.indexOf(e.value)),s),onChange:e=>r({product_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-products"},"select-segment-category")})]})}};function qi(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);if(void 0===n||void 0===Fi[n.segmentType])return null;const r=Fi[n.segmentType];return(0,y.jsx)(r,{filterIndex:t})}function $i(){const e=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=[Qs.EmailActionTypes.OPENED,Qs.EmailActionTypes.OPENS_ABSOLUTE_COUNT,Qs.EmailActionTypes.MACHINE_OPENED,Qs.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT];let n=!1;return e.filters.forEach((e=>{t.includes(e.action)&&(n=!0)})),n?(0,y.jsx)("div",{className:"mailpoet-form-field",children:(0,y.jsx)("span",{className:"mailpoet-form-notice-message",children:p.Z.I18n.t("privacyProtectionNotice")})}):(0,y.jsx)("span",{})}const{subscribersLimitReached:Ui,subscribersLimit:Vi,subscribersCount:Wi,premiumActive:Yi,hasValidApiKey:Bi,hasValidPremiumKey:Hi,isPremiumPluginInstalled:zi,premiumPluginDownloadUrl:Ki,premiumPluginActivationUrl:Gi,pluginPartialKey:Qi}=p.Z,Xi=Bi||Hi,Ji=e=>{const t=p.Z.I18n.t(e);return(0,y.jsx)("p",{children:k()(t,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?Wi:Vi))})},eo=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_blank";return(0,y.jsx)(v.Z,{href:t,target:n,rel:"noopener noreferrer",children:p.Z.I18n.t(e)})};var to=function(e){let t,n,{message:r,actionButton:a}=e;if(Xi&&!Yi)t=Ji("premiumFeatureDescription"),n=zi?eo("premiumFeatureButtonActivatePremium",Gi,"_self"):eo("premiumFeatureButtonDownloadPremium",Ki);else if(Ui){t=Ji("premiumFeatureDescriptionSubscribersLimitReached");const e=Xi?p.Z.MailPoetComUrlFactory.getUpgradeUrl(Qi):p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(+Wi+1);n=eo("premiumFeatureButtonUpgradePlan",e)}else t=r,n=a;return(0,y.jsx)(Be.Z,{title:p.Z.I18n.t("premiumFeature"),message:t,actionButton:n})},no=function(){return(0,y.jsx)(to,{message:(()=>{const e=p.Z.I18n.t("premiumFeatureMultipleConditions");return(0,y.jsx)("p",{children:k()(e,/\[link](.*?)\[\/link]/g,(e=>(0,y.jsx)("a",{href:p.Z.premiumLink,target:"_blank",rel:"noopener noreferrer",children:e},e)))})})(),actionButton:(0,y.jsx)(v.Z,{href:p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount,p.Z.currentWpUserEmail,null,{utm_medium:"segments",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("premiumBannerCtaFree")})})};const ro=Ye().applyFilters("mailpoet_dynamic_segments_form_filters_before",(()=>null)),ao=Ye().applyFilters("mailpoet_dynamic_filters_filter_before",(()=>null)),so=Ye().applyFilters("mailpoet_dynamic_filters_filter_after",(()=>(0,y.jsx)("div",{className:"mailpoet-gap"})));function io(e){let{segmentId:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),r=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getAvailableFilters()),[]),a=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").findFiltersValueForSegment(n)),[n]),s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),i=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getErrors()),[]),{updateSegment:o,updateSegmentFilter:l,handleSave:c}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),[d,u]=(0,j.useState)(!1),m=Ye().applyFilters("mailpoet_dynamic_segments_form_add_condition_action",(()=>{u(!0)}));return(0,y.jsxs)("form",{className:"mailpoet_form",children:[i.length>0&&(0,y.jsx)(it,{errors:i.map((e=>({message:e})))}),(0,y.jsxs)("div",{className:"mailpoet-form-grid",children:[(0,y.jsxs)("div",{className:"mailpoet-form-field-name form-field-row-name mailpoet-segments-name-section",children:[(0,y.jsx)(je.Z,{level:4,children:(0,y.jsx)("label",{htmlFor:"field_name",children:p.Z.I18n.t("name")})}),(0,y.jsx)("div",{className:"mailpoet-form-field",children:(0,y.jsx)(ae.Z,{isFullWidth:!0,type:"text",name:"name",id:"field_name",defaultValue:n.name,onChange:e=>o({name:e.target.value})})})]}),(0,y.jsxs)("div",{className:"mailpoet-form-field-description form-field-row-description mailpoet-segments-description-section",children:[(0,y.jsx)(je.Z,{level:4,children:(0,y.jsx)("label",{htmlFor:"field_description",children:p.Z.I18n.t("description")})}),(0,y.jsx)("p",{className:"mailpoet-form-description",children:p.Z.I18n.t("segmentDescriptionTip")}),(0,y.jsx)("div",{className:"mailpoet-form-field",children:(0,y.jsx)(oe.Z,{isFullWidth:!0,name:"description",id:"field_description",value:n.description,onChange:e=>o({description:e.target.value})})})]}),(0,y.jsxs)("div",{className:"mailpoet-segments-segments-section",children:[(0,y.jsx)(je.Z,{level:4,children:(0,y.jsx)("label",{htmlFor:"field_filters",children:p.Z.I18n.t("formPageTitle")})}),(0,y.jsx)(ro,{}),Array.isArray(a)&&a.map(((e,t)=>(0,y.jsxs)(j.Fragment,{children:[(0,y.jsxs)(_t.r.ThreeColumns,{className:"mailpoet-segments-grid",automationId:`filter-row-${t}`,children:[(0,y.jsx)(ao,{filterRows:a,index:t}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{dimension:"small",placeholder:p.Z.I18n.t("selectActionPlaceholder"),options:r,value:e.filterValue,onChange:e=>{l({segmentType:e.group,action:e.value},t)},automationId:"select-segment-action",isFullWidth:!0})}),void 0!==e.index&&(0,y.jsx)(qi,{filterIndex:e.index})]}),(0,y.jsx)(so,{index:t})]},e.index))),(0,y.jsx)(v.Z,{type:"button",variant:"tertiary",iconStart:q,onClick:e=>{e.preventDefault(),m(n,o)},children:p.Z.I18n.t("addCondition")})]}),d&&(0,y.jsx)("div",{className:"mailpoet-grid-span-two-columns",children:(0,y.jsx)(no,{})}),(0,y.jsxs)("div",{className:"mailpoet-segments-counter-section",children:[(0,y.jsx)(Li,{}),(0,y.jsx)($i,{})]}),(0,y.jsx)("div",{className:"mailpoet-form-actions",children:(0,y.jsx)(v.Z,{type:"submit",onClick:e=>{e.preventDefault(),c(t)},isDisabled:!Ai(n.filters)||void 0===s.count,children:p.Z.I18n.t("save")})})]})]})}var oo=n(61299);const lo=e=>e.products,co=e=>e.membershipPlans,uo=e=>e.subscriptionProducts,po=e=>e.wordpressRoles,mo=e=>e.productCategories,ho=e=>e.newslettersList,fo=e=>e.canUseWooSubscriptions,go=e=>e.wooCurrencySymbol,vo=e=>e.wooCountries,bo=e=>e.customFieldsList,yo=e=>e.segment,wo=e=>e.staticSegmentsList,xo=e=>e.subscriberCount,_o=(e,t)=>{let n;return Array.isArray(e.segment.filters)?(n={...e.segment.filters[t]},n):n},Zo=e=>e.errors,jo=e=>e.allAvailableFilters,Io=(e,t)=>{const n=[];return t.filters.forEach(((t,r)=>{e.allAvailableFilters.forEach((e=>{e.options.forEach((e=>{e.group===t.segmentType&&e.value===t.action&&n.push({filterValue:e,index:r})}))}))})),n};function So(e,t){return{...e,segment:t.segment}}function Co(e,t){return{...e,errors:t.errors}}function To(e,t){const n=e.segment;return{...e,segment:(0,Pn.assign)(n,t.segment)}}function ko(e,t){const n={...e.segment};return n.filters[t.filterIndex]=(0,Pn.assign)(n.filters[t.filterIndex],t.filter),{...e,segment:n}}function No(e,t){const n=e.subscriberCount;return{...e,subscriberCount:(0,Pn.assign)(n,t.subscriberCount)}}const Do=e=>function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case Qs.Actions.SET_SEGMENT:return So(t,n);case Qs.Actions.SET_ERRORS:return Co(t,n);case Qs.Actions.UPDATE_SEGMENT:return To(t,n);case Qs.Actions.UPDATE_SEGMENT_FILTER:return ko(t,n);case Qs.Actions.UPDATE_SUBSCRIBER_COUNT:return No(t,n);default:return t}};function Eo(e){return{type:Qs.Actions.SET_SEGMENT,segment:e}}function Oo(e){return{type:Qs.Actions.SET_ERRORS,errors:e}}function Ro(e){return{type:Qs.Actions.UPDATE_SEGMENT,segment:e}}function Ao(e,t){return{type:Qs.Actions.UPDATE_SEGMENT_FILTER,filter:e,filterIndex:t}}function Po(e,t){return{type:Qs.Actions.UPDATE_SEGMENT,segment:{[e]:t.target.value}}}function Mo(e,t,n){return{type:Qs.Actions.UPDATE_SEGMENT_FILTER,filter:{[e]:n.target.value},filterIndex:t}}function Lo(e){return{type:Qs.Actions.UPDATE_SUBSCRIBER_COUNT,subscriberCount:e}}function*Fo(e){if(void 0===e)return;p.Z.Modal.loading(!0);const{res:t,success:n}=yield{type:"LOAD_SEGMENT",segmentId:e};n&&!t.is_plugin_missing||(window.location.href="admin.php?page=mailpoet-segments#/segments"),yield Eo(t),p.Z.Modal.loading(!1)}function*qo(e){const t=(0,oo.Ys)("mailpoet-dynamic-segments-form").getSegment();yield Oo([]);const{error:n,success:r}=yield{type:"SAVE_SEGMENT",segment:t};var a;r?(window.location.href="admin.php?page=mailpoet-segments#/segments",void 0!==e?p.Z.Notice.success(p.Z.I18n.t("dynamicSegmentUpdated")):(a=t,p.Z.Notice.success(p.Z.I18n.t("dynamicSegmentAdded")),p.Z.trackEvent("Segments > Add new",{type:a.segmentType||"unknown type",subtype:a.action||a.wordpressRole||"unknown subtype"}))):yield Oo(n)}function $o(e){let t=JSON.parse(JSON.stringify(e));return(0,Pn.has)("link_id",e)&&(t=(0,Pn.assign)(t,{link_id:e.link_id.toString()})),(0,Pn.has)("newsletter_id",e)&&(t=(0,Pn.assign)(t,{newsletter_id:e.newsletter_id.toString()})),(0,Pn.has)("product_id",e)&&(t=(0,Pn.assign)(t,{product_id:e.product_id.toString()})),(0,Pn.has)("category_id",e)&&(t=(0,Pn.assign)(t,{category_id:e.category_id.toString()})),t}async function Uo(e){let{segmentId:t}=e;try{return{success:!0,res:$o((await p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"dynamic_segments",action:"get",data:{id:t}})).data)}}catch(e){return{success:!1,error:(0,ot.q)(e)?e.errors.map((e=>e.message)):null,res:e}}}async function Vo(e){let{segment:t}=e;try{return await p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"dynamic_segments",action:"save",data:t}),{success:!0}}catch(e){return{success:!1,error:(0,ot.q)(e)?e.errors.map((e=>e.message)):null}}}function Wo(e,t){const n=[{label:p.Z.I18n.t("email"),options:ni},{label:p.Z.I18n.t("wpUserRole"),options:Ti}];return p.Z.isWoocommerceActive&&n.push({label:p.Z.I18n.t("woocommerce"),options:si}),p.Z.isWoocommerceActive&&t&&n.push({label:p.Z.I18n.t("woocommerceMemberships"),options:Di}),p.Z.isWoocommerceActive&&e&&n.push({label:p.Z.I18n.t("woocommerceSubscriptions"),options:Oi}),n}var Yo=function(){const e=(0,c.useRouteMatch)();(()=>{const e={products:window.mailpoet_products,staticSegmentsList:window.mailpoet_static_segments_list,membershipPlans:window.mailpoet_membership_plans,subscriptionProducts:window.mailpoet_subscription_products,productCategories:window.mailpoet_product_categories,newslettersList:window.mailpoet_newsletters_list,wordpressRoles:window.wordpress_editable_roles_list,canUseWooMemberships:window.mailpoet_can_use_woocommerce_memberships,canUseWooSubscriptions:window.mailpoet_can_use_woocommerce_subscriptions,wooCurrencySymbol:window.mailpoet_woocommerce_currency_symbol,wooCountries:window.mailpoet_woocommerce_countries,customFieldsList:window.mailpoet_custom_fields,segment:{filters_connect:Qs.SegmentConnectTypes.AND,filters:[{segmentType:Qs.SegmentTypes.WordPressRole,action:Qs.SubscriberActionTypes.WORDPRESS_ROLE}]},subscriberCount:{loading:!1},errors:[],allAvailableFilters:Wo(window.mailpoet_can_use_woocommerce_subscriptions,window.mailpoet_can_use_woocommerce_memberships)},t={selectors:r,actions:a,controls:s,reducer:Do(e),resolvers:{}};(0,oo.R9)("mailpoet-dynamic-segments-form",t)})();const{pageLoaded:t}=(0,Bs.Z)("mailpoet-dynamic-segments-form");return(0,j.useEffect)((()=>{t(e.params.id)}),[e.params.id,t]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(De.Z,{}),(0,y.jsxs)(je.Z,{level:1,className:"mailpoet-title",children:[(0,y.jsx)("span",{children:p.Z.I18n.t("formPageTitle")}),(0,y.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:"/segments",children:p.Z.I18n.t("backToList")})]}),(0,y.jsx)(io,{segmentId:Number(e.params.id)})]})};const Bo=[{name:"name",label:p.Z.I18n.t("nameColumn"),sortable:!0},{name:"description",label:p.Z.I18n.t("description"),sortable:!1},{name:"count",label:p.Z.I18n.t("subscribersCountColumn"),sortable:!1},{name:"subscribed",label:p.Z.I18n.t("subscribed"),sortable:!1},{name:"updated_at",label:p.Z.I18n.t("updatedAtColumn"),sortable:!0}],Ho={onLoadingItems:()=>p.Z.I18n.t("loadingDynamicSegmentItems"),onNoItemsFound:()=>p.Z.I18n.t("noDynamicSegmentItemsFound"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneDynamicSegmentTrashed"):p.Z.I18n.t("multipleDynamicSegmentsTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneDynamicSegmentDeleted"):p.Z.I18n.t("multipleDynamicSegmentsDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneDynamicSegmentRestored"):p.Z.I18n.t("multipleDynamicSegmentsRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},zo=[{name:"edit",className:"mailpoet-hide-on-mobile",link:e=>(0,y.jsx)(l.rU,{to:`/edit-segment/${e.id}`,children:p.Z.I18n.t("edit")}),display:e=>!e.is_plugin_missing},{name:"edit_disabled",className:"mailpoet-hide-on-mobile mailpoet-disabled",link:e=>(0,y.jsx)(l.rU,{to:`/edit-segment/${e.id}`,children:p.Z.I18n.t("edit")}),display:e=>e.is_plugin_missing},{name:"view_subscribers",link:e=>(0,y.jsx)("a",{href:e.subscribers_url,children:p.Z.I18n.t("viewSubscribers")})},{name:"trash",className:"mailpoet-hide-on-mobile"}],Ko=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:Ho.onTrash}];function Go(e,t){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("td",{className:"column-primary","data-colname":p.Z.I18n.t("nameColumn"),children:[(0,y.jsx)("span",{className:"mailpoet-listing-title",children:e.name}),t]}),(0,y.jsx)("td",{"data-colname":p.Z.I18n.t("description"),children:(0,y.jsx)("abbr",{children:e.description})}),e.is_plugin_missing?(0,y.jsx)("td",{colSpan:"2",className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("missingPluginMessageColumn"),children:e.missing_plugin_message&&e.missing_plugin_message.message&&e.missing_plugin_message.link?k()(e.missing_plugin_message.message,/\[link](.*?)\[\/link]/g,(t=>(0,y.jsx)("a",{className:"mailpoet-listing-link-important",href:e.missing_plugin_message.link,target:"_blank",rel:"noopener noreferrer",children:t},"missingPluginMessageLink"))):e.missing_plugin_message}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("subscribersCountColumn"),children:parseInt(e.count_all,10).toLocaleString()}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("subscribed"),children:parseInt(e.count_subscribed,10).toLocaleString()})]}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("updatedAtColumn"),children:[p.Z.Date.short(e.created_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.created_at)]})]})}function Qo(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:e.location,params:e.match.params,search:!0,onRenderItem:Go,endpoint:"dynamic_segments",base_url:"segments",columns:Bo,messages:Ho,sort_by:"created_at",sort_order:"desc",item_actions:zo,bulk_actions:Ko}),(0,y.jsxs)("p",{className:"mailpoet_sending_methods_help help",children:[(0,y.jsxs)("b",{children:[p.Z.I18n.t("segmentsTip"),":"]})," ",p.Z.I18n.t("segmentsTipText")," ",(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/237-guide-to-subscriber-segmentation?utm_source=plugin&utm_medium=segments&utm_campaign=helpdocs","data-beacon-article":"5a574bd92c7d3a194368233e",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("segmentsTipLink")})]})]})}Qo.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var Xo=(0,c.withRouter)(Qo),Jo=function(){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(F.Q,{children:[(0,y.jsxs)(l.rU,{className:"mailpoet-button button-secondary",to:"/new",children:[q,(0,y.jsx)("span",{children:p.Z.I18n.t("new")})]}),(0,y.jsxs)(l.rU,{className:"mailpoet-button button-secondary",to:"/new-segment","data-automation-id":"new-segment",children:[q,(0,y.jsx)("span",{children:p.Z.I18n.t("newSegment")})]})]}),(0,y.jsx)(L,{subscribersInPlan:p.Z.subscribersCount,subscribersInPlanLimit:p.Z.subscribersLimit}),(0,y.jsx)(A,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,y.jsx)(D,{}),(0,y.jsx)(R,{}),(0,y.jsx)(E,{mssKeyInvalid:p.Z.hasInvalidMssApiKey,subscribersCount:p.Z.subscribersCount})]})};const el=document.getElementById("segments_container");function tl(){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Jo,{}),(0,y.jsxs)(ms.Z,{activeKey:"lists",routerType:"switch-only",children:[(0,y.jsx)(is.Z,{route:"lists/(.*)?",title:p.Z.I18n.t("pageTitle"),children:(0,y.jsx)($s,{})},"lists"),(0,y.jsx)(is.Z,{route:"segments/(.*)?",title:p.Z.I18n.t("pageTitleSegments"),automationId:"dynamic-segments-tab",children:(0,y.jsx)(Xo,{})},"segments")]})]})}function nl(){return(0,y.jsx)(Fe.k.Provider,{value:(0,Fe.S)(window),children:(0,y.jsxs)(l.UT,{children:[(0,y.jsx)(Ge.Z,{}),(0,y.jsxs)(c.Switch,{children:[(0,y.jsx)(c.Route,{exact:!0,path:"/",render:()=>(0,y.jsx)(c.Redirect,{to:"/lists"})}),(0,y.jsx)(c.Route,{path:"/new",component:Ys}),(0,y.jsx)(c.Route,{path:"/edit/:id",component:Ys}),(0,y.jsx)(c.Route,{path:"/new-segment",component:Yo}),(0,y.jsx)(c.Route,{path:"/edit-segment/:id",component:Yo}),(0,y.jsx)(c.Route,{path:"/segments/(.*)?",component:tl}),(0,y.jsx)(c.Route,{path:"/lists/(.*)?",component:tl})]})]})})}el&&o().render((0,y.jsx)(nl,{}),el);const rl=()=>{p.Z.trackEvent("Forms > Add New"),setTimeout((()=>{window.location=window.mailpoet_form_template_selection_url}),200)};function al(){const[e,t]=(0,j.useState)(!1);return(0,y.jsx)(F.Q,{children:(0,y.jsx)(v.Z,{onClick:()=>{t(!0),rl()},withSpinner:e,automationId:"create_new_form",variant:"secondary",iconStart:q,children:p.Z.I18n.t("new")})})}const sl=[{name:"name",label:p.Z.I18n.t("formName"),sortable:!0},{name:"segments",label:p.Z.I18n.t("segments")},{name:"type",label:p.Z.I18n.t("type")},{name:"status",label:p.Z.I18n.t("status")},{name:"updated_at",label:p.Z.I18n.t("updatedAt"),sortable:!0}],il={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneFormTrashed"):p.Z.I18n.t("multipleFormsTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneFormDeleted"):p.Z.I18n.t("multipleFormsDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneFormRestored"):p.Z.I18n.t("multipleFormsRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onNoItemsFound:()=>(0,y.jsxs)("div",{className:"mailpoet-forms-add-new-row",children:[(0,y.jsx)("p",{children:p.Z.I18n.t("noItemsFound")}),(0,y.jsx)(Ce.Button,{onClick:rl,automationId:"add_new_form",iconStart:q,children:p.Z.I18n.t("new")})]})},ol=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:il.onTrash}],ll=[{name:"edit",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("edit"),link:function(e){return(0,y.jsx)("a",{href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:p.Z.I18n.t("edit")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:function(e,t){return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"duplicate",data:{id:e.id}}).done((e=>{const n=e.data.name?e.data.name:p.Z.I18n.t("noName");p.Z.Notice.success(p.Z.I18n.t("formDuplicated").replace("%1$s",n)),t()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class cl extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"updateStatus",((e,t)=>{t.persist(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"enabled":"disabled"}}).done((e=>{"enabled"===e.data.status&&p.Z.Notice.success(p.Z.I18n.t("formActivated"))})).fail((n=>{p.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,Z.Z)(this,"isItemInactive",(e=>"disabled"===e.status)),(0,Z.Z)(this,"renderItem",((e,t)=>{const n=h()("manage-column","column-primary","has-row-actions"),r=window.mailpoet_segments.filter((t=>-1!==u().inArray(t.id,e.segments))),a=function(e){const t=[];return"1"===e?.form_placement?.fixed_bar?.enabled&&t.push(p.Z.I18n.t("placeFixedBarFormOnPages")),"1"===e?.form_placement?.below_posts?.enabled&&t.push(p.Z.I18n.t("placeFormBellowPages")),"1"===e?.form_placement?.popup?.enabled&&t.push(p.Z.I18n.t("placePopupFormOnPages")),"1"===e?.form_placement?.slide_in?.enabled&&t.push(p.Z.I18n.t("placeSlideInFormOnPages")),t.length>0?t.join(", "):p.Z.I18n.t("placeFormOthers")}(e.settings);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("td",{className:n,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:e.name?e.name:`(${p.Z.I18n.t("noName")})`}),t]}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("segments"),children:(0,y.jsx)(w,{segments:r,dimension:"large",children:"user"===e.settings.segments_selected_by&&(0,y.jsx)("span",{className:"mailpoet-tags-prefix",children:p.Z.I18n.t("userChoice")})})}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("type"),children:a}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("status"),children:this.renderStatus(e)}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("updatedAt"),children:[p.Z.Date.short(e.updated_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.updated_at)]})]})}))}renderStatus(e){return(0,y.jsxs)("div",{children:[(0,y.jsx)(Vt,{onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"enabled"===e.status}),(0,y.jsxs)("p",{children:[p.Z.I18n.t("signups"),": ",e.signups.toLocaleString()]})]})}render(){return(0,y.jsxs)("div",{className:"mailpoet-listing-no-actions-on-mobile",children:[(0,y.jsx)(al,{}),(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,className:"mailpoet-forms-listing",location:this.props.location,params:this.props.match.params,messages:il,search:!1,endpoint:"forms",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:sl,bulk_actions:ol,item_actions:ll})]})}}cl.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var dl=xs(cl);function ul(){return(0,y.jsx)(Fe.k.Provider,{value:(0,Fe.S)(window),children:(0,y.jsxs)(l.UT,{children:[(0,y.jsx)(Ge.Z,{}),(0,y.jsx)(c.Route,{path:"*",component:dl})]})})}const pl=document.getElementById("forms_container");pl&&o().render((0,y.jsx)(ul,{}),pl);var ml=function(){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("p",{children:p.Z.I18n.t("knowledgeBaseIntro")}),(0,y.jsxs)("ul",{className:"mailpoet-text-links",children:[(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/116-common-problems",children:"Common Problems"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/165-newsletters",children:"Newsletters"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/156-migration-questions",children:"Migration Questions"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/149-sending-methods",children:"Sending Methods"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/139-subscription-forms",children:"Subscription Forms"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/114-getting-started",children:"Getting Started"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/123-newsletter-designer",children:"Newsletter Designer"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/121-subscribers-and-lists",children:"Subscribers and Lists"})})]}),(0,y.jsx)(v.Z,{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/",children:p.Z.I18n.t("knowledgeBaseButton")})]})};function hl(e){e.target.select()}function fl(e){if(I.ZP.isObject(e)){const t=Object.keys(e).map((t=>`${t}: ${e[t]}`));return(0,y.jsx)("textarea",{readOnly:!0,onFocus:hl,value:t.join("\n"),style:{width:"100%",height:"400px"}})}return(0,y.jsx)("p",{children:p.Z.I18n.t("systemInfoDataError")})}var gl=function(){const e=window.systemInfoData;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,y.jsx)("p",{children:p.Z.I18n.t("systemInfoIntro")})}),fl(e)]})};function vl(e){return(0,y.jsx)("table",{className:"widefat fixed",style:{maxWidth:e.max_width},children:(0,y.jsx)("tbody",{children:e.rows.map((e=>(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{className:"row-title",children:e.key}),(0,y.jsx)("td",{children:e.value})]},`row_${e.key}`)))})})}vl.propTypes={max_width:g().string,rows:g().arrayOf(g().shape({key:g().string.isRequired,value:g().oneOfType([g().string,g().number,g().element]).isRequired})).isRequired},vl.defaultProps={max_width:"auto"};var bl=vl;function yl(e){return(0,y.jsx)("span",{children:!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown})}yl.propTypes={truthy:g().string,falsy:g().string,unknown:g().string,children:g().bool},yl.defaultProps={truthy:p.Z.I18n.t("yes"),falsy:p.Z.I18n.t("no"),unknown:p.Z.I18n.t("unknown"),children:null};var wl=yl;function xl(e){const t=e.status_data,n={active:p.Z.I18n.t("running"),inactive:p.Z.I18n.t("cronWaiting")},r=Array.isArray(t.last_error)?(0,y.jsx)(y.Fragment,{children:t.last_error.map((e=>(0,y.jsxs)("div",{children:[e.worker,":"," ",(0,y.jsx)("i",{children:e.message})]},e.worker)))}):t.last_error;return(0,y.jsxs)("div",{children:[(0,y.jsx)("h4",{children:p.Z.I18n.t("systemStatusCronStatusTitle")}),(0,y.jsx)(bl,{max_width:"400px",rows:[{key:p.Z.I18n.t("accessible"),value:(0,y.jsx)(wl,{children:t.accessible})},{key:p.Z.I18n.t("status"),value:n[t.status]?n[t.status]:p.Z.I18n.t("unknown")},{key:p.Z.I18n.t("lastUpdated"),value:t.updated_at?p.Z.Date.full(1e3*t.updated_at):p.Z.I18n.t("unknown")},{key:p.Z.I18n.t("lastRunStarted"),value:t.run_accessed_at?p.Z.Date.full(1e3*t.run_started_at):p.Z.I18n.t("unknown")},{key:p.Z.I18n.t("lastRunCompleted"),value:t.run_completed_at?p.Z.Date.full(1e3*t.run_completed_at):p.Z.I18n.t("unknown")},{key:p.Z.I18n.t("lastSeenError"),value:r||p.Z.I18n.t("none")},{key:p.Z.I18n.t("lastSeenErrorDate"),value:t.last_error_date?p.Z.Date.full(1e3*t.last_error_date):p.Z.I18n.t("unknown")}]})]})}xl.propTypes={status_data:g().shape({accessible:g().bool,last_error_date:g().string,status:g().string,updated_at:g().number,run_accessed_at:g().number,run_completed_at:g().number,run_started_at:g().number,last_error:g().oneOfType([g().string,g().array])}).isRequired};var _l=xl;function Zl(e){let t=e.task.scheduled_at;t&&(t=(0,kr.default)(t,"yyyy-MM-dd HH:mm:ss",new Date));const n=(0,kr.default)(e.task.updated_at,"yyyy-MM-dd HH:mm:ss",new Date);return(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{className:"column column-primary",children:e.task.id}),(0,y.jsx)("td",{className:"column",children:e.task.type}),(0,y.jsx)("td",{className:"column",children:e.task.newsletter?(0,y.jsx)("a",{href:e.task.newsletter.preview_url,"data-newsletter-id":e.task.newsletter.newsletter_id,"data-queue-id":e.task.newsletter.queue_id,target:"_blank",rel:"noopener noreferrer",children:e.task.newsletter.subject||p.Z.I18n.t("preview")}):p.Z.I18n.t("none")}),(0,y.jsx)("td",{className:"column",children:e.task.priority}),e.show_scheduled_at?(0,y.jsx)("td",{className:"column-date",children:(0,y.jsx)("abbr",{children:`${p.Z.Date.short(t)} ${p.Z.Date.time(t)}`})}):null,(0,y.jsx)("td",{className:"column-date",children:(0,y.jsx)("abbr",{children:`${p.Z.Date.short(n)} ${p.Z.Date.time(n)}`})})]})}Zl.propTypes={show_scheduled_at:g().bool,task:g().shape({id:g().number.isRequired,type:g().string.isRequired,priority:g().number.isRequired,updated_at:g().string.isRequired,scheduled_at:g().string,status:g().string,newsletter:g().shape({newsletter_id:g().number.isRequired,queue_id:g().number.isRequired,preview_url:g().string.isRequired,subject:g().string})}).isRequired},Zl.defaultProps={show_scheduled_at:!1};var jl=Zl;function Il(e){return(0,y.jsxs)("tr",{children:[(0,y.jsx)("th",{className:"row-title",children:"Id"}),(0,y.jsx)("th",{className:"row-title",children:p.Z.I18n.t("type")}),(0,y.jsx)("th",{className:"row-title",children:p.Z.I18n.t("email")}),(0,y.jsx)("th",{className:"row-title",children:p.Z.I18n.t("priority")}),e.show_scheduled_at?(0,y.jsx)("th",{className:"row-title",children:p.Z.I18n.t("scheduledAt")}):null,(0,y.jsx)("th",{className:"row-title",children:p.Z.I18n.t("updatedAt")})]})}Il.propTypes={show_scheduled_at:g().bool},Il.defaultProps={show_scheduled_at:!1};var Sl=Il;function Cl(e){const t=e.show_scheduled_at?6:5;return(0,y.jsxs)("table",{className:"widefat fixed striped",children:[(0,y.jsx)("thead",{children:(0,y.jsx)(Sl,{show_scheduled_at:e.show_scheduled_at})}),(0,y.jsx)("tbody",{children:e.tasks.length?e.tasks.map((t=>(0,y.jsx)(jl,{task:t,show_scheduled_at:e.show_scheduled_at},t.id))):(0,y.jsx)("tr",{className:"mailpoet-listing-no-items",children:(0,y.jsx)("td",{colSpan:t,children:p.Z.I18n.t("nothingToShow")})})}),(0,y.jsx)("tfoot",{children:(0,y.jsx)(Sl,{show_scheduled_at:e.show_scheduled_at})})]})}Cl.propTypes={show_scheduled_at:g().bool,tasks:g().arrayOf(jl.propTypes.task).isRequired},Cl.defaultProps={show_scheduled_at:!1};var Tl=Cl;function kl(e){const t=e.status_data;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("h4",{children:p.Z.I18n.t("systemStatusQueueTitle")}),(0,y.jsx)(bl,{max_width:"400px",rows:[{key:p.Z.I18n.t("status"),value:"paused"===t.status?p.Z.I18n.t("paused"):p.Z.I18n.t("running")},{key:p.Z.I18n.t("startedAt"),value:t.started?p.Z.Date.full(1e3*t.started):p.Z.I18n.t("unknown")},{key:p.Z.I18n.t("sentEmails"),value:t.sent||0},{key:p.Z.I18n.t("retryAttempt"),value:t.retry_attempt||p.Z.I18n.t("none")},{key:p.Z.I18n.t("retryAt"),value:t.retry_at?p.Z.Date.full(1e3*t.retry_at):p.Z.I18n.t("none")},{key:p.Z.I18n.t("error"),value:t.error?t.error.error_message:p.Z.I18n.t("none")},{key:p.Z.I18n.t("totalCompletedTasks"),value:t.tasksStatusCounts.completed},{key:p.Z.I18n.t("totalRunningTasks"),value:t.tasksStatusCounts.running},{key:p.Z.I18n.t("totalPausedTasks"),value:t.tasksStatusCounts.paused},{key:p.Z.I18n.t("totalScheduledTasks"),value:t.tasksStatusCounts.scheduled}]}),(0,y.jsx)("h5",{children:p.Z.I18n.t("scheduledTasks")}),(0,y.jsx)(Tl,{show_scheduled_at:!0,tasks:t.latestTasks.filter((e=>"scheduled"===e.status))}),(0,y.jsx)("h5",{children:p.Z.I18n.t("runningTasks")}),(0,y.jsx)(Tl,{tasks:t.latestTasks.filter((e=>null===e.status))}),(0,y.jsx)("h5",{children:p.Z.I18n.t("completedTasks")}),(0,y.jsx)(Tl,{tasks:t.latestTasks.filter((e=>"completed"===e.status))})]})}kl.propTypes={status_data:g().shape({status:g().string,started:g().number,sent:g().number,retry_attempt:g().number,retry_at:g().number,error:g().shape({operation:g().string,error_message:g().string}),tasksStatusCounts:g().shape({completed:g().number.isRequired,running:g().number.isRequired,paused:g().number.isRequired,scheduled:g().number.isRequired}).isRequired,latestTasks:g().arrayOf(jl.propTypes.task).isRequired}).isRequired};var Nl=kl;function Dl(e,t,n,r,a,s){const i=e?"success":"error";let o=e?t:n;return r&&(o=k()(o,/\[link\](.*?)\[\/link\]/g,(e=>(0,y.jsx)("a",{className:"mailpoet-text-link",href:r,"data-beacon-article":a,children:e},"kb-link")))),(0,y.jsxs)("div",{className:`mailpoet_notice notice inline notice-${i}`,children:[(0,y.jsx)("p",{children:o}),s?(0,y.jsx)("p",{children:(0,y.jsx)("i",{children:s})}):null]})}function El(e){const t=e.cron.isReachable,n=e.cron.url,r=`${p.Z.I18n.t("systemStatusConnectionUnsuccessful")} ${p.Z.I18n.t("systemStatusCronConnectionUnsuccessfulInfo")}`,a=p.Z.I18n.t("systemStatusConnectionSuccessful"),s=t?null:e.cron.pingResponse;return(0,y.jsxs)("div",{children:[(0,y.jsx)("h4",{children:p.Z.I18n.t("systemStatusCronTitle")}),(0,y.jsx)("p",{children:(0,y.jsx)("a",{className:"mailpoet-text-link",href:n,target:"_blank",rel:"noopener noreferrer",children:n})}),Dl(t,a,r,"https://kb.mailpoet.com/article/231-sending-does-not-work","5a0257ac2c7d3a272c0d7ad6",s)]})}function Ol(e){const t=e.mss.enabled?`${p.Z.I18n.t("systemStatusConnectionUnsuccessful")} ${p.Z.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo")}`:p.Z.I18n.t("systemStatusMSSConnectionCanNotConnect"),n=e.mss.enabled?p.Z.I18n.t("systemStatusConnectionSuccessful"):p.Z.I18n.t("systemStatusMSSConnectionCanConnect");return(0,y.jsxs)("div",{children:[(0,y.jsx)("h4",{children:p.Z.I18n.t("systemStatusMSSTitle")}),Dl(e.mss.isReachable,n,t,"https://kb.mailpoet.com/article/319-known-errors-when-validating-a-mailpoet-key","5ef1da9d2c7d3a10cba966c5",null)]})}var Rl=function(){const e=window.systemStatusData;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,y.jsx)("p",{children:e.mss.enabled?p.Z.I18n.t("systemStatusIntroCronMSS"):p.Z.I18n.t("systemStatusIntroCron")})}),El(e),Ol(e),(0,y.jsx)(_l,{status_data:e.cronStatus}),(0,y.jsx)(Nl,{status_data:e.queueStatus})]})},Al=function(){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("p",{children:p.Z.I18n.t("yourPrivacyContent1")}),(0,y.jsx)("p",{children:p.Z.I18n.t("yourPrivacyContent2")}),(0,y.jsx)("p",{children:p.Z.I18n.t("yourPrivacyContent3")}),(0,y.jsx)(v.Z,{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/",children:p.Z.I18n.t("yourPrivacyButton")})]})};function Pl(){return(0,y.jsxs)(Fe.k.Provider,{value:(0,Fe.S)(window),children:[(0,y.jsx)(F.D,{}),(0,y.jsx)(Ge.Z,{}),(0,y.jsxs)(ms.Z,{activeKey:"knowledgeBase",children:[(0,y.jsx)(is.Z,{title:p.Z.I18n.t("tabKnowledgeBaseTitle"),children:(0,y.jsx)(ml,{})},"knowledgeBase"),(0,y.jsx)(is.Z,{title:p.Z.I18n.t("tabSystemStatusTitle"),children:(0,y.jsx)(Rl,{})},"systemStatus"),(0,y.jsx)(is.Z,{title:p.Z.I18n.t("tabSystemInfoTitle"),children:(0,y.jsx)(gl,{})},"systemInfo"),(0,y.jsx)(is.Z,{title:p.Z.I18n.t("tabYourPrivacyTitle"),children:(0,y.jsx)(Al,{})},"yourPrivacy")]})]})}const Ml=document.getElementById("help_container");Ml&&o().render((0,y.jsx)(Pl,{}),Ml);var Ll=(0,c.withRouter)((function(e){let{children:t,location:{pathname:n}}=e;return(0,j.useEffect)((()=>{window.scrollTo(0,0)}),[n]),t||null}));function Fl(e){let{activeMethod:t,onMethodChange:n}=e;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,y.jsx)("span",{className:"mailpoet_import_heading",children:p.Z.I18n.t("methodSelectionHead")}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs-row",children:(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/242-video-guide-importing-subscribers-using-a-csv-file","data-beacon-article":"5a8e8f0204286305fbc9be9a",target:"_blank",rel:"noopener noreferrer",children:(0,y.jsx)(b.Z,{dimension:"large",variant:"excellent",isInverted:!0,children:p.Z.I18n.t("seeVideo")})})})]}),(0,y.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,y.jsx)(me.Z,{name:"select_method",automationId:"import-paste-method",id:"import-paste-method",checked:"paste-method"===t,value:"paste-method",onCheck:n}),(0,y.jsx)("label",{htmlFor:"import-paste-method",children:p.Z.I18n.t("methodPaste")})]}),(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,y.jsx)(me.Z,{name:"select_method",automationId:"import-csv-method",id:"import-csv-method",checked:"file-method"===t,value:"file-method",onCheck:n}),(0,y.jsx)("label",{htmlFor:"import-csv-method",children:p.Z.I18n.t("methodUpload")})]}),(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,y.jsx)(me.Z,{name:"select_method",automationId:"import-mailchimp-method",id:"import-mailchimp-method",checked:"mailchimp-method"===t,value:"mailchimp-method",onCheck:n}),(0,y.jsx)("label",{htmlFor:"import-mailchimp-method",children:p.Z.I18n.t("methodMailChimp")})]})]})]})}Fl.propTypes={activeMethod:g().string,onMethodChange:g().func.isRequired},Fl.defaultProps={activeMethod:void 0};var ql=Fl;function $l(e){let{hidePrevious:t,isLastStep:n,canGoNext:r,onPreviousAction:a,onNextAction:s}=e;return(0,y.jsxs)("div",{className:"mailpoet-settings-save",children:[!t&&(0,y.jsx)(v.Z,{type:"button",variant:"secondary",onClick:a,children:p.Z.I18n.t("previousStep")}),(0,y.jsx)(v.Z,{type:"button",automationId:"import-next-step",isDisabled:!r,onClick:()=>{r&&s()},children:p.Z.I18n.t(n?"import":"nextStep")})]})}$l.propTypes={canGoNext:g().bool,hidePrevious:g().bool,isLastStep:g().bool,onPreviousAction:g().func,onNextAction:g().func},$l.defaultProps={hidePrevious:!1,isLastStep:!1,canGoNext:!0,onPreviousAction:()=>{},onNextAction:()=>{}};var Ul=$l;function Vl(e){let{onValueChange:t,canFinish:n,onFinish:r,data:a,onPrevious:s}=e;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,y.jsx)("label",{htmlFor:"paste_input",children:p.Z.I18n.t("pasteLabel")}),(0,y.jsx)("p",{className:"description",children:k()(p.Z.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,y.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files","data-beacon-article":"57ce079f903360649f6e56fc",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsx)(oe.Z,{id:"paste_input",rows:"15",placeholder:"Email, First Name, Last Name\njohn@doe.com, John, Doe\nmary@smith.com, Mary, Smith\njohnny@walker.com, Johnny, Walker",isCode:!0,onChange:e=>{t(e.target.value)},defaultValue:a})}),(0,y.jsx)(Ul,{canGoNext:n,onPreviousAction:s,onNextAction:r})]})}Vl.propTypes={onFinish:g().func,onPrevious:g().func,canFinish:g().bool.isRequired,onValueChange:g().func.isRequired,data:g().string},Vl.defaultProps={onFinish:()=>{},onPrevious:()=>{},data:""};var Wl=Vl;function Yl(e){let{onValueChange:t,canFinish:n,onFinish:r,onPrevious:a}=e;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,y.jsx)("label",{htmlFor:"file_local",children:p.Z.I18n.t("methodUpload")}),(0,y.jsx)("p",{className:"description",children:k()(p.Z.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,y.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files","data-beacon-article":"57ce079f903360649f6e56fc",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsx)(ae.Z,{type:"file",id:"file_local",accept:".csv","data-automation-id":"import-file-upload-input",onChange:e=>{const n=e.target.value.match(/[^.]+$/);p.Z.Notice.hide(),null===n||"csv"!==n[0].toLowerCase()?(p.Z.Notice.error(p.Z.I18n.t("wrongFileFormat")),t("")):t(e.target.files[0])}})}),(0,y.jsx)(Ul,{canGoNext:n,onPreviousAction:a,onNextAction:r})]})}Yl.propTypes={canFinish:g().bool.isRequired,onFinish:g().func,onPrevious:g().func,onValueChange:g().func.isRequired},Yl.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var Bl=Yl;function Hl(e){let{onFinish:t,onPrevious:n}=e;const[r,a]=(0,j.useState)(""),[s,i]=(0,j.useState)(void 0),[o,l]=(0,j.useState)([]);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet-settings-label",children:(0,y.jsxs)("label",{htmlFor:"mailpoet_mailchimp_key_input",children:[(0,y.jsx)("span",{className:"mailpoet_import_heading",children:p.Z.I18n.t("methodMailChimpLabel")}),(0,y.jsx)("p",{className:"description",children:k()(p.Z.I18n.t("methodMailChimpDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,y.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/255-migrating-from-mailchimp-to-mailpoet#api","data-beacon-article":"5b16db842c7d3a0fa9a2aa15",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]})}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,y.jsx)(ae.Z,{dimension:"small",id:"mailpoet_mailchimp_key_input",type:"text",onChange:e=>{a(e.target.value),""===e.target.value.trim()&&i(void 0)}}),(0,y.jsx)("span",{className:"mailpoet-gap"}),(0,y.jsx)(v.Z,{type:"button",dimension:"small",onClick:()=>{p.Z.Modal.loading(!0),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpLists",data:{api_key:r}}).always((()=>{p.Z.Modal.loading(!1)})).done((e=>i(e.data))).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},children:p.Z.I18n.t("methodMailChimpVerify")}),(0,y.jsx)("span",{className:"mailpoet-gap"}),(0,y.jsx)("span",{children:Array.isArray(s)&&0===s.length?p.Z.I18n.t("noMailChimpLists"):null})]})}),s?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet-settings-label",children:p.Z.I18n.t("methodMailChimpSelectList")}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsx)(C,{field:{id:"segments",name:"list-selection",multiple:!0,placeholder:p.Z.I18n.t("methodMailChimpSelectPlaceholder"),forceSelect2:!0,values:s},onValueChange:e=>l(e.target.value)})})]}):null,(0,y.jsx)(Ul,{canGoNext:Array.isArray(o)&&o.length>0,onPreviousAction:n,onNextAction:()=>{p.Z.Modal.loading(!0),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:r,lists:o}}).always((()=>{p.Z.Modal.loading(!1)})).done((e=>t(e.data))).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}})]})}Hl.propTypes={onFinish:g().func,onPrevious:g().func},Hl.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var zl=Hl,Kl=n(57460),Gl=n.n(Kl);const Ql=e=>window.roleBasedEmails.findIndex((t=>e.startsWith(`${t}@`)))>=0,Xl=e=>{let t,n=I.ZP.unescape(e);return n=n.toLowerCase().replace(/^["';.,\s]+|[^\x20-\x7E]+$|["';.,_\s]+$/g,"").replace(/\s+|%\d+|,+/g,""),t=/<(.*?)>/.exec(n),t&&(n=t[1].trim()),t=/mailto:(?:\s+)?(.*)/.exec(n),t&&(n=t[1].trim()),!!window.mailpoet_email_regex.test(n)&&!Ql(n)&&n};var Jl=(e,t)=>{const n=encodeURI(e).split(/%..|./).length-1;p.Z.Notice.hide(),n>window.maxPostSizeBytes?p.Z.Notice.error(p.Z.I18n.t("maxPostSizeNotice")):(p.Z.Modal.loading(!0),Gl().parse(e,function(e){return{skipEmptyLines:!0,error(){p.Z.Notice.hide(),p.Z.Notice.error(p.Z.I18n.t("dataProcessingError"))},complete(t){const n=function(e){let t=[];const n=[],r=[],a=[],s=[];let i,o,l,c,d=null,u=null,p=!1;return Object.keys(e).forEach((m=>{l=e[m].map((e=>e.trim())),c=l.length,null===u&&(u=c),c===u&&(null===d?(Object.keys(l).forEach((e=>{o=Xl(l[e]),null===d&&window.mailpoet_email_regex.test(o)&&(d=e,n[o]=!0,l[e]=o,t[o]=l)})),null===d&&0===parseInt(m,10)&&(p=!0,t[0]=l)):""!==l[d]&&(i=Xl(l[d]),I.ZP.has(n,i)?r.push(i):Ql(l[d])?s.push(l[d]):window.mailpoet_email_regex.test(i)?(n[i]=!0,l[d]=i,t[i]=l):a.push(l[d])))})),t=I.ZP.values(t),t&&(p&&t.length>=2||!p&&t.length>=1)?{header:window.mailpoet_email_regex.test(t[0][d])?null:t.shift(),subscribers:t,subscribersCount:t.length,duplicate:I.ZP.uniq(r),invalid:I.ZP.uniq(a),role:I.ZP.uniq(s)}:null}(t.data);if(n)e(n);else{let e=p.Z.I18n.t("noValidRecords");e=e.replace("[link]",'<a href="https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files" data-beacon-article="57ce079f903360649f6e56fc">'),e=e.replace("[/link]","</a>"),p.Z.Notice.error(e)}p.Z.Modal.loading(!1)}}}(t)))};function ec(e){let{history:t,setStepMethodSelectionData:n,subscribersLimitForValidation:r}=e;const[a,s]=(0,j.useState)(void 0),[i,o]=(0,j.useState)(""),[l,c]=(0,j.useState)(void 0),d=e=>{n(e),t.push(((e,t,n)=>void 0===e||void 0===e.subscribersCount||e.subscribersCount<t||"mailchimp-method"===n?"step_data_manipulation":"step_input_validation")(e,r,a))},u=()=>{t.push("/step_clean_list")},m=()=>{Jl("paste-method"===a?i:l,(e=>{p.Z.trackEvent("Subscribers import started",{source:"file-method"===a?"file upload":"pasted data"}),d(e)}))};return(0,y.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,y.jsx)(ql,{activeMethod:a,onMethodChange:s}),"paste-method"===a&&(0,y.jsx)(Wl,{onPrevious:u,onValueChange:o,onFinish:m,canFinish:!!i.trim(),data:i}),"file-method"===a&&(0,y.jsx)(Bl,{onPrevious:u,onValueChange:c,onFinish:m,canFinish:!!l,data:l}),"mailchimp-method"===a&&(0,y.jsx)(zl,{onPrevious:u,onFinish:e=>{p.Z.trackEvent("Subscribers import started",{source:"MailChimp"}),d(e)}}),void 0===a&&(0,y.jsx)(Ul,{canGoNext:!1,onPreviousAction:u})]})}ec.propTypes={history:g().shape({push:g().func.isRequired}).isRequired,setStepMethodSelectionData:g().func.isRequired,subscribersLimitForValidation:g().number.isRequired};var tc=(0,c.withRouter)(ec);function nc(e){let{onProceed:t}=e;return(0,y.jsxs)("div",{className:"mailpoet-clean-list-step-container",children:[(0,y.jsx)("p",{children:p.Z.I18n.t("cleanListText1")}),(0,y.jsx)("p",{children:p.Z.I18n.t("cleanListText2")}),(0,y.jsxs)("p",{children:[t&&(0,y.jsx)(v.Z,{onClick:t,variant:"tertiary",children:p.Z.I18n.t("listCleaningGotIt")}),(0,y.jsx)(v.Z,{target:"_blank",href:"https://kb.mailpoet.com/article/287-list-cleaning-services",children:p.Z.I18n.t("tryListCleaning")})]})]})}function rc(e){let{onSubmit:t,history:n}=e;const[r,a]=(0,j.useState)(void 0);return(0,y.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,y.jsx)("div",{className:"mailpoet-settings-label",children:p.Z.I18n.t("validationStepHeading")}),(0,y.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,y.jsx)(me.Z,{automationId:"mailpoet_import_validation_step_option1",id:"existing-list",checked:"existing-list"===r,value:"existing-list",onCheck:a}),(0,y.jsx)("label",{htmlFor:"existing-list",children:p.Z.I18n.t("validationStepRadio1")})]}),(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,y.jsx)(me.Z,{automationId:"mailpoet_import_validation_step_option2",id:"address-book",checked:"address-book"===r,value:"address-book",onCheck:a}),(0,y.jsx)("label",{htmlFor:"address-book",children:p.Z.I18n.t("validationStepRadio2")})]})]}),(0,y.jsx)(Ul,{canGoNext:void 0!==r,onPreviousAction:()=>n.push("step_method_selection"),onNextAction:()=>t(r)})]})}rc.propTypes={history:g().shape({push:g().func.isRequired}).isRequired,onSubmit:g().func.isRequired};var ac=rc,sc=function(){return(0,y.jsxs)("div",{className:"mailpoet-clean-list-step-container","data-automation-id":"import_wrong_source_block",children:[(0,y.jsx)("p",{children:p.Z.I18n.t("validationStepBlock1")}),(0,y.jsx)("p",{children:p.Z.I18n.t("validationStepBlock2")}),(0,y.jsx)("p",{children:(0,y.jsx)(v.Z,{href:"https://kb.mailpoet.com/article/269-reconfirm-subscribers-to-your-list",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("validationStepBlockButton")})})]})};function ic(e){let{onSubmit:t}=e;const[n,r]=(0,j.useState)("over2years"),a=(0,j.useCallback)((e=>{r(e.target.value)}),[r]),s=(0,j.useCallback)((()=>{t("over2years"===n||"1to2years"===n?"notRecently":"recently")}),[t,n]);return(0,y.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,y.jsx)("div",{className:"mailpoet-settings-label",children:p.Z.I18n.t("validationStepLastSentHeading")}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsxs)(de.Z,{defaultValue:n,onChange:a,automationId:"last_sent_to_list",children:[(0,y.jsx)("option",{value:"over2years",children:p.Z.I18n.t("validationStepLastSentOption1")}),(0,y.jsx)("option",{value:"1to2years",children:p.Z.I18n.t("validationStepLastSentOption2")}),(0,y.jsx)("option",{value:"less1year",children:p.Z.I18n.t("validationStepLastSentOption3")}),(0,y.jsx)("option",{value:"less3months",children:p.Z.I18n.t("validationStepLastSentOption4")})]})}),(0,y.jsx)("div",{className:"mailpoet-settings-save",children:(0,y.jsx)(v.Z,{type:"button",automationId:"last_sent_to_list_next",onClick:s,children:p.Z.I18n.t("validationStepLastSentNext")})})]})}ic.propTypes={onSubmit:g().func.isRequired};var oc=ic;function lc(e){let{stepMethodSelectionData:t,history:n}=e;const[r,a]=(0,j.useState)(void 0),[s,i]=(0,j.useState)(void 0);(0,j.useEffect)((()=>{void 0===t&&n.replace("step_method_selection")}),[t,n]);const o=(0,j.useCallback)((e=>{i(e),"recently"===e&&n.push("step_data_manipulation")}),[n,i]);return(0,y.jsxs)(y.Fragment,{children:[void 0===r&&(0,y.jsx)(ac,{onSubmit:a,history:n}),"address-book"===r&&(0,y.jsx)(sc,{}),"existing-list"===r&&void 0===s&&(0,y.jsx)(oc,{onSubmit:o}),"existing-list"===r&&"notRecently"===s&&(0,y.jsx)(nc,{})]})}lc.propTypes={history:g().shape({push:g().func.isRequired,replace:g().func.isRequired}).isRequired,stepMethodSelectionData:g().shape({duplicate:g().arrayOf(g().string),header:g().arrayOf(g().string),invalid:g().arrayOf(g().string),role:g().arrayOf(g().string),subscribersCount:g().number,subscribers:g().arrayOf(g().arrayOf(g().string))})},lc.defaultProps={stepMethodSelectionData:void 0};var cc=(0,c.withRouter)(lc);const dc=e=>{let{translation:t,subscribers:n}=e,r="";return n.length&&(r=k()(t.replace("%2$s",n.join(", ")),"%1$s",(()=>(0,y.jsx)("strong",{children:n.length.toLocaleString()},t))),r=(0,y.jsx)("p",{children:r})),r};function uc(e){let{stepMethodSelectionData:t}=e;const{invalid:n,duplicate:r,role:a}=t,[s,i]=(0,j.useState)(!1),o=h()("mailpoet_subscribers_data_parse_results_details",{mailpoet_hidden:!s}),l=(0,y.jsx)(dc,{translation:p.Z.I18n.t("importNoticeInvalid"),subscribers:n}),c=(0,y.jsx)(dc,{translation:p.Z.I18n.t("importNoticeDuplicate"),subscribers:r});let d="";if(a.length&&(d=k()(p.Z.I18n.t("importNoticeRoleBased"),/(%1\$s|\[link\].*\[\/link\]|%2\$s)/,(e=>"%1$s"===e?(0,y.jsx)("strong",{children:a.length.toLocaleString()},"role-length"):"%2$s"===e?a.join(", "):(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/270-role-based-email-addresses-are-not-allowed","data-beacon-article":"5d0a1da404286318cac46fe5",target:"_blank",rel:"noopener noreferrer",children:e.replace("[link]","").replace("[/link]","")},e))),d=(0,y.jsx)("p",{children:d})),n.length||r.length||a.length){const e=n.length+r.length+a.length;return(0,y.jsxs)("div",{className:"error",children:[(0,y.jsxs)("p",{children:[k()(p.Z.I18n.t("importNoticeSkipped"),"%1$s",(()=>(0,y.jsx)("strong",{children:e.toLocaleString()},"lengths")))," ",(0,y.jsx)("a",{className:"mailpoet_subscribers_data_parse_results_details_show","data-automation-id":"show-more-details",onClick:()=>i(!s),role:"button",tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),i(!s))},children:p.Z.I18n.t("showMoreDetails")})]}),(0,y.jsxs)("div",{className:o,children:[(0,y.jsx)("hr",{}),l,c,d]})]})}return null}dc.propTypes={translation:g().string.isRequired,subscribers:g().arrayOf(g().string).isRequired},uc.propTypes={stepMethodSelectionData:g().shape({duplicate:g().arrayOf(g().string),invalid:g().arrayOf(g().string),role:g().arrayOf(g().string)})},uc.defaultProps={stepMethodSelectionData:{invalid:[],duplicate:[],role:[]}};var pc=uc;function mc(e){let{header:t,subscribers:n}=e;const r=((e,t)=>{const n=[],r=[];let a,s,i,o;return Object.keys(e[0]).forEach((l=>{a=e[0][l],s="ignore",a%1!=0&&window.mailpoet_email_regex.test(a)?s="email":t&&(i=t[l],o=window.mailpoetColumns.map((e=>e.name)).indexOf(i),-1!==o?s=window.mailpoetColumns[o].id:i&&(/first|first name|given name/i.test(i)?s="first_name":/last|last name/i.test(i)&&(s="last_name"))),s="ignore"!==s&&-1===r.indexOf(s)?s:"ignore",n[l]={column_id:s},r.push(s)})),n})(n,t);return(0,y.jsxs)("tr",{children:[(0,y.jsx)("th",{children:p.Z.I18n.t("matchData")}),r.map(((e,t)=>(0,y.jsx)("th",{children:(0,y.jsx)("select",{className:"mailpoet_subscribers_column_data_match","data-column-id":e.column_id,"data-column-index":t,id:`column_${t}`})},e.column_id+t)))]})}function hc(e){let{header:t}=e;return(0,y.jsxs)("tr",{className:"mailpoet_header",children:[(0,y.jsx)("td",{}),t.map((e=>(0,y.jsx)("td",{children:e},e)))]})}function fc(e){let{subscriber:t,index:n}=e;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("td",{children:n}),t.map(((e,t)=>(0,y.jsx)("td",{children:e},`${e}-${n}-${t}`)))]})}function gc(e){let{subscribers:t,subscribersCount:n}=e;const r=". . .",a=Array(t[0].length).fill(r);return(0,y.jsxs)(y.Fragment,{children:[t.slice(0,10).map(((e,t)=>(0,y.jsx)("tr",{children:(0,y.jsx)(fc,{subscriber:e,index:t+1})},`${e[0]}-${t}`))),n>11?(0,y.jsx)("tr",{children:(0,y.jsx)(fc,{subscriber:a,index:r})},"filler"):null,n>10?(0,y.jsx)("tr",{children:(0,y.jsx)(fc,{subscriber:t[n-1],index:n})},t[n-1][0]):null]})}function vc(e){let{subscribersCount:t,subscribers:n,header:r}=e;return(0,j.useLayoutEffect)((()=>{(()=>{const e={data:window.mailpoetColumnsSelect2,width:"15em"};u()("select.mailpoet_subscribers_column_data_match").select2(e).on("select2:selecting",(t=>{const n=t.currentTarget,r=t.params.args.data.id;"create"===r?(t.preventDefault(),u()(n).select2("close"),p.Z.Modal.popup({title:p.Z.I18n.t("addNewField"),template:u()("#form_template_field_form").html()}),u()("#form_field_new").parsley().on("form:submit",(()=>{const t=u()("#form_field_new").mailpoetSerializeObject();return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:t}).done((t=>{const r={id:t.data.id,name:t.data.name,text:t.data.name,type:t.data.type,params:t.data.params,custom:!0};2===window.mailpoetColumnsSelect2.length&&window.mailpoetColumnsSelect2.push({name:p.Z.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(r),window.mailpoetColumns.push(r),u()("select.mailpoet_subscribers_column_data_match").each((()=>{u()(n).html("").select2("destroy").select2(e)})),u()(n).data("column-id",r.id),p.Z.Modal.close()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#field_name"})})),!1}))):u()("select.mailpoet_subscribers_column_data_match").each((()=>{const e=n,a=u()(e).val();a===r&&"ignore"!==a&&(confirm(`${p.Z.I18n.t("selectedValueAlreadyMatched")} ${p.Z.I18n.t("confirmCorrespondingColumn")}`)?u()(e).data("column-id","ignore"):(t.preventDefault(),u()(n).select2("close")))}))})).on("select2:select",(e=>{const t=e.currentTarget,n=e.params.data.id;u()(t).data("column-id",n)})).on("select2:open",(()=>{const e=document.querySelectorAll(".select2-search__field[aria-controls]");0!==e.length&&e[e.length-1].focus()})),u().map(u()(".mailpoet_subscribers_column_data_match"),(e=>{const t=u()(e).data("column-id");u()(e).val(t).trigger("change")}))})()})),(0,y.jsx)("div",{className:"subscribers_data",children:(0,y.jsxs)("table",{className:"mailpoet_subscribers widefat fixed",children:[(0,y.jsx)("thead",{children:(0,y.jsx)(mc,{header:r,subscribers:n})}),(0,y.jsxs)("tbody",{children:[r?(0,y.jsx)(hc,{header:r}):null,(0,y.jsx)(gc,{subscribers:n,subscribersCount:t})]})]})})}mc.propTypes={subscribers:g().arrayOf(g().arrayOf(g().oneOfType([g().string,g().number]))).isRequired,header:g().arrayOf(g().string)},mc.defaultProps={header:[]},hc.propTypes={header:g().arrayOf(g().string).isRequired},fc.propTypes={subscriber:g().arrayOf(g().oneOfType([g().string,g().number])).isRequired,index:g().node.isRequired},gc.propTypes={subscribersCount:g().number.isRequired,subscribers:g().arrayOf(g().arrayOf(g().oneOfType([g().string,g().number]))).isRequired},vc.propTypes={subscribersCount:g().number,subscribers:g().arrayOf(g().arrayOf(g().oneOfType([g().string,g().number]))),header:g().arrayOf(g().string)},vc.defaultProps={subscribersCount:0,subscribers:[],header:[]};var bc=vc;function yc(e){let{setSelectedSegments:t}=e;const{segments:n}=(0,j.useContext)(Fe.k),{all:r,updateAll:a}=n,[s,i]=(0,j.useState)(r);(0,j.useLayoutEffect)((()=>{!function(e,n){const r=u()("select#mailpoet_segments_select");if(r.data("select2"))return;const a=e=>{let t=`<span class="mailpoet-form-select2-text"><span>${e.name}</span></span>`;return e.count&&(t+=`<span class="mailpoet-form-select2-count">${e.count}</span>`),t};r.html(""),r.select2({data:e.map((e=>({...e,text:e.name}))),dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:a,templateSelection:a}).on("change",(e=>{const n=u()('[data-id="notice_segmentSelection"]');e.currentTarget.value?u()('[data-id="notice_segmentSelection"]').remove():n.length||p.Z.Notice.error(p.Z.I18n.t("segmentSelectionRequired"),{static:!0,scroll:!0,id:"notice_segmentSelection",hideClose:!0});(e=>{t(e)})(I.ZP.pluck(r.select2("data"),"id"))}))}(s)}),[s,t]);const o=e=>{!function(){const e=u()("select#mailpoet_segments_select");e.data("select2")&&(e.select2("destroy"),e.find("option").remove(),e.off("select2:unselecting").off("change").off("select2:opening"))}(),t([]),i([...s,e]),a([...s,e])};return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet-settings-label",children:(0,y.jsxs)("label",{htmlFor:"mailpoet_segments_select",children:[p.Z.I18n.t("pickLists"),(0,y.jsx)("p",{className:"description",children:p.Z.I18n.t("pickListsDescription")})]})}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,y.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,y.jsx)("select",{id:"mailpoet_segments_select","data-placeholder":p.Z.I18n.t("select"),multiple:"multiple",children:(0,y.jsx)("option",{})})}),(0,y.jsx)(v.Z,{variant:"tertiary",onClick:()=>{return e=o,p.Z.Modal.popup({title:p.Z.I18n.t("addNewList"),template:u()("#new_segment_template").html()}),u()("#new_segment_name").on("keypress",(e=>{13===e.which&&u()("#new_segment_process").trigger("click")})),u()("#new_segment_process").on("click",(()=>{const t=u()("#new_segment_name").val().trim(),n=u()("#new_segment_description").val().trim();p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"addSegment",data:{name:t,description:n}}).done((t=>{e({id:t.data.id,name:t.data.name,text:t.data.name,subscriberCount:0}),p.Z.Modal.close()})).fail((e=>{e.errors.length>0&&(p.Z.Notice.hide(),p.Z.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#new_segment_name"}))}))})),void u()("#new_segment_cancel").on("click",(()=>{p.Z.Modal.close()}));var e},children:p.Z.I18n.t("createANewList")})]})})]})}yc.propTypes={setSelectedSegments:g().func.isRequired};var wc=yc;function xc(){return(0,y.jsx)("p",{className:"description",children:k()(p.Z.I18n.t("consentSubscribed"),/\[link](.*?)\[\/link]/,(e=>(0,y.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/357-why-express-consent-is-important",target:"_blank","data-beacon-article":"605ca22ac44f5d025f447f39",rel:"noopener noreferrer",children:e},"kb-link")))})}function _c(e){let{newSubscribersStatus:t,setNewSubscribersStatus:n}=e;const r=(0,j.useCallback)((e=>{n(e.target.value)}),[n]);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,y.jsx)("label",{htmlFor:"new_subscribers_status",children:p.Z.I18n.t("newSubscribersStatus")}),(0,y.jsx)(xc,{})]}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsxs)(de.Z,{id:"new_subscribers_status",placeholder:p.Z.I18n.t("select"),name:"new_subscribers_status",onChange:r,defaultValue:t,children:[(0,y.jsx)("option",{value:"subscribed",children:p.Z.I18n.t("subscribed")}),(0,y.jsx)("option",{value:"inactive",children:p.Z.I18n.t("inactive")}),(0,y.jsx)("option",{value:"unsubscribed",children:p.Z.I18n.t("unsubscribed")})]})})]})}function Zc(e){let{existingSubscribersStatus:t,setExistingSubscribersStatus:n}=e;const r=(0,j.useCallback)((e=>{n(e.target.value)}),[n]);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,y.jsx)("label",{htmlFor:"existing_subscribers_status",children:p.Z.I18n.t("existingSubscribersStatus")}),(0,y.jsx)(xc,{})]}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsxs)(de.Z,{id:"existing_subscribers_status",placeholder:p.Z.I18n.t("select"),name:"existing_subscribers_status",onChange:r,defaultValue:t,children:[(0,y.jsx)("option",{value:"dont_update",children:p.Z.I18n.t("dontUpdate")}),(0,y.jsx)("option",{value:"subscribed",children:p.Z.I18n.t("subscribed")}),(0,y.jsx)("option",{value:"inactive",children:p.Z.I18n.t("inactive")}),(0,y.jsx)("option",{value:"unsubscribed",children:p.Z.I18n.t("unsubscribed")})]})})]})}function jc(e){let{updateExistingSubscribers:t,setUpdateExistingSubscribers:n}=e;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet-settings-label",children:p.Z.I18n.t("updateExistingSubscribers")}),(0,y.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,y.jsx)(me.Z,{id:"update_existing_subscribers",name:"update_existing_subscribers",value:"1",checked:t,onCheck:()=>n(!0)}),(0,y.jsx)("label",{htmlFor:"update_existing_subscribers",children:p.Z.I18n.t("updateExistingSubscribersYes")}),(0,y.jsx)("span",{className:"mailpoet-gap"}),(0,y.jsx)(me.Z,{id:"dont_update_existing_subscribers",name:"update_existing_subscribers",value:"",checked:!t,onCheck:()=>n(!1)}),(0,y.jsx)("label",{htmlFor:"dont_update_existing_subscribers",children:p.Z.I18n.t("updateExistingSubscribersNo")})]})]})}jc.propTypes={setUpdateExistingSubscribers:g().func.isRequired,updateExistingSubscribers:g().bool.isRequired};var Ic=jc;function Sc(e){let{history:t,stepMethodSelectionData:n,subscribersLimitForValidation:r,setStepDataManipulationData:a}=e;const[s,i]=(0,j.useState)([]),[o,l]=(0,j.useState)(!0),[c,d]=(0,j.useState)("subscribed"),[m,h]=(0,j.useState)("dontUpdate");return(0,j.useEffect)((()=>{void 0===n&&t.replace("step_method_selection")}),[n,t]),void 0===n?null:(0,y.jsxs)("div",{"data-automation-id":"import_data_manipulation_step",children:[(0,y.jsx)(pc,{stepMethodSelectionData:n}),(0,y.jsx)(bc,{subscribersCount:n.subscribersCount,subscribers:n.subscribers,header:n.header}),(0,y.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,y.jsx)(wc,{setSelectedSegments:i}),(0,y.jsx)(_c,{newSubscribersStatus:c,setNewSubscribersStatus:d}),(0,y.jsx)(Zc,{existingSubscribersStatus:m,setExistingSubscribersStatus:h}),(0,y.jsx)(Ic,{setUpdateExistingSubscribers:l,updateExistingSubscribers:o}),(0,y.jsx)(Ul,{canGoNext:s.length>0,onPreviousAction:()=>t.push(function(e,t){return void 0===e||void 0===e.subscribersCount||e.subscribersCount<t?"step_method_selection":"step_input_validation"}(n,r)),onNextAction:()=>{((e,n,r,s,i,o)=>{const l={},c=new(u().AsyncQueue);let d=0;const m=Date.now()/1e3,h={created:0,updated:0,errors:[],segments:[]};p.Z.Modal.loading(!0);const f=(2e3,e.reduce(((e,t,n)=>(n%2e3==0&&e.push([]),e[e.length-1].push(t),e)),[]));I.ZP.each(u()("select.mailpoet_subscribers_column_data_match"),((e,t)=>{const n=u()(e).data("column-id");"ignore"!==n&&(l[n]={index:t})})),I.ZP.each(f,(()=>{c.add((e=>{e.pause(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processImport",data:JSON.stringify({columns:l,subscribers:f[d],timestamp:m,segments:n,newSubscribersStatus:r,existingSubscribersStatus:s,updateSubscribers:i})}).done((t=>{const n=t.data.added_to_segment_with_welcome_notification;h.created+=t.data.created,h.updated+=t.data.updated,h.segments=t.data.segments,h.added_to_segment_with_welcome_notification=n,e.run()})).fail((e=>{p.Z.Modal.loading(!1),e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),d+=1}))})),c.run(),c.onComplete((()=>{p.Z.Modal.loading(!1),h.errors.length>0&&!h.updated&&!h.created?p.Z.Notice.error(I.ZP.flatten(h.errors)):(h.segments=I.ZP.map(I.ZP.filter(h.segments,(e=>n.includes(e.id))),(e=>e.name)),a(h),t.push("step_results"))}))})(n.subscribers,s,c,m,o)},isLastStep:!0})]})]})}n(49868),Sc.propTypes={history:g().shape({push:g().func.isRequired,replace:g().func.isRequired}).isRequired,stepMethodSelectionData:g().shape({duplicate:g().arrayOf(g().string),header:g().arrayOf(g().string),invalid:g().arrayOf(g().string),role:g().arrayOf(g().string),subscribersCount:g().number,subscribers:g().arrayOf(g().arrayOf(g().oneOfType([g().string,g().number])))}),subscribersLimitForValidation:g().number.isRequired,setStepDataManipulationData:g().func.isRequired},Sc.defaultProps={stepMethodSelectionData:void 0};var Cc=(0,c.withRouter)(Sc);function Tc(e){let{subscribersCount:t,segments:n,initialMessage:r}=e;if(t){let e=k()(r,"%1$s",(()=>(0,y.jsx)("strong",{children:t.toLocaleString()},"%1$s")));return e=k()(e,"%2$s",(()=>`"${n.join('", "')}"`)),(0,y.jsx)("p",{children:e})}return null}function kc(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?null:(0,y.jsx)("p",{children:p.Z.I18n.t("importNoAction")})}function Nc(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("p",{children:(0,y.jsx)("b",{children:p.Z.I18n.t("congratulationResult")})}),(0,y.jsx)("p",{children:k()(p.Z.I18n.t("suppressionListReminder"),/\[link](.*?)\[\/link]/,(e=>(0,y.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/359-how-to-import-a-suppression-list","data-beacon-article":"6064973ce0324b5fdfd0650c",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}):null}function Dc(e){let{addedToSegmentWithWelcomeNotification:t}=e;return t?(0,y.jsx)("p",{children:p.Z.I18n.t("importNoWelcomeEmail")}):null}function Ec(e){let{errors:t,createdSubscribers:n,updatedSubscribers:r,segments:a,addedToSegmentWithWelcomeNotification:s,history:i}=e;return(0,j.useEffect)((()=>{void 0===a&&0===t.length&&void 0===n&&void 0===r&&i.replace("step_method_selection")}),[a,n,t.length,i,r]),t.length&&p.Z.Notice.error(I.ZP.flatten(t)),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"updated",children:[(0,y.jsx)(Tc,{subscribersCount:n,segments:a,initialMessage:p.Z.I18n.t("subscribersCreated")}),(0,y.jsx)(Tc,{subscribersCount:r,segments:a,initialMessage:p.Z.I18n.t("subscribersUpdated")}),(0,y.jsx)(kc,{createdSubscribers:n,updatedSubscribers:r}),(0,y.jsx)(Dc,{addedToSegmentWithWelcomeNotification:s})]}),(0,y.jsx)(Nc,{createdSubscribers:n,updatedSubscribers:r}),(0,y.jsx)("div",{className:"mailpoet-settings-grid",children:(0,y.jsxs)("div",{className:"mailpoet-settings-save",children:[(0,y.jsx)(v.Z,{variant:"secondary",type:"button",onClick:()=>i.push("step_method_selection"),children:p.Z.I18n.t("importAgain")}),(0,y.jsx)(v.Z,{type:"button",onClick:()=>{window.location.href="admin.php?page=mailpoet-subscribers"},children:p.Z.I18n.t("viewSubscribers")})]})})]})}Tc.propTypes={segments:g().arrayOf(g().string.isRequired),subscribersCount:g().number,initialMessage:g().string},Tc.defaultProps={segments:[],subscribersCount:0,initialMessage:""},kc.propTypes={createdSubscribers:g().number,updatedSubscribers:g().number},kc.defaultProps={createdSubscribers:0,updatedSubscribers:0},Nc.propTypes={createdSubscribers:g().number,updatedSubscribers:g().number},Nc.defaultProps={createdSubscribers:0,updatedSubscribers:0},Dc.propTypes={addedToSegmentWithWelcomeNotification:g().bool},Dc.defaultProps={addedToSegmentWithWelcomeNotification:!1},Ec.propTypes={history:g().shape({push:g().func.isRequired,replace:g().func.isRequired}).isRequired,errors:g().arrayOf(g().string.isRequired),segments:g().arrayOf(g().string.isRequired),createdSubscribers:g().number,updatedSubscribers:g().number,addedToSegmentWithWelcomeNotification:g().bool},Ec.defaultProps={errors:[],segments:void 0,createdSubscribers:void 0,updatedSubscribers:void 0,addedToSegmentWithWelcomeNotification:void 0};var Oc=(0,c.withRouter)(Ec);function Rc(e){let{history:t}=e;return(0,y.jsx)(nc,{onProceed:()=>t.push("step_method_selection")})}const Ac=document.getElementById("import_container");function Pc(){const[e,t]=(0,j.useState)(void 0),[n,r]=(0,j.useState)({}),a=(0,Fe.S)(window);return(0,y.jsx)(Fe.k.Provider,{value:a,children:(0,y.jsxs)(l.UT,{children:[(0,y.jsx)(Ge.Z,{}),(0,y.jsx)(Ll,{children:(0,y.jsxs)(c.Switch,{children:[(0,y.jsx)(c.Route,{path:"/step_clean_list",render:e=>(0,y.jsx)(Rc,{...e})}),(0,y.jsx)(c.Route,{path:"/step_method_selection",render:e=>(0,y.jsx)(tc,{...e,setStepMethodSelectionData:t,subscribersLimitForValidation:100})}),(0,y.jsx)(c.Route,{path:"/step_input_validation",render:t=>(0,y.jsx)(cc,{...t,stepMethodSelectionData:e})}),(0,y.jsx)(c.Route,{path:"/step_data_manipulation",render:t=>(0,y.jsx)(Cc,{...t,stepMethodSelectionData:e,subscribersLimitForValidation:100,setStepDataManipulationData:r})}),(0,y.jsx)(c.Route,{path:"/step_results",render:e=>(0,y.jsx)(Oc,{...e,errors:n.errors,createdSubscribers:n.created,updatedSubscribers:n.updated,segments:n.segments,addedToSegmentWithWelcomeNotification:n.added_to_segment_with_welcome_notification})}),(0,y.jsx)(c.Route,{path:"*",render:()=>(0,y.jsx)(c.Redirect,{to:"/step_clean_list"})})]})})]})})}Ac&&o().render((0,y.jsx)(Pc,{}),Ac);var Mc=n(19675),Lc=n.n(Mc),Fc=n(56692);function qc(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("welcomeWizardLetsStartTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("p",{children:p.Z.I18n.t("welcomeWizardSenderText")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("form",{id:"mailpoet_sender_form",onSubmit:t=>{t.preventDefault(),u()("#mailpoet_sender_form").parsley().validate()&&e.submit_sender()},children:[(0,y.jsxs)(_t.r.TwoColumns,{children:[(0,y.jsxs)("label",{htmlFor:"senderName",children:[(0,y.jsx)("span",{className:"mailpoet-wizard-label",children:p.Z.I18n.t("senderName")}),(0,y.jsx)(ae.Z,{isFullWidth:!0,name:"senderName",type:"text",placeholder:"John Doe",value:e.sender?e.sender.name:"","data-parsley-required":!0,onChange:t=>e.update_sender({name:t.target.value})})]}),(0,y.jsxs)("label",{htmlFor:"senderAddress",children:[(0,y.jsx)("span",{className:"mailpoet-wizard-label",children:p.Z.I18n.t("senderAddress")}),(0,y.jsx)(ae.Z,{isFullWidth:!0,name:"senderAddress",type:"text",placeholder:"john@doe.com",value:e.sender?e.sender.address:"","data-parsley-required":!0,"data-parsley-type":"email",onChange:t=>e.update_sender({address:t.target.value})})]})]}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)(v.Z,{isFullWidth:!0,type:"submit",withSpinner:e.loading,children:p.Z.I18n.t("continue")}),(0,y.jsx)(v.Z,{href:"#finish",isDisabled:e.loading,isFullWidth:!0,onClick:e.finish,variant:"tertiary",children:p.Z.I18n.t("finishLater")})]})]})}u()(document).ready((()=>{let e;if(!u()("#mailpoet_subscribers_export").length)return;if(!window.exportData.segments)return;const t=Lc().compile(u()("#mailpoet_subscribers_export_template").html());function n(t){const n="mailpoet-disabled";"on"===t?e.removeClass(n):e.addClass(n)}u()("#mailpoet-export").html(t(window.exportData));const r=u()("#export_lists"),a=u()("#export_columns");function s(e){let t=`<span class="mailpoet-form-select2-text"><span>${e.name}</span></span>`;return void 0!==e.count&&(t+=`<span class="mailpoet-form-select2-count">${e.count}</span>`),t}function i(e,t){e.data("select2")&&e.html("").select2("destroy"),e.select2({data:t,width:"20em",dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:s,templateSelection:s}).on("select2:selecting",(t=>{const n=t.params.args.data.id,r=["select","deselect"];let a;I.ZP.contains(r,n)&&(t.preventDefault(),"deselect"===n?u()(t.target).val("").trigger("change"):(a=[],I.ZP.each(e.find("option"),(e=>{const t=e.value;I.ZP.contains(r,t)||a.push(t)})),u()(t.target).val(a).trigger("change")),u()(t.target).select2("close"))})).on("change",(()=>{window.exportData.segments&&r.select2("data").length&&a.select2("data").length||!window.exportData.segments&&a.select2("data").length?n("on"):n("off")}))}e=u()("#mailpoet-export-button"),window.segments.forEach((e=>{r.append(u()("<option></option>").attr("value",e.id).text(e.name))})),window.subscriberFieldsSelect2.forEach((e=>{e.text=e.name,e.children.forEach((e=>{e.name=(0,Fc.r)(e.name),e.text=(0,Fc.r)(e.name)}))})),i(r,window.segments),i(a,window.subscriberFieldsSelect2),a.val(["email","first_name","last_name","list_status","global_status","subscribed_ip","created_at","confirmed_at","confirmed_ip"]).trigger("change"),e.on("click",(e=>{if(u()(e.target).hasClass("mailpoet-disabled"))return;p.Z.Modal.loading(!0);const t=u()(':radio[name="option_format"]:checked').val();p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"ImportExport",action:"processExport",data:JSON.stringify({export_format_option:t,segments:!!window.exportData.segments&&r.val(),subscriber_fields:a.val()})}).always((()=>{p.Z.Modal.loading(!1)})).done((e=>{const n=p.Z.I18n.t("exportMessage").replace("%1$s",`<strong>${parseInt(e.data.totalExported,10).toLocaleString()}</strong>`).replace("[link]",`<a href="${e.data.exportFileURL}" target="_blank" >`).replace("[/link]","</a>");u()("#export_result_notice").html(`<p>${n}</p>`).show(),window.location.href=e.data.exportFileURL,p.Z.trackEvent("Subscribers export completed",{"Total exported":e.data.totalExported,"File Format":t})})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}))})),qc.propTypes={finish:g().func.isRequired,loading:g().bool.isRequired,update_sender:g().func.isRequired,submit_sender:g().func.isRequired,sender:g().shape({name:g().string,address:g().string})},qc.defaultProps={sender:null};var $c=qc;function Uc(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("welcomeWizardLetsStartTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("p",{children:p.Z.I18n.t("welcomeWizardSenderMigratedUserText")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)(v.Z,{isFullWidth:!0,onClick:e.next,type:"button",children:p.Z.I18n.t("continue")})]})}Uc.propTypes={next:g().func.isRequired};var Vc=Uc;function Wc(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("welcomeWizardEmailCourseTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("p",{children:p.Z.I18n.t("welcomeWizardEmailCourseText")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("iframe",{id:"mailpoet_form_iframe",width:"100%",scrolling:"no",frameBorder:"0",title:"Apply to course",src:"https://www.mailpoet.com?mailpoet_form_iframe=13",className:"mailpoet-wizard-course-iframe",marginWidth:"0",marginHeight:"0"}),(0,y.jsx)(v.Z,{isFullWidth:!0,onClick:e.next,type:"button",children:p.Z.I18n.t("continue")})]})}Wc.propTypes={next:g().func.isRequired};var Yc=Wc,Bc=(0,y.jsx)("svg",{width:"13",height:"11",viewBox:"0 0 13 11",children:(0,y.jsx)("path",{fill:"currentColor",d:"M9.967.638c.483-.698 1.405-.846 2.06-.33.654.515.793 1.499.31 2.197l-5.44 7.857c-.55.794-1.64.857-2.267.132l-3.4-3.928c-.552-.638-.515-1.632.083-2.22.598-.59 1.53-.55 2.082.088l2.19 2.532L9.968.638z"})}),Hc=(0,y.jsx)("svg",{width:"17",height:"16",viewBox:"0 0 17 16",children:(0,y.jsx)("path",{fill:"currentColor",d:"M12.407 3.31c.576.576.576 1.509 0 2.084L9.914 7.888l2.411 2.412c.586.585.586 1.535 0 2.121-.585.586-1.535.586-2.12 0l-2.413-2.412L5.3 12.503c-.576.575-1.509.575-2.084 0-.575-.575-.575-1.508 0-2.083l2.493-2.495-2.41-2.41c-.587-.587-.587-1.536 0-2.122.585-.586 1.535-.586 2.12 0L7.83 5.804l2.494-2.493c.575-.576 1.508-.576 2.083 0z"})}),zc=function(e){let{onCheck:t,showError:n,checked:r,automationId:a,...s}=e;return(0,y.jsxs)("div",{className:h()({"mailpoet-form-yesno":!0,"mailpoet-form-yesno-error":n,"mailpoet-disabled":s.disabled}),"data-automation-id":a,children:[(0,y.jsxs)("label",{children:[(0,y.jsx)("input",{type:"radio",checked:!0===r,onChange:()=>t(!0),...s}),(0,y.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-yes",children:Bc})]}),(0,y.jsxs)("label",{children:[(0,y.jsx)("input",{type:"radio",checked:!1===r,onChange:()=>t(!1),...s}),(0,y.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-no",children:Hc})]})]})};function Kc(e){let{loading:t,submitForm:n}=e;const[r,a]=(0,j.useState)({tracking:void 0,libs3rdParty:void 0});return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("welcomeWizardUsageTrackingStepTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("p",{children:p.Z.I18n.t("welcomeWizardTrackingText")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)(je.Z,{level:5,children:p.Z.I18n.t("welcomeWizardUsageTrackingStepSubTitle")}),(0,y.jsx)(_t.r.TwoColumnsList,{children:(0,y.jsxs)(Jn,{children:[(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardTrackingList1")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardTrackingList2")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardTrackingList3")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardTrackingList4")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardTrackingList5")})]})}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("form",{onSubmit:function(e){return e.preventDefault(),n(r.tracking,r.libs3rdParty),!1},children:[(0,y.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,y.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,y.jsx)(zc,{onCheck:e=>{const t={tracking:e,libs3rdParty:r.libs3rdParty};e&&(t.libs3rdParty=e),a(t)},checked:r.tracking,name:"mailpoet_tracking"})}),(0,y.jsxs)("div",{children:[(0,y.jsxs)("p",{children:[p.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabel")," ",(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/130-sharing-your-data-with-us","data-beacon-article":"57ce0aaac6979108399a0454",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("welcomeWizardTrackingLink")})]}),(0,y.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,y.jsx)("span",{children:p.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNoteNote")}),p.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNote")]})]})]}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,y.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,y.jsx)(zc,{onCheck:e=>{const t={libs3rdParty:e,tracking:r.tracking};e||(t.tracking=e),a(t)},checked:r.libs3rdParty,name:"mailpoet_libs_3rdParty"})}),(0,y.jsxs)("div",{children:[(0,y.jsxs)("p",{children:[p.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabel")," ",(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/338-what-3rd-party-libraries-we-use","data-beacon-article":"5f7c7dd94cedfd0017dcece8",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLink")})]}),(0,y.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,y.jsx)("span",{children:p.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNoteNote")}),p.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNote")]})]})]}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)(v.Z,{isFullWidth:!0,type:"submit",withSpinner:t,disabled:t,children:p.Z.I18n.t("continue")})]})]})}Kc.propTypes={loading:g().bool.isRequired,submitForm:g().func.isRequired};var Gc=Kc,Qc=function(e){let{children:t}=e;return(0,y.jsx)("div",{className:"mailpoet-steps-content",children:t})};function Xc(e){const[t,n]=(0,j.useState)(null),[r,a]=(0,j.useState)(null),[s,i]=(0,j.useState)(!1),o=e.isWizardStep?p.Z.I18n.t("wooCommerceSetupFinishButtonTextWizard"):p.Z.I18n.t("wooCommerceSetupFinishButtonTextStandalone");let l;return"subscribed"===r&&(l=!0),"unsubscribed"===r&&(l=!1),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("wooCommerceSetupTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("p",{children:p.Z.I18n.t("wooCommerceSetupInfo")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("form",{onSubmit:n=>(n.preventDefault(),i(!0),null===r||null===t||e.submitForm(r,"true"===t),!1),children:[(0,y.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,y.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,y.jsx)(zc,{showError:s&&null===r,checked:l,onCheck:e=>a(e?"subscribed":"unsubscribed"),name:"mailpoet_woocommerce_import_type",automationId:"woocommerce_import_type"})}),(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{children:k()(p.Z.I18n.t("wooCommerceSetupImportInfo"),/\[link\](.*?)\[\/link\]/,(e=>(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/284-import-old-customers-to-the-woocommerce-customers-list","data-beacon-article":"5d722c7104286364bc8ecf19",rel:"noopener noreferrer",target:"_blank",children:e},e)))}),(0,y.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,y.jsx)("span",{children:"GDPR"}),p.Z.I18n.t("wooCommerceSetupImportGDPRInfo")]})]})]}),(0,y.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,y.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,y.jsx)(zc,{showError:s&&null===t,checked:t,onCheck:e=>n(e),name:"mailpoet_woocommerce_tracking",automationId:"woocommerce_tracking"})}),(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{children:k()(p.Z.I18n.t("wooCommerceSetupTrackingInfo"),/\[link\](.*?)\[\/link\]/,(e=>(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/280-woocommerce-cookie-tracking","data-beacon-article":"5d5fa44c2c7d3a7a4d778906",rel:"noopener noreferrer",target:"_blank",children:e},e)))}),(0,y.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,y.jsx)("span",{children:"GDPR"}),p.Z.I18n.t("wooCommerceSetupTrackingGDPRInfo")]})]})]}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)(v.Z,{isFullWidth:!0,type:"submit",withSpinner:e.loading,disabled:e.loading,automationId:"submit_woocommerce_setup",children:o})]})]})}Xc.propTypes={submitForm:g().func.isRequired,loading:g().bool.isRequired,isWizardStep:g().bool},Xc.defaultProps={isWizardStep:!1};var Jc=Xc;function ed(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet-wizard-logo",children:(0,y.jsx)("img",{src:window.mailpoet_logo_url,width:"160",height:"50",alt:"MailPoet logo"})}),(0,y.jsx)(Xn,{illustrationUrl:e.illustrationUrl,children:e.children})]})}ed.propTypes={illustrationUrl:g().string.isRequired,children:g().oneOfType([g().arrayOf(g().node),g().node]).isRequired};var td=ed;function nd(e){let{isWizardStep:t=!1}=e;const[n,r]=(0,j.useState)(!1),a=e=>{r(!1),p.Z.Notice.showApiErrorNotice(e,{scroll:!0})},s=()=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"setupWooCommerceInitialImport"}).fail(a),i=()=>{window.location=window.finish_wizard_url},o=(0,y.jsx)(td,{illustrationUrl:window.wizard_woocommerce_illustration_url,children:(0,y.jsx)(Jc,{loading:n,submitForm:(e,t)=>{r(!0);const n="basic"===p.Z.settings.tracking.level?"basic":"partial";var o;(o={woocommerce_import_screen_displayed:1,"mailpoet_subscribe_old_woocommerce_customers.enabled":"subscribed"===e?1:0,"tracking.level":t?"full":n,"woocommerce.accept_cookie_revenue_tracking.set":1},p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:o}).fail(a)).then(s).then(i)},isWizardStep:t})});return t?o:(0,y.jsx)(Qc,{children:o})}nd.propTypes={isWizardStep:g().bool},nd.defaultProps={isWizardStep:!1};var rd=nd,ad=e=>{let{name:t,address:n}=e;const r=n.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(r)>-1?(e=>{let{name:t,address:n}=e;const r=`wordpress@${window.location.hostname.replace("www.","")}`;return{sender:{name:t,address:r},reply_to:{name:t,address:n},"signup_confirmation.from.address":r,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":n,"signup_confirmation.reply_to.name":t}})({name:t,address:n}):(e=>{let{name:t,address:n}=e;return{sender:{name:t,address:n},reply_to:{name:t,address:n},"signup_confirmation.from.address":n,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":n,"signup_confirmation.reply_to.name":t}})({name:t,address:n})};const sd=()=>{let e=3;return window.has_mss_key_specified||(e+=1),window.is_woocommerce_active&&(e+=1),e},id=(e,t,n)=>{n<sd()?e.push(`/steps/${n+1}`):t()};var od=n(60054);function ld(e){const t=sd(),n=parseInt(e.match.params.step,10),[r,a]=(0,j.useState)(!1),[s,i]=(0,j.useState)(window.sender_data);function o(){a(!0),window.location=window.finish_wizard_url}(0,j.useEffect)((()=>{(n>t||n<1)&&e.history.push("/steps/1")}),[n,t,e.history]);const l=(0,I.r$)(id,e.history,o);function c(e){return a(!0),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:e}).then((()=>a(!1))).fail((e=>{a(!1),e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}const d=(0,j.useCallback)(((e,t)=>{a(!0),c({analytics:{enabled:e?"1":""},"3rd_party_libs":{enabled:t?"1":""}}).then((()=>l(n)))}),[l,n]),u=(0,j.useCallback)((e=>{i({...s,...e})}),[s]),m=(0,j.useCallback)((()=>{c(ad(s)).then((()=>l(n)))}),[l,s,n]),h=(0,j.useCallback)((e=>{e.preventDefault(),a(!0),c(ad({address:window.admin_email,name:""})).then((()=>{window.is_woocommerce_active?l(t-1):o()}))}),[l,t]),f=(e=>{const t=!window.is_mp2_migration_complete;return 1===e&&t?"WelcomeWizardSenderStep":1!==e||t?2===e?"WelcomeWizardEmailCourseStep":3===e?"WelcomeWizardUsageTrackingStep":window.is_woocommerce_active&&e===sd()?"WizardWooCommerceStep":"WelcomeWizardPitchMSSStep":"WelcomeWizardMigratedUserStep"})(n);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(od.Z,{count:t,current:n}),(0,y.jsxs)(Qc,{children:["WelcomeWizardSenderStep"===f?(0,y.jsx)(td,{illustrationUrl:window.wizard_sender_illustration_url,children:(0,y.jsx)($c,{update_sender:u,submit_sender:m,finish:h,loading:r,sender:s})}):null,"WelcomeWizardMigratedUserStep"===f?(0,y.jsx)(td,{illustrationUrl:window.wizard_sender_illustration_url,children:(0,y.jsx)(Vc,{next:()=>l(n)})}):null,"WelcomeWizardEmailCourseStep"===f?(0,y.jsx)(td,{illustrationUrl:window.wizard_email_course_illustration_url,children:(0,y.jsx)(Yc,{next:()=>l(n)})}):null,"WelcomeWizardUsageTrackingStep"===f?(0,y.jsx)(td,{illustrationUrl:window.wizard_tracking_illustration_url,children:(0,y.jsx)(Gc,{loading:r,submitForm:d})}):null,"WelcomeWizardPitchMSSStep"===f?(0,y.jsx)(td,{illustrationUrl:window.wizard_MSS_pitch_illustration_url,children:(0,y.jsx)(ir,{next:()=>l(n),subscribersCount:window.subscribers_count,mailpoetAccountUrl:window.mailpoet_account_url,purchaseUrl:p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount,p.Z.currentWpUserEmail,"business",{utm_medium:"onboarding",utm_campaign:"purchase"})})}):null,"WizardWooCommerceStep"===f?(0,y.jsx)(rd,{isWizardStep:!0}):null]})]})}ld.propTypes={match:g().shape({params:g().shape({step:g().string}).isRequired}).isRequired,history:g().shape({push:g().func.isRequired}).isRequired};var cd=ld;function dd(){let e="/steps/1";window.location.search.includes("woocommerce-setup")&&(e="/woocommerce");const t=(0,Fe.S)(window);return(0,y.jsx)(Fe.k.Provider,{value:t,children:(0,y.jsxs)(l.UT,{children:[(0,y.jsx)(Ge.Z,{}),(0,y.jsxs)(c.Switch,{children:[(0,y.jsx)(c.Route,{path:"/steps/:step",component:cd}),(0,y.jsx)(c.Route,{path:"/woocommerce",component:rd}),(0,y.jsx)(c.Route,{render:()=>(0,y.jsx)(c.Redirect,{to:e})})]})]})})}const ud=document.getElementById("mailpoet-wizard-container");function pd(){const[e,t]=(0,j.useState)(null),n=(0,Fe.S)(window),r=n.notices.error;function a(a){const s=a.target.name,i=a.target.checked;p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"set",data:{[s]:i?1:0}}).done((()=>{const r=e[s];r.value=i,t({...e,[s]:r});const a=`Feature '${s}' was ${i?"enabled":"disabled"}.`;n.notices.success((0,y.jsx)("p",{children:a}))})).fail((e=>{e.errors.length>0&&r(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}return(0,j.useEffect)((()=>{p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"getAll"}).done((e=>{const n=e.data.reduce(((e,t)=>({...e,[t.name]:t})),{});t(n)})).fail((e=>{e.errors.length>0&&r((0,y.jsx)(y.Fragment,{children:e.errors.map((e=>(0,y.jsx)("p",{children:e.message})))}),{scroll:!0})}))}),[r]),null===e?(0,y.jsx)("p",{children:"Loading experimental features..."}):0===Object.values(e).length?(0,y.jsx)("p",{children:"There are no experimental features at the moment."}):(0,y.jsx)(Fe.k.Provider,{value:n,children:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Ge.Z,{}),Object.values(e).map((e=>{const t=`experimental-feature-${e.name}`;return(0,y.jsx)("div",{children:(0,y.jsxs)("label",{htmlFor:t,children:[(0,y.jsx)("input",{id:t,type:"checkbox",name:e.name,defaultChecked:e.value,onChange:a})," ",e.name]})},e.name)}))]})})}ud&&o().render((0,y.jsx)(dd,{}),ud);const md=document.getElementById("experimental_features_container");md&&o().render((0,y.jsx)(pd,{}),md);var hd=n(23520);function fd(e){let{message:t,editing:n}=e;return n?(0,y.jsx)("textarea",{value:t,className:"mailpoet-logs-full-message",readOnly:!0}):(0,y.jsx)(y.Fragment,{children:`${t.substr(0,150)}…`})}function gd(e){let{log:t}=e;const[n,r]=(0,j.useState)(!1);return(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{role:"gridcell",children:t.name}),(0,y.jsx)("td",{onClick:function(e){(function(e){return(e.ctrlKey||e.metaKey)&&!e.altKey})(e)&&(n||r(!0))},role:"gridcell",children:(0,y.jsx)(fd,{message:t.message,editing:n})}),(0,y.jsx)("td",{role:"gridcell",children:p.Z.Date.full(t.created_at)})]},`log-row-${t.id}`)}function vd(e){let{logs:t,onFilter:n,originalFrom:r,originalTo:a,originalSearch:s,originalOffset:i,originalLimit:o}=e;const[l,c]=(0,j.useState)(null!=r?r:void 0),[d,u]=(0,j.useState)(null!=a?a:void 0),[m,h]=(0,j.useState)(null!=i?i:""),[f,g]=(0,j.useState)(null!=o?o:""),[v,b]=(0,j.useState)(s||""),w=(0,Ks.curry)(((e,t)=>{e(null!==t?p.Z.Date.format(t,{format:"Y-m-d"}):void 0)})),x=(0,j.useCallback)((()=>{const e={};l&&(e.from=l),d&&(e.to=d),m&&""!==m.trim()&&(e.offset=m),f&&""!==f.trim()&&(e.limit=f),v&&""!==v.trim()&&(e.search=v.trim()),n(e)}),[l,f,m,v,d,n]);return(0,y.jsxs)("div",{className:"mailpoet-listing mailpoet-logs",children:[(0,y.jsxs)("div",{className:"mailpoet-listing-header",children:[(0,y.jsxs)("div",{className:"mailpoet-listing-search",children:[(0,y.jsx)("label",{htmlFor:"search_input",className:"screen-reader-text",children:p.Z.I18n.t("searchLabel")}),(0,y.jsx)(ae.Z,{dimension:"small",iconStart:hd.Z,type:"search",id:"search_input",name:"s",onChange:e=>b(e.target.value),value:v,placeholder:p.Z.I18n.t("searchLabel")})]}),(0,y.jsxs)("div",{className:"mailpoet-listing-filters",children:[`${p.Z.I18n.t("from")}:`,(0,y.jsx)(It,{dateFormat:"MMMM d, yyyy",onChange:w(c),maxDate:new Date,selected:l?(0,di.default)(l):void 0,dimension:"small"}),`${p.Z.I18n.t("to")}:`,(0,y.jsx)(It,{dateFormat:"MMMM d, yyyy",onChange:w(u),maxDate:new Date,selected:d?(0,di.default)(d):void 0,dimension:"small"})]}),(0,y.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,y.jsx)("label",{htmlFor:"offset_input",className:"screen-reader-text",children:p.Z.I18n.t("offsetLabel")}),(0,y.jsx)(ae.Z,{dimension:"small",id:"offset_input",name:"o",type:"number",onChange:e=>h(e.target.value),value:m,placeholder:p.Z.I18n.t("offsetLabel")})]}),(0,y.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,y.jsx)("label",{htmlFor:"limit_input",className:"screen-reader-text",children:p.Z.I18n.t("limitLabel")}),(0,y.jsx)(ae.Z,{dimension:"small",id:"limit_input",name:"l",type:"number",onChange:e=>g(e.target.value),value:f,placeholder:p.Z.I18n.t("limitLabel")})]}),(0,y.jsx)(Ce.Button,{dimension:"small",onClick:x,children:p.Z.I18n.t("filter")})]}),(0,y.jsxs)("table",{className:"mailpoet-listing-table widefat striped",role:"grid",children:[(0,y.jsx)("thead",{children:(0,y.jsxs)("tr",{children:[(0,y.jsx)("th",{children:p.Z.I18n.t("tableHeaderName")}),(0,y.jsx)("th",{children:p.Z.I18n.t("tableHeaderMessage")}),(0,y.jsx)("th",{children:p.Z.I18n.t("tableHeaderCreatedOn")})]})}),(0,y.jsx)("tbody",{children:t.map((e=>(0,y.jsx)(gd,{log:e},`log-${e.id}`)))})]})]})}const bd=document.getElementById("mailpoet_logs_container");if(bd){const e=new URL(window.location.href);o().render((0,y.jsx)(vd,{logs:window.mailpoet_logs,originalFrom:e.searchParams.get("from"),originalTo:e.searchParams.get("to"),originalSearch:e.searchParams.get("search"),originalOffset:e.searchParams.get("offset"),originalLimit:e.searchParams.get("limit"),onFilter:t=>{e.searchParams.delete("from"),e.searchParams.delete("to"),e.searchParams.delete("search"),e.searchParams.delete("offset"),e.searchParams.delete("limit"),Object.entries(t).forEach((t=>{let[n,r]=t;e.searchParams.append(n,r)})),window.location.href=e.href}}),bd)}var yd=n(13651);function wd(e){let{onRequestClose:t}=e;const[n,r]=(0,j.useState)(!1);return u()((e=>{e(document).on("click",".notice .mailpoet-js-button-fix-this",(()=>{r(!0)}))})),(0,y.jsxs)(Fe.k.Provider,{value:(0,Fe.S)(window),children:[(0,y.jsx)(Ge.Z,{}),n&&(0,y.jsx)(yd.Z,{onRequestClose:()=>{r(!1),t()}})]})}wd.defaultProps={onRequestClose:Ks.noop};const xd=document.getElementById("mailpoet_set_from_address_modal");xd&&o().render((0,y.jsx)(wd,{onRequestClose:()=>{window.location.href.includes("?page=mailpoet-settings")&&window.location.reload()}}),xd);const _d=e=>(async e=>"MailPoet"!==p.Z.mtaMethod||-1!==(await(async()=>"MailPoet"!==p.Z.mtaMethod?[]:(await p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])()).indexOf(e))(e).then((e=>{if(!e)return p.Z.Notice.error(p.Z.I18n.t("mailerSendingNotResumedUnauthorized"),{scroll:!0}),p.Z.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"}),!1;p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"mailer",action:"resumeSending"}).done((()=>{p.Z.Notice.success(p.Z.I18n.t("mailerSendingResumedNotice"))})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}));u()((e=>{e(document).on("click",".notice .mailpoet-js-button-resume-sending",(e=>{_d(e.target.value)}))}))},97621:function(e,t){"use strict";function n(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function r(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}}var a={p:r,P:function(e,t){var a,s=e.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return n(e,t);switch(i){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"})}return a.replace("{{date}}",n(i,t)).replace("{{time}}",r(o,t))}};t.Z=a},24262:function(e,t,n){"use strict";function r(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}n.d(t,{Z:function(){return r}})},49702:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(19013),a=n(66979),s=n(7032),i=n(13882);function o(e){(0,i.Z)(1,arguments);var t=(0,s.Z)(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=(0,a.Z)(n);return r}var l=6048e5;function c(e){(0,i.Z)(1,arguments);var t=(0,r.default)(e),n=(0,a.Z)(t).getTime()-o(t).getTime();return Math.round(n/l)+1}},7032:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(19013),a=n(13882),s=n(66979);function i(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getUTCFullYear(),i=new Date(0);i.setUTCFullYear(n+1,0,4),i.setUTCHours(0,0,0,0);var o=(0,s.Z)(i),l=new Date(0);l.setUTCFullYear(n,0,4),l.setUTCHours(0,0,0,0);var c=(0,s.Z)(l);return t.getTime()>=o.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}},23324:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(19013),a=n(59025),s=n(7651),i=n(13882),o=n(83946);function l(e,t){(0,i.Z)(1,arguments);var n=t||{},r=n.locale,l=r&&r.options&&r.options.firstWeekContainsDate,c=null==l?1:(0,o.Z)(l),d=null==n.firstWeekContainsDate?c:(0,o.Z)(n.firstWeekContainsDate),u=(0,s.Z)(e,t),p=new Date(0);p.setUTCFullYear(u,0,d),p.setUTCHours(0,0,0,0);var m=(0,a.Z)(p,t);return m}var c=6048e5;function d(e,t){(0,i.Z)(1,arguments);var n=(0,r.default)(e),s=(0,a.Z)(n,t).getTime()-l(n,t).getTime();return Math.round(s/c)+1}},7651:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(19013),a=n(13882),s=n(59025),i=n(83946);function o(e,t){(0,a.Z)(1,arguments);var n=(0,r.default)(e),o=n.getUTCFullYear(),l=t||{},c=l.locale,d=c&&c.options&&c.options.firstWeekContainsDate,u=null==d?1:(0,i.Z)(d),p=null==l.firstWeekContainsDate?u:(0,i.Z)(l.firstWeekContainsDate);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(o+1,0,p),m.setUTCHours(0,0,0,0);var h=(0,s.Z)(m,t),f=new Date(0);f.setUTCFullYear(o,0,p),f.setUTCHours(0,0,0,0);var g=(0,s.Z)(f,t);return n.getTime()>=h.getTime()?o+1:n.getTime()>=g.getTime()?o:o-1}},5267:function(e,t,n){"use strict";n.d(t,{Iu:function(){return s},Do:function(){return i},qp:function(){return o}});var r=["D","DD"],a=["YY","YYYY"];function s(e){return-1!==r.indexOf(e)}function i(e){return-1!==a.indexOf(e)}function o(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"))}},13882:function(e,t,n){"use strict";function r(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}n.d(t,{Z:function(){return r}})},66979:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=1,n=(0,r.default)(e),s=n.getUTCDay(),i=(s<t?7:0)+s-t;return n.setUTCDate(n.getUTCDate()-i),n.setUTCHours(0,0,0,0),n}},59025:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(19013),a=n(13882),s=n(83946);function i(e,t){(0,a.Z)(1,arguments);var n=t||{},i=n.locale,o=i&&i.options&&i.options.weekStartsOn,l=null==o?0:(0,s.Z)(o),c=null==n.weekStartsOn?l:(0,s.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=(0,r.default)(e),u=d.getUTCDay(),p=(u<c?7:0)+u-c;return d.setUTCDate(d.getUTCDate()-p),d.setUTCHours(0,0,0,0),d}},83946:function(e,t,n){"use strict";function r(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}n.d(t,{Z:function(){return r}})},77349:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}},78343:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(83946),a=n(51820),s=n(13882),i=36e5;function o(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.Z)(e,n*i)}},51820:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e).getTime(),i=(0,r.Z)(t);return new Date(n+i)}},58545:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(51820),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.Z)(e,6e4*n)}},11640:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);if(isNaN(i))return new Date(NaN);if(!i)return n;var o=n.getDate(),l=new Date(n.getTime());l.setMonth(n.getMonth()+i+1,0);var c=l.getDate();return o>=c?l:(n.setFullYear(l.getFullYear(),l.getMonth(),o),n)}},63500:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(77349),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t),i=7*n;return(0,a.default)(e,i)}},21593:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(11640),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,12*n)}},36948:function(e,t,n){"use strict";n.d(t,{yJ:function(){return r},vh:function(){return a}}),Math.pow(10,8);var r=6e4,a=36e5},92300:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(24262),a=n(69119),s=n(13882),i=864e5;function o(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),o=(0,a.default)(t),l=n.getTime()-(0,r.Z)(n),c=o.getTime()-(0,r.Z)(o);return Math.round((l-c)/i)}},84129:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t),i=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return 12*i+o}},52724:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(584),a=n(24262),s=n(13882),i=6048e5;function o(e,t,n){(0,s.Z)(2,arguments);var o=(0,r.default)(e,n),l=(0,r.default)(t,n),c=o.getTime()-(0,a.Z)(o),d=l.getTime()-(0,a.Z)(l);return Math.round((c-d)/i)}},91857:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getFullYear()-s.getFullYear()}},57870:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e);return t.setHours(23,59,59,999),t}},4135:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}},67090:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(19013),a=n(83946),s=n(13882);function i(e,t){(0,s.Z)(1,arguments);var n=t||{},i=n.locale,o=i&&i.options&&i.options.weekStartsOn,l=null==o?0:(0,a.Z)(o),c=null==n.weekStartsOn?l:(0,a.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=(0,r.default)(e),u=d.getDay(),p=6+(u<c?-7:0)-(u-c);return d.setDate(d.getDate()+p),d.setHours(23,59,59,999),d}},49546:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return A}});var r=n(12274),a=n(4958),s=n(91218),i=n(19013),o=n(13882),l=864e5,c=n(49702),d=n(7032),u=n(23324),p=n(7651);function m(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var h=function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return m("yy"===t?r%100:r,t.length)},f=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):m(n+1,2)},g=function(e,t){return m(e.getUTCDate(),t.length)},v=function(e,t){return m(e.getUTCHours()%12||12,t.length)},b=function(e,t){return m(e.getUTCHours(),t.length)},y=function(e,t){return m(e.getUTCMinutes(),t.length)},w=function(e,t){return m(e.getUTCSeconds(),t.length)},x=function(e,t){var n=t.length,r=e.getUTCMilliseconds();return m(Math.floor(r*Math.pow(10,n-3)),t.length)};function _(e,t){var n=e>0?"-":"+",r=Math.abs(e),a=Math.floor(r/60),s=r%60;if(0===s)return n+String(a);var i=t||"";return n+String(a)+i+m(s,2)}function Z(e,t){return e%60==0?(e>0?"-":"+")+m(Math.abs(e)/60,2):j(e,t)}function j(e,t){var n=t||"",r=e>0?"-":"+",a=Math.abs(e);return r+m(Math.floor(a/60),2)+n+m(a%60,2)}var I={G:function(e,t,n){var r=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var r=e.getUTCFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return h(e,t)},Y:function(e,t,n,r){var a=(0,p.Z)(e,r),s=a>0?a:1-a;return"YY"===t?m(s%100,2):"Yo"===t?n.ordinalNumber(s,{unit:"year"}):m(s,t.length)},R:function(e,t){return m((0,d.Z)(e),t.length)},u:function(e,t){return m(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return m(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return m(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){var r=e.getUTCMonth();switch(t){case"M":case"MM":return f(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){var r=e.getUTCMonth();switch(t){case"L":return String(r+1);case"LL":return m(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){var a=(0,u.Z)(e,r);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):m(a,t.length)},I:function(e,t,n){var r=(0,c.Z)(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):m(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):g(e,t)},D:function(e,t,n){var r=function(e){(0,o.Z)(1,arguments);var t=(0,i.default)(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),a=n-r;return Math.floor(a/l)+1}(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):m(r,t.length)},E:function(e,t,n){var r=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){var a=e.getUTCDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return m(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){var a=e.getUTCDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return m(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){var r=e.getUTCDay(),a=0===r?7:r;switch(t){case"i":return String(a);case"ii":return m(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){var r,a=e.getUTCHours();switch(r=12===a?"noon":0===a?"midnight":a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){var r,a=e.getUTCHours();switch(r=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var r=e.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return v(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):b(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):m(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):m(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):y(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):w(e,t)},S:function(e,t){return x(e,t)},X:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return Z(a);case"XXXX":case"XX":return j(a);case"XXXXX":case"XXX":default:return j(a,":")}},x:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return Z(a);case"xxxx":case"xx":return j(a);case"xxxxx":case"xxx":default:return j(a,":")}},O:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+_(a,":");case"OOOO":default:return"GMT"+j(a,":")}},z:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+_(a,":");case"zzzz":default:return"GMT"+j(a,":")}},t:function(e,t,n,r){var a=r._originalDate||e;return m(Math.floor(a.getTime()/1e3),t.length)},T:function(e,t,n,r){return m((r._originalDate||e).getTime(),t.length)}},S=n(97621),C=n(24262),T=n(5267),k=n(83946),N=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,D=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,E=/^'([^]*?)'?$/,O=/''/g,R=/[a-zA-Z]/;function A(e,t,n){(0,o.Z)(2,arguments);var l=String(t),c=n||{},d=c.locale||a.Z,u=d.options&&d.options.firstWeekContainsDate,p=null==u?1:(0,k.Z)(u),m=null==c.firstWeekContainsDate?p:(0,k.Z)(c.firstWeekContainsDate);if(!(m>=1&&m<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=d.options&&d.options.weekStartsOn,f=null==h?0:(0,k.Z)(h),g=null==c.weekStartsOn?f:(0,k.Z)(c.weekStartsOn);if(!(g>=0&&g<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!d.localize)throw new RangeError("locale must contain localize property");if(!d.formatLong)throw new RangeError("locale must contain formatLong property");var v=(0,i.default)(e);if(!(0,r.default)(v))throw new RangeError("Invalid time value");var b=(0,C.Z)(v),y=(0,s.Z)(v,b),w={firstWeekContainsDate:m,weekStartsOn:g,locale:d,_originalDate:v},x=l.match(D).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,S.Z[t])(e,d.formatLong,w):e})).join("").match(N).map((function(n){if("''"===n)return"'";var r=n[0];if("'"===r)return P(n);var a=I[r];if(a)return!c.useAdditionalWeekYearTokens&&(0,T.Do)(n)&&(0,T.qp)(n,t,e),!c.useAdditionalDayOfYearTokens&&(0,T.Iu)(n)&&(0,T.qp)(n,t,e),a(y,n,d.localize,w);if(r.match(R))throw new RangeError("Format string contains an unescaped latin alphabet character `"+r+"`");return n})).join("");return x}function P(e){return e.match(E)[1].replace(O,"'")}},55855:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getDate();return n}},20466:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getDay();return n}},85817:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getHours();return n}},9827:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(19013),a=n(584),s=n(13882);function i(e){return(0,s.Z)(1,arguments),(0,a.default)(e,{weekStartsOn:1})}function o(e){(0,s.Z)(1,arguments);var t=(0,r.default)(e),n=t.getFullYear(),a=new Date(0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);var o=i(a),l=new Date(0);l.setFullYear(n,0,4),l.setHours(0,0,0,0);var c=i(l);return t.getTime()>=o.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function l(e){(0,s.Z)(1,arguments);var t=o(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var r=i(n);return r}var c=6048e5;function d(e){(0,s.Z)(1,arguments);var t=(0,r.default)(e),n=i(t).getTime()-l(t).getTime();return Math.round(n/c)+1}},39159:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMinutes();return n}},78966:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMonth();return n}},56605:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=Math.floor(t.getMonth()/3)+1;return n}},77881:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getSeconds();return n}},28789:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getTime();return n}},95570:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){return(0,a.Z)(1,arguments),(0,r.default)(e).getFullYear()}},42699:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()>s.getTime()}},313:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()<s.getTime()}},71381:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return a}});var r=n(13882);function a(e){return(0,r.Z)(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}},96843:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()===s.getTime()}},3151:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(69119),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()===s.getTime()}},49160:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}},86117:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(94431),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()===s.getTime()}},60792:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getFullYear()===s.getFullYear()}},12274:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(71381),a=n(19013),s=n(13882);function i(e){if((0,s.Z)(1,arguments),!(0,r.default)(e)&&"number"!=typeof e)return!1;var t=(0,a.default)(e);return!isNaN(Number(t))}},24257:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e).getTime(),s=(0,r.default)(t.start).getTime(),i=(0,r.default)(t.end).getTime();if(!(s<=i))throw new RangeError("Invalid interval");return n>=s&&n<=i}},4958:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function a(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var s={date:a({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:a({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:a({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},i={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function o(e){return function(t,n){var r,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,i=a.width?String(a.width):s;r=e.formattingValues[i]||e.formattingValues[s]}else{var o=e.defaultWidth,l=a.width?String(a.width):e.defaultWidth;r=e.values[l]||e.values[o]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function l(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(a);if(!s)return null;var i,o=s[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(l)?d(l,(function(e){return e.test(o)})):c(l,(function(e){return e.test(o)}));i=e.valueCallback?e.valueCallback(u):u,i=n.valueCallback?n.valueCallback(i):i;var p=t.slice(o.length);return{value:i,rest:p}}}function c(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function d(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var u,p={code:"en-US",formatDistance:function(e,t,n){var a,s=r[e];return a="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:s,formatRelative:function(e,t,n,r){return i[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:o({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:o({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:o({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:o({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:o({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(u={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(u.matchPattern);if(!n)return null;var r=n[0],a=e.match(u.parsePattern);if(!a)return null;var s=u.valueCallback?u.valueCallback(a[0]):a[0];s=t.valueCallback?t.valueCallback(s):s;var i=e.slice(r.length);return{value:s,rest:i}}),era:l({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:l({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:l({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:l({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:l({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}}},99890:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){var t,n;if((0,a.Z)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!=typeof e||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=(0,r.default)(e);(void 0===n||n<t||isNaN(Number(t)))&&(n=t)})),n||new Date(NaN)}},37950:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){var t,n;if((0,a.Z)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!=typeof e||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=(0,r.default)(e);(void 0===n||n>t||isNaN(t.getDate()))&&(n=t)})),n||new Date(NaN)}},45853:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return se}});var r=n(4958),a=n(91218),s=n(19013);function i(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}var o=n(97621),l=n(24262),c=n(5267),d=n(83946),u=n(7651),p=n(13882);function m(e,t,n){(0,p.Z)(2,arguments);var r=n||{},a=r.locale,i=a&&a.options&&a.options.weekStartsOn,o=null==i?0:(0,d.Z)(i),l=null==r.weekStartsOn?o:(0,d.Z)(r.weekStartsOn);if(!(l>=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=(0,s.default)(e),u=(0,d.Z)(t),m=c.getUTCDay(),h=u%7,f=(h+7)%7,g=(f<l?7:0)+u-m;return c.setUTCDate(c.getUTCDate()+g),c}var h=n(49702),f=n(23324),g=n(66979),v=n(59025),b=/^(1[0-2]|0?\d)/,y=/^(3[0-1]|[0-2]?\d)/,w=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,x=/^(5[0-3]|[0-4]?\d)/,_=/^(2[0-3]|[0-1]?\d)/,Z=/^(2[0-4]|[0-1]?\d)/,j=/^(1[0-1]|0?\d)/,I=/^(1[0-2]|0?\d)/,S=/^[0-5]?\d/,C=/^[0-5]?\d/,T=/^\d/,k=/^\d{1,2}/,N=/^\d{1,3}/,D=/^\d{1,4}/,E=/^-?\d+/,O=/^-?\d/,R=/^-?\d{1,2}/,A=/^-?\d{1,3}/,P=/^-?\d{1,4}/,M=/^([+-])(\d{2})(\d{2})?|Z/,L=/^([+-])(\d{2})(\d{2})|Z/,F=/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,q=/^([+-])(\d{2}):(\d{2})|Z/,$=/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/;function U(e,t,n){var r=t.match(e);if(!r)return null;var a=parseInt(r[0],10);return{value:n?n(a):a,rest:t.slice(r[0].length)}}function V(e,t){var n=t.match(e);return n?"Z"===n[0]?{value:0,rest:t.slice(1)}:{value:("+"===n[1]?1:-1)*(36e5*(n[2]?parseInt(n[2],10):0)+6e4*(n[3]?parseInt(n[3],10):0)+1e3*(n[5]?parseInt(n[5],10):0)),rest:t.slice(n[0].length)}:null}function W(e,t){return U(E,e,t)}function Y(e,t,n){switch(e){case 1:return U(T,t,n);case 2:return U(k,t,n);case 3:return U(N,t,n);case 4:return U(D,t,n);default:return U(new RegExp("^\\d{1,"+e+"}"),t,n)}}function B(e,t,n){switch(e){case 1:return U(O,t,n);case 2:return U(R,t,n);case 3:return U(A,t,n);case 4:return U(P,t,n);default:return U(new RegExp("^-?\\d{1,"+e+"}"),t,n)}}function H(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function z(e,t){var n,r=t>0,a=r?t:1-t;if(a<=50)n=e||100;else{var s=a+50;n=e+100*Math.floor(s/100)-(e>=s%100?100:0)}return r?n:1-n}var K=[31,28,31,30,31,30,31,31,30,31,30,31],G=[31,29,31,30,31,30,31,31,30,31,30,31];function Q(e){return e%400==0||e%4==0&&e%100!=0}var X={G:{priority:140,parse:function(e,t,n,r){switch(t){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});case"GGGG":default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}},set:function(e,t,n,r){return t.era=n,e.setUTCFullYear(n,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["R","u","t","T"]},y:{priority:130,parse:function(e,t,n,r){var a=function(e){return{year:e,isTwoDigitYear:"yy"===t}};switch(t){case"y":return Y(4,e,a);case"yo":return n.ordinalNumber(e,{unit:"year",valueCallback:a});default:return Y(t.length,e,a)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,r){var a=e.getUTCFullYear();if(n.isTwoDigitYear){var s=z(n.year,a);return e.setUTCFullYear(s,0,1),e.setUTCHours(0,0,0,0),e}var i="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(i,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","u","w","I","i","e","c","t","T"]},Y:{priority:130,parse:function(e,t,n,r){var a=function(e){return{year:e,isTwoDigitYear:"YY"===t}};switch(t){case"Y":return Y(4,e,a);case"Yo":return n.ordinalNumber(e,{unit:"year",valueCallback:a});default:return Y(t.length,e,a)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,r){var a=(0,u.Z)(e,r);if(n.isTwoDigitYear){var s=z(n.year,a);return e.setUTCFullYear(s,0,r.firstWeekContainsDate),e.setUTCHours(0,0,0,0),(0,v.Z)(e,r)}var i="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(i,0,r.firstWeekContainsDate),e.setUTCHours(0,0,0,0),(0,v.Z)(e,r)},incompatibleTokens:["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:{priority:130,parse:function(e,t,n,r){return B("R"===t?4:t.length,e)},set:function(e,t,n,r){var a=new Date(0);return a.setUTCFullYear(n,0,4),a.setUTCHours(0,0,0,0),(0,g.Z)(a)},incompatibleTokens:["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:{priority:130,parse:function(e,t,n,r){return B("u"===t?4:t.length,e)},set:function(e,t,n,r){return e.setUTCFullYear(n,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["G","y","Y","R","w","I","i","e","c","t","T"]},Q:{priority:120,parse:function(e,t,n,r){switch(t){case"Q":case"QQ":return Y(t.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=1&&t<=4},set:function(e,t,n,r){return e.setUTCMonth(3*(n-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},q:{priority:120,parse:function(e,t,n,r){switch(t){case"q":case"qq":return Y(t.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=1&&t<=4},set:function(e,t,n,r){return e.setUTCMonth(3*(n-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},M:{priority:110,parse:function(e,t,n,r){var a=function(e){return e-1};switch(t){case"M":return U(b,e,a);case"MM":return Y(2,e,a);case"Mo":return n.ordinalNumber(e,{unit:"month",valueCallback:a});case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,r){return e.setUTCMonth(n,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]},L:{priority:110,parse:function(e,t,n,r){var a=function(e){return e-1};switch(t){case"L":return U(b,e,a);case"LL":return Y(2,e,a);case"Lo":return n.ordinalNumber(e,{unit:"month",valueCallback:a});case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,r){return e.setUTCMonth(n,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},w:{priority:100,parse:function(e,t,n,r){switch(t){case"w":return U(x,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=53},set:function(e,t,n,r){return(0,v.Z)(function(e,t,n){(0,p.Z)(2,arguments);var r=(0,s.default)(e),a=(0,d.Z)(t),i=(0,f.Z)(r,n)-a;return r.setUTCDate(r.getUTCDate()-7*i),r}(e,n,r),r)},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:{priority:100,parse:function(e,t,n,r){switch(t){case"I":return U(x,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=53},set:function(e,t,n,r){return(0,g.Z)(function(e,t){(0,p.Z)(2,arguments);var n=(0,s.default)(e),r=(0,d.Z)(t),a=(0,h.Z)(n)-r;return n.setUTCDate(n.getUTCDate()-7*a),n}(e,n,r),r)},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},d:{priority:90,subPriority:1,parse:function(e,t,n,r){switch(t){case"d":return U(y,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return Y(t.length,e)}},validate:function(e,t,n){var r=Q(e.getUTCFullYear()),a=e.getUTCMonth();return r?t>=1&&t<=G[a]:t>=1&&t<=K[a]},set:function(e,t,n,r){return e.setUTCDate(n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","w","I","D","i","e","c","t","T"]},D:{priority:90,subPriority:1,parse:function(e,t,n,r){switch(t){case"D":case"DD":return U(w,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return Y(t.length,e)}},validate:function(e,t,n){return Q(e.getUTCFullYear())?t>=1&&t<=366:t>=1&&t<=365},set:function(e,t,n,r){return e.setUTCMonth(0,n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},E:{priority:90,parse:function(e,t,n,r){switch(t){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,r){return(e=m(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["D","i","e","c","t","T"]},e:{priority:90,parse:function(e,t,n,r){var a=function(e){var t=7*Math.floor((e-1)/7);return(e+r.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return Y(t.length,e,a);case"eo":return n.ordinalNumber(e,{unit:"day",valueCallback:a});case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,r){return(e=m(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},c:{priority:90,parse:function(e,t,n,r){var a=function(e){var t=7*Math.floor((e-1)/7);return(e+r.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return Y(t.length,e,a);case"co":return n.ordinalNumber(e,{unit:"day",valueCallback:a});case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,r){return(e=m(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},i:{priority:90,parse:function(e,t,n,r){var a=function(e){return 0===e?7:e};switch(t){case"i":case"ii":return Y(t.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return n.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||n.day(e,{width:"short",context:"formatting",valueCallback:a})||n.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiii":return n.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiiii":return n.day(e,{width:"short",context:"formatting",valueCallback:a})||n.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiii":default:return n.day(e,{width:"wide",context:"formatting",valueCallback:a})||n.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||n.day(e,{width:"short",context:"formatting",valueCallback:a})||n.day(e,{width:"narrow",context:"formatting",valueCallback:a})}},validate:function(e,t,n){return t>=1&&t<=7},set:function(e,t,n,r){return(e=function(e,t){(0,p.Z)(2,arguments);var n=(0,d.Z)(t);n%7==0&&(n-=7);var r=1,a=(0,s.default)(e),i=a.getUTCDay(),o=((n%7+7)%7<r?7:0)+n-i;return a.setUTCDate(a.getUTCDate()+o),a}(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]},a:{priority:80,parse:function(e,t,n,r){switch(t){case"a":case"aa":case"aaa":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,t,n,r){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["b","B","H","k","t","T"]},b:{priority:80,parse:function(e,t,n,r){switch(t){case"b":case"bb":case"bbb":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,t,n,r){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["a","B","H","k","t","T"]},B:{priority:80,parse:function(e,t,n,r){switch(t){case"B":case"BB":case"BBB":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,t,n,r){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["a","b","t","T"]},h:{priority:70,parse:function(e,t,n,r){switch(t){case"h":return U(I,e);case"ho":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=12},set:function(e,t,n,r){var a=e.getUTCHours()>=12;return a&&n<12?e.setUTCHours(n+12,0,0,0):a||12!==n?e.setUTCHours(n,0,0,0):e.setUTCHours(0,0,0,0),e},incompatibleTokens:["H","K","k","t","T"]},H:{priority:70,parse:function(e,t,n,r){switch(t){case"H":return U(_,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=23},set:function(e,t,n,r){return e.setUTCHours(n,0,0,0),e},incompatibleTokens:["a","b","h","K","k","t","T"]},K:{priority:70,parse:function(e,t,n,r){switch(t){case"K":return U(j,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,r){return e.getUTCHours()>=12&&n<12?e.setUTCHours(n+12,0,0,0):e.setUTCHours(n,0,0,0),e},incompatibleTokens:["h","H","k","t","T"]},k:{priority:70,parse:function(e,t,n,r){switch(t){case"k":return U(Z,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=24},set:function(e,t,n,r){var a=n<=24?n%24:n;return e.setUTCHours(a,0,0,0),e},incompatibleTokens:["a","b","h","H","K","t","T"]},m:{priority:60,parse:function(e,t,n,r){switch(t){case"m":return U(S,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=59},set:function(e,t,n,r){return e.setUTCMinutes(n,0,0),e},incompatibleTokens:["t","T"]},s:{priority:50,parse:function(e,t,n,r){switch(t){case"s":return U(C,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=59},set:function(e,t,n,r){return e.setUTCSeconds(n,0),e},incompatibleTokens:["t","T"]},S:{priority:30,parse:function(e,t,n,r){return Y(t.length,e,(function(e){return Math.floor(e*Math.pow(10,3-t.length))}))},set:function(e,t,n,r){return e.setUTCMilliseconds(n),e},incompatibleTokens:["t","T"]},X:{priority:10,parse:function(e,t,n,r){switch(t){case"X":return V(M,e);case"XX":return V(L,e);case"XXXX":return V(F,e);case"XXXXX":return V($,e);case"XXX":default:return V(q,e)}},set:function(e,t,n,r){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","x"]},x:{priority:10,parse:function(e,t,n,r){switch(t){case"x":return V(M,e);case"xx":return V(L,e);case"xxxx":return V(F,e);case"xxxxx":return V($,e);case"xxx":default:return V(q,e)}},set:function(e,t,n,r){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","X"]},t:{priority:40,parse:function(e,t,n,r){return W(e)},set:function(e,t,n,r){return[new Date(1e3*n),{timestampIsSet:!0}]},incompatibleTokens:"*"},T:{priority:20,parse:function(e,t,n,r){return W(e)},set:function(e,t,n,r){return[new Date(n),{timestampIsSet:!0}]},incompatibleTokens:"*"}},J=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,te=/^'([^]*?)'?$/,ne=/''/g,re=/\S/,ae=/[a-zA-Z]/;function se(e,t,n,u){(0,p.Z)(3,arguments);var m=String(e),h=String(t),f=u||{},g=f.locale||r.Z;if(!g.match)throw new RangeError("locale must contain match property");var v=g.options&&g.options.firstWeekContainsDate,b=null==v?1:(0,d.Z)(v),y=null==f.firstWeekContainsDate?b:(0,d.Z)(f.firstWeekContainsDate);if(!(y>=1&&y<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var w=g.options&&g.options.weekStartsOn,x=null==w?0:(0,d.Z)(w),_=null==f.weekStartsOn?x:(0,d.Z)(f.weekStartsOn);if(!(_>=0&&_<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(""===h)return""===m?(0,s.default)(n):new Date(NaN);var Z,j={firstWeekContainsDate:y,weekStartsOn:_,locale:g},I=[{priority:10,subPriority:-1,set:ie,index:0}],S=h.match(ee).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,o.Z[t])(e,g.formatLong,j):e})).join("").match(J),C=[];for(Z=0;Z<S.length;Z++){var T=S[Z];!f.useAdditionalWeekYearTokens&&(0,c.Do)(T)&&(0,c.qp)(T,h,e),!f.useAdditionalDayOfYearTokens&&(0,c.Iu)(T)&&(0,c.qp)(T,h,e);var k=T[0],N=X[k];if(N){var D=N.incompatibleTokens;if(Array.isArray(D)){for(var E=void 0,O=0;O<C.length;O++){var R=C[O].token;if(-1!==D.indexOf(R)||R===k){E=C[O];break}}if(E)throw new RangeError("The format string mustn't contain `".concat(E.fullToken,"` and `").concat(T,"` at the same time"))}else if("*"===N.incompatibleTokens&&C.length)throw new RangeError("The format string mustn't contain `".concat(T,"` and any other token at the same time"));C.push({token:k,fullToken:T});var A=N.parse(m,T,g.match,j);if(!A)return new Date(NaN);I.push({priority:N.priority,subPriority:N.subPriority||0,set:N.set,validate:N.validate,value:A.value,index:I.length}),m=A.rest}else{if(k.match(ae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+k+"`");if("''"===T?T="'":"'"===k&&(T=oe(T)),0!==m.indexOf(T))return new Date(NaN);m=m.slice(T.length)}}if(m.length>0&&re.test(m))return new Date(NaN);var P=I.map((function(e){return e.priority})).sort((function(e,t){return t-e})).filter((function(e,t,n){return n.indexOf(e)===t})).map((function(e){return I.filter((function(t){return t.priority===e})).sort((function(e,t){return t.subPriority-e.subPriority}))})).map((function(e){return e[0]})),M=(0,s.default)(n);if(isNaN(M))return new Date(NaN);var L=(0,a.Z)(M,(0,l.Z)(M)),F={};for(Z=0;Z<P.length;Z++){var q=P[Z];if(q.validate&&!q.validate(L,q.value,j))return new Date(NaN);var $=q.set(L,F,q.value,j);$[0]?(L=$[0],i(F,$[1])):L=$}return L}function ie(e,t){if(t.timestampIsSet)return e;var n=new Date(0);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}function oe(e){return e.match(te)[1].replace(ne,"'")}},23855:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(36948),a=n(13882),s=n(83946);function i(e,t){(0,a.Z)(1,arguments);var n=t||{},r=null==n.additionalDigits?2:(0,s.Z)(n.additionalDigits);if(2!==r&&1!==r&&0!==r)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var i,o=u(e);if(o.date){var l=p(o.date,r);i=m(l.restDateString,l.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);var c,d=i.getTime(),h=0;if(o.time&&(h=f(o.time),isNaN(h)))return new Date(NaN);if(!o.timezone){var g=new Date(d+h),b=new Date(0);return b.setFullYear(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),b.setHours(g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds()),b}return c=v(o.timezone),isNaN(c)?new Date(NaN):new Date(d+h+c)}var o={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},l=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,c=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,d=/^([+-])(\d{2})(?::?(\d{2}))?$/;function u(e){var t,n={},r=e.split(o.dateTimeDelimiter);if(r.length>2)return n;if(/:/.test(r[0])?t=r[0]:(n.date=r[0],t=r[1],o.timeZoneDelimiter.test(n.date)&&(n.date=e.split(o.timeZoneDelimiter)[0],t=e.substr(n.date.length,e.length))),t){var a=o.timezone.exec(t);a?(n.time=t.replace(a[1],""),n.timezone=a[1]):n.time=t}return n}function p(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};var a=r[1]?parseInt(r[1]):null,s=r[2]?parseInt(r[2]):null;return{year:null===s?a:100*s,restDateString:e.slice((r[1]||r[2]).length)}}function m(e,t){if(null===t)return new Date(NaN);var n=e.match(l);if(!n)return new Date(NaN);var r=!!n[4],a=h(n[1]),s=h(n[2])-1,i=h(n[3]),o=h(n[4]),c=h(n[5])-1;if(r)return function(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}(0,o,c)?function(e,t,n){var r=new Date(0);r.setUTCFullYear(e,0,4);var a=7*(t-1)+n+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+a),r}(t,o,c):new Date(NaN);var d=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(b[t]||(y(e)?29:28))}(t,s,i)&&function(e,t){return t>=1&&t<=(y(e)?366:365)}(t,a)?(d.setUTCFullYear(t,s,Math.max(a,i)),d):new Date(NaN)}function h(e){return e?parseInt(e):1}function f(e){var t=e.match(c);if(!t)return NaN;var n=g(t[1]),a=g(t[2]),s=g(t[3]);return function(e,t,n){return 24===e?0===t&&0===n:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}(n,a,s)?n*r.vh+a*r.yJ+1e3*s:NaN}function g(e){return e&&parseFloat(e.replace(",","."))||0}function v(e){if("Z"===e)return 0;var t=e.match(d);if(!t)return 0;var n="+"===t[1]?-1:1,a=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,s)?n*(a*r.vh+s*r.yJ):NaN}var b=[31,null,31,30,31,30,31,31,30,31,30,31];function y(e){return e%400==0||e%4==0&&e%100!=0}},37042:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return n.setHours(i),n}},4543:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return n.setMinutes(i),n}},62225:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(83946),a=n(19013),s=n(13882);function i(e){(0,s.Z)(1,arguments);var t=(0,a.default)(e),n=t.getFullYear(),r=t.getMonth(),i=new Date(0);return i.setFullYear(n,r+1,0),i.setHours(0,0,0,0),i.getDate()}function o(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),o=(0,r.Z)(t),l=n.getFullYear(),c=n.getDate(),d=new Date(0);d.setFullYear(l,o,15),d.setHours(0,0,0,0);var u=i(d);return n.setMonth(o,Math.min(c,u)),n}},11503:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(83946),a=n(19013),s=n(62225),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,a.default)(e),o=(0,r.Z)(t),l=Math.floor(n.getMonth()/3)+1,c=o-l;return(0,s.default)(n,n.getMonth()+3*c)}},39880:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return n.setSeconds(i),n}},44749:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(i),n)}},69119:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e);return t.setHours(0,0,0,0),t}},43703:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e);return t.setDate(1),t.setHours(0,0,0,0),t}},94431:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMonth(),s=n-n%3;return t.setMonth(s,1),t.setHours(0,0,0,0),t}},584:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(19013),a=n(83946),s=n(13882);function i(e,t){(0,s.Z)(1,arguments);var n=t||{},i=n.locale,o=i&&i.options&&i.options.weekStartsOn,l=null==o?0:(0,a.Z)(o),c=null==n.weekStartsOn?l:(0,a.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=(0,r.default)(e),u=d.getDay(),p=(u<c?7:0)+u-c;return d.setDate(d.getDate()-p),d.setHours(0,0,0,0),d}},38148:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}},7069:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(77349),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},88330:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(78343),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},91218:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(83946),a=n(51820),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.Z)(e,-n)}},1784:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(58545),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},54559:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(11640),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},77982:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(63500),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},59319:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(21593),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},19013:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return a}});var r=n(13882);function a(e){(0,r.Z)(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}},16245:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,n){var r,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,i=a.width?String(a.width):s;r=e.formattingValues[i]||e.formattingValues[s]}else{var o=e.defaultWidth,l=a.width?String(a.width):e.defaultWidth;r=e.values[l]||e.values[o]}return r[e.argumentCallback?e.argumentCallback(t):t]}},e.exports=t.default},57460:function(e,t){var n,r;void 0===(r="function"==typeof(n=function e(){"use strict";var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,r=n&&/blob:/i.test((t.location||{}).protocol),a={},s=0,i={parse:function(n,r){var o=(r=r||{}).dynamicTyping||!1;if(x(o)&&(r.dynamicTypingFunction=o,o={}),r.dynamicTyping=o,r.transform=!!x(r.transform)&&r.transform,r.worker&&i.WORKERS_SUPPORTED){var l=function(){if(!i.WORKERS_SUPPORTED)return!1;var n,r,o=(n=t.URL||t.webkitURL||null,r=e.toString(),i.BLOB_URL||(i.BLOB_URL=n.createObjectURL(new Blob(["(",r,")();"],{type:"text/javascript"})))),l=new t.Worker(o);return l.onmessage=g,l.id=s++,a[l.id]=l}();return l.userStep=r.step,l.userChunk=r.chunk,l.userComplete=r.complete,l.userError=r.error,r.step=x(r.step),r.chunk=x(r.chunk),r.complete=x(r.complete),r.error=x(r.error),delete r.worker,void l.postMessage({input:n,config:r,workerId:l.id})}var m=null;return i.NODE_STREAM_INPUT,"string"==typeof n?m=r.download?new c(r):new u(r):!0===n.readable&&x(n.read)&&x(n.on)?m=new p(r):(t.File&&n instanceof File||n instanceof Object)&&(m=new d(r)),m.stream(n)},unparse:function(e,t){var n=!1,r=!0,a=",",s="\r\n",o='"',l=o+o,c=!1,d=null,u=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||i.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(a=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(o=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");d=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+o),"boolean"==typeof t.escapeFormulae&&(u=t.escapeFormulae)}}();var p=new RegExp(h(o),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return m(null,e,c);if("object"==typeof e[0])return m(d||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),m(e.fields||[],e.data||[],c);throw new Error("Unable to serialize unrecognized input");function m(e,t,n){var i="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var o=Array.isArray(e)&&0<e.length,l=!Array.isArray(t[0]);if(o&&r){for(var c=0;c<e.length;c++)0<c&&(i+=a),i+=f(e[c],c);0<t.length&&(i+=s)}for(var d=0;d<t.length;d++){var u=o?e.length:t[d].length,p=!1,m=o?0===Object.keys(t[d]).length:0===t[d].length;if(n&&!o&&(p="greedy"===n?""===t[d].join("").trim():1===t[d].length&&0===t[d][0].length),"greedy"===n&&o){for(var h=[],g=0;g<u;g++){var v=l?e[g]:g;h.push(t[d][v])}p=""===h.join("").trim()}if(!p){for(var b=0;b<u;b++){0<b&&!m&&(i+=a);var y=o&&l?e[b]:b;i+=f(t[d][y],b)}d<t.length-1&&(!n||0<u&&!m)&&(i+=s)}}return i}function f(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);!0===u&&"string"==typeof e&&null!==e.match(/^[=+\-@].*$/)&&(e="'"+e);var r=e.toString().replace(p,l);return"boolean"==typeof n&&n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1}(r,i.BAD_DELIMITERS)||-1<r.indexOf(a)||" "===r.charAt(0)||" "===r.charAt(r.length-1)?o+r+o:r}}};if(i.RECORD_SEP=String.fromCharCode(30),i.UNIT_SEP=String.fromCharCode(31),i.BYTE_ORDER_MARK="\ufeff",i.BAD_DELIMITERS=["\r","\n",'"',i.BYTE_ORDER_MARK],i.WORKERS_SUPPORTED=!n&&!!t.Worker,i.NODE_STREAM_INPUT=1,i.LocalChunkSize=10485760,i.RemoteChunkSize=5242880,i.DefaultDelimiter=",",i.Parser=f,i.ParserHandle=m,i.NetworkStreamer=c,i.FileStreamer=d,i.StringStreamer=u,i.ReadableStreamStreamer=p,t.jQuery){var o=t.jQuery;o.fn.parse=function(e){var n=e.config||{},r=[];return this.each((function(e){if("INPUT"!==o(this).prop("tagName").toUpperCase()||"file"!==o(this).attr("type").toLowerCase()||!t.FileReader||!this.files||0===this.files.length)return!0;for(var a=0;a<this.files.length;a++)r.push({file:this.files[a],inputElem:this,instanceConfig:o.extend({},n)})})),a(),this;function a(){if(0!==r.length){var t,n,a,l=r[0];if(x(e.before)){var c=e.before(l.file,l.inputElem);if("object"==typeof c){if("abort"===c.action)return"AbortError",t=l.file,n=l.inputElem,a=c.reason,void(x(e.error)&&e.error({name:"AbortError"},t,n,a));if("skip"===c.action)return void s();"object"==typeof c.config&&(l.instanceConfig=o.extend(l.instanceConfig,c.config))}else if("skip"===c)return void s()}var d=l.instanceConfig.complete;l.instanceConfig.complete=function(e){x(d)&&d(e,l.file,l.inputElem),s()},i.parse(l.file,l.instanceConfig)}else x(e.complete)&&e.complete()}function s(){r.splice(0,1),a()}}}function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=y(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new m(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&x(this._config.beforeFirstChunk)){var a=this._config.beforeFirstChunk(e);void 0!==a&&(e=a)}this.isFirstChunk=!1,this._halted=!1;var s=this._partialLine+e;this._partialLine="";var o=this._handle.parse(s,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=o.meta.cursor;this._finished||(this._partialLine=s.substring(l-this._baseIndex),this._baseIndex=l),o&&o.data&&(this._rowCount+=o.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)t.postMessage({results:o,workerId:i.WORKER_ID,finished:c});else if(x(this._config.chunk)&&!n){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!c||!x(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(e){x(this._config.error)?this._config.error(e):r&&this._config.error&&t.postMessage({workerId:i.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=i.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=w(this._chunkLoaded,this),t.onerror=w(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var r in e)t.setRequestHeader(r,e[r])}if(this._config.chunkSize){var a=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+a)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var n=t.statusText||e;this._sendError(new Error(n))}}function d(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=i.LocalChunkSize),l.call(this,e);var r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=w(this._chunkLoaded,this),t.onerror=w(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var a=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,a)}var s=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:s}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,n=this._config.chunkSize;return n?(e=t.substring(0,n),t=t.substring(n)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function p(e){l.call(this,e=e||{});var t=[],n=!0,r=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=w((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=w((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=w((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=w((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function m(e){var t,n,r,a=Math.pow(2,53),s=-a,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,l=/^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/,c=this,d=0,u=0,p=!1,m=!1,g=[],v={data:[],errors:[],meta:{}};if(x(e.step)){var b=e.step;e.step=function(t){if(v=t,Z())_();else{if(_(),0===v.data.length)return;d+=t.data.length,e.preview&&d>e.preview?n.abort():(v.data=v.data[0],b(v,c))}}}function w(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function _(){if(v&&r&&(I("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+i.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines)for(var t=0;t<v.data.length;t++)w(v.data[t])&&v.data.splice(t--,1);return Z()&&function(){if(v)if(Array.isArray(v.data[0])){for(var t=0;Z()&&t<v.data.length;t++)v.data[t].forEach(n);v.data.splice(0,1)}else v.data.forEach(n);function n(t,n){x(e.transformHeader)&&(t=e.transformHeader(t,n)),g.push(t)}}(),function(){if(!v||!e.header&&!e.dynamicTyping&&!e.transform)return v;function t(t,n){var r,a=e.header?{}:[];for(r=0;r<t.length;r++){var s=r,i=t[r];e.header&&(s=r>=g.length?"__parsed_extra":g[r]),e.transform&&(i=e.transform(i,s)),i=j(s,i),"__parsed_extra"===s?(a[s]=a[s]||[],a[s].push(i)):a[s]=i}return e.header&&(r>g.length?I("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+r,u+n):r<g.length&&I("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+r,u+n)),a}var n=1;return!v.data.length||Array.isArray(v.data[0])?(v.data=v.data.map(t),n=v.data.length):v.data=t(v.data,0),e.header&&v.meta&&(v.meta.fields=g),u+=n,v}()}function Z(){return e.header&&0===g.length}function j(t,n){return r=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(o.test(e)){var t=parseFloat(e);if(s<t&&t<a)return!0}return!1}(n)?parseFloat(n):l.test(n)?new Date(n):""===n?null:n):n;var r}function I(e,t,n,r){var a={type:e,code:t,message:n};void 0!==r&&(a.row=r),v.errors.push(a)}this.parse=function(a,s,o){var l=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substring(0,1048576);var n=new RegExp(h(t)+"([^]*?)"+h(t),"gm"),r=(e=e.replace(n,"")).split("\r"),a=e.split("\n"),s=1<a.length&&a[0].length<r[0].length;if(1===r.length||s)return"\n";for(var i=0,o=0;o<r.length;o++)"\n"===r[o][0]&&i++;return i>=r.length/2?"\r\n":"\r"}(a,l)),r=!1,e.delimiter)x(e.delimiter)&&(e.delimiter=e.delimiter(a),v.meta.delimiter=e.delimiter);else{var c=function(t,n,r,a,s){var o,l,c,d;s=s||[",","\t","|",";",i.RECORD_SEP,i.UNIT_SEP];for(var u=0;u<s.length;u++){var p=s[u],m=0,h=0,g=0;c=void 0;for(var v=new f({comments:a,delimiter:p,newline:n,preview:10}).parse(t),b=0;b<v.data.length;b++)if(r&&w(v.data[b]))g++;else{var y=v.data[b].length;h+=y,void 0!==c?0<y&&(m+=Math.abs(y-c),c=y):c=y}0<v.data.length&&(h/=v.data.length-g),(void 0===l||m<=l)&&(void 0===d||d<h)&&1.99<h&&(l=m,o=p,d=h)}return{successful:!!(e.delimiter=o),bestDelimiter:o}}(a,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(r=!0,e.delimiter=i.DefaultDelimiter),v.meta.delimiter=e.delimiter}var d=y(e);return e.preview&&e.header&&d.preview++,t=a,n=new f(d),v=n.parse(t,s,o),_(),p?{meta:{paused:!0}}:v||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,n.abort(),t=x(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(p=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return m},this.abort=function(){m=!0,n.abort(),v.meta.aborted=!0,x(e.complete)&&e.complete(v),t=""}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function f(e){var t,n=(e=e||{}).delimiter,r=e.newline,a=e.comments,s=e.step,o=e.preview,l=e.fastMode,c=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof n||-1<i.BAD_DELIMITERS.indexOf(n))&&(n=","),a===n)throw new Error("Comment character same as delimiter");!0===a?a="#":("string"!=typeof a||-1<i.BAD_DELIMITERS.indexOf(a))&&(a=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var d=0,u=!1;this.parse=function(e,i,p){if("string"!=typeof e)throw new Error("Input must be a string");var m=e.length,f=n.length,g=r.length,v=a.length,b=x(s),y=[],w=[],_=[],Z=d=0;if(!e)return P();if(l||!1!==l&&-1===e.indexOf(t)){for(var j=e.split(r),I=0;I<j.length;I++){if(_=j[I],d+=_.length,I!==j.length-1)d+=r.length;else if(p)return P();if(!a||_.substring(0,v)!==a){if(b){if(y=[],E(_.split(n)),M(),u)return P()}else E(_.split(n));if(o&&o<=I)return y=y.slice(0,o),P(!0)}}return P()}for(var S=e.indexOf(n,d),C=e.indexOf(r,d),T=new RegExp(h(c)+h(t),"g"),k=e.indexOf(t,d);;)if(e[d]!==t)if(a&&0===_.length&&e.substring(d,d+v)===a){if(-1===C)return P();d=C+g,C=e.indexOf(r,d),S=e.indexOf(n,d)}else if(-1!==S&&(S<C||-1===C))_.push(e.substring(d,S)),d=S+f,S=e.indexOf(n,d);else{if(-1===C)break;if(_.push(e.substring(d,C)),A(C+g),b&&(M(),u))return P();if(o&&y.length>=o)return P(!0)}else for(k=d,d++;;){if(-1===(k=e.indexOf(t,k+1)))return p||w.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:y.length,index:d}),R();if(k===m-1)return R(e.substring(d,k).replace(T,t));if(t!==c||e[k+1]!==c){if(t===c||0===k||e[k-1]!==c){-1!==S&&S<k+1&&(S=e.indexOf(n,k+1)),-1!==C&&C<k+1&&(C=e.indexOf(r,k+1));var N=O(-1===C?S:Math.min(S,C));if(e[k+1+N]===n){_.push(e.substring(d,k).replace(T,t)),e[d=k+1+N+f]!==t&&(k=e.indexOf(t,d)),S=e.indexOf(n,d),C=e.indexOf(r,d);break}var D=O(C);if(e.substring(k+1+D,k+1+D+g)===r){if(_.push(e.substring(d,k).replace(T,t)),A(k+1+D+g),S=e.indexOf(n,d),k=e.indexOf(t,d),b&&(M(),u))return P();if(o&&y.length>=o)return P(!0);break}w.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:y.length,index:d}),k++}}else k++}return R();function E(e){y.push(e),Z=d}function O(t){var n=0;if(-1!==t){var r=e.substring(k+1,t);r&&""===r.trim()&&(n=r.length)}return n}function R(t){return p||(void 0===t&&(t=e.substring(d)),_.push(t),d=m,E(_),b&&M()),P()}function A(t){d=t,E(_),_=[],C=e.indexOf(r,d)}function P(e){return{data:y,errors:w,meta:{delimiter:n,linebreak:r,aborted:u,truncated:!!e,cursor:Z+(i||0)}}}function M(){s(P()),y=[],w=[]}},this.abort=function(){u=!0},this.getCharIndex=function(){return d}}function g(e){var t=e.data,n=a[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var s={abort:function(){r=!0,v(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:b,resume:b};if(x(n.userStep)){for(var i=0;i<t.results.data.length&&(n.userStep({data:t.results.data[i],errors:t.results.errors,meta:t.results.meta},s),!r);i++);delete t.results}else x(n.userChunk)&&(n.userChunk(t.results,s,t.file),delete t.results)}t.finished&&!r&&v(t.workerId,t.results)}function v(e,t){var n=a[e];x(n.userComplete)&&n.userComplete(t),n.terminate(),delete a[e]}function b(){throw new Error("Not implemented.")}function y(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=y(e[n]);return t}function w(e,t){return function(){e.apply(t,arguments)}}function x(e){return"function"==typeof e}return r&&(t.onmessage=function(e){var n=e.data;if(void 0===i.WORKER_ID&&n&&(i.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:i.WORKER_ID,results:i.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var r=i.parse(n.input,n.config);r&&t.postMessage({workerId:i.WORKER_ID,results:r,finished:!0})}}),(c.prototype=Object.create(l.prototype)).constructor=c,(d.prototype=Object.create(l.prototype)).constructor=d,(u.prototype=Object.create(u.prototype)).constructor=u,(p.prototype=Object.create(l.prototype)).constructor=p,i})?n.apply(t,[]):n)||(e.exports=r)},9198:function(e,t,n){!function(e,t,r,a,s,i,o,l,c,d,u,p,m,h,f,g,v,b,y,w,x,_,Z,j,I,S,C,T,k,N,D,E,O,R,A,P,M,L,F,q,$,U,V,W,Y,B,H,z,K,G,Q,X,J,ee,te,ne,re,ae,se,ie,oe,le,ce){"use strict";function de(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var ue=de(t),pe=de(a),me=de(s),he=de(i),fe=de(o),ge=de(l),ve=de(c),be=de(d),ye=de(u),we=de(p),xe=de(m),_e=de(g),Ze=de(v),je=de(b),Ie=de(y),Se=de(w),Ce=de(x),Te=de(_),ke=de(Z),Ne=de(j),De=de(I),Ee=de(S),Oe=de(C),Re=de(T),Ae=de(k),Pe=de(N),Me=de(D),Le=de(E),Fe=de(O),qe=de(R),$e=de(A),Ue=de(P),Ve=de(M),We=de(L),Ye=de(F),Be=de($),He=de(U),ze=de(V),Ke=de(W),Ge=de(Y),Qe=de(B),Xe=de(H),Je=de(G),et=de(Q),tt=de(X),nt=de(J),rt=de(ee),at=de(te),st=de(ne),it=de(re),ot=de(ae),lt=de(se),ct=de(ie),dt=de(oe),ut=de(le);function pt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function mt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pt(Object(n),!0).forEach((function(t){bt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ht(e){return(ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ft(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function vt(e,t,n){return t&&gt(e.prototype,t),n&&gt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function bt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yt(){return(yt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function wt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&_t(e,t)}function xt(e){return(xt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _t(e,t){return(_t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jt(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Zt(e)}function It(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=xt(e);if(t){var a=xt(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return jt(this,n)}}function St(e){return function(e){if(Array.isArray(e))return Ct(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Tt(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function kt(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}}var Nt={p:kt,P:function(e,t){var n,r=e.match(/(P+)(p+)?/)||[],a=r[1],s=r[2];if(!s)return Tt(e,t);switch(a){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;case"PPPP":default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Tt(a,t)).replace("{{time}}",kt(s,t))}},Dt=12,Et=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;function Ot(e){var t=e?"string"==typeof e||e instanceof String?ct.default(e):ot.default(e):new Date;return At(t)?t:null}function Rt(e,t,n,r,a){var s=null,i=Jt(n)||Jt(Xt()),o=!0;return Array.isArray(t)?(t.forEach((function(t){var n=lt.default(e,t,new Date,{locale:i});r&&(o=At(n,a)&&e===fe.default(n,t,{awareOfUnicodeTokens:!0})),At(n,a)&&o&&(s=n)})),s):(s=lt.default(e,t,new Date,{locale:i}),r?o=At(s)&&e===fe.default(s,t,{awareOfUnicodeTokens:!0}):At(s)||(t=t.match(Et).map((function(e){var t=e[0];return"p"===t||"P"===t?i?(0,Nt[t])(e,i.formatLong):t:e})).join(""),e.length>0&&(s=lt.default(e,t.slice(0,e.length),new Date)),At(s)||(s=new Date(e))),At(s)&&o?s:null)}function At(e,t){return t=t||new Date("1/1/1000"),he.default(e)&&!st.default(e,t)}function Pt(e,t,n){if("en"===n)return fe.default(e,t,{awareOfUnicodeTokens:!0});var r=Jt(n);return n&&!r&&console.warn('A locale object was not found for the provided string ["'.concat(n,'"].')),!r&&Xt()&&Jt(Xt())&&(r=Jt(Xt())),fe.default(e,t,{locale:r||null,awareOfUnicodeTokens:!0})}function Mt(e,t){var n=t.dateFormat,r=t.locale;return e&&Pt(e,Array.isArray(n)?n[0]:n,r)||""}function Lt(e,t){var n=t.hour,r=void 0===n?0:n,a=t.minute,s=void 0===a?0:a,i=t.second,o=void 0===i?0:i;return Le.default(Me.default(Pe.default(e,o),s),r)}function Ft(e,t){var n=t&&Jt(t)||Xt()&&Jt(Xt());return De.default(e,n?{locale:n}:null)}function qt(e,t){return Pt(e,"ddd",t)}function $t(e){return He.default(e)}function Ut(e,t,n){var r=Jt(t||Xt());return ze.default(e,{locale:r,weekStartsOn:n})}function Vt(e){return Ke.default(e)}function Wt(e){return Qe.default(e)}function Yt(e){return Ge.default(e)}function Bt(e,t){return e&&t?nt.default(e,t):!e&&!t}function Ht(e,t){return e&&t?tt.default(e,t):!e&&!t}function zt(e,t){return e&&t?rt.default(e,t):!e&&!t}function Kt(e,t){return e&&t?et.default(e,t):!e&&!t}function Gt(e,t){return e&&t?Je.default(e,t):!e&&!t}function Qt(e,t,n){var r,a=He.default(t),s=Xe.default(n);try{r=it.default(e,{start:a,end:s})}catch(e){r=!1}return r}function Xt(){return("undefined"!=typeof window?window:n.g).__localeId__}function Jt(e){if("string"==typeof e){var t="undefined"!=typeof window?window:n.g;return t.__localeData__?t.__localeData__[e]:null}return e}function en(e,t){return Pt(Fe.default(Ot(),e),"LLLL",t)}function tn(e,t){return Pt(Fe.default(Ot(),e),"LLL",t)}function nn(e,t){return Pt(qe.default(Ot(),e),"QQQ",t)}function rn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate,a=t.excludeDates,s=t.excludeDateIntervals,i=t.includeDates,o=t.includeDateIntervals,l=t.filterDate;return un(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return Kt(e,t)}))||s&&s.some((function(t){var n=t.start,r=t.end;return it.default(e,{start:n,end:r})}))||i&&!i.some((function(t){return Kt(e,t)}))||o&&!o.some((function(t){var n=t.start,r=t.end;return it.default(e,{start:n,end:r})}))||l&&!l(Ot(e))||!1}function an(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeDates,r=t.excludeDateIntervals;return r&&r.length>0?r.some((function(t){var n=t.start,r=t.end;return it.default(e,{start:n,end:r})})):n&&n.some((function(t){return Kt(e,t)}))||!1}function sn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate,a=t.excludeDates,s=t.includeDates,i=t.filterDate;return un(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return Ht(e,t)}))||s&&!s.some((function(t){return Ht(e,t)}))||i&&!i(Ot(e))||!1}function on(e,t,n,r){var a=Re.default(e),s=Ee.default(e),i=Re.default(t),o=Ee.default(t),l=Re.default(r);return a===i&&a===l?s<=n&&n<=o:a<i?l===a&&s<=n||l===i&&o>=n||l<i&&l>a:void 0}function ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate,a=t.excludeDates,s=t.includeDates,i=t.filterDate;return un(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return zt(e,t)}))||s&&!s.some((function(t){return zt(e,t)}))||i&&!i(Ot(e))||!1}function cn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate;return un(new Date(e,0,1),{minDate:n,maxDate:r})||!1}function dn(e,t,n,r){var a=Re.default(e),s=Oe.default(e),i=Re.default(t),o=Oe.default(t),l=Re.default(r);return a===i&&a===l?s<=n&&n<=o:a<i?l===a&&s<=n||l===i&&o>=n||l<i&&l>a:void 0}function un(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate;return n&&We.default(e,n)<0||r&&We.default(e,r)>0}function pn(e,t){return t.some((function(t){return Te.default(t)===Te.default(e)&&Ce.default(t)===Ce.default(e)}))}function mn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeTimes,r=t.includeTimes,a=t.filterTime;return n&&pn(e,n)||r&&!pn(e,r)||a&&!a(e)||!1}function hn(e,t){var n=t.minTime,r=t.maxTime;if(!n||!r)throw new Error("Both minTime and maxTime props required");var a,s=Ot(),i=Le.default(Me.default(s,Ce.default(e)),Te.default(e)),o=Le.default(Me.default(s,Ce.default(n)),Te.default(n)),l=Le.default(Me.default(s,Ce.default(r)),Te.default(r));try{a=!it.default(i,{start:o,end:l})}catch(e){a=!1}return a}function fn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.includeDates,a=je.default(e,1);return n&&Ye.default(n,a)>0||r&&r.every((function(e){return Ye.default(e,a)>0}))||!1}function gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.includeDates,a=we.default(e,1);return n&&Ye.default(a,n)>0||r&&r.every((function(e){return Ye.default(a,e)>0}))||!1}function vn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.includeDates,a=Ie.default(e,1);return n&&Be.default(n,a)>0||r&&r.every((function(e){return Be.default(e,a)>0}))||!1}function bn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.includeDates,a=xe.default(e,1);return n&&Be.default(a,n)>0||r&&r.every((function(e){return Be.default(a,e)>0}))||!1}function yn(e){var t=e.minDate,n=e.includeDates;if(n&&t){var r=n.filter((function(e){return We.default(e,t)>=0}));return Ue.default(r)}return n?Ue.default(n):t}function wn(e){var t=e.maxDate,n=e.includeDates;if(n&&t){var r=n.filter((function(e){return We.default(e,t)<=0}));return Ve.default(r)}return n?Ve.default(n):t}function xn(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"react-datepicker__day--highlighted",n=new Map,r=0,a=e.length;r<a;r++){var s=e[r];if(me.default(s)){var i=Pt(s,"MM.dd.yyyy"),o=n.get(i)||[];o.includes(t)||(o.push(t),n.set(i,o))}else if("object"===ht(s)){var l=Object.keys(s),c=l[0],d=s[l[0]];if("string"==typeof c&&d.constructor===Array)for(var u=0,p=d.length;u<p;u++){var m=Pt(d[u],"MM.dd.yyyy"),h=n.get(m)||[];h.includes(c)||(h.push(c),n.set(m,h))}}}return n}function _n(e,t,n,r,a){for(var s=a.length,i=[],o=0;o<s;o++){var l=ge.default(ve.default(e,Te.default(a[o])),Ce.default(a[o])),c=ge.default(e,(n+1)*r);at.default(l,t)&&st.default(l,c)&&i.push(a[o])}return i}function Zn(e){return e<10?"0".concat(e):"".concat(e)}function jn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Dt,n=Math.ceil(Re.default(e)/t)*t;return{startPeriod:n-(t-1),endPeriod:n}}function In(e,t,n,r){for(var a=[],s=0;s<2*t+1;s++){var i=e+t-s,o=!0;n&&(o=Re.default(n)<=i),r&&o&&(o=Re.default(r)>=i),o&&a.push(i)}return a}var Sn=function(e){wt(r,e);var n=It(r);function r(e){var a;ft(this,r),bt(Zt(a=n.call(this,e)),"renderOptions",(function(){var e=a.props.year,t=a.state.yearsList.map((function(t){return ue.default.createElement("div",{className:e===t?"react-datepicker__year-option react-datepicker__year-option--selected_year":"react-datepicker__year-option",key:t,onClick:a.onChange.bind(Zt(a),t),"aria-selected":e===t?"true":void 0},e===t?ue.default.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",t)})),n=a.props.minDate?Re.default(a.props.minDate):null,r=a.props.maxDate?Re.default(a.props.maxDate):null;return r&&a.state.yearsList.find((function(e){return e===r}))||t.unshift(ue.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:a.incrementYears},ue.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),n&&a.state.yearsList.find((function(e){return e===n}))||t.push(ue.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:a.decrementYears},ue.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t})),bt(Zt(a),"onChange",(function(e){a.props.onChange(e)})),bt(Zt(a),"handleClickOutside",(function(){a.props.onCancel()})),bt(Zt(a),"shiftYears",(function(e){var t=a.state.yearsList.map((function(t){return t+e}));a.setState({yearsList:t})})),bt(Zt(a),"incrementYears",(function(){return a.shiftYears(1)})),bt(Zt(a),"decrementYears",(function(){return a.shiftYears(-1)}));var s=e.yearDropdownItemNumber,i=e.scrollableYearDropdown,o=s||(i?10:5);return a.state={yearsList:In(a.props.year,o,a.props.minDate,a.props.maxDate)},a.dropdownRef=t.createRef(),a}return vt(r,[{key:"componentDidMount",value:function(){var e=this.dropdownRef.current;e&&(e.scrollTop=e.scrollHeight/2-e.clientHeight/2)}},{key:"render",value:function(){var e=pe.default({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return ue.default.createElement("div",{className:e,ref:this.dropdownRef},this.renderOptions())}}]),r}(ue.default.Component),Cn=dt.default(Sn),Tn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),bt(Zt(e),"renderSelectOptions",(function(){for(var t=e.props.minDate?Re.default(e.props.minDate):1900,n=e.props.maxDate?Re.default(e.props.maxDate):2100,r=[],a=t;a<=n;a++)r.push(ue.default.createElement("option",{key:a,value:a},a));return r})),bt(Zt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),bt(Zt(e),"renderSelectMode",(function(){return ue.default.createElement("select",{value:e.props.year,className:"react-datepicker__year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),bt(Zt(e),"renderReadView",(function(t){return ue.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__year-read-view",onClick:function(t){return e.toggleDropdown(t)}},ue.default.createElement("span",{className:"react-datepicker__year-read-view--down-arrow"}),ue.default.createElement("span",{className:"react-datepicker__year-read-view--selected-year"},e.props.year))})),bt(Zt(e),"renderDropdown",(function(){return ue.default.createElement(Cn,{key:"dropdown",year:e.props.year,onChange:e.onChange,onCancel:e.toggleDropdown,minDate:e.props.minDate,maxDate:e.props.maxDate,scrollableYearDropdown:e.props.scrollableYearDropdown,yearDropdownItemNumber:e.props.yearDropdownItemNumber})})),bt(Zt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),bt(Zt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.year&&e.props.onChange(t)})),bt(Zt(e),"toggleDropdown",(function(t){e.setState({dropdownVisible:!e.state.dropdownVisible},(function(){e.props.adjustDateOnChange&&e.handleYearChange(e.props.date,t)}))})),bt(Zt(e),"handleYearChange",(function(t,n){e.onSelect(t,n),e.setOpen()})),bt(Zt(e),"onSelect",(function(t,n){e.props.onSelect&&e.props.onSelect(t,n)})),bt(Zt(e),"setOpen",(function(){e.props.setOpen&&e.props.setOpen(!0)})),e}return vt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return ue.default.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(ue.default.Component),kn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"isSelectedMonth",(function(t){return e.props.month===t})),bt(Zt(e),"renderOptions",(function(){return e.props.monthNames.map((function(t,n){return ue.default.createElement("div",{className:e.isSelectedMonth(n)?"react-datepicker__month-option react-datepicker__month-option--selected_month":"react-datepicker__month-option",key:t,onClick:e.onChange.bind(Zt(e),n),"aria-selected":e.isSelectedMonth(n)?"true":void 0},e.isSelectedMonth(n)?ue.default.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",t)}))})),bt(Zt(e),"onChange",(function(t){return e.props.onChange(t)})),bt(Zt(e),"handleClickOutside",(function(){return e.props.onCancel()})),e}return vt(n,[{key:"render",value:function(){return ue.default.createElement("div",{className:"react-datepicker__month-dropdown"},this.renderOptions())}}]),n}(ue.default.Component),Nn=dt.default(kn),Dn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),bt(Zt(e),"renderSelectOptions",(function(e){return e.map((function(e,t){return ue.default.createElement("option",{key:t,value:t},e)}))})),bt(Zt(e),"renderSelectMode",(function(t){return ue.default.createElement("select",{value:e.props.month,className:"react-datepicker__month-select",onChange:function(t){return e.onChange(t.target.value)}},e.renderSelectOptions(t))})),bt(Zt(e),"renderReadView",(function(t,n){return ue.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__month-read-view",onClick:e.toggleDropdown},ue.default.createElement("span",{className:"react-datepicker__month-read-view--down-arrow"}),ue.default.createElement("span",{className:"react-datepicker__month-read-view--selected-month"},n[e.props.month]))})),bt(Zt(e),"renderDropdown",(function(t){return ue.default.createElement(Nn,{key:"dropdown",month:e.props.month,monthNames:t,onChange:e.onChange,onCancel:e.toggleDropdown})})),bt(Zt(e),"renderScrollMode",(function(t){var n=e.state.dropdownVisible,r=[e.renderReadView(!n,t)];return n&&r.unshift(e.renderDropdown(t)),r})),bt(Zt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.month&&e.props.onChange(t)})),bt(Zt(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return vt(n,[{key:"render",value:function(){var e,t=this,n=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(e){return tn(e,t.props.locale)}:function(e){return en(e,t.props.locale)});switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode(n);break;case"select":e=this.renderSelectMode(n)}return ue.default.createElement("div",{className:"react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(ue.default.Component);function En(e,t){for(var n=[],r=Vt(e),a=Vt(t);!at.default(r,a);)n.push(Ot(r)),r=we.default(r,1);return n}var On=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),bt(Zt(r=t.call(this,e)),"renderOptions",(function(){return r.state.monthYearsList.map((function(e){var t=Ae.default(e),n=Bt(r.props.date,e)&&Ht(r.props.date,e);return ue.default.createElement("div",{className:n?"react-datepicker__month-year-option--selected_month-year":"react-datepicker__month-year-option",key:t,onClick:r.onChange.bind(Zt(r),t),"aria-selected":n?"true":void 0},n?ue.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Pt(e,r.props.dateFormat,r.props.locale))}))})),bt(Zt(r),"onChange",(function(e){return r.props.onChange(e)})),bt(Zt(r),"handleClickOutside",(function(){r.props.onCancel()})),r.state={monthYearsList:En(r.props.minDate,r.props.maxDate)},r}return vt(n,[{key:"render",value:function(){var e=pe.default({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return ue.default.createElement("div",{className:e},this.renderOptions())}}]),n}(ue.default.Component),Rn=dt.default(On),An=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),bt(Zt(e),"renderSelectOptions",(function(){for(var t=Vt(e.props.minDate),n=Vt(e.props.maxDate),r=[];!at.default(t,n);){var a=Ae.default(t);r.push(ue.default.createElement("option",{key:a,value:a},Pt(t,e.props.dateFormat,e.props.locale))),t=we.default(t,1)}return r})),bt(Zt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),bt(Zt(e),"renderSelectMode",(function(){return ue.default.createElement("select",{value:Ae.default(Vt(e.props.date)),className:"react-datepicker__month-year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),bt(Zt(e),"renderReadView",(function(t){var n=Pt(e.props.date,e.props.dateFormat,e.props.locale);return ue.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__month-year-read-view",onClick:function(t){return e.toggleDropdown(t)}},ue.default.createElement("span",{className:"react-datepicker__month-year-read-view--down-arrow"}),ue.default.createElement("span",{className:"react-datepicker__month-year-read-view--selected-month-year"},n))})),bt(Zt(e),"renderDropdown",(function(){return ue.default.createElement(Rn,{key:"dropdown",date:e.props.date,dateFormat:e.props.dateFormat,onChange:e.onChange,onCancel:e.toggleDropdown,minDate:e.props.minDate,maxDate:e.props.maxDate,scrollableMonthYearDropdown:e.props.scrollableMonthYearDropdown,locale:e.props.locale})})),bt(Zt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),bt(Zt(e),"onChange",(function(t){e.toggleDropdown();var n=Ot(parseInt(t));Bt(e.props.date,n)&&Ht(e.props.date,n)||e.props.onChange(n)})),bt(Zt(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return vt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return ue.default.createElement("div",{className:"react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(ue.default.Component),Pn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"dayEl",ue.default.createRef()),bt(Zt(e),"handleClick",(function(t){!e.isDisabled()&&e.props.onClick&&e.props.onClick(t)})),bt(Zt(e),"handleMouseEnter",(function(t){!e.isDisabled()&&e.props.onMouseEnter&&e.props.onMouseEnter(t)})),bt(Zt(e),"handleOnKeyDown",(function(t){" "===t.key&&(t.preventDefault(),t.key="Enter"),e.props.handleOnKeyDown(t)})),bt(Zt(e),"isSameDay",(function(t){return Kt(e.props.day,t)})),bt(Zt(e),"isKeyboardSelected",(function(){return!e.props.disabledKeyboardNavigation&&!e.isSameDay(e.props.selected)&&e.isSameDay(e.props.preSelection)})),bt(Zt(e),"isDisabled",(function(){return rn(e.props.day,e.props)})),bt(Zt(e),"isExcluded",(function(){return an(e.props.day,e.props)})),bt(Zt(e),"getHighLightedClass",(function(t){var n=e.props,r=n.day,a=n.highlightDates;if(!a)return!1;var s=Pt(r,"MM.dd.yyyy");return a.get(s)})),bt(Zt(e),"isInRange",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&Qt(n,r,a)})),bt(Zt(e),"isInSelectingRange",(function(){var t,n=e.props,r=n.day,a=n.selectsStart,s=n.selectsEnd,i=n.selectsRange,o=n.selectsDisabledDaysInRange,l=n.startDate,c=n.endDate,d=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return!(!(a||s||i)||!d||!o&&e.isDisabled())&&(a&&c&&(st.default(d,c)||Gt(d,c))?Qt(r,d,c):(s&&l&&(at.default(d,l)||Gt(d,l))||!(!i||!l||c||!at.default(d,l)&&!Gt(d,l)))&&Qt(r,l,d))})),bt(Zt(e),"isSelectingRangeStart",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,r=n.day,a=n.startDate,s=n.selectsStart,i=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Kt(r,s?i:a)})),bt(Zt(e),"isSelectingRangeEnd",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,r=n.day,a=n.endDate,s=n.selectsEnd,i=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Kt(r,s?i:a)})),bt(Zt(e),"isRangeStart",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&Kt(r,n)})),bt(Zt(e),"isRangeEnd",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&Kt(a,n)})),bt(Zt(e),"isWeekend",(function(){var t=ke.default(e.props.day);return 0===t||6===t})),bt(Zt(e),"isAfterMonth",(function(){return void 0!==e.props.month&&(e.props.month+1)%12===Ee.default(e.props.day)})),bt(Zt(e),"isBeforeMonth",(function(){return void 0!==e.props.month&&(Ee.default(e.props.day)+1)%12===e.props.month})),bt(Zt(e),"isCurrentDay",(function(){return e.isSameDay(Ot())})),bt(Zt(e),"isSelected",(function(){return e.isSameDay(e.props.selected)})),bt(Zt(e),"getClassNames",(function(t){var n=e.props.dayClassName?e.props.dayClassName(t):void 0;return pe.default("react-datepicker__day",n,"react-datepicker__day--"+qt(e.props.day),{"react-datepicker__day--disabled":e.isDisabled(),"react-datepicker__day--excluded":e.isExcluded(),"react-datepicker__day--selected":e.isSelected(),"react-datepicker__day--keyboard-selected":e.isKeyboardSelected(),"react-datepicker__day--range-start":e.isRangeStart(),"react-datepicker__day--range-end":e.isRangeEnd(),"react-datepicker__day--in-range":e.isInRange(),"react-datepicker__day--in-selecting-range":e.isInSelectingRange(),"react-datepicker__day--selecting-range-start":e.isSelectingRangeStart(),"react-datepicker__day--selecting-range-end":e.isSelectingRangeEnd(),"react-datepicker__day--today":e.isCurrentDay(),"react-datepicker__day--weekend":e.isWeekend(),"react-datepicker__day--outside-month":e.isAfterMonth()||e.isBeforeMonth()},e.getHighLightedClass("react-datepicker__day--highlighted"))})),bt(Zt(e),"getAriaLabel",(function(){var t=e.props,n=t.day,r=t.ariaLabelPrefixWhenEnabled,a=void 0===r?"Choose":r,s=t.ariaLabelPrefixWhenDisabled,i=void 0===s?"Not available":s,o=e.isDisabled()||e.isExcluded()?i:a;return"".concat(o," ").concat(Pt(n,"PPPP",e.props.locale))})),bt(Zt(e),"getTabIndex",(function(t,n){var r=t||e.props.selected,a=n||e.props.preSelection;return e.isKeyboardSelected()||e.isSameDay(r)&&Kt(a,r)?0:-1})),bt(Zt(e),"handleFocusDay",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1;0===e.getTabIndex()&&!t.isInputFocused&&e.isSameDay(e.props.preSelection)&&(document.activeElement&&document.activeElement!==document.body||(n=!0),e.props.inline&&!e.props.shouldFocusDayInline&&(n=!1),e.props.containerRef&&e.props.containerRef.current&&e.props.containerRef.current.contains(document.activeElement)&&document.activeElement.classList.contains("react-datepicker__day")&&(n=!0)),n&&e.dayEl.current.focus({preventScroll:!0})})),bt(Zt(e),"renderDayContents",(function(){return e.props.monthShowsDuplicateDaysEnd&&e.isAfterMonth()||e.props.monthShowsDuplicateDaysStart&&e.isBeforeMonth()?null:e.props.renderDayContents?e.props.renderDayContents(Ne.default(e.props.day),e.props.day):Ne.default(e.props.day)})),bt(Zt(e),"render",(function(){return ue.default.createElement("div",{ref:e.dayEl,className:e.getClassNames(e.props.day),onKeyDown:e.handleOnKeyDown,onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,tabIndex:e.getTabIndex(),"aria-label":e.getAriaLabel(),role:"button","aria-disabled":e.isDisabled(),"aria-current":e.isCurrentDay()?"date":void 0,"aria-selected":e.isSelected()?"true":void 0},e.renderDayContents())})),e}return vt(n,[{key:"componentDidMount",value:function(){this.handleFocusDay()}},{key:"componentDidUpdate",value:function(e){this.handleFocusDay(e)}}]),n}(ue.default.Component),Mn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"handleClick",(function(t){e.props.onClick&&e.props.onClick(t)})),e}return vt(n,[{key:"render",value:function(){var e=this.props,t=e.weekNumber,n=e.ariaLabelPrefix,r=void 0===n?"week ":n,a={"react-datepicker__week-number":!0,"react-datepicker__week-number--clickable":!!e.onClick};return ue.default.createElement("div",{className:pe.default(a),"aria-label":"".concat(r," ").concat(this.props.weekNumber),onClick:this.handleClick},t)}}]),n}(ue.default.Component),Ln=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n)})),bt(Zt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),bt(Zt(e),"handleWeekClick",(function(t,n,r){"function"==typeof e.props.onWeekSelect&&e.props.onWeekSelect(t,n,r),e.props.shouldCloseOnSelect&&e.props.setOpen(!1)})),bt(Zt(e),"formatWeekNumber",(function(t){return e.props.formatWeekNumber?e.props.formatWeekNumber(t):Ft(t)})),bt(Zt(e),"renderDays",(function(){var t=Ut(e.props.day,e.props.locale,e.props.calendarStartDay),n=[],r=e.formatWeekNumber(t);if(e.props.showWeekNumber){var a=e.props.onWeekSelect?e.handleWeekClick.bind(Zt(e),t,r):void 0;n.push(ue.default.createElement(Mn,{key:"W",weekNumber:r,onClick:a,ariaLabelPrefix:e.props.ariaLabelPrefix}))}return n.concat([0,1,2,3,4,5,6].map((function(n){var r=be.default(t,n);return ue.default.createElement(Pn,{ariaLabelPrefixWhenEnabled:e.props.chooseDayAriaLabelPrefix,ariaLabelPrefixWhenDisabled:e.props.disabledDayAriaLabelPrefix,key:r.valueOf(),day:r,month:e.props.month,onClick:e.handleDayClick.bind(Zt(e),r),onMouseEnter:e.handleDayMouseEnter.bind(Zt(e),r),minDate:e.props.minDate,maxDate:e.props.maxDate,excludeDates:e.props.excludeDates,excludeDateIntervals:e.props.excludeDateIntervals,includeDates:e.props.includeDates,includeDateIntervals:e.props.includeDateIntervals,highlightDates:e.props.highlightDates,selectingDate:e.props.selectingDate,filterDate:e.props.filterDate,preSelection:e.props.preSelection,selected:e.props.selected,selectsStart:e.props.selectsStart,selectsEnd:e.props.selectsEnd,selectsRange:e.props.selectsRange,selectsDisabledDaysInRange:e.props.selectsDisabledDaysInRange,startDate:e.props.startDate,endDate:e.props.endDate,dayClassName:e.props.dayClassName,renderDayContents:e.props.renderDayContents,disabledKeyboardNavigation:e.props.disabledKeyboardNavigation,handleOnKeyDown:e.props.handleOnKeyDown,isInputFocused:e.props.isInputFocused,containerRef:e.props.containerRef,inline:e.props.inline,shouldFocusDayInline:e.props.shouldFocusDayInline,monthShowsDuplicateDaysEnd:e.props.monthShowsDuplicateDaysEnd,monthShowsDuplicateDaysStart:e.props.monthShowsDuplicateDaysStart,locale:e.props.locale})})))})),e}return vt(n,[{key:"render",value:function(){return ue.default.createElement("div",{className:"react-datepicker__week"},this.renderDays())}}],[{key:"defaultProps",get:function(){return{shouldCloseOnSelect:!0}}}]),n}(ue.default.Component),Fn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"MONTH_REFS",St(Array(12)).map((function(){return ue.default.createRef()}))),bt(Zt(e),"isDisabled",(function(t){return rn(t,e.props)})),bt(Zt(e),"isExcluded",(function(t){return an(t,e.props)})),bt(Zt(e),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n,e.props.orderInDisplay)})),bt(Zt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),bt(Zt(e),"handleMouseLeave",(function(){e.props.onMouseLeave&&e.props.onMouseLeave()})),bt(Zt(e),"isRangeStartMonth",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Ht(Fe.default(r,t),a)})),bt(Zt(e),"isRangeStartQuarter",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&zt(qe.default(r,t),a)})),bt(Zt(e),"isRangeEndMonth",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Ht(Fe.default(r,t),s)})),bt(Zt(e),"isRangeEndQuarter",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&zt(qe.default(r,t),s)})),bt(Zt(e),"isWeekInMonth",(function(t){var n=e.props.day,r=be.default(t,6);return Ht(t,n)||Ht(r,n)})),bt(Zt(e),"isCurrentMonth",(function(e,t){return Re.default(e)===Re.default(Ot())&&t===Ee.default(Ot())})),bt(Zt(e),"isSelectedMonth",(function(e,t,n){return Ee.default(e)===t&&Re.default(e)===Re.default(n)})),bt(Zt(e),"isSelectedQuarter",(function(e,t,n){return Oe.default(e)===t&&Re.default(e)===Re.default(n)})),bt(Zt(e),"renderWeeks",(function(){for(var t=[],n=e.props.fixedHeight,r=0,a=!1,s=Ut(Vt(e.props.day),e.props.locale,e.props.calendarStartDay);t.push(ue.default.createElement(Ln,{ariaLabelPrefix:e.props.weekAriaLabelPrefix,chooseDayAriaLabelPrefix:e.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:e.props.disabledDayAriaLabelPrefix,key:r,day:s,month:Ee.default(e.props.day),onDayClick:e.handleDayClick,onDayMouseEnter:e.handleDayMouseEnter,onWeekSelect:e.props.onWeekSelect,formatWeekNumber:e.props.formatWeekNumber,locale:e.props.locale,minDate:e.props.minDate,maxDate:e.props.maxDate,excludeDates:e.props.excludeDates,excludeDateIntervals:e.props.excludeDateIntervals,includeDates:e.props.includeDates,includeDateIntervals:e.props.includeDateIntervals,inline:e.props.inline,shouldFocusDayInline:e.props.shouldFocusDayInline,highlightDates:e.props.highlightDates,selectingDate:e.props.selectingDate,filterDate:e.props.filterDate,preSelection:e.props.preSelection,selected:e.props.selected,selectsStart:e.props.selectsStart,selectsEnd:e.props.selectsEnd,selectsRange:e.props.selectsRange,selectsDisabledDaysInRange:e.props.selectsDisabledDaysInRange,showWeekNumber:e.props.showWeekNumbers,startDate:e.props.startDate,endDate:e.props.endDate,dayClassName:e.props.dayClassName,setOpen:e.props.setOpen,shouldCloseOnSelect:e.props.shouldCloseOnSelect,disabledKeyboardNavigation:e.props.disabledKeyboardNavigation,renderDayContents:e.props.renderDayContents,handleOnKeyDown:e.props.handleOnKeyDown,isInputFocused:e.props.isInputFocused,containerRef:e.props.containerRef,calendarStartDay:e.props.calendarStartDay,monthShowsDuplicateDaysEnd:e.props.monthShowsDuplicateDaysEnd,monthShowsDuplicateDaysStart:e.props.monthShowsDuplicateDaysStart})),!a;){r++,s=ye.default(s,1);var i=n&&r>=6,o=!n&&!e.isWeekInMonth(s);if(i||o){if(!e.props.peekNextMonth)break;a=!0}}return t})),bt(Zt(e),"onMonthClick",(function(t,n){e.handleDayClick(Vt(Fe.default(e.props.day,n)),t)})),bt(Zt(e),"handleMonthNavigation",(function(t,n){e.isDisabled(n)||e.isExcluded(n)||(e.props.setPreSelection(n),e.MONTH_REFS[t].current&&e.MONTH_REFS[t].current.focus())})),bt(Zt(e),"onMonthKeyDown",(function(t,n){var r=t.key;if(!e.props.disabledKeyboardNavigation)switch(r){case"Enter":e.onMonthClick(t,n),e.props.setPreSelection(e.props.selected);break;case"ArrowRight":e.handleMonthNavigation(11===n?0:n+1,we.default(e.props.preSelection,1));break;case"ArrowLeft":e.handleMonthNavigation(0===n?11:n-1,je.default(e.props.preSelection,1))}})),bt(Zt(e),"onQuarterClick",(function(t,n){e.handleDayClick(Yt(qe.default(e.props.day,n)),t)})),bt(Zt(e),"getMonthClassNames",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate,i=n.selected,o=n.minDate,l=n.maxDate,c=n.preSelection,d=n.monthClassName,u=d?d(r):void 0;return pe.default("react-datepicker__month-text","react-datepicker__month-".concat(t),u,{"react-datepicker__month--disabled":(o||l)&&sn(Fe.default(r,t),e.props),"react-datepicker__month--selected":e.isSelectedMonth(r,t,i),"react-datepicker__month-text--keyboard-selected":Ee.default(c)===t,"react-datepicker__month--in-range":on(a,s,t,r),"react-datepicker__month--range-start":e.isRangeStartMonth(t),"react-datepicker__month--range-end":e.isRangeEndMonth(t),"react-datepicker__month-text--today":e.isCurrentMonth(r,t)})})),bt(Zt(e),"getTabIndex",(function(t){var n=Ee.default(e.props.preSelection);return e.props.disabledKeyboardNavigation||t!==n?"-1":"0"})),bt(Zt(e),"getAriaLabel",(function(t){var n=e.props,r=n.ariaLabelPrefix,a=void 0===r?"Choose":r,s=n.disabledDayAriaLabelPrefix,i=void 0===s?"Not available":s,o=n.day,l=Fe.default(o,t),c=e.isDisabled(l)||e.isExcluded(l)?i:a;return"".concat(c," ").concat(Pt(l,"MMMM yyyy"))})),bt(Zt(e),"getQuarterClassNames",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate,i=n.selected,o=n.minDate,l=n.maxDate;return pe.default("react-datepicker__quarter-text","react-datepicker__quarter-".concat(t),{"react-datepicker__quarter--disabled":(o||l)&&ln(qe.default(r,t),e.props),"react-datepicker__quarter--selected":e.isSelectedQuarter(r,t,i),"react-datepicker__quarter--in-range":dn(a,s,t,r),"react-datepicker__quarter--range-start":e.isRangeStartQuarter(t),"react-datepicker__quarter--range-end":e.isRangeEndQuarter(t)})})),bt(Zt(e),"renderMonths",(function(){var t=e.props,n=t.showFullMonthYearPicker,r=t.showTwoColumnMonthYearPicker,a=t.showFourColumnMonthYearPicker,s=t.locale,i=t.day,o=t.selected;return(a?[[0,1,2,3],[4,5,6,7],[8,9,10,11]]:r?[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11]]:[[0,1,2],[3,4,5],[6,7,8],[9,10,11]]).map((function(t,r){return ue.default.createElement("div",{className:"react-datepicker__month-wrapper",key:r},t.map((function(t,r){return ue.default.createElement("div",{ref:e.MONTH_REFS[t],key:r,onClick:function(n){e.onMonthClick(n,t)},onKeyDown:function(n){e.onMonthKeyDown(n,t)},tabIndex:e.getTabIndex(t),className:e.getMonthClassNames(t),role:"button","aria-label":e.getAriaLabel(t),"aria-current":e.isCurrentMonth(i,t)?"date":void 0,"aria-selected":e.isSelectedMonth(i,t,o)?"true":void 0},n?en(t,s):tn(t,s))})))}))})),bt(Zt(e),"renderQuarters",(function(){var t=e.props,n=t.day,r=t.selected;return ue.default.createElement("div",{className:"react-datepicker__quarter-wrapper"},[1,2,3,4].map((function(t,a){return ue.default.createElement("div",{key:a,onClick:function(n){e.onQuarterClick(n,t)},className:e.getQuarterClassNames(t),"aria-selected":e.isSelectedQuarter(n,t,r)?"true":void 0},nn(t,e.props.locale))})))})),bt(Zt(e),"getClassNames",(function(){var t=e.props;t.day;var n=t.selectingDate,r=t.selectsStart,a=t.selectsEnd,s=t.showMonthYearPicker,i=t.showQuarterYearPicker;return pe.default("react-datepicker__month",{"react-datepicker__month--selecting-range":n&&(r||a)},{"react-datepicker__monthPicker":s},{"react-datepicker__quarterPicker":i})})),e}return vt(n,[{key:"render",value:function(){var e=this.props,t=e.showMonthYearPicker,n=e.showQuarterYearPicker,r=e.day,a=e.ariaLabelPrefix,s=void 0===a?"month ":a;return ue.default.createElement("div",{className:this.getClassNames(),onMouseLeave:this.handleMouseLeave,"aria-label":"".concat(s," ").concat(Pt(r,"yyyy-MM"))},t?this.renderMonths():n?this.renderQuarters():this.renderWeeks())}}]),n}(ue.default.Component),qn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"state",{height:null}),bt(Zt(e),"handleClick",(function(t){(e.props.minTime||e.props.maxTime)&&hn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&mn(t,e.props)||e.props.onChange(t)})),bt(Zt(e),"isSelectedTime",(function(t,n,r){return e.props.selected&&n===Te.default(t)&&r===Ce.default(t)})),bt(Zt(e),"liClasses",(function(t,n,r){var a=["react-datepicker__time-list-item",e.props.timeClassName?e.props.timeClassName(t,n,r):void 0];return e.isSelectedTime(t,n,r)&&a.push("react-datepicker__time-list-item--selected"),((e.props.minTime||e.props.maxTime)&&hn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&mn(t,e.props))&&a.push("react-datepicker__time-list-item--disabled"),e.props.injectTimes&&(60*Te.default(t)+Ce.default(t))%e.props.intervals!=0&&a.push("react-datepicker__time-list-item--injected"),a.join(" ")})),bt(Zt(e),"handleOnKeyDown",(function(t,n){" "===t.key&&(t.preventDefault(),t.key="Enter"),"Enter"===t.key&&e.handleClick(n),e.props.handleOnKeyDown(t)})),bt(Zt(e),"renderTimes",(function(){for(var t=[],n=e.props.format?e.props.format:"p",r=e.props.intervals,a=$t(Ot(e.props.selected)),s=1440/r,i=e.props.injectTimes&&e.props.injectTimes.sort((function(e,t){return e-t})),o=e.props.selected||e.props.openToDate||Ot(),l=Te.default(o),c=Ce.default(o),d=Le.default(Me.default(a,c),l),u=0;u<s;u++){var p=ge.default(a,u*r);if(t.push(p),i){var m=_n(a,p,u,r,i);t=t.concat(m)}}return t.map((function(t,r){return ue.default.createElement("li",{key:r,onClick:e.handleClick.bind(Zt(e),t),className:e.liClasses(t,l,c),ref:function(n){(st.default(t,d)||Gt(t,d))&&(e.centerLi=n)},onKeyDown:function(n){e.handleOnKeyDown(n,t)},tabIndex:"0","aria-selected":e.isSelectedTime(t,l,c)?"true":void 0},Pt(t,n,e.props.locale))}))})),e}return vt(n,[{key:"componentDidMount",value:function(){this.list.scrollTop=n.calcCenterPosition(this.props.monthRef?this.props.monthRef.clientHeight-this.header.clientHeight:this.list.clientHeight,this.centerLi),this.props.monthRef&&this.header&&this.setState({height:this.props.monthRef.clientHeight-this.header.clientHeight})}},{key:"render",value:function(){var e=this,t=this.state.height;return ue.default.createElement("div",{className:"react-datepicker__time-container ".concat(this.props.todayButton?"react-datepicker__time-container--with-today-button":"")},ue.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--time ".concat(this.props.showTimeSelectOnly?"react-datepicker__header--time--only":""),ref:function(t){e.header=t}},ue.default.createElement("div",{className:"react-datepicker-time__header"},this.props.timeCaption)),ue.default.createElement("div",{className:"react-datepicker__time"},ue.default.createElement("div",{className:"react-datepicker__time-box"},ue.default.createElement("ul",{className:"react-datepicker__time-list",ref:function(t){e.list=t},style:t?{height:t}:{},tabIndex:"0"},this.renderTimes()))))}}],[{key:"defaultProps",get:function(){return{intervals:30,onTimeChange:function(){},todayButton:null,timeCaption:"Time"}}}]),n}(ue.default.Component);bt(qn,"calcCenterPosition",(function(e,t){return t.offsetTop-(e/2-t.clientHeight/2)}));var $n=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),bt(Zt(r=t.call(this,e)),"YEAR_REFS",St(Array(r.props.yearItemNumber)).map((function(){return ue.default.createRef()}))),bt(Zt(r),"isDisabled",(function(e){return rn(e,r.props)})),bt(Zt(r),"isExcluded",(function(e){return an(e,r.props)})),bt(Zt(r),"updateFocusOnPaginate",(function(e){var t=function(){this.YEAR_REFS[e].current.focus()}.bind(Zt(r));window.requestAnimationFrame(t)})),bt(Zt(r),"handleYearClick",(function(e,t){r.props.onDayClick&&r.props.onDayClick(e,t)})),bt(Zt(r),"handleYearNavigation",(function(e,t){var n=r.props,a=n.date,s=n.yearItemNumber,i=jn(a,s).startPeriod;r.isDisabled(t)||r.isExcluded(t)||(r.props.setPreSelection(t),e-i==-1?r.updateFocusOnPaginate(s-1):e-i===s?r.updateFocusOnPaginate(0):r.YEAR_REFS[e-i].current.focus())})),bt(Zt(r),"isSameDay",(function(e,t){return Kt(e,t)})),bt(Zt(r),"isCurrentYear",(function(e){return e===Re.default(Ot())})),bt(Zt(r),"isKeyboardSelected",(function(e){var t=Wt($e.default(r.props.date,e));return!r.props.disabledKeyboardNavigation&&!r.props.inline&&!Kt(t,Wt(r.props.selected))&&Kt(t,Wt(r.props.preSelection))})),bt(Zt(r),"onYearClick",(function(e,t){var n=r.props.date;r.handleYearClick(Wt($e.default(n,t)),e)})),bt(Zt(r),"onYearKeyDown",(function(e,t){var n=e.key;if(!r.props.disabledKeyboardNavigation)switch(n){case"Enter":r.onYearClick(e,t),r.props.setPreSelection(r.props.selected);break;case"ArrowRight":r.handleYearNavigation(t+1,xe.default(r.props.preSelection,1));break;case"ArrowLeft":r.handleYearNavigation(t-1,Ie.default(r.props.preSelection,1))}})),bt(Zt(r),"getYearClassNames",(function(e){var t=r.props,n=t.minDate,a=t.maxDate,s=t.selected;return pe.default("react-datepicker__year-text",{"react-datepicker__year-text--selected":e===Re.default(s),"react-datepicker__year-text--disabled":(n||a)&&cn(e,r.props),"react-datepicker__year-text--keyboard-selected":r.isKeyboardSelected(e),"react-datepicker__year-text--today":r.isCurrentYear(e)})})),bt(Zt(r),"getYearTabIndex",(function(e){return r.props.disabledKeyboardNavigation?"-1":e===Re.default(r.props.preSelection)?"0":"-1"})),r}return vt(n,[{key:"render",value:function(){for(var e=this,t=[],n=this.props,r=jn(n.date,n.yearItemNumber),a=r.startPeriod,s=r.endPeriod,i=function(n){t.push(ue.default.createElement("div",{ref:e.YEAR_REFS[n-a],onClick:function(t){e.onYearClick(t,n)},onKeyDown:function(t){e.onYearKeyDown(t,n)},tabIndex:e.getYearTabIndex(n),className:e.getYearClassNames(n),key:n,"aria-current":e.isCurrentYear(n)?"date":void 0},n))},o=a;o<=s;o++)i(o);return ue.default.createElement("div",{className:"react-datepicker__year"},ue.default.createElement("div",{className:"react-datepicker__year-wrapper"},t))}}]),n}(ue.default.Component),Un=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),bt(Zt(r=t.call(this,e)),"onTimeChange",(function(e){r.setState({time:e});var t=new Date;t.setHours(e.split(":")[0]),t.setMinutes(e.split(":")[1]),r.props.onChange(t)})),bt(Zt(r),"renderTimeInput",(function(){var e=r.state.time,t=r.props,n=t.date,a=t.timeString,s=t.customTimeInput;return s?ue.default.cloneElement(s,{date:n,value:e,onChange:r.onTimeChange}):ue.default.createElement("input",{type:"time",className:"react-datepicker-time__input",placeholder:"Time",name:"time-input",required:!0,value:e,onChange:function(e){r.onTimeChange(e.target.value||a)}})})),r.state={time:r.props.timeString},r}return vt(n,[{key:"render",value:function(){return ue.default.createElement("div",{className:"react-datepicker__input-time-container"},ue.default.createElement("div",{className:"react-datepicker-time__caption"},this.props.timeInputLabel),ue.default.createElement("div",{className:"react-datepicker-time__input-container"},ue.default.createElement("div",{className:"react-datepicker-time__input"},this.renderTimeInput())))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return e.timeString!==t.time?{time:e.timeString}:null}}]),n}(ue.default.Component);function Vn(e){var t=e.className,n=e.children,r=e.showPopperArrow,a=e.arrowProps,s=void 0===a?{}:a;return ue.default.createElement("div",{className:t},r&&ue.default.createElement("div",yt({className:"react-datepicker__triangle"},s)),n)}var Wn=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],Yn=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),bt(Zt(r=t.call(this,e)),"handleClickOutside",(function(e){r.props.onClickOutside(e)})),bt(Zt(r),"setClickOutsideRef",(function(){return r.containerRef.current})),bt(Zt(r),"handleDropdownFocus",(function(e){(function(){var e=((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).className||"").split(/\s+/);return Wn.some((function(t){return e.indexOf(t)>=0}))})(e.target)&&r.props.onDropdownFocus()})),bt(Zt(r),"getDateInView",(function(){var e=r.props,t=e.preSelection,n=e.selected,a=e.openToDate,s=yn(r.props),i=wn(r.props),o=Ot();return a||n||t||(s&&st.default(o,s)?s:i&&at.default(o,i)?i:o)})),bt(Zt(r),"increaseMonth",(function(){r.setState((function(e){var t=e.date;return{date:we.default(t,1)}}),(function(){return r.handleMonthChange(r.state.date)}))})),bt(Zt(r),"decreaseMonth",(function(){r.setState((function(e){var t=e.date;return{date:je.default(t,1)}}),(function(){return r.handleMonthChange(r.state.date)}))})),bt(Zt(r),"handleDayClick",(function(e,t,n){r.props.onSelect(e,t,n),r.props.setPreSelection&&r.props.setPreSelection(e)})),bt(Zt(r),"handleDayMouseEnter",(function(e){r.setState({selectingDate:e}),r.props.onDayMouseEnter&&r.props.onDayMouseEnter(e)})),bt(Zt(r),"handleMonthMouseLeave",(function(){r.setState({selectingDate:null}),r.props.onMonthMouseLeave&&r.props.onMonthMouseLeave()})),bt(Zt(r),"handleYearChange",(function(e){r.props.onYearChange&&r.props.onYearChange(e),r.props.adjustDateOnChange&&(r.props.onSelect&&r.props.onSelect(e),r.props.setOpen&&r.props.setOpen(!0)),r.props.setPreSelection&&r.props.setPreSelection(e)})),bt(Zt(r),"handleMonthChange",(function(e){r.props.onMonthChange&&r.props.onMonthChange(e),r.props.adjustDateOnChange&&(r.props.onSelect&&r.props.onSelect(e),r.props.setOpen&&r.props.setOpen(!0)),r.props.setPreSelection&&r.props.setPreSelection(e)})),bt(Zt(r),"handleMonthYearChange",(function(e){r.handleYearChange(e),r.handleMonthChange(e)})),bt(Zt(r),"changeYear",(function(e){r.setState((function(t){var n=t.date;return{date:$e.default(n,e)}}),(function(){return r.handleYearChange(r.state.date)}))})),bt(Zt(r),"changeMonth",(function(e){r.setState((function(t){var n=t.date;return{date:Fe.default(n,e)}}),(function(){return r.handleMonthChange(r.state.date)}))})),bt(Zt(r),"changeMonthYear",(function(e){r.setState((function(t){var n=t.date;return{date:$e.default(Fe.default(n,Ee.default(e)),Re.default(e))}}),(function(){return r.handleMonthYearChange(r.state.date)}))})),bt(Zt(r),"header",(function(){var e=Ut(arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.state.date,r.props.locale,r.props.calendarStartDay),t=[];return r.props.showWeekNumbers&&t.push(ue.default.createElement("div",{key:"W",className:"react-datepicker__day-name"},r.props.weekLabel||"#")),t.concat([0,1,2,3,4,5,6].map((function(t){var n=be.default(e,t),a=r.formatWeekday(n,r.props.locale),s=r.props.weekDayClassName?r.props.weekDayClassName(n):void 0;return ue.default.createElement("div",{key:t,className:pe.default("react-datepicker__day-name",s)},a)})))})),bt(Zt(r),"formatWeekday",(function(e,t){return r.props.formatWeekDay?function(e,t,n){return t(Pt(e,"EEEE",n))}(e,r.props.formatWeekDay,t):r.props.useWeekdaysShort?function(e,t){return Pt(e,"EEE",t)}(e,t):function(e,t){return Pt(e,"EEEEEE",t)}(e,t)})),bt(Zt(r),"decreaseYear",(function(){r.setState((function(e){var t=e.date;return{date:Ie.default(t,r.props.showYearPicker?r.props.yearItemNumber:1)}}),(function(){return r.handleYearChange(r.state.date)}))})),bt(Zt(r),"renderPreviousButton",(function(){if(!r.props.renderCustomHeader){var e;switch(!0){case r.props.showMonthYearPicker:e=vn(r.state.date,r.props);break;case r.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.yearItemNumber,a=void 0===r?Dt:r,s=jn(Wt(Ie.default(e,a)),a).endPeriod,i=n&&Re.default(n);return i&&i>s||!1}(r.state.date,r.props);break;default:e=fn(r.state.date,r.props)}if((r.props.forceShowMonthNavigation||r.props.showDisabledMonthNavigation||!e)&&!r.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--previous"],n=r.decreaseMonth;(r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker)&&(n=r.decreaseYear),e&&r.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--previous--disabled"),n=null);var a=r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker,s=r.props,i=s.previousMonthButtonLabel,o=s.previousYearButtonLabel,l=r.props,c=l.previousMonthAriaLabel,d=void 0===c?"string"==typeof i?i:"Previous Month":c,u=l.previousYearAriaLabel,p=void 0===u?"string"==typeof o?o:"Previous Year":u;return ue.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:r.props.handleOnKeyDown,"aria-label":a?p:d},ue.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"].join(" ")},a?r.props.previousYearButtonLabel:r.props.previousMonthButtonLabel))}}})),bt(Zt(r),"increaseYear",(function(){r.setState((function(e){var t=e.date;return{date:xe.default(t,r.props.showYearPicker?r.props.yearItemNumber:1)}}),(function(){return r.handleYearChange(r.state.date)}))})),bt(Zt(r),"renderNextButton",(function(){if(!r.props.renderCustomHeader){var e;switch(!0){case r.props.showMonthYearPicker:e=bn(r.state.date,r.props);break;case r.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.yearItemNumber,a=void 0===r?Dt:r,s=jn(xe.default(e,a),a).startPeriod,i=n&&Re.default(n);return i&&i<s||!1}(r.state.date,r.props);break;default:e=gn(r.state.date,r.props)}if((r.props.forceShowMonthNavigation||r.props.showDisabledMonthNavigation||!e)&&!r.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--next"];r.props.showTimeSelect&&t.push("react-datepicker__navigation--next--with-time"),r.props.todayButton&&t.push("react-datepicker__navigation--next--with-today-button");var n=r.increaseMonth;(r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker)&&(n=r.increaseYear),e&&r.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--next--disabled"),n=null);var a=r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker,s=r.props,i=s.nextMonthButtonLabel,o=s.nextYearButtonLabel,l=r.props,c=l.nextMonthAriaLabel,d=void 0===c?"string"==typeof i?i:"Next Month":c,u=l.nextYearAriaLabel,p=void 0===u?"string"==typeof o?o:"Next Year":u;return ue.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:r.props.handleOnKeyDown,"aria-label":a?p:d},ue.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"].join(" ")},a?r.props.nextYearButtonLabel:r.props.nextMonthButtonLabel))}}})),bt(Zt(r),"renderCurrentMonth",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.state.date,t=["react-datepicker__current-month"];return r.props.showYearDropdown&&t.push("react-datepicker__current-month--hasYearDropdown"),r.props.showMonthDropdown&&t.push("react-datepicker__current-month--hasMonthDropdown"),r.props.showMonthYearDropdown&&t.push("react-datepicker__current-month--hasMonthYearDropdown"),ue.default.createElement("div",{className:t.join(" ")},Pt(e,r.props.dateFormat,r.props.locale))})),bt(Zt(r),"renderYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showYearDropdown&&!e)return ue.default.createElement(Tn,{adjustDateOnChange:r.props.adjustDateOnChange,date:r.state.date,onSelect:r.props.onSelect,setOpen:r.props.setOpen,dropdownMode:r.props.dropdownMode,onChange:r.changeYear,minDate:r.props.minDate,maxDate:r.props.maxDate,year:Re.default(r.state.date),scrollableYearDropdown:r.props.scrollableYearDropdown,yearDropdownItemNumber:r.props.yearDropdownItemNumber})})),bt(Zt(r),"renderMonthDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showMonthDropdown&&!e)return ue.default.createElement(Dn,{dropdownMode:r.props.dropdownMode,locale:r.props.locale,onChange:r.changeMonth,month:Ee.default(r.state.date),useShortMonthInDropdown:r.props.useShortMonthInDropdown})})),bt(Zt(r),"renderMonthYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showMonthYearDropdown&&!e)return ue.default.createElement(An,{dropdownMode:r.props.dropdownMode,locale:r.props.locale,dateFormat:r.props.dateFormat,onChange:r.changeMonthYear,minDate:r.props.minDate,maxDate:r.props.maxDate,date:r.state.date,scrollableMonthYearDropdown:r.props.scrollableMonthYearDropdown})})),bt(Zt(r),"renderTodayButton",(function(){if(r.props.todayButton&&!r.props.showTimeSelectOnly)return ue.default.createElement("div",{className:"react-datepicker__today-button",onClick:function(e){return r.props.onSelect(He.default(Ot()),e)}},r.props.todayButton)})),bt(Zt(r),"renderDefaultHeader",(function(e){var t=e.monthDate,n=e.i;return ue.default.createElement("div",{className:"react-datepicker__header ".concat(r.props.showTimeSelect?"react-datepicker__header--has-time-select":"")},r.renderCurrentMonth(t),ue.default.createElement("div",{className:"react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(r.props.dropdownMode),onFocus:r.handleDropdownFocus},r.renderMonthDropdown(0!==n),r.renderMonthYearDropdown(0!==n),r.renderYearDropdown(0!==n)),ue.default.createElement("div",{className:"react-datepicker__day-names"},r.header(t)))})),bt(Zt(r),"renderCustomHeader",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.monthDate,n=e.i;if(r.props.showTimeSelect&&!r.state.monthContainer||r.props.showTimeSelectOnly)return null;var a=fn(r.state.date,r.props),s=gn(r.state.date,r.props),i=vn(r.state.date,r.props),o=bn(r.state.date,r.props),l=!r.props.showMonthYearPicker&&!r.props.showQuarterYearPicker&&!r.props.showYearPicker;return ue.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:r.props.onDropdownFocus},r.props.renderCustomHeader(mt(mt({},r.state),{},{customHeaderCount:n,monthDate:t,changeMonth:r.changeMonth,changeYear:r.changeYear,decreaseMonth:r.decreaseMonth,increaseMonth:r.increaseMonth,decreaseYear:r.decreaseYear,increaseYear:r.increaseYear,prevMonthButtonDisabled:a,nextMonthButtonDisabled:s,prevYearButtonDisabled:i,nextYearButtonDisabled:o})),l&&ue.default.createElement("div",{className:"react-datepicker__day-names"},r.header(t)))})),bt(Zt(r),"renderYearHeader",(function(){var e=r.state.date,t=r.props,n=t.showYearPicker,a=jn(e,t.yearItemNumber),s=a.startPeriod,i=a.endPeriod;return ue.default.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},n?"".concat(s," - ").concat(i):Re.default(e))})),bt(Zt(r),"renderHeader",(function(e){switch(!0){case void 0!==r.props.renderCustomHeader:return r.renderCustomHeader(e);case r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker:return r.renderYearHeader(e);default:return r.renderDefaultHeader(e)}})),bt(Zt(r),"renderMonths",(function(){if(!r.props.showTimeSelectOnly&&!r.props.showYearPicker){for(var e=[],t=r.props.showPreviousMonths?r.props.monthsShown-1:0,n=je.default(r.state.date,t),a=0;a<r.props.monthsShown;++a){var s=a-r.props.monthSelectedIn,i=we.default(n,s),o="month-".concat(a),l=a<r.props.monthsShown-1,c=a>0;e.push(ue.default.createElement("div",{key:o,ref:function(e){r.monthContainer=e},className:"react-datepicker__month-container"},r.renderHeader({monthDate:i,i:a}),ue.default.createElement(Fn,{chooseDayAriaLabelPrefix:r.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:r.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:r.props.weekAriaLabelPrefix,onChange:r.changeMonthYear,day:i,dayClassName:r.props.dayClassName,calendarStartDay:r.props.calendarStartDay,monthClassName:r.props.monthClassName,onDayClick:r.handleDayClick,handleOnKeyDown:r.props.handleOnDayKeyDown,onDayMouseEnter:r.handleDayMouseEnter,onMouseLeave:r.handleMonthMouseLeave,onWeekSelect:r.props.onWeekSelect,orderInDisplay:a,formatWeekNumber:r.props.formatWeekNumber,locale:r.props.locale,minDate:r.props.minDate,maxDate:r.props.maxDate,excludeDates:r.props.excludeDates,excludeDateIntervals:r.props.excludeDateIntervals,highlightDates:r.props.highlightDates,selectingDate:r.state.selectingDate,includeDates:r.props.includeDates,includeDateIntervals:r.props.includeDateIntervals,inline:r.props.inline,shouldFocusDayInline:r.props.shouldFocusDayInline,fixedHeight:r.props.fixedHeight,filterDate:r.props.filterDate,preSelection:r.props.preSelection,setPreSelection:r.props.setPreSelection,selected:r.props.selected,selectsStart:r.props.selectsStart,selectsEnd:r.props.selectsEnd,selectsRange:r.props.selectsRange,selectsDisabledDaysInRange:r.props.selectsDisabledDaysInRange,showWeekNumbers:r.props.showWeekNumbers,startDate:r.props.startDate,endDate:r.props.endDate,peekNextMonth:r.props.peekNextMonth,setOpen:r.props.setOpen,shouldCloseOnSelect:r.props.shouldCloseOnSelect,renderDayContents:r.props.renderDayContents,disabledKeyboardNavigation:r.props.disabledKeyboardNavigation,showMonthYearPicker:r.props.showMonthYearPicker,showFullMonthYearPicker:r.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:r.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:r.props.showFourColumnMonthYearPicker,showYearPicker:r.props.showYearPicker,showQuarterYearPicker:r.props.showQuarterYearPicker,isInputFocused:r.props.isInputFocused,containerRef:r.containerRef,monthShowsDuplicateDaysEnd:l,monthShowsDuplicateDaysStart:c})))}return e}})),bt(Zt(r),"renderYears",(function(){if(!r.props.showTimeSelectOnly)return r.props.showYearPicker?ue.default.createElement("div",{className:"react-datepicker__year--container"},r.renderHeader(),ue.default.createElement($n,yt({onDayClick:r.handleDayClick,date:r.state.date},r.props))):void 0})),bt(Zt(r),"renderTimeSection",(function(){if(r.props.showTimeSelect&&(r.state.monthContainer||r.props.showTimeSelectOnly))return ue.default.createElement(qn,{selected:r.props.selected,openToDate:r.props.openToDate,onChange:r.props.onTimeChange,timeClassName:r.props.timeClassName,format:r.props.timeFormat,includeTimes:r.props.includeTimes,intervals:r.props.timeIntervals,minTime:r.props.minTime,maxTime:r.props.maxTime,excludeTimes:r.props.excludeTimes,filterTime:r.props.filterTime,timeCaption:r.props.timeCaption,todayButton:r.props.todayButton,showMonthDropdown:r.props.showMonthDropdown,showMonthYearDropdown:r.props.showMonthYearDropdown,showYearDropdown:r.props.showYearDropdown,withPortal:r.props.withPortal,monthRef:r.state.monthContainer,injectTimes:r.props.injectTimes,locale:r.props.locale,handleOnKeyDown:r.props.handleOnKeyDown,showTimeSelectOnly:r.props.showTimeSelectOnly})})),bt(Zt(r),"renderInputTimeSection",(function(){var e=new Date(r.props.selected),t=At(e)&&Boolean(r.props.selected)?"".concat(Zn(e.getHours()),":").concat(Zn(e.getMinutes())):"";if(r.props.showTimeInput)return ue.default.createElement(Un,{date:e,timeString:t,timeInputLabel:r.props.timeInputLabel,onChange:r.props.onTimeChange,customTimeInput:r.props.customTimeInput})})),r.containerRef=ue.default.createRef(),r.state={date:r.getDateInView(),selectingDate:null,monthContainer:null},r}return vt(n,[{key:"componentDidMount",value:function(){this.props.showTimeSelect&&(this.assignMonthContainer=void this.setState({monthContainer:this.monthContainer}))}},{key:"componentDidUpdate",value:function(e){this.props.preSelection&&!Kt(this.props.preSelection,e.preSelection)?this.setState({date:this.props.preSelection}):this.props.openToDate&&!Kt(this.props.openToDate,e.openToDate)&&this.setState({date:this.props.openToDate})}},{key:"render",value:function(){var e=this.props.container||Vn;return ue.default.createElement("div",{ref:this.containerRef},ue.default.createElement(e,{className:pe.default("react-datepicker",this.props.className,{"react-datepicker--time-only":this.props.showTimeSelectOnly}),showPopperArrow:this.props.showPopperArrow,arrowProps:this.props.arrowProps},this.renderPreviousButton(),this.renderNextButton(),this.renderMonths(),this.renderYears(),this.renderTodayButton(),this.renderTimeSection(),this.renderInputTimeSection(),this.props.children))}}],[{key:"defaultProps",get:function(){return{onDropdownFocus:function(){},monthsShown:1,monthSelectedIn:0,forceShowMonthNavigation:!1,timeCaption:"Time",previousYearButtonLabel:"Previous Year",nextYearButtonLabel:"Next Year",previousMonthButtonLabel:"Previous Month",nextMonthButtonLabel:"Next Month",customTimeInput:null,yearItemNumber:Dt}}}]),n}(ue.default.Component),Bn=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),(r=t.call(this,e)).el=document.createElement("div"),r}return vt(n,[{key:"componentDidMount",value:function(){this.portalRoot=(this.props.portalHost||document).getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement("div"),this.portalRoot.setAttribute("id",this.props.portalId),(this.props.portalHost||document.body).appendChild(this.portalRoot)),this.portalRoot.appendChild(this.el)}},{key:"componentWillUnmount",value:function(){this.portalRoot.removeChild(this.el)}},{key:"render",value:function(){return ut.default.createPortal(this.props.children,this.el)}}]),n}(ue.default.Component),Hn=function(e){return!e.disabled&&-1!==e.tabIndex},zn=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),bt(Zt(r=t.call(this,e)),"getTabChildren",(function(){return Array.prototype.slice.call(r.tabLoopRef.current.querySelectorAll("[tabindex], a, button, input, select, textarea"),1,-1).filter(Hn)})),bt(Zt(r),"handleFocusStart",(function(e){var t=r.getTabChildren();t&&t.length>1&&t[t.length-1].focus()})),bt(Zt(r),"handleFocusEnd",(function(e){var t=r.getTabChildren();t&&t.length>1&&t[0].focus()})),r.tabLoopRef=ue.default.createRef(),r}return vt(n,[{key:"render",value:function(){return this.props.enableTabLoop?ue.default.createElement("div",{className:"react-datepicker__tab-loop",ref:this.tabLoopRef},ue.default.createElement("div",{className:"react-datepicker__tab-loop__start",tabIndex:"0",onFocus:this.handleFocusStart}),this.props.children,ue.default.createElement("div",{className:"react-datepicker__tab-loop__end",tabIndex:"0",onFocus:this.handleFocusEnd})):this.props.children}}],[{key:"defaultProps",get:function(){return{enableTabLoop:!0}}}]),n}(ue.default.Component),Kn=function(e){wt(n,e);var t=It(n);function n(){return ft(this,n),t.apply(this,arguments)}return vt(n,[{key:"render",value:function(){var e,t=this.props,n=t.className,r=t.wrapperClassName,a=t.hidePopper,s=t.popperComponent,i=t.popperModifiers,o=t.popperPlacement,l=t.popperProps,c=t.targetComponent,d=t.enableTabLoop,u=t.popperOnKeyDown,p=t.portalId,m=t.portalHost;if(!a){var h=pe.default("react-datepicker-popper",n);e=ue.default.createElement(ce.Popper,yt({modifiers:i,placement:o},l),(function(e){var t=e.ref,n=e.style,r=e.placement,a=e.arrowProps;return ue.default.createElement(zn,{enableTabLoop:d},ue.default.createElement("div",{ref:t,style:n,className:h,"data-placement":r,onKeyDown:u},ue.default.cloneElement(s,{arrowProps:a})))}))}this.props.popperContainer&&(e=ue.default.createElement(this.props.popperContainer,{},e)),p&&!a&&(e=ue.default.createElement(Bn,{portalId:p,portalHost:m},e));var f=pe.default("react-datepicker-wrapper",r);return ue.default.createElement(ce.Manager,{className:"react-datepicker-manager"},ue.default.createElement(ce.Reference,null,(function(e){var t=e.ref;return ue.default.createElement("div",{ref:t,className:f},c)})),e)}}],[{key:"defaultProps",get:function(){return{hidePopper:!0,popperModifiers:[],popperProps:{},popperPlacement:"bottom-start"}}}]),n}(ue.default.Component),Gn="react-datepicker-ignore-onclickoutside",Qn=dt.default(Yn),Xn="Date input not valid.",Jn=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),bt(Zt(r=t.call(this,e)),"getPreSelection",(function(){return r.props.openToDate?r.props.openToDate:r.props.selectsEnd&&r.props.startDate?r.props.startDate:r.props.selectsStart&&r.props.endDate?r.props.endDate:Ot()})),bt(Zt(r),"calcInitialState",(function(){var e,t=r.getPreSelection(),n=yn(r.props),a=wn(r.props),s=n&&st.default(t,He.default(n))?n:a&&at.default(t,Xe.default(a))?a:t;return{open:r.props.startOpen||!1,preventFocus:!1,preSelection:null!==(e=r.props.selectsRange?r.props.startDate:r.props.selected)&&void 0!==e?e:s,highlightDates:xn(r.props.highlightDates),focused:!1,shouldFocusDayInline:!1}})),bt(Zt(r),"clearPreventFocusTimeout",(function(){r.preventFocusTimeout&&clearTimeout(r.preventFocusTimeout)})),bt(Zt(r),"setFocus",(function(){r.input&&r.input.focus&&r.input.focus({preventScroll:!0})})),bt(Zt(r),"setBlur",(function(){r.input&&r.input.blur&&r.input.blur(),r.cancelFocusInput()})),bt(Zt(r),"setOpen",(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r.setState({open:e,preSelection:e&&r.state.open?r.state.preSelection:r.calcInitialState().preSelection,lastPreSelectChange:tr},(function(){e||r.setState((function(e){return{focused:!!t&&e.focused}}),(function(){!t&&r.setBlur(),r.setState({inputValue:null})}))}))})),bt(Zt(r),"inputOk",(function(){return me.default(r.state.preSelection)})),bt(Zt(r),"isCalendarOpen",(function(){return void 0===r.props.open?r.state.open&&!r.props.disabled&&!r.props.readOnly:r.props.open})),bt(Zt(r),"handleFocus",(function(e){r.state.preventFocus||(r.props.onFocus(e),r.props.preventOpenOnFocus||r.props.readOnly||r.setOpen(!0)),r.setState({focused:!0})})),bt(Zt(r),"cancelFocusInput",(function(){clearTimeout(r.inputFocusTimeout),r.inputFocusTimeout=null})),bt(Zt(r),"deferFocusInput",(function(){r.cancelFocusInput(),r.inputFocusTimeout=setTimeout((function(){return r.setFocus()}),1)})),bt(Zt(r),"handleDropdownFocus",(function(){r.cancelFocusInput()})),bt(Zt(r),"handleBlur",(function(e){(!r.state.open||r.props.withPortal||r.props.showTimeInput)&&r.props.onBlur(e),r.setState({focused:!1})})),bt(Zt(r),"handleCalendarClickOutside",(function(e){r.props.inline||r.setOpen(!1),r.props.onClickOutside(e),r.props.withPortal&&e.preventDefault()})),bt(Zt(r),"handleChange",(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var a=t[0];if(!r.props.onChangeRaw||(r.props.onChangeRaw.apply(Zt(r),t),"function"==typeof a.isDefaultPrevented&&!a.isDefaultPrevented())){r.setState({inputValue:a.target.value,lastPreSelectChange:er});var s=Rt(a.target.value,r.props.dateFormat,r.props.locale,r.props.strictParsing,r.props.minDate);!s&&a.target.value||r.setSelected(s,a,!0)}})),bt(Zt(r),"handleSelect",(function(e,t,n){if(r.setState({preventFocus:!0},(function(){return r.preventFocusTimeout=setTimeout((function(){return r.setState({preventFocus:!1})}),50),r.preventFocusTimeout})),r.props.onChangeRaw&&r.props.onChangeRaw(t),r.setSelected(e,t,!1,n),!r.props.shouldCloseOnSelect||r.props.showTimeSelect)r.setPreSelection(e);else if(!r.props.inline){r.props.selectsRange||r.setOpen(!1);var a=r.props,s=a.startDate,i=a.endDate;!s||i||st.default(e,s)||r.setOpen(!1)}})),bt(Zt(r),"setSelected",(function(e,t,n,a){var s=e;if(null===s||!rn(s,r.props)){var i=r.props,o=i.onChange,l=i.selectsRange,c=i.startDate,d=i.endDate;if(!Gt(r.props.selected,s)||r.props.allowSameDay||l)if(null!==s&&(!r.props.selected||n&&(r.props.showTimeSelect||r.props.showTimeSelectOnly||r.props.showTimeInput)||(s=Lt(s,{hour:Te.default(r.props.selected),minute:Ce.default(r.props.selected),second:Se.default(r.props.selected)})),r.props.inline||r.setState({preSelection:s}),r.props.focusSelectedMonth||r.setState({monthSelectedIn:a})),l){var u=c&&d;c||d?c&&!d&&(st.default(s,c)?o([s,null],t):o([c,s],t)):o([s,null],t),u&&o([s,null],t)}else o(s,t);n||(r.props.onSelect(s,t),r.setState({inputValue:null}))}})),bt(Zt(r),"setPreSelection",(function(e){var t=void 0!==r.props.minDate,n=void 0!==r.props.maxDate,a=!0;if(e){var s=He.default(e);if(t&&n)a=Qt(e,r.props.minDate,r.props.maxDate);else if(t){var i=He.default(r.props.minDate);a=at.default(e,i)||Gt(s,i)}else if(n){var o=Xe.default(r.props.maxDate);a=st.default(e,o)||Gt(s,o)}}a&&r.setState({preSelection:e})})),bt(Zt(r),"handleTimeChange",(function(e){var t=Lt(r.props.selected?r.props.selected:r.getPreSelection(),{hour:Te.default(e),minute:Ce.default(e)});r.setState({preSelection:t}),r.props.onChange(t),r.props.shouldCloseOnSelect&&r.setOpen(!1),r.props.showTimeInput&&r.setOpen(!0),r.setState({inputValue:null})})),bt(Zt(r),"onInputClick",(function(){r.props.disabled||r.props.readOnly||r.setOpen(!0),r.props.onInputClick()})),bt(Zt(r),"onInputKeyDown",(function(e){r.props.onKeyDown(e);var t=e.key;if(r.state.open||r.props.inline||r.props.preventOpenOnFocus){if(r.state.open){if("ArrowDown"===t||"ArrowUp"===t){e.preventDefault();var n=r.calendar.componentNode&&r.calendar.componentNode.querySelector('.react-datepicker__day[tabindex="0"]');return void(n&&n.focus({preventScroll:!0}))}var a=Ot(r.state.preSelection);"Enter"===t?(e.preventDefault(),r.inputOk()&&r.state.lastPreSelectChange===tr?(r.handleSelect(a,e),!r.props.shouldCloseOnSelect&&r.setPreSelection(a)):r.setOpen(!1)):"Escape"===t&&(e.preventDefault(),r.setOpen(!1)),r.inputOk()||r.props.onInputError({code:1,msg:Xn})}}else"ArrowDown"!==t&&"ArrowUp"!==t&&"Enter"!==t||r.onInputClick()})),bt(Zt(r),"onDayKeyDown",(function(e){r.props.onKeyDown(e);var t=e.key,n=Ot(r.state.preSelection);if("Enter"===t)e.preventDefault(),r.handleSelect(n,e),!r.props.shouldCloseOnSelect&&r.setPreSelection(n);else if("Escape"===t)e.preventDefault(),r.setOpen(!1),r.inputOk()||r.props.onInputError({code:1,msg:Xn});else if(!r.props.disabledKeyboardNavigation){var a;switch(t){case"ArrowLeft":a=_e.default(n,1);break;case"ArrowRight":a=be.default(n,1);break;case"ArrowUp":a=Ze.default(n,1);break;case"ArrowDown":a=ye.default(n,1);break;case"PageUp":a=je.default(n,1);break;case"PageDown":a=we.default(n,1);break;case"Home":a=Ie.default(n,1);break;case"End":a=xe.default(n,1)}if(!a)return void(r.props.onInputError&&r.props.onInputError({code:1,msg:Xn}));if(e.preventDefault(),r.setState({lastPreSelectChange:tr}),r.props.adjustDateOnChange&&r.setSelected(a),r.setPreSelection(a),r.props.inline){var s=Ee.default(n),i=Ee.default(a),o=Re.default(n),l=Re.default(a);s!==i||o!==l?r.setState({shouldFocusDayInline:!0}):r.setState({shouldFocusDayInline:!1})}}})),bt(Zt(r),"onPopperKeyDown",(function(e){"Escape"===e.key&&(e.preventDefault(),r.setState({preventFocus:!0},(function(){r.setOpen(!1),setTimeout((function(){r.setFocus(),r.setState({preventFocus:!1})}))})))})),bt(Zt(r),"onClearClick",(function(e){e&&e.preventDefault&&e.preventDefault(),r.props.selectsRange?r.props.onChange([null,null],e):r.props.onChange(null,e),r.setState({inputValue:null})})),bt(Zt(r),"clear",(function(){r.onClearClick()})),bt(Zt(r),"onScroll",(function(e){"boolean"==typeof r.props.closeOnScroll&&r.props.closeOnScroll?e.target!==document&&e.target!==document.documentElement&&e.target!==document.body||r.setOpen(!1):"function"==typeof r.props.closeOnScroll&&r.props.closeOnScroll(e)&&r.setOpen(!1)})),bt(Zt(r),"renderCalendar",(function(){return r.props.inline||r.isCalendarOpen()?ue.default.createElement(Qn,{ref:function(e){r.calendar=e},locale:r.props.locale,calendarStartDay:r.props.calendarStartDay,chooseDayAriaLabelPrefix:r.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:r.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:r.props.weekAriaLabelPrefix,adjustDateOnChange:r.props.adjustDateOnChange,setOpen:r.setOpen,shouldCloseOnSelect:r.props.shouldCloseOnSelect,dateFormat:r.props.dateFormatCalendar,useWeekdaysShort:r.props.useWeekdaysShort,formatWeekDay:r.props.formatWeekDay,dropdownMode:r.props.dropdownMode,selected:r.props.selected,preSelection:r.state.preSelection,onSelect:r.handleSelect,onWeekSelect:r.props.onWeekSelect,openToDate:r.props.openToDate,minDate:r.props.minDate,maxDate:r.props.maxDate,selectsStart:r.props.selectsStart,selectsEnd:r.props.selectsEnd,selectsRange:r.props.selectsRange,startDate:r.props.startDate,endDate:r.props.endDate,excludeDates:r.props.excludeDates,excludeDateIntervals:r.props.excludeDateIntervals,filterDate:r.props.filterDate,onClickOutside:r.handleCalendarClickOutside,formatWeekNumber:r.props.formatWeekNumber,highlightDates:r.state.highlightDates,includeDates:r.props.includeDates,includeDateIntervals:r.props.includeDateIntervals,includeTimes:r.props.includeTimes,injectTimes:r.props.injectTimes,inline:r.props.inline,shouldFocusDayInline:r.state.shouldFocusDayInline,peekNextMonth:r.props.peekNextMonth,showMonthDropdown:r.props.showMonthDropdown,showPreviousMonths:r.props.showPreviousMonths,useShortMonthInDropdown:r.props.useShortMonthInDropdown,showMonthYearDropdown:r.props.showMonthYearDropdown,showWeekNumbers:r.props.showWeekNumbers,showYearDropdown:r.props.showYearDropdown,withPortal:r.props.withPortal,forceShowMonthNavigation:r.props.forceShowMonthNavigation,showDisabledMonthNavigation:r.props.showDisabledMonthNavigation,scrollableYearDropdown:r.props.scrollableYearDropdown,scrollableMonthYearDropdown:r.props.scrollableMonthYearDropdown,todayButton:r.props.todayButton,weekLabel:r.props.weekLabel,outsideClickIgnoreClass:Gn,fixedHeight:r.props.fixedHeight,monthsShown:r.props.monthsShown,monthSelectedIn:r.state.monthSelectedIn,onDropdownFocus:r.handleDropdownFocus,onMonthChange:r.props.onMonthChange,onYearChange:r.props.onYearChange,dayClassName:r.props.dayClassName,weekDayClassName:r.props.weekDayClassName,monthClassName:r.props.monthClassName,timeClassName:r.props.timeClassName,showTimeSelect:r.props.showTimeSelect,showTimeSelectOnly:r.props.showTimeSelectOnly,onTimeChange:r.handleTimeChange,timeFormat:r.props.timeFormat,timeIntervals:r.props.timeIntervals,minTime:r.props.minTime,maxTime:r.props.maxTime,excludeTimes:r.props.excludeTimes,filterTime:r.props.filterTime,timeCaption:r.props.timeCaption,className:r.props.calendarClassName,container:r.props.calendarContainer,yearItemNumber:r.props.yearItemNumber,yearDropdownItemNumber:r.props.yearDropdownItemNumber,previousMonthAriaLabel:r.props.previousMonthAriaLabel,previousMonthButtonLabel:r.props.previousMonthButtonLabel,nextMonthAriaLabel:r.props.nextMonthAriaLabel,nextMonthButtonLabel:r.props.nextMonthButtonLabel,previousYearAriaLabel:r.props.previousYearAriaLabel,previousYearButtonLabel:r.props.previousYearButtonLabel,nextYearAriaLabel:r.props.nextYearAriaLabel,nextYearButtonLabel:r.props.nextYearButtonLabel,timeInputLabel:r.props.timeInputLabel,disabledKeyboardNavigation:r.props.disabledKeyboardNavigation,renderCustomHeader:r.props.renderCustomHeader,popperProps:r.props.popperProps,renderDayContents:r.props.renderDayContents,onDayMouseEnter:r.props.onDayMouseEnter,onMonthMouseLeave:r.props.onMonthMouseLeave,selectsDisabledDaysInRange:r.props.selectsDisabledDaysInRange,showTimeInput:r.props.showTimeInput,showMonthYearPicker:r.props.showMonthYearPicker,showFullMonthYearPicker:r.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:r.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:r.props.showFourColumnMonthYearPicker,showYearPicker:r.props.showYearPicker,showQuarterYearPicker:r.props.showQuarterYearPicker,showPopperArrow:r.props.showPopperArrow,excludeScrollbar:r.props.excludeScrollbar,handleOnKeyDown:r.props.onKeyDown,handleOnDayKeyDown:r.onDayKeyDown,isInputFocused:r.state.focused,customTimeInput:r.props.customTimeInput,setPreSelection:r.setPreSelection},r.props.children):null})),bt(Zt(r),"renderDateInput",(function(){var e,t=pe.default(r.props.className,bt({},Gn,r.state.open)),n=r.props.customInput||ue.default.createElement("input",{type:"text"}),a=r.props.customInputRef||"ref",s="string"==typeof r.props.value?r.props.value:"string"==typeof r.state.inputValue?r.state.inputValue:r.props.selectsRange?function(e,t,n){if(!e)return"";var r=Mt(e,n),a=t?Mt(t,n):"";return"".concat(r," - ").concat(a)}(r.props.startDate,r.props.endDate,r.props):Mt(r.props.selected,r.props);return ue.default.cloneElement(n,(bt(e={},a,(function(e){r.input=e})),bt(e,"value",s),bt(e,"onBlur",r.handleBlur),bt(e,"onChange",r.handleChange),bt(e,"onClick",r.onInputClick),bt(e,"onFocus",r.handleFocus),bt(e,"onKeyDown",r.onInputKeyDown),bt(e,"id",r.props.id),bt(e,"name",r.props.name),bt(e,"autoFocus",r.props.autoFocus),bt(e,"placeholder",r.props.placeholderText),bt(e,"disabled",r.props.disabled),bt(e,"autoComplete",r.props.autoComplete),bt(e,"className",pe.default(n.props.className,t)),bt(e,"title",r.props.title),bt(e,"readOnly",r.props.readOnly),bt(e,"required",r.props.required),bt(e,"tabIndex",r.props.tabIndex),bt(e,"aria-describedby",r.props.ariaDescribedBy),bt(e,"aria-invalid",r.props.ariaInvalid),bt(e,"aria-labelledby",r.props.ariaLabelledBy),bt(e,"aria-required",r.props.ariaRequired),e))})),bt(Zt(r),"renderClearButton",(function(){var e=r.props,t=e.isClearable,n=e.selected,a=e.startDate,s=e.endDate,i=e.clearButtonTitle,o=e.clearButtonClassName,l=void 0===o?"":o,c=e.ariaLabelClose,d=void 0===c?"Close":c;return!t||null==n&&null==a&&null==s?null:ue.default.createElement("button",{type:"button",className:"react-datepicker__close-icon ".concat(l).trim(),"aria-label":d,onClick:r.onClearClick,title:i,tabIndex:-1})})),r.state=r.calcInitialState(),r}return vt(n,[{key:"componentDidMount",value:function(){window.addEventListener("scroll",this.onScroll,!0)}},{key:"componentDidUpdate",value:function(e,t){var n,r;e.inline&&(n=e.selected,r=this.props.selected,n&&r?Ee.default(n)!==Ee.default(r)||Re.default(n)!==Re.default(r):n!==r)&&this.setPreSelection(this.props.selected),void 0!==this.state.monthSelectedIn&&e.monthsShown!==this.props.monthsShown&&this.setState({monthSelectedIn:0}),e.highlightDates!==this.props.highlightDates&&this.setState({highlightDates:xn(this.props.highlightDates)}),t.focused||Gt(e.selected,this.props.selected)||this.setState({inputValue:null}),t.open!==this.state.open&&(!1===t.open&&!0===this.state.open&&this.props.onCalendarOpen(),!0===t.open&&!1===this.state.open&&this.props.onCalendarClose())}},{key:"componentWillUnmount",value:function(){this.clearPreventFocusTimeout(),window.removeEventListener("scroll",this.onScroll,!0)}},{key:"renderInputContainer",value:function(){return ue.default.createElement("div",{className:"react-datepicker__input-container"},this.renderDateInput(),this.renderClearButton())}},{key:"render",value:function(){var e=this.renderCalendar();if(this.props.inline)return e;if(this.props.withPortal){var t=this.state.open?ue.default.createElement("div",{className:"react-datepicker__portal"},e):null;return this.state.open&&this.props.portalId&&(t=ue.default.createElement(Bn,{portalId:this.props.portalId,portalHost:this.props.portalHost},t)),ue.default.createElement("div",null,this.renderInputContainer(),t)}return ue.default.createElement(Kn,{className:this.props.popperClassName,wrapperClassName:this.props.wrapperClassName,hidePopper:!this.isCalendarOpen(),portalId:this.props.portalId,portalHost:this.props.portalHost,popperModifiers:this.props.popperModifiers,targetComponent:this.renderInputContainer(),popperContainer:this.props.popperContainer,popperComponent:e,popperPlacement:this.props.popperPlacement,popperProps:this.props.popperProps,popperOnKeyDown:this.onPopperKeyDown,enableTabLoop:this.props.enableTabLoop})}}],[{key:"defaultProps",get:function(){return{allowSameDay:!1,dateFormat:"MM/dd/yyyy",dateFormatCalendar:"LLLL yyyy",onChange:function(){},disabled:!1,disabledKeyboardNavigation:!1,dropdownMode:"scroll",onFocus:function(){},onBlur:function(){},onKeyDown:function(){},onInputClick:function(){},onSelect:function(){},onClickOutside:function(){},onMonthChange:function(){},onCalendarOpen:function(){},onCalendarClose:function(){},preventOpenOnFocus:!1,onYearChange:function(){},onInputError:function(){},monthsShown:1,readOnly:!1,withPortal:!1,selectsDisabledDaysInRange:!1,shouldCloseOnSelect:!0,showTimeSelect:!1,showTimeInput:!1,showPreviousMonths:!1,showMonthYearPicker:!1,showFullMonthYearPicker:!1,showTwoColumnMonthYearPicker:!1,showFourColumnMonthYearPicker:!1,showYearPicker:!1,showQuarterYearPicker:!1,strictParsing:!1,timeIntervals:30,timeCaption:"Time",previousMonthAriaLabel:"Previous Month",previousMonthButtonLabel:"Previous Month",nextMonthAriaLabel:"Next Month",nextMonthButtonLabel:"Next Month",previousYearAriaLabel:"Previous Year",previousYearButtonLabel:"Previous Year",nextYearAriaLabel:"Next Year",nextYearButtonLabel:"Next Year",timeInputLabel:"Time",enableTabLoop:!0,yearItemNumber:Dt,renderDayContents:function(e){return e},focusSelectedMonth:!1,showPopperArrow:!0,excludeScrollbar:!0,customTimeInput:null,calendarStartDay:void 0}}}]),n}(ue.default.Component),er="input",tr="navigate";e.CalendarContainer=Vn,e.default=Jn,e.getDefaultLocale=Xt,e.registerLocale=function(e,t){var r="undefined"!=typeof window?window:n.g;r.__localeData__||(r.__localeData__={}),r.__localeData__[e]=t},e.setDefaultLocale=function(e){("undefined"!=typeof window?window:n.g).__localeId__=e},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(45993),n(45697),n(78596),n(71381),n(12274),n(49546),n(58545),n(78343),n(77349),n(63500),n(11640),n(21593),n(1784),n(88330),n(7069),n(77982),n(54559),n(59319),n(77881),n(39159),n(85817),n(20466),n(55855),n(9827),n(78966),n(56605),n(95570),n(28789),n(39880),n(4543),n(37042),n(62225),n(11503),n(44749),n(37950),n(99890),n(92300),n(84129),n(52724),n(91857),n(69119),n(584),n(43703),n(94431),n(38148),n(57870),n(67090),n(4135),n(96843),n(3151),n(49160),n(60792),n(86117),n(42699),n(313),n(24257),n(19013),n(45853),n(23855),n(58949),n(52524),n(48934))},69590:function(e){var t="undefined"!=typeof Element,n="function"==typeof Map,r="function"==typeof Set,a="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function s(e,i){if(e===i)return!0;if(e&&i&&"object"==typeof e&&"object"==typeof i){if(e.constructor!==i.constructor)return!1;var o,l,c,d;if(Array.isArray(e)){if((o=e.length)!=i.length)return!1;for(l=o;0!=l--;)if(!s(e[l],i[l]))return!1;return!0}if(n&&e instanceof Map&&i instanceof Map){if(e.size!==i.size)return!1;for(d=e.entries();!(l=d.next()).done;)if(!i.has(l.value[0]))return!1;for(d=e.entries();!(l=d.next()).done;)if(!s(l.value[1],i.get(l.value[0])))return!1;return!0}if(r&&e instanceof Set&&i instanceof Set){if(e.size!==i.size)return!1;for(d=e.entries();!(l=d.next()).done;)if(!i.has(l.value[0]))return!1;return!0}if(a&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(i)){if((o=e.length)!=i.length)return!1;for(l=o;0!=l--;)if(e[l]!==i[l])return!1;return!0}if(e.constructor===RegExp)return e.source===i.source&&e.flags===i.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===i.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===i.toString();if((o=(c=Object.keys(e)).length)!==Object.keys(i).length)return!1;for(l=o;0!=l--;)if(!Object.prototype.hasOwnProperty.call(i,c[l]))return!1;if(t&&e instanceof Element)return!1;for(l=o;0!=l--;)if(("_owner"!==c[l]&&"__v"!==c[l]&&"__o"!==c[l]||!e.$$typeof)&&!s(e[c[l]],i[c[l]]))return!1;return!0}return e!=e&&i!=i}e.exports=function(e,t){try{return s(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}},58949:function(e,t,n){"use strict";n.r(t),n.d(t,{IGNORE_CLASS_NAME:function(){return h}});var r=n(45993),a=n(52524);function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(e,t,n){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(n):e.classList.contains(n))}var l,c,d=(void 0===l&&(l=0),function(){return++l}),u={},p={},m=["touchstart","touchmove"],h="ignore-react-onclickoutside";function f(e,t){var n=null;return-1!==m.indexOf(t)&&c&&(n={passive:!e.props.preventDefault}),n}t.default=function(e,t){var n,l,m=e.displayName||e.name||"Component";return l=n=function(n){var l,h;function g(e){var r;return(r=n.call(this,e)||this).__outsideClickHandler=function(e){if("function"!=typeof r.__clickOutsideHandlerProp){var t=r.getInstance();if("function"!=typeof t.props.handleClickOutside){if("function"!=typeof t.handleClickOutside)throw new Error("WrappedComponent: "+m+" lacks a handleClickOutside(event) function for processing outside click events.");t.handleClickOutside(e)}else t.props.handleClickOutside(e)}else r.__clickOutsideHandlerProp(e)},r.__getComponentNode=function(){var e=r.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():(0,a.findDOMNode)(e)},r.enableOnClickOutside=function(){if("undefined"!=typeof document&&!p[r._uid]){void 0===c&&(c=function(){if("undefined"!=typeof window&&"function"==typeof window.addEventListener){var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}}),n=function(){};return window.addEventListener("testPassiveEventSupport",n,t),window.removeEventListener("testPassiveEventSupport",n,t),e}}()),p[r._uid]=!0;var e=r.props.eventTypes;e.forEach||(e=[e]),u[r._uid]=function(e){var t;null!==r.componentNode&&(r.props.preventDefault&&e.preventDefault(),r.props.stopPropagation&&e.stopPropagation(),r.props.excludeScrollbar&&(t=e,document.documentElement.clientWidth<=t.clientX||document.documentElement.clientHeight<=t.clientY)||function(e,t,n){if(e===t)return!0;for(;e.parentNode||e.host;){if(e.parentNode&&o(e,t,n))return!0;e=e.parentNode||e.host}return e}(e.composed&&e.composedPath&&e.composedPath().shift()||e.target,r.componentNode,r.props.outsideClickIgnoreClass)===document&&r.__outsideClickHandler(e))},e.forEach((function(e){document.addEventListener(e,u[r._uid],f(i(r),e))}))}},r.disableOnClickOutside=function(){delete p[r._uid];var e=u[r._uid];if(e&&"undefined"!=typeof document){var t=r.props.eventTypes;t.forEach||(t=[t]),t.forEach((function(t){return document.removeEventListener(t,e,f(i(r),t))})),delete u[r._uid]}},r.getRef=function(e){return r.instanceRef=e},r._uid=d(),r}h=n,(l=g).prototype=Object.create(h.prototype),l.prototype.constructor=l,s(l,h);var v=g.prototype;return v.getInstance=function(){if(e.prototype&&!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},v.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(t&&"function"==typeof t.handleClickOutside&&(this.__clickOutsideHandlerProp=t.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw new Error("WrappedComponent: "+m+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},v.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},v.componentWillUnmount=function(){this.disableOnClickOutside()},v.render=function(){var t=this.props;t.excludeScrollbar;var n=function(e,t){if(null==e)return{};var n,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(t,["excludeScrollbar"]);return e.prototype&&e.prototype.isReactComponent?n.ref=this.getRef:n.wrappedRef=this.getRef,n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,(0,r.createElement)(e,n)},g}(r.Component),n.displayName="OnClickOutside("+m+")",n.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:h,preventDefault:!1,stopPropagation:!1},n.getClass=function(){return e.getClass?e.getClass():e},l}},48934:function(e,t,n){"use strict";n.r(t),n.d(t,{Manager:function(){return i},Popper:function(){return w},Reference:function(){return Z},usePopper:function(){return g}});var r=n(45993),a=r.createContext(),s=r.createContext();function i(e){var t=e.children,n=r.useState(null),i=n[0],o=n[1],l=r.useRef(!1);r.useEffect((function(){return function(){l.current=!0}}),[]);var c=r.useCallback((function(e){l.current||o(e)}),[]);return r.createElement(a.Provider,{value:i},r.createElement(s.Provider,{value:c},t))}var o=function(e){return Array.isArray(e)?e[0]:e},l=function(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}},c=function(e,t){if("function"==typeof e)return l(e,t);null!=e&&(e.current=t)},d=function(e){return e.reduce((function(e,t){var n=t[0],r=t[1];return e[n]=r,e}),{})},u="undefined"!=typeof window&&window.document&&window.document.createElement?r.useLayoutEffect:r.useEffect,p=n(17211),m=n(69590),h=n.n(m),f=[],g=function(e,t,n){void 0===n&&(n={});var a=r.useRef(null),s={onFirstUpdate:n.onFirstUpdate,placement:n.placement||"bottom",strategy:n.strategy||"absolute",modifiers:n.modifiers||f},i=r.useState({styles:{popper:{position:s.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),o=i[0],l=i[1],c=r.useMemo((function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(e){var t=e.state,n=Object.keys(t.elements);l({styles:d(n.map((function(e){return[e,t.styles[e]||{}]}))),attributes:d(n.map((function(e){return[e,t.attributes[e]]})))})},requires:["computeStyles"]}}),[]),m=r.useMemo((function(){var e={onFirstUpdate:s.onFirstUpdate,placement:s.placement,strategy:s.strategy,modifiers:[].concat(s.modifiers,[c,{name:"applyStyles",enabled:!1}])};return h()(a.current,e)?a.current||e:(a.current=e,e)}),[s.onFirstUpdate,s.placement,s.strategy,s.modifiers,c]),g=r.useRef();return u((function(){g.current&&g.current.setOptions(m)}),[m]),u((function(){if(null!=e&&null!=t){var r=(n.createPopper||p.fi)(e,t,m);return g.current=r,function(){r.destroy(),g.current=null}}}),[e,t,n.createPopper]),{state:g.current?g.current.state:null,styles:o.styles,attributes:o.attributes,update:g.current?g.current.update:null,forceUpdate:g.current?g.current.forceUpdate:null}},v=function(){},b=function(){return Promise.resolve(null)},y=[];function w(e){var t=e.placement,n=void 0===t?"bottom":t,s=e.strategy,i=void 0===s?"absolute":s,l=e.modifiers,d=void 0===l?y:l,u=e.referenceElement,p=e.onFirstUpdate,m=e.innerRef,h=e.children,f=r.useContext(a),w=r.useState(null),x=w[0],_=w[1],Z=r.useState(null),j=Z[0],I=Z[1];r.useEffect((function(){c(m,x)}),[m,x]);var S=r.useMemo((function(){return{placement:n,strategy:i,onFirstUpdate:p,modifiers:[].concat(d,[{name:"arrow",enabled:null!=j,options:{element:j}}])}}),[n,i,p,d,j]),C=g(u||f,x,S),T=C.state,k=C.styles,N=C.forceUpdate,D=C.update,E=r.useMemo((function(){return{ref:_,style:k.popper,placement:T?T.placement:n,hasPopperEscaped:T&&T.modifiersData.hide?T.modifiersData.hide.hasPopperEscaped:null,isReferenceHidden:T&&T.modifiersData.hide?T.modifiersData.hide.isReferenceHidden:null,arrowProps:{style:k.arrow,ref:I},forceUpdate:N||v,update:D||b}}),[_,I,n,T,k,D,N]);return o(h)(E)}var x=n(42473),_=n.n(x);function Z(e){var t=e.children,n=e.innerRef,a=r.useContext(s),i=r.useCallback((function(e){c(n,e),l(a,e)}),[n,a]);return r.useEffect((function(){return function(){return c(n,null)}})),r.useEffect((function(){_()(Boolean(a),"`Reference` should not be used outside of a `Manager` component.")}),[a]),o(t)({ref:i})}},87903:function(e){e.exports=function(e){if(!window.satismeter){window.satismeter=function(){var e=[];function t(){e.push(arguments)}return t.q=e,t}();var t=document.createElement("script"),n=document.getElementsByTagName("script")[0].parentNode;t.async=1,t.src="https://app.satismeter.com/satismeter.js",n.appendChild(t)}return window.satismeter(e)}},20454:function(e,t,n){var r,a,s;a=[n(65311)],void 0===(s="function"==typeof(r=function(t){var n=function(){if(t&&t.fn&&t.fn.select2&&t.fn.select2.amd)var n=t.fn.select2.amd;var r,a,s,i;return n&&n.requirejs||(n?a=n:n={},function(e){var t,n,i,o,l={},c={},d={},u={},p=Object.prototype.hasOwnProperty,m=[].slice,h=/\.js$/;function f(e,t){return p.call(e,t)}function g(e,t){var n,r,a,s,i,o,l,c,u,p,m,f=t&&t.split("/"),g=d.map,v=g&&g["*"]||{};if(e){for(i=(e=e.split("/")).length-1,d.nodeIdCompat&&h.test(e[i])&&(e[i]=e[i].replace(h,"")),"."===e[0].charAt(0)&&f&&(e=f.slice(0,f.length-1).concat(e)),u=0;u<e.length;u++)if("."===(m=e[u]))e.splice(u,1),u-=1;else if(".."===m){if(0===u||1===u&&".."===e[2]||".."===e[u-1])continue;u>0&&(e.splice(u-1,2),u-=2)}e=e.join("/")}if((f||v)&&g){for(u=(n=e.split("/")).length;u>0;u-=1){if(r=n.slice(0,u).join("/"),f)for(p=f.length;p>0;p-=1)if((a=g[f.slice(0,p).join("/")])&&(a=a[r])){s=a,o=u;break}if(s)break;!l&&v&&v[r]&&(l=v[r],c=u)}!s&&l&&(s=l,o=c),s&&(n.splice(0,o,s),e=n.join("/"))}return e}function v(t,r){return function(){var a=m.call(arguments,0);return"string"!=typeof a[0]&&1===a.length&&a.push(null),n.apply(e,a.concat([t,r]))}}function b(e){return function(t){l[e]=t}}function y(n){if(f(c,n)){var r=c[n];delete c[n],u[n]=!0,t.apply(e,r)}if(!f(l,n)&&!f(u,n))throw new Error("No "+n);return l[n]}function w(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function x(e){return e?w(e):[]}function _(e){return function(){return d&&d.config&&d.config[e]||{}}}i=function(e,t){var n,r,a=w(e),s=a[0],i=t[1];return e=a[1],s&&(n=y(s=g(s,i))),s?e=n&&n.normalize?n.normalize(e,(r=i,function(e){return g(e,r)})):g(e,i):(s=(a=w(e=g(e,i)))[0],e=a[1],s&&(n=y(s))),{f:s?s+"!"+e:e,n:e,pr:s,p:n}},o={require:function(e){return v(e)},exports:function(e){var t=l[e];return void 0!==t?t:l[e]={}},module:function(e){return{id:e,uri:"",exports:l[e],config:_(e)}}},t=function(t,n,r,a){var s,d,p,m,h,g,w,_=[],Z=typeof r;if(g=x(a=a||t),"undefined"===Z||"function"===Z){for(n=!n.length&&r.length?["require","exports","module"]:n,h=0;h<n.length;h+=1)if("require"===(d=(m=i(n[h],g)).f))_[h]=o.require(t);else if("exports"===d)_[h]=o.exports(t),w=!0;else if("module"===d)s=_[h]=o.module(t);else if(f(l,d)||f(c,d)||f(u,d))_[h]=y(d);else{if(!m.p)throw new Error(t+" missing "+d);m.p.load(m.n,v(a,!0),b(d),{}),_[h]=l[d]}p=r?r.apply(l[t],_):void 0,t&&(s&&s.exports!==e&&s.exports!==l[t]?l[t]=s.exports:p===e&&w||(l[t]=p))}else t&&(l[t]=r)},r=a=n=function(r,a,s,l,c){if("string"==typeof r)return o[r]?o[r](a):y(i(r,x(a)).f);if(!r.splice){if((d=r).deps&&n(d.deps,d.callback),!a)return;a.splice?(r=a,a=s,s=null):r=e}return a=a||function(){},"function"==typeof s&&(s=l,l=c),l?t(e,r,a,s):setTimeout((function(){t(e,r,a,s)}),4),n},n.config=function(e){return n(e)},r._defined=l,(s=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),f(l,e)||f(c,e)||(c[e]=[e,t,n])}).amd={jQuery:!0}}(),n.requirejs=r,n.require=a,n.define=s),n.define("almond",(function(){})),n.define("jquery",[],(function(){var e=t||$;return null==e&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),e})),n.define("select2/utils",["jquery"],(function(e){var t={};function n(e){var t=e.prototype,n=[];for(var r in t)"function"==typeof t[r]&&"constructor"!==r&&n.push(r);return n}t.Extend=function(e,t){var n={}.hasOwnProperty;function r(){this.constructor=e}for(var a in t)n.call(t,a)&&(e[a]=t[a]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},t.Decorate=function(e,t){var r=n(t),a=n(e);function s(){var n=Array.prototype.unshift,r=t.prototype.constructor.length,a=e.prototype.constructor;r>0&&(n.call(arguments,e.prototype.constructor),a=t.prototype.constructor),a.apply(this,arguments)}t.displayName=e.displayName,s.prototype=new function(){this.constructor=s};for(var i=0;i<a.length;i++){var o=a[i];s.prototype[o]=e.prototype[o]}for(var l=function(e){var n=function(){};e in s.prototype&&(n=s.prototype[e]);var r=t.prototype[e];return function(){return Array.prototype.unshift.call(arguments,n),r.apply(this,arguments)}},c=0;c<r.length;c++){var d=r[c];s.prototype[d]=l(d)}return s};var r=function(){this.listeners={}};r.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},r.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),n[0]._type=e,e in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},r.prototype.invoke=function(e,t){for(var n=0,r=e.length;n<r;n++)e[n].apply(this,t)},t.Observable=r,t.generateChars=function(e){for(var t="",n=0;n<e;n++)t+=Math.floor(36*Math.random()).toString(36);return t},t.bind=function(e,t){return function(){e.apply(t,arguments)}},t._convertData=function(e){for(var t in e){var n=t.split("-"),r=e;if(1!==n.length){for(var a=0;a<n.length;a++){var s=n[a];(s=s.substring(0,1).toLowerCase()+s.substring(1))in r||(r[s]={}),a==n.length-1&&(r[s]=e[t]),r=r[s]}delete e[t]}}return e},t.hasScroll=function(t,n){var r=e(n),a=n.style.overflowX,s=n.style.overflowY;return(a!==s||"hidden"!==s&&"visible"!==s)&&("scroll"===a||"scroll"===s||r.innerHeight()<n.scrollHeight||r.innerWidth()<n.scrollWidth)},t.escapeMarkup=function(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,(function(e){return t[e]}))},t.__cache={};var a=0;return t.GetUniqueElementId=function(e){var n=e.getAttribute("data-select2-id");return null!=n||(n=e.id?"select2-data-"+e.id:"select2-data-"+(++a).toString()+"-"+t.generateChars(4),e.setAttribute("data-select2-id",n)),n},t.StoreData=function(e,n,r){var a=t.GetUniqueElementId(e);t.__cache[a]||(t.__cache[a]={}),t.__cache[a][n]=r},t.GetData=function(n,r){var a=t.GetUniqueElementId(n);return r?t.__cache[a]&&null!=t.__cache[a][r]?t.__cache[a][r]:e(n).data(r):t.__cache[a]},t.RemoveData=function(e){var n=t.GetUniqueElementId(e);null!=t.__cache[n]&&delete t.__cache[n],e.removeAttribute("data-select2-id")},t.copyNonInternalCssClasses=function(e,t){var n=e.getAttribute("class").trim().split(/\s+/);n=n.filter((function(e){return 0===e.indexOf("select2-")}));var r=t.getAttribute("class").trim().split(/\s+/);r=r.filter((function(e){return 0!==e.indexOf("select2-")}));var a=n.concat(r);e.setAttribute("class",a.join(" "))},t})),n.define("select2/results",["jquery","./utils"],(function(e,t){function n(e,t,r){this.$element=e,this.data=r,this.options=t,n.__super__.constructor.call(this)}return t.Extend(n,t.Observable),n.prototype.render=function(){var t=e('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&t.attr("aria-multiselectable","true"),this.$results=t,t},n.prototype.clear=function(){this.$results.empty()},n.prototype.displayMessage=function(t){var n=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var r=e('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),a=this.options.get("translations").get(t.message);r.append(n(a(t.args))),r[0].className+=" select2-results__message",this.$results.append(r)},n.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},n.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n<e.results.length;n++){var r=e.results[n],a=this.option(r);t.push(a)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},n.prototype.position=function(e,t){t.find(".select2-results").append(e)},n.prototype.sort=function(e){return this.options.get("sorter")(e)},n.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option--selectable"),t=e.filter(".select2-results__option--selected");t.length>0?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},n.prototype.setClasses=function(){var n=this;this.data.current((function(r){var a=r.map((function(e){return e.id.toString()}));n.$results.find(".select2-results__option--selectable").each((function(){var n=e(this),r=t.GetData(this,"data"),s=""+r.id;null!=r.element&&r.element.selected||null==r.element&&a.indexOf(s)>-1?(this.classList.add("select2-results__option--selected"),n.attr("aria-selected","true")):(this.classList.remove("select2-results__option--selected"),n.attr("aria-selected","false"))}))}))},n.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},n=this.option(t);n.className+=" loading-results",this.$results.prepend(n)},n.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},n.prototype.option=function(n){var r=document.createElement("li");r.classList.add("select2-results__option"),r.classList.add("select2-results__option--selectable");var a={role:"option"},s=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(var i in(null!=n.element&&s.call(n.element,":disabled")||null==n.element&&n.disabled)&&(a["aria-disabled"]="true",r.classList.remove("select2-results__option--selectable"),r.classList.add("select2-results__option--disabled")),null==n.id&&r.classList.remove("select2-results__option--selectable"),null!=n._resultId&&(r.id=n._resultId),n.title&&(r.title=n.title),n.children&&(a.role="group",a["aria-label"]=n.text,r.classList.remove("select2-results__option--selectable"),r.classList.add("select2-results__option--group")),a){var o=a[i];r.setAttribute(i,o)}if(n.children){var l=e(r),c=document.createElement("strong");c.className="select2-results__group",this.template(n,c);for(var d=[],u=0;u<n.children.length;u++){var p=n.children[u],m=this.option(p);d.push(m)}var h=e("<ul></ul>",{class:"select2-results__options select2-results__options--nested",role:"none"});h.append(d),l.append(c),l.append(h)}else this.template(n,r);return t.StoreData(r,"data",n),r},n.prototype.bind=function(n,r){var a=this,s=n.id+"-results";this.$results.attr("id",s),n.on("results:all",(function(e){a.clear(),a.append(e.data),n.isOpen()&&(a.setClasses(),a.highlightFirstItem())})),n.on("results:append",(function(e){a.append(e.data),n.isOpen()&&a.setClasses()})),n.on("query",(function(e){a.hideMessages(),a.showLoading(e)})),n.on("select",(function(){n.isOpen()&&(a.setClasses(),a.options.get("scrollAfterSelect")&&a.highlightFirstItem())})),n.on("unselect",(function(){n.isOpen()&&(a.setClasses(),a.options.get("scrollAfterSelect")&&a.highlightFirstItem())})),n.on("open",(function(){a.$results.attr("aria-expanded","true"),a.$results.attr("aria-hidden","false"),a.setClasses(),a.ensureHighlightVisible()})),n.on("close",(function(){a.$results.attr("aria-expanded","false"),a.$results.attr("aria-hidden","true"),a.$results.removeAttr("aria-activedescendant")})),n.on("results:toggle",(function(){var e=a.getHighlightedResults();0!==e.length&&e.trigger("mouseup")})),n.on("results:select",(function(){var e=a.getHighlightedResults();if(0!==e.length){var n=t.GetData(e[0],"data");e.hasClass("select2-results__option--selected")?a.trigger("close",{}):a.trigger("select",{data:n})}})),n.on("results:previous",(function(){var e=a.getHighlightedResults(),t=a.$results.find(".select2-results__option--selectable"),n=t.index(e);if(!(n<=0)){var r=n-1;0===e.length&&(r=0);var s=t.eq(r);s.trigger("mouseenter");var i=a.$results.offset().top,o=s.offset().top,l=a.$results.scrollTop()+(o-i);0===r?a.$results.scrollTop(0):o-i<0&&a.$results.scrollTop(l)}})),n.on("results:next",(function(){var e=a.getHighlightedResults(),t=a.$results.find(".select2-results__option--selectable"),n=t.index(e)+1;if(!(n>=t.length)){var r=t.eq(n);r.trigger("mouseenter");var s=a.$results.offset().top+a.$results.outerHeight(!1),i=r.offset().top+r.outerHeight(!1),o=a.$results.scrollTop()+i-s;0===n?a.$results.scrollTop(0):i>s&&a.$results.scrollTop(o)}})),n.on("results:focus",(function(e){e.element[0].classList.add("select2-results__option--highlighted"),e.element[0].setAttribute("aria-selected","true")})),n.on("results:message",(function(e){a.displayMessage(e)})),e.fn.mousewheel&&this.$results.on("mousewheel",(function(e){var t=a.$results.scrollTop(),n=a.$results.get(0).scrollHeight-t+e.deltaY,r=e.deltaY>0&&t-e.deltaY<=0,s=e.deltaY<0&&n<=a.$results.height();r?(a.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):s&&(a.$results.scrollTop(a.$results.get(0).scrollHeight-a.$results.height()),e.preventDefault(),e.stopPropagation())})),this.$results.on("mouseup",".select2-results__option--selectable",(function(n){var r=e(this),s=t.GetData(this,"data");r.hasClass("select2-results__option--selected")?a.options.get("multiple")?a.trigger("unselect",{originalEvent:n,data:s}):a.trigger("close",{}):a.trigger("select",{originalEvent:n,data:s})})),this.$results.on("mouseenter",".select2-results__option--selectable",(function(n){var r=t.GetData(this,"data");a.getHighlightedResults().removeClass("select2-results__option--highlighted").attr("aria-selected","false"),a.trigger("results:focus",{data:r,element:e(this)})}))},n.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},n.prototype.destroy=function(){this.$results.remove()},n.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find(".select2-results__option--selectable").index(e),n=this.$results.offset().top,r=e.offset().top,a=this.$results.scrollTop()+(r-n),s=r-n;a-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(s>this.$results.outerHeight()||s<0)&&this.$results.scrollTop(a)}},n.prototype.template=function(t,n){var r=this.options.get("templateResult"),a=this.options.get("escapeMarkup"),s=r(t,n);null==s?n.style.display="none":"string"==typeof s?n.innerHTML=a(s):e(n).append(s)},n})),n.define("select2/keys",[],(function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}})),n.define("select2/selection/base",["jquery","../utils","../keys"],(function(e,t,n){function r(e,t){this.$element=e,this.options=t,r.__super__.constructor.call(this)}return t.Extend(r,t.Observable),r.prototype.render=function(){var n=e('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=t.GetData(this.$element[0],"old-tabindex")?this._tabindex=t.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),n.attr("title",this.$element.attr("title")),n.attr("tabindex",this._tabindex),n.attr("aria-disabled","false"),this.$selection=n,n},r.prototype.bind=function(e,t){var r=this,a=e.id+"-results";this.container=e,this.$selection.on("focus",(function(e){r.trigger("focus",e)})),this.$selection.on("blur",(function(e){r._handleBlur(e)})),this.$selection.on("keydown",(function(e){r.trigger("keypress",e),e.which===n.SPACE&&e.preventDefault()})),e.on("results:focus",(function(e){r.$selection.attr("aria-activedescendant",e.data._resultId)})),e.on("selection:update",(function(e){r.update(e.data)})),e.on("open",(function(){r.$selection.attr("aria-expanded","true"),r.$selection.attr("aria-owns",a),r._attachCloseHandler(e)})),e.on("close",(function(){r.$selection.attr("aria-expanded","false"),r.$selection.removeAttr("aria-activedescendant"),r.$selection.removeAttr("aria-owns"),r.$selection.trigger("focus"),r._detachCloseHandler(e)})),e.on("enable",(function(){r.$selection.attr("tabindex",r._tabindex),r.$selection.attr("aria-disabled","false")})),e.on("disable",(function(){r.$selection.attr("tabindex","-1"),r.$selection.attr("aria-disabled","true")}))},r.prototype._handleBlur=function(t){var n=this;window.setTimeout((function(){document.activeElement==n.$selection[0]||e.contains(n.$selection[0],document.activeElement)||n.trigger("blur",t)}),1)},r.prototype._attachCloseHandler=function(n){e(document.body).on("mousedown.select2."+n.id,(function(n){var r=e(n.target).closest(".select2");e(".select2.select2-container--open").each((function(){this!=r[0]&&t.GetData(this,"element").select2("close")}))}))},r.prototype._detachCloseHandler=function(t){e(document.body).off("mousedown.select2."+t.id)},r.prototype.position=function(e,t){t.find(".selection").append(e)},r.prototype.destroy=function(){this._detachCloseHandler(this.container)},r.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},r.prototype.isEnabled=function(){return!this.isDisabled()},r.prototype.isDisabled=function(){return this.options.get("disabled")},r})),n.define("select2/selection/single",["jquery","./base","../utils","../keys"],(function(e,t,n,r){function a(){a.__super__.constructor.apply(this,arguments)}return n.Extend(a,t),a.prototype.render=function(){var e=a.__super__.render.call(this);return e[0].classList.add("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},a.prototype.bind=function(e,t){var n=this;a.__super__.bind.apply(this,arguments);var r=e.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",r).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",r),this.$selection.attr("aria-controls",r),this.$selection.on("mousedown",(function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})})),this.$selection.on("focus",(function(e){})),this.$selection.on("blur",(function(e){})),e.on("focus",(function(t){e.isOpen()||n.$selection.trigger("focus")}))},a.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},a.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},a.prototype.selectionContainer=function(){return e("<span></span>")},a.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),r=this.display(t,n);n.empty().append(r);var a=t.title||t.text;a?n.attr("title",a):n.removeAttr("title")}else this.clear()},a})),n.define("select2/selection/multiple",["jquery","./base","../utils"],(function(e,t,n){function r(e,t){r.__super__.constructor.apply(this,arguments)}return n.Extend(r,t),r.prototype.render=function(){var e=r.__super__.render.call(this);return e[0].classList.add("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},r.prototype.bind=function(t,a){var s=this;r.__super__.bind.apply(this,arguments);var i=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",i),this.$selection.on("click",(function(e){s.trigger("toggle",{originalEvent:e})})),this.$selection.on("click",".select2-selection__choice__remove",(function(t){if(!s.isDisabled()){var r=e(this).parent(),a=n.GetData(r[0],"data");s.trigger("unselect",{originalEvent:t,data:a})}})),this.$selection.on("keydown",".select2-selection__choice__remove",(function(e){s.isDisabled()||e.stopPropagation()}))},r.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},r.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},r.prototype.selectionContainer=function(){return e('<li class="select2-selection__choice"><button type="button" class="select2-selection__choice__remove" tabindex="-1"><span aria-hidden="true">&times;</span></button><span class="select2-selection__choice__display"></span></li>')},r.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],r=this.$selection.find(".select2-selection__rendered").attr("id")+"-choice-",a=0;a<e.length;a++){var s=e[a],i=this.selectionContainer(),o=this.display(s,i),l=r+n.generateChars(4)+"-";s.id?l+=s.id:l+=n.generateChars(4),i.find(".select2-selection__choice__display").append(o).attr("id",l);var c=s.title||s.text;c&&i.attr("title",c);var d=this.options.get("translations").get("removeItem"),u=i.find(".select2-selection__choice__remove");u.attr("title",d()),u.attr("aria-label",d()),u.attr("aria-describedby",l),n.StoreData(i[0],"data",s),t.push(i)}this.$selection.find(".select2-selection__rendered").append(t)}},r})),n.define("select2/selection/placeholder",[],(function(){function e(e,t,n){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n)}return e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.createPlaceholder=function(e,t){var n=this.selectionContainer();n.html(this.display(t)),n[0].classList.add("select2-selection__placeholder"),n[0].classList.remove("select2-selection__choice");var r=t.title||t.text||n.text();return this.$selection.find(".select2-selection__rendered").attr("title",r),n},e.prototype.update=function(e,t){var n=1==t.length&&t[0].id!=this.placeholder.id;if(t.length>1||n)return e.call(this,t);this.clear();var r=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(r)},e})),n.define("select2/selection/allowClear",["jquery","../keys","../utils"],(function(e,t,n){function r(){}return r.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",(function(e){r._handleClear(e)})),t.on("keypress",(function(e){r._handleKeyboardClear(e,t)}))},r.prototype._handleClear=function(e,t){if(!this.isDisabled()){var r=this.$selection.find(".select2-selection__clear");if(0!==r.length){t.stopPropagation();var a=n.GetData(r[0],"data"),s=this.$element.val();this.$element.val(this.placeholder.id);var i={data:a};if(this.trigger("clear",i),i.prevented)this.$element.val(s);else{for(var o=0;o<a.length;o++)if(i={data:a[o]},this.trigger("unselect",i),i.prevented)return void this.$element.val(s);this.$element.trigger("input").trigger("change"),this.trigger("toggle",{})}}}},r.prototype._handleKeyboardClear=function(e,n,r){r.isOpen()||n.which!=t.DELETE&&n.which!=t.BACKSPACE||this._handleClear(n)},r.prototype.update=function(t,r){if(t.call(this,r),this.$selection.find(".select2-selection__clear").remove(),this.$selection[0].classList.remove("select2-selection--clearable"),!(this.$selection.find(".select2-selection__placeholder").length>0||0===r.length)){var a=this.$selection.find(".select2-selection__rendered").attr("id"),s=this.options.get("translations").get("removeAllItems"),i=e('<button type="button" class="select2-selection__clear" tabindex="-1"><span aria-hidden="true">&times;</span></button>');i.attr("title",s()),i.attr("aria-label",s()),i.attr("aria-describedby",a),n.StoreData(i[0],"data",r),this.$selection.prepend(i),this.$selection[0].classList.add("select2-selection--clearable")}},r})),n.define("select2/selection/search",["jquery","../utils","../keys"],(function(e,t,n){function r(e,t,n){e.call(this,t,n)}return r.prototype.render=function(t){var n=this.options.get("translations").get("search"),r=e('<span class="select2-search select2-search--inline"><textarea class="select2-search__field" type="search" tabindex="-1" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" ></textarea></span>');this.$searchContainer=r,this.$search=r.find("textarea"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",n());var a=t.call(this);return this._transferTabIndex(),a.append(this.$searchContainer),a},r.prototype.bind=function(e,r,a){var s=this,i=r.id+"-results",o=r.id+"-container";e.call(this,r,a),s.$search.attr("aria-describedby",o),r.on("open",(function(){s.$search.attr("aria-controls",i),s.$search.trigger("focus")})),r.on("close",(function(){s.$search.val(""),s.resizeSearch(),s.$search.removeAttr("aria-controls"),s.$search.removeAttr("aria-activedescendant"),s.$search.trigger("focus")})),r.on("enable",(function(){s.$search.prop("disabled",!1),s._transferTabIndex()})),r.on("disable",(function(){s.$search.prop("disabled",!0)})),r.on("focus",(function(e){s.$search.trigger("focus")})),r.on("results:focus",(function(e){e.data._resultId?s.$search.attr("aria-activedescendant",e.data._resultId):s.$search.removeAttr("aria-activedescendant")})),this.$selection.on("focusin",".select2-search--inline",(function(e){s.trigger("focus",e)})),this.$selection.on("focusout",".select2-search--inline",(function(e){s._handleBlur(e)})),this.$selection.on("keydown",".select2-search--inline",(function(e){if(e.stopPropagation(),s.trigger("keypress",e),s._keyUpPrevented=e.isDefaultPrevented(),e.which===n.BACKSPACE&&""===s.$search.val()){var r=s.$selection.find(".select2-selection__choice").last();if(r.length>0){var a=t.GetData(r[0],"data");s.searchRemoveChoice(a),e.preventDefault()}}})),this.$selection.on("click",".select2-search--inline",(function(e){s.$search.val()&&e.stopPropagation()}));var l=document.documentMode,c=l&&l<=11;this.$selection.on("input.searchcheck",".select2-search--inline",(function(e){c?s.$selection.off("input.search input.searchcheck"):s.$selection.off("keyup.search")})),this.$selection.on("keyup.search input.search",".select2-search--inline",(function(e){if(c&&"input"===e.type)s.$selection.off("input.search input.searchcheck");else{var t=e.which;t!=n.SHIFT&&t!=n.CTRL&&t!=n.ALT&&t!=n.TAB&&s.handleSearch(e)}}))},r.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},r.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},r.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.resizeSearch(),n&&this.$search.trigger("focus")},r.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},r.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},r.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="100%";""===this.$search.attr("placeholder")&&(e=.75*(this.$search.val().length+1)+"em"),this.$search.css("width",e)},r})),n.define("select2/selection/selectionCss",["../utils"],(function(e){function t(){}return t.prototype.render=function(t){var n=t.call(this),r=this.options.get("selectionCssClass")||"";return-1!==r.indexOf(":all:")&&(r=r.replace(":all:",""),e.copyNonInternalCssClasses(n[0],this.$element[0])),n.addClass(r),n},t})),n.define("select2/selection/eventRelay",["jquery"],(function(e){function t(){}return t.prototype.bind=function(t,n,r){var a=this,s=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],i=["opening","closing","selecting","unselecting","clearing"];t.call(this,n,r),n.on("*",(function(t,n){if(-1!==s.indexOf(t)){n=n||{};var r=e.Event("select2:"+t,{params:n});a.$element.trigger(r),-1!==i.indexOf(t)&&(n.prevented=r.isDefaultPrevented())}}))},t})),n.define("select2/translation",["jquery","require"],(function(e,t){function n(e){this.dict=e||{}}return n.prototype.all=function(){return this.dict},n.prototype.get=function(e){return this.dict[e]},n.prototype.extend=function(t){this.dict=e.extend({},t.all(),this.dict)},n._cache={},n.loadPath=function(e){if(!(e in n._cache)){var r=t(e);n._cache[e]=r}return new n(n._cache[e])},n})),n.define("select2/diacritics",[],(function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Œ":"OE","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","œ":"oe","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"}})),n.define("select2/data/base",["../utils"],(function(e){function t(e,n){t.__super__.constructor.call(this)}return e.Extend(t,e.Observable),t.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},t.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},t.prototype.bind=function(e,t){},t.prototype.destroy=function(){},t.prototype.generateResultId=function(t,n){var r=t.id+"-result-";return r+=e.generateChars(4),null!=n.id?r+="-"+n.id.toString():r+="-"+e.generateChars(4),r},t})),n.define("select2/data/select",["./base","../utils","jquery"],(function(e,t,n){function r(e,t){this.$element=e,this.options=t,r.__super__.constructor.call(this)}return t.Extend(r,e),r.prototype.current=function(e){var t=this;e(Array.prototype.map.call(this.$element[0].querySelectorAll(":checked"),(function(e){return t.item(n(e))})))},r.prototype.select=function(e){var t=this;if(e.selected=!0,null!=e.element&&"option"===e.element.tagName.toLowerCase())return e.element.selected=!0,void this.$element.trigger("input").trigger("change");if(this.$element.prop("multiple"))this.current((function(n){var r=[];(e=[e]).push.apply(e,n);for(var a=0;a<e.length;a++){var s=e[a].id;-1===r.indexOf(s)&&r.push(s)}t.$element.val(r),t.$element.trigger("input").trigger("change")}));else{var n=e.id;this.$element.val(n),this.$element.trigger("input").trigger("change")}},r.prototype.unselect=function(e){var t=this;if(this.$element.prop("multiple")){if(e.selected=!1,null!=e.element&&"option"===e.element.tagName.toLowerCase())return e.element.selected=!1,void this.$element.trigger("input").trigger("change");this.current((function(n){for(var r=[],a=0;a<n.length;a++){var s=n[a].id;s!==e.id&&-1===r.indexOf(s)&&r.push(s)}t.$element.val(r),t.$element.trigger("input").trigger("change")}))}},r.prototype.bind=function(e,t){var n=this;this.container=e,e.on("select",(function(e){n.select(e.data)})),e.on("unselect",(function(e){n.unselect(e.data)}))},r.prototype.destroy=function(){this.$element.find("*").each((function(){t.RemoveData(this)}))},r.prototype.query=function(e,t){var r=[],a=this;this.$element.children().each((function(){if("option"===this.tagName.toLowerCase()||"optgroup"===this.tagName.toLowerCase()){var t=n(this),s=a.item(t),i=a.matches(e,s);null!==i&&r.push(i)}})),t({results:r})},r.prototype.addOptions=function(e){this.$element.append(e)},r.prototype.option=function(e){var r;e.children?(r=document.createElement("optgroup")).label=e.text:void 0!==(r=document.createElement("option")).textContent?r.textContent=e.text:r.innerText=e.text,void 0!==e.id&&(r.value=e.id),e.disabled&&(r.disabled=!0),e.selected&&(r.selected=!0),e.title&&(r.title=e.title);var a=this._normalizeItem(e);return a.element=r,t.StoreData(r,"data",a),n(r)},r.prototype.item=function(e){var r={};if(null!=(r=t.GetData(e[0],"data")))return r;var a=e[0];if("option"===a.tagName.toLowerCase())r={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if("optgroup"===a.tagName.toLowerCase()){r={text:e.prop("label"),children:[],title:e.prop("title")};for(var s=e.children("option"),i=[],o=0;o<s.length;o++){var l=n(s[o]),c=this.item(l);i.push(c)}r.children=i}return(r=this._normalizeItem(r)).element=e[0],t.StoreData(e[0],"data",r),r},r.prototype._normalizeItem=function(e){e!==Object(e)&&(e={id:e,text:e});return null!=(e=n.extend({},{text:""},e)).id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),n.extend({},{selected:!1,disabled:!1},e)},r.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},r})),n.define("select2/data/array",["./select","../utils","jquery"],(function(e,t,n){function r(e,t){this._dataToConvert=t.get("data")||[],r.__super__.constructor.call(this,e,t)}return t.Extend(r,e),r.prototype.bind=function(e,t){r.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},r.prototype.select=function(e){var t=this.$element.find("option").filter((function(t,n){return n.value==e.id.toString()}));0===t.length&&(t=this.option(e),this.addOptions(t)),r.__super__.select.call(this,e)},r.prototype.convertToOptions=function(e){var t=this,r=this.$element.find("option"),a=r.map((function(){return t.item(n(this)).id})).get(),s=[];function i(e){return function(){return n(this).val()==e.id}}for(var o=0;o<e.length;o++){var l=this._normalizeItem(e[o]);if(a.indexOf(l.id)>=0){var c=r.filter(i(l)),d=this.item(c),u=n.extend(!0,{},l,d),p=this.option(u);c.replaceWith(p)}else{var m=this.option(l);if(l.children){var h=this.convertToOptions(l.children);m.append(h)}s.push(m)}}return s},r})),n.define("select2/data/ajax",["./array","../utils","jquery"],(function(e,t,n){function r(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),r.__super__.constructor.call(this,e,t)}return t.Extend(r,e),r.prototype._applyDefaults=function(e){var t={data:function(e){return n.extend({},e,{q:e.term})},transport:function(e,t,r){var a=n.ajax(e);return a.then(t),a.fail(r),a}};return n.extend({},t,e,!0)},r.prototype.processResults=function(e){return e},r.prototype.query=function(e,t){var r=this;null!=this._request&&("function"==typeof this._request.abort&&this._request.abort(),this._request=null);var a=n.extend({type:"GET"},this.ajaxOptions);function s(){var n=a.transport(a,(function(n){var a=r.processResults(n,e);r.options.get("debug")&&window.console&&console.error&&(a&&a.results&&Array.isArray(a.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),t(a)}),(function(){(!("status"in n)||0!==n.status&&"0"!==n.status)&&r.trigger("results:message",{message:"errorLoading"})}));r._request=n}"function"==typeof a.url&&(a.url=a.url.call(this.$element,e)),"function"==typeof a.data&&(a.data=a.data.call(this.$element,e)),this.ajaxOptions.delay&&null!=e.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(s,this.ajaxOptions.delay)):s()},r})),n.define("select2/data/tags",["jquery"],(function(e){function t(e,t,n){var r=n.get("tags"),a=n.get("createTag");void 0!==a&&(this.createTag=a);var s=n.get("insertTag");if(void 0!==s&&(this.insertTag=s),e.call(this,t,n),Array.isArray(r))for(var i=0;i<r.length;i++){var o=r[i],l=this._normalizeItem(o),c=this.option(l);this.$element.append(c)}}return t.prototype.query=function(e,t,n){var r=this;this._removeOldTags(),null!=t.term&&null==t.page?e.call(this,t,(function e(a,s){for(var i=a.results,o=0;o<i.length;o++){var l=i[o],c=null!=l.children&&!e({results:l.children},!0);if((l.text||"").toUpperCase()===(t.term||"").toUpperCase()||c)return!s&&(a.data=i,void n(a))}if(s)return!0;var d=r.createTag(t);if(null!=d){var u=r.option(d);u.attr("data-select2-tag","true"),r.addOptions([u]),r.insertTag(i,d)}a.results=i,n(a)})):e.call(this,t,n)},t.prototype.createTag=function(e,t){if(null==t.term)return null;var n=t.term.trim();return""===n?null:{id:n,text:n}},t.prototype.insertTag=function(e,t,n){t.unshift(n)},t.prototype._removeOldTags=function(t){this.$element.find("option[data-select2-tag]").each((function(){this.selected||e(this).remove()}))},t})),n.define("select2/data/tokenizer",["jquery"],(function(e){function t(e,t,n){var r=n.get("tokenizer");void 0!==r&&(this.tokenizer=r),e.call(this,t,n)}return t.prototype.bind=function(e,t,n){e.call(this,t,n),this.$search=t.dropdown.$search||t.selection.$search||n.find(".select2-search__field")},t.prototype.query=function(t,n,r){var a=this;n.term=n.term||"";var s=this.tokenizer(n,this.options,(function(t){var n=a._normalizeItem(t);if(!a.$element.find("option").filter((function(){return e(this).val()===n.id})).length){var r=a.option(n);r.attr("data-select2-tag",!0),a._removeOldTags(),a.addOptions([r])}!function(e){a.trigger("select",{data:e})}(n)}));s.term!==n.term&&(this.$search.length&&(this.$search.val(s.term),this.$search.trigger("focus")),n.term=s.term),t.call(this,n,r)},t.prototype.tokenizer=function(t,n,r,a){for(var s=r.get("tokenSeparators")||[],i=n.term,o=0,l=this.createTag||function(e){return{id:e.term,text:e.term}};o<i.length;){var c=i[o];if(-1!==s.indexOf(c)){var d=i.substr(0,o),u=l(e.extend({},n,{term:d}));null!=u?(a(u),i=i.substr(o+1)||"",o=0):o++}else o++}return{term:i}},t})),n.define("select2/data/minimumInputLength",[],(function(){function e(e,t,n){this.minimumInputLength=n.get("minimumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e})),n.define("select2/data/maximumInputLength",[],(function(){function e(e,t,n){this.maximumInputLength=n.get("maximumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",this.maximumInputLength>0&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e})),n.define("select2/data/maximumSelectionLength",[],(function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",(function(){r._checkIfMaximumSelected()}))},e.prototype.query=function(e,t,n){var r=this;this._checkIfMaximumSelected((function(){e.call(r,t,n)}))},e.prototype._checkIfMaximumSelected=function(e,t){var n=this;this.current((function(e){var r=null!=e?e.length:0;n.maximumSelectionLength>0&&r>=n.maximumSelectionLength?n.trigger("results:message",{message:"maximumSelected",args:{maximum:n.maximumSelectionLength}}):t&&t()}))},e})),n.define("select2/dropdown",["jquery","./utils"],(function(e,t){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return t.Extend(n,t.Observable),n.prototype.render=function(){var t=e('<span class="select2-dropdown"><span class="select2-results"></span></span>');return t.attr("dir",this.options.get("dir")),this.$dropdown=t,t},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n})),n.define("select2/dropdown/search",["jquery"],(function(e){function t(){}return t.prototype.render=function(t){var n=t.call(this),r=this.options.get("translations").get("search"),a=e('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></span>');return this.$searchContainer=a,this.$search=a.find("input"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",r()),n.prepend(a),n},t.prototype.bind=function(t,n,r){var a=this,s=n.id+"-results";t.call(this,n,r),this.$search.on("keydown",(function(e){a.trigger("keypress",e),a._keyUpPrevented=e.isDefaultPrevented()})),this.$search.on("input",(function(t){e(this).off("keyup")})),this.$search.on("keyup input",(function(e){a.handleSearch(e)})),n.on("open",(function(){a.$search.attr("tabindex",0),a.$search.attr("aria-controls",s),a.$search.trigger("focus"),window.setTimeout((function(){a.$search.trigger("focus")}),0)})),n.on("close",(function(){a.$search.attr("tabindex",-1),a.$search.removeAttr("aria-controls"),a.$search.removeAttr("aria-activedescendant"),a.$search.val(""),a.$search.trigger("blur")})),n.on("focus",(function(){n.isOpen()||a.$search.trigger("focus")})),n.on("results:all",(function(e){null!=e.query.term&&""!==e.query.term||(a.showSearch(e)?a.$searchContainer[0].classList.remove("select2-search--hide"):a.$searchContainer[0].classList.add("select2-search--hide"))})),n.on("results:focus",(function(e){e.data._resultId?a.$search.attr("aria-activedescendant",e.data._resultId):a.$search.removeAttr("aria-activedescendant")}))},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t})),n.define("select2/dropdown/hidePlaceholder",[],(function(){function e(e,t,n,r){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,r)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),r=t.length-1;r>=0;r--){var a=t[r];this.placeholder.id===a.id&&n.splice(r,1)}return n},e})),n.define("select2/dropdown/infiniteScroll",["jquery"],(function(e){function t(e,t,n,r){this.lastParams={},e.call(this,t,n,r),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return t.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},t.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("query",(function(e){r.lastParams=e,r.loading=!0})),t.on("query:append",(function(e){r.lastParams=e,r.loading=!0})),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},t.prototype.loadMoreIfNeeded=function(){var t=e.contains(document.documentElement,this.$loadingMore[0]);!this.loading&&t&&this.$results.offset().top+this.$results.outerHeight(!1)+50>=this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)&&this.loadMore()},t.prototype.loadMore=function(){this.loading=!0;var t=e.extend({},{page:1},this.lastParams);t.page++,this.trigger("query:append",t)},t.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},t.prototype.createLoadingMore=function(){var t=e('<li class="select2-results__option select2-results__option--load-more"role="option" aria-disabled="true"></li>'),n=this.options.get("translations").get("loadingMore");return t.html(n(this.lastParams)),t},t})),n.define("select2/dropdown/attachBody",["jquery","../utils"],(function(e,t){function n(t,n,r){this.$dropdownParent=e(r.get("dropdownParent")||document.body),t.call(this,n,r)}return n.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("open",(function(){r._showDropdown(),r._attachPositioningHandler(t),r._bindContainerResultHandlers(t)})),t.on("close",(function(){r._hideDropdown(),r._detachPositioningHandler(t)})),this.$dropdownContainer.on("mousedown",(function(e){e.stopPropagation()}))},n.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},n.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t[0].classList.remove("select2"),t[0].classList.add("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},n.prototype.render=function(t){var n=e("<span></span>"),r=t.call(this);return n.append(r),this.$dropdownContainer=n,n},n.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},n.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",(function(){n._positionDropdown(),n._resizeDropdown()})),t.on("results:append",(function(){n._positionDropdown(),n._resizeDropdown()})),t.on("results:message",(function(){n._positionDropdown(),n._resizeDropdown()})),t.on("select",(function(){n._positionDropdown(),n._resizeDropdown()})),t.on("unselect",(function(){n._positionDropdown(),n._resizeDropdown()})),this._containerResultsHandlersBound=!0}},n.prototype._attachPositioningHandler=function(n,r){var a=this,s="scroll.select2."+r.id,i="resize.select2."+r.id,o="orientationchange.select2."+r.id,l=this.$container.parents().filter(t.hasScroll);l.each((function(){t.StoreData(this,"select2-scroll-position",{x:e(this).scrollLeft(),y:e(this).scrollTop()})})),l.on(s,(function(n){var r=t.GetData(this,"select2-scroll-position");e(this).scrollTop(r.y)})),e(window).on(s+" "+i+" "+o,(function(e){a._positionDropdown(),a._resizeDropdown()}))},n.prototype._detachPositioningHandler=function(n,r){var a="scroll.select2."+r.id,s="resize.select2."+r.id,i="orientationchange.select2."+r.id;this.$container.parents().filter(t.hasScroll).off(a),e(window).off(a+" "+s+" "+i)},n.prototype._positionDropdown=function(){var t=e(window),n=this.$dropdown[0].classList.contains("select2-dropdown--above"),r=this.$dropdown[0].classList.contains("select2-dropdown--below"),a=null,s=this.$container.offset();s.bottom=s.top+this.$container.outerHeight(!1);var i={height:this.$container.outerHeight(!1)};i.top=s.top,i.bottom=s.top+i.height;var o=this.$dropdown.outerHeight(!1),l=t.scrollTop(),c=t.scrollTop()+t.height(),d=l<s.top-o,u=c>s.bottom+o,p={left:s.left,top:i.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var h={top:0,left:0};(e.contains(document.body,m[0])||m[0].isConnected)&&(h=m.offset()),p.top-=h.top,p.left-=h.left,n||r||(a="below"),u||!d||n?!d&&u&&n&&(a="below"):a="above",("above"==a||n&&"below"!==a)&&(p.top=i.top-h.top-o),null!=a&&(this.$dropdown[0].classList.remove("select2-dropdown--below"),this.$dropdown[0].classList.remove("select2-dropdown--above"),this.$dropdown[0].classList.add("select2-dropdown--"+a),this.$container[0].classList.remove("select2-container--below"),this.$container[0].classList.remove("select2-container--above"),this.$container[0].classList.add("select2-container--"+a)),this.$dropdownContainer.css(p)},n.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},n.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},n})),n.define("select2/dropdown/minimumResultsForSearch",[],(function(){function e(t){for(var n=0,r=0;r<t.length;r++){var a=t[r];a.children?n+=e(a.children):n++}return n}function t(e,t,n,r){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,r)}return t.prototype.showSearch=function(t,n){return!(e(n.data.results)<this.minimumResultsForSearch)&&t.call(this,n)},t})),n.define("select2/dropdown/selectOnClose",["../utils"],(function(e){function t(){}return t.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("close",(function(e){r._handleSelectOnClose(e)}))},t.prototype._handleSelectOnClose=function(t,n){if(n&&null!=n.originalSelect2Event){var r=n.originalSelect2Event;if("select"===r._type||"unselect"===r._type)return}var a=this.getHighlightedResults();if(!(a.length<1)){var s=e.GetData(a[0],"data");null!=s.element&&s.element.selected||null==s.element&&s.selected||this.trigger("select",{data:s})}},t})),n.define("select2/dropdown/closeOnSelect",[],(function(){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",(function(e){r._selectTriggered(e)})),t.on("unselect",(function(e){r._selectTriggered(e)}))},e.prototype._selectTriggered=function(e,t){var n=t.originalEvent;n&&(n.ctrlKey||n.metaKey)||this.trigger("close",{originalEvent:n,originalSelect2Event:t})},e})),n.define("select2/dropdown/dropdownCss",["../utils"],(function(e){function t(){}return t.prototype.render=function(t){var n=t.call(this),r=this.options.get("dropdownCssClass")||"";return-1!==r.indexOf(":all:")&&(r=r.replace(":all:",""),e.copyNonInternalCssClasses(n[0],this.$element[0])),n.addClass(r),n},t})),n.define("select2/dropdown/tagsSearchHighlight",["../utils"],(function(e){function t(){}return t.prototype.highlightFirstItem=function(t){var n=this.$results.find(".select2-results__option--selectable:not(.select2-results__option--selected)");if(n.length>0){var r=n.first(),a=e.GetData(r[0],"data").element;if(a&&a.getAttribute&&"true"===a.getAttribute("data-select2-tag"))return void r.trigger("mouseenter")}t.call(this)},t})),n.define("select2/i18n/en",[],(function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return 1!=t&&(n+="s"),n},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"},removeItem:function(){return"Remove item"},search:function(){return"Search"}}})),n.define("select2/defaults",["jquery","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/selectionCss","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./dropdown/dropdownCss","./dropdown/tagsSearchHighlight","./i18n/en"],(function(e,t,n,r,a,s,i,o,l,c,d,u,p,m,h,f,g,v,b,y,w,x,_,Z,j,I,S,C,T,k,N){function D(){this.reset()}return D.prototype.apply=function(d){if(null==(d=e.extend(!0,{},this.defaults,d)).dataAdapter&&(null!=d.ajax?d.dataAdapter=h:null!=d.data?d.dataAdapter=m:d.dataAdapter=p,d.minimumInputLength>0&&(d.dataAdapter=c.Decorate(d.dataAdapter,v)),d.maximumInputLength>0&&(d.dataAdapter=c.Decorate(d.dataAdapter,b)),d.maximumSelectionLength>0&&(d.dataAdapter=c.Decorate(d.dataAdapter,y)),d.tags&&(d.dataAdapter=c.Decorate(d.dataAdapter,f)),null==d.tokenSeparators&&null==d.tokenizer||(d.dataAdapter=c.Decorate(d.dataAdapter,g))),null==d.resultsAdapter&&(d.resultsAdapter=t,null!=d.ajax&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,Z)),null!=d.placeholder&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,_)),d.selectOnClose&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,S)),d.tags&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,k))),null==d.dropdownAdapter){if(d.multiple)d.dropdownAdapter=w;else{var u=c.Decorate(w,x);d.dropdownAdapter=u}0!==d.minimumResultsForSearch&&(d.dropdownAdapter=c.Decorate(d.dropdownAdapter,I)),d.closeOnSelect&&(d.dropdownAdapter=c.Decorate(d.dropdownAdapter,C)),null!=d.dropdownCssClass&&(d.dropdownAdapter=c.Decorate(d.dropdownAdapter,T)),d.dropdownAdapter=c.Decorate(d.dropdownAdapter,j)}null==d.selectionAdapter&&(d.multiple?d.selectionAdapter=r:d.selectionAdapter=n,null!=d.placeholder&&(d.selectionAdapter=c.Decorate(d.selectionAdapter,a)),d.allowClear&&(d.selectionAdapter=c.Decorate(d.selectionAdapter,s)),d.multiple&&(d.selectionAdapter=c.Decorate(d.selectionAdapter,i)),null!=d.selectionCssClass&&(d.selectionAdapter=c.Decorate(d.selectionAdapter,o)),d.selectionAdapter=c.Decorate(d.selectionAdapter,l)),d.language=this._resolveLanguage(d.language),d.language.push("en");for(var N=[],D=0;D<d.language.length;D++){var E=d.language[D];-1===N.indexOf(E)&&N.push(E)}return d.language=N,d.translations=this._processTranslations(d.language,d.debug),d},D.prototype.reset=function(){function t(e){return e.replace(/[^\u0000-\u007E]/g,(function(e){return u[e]||e}))}this.defaults={amdLanguageBase:"./i18n/",autocomplete:"off",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:c.escapeMarkup,language:{},matcher:function n(r,a){if(null==r.term||""===r.term.trim())return a;if(a.children&&a.children.length>0){for(var s=e.extend(!0,{},a),i=a.children.length-1;i>=0;i--)null==n(r,a.children[i])&&s.children.splice(i,1);return s.children.length>0?s:n(r,s)}var o=t(a.text).toUpperCase(),l=t(r.term).toUpperCase();return o.indexOf(l)>-1?a:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,scrollAfterSelect:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},D.prototype.applyFromElement=function(e,t){var n=e.language,r=this.defaults.language,a=t.prop("lang"),s=t.closest("[lang]").prop("lang"),i=Array.prototype.concat.call(this._resolveLanguage(a),this._resolveLanguage(n),this._resolveLanguage(r),this._resolveLanguage(s));return e.language=i,e},D.prototype._resolveLanguage=function(t){if(!t)return[];if(e.isEmptyObject(t))return[];if(e.isPlainObject(t))return[t];var n;n=Array.isArray(t)?t:[t];for(var r=[],a=0;a<n.length;a++)if(r.push(n[a]),"string"==typeof n[a]&&n[a].indexOf("-")>0){var s=n[a].split("-")[0];r.push(s)}return r},D.prototype._processTranslations=function(t,n){for(var r=new d,a=0;a<t.length;a++){var s=new d,i=t[a];if("string"==typeof i)try{s=d.loadPath(i)}catch(e){try{i=this.defaults.amdLanguageBase+i,s=d.loadPath(i)}catch(e){n&&window.console&&console.warn&&console.warn('Select2: The language file for "'+i+'" could not be automatically loaded. A fallback will be used instead.')}}else s=e.isPlainObject(i)?new d(i):i;r.extend(s)}return r},D.prototype.set=function(t,n){var r={};r[e.camelCase(t)]=n;var a=c._convertData(r);e.extend(!0,this.defaults,a)},new D})),n.define("select2/options",["jquery","./defaults","./utils"],(function(e,t,n){function r(e,n){this.options=e,null!=n&&this.fromElement(n),null!=n&&(this.options=t.applyFromElement(this.options,n)),this.options=t.apply(this.options)}return r.prototype.fromElement=function(t){var r=["select2"];null==this.options.multiple&&(this.options.multiple=t.prop("multiple")),null==this.options.disabled&&(this.options.disabled=t.prop("disabled")),null==this.options.autocomplete&&t.prop("autocomplete")&&(this.options.autocomplete=t.prop("autocomplete")),null==this.options.dir&&(t.prop("dir")?this.options.dir=t.prop("dir"):t.closest("[dir]").prop("dir")?this.options.dir=t.closest("[dir]").prop("dir"):this.options.dir="ltr"),t.prop("disabled",this.options.disabled),t.prop("multiple",this.options.multiple),n.GetData(t[0],"select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),n.StoreData(t[0],"data",n.GetData(t[0],"select2Tags")),n.StoreData(t[0],"tags",!0)),n.GetData(t[0],"ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),t.attr("ajax--url",n.GetData(t[0],"ajaxUrl")),n.StoreData(t[0],"ajax-Url",n.GetData(t[0],"ajaxUrl")));var a={};function s(e,t){return t.toUpperCase()}for(var i=0;i<t[0].attributes.length;i++){var o=t[0].attributes[i].name,l="data-";if(o.substr(0,l.length)==l){var c=o.substring(l.length),d=n.GetData(t[0],c);a[c.replace(/-([a-z])/g,s)]=d}}e.fn.jquery&&"1."==e.fn.jquery.substr(0,2)&&t[0].dataset&&(a=e.extend(!0,{},t[0].dataset,a));var u=e.extend(!0,{},n.GetData(t[0]),a);for(var p in u=n._convertData(u))r.indexOf(p)>-1||(e.isPlainObject(this.options[p])?e.extend(this.options[p],u[p]):this.options[p]=u[p]);return this},r.prototype.get=function(e){return this.options[e]},r.prototype.set=function(e,t){this.options[e]=t},r})),n.define("select2/core",["jquery","./options","./utils","./keys"],(function(e,t,n,r){var a=function(e,r){null!=n.GetData(e[0],"select2")&&n.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),r=r||{},this.options=new t(r,e),a.__super__.constructor.call(this);var s=e.attr("tabindex")||0;n.StoreData(e[0],"old-tabindex",s),e.attr("tabindex","-1");var i=this.options.get("dataAdapter");this.dataAdapter=new i(e,this.options);var o=this.render();this._placeContainer(o);var l=this.options.get("selectionAdapter");this.selection=new l(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,o);var c=this.options.get("dropdownAdapter");this.dropdown=new c(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,o);var d=this.options.get("resultsAdapter");this.results=new d(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var u=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current((function(e){u.trigger("selection:update",{data:e})})),e[0].classList.add("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),n.StoreData(e[0],"select2",this),e.data("select2",this)};return n.Extend(a,n.Observable),a.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+n.generateChars(2):n.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},a.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},a.prototype._resolveWidth=function(e,t){var n=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var r=this._resolveWidth(e,"style");return null!=r?r:this._resolveWidth(e,"element")}if("element"==t){var a=e.outerWidth(!1);return a<=0?"auto":a+"px"}if("style"==t){var s=e.attr("style");if("string"!=typeof s)return null;for(var i=s.split(";"),o=0,l=i.length;o<l;o+=1){var c=i[o].replace(/\s/g,"").match(n);if(null!==c&&c.length>=1)return c[1]}return null}return"computedstyle"==t?window.getComputedStyle(e[0]).width:t},a.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},a.prototype._registerDomEvents=function(){var e=this;this.$element.on("change.select2",(function(){e.dataAdapter.current((function(t){e.trigger("selection:update",{data:t})}))})),this.$element.on("focus.select2",(function(t){e.trigger("focus",t)})),this._syncA=n.bind(this._syncAttributes,this),this._syncS=n.bind(this._syncSubtree,this),this._observer=new window.MutationObserver((function(t){e._syncA(),e._syncS(t)})),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})},a.prototype._registerDataEvents=function(){var e=this;this.dataAdapter.on("*",(function(t,n){e.trigger(t,n)}))},a.prototype._registerSelectionEvents=function(){var e=this,t=["toggle","focus"];this.selection.on("toggle",(function(){e.toggleDropdown()})),this.selection.on("focus",(function(t){e.focus(t)})),this.selection.on("*",(function(n,r){-1===t.indexOf(n)&&e.trigger(n,r)}))},a.prototype._registerDropdownEvents=function(){var e=this;this.dropdown.on("*",(function(t,n){e.trigger(t,n)}))},a.prototype._registerResultsEvents=function(){var e=this;this.results.on("*",(function(t,n){e.trigger(t,n)}))},a.prototype._registerEvents=function(){var e=this;this.on("open",(function(){e.$container[0].classList.add("select2-container--open")})),this.on("close",(function(){e.$container[0].classList.remove("select2-container--open")})),this.on("enable",(function(){e.$container[0].classList.remove("select2-container--disabled")})),this.on("disable",(function(){e.$container[0].classList.add("select2-container--disabled")})),this.on("blur",(function(){e.$container[0].classList.remove("select2-container--focus")})),this.on("query",(function(t){e.isOpen()||e.trigger("open",{}),this.dataAdapter.query(t,(function(n){e.trigger("results:all",{data:n,query:t})}))})),this.on("query:append",(function(t){this.dataAdapter.query(t,(function(n){e.trigger("results:append",{data:n,query:t})}))})),this.on("keypress",(function(t){var n=t.which;e.isOpen()?n===r.ESC||n===r.UP&&t.altKey?(e.close(t),t.preventDefault()):n===r.ENTER||n===r.TAB?(e.trigger("results:select",{}),t.preventDefault()):n===r.SPACE&&t.ctrlKey?(e.trigger("results:toggle",{}),t.preventDefault()):n===r.UP?(e.trigger("results:previous",{}),t.preventDefault()):n===r.DOWN&&(e.trigger("results:next",{}),t.preventDefault()):(n===r.ENTER||n===r.SPACE||n===r.DOWN&&t.altKey)&&(e.open(),t.preventDefault())}))},a.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},a.prototype._isChangeMutation=function(e){var t=this;if(e.addedNodes&&e.addedNodes.length>0){for(var n=0;n<e.addedNodes.length;n++)if(e.addedNodes[n].selected)return!0}else{if(e.removedNodes&&e.removedNodes.length>0)return!0;if(Array.isArray(e))return e.some((function(e){return t._isChangeMutation(e)}))}return!1},a.prototype._syncSubtree=function(e){var t=this._isChangeMutation(e),n=this;t&&this.dataAdapter.current((function(e){n.trigger("selection:update",{data:e})}))},a.prototype.trigger=function(e,t){var n=a.__super__.trigger,r={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in r){var s=r[e],i={prevented:!1,name:e,args:t};if(n.call(this,s,i),i.prevented)return void(t.prevented=!0)}n.call(this,e,t)},a.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},a.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},a.prototype.close=function(e){this.isOpen()&&this.trigger("close",{originalEvent:e})},a.prototype.isEnabled=function(){return!this.isDisabled()},a.prototype.isDisabled=function(){return this.options.get("disabled")},a.prototype.isOpen=function(){return this.$container[0].classList.contains("select2-container--open")},a.prototype.hasFocus=function(){return this.$container[0].classList.contains("select2-container--focus")},a.prototype.focus=function(e){this.hasFocus()||(this.$container[0].classList.add("select2-container--focus"),this.trigger("focus",{}))},a.prototype.enable=function(e){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=e&&0!==e.length||(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},a.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var e=[];return this.dataAdapter.current((function(t){e=t})),e},a.prototype.val=function(e){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==e||0===e.length)return this.$element.val();var t=e[0];Array.isArray(t)&&(t=t.map((function(e){return e.toString()}))),this.$element.val(t).trigger("input").trigger("change")},a.prototype.destroy=function(){n.RemoveData(this.$container[0]),this.$container.remove(),this._observer.disconnect(),this._observer=null,this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",n.GetData(this.$element[0],"old-tabindex")),this.$element[0].classList.remove("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),n.RemoveData(this.$element[0]),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},a.prototype.render=function(){var t=e('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return t.attr("dir",this.options.get("dir")),this.$container=t,this.$container[0].classList.add("select2-container--"+this.options.get("theme")),n.StoreData(t[0],"element",this.$element),t},a})),n.define("select2/dropdown/attachContainer",[],(function(){function e(e,t,n){e.call(this,t,n)}return e.prototype.position=function(e,t,n){n.find(".dropdown-wrapper").append(t),t[0].classList.add("select2-dropdown--below"),n[0].classList.add("select2-container--below")},e})),n.define("select2/dropdown/stopPropagation",[],(function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n);this.$dropdown.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),(function(e){e.stopPropagation()}))},e})),n.define("select2/selection/stopPropagation",[],(function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n);this.$selection.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),(function(e){e.stopPropagation()}))},e})),i=function(e){var t,n,r=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],a="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],s=Array.prototype.slice;if(e.event.fixHooks)for(var i=r.length;i;)e.event.fixHooks[r[--i]]=e.event.mouseHooks;var o=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var t=a.length;t;)this.addEventListener(a[--t],l,!1);else this.onmousewheel=l;e.data(this,"mousewheel-line-height",o.getLineHeight(this)),e.data(this,"mousewheel-page-height",o.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var t=a.length;t;)this.removeEventListener(a[--t],l,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var n=e(t),r=n["offsetParent"in e.fn?"offsetParent":"parent"]();return r.length||(r=e("body")),parseInt(r.css("fontSize"),10)||parseInt(n.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function l(r){var a=r||window.event,i=s.call(arguments,1),l=0,u=0,p=0,m=0,h=0,f=0;if((r=e.event.fix(a)).type="mousewheel","detail"in a&&(p=-1*a.detail),"wheelDelta"in a&&(p=a.wheelDelta),"wheelDeltaY"in a&&(p=a.wheelDeltaY),"wheelDeltaX"in a&&(u=-1*a.wheelDeltaX),"axis"in a&&a.axis===a.HORIZONTAL_AXIS&&(u=-1*p,p=0),l=0===p?u:p,"deltaY"in a&&(l=p=-1*a.deltaY),"deltaX"in a&&(u=a.deltaX,0===p&&(l=-1*u)),0!==p||0!==u){if(1===a.deltaMode){var g=e.data(this,"mousewheel-line-height");l*=g,p*=g,u*=g}else if(2===a.deltaMode){var v=e.data(this,"mousewheel-page-height");l*=v,p*=v,u*=v}if(m=Math.max(Math.abs(p),Math.abs(u)),(!n||m<n)&&(n=m,d(a,m)&&(n/=40)),d(a,m)&&(l/=40,u/=40,p/=40),l=Math[l>=1?"floor":"ceil"](l/n),u=Math[u>=1?"floor":"ceil"](u/n),p=Math[p>=1?"floor":"ceil"](p/n),o.settings.normalizeOffset&&this.getBoundingClientRect){var b=this.getBoundingClientRect();h=r.clientX-b.left,f=r.clientY-b.top}return r.deltaX=u,r.deltaY=p,r.deltaFactor=n,r.offsetX=h,r.offsetY=f,r.deltaMode=0,i.unshift(r,l,u,p),t&&clearTimeout(t),t=setTimeout(c,200),(e.event.dispatch||e.event.handle).apply(this,i)}}function c(){n=null}function d(e,t){return o.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})},"function"==typeof n.define&&n.define.amd?n.define("jquery-mousewheel",["jquery"],i):e.exports=i,n.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],(function(e,t,n,r,a){if(null==e.fn.select2){var s=["open","close","destroy"];e.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each((function(){var r=e.extend(!0,{},t);new n(e(this),r)})),this;if("string"==typeof t){var r,i=Array.prototype.slice.call(arguments,1);return this.each((function(){var e=a.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),r=e[t].apply(e,i)})),s.indexOf(t)>-1?this:r}throw new Error("Invalid arguments for Select2: "+t)}}return null==e.fn.select2.defaults&&(e.fn.select2.defaults=r),n})),{define:n.define,require:n.require}}(),r=n.require("jquery.select2");return t.fn.select2.amd=n,r})?r.apply(t,a):r)||(e.exports=s)},42473:function(e){"use strict";e.exports=function(){}},65311:function(e){"use strict";e.exports=jQuery}},function(e){e.O(0,[351],(function(){return 78537,e(e.s=78537)})),e.O()}]);
assets/dist/js/{admin.fd6e2d07.js.LICENSE.txt → admin.5289a933.js.LICENSE.txt} RENAMED
File without changes
assets/dist/js/admin.fd6e2d07.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see admin.fd6e2d07.js.LICENSE.txt */
2
- (self.webpackChunkMailPoet3=self.webpackChunkMailPoet3||[]).push([[328],{49868:function(){jQuery.AsyncQueue=function(){var e,t,n,r,a=this,s=[],o=!1;return r=function(){var e=s.shift();e?(e.apply(a,[a]),!1===o&&r()):t&&t.apply(a)},this.onFailure=function(t){e=t},this.onComplete=function(e){t=e},this.add=function(e){return s.push(e),this},this.storeData=function(e){return n=e,this},this.lastCallbackData=function(){return n},this.run=function(){o=!1,r()},this.pause=function(){return o=!0,this},this.failure=function(){if(o=!0,e){var t=[a];for(i=0;i<arguments.length;i++)t.push(arguments[i]);e.apply(a,t)}},this}},78537:function(e,t,n){"use strict";var r={};n.r(r),n.d(r,{canUseWooSubscriptions:function(){return fo},findFiltersValueForSegment:function(){return Io},getAvailableFilters:function(){return jo},getCustomFieldsList:function(){return bo},getErrors:function(){return Zo},getMembershipPlans:function(){return co},getNewslettersList:function(){return ho},getProductCategories:function(){return mo},getProducts:function(){return lo},getSegment:function(){return yo},getSegmentFilter:function(){return _o},getStaticSegmentsList:function(){return wo},getSubscriberCount:function(){return xo},getSubscriptionProducts:function(){return uo},getWooCommerceCountries:function(){return vo},getWooCommerceCurrencySymbol:function(){return go},getWordpressRoles:function(){return po}});var a={};n.r(a),n.d(a,{handleSave:function(){return qo},pageLoaded:function(){return Fo},setErrors:function(){return Oo},setSegment:function(){return Eo},updateSegment:function(){return Ro},updateSegmentFilter:function(){return Ao},updateSegmentFilterFromEvent:function(){return Mo},updateSegmentFromEvent:function(){return Po},updateSubscriberCount:function(){return Lo}});var s={};n.r(s),n.d(s,{LOAD_SEGMENT:function(){return Uo},SAVE_SEGMENT:function(){return Vo}});var i=n(52524),o=n.n(i),l=n(73727),c=n(5977),d=n(65311),u=n.n(d),p=n(62948),m=n(78596),h=n.n(m),f=n(45697),g=n.n(f),v=n(57744),b=n(57578),y=n(15451),w=function(e){let{children:t,dimension:n,segments:r,strings:a}=e;return(0,y.jsxs)("div",{className:"mailpoet-tags",children:[t,r&&r.map((e=>(0,y.jsx)(b.Z,{dimension:n,variant:"list",children:e.name},e.name))),a&&a.map((e=>(0,y.jsx)(b.Z,{dimension:n,variant:"list",children:e},e)))]})},x=n(33160),_=n(57040),Z=n(44845),j=n(45993),I=n(59050);n(20454);class S extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"getFieldId",(e=>{const t=e||this.props;return t.field.id||t.field.name})),(0,Z.Z)(this,"getSelectedValues",(()=>{if(void 0!==this.props.field.selected)return this.props.field.selected(this.props.item);if(void 0!==this.props.item&&void 0!==this.props.field.name){if(!this.allowMultipleValues())return this.props.item[this.props.field.name];if(I.ZP.isArray(this.props.item[this.props.field.name]))return this.props.item[this.props.field.name].map((e=>e.id))}return null})),(0,Z.Z)(this,"getItems",(()=>{let e;return void 0!==window[`mailpoet_${this.props.field.endpoint}`]?e=window[`mailpoet_${this.props.field.endpoint}`]:void 0!==this.props.field.values&&(e=this.props.field.values),I.ZP.isArray(e)&&void 0!==this.props.field.filter&&(e=e.filter(this.props.field.filter)),e})),(0,Z.Z)(this,"getLabel",(e=>void 0!==this.props.field.getLabel?this.props.field.getLabel(e,this.props.item):e.name)),(0,Z.Z)(this,"getSearchLabel",(e=>void 0!==this.props.field.getSearchLabel?this.props.field.getSearchLabel(e,this.props.item):null)),(0,Z.Z)(this,"getValue",(e=>void 0!==this.props.field.getValue?this.props.field.getValue(e,this.props.item):e.id)),(0,Z.Z)(this,"getCount",(e=>void 0!==this.props.field.getCount?this.props.field.getCount(e,this.props.item):null)),(0,Z.Z)(this,"getTag",(e=>void 0!==this.props.field.getTag?this.props.field.getTag(e,this.props.item):null)),(0,Z.Z)(this,"setupSelect2",(()=>{if(this.isSelect2Initialized())return;const e=e=>{let t="";return e.tag&&(t+=`<span class="mailpoet-form-select2-tag">${e.tag}</span>`),t+=`<span class="mailpoet-form-select2-text"><span>${e.text}</span></span>`,e.count&&(t+=`<span class="mailpoet-form-select2-count">${e.count}</span>`),t};let t={disabled:this.props.disabled||!1,width:this.props.width||"",placeholder:{id:"",text:this.props.field.placeholder},dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:e,templateSelection:e};const n=this.props.field.remoteQuery||null;if(n)t=Object.assign(t,{ajax:{url:window.ajaxurl,type:"POST",dataType:"json",data:function(e){return{action:"mailpoet",api_version:window.mailpoet_api_version,token:window.mailpoet_token,endpoint:n.endpoint,method:n.method,data:Object.assign(n.data,{query:e.term})}},processResults:function(e){let t;return t=I.ZP.has(e,"data")?e.data.map((e=>({id:e.id||e.value,text:e.name||e.text}))):[],{results:t}}},minimumInputLength:n.minimumInputLength||2});else if(void 0!==this.props.field.getCount||void 0!==this.props.field.getTag){const e=this.getItems(this.props.field);let n=this.getSelectedValues()||[];Array.isArray(n)||(n=[n]);const r=e.map((e=>{const t=this.getValue(e);return{id:t,tag:this.getTag(e),text:this.getLabel(e),count:this.getCount(e),selected:n.indexOf(t)>-1}}));t=Object.assign(t,{data:r})}void 0!==this.props.field.extendSelect2Options&&(t=Object.assign(t,this.props.field.extendSelect2Options));const r=u()(`#${this.selectRef.current.id}`).select2(t);let a=!1;r.on("select2:unselecting",(()=>{a=!0})),r.on("select2:opening",(e=>{!0===a&&(a=!1,e.preventDefault())})),r.on("change",this.handleChange)})),(0,Z.Z)(this,"resetSelect2",(()=>{this.destroySelect2(),this.setupSelect2()})),(0,Z.Z)(this,"destroySelect2",(()=>{this.isSelect2Initialized()&&(u()(`#${this.selectRef.current.id}`).select2("destroy"),this.cleanupAfterSelect2())})),(0,Z.Z)(this,"cleanupAfterSelect2",(()=>{u()(`#${this.selectRef.current.id}`).find("option:not(.default)").remove(),u()(`#${this.selectRef.current.id}`).off("select2:unselecting").off("select2:opening")})),(0,Z.Z)(this,"allowMultipleValues",(()=>!0===this.props.field.multiple)),(0,Z.Z)(this,"isSelect2Initialized",(()=>!0===u()(`#${this.selectRef.current.id}`).hasClass("select2-hidden-accessible"))),(0,Z.Z)(this,"isSelect2Component",(()=>this.allowMultipleValues()||this.props.field.forceSelect2)),(0,Z.Z)(this,"handleChange",(e=>{if(void 0===this.props.onValueChange)return;const t=u()(`#${this.selectRef.current.id}`).children(":selected").map((function(){return{id:u()(this).val(),text:u()(this).text()}})),n=this.props.field.multiple?I.ZP.pluck(t,"id"):I.ZP.pluck(t,"id").toString(),r=this.transformChangedValue(n,t);this.props.onValueChange({target:{value:r,name:this.props.field.name,id:e.target.id}})})),(0,Z.Z)(this,"transformChangedValue",((e,t)=>"function"==typeof this.props.field.transformChangedValue?this.props.field.transformChangedValue.call(this,e,t):e)),(0,Z.Z)(this,"insertEmptyOption",(()=>{if(!this.allowMultipleValues())return this.props.field.placeholder?(0,y.jsx)("option",{className:"default"}):void 0})),this.selectRef=(0,j.createRef)()}componentDidMount(){this.isSelect2Component()&&this.setupSelect2()}componentDidUpdate(e){void 0!==this.props.item&&void 0!==e.item&&this.props.item.id!==e.item.id&&u()(`#${this.selectRef.current.id}`).val(this.getSelectedValues()).trigger("change"),this.isSelect2Initialized()&&this.getFieldId(this.props)!==this.getFieldId(e)&&void 0!==this.props.field.resetSelect2OnUpdate&&this.resetSelect2()}componentWillUnmount(){this.isSelect2Component()&&this.destroySelect2()}render(){const e=this.getItems(this.props.field),t=this.getSelectedValues(),n=e.map((e=>{const t=this.getLabel(e),n=this.getSearchLabel(e),r=this.getValue(e);return(0,y.jsx)("option",{className:"default",value:r,title:n,children:t},`option-${e.id}`)}));return(0,y.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,y.jsxs)("select",{id:this.getFieldId(),ref:this.selectRef,disabled:this.props.field.disabled,"data-placeholder":this.props.field.placeholder,multiple:this.props.field.multiple,defaultValue:t,...this.props.field.validation,children:[this.insertEmptyOption(),n]})})}}S.propTypes={onValueChange:g().func,field:g().shape({name:g().string.isRequired,values:g().oneOfType([g().object,g().array]),getLabel:g().func,resetSelect2OnUpdate:g().bool,selected:g().func,endpoint:g().string,filter:g().func,getSearchLabel:g().func,getValue:g().func,getCount:g().func,getTag:g().func,placeholder:g().string,remoteQuery:g().object,extendSelect2Options:g().object,multiple:g().bool,forceSelect2:g().bool,transformChangedValue:g().func,disabled:g().bool,validation:g().shape({"data-parsley-required":g().bool,"data-parsley-required-message":g().string,"data-parsley-type":g().string,"data-parsley-errors-container":g().string,maxLength:g().number})}).isRequired,item:g().object,disabled:g().bool,width:g().string},S.defaultProps={onValueChange:function(){},disabled:!1,width:"",item:void 0};var C=S,T=n(27273),k=n.n(T),N=n(38287),D=function(){if(!p.Z.subscribersLimitReached)return null;const e=p.Z.hasValidApiKey,t=p.Z.I18n.t("subscribersLimitNoticeTitle").replace("[subscribersLimit]",p.Z.subscribersLimit),n=p.Z.I18n.t(e?"yourPlanLimit":"freeVersionLimit").replace("[subscribersLimit]",p.Z.subscribersLimit),r=e?p.Z.MailPoetComUrlFactory.getUpgradeUrl(p.Z.pluginPartialKey):p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount+1),a=k()(p.Z.I18n.t("youCanDisableWPUsersList"),/\[link](.*?)\[\/link]/g,(e=>(0,y.jsx)("a",{href:"?page=mailpoet-segments",children:e},"goToSegments")));return(0,y.jsxs)(N.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,y.jsx)("h3",{children:t}),(0,y.jsxs)("p",{children:[n," ",p.Z.I18n.t("youNeedToUpgrade"),"active"===p.Z.wpSegmentState?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("br",{}),a]}):null]}),(0,y.jsxs)("p",{children:[(0,y.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:r,children:p.Z.I18n.t("upgradeNow")}),e&&(0,y.jsxs)(y.Fragment,{children:[" ",(0,y.jsx)("button",{type:"button",className:"button",onClick:async()=>{await p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:p.Z.I18n.t("refreshMySubscribers")})]})]})]})},E=function(e){let{mssKeyInvalid:t,subscribersCount:n}=e;return t?(0,y.jsxs)(N.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,y.jsx)("h3",{children:p.Z.I18n.t("allSendingPausedHeader")}),(0,y.jsx)("p",{children:k()(p.Z.I18n.t("allSendingPausedBody"),/\[link\](.*?)\[\/link\]/g,(e=>(0,y.jsx)("a",{href:"?page=mailpoet-settings#premium",children:e},"check-sending")))}),(0,y.jsx)("p",{children:(0,y.jsx)("a",{href:`https://account.mailpoet.com?s=${n}`,className:"button button-primary",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("allSendingPausedLink")})})]}):null},O=n(30653),R=function(){if(!p.Z.emailVolumeLimitReached)return null;const e=p.Z.I18n.t("emailVolumeLimitNoticeTitle").replace("[emailVolumeLimit]",p.Z.emailVolumeLimit),t=p.Z.I18n.t("youReachedEmailVolumeLimit").replace("[emailVolumeLimit]",p.Z.emailVolumeLimit),n=p.Z.MailPoetComUrlFactory.getUpgradeUrl(p.Z.pluginPartialKey),r=new Date,a=new Date(r.getFullYear(),r.getMonth()+1,1);let s=k()(p.Z.I18n.t("toContinueUpgradeYourPlanOrWaitUntil"),/\[link](.*?)\[\/link]/g,(e=>(0,y.jsx)("a",{target:"_blank",rel:"noreferrer",href:n,children:e},e)));return s=k()(s,/<b>\[date]<\/b>\./g,(()=>(0,O.ZP)(`<b>${p.Z.Date.short(a)}</b>.`))),(0,y.jsxs)(N.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,y.jsx)("h3",{children:e}),(0,y.jsxs)("p",{children:[t,(0,y.jsx)("br",{}),s]}),(0,y.jsxs)("p",{children:[(0,y.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:n,children:p.Z.I18n.t("upgradeNow")})," ",(0,y.jsx)("button",{type:"button",className:"button",onClick:async()=>{await p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:p.Z.I18n.t("refreshMyEmailVolumeLimit")})]})]})};function A(e){let{cacheCalculation:t}=e;const[n,r]=(0,j.useState)(!1),[a,s]=(0,j.useState)([]),i=(new Date).getTime()-new Date(t).getTime(),o=Math.floor(i/1e3/60);return(0,y.jsxs)("div",{className:"mailpoet-subscribers-cache-notice",children:[k()(p.Z.I18n.t("subscribersCountWereCalculatedWithMinutesAgo"),/<abbr>(.*?)<\/abbr>/,((e,n)=>(0,y.jsx)("abbr",{title:t,children:e.replace(/(\{\$mins\}|\$mins)/i,String(o))},n))),(0,y.jsx)(v.Z,{className:"mailpoet-subscribers-cache-notice-button",type:"button",variant:"secondary",dimension:"small",onClick:()=>{r(!0),p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"settings",action:"recalculateSubscribersCountsCache"}).done((()=>{window.location.reload()})).fail((e=>{s(e.errors.map((e=>e.message))),r(!1)}))},withSpinner:n,children:p.Z.I18n.t("recalculateNow")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),a.length>0&&(0,y.jsx)(N.Z,{type:"error",children:a.map((e=>(0,y.jsx)("p",{children:e},e)))})]})}var P=n(49793),M=n.n(P),L=function(e){let{subscribersInPlan:t,subscribersInPlanLimit:n}=e;if(!1===t)return null;const r=n?(0,y.jsx)("b",{children:p.Z.I18n.t("subscribersInPlanCount").replace("%1$d",t.toLocaleString()).replace("%2$d",n.toLocaleString())},"subscribers_count"):(0,y.jsx)("b",{children:t},"subscribers_count");return(0,y.jsxs)("div",{className:"mailpoet-subscribers-in-plan",children:[k()(p.Z.I18n.t("subscribersInPlan"),"%s",(()=>r))," ",(0,y.jsx)(M(),{tooltip:p.Z.I18n.t("subscribersInPlanTooltip"),place:"right"}),(0,y.jsx)("span",{className:"mailpoet-subscribers-in-plan-spacer",children:" "})]})},F=n(99181),q=(0,y.jsx)("svg",{viewBox:"4 4 16 16",children:(0,y.jsx)("path",{d:"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"})});function $(e){let{location:t}=e;return(0,y.jsxs)(F.Q,{children:[(0,y.jsxs)(l.rU,{className:"mailpoet-button button-secondary",to:{pathname:"/new",state:{backUrl:t?.pathname}},children:[q,(0,y.jsx)("span",{"data-automation-id":"add-new-subscribers-button",children:p.Z.I18n.t("new")})]}),(0,y.jsx)("a",{className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-import","data-automation-id":"import-subscribers-button",children:p.Z.I18n.t("import")}),(0,y.jsx)("a",{id:"mailpoet_export_button",className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-export",children:p.Z.I18n.t("export")})]})}$.propTypes={location:g().object.isRequired};var U=(0,c.withRouter)($),V=n(53423);function W(e){let{id:t,engagementScore:n}=e;const r={unknown:{name:p.Z.I18n.t("unknownBadgeName"),type:"unknown",tooltipTitle:p.Z.I18n.t("unknownBadgeTooltip"),tooltipText:p.Z.I18n.t("tooltipUnknown")},excellent:{name:p.Z.I18n.t("excellentBadgeName"),type:"excellent",tooltipTitle:p.Z.I18n.t("excellentBadgeTooltip"),tooltipText:p.Z.I18n.t("tooltipExcellent")},good:{name:p.Z.I18n.t("goodBadgeName"),type:"good",tooltipTitle:p.Z.I18n.t("goodBadgeTooltip"),tooltipText:p.Z.I18n.t("tooltipGood")},average:{name:p.Z.I18n.t("averageBadgeName"),type:"average",tooltipTitle:p.Z.I18n.t("averageBadgeTooltip"),tooltipText:p.Z.I18n.t("tooltipAverage")}},a=`badge-${t}`;let s;s=null==n?r.unknown:n<20?r.average:n<50?r.good:r.excellent;const i=(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"mailpoet-listing-stats-tooltip-title",children:s.tooltipTitle.toUpperCase()}),(0,y.jsx)("div",{className:"mailpoet-listing-stats-tooltip-description",children:p.Z.I18n.t("engagementScoreDescription")}),(0,y.jsxs)("div",{className:"mailpoet-listing-stats-tooltip-content",children:[(0,y.jsx)(V.Z,{type:"unknown",name:p.Z.I18n.t("unknownBadgeName")})," : ",r.unknown.tooltipText,(0,y.jsx)("br",{}),(0,y.jsx)(V.Z,{type:"excellent",name:p.Z.I18n.t("excellentBadgeName")})," : ",r.excellent.tooltipText,(0,y.jsx)("br",{}),(0,y.jsx)(V.Z,{type:"good",name:p.Z.I18n.t("goodBadgeName")})," : ",r.good.tooltipText,(0,y.jsx)("br",{}),(0,y.jsx)(V.Z,{type:"average",name:p.Z.I18n.t("averageBadgeName")})," : ",r.average.tooltipText]})]},`tooltip-${a}`);return(0,y.jsxs)("div",{className:"mailpoet-listing-stats-opened-clicked",children:[null!=n&&(0,y.jsxs)("div",{className:"mailpoet-listing-stats-percentages",children:[n.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),"%"]}),(0,y.jsx)("div",{children:(0,y.jsx)(V.Z,{isInverted:!0,type:s.type,name:s.name,tooltip:i,tooltipId:a,tooltipPlace:"top"})})]})}const Y=p.Z.trackingConfig.emailTrackingEnabled,B=[{name:"email",label:p.Z.I18n.t("subscriber"),sortable:!0},{name:"status",label:p.Z.I18n.t("status"),sortable:!0},{name:"segments",label:p.Z.I18n.t("lists")},{name:"statistics",label:p.Z.I18n.t("statisticsColumn"),display:Y},{name:"created_at",label:p.Z.I18n.t("subscribedOn"),sortable:!0}],H={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneSubscriberTrashed"):p.Z.I18n.t("multipleSubscribersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneSubscriberDeleted"):p.Z.I18n.t("multipleSubscribersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneSubscriberRestored"):p.Z.I18n.t("multipleSubscribersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onNoItemsFound:e=>"bounced"===e&&!window.mailpoet_premium_active&&!window.mailpoet_mss_active&&(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{children:p.Z.I18n.t("bouncedSubscribersHelp")}),(0,y.jsx)("p",{children:(0,y.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",className:"button-primary",children:p.Z.I18n.t("bouncedSubscribersPremiumButtonText")})})]})},z=(e,t,n,r)=>(0,y.jsxs)(_.Z,{title:r,onRequestClose:t,isDismissible:!0,children:[(0,y.jsx)(C,{field:n}),(0,y.jsx)("span",{className:"mailpoet-gap-half"}),(0,y.jsx)(v.Z,{onClick:e,dimension:"small",variant:"secondary",children:p.Z.I18n.t("apply")})]}),K=[{name:"moveToList",label:p.Z.I18n.t("moveToList"),onSelect:function(e,t){return z(e,t,{id:"move_to_segment",name:"move_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},p.Z.I18n.t("moveToList"))},getData:function(){return{segment_id:Number(u()("#move_to_segment").val())}},onSuccess:function(e){p.Z.Notice.success(p.Z.I18n.t("multipleSubscribersMovedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"addToList",label:p.Z.I18n.t("addToList"),onSelect:function(e,t){return z(e,t,{id:"add_to_segment",name:"add_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},p.Z.I18n.t("addToList"))},getData:function(){return{segment_id:Number(u()("#add_to_segment").val())}},onSuccess:function(e){p.Z.Notice.success(p.Z.I18n.t("multipleSubscribersAddedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromList",label:p.Z.I18n.t("removeFromList"),onSelect:function(e,t){return z(e,t,{id:"remove_from_segment",name:"remove_from_segment",endpoint:"segments",filter:function(e){return!("default"!==e.type)}},p.Z.I18n.t("removeFromList"))},getData:function(){return{segment_id:Number(u()("#remove_from_segment").val())}},onSuccess:function(e){p.Z.Notice.success(p.Z.I18n.t("multipleSubscribersRemovedFromList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromAllLists",label:p.Z.I18n.t("removeFromAllLists"),onSuccess:function(e){p.Z.Notice.success(p.Z.I18n.t("multipleSubscribersRemovedFromAllLists").replace("%1$d",Number(e.meta.count).toLocaleString()))}},{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:H.onTrash},{name:"unsubscribe",label:p.Z.I18n.t("unsubscribe"),onSelect:(e,t,n)=>{const r="all"!==n.selection?n.selected_ids.length:n.count;return(0,y.jsxs)(_.Z,{title:p.Z.I18n.t("unsubscribe"),onRequestClose:t,isDismissible:!0,children:[(0,y.jsx)("p",{children:p.Z.I18n.t("unsubscribeConfirm").replace("%s",r.toLocaleString())}),(0,y.jsx)("span",{className:"mailpoet-gap-half"}),(0,y.jsx)(v.Z,{onClick:e,dimension:"small",variant:"secondary",automationId:"bulk-unsubscribe-confirm",children:p.Z.I18n.t("apply")})]})}}],G=[{name:"statistics",label:p.Z.I18n.t("statsListingActionTitle"),link:function(e,t){return(0,y.jsx)(l.rU,{to:{pathname:`/stats/${e.id}`,state:{backUrl:t?.pathname}},children:p.Z.I18n.t("statsListingActionTitle")})}},{name:"edit",label:p.Z.I18n.t("edit"),link:function(e,t){return(0,y.jsx)(l.rU,{to:{pathname:`/edit/${e.id}`,state:{backUrl:t?.pathname}},children:p.Z.I18n.t("edit")})}},{name:"sendConfirmationEmail",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("resendConfirmationEmail"),display:function(e){return"unconfirmed"===e.status&&e.count_confirmations<window.mailpoet_max_confirmation_emails},onClick:function(e){return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"subscribers",action:"sendConfirmationEmail",data:{id:e.id}}).done((()=>p.Z.Notice.success(p.Z.I18n.t("oneConfirmationEmailSent")))).fail((e=>p.Z.Notice.showApiErrorNotice(e)))}},{name:"trash",className:"mailpoet-hide-on-mobile"}],Q=e=>0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user);function X(e){let{match:t}=e;const n=(0,c.useLocation)();return(0,y.jsxs)("div",{children:[(0,y.jsx)(U,{}),(0,y.jsx)(L,{subscribersInPlan:p.Z.subscribersCount,subscribersInPlanLimit:p.Z.subscribersLimit}),(0,y.jsx)(D,{}),(0,y.jsx)(R,{}),(0,y.jsx)(E,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,y.jsx)(A,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:n,params:t.params,endpoint:"subscribers",onRenderItem:(e,t)=>{const r=h()("manage-column","column-primary","has-row-actions","column-username");let a="";switch(e.status){case"subscribed":a=p.Z.I18n.t("subscribed");break;case"unconfirmed":a=p.Z.I18n.t("unconfirmed");break;case"unsubscribed":a=p.Z.I18n.t("unsubscribed");break;case"inactive":a=p.Z.I18n.t("inactive");break;case"bounced":a=p.Z.I18n.t("bounced");break;default:a="Invalid"}const s=[];return e.subscriptions.length>0&&e.subscriptions.forEach((e=>{const t=(e=>{let t=!1;return window.mailpoet_segments.forEach((n=>{n.id===e&&(t=n)})),t})(e.segment_id);!1!==t&&"subscribed"===e.status&&s.push(t)})),(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:r,children:[(0,y.jsx)(l.rU,{className:"mailpoet-listing-title",to:{pathname:`/edit/${e.id}`,state:{backUrl:n?.pathname}},children:e.email}),(0,y.jsxs)("div",{className:"mailpoet-listing-subtitle",children:[e.first_name," ",e.last_name]}),t]}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("status"),children:a}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("lists"),children:(0,y.jsx)(w,{segments:s,dimension:"large"})}),!0===Y?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("statisticsColumn"),children:(0,y.jsx)("div",{className:"mailpoet-listing-stats",children:(0,y.jsx)("a",{href:`#/stats/${e.id}`,children:(0,y.jsx)(W,{id:e.id,engagementScore:e.engagement_score})},`stats-link-${e.id}`)})}):null,(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("subscribedOn"),children:[p.Z.Date.short(e.created_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.created_at)]})]})},columns:B,bulk_actions:K,item_actions:G,messages:H,sort_by:"created_at",sort_order:"desc",isItemDeletable:Q})]})}X.propTypes={match:g().shape({params:g().object}).isRequired};var J=X,ee=n(30381),te=n.n(ee),ne=n(17123),re=n.n(ne),ae=n(60017);class se extends j.Component{render(){const e=this.props.field.name||null,t=this.props.item||{};let n,r;this.props.onValueChange instanceof Function&&(n=t[this.props.field.name],n=void 0===n?this.props.field.defaultValue||"":n),!n&&this.props.field.defaultValue&&(r=this.props.field.defaultValue);let a=this.props.field.id||null;!a&&this.props.field.name&&(a=`field_${this.props.field.name}`);let s=this.props.field.className||null;return s||this.props.field.size||(s="regular-text"),(0,y.jsx)(ae.Z,{type:"text",disabled:void 0!==this.props.field.disabled&&this.props.field.disabled(this.props.item),className:s,size:"auto"!==this.props.field.size&&this.props.field.size>0?this.props.field.size:null,name:e,id:a,value:n,defaultValue:r,placeholder:this.props.field.placeholder,onChange:this.props.onValueChange,customLabel:this.props.field.customLabel,tooltip:this.props.field.tooltip,...this.props.field.validation})}}se.propTypes={onValueChange:g().func,field:g().shape({name:g().string.isRequired,defaultValue:g().string,id:g().string,className:g().string,size:g().oneOfType([g().string,g().number]),disabled:g().func,placeholder:g().string,validation:g().shape({"data-parsley-required":g().bool,"data-parsley-required-message":g().string,"data-parsley-type":g().string,"data-parsley-errors-container":g().string,maxLength:g().number}),customLabel:g().string,tooltip:g().string}).isRequired,item:g().object.isRequired},se.defaultProps={onValueChange:function(){}};var ie=se,oe=n(97972);function le(e){return(0,y.jsx)(oe.Z,{type:"text",name:e.field.name,id:`field_${e.field.name}`,value:e.item[e.field.name],placeholder:e.field.placeholder,defaultValue:e.field.defaultValue,onChange:e.onValueChange,className:e.field.className,customLabel:e.field.customLabel,tooltip:e.field.tooltip,...e.field.validation})}le.propTypes={item:g().object.isRequired,field:g().shape({name:g().string,placeholder:g().string,defaultValue:g().string,validation:g().shape({"data-parsley-required":g().bool,"data-parsley-required-message":g().string,"data-parsley-type":g().string,"data-parsley-errors-container":g().string,maxLength:g().number}),className:g().string,customLabel:g().string,tooltip:g().string}).isRequired,onValueChange:g().func.isRequired};var ce=le,de=n(2141);class ue extends j.Component{render(){if(void 0===this.props.field.values)return!1;let e,t=!1,n=!1,r=!1;void 0!==this.props.field.placeholder&&(n=(0,y.jsx)("option",{value:"",children:this.props.field.placeholder})),void 0!==this.props.field.filter&&(t=this.props.field.filter),I.ZP.isFunction(this.props.field.sortBy)&&(r=this.props.field.sortBy),e=r?I.ZP.map(I.ZP.sortBy(I.ZP.pairs(this.props.field.values),(e=>r(e[0],e[1]))),(e=>e[0])):Object.keys(this.props.field.values);const a=e.filter((e=>!1===t||t(this.props.item,e))).map((e=>(0,y.jsx)("option",{value:e,children:this.props.field.values[e]},`option-${e}`)));return(0,y.jsxs)(de.Z,{name:this.props.field.name,id:`field_${this.props.field.name}`,value:this.props.item[this.props.field.name]||"",onChange:this.props.onValueChange,automationId:this.props.automationId,...this.props.field.validation,children:[n,a]})}}ue.propTypes={onValueChange:g().func,field:g().shape({name:g().string.isRequired,values:g().objectOf(g().string),placeholder:g().string,filter:g().func,sortBy:g().func,validation:g().shape({"data-parsley-required":g().bool,"data-parsley-required-message":g().string,"data-parsley-type":g().string,"data-parsley-errors-container":g().string,maxLength:g().number})}).isRequired,item:g().object.isRequired,automationId:g().string},ue.defaultProps={automationId:"",onValueChange:function(){}};var pe=ue,me=n(84868);class he extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"onValueChange",((e,t)=>this.props.onValueChange(t))),this.onValueChange=this.onValueChange.bind(this)}render(){if(void 0===this.props.field.values)return!1;const e=this.props.item[this.props.field.name],t=Object.keys(this.props.field.values).map((t=>(0,y.jsx)("p",{children:(0,y.jsx)(me.Z,{checked:e===t,value:t,onCheck:this.onValueChange,name:this.props.field.name,children:this.props.field.values[t]})},`radio-${t}`)));return(0,y.jsx)("div",{children:t})}}he.propTypes={onValueChange:g().func,field:g().shape({name:g().string.isRequired,values:g().objectOf(g().string)}).isRequired,item:g().object.isRequired},he.defaultProps={onValueChange:function(){}};var fe=he,ge=n(16277);class ve extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"onValueChange",((e,t)=>(t.target.value=e?"1":"0",this.props.onValueChange(t)))),this.onValueChange=this.onValueChange.bind(this)}render(){if(void 0===this.props.field.values)return!1;const e=!!Number(this.props.item[this.props.field.name]),t=Object.keys(this.props.field.values).map((t=>(0,y.jsx)("p",{children:(0,y.jsx)(ge.Z,{value:"1",checked:e,name:this.props.field.name,onCheck:this.onValueChange,children:this.props.field.values[t]})},`checkbox-${t}`)));return(0,y.jsx)("div",{children:t})}}ve.propTypes={onValueChange:g().func.isRequired,field:g().shape({name:g().string.isRequired,values:g().objectOf(g().string)}).isRequired,item:g().object.isRequired};var be=ve;function ye(e){const t=[];void 0!==e.placeholder&&t.push((0,y.jsx)("option",{value:"",children:e.placeholder},0));const n=te()().year();for(let e=n;e>=n-100;e-=1)t.push((0,y.jsx)("option",{value:e,children:e},e));return(0,y.jsx)(de.Z,{isMinWidth:!0,name:`${e.name}[year]`,value:e.year,onChange:e.onValueChange,children:t})}function we(e){const t=[];void 0!==e.placeholder&&t.push((0,y.jsx)("option",{value:"",children:e.placeholder},0));for(let n=1;n<=12;n+=1)t.push((0,y.jsx)("option",{value:n,children:e.monthNames[n-1]},n));return(0,y.jsx)(de.Z,{isMinWidth:!0,name:`${e.name}[month]`,value:e.month,onChange:e.onValueChange,children:t})}function xe(e){const t=[];void 0!==e.placeholder&&t.push((0,y.jsx)("option",{value:"",children:e.placeholder},0));for(let e=1;e<=31;e+=1)t.push((0,y.jsx)("option",{value:e,children:e},e));return(0,y.jsx)(de.Z,{isMinWidth:!0,name:`${e.name}[day]`,value:e.day,onChange:e.onValueChange,children:t})}ye.propTypes={name:g().string.isRequired,placeholder:g().string.isRequired,onValueChange:g().func.isRequired,year:g().oneOfType([g().string,g().number]).isRequired},we.propTypes={name:g().string.isRequired,placeholder:g().string.isRequired,onValueChange:g().func.isRequired,month:g().oneOfType([g().string,g().number]).isRequired,monthNames:g().arrayOf(g().string).isRequired},xe.propTypes={name:g().string.isRequired,placeholder:g().string.isRequired,onValueChange:g().func.isRequired,day:g().oneOfType([g().string,g().number]).isRequired};class _e extends j.Component{constructor(e){super(e),this.state={year:"",month:"",day:""},this.onValueChange=this.onValueChange.bind(this)}componentDidMount(){this.extractDateParts()}componentDidUpdate(e){void 0!==this.props.item&&void 0!==e.item&&this.props.item.id!==e.item.id&&this.extractDateParts()}onValueChange(e){const t=e.target.name.match(/(.*?)\[(.*?)\]/);let n=null,r=null;if(null!==t&&3===t.length){[,n,r]=t;const a=Number(e.target.value);this.setState({[`${r}`]:a},(()=>{this.props.onValueChange({target:{name:n,value:this.formatValue()}})}))}}formatValue(){let e;switch(this.props.field.params.date_type){case"year_month_day":e={year:this.state.year,month:this.state.month,day:this.state.day};break;case"year_month":e={year:this.state.year,month:this.state.month};break;case"month":e={month:this.state.month};break;case"year":e={year:this.state.year};break;default:e={value:"invalid type"}}return e}extractDateParts(){const e=void 0!==this.props.item[this.props.field.name]?this.props.item[this.props.field.name].trim():"";if(""===e)return;const t=te()(e);this.setState({year:t.format("YYYY"),month:t.format("M"),day:t.format("D")})}render(){const e=window.mailpoet_month_names||[];let t=(window.mailpoet_date_formats||{})[this.props.field.params.date_type][0];this.props.field.params.date_format&&(t=this.props.field.params.date_format);const n=t.split("/").map((t=>{switch(t){case"YYYY":return(0,y.jsx)(ye,{onValueChange:this.onValueChange,name:this.props.field.name,year:this.state.year,placeholder:this.props.field.year_placeholder},"year");case"MM":return(0,y.jsx)(we,{onValueChange:this.onValueChange,name:this.props.field.name,month:this.state.month,monthNames:e,placeholder:this.props.field.month_placeholder},"month");case"DD":return(0,y.jsx)(xe,{onValueChange:this.onValueChange,name:this.props.field.name,day:this.state.day,placeholder:this.props.field.day_placeholder},"day");default:return(0,y.jsx)("div",{children:"Invalid date type"})}}));return(0,y.jsx)("div",{children:n})}}_e.propTypes={item:g().object.isRequired,field:g().shape({name:g().string,day_placeholder:g().string,month_placeholder:g().string,year_placeholder:g().string,params:g().object}).isRequired,onValueChange:g().func.isRequired};var Ze=_e,je=n(22529);class Ie extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"renderField",(e=>{let t,n=!1;e.field.description&&(n=(0,y.jsx)("p",{className:"description",children:e.field.description}));let r=e.field;switch(void 0!==e.field.field&&(r=u().merge(r,e.field.field)),r.type){case"text":t=(0,y.jsx)(ie,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"textarea":t=(0,y.jsx)(ce,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"select":t=(0,y.jsx)(pe,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"radio":t=(0,y.jsx)(fe,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"checkbox":t=(0,y.jsx)(be,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"selection":t=(0,y.jsx)(C,{onValueChange:e.onValueChange,field:e.field,automationId:e.automationId,inline:e.inline,description:e.description,item:e.item},`selection-field-${r.name}`);break;case"date":t=(0,y.jsx)(Ze,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"reactComponent":t=(0,y.jsx)(e.field.component,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"empty":break;default:t="invalid"}return(0,y.jsxs)("div",{className:"mailpoet-form-field",children:[t,n]},`field-${e.index||0}`)}))}render(){let e=!1;e=void 0!==this.props.field.fields?this.props.field.fields.map(((e,t)=>this.renderField({index:t,field:e,item:this.props.item,onValueChange:this.props.onValueChange||!1}))):this.renderField(this.props);let t=!1;this.props.field.label&&(t=(0,y.jsx)(je.Z,{level:4,children:(0,y.jsx)("label",{htmlFor:`field_${this.props.field.name}`,children:this.props.field.label})}));let n=!1;return this.props.field.tip&&(n=(0,y.jsx)("p",{className:"mailpoet-form-description",children:this.props.field.tip})),(0,y.jsxs)("div",{className:`mailpoet-form-field-${this.props.field.name} form-field-row-${this.props.field.name}`,children:[t,n,e]})}}Ie.propTypes={onValueChange:g().func,field:g().shape({name:g().string.isRequired,values:g().objectOf(g().string),tip:g().oneOfType([g().array,g().string]),label:g().string,fields:g().arrayOf(g().object),description:g().string}).isRequired,item:g().object.isRequired},Ie.defaultProps={onValueChange:function(){}};var Se=Ie,Ce=n(62698);class Te extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"getValues",(()=>this.props.item||this.state.item)),(0,Z.Z)(this,"getErrors",(()=>this.props.errors||this.state.errors)),(0,Z.Z)(this,"loadItem",(e=>{this.setState({loading:!0}),this.props.endpoint&&p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:this.props.endpoint,action:"get",data:{id:e}}).done((e=>{this.setState({loading:!1,item:e.data}),"function"==typeof this.props.onItemLoad&&this.props.onItemLoad(e.data)})).fail((()=>{this.setState({loading:!1,item:{}},(function(){this.props.history.push("/lists")}))}))})),(0,Z.Z)(this,"handleSubmit",(e=>{if(e.preventDefault(),void 0!==this.props.isValid&&!1===this.props.isValid())return;this.setState({loading:!0});const t={};this.props.fields.forEach((e=>{void 0!==e.fields?e.fields.forEach((e=>{t[e.name]=this.state.item[e.name]})):t[e.name]=this.state.item[e.name]})),void 0!==this.props.params.id&&(t.id=this.props.params.id),this.props.endpoint&&p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:this.props.endpoint,action:"save",data:t}).always((()=>{this.setState({loading:!1})})).done((()=>{void 0!==this.props.onSuccess?this.props.onSuccess():this.props.history.push("/"),void 0!==this.props.params.id?this.props.messages.onUpdate():this.props.messages.onCreate()})).fail((e=>{e.errors.length>0&&this.setState({errors:e.errors})}))})),(0,Z.Z)(this,"handleValueChange",(e=>{const{name:t,value:n}=e.target;return this.props.onChange?this.props.onChange(e):(this.setState((e=>{const r=e.item;return r[t]=n,{item:r}})),!0)})),this.formRef=(0,j.createRef)(),this.state={loading:!1,errors:[],item:{}}}componentDidMount(){void 0!==this.props.params.id?this.loadItem(this.props.params.id):re()((()=>{this.setState({item:u()(".mailpoet_form").mailpoetSerializeObject()})}))}componentDidUpdate(e){void 0===this.props.params.id&&e.location.pathname!==this.props.location.pathname&&(re()((()=>{this.setState({loading:!1,item:{}})})),void 0===this.props.item&&this.formRef.current.reset())}render(){let e;void 0!==this.getErrors()&&(e=this.getErrors().map((e=>(0,y.jsx)("div",{className:"mailpoet_notice notice inline error is-dismissible",children:(0,y.jsx)("p",{children:e.message})},`error-${e.message}`))));const t=h()("mailpoet_form",{mailpoet_form_loading:this.state.loading||this.props.loading});let n=!1,r=!1;void 0!==this.props.beforeFormContent&&(n=this.props.beforeFormContent(this.getValues())),void 0!==this.props.afterFormContent&&(r=this.props.afterFormContent(this.getValues()));const a=this.props.fields.map((e=>{let t=this.handleValueChange;return e.onBeforeChange&&(t=t=>(e.onBeforeChange(t),this.handleValueChange(t))),(0,y.jsx)(Se,{field:e,item:this.getValues(),onValueChange:t,automationId:e.automationId},`field-${e.name}`)}));let s=!1;return s=this.props.children?this.props.children:(0,y.jsx)(Ce.Button,{type:"submit",isDisabled:this.state.loading,children:p.Z.I18n.t("save")}),(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"mailpoet-form-content-around",children:n}),(0,y.jsxs)("form",{id:this.props.id,ref:this.formRef,className:t,onSubmit:void 0!==this.props.onSubmit?this.props.onSubmit:this.handleSubmit,"data-automation-id":this.props.automationId,children:[e,(0,y.jsxs)("div",{className:"mailpoet-form-grid",children:[a,(0,y.jsx)("div",{className:"mailpoet-form-actions",children:s})]})]}),(0,y.jsx)("div",{className:"mailpoet-form-content-around",children:r})]})}}Te.propTypes={params:g().shape({id:g().string}),location:g().shape({pathname:g().string}),item:g().object,errors:g().arrayOf(g().object),endpoint:g().string,fields:g().arrayOf(g().object),messages:g().shape({onUpdate:g().func,onCreate:g().func}),loading:g().bool,children:g().array,id:g().string,automationId:g().string,beforeFormContent:g().func,afterFormContent:g().func,onItemLoad:g().func,isValid:g().func,onChange:g().func,onSubmit:g().func,onSuccess:g().func,history:g().shape({push:g().func.isRequired}).isRequired},Te.defaultProps={params:{},location:{},errors:void 0,fields:void 0,item:void 0,onItemLoad:void 0,isValid:void 0,onSuccess:void 0,onChange:void 0,loading:!1,beforeFormContent:void 0,afterFormContent:void 0,children:void 0,id:"",onSubmit:void 0,automationId:"",messages:{onUpdate:()=>{},onCreate:()=>{}},endpoint:void 0};var ke=(0,c.withRouter)(Te),Ne=n(86529),De=n(71014);const Ee=[{name:"email",label:p.Z.I18n.t("email"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"first_name",label:p.Z.I18n.t("firstname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"last_name",label:p.Z.I18n.t("lastname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"status",label:p.Z.I18n.t("status"),type:"select",automationId:"subscriber-status",values:{subscribed:p.Z.I18n.t("subscribed"),unconfirmed:p.Z.I18n.t("unconfirmed"),unsubscribed:p.Z.I18n.t("unsubscribed"),inactive:p.Z.I18n.t("inactive"),bounced:p.Z.I18n.t("bounced")}},{name:"segments",label:p.Z.I18n.t("lists"),type:"selection",placeholder:p.Z.I18n.t("selectList"),tip:p.Z.I18n.t("welcomeEmailTip"),api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,selected:function(e){return!1===Array.isArray(e.subscriptions)?null:e.subscriptions.filter((e=>"subscribed"===e.status)).map((e=>e.segment_id))},filter:function(e){return!e.deleted_at&&"default"===e.type},getLabel:function(e){return e.name},getCount:function(e){return e.subscribers},getSearchLabel:function(e,t){let n="";return void 0!==t.subscriptions&&t.subscriptions.forEach((t=>{if(e.id===t.segment_id&&(n=e.name,"unsubscribed"===t.status)){const e=p.Z.Date.format(t.updated_at);n+=" (%1$s)".replace("%1$s",p.Z.I18n.t("unsubscribedOn").replace("%1$s",e))}})),n}}];(window.mailpoet_custom_fields||[]).forEach((e=>{const t={name:`cf_${e.id}`,label:e.name,type:e.type};switch(e.params&&(t.params=e.params,e.params.values&&(t.values=e.params.values)),e.type){case"date":t.year_placeholder=p.Z.I18n.t("year"),t.month_placeholder=p.Z.I18n.t("month"),t.day_placeholder=p.Z.I18n.t("day");break;case"select":t.placeholder="-";break;default:t.placeholder=""}Ee.push(t)}));const Oe={onUpdate:function(){p.Z.Notice.success(p.Z.I18n.t("subscriberUpdated"))},onCreate:function(){p.Z.Notice.success(p.Z.I18n.t("subscriberAdded")),p.Z.trackEvent("Subscribers > Add new")}};function Re(e){if(Number(e.wp_user_id)>0)return(0,y.jsx)("p",{className:"description",children:k()(p.Z.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,((t,n)=>(0,y.jsx)("a",{href:`user-edit.php?user_id=${e.wp_user_id}`,children:t},n)))})}function Ae(e){return(0,y.jsxs)(y.Fragment,{children:[e?.unsubscribes?.map((e=>{const t=te()(e.createdAt.date).format("dddd MMMM Do YYYY [at] h:mm:ss a");let n;return n="admin"===e.source?p.Z.I18n.t("unsubscribedAdmin").replace("%1$d",t).replace("%2$d",e.meta):"manage"===e.source?p.Z.I18n.t("unsubscribedManage").replace("%1$d",t):"newsletter"===e.source?k()(p.Z.I18n.t("unsubscribedNewsletter").replace("%1$d",t),/\[link\]/g,((t,n)=>(0,y.jsx)("a",{href:`admin.php?page=mailpoet-newsletter-editor&id=${e.newsletterId}`,children:e.newsletterSubject},n))):p.Z.I18n.t("unsubscribedUnknown").replace("%1$d",t),(0,y.jsx)("p",{className:"description",children:n},n)})),(0,y.jsxs)("p",{className:"description",children:[(0,y.jsx)("strong",{children:p.Z.I18n.t("tip")})," ",p.Z.I18n.t("customFieldsTip")]})]})}function Pe(e){let{match:t}=e;const n=(0,c.useLocation)(),r=(0,c.useHistory)(),a=n.state?.backUrl||"/";return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(De.Z,{}),(0,y.jsxs)(je.Z,{level:1,className:"mailpoet-title",children:[(0,y.jsx)("span",{children:p.Z.I18n.t("subscriber")}),(0,y.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:a,children:p.Z.I18n.t("backToList")})]}),(0,y.jsx)(D,{}),(0,y.jsx)(ke,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:Ee,params:t.params,messages:Oe,beforeFormContent:Re,afterFormContent:Ae,onSuccess:()=>r.push(a)})]})}Pe.propTypes={match:g().shape({params:g().shape({id:g().string}).isRequired}).isRequired};var Me=Pe,Le=n(5830),Fe=n(71304);function qe(e){let{email:t}=e;const n=(0,c.useLocation)().state?.backUrl||"/";return(0,y.jsxs)(je.Z,{level:1,className:"mailpoet-title",children:[(0,y.jsx)("span",{children:p.Z.I18n.t("statsHeading").replace("%s",t)}),(0,y.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:n,children:p.Z.I18n.t("backToList")})]})}var $e=n(83213);function Ue(e){let{totalSent:t,open:n,machineOpen:r,click:a,subscriber:s}=e,i=0,o=0,l=0,c=0;const d=t-(n+r),u=t>0;return u&&(i=Math.round(n/t*100),o=Math.round(r/t*100),l=Math.round(a/t*100),c=Math.round(d/t*100)),(0,y.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,y.jsx)("div",{className:"mailpoet-listing",children:(0,y.jsx)("table",{className:"mailpoet-listing-table",children:(0,y.jsxs)("tbody",{children:[(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:p.Z.I18n.t("statsSentEmail")}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:t.toLocaleString()})}),(0,y.jsx)("td",{})]}),(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:(0,y.jsx)(b.Z,{children:p.Z.I18n.t("statsOpened")})}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:n.toLocaleString()})}),(0,y.jsx)("td",{children:u&&(0,y.jsxs)(y.Fragment,{children:[i,"%"]})})]}),(0,y.jsxs)("tr",{children:[(0,y.jsxs)("td",{children:[(0,y.jsx)(b.Z,{children:p.Z.I18n.t("statsMachineOpened")}),(0,y.jsx)($e.Z,{tooltip:k()(p.Z.I18n.t("statsMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,y.jsx)("span",{style:{pointerEvents:"all"},children:(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/368-what-are-machine-opens",target:"_blank","data-beacon-article":"6124b7fb21ef206e5592e188",rel:"noopener noreferrer",children:e},"kb-link")},"machine-opened-info")))})]}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:r.toLocaleString()})}),(0,y.jsx)("td",{children:u&&(0,y.jsxs)(y.Fragment,{children:[o,"%"]})})]}),(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:(0,y.jsx)(b.Z,{isInverted:!0,children:p.Z.I18n.t("statsClicked")})}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:a.toLocaleString()})}),(0,y.jsx)("td",{children:u&&(0,y.jsxs)(y.Fragment,{children:[l,"%"]})})]}),(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:p.Z.I18n.t("statsNotClicked")}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:d.toLocaleString()})}),(0,y.jsx)("td",{children:u&&(0,y.jsxs)(y.Fragment,{children:[c,"%"]})})]}),(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:p.Z.I18n.t("statisticsColumn")}),(0,y.jsx)("td",{children:(0,y.jsx)("div",{className:"mailpoet-listing-stats",children:(0,y.jsx)(W,{id:s.id,engagementScore:s.engagement_score})})}),(0,y.jsx)("td",{})]})]})})})})}function Ve(e){let{revenueValue:t,count:n,averageRevenueValue:r}=e;return(0,y.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,y.jsx)("div",{className:"mailpoet-listing",children:(0,y.jsx)("table",{className:"mailpoet-listing-table",children:(0,y.jsxs)("tbody",{children:[(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:"Orders created"}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:n.toLocaleString()})})]}),(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:"Total revenue"}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:t})})]}),(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{children:"Average revenue"}),(0,y.jsx)("td",{children:(0,y.jsx)("b",{children:r})})]})]})})})})}var We=n(11645),Ye=n.n(We),Be=n(58901);function He(e){let{limitReached:t,limitValue:n,subscribersCountTowardsLimit:r,premiumActive:a,hasValidApiKey:s,hasPremiumSupport:i}=e;return(0,y.jsxs)("table",{className:"mailpoet-listing-table","data-automation-id":"subscriber-stats-no-access",children:[(0,y.jsx)("thead",{children:(0,y.jsxs)("tr",{children:[(0,y.jsx)("th",{children:p.Z.I18n.t("email")}),(0,y.jsx)("th",{children:p.Z.I18n.t("columnAction")}),(0,y.jsx)("th",{children:p.Z.I18n.t("columnCount")}),(0,y.jsx)("th",{children:p.Z.I18n.t("columnActionOn")})]})}),(0,y.jsx)("tbody",{children:(0,y.jsx)("tr",{children:(0,y.jsx)("td",{colSpan:4,children:(0,y.jsx)("div",{className:"mailpoet-subscriber-stats-no-access-content",children:(0,y.jsx)(Be.Z,{title:a&&t?p.Z.I18n.t("upgradeRequired"):p.Z.I18n.t("premiumFeature"),message:(()=>{let e=p.Z.I18n.t("premiumRequired");return a?(e=i?p.Z.I18n.t("planLimitReached"):p.Z.I18n.t("freeLimitReached"),(0,y.jsx)("p",{children:k()(e,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?r:n))})):(0,y.jsx)("p",{children:k()(e,/\[link](.*?)\[\/link]/g,(e=>(0,y.jsx)("a",{href:p.Z.premiumLink,children:e},e)))})})(),actionButton:a&&t?(0,y.jsx)(v.Z,{href:s?p.Z.MailPoetComUrlFactory.getUpgradeUrl():p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(r+1),children:p.Z.I18n.t("premiumBannerCtaUpgrade")}):(0,y.jsx)(v.Z,{href:p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount,p.Z.currentWpUserEmail,null,{utm_medium:"stats",utm_campaign:"signup"}),children:p.Z.I18n.t("premiumBannerCtaFree")})})})})})})]})}function ze(e){let{params:t,location:n}=e;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:4,children:p.Z.I18n.t("openedEmailsHeading")}),!p.Z.premiumActive||p.Z.subscribersLimitReached?(0,y.jsx)(He,{limitReached:p.Z.subscribersLimitReached,limitValue:p.Z.subscribersLimit,subscribersCountTowardsLimit:p.Z.subscribersCount,premiumActive:p.Z.premiumActive,hasValidApiKey:p.Z.hasValidApiKey,hasPremiumSupport:p.Z.hasPremiumSupport}):Ye().applyFilters("mailpoet_subscribers_opened_emails_stats",t,n)]})}function Ke(){const e=(0,c.useRouteMatch)(),t=(0,c.useLocation)(),[n,r]=(0,j.useState)(null),[a,s]=(0,j.useState)(!0),i=(0,Fe.S)(window).notices.error;return(0,j.useEffect)((()=>{p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"subscriberStats",action:"get",data:{subscriber_id:e.params.id}}).done((e=>{r(e.data),s(!1)})).fail((e=>{s(!1),e.errors.length>0&&i((0,y.jsx)(y.Fragment,{children:e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message)))}),{scroll:!0})}))}),[e.params.id,i]),a?(0,y.jsx)(Le.Z,{}):(0,y.jsxs)("div",{className:"mailpoet-subscriber-stats",children:[(0,y.jsx)(qe,{email:n.email}),(0,y.jsxs)("p",{children:[p.Z.I18n.t("lastEngagement"),": ",n.last_engagement?p.Z.Date.format(n.last_engagement):p.Z.I18n.t("never")]}),(0,y.jsxs)("div",{className:"mailpoet-subscriber-stats-summary-grid",children:[(0,y.jsx)(Ue,{click:n.click,open:n.open,machineOpen:n.machine_open,totalSent:n.total_sent,subscriber:{id:Number(e.params.id),engagement_score:n.engagement_score}}),n.woocommerce&&(0,y.jsx)(Ve,{averageRevenueValue:n.woocommerce.formatted_average,count:n.woocommerce.count,revenueValue:n.woocommerce.formatted})]}),(0,y.jsx)(ze,{params:e.params,location:t})]})}var Ge=n(93726);function Qe(){return(0,y.jsx)(Fe.k.Provider,{value:(0,Fe.S)(window),children:(0,y.jsxs)(l.UT,{children:[(0,y.jsx)(Ge.Z,{}),(0,y.jsxs)(c.Switch,{children:[(0,y.jsx)(c.Route,{path:"/new",component:Me}),(0,y.jsx)(c.Route,{path:"/edit/:id",component:Me}),(0,y.jsx)(c.Route,{path:"/stats/:id/(.*)?",component:Ke}),(0,y.jsx)(c.Route,{path:"*",component:J})]})]})})}const Xe=document.getElementById("subscribers_container");Xe&&o().render((0,y.jsx)(Qe,{}),Xe);var Je=n(68345);class et extends j.PureComponent{render(){const e=this.props.event,t=e.soon;let n;if(this.props.premium)n=(0,y.jsx)("a",{href:"?page=mailpoet-premium",target:"_blank",children:p.Z.I18n.t("premiumFeatureLink")});else if(e.actionButtonLink&&e.actionButtonTitle)n=(0,y.jsx)("a",{href:e.actionButtonLink,target:"_blank",rel:"noopener noreferrer",children:e.actionButtonTitle});else{const r=t?null:I.ZP.partial(this.props.eventsConfigurator,e.slug);n=(0,y.jsx)(v.Z,{disabled:t,onClick:r,role:"presentation",automationId:`create_${e.slug}`,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),r())},children:e.actionButtonTitle||p.Z.I18n.t("setUp")})}return(0,y.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,y.jsx)("div",{className:"mailpoet-newsletter-type-image",children:e.badge&&(0,y.jsx)(Je.Z,{title:e.badge.text})}),(0,y.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,y.jsxs)(je.Z,{level:4,children:[e.title," ",e.soon&&`(${p.Z.I18n.t("soon")})`]}),(0,y.jsx)("p",{children:e.description}),(0,y.jsx)("div",{className:"mailpoet-flex-grow"}),(0,y.jsx)("div",{className:"mailpoet-newsletter-type-action",children:n})]})]})}}et.defaultProps={premium:!1},et.propTypes={premium:g().bool,eventsConfigurator:g().func.isRequired,event:g().shape({slug:g().string.isRequired,actionButtonLink:g().string,title:g().string.isRequired,soon:g().bool,badge:g().shape({style:g().string,text:g().string}),description:g().string.isRequired,actionButtonTitle:g().string}).isRequired};var tt=et;class nt extends j.Component{constructor(e){super(e),this.email=this.props.email,this.emailEvents=this.email.events,this.eventsConfigurator=this.eventsConfigurator.bind(this)}eventsConfigurator(e){p.Z.trackEvent("Emails > Automatic Type selected",{"Email type":e}),this.props.history.push(`/new/${this.email.slug}/${e}/conditions`)}render(){return I.ZP.map(this.emailEvents,((e,t)=>(0,y.jsx)(tt,{premium:this.email.premium,event:e,eventsConfigurator:this.eventsConfigurator},t)))}}nt.propTypes={email:g().shape({title:g().string.isRequired,slug:g().string.isRequired,premium:g().bool}).isRequired,history:g().shape({push:g().func.isRequired}).isRequired};var rt=(0,c.withRouter)(nt),at={woocommerce:(0,y.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 120 71",style:{enableBackground:"new 0 0 120 71"},children:[(0,y.jsx)("path",{fill:"#9ca6cc",d:"M11.4,0.7h97.1c6.1,0,11.1,4.9,11.1,11v36.7c0,6.1-5,11-11.1,11H73.7L78.5,71l-21-11.6h-46 c-6.1,0-11.1-4.9-11.1-11V11.7C0.3,5.7,5.3,0.7,11.4,0.7z"}),(0,y.jsx)("path",{fill:"#fff",d:"M7.2,10.7c0.7-0.9,1.7-1.4,3.1-1.5c2.5-0.2,3.9,1,4.2,3.5c1.5,10,3.2,18.5,4.9,25.5l10.6-20 c1-1.8,2.2-2.8,3.6-2.9c2.1-0.1,3.4,1.2,4,4c1.2,6.4,2.8,11.8,4.6,16.4c1.3-12.2,3.4-21,6.4-26.4c0.7-1.3,1.8-2,3.2-2.1 c1.1-0.1,2.1,0.2,3.1,1c0.9,0.7,1.4,1.6,1.5,2.7c0,0.9-0.1,1.6-0.5,2.3c-1.9,3.5-3.4,9.3-4.7,17.3c-1.2,7.8-1.6,13.9-1.4,18.3 c0.1,1.2-0.1,2.3-0.6,3.2c-0.6,1.1-1.5,1.6-2.6,1.7c-1.3,0.1-2.6-0.5-3.8-1.8c-4.5-4.6-8.1-11.4-10.7-20.5c-3.2,6.1-5.5,10.8-7,13.8 c-2.9,5.4-5.3,8.2-7.3,8.4c-1.3,0.1-2.4-1-3.4-3.3C11.9,44.1,9.3,32,6.4,14C6.2,12.7,6.5,11.6,7.2,10.7z M111.3,18.3 c-1.7-3-4.3-4.9-7.8-5.6c-0.9-0.2-1.8-0.3-2.6-0.3c-4.7,0-8.4,2.4-11.4,7.2c-2.5,4.1-3.8,8.6-3.8,13.5c0,3.7,0.8,6.9,2.3,9.5 c1.7,3,4.3,4.9,7.8,5.6c0.9,0.2,1.8,0.3,2.6,0.3c4.7,0,8.5-2.4,11.4-7.2c2.5-4.1,3.8-8.6,3.8-13.6C113.7,24,112.9,20.9,111.3,18.3z M105.2,31.6c-0.7,3.2-1.9,5.5-3.7,7.1c-1.4,1.2-2.7,1.8-3.9,1.5c-1.2-0.2-2.1-1.2-2.9-3.1c-0.6-1.5-0.9-3-0.9-4.4 c0-1.2,0.1-2.4,0.3-3.5c0.4-2,1.3-3.9,2.6-5.7c1.6-2.4,3.3-3.3,5-3c1.2,0.2,2.1,1.2,2.9,3.1c0.6,1.5,0.9,3,0.9,4.4 C105.6,29.3,105.5,30.5,105.2,31.6z M81,18.3c-1.7-3-4.4-4.9-7.8-5.6c-0.9-0.2-1.8-0.3-2.6-0.3c-4.7,0-8.4,2.4-11.4,7.2 c-2.5,4.1-3.8,8.6-3.8,13.5c0,3.7,0.8,6.9,2.3,9.5c1.7,3,4.3,4.9,7.8,5.6c0.9,0.2,1.8,0.3,2.6,0.3c4.7,0,8.5-2.4,11.4-7.2 c2.5-4.1,3.8-8.6,3.8-13.6C83.3,24,82.5,20.9,81,18.3z M74.8,31.6c-0.7,3.2-1.9,5.5-3.7,7.1c-1.4,1.2-2.7,1.8-3.9,1.5 c-1.2-0.2-2.1-1.2-2.9-3.1c-0.6-1.5-0.9-3-0.9-4.4c0-1.2,0.1-2.4,0.3-3.5c0.4-2,1.3-3.9,2.6-5.7c1.6-2.4,3.3-3.3,5-3 c1.2,0.2,2.1,1.2,2.9,3.1c0.6,1.5,0.9,3,0.9,4.4C75.2,29.3,75.1,30.5,74.8,31.6z"})]})},st=n(33687),it=function(e){let{errors:t}=e;return t.length<1?null:(0,y.jsx)(N.Z,{type:"error",closable:!1,children:t.map((e=>(0,y.jsx)("p",{children:e.message},e.message)))})},ot=n(62210);function lt(e){let{filter:t,history:n,hideClosingButton:r=!1,hideScreenOptions:a=!0}=e;const[s,i]=(0,j.useState)(!1),o=e=>{void 0!==e&&(n.push(`/new/${e}`),p.Z.trackEvent("Emails > Type selected",{"Email type":e}))},l=async()=>{p.Z.trackEvent("Emails > Type selected",{"Email type":"wc_transactional"});let e=window.mailpoet_woocommerce_transactional_email_id;if(!e)try{e=(await p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"settings",action:"set",data:{"woocommerce.use_mailpoet_editor":1}})).data.woocommerce.transactional_email_id,p.Z.trackEvent("Emails > WooCommerce email customizer enabled")}catch(e){return(0,ot.q)(e)&&e.errors.length>0?(0,y.jsx)(it,{errors:e.errors}):null}return window.location.href=`?page=mailpoet-newsletter-editor&id=${e}`,null},c=e=>{const t=!0===window.mailpoet_is_new_user?"mailpoet_badge mailpoet_badge_video":"mailpoet_badge mailpoet_badge_video mailpoet_badge_video_grey";return(0,y.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,y.jsx)("div",{className:"mailpoet-newsletter-type-image"}),(0,y.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,y.jsxs)(je.Z,{level:4,children:[e.title," ",e.beta?`(${p.Z.I18n.t("beta")})`:""]}),(0,y.jsx)("p",{children:e.description}),e.videoGuide&&(0,y.jsxs)("a",{className:t,href:e.videoGuide,"data-beacon-article":e.videoGuideBeacon,target:"_blank",rel:"noopener noreferrer",children:[(0,y.jsx)("span",{className:"dashicons dashicons-format-video"}),p.Z.I18n.t("seeVideoGuide")]}),(0,y.jsx)("div",{className:"mailpoet-flex-grow"}),(0,y.jsx)("div",{className:"mailpoet-newsletter-type-action",children:e.action})]})]},e.slug)},d=I.ZP.partial((e=>{i(!0),p.Z.trackEvent("Emails > Type selected",{"Email type":e}),p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"newsletters",action:"create",data:{type:e,subject:p.Z.I18n.t("draftNewsletterTitle")}}).done((e=>{n.push(`/template/${e.data.id}`)})).fail((e=>(i(!1),e.errors.length>0?(0,y.jsx)(it,{errors:e.errors}):null)))}),"standard"),u=I.ZP.partial(o,"notification"),m=I.ZP.partial(o,"welcome"),h=I.ZP.partial(o,"re-engagement"),f=[{slug:"standard",title:p.Z.I18n.t("regularNewsletterTypeTitle"),description:p.Z.I18n.t("regularNewsletterTypeDescription"),action:(0,y.jsx)(v.Z,{automationId:"create_standard",onClick:d,tabIndex:0,withSpinner:s,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),d())},children:p.Z.I18n.t("create")})},{slug:"welcome",title:p.Z.I18n.t("welcomeNewsletterTypeTitle"),description:p.Z.I18n.t("welcomeNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/254-video-guide-to-welcome-emails",videoGuideBeacon:"5b05ebf20428635ba8b2aa53",action:(0,y.jsx)(v.Z,{onClick:m,automationId:"create_welcome",withSpinner:s,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),m())},tabIndex:0,children:p.Z.I18n.t("setUp")})},{slug:"notification",title:p.Z.I18n.t("postNotificationNewsletterTypeTitle"),description:p.Z.I18n.t("postNotificationNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/210-video-guide-to-post-notifications",videoGuideBeacon:"59ba6fb3042863033a1cd5a5",action:(0,y.jsx)(v.Z,{automationId:"create_notification",onClick:u,withSpinner:s,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),u())},children:p.Z.I18n.t("setUp")})},{slug:"re_engagement",title:p.Z.I18n.t("tabReEngagementTitle"),description:p.Z.I18n.t("reEngagementDescription"),action:(0,y.jsx)(v.Z,{automationId:"create_notification",onClick:h,withSpinner:s,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),h())},children:p.Z.I18n.t("setUp")})}];let g=Ye().applyFilters("mailpoet_newsletters_types",[...f],this);t&&(g=g.filter(t));const b=p.Z.Ajax.constructGetUrl({api_version:p.Z.apiVersion,endpoint:"newsletterTemplates",action:"getAll"});return(0,y.jsxs)(y.Fragment,{children:[a&&(0,y.jsx)(De.Z,{}),(0,y.jsx)("link",{rel:"prefetch",href:window.mailpoet_editor_javascript_url,as:"script"}),(0,y.jsxs)("div",{className:"mailpoet-newsletter-types",children:[!r&&(0,y.jsx)("div",{className:"mailpoet-newsletter-types-close",children:(0,y.jsx)("button",{type:"button",onClick:()=>n.push("/"),className:"mailpoet-modal-close",children:st.Z})}),g.map((e=>c(e)),this),(()=>{if(!window.mailpoet_woocommerce_automatic_emails)return[];let e=window.mailpoet_woocommerce_automatic_emails;return t&&(e=I.ZP.filter(e,t)),I.ZP.map(e,(e=>{const r=e;return(0,y.jsxs)(j.Fragment,{children:[!t&&(0,y.jsxs)("div",{className:"mailpoet-newsletter-types-separator",children:[(0,y.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"}),(0,y.jsx)("div",{className:"mailpoet-newsletter-types-separator-logo",children:at[r.slug]||null}),(0,y.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"})]}),(0,y.jsx)(rt,{email:r,history:n}),"woocommerce"===r.slug&&(p.Z.isWoocommerceActive?[{slug:"wc_transactional",title:p.Z.I18n.t("wooCommerceCustomizerTypeTitle"),description:p.Z.I18n.t("wooCommerceCustomizerTypeDescription"),action:(0,y.jsx)(v.Z,{automationId:"customize_woocommerce",onClick:l,tabIndex:0,onKeyDown:async e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),await l())},children:p.Z.I18n.t("customize")})}]:[]).map((e=>c(e)),this)]},r.slug)}))})()]}),(0,y.jsx)("link",{rel:"prefetch",href:b,as:"fetch"})]})}lt.defaultProps={filter:null,hideScreenOptions:!0,hideClosingButton:!1};var ct=(0,c.withRouter)(lt),dt=n(21526),ut=(0,c.withRouter)((e=>(0,y.jsx)(dt.Z,{...e}))),pt=n(80416),mt=n(12912),ht=n(9185);class ft extends j.Component{constructor(e){super(e),this.onPreview=this.onPreview.bind(this),this.onDelete=this.onDelete.bind(this),this.onSelect=this.onSelect.bind(this)}onDelete(){const{id:e,name:t,beforeDelete:n,afterDelete:r}=this.props;(0,ht.Z)({message:p.Z.I18n.t("confirmTemplateDeletion").replace("%1$s",t),onConfirm:()=>{n(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"delete",data:{id:e}}).done((()=>{r(!0,e)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}})}onPreview(){p.Z.Modal.popup({title:this.props.name,template:'<img src="{{ thumbnail }}" />',data:this.props})}onSelect(){const{newsletterId:e,name:t,beforeSelect:n,afterSelect:r}=this.props;n(),p.Z.trackEvent("Emails > Template selected",{"Email name":t}),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:{id:e,template_id:this.props.id}}).done((e=>{r(!0,e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}render(){const{index:e,name:t,thumbnail:n,readonly:r}=this.props;let a="";return"string"==typeof n&&n.length>0&&(a=(0,y.jsxs)("a",{className:"mailpoet-template-preview",href:"#",onClick:e=>{e.preventDefault(),this.onPreview(e)},children:[(0,y.jsx)("div",{className:"mailpoet-template-thumbnail",children:n?(0,y.jsx)("img",{src:n,alt:p.Z.I18n.t("templatePreview"),loading:"lazy"}):""}),(0,y.jsx)("div",{className:"mailpoet-template-preview-overlay",children:(0,y.jsx)(v.Z,{children:p.Z.I18n.t("zoom")})})]})),(0,y.jsx)(mt.Z,{label:t,onSelect:this.onSelect,onDelete:!1===r?this.onDelete:void 0,automationId:`select_template_${e}`,className:"mailpoet-template-two-lines",children:a})}}ft.contextType=Fe.k,ft.propTypes={index:g().number.isRequired,id:g().number.isRequired,newsletterId:g().string.isRequired,name:g().string.isRequired,thumbnail:g().string,readonly:g().bool.isRequired,beforeDelete:g().func.isRequired,afterDelete:g().func.isRequired,beforeSelect:g().func.isRequired,afterSelect:g().func.isRequired},ft.defaultProps={thumbnail:null};var gt=ft;class vt extends j.Component{constructor(e){super(e),this.fileRef=(0,j.createRef)(),this.handleSubmit=this.handleSubmit.bind(this)}handleSubmit(e){if(e.preventDefault(),I.ZP.size(this.fileRef.current.files)<=0)return!1;const t=I.ZP.first(this.fileRef.current.files),n=new FileReader;return n.onload=e=>{try{this.saveTemplate(JSON.parse(e.target.result)),p.Z.trackEvent("Emails > Template imported")}catch(e){this.context.notices.error((0,y.jsx)("p",{children:p.Z.I18n.t("templateFileMalformedError")}))}},n.readAsText(t),!0}saveTemplate(e){const t=e,{beforeImport:n,afterImport:r}=this.props;I.ZP.isUndefined(t.body)||(t.body=JSON.stringify(t.body));try{t.categories=JSON.parse(t.categories)}catch(e){t.categories=[]}-1===t.categories.indexOf("saved")&&t.categories.push("saved"),-1===t.categories.indexOf("standard")&&-1===t.categories.indexOf("welcome")&&-1===t.categories.indexOf("notification")&&t.categories.push("standard"),t.categories=JSON.stringify(t.categories),n(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:t}).done((e=>{r(!0,e.data)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}render(){return(0,y.jsxs)("div",{className:"mailpoet-template-import",children:[(0,y.jsxs)("h4",{children:[p.Z.I18n.t("importTemplateTitle"),(0,y.jsx)(M(),{tooltip:p.Z.I18n.t("helpTooltipTemplateUpload"),place:"right",className:"tooltip-help-import-template"})]}),(0,y.jsxs)("form",{onSubmit:this.handleSubmit,children:[(0,y.jsx)("input",{type:"file",placeholder:p.Z.I18n.t("selectJsonFileToUpload"),ref:this.fileRef}),(0,y.jsx)("p",{className:"submit",children:(0,y.jsx)("input",{className:"button button-primary",type:"submit",value:p.Z.I18n.t("upload")})})]})]})}}vt.contextType=Fe.k,vt.propTypes={beforeImport:g().func.isRequired,afterImport:g().func.isRequired};var bt=vt;const yt=[];window.mailpoet_newsletters_templates_recently_sent_count&&yt.push({name:"recent",label:p.Z.I18n.t("recentlySent")}),yt.push({name:"standard",label:p.Z.I18n.t("tabStandardTitle")},{name:"welcome",label:p.Z.I18n.t("tabWelcomeTitle")},{name:"notification",label:p.Z.I18n.t("tabNotificationTitle")},{name:"re_engagement",label:p.Z.I18n.t("tabReEngagementTitle")},{name:"blank",label:p.Z.I18n.t("tabBlankTitle")}),window.mailpoet_woocommerce_active&&yt.push({name:"woocommerce",label:p.Z.I18n.t("tabWoocommerceTitle")}),yt.push({name:"saved",label:p.Z.I18n.t("savedTemplates")});class wt extends j.Component{constructor(e){super(e),this.state={loading:!0,templates:{},emailType:null,selectedTab:""},this.templates={},this.addTemplate=this.addTemplate.bind(this),this.afterTemplateDelete=this.afterTemplateDelete.bind(this),this.afterTemplateSelect=this.afterTemplateSelect.bind(this),this.afterTemplateImport=this.afterTemplateImport.bind(this)}componentDidMount(){p.Z.Ajax.get({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"getAll"}).done((e=>{0===e.data.length&&(e.data=[{name:p.Z.I18n.t("mailpoetGuideTemplateTitle"),categories:'["welcome", "notification", "standard", "woocommerce"]',readonly:!0}]),e.data.forEach(this.addTemplate),this.sortTemplates()})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})})).always((()=>{this.selectInitialTab()}))}addTemplate(e){const t=yt.map((e=>e.name));let n;-1===t.indexOf("woocommerce")&&t.push("woocommerce");try{n=JSON.parse(e.categories).filter((e=>-1!==t.indexOf(e)))}catch(e){n=[]}0===n.length&&n.push("saved"),n.forEach((t=>{void 0===this.templates[t]&&(this.templates[t]=[]),this.templates[t].unshift(e)}))}sortTemplates(){const e=["welcome","notification","standard"];Object.keys(this.templates).forEach((t=>{this.templates[t].sort(((n,r)=>{if(e.includes(t)){if(n.categories.includes('"blank"')&&!r.categories.includes('"blank"'))return-1;if(!n.categories.includes('"blank"')&&r.categories.includes('"blank"'))return 1}return n.id<r.id?1:-1}))}))}selectInitialTab(){let e,t="standard";p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:this.props.match.params.id}}).done((n=>{e=n.data.type,"automatic"===e&&(e=n.data.options.group||e),window.mailpoet_newsletters_templates_recently_sent_count?t="recent":I.ZP.findWhere(yt,{name:n.data.type})?t=n.data.type:"automatic"===n.data.type&&I.ZP.findWhere(yt,{name:n.data.options.group})&&(t=n.data.options.group)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})})).always((()=>{this.setState({templates:this.templates,emailType:e,selectedTab:t,loading:!1})}))}afterTemplateDelete(e,t){e&&Object.keys(this.templates).forEach((e=>{this.templates[e]=this.templates[e].filter((e=>e.id!==t))})),this.setState({templates:this.templates,loading:!1})}afterTemplateSelect(e,t){e?window.location=(e=>`admin.php?page=mailpoet-newsletter-editor&id=${e}`)(t):this.setState({loading:!1})}afterTemplateImport(e,t){e&&this.addTemplate(t),this.setState({templates:this.templates,selectedTab:e?"saved":"import",loading:!1})}render(){if(this.state.loading)return(0,y.jsx)(Le.Z,{});const e=yt.concat({name:"import",label:p.Z.I18n.t("tabImportTitle")}).map((e=>Object.assign(e,{automationId:`templates-${e.name.replace(/\s+/g,"-").toLowerCase()}`})));let t=null;if("import"===this.state.selectedTab)t=(0,y.jsx)(bt,{beforeImport:()=>this.setState({loading:!0}),afterImport:this.afterTemplateImport});else{let e=this.state.templates[this.state.selectedTab]||[];e=0===e.length?this.state.loading?null:(0,y.jsx)("p",{children:p.Z.I18n.t("noTemplates")}):e.map(((e,t)=>(0,y.jsx)(gt,{index:t,newsletterId:this.props.match.params.id,beforeDelete:()=>this.setState({loading:!0}),afterDelete:this.afterTemplateDelete,beforeSelect:()=>this.setState({loading:!0}),afterSelect:this.afterTemplateSelect,id:e.id,name:e.name,thumbnail:e.thumbnail,readonly:e.readonly},e.id))),t=e}return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(ut,{emailType:this.state.emailType,automationId:"email_template_selection_heading"}),(0,y.jsxs)("div",{className:"mailpoet-templates",children:[(0,y.jsx)(pt.Z,{categories:e,active:this.state.selectedTab,onSelect:e=>this.setState({selectedTab:e})}),t]})]})}}wt.contextType=Fe.k,wt.propTypes={match:g().shape({params:g().shape({id:g().string}).isRequired}).isRequired};var xt=wt,_t=n(11830),Zt=n(9198),jt=n.n(Zt),It=function(e){var t;let{dimension:n,isFullWidth:r,iconStart:a,iconEnd:s,...i}=e;return(0,y.jsxs)("div",{className:h()("mailpoet-datepicker mailpoet-form-input",{[`mailpoet-form-input-${n}`]:n,"mailpoet-disabled":i.disabled,"mailpoet-full-width":r}),children:[a,(0,y.jsx)(jt(),{useWeekdaysShort:!0,calendarStartDay:null!==(t=i.calendarStartDay)&&void 0!==t?t:p.Z.wpWeekStartsOn,...i}),s]})},St=n(4958),Ct=n(16245),Tt=n.n(Ct);const kt={abbreviated:[p.Z.I18n.t("januaryShort"),p.Z.I18n.t("februaryShort"),p.Z.I18n.t("marchShort"),p.Z.I18n.t("aprilShort"),p.Z.I18n.t("mayShort"),p.Z.I18n.t("juneShort"),p.Z.I18n.t("julyShort"),p.Z.I18n.t("augustShort"),p.Z.I18n.t("septemberShort"),p.Z.I18n.t("octoberShort"),p.Z.I18n.t("novemberShort"),p.Z.I18n.t("decemberShort")],wide:[p.Z.I18n.t("january"),p.Z.I18n.t("february"),p.Z.I18n.t("march"),p.Z.I18n.t("april"),p.Z.I18n.t("may"),p.Z.I18n.t("june"),p.Z.I18n.t("july"),p.Z.I18n.t("august"),p.Z.I18n.t("september"),p.Z.I18n.t("october"),p.Z.I18n.t("november"),p.Z.I18n.t("december")]},Nt={narrow:[p.Z.I18n.t("sundayMin"),p.Z.I18n.t("mondayMin"),p.Z.I18n.t("tuesdayMin"),p.Z.I18n.t("wednesdayMin"),p.Z.I18n.t("thursdayMin"),p.Z.I18n.t("fridayMin"),p.Z.I18n.t("saturdayMin")],abbreviated:[p.Z.I18n.t("sundayShort"),p.Z.I18n.t("mondayShort"),p.Z.I18n.t("tuesdayShort"),p.Z.I18n.t("wednesdayShort"),p.Z.I18n.t("thursdayShort"),p.Z.I18n.t("fridayShort"),p.Z.I18n.t("saturdayShort")],wide:[p.Z.I18n.t("sunday"),p.Z.I18n.t("monday"),p.Z.I18n.t("tuesday"),p.Z.I18n.t("wednesday"),p.Z.I18n.t("thursday"),p.Z.I18n.t("friday"),p.Z.I18n.t("saturday")]};St.Z.localize.month=Tt()({values:kt,defaultWidth:"wide"}),St.Z.localize.day=Tt()({values:Nt,defaultWidth:"wide"}),St.Z.options.weekStartsOn=void 0!==p.Z.wpWeekStartsOn?p.Z.wpWeekStartsOn:1,(0,Zt.registerLocale)("mailpoet",St.Z);class Dt extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"onChange",((e,t)=>{const n=t,r=this.getStorageDate(e);n.target.name=this.getFieldName(),n.target.value=r,this.props.onChange(n)})),(0,Z.Z)(this,"getFieldName",(()=>this.props.name||"date")),(0,Z.Z)(this,"getDisplayDateFormat",(e=>p.Z.Date.convertFormat(e).replace(/D/g,"d").replace(/Y/g,"y").replace(/\[/g,"").replace(/\]/g,""))),(0,Z.Z)(this,"getDate",(e=>{const t={parseFormat:this.props.storageFormat};return p.Z.Date.toDate(e,t)})),(0,Z.Z)(this,"getStorageDate",(e=>{const t={format:this.props.storageFormat};return p.Z.Date.format(e,t)}))}render(){return(0,y.jsx)(It,{name:this.getFieldName(),selected:this.getDate(this.props.value),dateFormat:this.getDisplayDateFormat(this.props.displayFormat),disabled:this.props.disabled,onChange:this.onChange,minDate:this.getDate(window.mailpoet_current_date),maxDate:this.props.maxDate,locale:"mailpoet",...this.props.validation})}}Dt.propTypes={displayFormat:g().string.isRequired,onChange:g().func.isRequired,name:g().string,storageFormat:g().string.isRequired,value:g().string.isRequired,disabled:g().bool.isRequired,validation:g().shape({"data-parsley-required":g().bool,"data-parsley-required-message":g().string,"data-parsley-type":g().string,"data-parsley-errors-container":g().string,maxLength:g().number}).isRequired,maxDate:g().instanceOf(Date)},Dt.defaultProps={name:"date",maxDate:null};var Et=Dt;class Ot extends j.Component{render(){const e=Object.keys(this.props.timeOfDayItems).map((e=>(0,y.jsx)("option",{value:e,children:this.props.timeOfDayItems[e]},`option-${this.props.timeOfDayItems[e]}`)));return(0,y.jsx)(de.Z,{name:this.props.name||"time",value:this.props.value,disabled:this.props.disabled,onChange:this.props.onChange,isMinWidth:!0,...this.props.validation,children:e})}}Ot.propTypes={timeOfDayItems:g().objectOf(g().string).isRequired,name:g().string,value:g().string.isRequired,disabled:g().bool,onChange:g().func.isRequired,validation:g().object},Ot.defaultProps={name:"time",disabled:!1,validation:{}};var Rt=Ot;class At extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"DATE_TIME_SEPARATOR"," "),(0,Z.Z)(this,"getDateTime",(()=>[this.state.date,this.state.time].join(this.DATE_TIME_SEPARATOR))),(0,Z.Z)(this,"buildStateFromProps",(e=>{const t=e.value||this.props.defaultDateTime,[n,r]=t.split(this.DATE_TIME_SEPARATOR);return{date:n,time:r}})),(0,Z.Z)(this,"handleChange",(e=>{const t={};t[e.target.name]=e.target.value,this.setState(t,this.propagateChange)})),(0,Z.Z)(this,"propagateChange",(()=>{this.props.onChange&&this.props.onChange({target:{name:this.props.name||"",value:this.getDateTime()}})})),this.state=this.buildStateFromProps(e)}componentDidUpdate(e){this.props.value===e.value&&this.props.defaultDateTime===e.defaultDateTime||re()((()=>{this.setState(this.buildStateFromProps(this.props))}))}render(){return(0,y.jsxs)(_t.r.Column,{className:"mailpoet-datetime-container",children:[(0,y.jsx)(Et,{name:"date",value:this.state.date,onChange:this.handleChange,displayFormat:this.props.dateDisplayFormat,storageFormat:this.props.dateStorageFormat,disabled:this.props.disabled,validation:this.props.dateValidation,maxDate:this.props.maxDate}),(0,y.jsx)(Rt,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems})]})}}At.propTypes={value:g().string,defaultDateTime:g().string.isRequired,dateDisplayFormat:g().string.isRequired,dateStorageFormat:g().string.isRequired,onChange:g().func,name:g().string,disabled:g().bool,dateValidation:g().object.isRequired,timeValidation:g().any,timeOfDayItems:g().objectOf(g().string).isRequired,maxDate:g().instanceOf(Date)},At.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0,value:void 0,maxDate:null};var Pt=At,Mt=n(43246);class Lt extends j.Component{constructor(e){super(e),this.state={emailAddress:e.item.sender_address},this.onChange=this.onChange.bind(this)}onChange(e){this.setState({emailAddress:e.target.value.toLowerCase()}),this.props.onValueChange({...e,target:{...e.target,name:e.target.name,value:e.target.value.toLowerCase()}})}render(){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(ie,{item:{...this.props.item,sender_address:this.state.emailAddress},field:this.props.field,onValueChange:this.onChange}),(0,y.jsx)("div",{className:"regular-text",children:(0,y.jsx)(Mt.Z,{emailAddress:this.state.emailAddress,mssActive:window.mailpoet_mss_active})})]})}}Lt.propTypes={field:g().object.isRequired,item:g().shape({sender_address:g().string.isRequired}).isRequired,onValueChange:g().func},Lt.defaultProps={onValueChange:function(){}};var Ft=Lt;const qt=I.ZP.once((()=>p.Z.trackEvent("User has typed a GA campaign name"))),$t=k()(p.Z.I18n.t("gaCampaignTip"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,y.jsxs)("span",{children:[(0,y.jsx)("br",{}),(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/187-track-your-newsletters-subscribers-in-google-analytics","data-beacon-article":"58b597d12c7d3a576d359144",target:"_blank",rel:"noopener noreferrer",className:"mailpoet-link",children:e})]},t)));var Ut={name:"ga_campaign",label:p.Z.I18n.t("gaCampaignLine"),tip:$t,type:"text",onBeforeChange:qt},Vt=function(e){let{dimension:t,onCheck:n,automationId:r,className:a,...s}=e;return(0,y.jsxs)("label",{className:h()({[a]:a,"mailpoet-form-toggle":!0,[`mailpoet-form-toggle-${t}`]:t,"mailpoet-disabled":s.disabled}),"data-automation-id":r,children:[(0,y.jsx)("input",{type:"checkbox",onChange:e=>n(e.target.checked,e),...s}),(0,y.jsx)("span",{className:"mailpoet-form-toggle-control"})]})};let Wt,Yt;!function(e){e.Standard="standard",e.Automatic="automatic",e.Welcome="welcome",e.Notification="notification",e.NotificationHistory="notification_history",e.WCTransactional="wc_transactional",e.ReEngagement="re_engagement"}(Wt||(Wt={})),function(e){e.Draft="draft",e.Scheduled="scheduled",e.Sending="sending",e.Sent="sent",e.Active="active"}(Yt||(Yt={}));const Bt=window.mailpoet_current_time||"00:00",Ht=`${window.mailpoet_tomorrow_date} 08:00:00`,zt=window.mailpoet_schedule_time_of_day,Kt=window.mailpoet_date_display_format,Gt=window.mailpoet_date_storage_format;class Qt extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"getCurrentValue",(()=>{var e;return{isScheduled:"0",scheduledAt:Ht,...null!==(e=this.props.item?.[this.props.field.name])&&void 0!==e?e:{}}})),(0,Z.Z)(this,"getDateValidation",(()=>({"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("noScheduledDateError"),"data-parsley-errors-container":"#mailpoet_scheduling"}))),(0,Z.Z)(this,"isScheduled",(()=>"1"===this.getCurrentValue().isScheduled)),(0,Z.Z)(this,"handleCheckboxChange",((e,t)=>{const n={...t};n.target.value=t.target.checked?"1":"0",this.handleValueChange(n)})),(0,Z.Z)(this,"handleValueChange",(e=>{const t=this.getCurrentValue(),n={};n[e.target.name]=e.target.value,this.props.onValueChange({target:{name:this.props.field.name,value:{...t,...n}}})}))}render(){let e;const t=new Date;return t.setFullYear(t.getFullYear()+5),this.isScheduled()&&(e=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("span",{className:"mailpoet-form-schedule-time",children:[p.Z.I18n.t("websiteTimeIs")," ",Bt]}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("div",{id:"mailpoet_scheduling",children:(0,y.jsx)(Pt,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:Ht,timeOfDayItems:zt,dateDisplayFormat:Kt,dateStorageFormat:Gt,maxDate:t})})]})),(0,y.jsxs)("div",{children:[(0,y.jsx)(Vt,{checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onCheck:this.handleCheckboxChange,automationId:"email-schedule-checkbox"}),e]})}}let Xt=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:p.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:p.Z.I18n.t("subjectLine"),tooltip:p.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:p.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:p.Z.I18n.t("preheaderLine"),tooltip:`${p.Z.I18n.t("preheaderLineTip1")} ${p.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"segments",label:p.Z.I18n.t("segments"),tip:p.Z.I18n.t("segmentsTip"),type:"selection",placeholder:p.Z.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems()||[];return e.map((e=>t.find((t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("noSegmentsSelectedError")}},{name:"options",label:p.Z.I18n.t("scheduleIt"),type:"reactComponent",component:Qt},{name:"sender",label:p.Z.I18n.t("sender"),tip:p.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:p.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:p.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Ut,{name:"reply-to",label:p.Z.I18n.t("replyTo"),tip:p.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:p.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:p.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Xt=Ye().applyFilters("mailpoet_newsletters_3rd_step_fields",Xt);var Jt={getFields:()=>Xt,getSendButtonOptions:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=te()(window.mailpoet_current_date_time),n="object"==typeof e.options&&"1"===e.options?.isScheduled&&p.Z.Date.isInFuture(e.options?.scheduledAt,t),r={value:n?p.Z.I18n.t("schedule"):p.Z.I18n.t("send")};return e.status!==Yt.Sent&&e.status!==Yt.Sending||(r.disabled="disabled"),r}};const en=window.mailpoet_time_format||"H:i",tn={immediate:p.Z.I18n.t("delayImmediately"),hours:p.Z.I18n.t("delayHoursAfter"),days:p.Z.I18n.t("delayDaysAfter"),weeks:p.Z.I18n.t("delayWeeksAfter")},nn={daily:p.Z.I18n.t("daily"),weekly:p.Z.I18n.t("weekly"),monthly:p.Z.I18n.t("monthly"),nthWeekDay:p.Z.I18n.t("monthlyEvery"),immediately:p.Z.I18n.t("immediately")},rn=I.ZP.object(I.ZP.map(I.ZP.times(24,(e=>3600*e)),(e=>{const t=new Date(null);return t.setSeconds(e),[e,p.Z.Date.format(t,{format:en,offset:0})]}))),an={0:p.Z.I18n.t("sunday"),1:p.Z.I18n.t("monday"),2:p.Z.I18n.t("tuesday"),3:p.Z.I18n.t("wednesday"),4:p.Z.I18n.t("thursday"),5:p.Z.I18n.t("friday"),6:p.Z.I18n.t("saturday")},sn=I.ZP.object(I.ZP.map(I.ZP.times(28,(e=>e)),(e=>{const t={0:p.Z.I18n.t("first"),1:p.Z.I18n.t("second"),2:p.Z.I18n.t("third")};let n;return n=void 0!==t[e]?t[e]:p.Z.I18n.t("nth").replace("%1$d",e+1),[e+1,n]}))),on={1:p.Z.I18n.t("first"),2:p.Z.I18n.t("second"),3:p.Z.I18n.t("third"),L:p.Z.I18n.t("last")},ln={name:"intervalType",values:nn},cn={name:"timeOfDay",values:rn},dn={name:"weekDay",values:an},un={name:"monthDay",values:sn},pn={name:"nthWeekDay",values:on};class mn extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,Z.Z)(this,"handleValueChanges",(e=>{const t=this.getCurrentValue();return this.props.onValueChange({target:{name:this.props.field.name,value:I.ZP.extend({},t,e)}})})),(0,Z.Z)(this,"handleIntervalChange",(e=>{const t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),this.handleValueChanges(n)})),(0,Z.Z)(this,"handleTimeOfDayChange",(e=>this.handleValueChanges({timeOfDay:e.target.value}))),(0,Z.Z)(this,"handleWeekDayChange",(e=>this.handleValueChanges({weekDay:e.target.value}))),(0,Z.Z)(this,"handleMonthDayChange",(e=>this.handleValueChanges({monthDay:e.target.value}))),(0,Z.Z)(this,"handleNthWeekDayChange",(e=>this.handleValueChanges({nthWeekDay:e.target.value})))}render(){const e=this.getCurrentValue();let t,n,r,a;return"immediately"!==e.intervalType&&(t=(0,y.jsx)(pe,{field:cn,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==e.intervalType&&"nthWeekDay"!==e.intervalType||(n=(0,y.jsx)(pe,{field:dn,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===e.intervalType&&(r=(0,y.jsx)(pe,{field:un,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===e.intervalType&&(a=(0,y.jsx)(pe,{field:pn,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),(0,y.jsxs)("div",{children:[(0,y.jsx)(pe,{field:ln,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[a,r,n,t]}),"immediately"!==e.intervalType&&(0,y.jsx)("div",{className:"mailpoet-gap"})]})}}mn.propTypes={item:g().object.isRequired,field:g().shape({name:g().string}).isRequired,onValueChange:g().func.isRequired};var hn=mn;let fn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:p.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:p.Z.I18n.t("subjectLine"),tooltip:p.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:p.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:p.Z.I18n.t("preheaderLine"),tooltip:`${p.Z.I18n.t("preheaderLineTip1")} ${p.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:p.Z.I18n.t("selectFrequency"),type:"reactComponent",component:hn},{name:"segments",label:p.Z.I18n.t("segments"),tip:p.Z.I18n.t("segmentsTip"),type:"selection",placeholder:p.Z.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return I.ZP.map(e,(e=>I.ZP.find(t,(t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:p.Z.I18n.t("sender"),tip:p.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:p.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:p.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Ut,{name:"reply-to",label:p.Z.I18n.t("replyTo"),tip:p.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:p.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:p.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];fn=Ye().applyFilters("mailpoet_newsletters_3rd_step_fields",fn);var gn={getFields:function(){return fn},getSendButtonOptions:function(){return{value:p.Z.I18n.t("activate")}}};const vn=window.mailpoet_roles||{},bn=I.ZP.filter(window.mailpoet_segments||[],(e=>"default"===e.type)),yn={name:"event",values:{segment:p.Z.I18n.t("onSubscriptionToList"),user:p.Z.I18n.t("onWPUserRegistration")}},wn={name:"segment",placeholder:p.Z.I18n.t("selectSegmentPlaceholder"),forceSelect2:!0,values:bn,getCount:e=>parseInt(e.subscribers,10).toLocaleString(),getLabel:e=>e.name,getValue:e=>e.id},xn={name:"role",values:vn},_n={name:"afterTimeNumber",size:3,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":p.Z.I18n.t("emailCanBeScheduledUpToFiveYears")}},Zn={name:"afterTimeType",values:tn};class jn extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,Z.Z)(this,"handleValueChange",((e,t)=>{const n=this.getCurrentValue(),r={};let a=t;return"afterTimeNumber"===e&&(a=parseInt(t,10),a=Number.isNaN(a)?"":a),r[e]=a,this.props.onValueChange({target:{name:this.props.field.name,value:I.ZP.extend({},n,r)}})})),(0,Z.Z)(this,"handleEventChange",(e=>this.handleValueChange("event",e.target.value))),(0,Z.Z)(this,"handleSegmentChange",(e=>this.handleValueChange("segment",e.target.value))),(0,Z.Z)(this,"handleRoleChange",(e=>this.handleValueChange("role",e.target.value))),(0,Z.Z)(this,"handleAfterTimeNumberChange",(e=>this.handleValueChange("afterTimeNumber",e.target.value))),(0,Z.Z)(this,"handleAfterTimeTypeChange",(e=>this.handleValueChange("afterTimeType",e.target.value)))}render(){const e=this.getCurrentValue();let t,n;return t="user"===e.event?(0,y.jsx)(pe,{field:xn,item:this.getCurrentValue(),onValueChange:this.handleRoleChange}):(0,y.jsx)(C,{field:wn,item:this.getCurrentValue(),onValueChange:this.handleSegmentChange}),"immediate"!==e.afterTimeType&&(n=(0,y.jsx)(ie,{field:_n,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeNumberChange})),(0,y.jsxs)("div",{children:[(0,y.jsx)(pe,{field:yn,item:this.getCurrentValue(),onValueChange:this.handleEventChange}),(0,y.jsx)("div",{className:"mailpoet-gap"}),t,(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[n,(0,y.jsx)(pe,{field:Zn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeTypeChange})]}),(0,y.jsx)("div",{className:"mailpoet-form-errors"}),(0,y.jsx)("div",{className:"mailpoet-gap"})]})}}jn.propTypes={history:g().shape({push:g().func.isRequired}).isRequired,item:g().object.isRequired,field:g().shape({name:g().string}).isRequired,onValueChange:g().func.isRequired};var In=(0,c.withRouter)(jn);let Sn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:p.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:p.Z.I18n.t("subjectLine"),tooltip:p.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:p.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:p.Z.I18n.t("preheaderLine"),tooltip:`${p.Z.I18n.t("preheaderLineTip1")} ${p.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:p.Z.I18n.t("selectEventToSendWelcomeEmail"),type:"reactComponent",component:In},Ut,{name:"sender",label:p.Z.I18n.t("sender"),tip:p.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:p.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:p.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:p.Z.I18n.t("replyTo"),tip:p.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:p.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:p.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Sn=Ye().applyFilters("mailpoet_newsletters_3rd_step_fields",Sn);var Cn={getFields:function(){return Sn},getSendButtonOptions:function(){return{value:p.Z.I18n.t("activate")}}};class Tn extends j.Component{constructor(e){super(e);const{item:t,event:n}=this.props;this.handleChange=this.handleChange.bind(this);const r=t.afterTimeType||n.defaultAfterTimeType||"immediate",a="minutes"===r?30:1,s=t.afterTimeNumber||a;this.state={afterTimeType:r,afterTimeNumber:s},t.afterTimeNumber===s&&t.afterTimeType===r||this.propagateChange(this.state)}handleChange(e,t){let{value:n}=e.target;"afterTimeNumber"===t&&(n=parseInt(e.target.value,10),n=Number.isNaN(n)?null:n);const r={[t]:n},{afterTimeType:a}=this.state;"afterTimeType"===t&&a!==n&&("minutes"===a&&(r.afterTimeNumber=1),"minutes"===n&&(r.afterTimeNumber=30)),this.setState(r,this.propagateChange(r))}displayAfterTimeTypeOptions(){const{event:e}=this.props;let t=tn;e.timeDelayValues&&(t=Object.entries(e.timeDelayValues).reduce(((e,t)=>{let[n,r]=t;return e[n]=r.text,e}),{}));const{afterTimeType:n}=this.state,r={field:{id:"scheduling_time_interval",name:"scheduling_time_interval",forceSelect2:!0,values:I.ZP.map(t,((e,t)=>({name:e,id:t}))),extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>n},onValueChange:I.ZP.partial(this.handleChange,I.ZP,"afterTimeType")};return(0,y.jsx)(C,{field:r.field,onValueChange:r.onValueChange})}displayAfterTimeNumberField(){const{afterTimeNumberSize:e,event:t}=this.props,{afterTimeType:n,afterTimeNumber:r}=this.state;if("immediate"===n)return null;if(t.timeDelayValues&&t.timeDelayValues[n]&&!t.timeDelayValues[n].displayAfterTimeNumberField)return null;const a={field:{id:"scheduling_time_duration",name:"scheduling_time_duration",defaultValue:r?r.toString():"",size:e,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":p.Z.I18n.t("emailCanBeScheduledUpToFiveYears")}},item:{},onValueChange:I.ZP.partial(this.handleChange,I.ZP,"afterTimeNumber")};return(0,y.jsx)(ie,{field:a.field,item:a.item,onValueChange:a.onValueChange})}propagateChange(e){const{onValueChange:t}=this.props;t&&t(e)}render(){const{event:e}=this.props;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[this.displayAfterTimeNumberField(),this.displayAfterTimeTypeOptions()]}),(0,y.jsx)("div",{className:"mailpoet-form-errors"}),(0,y.jsx)("div",{className:"mailpoet-gap"}),e.schedulingReadMoreLink&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("a",{href:e.schedulingReadMoreLink.link,target:"_blank",rel:"noopener noreferrer",className:"event-scheduling-read-more-link",children:e.schedulingReadMoreLink.text}),(0,y.jsx)("div",{className:"mailpoet-gap"})]})]})}}Tn.propTypes={item:g().shape({afterTimeType:g().string.isRequired,afterTimeNumber:g().number}).isRequired,afterTimeNumberSize:g().number,onValueChange:g().func,event:g().shape({defaultAfterTimeType:g().string,timeDelayValues:g().objectOf(g().shape({text:g().string,displayAfterTimeNumberField:g().bool})),schedulingReadMoreLink:g().shape({link:g().string.isRequired,text:g().string.isRequired})}).isRequired},Tn.defaultProps={afterTimeNumberSize:3,onValueChange:null};var kn=Tn;function Nn(e){const t=e&&e.values?e.values:[];return t?t.map((e=>({id:e.id,name:e.name}))):t}var Dn=function(e){let{eventOptions:t,eventSlug:n,selected:r,onValueChange:a}=e;function s(e){a&&a({eventOptionValue:e.target.value})}return(0,y.jsx)("div",{children:(0,y.jsx)("div",{className:"event-option-selection",children:function(){if(!t)return t;const e={field:{name:`event_options_${n}`,forceSelect2:!0,endpoint:t.endpoint,resetSelect2OnUpdate:!0,values:Nn(t),multiple:t.multiple||!1,placeholder:t.placeholder||!1,transformChangedValue:(e,t)=>I.ZP.map(t,(e=>({id:e.id,name:e.text}))),selected:()=>r,getLabel:I.ZP.property("name"),getValue:I.ZP.property("id"),validation:{"data-parsley-required":!0}},onValueChange:s,item:{action:""}};return"product_categories"===t.endpoint&&(e.field.name="category_ids",e.item={action:"purchasedCategory"}),"products"===t.endpoint&&(e.field.name="product_ids",e.item={action:"purchasedProduct"}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(C,{field:e.field,onValueChange:e.onValueChange,item:e.item}),(0,y.jsx)("div",{className:"mailpoet-gap"})]})}()})})};class En extends j.Component{constructor(e){super(e);const{field:t}=e;this.handleChange=this.handleChange.bind(this),this.email=t.email,this.emailOptions=t.emailOptions,this.events=I.ZP.indexBy(this.email.events,"slug"),this.segments=I.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const n=this.events[this.emailOptions.event],r=this.emailOptions.afterTimeType||n.defaultAfterTimeType||"immediate";this.state={event:n,afterTimeType:r,eventSlug:this.emailOptions.event,eventOptionValue:null,afterTimeNumber:this.emailOptions.afterTimeNumber||1,segment:this.emailOptions.segment?this.emailOptions.segment:null}}handleChange(e){const{afterTimeNumber:t}=this.state,n=e;n.afterTimeType&&"immediate"===n.afterTimeType?n.afterTimeNumber=null:!n.afterTimeType||n.afterTimeNumber||t||(n.afterTimeNumber=1),this.setState(e,this.propagateChange)}displayScheduling(){const{afterTimeNumber:e,afterTimeType:t,event:n}=this.state,r={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return(0,y.jsx)(kn,{item:r.item,event:r.event,onValueChange:r.onValueChange})}displaySegments(){const{segment:e}=this.state;if("user"===this.emailOptions.sendTo)return null;const t={field:{id:"segments",forceSelect2:!0,values:this.segments,extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>e},onValueChange:e=>this.handleChange({segment:e.target.value})};return(0,y.jsx)("div",{className:"event-segment-selection",children:(0,y.jsx)(C,{field:t.field,onValueChange:t.onValueChange})})}displayEventOptions(){const{event:e,eventSlug:t}=this.state;let n;try{n=JSON.parse(this.emailOptions.meta||null)}catch(e){n=this.emailOptions.meta||null}const r={emailSlug:this.email.slug,eventSlug:t,onValueChange:this.handleChange,eventOptions:e.options||null};return n&&n.option&&("remote"===r.eventOptions.type&&(r.eventOptions.values=n.option),r.selected=I.ZP.map(n.option,(e=>e.id))),(0,y.jsx)(Dn,{emailSlug:r.emailSlug,eventSlug:r.eventSlug,eventOptions:r.eventOptions,onValueChange:r.onValueChange,selected:r.selected})}displayHeader(){const{event:e}=this.state;return e.title}propagateChange(){const{eventSlug:e,afterTimeType:t,afterTimeNumber:n,segment:r,eventOptionValue:a}=this.state,{onValueChange:s}=this.props;if(!s)return;const i={group:this.email.slug,event:e,afterTimeType:t};n&&(i.afterTimeNumber=n),r&&(i.segment=r),a&&(i.meta=JSON.stringify({option:this.state.eventOptionValue})),s({target:{name:"options",value:i}})}render(){return(0,y.jsxs)("div",{children:[(0,y.jsx)(je.Z,{level:5,children:this.displayHeader()}),this.displayEventOptions(),this.displaySegments(),this.displayScheduling()]})}}En.propTypes={field:g().shape({email:g().shape({events:g().object.isRequired}).isRequired,emailOptions:g().object.isRequired}).isRequired,onValueChange:g().func},En.defaultProps={onValueChange:null};var On=En;const Rn=window.mailpoet_woocommerce_automatic_emails||[];var An={getFields:function(e){return(e=>{const t=Rn[e.options.group];if(!t)return!1;const n=e.options;return[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:p.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:p.Z.I18n.t("subjectLine"),tooltip:p.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:p.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:p.Z.I18n.t("preheaderLine"),tooltip:`${p.Z.I18n.t("preheaderLineTip1")} ${p.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:p.Z.I18n.t("sendAutomaticEmailWhenHeading").replace("%1s",t.title),type:"reactComponent",component:On,email:t,emailOptions:n},Ut,{name:"sender",label:p.Z.I18n.t("sender"),tip:p.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:p.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"text",placeholder:p.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:p.Z.I18n.t("replyTo"),tip:p.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:p.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:p.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}]})(e)},getSendButtonOptions:function(){return{value:p.Z.I18n.t("activate")}}},Pn=n(78230),Mn=n(68041);function Ln(e){let{afterTimeNumber:t,afterTimeType:n,updateAfterTimeNumber:r,updateAfterTimeType:a,inactiveSubscribersPeriod:s}=e;const i="weeks"===n?7:30,o=Number(t)*i;let l=s;return 365===s&&(l=360),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:4,children:p.Z.I18n.t("selectEventToSendReEngagementEmail")}),(0,y.jsxs)(_t.r.CenteredRow,{className:"mailpoet-re-engagement-scheduling",children:[(0,y.jsx)("p",{children:p.Z.I18n.t("reEngagementTextPre")}),(0,y.jsx)(ae.Z,{type:"text",placeholder:p.Z.I18n.t("reEngagementAterTimeNumberPlaceholder"),value:t,onChange:(0,Mn.z2)(r)}),(0,y.jsxs)(de.Z,{value:n,onChange:(0,Mn.z2)(a),children:[(0,y.jsx)("option",{value:"weeks",children:"weeks"}),(0,y.jsx)("option",{value:"months",children:"months"})]})]}),!!s&&l<=o&&(0,y.jsx)("p",{className:"mailpoet-re-engagement-scheduling-note",children:k()(p.Z.I18n.t("reEngagementEmailWarning").replace("{$months}",`${Math.floor(s/30)}`),/\[link\](.*?)\[\/link\]/g,(e=>(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/264-inactive-subscribers",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"5cbf19622c7d3a026fd3efe1",children:e},"link")))})]})}const Fn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:p.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:p.Z.I18n.t("subjectLine"),tooltip:p.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:p.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:p.Z.I18n.t("preheaderLine"),tooltip:`${p.Z.I18n.t("preheaderLineTip1")} ${p.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",type:"reactComponent",component:function(e){return(0,y.jsx)(Ln,{afterTimeNumber:e.item.options.afterTimeNumber.toString(),afterTimeType:e.item.options.afterTimeType,inactiveSubscribersPeriod:Number(p.Z.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:t=>{e.onValueChange({target:{name:"options",value:(0,Pn.assoc)("afterTimeNumber",t,e.item.options)}})},updateAfterTimeType:t=>{e.onValueChange({target:{name:"options",value:(0,Pn.assoc)("afterTimeType",t,e.item.options)}})}})}},{name:"segments",label:p.Z.I18n.t("segments"),tip:p.Z.I18n.t("segmentsTip"),type:"selection",placeholder:p.Z.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:p.Z.apiVersion,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at&&"dynamic"!==e.type},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return(0,Pn.map)((e=>(0,Pn.find)((t=>t.id===e),t)),e)},validation:{"data-parsley-required":!0,"data-parsley-required-message":p.Z.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:p.Z.I18n.t("sender"),tip:p.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:p.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ft,placeholder:p.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:p.Z.I18n.t("replyTo"),tip:p.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:p.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:p.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]},Ut],qn={getFields:()=>Fn,getSendButtonOptions:()=>({value:p.Z.I18n.t("activate")})};var $n=n(7358),Un=n(31304),Vn=n.n(Un);const Wn=window.mailpoet_woocommerce_automatic_emails||[],Yn=(e,t)=>`${Vn()(t,{lower:!0}).replace(/[^a-z0-9]+/g,"-").replace(/-$/,"")||"newsletter"}_${e}`;function Bn(e){let t,n;return e&&e.body&&e.body.content&&(n=e.body.content,t=JSON.stringify(e.body.content),!n.blocks||!Array.isArray(n.blocks)||0===n.blocks.length)?p.Z.I18n.t("newsletterIsEmpty"):window.mailpoet_mss_active&&t.indexOf("[link:subscription_unsubscribe_url]")<0&&t.indexOf("[link:subscription_unsubscribe]")<0?p.Z.I18n.t("unsubscribeLinkMissing"):"re_engagement"===e.type&&t.indexOf("[link:subscription_re_engage_url]")<0?p.Z.I18n.t("reEngageLinkMissing"):"notification"===e.type&&t.indexOf('"type":"automatedLatestContent"')<0&&t.indexOf('"type":"automatedLatestContentLayout"')<0?p.Z.I18n.t("automatedLatestContentMissing"):"standard"===e.type&&"sent"===e.status?p.Z.I18n.t("emailAlreadySent"):"re_engagement"!==e.type||p.Z.trackingConfig.emailTrackingEnabled?void 0:(0,y.jsx)("span",{style:{pointerEvents:"all"},children:k()(p.Z.I18n.t("reEngagementEmailsDisableIfTrackingIs"),/\[link\](.*?)\[\/link\]/g,(e=>(0,y.jsx)("a",{href:"?page=mailpoet-settings#/advanced",rel:"noopener noreferrer",children:e},"advancedSettingsTabLink")))})}class Hn extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"getFieldsByNewsletter",(e=>this.getSubtype(e).getFields(e))),(0,Z.Z)(this,"getSendButtonOptions",(()=>this.getSubtype(this.state.item).getSendButtonOptions(this.state.item))),(0,Z.Z)(this,"getSubtype",(e=>{switch(e.type){case"notification":return gn;case"welcome":return Cn;case"re_engagement":return qn;case"automatic":if(Wn[e.options.group])return An;default:return Jt}})),(0,Z.Z)(this,"getThumbnailPromise",(e=>this.state.thumbnailPromise?this.state.thumbnailPromise:(0,$n.W0)(e))),(0,Z.Z)(this,"isValid",(()=>u()("#mailpoet_newsletter").parsley().isValid())),(0,Z.Z)(this,"isValidFromAddress",(async()=>{if("MailPoet"!==window.mailpoet_mta_method)return!0;const e=await this.loadAuthorizedEmailAddresses(),t=this.state.item.sender_address;return-1!==e.indexOf(t)})),(0,Z.Z)(this,"showInvalidFromAddressError",(()=>{const e=this.state.item.sender_address;let t=k()(p.Z.I18n.t("newsletterInvalidFromAddress"),"%1$s",(()=>e));t=k()(t,/\[link\](.*?)\[\/link\]/g,(t=>`<a href="https://account.mailpoet.com/authorization?email=${encodeURIComponent(e)}" target="_blank" rel="noopener noreferrer">${t}</a>`)),u()("#field_sender_address").parsley().addError("invalidFromAddress",{message:t.join(""),updateClass:!0}),p.Z.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"})})),(0,Z.Z)(this,"removeInvalidFromAddressError",(()=>{u()("#field_sender_address").parsley().removeError("invalidFromAddress",{updateClass:!0})})),(0,Z.Z)(this,"loadItem",(e=>(this.setState({loading:!0}),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done((e=>{const t="draft"===e.data.status?this.getThumbnailPromise(e.meta.preview_url):null,n=e.data;n.ga_campaign||(n.ga_campaign=Yn(n.id,n.subject)),this.setState({item:e.data,fields:this.getFieldsByNewsletter(e.data),thumbnailPromise:t,validationError:Bn(e.data)})})).fail((()=>{this.setState({item:{}},(()=>{this.props.history.push("/new")}))}))))),(0,Z.Z)(this,"saveTemplate",((e,t)=>{this.getThumbnailPromise(e.meta.preview_url).then((n=>{p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:{newsletter_id:e.data.id,name:e.data.subject,thumbnail_data:n,body:JSON.stringify(e.data.body),categories:'["recent"]'}}).fail((e=>{this.showError(e),this.setState({loading:!1}),p.Z.Modal.loading(!1)})),t()})).catch((e=>{this.showError({errors:[e]})}))})),(0,Z.Z)(this,"loadAuthorizedEmailAddresses",(async()=>"MailPoet"!==window.mailpoet_mta_method?[]:(await p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])),(0,Z.Z)(this,"handleSend",(e=>(e.preventDefault(),this.removeInvalidFromAddressError(),this.isValid()?(p.Z.Modal.loading(!0),this.isValidFromAddress().then((t=>t?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((e=>{switch(e.data.type){case"notification":case"welcome":case"automatic":case"re_engagement":return this.activateNewsletter(e);default:return this.sendNewsletter(e)}})).fail((e=>{this.showError(e),this.setState({loading:!1}),p.Z.Modal.loading(!1)})):(this.showInvalidFromAddressError(),p.Z.Modal.loading(!1))))):u()("#mailpoet_newsletter").parsley().validate()))),(0,Z.Z)(this,"sendNewsletter",(e=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"add",data:{newsletter_id:this.state.item.id}}).done((t=>{this.saveTemplate(e,(()=>{if(window.mailpoet_show_congratulate_after_first_newsletter)return p.Z.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);this.props.history.push(`/${this.state.item.type||""}`),"scheduled"===t.data.status?(this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("newsletterHasBeenScheduled")})),p.Z.trackEvent("Emails > Newsletter sent",{scheduled:!0})):(this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("newsletterBeingSent")}),{id:"mailpoet_notice_being_sent"}),p.Z.trackEvent("Emails > Newsletter sent",{scheduled:!1})),p.Z.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),p.Z.Modal.loading(!1)})))),(0,Z.Z)(this,"activateNewsletter",(e=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:this.props.match.params.id,status:"active"}}).done((t=>{this.saveTemplate(e,(()=>{if(window.mailpoet_show_congratulate_after_first_newsletter)return p.Z.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);const e=this.state.item.options;this.props.history.push("automatic"===this.state.item.type?`/${e.group}`:`/${this.state.item.type||""}`),"automatic"===this.state.item.type&&Wn[e.group]?this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("automaticEmailActivated").replace("%1s",Wn[e.group].title)})):"welcome"===t.data.type?(this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("welcomeEmailActivated")})),p.Z.trackEvent("Emails > Welcome email activated",{"List type":e.event,Delay:`${e.afterTimeNumber} ${e.afterTimeType}`})):"notification"===t.data.type&&(this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("postNotificationActivated")})),p.Z.trackEvent("Emails > Post notifications activated",{Frequency:e.intervalType})),p.Z.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),p.Z.Modal.loading(!1)})))),(0,Z.Z)(this,"handleResume",(e=>(e.preventDefault(),this.isValid()?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((()=>{p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:this.state.item.id}}).done((()=>{this.props.history.push(`/${this.state.item.type||""}`),this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("newsletterSendingHasBeenResumed")}))})).fail((e=>{this.showError(e)}))})).fail((e=>{this.showError(e)})).always((()=>{this.setState({loading:!1})})):u()("#mailpoet_newsletter").parsley().validate(),!1))),(0,Z.Z)(this,"handleSave",(e=>{e.preventDefault(),this.saveNewsletter(e).done((()=>{this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("newsletterUpdated")}))})).done((()=>{const e="automatic"===this.state.item.type?this.state.item.options.group:this.state.item.type;this.props.history.push(`/${e||""}`)})).fail((e=>{this.showError(e)}))})),(0,Z.Z)(this,"handleRedirectToDesign",(e=>{e.preventDefault();const t=e.target.href;this.saveNewsletter(e).done((()=>{this.context.notices.success((0,y.jsx)("p",{children:p.Z.I18n.t("newsletterUpdated")}))})).done((()=>{window.location=t})).fail((e=>{this.showError(e)}))})),(0,Z.Z)(this,"saveNewsletter",(()=>{const e=this.state.item;e.queue=void 0,this.setState({loading:!0});const t=I.ZP.omit(e,["body","created_at","deleted_at","hash","status","updated_at","type"]);return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:t})})),(0,Z.Z)(this,"showError",(e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})})),(0,Z.Z)(this,"handleFormChange",(e=>{const t=e.target.name,n=e.target.value;return this.setState((e=>{const r=e.item,a=r.subject,s=r.ga_campaign;return r[t]=n,"subject"===t&&s===Yn(r.id,a)&&(r.ga_campaign=Yn(r.id,n)),"reply_to_address"===t&&(r[t]=n.toLowerCase()),{item:r}})),!0})),this.state={fields:[],item:{},loading:!0,thumbnailPromise:null}}componentDidMount(){this.loadItem(this.props.match.params.id).always((()=>{this.setState({loading:!1})})),u()("#mailpoet_newsletter").parsley()}componentDidUpdate(e){this.props.match.params.id!==e.match.params.id&&this.loadItem(this.props.match.params.id).always((()=>{this.setState({loading:!1})}))}render(){const e="sending"===this.state.item.status&&this.state.item.queue&&"paused"===this.state.item.queue.status,t=this.state.fields.map((t=>{const n=t;return"segments"!==t.name&&"options"!==t.name||(n.disabled=e),n})),n=this.getSendButtonOptions(),r=!(!window.mailpoet_subscribers_limit_reached&&!window.mailpoet_mss_key_pending_approval&&void 0===this.state.validationError);let a=this.state.item.type;return"automatic"===a&&(a=this.state.item.options.group||a),(0,y.jsxs)("div",{className:"mailpoet-form-send-email",children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(ut,{emailType:a,automationId:"newsletter_send_heading"}),(0,y.jsxs)(ke,{id:"mailpoet_newsletter",fields:t,automationId:"newsletter_send_form",item:this.state.item,loading:this.state.loading,onChange:this.handleFormChange,onSubmit:this.handleSave,children:[(0,y.jsxs)(_t.r.CenteredRow,{className:"send-newsletter-buttons",children:[(0,y.jsx)(Ce.Button,{variant:"secondary",type:"submit",automationId:"email-save-draft",children:p.Z.I18n.t("saveDraftAndClose")}),e?(0,y.jsx)(Ce.Button,{type:"button",onClick:this.handleResume,isDisabled:r,automationId:"email-resume",children:p.Z.I18n.t("resume")}):(0,y.jsx)(Ce.Button,{type:"button",onClick:this.handleSend,...n,isDisabled:r,automationId:"email-submit",children:n.value||p.Z.I18n.t("send")}),void 0!==this.state.validationError&&(0,y.jsx)(M(),{tooltip:(0,y.jsx)("div",{children:this.state.validationError}),tooltipId:"helpTooltipSendEmail"})]}),(0,y.jsxs)("p",{children:[p.Z.I18n.t("orSimply")," ",(0,y.jsx)("a",{className:"mailpoet-link",href:`?page=mailpoet-newsletter-editor&id=${this.props.match.params.id}`,onClick:this.handleRedirectToDesign,children:p.Z.I18n.t("goBackToDesign")}),"."]}),window.mailpoet_mss_key_pending_approval&&(0,y.jsx)("div",{className:"mailpoet_error",children:k()(p.Z.I18n.t("pendingKeyApprovalNotice"),/\[link\](.*?)\[\/link\]/g,(e=>(0,y.jsx)("a",{href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer",children:e},"pendingKeyApprovalNoticeLink")))})]})]})}}Hn.contextType=Fe.k,Hn.propTypes={match:g().shape({params:g().shape({id:g().string}).isRequired}).isRequired,history:g().shape({push:g().func.isRequired}).isRequired};var zn=(0,c.withRouter)(Hn);function Kn(e){const[t,n]=(0,j.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:0,children:p.Z.I18n.t("congratulationsSuccessHeader")}),(0,y.jsx)(je.Z,{level:3,children:(r=e.newsletter,"welcome"===r.type?p.Z.I18n.t("congratulationsWelcomeEmailSuccessBody"):"notification"===r.type?p.Z.I18n.t("congratulationsPostNotificationSuccessBody"):"automatic"===r.type?p.Z.I18n.t("congratulationsWooSuccessBody"):"scheduled"===r.status?p.Z.I18n.t("congratulationsScheduleSuccessBody"):p.Z.I18n.t("congratulationsSendSuccessBody"))}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)("img",{src:e.illustrationImageUrl,alt:"",width:"500"}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)(Ce.Button,{type:"button",dimension:"small",onClick:()=>{e.successClicked(),n(!0)},withSpinner:t,children:p.Z.I18n.t("close")})]});var r}Kn.propTypes={successClicked:g().func.isRequired,illustrationImageUrl:g().string.isRequired,newsletter:g().shape({status:g().string.isRequired,type:g().string.isRequired}).isRequired};var Gn=Kn;function Qn(e){return(0,y.jsxs)("div",{className:"mailpoet-wizard-step",children:[(0,y.jsx)("div",{className:"mailpoet-wizard-step-illustration",children:(0,y.jsx)("img",{src:e.illustrationUrl,width:"500",alt:""})}),(0,y.jsx)("div",{className:"mailpoet-wizard-step-content",children:e.children})]})}Qn.propTypes={illustrationUrl:g().string.isRequired,children:g().oneOfType([g().arrayOf(g().node),g().node]).isRequired};var Xn=Qn,Jn=function(e){let{children:t,isOrdered:n}=e;const r=n?"ol":"ul";return(0,y.jsx)(r,{className:`mailpoet-${r}`,children:t})};function er(){return(0,y.jsxs)(Jn,{children:[(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSList1")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSList2")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSList4")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSList5")})]})}function tr(){return(0,y.jsxs)(Jn,{children:[(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSNotFreeList1")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSNotFreeList2")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSNotFreeList3")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSNotFreeList4")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardMSSNotFreeList5")})]})}function nr(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)(v.Z,{isFullWidth:!0,href:e.mailpoetAccountUrl,target:"_blank",rel:"noopener noreferrer",onClick:t=>{t.preventDefault(),window.open(e.mailpoetAccountUrl),e.next()},children:e.nextButtonText}),(0,y.jsx)(v.Z,{isFullWidth:!0,variant:"tertiary",onClick:e.next,onKeyDown:t=>{["keydown","keypress"].includes(t.type)&&["Enter"," "].includes(t.key)&&(t.preventDefault(),e.next())},withSpinner:e.nextWithSpinner,children:p.Z.I18n.t("welcomeWizardMSSNoThanks")})]})}function rr(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("welcomeWizardMSSFreeTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("p",{children:p.Z.I18n.t("welcomeWizardMSSFreeSubtitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)(je.Z,{level:5,children:[p.Z.I18n.t("welcomeWizardMSSFreeListTitle"),":"]}),(0,y.jsx)(er,{}),(0,y.jsx)(nr,{mailpoetAccountUrl:p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount,p.Z.currentWpUserEmail,"starter",{utm_medium:"onboarding",utm_campaign:"purchase"}),next:e.next,nextButtonText:p.Z.I18n.t("welcomeWizardMSSFreeButton")})]})}function ar(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("welcomeWizardMSSNotFreeTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("p",{children:[p.Z.I18n.t("welcomeWizardMSSNotFreeSubtitle"),":"]}),(0,y.jsx)(tr,{}),(0,y.jsx)(nr,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next,nextButtonText:p.Z.I18n.t("welcomeWizardMSSNotFreeButton")})]})}function sr(e){return e.subscribersCount<1e3?(0,y.jsx)(rr,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next}):(0,y.jsx)(ar,{mailpoetAccountUrl:e.purchaseUrl,next:e.next})}nr.propTypes={mailpoetAccountUrl:g().string.isRequired,next:g().func.isRequired,nextButtonText:g().string.isRequired,nextWithSpinner:g().bool},nr.defaultProps={nextWithSpinner:!1},rr.propTypes={next:g().func.isRequired},ar.propTypes={mailpoetAccountUrl:g().string.isRequired,next:g().func.isRequired},sr.propTypes={next:g().func.isRequired,subscribersCount:g().number.isRequired,mailpoetAccountUrl:g().string.isRequired,purchaseUrl:g().string.isRequired};var ir=sr,or=function(e){const[t,n]=(0,j.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:(r=e.newsletter.type,{standard:p.Z.I18n.t("congratulationsMSSPitchHeader"),welcome:p.Z.I18n.t("congratulationsMSSPitchHeaderAutomated"),notification:p.Z.I18n.t("congratulationsMSSPitchHeaderAutomated"),woocommerce:p.Z.I18n.t("congratulationsMSSPitchHeaderAutomated")}[r]||p.Z.I18n.t("congratulationsMSSPitchHeaderAutomated"))}),(0,y.jsx)(Xn,{illustrationUrl:e.MSSPitchIllustrationUrl,children:(0,y.jsxs)("div",{className:"mailpoet-welcome-wizard-step-content",children:[(0,y.jsx)(je.Z,{level:4,children:p.Z.I18n.t("congratulationsMSSPitchSubHeader")}),(0,y.jsx)("p",{children:p.Z.I18n.t(e.subscribersCount<1e3?"welcomeWizardMSSFreeSubtitle":"welcomeWizardMSSNotFreeSubtitle")}),(0,y.jsxs)(je.Z,{level:5,children:[p.Z.I18n.t("welcomeWizardMSSFreeListTitle"),":"]}),(0,y.jsx)(er,{}),(0,y.jsx)(nr,{mailpoetAccountUrl:e.purchaseUrl,next:()=>{e.onFinish(),n(!0)},nextButtonText:p.Z.I18n.t("welcomeWizardMSSFreeButton"),nextWithSpinner:t})]})})]});var r};function lr(e){return window.has_mss_key_specified?(0,y.jsx)(Gn,{successClicked:e.successClicked,illustrationImageUrl:e.illustrationImageUrl,newsletter:e.newsletter}):(0,y.jsx)(or,{MSSPitchIllustrationUrl:e.MSSPitchIllustrationUrl,onFinish:e.successClicked,subscribersCount:e.subscribersCount,purchaseUrl:e.purchaseUrl,newsletter:e.newsletter})}lr.propTypes={successClicked:g().func.isRequired,illustrationImageUrl:g().string.isRequired,MSSPitchIllustrationUrl:g().string.isRequired,newsletter:g().shape({status:g().string.isRequired,type:g().string.isRequired}).isRequired,subscribersCount:g().number.isRequired,purchaseUrl:g().string.isRequired};var cr=lr;function dr(e){const[t,n]=(0,j.useState)(!1);return(0,y.jsxs)("div",{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("congratulationsSendFailHeader")}),(0,y.jsx)(je.Z,{level:3,children:k()(p.Z.I18n.t("congratulationsSendFailExplain"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,y.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://kb.mailpoet.com/article/231-sending-does-not-work","data-beacon-article":"5a0257ac2c7d3a272c0d7ad6",children:e},t)))}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)("img",{src:window.mailpoet_congratulations_error_image,alt:"",width:"500"}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)(Ce.Button,{dimension:"small",type:"button",onClick:()=>{e.failClicked(),n(!0)},withSpinner:t,children:p.Z.I18n.t("close")})]})}dr.propTypes={failClicked:g().func.isRequired};var ur=dr,pr=n(63438);function mr(e){return(0,y.jsx)("div",{className:"mailpoet-congratulate-loading",children:e.showRichLoadingScreen&&(0,y.jsxs)("div",{children:[(0,y.jsx)(je.Z,{level:0,children:p.Z.I18n.t("congratulationsLoadingHeader")}),(0,y.jsx)(je.Z,{level:3,children:p.Z.I18n.t("congratulationsLoadingBody")}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)("div",{className:"mailpoet-gap-large"}),(0,y.jsx)(pr.Z,{size:64})]})})}mr.propTypes={showRichLoadingScreen:g().bool.isRequired};var hr=mr;const fr=Math.floor(4*Math.random());function gr(){return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:{show_congratulate_after_first_newsletter:!1}}).always((()=>{window.location=window.mailpoet_main_page}))}class vr extends j.Component{constructor(e){super(e),this.state={loading:!0,newsletter:null,testingPassed:!1,timeStart:te()(),minimumLoadingTimePassed:!1},this.tick=this.tick.bind(this)}componentDidMount(){this.loadNewsletter(this.props.match.params.id),this.tick()}componentDidUpdate(e){e.match.params.id!==this.props.match.params.id&&this.loadNewsletter(this.props.match.params.id)}tick(){te()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),te()().subtract(6,"seconds").isAfter(this.state.timeStart)&&this.setState({minimumLoadingTimePassed:!0}),!this.state.loading&&this.state.minimumLoadingTimePassed||setTimeout(this.tick,2e3)}loadNewsletter(e){p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done((e=>this.newsletterLoaded(e.data)))}newsletterLoaded(e){"standard"!==e.type||"scheduled"===e.status?this.setState({newsletter:e,loading:!1,minimumLoadingTimePassed:!0}):"sent"===e.status||"sending"===e.status?this.setState({newsletter:e,loading:!1,testingPassed:!0}):this.setState({newsletter:e})}renderContent(){return this.state.loading||!this.state.minimumLoadingTimePassed?(e=!this.state.newsletter,(0,y.jsx)(hr,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:gr,showRichLoadingScreen:e})):this.state.error?(p.Z.trackEvent("Cron testing done",{"Cron is working":"false"}),(0,y.jsx)(ur,{failClicked:()=>{window.location=window.mailpoet_main_page}})):(t=this.state.newsletter,this.state.testingPassed&&p.Z.trackEvent("Cron testing done",{"Cron is working":"true"}),(0,y.jsx)(cr,{illustrationImageUrl:window.mailpoet_congratulations_success_images[fr],MSSPitchIllustrationUrl:window.mailpoet_congratulations_success_images[fr],successClicked:gr,newsletter:t,isWoocommerceActive:window.mailpoet_woocommerce_active,subscribersCount:window.mailpoet_subscribers_count,purchaseUrl:p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount,p.Z.currentWpUserEmail,"starter",{utm_medium:"first-newsletter-congratulations",utm_campaign:"purchase"})}));var e,t}render(){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("style",{dangerouslySetInnerHTML:{__html:"body { background: #fff; overflow-x: hidden; }"}}),(0,y.jsxs)("div",{className:"mailpoet-congratulate",children:[(0,y.jsx)("div",{className:"mailpoet-gap-large"}),this.renderContent()]})]})}}vr.propTypes={match:g().shape({params:g().shape({id:g().string}).isRequired}).isRequired};var br=vr;class yr extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"showTemplateSelection",(e=>{this.props.history.push(`/template/${e}`)}))}componentDidMount(){p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"standard"}}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}render(){return(0,y.jsx)("div",{children:(0,y.jsx)(ut,{emailType:"standard",automationId:"standard_newsletter_creation_heading"})})}}yr.contextType=Fe.k,yr.propTypes={history:g().shape({push:g().func.isRequired}).isRequired};var wr=(0,c.withRouter)(yr);const xr={name:"options",type:"reactComponent",component:hn};class _r extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"handleValueChange",(e=>{const t=this.state;t[e.target.name]=e.target.value,this.setState(t)})),(0,Z.Z)(this,"handleNext",(()=>{p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:I.ZP.extend({},this.state,{type:"notification",subject:p.Z.I18n.t("draftPostNotificationTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))})),(0,Z.Z)(this,"showTemplateSelection",(e=>{this.props.history.push(`/template/${e}`)})),this.state={options:{intervalType:"daily",timeOfDay:0,weekDay:1,monthDay:0,nthWeekDay:1}}}render(){return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(ut,{emailType:"notification",automationId:"post_notification_creation_heading"}),(0,y.jsxs)(_t.r.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,y.jsx)(je.Z,{level:4,children:p.Z.I18n.t("selectFrequency")}),(0,y.jsx)(hn,{item:this.state,field:xr,onValueChange:this.handleValueChange}),(0,y.jsx)(v.Z,{isFullWidth:!0,onClick:this.handleNext,type:"button",children:p.Z.I18n.t("next")})]})]})}}_r.contextType=Fe.k,_r.propTypes={history:g().shape({push:g().func.isRequired}).isRequired};var Zr=(0,c.withRouter)(_r);const jr={name:"options",label:"Event",type:"reactComponent",component:In};class Ir extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"isValid",(()=>u()("#welcome_scheduling").parsley().isValid())),(0,Z.Z)(this,"validate",(()=>u()("#welcome_scheduling").parsley().validate()));let t=window.mailpoet_segments||[],n=1;t=t.filter((e=>"default"===e.type)),I.ZP.size(t)>0&&(n=I.ZP.first(t).id),this.state={options:{event:"segment",segment:n,role:"subscriber",afterTimeNumber:1,afterTimeType:"immediate"}},this.handleValueChange=this.handleValueChange.bind(this),this.handleNext=this.handleNext.bind(this)}handleValueChange(e){const{state:t}=this;t[e.target.name]=e.target.value,this.setState(t)}handleNext(e){e.preventDefault(),this.isValid()?p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:I.ZP.extend({},this.state,{type:"welcome",subject:p.Z.I18n.t("draftNewsletterTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})):this.validate()}showTemplateSelection(e){this.props.history.push(`/template/${e}`)}render(){return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(ut,{emailType:"welcome",automationId:"welcome_email_creation_heading"}),(0,y.jsxs)(_t.r.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,y.jsx)(je.Z,{level:4,children:p.Z.I18n.t("selectEventToSendWelcomeEmail")}),(0,y.jsxs)("form",{id:"welcome_scheduling",children:[(0,y.jsx)(In,{item:this.state,field:jr,onValueChange:this.handleValueChange}),(0,y.jsx)(v.Z,{isFullWidth:!0,type:"submit",onClick:this.handleNext,children:p.Z.I18n.t("next")})]})]})]})}}Ir.propTypes={history:g().shape({push:g().func.isRequired}).isRequired};var Sr=Ir;class Cr extends j.Component{static getEventOptions(e){return e.options||null}static getEventOptionsFirstValue(e){return e&&I.ZP.isArray(e.values)&&e.values[0].id?e.values[0].id:null}constructor(e){super(e),(0,Z.Z)(this,"isValid",(()=>!u()("#newsletter_scheduling").parsley()||u()("#newsletter_scheduling").parsley().isValid())),(0,Z.Z)(this,"validate",(()=>{u()("#newsletter_scheduling").parsley()&&u()("#newsletter_scheduling").parsley().validate()})),(0,Z.Z)(this,"resetValidationErrors",(()=>{u()("#newsletter_scheduling").parsley()&&u()("#newsletter_scheduling").parsley().reset()}));const{email:t,name:n}=e;this.handleChange=this.handleChange.bind(this),this.handleNextStep=this.handleNextStep.bind(this),this.email=t,this.emailEvents=this.email.events,this.segments=I.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const r=this.getEvent(n),a=this.constructor.getEventOptions(r),s=this.constructor.getEventOptionsFirstValue(a);this.state={event:r,eventSlug:r.slug,eventOptionValue:s,segment:r.sendToLists?this.getFirstSegment():null,afterTimeType:r.defaultAfterTimeType||"immediate",afterTimeNumber:null}}handleChange(e){const{segment:t,afterTimeNumber:n}=this.state,r=e;if(r.eventSlug){r.event=this.getEvent(r.eventSlug),r.segment=r.event.sendToLists?t||this.getFirstSegment():null;const e=this.constructor.getEventOptions(r.event);r.eventOptionValue=e?this.constructor.getEventOptionsFirstValue(e):null}r.afterTimeType&&"immediate"===r.afterTimeType?r.afterTimeNumber=null:!r.afterTimeType||r.afterTimeNumber||n||(r.afterTimeNumber=1),this.setState(r),this.resetValidationErrors(),this.isValid()&&this.validate()}handleNextStep(e){if(e.preventDefault(),!this.isValid())return void this.validate();const{history:t}=this.props,{eventSlug:n,afterTimeType:r,afterTimeNumber:a,event:s,segment:i,eventOptionValue:o}=this.state,l={group:this.email.slug,event:n,afterTimeType:r};a&&(l.afterTimeNumber=a),l.sendTo=s.sendToLists?"segment":"user",i&&(l.segment=i),o&&(l.meta=JSON.stringify({option:o})),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"automatic",subject:p.Z.I18n.t("draftNewsletterTitle"),options:l}}).done((e=>{p.Z.trackEvent("Emails > New Automatic Email Created",{"Event type":l.event,"Schedule type":l.afterTimeType,"Schedule value":l.afterTimeNumber}),t.push(`/template/${e.data.id}`)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}getEvent(e){return this.emailEvents[e]}getFirstSegment(){return I.ZP.isArray(this.segments)&&this.segments[0].id?this.segments[0].id:null}displayHeader(){const{event:e}=this.state;return e.title}displayEventOptions(){const{eventSlug:e,event:t}=this.state,n={emailSlug:this.email.slug,eventSlug:e,eventOptions:this.constructor.getEventOptions(t),onValueChange:this.handleChange};return(0,y.jsx)(Dn,{emailSlug:n.emailSlug,eventSlug:n.eventSlug,eventOptions:n.eventOptions,onValueChange:n.onValueChange})}displaySegments(){const{event:e}=this.state;if(!e.sendToLists)return null;const t={field:{id:"segments",forceSelect2:!0,values:this.segments,extendSelect2Options:{minimumResultsForSearch:1/0}},onValueChange:e=>this.handleChange({segment:e.target.value})};return(0,y.jsx)("div",{className:"event-segment-selection",children:(0,y.jsx)(C,{field:t.field,onValueChange:t.onValueChange})})}displayScheduling(){const{afterTimeNumber:e,afterTimeType:t,event:n}=this.state,r={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return(0,y.jsx)(kn,{item:r.item,event:r.event,onValueChange:r.onValueChange})}displayEventTip(){const{event:e}=this.state;return e.tip?(0,y.jsxs)("p",{className:"description",children:[(0,y.jsx)("strong",{children:p.Z.I18n.t("tip")})," ",e.tip]}):null}render(){return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(ut,{emailType:"woocommerce",automationId:"woocommerce_email_creation_heading"}),(0,y.jsx)(_t.r.Column,{align:"center",className:"mailpoet-schedule-email",children:(0,y.jsxs)("form",{id:"newsletter_scheduling",children:[(0,y.jsx)(je.Z,{level:4,children:this.displayHeader()}),(0,y.jsx)("div",{children:this.displayEventOptions()}),(0,y.jsx)("div",{children:this.displaySegments()}),(0,y.jsx)("div",{children:this.displayScheduling()}),(0,y.jsx)(v.Z,{isFullWidth:!0,onClick:this.handleNextStep,type:"submit",children:p.Z.I18n.t("next")})]})}),this.displayEventTip()]})}}Cr.contextType=Fe.k,Cr.propTypes={history:g().shape({push:g().func.isRequired}).isRequired,name:g().string.isRequired,email:g().shape({title:g().string.isRequired,slug:g().string.isRequired}).isRequired};var Tr=Cr,kr=n(45853),Nr=n(19013),Dr=n(13882);function Er(e){return(0,Dr.Z)(1,arguments),(0,Nr.default)(e).getTime()<Date.now()}var Or=n(77349),Rr=n(36948);function Ar(e,t){return(0,Dr.Z)(2,arguments),(0,Nr.default)(e).getTime()-(0,Nr.default)(t).getTime()}var Pr={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function Mr(e){return e?Pr[e]:Pr.trunc}var Lr=n(44732),Fr=n(65221);function qr(e){let{percentage:t}=e;const n=16*Math.PI,r=n*(t/100),a=n-r;return(0,y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"8",className:"mailpoet-listing-status-percentage-background"}),(0,y.jsx)("circle",{r:"8",cx:"12",cy:"12",fill:"none",strokeDashoffset:n/4,strokeDasharray:`${r} ${a}`,className:"mailpoet-listing-status-percentage"})]})}function $r(){return(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:(0,y.jsx)("path",{className:"mailpoet-listing-status-scheduled-icon",strokeLinecap:"round",d:"M12 7L12 12 15 15"})})}var Ur=function(e){let{scheduledFor:t,processed:n,total:r,isPaused:a,status:s}=e;const i=!t&&!n&&!r,o=t&&function(e){return(0,Dr.Z)(1,arguments),(0,Nr.default)(e).getTime()>Date.now()}(t),l=(!t||Er(t))&&n<r,c=(!t||Er(t))&&n>=r,d="sent"===s&&void 0===r;let u=0,m=(0,Lr.Z)("notSentYet");if(o){const e=p.Z.Date.short(t),n=p.Z.Date.time(t),r=new Date,a=(0,Or.default)(r,1),s=p.Z.Date.short(r)===e,i=p.Z.Date.short(a)===e;if(s||i){const t=Math.random().toString(36).substring(2,15),r=s?(0,Lr.Z)("today"):(0,Lr.Z)("tomorrow");m=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{"data-tip":!0,"data-for":t,children:r}),(0,y.jsx)(Fr.Z,{place:"right",id:t,children:e}),(0,y.jsx)("br",{}),n]})}else m=(0,y.jsxs)(y.Fragment,{children:[e,(0,y.jsx)("br",{}),n]});const o=720,l=function(e,t,n){(0,Dr.Z)(2,arguments);var r=Ar(e,t)/Rr.yJ;return Mr(null==n?void 0:n.roundingMethod)(r)}(t,r);u=l<o?l/o*100:100}else l?(m=`${p.Z.Num.toLocaleFixed(n)} / ${p.Z.Num.toLocaleFixed(r)}`,u=n/r*100):c?(m=`${p.Z.Num.toLocaleFixed(r)} / ${p.Z.Num.toLocaleFixed(r)}`,u=100):d&&(m=(0,Lr.Z)("sent"),u=100);return!a||c||d||(m=(0,Lr.Z)("paused")),(0,y.jsxs)("div",{className:h()({"mailpoet-listing-status":!0,"mailpoet-listing-status-unknown":i,"mailpoet-listing-status-scheduled":o,"mailpoet-listing-status-in-progress":l,"mailpoet-listing-status-sent":c||d}),children:[o&&(0,y.jsx)($r,{}),(0,y.jsx)(qr,{percentage:u}),(0,y.jsx)("div",{className:"mailpoet-listing-status-label",children:m})]})};const Vr=g().shape({status:g().string,count_processed:g().string.isRequired,count_total:g().string.isRequired,scheduled_at:g().string}),Wr=g().shape({id:g().number.isRequired,sent_at:g().string,status:g().string.isRequired,queue:g().oneOfType([Vr,g().bool])});function Yr(e){let{newsletter:t}=e;const[n,r]=(0,j.useState)("paused"===t.queue.status),[a,s]=(0,j.useState)([]);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(it,{errors:a}),n&&(0,y.jsx)(v.Z,{dimension:"small",onClick:()=>{s([]),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:t.id}}).done((()=>r(!1))).fail((e=>s(e.errors)))},children:p.Z.I18n.t("resume")}),!n&&(0,y.jsx)(v.Z,{dimension:"small",onClick:()=>{s([]),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"pause",data:{newsletter_id:t.id}}).done((()=>r(!0))).fail((e=>s(e.errors)))},children:p.Z.I18n.t("pause")})]})}function Br(e){let{newsletter:t,mailerLog:n}=e,r=t.sent_at||t.queue.scheduled_at;r&&(r=(0,kr.default)(r,"yyyy-MM-dd HH:mm:ss",new Date));const a=t.queue&&"scheduled"!==t.queue.status,s="paused"===n.status,i=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.rU,{to:`/sending-status/${t.id}`,"data-automation-id":`sending_status_${t.id}`,children:(0,y.jsx)(Ur,{processed:parseInt(t.queue.count_processed,10),scheduledFor:r,total:parseInt(t.queue.count_total,10),isPaused:s,status:t.status})}),"completed"!==t.queue.status&&!s&&(0,y.jsx)(Yr,{newsletter:t})]}),o=(0,y.jsx)(Ur,{scheduledFor:r,isPaused:"scheduled"===t.queue.status&&s,status:t.status});return(0,y.jsxs)(y.Fragment,{children:[a&&i,!a&&o]})}Yr.propTypes={newsletter:Wr.isRequired},Br.propTypes={newsletter:Wr.isRequired,mailerLog:g().shape({status:g().string}).isRequired};var Hr=Br;const zr={opened:{badgeRanges:[30,10,0],badgeTypes:["excellent","good","average"],tooltipText:[p.Z.I18n.t("openedStatTooltipExcellent"),p.Z.I18n.t("openedStatTooltipGood"),p.Z.I18n.t("openedStatTooltipAverage")]},clicked:{badgeRanges:[3,1,0],badgeTypes:["excellent","good","average"],tooltipText:[p.Z.I18n.t("clickedStatTooltipExcellent"),p.Z.I18n.t("clickedStatTooltipGood"),p.Z.I18n.t("clickedStatTooltipAverage")]}},Kr=(e,t)=>{const n=zr[e]||null;if(!n)return null;if(t<0||t>100)return null;const r=n.badgeRanges.length;for(let e=0;e<r;e+=1)if(t>n.badgeRanges[e])return n.badgeTypes[e];return n.badgeTypes[r-1]};function Gr(e){const t={excellent:{name:p.Z.I18n.t("excellentBadgeName"),tooltipTitle:p.Z.I18n.t("excellentBadgeTooltip")},good:{name:p.Z.I18n.t("goodBadgeName"),tooltipTitle:p.Z.I18n.t("goodBadgeTooltip")},average:{name:p.Z.I18n.t("averageBadgeName"),tooltipTitle:p.Z.I18n.t("averageBadgeTooltip")}},n=Kr(e.stat,e.rate),r=t[n]||null;if(!r)return null;const a=zr[e.stat]||null;if(!a)return null;const s=e.tooltipId||null,i=(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"mailpoet-listing-stats-tooltip-title",children:r.tooltipTitle.toUpperCase()}),(0,y.jsxs)("div",{className:"mailpoet-listing-stats-tooltip-content",children:[(0,y.jsx)(V.Z,{type:"excellent",name:t.excellent.name})," : ",a.tooltipText[0],(0,y.jsx)("br",{}),(0,y.jsx)(V.Z,{type:"good",name:t.good.name})," : ",a.tooltipText[1],(0,y.jsx)("br",{}),(0,y.jsx)(V.Z,{type:"average",name:t.average.name})," : ",a.tooltipText[2]]})]},`tooltip-${s}`);return(0,y.jsx)(V.Z,{isInverted:e.isInverted,type:n,name:r.name,tooltip:i,tooltipId:s,tooltipPlace:e.tooltipPlace})}Gr.defaultProps={isInverted:!0};var Qr=function(e){let{opened:t,clicked:n,revenues:r,hideBadges:a,newsletterId:s,wrapContentInLink:i}=e;const o=p.Z.Num.toLocaleFixed(t,1),l=p.Z.Num.toLocaleFixed(n,1);let c=(0,y.jsxs)("div",{className:"mailpoet-listing-stats-opened-clicked",children:[(0,y.jsxs)("div",{className:"mailpoet-listing-stats-percentages",children:[l,"%",(0,y.jsx)("br",{}),(0,y.jsxs)("span",{className:"mailpoet-listing-stats-percentages-opens",children:[o,"%"]})]}),!a&&(0,y.jsx)("div",{children:(0,y.jsx)(Gr,{stat:"clicked",rate:n,tooltipId:`clicked-${s||"0"}`})})]}),d=null;if(r){const e=`revenues-${s||"0"}`;d=(0,y.jsxs)("div",{children:[(0,y.jsx)(b.Z,{"data-tip":!0,"data-for":e,children:r}),(0,y.jsx)(Fr.Z,{place:"top",multiline:!0,id:e,children:(0,y.jsx)("div",{className:"mailpoet-listing-stats-tooltip-content",children:p.Z.I18n.t("revenueStatsTooltipShort")})})]})}return i&&(c=i(c,"opened-and-clicked"),d=i(d,"revenue")),(0,y.jsxs)("div",{className:"mailpoet-listing-stats",children:[c,d]})},Xr=n(93723);function Jr(e){let{newsletter:t,isSent:n,currentTime:r}=e,a=n;if(void 0===a&&(a=t.statistics&&t.queue&&"scheduled"!==t.queue.status),!a)return null;const s={link:`/stats/${t.id}`,onClick:Ye().applyFilters("mailpoet_newsletters_listing_stats_tracking",Xr.gP)},i=Number(t.total_sent||t.queue.count_processed);let o,c,d,u,m,h=0,f=0,g=null;i>0&&(h=100*t.statistics.clicked/i,f=100*t.statistics.opened/i,g=t.statistics.revenue),void 0!==r?(o=6,c=t.queue.scheduled_at||t.queue.created_at,d=te()(r).diff(te()(c),"hours"),u=d<o,m=!0):(u=!1,m=!1);const v=i>=20&&t.statistics.opened>=5&&!u,w=(e,n)=>((e,t,n,r)=>r<=0||!t.link?e:t.externalLink?(0,y.jsx)("a",{href:t.link,onClick:t.onClick||null,children:e},`stats-${n}`):(0,y.jsx)(l.rU,{to:t.link,onClick:t.onClick||null,children:e},`stats-${n}`))(e,s,`${n}-${t.id}`,i),x=(0,y.jsx)(Qr,{opened:f,clicked:h,revenues:g&&g.value>0?g.formatted:null,hideBadges:!v,newsletterId:t.id,wrapContentInLink:w}),_=(0,y.jsxs)(y.Fragment,{children:[x,u&&w((0,y.jsx)(b.Z,{className:"mailpoet-listing-stats-too-early",dimension:"large",variant:"excellent",isInverted:!0,children:p.Z.I18n.t("checkBackInHours").replace("%1$d",o-d)}),"check-back")]});let Z;return m&&f<5&&d>=24&&i>=10&&(Z=(0,y.jsx)("div",{children:(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/191-how-to-improve-my-open-and-click-rates","data-beacon-article":"58f671152c7d3a057f8858e8",target:"_blank",rel:"noopener noreferrer",className:"mailpoet_stat_link_small",children:p.Z.I18n.t("improveThisLinkText")})})),(0,y.jsxs)(y.Fragment,{children:[_,Z]})}const ea=g().shape({clicked:g().number,opened:g().number,unsubscribed:g().number,revenue:g().shape({count:g().number,currency:g().string,formatted:g().string,value:g().number})}),ta=g().shape({status:g().string,count_processed:g().string.isRequired,count_total:g().string.isRequired,created_at:g().string,scheduled_at:g().string});Jr.propTypes={newsletter:g().shape({id:g().number.isRequired,queue:g().oneOfType([ta,g().bool]),total_sent:g().number,statistics:g().oneOfType([ea,g().bool])}).isRequired,isSent:g().bool,currentTime:g().string},Jr.defaultProps={isSent:void 0,currentTime:void 0};var na=Jr;const ra=p.Z.trackingConfig.emailTrackingEnabled,aa={onNoItemsFound:(e,t)=>p.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterTrashed"):p.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterDeleted"):p.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterRestored"):p.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},sa=[{name:"subject",label:p.Z.I18n.t("subject"),sortable:!0},{name:"status",label:p.Z.I18n.t("status")},{name:"segments",label:p.Z.I18n.t("lists")},{name:"statistics",label:p.Z.I18n.t("statistics"),display:ra},{name:"sent_at",label:p.Z.I18n.t("sentOn"),sortable:!0}],ia=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:aa.onTrash}],oa=e=>{const t=()=>{window.location.href=`?page=mailpoet-newsletter-editor&id=${e.id}`};e.queue&&"sending"===e.status&&null===e.queue.status?(0,ht.Z)({message:p.Z.I18n.t("confirmEdit"),onConfirm:t}):t()};let la=[{name:"view",link:function(e){return(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("edit"),onClick:oa},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:function(e,t){return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{p.Z.Notice.success(p.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];la=(0,Xr.y8)(la);class ca extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"renderItem",((e,t,n)=>{const r=h()("manage-column","column-primary","has-row-actions");return(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:r,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:"#",onClick:t=>{t.preventDefault(),oa(e)},children:e.queue.newsletter_rendered_subject||e.subject}),t]}),(0,y.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":p.Z.I18n.t("status"),children:(0,y.jsx)(Hr,{newsletter:e,mailerLog:n.mta_log})}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("lists"),children:(0,y.jsx)(w,{segments:e.segments,dimension:"large"})}),!0===ra?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("statistics"),children:(0,y.jsx)(na,{newsletter:e,currentTime:n.current_time})}):null,(0,y.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("sentOn"),children:e.sent_at?(0,y.jsxs)(y.Fragment,{children:[p.Z.Date.short(e.sent_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.sent_at)]}):null})]})})),(0,Z.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,y.jsxs)(y.Fragment,{children:[0===this.state.newslettersCount&&(0,y.jsx)(ct,{filter:e=>"standard"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"standard",base_url:"standard",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:sa,bulk_actions:ia,item_actions:la,messages:aa,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,Xr._X)(e),(0,Xr.bF)(e)}})]})}}ca.contextType=Fe.k,ca.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var da=(0,c.withRouter)(ca);const ua=window.mailpoet_roles||{},pa=window.mailpoet_segments||{},ma=p.Z.trackingConfig.emailTrackingEnabled,ha={onNoItemsFound:(e,t)=>p.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterTrashed"):p.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterDeleted"):p.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterRestored"):p.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},fa=[{name:"subject",label:p.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:p.Z.I18n.t("settings")},{name:"statistics",label:p.Z.I18n.t("statistics"),display:ma},{name:"status",label:p.Z.I18n.t("status"),width:145},{name:"updated_at",label:p.Z.I18n.t("lastModifiedOn"),sortable:!0}],ga=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:ha.onTrash}];let va=[{name:"view",link:function(e){return(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("preview")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:(e,t)=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{p.Z.Notice.success(p.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("edit"),onClick:Xr.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];va=(0,Xr.y8)(va);class ba extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"updateStatus",((e,t)=>{t.persist(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&p.Z.Notice.success(p.Z.I18n.t("welcomeEmailActivated")),this.forceUpdate()})).fail((n=>{p.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,Z.Z)(this,"renderStatus",(e=>{const t=p.Z.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString()),n=p.Z.I18n.t("scheduledToXSubscribers").replace("%1$d",e.total_scheduled.toLocaleString());return(0,y.jsxs)("div",{children:[(0,y.jsx)(Vt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,y.jsxs)("p",{className:"mailpoet-listing-stats-description",children:[(0,y.jsx)(l.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})," ",(0,y.jsx)("br",{}),n]})]})})),(0,Z.Z)(this,"renderSettings",(e=>{let t,n,r;switch(e.options.event){case"user":t="mailpoet_all"===e.options.role?p.Z.I18n.t("welcomeEventWPUserAnyRole"):k()(p.Z.I18n.t("welcomeEventWPUserWithRole"),'"%1$s"',((t,n)=>(0,y.jsx)(b.Z,{variant:"list",children:ua[e.options.role]},n)));break;default:if(r=I.ZP.find(pa,(t=>Number(t.id)===Number(e.options.segment))),void 0===r)return(0,y.jsx)(l.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:p.Z.I18n.t("sendingToSegmentsNotSpecified")});t=k()(p.Z.I18n.t("welcomeEventSegment"),'"%1$s"',((e,t)=>(0,y.jsx)(b.Z,{variant:"list",children:r.name},t)))}if(t&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":n=p.Z.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":n=p.Z.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":n=p.Z.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":n=p.Z.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:n=p.Z.I18n.t("sendingDelayInvalid")}return(0,y.jsxs)("span",{children:[t,n&&(0,y.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,y.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,y.jsx)($r,{})}),n]})]})})),(0,Z.Z)(this,"renderItem",((e,t)=>{const n=h()("manage-column","column-primary","has-row-actions");return(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:n,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("settings"),children:this.renderSettings(e)}),!0===ma?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("statistics"),children:(0,y.jsx)(na,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("status"),children:this.renderStatus(e)}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("lastModifiedOn"),children:[p.Z.Date.short(e.updated_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.updated_at)]})]})})),(0,Z.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,y.jsxs)(y.Fragment,{children:[0===this.state.newslettersCount&&(0,y.jsx)(ct,{filter:e=>"welcome"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"welcome",base_url:"welcome",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:fa,bulk_actions:ga,item_actions:va,messages:ha,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,Xr._X)(e),(0,Xr.bF)(e)}})]})}}ba.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var ya=(0,c.withRouter)(ba);const wa={onNoItemsFound:(e,t)=>p.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterTrashed"):p.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterDeleted"):p.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterRestored"):p.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},xa=[{name:"subject",label:p.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:p.Z.I18n.t("settings")},{name:"history",label:p.Z.I18n.t("history"),width:100},{name:"status",label:p.Z.I18n.t("status"),width:100},{name:"updated_at",label:p.Z.I18n.t("lastModifiedOn"),sortable:!0}],_a=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:wa.onTrash}],Za=[{name:"view",link:function(e){return(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("edit"),onClick:Xr.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:function(e,t){return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{p.Z.Notice.success(p.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class ja extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"updateStatus",((e,t)=>{t.persist(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&p.Z.Notice.success(p.Z.I18n.t("postNotificationActivated")),this.forceUpdate()})).fail((n=>{p.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,Z.Z)(this,"renderStatus",(e=>(0,y.jsx)(Vt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}))),(0,Z.Z)(this,"renderSettings",(e=>{let t;if(0===e.segments.length)return(0,y.jsx)(l.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:p.Z.I18n.t("sendingToSegmentsNotSpecified")});const n=k()(p.Z.I18n.t("sendTo"),"%1$s",((t,n)=>(0,y.jsx)(w,{segments:e.segments},n)));switch(e.options.intervalType){case"daily":t=p.Z.I18n.t("sendDaily").replace("%1$s",rn[e.options.timeOfDay]);break;case"weekly":t=p.Z.I18n.t("sendWeekly").replace("%1$s",an[e.options.weekDay]).replace("%2$s",rn[e.options.timeOfDay]);break;case"monthly":t=p.Z.I18n.t("sendMonthly").replace("%1$s",sn[e.options.monthDay]).replace("%2$s",rn[e.options.timeOfDay]);break;case"nthWeekDay":t=p.Z.I18n.t("sendNthWeekDay").replace("%1$s",on[e.options.nthWeekDay]).replace("%2$s",an[e.options.weekDay]).replace("%3$s",rn[e.options.timeOfDay]);break;case"immediately":t=p.Z.I18n.t("sendImmediately");break;default:t="Invalid sending frequency"}return(0,y.jsxs)("span",{children:[n,(0,y.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,y.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,y.jsx)($r,{})}),t]})]})})),(0,Z.Z)(this,"renderHistoryLink",(e=>0===Number(e.children_count)?(0,y.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small mailpoet-listing-notification-status",children:p.Z.I18n.t("notSentYet")}):(0,y.jsxs)(l.rU,{className:"mailpoet-nowrap","data-automation-id":`history-${e.id}`,to:`/notification/history/${e.id}`,children:[(0,y.jsx)(v.Z,{className:"mailpoet-hide-on-mobile",dimension:"small",children:p.Z.I18n.t("viewHistory")}),(0,y.jsx)(v.Z,{className:"mailpoet-show-on-mobile mailpoet-listing-notification-status",dimension:"small",variant:"secondary",children:p.Z.I18n.t("viewHistory")})]}))),(0,Z.Z)(this,"renderItem",((e,t)=>{const n=h()("manage-column","column-primary","has-row-actions");return(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:n,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("settings"),children:this.renderSettings(e)}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("history"),children:this.renderHistoryLink(e)}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("status"),children:this.renderStatus(e)}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("lastModifiedOn"),children:[p.Z.Date.short(e.updated_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.updated_at)]})]})})),(0,Z.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,y.jsxs)(y.Fragment,{children:[0===this.state.newslettersCount&&(0,y.jsx)(ct,{filter:e=>"notification"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"notification",base_url:"notification",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:xa,bulk_actions:_a,item_actions:Za,messages:wa,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,Xr._X)(e),(0,Xr.bF)(e)}})]})}}ja.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var Ia=(0,c.withRouter)(ja);const Sa=p.Z.trackingConfig.emailTrackingEnabled,Ca={onNoItemsFound:(e,t)=>p.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterTrashed"):p.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterDeleted"):p.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterRestored"):p.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},Ta=[{name:"subject",label:p.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:p.Z.I18n.t("settings")},{name:"statistics",label:p.Z.I18n.t("statistics"),display:Sa},{name:"status",label:p.Z.I18n.t("status"),width:145},{name:"updated_at",label:p.Z.I18n.t("lastModifiedOn"),sortable:!0}],ka=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:Ca.onTrash}];let Na=[{name:"view",link:function(e){return(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("preview")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:(e,t)=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{p.Z.Notice.success(p.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("edit"),onClick:Xr.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Na=(0,Xr.y8)(Na);class Da extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"updateStatus",((e,t)=>{t.persist(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&p.Z.Notice.success(p.Z.I18n.t("reEngagementEmailActivated")),this.forceUpdate()})).fail((n=>{p.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,Z.Z)(this,"renderStatus",(e=>{const t=p.Z.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString());return(0,y.jsxs)("div",{children:[(0,y.jsx)(Vt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,y.jsx)("p",{className:"mailpoet-listing-stats-description",children:(0,y.jsx)(l.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})})]})})),(0,Z.Z)(this,"renderSettings",(e=>{if(0===e.segments.length)return(0,y.jsx)(l.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:p.Z.I18n.t("sendingToSegmentsNotSpecified")});const t=k()(p.Z.I18n.t("sendTo"),"%1$s",((t,n)=>(0,y.jsx)(w,{segments:e.segments},n)));let n="reEngagementFrequencyMonth";e.options.afterTimeNumber>1&&"months"===e.options.afterTimeType?n="reEngagementFrequencyMonths":e.options.afterTimeNumber>1&&"weeks"===e.options.afterTimeType?n="reEngagementFrequencyWeeks":1===e.options.afterTimeNumber&&"weeks"===e.options.afterTimeType&&(n="reEngagementFrequencyWeek");const r=p.Z.I18n.t("reEngagementSettings").replace("{$count}",e.options.afterTimeNumber).replace("{$frequency}",p.Z.I18n.t(n));return(0,y.jsxs)("span",{children:[t,(0,y.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,y.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,y.jsx)($r,{})}),r]})]})})),(0,Z.Z)(this,"renderItem",((e,t)=>{const n=h()("manage-column","column-primary","has-row-actions");return(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:n,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("settings"),children:this.renderSettings(e)}),!0===Sa?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("statistics"),children:(0,y.jsx)(na,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("status"),children:this.renderStatus(e)}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("lastModifiedOn"),children:[p.Z.Date.short(e.updated_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.updated_at)]})]})})),(0,Z.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,y.jsxs)(y.Fragment,{children:[0===this.state.newslettersCount&&(0,y.jsx)(ct,{filter:e=>"re_engagement"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"re_engagement",base_url:"re_engagement",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Ta,bulk_actions:ka,item_actions:Na,messages:Ca,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}(0,Xr._X)(e),(0,Xr.bF)(e)}})]})}}Da.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var Ea=(0,c.withRouter)(Da);const Oa=p.Z.trackingConfig.emailTrackingEnabled,Ra=[{name:"subject",label:p.Z.I18n.t("subject")},{name:"status",label:p.Z.I18n.t("status")},{name:"segments",label:p.Z.I18n.t("lists")},{name:"statistics",label:p.Z.I18n.t("statistics"),display:Oa},{name:"sent_at",label:p.Z.I18n.t("sentOn"),sortable:!0}],Aa={onNoItemsFound:(e,t)=>p.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterTrashed"):p.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterDeleted"):p.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterRestored"):p.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},Pa=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:Aa.onTrash}],Ma=(0,Xr.y8)([{name:"view",link:function(e){return(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("preview")})}},{name:"trash",className:"mailpoet-hide-on-mobile"}]),La=(e,t,n)=>{const r=h()("manage-column","column-primary","has-row-actions");return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("td",{className:r,children:[(0,y.jsx)("strong",{children:(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:e.queue.newsletter_rendered_subject||e.subject})}),t]}),(0,y.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":p.Z.I18n.t("status"),children:(0,y.jsx)(Hr,{newsletter:e,mailerLog:n.mta_log})}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("lists"),children:(0,y.jsx)(w,{segments:e.segments,dimension:"large"})}),!0===Oa?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("statistics"),children:(0,y.jsx)(na,{newsletter:e,currentTime:n.current_time})}):null,(0,y.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("sentOn"),children:e.sent_at?(0,y.jsxs)(y.Fragment,{children:[p.Z.Date.short(e.sent_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.sent_at)]}):null})]})};function Fa(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:"/notification",children:p.Z.I18n.t("backToPostNotifications")}),(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:e.location,params:{...e.match.params,parentId:e.parentId},endpoint:"newsletters",type:"notification_history",base_url:"notification/history/:parentId",onRenderItem:La,columns:Ra,messages:Aa,item_actions:Ma,bulk_actions:Pa,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{(0,Xr._X)(e),(0,Xr.bF)(e)}})]})}Fa.propTypes={parentId:g().string.isRequired,location:g().shape({pathname:g().string}).isRequired,match:g().shape({params:g().shape({id:g().node}).isRequired}).isRequired};var qa=(0,c.withRouter)(Fa);const $a=[{name:"subscriber_id",label:p.Z.I18n.t("subscriber"),sortable:!0},{name:"status",label:p.Z.I18n.t("sendingStatus")},{name:"failureReason",label:p.Z.I18n.t("failureReason")}],Ua={onNoItemsFound:()=>p.Z.I18n.t("noSendingTaskFound")};function Va(e){const[t,n]=(0,j.useState)({id:e.match.params.id,subject:"",sent:!1});return(0,j.useEffect)((()=>{p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:t.id}}).done((e=>n({id:t.id,subject:e.data.subject,sent:null!==e.data.sent_at}))).fail((e=>p.Z.Notice.showApiErrorNotice(e)))}),[t.id]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("h1",{children:p.Z.I18n.t("sendingStatusTitle")}),(0,y.jsx)(Ha,{newsletter:t}),(0,y.jsx)(Ba,{location:e.location,params:e.match.params})]})}Va.propTypes={location:g().shape({pathname:g().string}).isRequired,match:g().shape({params:g().shape({id:g().string.isRequired}).isRequired}).isRequired};const Wa=(e,t)=>e.location.pathname===t.location.pathname&&e.params.id===t.params.id,Ya=e=>(0,y.jsx)("div",{children:(0,y.jsx)(za,{...e})}),Ba=(0,j.memo)((e=>{let{location:t,params:n}=e;return(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:t,params:n,endpoint:"sending_task_subscribers",base_url:"sending-status/:id",onRenderItem:Ya,getListingItemKey:e=>`${e.taskId}-${e.subscriberId}`,columns:$a,messages:Ua,auto_refresh:!0,sort_by:"failed",sort_order:"desc",afterGetItems:e=>{(0,Xr._X)(e),(0,Xr.bF)(e)}})}),Wa);function Ha(e){let{newsletter:t}=e;return t.id&&t.subject&&t.sent?(0,y.jsx)("p",{children:(0,y.jsx)(l.rU,{to:`/stats/${t.id}`,children:t.subject})}):null}function za(e){let{error:t,failed:n,taskId:r,processed:a,email:s,subscriberId:i,lastName:o,firstName:l}=e;const c=h()("manage-column","column-primary","has-row-actions");let d=p.Z.I18n.t("unprocessed");return"1"===a&&(d="1"===n?(0,y.jsxs)("span",{children:[p.Z.I18n.t("failed"),(0,y.jsx)("br",{}),(0,y.jsx)("a",{className:"button",href:"#",onClick:e=>{e.preventDefault(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sending_task_subscribers",action:"resend",data:{taskId:r,subscriberId:i}}).done((()=>window.mailpoet_listing.forceUpdate())).fail((e=>p.Z.Notice.showApiErrorNotice(e)))},children:p.Z.I18n.t("resend")})]}):p.Z.I18n.t("sent")),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("td",{"data-automation-id":`name_${r}_${i}`,className:c,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-subscribers#/edit/${i}`,children:s}),(0,y.jsx)("div",{className:"mailpoet-listing-subtitle",children:`${l} ${o}`})]}),(0,y.jsx)("td",{className:"column","data-automation-id":`status_${r}_${i}`,"data-colname":p.Z.I18n.t("sendingStatus"),children:d}),(0,y.jsx)("td",{className:"column","data-automation-id":`error_${r}_${i}`,"data-colname":p.Z.I18n.t("failureReason"),children:t})]})}Ba.propTypes={location:g().shape({pathname:g().string}).isRequired,params:g().shape({id:g().string.isRequired}).isRequired},Ha.propTypes={newsletter:g().shape({id:g().string,subject:g().string,sent:g().bool})},Ha.defaultProps={newsletter:{id:null,subject:null,sent:!1}},za.propTypes={error:g().string,email:g().string.isRequired,failed:g().string.isRequired,taskId:g().string.isRequired,lastName:g().string.isRequired,firstName:g().string.isRequired,processed:g().string.isRequired,subscriberId:g().string.isRequired},za.defaultProps={error:""};var Ka=Va;const Ga=p.Z.trackingConfig.emailTrackingEnabled,Qa=window.mailpoet_woocommerce_automatic_emails||{},Xa={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterTrashed"):p.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterDeleted"):p.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneNewsletterRestored"):p.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},Ja=[{name:"subject",label:p.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:p.Z.I18n.t("settings")},{name:"statistics",label:p.Z.I18n.t("statistics"),display:Ga},{name:"status",label:p.Z.I18n.t("status"),width:145},{name:"updated_at",label:p.Z.I18n.t("lastModifiedOn"),sortable:!0}],es=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:Xa.onTrash}];let ts=[{name:"view",link:function(e){return(0,y.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("edit"),onClick:Xr.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:(e,t)=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{p.Z.Notice.success(p.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"trash",className:"mailpoet-hide-on-mobile"}];ts=(0,Xr.y8)(ts);class ns extends j.Component{constructor(e){super(e),(0,Z.Z)(this,"updateStatus",((e,t)=>{t.persist(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{if("active"===e.data.status){const e=t.target.getAttribute("data-group"),n=Qa[e];p.Z.Notice.success(p.Z.I18n.t("automaticEmailActivated").replace("%1s",n.title))}this.forceUpdate()})).fail((n=>{p.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,Z.Z)(this,"renderStatus",(e=>{const t=parseInt(e.total_sent,10)>-1?p.Z.I18n.t("sentToXCustomers").replace("%1$d",e.total_sent.toLocaleString()):null;return(0,y.jsxs)("div",{children:[(0,y.jsx)(Vt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,"data-group":e.options.group,dimension:"small",defaultChecked:"active"===e.status}),(0,y.jsxs)("p",{className:"mailpoet-listing-notification-status",children:[t&&(0,y.jsx)(l.rU,{to:`/sending-status/${e.id}`,children:t}),!t&&(0,y.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small",children:p.Z.I18n.t("notSentYet")})]})]})})),(0,Z.Z)(this,"renderSettings",(e=>{const t=Qa[e.options.group].events[e.options.event];let n;try{n=JSON.parse(e.options.meta||null)}catch(t){n=e.options.meta||null}const r=n&&n.option?I.ZP.pluck(n.option,"name"):[];if(n&&I.ZP.isEmpty(r))return(0,y.jsx)("span",{className:"mailpoet-listing-error",children:p.Z.I18n.t("automaticEmailEventOptionsNotConfigured")});let a,s;if(a=r.length>1&&"listingScheduleDisplayTextPlural"in t?k()(t.listingScheduleDisplayTextPlural,"%s",((e,t)=>(0,y.jsx)(w,{strings:r},t))):k()(t.listingScheduleDisplayText,"%s",((e,t)=>(0,y.jsx)(w,{strings:r},t))),a&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":s=p.Z.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":s=p.Z.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":s=p.Z.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":s=p.Z.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:s=p.Z.I18n.t("sendingDelayInvalid")}return(0,y.jsxs)("span",{children:[a,s&&(0,y.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,y.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,y.jsx)($r,{})}),s]})]})})),(0,Z.Z)(this,"renderItem",((e,t)=>{const n=h()("manage-column","column-primary","has-row-actions");return(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:n,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("settings"),children:this.renderSettings(e)}),!0===Ga?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("statistics"),children:(0,y.jsx)(na,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("status"),children:this.renderStatus(e)}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("lastModifiedOn"),children:[p.Z.Date.short(e.updated_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.updated_at)]})]})})),(0,Z.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={eventCounts:{},newslettersCount:void 0},this.afterGetItems=this.afterGetItems.bind(this)}afterGetItems(e){(0,Xr._X)(e),this.countEmailTypes(e)}countEmailTypes(e){const t={woocommerce_product_purchased:0,woocommerce_product_purchased_in_category:0,woocommerce_first_purchase:0};if(Array.isArray(e.items)){const n=e.items.map((e=>e.options.event)).reduce(((e,t)=>(e[t]?e[t]+=1:e[t]=1,e)),t);this.setState({eventCounts:n})}}renderWarning(){const{eventCounts:e}=this.state;return e.woocommerce_product_purchased+e.woocommerce_product_purchased_in_category+e.woocommerce_first_purchase?"1"===window.mailpoet_woocommerce_optin_on_checkout?null:(0,y.jsxs)("div",{className:"notice error",children:[(0,y.jsx)("p",{children:p.Z.I18n.t("wooCommerceEmailsWarning")}),(0,y.jsx)("p",{children:(0,y.jsx)("a",{href:"?page=mailpoet-settings#woocommerce",children:p.Z.I18n.t("wooCommerceEmailsWarningLink")})})]}):null}render(){const{match:e,location:t}=this.props;return(0,y.jsxs)(y.Fragment,{children:[this.renderWarning(),0===this.state.newslettersCount&&(0,y.jsx)(ct,{filter:e=>"woocommerce"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:t,params:e.params,endpoint:"newsletters",type:"automatic",base_url:"woocommerce",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Ja,bulk_actions:es,item_actions:ts,messages:Xa,auto_refresh:!0,sort_by:"updated_at",sort_order:"desc",afterGetItems:e=>{if(!e.loading){const t=e.groups.reduce(((e,t)=>e+t.count),0);this.setState({newslettersCount:t})}this.afterGetItems(e)}})]})}}ns.propTypes={match:g().shape({params:g().shape({tab:g().string}).isRequired}).isRequired,location:g().object.isRequired};var rs=(0,c.withRouter)(ns),as=function(){return(0,y.jsx)(y.Fragment,{children:(0,y.jsx)("style",{dangerouslySetInnerHTML:{__html:".wrap { margin: 0 !important; }"}})})},ss=n(4840),is=n(53681);const os=e=>{const t=e<.1?2:1;return p.Z.Num.toLocaleFixed(e,t)};function ls(e){let{newsletter:t,isWoocommerceActive:n}=e;const r=t.total_sent||0;let a=0,s=0,i=0,o=0,l=0;r>0&&(a=100*t.statistics.clicked/r,s=100*t.statistics.opened/r,i=100*t.statistics.machineOpened/r,o=100*t.statistics.unsubscribed/r,l=100*t.statistics.bounced/r);const c=os(a),d=os(s),u=os(i),m=os(o),h=os(l),f=r>=20&&t.statistics.opened>=5,g=(0,y.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,y.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[d,"% "]}),p.Z.I18n.t("percentageOpened")]}),v=(0,y.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,y.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[u,"% "]}),p.Z.I18n.t("percentageMachineOpened"),(0,y.jsx)($e.Z,{tooltip:k()(p.Z.I18n.t("percentageMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,y.jsx)("span",{style:{pointerEvents:"all"},children:(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/368-what-are-machine-opens",target:"_blank","data-beacon-article":"6124b7fb21ef206e5592e188",rel:"noopener noreferrer",children:e},"kb-link")},"machine-opened-tooltip")))})]}),b=(0,y.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,y.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[m,"% "]}),p.Z.I18n.t("percentageUnsubscribed")]}),w=(0,y.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,y.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[h,"% "]}),p.Z.I18n.t("percentageBounced")]}),x=Kr("clicked",a),_=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-statistics-value",children:[(0,y.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${x}`,children:[c,"% "]}),p.Z.I18n.t("percentageClicked")]}),f&&(0,y.jsx)(Gr,{isInverted:!1,stat:"clicked",rate:a,tooltipId:`clicked-${t.id||"0"}`,tooltipPlace:"right"})]});return(0,y.jsxs)("div",{className:"mailpoet-stats-general",children:[(0,y.jsxs)(_t.r.ThreeColumns,{className:"mailpoet-stats-general-top-row",children:[(0,y.jsx)("div",{children:(0,y.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[p.Z.I18n.t("statsTotalSent"),": ",(0,y.jsx)("span",{className:"mailpoet-statistics-value-number",children:r.toLocaleString()})]})}),(0,y.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:b}),(0,y.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:w})]}),(0,y.jsxs)(_t.r.ThreeColumns,{children:[(0,y.jsx)("div",{children:_}),(0,y.jsxs)("div",{className:"mailpoet-statistics-with-left-separator",children:[g,v]}),n&&(0,y.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:Ye().applyFilters("mailpoet_newsletters_revenues_stats",null,t.statistics.revenue)}),!n&&(0,y.jsx)("div",{})]}),(0,y.jsx)("p",{className:"mailpoet-stats-general-read-more",children:(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/190-whats-a-good-email-open-rate",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"58f671152c7d3a057f8858e8",children:p.Z.I18n.t("readMoreOnStats")})})]})}function cs(e){let{newsletter:t}=e;const n=t.queue.scheduled_at||t.queue.created_at;return(0,y.jsxs)(_t.r.ThreeColumns,{className:"mailpoet-stats-info",children:[(0,y.jsxs)("div",{className:"mailpoet-grid-span-two-columns",children:[(0,y.jsx)(je.Z,{level:1,children:t.subject}),(0,y.jsx)("div",{children:(0,y.jsxs)("b",{children:[p.Z.Date.short(n)," • ",p.Z.Date.time(n)]})}),Array.isArray(t.segments)&&t.segments.length&&(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{className:"mailpoet-stats-info-key",children:p.Z.I18n.t("statsToSegments")}),": ",(0,y.jsx)(w,{dimension:"large",segments:t.segments})]})]}),(0,y.jsxs)("div",{className:"mailpoet-stats-info-sender-preview",children:[(0,y.jsxs)("div",{children:[(0,y.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,y.jsxs)("span",{className:"mailpoet-stats-info-key",children:[p.Z.I18n.t("statsFromAddress"),": "]}),t.sender_address?t.sender_address:"-"]}),(0,y.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,y.jsxs)("span",{className:"mailpoet-stats-info-key",children:[p.Z.I18n.t("statsReplyToAddress"),": "]}),t.reply_to_address?t.reply_to_address:"-"]}),(0,y.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,y.jsxs)("span",{className:"mailpoet-stats-info-key",children:[p.Z.I18n.t("googleAnalytics"),": "]}),t.ga_campaign?t.ga_campaign:"-"]})]}),(0,y.jsx)("div",{children:(0,y.jsx)(Ce.Button,{href:t.preview_url,target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("statsPreviewNewsletter")})})]})]})}function ds(){const e=(0,y.jsx)(v.Z,{href:p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount,p.Z.currentWpUserEmail,"starter",{utm_medium:"stats",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("premiumBannerCtaFree")}),t=(0,y.jsxs)("p",{children:[p.Z.I18n.t("premiumBannerDescription")," ",(0,y.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",children:p.Z.I18n.t("learnMore")}),"."]});return(0,y.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,y.jsx)(Be.Z,{title:p.Z.I18n.t("premiumFeature"),message:t,actionButton:e})})}var us=function(){if(!window.mailpoet_display_detailed_stats)return(0,y.jsx)(ds,{});if(window.mailpoet_subscribers_limit_reached){const e=window.mailpoet_has_valid_api_key,t=p.Z.I18n.t("upgradeRequired"),n=p.Z.I18n.t(e?"newsletterYourPlanLimit":"newsletterFreeVersionLimit").replace("[subscribersLimit]",window.mailpoet_subscribers_limit).replace("[subscribersCount]",window.mailpoet_subscribers_count),r=e?"https://account.mailpoet.com/upgrade":`https://account.mailpoet.com/?s=${window.mailpoet_subscribers_count+1}`;return(0,y.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,y.jsx)(Be.Z,{title:t,message:(0,y.jsx)("p",{children:n}),actionButton:(0,y.jsx)(v.Z,{target:"_blank",rel:"noopener noreferrer",href:r,children:p.Z.I18n.t("upgradeNow")})})})}return null},ps=(0,c.withRouter)((function(e){let{match:t,history:n,location:r}=e;const[a,s]=(0,j.useState)({item:void 0,loading:!0}),i=(0,j.useCallback)((e=>{s({loading:!0,item:a.item}),p.Z.Modal.loading(!0),p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:window.mailpoet_display_detailed_stats?"stats":"newsletters",action:window.mailpoet_display_detailed_stats?"get":"getWithStats",data:{id:e}}).always((()=>{p.Z.Modal.loading(!1)})).done((e=>{s({loading:!1,item:e.data})})).fail((e=>{p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0}),s({loading:!1}),n.push("/")}))}),[n,a.item]);(0,j.useEffect)((()=>{window.scrollTo(0,0),a.item?.id!==t.params.id&&i(t.params.id)}),[t.params.id,i,a.item]);const{item:o,loading:l}=a,c=o;return l?null:c?.subject&&!c?.queue?(0,y.jsx)("div",{children:(0,y.jsx)(je.Z,{level:1,children:c.subject})}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(De.Z,{}),(0,y.jsx)(as,{}),(0,y.jsx)(F.Q,{}),(0,y.jsxs)("div",{className:"mailpoet-stats-page",children:[(0,y.jsx)(E,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,y.jsx)(cs,{newsletter:c}),(0,y.jsx)(ls,{newsletter:c,isWoocommerceActive:p.Z.isWoocommerceActive}),(0,y.jsxs)(ss.Z,{activeKey:"clicked",children:[(0,y.jsx)(is.Z,{title:p.Z.I18n.t("clickedLinks"),children:Ye().applyFilters("mailpoet_newsletters_clicked_links_table",(0,y.jsx)(us,{}),c.clicked_links)},"clicked"),Ye().applyFilters("mailpoet_newsletters_purchased_products",null,c),(0,y.jsx)(is.Z,{title:p.Z.I18n.t("subscriberEngagement"),children:Ye().applyFilters("mailpoet_newsletters_subscriber_engagement",(0,y.jsx)(us,{}),r,t.params,c)},"engagement"),(0,y.jsx)(is.Z,{title:p.Z.I18n.t("bounces"),automationId:"bounces-tab",children:Ye().applyFilters("mailpoet_newsletters_bounces",(0,y.jsx)(us,{}),r,t.params)},"bounces")]})]})]})})),ms=n(48228),hs=n(97762),fs=n(87903),gs=n.n(fs);function vs(e){const t=e.installedDaysAgo,n=t>30?p.Z.I18n.t("reviewRequestUsingForMonths").replace("[months]",Math.round(t/30)):p.Z.I18n.t("reviewRequestUsingForDays").replace("[days]",t);return(0,y.jsxs)("div",{className:"mailpoet_review_request",children:[(0,y.jsx)("img",{src:e.reviewRequestIllustrationUrl,height:"280",width:"280",alt:""}),(0,y.jsx)("h2",{children:p.Z.I18n.t("reviewRequestHeading")}),(0,y.jsx)("p",{children:p.Z.I18n.t("reviewRequestDidYouKnow").replace("[username]",e.username)}),(0,y.jsx)("p",{children:n}),(0,y.jsx)("p",{children:(0,y.jsx)("a",{href:"http://bit.ly/2Bi124o",target:"_blank",rel:"noopener noreferrer",className:"button button-primary",children:p.Z.I18n.t("reviewRequestRateUsNow")})}),(0,y.jsx)("p",{children:(0,y.jsx)("a",{id:"mailpoet_review_request_not_now",children:p.Z.I18n.t("reviewRequestNotNow")})})]})}vs.propTypes={installedDaysAgo:g().number.isRequired,reviewRequestIllustrationUrl:g().string.isRequired,username:g().string.isRequired};var bs=vs;let ys=null;const ws=()=>((0,j.useLayoutEffect)((()=>{window.mailpoet_display_nps_poll&&p.Z.libs3rdPartyEnabled&&(ys||(ys=p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"analytics",action:"getTrackingData"})),ys).then((e=>{let{data:t}=e;return(e=>{let t;t=window.mailpoet_display_nps_form?"EqOgKsgZd832Sz9w":window.mailpoet_is_new_user?"6L479eVPXk7pBn6S":"k0aJAsQAWI2ERyGv",gs()({writeKey:t,userId:window.mailpoet_current_wp_user.ID+window.mailpoet_site_url,traits:{name:window.mailpoet_current_wp_user.user_nicename,email:window.mailpoet_current_wp_user.user_email,mailpoetVersion:window.mailpoet_version,mailpoetPremiumIsActive:window.mailpoet_premium_active,createdAt:e.installedAtIso,newslettersSent:e.newslettersSent,welcomeEmails:e.welcomeEmails,postnotificationEmails:e.postnotificationEmails,woocommerceEmails:e.woocommerceEmails,subscribers:e.subscribers,lists:e.lists,sendingMethod:e.sendingMethod,woocommerceIsInstalled:e.woocommerceIsInstalled},events:{submit:e=>{e.rating>=9&&e.completed&&p.Z.Modal.popup({width:800,template:hs.renderToString(bs({username:window.mailpoet_current_wp_user_firstname||window.mailpoet_current_wp_user.user_login,reviewRequestIllustrationUrl:window.mailpoet_review_request_illustration_url,installedDaysAgo:window.mailpoet_installed_days_ago})),onInit:()=>{document.getElementById("mailpoet_review_request_not_now").addEventListener("click",(()=>p.Z.Modal.close()))}})}}})})(t)}))}),[]),null);var xs=e=>function(t){return ws(),(0,y.jsx)(e,{...t})},_s=function(){return(0,y.jsx)(F.Q,{children:(0,y.jsxs)(l.rU,{id:"mailpoet-new-email",className:"mailpoet-button button-secondary",to:"/new",onClick:()=>p.Z.trackEvent("Emails > Add New"),"data-automation-id":"new_email",children:[q,(0,y.jsx)("span",{children:p.Z.I18n.t("new")})]})})},Zs=(0,c.withRouter)((function(e){let{children:t,location:n}=e;return null!==(0,dt.X)(n)||(e=>e.hash.match(/^#\/new/)||e.pathname.match(/^\/new/))(n)?null:t})),js=function(e){let{mailpoetInstalledDaysAgo:t,sendTransactionalEmails:n,mtaMethod:r,noticeDismissed:a,apiVersion:s}=e;const[i,o]=(0,j.useState)(!1),l=()=>{p.Z.Ajax.post({api_version:s,endpoint:"UserFlags",action:"set",data:{transactional_emails_opt_in_notice_dismissed:"1"}})};return t<30||n||"PHPMail"===r||"1"===a||i?null:(0,y.jsxs)(N.Z,{type:"success",timeout:!1,onClose:l,children:[(0,y.jsx)("h3",{children:p.Z.I18n.t("transactionalEmailNoticeTitle")}),(0,y.jsxs)("p",{children:[p.Z.I18n.t("transactionalEmailNoticeBody")," ",(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/292-choose-how-to-send-your-wordpress-websites-emails",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("transactionalEmailNoticeBodyReadMore")})]}),(0,y.jsx)("p",{children:(0,y.jsx)("button",{type:"button",className:"button",onClick:()=>{o(!0),p.Z.Ajax.post({api_version:s,endpoint:"settings",action:"set",data:{send_transactional_emails:"1"}}),l()},children:p.Z.I18n.t("transactionalEmailNoticeCTA")})})]})};const Is=window.mailpoet_woocommerce_automatic_emails||[],Ss=xs((()=>{const{parentId:e}=(0,c.useParams)();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Zs,{children:(0,y.jsx)(_s,{})}),(0,y.jsxs)(ms.Z,{activeKey:"standard",routerType:"switch-only",onSwitch:e=>(e=>p.Z.trackEvent(`Tab Emails > ${e} clicked`))(e),automationId:"newsletters_listing_tabs",children:[(0,y.jsx)(is.Z,{route:"standard/(.*)?",title:p.Z.I18n.t("tabStandardTitle"),automationId:`tab-${p.Z.I18n.t("tabStandardTitle")}`,children:(0,y.jsx)(da,{})},"standard"),(0,y.jsx)(is.Z,{route:"welcome/(.*)?",title:p.Z.I18n.t("tabWelcomeTitle"),automationId:`tab-${p.Z.I18n.t("tabWelcomeTitle")}`,children:(0,y.jsx)(ya,{})},"welcome"),(0,y.jsx)(is.Z,{route:"notification/(.*)?",title:p.Z.I18n.t("tabNotificationTitle"),automationId:`tab-${p.Z.I18n.t("tabNotificationTitle")}`,children:e?(0,y.jsx)(qa,{parentId:e}):(0,y.jsx)(Ia,{})},"notification"),(0,y.jsx)(is.Z,{route:"re_engagement/(.*)?",title:p.Z.I18n.t("tabReEngagementTitle"),automationId:`tab-${p.Z.I18n.t("tabReEngagementTitle")}`,children:(0,y.jsx)(Ea,{})},"re_engagement"),window.mailpoet_woocommerce_active&&I.ZP.map(Is,(e=>(0,y.jsx)(is.Z,{route:`${e.slug}/(.*)?`,title:e.title,automationId:`tab-${e.title}`,children:(0,y.jsx)(rs,{})},e.slug)))]})]})}));function Cs(e){let{history:t}=e;return(0,y.jsx)(ct,{history:t,hideClosingButton:0===window.mailpoet_newsletters_count})}Cs.propTypes={history:g().shape({push:g().func.isRequired}).isRequired};const Ts=[...(()=>{const e=[];return I.ZP.each(Is,(t=>{e.push({path:`/${t.slug}/(.*)?`,component:Ss});const{events:n}=t;I.ZP.isObject(n)&&I.ZP.each(n,(n=>{e.push({path:`/new/${t.slug}/${n.slug}/conditions`,render:e=>{const r={...e,email:t,name:n.slug};return(0,y.jsx)(Tr,{...r})}})})),e.push({path:`/new/${t.slug}`,render:e=>{const n={...e,email:t};return(0,y.jsx)(rt,{...n})}})})),e})(),{path:"/notification/history/:parentId/(.*)?",component:Ss},{path:"/(standard|welcome|notification|re_engagement)/(.*)?",component:Ss},{path:"/new/standard",component:wr},{path:"/new/notification",component:Zr},{path:"/new/welcome",component:Sr},{path:"/new/re-engagement",component:function(){let e="";p.Z.settings.deactivate_subscriber_after_inactive_days&&(e=(Math.floor(Number(p.Z.settings.deactivate_subscriber_after_inactive_days)/30)-1).toString());const[t,n]=(0,j.useState)({afterTimeNumber:e,afterTimeType:"months"}),[r,a]=(0,j.useState)([]),[s,i]=(0,j.useState)(!1),o=(0,c.useHistory)();return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),r&&(0,y.jsx)(it,{errors:r}),(0,y.jsx)(ut,{emailType:"re_engagement",automationId:"re_engagement_heading_creation_heading"}),(0,y.jsxs)(_t.r.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,y.jsx)(Ln,{afterTimeNumber:t.afterTimeNumber,afterTimeType:t.afterTimeType,inactiveSubscribersPeriod:Number(p.Z.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:(0,Pn.compose)([n,(0,Pn.assoc)("afterTimeNumber",Pn.__,t)]),updateAfterTimeType:(0,Pn.compose)([n,(0,Pn.assoc)("afterTimeType",Pn.__,t)])}),(0,y.jsx)(v.Z,{isFullWidth:!0,onClick:()=>(a([]),i(!0),void p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"newsletters",action:"create",data:{type:"re_engagement",subject:p.Z.I18n.t("draftNewsletterTitle"),options:t}}).done((e=>{var t;t=e.data.id,o.push(`/template/${t}`)})).fail((e=>{i(!1),e.errors&&a(e.errors)}))),type:"button",isDisabled:!t.afterTimeNumber||s,withSpinner:s,children:p.Z.I18n.t("next")})]})]})}},{path:"/new",component:Cs},{name:"template",path:"/template/:id",component:xt},{path:"/send/congratulate/:id",component:br},{path:"/send/:id",component:zn},{path:"/sending-status/:id/(.*)?",component:Ka},{path:"/stats/:id/(.*)?",component:ps}];function ks(){return(0,y.jsx)(Fe.k.Provider,{value:(0,Fe.S)(window),children:(0,y.jsxs)(l.UT,{children:[(0,y.jsx)(Ge.Z,{}),(0,y.jsx)(D,{}),(0,y.jsx)(R,{}),(0,y.jsx)(js,{mailpoetInstalledDaysAgo:window.mailpoet_installed_days_ago,sendTransactionalEmails:window.mailpoet_send_transactional_emails,mtaMethod:window.mailpoet_mta_method,apiVersion:window.mailpoet_api_version,noticeDismissed:window.mailpoet_transactional_emails_opt_in_notice_dismissed}),(0,y.jsx)(E,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,y.jsxs)(c.Switch,{children:[(0,y.jsx)(c.Route,{exact:!0,path:"/",render:()=>(0,y.jsx)(c.Redirect,{to:0===window.mailpoet_newsletters_count?"/new":"/standard"})}),Ts.map((e=>(0,y.jsx)(c.Route,{path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render},e.path)))]})]})})}const Ns=document.getElementById("newsletters_container");Ns&&(window.mailpoet_listing=o().render((0,y.jsx)(ks,{}),Ns));const Ds=e=>"wp_users"===e.type,Es=e=>"woocommerce_users"===e.type,Os=e=>Ds(e)||Es(e),Rs=p.Z.trackingConfig.emailTrackingEnabled,As=[{name:"name",label:p.Z.I18n.t("name"),sortable:!0},{name:"description",label:p.Z.I18n.t("description")},{name:"average_subscriber_score",label:p.Z.I18n.t("listScore"),display:Rs},{name:"subscribed",label:p.Z.I18n.t("subscribed"),className:"mailpoet-listing-column-narrow"},{name:"unconfirmed",label:p.Z.I18n.t("unconfirmed"),className:"mailpoet-listing-column-narrow"},{name:"unsubscribed",label:p.Z.I18n.t("unsubscribed"),className:"mailpoet-listing-column-narrow"},{name:"inactive",label:p.Z.I18n.t("inactive"),className:"mailpoet-listing-column-narrow"},{name:"bounced",label:p.Z.I18n.t("bounced"),className:"mailpoet-listing-column-narrow"},{name:"created_at",label:p.Z.I18n.t("createdOn"),sortable:!0}],Ps={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneSegmentTrashed"):p.Z.I18n.t("multipleSegmentsTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneSegmentDeleted"):p.Z.I18n.t("multipleSegmentsDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneSegmentRestored"):p.Z.I18n.t("multipleSegmentsRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},Ms=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:Ps.onTrash}],Ls=e=>!Os(e),Fs=[{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return(0,y.jsx)(l.rU,{to:`/edit/${e.id}`,children:p.Z.I18n.t("edit")})},display:function(e){return!Os(e)}},{name:"duplicate_segment",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:(e,t)=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"duplicate",data:{id:e.id}}).done((e=>{p.Z.Notice.success(p.Z.I18n.t("listDuplicated").replace("%1$s",e.data.name)),t()})).fail((e=>{p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),display:function(e){return!Os(e)}},{name:"read_more",className:"mailpoet-hide-on-mobile",link:function(){return(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/133-the-wordpress-users-list",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("readMore")})},display:function(e){return Ds(e)}},{name:"synchronize_segment",label:p.Z.I18n.t("forceSync"),onClick:function(e,t){p.Z.Modal.loading(!0),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"synchronize",data:{type:e.type}}).done((()=>{let n=p.Z.I18n.t("listSynchronized").replace("%1$s",e.name);"woocommerce_users"===e.type&&(n=p.Z.I18n.t("listSynchronizationWasScheduled").replace("%1$s",e.name)),p.Z.Modal.loading(!1),p.Z.Notice.success(n),t()})).fail((e=>{p.Z.Modal.loading(!1),e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},display:function(e){return Ds(e)||Es(e)}},{name:"view_subscribers",link:function(e){return(0,y.jsx)("a",{href:e.subscribers_url,"data-automation-id":`view_subscribers_${e.name}`,children:p.Z.I18n.t("viewSubscribers")})}},{name:"trash",className:"mailpoet-hide-on-mobile",display:function(e){return!Es(e)}}];class qs extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"renderItem",((e,t)=>{const n=h()("manage-column","column-primary","has-row-actions"),r=Number(e.subscribers_count.subscribed||0),a=Number(e.subscribers_count.unconfirmed||0),s=Number(e.subscribers_count.unsubscribed||0),i=Number(e.subscribers_count.inactive||0),o=Number(e.subscribers_count.bounced||0);let c;return c=Os(e)?(0,y.jsx)("span",{className:"mailpoet-listing-title",children:e.name}):(0,y.jsx)(l.rU,{className:"mailpoet-listing-title",to:`/edit/${e.id}`,children:e.name}),(0,y.jsxs)("div",{children:[(0,y.jsxs)("td",{className:n,"data-automation-id":`segment_name_${e.name}`,children:[c,t]}),(0,y.jsx)("td",{"data-colname":p.Z.I18n.t("description"),children:(0,y.jsx)("abbr",{children:e.description})}),Rs?(0,y.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":p.Z.I18n.t("averageScore"),children:(0,y.jsx)("div",{className:"mailpoet-listing-stats",children:(0,y.jsx)(W,{id:e.id,engagementScore:e.average_engagement_score})})}):null,(0,y.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("subscribed"),children:(0,y.jsx)("abbr",{children:r.toLocaleString()})}),(0,y.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("unconfirmed"),children:(0,y.jsx)("abbr",{children:a.toLocaleString()})}),(0,y.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("unsubscribed"),children:(0,y.jsx)("abbr",{children:s.toLocaleString()})}),(0,y.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("inactive"),children:(0,y.jsx)("abbr",{children:i.toLocaleString()})}),(0,y.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("bounced"),children:(0,y.jsx)("abbr",{children:o.toLocaleString()})}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("createdOn"),children:[p.Z.Date.short(e.created_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.created_at)]})]})}))}render(){return(0,y.jsx)("div",{className:"mailpoet-segments-listing",children:(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:Ps,search:!1,endpoint:"segments",base_url:"lists",onRenderItem:this.renderItem,columns:As,bulk_actions:Ms,item_actions:Fs,sort_by:"name",sort_order:"asc",isItemDeletable:Ls,isItemToggleable:Ds})})}}qs.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var $s=(0,c.withRouter)(qs);const Us=[{name:"name",label:p.Z.I18n.t("name"),type:"text"},{name:"description",label:p.Z.I18n.t("description"),type:"textarea",tip:p.Z.I18n.t("segmentDescriptionTip")}],Vs={onUpdate:function(){p.Z.Notice.success(p.Z.I18n.t("segmentUpdated"))},onCreate:function(){p.Z.Notice.success(p.Z.I18n.t("segmentAdded")),p.Z.trackEvent("Lists > Add new")}};function Ws(e){return(0,y.jsxs)("div",{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(De.Z,{}),(0,y.jsxs)(je.Z,{level:1,className:"mailpoet-title",children:[(0,y.jsx)("span",{children:p.Z.I18n.t("segment")}),(0,y.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:"/",children:p.Z.I18n.t("backToList")})]}),(0,y.jsx)(D,{}),(0,y.jsx)(ke,{endpoint:"segments",fields:Us,params:e.match.params,messages:Vs})]})}Ws.propTypes={match:g().shape({params:g().shape({id:g().string}).isRequired}).isRequired};var Ys=Ws,Bs=n(41882),Hs=n(94878),zs=n(1030),Ks=n(96486),Gs=n.n(Ks),Qs=n(66067);function Xs(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[])?.map((e=>{const t=e.sent_at?p.Z.Date.format(e.sent_at):p.Z.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}}));return(0,j.useEffect)((()=>{n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t),n.action===Qs.EmailActionTypes.MACHINE_OPENED&&n.operator===Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t)}),[n.action,n.operator,t,r]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{isFullWidth:!0,value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),n.action!==Qs.EmailActionTypes.MACHINE_OPENED?(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")}):null]},"select")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:p.Z.I18n.t("selectNewsletterPlaceholder"),options:s,automationId:"segment-email",value:(0,Pn.filter)((e=>{if(!n.newsletters)return;const t=e.value;return-1!==n.newsletters.indexOf(t)}),s),onChange:e=>{r({newsletters:(0,Pn.map)("value",e)},t)}})})]})}const Js=e=>!!e;function ei(e){return p.Z.I18n.t("emailActionOpensDaysSentence").split(/({days})/gim).map(e)}function ti(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");return(0,j.useEffect)((()=>{void 0===n.operator&&r({operator:"more"},t)}),[r,n,t]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(s=e=>"{condition}"===e?(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,y.jsx)("option",{value:"more",children:p.Z.I18n.t("moreThan")}),(0,y.jsx)("option",{value:"less",children:p.Z.I18n.t("lessThan")}),(0,y.jsx)("option",{value:"equals",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"not_equals",children:p.Z.I18n.t("notEquals")})]},"select"):"{opens}"===e?(0,y.jsx)(ae.Z,{type:"number",value:n.opens||"","data-automation-id":"segment-number-of-opens",onChange:e=>{a("opens",t,e)},min:"0",placeholder:p.Z.I18n.t("emailActionOpens")},"input"):"string"==typeof e&&e.trim().length>1?(0,y.jsx)("div",{children:e},"opens"):null,p.Z.I18n.t("emailActionOpensSentence").split(/({condition})|({opens})|(\b[a-zA-Z]+\b)/gim).map(s))}),(0,y.jsx)(_t.r.CenteredRow,{children:ei((e=>"{days}"===e?(0,y.jsx)(ae.Z,{type:"number",value:n.days||"","data-automation-id":"segment-number-of-days",onChange:e=>{a("days",t,e)},min:"0",placeholder:p.Z.I18n.t("emailActionDays")},"input"):"string"==typeof e&&e.trim().length>1?(0,y.jsx)("div",{children:e},e):null))})]});var s}const ni=[{value:Qs.EmailActionTypes.OPENS_ABSOLUTE_COUNT,label:p.Z.I18n.t("emailActionOpensAbsoluteCount"),group:Qs.SegmentTypes.Email},{value:Qs.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT,label:p.Z.I18n.t("emailActionMachineOpensAbsoluteCount"),group:Qs.SegmentTypes.Email},{value:Qs.EmailActionTypes.OPENED,label:p.Z.I18n.t("emailActionOpened"),group:Qs.SegmentTypes.Email},{value:Qs.EmailActionTypes.MACHINE_OPENED,label:p.Z.I18n.t("emailActionMachineOpened"),group:Qs.SegmentTypes.Email},{value:Qs.EmailActionTypes.CLICKED,label:p.Z.I18n.t("emailActionClicked"),group:Qs.SegmentTypes.Email},{value:Qs.EmailActionTypes.CLICKED_ANY,label:p.Z.I18n.t("emailActionClickedAnyEmail"),group:Qs.SegmentTypes.Email}],ri={[Qs.EmailActionTypes.OPENS_ABSOLUTE_COUNT]:ti,[Qs.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT]:ti,[Qs.EmailActionTypes.CLICKED]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),[i,o]=(0,j.useState)([]),[l,c]=(0,j.useState)([]),[d,u]=(0,j.useState)(!1),m=s?.map((e=>{const t=e.sent_at?p.Z.Date.format(e.sent_at):p.Z.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}})),h=(0,j.useCallback)((()=>{var e;Js(n.newsletter_id)&&(c([]),e=n.newsletter_id,o([]),u(!0),p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"newsletter_links",action:"get",data:{newsletterId:e}}).then((e=>{const{data:t}=e,n=t.map((e=>({value:e.id,label:e.url})));u(!1),c(n)})).fail((e=>{o(e.errors)})))}),[n.newsletter_id]);return(0,j.useEffect)((()=>{h()}),[h,n.newsletter_id]),(0,j.useEffect)((()=>{n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t)}),[n.operator,t,r]),(0,y.jsxs)(y.Fragment,{children:[i.length>0&&(0,y.jsx)(it,{errors:i}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectNewsletterPlaceholder"),options:m,value:(0,Pn.find)(["value",n.newsletter_id],m),onChange:e=>{r({newsletter_id:e.value,link_ids:[]},t)},automationId:"segment-email"})}),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{isMinWidth:!0,value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select-operator"),d&&(0,y.jsx)("span",{children:p.Z.I18n.t("loadingDynamicSegmentItems")}),!d&&Js(n.newsletter_id)&&(0,y.jsx)(zs.Z,{isMulti:!0,dimension:"small",isFullWidth:!0,automationId:"segment-link-select",placeholder:p.Z.I18n.t("allLinksPlaceholder"),options:l.length?l:[{value:0,label:p.Z.I18n.t("noLinksHint"),isDisabled:!0}],value:(0,Pn.filter)((e=>!!n.link_ids&&-1!==n.link_ids.indexOf(e.value)),l),onChange:e=>{r({link_ids:(e||[]).map((e=>e.value))},t)}})]})]})},[Qs.EmailActionTypes.OPENED]:Xs,[Qs.EmailActionTypes.MACHINE_OPENED]:Xs,[Qs.EmailActionTypes.CLICKED_ANY]:null};var ai;!function(e){e.NUMBER_OF_ORDERS="numberOfOrders",e.PURCHASED_CATEGORY="purchasedCategory",e.PURCHASED_PRODUCT="purchasedProduct",e.TOTAL_SPENT="totalSpent",e.CUSTOMER_IN_COUNTRY="customerInCountry"}(ai||(ai={}));const si=[{value:ai.CUSTOMER_IN_COUNTRY,label:p.Z.I18n.t("wooCustomerInCountry"),group:Qs.SegmentTypes.WooCommerce},{value:ai.NUMBER_OF_ORDERS,label:p.Z.I18n.t("wooNumberOfOrders"),group:Qs.SegmentTypes.WooCommerce},{value:ai.PURCHASED_CATEGORY,label:p.Z.I18n.t("wooPurchasedCategory"),group:Qs.SegmentTypes.WooCommerce},{value:ai.PURCHASED_PRODUCT,label:p.Z.I18n.t("wooPurchasedProduct"),group:Qs.SegmentTypes.WooCommerce},{value:ai.TOTAL_SPENT,label:p.Z.I18n.t("wooTotalSpent"),group:Qs.SegmentTypes.WooCommerce}],ii=[ai.PURCHASED_PRODUCT,ai.PURCHASED_CATEGORY];function oi(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");(0,j.useEffect)((()=>{n.action===Qs.SubscriberActionTypes.WORDPRESS_ROLE&&n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t)}),[r,n,t]);const s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getWordpressRoles()),[]).map((e=>({value:e.role_id,label:e.role_name})));return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{isFullWidth:!0,value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,automationId:"segment-wordpress-role",placeholder:p.Z.I18n.t("selectUserRolePlaceholder"),options:s,value:(0,Pn.filter)((e=>{if(n.wordpressRole)return-1!==n.wordpressRole.indexOf(e.value)}),s),onChange:e=>{r({wordpressRole:(0,Pn.map)("value",e)},t)}})})]})}let li;!function(e){e.HIGHER_THAN="higherThan",e.LOWER_THAN="lowerThan",e.EQUALS="equals",e.NOT_EQUALS="not_equals",e.UNKNOWN="unknown",e.NOT_UNKNOWN="not_unknown"}(li||(li={}));const ci=[li.HIGHER_THAN,li.LOWER_THAN,li.EQUALS,li.NOT_EQUALS,li.UNKNOWN,li.NOT_UNKNOWN];var di=n(23855),ui=n(12274);let pi;!function(e){e.BEFORE="before",e.AFTER="after",e.ON="on",e.NOT_ON="notOn",e.IN_THE_LAST="inTheLast",e.NOT_IN_THE_LAST="notInTheLast"}(pi||(pi={}));const mi=[pi.BEFORE,pi.AFTER,pi.ON,pi.NOT_ON,pi.IN_THE_LAST,pi.NOT_IN_THE_LAST],hi=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return p.Z.Date.format(e,{format:"Y-m-d"})}},fi=e=>{const t=(0,di.default)(e);if((0,ui.default)(t))return t};function gi(e){return"string"==typeof e.value&&e.value.length>0&&("equals"===e.operator||"contains"===e.operator||"not_equals"===e.operator||"more_than"===e.operator||"less_than"===e.operator)}function vi(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:r,updateSegmentFilter:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");return(0,j.useEffect)((()=>{void 0===n.operator&&a({operator:"equals",value:""},t)}),[a,n,t]),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{automationId:"text-custom-field-operator",value:n.operator,onChange:e=>{r("operator",t,e)},children:[(0,y.jsx)("option",{value:"equals",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"not_equals",children:p.Z.I18n.t("notEquals")}),(0,y.jsx)("option",{value:"contains",children:p.Z.I18n.t("contains")}),(0,y.jsx)("option",{value:"more_than",children:p.Z.I18n.t("moreThan")}),(0,y.jsx)("option",{value:"less_than",children:p.Z.I18n.t("lessThan")})]},"select"),(0,y.jsx)(ae.Z,{"data-automation-id":"text-custom-field-value",value:n.value||"",onChange:e=>{r("value",t,e)},placeholder:p.Z.I18n.t("value")},"input")]})}function bi(e){return"string"==typeof e.value&&e.value.length>0}function yi(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),a=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),s=(0,Pn.find)({id:Number(n.custom_field_id)},a);if(!s)return null;const i=s.params;if(!i||!Array.isArray(i.values))return null;const o=i.values.map((e=>({value:e.value,label:e.value})));return(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectValue"),options:o,value:n.value?{value:n.value,label:n.value}:null,onChange:e=>{r({value:e.value,operator:"equals"},t)},automationId:"segment-wordpress-role"})}var wi=n(95570),xi=n(49546);const _i=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return(0,xi.default)(e,"yyyy-MM-dd 00:00:00")}},Zi=e=>{const t=(0,di.default)(e);if((0,ui.default)(t))return t},ji={month:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,j.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Pn.assign)(n,{value:"2017-01-01 00:00:00"}),r)}),[t,n,r]),(0,y.jsxs)(de.Z,{value:n.value,onChange:e=>{t((0,Pn.assign)(n,{value:e.target.value}),r)},children:[(0,y.jsx)("option",{value:"2017-01-01 00:00:00",children:p.Z.I18n.t("january")}),(0,y.jsx)("option",{value:"2017-02-01 00:00:00",children:p.Z.I18n.t("february")}),(0,y.jsx)("option",{value:"2017-03-01 00:00:00",children:p.Z.I18n.t("march")}),(0,y.jsx)("option",{value:"2017-04-01 00:00:00",children:p.Z.I18n.t("april")}),(0,y.jsx)("option",{value:"2017-05-01 00:00:00",children:p.Z.I18n.t("may")}),(0,y.jsx)("option",{value:"2017-06-01 00:00:00",children:p.Z.I18n.t("june")}),(0,y.jsx)("option",{value:"2017-07-01 00:00:00",children:p.Z.I18n.t("july")}),(0,y.jsx)("option",{value:"2017-08-01 00:00:00",children:p.Z.I18n.t("august")}),(0,y.jsx)("option",{value:"2017-09-01 00:00:00",children:p.Z.I18n.t("september")}),(0,y.jsx)("option",{value:"2017-10-01 00:00:00",children:p.Z.I18n.t("october")}),(0,y.jsx)("option",{value:"2017-11-01 00:00:00",children:p.Z.I18n.t("november")}),(0,y.jsx)("option",{value:"2017-12-01 00:00:00",children:p.Z.I18n.t("december")})]},"select")},year:function(e){let{onChange:t,item:n,filterIndex:r}=e;const a=(0,wi.default)(new Date);return(0,j.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Pn.assign)(n,{value:`${a}-01-01 00:00:00`,operator:"equals"}),r)}),[a,t,n,r]),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>{t((0,Pn.assign)(n,{operator:e.target.value}),r)},children:[(0,y.jsx)("option",{value:"equals",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"before",children:p.Z.I18n.t("before")}),(0,y.jsx)("option",{value:"after",children:p.Z.I18n.t("after")})]},"select-operator"),(0,y.jsx)(de.Z,{value:n.value,onChange:e=>{t((0,Pn.assign)(n,{value:e.target.value}),r)},children:(0,Pn.range)(0,100).map((e=>(0,y.jsx)("option",{value:a-e+"-01-01 00:00:00",children:a-e},a-e)))},"select-year")]})},year_month:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,j.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Pn.assign)(n,{value:`${(0,xi.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),r)}),[t,n,r]),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>{t((0,Pn.assign)(n,{operator:e.target.value}),r)},children:[(0,y.jsx)("option",{value:"equals",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"before",children:p.Z.I18n.t("before")}),(0,y.jsx)("option",{value:"after",children:p.Z.I18n.t("after")})]},"select-operator"),(0,y.jsx)(It,{onChange:e=>t((0,Pn.assign)(n,{value:_i(e)}),r),selected:n.value?Zi(n.value):void 0,dateFormat:"MM/yyyy",showMonthYearPicker:!0})]})},year_month_day:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,j.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Pn.assign)(n,{value:`${(0,xi.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),r)}),[t,n,r]),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>{t((0,Pn.assign)(n,{operator:e.target.value}),r)},children:[(0,y.jsx)("option",{value:"equals",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"before",children:p.Z.I18n.t("before")}),(0,y.jsx)("option",{value:"after",children:p.Z.I18n.t("after")})]},"select-operator"),(0,y.jsx)(It,{dateFormat:"MMM d, yyyy",onChange:e=>t((0,Pn.assign)(n,{value:_i(e)}),r),selected:n.value?Zi(n.value):void 0})]})}};var Ii;!function(e){e.DATE="date",e.TEXT="text",e.TEXTAREA="textarea",e.RADIO="radio",e.CHECKBOX="checkbox",e.SELECT="select"}(Ii||(Ii={}));const Si={[Ii.TEXT]:gi,[Ii.TEXTAREA]:gi,[Ii.RADIO]:bi,[Ii.SELECT]:bi,[Ii.CHECKBOX]:function(e){return"1"===e.value||"0"===e.value},[Ii.DATE]:function(e){return("month"===e.date_type||!("string"!=typeof e.operator||e.operator.length<1))&&"string"==typeof e.value&&e.value.length>1}},Ci={[Ii.TEXT]:vi,[Ii.TEXTAREA]:vi,[Ii.RADIO]:yi,[Ii.SELECT]:yi,[Ii.CHECKBOX]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:r,updateSegmentFilter:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");return(0,j.useEffect)((()=>{"1"!==n.value&&"0"!==n.value&&a({operator:"equals",value:"1"},t)}),[a,n,t]),(0,y.jsxs)(de.Z,{value:n.value,onChange:e=>r("value",t,e),children:[(0,y.jsx)("option",{value:"1",children:p.Z.I18n.t("checked")}),(0,y.jsx)("option",{value:"0",children:p.Z.I18n.t("unchecked")})]},"select")},[Ii.DATE]:function(e){let{customField:t,filterIndex:n}=e;const r=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(n)),[n]),{updateSegmentFilter:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");(0,j.useEffect)((()=>{r.date_type!==t.params.date_type&&a({date_type:t.params.date_type,value:""},n)}),[r.date_type,a,t.params.date_type,n]);const s=ji[t.params.date_type];return s?(0,y.jsx)(s,{item:r,onChange:a,filterIndex:n}):null}},Ti=[{value:Qs.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD,label:p.Z.I18n.t("mailpoetCustomField"),group:Qs.SegmentTypes.WordPressRole},{value:Qs.SubscriberActionTypes.SUBSCRIBER_SCORE,label:p.Z.I18n.t("subscriberScore"),group:Qs.SegmentTypes.WordPressRole},{value:Qs.SubscriberActionTypes.SUBSCRIBED_DATE,label:p.Z.I18n.t("subscribedDate"),group:Qs.SegmentTypes.WordPressRole},{value:Qs.SubscriberActionTypes.SUBSCRIBED_TO_LIST,label:p.Z.I18n.t("subscribedToList"),group:Qs.SegmentTypes.WordPressRole},{value:Qs.SubscriberActionTypes.WORDPRESS_ROLE,label:p.Z.I18n.t("segmentsSubscriber"),group:Qs.SegmentTypes.WordPressRole}],ki={[Qs.SubscriberActionTypes.WORDPRESS_ROLE]:oi,[Qs.SubscriberActionTypes.SUBSCRIBER_SCORE]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");return(0,j.useEffect)((()=>{ci.includes(n.operator)||r({operator:li.HIGHER_THAN},t),n.operator!==li.HIGHER_THAN&&n.operator!==li.LOWER_THAN&&n.operator!==li.EQUALS&&n.operator!==li.NOT_EQUALS||void 0!==n.value||r({value:""},t),n.operator!==li.UNKNOWN&&n.operator!==li.NOT_UNKNOWN||r({value:null},t)}),[r,n,t]),(0,y.jsx)(_t.r.CenteredRow,{children:(s=e=>"{condition}"===e?(0,y.jsxs)(de.Z,{value:n.operator,automationId:"segment-subscriber-score-operator",onChange:e=>{a("operator",t,e)},children:[(0,y.jsx)("option",{value:li.HIGHER_THAN,children:p.Z.I18n.t("higherThan")}),(0,y.jsx)("option",{value:li.LOWER_THAN,children:p.Z.I18n.t("lowerThan")}),(0,y.jsx)("option",{value:li.EQUALS,children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:li.NOT_EQUALS,children:p.Z.I18n.t("notEquals")}),(0,y.jsx)("option",{value:li.UNKNOWN,children:p.Z.I18n.t("unknown")}),(0,y.jsx)("option",{value:li.NOT_UNKNOWN,children:p.Z.I18n.t("notUnknown")})]},"select"):"{score}"===e?(n.operator===li.HIGHER_THAN||n.operator===li.LOWER_THAN||n.operator===li.EQUALS||n.operator===li.NOT_EQUALS)&&(0,y.jsx)(ae.Z,{type:"number",value:n.value||"","data-automation-id":"segment-subscriber-score-value",onChange:e=>{a("value",t,e)},min:"0",placeholder:p.Z.I18n.t("subscriberScorePlaceholder")},"input"):"string"==typeof e&&e.trim().length>0?n.operator!==li.UNKNOWN&&n.operator!==li.NOT_UNKNOWN&&(0,y.jsx)("div",{children:e},"score"):null,p.Z.I18n.t("subscriberScoreSentence").split(/({condition})|({score})|(\b%\b)/gim).map(s))});var s},[Qs.SubscriberActionTypes.SUBSCRIBED_DATE]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form");return(0,j.useEffect)((()=>{mi.includes(n.operator)||r({operator:pi.BEFORE},t),n.operator!==pi.BEFORE&&n.operator!==pi.AFTER&&n.operator!==pi.ON&&n.operator!==pi.NOT_ON||void 0!==fi(n.value)&&/^\d+-\d+-\d+$/.test(n.value)||r({value:hi(new Date)},t),n.operator!==pi.IN_THE_LAST&&n.operator!==pi.NOT_IN_THE_LAST||"string"!=typeof n.value||/^\d*$/.exec(n.value)||r({value:""},t)}),[r,n,t]),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,y.jsx)("option",{value:pi.BEFORE,children:p.Z.I18n.t("before")}),(0,y.jsx)("option",{value:pi.AFTER,children:p.Z.I18n.t("after")}),(0,y.jsx)("option",{value:pi.ON,children:p.Z.I18n.t("on")}),(0,y.jsx)("option",{value:pi.NOT_ON,children:p.Z.I18n.t("notOn")}),(0,y.jsx)("option",{value:pi.IN_THE_LAST,children:p.Z.I18n.t("inTheLast")}),(0,y.jsx)("option",{value:pi.NOT_IN_THE_LAST,children:p.Z.I18n.t("notInTheLast")})]},"select"),(n.operator===pi.BEFORE||n.operator===pi.AFTER||n.operator===pi.ON||n.operator===pi.NOT_ON)&&(0,y.jsx)(It,{dateFormat:"MMM d, yyyy",onChange:e=>{r({value:hi(e)},t)},selected:n.value?fi(n.value):void 0}),(n.operator===pi.IN_THE_LAST||n.operator===pi.NOT_IN_THE_LAST)&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(ae.Z,{type:"number",value:n.value,onChange:e=>{a("value",t,e)},min:"1",placeholder:p.Z.I18n.t("daysPlaceholder")},"input"),(0,y.jsx)("span",{children:p.Z.I18n.t("daysPlaceholder")})]})]})},[Qs.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),a=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),s=(0,Pn.find)({id:Number(n.custom_field_id)},a),i=a.map((e=>({value:e.id.toString(),label:e.name}))),o=Ci[n.custom_field_type];return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{children:(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectCustomFieldPlaceholder"),options:i,automationId:"select-custom-field",value:(0,Pn.find)((e=>{if(n.custom_field_id)return n.custom_field_id===e.value}),i),onChange:e=>{const n=(0,Pn.find)({id:Number(e.value)},a);n&&r({custom_field_id:e.value,custom_field_type:n.type,operator:void 0,value:void 0},t)}})}),(0,y.jsx)("div",{children:o&&(0,y.jsx)(o,{customField:s,filterIndex:t})})]})},[Qs.SubscriberActionTypes.SUBSCRIBED_TO_LIST]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),r=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getStaticSegmentsList()),[]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:s}=(0,Bs.Z)("mailpoet-dynamic-segments-form");(0,j.useEffect)((()=>{n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.NONE&&a({operator:Qs.AnyValueTypes.ANY},t)}),[a,n,t]);const i=r.map((e=>({value:e.id,label:e.name})));return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{isFullWidth:!0,value:n.operator,onChange:e=>{s("operator",t,e)},children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:p.Z.I18n.t("searchLists"),options:i,value:(0,Pn.filter)((e=>{if(!n.segments)return;const t=e.value;return-1!==n.segments.indexOf(t)}),i),onChange:e=>{a({segments:(0,Pn.map)("value",e)},t)}})})]})}};var Ni;!function(e){e.MEMBER_OF="isMemberOf"}(Ni||(Ni={}));const Di=[{value:Ni.MEMBER_OF,label:p.Z.I18n.t("segmentsActiveMembership"),group:Qs.SegmentTypes.WooCommerceMembership}];var Ei;!function(e){e.ACTIVE_SUBSCRIPTIONS="hasActiveSubscription"}(Ei||(Ei={}));const Oi=[{value:Ei.ACTIVE_SUBSCRIPTIONS,label:p.Z.I18n.t("segmentsActiveSubscription"),group:Qs.SegmentTypes.WooCommerceSubscription}],Ri={[Qs.SegmentTypes.Email]:function(e){return!!Object.values(Qs.EmailActionTypes).some((t=>t===e.action))&&(e.action===Qs.EmailActionTypes.CLICKED_ANY||(e.action===Qs.EmailActionTypes.CLICKED?!!e.newsletter_id:e.action!==Qs.EmailActionTypes.OPENS_ABSOLUTE_COUNT&&e.action!==Qs.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT?Array.isArray(e.newsletters)&&e.newsletters.length>0:!!e.days&&!!e.opens&&!!e.operator))},[Qs.SegmentTypes.WooCommerce]:function(e){if(!Object.values(ai).some((t=>t===e.action)))return!1;const t=void 0===e.category_ids||0===e.category_ids.length||!e.operator;if(e.action===ai.PURCHASED_CATEGORY&&t)return!1;const n=void 0===e.product_ids||0===e.product_ids.length||!e.operator;if(e.action===ai.PURCHASED_PRODUCT&&n)return!1;const r=void 0===e.country_code||0===e.country_code.length;if(e.action===ai.CUSTOMER_IN_COUNTRY&&r)return!1;const a=!e.number_of_orders_count||!e.number_of_orders_days||!e.number_of_orders_type;return!(e.action===ai.NUMBER_OF_ORDERS&&a||!(e.action!==ai.TOTAL_SPENT||e.total_spent_amount&&e.total_spent_days&&e.total_spent_type))},[Qs.SegmentTypes.WordPressRole]:function(e){return e.action&&e.action!==Qs.SubscriberActionTypes.WORDPRESS_ROLE?e.action===Qs.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD?function(e){const t=Si[e.custom_field_type];return!!t&&t(e)}(e):e.action===Qs.SubscriberActionTypes.SUBSCRIBER_SCORE?function(e){if(e.operator===li.HIGHER_THAN||e.operator===li.LOWER_THAN||e.operator===li.EQUALS||e.operator===li.NOT_EQUALS){const t=Number(e.value),n=Number(parseFloat(e.value));return!Number.isNaN(t)&&!Number.isNaN(n)&&t>=0&&t<=100}return e.operator===li.UNKNOWN||e.operator===li.NOT_UNKNOWN}(e):e.action===Qs.SubscriberActionTypes.SUBSCRIBED_TO_LIST?function(e){return(e.operator===Qs.AnyValueTypes.ANY||e.operator===Qs.AnyValueTypes.ALL||e.operator===Qs.AnyValueTypes.NONE)&&Array.isArray(e.segments)&&e.segments.length>0}(e):!(!e.operator||!e.value)&&(e.operator===pi.BEFORE||e.operator===pi.AFTER||e.operator===pi.ON||e.operator===pi.NOT_ON?/^\d+-\d+-\d+$/.test(e.value):(e.operator===pi.IN_THE_LAST||e.operator===pi.NOT_IN_THE_LAST)&&(/^\d+$/.test(e.value)&&Number(e.value)>0)):Array.isArray(e.wordpressRole)&&e.wordpressRole.length>0},[Qs.SegmentTypes.WooCommerceMembership]:function(e){const t=!e.plan_ids||!e.plan_ids.length||!e.operator;return e.action!==Ni.MEMBER_OF||!t},[Qs.SegmentTypes.WooCommerceSubscription]:function(e){const t=!e.product_ids||!e.product_ids.length||!e.operator;return e.action!==Ei.ACTIVE_SUBSCRIPTIONS||!t}};function Ai(e){return!(e.length<1)&&0===e.map((e=>void 0!==Ri[e.segmentType]&&Ri[e.segmentType](e))).filter((e=>!1===e)).length}let Pi,Mi;function Li(){const e=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),{updateSubscriberCount:n}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),r=JSON.stringify(e),a=(0,j.useRef)(1),s=(0,j.useRef)(null),i=(0,j.useRef)(!1),o=(0,j.useRef)((0,Ks.debounce)((function e(t){if(i.current)return void(s.current=t);s.current=null,a.current+=1;const r=a.current;i.current=!0,function(e){const t={filters:e.filters,filters_connect:e.filters_connect};return Gs().isEqual(t,Pi)?Promise.resolve(Mi):(Pi={filters:[...e.filters],filters_connect:e.filters_connect},p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"dynamic_segments",action:"getCount",data:e,timeout:2e4}).then((e=>{const{data:t}=e;return Mi={count:t.count,errors:void 0},Mi})))}(t).then((t=>{if(i.current=!1,s.current)return void e(s.current);if(r!==a.current)return;const o={loading:!1};t&&(o.count=t.count,o.errors=t.errors),n(o)}),(e=>{i.current=!1;const t={},r=e.errors.map((e=>e.message));t.loading=!1,t.count=void 0,t.errors=r,n(t)}))}),2e3,{trailing:!0}));return(0,j.useEffect)((()=>{Ai(e.filters)?(n({loading:!0,count:void 0,errors:void 0}),(0,o.current)(e)):n({count:void 0,loading:!1})}),[e,r,n]),t.errors?(0,y.jsx)("div",{className:"mailpoet-form-field",children:(0,y.jsxs)("span",{className:"mailpoet-form-error-message",children:[p.Z.I18n.t("dynamicSegmentSizeCalculatingTimeout")," ",(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/237-guide-to-subscriber-segmentation?utm_source=plugin&utm_medium=segments","data-beacon-article":"5a574bd92c7d3a194368233e",target:"_blank",className:"mailpoet-form-error-message",rel:"noopener noreferrer",children:p.Z.I18n.t("learnMore")})]})}):t.loading||void 0!==t.count?t.loading?(0,y.jsx)("div",{className:"mailpoet-form-field",children:(0,y.jsx)("span",{className:"mailpoet-form-notice-message",children:p.Z.I18n.t("dynamicSegmentSizeIsCalculated")})}):(0,y.jsx)("div",{className:"mailpoet-form-field",children:(0,y.jsx)("span",{className:"mailpoet-form-notice-message",children:p.Z.I18n.t("dynamicSegmentSize").replace("%1$d",t.count.toLocaleString())})}):(0,y.jsx)("span",{})}const Fi={[Qs.SegmentTypes.Email]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),r=ri[n.action];return r?(0,y.jsx)(r,{filterIndex:t}):null},[Qs.SegmentTypes.WooCommerce]:e=>{let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getProductCategories()),[]),i=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCountries()),[]),o=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getProducts()),[]),l=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCurrencySymbol()),[]),c=o.map((e=>({value:e.id,label:e.name}))),d=s.map((e=>({value:e.id,label:e.name}))),u=i.map((e=>({value:e.code,label:e.name})));let m;return(0,j.useEffect)((()=>{void 0===n.number_of_orders_type&&n.action===ai.NUMBER_OF_ORDERS&&r({number_of_orders_type:"="},t),void 0===n.total_spent_type&&n.action===ai.TOTAL_SPENT&&r({total_spent_type:">"},t),ii.includes(n.action)&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t),n.action===ai.CUSTOMER_IN_COUNTRY&&n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t)}),[r,n,t]),n.action===ai.PURCHASED_PRODUCT?m=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>r({operator:e.target.value},t),automationId:"select-operator",children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select-operator")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectWooPurchasedProduct"),options:c,value:(0,Pn.filter)((e=>{if(void 0!==n.product_ids&&0!==n.product_ids.length)return-1!==n.product_ids.indexOf(e.value)}),c),onChange:e=>r({product_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-products"},"select-segment-products")})]}):n.action===ai.PURCHASED_CATEGORY?m=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>r({operator:e.target.value},t),automationId:"select-operator",children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select-operator")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectWooPurchasedCategory"),options:d,value:(0,Pn.filter)((e=>{if(void 0!==n.category_ids&&0!==n.category_ids.length)return-1!==n.category_ids.indexOf(e.value)}),d),onChange:e=>r({category_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-category"},"select-segment-category")})]}):n.action===ai.NUMBER_OF_ORDERS?m=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{value:n.number_of_orders_type,onChange:e=>{a("number_of_orders_type",t,e)},automationId:"select-number-of-orders-type",children:[(0,y.jsx)("option",{value:"=",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"!=",children:p.Z.I18n.t("notEquals")}),(0,y.jsx)("option",{value:">",children:p.Z.I18n.t("moreThan")}),(0,y.jsx)("option",{value:"<",children:p.Z.I18n.t("lessThan")})]},"select"),(0,y.jsx)(ae.Z,{"data-automation-id":"input-number-of-orders-count",type:"number",min:0,value:n.number_of_orders_count||"",placeholder:p.Z.I18n.t("wooNumberOfOrdersCount"),onChange:e=>{a("number_of_orders_count",t,e)}}),(0,y.jsx)("div",{children:p.Z.I18n.t("wooNumberOfOrdersOrders")})]}),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsx)("div",{children:p.Z.I18n.t("inTheLast")}),(0,y.jsx)(ae.Z,{"data-automation-id":"input-number-of-orders-days",type:"number",min:1,value:n.number_of_orders_days||"",placeholder:p.Z.I18n.t("daysPlaceholder"),onChange:e=>{a("number_of_orders_days",t,e)}}),(0,y.jsx)("div",{children:p.Z.I18n.t("days")})]})]}):n.action===ai.TOTAL_SPENT?m=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsxs)(de.Z,{value:n.total_spent_type,onChange:e=>{a("total_spent_type",t,e)},automationId:"select-total-spent-type",children:[(0,y.jsx)("option",{value:"=",children:p.Z.I18n.t("equals")}),(0,y.jsx)("option",{value:"!=",children:p.Z.I18n.t("notEquals")}),(0,y.jsx)("option",{value:">",children:p.Z.I18n.t("moreThan")}),(0,y.jsx)("option",{value:"<",children:p.Z.I18n.t("lessThan")})]},"select"),(0,y.jsx)(ae.Z,{"data-automation-id":"input-total-spent-amount",type:"number",min:0,step:.01,value:n.total_spent_amount||"",placeholder:p.Z.I18n.t("wooTotalSpentAmount"),onChange:e=>{a("total_spent_amount",t,e)}}),(0,y.jsx)("div",{children:l})]}),(0,y.jsxs)(_t.r.CenteredRow,{children:[(0,y.jsx)("div",{children:p.Z.I18n.t("inTheLast")}),(0,y.jsx)(ae.Z,{"data-automation-id":"input-total-spent-days",type:"number",min:1,value:n.total_spent_days||"",placeholder:p.Z.I18n.t("daysPlaceholder"),onChange:e=>{a("total_spent_days",t,e)}}),(0,y.jsx)("div",{children:p.Z.I18n.t("days")})]})]}):n.action===ai.CUSTOMER_IN_COUNTRY&&(m=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>r({operator:e.target.value},t),automationId:"select-operator-country",children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select-operator-country")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:p.Z.I18n.t("selectWooCountry"),options:u,value:(0,Pn.filter)((e=>{if(n.country_code)return-1!==n.country_code.indexOf(e.value)}),u),onChange:e=>r({country_code:(e||[]).map((e=>e.value))},t),automationId:"select-segment-country"},"select-segment-country")})]})),m},[Qs.SegmentTypes.WordPressRole]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);let r;return r=n.action?ki[n.action]:oi,r?(0,y.jsx)(r,{filterIndex:t}):null},[Qs.SegmentTypes.WooCommerceMembership]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getMembershipPlans()),[]).map((e=>({value:e.id,label:e.name})));return(0,j.useEffect)((()=>{n.action===Ni.MEMBER_OF&&n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t)}),[r,n,t]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select-operator")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectWooMembership"),options:s,value:(0,Pn.filter)((e=>!!n.plan_ids&&-1!==n.plan_ids.indexOf(e.value)),s),onChange:e=>r({plan_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-plans"},"select-segment-membership-plan")})]})},[Qs.SegmentTypes.WooCommerceSubscription]:function(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriptionProducts()),[]).map((e=>({value:e.id,label:e.name})));return(0,j.useEffect)((()=>{n.action===Ei.ACTIVE_SUBSCRIPTIONS&&n.operator!==Qs.AnyValueTypes.ANY&&n.operator!==Qs.AnyValueTypes.ALL&&n.operator!==Qs.AnyValueTypes.NONE&&r({operator:Qs.AnyValueTypes.ANY},t)}),[r,n,t]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsxs)(de.Z,{value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,y.jsx)("option",{value:Qs.AnyValueTypes.ANY,children:p.Z.I18n.t("anyOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.ALL,children:p.Z.I18n.t("allOf")}),(0,y.jsx)("option",{value:Qs.AnyValueTypes.NONE,children:p.Z.I18n.t("noneOf")})]},"select-operator")}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:p.Z.I18n.t("selectWooSubscription"),options:s,value:(0,Pn.filter)((e=>!!n.product_ids&&-1!==n.product_ids.indexOf(e.value)),s),onChange:e=>r({product_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-products"},"select-segment-category")})]})}};function qi(e){let{filterIndex:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);if(void 0===n||void 0===Fi[n.segmentType])return null;const r=Fi[n.segmentType];return(0,y.jsx)(r,{filterIndex:t})}function $i(){const e=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=[Qs.EmailActionTypes.OPENED,Qs.EmailActionTypes.OPENS_ABSOLUTE_COUNT,Qs.EmailActionTypes.MACHINE_OPENED,Qs.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT];let n=!1;return e.filters.forEach((e=>{t.includes(e.action)&&(n=!0)})),n?(0,y.jsx)("div",{className:"mailpoet-form-field",children:(0,y.jsx)("span",{className:"mailpoet-form-notice-message",children:p.Z.I18n.t("privacyProtectionNotice")})}):(0,y.jsx)("span",{})}const{subscribersLimitReached:Ui,subscribersLimit:Vi,subscribersCount:Wi,premiumActive:Yi,hasValidApiKey:Bi,hasValidPremiumKey:Hi,isPremiumPluginInstalled:zi,premiumPluginDownloadUrl:Ki,premiumPluginActivationUrl:Gi,pluginPartialKey:Qi}=p.Z,Xi=Bi||Hi,Ji=e=>{const t=p.Z.I18n.t(e);return(0,y.jsx)("p",{children:k()(t,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?Wi:Vi))})},eo=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_blank";return(0,y.jsx)(v.Z,{href:t,target:n,rel:"noopener noreferrer",children:p.Z.I18n.t(e)})};var to=function(e){let t,n,{message:r,actionButton:a}=e;if(Xi&&!Yi)t=Ji("premiumFeatureDescription"),n=zi?eo("premiumFeatureButtonActivatePremium",Gi,"_self"):eo("premiumFeatureButtonDownloadPremium",Ki);else if(Ui){t=Ji("premiumFeatureDescriptionSubscribersLimitReached");const e=Xi?p.Z.MailPoetComUrlFactory.getUpgradeUrl(Qi):p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(+Wi+1);n=eo("premiumFeatureButtonUpgradePlan",e)}else t=r,n=a;return(0,y.jsx)(Be.Z,{title:p.Z.I18n.t("premiumFeature"),message:t,actionButton:n})},no=function(){return(0,y.jsx)(to,{message:(()=>{const e=p.Z.I18n.t("premiumFeatureMultipleConditions");return(0,y.jsx)("p",{children:k()(e,/\[link](.*?)\[\/link]/g,(e=>(0,y.jsx)("a",{href:p.Z.premiumLink,target:"_blank",rel:"noopener noreferrer",children:e},e)))})})(),actionButton:(0,y.jsx)(v.Z,{href:p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount,p.Z.currentWpUserEmail,null,{utm_medium:"segments",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("premiumBannerCtaFree")})})};const ro=Ye().applyFilters("mailpoet_dynamic_segments_form_filters_before",(()=>null)),ao=Ye().applyFilters("mailpoet_dynamic_filters_filter_before",(()=>null)),so=Ye().applyFilters("mailpoet_dynamic_filters_filter_after",(()=>(0,y.jsx)("div",{className:"mailpoet-gap"})));function io(e){let{segmentId:t}=e;const n=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),r=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getAvailableFilters()),[]),a=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").findFiltersValueForSegment(n)),[n]),s=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),i=(0,Hs.Z)((e=>e("mailpoet-dynamic-segments-form").getErrors()),[]),{updateSegment:o,updateSegmentFilter:l,handleSave:c}=(0,Bs.Z)("mailpoet-dynamic-segments-form"),[d,u]=(0,j.useState)(!1),m=Ye().applyFilters("mailpoet_dynamic_segments_form_add_condition_action",(()=>{u(!0)}));return(0,y.jsxs)("form",{className:"mailpoet_form",children:[i.length>0&&(0,y.jsx)(it,{errors:i.map((e=>({message:e})))}),(0,y.jsxs)("div",{className:"mailpoet-form-grid",children:[(0,y.jsxs)("div",{className:"mailpoet-form-field-name form-field-row-name mailpoet-segments-name-section",children:[(0,y.jsx)(je.Z,{level:4,children:(0,y.jsx)("label",{htmlFor:"field_name",children:p.Z.I18n.t("name")})}),(0,y.jsx)("div",{className:"mailpoet-form-field",children:(0,y.jsx)(ae.Z,{isFullWidth:!0,type:"text",name:"name",id:"field_name",defaultValue:n.name,onChange:e=>o({name:e.target.value})})})]}),(0,y.jsxs)("div",{className:"mailpoet-form-field-description form-field-row-description mailpoet-segments-description-section",children:[(0,y.jsx)(je.Z,{level:4,children:(0,y.jsx)("label",{htmlFor:"field_description",children:p.Z.I18n.t("description")})}),(0,y.jsx)("p",{className:"mailpoet-form-description",children:p.Z.I18n.t("segmentDescriptionTip")}),(0,y.jsx)("div",{className:"mailpoet-form-field",children:(0,y.jsx)(oe.Z,{isFullWidth:!0,name:"description",id:"field_description",value:n.description,onChange:e=>o({description:e.target.value})})})]}),(0,y.jsxs)("div",{className:"mailpoet-segments-segments-section",children:[(0,y.jsx)(je.Z,{level:4,children:(0,y.jsx)("label",{htmlFor:"field_filters",children:p.Z.I18n.t("formPageTitle")})}),(0,y.jsx)(ro,{}),Array.isArray(a)&&a.map(((e,t)=>(0,y.jsxs)(j.Fragment,{children:[(0,y.jsxs)(_t.r.ThreeColumns,{className:"mailpoet-segments-grid",automationId:`filter-row-${t}`,children:[(0,y.jsx)(ao,{filterRows:a,index:t}),(0,y.jsx)(_t.r.CenteredRow,{children:(0,y.jsx)(zs.Z,{dimension:"small",placeholder:p.Z.I18n.t("selectActionPlaceholder"),options:r,value:e.filterValue,onChange:e=>{l({segmentType:e.group,action:e.value},t)},automationId:"select-segment-action",isFullWidth:!0})}),void 0!==e.index&&(0,y.jsx)(qi,{filterIndex:e.index})]}),(0,y.jsx)(so,{index:t})]},e.index))),(0,y.jsx)(v.Z,{type:"button",variant:"tertiary",iconStart:q,onClick:e=>{e.preventDefault(),m(n,o)},children:p.Z.I18n.t("addCondition")})]}),d&&(0,y.jsx)("div",{className:"mailpoet-grid-span-two-columns",children:(0,y.jsx)(no,{})}),(0,y.jsxs)("div",{className:"mailpoet-segments-counter-section",children:[(0,y.jsx)(Li,{}),(0,y.jsx)($i,{})]}),(0,y.jsx)("div",{className:"mailpoet-form-actions",children:(0,y.jsx)(v.Z,{type:"submit",onClick:e=>{e.preventDefault(),c(t)},isDisabled:!Ai(n.filters)||void 0===s.count,children:p.Z.I18n.t("save")})})]})]})}var oo=n(61299);const lo=e=>e.products,co=e=>e.membershipPlans,uo=e=>e.subscriptionProducts,po=e=>e.wordpressRoles,mo=e=>e.productCategories,ho=e=>e.newslettersList,fo=e=>e.canUseWooSubscriptions,go=e=>e.wooCurrencySymbol,vo=e=>e.wooCountries,bo=e=>e.customFieldsList,yo=e=>e.segment,wo=e=>e.staticSegmentsList,xo=e=>e.subscriberCount,_o=(e,t)=>{let n;return Array.isArray(e.segment.filters)?(n={...e.segment.filters[t]},n):n},Zo=e=>e.errors,jo=e=>e.allAvailableFilters,Io=(e,t)=>{const n=[];return t.filters.forEach(((t,r)=>{e.allAvailableFilters.forEach((e=>{e.options.forEach((e=>{e.group===t.segmentType&&e.value===t.action&&n.push({filterValue:e,index:r})}))}))})),n};function So(e,t){return{...e,segment:t.segment}}function Co(e,t){return{...e,errors:t.errors}}function To(e,t){const n=e.segment;return{...e,segment:(0,Pn.assign)(n,t.segment)}}function ko(e,t){const n={...e.segment};return n.filters[t.filterIndex]=(0,Pn.assign)(n.filters[t.filterIndex],t.filter),{...e,segment:n}}function No(e,t){const n=e.subscriberCount;return{...e,subscriberCount:(0,Pn.assign)(n,t.subscriberCount)}}const Do=e=>function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case Qs.Actions.SET_SEGMENT:return So(t,n);case Qs.Actions.SET_ERRORS:return Co(t,n);case Qs.Actions.UPDATE_SEGMENT:return To(t,n);case Qs.Actions.UPDATE_SEGMENT_FILTER:return ko(t,n);case Qs.Actions.UPDATE_SUBSCRIBER_COUNT:return No(t,n);default:return t}};function Eo(e){return{type:Qs.Actions.SET_SEGMENT,segment:e}}function Oo(e){return{type:Qs.Actions.SET_ERRORS,errors:e}}function Ro(e){return{type:Qs.Actions.UPDATE_SEGMENT,segment:e}}function Ao(e,t){return{type:Qs.Actions.UPDATE_SEGMENT_FILTER,filter:e,filterIndex:t}}function Po(e,t){return{type:Qs.Actions.UPDATE_SEGMENT,segment:{[e]:t.target.value}}}function Mo(e,t,n){return{type:Qs.Actions.UPDATE_SEGMENT_FILTER,filter:{[e]:n.target.value},filterIndex:t}}function Lo(e){return{type:Qs.Actions.UPDATE_SUBSCRIBER_COUNT,subscriberCount:e}}function*Fo(e){if(void 0===e)return;p.Z.Modal.loading(!0);const{res:t,success:n}=yield{type:"LOAD_SEGMENT",segmentId:e};n&&!t.is_plugin_missing||(window.location.href="admin.php?page=mailpoet-segments#/segments"),yield Eo(t),p.Z.Modal.loading(!1)}function*qo(e){const t=(0,oo.Ys)("mailpoet-dynamic-segments-form").getSegment();yield Oo([]);const{error:n,success:r}=yield{type:"SAVE_SEGMENT",segment:t};var a;r?(window.location.href="admin.php?page=mailpoet-segments#/segments",void 0!==e?p.Z.Notice.success(p.Z.I18n.t("dynamicSegmentUpdated")):(a=t,p.Z.Notice.success(p.Z.I18n.t("dynamicSegmentAdded")),p.Z.trackEvent("Segments > Add new",{type:a.segmentType||"unknown type",subtype:a.action||a.wordpressRole||"unknown subtype"}))):yield Oo(n)}function $o(e){let t=JSON.parse(JSON.stringify(e));return(0,Pn.has)("link_id",e)&&(t=(0,Pn.assign)(t,{link_id:e.link_id.toString()})),(0,Pn.has)("newsletter_id",e)&&(t=(0,Pn.assign)(t,{newsletter_id:e.newsletter_id.toString()})),(0,Pn.has)("product_id",e)&&(t=(0,Pn.assign)(t,{product_id:e.product_id.toString()})),(0,Pn.has)("category_id",e)&&(t=(0,Pn.assign)(t,{category_id:e.category_id.toString()})),t}async function Uo(e){let{segmentId:t}=e;try{return{success:!0,res:$o((await p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"dynamic_segments",action:"get",data:{id:t}})).data)}}catch(e){return{success:!1,error:(0,ot.q)(e)?e.errors.map((e=>e.message)):null,res:e}}}async function Vo(e){let{segment:t}=e;try{return await p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"dynamic_segments",action:"save",data:t}),{success:!0}}catch(e){return{success:!1,error:(0,ot.q)(e)?e.errors.map((e=>e.message)):null}}}function Wo(e,t){const n=[{label:p.Z.I18n.t("email"),options:ni},{label:p.Z.I18n.t("wpUserRole"),options:Ti}];return p.Z.isWoocommerceActive&&n.push({label:p.Z.I18n.t("woocommerce"),options:si}),p.Z.isWoocommerceActive&&t&&n.push({label:p.Z.I18n.t("woocommerceMemberships"),options:Di}),p.Z.isWoocommerceActive&&e&&n.push({label:p.Z.I18n.t("woocommerceSubscriptions"),options:Oi}),n}var Yo=function(){const e=(0,c.useRouteMatch)();(()=>{const e={products:window.mailpoet_products,staticSegmentsList:window.mailpoet_static_segments_list,membershipPlans:window.mailpoet_membership_plans,subscriptionProducts:window.mailpoet_subscription_products,productCategories:window.mailpoet_product_categories,newslettersList:window.mailpoet_newsletters_list,wordpressRoles:window.wordpress_editable_roles_list,canUseWooMemberships:window.mailpoet_can_use_woocommerce_memberships,canUseWooSubscriptions:window.mailpoet_can_use_woocommerce_subscriptions,wooCurrencySymbol:window.mailpoet_woocommerce_currency_symbol,wooCountries:window.mailpoet_woocommerce_countries,customFieldsList:window.mailpoet_custom_fields,segment:{filters_connect:Qs.SegmentConnectTypes.AND,filters:[{segmentType:Qs.SegmentTypes.WordPressRole,action:Qs.SubscriberActionTypes.WORDPRESS_ROLE}]},subscriberCount:{loading:!1},errors:[],allAvailableFilters:Wo(window.mailpoet_can_use_woocommerce_subscriptions,window.mailpoet_can_use_woocommerce_memberships)},t={selectors:r,actions:a,controls:s,reducer:Do(e),resolvers:{}};(0,oo.R9)("mailpoet-dynamic-segments-form",t)})();const{pageLoaded:t}=(0,Bs.Z)("mailpoet-dynamic-segments-form");return(0,j.useEffect)((()=>{t(e.params.id)}),[e.params.id,t]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Ne.Z,{color:"#fff"}),(0,y.jsx)(De.Z,{}),(0,y.jsxs)(je.Z,{level:1,className:"mailpoet-title",children:[(0,y.jsx)("span",{children:p.Z.I18n.t("formPageTitle")}),(0,y.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:"/segments",children:p.Z.I18n.t("backToList")})]}),(0,y.jsx)(io,{segmentId:Number(e.params.id)})]})};const Bo=[{name:"name",label:p.Z.I18n.t("nameColumn"),sortable:!0},{name:"description",label:p.Z.I18n.t("description"),sortable:!1},{name:"count",label:p.Z.I18n.t("subscribersCountColumn"),sortable:!1},{name:"subscribed",label:p.Z.I18n.t("subscribed"),sortable:!1},{name:"updated_at",label:p.Z.I18n.t("updatedAtColumn"),sortable:!0}],Ho={onLoadingItems:()=>p.Z.I18n.t("loadingDynamicSegmentItems"),onNoItemsFound:()=>p.Z.I18n.t("noDynamicSegmentItemsFound"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneDynamicSegmentTrashed"):p.Z.I18n.t("multipleDynamicSegmentsTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneDynamicSegmentDeleted"):p.Z.I18n.t("multipleDynamicSegmentsDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneDynamicSegmentRestored"):p.Z.I18n.t("multipleDynamicSegmentsRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)}},zo=[{name:"edit",className:"mailpoet-hide-on-mobile",link:e=>(0,y.jsx)(l.rU,{to:`/edit-segment/${e.id}`,children:p.Z.I18n.t("edit")}),display:e=>!e.is_plugin_missing},{name:"edit_disabled",className:"mailpoet-hide-on-mobile mailpoet-disabled",link:e=>(0,y.jsx)(l.rU,{to:`/edit-segment/${e.id}`,children:p.Z.I18n.t("edit")}),display:e=>e.is_plugin_missing},{name:"view_subscribers",link:e=>(0,y.jsx)("a",{href:e.subscribers_url,children:p.Z.I18n.t("viewSubscribers")})},{name:"trash",className:"mailpoet-hide-on-mobile"}],Ko=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:Ho.onTrash}];function Go(e,t){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("td",{className:"column-primary","data-colname":p.Z.I18n.t("nameColumn"),children:[(0,y.jsx)("span",{className:"mailpoet-listing-title",children:e.name}),t]}),(0,y.jsx)("td",{"data-colname":p.Z.I18n.t("description"),children:(0,y.jsx)("abbr",{children:e.description})}),e.is_plugin_missing?(0,y.jsx)("td",{colSpan:"2",className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("missingPluginMessageColumn"),children:e.missing_plugin_message&&e.missing_plugin_message.message&&e.missing_plugin_message.link?k()(e.missing_plugin_message.message,/\[link](.*?)\[\/link]/g,(t=>(0,y.jsx)("a",{className:"mailpoet-listing-link-important",href:e.missing_plugin_message.link,target:"_blank",rel:"noopener noreferrer",children:t},"missingPluginMessageLink"))):e.missing_plugin_message}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("subscribersCountColumn"),children:parseInt(e.count_all,10).toLocaleString()}),(0,y.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("subscribed"),children:parseInt(e.count_subscribed,10).toLocaleString()})]}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("updatedAtColumn"),children:[p.Z.Date.short(e.created_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.created_at)]})]})}function Qo(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,location:e.location,params:e.match.params,search:!0,onRenderItem:Go,endpoint:"dynamic_segments",base_url:"segments",columns:Bo,messages:Ho,sort_by:"created_at",sort_order:"desc",item_actions:zo,bulk_actions:Ko}),(0,y.jsxs)("p",{className:"mailpoet_sending_methods_help help",children:[(0,y.jsxs)("b",{children:[p.Z.I18n.t("segmentsTip"),":"]})," ",p.Z.I18n.t("segmentsTipText")," ",(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/237-guide-to-subscriber-segmentation?utm_source=plugin&utm_medium=segments&utm_campaign=helpdocs","data-beacon-article":"5a574bd92c7d3a194368233e",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("segmentsTipLink")})]})]})}Qo.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var Xo=(0,c.withRouter)(Qo),Jo=function(){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(F.Q,{children:[(0,y.jsxs)(l.rU,{className:"mailpoet-button button-secondary",to:"/new",children:[q,(0,y.jsx)("span",{children:p.Z.I18n.t("new")})]}),(0,y.jsxs)(l.rU,{className:"mailpoet-button button-secondary",to:"/new-segment","data-automation-id":"new-segment",children:[q,(0,y.jsx)("span",{children:p.Z.I18n.t("newSegment")})]})]}),(0,y.jsx)(L,{subscribersInPlan:p.Z.subscribersCount,subscribersInPlanLimit:p.Z.subscribersLimit}),(0,y.jsx)(A,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,y.jsx)(D,{}),(0,y.jsx)(R,{}),(0,y.jsx)(E,{mssKeyInvalid:p.Z.hasInvalidMssApiKey,subscribersCount:p.Z.subscribersCount})]})};const el=document.getElementById("segments_container");function tl(){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Jo,{}),(0,y.jsxs)(ms.Z,{activeKey:"lists",routerType:"switch-only",children:[(0,y.jsx)(is.Z,{route:"lists/(.*)?",title:p.Z.I18n.t("pageTitle"),children:(0,y.jsx)($s,{})},"lists"),(0,y.jsx)(is.Z,{route:"segments/(.*)?",title:p.Z.I18n.t("pageTitleSegments"),automationId:"dynamic-segments-tab",children:(0,y.jsx)(Xo,{})},"segments")]})]})}function nl(){return(0,y.jsx)(Fe.k.Provider,{value:(0,Fe.S)(window),children:(0,y.jsxs)(l.UT,{children:[(0,y.jsx)(Ge.Z,{}),(0,y.jsxs)(c.Switch,{children:[(0,y.jsx)(c.Route,{exact:!0,path:"/",render:()=>(0,y.jsx)(c.Redirect,{to:"/lists"})}),(0,y.jsx)(c.Route,{path:"/new",component:Ys}),(0,y.jsx)(c.Route,{path:"/edit/:id",component:Ys}),(0,y.jsx)(c.Route,{path:"/new-segment",component:Yo}),(0,y.jsx)(c.Route,{path:"/edit-segment/:id",component:Yo}),(0,y.jsx)(c.Route,{path:"/segments/(.*)?",component:tl}),(0,y.jsx)(c.Route,{path:"/lists/(.*)?",component:tl})]})]})})}el&&o().render((0,y.jsx)(nl,{}),el);const rl=()=>{p.Z.trackEvent("Forms > Add New"),setTimeout((()=>{window.location=window.mailpoet_form_template_selection_url}),200)};function al(){const[e,t]=(0,j.useState)(!1);return(0,y.jsx)(F.Q,{children:(0,y.jsx)(v.Z,{onClick:()=>{t(!0),rl()},withSpinner:e,automationId:"create_new_form",variant:"secondary",iconStart:q,children:p.Z.I18n.t("new")})})}const sl=[{name:"name",label:p.Z.I18n.t("formName"),sortable:!0},{name:"segments",label:p.Z.I18n.t("segments")},{name:"type",label:p.Z.I18n.t("type")},{name:"status",label:p.Z.I18n.t("status")},{name:"updated_at",label:p.Z.I18n.t("updatedAt"),sortable:!0}],il={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneFormTrashed"):p.Z.I18n.t("multipleFormsTrashed").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneFormDeleted"):p.Z.I18n.t("multipleFormsDeleted").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?p.Z.I18n.t("oneFormRestored"):p.Z.I18n.t("multipleFormsRestored").replace("%1$d",t.toLocaleString()),p.Z.Notice.success(n)},onNoItemsFound:()=>(0,y.jsxs)("div",{className:"mailpoet-forms-add-new-row",children:[(0,y.jsx)("p",{children:p.Z.I18n.t("noItemsFound")}),(0,y.jsx)(Ce.Button,{onClick:rl,automationId:"add_new_form",iconStart:q,children:p.Z.I18n.t("new")})]})},ol=[{name:"trash",label:p.Z.I18n.t("moveToTrash"),onSuccess:il.onTrash}],ll=[{name:"edit",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("edit"),link:function(e){return(0,y.jsx)("a",{href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:p.Z.I18n.t("edit")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:p.Z.I18n.t("duplicate"),onClick:function(e,t){return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"duplicate",data:{id:e.id}}).done((e=>{const n=e.data.name?e.data.name:p.Z.I18n.t("noName");p.Z.Notice.success(p.Z.I18n.t("formDuplicated").replace("%1$s",n)),t()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class cl extends j.Component{constructor(){super(...arguments),(0,Z.Z)(this,"updateStatus",((e,t)=>{t.persist(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"enabled":"disabled"}}).done((e=>{"enabled"===e.data.status&&p.Z.Notice.success(p.Z.I18n.t("formActivated"))})).fail((n=>{p.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,Z.Z)(this,"isItemInactive",(e=>"disabled"===e.status)),(0,Z.Z)(this,"renderItem",((e,t)=>{const n=h()("manage-column","column-primary","has-row-actions"),r=window.mailpoet_segments.filter((t=>-1!==u().inArray(t.id,e.segments))),a=function(e){const t=[];return"1"===e?.form_placement?.fixed_bar?.enabled&&t.push(p.Z.I18n.t("placeFixedBarFormOnPages")),"1"===e?.form_placement?.below_posts?.enabled&&t.push(p.Z.I18n.t("placeFormBellowPages")),"1"===e?.form_placement?.popup?.enabled&&t.push(p.Z.I18n.t("placePopupFormOnPages")),"1"===e?.form_placement?.slide_in?.enabled&&t.push(p.Z.I18n.t("placeSlideInFormOnPages")),t.length>0?t.join(", "):p.Z.I18n.t("placeFormOthers")}(e.settings);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("td",{className:n,children:[(0,y.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:e.name?e.name:`(${p.Z.I18n.t("noName")})`}),t]}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("segments"),children:(0,y.jsx)(w,{segments:r,dimension:"large",children:"user"===e.settings.segments_selected_by&&(0,y.jsx)("span",{className:"mailpoet-tags-prefix",children:p.Z.I18n.t("userChoice")})})}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("type"),children:a}),(0,y.jsx)("td",{className:"column","data-colname":p.Z.I18n.t("status"),children:this.renderStatus(e)}),(0,y.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":p.Z.I18n.t("updatedAt"),children:[p.Z.Date.short(e.updated_at),(0,y.jsx)("br",{}),p.Z.Date.time(e.updated_at)]})]})}))}renderStatus(e){return(0,y.jsxs)("div",{children:[(0,y.jsx)(Vt,{onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"enabled"===e.status}),(0,y.jsxs)("p",{children:[p.Z.I18n.t("signups"),": ",e.signups.toLocaleString()]})]})}render(){return(0,y.jsxs)("div",{className:"mailpoet-listing-no-actions-on-mobile",children:[(0,y.jsx)(al,{}),(0,y.jsx)(x.Z,{limit:window.mailpoet_listing_per_page,className:"mailpoet-forms-listing",location:this.props.location,params:this.props.match.params,messages:il,search:!1,endpoint:"forms",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:sl,bulk_actions:ol,item_actions:ll})]})}}cl.propTypes={location:g().object.isRequired,match:g().shape({params:g().object}).isRequired};var dl=xs(cl);function ul(){return(0,y.jsx)(Fe.k.Provider,{value:(0,Fe.S)(window),children:(0,y.jsxs)(l.UT,{children:[(0,y.jsx)(Ge.Z,{}),(0,y.jsx)(c.Route,{path:"*",component:dl})]})})}const pl=document.getElementById("forms_container");pl&&o().render((0,y.jsx)(ul,{}),pl);var ml=function(){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("p",{children:p.Z.I18n.t("knowledgeBaseIntro")}),(0,y.jsxs)("ul",{className:"mailpoet-text-links",children:[(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/116-common-problems",children:"Common Problems"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/165-newsletters",children:"Newsletters"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/156-migration-questions",children:"Migration Questions"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/149-sending-methods",children:"Sending Methods"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/139-subscription-forms",children:"Subscription Forms"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/114-getting-started",children:"Getting Started"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/123-newsletter-designer",children:"Newsletter Designer"})}),(0,y.jsx)("li",{children:(0,y.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/121-subscribers-and-lists",children:"Subscribers and Lists"})})]}),(0,y.jsx)(v.Z,{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/",children:p.Z.I18n.t("knowledgeBaseButton")})]})};function hl(e){e.target.select()}function fl(e){if(I.ZP.isObject(e)){const t=Object.keys(e).map((t=>`${t}: ${e[t]}`));return(0,y.jsx)("textarea",{readOnly:!0,onFocus:hl,value:t.join("\n"),style:{width:"100%",height:"400px"}})}return(0,y.jsx)("p",{children:p.Z.I18n.t("systemInfoDataError")})}var gl=function(){const e=window.systemInfoData;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,y.jsx)("p",{children:p.Z.I18n.t("systemInfoIntro")})}),fl(e)]})};function vl(e){return(0,y.jsx)("table",{className:"widefat fixed",style:{maxWidth:e.max_width},children:(0,y.jsx)("tbody",{children:e.rows.map((e=>(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{className:"row-title",children:e.key}),(0,y.jsx)("td",{children:e.value})]},`row_${e.key}`)))})})}vl.propTypes={max_width:g().string,rows:g().arrayOf(g().shape({key:g().string.isRequired,value:g().oneOfType([g().string,g().number,g().element]).isRequired})).isRequired},vl.defaultProps={max_width:"auto"};var bl=vl;function yl(e){return(0,y.jsx)("span",{children:!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown})}yl.propTypes={truthy:g().string,falsy:g().string,unknown:g().string,children:g().bool},yl.defaultProps={truthy:p.Z.I18n.t("yes"),falsy:p.Z.I18n.t("no"),unknown:p.Z.I18n.t("unknown"),children:null};var wl=yl;function xl(e){const t=e.status_data,n={active:p.Z.I18n.t("running"),inactive:p.Z.I18n.t("cronWaiting")},r=Array.isArray(t.last_error)?(0,y.jsx)(y.Fragment,{children:t.last_error.map((e=>(0,y.jsxs)("div",{children:[e.worker,":"," ",(0,y.jsx)("i",{children:e.message})]},e.worker)))}):t.last_error;return(0,y.jsxs)("div",{children:[(0,y.jsx)("h4",{children:p.Z.I18n.t("systemStatusCronStatusTitle")}),(0,y.jsx)(bl,{max_width:"400px",rows:[{key:p.Z.I18n.t("accessible"),value:(0,y.jsx)(wl,{children:t.accessible})},{key:p.Z.I18n.t("status"),value:n[t.status]?n[t.status]:p.Z.I18n.t("unknown")},{key:p.Z.I18n.t("lastUpdated"),value:t.updated_at?p.Z.Date.full(1e3*t.updated_at):p.Z.I18n.t("unknown")},{key:p.Z.I18n.t("lastRunStarted"),value:t.run_accessed_at?p.Z.Date.full(1e3*t.run_started_at):p.Z.I18n.t("unknown")},{key:p.Z.I18n.t("lastRunCompleted"),value:t.run_completed_at?p.Z.Date.full(1e3*t.run_completed_at):p.Z.I18n.t("unknown")},{key:p.Z.I18n.t("lastSeenError"),value:r||p.Z.I18n.t("none")},{key:p.Z.I18n.t("lastSeenErrorDate"),value:t.last_error_date?p.Z.Date.full(1e3*t.last_error_date):p.Z.I18n.t("unknown")}]})]})}xl.propTypes={status_data:g().shape({accessible:g().bool,last_error_date:g().string,status:g().string,updated_at:g().number,run_accessed_at:g().number,run_completed_at:g().number,run_started_at:g().number,last_error:g().oneOfType([g().string,g().array])}).isRequired};var _l=xl;function Zl(e){let t=e.task.scheduled_at;t&&(t=(0,kr.default)(t,"yyyy-MM-dd HH:mm:ss",new Date));const n=(0,kr.default)(e.task.updated_at,"yyyy-MM-dd HH:mm:ss",new Date);return(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{className:"column column-primary",children:e.task.id}),(0,y.jsx)("td",{className:"column",children:e.task.type}),(0,y.jsx)("td",{className:"column",children:e.task.newsletter?(0,y.jsx)("a",{href:e.task.newsletter.preview_url,"data-newsletter-id":e.task.newsletter.newsletter_id,"data-queue-id":e.task.newsletter.queue_id,target:"_blank",rel:"noopener noreferrer",children:e.task.newsletter.subject||p.Z.I18n.t("preview")}):p.Z.I18n.t("none")}),(0,y.jsx)("td",{className:"column",children:e.task.priority}),e.show_scheduled_at?(0,y.jsx)("td",{className:"column-date",children:(0,y.jsx)("abbr",{children:`${p.Z.Date.short(t)} ${p.Z.Date.time(t)}`})}):null,(0,y.jsx)("td",{className:"column-date",children:(0,y.jsx)("abbr",{children:`${p.Z.Date.short(n)} ${p.Z.Date.time(n)}`})})]})}Zl.propTypes={show_scheduled_at:g().bool,task:g().shape({id:g().number.isRequired,type:g().string.isRequired,priority:g().number.isRequired,updated_at:g().string.isRequired,scheduled_at:g().string,status:g().string,newsletter:g().shape({newsletter_id:g().number.isRequired,queue_id:g().number.isRequired,preview_url:g().string.isRequired,subject:g().string})}).isRequired},Zl.defaultProps={show_scheduled_at:!1};var jl=Zl;function Il(e){return(0,y.jsxs)("tr",{children:[(0,y.jsx)("th",{className:"row-title",children:"Id"}),(0,y.jsx)("th",{className:"row-title",children:p.Z.I18n.t("type")}),(0,y.jsx)("th",{className:"row-title",children:p.Z.I18n.t("email")}),(0,y.jsx)("th",{className:"row-title",children:p.Z.I18n.t("priority")}),e.show_scheduled_at?(0,y.jsx)("th",{className:"row-title",children:p.Z.I18n.t("scheduledAt")}):null,(0,y.jsx)("th",{className:"row-title",children:p.Z.I18n.t("updatedAt")})]})}Il.propTypes={show_scheduled_at:g().bool},Il.defaultProps={show_scheduled_at:!1};var Sl=Il;function Cl(e){const t=e.show_scheduled_at?6:5;return(0,y.jsxs)("table",{className:"widefat fixed striped",children:[(0,y.jsx)("thead",{children:(0,y.jsx)(Sl,{show_scheduled_at:e.show_scheduled_at})}),(0,y.jsx)("tbody",{children:e.tasks.length?e.tasks.map((t=>(0,y.jsx)(jl,{task:t,show_scheduled_at:e.show_scheduled_at},t.id))):(0,y.jsx)("tr",{className:"mailpoet-listing-no-items",children:(0,y.jsx)("td",{colSpan:t,children:p.Z.I18n.t("nothingToShow")})})}),(0,y.jsx)("tfoot",{children:(0,y.jsx)(Sl,{show_scheduled_at:e.show_scheduled_at})})]})}Cl.propTypes={show_scheduled_at:g().bool,tasks:g().arrayOf(jl.propTypes.task).isRequired},Cl.defaultProps={show_scheduled_at:!1};var Tl=Cl;function kl(e){const t=e.status_data;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("h4",{children:p.Z.I18n.t("systemStatusQueueTitle")}),(0,y.jsx)(bl,{max_width:"400px",rows:[{key:p.Z.I18n.t("status"),value:"paused"===t.status?p.Z.I18n.t("paused"):p.Z.I18n.t("running")},{key:p.Z.I18n.t("startedAt"),value:t.started?p.Z.Date.full(1e3*t.started):p.Z.I18n.t("unknown")},{key:p.Z.I18n.t("sentEmails"),value:t.sent||0},{key:p.Z.I18n.t("retryAttempt"),value:t.retry_attempt||p.Z.I18n.t("none")},{key:p.Z.I18n.t("retryAt"),value:t.retry_at?p.Z.Date.full(1e3*t.retry_at):p.Z.I18n.t("none")},{key:p.Z.I18n.t("error"),value:t.error?t.error.error_message:p.Z.I18n.t("none")},{key:p.Z.I18n.t("totalCompletedTasks"),value:t.tasksStatusCounts.completed},{key:p.Z.I18n.t("totalRunningTasks"),value:t.tasksStatusCounts.running},{key:p.Z.I18n.t("totalPausedTasks"),value:t.tasksStatusCounts.paused},{key:p.Z.I18n.t("totalScheduledTasks"),value:t.tasksStatusCounts.scheduled}]}),(0,y.jsx)("h5",{children:p.Z.I18n.t("scheduledTasks")}),(0,y.jsx)(Tl,{show_scheduled_at:!0,tasks:t.latestTasks.filter((e=>"scheduled"===e.status))}),(0,y.jsx)("h5",{children:p.Z.I18n.t("runningTasks")}),(0,y.jsx)(Tl,{tasks:t.latestTasks.filter((e=>null===e.status))}),(0,y.jsx)("h5",{children:p.Z.I18n.t("completedTasks")}),(0,y.jsx)(Tl,{tasks:t.latestTasks.filter((e=>"completed"===e.status))})]})}kl.propTypes={status_data:g().shape({status:g().string,started:g().number,sent:g().number,retry_attempt:g().number,retry_at:g().number,error:g().shape({operation:g().string,error_message:g().string}),tasksStatusCounts:g().shape({completed:g().number.isRequired,running:g().number.isRequired,paused:g().number.isRequired,scheduled:g().number.isRequired}).isRequired,latestTasks:g().arrayOf(jl.propTypes.task).isRequired}).isRequired};var Nl=kl;function Dl(e,t,n,r,a,s){const i=e?"success":"error";let o=e?t:n;return r&&(o=k()(o,/\[link\](.*?)\[\/link\]/g,(e=>(0,y.jsx)("a",{className:"mailpoet-text-link",href:r,"data-beacon-article":a,children:e},"kb-link")))),(0,y.jsxs)("div",{className:`mailpoet_notice notice inline notice-${i}`,children:[(0,y.jsx)("p",{children:o}),s?(0,y.jsx)("p",{children:(0,y.jsx)("i",{children:s})}):null]})}function El(e){const t=e.cron.isReachable,n=e.cron.url,r=`${p.Z.I18n.t("systemStatusConnectionUnsuccessful")} ${p.Z.I18n.t("systemStatusCronConnectionUnsuccessfulInfo")}`,a=p.Z.I18n.t("systemStatusConnectionSuccessful"),s=t?null:e.cron.pingResponse;return(0,y.jsxs)("div",{children:[(0,y.jsx)("h4",{children:p.Z.I18n.t("systemStatusCronTitle")}),(0,y.jsx)("p",{children:(0,y.jsx)("a",{className:"mailpoet-text-link",href:n,target:"_blank",rel:"noopener noreferrer",children:n})}),Dl(t,a,r,"https://kb.mailpoet.com/article/231-sending-does-not-work","5a0257ac2c7d3a272c0d7ad6",s)]})}function Ol(e){const t=e.mss.enabled?`${p.Z.I18n.t("systemStatusConnectionUnsuccessful")} ${p.Z.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo")}`:p.Z.I18n.t("systemStatusMSSConnectionCanNotConnect"),n=e.mss.enabled?p.Z.I18n.t("systemStatusConnectionSuccessful"):p.Z.I18n.t("systemStatusMSSConnectionCanConnect");return(0,y.jsxs)("div",{children:[(0,y.jsx)("h4",{children:p.Z.I18n.t("systemStatusMSSTitle")}),Dl(e.mss.isReachable,n,t,"https://kb.mailpoet.com/article/319-known-errors-when-validating-a-mailpoet-key","5ef1da9d2c7d3a10cba966c5",null)]})}var Rl=function(){const e=window.systemStatusData;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,y.jsx)("p",{children:e.mss.enabled?p.Z.I18n.t("systemStatusIntroCronMSS"):p.Z.I18n.t("systemStatusIntroCron")})}),El(e),Ol(e),(0,y.jsx)(_l,{status_data:e.cronStatus}),(0,y.jsx)(Nl,{status_data:e.queueStatus})]})},Al=function(){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("p",{children:p.Z.I18n.t("yourPrivacyContent1")}),(0,y.jsx)("p",{children:p.Z.I18n.t("yourPrivacyContent2")}),(0,y.jsx)("p",{children:p.Z.I18n.t("yourPrivacyContent3")}),(0,y.jsx)(v.Z,{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/",children:p.Z.I18n.t("yourPrivacyButton")})]})};function Pl(){return(0,y.jsxs)(Fe.k.Provider,{value:(0,Fe.S)(window),children:[(0,y.jsx)(F.D,{}),(0,y.jsx)(Ge.Z,{}),(0,y.jsxs)(ms.Z,{activeKey:"knowledgeBase",children:[(0,y.jsx)(is.Z,{title:p.Z.I18n.t("tabKnowledgeBaseTitle"),children:(0,y.jsx)(ml,{})},"knowledgeBase"),(0,y.jsx)(is.Z,{title:p.Z.I18n.t("tabSystemStatusTitle"),children:(0,y.jsx)(Rl,{})},"systemStatus"),(0,y.jsx)(is.Z,{title:p.Z.I18n.t("tabSystemInfoTitle"),children:(0,y.jsx)(gl,{})},"systemInfo"),(0,y.jsx)(is.Z,{title:p.Z.I18n.t("tabYourPrivacyTitle"),children:(0,y.jsx)(Al,{})},"yourPrivacy")]})]})}const Ml=document.getElementById("help_container");Ml&&o().render((0,y.jsx)(Pl,{}),Ml);var Ll=(0,c.withRouter)((function(e){let{children:t,location:{pathname:n}}=e;return(0,j.useEffect)((()=>{window.scrollTo(0,0)}),[n]),t||null}));function Fl(e){let{activeMethod:t,onMethodChange:n}=e;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,y.jsx)("span",{className:"mailpoet_import_heading",children:p.Z.I18n.t("methodSelectionHead")}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs-row",children:(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/242-video-guide-importing-subscribers-using-a-csv-file","data-beacon-article":"5a8e8f0204286305fbc9be9a",target:"_blank",rel:"noopener noreferrer",children:(0,y.jsx)(b.Z,{dimension:"large",variant:"excellent",isInverted:!0,children:p.Z.I18n.t("seeVideo")})})})]}),(0,y.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,y.jsx)(me.Z,{name:"select_method",automationId:"import-paste-method",id:"import-paste-method",checked:"paste-method"===t,value:"paste-method",onCheck:n}),(0,y.jsx)("label",{htmlFor:"import-paste-method",children:p.Z.I18n.t("methodPaste")})]}),(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,y.jsx)(me.Z,{name:"select_method",automationId:"import-csv-method",id:"import-csv-method",checked:"file-method"===t,value:"file-method",onCheck:n}),(0,y.jsx)("label",{htmlFor:"import-csv-method",children:p.Z.I18n.t("methodUpload")})]}),(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,y.jsx)(me.Z,{name:"select_method",automationId:"import-mailchimp-method",id:"import-mailchimp-method",checked:"mailchimp-method"===t,value:"mailchimp-method",onCheck:n}),(0,y.jsx)("label",{htmlFor:"import-mailchimp-method",children:p.Z.I18n.t("methodMailChimp")})]})]})]})}Fl.propTypes={activeMethod:g().string,onMethodChange:g().func.isRequired},Fl.defaultProps={activeMethod:void 0};var ql=Fl;function $l(e){let{hidePrevious:t,isLastStep:n,canGoNext:r,onPreviousAction:a,onNextAction:s}=e;return(0,y.jsxs)("div",{className:"mailpoet-settings-save",children:[!t&&(0,y.jsx)(v.Z,{type:"button",variant:"secondary",onClick:a,children:p.Z.I18n.t("previousStep")}),(0,y.jsx)(v.Z,{type:"button",automationId:"import-next-step",isDisabled:!r,onClick:()=>{r&&s()},children:p.Z.I18n.t(n?"import":"nextStep")})]})}$l.propTypes={canGoNext:g().bool,hidePrevious:g().bool,isLastStep:g().bool,onPreviousAction:g().func,onNextAction:g().func},$l.defaultProps={hidePrevious:!1,isLastStep:!1,canGoNext:!0,onPreviousAction:()=>{},onNextAction:()=>{}};var Ul=$l;function Vl(e){let{onValueChange:t,canFinish:n,onFinish:r,data:a,onPrevious:s}=e;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,y.jsx)("label",{htmlFor:"paste_input",children:p.Z.I18n.t("pasteLabel")}),(0,y.jsx)("p",{className:"description",children:k()(p.Z.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,y.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files","data-beacon-article":"57ce079f903360649f6e56fc",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsx)(oe.Z,{id:"paste_input",rows:"15",placeholder:"Email, First Name, Last Name\njohn@doe.com, John, Doe\nmary@smith.com, Mary, Smith\njohnny@walker.com, Johnny, Walker",isCode:!0,onChange:e=>{t(e.target.value)},defaultValue:a})}),(0,y.jsx)(Ul,{canGoNext:n,onPreviousAction:s,onNextAction:r})]})}Vl.propTypes={onFinish:g().func,onPrevious:g().func,canFinish:g().bool.isRequired,onValueChange:g().func.isRequired,data:g().string},Vl.defaultProps={onFinish:()=>{},onPrevious:()=>{},data:""};var Wl=Vl;function Yl(e){let{onValueChange:t,canFinish:n,onFinish:r,onPrevious:a}=e;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,y.jsx)("label",{htmlFor:"file_local",children:p.Z.I18n.t("methodUpload")}),(0,y.jsx)("p",{className:"description",children:k()(p.Z.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,y.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files","data-beacon-article":"57ce079f903360649f6e56fc",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsx)(ae.Z,{type:"file",id:"file_local",accept:".csv","data-automation-id":"import-file-upload-input",onChange:e=>{const n=e.target.value.match(/[^.]+$/);p.Z.Notice.hide(),null===n||"csv"!==n[0].toLowerCase()?(p.Z.Notice.error(p.Z.I18n.t("wrongFileFormat")),t("")):t(e.target.files[0])}})}),(0,y.jsx)(Ul,{canGoNext:n,onPreviousAction:a,onNextAction:r})]})}Yl.propTypes={canFinish:g().bool.isRequired,onFinish:g().func,onPrevious:g().func,onValueChange:g().func.isRequired},Yl.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var Bl=Yl;function Hl(e){let{onFinish:t,onPrevious:n}=e;const[r,a]=(0,j.useState)(""),[s,i]=(0,j.useState)(void 0),[o,l]=(0,j.useState)([]);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet-settings-label",children:(0,y.jsxs)("label",{htmlFor:"mailpoet_mailchimp_key_input",children:[(0,y.jsx)("span",{className:"mailpoet_import_heading",children:p.Z.I18n.t("methodMailChimpLabel")}),(0,y.jsx)("p",{className:"description",children:k()(p.Z.I18n.t("methodMailChimpDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,y.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/255-migrating-from-mailchimp-to-mailpoet#api","data-beacon-article":"5b16db842c7d3a0fa9a2aa15",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]})}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,y.jsx)(ae.Z,{dimension:"small",id:"mailpoet_mailchimp_key_input",type:"text",onChange:e=>{a(e.target.value),""===e.target.value.trim()&&i(void 0)}}),(0,y.jsx)("span",{className:"mailpoet-gap"}),(0,y.jsx)(v.Z,{type:"button",dimension:"small",onClick:()=>{p.Z.Modal.loading(!0),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpLists",data:{api_key:r}}).always((()=>{p.Z.Modal.loading(!1)})).done((e=>i(e.data))).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},children:p.Z.I18n.t("methodMailChimpVerify")}),(0,y.jsx)("span",{className:"mailpoet-gap"}),(0,y.jsx)("span",{children:Array.isArray(s)&&0===s.length?p.Z.I18n.t("noMailChimpLists"):null})]})}),s?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet-settings-label",children:p.Z.I18n.t("methodMailChimpSelectList")}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsx)(C,{field:{id:"segments",name:"list-selection",multiple:!0,placeholder:p.Z.I18n.t("methodMailChimpSelectPlaceholder"),forceSelect2:!0,values:s},onValueChange:e=>l(e.target.value)})})]}):null,(0,y.jsx)(Ul,{canGoNext:Array.isArray(o)&&o.length>0,onPreviousAction:n,onNextAction:()=>{p.Z.Modal.loading(!0),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:r,lists:o}}).always((()=>{p.Z.Modal.loading(!1)})).done((e=>t(e.data))).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}})]})}Hl.propTypes={onFinish:g().func,onPrevious:g().func},Hl.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var zl=Hl,Kl=n(57460),Gl=n.n(Kl);const Ql=e=>window.roleBasedEmails.findIndex((t=>e.startsWith(`${t}@`)))>=0,Xl=e=>{let t,n=I.ZP.unescape(e);return n=n.toLowerCase().replace(/^["';.,\s]+|[^\x20-\x7E]+$|["';.,_\s]+$/g,"").replace(/\s+|%\d+|,+/g,""),t=/<(.*?)>/.exec(n),t&&(n=t[1].trim()),t=/mailto:(?:\s+)?(.*)/.exec(n),t&&(n=t[1].trim()),!!window.mailpoet_email_regex.test(n)&&!Ql(n)&&n};var Jl=(e,t)=>{const n=encodeURI(e).split(/%..|./).length-1;p.Z.Notice.hide(),n>window.maxPostSizeBytes?p.Z.Notice.error(p.Z.I18n.t("maxPostSizeNotice")):(p.Z.Modal.loading(!0),Gl().parse(e,function(e){return{skipEmptyLines:!0,error(){p.Z.Notice.hide(),p.Z.Notice.error(p.Z.I18n.t("dataProcessingError"))},complete(t){const n=function(e){let t=[];const n=[],r=[],a=[],s=[];let i,o,l,c,d=null,u=null,p=!1;return Object.keys(e).forEach((m=>{l=e[m].map((e=>e.trim())),c=l.length,null===u&&(u=c),c===u&&(null===d?(Object.keys(l).forEach((e=>{o=Xl(l[e]),null===d&&window.mailpoet_email_regex.test(o)&&(d=e,n[o]=!0,l[e]=o,t[o]=l)})),null===d&&0===parseInt(m,10)&&(p=!0,t[0]=l)):""!==l[d]&&(i=Xl(l[d]),I.ZP.has(n,i)?r.push(i):Ql(l[d])?s.push(l[d]):window.mailpoet_email_regex.test(i)?(n[i]=!0,l[d]=i,t[i]=l):a.push(l[d])))})),t=I.ZP.values(t),t&&(p&&t.length>=2||!p&&t.length>=1)?{header:window.mailpoet_email_regex.test(t[0][d])?null:t.shift(),subscribers:t,subscribersCount:t.length,duplicate:I.ZP.uniq(r),invalid:I.ZP.uniq(a),role:I.ZP.uniq(s)}:null}(t.data);if(n)e(n);else{let e=p.Z.I18n.t("noValidRecords");e=e.replace("[link]",'<a href="https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files" data-beacon-article="57ce079f903360649f6e56fc">'),e=e.replace("[/link]","</a>"),p.Z.Notice.error(e)}p.Z.Modal.loading(!1)}}}(t)))};function ec(e){let{history:t,setStepMethodSelectionData:n,subscribersLimitForValidation:r}=e;const[a,s]=(0,j.useState)(void 0),[i,o]=(0,j.useState)(""),[l,c]=(0,j.useState)(void 0),d=e=>{n(e),t.push(((e,t,n)=>void 0===e||void 0===e.subscribersCount||e.subscribersCount<t||"mailchimp-method"===n?"step_data_manipulation":"step_input_validation")(e,r,a))},u=()=>{t.push("/step_clean_list")},m=()=>{Jl("paste-method"===a?i:l,(e=>{p.Z.trackEvent("Subscribers import started",{source:"file-method"===a?"file upload":"pasted data"}),d(e)}))};return(0,y.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,y.jsx)(ql,{activeMethod:a,onMethodChange:s}),"paste-method"===a&&(0,y.jsx)(Wl,{onPrevious:u,onValueChange:o,onFinish:m,canFinish:!!i.trim(),data:i}),"file-method"===a&&(0,y.jsx)(Bl,{onPrevious:u,onValueChange:c,onFinish:m,canFinish:!!l,data:l}),"mailchimp-method"===a&&(0,y.jsx)(zl,{onPrevious:u,onFinish:e=>{p.Z.trackEvent("Subscribers import started",{source:"MailChimp"}),d(e)}}),void 0===a&&(0,y.jsx)(Ul,{canGoNext:!1,onPreviousAction:u})]})}ec.propTypes={history:g().shape({push:g().func.isRequired}).isRequired,setStepMethodSelectionData:g().func.isRequired,subscribersLimitForValidation:g().number.isRequired};var tc=(0,c.withRouter)(ec);function nc(e){let{onProceed:t}=e;return(0,y.jsxs)("div",{className:"mailpoet-clean-list-step-container",children:[(0,y.jsx)("p",{children:p.Z.I18n.t("cleanListText1")}),(0,y.jsx)("p",{children:p.Z.I18n.t("cleanListText2")}),(0,y.jsxs)("p",{children:[t&&(0,y.jsx)(v.Z,{onClick:t,variant:"tertiary",children:p.Z.I18n.t("listCleaningGotIt")}),(0,y.jsx)(v.Z,{target:"_blank",href:"https://kb.mailpoet.com/article/287-list-cleaning-services",children:p.Z.I18n.t("tryListCleaning")})]})]})}function rc(e){let{onSubmit:t,history:n}=e;const[r,a]=(0,j.useState)(void 0);return(0,y.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,y.jsx)("div",{className:"mailpoet-settings-label",children:p.Z.I18n.t("validationStepHeading")}),(0,y.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,y.jsx)(me.Z,{automationId:"mailpoet_import_validation_step_option1",id:"existing-list",checked:"existing-list"===r,value:"existing-list",onCheck:a}),(0,y.jsx)("label",{htmlFor:"existing-list",children:p.Z.I18n.t("validationStepRadio1")})]}),(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,y.jsx)(me.Z,{automationId:"mailpoet_import_validation_step_option2",id:"address-book",checked:"address-book"===r,value:"address-book",onCheck:a}),(0,y.jsx)("label",{htmlFor:"address-book",children:p.Z.I18n.t("validationStepRadio2")})]})]}),(0,y.jsx)(Ul,{canGoNext:void 0!==r,onPreviousAction:()=>n.push("step_method_selection"),onNextAction:()=>t(r)})]})}rc.propTypes={history:g().shape({push:g().func.isRequired}).isRequired,onSubmit:g().func.isRequired};var ac=rc,sc=function(){return(0,y.jsxs)("div",{className:"mailpoet-clean-list-step-container","data-automation-id":"import_wrong_source_block",children:[(0,y.jsx)("p",{children:p.Z.I18n.t("validationStepBlock1")}),(0,y.jsx)("p",{children:p.Z.I18n.t("validationStepBlock2")}),(0,y.jsx)("p",{children:(0,y.jsx)(v.Z,{href:"https://kb.mailpoet.com/article/269-reconfirm-subscribers-to-your-list",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("validationStepBlockButton")})})]})};function ic(e){let{onSubmit:t}=e;const[n,r]=(0,j.useState)("over2years"),a=(0,j.useCallback)((e=>{r(e.target.value)}),[r]),s=(0,j.useCallback)((()=>{t("over2years"===n||"1to2years"===n?"notRecently":"recently")}),[t,n]);return(0,y.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,y.jsx)("div",{className:"mailpoet-settings-label",children:p.Z.I18n.t("validationStepLastSentHeading")}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsxs)(de.Z,{defaultValue:n,onChange:a,automationId:"last_sent_to_list",children:[(0,y.jsx)("option",{value:"over2years",children:p.Z.I18n.t("validationStepLastSentOption1")}),(0,y.jsx)("option",{value:"1to2years",children:p.Z.I18n.t("validationStepLastSentOption2")}),(0,y.jsx)("option",{value:"less1year",children:p.Z.I18n.t("validationStepLastSentOption3")}),(0,y.jsx)("option",{value:"less3months",children:p.Z.I18n.t("validationStepLastSentOption4")})]})}),(0,y.jsx)("div",{className:"mailpoet-settings-save",children:(0,y.jsx)(v.Z,{type:"button",automationId:"last_sent_to_list_next",onClick:s,children:p.Z.I18n.t("validationStepLastSentNext")})})]})}ic.propTypes={onSubmit:g().func.isRequired};var oc=ic;function lc(e){let{stepMethodSelectionData:t,history:n}=e;const[r,a]=(0,j.useState)(void 0),[s,i]=(0,j.useState)(void 0);(0,j.useEffect)((()=>{void 0===t&&n.replace("step_method_selection")}),[t,n]);const o=(0,j.useCallback)((e=>{i(e),"recently"===e&&n.push("step_data_manipulation")}),[n,i]);return(0,y.jsxs)(y.Fragment,{children:[void 0===r&&(0,y.jsx)(ac,{onSubmit:a,history:n}),"address-book"===r&&(0,y.jsx)(sc,{}),"existing-list"===r&&void 0===s&&(0,y.jsx)(oc,{onSubmit:o}),"existing-list"===r&&"notRecently"===s&&(0,y.jsx)(nc,{})]})}lc.propTypes={history:g().shape({push:g().func.isRequired,replace:g().func.isRequired}).isRequired,stepMethodSelectionData:g().shape({duplicate:g().arrayOf(g().string),header:g().arrayOf(g().string),invalid:g().arrayOf(g().string),role:g().arrayOf(g().string),subscribersCount:g().number,subscribers:g().arrayOf(g().arrayOf(g().string))})},lc.defaultProps={stepMethodSelectionData:void 0};var cc=(0,c.withRouter)(lc);const dc=e=>{let{translation:t,subscribers:n}=e,r="";return n.length&&(r=k()(t.replace("%2$s",n.join(", ")),"%1$s",(()=>(0,y.jsx)("strong",{children:n.length.toLocaleString()},t))),r=(0,y.jsx)("p",{children:r})),r};function uc(e){let{stepMethodSelectionData:t}=e;const{invalid:n,duplicate:r,role:a}=t,[s,i]=(0,j.useState)(!1),o=h()("mailpoet_subscribers_data_parse_results_details",{mailpoet_hidden:!s}),l=(0,y.jsx)(dc,{translation:p.Z.I18n.t("importNoticeInvalid"),subscribers:n}),c=(0,y.jsx)(dc,{translation:p.Z.I18n.t("importNoticeDuplicate"),subscribers:r});let d="";if(a.length&&(d=k()(p.Z.I18n.t("importNoticeRoleBased"),/(%1\$s|\[link\].*\[\/link\]|%2\$s)/,(e=>"%1$s"===e?(0,y.jsx)("strong",{children:a.length.toLocaleString()},"role-length"):"%2$s"===e?a.join(", "):(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/270-role-based-email-addresses-are-not-allowed","data-beacon-article":"5d0a1da404286318cac46fe5",target:"_blank",rel:"noopener noreferrer",children:e.replace("[link]","").replace("[/link]","")},e))),d=(0,y.jsx)("p",{children:d})),n.length||r.length||a.length){const e=n.length+r.length+a.length;return(0,y.jsxs)("div",{className:"error",children:[(0,y.jsxs)("p",{children:[k()(p.Z.I18n.t("importNoticeSkipped"),"%1$s",(()=>(0,y.jsx)("strong",{children:e.toLocaleString()},"lengths")))," ",(0,y.jsx)("a",{className:"mailpoet_subscribers_data_parse_results_details_show","data-automation-id":"show-more-details",onClick:()=>i(!s),role:"button",tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),i(!s))},children:p.Z.I18n.t("showMoreDetails")})]}),(0,y.jsxs)("div",{className:o,children:[(0,y.jsx)("hr",{}),l,c,d]})]})}return null}dc.propTypes={translation:g().string.isRequired,subscribers:g().arrayOf(g().string).isRequired},uc.propTypes={stepMethodSelectionData:g().shape({duplicate:g().arrayOf(g().string),invalid:g().arrayOf(g().string),role:g().arrayOf(g().string)})},uc.defaultProps={stepMethodSelectionData:{invalid:[],duplicate:[],role:[]}};var pc=uc;function mc(e){let{header:t,subscribers:n}=e;const r=((e,t)=>{const n=[],r=[];let a,s,i,o;return Object.keys(e[0]).forEach((l=>{a=e[0][l],s="ignore",a%1!=0&&window.mailpoet_email_regex.test(a)?s="email":t&&(i=t[l],o=window.mailpoetColumns.map((e=>e.name)).indexOf(i),-1!==o?s=window.mailpoetColumns[o].id:i&&(/first|first name|given name/i.test(i)?s="first_name":/last|last name/i.test(i)&&(s="last_name"))),s="ignore"!==s&&-1===r.indexOf(s)?s:"ignore",n[l]={column_id:s},r.push(s)})),n})(n,t);return(0,y.jsxs)("tr",{children:[(0,y.jsx)("th",{children:p.Z.I18n.t("matchData")}),r.map(((e,t)=>(0,y.jsx)("th",{children:(0,y.jsx)("select",{className:"mailpoet_subscribers_column_data_match","data-column-id":e.column_id,"data-column-index":t,id:`column_${t}`})},e.column_id+t)))]})}function hc(e){let{header:t}=e;return(0,y.jsxs)("tr",{className:"mailpoet_header",children:[(0,y.jsx)("td",{}),t.map((e=>(0,y.jsx)("td",{children:e},e)))]})}function fc(e){let{subscriber:t,index:n}=e;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("td",{children:n}),t.map(((e,t)=>(0,y.jsx)("td",{children:e},`${e}-${n}-${t}`)))]})}function gc(e){let{subscribers:t,subscribersCount:n}=e;const r=". . .",a=Array(t[0].length).fill(r);return(0,y.jsxs)(y.Fragment,{children:[t.slice(0,10).map(((e,t)=>(0,y.jsx)("tr",{children:(0,y.jsx)(fc,{subscriber:e,index:t+1})},`${e[0]}-${t}`))),n>11?(0,y.jsx)("tr",{children:(0,y.jsx)(fc,{subscriber:a,index:r})},"filler"):null,n>10?(0,y.jsx)("tr",{children:(0,y.jsx)(fc,{subscriber:t[n-1],index:n})},t[n-1][0]):null]})}function vc(e){let{subscribersCount:t,subscribers:n,header:r}=e;return(0,j.useLayoutEffect)((()=>{(()=>{const e={data:window.mailpoetColumnsSelect2,width:"15em"};u()("select.mailpoet_subscribers_column_data_match").select2(e).on("select2:selecting",(t=>{const n=t.currentTarget,r=t.params.args.data.id;"create"===r?(t.preventDefault(),u()(n).select2("close"),p.Z.Modal.popup({title:p.Z.I18n.t("addNewField"),template:u()("#form_template_field_form").html()}),u()("#form_field_new").parsley().on("form:submit",(()=>{const t=u()("#form_field_new").mailpoetSerializeObject();return p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:t}).done((t=>{const r={id:t.data.id,name:t.data.name,text:t.data.name,type:t.data.type,params:t.data.params,custom:!0};2===window.mailpoetColumnsSelect2.length&&window.mailpoetColumnsSelect2.push({name:p.Z.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(r),window.mailpoetColumns.push(r),u()("select.mailpoet_subscribers_column_data_match").each((()=>{u()(n).html("").select2("destroy").select2(e)})),u()(n).data("column-id",r.id),p.Z.Modal.close()})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#field_name"})})),!1}))):u()("select.mailpoet_subscribers_column_data_match").each((()=>{const e=n,a=u()(e).val();a===r&&"ignore"!==a&&(confirm(`${p.Z.I18n.t("selectedValueAlreadyMatched")} ${p.Z.I18n.t("confirmCorrespondingColumn")}`)?u()(e).data("column-id","ignore"):(t.preventDefault(),u()(n).select2("close")))}))})).on("select2:select",(e=>{const t=e.currentTarget,n=e.params.data.id;u()(t).data("column-id",n)})).on("select2:open",(()=>{const e=document.querySelectorAll(".select2-search__field[aria-controls]");0!==e.length&&e[e.length-1].focus()})),u().map(u()(".mailpoet_subscribers_column_data_match"),(e=>{const t=u()(e).data("column-id");u()(e).val(t).trigger("change")}))})()})),(0,y.jsx)("div",{className:"subscribers_data",children:(0,y.jsxs)("table",{className:"mailpoet_subscribers widefat fixed",children:[(0,y.jsx)("thead",{children:(0,y.jsx)(mc,{header:r,subscribers:n})}),(0,y.jsxs)("tbody",{children:[r?(0,y.jsx)(hc,{header:r}):null,(0,y.jsx)(gc,{subscribers:n,subscribersCount:t})]})]})})}mc.propTypes={subscribers:g().arrayOf(g().arrayOf(g().oneOfType([g().string,g().number]))).isRequired,header:g().arrayOf(g().string)},mc.defaultProps={header:[]},hc.propTypes={header:g().arrayOf(g().string).isRequired},fc.propTypes={subscriber:g().arrayOf(g().oneOfType([g().string,g().number])).isRequired,index:g().node.isRequired},gc.propTypes={subscribersCount:g().number.isRequired,subscribers:g().arrayOf(g().arrayOf(g().oneOfType([g().string,g().number]))).isRequired},vc.propTypes={subscribersCount:g().number,subscribers:g().arrayOf(g().arrayOf(g().oneOfType([g().string,g().number]))),header:g().arrayOf(g().string)},vc.defaultProps={subscribersCount:0,subscribers:[],header:[]};var bc=vc;function yc(e){let{setSelectedSegments:t}=e;const{segments:n}=(0,j.useContext)(Fe.k),{all:r,updateAll:a}=n,[s,i]=(0,j.useState)(r);(0,j.useLayoutEffect)((()=>{!function(e,n){const r=u()("select#mailpoet_segments_select");if(r.data("select2"))return;const a=e=>{let t=`<span class="mailpoet-form-select2-text"><span>${e.name}</span></span>`;return e.count&&(t+=`<span class="mailpoet-form-select2-count">${e.count}</span>`),t};r.html(""),r.select2({data:e.map((e=>({...e,text:e.name}))),dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:a,templateSelection:a}).on("change",(e=>{const n=u()('[data-id="notice_segmentSelection"]');e.currentTarget.value?u()('[data-id="notice_segmentSelection"]').remove():n.length||p.Z.Notice.error(p.Z.I18n.t("segmentSelectionRequired"),{static:!0,scroll:!0,id:"notice_segmentSelection",hideClose:!0});(e=>{t(e)})(I.ZP.pluck(r.select2("data"),"id"))}))}(s)}),[s,t]);const o=e=>{!function(){const e=u()("select#mailpoet_segments_select");e.data("select2")&&(e.select2("destroy"),e.find("option").remove(),e.off("select2:unselecting").off("change").off("select2:opening"))}(),t([]),i([...s,e]),a([...s,e])};return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet-settings-label",children:(0,y.jsxs)("label",{htmlFor:"mailpoet_segments_select",children:[p.Z.I18n.t("pickLists"),(0,y.jsx)("p",{className:"description",children:p.Z.I18n.t("pickListsDescription")})]})}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,y.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,y.jsx)("select",{id:"mailpoet_segments_select","data-placeholder":p.Z.I18n.t("select"),multiple:"multiple",children:(0,y.jsx)("option",{})})}),(0,y.jsx)(v.Z,{variant:"tertiary",onClick:()=>{return e=o,p.Z.Modal.popup({title:p.Z.I18n.t("addNewList"),template:u()("#new_segment_template").html()}),u()("#new_segment_name").on("keypress",(e=>{13===e.which&&u()("#new_segment_process").trigger("click")})),u()("#new_segment_process").on("click",(()=>{const t=u()("#new_segment_name").val().trim(),n=u()("#new_segment_description").val().trim();p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"addSegment",data:{name:t,description:n}}).done((t=>{e({id:t.data.id,name:t.data.name,text:t.data.name,subscriberCount:0}),p.Z.Modal.close()})).fail((e=>{e.errors.length>0&&(p.Z.Notice.hide(),p.Z.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#new_segment_name"}))}))})),void u()("#new_segment_cancel").on("click",(()=>{p.Z.Modal.close()}));var e},children:p.Z.I18n.t("createANewList")})]})})]})}yc.propTypes={setSelectedSegments:g().func.isRequired};var wc=yc;function xc(){return(0,y.jsx)("p",{className:"description",children:k()(p.Z.I18n.t("consentSubscribed"),/\[link](.*?)\[\/link]/,(e=>(0,y.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/357-why-express-consent-is-important",target:"_blank","data-beacon-article":"605ca22ac44f5d025f447f39",rel:"noopener noreferrer",children:e},"kb-link")))})}function _c(e){let{newSubscribersStatus:t,setNewSubscribersStatus:n}=e;const r=(0,j.useCallback)((e=>{n(e.target.value)}),[n]);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,y.jsx)("label",{htmlFor:"new_subscribers_status",children:p.Z.I18n.t("newSubscribersStatus")}),(0,y.jsx)(xc,{})]}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsxs)(de.Z,{id:"new_subscribers_status",placeholder:p.Z.I18n.t("select"),name:"new_subscribers_status",onChange:r,defaultValue:t,children:[(0,y.jsx)("option",{value:"subscribed",children:p.Z.I18n.t("subscribed")}),(0,y.jsx)("option",{value:"inactive",children:p.Z.I18n.t("inactive")}),(0,y.jsx)("option",{value:"unsubscribed",children:p.Z.I18n.t("unsubscribed")})]})})]})}function Zc(e){let{existingSubscribersStatus:t,setExistingSubscribersStatus:n}=e;const r=(0,j.useCallback)((e=>{n(e.target.value)}),[n]);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,y.jsx)("label",{htmlFor:"existing_subscribers_status",children:p.Z.I18n.t("existingSubscribersStatus")}),(0,y.jsx)(xc,{})]}),(0,y.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,y.jsxs)(de.Z,{id:"existing_subscribers_status",placeholder:p.Z.I18n.t("select"),name:"existing_subscribers_status",onChange:r,defaultValue:t,children:[(0,y.jsx)("option",{value:"dont_update",children:p.Z.I18n.t("dontUpdate")}),(0,y.jsx)("option",{value:"subscribed",children:p.Z.I18n.t("subscribed")}),(0,y.jsx)("option",{value:"inactive",children:p.Z.I18n.t("inactive")}),(0,y.jsx)("option",{value:"unsubscribed",children:p.Z.I18n.t("unsubscribed")})]})})]})}function jc(e){let{updateExistingSubscribers:t,setUpdateExistingSubscribers:n}=e;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet-settings-label",children:p.Z.I18n.t("updateExistingSubscribers")}),(0,y.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,y.jsx)(me.Z,{id:"update_existing_subscribers",name:"update_existing_subscribers",value:"1",checked:t,onCheck:()=>n(!0)}),(0,y.jsx)("label",{htmlFor:"update_existing_subscribers",children:p.Z.I18n.t("updateExistingSubscribersYes")}),(0,y.jsx)("span",{className:"mailpoet-gap"}),(0,y.jsx)(me.Z,{id:"dont_update_existing_subscribers",name:"update_existing_subscribers",value:"",checked:!t,onCheck:()=>n(!1)}),(0,y.jsx)("label",{htmlFor:"dont_update_existing_subscribers",children:p.Z.I18n.t("updateExistingSubscribersNo")})]})]})}jc.propTypes={setUpdateExistingSubscribers:g().func.isRequired,updateExistingSubscribers:g().bool.isRequired};var Ic=jc;function Sc(e){let{history:t,stepMethodSelectionData:n,subscribersLimitForValidation:r,setStepDataManipulationData:a}=e;const[s,i]=(0,j.useState)([]),[o,l]=(0,j.useState)(!0),[c,d]=(0,j.useState)("subscribed"),[m,h]=(0,j.useState)("dontUpdate");return(0,j.useEffect)((()=>{void 0===n&&t.replace("step_method_selection")}),[n,t]),void 0===n?null:(0,y.jsxs)("div",{"data-automation-id":"import_data_manipulation_step",children:[(0,y.jsx)(pc,{stepMethodSelectionData:n}),(0,y.jsx)(bc,{subscribersCount:n.subscribersCount,subscribers:n.subscribers,header:n.header}),(0,y.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,y.jsx)(wc,{setSelectedSegments:i}),(0,y.jsx)(_c,{newSubscribersStatus:c,setNewSubscribersStatus:d}),(0,y.jsx)(Zc,{existingSubscribersStatus:m,setExistingSubscribersStatus:h}),(0,y.jsx)(Ic,{setUpdateExistingSubscribers:l,updateExistingSubscribers:o}),(0,y.jsx)(Ul,{canGoNext:s.length>0,onPreviousAction:()=>t.push(function(e,t){return void 0===e||void 0===e.subscribersCount||e.subscribersCount<t?"step_method_selection":"step_input_validation"}(n,r)),onNextAction:()=>{((e,n,r,s,i,o)=>{const l={},c=new(u().AsyncQueue);let d=0;const m=Date.now()/1e3,h={created:0,updated:0,errors:[],segments:[]};p.Z.Modal.loading(!0);const f=(2e3,e.reduce(((e,t,n)=>(n%2e3==0&&e.push([]),e[e.length-1].push(t),e)),[]));I.ZP.each(u()("select.mailpoet_subscribers_column_data_match"),((e,t)=>{const n=u()(e).data("column-id");"ignore"!==n&&(l[n]={index:t})})),I.ZP.each(f,(()=>{c.add((e=>{e.pause(),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processImport",data:JSON.stringify({columns:l,subscribers:f[d],timestamp:m,segments:n,newSubscribersStatus:r,existingSubscribersStatus:s,updateSubscribers:i})}).done((t=>{const n=t.data.added_to_segment_with_welcome_notification;h.created+=t.data.created,h.updated+=t.data.updated,h.segments=t.data.segments,h.added_to_segment_with_welcome_notification=n,e.run()})).fail((e=>{p.Z.Modal.loading(!1),e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),d+=1}))})),c.run(),c.onComplete((()=>{p.Z.Modal.loading(!1),h.errors.length>0&&!h.updated&&!h.created?p.Z.Notice.error(I.ZP.flatten(h.errors)):(h.segments=I.ZP.map(I.ZP.filter(h.segments,(e=>n.includes(e.id))),(e=>e.name)),a(h),t.push("step_results"))}))})(n.subscribers,s,c,m,o)},isLastStep:!0})]})]})}n(49868),Sc.propTypes={history:g().shape({push:g().func.isRequired,replace:g().func.isRequired}).isRequired,stepMethodSelectionData:g().shape({duplicate:g().arrayOf(g().string),header:g().arrayOf(g().string),invalid:g().arrayOf(g().string),role:g().arrayOf(g().string),subscribersCount:g().number,subscribers:g().arrayOf(g().arrayOf(g().oneOfType([g().string,g().number])))}),subscribersLimitForValidation:g().number.isRequired,setStepDataManipulationData:g().func.isRequired},Sc.defaultProps={stepMethodSelectionData:void 0};var Cc=(0,c.withRouter)(Sc);function Tc(e){let{subscribersCount:t,segments:n,initialMessage:r}=e;if(t){let e=k()(r,"%1$s",(()=>(0,y.jsx)("strong",{children:t.toLocaleString()},"%1$s")));return e=k()(e,"%2$s",(()=>`"${n.join('", "')}"`)),(0,y.jsx)("p",{children:e})}return null}function kc(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?null:(0,y.jsx)("p",{children:p.Z.I18n.t("importNoAction")})}function Nc(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("p",{children:(0,y.jsx)("b",{children:p.Z.I18n.t("congratulationResult")})}),(0,y.jsx)("p",{children:k()(p.Z.I18n.t("suppressionListReminder"),/\[link](.*?)\[\/link]/,(e=>(0,y.jsx)("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/359-how-to-import-a-suppression-list","data-beacon-article":"6064973ce0324b5fdfd0650c",target:"_blank",rel:"noopener noreferrer",children:e},"kb-link")))})]}):null}function Dc(e){let{addedToSegmentWithWelcomeNotification:t}=e;return t?(0,y.jsx)("p",{children:p.Z.I18n.t("importNoWelcomeEmail")}):null}function Ec(e){let{errors:t,createdSubscribers:n,updatedSubscribers:r,segments:a,addedToSegmentWithWelcomeNotification:s,history:i}=e;return(0,j.useEffect)((()=>{void 0===a&&0===t.length&&void 0===n&&void 0===r&&i.replace("step_method_selection")}),[a,n,t.length,i,r]),t.length&&p.Z.Notice.error(I.ZP.flatten(t)),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:"updated",children:[(0,y.jsx)(Tc,{subscribersCount:n,segments:a,initialMessage:p.Z.I18n.t("subscribersCreated")}),(0,y.jsx)(Tc,{subscribersCount:r,segments:a,initialMessage:p.Z.I18n.t("subscribersUpdated")}),(0,y.jsx)(kc,{createdSubscribers:n,updatedSubscribers:r}),(0,y.jsx)(Dc,{addedToSegmentWithWelcomeNotification:s})]}),(0,y.jsx)(Nc,{createdSubscribers:n,updatedSubscribers:r}),(0,y.jsx)("div",{className:"mailpoet-settings-grid",children:(0,y.jsxs)("div",{className:"mailpoet-settings-save",children:[(0,y.jsx)(v.Z,{variant:"secondary",type:"button",onClick:()=>i.push("step_method_selection"),children:p.Z.I18n.t("importAgain")}),(0,y.jsx)(v.Z,{type:"button",onClick:()=>{window.location.href="admin.php?page=mailpoet-subscribers"},children:p.Z.I18n.t("viewSubscribers")})]})})]})}Tc.propTypes={segments:g().arrayOf(g().string.isRequired),subscribersCount:g().number,initialMessage:g().string},Tc.defaultProps={segments:[],subscribersCount:0,initialMessage:""},kc.propTypes={createdSubscribers:g().number,updatedSubscribers:g().number},kc.defaultProps={createdSubscribers:0,updatedSubscribers:0},Nc.propTypes={createdSubscribers:g().number,updatedSubscribers:g().number},Nc.defaultProps={createdSubscribers:0,updatedSubscribers:0},Dc.propTypes={addedToSegmentWithWelcomeNotification:g().bool},Dc.defaultProps={addedToSegmentWithWelcomeNotification:!1},Ec.propTypes={history:g().shape({push:g().func.isRequired,replace:g().func.isRequired}).isRequired,errors:g().arrayOf(g().string.isRequired),segments:g().arrayOf(g().string.isRequired),createdSubscribers:g().number,updatedSubscribers:g().number,addedToSegmentWithWelcomeNotification:g().bool},Ec.defaultProps={errors:[],segments:void 0,createdSubscribers:void 0,updatedSubscribers:void 0,addedToSegmentWithWelcomeNotification:void 0};var Oc=(0,c.withRouter)(Ec);function Rc(e){let{history:t}=e;return(0,y.jsx)(nc,{onProceed:()=>t.push("step_method_selection")})}const Ac=document.getElementById("import_container");function Pc(){const[e,t]=(0,j.useState)(void 0),[n,r]=(0,j.useState)({}),a=(0,Fe.S)(window);return(0,y.jsx)(Fe.k.Provider,{value:a,children:(0,y.jsxs)(l.UT,{children:[(0,y.jsx)(Ge.Z,{}),(0,y.jsx)(Ll,{children:(0,y.jsxs)(c.Switch,{children:[(0,y.jsx)(c.Route,{path:"/step_clean_list",render:e=>(0,y.jsx)(Rc,{...e})}),(0,y.jsx)(c.Route,{path:"/step_method_selection",render:e=>(0,y.jsx)(tc,{...e,setStepMethodSelectionData:t,subscribersLimitForValidation:100})}),(0,y.jsx)(c.Route,{path:"/step_input_validation",render:t=>(0,y.jsx)(cc,{...t,stepMethodSelectionData:e})}),(0,y.jsx)(c.Route,{path:"/step_data_manipulation",render:t=>(0,y.jsx)(Cc,{...t,stepMethodSelectionData:e,subscribersLimitForValidation:100,setStepDataManipulationData:r})}),(0,y.jsx)(c.Route,{path:"/step_results",render:e=>(0,y.jsx)(Oc,{...e,errors:n.errors,createdSubscribers:n.created,updatedSubscribers:n.updated,segments:n.segments,addedToSegmentWithWelcomeNotification:n.added_to_segment_with_welcome_notification})}),(0,y.jsx)(c.Route,{path:"*",render:()=>(0,y.jsx)(c.Redirect,{to:"/step_clean_list"})})]})})]})})}Ac&&o().render((0,y.jsx)(Pc,{}),Ac);var Mc=n(19675),Lc=n.n(Mc),Fc=n(56692);function qc(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("welcomeWizardLetsStartTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("p",{children:p.Z.I18n.t("welcomeWizardSenderText")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("form",{id:"mailpoet_sender_form",onSubmit:t=>{t.preventDefault(),u()("#mailpoet_sender_form").parsley().validate()&&e.submit_sender()},children:[(0,y.jsxs)(_t.r.TwoColumns,{children:[(0,y.jsxs)("label",{htmlFor:"senderName",children:[(0,y.jsx)("span",{className:"mailpoet-wizard-label",children:p.Z.I18n.t("senderName")}),(0,y.jsx)(ae.Z,{isFullWidth:!0,name:"senderName",type:"text",placeholder:"John Doe",value:e.sender?e.sender.name:"","data-parsley-required":!0,onChange:t=>e.update_sender({name:t.target.value})})]}),(0,y.jsxs)("label",{htmlFor:"senderAddress",children:[(0,y.jsx)("span",{className:"mailpoet-wizard-label",children:p.Z.I18n.t("senderAddress")}),(0,y.jsx)(ae.Z,{isFullWidth:!0,name:"senderAddress",type:"text",placeholder:"john@doe.com",value:e.sender?e.sender.address:"","data-parsley-required":!0,"data-parsley-type":"email",onChange:t=>e.update_sender({address:t.target.value})})]})]}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)(v.Z,{isFullWidth:!0,type:"submit",withSpinner:e.loading,children:p.Z.I18n.t("continue")}),(0,y.jsx)(v.Z,{href:"#finish",isDisabled:e.loading,isFullWidth:!0,onClick:e.finish,variant:"tertiary",children:p.Z.I18n.t("finishLater")})]})]})}u()(document).ready((()=>{let e;if(!u()("#mailpoet_subscribers_export").length)return;if(!window.exportData.segments)return;const t=Lc().compile(u()("#mailpoet_subscribers_export_template").html());function n(t){const n="mailpoet-disabled";"on"===t?e.removeClass(n):e.addClass(n)}u()("#mailpoet-export").html(t(window.exportData));const r=u()("#export_lists"),a=u()("#export_columns");function s(e){let t=`<span class="mailpoet-form-select2-text"><span>${e.name}</span></span>`;return void 0!==e.count&&(t+=`<span class="mailpoet-form-select2-count">${e.count}</span>`),t}function i(e,t){e.data("select2")&&e.html("").select2("destroy"),e.select2({data:t,width:"20em",dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:s,templateSelection:s}).on("select2:selecting",(t=>{const n=t.params.args.data.id,r=["select","deselect"];let a;I.ZP.contains(r,n)&&(t.preventDefault(),"deselect"===n?u()(t.target).val("").trigger("change"):(a=[],I.ZP.each(e.find("option"),(e=>{const t=e.value;I.ZP.contains(r,t)||a.push(t)})),u()(t.target).val(a).trigger("change")),u()(t.target).select2("close"))})).on("change",(()=>{window.exportData.segments&&r.select2("data").length&&a.select2("data").length||!window.exportData.segments&&a.select2("data").length?n("on"):n("off")}))}e=u()("#mailpoet-export-button"),window.segments.forEach((e=>{r.append(u()("<option></option>").attr("value",e.id).text(e.name))})),window.subscriberFieldsSelect2.forEach((e=>{e.text=e.name,e.children.forEach((e=>{e.name=(0,Fc.r)(e.name),e.text=(0,Fc.r)(e.name)}))})),i(r,window.segments),i(a,window.subscriberFieldsSelect2),a.val(["email","first_name","last_name","list_status","global_status","subscribed_ip","created_at","confirmed_at","confirmed_ip"]).trigger("change"),e.on("click",(e=>{if(u()(e.target).hasClass("mailpoet-disabled"))return;p.Z.Modal.loading(!0);const t=u()(':radio[name="option_format"]:checked').val();p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"ImportExport",action:"processExport",data:JSON.stringify({export_format_option:t,segments:!!window.exportData.segments&&r.val(),subscriber_fields:a.val()})}).always((()=>{p.Z.Modal.loading(!1)})).done((e=>{const n=p.Z.I18n.t("exportMessage").replace("%1$s",`<strong>${parseInt(e.data.totalExported,10).toLocaleString()}</strong>`).replace("[link]",`<a href="${e.data.exportFileURL}" target="_blank" >`).replace("[/link]","</a>");u()("#export_result_notice").html(`<p>${n}</p>`).show(),window.location.href=e.data.exportFileURL,p.Z.trackEvent("Subscribers export completed",{"Total exported":e.data.totalExported,"File Format":t})})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}))})),qc.propTypes={finish:g().func.isRequired,loading:g().bool.isRequired,update_sender:g().func.isRequired,submit_sender:g().func.isRequired,sender:g().shape({name:g().string,address:g().string})},qc.defaultProps={sender:null};var $c=qc;function Uc(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("welcomeWizardLetsStartTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("p",{children:p.Z.I18n.t("welcomeWizardSenderMigratedUserText")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)(v.Z,{isFullWidth:!0,onClick:e.next,type:"button",children:p.Z.I18n.t("continue")})]})}Uc.propTypes={next:g().func.isRequired};var Vc=Uc;function Wc(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("welcomeWizardEmailCourseTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("p",{children:p.Z.I18n.t("welcomeWizardEmailCourseText")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("iframe",{id:"mailpoet_form_iframe",width:"100%",scrolling:"no",frameBorder:"0",title:"Apply to course",src:"https://www.mailpoet.com?mailpoet_form_iframe=13",className:"mailpoet-wizard-course-iframe",marginWidth:"0",marginHeight:"0"}),(0,y.jsx)(v.Z,{isFullWidth:!0,onClick:e.next,type:"button",children:p.Z.I18n.t("continue")})]})}Wc.propTypes={next:g().func.isRequired};var Yc=Wc,Bc=(0,y.jsx)("svg",{width:"13",height:"11",viewBox:"0 0 13 11",children:(0,y.jsx)("path",{fill:"currentColor",d:"M9.967.638c.483-.698 1.405-.846 2.06-.33.654.515.793 1.499.31 2.197l-5.44 7.857c-.55.794-1.64.857-2.267.132l-3.4-3.928c-.552-.638-.515-1.632.083-2.22.598-.59 1.53-.55 2.082.088l2.19 2.532L9.968.638z"})}),Hc=(0,y.jsx)("svg",{width:"17",height:"16",viewBox:"0 0 17 16",children:(0,y.jsx)("path",{fill:"currentColor",d:"M12.407 3.31c.576.576.576 1.509 0 2.084L9.914 7.888l2.411 2.412c.586.585.586 1.535 0 2.121-.585.586-1.535.586-2.12 0l-2.413-2.412L5.3 12.503c-.576.575-1.509.575-2.084 0-.575-.575-.575-1.508 0-2.083l2.493-2.495-2.41-2.41c-.587-.587-.587-1.536 0-2.122.585-.586 1.535-.586 2.12 0L7.83 5.804l2.494-2.493c.575-.576 1.508-.576 2.083 0z"})}),zc=function(e){let{onCheck:t,showError:n,checked:r,automationId:a,...s}=e;return(0,y.jsxs)("div",{className:h()({"mailpoet-form-yesno":!0,"mailpoet-form-yesno-error":n,"mailpoet-disabled":s.disabled}),"data-automation-id":a,children:[(0,y.jsxs)("label",{children:[(0,y.jsx)("input",{type:"radio",checked:!0===r,onChange:()=>t(!0),...s}),(0,y.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-yes",children:Bc})]}),(0,y.jsxs)("label",{children:[(0,y.jsx)("input",{type:"radio",checked:!1===r,onChange:()=>t(!1),...s}),(0,y.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-no",children:Hc})]})]})};function Kc(e){let{loading:t,submitForm:n}=e;const[r,a]=(0,j.useState)({tracking:void 0,libs3rdParty:void 0});return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("welcomeWizardUsageTrackingStepTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("p",{children:p.Z.I18n.t("welcomeWizardTrackingText")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)(je.Z,{level:5,children:p.Z.I18n.t("welcomeWizardUsageTrackingStepSubTitle")}),(0,y.jsx)(_t.r.TwoColumnsList,{children:(0,y.jsxs)(Jn,{children:[(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardTrackingList1")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardTrackingList2")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardTrackingList3")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardTrackingList4")}),(0,y.jsx)("li",{children:p.Z.I18n.t("welcomeWizardTrackingList5")})]})}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("form",{onSubmit:function(e){return e.preventDefault(),n(r.tracking,r.libs3rdParty),!1},children:[(0,y.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,y.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,y.jsx)(zc,{onCheck:e=>{const t={tracking:e,libs3rdParty:r.libs3rdParty};e&&(t.libs3rdParty=e),a(t)},checked:r.tracking,name:"mailpoet_tracking"})}),(0,y.jsxs)("div",{children:[(0,y.jsxs)("p",{children:[p.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabel")," ",(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/130-sharing-your-data-with-us","data-beacon-article":"57ce0aaac6979108399a0454",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("welcomeWizardTrackingLink")})]}),(0,y.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,y.jsx)("span",{children:p.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNoteNote")}),p.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNote")]})]})]}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,y.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,y.jsx)(zc,{onCheck:e=>{const t={libs3rdParty:e,tracking:r.tracking};e||(t.tracking=e),a(t)},checked:r.libs3rdParty,name:"mailpoet_libs_3rdParty"})}),(0,y.jsxs)("div",{children:[(0,y.jsxs)("p",{children:[p.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabel")," ",(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/338-what-3rd-party-libraries-we-use","data-beacon-article":"5f7c7dd94cedfd0017dcece8",target:"_blank",rel:"noopener noreferrer",children:p.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLink")})]}),(0,y.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,y.jsx)("span",{children:p.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNoteNote")}),p.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNote")]})]})]}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)(v.Z,{isFullWidth:!0,type:"submit",withSpinner:t,disabled:t,children:p.Z.I18n.t("continue")})]})]})}Kc.propTypes={loading:g().bool.isRequired,submitForm:g().func.isRequired};var Gc=Kc,Qc=function(e){let{children:t}=e;return(0,y.jsx)("div",{className:"mailpoet-steps-content",children:t})};function Xc(e){const[t,n]=(0,j.useState)(null),[r,a]=(0,j.useState)(null),[s,i]=(0,j.useState)(!1),o=e.isWizardStep?p.Z.I18n.t("wooCommerceSetupFinishButtonTextWizard"):p.Z.I18n.t("wooCommerceSetupFinishButtonTextStandalone");let l;return"subscribed"===r&&(l=!0),"unsubscribed"===r&&(l=!1),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(je.Z,{level:1,children:p.Z.I18n.t("wooCommerceSetupTitle")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)("p",{children:p.Z.I18n.t("wooCommerceSetupInfo")}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsxs)("form",{onSubmit:n=>(n.preventDefault(),i(!0),null===r||null===t||e.submitForm(r,"true"===t),!1),children:[(0,y.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,y.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,y.jsx)(zc,{showError:s&&null===r,checked:l,onCheck:e=>a(e?"subscribed":"unsubscribed"),name:"mailpoet_woocommerce_import_type",automationId:"woocommerce_import_type"})}),(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{children:k()(p.Z.I18n.t("wooCommerceSetupImportInfo"),/\[link\](.*?)\[\/link\]/,(e=>(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/284-import-old-customers-to-the-woocommerce-customers-list","data-beacon-article":"5d722c7104286364bc8ecf19",rel:"noopener noreferrer",target:"_blank",children:e},e)))}),(0,y.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,y.jsx)("span",{children:"GDPR"}),p.Z.I18n.t("wooCommerceSetupImportGDPRInfo")]})]})]}),(0,y.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,y.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,y.jsx)(zc,{showError:s&&null===t,checked:t,onCheck:e=>n(e),name:"mailpoet_woocommerce_tracking",automationId:"woocommerce_tracking"})}),(0,y.jsxs)("div",{children:[(0,y.jsx)("p",{children:k()(p.Z.I18n.t("wooCommerceSetupTrackingInfo"),/\[link\](.*?)\[\/link\]/,(e=>(0,y.jsx)("a",{href:"https://kb.mailpoet.com/article/280-woocommerce-cookie-tracking","data-beacon-article":"5d5fa44c2c7d3a7a4d778906",rel:"noopener noreferrer",target:"_blank",children:e},e)))}),(0,y.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,y.jsx)("span",{children:"GDPR"}),p.Z.I18n.t("wooCommerceSetupTrackingGDPRInfo")]})]})]}),(0,y.jsx)("div",{className:"mailpoet-gap"}),(0,y.jsx)(v.Z,{isFullWidth:!0,type:"submit",withSpinner:e.loading,disabled:e.loading,automationId:"submit_woocommerce_setup",children:o})]})]})}Xc.propTypes={submitForm:g().func.isRequired,loading:g().bool.isRequired,isWizardStep:g().bool},Xc.defaultProps={isWizardStep:!1};var Jc=Xc;function ed(e){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"mailpoet-wizard-logo",children:(0,y.jsx)("img",{src:window.mailpoet_logo_url,width:"160",height:"50",alt:"MailPoet logo"})}),(0,y.jsx)(Xn,{illustrationUrl:e.illustrationUrl,children:e.children})]})}ed.propTypes={illustrationUrl:g().string.isRequired,children:g().oneOfType([g().arrayOf(g().node),g().node]).isRequired};var td=ed;function nd(e){let{isWizardStep:t=!1}=e;const[n,r]=(0,j.useState)(!1),a=e=>{r(!1),p.Z.Notice.showApiErrorNotice(e,{scroll:!0})},s=()=>p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"setupWooCommerceInitialImport"}).fail(a),i=()=>{window.location=window.finish_wizard_url},o=(0,y.jsx)(td,{illustrationUrl:window.wizard_woocommerce_illustration_url,children:(0,y.jsx)(Jc,{loading:n,submitForm:(e,t)=>{r(!0);const n="basic"===p.Z.settings.tracking.level?"basic":"partial";var o;(o={woocommerce_import_screen_displayed:1,"mailpoet_subscribe_old_woocommerce_customers.enabled":"subscribed"===e?1:0,"tracking.level":t?"full":n,"woocommerce.accept_cookie_revenue_tracking.set":1},p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:o}).fail(a)).then(s).then(i)},isWizardStep:t})});return t?o:(0,y.jsx)(Qc,{children:o})}nd.propTypes={isWizardStep:g().bool},nd.defaultProps={isWizardStep:!1};var rd=nd,ad=e=>{let{name:t,address:n}=e;const r=n.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(r)>-1?(e=>{let{name:t,address:n}=e;const r=`wordpress@${window.location.hostname.replace("www.","")}`;return{sender:{name:t,address:r},reply_to:{name:t,address:n},"signup_confirmation.from.address":r,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":n,"signup_confirmation.reply_to.name":t}})({name:t,address:n}):(e=>{let{name:t,address:n}=e;return{sender:{name:t,address:n},reply_to:{name:t,address:n},"signup_confirmation.from.address":n,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":n,"signup_confirmation.reply_to.name":t}})({name:t,address:n})};const sd=()=>{let e=3;return window.has_mss_key_specified||(e+=1),window.is_woocommerce_active&&(e+=1),e},id=(e,t,n)=>{n<sd()?e.push(`/steps/${n+1}`):t()};var od=n(60054);function ld(e){const t=sd(),n=parseInt(e.match.params.step,10),[r,a]=(0,j.useState)(!1),[s,i]=(0,j.useState)(window.sender_data);function o(){a(!0),window.location=window.finish_wizard_url}(0,j.useEffect)((()=>{(n>t||n<1)&&e.history.push("/steps/1")}),[n,t,e.history]);const l=(0,I.r$)(id,e.history,o);function c(e){return a(!0),p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:e}).then((()=>a(!1))).fail((e=>{a(!1),e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}const d=(0,j.useCallback)(((e,t)=>{a(!0),c({analytics:{enabled:e?"1":""},"3rd_party_libs":{enabled:t?"1":""}}).then((()=>l(n)))}),[l,n]),u=(0,j.useCallback)((e=>{i({...s,...e})}),[s]),m=(0,j.useCallback)((()=>{c(ad(s)).then((()=>l(n)))}),[l,s,n]),h=(0,j.useCallback)((e=>{e.preventDefault(),a(!0),c(ad({address:window.admin_email,name:""})).then((()=>{window.is_woocommerce_active?l(t-1):o()}))}),[l,t]),f=(e=>{const t=!window.is_mp2_migration_complete;return 1===e&&t?"WelcomeWizardSenderStep":1!==e||t?2===e?"WelcomeWizardEmailCourseStep":3===e?"WelcomeWizardUsageTrackingStep":window.is_woocommerce_active&&e===sd()?"WizardWooCommerceStep":"WelcomeWizardPitchMSSStep":"WelcomeWizardMigratedUserStep"})(n);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(od.Z,{count:t,current:n}),(0,y.jsxs)(Qc,{children:["WelcomeWizardSenderStep"===f?(0,y.jsx)(td,{illustrationUrl:window.wizard_sender_illustration_url,children:(0,y.jsx)($c,{update_sender:u,submit_sender:m,finish:h,loading:r,sender:s})}):null,"WelcomeWizardMigratedUserStep"===f?(0,y.jsx)(td,{illustrationUrl:window.wizard_sender_illustration_url,children:(0,y.jsx)(Vc,{next:()=>l(n)})}):null,"WelcomeWizardEmailCourseStep"===f?(0,y.jsx)(td,{illustrationUrl:window.wizard_email_course_illustration_url,children:(0,y.jsx)(Yc,{next:()=>l(n)})}):null,"WelcomeWizardUsageTrackingStep"===f?(0,y.jsx)(td,{illustrationUrl:window.wizard_tracking_illustration_url,children:(0,y.jsx)(Gc,{loading:r,submitForm:d})}):null,"WelcomeWizardPitchMSSStep"===f?(0,y.jsx)(td,{illustrationUrl:window.wizard_MSS_pitch_illustration_url,children:(0,y.jsx)(ir,{next:()=>l(n),subscribersCount:window.subscribers_count,mailpoetAccountUrl:window.mailpoet_account_url,purchaseUrl:p.Z.MailPoetComUrlFactory.getPurchasePlanUrl(p.Z.subscribersCount,p.Z.currentWpUserEmail,"business",{utm_medium:"onboarding",utm_campaign:"purchase"})})}):null,"WizardWooCommerceStep"===f?(0,y.jsx)(rd,{isWizardStep:!0}):null]})]})}ld.propTypes={match:g().shape({params:g().shape({step:g().string}).isRequired}).isRequired,history:g().shape({push:g().func.isRequired}).isRequired};var cd=ld;function dd(){let e="/steps/1";window.location.search.includes("woocommerce-setup")&&(e="/woocommerce");const t=(0,Fe.S)(window);return(0,y.jsx)(Fe.k.Provider,{value:t,children:(0,y.jsxs)(l.UT,{children:[(0,y.jsx)(Ge.Z,{}),(0,y.jsxs)(c.Switch,{children:[(0,y.jsx)(c.Route,{path:"/steps/:step",component:cd}),(0,y.jsx)(c.Route,{path:"/woocommerce",component:rd}),(0,y.jsx)(c.Route,{render:()=>(0,y.jsx)(c.Redirect,{to:e})})]})]})})}const ud=document.getElementById("mailpoet-wizard-container");function pd(){const[e,t]=(0,j.useState)(null),n=(0,Fe.S)(window),r=n.notices.error;function a(a){const s=a.target.name,i=a.target.checked;p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"set",data:{[s]:i?1:0}}).done((()=>{const r=e[s];r.value=i,t({...e,[s]:r});const a=`Feature '${s}' was ${i?"enabled":"disabled"}.`;n.notices.success((0,y.jsx)("p",{children:a}))})).fail((e=>{e.errors.length>0&&r(e.errors.map((e=>(0,y.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}return(0,j.useEffect)((()=>{p.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"getAll"}).done((e=>{const n=e.data.reduce(((e,t)=>({...e,[t.name]:t})),{});t(n)})).fail((e=>{e.errors.length>0&&r((0,y.jsx)(y.Fragment,{children:e.errors.map((e=>(0,y.jsx)("p",{children:e.message})))}),{scroll:!0})}))}),[r]),null===e?(0,y.jsx)("p",{children:"Loading experimental features..."}):0===Object.values(e).length?(0,y.jsx)("p",{children:"There are no experimental features at the moment."}):(0,y.jsx)(Fe.k.Provider,{value:n,children:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Ge.Z,{}),Object.values(e).map((e=>{const t=`experimental-feature-${e.name}`;return(0,y.jsx)("div",{children:(0,y.jsxs)("label",{htmlFor:t,children:[(0,y.jsx)("input",{id:t,type:"checkbox",name:e.name,defaultChecked:e.value,onChange:a})," ",e.name]})},e.name)}))]})})}ud&&o().render((0,y.jsx)(dd,{}),ud);const md=document.getElementById("experimental_features_container");md&&o().render((0,y.jsx)(pd,{}),md);var hd=n(23520);function fd(e){let{message:t,editing:n}=e;return n?(0,y.jsx)("textarea",{value:t,className:"mailpoet-logs-full-message",readOnly:!0}):(0,y.jsx)(y.Fragment,{children:`${t.substr(0,150)}…`})}function gd(e){let{log:t}=e;const[n,r]=(0,j.useState)(!1);return(0,y.jsxs)("tr",{children:[(0,y.jsx)("td",{role:"gridcell",children:t.name}),(0,y.jsx)("td",{onClick:function(e){(function(e){return(e.ctrlKey||e.metaKey)&&!e.altKey})(e)&&(n||r(!0))},role:"gridcell",children:(0,y.jsx)(fd,{message:t.message,editing:n})}),(0,y.jsx)("td",{role:"gridcell",children:p.Z.Date.full(t.created_at)})]},`log-row-${t.id}`)}function vd(e){let{logs:t,onFilter:n,originalFrom:r,originalTo:a,originalSearch:s,originalOffset:i,originalLimit:o}=e;const[l,c]=(0,j.useState)(null!=r?r:void 0),[d,u]=(0,j.useState)(null!=a?a:void 0),[m,h]=(0,j.useState)(null!=i?i:""),[f,g]=(0,j.useState)(null!=o?o:""),[v,b]=(0,j.useState)(s||""),w=(0,Ks.curry)(((e,t)=>{e(null!==t?p.Z.Date.format(t,{format:"Y-m-d"}):void 0)})),x=(0,j.useCallback)((()=>{const e={};l&&(e.from=l),d&&(e.to=d),m&&""!==m.trim()&&(e.offset=m),f&&""!==f.trim()&&(e.limit=f),v&&""!==v.trim()&&(e.search=v.trim()),n(e)}),[l,f,m,v,d,n]);return(0,y.jsxs)("div",{className:"mailpoet-listing mailpoet-logs",children:[(0,y.jsxs)("div",{className:"mailpoet-listing-header",children:[(0,y.jsxs)("div",{className:"mailpoet-listing-search",children:[(0,y.jsx)("label",{htmlFor:"search_input",className:"screen-reader-text",children:p.Z.I18n.t("searchLabel")}),(0,y.jsx)(ae.Z,{dimension:"small",iconStart:hd.Z,type:"search",id:"search_input",name:"s",onChange:e=>b(e.target.value),value:v,placeholder:p.Z.I18n.t("searchLabel")})]}),(0,y.jsxs)("div",{className:"mailpoet-listing-filters",children:[`${p.Z.I18n.t("from")}:`,(0,y.jsx)(It,{dateFormat:"MMMM d, yyyy",onChange:w(c),maxDate:new Date,selected:l?(0,di.default)(l):void 0,dimension:"small"}),`${p.Z.I18n.t("to")}:`,(0,y.jsx)(It,{dateFormat:"MMMM d, yyyy",onChange:w(u),maxDate:new Date,selected:d?(0,di.default)(d):void 0,dimension:"small"})]}),(0,y.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,y.jsx)("label",{htmlFor:"offset_input",className:"screen-reader-text",children:p.Z.I18n.t("offsetLabel")}),(0,y.jsx)(ae.Z,{dimension:"small",id:"offset_input",name:"o",type:"number",onChange:e=>h(e.target.value),value:m,placeholder:p.Z.I18n.t("offsetLabel")})]}),(0,y.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,y.jsx)("label",{htmlFor:"limit_input",className:"screen-reader-text",children:p.Z.I18n.t("limitLabel")}),(0,y.jsx)(ae.Z,{dimension:"small",id:"limit_input",name:"l",type:"number",onChange:e=>g(e.target.value),value:f,placeholder:p.Z.I18n.t("limitLabel")})]}),(0,y.jsx)(Ce.Button,{dimension:"small",onClick:x,children:p.Z.I18n.t("filter")})]}),(0,y.jsxs)("table",{className:"mailpoet-listing-table widefat striped",role:"grid",children:[(0,y.jsx)("thead",{children:(0,y.jsxs)("tr",{children:[(0,y.jsx)("th",{children:p.Z.I18n.t("tableHeaderName")}),(0,y.jsx)("th",{children:p.Z.I18n.t("tableHeaderMessage")}),(0,y.jsx)("th",{children:p.Z.I18n.t("tableHeaderCreatedOn")})]})}),(0,y.jsx)("tbody",{children:t.map((e=>(0,y.jsx)(gd,{log:e},`log-${e.id}`)))})]})]})}const bd=document.getElementById("mailpoet_logs_container");if(bd){const e=new URL(window.location.href);o().render((0,y.jsx)(vd,{logs:window.mailpoet_logs,originalFrom:e.searchParams.get("from"),originalTo:e.searchParams.get("to"),originalSearch:e.searchParams.get("search"),originalOffset:e.searchParams.get("offset"),originalLimit:e.searchParams.get("limit"),onFilter:t=>{e.searchParams.delete("from"),e.searchParams.delete("to"),e.searchParams.delete("search"),e.searchParams.delete("offset"),e.searchParams.delete("limit"),Object.entries(t).forEach((t=>{let[n,r]=t;e.searchParams.append(n,r)})),window.location.href=e.href}}),bd)}var yd=n(13651);function wd(e){let{onRequestClose:t}=e;const[n,r]=(0,j.useState)(!1);return u()((e=>{e(document).on("click",".notice .mailpoet-js-button-fix-this",(()=>{r(!0)}))})),(0,y.jsxs)(Fe.k.Provider,{value:(0,Fe.S)(window),children:[(0,y.jsx)(Ge.Z,{}),n&&(0,y.jsx)(yd.Z,{onRequestClose:()=>{r(!1),t()}})]})}wd.defaultProps={onRequestClose:Ks.noop};const xd=document.getElementById("mailpoet_set_from_address_modal");xd&&o().render((0,y.jsx)(wd,{onRequestClose:()=>{window.location.href.includes("?page=mailpoet-settings")&&window.location.reload()}}),xd);const _d=e=>(async e=>"MailPoet"!==p.Z.mtaMethod||-1!==(await(async()=>"MailPoet"!==p.Z.mtaMethod?[]:(await p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])()).indexOf(e))(e).then((e=>{if(!e)return p.Z.Notice.error(p.Z.I18n.t("mailerSendingNotResumedUnauthorized"),{scroll:!0}),p.Z.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"}),!1;p.Z.Ajax.post({api_version:p.Z.apiVersion,endpoint:"mailer",action:"resumeSending"}).done((()=>{p.Z.Notice.success(p.Z.I18n.t("mailerSendingResumedNotice"))})).fail((e=>{e.errors.length>0&&p.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}));u()((e=>{e(document).on("click",".notice .mailpoet-js-button-resume-sending",(e=>{_d(e.target.value)}))}))},97621:function(e,t){"use strict";function n(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function r(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}}var a={p:r,P:function(e,t){var a,s=e.match(/(P+)(p+)?/)||[],i=s[1],o=s[2];if(!o)return n(e,t);switch(i){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"})}return a.replace("{{date}}",n(i,t)).replace("{{time}}",r(o,t))}};t.Z=a},24262:function(e,t,n){"use strict";function r(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}n.d(t,{Z:function(){return r}})},49702:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(19013),a=n(66979),s=n(7032),i=n(13882);function o(e){(0,i.Z)(1,arguments);var t=(0,s.Z)(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=(0,a.Z)(n);return r}var l=6048e5;function c(e){(0,i.Z)(1,arguments);var t=(0,r.default)(e),n=(0,a.Z)(t).getTime()-o(t).getTime();return Math.round(n/l)+1}},7032:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(19013),a=n(13882),s=n(66979);function i(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getUTCFullYear(),i=new Date(0);i.setUTCFullYear(n+1,0,4),i.setUTCHours(0,0,0,0);var o=(0,s.Z)(i),l=new Date(0);l.setUTCFullYear(n,0,4),l.setUTCHours(0,0,0,0);var c=(0,s.Z)(l);return t.getTime()>=o.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}},23324:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(19013),a=n(59025),s=n(7651),i=n(13882),o=n(83946);function l(e,t){(0,i.Z)(1,arguments);var n=t||{},r=n.locale,l=r&&r.options&&r.options.firstWeekContainsDate,c=null==l?1:(0,o.Z)(l),d=null==n.firstWeekContainsDate?c:(0,o.Z)(n.firstWeekContainsDate),u=(0,s.Z)(e,t),p=new Date(0);p.setUTCFullYear(u,0,d),p.setUTCHours(0,0,0,0);var m=(0,a.Z)(p,t);return m}var c=6048e5;function d(e,t){(0,i.Z)(1,arguments);var n=(0,r.default)(e),s=(0,a.Z)(n,t).getTime()-l(n,t).getTime();return Math.round(s/c)+1}},7651:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(19013),a=n(13882),s=n(59025),i=n(83946);function o(e,t){(0,a.Z)(1,arguments);var n=(0,r.default)(e),o=n.getUTCFullYear(),l=t||{},c=l.locale,d=c&&c.options&&c.options.firstWeekContainsDate,u=null==d?1:(0,i.Z)(d),p=null==l.firstWeekContainsDate?u:(0,i.Z)(l.firstWeekContainsDate);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(o+1,0,p),m.setUTCHours(0,0,0,0);var h=(0,s.Z)(m,t),f=new Date(0);f.setUTCFullYear(o,0,p),f.setUTCHours(0,0,0,0);var g=(0,s.Z)(f,t);return n.getTime()>=h.getTime()?o+1:n.getTime()>=g.getTime()?o:o-1}},5267:function(e,t,n){"use strict";n.d(t,{Iu:function(){return s},Do:function(){return i},qp:function(){return o}});var r=["D","DD"],a=["YY","YYYY"];function s(e){return-1!==r.indexOf(e)}function i(e){return-1!==a.indexOf(e)}function o(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"))}},13882:function(e,t,n){"use strict";function r(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}n.d(t,{Z:function(){return r}})},66979:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=1,n=(0,r.default)(e),s=n.getUTCDay(),i=(s<t?7:0)+s-t;return n.setUTCDate(n.getUTCDate()-i),n.setUTCHours(0,0,0,0),n}},59025:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(19013),a=n(13882),s=n(83946);function i(e,t){(0,a.Z)(1,arguments);var n=t||{},i=n.locale,o=i&&i.options&&i.options.weekStartsOn,l=null==o?0:(0,s.Z)(o),c=null==n.weekStartsOn?l:(0,s.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=(0,r.default)(e),u=d.getUTCDay(),p=(u<c?7:0)+u-c;return d.setUTCDate(d.getUTCDate()-p),d.setUTCHours(0,0,0,0),d}},83946:function(e,t,n){"use strict";function r(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}n.d(t,{Z:function(){return r}})},77349:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return isNaN(i)?new Date(NaN):i?(n.setDate(n.getDate()+i),n):n}},78343:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(83946),a=n(51820),s=n(13882),i=36e5;function o(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.Z)(e,n*i)}},51820:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e).getTime(),i=(0,r.Z)(t);return new Date(n+i)}},58545:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(51820),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.Z)(e,6e4*n)}},11640:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);if(isNaN(i))return new Date(NaN);if(!i)return n;var o=n.getDate(),l=new Date(n.getTime());l.setMonth(n.getMonth()+i+1,0);var c=l.getDate();return o>=c?l:(n.setFullYear(l.getFullYear(),l.getMonth(),o),n)}},63500:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(77349),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t),i=7*n;return(0,a.default)(e,i)}},21593:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(11640),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,12*n)}},36948:function(e,t,n){"use strict";n.d(t,{yJ:function(){return r},vh:function(){return a}}),Math.pow(10,8);var r=6e4,a=36e5},92300:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(24262),a=n(69119),s=n(13882),i=864e5;function o(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),o=(0,a.default)(t),l=n.getTime()-(0,r.Z)(n),c=o.getTime()-(0,r.Z)(o);return Math.round((l-c)/i)}},84129:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t),i=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return 12*i+o}},52724:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(584),a=n(24262),s=n(13882),i=6048e5;function o(e,t,n){(0,s.Z)(2,arguments);var o=(0,r.default)(e,n),l=(0,r.default)(t,n),c=o.getTime()-(0,a.Z)(o),d=l.getTime()-(0,a.Z)(l);return Math.round((c-d)/i)}},91857:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getFullYear()-s.getFullYear()}},57870:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e);return t.setHours(23,59,59,999),t}},4135:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}},67090:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(19013),a=n(83946),s=n(13882);function i(e,t){(0,s.Z)(1,arguments);var n=t||{},i=n.locale,o=i&&i.options&&i.options.weekStartsOn,l=null==o?0:(0,a.Z)(o),c=null==n.weekStartsOn?l:(0,a.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=(0,r.default)(e),u=d.getDay(),p=6+(u<c?-7:0)-(u-c);return d.setDate(d.getDate()+p),d.setHours(23,59,59,999),d}},49546:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return A}});var r=n(12274),a=n(4958),s=n(91218),i=n(19013),o=n(13882),l=864e5,c=n(49702),d=n(7032),u=n(23324),p=n(7651);function m(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var h=function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return m("yy"===t?r%100:r,t.length)},f=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):m(n+1,2)},g=function(e,t){return m(e.getUTCDate(),t.length)},v=function(e,t){return m(e.getUTCHours()%12||12,t.length)},b=function(e,t){return m(e.getUTCHours(),t.length)},y=function(e,t){return m(e.getUTCMinutes(),t.length)},w=function(e,t){return m(e.getUTCSeconds(),t.length)},x=function(e,t){var n=t.length,r=e.getUTCMilliseconds();return m(Math.floor(r*Math.pow(10,n-3)),t.length)};function _(e,t){var n=e>0?"-":"+",r=Math.abs(e),a=Math.floor(r/60),s=r%60;if(0===s)return n+String(a);var i=t||"";return n+String(a)+i+m(s,2)}function Z(e,t){return e%60==0?(e>0?"-":"+")+m(Math.abs(e)/60,2):j(e,t)}function j(e,t){var n=t||"",r=e>0?"-":"+",a=Math.abs(e);return r+m(Math.floor(a/60),2)+n+m(a%60,2)}var I={G:function(e,t,n){var r=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var r=e.getUTCFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return h(e,t)},Y:function(e,t,n,r){var a=(0,p.Z)(e,r),s=a>0?a:1-a;return"YY"===t?m(s%100,2):"Yo"===t?n.ordinalNumber(s,{unit:"year"}):m(s,t.length)},R:function(e,t){return m((0,d.Z)(e),t.length)},u:function(e,t){return m(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return m(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return m(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){var r=e.getUTCMonth();switch(t){case"M":case"MM":return f(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){var r=e.getUTCMonth();switch(t){case"L":return String(r+1);case"LL":return m(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){var a=(0,u.Z)(e,r);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):m(a,t.length)},I:function(e,t,n){var r=(0,c.Z)(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):m(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):g(e,t)},D:function(e,t,n){var r=function(e){(0,o.Z)(1,arguments);var t=(0,i.default)(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),a=n-r;return Math.floor(a/l)+1}(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):m(r,t.length)},E:function(e,t,n){var r=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){var a=e.getUTCDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return m(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){var a=e.getUTCDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return m(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){var r=e.getUTCDay(),a=0===r?7:r;switch(t){case"i":return String(a);case"ii":return m(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){var r,a=e.getUTCHours();switch(r=12===a?"noon":0===a?"midnight":a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){var r,a=e.getUTCHours();switch(r=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var r=e.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return v(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):b(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):m(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):m(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):y(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):w(e,t)},S:function(e,t){return x(e,t)},X:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return Z(a);case"XXXX":case"XX":return j(a);case"XXXXX":case"XXX":default:return j(a,":")}},x:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return Z(a);case"xxxx":case"xx":return j(a);case"xxxxx":case"xxx":default:return j(a,":")}},O:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+_(a,":");case"OOOO":default:return"GMT"+j(a,":")}},z:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+_(a,":");case"zzzz":default:return"GMT"+j(a,":")}},t:function(e,t,n,r){var a=r._originalDate||e;return m(Math.floor(a.getTime()/1e3),t.length)},T:function(e,t,n,r){return m((r._originalDate||e).getTime(),t.length)}},S=n(97621),C=n(24262),T=n(5267),k=n(83946),N=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,D=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,E=/^'([^]*?)'?$/,O=/''/g,R=/[a-zA-Z]/;function A(e,t,n){(0,o.Z)(2,arguments);var l=String(t),c=n||{},d=c.locale||a.Z,u=d.options&&d.options.firstWeekContainsDate,p=null==u?1:(0,k.Z)(u),m=null==c.firstWeekContainsDate?p:(0,k.Z)(c.firstWeekContainsDate);if(!(m>=1&&m<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=d.options&&d.options.weekStartsOn,f=null==h?0:(0,k.Z)(h),g=null==c.weekStartsOn?f:(0,k.Z)(c.weekStartsOn);if(!(g>=0&&g<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!d.localize)throw new RangeError("locale must contain localize property");if(!d.formatLong)throw new RangeError("locale must contain formatLong property");var v=(0,i.default)(e);if(!(0,r.default)(v))throw new RangeError("Invalid time value");var b=(0,C.Z)(v),y=(0,s.Z)(v,b),w={firstWeekContainsDate:m,weekStartsOn:g,locale:d,_originalDate:v},x=l.match(D).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,S.Z[t])(e,d.formatLong,w):e})).join("").match(N).map((function(n){if("''"===n)return"'";var r=n[0];if("'"===r)return P(n);var a=I[r];if(a)return!c.useAdditionalWeekYearTokens&&(0,T.Do)(n)&&(0,T.qp)(n,t,e),!c.useAdditionalDayOfYearTokens&&(0,T.Iu)(n)&&(0,T.qp)(n,t,e),a(y,n,d.localize,w);if(r.match(R))throw new RangeError("Format string contains an unescaped latin alphabet character `"+r+"`");return n})).join("");return x}function P(e){return e.match(E)[1].replace(O,"'")}},55855:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getDate();return n}},20466:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getDay();return n}},85817:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getHours();return n}},9827:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(19013),a=n(584),s=n(13882);function i(e){return(0,s.Z)(1,arguments),(0,a.default)(e,{weekStartsOn:1})}function o(e){(0,s.Z)(1,arguments);var t=(0,r.default)(e),n=t.getFullYear(),a=new Date(0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);var o=i(a),l=new Date(0);l.setFullYear(n,0,4),l.setHours(0,0,0,0);var c=i(l);return t.getTime()>=o.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function l(e){(0,s.Z)(1,arguments);var t=o(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var r=i(n);return r}var c=6048e5;function d(e){(0,s.Z)(1,arguments);var t=(0,r.default)(e),n=i(t).getTime()-l(t).getTime();return Math.round(n/c)+1}},39159:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMinutes();return n}},78966:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMonth();return n}},56605:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=Math.floor(t.getMonth()/3)+1;return n}},77881:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getSeconds();return n}},28789:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getTime();return n}},95570:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){return(0,a.Z)(1,arguments),(0,r.default)(e).getFullYear()}},42699:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()>s.getTime()}},313:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()<s.getTime()}},71381:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return a}});var r=n(13882);function a(e){return(0,r.Z)(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}},96843:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()===s.getTime()}},3151:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(69119),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()===s.getTime()}},49160:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}},86117:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(94431),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getTime()===s.getTime()}},60792:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t);return n.getFullYear()===s.getFullYear()}},12274:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(71381),a=n(19013),s=n(13882);function i(e){if((0,s.Z)(1,arguments),!(0,r.default)(e)&&"number"!=typeof e)return!1;var t=(0,a.default)(e);return!isNaN(Number(t))}},24257:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e,t){(0,a.Z)(2,arguments);var n=(0,r.default)(e).getTime(),s=(0,r.default)(t.start).getTime(),i=(0,r.default)(t.end).getTime();if(!(s<=i))throw new RangeError("Invalid interval");return n>=s&&n<=i}},4958:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function a(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var s={date:a({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:a({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:a({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},i={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function o(e){return function(t,n){var r,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,i=a.width?String(a.width):s;r=e.formattingValues[i]||e.formattingValues[s]}else{var o=e.defaultWidth,l=a.width?String(a.width):e.defaultWidth;r=e.values[l]||e.values[o]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function l(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(a);if(!s)return null;var i,o=s[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(l)?d(l,(function(e){return e.test(o)})):c(l,(function(e){return e.test(o)}));i=e.valueCallback?e.valueCallback(u):u,i=n.valueCallback?n.valueCallback(i):i;var p=t.slice(o.length);return{value:i,rest:p}}}function c(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function d(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var u,p={code:"en-US",formatDistance:function(e,t,n){var a,s=r[e];return a="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:s,formatRelative:function(e,t,n,r){return i[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:o({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:o({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:o({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:o({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:o({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(u={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(u.matchPattern);if(!n)return null;var r=n[0],a=e.match(u.parsePattern);if(!a)return null;var s=u.valueCallback?u.valueCallback(a[0]):a[0];s=t.valueCallback?t.valueCallback(s):s;var i=e.slice(r.length);return{value:s,rest:i}}),era:l({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:l({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:l({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:l({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:l({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}}},99890:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){var t,n;if((0,a.Z)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!=typeof e||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=(0,r.default)(e);(void 0===n||n<t||isNaN(Number(t)))&&(n=t)})),n||new Date(NaN)}},37950:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){var t,n;if((0,a.Z)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!=typeof e||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=(0,r.default)(e);(void 0===n||n>t||isNaN(t.getDate()))&&(n=t)})),n||new Date(NaN)}},45853:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return se}});var r=n(4958),a=n(91218),s=n(19013);function i(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}var o=n(97621),l=n(24262),c=n(5267),d=n(83946),u=n(7651),p=n(13882);function m(e,t,n){(0,p.Z)(2,arguments);var r=n||{},a=r.locale,i=a&&a.options&&a.options.weekStartsOn,o=null==i?0:(0,d.Z)(i),l=null==r.weekStartsOn?o:(0,d.Z)(r.weekStartsOn);if(!(l>=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=(0,s.default)(e),u=(0,d.Z)(t),m=c.getUTCDay(),h=u%7,f=(h+7)%7,g=(f<l?7:0)+u-m;return c.setUTCDate(c.getUTCDate()+g),c}var h=n(49702),f=n(23324),g=n(66979),v=n(59025),b=/^(1[0-2]|0?\d)/,y=/^(3[0-1]|[0-2]?\d)/,w=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,x=/^(5[0-3]|[0-4]?\d)/,_=/^(2[0-3]|[0-1]?\d)/,Z=/^(2[0-4]|[0-1]?\d)/,j=/^(1[0-1]|0?\d)/,I=/^(1[0-2]|0?\d)/,S=/^[0-5]?\d/,C=/^[0-5]?\d/,T=/^\d/,k=/^\d{1,2}/,N=/^\d{1,3}/,D=/^\d{1,4}/,E=/^-?\d+/,O=/^-?\d/,R=/^-?\d{1,2}/,A=/^-?\d{1,3}/,P=/^-?\d{1,4}/,M=/^([+-])(\d{2})(\d{2})?|Z/,L=/^([+-])(\d{2})(\d{2})|Z/,F=/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,q=/^([+-])(\d{2}):(\d{2})|Z/,$=/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/;function U(e,t,n){var r=t.match(e);if(!r)return null;var a=parseInt(r[0],10);return{value:n?n(a):a,rest:t.slice(r[0].length)}}function V(e,t){var n=t.match(e);return n?"Z"===n[0]?{value:0,rest:t.slice(1)}:{value:("+"===n[1]?1:-1)*(36e5*(n[2]?parseInt(n[2],10):0)+6e4*(n[3]?parseInt(n[3],10):0)+1e3*(n[5]?parseInt(n[5],10):0)),rest:t.slice(n[0].length)}:null}function W(e,t){return U(E,e,t)}function Y(e,t,n){switch(e){case 1:return U(T,t,n);case 2:return U(k,t,n);case 3:return U(N,t,n);case 4:return U(D,t,n);default:return U(new RegExp("^\\d{1,"+e+"}"),t,n)}}function B(e,t,n){switch(e){case 1:return U(O,t,n);case 2:return U(R,t,n);case 3:return U(A,t,n);case 4:return U(P,t,n);default:return U(new RegExp("^-?\\d{1,"+e+"}"),t,n)}}function H(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function z(e,t){var n,r=t>0,a=r?t:1-t;if(a<=50)n=e||100;else{var s=a+50;n=e+100*Math.floor(s/100)-(e>=s%100?100:0)}return r?n:1-n}var K=[31,28,31,30,31,30,31,31,30,31,30,31],G=[31,29,31,30,31,30,31,31,30,31,30,31];function Q(e){return e%400==0||e%4==0&&e%100!=0}var X={G:{priority:140,parse:function(e,t,n,r){switch(t){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});case"GGGG":default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}},set:function(e,t,n,r){return t.era=n,e.setUTCFullYear(n,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["R","u","t","T"]},y:{priority:130,parse:function(e,t,n,r){var a=function(e){return{year:e,isTwoDigitYear:"yy"===t}};switch(t){case"y":return Y(4,e,a);case"yo":return n.ordinalNumber(e,{unit:"year",valueCallback:a});default:return Y(t.length,e,a)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,r){var a=e.getUTCFullYear();if(n.isTwoDigitYear){var s=z(n.year,a);return e.setUTCFullYear(s,0,1),e.setUTCHours(0,0,0,0),e}var i="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(i,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","u","w","I","i","e","c","t","T"]},Y:{priority:130,parse:function(e,t,n,r){var a=function(e){return{year:e,isTwoDigitYear:"YY"===t}};switch(t){case"Y":return Y(4,e,a);case"Yo":return n.ordinalNumber(e,{unit:"year",valueCallback:a});default:return Y(t.length,e,a)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,r){var a=(0,u.Z)(e,r);if(n.isTwoDigitYear){var s=z(n.year,a);return e.setUTCFullYear(s,0,r.firstWeekContainsDate),e.setUTCHours(0,0,0,0),(0,v.Z)(e,r)}var i="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(i,0,r.firstWeekContainsDate),e.setUTCHours(0,0,0,0),(0,v.Z)(e,r)},incompatibleTokens:["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:{priority:130,parse:function(e,t,n,r){return B("R"===t?4:t.length,e)},set:function(e,t,n,r){var a=new Date(0);return a.setUTCFullYear(n,0,4),a.setUTCHours(0,0,0,0),(0,g.Z)(a)},incompatibleTokens:["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:{priority:130,parse:function(e,t,n,r){return B("u"===t?4:t.length,e)},set:function(e,t,n,r){return e.setUTCFullYear(n,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["G","y","Y","R","w","I","i","e","c","t","T"]},Q:{priority:120,parse:function(e,t,n,r){switch(t){case"Q":case"QQ":return Y(t.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=1&&t<=4},set:function(e,t,n,r){return e.setUTCMonth(3*(n-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},q:{priority:120,parse:function(e,t,n,r){switch(t){case"q":case"qq":return Y(t.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=1&&t<=4},set:function(e,t,n,r){return e.setUTCMonth(3*(n-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},M:{priority:110,parse:function(e,t,n,r){var a=function(e){return e-1};switch(t){case"M":return U(b,e,a);case"MM":return Y(2,e,a);case"Mo":return n.ordinalNumber(e,{unit:"month",valueCallback:a});case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,r){return e.setUTCMonth(n,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]},L:{priority:110,parse:function(e,t,n,r){var a=function(e){return e-1};switch(t){case"L":return U(b,e,a);case"LL":return Y(2,e,a);case"Lo":return n.ordinalNumber(e,{unit:"month",valueCallback:a});case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,r){return e.setUTCMonth(n,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},w:{priority:100,parse:function(e,t,n,r){switch(t){case"w":return U(x,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=53},set:function(e,t,n,r){return(0,v.Z)(function(e,t,n){(0,p.Z)(2,arguments);var r=(0,s.default)(e),a=(0,d.Z)(t),i=(0,f.Z)(r,n)-a;return r.setUTCDate(r.getUTCDate()-7*i),r}(e,n,r),r)},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:{priority:100,parse:function(e,t,n,r){switch(t){case"I":return U(x,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=53},set:function(e,t,n,r){return(0,g.Z)(function(e,t){(0,p.Z)(2,arguments);var n=(0,s.default)(e),r=(0,d.Z)(t),a=(0,h.Z)(n)-r;return n.setUTCDate(n.getUTCDate()-7*a),n}(e,n,r),r)},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},d:{priority:90,subPriority:1,parse:function(e,t,n,r){switch(t){case"d":return U(y,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return Y(t.length,e)}},validate:function(e,t,n){var r=Q(e.getUTCFullYear()),a=e.getUTCMonth();return r?t>=1&&t<=G[a]:t>=1&&t<=K[a]},set:function(e,t,n,r){return e.setUTCDate(n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","w","I","D","i","e","c","t","T"]},D:{priority:90,subPriority:1,parse:function(e,t,n,r){switch(t){case"D":case"DD":return U(w,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return Y(t.length,e)}},validate:function(e,t,n){return Q(e.getUTCFullYear())?t>=1&&t<=366:t>=1&&t<=365},set:function(e,t,n,r){return e.setUTCMonth(0,n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},E:{priority:90,parse:function(e,t,n,r){switch(t){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,r){return(e=m(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["D","i","e","c","t","T"]},e:{priority:90,parse:function(e,t,n,r){var a=function(e){var t=7*Math.floor((e-1)/7);return(e+r.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return Y(t.length,e,a);case"eo":return n.ordinalNumber(e,{unit:"day",valueCallback:a});case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,r){return(e=m(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},c:{priority:90,parse:function(e,t,n,r){var a=function(e){var t=7*Math.floor((e-1)/7);return(e+r.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return Y(t.length,e,a);case"co":return n.ordinalNumber(e,{unit:"day",valueCallback:a});case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,n){return t>=0&&t<=6},set:function(e,t,n,r){return(e=m(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},i:{priority:90,parse:function(e,t,n,r){var a=function(e){return 0===e?7:e};switch(t){case"i":case"ii":return Y(t.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return n.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||n.day(e,{width:"short",context:"formatting",valueCallback:a})||n.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiii":return n.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiiii":return n.day(e,{width:"short",context:"formatting",valueCallback:a})||n.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiii":default:return n.day(e,{width:"wide",context:"formatting",valueCallback:a})||n.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||n.day(e,{width:"short",context:"formatting",valueCallback:a})||n.day(e,{width:"narrow",context:"formatting",valueCallback:a})}},validate:function(e,t,n){return t>=1&&t<=7},set:function(e,t,n,r){return(e=function(e,t){(0,p.Z)(2,arguments);var n=(0,d.Z)(t);n%7==0&&(n-=7);var r=1,a=(0,s.default)(e),i=a.getUTCDay(),o=((n%7+7)%7<r?7:0)+n-i;return a.setUTCDate(a.getUTCDate()+o),a}(e,n,r)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]},a:{priority:80,parse:function(e,t,n,r){switch(t){case"a":case"aa":case"aaa":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,t,n,r){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["b","B","H","k","t","T"]},b:{priority:80,parse:function(e,t,n,r){switch(t){case"b":case"bb":case"bbb":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,t,n,r){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["a","B","H","k","t","T"]},B:{priority:80,parse:function(e,t,n,r){switch(t){case"B":case"BB":case"BBB":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,t,n,r){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["a","b","t","T"]},h:{priority:70,parse:function(e,t,n,r){switch(t){case"h":return U(I,e);case"ho":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=12},set:function(e,t,n,r){var a=e.getUTCHours()>=12;return a&&n<12?e.setUTCHours(n+12,0,0,0):a||12!==n?e.setUTCHours(n,0,0,0):e.setUTCHours(0,0,0,0),e},incompatibleTokens:["H","K","k","t","T"]},H:{priority:70,parse:function(e,t,n,r){switch(t){case"H":return U(_,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=23},set:function(e,t,n,r){return e.setUTCHours(n,0,0,0),e},incompatibleTokens:["a","b","h","K","k","t","T"]},K:{priority:70,parse:function(e,t,n,r){switch(t){case"K":return U(j,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=11},set:function(e,t,n,r){return e.getUTCHours()>=12&&n<12?e.setUTCHours(n+12,0,0,0):e.setUTCHours(n,0,0,0),e},incompatibleTokens:["h","H","k","t","T"]},k:{priority:70,parse:function(e,t,n,r){switch(t){case"k":return U(Z,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=24},set:function(e,t,n,r){var a=n<=24?n%24:n;return e.setUTCHours(a,0,0,0),e},incompatibleTokens:["a","b","h","H","K","t","T"]},m:{priority:60,parse:function(e,t,n,r){switch(t){case"m":return U(S,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=59},set:function(e,t,n,r){return e.setUTCMinutes(n,0,0),e},incompatibleTokens:["t","T"]},s:{priority:50,parse:function(e,t,n,r){switch(t){case"s":return U(C,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=59},set:function(e,t,n,r){return e.setUTCSeconds(n,0),e},incompatibleTokens:["t","T"]},S:{priority:30,parse:function(e,t,n,r){return Y(t.length,e,(function(e){return Math.floor(e*Math.pow(10,3-t.length))}))},set:function(e,t,n,r){return e.setUTCMilliseconds(n),e},incompatibleTokens:["t","T"]},X:{priority:10,parse:function(e,t,n,r){switch(t){case"X":return V(M,e);case"XX":return V(L,e);case"XXXX":return V(F,e);case"XXXXX":return V($,e);case"XXX":default:return V(q,e)}},set:function(e,t,n,r){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","x"]},x:{priority:10,parse:function(e,t,n,r){switch(t){case"x":return V(M,e);case"xx":return V(L,e);case"xxxx":return V(F,e);case"xxxxx":return V($,e);case"xxx":default:return V(q,e)}},set:function(e,t,n,r){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","X"]},t:{priority:40,parse:function(e,t,n,r){return W(e)},set:function(e,t,n,r){return[new Date(1e3*n),{timestampIsSet:!0}]},incompatibleTokens:"*"},T:{priority:20,parse:function(e,t,n,r){return W(e)},set:function(e,t,n,r){return[new Date(n),{timestampIsSet:!0}]},incompatibleTokens:"*"}},J=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,te=/^'([^]*?)'?$/,ne=/''/g,re=/\S/,ae=/[a-zA-Z]/;function se(e,t,n,u){(0,p.Z)(3,arguments);var m=String(e),h=String(t),f=u||{},g=f.locale||r.Z;if(!g.match)throw new RangeError("locale must contain match property");var v=g.options&&g.options.firstWeekContainsDate,b=null==v?1:(0,d.Z)(v),y=null==f.firstWeekContainsDate?b:(0,d.Z)(f.firstWeekContainsDate);if(!(y>=1&&y<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var w=g.options&&g.options.weekStartsOn,x=null==w?0:(0,d.Z)(w),_=null==f.weekStartsOn?x:(0,d.Z)(f.weekStartsOn);if(!(_>=0&&_<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(""===h)return""===m?(0,s.default)(n):new Date(NaN);var Z,j={firstWeekContainsDate:y,weekStartsOn:_,locale:g},I=[{priority:10,subPriority:-1,set:ie,index:0}],S=h.match(ee).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,o.Z[t])(e,g.formatLong,j):e})).join("").match(J),C=[];for(Z=0;Z<S.length;Z++){var T=S[Z];!f.useAdditionalWeekYearTokens&&(0,c.Do)(T)&&(0,c.qp)(T,h,e),!f.useAdditionalDayOfYearTokens&&(0,c.Iu)(T)&&(0,c.qp)(T,h,e);var k=T[0],N=X[k];if(N){var D=N.incompatibleTokens;if(Array.isArray(D)){for(var E=void 0,O=0;O<C.length;O++){var R=C[O].token;if(-1!==D.indexOf(R)||R===k){E=C[O];break}}if(E)throw new RangeError("The format string mustn't contain `".concat(E.fullToken,"` and `").concat(T,"` at the same time"))}else if("*"===N.incompatibleTokens&&C.length)throw new RangeError("The format string mustn't contain `".concat(T,"` and any other token at the same time"));C.push({token:k,fullToken:T});var A=N.parse(m,T,g.match,j);if(!A)return new Date(NaN);I.push({priority:N.priority,subPriority:N.subPriority||0,set:N.set,validate:N.validate,value:A.value,index:I.length}),m=A.rest}else{if(k.match(ae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+k+"`");if("''"===T?T="'":"'"===k&&(T=oe(T)),0!==m.indexOf(T))return new Date(NaN);m=m.slice(T.length)}}if(m.length>0&&re.test(m))return new Date(NaN);var P=I.map((function(e){return e.priority})).sort((function(e,t){return t-e})).filter((function(e,t,n){return n.indexOf(e)===t})).map((function(e){return I.filter((function(t){return t.priority===e})).sort((function(e,t){return t.subPriority-e.subPriority}))})).map((function(e){return e[0]})),M=(0,s.default)(n);if(isNaN(M))return new Date(NaN);var L=(0,a.Z)(M,(0,l.Z)(M)),F={};for(Z=0;Z<P.length;Z++){var q=P[Z];if(q.validate&&!q.validate(L,q.value,j))return new Date(NaN);var $=q.set(L,F,q.value,j);$[0]?(L=$[0],i(F,$[1])):L=$}return L}function ie(e,t){if(t.timestampIsSet)return e;var n=new Date(0);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}function oe(e){return e.match(te)[1].replace(ne,"'")}},23855:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(36948),a=n(13882),s=n(83946);function i(e,t){(0,a.Z)(1,arguments);var n=t||{},r=null==n.additionalDigits?2:(0,s.Z)(n.additionalDigits);if(2!==r&&1!==r&&0!==r)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var i,o=u(e);if(o.date){var l=p(o.date,r);i=m(l.restDateString,l.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);var c,d=i.getTime(),h=0;if(o.time&&(h=f(o.time),isNaN(h)))return new Date(NaN);if(!o.timezone){var g=new Date(d+h),b=new Date(0);return b.setFullYear(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),b.setHours(g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds()),b}return c=v(o.timezone),isNaN(c)?new Date(NaN):new Date(d+h+c)}var o={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},l=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,c=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,d=/^([+-])(\d{2})(?::?(\d{2}))?$/;function u(e){var t,n={},r=e.split(o.dateTimeDelimiter);if(r.length>2)return n;if(/:/.test(r[0])?t=r[0]:(n.date=r[0],t=r[1],o.timeZoneDelimiter.test(n.date)&&(n.date=e.split(o.timeZoneDelimiter)[0],t=e.substr(n.date.length,e.length))),t){var a=o.timezone.exec(t);a?(n.time=t.replace(a[1],""),n.timezone=a[1]):n.time=t}return n}function p(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};var a=r[1]?parseInt(r[1]):null,s=r[2]?parseInt(r[2]):null;return{year:null===s?a:100*s,restDateString:e.slice((r[1]||r[2]).length)}}function m(e,t){if(null===t)return new Date(NaN);var n=e.match(l);if(!n)return new Date(NaN);var r=!!n[4],a=h(n[1]),s=h(n[2])-1,i=h(n[3]),o=h(n[4]),c=h(n[5])-1;if(r)return function(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}(0,o,c)?function(e,t,n){var r=new Date(0);r.setUTCFullYear(e,0,4);var a=7*(t-1)+n+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+a),r}(t,o,c):new Date(NaN);var d=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(b[t]||(y(e)?29:28))}(t,s,i)&&function(e,t){return t>=1&&t<=(y(e)?366:365)}(t,a)?(d.setUTCFullYear(t,s,Math.max(a,i)),d):new Date(NaN)}function h(e){return e?parseInt(e):1}function f(e){var t=e.match(c);if(!t)return NaN;var n=g(t[1]),a=g(t[2]),s=g(t[3]);return function(e,t,n){return 24===e?0===t&&0===n:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}(n,a,s)?n*r.vh+a*r.yJ+1e3*s:NaN}function g(e){return e&&parseFloat(e.replace(",","."))||0}function v(e){if("Z"===e)return 0;var t=e.match(d);if(!t)return 0;var n="+"===t[1]?-1:1,a=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,s)?n*(a*r.vh+s*r.yJ):NaN}var b=[31,null,31,30,31,30,31,31,30,31,30,31];function y(e){return e%400==0||e%4==0&&e%100!=0}},37042:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return n.setHours(i),n}},4543:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return n.setMinutes(i),n}},62225:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(83946),a=n(19013),s=n(13882);function i(e){(0,s.Z)(1,arguments);var t=(0,a.default)(e),n=t.getFullYear(),r=t.getMonth(),i=new Date(0);return i.setFullYear(n,r+1,0),i.setHours(0,0,0,0),i.getDate()}function o(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),o=(0,r.Z)(t),l=n.getFullYear(),c=n.getDate(),d=new Date(0);d.setFullYear(l,o,15),d.setHours(0,0,0,0);var u=i(d);return n.setMonth(o,Math.min(c,u)),n}},11503:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(83946),a=n(19013),s=n(62225),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,a.default)(e),o=(0,r.Z)(t),l=Math.floor(n.getMonth()/3)+1,c=o-l;return(0,s.default)(n,n.getMonth()+3*c)}},39880:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return n.setSeconds(i),n}},44749:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(19013),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,a.default)(e),i=(0,r.Z)(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(i),n)}},69119:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e);return t.setHours(0,0,0,0),t}},43703:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e);return t.setDate(1),t.setHours(0,0,0,0),t}},94431:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=t.getMonth(),s=n-n%3;return t.setMonth(s,1),t.setHours(0,0,0,0),t}},584:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(19013),a=n(83946),s=n(13882);function i(e,t){(0,s.Z)(1,arguments);var n=t||{},i=n.locale,o=i&&i.options&&i.options.weekStartsOn,l=null==o?0:(0,a.Z)(o),c=null==n.weekStartsOn?l:(0,a.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=(0,r.default)(e),u=d.getDay(),p=(u<c?7:0)+u-c;return d.setDate(d.getDate()-p),d.setHours(0,0,0,0),d}},38148:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(19013),a=n(13882);function s(e){(0,a.Z)(1,arguments);var t=(0,r.default)(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}},7069:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(77349),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},88330:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(78343),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},91218:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(83946),a=n(51820),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.Z)(e,-n)}},1784:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(58545),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},54559:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(11640),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},77982:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(63500),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},59319:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(83946),a=n(21593),s=n(13882);function i(e,t){(0,s.Z)(2,arguments);var n=(0,r.Z)(t);return(0,a.default)(e,-n)}},19013:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return a}});var r=n(13882);function a(e){(0,r.Z)(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}},16245:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,n){var r,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,i=a.width?String(a.width):s;r=e.formattingValues[i]||e.formattingValues[s]}else{var o=e.defaultWidth,l=a.width?String(a.width):e.defaultWidth;r=e.values[l]||e.values[o]}return r[e.argumentCallback?e.argumentCallback(t):t]}},e.exports=t.default},57460:function(e,t){var n,r;void 0===(r="function"==typeof(n=function e(){"use strict";var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,r=n&&/blob:/i.test((t.location||{}).protocol),a={},s=0,i={parse:function(n,r){var o=(r=r||{}).dynamicTyping||!1;if(x(o)&&(r.dynamicTypingFunction=o,o={}),r.dynamicTyping=o,r.transform=!!x(r.transform)&&r.transform,r.worker&&i.WORKERS_SUPPORTED){var l=function(){if(!i.WORKERS_SUPPORTED)return!1;var n,r,o=(n=t.URL||t.webkitURL||null,r=e.toString(),i.BLOB_URL||(i.BLOB_URL=n.createObjectURL(new Blob(["(",r,")();"],{type:"text/javascript"})))),l=new t.Worker(o);return l.onmessage=g,l.id=s++,a[l.id]=l}();return l.userStep=r.step,l.userChunk=r.chunk,l.userComplete=r.complete,l.userError=r.error,r.step=x(r.step),r.chunk=x(r.chunk),r.complete=x(r.complete),r.error=x(r.error),delete r.worker,void l.postMessage({input:n,config:r,workerId:l.id})}var m=null;return i.NODE_STREAM_INPUT,"string"==typeof n?m=r.download?new c(r):new u(r):!0===n.readable&&x(n.read)&&x(n.on)?m=new p(r):(t.File&&n instanceof File||n instanceof Object)&&(m=new d(r)),m.stream(n)},unparse:function(e,t){var n=!1,r=!0,a=",",s="\r\n",o='"',l=o+o,c=!1,d=null,u=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||i.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(a=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(o=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");d=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+o),"boolean"==typeof t.escapeFormulae&&(u=t.escapeFormulae)}}();var p=new RegExp(h(o),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return m(null,e,c);if("object"==typeof e[0])return m(d||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),m(e.fields||[],e.data||[],c);throw new Error("Unable to serialize unrecognized input");function m(e,t,n){var i="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var o=Array.isArray(e)&&0<e.length,l=!Array.isArray(t[0]);if(o&&r){for(var c=0;c<e.length;c++)0<c&&(i+=a),i+=f(e[c],c);0<t.length&&(i+=s)}for(var d=0;d<t.length;d++){var u=o?e.length:t[d].length,p=!1,m=o?0===Object.keys(t[d]).length:0===t[d].length;if(n&&!o&&(p="greedy"===n?""===t[d].join("").trim():1===t[d].length&&0===t[d][0].length),"greedy"===n&&o){for(var h=[],g=0;g<u;g++){var v=l?e[g]:g;h.push(t[d][v])}p=""===h.join("").trim()}if(!p){for(var b=0;b<u;b++){0<b&&!m&&(i+=a);var y=o&&l?e[b]:b;i+=f(t[d][y],b)}d<t.length-1&&(!n||0<u&&!m)&&(i+=s)}}return i}function f(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);!0===u&&"string"==typeof e&&null!==e.match(/^[=+\-@].*$/)&&(e="'"+e);var r=e.toString().replace(p,l);return"boolean"==typeof n&&n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1}(r,i.BAD_DELIMITERS)||-1<r.indexOf(a)||" "===r.charAt(0)||" "===r.charAt(r.length-1)?o+r+o:r}}};if(i.RECORD_SEP=String.fromCharCode(30),i.UNIT_SEP=String.fromCharCode(31),i.BYTE_ORDER_MARK="\ufeff",i.BAD_DELIMITERS=["\r","\n",'"',i.BYTE_ORDER_MARK],i.WORKERS_SUPPORTED=!n&&!!t.Worker,i.NODE_STREAM_INPUT=1,i.LocalChunkSize=10485760,i.RemoteChunkSize=5242880,i.DefaultDelimiter=",",i.Parser=f,i.ParserHandle=m,i.NetworkStreamer=c,i.FileStreamer=d,i.StringStreamer=u,i.ReadableStreamStreamer=p,t.jQuery){var o=t.jQuery;o.fn.parse=function(e){var n=e.config||{},r=[];return this.each((function(e){if("INPUT"!==o(this).prop("tagName").toUpperCase()||"file"!==o(this).attr("type").toLowerCase()||!t.FileReader||!this.files||0===this.files.length)return!0;for(var a=0;a<this.files.length;a++)r.push({file:this.files[a],inputElem:this,instanceConfig:o.extend({},n)})})),a(),this;function a(){if(0!==r.length){var t,n,a,l=r[0];if(x(e.before)){var c=e.before(l.file,l.inputElem);if("object"==typeof c){if("abort"===c.action)return"AbortError",t=l.file,n=l.inputElem,a=c.reason,void(x(e.error)&&e.error({name:"AbortError"},t,n,a));if("skip"===c.action)return void s();"object"==typeof c.config&&(l.instanceConfig=o.extend(l.instanceConfig,c.config))}else if("skip"===c)return void s()}var d=l.instanceConfig.complete;l.instanceConfig.complete=function(e){x(d)&&d(e,l.file,l.inputElem),s()},i.parse(l.file,l.instanceConfig)}else x(e.complete)&&e.complete()}function s(){r.splice(0,1),a()}}}function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=y(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new m(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&x(this._config.beforeFirstChunk)){var a=this._config.beforeFirstChunk(e);void 0!==a&&(e=a)}this.isFirstChunk=!1,this._halted=!1;var s=this._partialLine+e;this._partialLine="";var o=this._handle.parse(s,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=o.meta.cursor;this._finished||(this._partialLine=s.substring(l-this._baseIndex),this._baseIndex=l),o&&o.data&&(this._rowCount+=o.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)t.postMessage({results:o,workerId:i.WORKER_ID,finished:c});else if(x(this._config.chunk)&&!n){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!c||!x(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(e){x(this._config.error)?this._config.error(e):r&&this._config.error&&t.postMessage({workerId:i.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=i.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=w(this._chunkLoaded,this),t.onerror=w(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var r in e)t.setRequestHeader(r,e[r])}if(this._config.chunkSize){var a=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+a)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var n=t.statusText||e;this._sendError(new Error(n))}}function d(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=i.LocalChunkSize),l.call(this,e);var r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=w(this._chunkLoaded,this),t.onerror=w(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var a=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,a)}var s=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:s}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,n=this._config.chunkSize;return n?(e=t.substring(0,n),t=t.substring(n)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function p(e){l.call(this,e=e||{});var t=[],n=!0,r=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=w((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=w((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=w((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=w((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function m(e){var t,n,r,a=Math.pow(2,53),s=-a,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,l=/^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/,c=this,d=0,u=0,p=!1,m=!1,g=[],v={data:[],errors:[],meta:{}};if(x(e.step)){var b=e.step;e.step=function(t){if(v=t,Z())_();else{if(_(),0===v.data.length)return;d+=t.data.length,e.preview&&d>e.preview?n.abort():(v.data=v.data[0],b(v,c))}}}function w(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function _(){if(v&&r&&(I("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+i.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines)for(var t=0;t<v.data.length;t++)w(v.data[t])&&v.data.splice(t--,1);return Z()&&function(){if(v)if(Array.isArray(v.data[0])){for(var t=0;Z()&&t<v.data.length;t++)v.data[t].forEach(n);v.data.splice(0,1)}else v.data.forEach(n);function n(t,n){x(e.transformHeader)&&(t=e.transformHeader(t,n)),g.push(t)}}(),function(){if(!v||!e.header&&!e.dynamicTyping&&!e.transform)return v;function t(t,n){var r,a=e.header?{}:[];for(r=0;r<t.length;r++){var s=r,i=t[r];e.header&&(s=r>=g.length?"__parsed_extra":g[r]),e.transform&&(i=e.transform(i,s)),i=j(s,i),"__parsed_extra"===s?(a[s]=a[s]||[],a[s].push(i)):a[s]=i}return e.header&&(r>g.length?I("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+r,u+n):r<g.length&&I("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+r,u+n)),a}var n=1;return!v.data.length||Array.isArray(v.data[0])?(v.data=v.data.map(t),n=v.data.length):v.data=t(v.data,0),e.header&&v.meta&&(v.meta.fields=g),u+=n,v}()}function Z(){return e.header&&0===g.length}function j(t,n){return r=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(o.test(e)){var t=parseFloat(e);if(s<t&&t<a)return!0}return!1}(n)?parseFloat(n):l.test(n)?new Date(n):""===n?null:n):n;var r}function I(e,t,n,r){var a={type:e,code:t,message:n};void 0!==r&&(a.row=r),v.errors.push(a)}this.parse=function(a,s,o){var l=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substring(0,1048576);var n=new RegExp(h(t)+"([^]*?)"+h(t),"gm"),r=(e=e.replace(n,"")).split("\r"),a=e.split("\n"),s=1<a.length&&a[0].length<r[0].length;if(1===r.length||s)return"\n";for(var i=0,o=0;o<r.length;o++)"\n"===r[o][0]&&i++;return i>=r.length/2?"\r\n":"\r"}(a,l)),r=!1,e.delimiter)x(e.delimiter)&&(e.delimiter=e.delimiter(a),v.meta.delimiter=e.delimiter);else{var c=function(t,n,r,a,s){var o,l,c,d;s=s||[",","\t","|",";",i.RECORD_SEP,i.UNIT_SEP];for(var u=0;u<s.length;u++){var p=s[u],m=0,h=0,g=0;c=void 0;for(var v=new f({comments:a,delimiter:p,newline:n,preview:10}).parse(t),b=0;b<v.data.length;b++)if(r&&w(v.data[b]))g++;else{var y=v.data[b].length;h+=y,void 0!==c?0<y&&(m+=Math.abs(y-c),c=y):c=y}0<v.data.length&&(h/=v.data.length-g),(void 0===l||m<=l)&&(void 0===d||d<h)&&1.99<h&&(l=m,o=p,d=h)}return{successful:!!(e.delimiter=o),bestDelimiter:o}}(a,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(r=!0,e.delimiter=i.DefaultDelimiter),v.meta.delimiter=e.delimiter}var d=y(e);return e.preview&&e.header&&d.preview++,t=a,n=new f(d),v=n.parse(t,s,o),_(),p?{meta:{paused:!0}}:v||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,n.abort(),t=x(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(p=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return m},this.abort=function(){m=!0,n.abort(),v.meta.aborted=!0,x(e.complete)&&e.complete(v),t=""}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function f(e){var t,n=(e=e||{}).delimiter,r=e.newline,a=e.comments,s=e.step,o=e.preview,l=e.fastMode,c=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof n||-1<i.BAD_DELIMITERS.indexOf(n))&&(n=","),a===n)throw new Error("Comment character same as delimiter");!0===a?a="#":("string"!=typeof a||-1<i.BAD_DELIMITERS.indexOf(a))&&(a=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var d=0,u=!1;this.parse=function(e,i,p){if("string"!=typeof e)throw new Error("Input must be a string");var m=e.length,f=n.length,g=r.length,v=a.length,b=x(s),y=[],w=[],_=[],Z=d=0;if(!e)return P();if(l||!1!==l&&-1===e.indexOf(t)){for(var j=e.split(r),I=0;I<j.length;I++){if(_=j[I],d+=_.length,I!==j.length-1)d+=r.length;else if(p)return P();if(!a||_.substring(0,v)!==a){if(b){if(y=[],E(_.split(n)),M(),u)return P()}else E(_.split(n));if(o&&o<=I)return y=y.slice(0,o),P(!0)}}return P()}for(var S=e.indexOf(n,d),C=e.indexOf(r,d),T=new RegExp(h(c)+h(t),"g"),k=e.indexOf(t,d);;)if(e[d]!==t)if(a&&0===_.length&&e.substring(d,d+v)===a){if(-1===C)return P();d=C+g,C=e.indexOf(r,d),S=e.indexOf(n,d)}else if(-1!==S&&(S<C||-1===C))_.push(e.substring(d,S)),d=S+f,S=e.indexOf(n,d);else{if(-1===C)break;if(_.push(e.substring(d,C)),A(C+g),b&&(M(),u))return P();if(o&&y.length>=o)return P(!0)}else for(k=d,d++;;){if(-1===(k=e.indexOf(t,k+1)))return p||w.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:y.length,index:d}),R();if(k===m-1)return R(e.substring(d,k).replace(T,t));if(t!==c||e[k+1]!==c){if(t===c||0===k||e[k-1]!==c){-1!==S&&S<k+1&&(S=e.indexOf(n,k+1)),-1!==C&&C<k+1&&(C=e.indexOf(r,k+1));var N=O(-1===C?S:Math.min(S,C));if(e[k+1+N]===n){_.push(e.substring(d,k).replace(T,t)),e[d=k+1+N+f]!==t&&(k=e.indexOf(t,d)),S=e.indexOf(n,d),C=e.indexOf(r,d);break}var D=O(C);if(e.substring(k+1+D,k+1+D+g)===r){if(_.push(e.substring(d,k).replace(T,t)),A(k+1+D+g),S=e.indexOf(n,d),k=e.indexOf(t,d),b&&(M(),u))return P();if(o&&y.length>=o)return P(!0);break}w.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:y.length,index:d}),k++}}else k++}return R();function E(e){y.push(e),Z=d}function O(t){var n=0;if(-1!==t){var r=e.substring(k+1,t);r&&""===r.trim()&&(n=r.length)}return n}function R(t){return p||(void 0===t&&(t=e.substring(d)),_.push(t),d=m,E(_),b&&M()),P()}function A(t){d=t,E(_),_=[],C=e.indexOf(r,d)}function P(e){return{data:y,errors:w,meta:{delimiter:n,linebreak:r,aborted:u,truncated:!!e,cursor:Z+(i||0)}}}function M(){s(P()),y=[],w=[]}},this.abort=function(){u=!0},this.getCharIndex=function(){return d}}function g(e){var t=e.data,n=a[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var s={abort:function(){r=!0,v(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:b,resume:b};if(x(n.userStep)){for(var i=0;i<t.results.data.length&&(n.userStep({data:t.results.data[i],errors:t.results.errors,meta:t.results.meta},s),!r);i++);delete t.results}else x(n.userChunk)&&(n.userChunk(t.results,s,t.file),delete t.results)}t.finished&&!r&&v(t.workerId,t.results)}function v(e,t){var n=a[e];x(n.userComplete)&&n.userComplete(t),n.terminate(),delete a[e]}function b(){throw new Error("Not implemented.")}function y(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=y(e[n]);return t}function w(e,t){return function(){e.apply(t,arguments)}}function x(e){return"function"==typeof e}return r&&(t.onmessage=function(e){var n=e.data;if(void 0===i.WORKER_ID&&n&&(i.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:i.WORKER_ID,results:i.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var r=i.parse(n.input,n.config);r&&t.postMessage({workerId:i.WORKER_ID,results:r,finished:!0})}}),(c.prototype=Object.create(l.prototype)).constructor=c,(d.prototype=Object.create(l.prototype)).constructor=d,(u.prototype=Object.create(u.prototype)).constructor=u,(p.prototype=Object.create(l.prototype)).constructor=p,i})?n.apply(t,[]):n)||(e.exports=r)},9198:function(e,t,n){!function(e,t,r,a,s,i,o,l,c,d,u,p,m,h,f,g,v,b,y,w,x,_,Z,j,I,S,C,T,k,N,D,E,O,R,A,P,M,L,F,q,$,U,V,W,Y,B,H,z,K,G,Q,X,J,ee,te,ne,re,ae,se,ie,oe,le,ce){"use strict";function de(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var ue=de(t),pe=de(a),me=de(s),he=de(i),fe=de(o),ge=de(l),ve=de(c),be=de(d),ye=de(u),we=de(p),xe=de(m),_e=de(g),Ze=de(v),je=de(b),Ie=de(y),Se=de(w),Ce=de(x),Te=de(_),ke=de(Z),Ne=de(j),De=de(I),Ee=de(S),Oe=de(C),Re=de(T),Ae=de(k),Pe=de(N),Me=de(D),Le=de(E),Fe=de(O),qe=de(R),$e=de(A),Ue=de(P),Ve=de(M),We=de(L),Ye=de(F),Be=de($),He=de(U),ze=de(V),Ke=de(W),Ge=de(Y),Qe=de(B),Xe=de(H),Je=de(G),et=de(Q),tt=de(X),nt=de(J),rt=de(ee),at=de(te),st=de(ne),it=de(re),ot=de(ae),lt=de(se),ct=de(ie),dt=de(oe),ut=de(le);function pt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function mt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pt(Object(n),!0).forEach((function(t){bt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ht(e){return(ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ft(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function vt(e,t,n){return t&&gt(e.prototype,t),n&&gt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function bt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yt(){return(yt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function wt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&_t(e,t)}function xt(e){return(xt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _t(e,t){return(_t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jt(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Zt(e)}function It(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=xt(e);if(t){var a=xt(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return jt(this,n)}}function St(e){return function(e){if(Array.isArray(e))return Ct(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Tt(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function kt(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}}var Nt={p:kt,P:function(e,t){var n,r=e.match(/(P+)(p+)?/)||[],a=r[1],s=r[2];if(!s)return Tt(e,t);switch(a){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;case"PPPP":default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Tt(a,t)).replace("{{time}}",kt(s,t))}},Dt=12,Et=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;function Ot(e){var t=e?"string"==typeof e||e instanceof String?ct.default(e):ot.default(e):new Date;return At(t)?t:null}function Rt(e,t,n,r,a){var s=null,i=Jt(n)||Jt(Xt()),o=!0;return Array.isArray(t)?(t.forEach((function(t){var n=lt.default(e,t,new Date,{locale:i});r&&(o=At(n,a)&&e===fe.default(n,t,{awareOfUnicodeTokens:!0})),At(n,a)&&o&&(s=n)})),s):(s=lt.default(e,t,new Date,{locale:i}),r?o=At(s)&&e===fe.default(s,t,{awareOfUnicodeTokens:!0}):At(s)||(t=t.match(Et).map((function(e){var t=e[0];return"p"===t||"P"===t?i?(0,Nt[t])(e,i.formatLong):t:e})).join(""),e.length>0&&(s=lt.default(e,t.slice(0,e.length),new Date)),At(s)||(s=new Date(e))),At(s)&&o?s:null)}function At(e,t){return t=t||new Date("1/1/1000"),he.default(e)&&!st.default(e,t)}function Pt(e,t,n){if("en"===n)return fe.default(e,t,{awareOfUnicodeTokens:!0});var r=Jt(n);return n&&!r&&console.warn('A locale object was not found for the provided string ["'.concat(n,'"].')),!r&&Xt()&&Jt(Xt())&&(r=Jt(Xt())),fe.default(e,t,{locale:r||null,awareOfUnicodeTokens:!0})}function Mt(e,t){var n=t.dateFormat,r=t.locale;return e&&Pt(e,Array.isArray(n)?n[0]:n,r)||""}function Lt(e,t){var n=t.hour,r=void 0===n?0:n,a=t.minute,s=void 0===a?0:a,i=t.second,o=void 0===i?0:i;return Le.default(Me.default(Pe.default(e,o),s),r)}function Ft(e,t){var n=t&&Jt(t)||Xt()&&Jt(Xt());return De.default(e,n?{locale:n}:null)}function qt(e,t){return Pt(e,"ddd",t)}function $t(e){return He.default(e)}function Ut(e,t,n){var r=Jt(t||Xt());return ze.default(e,{locale:r,weekStartsOn:n})}function Vt(e){return Ke.default(e)}function Wt(e){return Qe.default(e)}function Yt(e){return Ge.default(e)}function Bt(e,t){return e&&t?nt.default(e,t):!e&&!t}function Ht(e,t){return e&&t?tt.default(e,t):!e&&!t}function zt(e,t){return e&&t?rt.default(e,t):!e&&!t}function Kt(e,t){return e&&t?et.default(e,t):!e&&!t}function Gt(e,t){return e&&t?Je.default(e,t):!e&&!t}function Qt(e,t,n){var r,a=He.default(t),s=Xe.default(n);try{r=it.default(e,{start:a,end:s})}catch(e){r=!1}return r}function Xt(){return("undefined"!=typeof window?window:n.g).__localeId__}function Jt(e){if("string"==typeof e){var t="undefined"!=typeof window?window:n.g;return t.__localeData__?t.__localeData__[e]:null}return e}function en(e,t){return Pt(Fe.default(Ot(),e),"LLLL",t)}function tn(e,t){return Pt(Fe.default(Ot(),e),"LLL",t)}function nn(e,t){return Pt(qe.default(Ot(),e),"QQQ",t)}function rn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate,a=t.excludeDates,s=t.excludeDateIntervals,i=t.includeDates,o=t.includeDateIntervals,l=t.filterDate;return un(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return Kt(e,t)}))||s&&s.some((function(t){var n=t.start,r=t.end;return it.default(e,{start:n,end:r})}))||i&&!i.some((function(t){return Kt(e,t)}))||o&&!o.some((function(t){var n=t.start,r=t.end;return it.default(e,{start:n,end:r})}))||l&&!l(Ot(e))||!1}function an(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeDates,r=t.excludeDateIntervals;return r&&r.length>0?r.some((function(t){var n=t.start,r=t.end;return it.default(e,{start:n,end:r})})):n&&n.some((function(t){return Kt(e,t)}))||!1}function sn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate,a=t.excludeDates,s=t.includeDates,i=t.filterDate;return un(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return Ht(e,t)}))||s&&!s.some((function(t){return Ht(e,t)}))||i&&!i(Ot(e))||!1}function on(e,t,n,r){var a=Re.default(e),s=Ee.default(e),i=Re.default(t),o=Ee.default(t),l=Re.default(r);return a===i&&a===l?s<=n&&n<=o:a<i?l===a&&s<=n||l===i&&o>=n||l<i&&l>a:void 0}function ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate,a=t.excludeDates,s=t.includeDates,i=t.filterDate;return un(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return zt(e,t)}))||s&&!s.some((function(t){return zt(e,t)}))||i&&!i(Ot(e))||!1}function cn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate;return un(new Date(e,0,1),{minDate:n,maxDate:r})||!1}function dn(e,t,n,r){var a=Re.default(e),s=Oe.default(e),i=Re.default(t),o=Oe.default(t),l=Re.default(r);return a===i&&a===l?s<=n&&n<=o:a<i?l===a&&s<=n||l===i&&o>=n||l<i&&l>a:void 0}function un(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate;return n&&We.default(e,n)<0||r&&We.default(e,r)>0}function pn(e,t){return t.some((function(t){return Te.default(t)===Te.default(e)&&Ce.default(t)===Ce.default(e)}))}function mn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeTimes,r=t.includeTimes,a=t.filterTime;return n&&pn(e,n)||r&&!pn(e,r)||a&&!a(e)||!1}function hn(e,t){var n=t.minTime,r=t.maxTime;if(!n||!r)throw new Error("Both minTime and maxTime props required");var a,s=Ot(),i=Le.default(Me.default(s,Ce.default(e)),Te.default(e)),o=Le.default(Me.default(s,Ce.default(n)),Te.default(n)),l=Le.default(Me.default(s,Ce.default(r)),Te.default(r));try{a=!it.default(i,{start:o,end:l})}catch(e){a=!1}return a}function fn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.includeDates,a=je.default(e,1);return n&&Ye.default(n,a)>0||r&&r.every((function(e){return Ye.default(e,a)>0}))||!1}function gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.includeDates,a=we.default(e,1);return n&&Ye.default(a,n)>0||r&&r.every((function(e){return Ye.default(a,e)>0}))||!1}function vn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.includeDates,a=Ie.default(e,1);return n&&Be.default(n,a)>0||r&&r.every((function(e){return Be.default(e,a)>0}))||!1}function bn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.includeDates,a=xe.default(e,1);return n&&Be.default(a,n)>0||r&&r.every((function(e){return Be.default(a,e)>0}))||!1}function yn(e){var t=e.minDate,n=e.includeDates;if(n&&t){var r=n.filter((function(e){return We.default(e,t)>=0}));return Ue.default(r)}return n?Ue.default(n):t}function wn(e){var t=e.maxDate,n=e.includeDates;if(n&&t){var r=n.filter((function(e){return We.default(e,t)<=0}));return Ve.default(r)}return n?Ve.default(n):t}function xn(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"react-datepicker__day--highlighted",n=new Map,r=0,a=e.length;r<a;r++){var s=e[r];if(me.default(s)){var i=Pt(s,"MM.dd.yyyy"),o=n.get(i)||[];o.includes(t)||(o.push(t),n.set(i,o))}else if("object"===ht(s)){var l=Object.keys(s),c=l[0],d=s[l[0]];if("string"==typeof c&&d.constructor===Array)for(var u=0,p=d.length;u<p;u++){var m=Pt(d[u],"MM.dd.yyyy"),h=n.get(m)||[];h.includes(c)||(h.push(c),n.set(m,h))}}}return n}function _n(e,t,n,r,a){for(var s=a.length,i=[],o=0;o<s;o++){var l=ge.default(ve.default(e,Te.default(a[o])),Ce.default(a[o])),c=ge.default(e,(n+1)*r);at.default(l,t)&&st.default(l,c)&&i.push(a[o])}return i}function Zn(e){return e<10?"0".concat(e):"".concat(e)}function jn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Dt,n=Math.ceil(Re.default(e)/t)*t;return{startPeriod:n-(t-1),endPeriod:n}}function In(e,t,n,r){for(var a=[],s=0;s<2*t+1;s++){var i=e+t-s,o=!0;n&&(o=Re.default(n)<=i),r&&o&&(o=Re.default(r)>=i),o&&a.push(i)}return a}var Sn=function(e){wt(r,e);var n=It(r);function r(e){var a;ft(this,r),bt(Zt(a=n.call(this,e)),"renderOptions",(function(){var e=a.props.year,t=a.state.yearsList.map((function(t){return ue.default.createElement("div",{className:e===t?"react-datepicker__year-option react-datepicker__year-option--selected_year":"react-datepicker__year-option",key:t,onClick:a.onChange.bind(Zt(a),t),"aria-selected":e===t?"true":void 0},e===t?ue.default.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",t)})),n=a.props.minDate?Re.default(a.props.minDate):null,r=a.props.maxDate?Re.default(a.props.maxDate):null;return r&&a.state.yearsList.find((function(e){return e===r}))||t.unshift(ue.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:a.incrementYears},ue.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),n&&a.state.yearsList.find((function(e){return e===n}))||t.push(ue.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:a.decrementYears},ue.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t})),bt(Zt(a),"onChange",(function(e){a.props.onChange(e)})),bt(Zt(a),"handleClickOutside",(function(){a.props.onCancel()})),bt(Zt(a),"shiftYears",(function(e){var t=a.state.yearsList.map((function(t){return t+e}));a.setState({yearsList:t})})),bt(Zt(a),"incrementYears",(function(){return a.shiftYears(1)})),bt(Zt(a),"decrementYears",(function(){return a.shiftYears(-1)}));var s=e.yearDropdownItemNumber,i=e.scrollableYearDropdown,o=s||(i?10:5);return a.state={yearsList:In(a.props.year,o,a.props.minDate,a.props.maxDate)},a.dropdownRef=t.createRef(),a}return vt(r,[{key:"componentDidMount",value:function(){var e=this.dropdownRef.current;e&&(e.scrollTop=e.scrollHeight/2-e.clientHeight/2)}},{key:"render",value:function(){var e=pe.default({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return ue.default.createElement("div",{className:e,ref:this.dropdownRef},this.renderOptions())}}]),r}(ue.default.Component),Cn=dt.default(Sn),Tn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),bt(Zt(e),"renderSelectOptions",(function(){for(var t=e.props.minDate?Re.default(e.props.minDate):1900,n=e.props.maxDate?Re.default(e.props.maxDate):2100,r=[],a=t;a<=n;a++)r.push(ue.default.createElement("option",{key:a,value:a},a));return r})),bt(Zt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),bt(Zt(e),"renderSelectMode",(function(){return ue.default.createElement("select",{value:e.props.year,className:"react-datepicker__year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),bt(Zt(e),"renderReadView",(function(t){return ue.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__year-read-view",onClick:function(t){return e.toggleDropdown(t)}},ue.default.createElement("span",{className:"react-datepicker__year-read-view--down-arrow"}),ue.default.createElement("span",{className:"react-datepicker__year-read-view--selected-year"},e.props.year))})),bt(Zt(e),"renderDropdown",(function(){return ue.default.createElement(Cn,{key:"dropdown",year:e.props.year,onChange:e.onChange,onCancel:e.toggleDropdown,minDate:e.props.minDate,maxDate:e.props.maxDate,scrollableYearDropdown:e.props.scrollableYearDropdown,yearDropdownItemNumber:e.props.yearDropdownItemNumber})})),bt(Zt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),bt(Zt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.year&&e.props.onChange(t)})),bt(Zt(e),"toggleDropdown",(function(t){e.setState({dropdownVisible:!e.state.dropdownVisible},(function(){e.props.adjustDateOnChange&&e.handleYearChange(e.props.date,t)}))})),bt(Zt(e),"handleYearChange",(function(t,n){e.onSelect(t,n),e.setOpen()})),bt(Zt(e),"onSelect",(function(t,n){e.props.onSelect&&e.props.onSelect(t,n)})),bt(Zt(e),"setOpen",(function(){e.props.setOpen&&e.props.setOpen(!0)})),e}return vt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return ue.default.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(ue.default.Component),kn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"isSelectedMonth",(function(t){return e.props.month===t})),bt(Zt(e),"renderOptions",(function(){return e.props.monthNames.map((function(t,n){return ue.default.createElement("div",{className:e.isSelectedMonth(n)?"react-datepicker__month-option react-datepicker__month-option--selected_month":"react-datepicker__month-option",key:t,onClick:e.onChange.bind(Zt(e),n),"aria-selected":e.isSelectedMonth(n)?"true":void 0},e.isSelectedMonth(n)?ue.default.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",t)}))})),bt(Zt(e),"onChange",(function(t){return e.props.onChange(t)})),bt(Zt(e),"handleClickOutside",(function(){return e.props.onCancel()})),e}return vt(n,[{key:"render",value:function(){return ue.default.createElement("div",{className:"react-datepicker__month-dropdown"},this.renderOptions())}}]),n}(ue.default.Component),Nn=dt.default(kn),Dn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),bt(Zt(e),"renderSelectOptions",(function(e){return e.map((function(e,t){return ue.default.createElement("option",{key:t,value:t},e)}))})),bt(Zt(e),"renderSelectMode",(function(t){return ue.default.createElement("select",{value:e.props.month,className:"react-datepicker__month-select",onChange:function(t){return e.onChange(t.target.value)}},e.renderSelectOptions(t))})),bt(Zt(e),"renderReadView",(function(t,n){return ue.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__month-read-view",onClick:e.toggleDropdown},ue.default.createElement("span",{className:"react-datepicker__month-read-view--down-arrow"}),ue.default.createElement("span",{className:"react-datepicker__month-read-view--selected-month"},n[e.props.month]))})),bt(Zt(e),"renderDropdown",(function(t){return ue.default.createElement(Nn,{key:"dropdown",month:e.props.month,monthNames:t,onChange:e.onChange,onCancel:e.toggleDropdown})})),bt(Zt(e),"renderScrollMode",(function(t){var n=e.state.dropdownVisible,r=[e.renderReadView(!n,t)];return n&&r.unshift(e.renderDropdown(t)),r})),bt(Zt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.month&&e.props.onChange(t)})),bt(Zt(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return vt(n,[{key:"render",value:function(){var e,t=this,n=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(e){return tn(e,t.props.locale)}:function(e){return en(e,t.props.locale)});switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode(n);break;case"select":e=this.renderSelectMode(n)}return ue.default.createElement("div",{className:"react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(ue.default.Component);function En(e,t){for(var n=[],r=Vt(e),a=Vt(t);!at.default(r,a);)n.push(Ot(r)),r=we.default(r,1);return n}var On=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),bt(Zt(r=t.call(this,e)),"renderOptions",(function(){return r.state.monthYearsList.map((function(e){var t=Ae.default(e),n=Bt(r.props.date,e)&&Ht(r.props.date,e);return ue.default.createElement("div",{className:n?"react-datepicker__month-year-option--selected_month-year":"react-datepicker__month-year-option",key:t,onClick:r.onChange.bind(Zt(r),t),"aria-selected":n?"true":void 0},n?ue.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Pt(e,r.props.dateFormat,r.props.locale))}))})),bt(Zt(r),"onChange",(function(e){return r.props.onChange(e)})),bt(Zt(r),"handleClickOutside",(function(){r.props.onCancel()})),r.state={monthYearsList:En(r.props.minDate,r.props.maxDate)},r}return vt(n,[{key:"render",value:function(){var e=pe.default({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return ue.default.createElement("div",{className:e},this.renderOptions())}}]),n}(ue.default.Component),Rn=dt.default(On),An=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),bt(Zt(e),"renderSelectOptions",(function(){for(var t=Vt(e.props.minDate),n=Vt(e.props.maxDate),r=[];!at.default(t,n);){var a=Ae.default(t);r.push(ue.default.createElement("option",{key:a,value:a},Pt(t,e.props.dateFormat,e.props.locale))),t=we.default(t,1)}return r})),bt(Zt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),bt(Zt(e),"renderSelectMode",(function(){return ue.default.createElement("select",{value:Ae.default(Vt(e.props.date)),className:"react-datepicker__month-year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),bt(Zt(e),"renderReadView",(function(t){var n=Pt(e.props.date,e.props.dateFormat,e.props.locale);return ue.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__month-year-read-view",onClick:function(t){return e.toggleDropdown(t)}},ue.default.createElement("span",{className:"react-datepicker__month-year-read-view--down-arrow"}),ue.default.createElement("span",{className:"react-datepicker__month-year-read-view--selected-month-year"},n))})),bt(Zt(e),"renderDropdown",(function(){return ue.default.createElement(Rn,{key:"dropdown",date:e.props.date,dateFormat:e.props.dateFormat,onChange:e.onChange,onCancel:e.toggleDropdown,minDate:e.props.minDate,maxDate:e.props.maxDate,scrollableMonthYearDropdown:e.props.scrollableMonthYearDropdown,locale:e.props.locale})})),bt(Zt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),bt(Zt(e),"onChange",(function(t){e.toggleDropdown();var n=Ot(parseInt(t));Bt(e.props.date,n)&&Ht(e.props.date,n)||e.props.onChange(n)})),bt(Zt(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return vt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return ue.default.createElement("div",{className:"react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(ue.default.Component),Pn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"dayEl",ue.default.createRef()),bt(Zt(e),"handleClick",(function(t){!e.isDisabled()&&e.props.onClick&&e.props.onClick(t)})),bt(Zt(e),"handleMouseEnter",(function(t){!e.isDisabled()&&e.props.onMouseEnter&&e.props.onMouseEnter(t)})),bt(Zt(e),"handleOnKeyDown",(function(t){" "===t.key&&(t.preventDefault(),t.key="Enter"),e.props.handleOnKeyDown(t)})),bt(Zt(e),"isSameDay",(function(t){return Kt(e.props.day,t)})),bt(Zt(e),"isKeyboardSelected",(function(){return!e.props.disabledKeyboardNavigation&&!e.isSameDay(e.props.selected)&&e.isSameDay(e.props.preSelection)})),bt(Zt(e),"isDisabled",(function(){return rn(e.props.day,e.props)})),bt(Zt(e),"isExcluded",(function(){return an(e.props.day,e.props)})),bt(Zt(e),"getHighLightedClass",(function(t){var n=e.props,r=n.day,a=n.highlightDates;if(!a)return!1;var s=Pt(r,"MM.dd.yyyy");return a.get(s)})),bt(Zt(e),"isInRange",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&Qt(n,r,a)})),bt(Zt(e),"isInSelectingRange",(function(){var t,n=e.props,r=n.day,a=n.selectsStart,s=n.selectsEnd,i=n.selectsRange,o=n.selectsDisabledDaysInRange,l=n.startDate,c=n.endDate,d=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return!(!(a||s||i)||!d||!o&&e.isDisabled())&&(a&&c&&(st.default(d,c)||Gt(d,c))?Qt(r,d,c):(s&&l&&(at.default(d,l)||Gt(d,l))||!(!i||!l||c||!at.default(d,l)&&!Gt(d,l)))&&Qt(r,l,d))})),bt(Zt(e),"isSelectingRangeStart",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,r=n.day,a=n.startDate,s=n.selectsStart,i=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Kt(r,s?i:a)})),bt(Zt(e),"isSelectingRangeEnd",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,r=n.day,a=n.endDate,s=n.selectsEnd,i=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Kt(r,s?i:a)})),bt(Zt(e),"isRangeStart",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&Kt(r,n)})),bt(Zt(e),"isRangeEnd",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&Kt(a,n)})),bt(Zt(e),"isWeekend",(function(){var t=ke.default(e.props.day);return 0===t||6===t})),bt(Zt(e),"isAfterMonth",(function(){return void 0!==e.props.month&&(e.props.month+1)%12===Ee.default(e.props.day)})),bt(Zt(e),"isBeforeMonth",(function(){return void 0!==e.props.month&&(Ee.default(e.props.day)+1)%12===e.props.month})),bt(Zt(e),"isCurrentDay",(function(){return e.isSameDay(Ot())})),bt(Zt(e),"isSelected",(function(){return e.isSameDay(e.props.selected)})),bt(Zt(e),"getClassNames",(function(t){var n=e.props.dayClassName?e.props.dayClassName(t):void 0;return pe.default("react-datepicker__day",n,"react-datepicker__day--"+qt(e.props.day),{"react-datepicker__day--disabled":e.isDisabled(),"react-datepicker__day--excluded":e.isExcluded(),"react-datepicker__day--selected":e.isSelected(),"react-datepicker__day--keyboard-selected":e.isKeyboardSelected(),"react-datepicker__day--range-start":e.isRangeStart(),"react-datepicker__day--range-end":e.isRangeEnd(),"react-datepicker__day--in-range":e.isInRange(),"react-datepicker__day--in-selecting-range":e.isInSelectingRange(),"react-datepicker__day--selecting-range-start":e.isSelectingRangeStart(),"react-datepicker__day--selecting-range-end":e.isSelectingRangeEnd(),"react-datepicker__day--today":e.isCurrentDay(),"react-datepicker__day--weekend":e.isWeekend(),"react-datepicker__day--outside-month":e.isAfterMonth()||e.isBeforeMonth()},e.getHighLightedClass("react-datepicker__day--highlighted"))})),bt(Zt(e),"getAriaLabel",(function(){var t=e.props,n=t.day,r=t.ariaLabelPrefixWhenEnabled,a=void 0===r?"Choose":r,s=t.ariaLabelPrefixWhenDisabled,i=void 0===s?"Not available":s,o=e.isDisabled()||e.isExcluded()?i:a;return"".concat(o," ").concat(Pt(n,"PPPP",e.props.locale))})),bt(Zt(e),"getTabIndex",(function(t,n){var r=t||e.props.selected,a=n||e.props.preSelection;return e.isKeyboardSelected()||e.isSameDay(r)&&Kt(a,r)?0:-1})),bt(Zt(e),"handleFocusDay",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1;0===e.getTabIndex()&&!t.isInputFocused&&e.isSameDay(e.props.preSelection)&&(document.activeElement&&document.activeElement!==document.body||(n=!0),e.props.inline&&!e.props.shouldFocusDayInline&&(n=!1),e.props.containerRef&&e.props.containerRef.current&&e.props.containerRef.current.contains(document.activeElement)&&document.activeElement.classList.contains("react-datepicker__day")&&(n=!0)),n&&e.dayEl.current.focus({preventScroll:!0})})),bt(Zt(e),"renderDayContents",(function(){return e.props.monthShowsDuplicateDaysEnd&&e.isAfterMonth()||e.props.monthShowsDuplicateDaysStart&&e.isBeforeMonth()?null:e.props.renderDayContents?e.props.renderDayContents(Ne.default(e.props.day),e.props.day):Ne.default(e.props.day)})),bt(Zt(e),"render",(function(){return ue.default.createElement("div",{ref:e.dayEl,className:e.getClassNames(e.props.day),onKeyDown:e.handleOnKeyDown,onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,tabIndex:e.getTabIndex(),"aria-label":e.getAriaLabel(),role:"button","aria-disabled":e.isDisabled(),"aria-current":e.isCurrentDay()?"date":void 0,"aria-selected":e.isSelected()?"true":void 0},e.renderDayContents())})),e}return vt(n,[{key:"componentDidMount",value:function(){this.handleFocusDay()}},{key:"componentDidUpdate",value:function(e){this.handleFocusDay(e)}}]),n}(ue.default.Component),Mn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"handleClick",(function(t){e.props.onClick&&e.props.onClick(t)})),e}return vt(n,[{key:"render",value:function(){var e=this.props,t=e.weekNumber,n=e.ariaLabelPrefix,r=void 0===n?"week ":n,a={"react-datepicker__week-number":!0,"react-datepicker__week-number--clickable":!!e.onClick};return ue.default.createElement("div",{className:pe.default(a),"aria-label":"".concat(r," ").concat(this.props.weekNumber),onClick:this.handleClick},t)}}]),n}(ue.default.Component),Ln=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n)})),bt(Zt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),bt(Zt(e),"handleWeekClick",(function(t,n,r){"function"==typeof e.props.onWeekSelect&&e.props.onWeekSelect(t,n,r),e.props.shouldCloseOnSelect&&e.props.setOpen(!1)})),bt(Zt(e),"formatWeekNumber",(function(t){return e.props.formatWeekNumber?e.props.formatWeekNumber(t):Ft(t)})),bt(Zt(e),"renderDays",(function(){var t=Ut(e.props.day,e.props.locale,e.props.calendarStartDay),n=[],r=e.formatWeekNumber(t);if(e.props.showWeekNumber){var a=e.props.onWeekSelect?e.handleWeekClick.bind(Zt(e),t,r):void 0;n.push(ue.default.createElement(Mn,{key:"W",weekNumber:r,onClick:a,ariaLabelPrefix:e.props.ariaLabelPrefix}))}return n.concat([0,1,2,3,4,5,6].map((function(n){var r=be.default(t,n);return ue.default.createElement(Pn,{ariaLabelPrefixWhenEnabled:e.props.chooseDayAriaLabelPrefix,ariaLabelPrefixWhenDisabled:e.props.disabledDayAriaLabelPrefix,key:r.valueOf(),day:r,month:e.props.month,onClick:e.handleDayClick.bind(Zt(e),r),onMouseEnter:e.handleDayMouseEnter.bind(Zt(e),r),minDate:e.props.minDate,maxDate:e.props.maxDate,excludeDates:e.props.excludeDates,excludeDateIntervals:e.props.excludeDateIntervals,includeDates:e.props.includeDates,includeDateIntervals:e.props.includeDateIntervals,highlightDates:e.props.highlightDates,selectingDate:e.props.selectingDate,filterDate:e.props.filterDate,preSelection:e.props.preSelection,selected:e.props.selected,selectsStart:e.props.selectsStart,selectsEnd:e.props.selectsEnd,selectsRange:e.props.selectsRange,selectsDisabledDaysInRange:e.props.selectsDisabledDaysInRange,startDate:e.props.startDate,endDate:e.props.endDate,dayClassName:e.props.dayClassName,renderDayContents:e.props.renderDayContents,disabledKeyboardNavigation:e.props.disabledKeyboardNavigation,handleOnKeyDown:e.props.handleOnKeyDown,isInputFocused:e.props.isInputFocused,containerRef:e.props.containerRef,inline:e.props.inline,shouldFocusDayInline:e.props.shouldFocusDayInline,monthShowsDuplicateDaysEnd:e.props.monthShowsDuplicateDaysEnd,monthShowsDuplicateDaysStart:e.props.monthShowsDuplicateDaysStart,locale:e.props.locale})})))})),e}return vt(n,[{key:"render",value:function(){return ue.default.createElement("div",{className:"react-datepicker__week"},this.renderDays())}}],[{key:"defaultProps",get:function(){return{shouldCloseOnSelect:!0}}}]),n}(ue.default.Component),Fn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"MONTH_REFS",St(Array(12)).map((function(){return ue.default.createRef()}))),bt(Zt(e),"isDisabled",(function(t){return rn(t,e.props)})),bt(Zt(e),"isExcluded",(function(t){return an(t,e.props)})),bt(Zt(e),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n,e.props.orderInDisplay)})),bt(Zt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),bt(Zt(e),"handleMouseLeave",(function(){e.props.onMouseLeave&&e.props.onMouseLeave()})),bt(Zt(e),"isRangeStartMonth",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Ht(Fe.default(r,t),a)})),bt(Zt(e),"isRangeStartQuarter",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&zt(qe.default(r,t),a)})),bt(Zt(e),"isRangeEndMonth",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Ht(Fe.default(r,t),s)})),bt(Zt(e),"isRangeEndQuarter",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&zt(qe.default(r,t),s)})),bt(Zt(e),"isWeekInMonth",(function(t){var n=e.props.day,r=be.default(t,6);return Ht(t,n)||Ht(r,n)})),bt(Zt(e),"isCurrentMonth",(function(e,t){return Re.default(e)===Re.default(Ot())&&t===Ee.default(Ot())})),bt(Zt(e),"isSelectedMonth",(function(e,t,n){return Ee.default(e)===t&&Re.default(e)===Re.default(n)})),bt(Zt(e),"isSelectedQuarter",(function(e,t,n){return Oe.default(e)===t&&Re.default(e)===Re.default(n)})),bt(Zt(e),"renderWeeks",(function(){for(var t=[],n=e.props.fixedHeight,r=0,a=!1,s=Ut(Vt(e.props.day),e.props.locale,e.props.calendarStartDay);t.push(ue.default.createElement(Ln,{ariaLabelPrefix:e.props.weekAriaLabelPrefix,chooseDayAriaLabelPrefix:e.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:e.props.disabledDayAriaLabelPrefix,key:r,day:s,month:Ee.default(e.props.day),onDayClick:e.handleDayClick,onDayMouseEnter:e.handleDayMouseEnter,onWeekSelect:e.props.onWeekSelect,formatWeekNumber:e.props.formatWeekNumber,locale:e.props.locale,minDate:e.props.minDate,maxDate:e.props.maxDate,excludeDates:e.props.excludeDates,excludeDateIntervals:e.props.excludeDateIntervals,includeDates:e.props.includeDates,includeDateIntervals:e.props.includeDateIntervals,inline:e.props.inline,shouldFocusDayInline:e.props.shouldFocusDayInline,highlightDates:e.props.highlightDates,selectingDate:e.props.selectingDate,filterDate:e.props.filterDate,preSelection:e.props.preSelection,selected:e.props.selected,selectsStart:e.props.selectsStart,selectsEnd:e.props.selectsEnd,selectsRange:e.props.selectsRange,selectsDisabledDaysInRange:e.props.selectsDisabledDaysInRange,showWeekNumber:e.props.showWeekNumbers,startDate:e.props.startDate,endDate:e.props.endDate,dayClassName:e.props.dayClassName,setOpen:e.props.setOpen,shouldCloseOnSelect:e.props.shouldCloseOnSelect,disabledKeyboardNavigation:e.props.disabledKeyboardNavigation,renderDayContents:e.props.renderDayContents,handleOnKeyDown:e.props.handleOnKeyDown,isInputFocused:e.props.isInputFocused,containerRef:e.props.containerRef,calendarStartDay:e.props.calendarStartDay,monthShowsDuplicateDaysEnd:e.props.monthShowsDuplicateDaysEnd,monthShowsDuplicateDaysStart:e.props.monthShowsDuplicateDaysStart})),!a;){r++,s=ye.default(s,1);var i=n&&r>=6,o=!n&&!e.isWeekInMonth(s);if(i||o){if(!e.props.peekNextMonth)break;a=!0}}return t})),bt(Zt(e),"onMonthClick",(function(t,n){e.handleDayClick(Vt(Fe.default(e.props.day,n)),t)})),bt(Zt(e),"handleMonthNavigation",(function(t,n){e.isDisabled(n)||e.isExcluded(n)||(e.props.setPreSelection(n),e.MONTH_REFS[t].current&&e.MONTH_REFS[t].current.focus())})),bt(Zt(e),"onMonthKeyDown",(function(t,n){var r=t.key;if(!e.props.disabledKeyboardNavigation)switch(r){case"Enter":e.onMonthClick(t,n),e.props.setPreSelection(e.props.selected);break;case"ArrowRight":e.handleMonthNavigation(11===n?0:n+1,we.default(e.props.preSelection,1));break;case"ArrowLeft":e.handleMonthNavigation(0===n?11:n-1,je.default(e.props.preSelection,1))}})),bt(Zt(e),"onQuarterClick",(function(t,n){e.handleDayClick(Yt(qe.default(e.props.day,n)),t)})),bt(Zt(e),"getMonthClassNames",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate,i=n.selected,o=n.minDate,l=n.maxDate,c=n.preSelection,d=n.monthClassName,u=d?d(r):void 0;return pe.default("react-datepicker__month-text","react-datepicker__month-".concat(t),u,{"react-datepicker__month--disabled":(o||l)&&sn(Fe.default(r,t),e.props),"react-datepicker__month--selected":e.isSelectedMonth(r,t,i),"react-datepicker__month-text--keyboard-selected":Ee.default(c)===t,"react-datepicker__month--in-range":on(a,s,t,r),"react-datepicker__month--range-start":e.isRangeStartMonth(t),"react-datepicker__month--range-end":e.isRangeEndMonth(t),"react-datepicker__month-text--today":e.isCurrentMonth(r,t)})})),bt(Zt(e),"getTabIndex",(function(t){var n=Ee.default(e.props.preSelection);return e.props.disabledKeyboardNavigation||t!==n?"-1":"0"})),bt(Zt(e),"getAriaLabel",(function(t){var n=e.props,r=n.ariaLabelPrefix,a=void 0===r?"Choose":r,s=n.disabledDayAriaLabelPrefix,i=void 0===s?"Not available":s,o=n.day,l=Fe.default(o,t),c=e.isDisabled(l)||e.isExcluded(l)?i:a;return"".concat(c," ").concat(Pt(l,"MMMM yyyy"))})),bt(Zt(e),"getQuarterClassNames",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate,i=n.selected,o=n.minDate,l=n.maxDate;return pe.default("react-datepicker__quarter-text","react-datepicker__quarter-".concat(t),{"react-datepicker__quarter--disabled":(o||l)&&ln(qe.default(r,t),e.props),"react-datepicker__quarter--selected":e.isSelectedQuarter(r,t,i),"react-datepicker__quarter--in-range":dn(a,s,t,r),"react-datepicker__quarter--range-start":e.isRangeStartQuarter(t),"react-datepicker__quarter--range-end":e.isRangeEndQuarter(t)})})),bt(Zt(e),"renderMonths",(function(){var t=e.props,n=t.showFullMonthYearPicker,r=t.showTwoColumnMonthYearPicker,a=t.showFourColumnMonthYearPicker,s=t.locale,i=t.day,o=t.selected;return(a?[[0,1,2,3],[4,5,6,7],[8,9,10,11]]:r?[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11]]:[[0,1,2],[3,4,5],[6,7,8],[9,10,11]]).map((function(t,r){return ue.default.createElement("div",{className:"react-datepicker__month-wrapper",key:r},t.map((function(t,r){return ue.default.createElement("div",{ref:e.MONTH_REFS[t],key:r,onClick:function(n){e.onMonthClick(n,t)},onKeyDown:function(n){e.onMonthKeyDown(n,t)},tabIndex:e.getTabIndex(t),className:e.getMonthClassNames(t),role:"button","aria-label":e.getAriaLabel(t),"aria-current":e.isCurrentMonth(i,t)?"date":void 0,"aria-selected":e.isSelectedMonth(i,t,o)?"true":void 0},n?en(t,s):tn(t,s))})))}))})),bt(Zt(e),"renderQuarters",(function(){var t=e.props,n=t.day,r=t.selected;return ue.default.createElement("div",{className:"react-datepicker__quarter-wrapper"},[1,2,3,4].map((function(t,a){return ue.default.createElement("div",{key:a,onClick:function(n){e.onQuarterClick(n,t)},className:e.getQuarterClassNames(t),"aria-selected":e.isSelectedQuarter(n,t,r)?"true":void 0},nn(t,e.props.locale))})))})),bt(Zt(e),"getClassNames",(function(){var t=e.props;t.day;var n=t.selectingDate,r=t.selectsStart,a=t.selectsEnd,s=t.showMonthYearPicker,i=t.showQuarterYearPicker;return pe.default("react-datepicker__month",{"react-datepicker__month--selecting-range":n&&(r||a)},{"react-datepicker__monthPicker":s},{"react-datepicker__quarterPicker":i})})),e}return vt(n,[{key:"render",value:function(){var e=this.props,t=e.showMonthYearPicker,n=e.showQuarterYearPicker,r=e.day,a=e.ariaLabelPrefix,s=void 0===a?"month ":a;return ue.default.createElement("div",{className:this.getClassNames(),onMouseLeave:this.handleMouseLeave,"aria-label":"".concat(s," ").concat(Pt(r,"yyyy-MM"))},t?this.renderMonths():n?this.renderQuarters():this.renderWeeks())}}]),n}(ue.default.Component),qn=function(e){wt(n,e);var t=It(n);function n(){var e;ft(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return bt(Zt(e=t.call.apply(t,[this].concat(a))),"state",{height:null}),bt(Zt(e),"handleClick",(function(t){(e.props.minTime||e.props.maxTime)&&hn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&mn(t,e.props)||e.props.onChange(t)})),bt(Zt(e),"isSelectedTime",(function(t,n,r){return e.props.selected&&n===Te.default(t)&&r===Ce.default(t)})),bt(Zt(e),"liClasses",(function(t,n,r){var a=["react-datepicker__time-list-item",e.props.timeClassName?e.props.timeClassName(t,n,r):void 0];return e.isSelectedTime(t,n,r)&&a.push("react-datepicker__time-list-item--selected"),((e.props.minTime||e.props.maxTime)&&hn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&mn(t,e.props))&&a.push("react-datepicker__time-list-item--disabled"),e.props.injectTimes&&(60*Te.default(t)+Ce.default(t))%e.props.intervals!=0&&a.push("react-datepicker__time-list-item--injected"),a.join(" ")})),bt(Zt(e),"handleOnKeyDown",(function(t,n){" "===t.key&&(t.preventDefault(),t.key="Enter"),"Enter"===t.key&&e.handleClick(n),e.props.handleOnKeyDown(t)})),bt(Zt(e),"renderTimes",(function(){for(var t=[],n=e.props.format?e.props.format:"p",r=e.props.intervals,a=$t(Ot(e.props.selected)),s=1440/r,i=e.props.injectTimes&&e.props.injectTimes.sort((function(e,t){return e-t})),o=e.props.selected||e.props.openToDate||Ot(),l=Te.default(o),c=Ce.default(o),d=Le.default(Me.default(a,c),l),u=0;u<s;u++){var p=ge.default(a,u*r);if(t.push(p),i){var m=_n(a,p,u,r,i);t=t.concat(m)}}return t.map((function(t,r){return ue.default.createElement("li",{key:r,onClick:e.handleClick.bind(Zt(e),t),className:e.liClasses(t,l,c),ref:function(n){(st.default(t,d)||Gt(t,d))&&(e.centerLi=n)},onKeyDown:function(n){e.handleOnKeyDown(n,t)},tabIndex:"0","aria-selected":e.isSelectedTime(t,l,c)?"true":void 0},Pt(t,n,e.props.locale))}))})),e}return vt(n,[{key:"componentDidMount",value:function(){this.list.scrollTop=n.calcCenterPosition(this.props.monthRef?this.props.monthRef.clientHeight-this.header.clientHeight:this.list.clientHeight,this.centerLi),this.props.monthRef&&this.header&&this.setState({height:this.props.monthRef.clientHeight-this.header.clientHeight})}},{key:"render",value:function(){var e=this,t=this.state.height;return ue.default.createElement("div",{className:"react-datepicker__time-container ".concat(this.props.todayButton?"react-datepicker__time-container--with-today-button":"")},ue.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--time ".concat(this.props.showTimeSelectOnly?"react-datepicker__header--time--only":""),ref:function(t){e.header=t}},ue.default.createElement("div",{className:"react-datepicker-time__header"},this.props.timeCaption)),ue.default.createElement("div",{className:"react-datepicker__time"},ue.default.createElement("div",{className:"react-datepicker__time-box"},ue.default.createElement("ul",{className:"react-datepicker__time-list",ref:function(t){e.list=t},style:t?{height:t}:{},tabIndex:"0"},this.renderTimes()))))}}],[{key:"defaultProps",get:function(){return{intervals:30,onTimeChange:function(){},todayButton:null,timeCaption:"Time"}}}]),n}(ue.default.Component);bt(qn,"calcCenterPosition",(function(e,t){return t.offsetTop-(e/2-t.clientHeight/2)}));var $n=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),bt(Zt(r=t.call(this,e)),"YEAR_REFS",St(Array(r.props.yearItemNumber)).map((function(){return ue.default.createRef()}))),bt(Zt(r),"isDisabled",(function(e){return rn(e,r.props)})),bt(Zt(r),"isExcluded",(function(e){return an(e,r.props)})),bt(Zt(r),"updateFocusOnPaginate",(function(e){var t=function(){this.YEAR_REFS[e].current.focus()}.bind(Zt(r));window.requestAnimationFrame(t)})),bt(Zt(r),"handleYearClick",(function(e,t){r.props.onDayClick&&r.props.onDayClick(e,t)})),bt(Zt(r),"handleYearNavigation",(function(e,t){var n=r.props,a=n.date,s=n.yearItemNumber,i=jn(a,s).startPeriod;r.isDisabled(t)||r.isExcluded(t)||(r.props.setPreSelection(t),e-i==-1?r.updateFocusOnPaginate(s-1):e-i===s?r.updateFocusOnPaginate(0):r.YEAR_REFS[e-i].current.focus())})),bt(Zt(r),"isSameDay",(function(e,t){return Kt(e,t)})),bt(Zt(r),"isCurrentYear",(function(e){return e===Re.default(Ot())})),bt(Zt(r),"isKeyboardSelected",(function(e){var t=Wt($e.default(r.props.date,e));return!r.props.disabledKeyboardNavigation&&!r.props.inline&&!Kt(t,Wt(r.props.selected))&&Kt(t,Wt(r.props.preSelection))})),bt(Zt(r),"onYearClick",(function(e,t){var n=r.props.date;r.handleYearClick(Wt($e.default(n,t)),e)})),bt(Zt(r),"onYearKeyDown",(function(e,t){var n=e.key;if(!r.props.disabledKeyboardNavigation)switch(n){case"Enter":r.onYearClick(e,t),r.props.setPreSelection(r.props.selected);break;case"ArrowRight":r.handleYearNavigation(t+1,xe.default(r.props.preSelection,1));break;case"ArrowLeft":r.handleYearNavigation(t-1,Ie.default(r.props.preSelection,1))}})),bt(Zt(r),"getYearClassNames",(function(e){var t=r.props,n=t.minDate,a=t.maxDate,s=t.selected;return pe.default("react-datepicker__year-text",{"react-datepicker__year-text--selected":e===Re.default(s),"react-datepicker__year-text--disabled":(n||a)&&cn(e,r.props),"react-datepicker__year-text--keyboard-selected":r.isKeyboardSelected(e),"react-datepicker__year-text--today":r.isCurrentYear(e)})})),bt(Zt(r),"getYearTabIndex",(function(e){return r.props.disabledKeyboardNavigation?"-1":e===Re.default(r.props.preSelection)?"0":"-1"})),r}return vt(n,[{key:"render",value:function(){for(var e=this,t=[],n=this.props,r=jn(n.date,n.yearItemNumber),a=r.startPeriod,s=r.endPeriod,i=function(n){t.push(ue.default.createElement("div",{ref:e.YEAR_REFS[n-a],onClick:function(t){e.onYearClick(t,n)},onKeyDown:function(t){e.onYearKeyDown(t,n)},tabIndex:e.getYearTabIndex(n),className:e.getYearClassNames(n),key:n,"aria-current":e.isCurrentYear(n)?"date":void 0},n))},o=a;o<=s;o++)i(o);return ue.default.createElement("div",{className:"react-datepicker__year"},ue.default.createElement("div",{className:"react-datepicker__year-wrapper"},t))}}]),n}(ue.default.Component),Un=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),bt(Zt(r=t.call(this,e)),"onTimeChange",(function(e){r.setState({time:e});var t=new Date;t.setHours(e.split(":")[0]),t.setMinutes(e.split(":")[1]),r.props.onChange(t)})),bt(Zt(r),"renderTimeInput",(function(){var e=r.state.time,t=r.props,n=t.date,a=t.timeString,s=t.customTimeInput;return s?ue.default.cloneElement(s,{date:n,value:e,onChange:r.onTimeChange}):ue.default.createElement("input",{type:"time",className:"react-datepicker-time__input",placeholder:"Time",name:"time-input",required:!0,value:e,onChange:function(e){r.onTimeChange(e.target.value||a)}})})),r.state={time:r.props.timeString},r}return vt(n,[{key:"render",value:function(){return ue.default.createElement("div",{className:"react-datepicker__input-time-container"},ue.default.createElement("div",{className:"react-datepicker-time__caption"},this.props.timeInputLabel),ue.default.createElement("div",{className:"react-datepicker-time__input-container"},ue.default.createElement("div",{className:"react-datepicker-time__input"},this.renderTimeInput())))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return e.timeString!==t.time?{time:e.timeString}:null}}]),n}(ue.default.Component);function Vn(e){var t=e.className,n=e.children,r=e.showPopperArrow,a=e.arrowProps,s=void 0===a?{}:a;return ue.default.createElement("div",{className:t},r&&ue.default.createElement("div",yt({className:"react-datepicker__triangle"},s)),n)}var Wn=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],Yn=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),bt(Zt(r=t.call(this,e)),"handleClickOutside",(function(e){r.props.onClickOutside(e)})),bt(Zt(r),"setClickOutsideRef",(function(){return r.containerRef.current})),bt(Zt(r),"handleDropdownFocus",(function(e){(function(){var e=((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).className||"").split(/\s+/);return Wn.some((function(t){return e.indexOf(t)>=0}))})(e.target)&&r.props.onDropdownFocus()})),bt(Zt(r),"getDateInView",(function(){var e=r.props,t=e.preSelection,n=e.selected,a=e.openToDate,s=yn(r.props),i=wn(r.props),o=Ot();return a||n||t||(s&&st.default(o,s)?s:i&&at.default(o,i)?i:o)})),bt(Zt(r),"increaseMonth",(function(){r.setState((function(e){var t=e.date;return{date:we.default(t,1)}}),(function(){return r.handleMonthChange(r.state.date)}))})),bt(Zt(r),"decreaseMonth",(function(){r.setState((function(e){var t=e.date;return{date:je.default(t,1)}}),(function(){return r.handleMonthChange(r.state.date)}))})),bt(Zt(r),"handleDayClick",(function(e,t,n){r.props.onSelect(e,t,n),r.props.setPreSelection&&r.props.setPreSelection(e)})),bt(Zt(r),"handleDayMouseEnter",(function(e){r.setState({selectingDate:e}),r.props.onDayMouseEnter&&r.props.onDayMouseEnter(e)})),bt(Zt(r),"handleMonthMouseLeave",(function(){r.setState({selectingDate:null}),r.props.onMonthMouseLeave&&r.props.onMonthMouseLeave()})),bt(Zt(r),"handleYearChange",(function(e){r.props.onYearChange&&r.props.onYearChange(e),r.props.adjustDateOnChange&&(r.props.onSelect&&r.props.onSelect(e),r.props.setOpen&&r.props.setOpen(!0)),r.props.setPreSelection&&r.props.setPreSelection(e)})),bt(Zt(r),"handleMonthChange",(function(e){r.props.onMonthChange&&r.props.onMonthChange(e),r.props.adjustDateOnChange&&(r.props.onSelect&&r.props.onSelect(e),r.props.setOpen&&r.props.setOpen(!0)),r.props.setPreSelection&&r.props.setPreSelection(e)})),bt(Zt(r),"handleMonthYearChange",(function(e){r.handleYearChange(e),r.handleMonthChange(e)})),bt(Zt(r),"changeYear",(function(e){r.setState((function(t){var n=t.date;return{date:$e.default(n,e)}}),(function(){return r.handleYearChange(r.state.date)}))})),bt(Zt(r),"changeMonth",(function(e){r.setState((function(t){var n=t.date;return{date:Fe.default(n,e)}}),(function(){return r.handleMonthChange(r.state.date)}))})),bt(Zt(r),"changeMonthYear",(function(e){r.setState((function(t){var n=t.date;return{date:$e.default(Fe.default(n,Ee.default(e)),Re.default(e))}}),(function(){return r.handleMonthYearChange(r.state.date)}))})),bt(Zt(r),"header",(function(){var e=Ut(arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.state.date,r.props.locale,r.props.calendarStartDay),t=[];return r.props.showWeekNumbers&&t.push(ue.default.createElement("div",{key:"W",className:"react-datepicker__day-name"},r.props.weekLabel||"#")),t.concat([0,1,2,3,4,5,6].map((function(t){var n=be.default(e,t),a=r.formatWeekday(n,r.props.locale),s=r.props.weekDayClassName?r.props.weekDayClassName(n):void 0;return ue.default.createElement("div",{key:t,className:pe.default("react-datepicker__day-name",s)},a)})))})),bt(Zt(r),"formatWeekday",(function(e,t){return r.props.formatWeekDay?function(e,t,n){return t(Pt(e,"EEEE",n))}(e,r.props.formatWeekDay,t):r.props.useWeekdaysShort?function(e,t){return Pt(e,"EEE",t)}(e,t):function(e,t){return Pt(e,"EEEEEE",t)}(e,t)})),bt(Zt(r),"decreaseYear",(function(){r.setState((function(e){var t=e.date;return{date:Ie.default(t,r.props.showYearPicker?r.props.yearItemNumber:1)}}),(function(){return r.handleYearChange(r.state.date)}))})),bt(Zt(r),"renderPreviousButton",(function(){if(!r.props.renderCustomHeader){var e;switch(!0){case r.props.showMonthYearPicker:e=vn(r.state.date,r.props);break;case r.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.yearItemNumber,a=void 0===r?Dt:r,s=jn(Wt(Ie.default(e,a)),a).endPeriod,i=n&&Re.default(n);return i&&i>s||!1}(r.state.date,r.props);break;default:e=fn(r.state.date,r.props)}if((r.props.forceShowMonthNavigation||r.props.showDisabledMonthNavigation||!e)&&!r.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--previous"],n=r.decreaseMonth;(r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker)&&(n=r.decreaseYear),e&&r.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--previous--disabled"),n=null);var a=r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker,s=r.props,i=s.previousMonthButtonLabel,o=s.previousYearButtonLabel,l=r.props,c=l.previousMonthAriaLabel,d=void 0===c?"string"==typeof i?i:"Previous Month":c,u=l.previousYearAriaLabel,p=void 0===u?"string"==typeof o?o:"Previous Year":u;return ue.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:r.props.handleOnKeyDown,"aria-label":a?p:d},ue.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"].join(" ")},a?r.props.previousYearButtonLabel:r.props.previousMonthButtonLabel))}}})),bt(Zt(r),"increaseYear",(function(){r.setState((function(e){var t=e.date;return{date:xe.default(t,r.props.showYearPicker?r.props.yearItemNumber:1)}}),(function(){return r.handleYearChange(r.state.date)}))})),bt(Zt(r),"renderNextButton",(function(){if(!r.props.renderCustomHeader){var e;switch(!0){case r.props.showMonthYearPicker:e=bn(r.state.date,r.props);break;case r.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.yearItemNumber,a=void 0===r?Dt:r,s=jn(xe.default(e,a),a).startPeriod,i=n&&Re.default(n);return i&&i<s||!1}(r.state.date,r.props);break;default:e=gn(r.state.date,r.props)}if((r.props.forceShowMonthNavigation||r.props.showDisabledMonthNavigation||!e)&&!r.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--next"];r.props.showTimeSelect&&t.push("react-datepicker__navigation--next--with-time"),r.props.todayButton&&t.push("react-datepicker__navigation--next--with-today-button");var n=r.increaseMonth;(r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker)&&(n=r.increaseYear),e&&r.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--next--disabled"),n=null);var a=r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker,s=r.props,i=s.nextMonthButtonLabel,o=s.nextYearButtonLabel,l=r.props,c=l.nextMonthAriaLabel,d=void 0===c?"string"==typeof i?i:"Next Month":c,u=l.nextYearAriaLabel,p=void 0===u?"string"==typeof o?o:"Next Year":u;return ue.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:r.props.handleOnKeyDown,"aria-label":a?p:d},ue.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"].join(" ")},a?r.props.nextYearButtonLabel:r.props.nextMonthButtonLabel))}}})),bt(Zt(r),"renderCurrentMonth",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.state.date,t=["react-datepicker__current-month"];return r.props.showYearDropdown&&t.push("react-datepicker__current-month--hasYearDropdown"),r.props.showMonthDropdown&&t.push("react-datepicker__current-month--hasMonthDropdown"),r.props.showMonthYearDropdown&&t.push("react-datepicker__current-month--hasMonthYearDropdown"),ue.default.createElement("div",{className:t.join(" ")},Pt(e,r.props.dateFormat,r.props.locale))})),bt(Zt(r),"renderYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showYearDropdown&&!e)return ue.default.createElement(Tn,{adjustDateOnChange:r.props.adjustDateOnChange,date:r.state.date,onSelect:r.props.onSelect,setOpen:r.props.setOpen,dropdownMode:r.props.dropdownMode,onChange:r.changeYear,minDate:r.props.minDate,maxDate:r.props.maxDate,year:Re.default(r.state.date),scrollableYearDropdown:r.props.scrollableYearDropdown,yearDropdownItemNumber:r.props.yearDropdownItemNumber})})),bt(Zt(r),"renderMonthDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showMonthDropdown&&!e)return ue.default.createElement(Dn,{dropdownMode:r.props.dropdownMode,locale:r.props.locale,onChange:r.changeMonth,month:Ee.default(r.state.date),useShortMonthInDropdown:r.props.useShortMonthInDropdown})})),bt(Zt(r),"renderMonthYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showMonthYearDropdown&&!e)return ue.default.createElement(An,{dropdownMode:r.props.dropdownMode,locale:r.props.locale,dateFormat:r.props.dateFormat,onChange:r.changeMonthYear,minDate:r.props.minDate,maxDate:r.props.maxDate,date:r.state.date,scrollableMonthYearDropdown:r.props.scrollableMonthYearDropdown})})),bt(Zt(r),"renderTodayButton",(function(){if(r.props.todayButton&&!r.props.showTimeSelectOnly)return ue.default.createElement("div",{className:"react-datepicker__today-button",onClick:function(e){return r.props.onSelect(He.default(Ot()),e)}},r.props.todayButton)})),bt(Zt(r),"renderDefaultHeader",(function(e){var t=e.monthDate,n=e.i;return ue.default.createElement("div",{className:"react-datepicker__header ".concat(r.props.showTimeSelect?"react-datepicker__header--has-time-select":"")},r.renderCurrentMonth(t),ue.default.createElement("div",{className:"react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(r.props.dropdownMode),onFocus:r.handleDropdownFocus},r.renderMonthDropdown(0!==n),r.renderMonthYearDropdown(0!==n),r.renderYearDropdown(0!==n)),ue.default.createElement("div",{className:"react-datepicker__day-names"},r.header(t)))})),bt(Zt(r),"renderCustomHeader",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.monthDate,n=e.i;if(r.props.showTimeSelect&&!r.state.monthContainer||r.props.showTimeSelectOnly)return null;var a=fn(r.state.date,r.props),s=gn(r.state.date,r.props),i=vn(r.state.date,r.props),o=bn(r.state.date,r.props),l=!r.props.showMonthYearPicker&&!r.props.showQuarterYearPicker&&!r.props.showYearPicker;return ue.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:r.props.onDropdownFocus},r.props.renderCustomHeader(mt(mt({},r.state),{},{customHeaderCount:n,monthDate:t,changeMonth:r.changeMonth,changeYear:r.changeYear,decreaseMonth:r.decreaseMonth,increaseMonth:r.increaseMonth,decreaseYear:r.decreaseYear,increaseYear:r.increaseYear,prevMonthButtonDisabled:a,nextMonthButtonDisabled:s,prevYearButtonDisabled:i,nextYearButtonDisabled:o})),l&&ue.default.createElement("div",{className:"react-datepicker__day-names"},r.header(t)))})),bt(Zt(r),"renderYearHeader",(function(){var e=r.state.date,t=r.props,n=t.showYearPicker,a=jn(e,t.yearItemNumber),s=a.startPeriod,i=a.endPeriod;return ue.default.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},n?"".concat(s," - ").concat(i):Re.default(e))})),bt(Zt(r),"renderHeader",(function(e){switch(!0){case void 0!==r.props.renderCustomHeader:return r.renderCustomHeader(e);case r.props.showMonthYearPicker||r.props.showQuarterYearPicker||r.props.showYearPicker:return r.renderYearHeader(e);default:return r.renderDefaultHeader(e)}})),bt(Zt(r),"renderMonths",(function(){if(!r.props.showTimeSelectOnly&&!r.props.showYearPicker){for(var e=[],t=r.props.showPreviousMonths?r.props.monthsShown-1:0,n=je.default(r.state.date,t),a=0;a<r.props.monthsShown;++a){var s=a-r.props.monthSelectedIn,i=we.default(n,s),o="month-".concat(a),l=a<r.props.monthsShown-1,c=a>0;e.push(ue.default.createElement("div",{key:o,ref:function(e){r.monthContainer=e},className:"react-datepicker__month-container"},r.renderHeader({monthDate:i,i:a}),ue.default.createElement(Fn,{chooseDayAriaLabelPrefix:r.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:r.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:r.props.weekAriaLabelPrefix,onChange:r.changeMonthYear,day:i,dayClassName:r.props.dayClassName,calendarStartDay:r.props.calendarStartDay,monthClassName:r.props.monthClassName,onDayClick:r.handleDayClick,handleOnKeyDown:r.props.handleOnDayKeyDown,onDayMouseEnter:r.handleDayMouseEnter,onMouseLeave:r.handleMonthMouseLeave,onWeekSelect:r.props.onWeekSelect,orderInDisplay:a,formatWeekNumber:r.props.formatWeekNumber,locale:r.props.locale,minDate:r.props.minDate,maxDate:r.props.maxDate,excludeDates:r.props.excludeDates,excludeDateIntervals:r.props.excludeDateIntervals,highlightDates:r.props.highlightDates,selectingDate:r.state.selectingDate,includeDates:r.props.includeDates,includeDateIntervals:r.props.includeDateIntervals,inline:r.props.inline,shouldFocusDayInline:r.props.shouldFocusDayInline,fixedHeight:r.props.fixedHeight,filterDate:r.props.filterDate,preSelection:r.props.preSelection,setPreSelection:r.props.setPreSelection,selected:r.props.selected,selectsStart:r.props.selectsStart,selectsEnd:r.props.selectsEnd,selectsRange:r.props.selectsRange,selectsDisabledDaysInRange:r.props.selectsDisabledDaysInRange,showWeekNumbers:r.props.showWeekNumbers,startDate:r.props.startDate,endDate:r.props.endDate,peekNextMonth:r.props.peekNextMonth,setOpen:r.props.setOpen,shouldCloseOnSelect:r.props.shouldCloseOnSelect,renderDayContents:r.props.renderDayContents,disabledKeyboardNavigation:r.props.disabledKeyboardNavigation,showMonthYearPicker:r.props.showMonthYearPicker,showFullMonthYearPicker:r.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:r.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:r.props.showFourColumnMonthYearPicker,showYearPicker:r.props.showYearPicker,showQuarterYearPicker:r.props.showQuarterYearPicker,isInputFocused:r.props.isInputFocused,containerRef:r.containerRef,monthShowsDuplicateDaysEnd:l,monthShowsDuplicateDaysStart:c})))}return e}})),bt(Zt(r),"renderYears",(function(){if(!r.props.showTimeSelectOnly)return r.props.showYearPicker?ue.default.createElement("div",{className:"react-datepicker__year--container"},r.renderHeader(),ue.default.createElement($n,yt({onDayClick:r.handleDayClick,date:r.state.date},r.props))):void 0})),bt(Zt(r),"renderTimeSection",(function(){if(r.props.showTimeSelect&&(r.state.monthContainer||r.props.showTimeSelectOnly))return ue.default.createElement(qn,{selected:r.props.selected,openToDate:r.props.openToDate,onChange:r.props.onTimeChange,timeClassName:r.props.timeClassName,format:r.props.timeFormat,includeTimes:r.props.includeTimes,intervals:r.props.timeIntervals,minTime:r.props.minTime,maxTime:r.props.maxTime,excludeTimes:r.props.excludeTimes,filterTime:r.props.filterTime,timeCaption:r.props.timeCaption,todayButton:r.props.todayButton,showMonthDropdown:r.props.showMonthDropdown,showMonthYearDropdown:r.props.showMonthYearDropdown,showYearDropdown:r.props.showYearDropdown,withPortal:r.props.withPortal,monthRef:r.state.monthContainer,injectTimes:r.props.injectTimes,locale:r.props.locale,handleOnKeyDown:r.props.handleOnKeyDown,showTimeSelectOnly:r.props.showTimeSelectOnly})})),bt(Zt(r),"renderInputTimeSection",(function(){var e=new Date(r.props.selected),t=At(e)&&Boolean(r.props.selected)?"".concat(Zn(e.getHours()),":").concat(Zn(e.getMinutes())):"";if(r.props.showTimeInput)return ue.default.createElement(Un,{date:e,timeString:t,timeInputLabel:r.props.timeInputLabel,onChange:r.props.onTimeChange,customTimeInput:r.props.customTimeInput})})),r.containerRef=ue.default.createRef(),r.state={date:r.getDateInView(),selectingDate:null,monthContainer:null},r}return vt(n,[{key:"componentDidMount",value:function(){this.props.showTimeSelect&&(this.assignMonthContainer=void this.setState({monthContainer:this.monthContainer}))}},{key:"componentDidUpdate",value:function(e){this.props.preSelection&&!Kt(this.props.preSelection,e.preSelection)?this.setState({date:this.props.preSelection}):this.props.openToDate&&!Kt(this.props.openToDate,e.openToDate)&&this.setState({date:this.props.openToDate})}},{key:"render",value:function(){var e=this.props.container||Vn;return ue.default.createElement("div",{ref:this.containerRef},ue.default.createElement(e,{className:pe.default("react-datepicker",this.props.className,{"react-datepicker--time-only":this.props.showTimeSelectOnly}),showPopperArrow:this.props.showPopperArrow,arrowProps:this.props.arrowProps},this.renderPreviousButton(),this.renderNextButton(),this.renderMonths(),this.renderYears(),this.renderTodayButton(),this.renderTimeSection(),this.renderInputTimeSection(),this.props.children))}}],[{key:"defaultProps",get:function(){return{onDropdownFocus:function(){},monthsShown:1,monthSelectedIn:0,forceShowMonthNavigation:!1,timeCaption:"Time",previousYearButtonLabel:"Previous Year",nextYearButtonLabel:"Next Year",previousMonthButtonLabel:"Previous Month",nextMonthButtonLabel:"Next Month",customTimeInput:null,yearItemNumber:Dt}}}]),n}(ue.default.Component),Bn=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),(r=t.call(this,e)).el=document.createElement("div"),r}return vt(n,[{key:"componentDidMount",value:function(){this.portalRoot=(this.props.portalHost||document).getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement("div"),this.portalRoot.setAttribute("id",this.props.portalId),(this.props.portalHost||document.body).appendChild(this.portalRoot)),this.portalRoot.appendChild(this.el)}},{key:"componentWillUnmount",value:function(){this.portalRoot.removeChild(this.el)}},{key:"render",value:function(){return ut.default.createPortal(this.props.children,this.el)}}]),n}(ue.default.Component),Hn=function(e){return!e.disabled&&-1!==e.tabIndex},zn=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),bt(Zt(r=t.call(this,e)),"getTabChildren",(function(){return Array.prototype.slice.call(r.tabLoopRef.current.querySelectorAll("[tabindex], a, button, input, select, textarea"),1,-1).filter(Hn)})),bt(Zt(r),"handleFocusStart",(function(e){var t=r.getTabChildren();t&&t.length>1&&t[t.length-1].focus()})),bt(Zt(r),"handleFocusEnd",(function(e){var t=r.getTabChildren();t&&t.length>1&&t[0].focus()})),r.tabLoopRef=ue.default.createRef(),r}return vt(n,[{key:"render",value:function(){return this.props.enableTabLoop?ue.default.createElement("div",{className:"react-datepicker__tab-loop",ref:this.tabLoopRef},ue.default.createElement("div",{className:"react-datepicker__tab-loop__start",tabIndex:"0",onFocus:this.handleFocusStart}),this.props.children,ue.default.createElement("div",{className:"react-datepicker__tab-loop__end",tabIndex:"0",onFocus:this.handleFocusEnd})):this.props.children}}],[{key:"defaultProps",get:function(){return{enableTabLoop:!0}}}]),n}(ue.default.Component),Kn=function(e){wt(n,e);var t=It(n);function n(){return ft(this,n),t.apply(this,arguments)}return vt(n,[{key:"render",value:function(){var e,t=this.props,n=t.className,r=t.wrapperClassName,a=t.hidePopper,s=t.popperComponent,i=t.popperModifiers,o=t.popperPlacement,l=t.popperProps,c=t.targetComponent,d=t.enableTabLoop,u=t.popperOnKeyDown,p=t.portalId,m=t.portalHost;if(!a){var h=pe.default("react-datepicker-popper",n);e=ue.default.createElement(ce.Popper,yt({modifiers:i,placement:o},l),(function(e){var t=e.ref,n=e.style,r=e.placement,a=e.arrowProps;return ue.default.createElement(zn,{enableTabLoop:d},ue.default.createElement("div",{ref:t,style:n,className:h,"data-placement":r,onKeyDown:u},ue.default.cloneElement(s,{arrowProps:a})))}))}this.props.popperContainer&&(e=ue.default.createElement(this.props.popperContainer,{},e)),p&&!a&&(e=ue.default.createElement(Bn,{portalId:p,portalHost:m},e));var f=pe.default("react-datepicker-wrapper",r);return ue.default.createElement(ce.Manager,{className:"react-datepicker-manager"},ue.default.createElement(ce.Reference,null,(function(e){var t=e.ref;return ue.default.createElement("div",{ref:t,className:f},c)})),e)}}],[{key:"defaultProps",get:function(){return{hidePopper:!0,popperModifiers:[],popperProps:{},popperPlacement:"bottom-start"}}}]),n}(ue.default.Component),Gn="react-datepicker-ignore-onclickoutside",Qn=dt.default(Yn),Xn="Date input not valid.",Jn=function(e){wt(n,e);var t=It(n);function n(e){var r;return ft(this,n),bt(Zt(r=t.call(this,e)),"getPreSelection",(function(){return r.props.openToDate?r.props.openToDate:r.props.selectsEnd&&r.props.startDate?r.props.startDate:r.props.selectsStart&&r.props.endDate?r.props.endDate:Ot()})),bt(Zt(r),"calcInitialState",(function(){var e,t=r.getPreSelection(),n=yn(r.props),a=wn(r.props),s=n&&st.default(t,He.default(n))?n:a&&at.default(t,Xe.default(a))?a:t;return{open:r.props.startOpen||!1,preventFocus:!1,preSelection:null!==(e=r.props.selectsRange?r.props.startDate:r.props.selected)&&void 0!==e?e:s,highlightDates:xn(r.props.highlightDates),focused:!1,shouldFocusDayInline:!1}})),bt(Zt(r),"clearPreventFocusTimeout",(function(){r.preventFocusTimeout&&clearTimeout(r.preventFocusTimeout)})),bt(Zt(r),"setFocus",(function(){r.input&&r.input.focus&&r.input.focus({preventScroll:!0})})),bt(Zt(r),"setBlur",(function(){r.input&&r.input.blur&&r.input.blur(),r.cancelFocusInput()})),bt(Zt(r),"setOpen",(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r.setState({open:e,preSelection:e&&r.state.open?r.state.preSelection:r.calcInitialState().preSelection,lastPreSelectChange:tr},(function(){e||r.setState((function(e){return{focused:!!t&&e.focused}}),(function(){!t&&r.setBlur(),r.setState({inputValue:null})}))}))})),bt(Zt(r),"inputOk",(function(){return me.default(r.state.preSelection)})),bt(Zt(r),"isCalendarOpen",(function(){return void 0===r.props.open?r.state.open&&!r.props.disabled&&!r.props.readOnly:r.props.open})),bt(Zt(r),"handleFocus",(function(e){r.state.preventFocus||(r.props.onFocus(e),r.props.preventOpenOnFocus||r.props.readOnly||r.setOpen(!0)),r.setState({focused:!0})})),bt(Zt(r),"cancelFocusInput",(function(){clearTimeout(r.inputFocusTimeout),r.inputFocusTimeout=null})),bt(Zt(r),"deferFocusInput",(function(){r.cancelFocusInput(),r.inputFocusTimeout=setTimeout((function(){return r.setFocus()}),1)})),bt(Zt(r),"handleDropdownFocus",(function(){r.cancelFocusInput()})),bt(Zt(r),"handleBlur",(function(e){(!r.state.open||r.props.withPortal||r.props.showTimeInput)&&r.props.onBlur(e),r.setState({focused:!1})})),bt(Zt(r),"handleCalendarClickOutside",(function(e){r.props.inline||r.setOpen(!1),r.props.onClickOutside(e),r.props.withPortal&&e.preventDefault()})),bt(Zt(r),"handleChange",(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var a=t[0];if(!r.props.onChangeRaw||(r.props.onChangeRaw.apply(Zt(r),t),"function"==typeof a.isDefaultPrevented&&!a.isDefaultPrevented())){r.setState({inputValue:a.target.value,lastPreSelectChange:er});var s=Rt(a.target.value,r.props.dateFormat,r.props.locale,r.props.strictParsing,r.props.minDate);!s&&a.target.value||r.setSelected(s,a,!0)}})),bt(Zt(r),"handleSelect",(function(e,t,n){if(r.setState({preventFocus:!0},(function(){return r.preventFocusTimeout=setTimeout((function(){return r.setState({preventFocus:!1})}),50),r.preventFocusTimeout})),r.props.onChangeRaw&&r.props.onChangeRaw(t),r.setSelected(e,t,!1,n),!r.props.shouldCloseOnSelect||r.props.showTimeSelect)r.setPreSelection(e);else if(!r.props.inline){r.props.selectsRange||r.setOpen(!1);var a=r.props,s=a.startDate,i=a.endDate;!s||i||st.default(e,s)||r.setOpen(!1)}})),bt(Zt(r),"setSelected",(function(e,t,n,a){var s=e;if(null===s||!rn(s,r.props)){var i=r.props,o=i.onChange,l=i.selectsRange,c=i.startDate,d=i.endDate;if(!Gt(r.props.selected,s)||r.props.allowSameDay||l)if(null!==s&&(!r.props.selected||n&&(r.props.showTimeSelect||r.props.showTimeSelectOnly||r.props.showTimeInput)||(s=Lt(s,{hour:Te.default(r.props.selected),minute:Ce.default(r.props.selected),second:Se.default(r.props.selected)})),r.props.inline||r.setState({preSelection:s}),r.props.focusSelectedMonth||r.setState({monthSelectedIn:a})),l){var u=c&&d;c||d?c&&!d&&(st.default(s,c)?o([s,null],t):o([c,s],t)):o([s,null],t),u&&o([s,null],t)}else o(s,t);n||(r.props.onSelect(s,t),r.setState({inputValue:null}))}})),bt(Zt(r),"setPreSelection",(function(e){var t=void 0!==r.props.minDate,n=void 0!==r.props.maxDate,a=!0;if(e){var s=He.default(e);if(t&&n)a=Qt(e,r.props.minDate,r.props.maxDate);else if(t){var i=He.default(r.props.minDate);a=at.default(e,i)||Gt(s,i)}else if(n){var o=Xe.default(r.props.maxDate);a=st.default(e,o)||Gt(s,o)}}a&&r.setState({preSelection:e})})),bt(Zt(r),"handleTimeChange",(function(e){var t=Lt(r.props.selected?r.props.selected:r.getPreSelection(),{hour:Te.default(e),minute:Ce.default(e)});r.setState({preSelection:t}),r.props.onChange(t),r.props.shouldCloseOnSelect&&r.setOpen(!1),r.props.showTimeInput&&r.setOpen(!0),r.setState({inputValue:null})})),bt(Zt(r),"onInputClick",(function(){r.props.disabled||r.props.readOnly||r.setOpen(!0),r.props.onInputClick()})),bt(Zt(r),"onInputKeyDown",(function(e){r.props.onKeyDown(e);var t=e.key;if(r.state.open||r.props.inline||r.props.preventOpenOnFocus){if(r.state.open){if("ArrowDown"===t||"ArrowUp"===t){e.preventDefault();var n=r.calendar.componentNode&&r.calendar.componentNode.querySelector('.react-datepicker__day[tabindex="0"]');return void(n&&n.focus({preventScroll:!0}))}var a=Ot(r.state.preSelection);"Enter"===t?(e.preventDefault(),r.inputOk()&&r.state.lastPreSelectChange===tr?(r.handleSelect(a,e),!r.props.shouldCloseOnSelect&&r.setPreSelection(a)):r.setOpen(!1)):"Escape"===t&&(e.preventDefault(),r.setOpen(!1)),r.inputOk()||r.props.onInputError({code:1,msg:Xn})}}else"ArrowDown"!==t&&"ArrowUp"!==t&&"Enter"!==t||r.onInputClick()})),bt(Zt(r),"onDayKeyDown",(function(e){r.props.onKeyDown(e);var t=e.key,n=Ot(r.state.preSelection);if("Enter"===t)e.preventDefault(),r.handleSelect(n,e),!r.props.shouldCloseOnSelect&&r.setPreSelection(n);else if("Escape"===t)e.preventDefault(),r.setOpen(!1),r.inputOk()||r.props.onInputError({code:1,msg:Xn});else if(!r.props.disabledKeyboardNavigation){var a;switch(t){case"ArrowLeft":a=_e.default(n,1);break;case"ArrowRight":a=be.default(n,1);break;case"ArrowUp":a=Ze.default(n,1);break;case"ArrowDown":a=ye.default(n,1);break;case"PageUp":a=je.default(n,1);break;case"PageDown":a=we.default(n,1);break;case"Home":a=Ie.default(n,1);break;case"End":a=xe.default(n,1)}if(!a)return void(r.props.onInputError&&r.props.onInputError({code:1,msg:Xn}));if(e.preventDefault(),r.setState({lastPreSelectChange:tr}),r.props.adjustDateOnChange&&r.setSelected(a),r.setPreSelection(a),r.props.inline){var s=Ee.default(n),i=Ee.default(a),o=Re.default(n),l=Re.default(a);s!==i||o!==l?r.setState({shouldFocusDayInline:!0}):r.setState({shouldFocusDayInline:!1})}}})),bt(Zt(r),"onPopperKeyDown",(function(e){"Escape"===e.key&&(e.preventDefault(),r.setState({preventFocus:!0},(function(){r.setOpen(!1),setTimeout((function(){r.setFocus(),r.setState({preventFocus:!1})}))})))})),bt(Zt(r),"onClearClick",(function(e){e&&e.preventDefault&&e.preventDefault(),r.props.selectsRange?r.props.onChange([null,null],e):r.props.onChange(null,e),r.setState({inputValue:null})})),bt(Zt(r),"clear",(function(){r.onClearClick()})),bt(Zt(r),"onScroll",(function(e){"boolean"==typeof r.props.closeOnScroll&&r.props.closeOnScroll?e.target!==document&&e.target!==document.documentElement&&e.target!==document.body||r.setOpen(!1):"function"==typeof r.props.closeOnScroll&&r.props.closeOnScroll(e)&&r.setOpen(!1)})),bt(Zt(r),"renderCalendar",(function(){return r.props.inline||r.isCalendarOpen()?ue.default.createElement(Qn,{ref:function(e){r.calendar=e},locale:r.props.locale,calendarStartDay:r.props.calendarStartDay,chooseDayAriaLabelPrefix:r.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:r.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:r.props.weekAriaLabelPrefix,adjustDateOnChange:r.props.adjustDateOnChange,setOpen:r.setOpen,shouldCloseOnSelect:r.props.shouldCloseOnSelect,dateFormat:r.props.dateFormatCalendar,useWeekdaysShort:r.props.useWeekdaysShort,formatWeekDay:r.props.formatWeekDay,dropdownMode:r.props.dropdownMode,selected:r.props.selected,preSelection:r.state.preSelection,onSelect:r.handleSelect,onWeekSelect:r.props.onWeekSelect,openToDate:r.props.openToDate,minDate:r.props.minDate,maxDate:r.props.maxDate,selectsStart:r.props.selectsStart,selectsEnd:r.props.selectsEnd,selectsRange:r.props.selectsRange,startDate:r.props.startDate,endDate:r.props.endDate,excludeDates:r.props.excludeDates,excludeDateIntervals:r.props.excludeDateIntervals,filterDate:r.props.filterDate,onClickOutside:r.handleCalendarClickOutside,formatWeekNumber:r.props.formatWeekNumber,highlightDates:r.state.highlightDates,includeDates:r.props.includeDates,includeDateIntervals:r.props.includeDateIntervals,includeTimes:r.props.includeTimes,injectTimes:r.props.injectTimes,inline:r.props.inline,shouldFocusDayInline:r.state.shouldFocusDayInline,peekNextMonth:r.props.peekNextMonth,showMonthDropdown:r.props.showMonthDropdown,showPreviousMonths:r.props.showPreviousMonths,useShortMonthInDropdown:r.props.useShortMonthInDropdown,showMonthYearDropdown:r.props.showMonthYearDropdown,showWeekNumbers:r.props.showWeekNumbers,showYearDropdown:r.props.showYearDropdown,withPortal:r.props.withPortal,forceShowMonthNavigation:r.props.forceShowMonthNavigation,showDisabledMonthNavigation:r.props.showDisabledMonthNavigation,scrollableYearDropdown:r.props.scrollableYearDropdown,scrollableMonthYearDropdown:r.props.scrollableMonthYearDropdown,todayButton:r.props.todayButton,weekLabel:r.props.weekLabel,outsideClickIgnoreClass:Gn,fixedHeight:r.props.fixedHeight,monthsShown:r.props.monthsShown,monthSelectedIn:r.state.monthSelectedIn,onDropdownFocus:r.handleDropdownFocus,onMonthChange:r.props.onMonthChange,onYearChange:r.props.onYearChange,dayClassName:r.props.dayClassName,weekDayClassName:r.props.weekDayClassName,monthClassName:r.props.monthClassName,timeClassName:r.props.timeClassName,showTimeSelect:r.props.showTimeSelect,showTimeSelectOnly:r.props.showTimeSelectOnly,onTimeChange:r.handleTimeChange,timeFormat:r.props.timeFormat,timeIntervals:r.props.timeIntervals,minTime:r.props.minTime,maxTime:r.props.maxTime,excludeTimes:r.props.excludeTimes,filterTime:r.props.filterTime,timeCaption:r.props.timeCaption,className:r.props.calendarClassName,container:r.props.calendarContainer,yearItemNumber:r.props.yearItemNumber,yearDropdownItemNumber:r.props.yearDropdownItemNumber,previousMonthAriaLabel:r.props.previousMonthAriaLabel,previousMonthButtonLabel:r.props.previousMonthButtonLabel,nextMonthAriaLabel:r.props.nextMonthAriaLabel,nextMonthButtonLabel:r.props.nextMonthButtonLabel,previousYearAriaLabel:r.props.previousYearAriaLabel,previousYearButtonLabel:r.props.previousYearButtonLabel,nextYearAriaLabel:r.props.nextYearAriaLabel,nextYearButtonLabel:r.props.nextYearButtonLabel,timeInputLabel:r.props.timeInputLabel,disabledKeyboardNavigation:r.props.disabledKeyboardNavigation,renderCustomHeader:r.props.renderCustomHeader,popperProps:r.props.popperProps,renderDayContents:r.props.renderDayContents,onDayMouseEnter:r.props.onDayMouseEnter,onMonthMouseLeave:r.props.onMonthMouseLeave,selectsDisabledDaysInRange:r.props.selectsDisabledDaysInRange,showTimeInput:r.props.showTimeInput,showMonthYearPicker:r.props.showMonthYearPicker,showFullMonthYearPicker:r.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:r.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:r.props.showFourColumnMonthYearPicker,showYearPicker:r.props.showYearPicker,showQuarterYearPicker:r.props.showQuarterYearPicker,showPopperArrow:r.props.showPopperArrow,excludeScrollbar:r.props.excludeScrollbar,handleOnKeyDown:r.props.onKeyDown,handleOnDayKeyDown:r.onDayKeyDown,isInputFocused:r.state.focused,customTimeInput:r.props.customTimeInput,setPreSelection:r.setPreSelection},r.props.children):null})),bt(Zt(r),"renderDateInput",(function(){var e,t=pe.default(r.props.className,bt({},Gn,r.state.open)),n=r.props.customInput||ue.default.createElement("input",{type:"text"}),a=r.props.customInputRef||"ref",s="string"==typeof r.props.value?r.props.value:"string"==typeof r.state.inputValue?r.state.inputValue:r.props.selectsRange?function(e,t,n){if(!e)return"";var r=Mt(e,n),a=t?Mt(t,n):"";return"".concat(r," - ").concat(a)}(r.props.startDate,r.props.endDate,r.props):Mt(r.props.selected,r.props);return ue.default.cloneElement(n,(bt(e={},a,(function(e){r.input=e})),bt(e,"value",s),bt(e,"onBlur",r.handleBlur),bt(e,"onChange",r.handleChange),bt(e,"onClick",r.onInputClick),bt(e,"onFocus",r.handleFocus),bt(e,"onKeyDown",r.onInputKeyDown),bt(e,"id",r.props.id),bt(e,"name",r.props.name),bt(e,"autoFocus",r.props.autoFocus),bt(e,"placeholder",r.props.placeholderText),bt(e,"disabled",r.props.disabled),bt(e,"autoComplete",r.props.autoComplete),bt(e,"className",pe.default(n.props.className,t)),bt(e,"title",r.props.title),bt(e,"readOnly",r.props.readOnly),bt(e,"required",r.props.required),bt(e,"tabIndex",r.props.tabIndex),bt(e,"aria-describedby",r.props.ariaDescribedBy),bt(e,"aria-invalid",r.props.ariaInvalid),bt(e,"aria-labelledby",r.props.ariaLabelledBy),bt(e,"aria-required",r.props.ariaRequired),e))})),bt(Zt(r),"renderClearButton",(function(){var e=r.props,t=e.isClearable,n=e.selected,a=e.startDate,s=e.endDate,i=e.clearButtonTitle,o=e.clearButtonClassName,l=void 0===o?"":o,c=e.ariaLabelClose,d=void 0===c?"Close":c;return!t||null==n&&null==a&&null==s?null:ue.default.createElement("button",{type:"button",className:"react-datepicker__close-icon ".concat(l).trim(),"aria-label":d,onClick:r.onClearClick,title:i,tabIndex:-1})})),r.state=r.calcInitialState(),r}return vt(n,[{key:"componentDidMount",value:function(){window.addEventListener("scroll",this.onScroll,!0)}},{key:"componentDidUpdate",value:function(e,t){var n,r;e.inline&&(n=e.selected,r=this.props.selected,n&&r?Ee.default(n)!==Ee.default(r)||Re.default(n)!==Re.default(r):n!==r)&&this.setPreSelection(this.props.selected),void 0!==this.state.monthSelectedIn&&e.monthsShown!==this.props.monthsShown&&this.setState({monthSelectedIn:0}),e.highlightDates!==this.props.highlightDates&&this.setState({highlightDates:xn(this.props.highlightDates)}),t.focused||Gt(e.selected,this.props.selected)||this.setState({inputValue:null}),t.open!==this.state.open&&(!1===t.open&&!0===this.state.open&&this.props.onCalendarOpen(),!0===t.open&&!1===this.state.open&&this.props.onCalendarClose())}},{key:"componentWillUnmount",value:function(){this.clearPreventFocusTimeout(),window.removeEventListener("scroll",this.onScroll,!0)}},{key:"renderInputContainer",value:function(){return ue.default.createElement("div",{className:"react-datepicker__input-container"},this.renderDateInput(),this.renderClearButton())}},{key:"render",value:function(){var e=this.renderCalendar();if(this.props.inline)return e;if(this.props.withPortal){var t=this.state.open?ue.default.createElement("div",{className:"react-datepicker__portal"},e):null;return this.state.open&&this.props.portalId&&(t=ue.default.createElement(Bn,{portalId:this.props.portalId,portalHost:this.props.portalHost},t)),ue.default.createElement("div",null,this.renderInputContainer(),t)}return ue.default.createElement(Kn,{className:this.props.popperClassName,wrapperClassName:this.props.wrapperClassName,hidePopper:!this.isCalendarOpen(),portalId:this.props.portalId,portalHost:this.props.portalHost,popperModifiers:this.props.popperModifiers,targetComponent:this.renderInputContainer(),popperContainer:this.props.popperContainer,popperComponent:e,popperPlacement:this.props.popperPlacement,popperProps:this.props.popperProps,popperOnKeyDown:this.onPopperKeyDown,enableTabLoop:this.props.enableTabLoop})}}],[{key:"defaultProps",get:function(){return{allowSameDay:!1,dateFormat:"MM/dd/yyyy",dateFormatCalendar:"LLLL yyyy",onChange:function(){},disabled:!1,disabledKeyboardNavigation:!1,dropdownMode:"scroll",onFocus:function(){},onBlur:function(){},onKeyDown:function(){},onInputClick:function(){},onSelect:function(){},onClickOutside:function(){},onMonthChange:function(){},onCalendarOpen:function(){},onCalendarClose:function(){},preventOpenOnFocus:!1,onYearChange:function(){},onInputError:function(){},monthsShown:1,readOnly:!1,withPortal:!1,selectsDisabledDaysInRange:!1,shouldCloseOnSelect:!0,showTimeSelect:!1,showTimeInput:!1,showPreviousMonths:!1,showMonthYearPicker:!1,showFullMonthYearPicker:!1,showTwoColumnMonthYearPicker:!1,showFourColumnMonthYearPicker:!1,showYearPicker:!1,showQuarterYearPicker:!1,strictParsing:!1,timeIntervals:30,timeCaption:"Time",previousMonthAriaLabel:"Previous Month",previousMonthButtonLabel:"Previous Month",nextMonthAriaLabel:"Next Month",nextMonthButtonLabel:"Next Month",previousYearAriaLabel:"Previous Year",previousYearButtonLabel:"Previous Year",nextYearAriaLabel:"Next Year",nextYearButtonLabel:"Next Year",timeInputLabel:"Time",enableTabLoop:!0,yearItemNumber:Dt,renderDayContents:function(e){return e},focusSelectedMonth:!1,showPopperArrow:!0,excludeScrollbar:!0,customTimeInput:null,calendarStartDay:void 0}}}]),n}(ue.default.Component),er="input",tr="navigate";e.CalendarContainer=Vn,e.default=Jn,e.getDefaultLocale=Xt,e.registerLocale=function(e,t){var r="undefined"!=typeof window?window:n.g;r.__localeData__||(r.__localeData__={}),r.__localeData__[e]=t},e.setDefaultLocale=function(e){("undefined"!=typeof window?window:n.g).__localeId__=e},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(45993),n(45697),n(78596),n(71381),n(12274),n(49546),n(58545),n(78343),n(77349),n(63500),n(11640),n(21593),n(1784),n(88330),n(7069),n(77982),n(54559),n(59319),n(77881),n(39159),n(85817),n(20466),n(55855),n(9827),n(78966),n(56605),n(95570),n(28789),n(39880),n(4543),n(37042),n(62225),n(11503),n(44749),n(37950),n(99890),n(92300),n(84129),n(52724),n(91857),n(69119),n(584),n(43703),n(94431),n(38148),n(57870),n(67090),n(4135),n(96843),n(3151),n(49160),n(60792),n(86117),n(42699),n(313),n(24257),n(19013),n(45853),n(23855),n(58949),n(52524),n(48934))},69590:function(e){var t="undefined"!=typeof Element,n="function"==typeof Map,r="function"==typeof Set,a="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function s(e,i){if(e===i)return!0;if(e&&i&&"object"==typeof e&&"object"==typeof i){if(e.constructor!==i.constructor)return!1;var o,l,c,d;if(Array.isArray(e)){if((o=e.length)!=i.length)return!1;for(l=o;0!=l--;)if(!s(e[l],i[l]))return!1;return!0}if(n&&e instanceof Map&&i instanceof Map){if(e.size!==i.size)return!1;for(d=e.entries();!(l=d.next()).done;)if(!i.has(l.value[0]))return!1;for(d=e.entries();!(l=d.next()).done;)if(!s(l.value[1],i.get(l.value[0])))return!1;return!0}if(r&&e instanceof Set&&i instanceof Set){if(e.size!==i.size)return!1;for(d=e.entries();!(l=d.next()).done;)if(!i.has(l.value[0]))return!1;return!0}if(a&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(i)){if((o=e.length)!=i.length)return!1;for(l=o;0!=l--;)if(e[l]!==i[l])return!1;return!0}if(e.constructor===RegExp)return e.source===i.source&&e.flags===i.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===i.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===i.toString();if((o=(c=Object.keys(e)).length)!==Object.keys(i).length)return!1;for(l=o;0!=l--;)if(!Object.prototype.hasOwnProperty.call(i,c[l]))return!1;if(t&&e instanceof Element)return!1;for(l=o;0!=l--;)if(("_owner"!==c[l]&&"__v"!==c[l]&&"__o"!==c[l]||!e.$$typeof)&&!s(e[c[l]],i[c[l]]))return!1;return!0}return e!=e&&i!=i}e.exports=function(e,t){try{return s(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}},58949:function(e,t,n){"use strict";n.r(t),n.d(t,{IGNORE_CLASS_NAME:function(){return h}});var r=n(45993),a=n(52524);function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(e,t,n){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(n):e.classList.contains(n))}var l,c,d=(void 0===l&&(l=0),function(){return++l}),u={},p={},m=["touchstart","touchmove"],h="ignore-react-onclickoutside";function f(e,t){var n=null;return-1!==m.indexOf(t)&&c&&(n={passive:!e.props.preventDefault}),n}t.default=function(e,t){var n,l,m=e.displayName||e.name||"Component";return l=n=function(n){var l,h;function g(e){var r;return(r=n.call(this,e)||this).__outsideClickHandler=function(e){if("function"!=typeof r.__clickOutsideHandlerProp){var t=r.getInstance();if("function"!=typeof t.props.handleClickOutside){if("function"!=typeof t.handleClickOutside)throw new Error("WrappedComponent: "+m+" lacks a handleClickOutside(event) function for processing outside click events.");t.handleClickOutside(e)}else t.props.handleClickOutside(e)}else r.__clickOutsideHandlerProp(e)},r.__getComponentNode=function(){var e=r.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():(0,a.findDOMNode)(e)},r.enableOnClickOutside=function(){if("undefined"!=typeof document&&!p[r._uid]){void 0===c&&(c=function(){if("undefined"!=typeof window&&"function"==typeof window.addEventListener){var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}}),n=function(){};return window.addEventListener("testPassiveEventSupport",n,t),window.removeEventListener("testPassiveEventSupport",n,t),e}}()),p[r._uid]=!0;var e=r.props.eventTypes;e.forEach||(e=[e]),u[r._uid]=function(e){var t;null!==r.componentNode&&(r.props.preventDefault&&e.preventDefault(),r.props.stopPropagation&&e.stopPropagation(),r.props.excludeScrollbar&&(t=e,document.documentElement.clientWidth<=t.clientX||document.documentElement.clientHeight<=t.clientY)||function(e,t,n){if(e===t)return!0;for(;e.parentNode||e.host;){if(e.parentNode&&o(e,t,n))return!0;e=e.parentNode||e.host}return e}(e.composed&&e.composedPath&&e.composedPath().shift()||e.target,r.componentNode,r.props.outsideClickIgnoreClass)===document&&r.__outsideClickHandler(e))},e.forEach((function(e){document.addEventListener(e,u[r._uid],f(i(r),e))}))}},r.disableOnClickOutside=function(){delete p[r._uid];var e=u[r._uid];if(e&&"undefined"!=typeof document){var t=r.props.eventTypes;t.forEach||(t=[t]),t.forEach((function(t){return document.removeEventListener(t,e,f(i(r),t))})),delete u[r._uid]}},r.getRef=function(e){return r.instanceRef=e},r._uid=d(),r}h=n,(l=g).prototype=Object.create(h.prototype),l.prototype.constructor=l,s(l,h);var v=g.prototype;return v.getInstance=function(){if(e.prototype&&!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},v.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(t&&"function"==typeof t.handleClickOutside&&(this.__clickOutsideHandlerProp=t.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw new Error("WrappedComponent: "+m+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},v.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},v.componentWillUnmount=function(){this.disableOnClickOutside()},v.render=function(){var t=this.props;t.excludeScrollbar;var n=function(e,t){if(null==e)return{};var n,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(t,["excludeScrollbar"]);return e.prototype&&e.prototype.isReactComponent?n.ref=this.getRef:n.wrappedRef=this.getRef,n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,(0,r.createElement)(e,n)},g}(r.Component),n.displayName="OnClickOutside("+m+")",n.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:h,preventDefault:!1,stopPropagation:!1},n.getClass=function(){return e.getClass?e.getClass():e},l}},48934:function(e,t,n){"use strict";n.r(t),n.d(t,{Manager:function(){return i},Popper:function(){return w},Reference:function(){return Z},usePopper:function(){return g}});var r=n(45993),a=r.createContext(),s=r.createContext();function i(e){var t=e.children,n=r.useState(null),i=n[0],o=n[1],l=r.useRef(!1);r.useEffect((function(){return function(){l.current=!0}}),[]);var c=r.useCallback((function(e){l.current||o(e)}),[]);return r.createElement(a.Provider,{value:i},r.createElement(s.Provider,{value:c},t))}var o=function(e){return Array.isArray(e)?e[0]:e},l=function(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}},c=function(e,t){if("function"==typeof e)return l(e,t);null!=e&&(e.current=t)},d=function(e){return e.reduce((function(e,t){var n=t[0],r=t[1];return e[n]=r,e}),{})},u="undefined"!=typeof window&&window.document&&window.document.createElement?r.useLayoutEffect:r.useEffect,p=n(17211),m=n(69590),h=n.n(m),f=[],g=function(e,t,n){void 0===n&&(n={});var a=r.useRef(null),s={onFirstUpdate:n.onFirstUpdate,placement:n.placement||"bottom",strategy:n.strategy||"absolute",modifiers:n.modifiers||f},i=r.useState({styles:{popper:{position:s.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),o=i[0],l=i[1],c=r.useMemo((function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(e){var t=e.state,n=Object.keys(t.elements);l({styles:d(n.map((function(e){return[e,t.styles[e]||{}]}))),attributes:d(n.map((function(e){return[e,t.attributes[e]]})))})},requires:["computeStyles"]}}),[]),m=r.useMemo((function(){var e={onFirstUpdate:s.onFirstUpdate,placement:s.placement,strategy:s.strategy,modifiers:[].concat(s.modifiers,[c,{name:"applyStyles",enabled:!1}])};return h()(a.current,e)?a.current||e:(a.current=e,e)}),[s.onFirstUpdate,s.placement,s.strategy,s.modifiers,c]),g=r.useRef();return u((function(){g.current&&g.current.setOptions(m)}),[m]),u((function(){if(null!=e&&null!=t){var r=(n.createPopper||p.fi)(e,t,m);return g.current=r,function(){r.destroy(),g.current=null}}}),[e,t,n.createPopper]),{state:g.current?g.current.state:null,styles:o.styles,attributes:o.attributes,update:g.current?g.current.update:null,forceUpdate:g.current?g.current.forceUpdate:null}},v=function(){},b=function(){return Promise.resolve(null)},y=[];function w(e){var t=e.placement,n=void 0===t?"bottom":t,s=e.strategy,i=void 0===s?"absolute":s,l=e.modifiers,d=void 0===l?y:l,u=e.referenceElement,p=e.onFirstUpdate,m=e.innerRef,h=e.children,f=r.useContext(a),w=r.useState(null),x=w[0],_=w[1],Z=r.useState(null),j=Z[0],I=Z[1];r.useEffect((function(){c(m,x)}),[m,x]);var S=r.useMemo((function(){return{placement:n,strategy:i,onFirstUpdate:p,modifiers:[].concat(d,[{name:"arrow",enabled:null!=j,options:{element:j}}])}}),[n,i,p,d,j]),C=g(u||f,x,S),T=C.state,k=C.styles,N=C.forceUpdate,D=C.update,E=r.useMemo((function(){return{ref:_,style:k.popper,placement:T?T.placement:n,hasPopperEscaped:T&&T.modifiersData.hide?T.modifiersData.hide.hasPopperEscaped:null,isReferenceHidden:T&&T.modifiersData.hide?T.modifiersData.hide.isReferenceHidden:null,arrowProps:{style:k.arrow,ref:I},forceUpdate:N||v,update:D||b}}),[_,I,n,T,k,D,N]);return o(h)(E)}var x=n(42473),_=n.n(x);function Z(e){var t=e.children,n=e.innerRef,a=r.useContext(s),i=r.useCallback((function(e){c(n,e),l(a,e)}),[n,a]);return r.useEffect((function(){return function(){return c(n,null)}})),r.useEffect((function(){_()(Boolean(a),"`Reference` should not be used outside of a `Manager` component.")}),[a]),o(t)({ref:i})}},87903:function(e){e.exports=function(e){if(!window.satismeter){window.satismeter=function(){var e=[];function t(){e.push(arguments)}return t.q=e,t}();var t=document.createElement("script"),n=document.getElementsByTagName("script")[0].parentNode;t.async=1,t.src="https://app.satismeter.com/satismeter.js",n.appendChild(t)}return window.satismeter(e)}},20454:function(e,t,n){var r,a,s;a=[n(65311)],void 0===(s="function"==typeof(r=function(t){var n=function(){if(t&&t.fn&&t.fn.select2&&t.fn.select2.amd)var n=t.fn.select2.amd;var r,a,s,i;return n&&n.requirejs||(n?a=n:n={},function(e){var t,n,i,o,l={},c={},d={},u={},p=Object.prototype.hasOwnProperty,m=[].slice,h=/\.js$/;function f(e,t){return p.call(e,t)}function g(e,t){var n,r,a,s,i,o,l,c,u,p,m,f=t&&t.split("/"),g=d.map,v=g&&g["*"]||{};if(e){for(i=(e=e.split("/")).length-1,d.nodeIdCompat&&h.test(e[i])&&(e[i]=e[i].replace(h,"")),"."===e[0].charAt(0)&&f&&(e=f.slice(0,f.length-1).concat(e)),u=0;u<e.length;u++)if("."===(m=e[u]))e.splice(u,1),u-=1;else if(".."===m){if(0===u||1===u&&".."===e[2]||".."===e[u-1])continue;u>0&&(e.splice(u-1,2),u-=2)}e=e.join("/")}if((f||v)&&g){for(u=(n=e.split("/")).length;u>0;u-=1){if(r=n.slice(0,u).join("/"),f)for(p=f.length;p>0;p-=1)if((a=g[f.slice(0,p).join("/")])&&(a=a[r])){s=a,o=u;break}if(s)break;!l&&v&&v[r]&&(l=v[r],c=u)}!s&&l&&(s=l,o=c),s&&(n.splice(0,o,s),e=n.join("/"))}return e}function v(t,r){return function(){var a=m.call(arguments,0);return"string"!=typeof a[0]&&1===a.length&&a.push(null),n.apply(e,a.concat([t,r]))}}function b(e){return function(t){l[e]=t}}function y(n){if(f(c,n)){var r=c[n];delete c[n],u[n]=!0,t.apply(e,r)}if(!f(l,n)&&!f(u,n))throw new Error("No "+n);return l[n]}function w(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function x(e){return e?w(e):[]}function _(e){return function(){return d&&d.config&&d.config[e]||{}}}i=function(e,t){var n,r,a=w(e),s=a[0],i=t[1];return e=a[1],s&&(n=y(s=g(s,i))),s?e=n&&n.normalize?n.normalize(e,(r=i,function(e){return g(e,r)})):g(e,i):(s=(a=w(e=g(e,i)))[0],e=a[1],s&&(n=y(s))),{f:s?s+"!"+e:e,n:e,pr:s,p:n}},o={require:function(e){return v(e)},exports:function(e){var t=l[e];return void 0!==t?t:l[e]={}},module:function(e){return{id:e,uri:"",exports:l[e],config:_(e)}}},t=function(t,n,r,a){var s,d,p,m,h,g,w,_=[],Z=typeof r;if(g=x(a=a||t),"undefined"===Z||"function"===Z){for(n=!n.length&&r.length?["require","exports","module"]:n,h=0;h<n.length;h+=1)if("require"===(d=(m=i(n[h],g)).f))_[h]=o.require(t);else if("exports"===d)_[h]=o.exports(t),w=!0;else if("module"===d)s=_[h]=o.module(t);else if(f(l,d)||f(c,d)||f(u,d))_[h]=y(d);else{if(!m.p)throw new Error(t+" missing "+d);m.p.load(m.n,v(a,!0),b(d),{}),_[h]=l[d]}p=r?r.apply(l[t],_):void 0,t&&(s&&s.exports!==e&&s.exports!==l[t]?l[t]=s.exports:p===e&&w||(l[t]=p))}else t&&(l[t]=r)},r=a=n=function(r,a,s,l,c){if("string"==typeof r)return o[r]?o[r](a):y(i(r,x(a)).f);if(!r.splice){if((d=r).deps&&n(d.deps,d.callback),!a)return;a.splice?(r=a,a=s,s=null):r=e}return a=a||function(){},"function"==typeof s&&(s=l,l=c),l?t(e,r,a,s):setTimeout((function(){t(e,r,a,s)}),4),n},n.config=function(e){return n(e)},r._defined=l,(s=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),f(l,e)||f(c,e)||(c[e]=[e,t,n])}).amd={jQuery:!0}}(),n.requirejs=r,n.require=a,n.define=s),n.define("almond",(function(){})),n.define("jquery",[],(function(){var e=t||$;return null==e&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),e})),n.define("select2/utils",["jquery"],(function(e){var t={};function n(e){var t=e.prototype,n=[];for(var r in t)"function"==typeof t[r]&&"constructor"!==r&&n.push(r);return n}t.Extend=function(e,t){var n={}.hasOwnProperty;function r(){this.constructor=e}for(var a in t)n.call(t,a)&&(e[a]=t[a]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},t.Decorate=function(e,t){var r=n(t),a=n(e);function s(){var n=Array.prototype.unshift,r=t.prototype.constructor.length,a=e.prototype.constructor;r>0&&(n.call(arguments,e.prototype.constructor),a=t.prototype.constructor),a.apply(this,arguments)}t.displayName=e.displayName,s.prototype=new function(){this.constructor=s};for(var i=0;i<a.length;i++){var o=a[i];s.prototype[o]=e.prototype[o]}for(var l=function(e){var n=function(){};e in s.prototype&&(n=s.prototype[e]);var r=t.prototype[e];return function(){return Array.prototype.unshift.call(arguments,n),r.apply(this,arguments)}},c=0;c<r.length;c++){var d=r[c];s.prototype[d]=l(d)}return s};var r=function(){this.listeners={}};r.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},r.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),n[0]._type=e,e in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},r.prototype.invoke=function(e,t){for(var n=0,r=e.length;n<r;n++)e[n].apply(this,t)},t.Observable=r,t.generateChars=function(e){for(var t="",n=0;n<e;n++)t+=Math.floor(36*Math.random()).toString(36);return t},t.bind=function(e,t){return function(){e.apply(t,arguments)}},t._convertData=function(e){for(var t in e){var n=t.split("-"),r=e;if(1!==n.length){for(var a=0;a<n.length;a++){var s=n[a];(s=s.substring(0,1).toLowerCase()+s.substring(1))in r||(r[s]={}),a==n.length-1&&(r[s]=e[t]),r=r[s]}delete e[t]}}return e},t.hasScroll=function(t,n){var r=e(n),a=n.style.overflowX,s=n.style.overflowY;return(a!==s||"hidden"!==s&&"visible"!==s)&&("scroll"===a||"scroll"===s||r.innerHeight()<n.scrollHeight||r.innerWidth()<n.scrollWidth)},t.escapeMarkup=function(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,(function(e){return t[e]}))},t.__cache={};var a=0;return t.GetUniqueElementId=function(e){var n=e.getAttribute("data-select2-id");return null!=n||(n=e.id?"select2-data-"+e.id:"select2-data-"+(++a).toString()+"-"+t.generateChars(4),e.setAttribute("data-select2-id",n)),n},t.StoreData=function(e,n,r){var a=t.GetUniqueElementId(e);t.__cache[a]||(t.__cache[a]={}),t.__cache[a][n]=r},t.GetData=function(n,r){var a=t.GetUniqueElementId(n);return r?t.__cache[a]&&null!=t.__cache[a][r]?t.__cache[a][r]:e(n).data(r):t.__cache[a]},t.RemoveData=function(e){var n=t.GetUniqueElementId(e);null!=t.__cache[n]&&delete t.__cache[n],e.removeAttribute("data-select2-id")},t.copyNonInternalCssClasses=function(e,t){var n=e.getAttribute("class").trim().split(/\s+/);n=n.filter((function(e){return 0===e.indexOf("select2-")}));var r=t.getAttribute("class").trim().split(/\s+/);r=r.filter((function(e){return 0!==e.indexOf("select2-")}));var a=n.concat(r);e.setAttribute("class",a.join(" "))},t})),n.define("select2/results",["jquery","./utils"],(function(e,t){function n(e,t,r){this.$element=e,this.data=r,this.options=t,n.__super__.constructor.call(this)}return t.Extend(n,t.Observable),n.prototype.render=function(){var t=e('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&t.attr("aria-multiselectable","true"),this.$results=t,t},n.prototype.clear=function(){this.$results.empty()},n.prototype.displayMessage=function(t){var n=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var r=e('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),a=this.options.get("translations").get(t.message);r.append(n(a(t.args))),r[0].className+=" select2-results__message",this.$results.append(r)},n.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},n.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n<e.results.length;n++){var r=e.results[n],a=this.option(r);t.push(a)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},n.prototype.position=function(e,t){t.find(".select2-results").append(e)},n.prototype.sort=function(e){return this.options.get("sorter")(e)},n.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option--selectable"),t=e.filter(".select2-results__option--selected");t.length>0?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},n.prototype.setClasses=function(){var n=this;this.data.current((function(r){var a=r.map((function(e){return e.id.toString()}));n.$results.find(".select2-results__option--selectable").each((function(){var n=e(this),r=t.GetData(this,"data"),s=""+r.id;null!=r.element&&r.element.selected||null==r.element&&a.indexOf(s)>-1?(this.classList.add("select2-results__option--selected"),n.attr("aria-selected","true")):(this.classList.remove("select2-results__option--selected"),n.attr("aria-selected","false"))}))}))},n.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},n=this.option(t);n.className+=" loading-results",this.$results.prepend(n)},n.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},n.prototype.option=function(n){var r=document.createElement("li");r.classList.add("select2-results__option"),r.classList.add("select2-results__option--selectable");var a={role:"option"},s=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(var i in(null!=n.element&&s.call(n.element,":disabled")||null==n.element&&n.disabled)&&(a["aria-disabled"]="true",r.classList.remove("select2-results__option--selectable"),r.classList.add("select2-results__option--disabled")),null==n.id&&r.classList.remove("select2-results__option--selectable"),null!=n._resultId&&(r.id=n._resultId),n.title&&(r.title=n.title),n.children&&(a.role="group",a["aria-label"]=n.text,r.classList.remove("select2-results__option--selectable"),r.classList.add("select2-results__option--group")),a){var o=a[i];r.setAttribute(i,o)}if(n.children){var l=e(r),c=document.createElement("strong");c.className="select2-results__group",this.template(n,c);for(var d=[],u=0;u<n.children.length;u++){var p=n.children[u],m=this.option(p);d.push(m)}var h=e("<ul></ul>",{class:"select2-results__options select2-results__options--nested",role:"none"});h.append(d),l.append(c),l.append(h)}else this.template(n,r);return t.StoreData(r,"data",n),r},n.prototype.bind=function(n,r){var a=this,s=n.id+"-results";this.$results.attr("id",s),n.on("results:all",(function(e){a.clear(),a.append(e.data),n.isOpen()&&(a.setClasses(),a.highlightFirstItem())})),n.on("results:append",(function(e){a.append(e.data),n.isOpen()&&a.setClasses()})),n.on("query",(function(e){a.hideMessages(),a.showLoading(e)})),n.on("select",(function(){n.isOpen()&&(a.setClasses(),a.options.get("scrollAfterSelect")&&a.highlightFirstItem())})),n.on("unselect",(function(){n.isOpen()&&(a.setClasses(),a.options.get("scrollAfterSelect")&&a.highlightFirstItem())})),n.on("open",(function(){a.$results.attr("aria-expanded","true"),a.$results.attr("aria-hidden","false"),a.setClasses(),a.ensureHighlightVisible()})),n.on("close",(function(){a.$results.attr("aria-expanded","false"),a.$results.attr("aria-hidden","true"),a.$results.removeAttr("aria-activedescendant")})),n.on("results:toggle",(function(){var e=a.getHighlightedResults();0!==e.length&&e.trigger("mouseup")})),n.on("results:select",(function(){var e=a.getHighlightedResults();if(0!==e.length){var n=t.GetData(e[0],"data");e.hasClass("select2-results__option--selected")?a.trigger("close",{}):a.trigger("select",{data:n})}})),n.on("results:previous",(function(){var e=a.getHighlightedResults(),t=a.$results.find(".select2-results__option--selectable"),n=t.index(e);if(!(n<=0)){var r=n-1;0===e.length&&(r=0);var s=t.eq(r);s.trigger("mouseenter");var i=a.$results.offset().top,o=s.offset().top,l=a.$results.scrollTop()+(o-i);0===r?a.$results.scrollTop(0):o-i<0&&a.$results.scrollTop(l)}})),n.on("results:next",(function(){var e=a.getHighlightedResults(),t=a.$results.find(".select2-results__option--selectable"),n=t.index(e)+1;if(!(n>=t.length)){var r=t.eq(n);r.trigger("mouseenter");var s=a.$results.offset().top+a.$results.outerHeight(!1),i=r.offset().top+r.outerHeight(!1),o=a.$results.scrollTop()+i-s;0===n?a.$results.scrollTop(0):i>s&&a.$results.scrollTop(o)}})),n.on("results:focus",(function(e){e.element[0].classList.add("select2-results__option--highlighted"),e.element[0].setAttribute("aria-selected","true")})),n.on("results:message",(function(e){a.displayMessage(e)})),e.fn.mousewheel&&this.$results.on("mousewheel",(function(e){var t=a.$results.scrollTop(),n=a.$results.get(0).scrollHeight-t+e.deltaY,r=e.deltaY>0&&t-e.deltaY<=0,s=e.deltaY<0&&n<=a.$results.height();r?(a.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):s&&(a.$results.scrollTop(a.$results.get(0).scrollHeight-a.$results.height()),e.preventDefault(),e.stopPropagation())})),this.$results.on("mouseup",".select2-results__option--selectable",(function(n){var r=e(this),s=t.GetData(this,"data");r.hasClass("select2-results__option--selected")?a.options.get("multiple")?a.trigger("unselect",{originalEvent:n,data:s}):a.trigger("close",{}):a.trigger("select",{originalEvent:n,data:s})})),this.$results.on("mouseenter",".select2-results__option--selectable",(function(n){var r=t.GetData(this,"data");a.getHighlightedResults().removeClass("select2-results__option--highlighted").attr("aria-selected","false"),a.trigger("results:focus",{data:r,element:e(this)})}))},n.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},n.prototype.destroy=function(){this.$results.remove()},n.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find(".select2-results__option--selectable").index(e),n=this.$results.offset().top,r=e.offset().top,a=this.$results.scrollTop()+(r-n),s=r-n;a-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(s>this.$results.outerHeight()||s<0)&&this.$results.scrollTop(a)}},n.prototype.template=function(t,n){var r=this.options.get("templateResult"),a=this.options.get("escapeMarkup"),s=r(t,n);null==s?n.style.display="none":"string"==typeof s?n.innerHTML=a(s):e(n).append(s)},n})),n.define("select2/keys",[],(function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}})),n.define("select2/selection/base",["jquery","../utils","../keys"],(function(e,t,n){function r(e,t){this.$element=e,this.options=t,r.__super__.constructor.call(this)}return t.Extend(r,t.Observable),r.prototype.render=function(){var n=e('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=t.GetData(this.$element[0],"old-tabindex")?this._tabindex=t.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),n.attr("title",this.$element.attr("title")),n.attr("tabindex",this._tabindex),n.attr("aria-disabled","false"),this.$selection=n,n},r.prototype.bind=function(e,t){var r=this,a=e.id+"-results";this.container=e,this.$selection.on("focus",(function(e){r.trigger("focus",e)})),this.$selection.on("blur",(function(e){r._handleBlur(e)})),this.$selection.on("keydown",(function(e){r.trigger("keypress",e),e.which===n.SPACE&&e.preventDefault()})),e.on("results:focus",(function(e){r.$selection.attr("aria-activedescendant",e.data._resultId)})),e.on("selection:update",(function(e){r.update(e.data)})),e.on("open",(function(){r.$selection.attr("aria-expanded","true"),r.$selection.attr("aria-owns",a),r._attachCloseHandler(e)})),e.on("close",(function(){r.$selection.attr("aria-expanded","false"),r.$selection.removeAttr("aria-activedescendant"),r.$selection.removeAttr("aria-owns"),r.$selection.trigger("focus"),r._detachCloseHandler(e)})),e.on("enable",(function(){r.$selection.attr("tabindex",r._tabindex),r.$selection.attr("aria-disabled","false")})),e.on("disable",(function(){r.$selection.attr("tabindex","-1"),r.$selection.attr("aria-disabled","true")}))},r.prototype._handleBlur=function(t){var n=this;window.setTimeout((function(){document.activeElement==n.$selection[0]||e.contains(n.$selection[0],document.activeElement)||n.trigger("blur",t)}),1)},r.prototype._attachCloseHandler=function(n){e(document.body).on("mousedown.select2."+n.id,(function(n){var r=e(n.target).closest(".select2");e(".select2.select2-container--open").each((function(){this!=r[0]&&t.GetData(this,"element").select2("close")}))}))},r.prototype._detachCloseHandler=function(t){e(document.body).off("mousedown.select2."+t.id)},r.prototype.position=function(e,t){t.find(".selection").append(e)},r.prototype.destroy=function(){this._detachCloseHandler(this.container)},r.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},r.prototype.isEnabled=function(){return!this.isDisabled()},r.prototype.isDisabled=function(){return this.options.get("disabled")},r})),n.define("select2/selection/single",["jquery","./base","../utils","../keys"],(function(e,t,n,r){function a(){a.__super__.constructor.apply(this,arguments)}return n.Extend(a,t),a.prototype.render=function(){var e=a.__super__.render.call(this);return e[0].classList.add("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},a.prototype.bind=function(e,t){var n=this;a.__super__.bind.apply(this,arguments);var r=e.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",r).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",r),this.$selection.attr("aria-controls",r),this.$selection.on("mousedown",(function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})})),this.$selection.on("focus",(function(e){})),this.$selection.on("blur",(function(e){})),e.on("focus",(function(t){e.isOpen()||n.$selection.trigger("focus")}))},a.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},a.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},a.prototype.selectionContainer=function(){return e("<span></span>")},a.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),r=this.displ