MailPoet Newsletters (New) - Version 3.89.1

Version Description

  • 2022-05-17 =
  • Improved: performance fixes;
  • Improved: error handling when using MailPoet Sending Service;
  • Changed: removed deprecated code;
  • Changed: automatic emails can no longer be activated without an unsubscribe link when sending with MSS;
  • Fixed: remove unnecessary redirect that in some circumstances prevented displaying a form;
  • Fixed: users added via MemberPress now receive welcome emails targeted to custom roles.
Download this release

Release Info

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

Code changes from version 3.89.0 to 3.89.1

assets/dist/js/admin.6dc875a2.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see admin.6dc875a2.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}},45676:function(e,t,n){"use strict";var r={};n.r(r),n.d(r,{canUseWooSubscriptions:function(){return gi},findFiltersValueForSegment:function(){return Ci},getAvailableFilters:function(){return Si},getCustomFieldsList:function(){return bi},getErrors:function(){return Ii},getMembershipPlans:function(){return ui},getNewslettersList:function(){return fi},getProductCategories:function(){return hi},getProducts:function(){return di},getSegment:function(){return yi},getSegmentFilter:function(){return ji},getStaticSegmentsList:function(){return wi},getSubscriberCount:function(){return _i},getSubscriptionProducts:function(){return pi},getWooCommerceCountries:function(){return vi},getWooCommerceCurrencySymbol:function(){return xi},getWordpressRoles:function(){return mi}});var a={};n.r(a),n.d(a,{handleSave:function(){return Ui},pageLoaded:function(){return $i},setErrors:function(){return Ai},setSegment:function(){return Ri},updateSegment:function(){return Pi},updateSegmentFilter:function(){return Mi},updateSegmentFilterFromEvent:function(){return Fi},updateSegmentFromEvent:function(){return Li},updateSubscriberCount:function(){return qi}});var s={};n.r(s),n.d(s,{LOAD_SEGMENT:function(){return Vi},SAVE_SEGMENT:function(){return Wi}});var i=n(52524),o=n.n(i),l=n(73727),c=n(5977),d=n(78596),u=n.n(d),p=n(65311),m=n.n(p),h=n(45697),f=n.n(h),g=n(62698),x=n(33160),v=n(57790),b=n(57040),y=n(44845),w=n(45993),_=n(59050),j=(n(20454),n(15451));class I extends w.Component{constructor(e){super(e),(0,y.Z)(this,"getFieldId",(e=>{const t=e||this.props;return t.field.id||t.field.name})),(0,y.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(_.ZP.isArray(this.props.item[this.props.field.name]))return this.props.item[this.props.field.name].map((e=>e.id))}return null})),(0,y.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),_.ZP.isArray(e)&&void 0!==this.props.field.filter&&(e=e.filter(this.props.field.filter)),e})),(0,y.Z)(this,"getLabel",(e=>void 0!==this.props.field.getLabel?this.props.field.getLabel(e,this.props.item):e.name)),(0,y.Z)(this,"getSearchLabel",(e=>void 0!==this.props.field.getSearchLabel?this.props.field.getSearchLabel(e,this.props.item):null)),(0,y.Z)(this,"getValue",(e=>void 0!==this.props.field.getValue?this.props.field.getValue(e,this.props.item):e.id)),(0,y.Z)(this,"getCount",(e=>void 0!==this.props.field.getCount?this.props.field.getCount(e,this.props.item):null)),(0,y.Z)(this,"getTag",(e=>void 0!==this.props.field.getTag?this.props.field.getTag(e,this.props.item):null)),(0,y.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=_.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=m()(`#${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,y.Z)(this,"resetSelect2",(()=>{this.destroySelect2(),this.setupSelect2()})),(0,y.Z)(this,"destroySelect2",(()=>{this.isSelect2Initialized()&&(m()(`#${this.selectRef.current.id}`).select2("destroy"),this.cleanupAfterSelect2())})),(0,y.Z)(this,"cleanupAfterSelect2",(()=>{m()(`#${this.selectRef.current.id}`).find("option:not(.default)").remove(),m()(`#${this.selectRef.current.id}`).off("select2:unselecting").off("select2:opening")})),(0,y.Z)(this,"allowMultipleValues",(()=>!0===this.props.field.multiple)),(0,y.Z)(this,"isSelect2Initialized",(()=>!0===m()(`#${this.selectRef.current.id}`).hasClass("select2-hidden-accessible"))),(0,y.Z)(this,"isSelect2Component",(()=>this.allowMultipleValues()||this.props.field.forceSelect2)),(0,y.Z)(this,"handleChange",(e=>{if(void 0===this.props.onValueChange)return;const t=m()(`#${this.selectRef.current.id}`).children(":selected").map((function(){return{id:m()(this).val(),text:m()(this).text()}})),n=this.props.field.multiple?_.ZP.pluck(t,"id"):_.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,y.Z)(this,"transformChangedValue",((e,t)=>"function"==typeof this.props.field.transformChangedValue?this.props.field.transformChangedValue.call(this,e,t):e)),(0,y.Z)(this,"insertEmptyOption",(()=>{if(!this.allowMultipleValues())return this.props.field.placeholder?(0,j.jsx)("option",{className:"default"}):void 0})),this.selectRef=(0,w.createRef)()}componentDidMount(){this.isSelect2Component()&&this.setupSelect2()}componentDidUpdate(e){void 0!==this.props.item&&void 0!==e.item&&this.props.item.id!==e.item.id&&m()(`#${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,j.jsx)("option",{className:"default",value:r,title:n,children:t},`option-${e.id}`)}));return(0,j.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,j.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]})})}}I.propTypes={onValueChange:f().func,field:f().shape({name:f().string.isRequired,values:f().oneOfType([f().object,f().array]),getLabel:f().func,resetSelect2OnUpdate:f().bool,selected:f().func,endpoint:f().string,filter:f().func,getSearchLabel:f().func,getValue:f().func,getCount:f().func,getTag:f().func,placeholder:f().string,remoteQuery:f().object,extendSelect2Options:f().object,multiple:f().bool,forceSelect2:f().bool,transformChangedValue:f().func,disabled:f().bool,validation:f().shape({"data-parsley-required":f().bool,"data-parsley-required-message":f().string,"data-parsley-type":f().string,"data-parsley-errors-container":f().string,maxLength:f().number})}).isRequired,item:f().object,disabled:f().bool,width:f().string},I.defaultProps={onValueChange:function(){},disabled:!1,width:"",item:void 0};var S=n(27273),C=n.n(S),T=n(38287);function k(){if(!v.x.subscribersLimitReached)return null;const e=v.x.hasValidApiKey,t=v.x.I18n.t("subscribersLimitNoticeTitle").replace("[subscribersLimit]",v.x.subscribersLimit),n=v.x.I18n.t(e?"yourPlanLimit":"freeVersionLimit").replace("[subscribersLimit]",v.x.subscribersLimit),r=e?v.x.MailPoetComUrlFactory.getUpgradeUrl(v.x.pluginPartialKey):v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount+1),a=C()(v.x.I18n.t("youCanDisableWPUsersList"),/\[link](.*?)\[\/link]/g,(e=>(0,j.jsx)("a",{href:"?page=mailpoet-segments",children:e},"goToSegments")));return(0,j.jsxs)(T.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,j.jsx)("h3",{children:t}),(0,j.jsxs)("p",{children:[n," ",v.x.I18n.t("youNeedToUpgrade"),"active"===v.x.wpSegmentState?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("br",{}),a]}):null]}),(0,j.jsxs)("p",{children:[(0,j.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:r,children:v.x.I18n.t("upgradeNow")}),e&&(0,j.jsxs)(j.Fragment,{children:[" ",(0,j.jsx)("button",{type:"button",className:"button",onClick:async()=>{await v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:v.x.I18n.t("refreshMySubscribers")})]})]})]})}function N(e){let{mssKeyInvalid:t,subscribersCount:n}=e;return t?(0,j.jsxs)(T.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,j.jsx)("h3",{children:v.x.I18n.t("allSendingPausedHeader")}),(0,j.jsx)("p",{children:C()(v.x.I18n.t("allSendingPausedBody"),/\[link\](.*?)\[\/link\]/g,(e=>(0,j.jsx)("a",{href:"?page=mailpoet-settings#premium",children:e},"check-sending")))}),(0,j.jsx)("p",{children:(0,j.jsx)("a",{href:`https://account.mailpoet.com?s=${n}`,className:"button button-primary",target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("allSendingPausedLink")})})]}):null}var D=n(30653);function E(){if(!v.x.emailVolumeLimitReached)return null;const e=v.x.I18n.t("emailVolumeLimitNoticeTitle").replace("[emailVolumeLimit]",v.x.emailVolumeLimit),t=v.x.I18n.t("youReachedEmailVolumeLimit").replace("[emailVolumeLimit]",v.x.emailVolumeLimit),n=v.x.MailPoetComUrlFactory.getUpgradeUrl(v.x.pluginPartialKey),r=new Date,a=new Date(r.getFullYear(),r.getMonth()+1,1);let s=C()(v.x.I18n.t("toContinueUpgradeYourPlanOrWaitUntil"),/\[link](.*?)\[\/link]/g,(e=>(0,j.jsx)("a",{target:"_blank",rel:"noreferrer",href:n,children:e},e)));return s=C()(s,/<b>\[date]<\/b>\./g,(()=>(0,D.ZP)(`<b>${v.x.Date.short(a)}</b>.`))),(0,j.jsxs)(T.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,j.jsx)("h3",{children:e}),(0,j.jsxs)("p",{children:[t,(0,j.jsx)("br",{}),s]}),(0,j.jsxs)("p",{children:[(0,j.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:n,children:v.x.I18n.t("upgradeNow")})," ",(0,j.jsx)("button",{type:"button",className:"button",onClick:async()=>{await v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:v.x.I18n.t("refreshMyEmailVolumeLimit")})]})]})}var O=n(57744);function R(e){let{cacheCalculation:t}=e;const[n,r]=(0,w.useState)(!1),[a,s]=(0,w.useState)([]),i=(new Date).getTime()-new Date(t).getTime(),o=Math.floor(i/1e3/60);return(0,j.jsxs)("div",{className:"mailpoet-subscribers-cache-notice",children:[C()(v.x.I18n.t("subscribersCountWereCalculatedWithMinutesAgo"),/<abbr>(.*?)<\/abbr>/,((e,n)=>(0,j.jsx)("abbr",{title:t,children:e.replace(/(\{\$mins\}|\$mins)/i,String(o))},n))),(0,j.jsx)(O.z,{className:"mailpoet-subscribers-cache-notice-button",type:"button",variant:"secondary",dimension:"small",onClick:()=>{r(!0),v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"settings",action:"recalculateSubscribersCountsCache"}).done((()=>{window.location.reload()})).fail((e=>{s(e.errors.map((e=>e.message))),r(!1)}))},withSpinner:n,children:v.x.I18n.t("recalculateNow")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),a.length>0&&(0,j.jsx)(T.q,{type:"error",children:a.map((e=>(0,j.jsx)("p",{children:e},e)))})]})}var A=n(49793);function P(e){let{subscribersInPlan:t,subscribersInPlanLimit:n}=e;if(!1===t)return null;const r=n?(0,j.jsx)("b",{children:v.x.I18n.t("subscribersInPlanCount").replace("%1$d",t.toLocaleString()).replace("%2$d",n.toLocaleString())},"subscribers_count"):(0,j.jsx)("b",{children:t},"subscribers_count");return(0,j.jsxs)("div",{className:"mailpoet-subscribers-in-plan",children:[C()(v.x.I18n.t("subscribersInPlan"),"%s",(()=>r))," ",(0,j.jsx)(A.Tooltip,{tooltip:v.x.I18n.t("subscribersInPlanTooltip"),place:"right"}),(0,j.jsx)("span",{className:"mailpoet-subscribers-in-plan-spacer",children:" "})]})}var M=n(53423);function L(e){let{id:t,engagementScore:n}=e;const r={unknown:{name:v.x.I18n.t("unknownBadgeName"),type:"unknown",tooltipTitle:v.x.I18n.t("unknownBadgeTooltip"),tooltipText:v.x.I18n.t("tooltipUnknown")},excellent:{name:v.x.I18n.t("excellentBadgeName"),type:"excellent",tooltipTitle:v.x.I18n.t("excellentBadgeTooltip"),tooltipText:v.x.I18n.t("tooltipExcellent")},good:{name:v.x.I18n.t("goodBadgeName"),type:"good",tooltipTitle:v.x.I18n.t("goodBadgeTooltip"),tooltipText:v.x.I18n.t("tooltipGood")},average:{name:v.x.I18n.t("averageBadgeName"),type:"average",tooltipTitle:v.x.I18n.t("averageBadgeTooltip"),tooltipText:v.x.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,j.jsxs)("div",{children:[(0,j.jsx)("div",{className:"mailpoet-listing-stats-tooltip-title",children:s.tooltipTitle.toUpperCase()}),(0,j.jsx)("div",{className:"mailpoet-listing-stats-tooltip-description",children:v.x.I18n.t("engagementScoreDescription")}),(0,j.jsxs)("div",{className:"mailpoet-listing-stats-tooltip-content",children:[(0,j.jsx)(M.C,{type:"unknown",name:v.x.I18n.t("unknownBadgeName")})," : ",r.unknown.tooltipText,(0,j.jsx)("br",{}),(0,j.jsx)(M.C,{type:"excellent",name:v.x.I18n.t("excellentBadgeName")})," : ",r.excellent.tooltipText,(0,j.jsx)("br",{}),(0,j.jsx)(M.C,{type:"good",name:v.x.I18n.t("goodBadgeName")})," : ",r.good.tooltipText,(0,j.jsx)("br",{}),(0,j.jsx)(M.C,{type:"average",name:v.x.I18n.t("averageBadgeName")})," : ",r.average.tooltipText]})]},`tooltip-${a}`);return(0,j.jsxs)("div",{className:"mailpoet-listing-stats-opened-clicked",children:[null!=n&&(0,j.jsxs)("div",{className:"mailpoet-listing-stats-percentages",children:[n.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),"%"]}),(0,j.jsx)("div",{children:(0,j.jsx)(M.C,{isInverted:!0,type:s.type,name:s.name,tooltip:i,tooltipId:a,tooltipPlace:"top"})})]})}var F=n(99181);const q=(0,j.jsx)("svg",{viewBox:"4 4 16 16",children:(0,j.jsx)("path",{d:"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"})});function $(e){let{location:t}=e;return(0,j.jsxs)(F.Q,{children:[(0,j.jsxs)(l.rU,{className:"mailpoet-button button-secondary",to:{pathname:"/new",state:{backUrl:null==t?void 0:t.pathname}},children:[q,(0,j.jsx)("span",{"data-automation-id":"add-new-subscribers-button",children:v.x.I18n.t("new")})]}),(0,j.jsx)("a",{className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-import","data-automation-id":"import-subscribers-button",children:v.x.I18n.t("import")}),(0,j.jsx)("a",{id:"mailpoet_export_button",className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-export",children:v.x.I18n.t("export")})]})}$.propTypes={location:f().object.isRequired};const U=(0,c.withRouter)($),Z=v.x.trackingConfig.emailTrackingEnabled,V=[{name:"email",label:v.x.I18n.t("subscriber"),sortable:!0},{name:"status",label:v.x.I18n.t("status"),sortable:!0},{name:"segments",label:v.x.I18n.t("lists")},{name:"statistics",label:v.x.I18n.t("statisticsColumn"),display:Z},{name:"created_at",label:v.x.I18n.t("subscribedOn"),sortable:!0}],W={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneSubscriberTrashed"):v.x.I18n.t("multipleSubscribersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneSubscriberDeleted"):v.x.I18n.t("multipleSubscribersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneSubscriberRestored"):v.x.I18n.t("multipleSubscribersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onNoItemsFound:e=>"bounced"===e&&!window.mailpoet_premium_active&&!window.mailpoet_mss_active&&(0,j.jsxs)("div",{children:[(0,j.jsx)("p",{children:v.x.I18n.t("bouncedSubscribersHelp")}),(0,j.jsx)("p",{children:(0,j.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",className:"button-primary",children:v.x.I18n.t("bouncedSubscribersPremiumButtonText")})})]})},Y=(e,t,n,r)=>(0,j.jsxs)(b.u,{title:r,onRequestClose:t,isDismissible:!0,children:[(0,j.jsx)(I,{field:n}),(0,j.jsx)("span",{className:"mailpoet-gap-half"}),(0,j.jsx)(g.Button,{onClick:e,dimension:"small",variant:"secondary",children:v.x.I18n.t("apply")})]}),B=[{name:"moveToList",label:v.x.I18n.t("moveToList"),onSelect:function(e,t){return Y(e,t,{id:"move_to_segment",name:"move_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},v.x.I18n.t("moveToList"))},getData:function(){return{segment_id:Number(m()("#move_to_segment").val())}},onSuccess:function(e){v.x.Notice.success(v.x.I18n.t("multipleSubscribersMovedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"addToList",label:v.x.I18n.t("addToList"),onSelect:function(e,t){return Y(e,t,{id:"add_to_segment",name:"add_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},v.x.I18n.t("addToList"))},getData:function(){return{segment_id:Number(m()("#add_to_segment").val())}},onSuccess:function(e){v.x.Notice.success(v.x.I18n.t("multipleSubscribersAddedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromList",label:v.x.I18n.t("removeFromList"),onSelect:function(e,t){return Y(e,t,{id:"remove_from_segment",name:"remove_from_segment",endpoint:"segments",filter:function(e){return!("default"!==e.type)}},v.x.I18n.t("removeFromList"))},getData:function(){return{segment_id:Number(m()("#remove_from_segment").val())}},onSuccess:function(e){v.x.Notice.success(v.x.I18n.t("multipleSubscribersRemovedFromList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromAllLists",label:v.x.I18n.t("removeFromAllLists"),onSuccess:function(e){v.x.Notice.success(v.x.I18n.t("multipleSubscribersRemovedFromAllLists").replace("%1$d",Number(e.meta.count).toLocaleString()))}},{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:W.onTrash},{name:"unsubscribe",label:v.x.I18n.t("unsubscribe"),onSelect:(e,t,n)=>{const r="all"!==n.selection?n.selected_ids.length:n.count;return(0,j.jsxs)(b.u,{title:v.x.I18n.t("unsubscribe"),onRequestClose:t,isDismissible:!0,children:[(0,j.jsx)("p",{children:v.x.I18n.t("unsubscribeConfirm").replace("%s",r.toLocaleString())}),(0,j.jsx)("span",{className:"mailpoet-gap-half"}),(0,j.jsx)(g.Button,{onClick:e,dimension:"small",variant:"secondary",automationId:"bulk-unsubscribe-confirm",children:v.x.I18n.t("apply")})]})}}],H=[{name:"statistics",label:v.x.I18n.t("statsListingActionTitle"),link:function(e,t){return(0,j.jsx)(l.rU,{to:{pathname:`/stats/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}},children:v.x.I18n.t("statsListingActionTitle")})}},{name:"edit",label:v.x.I18n.t("edit"),link:function(e,t){return(0,j.jsx)(l.rU,{to:{pathname:`/edit/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}},children:v.x.I18n.t("edit")})}},{name:"sendConfirmationEmail",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("resendConfirmationEmail"),display:function(e){return"unconfirmed"===e.status&&e.count_confirmations<window.mailpoet_max_confirmation_emails},onClick:function(e){return v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"subscribers",action:"sendConfirmationEmail",data:{id:e.id}}).done((()=>v.x.Notice.success(v.x.I18n.t("oneConfirmationEmailSent")))).fail((e=>v.x.Notice.showApiErrorNotice(e)))}},{name:"trash",className:"mailpoet-hide-on-mobile"}],z=e=>0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user);function K(e){let{match:t}=e;const n=(0,c.useLocation)();return(0,j.jsxs)("div",{children:[(0,j.jsx)(U,{}),(0,j.jsx)(P,{subscribersInPlan:v.x.subscribersCount,subscribersInPlanLimit:v.x.subscribersLimit}),(0,j.jsx)(k,{}),(0,j.jsx)(E,{}),(0,j.jsx)(N,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,j.jsx)(R,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,j.jsx)(x.N,{limit:window.mailpoet_listing_per_page,location:n,params:t.params,endpoint:"subscribers",onRenderItem:(e,t)=>{const r=u()("manage-column","column-primary","has-row-actions","column-username");let a="";switch(e.status){case"subscribed":a=v.x.I18n.t("subscribed");break;case"unconfirmed":a=v.x.I18n.t("unconfirmed");break;case"unsubscribed":a=v.x.I18n.t("unsubscribed");break;case"inactive":a=v.x.I18n.t("inactive");break;case"bounced":a=v.x.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,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:r,children:[(0,j.jsx)(l.rU,{className:"mailpoet-listing-title",to:{pathname:`/edit/${e.id}`,state:{backUrl:null==n?void 0:n.pathname}},children:e.email}),(0,j.jsxs)("div",{className:"mailpoet-listing-subtitle",children:[e.first_name," ",e.last_name]}),t]}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("status"),children:a}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("lists"),children:(0,j.jsx)(g.Tags,{segments:s,dimension:"large"})}),!0===Z?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("statisticsColumn"),children:(0,j.jsx)("div",{className:"mailpoet-listing-stats",children:(0,j.jsx)("a",{href:`#/stats/${e.id}`,children:(0,j.jsx)(L,{id:e.id,engagementScore:e.engagement_score})},`stats-link-${e.id}`)})}):null,(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("subscribedOn"),children:[v.x.Date.short(e.created_at),(0,j.jsx)("br",{}),v.x.Date.time(e.created_at)]})]})},columns:V,bulk_actions:B,item_actions:H,messages:W,sort_by:"created_at",sort_order:"desc",isItemDeletable:z})]})}K.propTypes={match:f().shape({params:f().object}).isRequired};var G=n(30381),Q=n.n(G),X=n(86529),J=n(17123),ee=n.n(J),te=n(60017);class ne extends w.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,j.jsx)(te.I,{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})}}ne.propTypes={onValueChange:f().func,field:f().shape({name:f().string.isRequired,defaultValue:f().string,id:f().string,className:f().string,size:f().oneOfType([f().string,f().number]),disabled:f().func,placeholder:f().string,validation:f().shape({"data-parsley-required":f().bool,"data-parsley-required-message":f().string,"data-parsley-type":f().string,"data-parsley-errors-container":f().string,maxLength:f().number}),customLabel:f().string,tooltip:f().string}).isRequired,item:f().object.isRequired},ne.defaultProps={onValueChange:function(){}};var re=n(97972);function ae(e){return(0,j.jsx)(re.g,{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})}ae.propTypes={item:f().object.isRequired,field:f().shape({name:f().string,placeholder:f().string,defaultValue:f().string,validation:f().shape({"data-parsley-required":f().bool,"data-parsley-required-message":f().string,"data-parsley-type":f().string,"data-parsley-errors-container":f().string,maxLength:f().number}),className:f().string,customLabel:f().string,tooltip:f().string}).isRequired,onValueChange:f().func.isRequired};var se=n(2141);class ie extends w.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,j.jsx)("option",{value:"",children:this.props.field.placeholder})),void 0!==this.props.field.filter&&(t=this.props.field.filter),_.ZP.isFunction(this.props.field.sortBy)&&(r=this.props.field.sortBy),e=r?_.ZP.map(_.ZP.sortBy(_.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,j.jsx)("option",{value:e,children:this.props.field.values[e]},`option-${e}`)));return(0,j.jsxs)(se.P,{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]})}}ie.propTypes={onValueChange:f().func,field:f().shape({name:f().string.isRequired,values:f().objectOf(f().string),placeholder:f().string,filter:f().func,sortBy:f().func,validation:f().shape({"data-parsley-required":f().bool,"data-parsley-required-message":f().string,"data-parsley-type":f().string,"data-parsley-errors-container":f().string,maxLength:f().number})}).isRequired,item:f().object.isRequired,automationId:f().string},ie.defaultProps={automationId:"",onValueChange:function(){}};var oe=n(84868);class le extends w.Component{constructor(e){super(e),(0,y.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,j.jsx)("p",{children:(0,j.jsx)(oe.Y,{checked:e===t,value:t,onCheck:this.onValueChange,name:this.props.field.name,children:this.props.field.values[t]})},`radio-${t}`)));return(0,j.jsx)("div",{children:t})}}le.propTypes={onValueChange:f().func,field:f().shape({name:f().string.isRequired,values:f().objectOf(f().string)}).isRequired,item:f().object.isRequired},le.defaultProps={onValueChange:function(){}};var ce=n(16277);class de extends w.Component{constructor(e){super(e),(0,y.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,j.jsx)("p",{children:(0,j.jsx)(ce.X,{value:"1",checked:e,name:this.props.field.name,onCheck:this.onValueChange,children:this.props.field.values[t]})},`checkbox-${t}`)));return(0,j.jsx)("div",{children:t})}}function ue(e){const t=[];void 0!==e.placeholder&&t.push((0,j.jsx)("option",{value:"",children:e.placeholder},0));const n=Q()().year();for(let e=n;e>=n-100;e-=1)t.push((0,j.jsx)("option",{value:e,children:e},e));return(0,j.jsx)(g.Select,{isMinWidth:!0,name:`${e.name}[year]`,value:e.year,onChange:e.onValueChange,children:t})}function pe(e){const t=[];void 0!==e.placeholder&&t.push((0,j.jsx)("option",{value:"",children:e.placeholder},0));for(let n=1;n<=12;n+=1)t.push((0,j.jsx)("option",{value:n,children:e.monthNames[n-1]},n));return(0,j.jsx)(g.Select,{isMinWidth:!0,name:`${e.name}[month]`,value:e.month,onChange:e.onValueChange,children:t})}function me(e){const t=[];void 0!==e.placeholder&&t.push((0,j.jsx)("option",{value:"",children:e.placeholder},0));for(let e=1;e<=31;e+=1)t.push((0,j.jsx)("option",{value:e,children:e},e));return(0,j.jsx)(g.Select,{isMinWidth:!0,name:`${e.name}[day]`,value:e.day,onChange:e.onValueChange,children:t})}de.propTypes={onValueChange:f().func.isRequired,field:f().shape({name:f().string.isRequired,values:f().objectOf(f().string)}).isRequired,item:f().object.isRequired},ue.propTypes={name:f().string.isRequired,placeholder:f().string.isRequired,onValueChange:f().func.isRequired,year:f().oneOfType([f().string,f().number]).isRequired},pe.propTypes={name:f().string.isRequired,placeholder:f().string.isRequired,onValueChange:f().func.isRequired,month:f().oneOfType([f().string,f().number]).isRequired,monthNames:f().arrayOf(f().string).isRequired},me.propTypes={name:f().string.isRequired,placeholder:f().string.isRequired,onValueChange:f().func.isRequired,day:f().oneOfType([f().string,f().number]).isRequired};class he extends w.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=Q()(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,j.jsx)(ue,{onValueChange:this.onValueChange,name:this.props.field.name,year:this.state.year,placeholder:this.props.field.year_placeholder},"year");case"MM":return(0,j.jsx)(pe,{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,j.jsx)(me,{onValueChange:this.onValueChange,name:this.props.field.name,day:this.state.day,placeholder:this.props.field.day_placeholder},"day");default:return(0,j.jsx)("div",{children:"Invalid date type"})}}));return(0,j.jsx)("div",{children:n})}}he.propTypes={item:f().object.isRequired,field:f().shape({name:f().string,day_placeholder:f().string,month_placeholder:f().string,year_placeholder:f().string,params:f().object}).isRequired,onValueChange:f().func.isRequired};var fe=n(22529);class ge extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"renderField",(e=>{let t,n=!1;e.field.description&&(n=(0,j.jsx)("p",{className:"description",children:e.field.description}));let r=e.field;switch(void 0!==e.field.field&&(r=m().merge(r,e.field.field)),r.type){case"text":t=(0,j.jsx)(ne,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"textarea":t=(0,j.jsx)(ae,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"select":t=(0,j.jsx)(ie,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"radio":t=(0,j.jsx)(le,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"checkbox":t=(0,j.jsx)(de,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"selection":t=(0,j.jsx)(I,{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,j.jsx)(he,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"reactComponent":t=(0,j.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,j.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,j.jsx)(fe.X,{level:4,children:(0,j.jsx)("label",{htmlFor:`field_${this.props.field.name}`,children:this.props.field.label})}));let n=!1;return this.props.field.tip&&(n=(0,j.jsx)("p",{className:"mailpoet-form-description",children:this.props.field.tip})),(0,j.jsxs)("div",{className:`mailpoet-form-field-${this.props.field.name} form-field-row-${this.props.field.name}`,children:[t,n,e]})}}ge.propTypes={onValueChange:f().func,field:f().shape({name:f().string.isRequired,values:f().objectOf(f().string),tip:f().oneOfType([f().array,f().string]),label:f().string,fields:f().arrayOf(f().object),description:f().string}).isRequired,item:f().object.isRequired},ge.defaultProps={onValueChange:function(){}};class xe extends w.Component{constructor(e){super(e),(0,y.Z)(this,"getValues",(()=>this.props.item||this.state.item)),(0,y.Z)(this,"getErrors",(()=>this.props.errors||this.state.errors)),(0,y.Z)(this,"loadItem",(e=>{this.setState({loading:!0}),this.props.endpoint&&v.x.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,y.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&&v.x.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,y.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,w.createRef)(),this.state={loading:!1,errors:[],item:{}}}componentDidMount(){void 0!==this.props.params.id?this.loadItem(this.props.params.id):ee()((()=>{this.setState({item:m()(".mailpoet_form").mailpoetSerializeObject()})}))}componentDidUpdate(e){void 0===this.props.params.id&&e.location.pathname!==this.props.location.pathname&&(ee()((()=>{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,j.jsx)("div",{className:"mailpoet_notice notice inline error is-dismissible",children:(0,j.jsx)("p",{children:e.message})},`error-${e.message}`))));const t=u()("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,j.jsx)(ge,{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,j.jsx)(g.Button,{type:"submit",isDisabled:this.state.loading,children:v.x.I18n.t("save")}),(0,j.jsxs)("div",{children:[(0,j.jsx)("div",{className:"mailpoet-form-content-around",children:n}),(0,j.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,j.jsxs)("div",{className:"mailpoet-form-grid",children:[a,(0,j.jsx)("div",{className:"mailpoet-form-actions",children:s})]})]}),(0,j.jsx)("div",{className:"mailpoet-form-content-around",children:r})]})}}xe.propTypes={params:f().shape({id:f().string}),location:f().shape({pathname:f().string}),item:f().object,errors:f().arrayOf(f().object),endpoint:f().string,fields:f().arrayOf(f().object),messages:f().shape({onUpdate:f().func,onCreate:f().func}),loading:f().bool,children:f().array,id:f().string,automationId:f().string,beforeFormContent:f().func,afterFormContent:f().func,onItemLoad:f().func,isValid:f().func,onChange:f().func,onSubmit:f().func,onSuccess:f().func,history:f().shape({push:f().func.isRequired}).isRequired},xe.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};const ve=(0,c.withRouter)(xe);var be=n(71014);const ye=[{name:"email",label:v.x.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:v.x.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:v.x.I18n.t("lastname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"status",label:v.x.I18n.t("status"),type:"select",automationId:"subscriber-status",values:{subscribed:v.x.I18n.t("subscribed"),unconfirmed:v.x.I18n.t("unconfirmed"),unsubscribed:v.x.I18n.t("unsubscribed"),inactive:v.x.I18n.t("inactive"),bounced:v.x.I18n.t("bounced")}},{name:"segments",label:v.x.I18n.t("lists"),type:"selection",placeholder:v.x.I18n.t("selectList"),tip:v.x.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=v.x.Date.format(t.updated_at);n+=" (%1$s)".replace("%1$s",v.x.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=v.x.I18n.t("year"),t.month_placeholder=v.x.I18n.t("month"),t.day_placeholder=v.x.I18n.t("day");break;case"select":t.placeholder="-";break;default:t.placeholder=""}ye.push(t)}));const we={onUpdate:function(){v.x.Notice.success(v.x.I18n.t("subscriberUpdated"))},onCreate:function(){v.x.Notice.success(v.x.I18n.t("subscriberAdded")),v.x.trackEvent("Subscribers > Add new")}};function _e(e){if(Number(e.wp_user_id)>0)return(0,j.jsx)("p",{className:"description",children:C()(v.x.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,((t,n)=>(0,j.jsx)("a",{href:`user-edit.php?user_id=${e.wp_user_id}`,children:t},n)))})}function je(e){var t;return(0,j.jsxs)(j.Fragment,{children:[null==e||null===(t=e.unsubscribes)||void 0===t?void 0:t.map((e=>{const t=Q()(e.createdAt.date).format("dddd MMMM Do YYYY [at] h:mm:ss a");let n;return n="admin"===e.source?v.x.I18n.t("unsubscribedAdmin").replace("%1$d",t).replace("%2$d",e.meta):"manage"===e.source?v.x.I18n.t("unsubscribedManage").replace("%1$d",t):"newsletter"===e.source?C()(v.x.I18n.t("unsubscribedNewsletter").replace("%1$d",t),/\[link\]/g,((t,n)=>(0,j.jsx)("a",{href:`admin.php?page=mailpoet-newsletter-editor&id=${e.newsletterId}`,children:e.newsletterSubject},n))):v.x.I18n.t("unsubscribedUnknown").replace("%1$d",t),(0,j.jsx)("p",{className:"description",children:n},n)})),(0,j.jsxs)("p",{className:"description",children:[(0,j.jsx)("strong",{children:v.x.I18n.t("tip")})," ",v.x.I18n.t("customFieldsTip")]})]})}function Ie(e){var t;let{match:n}=e;const r=(0,c.useLocation)(),a=(0,c.useHistory)(),s=(null===(t=r.state)||void 0===t?void 0:t.backUrl)||"/";return(0,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(be.B,{}),(0,j.jsxs)(fe.X,{level:1,className:"mailpoet-title",children:[(0,j.jsx)("span",{children:v.x.I18n.t("subscriber")}),(0,j.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:s,children:v.x.I18n.t("backToList")})]}),(0,j.jsx)(k,{}),(0,j.jsx)(ve,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:ye,params:n.params,messages:we,beforeFormContent:_e,afterFormContent:je,onSuccess:()=>a.push(s)})]})}Ie.propTypes={match:f().shape({params:f().shape({id:f().string}).isRequired}).isRequired};var Se=n(5830),Ce=n(71304);function Te(e){var t;let{email:n}=e;const r=(null===(t=(0,c.useLocation)().state)||void 0===t?void 0:t.backUrl)||"/";return(0,j.jsxs)(fe.X,{level:1,className:"mailpoet-title",children:[(0,j.jsx)("span",{children:v.x.I18n.t("statsHeading").replace("%s",n)}),(0,j.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:r,children:v.x.I18n.t("backToList")})]})}var ke=n(57578);function Ne(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,j.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,j.jsx)("div",{className:"mailpoet-listing",children:(0,j.jsx)("table",{className:"mailpoet-listing-table",children:(0,j.jsxs)("tbody",{children:[(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:v.x.I18n.t("statsSentEmail")}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:t.toLocaleString()})}),(0,j.jsx)("td",{})]}),(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:(0,j.jsx)(ke.V,{children:v.x.I18n.t("statsOpened")})}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:n.toLocaleString()})}),(0,j.jsx)("td",{children:u&&(0,j.jsxs)(j.Fragment,{children:[i,"%"]})})]}),(0,j.jsxs)("tr",{children:[(0,j.jsxs)("td",{children:[(0,j.jsx)(ke.V,{children:v.x.I18n.t("statsMachineOpened")}),(0,j.jsx)(A.Tooltip,{tooltip:C()(v.x.I18n.t("statsMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,j.jsx)("span",{style:{pointerEvents:"all"},children:(0,j.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,j.jsx)("td",{children:(0,j.jsx)("b",{children:r.toLocaleString()})}),(0,j.jsx)("td",{children:u&&(0,j.jsxs)(j.Fragment,{children:[o,"%"]})})]}),(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:(0,j.jsx)(ke.V,{isInverted:!0,children:v.x.I18n.t("statsClicked")})}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:a.toLocaleString()})}),(0,j.jsx)("td",{children:u&&(0,j.jsxs)(j.Fragment,{children:[l,"%"]})})]}),(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:v.x.I18n.t("statsNotClicked")}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:d.toLocaleString()})}),(0,j.jsx)("td",{children:u&&(0,j.jsxs)(j.Fragment,{children:[c,"%"]})})]}),(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:v.x.I18n.t("statisticsColumn")}),(0,j.jsx)("td",{children:(0,j.jsx)("div",{className:"mailpoet-listing-stats",children:(0,j.jsx)(L,{id:s.id,engagementScore:s.engagement_score})})}),(0,j.jsx)("td",{})]})]})})})})}function De(e){let{revenueValue:t,count:n,averageRevenueValue:r}=e;return(0,j.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,j.jsx)("div",{className:"mailpoet-listing",children:(0,j.jsx)("table",{className:"mailpoet-listing-table",children:(0,j.jsxs)("tbody",{children:[(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:"Orders created"}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:n.toLocaleString()})})]}),(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:"Total revenue"}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:t})})]}),(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:"Average revenue"}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:r})})]})]})})})})}var Ee=n(11645),Oe=n(58901);function Re(e){let{limitReached:t,limitValue:n,subscribersCountTowardsLimit:r,premiumActive:a,hasValidApiKey:s,hasPremiumSupport:i}=e;return(0,j.jsxs)("table",{className:"mailpoet-listing-table","data-automation-id":"subscriber-stats-no-access",children:[(0,j.jsx)("thead",{children:(0,j.jsxs)("tr",{children:[(0,j.jsx)("th",{children:v.x.I18n.t("email")}),(0,j.jsx)("th",{children:v.x.I18n.t("columnAction")}),(0,j.jsx)("th",{children:v.x.I18n.t("columnCount")}),(0,j.jsx)("th",{children:v.x.I18n.t("columnActionOn")})]})}),(0,j.jsx)("tbody",{children:(0,j.jsx)("tr",{children:(0,j.jsx)("td",{colSpan:4,children:(0,j.jsx)("div",{className:"mailpoet-subscriber-stats-no-access-content",children:(0,j.jsx)(Oe.K,{title:a&&t?v.x.I18n.t("upgradeRequired"):v.x.I18n.t("premiumFeature"),message:(()=>{let e=v.x.I18n.t("premiumRequired");return a?(e=i?v.x.I18n.t("planLimitReached"):v.x.I18n.t("freeLimitReached"),(0,j.jsx)("p",{children:C()(e,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?r:n))})):(0,j.jsx)("p",{children:C()(e,/\[link](.*?)\[\/link]/g,(e=>(0,j.jsx)("a",{href:v.x.premiumLink,children:e},e)))})})(),actionButton:a&&t?(0,j.jsx)(O.z,{href:s?v.x.MailPoetComUrlFactory.getUpgradeUrl():v.x.MailPoetComUrlFactory.getPurchasePlanUrl(r+1),children:v.x.I18n.t("premiumBannerCtaUpgrade")}):(0,j.jsx)(O.z,{href:v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount,v.x.currentWpUserEmail,null,{utm_medium:"stats",utm_campaign:"signup"}),children:v.x.I18n.t("premiumBannerCtaFree")})})})})})})]})}function Ae(e){let{params:t,location:n}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:4,children:v.x.I18n.t("openedEmailsHeading")}),!v.x.premiumActive||v.x.subscribersLimitReached?(0,j.jsx)(Re,{limitReached:v.x.subscribersLimitReached,limitValue:v.x.subscribersLimit,subscribersCountTowardsLimit:v.x.subscribersCount,premiumActive:v.x.premiumActive,hasValidApiKey:v.x.hasValidApiKey,hasPremiumSupport:v.x.hasPremiumSupport}):Ee.Hooks.applyFilters("mailpoet_subscribers_opened_emails_stats",t,n)]})}function Pe(){const e=(0,c.useRouteMatch)(),t=(0,c.useLocation)(),[n,r]=(0,w.useState)(null),[a,s]=(0,w.useState)(!0),i=(0,Ce.S)(window).notices.error;return(0,w.useEffect)((()=>{v.x.Ajax.post({api_version:v.x.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,j.jsx)(j.Fragment,{children:e.errors.map((e=>(0,j.jsx)("p",{children:e.message},e.message)))}),{scroll:!0})}))}),[e.params.id,i]),a?(0,j.jsx)(Se.g,{}):(0,j.jsxs)("div",{className:"mailpoet-subscriber-stats",children:[(0,j.jsx)(Te,{email:n.email}),(0,j.jsxs)("p",{children:[v.x.I18n.t("lastEngagement"),": ",n.last_engagement?v.x.Date.format(n.last_engagement):v.x.I18n.t("never")]}),(0,j.jsxs)("div",{className:"mailpoet-subscriber-stats-summary-grid",children:[(0,j.jsx)(Ne,{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,j.jsx)(De,{averageRevenueValue:n.woocommerce.formatted_average,count:n.woocommerce.count,revenueValue:n.woocommerce.formatted})]}),(0,j.jsx)(Ae,{params:e.params,location:t})]})}var Me=n(93726);function Le(){return(0,j.jsx)(Ce.k.Provider,{value:(0,Ce.S)(window),children:(0,j.jsxs)(l.UT,{children:[(0,j.jsx)(Me.w,{}),(0,j.jsxs)(c.Switch,{children:[(0,j.jsx)(c.Route,{path:"/new",component:Ie}),(0,j.jsx)(c.Route,{path:"/edit/:id",component:Ie}),(0,j.jsx)(c.Route,{path:"/stats/:id/(.*)?",component:Pe}),(0,j.jsx)(c.Route,{path:"*",component:K})]})]})})}const Fe=document.getElementById("subscribers_container");Fe&&o().render((0,j.jsx)(Le,{}),Fe);var qe=n(93723),$e=n(68345);class Ue extends w.PureComponent{render(){const e=this.props.event,t=e.soon;let n;if(this.props.premium)n=(0,j.jsx)("a",{href:"?page=mailpoet-premium",target:"_blank",children:v.x.I18n.t("premiumFeatureLink")});else if(e.actionButtonLink&&e.actionButtonTitle)n=(0,j.jsx)("a",{href:e.actionButtonLink,target:"_blank",rel:"noopener noreferrer",children:e.actionButtonTitle});else{const r=t?null:_.ZP.partial(this.props.eventsConfigurator,e.slug);n=(0,j.jsx)(O.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||v.x.I18n.t("setUp")})}return(0,j.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,j.jsx)("div",{className:"mailpoet-newsletter-type-image",children:e.badge&&(0,j.jsx)($e.C,{title:e.badge.text})}),(0,j.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,j.jsxs)(fe.X,{level:4,children:[e.title," ",e.soon&&`(${v.x.I18n.t("soon")})`]}),(0,j.jsx)("p",{children:e.description}),(0,j.jsx)("div",{className:"mailpoet-flex-grow"}),(0,j.jsx)("div",{className:"mailpoet-newsletter-type-action",children:n})]})]})}}Ue.defaultProps={premium:!1},Ue.propTypes={premium:f().bool,eventsConfigurator:f().func.isRequired,event:f().shape({slug:f().string.isRequired,actionButtonLink:f().string,title:f().string.isRequired,soon:f().bool,badge:f().shape({style:f().string,text:f().string}),description:f().string.isRequired,actionButtonTitle:f().string}).isRequired};class Ze extends w.Component{constructor(e){super(e),this.email=this.props.email,this.emailEvents=this.email.events,this.eventsConfigurator=this.eventsConfigurator.bind(this)}eventsConfigurator(e){v.x.trackEvent("Emails > Automatic Type selected",{"Email type":e}),this.props.history.push(`/new/${this.email.slug}/${e}/conditions`)}render(){return _.ZP.map(this.emailEvents,((e,t)=>(0,j.jsx)(Ue,{premium:this.email.premium,event:e,eventsConfigurator:this.eventsConfigurator},t)))}}Ze.propTypes={email:f().shape({title:f().string.isRequired,slug:f().string.isRequired,premium:f().bool}).isRequired,history:f().shape({push:f().func.isRequired}).isRequired};const Ve=(0,c.withRouter)(Ze),We={woocommerce:(0,j.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,j.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,j.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"})]})};var Ye=n(33687);function Be(e){let{errors:t}=e;return t.length<1?null:(0,j.jsx)(T.q,{type:"error",closable:!1,children:t.map((e=>(0,j.jsx)("p",{children:e.message},e.message)))})}var He=n(62210);function ze(e){let{filter:t,history:n,hideClosingButton:r=!1,hideScreenOptions:a=!0}=e;const[s,i]=(0,w.useState)(!1),o=e=>{void 0!==e&&(n.push(`/new/${e}`),v.x.trackEvent("Emails > Type selected",{"Email type":e}))},l=async()=>{v.x.trackEvent("Emails > Type selected",{"Email type":"wc_transactional"});let e=window.mailpoet_woocommerce_transactional_email_id;if(!e)try{e=(await v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"settings",action:"set",data:{"woocommerce.use_mailpoet_editor":1}})).data.woocommerce.transactional_email_id,v.x.trackEvent("Emails > WooCommerce email customizer enabled")}catch(e){return(0,He.q)(e)&&e.errors.length>0?(0,j.jsx)(Be,{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,j.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,j.jsx)("div",{className:"mailpoet-newsletter-type-image"}),(0,j.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,j.jsxs)(fe.X,{level:4,children:[e.title," ",e.beta?`(${v.x.I18n.t("beta")})`:""]}),(0,j.jsx)("p",{children:e.description}),e.videoGuide&&(0,j.jsxs)("a",{className:t,href:e.videoGuide,"data-beacon-article":e.videoGuideBeacon,target:"_blank",rel:"noopener noreferrer",children:[(0,j.jsx)("span",{className:"dashicons dashicons-format-video"}),v.x.I18n.t("seeVideoGuide")]}),(0,j.jsx)("div",{className:"mailpoet-flex-grow"}),(0,j.jsx)("div",{className:"mailpoet-newsletter-type-action",children:e.action})]})]},e.slug)},d=_.ZP.partial((e=>{i(!0),v.x.trackEvent("Emails > Type selected",{"Email type":e}),v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"newsletters",action:"create",data:{type:e,subject:v.x.I18n.t("draftNewsletterTitle")}}).done((e=>{n.push(`/template/${e.data.id}`)})).fail((e=>(i(!1),e.errors.length>0?(0,j.jsx)(Be,{errors:e.errors}):null)))}),"standard"),u=_.ZP.partial(o,"notification"),p=_.ZP.partial(o,"welcome"),m=_.ZP.partial(o,"re-engagement"),h=[{slug:"standard",title:v.x.I18n.t("regularNewsletterTypeTitle"),description:v.x.I18n.t("regularNewsletterTypeDescription"),action:(0,j.jsx)(O.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:v.x.I18n.t("create")})},{slug:"welcome",title:v.x.I18n.t("welcomeNewsletterTypeTitle"),description:v.x.I18n.t("welcomeNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/254-video-guide-to-welcome-emails",videoGuideBeacon:"5b05ebf20428635ba8b2aa53",action:(0,j.jsx)(O.z,{onClick:p,automationId:"create_welcome",withSpinner:s,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),p())},tabIndex:0,children:v.x.I18n.t("setUp")})},{slug:"notification",title:v.x.I18n.t("postNotificationNewsletterTypeTitle"),description:v.x.I18n.t("postNotificationNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/210-video-guide-to-post-notifications",videoGuideBeacon:"59ba6fb3042863033a1cd5a5",action:(0,j.jsx)(O.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:v.x.I18n.t("setUp")})},{slug:"re_engagement",title:v.x.I18n.t("tabReEngagementTitle"),description:v.x.I18n.t("reEngagementDescription"),action:(0,j.jsx)(O.z,{automationId:"create_notification",onClick:m,withSpinner:s,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),m())},children:v.x.I18n.t("setUp")})}];let f=Ee.Hooks.applyFilters("mailpoet_newsletters_types",[...h],this);t&&(f=f.filter(t));const g=v.x.Ajax.constructGetUrl({api_version:v.x.apiVersion,endpoint:"newsletterTemplates",action:"getAll"});return(0,j.jsxs)(j.Fragment,{children:[a&&(0,j.jsx)(be.B,{}),(0,j.jsx)("link",{rel:"prefetch",href:window.mailpoet_editor_javascript_url,as:"script"}),(0,j.jsxs)("div",{className:"mailpoet-newsletter-types",children:[!r&&(0,j.jsx)("div",{className:"mailpoet-newsletter-types-close",children:(0,j.jsx)("button",{type:"button",onClick:()=>n.push("/"),className:"mailpoet-modal-close",children:Ye.X})}),f.map((e=>c(e)),this),(()=>{if(!window.mailpoet_woocommerce_automatic_emails)return[];let e=window.mailpoet_woocommerce_automatic_emails;return t&&(e=_.ZP.filter(e,t)),_.ZP.map(e,(e=>{const r=e;return(0,j.jsxs)(w.Fragment,{children:[!t&&(0,j.jsxs)("div",{className:"mailpoet-newsletter-types-separator",children:[(0,j.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"}),(0,j.jsx)("div",{className:"mailpoet-newsletter-types-separator-logo",children:We[r.slug]||null}),(0,j.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"})]}),(0,j.jsx)(Ve,{email:r,history:n}),"woocommerce"===r.slug&&(v.x.isWoocommerceActive?[{slug:"wc_transactional",title:v.x.I18n.t("wooCommerceCustomizerTypeTitle"),description:v.x.I18n.t("wooCommerceCustomizerTypeDescription"),action:(0,j.jsx)(O.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:v.x.I18n.t("customize")})}]:[]).map((e=>c(e)),this)]},r.slug)}))})()]}),(0,j.jsx)("link",{rel:"prefetch",href:g,as:"fetch"})]})}ze.defaultProps={filter:null,hideScreenOptions:!0,hideClosingButton:!1};const Ke=(0,c.withRouter)(ze);var Ge=n(9358);function Qe(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:Ee.Hooks.applyFilters("mailpoet_newsletters_listing_stats_tracking",qe.gP)},i=Number(t.total_sent||t.queue.count_processed);let o,c,d,u,p,m=0,h=0,f=null;i>0&&(m=100*t.statistics.clicked/i,h=100*t.statistics.opened/i,f=t.statistics.revenue),void 0!==r?(o=6,c=t.queue.scheduled_at||t.queue.created_at,d=Q()(r).diff(Q()(c),"hours"),u=d<o,p=!0):(u=!1,p=!1);const x=i>=20&&t.statistics.opened>=5&&!u,b=(e,n)=>((e,t,n,r)=>r<=0||!t.link?e:t.externalLink?(0,j.jsx)("a",{href:t.link,onClick:t.onClick||null,children:e},`stats-${n}`):(0,j.jsx)(l.rU,{to:t.link,onClick:t.onClick||null,children:e},`stats-${n}`))(e,s,`${n}-${t.id}`,i),y=(0,j.jsx)(Ge.M,{opened:h,clicked:m,revenues:f&&f.value>0?f.formatted:null,hideBadges:!x,newsletterId:t.id,wrapContentInLink:b}),w=(0,j.jsxs)(j.Fragment,{children:[y,u&&b((0,j.jsx)(g.Tag,{className:"mailpoet-listing-stats-too-early",dimension:"large",variant:"excellent",isInverted:!0,children:v.x.I18n.t("checkBackInHours").replace("%1$d",o-d)}),"check-back")]});let _;return p&&h<5&&d>=24&&i>=10&&(_=(0,j.jsx)("div",{children:(0,j.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:v.x.I18n.t("improveThisLinkText")})})),(0,j.jsxs)(j.Fragment,{children:[w,_]})}const Xe=f().shape({clicked:f().number,opened:f().number,unsubscribed:f().number,revenue:f().shape({count:f().number,currency:f().string,formatted:f().string,value:f().number})}),Je=f().shape({status:f().string,count_processed:f().string.isRequired,count_total:f().string.isRequired,created_at:f().string,scheduled_at:f().string});Qe.propTypes={newsletter:f().shape({id:f().number.isRequired,queue:f().oneOfType([Je,f().bool]),total_sent:f().number,statistics:f().oneOfType([Xe,f().bool])}).isRequired,isSent:f().bool,currentTime:f().string},Qe.defaultProps={isSent:void 0,currentTime:void 0};const et=v.x.trackingConfig.emailTrackingEnabled,tt=window.mailpoet_woocommerce_automatic_emails||{},nt={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterTrashed"):v.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterDeleted"):v.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterRestored"):v.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},rt=[{name:"subject",label:v.x.I18n.t("subject"),sortable:!0},{name:"settings",label:v.x.I18n.t("settings")},{name:"statistics",label:v.x.I18n.t("statistics"),display:et},{name:"status",label:v.x.I18n.t("status"),width:145},{name:"updated_at",label:v.x.I18n.t("lastModifiedOn"),sortable:!0}],at=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:nt.onTrash}];let st=[{name:"view",link:function(e){return(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("edit"),onClick:qe.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:(e,t)=>v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{v.x.Notice.success(v.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"trash",className:"mailpoet-hide-on-mobile"}];st=(0,qe.y8)(st);class it extends w.Component{constructor(e){super(e),(0,y.Z)(this,"updateStatus",((e,t)=>{t.persist(),v.x.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=tt[e];v.x.Notice.success(v.x.I18n.t("automaticEmailActivated").replace("%1s",n.title))}this.forceUpdate()})).fail((n=>{v.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,y.Z)(this,"renderStatus",(e=>{const t=parseInt(e.total_sent,10)>-1?v.x.I18n.t("sentToXCustomers").replace("%1$d",e.total_sent.toLocaleString()):null;return(0,j.jsxs)("div",{children:[(0,j.jsx)(g.Toggle,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,"data-group":e.options.group,dimension:"small",defaultChecked:"active"===e.status}),(0,j.jsxs)("p",{className:"mailpoet-listing-notification-status",children:[t&&(0,j.jsx)(l.rU,{to:`/sending-status/${e.id}`,children:t}),!t&&(0,j.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small",children:v.x.I18n.t("notSentYet")})]})]})})),(0,y.Z)(this,"renderSettings",(e=>{const t=tt[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?_.ZP.pluck(n.option,"name"):[];if(n&&_.ZP.isEmpty(r))return(0,j.jsx)("span",{className:"mailpoet-listing-error",children:v.x.I18n.t("automaticEmailEventOptionsNotConfigured")});let a,s;if(a=r.length>1&&"listingScheduleDisplayTextPlural"in t?C()(t.listingScheduleDisplayTextPlural,"%s",((e,t)=>(0,j.jsx)(g.Tags,{strings:r},t))):C()(t.listingScheduleDisplayText,"%s",((e,t)=>(0,j.jsx)(g.Tags,{strings:r},t))),a&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":s=v.x.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":s=v.x.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":s=v.x.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":s=v.x.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:s=v.x.I18n.t("sendingDelayInvalid")}return(0,j.jsxs)("span",{children:[a,s&&(0,j.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,j.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,j.jsx)(g.ScheduledIcon,{})}),s]})]})})),(0,y.Z)(this,"renderItem",((e,t)=>{const n=u()("manage-column","column-primary","has-row-actions");return(0,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:n,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("settings"),children:this.renderSettings(e)}),!0===et?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("statistics"),children:(0,j.jsx)(Qe,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("status"),children:this.renderStatus(e)}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("lastModifiedOn"),children:[v.x.Date.short(e.updated_at),(0,j.jsx)("br",{}),v.x.Date.time(e.updated_at)]})]})})),(0,y.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={eventCounts:{},newslettersCount:void 0},this.afterGetItems=this.afterGetItems.bind(this)}afterGetItems(e){(0,qe._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,j.jsxs)("div",{className:"notice error",children:[(0,j.jsx)("p",{children:v.x.I18n.t("wooCommerceEmailsWarning")}),(0,j.jsx)("p",{children:(0,j.jsx)("a",{href:"?page=mailpoet-settings#woocommerce",children:v.x.I18n.t("wooCommerceEmailsWarningLink")})})]}):null}render(){const{match:e,location:t}=this.props;return(0,j.jsxs)(j.Fragment,{children:[this.renderWarning(),0===this.state.newslettersCount&&(0,j.jsx)(Ke,{filter:e=>"woocommerce"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,j.jsx)(x.N,{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:rt,bulk_actions:at,item_actions:st,messages:nt,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)}})]})}}it.propTypes={match:f().shape({params:f().shape({tab:f().string}).isRequired}).isRequired,location:f().object.isRequired};const ot=(0,c.withRouter)(it);var lt=n(80416),ct=n(21526);const dt=(0,c.withRouter)((e=>(0,j.jsx)(ct.b,{...e})));var ut=n(12912),pt=n(9185);class mt extends w.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,pt._)({message:v.x.I18n.t("confirmTemplateDeletion").replace("%1$s",t),onConfirm:()=>{n(),v.x.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,j.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}})}onPreview(){v.x.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(),v.x.trackEvent("Emails > Template selected",{"Email name":t}),v.x.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,j.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,j.jsxs)("a",{className:"mailpoet-template-preview",href:"#",onClick:e=>{e.preventDefault(),this.onPreview(e)},children:[(0,j.jsx)("div",{className:"mailpoet-template-thumbnail",children:n?(0,j.jsx)("img",{src:n,alt:v.x.I18n.t("templatePreview"),loading:"lazy"}):""}),(0,j.jsx)("div",{className:"mailpoet-template-preview-overlay",children:(0,j.jsx)(O.z,{children:v.x.I18n.t("zoom")})})]})),(0,j.jsx)(ut.G,{label:t,onSelect:this.onSelect,onDelete:!1===r?this.onDelete:void 0,automationId:`select_template_${e}`,className:"mailpoet-template-two-lines",children:a})}}mt.contextType=Ce.k,mt.propTypes={index:f().number.isRequired,id:f().number.isRequired,newsletterId:f().string.isRequired,name:f().string.isRequired,thumbnail:f().string,readonly:f().bool.isRequired,beforeDelete:f().func.isRequired,afterDelete:f().func.isRequired,beforeSelect:f().func.isRequired,afterSelect:f().func.isRequired},mt.defaultProps={thumbnail:null};class ht extends w.Component{constructor(e){super(e),this.fileRef=(0,w.createRef)(),this.handleSubmit=this.handleSubmit.bind(this)}handleSubmit(e){if(e.preventDefault(),_.ZP.size(this.fileRef.current.files)<=0)return!1;const t=_.ZP.first(this.fileRef.current.files),n=new FileReader;return n.onload=e=>{try{this.saveTemplate(JSON.parse(e.target.result)),v.x.trackEvent("Emails > Template imported")}catch(e){this.context.notices.error((0,j.jsx)("p",{children:v.x.I18n.t("templateFileMalformedError")}))}},n.readAsText(t),!0}saveTemplate(e){const t=e,{beforeImport:n,afterImport:r}=this.props;_.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(),v.x.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,j.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}render(){return(0,j.jsxs)("div",{className:"mailpoet-template-import",children:[(0,j.jsxs)("h4",{children:[v.x.I18n.t("importTemplateTitle"),(0,j.jsx)(A.Tooltip,{tooltip:v.x.I18n.t("helpTooltipTemplateUpload"),place:"right",className:"tooltip-help-import-template"})]}),(0,j.jsxs)("form",{onSubmit:this.handleSubmit,children:[(0,j.jsx)("input",{type:"file",placeholder:v.x.I18n.t("selectJsonFileToUpload"),ref:this.fileRef}),(0,j.jsx)("p",{className:"submit",children:(0,j.jsx)("input",{className:"button button-primary",type:"submit",value:v.x.I18n.t("upload")})})]})]})}}ht.contextType=Ce.k,ht.propTypes={beforeImport:f().func.isRequired,afterImport:f().func.isRequired};const ft=[];window.mailpoet_newsletters_templates_recently_sent_count&&ft.push({name:"recent",label:v.x.I18n.t("recentlySent")}),ft.push({name:"standard",label:v.x.I18n.t("tabStandardTitle")},{name:"welcome",label:v.x.I18n.t("tabWelcomeTitle")},{name:"notification",label:v.x.I18n.t("tabNotificationTitle")},{name:"re_engagement",label:v.x.I18n.t("tabReEngagementTitle")},{name:"blank",label:v.x.I18n.t("tabBlankTitle")}),window.mailpoet_woocommerce_active&&ft.push({name:"woocommerce",label:v.x.I18n.t("tabWoocommerceTitle")}),ft.push({name:"saved",label:v.x.I18n.t("savedTemplates")});class gt extends w.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(){v.x.Ajax.get({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"getAll"}).done((e=>{0===e.data.length&&(e.data=[{name:v.x.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,j.jsx)("p",{children:e.message},e.message))),{scroll:!0})})).always((()=>{this.selectInitialTab()}))}addTemplate(e){const t=ft.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";v.x.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":_.ZP.findWhere(ft,{name:n.data.type})?t=n.data.type:"automatic"===n.data.type&&_.ZP.findWhere(ft,{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,j.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,j.jsx)(Se.g,{});const e=ft.concat({name:"import",label:v.x.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,j.jsx)(ht,{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,j.jsx)("p",{children:v.x.I18n.t("noTemplates")}):e.map(((e,t)=>(0,j.jsx)(mt,{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,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(dt,{emailType:this.state.emailType,automationId:"email_template_selection_heading"}),(0,j.jsxs)("div",{className:"mailpoet-templates",children:[(0,j.jsx)(lt.R,{categories:e,active:this.state.selectedTab,onSelect:e=>this.setState({selectedTab:e})}),t]})]})}}gt.contextType=Ce.k,gt.propTypes={match:f().shape({params:f().shape({id:f().string}).isRequired}).isRequired};var xt=n(31304),vt=n.n(xt),bt=n(11830),yt=n(9198),wt=n.n(yt),_t=n(4958),jt=n(16245),It=n.n(jt);function St(e){var t;let{dimension:n,isFullWidth:r,iconStart:a,iconEnd:s,...i}=e;return(0,j.jsxs)("div",{className:u()("mailpoet-datepicker mailpoet-form-input",{[`mailpoet-form-input-${n}`]:n,"mailpoet-disabled":i.disabled,"mailpoet-full-width":r}),children:[a,(0,j.jsx)(wt(),{useWeekdaysShort:!0,calendarStartDay:null!==(t=i.calendarStartDay)&&void 0!==t?t:v.x.wpWeekStartsOn,...i}),s]})}const Ct={abbreviated:[v.x.I18n.t("januaryShort"),v.x.I18n.t("februaryShort"),v.x.I18n.t("marchShort"),v.x.I18n.t("aprilShort"),v.x.I18n.t("mayShort"),v.x.I18n.t("juneShort"),v.x.I18n.t("julyShort"),v.x.I18n.t("augustShort"),v.x.I18n.t("septemberShort"),v.x.I18n.t("octoberShort"),v.x.I18n.t("novemberShort"),v.x.I18n.t("decemberShort")],wide:[v.x.I18n.t("january"),v.x.I18n.t("february"),v.x.I18n.t("march"),v.x.I18n.t("april"),v.x.I18n.t("may"),v.x.I18n.t("june"),v.x.I18n.t("july"),v.x.I18n.t("august"),v.x.I18n.t("september"),v.x.I18n.t("october"),v.x.I18n.t("november"),v.x.I18n.t("december")]},Tt={narrow:[v.x.I18n.t("sundayMin"),v.x.I18n.t("mondayMin"),v.x.I18n.t("tuesdayMin"),v.x.I18n.t("wednesdayMin"),v.x.I18n.t("thursdayMin"),v.x.I18n.t("fridayMin"),v.x.I18n.t("saturdayMin")],abbreviated:[v.x.I18n.t("sundayShort"),v.x.I18n.t("mondayShort"),v.x.I18n.t("tuesdayShort"),v.x.I18n.t("wednesdayShort"),v.x.I18n.t("thursdayShort"),v.x.I18n.t("fridayShort"),v.x.I18n.t("saturdayShort")],wide:[v.x.I18n.t("sunday"),v.x.I18n.t("monday"),v.x.I18n.t("tuesday"),v.x.I18n.t("wednesday"),v.x.I18n.t("thursday"),v.x.I18n.t("friday"),v.x.I18n.t("saturday")]};_t.Z.localize.month=It()({values:Ct,defaultWidth:"wide"}),_t.Z.localize.day=It()({values:Tt,defaultWidth:"wide"}),_t.Z.options.weekStartsOn=void 0!==v.x.wpWeekStartsOn?v.x.wpWeekStartsOn:1,(0,yt.registerLocale)("mailpoet",_t.Z);class kt extends w.Component{constructor(){super(...arguments),(0,y.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,y.Z)(this,"getFieldName",(()=>this.props.name||"date")),(0,y.Z)(this,"getDisplayDateFormat",(e=>v.x.Date.convertFormat(e).replace(/D/g,"d").replace(/Y/g,"y").replace(/\[/g,"").replace(/\]/g,""))),(0,y.Z)(this,"getDate",(e=>{const t={parseFormat:this.props.storageFormat};return v.x.Date.toDate(e,t)})),(0,y.Z)(this,"getStorageDate",(e=>{const t={format:this.props.storageFormat};return v.x.Date.format(e,t)}))}render(){return(0,j.jsx)(St,{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})}}kt.propTypes={displayFormat:f().string.isRequired,onChange:f().func.isRequired,name:f().string,storageFormat:f().string.isRequired,value:f().string.isRequired,disabled:f().bool.isRequired,validation:f().shape({"data-parsley-required":f().bool,"data-parsley-required-message":f().string,"data-parsley-type":f().string,"data-parsley-errors-container":f().string,maxLength:f().number}).isRequired,maxDate:f().instanceOf(Date)},kt.defaultProps={name:"date",maxDate:null};class Nt extends w.Component{render(){const e=Object.keys(this.props.timeOfDayItems).map((e=>(0,j.jsx)("option",{value:e,children:this.props.timeOfDayItems[e]},`option-${this.props.timeOfDayItems[e]}`)));return(0,j.jsx)(se.P,{name:this.props.name||"time",value:this.props.value,disabled:this.props.disabled,onChange:this.props.onChange,isMinWidth:!0,...this.props.validation,children:e})}}Nt.propTypes={timeOfDayItems:f().objectOf(f().string).isRequired,name:f().string,value:f().string.isRequired,disabled:f().bool,onChange:f().func.isRequired,validation:f().object},Nt.defaultProps={name:"time",disabled:!1,validation:{}};class Dt extends w.Component{constructor(e){super(e),(0,y.Z)(this,"DATE_TIME_SEPARATOR"," "),(0,y.Z)(this,"getDateTime",(()=>[this.state.date,this.state.time].join(this.DATE_TIME_SEPARATOR))),(0,y.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,y.Z)(this,"handleChange",(e=>{const t={};t[e.target.name]=e.target.value,this.setState(t,this.propagateChange)})),(0,y.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||ee()((()=>{this.setState(this.buildStateFromProps(this.props))}))}render(){return(0,j.jsxs)(bt.r.Column,{className:"mailpoet-datetime-container",children:[(0,j.jsx)(kt,{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,j.jsx)(Nt,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems})]})}}Dt.propTypes={value:f().string,defaultDateTime:f().string.isRequired,dateDisplayFormat:f().string.isRequired,dateStorageFormat:f().string.isRequired,onChange:f().func,name:f().string,disabled:f().bool,dateValidation:f().object.isRequired,timeValidation:f().any,timeOfDayItems:f().objectOf(f().string).isRequired,maxDate:f().instanceOf(Date)},Dt.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0,value:void 0,maxDate:null};var Et=n(43246);class Ot extends w.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,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(ne,{item:{...this.props.item,sender_address:this.state.emailAddress},field:this.props.field,onValueChange:this.onChange}),(0,j.jsx)("div",{className:"regular-text",children:(0,j.jsx)(Et.L,{emailAddress:this.state.emailAddress,mssActive:window.mailpoet_mss_active})})]})}}Ot.propTypes={field:f().object.isRequired,item:f().shape({sender_address:f().string.isRequired}).isRequired,onValueChange:f().func},Ot.defaultProps={onValueChange:function(){}};const Rt=_.ZP.once((()=>v.x.trackEvent("User has typed a GA campaign name"))),At=C()(v.x.I18n.t("gaCampaignTip"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,j.jsxs)("span",{children:[(0,j.jsx)("br",{}),(0,j.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))),Pt={name:"ga_campaign",label:v.x.I18n.t("gaCampaignLine"),tip:At,type:"text",onBeforeChange:Rt};var Mt=n(18568);let Lt,Ft;!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"}(Lt||(Lt={})),function(e){e.Draft="draft",e.Scheduled="scheduled",e.Sending="sending",e.Sent="sent",e.Active="active"}(Ft||(Ft={}));const qt=window.mailpoet_current_time||"00:00",$t=`${window.mailpoet_tomorrow_date} 08:00:00`,Ut=window.mailpoet_schedule_time_of_day,Zt=window.mailpoet_date_display_format,Vt=window.mailpoet_date_storage_format;class Wt extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"getCurrentValue",(()=>{var e,t;return{isScheduled:"0",scheduledAt:$t,...null!==(e=null===(t=this.props.item)||void 0===t?void 0:t[this.props.field.name])&&void 0!==e?e:{}}})),(0,y.Z)(this,"getDateValidation",(()=>({"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("noScheduledDateError"),"data-parsley-errors-container":"#mailpoet_scheduling"}))),(0,y.Z)(this,"isScheduled",(()=>"1"===this.getCurrentValue().isScheduled)),(0,y.Z)(this,"handleCheckboxChange",((e,t)=>{const n={...t};n.target.value=t.target.checked?"1":"0",this.handleValueChange(n)})),(0,y.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,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("span",{className:"mailpoet-form-schedule-time",children:[v.x.I18n.t("websiteTimeIs")," ",qt]}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("div",{id:"mailpoet_scheduling",children:(0,j.jsx)(Dt,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:$t,timeOfDayItems:Ut,dateDisplayFormat:Zt,dateStorageFormat:Vt,maxDate:t})})]})),(0,j.jsxs)("div",{children:[(0,j.jsx)(Mt.Z,{checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onCheck:this.handleCheckboxChange,automationId:"email-schedule-checkbox"}),e]})}}let Yt=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:v.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:v.x.I18n.t("subjectLine"),tooltip:v.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:v.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:v.x.I18n.t("preheaderLine"),tooltip:`${v.x.I18n.t("preheaderLineTip1")} ${v.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"segments",label:v.x.I18n.t("segments"),tip:v.x.I18n.t("segmentsTip"),type:"selection",placeholder:v.x.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":v.x.I18n.t("noSegmentsSelectedError")}},{name:"options",label:v.x.I18n.t("scheduleIt"),type:"reactComponent",component:Wt},{name:"sender",label:v.x.I18n.t("sender"),tip:v.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:v.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ot,placeholder:v.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Pt,{name:"reply-to",label:v.x.I18n.t("replyTo"),tip:v.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:v.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:v.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Yt=Ee.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",Yt);const Bt={getFields:()=>Yt,getSendButtonOptions:function(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=Q()(window.mailpoet_current_date_time),a="object"==typeof n.options&&"1"===(null===(e=n.options)||void 0===e?void 0:e.isScheduled)&&v.x.Date.isInFuture(null===(t=n.options)||void 0===t?void 0:t.scheduledAt,r),s={value:a?v.x.I18n.t("schedule"):v.x.I18n.t("send")};return n.status!==Ft.Sent&&n.status!==Ft.Sending||(s.disabled="disabled"),s}},Ht=window.mailpoet_time_format||"H:i",zt={immediate:v.x.I18n.t("delayImmediately"),hours:v.x.I18n.t("delayHoursAfter"),days:v.x.I18n.t("delayDaysAfter"),weeks:v.x.I18n.t("delayWeeksAfter")},Kt={daily:v.x.I18n.t("daily"),weekly:v.x.I18n.t("weekly"),monthly:v.x.I18n.t("monthly"),nthWeekDay:v.x.I18n.t("monthlyEvery"),immediately:v.x.I18n.t("immediately")},Gt=_.ZP.object(_.ZP.map(_.ZP.times(24,(e=>3600*e)),(e=>{const t=new Date(null);return t.setSeconds(e),[e,v.x.Date.format(t,{format:Ht,offset:0})]}))),Qt={0:v.x.I18n.t("sunday"),1:v.x.I18n.t("monday"),2:v.x.I18n.t("tuesday"),3:v.x.I18n.t("wednesday"),4:v.x.I18n.t("thursday"),5:v.x.I18n.t("friday"),6:v.x.I18n.t("saturday")},Xt=_.ZP.object(_.ZP.map(_.ZP.times(28,(e=>e)),(e=>{const t={0:v.x.I18n.t("first"),1:v.x.I18n.t("second"),2:v.x.I18n.t("third")};let n;return n=void 0!==t[e]?t[e]:v.x.I18n.t("nth").replace("%1$d",e+1),[e+1,n]}))),Jt={1:v.x.I18n.t("first"),2:v.x.I18n.t("second"),3:v.x.I18n.t("third"),L:v.x.I18n.t("last")},en={name:"intervalType",values:Kt},tn={name:"timeOfDay",values:Gt},nn={name:"weekDay",values:Qt},rn={name:"monthDay",values:Xt},an={name:"nthWeekDay",values:Jt};class sn extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,y.Z)(this,"handleValueChanges",(e=>{const t=this.getCurrentValue();return this.props.onValueChange({target:{name:this.props.field.name,value:_.ZP.extend({},t,e)}})})),(0,y.Z)(this,"handleIntervalChange",(e=>{const t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),this.handleValueChanges(n)})),(0,y.Z)(this,"handleTimeOfDayChange",(e=>this.handleValueChanges({timeOfDay:e.target.value}))),(0,y.Z)(this,"handleWeekDayChange",(e=>this.handleValueChanges({weekDay:e.target.value}))),(0,y.Z)(this,"handleMonthDayChange",(e=>this.handleValueChanges({monthDay:e.target.value}))),(0,y.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,j.jsx)(ie,{field:tn,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==e.intervalType&&"nthWeekDay"!==e.intervalType||(n=(0,j.jsx)(ie,{field:nn,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===e.intervalType&&(r=(0,j.jsx)(ie,{field:rn,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===e.intervalType&&(a=(0,j.jsx)(ie,{field:an,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),(0,j.jsxs)("div",{children:[(0,j.jsx)(ie,{field:en,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[a,r,n,t]}),"immediately"!==e.intervalType&&(0,j.jsx)("div",{className:"mailpoet-gap"})]})}}sn.propTypes={item:f().object.isRequired,field:f().shape({name:f().string}).isRequired,onValueChange:f().func.isRequired};let on=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:v.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:v.x.I18n.t("subjectLine"),tooltip:v.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:v.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:v.x.I18n.t("preheaderLine"),tooltip:`${v.x.I18n.t("preheaderLineTip1")} ${v.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:v.x.I18n.t("selectFrequency"),type:"reactComponent",component:sn},{name:"segments",label:v.x.I18n.t("segments"),tip:v.x.I18n.t("segmentsTip"),type:"selection",placeholder:v.x.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 _.ZP.map(e,(e=>_.ZP.find(t,(t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:v.x.I18n.t("sender"),tip:v.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:v.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ot,placeholder:v.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Pt,{name:"reply-to",label:v.x.I18n.t("replyTo"),tip:v.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:v.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:v.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];on=Ee.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",on);const ln={getFields:function(){return on},getSendButtonOptions:function(){return{value:v.x.I18n.t("activate")}}},cn=window.mailpoet_roles||{},dn=_.ZP.filter(window.mailpoet_segments||[],(e=>"default"===e.type)),un={name:"event",values:{segment:v.x.I18n.t("onSubscriptionToList"),user:v.x.I18n.t("onWPUserRegistration")}},pn={name:"segment",placeholder:v.x.I18n.t("selectSegmentPlaceholder"),forceSelect2:!0,values:dn,getCount:e=>parseInt(e.subscribers,10).toLocaleString(),getLabel:e=>e.name,getValue:e=>e.id},mn={name:"role",values:cn},hn={name:"afterTimeNumber",size:3,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":v.x.I18n.t("emailCanBeScheduledUpToFiveYears")}},fn={name:"afterTimeType",values:zt};class gn extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,y.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:_.ZP.extend({},n,r)}})})),(0,y.Z)(this,"handleEventChange",(e=>this.handleValueChange("event",e.target.value))),(0,y.Z)(this,"handleSegmentChange",(e=>this.handleValueChange("segment",e.target.value))),(0,y.Z)(this,"handleRoleChange",(e=>this.handleValueChange("role",e.target.value))),(0,y.Z)(this,"handleAfterTimeNumberChange",(e=>this.handleValueChange("afterTimeNumber",e.target.value))),(0,y.Z)(this,"handleAfterTimeTypeChange",(e=>this.handleValueChange("afterTimeType",e.target.value)))}render(){const e=this.getCurrentValue();let t,n;return t="user"===e.event?(0,j.jsx)(ie,{field:mn,item:this.getCurrentValue(),onValueChange:this.handleRoleChange}):(0,j.jsx)(I,{field:pn,item:this.getCurrentValue(),onValueChange:this.handleSegmentChange}),"immediate"!==e.afterTimeType&&(n=(0,j.jsx)(ne,{field:hn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeNumberChange})),(0,j.jsxs)("div",{children:[(0,j.jsx)(ie,{field:un,item:this.getCurrentValue(),onValueChange:this.handleEventChange}),(0,j.jsx)("div",{className:"mailpoet-gap"}),t,(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[n,(0,j.jsx)(ie,{field:fn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeTypeChange})]}),(0,j.jsx)("div",{className:"mailpoet-form-errors"}),(0,j.jsx)("div",{className:"mailpoet-gap"})]})}}gn.propTypes={history:f().shape({push:f().func.isRequired}).isRequired,item:f().object.isRequired,field:f().shape({name:f().string}).isRequired,onValueChange:f().func.isRequired};const xn=(0,c.withRouter)(gn);let vn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:v.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:v.x.I18n.t("subjectLine"),tooltip:v.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:v.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:v.x.I18n.t("preheaderLine"),tooltip:`${v.x.I18n.t("preheaderLineTip1")} ${v.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:v.x.I18n.t("selectEventToSendWelcomeEmail"),type:"reactComponent",component:xn},Pt,{name:"sender",label:v.x.I18n.t("sender"),tip:v.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:v.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ot,placeholder:v.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:v.x.I18n.t("replyTo"),tip:v.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:v.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:v.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];vn=Ee.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",vn);const bn={getFields:function(){return vn},getSendButtonOptions:function(){return{value:v.x.I18n.t("activate")}}};class yn extends w.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=zt;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:_.ZP.map(t,((e,t)=>({name:e,id:t}))),extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>n},onValueChange:_.ZP.partial(this.handleChange,_.ZP,"afterTimeType")};return(0,j.jsx)(I,{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":v.x.I18n.t("emailCanBeScheduledUpToFiveYears")}},item:{},onValueChange:_.ZP.partial(this.handleChange,_.ZP,"afterTimeNumber")};return(0,j.jsx)(ne,{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,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[this.displayAfterTimeNumberField(),this.displayAfterTimeTypeOptions()]}),(0,j.jsx)("div",{className:"mailpoet-form-errors"}),(0,j.jsx)("div",{className:"mailpoet-gap"}),e.schedulingReadMoreLink&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("a",{href:e.schedulingReadMoreLink.link,target:"_blank",rel:"noopener noreferrer",className:"event-scheduling-read-more-link",children:e.schedulingReadMoreLink.text}),(0,j.jsx)("div",{className:"mailpoet-gap"})]})]})}}function wn(e){const t=e&&e.values?e.values:[];return t?t.map((e=>({id:e.id,name:e.name}))):t}function _n(e){let{eventOptions:t,eventSlug:n,selected:r,onValueChange:a}=e;function s(e){a&&a({eventOptionValue:e.target.value})}return(0,j.jsx)("div",{children:(0,j.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:wn(t),multiple:t.multiple||!1,placeholder:t.placeholder||!1,transformChangedValue:(e,t)=>_.ZP.map(t,(e=>({id:e.id,name:e.text}))),selected:()=>r,getLabel:_.ZP.property("name"),getValue:_.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,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(I,{field:e.field,onValueChange:e.onValueChange,item:e.item}),(0,j.jsx)("div",{className:"mailpoet-gap"})]})}()})})}yn.propTypes={item:f().shape({afterTimeType:f().string.isRequired,afterTimeNumber:f().number}).isRequired,afterTimeNumberSize:f().number,onValueChange:f().func,event:f().shape({defaultAfterTimeType:f().string,timeDelayValues:f().objectOf(f().shape({text:f().string,displayAfterTimeNumberField:f().bool})),schedulingReadMoreLink:f().shape({link:f().string.isRequired,text:f().string.isRequired})}).isRequired},yn.defaultProps={afterTimeNumberSize:3,onValueChange:null};class jn extends w.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=_.ZP.indexBy(this.email.events,"slug"),this.segments=_.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,j.jsx)(yn,{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,j.jsx)("div",{className:"event-segment-selection",children:(0,j.jsx)(I,{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=_.ZP.map(n.option,(e=>e.id))),(0,j.jsx)(_n,{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,j.jsxs)("div",{children:[(0,j.jsx)(fe.X,{level:5,children:this.displayHeader()}),this.displayEventOptions(),this.displaySegments(),this.displayScheduling()]})}}jn.propTypes={field:f().shape({email:f().shape({events:f().object.isRequired}).isRequired,emailOptions:f().object.isRequired}).isRequired,onValueChange:f().func},jn.defaultProps={onValueChange:null};const In=window.mailpoet_woocommerce_automatic_emails||[],Sn={getFields:function(e){return(e=>{const t=In[e.options.group];if(!t)return!1;const n=e.options;return[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:v.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:v.x.I18n.t("subjectLine"),tooltip:v.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:v.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:v.x.I18n.t("preheaderLine"),tooltip:`${v.x.I18n.t("preheaderLineTip1")} ${v.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:v.x.I18n.t("sendAutomaticEmailWhenHeading").replace("%1s",t.title),type:"reactComponent",component:jn,email:t,emailOptions:n},Pt,{name:"sender",label:v.x.I18n.t("sender"),tip:v.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:v.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"text",placeholder:v.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:v.x.I18n.t("replyTo"),tip:v.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:v.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:v.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}]})(e)},getSendButtonOptions:function(){return{value:v.x.I18n.t("activate")}}};var Cn=n(78230),Tn=n(68041);function kn(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,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:4,children:v.x.I18n.t("selectEventToSendReEngagementEmail")}),(0,j.jsxs)(bt.r.CenteredRow,{className:"mailpoet-re-engagement-scheduling",children:[(0,j.jsx)("p",{children:v.x.I18n.t("reEngagementTextPre")}),(0,j.jsx)(te.I,{type:"text",placeholder:v.x.I18n.t("reEngagementAterTimeNumberPlaceholder"),value:t,onChange:(0,Tn.z2)(r)}),(0,j.jsxs)(se.P,{value:n,onChange:(0,Tn.z2)(a),children:[(0,j.jsx)("option",{value:"weeks",children:"weeks"}),(0,j.jsx)("option",{value:"months",children:"months"})]})]}),!!s&&l<=o&&(0,j.jsx)("p",{className:"mailpoet-re-engagement-scheduling-note",children:C()(v.x.I18n.t("reEngagementEmailWarning").replace("{$months}",`${Math.floor(s/30)}`),/\[link\](.*?)\[\/link\]/g,(e=>(0,j.jsx)("a",{href:"https://kb.mailpoet.com/article/264-inactive-subscribers",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"5cbf19622c7d3a026fd3efe1",children:e},"link")))})]})}const Nn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:v.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:v.x.I18n.t("subjectLine"),tooltip:v.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:v.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:v.x.I18n.t("preheaderLine"),tooltip:`${v.x.I18n.t("preheaderLineTip1")} ${v.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",type:"reactComponent",component:function(e){return(0,j.jsx)(kn,{afterTimeNumber:e.item.options.afterTimeNumber.toString(),afterTimeType:e.item.options.afterTimeType,inactiveSubscribersPeriod:Number(v.x.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:t=>{e.onValueChange({target:{name:"options",value:(0,Cn.assoc)("afterTimeNumber",t,e.item.options)}})},updateAfterTimeType:t=>{e.onValueChange({target:{name:"options",value:(0,Cn.assoc)("afterTimeType",t,e.item.options)}})}})}},{name:"segments",label:v.x.I18n.t("segments"),tip:v.x.I18n.t("segmentsTip"),type:"selection",placeholder:v.x.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:v.x.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,Cn.map)((e=>(0,Cn.find)((t=>t.id===e),t)),e)},validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:v.x.I18n.t("sender"),tip:v.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:v.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ot,placeholder:v.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:v.x.I18n.t("replyTo"),tip:v.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:v.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:v.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]},Pt],Dn={getFields:()=>Nn,getSendButtonOptions:()=>({value:v.x.I18n.t("activate")})};var En=n(7358);const On=window.mailpoet_woocommerce_automatic_emails||[],Rn=(e,t)=>`${vt()(t,{lower:!0}).replace(/[^a-z0-9]+/g,"-").replace(/-$/,"")||"newsletter"}_${e}`;function An(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)?v.x.I18n.t("newsletterIsEmpty"):window.mailpoet_mss_active&&t.indexOf("[link:subscription_unsubscribe_url]")<0&&t.indexOf("[link:subscription_unsubscribe]")<0?v.x.I18n.t("unsubscribeLinkMissing"):"re_engagement"===e.type&&t.indexOf("[link:subscription_re_engage_url]")<0?v.x.I18n.t("reEngageLinkMissing"):"notification"===e.type&&t.indexOf('"type":"automatedLatestContent"')<0&&t.indexOf('"type":"automatedLatestContentLayout"')<0?v.x.I18n.t("automatedLatestContentMissing"):"standard"===e.type&&"sent"===e.status?v.x.I18n.t("emailAlreadySent"):"re_engagement"!==e.type||v.x.trackingConfig.emailTrackingEnabled?void 0:(0,j.jsx)("span",{style:{pointerEvents:"all"},children:C()(v.x.I18n.t("reEngagementEmailsDisableIfTrackingIs"),/\[link\](.*?)\[\/link\]/g,(e=>(0,j.jsx)("a",{href:"?page=mailpoet-settings#/advanced",rel:"noopener noreferrer",children:e},"advancedSettingsTabLink")))})}class Pn extends w.Component{constructor(e){super(e),(0,y.Z)(this,"getFieldsByNewsletter",(e=>this.getSubtype(e).getFields(e))),(0,y.Z)(this,"getSendButtonOptions",(()=>this.getSubtype(this.state.item).getSendButtonOptions(this.state.item))),(0,y.Z)(this,"getSubtype",(e=>{switch(e.type){case"notification":return ln;case"welcome":return bn;case"re_engagement":return Dn;case"automatic":if(On[e.options.group])return Sn;default:return Bt}})),(0,y.Z)(this,"getThumbnailPromise",(e=>this.state.thumbnailPromise?this.state.thumbnailPromise:(0,En.W0)(e))),(0,y.Z)(this,"isValid",(()=>m()("#mailpoet_newsletter").parsley().isValid())),(0,y.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,y.Z)(this,"showInvalidFromAddressError",(()=>{const e=this.state.item.sender_address;let t=C()(v.x.I18n.t("newsletterInvalidFromAddress"),"%1$s",(()=>e));t=C()(t,/\[link\](.*?)\[\/link\]/g,(t=>`<a href="https://account.mailpoet.com/authorization?email=${encodeURIComponent(e)}" target="_blank" rel="noopener noreferrer">${t}</a>`)),m()("#field_sender_address").parsley().addError("invalidFromAddress",{message:t.join(""),updateClass:!0}),v.x.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"})})),(0,y.Z)(this,"removeInvalidFromAddressError",(()=>{m()("#field_sender_address").parsley().removeError("invalidFromAddress",{updateClass:!0})})),(0,y.Z)(this,"loadItem",(e=>(this.setState({loading:!0}),v.x.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=Rn(n.id,n.subject)),this.setState({item:e.data,fields:this.getFieldsByNewsletter(e.data),thumbnailPromise:t,validationError:An(e.data)})})).fail((()=>{this.setState({item:{}},(()=>{this.props.history.push("/new")}))}))))),(0,y.Z)(this,"saveTemplate",((e,t)=>{this.getThumbnailPromise(e.meta.preview_url).then((n=>{v.x.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}),v.x.Modal.loading(!1)})),t()})).catch((e=>{this.showError({errors:[e]})}))})),(0,y.Z)(this,"loadAuthorizedEmailAddresses",(async()=>"MailPoet"!==window.mailpoet_mta_method?[]:(await v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])),(0,y.Z)(this,"handleSend",(e=>(e.preventDefault(),this.removeInvalidFromAddressError(),this.isValid()?(v.x.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}),v.x.Modal.loading(!1)})):(this.showInvalidFromAddressError(),v.x.Modal.loading(!1))))):m()("#mailpoet_newsletter").parsley().validate()))),(0,y.Z)(this,"sendNewsletter",(e=>v.x.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 v.x.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,j.jsx)("p",{children:v.x.I18n.t("newsletterHasBeenScheduled")})),v.x.trackEvent("Emails > Newsletter sent",{scheduled:!0})):(this.context.notices.success((0,j.jsx)("p",{children:v.x.I18n.t("newsletterBeingSent")}),{id:"mailpoet_notice_being_sent"}),v.x.trackEvent("Emails > Newsletter sent",{scheduled:!1})),v.x.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),v.x.Modal.loading(!1)})))),(0,y.Z)(this,"activateNewsletter",(e=>v.x.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 v.x.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&&On[e.group]?this.context.notices.success((0,j.jsx)("p",{children:v.x.I18n.t("automaticEmailActivated").replace("%1s",On[e.group].title)})):"welcome"===t.data.type?(this.context.notices.success((0,j.jsx)("p",{children:v.x.I18n.t("welcomeEmailActivated")})),v.x.trackEvent("Emails > Welcome email activated",{"List type":e.event,Delay:`${e.afterTimeNumber} ${e.afterTimeType}`})):"notification"===t.data.type&&(this.context.notices.success((0,j.jsx)("p",{children:v.x.I18n.t("postNotificationActivated")})),v.x.trackEvent("Emails > Post notifications activated",{Frequency:e.intervalType})),v.x.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),v.x.Modal.loading(!1)})))),(0,y.Z)(this,"handleResume",(e=>(e.preventDefault(),this.isValid()?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((()=>{v.x.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,j.jsx)("p",{children:v.x.I18n.t("newsletterSendingHasBeenResumed")}))})).fail((e=>{this.showError(e)}))})).fail((e=>{this.showError(e)})).always((()=>{this.setState({loading:!1})})):m()("#mailpoet_newsletter").parsley().validate(),!1))),(0,y.Z)(this,"handleSave",(e=>{e.preventDefault(),this.saveNewsletter(e).done((()=>{this.context.notices.success((0,j.jsx)("p",{children:v.x.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,y.Z)(this,"handleRedirectToDesign",(e=>{e.preventDefault();const t=e.target.href;this.saveNewsletter(e).done((()=>{this.context.notices.success((0,j.jsx)("p",{children:v.x.I18n.t("newsletterUpdated")}))})).done((()=>{window.location=t})).fail((e=>{this.showError(e)}))})),(0,y.Z)(this,"saveNewsletter",(()=>{const e=this.state.item;e.queue=void 0,this.setState({loading:!0});const t=_.ZP.omit(e,["body","created_at","deleted_at","hash","status","updated_at","type"]);return v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:t})})),(0,y.Z)(this,"showError",(e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,j.jsx)("p",{children:e.message},e.message))),{scroll:!0})})),(0,y.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===Rn(r.id,a)&&(r.ga_campaign=Rn(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})})),m()("#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,j.jsxs)("div",{className:"mailpoet-form-send-email",children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(dt,{emailType:a,automationId:"newsletter_send_heading"}),(0,j.jsxs)(ve,{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,j.jsxs)(bt.r.CenteredRow,{className:"send-newsletter-buttons",children:[(0,j.jsx)(g.Button,{variant:"secondary",type:"submit",automationId:"email-save-draft",children:v.x.I18n.t("saveDraftAndClose")}),e?(0,j.jsx)(g.Button,{type:"button",onClick:this.handleResume,isDisabled:r,automationId:"email-resume",children:v.x.I18n.t("resume")}):(0,j.jsx)(g.Button,{type:"button",onClick:this.handleSend,...n,isDisabled:r,automationId:"email-submit",children:n.value||v.x.I18n.t("send")}),void 0!==this.state.validationError&&(0,j.jsx)(A.Tooltip,{tooltip:(0,j.jsx)("div",{children:this.state.validationError}),tooltipId:"helpTooltipSendEmail"})]}),(0,j.jsxs)("p",{children:[v.x.I18n.t("orSimply")," ",(0,j.jsx)("a",{className:"mailpoet-link",href:`?page=mailpoet-newsletter-editor&id=${this.props.match.params.id}`,onClick:this.handleRedirectToDesign,children:v.x.I18n.t("goBackToDesign")}),"."]}),window.mailpoet_mss_key_pending_approval&&(0,j.jsx)("div",{className:"mailpoet_error",children:C()(v.x.I18n.t("pendingKeyApprovalNotice"),/\[link\](.*?)\[\/link\]/g,(e=>(0,j.jsx)("a",{href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer",children:e},"pendingKeyApprovalNoticeLink")))})]})]})}}Pn.contextType=Ce.k,Pn.propTypes={match:f().shape({params:f().shape({id:f().string}).isRequired}).isRequired,history:f().shape({push:f().func.isRequired}).isRequired};const Mn=(0,c.withRouter)(Pn);function Ln(e){const[t,n]=(0,w.useState)(!1);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:0,children:v.x.I18n.t("congratulationsSuccessHeader")}),(0,j.jsx)(fe.X,{level:3,children:(r=e.newsletter,"welcome"===r.type?v.x.I18n.t("congratulationsWelcomeEmailSuccessBody"):"notification"===r.type?v.x.I18n.t("congratulationsPostNotificationSuccessBody"):"automatic"===r.type?v.x.I18n.t("congratulationsWooSuccessBody"):"scheduled"===r.status?v.x.I18n.t("congratulationsScheduleSuccessBody"):v.x.I18n.t("congratulationsSendSuccessBody"))}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)("img",{src:e.illustrationImageUrl,alt:"",width:"500"}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)(g.Button,{type:"button",dimension:"small",onClick:()=>{e.successClicked(),n(!0)},withSpinner:t,children:v.x.I18n.t("close")})]});var r}function Fn(e){return(0,j.jsxs)("div",{className:"mailpoet-wizard-step",children:[(0,j.jsx)("div",{className:"mailpoet-wizard-step-illustration",children:(0,j.jsx)("img",{src:e.illustrationUrl,width:"500",alt:""})}),(0,j.jsx)("div",{className:"mailpoet-wizard-step-content",children:e.children})]})}function qn(e){let{children:t,isOrdered:n}=e;const r=n?"ol":"ul";return(0,j.jsx)(r,{className:`mailpoet-${r}`,children:t})}function $n(){return(0,j.jsxs)(qn,{children:[(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSList1")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSList2")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSList4")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSList5")})]})}function Un(){return(0,j.jsxs)(qn,{children:[(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSNotFreeList1")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSNotFreeList2")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSNotFreeList3")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSNotFreeList4")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSNotFreeList5")})]})}function Zn(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)(g.Button,{isFullWidth:!0,href:e.mailpoetAccountUrl,target:"_blank",rel:"noopener noreferrer",onClick:t=>{t.preventDefault(),window.open(e.mailpoetAccountUrl),e.next()},children:e.nextButtonText}),(0,j.jsx)(g.Button,{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:v.x.I18n.t("welcomeWizardMSSNoThanks")})]})}function Vn(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("welcomeWizardMSSFreeTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("p",{children:v.x.I18n.t("welcomeWizardMSSFreeSubtitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)(fe.X,{level:5,children:[v.x.I18n.t("welcomeWizardMSSFreeListTitle"),":"]}),(0,j.jsx)($n,{}),(0,j.jsx)(Zn,{mailpoetAccountUrl:v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount,v.x.currentWpUserEmail,"starter",{utm_medium:"onboarding",utm_campaign:"purchase"}),next:e.next,nextButtonText:v.x.I18n.t("welcomeWizardMSSFreeButton")})]})}function Wn(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("welcomeWizardMSSNotFreeTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("p",{children:[v.x.I18n.t("welcomeWizardMSSNotFreeSubtitle"),":"]}),(0,j.jsx)(Un,{}),(0,j.jsx)(Zn,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next,nextButtonText:v.x.I18n.t("welcomeWizardMSSNotFreeButton")})]})}function Yn(e){return e.subscribersCount<1e3?(0,j.jsx)(Vn,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next}):(0,j.jsx)(Wn,{mailpoetAccountUrl:e.purchaseUrl,next:e.next})}function Bn(e){const[t,n]=(0,w.useState)(!1);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:(r=e.newsletter.type,{standard:v.x.I18n.t("congratulationsMSSPitchHeader"),welcome:v.x.I18n.t("congratulationsMSSPitchHeaderAutomated"),notification:v.x.I18n.t("congratulationsMSSPitchHeaderAutomated"),woocommerce:v.x.I18n.t("congratulationsMSSPitchHeaderAutomated")}[r]||v.x.I18n.t("congratulationsMSSPitchHeaderAutomated"))}),(0,j.jsx)(Fn,{illustrationUrl:e.MSSPitchIllustrationUrl,children:(0,j.jsxs)("div",{className:"mailpoet-welcome-wizard-step-content",children:[(0,j.jsx)(fe.X,{level:4,children:v.x.I18n.t("congratulationsMSSPitchSubHeader")}),(0,j.jsx)("p",{children:v.x.I18n.t(e.subscribersCount<1e3?"welcomeWizardMSSFreeSubtitle":"welcomeWizardMSSNotFreeSubtitle")}),(0,j.jsxs)(fe.X,{level:5,children:[v.x.I18n.t("welcomeWizardMSSFreeListTitle"),":"]}),(0,j.jsx)($n,{}),(0,j.jsx)(Zn,{mailpoetAccountUrl:e.purchaseUrl,next:()=>{e.onFinish(),n(!0)},nextButtonText:v.x.I18n.t("welcomeWizardMSSFreeButton"),nextWithSpinner:t})]})})]});var r}function Hn(e){return window.has_mss_key_specified?(0,j.jsx)(Ln,{successClicked:e.successClicked,illustrationImageUrl:e.illustrationImageUrl,newsletter:e.newsletter}):(0,j.jsx)(Bn,{MSSPitchIllustrationUrl:e.MSSPitchIllustrationUrl,onFinish:e.successClicked,subscribersCount:e.subscribersCount,purchaseUrl:e.purchaseUrl,newsletter:e.newsletter})}function zn(e){const[t,n]=(0,w.useState)(!1);return(0,j.jsxs)("div",{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("congratulationsSendFailHeader")}),(0,j.jsx)(fe.X,{level:3,children:C()(v.x.I18n.t("congratulationsSendFailExplain"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,j.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,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)("img",{src:window.mailpoet_congratulations_error_image,alt:"",width:"500"}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)(g.Button,{dimension:"small",type:"button",onClick:()=>{e.failClicked(),n(!0)},withSpinner:t,children:v.x.I18n.t("close")})]})}Ln.propTypes={successClicked:f().func.isRequired,illustrationImageUrl:f().string.isRequired,newsletter:f().shape({status:f().string.isRequired,type:f().string.isRequired}).isRequired},Fn.propTypes={illustrationUrl:f().string.isRequired,children:f().oneOfType([f().arrayOf(f().node),f().node]).isRequired},Zn.propTypes={mailpoetAccountUrl:f().string.isRequired,next:f().func.isRequired,nextButtonText:f().string.isRequired,nextWithSpinner:f().bool},Zn.defaultProps={nextWithSpinner:!1},Vn.propTypes={next:f().func.isRequired},Wn.propTypes={mailpoetAccountUrl:f().string.isRequired,next:f().func.isRequired},Yn.propTypes={next:f().func.isRequired,subscribersCount:f().number.isRequired,mailpoetAccountUrl:f().string.isRequired,purchaseUrl:f().string.isRequired},Hn.propTypes={successClicked:f().func.isRequired,illustrationImageUrl:f().string.isRequired,MSSPitchIllustrationUrl:f().string.isRequired,newsletter:f().shape({status:f().string.isRequired,type:f().string.isRequired}).isRequired,subscribersCount:f().number.isRequired,purchaseUrl:f().string.isRequired},zn.propTypes={failClicked:f().func.isRequired};var Kn=n(63438);function Gn(e){return(0,j.jsx)("div",{className:"mailpoet-congratulate-loading",children:e.showRichLoadingScreen&&(0,j.jsxs)("div",{children:[(0,j.jsx)(fe.X,{level:0,children:v.x.I18n.t("congratulationsLoadingHeader")}),(0,j.jsx)(fe.X,{level:3,children:v.x.I18n.t("congratulationsLoadingBody")}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)(Kn.a,{size:64})]})})}Gn.propTypes={showRichLoadingScreen:f().bool.isRequired};const Qn=Math.floor(4*Math.random());function Xn(){return v.x.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 Jn extends w.Component{constructor(e){super(e),this.state={loading:!0,newsletter:null,testingPassed:!1,timeStart:Q()(),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(){Q()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),Q()().subtract(6,"seconds").isAfter(this.state.timeStart)&&this.setState({minimumLoadingTimePassed:!0}),!this.state.loading&&this.state.minimumLoadingTimePassed||setTimeout(this.tick,2e3)}loadNewsletter(e){v.x.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,j.jsx)(Gn,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:Xn,showRichLoadingScreen:e})):this.state.error?(v.x.trackEvent("Cron testing done",{"Cron is working":"false"}),(0,j.jsx)(zn,{failClicked:()=>{window.location=window.mailpoet_main_page}})):(t=this.state.newsletter,this.state.testingPassed&&v.x.trackEvent("Cron testing done",{"Cron is working":"true"}),(0,j.jsx)(Hn,{illustrationImageUrl:window.mailpoet_congratulations_success_images[Qn],MSSPitchIllustrationUrl:window.mailpoet_congratulations_success_images[Qn],successClicked:Xn,newsletter:t,isWoocommerceActive:window.mailpoet_woocommerce_active,subscribersCount:window.mailpoet_subscribers_count,purchaseUrl:v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount,v.x.currentWpUserEmail,"starter",{utm_medium:"first-newsletter-congratulations",utm_campaign:"purchase"})}));var e,t}render(){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("style",{dangerouslySetInnerHTML:{__html:"body { background: #fff; overflow-x: hidden; }"}}),(0,j.jsxs)("div",{className:"mailpoet-congratulate",children:[(0,j.jsx)("div",{className:"mailpoet-gap-large"}),this.renderContent()]})]})}}Jn.propTypes={match:f().shape({params:f().shape({id:f().string}).isRequired}).isRequired};class er extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"showTemplateSelection",(e=>{this.props.history.push(`/template/${e}`)}))}componentDidMount(){v.x.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,j.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}render(){return(0,j.jsx)("div",{children:(0,j.jsx)(dt,{emailType:"standard",automationId:"standard_newsletter_creation_heading"})})}}er.contextType=Ce.k,er.propTypes={history:f().shape({push:f().func.isRequired}).isRequired};const tr=(0,c.withRouter)(er),nr={name:"options",type:"reactComponent",component:sn};class rr extends w.Component{constructor(e){super(e),(0,y.Z)(this,"handleValueChange",(e=>{const t=this.state;t[e.target.name]=e.target.value,this.setState(t)})),(0,y.Z)(this,"handleNext",(()=>{v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:_.ZP.extend({},this.state,{type:"notification",subject:v.x.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,j.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))})),(0,y.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,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(dt,{emailType:"notification",automationId:"post_notification_creation_heading"}),(0,j.jsxs)(bt.r.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,j.jsx)(fe.X,{level:4,children:v.x.I18n.t("selectFrequency")}),(0,j.jsx)(sn,{item:this.state,field:nr,onValueChange:this.handleValueChange}),(0,j.jsx)(O.z,{isFullWidth:!0,onClick:this.handleNext,type:"button",children:v.x.I18n.t("next")})]})]})}}rr.contextType=Ce.k,rr.propTypes={history:f().shape({push:f().func.isRequired}).isRequired};const ar=(0,c.withRouter)(rr),sr={name:"options",label:"Event",type:"reactComponent",component:xn};class ir extends w.Component{constructor(e){super(e),(0,y.Z)(this,"isValid",(()=>m()("#welcome_scheduling").parsley().isValid())),(0,y.Z)(this,"validate",(()=>m()("#welcome_scheduling").parsley().validate()));let t=window.mailpoet_segments||[],n=1;t=t.filter((e=>"default"===e.type)),_.ZP.size(t)>0&&(n=_.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()?v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:_.ZP.extend({},this.state,{type:"welcome",subject:v.x.I18n.t("draftNewsletterTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})):this.validate()}showTemplateSelection(e){this.props.history.push(`/template/${e}`)}render(){return(0,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(dt,{emailType:"welcome",automationId:"welcome_email_creation_heading"}),(0,j.jsxs)(bt.r.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,j.jsx)(fe.X,{level:4,children:v.x.I18n.t("selectEventToSendWelcomeEmail")}),(0,j.jsxs)("form",{id:"welcome_scheduling",children:[(0,j.jsx)(xn,{item:this.state,field:sr,onValueChange:this.handleValueChange}),(0,j.jsx)(O.z,{isFullWidth:!0,type:"submit",onClick:this.handleNext,children:v.x.I18n.t("next")})]})]})]})}}ir.propTypes={history:f().shape({push:f().func.isRequired}).isRequired};class or extends w.Component{static getEventOptions(e){return e.options||null}static getEventOptionsFirstValue(e){return e&&_.ZP.isArray(e.values)&&e.values[0].id?e.values[0].id:null}constructor(e){super(e),(0,y.Z)(this,"isValid",(()=>!m()("#newsletter_scheduling").parsley()||m()("#newsletter_scheduling").parsley().isValid())),(0,y.Z)(this,"validate",(()=>{m()("#newsletter_scheduling").parsley()&&m()("#newsletter_scheduling").parsley().validate()})),(0,y.Z)(this,"resetValidationErrors",(()=>{m()("#newsletter_scheduling").parsley()&&m()("#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=_.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})),v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"automatic",subject:v.x.I18n.t("draftNewsletterTitle"),options:l}}).done((e=>{v.x.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,j.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}getEvent(e){return this.emailEvents[e]}getFirstSegment(){return _.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,j.jsx)(_n,{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,j.jsx)("div",{className:"event-segment-selection",children:(0,j.jsx)(I,{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,j.jsx)(yn,{item:r.item,event:r.event,onValueChange:r.onValueChange})}displayEventTip(){const{event:e}=this.state;return e.tip?(0,j.jsxs)("p",{className:"description",children:[(0,j.jsx)("strong",{children:v.x.I18n.t("tip")})," ",e.tip]}):null}render(){return(0,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(dt,{emailType:"woocommerce",automationId:"woocommerce_email_creation_heading"}),(0,j.jsx)(bt.r.Column,{align:"center",className:"mailpoet-schedule-email",children:(0,j.jsxs)("form",{id:"newsletter_scheduling",children:[(0,j.jsx)(fe.X,{level:4,children:this.displayHeader()}),(0,j.jsx)("div",{children:this.displayEventOptions()}),(0,j.jsx)("div",{children:this.displaySegments()}),(0,j.jsx)("div",{children:this.displayScheduling()}),(0,j.jsx)(O.z,{isFullWidth:!0,onClick:this.handleNextStep,type:"submit",children:v.x.I18n.t("next")})]})}),this.displayEventTip()]})}}or.contextType=Ce.k,or.propTypes={history:f().shape({push:f().func.isRequired}).isRequired,name:f().string.isRequired,email:f().shape({title:f().string.isRequired,slug:f().string.isRequired}).isRequired};var lr=n(29925),cr=n(45853),dr=n(47443);const ur=f().shape({status:f().string,count_processed:f().string.isRequired,count_total:f().string.isRequired,scheduled_at:f().string}),pr=f().shape({id:f().number.isRequired,sent_at:f().string,status:f().string.isRequired,queue:f().oneOfType([ur,f().bool])});function mr(e){let{newsletter:t}=e;const[n,r]=(0,w.useState)("paused"===t.queue.status),[a,s]=(0,w.useState)([]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Be,{errors:a}),n&&(0,j.jsx)(O.z,{dimension:"small",onClick:()=>{s([]),v.x.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:v.x.I18n.t("resume")}),!n&&(0,j.jsx)(O.z,{dimension:"small",onClick:()=>{s([]),v.x.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:v.x.I18n.t("pause")})]})}function hr(e){let{newsletter:t,mailerLog:n}=e,r=t.sent_at||t.queue.scheduled_at;r&&(r=(0,cr.default)(r,"yyyy-MM-dd HH:mm:ss",new Date));const a=t.queue&&"scheduled"!==t.queue.status,s="paused"===n.status,i=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.rU,{to:`/sending-status/${t.id}`,"data-automation-id":`sending_status_${t.id}`,children:(0,j.jsx)(dr.s,{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,j.jsx)(mr,{newsletter:t})]}),o=(0,j.jsx)(dr.s,{scheduledFor:r,isPaused:"scheduled"===t.queue.status&&s,status:t.status});return(0,j.jsxs)(j.Fragment,{children:[a&&i,!a&&o]})}mr.propTypes={newsletter:pr.isRequired},hr.propTypes={newsletter:pr.isRequired,mailerLog:f().shape({status:f().string}).isRequired};const fr=v.x.trackingConfig.emailTrackingEnabled,gr={onNoItemsFound:(e,t)=>v.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterTrashed"):v.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterDeleted"):v.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterRestored"):v.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},xr=[{name:"subject",label:v.x.I18n.t("subject"),sortable:!0},{name:"status",label:v.x.I18n.t("status")},{name:"segments",label:v.x.I18n.t("lists")},{name:"statistics",label:v.x.I18n.t("statistics"),display:fr},{name:"sent_at",label:v.x.I18n.t("sentOn"),sortable:!0}],vr=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:gr.onTrash}],br=e=>{const t=()=>{window.location.href=`?page=mailpoet-newsletter-editor&id=${e.id}`};e.queue&&"sending"===e.status&&null===e.queue.status?(0,pt._)({message:v.x.I18n.t("confirmEdit"),onConfirm:t}):t()};let yr=[{name:"view",link:function(e){return(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("edit"),onClick:br},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:function(e,t){return v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{v.x.Notice.success(v.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];yr=(0,qe.y8)(yr);class wr extends w.Component{constructor(e){super(e),(0,y.Z)(this,"renderItem",((e,t,n)=>{const r=u()("manage-column","column-primary","has-row-actions");return(0,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:r,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:"#",onClick:t=>{t.preventDefault(),br(e)},children:e.queue.newsletter_rendered_subject||e.subject}),t]}),(0,j.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":v.x.I18n.t("status"),children:(0,j.jsx)(hr,{newsletter:e,mailerLog:n.mta_log})}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("lists"),children:(0,j.jsx)(lr.$,{segments:e.segments,dimension:"large"})}),!0===fr?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("statistics"),children:(0,j.jsx)(Qe,{newsletter:e,currentTime:n.current_time})}):null,(0,j.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("sentOn"),children:e.sent_at?(0,j.jsxs)(j.Fragment,{children:[v.x.Date.short(e.sent_at),(0,j.jsx)("br",{}),v.x.Date.time(e.sent_at)]}):null})]})})),(0,y.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,j.jsxs)(j.Fragment,{children:[0===this.state.newslettersCount&&(0,j.jsx)(Ke,{filter:e=>"standard"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,j.jsx)(x.N,{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:xr,bulk_actions:vr,item_actions:yr,messages:gr,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,qe._X)(e),(0,qe.bF)(e)}})]})}}wr.contextType=Ce.k,wr.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const _r=(0,c.withRouter)(wr),jr=window.mailpoet_roles||{},Ir=window.mailpoet_segments||{},Sr=v.x.trackingConfig.emailTrackingEnabled,Cr={onNoItemsFound:(e,t)=>v.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterTrashed"):v.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterDeleted"):v.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterRestored"):v.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},Tr=[{name:"subject",label:v.x.I18n.t("subject"),sortable:!0},{name:"settings",label:v.x.I18n.t("settings")},{name:"statistics",label:v.x.I18n.t("statistics"),display:Sr},{name:"status",label:v.x.I18n.t("status"),width:145},{name:"updated_at",label:v.x.I18n.t("lastModifiedOn"),sortable:!0}],kr=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:Cr.onTrash}];let Nr=[{name:"view",link:function(e){return(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("preview")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:(e,t)=>v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{v.x.Notice.success(v.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("edit"),onClick:qe.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Nr=(0,qe.y8)(Nr);class Dr extends w.Component{constructor(e){super(e),(0,y.Z)(this,"updateStatus",((e,t)=>{t.persist(),v.x.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&&v.x.Notice.success(v.x.I18n.t("welcomeEmailActivated")),this.forceUpdate()})).fail((n=>{v.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,y.Z)(this,"renderStatus",(e=>{const t=v.x.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString()),n=v.x.I18n.t("scheduledToXSubscribers").replace("%1$d",e.total_scheduled.toLocaleString());return(0,j.jsxs)("div",{children:[(0,j.jsx)(Mt.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,j.jsxs)("p",{className:"mailpoet-listing-stats-description",children:[(0,j.jsx)(l.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})," ",(0,j.jsx)("br",{}),n]})]})})),(0,y.Z)(this,"renderSettings",(e=>{let t,n,r;switch(e.options.event){case"user":t="mailpoet_all"===e.options.role?v.x.I18n.t("welcomeEventWPUserAnyRole"):C()(v.x.I18n.t("welcomeEventWPUserWithRole"),'"%1$s"',((t,n)=>(0,j.jsx)(ke.V,{variant:"list",children:jr[e.options.role]},n)));break;default:if(r=_.ZP.find(Ir,(t=>Number(t.id)===Number(e.options.segment))),void 0===r)return(0,j.jsx)(l.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:v.x.I18n.t("sendingToSegmentsNotSpecified")});t=C()(v.x.I18n.t("welcomeEventSegment"),'"%1$s"',((e,t)=>(0,j.jsx)(ke.V,{variant:"list",children:r.name},t)))}if(t&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":n=v.x.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":n=v.x.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":n=v.x.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":n=v.x.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:n=v.x.I18n.t("sendingDelayInvalid")}return(0,j.jsxs)("span",{children:[t,n&&(0,j.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,j.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,j.jsx)(dr.P,{})}),n]})]})})),(0,y.Z)(this,"renderItem",((e,t)=>{const n=u()("manage-column","column-primary","has-row-actions");return(0,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:n,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("settings"),children:this.renderSettings(e)}),!0===Sr?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("statistics"),children:(0,j.jsx)(Qe,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("status"),children:this.renderStatus(e)}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("lastModifiedOn"),children:[v.x.Date.short(e.updated_at),(0,j.jsx)("br",{}),v.x.Date.time(e.updated_at)]})]})})),(0,y.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,j.jsxs)(j.Fragment,{children:[0===this.state.newslettersCount&&(0,j.jsx)(Ke,{filter:e=>"welcome"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,j.jsx)(x.N,{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:Tr,bulk_actions:kr,item_actions:Nr,messages:Cr,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,qe._X)(e),(0,qe.bF)(e)}})]})}}Dr.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const Er=(0,c.withRouter)(Dr),Or={onNoItemsFound:(e,t)=>v.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterTrashed"):v.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterDeleted"):v.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterRestored"):v.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},Rr=[{name:"subject",label:v.x.I18n.t("subject"),sortable:!0},{name:"settings",label:v.x.I18n.t("settings")},{name:"history",label:v.x.I18n.t("history"),width:100},{name:"status",label:v.x.I18n.t("status"),width:100},{name:"updated_at",label:v.x.I18n.t("lastModifiedOn"),sortable:!0}],Ar=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:Or.onTrash}],Pr=[{name:"view",link:function(e){return(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("edit"),onClick:qe.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:function(e,t){return v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{v.x.Notice.success(v.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class Mr extends w.Component{constructor(e){super(e),(0,y.Z)(this,"updateStatus",((e,t)=>{t.persist(),v.x.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&&v.x.Notice.success(v.x.I18n.t("postNotificationActivated")),this.forceUpdate()})).fail((n=>{v.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,y.Z)(this,"renderStatus",(e=>(0,j.jsx)(Mt.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}))),(0,y.Z)(this,"renderSettings",(e=>{let t;if(0===e.segments.length)return(0,j.jsx)(l.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:v.x.I18n.t("sendingToSegmentsNotSpecified")});const n=C()(v.x.I18n.t("sendTo"),"%1$s",((t,n)=>(0,j.jsx)(lr.$,{segments:e.segments},n)));switch(e.options.intervalType){case"daily":t=v.x.I18n.t("sendDaily").replace("%1$s",Gt[e.options.timeOfDay]);break;case"weekly":t=v.x.I18n.t("sendWeekly").replace("%1$s",Qt[e.options.weekDay]).replace("%2$s",Gt[e.options.timeOfDay]);break;case"monthly":t=v.x.I18n.t("sendMonthly").replace("%1$s",Xt[e.options.monthDay]).replace("%2$s",Gt[e.options.timeOfDay]);break;case"nthWeekDay":t=v.x.I18n.t("sendNthWeekDay").replace("%1$s",Jt[e.options.nthWeekDay]).replace("%2$s",Qt[e.options.weekDay]).replace("%3$s",Gt[e.options.timeOfDay]);break;case"immediately":t=v.x.I18n.t("sendImmediately");break;default:t="Invalid sending frequency"}return(0,j.jsxs)("span",{children:[n,(0,j.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,j.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,j.jsx)(dr.P,{})}),t]})]})})),(0,y.Z)(this,"renderHistoryLink",(e=>0===Number(e.children_count)?(0,j.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small mailpoet-listing-notification-status",children:v.x.I18n.t("notSentYet")}):(0,j.jsxs)(l.rU,{className:"mailpoet-nowrap","data-automation-id":`history-${e.id}`,to:`/notification/history/${e.id}`,children:[(0,j.jsx)(O.z,{className:"mailpoet-hide-on-mobile",dimension:"small",children:v.x.I18n.t("viewHistory")}),(0,j.jsx)(O.z,{className:"mailpoet-show-on-mobile mailpoet-listing-notification-status",dimension:"small",variant:"secondary",children:v.x.I18n.t("viewHistory")})]}))),(0,y.Z)(this,"renderItem",((e,t)=>{const n=u()("manage-column","column-primary","has-row-actions");return(0,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:n,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("settings"),children:this.renderSettings(e)}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("history"),children:this.renderHistoryLink(e)}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("status"),children:this.renderStatus(e)}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("lastModifiedOn"),children:[v.x.Date.short(e.updated_at),(0,j.jsx)("br",{}),v.x.Date.time(e.updated_at)]})]})})),(0,y.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,j.jsxs)(j.Fragment,{children:[0===this.state.newslettersCount&&(0,j.jsx)(Ke,{filter:e=>"notification"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,j.jsx)(x.N,{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:Rr,bulk_actions:Ar,item_actions:Pr,messages:Or,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,qe._X)(e),(0,qe.bF)(e)}})]})}}Mr.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const Lr=(0,c.withRouter)(Mr),Fr=v.x.trackingConfig.emailTrackingEnabled,qr={onNoItemsFound:(e,t)=>v.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterTrashed"):v.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterDeleted"):v.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterRestored"):v.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},$r=[{name:"subject",label:v.x.I18n.t("subject"),sortable:!0},{name:"settings",label:v.x.I18n.t("settings")},{name:"statistics",label:v.x.I18n.t("statistics"),display:Fr},{name:"status",label:v.x.I18n.t("status"),width:145},{name:"updated_at",label:v.x.I18n.t("lastModifiedOn"),sortable:!0}],Ur=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:qr.onTrash}];let Zr=[{name:"view",link:function(e){return(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("preview")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:(e,t)=>v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{v.x.Notice.success(v.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("edit"),onClick:qe.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Zr=(0,qe.y8)(Zr);class Vr extends w.Component{constructor(e){super(e),(0,y.Z)(this,"updateStatus",((e,t)=>{t.persist(),v.x.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&&v.x.Notice.success(v.x.I18n.t("reEngagementEmailActivated")),this.forceUpdate()})).fail((n=>{v.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,y.Z)(this,"renderStatus",(e=>{const t=v.x.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString());return(0,j.jsxs)("div",{children:[(0,j.jsx)(Mt.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,j.jsx)("p",{className:"mailpoet-listing-stats-description",children:(0,j.jsx)(l.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})})]})})),(0,y.Z)(this,"renderSettings",(e=>{if(0===e.segments.length)return(0,j.jsx)(l.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:v.x.I18n.t("sendingToSegmentsNotSpecified")});const t=C()(v.x.I18n.t("sendTo"),"%1$s",((t,n)=>(0,j.jsx)(lr.$,{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=v.x.I18n.t("reEngagementSettings").replace("{$count}",e.options.afterTimeNumber).replace("{$frequency}",v.x.I18n.t(n));return(0,j.jsxs)("span",{children:[t,(0,j.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,j.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,j.jsx)(dr.P,{})}),r]})]})})),(0,y.Z)(this,"renderItem",((e,t)=>{const n=u()("manage-column","column-primary","has-row-actions");return(0,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:n,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("settings"),children:this.renderSettings(e)}),!0===Fr?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("statistics"),children:(0,j.jsx)(Qe,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("status"),children:this.renderStatus(e)}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("lastModifiedOn"),children:[v.x.Date.short(e.updated_at),(0,j.jsx)("br",{}),v.x.Date.time(e.updated_at)]})]})})),(0,y.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,j.jsxs)(j.Fragment,{children:[0===this.state.newslettersCount&&(0,j.jsx)(Ke,{filter:e=>"re_engagement"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,j.jsx)(x.N,{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:$r,bulk_actions:Ur,item_actions:Zr,messages:qr,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,qe._X)(e),(0,qe.bF)(e)}})]})}}Vr.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const Wr=(0,c.withRouter)(Vr),Yr=v.x.trackingConfig.emailTrackingEnabled,Br=[{name:"subject",label:v.x.I18n.t("subject")},{name:"status",label:v.x.I18n.t("status")},{name:"segments",label:v.x.I18n.t("lists")},{name:"statistics",label:v.x.I18n.t("statistics"),display:Yr},{name:"sent_at",label:v.x.I18n.t("sentOn"),sortable:!0}],Hr={onNoItemsFound:(e,t)=>v.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterTrashed"):v.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterDeleted"):v.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterRestored"):v.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},zr=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:Hr.onTrash}],Kr=(0,qe.y8)([{name:"view",link:function(e){return(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("preview")})}},{name:"trash",className:"mailpoet-hide-on-mobile"}]),Gr=(e,t,n)=>{const r=u()("manage-column","column-primary","has-row-actions");return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("td",{className:r,children:[(0,j.jsx)("strong",{children:(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:e.queue.newsletter_rendered_subject||e.subject})}),t]}),(0,j.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":v.x.I18n.t("status"),children:(0,j.jsx)(hr,{newsletter:e,mailerLog:n.mta_log})}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("lists"),children:(0,j.jsx)(lr.$,{segments:e.segments,dimension:"large"})}),!0===Yr?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("statistics"),children:(0,j.jsx)(Qe,{newsletter:e,currentTime:n.current_time})}):null,(0,j.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("sentOn"),children:e.sent_at?(0,j.jsxs)(j.Fragment,{children:[v.x.Date.short(e.sent_at),(0,j.jsx)("br",{}),v.x.Date.time(e.sent_at)]}):null})]})};function Qr(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:"/notification",children:v.x.I18n.t("backToPostNotifications")}),(0,j.jsx)(x.N,{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:Gr,columns:Br,messages:Hr,item_actions:Kr,bulk_actions:zr,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{(0,qe._X)(e),(0,qe.bF)(e)}})]})}Qr.propTypes={parentId:f().string.isRequired,location:f().shape({pathname:f().string}).isRequired,match:f().shape({params:f().shape({id:f().node}).isRequired}).isRequired};const Xr=(0,c.withRouter)(Qr),Jr=[{name:"subscriber_id",label:v.x.I18n.t("subscriber"),sortable:!0},{name:"status",label:v.x.I18n.t("sendingStatus")},{name:"failureReason",label:v.x.I18n.t("failureReason")}],ea={onNoItemsFound:()=>v.x.I18n.t("noSendingTaskFound")};function ta(e){const[t,n]=(0,w.useState)({id:e.match.params.id,subject:"",sent:!1});return(0,w.useEffect)((()=>{v.x.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=>v.x.Notice.showApiErrorNotice(e)))}),[t.id]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:v.x.I18n.t("sendingStatusTitle")}),(0,j.jsx)(sa,{newsletter:t}),(0,j.jsx)(aa,{location:e.location,params:e.match.params})]})}ta.propTypes={location:f().shape({pathname:f().string}).isRequired,match:f().shape({params:f().shape({id:f().string.isRequired}).isRequired}).isRequired};const na=(e,t)=>e.location.pathname===t.location.pathname&&e.params.id===t.params.id,ra=e=>(0,j.jsx)("div",{children:(0,j.jsx)(ia,{...e})}),aa=(0,w.memo)((e=>{let{location:t,params:n}=e;return(0,j.jsx)(x.N,{limit:window.mailpoet_listing_per_page,location:t,params:n,endpoint:"sending_task_subscribers",base_url:"sending-status/:id",onRenderItem:ra,getListingItemKey:e=>`${e.taskId}-${e.subscriberId}`,columns:Jr,messages:ea,auto_refresh:!0,sort_by:"failed",sort_order:"desc",afterGetItems:e=>{(0,qe._X)(e),(0,qe.bF)(e)}})}),na);function sa(e){let{newsletter:t}=e;return t.id&&t.subject&&t.sent?(0,j.jsx)("p",{children:(0,j.jsx)(l.rU,{to:`/stats/${t.id}`,children:t.subject})}):null}function ia(e){let{error:t,failed:n,taskId:r,processed:a,email:s,subscriberId:i,lastName:o,firstName:l}=e;const c=u()("manage-column","column-primary","has-row-actions");let d=v.x.I18n.t("unprocessed");return a&&(d=n?(0,j.jsxs)("span",{children:[v.x.I18n.t("failed"),(0,j.jsx)("br",{}),(0,j.jsx)("a",{className:"button",href:"#",onClick:e=>{e.preventDefault(),v.x.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=>v.x.Notice.showApiErrorNotice(e)))},children:v.x.I18n.t("resend")})]}):v.x.I18n.t("sent")),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("td",{"data-automation-id":`name_${r}_${i}`,className:c,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-subscribers#/edit/${i}`,children:s}),(0,j.jsx)("div",{className:"mailpoet-listing-subtitle",children:`${l} ${o}`})]}),(0,j.jsx)("td",{className:"column","data-automation-id":`status_${r}_${i}`,"data-colname":v.x.I18n.t("sendingStatus"),children:d}),(0,j.jsx)("td",{className:"column","data-automation-id":`error_${r}_${i}`,"data-colname":v.x.I18n.t("failureReason"),children:t})]})}function oa(){return(0,j.jsx)("style",{dangerouslySetInnerHTML:{__html:".wrap { margin: 0 !important; }"}})}aa.propTypes={location:f().shape({pathname:f().string}).isRequired,params:f().shape({id:f().string.isRequired}).isRequired},sa.propTypes={newsletter:f().shape({id:f().string,subject:f().string,sent:f().bool})},sa.defaultProps={newsletter:{id:null,subject:null,sent:!1}},ia.propTypes={error:f().string,email:f().string.isRequired,failed:f().number.isRequired,taskId:f().number.isRequired,lastName:f().string.isRequired,firstName:f().string.isRequired,processed:f().number.isRequired,subscriberId:f().number.isRequired},ia.defaultProps={error:""};var la=n(4840),ca=n(53681),da=n(21918);const ua=e=>{const t=e<.1?2:1;return v.x.Num.toLocaleFixed(e,t)};function pa(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=ua(a),d=ua(s),u=ua(i),p=ua(o),m=ua(l),h=r>=20&&t.statistics.opened>=5,f=(0,j.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,j.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[d,"% "]}),v.x.I18n.t("percentageOpened")]}),g=(0,j.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,j.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[u,"% "]}),v.x.I18n.t("percentageMachineOpened"),(0,j.jsx)(A.Tooltip,{tooltip:C()(v.x.I18n.t("percentageMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,j.jsx)("span",{style:{pointerEvents:"all"},children:(0,j.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")))})]}),x=(0,j.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,j.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[p,"% "]}),v.x.I18n.t("percentageUnsubscribed")]}),b=(0,j.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,j.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[m,"% "]}),v.x.I18n.t("percentageBounced")]}),y=(0,da.y)("clicked",a),w=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-statistics-value",children:[(0,j.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${y}`,children:[c,"% "]}),v.x.I18n.t("percentageClicked")]}),h&&(0,j.jsx)(da.$,{isInverted:!1,stat:"clicked",rate:a,tooltipId:`clicked-${t.id||"0"}`,tooltipPlace:"right"})]});return(0,j.jsxs)("div",{className:"mailpoet-stats-general",children:[(0,j.jsxs)(bt.r.ThreeColumns,{className:"mailpoet-stats-general-top-row",children:[(0,j.jsx)("div",{children:(0,j.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[v.x.I18n.t("statsTotalSent"),": ",(0,j.jsx)("span",{className:"mailpoet-statistics-value-number",children:r.toLocaleString()})]})}),(0,j.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:x}),(0,j.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:b})]}),(0,j.jsxs)(bt.r.ThreeColumns,{children:[(0,j.jsx)("div",{children:w}),(0,j.jsxs)("div",{className:"mailpoet-statistics-with-left-separator",children:[f,g]}),n&&(0,j.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:Ee.Hooks.applyFilters("mailpoet_newsletters_revenues_stats",null,t.statistics.revenue)}),!n&&(0,j.jsx)("div",{})]}),(0,j.jsx)("p",{className:"mailpoet-stats-general-read-more",children:(0,j.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:v.x.I18n.t("readMoreOnStats")})})]})}function ma(e){let{newsletter:t}=e;const n=t.queue.scheduled_at||t.queue.created_at;return(0,j.jsxs)(bt.r.ThreeColumns,{className:"mailpoet-stats-info",children:[(0,j.jsxs)("div",{className:"mailpoet-grid-span-two-columns",children:[(0,j.jsx)(fe.X,{level:1,children:t.subject}),(0,j.jsx)("div",{children:(0,j.jsxs)("b",{children:[v.x.Date.short(n)," • ",v.x.Date.time(n)]})}),Array.isArray(t.segments)&&t.segments.length&&(0,j.jsxs)("div",{children:[(0,j.jsx)("span",{className:"mailpoet-stats-info-key",children:v.x.I18n.t("statsToSegments")}),": ",(0,j.jsx)(g.Tags,{dimension:"large",segments:t.segments})]})]}),(0,j.jsxs)("div",{className:"mailpoet-stats-info-sender-preview",children:[(0,j.jsxs)("div",{children:[(0,j.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,j.jsxs)("span",{className:"mailpoet-stats-info-key",children:[v.x.I18n.t("statsFromAddress"),": "]}),t.sender_address?t.sender_address:"-"]}),(0,j.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,j.jsxs)("span",{className:"mailpoet-stats-info-key",children:[v.x.I18n.t("statsReplyToAddress"),": "]}),t.reply_to_address?t.reply_to_address:"-"]}),(0,j.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,j.jsxs)("span",{className:"mailpoet-stats-info-key",children:[v.x.I18n.t("googleAnalytics"),": "]}),t.ga_campaign?t.ga_campaign:"-"]})]}),(0,j.jsx)("div",{children:(0,j.jsx)(g.Button,{href:t.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("statsPreviewNewsletter")})})]})]})}function ha(){const e=(0,j.jsx)(O.z,{href:v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount,v.x.currentWpUserEmail,"starter",{utm_medium:"stats",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("premiumBannerCtaFree")}),t=(0,j.jsxs)("p",{children:[v.x.I18n.t("premiumBannerDescription")," ",(0,j.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",children:v.x.I18n.t("learnMore")}),"."]});return(0,j.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,j.jsx)(Oe.K,{title:v.x.I18n.t("premiumFeature"),message:t,actionButton:e})})}function fa(){if(!window.mailpoet_display_detailed_stats)return(0,j.jsx)(ha,{});if(window.mailpoet_subscribers_limit_reached){const e=window.mailpoet_has_valid_api_key,t=v.x.I18n.t("upgradeRequired"),n=v.x.I18n.t(e?"newsletterYourPlanLimit":"newsletterFreeVersionLimit").replace("[subscribersLimit]",window.mailpoet_subscribers_limit).replace("[subscribersCount]",window.mailpoet_subscribers_count),r=e?v.x.MailPoetComUrlFactory.getUpgradeUrl(v.x.pluginPartialKey):v.x.MailPoetComUrlFactory.getPurchasePlanUrl(window.mailpoet_subscribers_count+1);return(0,j.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,j.jsx)(Oe.K,{title:t,message:(0,j.jsx)("p",{children:n}),actionButton:(0,j.jsx)(O.z,{target:"_blank",rel:"noopener noreferrer",href:r,children:v.x.I18n.t("upgradeNow")})})})}return null}const ga=(0,c.withRouter)((function(e){let{match:t,history:n,location:r}=e;const[a,s]=(0,w.useState)({item:void 0,loading:!0}),i=(0,w.useCallback)((e=>{s({loading:!0,item:a.item}),v.x.Modal.loading(!0),v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:window.mailpoet_display_detailed_stats?"stats":"newsletters",action:window.mailpoet_display_detailed_stats?"get":"getWithStats",data:{id:e}}).always((()=>{v.x.Modal.loading(!1)})).done((e=>{s({loading:!1,item:e.data})})).fail((e=>{v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0}),s({loading:!1}),n.push("/")}))}),[n,a.item]);(0,w.useEffect)((()=>{var e;window.scrollTo(0,0),(null===(e=a.item)||void 0===e?void 0:e.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:null==c||!c.subject||null!=c&&c.queue?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(be.B,{}),(0,j.jsx)(oa,{}),(0,j.jsx)(F.Q,{}),(0,j.jsxs)("div",{className:"mailpoet-stats-page",children:[(0,j.jsx)(N,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,j.jsx)(ma,{newsletter:c}),(0,j.jsx)(pa,{newsletter:c,isWoocommerceActive:v.x.isWoocommerceActive}),(0,j.jsxs)(la.m,{activeKey:"clicked",children:[(0,j.jsx)(ca.O,{title:v.x.I18n.t("clickedLinks"),children:Ee.Hooks.applyFilters("mailpoet_newsletters_clicked_links_table",(0,j.jsx)(fa,{}),c.clicked_links)},"clicked"),Ee.Hooks.applyFilters("mailpoet_newsletters_purchased_products",null,c),(0,j.jsx)(ca.O,{title:v.x.I18n.t("subscriberEngagement"),children:Ee.Hooks.applyFilters("mailpoet_newsletters_subscriber_engagement",(0,j.jsx)(fa,{}),r,t.params,c)},"engagement"),(0,j.jsx)(ca.O,{title:v.x.I18n.t("bounces"),automationId:"bounces-tab",children:Ee.Hooks.applyFilters("mailpoet_newsletters_bounces",(0,j.jsx)(fa,{}),r,t.params)},"bounces")]})]})]}):(0,j.jsx)("div",{children:(0,j.jsx)(fe.X,{level:1,children:c.subject})})}));var xa=n(48228),va=n(97762),ba=n(87903),ya=n.n(ba);function wa(e){const t=e.installedDaysAgo,n=t>30?v.x.I18n.t("reviewRequestUsingForMonths").replace("[months]",Math.round(t/30)):v.x.I18n.t("reviewRequestUsingForDays").replace("[days]",t);return(0,j.jsxs)("div",{className:"mailpoet_review_request",children:[(0,j.jsx)("img",{src:e.reviewRequestIllustrationUrl,height:"280",width:"280",alt:""}),(0,j.jsx)("h2",{children:v.x.I18n.t("reviewRequestHeading")}),(0,j.jsx)("p",{children:v.x.I18n.t("reviewRequestDidYouKnow").replace("[username]",e.username)}),(0,j.jsx)("p",{children:n}),(0,j.jsx)("p",{children:(0,j.jsx)("a",{href:"http://bit.ly/2Bi124o",target:"_blank",rel:"noopener noreferrer",className:"button button-primary",children:v.x.I18n.t("reviewRequestRateUsNow")})}),(0,j.jsx)("p",{children:(0,j.jsx)("a",{id:"mailpoet_review_request_not_now",children:v.x.I18n.t("reviewRequestNotNow")})})]})}wa.propTypes={installedDaysAgo:f().number.isRequired,reviewRequestIllustrationUrl:f().string.isRequired,username:f().string.isRequired};let _a=null;const ja=()=>((0,w.useLayoutEffect)((()=>{window.mailpoet_display_nps_poll&&v.x.libs3rdPartyEnabled&&(_a||(_a=v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"analytics",action:"getTrackingData"})),_a).then((e=>{let{data:t}=e;return(e=>{let t;t=window.mailpoet_display_nps_form?"EqOgKsgZd832Sz9w":window.mailpoet_is_new_user?"6L479eVPXk7pBn6S":"k0aJAsQAWI2ERyGv",ya()({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&&v.x.Modal.popup({width:800,template:va.renderToString(wa({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",(()=>v.x.Modal.close()))}})}}})})(t)}))}),[]),null),Ia=e=>function(t){return ja(),(0,j.jsx)(e,{...t})};function Sa(){return(0,j.jsx)(F.Q,{children:(0,j.jsxs)(l.rU,{id:"mailpoet-new-email",className:"mailpoet-button button-secondary",to:"/new",onClick:()=>v.x.trackEvent("Emails > Add New"),"data-automation-id":"new_email",children:[q,(0,j.jsx)("span",{children:v.x.I18n.t("new")})]})})}const Ca=(0,c.withRouter)((function(e){let{children:t,location:n}=e;return null!==(0,ct.X)(n)||(e=>e.hash.match(/^#\/new/)||e.pathname.match(/^\/new/))(n)?null:t}));function Ta(e){let{mailpoetInstalledDaysAgo:t,sendTransactionalEmails:n,mtaMethod:r,noticeDismissed:a,apiVersion:s}=e;const[i,o]=(0,w.useState)(!1),l=()=>{v.x.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,j.jsxs)(T.q,{type:"success",timeout:!1,onClose:l,children:[(0,j.jsx)("h3",{children:v.x.I18n.t("transactionalEmailNoticeTitle")}),(0,j.jsxs)("p",{children:[v.x.I18n.t("transactionalEmailNoticeBody")," ",(0,j.jsx)("a",{href:"https://kb.mailpoet.com/article/292-choose-how-to-send-your-wordpress-websites-emails",target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("transactionalEmailNoticeBodyReadMore")})]}),(0,j.jsx)("p",{children:(0,j.jsx)("button",{type:"button",className:"button",onClick:()=>{o(!0),v.x.Ajax.post({api_version:s,endpoint:"settings",action:"set",data:{send_transactional_emails:"1"}}),l()},children:v.x.I18n.t("transactionalEmailNoticeCTA")})})]})}const ka=window.mailpoet_woocommerce_automatic_emails||[],Na=Ia((()=>{const{parentId:e}=(0,c.useParams)();return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ca,{children:(0,j.jsx)(Sa,{})}),(0,j.jsxs)(xa.t,{activeKey:"standard",routerType:"switch-only",onSwitch:e=>(e=>v.x.trackEvent(`Tab Emails > ${e} clicked`))(e),automationId:"newsletters_listing_tabs",children:[(0,j.jsx)(ca.O,{route:"standard/(.*)?",title:v.x.I18n.t("tabStandardTitle"),automationId:`tab-${v.x.I18n.t("tabStandardTitle")}`,children:(0,j.jsx)(_r,{})},"standard"),(0,j.jsx)(ca.O,{route:"welcome/(.*)?",title:v.x.I18n.t("tabWelcomeTitle"),automationId:`tab-${v.x.I18n.t("tabWelcomeTitle")}`,children:(0,j.jsx)(Er,{})},"welcome"),(0,j.jsx)(ca.O,{route:"notification/(.*)?",title:v.x.I18n.t("tabNotificationTitle"),automationId:`tab-${v.x.I18n.t("tabNotificationTitle")}`,children:e?(0,j.jsx)(Xr,{parentId:e}):(0,j.jsx)(Lr,{})},"notification"),(0,j.jsx)(ca.O,{route:"re_engagement/(.*)?",title:v.x.I18n.t("tabReEngagementTitle"),automationId:`tab-${v.x.I18n.t("tabReEngagementTitle")}`,children:(0,j.jsx)(Wr,{})},"re_engagement"),window.mailpoet_woocommerce_active&&_.ZP.map(ka,(e=>(0,j.jsx)(ca.O,{route:`${e.slug}/(.*)?`,title:e.title,automationId:`tab-${e.title}`,children:(0,j.jsx)(ot,{})},e.slug)))]})]})}));function Da(e){let{history:t}=e;return(0,j.jsx)(Ke,{history:t,hideClosingButton:0===window.mailpoet_newsletters_count})}Da.propTypes={history:f().shape({push:f().func.isRequired}).isRequired};const Ea=[...(()=>{const e=[];return _.ZP.each(ka,(t=>{e.push({path:`/${t.slug}/(.*)?`,component:Na});const{events:n}=t;_.ZP.isObject(n)&&_.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,j.jsx)(or,{...r})}})})),e.push({path:`/new/${t.slug}`,render:e=>{const n={...e,email:t};return(0,j.jsx)(Ve,{...n})}})})),e})(),{path:"/notification/history/:parentId/(.*)?",component:Na},{path:"/(standard|welcome|notification|re_engagement)/(.*)?",component:Na},{path:"/new/standard",component:tr},{path:"/new/notification",component:ar},{path:"/new/welcome",component:ir},{path:"/new/re-engagement",component:function(){let e="";v.x.settings.deactivate_subscriber_after_inactive_days&&(e=(Math.floor(Number(v.x.settings.deactivate_subscriber_after_inactive_days)/30)-1).toString());const[t,n]=(0,w.useState)({afterTimeNumber:e,afterTimeType:"months"}),[r,a]=(0,w.useState)([]),[s,i]=(0,w.useState)(!1),o=(0,c.useHistory)();return(0,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),r&&(0,j.jsx)(Be,{errors:r}),(0,j.jsx)(dt,{emailType:"re_engagement",automationId:"re_engagement_heading_creation_heading"}),(0,j.jsxs)(bt.r.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,j.jsx)(kn,{afterTimeNumber:t.afterTimeNumber,afterTimeType:t.afterTimeType,inactiveSubscribersPeriod:Number(v.x.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:(0,Cn.compose)([n,(0,Cn.assoc)("afterTimeNumber",Cn.__,t)]),updateAfterTimeType:(0,Cn.compose)([n,(0,Cn.assoc)("afterTimeType",Cn.__,t)])}),(0,j.jsx)(O.z,{isFullWidth:!0,onClick:()=>(a([]),i(!0),void v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"newsletters",action:"create",data:{type:"re_engagement",subject:v.x.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:v.x.I18n.t("next")})]})]})}},{path:"/new",component:Da},{name:"template",path:"/template/:id",component:gt},{path:"/send/congratulate/:id",component:Jn},{path:"/send/:id",component:Mn},{path:"/sending-status/:id/(.*)?",component:ta},{path:"/stats/:id/(.*)?",component:ga}];function Oa(){return(0,j.jsx)(Ce.k.Provider,{value:(0,Ce.S)(window),children:(0,j.jsxs)(l.UT,{children:[(0,j.jsx)(Me.w,{}),(0,j.jsx)(k,{}),(0,j.jsx)(E,{}),(0,j.jsx)(Ta,{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,j.jsx)(N,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,j.jsxs)(c.Switch,{children:[(0,j.jsx)(c.Route,{exact:!0,path:"/",render:()=>(0,j.jsx)(c.Redirect,{to:0===window.mailpoet_newsletters_count?"/new":"/standard"})}),Ea.map((e=>(0,j.jsx)(c.Route,{path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render},e.path)))]})]})})}const Ra=document.getElementById("newsletters_container");Ra&&(window.mailpoet_listing=o().render((0,j.jsx)(Oa,{}),Ra));const Aa=e=>"wp_users"===e.type,Pa=e=>"woocommerce_users"===e.type,Ma=e=>Aa(e)||Pa(e),La=v.x.trackingConfig.emailTrackingEnabled,Fa=[{name:"name",label:v.x.I18n.t("name"),sortable:!0},{name:"description",label:v.x.I18n.t("description")},{name:"average_subscriber_score",label:v.x.I18n.t("listScore"),display:La},{name:"subscribed",label:v.x.I18n.t("subscribed"),className:"mailpoet-listing-column-narrow"},{name:"unconfirmed",label:v.x.I18n.t("unconfirmed"),className:"mailpoet-listing-column-narrow"},{name:"unsubscribed",label:v.x.I18n.t("unsubscribed"),className:"mailpoet-listing-column-narrow"},{name:"inactive",label:v.x.I18n.t("inactive"),className:"mailpoet-listing-column-narrow"},{name:"bounced",label:v.x.I18n.t("bounced"),className:"mailpoet-listing-column-narrow"},{name:"created_at",label:v.x.I18n.t("createdOn"),sortable:!0}],qa={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneSegmentTrashed"):v.x.I18n.t("multipleSegmentsTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneSegmentDeleted"):v.x.I18n.t("multipleSegmentsDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneSegmentRestored"):v.x.I18n.t("multipleSegmentsRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},$a=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:qa.onTrash}],Ua=e=>!Ma(e),Za=[{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return(0,j.jsx)(l.rU,{to:`/edit/${e.id}`,children:v.x.I18n.t("edit")})},display:function(e){return!Ma(e)}},{name:"duplicate_segment",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:(e,t)=>v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"duplicate",data:{id:e.id}}).done((e=>{v.x.Notice.success(v.x.I18n.t("listDuplicated").replace("%1$s",e.data.name)),t()})).fail((e=>{v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),display:function(e){return!Ma(e)}},{name:"read_more",className:"mailpoet-hide-on-mobile",link:function(){return(0,j.jsx)("a",{href:"https://kb.mailpoet.com/article/133-the-wordpress-users-list",target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("readMore")})},display:function(e){return Aa(e)}},{name:"synchronize_segment",label:v.x.I18n.t("forceSync"),onClick:function(e,t){v.x.Modal.loading(!0),v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"synchronize",data:{type:e.type}}).done((()=>{let n=v.x.I18n.t("listSynchronized").replace("%1$s",e.name);"woocommerce_users"===e.type&&(n=v.x.I18n.t("listSynchronizationWasScheduled").replace("%1$s",e.name)),v.x.Modal.loading(!1),v.x.Notice.success(n),t()})).fail((e=>{v.x.Modal.loading(!1),e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},display:function(e){return Aa(e)||Pa(e)}},{name:"view_subscribers",link:function(e){return(0,j.jsx)("a",{href:e.subscribers_url,"data-automation-id":`view_subscribers_${e.name}`,children:v.x.I18n.t("viewSubscribers")})}},{name:"trash",className:"mailpoet-hide-on-mobile",display:function(e){return!Pa(e)}}];class Va extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"renderItem",((e,t)=>{const n=u()("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=Ma(e)?(0,j.jsx)("span",{className:"mailpoet-listing-title",children:e.name}):(0,j.jsx)(l.rU,{className:"mailpoet-listing-title",to:`/edit/${e.id}`,children:e.name}),(0,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:n,"data-automation-id":`segment_name_${e.name}`,children:[c,t]}),(0,j.jsx)("td",{"data-colname":v.x.I18n.t("description"),children:(0,j.jsx)("abbr",{children:e.description})}),La?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("averageScore"),children:(0,j.jsx)("div",{className:"mailpoet-listing-stats",children:(0,j.jsx)(L,{id:e.id,engagementScore:e.average_engagement_score})})}):null,(0,j.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("subscribed"),children:(0,j.jsx)("abbr",{children:r.toLocaleString()})}),(0,j.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("unconfirmed"),children:(0,j.jsx)("abbr",{children:a.toLocaleString()})}),(0,j.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("unsubscribed"),children:(0,j.jsx)("abbr",{children:s.toLocaleString()})}),(0,j.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("inactive"),children:(0,j.jsx)("abbr",{children:i.toLocaleString()})}),(0,j.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("bounced"),children:(0,j.jsx)("abbr",{children:o.toLocaleString()})}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("createdOn"),children:[v.x.Date.short(e.created_at),(0,j.jsx)("br",{}),v.x.Date.time(e.created_at)]})]})}))}render(){return(0,j.jsx)("div",{className:"mailpoet-segments-listing",children:(0,j.jsx)(x.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:qa,search:!1,endpoint:"segments",base_url:"lists",onRenderItem:this.renderItem,columns:Fa,bulk_actions:$a,item_actions:Za,sort_by:"name",sort_order:"asc",isItemDeletable:Ua,isItemToggleable:Aa})})}}Va.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const Wa=(0,c.withRouter)(Va),Ya=[{name:"name",label:v.x.I18n.t("name"),type:"text"},{name:"description",label:v.x.I18n.t("description"),type:"textarea",tip:v.x.I18n.t("segmentDescriptionTip")}],Ba={onUpdate:function(){v.x.Notice.success(v.x.I18n.t("segmentUpdated"))},onCreate:function(){v.x.Notice.success(v.x.I18n.t("segmentAdded")),v.x.trackEvent("Lists > Add new")}};function Ha(e){return(0,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(be.B,{}),(0,j.jsxs)(fe.X,{level:1,className:"mailpoet-title",children:[(0,j.jsx)("span",{children:v.x.I18n.t("segment")}),(0,j.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:"/",children:v.x.I18n.t("backToList")})]}),(0,j.jsx)(k,{}),(0,j.jsx)(ve,{endpoint:"segments",fields:Ya,params:e.match.params,messages:Ba})]})}Ha.propTypes={match:f().shape({params:f().shape({id:f().string}).isRequired}).isRequired};var za=n(41882),Ka=n(94878),Ga=n(1030),Qa=n(96486),Xa=n.n(Qa),Ja=n(66067);function es(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form"),s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),i=null==s?void 0:s.map((e=>{const t=e.sent_at?v.x.Date.format(e.sent_at):v.x.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}}));return(0,w.useEffect)((()=>{n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t),n.action===Ja.EmailActionTypes.MACHINE_OPENED&&n.operator===Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t)}),[n.action,n.operator,t,r]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{isFullWidth:!0,value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),n.action!==Ja.EmailActionTypes.MACHINE_OPENED?(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")}):null]},"select")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:v.x.I18n.t("selectNewsletterPlaceholder"),options:i,automationId:"segment-email",value:(0,Cn.filter)((e=>{if(!n.newsletters)return;const t=e.value;return-1!==n.newsletters.indexOf(t)}),i),onChange:e=>{r({newsletters:(0,Cn.map)("value",e)},t)}})})]})}const ts=e=>!!e;function ns(e){return v.x.I18n.t("emailActionOpensDaysSentence").split(/({days})/gim).map(e)}function rs(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form");return(0,w.useEffect)((()=>{void 0===n.operator&&r({operator:"more"},t)}),[r,n,t]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(s=e=>"{condition}"===e?(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,j.jsx)("option",{value:"more",children:v.x.I18n.t("moreThan")}),(0,j.jsx)("option",{value:"less",children:v.x.I18n.t("lessThan")}),(0,j.jsx)("option",{value:"equals",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"not_equals",children:v.x.I18n.t("notEquals")})]},"select"):"{opens}"===e?(0,j.jsx)(te.I,{type:"number",value:n.opens||"","data-automation-id":"segment-number-of-opens",onChange:e=>{a("opens",t,e)},min:"0",placeholder:v.x.I18n.t("emailActionOpens")},"input"):"string"==typeof e&&e.trim().length>1?(0,j.jsx)("div",{children:e},"opens"):null,v.x.I18n.t("emailActionOpensSentence").split(/({condition})|({opens})|(\b[a-zA-Z]+\b)/gim).map(s))}),(0,j.jsx)(bt.r.CenteredRow,{children:ns((e=>"{days}"===e?(0,j.jsx)(te.I,{type:"number",value:n.days||"","data-automation-id":"segment-number-of-days",onChange:e=>{a("days",t,e)},min:"0",placeholder:v.x.I18n.t("emailActionDays")},"input"):"string"==typeof e&&e.trim().length>1?(0,j.jsx)("div",{children:e},e):null))})]});var s}const as=[{value:Ja.EmailActionTypes.OPENS_ABSOLUTE_COUNT,label:v.x.I18n.t("emailActionOpensAbsoluteCount"),group:Ja.SegmentTypes.Email},{value:Ja.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT,label:v.x.I18n.t("emailActionMachineOpensAbsoluteCount"),group:Ja.SegmentTypes.Email},{value:Ja.EmailActionTypes.OPENED,label:v.x.I18n.t("emailActionOpened"),group:Ja.SegmentTypes.Email},{value:Ja.EmailActionTypes.MACHINE_OPENED,label:v.x.I18n.t("emailActionMachineOpened"),group:Ja.SegmentTypes.Email},{value:Ja.EmailActionTypes.CLICKED,label:v.x.I18n.t("emailActionClicked"),group:Ja.SegmentTypes.Email},{value:Ja.EmailActionTypes.CLICKED_ANY,label:v.x.I18n.t("emailActionClickedAnyEmail"),group:Ja.SegmentTypes.Email}],ss={[Ja.EmailActionTypes.OPENS_ABSOLUTE_COUNT]:rs,[Ja.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT]:rs,[Ja.EmailActionTypes.CLICKED]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form"),s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),[i,o]=(0,w.useState)([]),[l,c]=(0,w.useState)([]),[d,u]=(0,w.useState)(!1),p=null==s?void 0:s.map((e=>{const t=e.sent_at?v.x.Date.format(e.sent_at):v.x.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}})),m=(0,w.useCallback)((()=>{var e;ts(n.newsletter_id)&&(c([]),e=n.newsletter_id,o([]),u(!0),v.x.Ajax.post({api_version:v.x.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,w.useEffect)((()=>{m()}),[m,n.newsletter_id]),(0,w.useEffect)((()=>{n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t)}),[n.operator,t,r]),(0,j.jsxs)(j.Fragment,{children:[i.length>0&&(0,j.jsx)(Be,{errors:i}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,placeholder:v.x.I18n.t("selectNewsletterPlaceholder"),options:p,value:(0,Cn.find)(["value",n.newsletter_id],p),onChange:e=>{r({newsletter_id:e.value,link_ids:[]},t)},automationId:"segment-email"})}),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{isMinWidth:!0,value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select-operator"),d&&(0,j.jsx)("span",{children:v.x.I18n.t("loadingDynamicSegmentItems")}),!d&&ts(n.newsletter_id)&&(0,j.jsx)(Ga.J,{isMulti:!0,dimension:"small",isFullWidth:!0,automationId:"segment-link-select",placeholder:v.x.I18n.t("allLinksPlaceholder"),options:l.length?l:[{value:0,label:v.x.I18n.t("noLinksHint"),isDisabled:!0}],value:(0,Cn.filter)((e=>!!n.link_ids&&-1!==n.link_ids.indexOf(e.value)),l),onChange:e=>{r({link_ids:(e||[]).map((e=>e.value))},t)}})]})]})},[Ja.EmailActionTypes.OPENED]:es,[Ja.EmailActionTypes.MACHINE_OPENED]:es,[Ja.EmailActionTypes.CLICKED_ANY]:null};var is;!function(e){e.NUMBER_OF_ORDERS="numberOfOrders",e.PURCHASED_CATEGORY="purchasedCategory",e.PURCHASED_PRODUCT="purchasedProduct",e.TOTAL_SPENT="totalSpent",e.CUSTOMER_IN_COUNTRY="customerInCountry"}(is||(is={}));const os=[{value:is.CUSTOMER_IN_COUNTRY,label:v.x.I18n.t("wooCustomerInCountry"),group:Ja.SegmentTypes.WooCommerce},{value:is.NUMBER_OF_ORDERS,label:v.x.I18n.t("wooNumberOfOrders"),group:Ja.SegmentTypes.WooCommerce},{value:is.PURCHASED_CATEGORY,label:v.x.I18n.t("wooPurchasedCategory"),group:Ja.SegmentTypes.WooCommerce},{value:is.PURCHASED_PRODUCT,label:v.x.I18n.t("wooPurchasedProduct"),group:Ja.SegmentTypes.WooCommerce},{value:is.TOTAL_SPENT,label:v.x.I18n.t("wooTotalSpent"),group:Ja.SegmentTypes.WooCommerce}],ls=[is.PURCHASED_PRODUCT,is.PURCHASED_CATEGORY];function cs(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form");(0,w.useEffect)((()=>{n.action===Ja.SubscriberActionTypes.WORDPRESS_ROLE&&n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t)}),[r,n,t]);const s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getWordpressRoles()),[]).map((e=>({value:e.role_id,label:e.role_name})));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{isFullWidth:!0,value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,isMulti:!0,automationId:"segment-wordpress-role",placeholder:v.x.I18n.t("selectUserRolePlaceholder"),options:s,value:(0,Cn.filter)((e=>{if(n.wordpressRole)return-1!==n.wordpressRole.indexOf(e.value)}),s),onChange:e=>{r({wordpressRole:(0,Cn.map)("value",e)},t)}})})]})}let ds;!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"}(ds||(ds={}));const us=[ds.HIGHER_THAN,ds.LOWER_THAN,ds.EQUALS,ds.NOT_EQUALS,ds.UNKNOWN,ds.NOT_UNKNOWN];var ps=n(23855),ms=n(12274);let hs;!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"}(hs||(hs={}));const fs=[hs.BEFORE,hs.AFTER,hs.ON,hs.NOT_ON,hs.IN_THE_LAST,hs.NOT_IN_THE_LAST],gs=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return v.x.Date.format(e,{format:"Y-m-d"})}},xs=e=>{const t=(0,ps.default)(e);if((0,ms.default)(t))return t};function vs(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 bs(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:r,updateSegmentFilter:a}=(0,za.Z)("mailpoet-dynamic-segments-form");return(0,w.useEffect)((()=>{void 0===n.operator&&a({operator:"equals",value:""},t)}),[a,n,t]),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{automationId:"text-custom-field-operator",value:n.operator,onChange:e=>{r("operator",t,e)},children:[(0,j.jsx)("option",{value:"equals",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"not_equals",children:v.x.I18n.t("notEquals")}),(0,j.jsx)("option",{value:"contains",children:v.x.I18n.t("contains")}),(0,j.jsx)("option",{value:"more_than",children:v.x.I18n.t("moreThan")}),(0,j.jsx)("option",{value:"less_than",children:v.x.I18n.t("lessThan")})]},"select"),(0,j.jsx)(te.I,{"data-automation-id":"text-custom-field-value",value:n.value||"",onChange:e=>{r("value",t,e)},placeholder:v.x.I18n.t("value")},"input")]})}function ys(e){return"string"==typeof e.value&&e.value.length>0}function ws(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r}=(0,za.Z)("mailpoet-dynamic-segments-form"),a=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),s=(0,Cn.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,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,placeholder:v.x.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 _s=n(95570),js=n(49546);const Is=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return(0,js.default)(e,"yyyy-MM-dd 00:00:00")}},Ss=e=>{const t=(0,ps.default)(e);if((0,ms.default)(t))return t},Cs={month:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,w.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Cn.assign)(n,{value:"2017-01-01 00:00:00"}),r)}),[t,n,r]),(0,j.jsxs)(se.P,{value:n.value,onChange:e=>{t((0,Cn.assign)(n,{value:e.target.value}),r)},children:[(0,j.jsx)("option",{value:"2017-01-01 00:00:00",children:v.x.I18n.t("january")}),(0,j.jsx)("option",{value:"2017-02-01 00:00:00",children:v.x.I18n.t("february")}),(0,j.jsx)("option",{value:"2017-03-01 00:00:00",children:v.x.I18n.t("march")}),(0,j.jsx)("option",{value:"2017-04-01 00:00:00",children:v.x.I18n.t("april")}),(0,j.jsx)("option",{value:"2017-05-01 00:00:00",children:v.x.I18n.t("may")}),(0,j.jsx)("option",{value:"2017-06-01 00:00:00",children:v.x.I18n.t("june")}),(0,j.jsx)("option",{value:"2017-07-01 00:00:00",children:v.x.I18n.t("july")}),(0,j.jsx)("option",{value:"2017-08-01 00:00:00",children:v.x.I18n.t("august")}),(0,j.jsx)("option",{value:"2017-09-01 00:00:00",children:v.x.I18n.t("september")}),(0,j.jsx)("option",{value:"2017-10-01 00:00:00",children:v.x.I18n.t("october")}),(0,j.jsx)("option",{value:"2017-11-01 00:00:00",children:v.x.I18n.t("november")}),(0,j.jsx)("option",{value:"2017-12-01 00:00:00",children:v.x.I18n.t("december")})]},"select")},year:function(e){let{onChange:t,item:n,filterIndex:r}=e;const a=(0,_s.default)(new Date);return(0,w.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Cn.assign)(n,{value:`${a}-01-01 00:00:00`,operator:"equals"}),r)}),[a,t,n,r]),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>{t((0,Cn.assign)(n,{operator:e.target.value}),r)},children:[(0,j.jsx)("option",{value:"equals",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"before",children:v.x.I18n.t("before")}),(0,j.jsx)("option",{value:"after",children:v.x.I18n.t("after")})]},"select-operator"),(0,j.jsx)(se.P,{value:n.value,onChange:e=>{t((0,Cn.assign)(n,{value:e.target.value}),r)},children:(0,Cn.range)(0,100).map((e=>(0,j.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,w.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Cn.assign)(n,{value:`${(0,js.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),r)}),[t,n,r]),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>{t((0,Cn.assign)(n,{operator:e.target.value}),r)},children:[(0,j.jsx)("option",{value:"equals",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"before",children:v.x.I18n.t("before")}),(0,j.jsx)("option",{value:"after",children:v.x.I18n.t("after")})]},"select-operator"),(0,j.jsx)(St,{onChange:e=>t((0,Cn.assign)(n,{value:Is(e)}),r),selected:n.value?Ss(n.value):void 0,dateFormat:"MM/yyyy",showMonthYearPicker:!0})]})},year_month_day:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,w.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Cn.assign)(n,{value:`${(0,js.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),r)}),[t,n,r]),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>{t((0,Cn.assign)(n,{operator:e.target.value}),r)},children:[(0,j.jsx)("option",{value:"equals",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"before",children:v.x.I18n.t("before")}),(0,j.jsx)("option",{value:"after",children:v.x.I18n.t("after")})]},"select-operator"),(0,j.jsx)(St,{dateFormat:"MMM d, yyyy",onChange:e=>t((0,Cn.assign)(n,{value:Is(e)}),r),selected:n.value?Ss(n.value):void 0})]})}};var Ts;!function(e){e.DATE="date",e.TEXT="text",e.TEXTAREA="textarea",e.RADIO="radio",e.CHECKBOX="checkbox",e.SELECT="select"}(Ts||(Ts={}));const ks={[Ts.TEXT]:vs,[Ts.TEXTAREA]:vs,[Ts.RADIO]:ys,[Ts.SELECT]:ys,[Ts.CHECKBOX]:function(e){return"1"===e.value||"0"===e.value},[Ts.DATE]:function(e){return("month"===e.date_type||!("string"!=typeof e.operator||e.operator.length<1))&&"string"==typeof e.value&&e.value.length>1}},Ns={[Ts.TEXT]:bs,[Ts.TEXTAREA]:bs,[Ts.RADIO]:ws,[Ts.SELECT]:ws,[Ts.CHECKBOX]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:r,updateSegmentFilter:a}=(0,za.Z)("mailpoet-dynamic-segments-form");return(0,w.useEffect)((()=>{"1"!==n.value&&"0"!==n.value&&a({operator:"equals",value:"1"},t)}),[a,n,t]),(0,j.jsxs)(se.P,{value:n.value,onChange:e=>r("value",t,e),children:[(0,j.jsx)("option",{value:"1",children:v.x.I18n.t("checked")}),(0,j.jsx)("option",{value:"0",children:v.x.I18n.t("unchecked")})]},"select")},[Ts.DATE]:function(e){let{customField:t,filterIndex:n}=e;const r=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(n)),[n]),{updateSegmentFilter:a}=(0,za.Z)("mailpoet-dynamic-segments-form");(0,w.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=Cs[t.params.date_type];return s?(0,j.jsx)(s,{item:r,onChange:a,filterIndex:n}):null}},Ds=[{value:Ja.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD,label:v.x.I18n.t("mailpoetCustomField"),group:Ja.SegmentTypes.WordPressRole},{value:Ja.SubscriberActionTypes.SUBSCRIBER_SCORE,label:v.x.I18n.t("subscriberScore"),group:Ja.SegmentTypes.WordPressRole},{value:Ja.SubscriberActionTypes.SUBSCRIBED_DATE,label:v.x.I18n.t("subscribedDate"),group:Ja.SegmentTypes.WordPressRole},{value:Ja.SubscriberActionTypes.SUBSCRIBED_TO_LIST,label:v.x.I18n.t("subscribedToList"),group:Ja.SegmentTypes.WordPressRole},{value:Ja.SubscriberActionTypes.WORDPRESS_ROLE,label:v.x.I18n.t("segmentsSubscriber"),group:Ja.SegmentTypes.WordPressRole}],Es={[Ja.SubscriberActionTypes.WORDPRESS_ROLE]:cs,[Ja.SubscriberActionTypes.SUBSCRIBER_SCORE]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form");return(0,w.useEffect)((()=>{us.includes(n.operator)||r({operator:ds.HIGHER_THAN},t),n.operator!==ds.HIGHER_THAN&&n.operator!==ds.LOWER_THAN&&n.operator!==ds.EQUALS&&n.operator!==ds.NOT_EQUALS||void 0!==n.value||r({value:""},t),n.operator!==ds.UNKNOWN&&n.operator!==ds.NOT_UNKNOWN||r({value:null},t)}),[r,n,t]),(0,j.jsx)(bt.r.CenteredRow,{children:(s=e=>"{condition}"===e?(0,j.jsxs)(se.P,{value:n.operator,automationId:"segment-subscriber-score-operator",onChange:e=>{a("operator",t,e)},children:[(0,j.jsx)("option",{value:ds.HIGHER_THAN,children:v.x.I18n.t("higherThan")}),(0,j.jsx)("option",{value:ds.LOWER_THAN,children:v.x.I18n.t("lowerThan")}),(0,j.jsx)("option",{value:ds.EQUALS,children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:ds.NOT_EQUALS,children:v.x.I18n.t("notEquals")}),(0,j.jsx)("option",{value:ds.UNKNOWN,children:v.x.I18n.t("unknown")}),(0,j.jsx)("option",{value:ds.NOT_UNKNOWN,children:v.x.I18n.t("notUnknown")})]},"select"):"{score}"===e?(n.operator===ds.HIGHER_THAN||n.operator===ds.LOWER_THAN||n.operator===ds.EQUALS||n.operator===ds.NOT_EQUALS)&&(0,j.jsx)(te.I,{type:"number",value:n.value||"","data-automation-id":"segment-subscriber-score-value",onChange:e=>{a("value",t,e)},min:"0",placeholder:v.x.I18n.t("subscriberScorePlaceholder")},"input"):"string"==typeof e&&e.trim().length>0?n.operator!==ds.UNKNOWN&&n.operator!==ds.NOT_UNKNOWN&&(0,j.jsx)("div",{children:e},"score"):null,v.x.I18n.t("subscriberScoreSentence").split(/({condition})|({score})|(\b%\b)/gim).map(s))});var s},[Ja.SubscriberActionTypes.SUBSCRIBED_DATE]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form");return(0,w.useEffect)((()=>{fs.includes(n.operator)||r({operator:hs.BEFORE},t),n.operator!==hs.BEFORE&&n.operator!==hs.AFTER&&n.operator!==hs.ON&&n.operator!==hs.NOT_ON||void 0!==xs(n.value)&&/^\d+-\d+-\d+$/.test(n.value)||r({value:gs(new Date)},t),n.operator!==hs.IN_THE_LAST&&n.operator!==hs.NOT_IN_THE_LAST||"string"!=typeof n.value||/^\d*$/.exec(n.value)||r({value:""},t)}),[r,n,t]),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,j.jsx)("option",{value:hs.BEFORE,children:v.x.I18n.t("before")}),(0,j.jsx)("option",{value:hs.AFTER,children:v.x.I18n.t("after")}),(0,j.jsx)("option",{value:hs.ON,children:v.x.I18n.t("on")}),(0,j.jsx)("option",{value:hs.NOT_ON,children:v.x.I18n.t("notOn")}),(0,j.jsx)("option",{value:hs.IN_THE_LAST,children:v.x.I18n.t("inTheLast")}),(0,j.jsx)("option",{value:hs.NOT_IN_THE_LAST,children:v.x.I18n.t("notInTheLast")})]},"select"),(n.operator===hs.BEFORE||n.operator===hs.AFTER||n.operator===hs.ON||n.operator===hs.NOT_ON)&&(0,j.jsx)(St,{dateFormat:"MMM d, yyyy",onChange:e=>{r({value:gs(e)},t)},selected:n.value?xs(n.value):void 0}),(n.operator===hs.IN_THE_LAST||n.operator===hs.NOT_IN_THE_LAST)&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(te.I,{type:"number",value:n.value,onChange:e=>{a("value",t,e)},min:"1",placeholder:v.x.I18n.t("daysPlaceholder")},"input"),(0,j.jsx)("span",{children:v.x.I18n.t("daysPlaceholder")})]})]})},[Ja.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r}=(0,za.Z)("mailpoet-dynamic-segments-form"),a=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),s=(0,Cn.find)({id:Number(n.custom_field_id)},a),i=a.map((e=>({value:e.id.toString(),label:e.name}))),o=Ns[n.custom_field_type];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{children:(0,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,placeholder:v.x.I18n.t("selectCustomFieldPlaceholder"),options:i,automationId:"select-custom-field",value:(0,Cn.find)((e=>{if(n.custom_field_id)return n.custom_field_id===e.value}),i),onChange:e=>{const n=(0,Cn.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,j.jsx)("div",{children:o&&(0,j.jsx)(o,{customField:s,filterIndex:t})})]})},[Ja.SubscriberActionTypes.SUBSCRIBED_TO_LIST]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),r=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getStaticSegmentsList()),[]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:s}=(0,za.Z)("mailpoet-dynamic-segments-form");(0,w.useEffect)((()=>{n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.NONE&&a({operator:Ja.AnyValueTypes.ANY},t)}),[a,n,t]);const i=r.map((e=>({value:e.id,label:e.name})));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{isFullWidth:!0,value:n.operator,onChange:e=>{s("operator",t,e)},children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:v.x.I18n.t("searchLists"),options:i,value:(0,Cn.filter)((e=>{if(!n.segments)return;const t=e.value;return-1!==n.segments.indexOf(t)}),i),onChange:e=>{a({segments:(0,Cn.map)("value",e)},t)}})})]})}};var Os;!function(e){e.MEMBER_OF="isMemberOf"}(Os||(Os={}));const Rs=[{value:Os.MEMBER_OF,label:v.x.I18n.t("segmentsActiveMembership"),group:Ja.SegmentTypes.WooCommerceMembership}];var As;!function(e){e.ACTIVE_SUBSCRIPTIONS="hasActiveSubscription"}(As||(As={}));const Ps=[{value:As.ACTIVE_SUBSCRIPTIONS,label:v.x.I18n.t("segmentsActiveSubscription"),group:Ja.SegmentTypes.WooCommerceSubscription}],Ms={[Ja.SegmentTypes.Email]:function(e){return!!Object.values(Ja.EmailActionTypes).some((t=>t===e.action))&&(e.action===Ja.EmailActionTypes.CLICKED_ANY||(e.action===Ja.EmailActionTypes.CLICKED?!!e.newsletter_id:e.action!==Ja.EmailActionTypes.OPENS_ABSOLUTE_COUNT&&e.action!==Ja.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT?Array.isArray(e.newsletters)&&e.newsletters.length>0:!!e.days&&!!e.opens&&!!e.operator))},[Ja.SegmentTypes.WooCommerce]:function(e){if(!Object.values(is).some((t=>t===e.action)))return!1;const t=void 0===e.category_ids||0===e.category_ids.length||!e.operator;if(e.action===is.PURCHASED_CATEGORY&&t)return!1;const n=void 0===e.product_ids||0===e.product_ids.length||!e.operator;if(e.action===is.PURCHASED_PRODUCT&&n)return!1;const r=void 0===e.country_code||0===e.country_code.length;if(e.action===is.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===is.NUMBER_OF_ORDERS&&a||!(e.action!==is.TOTAL_SPENT||e.total_spent_amount&&e.total_spent_days&&e.total_spent_type))},[Ja.SegmentTypes.WordPressRole]:function(e){return e.action&&e.action!==Ja.SubscriberActionTypes.WORDPRESS_ROLE?e.action===Ja.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD?function(e){const t=ks[e.custom_field_type];return!!t&&t(e)}(e):e.action===Ja.SubscriberActionTypes.SUBSCRIBER_SCORE?function(e){if(e.operator===ds.HIGHER_THAN||e.operator===ds.LOWER_THAN||e.operator===ds.EQUALS||e.operator===ds.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===ds.UNKNOWN||e.operator===ds.NOT_UNKNOWN}(e):e.action===Ja.SubscriberActionTypes.SUBSCRIBED_TO_LIST?function(e){return(e.operator===Ja.AnyValueTypes.ANY||e.operator===Ja.AnyValueTypes.ALL||e.operator===Ja.AnyValueTypes.NONE)&&Array.isArray(e.segments)&&e.segments.length>0}(e):!(!e.operator||!e.value)&&(e.operator===hs.BEFORE||e.operator===hs.AFTER||e.operator===hs.ON||e.operator===hs.NOT_ON?/^\d+-\d+-\d+$/.test(e.value):(e.operator===hs.IN_THE_LAST||e.operator===hs.NOT_IN_THE_LAST)&&(/^\d+$/.test(e.value)&&Number(e.value)>0)):Array.isArray(e.wordpressRole)&&e.wordpressRole.length>0},[Ja.SegmentTypes.WooCommerceMembership]:function(e){const t=!e.plan_ids||!e.plan_ids.length||!e.operator;return e.action!==Os.MEMBER_OF||!t},[Ja.SegmentTypes.WooCommerceSubscription]:function(e){const t=!e.product_ids||!e.product_ids.length||!e.operator;return e.action!==As.ACTIVE_SUBSCRIPTIONS||!t}};function Ls(e){return!(e.length<1)&&0===e.map((e=>void 0!==Ms[e.segmentType]&&Ms[e.segmentType](e))).filter((e=>!1===e)).length}let Fs,qs;function $s(){const e=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),{updateSubscriberCount:n}=(0,za.Z)("mailpoet-dynamic-segments-form"),r=JSON.stringify(e),a=(0,w.useRef)(1),s=(0,w.useRef)(null),i=(0,w.useRef)(!1),o=(0,w.useRef)((0,Qa.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 Xa().isEqual(t,Fs)?Promise.resolve(qs):(Fs={filters:[...e.filters],filters_connect:e.filters_connect},v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"dynamic_segments",action:"getCount",data:e,timeout:2e4}).then((e=>{const{data:t}=e;return qs={count:t.count,errors:void 0},qs})))}(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,w.useEffect)((()=>{Ls(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,j.jsx)("div",{className:"mailpoet-form-field",children:(0,j.jsxs)("span",{className:"mailpoet-form-error-message",children:[v.x.I18n.t("dynamicSegmentSizeCalculatingTimeout")," ",(0,j.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:v.x.I18n.t("learnMore")})]})}):t.loading||void 0!==t.count?t.loading?(0,j.jsx)("div",{className:"mailpoet-form-field",children:(0,j.jsx)("span",{className:"mailpoet-form-notice-message",children:v.x.I18n.t("dynamicSegmentSizeIsCalculated")})}):(0,j.jsx)("div",{className:"mailpoet-form-field",children:(0,j.jsx)("span",{className:"mailpoet-form-notice-message",children:v.x.I18n.t("dynamicSegmentSize").replace("%1$d",t.count.toLocaleString())})}):(0,j.jsx)("span",{})}const Us={[Ja.SegmentTypes.Email]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),r=ss[n.action];return r?(0,j.jsx)(r,{filterIndex:t}):null},[Ja.SegmentTypes.WooCommerce]:e=>{let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form"),s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getProductCategories()),[]),i=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCountries()),[]),o=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getProducts()),[]),l=(0,Ka.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 p;return(0,w.useEffect)((()=>{void 0===n.number_of_orders_type&&n.action===is.NUMBER_OF_ORDERS&&r({number_of_orders_type:"="},t),void 0===n.total_spent_type&&n.action===is.TOTAL_SPENT&&r({total_spent_type:">"},t),ls.includes(n.action)&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t),n.action===is.CUSTOMER_IN_COUNTRY&&n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t)}),[r,n,t]),n.action===is.PURCHASED_PRODUCT?p=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>r({operator:e.target.value},t),automationId:"select-operator",children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select-operator")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:v.x.I18n.t("selectWooPurchasedProduct"),options:c,value:(0,Cn.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===is.PURCHASED_CATEGORY?p=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>r({operator:e.target.value},t),automationId:"select-operator",children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select-operator")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:v.x.I18n.t("selectWooPurchasedCategory"),options:d,value:(0,Cn.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===is.NUMBER_OF_ORDERS?p=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{value:n.number_of_orders_type,onChange:e=>{a("number_of_orders_type",t,e)},automationId:"select-number-of-orders-type",children:[(0,j.jsx)("option",{value:"=",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"!=",children:v.x.I18n.t("notEquals")}),(0,j.jsx)("option",{value:">",children:v.x.I18n.t("moreThan")}),(0,j.jsx)("option",{value:"<",children:v.x.I18n.t("lessThan")})]},"select"),(0,j.jsx)(te.I,{"data-automation-id":"input-number-of-orders-count",type:"number",min:0,value:n.number_of_orders_count||"",placeholder:v.x.I18n.t("wooNumberOfOrdersCount"),onChange:e=>{a("number_of_orders_count",t,e)}}),(0,j.jsx)("div",{children:v.x.I18n.t("wooNumberOfOrdersOrders")})]}),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsx)("div",{children:v.x.I18n.t("inTheLast")}),(0,j.jsx)(te.I,{"data-automation-id":"input-number-of-orders-days",type:"number",min:1,value:n.number_of_orders_days||"",placeholder:v.x.I18n.t("daysPlaceholder"),onChange:e=>{a("number_of_orders_days",t,e)}}),(0,j.jsx)("div",{children:v.x.I18n.t("days")})]})]}):n.action===is.TOTAL_SPENT?p=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{value:n.total_spent_type,onChange:e=>{a("total_spent_type",t,e)},automationId:"select-total-spent-type",children:[(0,j.jsx)("option",{value:"=",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"!=",children:v.x.I18n.t("notEquals")}),(0,j.jsx)("option",{value:">",children:v.x.I18n.t("moreThan")}),(0,j.jsx)("option",{value:"<",children:v.x.I18n.t("lessThan")})]},"select"),(0,j.jsx)(te.I,{"data-automation-id":"input-total-spent-amount",type:"number",min:0,step:.01,value:n.total_spent_amount||"",placeholder:v.x.I18n.t("wooTotalSpentAmount"),onChange:e=>{a("total_spent_amount",t,e)}}),(0,j.jsx)("div",{children:l})]}),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsx)("div",{children:v.x.I18n.t("inTheLast")}),(0,j.jsx)(te.I,{"data-automation-id":"input-total-spent-days",type:"number",min:1,value:n.total_spent_days||"",placeholder:v.x.I18n.t("daysPlaceholder"),onChange:e=>{a("total_spent_days",t,e)}}),(0,j.jsx)("div",{children:v.x.I18n.t("days")})]})]}):n.action===is.CUSTOMER_IN_COUNTRY&&(p=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>r({operator:e.target.value},t),automationId:"select-operator-country",children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select-operator-country")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:v.x.I18n.t("selectWooCountry"),options:u,value:(0,Cn.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")})]})),p},[Ja.SegmentTypes.WordPressRole]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);let r;return r=n.action?Es[n.action]:cs,r?(0,j.jsx)(r,{filterIndex:t}):null},[Ja.SegmentTypes.WooCommerceMembership]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form"),s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getMembershipPlans()),[]).map((e=>({value:e.id,label:e.name})));return(0,w.useEffect)((()=>{n.action===Os.MEMBER_OF&&n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t)}),[r,n,t]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select-operator")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:v.x.I18n.t("selectWooMembership"),options:s,value:(0,Cn.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")})]})},[Ja.SegmentTypes.WooCommerceSubscription]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form"),s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriptionProducts()),[]).map((e=>({value:e.id,label:e.name})));return(0,w.useEffect)((()=>{n.action===As.ACTIVE_SUBSCRIPTIONS&&n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t)}),[r,n,t]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select-operator")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:v.x.I18n.t("selectWooSubscription"),options:s,value:(0,Cn.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 Zs(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);if(void 0===n||void 0===Us[n.segmentType])return null;const r=Us[n.segmentType];return(0,j.jsx)(r,{filterIndex:t})}function Vs(){const e=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=[Ja.EmailActionTypes.OPENED,Ja.EmailActionTypes.OPENS_ABSOLUTE_COUNT,Ja.EmailActionTypes.MACHINE_OPENED,Ja.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT];let n=!1;return e.filters.forEach((e=>{t.includes(e.action)&&(n=!0)})),n?(0,j.jsx)("div",{className:"mailpoet-form-field",children:(0,j.jsx)("span",{className:"mailpoet-form-notice-message",children:v.x.I18n.t("privacyProtectionNotice")})}):(0,j.jsx)("span",{})}const{subscribersLimitReached:Ws,subscribersLimit:Ys,subscribersCount:Bs,premiumActive:Hs,hasValidApiKey:zs,hasValidPremiumKey:Ks,isPremiumPluginInstalled:Gs,premiumPluginDownloadUrl:Qs,premiumPluginActivationUrl:Xs,pluginPartialKey:Js}=v.x,ei=zs||Ks,ti=e=>{const t=v.x.I18n.t(e);return(0,j.jsx)("p",{children:C()(t,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?Bs:Ys))})},ni=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_blank";return(0,j.jsx)(O.z,{href:t,target:n,rel:"noopener noreferrer",children:v.x.I18n.t(e)})};function ri(e){let t,n,{message:r,actionButton:a}=e;if(ei&&!Hs)t=ti("premiumFeatureDescription"),n=Gs?ni("premiumFeatureButtonActivatePremium",Xs,"_self"):ni("premiumFeatureButtonDownloadPremium",Qs);else if(Ws){t=ti("premiumFeatureDescriptionSubscribersLimitReached");const e=ei?v.x.MailPoetComUrlFactory.getUpgradeUrl(Js):v.x.MailPoetComUrlFactory.getPurchasePlanUrl(+Bs+1);n=ni("premiumFeatureButtonUpgradePlan",e)}else t=r,n=a;return(0,j.jsx)(Oe.K,{title:v.x.I18n.t("premiumFeature"),message:t,actionButton:n})}function ai(){return(0,j.jsx)(ri,{message:(()=>{const e=v.x.I18n.t("premiumFeatureMultipleConditions");return(0,j.jsx)("p",{children:C()(e,/\[link](.*?)\[\/link]/g,(e=>(0,j.jsx)("a",{href:v.x.premiumLink,target:"_blank",rel:"noopener noreferrer",children:e},e)))})})(),actionButton:(0,j.jsx)(O.z,{href:v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount,v.x.currentWpUserEmail,null,{utm_medium:"segments",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("premiumBannerCtaFree")})})}const si=Ee.Hooks.applyFilters("mailpoet_dynamic_segments_form_filters_before",(()=>null)),ii=Ee.Hooks.applyFilters("mailpoet_dynamic_filters_filter_before",(()=>null)),oi=Ee.Hooks.applyFilters("mailpoet_dynamic_filters_filter_after",(()=>(0,j.jsx)("div",{className:"mailpoet-gap"})));function li(e){let{segmentId:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),r=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getAvailableFilters()),[]),a=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").findFiltersValueForSegment(n)),[n]),s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),i=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getErrors()),[]),{updateSegment:o,updateSegmentFilter:l,handleSave:c}=(0,za.Z)("mailpoet-dynamic-segments-form"),[d,u]=(0,w.useState)(!1),p=Ee.Hooks.applyFilters("mailpoet_dynamic_segments_form_add_condition_action",(()=>{u(!0)}));return(0,j.jsxs)("form",{className:"mailpoet_form",children:[i.length>0&&(0,j.jsx)(Be,{errors:i.map((e=>({message:e})))}),(0,j.jsxs)("div",{className:"mailpoet-form-grid",children:[(0,j.jsxs)("div",{className:"mailpoet-form-field-name form-field-row-name mailpoet-segments-name-section",children:[(0,j.jsx)(fe.X,{level:4,children:(0,j.jsx)("label",{htmlFor:"field_name",children:v.x.I18n.t("name")})}),(0,j.jsx)("div",{className:"mailpoet-form-field",children:(0,j.jsx)(te.I,{isFullWidth:!0,type:"text",name:"name",id:"field_name",defaultValue:n.name,onChange:e=>o({name:e.target.value})})})]}),(0,j.jsxs)("div",{className:"mailpoet-form-field-description form-field-row-description mailpoet-segments-description-section",children:[(0,j.jsx)(fe.X,{level:4,children:(0,j.jsx)("label",{htmlFor:"field_description",children:v.x.I18n.t("description")})}),(0,j.jsx)("p",{className:"mailpoet-form-description",children:v.x.I18n.t("segmentDescriptionTip")}),(0,j.jsx)("div",{className:"mailpoet-form-field",children:(0,j.jsx)(re.g,{isFullWidth:!0,name:"description",id:"field_description",value:n.description,onChange:e=>o({description:e.target.value})})})]}),(0,j.jsxs)("div",{className:"mailpoet-segments-segments-section",children:[(0,j.jsx)(fe.X,{level:4,children:(0,j.jsx)("label",{htmlFor:"field_filters",children:v.x.I18n.t("formPageTitle")})}),(0,j.jsx)(si,{}),Array.isArray(a)&&a.map(((e,t)=>(0,j.jsxs)(w.Fragment,{children:[(0,j.jsxs)(bt.r.ThreeColumns,{className:"mailpoet-segments-grid",automationId:`filter-row-${t}`,children:[(0,j.jsx)(ii,{filterRows:a,index:t}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{dimension:"small",placeholder:v.x.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,j.jsx)(Zs,{filterIndex:e.index})]}),(0,j.jsx)(oi,{index:t})]},e.index))),(0,j.jsx)(O.z,{type:"button",variant:"tertiary",iconStart:q,onClick:e=>{e.preventDefault(),p(n,o)},children:v.x.I18n.t("addCondition")})]}),d&&(0,j.jsx)("div",{className:"mailpoet-grid-span-two-columns",children:(0,j.jsx)(ai,{})}),(0,j.jsxs)("div",{className:"mailpoet-segments-counter-section",children:[(0,j.jsx)($s,{}),(0,j.jsx)(Vs,{})]}),(0,j.jsx)("div",{className:"mailpoet-form-actions",children:(0,j.jsx)(O.z,{type:"submit",onClick:e=>{e.preventDefault(),c(t)},isDisabled:!Ls(n.filters)||void 0===s.count,children:v.x.I18n.t("save")})})]})]})}var ci=n(61299);const di=e=>e.products,ui=e=>e.membershipPlans,pi=e=>e.subscriptionProducts,mi=e=>e.wordpressRoles,hi=e=>e.productCategories,fi=e=>e.newslettersList,gi=e=>e.canUseWooSubscriptions,xi=e=>e.wooCurrencySymbol,vi=e=>e.wooCountries,bi=e=>e.customFieldsList,yi=e=>e.segment,wi=e=>e.staticSegmentsList,_i=e=>e.subscriberCount,ji=(e,t)=>{let n;return Array.isArray(e.segment.filters)?(n={...e.segment.filters[t]},n):n},Ii=e=>e.errors,Si=e=>e.allAvailableFilters,Ci=(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 Ti(e,t){return{...e,segment:t.segment}}function ki(e,t){return{...e,errors:t.errors}}function Ni(e,t){const n=e.segment;return{...e,segment:(0,Cn.assign)(n,t.segment)}}function Di(e,t){const n={...e.segment};return n.filters[t.filterIndex]=(0,Cn.assign)(n.filters[t.filterIndex],t.filter),{...e,segment:n}}function Ei(e,t){const n=e.subscriberCount;return{...e,subscriberCount:(0,Cn.assign)(n,t.subscriberCount)}}const Oi=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 Ja.Actions.SET_SEGMENT:return Ti(t,n);case Ja.Actions.SET_ERRORS:return ki(t,n);case Ja.Actions.UPDATE_SEGMENT:return Ni(t,n);case Ja.Actions.UPDATE_SEGMENT_FILTER:return Di(t,n);case Ja.Actions.UPDATE_SUBSCRIBER_COUNT:return Ei(t,n);default:return t}};function Ri(e){return{type:Ja.Actions.SET_SEGMENT,segment:e}}function Ai(e){return{type:Ja.Actions.SET_ERRORS,errors:e}}function Pi(e){return{type:Ja.Actions.UPDATE_SEGMENT,segment:e}}function Mi(e,t){return{type:Ja.Actions.UPDATE_SEGMENT_FILTER,filter:e,filterIndex:t}}function Li(e,t){return{type:Ja.Actions.UPDATE_SEGMENT,segment:{[e]:t.target.value}}}function Fi(e,t,n){return{type:Ja.Actions.UPDATE_SEGMENT_FILTER,filter:{[e]:n.target.value},filterIndex:t}}function qi(e){return{type:Ja.Actions.UPDATE_SUBSCRIBER_COUNT,subscriberCount:e}}function*$i(e){if(void 0===e)return;v.x.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 Ri(t),v.x.Modal.loading(!1)}function*Ui(e){const t=(0,ci.Ys)("mailpoet-dynamic-segments-form").getSegment();yield Ai([]);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?v.x.Notice.success(v.x.I18n.t("dynamicSegmentUpdated")):(a=t,v.x.Notice.success(v.x.I18n.t("dynamicSegmentAdded")),v.x.trackEvent("Segments > Add new",{type:a.segmentType||"unknown type",subtype:a.action||a.wordpressRole||"unknown subtype"}))):yield Ai(n)}function Zi(e){let t=JSON.parse(JSON.stringify(e));return(0,Cn.has)("link_id",e)&&(t=(0,Cn.assign)(t,{link_id:e.link_id.toString()})),(0,Cn.has)("newsletter_id",e)&&(t=(0,Cn.assign)(t,{newsletter_id:e.newsletter_id.toString()})),(0,Cn.has)("product_id",e)&&(t=(0,Cn.assign)(t,{product_id:e.product_id.toString()})),(0,Cn.has)("category_id",e)&&(t=(0,Cn.assign)(t,{category_id:e.category_id.toString()})),t}async function Vi(e){let{segmentId:t}=e;try{return{success:!0,res:Zi((await v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"dynamic_segments",action:"get",data:{id:t}})).data)}}catch(e){return{success:!1,error:(0,He.q)(e)?e.errors.map((e=>e.message)):null,res:e}}}async function Wi(e){let{segment:t}=e;try{return await v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"dynamic_segments",action:"save",data:t}),{success:!0}}catch(e){return{success:!1,error:(0,He.q)(e)?e.errors.map((e=>e.message)):null}}}function Yi(e,t){const n=[{label:v.x.I18n.t("email"),options:as},{label:v.x.I18n.t("wpUserRole"),options:Ds}];return v.x.isWoocommerceActive&&n.push({label:v.x.I18n.t("woocommerce"),options:os}),v.x.isWoocommerceActive&&t&&n.push({label:v.x.I18n.t("woocommerceMemberships"),options:Rs}),v.x.isWoocommerceActive&&e&&n.push({label:v.x.I18n.t("woocommerceSubscriptions"),options:Ps}),n}function Bi(){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:Ja.SegmentConnectTypes.AND,filters:[{segmentType:Ja.SegmentTypes.WordPressRole,action:Ja.SubscriberActionTypes.WORDPRESS_ROLE}]},subscriberCount:{loading:!1},errors:[],allAvailableFilters:Yi(window.mailpoet_can_use_woocommerce_subscriptions,window.mailpoet_can_use_woocommerce_memberships)},t={selectors:r,actions:a,controls:s,reducer:Oi(e),resolvers:{}};(0,ci.R9)("mailpoet-dynamic-segments-form",t)})();const{pageLoaded:t}=(0,za.Z)("mailpoet-dynamic-segments-form");return(0,w.useEffect)((()=>{t(e.params.id)}),[e.params.id,t]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(be.B,{}),(0,j.jsxs)(fe.X,{level:1,className:"mailpoet-title",children:[(0,j.jsx)("span",{children:v.x.I18n.t("formPageTitle")}),(0,j.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:"/segments",children:v.x.I18n.t("backToList")})]}),(0,j.jsx)(li,{segmentId:Number(e.params.id)})]})}const Hi=[{name:"name",label:v.x.I18n.t("nameColumn"),sortable:!0},{name:"description",label:v.x.I18n.t("description"),sortable:!1},{name:"count",label:v.x.I18n.t("subscribersCountColumn"),sortable:!1},{name:"subscribed",label:v.x.I18n.t("subscribed"),sortable:!1},{name:"updated_at",label:v.x.I18n.t("updatedAtColumn"),sortable:!0}],zi={onLoadingItems:()=>v.x.I18n.t("loadingDynamicSegmentItems"),onNoItemsFound:()=>v.x.I18n.t("noDynamicSegmentItemsFound"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneDynamicSegmentTrashed"):v.x.I18n.t("multipleDynamicSegmentsTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneDynamicSegmentDeleted"):v.x.I18n.t("multipleDynamicSegmentsDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneDynamicSegmentRestored"):v.x.I18n.t("multipleDynamicSegmentsRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},Ki=[{name:"edit",className:"mailpoet-hide-on-mobile",link:e=>(0,j.jsx)(l.rU,{to:`/edit-segment/${e.id}`,children:v.x.I18n.t("edit")}),display:e=>!e.is_plugin_missing},{name:"edit_disabled",className:"mailpoet-hide-on-mobile mailpoet-disabled",link:e=>(0,j.jsx)(l.rU,{to:`/edit-segment/${e.id}`,children:v.x.I18n.t("edit")}),display:e=>e.is_plugin_missing},{name:"view_subscribers",link:e=>(0,j.jsx)("a",{href:e.subscribers_url,children:v.x.I18n.t("viewSubscribers")})},{name:"trash",className:"mailpoet-hide-on-mobile"}],Gi=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:zi.onTrash}];function Qi(e,t){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("td",{className:"column-primary","data-colname":v.x.I18n.t("nameColumn"),children:[(0,j.jsx)("span",{className:"mailpoet-listing-title",children:e.name}),t]}),(0,j.jsx)("td",{"data-colname":v.x.I18n.t("description"),children:(0,j.jsx)("abbr",{children:e.description})}),e.is_plugin_missing?(0,j.jsx)("td",{colSpan:"2",className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("missingPluginMessageColumn"),children:e.missing_plugin_message&&e.missing_plugin_message.message&&e.missing_plugin_message.link?C()(e.missing_plugin_message.message,/\[link](.*?)\[\/link]/g,(t=>(0,j.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,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("subscribersCountColumn"),children:parseInt(e.count_all,10).toLocaleString()}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("subscribed"),children:parseInt(e.count_subscribed,10).toLocaleString()})]}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("updatedAtColumn"),children:[v.x.Date.short(e.created_at),(0,j.jsx)("br",{}),v.x.Date.time(e.created_at)]})]})}function Xi(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(x.N,{limit:window.mailpoet_listing_per_page,location:e.location,params:e.match.params,search:!0,onRenderItem:Qi,endpoint:"dynamic_segments",base_url:"segments",columns:Hi,messages:zi,sort_by:"created_at",sort_order:"desc",item_actions:Ki,bulk_actions:Gi}),(0,j.jsxs)("p",{className:"mailpoet_sending_methods_help help",children:[(0,j.jsxs)("b",{children:[v.x.I18n.t("segmentsTip"),":"]})," ",v.x.I18n.t("segmentsTipText")," ",(0,j.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:v.x.I18n.t("segmentsTipLink")})]})]})}Xi.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const Ji=(0,c.withRouter)(Xi);function eo(){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(F.Q,{children:[(0,j.jsxs)(l.rU,{className:"mailpoet-button button-secondary",to:"/new",children:[q,(0,j.jsx)("span",{children:v.x.I18n.t("new")})]}),(0,j.jsxs)(l.rU,{className:"mailpoet-button button-secondary",to:"/new-segment","data-automation-id":"new-segment",children:[q,(0,j.jsx)("span",{children:v.x.I18n.t("newSegment")})]})]}),(0,j.jsx)(P,{subscribersInPlan:v.x.subscribersCount,subscribersInPlanLimit:v.x.subscribersLimit}),(0,j.jsx)(R,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,j.jsx)(k,{}),(0,j.jsx)(E,{}),(0,j.jsx)(N,{mssKeyInvalid:v.x.hasInvalidMssApiKey,subscribersCount:v.x.subscribersCount})]})}const to=document.getElementById("segments_container");function no(){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(eo,{}),(0,j.jsxs)(xa.t,{activeKey:"lists",routerType:"switch-only",children:[(0,j.jsx)(ca.O,{route:"lists/(.*)?",title:v.x.I18n.t("pageTitle"),children:(0,j.jsx)(Wa,{})},"lists"),(0,j.jsx)(ca.O,{route:"segments/(.*)?",title:v.x.I18n.t("pageTitleSegments"),automationId:"dynamic-segments-tab",children:(0,j.jsx)(Ji,{})},"segments")]})]})}function ro(){return(0,j.jsx)(Ce.k.Provider,{value:(0,Ce.S)(window),children:(0,j.jsxs)(l.UT,{children:[(0,j.jsx)(Me.w,{}),(0,j.jsxs)(c.Switch,{children:[(0,j.jsx)(c.Route,{exact:!0,path:"/",render:()=>(0,j.jsx)(c.Redirect,{to:"/lists"})}),(0,j.jsx)(c.Route,{path:"/new",component:Ha}),(0,j.jsx)(c.Route,{path:"/edit/:id",component:Ha}),(0,j.jsx)(c.Route,{path:"/new-segment",component:Bi}),(0,j.jsx)(c.Route,{path:"/edit-segment/:id",component:Bi}),(0,j.jsx)(c.Route,{path:"/segments/(.*)?",component:no}),(0,j.jsx)(c.Route,{path:"/lists/(.*)?",component:no})]})]})})}to&&o().render((0,j.jsx)(ro,{}),to);const ao=()=>{v.x.trackEvent("Forms > Add New"),setTimeout((()=>{window.location=window.mailpoet_form_template_selection_url}),200)};function so(){const[e,t]=(0,w.useState)(!1);return(0,j.jsx)(F.Q,{children:(0,j.jsx)(O.z,{onClick:()=>{t(!0),ao()},withSpinner:e,automationId:"create_new_form",variant:"secondary",iconStart:q,children:v.x.I18n.t("new")})})}const io=[{name:"name",label:v.x.I18n.t("formName"),sortable:!0},{name:"segments",label:v.x.I18n.t("segments")},{name:"type",label:v.x.I18n.t("type")},{name:"status",label:v.x.I18n.t("status")},{name:"updated_at",label:v.x.I18n.t("updatedAt"),sortable:!0}],oo={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneFormTrashed"):v.x.I18n.t("multipleFormsTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneFormDeleted"):v.x.I18n.t("multipleFormsDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneFormRestored"):v.x.I18n.t("multipleFormsRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onNoItemsFound:()=>(0,j.jsxs)("div",{className:"mailpoet-forms-add-new-row",children:[(0,j.jsx)("p",{children:v.x.I18n.t("noItemsFound")}),(0,j.jsx)(g.Button,{onClick:ao,automationId:"add_new_form",iconStart:q,children:v.x.I18n.t("new")})]})},lo=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:oo.onTrash}],co=[{name:"edit",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("edit"),link:function(e){return(0,j.jsx)("a",{href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:v.x.I18n.t("edit")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:function(e,t){return v.x.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:v.x.I18n.t("noName");v.x.Notice.success(v.x.I18n.t("formDuplicated").replace("%1$s",n)),t()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class uo extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"updateStatus",((e,t)=>{t.persist(),v.x.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&&v.x.Notice.success(v.x.I18n.t("formActivated"))})).fail((n=>{v.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,y.Z)(this,"isItemInactive",(e=>"disabled"===e.status)),(0,y.Z)(this,"renderItem",((e,t)=>{const n=u()("manage-column","column-primary","has-row-actions"),r=window.mailpoet_segments.filter((t=>-1!==m().inArray(t.id,e.segments))),a=function(e){var t,n,r,a,s,i,o,l;const c=[];return"1"===(null==e||null===(t=e.form_placement)||void 0===t||null===(n=t.fixed_bar)||void 0===n?void 0:n.enabled)&&c.push(v.x.I18n.t("placeFixedBarFormOnPages")),"1"===(null==e||null===(r=e.form_placement)||void 0===r||null===(a=r.below_posts)||void 0===a?void 0:a.enabled)&&c.push(v.x.I18n.t("placeFormBellowPages")),"1"===(null==e||null===(s=e.form_placement)||void 0===s||null===(i=s.popup)||void 0===i?void 0:i.enabled)&&c.push(v.x.I18n.t("placePopupFormOnPages")),"1"===(null==e||null===(o=e.form_placement)||void 0===o||null===(l=o.slide_in)||void 0===l?void 0:l.enabled)&&c.push(v.x.I18n.t("placeSlideInFormOnPages")),c.length>0?c.join(", "):v.x.I18n.t("placeFormOthers")}(e.settings);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("td",{className:n,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:e.name?e.name:`(${v.x.I18n.t("noName")})`}),t]}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("segments"),children:(0,j.jsx)(lr.$,{segments:r,dimension:"large",children:"user"===e.settings.segments_selected_by&&(0,j.jsx)("span",{className:"mailpoet-tags-prefix",children:v.x.I18n.t("userChoice")})})}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("type"),children:a}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("status"),children:this.renderStatus(e)}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("updatedAt"),children:[v.x.Date.short(e.updated_at),(0,j.jsx)("br",{}),v.x.Date.time(e.updated_at)]})]})}))}renderStatus(e){return(0,j.jsxs)("div",{children:[(0,j.jsx)(Mt.Z,{onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"enabled"===e.status}),(0,j.jsxs)("p",{children:[v.x.I18n.t("signups"),": ",e.signups.toLocaleString()]})]})}render(){return(0,j.jsxs)("div",{className:"mailpoet-listing-no-actions-on-mobile",children:[(0,j.jsx)(so,{}),(0,j.jsx)(x.N,{limit:window.mailpoet_listing_per_page,className:"mailpoet-forms-listing",location:this.props.location,params:this.props.match.params,messages:oo,search:!1,endpoint:"forms",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:io,bulk_actions:lo,item_actions:co})]})}}uo.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const po=Ia(uo);function mo(){return(0,j.jsx)(Ce.k.Provider,{value:(0,Ce.S)(window),children:(0,j.jsxs)(l.UT,{children:[(0,j.jsx)(Me.w,{}),(0,j.jsx)(c.Route,{path:"*",component:po})]})})}const ho=document.getElementById("forms_container");function fo(){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("p",{children:v.x.I18n.t("knowledgeBaseIntro")}),(0,j.jsxs)("ul",{className:"mailpoet-text-links",children:[(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/116-common-problems",children:"Common Problems"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/165-newsletters",children:"Newsletters"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/156-migration-questions",children:"Migration Questions"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/149-sending-methods",children:"Sending Methods"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/139-subscription-forms",children:"Subscription Forms"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/114-getting-started",children:"Getting Started"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/123-newsletter-designer",children:"Newsletter Designer"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/121-subscribers-and-lists",children:"Subscribers and Lists"})})]}),(0,j.jsx)(O.z,{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/",children:v.x.I18n.t("knowledgeBaseButton")})]})}function go(e){e.target.select()}function xo(e){if(_.ZP.isObject(e)){const t=Object.keys(e).map((t=>`${t}: ${e[t]}`));return(0,j.jsx)("textarea",{readOnly:!0,onFocus:go,value:t.join("\n"),style:{width:"100%",height:"400px"}})}return(0,j.jsx)("p",{children:v.x.I18n.t("systemInfoDataError")})}function vo(){const e=window.systemInfoData;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,j.jsx)("p",{children:v.x.I18n.t("systemInfoIntro")})}),xo(e)]})}function bo(e){return(0,j.jsx)("table",{className:"widefat fixed",style:{maxWidth:e.max_width},children:(0,j.jsx)("tbody",{children:e.rows.map((e=>(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{className:"row-title",children:e.key}),(0,j.jsx)("td",{children:e.value})]},`row_${e.key}`)))})})}function yo(e){return(0,j.jsx)("span",{children:!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown})}function wo(e){const t=e.status_data,n={active:v.x.I18n.t("running"),inactive:v.x.I18n.t("cronWaiting")},r=Array.isArray(t.last_error)?(0,j.jsx)(j.Fragment,{children:t.last_error.map((e=>(0,j.jsxs)("div",{children:[e.worker,": ",(0,j.jsx)("i",{children:e.message})]},e.worker)))}):t.last_error;return(0,j.jsxs)("div",{children:[(0,j.jsx)("h4",{children:v.x.I18n.t("systemStatusCronStatusTitle")}),(0,j.jsx)(bo,{max_width:"400px",rows:[{key:v.x.I18n.t("accessible"),value:(0,j.jsx)(yo,{children:t.accessible})},{key:v.x.I18n.t("status"),value:n[t.status]?n[t.status]:v.x.I18n.t("unknown")},{key:v.x.I18n.t("lastUpdated"),value:t.updated_at?v.x.Date.full(1e3*t.updated_at):v.x.I18n.t("unknown")},{key:v.x.I18n.t("lastRunStarted"),value:t.run_accessed_at?v.x.Date.full(1e3*t.run_started_at):v.x.I18n.t("unknown")},{key:v.x.I18n.t("lastRunCompleted"),value:t.run_completed_at?v.x.Date.full(1e3*t.run_completed_at):v.x.I18n.t("unknown")},{key:v.x.I18n.t("lastSeenError"),value:r||v.x.I18n.t("none")},{key:v.x.I18n.t("lastSeenErrorDate"),value:t.last_error_date?v.x.Date.full(1e3*t.last_error_date):v.x.I18n.t("unknown")}]})]})}function _o(e){let t=e.task.scheduled_at;t&&(t=(0,cr.default)(t,"yyyy-MM-dd HH:mm:ss",new Date));const n=(0,cr.default)(e.task.updated_at,"yyyy-MM-dd HH:mm:ss",new Date);return(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{className:"column column-primary",children:e.task.id}),(0,j.jsx)("td",{className:"column",children:e.task.type}),(0,j.jsx)("td",{className:"column",children:e.task.newsletter?(0,j.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||v.x.I18n.t("preview")}):v.x.I18n.t("none")}),(0,j.jsx)("td",{className:"column",children:e.task.priority}),e.show_scheduled_at?(0,j.jsx)("td",{className:"column-date",children:(0,j.jsx)("abbr",{children:`${v.x.Date.short(t)} ${v.x.Date.time(t)}`})}):null,(0,j.jsx)("td",{className:"column-date",children:(0,j.jsx)("abbr",{children:`${v.x.Date.short(n)} ${v.x.Date.time(n)}`})})]})}function jo(e){return(0,j.jsxs)("tr",{children:[(0,j.jsx)("th",{className:"row-title",children:"Id"}),(0,j.jsx)("th",{className:"row-title",children:v.x.I18n.t("type")}),(0,j.jsx)("th",{className:"row-title",children:v.x.I18n.t("email")}),(0,j.jsx)("th",{className:"row-title",children:v.x.I18n.t("priority")}),e.show_scheduled_at?(0,j.jsx)("th",{className:"row-title",children:v.x.I18n.t("scheduledAt")}):null,(0,j.jsx)("th",{className:"row-title",children:v.x.I18n.t("updatedAt")})]})}function Io(e){const t=e.show_scheduled_at?6:5;return(0,j.jsxs)("table",{className:"widefat fixed striped",children:[(0,j.jsx)("thead",{children:(0,j.jsx)(jo,{show_scheduled_at:e.show_scheduled_at})}),(0,j.jsx)("tbody",{children:e.tasks.length?e.tasks.map((t=>(0,j.jsx)(_o,{task:t,show_scheduled_at:e.show_scheduled_at},t.id))):(0,j.jsx)("tr",{className:"mailpoet-listing-no-items",children:(0,j.jsx)("td",{colSpan:t,children:v.x.I18n.t("nothingToShow")})})}),(0,j.jsx)("tfoot",{children:(0,j.jsx)(jo,{show_scheduled_at:e.show_scheduled_at})})]})}function So(e){const t=e.status_data;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h4",{children:v.x.I18n.t("systemStatusQueueTitle")}),(0,j.jsx)(bo,{max_width:"400px",rows:[{key:v.x.I18n.t("status"),value:"paused"===t.status?v.x.I18n.t("paused"):v.x.I18n.t("running")},{key:v.x.I18n.t("startedAt"),value:t.started?v.x.Date.full(1e3*t.started):v.x.I18n.t("unknown")},{key:v.x.I18n.t("sentEmails"),value:t.sent||0},{key:v.x.I18n.t("retryAttempt"),value:t.retry_attempt||v.x.I18n.t("none")},{key:v.x.I18n.t("retryAt"),value:t.retry_at?v.x.Date.full(1e3*t.retry_at):v.x.I18n.t("none")},{key:v.x.I18n.t("error"),value:t.error?t.error.error_message:v.x.I18n.t("none")},{key:v.x.I18n.t("totalCompletedTasks"),value:t.tasksStatusCounts.completed},{key:v.x.I18n.t("totalRunningTasks"),value:t.tasksStatusCounts.running},{key:v.x.I18n.t("totalPausedTasks"),value:t.tasksStatusCounts.paused},{key:v.x.I18n.t("totalScheduledTasks"),value:t.tasksStatusCounts.scheduled}]}),(0,j.jsx)("h5",{children:v.x.I18n.t("scheduledTasks")}),(0,j.jsx)(Io,{show_scheduled_at:!0,tasks:t.latestTasks.filter((e=>"scheduled"===e.status))}),(0,j.jsx)("h5",{children:v.x.I18n.t("runningTasks")}),(0,j.jsx)(Io,{tasks:t.latestTasks.filter((e=>null===e.status))}),(0,j.jsx)("h5",{children:v.x.I18n.t("completedTasks")}),(0,j.jsx)(Io,{tasks:t.latestTasks.filter((e=>"completed"===e.status))})]})}function Co(e,t,n,r,a,s){const i=e?"success":"error";let o=e?t:n;return r&&(o=C()(o,/\[link\](.*?)\[\/link\]/g,(e=>(0,j.jsx)("a",{className:"mailpoet-text-link",href:r,"data-beacon-article":a,children:e},"kb-link")))),(0,j.jsxs)("div",{className:`mailpoet_notice notice inline notice-${i}`,children:[(0,j.jsx)("p",{children:o}),s?(0,j.jsx)("p",{children:(0,j.jsx)("i",{children:s})}):null]})}function To(e){const t=e.cron.isReachable,n=e.cron.url,r=`${v.x.I18n.t("systemStatusConnectionUnsuccessful")} ${v.x.I18n.t("systemStatusCronConnectionUnsuccessfulInfo")}`,a=v.x.I18n.t("systemStatusConnectionSuccessful"),s=t?null:e.cron.pingResponse;return(0,j.jsxs)("div",{children:[(0,j.jsx)("h4",{children:v.x.I18n.t("systemStatusCronTitle")}),(0,j.jsx)("p",{children:(0,j.jsx)("a",{className:"mailpoet-text-link",href:n,target:"_blank",rel:"noopener noreferrer",children:n})}),Co(t,a,r,"https://kb.mailpoet.com/article/231-sending-does-not-work","5a0257ac2c7d3a272c0d7ad6",s)]})}function ko(e){const t=e.mss.enabled?`${v.x.I18n.t("systemStatusConnectionUnsuccessful")} ${v.x.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo")}`:v.x.I18n.t("systemStatusMSSConnectionCanNotConnect"),n=e.mss.enabled?v.x.I18n.t("systemStatusConnectionSuccessful"):v.x.I18n.t("systemStatusMSSConnectionCanConnect");return(0,j.jsxs)("div",{children:[(0,j.jsx)("h4",{children:v.x.I18n.t("systemStatusMSSTitle")}),Co(e.mss.isReachable,n,t,"https://kb.mailpoet.com/article/319-known-errors-when-validating-a-mailpoet-key","5ef1da9d2c7d3a10cba966c5",null)]})}function No(){const e=window.systemStatusData;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,j.jsx)("p",{children:e.mss.enabled?v.x.I18n.t("systemStatusIntroCronMSS"):v.x.I18n.t("systemStatusIntroCron")})}),To(e),ko(e),(0,j.jsx)(wo,{status_data:e.cronStatus}),(0,j.jsx)(So,{status_data:e.queueStatus})]})}function Do(){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("p",{children:v.x.I18n.t("yourPrivacyContent1")}),(0,j.jsx)("p",{children:v.x.I18n.t("yourPrivacyContent2")}),(0,j.jsx)("p",{children:v.x.I18n.t("yourPrivacyContent3")}),(0,j.jsx)(O.z,{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/",children:v.x.I18n.t("yourPrivacyButton")})]})}function Eo(){return(0,j.jsxs)(Ce.k.Provider,{value:(0,Ce.S)(window),children:[(0,j.jsx)(F.D,{}),(0,j.jsx)(Me.w,{}),(0,j.jsxs)(xa.t,{activeKey:"knowledgeBase",children:[(0,j.jsx)(g.Tab,{title:v.x.I18n.t("tabKnowledgeBaseTitle"),children:(0,j.jsx)(fo,{})},"knowledgeBase"),(0,j.jsx)(g.Tab,{title:v.x.I18n.t("tabSystemStatusTitle"),children:(0,j.jsx)(No,{})},"systemStatus"),(0,j.jsx)(g.Tab,{title:v.x.I18n.t("tabSystemInfoTitle"),children:(0,j.jsx)(vo,{})},"systemInfo"),(0,j.jsx)(g.Tab,{title:v.x.I18n.t("tabYourPrivacyTitle"),children:(0,j.jsx)(Do,{})},"yourPrivacy")]})]})}ho&&o().render((0,j.jsx)(mo,{}),ho),bo.propTypes={max_width:f().string,rows:f().arrayOf(f().shape({key:f().string.isRequired,value:f().oneOfType([f().string,f().number,f().element]).isRequired})).isRequired},bo.defaultProps={max_width:"auto"},yo.propTypes={truthy:f().string,falsy:f().string,unknown:f().string,children:f().bool},yo.defaultProps={truthy:v.x.I18n.t("yes"),falsy:v.x.I18n.t("no"),unknown:v.x.I18n.t("unknown"),children:null},wo.propTypes={status_data:f().shape({accessible:f().bool,last_error_date:f().string,status:f().string,updated_at:f().number,run_accessed_at:f().number,run_completed_at:f().number,run_started_at:f().number,last_error:f().oneOfType([f().string,f().array])}).isRequired},_o.propTypes={show_scheduled_at:f().bool,task:f().shape({id:f().number.isRequired,type:f().string.isRequired,priority:f().number.isRequired,updated_at:f().string.isRequired,scheduled_at:f().string,status:f().string,newsletter:f().shape({newsletter_id:f().number.isRequired,queue_id:f().number.isRequired,preview_url:f().string.isRequired,subject:f().string})}).isRequired},_o.defaultProps={show_scheduled_at:!1},jo.propTypes={show_scheduled_at:f().bool},jo.defaultProps={show_scheduled_at:!1},Io.propTypes={show_scheduled_at:f().bool,tasks:f().arrayOf(_o.propTypes.task).isRequired},Io.defaultProps={show_scheduled_at:!1},So.propTypes={status_data:f().shape({status:f().string,started:f().number,sent:f().number,retry_attempt:f().number,retry_at:f().number,error:f().shape({operation:f().string,error_message:f().string}),tasksStatusCounts:f().shape({completed:f().number.isRequired,running:f().number.isRequired,paused:f().number.isRequired,scheduled:f().number.isRequired}).isRequired,latestTasks:f().arrayOf(_o.propTypes.task).isRequired}).isRequired};const Oo=document.getElementById("help_container");Oo&&o().render((0,j.jsx)(Eo,{}),Oo);const Ro=(0,c.withRouter)((function(e){let{children:t,location:{pathname:n}}=e;return(0,w.useEffect)((()=>{window.scrollTo(0,0)}),[n]),t||null}));function Ao(e){let{activeMethod:t,onMethodChange:n}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,j.jsx)("span",{className:"mailpoet_import_heading",children:v.x.I18n.t("methodSelectionHead")}),(0,j.jsx)("div",{className:"mailpoet-settings-inputs-row",children:(0,j.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,j.jsx)(ke.V,{dimension:"large",variant:"excellent",isInverted:!0,children:v.x.I18n.t("seeVideo")})})})]}),(0,j.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,j.jsx)(oe.Y,{name:"select_method",automationId:"import-paste-method",id:"import-paste-method",checked:"paste-method"===t,value:"paste-method",onCheck:n}),(0,j.jsx)("label",{htmlFor:"import-paste-method",children:v.x.I18n.t("methodPaste")})]}),(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,j.jsx)(oe.Y,{name:"select_method",automationId:"import-csv-method",id:"import-csv-method",checked:"file-method"===t,value:"file-method",onCheck:n}),(0,j.jsx)("label",{htmlFor:"import-csv-method",children:v.x.I18n.t("methodUpload")})]}),(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,j.jsx)(oe.Y,{name:"select_method",automationId:"import-mailchimp-method",id:"import-mailchimp-method",checked:"mailchimp-method"===t,value:"mailchimp-method",onCheck:n}),(0,j.jsx)("label",{htmlFor:"import-mailchimp-method",children:v.x.I18n.t("methodMailChimp")})]})]})]})}function Po(e){let{hidePrevious:t,isLastStep:n,canGoNext:r,onPreviousAction:a,onNextAction:s}=e;return(0,j.jsxs)("div",{className:"mailpoet-settings-save",children:[!t&&(0,j.jsx)(O.z,{type:"button",variant:"secondary",onClick:a,children:v.x.I18n.t("previousStep")}),(0,j.jsx)(O.z,{type:"button",automationId:"import-next-step",isDisabled:!r,onClick:()=>{r&&s()},children:v.x.I18n.t(n?"import":"nextStep")})]})}function Mo(e){let{onValueChange:t,canFinish:n,onFinish:r,data:a,onPrevious:s}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,j.jsx)("label",{htmlFor:"paste_input",children:v.x.I18n.t("pasteLabel")}),(0,j.jsx)("p",{className:"description",children:C()(v.x.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,j.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,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsx)(re.g,{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,j.jsx)(Po,{canGoNext:n,onPreviousAction:s,onNextAction:r})]})}function Lo(e){let{onValueChange:t,canFinish:n,onFinish:r,onPrevious:a}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,j.jsx)("label",{htmlFor:"file_local",children:v.x.I18n.t("methodUpload")}),(0,j.jsx)("p",{className:"description",children:C()(v.x.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,j.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,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsx)(te.I,{type:"file",id:"file_local",accept:".csv","data-automation-id":"import-file-upload-input",onChange:e=>{const n=e.target.value.match(/[^.]+$/);v.x.Notice.hide(),null===n||"csv"!==n[0].toLowerCase()?(v.x.Notice.error(v.x.I18n.t("wrongFileFormat")),t("")):t(e.target.files[0])}})}),(0,j.jsx)(Po,{canGoNext:n,onPreviousAction:a,onNextAction:r})]})}function Fo(e){let{onFinish:t,onPrevious:n}=e;const[r,a]=(0,w.useState)(""),[s,i]=(0,w.useState)(void 0),[o,l]=(0,w.useState)([]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet-settings-label",children:(0,j.jsxs)("label",{htmlFor:"mailpoet_mailchimp_key_input",children:[(0,j.jsx)("span",{className:"mailpoet_import_heading",children:v.x.I18n.t("methodMailChimpLabel")}),(0,j.jsx)("p",{className:"description",children:C()(v.x.I18n.t("methodMailChimpDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,j.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,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,j.jsx)(te.I,{dimension:"small",id:"mailpoet_mailchimp_key_input",type:"text",onChange:e=>{a(e.target.value),""===e.target.value.trim()&&i(void 0)}}),(0,j.jsx)("span",{className:"mailpoet-gap"}),(0,j.jsx)(O.z,{type:"button",dimension:"small",onClick:()=>{v.x.Modal.loading(!0),v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpLists",data:{api_key:r}}).always((()=>{v.x.Modal.loading(!1)})).done((e=>i(e.data))).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},children:v.x.I18n.t("methodMailChimpVerify")}),(0,j.jsx)("span",{className:"mailpoet-gap"}),(0,j.jsx)("span",{children:Array.isArray(s)&&0===s.length?v.x.I18n.t("noMailChimpLists"):null})]})}),s?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet-settings-label",children:v.x.I18n.t("methodMailChimpSelectList")}),(0,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsx)(I,{field:{id:"segments",name:"list-selection",multiple:!0,placeholder:v.x.I18n.t("methodMailChimpSelectPlaceholder"),forceSelect2:!0,values:s},onValueChange:e=>l(e.target.value)})})]}):null,(0,j.jsx)(Po,{canGoNext:Array.isArray(o)&&o.length>0,onPreviousAction:n,onNextAction:()=>{v.x.Modal.loading(!0),v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:r,lists:o}}).always((()=>{v.x.Modal.loading(!1)})).done((e=>t(e.data))).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}})]})}Ao.propTypes={activeMethod:f().string,onMethodChange:f().func.isRequired},Ao.defaultProps={activeMethod:void 0},Po.propTypes={canGoNext:f().bool,hidePrevious:f().bool,isLastStep:f().bool,onPreviousAction:f().func,onNextAction:f().func},Po.defaultProps={hidePrevious:!1,isLastStep:!1,canGoNext:!0,onPreviousAction:()=>{},onNextAction:()=>{}},Mo.propTypes={onFinish:f().func,onPrevious:f().func,canFinish:f().bool.isRequired,onValueChange:f().func.isRequired,data:f().string},Mo.defaultProps={onFinish:()=>{},onPrevious:()=>{},data:""},Lo.propTypes={canFinish:f().bool.isRequired,onFinish:f().func,onPrevious:f().func,onValueChange:f().func.isRequired},Lo.defaultProps={onFinish:()=>{},onPrevious:()=>{}},Fo.propTypes={onFinish:f().func,onPrevious:f().func},Fo.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var qo=n(57460),$o=n.n(qo);const Uo=e=>window.roleBasedEmails.findIndex((t=>e.startsWith(`${t}@`)))>=0,Zo=e=>{let t,n=_.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)&&!Uo(n)&&n};function Vo(e){let{history:t,setStepMethodSelectionData:n,subscribersLimitForValidation:r}=e;const[a,s]=(0,w.useState)(void 0),[i,o]=(0,w.useState)(""),[l,c]=(0,w.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")},p=()=>{((e,t)=>{const n=encodeURI(e).split(/%..|./).length-1;v.x.Notice.hide(),n>window.maxPostSizeBytes?v.x.Notice.error(v.x.I18n.t("maxPostSizeNotice")):(v.x.Modal.loading(!0),$o().parse(e,function(e){return{skipEmptyLines:!0,error(){v.x.Notice.hide(),v.x.Notice.error(v.x.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=Zo(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=Zo(l[d]),_.ZP.has(n,i)?r.push(i):Uo(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=_.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:_.ZP.uniq(r),invalid:_.ZP.uniq(a),role:_.ZP.uniq(s)}:null}(t.data);if(n)e(n);else{let e=v.x.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>"),v.x.Notice.error(e)}v.x.Modal.loading(!1)}}}((e=>{v.x.trackEvent("Subscribers import started",{source:"file-method"===a?"file upload":"pasted data"}),d(e)}))))})("paste-method"===a?i:l)};return(0,j.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,j.jsx)(Ao,{activeMethod:a,onMethodChange:s}),"paste-method"===a&&(0,j.jsx)(Mo,{onPrevious:u,onValueChange:o,onFinish:p,canFinish:!!i.trim(),data:i}),"file-method"===a&&(0,j.jsx)(Lo,{onPrevious:u,onValueChange:c,onFinish:p,canFinish:!!l,data:l}),"mailchimp-method"===a&&(0,j.jsx)(Fo,{onPrevious:u,onFinish:e=>{v.x.trackEvent("Subscribers import started",{source:"MailChimp"}),d(e)}}),void 0===a&&(0,j.jsx)(Po,{canGoNext:!1,onPreviousAction:u})]})}Vo.propTypes={history:f().shape({push:f().func.isRequired}).isRequired,setStepMethodSelectionData:f().func.isRequired,subscribersLimitForValidation:f().number.isRequired};const Wo=(0,c.withRouter)(Vo);function Yo(e){let{onProceed:t}=e;return(0,j.jsxs)("div",{className:"mailpoet-clean-list-step-container",children:[(0,j.jsx)("p",{children:v.x.I18n.t("cleanListText1")}),(0,j.jsx)("p",{children:v.x.I18n.t("cleanListText2")}),(0,j.jsxs)("p",{children:[t&&(0,j.jsx)(O.z,{onClick:t,variant:"tertiary",children:v.x.I18n.t("listCleaningGotIt")}),(0,j.jsx)(O.z,{target:"_blank",href:"https://kb.mailpoet.com/article/287-list-cleaning-services",children:v.x.I18n.t("tryListCleaning")})]})]})}function Bo(e){let{onSubmit:t,history:n}=e;const[r,a]=(0,w.useState)(void 0);return(0,j.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,j.jsx)("div",{className:"mailpoet-settings-label",children:v.x.I18n.t("validationStepHeading")}),(0,j.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,j.jsx)(oe.Y,{automationId:"mailpoet_import_validation_step_option1",id:"existing-list",checked:"existing-list"===r,value:"existing-list",onCheck:a}),(0,j.jsx)("label",{htmlFor:"existing-list",children:v.x.I18n.t("validationStepRadio1")})]}),(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,j.jsx)(oe.Y,{automationId:"mailpoet_import_validation_step_option2",id:"address-book",checked:"address-book"===r,value:"address-book",onCheck:a}),(0,j.jsx)("label",{htmlFor:"address-book",children:v.x.I18n.t("validationStepRadio2")})]})]}),(0,j.jsx)(Po,{canGoNext:void 0!==r,onPreviousAction:()=>n.push("step_method_selection"),onNextAction:()=>t(r)})]})}function Ho(){return(0,j.jsxs)("div",{className:"mailpoet-clean-list-step-container","data-automation-id":"import_wrong_source_block",children:[(0,j.jsx)("p",{children:v.x.I18n.t("validationStepBlock1")}),(0,j.jsx)("p",{children:v.x.I18n.t("validationStepBlock2")}),(0,j.jsx)("p",{children:(0,j.jsx)(O.z,{href:"https://kb.mailpoet.com/article/269-reconfirm-subscribers-to-your-list",target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("validationStepBlockButton")})})]})}function zo(e){let{onSubmit:t}=e;const[n,r]=(0,w.useState)("over2years"),a=(0,w.useCallback)((e=>{r(e.target.value)}),[r]),s=(0,w.useCallback)((()=>{t("over2years"===n||"1to2years"===n?"notRecently":"recently")}),[t,n]);return(0,j.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,j.jsx)("div",{className:"mailpoet-settings-label",children:v.x.I18n.t("validationStepLastSentHeading")}),(0,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsxs)(se.P,{defaultValue:n,onChange:a,automationId:"last_sent_to_list",children:[(0,j.jsx)("option",{value:"over2years",children:v.x.I18n.t("validationStepLastSentOption1")}),(0,j.jsx)("option",{value:"1to2years",children:v.x.I18n.t("validationStepLastSentOption2")}),(0,j.jsx)("option",{value:"less1year",children:v.x.I18n.t("validationStepLastSentOption3")}),(0,j.jsx)("option",{value:"less3months",children:v.x.I18n.t("validationStepLastSentOption4")})]})}),(0,j.jsx)("div",{className:"mailpoet-settings-save",children:(0,j.jsx)(O.z,{type:"button",automationId:"last_sent_to_list_next",onClick:s,children:v.x.I18n.t("validationStepLastSentNext")})})]})}function Ko(e){let{stepMethodSelectionData:t,history:n}=e;const[r,a]=(0,w.useState)(void 0),[s,i]=(0,w.useState)(void 0);(0,w.useEffect)((()=>{void 0===t&&n.replace("step_method_selection")}),[t,n]);const o=(0,w.useCallback)((e=>{i(e),"recently"===e&&n.push("step_data_manipulation")}),[n,i]);return(0,j.jsxs)(j.Fragment,{children:[void 0===r&&(0,j.jsx)(Bo,{onSubmit:a,history:n}),"address-book"===r&&(0,j.jsx)(Ho,{}),"existing-list"===r&&void 0===s&&(0,j.jsx)(zo,{onSubmit:o}),"existing-list"===r&&"notRecently"===s&&(0,j.jsx)(Yo,{})]})}Bo.propTypes={history:f().shape({push:f().func.isRequired}).isRequired,onSubmit:f().func.isRequired},zo.propTypes={onSubmit:f().func.isRequired},Ko.propTypes={history:f().shape({push:f().func.isRequired,replace:f().func.isRequired}).isRequired,stepMethodSelectionData:f().shape({duplicate:f().arrayOf(f().string),header:f().arrayOf(f().string),invalid:f().arrayOf(f().string),role:f().arrayOf(f().string),subscribersCount:f().number,subscribers:f().arrayOf(f().arrayOf(f().string))})},Ko.defaultProps={stepMethodSelectionData:void 0};const Go=(0,c.withRouter)(Ko),Qo=e=>{let{translation:t,subscribers:n}=e,r="";return n.length&&(r=C()(t.replace("%2$s",n.join(", ")),"%1$s",(()=>(0,j.jsx)("strong",{children:n.length.toLocaleString()},t))),r=(0,j.jsx)("p",{children:r})),r};function Xo(e){let{stepMethodSelectionData:t}=e;const{invalid:n,duplicate:r,role:a}=t,[s,i]=(0,w.useState)(!1),o=u()("mailpoet_subscribers_data_parse_results_details",{mailpoet_hidden:!s}),l=(0,j.jsx)(Qo,{translation:v.x.I18n.t("importNoticeInvalid"),subscribers:n}),c=(0,j.jsx)(Qo,{translation:v.x.I18n.t("importNoticeDuplicate"),subscribers:r});let d="";if(a.length&&(d=C()(v.x.I18n.t("importNoticeRoleBased"),/(%1\$s|\[link\].*\[\/link\]|%2\$s)/,(e=>"%1$s"===e?(0,j.jsx)("strong",{children:a.length.toLocaleString()},"role-length"):"%2$s"===e?a.join(", "):(0,j.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,j.jsx)("p",{children:d})),n.length||r.length||a.length){const e=n.length+r.length+a.length;return(0,j.jsxs)("div",{className:"error",children:[(0,j.jsxs)("p",{children:[C()(v.x.I18n.t("importNoticeSkipped"),"%1$s",(()=>(0,j.jsx)("strong",{children:e.toLocaleString()},"lengths")))," ",(0,j.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:v.x.I18n.t("showMoreDetails")})]}),(0,j.jsxs)("div",{className:o,children:[(0,j.jsx)("hr",{}),l,c,d]})]})}return null}function Jo(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,j.jsxs)("tr",{children:[(0,j.jsx)("th",{children:v.x.I18n.t("matchData")}),r.map(((e,t)=>(0,j.jsx)("th",{children:(0,j.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 el(e){let{header:t}=e;return(0,j.jsxs)("tr",{className:"mailpoet_header",children:[(0,j.jsx)("td",{}),t.map((e=>(0,j.jsx)("td",{children:e},e)))]})}function tl(e){let{subscriber:t,index:n}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("td",{children:n}),t.map(((e,t)=>(0,j.jsx)("td",{children:e},`${e}-${n}-${t}`)))]})}function nl(e){let{subscribers:t,subscribersCount:n}=e;const r=". . .",a=Array(t[0].length).fill(r);return(0,j.jsxs)(j.Fragment,{children:[t.slice(0,10).map(((e,t)=>(0,j.jsx)("tr",{children:(0,j.jsx)(tl,{subscriber:e,index:t+1})},`${e[0]}-${t}`))),n>11?(0,j.jsx)("tr",{children:(0,j.jsx)(tl,{subscriber:a,index:r})},"filler"):null,n>10?(0,j.jsx)("tr",{children:(0,j.jsx)(tl,{subscriber:t[n-1],index:n})},t[n-1][0]):null]})}function rl(e){let{subscribersCount:t,subscribers:n,header:r}=e;return(0,w.useLayoutEffect)((()=>{(()=>{const e={data:window.mailpoetColumnsSelect2,width:"15em"};m()("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(),m()(n).select2("close"),v.x.Modal.popup({title:v.x.I18n.t("addNewField"),template:m()("#form_template_field_form").html()}),m()("#form_field_new").parsley().on("form:submit",(()=>{const t=m()("#form_field_new").mailpoetSerializeObject();return v.x.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:v.x.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(r),window.mailpoetColumns.push(r),m()("select.mailpoet_subscribers_column_data_match").each((()=>{m()(n).html("").select2("destroy").select2(e)})),m()(n).data("column-id",r.id),v.x.Modal.close()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#field_name"})})),!1}))):m()("select.mailpoet_subscribers_column_data_match").each((()=>{const e=n,a=m()(e).val();a===r&&"ignore"!==a&&(confirm(`${v.x.I18n.t("selectedValueAlreadyMatched")} ${v.x.I18n.t("confirmCorrespondingColumn")}`)?m()(e).data("column-id","ignore"):(t.preventDefault(),m()(n).select2("close")))}))})).on("select2:select",(e=>{const t=e.currentTarget,n=e.params.data.id;m()(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()})),m().map(m()(".mailpoet_subscribers_column_data_match"),(e=>{const t=m()(e).data("column-id");m()(e).val(t).trigger("change")}))})()})),(0,j.jsx)("div",{className:"subscribers_data",children:(0,j.jsxs)("table",{className:"mailpoet_subscribers widefat fixed",children:[(0,j.jsx)("thead",{children:(0,j.jsx)(Jo,{header:r,subscribers:n})}),(0,j.jsxs)("tbody",{children:[r?(0,j.jsx)(el,{header:r}):null,(0,j.jsx)(nl,{subscribers:n,subscribersCount:t})]})]})})}function al(e){let{setSelectedSegments:t}=e;const{segments:n}=(0,w.useContext)(Ce.k),{all:r,updateAll:a}=n,[s,i]=(0,w.useState)(r);(0,w.useLayoutEffect)((()=>{!function(e,n){const r=m()("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=m()('[data-id="notice_segmentSelection"]');e.currentTarget.value?m()('[data-id="notice_segmentSelection"]').remove():n.length||v.x.Notice.error(v.x.I18n.t("segmentSelectionRequired"),{static:!0,scroll:!0,id:"notice_segmentSelection",hideClose:!0});(e=>{t(e)})(_.ZP.pluck(r.select2("data"),"id"))}))}(s)}),[s,t]);const o=e=>{!function(){const e=m()("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,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet-settings-label",children:(0,j.jsxs)("label",{htmlFor:"mailpoet_segments_select",children:[v.x.I18n.t("pickLists"),(0,j.jsx)("p",{className:"description",children:v.x.I18n.t("pickListsDescription")})]})}),(0,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,j.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,j.jsx)("select",{id:"mailpoet_segments_select","data-placeholder":v.x.I18n.t("select"),multiple:"multiple",children:(0,j.jsx)("option",{})})}),(0,j.jsx)(O.z,{variant:"tertiary",onClick:()=>{return e=o,v.x.Modal.popup({title:v.x.I18n.t("addNewList"),template:m()("#new_segment_template").html()}),m()("#new_segment_name").on("keypress",(e=>{13===e.which&&m()("#new_segment_process").trigger("click")})),m()("#new_segment_process").on("click",(()=>{const t=m()("#new_segment_name").val().trim(),n=m()("#new_segment_description").val().trim();v.x.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}),v.x.Modal.close()})).fail((e=>{e.errors.length>0&&(v.x.Notice.hide(),v.x.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#new_segment_name"}))}))})),void m()("#new_segment_cancel").on("click",(()=>{v.x.Modal.close()}));var e},children:v.x.I18n.t("createANewList")})]})})]})}function sl(){return(0,j.jsx)("p",{className:"description",children:C()(v.x.I18n.t("consentSubscribed"),/\[link](.*?)\[\/link]/,(e=>(0,j.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 il(e){let{newSubscribersStatus:t,setNewSubscribersStatus:n}=e;const r=(0,w.useCallback)((e=>{n(e.target.value)}),[n]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,j.jsx)("label",{htmlFor:"new_subscribers_status",children:v.x.I18n.t("newSubscribersStatus")}),(0,j.jsx)(sl,{})]}),(0,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsxs)(se.P,{id:"new_subscribers_status",placeholder:v.x.I18n.t("select"),name:"new_subscribers_status",onChange:r,defaultValue:t,children:[(0,j.jsx)("option",{value:"subscribed",children:v.x.I18n.t("subscribed")}),(0,j.jsx)("option",{value:"inactive",children:v.x.I18n.t("inactive")}),(0,j.jsx)("option",{value:"unsubscribed",children:v.x.I18n.t("unsubscribed")})]})})]})}function ol(e){let{existingSubscribersStatus:t,setExistingSubscribersStatus:n}=e;const r=(0,w.useCallback)((e=>{n(e.target.value)}),[n]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,j.jsx)("label",{htmlFor:"existing_subscribers_status",children:v.x.I18n.t("existingSubscribersStatus")}),(0,j.jsx)(sl,{})]}),(0,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsxs)(se.P,{id:"existing_subscribers_status",placeholder:v.x.I18n.t("select"),name:"existing_subscribers_status",onChange:r,defaultValue:t,children:[(0,j.jsx)("option",{value:"dont_update",children:v.x.I18n.t("dontUpdate")}),(0,j.jsx)("option",{value:"subscribed",children:v.x.I18n.t("subscribed")}),(0,j.jsx)("option",{value:"inactive",children:v.x.I18n.t("inactive")}),(0,j.jsx)("option",{value:"unsubscribed",children:v.x.I18n.t("unsubscribed")})]})})]})}function ll(e){let{updateExistingSubscribers:t,setUpdateExistingSubscribers:n}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet-settings-label",children:v.x.I18n.t("updateExistingSubscribers")}),(0,j.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,j.jsx)(oe.Y,{id:"update_existing_subscribers",name:"update_existing_subscribers",value:"1",checked:t,onCheck:()=>n(!0)}),(0,j.jsx)("label",{htmlFor:"update_existing_subscribers",children:v.x.I18n.t("updateExistingSubscribersYes")}),(0,j.jsx)("span",{className:"mailpoet-gap"}),(0,j.jsx)(oe.Y,{id:"dont_update_existing_subscribers",name:"update_existing_subscribers",value:"",checked:!t,onCheck:()=>n(!1)}),(0,j.jsx)("label",{htmlFor:"dont_update_existing_subscribers",children:v.x.I18n.t("updateExistingSubscribersNo")})]})]})}function cl(e){let{history:t,stepMethodSelectionData:n,subscribersLimitForValidation:r,setStepDataManipulationData:a}=e;const[s,i]=(0,w.useState)([]),[o,l]=(0,w.useState)(!0),[c,d]=(0,w.useState)("subscribed"),[u,p]=(0,w.useState)("dontUpdate");return(0,w.useEffect)((()=>{void 0===n&&t.replace("step_method_selection")}),[n,t]),void 0===n?null:(0,j.jsxs)("div",{"data-automation-id":"import_data_manipulation_step",children:[(0,j.jsx)(Xo,{stepMethodSelectionData:n}),(0,j.jsx)(rl,{subscribersCount:n.subscribersCount,subscribers:n.subscribers,header:n.header}),(0,j.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,j.jsx)(al,{setSelectedSegments:i}),(0,j.jsx)(il,{newSubscribersStatus:c,setNewSubscribersStatus:d}),(0,j.jsx)(ol,{existingSubscribersStatus:u,setExistingSubscribersStatus:p}),(0,j.jsx)(ll,{setUpdateExistingSubscribers:l,updateExistingSubscribers:o}),(0,j.jsx)(Po,{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(m().AsyncQueue);let d=0;const u=Date.now()/1e3,p={created:0,updated:0,errors:[],segments:[]};v.x.Modal.loading(!0);const h=(2e3,e.reduce(((e,t,n)=>(n%2e3==0&&e.push([]),e[e.length-1].push(t),e)),[]));_.ZP.each(m()("select.mailpoet_subscribers_column_data_match"),((e,t)=>{const n=m()(e).data("column-id");"ignore"!==n&&(l[n]={index:t})})),_.ZP.each(h,(()=>{c.add((e=>{e.pause(),v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processImport",data:JSON.stringify({columns:l,subscribers:h[d],timestamp:u,segments:n,newSubscribersStatus:r,existingSubscribersStatus:s,updateSubscribers:i})}).done((t=>{const n=t.data.added_to_segment_with_welcome_notification;p.created+=t.data.created,p.updated+=t.data.updated,p.segments=t.data.segments,p.added_to_segment_with_welcome_notification=n,e.run()})).fail((e=>{v.x.Modal.loading(!1),e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),d+=1}))})),c.run(),c.onComplete((()=>{v.x.Modal.loading(!1),p.errors.length>0&&!p.updated&&!p.created?v.x.Notice.error(_.ZP.flatten(p.errors)):(p.segments=_.ZP.map(_.ZP.filter(p.segments,(e=>n.includes(e.id))),(e=>e.name)),a(p),t.push("step_results"))}))})(n.subscribers,s,c,u,o)},isLastStep:!0})]})]})}Qo.propTypes={translation:f().string.isRequired,subscribers:f().arrayOf(f().string).isRequired},Xo.propTypes={stepMethodSelectionData:f().shape({duplicate:f().arrayOf(f().string),invalid:f().arrayOf(f().string),role:f().arrayOf(f().string)})},Xo.defaultProps={stepMethodSelectionData:{invalid:[],duplicate:[],role:[]}},Jo.propTypes={subscribers:f().arrayOf(f().arrayOf(f().oneOfType([f().string,f().number]))).isRequired,header:f().arrayOf(f().string)},Jo.defaultProps={header:[]},el.propTypes={header:f().arrayOf(f().string).isRequired},tl.propTypes={subscriber:f().arrayOf(f().oneOfType([f().string,f().number])).isRequired,index:f().node.isRequired},nl.propTypes={subscribersCount:f().number.isRequired,subscribers:f().arrayOf(f().arrayOf(f().oneOfType([f().string,f().number]))).isRequired},rl.propTypes={subscribersCount:f().number,subscribers:f().arrayOf(f().arrayOf(f().oneOfType([f().string,f().number]))),header:f().arrayOf(f().string)},rl.defaultProps={subscribersCount:0,subscribers:[],header:[]},al.propTypes={setSelectedSegments:f().func.isRequired},ll.propTypes={setUpdateExistingSubscribers:f().func.isRequired,updateExistingSubscribers:f().bool.isRequired},n(49868),cl.propTypes={history:f().shape({push:f().func.isRequired,replace:f().func.isRequired}).isRequired,stepMethodSelectionData:f().shape({duplicate:f().arrayOf(f().string),header:f().arrayOf(f().string),invalid:f().arrayOf(f().string),role:f().arrayOf(f().string),subscribersCount:f().number,subscribers:f().arrayOf(f().arrayOf(f().oneOfType([f().string,f().number])))}),subscribersLimitForValidation:f().number.isRequired,setStepDataManipulationData:f().func.isRequired},cl.defaultProps={stepMethodSelectionData:void 0};const dl=(0,c.withRouter)(cl);function ul(e){let{subscribersCount:t,segments:n,initialMessage:r}=e;if(t){let e=C()(r,"%1$s",(()=>(0,j.jsx)("strong",{children:t.toLocaleString()},"%1$s")));return e=C()(e,"%2$s",(()=>`"${n.join('", "')}"`)),(0,j.jsx)("p",{children:e})}return null}function pl(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?null:(0,j.jsx)("p",{children:v.x.I18n.t("importNoAction")})}function ml(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("p",{children:(0,j.jsx)("b",{children:v.x.I18n.t("congratulationResult")})}),(0,j.jsx)("p",{children:C()(v.x.I18n.t("suppressionListReminder"),/\[link](.*?)\[\/link]/,(e=>(0,j.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 hl(e){let{addedToSegmentWithWelcomeNotification:t}=e;return t?(0,j.jsx)("p",{children:v.x.I18n.t("importNoWelcomeEmail")}):null}function fl(e){let{errors:t,createdSubscribers:n,updatedSubscribers:r,segments:a,addedToSegmentWithWelcomeNotification:s,history:i}=e;return(0,w.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&&v.x.Notice.error(_.ZP.flatten(t)),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"updated",children:[(0,j.jsx)(ul,{subscribersCount:n,segments:a,initialMessage:v.x.I18n.t("subscribersCreated")}),(0,j.jsx)(ul,{subscribersCount:r,segments:a,initialMessage:v.x.I18n.t("subscribersUpdated")}),(0,j.jsx)(pl,{createdSubscribers:n,updatedSubscribers:r}),(0,j.jsx)(hl,{addedToSegmentWithWelcomeNotification:s})]}),(0,j.jsx)(ml,{createdSubscribers:n,updatedSubscribers:r}),(0,j.jsx)("div",{className:"mailpoet-settings-grid",children:(0,j.jsxs)("div",{className:"mailpoet-settings-save",children:[(0,j.jsx)(O.z,{variant:"secondary",type:"button",onClick:()=>i.push("step_method_selection"),children:v.x.I18n.t("importAgain")}),(0,j.jsx)(O.z,{type:"button",onClick:()=>{window.location.href="admin.php?page=mailpoet-subscribers"},children:v.x.I18n.t("viewSubscribers")})]})})]})}ul.propTypes={segments:f().arrayOf(f().string.isRequired),subscribersCount:f().number,initialMessage:f().string},ul.defaultProps={segments:[],subscribersCount:0,initialMessage:""},pl.propTypes={createdSubscribers:f().number,updatedSubscribers:f().number},pl.defaultProps={createdSubscribers:0,updatedSubscribers:0},ml.propTypes={createdSubscribers:f().number,updatedSubscribers:f().number},ml.defaultProps={createdSubscribers:0,updatedSubscribers:0},hl.propTypes={addedToSegmentWithWelcomeNotification:f().bool},hl.defaultProps={addedToSegmentWithWelcomeNotification:!1},fl.propTypes={history:f().shape({push:f().func.isRequired,replace:f().func.isRequired}).isRequired,errors:f().arrayOf(f().string.isRequired),segments:f().arrayOf(f().string.isRequired),createdSubscribers:f().number,updatedSubscribers:f().number,addedToSegmentWithWelcomeNotification:f().bool},fl.defaultProps={errors:[],segments:void 0,createdSubscribers:void 0,updatedSubscribers:void 0,addedToSegmentWithWelcomeNotification:void 0};const gl=(0,c.withRouter)(fl);function xl(e){let{history:t}=e;return(0,j.jsx)(Yo,{onProceed:()=>t.push("step_method_selection")})}const vl=document.getElementById("import_container");function bl(){const[e,t]=(0,w.useState)(void 0),[n,r]=(0,w.useState)({}),a=(0,Ce.S)(window);return(0,j.jsx)(Ce.k.Provider,{value:a,children:(0,j.jsxs)(l.UT,{children:[(0,j.jsx)(Me.w,{}),(0,j.jsx)(Ro,{children:(0,j.jsxs)(c.Switch,{children:[(0,j.jsx)(c.Route,{path:"/step_clean_list",render:e=>(0,j.jsx)(xl,{...e})}),(0,j.jsx)(c.Route,{path:"/step_method_selection",render:e=>(0,j.jsx)(Wo,{...e,setStepMethodSelectionData:t,subscribersLimitForValidation:100})}),(0,j.jsx)(c.Route,{path:"/step_input_validation",render:t=>(0,j.jsx)(Go,{...t,stepMethodSelectionData:e})}),(0,j.jsx)(c.Route,{path:"/step_data_manipulation",render:t=>(0,j.jsx)(dl,{...t,stepMethodSelectionData:e,subscribersLimitForValidation:100,setStepDataManipulationData:r})}),(0,j.jsx)(c.Route,{path:"/step_results",render:e=>(0,j.jsx)(gl,{...e,errors:n.errors,createdSubscribers:n.created,updatedSubscribers:n.updated,segments:n.segments,addedToSegmentWithWelcomeNotification:n.added_to_segment_with_welcome_notification})}),(0,j.jsx)(c.Route,{path:"*",render:()=>(0,j.jsx)(c.Redirect,{to:"/step_clean_list"})})]})})]})})}vl&&o().render((0,j.jsx)(bl,{}),vl);var yl=n(19675),wl=n.n(yl),_l=n(56692);function jl(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("welcomeWizardLetsStartTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("p",{children:v.x.I18n.t("welcomeWizardSenderText")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("form",{id:"mailpoet_sender_form",onSubmit:t=>{t.preventDefault(),m()("#mailpoet_sender_form").parsley().validate()&&e.submit_sender()},children:[(0,j.jsxs)(bt.r.TwoColumns,{children:[(0,j.jsxs)("label",{htmlFor:"senderName",children:[(0,j.jsx)("span",{className:"mailpoet-wizard-label",children:v.x.I18n.t("senderName")}),(0,j.jsx)(te.I,{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,j.jsxs)("label",{htmlFor:"senderAddress",children:[(0,j.jsx)("span",{className:"mailpoet-wizard-label",children:v.x.I18n.t("senderAddress")}),(0,j.jsx)(te.I,{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,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)(O.z,{isFullWidth:!0,type:"submit",withSpinner:e.loading,children:v.x.I18n.t("continue")}),(0,j.jsx)(O.z,{href:"#finish",isDisabled:e.loading,isFullWidth:!0,onClick:e.finish,variant:"tertiary",children:v.x.I18n.t("finishLater")})]})]})}function Il(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("welcomeWizardLetsStartTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("p",{children:v.x.I18n.t("welcomeWizardSenderMigratedUserText")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)(g.Button,{isFullWidth:!0,onClick:e.next,type:"button",children:v.x.I18n.t("continue")})]})}function Sl(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("welcomeWizardEmailCourseTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("p",{children:v.x.I18n.t("welcomeWizardEmailCourseText")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.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,j.jsx)(g.Button,{isFullWidth:!0,onClick:e.next,type:"button",children:v.x.I18n.t("continue")})]})}m()(document).ready((()=>{let e;if(!m()("#mailpoet_subscribers_export").length)return;if(!window.exportData.segments)return;const t=wl().compile(m()("#mailpoet_subscribers_export_template").html());function n(t){const n="mailpoet-disabled";"on"===t?e.removeClass(n):e.addClass(n)}m()("#mailpoet-export").html(t(window.exportData));const r=m()("#export_lists"),a=m()("#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;_.ZP.contains(r,n)&&(t.preventDefault(),"deselect"===n?m()(t.target).val("").trigger("change"):(a=[],_.ZP.each(e.find("option"),(e=>{const t=e.value;_.ZP.contains(r,t)||a.push(t)})),m()(t.target).val(a).trigger("change")),m()(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=m()("#mailpoet-export-button"),window.segments.forEach((e=>{r.append(m()("<option></option>").attr("value",e.id).text(e.name))})),window.subscriberFieldsSelect2.forEach((e=>{e.text=e.name,e.children.forEach((e=>{e.name=(0,_l.r)(e.name),e.text=(0,_l.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(m()(e.target).hasClass("mailpoet-disabled"))return;v.x.Modal.loading(!0);const t=m()(':radio[name="option_format"]:checked').val();v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"ImportExport",action:"processExport",data:JSON.stringify({export_format_option:t,segments:!!window.exportData.segments&&r.val(),subscriber_fields:a.val()})}).always((()=>{v.x.Modal.loading(!1)})).done((e=>{const n=v.x.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>");m()("#export_result_notice").html(`<p>${n}</p>`).show(),window.location.href=e.data.exportFileURL,v.x.trackEvent("Subscribers export completed",{"Total exported":e.data.totalExported,"File Format":t})})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}))})),jl.propTypes={finish:f().func.isRequired,loading:f().bool.isRequired,update_sender:f().func.isRequired,submit_sender:f().func.isRequired,sender:f().shape({name:f().string,address:f().string})},jl.defaultProps={sender:null},Il.propTypes={next:f().func.isRequired},Sl.propTypes={next:f().func.isRequired};const Cl=(0,j.jsx)("svg",{width:"13",height:"11",viewBox:"0 0 13 11",children:(0,j.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"})}),Tl=(0,j.jsx)("svg",{width:"17",height:"16",viewBox:"0 0 17 16",children:(0,j.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"})});function kl(e){let{onCheck:t,showError:n,checked:r,automationId:a,...s}=e;return(0,j.jsxs)("div",{className:u()({"mailpoet-form-yesno":!0,"mailpoet-form-yesno-error":n,"mailpoet-disabled":s.disabled}),"data-automation-id":a,children:[(0,j.jsxs)("label",{children:[(0,j.jsx)("input",{type:"radio",checked:!0===r,onChange:()=>t(!0),...s}),(0,j.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-yes",children:Cl})]}),(0,j.jsxs)("label",{children:[(0,j.jsx)("input",{type:"radio",checked:!1===r,onChange:()=>t(!1),...s}),(0,j.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-no",children:Tl})]})]})}function Nl(e){let{loading:t,submitForm:n}=e;const[r,a]=(0,w.useState)({tracking:void 0,libs3rdParty:void 0});return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("welcomeWizardUsageTrackingStepTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("p",{children:v.x.I18n.t("welcomeWizardTrackingText")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)(fe.X,{level:5,children:v.x.I18n.t("welcomeWizardUsageTrackingStepSubTitle")}),(0,j.jsx)(bt.r.TwoColumnsList,{children:(0,j.jsxs)(qn,{children:[(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardTrackingList1")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardTrackingList2")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardTrackingList3")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardTrackingList4")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardTrackingList5")})]})}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("form",{onSubmit:function(e){return e.preventDefault(),n(r.tracking,r.libs3rdParty),!1},children:[(0,j.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,j.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,j.jsx)(kl,{onCheck:e=>{const t={tracking:e,libs3rdParty:r.libs3rdParty};e&&(t.libs3rdParty=e),a(t)},checked:r.tracking,name:"mailpoet_tracking"})}),(0,j.jsxs)("div",{children:[(0,j.jsxs)("p",{children:[v.x.I18n.t("welcomeWizardUsageTrackingStepTrackingLabel")," ",(0,j.jsx)("a",{href:"https://kb.mailpoet.com/article/130-sharing-your-data-with-us","data-beacon-article":"57ce0aaac6979108399a0454",target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("welcomeWizardTrackingLink")})]}),(0,j.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,j.jsx)("span",{children:v.x.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNoteNote")}),v.x.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNote")]})]})]}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,j.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,j.jsx)(kl,{onCheck:e=>{const t={libs3rdParty:e,tracking:r.tracking};e||(t.tracking=e),a(t)},checked:r.libs3rdParty,name:"mailpoet_libs_3rdParty"})}),(0,j.jsxs)("div",{children:[(0,j.jsxs)("p",{children:[v.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabel")," ",(0,j.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:v.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLink")})]}),(0,j.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,j.jsx)("span",{children:v.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNoteNote")}),v.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNote")]})]})]}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)(O.z,{isFullWidth:!0,type:"submit",withSpinner:t,disabled:t,children:v.x.I18n.t("continue")})]})]})}function Dl(e){let{children:t}=e;return(0,j.jsx)("div",{className:"mailpoet-steps-content",children:t})}function El(e){const[t,n]=(0,w.useState)(null),[r,a]=(0,w.useState)(null),[s,i]=(0,w.useState)(!1),o=e.isWizardStep?v.x.I18n.t("wooCommerceSetupFinishButtonTextWizard"):v.x.I18n.t("wooCommerceSetupFinishButtonTextStandalone");let l;return"subscribed"===r&&(l=!0),"unsubscribed"===r&&(l=!1),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(g.TypographyHeading,{level:1,children:v.x.I18n.t("wooCommerceSetupTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("p",{children:v.x.I18n.t("wooCommerceSetupInfo")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("form",{onSubmit:n=>(n.preventDefault(),i(!0),null===r||null===t||e.submitForm(r,"true"===t),!1),children:[(0,j.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,j.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,j.jsx)(kl,{showError:s&&null===r,checked:l,onCheck:e=>a(e?"subscribed":"unsubscribed"),name:"mailpoet_woocommerce_import_type",automationId:"woocommerce_import_type"})}),(0,j.jsxs)("div",{children:[(0,j.jsx)("p",{children:C()(v.x.I18n.t("wooCommerceSetupImportInfo"),/\[link\](.*?)\[\/link\]/,(e=>(0,j.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,j.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,j.jsx)("span",{children:"GDPR"}),v.x.I18n.t("wooCommerceSetupImportGDPRInfo")]})]})]}),(0,j.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,j.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,j.jsx)(kl,{showError:s&&null===t,checked:t,onCheck:e=>n(e),name:"mailpoet_woocommerce_tracking",automationId:"woocommerce_tracking"})}),(0,j.jsxs)("div",{children:[(0,j.jsx)("p",{children:C()(v.x.I18n.t("wooCommerceSetupTrackingInfo"),/\[link\](.*?)\[\/link\]/,(e=>(0,j.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,j.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,j.jsx)("span",{children:"GDPR"}),v.x.I18n.t("wooCommerceSetupTrackingGDPRInfo")]})]})]}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)(g.Button,{isFullWidth:!0,type:"submit",withSpinner:e.loading,disabled:e.loading,automationId:"submit_woocommerce_setup",children:o})]})]})}function Ol(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet-wizard-logo",children:(0,j.jsx)("img",{src:window.mailpoet_logo_url,width:"160",height:"50",alt:"MailPoet logo"})}),(0,j.jsx)(Fn,{illustrationUrl:e.illustrationUrl,children:e.children})]})}function Rl(e){let{isWizardStep:t=!1}=e;const[n,r]=(0,w.useState)(!1),a=e=>{r(!1),v.x.Notice.showApiErrorNotice(e,{scroll:!0})},s=()=>v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"setupWooCommerceInitialImport"}).fail(a),i=()=>{window.location=window.finish_wizard_url},o=(0,j.jsx)(Ol,{illustrationUrl:window.wizard_woocommerce_illustration_url,children:(0,j.jsx)(El,{loading:n,submitForm:(e,t)=>{var n;r(!0);const o="basic"===(null===(n=v.x.settings.tracking)||void 0===n?void 0:n.level)?"basic":"partial";var l;(l={woocommerce_import_screen_displayed:1,"mailpoet_subscribe_old_woocommerce_customers.enabled":"subscribed"===e?1:0,"tracking.level":t?"full":o,"woocommerce.accept_cookie_revenue_tracking.set":1},v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:l}).fail(a)).then(s).then(i)},isWizardStep:t})});return t?o:(0,j.jsx)(Dl,{children:o})}Nl.propTypes={loading:f().bool.isRequired,submitForm:f().func.isRequired},El.propTypes={submitForm:f().func.isRequired,loading:f().bool.isRequired,isWizardStep:f().bool},El.defaultProps={isWizardStep:!1},Ol.propTypes={illustrationUrl:f().string.isRequired,children:f().oneOfType([f().arrayOf(f().node),f().node]).isRequired},Rl.propTypes={isWizardStep:f().bool},Rl.defaultProps={isWizardStep:!1};const Al=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})},Pl=()=>{let e=3;return window.has_mss_key_specified||(e+=1),window.is_woocommerce_active&&(e+=1),e},Ml=(e,t,n)=>{n<Pl()?e.push(`/steps/${n+1}`):t()};var Ll=n(60054);function Fl(e){const t=Pl(),n=parseInt(e.match.params.step,10),[r,a]=(0,w.useState)(!1),[s,i]=(0,w.useState)(window.sender_data);function o(){a(!0),window.location=window.finish_wizard_url}(0,w.useEffect)((()=>{(n>t||n<1)&&e.history.push("/steps/1")}),[n,t,e.history]);const l=(0,_.r$)(Ml,e.history,o);function c(e){return a(!0),v.x.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&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}const d=(0,w.useCallback)(((e,t)=>{a(!0),c({analytics:{enabled:e?"1":""},"3rd_party_libs":{enabled:t?"1":""}}).then((()=>l(n)))}),[l,n]),u=(0,w.useCallback)((e=>{i({...s,...e})}),[s]),p=(0,w.useCallback)((()=>{c(Al(s)).then((()=>l(n)))}),[l,s,n]),m=(0,w.useCallback)((e=>{e.preventDefault(),a(!0),c(Al({address:window.admin_email,name:""})).then((()=>{window.is_woocommerce_active?l(t-1):o()}))}),[l,t]),h=(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===Pl()?"WizardWooCommerceStep":"WelcomeWizardPitchMSSStep":"WelcomeWizardMigratedUserStep"})(n);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ll.R,{count:t,current:n}),(0,j.jsxs)(Dl,{children:["WelcomeWizardSenderStep"===h?(0,j.jsx)(Ol,{illustrationUrl:window.wizard_sender_illustration_url,children:(0,j.jsx)(jl,{update_sender:u,submit_sender:p,finish:m,loading:r,sender:s})}):null,"WelcomeWizardMigratedUserStep"===h?(0,j.jsx)(Ol,{illustrationUrl:window.wizard_sender_illustration_url,children:(0,j.jsx)(Il,{next:()=>l(n)})}):null,"WelcomeWizardEmailCourseStep"===h?(0,j.jsx)(Ol,{illustrationUrl:window.wizard_email_course_illustration_url,children:(0,j.jsx)(Sl,{next:()=>l(n)})}):null,"WelcomeWizardUsageTrackingStep"===h?(0,j.jsx)(Ol,{illustrationUrl:window.wizard_tracking_illustration_url,children:(0,j.jsx)(Nl,{loading:r,submitForm:d})}):null,"WelcomeWizardPitchMSSStep"===h?(0,j.jsx)(Ol,{illustrationUrl:window.wizard_MSS_pitch_illustration_url,children:(0,j.jsx)(Yn,{next:()=>l(n),subscribersCount:window.subscribers_count,mailpoetAccountUrl:window.mailpoet_account_url,purchaseUrl:v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount,v.x.currentWpUserEmail,"business",{utm_medium:"onboarding",utm_campaign:"purchase"})})}):null,"WizardWooCommerceStep"===h?(0,j.jsx)(Rl,{isWizardStep:!0}):null]})]})}function ql(){let e="/steps/1";window.location.search.includes("woocommerce-setup")&&(e="/woocommerce");const t=(0,Ce.S)(window);return(0,j.jsx)(Ce.k.Provider,{value:t,children:(0,j.jsxs)(l.UT,{children:[(0,j.jsx)(Me.w,{}),(0,j.jsxs)(c.Switch,{children:[(0,j.jsx)(c.Route,{path:"/steps/:step",component:Fl}),(0,j.jsx)(c.Route,{path:"/woocommerce",component:Rl}),(0,j.jsx)(c.Route,{render:()=>(0,j.jsx)(c.Redirect,{to:e})})]})]})})}Fl.propTypes={match:f().shape({params:f().shape({step:f().string}).isRequired}).isRequired,history:f().shape({push:f().func.isRequired}).isRequired};const $l=document.getElementById("mailpoet-wizard-container");function Ul(){const[e,t]=(0,w.useState)(null),n=(0,Ce.S)(window),r=n.notices.error;function a(a){const s=a.target.name,i=a.target.checked;v.x.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,j.jsx)("p",{children:a}))})).fail((e=>{e.errors.length>0&&r(e.errors.map((e=>(0,j.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}return(0,w.useEffect)((()=>{v.x.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,j.jsx)(j.Fragment,{children:e.errors.map((e=>(0,j.jsx)("p",{children:e.message})))}),{scroll:!0})}))}),[r]),null===e?(0,j.jsx)("p",{children:"Loading experimental features..."}):0===Object.values(e).length?(0,j.jsx)("p",{children:"There are no experimental features at the moment."}):(0,j.jsx)(Ce.k.Provider,{value:n,children:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Me.w,{}),Object.values(e).map((e=>{const t=`experimental-feature-${e.name}`;return(0,j.jsx)("div",{children:(0,j.jsxs)("label",{htmlFor:t,children:[(0,j.jsx)("input",{id:t,type:"checkbox",name:e.name,defaultChecked:e.value,onChange:a})," ",e.name]})},e.name)}))]})})}$l&&o().render((0,j.jsx)(ql,{}),$l);const Zl=document.getElementById("experimental_features_container");Zl&&o().render((0,j.jsx)(Ul,{}),Zl);var Vl=n(23520);function Wl(e){let{message:t,editing:n}=e;return n?(0,j.jsx)("textarea",{value:t,className:"mailpoet-logs-full-message",readOnly:!0}):(0,j.jsx)(j.Fragment,{children:`${t.substr(0,150)}…`})}function Yl(e){let{log:t}=e;const[n,r]=(0,w.useState)(!1);return(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{role:"gridcell",children:t.name}),(0,j.jsx)("td",{onClick:function(e){(function(e){return(e.ctrlKey||e.metaKey)&&!e.altKey})(e)&&(n||r(!0))},role:"gridcell",children:(0,j.jsx)(Wl,{message:t.message,editing:n})}),(0,j.jsx)("td",{role:"gridcell",children:v.x.Date.full(t.created_at)})]},`log-row-${t.id}`)}function Bl(e){let{logs:t,onFilter:n,originalFrom:r,originalTo:a,originalSearch:s,originalOffset:i,originalLimit:o}=e;const[l,c]=(0,w.useState)(null!=r?r:void 0),[d,u]=(0,w.useState)(null!=a?a:void 0),[p,m]=(0,w.useState)(null!=i?i:""),[h,f]=(0,w.useState)(null!=o?o:""),[x,b]=(0,w.useState)(s||""),y=(0,Qa.curry)(((e,t)=>{e(null!==t?v.x.Date.format(t,{format:"Y-m-d"}):void 0)})),_=(0,w.useCallback)((()=>{const e={};l&&(e.from=l),d&&(e.to=d),p&&""!==p.trim()&&(e.offset=p),h&&""!==h.trim()&&(e.limit=h),x&&""!==x.trim()&&(e.search=x.trim()),n(e)}),[l,h,p,x,d,n]);return(0,j.jsxs)("div",{className:"mailpoet-listing mailpoet-logs",children:[(0,j.jsxs)("div",{className:"mailpoet-listing-header",children:[(0,j.jsxs)("div",{className:"mailpoet-listing-search",children:[(0,j.jsx)("label",{htmlFor:"search_input",className:"screen-reader-text",children:v.x.I18n.t("searchLabel")}),(0,j.jsx)(g.Input,{dimension:"small",iconStart:Vl.J,type:"search",id:"search_input",name:"s",onChange:e=>b(e.target.value),value:x,placeholder:v.x.I18n.t("searchLabel")})]}),(0,j.jsxs)("div",{className:"mailpoet-listing-filters",children:[`${v.x.I18n.t("from")}:`,(0,j.jsx)(St,{dateFormat:"MMMM d, yyyy",onChange:y(c),maxDate:new Date,selected:l?(0,ps.default)(l):void 0,dimension:"small"}),`${v.x.I18n.t("to")}:`,(0,j.jsx)(St,{dateFormat:"MMMM d, yyyy",onChange:y(u),maxDate:new Date,selected:d?(0,ps.default)(d):void 0,dimension:"small"})]}),(0,j.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,j.jsx)("label",{htmlFor:"offset_input",className:"screen-reader-text",children:v.x.I18n.t("offsetLabel")}),(0,j.jsx)(g.Input,{dimension:"small",id:"offset_input",name:"o",type:"number",onChange:e=>m(e.target.value),value:p,placeholder:v.x.I18n.t("offsetLabel")})]}),(0,j.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,j.jsx)("label",{htmlFor:"limit_input",className:"screen-reader-text",children:v.x.I18n.t("limitLabel")}),(0,j.jsx)(g.Input,{dimension:"small",id:"limit_input",name:"l",type:"number",onChange:e=>f(e.target.value),value:h,placeholder:v.x.I18n.t("limitLabel")})]}),(0,j.jsx)(g.Button,{dimension:"small",onClick:_,children:v.x.I18n.t("filter")})]}),(0,j.jsxs)("table",{className:"mailpoet-listing-table widefat striped",role:"grid",children:[(0,j.jsx)("thead",{children:(0,j.jsxs)("tr",{children:[(0,j.jsx)("th",{children:v.x.I18n.t("tableHeaderName")}),(0,j.jsx)("th",{children:v.x.I18n.t("tableHeaderMessage")}),(0,j.jsx)("th",{children:v.x.I18n.t("tableHeaderCreatedOn")})]})}),(0,j.jsx)("tbody",{children:t.map((e=>(0,j.jsx)(Yl,{log:e},`log-${e.id}`)))})]})]})}const Hl=document.getElementById("mailpoet_logs_container");if(Hl){const e=new URL(window.location.href);o().render((0,j.jsx)(Bl,{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}}),Hl)}var zl=n(13651);function Kl(e){let{onRequestClose:t}=e;const[n,r]=(0,w.useState)(!1);return m()((e=>{e(document).on("click",".notice .mailpoet-js-button-fix-this",(()=>{r(!0)}))})),(0,j.jsxs)(Ce.k.Provider,{value:(0,Ce.S)(window),children:[(0,j.jsx)(Me.w,{}),n&&(0,j.jsx)(zl.d,{onRequestClose:()=>{r(!1),t()}})]})}Kl.defaultProps={onRequestClose:Qa.noop};const Gl=document.getElementById("mailpoet_set_from_address_modal");Gl&&o().render((0,j.jsx)(Kl,{onRequestClose:()=>{window.location.href.includes("?page=mailpoet-settings")&&window.location.reload()}}),Gl);const Ql=e=>(async e=>"MailPoet"!==v.x.mtaMethod||-1!==(await(async()=>"MailPoet"!==v.x.mtaMethod?[]:(await v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])()).indexOf(e))(e).then((e=>{if(!e)return v.x.Notice.error(v.x.I18n.t("mailerSendingNotResumedUnauthorized"),{scroll:!0}),v.x.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"}),!1;v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"mailer",action:"resumeSending"}).done((()=>{v.x.Notice.success(v.x.I18n.t("mailerSendingResumedNotice"))})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}));m()((e=>{e(document).on("click",".notice .mailpoet-js-button-resume-sending",(e=>{Ql(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,{Do:function(){return i},Iu:function(){return s},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"))}},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}},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)}},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 P}});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)},x=function(e,t){return m(e.getUTCHours()%12||12,t.length)},v=function(e,t){return m(e.getUTCHours(),t.length)},b=function(e,t){return m(e.getUTCMinutes(),t.length)},y=function(e,t){return m(e.getUTCSeconds(),t.length)},w=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 j(e,t){return e%60==0?(e>0?"-":"+")+m(Math.abs(e)/60,2):I(e,t)}function I(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 S={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 x(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):v(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"}):b(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):y(e,t)},S:function(e,t){return w(e,t)},X:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return j(a);case"XXXX":case"XX":return I(a);case"XXXXX":case"XXX":default:return I(a,":")}},x:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return j(a);case"xxxx":case"xx":return I(a);case"xxxxx":case"xxx":default:return I(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"+I(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"+I(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)}},C=n(97621),T=n(24262),k=n(5267),N=n(83946),D=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,E=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,O=/^'([^]*?)'?$/,R=/''/g,A=/[a-zA-Z]/;function P(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,N.Z)(u),m=null==c.firstWeekContainsDate?p:(0,N.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,N.Z)(h),g=null==c.weekStartsOn?f:(0,N.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 x=(0,i.default)(e);if(!(0,r.default)(x))throw new RangeError("Invalid time value");var v=(0,T.Z)(x),b=(0,s.Z)(x,v),y={firstWeekContainsDate:m,weekStartsOn:g,locale:d,_originalDate:x},w=l.match(E).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,C.Z[t])(e,d.formatLong,y):e})).join("").match(D).map((function(n){if("''"===n)return"'";var r=n[0];if("'"===r)return M(n);var a=S[r];if(a)return!c.useAdditionalWeekYearTokens&&(0,k.Do)(n)&&(0,k.qp)(n,t,e),!c.useAdditionalDayOfYearTokens&&(0,k.Iu)(n)&&(0,k.qp)(n,t,e),a(b,n,d.localize,y);if(r.match(A))throw new RangeError("Format string contains an unescaped latin alphabet character `"+r+"`");return n})).join("");return w}function M(e){return e.match(O)[1].replace(R,"'")}},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),x=n(59025),v=/^(1[0-2]|0?\d)/,b=/^(3[0-1]|[0-2]?\d)/,y=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,w=/^(5[0-3]|[0-4]?\d)/,_=/^(2[0-3]|[0-1]?\d)/,j=/^(2[0-4]|[0-1]?\d)/,I=/^(1[0-1]|0?\d)/,S=/^(1[0-2]|0?\d)/,C=/^[0-5]?\d/,T=/^[0-5]?\d/,k=/^\d/,N=/^\d{1,2}/,D=/^\d{1,3}/,E=/^\d{1,4}/,O=/^-?\d+/,R=/^-?\d/,A=/^-?\d{1,2}/,P=/^-?\d{1,3}/,M=/^-?\d{1,4}/,L=/^([+-])(\d{2})(\d{2})?|Z/,F=/^([+-])(\d{2})(\d{2})|Z/,q=/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,$=/^([+-])(\d{2}):(\d{2})|Z/,U=/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/;function Z(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 Z(O,e,t)}function Y(e,t,n){switch(e){case 1:return Z(k,t,n);case 2:return Z(N,t,n);case 3:return Z(D,t,n);case 4:return Z(E,t,n);default:return Z(new RegExp("^\\d{1,"+e+"}"),t,n)}}function B(e,t,n){switch(e){case 1:return Z(R,t,n);case 2:return Z(A,t,n);case 3:return Z(P,t,n);case 4:return Z(M,t,n);default:return Z(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,x.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,x.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 Z(v,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 Z(v,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 Z(w,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,x.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 Z(w,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 Z(b,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 Z(y,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 Z(S,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 Z(_,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 Z(I,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 Z(j,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 Z(C,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 Z(T,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(L,e);case"XX":return V(F,e);case"XXXX":return V(q,e);case"XXXXX":return V(U,e);case"XXX":default:return V($,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(L,e);case"xx":return V(F,e);case"xxxx":return V(q,e);case"xxxxx":return V(U,e);case"xxx":default:return V($,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 x=g.options&&g.options.firstWeekContainsDate,v=null==x?1:(0,d.Z)(x),b=null==f.firstWeekContainsDate?v:(0,d.Z)(f.firstWeekContainsDate);if(!(b>=1&&b<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=g.options&&g.options.weekStartsOn,w=null==y?0:(0,d.Z)(y),_=null==f.weekStartsOn?w:(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 j,I={firstWeekContainsDate:b,weekStartsOn:_,locale:g},S=[{priority:10,subPriority:-1,set:ie,index:0}],C=h.match(ee).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,o.Z[t])(e,g.formatLong,I):e})).join("").match(J),T=[];for(j=0;j<C.length;j++){var k=C[j];!f.useAdditionalWeekYearTokens&&(0,c.Do)(k)&&(0,c.qp)(k,h,e),!f.useAdditionalDayOfYearTokens&&(0,c.Iu)(k)&&(0,c.qp)(k,h,e);var N=k[0],D=X[N];if(D){var E=D.incompatibleTokens;if(Array.isArray(E)){for(var O=void 0,R=0;R<T.length;R++){var A=T[R].token;if(-1!==E.indexOf(A)||A===N){O=T[R];break}}if(O)throw new RangeError("The format string mustn't contain `".concat(O.fullToken,"` and `").concat(k,"` at the same time"))}else if("*"===D.incompatibleTokens&&T.length)throw new RangeError("The format string mustn't contain `".concat(k,"` and any other token at the same time"));T.push({token:N,fullToken:k});var P=D.parse(m,k,g.match,I);if(!P)return new Date(NaN);S.push({priority:D.priority,subPriority:D.subPriority||0,set:D.set,validate:D.validate,value:P.value,index:S.length}),m=P.rest}else{if(N.match(ae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");if("''"===k?k="'":"'"===N&&(k=oe(k)),0!==m.indexOf(k))return new Date(NaN);m=m.slice(k.length)}}if(m.length>0&&re.test(m))return new Date(NaN);var M=S.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 S.filter((function(t){return t.priority===e})).sort((function(e,t){return t.subPriority-e.subPriority}))})).map((function(e){return e[0]})),L=(0,s.default)(n);if(isNaN(L))return new Date(NaN);var F=(0,a.Z)(L,(0,l.Z)(L)),q={};for(j=0;j<M.length;j++){var $=M[j];if($.validate&&!$.validate(F,$.value,I))return new Date(NaN);var U=$.set(F,q,$.value,I);U[0]?(F=U[0],i(q,U[1])):F=U}return F}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),v=new Date(0);return v.setFullYear(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),v.setHours(g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds()),v}return c=x(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<=(v[t]||(b(e)?29:28))}(t,s,i)&&function(e,t){return t>=1&&t<=(b(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 x(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 v=[31,null,31,30,31,30,31,31,30,31,30,31];function b(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)}},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(w(o)&&(r.dynamicTypingFunction=o,o={}),r.dynamicTyping=o,r.transform=!!w(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=w(r.step),r.chunk=w(r.chunk),r.complete=w(r.complete),r.error=w(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&&w(n.read)&&w(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||t.escapeFormulae instanceof RegExp)&&(u=t.escapeFormulae instanceof RegExp?t.escapeFormulae:/^[=+\-@\t\r].*$/)}}();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||d),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 x=l?e[g]:g;h.push(t[d][x])}p=""===h.join("").trim()}if(!p){for(var v=0;v<u;v++){0<v&&!m&&(i+=a);var b=o&&l?e[v]:v;i+=f(t[d][b],v)}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);var r=!1;u&&"string"==typeof e&&u.test(e)&&(e="'"+e,r=!0);var s=e.toString().replace(p,l);return(r=r||!0===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}(s,i.BAD_DELIMITERS)||-1<s.indexOf(a)||" "===s.charAt(0)||" "===s.charAt(s.length-1))?o+s+o:s}}};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(w(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(w(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){w(d)&&d(e,l.file,l.inputElem),s()},i.parse(l.file,l.instanceConfig)}else w(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=b(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&&w(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(w(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||!w(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){w(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=y(this._chunkLoaded,this),t.onerror=y(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=y(this._chunkLoaded,this),t.onerror=y(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=y((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=y((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=y((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=y((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=[],x={data:[],errors:[],meta:{}};if(w(e.step)){var v=e.step;e.step=function(t){if(x=t,j())_();else{if(_(),0===x.data.length)return;d+=t.data.length,e.preview&&d>e.preview?n.abort():(x.data=x.data[0],v(x,c))}}}function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function _(){return x&&r&&(S("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+i.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(x.data=x.data.filter((function(e){return!y(e)}))),j()&&function(){if(x)if(Array.isArray(x.data[0])){for(var t=0;j()&&t<x.data.length;t++)x.data[t].forEach(n);x.data.splice(0,1)}else x.data.forEach(n);function n(t,n){w(e.transformHeader)&&(t=e.transformHeader(t,n)),g.push(t)}}(),function(){if(!x||!e.header&&!e.dynamicTyping&&!e.transform)return x;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=I(s,i),"__parsed_extra"===s?(a[s]=a[s]||[],a[s].push(i)):a[s]=i}return e.header&&(r>g.length?S("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+r,u+n):r<g.length&&S("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+r,u+n)),a}var n=1;return!x.data.length||Array.isArray(x.data[0])?(x.data=x.data.map(t),n=x.data.length):x.data=t(x.data,0),e.header&&x.meta&&(x.meta.fields=g),u+=n,x}()}function j(){return e.header&&0===g.length}function I(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 S(e,t,n,r){var a={type:e,code:t,message:n};void 0!==r&&(a.row=r),x.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)w(e.delimiter)&&(e.delimiter=e.delimiter(a),x.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 x=new f({comments:a,delimiter:p,newline:n,preview:10}).parse(t),v=0;v<x.data.length;v++)if(r&&y(x.data[v]))g++;else{var b=x.data[v].length;h+=b,void 0!==c?0<b&&(m+=Math.abs(b-c),c=b):c=b}0<x.data.length&&(h/=x.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),x.meta.delimiter=e.delimiter}var d=b(e);return e.preview&&e.header&&d.preview++,t=a,n=new f(d),x=n.parse(t,s,o),_(),p?{meta:{paused:!0}}:x||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,n.abort(),t=w(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(),x.meta.aborted=!0,w(e.complete)&&e.complete(x),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||null===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,x=a.length,v=w(s),b=[],y=[],_=[],j=d=0;if(!e)return M();if(l||!1!==l&&-1===e.indexOf(t)){for(var I=e.split(r),S=0;S<I.length;S++){if(_=I[S],d+=_.length,S!==I.length-1)d+=r.length;else if(p)return M();if(!a||_.substring(0,x)!==a){if(v){if(b=[],O(_.split(n)),L(),u)return M()}else O(_.split(n));if(o&&o<=S)return b=b.slice(0,o),M(!0)}}return M()}for(var C=e.indexOf(n,d),T=e.indexOf(r,d),k=new RegExp(h(c)+h(t),"g"),N=e.indexOf(t,d);;)if(e[d]!==t)if(a&&0===_.length&&e.substring(d,d+x)===a){if(-1===T)return M();d=T+g,T=e.indexOf(r,d),C=e.indexOf(n,d)}else if(-1!==C&&(C<T||-1===T))_.push(e.substring(d,C)),d=C+f,C=e.indexOf(n,d);else{if(-1===T)break;if(_.push(e.substring(d,T)),P(T+g),v&&(L(),u))return M();if(o&&b.length>=o)return M(!0)}else for(N=d,d++;;){if(-1===(N=e.indexOf(t,N+1)))return p||y.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:d}),A();if(N===m-1)return A(e.substring(d,N).replace(k,t));if(t!==c||e[N+1]!==c){if(t===c||0===N||e[N-1]!==c){-1!==C&&C<N+1&&(C=e.indexOf(n,N+1)),-1!==T&&T<N+1&&(T=e.indexOf(r,N+1));var D=R(-1===T?C:Math.min(C,T));if(e.substr(N+1+D,f)===n){_.push(e.substring(d,N).replace(k,t)),e[d=N+1+D+f]!==t&&(N=e.indexOf(t,d)),C=e.indexOf(n,d),T=e.indexOf(r,d);break}var E=R(T);if(e.substring(N+1+E,N+1+E+g)===r){if(_.push(e.substring(d,N).replace(k,t)),P(N+1+E+g),C=e.indexOf(n,d),N=e.indexOf(t,d),v&&(L(),u))return M();if(o&&b.length>=o)return M(!0);break}y.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:b.length,index:d}),N++}}else N++}return A();function O(e){b.push(e),j=d}function R(t){var n=0;if(-1!==t){var r=e.substring(N+1,t);r&&""===r.trim()&&(n=r.length)}return n}function A(t){return p||(void 0===t&&(t=e.substring(d)),_.push(t),d=m,O(_),v&&L()),M()}function P(t){d=t,O(_),_=[],T=e.indexOf(r,d)}function M(e){return{data:b,errors:y,meta:{delimiter:n,linebreak:r,aborted:u,truncated:!!e,cursor:j+(i||0)}}}function L(){s(M()),b=[],y=[]}},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,x(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:v,resume:v};if(w(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 w(n.userChunk)&&(n.userChunk(t.results,s,t.file),delete t.results)}t.finished&&!r&&x(t.workerId,t.results)}function x(e,t){var n=a[e];w(n.userComplete)&&n.userComplete(t),n.terminate(),delete a[e]}function v(){throw new Error("Not implemented.")}function b(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=b(e[n]);return t}function y(e,t){return function(){e.apply(t,arguments)}}function w(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,n,r,a,s,i,o,l,c,d,u,p,m,h,f,g,x,v,b,y,w,_,j,I,S,C,T,k,N,D,E,O,R,A,P,M,L,F,q,$,U,Z,V,W,Y,B,H,z,K,G,Q,X,J,ee,te,ne,re,ae,se,ie,oe,le){"use strict";function ce(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var de=ce(t),ue=ce(r),pe=ce(a),me=ce(s),he=ce(i),fe=ce(o),ge=ce(l),xe=ce(c),ve=ce(d),be=ce(u),ye=ce(p),we=ce(f),_e=ce(g),je=ce(x),Ie=ce(v),Se=ce(b),Ce=ce(y),Te=ce(w),ke=ce(_),Ne=ce(j),De=ce(I),Ee=ce(S),Oe=ce(C),Re=ce(T),Ae=ce(k),Pe=ce(N),Me=ce(D),Le=ce(E),Fe=ce(O),qe=ce(R),$e=ce(A),Ue=ce(P),Ze=ce(M),Ve=ce(L),We=ce(F),Ye=ce($),Be=ce(U),He=ce(Z),ze=ce(V),Ke=ce(W),Ge=ce(Y),Qe=ce(B),Xe=ce(K),Je=ce(G),et=ce(Q),tt=ce(X),nt=ce(J),rt=ce(ee),at=ce(te),st=ce(ne),it=ce(re),ot=ce(ae),lt=ce(se),ct=ce(ie),dt=ce(oe);function ut(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 pt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach((function(t){xt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function mt(e){return(mt="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 ht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ft(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 gt(e,t,n){return t&&ft(e.prototype,t),n&&ft(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function xt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vt(){return(vt=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 bt(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&&wt(e,t)}function yt(e){return(yt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function wt(e,t){return(wt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _t(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 _t(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=yt(e);if(t){var a=yt(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?lt.default(e):it.default(e):new Date;return At(t)?t:null}function Rt(e,t,n,r,a){var s=null,i=Xt(n)||Xt(Qt()),o=!0;return Array.isArray(t)?(t.forEach((function(t){var l=ot.default(e,t,new Date,{locale:i});r&&(o=At(l,a)&&e===Pt(l,t,n)),At(l,a)&&o&&(s=l)})),s):(s=ot.default(e,t,new Date,{locale:i}),r?o=At(s)&&e===Pt(s,t,n):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=ot.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"),me.default(e)&&!at.default(e,t)}function Pt(e,t,n){if("en"===n)return he.default(e,t,{awareOfUnicodeTokens:!0});var r=Xt(n);return n&&!r&&console.warn('A locale object was not found for the provided string ["'.concat(n,'"].')),!r&&Qt()&&Xt(Qt())&&(r=Xt(Qt())),he.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&&Xt(t)||Qt()&&Xt(Qt());return De.default(e,n?{locale:n}:null)}function qt(e,t){return Pt(e,"ddd",t)}function $t(e){return Be.default(e)}function Ut(e,t,n){var r=Xt(t||Qt());return He.default(e,{locale:r,weekStartsOn:n})}function Zt(e){return ze.default(e)}function Vt(e){return Ge.default(e)}function Wt(e){return Ke.default(e)}function Yt(e,t){return e&&t?tt.default(e,t):!e&&!t}function Bt(e,t){return e&&t?et.default(e,t):!e&&!t}function Ht(e,t){return e&&t?nt.default(e,t):!e&&!t}function zt(e,t){return e&&t?Je.default(e,t):!e&&!t}function Kt(e,t){return e&&t?Xe.default(e,t):!e&&!t}function Gt(e,t,n){var r,a=Be.default(t),s=Qe.default(n);try{r=st.default(e,{start:a,end:s})}catch(e){r=!1}return r}function Qt(){return("undefined"!=typeof window?window:globalThis).__localeId__}function Xt(e){if("string"==typeof e){var t="undefined"!=typeof window?window:globalThis;return t.__localeData__?t.__localeData__[e]:null}return e}function Jt(e,t){return Pt(Fe.default(Ot(),e),"LLLL",t)}function en(e,t){return Pt(Fe.default(Ot(),e),"LLL",t)}function tn(e,t){return Pt(qe.default(Ot(),e),"QQQ",t)}function nn(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 dn(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return zt(e,t)}))||s&&s.some((function(t){var n=t.start,r=t.end;return st.default(e,{start:n,end:r})}))||i&&!i.some((function(t){return zt(e,t)}))||o&&!o.some((function(t){var n=t.start,r=t.end;return st.default(e,{start:n,end:r})}))||l&&!l(Ot(e))||!1}function rn(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 st.default(e,{start:n,end:r})})):n&&n.some((function(t){return zt(e,t)}))||!1}function an(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 dn(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return Bt(e,t)}))||s&&!s.some((function(t){return Bt(e,t)}))||i&&!i(Ot(e))||!1}function sn(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 on(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 dn(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 ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate;return dn(new Date(e,0,1),{minDate:n,maxDate:r})||!1}function cn(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 dn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate;return n&&Ve.default(e,n)<0||r&&Ve.default(e,r)>0}function un(e,t){return t.some((function(t){return Te.default(t)===Te.default(e)&&Ce.default(t)===Ce.default(e)}))}function pn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeTimes,r=t.includeTimes,a=t.filterTime;return n&&un(e,n)||r&&!un(e,r)||a&&!a(e)||!1}function mn(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=!st.default(i,{start:o,end:l})}catch(e){a=!1}return a}function hn(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&&We.default(n,a)>0||r&&r.every((function(e){return We.default(e,a)>0}))||!1}function fn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.includeDates,a=be.default(e,1);return n&&We.default(a,n)>0||r&&r.every((function(e){return We.default(a,e)>0}))||!1}function gn(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&&Ye.default(n,a)>0||r&&r.every((function(e){return Ye.default(e,a)>0}))||!1}function xn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.includeDates,a=ye.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=e.minDate,n=e.includeDates;if(n&&t){var r=n.filter((function(e){return Ve.default(e,t)>=0}));return Ue.default(r)}return n?Ue.default(n):t}function bn(e){var t=e.maxDate,n=e.includeDates;if(n&&t){var r=n.filter((function(e){return Ve.default(e,t)<=0}));return Ze.default(r)}return n?Ze.default(n):t}function yn(){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(pe.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"===mt(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 wn(e,t,n,r,a){for(var s=a.length,i=[],o=0;o<s;o++){var l=fe.default(ge.default(e,Te.default(a[o])),Ce.default(a[o])),c=fe.default(e,(n+1)*r);rt.default(l,t)&&at.default(l,c)&&i.push(a[o])}return i}function _n(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){bt(r,e);var n=It(r);function r(e){var a;ht(this,r),xt(_t(a=n.call(this,e)),"renderOptions",(function(){var e=a.props.year,t=a.state.yearsList.map((function(t){return de.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(_t(a),t),"aria-selected":e===t?"true":void 0},e===t?de.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(de.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:a.incrementYears},de.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(de.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:a.decrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t})),xt(_t(a),"onChange",(function(e){a.props.onChange(e)})),xt(_t(a),"handleClickOutside",(function(){a.props.onCancel()})),xt(_t(a),"shiftYears",(function(e){var t=a.state.yearsList.map((function(t){return t+e}));a.setState({yearsList:t})})),xt(_t(a),"incrementYears",(function(){return a.shiftYears(1)})),xt(_t(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 gt(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=ue.default({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return de.default.createElement("div",{className:e,ref:this.dropdownRef},this.renderOptions())}}]),r}(de.default.Component),Cn=ct.default(Sn),Tn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),xt(_t(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(de.default.createElement("option",{key:a,value:a},a));return r})),xt(_t(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),xt(_t(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:e.props.year,className:"react-datepicker__year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),xt(_t(e),"renderReadView",(function(t){return de.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__year-read-view",onClick:function(t){return e.toggleDropdown(t)}},de.default.createElement("span",{className:"react-datepicker__year-read-view--down-arrow"}),de.default.createElement("span",{className:"react-datepicker__year-read-view--selected-year"},e.props.year))})),xt(_t(e),"renderDropdown",(function(){return de.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})})),xt(_t(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),xt(_t(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.year&&e.props.onChange(t)})),xt(_t(e),"toggleDropdown",(function(t){e.setState({dropdownVisible:!e.state.dropdownVisible},(function(){e.props.adjustDateOnChange&&e.handleYearChange(e.props.date,t)}))})),xt(_t(e),"handleYearChange",(function(t,n){e.onSelect(t,n),e.setOpen()})),xt(_t(e),"onSelect",(function(t,n){e.props.onSelect&&e.props.onSelect(t,n)})),xt(_t(e),"setOpen",(function(){e.props.setOpen&&e.props.setOpen(!0)})),e}return gt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return de.default.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component),kn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"isSelectedMonth",(function(t){return e.props.month===t})),xt(_t(e),"renderOptions",(function(){return e.props.monthNames.map((function(t,n){return de.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(_t(e),n),"aria-selected":e.isSelectedMonth(n)?"true":void 0},e.isSelectedMonth(n)?de.default.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",t)}))})),xt(_t(e),"onChange",(function(t){return e.props.onChange(t)})),xt(_t(e),"handleClickOutside",(function(){return e.props.onCancel()})),e}return gt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__month-dropdown"},this.renderOptions())}}]),n}(de.default.Component),Nn=ct.default(kn),Dn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),xt(_t(e),"renderSelectOptions",(function(e){return e.map((function(e,t){return de.default.createElement("option",{key:t,value:t},e)}))})),xt(_t(e),"renderSelectMode",(function(t){return de.default.createElement("select",{value:e.props.month,className:"react-datepicker__month-select",onChange:function(t){return e.onChange(t.target.value)}},e.renderSelectOptions(t))})),xt(_t(e),"renderReadView",(function(t,n){return de.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__month-read-view",onClick:e.toggleDropdown},de.default.createElement("span",{className:"react-datepicker__month-read-view--down-arrow"}),de.default.createElement("span",{className:"react-datepicker__month-read-view--selected-month"},n[e.props.month]))})),xt(_t(e),"renderDropdown",(function(t){return de.default.createElement(Nn,{key:"dropdown",month:e.props.month,monthNames:t,onChange:e.onChange,onCancel:e.toggleDropdown})})),xt(_t(e),"renderScrollMode",(function(t){var n=e.state.dropdownVisible,r=[e.renderReadView(!n,t)];return n&&r.unshift(e.renderDropdown(t)),r})),xt(_t(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.month&&e.props.onChange(t)})),xt(_t(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return gt(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 en(e,t.props.locale)}:function(e){return Jt(e,t.props.locale)});switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode(n);break;case"select":e=this.renderSelectMode(n)}return de.default.createElement("div",{className:"react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component);function En(e,t){for(var n=[],r=Zt(e),a=Zt(t);!rt.default(r,a);)n.push(Ot(r)),r=be.default(r,1);return n}var On=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"renderOptions",(function(){return r.state.monthYearsList.map((function(e){var t=Ae.default(e),n=Yt(r.props.date,e)&&Bt(r.props.date,e);return de.default.createElement("div",{className:n?"react-datepicker__month-year-option--selected_month-year":"react-datepicker__month-year-option",key:t,onClick:r.onChange.bind(_t(r),t),"aria-selected":n?"true":void 0},n?de.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Pt(e,r.props.dateFormat,r.props.locale))}))})),xt(_t(r),"onChange",(function(e){return r.props.onChange(e)})),xt(_t(r),"handleClickOutside",(function(){r.props.onCancel()})),r.state={monthYearsList:En(r.props.minDate,r.props.maxDate)},r}return gt(n,[{key:"render",value:function(){var e=ue.default({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return de.default.createElement("div",{className:e},this.renderOptions())}}]),n}(de.default.Component),Rn=ct.default(On),An=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),xt(_t(e),"renderSelectOptions",(function(){for(var t=Zt(e.props.minDate),n=Zt(e.props.maxDate),r=[];!rt.default(t,n);){var a=Ae.default(t);r.push(de.default.createElement("option",{key:a,value:a},Pt(t,e.props.dateFormat,e.props.locale))),t=be.default(t,1)}return r})),xt(_t(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),xt(_t(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:Ae.default(Zt(e.props.date)),className:"react-datepicker__month-year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),xt(_t(e),"renderReadView",(function(t){var n=Pt(e.props.date,e.props.dateFormat,e.props.locale);return de.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__month-year-read-view",onClick:function(t){return e.toggleDropdown(t)}},de.default.createElement("span",{className:"react-datepicker__month-year-read-view--down-arrow"}),de.default.createElement("span",{className:"react-datepicker__month-year-read-view--selected-month-year"},n))})),xt(_t(e),"renderDropdown",(function(){return de.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})})),xt(_t(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),xt(_t(e),"onChange",(function(t){e.toggleDropdown();var n=Ot(parseInt(t));Yt(e.props.date,n)&&Bt(e.props.date,n)||e.props.onChange(n)})),xt(_t(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return gt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return de.default.createElement("div",{className:"react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component),Pn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"dayEl",de.default.createRef()),xt(_t(e),"handleClick",(function(t){!e.isDisabled()&&e.props.onClick&&e.props.onClick(t)})),xt(_t(e),"handleMouseEnter",(function(t){!e.isDisabled()&&e.props.onMouseEnter&&e.props.onMouseEnter(t)})),xt(_t(e),"handleOnKeyDown",(function(t){" "===t.key&&(t.preventDefault(),t.key="Enter"),e.props.handleOnKeyDown(t)})),xt(_t(e),"isSameDay",(function(t){return zt(e.props.day,t)})),xt(_t(e),"isKeyboardSelected",(function(){return!e.props.disabledKeyboardNavigation&&!e.isSameDay(e.props.selected)&&e.isSameDay(e.props.preSelection)})),xt(_t(e),"isDisabled",(function(){return nn(e.props.day,e.props)})),xt(_t(e),"isExcluded",(function(){return rn(e.props.day,e.props)})),xt(_t(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)})),xt(_t(e),"isInRange",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&Gt(n,r,a)})),xt(_t(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&&(at.default(d,c)||Kt(d,c))?Gt(r,d,c):(s&&l&&(rt.default(d,l)||Kt(d,l))||!(!i||!l||c||!rt.default(d,l)&&!Kt(d,l)))&&Gt(r,l,d))})),xt(_t(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 zt(r,s?i:a)})),xt(_t(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 zt(r,s?i:a)})),xt(_t(e),"isRangeStart",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&zt(r,n)})),xt(_t(e),"isRangeEnd",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&zt(a,n)})),xt(_t(e),"isWeekend",(function(){var t=ke.default(e.props.day);return 0===t||6===t})),xt(_t(e),"isAfterMonth",(function(){return void 0!==e.props.month&&(e.props.month+1)%12===Ee.default(e.props.day)})),xt(_t(e),"isBeforeMonth",(function(){return void 0!==e.props.month&&(Ee.default(e.props.day)+1)%12===e.props.month})),xt(_t(e),"isCurrentDay",(function(){return e.isSameDay(Ot())})),xt(_t(e),"isSelected",(function(){return e.isSameDay(e.props.selected)})),xt(_t(e),"getClassNames",(function(t){var n=e.props.dayClassName?e.props.dayClassName(t):void 0;return ue.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"))})),xt(_t(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))})),xt(_t(e),"getTabIndex",(function(t,n){var r=t||e.props.selected,a=n||e.props.preSelection;return e.isKeyboardSelected()||e.isSameDay(r)&&zt(a,r)?0:-1})),xt(_t(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})})),xt(_t(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)})),xt(_t(e),"render",(function(){return de.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:"option","aria-disabled":e.isDisabled(),"aria-current":e.isCurrentDay()?"date":void 0,"aria-selected":e.isSelected()},e.renderDayContents())})),e}return gt(n,[{key:"componentDidMount",value:function(){this.handleFocusDay()}},{key:"componentDidUpdate",value:function(e){this.handleFocusDay(e)}}]),n}(de.default.Component),Mn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"handleClick",(function(t){e.props.onClick&&e.props.onClick(t)})),e}return gt(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 de.default.createElement("div",{className:ue.default(a),"aria-label":"".concat(r," ").concat(this.props.weekNumber),onClick:this.handleClick},t)}}]),n}(de.default.Component),Ln=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n)})),xt(_t(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),xt(_t(e),"handleWeekClick",(function(t,n,r){"function"==typeof e.props.onWeekSelect&&e.props.onWeekSelect(t,n,r),e.props.shouldCloseOnSelect&&e.props.setOpen(!1)})),xt(_t(e),"formatWeekNumber",(function(t){return e.props.formatWeekNumber?e.props.formatWeekNumber(t):Ft(t)})),xt(_t(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(_t(e),t,r):void 0;n.push(de.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=xe.default(t,n);return de.default.createElement(Pn,{ariaLabelPrefixWhenEnabled:e.props.chooseDayAriaLabelPrefix,ariaLabelPrefixWhenDisabled:e.props.disabledDayAriaLabelPrefix,key:r.valueOf(),day:r,month:e.props.month,onClick:e.handleDayClick.bind(_t(e),r),onMouseEnter:e.handleDayMouseEnter.bind(_t(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 gt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__week"},this.renderDays())}}],[{key:"defaultProps",get:function(){return{shouldCloseOnSelect:!0}}}]),n}(de.default.Component),Fn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"MONTH_REFS",St(Array(12)).map((function(){return de.default.createRef()}))),xt(_t(e),"isDisabled",(function(t){return nn(t,e.props)})),xt(_t(e),"isExcluded",(function(t){return rn(t,e.props)})),xt(_t(e),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n,e.props.orderInDisplay)})),xt(_t(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),xt(_t(e),"handleMouseLeave",(function(){e.props.onMouseLeave&&e.props.onMouseLeave()})),xt(_t(e),"isRangeStartMonth",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Bt(Fe.default(r,t),a)})),xt(_t(e),"isRangeStartQuarter",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Ht(qe.default(r,t),a)})),xt(_t(e),"isRangeEndMonth",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Bt(Fe.default(r,t),s)})),xt(_t(e),"isRangeEndQuarter",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Ht(qe.default(r,t),s)})),xt(_t(e),"isWeekInMonth",(function(t){var n=e.props.day,r=xe.default(t,6);return Bt(t,n)||Bt(r,n)})),xt(_t(e),"isCurrentMonth",(function(e,t){return Re.default(e)===Re.default(Ot())&&t===Ee.default(Ot())})),xt(_t(e),"isSelectedMonth",(function(e,t,n){return Ee.default(e)===t&&Re.default(e)===Re.default(n)})),xt(_t(e),"isSelectedQuarter",(function(e,t,n){return Oe.default(e)===t&&Re.default(e)===Re.default(n)})),xt(_t(e),"renderWeeks",(function(){for(var t=[],n=e.props.fixedHeight,r=0,a=!1,s=Ut(Zt(e.props.day),e.props.locale,e.props.calendarStartDay);t.push(de.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=ve.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})),xt(_t(e),"onMonthClick",(function(t,n){e.handleDayClick(Zt(Fe.default(e.props.day,n)),t)})),xt(_t(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())})),xt(_t(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,be.default(e.props.preSelection,1));break;case"ArrowLeft":e.handleMonthNavigation(0===n?11:n-1,je.default(e.props.preSelection,1))}})),xt(_t(e),"onQuarterClick",(function(t,n){e.handleDayClick(Wt(qe.default(e.props.day,n)),t)})),xt(_t(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 ue.default("react-datepicker__month-text","react-datepicker__month-".concat(t),u,{"react-datepicker__month--disabled":(o||l)&&an(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":sn(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)})})),xt(_t(e),"getTabIndex",(function(t){var n=Ee.default(e.props.preSelection);return e.props.disabledKeyboardNavigation||t!==n?"-1":"0"})),xt(_t(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"))})),xt(_t(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 ue.default("react-datepicker__quarter-text","react-datepicker__quarter-".concat(t),{"react-datepicker__quarter--disabled":(o||l)&&on(qe.default(r,t),e.props),"react-datepicker__quarter--selected":e.isSelectedQuarter(r,t,i),"react-datepicker__quarter--in-range":cn(a,s,t,r),"react-datepicker__quarter--range-start":e.isRangeStartQuarter(t),"react-datepicker__quarter--range-end":e.isRangeEndQuarter(t)})})),xt(_t(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 de.default.createElement("div",{className:"react-datepicker__month-wrapper",key:r},t.map((function(t,r){return de.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:"option","aria-label":e.getAriaLabel(t),"aria-current":e.isCurrentMonth(i,t)?"date":void 0,"aria-selected":e.isSelectedMonth(i,t,o)},n?Jt(t,s):en(t,s))})))}))})),xt(_t(e),"renderQuarters",(function(){var t=e.props,n=t.day,r=t.selected;return de.default.createElement("div",{className:"react-datepicker__quarter-wrapper"},[1,2,3,4].map((function(t,a){return de.default.createElement("div",{key:a,role:"option",onClick:function(n){e.onQuarterClick(n,t)},className:e.getQuarterClassNames(t),"aria-selected":e.isSelectedQuarter(n,t,r)},tn(t,e.props.locale))})))})),xt(_t(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 ue.default("react-datepicker__month",{"react-datepicker__month--selecting-range":n&&(r||a)},{"react-datepicker__monthPicker":s},{"react-datepicker__quarterPicker":i})})),e}return gt(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 de.default.createElement("div",{className:this.getClassNames(),onMouseLeave:this.handleMouseLeave,"aria-label":"".concat(s," ").concat(Pt(r,"yyyy-MM")),role:"listbox"},t?this.renderMonths():n?this.renderQuarters():this.renderWeeks())}}]),n}(de.default.Component),qn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{height:null}),xt(_t(e),"handleClick",(function(t){(e.props.minTime||e.props.maxTime)&&mn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&pn(t,e.props)||e.props.onChange(t)})),xt(_t(e),"isSelectedTime",(function(t,n,r){return e.props.selected&&n===Te.default(t)&&r===Ce.default(t)})),xt(_t(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)&&mn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&pn(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(" ")})),xt(_t(e),"handleOnKeyDown",(function(t,n){" "===t.key&&(t.preventDefault(),t.key="Enter"),"Enter"===t.key&&e.handleClick(n),e.props.handleOnKeyDown(t)})),xt(_t(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=fe.default(a,u*r);if(t.push(p),i){var m=wn(a,p,u,r,i);t=t.concat(m)}}return t.map((function(t,r){return de.default.createElement("li",{key:r,onClick:e.handleClick.bind(_t(e),t),className:e.liClasses(t,l,c),ref:function(n){(at.default(t,d)||Kt(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 gt(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 de.default.createElement("div",{className:"react-datepicker__time-container ".concat(this.props.todayButton?"react-datepicker__time-container--with-today-button":"")},de.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}},de.default.createElement("div",{className:"react-datepicker-time__header"},this.props.timeCaption)),de.default.createElement("div",{className:"react-datepicker__time"},de.default.createElement("div",{className:"react-datepicker__time-box"},de.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}(de.default.Component);xt(qn,"calcCenterPosition",(function(e,t){return t.offsetTop-(e/2-t.clientHeight/2)}));var $n=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"YEAR_REFS",St(Array(r.props.yearItemNumber)).map((function(){return de.default.createRef()}))),xt(_t(r),"isDisabled",(function(e){return nn(e,r.props)})),xt(_t(r),"isExcluded",(function(e){return rn(e,r.props)})),xt(_t(r),"updateFocusOnPaginate",(function(e){var t=function(){this.YEAR_REFS[e].current.focus()}.bind(_t(r));window.requestAnimationFrame(t)})),xt(_t(r),"handleYearClick",(function(e,t){r.props.onDayClick&&r.props.onDayClick(e,t)})),xt(_t(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())})),xt(_t(r),"isSameDay",(function(e,t){return zt(e,t)})),xt(_t(r),"isCurrentYear",(function(e){return e===Re.default(Ot())})),xt(_t(r),"isKeyboardSelected",(function(e){var t=Vt($e.default(r.props.date,e));return!r.props.disabledKeyboardNavigation&&!r.props.inline&&!zt(t,Vt(r.props.selected))&&zt(t,Vt(r.props.preSelection))})),xt(_t(r),"onYearClick",(function(e,t){var n=r.props.date;r.handleYearClick(Vt($e.default(n,t)),e)})),xt(_t(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,ye.default(r.props.preSelection,1));break;case"ArrowLeft":r.handleYearNavigation(t-1,Ie.default(r.props.preSelection,1))}})),xt(_t(r),"getYearClassNames",(function(e){var t=r.props,n=t.minDate,a=t.maxDate,s=t.selected;return ue.default("react-datepicker__year-text",{"react-datepicker__year-text--selected":e===Re.default(s),"react-datepicker__year-text--disabled":(n||a)&&ln(e,r.props),"react-datepicker__year-text--keyboard-selected":r.isKeyboardSelected(e),"react-datepicker__year-text--today":r.isCurrentYear(e)})})),xt(_t(r),"getYearTabIndex",(function(e){return r.props.disabledKeyboardNavigation?"-1":e===Re.default(r.props.preSelection)?"0":"-1"})),r}return gt(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(de.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 de.default.createElement("div",{className:"react-datepicker__year"},de.default.createElement("div",{className:"react-datepicker__year-wrapper"},t))}}]),n}(de.default.Component),Un=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),xt(_t(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)})),xt(_t(r),"renderTimeInput",(function(){var e=r.state.time,t=r.props,n=t.date,a=t.timeString,s=t.customTimeInput;return s?de.default.cloneElement(s,{date:n,value:e,onChange:r.onTimeChange}):de.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 gt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__input-time-container"},de.default.createElement("div",{className:"react-datepicker-time__caption"},this.props.timeInputLabel),de.default.createElement("div",{className:"react-datepicker-time__input-container"},de.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}(de.default.Component);function Zn(e){var t=e.className,n=e.children,r=e.showPopperArrow,a=e.arrowProps,s=void 0===a?{}:a;return de.default.createElement("div",{className:t},r&&de.default.createElement("div",vt({className:"react-datepicker__triangle"},s)),n)}var Vn=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],Wn=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"handleClickOutside",(function(e){r.props.onClickOutside(e)})),xt(_t(r),"setClickOutsideRef",(function(){return r.containerRef.current})),xt(_t(r),"handleDropdownFocus",(function(e){(function(){var e=((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).className||"").split(/\s+/);return Vn.some((function(t){return e.indexOf(t)>=0}))})(e.target)&&r.props.onDropdownFocus()})),xt(_t(r),"getDateInView",(function(){var e=r.props,t=e.preSelection,n=e.selected,a=e.openToDate,s=vn(r.props),i=bn(r.props),o=Ot();return a||n||t||(s&&at.default(o,s)?s:i&&rt.default(o,i)?i:o)})),xt(_t(r),"increaseMonth",(function(){r.setState((function(e){var t=e.date;return{date:be.default(t,1)}}),(function(){return r.handleMonthChange(r.state.date)}))})),xt(_t(r),"decreaseMonth",(function(){r.setState((function(e){var t=e.date;return{date:je.default(t,1)}}),(function(){return r.handleMonthChange(r.state.date)}))})),xt(_t(r),"handleDayClick",(function(e,t,n){r.props.onSelect(e,t,n),r.props.setPreSelection&&r.props.setPreSelection(e)})),xt(_t(r),"handleDayMouseEnter",(function(e){r.setState({selectingDate:e}),r.props.onDayMouseEnter&&r.props.onDayMouseEnter(e)})),xt(_t(r),"handleMonthMouseLeave",(function(){r.setState({selectingDate:null}),r.props.onMonthMouseLeave&&r.props.onMonthMouseLeave()})),xt(_t(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)})),xt(_t(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)})),xt(_t(r),"handleMonthYearChange",(function(e){r.handleYearChange(e),r.handleMonthChange(e)})),xt(_t(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)}))})),xt(_t(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)}))})),xt(_t(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)}))})),xt(_t(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(de.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=xe.default(e,t),a=r.formatWeekday(n,r.props.locale),s=r.props.weekDayClassName?r.props.weekDayClassName(n):void 0;return de.default.createElement("div",{key:t,className:ue.default("react-datepicker__day-name",s)},a)})))})),xt(_t(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)})),xt(_t(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)}))})),xt(_t(r),"renderPreviousButton",(function(){if(!r.props.renderCustomHeader){var e;switch(!0){case r.props.showMonthYearPicker:e=gn(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(Vt(Ie.default(e,a)),a).endPeriod,i=n&&Re.default(n);return i&&i>s||!1}(r.state.date,r.props);break;default:e=hn(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 de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:r.props.handleOnKeyDown,"aria-label":a?p:d},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"].join(" ")},a?r.props.previousYearButtonLabel:r.props.previousMonthButtonLabel))}}})),xt(_t(r),"increaseYear",(function(){r.setState((function(e){var t=e.date;return{date:ye.default(t,r.props.showYearPicker?r.props.yearItemNumber:1)}}),(function(){return r.handleYearChange(r.state.date)}))})),xt(_t(r),"renderNextButton",(function(){if(!r.props.renderCustomHeader){var e;switch(!0){case r.props.showMonthYearPicker:e=xn(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(ye.default(e,a),a).startPeriod,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--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 de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:r.props.handleOnKeyDown,"aria-label":a?p:d},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"].join(" ")},a?r.props.nextYearButtonLabel:r.props.nextMonthButtonLabel))}}})),xt(_t(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"),de.default.createElement("div",{className:t.join(" ")},Pt(e,r.props.dateFormat,r.props.locale))})),xt(_t(r),"renderYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showYearDropdown&&!e)return de.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})})),xt(_t(r),"renderMonthDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showMonthDropdown&&!e)return de.default.createElement(Dn,{dropdownMode:r.props.dropdownMode,locale:r.props.locale,onChange:r.changeMonth,month:Ee.default(r.state.date),useShortMonthInDropdown:r.props.useShortMonthInDropdown})})),xt(_t(r),"renderMonthYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showMonthYearDropdown&&!e)return de.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})})),xt(_t(r),"renderTodayButton",(function(){if(r.props.todayButton&&!r.props.showTimeSelectOnly)return de.default.createElement("div",{className:"react-datepicker__today-button",onClick:function(e){return r.props.onSelect(Be.default(Ot()),e)}},r.props.todayButton)})),xt(_t(r),"renderDefaultHeader",(function(e){var t=e.monthDate,n=e.i;return de.default.createElement("div",{className:"react-datepicker__header ".concat(r.props.showTimeSelect?"react-datepicker__header--has-time-select":"")},r.renderCurrentMonth(t),de.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)),de.default.createElement("div",{className:"react-datepicker__day-names"},r.header(t)))})),xt(_t(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=hn(r.state.date,r.props),s=fn(r.state.date,r.props),i=gn(r.state.date,r.props),o=xn(r.state.date,r.props),l=!r.props.showMonthYearPicker&&!r.props.showQuarterYearPicker&&!r.props.showYearPicker;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:r.props.onDropdownFocus},r.props.renderCustomHeader(pt(pt({},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&&de.default.createElement("div",{className:"react-datepicker__day-names"},r.header(t)))})),xt(_t(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 de.default.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},n?"".concat(s," - ").concat(i):Re.default(e))})),xt(_t(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)}})),xt(_t(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=be.default(n,s),o="month-".concat(a),l=a<r.props.monthsShown-1,c=a>0;e.push(de.default.createElement("div",{key:o,ref:function(e){r.monthContainer=e},className:"react-datepicker__month-container"},r.renderHeader({monthDate:i,i:a}),de.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}})),xt(_t(r),"renderYears",(function(){if(!r.props.showTimeSelectOnly)return r.props.showYearPicker?de.default.createElement("div",{className:"react-datepicker__year--container"},r.renderHeader(),de.default.createElement($n,vt({onDayClick:r.handleDayClick,date:r.state.date},r.props))):void 0})),xt(_t(r),"renderTimeSection",(function(){if(r.props.showTimeSelect&&(r.state.monthContainer||r.props.showTimeSelectOnly))return de.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})})),xt(_t(r),"renderInputTimeSection",(function(){var e=new Date(r.props.selected),t=At(e)&&Boolean(r.props.selected)?"".concat(_n(e.getHours()),":").concat(_n(e.getMinutes())):"";if(r.props.showTimeInput)return de.default.createElement(Un,{date:e,timeString:t,timeInputLabel:r.props.timeInputLabel,onChange:r.props.onTimeChange,customTimeInput:r.props.customTimeInput})})),r.containerRef=de.default.createRef(),r.state={date:r.getDateInView(),selectingDate:null,monthContainer:null},r}return gt(n,[{key:"componentDidMount",value:function(){this.props.showTimeSelect&&(this.assignMonthContainer=void this.setState({monthContainer:this.monthContainer}))}},{key:"componentDidUpdate",value:function(e){this.props.preSelection&&!zt(this.props.preSelection,e.preSelection)?this.setState({date:this.props.preSelection}):this.props.openToDate&&!zt(this.props.openToDate,e.openToDate)&&this.setState({date:this.props.openToDate})}},{key:"render",value:function(){var e=this.props.container||Zn;return de.default.createElement("div",{ref:this.containerRef},de.default.createElement(e,{className:ue.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}(de.default.Component),Yn=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),(r=t.call(this,e)).el=document.createElement("div"),r}return gt(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 dt.default.createPortal(this.props.children,this.el)}}]),n}(de.default.Component),Bn=function(e){return!e.disabled&&-1!==e.tabIndex},Hn=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),xt(_t(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(Bn)})),xt(_t(r),"handleFocusStart",(function(e){var t=r.getTabChildren();t&&t.length>1&&t[t.length-1].focus()})),xt(_t(r),"handleFocusEnd",(function(e){var t=r.getTabChildren();t&&t.length>1&&t[0].focus()})),r.tabLoopRef=de.default.createRef(),r}return gt(n,[{key:"render",value:function(){return this.props.enableTabLoop?de.default.createElement("div",{className:"react-datepicker__tab-loop",ref:this.tabLoopRef},de.default.createElement("div",{className:"react-datepicker__tab-loop__start",tabIndex:"0",onFocus:this.handleFocusStart}),this.props.children,de.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}(de.default.Component),zn=function(e){bt(n,e);var t=It(n);function n(){return ht(this,n),t.apply(this,arguments)}return gt(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=ue.default("react-datepicker-popper",n);e=de.default.createElement(le.Popper,vt({modifiers:i,placement:o},l),(function(e){var t=e.ref,n=e.style,r=e.placement,a=e.arrowProps;return de.default.createElement(Hn,{enableTabLoop:d},de.default.createElement("div",{ref:t,style:n,className:h,"data-placement":r,onKeyDown:u},de.default.cloneElement(s,{arrowProps:a})))}))}this.props.popperContainer&&(e=de.default.createElement(this.props.popperContainer,{},e)),p&&!a&&(e=de.default.createElement(Yn,{portalId:p,portalHost:m},e));var f=ue.default("react-datepicker-wrapper",r);return de.default.createElement(le.Manager,{className:"react-datepicker-manager"},de.default.createElement(le.Reference,null,(function(e){var t=e.ref;return de.default.createElement("div",{ref:t,className:f},c)})),e)}}],[{key:"defaultProps",get:function(){return{hidePopper:!0,popperModifiers:[],popperProps:{},popperPlacement:"bottom-start"}}}]),n}(de.default.Component),Kn="react-datepicker-ignore-onclickoutside",Gn=ct.default(Wn),Qn="Date input not valid.",Xn=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),xt(_t(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()})),xt(_t(r),"calcInitialState",(function(){var e,t=r.getPreSelection(),n=vn(r.props),a=bn(r.props),s=n&&at.default(t,Be.default(n))?n:a&&rt.default(t,Qe.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:yn(r.props.highlightDates),focused:!1,shouldFocusDayInline:!1}})),xt(_t(r),"clearPreventFocusTimeout",(function(){r.preventFocusTimeout&&clearTimeout(r.preventFocusTimeout)})),xt(_t(r),"setFocus",(function(){r.input&&r.input.focus&&r.input.focus({preventScroll:!0})})),xt(_t(r),"setBlur",(function(){r.input&&r.input.blur&&r.input.blur(),r.cancelFocusInput()})),xt(_t(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:er},(function(){e||r.setState((function(e){return{focused:!!t&&e.focused}}),(function(){!t&&r.setBlur(),r.setState({inputValue:null})}))}))})),xt(_t(r),"inputOk",(function(){return pe.default(r.state.preSelection)})),xt(_t(r),"isCalendarOpen",(function(){return void 0===r.props.open?r.state.open&&!r.props.disabled&&!r.props.readOnly:r.props.open})),xt(_t(r),"handleFocus",(function(e){r.state.preventFocus||(r.props.onFocus(e),r.props.preventOpenOnFocus||r.props.readOnly||r.setOpen(!0)),r.setState({focused:!0})})),xt(_t(r),"cancelFocusInput",(function(){clearTimeout(r.inputFocusTimeout),r.inputFocusTimeout=null})),xt(_t(r),"deferFocusInput",(function(){r.cancelFocusInput(),r.inputFocusTimeout=setTimeout((function(){return r.setFocus()}),1)})),xt(_t(r),"handleDropdownFocus",(function(){r.cancelFocusInput()})),xt(_t(r),"handleBlur",(function(e){(!r.state.open||r.props.withPortal||r.props.showTimeInput)&&r.props.onBlur(e),r.setState({focused:!1})})),xt(_t(r),"handleCalendarClickOutside",(function(e){r.props.inline||r.setOpen(!1),r.props.onClickOutside(e),r.props.withPortal&&e.preventDefault()})),xt(_t(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(_t(r),t),"function"==typeof a.isDefaultPrevented&&!a.isDefaultPrevented())){r.setState({inputValue:a.target.value,lastPreSelectChange:Jn});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)}})),xt(_t(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||at.default(e,s)||r.setOpen(!1)}})),xt(_t(r),"setSelected",(function(e,t,n,a){var s=e;if(null===s||!nn(s,r.props)){var i=r.props,o=i.onChange,l=i.selectsRange,c=i.startDate,d=i.endDate;if(!Kt(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&&(at.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}))}})),xt(_t(r),"setPreSelection",(function(e){var t=void 0!==r.props.minDate,n=void 0!==r.props.maxDate,a=!0;if(e){var s=Be.default(e);if(t&&n)a=Gt(e,r.props.minDate,r.props.maxDate);else if(t){var i=Be.default(r.props.minDate);a=rt.default(e,i)||Kt(s,i)}else if(n){var o=Qe.default(r.props.maxDate);a=at.default(e,o)||Kt(s,o)}}a&&r.setState({preSelection:e})})),xt(_t(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})})),xt(_t(r),"onInputClick",(function(){r.props.disabled||r.props.readOnly||r.setOpen(!0),r.props.onInputClick()})),xt(_t(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===er?(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:Qn})}}else"ArrowDown"!==t&&"ArrowUp"!==t&&"Enter"!==t||r.onInputClick()})),xt(_t(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:Qn});else if(!r.props.disabledKeyboardNavigation){var a;switch(t){case"ArrowLeft":a=we.default(n,1);break;case"ArrowRight":a=xe.default(n,1);break;case"ArrowUp":a=_e.default(n,1);break;case"ArrowDown":a=ve.default(n,1);break;case"PageUp":a=je.default(n,1);break;case"PageDown":a=be.default(n,1);break;case"Home":a=Ie.default(n,1);break;case"End":a=ye.default(n,1)}if(!a)return void(r.props.onInputError&&r.props.onInputError({code:1,msg:Qn}));if(e.preventDefault(),r.setState({lastPreSelectChange:er}),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})}}})),xt(_t(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})}))})))})),xt(_t(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})})),xt(_t(r),"clear",(function(){r.onClearClick()})),xt(_t(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)})),xt(_t(r),"renderCalendar",(function(){return r.props.inline||r.isCalendarOpen()?de.default.createElement(Gn,{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:Kn,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})),xt(_t(r),"renderDateInput",(function(){var e,t=ue.default(r.props.className,xt({},Kn,r.state.open)),n=r.props.customInput||de.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 de.default.cloneElement(n,(xt(e={},a,(function(e){r.input=e})),xt(e,"value",s),xt(e,"onBlur",r.handleBlur),xt(e,"onChange",r.handleChange),xt(e,"onClick",r.onInputClick),xt(e,"onFocus",r.handleFocus),xt(e,"onKeyDown",r.onInputKeyDown),xt(e,"id",r.props.id),xt(e,"name",r.props.name),xt(e,"autoFocus",r.props.autoFocus),xt(e,"placeholder",r.props.placeholderText),xt(e,"disabled",r.props.disabled),xt(e,"autoComplete",r.props.autoComplete),xt(e,"className",ue.default(n.props.className,t)),xt(e,"title",r.props.title),xt(e,"readOnly",r.props.readOnly),xt(e,"required",r.props.required),xt(e,"tabIndex",r.props.tabIndex),xt(e,"aria-describedby",r.props.ariaDescribedBy),xt(e,"aria-invalid",r.props.ariaInvalid),xt(e,"aria-labelledby",r.props.ariaLabelledBy),xt(e,"aria-required",r.props.ariaRequired),e))})),xt(_t(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:de.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 gt(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:yn(this.props.highlightDates)}),t.focused||Kt(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 de.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?de.default.createElement("div",{className:"react-datepicker__portal"},e):null;return this.state.open&&this.props.portalId&&(t=de.default.createElement(Yn,{portalId:this.props.portalId,portalHost:this.props.portalHost},t)),de.default.createElement("div",null,this.renderInputContainer(),t)}return de.default.createElement(zn,{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}(de.default.Component),Jn="input",er="navigate";e.CalendarContainer=Zn,e.default=Xn,e.getDefaultLocale=Qt,e.registerLocale=function(e,t){var n="undefined"!=typeof window?window:globalThis;n.__localeData__||(n.__localeData__={}),n.__localeData__[e]=t},e.setDefaultLocale=function(e){("undefined"!=typeof window?window:globalThis).__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 x=g.prototype;return x.getInstance=function(){if(e.prototype&&!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},x.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()}},x.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},x.componentWillUnmount=function(){this.disableOnClickOutside()},x.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 y},Reference:function(){return j},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}},x=function(){},v=function(){return Promise.resolve(null)},b=[];function y(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?b:l,u=e.referenceElement,p=e.onFirstUpdate,m=e.innerRef,h=e.children,f=r.useContext(a),y=r.useState(null),w=y[0],_=y[1],j=r.useState(null),I=j[0],S=j[1];r.useEffect((function(){c(m,w)}),[m,w]);var C=r.useMemo((function(){return{placement:n,strategy:i,onFirstUpdate:p,modifiers:[].concat(d,[{name:"arrow",enabled:null!=I,options:{element:I}}])}}),[n,i,p,d,I]),T=g(u||f,w,C),k=T.state,N=T.styles,D=T.forceUpdate,E=T.update,O=r.useMemo((function(){return{ref:_,style:N.popper,placement:k?k.placement:n,hasPopperEscaped:k&&k.modifiersData.hide?k.modifiersData.hide.hasPopperEscaped:null,isReferenceHidden:k&&k.modifiersData.hide?k.modifiersData.hide.isReferenceHidden:null,arrowProps:{style:N.arrow,ref:S},forceUpdate:D||x,update:E||v}}),[_,S,n,k,N,E,D]);return o(h)(O)}var w=n(42473),_=n.n(w);function j(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,x=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||x)&&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&&x&&x[r]&&(l=x[r],c=u)}!s&&l&&(s=l,o=c),s&&(n.splice(0,o,s),e=n.join("/"))}return e}function x(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 v(e){return function(t){l[e]=t}}function b(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 y(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 w(e){return e?y(e):[]}function _(e){return function(){return d&&d.config&&d.config[e]||{}}}i=function(e,t){var n,r,a=y(e),s=a[0],i=t[1];return e=a[1],s&&(n=b(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=y(e=g(e,i)))[0],e=a[1],s&&(n=b(s))),{f:s?s+"!"+e:e,n:e,pr:s,p:n}},o={require:function(e){return x(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,y,_=[],j=typeof r;if(g=w(a=a||t),"undefined"===j||"function"===j){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),y=!0;else if("module"===d)s=_[h]=o.module(t);else if(f(l,d)||f(c,d)||f(u,d))_[h]=b(d);else{if(!m.p)throw new Error(t+" missing "+d);m.p.load(m.n,x(a,!0),v(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&&y||(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):b(i(r,w(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,x,v,b,y,w,_,j,I,S,C,T,k,N,D){function E(){this.reset()}return E.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,x)),d.maximumInputLength>0&&(d.dataAdapter=c.Decorate(d.dataAdapter,v)),d.maximumSelectionLength>0&&(d.dataAdapter=c.Decorate(d.dataAdapter,b)),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,j)),null!=d.placeholder&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,_)),d.selectOnClose&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,C)),d.tags&&(d.resultsAdapter=c.Decorate(d.resultsAdapter,N))),null==d.dropdownAdapter){if(d.multiple)d.dropdownAdapter=y;else{var u=c.Decorate(y,w);d.dropdownAdapter=u}0!==d.minimumResultsForSearch&&(d.dropdownAdapter=c.Decorate(d.dropdownAdapter,S)),d.closeOnSelect&&(d.dropdownAdapter=c.Decorate(d.dropdownAdapter,T)),null!=d.dropdownCssClass&&(d.dropdownAdapter=c.Decorate(d.dropdownAdapter,k)),d.dropdownAdapter=c.Decorate(d.dropdownAdapter,I)}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 D=[],E=0;E<d.language.length;E++){var O=d.language[E];-1===D.indexOf(O)&&D.push(O)}return d.language=D,d.translations=this._processTranslations(d.language,d.debug),d},E.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"}},E.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},E.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},E.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},E.prototype.set=function(t,n){var r={};r[e.camelCase(t)]=n;var a=c._convertData(r);e.extend(!0,this.defaults,a)},new E})),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 x=e.data(this,"mousewheel-page-height");l*=x,p*=x,u*=x}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 v=this.getBoundingClientRect();h=r.clientX-v.left,f=r.clientY-v.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 45676,e(e.s=45676)})),e.O()}]);
 
 
assets/dist/js/admin.de22495d.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! For license information please see admin.de22495d.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}},45676:function(e,t,n){"use strict";var r={};n.r(r),n.d(r,{canUseWooSubscriptions:function(){return gi},findFiltersValueForSegment:function(){return Ci},getAvailableFilters:function(){return Si},getCustomFieldsList:function(){return bi},getErrors:function(){return Ii},getMembershipPlans:function(){return ui},getNewslettersList:function(){return fi},getProductCategories:function(){return hi},getProducts:function(){return di},getSegment:function(){return yi},getSegmentFilter:function(){return ji},getStaticSegmentsList:function(){return wi},getSubscriberCount:function(){return _i},getSubscriptionProducts:function(){return pi},getWooCommerceCountries:function(){return vi},getWooCommerceCurrencySymbol:function(){return xi},getWordpressRoles:function(){return mi}});var a={};n.r(a),n.d(a,{handleSave:function(){return Ui},pageLoaded:function(){return $i},setErrors:function(){return Ai},setSegment:function(){return Ri},updateSegment:function(){return Pi},updateSegmentFilter:function(){return Mi},updateSegmentFilterFromEvent:function(){return Fi},updateSegmentFromEvent:function(){return Li},updateSubscriberCount:function(){return qi}});var s={};n.r(s),n.d(s,{LOAD_SEGMENT:function(){return Vi},SAVE_SEGMENT:function(){return Wi}});var i=n(52524),o=n.n(i),l=n(73727),c=n(5977),d=n(78596),u=n.n(d),p=n(65311),m=n.n(p),h=n(45697),f=n.n(h),g=n(62698),x=n(33160),v=n(57790),b=n(57040),y=n(44845),w=n(45993),_=n(59050),j=(n(20454),n(15451));class I extends w.Component{constructor(e){super(e),(0,y.Z)(this,"getFieldId",(e=>{const t=e||this.props;return t.field.id||t.field.name})),(0,y.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(_.ZP.isArray(this.props.item[this.props.field.name]))return this.props.item[this.props.field.name].map((e=>e.id))}return null})),(0,y.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),_.ZP.isArray(e)&&void 0!==this.props.field.filter&&(e=e.filter(this.props.field.filter)),e})),(0,y.Z)(this,"getLabel",(e=>void 0!==this.props.field.getLabel?this.props.field.getLabel(e,this.props.item):e.name)),(0,y.Z)(this,"getSearchLabel",(e=>void 0!==this.props.field.getSearchLabel?this.props.field.getSearchLabel(e,this.props.item):null)),(0,y.Z)(this,"getValue",(e=>void 0!==this.props.field.getValue?this.props.field.getValue(e,this.props.item):e.id)),(0,y.Z)(this,"getCount",(e=>void 0!==this.props.field.getCount?this.props.field.getCount(e,this.props.item):null)),(0,y.Z)(this,"getTag",(e=>void 0!==this.props.field.getTag?this.props.field.getTag(e,this.props.item):null)),(0,y.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=_.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=m()(`#${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,y.Z)(this,"resetSelect2",(()=>{this.destroySelect2(),this.setupSelect2()})),(0,y.Z)(this,"destroySelect2",(()=>{this.isSelect2Initialized()&&(m()(`#${this.selectRef.current.id}`).select2("destroy"),this.cleanupAfterSelect2())})),(0,y.Z)(this,"cleanupAfterSelect2",(()=>{m()(`#${this.selectRef.current.id}`).find("option:not(.default)").remove(),m()(`#${this.selectRef.current.id}`).off("select2:unselecting").off("select2:opening")})),(0,y.Z)(this,"allowMultipleValues",(()=>!0===this.props.field.multiple)),(0,y.Z)(this,"isSelect2Initialized",(()=>!0===m()(`#${this.selectRef.current.id}`).hasClass("select2-hidden-accessible"))),(0,y.Z)(this,"isSelect2Component",(()=>this.allowMultipleValues()||this.props.field.forceSelect2)),(0,y.Z)(this,"handleChange",(e=>{if(void 0===this.props.onValueChange)return;const t=m()(`#${this.selectRef.current.id}`).children(":selected").map((function(){return{id:m()(this).val(),text:m()(this).text()}})),n=this.props.field.multiple?_.ZP.pluck(t,"id"):_.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,y.Z)(this,"transformChangedValue",((e,t)=>"function"==typeof this.props.field.transformChangedValue?this.props.field.transformChangedValue.call(this,e,t):e)),(0,y.Z)(this,"insertEmptyOption",(()=>{if(!this.allowMultipleValues())return this.props.field.placeholder?(0,j.jsx)("option",{className:"default"}):void 0})),this.selectRef=(0,w.createRef)()}componentDidMount(){this.isSelect2Component()&&this.setupSelect2()}componentDidUpdate(e){void 0!==this.props.item&&void 0!==e.item&&this.props.item.id!==e.item.id&&m()(`#${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,j.jsx)("option",{className:"default",value:r,title:n,children:t},`option-${e.id}`)}));return(0,j.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,j.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]})})}}I.propTypes={onValueChange:f().func,field:f().shape({name:f().string.isRequired,values:f().oneOfType([f().object,f().array]),getLabel:f().func,resetSelect2OnUpdate:f().bool,selected:f().func,endpoint:f().string,filter:f().func,getSearchLabel:f().func,getValue:f().func,getCount:f().func,getTag:f().func,placeholder:f().string,remoteQuery:f().object,extendSelect2Options:f().object,multiple:f().bool,forceSelect2:f().bool,transformChangedValue:f().func,disabled:f().bool,validation:f().shape({"data-parsley-required":f().bool,"data-parsley-required-message":f().string,"data-parsley-type":f().string,"data-parsley-errors-container":f().string,maxLength:f().number})}).isRequired,item:f().object,disabled:f().bool,width:f().string},I.defaultProps={onValueChange:function(){},disabled:!1,width:"",item:void 0};var S=n(27273),C=n.n(S),T=n(38287);function k(){if(!v.x.subscribersLimitReached)return null;const e=v.x.hasValidApiKey,t=v.x.I18n.t("subscribersLimitNoticeTitle").replace("[subscribersLimit]",v.x.subscribersLimit),n=v.x.I18n.t(e?"yourPlanLimit":"freeVersionLimit").replace("[subscribersLimit]",v.x.subscribersLimit),r=e?v.x.MailPoetComUrlFactory.getUpgradeUrl(v.x.pluginPartialKey):v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount+1),a=C()(v.x.I18n.t("youCanDisableWPUsersList"),/\[link](.*?)\[\/link]/g,(e=>(0,j.jsx)("a",{href:"?page=mailpoet-segments",children:e},"goToSegments")));return(0,j.jsxs)(T.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,j.jsx)("h3",{children:t}),(0,j.jsxs)("p",{children:[n," ",v.x.I18n.t("youNeedToUpgrade"),"active"===v.x.wpSegmentState?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("br",{}),a]}):null]}),(0,j.jsxs)("p",{children:[(0,j.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:r,children:v.x.I18n.t("upgradeNow")}),e&&(0,j.jsxs)(j.Fragment,{children:[" ",(0,j.jsx)("button",{type:"button",className:"button",onClick:async()=>{await v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:v.x.I18n.t("refreshMySubscribers")})]})]})]})}function N(e){let{mssKeyInvalid:t,subscribersCount:n}=e;return t?(0,j.jsxs)(T.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,j.jsx)("h3",{children:v.x.I18n.t("allSendingPausedHeader")}),(0,j.jsx)("p",{children:C()(v.x.I18n.t("allSendingPausedBody"),/\[link\](.*?)\[\/link\]/g,(e=>(0,j.jsx)("a",{href:"?page=mailpoet-settings#premium",children:e},"check-sending")))}),(0,j.jsx)("p",{children:(0,j.jsx)("a",{href:`https://account.mailpoet.com?s=${n}`,className:"button button-primary",target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("allSendingPausedLink")})})]}):null}var D=n(30653);function E(){if(!v.x.emailVolumeLimitReached)return null;const e=v.x.I18n.t("emailVolumeLimitNoticeTitle").replace("[emailVolumeLimit]",v.x.emailVolumeLimit),t=v.x.I18n.t("youReachedEmailVolumeLimit").replace("[emailVolumeLimit]",v.x.emailVolumeLimit),n=v.x.MailPoetComUrlFactory.getUpgradeUrl(v.x.pluginPartialKey),r=new Date,a=new Date(r.getFullYear(),r.getMonth()+1,1);let s=C()(v.x.I18n.t("toContinueUpgradeYourPlanOrWaitUntil"),/\[link](.*?)\[\/link]/g,(e=>(0,j.jsx)("a",{target:"_blank",rel:"noreferrer",href:n,children:e},e)));return s=C()(s,/<b>\[date]<\/b>\./g,(()=>(0,D.ZP)(`<b>${v.x.Date.short(a)}</b>.`))),(0,j.jsxs)(T.q,{type:"error",timeout:!1,closable:!1,renderInPlace:!0,children:[(0,j.jsx)("h3",{children:e}),(0,j.jsxs)("p",{children:[t,(0,j.jsx)("br",{}),s]}),(0,j.jsxs)("p",{children:[(0,j.jsx)("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:n,children:v.x.I18n.t("upgradeNow")})," ",(0,j.jsx)("button",{type:"button",className:"button",onClick:async()=>{await v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()},children:v.x.I18n.t("refreshMyEmailVolumeLimit")})]})]})}var O=n(57744);function R(e){let{cacheCalculation:t}=e;const[n,r]=(0,w.useState)(!1),[a,s]=(0,w.useState)([]),i=(new Date).getTime()-new Date(t).getTime(),o=Math.floor(i/1e3/60);return(0,j.jsxs)("div",{className:"mailpoet-subscribers-cache-notice",children:[C()(v.x.I18n.t("subscribersCountWereCalculatedWithMinutesAgo"),/<abbr>(.*?)<\/abbr>/,((e,n)=>(0,j.jsx)("abbr",{title:t,children:e.replace(/(\{\$mins\}|\$mins)/i,String(o))},n))),(0,j.jsx)(O.z,{className:"mailpoet-subscribers-cache-notice-button",type:"button",variant:"secondary",dimension:"small",onClick:()=>{r(!0),v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"settings",action:"recalculateSubscribersCountsCache"}).done((()=>{window.location.reload()})).fail((e=>{s(e.errors.map((e=>e.message))),r(!1)}))},withSpinner:n,children:v.x.I18n.t("recalculateNow")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),a.length>0&&(0,j.jsx)(T.q,{type:"error",children:a.map((e=>(0,j.jsx)("p",{children:e},e)))})]})}var A=n(49793);function P(e){let{subscribersInPlan:t,subscribersInPlanLimit:n}=e;if(!1===t)return null;const r=n?(0,j.jsx)("b",{children:v.x.I18n.t("subscribersInPlanCount").replace("%1$d",t.toLocaleString()).replace("%2$d",n.toLocaleString())},"subscribers_count"):(0,j.jsx)("b",{children:t},"subscribers_count");return(0,j.jsxs)("div",{className:"mailpoet-subscribers-in-plan",children:[C()(v.x.I18n.t("subscribersInPlan"),"%s",(()=>r))," ",(0,j.jsx)(A.Tooltip,{tooltip:v.x.I18n.t("subscribersInPlanTooltip"),place:"right"}),(0,j.jsx)("span",{className:"mailpoet-subscribers-in-plan-spacer",children:" "})]})}var M=n(53423);function L(e){let{id:t,engagementScore:n}=e;const r={unknown:{name:v.x.I18n.t("unknownBadgeName"),type:"unknown",tooltipTitle:v.x.I18n.t("unknownBadgeTooltip"),tooltipText:v.x.I18n.t("tooltipUnknown")},excellent:{name:v.x.I18n.t("excellentBadgeName"),type:"excellent",tooltipTitle:v.x.I18n.t("excellentBadgeTooltip"),tooltipText:v.x.I18n.t("tooltipExcellent")},good:{name:v.x.I18n.t("goodBadgeName"),type:"good",tooltipTitle:v.x.I18n.t("goodBadgeTooltip"),tooltipText:v.x.I18n.t("tooltipGood")},average:{name:v.x.I18n.t("averageBadgeName"),type:"average",tooltipTitle:v.x.I18n.t("averageBadgeTooltip"),tooltipText:v.x.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,j.jsxs)("div",{children:[(0,j.jsx)("div",{className:"mailpoet-listing-stats-tooltip-title",children:s.tooltipTitle.toUpperCase()}),(0,j.jsx)("div",{className:"mailpoet-listing-stats-tooltip-description",children:v.x.I18n.t("engagementScoreDescription")}),(0,j.jsxs)("div",{className:"mailpoet-listing-stats-tooltip-content",children:[(0,j.jsx)(M.C,{type:"unknown",name:v.x.I18n.t("unknownBadgeName")})," : ",r.unknown.tooltipText,(0,j.jsx)("br",{}),(0,j.jsx)(M.C,{type:"excellent",name:v.x.I18n.t("excellentBadgeName")})," : ",r.excellent.tooltipText,(0,j.jsx)("br",{}),(0,j.jsx)(M.C,{type:"good",name:v.x.I18n.t("goodBadgeName")})," : ",r.good.tooltipText,(0,j.jsx)("br",{}),(0,j.jsx)(M.C,{type:"average",name:v.x.I18n.t("averageBadgeName")})," : ",r.average.tooltipText]})]},`tooltip-${a}`);return(0,j.jsxs)("div",{className:"mailpoet-listing-stats-opened-clicked",children:[null!=n&&(0,j.jsxs)("div",{className:"mailpoet-listing-stats-percentages",children:[n.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),"%"]}),(0,j.jsx)("div",{children:(0,j.jsx)(M.C,{isInverted:!0,type:s.type,name:s.name,tooltip:i,tooltipId:a,tooltipPlace:"top"})})]})}var F=n(99181);const q=(0,j.jsx)("svg",{viewBox:"4 4 16 16",children:(0,j.jsx)("path",{d:"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"})});function $(e){let{location:t}=e;return(0,j.jsxs)(F.Q,{children:[(0,j.jsxs)(l.rU,{className:"mailpoet-button button-secondary",to:{pathname:"/new",state:{backUrl:null==t?void 0:t.pathname}},children:[q,(0,j.jsx)("span",{"data-automation-id":"add-new-subscribers-button",children:v.x.I18n.t("new")})]}),(0,j.jsx)("a",{className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-import","data-automation-id":"import-subscribers-button",children:v.x.I18n.t("import")}),(0,j.jsx)("a",{id:"mailpoet_export_button",className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-export",children:v.x.I18n.t("export")})]})}$.propTypes={location:f().object.isRequired};const U=(0,c.withRouter)($),Z=v.x.trackingConfig.emailTrackingEnabled,V=[{name:"email",label:v.x.I18n.t("subscriber"),sortable:!0},{name:"status",label:v.x.I18n.t("status"),sortable:!0},{name:"segments",label:v.x.I18n.t("lists")},{name:"statistics",label:v.x.I18n.t("statisticsColumn"),display:Z},{name:"created_at",label:v.x.I18n.t("subscribedOn"),sortable:!0}],W={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneSubscriberTrashed"):v.x.I18n.t("multipleSubscribersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneSubscriberDeleted"):v.x.I18n.t("multipleSubscribersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneSubscriberRestored"):v.x.I18n.t("multipleSubscribersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onNoItemsFound:e=>"bounced"===e&&!window.mailpoet_premium_active&&!window.mailpoet_mss_active&&(0,j.jsxs)("div",{children:[(0,j.jsx)("p",{children:v.x.I18n.t("bouncedSubscribersHelp")}),(0,j.jsx)("p",{children:(0,j.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",className:"button-primary",children:v.x.I18n.t("bouncedSubscribersPremiumButtonText")})})]})},Y=(e,t,n,r)=>(0,j.jsxs)(b.u,{title:r,onRequestClose:t,isDismissible:!0,children:[(0,j.jsx)(I,{field:n}),(0,j.jsx)("span",{className:"mailpoet-gap-half"}),(0,j.jsx)(g.Button,{onClick:e,dimension:"small",variant:"secondary",children:v.x.I18n.t("apply")})]}),B=[{name:"moveToList",label:v.x.I18n.t("moveToList"),onSelect:function(e,t){return Y(e,t,{id:"move_to_segment",name:"move_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},v.x.I18n.t("moveToList"))},getData:function(){return{segment_id:Number(m()("#move_to_segment").val())}},onSuccess:function(e){v.x.Notice.success(v.x.I18n.t("multipleSubscribersMovedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"addToList",label:v.x.I18n.t("addToList"),onSelect:function(e,t){return Y(e,t,{id:"add_to_segment",name:"add_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},v.x.I18n.t("addToList"))},getData:function(){return{segment_id:Number(m()("#add_to_segment").val())}},onSuccess:function(e){v.x.Notice.success(v.x.I18n.t("multipleSubscribersAddedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromList",label:v.x.I18n.t("removeFromList"),onSelect:function(e,t){return Y(e,t,{id:"remove_from_segment",name:"remove_from_segment",endpoint:"segments",filter:function(e){return!("default"!==e.type)}},v.x.I18n.t("removeFromList"))},getData:function(){return{segment_id:Number(m()("#remove_from_segment").val())}},onSuccess:function(e){v.x.Notice.success(v.x.I18n.t("multipleSubscribersRemovedFromList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromAllLists",label:v.x.I18n.t("removeFromAllLists"),onSuccess:function(e){v.x.Notice.success(v.x.I18n.t("multipleSubscribersRemovedFromAllLists").replace("%1$d",Number(e.meta.count).toLocaleString()))}},{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:W.onTrash},{name:"unsubscribe",label:v.x.I18n.t("unsubscribe"),onSelect:(e,t,n)=>{const r="all"!==n.selection?n.selected_ids.length:n.count;return(0,j.jsxs)(b.u,{title:v.x.I18n.t("unsubscribe"),onRequestClose:t,isDismissible:!0,children:[(0,j.jsx)("p",{children:v.x.I18n.t("unsubscribeConfirm").replace("%s",r.toLocaleString())}),(0,j.jsx)("span",{className:"mailpoet-gap-half"}),(0,j.jsx)(g.Button,{onClick:e,dimension:"small",variant:"secondary",automationId:"bulk-unsubscribe-confirm",children:v.x.I18n.t("apply")})]})}}],H=[{name:"statistics",label:v.x.I18n.t("statsListingActionTitle"),link:function(e,t){return(0,j.jsx)(l.rU,{to:{pathname:`/stats/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}},children:v.x.I18n.t("statsListingActionTitle")})}},{name:"edit",label:v.x.I18n.t("edit"),link:function(e,t){return(0,j.jsx)(l.rU,{to:{pathname:`/edit/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}},children:v.x.I18n.t("edit")})}},{name:"sendConfirmationEmail",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("resendConfirmationEmail"),display:function(e){return"unconfirmed"===e.status&&e.count_confirmations<window.mailpoet_max_confirmation_emails},onClick:function(e){return v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"subscribers",action:"sendConfirmationEmail",data:{id:e.id}}).done((()=>v.x.Notice.success(v.x.I18n.t("oneConfirmationEmailSent")))).fail((e=>v.x.Notice.showApiErrorNotice(e)))}},{name:"trash",className:"mailpoet-hide-on-mobile"}],z=e=>0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user);function K(e){let{match:t}=e;const n=(0,c.useLocation)();return(0,j.jsxs)("div",{children:[(0,j.jsx)(U,{}),(0,j.jsx)(P,{subscribersInPlan:v.x.subscribersCount,subscribersInPlanLimit:v.x.subscribersLimit}),(0,j.jsx)(k,{}),(0,j.jsx)(E,{}),(0,j.jsx)(N,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,j.jsx)(R,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,j.jsx)(x.N,{limit:window.mailpoet_listing_per_page,location:n,params:t.params,endpoint:"subscribers",onRenderItem:(e,t)=>{const r=u()("manage-column","column-primary","has-row-actions","column-username");let a="";switch(e.status){case"subscribed":a=v.x.I18n.t("subscribed");break;case"unconfirmed":a=v.x.I18n.t("unconfirmed");break;case"unsubscribed":a=v.x.I18n.t("unsubscribed");break;case"inactive":a=v.x.I18n.t("inactive");break;case"bounced":a=v.x.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,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:r,children:[(0,j.jsx)(l.rU,{className:"mailpoet-listing-title",to:{pathname:`/edit/${e.id}`,state:{backUrl:null==n?void 0:n.pathname}},children:e.email}),(0,j.jsxs)("div",{className:"mailpoet-listing-subtitle",children:[e.first_name," ",e.last_name]}),t]}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("status"),children:a}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("lists"),children:(0,j.jsx)(g.Tags,{segments:s,dimension:"large"})}),!0===Z?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("statisticsColumn"),children:(0,j.jsx)("div",{className:"mailpoet-listing-stats",children:(0,j.jsx)("a",{href:`#/stats/${e.id}`,children:(0,j.jsx)(L,{id:e.id,engagementScore:e.engagement_score})},`stats-link-${e.id}`)})}):null,(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("subscribedOn"),children:[v.x.Date.short(e.created_at),(0,j.jsx)("br",{}),v.x.Date.time(e.created_at)]})]})},columns:V,bulk_actions:B,item_actions:H,messages:W,sort_by:"created_at",sort_order:"desc",isItemDeletable:z})]})}K.propTypes={match:f().shape({params:f().object}).isRequired};var G=n(30381),Q=n.n(G),X=n(86529),J=n(17123),ee=n.n(J),te=n(60017);class ne extends w.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,j.jsx)(te.I,{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})}}ne.propTypes={onValueChange:f().func,field:f().shape({name:f().string.isRequired,defaultValue:f().string,id:f().string,className:f().string,size:f().oneOfType([f().string,f().number]),disabled:f().func,placeholder:f().string,validation:f().shape({"data-parsley-required":f().bool,"data-parsley-required-message":f().string,"data-parsley-type":f().string,"data-parsley-errors-container":f().string,maxLength:f().number}),customLabel:f().string,tooltip:f().string}).isRequired,item:f().object.isRequired},ne.defaultProps={onValueChange:function(){}};var re=n(97972);function ae(e){return(0,j.jsx)(re.g,{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})}ae.propTypes={item:f().object.isRequired,field:f().shape({name:f().string,placeholder:f().string,defaultValue:f().string,validation:f().shape({"data-parsley-required":f().bool,"data-parsley-required-message":f().string,"data-parsley-type":f().string,"data-parsley-errors-container":f().string,maxLength:f().number}),className:f().string,customLabel:f().string,tooltip:f().string}).isRequired,onValueChange:f().func.isRequired};var se=n(2141);class ie extends w.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,j.jsx)("option",{value:"",children:this.props.field.placeholder})),void 0!==this.props.field.filter&&(t=this.props.field.filter),_.ZP.isFunction(this.props.field.sortBy)&&(r=this.props.field.sortBy),e=r?_.ZP.map(_.ZP.sortBy(_.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,j.jsx)("option",{value:e,children:this.props.field.values[e]},`option-${e}`)));return(0,j.jsxs)(se.P,{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]})}}ie.propTypes={onValueChange:f().func,field:f().shape({name:f().string.isRequired,values:f().objectOf(f().string),placeholder:f().string,filter:f().func,sortBy:f().func,validation:f().shape({"data-parsley-required":f().bool,"data-parsley-required-message":f().string,"data-parsley-type":f().string,"data-parsley-errors-container":f().string,maxLength:f().number})}).isRequired,item:f().object.isRequired,automationId:f().string},ie.defaultProps={automationId:"",onValueChange:function(){}};var oe=n(84868);class le extends w.Component{constructor(e){super(e),(0,y.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,j.jsx)("p",{children:(0,j.jsx)(oe.Y,{checked:e===t,value:t,onCheck:this.onValueChange,name:this.props.field.name,children:this.props.field.values[t]})},`radio-${t}`)));return(0,j.jsx)("div",{children:t})}}le.propTypes={onValueChange:f().func,field:f().shape({name:f().string.isRequired,values:f().objectOf(f().string)}).isRequired,item:f().object.isRequired},le.defaultProps={onValueChange:function(){}};var ce=n(16277);class de extends w.Component{constructor(e){super(e),(0,y.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,j.jsx)("p",{children:(0,j.jsx)(ce.X,{value:"1",checked:e,name:this.props.field.name,onCheck:this.onValueChange,children:this.props.field.values[t]})},`checkbox-${t}`)));return(0,j.jsx)("div",{children:t})}}function ue(e){const t=[];void 0!==e.placeholder&&t.push((0,j.jsx)("option",{value:"",children:e.placeholder},0));const n=Q()().year();for(let e=n;e>=n-100;e-=1)t.push((0,j.jsx)("option",{value:e,children:e},e));return(0,j.jsx)(g.Select,{isMinWidth:!0,name:`${e.name}[year]`,value:e.year,onChange:e.onValueChange,children:t})}function pe(e){const t=[];void 0!==e.placeholder&&t.push((0,j.jsx)("option",{value:"",children:e.placeholder},0));for(let n=1;n<=12;n+=1)t.push((0,j.jsx)("option",{value:n,children:e.monthNames[n-1]},n));return(0,j.jsx)(g.Select,{isMinWidth:!0,name:`${e.name}[month]`,value:e.month,onChange:e.onValueChange,children:t})}function me(e){const t=[];void 0!==e.placeholder&&t.push((0,j.jsx)("option",{value:"",children:e.placeholder},0));for(let e=1;e<=31;e+=1)t.push((0,j.jsx)("option",{value:e,children:e},e));return(0,j.jsx)(g.Select,{isMinWidth:!0,name:`${e.name}[day]`,value:e.day,onChange:e.onValueChange,children:t})}de.propTypes={onValueChange:f().func.isRequired,field:f().shape({name:f().string.isRequired,values:f().objectOf(f().string)}).isRequired,item:f().object.isRequired},ue.propTypes={name:f().string.isRequired,placeholder:f().string.isRequired,onValueChange:f().func.isRequired,year:f().oneOfType([f().string,f().number]).isRequired},pe.propTypes={name:f().string.isRequired,placeholder:f().string.isRequired,onValueChange:f().func.isRequired,month:f().oneOfType([f().string,f().number]).isRequired,monthNames:f().arrayOf(f().string).isRequired},me.propTypes={name:f().string.isRequired,placeholder:f().string.isRequired,onValueChange:f().func.isRequired,day:f().oneOfType([f().string,f().number]).isRequired};class he extends w.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=Q()(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,j.jsx)(ue,{onValueChange:this.onValueChange,name:this.props.field.name,year:this.state.year,placeholder:this.props.field.year_placeholder},"year");case"MM":return(0,j.jsx)(pe,{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,j.jsx)(me,{onValueChange:this.onValueChange,name:this.props.field.name,day:this.state.day,placeholder:this.props.field.day_placeholder},"day");default:return(0,j.jsx)("div",{children:"Invalid date type"})}}));return(0,j.jsx)("div",{children:n})}}he.propTypes={item:f().object.isRequired,field:f().shape({name:f().string,day_placeholder:f().string,month_placeholder:f().string,year_placeholder:f().string,params:f().object}).isRequired,onValueChange:f().func.isRequired};var fe=n(22529);class ge extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"renderField",(e=>{let t,n=!1;e.field.description&&(n=(0,j.jsx)("p",{className:"description",children:e.field.description}));let r=e.field;switch(void 0!==e.field.field&&(r=m().merge(r,e.field.field)),r.type){case"text":t=(0,j.jsx)(ne,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"textarea":t=(0,j.jsx)(ae,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"select":t=(0,j.jsx)(ie,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"radio":t=(0,j.jsx)(le,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"checkbox":t=(0,j.jsx)(de,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"selection":t=(0,j.jsx)(I,{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,j.jsx)(he,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"reactComponent":t=(0,j.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,j.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,j.jsx)(fe.X,{level:4,children:(0,j.jsx)("label",{htmlFor:`field_${this.props.field.name}`,children:this.props.field.label})}));let n=!1;return this.props.field.tip&&(n=(0,j.jsx)("p",{className:"mailpoet-form-description",children:this.props.field.tip})),(0,j.jsxs)("div",{className:`mailpoet-form-field-${this.props.field.name} form-field-row-${this.props.field.name}`,children:[t,n,e]})}}ge.propTypes={onValueChange:f().func,field:f().shape({name:f().string.isRequired,values:f().objectOf(f().string),tip:f().oneOfType([f().array,f().string]),label:f().string,fields:f().arrayOf(f().object),description:f().string}).isRequired,item:f().object.isRequired},ge.defaultProps={onValueChange:function(){}};class xe extends w.Component{constructor(e){super(e),(0,y.Z)(this,"getValues",(()=>this.props.item||this.state.item)),(0,y.Z)(this,"getErrors",(()=>this.props.errors||this.state.errors)),(0,y.Z)(this,"loadItem",(e=>{this.setState({loading:!0}),this.props.endpoint&&v.x.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,y.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&&v.x.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,y.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,w.createRef)(),this.state={loading:!1,errors:[],item:{}}}componentDidMount(){void 0!==this.props.params.id?this.loadItem(this.props.params.id):ee()((()=>{this.setState({item:m()(".mailpoet_form").mailpoetSerializeObject()})}))}componentDidUpdate(e){void 0===this.props.params.id&&e.location.pathname!==this.props.location.pathname&&(ee()((()=>{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,j.jsx)("div",{className:"mailpoet_notice notice inline error is-dismissible",children:(0,j.jsx)("p",{children:e.message})},`error-${e.message}`))));const t=u()("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,j.jsx)(ge,{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,j.jsx)(g.Button,{type:"submit",isDisabled:this.state.loading,children:v.x.I18n.t("save")}),(0,j.jsxs)("div",{children:[(0,j.jsx)("div",{className:"mailpoet-form-content-around",children:n}),(0,j.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,j.jsxs)("div",{className:"mailpoet-form-grid",children:[a,(0,j.jsx)("div",{className:"mailpoet-form-actions",children:s})]})]}),(0,j.jsx)("div",{className:"mailpoet-form-content-around",children:r})]})}}xe.propTypes={params:f().shape({id:f().string}),location:f().shape({pathname:f().string}),item:f().object,errors:f().arrayOf(f().object),endpoint:f().string,fields:f().arrayOf(f().object),messages:f().shape({onUpdate:f().func,onCreate:f().func}),loading:f().bool,children:f().array,id:f().string,automationId:f().string,beforeFormContent:f().func,afterFormContent:f().func,onItemLoad:f().func,isValid:f().func,onChange:f().func,onSubmit:f().func,onSuccess:f().func,history:f().shape({push:f().func.isRequired}).isRequired},xe.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};const ve=(0,c.withRouter)(xe);var be=n(71014);const ye=[{name:"email",label:v.x.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:v.x.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:v.x.I18n.t("lastname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"status",label:v.x.I18n.t("status"),type:"select",automationId:"subscriber-status",values:{subscribed:v.x.I18n.t("subscribed"),unconfirmed:v.x.I18n.t("unconfirmed"),unsubscribed:v.x.I18n.t("unsubscribed"),inactive:v.x.I18n.t("inactive"),bounced:v.x.I18n.t("bounced")}},{name:"segments",label:v.x.I18n.t("lists"),type:"selection",placeholder:v.x.I18n.t("selectList"),tip:v.x.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=v.x.Date.format(t.updated_at);n+=" (%1$s)".replace("%1$s",v.x.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=v.x.I18n.t("year"),t.month_placeholder=v.x.I18n.t("month"),t.day_placeholder=v.x.I18n.t("day");break;case"select":t.placeholder="-";break;default:t.placeholder=""}ye.push(t)}));const we={onUpdate:function(){v.x.Notice.success(v.x.I18n.t("subscriberUpdated"))},onCreate:function(){v.x.Notice.success(v.x.I18n.t("subscriberAdded")),v.x.trackEvent("Subscribers > Add new")}};function _e(e){if(Number(e.wp_user_id)>0)return(0,j.jsx)("p",{className:"description",children:C()(v.x.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,((t,n)=>(0,j.jsx)("a",{href:`user-edit.php?user_id=${e.wp_user_id}`,children:t},n)))})}function je(e){var t;return(0,j.jsxs)(j.Fragment,{children:[null==e||null===(t=e.unsubscribes)||void 0===t?void 0:t.map((e=>{const t=Q()(e.createdAt.date).format("dddd MMMM Do YYYY [at] h:mm:ss a");let n;return n="admin"===e.source?v.x.I18n.t("unsubscribedAdmin").replace("%1$d",t).replace("%2$d",e.meta):"manage"===e.source?v.x.I18n.t("unsubscribedManage").replace("%1$d",t):"newsletter"===e.source?C()(v.x.I18n.t("unsubscribedNewsletter").replace("%1$d",t),/\[link\]/g,((t,n)=>(0,j.jsx)("a",{href:`admin.php?page=mailpoet-newsletter-editor&id=${e.newsletterId}`,children:e.newsletterSubject},n))):v.x.I18n.t("unsubscribedUnknown").replace("%1$d",t),(0,j.jsx)("p",{className:"description",children:n},n)})),(0,j.jsxs)("p",{className:"description",children:[(0,j.jsx)("strong",{children:v.x.I18n.t("tip")})," ",v.x.I18n.t("customFieldsTip")]})]})}function Ie(e){var t;let{match:n}=e;const r=(0,c.useLocation)(),a=(0,c.useHistory)(),s=(null===(t=r.state)||void 0===t?void 0:t.backUrl)||"/";return(0,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(be.B,{}),(0,j.jsxs)(fe.X,{level:1,className:"mailpoet-title",children:[(0,j.jsx)("span",{children:v.x.I18n.t("subscriber")}),(0,j.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:s,children:v.x.I18n.t("backToList")})]}),(0,j.jsx)(k,{}),(0,j.jsx)(ve,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:ye,params:n.params,messages:we,beforeFormContent:_e,afterFormContent:je,onSuccess:()=>a.push(s)})]})}Ie.propTypes={match:f().shape({params:f().shape({id:f().string}).isRequired}).isRequired};var Se=n(5830),Ce=n(71304);function Te(e){var t;let{email:n}=e;const r=(null===(t=(0,c.useLocation)().state)||void 0===t?void 0:t.backUrl)||"/";return(0,j.jsxs)(fe.X,{level:1,className:"mailpoet-title",children:[(0,j.jsx)("span",{children:v.x.I18n.t("statsHeading").replace("%s",n)}),(0,j.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:r,children:v.x.I18n.t("backToList")})]})}var ke=n(57578);function Ne(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,j.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,j.jsx)("div",{className:"mailpoet-listing",children:(0,j.jsx)("table",{className:"mailpoet-listing-table",children:(0,j.jsxs)("tbody",{children:[(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:v.x.I18n.t("statsSentEmail")}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:t.toLocaleString()})}),(0,j.jsx)("td",{})]}),(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:(0,j.jsx)(ke.V,{children:v.x.I18n.t("statsOpened")})}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:n.toLocaleString()})}),(0,j.jsx)("td",{children:u&&(0,j.jsxs)(j.Fragment,{children:[i,"%"]})})]}),(0,j.jsxs)("tr",{children:[(0,j.jsxs)("td",{children:[(0,j.jsx)(ke.V,{children:v.x.I18n.t("statsMachineOpened")}),(0,j.jsx)(A.Tooltip,{tooltip:C()(v.x.I18n.t("statsMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,j.jsx)("span",{style:{pointerEvents:"all"},children:(0,j.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,j.jsx)("td",{children:(0,j.jsx)("b",{children:r.toLocaleString()})}),(0,j.jsx)("td",{children:u&&(0,j.jsxs)(j.Fragment,{children:[o,"%"]})})]}),(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:(0,j.jsx)(ke.V,{isInverted:!0,children:v.x.I18n.t("statsClicked")})}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:a.toLocaleString()})}),(0,j.jsx)("td",{children:u&&(0,j.jsxs)(j.Fragment,{children:[l,"%"]})})]}),(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:v.x.I18n.t("statsNotClicked")}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:d.toLocaleString()})}),(0,j.jsx)("td",{children:u&&(0,j.jsxs)(j.Fragment,{children:[c,"%"]})})]}),(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:v.x.I18n.t("statisticsColumn")}),(0,j.jsx)("td",{children:(0,j.jsx)("div",{className:"mailpoet-listing-stats",children:(0,j.jsx)(L,{id:s.id,engagementScore:s.engagement_score})})}),(0,j.jsx)("td",{})]})]})})})})}function De(e){let{revenueValue:t,count:n,averageRevenueValue:r}=e;return(0,j.jsx)("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary",children:(0,j.jsx)("div",{className:"mailpoet-listing",children:(0,j.jsx)("table",{className:"mailpoet-listing-table",children:(0,j.jsxs)("tbody",{children:[(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:"Orders created"}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:n.toLocaleString()})})]}),(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:"Total revenue"}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:t})})]}),(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{children:"Average revenue"}),(0,j.jsx)("td",{children:(0,j.jsx)("b",{children:r})})]})]})})})})}var Ee=n(11645),Oe=n(58901);function Re(e){let{limitReached:t,limitValue:n,subscribersCountTowardsLimit:r,premiumActive:a,hasValidApiKey:s,hasPremiumSupport:i}=e;return(0,j.jsxs)("table",{className:"mailpoet-listing-table","data-automation-id":"subscriber-stats-no-access",children:[(0,j.jsx)("thead",{children:(0,j.jsxs)("tr",{children:[(0,j.jsx)("th",{children:v.x.I18n.t("email")}),(0,j.jsx)("th",{children:v.x.I18n.t("columnAction")}),(0,j.jsx)("th",{children:v.x.I18n.t("columnCount")}),(0,j.jsx)("th",{children:v.x.I18n.t("columnActionOn")})]})}),(0,j.jsx)("tbody",{children:(0,j.jsx)("tr",{children:(0,j.jsx)("td",{colSpan:4,children:(0,j.jsx)("div",{className:"mailpoet-subscriber-stats-no-access-content",children:(0,j.jsx)(Oe.K,{title:a&&t?v.x.I18n.t("upgradeRequired"):v.x.I18n.t("premiumFeature"),message:(()=>{let e=v.x.I18n.t("premiumRequired");return a?(e=i?v.x.I18n.t("planLimitReached"):v.x.I18n.t("freeLimitReached"),(0,j.jsx)("p",{children:C()(e,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?r:n))})):(0,j.jsx)("p",{children:C()(e,/\[link](.*?)\[\/link]/g,(e=>(0,j.jsx)("a",{href:v.x.premiumLink,children:e},e)))})})(),actionButton:a&&t?(0,j.jsx)(O.z,{href:s?v.x.MailPoetComUrlFactory.getUpgradeUrl():v.x.MailPoetComUrlFactory.getPurchasePlanUrl(r+1),children:v.x.I18n.t("premiumBannerCtaUpgrade")}):(0,j.jsx)(O.z,{href:v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount,v.x.currentWpUserEmail,null,{utm_medium:"stats",utm_campaign:"signup"}),children:v.x.I18n.t("premiumBannerCtaFree")})})})})})})]})}function Ae(e){let{params:t,location:n}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:4,children:v.x.I18n.t("openedEmailsHeading")}),!v.x.premiumActive||v.x.subscribersLimitReached?(0,j.jsx)(Re,{limitReached:v.x.subscribersLimitReached,limitValue:v.x.subscribersLimit,subscribersCountTowardsLimit:v.x.subscribersCount,premiumActive:v.x.premiumActive,hasValidApiKey:v.x.hasValidApiKey,hasPremiumSupport:v.x.hasPremiumSupport}):Ee.Hooks.applyFilters("mailpoet_subscribers_opened_emails_stats",t,n)]})}function Pe(){const e=(0,c.useRouteMatch)(),t=(0,c.useLocation)(),[n,r]=(0,w.useState)(null),[a,s]=(0,w.useState)(!0),i=(0,Ce.S)(window).notices.error;return(0,w.useEffect)((()=>{v.x.Ajax.post({api_version:v.x.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,j.jsx)(j.Fragment,{children:e.errors.map((e=>(0,j.jsx)("p",{children:e.message},e.message)))}),{scroll:!0})}))}),[e.params.id,i]),a?(0,j.jsx)(Se.g,{}):(0,j.jsxs)("div",{className:"mailpoet-subscriber-stats",children:[(0,j.jsx)(Te,{email:n.email}),(0,j.jsxs)("p",{children:[v.x.I18n.t("lastEngagement"),": ",n.last_engagement?v.x.Date.format(n.last_engagement):v.x.I18n.t("never")]}),(0,j.jsxs)("div",{className:"mailpoet-subscriber-stats-summary-grid",children:[(0,j.jsx)(Ne,{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,j.jsx)(De,{averageRevenueValue:n.woocommerce.formatted_average,count:n.woocommerce.count,revenueValue:n.woocommerce.formatted})]}),(0,j.jsx)(Ae,{params:e.params,location:t})]})}var Me=n(93726);function Le(){return(0,j.jsx)(Ce.k.Provider,{value:(0,Ce.S)(window),children:(0,j.jsxs)(l.UT,{children:[(0,j.jsx)(Me.w,{}),(0,j.jsxs)(c.Switch,{children:[(0,j.jsx)(c.Route,{path:"/new",component:Ie}),(0,j.jsx)(c.Route,{path:"/edit/:id",component:Ie}),(0,j.jsx)(c.Route,{path:"/stats/:id/(.*)?",component:Pe}),(0,j.jsx)(c.Route,{path:"*",component:K})]})]})})}const Fe=document.getElementById("subscribers_container");Fe&&o().render((0,j.jsx)(Le,{}),Fe);var qe=n(93723),$e=n(68345);class Ue extends w.PureComponent{render(){const e=this.props.event,t=e.soon;let n;if(this.props.premium)n=(0,j.jsx)("a",{href:"?page=mailpoet-premium",target:"_blank",children:v.x.I18n.t("premiumFeatureLink")});else if(e.actionButtonLink&&e.actionButtonTitle)n=(0,j.jsx)("a",{href:e.actionButtonLink,target:"_blank",rel:"noopener noreferrer",children:e.actionButtonTitle});else{const r=t?null:_.ZP.partial(this.props.eventsConfigurator,e.slug);n=(0,j.jsx)(O.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||v.x.I18n.t("setUp")})}return(0,j.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,j.jsx)("div",{className:"mailpoet-newsletter-type-image",children:e.badge&&(0,j.jsx)($e.C,{title:e.badge.text})}),(0,j.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,j.jsxs)(fe.X,{level:4,children:[e.title," ",e.soon&&`(${v.x.I18n.t("soon")})`]}),(0,j.jsx)("p",{children:e.description}),(0,j.jsx)("div",{className:"mailpoet-flex-grow"}),(0,j.jsx)("div",{className:"mailpoet-newsletter-type-action",children:n})]})]})}}Ue.defaultProps={premium:!1},Ue.propTypes={premium:f().bool,eventsConfigurator:f().func.isRequired,event:f().shape({slug:f().string.isRequired,actionButtonLink:f().string,title:f().string.isRequired,soon:f().bool,badge:f().shape({style:f().string,text:f().string}),description:f().string.isRequired,actionButtonTitle:f().string}).isRequired};class Ze extends w.Component{constructor(e){super(e),this.email=this.props.email,this.emailEvents=this.email.events,this.eventsConfigurator=this.eventsConfigurator.bind(this)}eventsConfigurator(e){v.x.trackEvent("Emails > Automatic Type selected",{"Email type":e}),this.props.history.push(`/new/${this.email.slug}/${e}/conditions`)}render(){return _.ZP.map(this.emailEvents,((e,t)=>(0,j.jsx)(Ue,{premium:this.email.premium,event:e,eventsConfigurator:this.eventsConfigurator},t)))}}Ze.propTypes={email:f().shape({title:f().string.isRequired,slug:f().string.isRequired,premium:f().bool}).isRequired,history:f().shape({push:f().func.isRequired}).isRequired};const Ve=(0,c.withRouter)(Ze),We={woocommerce:(0,j.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,j.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,j.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"})]})};var Ye=n(33687);function Be(e){let{errors:t}=e;return t.length<1?null:(0,j.jsx)(T.q,{type:"error",closable:!1,children:t.map((e=>(0,j.jsx)("p",{children:e.message},e.message)))})}var He=n(62210);function ze(e){let{filter:t,history:n,hideClosingButton:r=!1,hideScreenOptions:a=!0}=e;const[s,i]=(0,w.useState)(!1),o=e=>{void 0!==e&&(n.push(`/new/${e}`),v.x.trackEvent("Emails > Type selected",{"Email type":e}))},l=async()=>{v.x.trackEvent("Emails > Type selected",{"Email type":"wc_transactional"});let e=window.mailpoet_woocommerce_transactional_email_id;if(!e)try{e=(await v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"settings",action:"set",data:{"woocommerce.use_mailpoet_editor":1}})).data.woocommerce.transactional_email_id,v.x.trackEvent("Emails > WooCommerce email customizer enabled")}catch(e){return(0,He.q)(e)&&e.errors.length>0?(0,j.jsx)(Be,{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,j.jsxs)("div",{"data-type":e.slug,className:"mailpoet-newsletter-type",children:[(0,j.jsx)("div",{className:"mailpoet-newsletter-type-image"}),(0,j.jsxs)("div",{className:"mailpoet-newsletter-type-content",children:[(0,j.jsxs)(fe.X,{level:4,children:[e.title," ",e.beta?`(${v.x.I18n.t("beta")})`:""]}),(0,j.jsx)("p",{children:e.description}),e.videoGuide&&(0,j.jsxs)("a",{className:t,href:e.videoGuide,"data-beacon-article":e.videoGuideBeacon,target:"_blank",rel:"noopener noreferrer",children:[(0,j.jsx)("span",{className:"dashicons dashicons-format-video"}),v.x.I18n.t("seeVideoGuide")]}),(0,j.jsx)("div",{className:"mailpoet-flex-grow"}),(0,j.jsx)("div",{className:"mailpoet-newsletter-type-action",children:e.action})]})]},e.slug)},d=_.ZP.partial((e=>{i(!0),v.x.trackEvent("Emails > Type selected",{"Email type":e}),v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"newsletters",action:"create",data:{type:e,subject:v.x.I18n.t("draftNewsletterTitle")}}).done((e=>{n.push(`/template/${e.data.id}`)})).fail((e=>(i(!1),e.errors.length>0?(0,j.jsx)(Be,{errors:e.errors}):null)))}),"standard"),u=_.ZP.partial(o,"notification"),p=_.ZP.partial(o,"welcome"),m=_.ZP.partial(o,"re-engagement"),h=[{slug:"standard",title:v.x.I18n.t("regularNewsletterTypeTitle"),description:v.x.I18n.t("regularNewsletterTypeDescription"),action:(0,j.jsx)(O.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:v.x.I18n.t("create")})},{slug:"welcome",title:v.x.I18n.t("welcomeNewsletterTypeTitle"),description:v.x.I18n.t("welcomeNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/254-video-guide-to-welcome-emails",videoGuideBeacon:"5b05ebf20428635ba8b2aa53",action:(0,j.jsx)(O.z,{onClick:p,automationId:"create_welcome",withSpinner:s,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),p())},tabIndex:0,children:v.x.I18n.t("setUp")})},{slug:"notification",title:v.x.I18n.t("postNotificationNewsletterTypeTitle"),description:v.x.I18n.t("postNotificationNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/210-video-guide-to-post-notifications",videoGuideBeacon:"59ba6fb3042863033a1cd5a5",action:(0,j.jsx)(O.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:v.x.I18n.t("setUp")})},{slug:"re_engagement",title:v.x.I18n.t("tabReEngagementTitle"),description:v.x.I18n.t("reEngagementDescription"),action:(0,j.jsx)(O.z,{automationId:"create_notification",onClick:m,withSpinner:s,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),m())},children:v.x.I18n.t("setUp")})}];let f=Ee.Hooks.applyFilters("mailpoet_newsletters_types",[...h],this);t&&(f=f.filter(t));const g=v.x.Ajax.constructGetUrl({api_version:v.x.apiVersion,endpoint:"newsletterTemplates",action:"getAll"});return(0,j.jsxs)(j.Fragment,{children:[a&&(0,j.jsx)(be.B,{}),(0,j.jsx)("link",{rel:"prefetch",href:window.mailpoet_editor_javascript_url,as:"script"}),(0,j.jsxs)("div",{className:"mailpoet-newsletter-types",children:[!r&&(0,j.jsx)("div",{className:"mailpoet-newsletter-types-close",children:(0,j.jsx)("button",{type:"button",onClick:()=>n.push("/"),className:"mailpoet-modal-close",children:Ye.X})}),f.map((e=>c(e)),this),(()=>{if(!window.mailpoet_woocommerce_automatic_emails)return[];let e=window.mailpoet_woocommerce_automatic_emails;return t&&(e=_.ZP.filter(e,t)),_.ZP.map(e,(e=>{const r=e;return(0,j.jsxs)(w.Fragment,{children:[!t&&(0,j.jsxs)("div",{className:"mailpoet-newsletter-types-separator",children:[(0,j.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"}),(0,j.jsx)("div",{className:"mailpoet-newsletter-types-separator-logo",children:We[r.slug]||null}),(0,j.jsx)("div",{className:"mailpoet-newsletter-types-separator-line"})]}),(0,j.jsx)(Ve,{email:r,history:n}),"woocommerce"===r.slug&&(v.x.isWoocommerceActive?[{slug:"wc_transactional",title:v.x.I18n.t("wooCommerceCustomizerTypeTitle"),description:v.x.I18n.t("wooCommerceCustomizerTypeDescription"),action:(0,j.jsx)(O.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:v.x.I18n.t("customize")})}]:[]).map((e=>c(e)),this)]},r.slug)}))})()]}),(0,j.jsx)("link",{rel:"prefetch",href:g,as:"fetch"})]})}ze.defaultProps={filter:null,hideScreenOptions:!0,hideClosingButton:!1};const Ke=(0,c.withRouter)(ze);var Ge=n(9358);function Qe(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:Ee.Hooks.applyFilters("mailpoet_newsletters_listing_stats_tracking",qe.gP)},i=Number(t.total_sent||t.queue.count_processed);let o,c,d,u,p,m=0,h=0,f=null;i>0&&(m=100*t.statistics.clicked/i,h=100*t.statistics.opened/i,f=t.statistics.revenue),void 0!==r?(o=6,c=t.queue.scheduled_at||t.queue.created_at,d=Q()(r).diff(Q()(c),"hours"),u=d<o,p=!0):(u=!1,p=!1);const x=i>=20&&t.statistics.opened>=5&&!u,b=(e,n)=>((e,t,n,r)=>r<=0||!t.link?e:t.externalLink?(0,j.jsx)("a",{href:t.link,onClick:t.onClick||null,children:e},`stats-${n}`):(0,j.jsx)(l.rU,{to:t.link,onClick:t.onClick||null,children:e},`stats-${n}`))(e,s,`${n}-${t.id}`,i),y=(0,j.jsx)(Ge.M,{opened:h,clicked:m,revenues:f&&f.value>0?f.formatted:null,hideBadges:!x,newsletterId:t.id,wrapContentInLink:b}),w=(0,j.jsxs)(j.Fragment,{children:[y,u&&b((0,j.jsx)(g.Tag,{className:"mailpoet-listing-stats-too-early",dimension:"large",variant:"excellent",isInverted:!0,children:v.x.I18n.t("checkBackInHours").replace("%1$d",o-d)}),"check-back")]});let _;return p&&h<5&&d>=24&&i>=10&&(_=(0,j.jsx)("div",{children:(0,j.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:v.x.I18n.t("improveThisLinkText")})})),(0,j.jsxs)(j.Fragment,{children:[w,_]})}const Xe=f().shape({clicked:f().number,opened:f().number,unsubscribed:f().number,revenue:f().shape({count:f().number,currency:f().string,formatted:f().string,value:f().number})}),Je=f().shape({status:f().string,count_processed:f().string.isRequired,count_total:f().string.isRequired,created_at:f().string,scheduled_at:f().string});Qe.propTypes={newsletter:f().shape({id:f().number.isRequired,queue:f().oneOfType([Je,f().bool]),total_sent:f().number,statistics:f().oneOfType([Xe,f().bool])}).isRequired,isSent:f().bool,currentTime:f().string},Qe.defaultProps={isSent:void 0,currentTime:void 0};const et=v.x.trackingConfig.emailTrackingEnabled,tt=window.mailpoet_woocommerce_automatic_emails||{},nt={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterTrashed"):v.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterDeleted"):v.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterRestored"):v.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},rt=[{name:"subject",label:v.x.I18n.t("subject"),sortable:!0},{name:"settings",label:v.x.I18n.t("settings")},{name:"statistics",label:v.x.I18n.t("statistics"),display:et},{name:"status",label:v.x.I18n.t("status"),width:145},{name:"updated_at",label:v.x.I18n.t("lastModifiedOn"),sortable:!0}],at=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:nt.onTrash}];let st=[{name:"view",link:function(e){return(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("edit"),onClick:qe.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:(e,t)=>v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{v.x.Notice.success(v.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"trash",className:"mailpoet-hide-on-mobile"}];st=(0,qe.y8)(st);class it extends w.Component{constructor(e){super(e),(0,y.Z)(this,"updateStatus",((e,t)=>{t.persist(),v.x.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=tt[e];v.x.Notice.success(v.x.I18n.t("automaticEmailActivated").replace("%1s",n.title))}this.forceUpdate()})).fail((n=>{v.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,y.Z)(this,"renderStatus",(e=>{const t=parseInt(e.total_sent,10)>-1?v.x.I18n.t("sentToXCustomers").replace("%1$d",e.total_sent.toLocaleString()):null;return(0,j.jsxs)("div",{children:[(0,j.jsx)(g.Toggle,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,"data-group":e.options.group,dimension:"small",defaultChecked:"active"===e.status}),(0,j.jsxs)("p",{className:"mailpoet-listing-notification-status",children:[t&&(0,j.jsx)(l.rU,{to:`/sending-status/${e.id}`,children:t}),!t&&(0,j.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small",children:v.x.I18n.t("notSentYet")})]})]})})),(0,y.Z)(this,"renderSettings",(e=>{const t=tt[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?_.ZP.pluck(n.option,"name"):[];if(n&&_.ZP.isEmpty(r))return(0,j.jsx)("span",{className:"mailpoet-listing-error",children:v.x.I18n.t("automaticEmailEventOptionsNotConfigured")});let a,s;if(a=r.length>1&&"listingScheduleDisplayTextPlural"in t?C()(t.listingScheduleDisplayTextPlural,"%s",((e,t)=>(0,j.jsx)(g.Tags,{strings:r},t))):C()(t.listingScheduleDisplayText,"%s",((e,t)=>(0,j.jsx)(g.Tags,{strings:r},t))),a&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":s=v.x.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":s=v.x.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":s=v.x.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":s=v.x.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:s=v.x.I18n.t("sendingDelayInvalid")}return(0,j.jsxs)("span",{children:[a,s&&(0,j.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,j.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,j.jsx)(g.ScheduledIcon,{})}),s]})]})})),(0,y.Z)(this,"renderItem",((e,t)=>{const n=u()("manage-column","column-primary","has-row-actions");return(0,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:n,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("settings"),children:this.renderSettings(e)}),!0===et?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("statistics"),children:(0,j.jsx)(Qe,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("status"),children:this.renderStatus(e)}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("lastModifiedOn"),children:[v.x.Date.short(e.updated_at),(0,j.jsx)("br",{}),v.x.Date.time(e.updated_at)]})]})})),(0,y.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={eventCounts:{},newslettersCount:void 0},this.afterGetItems=this.afterGetItems.bind(this)}afterGetItems(e){(0,qe._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,j.jsxs)("div",{className:"notice error",children:[(0,j.jsx)("p",{children:v.x.I18n.t("wooCommerceEmailsWarning")}),(0,j.jsx)("p",{children:(0,j.jsx)("a",{href:"?page=mailpoet-settings#woocommerce",children:v.x.I18n.t("wooCommerceEmailsWarningLink")})})]}):null}render(){const{match:e,location:t}=this.props;return(0,j.jsxs)(j.Fragment,{children:[this.renderWarning(),0===this.state.newslettersCount&&(0,j.jsx)(Ke,{filter:e=>"woocommerce"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,j.jsx)(x.N,{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:rt,bulk_actions:at,item_actions:st,messages:nt,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)}})]})}}it.propTypes={match:f().shape({params:f().shape({tab:f().string}).isRequired}).isRequired,location:f().object.isRequired};const ot=(0,c.withRouter)(it);var lt=n(80416),ct=n(21526);const dt=(0,c.withRouter)((e=>(0,j.jsx)(ct.b,{...e})));var ut=n(12912),pt=n(9185);class mt extends w.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,pt._)({message:v.x.I18n.t("confirmTemplateDeletion").replace("%1$s",t),onConfirm:()=>{n(),v.x.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,j.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}})}onPreview(){v.x.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(),v.x.trackEvent("Emails > Template selected",{"Email name":t}),v.x.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,j.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,j.jsxs)("a",{className:"mailpoet-template-preview",href:"#",onClick:e=>{e.preventDefault(),this.onPreview(e)},children:[(0,j.jsx)("div",{className:"mailpoet-template-thumbnail",children:n?(0,j.jsx)("img",{src:n,alt:v.x.I18n.t("templatePreview"),loading:"lazy"}):""}),(0,j.jsx)("div",{className:"mailpoet-template-preview-overlay",children:(0,j.jsx)(O.z,{children:v.x.I18n.t("zoom")})})]})),(0,j.jsx)(ut.G,{label:t,onSelect:this.onSelect,onDelete:!1===r?this.onDelete:void 0,automationId:`select_template_${e}`,className:"mailpoet-template-two-lines",children:a})}}mt.contextType=Ce.k,mt.propTypes={index:f().number.isRequired,id:f().number.isRequired,newsletterId:f().string.isRequired,name:f().string.isRequired,thumbnail:f().string,readonly:f().bool.isRequired,beforeDelete:f().func.isRequired,afterDelete:f().func.isRequired,beforeSelect:f().func.isRequired,afterSelect:f().func.isRequired},mt.defaultProps={thumbnail:null};class ht extends w.Component{constructor(e){super(e),this.fileRef=(0,w.createRef)(),this.handleSubmit=this.handleSubmit.bind(this)}handleSubmit(e){if(e.preventDefault(),_.ZP.size(this.fileRef.current.files)<=0)return!1;const t=_.ZP.first(this.fileRef.current.files),n=new FileReader;return n.onload=e=>{try{this.saveTemplate(JSON.parse(e.target.result)),v.x.trackEvent("Emails > Template imported")}catch(e){this.context.notices.error((0,j.jsx)("p",{children:v.x.I18n.t("templateFileMalformedError")}))}},n.readAsText(t),!0}saveTemplate(e){const t=e,{beforeImport:n,afterImport:r}=this.props;_.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(),v.x.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,j.jsx)("p",{children:e.message},e.message))),{scroll:!0}),r(!1)}))}render(){return(0,j.jsxs)("div",{className:"mailpoet-template-import",children:[(0,j.jsxs)("h4",{children:[v.x.I18n.t("importTemplateTitle"),(0,j.jsx)(A.Tooltip,{tooltip:v.x.I18n.t("helpTooltipTemplateUpload"),place:"right",className:"tooltip-help-import-template"})]}),(0,j.jsxs)("form",{onSubmit:this.handleSubmit,children:[(0,j.jsx)("input",{type:"file",placeholder:v.x.I18n.t("selectJsonFileToUpload"),ref:this.fileRef}),(0,j.jsx)("p",{className:"submit",children:(0,j.jsx)("input",{className:"button button-primary",type:"submit",value:v.x.I18n.t("upload")})})]})]})}}ht.contextType=Ce.k,ht.propTypes={beforeImport:f().func.isRequired,afterImport:f().func.isRequired};const ft=[];window.mailpoet_newsletters_templates_recently_sent_count&&ft.push({name:"recent",label:v.x.I18n.t("recentlySent")}),ft.push({name:"standard",label:v.x.I18n.t("tabStandardTitle")},{name:"welcome",label:v.x.I18n.t("tabWelcomeTitle")},{name:"notification",label:v.x.I18n.t("tabNotificationTitle")},{name:"re_engagement",label:v.x.I18n.t("tabReEngagementTitle")},{name:"blank",label:v.x.I18n.t("tabBlankTitle")}),window.mailpoet_woocommerce_active&&ft.push({name:"woocommerce",label:v.x.I18n.t("tabWoocommerceTitle")}),ft.push({name:"saved",label:v.x.I18n.t("savedTemplates")});class gt extends w.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(){v.x.Ajax.get({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"getAll"}).done((e=>{0===e.data.length&&(e.data=[{name:v.x.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,j.jsx)("p",{children:e.message},e.message))),{scroll:!0})})).always((()=>{this.selectInitialTab()}))}addTemplate(e){const t=ft.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";v.x.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":_.ZP.findWhere(ft,{name:n.data.type})?t=n.data.type:"automatic"===n.data.type&&_.ZP.findWhere(ft,{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,j.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,j.jsx)(Se.g,{});const e=ft.concat({name:"import",label:v.x.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,j.jsx)(ht,{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,j.jsx)("p",{children:v.x.I18n.t("noTemplates")}):e.map(((e,t)=>(0,j.jsx)(mt,{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,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(dt,{emailType:this.state.emailType,automationId:"email_template_selection_heading"}),(0,j.jsxs)("div",{className:"mailpoet-templates",children:[(0,j.jsx)(lt.R,{categories:e,active:this.state.selectedTab,onSelect:e=>this.setState({selectedTab:e})}),t]})]})}}gt.contextType=Ce.k,gt.propTypes={match:f().shape({params:f().shape({id:f().string}).isRequired}).isRequired};var xt=n(31304),vt=n.n(xt),bt=n(11830),yt=n(9198),wt=n.n(yt),_t=n(4958),jt=n(16245),It=n.n(jt);function St(e){var t;let{dimension:n,isFullWidth:r,iconStart:a,iconEnd:s,...i}=e;return(0,j.jsxs)("div",{className:u()("mailpoet-datepicker mailpoet-form-input",{[`mailpoet-form-input-${n}`]:n,"mailpoet-disabled":i.disabled,"mailpoet-full-width":r}),children:[a,(0,j.jsx)(wt(),{useWeekdaysShort:!0,calendarStartDay:null!==(t=i.calendarStartDay)&&void 0!==t?t:v.x.wpWeekStartsOn,...i}),s]})}const Ct={abbreviated:[v.x.I18n.t("januaryShort"),v.x.I18n.t("februaryShort"),v.x.I18n.t("marchShort"),v.x.I18n.t("aprilShort"),v.x.I18n.t("mayShort"),v.x.I18n.t("juneShort"),v.x.I18n.t("julyShort"),v.x.I18n.t("augustShort"),v.x.I18n.t("septemberShort"),v.x.I18n.t("octoberShort"),v.x.I18n.t("novemberShort"),v.x.I18n.t("decemberShort")],wide:[v.x.I18n.t("january"),v.x.I18n.t("february"),v.x.I18n.t("march"),v.x.I18n.t("april"),v.x.I18n.t("may"),v.x.I18n.t("june"),v.x.I18n.t("july"),v.x.I18n.t("august"),v.x.I18n.t("september"),v.x.I18n.t("october"),v.x.I18n.t("november"),v.x.I18n.t("december")]},Tt={narrow:[v.x.I18n.t("sundayMin"),v.x.I18n.t("mondayMin"),v.x.I18n.t("tuesdayMin"),v.x.I18n.t("wednesdayMin"),v.x.I18n.t("thursdayMin"),v.x.I18n.t("fridayMin"),v.x.I18n.t("saturdayMin")],abbreviated:[v.x.I18n.t("sundayShort"),v.x.I18n.t("mondayShort"),v.x.I18n.t("tuesdayShort"),v.x.I18n.t("wednesdayShort"),v.x.I18n.t("thursdayShort"),v.x.I18n.t("fridayShort"),v.x.I18n.t("saturdayShort")],wide:[v.x.I18n.t("sunday"),v.x.I18n.t("monday"),v.x.I18n.t("tuesday"),v.x.I18n.t("wednesday"),v.x.I18n.t("thursday"),v.x.I18n.t("friday"),v.x.I18n.t("saturday")]};_t.Z.localize.month=It()({values:Ct,defaultWidth:"wide"}),_t.Z.localize.day=It()({values:Tt,defaultWidth:"wide"}),_t.Z.options.weekStartsOn=void 0!==v.x.wpWeekStartsOn?v.x.wpWeekStartsOn:1,(0,yt.registerLocale)("mailpoet",_t.Z);class kt extends w.Component{constructor(){super(...arguments),(0,y.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,y.Z)(this,"getFieldName",(()=>this.props.name||"date")),(0,y.Z)(this,"getDisplayDateFormat",(e=>v.x.Date.convertFormat(e).replace(/D/g,"d").replace(/Y/g,"y").replace(/\[/g,"").replace(/\]/g,""))),(0,y.Z)(this,"getDate",(e=>{const t={parseFormat:this.props.storageFormat};return v.x.Date.toDate(e,t)})),(0,y.Z)(this,"getStorageDate",(e=>{const t={format:this.props.storageFormat};return v.x.Date.format(e,t)}))}render(){return(0,j.jsx)(St,{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})}}kt.propTypes={displayFormat:f().string.isRequired,onChange:f().func.isRequired,name:f().string,storageFormat:f().string.isRequired,value:f().string.isRequired,disabled:f().bool.isRequired,validation:f().shape({"data-parsley-required":f().bool,"data-parsley-required-message":f().string,"data-parsley-type":f().string,"data-parsley-errors-container":f().string,maxLength:f().number}).isRequired,maxDate:f().instanceOf(Date)},kt.defaultProps={name:"date",maxDate:null};class Nt extends w.Component{render(){const e=Object.keys(this.props.timeOfDayItems).map((e=>(0,j.jsx)("option",{value:e,children:this.props.timeOfDayItems[e]},`option-${this.props.timeOfDayItems[e]}`)));return(0,j.jsx)(se.P,{name:this.props.name||"time",value:this.props.value,disabled:this.props.disabled,onChange:this.props.onChange,isMinWidth:!0,...this.props.validation,children:e})}}Nt.propTypes={timeOfDayItems:f().objectOf(f().string).isRequired,name:f().string,value:f().string.isRequired,disabled:f().bool,onChange:f().func.isRequired,validation:f().object},Nt.defaultProps={name:"time",disabled:!1,validation:{}};class Dt extends w.Component{constructor(e){super(e),(0,y.Z)(this,"DATE_TIME_SEPARATOR"," "),(0,y.Z)(this,"getDateTime",(()=>[this.state.date,this.state.time].join(this.DATE_TIME_SEPARATOR))),(0,y.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,y.Z)(this,"handleChange",(e=>{const t={};t[e.target.name]=e.target.value,this.setState(t,this.propagateChange)})),(0,y.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||ee()((()=>{this.setState(this.buildStateFromProps(this.props))}))}render(){return(0,j.jsxs)(bt.r.Column,{className:"mailpoet-datetime-container",children:[(0,j.jsx)(kt,{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,j.jsx)(Nt,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems})]})}}Dt.propTypes={value:f().string,defaultDateTime:f().string.isRequired,dateDisplayFormat:f().string.isRequired,dateStorageFormat:f().string.isRequired,onChange:f().func,name:f().string,disabled:f().bool,dateValidation:f().object.isRequired,timeValidation:f().any,timeOfDayItems:f().objectOf(f().string).isRequired,maxDate:f().instanceOf(Date)},Dt.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0,value:void 0,maxDate:null};var Et=n(43246);class Ot extends w.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,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(ne,{item:{...this.props.item,sender_address:this.state.emailAddress},field:this.props.field,onValueChange:this.onChange}),(0,j.jsx)("div",{className:"regular-text",children:(0,j.jsx)(Et.L,{emailAddress:this.state.emailAddress,mssActive:window.mailpoet_mss_active})})]})}}Ot.propTypes={field:f().object.isRequired,item:f().shape({sender_address:f().string.isRequired}).isRequired,onValueChange:f().func},Ot.defaultProps={onValueChange:function(){}};const Rt=_.ZP.once((()=>v.x.trackEvent("User has typed a GA campaign name"))),At=C()(v.x.I18n.t("gaCampaignTip"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,j.jsxs)("span",{children:[(0,j.jsx)("br",{}),(0,j.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))),Pt={name:"ga_campaign",label:v.x.I18n.t("gaCampaignLine"),tip:At,type:"text",onBeforeChange:Rt};var Mt=n(18568);let Lt,Ft;!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"}(Lt||(Lt={})),function(e){e.Draft="draft",e.Scheduled="scheduled",e.Sending="sending",e.Sent="sent",e.Active="active"}(Ft||(Ft={}));const qt=window.mailpoet_current_time||"00:00",$t=`${window.mailpoet_tomorrow_date} 08:00:00`,Ut=window.mailpoet_schedule_time_of_day,Zt=window.mailpoet_date_display_format,Vt=window.mailpoet_date_storage_format;class Wt extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"getCurrentValue",(()=>{var e,t;return{isScheduled:"0",scheduledAt:$t,...null!==(e=null===(t=this.props.item)||void 0===t?void 0:t[this.props.field.name])&&void 0!==e?e:{}}})),(0,y.Z)(this,"getDateValidation",(()=>({"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("noScheduledDateError"),"data-parsley-errors-container":"#mailpoet_scheduling"}))),(0,y.Z)(this,"isScheduled",(()=>"1"===this.getCurrentValue().isScheduled)),(0,y.Z)(this,"handleCheckboxChange",((e,t)=>{const n={...t};n.target.value=t.target.checked?"1":"0",this.handleValueChange(n)})),(0,y.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,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("span",{className:"mailpoet-form-schedule-time",children:[v.x.I18n.t("websiteTimeIs")," ",qt]}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("div",{id:"mailpoet_scheduling",children:(0,j.jsx)(Dt,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:$t,timeOfDayItems:Ut,dateDisplayFormat:Zt,dateStorageFormat:Vt,maxDate:t})})]})),(0,j.jsxs)("div",{children:[(0,j.jsx)(Mt.Z,{checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onCheck:this.handleCheckboxChange,automationId:"email-schedule-checkbox"}),e]})}}let Yt=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:v.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:v.x.I18n.t("subjectLine"),tooltip:v.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:v.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:v.x.I18n.t("preheaderLine"),tooltip:`${v.x.I18n.t("preheaderLineTip1")} ${v.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"segments",label:v.x.I18n.t("segments"),tip:v.x.I18n.t("segmentsTip"),type:"selection",placeholder:v.x.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":v.x.I18n.t("noSegmentsSelectedError")}},{name:"options",label:v.x.I18n.t("scheduleIt"),type:"reactComponent",component:Wt},{name:"sender",label:v.x.I18n.t("sender"),tip:v.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:v.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ot,placeholder:v.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Pt,{name:"reply-to",label:v.x.I18n.t("replyTo"),tip:v.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:v.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:v.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Yt=Ee.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",Yt);const Bt={getFields:()=>Yt,getSendButtonOptions:function(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=Q()(window.mailpoet_current_date_time),a="object"==typeof n.options&&"1"===(null===(e=n.options)||void 0===e?void 0:e.isScheduled)&&v.x.Date.isInFuture(null===(t=n.options)||void 0===t?void 0:t.scheduledAt,r),s={value:a?v.x.I18n.t("schedule"):v.x.I18n.t("send")};return n.status!==Ft.Sent&&n.status!==Ft.Sending||(s.disabled="disabled"),s}},Ht=window.mailpoet_time_format||"H:i",zt={immediate:v.x.I18n.t("delayImmediately"),hours:v.x.I18n.t("delayHoursAfter"),days:v.x.I18n.t("delayDaysAfter"),weeks:v.x.I18n.t("delayWeeksAfter")},Kt={daily:v.x.I18n.t("daily"),weekly:v.x.I18n.t("weekly"),monthly:v.x.I18n.t("monthly"),nthWeekDay:v.x.I18n.t("monthlyEvery"),immediately:v.x.I18n.t("immediately")},Gt=_.ZP.object(_.ZP.map(_.ZP.times(24,(e=>3600*e)),(e=>{const t=new Date(null);return t.setSeconds(e),[e,v.x.Date.format(t,{format:Ht,offset:0})]}))),Qt={0:v.x.I18n.t("sunday"),1:v.x.I18n.t("monday"),2:v.x.I18n.t("tuesday"),3:v.x.I18n.t("wednesday"),4:v.x.I18n.t("thursday"),5:v.x.I18n.t("friday"),6:v.x.I18n.t("saturday")},Xt=_.ZP.object(_.ZP.map(_.ZP.times(28,(e=>e)),(e=>{const t={0:v.x.I18n.t("first"),1:v.x.I18n.t("second"),2:v.x.I18n.t("third")};let n;return n=void 0!==t[e]?t[e]:v.x.I18n.t("nth").replace("%1$d",e+1),[e+1,n]}))),Jt={1:v.x.I18n.t("first"),2:v.x.I18n.t("second"),3:v.x.I18n.t("third"),L:v.x.I18n.t("last")},en={name:"intervalType",values:Kt},tn={name:"timeOfDay",values:Gt},nn={name:"weekDay",values:Qt},rn={name:"monthDay",values:Xt},an={name:"nthWeekDay",values:Jt};class sn extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,y.Z)(this,"handleValueChanges",(e=>{const t=this.getCurrentValue();return this.props.onValueChange({target:{name:this.props.field.name,value:_.ZP.extend({},t,e)}})})),(0,y.Z)(this,"handleIntervalChange",(e=>{const t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),this.handleValueChanges(n)})),(0,y.Z)(this,"handleTimeOfDayChange",(e=>this.handleValueChanges({timeOfDay:e.target.value}))),(0,y.Z)(this,"handleWeekDayChange",(e=>this.handleValueChanges({weekDay:e.target.value}))),(0,y.Z)(this,"handleMonthDayChange",(e=>this.handleValueChanges({monthDay:e.target.value}))),(0,y.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,j.jsx)(ie,{field:tn,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==e.intervalType&&"nthWeekDay"!==e.intervalType||(n=(0,j.jsx)(ie,{field:nn,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===e.intervalType&&(r=(0,j.jsx)(ie,{field:rn,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===e.intervalType&&(a=(0,j.jsx)(ie,{field:an,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),(0,j.jsxs)("div",{children:[(0,j.jsx)(ie,{field:en,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[a,r,n,t]}),"immediately"!==e.intervalType&&(0,j.jsx)("div",{className:"mailpoet-gap"})]})}}sn.propTypes={item:f().object.isRequired,field:f().shape({name:f().string}).isRequired,onValueChange:f().func.isRequired};let on=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:v.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:v.x.I18n.t("subjectLine"),tooltip:v.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:v.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:v.x.I18n.t("preheaderLine"),tooltip:`${v.x.I18n.t("preheaderLineTip1")} ${v.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:v.x.I18n.t("selectFrequency"),type:"reactComponent",component:sn},{name:"segments",label:v.x.I18n.t("segments"),tip:v.x.I18n.t("segmentsTip"),type:"selection",placeholder:v.x.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 _.ZP.map(e,(e=>_.ZP.find(t,(t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:v.x.I18n.t("sender"),tip:v.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:v.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ot,placeholder:v.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Pt,{name:"reply-to",label:v.x.I18n.t("replyTo"),tip:v.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:v.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:v.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];on=Ee.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",on);const ln={getFields:function(){return on},getSendButtonOptions:function(){return{value:v.x.I18n.t("activate")}}},cn=window.mailpoet_roles||{},dn=_.ZP.filter(window.mailpoet_segments||[],(e=>"default"===e.type)),un={name:"event",values:{segment:v.x.I18n.t("onSubscriptionToList"),user:v.x.I18n.t("onWPUserRegistration")}},pn={name:"segment",placeholder:v.x.I18n.t("selectSegmentPlaceholder"),forceSelect2:!0,values:dn,getCount:e=>parseInt(e.subscribers,10).toLocaleString(),getLabel:e=>e.name,getValue:e=>e.id},mn={name:"role",values:cn},hn={name:"afterTimeNumber",size:3,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":v.x.I18n.t("emailCanBeScheduledUpToFiveYears")}},fn={name:"afterTimeType",values:zt};class gn extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,y.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:_.ZP.extend({},n,r)}})})),(0,y.Z)(this,"handleEventChange",(e=>this.handleValueChange("event",e.target.value))),(0,y.Z)(this,"handleSegmentChange",(e=>this.handleValueChange("segment",e.target.value))),(0,y.Z)(this,"handleRoleChange",(e=>this.handleValueChange("role",e.target.value))),(0,y.Z)(this,"handleAfterTimeNumberChange",(e=>this.handleValueChange("afterTimeNumber",e.target.value))),(0,y.Z)(this,"handleAfterTimeTypeChange",(e=>this.handleValueChange("afterTimeType",e.target.value)))}render(){const e=this.getCurrentValue();let t,n;return t="user"===e.event?(0,j.jsx)(ie,{field:mn,item:this.getCurrentValue(),onValueChange:this.handleRoleChange}):(0,j.jsx)(I,{field:pn,item:this.getCurrentValue(),onValueChange:this.handleSegmentChange}),"immediate"!==e.afterTimeType&&(n=(0,j.jsx)(ne,{field:hn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeNumberChange})),(0,j.jsxs)("div",{children:[(0,j.jsx)(ie,{field:un,item:this.getCurrentValue(),onValueChange:this.handleEventChange}),(0,j.jsx)("div",{className:"mailpoet-gap"}),t,(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[n,(0,j.jsx)(ie,{field:fn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeTypeChange})]}),(0,j.jsx)("div",{className:"mailpoet-form-errors"}),(0,j.jsx)("div",{className:"mailpoet-gap"})]})}}gn.propTypes={history:f().shape({push:f().func.isRequired}).isRequired,item:f().object.isRequired,field:f().shape({name:f().string}).isRequired,onValueChange:f().func.isRequired};const xn=(0,c.withRouter)(gn);let vn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:v.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:v.x.I18n.t("subjectLine"),tooltip:v.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:v.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:v.x.I18n.t("preheaderLine"),tooltip:`${v.x.I18n.t("preheaderLineTip1")} ${v.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:v.x.I18n.t("selectEventToSendWelcomeEmail"),type:"reactComponent",component:xn},Pt,{name:"sender",label:v.x.I18n.t("sender"),tip:v.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:v.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ot,placeholder:v.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:v.x.I18n.t("replyTo"),tip:v.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:v.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:v.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];vn=Ee.Hooks.applyFilters("mailpoet_newsletters_3rd_step_fields",vn);const bn={getFields:function(){return vn},getSendButtonOptions:function(){return{value:v.x.I18n.t("activate")}}};class yn extends w.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=zt;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:_.ZP.map(t,((e,t)=>({name:e,id:t}))),extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>n},onValueChange:_.ZP.partial(this.handleChange,_.ZP,"afterTimeType")};return(0,j.jsx)(I,{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":v.x.I18n.t("emailCanBeScheduledUpToFiveYears")}},item:{},onValueChange:_.ZP.partial(this.handleChange,_.ZP,"afterTimeNumber")};return(0,j.jsx)(ne,{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,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-grid-column mailpoet-flex",children:[this.displayAfterTimeNumberField(),this.displayAfterTimeTypeOptions()]}),(0,j.jsx)("div",{className:"mailpoet-form-errors"}),(0,j.jsx)("div",{className:"mailpoet-gap"}),e.schedulingReadMoreLink&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("a",{href:e.schedulingReadMoreLink.link,target:"_blank",rel:"noopener noreferrer",className:"event-scheduling-read-more-link",children:e.schedulingReadMoreLink.text}),(0,j.jsx)("div",{className:"mailpoet-gap"})]})]})}}function wn(e){const t=e&&e.values?e.values:[];return t?t.map((e=>({id:e.id,name:e.name}))):t}function _n(e){let{eventOptions:t,eventSlug:n,selected:r,onValueChange:a}=e;function s(e){a&&a({eventOptionValue:e.target.value})}return(0,j.jsx)("div",{children:(0,j.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:wn(t),multiple:t.multiple||!1,placeholder:t.placeholder||!1,transformChangedValue:(e,t)=>_.ZP.map(t,(e=>({id:e.id,name:e.text}))),selected:()=>r,getLabel:_.ZP.property("name"),getValue:_.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,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(I,{field:e.field,onValueChange:e.onValueChange,item:e.item}),(0,j.jsx)("div",{className:"mailpoet-gap"})]})}()})})}yn.propTypes={item:f().shape({afterTimeType:f().string.isRequired,afterTimeNumber:f().number}).isRequired,afterTimeNumberSize:f().number,onValueChange:f().func,event:f().shape({defaultAfterTimeType:f().string,timeDelayValues:f().objectOf(f().shape({text:f().string,displayAfterTimeNumberField:f().bool})),schedulingReadMoreLink:f().shape({link:f().string.isRequired,text:f().string.isRequired})}).isRequired},yn.defaultProps={afterTimeNumberSize:3,onValueChange:null};class jn extends w.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=_.ZP.indexBy(this.email.events,"slug"),this.segments=_.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,j.jsx)(yn,{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,j.jsx)("div",{className:"event-segment-selection",children:(0,j.jsx)(I,{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=_.ZP.map(n.option,(e=>e.id))),(0,j.jsx)(_n,{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,j.jsxs)("div",{children:[(0,j.jsx)(fe.X,{level:5,children:this.displayHeader()}),this.displayEventOptions(),this.displaySegments(),this.displayScheduling()]})}}jn.propTypes={field:f().shape({email:f().shape({events:f().object.isRequired}).isRequired,emailOptions:f().object.isRequired}).isRequired,onValueChange:f().func},jn.defaultProps={onValueChange:null};const In=window.mailpoet_woocommerce_automatic_emails||[],Sn={getFields:function(e){return(e=>{const t=In[e.options.group];if(!t)return!1;const n=e.options;return[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:v.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:v.x.I18n.t("subjectLine"),tooltip:v.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:v.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:v.x.I18n.t("preheaderLine"),tooltip:`${v.x.I18n.t("preheaderLineTip1")} ${v.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:v.x.I18n.t("sendAutomaticEmailWhenHeading").replace("%1s",t.title),type:"reactComponent",component:jn,email:t,emailOptions:n},Pt,{name:"sender",label:v.x.I18n.t("sender"),tip:v.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:v.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"text",placeholder:v.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:v.x.I18n.t("replyTo"),tip:v.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:v.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:v.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}]})(e)},getSendButtonOptions:function(){return{value:v.x.I18n.t("activate")}}};var Cn=n(78230),Tn=n(68041);function kn(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,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:4,children:v.x.I18n.t("selectEventToSendReEngagementEmail")}),(0,j.jsxs)(bt.r.CenteredRow,{className:"mailpoet-re-engagement-scheduling",children:[(0,j.jsx)("p",{children:v.x.I18n.t("reEngagementTextPre")}),(0,j.jsx)(te.I,{type:"text",placeholder:v.x.I18n.t("reEngagementAterTimeNumberPlaceholder"),value:t,onChange:(0,Tn.z2)(r)}),(0,j.jsxs)(se.P,{value:n,onChange:(0,Tn.z2)(a),children:[(0,j.jsx)("option",{value:"weeks",children:"weeks"}),(0,j.jsx)("option",{value:"months",children:"months"})]})]}),!!s&&l<=o&&(0,j.jsx)("p",{className:"mailpoet-re-engagement-scheduling-note",children:C()(v.x.I18n.t("reEngagementEmailWarning").replace("{$months}",`${Math.floor(s/30)}`),/\[link\](.*?)\[\/link\]/g,(e=>(0,j.jsx)("a",{href:"https://kb.mailpoet.com/article/264-inactive-subscribers",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"5cbf19622c7d3a026fd3efe1",children:e},"link")))})]})}const Nn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:v.x.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:v.x.I18n.t("subjectLine"),tooltip:v.x.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:v.x.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:v.x.I18n.t("preheaderLine"),tooltip:`${v.x.I18n.t("preheaderLineTip1")} ${v.x.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",type:"reactComponent",component:function(e){return(0,j.jsx)(kn,{afterTimeNumber:e.item.options.afterTimeNumber.toString(),afterTimeType:e.item.options.afterTimeType,inactiveSubscribersPeriod:Number(v.x.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:t=>{e.onValueChange({target:{name:"options",value:(0,Cn.assoc)("afterTimeNumber",t,e.item.options)}})},updateAfterTimeType:t=>{e.onValueChange({target:{name:"options",value:(0,Cn.assoc)("afterTimeType",t,e.item.options)}})}})}},{name:"segments",label:v.x.I18n.t("segments"),tip:v.x.I18n.t("segmentsTip"),type:"selection",placeholder:v.x.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:v.x.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,Cn.map)((e=>(0,Cn.find)((t=>t.id===e),t)),e)},validation:{"data-parsley-required":!0,"data-parsley-required-message":v.x.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:v.x.I18n.t("sender"),tip:v.x.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:v.x.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Ot,placeholder:v.x.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:v.x.I18n.t("replyTo"),tip:v.x.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:v.x.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:v.x.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]},Pt],Dn={getFields:()=>Nn,getSendButtonOptions:()=>({value:v.x.I18n.t("activate")})};var En=n(7358);const On=window.mailpoet_woocommerce_automatic_emails||[],Rn=(e,t)=>`${vt()(t,{lower:!0}).replace(/[^a-z0-9]+/g,"-").replace(/-$/,"")||"newsletter"}_${e}`;function An(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)?v.x.I18n.t("newsletterIsEmpty"):window.mailpoet_mss_active&&t.indexOf("[link:subscription_unsubscribe_url]")<0&&t.indexOf("[link:subscription_unsubscribe]")<0?v.x.I18n.t("unsubscribeLinkMissing"):"re_engagement"===e.type&&t.indexOf("[link:subscription_re_engage_url]")<0?v.x.I18n.t("reEngageLinkMissing"):"notification"===e.type&&t.indexOf('"type":"automatedLatestContent"')<0&&t.indexOf('"type":"automatedLatestContentLayout"')<0?v.x.I18n.t("automatedLatestContentMissing"):"standard"===e.type&&"sent"===e.status?v.x.I18n.t("emailAlreadySent"):"re_engagement"!==e.type||v.x.trackingConfig.emailTrackingEnabled?void 0:(0,j.jsx)("span",{style:{pointerEvents:"all"},children:C()(v.x.I18n.t("reEngagementEmailsDisableIfTrackingIs"),/\[link\](.*?)\[\/link\]/g,(e=>(0,j.jsx)("a",{href:"?page=mailpoet-settings#/advanced",rel:"noopener noreferrer",children:e},"advancedSettingsTabLink")))})}class Pn extends w.Component{constructor(e){super(e),(0,y.Z)(this,"getFieldsByNewsletter",(e=>this.getSubtype(e).getFields(e))),(0,y.Z)(this,"getSendButtonOptions",(()=>this.getSubtype(this.state.item).getSendButtonOptions(this.state.item))),(0,y.Z)(this,"getSubtype",(e=>{switch(e.type){case"notification":return ln;case"welcome":return bn;case"re_engagement":return Dn;case"automatic":if(On[e.options.group])return Sn;default:return Bt}})),(0,y.Z)(this,"getThumbnailPromise",(e=>this.state.thumbnailPromise?this.state.thumbnailPromise:(0,En.W0)(e))),(0,y.Z)(this,"isValid",(()=>m()("#mailpoet_newsletter").parsley().isValid())),(0,y.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,y.Z)(this,"showInvalidFromAddressError",(()=>{const e=this.state.item.sender_address;let t=C()(v.x.I18n.t("newsletterInvalidFromAddress"),"%1$s",(()=>e));t=C()(t,/\[link\](.*?)\[\/link\]/g,(t=>`<a href="https://account.mailpoet.com/authorization?email=${encodeURIComponent(e)}" target="_blank" rel="noopener noreferrer">${t}</a>`)),m()("#field_sender_address").parsley().addError("invalidFromAddress",{message:t.join(""),updateClass:!0}),v.x.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"})})),(0,y.Z)(this,"removeInvalidFromAddressError",(()=>{m()("#field_sender_address").parsley().removeError("invalidFromAddress",{updateClass:!0})})),(0,y.Z)(this,"loadItem",(e=>(this.setState({loading:!0}),v.x.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=Rn(n.id,n.subject)),this.setState({item:e.data,fields:this.getFieldsByNewsletter(e.data),thumbnailPromise:t,validationError:An(e.data)})})).fail((()=>{this.setState({item:{}},(()=>{this.props.history.push("/new")}))}))))),(0,y.Z)(this,"saveTemplate",((e,t)=>{this.getThumbnailPromise(e.meta.preview_url).then((n=>{v.x.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}),v.x.Modal.loading(!1)})),t()})).catch((e=>{this.showError({errors:[e]})}))})),(0,y.Z)(this,"loadAuthorizedEmailAddresses",(async()=>"MailPoet"!==window.mailpoet_mta_method?[]:(await v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])),(0,y.Z)(this,"handleSend",(e=>(e.preventDefault(),this.removeInvalidFromAddressError(),this.isValid()?(v.x.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}),v.x.Modal.loading(!1)})):(this.showInvalidFromAddressError(),v.x.Modal.loading(!1))))):m()("#mailpoet_newsletter").parsley().validate()))),(0,y.Z)(this,"sendNewsletter",(e=>v.x.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 v.x.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,j.jsx)("p",{children:v.x.I18n.t("newsletterHasBeenScheduled")})),v.x.trackEvent("Emails > Newsletter sent",{scheduled:!0})):(this.context.notices.success((0,j.jsx)("p",{children:v.x.I18n.t("newsletterBeingSent")}),{id:"mailpoet_notice_being_sent"}),v.x.trackEvent("Emails > Newsletter sent",{scheduled:!1})),v.x.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),v.x.Modal.loading(!1)})))),(0,y.Z)(this,"activateNewsletter",(e=>v.x.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 v.x.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&&On[e.group]?this.context.notices.success((0,j.jsx)("p",{children:v.x.I18n.t("automaticEmailActivated").replace("%1s",On[e.group].title)})):"welcome"===t.data.type?(this.context.notices.success((0,j.jsx)("p",{children:v.x.I18n.t("welcomeEmailActivated")})),v.x.trackEvent("Emails > Welcome email activated",{"List type":e.event,Delay:`${e.afterTimeNumber} ${e.afterTimeType}`})):"notification"===t.data.type&&(this.context.notices.success((0,j.jsx)("p",{children:v.x.I18n.t("postNotificationActivated")})),v.x.trackEvent("Emails > Post notifications activated",{Frequency:e.intervalType})),v.x.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),v.x.Modal.loading(!1)})))),(0,y.Z)(this,"handleResume",(e=>(e.preventDefault(),this.isValid()?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((()=>{v.x.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,j.jsx)("p",{children:v.x.I18n.t("newsletterSendingHasBeenResumed")}))})).fail((e=>{this.showError(e)}))})).fail((e=>{this.showError(e)})).always((()=>{this.setState({loading:!1})})):m()("#mailpoet_newsletter").parsley().validate(),!1))),(0,y.Z)(this,"handleSave",(e=>{e.preventDefault(),this.saveNewsletter(e).done((()=>{this.context.notices.success((0,j.jsx)("p",{children:v.x.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,y.Z)(this,"handleRedirectToDesign",(e=>{e.preventDefault();const t=e.target.href;this.saveNewsletter(e).done((()=>{this.context.notices.success((0,j.jsx)("p",{children:v.x.I18n.t("newsletterUpdated")}))})).done((()=>{window.location=t})).fail((e=>{this.showError(e)}))})),(0,y.Z)(this,"saveNewsletter",(()=>{const e=this.state.item;e.queue=void 0,this.setState({loading:!0});const t=_.ZP.omit(e,["body","created_at","deleted_at","hash","status","updated_at","type"]);return v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:t})})),(0,y.Z)(this,"showError",(e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>(0,j.jsx)("p",{children:e.message},e.message))),{scroll:!0})})),(0,y.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===Rn(r.id,a)&&(r.ga_campaign=Rn(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})})),m()("#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,j.jsxs)("div",{className:"mailpoet-form-send-email",children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(dt,{emailType:a,automationId:"newsletter_send_heading"}),(0,j.jsxs)(ve,{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,j.jsxs)(bt.r.CenteredRow,{className:"send-newsletter-buttons",children:[(0,j.jsx)(g.Button,{variant:"secondary",type:"submit",automationId:"email-save-draft",children:v.x.I18n.t("saveDraftAndClose")}),e?(0,j.jsx)(g.Button,{type:"button",onClick:this.handleResume,isDisabled:r,automationId:"email-resume",children:v.x.I18n.t("resume")}):(0,j.jsx)(g.Button,{type:"button",onClick:this.handleSend,...n,isDisabled:r,automationId:"email-submit",children:n.value||v.x.I18n.t("send")}),void 0!==this.state.validationError&&(0,j.jsx)(A.Tooltip,{tooltip:(0,j.jsx)("div",{children:this.state.validationError}),tooltipId:"helpTooltipSendEmail"})]}),(0,j.jsxs)("p",{children:[v.x.I18n.t("orSimply")," ",(0,j.jsx)("a",{className:"mailpoet-link",href:`?page=mailpoet-newsletter-editor&id=${this.props.match.params.id}`,onClick:this.handleRedirectToDesign,children:v.x.I18n.t("goBackToDesign")}),"."]}),window.mailpoet_mss_key_pending_approval&&(0,j.jsx)("div",{className:"mailpoet_error",children:C()(v.x.I18n.t("pendingKeyApprovalNotice"),/\[link\](.*?)\[\/link\]/g,(e=>(0,j.jsx)("a",{href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer",children:e},"pendingKeyApprovalNoticeLink")))})]})]})}}Pn.contextType=Ce.k,Pn.propTypes={match:f().shape({params:f().shape({id:f().string}).isRequired}).isRequired,history:f().shape({push:f().func.isRequired}).isRequired};const Mn=(0,c.withRouter)(Pn);function Ln(e){const[t,n]=(0,w.useState)(!1);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:0,children:v.x.I18n.t("congratulationsSuccessHeader")}),(0,j.jsx)(fe.X,{level:3,children:(r=e.newsletter,"welcome"===r.type?v.x.I18n.t("congratulationsWelcomeEmailSuccessBody"):"notification"===r.type?v.x.I18n.t("congratulationsPostNotificationSuccessBody"):"automatic"===r.type?v.x.I18n.t("congratulationsWooSuccessBody"):"scheduled"===r.status?v.x.I18n.t("congratulationsScheduleSuccessBody"):v.x.I18n.t("congratulationsSendSuccessBody"))}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)("img",{src:e.illustrationImageUrl,alt:"",width:"500"}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)(g.Button,{type:"button",dimension:"small",onClick:()=>{e.successClicked(),n(!0)},withSpinner:t,children:v.x.I18n.t("close")})]});var r}function Fn(e){return(0,j.jsxs)("div",{className:"mailpoet-wizard-step",children:[(0,j.jsx)("div",{className:"mailpoet-wizard-step-illustration",children:(0,j.jsx)("img",{src:e.illustrationUrl,width:"500",alt:""})}),(0,j.jsx)("div",{className:"mailpoet-wizard-step-content",children:e.children})]})}function qn(e){let{children:t,isOrdered:n}=e;const r=n?"ol":"ul";return(0,j.jsx)(r,{className:`mailpoet-${r}`,children:t})}function $n(){return(0,j.jsxs)(qn,{children:[(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSList1")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSList2")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSList4")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSList5")})]})}function Un(){return(0,j.jsxs)(qn,{children:[(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSNotFreeList1")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSNotFreeList2")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSNotFreeList3")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSNotFreeList4")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardMSSNotFreeList5")})]})}function Zn(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)(g.Button,{isFullWidth:!0,href:e.mailpoetAccountUrl,target:"_blank",rel:"noopener noreferrer",onClick:t=>{t.preventDefault(),window.open(e.mailpoetAccountUrl),e.next()},children:e.nextButtonText}),(0,j.jsx)(g.Button,{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:v.x.I18n.t("welcomeWizardMSSNoThanks")})]})}function Vn(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("welcomeWizardMSSFreeTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("p",{children:v.x.I18n.t("welcomeWizardMSSFreeSubtitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)(fe.X,{level:5,children:[v.x.I18n.t("welcomeWizardMSSFreeListTitle"),":"]}),(0,j.jsx)($n,{}),(0,j.jsx)(Zn,{mailpoetAccountUrl:v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount,v.x.currentWpUserEmail,"starter",{utm_medium:"onboarding",utm_campaign:"purchase"}),next:e.next,nextButtonText:v.x.I18n.t("welcomeWizardMSSFreeButton")})]})}function Wn(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("welcomeWizardMSSNotFreeTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("p",{children:[v.x.I18n.t("welcomeWizardMSSNotFreeSubtitle"),":"]}),(0,j.jsx)(Un,{}),(0,j.jsx)(Zn,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next,nextButtonText:v.x.I18n.t("welcomeWizardMSSNotFreeButton")})]})}function Yn(e){return e.subscribersCount<1e3?(0,j.jsx)(Vn,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next}):(0,j.jsx)(Wn,{mailpoetAccountUrl:e.purchaseUrl,next:e.next})}function Bn(e){const[t,n]=(0,w.useState)(!1);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:(r=e.newsletter.type,{standard:v.x.I18n.t("congratulationsMSSPitchHeader"),welcome:v.x.I18n.t("congratulationsMSSPitchHeaderAutomated"),notification:v.x.I18n.t("congratulationsMSSPitchHeaderAutomated"),woocommerce:v.x.I18n.t("congratulationsMSSPitchHeaderAutomated")}[r]||v.x.I18n.t("congratulationsMSSPitchHeaderAutomated"))}),(0,j.jsx)(Fn,{illustrationUrl:e.MSSPitchIllustrationUrl,children:(0,j.jsxs)("div",{className:"mailpoet-welcome-wizard-step-content",children:[(0,j.jsx)(fe.X,{level:4,children:v.x.I18n.t("congratulationsMSSPitchSubHeader")}),(0,j.jsx)("p",{children:v.x.I18n.t(e.subscribersCount<1e3?"welcomeWizardMSSFreeSubtitle":"welcomeWizardMSSNotFreeSubtitle")}),(0,j.jsxs)(fe.X,{level:5,children:[v.x.I18n.t("welcomeWizardMSSFreeListTitle"),":"]}),(0,j.jsx)($n,{}),(0,j.jsx)(Zn,{mailpoetAccountUrl:e.purchaseUrl,next:()=>{e.onFinish(),n(!0)},nextButtonText:v.x.I18n.t("welcomeWizardMSSFreeButton"),nextWithSpinner:t})]})})]});var r}function Hn(e){return window.has_mss_key_specified?(0,j.jsx)(Ln,{successClicked:e.successClicked,illustrationImageUrl:e.illustrationImageUrl,newsletter:e.newsletter}):(0,j.jsx)(Bn,{MSSPitchIllustrationUrl:e.MSSPitchIllustrationUrl,onFinish:e.successClicked,subscribersCount:e.subscribersCount,purchaseUrl:e.purchaseUrl,newsletter:e.newsletter})}function zn(e){const[t,n]=(0,w.useState)(!1);return(0,j.jsxs)("div",{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("congratulationsSendFailHeader")}),(0,j.jsx)(fe.X,{level:3,children:C()(v.x.I18n.t("congratulationsSendFailExplain"),/\[link\](.*?)\[\/link\]/g,((e,t)=>(0,j.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,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)("img",{src:window.mailpoet_congratulations_error_image,alt:"",width:"500"}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)(g.Button,{dimension:"small",type:"button",onClick:()=>{e.failClicked(),n(!0)},withSpinner:t,children:v.x.I18n.t("close")})]})}Ln.propTypes={successClicked:f().func.isRequired,illustrationImageUrl:f().string.isRequired,newsletter:f().shape({status:f().string.isRequired,type:f().string.isRequired}).isRequired},Fn.propTypes={illustrationUrl:f().string.isRequired,children:f().oneOfType([f().arrayOf(f().node),f().node]).isRequired},Zn.propTypes={mailpoetAccountUrl:f().string.isRequired,next:f().func.isRequired,nextButtonText:f().string.isRequired,nextWithSpinner:f().bool},Zn.defaultProps={nextWithSpinner:!1},Vn.propTypes={next:f().func.isRequired},Wn.propTypes={mailpoetAccountUrl:f().string.isRequired,next:f().func.isRequired},Yn.propTypes={next:f().func.isRequired,subscribersCount:f().number.isRequired,mailpoetAccountUrl:f().string.isRequired,purchaseUrl:f().string.isRequired},Hn.propTypes={successClicked:f().func.isRequired,illustrationImageUrl:f().string.isRequired,MSSPitchIllustrationUrl:f().string.isRequired,newsletter:f().shape({status:f().string.isRequired,type:f().string.isRequired}).isRequired,subscribersCount:f().number.isRequired,purchaseUrl:f().string.isRequired},zn.propTypes={failClicked:f().func.isRequired};var Kn=n(63438);function Gn(e){return(0,j.jsx)("div",{className:"mailpoet-congratulate-loading",children:e.showRichLoadingScreen&&(0,j.jsxs)("div",{children:[(0,j.jsx)(fe.X,{level:0,children:v.x.I18n.t("congratulationsLoadingHeader")}),(0,j.jsx)(fe.X,{level:3,children:v.x.I18n.t("congratulationsLoadingBody")}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)("div",{className:"mailpoet-gap-large"}),(0,j.jsx)(Kn.a,{size:64})]})})}Gn.propTypes={showRichLoadingScreen:f().bool.isRequired};const Qn=Math.floor(4*Math.random());function Xn(){return v.x.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 Jn extends w.Component{constructor(e){super(e),this.state={loading:!0,newsletter:null,testingPassed:!1,timeStart:Q()(),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(){Q()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),Q()().subtract(6,"seconds").isAfter(this.state.timeStart)&&this.setState({minimumLoadingTimePassed:!0}),!this.state.loading&&this.state.minimumLoadingTimePassed||setTimeout(this.tick,2e3)}loadNewsletter(e){v.x.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,j.jsx)(Gn,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:Xn,showRichLoadingScreen:e})):this.state.error?(v.x.trackEvent("Cron testing done",{"Cron is working":"false"}),(0,j.jsx)(zn,{failClicked:()=>{window.location=window.mailpoet_main_page}})):(t=this.state.newsletter,this.state.testingPassed&&v.x.trackEvent("Cron testing done",{"Cron is working":"true"}),(0,j.jsx)(Hn,{illustrationImageUrl:window.mailpoet_congratulations_success_images[Qn],MSSPitchIllustrationUrl:window.mailpoet_congratulations_success_images[Qn],successClicked:Xn,newsletter:t,isWoocommerceActive:window.mailpoet_woocommerce_active,subscribersCount:window.mailpoet_subscribers_count,purchaseUrl:v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount,v.x.currentWpUserEmail,"starter",{utm_medium:"first-newsletter-congratulations",utm_campaign:"purchase"})}));var e,t}render(){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("style",{dangerouslySetInnerHTML:{__html:"body { background: #fff; overflow-x: hidden; }"}}),(0,j.jsxs)("div",{className:"mailpoet-congratulate",children:[(0,j.jsx)("div",{className:"mailpoet-gap-large"}),this.renderContent()]})]})}}Jn.propTypes={match:f().shape({params:f().shape({id:f().string}).isRequired}).isRequired};class er extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"showTemplateSelection",(e=>{this.props.history.push(`/template/${e}`)}))}componentDidMount(){v.x.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,j.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}render(){return(0,j.jsx)("div",{children:(0,j.jsx)(dt,{emailType:"standard",automationId:"standard_newsletter_creation_heading"})})}}er.contextType=Ce.k,er.propTypes={history:f().shape({push:f().func.isRequired}).isRequired};const tr=(0,c.withRouter)(er),nr={name:"options",type:"reactComponent",component:sn};class rr extends w.Component{constructor(e){super(e),(0,y.Z)(this,"handleValueChange",(e=>{const t=this.state;t[e.target.name]=e.target.value,this.setState(t)})),(0,y.Z)(this,"handleNext",(()=>{v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:_.ZP.extend({},this.state,{type:"notification",subject:v.x.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,j.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))})),(0,y.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,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(dt,{emailType:"notification",automationId:"post_notification_creation_heading"}),(0,j.jsxs)(bt.r.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,j.jsx)(fe.X,{level:4,children:v.x.I18n.t("selectFrequency")}),(0,j.jsx)(sn,{item:this.state,field:nr,onValueChange:this.handleValueChange}),(0,j.jsx)(O.z,{isFullWidth:!0,onClick:this.handleNext,type:"button",children:v.x.I18n.t("next")})]})]})}}rr.contextType=Ce.k,rr.propTypes={history:f().shape({push:f().func.isRequired}).isRequired};const ar=(0,c.withRouter)(rr),sr={name:"options",label:"Event",type:"reactComponent",component:xn};class ir extends w.Component{constructor(e){super(e),(0,y.Z)(this,"isValid",(()=>m()("#welcome_scheduling").parsley().isValid())),(0,y.Z)(this,"validate",(()=>m()("#welcome_scheduling").parsley().validate()));let t=window.mailpoet_segments||[],n=1;t=t.filter((e=>"default"===e.type)),_.ZP.size(t)>0&&(n=_.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()?v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:_.ZP.extend({},this.state,{type:"welcome",subject:v.x.I18n.t("draftNewsletterTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})):this.validate()}showTemplateSelection(e){this.props.history.push(`/template/${e}`)}render(){return(0,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(dt,{emailType:"welcome",automationId:"welcome_email_creation_heading"}),(0,j.jsxs)(bt.r.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,j.jsx)(fe.X,{level:4,children:v.x.I18n.t("selectEventToSendWelcomeEmail")}),(0,j.jsxs)("form",{id:"welcome_scheduling",children:[(0,j.jsx)(xn,{item:this.state,field:sr,onValueChange:this.handleValueChange}),(0,j.jsx)(O.z,{isFullWidth:!0,type:"submit",onClick:this.handleNext,children:v.x.I18n.t("next")})]})]})]})}}ir.propTypes={history:f().shape({push:f().func.isRequired}).isRequired};class or extends w.Component{static getEventOptions(e){return e.options||null}static getEventOptionsFirstValue(e){return e&&_.ZP.isArray(e.values)&&e.values[0].id?e.values[0].id:null}constructor(e){super(e),(0,y.Z)(this,"isValid",(()=>!m()("#newsletter_scheduling").parsley()||m()("#newsletter_scheduling").parsley().isValid())),(0,y.Z)(this,"validate",(()=>{m()("#newsletter_scheduling").parsley()&&m()("#newsletter_scheduling").parsley().validate()})),(0,y.Z)(this,"resetValidationErrors",(()=>{m()("#newsletter_scheduling").parsley()&&m()("#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=_.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})),v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"automatic",subject:v.x.I18n.t("draftNewsletterTitle"),options:l}}).done((e=>{v.x.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,j.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}getEvent(e){return this.emailEvents[e]}getFirstSegment(){return _.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,j.jsx)(_n,{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,j.jsx)("div",{className:"event-segment-selection",children:(0,j.jsx)(I,{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,j.jsx)(yn,{item:r.item,event:r.event,onValueChange:r.onValueChange})}displayEventTip(){const{event:e}=this.state;return e.tip?(0,j.jsxs)("p",{className:"description",children:[(0,j.jsx)("strong",{children:v.x.I18n.t("tip")})," ",e.tip]}):null}render(){return(0,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(dt,{emailType:"woocommerce",automationId:"woocommerce_email_creation_heading"}),(0,j.jsx)(bt.r.Column,{align:"center",className:"mailpoet-schedule-email",children:(0,j.jsxs)("form",{id:"newsletter_scheduling",children:[(0,j.jsx)(fe.X,{level:4,children:this.displayHeader()}),(0,j.jsx)("div",{children:this.displayEventOptions()}),(0,j.jsx)("div",{children:this.displaySegments()}),(0,j.jsx)("div",{children:this.displayScheduling()}),(0,j.jsx)(O.z,{isFullWidth:!0,onClick:this.handleNextStep,type:"submit",children:v.x.I18n.t("next")})]})}),this.displayEventTip()]})}}or.contextType=Ce.k,or.propTypes={history:f().shape({push:f().func.isRequired}).isRequired,name:f().string.isRequired,email:f().shape({title:f().string.isRequired,slug:f().string.isRequired}).isRequired};var lr=n(29925),cr=n(45853),dr=n(47443);const ur=f().shape({status:f().string,count_processed:f().string.isRequired,count_total:f().string.isRequired,scheduled_at:f().string}),pr=f().shape({id:f().number.isRequired,sent_at:f().string,status:f().string.isRequired,queue:f().oneOfType([ur,f().bool])});function mr(e){let{newsletter:t}=e;const[n,r]=(0,w.useState)("paused"===t.queue.status),[a,s]=(0,w.useState)([]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Be,{errors:a}),n&&(0,j.jsx)(O.z,{dimension:"small",onClick:()=>{s([]),v.x.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:v.x.I18n.t("resume")}),!n&&(0,j.jsx)(O.z,{dimension:"small",onClick:()=>{s([]),v.x.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:v.x.I18n.t("pause")})]})}function hr(e){let{newsletter:t,mailerLog:n}=e,r=t.sent_at||t.queue.scheduled_at;r&&(r=(0,cr.default)(r,"yyyy-MM-dd HH:mm:ss",new Date));const a=t.queue&&"scheduled"!==t.queue.status,s="paused"===n.status,i=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.rU,{to:`/sending-status/${t.id}`,"data-automation-id":`sending_status_${t.id}`,children:(0,j.jsx)(dr.s,{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,j.jsx)(mr,{newsletter:t})]}),o=(0,j.jsx)(dr.s,{scheduledFor:r,isPaused:"scheduled"===t.queue.status&&s,status:t.status});return(0,j.jsxs)(j.Fragment,{children:[a&&i,!a&&o]})}mr.propTypes={newsletter:pr.isRequired},hr.propTypes={newsletter:pr.isRequired,mailerLog:f().shape({status:f().string}).isRequired};const fr=v.x.trackingConfig.emailTrackingEnabled,gr={onNoItemsFound:(e,t)=>v.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterTrashed"):v.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterDeleted"):v.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterRestored"):v.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},xr=[{name:"subject",label:v.x.I18n.t("subject"),sortable:!0},{name:"status",label:v.x.I18n.t("status")},{name:"segments",label:v.x.I18n.t("lists")},{name:"statistics",label:v.x.I18n.t("statistics"),display:fr},{name:"sent_at",label:v.x.I18n.t("sentOn"),sortable:!0}],vr=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:gr.onTrash}],br=e=>{const t=()=>{window.location.href=`?page=mailpoet-newsletter-editor&id=${e.id}`};e.queue&&"sending"===e.status&&null===e.queue.status?(0,pt._)({message:v.x.I18n.t("confirmEdit"),onConfirm:t}):t()};let yr=[{name:"view",link:function(e){return(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("edit"),onClick:br},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:function(e,t){return v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{v.x.Notice.success(v.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];yr=(0,qe.y8)(yr);class wr extends w.Component{constructor(e){super(e),(0,y.Z)(this,"renderItem",((e,t,n)=>{const r=u()("manage-column","column-primary","has-row-actions");return(0,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:r,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:"#",onClick:t=>{t.preventDefault(),br(e)},children:e.queue.newsletter_rendered_subject||e.subject}),t]}),(0,j.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":v.x.I18n.t("status"),children:(0,j.jsx)(hr,{newsletter:e,mailerLog:n.mta_log})}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("lists"),children:(0,j.jsx)(lr.$,{segments:e.segments,dimension:"large"})}),!0===fr?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("statistics"),children:(0,j.jsx)(Qe,{newsletter:e,currentTime:n.current_time})}):null,(0,j.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("sentOn"),children:e.sent_at?(0,j.jsxs)(j.Fragment,{children:[v.x.Date.short(e.sent_at),(0,j.jsx)("br",{}),v.x.Date.time(e.sent_at)]}):null})]})})),(0,y.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,j.jsxs)(j.Fragment,{children:[0===this.state.newslettersCount&&(0,j.jsx)(Ke,{filter:e=>"standard"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,j.jsx)(x.N,{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:xr,bulk_actions:vr,item_actions:yr,messages:gr,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,qe._X)(e),(0,qe.bF)(e)}})]})}}wr.contextType=Ce.k,wr.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const _r=(0,c.withRouter)(wr),jr=window.mailpoet_roles||{},Ir=window.mailpoet_segments||{},Sr=v.x.trackingConfig.emailTrackingEnabled,Cr={onNoItemsFound:(e,t)=>v.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterTrashed"):v.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterDeleted"):v.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterRestored"):v.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},Tr=[{name:"subject",label:v.x.I18n.t("subject"),sortable:!0},{name:"settings",label:v.x.I18n.t("settings")},{name:"statistics",label:v.x.I18n.t("statistics"),display:Sr},{name:"status",label:v.x.I18n.t("status"),width:145},{name:"updated_at",label:v.x.I18n.t("lastModifiedOn"),sortable:!0}],kr=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:Cr.onTrash}];let Nr=[{name:"view",link:function(e){return(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("preview")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:(e,t)=>v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{v.x.Notice.success(v.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("edit"),onClick:qe.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Nr=(0,qe.y8)(Nr);class Dr extends w.Component{constructor(e){super(e),(0,y.Z)(this,"updateStatus",((e,t)=>{t.persist(),v.x.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&&v.x.Notice.success(v.x.I18n.t("welcomeEmailActivated")),this.forceUpdate()})).fail((n=>{v.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,y.Z)(this,"renderStatus",(e=>{const t=v.x.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString()),n=v.x.I18n.t("scheduledToXSubscribers").replace("%1$d",e.total_scheduled.toLocaleString());return(0,j.jsxs)("div",{children:[(0,j.jsx)(Mt.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,j.jsxs)("p",{className:"mailpoet-listing-stats-description",children:[(0,j.jsx)(l.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})," ",(0,j.jsx)("br",{}),n]})]})})),(0,y.Z)(this,"renderSettings",(e=>{let t,n,r;switch(e.options.event){case"user":t="mailpoet_all"===e.options.role?v.x.I18n.t("welcomeEventWPUserAnyRole"):C()(v.x.I18n.t("welcomeEventWPUserWithRole"),'"%1$s"',((t,n)=>(0,j.jsx)(ke.V,{variant:"list",children:jr[e.options.role]},n)));break;default:if(r=_.ZP.find(Ir,(t=>Number(t.id)===Number(e.options.segment))),void 0===r)return(0,j.jsx)(l.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:v.x.I18n.t("sendingToSegmentsNotSpecified")});t=C()(v.x.I18n.t("welcomeEventSegment"),'"%1$s"',((e,t)=>(0,j.jsx)(ke.V,{variant:"list",children:r.name},t)))}if(t&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":n=v.x.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":n=v.x.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":n=v.x.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":n=v.x.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:n=v.x.I18n.t("sendingDelayInvalid")}return(0,j.jsxs)("span",{children:[t,n&&(0,j.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,j.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,j.jsx)(dr.P,{})}),n]})]})})),(0,y.Z)(this,"renderItem",((e,t)=>{const n=u()("manage-column","column-primary","has-row-actions");return(0,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:n,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("settings"),children:this.renderSettings(e)}),!0===Sr?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("statistics"),children:(0,j.jsx)(Qe,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("status"),children:this.renderStatus(e)}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("lastModifiedOn"),children:[v.x.Date.short(e.updated_at),(0,j.jsx)("br",{}),v.x.Date.time(e.updated_at)]})]})})),(0,y.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,j.jsxs)(j.Fragment,{children:[0===this.state.newslettersCount&&(0,j.jsx)(Ke,{filter:e=>"welcome"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,j.jsx)(x.N,{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:Tr,bulk_actions:kr,item_actions:Nr,messages:Cr,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,qe._X)(e),(0,qe.bF)(e)}})]})}}Dr.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const Er=(0,c.withRouter)(Dr),Or={onNoItemsFound:(e,t)=>v.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterTrashed"):v.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterDeleted"):v.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterRestored"):v.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},Rr=[{name:"subject",label:v.x.I18n.t("subject"),sortable:!0},{name:"settings",label:v.x.I18n.t("settings")},{name:"history",label:v.x.I18n.t("history"),width:100},{name:"status",label:v.x.I18n.t("status"),width:100},{name:"updated_at",label:v.x.I18n.t("lastModifiedOn"),sortable:!0}],Ar=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:Or.onTrash}],Pr=[{name:"view",link:function(e){return(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("preview")})}},{name:"edit",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("edit"),onClick:qe.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:function(e,t){return v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{v.x.Notice.success(v.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class Mr extends w.Component{constructor(e){super(e),(0,y.Z)(this,"updateStatus",((e,t)=>{t.persist(),v.x.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&&v.x.Notice.success(v.x.I18n.t("postNotificationActivated")),this.forceUpdate()})).fail((n=>{v.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,y.Z)(this,"renderStatus",(e=>(0,j.jsx)(Mt.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}))),(0,y.Z)(this,"renderSettings",(e=>{let t;if(0===e.segments.length)return(0,j.jsx)(l.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:v.x.I18n.t("sendingToSegmentsNotSpecified")});const n=C()(v.x.I18n.t("sendTo"),"%1$s",((t,n)=>(0,j.jsx)(lr.$,{segments:e.segments},n)));switch(e.options.intervalType){case"daily":t=v.x.I18n.t("sendDaily").replace("%1$s",Gt[e.options.timeOfDay]);break;case"weekly":t=v.x.I18n.t("sendWeekly").replace("%1$s",Qt[e.options.weekDay]).replace("%2$s",Gt[e.options.timeOfDay]);break;case"monthly":t=v.x.I18n.t("sendMonthly").replace("%1$s",Xt[e.options.monthDay]).replace("%2$s",Gt[e.options.timeOfDay]);break;case"nthWeekDay":t=v.x.I18n.t("sendNthWeekDay").replace("%1$s",Jt[e.options.nthWeekDay]).replace("%2$s",Qt[e.options.weekDay]).replace("%3$s",Gt[e.options.timeOfDay]);break;case"immediately":t=v.x.I18n.t("sendImmediately");break;default:t="Invalid sending frequency"}return(0,j.jsxs)("span",{children:[n,(0,j.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,j.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,j.jsx)(dr.P,{})}),t]})]})})),(0,y.Z)(this,"renderHistoryLink",(e=>0===Number(e.children_count)?(0,j.jsx)("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small mailpoet-listing-notification-status",children:v.x.I18n.t("notSentYet")}):(0,j.jsxs)(l.rU,{className:"mailpoet-nowrap","data-automation-id":`history-${e.id}`,to:`/notification/history/${e.id}`,children:[(0,j.jsx)(O.z,{className:"mailpoet-hide-on-mobile",dimension:"small",children:v.x.I18n.t("viewHistory")}),(0,j.jsx)(O.z,{className:"mailpoet-show-on-mobile mailpoet-listing-notification-status",dimension:"small",variant:"secondary",children:v.x.I18n.t("viewHistory")})]}))),(0,y.Z)(this,"renderItem",((e,t)=>{const n=u()("manage-column","column-primary","has-row-actions");return(0,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:n,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("settings"),children:this.renderSettings(e)}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("history"),children:this.renderHistoryLink(e)}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("status"),children:this.renderStatus(e)}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("lastModifiedOn"),children:[v.x.Date.short(e.updated_at),(0,j.jsx)("br",{}),v.x.Date.time(e.updated_at)]})]})})),(0,y.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,j.jsxs)(j.Fragment,{children:[0===this.state.newslettersCount&&(0,j.jsx)(Ke,{filter:e=>"notification"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,j.jsx)(x.N,{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:Rr,bulk_actions:Ar,item_actions:Pr,messages:Or,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,qe._X)(e),(0,qe.bF)(e)}})]})}}Mr.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const Lr=(0,c.withRouter)(Mr),Fr=v.x.trackingConfig.emailTrackingEnabled,qr={onNoItemsFound:(e,t)=>v.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterTrashed"):v.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterDeleted"):v.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterRestored"):v.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},$r=[{name:"subject",label:v.x.I18n.t("subject"),sortable:!0},{name:"settings",label:v.x.I18n.t("settings")},{name:"statistics",label:v.x.I18n.t("statistics"),display:Fr},{name:"status",label:v.x.I18n.t("status"),width:145},{name:"updated_at",label:v.x.I18n.t("lastModifiedOn"),sortable:!0}],Ur=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:qr.onTrash}];let Zr=[{name:"view",link:function(e){return(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("preview")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:(e,t)=>v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{v.x.Notice.success(v.x.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("edit"),onClick:qe.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Zr=(0,qe.y8)(Zr);class Vr extends w.Component{constructor(e){super(e),(0,y.Z)(this,"updateStatus",((e,t)=>{t.persist(),v.x.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&&v.x.Notice.success(v.x.I18n.t("reEngagementEmailActivated")),this.forceUpdate()})).fail((n=>{v.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,y.Z)(this,"renderStatus",(e=>{const t=v.x.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString());return(0,j.jsxs)("div",{children:[(0,j.jsx)(Mt.Z,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),(0,j.jsx)("p",{className:"mailpoet-listing-stats-description",children:(0,j.jsx)(l.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`,children:t})})]})})),(0,y.Z)(this,"renderSettings",(e=>{if(0===e.segments.length)return(0,j.jsx)(l.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`,children:v.x.I18n.t("sendingToSegmentsNotSpecified")});const t=C()(v.x.I18n.t("sendTo"),"%1$s",((t,n)=>(0,j.jsx)(lr.$,{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=v.x.I18n.t("reEngagementSettings").replace("{$count}",e.options.afterTimeNumber).replace("{$frequency}",v.x.I18n.t(n));return(0,j.jsxs)("span",{children:[t,(0,j.jsxs)("div",{className:"mailpoet-listing-schedule",children:[(0,j.jsx)("div",{className:"mailpoet-listing-schedule-icon",children:(0,j.jsx)(dr.P,{})}),r]})]})})),(0,y.Z)(this,"renderItem",((e,t)=>{const n=u()("manage-column","column-primary","has-row-actions");return(0,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:n,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`,children:e.subject}),t]}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("settings"),children:this.renderSettings(e)}),!0===Fr?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("statistics"),children:(0,j.jsx)(Qe,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})}):null,(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("status"),children:this.renderStatus(e)}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("lastModifiedOn"),children:[v.x.Date.short(e.updated_at),(0,j.jsx)("br",{}),v.x.Date.time(e.updated_at)]})]})})),(0,y.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return(0,j.jsxs)(j.Fragment,{children:[0===this.state.newslettersCount&&(0,j.jsx)(Ke,{filter:e=>"re_engagement"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&(0,j.jsx)(x.N,{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:$r,bulk_actions:Ur,item_actions:Zr,messages:qr,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,qe._X)(e),(0,qe.bF)(e)}})]})}}Vr.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const Wr=(0,c.withRouter)(Vr),Yr=v.x.trackingConfig.emailTrackingEnabled,Br=[{name:"subject",label:v.x.I18n.t("subject")},{name:"status",label:v.x.I18n.t("status")},{name:"segments",label:v.x.I18n.t("lists")},{name:"statistics",label:v.x.I18n.t("statistics"),display:Yr},{name:"sent_at",label:v.x.I18n.t("sentOn"),sortable:!0}],Hr={onNoItemsFound:(e,t)=>v.x.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterTrashed"):v.x.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterDeleted"):v.x.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneNewsletterRestored"):v.x.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},zr=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:Hr.onTrash}],Kr=(0,qe.y8)([{name:"view",link:function(e){return(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("preview")})}},{name:"trash",className:"mailpoet-hide-on-mobile"}]),Gr=(e,t,n)=>{const r=u()("manage-column","column-primary","has-row-actions");return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("td",{className:r,children:[(0,j.jsx)("strong",{children:(0,j.jsx)("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer",children:e.queue.newsletter_rendered_subject||e.subject})}),t]}),(0,j.jsx)("td",{className:"column mailpoet-listing-status-column","data-colname":v.x.I18n.t("status"),children:(0,j.jsx)(hr,{newsletter:e,mailerLog:n.mta_log})}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("lists"),children:(0,j.jsx)(lr.$,{segments:e.segments,dimension:"large"})}),!0===Yr?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("statistics"),children:(0,j.jsx)(Qe,{newsletter:e,currentTime:n.current_time})}):null,(0,j.jsx)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("sentOn"),children:e.sent_at?(0,j.jsxs)(j.Fragment,{children:[v.x.Date.short(e.sent_at),(0,j.jsx)("br",{}),v.x.Date.time(e.sent_at)]}):null})]})};function Qr(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:"/notification",children:v.x.I18n.t("backToPostNotifications")}),(0,j.jsx)(x.N,{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:Gr,columns:Br,messages:Hr,item_actions:Kr,bulk_actions:zr,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{(0,qe._X)(e),(0,qe.bF)(e)}})]})}Qr.propTypes={parentId:f().string.isRequired,location:f().shape({pathname:f().string}).isRequired,match:f().shape({params:f().shape({id:f().node}).isRequired}).isRequired};const Xr=(0,c.withRouter)(Qr),Jr=[{name:"subscriber_id",label:v.x.I18n.t("subscriber"),sortable:!0},{name:"status",label:v.x.I18n.t("sendingStatus")},{name:"failureReason",label:v.x.I18n.t("failureReason")}],ea={onNoItemsFound:()=>v.x.I18n.t("noSendingTaskFound")};function ta(e){const[t,n]=(0,w.useState)({id:e.match.params.id,subject:"",sent:!1});return(0,w.useEffect)((()=>{v.x.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=>v.x.Notice.showApiErrorNotice(e)))}),[t.id]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:v.x.I18n.t("sendingStatusTitle")}),(0,j.jsx)(sa,{newsletter:t}),(0,j.jsx)(aa,{location:e.location,params:e.match.params})]})}ta.propTypes={location:f().shape({pathname:f().string}).isRequired,match:f().shape({params:f().shape({id:f().string.isRequired}).isRequired}).isRequired};const na=(e,t)=>e.location.pathname===t.location.pathname&&e.params.id===t.params.id,ra=e=>(0,j.jsx)("div",{children:(0,j.jsx)(ia,{...e})}),aa=(0,w.memo)((e=>{let{location:t,params:n}=e;return(0,j.jsx)(x.N,{limit:window.mailpoet_listing_per_page,location:t,params:n,endpoint:"sending_task_subscribers",base_url:"sending-status/:id",onRenderItem:ra,getListingItemKey:e=>`${e.taskId}-${e.subscriberId}`,columns:Jr,messages:ea,auto_refresh:!0,sort_by:"failed",sort_order:"desc",afterGetItems:e=>{(0,qe._X)(e),(0,qe.bF)(e)}})}),na);function sa(e){let{newsletter:t}=e;return t.id&&t.subject&&t.sent?(0,j.jsx)("p",{children:(0,j.jsx)(l.rU,{to:`/stats/${t.id}`,children:t.subject})}):null}function ia(e){let{error:t,failed:n,taskId:r,processed:a,email:s,subscriberId:i,lastName:o,firstName:l}=e;const c=u()("manage-column","column-primary","has-row-actions");let d=v.x.I18n.t("unprocessed");return a&&(d=n?(0,j.jsxs)("span",{children:[v.x.I18n.t("failed"),(0,j.jsx)("br",{}),(0,j.jsx)("a",{className:"button",href:"#",onClick:e=>{e.preventDefault(),v.x.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=>v.x.Notice.showApiErrorNotice(e)))},children:v.x.I18n.t("resend")})]}):v.x.I18n.t("sent")),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("td",{"data-automation-id":`name_${r}_${i}`,className:c,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-subscribers#/edit/${i}`,children:s}),(0,j.jsx)("div",{className:"mailpoet-listing-subtitle",children:`${l} ${o}`})]}),(0,j.jsx)("td",{className:"column","data-automation-id":`status_${r}_${i}`,"data-colname":v.x.I18n.t("sendingStatus"),children:d}),(0,j.jsx)("td",{className:"column","data-automation-id":`error_${r}_${i}`,"data-colname":v.x.I18n.t("failureReason"),children:t})]})}function oa(){return(0,j.jsx)("style",{dangerouslySetInnerHTML:{__html:".wrap { margin: 0 !important; }"}})}aa.propTypes={location:f().shape({pathname:f().string}).isRequired,params:f().shape({id:f().string.isRequired}).isRequired},sa.propTypes={newsletter:f().shape({id:f().string,subject:f().string,sent:f().bool})},sa.defaultProps={newsletter:{id:null,subject:null,sent:!1}},ia.propTypes={error:f().string,email:f().string.isRequired,failed:f().number.isRequired,taskId:f().number.isRequired,lastName:f().string.isRequired,firstName:f().string.isRequired,processed:f().number.isRequired,subscriberId:f().number.isRequired},ia.defaultProps={error:""};var la=n(4840),ca=n(53681),da=n(21918);const ua=e=>{const t=e<.1?2:1;return v.x.Num.toLocaleFixed(e,t)};function pa(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=ua(a),d=ua(s),u=ua(i),p=ua(o),m=ua(l),h=r>=20&&t.statistics.opened>=5,f=(0,j.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,j.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[d,"% "]}),v.x.I18n.t("percentageOpened")]}),g=(0,j.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,j.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[u,"% "]}),v.x.I18n.t("percentageMachineOpened"),(0,j.jsx)(A.Tooltip,{tooltip:C()(v.x.I18n.t("percentageMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>(0,j.jsx)("span",{style:{pointerEvents:"all"},children:(0,j.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")))})]}),x=(0,j.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,j.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[p,"% "]}),v.x.I18n.t("percentageUnsubscribed")]}),b=(0,j.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[(0,j.jsxs)("span",{className:"mailpoet-statistics-value-number",children:[m,"% "]}),v.x.I18n.t("percentageBounced")]}),y=(0,da.y)("clicked",a),w=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-statistics-value",children:[(0,j.jsxs)("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${y}`,children:[c,"% "]}),v.x.I18n.t("percentageClicked")]}),h&&(0,j.jsx)(da.$,{isInverted:!1,stat:"clicked",rate:a,tooltipId:`clicked-${t.id||"0"}`,tooltipPlace:"right"})]});return(0,j.jsxs)("div",{className:"mailpoet-stats-general",children:[(0,j.jsxs)(bt.r.ThreeColumns,{className:"mailpoet-stats-general-top-row",children:[(0,j.jsx)("div",{children:(0,j.jsxs)("div",{className:"mailpoet-statistics-value-small",children:[v.x.I18n.t("statsTotalSent"),": ",(0,j.jsx)("span",{className:"mailpoet-statistics-value-number",children:r.toLocaleString()})]})}),(0,j.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:x}),(0,j.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:b})]}),(0,j.jsxs)(bt.r.ThreeColumns,{children:[(0,j.jsx)("div",{children:w}),(0,j.jsxs)("div",{className:"mailpoet-statistics-with-left-separator",children:[f,g]}),n&&(0,j.jsx)("div",{className:"mailpoet-statistics-with-left-separator",children:Ee.Hooks.applyFilters("mailpoet_newsletters_revenues_stats",null,t.statistics.revenue)}),!n&&(0,j.jsx)("div",{})]}),(0,j.jsx)("p",{className:"mailpoet-stats-general-read-more",children:(0,j.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:v.x.I18n.t("readMoreOnStats")})})]})}function ma(e){let{newsletter:t}=e;const n=t.queue.scheduled_at||t.queue.created_at;return(0,j.jsxs)(bt.r.ThreeColumns,{className:"mailpoet-stats-info",children:[(0,j.jsxs)("div",{className:"mailpoet-grid-span-two-columns",children:[(0,j.jsx)(fe.X,{level:1,children:t.subject}),(0,j.jsx)("div",{children:(0,j.jsxs)("b",{children:[v.x.Date.short(n)," • ",v.x.Date.time(n)]})}),Array.isArray(t.segments)&&t.segments.length&&(0,j.jsxs)("div",{children:[(0,j.jsx)("span",{className:"mailpoet-stats-info-key",children:v.x.I18n.t("statsToSegments")}),": ",(0,j.jsx)(g.Tags,{dimension:"large",segments:t.segments})]})]}),(0,j.jsxs)("div",{className:"mailpoet-stats-info-sender-preview",children:[(0,j.jsxs)("div",{children:[(0,j.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,j.jsxs)("span",{className:"mailpoet-stats-info-key",children:[v.x.I18n.t("statsFromAddress"),": "]}),t.sender_address?t.sender_address:"-"]}),(0,j.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,j.jsxs)("span",{className:"mailpoet-stats-info-key",children:[v.x.I18n.t("statsReplyToAddress"),": "]}),t.reply_to_address?t.reply_to_address:"-"]}),(0,j.jsxs)("div",{className:"mailpoet-stats-info-key-value",children:[(0,j.jsxs)("span",{className:"mailpoet-stats-info-key",children:[v.x.I18n.t("googleAnalytics"),": "]}),t.ga_campaign?t.ga_campaign:"-"]})]}),(0,j.jsx)("div",{children:(0,j.jsx)(g.Button,{href:t.preview_url,target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("statsPreviewNewsletter")})})]})]})}function ha(){const e=(0,j.jsx)(O.z,{href:v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount,v.x.currentWpUserEmail,"starter",{utm_medium:"stats",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("premiumBannerCtaFree")}),t=(0,j.jsxs)("p",{children:[v.x.I18n.t("premiumBannerDescription")," ",(0,j.jsx)("a",{href:"admin.php?page=mailpoet-upgrade",children:v.x.I18n.t("learnMore")}),"."]});return(0,j.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,j.jsx)(Oe.K,{title:v.x.I18n.t("premiumFeature"),message:t,actionButton:e})})}function fa(){if(!window.mailpoet_display_detailed_stats)return(0,j.jsx)(ha,{});if(window.mailpoet_subscribers_limit_reached){const e=window.mailpoet_has_valid_api_key,t=v.x.I18n.t("upgradeRequired"),n=v.x.I18n.t(e?"newsletterYourPlanLimit":"newsletterFreeVersionLimit").replace("[subscribersLimit]",window.mailpoet_subscribers_limit).replace("[subscribersCount]",window.mailpoet_subscribers_count),r=e?v.x.MailPoetComUrlFactory.getUpgradeUrl(v.x.pluginPartialKey):v.x.MailPoetComUrlFactory.getPurchasePlanUrl(window.mailpoet_subscribers_count+1);return(0,j.jsx)("div",{className:"mailpoet-stats-premium-required",children:(0,j.jsx)(Oe.K,{title:t,message:(0,j.jsx)("p",{children:n}),actionButton:(0,j.jsx)(O.z,{target:"_blank",rel:"noopener noreferrer",href:r,children:v.x.I18n.t("upgradeNow")})})})}return null}const ga=(0,c.withRouter)((function(e){let{match:t,history:n,location:r}=e;const[a,s]=(0,w.useState)({item:void 0,loading:!0}),i=(0,w.useCallback)((e=>{s({loading:!0,item:a.item}),v.x.Modal.loading(!0),v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:window.mailpoet_display_detailed_stats?"stats":"newsletters",action:window.mailpoet_display_detailed_stats?"get":"getWithStats",data:{id:e}}).always((()=>{v.x.Modal.loading(!1)})).done((e=>{s({loading:!1,item:e.data})})).fail((e=>{v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0}),s({loading:!1}),n.push("/")}))}),[n,a.item]);(0,w.useEffect)((()=>{var e;window.scrollTo(0,0),(null===(e=a.item)||void 0===e?void 0:e.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:null==c||!c.subject||null!=c&&c.queue?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(be.B,{}),(0,j.jsx)(oa,{}),(0,j.jsx)(F.Q,{}),(0,j.jsxs)("div",{className:"mailpoet-stats-page",children:[(0,j.jsx)(N,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,j.jsx)(ma,{newsletter:c}),(0,j.jsx)(pa,{newsletter:c,isWoocommerceActive:v.x.isWoocommerceActive}),(0,j.jsxs)(la.m,{activeKey:"clicked",children:[(0,j.jsx)(ca.O,{title:v.x.I18n.t("clickedLinks"),children:Ee.Hooks.applyFilters("mailpoet_newsletters_clicked_links_table",(0,j.jsx)(fa,{}),c.clicked_links)},"clicked"),Ee.Hooks.applyFilters("mailpoet_newsletters_purchased_products",null,c),(0,j.jsx)(ca.O,{title:v.x.I18n.t("subscriberEngagement"),children:Ee.Hooks.applyFilters("mailpoet_newsletters_subscriber_engagement",(0,j.jsx)(fa,{}),r,t.params,c)},"engagement"),(0,j.jsx)(ca.O,{title:v.x.I18n.t("bounces"),automationId:"bounces-tab",children:Ee.Hooks.applyFilters("mailpoet_newsletters_bounces",(0,j.jsx)(fa,{}),r,t.params)},"bounces")]})]})]}):(0,j.jsx)("div",{children:(0,j.jsx)(fe.X,{level:1,children:c.subject})})}));var xa=n(48228),va=n(97762),ba=n(87903),ya=n.n(ba);function wa(e){const t=e.installedDaysAgo,n=t>30?v.x.I18n.t("reviewRequestUsingForMonths").replace("[months]",Math.round(t/30)):v.x.I18n.t("reviewRequestUsingForDays").replace("[days]",t);return(0,j.jsxs)("div",{className:"mailpoet_review_request",children:[(0,j.jsx)("img",{src:e.reviewRequestIllustrationUrl,height:"280",width:"280",alt:""}),(0,j.jsx)("h2",{children:v.x.I18n.t("reviewRequestHeading")}),(0,j.jsx)("p",{children:v.x.I18n.t("reviewRequestDidYouKnow").replace("[username]",e.username)}),(0,j.jsx)("p",{children:n}),(0,j.jsx)("p",{children:(0,j.jsx)("a",{href:"http://bit.ly/2Bi124o",target:"_blank",rel:"noopener noreferrer",className:"button button-primary",children:v.x.I18n.t("reviewRequestRateUsNow")})}),(0,j.jsx)("p",{children:(0,j.jsx)("a",{id:"mailpoet_review_request_not_now",children:v.x.I18n.t("reviewRequestNotNow")})})]})}wa.propTypes={installedDaysAgo:f().number.isRequired,reviewRequestIllustrationUrl:f().string.isRequired,username:f().string.isRequired};let _a=null;const ja=()=>((0,w.useLayoutEffect)((()=>{window.mailpoet_display_nps_poll&&v.x.libs3rdPartyEnabled&&(_a||(_a=v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"analytics",action:"getTrackingData"})),_a).then((e=>{let{data:t}=e;return(e=>{let t;t=window.mailpoet_display_nps_form?"EqOgKsgZd832Sz9w":window.mailpoet_is_new_user?"6L479eVPXk7pBn6S":"k0aJAsQAWI2ERyGv",ya()({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&&v.x.Modal.popup({width:800,template:va.renderToString(wa({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",(()=>v.x.Modal.close()))}})}}})})(t)}))}),[]),null),Ia=e=>function(t){return ja(),(0,j.jsx)(e,{...t})};function Sa(){return(0,j.jsx)(F.Q,{children:(0,j.jsxs)(l.rU,{id:"mailpoet-new-email",className:"mailpoet-button button-secondary",to:"/new",onClick:()=>v.x.trackEvent("Emails > Add New"),"data-automation-id":"new_email",children:[q,(0,j.jsx)("span",{children:v.x.I18n.t("new")})]})})}const Ca=(0,c.withRouter)((function(e){let{children:t,location:n}=e;return null!==(0,ct.X)(n)||(e=>e.hash.match(/^#\/new/)||e.pathname.match(/^\/new/))(n)?null:t}));function Ta(e){let{mailpoetInstalledDaysAgo:t,sendTransactionalEmails:n,mtaMethod:r,noticeDismissed:a,apiVersion:s}=e;const[i,o]=(0,w.useState)(!1),l=()=>{v.x.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,j.jsxs)(T.q,{type:"success",timeout:!1,onClose:l,children:[(0,j.jsx)("h3",{children:v.x.I18n.t("transactionalEmailNoticeTitle")}),(0,j.jsxs)("p",{children:[v.x.I18n.t("transactionalEmailNoticeBody")," ",(0,j.jsx)("a",{href:"https://kb.mailpoet.com/article/292-choose-how-to-send-your-wordpress-websites-emails",target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("transactionalEmailNoticeBodyReadMore")})]}),(0,j.jsx)("p",{children:(0,j.jsx)("button",{type:"button",className:"button",onClick:()=>{o(!0),v.x.Ajax.post({api_version:s,endpoint:"settings",action:"set",data:{send_transactional_emails:"1"}}),l()},children:v.x.I18n.t("transactionalEmailNoticeCTA")})})]})}const ka=window.mailpoet_woocommerce_automatic_emails||[],Na=Ia((()=>{const{parentId:e}=(0,c.useParams)();return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ca,{children:(0,j.jsx)(Sa,{})}),(0,j.jsxs)(xa.t,{activeKey:"standard",routerType:"switch-only",onSwitch:e=>(e=>v.x.trackEvent(`Tab Emails > ${e} clicked`))(e),automationId:"newsletters_listing_tabs",children:[(0,j.jsx)(ca.O,{route:"standard/(.*)?",title:v.x.I18n.t("tabStandardTitle"),automationId:`tab-${v.x.I18n.t("tabStandardTitle")}`,children:(0,j.jsx)(_r,{})},"standard"),(0,j.jsx)(ca.O,{route:"welcome/(.*)?",title:v.x.I18n.t("tabWelcomeTitle"),automationId:`tab-${v.x.I18n.t("tabWelcomeTitle")}`,children:(0,j.jsx)(Er,{})},"welcome"),(0,j.jsx)(ca.O,{route:"notification/(.*)?",title:v.x.I18n.t("tabNotificationTitle"),automationId:`tab-${v.x.I18n.t("tabNotificationTitle")}`,children:e?(0,j.jsx)(Xr,{parentId:e}):(0,j.jsx)(Lr,{})},"notification"),(0,j.jsx)(ca.O,{route:"re_engagement/(.*)?",title:v.x.I18n.t("tabReEngagementTitle"),automationId:`tab-${v.x.I18n.t("tabReEngagementTitle")}`,children:(0,j.jsx)(Wr,{})},"re_engagement"),window.mailpoet_woocommerce_active&&_.ZP.map(ka,(e=>(0,j.jsx)(ca.O,{route:`${e.slug}/(.*)?`,title:e.title,automationId:`tab-${e.title}`,children:(0,j.jsx)(ot,{})},e.slug)))]})]})}));function Da(e){let{history:t}=e;return(0,j.jsx)(Ke,{history:t,hideClosingButton:0===window.mailpoet_newsletters_count})}Da.propTypes={history:f().shape({push:f().func.isRequired}).isRequired};const Ea=[...(()=>{const e=[];return _.ZP.each(ka,(t=>{e.push({path:`/${t.slug}/(.*)?`,component:Na});const{events:n}=t;_.ZP.isObject(n)&&_.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,j.jsx)(or,{...r})}})})),e.push({path:`/new/${t.slug}`,render:e=>{const n={...e,email:t};return(0,j.jsx)(Ve,{...n})}})})),e})(),{path:"/notification/history/:parentId/(.*)?",component:Na},{path:"/(standard|welcome|notification|re_engagement)/(.*)?",component:Na},{path:"/new/standard",component:tr},{path:"/new/notification",component:ar},{path:"/new/welcome",component:ir},{path:"/new/re-engagement",component:function(){let e="";v.x.settings.deactivate_subscriber_after_inactive_days&&(e=(Math.floor(Number(v.x.settings.deactivate_subscriber_after_inactive_days)/30)-1).toString());const[t,n]=(0,w.useState)({afterTimeNumber:e,afterTimeType:"months"}),[r,a]=(0,w.useState)([]),[s,i]=(0,w.useState)(!1),o=(0,c.useHistory)();return(0,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),r&&(0,j.jsx)(Be,{errors:r}),(0,j.jsx)(dt,{emailType:"re_engagement",automationId:"re_engagement_heading_creation_heading"}),(0,j.jsxs)(bt.r.Column,{align:"center",className:"mailpoet-schedule-email",children:[(0,j.jsx)(kn,{afterTimeNumber:t.afterTimeNumber,afterTimeType:t.afterTimeType,inactiveSubscribersPeriod:Number(v.x.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:(0,Cn.compose)([n,(0,Cn.assoc)("afterTimeNumber",Cn.__,t)]),updateAfterTimeType:(0,Cn.compose)([n,(0,Cn.assoc)("afterTimeType",Cn.__,t)])}),(0,j.jsx)(O.z,{isFullWidth:!0,onClick:()=>(a([]),i(!0),void v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"newsletters",action:"create",data:{type:"re_engagement",subject:v.x.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:v.x.I18n.t("next")})]})]})}},{path:"/new",component:Da},{name:"template",path:"/template/:id",component:gt},{path:"/send/congratulate/:id",component:Jn},{path:"/send/:id",component:Mn},{path:"/sending-status/:id/(.*)?",component:ta},{path:"/stats/:id/(.*)?",component:ga}];function Oa(){return(0,j.jsx)(Ce.k.Provider,{value:(0,Ce.S)(window),children:(0,j.jsxs)(l.UT,{children:[(0,j.jsx)(Me.w,{}),(0,j.jsx)(k,{}),(0,j.jsx)(E,{}),(0,j.jsx)(Ta,{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,j.jsx)(N,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),(0,j.jsxs)(c.Switch,{children:[(0,j.jsx)(c.Route,{exact:!0,path:"/",render:()=>(0,j.jsx)(c.Redirect,{to:0===window.mailpoet_newsletters_count?"/new":"/standard"})}),Ea.map((e=>(0,j.jsx)(c.Route,{path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render},e.path)))]})]})})}const Ra=document.getElementById("newsletters_container");Ra&&(window.mailpoet_listing=o().render((0,j.jsx)(Oa,{}),Ra));const Aa=e=>"wp_users"===e.type,Pa=e=>"woocommerce_users"===e.type,Ma=e=>Aa(e)||Pa(e),La=v.x.trackingConfig.emailTrackingEnabled,Fa=[{name:"name",label:v.x.I18n.t("name"),sortable:!0},{name:"description",label:v.x.I18n.t("description")},{name:"average_subscriber_score",label:v.x.I18n.t("listScore"),display:La},{name:"subscribed",label:v.x.I18n.t("subscribed"),className:"mailpoet-listing-column-narrow"},{name:"unconfirmed",label:v.x.I18n.t("unconfirmed"),className:"mailpoet-listing-column-narrow"},{name:"unsubscribed",label:v.x.I18n.t("unsubscribed"),className:"mailpoet-listing-column-narrow"},{name:"inactive",label:v.x.I18n.t("inactive"),className:"mailpoet-listing-column-narrow"},{name:"bounced",label:v.x.I18n.t("bounced"),className:"mailpoet-listing-column-narrow"},{name:"created_at",label:v.x.I18n.t("createdOn"),sortable:!0}],qa={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneSegmentTrashed"):v.x.I18n.t("multipleSegmentsTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneSegmentDeleted"):v.x.I18n.t("multipleSegmentsDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneSegmentRestored"):v.x.I18n.t("multipleSegmentsRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},$a=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:qa.onTrash}],Ua=e=>!Ma(e),Za=[{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return(0,j.jsx)(l.rU,{to:`/edit/${e.id}`,children:v.x.I18n.t("edit")})},display:function(e){return!Ma(e)}},{name:"duplicate_segment",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:(e,t)=>v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"duplicate",data:{id:e.id}}).done((e=>{v.x.Notice.success(v.x.I18n.t("listDuplicated").replace("%1$s",e.data.name)),t()})).fail((e=>{v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),display:function(e){return!Ma(e)}},{name:"read_more",className:"mailpoet-hide-on-mobile",link:function(){return(0,j.jsx)("a",{href:"https://kb.mailpoet.com/article/133-the-wordpress-users-list",target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("readMore")})},display:function(e){return Aa(e)}},{name:"synchronize_segment",label:v.x.I18n.t("forceSync"),onClick:function(e,t){v.x.Modal.loading(!0),v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"synchronize",data:{type:e.type}}).done((()=>{let n=v.x.I18n.t("listSynchronized").replace("%1$s",e.name);"woocommerce_users"===e.type&&(n=v.x.I18n.t("listSynchronizationWasScheduled").replace("%1$s",e.name)),v.x.Modal.loading(!1),v.x.Notice.success(n),t()})).fail((e=>{v.x.Modal.loading(!1),e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},display:function(e){return Aa(e)||Pa(e)}},{name:"view_subscribers",link:function(e){return(0,j.jsx)("a",{href:e.subscribers_url,"data-automation-id":`view_subscribers_${e.name}`,children:v.x.I18n.t("viewSubscribers")})}},{name:"trash",className:"mailpoet-hide-on-mobile",display:function(e){return!Pa(e)}}];class Va extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"renderItem",((e,t)=>{const n=u()("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=Ma(e)?(0,j.jsx)("span",{className:"mailpoet-listing-title",children:e.name}):(0,j.jsx)(l.rU,{className:"mailpoet-listing-title",to:`/edit/${e.id}`,children:e.name}),(0,j.jsxs)("div",{children:[(0,j.jsxs)("td",{className:n,"data-automation-id":`segment_name_${e.name}`,children:[c,t]}),(0,j.jsx)("td",{"data-colname":v.x.I18n.t("description"),children:(0,j.jsx)("abbr",{children:e.description})}),La?(0,j.jsx)("td",{className:"column mailpoet-listing-stats-column","data-colname":v.x.I18n.t("averageScore"),children:(0,j.jsx)("div",{className:"mailpoet-listing-stats",children:(0,j.jsx)(L,{id:e.id,engagementScore:e.average_engagement_score})})}):null,(0,j.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("subscribed"),children:(0,j.jsx)("abbr",{children:r.toLocaleString()})}),(0,j.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("unconfirmed"),children:(0,j.jsx)("abbr",{children:a.toLocaleString()})}),(0,j.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("unsubscribed"),children:(0,j.jsx)("abbr",{children:s.toLocaleString()})}),(0,j.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("inactive"),children:(0,j.jsx)("abbr",{children:i.toLocaleString()})}),(0,j.jsx)("td",{className:"mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("bounced"),children:(0,j.jsx)("abbr",{children:o.toLocaleString()})}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("createdOn"),children:[v.x.Date.short(e.created_at),(0,j.jsx)("br",{}),v.x.Date.time(e.created_at)]})]})}))}render(){return(0,j.jsx)("div",{className:"mailpoet-segments-listing",children:(0,j.jsx)(x.N,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:qa,search:!1,endpoint:"segments",base_url:"lists",onRenderItem:this.renderItem,columns:Fa,bulk_actions:$a,item_actions:Za,sort_by:"name",sort_order:"asc",isItemDeletable:Ua,isItemToggleable:Aa})})}}Va.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const Wa=(0,c.withRouter)(Va),Ya=[{name:"name",label:v.x.I18n.t("name"),type:"text"},{name:"description",label:v.x.I18n.t("description"),type:"textarea",tip:v.x.I18n.t("segmentDescriptionTip")}],Ba={onUpdate:function(){v.x.Notice.success(v.x.I18n.t("segmentUpdated"))},onCreate:function(){v.x.Notice.success(v.x.I18n.t("segmentAdded")),v.x.trackEvent("Lists > Add new")}};function Ha(e){return(0,j.jsxs)("div",{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(be.B,{}),(0,j.jsxs)(fe.X,{level:1,className:"mailpoet-title",children:[(0,j.jsx)("span",{children:v.x.I18n.t("segment")}),(0,j.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:"/",children:v.x.I18n.t("backToList")})]}),(0,j.jsx)(k,{}),(0,j.jsx)(ve,{endpoint:"segments",fields:Ya,params:e.match.params,messages:Ba})]})}Ha.propTypes={match:f().shape({params:f().shape({id:f().string}).isRequired}).isRequired};var za=n(41882),Ka=n(94878),Ga=n(1030),Qa=n(96486),Xa=n.n(Qa),Ja=n(66067);function es(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form"),s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),i=null==s?void 0:s.map((e=>{const t=e.sent_at?v.x.Date.format(e.sent_at):v.x.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}}));return(0,w.useEffect)((()=>{n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t),n.action===Ja.EmailActionTypes.MACHINE_OPENED&&n.operator===Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t)}),[n.action,n.operator,t,r]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{isFullWidth:!0,value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),n.action!==Ja.EmailActionTypes.MACHINE_OPENED?(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")}):null]},"select")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:v.x.I18n.t("selectNewsletterPlaceholder"),options:i,automationId:"segment-email",value:(0,Cn.filter)((e=>{if(!n.newsletters)return;const t=e.value;return-1!==n.newsletters.indexOf(t)}),i),onChange:e=>{r({newsletters:(0,Cn.map)("value",e)},t)}})})]})}const ts=e=>!!e;function ns(e){return v.x.I18n.t("emailActionOpensDaysSentence").split(/({days})/gim).map(e)}function rs(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form");return(0,w.useEffect)((()=>{void 0===n.operator&&r({operator:"more"},t)}),[r,n,t]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(s=e=>"{condition}"===e?(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,j.jsx)("option",{value:"more",children:v.x.I18n.t("moreThan")}),(0,j.jsx)("option",{value:"less",children:v.x.I18n.t("lessThan")}),(0,j.jsx)("option",{value:"equals",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"not_equals",children:v.x.I18n.t("notEquals")})]},"select"):"{opens}"===e?(0,j.jsx)(te.I,{type:"number",value:n.opens||"","data-automation-id":"segment-number-of-opens",onChange:e=>{a("opens",t,e)},min:"0",placeholder:v.x.I18n.t("emailActionOpens")},"input"):"string"==typeof e&&e.trim().length>1?(0,j.jsx)("div",{children:e},"opens"):null,v.x.I18n.t("emailActionOpensSentence").split(/({condition})|({opens})|(\b[a-zA-Z]+\b)/gim).map(s))}),(0,j.jsx)(bt.r.CenteredRow,{children:ns((e=>"{days}"===e?(0,j.jsx)(te.I,{type:"number",value:n.days||"","data-automation-id":"segment-number-of-days",onChange:e=>{a("days",t,e)},min:"0",placeholder:v.x.I18n.t("emailActionDays")},"input"):"string"==typeof e&&e.trim().length>1?(0,j.jsx)("div",{children:e},e):null))})]});var s}const as=[{value:Ja.EmailActionTypes.OPENS_ABSOLUTE_COUNT,label:v.x.I18n.t("emailActionOpensAbsoluteCount"),group:Ja.SegmentTypes.Email},{value:Ja.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT,label:v.x.I18n.t("emailActionMachineOpensAbsoluteCount"),group:Ja.SegmentTypes.Email},{value:Ja.EmailActionTypes.OPENED,label:v.x.I18n.t("emailActionOpened"),group:Ja.SegmentTypes.Email},{value:Ja.EmailActionTypes.MACHINE_OPENED,label:v.x.I18n.t("emailActionMachineOpened"),group:Ja.SegmentTypes.Email},{value:Ja.EmailActionTypes.CLICKED,label:v.x.I18n.t("emailActionClicked"),group:Ja.SegmentTypes.Email},{value:Ja.EmailActionTypes.CLICKED_ANY,label:v.x.I18n.t("emailActionClickedAnyEmail"),group:Ja.SegmentTypes.Email}],ss={[Ja.EmailActionTypes.OPENS_ABSOLUTE_COUNT]:rs,[Ja.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT]:rs,[Ja.EmailActionTypes.CLICKED]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form"),s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),[i,o]=(0,w.useState)([]),[l,c]=(0,w.useState)([]),[d,u]=(0,w.useState)(!1),p=null==s?void 0:s.map((e=>{const t=e.sent_at?v.x.Date.format(e.sent_at):v.x.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}})),m=(0,w.useCallback)((()=>{var e;ts(n.newsletter_id)&&(c([]),e=n.newsletter_id,o([]),u(!0),v.x.Ajax.post({api_version:v.x.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,w.useEffect)((()=>{m()}),[m,n.newsletter_id]),(0,w.useEffect)((()=>{n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t)}),[n.operator,t,r]),(0,j.jsxs)(j.Fragment,{children:[i.length>0&&(0,j.jsx)(Be,{errors:i}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,placeholder:v.x.I18n.t("selectNewsletterPlaceholder"),options:p,value:(0,Cn.find)(["value",n.newsletter_id],p),onChange:e=>{r({newsletter_id:e.value,link_ids:[]},t)},automationId:"segment-email"})}),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{isMinWidth:!0,value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select-operator"),d&&(0,j.jsx)("span",{children:v.x.I18n.t("loadingDynamicSegmentItems")}),!d&&ts(n.newsletter_id)&&(0,j.jsx)(Ga.J,{isMulti:!0,dimension:"small",isFullWidth:!0,automationId:"segment-link-select",placeholder:v.x.I18n.t("allLinksPlaceholder"),options:l.length?l:[{value:0,label:v.x.I18n.t("noLinksHint"),isDisabled:!0}],value:(0,Cn.filter)((e=>!!n.link_ids&&-1!==n.link_ids.indexOf(e.value)),l),onChange:e=>{r({link_ids:(e||[]).map((e=>e.value))},t)}})]})]})},[Ja.EmailActionTypes.OPENED]:es,[Ja.EmailActionTypes.MACHINE_OPENED]:es,[Ja.EmailActionTypes.CLICKED_ANY]:null};var is;!function(e){e.NUMBER_OF_ORDERS="numberOfOrders",e.PURCHASED_CATEGORY="purchasedCategory",e.PURCHASED_PRODUCT="purchasedProduct",e.TOTAL_SPENT="totalSpent",e.CUSTOMER_IN_COUNTRY="customerInCountry"}(is||(is={}));const os=[{value:is.CUSTOMER_IN_COUNTRY,label:v.x.I18n.t("wooCustomerInCountry"),group:Ja.SegmentTypes.WooCommerce},{value:is.NUMBER_OF_ORDERS,label:v.x.I18n.t("wooNumberOfOrders"),group:Ja.SegmentTypes.WooCommerce},{value:is.PURCHASED_CATEGORY,label:v.x.I18n.t("wooPurchasedCategory"),group:Ja.SegmentTypes.WooCommerce},{value:is.PURCHASED_PRODUCT,label:v.x.I18n.t("wooPurchasedProduct"),group:Ja.SegmentTypes.WooCommerce},{value:is.TOTAL_SPENT,label:v.x.I18n.t("wooTotalSpent"),group:Ja.SegmentTypes.WooCommerce}],ls=[is.PURCHASED_PRODUCT,is.PURCHASED_CATEGORY];function cs(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form");(0,w.useEffect)((()=>{n.action===Ja.SubscriberActionTypes.WORDPRESS_ROLE&&n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t)}),[r,n,t]);const s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getWordpressRoles()),[]).map((e=>({value:e.role_id,label:e.role_name})));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{isFullWidth:!0,value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,isMulti:!0,automationId:"segment-wordpress-role",placeholder:v.x.I18n.t("selectUserRolePlaceholder"),options:s,value:(0,Cn.filter)((e=>{if(n.wordpressRole)return-1!==n.wordpressRole.indexOf(e.value)}),s),onChange:e=>{r({wordpressRole:(0,Cn.map)("value",e)},t)}})})]})}let ds;!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"}(ds||(ds={}));const us=[ds.HIGHER_THAN,ds.LOWER_THAN,ds.EQUALS,ds.NOT_EQUALS,ds.UNKNOWN,ds.NOT_UNKNOWN];var ps=n(23855),ms=n(12274);let hs;!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"}(hs||(hs={}));const fs=[hs.BEFORE,hs.AFTER,hs.ON,hs.NOT_ON,hs.IN_THE_LAST,hs.NOT_IN_THE_LAST],gs=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return v.x.Date.format(e,{format:"Y-m-d"})}},xs=e=>{const t=(0,ps.default)(e);if((0,ms.default)(t))return t};function vs(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 bs(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:r,updateSegmentFilter:a}=(0,za.Z)("mailpoet-dynamic-segments-form");return(0,w.useEffect)((()=>{void 0===n.operator&&a({operator:"equals",value:""},t)}),[a,n,t]),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{automationId:"text-custom-field-operator",value:n.operator,onChange:e=>{r("operator",t,e)},children:[(0,j.jsx)("option",{value:"equals",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"not_equals",children:v.x.I18n.t("notEquals")}),(0,j.jsx)("option",{value:"contains",children:v.x.I18n.t("contains")}),(0,j.jsx)("option",{value:"more_than",children:v.x.I18n.t("moreThan")}),(0,j.jsx)("option",{value:"less_than",children:v.x.I18n.t("lessThan")})]},"select"),(0,j.jsx)(te.I,{"data-automation-id":"text-custom-field-value",value:n.value||"",onChange:e=>{r("value",t,e)},placeholder:v.x.I18n.t("value")},"input")]})}function ys(e){return"string"==typeof e.value&&e.value.length>0}function ws(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r}=(0,za.Z)("mailpoet-dynamic-segments-form"),a=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),s=(0,Cn.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,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,placeholder:v.x.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 _s=n(95570),js=n(49546);const Is=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return(0,js.default)(e,"yyyy-MM-dd 00:00:00")}},Ss=e=>{const t=(0,ps.default)(e);if((0,ms.default)(t))return t},Cs={month:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,w.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Cn.assign)(n,{value:"2017-01-01 00:00:00"}),r)}),[t,n,r]),(0,j.jsxs)(se.P,{value:n.value,onChange:e=>{t((0,Cn.assign)(n,{value:e.target.value}),r)},children:[(0,j.jsx)("option",{value:"2017-01-01 00:00:00",children:v.x.I18n.t("january")}),(0,j.jsx)("option",{value:"2017-02-01 00:00:00",children:v.x.I18n.t("february")}),(0,j.jsx)("option",{value:"2017-03-01 00:00:00",children:v.x.I18n.t("march")}),(0,j.jsx)("option",{value:"2017-04-01 00:00:00",children:v.x.I18n.t("april")}),(0,j.jsx)("option",{value:"2017-05-01 00:00:00",children:v.x.I18n.t("may")}),(0,j.jsx)("option",{value:"2017-06-01 00:00:00",children:v.x.I18n.t("june")}),(0,j.jsx)("option",{value:"2017-07-01 00:00:00",children:v.x.I18n.t("july")}),(0,j.jsx)("option",{value:"2017-08-01 00:00:00",children:v.x.I18n.t("august")}),(0,j.jsx)("option",{value:"2017-09-01 00:00:00",children:v.x.I18n.t("september")}),(0,j.jsx)("option",{value:"2017-10-01 00:00:00",children:v.x.I18n.t("october")}),(0,j.jsx)("option",{value:"2017-11-01 00:00:00",children:v.x.I18n.t("november")}),(0,j.jsx)("option",{value:"2017-12-01 00:00:00",children:v.x.I18n.t("december")})]},"select")},year:function(e){let{onChange:t,item:n,filterIndex:r}=e;const a=(0,_s.default)(new Date);return(0,w.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Cn.assign)(n,{value:`${a}-01-01 00:00:00`,operator:"equals"}),r)}),[a,t,n,r]),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>{t((0,Cn.assign)(n,{operator:e.target.value}),r)},children:[(0,j.jsx)("option",{value:"equals",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"before",children:v.x.I18n.t("before")}),(0,j.jsx)("option",{value:"after",children:v.x.I18n.t("after")})]},"select-operator"),(0,j.jsx)(se.P,{value:n.value,onChange:e=>{t((0,Cn.assign)(n,{value:e.target.value}),r)},children:(0,Cn.range)(0,100).map((e=>(0,j.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,w.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Cn.assign)(n,{value:`${(0,js.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),r)}),[t,n,r]),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>{t((0,Cn.assign)(n,{operator:e.target.value}),r)},children:[(0,j.jsx)("option",{value:"equals",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"before",children:v.x.I18n.t("before")}),(0,j.jsx)("option",{value:"after",children:v.x.I18n.t("after")})]},"select-operator"),(0,j.jsx)(St,{onChange:e=>t((0,Cn.assign)(n,{value:Is(e)}),r),selected:n.value?Ss(n.value):void 0,dateFormat:"MM/yyyy",showMonthYearPicker:!0})]})},year_month_day:function(e){let{onChange:t,item:n,filterIndex:r}=e;return(0,w.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Cn.assign)(n,{value:`${(0,js.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),r)}),[t,n,r]),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>{t((0,Cn.assign)(n,{operator:e.target.value}),r)},children:[(0,j.jsx)("option",{value:"equals",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"before",children:v.x.I18n.t("before")}),(0,j.jsx)("option",{value:"after",children:v.x.I18n.t("after")})]},"select-operator"),(0,j.jsx)(St,{dateFormat:"MMM d, yyyy",onChange:e=>t((0,Cn.assign)(n,{value:Is(e)}),r),selected:n.value?Ss(n.value):void 0})]})}};var Ts;!function(e){e.DATE="date",e.TEXT="text",e.TEXTAREA="textarea",e.RADIO="radio",e.CHECKBOX="checkbox",e.SELECT="select"}(Ts||(Ts={}));const ks={[Ts.TEXT]:vs,[Ts.TEXTAREA]:vs,[Ts.RADIO]:ys,[Ts.SELECT]:ys,[Ts.CHECKBOX]:function(e){return"1"===e.value||"0"===e.value},[Ts.DATE]:function(e){return("month"===e.date_type||!("string"!=typeof e.operator||e.operator.length<1))&&"string"==typeof e.value&&e.value.length>1}},Ns={[Ts.TEXT]:bs,[Ts.TEXTAREA]:bs,[Ts.RADIO]:ws,[Ts.SELECT]:ws,[Ts.CHECKBOX]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:r,updateSegmentFilter:a}=(0,za.Z)("mailpoet-dynamic-segments-form");return(0,w.useEffect)((()=>{"1"!==n.value&&"0"!==n.value&&a({operator:"equals",value:"1"},t)}),[a,n,t]),(0,j.jsxs)(se.P,{value:n.value,onChange:e=>r("value",t,e),children:[(0,j.jsx)("option",{value:"1",children:v.x.I18n.t("checked")}),(0,j.jsx)("option",{value:"0",children:v.x.I18n.t("unchecked")})]},"select")},[Ts.DATE]:function(e){let{customField:t,filterIndex:n}=e;const r=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(n)),[n]),{updateSegmentFilter:a}=(0,za.Z)("mailpoet-dynamic-segments-form");(0,w.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=Cs[t.params.date_type];return s?(0,j.jsx)(s,{item:r,onChange:a,filterIndex:n}):null}},Ds=[{value:Ja.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD,label:v.x.I18n.t("mailpoetCustomField"),group:Ja.SegmentTypes.WordPressRole},{value:Ja.SubscriberActionTypes.SUBSCRIBER_SCORE,label:v.x.I18n.t("subscriberScore"),group:Ja.SegmentTypes.WordPressRole},{value:Ja.SubscriberActionTypes.SUBSCRIBED_DATE,label:v.x.I18n.t("subscribedDate"),group:Ja.SegmentTypes.WordPressRole},{value:Ja.SubscriberActionTypes.SUBSCRIBED_TO_LIST,label:v.x.I18n.t("subscribedToList"),group:Ja.SegmentTypes.WordPressRole},{value:Ja.SubscriberActionTypes.WORDPRESS_ROLE,label:v.x.I18n.t("segmentsSubscriber"),group:Ja.SegmentTypes.WordPressRole}],Es={[Ja.SubscriberActionTypes.WORDPRESS_ROLE]:cs,[Ja.SubscriberActionTypes.SUBSCRIBER_SCORE]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form");return(0,w.useEffect)((()=>{us.includes(n.operator)||r({operator:ds.HIGHER_THAN},t),n.operator!==ds.HIGHER_THAN&&n.operator!==ds.LOWER_THAN&&n.operator!==ds.EQUALS&&n.operator!==ds.NOT_EQUALS||void 0!==n.value||r({value:""},t),n.operator!==ds.UNKNOWN&&n.operator!==ds.NOT_UNKNOWN||r({value:null},t)}),[r,n,t]),(0,j.jsx)(bt.r.CenteredRow,{children:(s=e=>"{condition}"===e?(0,j.jsxs)(se.P,{value:n.operator,automationId:"segment-subscriber-score-operator",onChange:e=>{a("operator",t,e)},children:[(0,j.jsx)("option",{value:ds.HIGHER_THAN,children:v.x.I18n.t("higherThan")}),(0,j.jsx)("option",{value:ds.LOWER_THAN,children:v.x.I18n.t("lowerThan")}),(0,j.jsx)("option",{value:ds.EQUALS,children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:ds.NOT_EQUALS,children:v.x.I18n.t("notEquals")}),(0,j.jsx)("option",{value:ds.UNKNOWN,children:v.x.I18n.t("unknown")}),(0,j.jsx)("option",{value:ds.NOT_UNKNOWN,children:v.x.I18n.t("notUnknown")})]},"select"):"{score}"===e?(n.operator===ds.HIGHER_THAN||n.operator===ds.LOWER_THAN||n.operator===ds.EQUALS||n.operator===ds.NOT_EQUALS)&&(0,j.jsx)(te.I,{type:"number",value:n.value||"","data-automation-id":"segment-subscriber-score-value",onChange:e=>{a("value",t,e)},min:"0",placeholder:v.x.I18n.t("subscriberScorePlaceholder")},"input"):"string"==typeof e&&e.trim().length>0?n.operator!==ds.UNKNOWN&&n.operator!==ds.NOT_UNKNOWN&&(0,j.jsx)("div",{children:e},"score"):null,v.x.I18n.t("subscriberScoreSentence").split(/({condition})|({score})|(\b%\b)/gim).map(s))});var s},[Ja.SubscriberActionTypes.SUBSCRIBED_DATE]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form");return(0,w.useEffect)((()=>{fs.includes(n.operator)||r({operator:hs.BEFORE},t),n.operator!==hs.BEFORE&&n.operator!==hs.AFTER&&n.operator!==hs.ON&&n.operator!==hs.NOT_ON||void 0!==xs(n.value)&&/^\d+-\d+-\d+$/.test(n.value)||r({value:gs(new Date)},t),n.operator!==hs.IN_THE_LAST&&n.operator!==hs.NOT_IN_THE_LAST||"string"!=typeof n.value||/^\d*$/.exec(n.value)||r({value:""},t)}),[r,n,t]),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>{a("operator",t,e)},children:[(0,j.jsx)("option",{value:hs.BEFORE,children:v.x.I18n.t("before")}),(0,j.jsx)("option",{value:hs.AFTER,children:v.x.I18n.t("after")}),(0,j.jsx)("option",{value:hs.ON,children:v.x.I18n.t("on")}),(0,j.jsx)("option",{value:hs.NOT_ON,children:v.x.I18n.t("notOn")}),(0,j.jsx)("option",{value:hs.IN_THE_LAST,children:v.x.I18n.t("inTheLast")}),(0,j.jsx)("option",{value:hs.NOT_IN_THE_LAST,children:v.x.I18n.t("notInTheLast")})]},"select"),(n.operator===hs.BEFORE||n.operator===hs.AFTER||n.operator===hs.ON||n.operator===hs.NOT_ON)&&(0,j.jsx)(St,{dateFormat:"MMM d, yyyy",onChange:e=>{r({value:gs(e)},t)},selected:n.value?xs(n.value):void 0}),(n.operator===hs.IN_THE_LAST||n.operator===hs.NOT_IN_THE_LAST)&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(te.I,{type:"number",value:n.value,onChange:e=>{a("value",t,e)},min:"1",placeholder:v.x.I18n.t("daysPlaceholder")},"input"),(0,j.jsx)("span",{children:v.x.I18n.t("daysPlaceholder")})]})]})},[Ja.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r}=(0,za.Z)("mailpoet-dynamic-segments-form"),a=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),s=(0,Cn.find)({id:Number(n.custom_field_id)},a),i=a.map((e=>({value:e.id.toString(),label:e.name}))),o=Ns[n.custom_field_type];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{children:(0,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,placeholder:v.x.I18n.t("selectCustomFieldPlaceholder"),options:i,automationId:"select-custom-field",value:(0,Cn.find)((e=>{if(n.custom_field_id)return n.custom_field_id===e.value}),i),onChange:e=>{const n=(0,Cn.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,j.jsx)("div",{children:o&&(0,j.jsx)(o,{customField:s,filterIndex:t})})]})},[Ja.SubscriberActionTypes.SUBSCRIBED_TO_LIST]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),r=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getStaticSegmentsList()),[]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:s}=(0,za.Z)("mailpoet-dynamic-segments-form");(0,w.useEffect)((()=>{n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.NONE&&a({operator:Ja.AnyValueTypes.ANY},t)}),[a,n,t]);const i=r.map((e=>({value:e.id,label:e.name})));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{isFullWidth:!0,value:n.operator,onChange:e=>{s("operator",t,e)},children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:v.x.I18n.t("searchLists"),options:i,value:(0,Cn.filter)((e=>{if(!n.segments)return;const t=e.value;return-1!==n.segments.indexOf(t)}),i),onChange:e=>{a({segments:(0,Cn.map)("value",e)},t)}})})]})}};var Os;!function(e){e.MEMBER_OF="isMemberOf"}(Os||(Os={}));const Rs=[{value:Os.MEMBER_OF,label:v.x.I18n.t("segmentsActiveMembership"),group:Ja.SegmentTypes.WooCommerceMembership}];var As;!function(e){e.ACTIVE_SUBSCRIPTIONS="hasActiveSubscription"}(As||(As={}));const Ps=[{value:As.ACTIVE_SUBSCRIPTIONS,label:v.x.I18n.t("segmentsActiveSubscription"),group:Ja.SegmentTypes.WooCommerceSubscription}],Ms={[Ja.SegmentTypes.Email]:function(e){return!!Object.values(Ja.EmailActionTypes).some((t=>t===e.action))&&(e.action===Ja.EmailActionTypes.CLICKED_ANY||(e.action===Ja.EmailActionTypes.CLICKED?!!e.newsletter_id:e.action!==Ja.EmailActionTypes.OPENS_ABSOLUTE_COUNT&&e.action!==Ja.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT?Array.isArray(e.newsletters)&&e.newsletters.length>0:!!e.days&&!!e.opens&&!!e.operator))},[Ja.SegmentTypes.WooCommerce]:function(e){if(!Object.values(is).some((t=>t===e.action)))return!1;const t=void 0===e.category_ids||0===e.category_ids.length||!e.operator;if(e.action===is.PURCHASED_CATEGORY&&t)return!1;const n=void 0===e.product_ids||0===e.product_ids.length||!e.operator;if(e.action===is.PURCHASED_PRODUCT&&n)return!1;const r=void 0===e.country_code||0===e.country_code.length;if(e.action===is.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===is.NUMBER_OF_ORDERS&&a||!(e.action!==is.TOTAL_SPENT||e.total_spent_amount&&e.total_spent_days&&e.total_spent_type))},[Ja.SegmentTypes.WordPressRole]:function(e){return e.action&&e.action!==Ja.SubscriberActionTypes.WORDPRESS_ROLE?e.action===Ja.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD?function(e){const t=ks[e.custom_field_type];return!!t&&t(e)}(e):e.action===Ja.SubscriberActionTypes.SUBSCRIBER_SCORE?function(e){if(e.operator===ds.HIGHER_THAN||e.operator===ds.LOWER_THAN||e.operator===ds.EQUALS||e.operator===ds.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===ds.UNKNOWN||e.operator===ds.NOT_UNKNOWN}(e):e.action===Ja.SubscriberActionTypes.SUBSCRIBED_TO_LIST?function(e){return(e.operator===Ja.AnyValueTypes.ANY||e.operator===Ja.AnyValueTypes.ALL||e.operator===Ja.AnyValueTypes.NONE)&&Array.isArray(e.segments)&&e.segments.length>0}(e):!(!e.operator||!e.value)&&(e.operator===hs.BEFORE||e.operator===hs.AFTER||e.operator===hs.ON||e.operator===hs.NOT_ON?/^\d+-\d+-\d+$/.test(e.value):(e.operator===hs.IN_THE_LAST||e.operator===hs.NOT_IN_THE_LAST)&&(/^\d+$/.test(e.value)&&Number(e.value)>0)):Array.isArray(e.wordpressRole)&&e.wordpressRole.length>0},[Ja.SegmentTypes.WooCommerceMembership]:function(e){const t=!e.plan_ids||!e.plan_ids.length||!e.operator;return e.action!==Os.MEMBER_OF||!t},[Ja.SegmentTypes.WooCommerceSubscription]:function(e){const t=!e.product_ids||!e.product_ids.length||!e.operator;return e.action!==As.ACTIVE_SUBSCRIPTIONS||!t}};function Ls(e){return!(e.length<1)&&0===e.map((e=>void 0!==Ms[e.segmentType]&&Ms[e.segmentType](e))).filter((e=>!1===e)).length}let Fs,qs;function $s(){const e=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),{updateSubscriberCount:n}=(0,za.Z)("mailpoet-dynamic-segments-form"),r=JSON.stringify(e),a=(0,w.useRef)(1),s=(0,w.useRef)(null),i=(0,w.useRef)(!1),o=(0,w.useRef)((0,Qa.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 Xa().isEqual(t,Fs)?Promise.resolve(qs):(Fs={filters:[...e.filters],filters_connect:e.filters_connect},v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"dynamic_segments",action:"getCount",data:e,timeout:2e4}).then((e=>{const{data:t}=e;return qs={count:t.count,errors:void 0},qs})))}(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,w.useEffect)((()=>{Ls(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,j.jsx)("div",{className:"mailpoet-form-field",children:(0,j.jsxs)("span",{className:"mailpoet-form-error-message",children:[v.x.I18n.t("dynamicSegmentSizeCalculatingTimeout")," ",(0,j.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:v.x.I18n.t("learnMore")})]})}):t.loading||void 0!==t.count?t.loading?(0,j.jsx)("div",{className:"mailpoet-form-field",children:(0,j.jsx)("span",{className:"mailpoet-form-notice-message",children:v.x.I18n.t("dynamicSegmentSizeIsCalculated")})}):(0,j.jsx)("div",{className:"mailpoet-form-field",children:(0,j.jsx)("span",{className:"mailpoet-form-notice-message",children:v.x.I18n.t("dynamicSegmentSize").replace("%1$d",t.count.toLocaleString())})}):(0,j.jsx)("span",{})}const Us={[Ja.SegmentTypes.Email]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),r=ss[n.action];return r?(0,j.jsx)(r,{filterIndex:t}):null},[Ja.SegmentTypes.WooCommerce]:e=>{let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form"),s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getProductCategories()),[]),i=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCountries()),[]),o=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getProducts()),[]),l=(0,Ka.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 p;return(0,w.useEffect)((()=>{void 0===n.number_of_orders_type&&n.action===is.NUMBER_OF_ORDERS&&r({number_of_orders_type:"="},t),void 0===n.total_spent_type&&n.action===is.TOTAL_SPENT&&r({total_spent_type:">"},t),ls.includes(n.action)&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t),n.action===is.CUSTOMER_IN_COUNTRY&&n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t)}),[r,n,t]),n.action===is.PURCHASED_PRODUCT?p=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>r({operator:e.target.value},t),automationId:"select-operator",children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select-operator")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:v.x.I18n.t("selectWooPurchasedProduct"),options:c,value:(0,Cn.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===is.PURCHASED_CATEGORY?p=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>r({operator:e.target.value},t),automationId:"select-operator",children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select-operator")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:v.x.I18n.t("selectWooPurchasedCategory"),options:d,value:(0,Cn.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===is.NUMBER_OF_ORDERS?p=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{value:n.number_of_orders_type,onChange:e=>{a("number_of_orders_type",t,e)},automationId:"select-number-of-orders-type",children:[(0,j.jsx)("option",{value:"=",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"!=",children:v.x.I18n.t("notEquals")}),(0,j.jsx)("option",{value:">",children:v.x.I18n.t("moreThan")}),(0,j.jsx)("option",{value:"<",children:v.x.I18n.t("lessThan")})]},"select"),(0,j.jsx)(te.I,{"data-automation-id":"input-number-of-orders-count",type:"number",min:0,value:n.number_of_orders_count||"",placeholder:v.x.I18n.t("wooNumberOfOrdersCount"),onChange:e=>{a("number_of_orders_count",t,e)}}),(0,j.jsx)("div",{children:v.x.I18n.t("wooNumberOfOrdersOrders")})]}),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsx)("div",{children:v.x.I18n.t("inTheLast")}),(0,j.jsx)(te.I,{"data-automation-id":"input-number-of-orders-days",type:"number",min:1,value:n.number_of_orders_days||"",placeholder:v.x.I18n.t("daysPlaceholder"),onChange:e=>{a("number_of_orders_days",t,e)}}),(0,j.jsx)("div",{children:v.x.I18n.t("days")})]})]}):n.action===is.TOTAL_SPENT?p=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsxs)(se.P,{value:n.total_spent_type,onChange:e=>{a("total_spent_type",t,e)},automationId:"select-total-spent-type",children:[(0,j.jsx)("option",{value:"=",children:v.x.I18n.t("equals")}),(0,j.jsx)("option",{value:"!=",children:v.x.I18n.t("notEquals")}),(0,j.jsx)("option",{value:">",children:v.x.I18n.t("moreThan")}),(0,j.jsx)("option",{value:"<",children:v.x.I18n.t("lessThan")})]},"select"),(0,j.jsx)(te.I,{"data-automation-id":"input-total-spent-amount",type:"number",min:0,step:.01,value:n.total_spent_amount||"",placeholder:v.x.I18n.t("wooTotalSpentAmount"),onChange:e=>{a("total_spent_amount",t,e)}}),(0,j.jsx)("div",{children:l})]}),(0,j.jsxs)(bt.r.CenteredRow,{children:[(0,j.jsx)("div",{children:v.x.I18n.t("inTheLast")}),(0,j.jsx)(te.I,{"data-automation-id":"input-total-spent-days",type:"number",min:1,value:n.total_spent_days||"",placeholder:v.x.I18n.t("daysPlaceholder"),onChange:e=>{a("total_spent_days",t,e)}}),(0,j.jsx)("div",{children:v.x.I18n.t("days")})]})]}):n.action===is.CUSTOMER_IN_COUNTRY&&(p=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>r({operator:e.target.value},t),automationId:"select-operator-country",children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select-operator-country")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:v.x.I18n.t("selectWooCountry"),options:u,value:(0,Cn.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")})]})),p},[Ja.SegmentTypes.WordPressRole]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);let r;return r=n.action?Es[n.action]:cs,r?(0,j.jsx)(r,{filterIndex:t}):null},[Ja.SegmentTypes.WooCommerceMembership]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form"),s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getMembershipPlans()),[]).map((e=>({value:e.id,label:e.name})));return(0,w.useEffect)((()=>{n.action===Os.MEMBER_OF&&n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t)}),[r,n,t]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select-operator")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:v.x.I18n.t("selectWooMembership"),options:s,value:(0,Cn.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")})]})},[Ja.SegmentTypes.WooCommerceSubscription]:function(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:a}=(0,za.Z)("mailpoet-dynamic-segments-form"),s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriptionProducts()),[]).map((e=>({value:e.id,label:e.name})));return(0,w.useEffect)((()=>{n.action===As.ACTIVE_SUBSCRIPTIONS&&n.operator!==Ja.AnyValueTypes.ANY&&n.operator!==Ja.AnyValueTypes.ALL&&n.operator!==Ja.AnyValueTypes.NONE&&r({operator:Ja.AnyValueTypes.ANY},t)}),[r,n,t]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsxs)(se.P,{value:n.operator,onChange:e=>a("operator",t,e),automationId:"select-operator",children:[(0,j.jsx)("option",{value:Ja.AnyValueTypes.ANY,children:v.x.I18n.t("anyOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.ALL,children:v.x.I18n.t("allOf")}),(0,j.jsx)("option",{value:Ja.AnyValueTypes.NONE,children:v.x.I18n.t("noneOf")})]},"select-operator")}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{isMulti:!0,dimension:"small",isFullWidth:!0,placeholder:v.x.I18n.t("selectWooSubscription"),options:s,value:(0,Cn.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 Zs(e){let{filterIndex:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);if(void 0===n||void 0===Us[n.segmentType])return null;const r=Us[n.segmentType];return(0,j.jsx)(r,{filterIndex:t})}function Vs(){const e=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=[Ja.EmailActionTypes.OPENED,Ja.EmailActionTypes.OPENS_ABSOLUTE_COUNT,Ja.EmailActionTypes.MACHINE_OPENED,Ja.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT];let n=!1;return e.filters.forEach((e=>{t.includes(e.action)&&(n=!0)})),n?(0,j.jsx)("div",{className:"mailpoet-form-field",children:(0,j.jsx)("span",{className:"mailpoet-form-notice-message",children:v.x.I18n.t("privacyProtectionNotice")})}):(0,j.jsx)("span",{})}const{subscribersLimitReached:Ws,subscribersLimit:Ys,subscribersCount:Bs,premiumActive:Hs,hasValidApiKey:zs,hasValidPremiumKey:Ks,isPremiumPluginInstalled:Gs,premiumPluginDownloadUrl:Qs,premiumPluginActivationUrl:Xs,pluginPartialKey:Js}=v.x,ei=zs||Ks,ti=e=>{const t=v.x.I18n.t(e);return(0,j.jsx)("p",{children:C()(t,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?Bs:Ys))})},ni=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_blank";return(0,j.jsx)(O.z,{href:t,target:n,rel:"noopener noreferrer",children:v.x.I18n.t(e)})};function ri(e){let t,n,{message:r,actionButton:a}=e;if(ei&&!Hs)t=ti("premiumFeatureDescription"),n=Gs?ni("premiumFeatureButtonActivatePremium",Xs,"_self"):ni("premiumFeatureButtonDownloadPremium",Qs);else if(Ws){t=ti("premiumFeatureDescriptionSubscribersLimitReached");const e=ei?v.x.MailPoetComUrlFactory.getUpgradeUrl(Js):v.x.MailPoetComUrlFactory.getPurchasePlanUrl(+Bs+1);n=ni("premiumFeatureButtonUpgradePlan",e)}else t=r,n=a;return(0,j.jsx)(Oe.K,{title:v.x.I18n.t("premiumFeature"),message:t,actionButton:n})}function ai(){return(0,j.jsx)(ri,{message:(()=>{const e=v.x.I18n.t("premiumFeatureMultipleConditions");return(0,j.jsx)("p",{children:C()(e,/\[link](.*?)\[\/link]/g,(e=>(0,j.jsx)("a",{href:v.x.premiumLink,target:"_blank",rel:"noopener noreferrer",children:e},e)))})})(),actionButton:(0,j.jsx)(O.z,{href:v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount,v.x.currentWpUserEmail,null,{utm_medium:"segments",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("premiumBannerCtaFree")})})}const si=Ee.Hooks.applyFilters("mailpoet_dynamic_segments_form_filters_before",(()=>null)),ii=Ee.Hooks.applyFilters("mailpoet_dynamic_filters_filter_before",(()=>null)),oi=Ee.Hooks.applyFilters("mailpoet_dynamic_filters_filter_after",(()=>(0,j.jsx)("div",{className:"mailpoet-gap"})));function li(e){let{segmentId:t}=e;const n=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),r=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getAvailableFilters()),[]),a=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").findFiltersValueForSegment(n)),[n]),s=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),i=(0,Ka.Z)((e=>e("mailpoet-dynamic-segments-form").getErrors()),[]),{updateSegment:o,updateSegmentFilter:l,handleSave:c}=(0,za.Z)("mailpoet-dynamic-segments-form"),[d,u]=(0,w.useState)(!1),p=Ee.Hooks.applyFilters("mailpoet_dynamic_segments_form_add_condition_action",(()=>{u(!0)}));return(0,j.jsxs)("form",{className:"mailpoet_form",children:[i.length>0&&(0,j.jsx)(Be,{errors:i.map((e=>({message:e})))}),(0,j.jsxs)("div",{className:"mailpoet-form-grid",children:[(0,j.jsxs)("div",{className:"mailpoet-form-field-name form-field-row-name mailpoet-segments-name-section",children:[(0,j.jsx)(fe.X,{level:4,children:(0,j.jsx)("label",{htmlFor:"field_name",children:v.x.I18n.t("name")})}),(0,j.jsx)("div",{className:"mailpoet-form-field",children:(0,j.jsx)(te.I,{isFullWidth:!0,type:"text",name:"name",id:"field_name",defaultValue:n.name,onChange:e=>o({name:e.target.value})})})]}),(0,j.jsxs)("div",{className:"mailpoet-form-field-description form-field-row-description mailpoet-segments-description-section",children:[(0,j.jsx)(fe.X,{level:4,children:(0,j.jsx)("label",{htmlFor:"field_description",children:v.x.I18n.t("description")})}),(0,j.jsx)("p",{className:"mailpoet-form-description",children:v.x.I18n.t("segmentDescriptionTip")}),(0,j.jsx)("div",{className:"mailpoet-form-field",children:(0,j.jsx)(re.g,{isFullWidth:!0,name:"description",id:"field_description",value:n.description,onChange:e=>o({description:e.target.value})})})]}),(0,j.jsxs)("div",{className:"mailpoet-segments-segments-section",children:[(0,j.jsx)(fe.X,{level:4,children:(0,j.jsx)("label",{htmlFor:"field_filters",children:v.x.I18n.t("formPageTitle")})}),(0,j.jsx)(si,{}),Array.isArray(a)&&a.map(((e,t)=>(0,j.jsxs)(w.Fragment,{children:[(0,j.jsxs)(bt.r.ThreeColumns,{className:"mailpoet-segments-grid",automationId:`filter-row-${t}`,children:[(0,j.jsx)(ii,{filterRows:a,index:t}),(0,j.jsx)(bt.r.CenteredRow,{children:(0,j.jsx)(Ga.J,{dimension:"small",placeholder:v.x.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,j.jsx)(Zs,{filterIndex:e.index})]}),(0,j.jsx)(oi,{index:t})]},e.index))),(0,j.jsx)(O.z,{type:"button",variant:"tertiary",iconStart:q,onClick:e=>{e.preventDefault(),p(n,o)},children:v.x.I18n.t("addCondition")})]}),d&&(0,j.jsx)("div",{className:"mailpoet-grid-span-two-columns",children:(0,j.jsx)(ai,{})}),(0,j.jsxs)("div",{className:"mailpoet-segments-counter-section",children:[(0,j.jsx)($s,{}),(0,j.jsx)(Vs,{})]}),(0,j.jsx)("div",{className:"mailpoet-form-actions",children:(0,j.jsx)(O.z,{type:"submit",onClick:e=>{e.preventDefault(),c(t)},isDisabled:!Ls(n.filters)||void 0===s.count,children:v.x.I18n.t("save")})})]})]})}var ci=n(61299);const di=e=>e.products,ui=e=>e.membershipPlans,pi=e=>e.subscriptionProducts,mi=e=>e.wordpressRoles,hi=e=>e.productCategories,fi=e=>e.newslettersList,gi=e=>e.canUseWooSubscriptions,xi=e=>e.wooCurrencySymbol,vi=e=>e.wooCountries,bi=e=>e.customFieldsList,yi=e=>e.segment,wi=e=>e.staticSegmentsList,_i=e=>e.subscriberCount,ji=(e,t)=>{let n;return Array.isArray(e.segment.filters)?(n={...e.segment.filters[t]},n):n},Ii=e=>e.errors,Si=e=>e.allAvailableFilters,Ci=(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 Ti(e,t){return{...e,segment:t.segment}}function ki(e,t){return{...e,errors:t.errors}}function Ni(e,t){const n=e.segment;return{...e,segment:(0,Cn.assign)(n,t.segment)}}function Di(e,t){const n={...e.segment};return n.filters[t.filterIndex]=(0,Cn.assign)(n.filters[t.filterIndex],t.filter),{...e,segment:n}}function Ei(e,t){const n=e.subscriberCount;return{...e,subscriberCount:(0,Cn.assign)(n,t.subscriberCount)}}const Oi=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 Ja.Actions.SET_SEGMENT:return Ti(t,n);case Ja.Actions.SET_ERRORS:return ki(t,n);case Ja.Actions.UPDATE_SEGMENT:return Ni(t,n);case Ja.Actions.UPDATE_SEGMENT_FILTER:return Di(t,n);case Ja.Actions.UPDATE_SUBSCRIBER_COUNT:return Ei(t,n);default:return t}};function Ri(e){return{type:Ja.Actions.SET_SEGMENT,segment:e}}function Ai(e){return{type:Ja.Actions.SET_ERRORS,errors:e}}function Pi(e){return{type:Ja.Actions.UPDATE_SEGMENT,segment:e}}function Mi(e,t){return{type:Ja.Actions.UPDATE_SEGMENT_FILTER,filter:e,filterIndex:t}}function Li(e,t){return{type:Ja.Actions.UPDATE_SEGMENT,segment:{[e]:t.target.value}}}function Fi(e,t,n){return{type:Ja.Actions.UPDATE_SEGMENT_FILTER,filter:{[e]:n.target.value},filterIndex:t}}function qi(e){return{type:Ja.Actions.UPDATE_SUBSCRIBER_COUNT,subscriberCount:e}}function*$i(e){if(void 0===e)return;v.x.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 Ri(t),v.x.Modal.loading(!1)}function*Ui(e){const t=(0,ci.Ys)("mailpoet-dynamic-segments-form").getSegment();yield Ai([]);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?v.x.Notice.success(v.x.I18n.t("dynamicSegmentUpdated")):(a=t,v.x.Notice.success(v.x.I18n.t("dynamicSegmentAdded")),v.x.trackEvent("Segments > Add new",{type:a.segmentType||"unknown type",subtype:a.action||a.wordpressRole||"unknown subtype"}))):yield Ai(n)}function Zi(e){let t=JSON.parse(JSON.stringify(e));return(0,Cn.has)("link_id",e)&&(t=(0,Cn.assign)(t,{link_id:e.link_id.toString()})),(0,Cn.has)("newsletter_id",e)&&(t=(0,Cn.assign)(t,{newsletter_id:e.newsletter_id.toString()})),(0,Cn.has)("product_id",e)&&(t=(0,Cn.assign)(t,{product_id:e.product_id.toString()})),(0,Cn.has)("category_id",e)&&(t=(0,Cn.assign)(t,{category_id:e.category_id.toString()})),t}async function Vi(e){const t=e.segmentId;try{return{success:!0,res:Zi((await v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"dynamic_segments",action:"get",data:{id:t}})).data)}}catch(e){return{success:!1,error:(0,He.q)(e)?e.errors.map((e=>e.message)):null,res:e}}}async function Wi(e){const t=e.segment;try{return await v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"dynamic_segments",action:"save",data:t}),{success:!0}}catch(e){return{success:!1,error:(0,He.q)(e)?e.errors.map((e=>e.message)):null}}}function Yi(e,t){const n=[{label:v.x.I18n.t("email"),options:as},{label:v.x.I18n.t("wpUserRole"),options:Ds}];return v.x.isWoocommerceActive&&n.push({label:v.x.I18n.t("woocommerce"),options:os}),v.x.isWoocommerceActive&&t&&n.push({label:v.x.I18n.t("woocommerceMemberships"),options:Rs}),v.x.isWoocommerceActive&&e&&n.push({label:v.x.I18n.t("woocommerceSubscriptions"),options:Ps}),n}function Bi(){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:Ja.SegmentConnectTypes.AND,filters:[{segmentType:Ja.SegmentTypes.WordPressRole,action:Ja.SubscriberActionTypes.WORDPRESS_ROLE}]},subscriberCount:{loading:!1},errors:[],allAvailableFilters:Yi(window.mailpoet_can_use_woocommerce_subscriptions,window.mailpoet_can_use_woocommerce_memberships)},t={selectors:r,actions:a,controls:s,reducer:Oi(e),resolvers:{}};(0,ci.R9)("mailpoet-dynamic-segments-form",t)})();const{pageLoaded:t}=(0,za.Z)("mailpoet-dynamic-segments-form");return(0,w.useEffect)((()=>{t(e.params.id)}),[e.params.id,t]),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(X.A,{color:"#fff"}),(0,j.jsx)(be.B,{}),(0,j.jsxs)(fe.X,{level:1,className:"mailpoet-title",children:[(0,j.jsx)("span",{children:v.x.I18n.t("formPageTitle")}),(0,j.jsx)(l.rU,{className:"mailpoet-button button button-secondary button-small",to:"/segments",children:v.x.I18n.t("backToList")})]}),(0,j.jsx)(li,{segmentId:Number(e.params.id)})]})}const Hi=[{name:"name",label:v.x.I18n.t("nameColumn"),sortable:!0},{name:"description",label:v.x.I18n.t("description"),sortable:!1},{name:"count",label:v.x.I18n.t("subscribersCountColumn"),sortable:!1},{name:"subscribed",label:v.x.I18n.t("subscribed"),sortable:!1},{name:"updated_at",label:v.x.I18n.t("updatedAtColumn"),sortable:!0}],zi={onLoadingItems:()=>v.x.I18n.t("loadingDynamicSegmentItems"),onNoItemsFound:()=>v.x.I18n.t("noDynamicSegmentItemsFound"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneDynamicSegmentTrashed"):v.x.I18n.t("multipleDynamicSegmentsTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneDynamicSegmentDeleted"):v.x.I18n.t("multipleDynamicSegmentsDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneDynamicSegmentRestored"):v.x.I18n.t("multipleDynamicSegmentsRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)}},Ki=[{name:"edit",className:"mailpoet-hide-on-mobile",link:e=>(0,j.jsx)(l.rU,{to:`/edit-segment/${e.id}`,children:v.x.I18n.t("edit")}),display:e=>!e.is_plugin_missing},{name:"edit_disabled",className:"mailpoet-hide-on-mobile mailpoet-disabled",link:e=>(0,j.jsx)(l.rU,{to:`/edit-segment/${e.id}`,children:v.x.I18n.t("edit")}),display:e=>e.is_plugin_missing},{name:"view_subscribers",link:e=>(0,j.jsx)("a",{href:e.subscribers_url,children:v.x.I18n.t("viewSubscribers")})},{name:"trash",className:"mailpoet-hide-on-mobile"}],Gi=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:zi.onTrash}];function Qi(e,t){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("td",{className:"column-primary","data-colname":v.x.I18n.t("nameColumn"),children:[(0,j.jsx)("span",{className:"mailpoet-listing-title",children:e.name}),t]}),(0,j.jsx)("td",{"data-colname":v.x.I18n.t("description"),children:(0,j.jsx)("abbr",{children:e.description})}),e.is_plugin_missing?(0,j.jsx)("td",{colSpan:"2",className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("missingPluginMessageColumn"),children:e.missing_plugin_message&&e.missing_plugin_message.message&&e.missing_plugin_message.link?C()(e.missing_plugin_message.message,/\[link](.*?)\[\/link]/g,(t=>(0,j.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,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("subscribersCountColumn"),children:parseInt(e.count_all,10).toLocaleString()}),(0,j.jsx)("td",{className:"column mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("subscribed"),children:parseInt(e.count_subscribed,10).toLocaleString()})]}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("updatedAtColumn"),children:[v.x.Date.short(e.created_at),(0,j.jsx)("br",{}),v.x.Date.time(e.created_at)]})]})}function Xi(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(x.N,{limit:window.mailpoet_listing_per_page,location:e.location,params:e.match.params,search:!0,onRenderItem:Qi,endpoint:"dynamic_segments",base_url:"segments",columns:Hi,messages:zi,sort_by:"created_at",sort_order:"desc",item_actions:Ki,bulk_actions:Gi}),(0,j.jsxs)("p",{className:"mailpoet_sending_methods_help help",children:[(0,j.jsxs)("b",{children:[v.x.I18n.t("segmentsTip"),":"]})," ",v.x.I18n.t("segmentsTipText")," ",(0,j.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:v.x.I18n.t("segmentsTipLink")})]})]})}Xi.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const Ji=(0,c.withRouter)(Xi);function eo(){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(F.Q,{children:[(0,j.jsxs)(l.rU,{className:"mailpoet-button button-secondary",to:"/new",children:[q,(0,j.jsx)("span",{children:v.x.I18n.t("new")})]}),(0,j.jsxs)(l.rU,{className:"mailpoet-button button-secondary",to:"/new-segment","data-automation-id":"new-segment",children:[q,(0,j.jsx)("span",{children:v.x.I18n.t("newSegment")})]})]}),(0,j.jsx)(P,{subscribersInPlan:v.x.subscribersCount,subscribersInPlanLimit:v.x.subscribersLimit}),(0,j.jsx)(R,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),(0,j.jsx)(k,{}),(0,j.jsx)(E,{}),(0,j.jsx)(N,{mssKeyInvalid:v.x.hasInvalidMssApiKey,subscribersCount:v.x.subscribersCount})]})}const to=document.getElementById("segments_container");function no(){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(eo,{}),(0,j.jsxs)(xa.t,{activeKey:"lists",routerType:"switch-only",children:[(0,j.jsx)(ca.O,{route:"lists/(.*)?",title:v.x.I18n.t("pageTitle"),children:(0,j.jsx)(Wa,{})},"lists"),(0,j.jsx)(ca.O,{route:"segments/(.*)?",title:v.x.I18n.t("pageTitleSegments"),automationId:"dynamic-segments-tab",children:(0,j.jsx)(Ji,{})},"segments")]})]})}function ro(){return(0,j.jsx)(Ce.k.Provider,{value:(0,Ce.S)(window),children:(0,j.jsxs)(l.UT,{children:[(0,j.jsx)(Me.w,{}),(0,j.jsxs)(c.Switch,{children:[(0,j.jsx)(c.Route,{exact:!0,path:"/",render:()=>(0,j.jsx)(c.Redirect,{to:"/lists"})}),(0,j.jsx)(c.Route,{path:"/new",component:Ha}),(0,j.jsx)(c.Route,{path:"/edit/:id",component:Ha}),(0,j.jsx)(c.Route,{path:"/new-segment",component:Bi}),(0,j.jsx)(c.Route,{path:"/edit-segment/:id",component:Bi}),(0,j.jsx)(c.Route,{path:"/segments/(.*)?",component:no}),(0,j.jsx)(c.Route,{path:"/lists/(.*)?",component:no})]})]})})}to&&o().render((0,j.jsx)(ro,{}),to);const ao=()=>{v.x.trackEvent("Forms > Add New"),setTimeout((()=>{window.location=window.mailpoet_form_template_selection_url}),200)};function so(){const[e,t]=(0,w.useState)(!1);return(0,j.jsx)(F.Q,{children:(0,j.jsx)(O.z,{onClick:()=>{t(!0),ao()},withSpinner:e,automationId:"create_new_form",variant:"secondary",iconStart:q,children:v.x.I18n.t("new")})})}const io=[{name:"name",label:v.x.I18n.t("formName"),sortable:!0},{name:"segments",label:v.x.I18n.t("segments")},{name:"type",label:v.x.I18n.t("type")},{name:"status",label:v.x.I18n.t("status")},{name:"updated_at",label:v.x.I18n.t("updatedAt"),sortable:!0}],oo={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneFormTrashed"):v.x.I18n.t("multipleFormsTrashed").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneFormDeleted"):v.x.I18n.t("multipleFormsDeleted").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?v.x.I18n.t("oneFormRestored"):v.x.I18n.t("multipleFormsRestored").replace("%1$d",t.toLocaleString()),v.x.Notice.success(n)},onNoItemsFound:()=>(0,j.jsxs)("div",{className:"mailpoet-forms-add-new-row",children:[(0,j.jsx)("p",{children:v.x.I18n.t("noItemsFound")}),(0,j.jsx)(g.Button,{onClick:ao,automationId:"add_new_form",iconStart:q,children:v.x.I18n.t("new")})]})},lo=[{name:"trash",label:v.x.I18n.t("moveToTrash"),onSuccess:oo.onTrash}],co=[{name:"edit",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("edit"),link:function(e){return(0,j.jsx)("a",{href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:v.x.I18n.t("edit")})}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:v.x.I18n.t("duplicate"),onClick:function(e,t){return v.x.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:v.x.I18n.t("noName");v.x.Notice.success(v.x.I18n.t("formDuplicated").replace("%1$s",n)),t()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class uo extends w.Component{constructor(){super(...arguments),(0,y.Z)(this,"updateStatus",((e,t)=>{t.persist(),v.x.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&&v.x.Notice.success(v.x.I18n.t("formActivated"))})).fail((n=>{v.x.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,y.Z)(this,"isItemInactive",(e=>"disabled"===e.status)),(0,y.Z)(this,"renderItem",((e,t)=>{const n=u()("manage-column","column-primary","has-row-actions"),r=window.mailpoet_segments.filter((t=>-1!==m().inArray(t.id,e.segments))),a=function(e){var t,n,r,a,s,i,o,l;const c=[];return"1"===(null==e||null===(t=e.form_placement)||void 0===t||null===(n=t.fixed_bar)||void 0===n?void 0:n.enabled)&&c.push(v.x.I18n.t("placeFixedBarFormOnPages")),"1"===(null==e||null===(r=e.form_placement)||void 0===r||null===(a=r.below_posts)||void 0===a?void 0:a.enabled)&&c.push(v.x.I18n.t("placeFormBellowPages")),"1"===(null==e||null===(s=e.form_placement)||void 0===s||null===(i=s.popup)||void 0===i?void 0:i.enabled)&&c.push(v.x.I18n.t("placePopupFormOnPages")),"1"===(null==e||null===(o=e.form_placement)||void 0===o||null===(l=o.slide_in)||void 0===l?void 0:l.enabled)&&c.push(v.x.I18n.t("placeSlideInFormOnPages")),c.length>0?c.join(", "):v.x.I18n.t("placeFormOthers")}(e.settings);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("td",{className:n,children:[(0,j.jsx)("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-form-editor&id=${e.id}`,children:e.name?e.name:`(${v.x.I18n.t("noName")})`}),t]}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("segments"),children:(0,j.jsx)(lr.$,{segments:r,dimension:"large",children:"user"===e.settings.segments_selected_by&&(0,j.jsx)("span",{className:"mailpoet-tags-prefix",children:v.x.I18n.t("userChoice")})})}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("type"),children:a}),(0,j.jsx)("td",{className:"column","data-colname":v.x.I18n.t("status"),children:this.renderStatus(e)}),(0,j.jsxs)("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":v.x.I18n.t("updatedAt"),children:[v.x.Date.short(e.updated_at),(0,j.jsx)("br",{}),v.x.Date.time(e.updated_at)]})]})}))}renderStatus(e){return(0,j.jsxs)("div",{children:[(0,j.jsx)(Mt.Z,{onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"enabled"===e.status}),(0,j.jsxs)("p",{children:[v.x.I18n.t("signups"),": ",e.signups.toLocaleString()]})]})}render(){return(0,j.jsxs)("div",{className:"mailpoet-listing-no-actions-on-mobile",children:[(0,j.jsx)(so,{}),(0,j.jsx)(x.N,{limit:window.mailpoet_listing_per_page,className:"mailpoet-forms-listing",location:this.props.location,params:this.props.match.params,messages:oo,search:!1,endpoint:"forms",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:io,bulk_actions:lo,item_actions:co})]})}}uo.propTypes={location:f().object.isRequired,match:f().shape({params:f().object}).isRequired};const po=Ia(uo);function mo(){return(0,j.jsx)(Ce.k.Provider,{value:(0,Ce.S)(window),children:(0,j.jsxs)(l.UT,{children:[(0,j.jsx)(Me.w,{}),(0,j.jsx)(c.Route,{path:"*",component:po})]})})}const ho=document.getElementById("forms_container");function fo(){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("p",{children:v.x.I18n.t("knowledgeBaseIntro")}),(0,j.jsxs)("ul",{className:"mailpoet-text-links",children:[(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/116-common-problems",children:"Common Problems"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/165-newsletters",children:"Newsletters"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/156-migration-questions",children:"Migration Questions"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/149-sending-methods",children:"Sending Methods"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/139-subscription-forms",children:"Subscription Forms"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/114-getting-started",children:"Getting Started"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/123-newsletter-designer",children:"Newsletter Designer"})}),(0,j.jsx)("li",{children:(0,j.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/121-subscribers-and-lists",children:"Subscribers and Lists"})})]}),(0,j.jsx)(O.z,{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/",children:v.x.I18n.t("knowledgeBaseButton")})]})}function go(e){e.target.select()}function xo(e){if(_.ZP.isObject(e)){const t=Object.keys(e).map((t=>`${t}: ${e[t]}`));return(0,j.jsx)("textarea",{readOnly:!0,onFocus:go,value:t.join("\n"),style:{width:"100%",height:"400px"}})}return(0,j.jsx)("p",{children:v.x.I18n.t("systemInfoDataError")})}function vo(){const e=window.systemInfoData;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,j.jsx)("p",{children:v.x.I18n.t("systemInfoIntro")})}),xo(e)]})}function bo(e){return(0,j.jsx)("table",{className:"widefat fixed",style:{maxWidth:e.max_width},children:(0,j.jsx)("tbody",{children:e.rows.map((e=>(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{className:"row-title",children:e.key}),(0,j.jsx)("td",{children:e.value})]},`row_${e.key}`)))})})}function yo(e){return(0,j.jsx)("span",{children:!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown})}function wo(e){const t=e.status_data,n={active:v.x.I18n.t("running"),inactive:v.x.I18n.t("cronWaiting")},r=Array.isArray(t.last_error)?(0,j.jsx)(j.Fragment,{children:t.last_error.map((e=>(0,j.jsxs)("div",{children:[e.worker,": ",(0,j.jsx)("i",{children:e.message})]},e.worker)))}):t.last_error;return(0,j.jsxs)("div",{children:[(0,j.jsx)("h4",{children:v.x.I18n.t("systemStatusCronStatusTitle")}),(0,j.jsx)(bo,{max_width:"400px",rows:[{key:v.x.I18n.t("accessible"),value:(0,j.jsx)(yo,{children:t.accessible})},{key:v.x.I18n.t("status"),value:n[t.status]?n[t.status]:v.x.I18n.t("unknown")},{key:v.x.I18n.t("lastUpdated"),value:t.updated_at?v.x.Date.full(1e3*t.updated_at):v.x.I18n.t("unknown")},{key:v.x.I18n.t("lastRunStarted"),value:t.run_accessed_at?v.x.Date.full(1e3*t.run_started_at):v.x.I18n.t("unknown")},{key:v.x.I18n.t("lastRunCompleted"),value:t.run_completed_at?v.x.Date.full(1e3*t.run_completed_at):v.x.I18n.t("unknown")},{key:v.x.I18n.t("lastSeenError"),value:r||v.x.I18n.t("none")},{key:v.x.I18n.t("lastSeenErrorDate"),value:t.last_error_date?v.x.Date.full(1e3*t.last_error_date):v.x.I18n.t("unknown")}]})]})}function _o(e){let t=e.task.scheduled_at;t&&(t=(0,cr.default)(t,"yyyy-MM-dd HH:mm:ss",new Date));const n=(0,cr.default)(e.task.updated_at,"yyyy-MM-dd HH:mm:ss",new Date);return(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{className:"column column-primary",children:e.task.id}),(0,j.jsx)("td",{className:"column",children:e.task.type}),(0,j.jsx)("td",{className:"column",children:e.task.newsletter?(0,j.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||v.x.I18n.t("preview")}):v.x.I18n.t("none")}),(0,j.jsx)("td",{className:"column",children:e.task.priority}),e.show_scheduled_at?(0,j.jsx)("td",{className:"column-date",children:(0,j.jsx)("abbr",{children:`${v.x.Date.short(t)} ${v.x.Date.time(t)}`})}):null,(0,j.jsx)("td",{className:"column-date",children:(0,j.jsx)("abbr",{children:`${v.x.Date.short(n)} ${v.x.Date.time(n)}`})})]})}function jo(e){return(0,j.jsxs)("tr",{children:[(0,j.jsx)("th",{className:"row-title",children:"Id"}),(0,j.jsx)("th",{className:"row-title",children:v.x.I18n.t("type")}),(0,j.jsx)("th",{className:"row-title",children:v.x.I18n.t("email")}),(0,j.jsx)("th",{className:"row-title",children:v.x.I18n.t("priority")}),e.show_scheduled_at?(0,j.jsx)("th",{className:"row-title",children:v.x.I18n.t("scheduledAt")}):null,(0,j.jsx)("th",{className:"row-title",children:v.x.I18n.t("updatedAt")})]})}function Io(e){const t=e.show_scheduled_at?6:5;return(0,j.jsxs)("table",{className:"widefat fixed striped",children:[(0,j.jsx)("thead",{children:(0,j.jsx)(jo,{show_scheduled_at:e.show_scheduled_at})}),(0,j.jsx)("tbody",{children:e.tasks.length?e.tasks.map((t=>(0,j.jsx)(_o,{task:t,show_scheduled_at:e.show_scheduled_at},t.id))):(0,j.jsx)("tr",{className:"mailpoet-listing-no-items",children:(0,j.jsx)("td",{colSpan:t,children:v.x.I18n.t("nothingToShow")})})}),(0,j.jsx)("tfoot",{children:(0,j.jsx)(jo,{show_scheduled_at:e.show_scheduled_at})})]})}function So(e){const t=e.status_data;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h4",{children:v.x.I18n.t("systemStatusQueueTitle")}),(0,j.jsx)(bo,{max_width:"400px",rows:[{key:v.x.I18n.t("status"),value:"paused"===t.status?v.x.I18n.t("paused"):v.x.I18n.t("running")},{key:v.x.I18n.t("startedAt"),value:t.started?v.x.Date.full(1e3*t.started):v.x.I18n.t("unknown")},{key:v.x.I18n.t("sentEmails"),value:t.sent||0},{key:v.x.I18n.t("retryAttempt"),value:t.retry_attempt||v.x.I18n.t("none")},{key:v.x.I18n.t("retryAt"),value:t.retry_at?v.x.Date.full(1e3*t.retry_at):v.x.I18n.t("none")},{key:v.x.I18n.t("error"),value:t.error?t.error.error_message:v.x.I18n.t("none")},{key:v.x.I18n.t("totalCompletedTasks"),value:t.tasksStatusCounts.completed},{key:v.x.I18n.t("totalRunningTasks"),value:t.tasksStatusCounts.running},{key:v.x.I18n.t("totalPausedTasks"),value:t.tasksStatusCounts.paused},{key:v.x.I18n.t("totalScheduledTasks"),value:t.tasksStatusCounts.scheduled}]}),(0,j.jsx)("h5",{children:v.x.I18n.t("scheduledTasks")}),(0,j.jsx)(Io,{show_scheduled_at:!0,tasks:t.latestTasks.filter((e=>"scheduled"===e.status))}),(0,j.jsx)("h5",{children:v.x.I18n.t("runningTasks")}),(0,j.jsx)(Io,{tasks:t.latestTasks.filter((e=>null===e.status))}),(0,j.jsx)("h5",{children:v.x.I18n.t("completedTasks")}),(0,j.jsx)(Io,{tasks:t.latestTasks.filter((e=>"completed"===e.status))})]})}function Co(e,t,n,r,a,s){const i=e?"success":"error";let o=e?t:n;return r&&(o=C()(o,/\[link\](.*?)\[\/link\]/g,(e=>(0,j.jsx)("a",{className:"mailpoet-text-link",href:r,"data-beacon-article":a,children:e},"kb-link")))),(0,j.jsxs)("div",{className:`mailpoet_notice notice inline notice-${i}`,children:[(0,j.jsx)("p",{children:o}),s?(0,j.jsx)("p",{children:(0,j.jsx)("i",{children:s})}):null]})}function To(e){const t=e.cron.isReachable,n=e.cron.url,r=`${v.x.I18n.t("systemStatusConnectionUnsuccessful")} ${v.x.I18n.t("systemStatusCronConnectionUnsuccessfulInfo")}`,a=v.x.I18n.t("systemStatusConnectionSuccessful"),s=t?null:e.cron.pingResponse;return(0,j.jsxs)("div",{children:[(0,j.jsx)("h4",{children:v.x.I18n.t("systemStatusCronTitle")}),(0,j.jsx)("p",{children:(0,j.jsx)("a",{className:"mailpoet-text-link",href:n,target:"_blank",rel:"noopener noreferrer",children:n})}),Co(t,a,r,"https://kb.mailpoet.com/article/231-sending-does-not-work","5a0257ac2c7d3a272c0d7ad6",s)]})}function ko(e){const t=e.mss.enabled?`${v.x.I18n.t("systemStatusConnectionUnsuccessful")} ${v.x.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo")}`:v.x.I18n.t("systemStatusMSSConnectionCanNotConnect"),n=e.mss.enabled?v.x.I18n.t("systemStatusConnectionSuccessful"):v.x.I18n.t("systemStatusMSSConnectionCanConnect");return(0,j.jsxs)("div",{children:[(0,j.jsx)("h4",{children:v.x.I18n.t("systemStatusMSSTitle")}),Co(e.mss.isReachable,n,t,"https://kb.mailpoet.com/article/319-known-errors-when-validating-a-mailpoet-key","5ef1da9d2c7d3a10cba966c5",null)]})}function No(){const e=window.systemStatusData;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet_notice notice inline",children:(0,j.jsx)("p",{children:e.mss.enabled?v.x.I18n.t("systemStatusIntroCronMSS"):v.x.I18n.t("systemStatusIntroCron")})}),To(e),ko(e),(0,j.jsx)(wo,{status_data:e.cronStatus}),(0,j.jsx)(So,{status_data:e.queueStatus})]})}function Do(){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("p",{children:v.x.I18n.t("yourPrivacyContent1")}),(0,j.jsx)("p",{children:v.x.I18n.t("yourPrivacyContent2")}),(0,j.jsx)("p",{children:v.x.I18n.t("yourPrivacyContent3")}),(0,j.jsx)(O.z,{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/",children:v.x.I18n.t("yourPrivacyButton")})]})}function Eo(){return(0,j.jsxs)(Ce.k.Provider,{value:(0,Ce.S)(window),children:[(0,j.jsx)(F.D,{}),(0,j.jsx)(Me.w,{}),(0,j.jsxs)(xa.t,{activeKey:"knowledgeBase",children:[(0,j.jsx)(g.Tab,{title:v.x.I18n.t("tabKnowledgeBaseTitle"),children:(0,j.jsx)(fo,{})},"knowledgeBase"),(0,j.jsx)(g.Tab,{title:v.x.I18n.t("tabSystemStatusTitle"),children:(0,j.jsx)(No,{})},"systemStatus"),(0,j.jsx)(g.Tab,{title:v.x.I18n.t("tabSystemInfoTitle"),children:(0,j.jsx)(vo,{})},"systemInfo"),(0,j.jsx)(g.Tab,{title:v.x.I18n.t("tabYourPrivacyTitle"),children:(0,j.jsx)(Do,{})},"yourPrivacy")]})]})}ho&&o().render((0,j.jsx)(mo,{}),ho),bo.propTypes={max_width:f().string,rows:f().arrayOf(f().shape({key:f().string.isRequired,value:f().oneOfType([f().string,f().number,f().element]).isRequired})).isRequired},bo.defaultProps={max_width:"auto"},yo.propTypes={truthy:f().string,falsy:f().string,unknown:f().string,children:f().bool},yo.defaultProps={truthy:v.x.I18n.t("yes"),falsy:v.x.I18n.t("no"),unknown:v.x.I18n.t("unknown"),children:null},wo.propTypes={status_data:f().shape({accessible:f().bool,last_error_date:f().string,status:f().string,updated_at:f().number,run_accessed_at:f().number,run_completed_at:f().number,run_started_at:f().number,last_error:f().oneOfType([f().string,f().array])}).isRequired},_o.propTypes={show_scheduled_at:f().bool,task:f().shape({id:f().number.isRequired,type:f().string.isRequired,priority:f().number.isRequired,updated_at:f().string.isRequired,scheduled_at:f().string,status:f().string,newsletter:f().shape({newsletter_id:f().number.isRequired,queue_id:f().number.isRequired,preview_url:f().string.isRequired,subject:f().string})}).isRequired},_o.defaultProps={show_scheduled_at:!1},jo.propTypes={show_scheduled_at:f().bool},jo.defaultProps={show_scheduled_at:!1},Io.propTypes={show_scheduled_at:f().bool,tasks:f().arrayOf(_o.propTypes.task).isRequired},Io.defaultProps={show_scheduled_at:!1},So.propTypes={status_data:f().shape({status:f().string,started:f().number,sent:f().number,retry_attempt:f().number,retry_at:f().number,error:f().shape({operation:f().string,error_message:f().string}),tasksStatusCounts:f().shape({completed:f().number.isRequired,running:f().number.isRequired,paused:f().number.isRequired,scheduled:f().number.isRequired}).isRequired,latestTasks:f().arrayOf(_o.propTypes.task).isRequired}).isRequired};const Oo=document.getElementById("help_container");Oo&&o().render((0,j.jsx)(Eo,{}),Oo);const Ro=(0,c.withRouter)((function(e){let{children:t,location:{pathname:n}}=e;return(0,w.useEffect)((()=>{window.scrollTo(0,0)}),[n]),t||null}));function Ao(e){let{activeMethod:t,onMethodChange:n}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,j.jsx)("span",{className:"mailpoet_import_heading",children:v.x.I18n.t("methodSelectionHead")}),(0,j.jsx)("div",{className:"mailpoet-settings-inputs-row",children:(0,j.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,j.jsx)(ke.V,{dimension:"large",variant:"excellent",isInverted:!0,children:v.x.I18n.t("seeVideo")})})})]}),(0,j.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,j.jsx)(oe.Y,{name:"select_method",automationId:"import-paste-method",id:"import-paste-method",checked:"paste-method"===t,value:"paste-method",onCheck:n}),(0,j.jsx)("label",{htmlFor:"import-paste-method",children:v.x.I18n.t("methodPaste")})]}),(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,j.jsx)(oe.Y,{name:"select_method",automationId:"import-csv-method",id:"import-csv-method",checked:"file-method"===t,value:"file-method",onCheck:n}),(0,j.jsx)("label",{htmlFor:"import-csv-method",children:v.x.I18n.t("methodUpload")})]}),(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,j.jsx)(oe.Y,{name:"select_method",automationId:"import-mailchimp-method",id:"import-mailchimp-method",checked:"mailchimp-method"===t,value:"mailchimp-method",onCheck:n}),(0,j.jsx)("label",{htmlFor:"import-mailchimp-method",children:v.x.I18n.t("methodMailChimp")})]})]})]})}function Po(e){let{hidePrevious:t,isLastStep:n,canGoNext:r,onPreviousAction:a,onNextAction:s}=e;return(0,j.jsxs)("div",{className:"mailpoet-settings-save",children:[!t&&(0,j.jsx)(O.z,{type:"button",variant:"secondary",onClick:a,children:v.x.I18n.t("previousStep")}),(0,j.jsx)(O.z,{type:"button",automationId:"import-next-step",isDisabled:!r,onClick:()=>{r&&s()},children:v.x.I18n.t(n?"import":"nextStep")})]})}function Mo(e){let{onValueChange:t,canFinish:n,onFinish:r,data:a,onPrevious:s}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,j.jsx)("label",{htmlFor:"paste_input",children:v.x.I18n.t("pasteLabel")}),(0,j.jsx)("p",{className:"description",children:C()(v.x.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,j.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,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsx)(re.g,{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,j.jsx)(Po,{canGoNext:n,onPreviousAction:s,onNextAction:r})]})}function Lo(e){let{onValueChange:t,canFinish:n,onFinish:r,onPrevious:a}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,j.jsx)("label",{htmlFor:"file_local",children:v.x.I18n.t("methodUpload")}),(0,j.jsx)("p",{className:"description",children:C()(v.x.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,j.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,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsx)(te.I,{type:"file",id:"file_local",accept:".csv","data-automation-id":"import-file-upload-input",onChange:e=>{const n=e.target.value.match(/[^.]+$/);v.x.Notice.hide(),null===n||"csv"!==n[0].toLowerCase()?(v.x.Notice.error(v.x.I18n.t("wrongFileFormat")),t("")):t(e.target.files[0])}})}),(0,j.jsx)(Po,{canGoNext:n,onPreviousAction:a,onNextAction:r})]})}function Fo(e){let{onFinish:t,onPrevious:n}=e;const[r,a]=(0,w.useState)(""),[s,i]=(0,w.useState)(void 0),[o,l]=(0,w.useState)([]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet-settings-label",children:(0,j.jsxs)("label",{htmlFor:"mailpoet_mailchimp_key_input",children:[(0,j.jsx)("span",{className:"mailpoet_import_heading",children:v.x.I18n.t("methodMailChimpLabel")}),(0,j.jsx)("p",{className:"description",children:C()(v.x.I18n.t("methodMailChimpDescription"),/\[link\](.*?)\[\/link\]/,(e=>(0,j.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,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,j.jsx)(te.I,{dimension:"small",id:"mailpoet_mailchimp_key_input",type:"text",onChange:e=>{a(e.target.value),""===e.target.value.trim()&&i(void 0)}}),(0,j.jsx)("span",{className:"mailpoet-gap"}),(0,j.jsx)(O.z,{type:"button",dimension:"small",onClick:()=>{v.x.Modal.loading(!0),v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpLists",data:{api_key:r}}).always((()=>{v.x.Modal.loading(!1)})).done((e=>i(e.data))).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},children:v.x.I18n.t("methodMailChimpVerify")}),(0,j.jsx)("span",{className:"mailpoet-gap"}),(0,j.jsx)("span",{children:Array.isArray(s)&&0===s.length?v.x.I18n.t("noMailChimpLists"):null})]})}),s?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet-settings-label",children:v.x.I18n.t("methodMailChimpSelectList")}),(0,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsx)(I,{field:{id:"segments",name:"list-selection",multiple:!0,placeholder:v.x.I18n.t("methodMailChimpSelectPlaceholder"),forceSelect2:!0,values:s},onValueChange:e=>l(e.target.value)})})]}):null,(0,j.jsx)(Po,{canGoNext:Array.isArray(o)&&o.length>0,onPreviousAction:n,onNextAction:()=>{v.x.Modal.loading(!0),v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:r,lists:o}}).always((()=>{v.x.Modal.loading(!1)})).done((e=>t(e.data))).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}})]})}Ao.propTypes={activeMethod:f().string,onMethodChange:f().func.isRequired},Ao.defaultProps={activeMethod:void 0},Po.propTypes={canGoNext:f().bool,hidePrevious:f().bool,isLastStep:f().bool,onPreviousAction:f().func,onNextAction:f().func},Po.defaultProps={hidePrevious:!1,isLastStep:!1,canGoNext:!0,onPreviousAction:()=>{},onNextAction:()=>{}},Mo.propTypes={onFinish:f().func,onPrevious:f().func,canFinish:f().bool.isRequired,onValueChange:f().func.isRequired,data:f().string},Mo.defaultProps={onFinish:()=>{},onPrevious:()=>{},data:""},Lo.propTypes={canFinish:f().bool.isRequired,onFinish:f().func,onPrevious:f().func,onValueChange:f().func.isRequired},Lo.defaultProps={onFinish:()=>{},onPrevious:()=>{}},Fo.propTypes={onFinish:f().func,onPrevious:f().func},Fo.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var qo=n(57460),$o=n.n(qo);const Uo=e=>window.roleBasedEmails.findIndex((t=>e.startsWith(`${t}@`)))>=0,Zo=e=>{let t,n=_.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)&&!Uo(n)&&n};function Vo(e){let{history:t,setStepMethodSelectionData:n,subscribersLimitForValidation:r}=e;const[a,s]=(0,w.useState)(void 0),[i,o]=(0,w.useState)(""),[l,c]=(0,w.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")},p=()=>{((e,t)=>{const n=encodeURI(e).split(/%..|./).length-1;v.x.Notice.hide(),n>window.maxPostSizeBytes?v.x.Notice.error(v.x.I18n.t("maxPostSizeNotice")):(v.x.Modal.loading(!0),$o().parse(e,function(e){return{skipEmptyLines:!0,error(){v.x.Notice.hide(),v.x.Notice.error(v.x.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=Zo(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=Zo(l[d]),_.ZP.has(n,i)?r.push(i):Uo(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=_.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:_.ZP.uniq(r),invalid:_.ZP.uniq(a),role:_.ZP.uniq(s)}:null}(t.data);if(n)e(n);else{let e=v.x.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>"),v.x.Notice.error(e)}v.x.Modal.loading(!1)}}}((e=>{v.x.trackEvent("Subscribers import started",{source:"file-method"===a?"file upload":"pasted data"}),d(e)}))))})("paste-method"===a?i:l)};return(0,j.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,j.jsx)(Ao,{activeMethod:a,onMethodChange:s}),"paste-method"===a&&(0,j.jsx)(Mo,{onPrevious:u,onValueChange:o,onFinish:p,canFinish:!!i.trim(),data:i}),"file-method"===a&&(0,j.jsx)(Lo,{onPrevious:u,onValueChange:c,onFinish:p,canFinish:!!l,data:l}),"mailchimp-method"===a&&(0,j.jsx)(Fo,{onPrevious:u,onFinish:e=>{v.x.trackEvent("Subscribers import started",{source:"MailChimp"}),d(e)}}),void 0===a&&(0,j.jsx)(Po,{canGoNext:!1,onPreviousAction:u})]})}Vo.propTypes={history:f().shape({push:f().func.isRequired}).isRequired,setStepMethodSelectionData:f().func.isRequired,subscribersLimitForValidation:f().number.isRequired};const Wo=(0,c.withRouter)(Vo);function Yo(e){let{onProceed:t}=e;return(0,j.jsxs)("div",{className:"mailpoet-clean-list-step-container",children:[(0,j.jsx)("p",{children:v.x.I18n.t("cleanListText1")}),(0,j.jsx)("p",{children:v.x.I18n.t("cleanListText2")}),(0,j.jsxs)("p",{children:[t&&(0,j.jsx)(O.z,{onClick:t,variant:"tertiary",children:v.x.I18n.t("listCleaningGotIt")}),(0,j.jsx)(O.z,{target:"_blank",href:"https://kb.mailpoet.com/article/287-list-cleaning-services",children:v.x.I18n.t("tryListCleaning")})]})]})}function Bo(e){let{onSubmit:t,history:n}=e;const[r,a]=(0,w.useState)(void 0);return(0,j.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,j.jsx)("div",{className:"mailpoet-settings-label",children:v.x.I18n.t("validationStepHeading")}),(0,j.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,j.jsx)(oe.Y,{automationId:"mailpoet_import_validation_step_option1",id:"existing-list",checked:"existing-list"===r,value:"existing-list",onCheck:a}),(0,j.jsx)("label",{htmlFor:"existing-list",children:v.x.I18n.t("validationStepRadio1")})]}),(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row",children:[(0,j.jsx)(oe.Y,{automationId:"mailpoet_import_validation_step_option2",id:"address-book",checked:"address-book"===r,value:"address-book",onCheck:a}),(0,j.jsx)("label",{htmlFor:"address-book",children:v.x.I18n.t("validationStepRadio2")})]})]}),(0,j.jsx)(Po,{canGoNext:void 0!==r,onPreviousAction:()=>n.push("step_method_selection"),onNextAction:()=>t(r)})]})}function Ho(){return(0,j.jsxs)("div",{className:"mailpoet-clean-list-step-container","data-automation-id":"import_wrong_source_block",children:[(0,j.jsx)("p",{children:v.x.I18n.t("validationStepBlock1")}),(0,j.jsx)("p",{children:v.x.I18n.t("validationStepBlock2")}),(0,j.jsx)("p",{children:(0,j.jsx)(O.z,{href:"https://kb.mailpoet.com/article/269-reconfirm-subscribers-to-your-list",target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("validationStepBlockButton")})})]})}function zo(e){let{onSubmit:t}=e;const[n,r]=(0,w.useState)("over2years"),a=(0,w.useCallback)((e=>{r(e.target.value)}),[r]),s=(0,w.useCallback)((()=>{t("over2years"===n||"1to2years"===n?"notRecently":"recently")}),[t,n]);return(0,j.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,j.jsx)("div",{className:"mailpoet-settings-label",children:v.x.I18n.t("validationStepLastSentHeading")}),(0,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsxs)(se.P,{defaultValue:n,onChange:a,automationId:"last_sent_to_list",children:[(0,j.jsx)("option",{value:"over2years",children:v.x.I18n.t("validationStepLastSentOption1")}),(0,j.jsx)("option",{value:"1to2years",children:v.x.I18n.t("validationStepLastSentOption2")}),(0,j.jsx)("option",{value:"less1year",children:v.x.I18n.t("validationStepLastSentOption3")}),(0,j.jsx)("option",{value:"less3months",children:v.x.I18n.t("validationStepLastSentOption4")})]})}),(0,j.jsx)("div",{className:"mailpoet-settings-save",children:(0,j.jsx)(O.z,{type:"button",automationId:"last_sent_to_list_next",onClick:s,children:v.x.I18n.t("validationStepLastSentNext")})})]})}function Ko(e){let{stepMethodSelectionData:t,history:n}=e;const[r,a]=(0,w.useState)(void 0),[s,i]=(0,w.useState)(void 0);(0,w.useEffect)((()=>{void 0===t&&n.replace("step_method_selection")}),[t,n]);const o=(0,w.useCallback)((e=>{i(e),"recently"===e&&n.push("step_data_manipulation")}),[n,i]);return(0,j.jsxs)(j.Fragment,{children:[void 0===r&&(0,j.jsx)(Bo,{onSubmit:a,history:n}),"address-book"===r&&(0,j.jsx)(Ho,{}),"existing-list"===r&&void 0===s&&(0,j.jsx)(zo,{onSubmit:o}),"existing-list"===r&&"notRecently"===s&&(0,j.jsx)(Yo,{})]})}Bo.propTypes={history:f().shape({push:f().func.isRequired}).isRequired,onSubmit:f().func.isRequired},zo.propTypes={onSubmit:f().func.isRequired},Ko.propTypes={history:f().shape({push:f().func.isRequired,replace:f().func.isRequired}).isRequired,stepMethodSelectionData:f().shape({duplicate:f().arrayOf(f().string),header:f().arrayOf(f().string),invalid:f().arrayOf(f().string),role:f().arrayOf(f().string),subscribersCount:f().number,subscribers:f().arrayOf(f().arrayOf(f().string))})},Ko.defaultProps={stepMethodSelectionData:void 0};const Go=(0,c.withRouter)(Ko),Qo=e=>{let{translation:t,subscribers:n}=e,r="";return n.length&&(r=C()(t.replace("%2$s",n.join(", ")),"%1$s",(()=>(0,j.jsx)("strong",{children:n.length.toLocaleString()},t))),r=(0,j.jsx)("p",{children:r})),r};function Xo(e){let{stepMethodSelectionData:t}=e;const{invalid:n,duplicate:r,role:a}=t,[s,i]=(0,w.useState)(!1),o=u()("mailpoet_subscribers_data_parse_results_details",{mailpoet_hidden:!s}),l=(0,j.jsx)(Qo,{translation:v.x.I18n.t("importNoticeInvalid"),subscribers:n}),c=(0,j.jsx)(Qo,{translation:v.x.I18n.t("importNoticeDuplicate"),subscribers:r});let d="";if(a.length&&(d=C()(v.x.I18n.t("importNoticeRoleBased"),/(%1\$s|\[link\].*\[\/link\]|%2\$s)/,(e=>"%1$s"===e?(0,j.jsx)("strong",{children:a.length.toLocaleString()},"role-length"):"%2$s"===e?a.join(", "):(0,j.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,j.jsx)("p",{children:d})),n.length||r.length||a.length){const e=n.length+r.length+a.length;return(0,j.jsxs)("div",{className:"error",children:[(0,j.jsxs)("p",{children:[C()(v.x.I18n.t("importNoticeSkipped"),"%1$s",(()=>(0,j.jsx)("strong",{children:e.toLocaleString()},"lengths")))," ",(0,j.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:v.x.I18n.t("showMoreDetails")})]}),(0,j.jsxs)("div",{className:o,children:[(0,j.jsx)("hr",{}),l,c,d]})]})}return null}function Jo(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,j.jsxs)("tr",{children:[(0,j.jsx)("th",{children:v.x.I18n.t("matchData")}),r.map(((e,t)=>(0,j.jsx)("th",{children:(0,j.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 el(e){let{header:t}=e;return(0,j.jsxs)("tr",{className:"mailpoet_header",children:[(0,j.jsx)("td",{}),t.map((e=>(0,j.jsx)("td",{children:e},e)))]})}function tl(e){let{subscriber:t,index:n}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("td",{children:n}),t.map(((e,t)=>(0,j.jsx)("td",{children:e},`${e}-${n}-${t}`)))]})}function nl(e){let{subscribers:t,subscribersCount:n}=e;const r=". . .",a=Array(t[0].length).fill(r);return(0,j.jsxs)(j.Fragment,{children:[t.slice(0,10).map(((e,t)=>(0,j.jsx)("tr",{children:(0,j.jsx)(tl,{subscriber:e,index:t+1})},`${e[0]}-${t}`))),n>11?(0,j.jsx)("tr",{children:(0,j.jsx)(tl,{subscriber:a,index:r})},"filler"):null,n>10?(0,j.jsx)("tr",{children:(0,j.jsx)(tl,{subscriber:t[n-1],index:n})},t[n-1][0]):null]})}function rl(e){let{subscribersCount:t,subscribers:n,header:r}=e;return(0,w.useLayoutEffect)((()=>{(()=>{const e={data:window.mailpoetColumnsSelect2,width:"15em"};m()("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(),m()(n).select2("close"),v.x.Modal.popup({title:v.x.I18n.t("addNewField"),template:m()("#form_template_field_form").html()}),m()("#form_field_new").parsley().on("form:submit",(()=>{const t=m()("#form_field_new").mailpoetSerializeObject();return v.x.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:v.x.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(r),window.mailpoetColumns.push(r),m()("select.mailpoet_subscribers_column_data_match").each((()=>{m()(n).html("").select2("destroy").select2(e)})),m()(n).data("column-id",r.id),v.x.Modal.close()})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#field_name"})})),!1}))):m()("select.mailpoet_subscribers_column_data_match").each((()=>{const e=n,a=m()(e).val();a===r&&"ignore"!==a&&(confirm(`${v.x.I18n.t("selectedValueAlreadyMatched")} ${v.x.I18n.t("confirmCorrespondingColumn")}`)?m()(e).data("column-id","ignore"):(t.preventDefault(),m()(n).select2("close")))}))})).on("select2:select",(e=>{const t=e.currentTarget,n=e.params.data.id;m()(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()})),m().map(m()(".mailpoet_subscribers_column_data_match"),(e=>{const t=m()(e).data("column-id");m()(e).val(t).trigger("change")}))})()})),(0,j.jsx)("div",{className:"subscribers_data",children:(0,j.jsxs)("table",{className:"mailpoet_subscribers widefat fixed",children:[(0,j.jsx)("thead",{children:(0,j.jsx)(Jo,{header:r,subscribers:n})}),(0,j.jsxs)("tbody",{children:[r?(0,j.jsx)(el,{header:r}):null,(0,j.jsx)(nl,{subscribers:n,subscribersCount:t})]})]})})}function al(e){let{setSelectedSegments:t}=e;const{segments:n}=(0,w.useContext)(Ce.k),{all:r,updateAll:a}=n,[s,i]=(0,w.useState)(r);(0,w.useLayoutEffect)((()=>{!function(e,n){const r=m()("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=m()('[data-id="notice_segmentSelection"]');e.currentTarget.value?m()('[data-id="notice_segmentSelection"]').remove():n.length||v.x.Notice.error(v.x.I18n.t("segmentSelectionRequired"),{static:!0,scroll:!0,id:"notice_segmentSelection",hideClose:!0});(e=>{t(e)})(_.ZP.pluck(r.select2("data"),"id"))}))}(s)}),[s,t]);const o=e=>{!function(){const e=m()("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,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet-settings-label",children:(0,j.jsxs)("label",{htmlFor:"mailpoet_segments_select",children:[v.x.I18n.t("pickLists"),(0,j.jsx)("p",{className:"description",children:v.x.I18n.t("pickListsDescription")})]})}),(0,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,j.jsx)("div",{className:"mailpoet-form-select mailpoet-form-input",children:(0,j.jsx)("select",{id:"mailpoet_segments_select","data-placeholder":v.x.I18n.t("select"),multiple:"multiple",children:(0,j.jsx)("option",{})})}),(0,j.jsx)(O.z,{variant:"tertiary",onClick:()=>{return e=o,v.x.Modal.popup({title:v.x.I18n.t("addNewList"),template:m()("#new_segment_template").html()}),m()("#new_segment_name").on("keypress",(e=>{13===e.which&&m()("#new_segment_process").trigger("click")})),m()("#new_segment_process").on("click",(()=>{const t=m()("#new_segment_name").val().trim(),n=m()("#new_segment_description").val().trim();v.x.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}),v.x.Modal.close()})).fail((e=>{e.errors.length>0&&(v.x.Notice.hide(),v.x.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#new_segment_name"}))}))})),void m()("#new_segment_cancel").on("click",(()=>{v.x.Modal.close()}));var e},children:v.x.I18n.t("createANewList")})]})})]})}function sl(){return(0,j.jsx)("p",{className:"description",children:C()(v.x.I18n.t("consentSubscribed"),/\[link](.*?)\[\/link]/,(e=>(0,j.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 il(e){let{newSubscribersStatus:t,setNewSubscribersStatus:n}=e;const r=(0,w.useCallback)((e=>{n(e.target.value)}),[n]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,j.jsx)("label",{htmlFor:"new_subscribers_status",children:v.x.I18n.t("newSubscribersStatus")}),(0,j.jsx)(sl,{})]}),(0,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsxs)(se.P,{id:"new_subscribers_status",placeholder:v.x.I18n.t("select"),name:"new_subscribers_status",onChange:r,defaultValue:t,children:[(0,j.jsx)("option",{value:"subscribed",children:v.x.I18n.t("subscribed")}),(0,j.jsx)("option",{value:"inactive",children:v.x.I18n.t("inactive")}),(0,j.jsx)("option",{value:"unsubscribed",children:v.x.I18n.t("unsubscribed")})]})})]})}function ol(e){let{existingSubscribersStatus:t,setExistingSubscribersStatus:n}=e;const r=(0,w.useCallback)((e=>{n(e.target.value)}),[n]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,j.jsx)("label",{htmlFor:"existing_subscribers_status",children:v.x.I18n.t("existingSubscribersStatus")}),(0,j.jsx)(sl,{})]}),(0,j.jsx)("div",{className:"mailpoet-settings-inputs",children:(0,j.jsxs)(se.P,{id:"existing_subscribers_status",placeholder:v.x.I18n.t("select"),name:"existing_subscribers_status",onChange:r,defaultValue:t,children:[(0,j.jsx)("option",{value:"dont_update",children:v.x.I18n.t("dontUpdate")}),(0,j.jsx)("option",{value:"subscribed",children:v.x.I18n.t("subscribed")}),(0,j.jsx)("option",{value:"inactive",children:v.x.I18n.t("inactive")}),(0,j.jsx)("option",{value:"unsubscribed",children:v.x.I18n.t("unsubscribed")})]})})]})}function ll(e){let{updateExistingSubscribers:t,setUpdateExistingSubscribers:n}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet-settings-label",children:v.x.I18n.t("updateExistingSubscribers")}),(0,j.jsxs)("div",{className:"mailpoet-settings-inputs",children:[(0,j.jsx)(oe.Y,{id:"update_existing_subscribers",name:"update_existing_subscribers",value:"1",checked:t,onCheck:()=>n(!0)}),(0,j.jsx)("label",{htmlFor:"update_existing_subscribers",children:v.x.I18n.t("updateExistingSubscribersYes")}),(0,j.jsx)("span",{className:"mailpoet-gap"}),(0,j.jsx)(oe.Y,{id:"dont_update_existing_subscribers",name:"update_existing_subscribers",value:"",checked:!t,onCheck:()=>n(!1)}),(0,j.jsx)("label",{htmlFor:"dont_update_existing_subscribers",children:v.x.I18n.t("updateExistingSubscribersNo")})]})]})}function cl(e){let{history:t,stepMethodSelectionData:n,subscribersLimitForValidation:r,setStepDataManipulationData:a}=e;const[s,i]=(0,w.useState)([]),[o,l]=(0,w.useState)(!0),[c,d]=(0,w.useState)("subscribed"),[u,p]=(0,w.useState)("dontUpdate");return(0,w.useEffect)((()=>{void 0===n&&t.replace("step_method_selection")}),[n,t]),void 0===n?null:(0,j.jsxs)("div",{"data-automation-id":"import_data_manipulation_step",children:[(0,j.jsx)(Xo,{stepMethodSelectionData:n}),(0,j.jsx)(rl,{subscribersCount:n.subscribersCount,subscribers:n.subscribers,header:n.header}),(0,j.jsxs)("div",{className:"mailpoet-settings-grid",children:[(0,j.jsx)(al,{setSelectedSegments:i}),(0,j.jsx)(il,{newSubscribersStatus:c,setNewSubscribersStatus:d}),(0,j.jsx)(ol,{existingSubscribersStatus:u,setExistingSubscribersStatus:p}),(0,j.jsx)(ll,{setUpdateExistingSubscribers:l,updateExistingSubscribers:o}),(0,j.jsx)(Po,{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(m().AsyncQueue);let d=0;const u=Date.now()/1e3,p={created:0,updated:0,errors:[],segments:[]};v.x.Modal.loading(!0);const h=(2e3,e.reduce(((e,t,n)=>(n%2e3==0&&e.push([]),e[e.length-1].push(t),e)),[]));_.ZP.each(m()("select.mailpoet_subscribers_column_data_match"),((e,t)=>{const n=m()(e).data("column-id");"ignore"!==n&&(l[n]={index:t})})),_.ZP.each(h,(()=>{c.add((e=>{e.pause(),v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processImport",data:JSON.stringify({columns:l,subscribers:h[d],timestamp:u,segments:n,newSubscribersStatus:r,existingSubscribersStatus:s,updateSubscribers:i})}).done((t=>{const n=t.data.added_to_segment_with_welcome_notification;p.created+=t.data.created,p.updated+=t.data.updated,p.segments=t.data.segments,p.added_to_segment_with_welcome_notification=n,e.run()})).fail((e=>{v.x.Modal.loading(!1),e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),d+=1}))})),c.run(),c.onComplete((()=>{v.x.Modal.loading(!1),p.errors.length>0&&!p.updated&&!p.created?v.x.Notice.error(_.ZP.flatten(p.errors)):(p.segments=_.ZP.map(_.ZP.filter(p.segments,(e=>n.includes(e.id))),(e=>e.name)),a(p),t.push("step_results"))}))})(n.subscribers,s,c,u,o)},isLastStep:!0})]})]})}Qo.propTypes={translation:f().string.isRequired,subscribers:f().arrayOf(f().string).isRequired},Xo.propTypes={stepMethodSelectionData:f().shape({duplicate:f().arrayOf(f().string),invalid:f().arrayOf(f().string),role:f().arrayOf(f().string)})},Xo.defaultProps={stepMethodSelectionData:{invalid:[],duplicate:[],role:[]}},Jo.propTypes={subscribers:f().arrayOf(f().arrayOf(f().oneOfType([f().string,f().number]))).isRequired,header:f().arrayOf(f().string)},Jo.defaultProps={header:[]},el.propTypes={header:f().arrayOf(f().string).isRequired},tl.propTypes={subscriber:f().arrayOf(f().oneOfType([f().string,f().number])).isRequired,index:f().node.isRequired},nl.propTypes={subscribersCount:f().number.isRequired,subscribers:f().arrayOf(f().arrayOf(f().oneOfType([f().string,f().number]))).isRequired},rl.propTypes={subscribersCount:f().number,subscribers:f().arrayOf(f().arrayOf(f().oneOfType([f().string,f().number]))),header:f().arrayOf(f().string)},rl.defaultProps={subscribersCount:0,subscribers:[],header:[]},al.propTypes={setSelectedSegments:f().func.isRequired},ll.propTypes={setUpdateExistingSubscribers:f().func.isRequired,updateExistingSubscribers:f().bool.isRequired},n(49868),cl.propTypes={history:f().shape({push:f().func.isRequired,replace:f().func.isRequired}).isRequired,stepMethodSelectionData:f().shape({duplicate:f().arrayOf(f().string),header:f().arrayOf(f().string),invalid:f().arrayOf(f().string),role:f().arrayOf(f().string),subscribersCount:f().number,subscribers:f().arrayOf(f().arrayOf(f().oneOfType([f().string,f().number])))}),subscribersLimitForValidation:f().number.isRequired,setStepDataManipulationData:f().func.isRequired},cl.defaultProps={stepMethodSelectionData:void 0};const dl=(0,c.withRouter)(cl);function ul(e){let{subscribersCount:t,segments:n,initialMessage:r}=e;if(t){let e=C()(r,"%1$s",(()=>(0,j.jsx)("strong",{children:t.toLocaleString()},"%1$s")));return e=C()(e,"%2$s",(()=>`"${n.join('", "')}"`)),(0,j.jsx)("p",{children:e})}return null}function pl(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?null:(0,j.jsx)("p",{children:v.x.I18n.t("importNoAction")})}function ml(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("p",{children:(0,j.jsx)("b",{children:v.x.I18n.t("congratulationResult")})}),(0,j.jsx)("p",{children:C()(v.x.I18n.t("suppressionListReminder"),/\[link](.*?)\[\/link]/,(e=>(0,j.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 hl(e){let{addedToSegmentWithWelcomeNotification:t}=e;return t?(0,j.jsx)("p",{children:v.x.I18n.t("importNoWelcomeEmail")}):null}function fl(e){let{errors:t,createdSubscribers:n,updatedSubscribers:r,segments:a,addedToSegmentWithWelcomeNotification:s,history:i}=e;return(0,w.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&&v.x.Notice.error(_.ZP.flatten(t)),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"updated",children:[(0,j.jsx)(ul,{subscribersCount:n,segments:a,initialMessage:v.x.I18n.t("subscribersCreated")}),(0,j.jsx)(ul,{subscribersCount:r,segments:a,initialMessage:v.x.I18n.t("subscribersUpdated")}),(0,j.jsx)(pl,{createdSubscribers:n,updatedSubscribers:r}),(0,j.jsx)(hl,{addedToSegmentWithWelcomeNotification:s})]}),(0,j.jsx)(ml,{createdSubscribers:n,updatedSubscribers:r}),(0,j.jsx)("div",{className:"mailpoet-settings-grid",children:(0,j.jsxs)("div",{className:"mailpoet-settings-save",children:[(0,j.jsx)(O.z,{variant:"secondary",type:"button",onClick:()=>i.push("step_method_selection"),children:v.x.I18n.t("importAgain")}),(0,j.jsx)(O.z,{type:"button",onClick:()=>{window.location.href="admin.php?page=mailpoet-subscribers"},children:v.x.I18n.t("viewSubscribers")})]})})]})}ul.propTypes={segments:f().arrayOf(f().string.isRequired),subscribersCount:f().number,initialMessage:f().string},ul.defaultProps={segments:[],subscribersCount:0,initialMessage:""},pl.propTypes={createdSubscribers:f().number,updatedSubscribers:f().number},pl.defaultProps={createdSubscribers:0,updatedSubscribers:0},ml.propTypes={createdSubscribers:f().number,updatedSubscribers:f().number},ml.defaultProps={createdSubscribers:0,updatedSubscribers:0},hl.propTypes={addedToSegmentWithWelcomeNotification:f().bool},hl.defaultProps={addedToSegmentWithWelcomeNotification:!1},fl.propTypes={history:f().shape({push:f().func.isRequired,replace:f().func.isRequired}).isRequired,errors:f().arrayOf(f().string.isRequired),segments:f().arrayOf(f().string.isRequired),createdSubscribers:f().number,updatedSubscribers:f().number,addedToSegmentWithWelcomeNotification:f().bool},fl.defaultProps={errors:[],segments:void 0,createdSubscribers:void 0,updatedSubscribers:void 0,addedToSegmentWithWelcomeNotification:void 0};const gl=(0,c.withRouter)(fl);function xl(e){let{history:t}=e;return(0,j.jsx)(Yo,{onProceed:()=>t.push("step_method_selection")})}const vl=document.getElementById("import_container");function bl(){const[e,t]=(0,w.useState)(void 0),[n,r]=(0,w.useState)({}),a=(0,Ce.S)(window);return(0,j.jsx)(Ce.k.Provider,{value:a,children:(0,j.jsxs)(l.UT,{children:[(0,j.jsx)(Me.w,{}),(0,j.jsx)(Ro,{children:(0,j.jsxs)(c.Switch,{children:[(0,j.jsx)(c.Route,{path:"/step_clean_list",render:e=>(0,j.jsx)(xl,{...e})}),(0,j.jsx)(c.Route,{path:"/step_method_selection",render:e=>(0,j.jsx)(Wo,{...e,setStepMethodSelectionData:t,subscribersLimitForValidation:100})}),(0,j.jsx)(c.Route,{path:"/step_input_validation",render:t=>(0,j.jsx)(Go,{...t,stepMethodSelectionData:e})}),(0,j.jsx)(c.Route,{path:"/step_data_manipulation",render:t=>(0,j.jsx)(dl,{...t,stepMethodSelectionData:e,subscribersLimitForValidation:100,setStepDataManipulationData:r})}),(0,j.jsx)(c.Route,{path:"/step_results",render:e=>(0,j.jsx)(gl,{...e,errors:n.errors,createdSubscribers:n.created,updatedSubscribers:n.updated,segments:n.segments,addedToSegmentWithWelcomeNotification:n.added_to_segment_with_welcome_notification})}),(0,j.jsx)(c.Route,{path:"*",render:()=>(0,j.jsx)(c.Redirect,{to:"/step_clean_list"})})]})})]})})}vl&&o().render((0,j.jsx)(bl,{}),vl);var yl=n(19675),wl=n.n(yl),_l=n(56692);function jl(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("welcomeWizardLetsStartTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("p",{children:v.x.I18n.t("welcomeWizardSenderText")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("form",{id:"mailpoet_sender_form",onSubmit:t=>{t.preventDefault(),m()("#mailpoet_sender_form").parsley().validate()&&e.submit_sender()},children:[(0,j.jsxs)(bt.r.TwoColumns,{children:[(0,j.jsxs)("label",{htmlFor:"senderName",children:[(0,j.jsx)("span",{className:"mailpoet-wizard-label",children:v.x.I18n.t("senderName")}),(0,j.jsx)(te.I,{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,j.jsxs)("label",{htmlFor:"senderAddress",children:[(0,j.jsx)("span",{className:"mailpoet-wizard-label",children:v.x.I18n.t("senderAddress")}),(0,j.jsx)(te.I,{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,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)(O.z,{isFullWidth:!0,type:"submit",withSpinner:e.loading,children:v.x.I18n.t("continue")}),(0,j.jsx)(O.z,{href:"#finish",isDisabled:e.loading,isFullWidth:!0,onClick:e.finish,variant:"tertiary",children:v.x.I18n.t("finishLater")})]})]})}function Il(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("welcomeWizardLetsStartTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("p",{children:v.x.I18n.t("welcomeWizardSenderMigratedUserText")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)(g.Button,{isFullWidth:!0,onClick:e.next,type:"button",children:v.x.I18n.t("continue")})]})}function Sl(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("welcomeWizardEmailCourseTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("p",{children:v.x.I18n.t("welcomeWizardEmailCourseText")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.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,j.jsx)(g.Button,{isFullWidth:!0,onClick:e.next,type:"button",children:v.x.I18n.t("continue")})]})}m()(document).ready((()=>{let e;if(!m()("#mailpoet_subscribers_export").length)return;if(!window.exportData.segments)return;const t=wl().compile(m()("#mailpoet_subscribers_export_template").html());function n(t){const n="mailpoet-disabled";"on"===t?e.removeClass(n):e.addClass(n)}m()("#mailpoet-export").html(t(window.exportData));const r=m()("#export_lists"),a=m()("#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;_.ZP.contains(r,n)&&(t.preventDefault(),"deselect"===n?m()(t.target).val("").trigger("change"):(a=[],_.ZP.each(e.find("option"),(e=>{const t=e.value;_.ZP.contains(r,t)||a.push(t)})),m()(t.target).val(a).trigger("change")),m()(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=m()("#mailpoet-export-button"),window.segments.forEach((e=>{r.append(m()("<option></option>").attr("value",e.id).text(e.name))})),window.subscriberFieldsSelect2.forEach((e=>{e.text=e.name,e.children.forEach((e=>{e.name=(0,_l.r)(e.name),e.text=(0,_l.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(m()(e.target).hasClass("mailpoet-disabled"))return;v.x.Modal.loading(!0);const t=m()(':radio[name="option_format"]:checked').val();v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"ImportExport",action:"processExport",data:JSON.stringify({export_format_option:t,segments:!!window.exportData.segments&&r.val(),subscriber_fields:a.val()})}).always((()=>{v.x.Modal.loading(!1)})).done((e=>{const n=v.x.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>");m()("#export_result_notice").html(`<p>${n}</p>`).show(),window.location.href=e.data.exportFileURL,v.x.trackEvent("Subscribers export completed",{"Total exported":e.data.totalExported,"File Format":t})})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}))})),jl.propTypes={finish:f().func.isRequired,loading:f().bool.isRequired,update_sender:f().func.isRequired,submit_sender:f().func.isRequired,sender:f().shape({name:f().string,address:f().string})},jl.defaultProps={sender:null},Il.propTypes={next:f().func.isRequired},Sl.propTypes={next:f().func.isRequired};const Cl=(0,j.jsx)("svg",{width:"13",height:"11",viewBox:"0 0 13 11",children:(0,j.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"})}),Tl=(0,j.jsx)("svg",{width:"17",height:"16",viewBox:"0 0 17 16",children:(0,j.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"})});function kl(e){let{onCheck:t,showError:n,checked:r,automationId:a,...s}=e;return(0,j.jsxs)("div",{className:u()({"mailpoet-form-yesno":!0,"mailpoet-form-yesno-error":n,"mailpoet-disabled":s.disabled}),"data-automation-id":a,children:[(0,j.jsxs)("label",{children:[(0,j.jsx)("input",{type:"radio",checked:!0===r,onChange:()=>t(!0),...s}),(0,j.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-yes",children:Cl})]}),(0,j.jsxs)("label",{children:[(0,j.jsx)("input",{type:"radio",checked:!1===r,onChange:()=>t(!1),...s}),(0,j.jsx)("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-no",children:Tl})]})]})}function Nl(e){let{loading:t,submitForm:n}=e;const[r,a]=(0,w.useState)({tracking:void 0,libs3rdParty:void 0});return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(fe.X,{level:1,children:v.x.I18n.t("welcomeWizardUsageTrackingStepTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("p",{children:v.x.I18n.t("welcomeWizardTrackingText")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)(fe.X,{level:5,children:v.x.I18n.t("welcomeWizardUsageTrackingStepSubTitle")}),(0,j.jsx)(bt.r.TwoColumnsList,{children:(0,j.jsxs)(qn,{children:[(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardTrackingList1")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardTrackingList2")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardTrackingList3")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardTrackingList4")}),(0,j.jsx)("li",{children:v.x.I18n.t("welcomeWizardTrackingList5")})]})}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("form",{onSubmit:function(e){return e.preventDefault(),n(r.tracking,r.libs3rdParty),!1},children:[(0,j.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,j.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,j.jsx)(kl,{onCheck:e=>{const t={tracking:e,libs3rdParty:r.libs3rdParty};e&&(t.libs3rdParty=e),a(t)},checked:r.tracking,name:"mailpoet_tracking"})}),(0,j.jsxs)("div",{children:[(0,j.jsxs)("p",{children:[v.x.I18n.t("welcomeWizardUsageTrackingStepTrackingLabel")," ",(0,j.jsx)("a",{href:"https://kb.mailpoet.com/article/130-sharing-your-data-with-us","data-beacon-article":"57ce0aaac6979108399a0454",target:"_blank",rel:"noopener noreferrer",children:v.x.I18n.t("welcomeWizardTrackingLink")})]}),(0,j.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,j.jsx)("span",{children:v.x.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNoteNote")}),v.x.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNote")]})]})]}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,j.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,j.jsx)(kl,{onCheck:e=>{const t={libs3rdParty:e,tracking:r.tracking};e||(t.tracking=e),a(t)},checked:r.libs3rdParty,name:"mailpoet_libs_3rdParty"})}),(0,j.jsxs)("div",{children:[(0,j.jsxs)("p",{children:[v.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabel")," ",(0,j.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:v.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLink")})]}),(0,j.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,j.jsx)("span",{children:v.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNoteNote")}),v.x.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNote")]})]})]}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)(O.z,{isFullWidth:!0,type:"submit",withSpinner:t,disabled:t,children:v.x.I18n.t("continue")})]})]})}function Dl(e){let{children:t}=e;return(0,j.jsx)("div",{className:"mailpoet-steps-content",children:t})}function El(e){const[t,n]=(0,w.useState)(null),[r,a]=(0,w.useState)(null),[s,i]=(0,w.useState)(!1),o=e.isWizardStep?v.x.I18n.t("wooCommerceSetupFinishButtonTextWizard"):v.x.I18n.t("wooCommerceSetupFinishButtonTextStandalone");let l;return"subscribed"===r&&(l=!0),"unsubscribed"===r&&(l=!1),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(g.TypographyHeading,{level:1,children:v.x.I18n.t("wooCommerceSetupTitle")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)("p",{children:v.x.I18n.t("wooCommerceSetupInfo")}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsxs)("form",{onSubmit:n=>(n.preventDefault(),i(!0),null===r||null===t||e.submitForm(r,"true"===t),!1),children:[(0,j.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,j.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,j.jsx)(kl,{showError:s&&null===r,checked:l,onCheck:e=>a(e?"subscribed":"unsubscribed"),name:"mailpoet_woocommerce_import_type",automationId:"woocommerce_import_type"})}),(0,j.jsxs)("div",{children:[(0,j.jsx)("p",{children:C()(v.x.I18n.t("wooCommerceSetupImportInfo"),/\[link\](.*?)\[\/link\]/,(e=>(0,j.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,j.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,j.jsx)("span",{children:"GDPR"}),v.x.I18n.t("wooCommerceSetupImportGDPRInfo")]})]})]}),(0,j.jsxs)("div",{className:"mailpoet-wizard-woocommerce-option",children:[(0,j.jsx)("div",{className:"mailpoet-wizard-woocommerce-toggle",children:(0,j.jsx)(kl,{showError:s&&null===t,checked:t,onCheck:e=>n(e),name:"mailpoet_woocommerce_tracking",automationId:"woocommerce_tracking"})}),(0,j.jsxs)("div",{children:[(0,j.jsx)("p",{children:C()(v.x.I18n.t("wooCommerceSetupTrackingInfo"),/\[link\](.*?)\[\/link\]/,(e=>(0,j.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,j.jsxs)("div",{className:"mailpoet-wizard-note",children:[(0,j.jsx)("span",{children:"GDPR"}),v.x.I18n.t("wooCommerceSetupTrackingGDPRInfo")]})]})]}),(0,j.jsx)("div",{className:"mailpoet-gap"}),(0,j.jsx)(g.Button,{isFullWidth:!0,type:"submit",withSpinner:e.loading,disabled:e.loading,automationId:"submit_woocommerce_setup",children:o})]})]})}function Ol(e){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:"mailpoet-wizard-logo",children:(0,j.jsx)("img",{src:window.mailpoet_logo_url,width:"160",height:"50",alt:"MailPoet logo"})}),(0,j.jsx)(Fn,{illustrationUrl:e.illustrationUrl,children:e.children})]})}function Rl(e){let{isWizardStep:t=!1}=e;const[n,r]=(0,w.useState)(!1),a=e=>{r(!1),v.x.Notice.showApiErrorNotice(e,{scroll:!0})},s=()=>v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"setupWooCommerceInitialImport"}).fail(a),i=()=>{window.location=window.finish_wizard_url},o=(0,j.jsx)(Ol,{illustrationUrl:window.wizard_woocommerce_illustration_url,children:(0,j.jsx)(El,{loading:n,submitForm:(e,t)=>{var n;r(!0);const o="basic"===(null===(n=v.x.settings.tracking)||void 0===n?void 0:n.level)?"basic":"partial";var l;(l={woocommerce_import_screen_displayed:1,"mailpoet_subscribe_old_woocommerce_customers.enabled":"subscribed"===e?1:0,"tracking.level":t?"full":o,"woocommerce.accept_cookie_revenue_tracking.set":1},v.x.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:l}).fail(a)).then(s).then(i)},isWizardStep:t})});return t?o:(0,j.jsx)(Dl,{children:o})}Nl.propTypes={loading:f().bool.isRequired,submitForm:f().func.isRequired},El.propTypes={submitForm:f().func.isRequired,loading:f().bool.isRequired,isWizardStep:f().bool},El.defaultProps={isWizardStep:!1},Ol.propTypes={illustrationUrl:f().string.isRequired,children:f().oneOfType([f().arrayOf(f().node),f().node]).isRequired},Rl.propTypes={isWizardStep:f().bool},Rl.defaultProps={isWizardStep:!1};const Al=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})},Pl=()=>{let e=3;return window.has_mss_key_specified||(e+=1),window.is_woocommerce_active&&(e+=1),e},Ml=(e,t,n)=>{n<Pl()?e.push(`/steps/${n+1}`):t()};var Ll=n(60054);function Fl(e){const t=Pl(),n=parseInt(e.match.params.step,10),[r,a]=(0,w.useState)(!1),[s,i]=(0,w.useState)(window.sender_data);function o(){a(!0),window.location=window.finish_wizard_url}(0,w.useEffect)((()=>{(n>t||n<1)&&e.history.push("/steps/1")}),[n,t,e.history]);const l=(0,_.r$)(Ml,e.history,o);function c(e){return a(!0),v.x.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&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}const d=(0,w.useCallback)(((e,t)=>{a(!0),c({analytics:{enabled:e?"1":""},"3rd_party_libs":{enabled:t?"1":""}}).then((()=>l(n)))}),[l,n]),u=(0,w.useCallback)((e=>{i({...s,...e})}),[s]),p=(0,w.useCallback)((()=>{c(Al(s)).then((()=>l(n)))}),[l,s,n]),m=(0,w.useCallback)((e=>{e.preventDefault(),a(!0),c(Al({address:window.admin_email,name:""})).then((()=>{window.is_woocommerce_active?l(t-1):o()}))}),[l,t]),h=(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===Pl()?"WizardWooCommerceStep":"WelcomeWizardPitchMSSStep":"WelcomeWizardMigratedUserStep"})(n);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ll.R,{count:t,current:n}),(0,j.jsxs)(Dl,{children:["WelcomeWizardSenderStep"===h?(0,j.jsx)(Ol,{illustrationUrl:window.wizard_sender_illustration_url,children:(0,j.jsx)(jl,{update_sender:u,submit_sender:p,finish:m,loading:r,sender:s})}):null,"WelcomeWizardMigratedUserStep"===h?(0,j.jsx)(Ol,{illustrationUrl:window.wizard_sender_illustration_url,children:(0,j.jsx)(Il,{next:()=>l(n)})}):null,"WelcomeWizardEmailCourseStep"===h?(0,j.jsx)(Ol,{illustrationUrl:window.wizard_email_course_illustration_url,children:(0,j.jsx)(Sl,{next:()=>l(n)})}):null,"WelcomeWizardUsageTrackingStep"===h?(0,j.jsx)(Ol,{illustrationUrl:window.wizard_tracking_illustration_url,children:(0,j.jsx)(Nl,{loading:r,submitForm:d})}):null,"WelcomeWizardPitchMSSStep"===h?(0,j.jsx)(Ol,{illustrationUrl:window.wizard_MSS_pitch_illustration_url,children:(0,j.jsx)(Yn,{next:()=>l(n),subscribersCount:window.subscribers_count,mailpoetAccountUrl:window.mailpoet_account_url,purchaseUrl:v.x.MailPoetComUrlFactory.getPurchasePlanUrl(v.x.subscribersCount,v.x.currentWpUserEmail,"business",{utm_medium:"onboarding",utm_campaign:"purchase"})})}):null,"WizardWooCommerceStep"===h?(0,j.jsx)(Rl,{isWizardStep:!0}):null]})]})}function ql(){let e="/steps/1";window.location.search.includes("woocommerce-setup")&&(e="/woocommerce");const t=(0,Ce.S)(window);return(0,j.jsx)(Ce.k.Provider,{value:t,children:(0,j.jsxs)(l.UT,{children:[(0,j.jsx)(Me.w,{}),(0,j.jsxs)(c.Switch,{children:[(0,j.jsx)(c.Route,{path:"/steps/:step",component:Fl}),(0,j.jsx)(c.Route,{path:"/woocommerce",component:Rl}),(0,j.jsx)(c.Route,{render:()=>(0,j.jsx)(c.Redirect,{to:e})})]})]})})}Fl.propTypes={match:f().shape({params:f().shape({step:f().string}).isRequired}).isRequired,history:f().shape({push:f().func.isRequired}).isRequired};const $l=document.getElementById("mailpoet-wizard-container");function Ul(){const[e,t]=(0,w.useState)(null),n=(0,Ce.S)(window),r=n.notices.error;function a(a){const s=a.target.name,i=a.target.checked;v.x.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,j.jsx)("p",{children:a}))})).fail((e=>{e.errors.length>0&&r(e.errors.map((e=>(0,j.jsx)("p",{children:e.message},e.message))),{scroll:!0})}))}return(0,w.useEffect)((()=>{v.x.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,j.jsx)(j.Fragment,{children:e.errors.map((e=>(0,j.jsx)("p",{children:e.message})))}),{scroll:!0})}))}),[r]),null===e?(0,j.jsx)("p",{children:"Loading experimental features..."}):0===Object.values(e).length?(0,j.jsx)("p",{children:"There are no experimental features at the moment."}):(0,j.jsx)(Ce.k.Provider,{value:n,children:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Me.w,{}),Object.values(e).map((e=>{const t=`experimental-feature-${e.name}`;return(0,j.jsx)("div",{children:(0,j.jsxs)("label",{htmlFor:t,children:[(0,j.jsx)("input",{id:t,type:"checkbox",name:e.name,defaultChecked:e.value,onChange:a})," ",e.name]})},e.name)}))]})})}$l&&o().render((0,j.jsx)(ql,{}),$l);const Zl=document.getElementById("experimental_features_container");Zl&&o().render((0,j.jsx)(Ul,{}),Zl);var Vl=n(23520);function Wl(e){let{message:t,editing:n}=e;return n?(0,j.jsx)("textarea",{value:t,className:"mailpoet-logs-full-message",readOnly:!0}):(0,j.jsx)(j.Fragment,{children:`${t.substr(0,150)}…`})}function Yl(e){let{log:t}=e;const[n,r]=(0,w.useState)(!1);return(0,j.jsxs)("tr",{children:[(0,j.jsx)("td",{role:"gridcell",children:t.name}),(0,j.jsx)("td",{onClick:function(e){(function(e){return(e.ctrlKey||e.metaKey)&&!e.altKey})(e)&&(n||r(!0))},role:"gridcell",children:(0,j.jsx)(Wl,{message:t.message,editing:n})}),(0,j.jsx)("td",{role:"gridcell",children:v.x.Date.full(t.created_at)})]},`log-row-${t.id}`)}function Bl(e){let{logs:t,onFilter:n,originalFrom:r,originalTo:a,originalSearch:s,originalOffset:i,originalLimit:o}=e;const[l,c]=(0,w.useState)(null!=r?r:void 0),[d,u]=(0,w.useState)(null!=a?a:void 0),[p,m]=(0,w.useState)(null!=i?i:""),[h,f]=(0,w.useState)(null!=o?o:""),[x,b]=(0,w.useState)(s||""),y=(0,Qa.curry)(((e,t)=>{e(null!==t?v.x.Date.format(t,{format:"Y-m-d"}):void 0)})),_=(0,w.useCallback)((()=>{const e={};l&&(e.from=l),d&&(e.to=d),p&&""!==p.trim()&&(e.offset=p),h&&""!==h.trim()&&(e.limit=h),x&&""!==x.trim()&&(e.search=x.trim()),n(e)}),[l,h,p,x,d,n]);return(0,j.jsxs)("div",{className:"mailpoet-listing mailpoet-logs",children:[(0,j.jsxs)("div",{className:"mailpoet-listing-header",children:[(0,j.jsxs)("div",{className:"mailpoet-listing-search",children:[(0,j.jsx)("label",{htmlFor:"search_input",className:"screen-reader-text",children:v.x.I18n.t("searchLabel")}),(0,j.jsx)(g.Input,{dimension:"small",iconStart:Vl.J,type:"search",id:"search_input",name:"s",onChange:e=>b(e.target.value),value:x,placeholder:v.x.I18n.t("searchLabel")})]}),(0,j.jsxs)("div",{className:"mailpoet-listing-filters",children:[`${v.x.I18n.t("from")}:`,(0,j.jsx)(St,{dateFormat:"MMMM d, yyyy",onChange:y(c),maxDate:new Date,selected:l?(0,ps.default)(l):void 0,dimension:"small"}),`${v.x.I18n.t("to")}:`,(0,j.jsx)(St,{dateFormat:"MMMM d, yyyy",onChange:y(u),maxDate:new Date,selected:d?(0,ps.default)(d):void 0,dimension:"small"})]}),(0,j.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,j.jsx)("label",{htmlFor:"offset_input",className:"screen-reader-text",children:v.x.I18n.t("offsetLabel")}),(0,j.jsx)(g.Input,{dimension:"small",id:"offset_input",name:"o",type:"number",onChange:e=>m(e.target.value),value:p,placeholder:v.x.I18n.t("offsetLabel")})]}),(0,j.jsxs)("div",{className:"mailpoet-logs-limit",children:[(0,j.jsx)("label",{htmlFor:"limit_input",className:"screen-reader-text",children:v.x.I18n.t("limitLabel")}),(0,j.jsx)(g.Input,{dimension:"small",id:"limit_input",name:"l",type:"number",onChange:e=>f(e.target.value),value:h,placeholder:v.x.I18n.t("limitLabel")})]}),(0,j.jsx)(g.Button,{dimension:"small",onClick:_,children:v.x.I18n.t("filter")})]}),(0,j.jsxs)("table",{className:"mailpoet-listing-table widefat striped",role:"grid",children:[(0,j.jsx)("thead",{children:(0,j.jsxs)("tr",{children:[(0,j.jsx)("th",{children:v.x.I18n.t("tableHeaderName")}),(0,j.jsx)("th",{children:v.x.I18n.t("tableHeaderMessage")}),(0,j.jsx)("th",{children:v.x.I18n.t("tableHeaderCreatedOn")})]})}),(0,j.jsx)("tbody",{children:t.map((e=>(0,j.jsx)(Yl,{log:e},`log-${e.id}`)))})]})]})}const Hl=document.getElementById("mailpoet_logs_container");if(Hl){const e=new URL(window.location.href);o().render((0,j.jsx)(Bl,{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}}),Hl)}var zl=n(13651);function Kl(e){let{onRequestClose:t}=e;const[n,r]=(0,w.useState)(!1);return m()((e=>{e(document).on("click",".notice .mailpoet-js-button-fix-this",(()=>{r(!0)}))})),(0,j.jsxs)(Ce.k.Provider,{value:(0,Ce.S)(window),children:[(0,j.jsx)(Me.w,{}),n&&(0,j.jsx)(zl.d,{onRequestClose:()=>{r(!1),t()}})]})}Kl.defaultProps={onRequestClose:Qa.noop};const Gl=document.getElementById("mailpoet_set_from_address_modal");Gl&&o().render((0,j.jsx)(Kl,{onRequestClose:()=>{window.location.href.includes("?page=mailpoet-settings")&&window.location.reload()}}),Gl);const Ql=e=>(async e=>"MailPoet"!==v.x.mtaMethod||-1!==(await(async()=>"MailPoet"!==v.x.mtaMethod?[]:(await v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])()).indexOf(e))(e).then((e=>{if(!e)return v.x.Notice.error(v.x.I18n.t("mailerSendingNotResumedUnauthorized"),{scroll:!0}),v.x.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"}),!1;v.x.Ajax.post({api_version:v.x.apiVersion,endpoint:"mailer",action:"resumeSending"}).done((()=>{v.x.Notice.success(v.x.I18n.t("mailerSendingResumedNotice"))})).fail((e=>{e.errors.length>0&&v.x.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}));m()((e=>{e(document).on("click",".notice .mailpoet-js-button-resume-sending",(e=>{Ql(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,{Do:function(){return i},Iu:function(){return s},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"))}},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}},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)}},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 P}});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)},x=function(e,t){return m(e.getUTCHours()%12||12,t.length)},v=function(e,t){return m(e.getUTCHours(),t.length)},b=function(e,t){return m(e.getUTCMinutes(),t.length)},y=function(e,t){return m(e.getUTCSeconds(),t.length)},w=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 j(e,t){return e%60==0?(e>0?"-":"+")+m(Math.abs(e)/60,2):I(e,t)}function I(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 S={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 x(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):v(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"}):b(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):y(e,t)},S:function(e,t){return w(e,t)},X:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return j(a);case"XXXX":case"XX":return I(a);case"XXXXX":case"XXX":default:return I(a,":")}},x:function(e,t,n,r){var a=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return j(a);case"xxxx":case"xx":return I(a);case"xxxxx":case"xxx":default:return I(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"+I(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"+I(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)}},C=n(97621),T=n(24262),k=n(5267),N=n(83946),D=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,E=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,O=/^'([^]*?)'?$/,R=/''/g,A=/[a-zA-Z]/;function P(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,N.Z)(u),m=null==c.firstWeekContainsDate?p:(0,N.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,N.Z)(h),g=null==c.weekStartsOn?f:(0,N.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 x=(0,i.default)(e);if(!(0,r.default)(x))throw new RangeError("Invalid time value");var v=(0,T.Z)(x),b=(0,s.Z)(x,v),y={firstWeekContainsDate:m,weekStartsOn:g,locale:d,_originalDate:x},w=l.match(E).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,C.Z[t])(e,d.formatLong,y):e})).join("").match(D).map((function(n){if("''"===n)return"'";var r=n[0];if("'"===r)return M(n);var a=S[r];if(a)return!c.useAdditionalWeekYearTokens&&(0,k.Do)(n)&&(0,k.qp)(n,t,e),!c.useAdditionalDayOfYearTokens&&(0,k.Iu)(n)&&(0,k.qp)(n,t,e),a(b,n,d.localize,y);if(r.match(A))throw new RangeError("Format string contains an unescaped latin alphabet character `"+r+"`");return n})).join("");return w}function M(e){return e.match(O)[1].replace(R,"'")}},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),x=n(59025),v=/^(1[0-2]|0?\d)/,b=/^(3[0-1]|[0-2]?\d)/,y=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,w=/^(5[0-3]|[0-4]?\d)/,_=/^(2[0-3]|[0-1]?\d)/,j=/^(2[0-4]|[0-1]?\d)/,I=/^(1[0-1]|0?\d)/,S=/^(1[0-2]|0?\d)/,C=/^[0-5]?\d/,T=/^[0-5]?\d/,k=/^\d/,N=/^\d{1,2}/,D=/^\d{1,3}/,E=/^\d{1,4}/,O=/^-?\d+/,R=/^-?\d/,A=/^-?\d{1,2}/,P=/^-?\d{1,3}/,M=/^-?\d{1,4}/,L=/^([+-])(\d{2})(\d{2})?|Z/,F=/^([+-])(\d{2})(\d{2})|Z/,q=/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,$=/^([+-])(\d{2}):(\d{2})|Z/,U=/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/;function Z(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 Z(O,e,t)}function Y(e,t,n){switch(e){case 1:return Z(k,t,n);case 2:return Z(N,t,n);case 3:return Z(D,t,n);case 4:return Z(E,t,n);default:return Z(new RegExp("^\\d{1,"+e+"}"),t,n)}}function B(e,t,n){switch(e){case 1:return Z(R,t,n);case 2:return Z(A,t,n);case 3:return Z(P,t,n);case 4:return Z(M,t,n);default:return Z(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,x.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,x.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 Z(v,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 Z(v,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 Z(w,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,x.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 Z(w,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 Z(b,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 Z(y,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 Z(S,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 Z(_,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 Z(I,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 Z(j,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 Z(C,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 Z(T,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(L,e);case"XX":return V(F,e);case"XXXX":return V(q,e);case"XXXXX":return V(U,e);case"XXX":default:return V($,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(L,e);case"xx":return V(F,e);case"xxxx":return V(q,e);case"xxxxx":return V(U,e);case"xxx":default:return V($,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 x=g.options&&g.options.firstWeekContainsDate,v=null==x?1:(0,d.Z)(x),b=null==f.firstWeekContainsDate?v:(0,d.Z)(f.firstWeekContainsDate);if(!(b>=1&&b<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=g.options&&g.options.weekStartsOn,w=null==y?0:(0,d.Z)(y),_=null==f.weekStartsOn?w:(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 j,I={firstWeekContainsDate:b,weekStartsOn:_,locale:g},S=[{priority:10,subPriority:-1,set:ie,index:0}],C=h.match(ee).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,o.Z[t])(e,g.formatLong,I):e})).join("").match(J),T=[];for(j=0;j<C.length;j++){var k=C[j];!f.useAdditionalWeekYearTokens&&(0,c.Do)(k)&&(0,c.qp)(k,h,e),!f.useAdditionalDayOfYearTokens&&(0,c.Iu)(k)&&(0,c.qp)(k,h,e);var N=k[0],D=X[N];if(D){var E=D.incompatibleTokens;if(Array.isArray(E)){for(var O=void 0,R=0;R<T.length;R++){var A=T[R].token;if(-1!==E.indexOf(A)||A===N){O=T[R];break}}if(O)throw new RangeError("The format string mustn't contain `".concat(O.fullToken,"` and `").concat(k,"` at the same time"))}else if("*"===D.incompatibleTokens&&T.length)throw new RangeError("The format string mustn't contain `".concat(k,"` and any other token at the same time"));T.push({token:N,fullToken:k});var P=D.parse(m,k,g.match,I);if(!P)return new Date(NaN);S.push({priority:D.priority,subPriority:D.subPriority||0,set:D.set,validate:D.validate,value:P.value,index:S.length}),m=P.rest}else{if(N.match(ae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");if("''"===k?k="'":"'"===N&&(k=oe(k)),0!==m.indexOf(k))return new Date(NaN);m=m.slice(k.length)}}if(m.length>0&&re.test(m))return new Date(NaN);var M=S.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 S.filter((function(t){return t.priority===e})).sort((function(e,t){return t.subPriority-e.subPriority}))})).map((function(e){return e[0]})),L=(0,s.default)(n);if(isNaN(L))return new Date(NaN);var F=(0,a.Z)(L,(0,l.Z)(L)),q={};for(j=0;j<M.length;j++){var $=M[j];if($.validate&&!$.validate(F,$.value,I))return new Date(NaN);var U=$.set(F,q,$.value,I);U[0]?(F=U[0],i(q,U[1])):F=U}return F}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),v=new Date(0);return v.setFullYear(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),v.setHours(g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds()),v}return c=x(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<=(v[t]||(b(e)?29:28))}(t,s,i)&&function(e,t){return t>=1&&t<=(b(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 x(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 v=[31,null,31,30,31,30,31,31,30,31,30,31];function b(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)}},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(w(o)&&(r.dynamicTypingFunction=o,o={}),r.dynamicTyping=o,r.transform=!!w(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=w(r.step),r.chunk=w(r.chunk),r.complete=w(r.complete),r.error=w(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&&w(n.read)&&w(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||t.escapeFormulae instanceof RegExp)&&(u=t.escapeFormulae instanceof RegExp?t.escapeFormulae:/^[=+\-@\t\r].*$/)}}();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||d),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 x=l?e[g]:g;h.push(t[d][x])}p=""===h.join("").trim()}if(!p){for(var v=0;v<u;v++){0<v&&!m&&(i+=a);var b=o&&l?e[v]:v;i+=f(t[d][b],v)}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);var r=!1;u&&"string"==typeof e&&u.test(e)&&(e="'"+e,r=!0);var s=e.toString().replace(p,l);return(r=r||!0===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}(s,i.BAD_DELIMITERS)||-1<s.indexOf(a)||" "===s.charAt(0)||" "===s.charAt(s.length-1))?o+s+o:s}}};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(w(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(w(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){w(d)&&d(e,l.file,l.inputElem),s()},i.parse(l.file,l.instanceConfig)}else w(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=b(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&&w(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(w(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||!w(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){w(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=y(this._chunkLoaded,this),t.onerror=y(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=y(this._chunkLoaded,this),t.onerror=y(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=y((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=y((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=y((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=y((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=[],x={data:[],errors:[],meta:{}};if(w(e.step)){var v=e.step;e.step=function(t){if(x=t,j())_();else{if(_(),0===x.data.length)return;d+=t.data.length,e.preview&&d>e.preview?n.abort():(x.data=x.data[0],v(x,c))}}}function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function _(){return x&&r&&(S("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+i.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(x.data=x.data.filter((function(e){return!y(e)}))),j()&&function(){if(x)if(Array.isArray(x.data[0])){for(var t=0;j()&&t<x.data.length;t++)x.data[t].forEach(n);x.data.splice(0,1)}else x.data.forEach(n);function n(t,n){w(e.transformHeader)&&(t=e.transformHeader(t,n)),g.push(t)}}(),function(){if(!x||!e.header&&!e.dynamicTyping&&!e.transform)return x;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=I(s,i),"__parsed_extra"===s?(a[s]=a[s]||[],a[s].push(i)):a[s]=i}return e.header&&(r>g.length?S("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+r,u+n):r<g.length&&S("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+r,u+n)),a}var n=1;return!x.data.length||Array.isArray(x.data[0])?(x.data=x.data.map(t),n=x.data.length):x.data=t(x.data,0),e.header&&x.meta&&(x.meta.fields=g),u+=n,x}()}function j(){return e.header&&0===g.length}function I(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 S(e,t,n,r){var a={type:e,code:t,message:n};void 0!==r&&(a.row=r),x.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)w(e.delimiter)&&(e.delimiter=e.delimiter(a),x.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 x=new f({comments:a,delimiter:p,newline:n,preview:10}).parse(t),v=0;v<x.data.length;v++)if(r&&y(x.data[v]))g++;else{var b=x.data[v].length;h+=b,void 0!==c?0<b&&(m+=Math.abs(b-c),c=b):c=b}0<x.data.length&&(h/=x.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),x.meta.delimiter=e.delimiter}var d=b(e);return e.preview&&e.header&&d.preview++,t=a,n=new f(d),x=n.parse(t,s,o),_(),p?{meta:{paused:!0}}:x||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,n.abort(),t=w(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(),x.meta.aborted=!0,w(e.complete)&&e.complete(x),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||null===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,x=a.length,v=w(s),b=[],y=[],_=[],j=d=0;if(!e)return M();if(l||!1!==l&&-1===e.indexOf(t)){for(var I=e.split(r),S=0;S<I.length;S++){if(_=I[S],d+=_.length,S!==I.length-1)d+=r.length;else if(p)return M();if(!a||_.substring(0,x)!==a){if(v){if(b=[],O(_.split(n)),L(),u)return M()}else O(_.split(n));if(o&&o<=S)return b=b.slice(0,o),M(!0)}}return M()}for(var C=e.indexOf(n,d),T=e.indexOf(r,d),k=new RegExp(h(c)+h(t),"g"),N=e.indexOf(t,d);;)if(e[d]!==t)if(a&&0===_.length&&e.substring(d,d+x)===a){if(-1===T)return M();d=T+g,T=e.indexOf(r,d),C=e.indexOf(n,d)}else if(-1!==C&&(C<T||-1===T))_.push(e.substring(d,C)),d=C+f,C=e.indexOf(n,d);else{if(-1===T)break;if(_.push(e.substring(d,T)),P(T+g),v&&(L(),u))return M();if(o&&b.length>=o)return M(!0)}else for(N=d,d++;;){if(-1===(N=e.indexOf(t,N+1)))return p||y.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:d}),A();if(N===m-1)return A(e.substring(d,N).replace(k,t));if(t!==c||e[N+1]!==c){if(t===c||0===N||e[N-1]!==c){-1!==C&&C<N+1&&(C=e.indexOf(n,N+1)),-1!==T&&T<N+1&&(T=e.indexOf(r,N+1));var D=R(-1===T?C:Math.min(C,T));if(e.substr(N+1+D,f)===n){_.push(e.substring(d,N).replace(k,t)),e[d=N+1+D+f]!==t&&(N=e.indexOf(t,d)),C=e.indexOf(n,d),T=e.indexOf(r,d);break}var E=R(T);if(e.substring(N+1+E,N+1+E+g)===r){if(_.push(e.substring(d,N).replace(k,t)),P(N+1+E+g),C=e.indexOf(n,d),N=e.indexOf(t,d),v&&(L(),u))return M();if(o&&b.length>=o)return M(!0);break}y.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:b.length,index:d}),N++}}else N++}return A();function O(e){b.push(e),j=d}function R(t){var n=0;if(-1!==t){var r=e.substring(N+1,t);r&&""===r.trim()&&(n=r.length)}return n}function A(t){return p||(void 0===t&&(t=e.substring(d)),_.push(t),d=m,O(_),v&&L()),M()}function P(t){d=t,O(_),_=[],T=e.indexOf(r,d)}function M(e){return{data:b,errors:y,meta:{delimiter:n,linebreak:r,aborted:u,truncated:!!e,cursor:j+(i||0)}}}function L(){s(M()),b=[],y=[]}},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,x(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:v,resume:v};if(w(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 w(n.userChunk)&&(n.userChunk(t.results,s,t.file),delete t.results)}t.finished&&!r&&x(t.workerId,t.results)}function x(e,t){var n=a[e];w(n.userComplete)&&n.userComplete(t),n.terminate(),delete a[e]}function v(){throw new Error("Not implemented.")}function b(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=b(e[n]);return t}function y(e,t){return function(){e.apply(t,arguments)}}function w(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,n,r,a,s,i,o,l,c,d,u,p,m,h,f,g,x,v,b,y,w,_,j,I,S,C,T,k,N,D,E,O,R,A,P,M,L,F,q,$,U,Z,V,W,Y,B,H,z,K,G,Q,X,J,ee,te,ne,re,ae,se,ie,oe,le){"use strict";function ce(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var de=ce(t),ue=ce(r),pe=ce(a),me=ce(s),he=ce(i),fe=ce(o),ge=ce(l),xe=ce(c),ve=ce(d),be=ce(u),ye=ce(p),we=ce(f),_e=ce(g),je=ce(x),Ie=ce(v),Se=ce(b),Ce=ce(y),Te=ce(w),ke=ce(_),Ne=ce(j),De=ce(I),Ee=ce(S),Oe=ce(C),Re=ce(T),Ae=ce(k),Pe=ce(N),Me=ce(D),Le=ce(E),Fe=ce(O),qe=ce(R),$e=ce(A),Ue=ce(P),Ze=ce(M),Ve=ce(L),We=ce(F),Ye=ce($),Be=ce(U),He=ce(Z),ze=ce(V),Ke=ce(W),Ge=ce(Y),Qe=ce(B),Xe=ce(K),Je=ce(G),et=ce(Q),tt=ce(X),nt=ce(J),rt=ce(ee),at=ce(te),st=ce(ne),it=ce(re),ot=ce(ae),lt=ce(se),ct=ce(ie),dt=ce(oe);function ut(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 pt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach((function(t){xt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function mt(e){return(mt="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 ht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ft(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 gt(e,t,n){return t&&ft(e.prototype,t),n&&ft(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function xt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vt(){return(vt=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 bt(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&&wt(e,t)}function yt(e){return(yt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function wt(e,t){return(wt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _t(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 _t(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=yt(e);if(t){var a=yt(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?lt.default(e):it.default(e):new Date;return At(t)?t:null}function Rt(e,t,n,r,a){var s=null,i=Xt(n)||Xt(Qt()),o=!0;return Array.isArray(t)?(t.forEach((function(t){var l=ot.default(e,t,new Date,{locale:i});r&&(o=At(l,a)&&e===Pt(l,t,n)),At(l,a)&&o&&(s=l)})),s):(s=ot.default(e,t,new Date,{locale:i}),r?o=At(s)&&e===Pt(s,t,n):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=ot.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"),me.default(e)&&!at.default(e,t)}function Pt(e,t,n){if("en"===n)return he.default(e,t,{awareOfUnicodeTokens:!0});var r=Xt(n);return n&&!r&&console.warn('A locale object was not found for the provided string ["'.concat(n,'"].')),!r&&Qt()&&Xt(Qt())&&(r=Xt(Qt())),he.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&&Xt(t)||Qt()&&Xt(Qt());return De.default(e,n?{locale:n}:null)}function qt(e,t){return Pt(e,"ddd",t)}function $t(e){return Be.default(e)}function Ut(e,t,n){var r=Xt(t||Qt());return He.default(e,{locale:r,weekStartsOn:n})}function Zt(e){return ze.default(e)}function Vt(e){return Ge.default(e)}function Wt(e){return Ke.default(e)}function Yt(e,t){return e&&t?tt.default(e,t):!e&&!t}function Bt(e,t){return e&&t?et.default(e,t):!e&&!t}function Ht(e,t){return e&&t?nt.default(e,t):!e&&!t}function zt(e,t){return e&&t?Je.default(e,t):!e&&!t}function Kt(e,t){return e&&t?Xe.default(e,t):!e&&!t}function Gt(e,t,n){var r,a=Be.default(t),s=Qe.default(n);try{r=st.default(e,{start:a,end:s})}catch(e){r=!1}return r}function Qt(){return("undefined"!=typeof window?window:globalThis).__localeId__}function Xt(e){if("string"==typeof e){var t="undefined"!=typeof window?window:globalThis;return t.__localeData__?t.__localeData__[e]:null}return e}function Jt(e,t){return Pt(Fe.default(Ot(),e),"LLLL",t)}function en(e,t){return Pt(Fe.default(Ot(),e),"LLL",t)}function tn(e,t){return Pt(qe.default(Ot(),e),"QQQ",t)}function nn(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 dn(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return zt(e,t)}))||s&&s.some((function(t){var n=t.start,r=t.end;return st.default(e,{start:n,end:r})}))||i&&!i.some((function(t){return zt(e,t)}))||o&&!o.some((function(t){var n=t.start,r=t.end;return st.default(e,{start:n,end:r})}))||l&&!l(Ot(e))||!1}function rn(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 st.default(e,{start:n,end:r})})):n&&n.some((function(t){return zt(e,t)}))||!1}function an(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 dn(e,{minDate:n,maxDate:r})||a&&a.some((function(t){return Bt(e,t)}))||s&&!s.some((function(t){return Bt(e,t)}))||i&&!i(Ot(e))||!1}function sn(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 on(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 dn(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 ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate;return dn(new Date(e,0,1),{minDate:n,maxDate:r})||!1}function cn(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 dn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,r=t.maxDate;return n&&Ve.default(e,n)<0||r&&Ve.default(e,r)>0}function un(e,t){return t.some((function(t){return Te.default(t)===Te.default(e)&&Ce.default(t)===Ce.default(e)}))}function pn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeTimes,r=t.includeTimes,a=t.filterTime;return n&&un(e,n)||r&&!un(e,r)||a&&!a(e)||!1}function mn(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=!st.default(i,{start:o,end:l})}catch(e){a=!1}return a}function hn(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&&We.default(n,a)>0||r&&r.every((function(e){return We.default(e,a)>0}))||!1}function fn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.includeDates,a=be.default(e,1);return n&&We.default(a,n)>0||r&&r.every((function(e){return We.default(a,e)>0}))||!1}function gn(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&&Ye.default(n,a)>0||r&&r.every((function(e){return Ye.default(e,a)>0}))||!1}function xn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,r=t.includeDates,a=ye.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=e.minDate,n=e.includeDates;if(n&&t){var r=n.filter((function(e){return Ve.default(e,t)>=0}));return Ue.default(r)}return n?Ue.default(n):t}function bn(e){var t=e.maxDate,n=e.includeDates;if(n&&t){var r=n.filter((function(e){return Ve.default(e,t)<=0}));return Ze.default(r)}return n?Ze.default(n):t}function yn(){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(pe.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"===mt(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 wn(e,t,n,r,a){for(var s=a.length,i=[],o=0;o<s;o++){var l=fe.default(ge.default(e,Te.default(a[o])),Ce.default(a[o])),c=fe.default(e,(n+1)*r);rt.default(l,t)&&at.default(l,c)&&i.push(a[o])}return i}function _n(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){bt(r,e);var n=It(r);function r(e){var a;ht(this,r),xt(_t(a=n.call(this,e)),"renderOptions",(function(){var e=a.props.year,t=a.state.yearsList.map((function(t){return de.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(_t(a),t),"aria-selected":e===t?"true":void 0},e===t?de.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(de.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:a.incrementYears},de.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(de.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:a.decrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t})),xt(_t(a),"onChange",(function(e){a.props.onChange(e)})),xt(_t(a),"handleClickOutside",(function(){a.props.onCancel()})),xt(_t(a),"shiftYears",(function(e){var t=a.state.yearsList.map((function(t){return t+e}));a.setState({yearsList:t})})),xt(_t(a),"incrementYears",(function(){return a.shiftYears(1)})),xt(_t(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 gt(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=ue.default({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return de.default.createElement("div",{className:e,ref:this.dropdownRef},this.renderOptions())}}]),r}(de.default.Component),Cn=ct.default(Sn),Tn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),xt(_t(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(de.default.createElement("option",{key:a,value:a},a));return r})),xt(_t(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),xt(_t(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:e.props.year,className:"react-datepicker__year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),xt(_t(e),"renderReadView",(function(t){return de.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__year-read-view",onClick:function(t){return e.toggleDropdown(t)}},de.default.createElement("span",{className:"react-datepicker__year-read-view--down-arrow"}),de.default.createElement("span",{className:"react-datepicker__year-read-view--selected-year"},e.props.year))})),xt(_t(e),"renderDropdown",(function(){return de.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})})),xt(_t(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),xt(_t(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.year&&e.props.onChange(t)})),xt(_t(e),"toggleDropdown",(function(t){e.setState({dropdownVisible:!e.state.dropdownVisible},(function(){e.props.adjustDateOnChange&&e.handleYearChange(e.props.date,t)}))})),xt(_t(e),"handleYearChange",(function(t,n){e.onSelect(t,n),e.setOpen()})),xt(_t(e),"onSelect",(function(t,n){e.props.onSelect&&e.props.onSelect(t,n)})),xt(_t(e),"setOpen",(function(){e.props.setOpen&&e.props.setOpen(!0)})),e}return gt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return de.default.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component),kn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"isSelectedMonth",(function(t){return e.props.month===t})),xt(_t(e),"renderOptions",(function(){return e.props.monthNames.map((function(t,n){return de.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(_t(e),n),"aria-selected":e.isSelectedMonth(n)?"true":void 0},e.isSelectedMonth(n)?de.default.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",t)}))})),xt(_t(e),"onChange",(function(t){return e.props.onChange(t)})),xt(_t(e),"handleClickOutside",(function(){return e.props.onCancel()})),e}return gt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__month-dropdown"},this.renderOptions())}}]),n}(de.default.Component),Nn=ct.default(kn),Dn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),xt(_t(e),"renderSelectOptions",(function(e){return e.map((function(e,t){return de.default.createElement("option",{key:t,value:t},e)}))})),xt(_t(e),"renderSelectMode",(function(t){return de.default.createElement("select",{value:e.props.month,className:"react-datepicker__month-select",onChange:function(t){return e.onChange(t.target.value)}},e.renderSelectOptions(t))})),xt(_t(e),"renderReadView",(function(t,n){return de.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__month-read-view",onClick:e.toggleDropdown},de.default.createElement("span",{className:"react-datepicker__month-read-view--down-arrow"}),de.default.createElement("span",{className:"react-datepicker__month-read-view--selected-month"},n[e.props.month]))})),xt(_t(e),"renderDropdown",(function(t){return de.default.createElement(Nn,{key:"dropdown",month:e.props.month,monthNames:t,onChange:e.onChange,onCancel:e.toggleDropdown})})),xt(_t(e),"renderScrollMode",(function(t){var n=e.state.dropdownVisible,r=[e.renderReadView(!n,t)];return n&&r.unshift(e.renderDropdown(t)),r})),xt(_t(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.month&&e.props.onChange(t)})),xt(_t(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return gt(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 en(e,t.props.locale)}:function(e){return Jt(e,t.props.locale)});switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode(n);break;case"select":e=this.renderSelectMode(n)}return de.default.createElement("div",{className:"react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component);function En(e,t){for(var n=[],r=Zt(e),a=Zt(t);!rt.default(r,a);)n.push(Ot(r)),r=be.default(r,1);return n}var On=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"renderOptions",(function(){return r.state.monthYearsList.map((function(e){var t=Ae.default(e),n=Yt(r.props.date,e)&&Bt(r.props.date,e);return de.default.createElement("div",{className:n?"react-datepicker__month-year-option--selected_month-year":"react-datepicker__month-year-option",key:t,onClick:r.onChange.bind(_t(r),t),"aria-selected":n?"true":void 0},n?de.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Pt(e,r.props.dateFormat,r.props.locale))}))})),xt(_t(r),"onChange",(function(e){return r.props.onChange(e)})),xt(_t(r),"handleClickOutside",(function(){r.props.onCancel()})),r.state={monthYearsList:En(r.props.minDate,r.props.maxDate)},r}return gt(n,[{key:"render",value:function(){var e=ue.default({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return de.default.createElement("div",{className:e},this.renderOptions())}}]),n}(de.default.Component),Rn=ct.default(On),An=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{dropdownVisible:!1}),xt(_t(e),"renderSelectOptions",(function(){for(var t=Zt(e.props.minDate),n=Zt(e.props.maxDate),r=[];!rt.default(t,n);){var a=Ae.default(t);r.push(de.default.createElement("option",{key:a,value:a},Pt(t,e.props.dateFormat,e.props.locale))),t=be.default(t,1)}return r})),xt(_t(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),xt(_t(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:Ae.default(Zt(e.props.date)),className:"react-datepicker__month-year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),xt(_t(e),"renderReadView",(function(t){var n=Pt(e.props.date,e.props.dateFormat,e.props.locale);return de.default.createElement("div",{key:"read",style:{visibility:t?"visible":"hidden"},className:"react-datepicker__month-year-read-view",onClick:function(t){return e.toggleDropdown(t)}},de.default.createElement("span",{className:"react-datepicker__month-year-read-view--down-arrow"}),de.default.createElement("span",{className:"react-datepicker__month-year-read-view--selected-month-year"},n))})),xt(_t(e),"renderDropdown",(function(){return de.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})})),xt(_t(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),xt(_t(e),"onChange",(function(t){e.toggleDropdown();var n=Ot(parseInt(t));Yt(e.props.date,n)&&Bt(e.props.date,n)||e.props.onChange(n)})),xt(_t(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return gt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return de.default.createElement("div",{className:"react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component),Pn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"dayEl",de.default.createRef()),xt(_t(e),"handleClick",(function(t){!e.isDisabled()&&e.props.onClick&&e.props.onClick(t)})),xt(_t(e),"handleMouseEnter",(function(t){!e.isDisabled()&&e.props.onMouseEnter&&e.props.onMouseEnter(t)})),xt(_t(e),"handleOnKeyDown",(function(t){" "===t.key&&(t.preventDefault(),t.key="Enter"),e.props.handleOnKeyDown(t)})),xt(_t(e),"isSameDay",(function(t){return zt(e.props.day,t)})),xt(_t(e),"isKeyboardSelected",(function(){return!e.props.disabledKeyboardNavigation&&!e.isSameDay(e.props.selected)&&e.isSameDay(e.props.preSelection)})),xt(_t(e),"isDisabled",(function(){return nn(e.props.day,e.props)})),xt(_t(e),"isExcluded",(function(){return rn(e.props.day,e.props)})),xt(_t(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)})),xt(_t(e),"isInRange",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&Gt(n,r,a)})),xt(_t(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&&(at.default(d,c)||Kt(d,c))?Gt(r,d,c):(s&&l&&(rt.default(d,l)||Kt(d,l))||!(!i||!l||c||!rt.default(d,l)&&!Kt(d,l)))&&Gt(r,l,d))})),xt(_t(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 zt(r,s?i:a)})),xt(_t(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 zt(r,s?i:a)})),xt(_t(e),"isRangeStart",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&zt(r,n)})),xt(_t(e),"isRangeEnd",(function(){var t=e.props,n=t.day,r=t.startDate,a=t.endDate;return!(!r||!a)&&zt(a,n)})),xt(_t(e),"isWeekend",(function(){var t=ke.default(e.props.day);return 0===t||6===t})),xt(_t(e),"isAfterMonth",(function(){return void 0!==e.props.month&&(e.props.month+1)%12===Ee.default(e.props.day)})),xt(_t(e),"isBeforeMonth",(function(){return void 0!==e.props.month&&(Ee.default(e.props.day)+1)%12===e.props.month})),xt(_t(e),"isCurrentDay",(function(){return e.isSameDay(Ot())})),xt(_t(e),"isSelected",(function(){return e.isSameDay(e.props.selected)})),xt(_t(e),"getClassNames",(function(t){var n=e.props.dayClassName?e.props.dayClassName(t):void 0;return ue.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"))})),xt(_t(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))})),xt(_t(e),"getTabIndex",(function(t,n){var r=t||e.props.selected,a=n||e.props.preSelection;return e.isKeyboardSelected()||e.isSameDay(r)&&zt(a,r)?0:-1})),xt(_t(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})})),xt(_t(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)})),xt(_t(e),"render",(function(){return de.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:"option","aria-disabled":e.isDisabled(),"aria-current":e.isCurrentDay()?"date":void 0,"aria-selected":e.isSelected()},e.renderDayContents())})),e}return gt(n,[{key:"componentDidMount",value:function(){this.handleFocusDay()}},{key:"componentDidUpdate",value:function(e){this.handleFocusDay(e)}}]),n}(de.default.Component),Mn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"handleClick",(function(t){e.props.onClick&&e.props.onClick(t)})),e}return gt(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 de.default.createElement("div",{className:ue.default(a),"aria-label":"".concat(r," ").concat(this.props.weekNumber),onClick:this.handleClick},t)}}]),n}(de.default.Component),Ln=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n)})),xt(_t(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),xt(_t(e),"handleWeekClick",(function(t,n,r){"function"==typeof e.props.onWeekSelect&&e.props.onWeekSelect(t,n,r),e.props.shouldCloseOnSelect&&e.props.setOpen(!1)})),xt(_t(e),"formatWeekNumber",(function(t){return e.props.formatWeekNumber?e.props.formatWeekNumber(t):Ft(t)})),xt(_t(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(_t(e),t,r):void 0;n.push(de.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=xe.default(t,n);return de.default.createElement(Pn,{ariaLabelPrefixWhenEnabled:e.props.chooseDayAriaLabelPrefix,ariaLabelPrefixWhenDisabled:e.props.disabledDayAriaLabelPrefix,key:r.valueOf(),day:r,month:e.props.month,onClick:e.handleDayClick.bind(_t(e),r),onMouseEnter:e.handleDayMouseEnter.bind(_t(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 gt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__week"},this.renderDays())}}],[{key:"defaultProps",get:function(){return{shouldCloseOnSelect:!0}}}]),n}(de.default.Component),Fn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"MONTH_REFS",St(Array(12)).map((function(){return de.default.createRef()}))),xt(_t(e),"isDisabled",(function(t){return nn(t,e.props)})),xt(_t(e),"isExcluded",(function(t){return rn(t,e.props)})),xt(_t(e),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n,e.props.orderInDisplay)})),xt(_t(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),xt(_t(e),"handleMouseLeave",(function(){e.props.onMouseLeave&&e.props.onMouseLeave()})),xt(_t(e),"isRangeStartMonth",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Bt(Fe.default(r,t),a)})),xt(_t(e),"isRangeStartQuarter",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Ht(qe.default(r,t),a)})),xt(_t(e),"isRangeEndMonth",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Bt(Fe.default(r,t),s)})),xt(_t(e),"isRangeEndQuarter",(function(t){var n=e.props,r=n.day,a=n.startDate,s=n.endDate;return!(!a||!s)&&Ht(qe.default(r,t),s)})),xt(_t(e),"isWeekInMonth",(function(t){var n=e.props.day,r=xe.default(t,6);return Bt(t,n)||Bt(r,n)})),xt(_t(e),"isCurrentMonth",(function(e,t){return Re.default(e)===Re.default(Ot())&&t===Ee.default(Ot())})),xt(_t(e),"isSelectedMonth",(function(e,t,n){return Ee.default(e)===t&&Re.default(e)===Re.default(n)})),xt(_t(e),"isSelectedQuarter",(function(e,t,n){return Oe.default(e)===t&&Re.default(e)===Re.default(n)})),xt(_t(e),"renderWeeks",(function(){for(var t=[],n=e.props.fixedHeight,r=0,a=!1,s=Ut(Zt(e.props.day),e.props.locale,e.props.calendarStartDay);t.push(de.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=ve.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})),xt(_t(e),"onMonthClick",(function(t,n){e.handleDayClick(Zt(Fe.default(e.props.day,n)),t)})),xt(_t(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())})),xt(_t(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,be.default(e.props.preSelection,1));break;case"ArrowLeft":e.handleMonthNavigation(0===n?11:n-1,je.default(e.props.preSelection,1))}})),xt(_t(e),"onQuarterClick",(function(t,n){e.handleDayClick(Wt(qe.default(e.props.day,n)),t)})),xt(_t(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 ue.default("react-datepicker__month-text","react-datepicker__month-".concat(t),u,{"react-datepicker__month--disabled":(o||l)&&an(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":sn(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)})})),xt(_t(e),"getTabIndex",(function(t){var n=Ee.default(e.props.preSelection);return e.props.disabledKeyboardNavigation||t!==n?"-1":"0"})),xt(_t(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"))})),xt(_t(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 ue.default("react-datepicker__quarter-text","react-datepicker__quarter-".concat(t),{"react-datepicker__quarter--disabled":(o||l)&&on(qe.default(r,t),e.props),"react-datepicker__quarter--selected":e.isSelectedQuarter(r,t,i),"react-datepicker__quarter--in-range":cn(a,s,t,r),"react-datepicker__quarter--range-start":e.isRangeStartQuarter(t),"react-datepicker__quarter--range-end":e.isRangeEndQuarter(t)})})),xt(_t(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 de.default.createElement("div",{className:"react-datepicker__month-wrapper",key:r},t.map((function(t,r){return de.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:"option","aria-label":e.getAriaLabel(t),"aria-current":e.isCurrentMonth(i,t)?"date":void 0,"aria-selected":e.isSelectedMonth(i,t,o)},n?Jt(t,s):en(t,s))})))}))})),xt(_t(e),"renderQuarters",(function(){var t=e.props,n=t.day,r=t.selected;return de.default.createElement("div",{className:"react-datepicker__quarter-wrapper"},[1,2,3,4].map((function(t,a){return de.default.createElement("div",{key:a,role:"option",onClick:function(n){e.onQuarterClick(n,t)},className:e.getQuarterClassNames(t),"aria-selected":e.isSelectedQuarter(n,t,r)},tn(t,e.props.locale))})))})),xt(_t(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 ue.default("react-datepicker__month",{"react-datepicker__month--selecting-range":n&&(r||a)},{"react-datepicker__monthPicker":s},{"react-datepicker__quarterPicker":i})})),e}return gt(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 de.default.createElement("div",{className:this.getClassNames(),onMouseLeave:this.handleMouseLeave,"aria-label":"".concat(s," ").concat(Pt(r,"yyyy-MM")),role:"listbox"},t?this.renderMonths():n?this.renderQuarters():this.renderWeeks())}}]),n}(de.default.Component),qn=function(e){bt(n,e);var t=It(n);function n(){var e;ht(this,n);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return xt(_t(e=t.call.apply(t,[this].concat(a))),"state",{height:null}),xt(_t(e),"handleClick",(function(t){(e.props.minTime||e.props.maxTime)&&mn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&pn(t,e.props)||e.props.onChange(t)})),xt(_t(e),"isSelectedTime",(function(t,n,r){return e.props.selected&&n===Te.default(t)&&r===Ce.default(t)})),xt(_t(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)&&mn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&pn(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(" ")})),xt(_t(e),"handleOnKeyDown",(function(t,n){" "===t.key&&(t.preventDefault(),t.key="Enter"),"Enter"===t.key&&e.handleClick(n),e.props.handleOnKeyDown(t)})),xt(_t(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=fe.default(a,u*r);if(t.push(p),i){var m=wn(a,p,u,r,i);t=t.concat(m)}}return t.map((function(t,r){return de.default.createElement("li",{key:r,onClick:e.handleClick.bind(_t(e),t),className:e.liClasses(t,l,c),ref:function(n){(at.default(t,d)||Kt(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 gt(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 de.default.createElement("div",{className:"react-datepicker__time-container ".concat(this.props.todayButton?"react-datepicker__time-container--with-today-button":"")},de.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}},de.default.createElement("div",{className:"react-datepicker-time__header"},this.props.timeCaption)),de.default.createElement("div",{className:"react-datepicker__time"},de.default.createElement("div",{className:"react-datepicker__time-box"},de.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}(de.default.Component);xt(qn,"calcCenterPosition",(function(e,t){return t.offsetTop-(e/2-t.clientHeight/2)}));var $n=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"YEAR_REFS",St(Array(r.props.yearItemNumber)).map((function(){return de.default.createRef()}))),xt(_t(r),"isDisabled",(function(e){return nn(e,r.props)})),xt(_t(r),"isExcluded",(function(e){return rn(e,r.props)})),xt(_t(r),"updateFocusOnPaginate",(function(e){var t=function(){this.YEAR_REFS[e].current.focus()}.bind(_t(r));window.requestAnimationFrame(t)})),xt(_t(r),"handleYearClick",(function(e,t){r.props.onDayClick&&r.props.onDayClick(e,t)})),xt(_t(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())})),xt(_t(r),"isSameDay",(function(e,t){return zt(e,t)})),xt(_t(r),"isCurrentYear",(function(e){return e===Re.default(Ot())})),xt(_t(r),"isKeyboardSelected",(function(e){var t=Vt($e.default(r.props.date,e));return!r.props.disabledKeyboardNavigation&&!r.props.inline&&!zt(t,Vt(r.props.selected))&&zt(t,Vt(r.props.preSelection))})),xt(_t(r),"onYearClick",(function(e,t){var n=r.props.date;r.handleYearClick(Vt($e.default(n,t)),e)})),xt(_t(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,ye.default(r.props.preSelection,1));break;case"ArrowLeft":r.handleYearNavigation(t-1,Ie.default(r.props.preSelection,1))}})),xt(_t(r),"getYearClassNames",(function(e){var t=r.props,n=t.minDate,a=t.maxDate,s=t.selected;return ue.default("react-datepicker__year-text",{"react-datepicker__year-text--selected":e===Re.default(s),"react-datepicker__year-text--disabled":(n||a)&&ln(e,r.props),"react-datepicker__year-text--keyboard-selected":r.isKeyboardSelected(e),"react-datepicker__year-text--today":r.isCurrentYear(e)})})),xt(_t(r),"getYearTabIndex",(function(e){return r.props.disabledKeyboardNavigation?"-1":e===Re.default(r.props.preSelection)?"0":"-1"})),r}return gt(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(de.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 de.default.createElement("div",{className:"react-datepicker__year"},de.default.createElement("div",{className:"react-datepicker__year-wrapper"},t))}}]),n}(de.default.Component),Un=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),xt(_t(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)})),xt(_t(r),"renderTimeInput",(function(){var e=r.state.time,t=r.props,n=t.date,a=t.timeString,s=t.customTimeInput;return s?de.default.cloneElement(s,{date:n,value:e,onChange:r.onTimeChange}):de.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 gt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__input-time-container"},de.default.createElement("div",{className:"react-datepicker-time__caption"},this.props.timeInputLabel),de.default.createElement("div",{className:"react-datepicker-time__input-container"},de.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}(de.default.Component);function Zn(e){var t=e.className,n=e.children,r=e.showPopperArrow,a=e.arrowProps,s=void 0===a?{}:a;return de.default.createElement("div",{className:t},r&&de.default.createElement("div",vt({className:"react-datepicker__triangle"},s)),n)}var Vn=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],Wn=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),xt(_t(r=t.call(this,e)),"handleClickOutside",(function(e){r.props.onClickOutside(e)})),xt(_t(r),"setClickOutsideRef",(function(){return r.containerRef.current})),xt(_t(r),"handleDropdownFocus",(function(e){(function(){var e=((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).className||"").split(/\s+/);return Vn.some((function(t){return e.indexOf(t)>=0}))})(e.target)&&r.props.onDropdownFocus()})),xt(_t(r),"getDateInView",(function(){var e=r.props,t=e.preSelection,n=e.selected,a=e.openToDate,s=vn(r.props),i=bn(r.props),o=Ot();return a||n||t||(s&&at.default(o,s)?s:i&&rt.default(o,i)?i:o)})),xt(_t(r),"increaseMonth",(function(){r.setState((function(e){var t=e.date;return{date:be.default(t,1)}}),(function(){return r.handleMonthChange(r.state.date)}))})),xt(_t(r),"decreaseMonth",(function(){r.setState((function(e){var t=e.date;return{date:je.default(t,1)}}),(function(){return r.handleMonthChange(r.state.date)}))})),xt(_t(r),"handleDayClick",(function(e,t,n){r.props.onSelect(e,t,n),r.props.setPreSelection&&r.props.setPreSelection(e)})),xt(_t(r),"handleDayMouseEnter",(function(e){r.setState({selectingDate:e}),r.props.onDayMouseEnter&&r.props.onDayMouseEnter(e)})),xt(_t(r),"handleMonthMouseLeave",(function(){r.setState({selectingDate:null}),r.props.onMonthMouseLeave&&r.props.onMonthMouseLeave()})),xt(_t(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)})),xt(_t(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)})),xt(_t(r),"handleMonthYearChange",(function(e){r.handleYearChange(e),r.handleMonthChange(e)})),xt(_t(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)}))})),xt(_t(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)}))})),xt(_t(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)}))})),xt(_t(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(de.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=xe.default(e,t),a=r.formatWeekday(n,r.props.locale),s=r.props.weekDayClassName?r.props.weekDayClassName(n):void 0;return de.default.createElement("div",{key:t,className:ue.default("react-datepicker__day-name",s)},a)})))})),xt(_t(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)})),xt(_t(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)}))})),xt(_t(r),"renderPreviousButton",(function(){if(!r.props.renderCustomHeader){var e;switch(!0){case r.props.showMonthYearPicker:e=gn(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(Vt(Ie.default(e,a)),a).endPeriod,i=n&&Re.default(n);return i&&i>s||!1}(r.state.date,r.props);break;default:e=hn(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 de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:r.props.handleOnKeyDown,"aria-label":a?p:d},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"].join(" ")},a?r.props.previousYearButtonLabel:r.props.previousMonthButtonLabel))}}})),xt(_t(r),"increaseYear",(function(){r.setState((function(e){var t=e.date;return{date:ye.default(t,r.props.showYearPicker?r.props.yearItemNumber:1)}}),(function(){return r.handleYearChange(r.state.date)}))})),xt(_t(r),"renderNextButton",(function(){if(!r.props.renderCustomHeader){var e;switch(!0){case r.props.showMonthYearPicker:e=xn(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(ye.default(e,a),a).startPeriod,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--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 de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:r.props.handleOnKeyDown,"aria-label":a?p:d},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"].join(" ")},a?r.props.nextYearButtonLabel:r.props.nextMonthButtonLabel))}}})),xt(_t(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"),de.default.createElement("div",{className:t.join(" ")},Pt(e,r.props.dateFormat,r.props.locale))})),xt(_t(r),"renderYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showYearDropdown&&!e)return de.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})})),xt(_t(r),"renderMonthDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showMonthDropdown&&!e)return de.default.createElement(Dn,{dropdownMode:r.props.dropdownMode,locale:r.props.locale,onChange:r.changeMonth,month:Ee.default(r.state.date),useShortMonthInDropdown:r.props.useShortMonthInDropdown})})),xt(_t(r),"renderMonthYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(r.props.showMonthYearDropdown&&!e)return de.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})})),xt(_t(r),"renderTodayButton",(function(){if(r.props.todayButton&&!r.props.showTimeSelectOnly)return de.default.createElement("div",{className:"react-datepicker__today-button",onClick:function(e){return r.props.onSelect(Be.default(Ot()),e)}},r.props.todayButton)})),xt(_t(r),"renderDefaultHeader",(function(e){var t=e.monthDate,n=e.i;return de.default.createElement("div",{className:"react-datepicker__header ".concat(r.props.showTimeSelect?"react-datepicker__header--has-time-select":"")},r.renderCurrentMonth(t),de.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)),de.default.createElement("div",{className:"react-datepicker__day-names"},r.header(t)))})),xt(_t(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=hn(r.state.date,r.props),s=fn(r.state.date,r.props),i=gn(r.state.date,r.props),o=xn(r.state.date,r.props),l=!r.props.showMonthYearPicker&&!r.props.showQuarterYearPicker&&!r.props.showYearPicker;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:r.props.onDropdownFocus},r.props.renderCustomHeader(pt(pt({},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&&de.default.createElement("div",{className:"react-datepicker__day-names"},r.header(t)))})),xt(_t(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 de.default.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},n?"".concat(s," - ").concat(i):Re.default(e))})),xt(_t(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)}})),xt(_t(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=be.default(n,s),o="month-".concat(a),l=a<r.props.monthsShown-1,c=a>0;e.push(de.default.createElement("div",{key:o,ref:function(e){r.monthContainer=e},className:"react-datepicker__month-container"},r.renderHeader({monthDate:i,i:a}),de.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}})),xt(_t(r),"renderYears",(function(){if(!r.props.showTimeSelectOnly)return r.props.showYearPicker?de.default.createElement("div",{className:"react-datepicker__year--container"},r.renderHeader(),de.default.createElement($n,vt({onDayClick:r.handleDayClick,date:r.state.date},r.props))):void 0})),xt(_t(r),"renderTimeSection",(function(){if(r.props.showTimeSelect&&(r.state.monthContainer||r.props.showTimeSelectOnly))return de.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})})),xt(_t(r),"renderInputTimeSection",(function(){var e=new Date(r.props.selected),t=At(e)&&Boolean(r.props.selected)?"".concat(_n(e.getHours()),":").concat(_n(e.getMinutes())):"";if(r.props.showTimeInput)return de.default.createElement(Un,{date:e,timeString:t,timeInputLabel:r.props.timeInputLabel,onChange:r.props.onTimeChange,customTimeInput:r.props.customTimeInput})})),r.containerRef=de.default.createRef(),r.state={date:r.getDateInView(),selectingDate:null,monthContainer:null},r}return gt(n,[{key:"componentDidMount",value:function(){this.props.showTimeSelect&&(this.assignMonthContainer=void this.setState({monthContainer:this.monthContainer}))}},{key:"componentDidUpdate",value:function(e){this.props.preSelection&&!zt(this.props.preSelection,e.preSelection)?this.setState({date:this.props.preSelection}):this.props.openToDate&&!zt(this.props.openToDate,e.openToDate)&&this.setState({date:this.props.openToDate})}},{key:"render",value:function(){var e=this.props.container||Zn;return de.default.createElement("div",{ref:this.containerRef},de.default.createElement(e,{className:ue.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}(de.default.Component),Yn=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),(r=t.call(this,e)).el=document.createElement("div"),r}return gt(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 dt.default.createPortal(this.props.children,this.el)}}]),n}(de.default.Component),Bn=function(e){return!e.disabled&&-1!==e.tabIndex},Hn=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),xt(_t(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(Bn)})),xt(_t(r),"handleFocusStart",(function(e){var t=r.getTabChildren();t&&t.length>1&&t[t.length-1].focus()})),xt(_t(r),"handleFocusEnd",(function(e){var t=r.getTabChildren();t&&t.length>1&&t[0].focus()})),r.tabLoopRef=de.default.createRef(),r}return gt(n,[{key:"render",value:function(){return this.props.enableTabLoop?de.default.createElement("div",{className:"react-datepicker__tab-loop",ref:this.tabLoopRef},de.default.createElement("div",{className:"react-datepicker__tab-loop__start",tabIndex:"0",onFocus:this.handleFocusStart}),this.props.children,de.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}(de.default.Component),zn=function(e){bt(n,e);var t=It(n);function n(){return ht(this,n),t.apply(this,arguments)}return gt(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=ue.default("react-datepicker-popper",n);e=de.default.createElement(le.Popper,vt({modifiers:i,placement:o},l),(function(e){var t=e.ref,n=e.style,r=e.placement,a=e.arrowProps;return de.default.createElement(Hn,{enableTabLoop:d},de.default.createElement("div",{ref:t,style:n,className:h,"data-placement":r,onKeyDown:u},de.default.cloneElement(s,{arrowProps:a})))}))}this.props.popperContainer&&(e=de.default.createElement(this.props.popperContainer,{},e)),p&&!a&&(e=de.default.createElement(Yn,{portalId:p,portalHost:m},e));var f=ue.default("react-datepicker-wrapper",r);return de.default.createElement(le.Manager,{className:"react-datepicker-manager"},de.default.createElement(le.Reference,null,(function(e){var t=e.ref;return de.default.createElement("div",{ref:t,className:f},c)})),e)}}],[{key:"defaultProps",get:function(){return{hidePopper:!0,popperModifiers:[],popperProps:{},popperPlacement:"bottom-start"}}}]),n}(de.default.Component),Kn="react-datepicker-ignore-onclickoutside",Gn=ct.default(Wn),Qn="Date input not valid.",Xn=function(e){bt(n,e);var t=It(n);function n(e){var r;return ht(this,n),xt(_t(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()})),xt(_t(r),"calcInitialState",(function(){var e,t=r.getPreSelection(),n=vn(r.props),a=bn(r.props),s=n&&at.default(t,Be.default(n))?n:a&&rt.default(t,Qe.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:yn(r.props.highlightDates),focused:!1,shouldFocusDayInline:!1}})),xt(_t(r),"clearPreventFocusTimeout",(function(){r.preventFocusTimeout&&clearTimeout(r.preventFocusTimeout)})),xt(_t(r),"setFocus",(function(){r.input&&r.input.focus&&r.input.focus({preventScroll:!0})})),xt(_t(r),"setBlur",(function(){r.input&&r.input.blur&&r.input.blur(),r.cancelFocusInput()})),xt(_t(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:er},(function(){e||r.setState((function(e){return{focused:!!t&&e.focused}}),(function(){!t&&r.setBlur(),r.setState({inputValue:null})}))}))})),xt(_t(r),"inputOk",(function(){return pe.default(r.state.preSelection)})),xt(_t(r),"isCalendarOpen",(function(){return void 0===r.props.open?r.state.open&&!r.props.disabled&&!r.props.readOnly:r.props.open})),xt(_t(r),"handleFocus",(function(e){r.state.preventFocus||(r.props.onFocus(e),r.props.preventOpenOnFocus||r.props.readOnly||r.setOpen(!0)),r.setState({focused:!0})})),xt(_t(r),"cancelFocusInput",(function(){clearTimeout(r.inputFocusTimeout),r.inputFocusTimeout=null})),xt(_t(r),"deferFocusInput",(function(){r.cancelFocusInput(),r.inputFocusTimeout=setTimeout((function(){return r.setFocus()}),1)})),xt(_t(r),"handleDropdownFocus",(function(){r.cancelFocusInput()})),xt(_t(r),"handleBlur",(function(e){(!r.state.open||r.props.withPortal||r.props.showTimeInput)&&r.props.onBlur(e),r.setState({focused:!1})})),xt(_t(r),"handleCalendarClickOutside",(function(e){r.props.inline||r.setOpen(!1),r.props.onClickOutside(e),r.props.withPortal&&e.preventDefault()})),xt(_t(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(_t(r),t),"function"==typeof a.isDefaultPrevented&&!a.isDefaultPrevented())){r.setState({inputValue:a.target.value,lastPreSelectChange:Jn});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)}})),xt(_t(r),"handleSelect",(function(e,t,n){if(r.setState({preventFocus:!0},(function(){return r.prev