MailPoet Newsletters (New) - Version 3.84.1

Version Description

  • 2022-03-14 =
  • Added: more engagement checks before marking subscriber as inactive;
  • Fixed: when scheduling an email, button says "Send" instead of "Schedule".
Download this release

Release Info

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

Code changes from version 3.84.0 to 3.84.1

assets/dist/js/admin.517073b9.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! For license information please see admin.517073b9.js.LICENSE.txt */
2
+ (self.webpackChunkMailPoet3=self.webpackChunkMailPoet3||[]).push([[328],{49868:function(){jQuery.AsyncQueue=function(){var e,t,n,a,r=this,s=[],o=!1;return a=function(){var e=s.shift();e?(e.apply(r,[r]),!1===o&&a()):t&&t.apply(r)},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,a()},this.pause=function(){return o=!0,this},this.failure=function(){if(o=!0,e){var t=[r];for(i=0;i<arguments.length;i++)t.push(arguments[i]);e.apply(r,t)}},this}},78537:function(e,t,n){"use strict";var a={};n.r(a),n.d(a,{canUseWooSubscriptions:function(){return Yo},findFiltersValueForSegment:function(){return tl},getAvailableFilters:function(){return el},getCustomFieldsList:function(){return zo},getErrors:function(){return Jo},getMembershipPlans:function(){return $o},getNewslettersList:function(){return Wo},getProductCategories:function(){return jo},getProducts:function(){return qo},getSegment:function(){return Ko},getSegmentFilter:function(){return Xo},getStaticSegmentsList:function(){return Go},getSubscriberCount:function(){return Qo},getSubscriptionProducts:function(){return Uo},getWooCommerceCountries:function(){return Ho},getWooCommerceCurrencySymbol:function(){return Bo},getWordpressRoles:function(){return Vo}});var r={};n.r(r),n.d(r,{handleSave:function(){return gl},pageLoaded:function(){return fl},setErrors:function(){return cl},setSegment:function(){return ll},updateSegment:function(){return ul},updateSegmentFilter:function(){return dl},updateSegmentFilterFromEvent:function(){return ml},updateSegmentFromEvent:function(){return pl},updateSubscriberCount:function(){return hl}});var i={};n.r(i),n.d(i,{LOAD_SEGMENT:function(){return yl},SAVE_SEGMENT:function(){return bl}});var s=n(45993),o=n.n(s),l=n(97846),c=n.n(l),u=n(73727),d=n(5977),p=n(65311),m=n.n(p),h=n(62948),f=n(89457),g=n.n(f),v=n(45697),y=n.n(v),b=n(57744),w=n(57578);function _(e){let{children:t,dimension:n,segments:a,strings:r}=e;return o().createElement("div",{className:"mailpoet-tags"},t,a&&a.map((e=>o().createElement(w.Z,{key:e.name,dimension:n,variant:"list"},e.name))),r&&r.map((e=>o().createElement(w.Z,{key:e,dimension:n,variant:"list"},e))))}_.propTypes={children:y().node,dimension:y().oneOf(["large"]),segments:y().arrayOf(y().shape({name:y().string.isRequired})),strings:y().arrayOf(y().string)};var E=_,Z=n(33160),I=n(57040),S=n(73126),k=n(44845),T=n(59050);n(20454);class C extends o().Component{constructor(e){super(e),(0,k.Z)(this,"getFieldId",(e=>{const t=e||this.props;return t.field.id||t.field.name})),(0,k.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(T.ZP.isArray(this.props.item[this.props.field.name]))return this.props.item[this.props.field.name].map((e=>e.id))}return null})),(0,k.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),T.ZP.isArray(e)&&void 0!==this.props.field.filter&&(e=e.filter(this.props.field.filter)),e})),(0,k.Z)(this,"getLabel",(e=>void 0!==this.props.field.getLabel?this.props.field.getLabel(e,this.props.item):e.name)),(0,k.Z)(this,"getSearchLabel",(e=>void 0!==this.props.field.getSearchLabel?this.props.field.getSearchLabel(e,this.props.item):null)),(0,k.Z)(this,"getValue",(e=>void 0!==this.props.field.getValue?this.props.field.getValue(e,this.props.item):e.id)),(0,k.Z)(this,"getCount",(e=>void 0!==this.props.field.getCount?this.props.field.getCount(e,this.props.item):null)),(0,k.Z)(this,"getTag",(e=>void 0!==this.props.field.getTag?this.props.field.getTag(e,this.props.item):null)),(0,k.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=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 a=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:a})}void 0!==this.props.field.extendSelect2Options&&(t=Object.assign(t,this.props.field.extendSelect2Options));const a=m()(`#${this.selectRef.current.id}`).select2(t);let r=!1;a.on("select2:unselecting",(()=>{r=!0})),a.on("select2:opening",(e=>{!0===r&&(r=!1,e.preventDefault())})),a.on("change",this.handleChange)})),(0,k.Z)(this,"resetSelect2",(()=>{this.destroySelect2(),this.setupSelect2()})),(0,k.Z)(this,"destroySelect2",(()=>{this.isSelect2Initialized()&&(m()(`#${this.selectRef.current.id}`).select2("destroy"),this.cleanupAfterSelect2())})),(0,k.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,k.Z)(this,"allowMultipleValues",(()=>!0===this.props.field.multiple)),(0,k.Z)(this,"isSelect2Initialized",(()=>!0===m()(`#${this.selectRef.current.id}`).hasClass("select2-hidden-accessible"))),(0,k.Z)(this,"isSelect2Component",(()=>this.allowMultipleValues()||this.props.field.forceSelect2)),(0,k.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?T.ZP.pluck(t,"id"):T.ZP.pluck(t,"id").toString(),a=this.transformChangedValue(n,t);this.props.onValueChange({target:{value:a,name:this.props.field.name,id:e.target.id}})})),(0,k.Z)(this,"transformChangedValue",((e,t)=>"function"==typeof this.props.field.transformChangedValue?this.props.field.transformChangedValue.call(this,e,t):e)),(0,k.Z)(this,"insertEmptyOption",(()=>{if(!this.allowMultipleValues())return this.props.field.placeholder?o().createElement("option",{className:"default"}):void 0})),this.selectRef=o().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),a=this.getValue(e);return o().createElement("option",{key:`option-${e.id}`,className:"default",value:a,title:n},t)}));return o().createElement("div",{className:"mailpoet-form-select mailpoet-form-input"},o().createElement("select",(0,S.Z)({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),this.insertEmptyOption(),n))}}C.propTypes={onValueChange:y().func,field:y().shape({name:y().string.isRequired,values:y().oneOfType([y().object,y().array]),getLabel:y().func,resetSelect2OnUpdate:y().bool,selected:y().func,endpoint:y().string,filter:y().func,getSearchLabel:y().func,getValue:y().func,getCount:y().func,getTag:y().func,placeholder:y().string,remoteQuery:y().object,extendSelect2Options:y().object,multiple:y().bool,forceSelect2:y().bool,transformChangedValue:y().func,disabled:y().bool,validation:y().shape({"data-parsley-required":y().bool,"data-parsley-required-message":y().string,"data-parsley-type":y().string,"data-parsley-errors-container":y().string,maxLength:y().number})}).isRequired,item:y().object,disabled:y().bool,width:y().string},C.defaultProps={onValueChange:function(){},disabled:!1,width:"",item:void 0};var N=C,D=n(27927),x=n.n(D),R=n(38287),O=function(){if(!h.Z.subscribersLimitReached)return null;const e=h.Z.hasValidApiKey,t=h.Z.I18n.t("subscribersLimitNoticeTitle").replace("[subscribersLimit]",h.Z.subscribersLimit),n=h.Z.I18n.t(e?"yourPlanLimit":"freeVersionLimit").replace("[subscribersLimit]",h.Z.subscribersLimit),a=e?h.Z.MailPoetComUrlFactory.getUpgradeUrl(h.Z.pluginPartialKey):h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount+1),r=x()(h.Z.I18n.t("youCanDisableWPUsersList"),/\[link](.*?)\[\/link]/g,(e=>o().createElement("a",{key:"goToSegments",href:"?page=mailpoet-segments"},e)));return o().createElement(R.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0},o().createElement("h3",null,t),o().createElement("p",null,n," ",h.Z.I18n.t("youNeedToUpgrade"),"active"===h.Z.wpSegmentState?o().createElement(o().Fragment,null,o().createElement("br",null),r):null),o().createElement("p",null,o().createElement("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:a},h.Z.I18n.t("upgradeNow")),e&&o().createElement(o().Fragment,null," ",o().createElement("button",{type:"button",className:"button",onClick:async()=>{await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()}},h.Z.I18n.t("refreshMySubscribers")))))};function A(e){let{mssKeyInvalid:t,subscribersCount:n}=e;return t?o().createElement(R.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0},o().createElement("h3",null,h.Z.I18n.t("allSendingPausedHeader")),o().createElement("p",null,x()(h.Z.I18n.t("allSendingPausedBody"),/\[link\](.*?)\[\/link\]/g,(e=>o().createElement("a",{href:"?page=mailpoet-settings#premium",key:"check-sending"},e)))),o().createElement("p",null,o().createElement("a",{href:`https://account.mailpoet.com?s=${n}`,className:"button button-primary",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("allSendingPausedLink")))):null}A.propTypes={mssKeyInvalid:y().bool.isRequired,subscribersCount:y().number.isRequired};var P=A,M=n(30653),L=function(){if(!h.Z.emailVolumeLimitReached)return null;const e=h.Z.I18n.t("emailVolumeLimitNoticeTitle").replace("[emailVolumeLimit]",h.Z.emailVolumeLimit),t=h.Z.I18n.t("youReachedEmailVolumeLimit").replace("[emailVolumeLimit]",h.Z.emailVolumeLimit),n=h.Z.MailPoetComUrlFactory.getUpgradeUrl(h.Z.pluginPartialKey),a=new Date,r=new Date(a.getFullYear(),a.getMonth()+1,1);let i=x()(h.Z.I18n.t("toContinueUpgradeYourPlanOrWaitUntil"),/\[link](.*?)\[\/link]/g,(e=>o().createElement("a",{target:"_blank",rel:"noreferrer",href:n,key:e},e)));return i=x()(i,/<b>\[date]<\/b>\./g,(()=>(0,M.ZP)(`<b>${h.Z.Date.short(r)}</b>.`))),o().createElement(R.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0},o().createElement("h3",null,e),o().createElement("p",null,t,o().createElement("br",null),i),o().createElement("p",null,o().createElement("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:n},h.Z.I18n.t("upgradeNow"))," ",o().createElement("button",{type:"button",className:"button",onClick:async()=>{await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()}},h.Z.I18n.t("refreshMyEmailVolumeLimit"))))};function F(e){let{cacheCalculation:t}=e;const[n,a]=(0,s.useState)(!1),[r,i]=(0,s.useState)([]),l=(new Date).getTime()-new Date(t).getTime(),c=Math.floor(l/1e3/60);return o().createElement("div",{className:"mailpoet-subscribers-cache-notice"},x()(h.Z.I18n.t("subscribersCountWereCalculatedWithMinutesAgo"),/<abbr>(.*?)<\/abbr>/,((e,n)=>o().createElement("abbr",{key:n,title:t},e.replace(/(\{\$mins\}|\$mins)/i,String(c))))),o().createElement(b.Z,{className:"mailpoet-subscribers-cache-notice-button",type:"button",variant:"secondary",dimension:"small",onClick:()=>{a(!0),h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"settings",action:"recalculateSubscribersCountsCache"}).done((()=>{window.location.reload()})).fail((e=>{i(e.errors.map((e=>e.message))),a(!1)}))},withSpinner:n},h.Z.I18n.t("recalculateNow")),o().createElement("div",{className:"mailpoet-gap"}),r.length>0&&o().createElement(R.Z,{type:"error"},r.map((e=>o().createElement("p",{key:e},e)))))}F.propTypes={cacheCalculation:y().string.isRequired};var q=n(69223),$=n.n(q);function U(e){let{subscribersInPlan:t,subscribersInPlanLimit:n}=e;if(!1===t)return null;const a=n?o().createElement("b",{key:"subscribers_count"},h.Z.I18n.t("subscribersInPlanCount").replace("%1$d",t.toLocaleString()).replace("%2$d",n.toLocaleString())):o().createElement("b",{key:"subscribers_count"},t);return o().createElement("div",{className:"mailpoet-subscribers-in-plan"},x()(h.Z.I18n.t("subscribersInPlan"),"%s",(()=>a))," ",o().createElement($(),{tooltip:h.Z.I18n.t("subscribersInPlanTooltip"),place:"right"}),o().createElement("span",{className:"mailpoet-subscribers-in-plan-spacer"}," "))}U.propTypes={subscribersInPlan:y().oneOfType([y().number,y().oneOf([!1])]).isRequired,subscribersInPlanLimit:y().oneOfType([y().number,y().oneOf([!1])]).isRequired};var V=U,j=n(99181),W=o().createElement("svg",{viewBox:"4 4 16 16"},o().createElement("path",{d:"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"}));function Y(e){let{location:t}=e;return o().createElement(j.Q,null,o().createElement(u.rU,{className:"mailpoet-button button-secondary",to:{pathname:"/new",state:{backUrl:t?.pathname}}},W,o().createElement("span",{"data-automation-id":"add-new-subscribers-button"},h.Z.I18n.t("new"))),o().createElement("a",{className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-import","data-automation-id":"import-subscribers-button"},h.Z.I18n.t("import")),o().createElement("a",{id:"mailpoet_export_button",className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-export"},h.Z.I18n.t("export")))}Y.propTypes={location:y().object.isRequired};var B=(0,d.withRouter)(Y),H=n(53423);function z(e){let{id:t,engagementScore:n}=e;const a={unknown:{name:h.Z.I18n.t("unknownBadgeName"),type:"unknown",tooltipTitle:h.Z.I18n.t("unknownBadgeTooltip"),tooltipText:h.Z.I18n.t("tooltipUnknown")},excellent:{name:h.Z.I18n.t("excellentBadgeName"),type:"excellent",tooltipTitle:h.Z.I18n.t("excellentBadgeTooltip"),tooltipText:h.Z.I18n.t("tooltipExcellent")},good:{name:h.Z.I18n.t("goodBadgeName"),type:"good",tooltipTitle:h.Z.I18n.t("goodBadgeTooltip"),tooltipText:h.Z.I18n.t("tooltipGood")},average:{name:h.Z.I18n.t("averageBadgeName"),type:"average",tooltipTitle:h.Z.I18n.t("averageBadgeTooltip"),tooltipText:h.Z.I18n.t("tooltipAverage")}},r=`badge-${t}`;let i;i=null==n?a.unknown:n<20?a.average:n<50?a.good:a.excellent;const s=o().createElement("div",{key:`tooltip-${r}`},o().createElement("div",{className:"mailpoet-listing-stats-tooltip-title"},i.tooltipTitle.toUpperCase()),o().createElement("div",{className:"mailpoet-listing-stats-tooltip-description"},h.Z.I18n.t("engagementScoreDescription")),o().createElement("div",{className:"mailpoet-listing-stats-tooltip-content"},o().createElement(H.Z,{type:"unknown",name:h.Z.I18n.t("unknownBadgeName")})," : ",a.unknown.tooltipText,o().createElement("br",null),o().createElement(H.Z,{type:"excellent",name:h.Z.I18n.t("excellentBadgeName")})," : ",a.excellent.tooltipText,o().createElement("br",null),o().createElement(H.Z,{type:"good",name:h.Z.I18n.t("goodBadgeName")})," : ",a.good.tooltipText,o().createElement("br",null),o().createElement(H.Z,{type:"average",name:h.Z.I18n.t("averageBadgeName")})," : ",a.average.tooltipText));return o().createElement("div",{className:"mailpoet-listing-stats-opened-clicked"},null!=n&&o().createElement("div",{className:"mailpoet-listing-stats-percentages"},n.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),"%"),o().createElement("div",null,o().createElement(H.Z,{isInverted:!0,type:i.type,name:i.name,tooltip:s,tooltipId:r,tooltipPlace:"top"})))}z.propTypes={id:y().number.isRequired,engagementScore:y().number};const K=h.Z.trackingConfig.emailTrackingEnabled,G=[{name:"email",label:h.Z.I18n.t("subscriber"),sortable:!0},{name:"status",label:h.Z.I18n.t("status"),sortable:!0},{name:"segments",label:h.Z.I18n.t("lists")},{name:"statistics",label:h.Z.I18n.t("statisticsColumn"),display:K},{name:"created_at",label:h.Z.I18n.t("subscribedOn"),sortable:!0}],Q={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneSubscriberTrashed"):h.Z.I18n.t("multipleSubscribersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneSubscriberDeleted"):h.Z.I18n.t("multipleSubscribersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneSubscriberRestored"):h.Z.I18n.t("multipleSubscribersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onNoItemsFound:e=>"bounced"===e&&!window.mailpoet_premium_active&&!window.mailpoet_mss_active&&o().createElement("div",null,o().createElement("p",null,h.Z.I18n.t("bouncedSubscribersHelp")),o().createElement("p",null,o().createElement("a",{href:"admin.php?page=mailpoet-upgrade",className:"button-primary"},h.Z.I18n.t("bouncedSubscribersPremiumButtonText"))))},X=(e,t,n,a)=>o().createElement(I.Z,{title:a,onRequestClose:t,isDismissible:!0},o().createElement(N,{field:n}),o().createElement("span",{className:"mailpoet-gap-half"}),o().createElement(b.Z,{onClick:e,dimension:"small",variant:"secondary"},h.Z.I18n.t("apply"))),J=[{name:"moveToList",label:h.Z.I18n.t("moveToList"),onSelect:function(e,t){return X(e,t,{id:"move_to_segment",name:"move_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},h.Z.I18n.t("moveToList"))},getData:function(){return{segment_id:Number(m()("#move_to_segment").val())}},onSuccess:function(e){h.Z.Notice.success(h.Z.I18n.t("multipleSubscribersMovedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"addToList",label:h.Z.I18n.t("addToList"),onSelect:function(e,t){return X(e,t,{id:"add_to_segment",name:"add_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},h.Z.I18n.t("addToList"))},getData:function(){return{segment_id:Number(m()("#add_to_segment").val())}},onSuccess:function(e){h.Z.Notice.success(h.Z.I18n.t("multipleSubscribersAddedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromList",label:h.Z.I18n.t("removeFromList"),onSelect:function(e,t){return X(e,t,{id:"remove_from_segment",name:"remove_from_segment",endpoint:"segments",filter:function(e){return!("default"!==e.type)}},h.Z.I18n.t("removeFromList"))},getData:function(){return{segment_id:Number(m()("#remove_from_segment").val())}},onSuccess:function(e){h.Z.Notice.success(h.Z.I18n.t("multipleSubscribersRemovedFromList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromAllLists",label:h.Z.I18n.t("removeFromAllLists"),onSuccess:function(e){h.Z.Notice.success(h.Z.I18n.t("multipleSubscribersRemovedFromAllLists").replace("%1$d",Number(e.meta.count).toLocaleString()))}},{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Q.onTrash},{name:"unsubscribe",label:h.Z.I18n.t("unsubscribe"),onSelect:(e,t,n)=>{const a="all"!==n.selection?n.selected_ids.length:n.count;return o().createElement(I.Z,{title:h.Z.I18n.t("unsubscribe"),onRequestClose:t,isDismissible:!0},o().createElement("p",null,h.Z.I18n.t("unsubscribeConfirm").replace("%s",a.toLocaleString())),o().createElement("span",{className:"mailpoet-gap-half"}),o().createElement(b.Z,{onClick:e,dimension:"small",variant:"secondary",automationId:"bulk-unsubscribe-confirm"},h.Z.I18n.t("apply")))}}],ee=[{name:"statistics",label:h.Z.I18n.t("statsListingActionTitle"),link:function(e,t){return o().createElement(u.rU,{to:{pathname:`/stats/${e.id}`,state:{backUrl:t?.pathname}}},h.Z.I18n.t("statsListingActionTitle"))}},{name:"edit",label:h.Z.I18n.t("edit"),link:function(e,t){return o().createElement(u.rU,{to:{pathname:`/edit/${e.id}`,state:{backUrl:t?.pathname}}},h.Z.I18n.t("edit"))}},{name:"sendConfirmationEmail",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("resendConfirmationEmail"),display:function(e){return"unconfirmed"===e.status&&e.count_confirmations<window.mailpoet_max_confirmation_emails},onClick:function(e){return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"subscribers",action:"sendConfirmationEmail",data:{id:e.id}}).done((()=>h.Z.Notice.success(h.Z.I18n.t("oneConfirmationEmailSent")))).fail((e=>h.Z.Notice.showApiErrorNotice(e)))}},{name:"trash",className:"mailpoet-hide-on-mobile"}],te=e=>0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user);function ne(e){let{match:t}=e;const n=(0,d.useLocation)();return o().createElement("div",null,o().createElement(B,null),o().createElement(V,{subscribersInPlan:h.Z.subscribersCount,subscribersInPlanLimit:h.Z.subscribersLimit}),o().createElement(O,null),o().createElement(L,null),o().createElement(P,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),o().createElement(F,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:n,params:t.params,endpoint:"subscribers",onRenderItem:(e,t)=>{const a=g()("manage-column","column-primary","has-row-actions","column-username");let r="";switch(e.status){case"subscribed":r=h.Z.I18n.t("subscribed");break;case"unconfirmed":r=h.Z.I18n.t("unconfirmed");break;case"unsubscribed":r=h.Z.I18n.t("unsubscribed");break;case"inactive":r=h.Z.I18n.t("inactive");break;case"bounced":r=h.Z.I18n.t("bounced");break;default:r="Invalid"}const i=[];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&&i.push(t)})),o().createElement("div",null,o().createElement("td",{className:a},o().createElement(u.rU,{className:"mailpoet-listing-title",to:{pathname:`/edit/${e.id}`,state:{backUrl:n?.pathname}}},e.email),o().createElement("div",{className:"mailpoet-listing-subtitle"},e.first_name," ",e.last_name),t),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},r),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("lists")},o().createElement(E,{segments:i,dimension:"large"})),!0===K?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statisticsColumn")},o().createElement("div",{className:"mailpoet-listing-stats"},o().createElement("a",{key:`stats-link-${e.id}`,href:`#/stats/${e.id}`},o().createElement(z,{id:e.id,engagementScore:e.engagement_score})))):null,o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribedOn")},h.Z.Date.short(e.created_at),o().createElement("br",null),h.Z.Date.time(e.created_at)))},columns:G,bulk_actions:J,item_actions:ee,messages:Q,sort_by:"created_at",sort_order:"desc",isItemDeletable:te}))}ne.propTypes={match:y().shape({params:y().object}).isRequired};var ae=ne,re=n(30381),ie=n.n(re),se=n(17123),oe=n.n(se),le=n(60017);class ce extends o().Component{render(){const e=this.props.field.name||null,t=this.props.item||{};let n,a;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&&(a=this.props.field.defaultValue);let r=this.props.field.id||null;!r&&this.props.field.name&&(r=`field_${this.props.field.name}`);let i=this.props.field.className||null;return i||this.props.field.size||(i="regular-text"),o().createElement(le.Z,(0,S.Z)({type:"text",disabled:void 0!==this.props.field.disabled&&this.props.field.disabled(this.props.item),className:i,size:"auto"!==this.props.field.size&&this.props.field.size>0?this.props.field.size:null,name:e,id:r,value:n,defaultValue:a,placeholder:this.props.field.placeholder,onChange:this.props.onValueChange,customLabel:this.props.field.customLabel,tooltip:this.props.field.tooltip},this.props.field.validation))}}ce.propTypes={onValueChange:y().func,field:y().shape({name:y().string.isRequired,defaultValue:y().string,id:y().string,className:y().string,size:y().oneOfType([y().string,y().number]),disabled:y().func,placeholder:y().string,validation:y().shape({"data-parsley-required":y().bool,"data-parsley-required-message":y().string,"data-parsley-type":y().string,"data-parsley-errors-container":y().string,maxLength:y().number}),customLabel:y().string,tooltip:y().string}).isRequired,item:y().object.isRequired},ce.defaultProps={onValueChange:function(){}};var ue=ce,de=n(97972);function pe(e){return o().createElement(de.Z,(0,S.Z)({type:"text",name:e.field.name,id:`field_${e.field.name}`,value:e.item[e.field.name],placeholder:e.field.placeholder,defaultValue:e.field.defaultValue,onChange:e.onValueChange,className:e.field.className,customLabel:e.field.customLabel,tooltip:e.field.tooltip},e.field.validation))}pe.propTypes={item:y().object.isRequired,field:y().shape({name:y().string,placeholder:y().string,defaultValue:y().string,validation:y().shape({"data-parsley-required":y().bool,"data-parsley-required-message":y().string,"data-parsley-type":y().string,"data-parsley-errors-container":y().string,maxLength:y().number}),className:y().string,customLabel:y().string,tooltip:y().string}).isRequired,onValueChange:y().func.isRequired};var me=pe,he=n(2141);class fe extends o().Component{render(){if(void 0===this.props.field.values)return!1;let e,t=!1,n=!1,a=!1;void 0!==this.props.field.placeholder&&(n=o().createElement("option",{value:""},this.props.field.placeholder)),void 0!==this.props.field.filter&&(t=this.props.field.filter),T.ZP.isFunction(this.props.field.sortBy)&&(a=this.props.field.sortBy),e=a?T.ZP.map(T.ZP.sortBy(T.ZP.pairs(this.props.field.values),(e=>a(e[0],e[1]))),(e=>e[0])):Object.keys(this.props.field.values);const r=e.filter((e=>!1===t||t(this.props.item,e))).map((e=>o().createElement("option",{key:`option-${e}`,value:e},this.props.field.values[e])));return o().createElement(he.Z,(0,S.Z)({name:this.props.field.name,id:`field_${this.props.field.name}`,value:this.props.item[this.props.field.name]||"",onChange:this.props.onValueChange,automationId:this.props.automationId},this.props.field.validation),n,r)}}fe.propTypes={onValueChange:y().func,field:y().shape({name:y().string.isRequired,values:y().objectOf(y().string),placeholder:y().string,filter:y().func,sortBy:y().func,validation:y().shape({"data-parsley-required":y().bool,"data-parsley-required-message":y().string,"data-parsley-type":y().string,"data-parsley-errors-container":y().string,maxLength:y().number})}).isRequired,item:y().object.isRequired,automationId:y().string},fe.defaultProps={automationId:"",onValueChange:function(){}};var ge=fe,ve=n(84868);class ye extends o().Component{constructor(e){super(e),(0,k.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=>o().createElement("p",{key:`radio-${t}`},o().createElement(ve.Z,{checked:e===t,value:t,onCheck:this.onValueChange,name:this.props.field.name},this.props.field.values[t]))));return o().createElement("div",null,t)}}ye.propTypes={onValueChange:y().func,field:y().shape({name:y().string.isRequired,values:y().objectOf(y().string)}).isRequired,item:y().object.isRequired},ye.defaultProps={onValueChange:function(){}};var be=ye,we=n(16277);class _e extends o().Component{constructor(e){super(e),(0,k.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=>o().createElement("p",{key:`checkbox-${t}`},o().createElement(we.Z,{value:"1",checked:e,name:this.props.field.name,onCheck:this.onValueChange},this.props.field.values[t]))));return o().createElement("div",null,t)}}_e.propTypes={onValueChange:y().func.isRequired,field:y().shape({name:y().string.isRequired,values:y().objectOf(y().string)}).isRequired,item:y().object.isRequired};var Ee=_e;function Ze(e){const t=[];void 0!==e.placeholder&&t.push(o().createElement("option",{value:"",key:0},e.placeholder));const n=ie()().year();for(let e=n;e>=n-100;e-=1)t.push(o().createElement("option",{key:e,value:e},e));return o().createElement(he.Z,{isMinWidth:!0,name:`${e.name}[year]`,value:e.year,onChange:e.onValueChange},t)}function Ie(e){const t=[];void 0!==e.placeholder&&t.push(o().createElement("option",{value:"",key:0},e.placeholder));for(let n=1;n<=12;n+=1)t.push(o().createElement("option",{key:n,value:n},e.monthNames[n-1]));return o().createElement(he.Z,{isMinWidth:!0,name:`${e.name}[month]`,value:e.month,onChange:e.onValueChange},t)}function Se(e){const t=[];void 0!==e.placeholder&&t.push(o().createElement("option",{value:"",key:0},e.placeholder));for(let e=1;e<=31;e+=1)t.push(o().createElement("option",{key:e,value:e},e));return o().createElement(he.Z,{isMinWidth:!0,name:`${e.name}[day]`,value:e.day,onChange:e.onValueChange},t)}Ze.propTypes={name:y().string.isRequired,placeholder:y().string.isRequired,onValueChange:y().func.isRequired,year:y().oneOfType([y().string,y().number]).isRequired},Ie.propTypes={name:y().string.isRequired,placeholder:y().string.isRequired,onValueChange:y().func.isRequired,month:y().oneOfType([y().string,y().number]).isRequired,monthNames:y().arrayOf(y().string).isRequired},Se.propTypes={name:y().string.isRequired,placeholder:y().string.isRequired,onValueChange:y().func.isRequired,day:y().oneOfType([y().string,y().number]).isRequired};class ke extends o().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,a=null;if(null!==t&&3===t.length){[,n,a]=t;const r=Number(e.target.value);this.setState({[`${a}`]:r},(()=>{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=ie()(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 o().createElement(Ze,{onValueChange:this.onValueChange,key:"year",name:this.props.field.name,year:this.state.year,placeholder:this.props.field.year_placeholder});case"MM":return o().createElement(Ie,{onValueChange:this.onValueChange,key:"month",name:this.props.field.name,month:this.state.month,monthNames:e,placeholder:this.props.field.month_placeholder});case"DD":return o().createElement(Se,{onValueChange:this.onValueChange,key:"day",name:this.props.field.name,day:this.state.day,placeholder:this.props.field.day_placeholder});default:return o().createElement("div",null,"Invalid date type")}}));return o().createElement("div",null,n)}}ke.propTypes={item:y().object.isRequired,field:y().shape({name:y().string,day_placeholder:y().string,month_placeholder:y().string,year_placeholder:y().string,params:y().object}).isRequired,onValueChange:y().func.isRequired};var Te=ke,Ce=n(22529);class Ne extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"renderField",(e=>{let t,n=!1;e.field.description&&(n=o().createElement("p",{className:"description"},e.field.description));let a=e.field;switch(void 0!==e.field.field&&(a=m().merge(a,e.field.field)),a.type){case"text":t=o().createElement(ue,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"textarea":t=o().createElement(me,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"select":t=o().createElement(ge,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"radio":t=o().createElement(be,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"checkbox":t=o().createElement(Ee,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"selection":t=o().createElement(N,{key:`selection-field-${a.name}`,onValueChange:e.onValueChange,field:e.field,automationId:e.automationId,inline:e.inline,description:e.description,item:e.item});break;case"date":t=o().createElement(Te,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"reactComponent":t=o().createElement(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 o().createElement("div",{className:"mailpoet-form-field",key:`field-${e.index||0}`},t,n)}))}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=o().createElement(Ce.Z,{level:4},o().createElement("label",{htmlFor:`field_${this.props.field.name}`},this.props.field.label)));let n=!1;return this.props.field.tip&&(n=o().createElement("p",{className:"mailpoet-form-description"},this.props.field.tip)),o().createElement("div",{className:`mailpoet-form-field-${this.props.field.name} form-field-row-${this.props.field.name}`},t,n,e)}}Ne.propTypes={onValueChange:y().func,field:y().shape({name:y().string.isRequired,values:y().objectOf(y().string),tip:y().oneOfType([y().array,y().string]),label:y().string,fields:y().arrayOf(y().object),description:y().string}).isRequired,item:y().object.isRequired},Ne.defaultProps={onValueChange:function(){}};var De=Ne,xe=n(73816);class Re extends o().Component{constructor(e){super(e),(0,k.Z)(this,"getValues",(()=>this.props.item||this.state.item)),(0,k.Z)(this,"getErrors",(()=>this.props.errors||this.state.errors)),(0,k.Z)(this,"loadItem",(e=>{this.setState({loading:!0}),this.props.endpoint&&h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:this.props.endpoint,action:"get",data:{id:e}}).done((e=>{this.setState({loading:!1,item:e.data}),"function"==typeof this.props.onItemLoad&&this.props.onItemLoad(e.data)})).fail((()=>{this.setState({loading:!1,item:{}},(function(){this.props.history.push("/lists")}))}))})),(0,k.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&&h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:this.props.endpoint,action:"save",data:t}).always((()=>{this.setState({loading:!1})})).done((()=>{void 0!==this.props.onSuccess?this.props.onSuccess():this.props.history.push("/"),void 0!==this.props.params.id?this.props.messages.onUpdate():this.props.messages.onCreate()})).fail((e=>{e.errors.length>0&&this.setState({errors:e.errors})}))})),(0,k.Z)(this,"handleValueChange",(e=>{const{name:t,value:n}=e.target;return this.props.onChange?this.props.onChange(e):(this.setState((e=>{const a=e.item;return a[t]=n,{item:a}})),!0)})),this.formRef=o().createRef(),this.state={loading:!1,errors:[],item:{}}}componentDidMount(){void 0!==this.props.params.id?this.loadItem(this.props.params.id):oe()((()=>{this.setState({item:m()(".mailpoet_form").mailpoetSerializeObject()})}))}componentDidUpdate(e){void 0===this.props.params.id&&e.location.pathname!==this.props.location.pathname&&(oe()((()=>{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=>o().createElement("div",{className:"mailpoet_notice notice inline error is-dismissible",key:`error-${e.message}`},o().createElement("p",null,e.message)))));const t=g()("mailpoet_form",{mailpoet_form_loading:this.state.loading||this.props.loading});let n=!1,a=!1;void 0!==this.props.beforeFormContent&&(n=this.props.beforeFormContent(this.getValues())),void 0!==this.props.afterFormContent&&(a=this.props.afterFormContent(this.getValues()));const r=this.props.fields.map((e=>{let t=this.handleValueChange;return e.onBeforeChange&&(t=t=>(e.onBeforeChange(t),this.handleValueChange(t))),o().createElement(De,{field:e,item:this.getValues(),onValueChange:t,key:`field-${e.name}`,automationId:e.automationId})}));let i=!1;return i=this.props.children?this.props.children:o().createElement(xe.Button,{type:"submit",isDisabled:this.state.loading},h.Z.I18n.t("save")),o().createElement("div",null,o().createElement("div",{className:"mailpoet-form-content-around"},n),o().createElement("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},e,o().createElement("div",{className:"mailpoet-form-grid"},r,o().createElement("div",{className:"mailpoet-form-actions"},i))),o().createElement("div",{className:"mailpoet-form-content-around"},a))}}Re.propTypes={params:y().shape({id:y().string}),location:y().shape({pathname:y().string}),item:y().object,errors:y().arrayOf(y().object),endpoint:y().string,fields:y().arrayOf(y().object),messages:y().shape({onUpdate:y().func,onCreate:y().func}),loading:y().bool,children:y().array,id:y().string,automationId:y().string,beforeFormContent:y().func,afterFormContent:y().func,onItemLoad:y().func,isValid:y().func,onChange:y().func,onSubmit:y().func,onSuccess:y().func,history:y().shape({push:y().func.isRequired}).isRequired},Re.defaultProps={params:{},location:{},errors:void 0,fields:void 0,item:void 0,onItemLoad:void 0,isValid:void 0,onSuccess:void 0,onChange:void 0,loading:!1,beforeFormContent:void 0,afterFormContent:void 0,children:void 0,id:"",onSubmit:void 0,automationId:"",messages:{onUpdate:()=>{},onCreate:()=>{}},endpoint:void 0};var Oe=(0,d.withRouter)(Re),Ae=n(86529),Pe=n(71014);const Me=[{name:"email",label:h.Z.I18n.t("email"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"first_name",label:h.Z.I18n.t("firstname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"last_name",label:h.Z.I18n.t("lastname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"status",label:h.Z.I18n.t("status"),type:"select",automationId:"subscriber-status",values:{subscribed:h.Z.I18n.t("subscribed"),unconfirmed:h.Z.I18n.t("unconfirmed"),unsubscribed:h.Z.I18n.t("unsubscribed"),inactive:h.Z.I18n.t("inactive"),bounced:h.Z.I18n.t("bounced")}},{name:"segments",label:h.Z.I18n.t("lists"),type:"selection",placeholder:h.Z.I18n.t("selectList"),tip:h.Z.I18n.t("welcomeEmailTip"),api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,selected:function(e){return!1===Array.isArray(e.subscriptions)?null:e.subscriptions.filter((e=>"subscribed"===e.status)).map((e=>e.segment_id))},filter:function(e){return!e.deleted_at&&"default"===e.type},getLabel:function(e){return e.name},getCount:function(e){return e.subscribers},getSearchLabel:function(e,t){let n="";return void 0!==t.subscriptions&&t.subscriptions.forEach((t=>{if(e.id===t.segment_id&&(n=e.name,"unsubscribed"===t.status)){const e=h.Z.Date.format(t.updated_at);n+=" (%1$s)".replace("%1$s",h.Z.I18n.t("unsubscribedOn").replace("%1$s",e))}})),n}}];(window.mailpoet_custom_fields||[]).forEach((e=>{const t={name:`cf_${e.id}`,label:e.name,type:e.type};switch(e.params&&(t.params=e.params,e.params.values&&(t.values=e.params.values)),e.type){case"date":t.year_placeholder=h.Z.I18n.t("year"),t.month_placeholder=h.Z.I18n.t("month"),t.day_placeholder=h.Z.I18n.t("day");break;case"select":t.placeholder="-";break;default:t.placeholder=""}Me.push(t)}));const Le={onUpdate:function(){h.Z.Notice.success(h.Z.I18n.t("subscriberUpdated"))},onCreate:function(){h.Z.Notice.success(h.Z.I18n.t("subscriberAdded")),h.Z.trackEvent("Subscribers > Add new")}};function Fe(e){if(Number(e.wp_user_id)>0)return o().createElement("p",{className:"description"},x()(h.Z.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,((t,n)=>o().createElement("a",{key:n,href:`user-edit.php?user_id=${e.wp_user_id}`},t))))}function qe(e){return o().createElement(o().Fragment,null,e?.unsubscribes?.map((e=>{const t=ie()(e.createdAt.date).format("dddd MMMM Do YYYY [at] h:mm:ss a");let n;return n="admin"===e.source?h.Z.I18n.t("unsubscribedAdmin").replace("%1$d",t).replace("%2$d",e.meta):"manage"===e.source?h.Z.I18n.t("unsubscribedManage").replace("%1$d",t):"newsletter"===e.source?x()(h.Z.I18n.t("unsubscribedNewsletter").replace("%1$d",t),/\[link\]/g,((t,n)=>o().createElement("a",{key:n,href:`admin.php?page=mailpoet-newsletter-editor&id=${e.newsletterId}`},e.newsletterSubject))):h.Z.I18n.t("unsubscribedUnknown").replace("%1$d",t),o().createElement("p",{className:"description",key:n},n)})),o().createElement("p",{className:"description"},o().createElement("strong",null,h.Z.I18n.t("tip"))," ",h.Z.I18n.t("customFieldsTip")))}function $e(e){let{match:t}=e;const n=(0,d.useLocation)(),a=(0,d.useHistory)(),r=n.state?.backUrl||"/";return o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(Pe.Z,null),o().createElement(Ce.Z,{level:1,className:"mailpoet-title"},o().createElement("span",null,h.Z.I18n.t("subscriber")),o().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:r},h.Z.I18n.t("backToList"))),o().createElement(O,null),o().createElement(Oe,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:Me,params:t.params,messages:Le,beforeFormContent:Fe,afterFormContent:qe,onSuccess:()=>a.push(r)}))}$e.propTypes={match:y().shape({params:y().shape({id:y().string}).isRequired}).isRequired};var Ue=$e,Ve=n(5830),je=n(71304);function We(e){let{email:t}=e;const n=(0,d.useLocation)().state?.backUrl||"/";return o().createElement(Ce.Z,{level:1,className:"mailpoet-title"},o().createElement("span",null,h.Z.I18n.t("statsHeading").replace("%s",t)),o().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:n},h.Z.I18n.t("backToList")))}We.propTypes={email:y().string.isRequired};var Ye=n(83213);function Be(e){let{totalSent:t,open:n,machineOpen:a,click:r,subscriber:i}=e,s=0,l=0,c=0,u=0;const d=t-(n+a),p=t>0;return p&&(s=Math.round(n/t*100),l=Math.round(a/t*100),c=Math.round(r/t*100),u=Math.round(d/t*100)),o().createElement("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary"},o().createElement("div",{className:"mailpoet-listing"},o().createElement("table",{className:"mailpoet-listing-table"},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,h.Z.I18n.t("statsSentEmail")),o().createElement("td",null,o().createElement("b",null,t.toLocaleString())),o().createElement("td",null)),o().createElement("tr",null,o().createElement("td",null,o().createElement(w.Z,null,h.Z.I18n.t("statsOpened"))),o().createElement("td",null,o().createElement("b",null,n.toLocaleString())),o().createElement("td",null,p&&o().createElement(o().Fragment,null,s,"%"))),o().createElement("tr",null,o().createElement("td",null,o().createElement(w.Z,null,h.Z.I18n.t("statsMachineOpened")),o().createElement(Ye.Z,{tooltip:x()(h.Z.I18n.t("statsMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>o().createElement("span",{style:{pointerEvents:"all"},key:"machine-opened-info"},o().createElement("a",{href:"https://kb.mailpoet.com/article/368-what-are-machine-opens",key:"kb-link",target:"_blank","data-beacon-article":"6124b7fb21ef206e5592e188",rel:"noopener noreferrer"},e))))})),o().createElement("td",null,o().createElement("b",null,a.toLocaleString())),o().createElement("td",null,p&&o().createElement(o().Fragment,null,l,"%"))),o().createElement("tr",null,o().createElement("td",null,o().createElement(w.Z,{isInverted:!0},h.Z.I18n.t("statsClicked"))),o().createElement("td",null,o().createElement("b",null,r.toLocaleString())),o().createElement("td",null,p&&o().createElement(o().Fragment,null,c,"%"))),o().createElement("tr",null,o().createElement("td",null,h.Z.I18n.t("statsNotClicked")),o().createElement("td",null,o().createElement("b",null,d.toLocaleString())),o().createElement("td",null,p&&o().createElement(o().Fragment,null,u,"%"))),o().createElement("tr",null,o().createElement("td",null,h.Z.I18n.t("statisticsColumn")),o().createElement("td",null,o().createElement("div",{className:"mailpoet-listing-stats"},o().createElement(z,{id:i.id,engagementScore:i.engagement_score}))),o().createElement("td",null))))))}function He(e){let{revenueValue:t,count:n,averageRevenueValue:a}=e;return o().createElement("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary"},o().createElement("div",{className:"mailpoet-listing"},o().createElement("table",{className:"mailpoet-listing-table"},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,"Orders created"),o().createElement("td",null,o().createElement("b",null,n.toLocaleString()))),o().createElement("tr",null,o().createElement("td",null,"Total revenue"),o().createElement("td",null,o().createElement("b",null,t))),o().createElement("tr",null,o().createElement("td",null,"Average revenue"),o().createElement("td",null,o().createElement("b",null,a)))))))}Be.propTypes={totalSent:y().number.isRequired,open:y().number.isRequired,machineOpen:y().number.isRequired,click:y().number.isRequired,subscriber:y().shape({id:y().number.isRequired,engagement_score:y().number}).isRequired},He.propTypes={count:y().number.isRequired,revenueValue:y().string.isRequired,averageRevenueValue:y().string.isRequired};var ze=n(90074),Ke=n.n(ze),Ge=n(58901);function Qe(e){let{limitReached:t,limitValue:n,subscribersCountTowardsLimit:a,premiumActive:r,hasValidApiKey:i,hasPremiumSupport:s}=e;return o().createElement("table",{className:"mailpoet-listing-table","data-automation-id":"subscriber-stats-no-access"},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",null,h.Z.I18n.t("email")),o().createElement("th",null,h.Z.I18n.t("columnAction")),o().createElement("th",null,h.Z.I18n.t("columnCount")),o().createElement("th",null,h.Z.I18n.t("columnActionOn")))),o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{colSpan:4},o().createElement("div",{className:"mailpoet-subscriber-stats-no-access-content"},o().createElement(Ge.Z,{title:r&&t?h.Z.I18n.t("upgradeRequired"):h.Z.I18n.t("premiumFeature"),message:(()=>{let e=h.Z.I18n.t("premiumRequired");return r?(e=s?h.Z.I18n.t("planLimitReached"):h.Z.I18n.t("freeLimitReached"),o().createElement("p",null,x()(e,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?a:n)))):o().createElement("p",null,x()(e,/\[link](.*?)\[\/link]/g,(e=>o().createElement("a",{key:e,href:h.Z.premiumLink},e))))})(),actionButton:r&&t?o().createElement(b.Z,{href:i?h.Z.MailPoetComUrlFactory.getUpgradeUrl():h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(a+1)},h.Z.I18n.t("premiumBannerCtaUpgrade")):o().createElement(b.Z,{href:h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount,h.Z.currentWpUserEmail,null,{utm_medium:"stats",utm_campaign:"signup"})},h.Z.I18n.t("premiumBannerCtaFree"))}))))))}function Xe(e){let{params:t,location:n}=e;return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:4},h.Z.I18n.t("openedEmailsHeading")),!h.Z.premiumActive||h.Z.subscribersLimitReached?o().createElement(Qe,{limitReached:h.Z.subscribersLimitReached,limitValue:h.Z.subscribersLimit,subscribersCountTowardsLimit:h.Z.subscribersCount,premiumActive:h.Z.premiumActive,hasValidApiKey:h.Z.hasValidApiKey,hasPremiumSupport:h.Z.hasPremiumSupport}):Ke().applyFilters("mailpoet_subscribers_opened_emails_stats",t,n))}function Je(){const e=(0,d.useRouteMatch)(),t=(0,d.useLocation)(),[n,a]=(0,s.useState)(null),[r,i]=(0,s.useState)(!0),l=(0,je.S)(window).notices.error;return(0,s.useEffect)((()=>{h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"subscriberStats",action:"get",data:{subscriber_id:e.params.id}}).done((e=>{a(e.data),i(!1)})).fail((e=>{i(!1),e.errors.length>0&&l(o().createElement(o().Fragment,null,e.errors.map((e=>o().createElement("p",{key:e.message},e.message)))),{scroll:!0})}))}),[e.params.id,l]),r?o().createElement(Ve.Z,null):o().createElement("div",{className:"mailpoet-subscriber-stats"},o().createElement(We,{email:n.email}),o().createElement("p",null,h.Z.I18n.t("lastEngagement"),": ",n.last_engagement?h.Z.Date.format(n.last_engagement):h.Z.I18n.t("never")),o().createElement("div",{className:"mailpoet-subscriber-stats-summary-grid"},o().createElement(Be,{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&&o().createElement(He,{averageRevenueValue:n.woocommerce.formatted_average,count:n.woocommerce.count,revenueValue:n.woocommerce.formatted})),o().createElement(Xe,{params:e.params,location:t}))}Qe.propTypes={limitReached:y().bool.isRequired,limitValue:y().number.isRequired,subscribersCountTowardsLimit:y().number.isRequired,premiumActive:y().bool.isRequired,hasValidApiKey:y().bool.isRequired,hasPremiumSupport:y().bool.isRequired},Xe.propTypes={params:y().shape({id:y().string.isRequired}).isRequired};var et=n(93726);function tt(){return o().createElement(je.k.Provider,{value:(0,je.S)(window)},o().createElement(u.UT,null,o().createElement(et.Z,null),o().createElement(d.Switch,null,o().createElement(d.Route,{path:"/new",component:Ue}),o().createElement(d.Route,{path:"/edit/:id",component:Ue}),o().createElement(d.Route,{path:"/stats/:id/(.*)?",component:Je}),o().createElement(d.Route,{path:"*",component:ae}))))}const nt=document.getElementById("subscribers_container");nt&&c().render(o().createElement(tt,null),nt);var at=n(68345);class rt extends o().PureComponent{render(){const e=this.props.event,t=e.soon;let n;if(this.props.premium)n=o().createElement("a",{href:"?page=mailpoet-premium",target:"_blank"},h.Z.I18n.t("premiumFeatureLink"));else if(e.actionButtonLink&&e.actionButtonTitle)n=o().createElement("a",{href:e.actionButtonLink,target:"_blank",rel:"noopener noreferrer"},e.actionButtonTitle);else{const a=t?null:T.ZP.partial(this.props.eventsConfigurator,e.slug);n=o().createElement(b.Z,{disabled:t,onClick:a,role:"presentation",automationId:`create_${e.slug}`,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),a())}},e.actionButtonTitle||h.Z.I18n.t("setUp"))}return o().createElement("div",{"data-type":e.slug,className:"mailpoet-newsletter-type"},o().createElement("div",{className:"mailpoet-newsletter-type-image"},e.badge&&o().createElement(at.Z,{title:e.badge.text})),o().createElement("div",{className:"mailpoet-newsletter-type-content"},o().createElement(Ce.Z,{level:4},e.title," ",e.soon&&`(${h.Z.I18n.t("soon")})`),o().createElement("p",null,e.description),o().createElement("div",{className:"mailpoet-flex-grow"}),o().createElement("div",{className:"mailpoet-newsletter-type-action"},n)))}}rt.defaultProps={premium:!1},rt.propTypes={premium:y().bool,eventsConfigurator:y().func.isRequired,event:y().shape({slug:y().string.isRequired,actionButtonLink:y().string,title:y().string.isRequired,soon:y().bool,badge:y().shape({style:y().string,text:y().string}),description:y().string.isRequired,actionButtonTitle:y().string}).isRequired};var it=rt;class st extends o().Component{constructor(e){super(e),this.email=this.props.email,this.emailEvents=this.email.events,this.eventsConfigurator=this.eventsConfigurator.bind(this)}eventsConfigurator(e){h.Z.trackEvent("Emails > Automatic Type selected",{"Email type":e}),this.props.history.push(`/new/${this.email.slug}/${e}/conditions`)}render(){return T.ZP.map(this.emailEvents,((e,t)=>o().createElement(it,{premium:this.email.premium,event:e,key:t,eventsConfigurator:this.eventsConfigurator})))}}st.propTypes={email:y().shape({title:y().string.isRequired,slug:y().string.isRequired,premium:y().bool}).isRequired,history:y().shape({push:y().func.isRequired}).isRequired};var ot=(0,d.withRouter)(st),lt={woocommerce:o().createElement("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"}},o().createElement("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"}),o().createElement("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"}))},ct=n(33687);function ut(e){let{errors:t}=e;return t.length<1?null:o().createElement(R.Z,{type:"error",closable:!1},t.map((e=>o().createElement("p",{key:e.message},e.message))))}ut.propTypes={errors:y().arrayOf(y().shape({message:y().string.isRequired})).isRequired};var dt=ut;function pt(e){let{filter:t,history:n,hideClosingButton:a=!1,hideScreenOptions:r=!0}=e;const[i,l]=(0,s.useState)(!1),c=e=>{void 0!==e&&(n.push(`/new/${e}`),h.Z.trackEvent("Emails > Type selected",{"Email type":e}))},u=async()=>{h.Z.trackEvent("Emails > Type selected",{"Email type":"wc_transactional"});let e=window.mailpoet_woocommerce_transactional_email_id;if(!e)try{e=(await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"settings",action:"set",data:{"woocommerce.use_mailpoet_editor":1}})).data.woocommerce.transactional_email_id,h.Z.trackEvent("Emails > WooCommerce email customizer enabled")}catch(e){return e.errors.length>0?o().createElement(dt,{errors:e.errors}):null}return window.location.href=`?page=mailpoet-newsletter-editor&id=${e}`,null},d=e=>{const t=!0===window.mailpoet_is_new_user?"mailpoet_badge mailpoet_badge_video":"mailpoet_badge mailpoet_badge_video mailpoet_badge_video_grey";return o().createElement("div",{key:e.slug,"data-type":e.slug,className:"mailpoet-newsletter-type"},o().createElement("div",{className:"mailpoet-newsletter-type-image"}),o().createElement("div",{className:"mailpoet-newsletter-type-content"},o().createElement(Ce.Z,{level:4},e.title," ",e.beta?`(${h.Z.I18n.t("beta")})`:""),o().createElement("p",null,e.description),e.videoGuide&&o().createElement("a",{className:t,href:e.videoGuide,"data-beacon-article":e.videoGuideBeacon,target:"_blank",rel:"noopener noreferrer"},o().createElement("span",{className:"dashicons dashicons-format-video"}),h.Z.I18n.t("seeVideoGuide")),o().createElement("div",{className:"mailpoet-flex-grow"}),o().createElement("div",{className:"mailpoet-newsletter-type-action"},e.action)))},p=T.ZP.partial((e=>{l(!0),h.Z.trackEvent("Emails > Type selected",{"Email type":e}),h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"newsletters",action:"create",data:{type:e,subject:h.Z.I18n.t("draftNewsletterTitle")}}).done((e=>{n.push(`/template/${e.data.id}`)})).fail((e=>(l(!1),e.errors.length>0?o().createElement(dt,{errors:e.errors}):null)))}),"standard"),m=T.ZP.partial(c,"notification"),f=T.ZP.partial(c,"welcome"),g=T.ZP.partial(c,"re-engagement"),v=[{slug:"standard",title:h.Z.I18n.t("regularNewsletterTypeTitle"),description:h.Z.I18n.t("regularNewsletterTypeDescription"),action:o().createElement(b.Z,{automationId:"create_standard",onClick:p,tabIndex:0,withSpinner:i,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),p())}},h.Z.I18n.t("create"))},{slug:"welcome",title:h.Z.I18n.t("welcomeNewsletterTypeTitle"),description:h.Z.I18n.t("welcomeNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/254-video-guide-to-welcome-emails",videoGuideBeacon:"5b05ebf20428635ba8b2aa53",action:o().createElement(b.Z,{onClick:f,automationId:"create_welcome",withSpinner:i,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),f())},tabIndex:0},h.Z.I18n.t("setUp"))},{slug:"notification",title:h.Z.I18n.t("postNotificationNewsletterTypeTitle"),description:h.Z.I18n.t("postNotificationNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/210-video-guide-to-post-notifications",videoGuideBeacon:"59ba6fb3042863033a1cd5a5",action:o().createElement(b.Z,{automationId:"create_notification",onClick:m,withSpinner:i,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),m())}},h.Z.I18n.t("setUp"))},{slug:"re_engagement",title:h.Z.I18n.t("tabReEngagementTitle"),description:h.Z.I18n.t("reEngagementDescription"),action:o().createElement(b.Z,{automationId:"create_notification",onClick:g,withSpinner:i,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),g())}},h.Z.I18n.t("setUp"))}];let y=Ke().applyFilters("mailpoet_newsletters_types",[...v],this);t&&(y=y.filter(t));const w=h.Z.Ajax.constructGetUrl({api_version:h.Z.apiVersion,endpoint:"newsletterTemplates",action:"getAll"});return o().createElement(o().Fragment,null,r&&o().createElement(Pe.Z,null),o().createElement("link",{rel:"prefetch",href:window.mailpoet_editor_javascript_url,as:"script"}),o().createElement("div",{className:"mailpoet-newsletter-types"},!a&&o().createElement("div",{className:"mailpoet-newsletter-types-close"},o().createElement("button",{type:"button",onClick:()=>n.push("/"),className:"mailpoet-modal-close"},ct.Z)),y.map((e=>d(e)),this),(()=>{if(!window.mailpoet_woocommerce_automatic_emails)return[];let e=window.mailpoet_woocommerce_automatic_emails;return t&&(e=T.ZP.filter(e,t)),T.ZP.map(e,(e=>{const a=e;return o().createElement(o().Fragment,{key:a.slug},!t&&o().createElement("div",{className:"mailpoet-newsletter-types-separator"},o().createElement("div",{className:"mailpoet-newsletter-types-separator-line"}),o().createElement("div",{className:"mailpoet-newsletter-types-separator-logo"},lt[a.slug]||null),o().createElement("div",{className:"mailpoet-newsletter-types-separator-line"})),o().createElement(ot,{email:a,history:n}),"woocommerce"===a.slug&&(h.Z.isWoocommerceActive?[{slug:"wc_transactional",title:h.Z.I18n.t("wooCommerceCustomizerTypeTitle"),description:h.Z.I18n.t("wooCommerceCustomizerTypeDescription"),action:o().createElement(b.Z,{automationId:"customize_woocommerce",onClick:u,tabIndex:0,onKeyDown:async e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),await u())}},h.Z.I18n.t("customize"))}]:[]).map((e=>d(e)),this))}))})()),o().createElement("link",{rel:"prefetch",href:w,as:"fetch"}))}pt.propTypes={filter:y().func,hideScreenOptions:y().bool,hideClosingButton:y().bool},pt.defaultProps={filter:null,hideScreenOptions:!0,hideClosingButton:!1};var mt=(0,d.withRouter)(pt),ht=n(21526),ft=(0,d.withRouter)((e=>o().createElement(ht.Z,e))),gt=n(80416),vt=n(12912),yt=n(9185);class bt extends o().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:a}=this.props;(0,yt.Z)({message:h.Z.I18n.t("confirmTemplateDeletion").replace("%1$s",t),onConfirm:()=>{n(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"delete",data:{id:e}}).done((()=>{a(!0,e)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0}),a(!1)}))}})}onPreview(){h.Z.Modal.popup({title:this.props.name,template:'<img src="{{ thumbnail }}" />',data:this.props})}onSelect(){const{newsletterId:e,name:t,beforeSelect:n,afterSelect:a}=this.props;n(),h.Z.trackEvent("Emails > Template selected",{"Email name":t}),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:{id:e,template_id:this.props.id}}).done((e=>{a(!0,e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0}),a(!1)}))}render(){const{index:e,name:t,thumbnail:n,readonly:a}=this.props;let r="";return"string"==typeof n&&n.length>0&&(r=o().createElement("a",{className:"mailpoet-template-preview",href:"#",onClick:e=>{e.preventDefault(),this.onPreview(e)}},o().createElement("div",{className:"mailpoet-template-thumbnail"},n?o().createElement("img",{src:n,alt:h.Z.I18n.t("templatePreview"),loading:"lazy"}):""),o().createElement("div",{className:"mailpoet-template-preview-overlay"},o().createElement(b.Z,null,h.Z.I18n.t("zoom"))))),o().createElement(vt.Z,{label:t,onSelect:this.onSelect,onDelete:!1===a?this.onDelete:void 0,automationId:`select_template_${e}`,className:"mailpoet-template-two-lines"},r)}}bt.contextType=je.k,bt.propTypes={index:y().number.isRequired,id:y().number.isRequired,newsletterId:y().string.isRequired,name:y().string.isRequired,thumbnail:y().string,readonly:y().bool.isRequired,beforeDelete:y().func.isRequired,afterDelete:y().func.isRequired,beforeSelect:y().func.isRequired,afterSelect:y().func.isRequired},bt.defaultProps={thumbnail:null};var wt=bt;class _t extends o().Component{constructor(e){super(e),this.fileRef=o().createRef(),this.handleSubmit=this.handleSubmit.bind(this)}handleSubmit(e){if(e.preventDefault(),T.ZP.size(this.fileRef.current.files)<=0)return!1;const t=T.ZP.first(this.fileRef.current.files),n=new FileReader;return n.onload=e=>{try{this.saveTemplate(JSON.parse(e.target.result)),h.Z.trackEvent("Emails > Template imported")}catch(e){this.context.notices.error(o().createElement("p",null,h.Z.I18n.t("templateFileMalformedError")))}},n.readAsText(t),!0}saveTemplate(e){const t=e,{beforeImport:n,afterImport:a}=this.props;T.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(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:t}).done((e=>{a(!0,e.data)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0}),a(!1)}))}render(){return o().createElement("div",{className:"mailpoet-template-import"},o().createElement("h4",null,h.Z.I18n.t("importTemplateTitle"),o().createElement($(),{tooltip:h.Z.I18n.t("helpTooltipTemplateUpload"),place:"right",className:"tooltip-help-import-template"})),o().createElement("form",{onSubmit:this.handleSubmit},o().createElement("input",{type:"file",placeholder:h.Z.I18n.t("selectJsonFileToUpload"),ref:this.fileRef}),o().createElement("p",{className:"submit"},o().createElement("input",{className:"button button-primary",type:"submit",value:h.Z.I18n.t("upload")}))))}}_t.contextType=je.k,_t.propTypes={beforeImport:y().func.isRequired,afterImport:y().func.isRequired};var Et=_t;const Zt=[];window.mailpoet_newsletters_templates_recently_sent_count&&Zt.push({name:"recent",label:h.Z.I18n.t("recentlySent")}),Zt.push({name:"standard",label:h.Z.I18n.t("tabStandardTitle")},{name:"welcome",label:h.Z.I18n.t("tabWelcomeTitle")},{name:"notification",label:h.Z.I18n.t("tabNotificationTitle")},{name:"re_engagement",label:h.Z.I18n.t("tabReEngagementTitle")},{name:"blank",label:h.Z.I18n.t("tabBlankTitle")}),window.mailpoet_woocommerce_active&&Zt.push({name:"woocommerce",label:h.Z.I18n.t("tabWoocommerceTitle")}),Zt.push({name:"saved",label:h.Z.I18n.t("savedTemplates")});class It extends o().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(){h.Z.Ajax.get({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"getAll"}).done((e=>{0===e.data.length&&(e.data=[{name:h.Z.I18n.t("mailpoetGuideTemplateTitle"),categories:'["welcome", "notification", "standard", "woocommerce"]',readonly:!0}]),e.data.forEach(this.addTemplate),this.sortTemplates()})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0})})).always((()=>{this.selectInitialTab()}))}addTemplate(e){const t=Zt.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,a)=>{if(e.includes(t)){if(n.categories.includes('"blank"')&&!a.categories.includes('"blank"'))return-1;if(!n.categories.includes('"blank"')&&a.categories.includes('"blank"'))return 1}return n.id<a.id?1:-1}))}))}selectInitialTab(){let e,t="standard";h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:this.props.match.params.id}}).done((n=>{e=n.data.type,"automatic"===e&&(e=n.data.options.group||e),window.mailpoet_newsletters_templates_recently_sent_count?t="recent":T.ZP.findWhere(Zt,{name:n.data.type})?t=n.data.type:"automatic"===n.data.type&&T.ZP.findWhere(Zt,{name:n.data.options.group})&&(t=n.data.options.group)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key: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 o().createElement(Ve.Z,null);const e=Zt.concat({name:"import",label:h.Z.I18n.t("tabImportTitle")}).map((e=>Object.assign(e,{automationId:`templates-${e.name.replace(/\s+/g,"-").toLowerCase()}`})));let t=null;if("import"===this.state.selectedTab)t=o().createElement(Et,{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:o().createElement("p",null,h.Z.I18n.t("noTemplates")):e.map(((e,t)=>o().createElement(wt,{key:e.id,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}))),t=e}return o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(ft,{emailType:this.state.emailType,automationId:"email_template_selection_heading"}),o().createElement("div",{className:"mailpoet-templates"},o().createElement(gt.Z,{categories:e,active:this.state.selectedTab,onSelect:e=>this.setState({selectedTab:e})}),t))}}It.contextType=je.k,It.propTypes={match:y().shape({params:y().shape({id:y().string}).isRequired}).isRequired};var St=It,kt=n(11830),Tt=n(9198),Ct=n.n(Tt);function Nt(e){var t;let{dimension:n,isFullWidth:a,iconStart:r,iconEnd:i,...s}=e;return o().createElement("div",{className:g()("mailpoet-datepicker mailpoet-form-input",{[`mailpoet-form-input-${n}`]:n,"mailpoet-disabled":s.disabled,"mailpoet-full-width":a})},r,o().createElement(Ct(),(0,S.Z)({useWeekdaysShort:!0,calendarStartDay:null!==(t=s.calendarStartDay)&&void 0!==t?t:h.Z.wpWeekStartsOn},s)),i)}Nt.propTypes={dimension:y().oneOf(["small"]),isFullWidth:y().bool,iconStart:y().element,iconEnd:y().element};var Dt=Nt,xt=n(4958),Rt=n(16245),Ot=n.n(Rt);const At={abbreviated:[h.Z.I18n.t("januaryShort"),h.Z.I18n.t("februaryShort"),h.Z.I18n.t("marchShort"),h.Z.I18n.t("aprilShort"),h.Z.I18n.t("mayShort"),h.Z.I18n.t("juneShort"),h.Z.I18n.t("julyShort"),h.Z.I18n.t("augustShort"),h.Z.I18n.t("septemberShort"),h.Z.I18n.t("octoberShort"),h.Z.I18n.t("novemberShort"),h.Z.I18n.t("decemberShort")],wide:[h.Z.I18n.t("january"),h.Z.I18n.t("february"),h.Z.I18n.t("march"),h.Z.I18n.t("april"),h.Z.I18n.t("may"),h.Z.I18n.t("june"),h.Z.I18n.t("july"),h.Z.I18n.t("august"),h.Z.I18n.t("september"),h.Z.I18n.t("october"),h.Z.I18n.t("november"),h.Z.I18n.t("december")]},Pt={narrow:[h.Z.I18n.t("sundayMin"),h.Z.I18n.t("mondayMin"),h.Z.I18n.t("tuesdayMin"),h.Z.I18n.t("wednesdayMin"),h.Z.I18n.t("thursdayMin"),h.Z.I18n.t("fridayMin"),h.Z.I18n.t("saturdayMin")],abbreviated:[h.Z.I18n.t("sundayShort"),h.Z.I18n.t("mondayShort"),h.Z.I18n.t("tuesdayShort"),h.Z.I18n.t("wednesdayShort"),h.Z.I18n.t("thursdayShort"),h.Z.I18n.t("fridayShort"),h.Z.I18n.t("saturdayShort")],wide:[h.Z.I18n.t("sunday"),h.Z.I18n.t("monday"),h.Z.I18n.t("tuesday"),h.Z.I18n.t("wednesday"),h.Z.I18n.t("thursday"),h.Z.I18n.t("friday"),h.Z.I18n.t("saturday")]};xt.Z.localize.month=Ot()({values:At,defaultWidth:"wide"}),xt.Z.localize.day=Ot()({values:Pt,defaultWidth:"wide"}),xt.Z.options.weekStartsOn=void 0!==h.Z.wpWeekStartsOn?h.Z.wpWeekStartsOn:1,(0,Tt.registerLocale)("mailpoet",xt.Z);class Mt extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"onChange",((e,t)=>{const n=t,a=this.getStorageDate(e);n.target.name=this.getFieldName(),n.target.value=a,this.props.onChange(n)})),(0,k.Z)(this,"getFieldName",(()=>this.props.name||"date")),(0,k.Z)(this,"getDisplayDateFormat",(e=>h.Z.Date.convertFormat(e).replace(/D/g,"d").replace(/Y/g,"y").replace(/\[/g,"").replace(/\]/g,""))),(0,k.Z)(this,"getDate",(e=>{const t={parseFormat:this.props.storageFormat};return h.Z.Date.toDate(e,t)})),(0,k.Z)(this,"getStorageDate",(e=>{const t={format:this.props.storageFormat};return h.Z.Date.format(e,t)}))}render(){return o().createElement(Dt,(0,S.Z)({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))}}Mt.propTypes={displayFormat:y().string.isRequired,onChange:y().func.isRequired,name:y().string,storageFormat:y().string.isRequired,value:y().string.isRequired,disabled:y().bool.isRequired,validation:y().shape({"data-parsley-required":y().bool,"data-parsley-required-message":y().string,"data-parsley-type":y().string,"data-parsley-errors-container":y().string,maxLength:y().number}).isRequired,maxDate:y().instanceOf(Date)},Mt.defaultProps={name:"date",maxDate:null};var Lt=Mt;class Ft extends o().Component{render(){const e=Object.keys(this.props.timeOfDayItems).map((e=>o().createElement("option",{key:`option-${this.props.timeOfDayItems[e]}`,value:e},this.props.timeOfDayItems[e])));return o().createElement(he.Z,(0,S.Z)({name:this.props.name||"time",value:this.props.value,disabled:this.props.disabled,onChange:this.props.onChange,isMinWidth:!0},this.props.validation),e)}}Ft.propTypes={timeOfDayItems:y().objectOf(y().string).isRequired,name:y().string,value:y().string.isRequired,disabled:y().bool,onChange:y().func.isRequired,validation:y().object},Ft.defaultProps={name:"time",disabled:!1,validation:{}};var qt=Ft;class $t extends o().Component{constructor(e){super(e),(0,k.Z)(this,"DATE_TIME_SEPARATOR"," "),(0,k.Z)(this,"getDateTime",(()=>[this.state.date,this.state.time].join(this.DATE_TIME_SEPARATOR))),(0,k.Z)(this,"buildStateFromProps",(e=>{const t=e.value||this.props.defaultDateTime,[n,a]=t.split(this.DATE_TIME_SEPARATOR);return{date:n,time:a}})),(0,k.Z)(this,"handleChange",(e=>{const t={};t[e.target.name]=e.target.value,this.setState(t,this.propagateChange)})),(0,k.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||oe()((()=>{this.setState(this.buildStateFromProps(this.props))}))}render(){return o().createElement(kt.r.Column,{className:"mailpoet-datetime-container"},o().createElement(Lt,{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}),o().createElement(qt,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems}))}}$t.propTypes={value:y().string,defaultDateTime:y().string.isRequired,dateDisplayFormat:y().string.isRequired,dateStorageFormat:y().string.isRequired,onChange:y().func,name:y().string,disabled:y().bool,dateValidation:y().object.isRequired,timeValidation:y().any,timeOfDayItems:y().objectOf(y().string).isRequired,maxDate:y().instanceOf(Date)},$t.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0,value:void 0,maxDate:null};var Ut=$t,Vt=n(43246);class jt extends o().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 o().createElement(o().Fragment,null,o().createElement(ue,{item:{...this.props.item,sender_address:this.state.emailAddress},field:this.props.field,onValueChange:this.onChange}),o().createElement("div",{className:"regular-text"},o().createElement(Vt.Z,{emailAddress:this.state.emailAddress,mssActive:window.mailpoet_mss_active})))}}jt.propTypes={field:y().object.isRequired,item:y().shape({sender_address:y().string.isRequired}).isRequired,onValueChange:y().func},jt.defaultProps={onValueChange:function(){}};var Wt=jt;const Yt=T.ZP.once((()=>h.Z.trackEvent("User has typed a GA campaign name"))),Bt=x()(h.Z.I18n.t("gaCampaignTip"),/\[link\](.*?)\[\/link\]/g,((e,t)=>o().createElement("span",{key:t},o().createElement("br",null),o().createElement("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"},e))));var Ht={name:"ga_campaign",label:h.Z.I18n.t("gaCampaignLine"),tip:Bt,type:"text",onBeforeChange:Yt};function zt(e){let{dimension:t,onCheck:n,automationId:a,className:r,...i}=e;return o().createElement("label",{className:g()({[r]:r,"mailpoet-form-toggle":!0,[`mailpoet-form-toggle-${t}`]:t,"mailpoet-disabled":i.disabled}),"data-automation-id":a},o().createElement("input",(0,S.Z)({type:"checkbox",onChange:e=>n(e.target.checked,e)},i)),o().createElement("span",{className:"mailpoet-form-toggle-control"}))}zt.propTypes={dimension:y().oneOf(["small"]),onCheck:y().func.isRequired,automationId:y().string};var Kt=zt;let Gt,Qt;!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"}(Gt||(Gt={})),function(e){e.Draft="draft",e.Scheduled="scheduled",e.Sending="sending",e.Sent="sent",e.Active="active"}(Qt||(Qt={}));const Xt=window.mailpoet_current_time||"00:00",Jt=`${window.mailpoet_tomorrow_date} 08:00:00`,en=window.mailpoet_schedule_time_of_day,tn=window.mailpoet_date_display_format,nn=window.mailpoet_date_storage_format;class an extends s.Component{constructor(){super(...arguments),(0,k.Z)(this,"getCurrentValue",(()=>{var e;return{isScheduled:"0",scheduledAt:Jt,...null!==(e=this.props.item?.[this.props.field.name])&&void 0!==e?e:{}}})),(0,k.Z)(this,"getDateValidation",(()=>({"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("noScheduledDateError"),"data-parsley-errors-container":"#mailpoet_scheduling"}))),(0,k.Z)(this,"isScheduled",(()=>"1"===this.getCurrentValue().isScheduled)),(0,k.Z)(this,"handleCheckboxChange",((e,t)=>{const n={...t};n.target.value=t.target.checked?"1":"0",this.handleValueChange(n)})),(0,k.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=o().createElement(o().Fragment,null,o().createElement("span",{className:"mailpoet-form-schedule-time"},h.Z.I18n.t("websiteTimeIs")," ",Xt),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{id:"mailpoet_scheduling"},o().createElement(Ut,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:Jt,timeOfDayItems:en,dateDisplayFormat:tn,dateStorageFormat:nn,maxDate:t})))),o().createElement("div",null,o().createElement(Kt,{checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onCheck:this.handleCheckboxChange,automationId:"email-schedule-checkbox"}),e)}}(0,k.Z)(an,"propTypes",{onValueChange:y().func.isRequired});let rn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:h.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:h.Z.I18n.t("subjectLine"),tooltip:h.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:h.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:h.Z.I18n.t("preheaderLine"),tooltip:`${h.Z.I18n.t("preheaderLineTip1")} ${h.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"segments",label:h.Z.I18n.t("segments"),tip:h.Z.I18n.t("segmentsTip"),type:"selection",placeholder:h.Z.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems()||[];return e.map((e=>t.find((t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("noSegmentsSelectedError")}},{name:"options",label:h.Z.I18n.t("scheduleIt"),type:"reactComponent",component:an},{name:"sender",label:h.Z.I18n.t("sender"),tip:h.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:h.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Wt,placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Ht,{name:"reply-to",label:h.Z.I18n.t("replyTo"),tip:h.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:h.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:h.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];rn=Ke().applyFilters("mailpoet_newsletters_3rd_step_fields",rn);var sn={getFields:()=>rn,getSendButtonOptions:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=ie()(window.mailpoet_current_date_time),n="object"==typeof e.options&&"1"===e.options?.isScheduled&&h.Z.Date.isInFuture(e.options?.scheduledAt,t),a={value:n?h.Z.I18n.t("schedule"):h.Z.I18n.t("send")};return e.status!==Qt.Sent&&e.status!==Qt.Sending||(a.disabled="disabled"),a}};const on=window.mailpoet_time_format||"H:i",ln={immediate:h.Z.I18n.t("delayImmediately"),hours:h.Z.I18n.t("delayHoursAfter"),days:h.Z.I18n.t("delayDaysAfter"),weeks:h.Z.I18n.t("delayWeeksAfter")},cn={daily:h.Z.I18n.t("daily"),weekly:h.Z.I18n.t("weekly"),monthly:h.Z.I18n.t("monthly"),nthWeekDay:h.Z.I18n.t("monthlyEvery"),immediately:h.Z.I18n.t("immediately")},un=T.ZP.object(T.ZP.map(T.ZP.times(24,(e=>3600*e)),(e=>{const t=new Date(null);return t.setSeconds(e),[e,h.Z.Date.format(t,{format:on,offset:0})]}))),dn={0:h.Z.I18n.t("sunday"),1:h.Z.I18n.t("monday"),2:h.Z.I18n.t("tuesday"),3:h.Z.I18n.t("wednesday"),4:h.Z.I18n.t("thursday"),5:h.Z.I18n.t("friday"),6:h.Z.I18n.t("saturday")},pn=T.ZP.object(T.ZP.map(T.ZP.times(28,(e=>e)),(e=>{const t={0:h.Z.I18n.t("first"),1:h.Z.I18n.t("second"),2:h.Z.I18n.t("third")};let n;return n=void 0!==t[e]?t[e]:h.Z.I18n.t("nth").replace("%1$d",e+1),[e+1,n]}))),mn={1:h.Z.I18n.t("first"),2:h.Z.I18n.t("second"),3:h.Z.I18n.t("third"),L:h.Z.I18n.t("last")},hn={name:"intervalType",values:cn},fn={name:"timeOfDay",values:un},gn={name:"weekDay",values:dn},vn={name:"monthDay",values:pn},yn={name:"nthWeekDay",values:mn};class bn extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,k.Z)(this,"handleValueChanges",(e=>{const t=this.getCurrentValue();return this.props.onValueChange({target:{name:this.props.field.name,value:T.ZP.extend({},t,e)}})})),(0,k.Z)(this,"handleIntervalChange",(e=>{const t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),this.handleValueChanges(n)})),(0,k.Z)(this,"handleTimeOfDayChange",(e=>this.handleValueChanges({timeOfDay:e.target.value}))),(0,k.Z)(this,"handleWeekDayChange",(e=>this.handleValueChanges({weekDay:e.target.value}))),(0,k.Z)(this,"handleMonthDayChange",(e=>this.handleValueChanges({monthDay:e.target.value}))),(0,k.Z)(this,"handleNthWeekDayChange",(e=>this.handleValueChanges({nthWeekDay:e.target.value})))}render(){const e=this.getCurrentValue();let t,n,a,r;return"immediately"!==e.intervalType&&(t=o().createElement(ge,{field:fn,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==e.intervalType&&"nthWeekDay"!==e.intervalType||(n=o().createElement(ge,{field:gn,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===e.intervalType&&(a=o().createElement(ge,{field:vn,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===e.intervalType&&(r=o().createElement(ge,{field:yn,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),o().createElement("div",null,o().createElement(ge,{field:hn,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{className:"mailpoet-grid-column mailpoet-flex"},r,a,n,t),"immediately"!==e.intervalType&&o().createElement("div",{className:"mailpoet-gap"}))}}bn.propTypes={item:y().object.isRequired,field:y().shape({name:y().string}).isRequired,onValueChange:y().func.isRequired};var wn=bn;let _n=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:h.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:h.Z.I18n.t("subjectLine"),tooltip:h.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:h.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:h.Z.I18n.t("preheaderLine"),tooltip:`${h.Z.I18n.t("preheaderLineTip1")} ${h.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:h.Z.I18n.t("selectFrequency"),type:"reactComponent",component:wn},{name:"segments",label:h.Z.I18n.t("segments"),tip:h.Z.I18n.t("segmentsTip"),type:"selection",placeholder:h.Z.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return T.ZP.map(e,(e=>T.ZP.find(t,(t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:h.Z.I18n.t("sender"),tip:h.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:h.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Wt,placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Ht,{name:"reply-to",label:h.Z.I18n.t("replyTo"),tip:h.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:h.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:h.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];_n=Ke().applyFilters("mailpoet_newsletters_3rd_step_fields",_n);var En={getFields:function(){return _n},getSendButtonOptions:function(){return{value:h.Z.I18n.t("activate")}}};const Zn=window.mailpoet_roles||{},In=T.ZP.filter(window.mailpoet_segments||[],(e=>"default"===e.type)),Sn={name:"event",values:{segment:h.Z.I18n.t("onSubscriptionToList"),user:h.Z.I18n.t("onWPUserRegistration")}},kn={name:"segment",placeholder:h.Z.I18n.t("selectSegmentPlaceholder"),forceSelect2:!0,values:In,getCount:e=>parseInt(e.subscribers,10).toLocaleString(),getLabel:e=>e.name,getValue:e=>e.id},Tn={name:"role",values:Zn},Cn={name:"afterTimeNumber",size:3,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":h.Z.I18n.t("emailCanBeScheduledUpToFiveYears")}},Nn={name:"afterTimeType",values:ln};class Dn extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,k.Z)(this,"handleValueChange",((e,t)=>{const n=this.getCurrentValue(),a={};let r=t;return"afterTimeNumber"===e&&(r=parseInt(t,10),r=Number.isNaN(r)?"":r),a[e]=r,this.props.onValueChange({target:{name:this.props.field.name,value:T.ZP.extend({},n,a)}})})),(0,k.Z)(this,"handleEventChange",(e=>this.handleValueChange("event",e.target.value))),(0,k.Z)(this,"handleSegmentChange",(e=>this.handleValueChange("segment",e.target.value))),(0,k.Z)(this,"handleRoleChange",(e=>this.handleValueChange("role",e.target.value))),(0,k.Z)(this,"handleAfterTimeNumberChange",(e=>this.handleValueChange("afterTimeNumber",e.target.value))),(0,k.Z)(this,"handleAfterTimeTypeChange",(e=>this.handleValueChange("afterTimeType",e.target.value)))}render(){const e=this.getCurrentValue();let t,n;return t="user"===e.event?o().createElement(ge,{field:Tn,item:this.getCurrentValue(),onValueChange:this.handleRoleChange}):o().createElement(N,{field:kn,item:this.getCurrentValue(),onValueChange:this.handleSegmentChange}),"immediate"!==e.afterTimeType&&(n=o().createElement(ue,{field:Cn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeNumberChange})),o().createElement("div",null,o().createElement(ge,{field:Sn,item:this.getCurrentValue(),onValueChange:this.handleEventChange}),o().createElement("div",{className:"mailpoet-gap"}),t,o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{className:"mailpoet-grid-column mailpoet-flex"},n,o().createElement(ge,{field:Nn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeTypeChange})),o().createElement("div",{className:"mailpoet-form-errors"}),o().createElement("div",{className:"mailpoet-gap"}))}}Dn.propTypes={history:y().shape({push:y().func.isRequired}).isRequired,item:y().object.isRequired,field:y().shape({name:y().string}).isRequired,onValueChange:y().func.isRequired};var xn=(0,d.withRouter)(Dn);let Rn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:h.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:h.Z.I18n.t("subjectLine"),tooltip:h.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:h.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:h.Z.I18n.t("preheaderLine"),tooltip:`${h.Z.I18n.t("preheaderLineTip1")} ${h.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:h.Z.I18n.t("selectEventToSendWelcomeEmail"),type:"reactComponent",component:xn},Ht,{name:"sender",label:h.Z.I18n.t("sender"),tip:h.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:h.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Wt,placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:h.Z.I18n.t("replyTo"),tip:h.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:h.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:h.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Rn=Ke().applyFilters("mailpoet_newsletters_3rd_step_fields",Rn);var On={getFields:function(){return Rn},getSendButtonOptions:function(){return{value:h.Z.I18n.t("activate")}}};class An extends o().Component{constructor(e){super(e);const{item:t,event:n}=this.props;this.handleChange=this.handleChange.bind(this);const a=t.afterTimeType||n.defaultAfterTimeType||"immediate",r="minutes"===a?30:1,i=t.afterTimeNumber||r;this.state={afterTimeType:a,afterTimeNumber:i},t.afterTimeNumber===i&&t.afterTimeType===a||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 a={[t]:n},{afterTimeType:r}=this.state;"afterTimeType"===t&&r!==n&&("minutes"===r&&(a.afterTimeNumber=1),"minutes"===n&&(a.afterTimeNumber=30)),this.setState(a,this.propagateChange(a))}displayAfterTimeTypeOptions(){const{event:e}=this.props;let t=ln;e.timeDelayValues&&(t=Object.entries(e.timeDelayValues).reduce(((e,t)=>{let[n,a]=t;return e[n]=a.text,e}),{}));const{afterTimeType:n}=this.state,a={field:{id:"scheduling_time_interval",name:"scheduling_time_interval",forceSelect2:!0,values:T.ZP.map(t,((e,t)=>({name:e,id:t}))),extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>n},onValueChange:T.ZP.partial(this.handleChange,T.ZP,"afterTimeType")};return o().createElement(N,{field:a.field,onValueChange:a.onValueChange})}displayAfterTimeNumberField(){const{afterTimeNumberSize:e,event:t}=this.props,{afterTimeType:n,afterTimeNumber:a}=this.state;if("immediate"===n)return null;if(t.timeDelayValues&&t.timeDelayValues[n]&&!t.timeDelayValues[n].displayAfterTimeNumberField)return null;const r={field:{id:"scheduling_time_duration",name:"scheduling_time_duration",defaultValue:a?a.toString():"",size:e,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":h.Z.I18n.t("emailCanBeScheduledUpToFiveYears")}},item:{},onValueChange:T.ZP.partial(this.handleChange,T.ZP,"afterTimeNumber")};return o().createElement(ue,{field:r.field,item:r.item,onValueChange:r.onValueChange})}propagateChange(e){const{onValueChange:t}=this.props;t&&t(e)}render(){const{event:e}=this.props;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-grid-column mailpoet-flex"},this.displayAfterTimeNumberField(),this.displayAfterTimeTypeOptions()),o().createElement("div",{className:"mailpoet-form-errors"}),o().createElement("div",{className:"mailpoet-gap"}),e.schedulingReadMoreLink&&o().createElement(o().Fragment,null,o().createElement("a",{href:e.schedulingReadMoreLink.link,target:"_blank",rel:"noopener noreferrer",className:"event-scheduling-read-more-link"},e.schedulingReadMoreLink.text),o().createElement("div",{className:"mailpoet-gap"})))}}An.propTypes={item:y().shape({afterTimeType:y().string.isRequired,afterTimeNumber:y().number}).isRequired,afterTimeNumberSize:y().number,onValueChange:y().func,event:y().shape({defaultAfterTimeType:y().string,timeDelayValues:y().objectOf(y().shape({text:y().string,displayAfterTimeNumberField:y().bool})),schedulingReadMoreLink:y().shape({link:y().string.isRequired,text:y().string.isRequired})}).isRequired},An.defaultProps={afterTimeNumberSize:3,onValueChange:null};var Pn=An;function Mn(e){const t=e&&e.values?e.values:[];return t?t.map((e=>({id:e.id,name:e.name}))):t}function Ln(e){let{eventOptions:t,eventSlug:n,selected:a,onValueChange:r}=e;function i(e){r&&r({eventOptionValue:e.target.value})}return o().createElement("div",null,o().createElement("div",{className:"event-option-selection"},function(){if(!t)return t;const e={field:{name:`event_options_${n}`,forceSelect2:!0,endpoint:t.endpoint,resetSelect2OnUpdate:!0,values:Mn(t),multiple:t.multiple||!1,placeholder:t.placeholder||!1,transformChangedValue:(e,t)=>T.ZP.map(t,(e=>({id:e.id,name:e.text}))),selected:()=>a,getLabel:T.ZP.property("name"),getValue:T.ZP.property("id"),validation:{"data-parsley-required":!0}},onValueChange:i,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"}),o().createElement(o().Fragment,null,o().createElement(N,{field:e.field,onValueChange:e.onValueChange,item:e.item}),o().createElement("div",{className:"mailpoet-gap"}))}()))}Ln.propTypes={eventOptions:y().shape({values:y().arrayOf(y().shape({id:y().string.isRequired,name:y().string.isRequired})),multiple:y().bool.isRequired,placeholder:y().string.isRequired,endpoint:y().string.isRequired}).isRequired,eventSlug:y().string.isRequired,selected:y().arrayOf(y().string).isRequired,onValueChange:y().func.isRequired};var Fn=Ln;class qn extends o().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=T.ZP.indexBy(this.email.events,"slug"),this.segments=T.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const n=this.events[this.emailOptions.event],a=this.emailOptions.afterTimeType||n.defaultAfterTimeType||"immediate";this.state={event:n,afterTimeType:a,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,a={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return o().createElement(Pn,{item:a.item,event:a.event,onValueChange:a.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 o().createElement("div",{className:"event-segment-selection"},o().createElement(N,{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 a={emailSlug:this.email.slug,eventSlug:t,onValueChange:this.handleChange,eventOptions:e.options||null};return n&&n.option&&("remote"===a.eventOptions.type&&(a.eventOptions.values=n.option),a.selected=T.ZP.map(n.option,(e=>e.id))),o().createElement(Fn,{emailSlug:a.emailSlug,eventSlug:a.eventSlug,eventOptions:a.eventOptions,onValueChange:a.onValueChange,selected:a.selected})}displayHeader(){const{event:e}=this.state;return e.title}propagateChange(){const{eventSlug:e,afterTimeType:t,afterTimeNumber:n,segment:a,eventOptionValue:r}=this.state,{onValueChange:i}=this.props;if(!i)return;const s={group:this.email.slug,event:e,afterTimeType:t};n&&(s.afterTimeNumber=n),a&&(s.segment=a),r&&(s.meta=JSON.stringify({option:this.state.eventOptionValue})),i({target:{name:"options",value:s}})}render(){return o().createElement("div",null,o().createElement(Ce.Z,{level:5},this.displayHeader()),this.displayEventOptions(),this.displaySegments(),this.displayScheduling())}}qn.propTypes={field:y().shape({email:y().shape({events:y().object.isRequired}).isRequired,emailOptions:y().object.isRequired}).isRequired,onValueChange:y().func},qn.defaultProps={onValueChange:null};var $n=qn;const Un=window.mailpoet_woocommerce_automatic_emails||[];var Vn={getFields:function(e){return(e=>{const t=Un[e.options.group];if(!t)return!1;const n=e.options;return[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:h.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:h.Z.I18n.t("subjectLine"),tooltip:h.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:h.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:h.Z.I18n.t("preheaderLine"),tooltip:`${h.Z.I18n.t("preheaderLineTip1")} ${h.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:h.Z.I18n.t("sendAutomaticEmailWhenHeading").replace("%1s",t.title),type:"reactComponent",component:$n,email:t,emailOptions:n},Ht,{name:"sender",label:h.Z.I18n.t("sender"),tip:h.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:h.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"text",placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:h.Z.I18n.t("replyTo"),tip:h.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:h.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:h.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}]})(e)},getSendButtonOptions:function(){return{value:h.Z.I18n.t("activate")}}},jn=n(78230),Wn=n(68041);function Yn(e){let{afterTimeNumber:t,afterTimeType:n,updateAfterTimeNumber:a,updateAfterTimeType:r,inactiveSubscribersPeriod:i}=e;const s="weeks"===n?7:30,l=Number(t)*s;let c=i;return 365===i&&(c=360),o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:4},h.Z.I18n.t("selectEventToSendReEngagementEmail")),o().createElement(kt.r.CenteredRow,{className:"mailpoet-re-engagement-scheduling"},o().createElement("p",null,h.Z.I18n.t("reEngagementTextPre")),o().createElement(le.Z,{type:"text",placeholder:h.Z.I18n.t("reEngagementAterTimeNumberPlaceholder"),value:t,onChange:(0,Wn.z2)(a)}),o().createElement(he.Z,{value:n,onChange:(0,Wn.z2)(r)},o().createElement("option",{value:"weeks"},"weeks"),o().createElement("option",{value:"months"},"months"))),!!i&&c<=l&&o().createElement("p",{className:"mailpoet-re-engagement-scheduling-note"},x()(h.Z.I18n.t("reEngagementEmailWarning").replace("{$months}",`${Math.floor(i/30)}`),/\[link\](.*?)\[\/link\]/g,(e=>o().createElement("a",{key:"link",href:"https://kb.mailpoet.com/article/264-inactive-subscribers",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"5cbf19622c7d3a026fd3efe1"},e)))))}function Bn(e){return o().createElement(Yn,{afterTimeNumber:e.item.options.afterTimeNumber.toString(),afterTimeType:e.item.options.afterTimeType,inactiveSubscribersPeriod:Number(h.Z.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:t=>{e.onValueChange({target:{name:"options",value:(0,jn.assoc)("afterTimeNumber",t,e.item.options)}})},updateAfterTimeType:t=>{e.onValueChange({target:{name:"options",value:(0,jn.assoc)("afterTimeType",t,e.item.options)}})}})}Yn.propTypes={afterTimeNumber:y().string.isRequired,afterTimeType:y().string.isRequired,updateAfterTimeNumber:y().func.isRequired,updateAfterTimeType:y().func.isRequired},Bn.propTypes={item:y().shape({options:y().shape({afterTimeNumber:y().oneOfType([y().number,y().string]).isRequired,afterTimeType:y().string.isRequired}).isRequired}).isRequired,onValueChange:y().func.isRequired};const Hn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:h.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:h.Z.I18n.t("subjectLine"),tooltip:h.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:h.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:h.Z.I18n.t("preheaderLine"),tooltip:`${h.Z.I18n.t("preheaderLineTip1")} ${h.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",type:"reactComponent",component:Bn},{name:"segments",label:h.Z.I18n.t("segments"),tip:h.Z.I18n.t("segmentsTip"),type:"selection",placeholder:h.Z.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:h.Z.apiVersion,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at&&"dynamic"!==e.type},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return(0,jn.map)((e=>(0,jn.find)((t=>t.id===e),t)),e)},validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:h.Z.I18n.t("sender"),tip:h.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:h.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Wt,placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:h.Z.I18n.t("replyTo"),tip:h.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:h.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:h.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]},Ht],zn={getFields:()=>Hn,getSendButtonOptions:()=>({value:h.Z.I18n.t("activate")})};var Kn=n(7358),Gn=n(31304),Qn=n.n(Gn);const Xn=window.mailpoet_woocommerce_automatic_emails||[],Jn=(e,t)=>`${Qn()(t,{lower:!0}).replace(/[^a-z0-9]+/g,"-").replace(/-$/,"")||"newsletter"}_${e}`;function ea(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)?h.Z.I18n.t("newsletterIsEmpty"):window.mailpoet_mss_active&&t.indexOf("[link:subscription_unsubscribe_url]")<0&&t.indexOf("[link:subscription_unsubscribe]")<0?h.Z.I18n.t("unsubscribeLinkMissing"):"re_engagement"===e.type&&t.indexOf("[link:subscription_re_engage_url]")<0?h.Z.I18n.t("reEngageLinkMissing"):"notification"===e.type&&t.indexOf('"type":"automatedLatestContent"')<0&&t.indexOf('"type":"automatedLatestContentLayout"')<0?h.Z.I18n.t("automatedLatestContentMissing"):"standard"===e.type&&"sent"===e.status?h.Z.I18n.t("emailAlreadySent"):"re_engagement"!==e.type||h.Z.trackingConfig.emailTrackingEnabled?void 0:o().createElement("span",{style:{pointerEvents:"all"}},x()(h.Z.I18n.t("reEngagementEmailsDisableIfTrackingIs"),/\[link\](.*?)\[\/link\]/g,(e=>o().createElement("a",{key:"advancedSettingsTabLink",href:"?page=mailpoet-settings#/advanced",rel:"noopener noreferrer"},e))))}class ta extends o().Component{constructor(e){super(e),(0,k.Z)(this,"getFieldsByNewsletter",(e=>this.getSubtype(e).getFields(e))),(0,k.Z)(this,"getSendButtonOptions",(()=>this.getSubtype(this.state.item).getSendButtonOptions(this.state.item))),(0,k.Z)(this,"getSubtype",(e=>{switch(e.type){case"notification":return En;case"welcome":return On;case"re_engagement":return zn;case"automatic":if(Xn[e.options.group])return Vn;default:return sn}})),(0,k.Z)(this,"getThumbnailPromise",(e=>this.state.thumbnailPromise?this.state.thumbnailPromise:(0,Kn.W0)(e))),(0,k.Z)(this,"isValid",(()=>m()("#mailpoet_newsletter").parsley().isValid())),(0,k.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,k.Z)(this,"showInvalidFromAddressError",(()=>{const e=this.state.item.sender_address;let t=x()(h.Z.I18n.t("newsletterInvalidFromAddress"),"%1$s",(()=>e));t=x()(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}),h.Z.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"})})),(0,k.Z)(this,"removeInvalidFromAddressError",(()=>{m()("#field_sender_address").parsley().removeError("invalidFromAddress",{updateClass:!0})})),(0,k.Z)(this,"loadItem",(e=>(this.setState({loading:!0}),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done((e=>{const t="draft"===e.data.status?this.getThumbnailPromise(e.meta.preview_url):null,n=e.data;n.ga_campaign||(n.ga_campaign=Jn(n.id,n.subject)),this.setState({item:e.data,fields:this.getFieldsByNewsletter(e.data),thumbnailPromise:t,validationError:ea(e.data)})})).fail((()=>{this.setState({item:{}},(()=>{this.props.history.push("/new")}))}))))),(0,k.Z)(this,"saveTemplate",((e,t)=>{this.getThumbnailPromise(e.meta.preview_url).then((n=>{h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:{newsletter_id:e.data.id,name:e.data.subject,thumbnail_data:n,body:JSON.stringify(e.data.body),categories:'["recent"]'}}).fail((e=>{this.showError(e),this.setState({loading:!1}),h.Z.Modal.loading(!1)})),t()})).catch((e=>{this.showError({errors:[e]})}))})),(0,k.Z)(this,"loadAuthorizedEmailAddresses",(async()=>"MailPoet"!==window.mailpoet_mta_method?[]:(await h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])),(0,k.Z)(this,"handleSend",(e=>(e.preventDefault(),this.removeInvalidFromAddressError(),this.isValid()?(h.Z.Modal.loading(!0),this.isValidFromAddress().then((t=>t?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((e=>{switch(e.data.type){case"notification":case"welcome":case"automatic":case"re_engagement":return this.activateNewsletter(e);default:return this.sendNewsletter(e)}})).fail((e=>{this.showError(e),this.setState({loading:!1}),h.Z.Modal.loading(!1)})):(this.showInvalidFromAddressError(),h.Z.Modal.loading(!1))))):m()("#mailpoet_newsletter").parsley().validate()))),(0,k.Z)(this,"sendNewsletter",(e=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"add",data:{newsletter_id:this.state.item.id}}).done((t=>{this.saveTemplate(e,(()=>{if(window.mailpoet_show_congratulate_after_first_newsletter)return h.Z.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);this.props.history.push(`/${this.state.item.type||""}`),"scheduled"===t.data.status?(this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("newsletterHasBeenScheduled"))),h.Z.trackEvent("Emails > Newsletter sent",{scheduled:!0})):(this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("newsletterBeingSent")),{id:"mailpoet_notice_being_sent"}),h.Z.trackEvent("Emails > Newsletter sent",{scheduled:!1})),h.Z.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),h.Z.Modal.loading(!1)})))),(0,k.Z)(this,"activateNewsletter",(e=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:this.props.match.params.id,status:"active"}}).done((t=>{this.saveTemplate(e,(()=>{if(window.mailpoet_show_congratulate_after_first_newsletter)return h.Z.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);const e=this.state.item.options;this.props.history.push("automatic"===this.state.item.type?`/${e.group}`:`/${this.state.item.type||""}`),"automatic"===this.state.item.type&&Xn[e.group]?this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("automaticEmailActivated").replace("%1s",Xn[e.group].title))):"welcome"===t.data.type?(this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("welcomeEmailActivated"))),h.Z.trackEvent("Emails > Welcome email activated",{"List type":e.event,Delay:`${e.afterTimeNumber} ${e.afterTimeType}`})):"notification"===t.data.type&&(this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("postNotificationActivated"))),h.Z.trackEvent("Emails > Post notifications activated",{Frequency:e.intervalType})),h.Z.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),h.Z.Modal.loading(!1)})))),(0,k.Z)(this,"handleResume",(e=>(e.preventDefault(),this.isValid()?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((()=>{h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:this.state.item.id}}).done((()=>{this.props.history.push(`/${this.state.item.type||""}`),this.context.notices.success(o().createElement("p",null,h.Z.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,k.Z)(this,"handleSave",(e=>{e.preventDefault(),this.saveNewsletter(e).done((()=>{this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("newsletterUpdated")))})).done((()=>{const e="automatic"===this.state.item.type?this.state.item.options.group:this.state.item.type;this.props.history.push(`/${e||""}`)})).fail((e=>{this.showError(e)}))})),(0,k.Z)(this,"handleRedirectToDesign",(e=>{e.preventDefault();const t=e.target.href;this.saveNewsletter(e).done((()=>{this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("newsletterUpdated")))})).done((()=>{window.location=t})).fail((e=>{this.showError(e)}))})),(0,k.Z)(this,"saveNewsletter",(()=>{const e=this.state.item;e.queue=void 0,this.setState({loading:!0});const t=T.ZP.omit(e,["body","created_at","deleted_at","hash","status","updated_at","type"]);return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:t})})),(0,k.Z)(this,"showError",(e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0})})),(0,k.Z)(this,"handleFormChange",(e=>{const t=e.target.name,n=e.target.value;return this.setState((e=>{const a=e.item,r=a.subject,i=a.ga_campaign;return a[t]=n,"subject"===t&&i===Jn(a.id,r)&&(a.ga_campaign=Jn(a.id,n)),"reply_to_address"===t&&(a[t]=n.toLowerCase()),{item:a}})),!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(),a=!(!window.mailpoet_subscribers_limit_reached&&!window.mailpoet_mss_key_pending_approval&&void 0===this.state.validationError);let r=this.state.item.type;return"automatic"===r&&(r=this.state.item.options.group||r),o().createElement("div",{className:"mailpoet-form-send-email"},o().createElement(Ae.Z,{color:"#fff"}),o().createElement(ft,{emailType:r,automationId:"newsletter_send_heading"}),o().createElement(Oe,{id:"mailpoet_newsletter",fields:t,automationId:"newsletter_send_form",item:this.state.item,loading:this.state.loading,onChange:this.handleFormChange,onSubmit:this.handleSave},o().createElement(kt.r.CenteredRow,{className:"send-newsletter-buttons"},o().createElement(xe.Button,{variant:"secondary",type:"submit",automationId:"email-save-draft"},h.Z.I18n.t("saveDraftAndClose")),e?o().createElement(xe.Button,{type:"button",onClick:this.handleResume,isDisabled:a,automationId:"email-resume"},h.Z.I18n.t("resume")):o().createElement(xe.Button,(0,S.Z)({type:"button",onClick:this.handleSend},n,{isDisabled:a,automationId:"email-submit"}),n.value||h.Z.I18n.t("send")),void 0!==this.state.validationError&&o().createElement($(),{tooltip:o().createElement("div",null,this.state.validationError),tooltipId:"helpTooltipSendEmail"})),o().createElement("p",null,h.Z.I18n.t("orSimply")," ",o().createElement("a",{className:"mailpoet-link",href:`?page=mailpoet-newsletter-editor&id=${this.props.match.params.id}`,onClick:this.handleRedirectToDesign},h.Z.I18n.t("goBackToDesign")),"."),window.mailpoet_mss_key_pending_approval&&o().createElement("div",{className:"mailpoet_error"},x()(h.Z.I18n.t("pendingKeyApprovalNotice"),/\[link\](.*?)\[\/link\]/g,(e=>o().createElement("a",{key:"pendingKeyApprovalNoticeLink",href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer"},e))))))}}ta.contextType=je.k,ta.propTypes={match:y().shape({params:y().shape({id:y().string}).isRequired}).isRequired,history:y().shape({push:y().func.isRequired}).isRequired};var na=(0,d.withRouter)(ta);function aa(e){const[t,n]=(0,s.useState)(!1);return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:0},h.Z.I18n.t("congratulationsSuccessHeader")),o().createElement(Ce.Z,{level:3},"welcome"===(a=e.newsletter).type?h.Z.I18n.t("congratulationsWelcomeEmailSuccessBody"):"notification"===a.type?h.Z.I18n.t("congratulationsPostNotificationSuccessBody"):"automatic"===a.type?h.Z.I18n.t("congratulationsWooSuccessBody"):"scheduled"===a.status?h.Z.I18n.t("congratulationsScheduleSuccessBody"):h.Z.I18n.t("congratulationsSendSuccessBody")),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement("img",{src:e.illustrationImageUrl,alt:"",width:"500"}),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement(xe.Button,{type:"button",dimension:"small",onClick:()=>{e.successClicked(),n(!0)},withSpinner:t},h.Z.I18n.t("close")));var a}aa.propTypes={successClicked:y().func.isRequired,illustrationImageUrl:y().string.isRequired,newsletter:y().shape({status:y().string.isRequired,type:y().string.isRequired}).isRequired};var ra=aa;function ia(e){return o().createElement("div",{className:"mailpoet-wizard-step"},o().createElement("div",{className:"mailpoet-wizard-step-illustration"},o().createElement("img",{src:e.illustrationUrl,width:"500",alt:""})),o().createElement("div",{className:"mailpoet-wizard-step-content"},e.children))}ia.propTypes={illustrationUrl:y().string.isRequired,children:y().oneOfType([y().arrayOf(y().node),y().node]).isRequired};var sa=ia;function oa(e){let{children:t,isOrdered:n}=e;const a=n?"ol":"ul";return o().createElement(a,{className:`mailpoet-${a}`},t)}oa.propTypes={children:y().node.isRequired,isOrdered:y().bool};var la=oa;function ca(){return o().createElement(la,null,o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList1")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList2")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList4")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList5")))}function ua(){return o().createElement(la,null,o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSNotFreeList1")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSNotFreeList2")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSNotFreeList3")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSNotFreeList4")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSNotFreeList5")))}function da(e){return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(b.Z,{isFullWidth:!0,href:e.mailpoetAccountUrl,target:"_blank",rel:"noopener noreferrer",onClick:t=>{t.preventDefault(),window.open(e.mailpoetAccountUrl),e.next()}},e.nextButtonText),o().createElement(b.Z,{isFullWidth:!0,variant:"tertiary",onClick:e.next,onKeyDown:t=>{["keydown","keypress"].includes(t.type)&&["Enter"," "].includes(t.key)&&(t.preventDefault(),e.next())},withSpinner:e.nextWithSpinner},h.Z.I18n.t("welcomeWizardMSSNoThanks")))}function pa(e){return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("welcomeWizardMSSFreeTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("welcomeWizardMSSFreeSubtitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(Ce.Z,{level:5},h.Z.I18n.t("welcomeWizardMSSFreeListTitle"),":"),o().createElement(ca,null),o().createElement(da,{mailpoetAccountUrl:h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount,h.Z.currentWpUserEmail,"starter",{utm_medium:"onboarding",utm_campaign:"purchase"}),next:e.next,nextButtonText:h.Z.I18n.t("welcomeWizardMSSFreeButton")}))}function ma(e){return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("welcomeWizardMSSNotFreeTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("welcomeWizardMSSNotFreeSubtitle"),":"),o().createElement(ua,null),o().createElement(da,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next,nextButtonText:h.Z.I18n.t("welcomeWizardMSSNotFreeButton")}))}function ha(e){return e.subscribersCount<1e3?o().createElement(pa,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next}):o().createElement(ma,{mailpoetAccountUrl:e.purchaseUrl,next:e.next})}da.propTypes={mailpoetAccountUrl:y().string.isRequired,next:y().func.isRequired,nextButtonText:y().string.isRequired,nextWithSpinner:y().bool},da.defaultProps={nextWithSpinner:!1},pa.propTypes={next:y().func.isRequired},ma.propTypes={mailpoetAccountUrl:y().string.isRequired,next:y().func.isRequired},ha.propTypes={next:y().func.isRequired,subscribersCount:y().number.isRequired,mailpoetAccountUrl:y().string.isRequired,purchaseUrl:y().string.isRequired};var fa=ha;function ga(e){const[t,n]=(0,s.useState)(!1);return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},(a=e.newsletter.type,{standard:h.Z.I18n.t("congratulationsMSSPitchHeader"),welcome:h.Z.I18n.t("congratulationsMSSPitchHeaderAutomated"),notification:h.Z.I18n.t("congratulationsMSSPitchHeaderAutomated"),woocommerce:h.Z.I18n.t("congratulationsMSSPitchHeaderAutomated")}[a]||h.Z.I18n.t("congratulationsMSSPitchHeaderAutomated"))),o().createElement(sa,{illustrationUrl:e.MSSPitchIllustrationUrl},o().createElement("div",{className:"mailpoet-welcome-wizard-step-content"},o().createElement(Ce.Z,{level:4},h.Z.I18n.t("congratulationsMSSPitchSubHeader")),o().createElement("p",null,h.Z.I18n.t(e.subscribersCount<1e3?"welcomeWizardMSSFreeSubtitle":"welcomeWizardMSSNotFreeSubtitle")),o().createElement(Ce.Z,{level:5},h.Z.I18n.t("welcomeWizardMSSFreeListTitle"),":"),o().createElement(ca,null),o().createElement(da,{mailpoetAccountUrl:e.purchaseUrl,next:()=>{e.onFinish(),n(!0)},nextButtonText:h.Z.I18n.t("welcomeWizardMSSFreeButton"),nextWithSpinner:t}))));var a}ga.propTypes={MSSPitchIllustrationUrl:y().string.isRequired,onFinish:y().func.isRequired,subscribersCount:y().number.isRequired,purchaseUrl:y().string.isRequired,newsletter:y().shape({status:y().string.isRequired,type:y().string.isRequired}).isRequired};var va=ga;function ya(e){return window.has_mss_key_specified?o().createElement(ra,{successClicked:e.successClicked,illustrationImageUrl:e.illustrationImageUrl,newsletter:e.newsletter}):o().createElement(va,{MSSPitchIllustrationUrl:e.MSSPitchIllustrationUrl,onFinish:e.successClicked,subscribersCount:e.subscribersCount,purchaseUrl:e.purchaseUrl,newsletter:e.newsletter})}ya.propTypes={successClicked:y().func.isRequired,illustrationImageUrl:y().string.isRequired,MSSPitchIllustrationUrl:y().string.isRequired,newsletter:y().shape({status:y().string.isRequired,type:y().string.isRequired}).isRequired,subscribersCount:y().number.isRequired,purchaseUrl:y().string.isRequired};var ba=ya;function wa(e){const[t,n]=(0,s.useState)(!1);return o().createElement("div",null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("congratulationsSendFailHeader")),o().createElement(Ce.Z,{level:3},x()(h.Z.I18n.t("congratulationsSendFailExplain"),/\[link\](.*?)\[\/link\]/g,((e,t)=>o().createElement("a",{key:t,target:"_blank",rel:"noopener noreferrer",href:"https://kb.mailpoet.com/article/231-sending-does-not-work","data-beacon-article":"5a0257ac2c7d3a272c0d7ad6"},e)))),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement("img",{src:window.mailpoet_congratulations_error_image,alt:"",width:"500"}),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement(xe.Button,{dimension:"small",type:"button",onClick:()=>{e.failClicked(),n(!0)},withSpinner:t},h.Z.I18n.t("close")))}wa.propTypes={failClicked:y().func.isRequired};var _a=wa,Ea=n(63438);function Za(e){return o().createElement("div",{className:"mailpoet-congratulate-loading"},e.showRichLoadingScreen&&o().createElement("div",null,o().createElement(Ce.Z,{level:0},h.Z.I18n.t("congratulationsLoadingHeader")),o().createElement(Ce.Z,{level:3},h.Z.I18n.t("congratulationsLoadingBody")),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement(Ea.Z,{size:64})))}Za.propTypes={showRichLoadingScreen:y().bool.isRequired};var Ia=Za;const Sa=Math.floor(4*Math.random());function ka(){return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:{show_congratulate_after_first_newsletter:!1}}).always((()=>{window.location=window.mailpoet_main_page}))}class Ta extends o().Component{constructor(e){super(e),this.state={loading:!0,newsletter:null,testingPassed:!1,timeStart:ie()(),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(){ie()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),ie()().subtract(6,"seconds").isAfter(this.state.timeStart)&&this.setState({minimumLoadingTimePassed:!0}),!this.state.loading&&this.state.minimumLoadingTimePassed||setTimeout(this.tick,2e3)}loadNewsletter(e){h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done((e=>this.newsletterLoaded(e.data)))}newsletterLoaded(e){"standard"!==e.type||"scheduled"===e.status?this.setState({newsletter:e,loading:!1,minimumLoadingTimePassed:!0}):"sent"===e.status||"sending"===e.status?this.setState({newsletter:e,loading:!1,testingPassed:!0}):this.setState({newsletter:e})}renderContent(){return this.state.loading||!this.state.minimumLoadingTimePassed?(e=!this.state.newsletter,o().createElement(Ia,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:ka,showRichLoadingScreen:e})):this.state.error?(h.Z.trackEvent("Cron testing done",{"Cron is working":"false"}),o().createElement(_a,{failClicked:()=>{window.location=window.mailpoet_main_page}})):(t=this.state.newsletter,this.state.testingPassed&&h.Z.trackEvent("Cron testing done",{"Cron is working":"true"}),o().createElement(ba,{illustrationImageUrl:window.mailpoet_congratulations_success_images[Sa],MSSPitchIllustrationUrl:window.mailpoet_congratulations_success_images[Sa],successClicked:ka,newsletter:t,isWoocommerceActive:window.mailpoet_woocommerce_active,subscribersCount:window.mailpoet_subscribers_count,purchaseUrl:h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount,h.Z.currentWpUserEmail,"starter",{utm_medium:"first-newsletter-congratulations",utm_campaign:"purchase"})}));var e,t}render(){return o().createElement(o().Fragment,null,o().createElement("style",{dangerouslySetInnerHTML:{__html:"body { background: #fff; overflow-x: hidden; }"}}),o().createElement("div",{className:"mailpoet-congratulate"},o().createElement("div",{className:"mailpoet-gap-large"}),this.renderContent()))}}Ta.propTypes={match:y().shape({params:y().shape({id:y().string}).isRequired}).isRequired};var Ca=Ta;class Na extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"showTemplateSelection",(e=>{this.props.history.push(`/template/${e}`)}))}componentDidMount(){h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"standard"}}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0})}))}render(){return o().createElement("div",null,o().createElement(ft,{emailType:"standard",automationId:"standard_newsletter_creation_heading"}))}}Na.contextType=je.k,Na.propTypes={history:y().shape({push:y().func.isRequired}).isRequired};var Da=(0,d.withRouter)(Na);const xa={name:"options",type:"reactComponent",component:wn};class Ra extends o().Component{constructor(e){super(e),(0,k.Z)(this,"handleValueChange",(e=>{const t=this.state;t[e.target.name]=e.target.value,this.setState(t)})),(0,k.Z)(this,"handleNext",(()=>{h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:T.ZP.extend({},this.state,{type:"notification",subject:h.Z.I18n.t("draftPostNotificationTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0})}))})),(0,k.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 o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(ft,{emailType:"notification",automationId:"post_notification_creation_heading"}),o().createElement(kt.r.Column,{align:"center",className:"mailpoet-schedule-email"},o().createElement(Ce.Z,{level:4},h.Z.I18n.t("selectFrequency")),o().createElement(wn,{item:this.state,field:xa,onValueChange:this.handleValueChange}),o().createElement(b.Z,{isFullWidth:!0,onClick:this.handleNext,type:"button"},h.Z.I18n.t("next"))))}}Ra.contextType=je.k,Ra.propTypes={history:y().shape({push:y().func.isRequired}).isRequired};var Oa=(0,d.withRouter)(Ra);const Aa={name:"options",label:"Event",type:"reactComponent",component:xn};class Pa extends o().Component{constructor(e){super(e),(0,k.Z)(this,"isValid",(()=>m()("#welcome_scheduling").parsley().isValid())),(0,k.Z)(this,"validate",(()=>m()("#welcome_scheduling").parsley().validate()));let t=window.mailpoet_segments||[],n=1;t=t.filter((e=>"default"===e.type)),T.ZP.size(t)>0&&(n=T.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()?h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:T.ZP.extend({},this.state,{type:"welcome",subject:h.Z.I18n.t("draftNewsletterTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})):this.validate()}showTemplateSelection(e){this.props.history.push(`/template/${e}`)}render(){return o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(ft,{emailType:"welcome",automationId:"welcome_email_creation_heading"}),o().createElement(kt.r.Column,{align:"center",className:"mailpoet-schedule-email"},o().createElement(Ce.Z,{level:4},h.Z.I18n.t("selectEventToSendWelcomeEmail")),o().createElement("form",{id:"welcome_scheduling"},o().createElement(xn,{item:this.state,field:Aa,onValueChange:this.handleValueChange}),o().createElement(b.Z,{isFullWidth:!0,type:"submit",onClick:this.handleNext},h.Z.I18n.t("next")))))}}Pa.propTypes={history:y().shape({push:y().func.isRequired}).isRequired};var Ma=Pa;class La extends o().Component{static getEventOptions(e){return e.options||null}static getEventOptionsFirstValue(e){return e&&T.ZP.isArray(e.values)&&e.values[0].id?e.values[0].id:null}constructor(e){super(e),(0,k.Z)(this,"isValid",(()=>!m()("#newsletter_scheduling").parsley()||m()("#newsletter_scheduling").parsley().isValid())),(0,k.Z)(this,"validate",(()=>{m()("#newsletter_scheduling").parsley()&&m()("#newsletter_scheduling").parsley().validate()})),(0,k.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=T.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const a=this.getEvent(n),r=this.constructor.getEventOptions(a),i=this.constructor.getEventOptionsFirstValue(r);this.state={event:a,eventSlug:a.slug,eventOptionValue:i,segment:a.sendToLists?this.getFirstSegment():null,afterTimeType:a.defaultAfterTimeType||"immediate",afterTimeNumber:null}}handleChange(e){const{segment:t,afterTimeNumber:n}=this.state,a=e;if(a.eventSlug){a.event=this.getEvent(a.eventSlug),a.segment=a.event.sendToLists?t||this.getFirstSegment():null;const e=this.constructor.getEventOptions(a.event);a.eventOptionValue=e?this.constructor.getEventOptionsFirstValue(e):null}a.afterTimeType&&"immediate"===a.afterTimeType?a.afterTimeNumber=null:!a.afterTimeType||a.afterTimeNumber||n||(a.afterTimeNumber=1),this.setState(a),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:a,afterTimeNumber:r,event:i,segment:s,eventOptionValue:l}=this.state,c={group:this.email.slug,event:n,afterTimeType:a};r&&(c.afterTimeNumber=r),c.sendTo=i.sendToLists?"segment":"user",s&&(c.segment=s),l&&(c.meta=JSON.stringify({option:l})),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"automatic",subject:h.Z.I18n.t("draftNewsletterTitle"),options:c}}).done((e=>{h.Z.trackEvent("Emails > New Automatic Email Created",{"Event type":c.event,"Schedule type":c.afterTimeType,"Schedule value":c.afterTimeNumber}),t.push(`/template/${e.data.id}`)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0})}))}getEvent(e){return this.emailEvents[e]}getFirstSegment(){return T.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 o().createElement(Fn,{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 o().createElement("div",{className:"event-segment-selection"},o().createElement(N,{field:t.field,onValueChange:t.onValueChange}))}displayScheduling(){const{afterTimeNumber:e,afterTimeType:t,event:n}=this.state,a={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return o().createElement(Pn,{item:a.item,event:a.event,onValueChange:a.onValueChange})}displayEventTip(){const{event:e}=this.state;return e.tip?o().createElement("p",{className:"description"},o().createElement("strong",null,h.Z.I18n.t("tip"))," ",e.tip):null}render(){return o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(ft,{emailType:"woocommerce",automationId:"woocommerce_email_creation_heading"}),o().createElement(kt.r.Column,{align:"center",className:"mailpoet-schedule-email"},o().createElement("form",{id:"newsletter_scheduling"},o().createElement(Ce.Z,{level:4},this.displayHeader()),o().createElement("div",null,this.displayEventOptions()),o().createElement("div",null,this.displaySegments()),o().createElement("div",null,this.displayScheduling()),o().createElement(b.Z,{isFullWidth:!0,onClick:this.handleNextStep,type:"submit"},h.Z.I18n.t("next")))),this.displayEventTip())}}La.contextType=je.k,La.propTypes={history:y().shape({push:y().func.isRequired}).isRequired,name:y().string.isRequired,email:y().shape({title:y().string.isRequired,slug:y().string.isRequired}).isRequired};var Fa=La,qa=n(45853),$a=n(19013),Ua=n(13882);function Va(e){return(0,Ua.Z)(1,arguments),(0,$a.default)(e).getTime()<Date.now()}var ja=n(77349),Wa=n(36948);function Ya(e,t){return(0,Ua.Z)(2,arguments),(0,$a.default)(e).getTime()-(0,$a.default)(t).getTime()}var Ba={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function Ha(e){return e?Ba[e]:Ba.trunc}var za=n(44732),Ka=n(65221);function Ga(e){let{scheduledFor:t,processed:n,total:a,isPaused:r,status:i}=e;const s=!t&&!n&&!a,l=t&&function(e){return(0,Ua.Z)(1,arguments),(0,$a.default)(e).getTime()>Date.now()}(t),c=(!t||Va(t))&&n<a,u=(!t||Va(t))&&n>=a,d="sent"===i&&void 0===a;let p=0,m=(0,za.Z)("notSentYet");if(l){const e=h.Z.Date.short(t),n=h.Z.Date.time(t),a=new Date,r=(0,ja.default)(a,1),i=h.Z.Date.short(a)===e,s=h.Z.Date.short(r)===e;if(i||s){const t=Math.random().toString(36).substring(2,15),a=i?(0,za.Z)("today"):(0,za.Z)("tomorrow");m=o().createElement(o().Fragment,null,o().createElement("span",{"data-tip":!0,"data-for":t},a),o().createElement(Ka.Z,{place:"right",id:t},e),o().createElement("br",null),n)}else m=o().createElement(o().Fragment,null,e,o().createElement("br",null),n);const l=720,c=function(e,t,n){(0,Ua.Z)(2,arguments);var a=Ya(e,t)/Wa.yJ;return Ha(null==n?void 0:n.roundingMethod)(a)}(t,a);p=c<l?c/l*100:100}else c?(m=`${h.Z.Num.toLocaleFixed(n)} / ${h.Z.Num.toLocaleFixed(a)}`,p=n/a*100):u?(m=`${h.Z.Num.toLocaleFixed(a)} / ${h.Z.Num.toLocaleFixed(a)}`,p=100):d&&(m=(0,za.Z)("sent"),p=100);return!r||u||d||(m=(0,za.Z)("paused")),o().createElement("div",{className:g()({"mailpoet-listing-status":!0,"mailpoet-listing-status-unknown":s,"mailpoet-listing-status-scheduled":l,"mailpoet-listing-status-in-progress":c,"mailpoet-listing-status-sent":u||d})},l&&o().createElement(Xa,null),o().createElement(Qa,{percentage:p}),o().createElement("div",{className:"mailpoet-listing-status-label"},m))}function Qa(e){let{percentage:t}=e;const n=16*Math.PI,a=n*(t/100),r=n-a;return o().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},o().createElement("circle",{cx:"12",cy:"12",r:"8",className:"mailpoet-listing-status-percentage-background"}),o().createElement("circle",{r:"8",cx:"12",cy:"12",fill:"none",strokeDashoffset:n/4,strokeDasharray:`${a} ${r}`,className:"mailpoet-listing-status-percentage"}))}function Xa(){return o().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},o().createElement("path",{className:"mailpoet-listing-status-scheduled-icon",strokeLinecap:"round",d:"M12 7L12 12 15 15"}))}Ga.propTypes={scheduledFor:y().instanceOf(Date),processed:y().number,total:y().number,isPaused:y().bool,status:y().string},Qa.propTypes={percentage:y().number.isRequired};var Ja=Ga;const er=y().shape({status:y().string,count_processed:y().string.isRequired,count_total:y().string.isRequired,scheduled_at:y().string}),tr=y().shape({id:y().number.isRequired,sent_at:y().string,status:y().string.isRequired,queue:y().oneOfType([er,y().bool])});function nr(e){let{newsletter:t}=e;const[n,a]=o().useState("paused"===t.queue.status),[r,i]=o().useState([]);return o().createElement(o().Fragment,null,o().createElement(dt,{errors:r}),n&&o().createElement(b.Z,{dimension:"small",onClick:()=>{i([]),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:t.id}}).done((()=>a(!1))).fail((e=>i(e.errors)))}},h.Z.I18n.t("resume")),!n&&o().createElement(b.Z,{dimension:"small",onClick:()=>{i([]),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"pause",data:{newsletter_id:t.id}}).done((()=>a(!0))).fail((e=>i(e.errors)))}},h.Z.I18n.t("pause")))}function ar(e){let{newsletter:t,mailerLog:n}=e,a=t.sent_at||t.queue.scheduled_at;a&&(a=(0,qa.default)(a,"yyyy-MM-dd HH:mm:ss",new Date));const r=t.queue&&"scheduled"!==t.queue.status,i="paused"===n.status,s=o().createElement(o().Fragment,null,o().createElement(u.rU,{to:`/sending-status/${t.id}`,"data-automation-id":`sending_status_${t.id}`},o().createElement(Ja,{processed:parseInt(t.queue.count_processed,10),scheduledFor:a,total:parseInt(t.queue.count_total,10),isPaused:i,status:t.status})),"completed"!==t.queue.status&&!i&&o().createElement(nr,{newsletter:t})),l=o().createElement(Ja,{scheduledFor:a,isPaused:"scheduled"===t.queue.status&&i,status:t.status});return o().createElement(o().Fragment,null,r&&s,!r&&l)}nr.propTypes={newsletter:tr.isRequired},ar.propTypes={newsletter:tr.isRequired,mailerLog:y().shape({status:y().string}).isRequired};var rr=ar;const ir={opened:{badgeRanges:[30,10,0],badgeTypes:["excellent","good","average"],tooltipText:[h.Z.I18n.t("openedStatTooltipExcellent"),h.Z.I18n.t("openedStatTooltipGood"),h.Z.I18n.t("openedStatTooltipAverage")]},clicked:{badgeRanges:[3,1,0],badgeTypes:["excellent","good","average"],tooltipText:[h.Z.I18n.t("clickedStatTooltipExcellent"),h.Z.I18n.t("clickedStatTooltipGood"),h.Z.I18n.t("clickedStatTooltipAverage")]}},sr=(e,t)=>{const n=ir[e]||null;if(!n)return null;if(t<0||t>100)return null;const a=n.badgeRanges.length;for(let e=0;e<a;e+=1)if(t>n.badgeRanges[e])return n.badgeTypes[e];return n.badgeTypes[a-1]};function or(e){const t={excellent:{name:h.Z.I18n.t("excellentBadgeName"),tooltipTitle:h.Z.I18n.t("excellentBadgeTooltip")},good:{name:h.Z.I18n.t("goodBadgeName"),tooltipTitle:h.Z.I18n.t("goodBadgeTooltip")},average:{name:h.Z.I18n.t("averageBadgeName"),tooltipTitle:h.Z.I18n.t("averageBadgeTooltip")}},n=sr(e.stat,e.rate),a=t[n]||null;if(!a)return null;const r=ir[e.stat]||null;if(!r)return null;const i=e.tooltipId||null,s=o().createElement("div",{key:`tooltip-${i}`},o().createElement("div",{className:"mailpoet-listing-stats-tooltip-title"},a.tooltipTitle.toUpperCase()),o().createElement("div",{className:"mailpoet-listing-stats-tooltip-content"},o().createElement(H.Z,{type:"excellent",name:t.excellent.name})," : ",r.tooltipText[0],o().createElement("br",null),o().createElement(H.Z,{type:"good",name:t.good.name})," : ",r.tooltipText[1],o().createElement("br",null),o().createElement(H.Z,{type:"average",name:t.average.name})," : ",r.tooltipText[2]));return o().createElement(H.Z,{isInverted:e.isInverted,type:n,name:a.name,tooltip:s,tooltipId:i,tooltipPlace:e.tooltipPlace})}function lr(e){let{opened:t,clicked:n,revenues:a,hideBadges:r,newsletterId:i,wrapContentInLink:s}=e;const l=h.Z.Num.toLocaleFixed(t,1),c=h.Z.Num.toLocaleFixed(n,1);let u=o().createElement("div",{className:"mailpoet-listing-stats-opened-clicked"},o().createElement("div",{className:"mailpoet-listing-stats-percentages"},c,"%",o().createElement("br",null),o().createElement("span",{className:"mailpoet-listing-stats-percentages-opens"},l,"%")),!r&&o().createElement("div",null,o().createElement(or,{stat:"clicked",rate:n,tooltipId:`clicked-${i||"0"}`}))),d=null;if(a){const e=`revenues-${i||"0"}`;d=o().createElement("div",null,o().createElement(w.Z,{"data-tip":!0,"data-for":e},a),o().createElement(Ka.Z,{place:"top",multiline:!0,id:e},o().createElement("div",{className:"mailpoet-listing-stats-tooltip-content"},h.Z.I18n.t("revenueStatsTooltipShort"))))}return s&&(u=s(u,"opened-and-clicked"),d=s(d,"revenue")),o().createElement("div",{className:"mailpoet-listing-stats"},u,d)}or.propTypes={stat:y().string.isRequired,rate:y().number.isRequired,tooltipId:y().string,isInverted:y().bool},or.defaultProps={isInverted:!0},lr.propTypes={opened:y().number.isRequired,clicked:y().number.isRequired,revenues:y().string,hideBadges:y().bool,newsletterId:y().number,wrapContentInLink:y().func};var cr=lr,ur=n(93723);function dr(e){let{newsletter:t,isSent:n,currentTime:a}=e,r=n;if(void 0===r&&(r=t.statistics&&t.queue&&"scheduled"!==t.queue.status),!r)return null;const i={link:`/stats/${t.id}`,onClick:Ke().applyFilters("mailpoet_newsletters_listing_stats_tracking",ur.gP)},s=Number(t.total_sent||t.queue.count_processed);let l,c,d,p,m,f=0,g=0,v=null;s>0&&(f=100*t.statistics.clicked/s,g=100*t.statistics.opened/s,v=t.statistics.revenue),void 0!==a?(l=6,c=t.queue.scheduled_at||t.queue.created_at,d=ie()(a).diff(ie()(c),"hours"),p=d<l,m=!0):(p=!1,m=!1);const y=s>=20&&t.statistics.opened>=5&&!p,b=(e,n)=>((e,t,n,a)=>a<=0||!t.link?e:t.externalLink?o().createElement("a",{key:`stats-${n}`,href:t.link,onClick:t.onClick||null},e):o().createElement(u.rU,{key:`stats-${n}`,to:t.link,onClick:t.onClick||null},e))(e,i,`${n}-${t.id}`,s),_=o().createElement(cr,{opened:g,clicked:f,revenues:v&&v.value>0?v.formatted:null,hideBadges:!y,newsletterId:t.id,wrapContentInLink:b}),E=o().createElement(o().Fragment,null,_,p&&b(o().createElement(w.Z,{className:"mailpoet-listing-stats-too-early",dimension:"large",variant:"excellent",isInverted:!0},h.Z.I18n.t("checkBackInHours").replace("%1$d",l-d)),"check-back"));let Z;return m&&g<5&&d>=24&&s>=10&&(Z=o().createElement("div",null,o().createElement("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"},h.Z.I18n.t("improveThisLinkText")))),o().createElement(o().Fragment,null,E,Z)}const pr=y().shape({clicked:y().number,opened:y().number,unsubscribed:y().number,revenue:y().shape({count:y().number,currency:y().string,formatted:y().string,value:y().number})}),mr=y().shape({status:y().string,count_processed:y().string.isRequired,count_total:y().string.isRequired,created_at:y().string,scheduled_at:y().string});dr.propTypes={newsletter:y().shape({id:y().number.isRequired,queue:y().oneOfType([mr,y().bool]),total_sent:y().number,statistics:y().oneOfType([pr,y().bool])}).isRequired,isSent:y().bool,currentTime:y().string},dr.defaultProps={isSent:void 0,currentTime:void 0};var hr=dr;const fr=h.Z.trackingConfig.emailTrackingEnabled,gr={onNoItemsFound:(e,t)=>h.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterTrashed"):h.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterDeleted"):h.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterRestored"):h.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},vr=[{name:"subject",label:h.Z.I18n.t("subject"),sortable:!0},{name:"status",label:h.Z.I18n.t("status")},{name:"segments",label:h.Z.I18n.t("lists")},{name:"statistics",label:h.Z.I18n.t("statistics"),display:fr},{name:"sent_at",label:h.Z.I18n.t("sentOn"),sortable:!0}],yr=[{name:"trash",label:h.Z.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,yt.Z)({message:h.Z.I18n.t("confirmEdit"),onConfirm:t}):t()};let wr=[{name:"view",link:function(e){return o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),onClick:br},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:function(e,t){return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{h.Z.Notice.success(h.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];wr=(0,ur.y8)(wr);class _r extends o().Component{constructor(e){super(e),(0,k.Z)(this,"renderItem",((e,t,n)=>{const a=g()("manage-column","column-primary","has-row-actions");return o().createElement("div",null,o().createElement("td",{className:a},o().createElement("a",{className:"mailpoet-listing-title",href:"#",onClick:t=>{t.preventDefault(),br(e)}},e.queue.newsletter_rendered_subject||e.subject),t),o().createElement("td",{className:"column mailpoet-listing-status-column","data-colname":h.Z.I18n.t("status")},o().createElement(rr,{newsletter:e,mailerLog:n.mta_log})),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lists")},o().createElement(E,{segments:e.segments,dimension:"large"})),!0===fr?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},o().createElement(hr,{newsletter:e,currentTime:n.current_time})):null,o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("sentOn")},e.sent_at?o().createElement(o().Fragment,null,h.Z.Date.short(e.sent_at),o().createElement("br",null),h.Z.Date.time(e.sent_at)):null))})),(0,k.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return o().createElement(o().Fragment,null,0===this.state.newslettersCount&&o().createElement(mt,{filter:e=>"standard"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"standard",base_url:"standard",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:vr,bulk_actions:yr,item_actions:wr,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,ur._X)(e),(0,ur.bF)(e)}}))}}_r.contextType=je.k,_r.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var Er=(0,d.withRouter)(_r);const Zr=window.mailpoet_roles||{},Ir=window.mailpoet_segments||{},Sr=h.Z.trackingConfig.emailTrackingEnabled,kr={onNoItemsFound:(e,t)=>h.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterTrashed"):h.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterDeleted"):h.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterRestored"):h.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},Tr=[{name:"subject",label:h.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:h.Z.I18n.t("settings")},{name:"statistics",label:h.Z.I18n.t("statistics"),display:Sr},{name:"status",label:h.Z.I18n.t("status"),width:145},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],Cr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:kr.onTrash}];let Nr=[{name:"view",link:function(e){return o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:(e,t)=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{h.Z.Notice.success(h.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),onClick:ur.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Nr=(0,ur.y8)(Nr);class Dr extends o().Component{constructor(e){super(e),(0,k.Z)(this,"updateStatus",((e,t)=>{t.persist(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&h.Z.Notice.success(h.Z.I18n.t("welcomeEmailActivated")),this.forceUpdate()})).fail((n=>{h.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,k.Z)(this,"renderStatus",(e=>{const t=h.Z.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString()),n=h.Z.I18n.t("scheduledToXSubscribers").replace("%1$d",e.total_scheduled.toLocaleString());return o().createElement("div",null,o().createElement(Kt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),o().createElement("p",{className:"mailpoet-listing-stats-description"},o().createElement(u.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`},t)," ",o().createElement("br",null),n))})),(0,k.Z)(this,"renderSettings",(e=>{let t,n,a;switch(e.options.event){case"user":t="mailpoet_all"===e.options.role?h.Z.I18n.t("welcomeEventWPUserAnyRole"):x()(h.Z.I18n.t("welcomeEventWPUserWithRole"),'"%1$s"',((t,n)=>o().createElement(w.Z,{variant:"list",key:n},Zr[e.options.role])));break;default:if(a=T.ZP.find(Ir,(t=>Number(t.id)===Number(e.options.segment))),void 0===a)return o().createElement(u.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`},h.Z.I18n.t("sendingToSegmentsNotSpecified"));t=x()(h.Z.I18n.t("welcomeEventSegment"),'"%1$s"',((e,t)=>o().createElement(w.Z,{variant:"list",key:t},a.name)))}if(t&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":n=h.Z.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":n=h.Z.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":n=h.Z.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":n=h.Z.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:n=h.Z.I18n.t("sendingDelayInvalid")}return o().createElement("span",null,t,n&&o().createElement("div",{className:"mailpoet-listing-schedule"},o().createElement("div",{className:"mailpoet-listing-schedule-icon"},o().createElement(Xa,null)),n))})),(0,k.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return o().createElement("div",null,o().createElement("td",{className:n},o().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),!0===Sr?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},o().createElement(hr,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})):null,o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),o().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,k.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return o().createElement(o().Fragment,null,0===this.state.newslettersCount&&o().createElement(mt,{filter:e=>"welcome"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"welcome",base_url:"welcome",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Tr,bulk_actions:Cr,item_actions:Nr,messages:kr,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,ur._X)(e),(0,ur.bF)(e)}}))}}Dr.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var xr=(0,d.withRouter)(Dr);const Rr={onNoItemsFound:(e,t)=>h.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterTrashed"):h.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterDeleted"):h.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterRestored"):h.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},Or=[{name:"subject",label:h.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:h.Z.I18n.t("settings")},{name:"history",label:h.Z.I18n.t("history"),width:100},{name:"status",label:h.Z.I18n.t("status"),width:100},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],Ar=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Rr.onTrash}],Pr=[{name:"view",link:function(e){return o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),onClick:ur.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:function(e,t){return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{h.Z.Notice.success(h.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class Mr extends o().Component{constructor(e){super(e),(0,k.Z)(this,"updateStatus",((e,t)=>{t.persist(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&h.Z.Notice.success(h.Z.I18n.t("postNotificationActivated")),this.forceUpdate()})).fail((n=>{h.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,k.Z)(this,"renderStatus",(e=>o().createElement(Kt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}))),(0,k.Z)(this,"renderSettings",(e=>{let t;if(0===e.segments.length)return o().createElement(u.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`},h.Z.I18n.t("sendingToSegmentsNotSpecified"));const n=x()(h.Z.I18n.t("sendTo"),"%1$s",((t,n)=>o().createElement(E,{segments:e.segments,key:n})));switch(e.options.intervalType){case"daily":t=h.Z.I18n.t("sendDaily").replace("%1$s",un[e.options.timeOfDay]);break;case"weekly":t=h.Z.I18n.t("sendWeekly").replace("%1$s",dn[e.options.weekDay]).replace("%2$s",un[e.options.timeOfDay]);break;case"monthly":t=h.Z.I18n.t("sendMonthly").replace("%1$s",pn[e.options.monthDay]).replace("%2$s",un[e.options.timeOfDay]);break;case"nthWeekDay":t=h.Z.I18n.t("sendNthWeekDay").replace("%1$s",mn[e.options.nthWeekDay]).replace("%2$s",dn[e.options.weekDay]).replace("%3$s",un[e.options.timeOfDay]);break;case"immediately":t=h.Z.I18n.t("sendImmediately");break;default:t="Invalid sending frequency"}return o().createElement("span",null,n,o().createElement("div",{className:"mailpoet-listing-schedule"},o().createElement("div",{className:"mailpoet-listing-schedule-icon"},o().createElement(Xa,null)),t))})),(0,k.Z)(this,"renderHistoryLink",(e=>0===Number(e.children_count)?o().createElement("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small mailpoet-listing-notification-status"},h.Z.I18n.t("notSentYet")):o().createElement(u.rU,{className:"mailpoet-nowrap","data-automation-id":`history-${e.id}`,to:`/notification/history/${e.id}`},o().createElement(b.Z,{className:"mailpoet-hide-on-mobile",dimension:"small"},h.Z.I18n.t("viewHistory")),o().createElement(b.Z,{className:"mailpoet-show-on-mobile mailpoet-listing-notification-status",dimension:"small",variant:"secondary"},h.Z.I18n.t("viewHistory"))))),(0,k.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return o().createElement("div",null,o().createElement("td",{className:n},o().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("history")},this.renderHistoryLink(e)),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),o().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,k.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return o().createElement(o().Fragment,null,0===this.state.newslettersCount&&o().createElement(mt,{filter:e=>"notification"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"notification",base_url:"notification",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Or,bulk_actions:Ar,item_actions:Pr,messages:Rr,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,ur._X)(e),(0,ur.bF)(e)}}))}}Mr.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var Lr=(0,d.withRouter)(Mr);const Fr=h.Z.trackingConfig.emailTrackingEnabled,qr={onNoItemsFound:(e,t)=>h.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterTrashed"):h.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterDeleted"):h.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterRestored"):h.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},$r=[{name:"subject",label:h.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:h.Z.I18n.t("settings")},{name:"statistics",label:h.Z.I18n.t("statistics"),display:Fr},{name:"status",label:h.Z.I18n.t("status"),width:145},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],Ur=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:qr.onTrash}];let Vr=[{name:"view",link:function(e){return o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:(e,t)=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{h.Z.Notice.success(h.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),onClick:ur.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Vr=(0,ur.y8)(Vr);class jr extends o().Component{constructor(e){super(e),(0,k.Z)(this,"updateStatus",((e,t)=>{t.persist(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&h.Z.Notice.success(h.Z.I18n.t("reEngagementEmailActivated")),this.forceUpdate()})).fail((n=>{h.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,k.Z)(this,"renderStatus",(e=>{const t=h.Z.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString());return o().createElement("div",null,o().createElement(Kt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),o().createElement("p",{className:"mailpoet-listing-stats-description"},o().createElement(u.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`},t)))})),(0,k.Z)(this,"renderSettings",(e=>{if(0===e.segments.length)return o().createElement(u.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`},h.Z.I18n.t("sendingToSegmentsNotSpecified"));const t=x()(h.Z.I18n.t("sendTo"),"%1$s",((t,n)=>o().createElement(E,{segments:e.segments,key: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 a=h.Z.I18n.t("reEngagementSettings").replace("{$count}",e.options.afterTimeNumber).replace("{$frequency}",h.Z.I18n.t(n));return o().createElement("span",null,t,o().createElement("div",{className:"mailpoet-listing-schedule"},o().createElement("div",{className:"mailpoet-listing-schedule-icon"},o().createElement(Xa,null)),a))})),(0,k.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return o().createElement("div",null,o().createElement("td",{className:n},o().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),!0===Fr?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},o().createElement(hr,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})):null,o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),o().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,k.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return o().createElement(o().Fragment,null,0===this.state.newslettersCount&&o().createElement(mt,{filter:e=>"re_engagement"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"re_engagement",base_url:"re_engagement",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:$r,bulk_actions:Ur,item_actions:Vr,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,ur._X)(e),(0,ur.bF)(e)}}))}}jr.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var Wr=(0,d.withRouter)(jr);const Yr=h.Z.trackingConfig.emailTrackingEnabled,Br=[{name:"subject",label:h.Z.I18n.t("subject")},{name:"status",label:h.Z.I18n.t("status")},{name:"segments",label:h.Z.I18n.t("lists")},{name:"statistics",label:h.Z.I18n.t("statistics"),display:Yr},{name:"sent_at",label:h.Z.I18n.t("sentOn"),sortable:!0}],Hr={onNoItemsFound:(e,t)=>h.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterTrashed"):h.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterDeleted"):h.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterRestored"):h.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},zr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Hr.onTrash}],Kr=(0,ur.y8)([{name:"view",link:function(e){return o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"trash",className:"mailpoet-hide-on-mobile"}]),Gr=(e,t,n)=>{const a=g()("manage-column","column-primary","has-row-actions");return o().createElement(o().Fragment,null,o().createElement("td",{className:a},o().createElement("strong",null,o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},e.queue.newsletter_rendered_subject||e.subject)),t),o().createElement("td",{className:"column mailpoet-listing-status-column","data-colname":h.Z.I18n.t("status")},o().createElement(rr,{newsletter:e,mailerLog:n.mta_log})),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lists")},o().createElement(E,{segments:e.segments,dimension:"large"})),!0===Yr?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},o().createElement(hr,{newsletter:e,currentTime:n.current_time})):null,o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("sentOn")},e.sent_at?o().createElement(o().Fragment,null,h.Z.Date.short(e.sent_at),o().createElement("br",null),h.Z.Date.time(e.sent_at)):null))};function Qr(e){return o().createElement(o().Fragment,null,o().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:"/notification"},h.Z.I18n.t("backToPostNotifications")),o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:e.location,params:{...e.match.params,parentId:e.parentId},endpoint:"newsletters",type:"notification_history",base_url:"notification/history/:parentId",onRenderItem:Gr,columns:Br,messages:Hr,item_actions:Kr,bulk_actions:zr,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{(0,ur._X)(e),(0,ur.bF)(e)}}))}Qr.propTypes={parentId:y().string.isRequired,location:y().shape({pathname:y().string}).isRequired,match:y().shape({params:y().shape({id:y().node}).isRequired}).isRequired};var Xr=(0,d.withRouter)(Qr);const Jr=[{name:"subscriber_id",label:h.Z.I18n.t("subscriber"),sortable:!0},{name:"status",label:h.Z.I18n.t("sendingStatus")},{name:"failureReason",label:h.Z.I18n.t("failureReason")}],ei={onNoItemsFound:()=>h.Z.I18n.t("noSendingTaskFound")};function ti(e){const[t,n]=o().useState({id:e.match.params.id,subject:"",sent:!1});return o().useEffect((()=>{h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:t.id}}).done((e=>n({id:t.id,subject:e.data.subject,sent:null!==e.data.sent_at}))).fail((e=>h.Z.Notice.showApiErrorNotice(e)))}),[t.id]),o().createElement(o().Fragment,null,o().createElement("h1",null,h.Z.I18n.t("sendingStatusTitle")),o().createElement(ii,{newsletter:t}),o().createElement(ri,{location:e.location,params:e.match.params}))}ti.propTypes={location:y().shape({pathname:y().string}).isRequired,match:y().shape({params:y().shape({id:y().string.isRequired}).isRequired}).isRequired};const ni=(e,t)=>e.location.pathname===t.location.pathname&&e.params.id===t.params.id,ai=e=>o().createElement("div",null,o().createElement(si,e)),ri=o().memo((e=>{let{location:t,params:n}=e;return o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:t,params:n,endpoint:"sending_task_subscribers",base_url:"sending-status/:id",onRenderItem:ai,getListingItemKey:e=>`${e.taskId}-${e.subscriberId}`,columns:Jr,messages:ei,auto_refresh:!0,sort_by:"failed",sort_order:"desc",afterGetItems:e=>{(0,ur._X)(e),(0,ur.bF)(e)}})}),ni);function ii(e){let{newsletter:t}=e;return t.id&&t.subject&&t.sent?o().createElement("p",null,o().createElement(u.rU,{to:`/stats/${t.id}`},t.subject)):null}function si(e){let{error:t,failed:n,taskId:a,processed:r,email:i,subscriberId:s,lastName:l,firstName:c}=e;const u=g()("manage-column","column-primary","has-row-actions");let d=h.Z.I18n.t("unprocessed");return"1"===r&&(d="1"===n?o().createElement("span",null,h.Z.I18n.t("failed"),o().createElement("br",null),o().createElement("a",{className:"button",href:"#",onClick:e=>{e.preventDefault(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sending_task_subscribers",action:"resend",data:{taskId:a,subscriberId:s}}).done((()=>window.mailpoet_listing.forceUpdate())).fail((e=>h.Z.Notice.showApiErrorNotice(e)))}},h.Z.I18n.t("resend"))):h.Z.I18n.t("sent")),o().createElement(o().Fragment,null,o().createElement("td",{"data-automation-id":`name_${a}_${s}`,className:u},o().createElement("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-subscribers#/edit/${s}`},i),o().createElement("div",{className:"mailpoet-listing-subtitle"},`${c} ${l}`)),o().createElement("td",{className:"column","data-automation-id":`status_${a}_${s}`,"data-colname":h.Z.I18n.t("sendingStatus")},d),o().createElement("td",{className:"column","data-automation-id":`error_${a}_${s}`,"data-colname":h.Z.I18n.t("failureReason")},t))}ri.propTypes={location:y().shape({pathname:y().string}).isRequired,params:y().shape({id:y().string.isRequired}).isRequired},ii.propTypes={newsletter:y().shape({id:y().string,subject:y().string,sent:y().bool})},ii.defaultProps={newsletter:{id:null,subject:null,sent:!1}},si.propTypes={error:y().string,email:y().string.isRequired,failed:y().string.isRequired,taskId:y().string.isRequired,lastName:y().string.isRequired,firstName:y().string.isRequired,processed:y().string.isRequired,subscriberId:y().string.isRequired},si.defaultProps={error:""};var oi=ti;const li=h.Z.trackingConfig.emailTrackingEnabled,ci=window.mailpoet_woocommerce_automatic_emails||{},ui={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterTrashed"):h.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterDeleted"):h.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterRestored"):h.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},di=[{name:"subject",label:h.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:h.Z.I18n.t("settings")},{name:"statistics",label:h.Z.I18n.t("statistics"),display:li},{name:"status",label:h.Z.I18n.t("status"),width:145},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],pi=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:ui.onTrash}];let mi=[{name:"view",link:function(e){return o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),onClick:ur.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:(e,t)=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{h.Z.Notice.success(h.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"trash",className:"mailpoet-hide-on-mobile"}];mi=(0,ur.y8)(mi);class hi extends o().Component{constructor(e){super(e),(0,k.Z)(this,"updateStatus",((e,t)=>{t.persist(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{if("active"===e.data.status){const e=t.target.getAttribute("data-group"),n=ci[e];h.Z.Notice.success(h.Z.I18n.t("automaticEmailActivated").replace("%1s",n.title))}this.forceUpdate()})).fail((n=>{h.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,k.Z)(this,"renderStatus",(e=>{const t=parseInt(e.total_sent,10)>-1?h.Z.I18n.t("sentToXCustomers").replace("%1$d",e.total_sent.toLocaleString()):null;return o().createElement("div",null,o().createElement(Kt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,"data-group":e.options.group,dimension:"small",defaultChecked:"active"===e.status}),o().createElement("p",{className:"mailpoet-listing-notification-status"},t&&o().createElement(u.rU,{to:`/sending-status/${e.id}`},t),!t&&o().createElement("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small"},h.Z.I18n.t("notSentYet"))))})),(0,k.Z)(this,"renderSettings",(e=>{const t=ci[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 a=n&&n.option?T.ZP.pluck(n.option,"name"):[];if(n&&T.ZP.isEmpty(a))return o().createElement("span",{className:"mailpoet-listing-error"},h.Z.I18n.t("automaticEmailEventOptionsNotConfigured"));let r,i;if(r=a.length>1&&"listingScheduleDisplayTextPlural"in t?x()(t.listingScheduleDisplayTextPlural,"%s",((e,t)=>o().createElement(E,{strings:a,key:t}))):x()(t.listingScheduleDisplayText,"%s",((e,t)=>o().createElement(E,{strings:a,key:t}))),r&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":i=h.Z.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":i=h.Z.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":i=h.Z.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":i=h.Z.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:i=h.Z.I18n.t("sendingDelayInvalid")}return o().createElement("span",null,r,i&&o().createElement("div",{className:"mailpoet-listing-schedule"},o().createElement("div",{className:"mailpoet-listing-schedule-icon"},o().createElement(Xa,null)),i))})),(0,k.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return o().createElement("div",null,o().createElement("td",{className:n},o().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),!0===li?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},o().createElement(hr,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})):null,o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),o().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,k.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={eventCounts:{},newslettersCount:void 0},this.afterGetItems=this.afterGetItems.bind(this)}afterGetItems(e){(0,ur._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:o().createElement("div",{className:"notice error"},o().createElement("p",null,h.Z.I18n.t("wooCommerceEmailsWarning")),o().createElement("p",null,o().createElement("a",{href:"?page=mailpoet-settings#woocommerce"},h.Z.I18n.t("wooCommerceEmailsWarningLink")))):null}render(){const{match:e,location:t}=this.props;return o().createElement(o().Fragment,null,this.renderWarning(),0===this.state.newslettersCount&&o().createElement(mt,{filter:e=>"woocommerce"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:t,params:e.params,endpoint:"newsletters",type:"automatic",base_url:"woocommerce",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:di,bulk_actions:pi,item_actions:mi,messages:ui,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)}}))}}hi.propTypes={match:y().shape({params:y().shape({tab:y().string}).isRequired}).isRequired,location:y().object.isRequired};var fi=(0,d.withRouter)(hi),gi=function(){return o().createElement(o().Fragment,null,o().createElement("style",{dangerouslySetInnerHTML:{__html:".wrap { margin: 0 !important; }"}}))},vi=n(4840),yi=n(53681);const bi=e=>{const t=e<.1?2:1;return h.Z.Num.toLocaleFixed(e,t)};function wi(e){let{newsletter:t,isWoocommerceActive:n}=e;const a=t.total_sent||0;let r=0,i=0,s=0,l=0,c=0;a>0&&(r=100*t.statistics.clicked/a,i=100*t.statistics.opened/a,s=100*t.statistics.machineOpened/a,l=100*t.statistics.unsubscribed/a,c=100*t.statistics.bounced/a);const u=bi(r),d=bi(i),p=bi(s),m=bi(l),f=bi(c),g=a>=20&&t.statistics.opened>=5,v=o().createElement("div",{className:"mailpoet-statistics-value-small"},o().createElement("span",{className:"mailpoet-statistics-value-number"},d,"% "),h.Z.I18n.t("percentageOpened")),y=o().createElement("div",{className:"mailpoet-statistics-value-small"},o().createElement("span",{className:"mailpoet-statistics-value-number"},p,"% "),h.Z.I18n.t("percentageMachineOpened"),o().createElement(Ye.Z,{tooltip:x()(h.Z.I18n.t("percentageMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>o().createElement("span",{style:{pointerEvents:"all"},key:"machine-opened-tooltip"},o().createElement("a",{href:"https://kb.mailpoet.com/article/368-what-are-machine-opens",key:"kb-link",target:"_blank","data-beacon-article":"6124b7fb21ef206e5592e188",rel:"noopener noreferrer"},e))))})),b=o().createElement("div",{className:"mailpoet-statistics-value-small"},o().createElement("span",{className:"mailpoet-statistics-value-number"},m,"% "),h.Z.I18n.t("percentageUnsubscribed")),w=o().createElement("div",{className:"mailpoet-statistics-value-small"},o().createElement("span",{className:"mailpoet-statistics-value-number"},f,"% "),h.Z.I18n.t("percentageBounced")),_=sr("clicked",r),E=o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-statistics-value"},o().createElement("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${_}`},u,"% "),h.Z.I18n.t("percentageClicked")),g&&o().createElement(or,{isInverted:!1,stat:"clicked",rate:r,tooltipId:`clicked-${t.id||"0"}`,tooltipPlace:"right"}));return o().createElement("div",{className:"mailpoet-stats-general"},o().createElement(kt.r.ThreeColumns,{className:"mailpoet-stats-general-top-row"},o().createElement("div",null,o().createElement("div",{className:"mailpoet-statistics-value-small"},h.Z.I18n.t("statsTotalSent"),": ",o().createElement("span",{className:"mailpoet-statistics-value-number"},a.toLocaleString()))),o().createElement("div",{className:"mailpoet-statistics-with-left-separator"},b),o().createElement("div",{className:"mailpoet-statistics-with-left-separator"},w)),o().createElement(kt.r.ThreeColumns,null,o().createElement("div",null,E),o().createElement("div",{className:"mailpoet-statistics-with-left-separator"},v,y),n&&o().createElement("div",{className:"mailpoet-statistics-with-left-separator"},Ke().applyFilters("mailpoet_newsletters_revenues_stats",null,t.statistics.revenue)),!n&&o().createElement("div",null)),o().createElement("p",{className:"mailpoet-stats-general-read-more"},o().createElement("a",{href:"https://kb.mailpoet.com/article/190-whats-a-good-email-open-rate",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"58f671152c7d3a057f8858e8"},h.Z.I18n.t("readMoreOnStats"))))}function _i(e){let{newsletter:t}=e;const n=t.queue.scheduled_at||t.queue.created_at;return o().createElement(kt.r.ThreeColumns,{className:"mailpoet-stats-info"},o().createElement("div",{className:"mailpoet-grid-span-two-columns"},o().createElement(Ce.Z,{level:1},t.subject),o().createElement("div",null,o().createElement("b",null,h.Z.Date.short(n)," • ",h.Z.Date.time(n))),Array.isArray(t.segments)&&t.segments.length&&o().createElement("div",null,o().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("statsToSegments")),": ",o().createElement(E,{dimension:"large",segments:t.segments}))),o().createElement("div",{className:"mailpoet-stats-info-sender-preview"},o().createElement("div",null,o().createElement("div",{className:"mailpoet-stats-info-key-value"},o().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("statsFromAddress"),": "),t.sender_address?t.sender_address:"-"),o().createElement("div",{className:"mailpoet-stats-info-key-value"},o().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("statsReplyToAddress"),": "),t.reply_to_address?t.reply_to_address:"-"),o().createElement("div",{className:"mailpoet-stats-info-key-value"},o().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("googleAnalytics"),": "),t.ga_campaign?t.ga_campaign:"-")),o().createElement("div",null,o().createElement(xe.Button,{href:t.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("statsPreviewNewsletter")))))}function Ei(){const e=o().createElement(b.Z,{href:h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount,h.Z.currentWpUserEmail,"starter",{utm_medium:"stats",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("premiumBannerCtaFree")),t=o().createElement("p",null,h.Z.I18n.t("premiumBannerDescription")," ",o().createElement("a",{href:"admin.php?page=mailpoet-upgrade"},h.Z.I18n.t("learnMore")),".");return o().createElement("div",{className:"mailpoet-stats-premium-required"},o().createElement(Ge.Z,{title:h.Z.I18n.t("premiumFeature"),message:t,actionButton:e}))}wi.propTypes={isWoocommerceActive:y().bool.isRequired};var Zi=function(){if(!window.mailpoet_display_detailed_stats)return o().createElement(Ei,null);if(window.mailpoet_subscribers_limit_reached){const e=window.mailpoet_has_valid_api_key,t=h.Z.I18n.t("upgradeRequired"),n=h.Z.I18n.t(e?"newsletterYourPlanLimit":"newsletterFreeVersionLimit").replace("[subscribersLimit]",window.mailpoet_subscribers_limit).replace("[subscribersCount]",window.mailpoet_subscribers_count),a=e?"https://account.mailpoet.com/upgrade":`https://account.mailpoet.com/?s=${window.mailpoet_subscribers_count+1}`;return o().createElement("div",{className:"mailpoet-stats-premium-required"},o().createElement(Ge.Z,{title:t,message:o().createElement("p",null,n),actionButton:o().createElement(b.Z,{target:"_blank",rel:"noopener noreferrer",href:a},h.Z.I18n.t("upgradeNow"))}))}return null};function Ii(e){let{match:t,history:n,location:a}=e;const[r,i]=(0,s.useState)({item:void 0,loading:!0}),l=(0,s.useCallback)((e=>{i({loading:!0,item:r.item}),h.Z.Modal.loading(!0),h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:window.mailpoet_display_detailed_stats?"stats":"newsletters",action:window.mailpoet_display_detailed_stats?"get":"getWithStats",data:{id:e}}).always((()=>{h.Z.Modal.loading(!1)})).done((e=>{i({loading:!1,item:e.data})})).fail((e=>{h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0}),i({loading:!1}),n.push("/")}))}),[n,r.item]);(0,s.useEffect)((()=>{window.scrollTo(0,0),r.item?.id!==t.params.id&&l(t.params.id)}),[t.params.id,l,r.item]);const{item:c,loading:u}=r,d=c;return u?null:d?.subject&&!d?.queue?o().createElement("div",null,o().createElement(Ce.Z,{level:1},d.subject)):o().createElement(o().Fragment,null,o().createElement(Pe.Z,null),o().createElement(gi,null),o().createElement(j.Q,null),o().createElement("div",{className:"mailpoet-stats-page"},o().createElement(P,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),o().createElement(_i,{newsletter:d}),o().createElement(wi,{newsletter:d,isWoocommerceActive:h.Z.isWoocommerceActive}),o().createElement(vi.Z,{activeKey:"clicked"},o().createElement(yi.Z,{key:"clicked",title:h.Z.I18n.t("clickedLinks")},Ke().applyFilters("mailpoet_newsletters_clicked_links_table",o().createElement(Zi,null),d.clicked_links)),Ke().applyFilters("mailpoet_newsletters_purchased_products",null,d),o().createElement(yi.Z,{key:"engagement",title:h.Z.I18n.t("subscriberEngagement")},Ke().applyFilters("mailpoet_newsletters_subscriber_engagement",o().createElement(Zi,null),a,t.params,d)),o().createElement(yi.Z,{key:"bounces",title:h.Z.I18n.t("bounces"),automationId:"bounces-tab"},Ke().applyFilters("mailpoet_newsletters_bounces",o().createElement(Zi,null),a,t.params)))))}Ii.propTypes={match:y().shape({params:y().shape({id:y().string.isRequired}).isRequired}).isRequired,history:y().shape({push:y().func.isRequired}).isRequired,location:y().object.isRequired};var Si=(0,d.withRouter)(Ii),ki=n(48228),Ti=n(97762),Ci=n(87903),Ni=n.n(Ci);function Di(e){const t=e.installedDaysAgo,n=t>30?h.Z.I18n.t("reviewRequestUsingForMonths").replace("[months]",Math.round(t/30)):h.Z.I18n.t("reviewRequestUsingForDays").replace("[days]",t);return o().createElement("div",{className:"mailpoet_review_request"},o().createElement("img",{src:e.reviewRequestIllustrationUrl,height:"280",width:"280",alt:""}),o().createElement("h2",null,h.Z.I18n.t("reviewRequestHeading")),o().createElement("p",null,h.Z.I18n.t("reviewRequestDidYouKnow").replace("[username]",e.username)),o().createElement("p",null,n),o().createElement("p",null,o().createElement("a",{href:"http://bit.ly/2Bi124o",target:"_blank",rel:"noopener noreferrer",className:"button button-primary"},h.Z.I18n.t("reviewRequestRateUsNow"))),o().createElement("p",null,o().createElement("a",{id:"mailpoet_review_request_not_now"},h.Z.I18n.t("reviewRequestNotNow"))))}Di.propTypes={installedDaysAgo:y().number.isRequired,reviewRequestIllustrationUrl:y().string.isRequired,username:y().string.isRequired};var xi=Di;let Ri=null;const Oi=()=>((0,s.useLayoutEffect)((()=>{window.mailpoet_display_nps_poll&&h.Z.libs3rdPartyEnabled&&(Ri||(Ri=h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"analytics",action:"getTrackingData"})),Ri).then((e=>{let{data:t}=e;return(e=>{let t;t=window.mailpoet_display_nps_form?"EqOgKsgZd832Sz9w":window.mailpoet_is_new_user?"6L479eVPXk7pBn6S":"k0aJAsQAWI2ERyGv",Ni()({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&&h.Z.Modal.popup({width:800,template:Ti.renderToString(xi({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",(()=>h.Z.Modal.close()))}})}}})})(t)}))}),[]),null);var Ai=e=>function(t){return Oi(),o().createElement(e,t)},Pi=function(){return o().createElement(j.Q,null,o().createElement(u.rU,{id:"mailpoet-new-email",className:"mailpoet-button button-secondary",to:"/new",onClick:()=>h.Z.trackEvent("Emails > Add New"),"data-automation-id":"new_email"},W,o().createElement("span",null,h.Z.I18n.t("new"))))},Mi=(0,d.withRouter)((function(e){let{children:t,location:n}=e;return null!==(0,ht.X)(n)||(e=>e.hash.match(/^#\/new/)||e.pathname.match(/^\/new/))(n)?null:t}));function Li(e){let{mailpoetInstalledDaysAgo:t,sendTransactionalEmails:n,mtaMethod:a,noticeDismissed:r,apiVersion:i}=e;const[l,c]=(0,s.useState)(!1),u=()=>{h.Z.Ajax.post({api_version:i,endpoint:"UserFlags",action:"set",data:{transactional_emails_opt_in_notice_dismissed:"1"}})};return t<30||n||"PHPMail"===a||"1"===r||l?null:o().createElement(R.Z,{type:"success",timeout:!1,onClose:u},o().createElement("h3",null,h.Z.I18n.t("transactionalEmailNoticeTitle")),o().createElement("p",null,h.Z.I18n.t("transactionalEmailNoticeBody")," ",o().createElement("a",{href:"https://kb.mailpoet.com/article/292-choose-how-to-send-your-wordpress-websites-emails",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("transactionalEmailNoticeBodyReadMore"))),o().createElement("p",null,o().createElement("button",{type:"button",className:"button",onClick:()=>{c(!0),h.Z.Ajax.post({api_version:i,endpoint:"settings",action:"set",data:{send_transactional_emails:"1"}}),u()}},h.Z.I18n.t("transactionalEmailNoticeCTA"))))}Li.propTypes={mailpoetInstalledDaysAgo:y().number.isRequired,sendTransactionalEmails:y().bool.isRequired,noticeDismissed:y().string.isRequired,mtaMethod:y().string.isRequired,apiVersion:y().string.isRequired};var Fi=Li;const qi=window.mailpoet_woocommerce_automatic_emails||[],$i=Ai((()=>{const{parentId:e}=(0,d.useParams)();return o().createElement(o().Fragment,null,o().createElement(Mi,null,o().createElement(Pi,null)),o().createElement(ki.Z,{activeKey:"standard",routerType:"switch-only",onSwitch:e=>(e=>h.Z.trackEvent(`Tab Emails > ${e} clicked`))(e),automationId:"newsletters_listing_tabs"},o().createElement(yi.Z,{key:"standard",route:"standard/(.*)?",title:h.Z.I18n.t("tabStandardTitle"),automationId:`tab-${h.Z.I18n.t("tabStandardTitle")}`},o().createElement(Er,null)),o().createElement(yi.Z,{key:"welcome",route:"welcome/(.*)?",title:h.Z.I18n.t("tabWelcomeTitle"),automationId:`tab-${h.Z.I18n.t("tabWelcomeTitle")}`},o().createElement(xr,null)),o().createElement(yi.Z,{key:"notification",route:"notification/(.*)?",title:h.Z.I18n.t("tabNotificationTitle"),automationId:`tab-${h.Z.I18n.t("tabNotificationTitle")}`},e?o().createElement(Xr,{parentId:e}):o().createElement(Lr,null)),o().createElement(yi.Z,{key:"re_engagement",route:"re_engagement/(.*)?",title:h.Z.I18n.t("tabReEngagementTitle"),automationId:`tab-${h.Z.I18n.t("tabReEngagementTitle")}`},o().createElement(Wr,null)),window.mailpoet_woocommerce_active&&T.ZP.map(qi,(e=>o().createElement(yi.Z,{key:e.slug,route:`${e.slug}/(.*)?`,title:e.title,automationId:`tab-${e.title}`},o().createElement(fi,null))))))}));function Ui(e){let{history:t}=e;return o().createElement(mt,{history:t,hideClosingButton:0===window.mailpoet_newsletters_count})}Ui.propTypes={history:y().shape({push:y().func.isRequired}).isRequired};const Vi=[...(()=>{const e=[];return T.ZP.each(qi,(t=>{e.push({path:`/${t.slug}/(.*)?`,component:$i});const{events:n}=t;T.ZP.isObject(n)&&T.ZP.each(n,(n=>{e.push({path:`/new/${t.slug}/${n.slug}/conditions`,render:e=>{const a={...e,email:t,name:n.slug};return o().createElement(Fa,a)}})})),e.push({path:`/new/${t.slug}`,render:e=>{const n={...e,email:t};return o().createElement(ot,n)}})})),e})(),{path:"/notification/history/:parentId/(.*)?",component:$i},{path:"/(standard|welcome|notification|re_engagement)/(.*)?",component:$i},{path:"/new/standard",component:Da},{path:"/new/notification",component:Oa},{path:"/new/welcome",component:Ma},{path:"/new/re-engagement",component:function(){let e="";h.Z.settings.deactivate_subscriber_after_inactive_days&&(e=(Math.floor(Number(h.Z.settings.deactivate_subscriber_after_inactive_days)/30)-1).toString());const[t,n]=(0,s.useState)({afterTimeNumber:e,afterTimeType:"months"}),[a,r]=(0,s.useState)([]),[i,l]=(0,s.useState)(!1),c=(0,d.useHistory)();return o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),a&&o().createElement(dt,{errors:a}),o().createElement(ft,{emailType:"re_engagement",automationId:"re_engagement_heading_creation_heading"}),o().createElement(kt.r.Column,{align:"center",className:"mailpoet-schedule-email"},o().createElement(Yn,{afterTimeNumber:t.afterTimeNumber,afterTimeType:t.afterTimeType,inactiveSubscribersPeriod:Number(h.Z.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:(0,jn.compose)([n,(0,jn.assoc)("afterTimeNumber",jn.__,t)]),updateAfterTimeType:(0,jn.compose)([n,(0,jn.assoc)("afterTimeType",jn.__,t)])}),o().createElement(b.Z,{isFullWidth:!0,onClick:()=>(r([]),l(!0),void h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"newsletters",action:"create",data:{type:"re_engagement",subject:h.Z.I18n.t("draftNewsletterTitle"),options:t}}).done((e=>{var t;t=e.data.id,c.push(`/template/${t}`)})).fail((e=>{l(!1),e.errors&&r(e.errors)}))),type:"button",isDisabled:!t.afterTimeNumber||i,withSpinner:i},h.Z.I18n.t("next"))))}},{path:"/new",component:Ui},{name:"template",path:"/template/:id",component:St},{path:"/send/congratulate/:id",component:Ca},{path:"/send/:id",component:na},{path:"/sending-status/:id/(.*)?",component:oi},{path:"/stats/:id/(.*)?",component:Si}];function ji(){return o().createElement(je.k.Provider,{value:(0,je.S)(window)},o().createElement(u.UT,null,o().createElement(et.Z,null),o().createElement(O,null),o().createElement(L,null),o().createElement(Fi,{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}),o().createElement(P,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),o().createElement(d.Switch,null,o().createElement(d.Route,{exact:!0,path:"/",render:()=>o().createElement(d.Redirect,{to:0===window.mailpoet_newsletters_count?"/new":"/standard"})}),Vi.map((e=>o().createElement(d.Route,{key:e.path,path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render}))))))}const Wi=document.getElementById("newsletters_container");Wi&&(window.mailpoet_listing=c().render(o().createElement(ji,null),Wi));const Yi=e=>"wp_users"===e.type,Bi=e=>"woocommerce_users"===e.type,Hi=e=>Yi(e)||Bi(e),zi=h.Z.trackingConfig.emailTrackingEnabled,Ki=[{name:"name",label:h.Z.I18n.t("name"),sortable:!0},{name:"description",label:h.Z.I18n.t("description")},{name:"average_subscriber_score",label:h.Z.I18n.t("listScore"),display:zi},{name:"subscribed",label:h.Z.I18n.t("subscribed"),className:"mailpoet-listing-column-narrow"},{name:"unconfirmed",label:h.Z.I18n.t("unconfirmed"),className:"mailpoet-listing-column-narrow"},{name:"unsubscribed",label:h.Z.I18n.t("unsubscribed"),className:"mailpoet-listing-column-narrow"},{name:"inactive",label:h.Z.I18n.t("inactive"),className:"mailpoet-listing-column-narrow"},{name:"bounced",label:h.Z.I18n.t("bounced"),className:"mailpoet-listing-column-narrow"},{name:"created_at",label:h.Z.I18n.t("createdOn"),sortable:!0}],Gi={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneSegmentTrashed"):h.Z.I18n.t("multipleSegmentsTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneSegmentDeleted"):h.Z.I18n.t("multipleSegmentsDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneSegmentRestored"):h.Z.I18n.t("multipleSegmentsRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},Qi=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Gi.onTrash}],Xi=e=>!Hi(e),Ji=[{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return o().createElement(u.rU,{to:`/edit/${e.id}`},h.Z.I18n.t("edit"))},display:function(e){return!Hi(e)}},{name:"duplicate_segment",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:(e,t)=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"duplicate",data:{id:e.id}}).done((e=>{h.Z.Notice.success(h.Z.I18n.t("listDuplicated").replace("%1$s",e.data.name)),t()})).fail((e=>{h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),display:function(e){return!Hi(e)}},{name:"read_more",className:"mailpoet-hide-on-mobile",link:function(){return o().createElement("a",{href:"https://kb.mailpoet.com/article/133-the-wordpress-users-list",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("readMore"))},display:function(e){return Yi(e)}},{name:"synchronize_segment",label:h.Z.I18n.t("forceSync"),onClick:function(e,t){h.Z.Modal.loading(!0),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"synchronize",data:{type:e.type}}).done((()=>{let n=h.Z.I18n.t("listSynchronized").replace("%1$s",e.name);"woocommerce_users"===e.type&&(n=h.Z.I18n.t("listSynchronizationWasScheduled").replace("%1$s",e.name)),h.Z.Modal.loading(!1),h.Z.Notice.success(n),t()})).fail((e=>{h.Z.Modal.loading(!1),e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},display:function(e){return Yi(e)||Bi(e)}},{name:"view_subscribers",link:function(e){return o().createElement("a",{href:e.subscribers_url,"data-automation-id":`view_subscribers_${e.name}`},h.Z.I18n.t("viewSubscribers"))}},{name:"trash",className:"mailpoet-hide-on-mobile",display:function(e){return!Bi(e)}}];class es extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions"),a=Number(e.subscribers_count.subscribed||0),r=Number(e.subscribers_count.unconfirmed||0),i=Number(e.subscribers_count.unsubscribed||0),s=Number(e.subscribers_count.inactive||0),l=Number(e.subscribers_count.bounced||0);let c;return c=Hi(e)?o().createElement("span",{className:"mailpoet-listing-title"},e.name):o().createElement(u.rU,{className:"mailpoet-listing-title",to:`/edit/${e.id}`},e.name),o().createElement("div",null,o().createElement("td",{className:n,"data-automation-id":`segment_name_${e.name}`},c,t),o().createElement("td",{"data-colname":h.Z.I18n.t("description")},o().createElement("abbr",null,e.description)),zi?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("averageScore")},o().createElement("div",{className:"mailpoet-listing-stats"},o().createElement(z,{id:e.id,engagementScore:e.average_engagement_score}))):null,o().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribed")},o().createElement("abbr",null,a.toLocaleString())),o().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("unconfirmed")},o().createElement("abbr",null,r.toLocaleString())),o().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("unsubscribed")},o().createElement("abbr",null,i.toLocaleString())),o().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("inactive")},o().createElement("abbr",null,s.toLocaleString())),o().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("bounced")},o().createElement("abbr",null,l.toLocaleString())),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("createdOn")},h.Z.Date.short(e.created_at),o().createElement("br",null),h.Z.Date.time(e.created_at)))}))}render(){return o().createElement("div",{className:"mailpoet-segments-listing"},o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:Gi,search:!1,endpoint:"segments",base_url:"lists",onRenderItem:this.renderItem,columns:Ki,bulk_actions:Qi,item_actions:Ji,sort_by:"name",sort_order:"asc",isItemDeletable:Xi,isItemToggleable:Yi}))}}es.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var ts=(0,d.withRouter)(es);const ns=[{name:"name",label:h.Z.I18n.t("name"),type:"text"},{name:"description",label:h.Z.I18n.t("description"),type:"textarea",tip:h.Z.I18n.t("segmentDescriptionTip")}],as={onUpdate:function(){h.Z.Notice.success(h.Z.I18n.t("segmentUpdated"))},onCreate:function(){h.Z.Notice.success(h.Z.I18n.t("segmentAdded")),h.Z.trackEvent("Lists > Add new")}};function rs(e){return o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(Pe.Z,null),o().createElement(Ce.Z,{level:1,className:"mailpoet-title"},o().createElement("span",null,h.Z.I18n.t("segment")),o().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:"/"},h.Z.I18n.t("backToList"))),o().createElement(O,null),o().createElement(Oe,{endpoint:"segments",fields:ns,params:e.match.params,messages:as}))}rs.propTypes={match:y().shape({params:y().shape({id:y().string}).isRequired}).isRequired};var is=rs,ss=n(41882),os=n(94878),ls=n(1030),cs=n(96486),us=n.n(cs),ds=n(54791);function ps(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,ss.Z)("mailpoet-dynamic-segments-form"),i=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[])?.map((e=>{const t=e.sent_at?h.Z.Date.format(e.sent_at):h.Z.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}}));return(0,s.useEffect)((()=>{n.operator!==ds.AnyValueTypes.ANY&&n.operator!==ds.AnyValueTypes.ALL&&n.operator!==ds.AnyValueTypes.NONE&&a({operator:ds.AnyValueTypes.ANY},t),n.action===ds.EmailActionTypes.MACHINE_OPENED&&n.operator===ds.AnyValueTypes.NONE&&a({operator:ds.AnyValueTypes.ANY},t)}),[n.action,n.operator,t,a]),o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",isFullWidth:!0,value:n.operator,onChange:e=>{r("operator",t,e)}},o().createElement("option",{value:ds.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:ds.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),n.action!==ds.EmailActionTypes.MACHINE_OPENED?o().createElement("option",{value:ds.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")):null)),o().createElement(kt.r.CenteredRow,null,o().createElement(ls.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:h.Z.I18n.t("selectNewsletterPlaceholder"),options:i,automationId:"segment-email",value:(0,jn.filter)((e=>{if(!n.newsletters)return;const t=e.value;return-1!==n.newsletters.indexOf(t)}),i),onChange:e=>{a({newsletters:(0,jn.map)("value",e)},t)}})))}ps.propTypes={filterIndex:y().number.isRequired};const ms=e=>!!e;function hs(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,ss.Z)("mailpoet-dynamic-segments-form"),i=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),[l,c]=(0,s.useState)([]),[u,d]=(0,s.useState)([]),[p,m]=(0,s.useState)(!1),f=i?.map((e=>{const t=e.sent_at?h.Z.Date.format(e.sent_at):h.Z.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}})),g=(0,s.useCallback)((()=>{var e;ms(n.newsletter_id)&&(d([]),e=n.newsletter_id,c([]),m(!0),h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"newsletter_links",action:"get",data:{newsletterId:e}}).then((e=>{const{data:t}=e,n=t.map((e=>({value:e.id,label:e.url})));m(!1),d(n)})).fail((e=>{c(e.errors)})))}),[n.newsletter_id]);return(0,s.useEffect)((()=>{g()}),[g,n.newsletter_id]),(0,s.useEffect)((()=>{n.operator!==ds.AnyValueTypes.ANY&&n.operator!==ds.AnyValueTypes.ALL&&n.operator!==ds.AnyValueTypes.NONE&&a({operator:ds.AnyValueTypes.ANY},t)}),[n.operator,t,a]),o().createElement(o().Fragment,null,l.length>0&&o().createElement(dt,{errors:l}),o().createElement(kt.r.CenteredRow,null,o().createElement(ls.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectNewsletterPlaceholder"),options:f,value:(0,jn.find)(["value",n.newsletter_id],f),onChange:e=>{a({newsletter_id:e.value,link_ids:[]},t)},automationId:"segment-email"})),o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{isMinWidth:!0,key:"select-operator",value:n.operator,onChange:e=>r("operator",t,e),automationId:"select-operator"},o().createElement("option",{value:ds.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:ds.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:ds.AnyValueTypes.NONE},h.Z.I18n.t("noneOf"))),p&&o().createElement("span",null,h.Z.I18n.t("loadingDynamicSegmentItems")),!p&&ms(n.newsletter_id)&&o().createElement(ls.Z,{isMulti:!0,dimension:"small",isFullWidth:!0,automationId:"segment-link-select",placeholder:h.Z.I18n.t("allLinksPlaceholder"),options:u.length?u:[{value:0,label:h.Z.I18n.t("noLinksHint"),isDisabled:!0}],value:(0,jn.filter)((e=>!!n.link_ids&&-1!==n.link_ids.indexOf(e.value)),u),onChange:e=>{a({link_ids:(e||[]).map((e=>e.value))},t)}})))}function fs(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,ss.Z)("mailpoet-dynamic-segments-form");return(0,s.useEffect)((()=>{void 0===n.operator&&a({operator:"more"},t)}),[a,n,t]),o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,(i=e=>"{condition}"===e?o().createElement(he.Z,{key:"select",value:n.operator,onChange:e=>{r("operator",t,e)}},o().createElement("option",{value:"more"},h.Z.I18n.t("moreThan")),o().createElement("option",{value:"less"},h.Z.I18n.t("lessThan")),o().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),o().createElement("option",{value:"not_equals"},h.Z.I18n.t("notEquals"))):"{opens}"===e?o().createElement(le.Z,{key:"input",type:"number",value:n.opens||"","data-automation-id":"segment-number-of-opens",onChange:e=>{r("opens",t,e)},min:"0",placeholder:h.Z.I18n.t("emailActionOpens")}):"string"==typeof e&&e.trim().length>1?o().createElement("div",{key:"opens"},e):null,h.Z.I18n.t("emailActionOpensSentence").split(/({condition})|({opens})|(\b[a-zA-Z]+\b)/gim).map(i))),o().createElement(kt.r.CenteredRow,null,h.Z.I18n.t("emailActionOpensDaysSentence").split(/({days})/gim).map((e=>"{days}"===e?o().createElement(le.Z,{key:"input",type:"number",value:n.days||"","data-automation-id":"segment-number-of-days",onChange:e=>{r("days",t,e)},min:"0",placeholder:h.Z.I18n.t("emailActionDays")}):"string"==typeof e&&e.trim().length>1?o().createElement("div",{key:e},e):null))));var i}hs.propTypes={filterIndex:y().number.isRequired},fs.propTypes={filterIndex:y().number.isRequired};const gs=[{value:ds.EmailActionTypes.OPENS_ABSOLUTE_COUNT,label:h.Z.I18n.t("emailActionOpensAbsoluteCount"),group:ds.SegmentTypes.Email},{value:ds.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT,label:h.Z.I18n.t("emailActionMachineOpensAbsoluteCount"),group:ds.SegmentTypes.Email},{value:ds.EmailActionTypes.OPENED,label:h.Z.I18n.t("emailActionOpened"),group:ds.SegmentTypes.Email},{value:ds.EmailActionTypes.MACHINE_OPENED,label:h.Z.I18n.t("emailActionMachineOpened"),group:ds.SegmentTypes.Email},{value:ds.EmailActionTypes.CLICKED,label:h.Z.I18n.t("emailActionClicked"),group:ds.SegmentTypes.Email},{value:ds.EmailActionTypes.CLICKED_ANY,label:h.Z.I18n.t("emailActionClickedAnyEmail"),group:ds.SegmentTypes.Email}],vs={[ds.EmailActionTypes.OPENS_ABSOLUTE_COUNT]:fs,[ds.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT]:fs,[ds.EmailActionTypes.CLICKED]:hs,[ds.EmailActionTypes.OPENED]:ps,[ds.EmailActionTypes.MACHINE_OPENED]:ps,[ds.EmailActionTypes.CLICKED_ANY]:null};function ys(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),a=vs[n.action];return a?o().createElement(a,{filterIndex:t}):null}var bs;ys.propTypes={filterIndex:y().number.isRequired},function(e){e.NUMBER_OF_ORDERS="numberOfOrders",e.PURCHASED_CATEGORY="purchasedCategory",e.PURCHASED_PRODUCT="purchasedProduct",e.TOTAL_SPENT="totalSpent",e.CUSTOMER_IN_COUNTRY="customerInCountry"}(bs||(bs={}));const ws=[{value:bs.CUSTOMER_IN_COUNTRY,label:h.Z.I18n.t("wooCustomerInCountry"),group:ds.SegmentTypes.WooCommerce},{value:bs.NUMBER_OF_ORDERS,label:h.Z.I18n.t("wooNumberOfOrders"),group:ds.SegmentTypes.WooCommerce},{value:bs.PURCHASED_CATEGORY,label:h.Z.I18n.t("wooPurchasedCategory"),group:ds.SegmentTypes.WooCommerce},{value:bs.PURCHASED_PRODUCT,label:h.Z.I18n.t("wooPurchasedProduct"),group:ds.SegmentTypes.WooCommerce},{value:bs.TOTAL_SPENT,label:h.Z.I18n.t("wooTotalSpent"),group:ds.SegmentTypes.WooCommerce}],_s=[bs.PURCHASED_PRODUCT,bs.PURCHASED_CATEGORY],Es=e=>{let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,ss.Z)("mailpoet-dynamic-segments-form"),i=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getProductCategories()),[]),l=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCountries()),[]),c=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getProducts()),[]),u=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCurrencySymbol()),[]),d=c.map((e=>({value:e.id,label:e.name}))),p=i.map((e=>({value:e.id,label:e.name}))),m=l.map((e=>({value:e.code,label:e.name})));let f;return(0,s.useEffect)((()=>{void 0===n.number_of_orders_type&&n.action===bs.NUMBER_OF_ORDERS&&a({number_of_orders_type:"="},t),void 0===n.total_spent_type&&n.action===bs.TOTAL_SPENT&&a({total_spent_type:">"},t),_s.includes(n.action)&&n.operator!==ds.AnyValueTypes.ALL&&n.operator!==ds.AnyValueTypes.ANY&&n.operator!==ds.AnyValueTypes.NONE&&a({operator:ds.AnyValueTypes.ANY},t),n.action===bs.CUSTOMER_IN_COUNTRY&&n.operator!==ds.AnyValueTypes.ANY&&n.operator!==ds.AnyValueTypes.NONE&&a({operator:ds.AnyValueTypes.ANY},t)}),[a,n,t]),n.action===bs.PURCHASED_PRODUCT?f=o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>a({operator:e.target.value},t),automationId:"select-operator"},o().createElement("option",{value:ds.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:ds.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:ds.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ls.Z,{isMulti:!0,dimension:"small",key:"select-segment-products",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooPurchasedProduct"),options:d,value:(0,jn.filter)((e=>{if(void 0!==n.product_ids&&0!==n.product_ids.length)return-1!==n.product_ids.indexOf(e.value)}),d),onChange:e=>a({product_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-products"}))):n.action===bs.PURCHASED_CATEGORY?f=o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>a({operator:e.target.value},t),automationId:"select-operator"},o().createElement("option",{value:ds.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:ds.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:ds.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ls.Z,{isMulti:!0,dimension:"small",key:"select-segment-category",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooPurchasedCategory"),options:p,value:(0,jn.filter)((e=>{if(void 0!==n.category_ids&&0!==n.category_ids.length)return-1!==n.category_ids.indexOf(e.value)}),p),onChange:e=>a({category_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-category"}))):n.action===bs.NUMBER_OF_ORDERS?f=o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",value:n.number_of_orders_type,onChange:e=>{r("number_of_orders_type",t,e)},automationId:"select-number-of-orders-type"},o().createElement("option",{value:"="},h.Z.I18n.t("equals")),o().createElement("option",{value:"!="},h.Z.I18n.t("notEquals")),o().createElement("option",{value:">"},h.Z.I18n.t("moreThan")),o().createElement("option",{value:"<"},h.Z.I18n.t("lessThan"))),o().createElement(le.Z,{"data-automation-id":"input-number-of-orders-count",type:"number",min:0,value:n.number_of_orders_count||"",placeholder:h.Z.I18n.t("wooNumberOfOrdersCount"),onChange:e=>{r("number_of_orders_count",t,e)}}),o().createElement("div",null,h.Z.I18n.t("wooNumberOfOrdersOrders"))),o().createElement(kt.r.CenteredRow,null,o().createElement("div",null,h.Z.I18n.t("inTheLast")),o().createElement(le.Z,{"data-automation-id":"input-number-of-orders-days",type:"number",min:1,value:n.number_of_orders_days||"",placeholder:h.Z.I18n.t("daysPlaceholder"),onChange:e=>{r("number_of_orders_days",t,e)}}),o().createElement("div",null,h.Z.I18n.t("days")))):n.action===bs.TOTAL_SPENT?f=o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",value:n.total_spent_type,onChange:e=>{r("total_spent_type",t,e)},automationId:"select-total-spent-type"},o().createElement("option",{value:"="},h.Z.I18n.t("equals")),o().createElement("option",{value:"!="},h.Z.I18n.t("notEquals")),o().createElement("option",{value:">"},h.Z.I18n.t("moreThan")),o().createElement("option",{value:"<"},h.Z.I18n.t("lessThan"))),o().createElement(le.Z,{"data-automation-id":"input-total-spent-amount",type:"number",min:0,step:.01,value:n.total_spent_amount||"",placeholder:h.Z.I18n.t("wooTotalSpentAmount"),onChange:e=>{r("total_spent_amount",t,e)}}),o().createElement("div",null,u)),o().createElement(kt.r.CenteredRow,null,o().createElement("div",null,h.Z.I18n.t("inTheLast")),o().createElement(le.Z,{"data-automation-id":"input-total-spent-days",type:"number",min:1,value:n.total_spent_days||"",placeholder:h.Z.I18n.t("daysPlaceholder"),onChange:e=>{r("total_spent_days",t,e)}}),o().createElement("div",null,h.Z.I18n.t("days")))):n.action===bs.CUSTOMER_IN_COUNTRY&&(f=o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator-country",value:n.operator,onChange:e=>a({operator:e.target.value},t),automationId:"select-operator-country"},o().createElement("option",{value:ds.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:ds.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ls.Z,{dimension:"small",key:"select-segment-country",isFullWidth:!0,isMulti:!0,placeholder:h.Z.I18n.t("selectWooCountry"),options:m,value:(0,jn.filter)((e=>{if(n.country_code)return-1!==n.country_code.indexOf(e.value)}),m),onChange:e=>a({country_code:(e||[]).map((e=>e.value))},t),automationId:"select-segment-country"})))),f};function Zs(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,ss.Z)("mailpoet-dynamic-segments-form");(0,s.useEffect)((()=>{n.action===ds.SubscriberActionTypes.WORDPRESS_ROLE&&n.operator!==ds.AnyValueTypes.ANY&&n.operator!==ds.AnyValueTypes.ALL&&n.operator!==ds.AnyValueTypes.NONE&&a({operator:ds.AnyValueTypes.ANY},t)}),[a,n,t]);const i=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getWordpressRoles()),[]).map((e=>({value:e.role_id,label:e.role_name})));return o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",isFullWidth:!0,value:n.operator,onChange:e=>{r("operator",t,e)}},o().createElement("option",{value:ds.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:ds.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:ds.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ls.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,automationId:"segment-wordpress-role",placeholder:h.Z.I18n.t("selectUserRolePlaceholder"),options:i,value:(0,jn.filter)((e=>{if(n.wordpressRole)return-1!==n.wordpressRole.indexOf(e.value)}),i),onChange:e=>{a({wordpressRole:(0,jn.map)("value",e)},t)}})))}let Is;Es.propTypes={filterIndex:y().number.isRequired},Zs.propTypes={filterIndex:y().number.isRequired},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"}(Is||(Is={}));const Ss=[Is.HIGHER_THAN,Is.LOWER_THAN,Is.EQUALS,Is.NOT_EQUALS,Is.UNKNOWN,Is.NOT_UNKNOWN];function ks(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,ss.Z)("mailpoet-dynamic-segments-form");return(0,s.useEffect)((()=>{Ss.includes(n.operator)||a({operator:Is.HIGHER_THAN},t),n.operator!==Is.HIGHER_THAN&&n.operator!==Is.LOWER_THAN&&n.operator!==Is.EQUALS&&n.operator!==Is.NOT_EQUALS||void 0!==n.value||a({value:""},t),n.operator!==Is.UNKNOWN&&n.operator!==Is.NOT_UNKNOWN||a({value:null},t)}),[a,n,t]),o().createElement(kt.r.CenteredRow,null,(i=e=>"{condition}"===e?o().createElement(he.Z,{key:"select",value:n.operator,automationId:"segment-subscriber-score-operator",onChange:e=>{r("operator",t,e)}},o().createElement("option",{value:Is.HIGHER_THAN},h.Z.I18n.t("higherThan")),o().createElement("option",{value:Is.LOWER_THAN},h.Z.I18n.t("lowerThan")),o().createElement("option",{value:Is.EQUALS},h.Z.I18n.t("equals")),o().createElement("option",{value:Is.NOT_EQUALS},h.Z.I18n.t("notEquals")),o().createElement("option",{value:Is.UNKNOWN},h.Z.I18n.t("unknown")),o().createElement("option",{value:Is.NOT_UNKNOWN},h.Z.I18n.t("notUnknown"))):"{score}"===e?(n.operator===Is.HIGHER_THAN||n.operator===Is.LOWER_THAN||n.operator===Is.EQUALS||n.operator===Is.NOT_EQUALS)&&o().createElement(le.Z,{key:"input",type:"number",value:n.value||"","data-automation-id":"segment-subscriber-score-value",onChange:e=>{r("value",t,e)},min:"0",placeholder:h.Z.I18n.t("subscriberScorePlaceholder")}):"string"==typeof e&&e.trim().length>0?n.operator!==Is.UNKNOWN&&n.operator!==Is.NOT_UNKNOWN&&o().createElement("div",{key:"score"},e):null,h.Z.I18n.t("subscriberScoreSentence").split(/({condition})|({score})|(\b%\b)/gim).map(i)));var i}ks.propTypes={filterIndex:y().number.isRequired};var Ts=n(23855),Cs=n(12274);let Ns;!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"}(Ns||(Ns={}));const Ds=[Ns.BEFORE,Ns.AFTER,Ns.ON,Ns.NOT_ON,Ns.IN_THE_LAST,Ns.NOT_IN_THE_LAST],xs=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return h.Z.Date.format(e,{format:"Y-m-d"})}},Rs=e=>{const t=(0,Ts.default)(e);if((0,Cs.default)(t))return t};function Os(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,ss.Z)("mailpoet-dynamic-segments-form");return(0,s.useEffect)((()=>{Ds.includes(n.operator)||a({operator:Ns.BEFORE},t),n.operator!==Ns.BEFORE&&n.operator!==Ns.AFTER&&n.operator!==Ns.ON&&n.operator!==Ns.NOT_ON||void 0!==Rs(n.value)&&/^\d+-\d+-\d+$/.test(n.value)||a({value:xs(new Date)},t),n.operator!==Ns.IN_THE_LAST&&n.operator!==Ns.NOT_IN_THE_LAST||"string"!=typeof n.value||/^\d*$/.exec(n.value)||a({value:""},t)}),[a,n,t]),o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",value:n.operator,onChange:e=>{r("operator",t,e)}},o().createElement("option",{value:Ns.BEFORE},h.Z.I18n.t("before")),o().createElement("option",{value:Ns.AFTER},h.Z.I18n.t("after")),o().createElement("option",{value:Ns.ON},h.Z.I18n.t("on")),o().createElement("option",{value:Ns.NOT_ON},h.Z.I18n.t("notOn")),o().createElement("option",{value:Ns.IN_THE_LAST},h.Z.I18n.t("inTheLast")),o().createElement("option",{value:Ns.NOT_IN_THE_LAST},h.Z.I18n.t("notInTheLast"))),(n.operator===Ns.BEFORE||n.operator===Ns.AFTER||n.operator===Ns.ON||n.operator===Ns.NOT_ON)&&o().createElement(Dt,{dateFormat:"MMM d, yyyy",onChange:e=>{a({value:xs(e)},t)},selected:n.value?Rs(n.value):void 0}),(n.operator===Ns.IN_THE_LAST||n.operator===Ns.NOT_IN_THE_LAST)&&o().createElement(o().Fragment,null,o().createElement(le.Z,{key:"input",type:"number",value:n.value,onChange:e=>{r("value",t,e)},min:"1",placeholder:h.Z.I18n.t("daysPlaceholder")}),o().createElement("span",null,h.Z.I18n.t("daysPlaceholder"))))}function As(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 Ps(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:a,updateSegmentFilter:r}=(0,ss.Z)("mailpoet-dynamic-segments-form");return(0,s.useEffect)((()=>{void 0===n.operator&&r({operator:"equals",value:""},t)}),[r,n,t]),o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",automationId:"text-custom-field-operator",value:n.operator,onChange:e=>{a("operator",t,e)}},o().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),o().createElement("option",{value:"not_equals"},h.Z.I18n.t("notEquals")),o().createElement("option",{value:"contains"},h.Z.I18n.t("contains")),o().createElement("option",{value:"more_than"},h.Z.I18n.t("moreThan")),o().createElement("option",{value:"less_than"},h.Z.I18n.t("lessThan"))),o().createElement(le.Z,{key:"input","data-automation-id":"text-custom-field-value",value:n.value||"",onChange:e=>{a("value",t,e)},placeholder:h.Z.I18n.t("value")}))}function Ms(e){return"string"==typeof e.value&&e.value.length>0}function Ls(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,ss.Z)("mailpoet-dynamic-segments-form"),r=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),i=(0,jn.find)({id:Number(n.custom_field_id)},r);if(!i)return null;const s=i.params;if(!s||!Array.isArray(s.values))return null;const l=s.values.map((e=>({value:e.value,label:e.value})));return o().createElement(ls.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectValue"),options:l,value:n.value?{value:n.value,label:n.value}:null,onChange:e=>{a({value:e.value,operator:"equals"},t)},automationId:"segment-wordpress-role"})}function Fs(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:a,updateSegmentFilter:r}=(0,ss.Z)("mailpoet-dynamic-segments-form");return(0,s.useEffect)((()=>{"1"!==n.value&&"0"!==n.value&&r({operator:"equals",value:"1"},t)}),[r,n,t]),o().createElement(he.Z,{key:"select",value:n.value,onChange:e=>a("value",t,e)},o().createElement("option",{value:"1"},h.Z.I18n.t("checked")),o().createElement("option",{value:"0"},h.Z.I18n.t("unchecked")))}Os.propTypes={filterIndex:y().number.isRequired},Ps.propTypes={filterIndex:y().number.isRequired},Ls.propTypes={filterIndex:y().number.isRequired},Fs.propTypes={filterIndex:y().number.isRequired};var qs=n(95570),$s=n(49546);function Us(e){let{onChange:t,item:n,filterIndex:a}=e;return(0,s.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,jn.assign)(n,{value:"2017-01-01 00:00:00"}),a)}),[t,n,a]),o().createElement(he.Z,{key:"select",value:n.value,onChange:e=>{t((0,jn.assign)(n,{value:e.target.value}),a)}},o().createElement("option",{value:"2017-01-01 00:00:00"},h.Z.I18n.t("january")),o().createElement("option",{value:"2017-02-01 00:00:00"},h.Z.I18n.t("february")),o().createElement("option",{value:"2017-03-01 00:00:00"},h.Z.I18n.t("march")),o().createElement("option",{value:"2017-04-01 00:00:00"},h.Z.I18n.t("april")),o().createElement("option",{value:"2017-05-01 00:00:00"},h.Z.I18n.t("may")),o().createElement("option",{value:"2017-06-01 00:00:00"},h.Z.I18n.t("june")),o().createElement("option",{value:"2017-07-01 00:00:00"},h.Z.I18n.t("july")),o().createElement("option",{value:"2017-08-01 00:00:00"},h.Z.I18n.t("august")),o().createElement("option",{value:"2017-09-01 00:00:00"},h.Z.I18n.t("september")),o().createElement("option",{value:"2017-10-01 00:00:00"},h.Z.I18n.t("october")),o().createElement("option",{value:"2017-11-01 00:00:00"},h.Z.I18n.t("november")),o().createElement("option",{value:"2017-12-01 00:00:00"},h.Z.I18n.t("december")))}function Vs(e){let{onChange:t,item:n,filterIndex:a}=e;const r=(0,qs.default)(new Date);return(0,s.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,jn.assign)(n,{value:`${r}-01-01 00:00:00`,operator:"equals"}),a)}),[r,t,n,a]),o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>{t((0,jn.assign)(n,{operator:e.target.value}),a)}},o().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),o().createElement("option",{value:"before"},h.Z.I18n.t("before")),o().createElement("option",{value:"after"},h.Z.I18n.t("after"))),o().createElement(he.Z,{key:"select-year",value:n.value,onChange:e=>{t((0,jn.assign)(n,{value:e.target.value}),a)}},(0,jn.range)(0,100).map((e=>o().createElement("option",{value:r-e+"-01-01 00:00:00",key:r-e},r-e)))))}Us.propTypes={filterIndex:y().number.isRequired},Vs.propTypes={filterIndex:y().number.isRequired};const js=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return(0,$s.default)(e,"yyyy-MM-dd 00:00:00")}},Ws=e=>{const t=(0,Ts.default)(e);if((0,Cs.default)(t))return t};function Ys(e){let{onChange:t,item:n,filterIndex:a}=e;return(0,s.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,jn.assign)(n,{value:`${(0,$s.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),a)}),[t,n,a]),o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>{t((0,jn.assign)(n,{operator:e.target.value}),a)}},o().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),o().createElement("option",{value:"before"},h.Z.I18n.t("before")),o().createElement("option",{value:"after"},h.Z.I18n.t("after"))),o().createElement(Dt,{dateFormat:"MMM d, yyyy",onChange:e=>t((0,jn.assign)(n,{value:js(e)}),a),selected:n.value?Ws(n.value):void 0}))}function Bs(e){let{onChange:t,item:n,filterIndex:a}=e;return(0,s.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,jn.assign)(n,{value:`${(0,$s.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),a)}),[t,n,a]),o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>{t((0,jn.assign)(n,{operator:e.target.value}),a)}},o().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),o().createElement("option",{value:"before"},h.Z.I18n.t("before")),o().createElement("option",{value:"after"},h.Z.I18n.t("after"))),o().createElement(Dt,{onChange:e=>t((0,jn.assign)(n,{value:js(e)}),a),selected:n.value?Ws(n.value):void 0,dateFormat:"MM/yyyy",showMonthYearPicker:!0}))}Ys.propTypes={filterIndex:y().number.isRequired},Bs.propTypes={filterIndex:y().number.isRequired};const Hs={month:Us,year:Vs,year_month:Bs,year_month_day:Ys};function zs(e){let{customField:t,filterIndex:n}=e;const a=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(n)),[n]),{updateSegmentFilter:r}=(0,ss.Z)("mailpoet-dynamic-segments-form");(0,s.useEffect)((()=>{a.date_type!==t.params.date_type&&r({date_type:t.params.date_type,value:""},n)}),[a.date_type,r,t.params.date_type,n]);const i=Hs[t.params.date_type];return i?o().createElement(i,{item:a,onChange:r,filterIndex:n}):null}var Ks;zs.propTypes={customField:y().shape({params:y().shape({date_type:y().string.isRequired}).isRequired}).isRequired,filterIndex:y().number.isRequired},function(e){e.DATE="date",e.TEXT="text",e.TEXTAREA="textarea",e.RADIO="radio",e.CHECKBOX="checkbox",e.SELECT="select"}(Ks||(Ks={}));const Gs={[Ks.TEXT]:As,[Ks.TEXTAREA]:As,[Ks.RADIO]:Ms,[Ks.SELECT]:Ms,[Ks.CHECKBOX]:function(e){return"1"===e.value||"0"===e.value},[Ks.DATE]:function(e){return("month"===e.date_type||!("string"!=typeof e.operator||e.operator.length<1))&&"string"==typeof e.value&&e.value.length>1}},Qs={[Ks.TEXT]:Ps,[Ks.TEXTAREA]:Ps,[Ks.RADIO]:Ls,[Ks.SELECT]:Ls,[Ks.CHECKBOX]:Fs,[Ks.DATE]:zs};function Xs(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,ss.Z)("mailpoet-dynamic-segments-form"),r=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),i=(0,jn.find)({id:Number(n.custom_field_id)},r),s=r.map((e=>({value:e.id.toString(),label:e.name}))),l=Qs[n.custom_field_type];return o().createElement(o().Fragment,null,o().createElement("div",null,o().createElement(ls.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectCustomFieldPlaceholder"),options:s,automationId:"select-custom-field",value:(0,jn.find)((e=>{if(n.custom_field_id)return n.custom_field_id===e.value}),s),onChange:e=>{const n=(0,jn.find)({id:Number(e.value)},r);n&&a({custom_field_id:e.value,custom_field_type:n.type,operator:void 0,value:void 0},t)}})),o().createElement("div",null,l&&o().createElement(l,{customField:i,filterIndex:t})))}function Js(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),a=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getStaticSegmentsList()),[]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:i}=(0,ss.Z)("mailpoet-dynamic-segments-form");(0,s.useEffect)((()=>{n.operator!==ds.AnyValueTypes.ANY&&n.operator!==ds.AnyValueTypes.ALL&&n.operator!==ds.AnyValueTypes.NONE&&r({operator:ds.AnyValueTypes.ANY},t)}),[r,n,t]);const l=a.map((e=>({value:e.id,label:e.name})));return o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",isFullWidth:!0,value:n.operator,onChange:e=>{i("operator",t,e)}},o().createElement("option",{value:ds.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:ds.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:ds.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ls.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:h.Z.I18n.t("searchLists"),options:l,value:(0,jn.filter)((e=>{if(!n.segments)return;const t=e.value;return-1!==n.segments.indexOf(t)}),l),onChange:e=>{r({segments:(0,jn.map)("value",e)},t)}})))}Xs.propTypes={filterIndex:y().number.isRequired},Js.propTypes={filterIndex:y().number.isRequired};const eo=[{value:ds.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD,label:h.Z.I18n.t("mailpoetCustomField"),group:ds.SegmentTypes.WordPressRole},{value:ds.SubscriberActionTypes.SUBSCRIBER_SCORE,label:h.Z.I18n.t("subscriberScore"),group:ds.SegmentTypes.WordPressRole},{value:ds.SubscriberActionTypes.SUBSCRIBED_DATE,label:h.Z.I18n.t("subscribedDate"),group:ds.SegmentTypes.WordPressRole},{value:ds.SubscriberActionTypes.SUBSCRIBED_TO_LIST,label:h.Z.I18n.t("subscribedToList"),group:ds.SegmentTypes.WordPressRole},{value:ds.SubscriberActionTypes.WORDPRESS_ROLE,label:h.Z.I18n.t("segmentsSubscriber"),group:ds.SegmentTypes.WordPressRole}],to={[ds.SubscriberActionTypes.WORDPRESS_ROLE]:Zs,[ds.SubscriberActionTypes.SUBSCRIBER_SCORE]:ks,[ds.SubscriberActionTypes.SUBSCRIBED_DATE]:Os,[ds.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD]:Xs,[ds.SubscriberActionTypes.SUBSCRIBED_TO_LIST]:Js};function no(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);let a;return a=n.action?to[n.action]:Zs,a?o().createElement(a,{filterIndex:t}):null}var ao;no.propTypes={filterIndex:y().number.isRequired},function(e){e.MEMBER_OF="isMemberOf"}(ao||(ao={}));const ro=[{value:ao.MEMBER_OF,label:h.Z.I18n.t("segmentsActiveMembership"),group:ds.SegmentTypes.WooCommerceMembership}];function io(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,ss.Z)("mailpoet-dynamic-segments-form"),i=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getMembershipPlans()),[]).map((e=>({value:e.id,label:e.name})));return(0,s.useEffect)((()=>{n.action===ao.MEMBER_OF&&n.operator!==ds.AnyValueTypes.ANY&&n.operator!==ds.AnyValueTypes.ALL&&n.operator!==ds.AnyValueTypes.NONE&&a({operator:ds.AnyValueTypes.ANY},t)}),[a,n,t]),o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>r("operator",t,e),automationId:"select-operator"},o().createElement("option",{value:ds.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:ds.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:ds.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ls.Z,{isMulti:!0,dimension:"small",key:"select-segment-membership-plan",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooMembership"),options:i,value:(0,jn.filter)((e=>!!n.plan_ids&&-1!==n.plan_ids.indexOf(e.value)),i),onChange:e=>a({plan_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-plans"})))}var so;io.propTypes={filterIndex:y().number.isRequired},function(e){e.ACTIVE_SUBSCRIPTIONS="hasActiveSubscription"}(so||(so={}));const oo=[{value:so.ACTIVE_SUBSCRIPTIONS,label:h.Z.I18n.t("segmentsActiveSubscription"),group:ds.SegmentTypes.WooCommerceSubscription}];function lo(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,ss.Z)("mailpoet-dynamic-segments-form"),i=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriptionProducts()),[]).map((e=>({value:e.id,label:e.name})));return(0,s.useEffect)((()=>{n.action===so.ACTIVE_SUBSCRIPTIONS&&n.operator!==ds.AnyValueTypes.ANY&&n.operator!==ds.AnyValueTypes.ALL&&n.operator!==ds.AnyValueTypes.NONE&&a({operator:ds.AnyValueTypes.ANY},t)}),[a,n,t]),o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>r("operator",t,e),automationId:"select-operator"},o().createElement("option",{value:ds.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:ds.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:ds.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ls.Z,{isMulti:!0,dimension:"small",key:"select-segment-category",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooSubscription"),options:i,value:(0,jn.filter)((e=>!!n.product_ids&&-1!==n.product_ids.indexOf(e.value)),i),onChange:e=>a({product_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-products"})))}lo.propTypes={filterIndex:y().number.isRequired};const co={[ds.SegmentTypes.Email]:function(e){return!!Object.values(ds.EmailActionTypes).some((t=>t===e.action))&&(e.action===ds.EmailActionTypes.CLICKED_ANY||(e.action===ds.EmailActionTypes.CLICKED?!!e.newsletter_id:e.action!==ds.EmailActionTypes.OPENS_ABSOLUTE_COUNT&&e.action!==ds.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT?Array.isArray(e.newsletters)&&e.newsletters.length>0:!!e.days&&!!e.opens&&!!e.operator))},[ds.SegmentTypes.WooCommerce]:function(e){if(!Object.values(bs).some((t=>t===e.action)))return!1;const t=void 0===e.category_ids||0===e.category_ids.length||!e.operator;if(e.action===bs.PURCHASED_CATEGORY&&t)return!1;const n=void 0===e.product_ids||0===e.product_ids.length||!e.operator;if(e.action===bs.PURCHASED_PRODUCT&&n)return!1;const a=void 0===e.country_code||0===e.country_code.length;if(e.action===bs.CUSTOMER_IN_COUNTRY&&a)return!1;const r=!e.number_of_orders_count||!e.number_of_orders_days||!e.number_of_orders_type;return!(e.action===bs.NUMBER_OF_ORDERS&&r||!(e.action!==bs.TOTAL_SPENT||e.total_spent_amount&&e.total_spent_days&&e.total_spent_type))},[ds.SegmentTypes.WordPressRole]:function(e){return e.action&&e.action!==ds.SubscriberActionTypes.WORDPRESS_ROLE?e.action===ds.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD?function(e){const t=Gs[e.custom_field_type];return!!t&&t(e)}(e):e.action===ds.SubscriberActionTypes.SUBSCRIBER_SCORE?function(e){if(e.operator===Is.HIGHER_THAN||e.operator===Is.LOWER_THAN||e.operator===Is.EQUALS||e.operator===Is.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===Is.UNKNOWN||e.operator===Is.NOT_UNKNOWN}(e):e.action===ds.SubscriberActionTypes.SUBSCRIBED_TO_LIST?function(e){return(e.operator===ds.AnyValueTypes.ANY||e.operator===ds.AnyValueTypes.ALL||e.operator===ds.AnyValueTypes.NONE)&&Array.isArray(e.segments)&&e.segments.length>0}(e):!(!e.operator||!e.value)&&(e.operator===Ns.BEFORE||e.operator===Ns.AFTER||e.operator===Ns.ON||e.operator===Ns.NOT_ON?/^\d+-\d+-\d+$/.test(e.value):(e.operator===Ns.IN_THE_LAST||e.operator===Ns.NOT_IN_THE_LAST)&&(/^\d+$/.test(e.value)&&Number(e.value)>0)):Array.isArray(e.wordpressRole)&&e.wordpressRole.length>0},[ds.SegmentTypes.WooCommerceMembership]:function(e){const t=!e.plan_ids||!e.plan_ids.length||!e.operator;return e.action!==ao.MEMBER_OF||!t},[ds.SegmentTypes.WooCommerceSubscription]:function(e){const t=!e.product_ids||!e.product_ids.length||!e.operator;return e.action!==so.ACTIVE_SUBSCRIPTIONS||!t}};function uo(e){return!(e.length<1)&&0===e.map((e=>void 0!==co[e.segmentType]&&co[e.segmentType](e))).filter((e=>!1===e)).length}let po,mo;function ho(){const e=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),{updateSubscriberCount:n}=(0,ss.Z)("mailpoet-dynamic-segments-form"),a=JSON.stringify(e),r=(0,s.useRef)(1),i=(0,s.useRef)(null),l=(0,s.useRef)(!1),c=(0,s.useRef)((0,cs.debounce)((function e(t){if(l.current)return void(i.current=t);i.current=null,r.current+=1;const a=r.current;l.current=!0,function(e){const t={filters:e.filters,filters_connect:e.filters_connect};return us().isEqual(t,po)?Promise.resolve(mo):(po={filters:[...e.filters],filters_connect:e.filters_connect},h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"dynamic_segments",action:"getCount",data:e,timeout:2e4}).then((e=>{const{data:t}=e;return mo={count:t.count,errors:void 0},mo})))}(t).then((t=>{if(l.current=!1,i.current)return void e(i.current);if(a!==r.current)return;const s={loading:!1};t&&(s.count=t.count,s.errors=t.errors),n(s)}),(e=>{l.current=!1;const t={},a=e.errors.map((e=>e.message));t.loading=!1,t.count=void 0,t.errors=a,n(t)}))}),2e3,{trailing:!0}));return(0,s.useEffect)((()=>{uo(e.filters)?(n({loading:!0,count:void 0,errors:void 0}),(0,c.current)(e)):n({count:void 0,loading:!1})}),[e,a,n]),t.errors?o().createElement("div",{className:"mailpoet-form-field"},o().createElement("span",{className:"mailpoet-form-error-message"},h.Z.I18n.t("dynamicSegmentSizeCalculatingTimeout")," ",o().createElement("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"},h.Z.I18n.t("learnMore")))):t.loading||void 0!==t.count?t.loading?o().createElement("div",{className:"mailpoet-form-field"},o().createElement("span",{className:"mailpoet-form-notice-message"},h.Z.I18n.t("dynamicSegmentSizeIsCalculated"))):o().createElement("div",{className:"mailpoet-form-field"},o().createElement("span",{className:"mailpoet-form-notice-message"},h.Z.I18n.t("dynamicSegmentSize").replace("%1$d",t.count.toLocaleString()))):o().createElement("span",null)}const fo={[ds.SegmentTypes.Email]:ys,[ds.SegmentTypes.WooCommerce]:Es,[ds.SegmentTypes.WordPressRole]:no,[ds.SegmentTypes.WooCommerceMembership]:io,[ds.SegmentTypes.WooCommerceSubscription]:lo};function go(e){let{filterIndex:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);if(void 0===n||void 0===fo[n.segmentType])return null;const a=fo[n.segmentType];return o().createElement(a,{filterIndex:t})}function vo(){const e=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=[ds.EmailActionTypes.OPENED,ds.EmailActionTypes.OPENS_ABSOLUTE_COUNT,ds.EmailActionTypes.MACHINE_OPENED,ds.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT];let n=!1;return e.filters.forEach((e=>{t.includes(e.action)&&(n=!0)})),n?o().createElement("div",{className:"mailpoet-form-field"},o().createElement("span",{className:"mailpoet-form-notice-message"},h.Z.I18n.t("privacyProtectionNotice"))):o().createElement("span",null)}go.propTypes={filterIndex:y().number.isRequired};const{subscribersLimitReached:yo,subscribersLimit:bo,subscribersCount:wo,premiumActive:_o,hasValidApiKey:Eo,hasValidPremiumKey:Zo,isPremiumPluginInstalled:Io,premiumPluginDownloadUrl:So,premiumPluginActivationUrl:ko,pluginPartialKey:To}=h.Z,Co=Eo||Zo,No=e=>{const t=h.Z.I18n.t(e);return o().createElement("p",null,x()(t,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?wo:bo)))},Do=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_blank";return o().createElement(b.Z,{href:t,target:n,rel:"noopener noreferrer"},h.Z.I18n.t(e))};function xo(e){let t,n,{message:a,actionButton:r}=e;if(Co&&!_o)t=No("premiumFeatureDescription"),n=Io?Do("premiumFeatureButtonActivatePremium",ko,"_self"):Do("premiumFeatureButtonDownloadPremium",So);else if(yo){t=No("premiumFeatureDescriptionSubscribersLimitReached");const e=Co?h.Z.MailPoetComUrlFactory.getUpgradeUrl(To):h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(+wo+1);n=Do("premiumFeatureButtonUpgradePlan",e)}else t=a,n=r;return o().createElement(Ge.Z,{title:h.Z.I18n.t("premiumFeature"),message:t,actionButton:n})}xo.propTypes={message:y().node.isRequired,actionButton:y().node.isRequired};var Ro=xo,Oo=function(){return o().createElement(Ro,{message:(()=>{const e=h.Z.I18n.t("premiumFeatureMultipleConditions");return o().createElement("p",null,x()(e,/\[link](.*?)\[\/link]/g,(e=>o().createElement("a",{key:e,href:h.Z.premiumLink,target:"_blank",rel:"noopener noreferrer"},e))))})(),actionButton:o().createElement(b.Z,{href:h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount,h.Z.currentWpUserEmail,null,{utm_medium:"segments",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("premiumBannerCtaFree"))})};const Ao=Ke().applyFilters("mailpoet_dynamic_segments_form_filters_before",(()=>null)),Po=Ke().applyFilters("mailpoet_dynamic_filters_filter_before",(()=>null)),Mo=Ke().applyFilters("mailpoet_dynamic_filters_filter_after",(()=>o().createElement("div",{className:"mailpoet-gap"})));function Lo(e){let{segmentId:t}=e;const n=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),a=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getAvailableFilters()),[]),r=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").findFiltersValueForSegment(n)),[n]),i=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),l=(0,os.Z)((e=>e("mailpoet-dynamic-segments-form").getErrors()),[]),{updateSegment:c,updateSegmentFilter:u,handleSave:d}=(0,ss.Z)("mailpoet-dynamic-segments-form"),[p,m]=(0,s.useState)(!1),f=Ke().applyFilters("mailpoet_dynamic_segments_form_add_condition_action",(()=>{m(!0)}));return o().createElement("form",{className:"mailpoet_form"},l.length>0&&o().createElement(dt,{errors:l.map((e=>({message:e})))}),o().createElement("div",{className:"mailpoet-form-grid"},o().createElement("div",{className:"mailpoet-form-field-name form-field-row-name mailpoet-segments-name-section"},o().createElement(Ce.Z,{level:4},o().createElement("label",{htmlFor:"field_name"},h.Z.I18n.t("name"))),o().createElement("div",{className:"mailpoet-form-field"},o().createElement(le.Z,{isFullWidth:!0,type:"text",name:"name",id:"field_name",defaultValue:n.name,onChange:e=>c({name:e.target.value})}))),o().createElement("div",{className:"mailpoet-form-field-description form-field-row-description mailpoet-segments-description-section"},o().createElement(Ce.Z,{level:4},o().createElement("label",{htmlFor:"field_description"},h.Z.I18n.t("description"))),o().createElement("p",{className:"mailpoet-form-description"},h.Z.I18n.t("segmentDescriptionTip")),o().createElement("div",{className:"mailpoet-form-field"},o().createElement(de.Z,{isFullWidth:!0,name:"description",id:"field_description",value:n.description,onChange:e=>c({description:e.target.value})}))),o().createElement("div",{className:"mailpoet-segments-segments-section"},o().createElement(Ce.Z,{level:4},o().createElement("label",{htmlFor:"field_filters"},h.Z.I18n.t("formPageTitle"))),o().createElement(Ao,null),Array.isArray(r)&&r.map(((e,t)=>o().createElement(o().Fragment,{key:e.index},o().createElement(kt.r.ThreeColumns,{className:"mailpoet-segments-grid",automationId:`filter-row-${t}`},o().createElement(Po,{filterRows:r,index:t}),o().createElement(kt.r.CenteredRow,null,o().createElement(ls.Z,{dimension:"small",placeholder:h.Z.I18n.t("selectActionPlaceholder"),options:a,value:e.filterValue,onChange:e=>{u({segmentType:e.group,action:e.value},t)},automationId:"select-segment-action",isFullWidth:!0})),void 0!==e.index&&o().createElement(go,{filterIndex:e.index})),o().createElement(Mo,{index:t})))),o().createElement(b.Z,{type:"button",variant:"tertiary",iconStart:W,onClick:e=>{e.preventDefault(),f(n,c)}},h.Z.I18n.t("addCondition"))),p&&o().createElement("div",{className:"mailpoet-grid-span-two-columns"},o().createElement(Oo,null)),o().createElement("div",{className:"mailpoet-segments-counter-section"},o().createElement(ho,null),o().createElement(vo,null)),o().createElement("div",{className:"mailpoet-form-actions"},o().createElement(b.Z,{type:"submit",onClick:e=>{e.preventDefault(),d(t)},isDisabled:!uo(n.filters)||void 0===i.count},h.Z.I18n.t("save")))))}Lo.propTypes={segmentId:y().number};var Fo=n(61299);const qo=e=>e.products,$o=e=>e.membershipPlans,Uo=e=>e.subscriptionProducts,Vo=e=>e.wordpressRoles,jo=e=>e.productCategories,Wo=e=>e.newslettersList,Yo=e=>e.canUseWooSubscriptions,Bo=e=>e.wooCurrencySymbol,Ho=e=>e.wooCountries,zo=e=>e.customFieldsList,Ko=e=>e.segment,Go=e=>e.staticSegmentsList,Qo=e=>e.subscriberCount,Xo=(e,t)=>{let n;return Array.isArray(e.segment.filters)?(n={...e.segment.filters[t]},n):n},Jo=e=>e.errors,el=e=>e.allAvailableFilters,tl=(e,t)=>{const n=[];return t.filters.forEach(((t,a)=>{e.allAvailableFilters.forEach((e=>{e.options.forEach((e=>{e.group===t.segmentType&&e.value===t.action&&n.push({filterValue:e,index:a})}))}))})),n};function nl(e,t){return{...e,segment:t.segment}}function al(e,t){return{...e,errors:t.errors}}function rl(e,t){const n=e.segment;return{...e,segment:(0,jn.assign)(n,t.segment)}}function il(e,t){const n={...e.segment};return n.filters[t.filterIndex]=(0,jn.assign)(n.filters[t.filterIndex],t.filter),{...e,segment:n}}function sl(e,t){const n=e.subscriberCount;return{...e,subscriberCount:(0,jn.assign)(n,t.subscriberCount)}}const ol=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 ds.Actions.SET_SEGMENT:return nl(t,n);case ds.Actions.SET_ERRORS:return al(t,n);case ds.Actions.UPDATE_SEGMENT:return rl(t,n);case ds.Actions.UPDATE_SEGMENT_FILTER:return il(t,n);case ds.Actions.UPDATE_SUBSCRIBER_COUNT:return sl(t,n);default:return t}};function ll(e){return{type:ds.Actions.SET_SEGMENT,segment:e}}function cl(e){return{type:ds.Actions.SET_ERRORS,errors:e}}function ul(e){return{type:ds.Actions.UPDATE_SEGMENT,segment:e}}function dl(e,t){return{type:ds.Actions.UPDATE_SEGMENT_FILTER,filter:e,filterIndex:t}}function pl(e,t){return{type:ds.Actions.UPDATE_SEGMENT,segment:{[e]:t.target.value}}}function ml(e,t,n){return{type:ds.Actions.UPDATE_SEGMENT_FILTER,filter:{[e]:n.target.value},filterIndex:t}}function hl(e){return{type:ds.Actions.UPDATE_SUBSCRIBER_COUNT,subscriberCount:e}}function*fl(e){if(void 0===e)return;h.Z.Modal.loading(!0);const{res:t,success:n}=yield{type:"LOAD_SEGMENT",segmentId:e};n&&!t.is_plugin_missing||(window.location.href="admin.php?page=mailpoet-segments#/segments"),yield ll(t),h.Z.Modal.loading(!1)}function*gl(e){const t=(0,Fo.Ys)("mailpoet-dynamic-segments-form").getSegment();yield cl([]);const{error:n,success:a}=yield{type:"SAVE_SEGMENT",segment:t};var r;a?(window.location.href="admin.php?page=mailpoet-segments#/segments",void 0!==e?h.Z.Notice.success(h.Z.I18n.t("dynamicSegmentUpdated")):(r=t,h.Z.Notice.success(h.Z.I18n.t("dynamicSegmentAdded")),h.Z.trackEvent("Segments > Add new",{type:r.segmentType||"unknown type",subtype:r.action||r.wordpressRole||"unknown subtype"}))):yield cl(n)}function vl(e){let t=JSON.parse(JSON.stringify(e));return(0,jn.has)("link_id",e)&&(t=(0,jn.assign)(t,{link_id:e.link_id.toString()})),(0,jn.has)("newsletter_id",e)&&(t=(0,jn.assign)(t,{newsletter_id:e.newsletter_id.toString()})),(0,jn.has)("product_id",e)&&(t=(0,jn.assign)(t,{product_id:e.product_id.toString()})),(0,jn.has)("category_id",e)&&(t=(0,jn.assign)(t,{category_id:e.category_id.toString()})),t}async function yl(e){let{segmentId:t}=e;try{return{success:!0,res:vl((await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"dynamic_segments",action:"get",data:{id:t}})).data)}}catch(e){return{success:!1,error:e.errors.map((e=>e.message)),res:e}}}async function bl(e){let{segment:t}=e;try{return await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"dynamic_segments",action:"save",data:t}),{success:!0}}catch(e){return{success:!1,error:e.errors.map((e=>e.message))}}}function wl(e,t){const n=[{label:h.Z.I18n.t("email"),options:gs},{label:h.Z.I18n.t("wpUserRole"),options:eo}];return h.Z.isWoocommerceActive&&n.push({label:h.Z.I18n.t("woocommerce"),options:ws}),h.Z.isWoocommerceActive&&t&&n.push({label:h.Z.I18n.t("woocommerceMemberships"),options:ro}),h.Z.isWoocommerceActive&&e&&n.push({label:h.Z.I18n.t("woocommerceSubscriptions"),options:oo}),n}var _l=function(){const e=(0,d.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:ds.SegmentConnectTypes.AND,filters:[{segmentType:ds.SegmentTypes.WordPressRole,action:ds.SubscriberActionTypes.WORDPRESS_ROLE}]},subscriberCount:{loading:!1},errors:[],allAvailableFilters:wl(window.mailpoet_can_use_woocommerce_subscriptions,window.mailpoet_can_use_woocommerce_memberships)},t={selectors:a,actions:r,controls:i,reducer:ol(e),resolvers:{}};(0,Fo.R9)("mailpoet-dynamic-segments-form",t)})();const{pageLoaded:t}=(0,ss.Z)("mailpoet-dynamic-segments-form");return(0,s.useEffect)((()=>{t(e.params.id)}),[e.params.id,t]),o().createElement(o().Fragment,null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(Pe.Z,null),o().createElement(Ce.Z,{level:1,className:"mailpoet-title"},o().createElement("span",null,h.Z.I18n.t("formPageTitle")),o().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:"/segments"},h.Z.I18n.t("backToList"))),o().createElement(Lo,{segmentId:Number(e.params.id)}))};const El=[{name:"name",label:h.Z.I18n.t("nameColumn"),sortable:!0},{name:"description",label:h.Z.I18n.t("description"),sortable:!1},{name:"count",label:h.Z.I18n.t("subscribersCountColumn"),sortable:!1},{name:"subscribed",label:h.Z.I18n.t("subscribed"),sortable:!1},{name:"updated_at",label:h.Z.I18n.t("updatedAtColumn"),sortable:!0}],Zl={onLoadingItems:()=>h.Z.I18n.t("loadingDynamicSegmentItems"),onNoItemsFound:()=>h.Z.I18n.t("noDynamicSegmentItemsFound"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneDynamicSegmentTrashed"):h.Z.I18n.t("multipleDynamicSegmentsTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneDynamicSegmentDeleted"):h.Z.I18n.t("multipleDynamicSegmentsDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneDynamicSegmentRestored"):h.Z.I18n.t("multipleDynamicSegmentsRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},Il=[{name:"edit",className:"mailpoet-hide-on-mobile",link:e=>o().createElement(u.rU,{to:`/edit-segment/${e.id}`},h.Z.I18n.t("edit")),display:e=>!e.is_plugin_missing},{name:"edit_disabled",className:"mailpoet-hide-on-mobile mailpoet-disabled",link:e=>o().createElement(u.rU,{to:`/edit-segment/${e.id}`},h.Z.I18n.t("edit")),display:e=>e.is_plugin_missing},{name:"view_subscribers",link:e=>o().createElement("a",{href:e.subscribers_url},h.Z.I18n.t("viewSubscribers"))},{name:"trash",className:"mailpoet-hide-on-mobile"}],Sl=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Zl.onTrash}];function kl(e,t){return o().createElement(o().Fragment,null,o().createElement("td",{className:"column-primary","data-colname":h.Z.I18n.t("nameColumn")},o().createElement("span",{className:"mailpoet-listing-title"},e.name),t),o().createElement("td",{"data-colname":h.Z.I18n.t("description")},o().createElement("abbr",null,e.description)),e.is_plugin_missing?o().createElement("td",{colSpan:"2",className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("missingPluginMessageColumn")},e.missing_plugin_message&&e.missing_plugin_message.message&&e.missing_plugin_message.link?x()(e.missing_plugin_message.message,/\[link](.*?)\[\/link]/g,(t=>o().createElement("a",{className:"mailpoet-listing-link-important",key:"missingPluginMessageLink",href:e.missing_plugin_message.link,target:"_blank",rel:"noopener noreferrer"},t))):e.missing_plugin_message):o().createElement(o().Fragment,null,o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribersCountColumn")},parseInt(e.count_all,10).toLocaleString()),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribed")},parseInt(e.count_subscribed,10).toLocaleString())),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("updatedAtColumn")},h.Z.Date.short(e.created_at),o().createElement("br",null),h.Z.Date.time(e.created_at)))}function Tl(e){return o().createElement(o().Fragment,null,o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:e.location,params:e.match.params,search:!0,onRenderItem:kl,endpoint:"dynamic_segments",base_url:"segments",columns:El,messages:Zl,sort_by:"created_at",sort_order:"desc",item_actions:Il,bulk_actions:Sl}),o().createElement("p",{className:"mailpoet_sending_methods_help help"},o().createElement("b",null,h.Z.I18n.t("segmentsTip"),":")," ",h.Z.I18n.t("segmentsTipText")," ",o().createElement("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"},h.Z.I18n.t("segmentsTipLink"))))}Tl.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var Cl=(0,d.withRouter)(Tl),Nl=function(){return o().createElement(o().Fragment,null,o().createElement(j.Q,null,o().createElement(u.rU,{className:"mailpoet-button button-secondary",to:"/new"},W,o().createElement("span",null,h.Z.I18n.t("new"))),o().createElement(u.rU,{className:"mailpoet-button button-secondary",to:"/new-segment","data-automation-id":"new-segment"},W,o().createElement("span",null,h.Z.I18n.t("newSegment")))),o().createElement(V,{subscribersInPlan:h.Z.subscribersCount,subscribersInPlanLimit:h.Z.subscribersLimit}),o().createElement(F,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),o().createElement(O,null),o().createElement(L,null),o().createElement(P,{mssKeyInvalid:h.Z.hasInvalidMssApiKey,subscribersCount:h.Z.subscribersCount}))};const Dl=document.getElementById("segments_container");function xl(){return o().createElement(o().Fragment,null,o().createElement(Nl,null),o().createElement(ki.Z,{activeKey:"lists",routerType:"switch-only"},o().createElement(yi.Z,{key:"lists",route:"lists/(.*)?",title:h.Z.I18n.t("pageTitle")},o().createElement(ts,null)),o().createElement(yi.Z,{key:"segments",route:"segments/(.*)?",title:h.Z.I18n.t("pageTitleSegments"),automationId:"dynamic-segments-tab"},o().createElement(Cl,null))))}function Rl(){return o().createElement(je.k.Provider,{value:(0,je.S)(window)},o().createElement(u.UT,null,o().createElement(et.Z,null),o().createElement(d.Switch,null,o().createElement(d.Route,{exact:!0,path:"/",render:()=>o().createElement(d.Redirect,{to:"/lists"})}),o().createElement(d.Route,{path:"/new",component:is}),o().createElement(d.Route,{path:"/edit/:id",component:is}),o().createElement(d.Route,{path:"/new-segment",component:_l}),o().createElement(d.Route,{path:"/edit-segment/:id",component:_l}),o().createElement(d.Route,{path:"/segments/(.*)?",component:xl}),o().createElement(d.Route,{path:"/lists/(.*)?",component:xl}))))}Dl&&c().render(o().createElement(Rl,null),Dl);const Ol=()=>{h.Z.trackEvent("Forms > Add New"),setTimeout((()=>{window.location=window.mailpoet_form_template_selection_url}),200)};function Al(){const[e,t]=(0,s.useState)(!1);return o().createElement(j.Q,null,o().createElement(b.Z,{onClick:()=>{t(!0),Ol()},withSpinner:e,automationId:"create_new_form",variant:"secondary",iconStart:W},h.Z.I18n.t("new")))}const Pl=[{name:"name",label:h.Z.I18n.t("formName"),sortable:!0},{name:"segments",label:h.Z.I18n.t("segments")},{name:"type",label:h.Z.I18n.t("type")},{name:"status",label:h.Z.I18n.t("status")},{name:"updated_at",label:h.Z.I18n.t("updatedAt"),sortable:!0}],Ml={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneFormTrashed"):h.Z.I18n.t("multipleFormsTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneFormDeleted"):h.Z.I18n.t("multipleFormsDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneFormRestored"):h.Z.I18n.t("multipleFormsRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onNoItemsFound:()=>o().createElement("div",{className:"mailpoet-forms-add-new-row"},o().createElement("p",null,h.Z.I18n.t("noItemsFound")),o().createElement(xe.Button,{onClick:Ol,automationId:"add_new_form",iconStart:W},h.Z.I18n.t("new")))},Ll=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Ml.onTrash}],Fl=[{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),link:function(e){return o().createElement("a",{href:`admin.php?page=mailpoet-form-editor&id=${e.id}`},h.Z.I18n.t("edit"))}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:function(e,t){return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"duplicate",data:{id:e.id}}).done((e=>{const n=e.data.name?e.data.name:h.Z.I18n.t("noName");h.Z.Notice.success(h.Z.I18n.t("formDuplicated").replace("%1$s",n)),t()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class ql extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"updateStatus",((e,t)=>{t.persist(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"enabled":"disabled"}}).done((e=>{"enabled"===e.data.status&&h.Z.Notice.success(h.Z.I18n.t("formActivated"))})).fail((n=>{h.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,k.Z)(this,"isItemInactive",(e=>"disabled"===e.status)),(0,k.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions"),a=window.mailpoet_segments.filter((t=>-1!==m().inArray(t.id,e.segments))),r=function(e){const t=[];return"1"===e?.form_placement?.fixed_bar?.enabled&&t.push(h.Z.I18n.t("placeFixedBarFormOnPages")),"1"===e?.form_placement?.below_posts?.enabled&&t.push(h.Z.I18n.t("placeFormBellowPages")),"1"===e?.form_placement?.popup?.enabled&&t.push(h.Z.I18n.t("placePopupFormOnPages")),"1"===e?.form_placement?.slide_in?.enabled&&t.push(h.Z.I18n.t("placeSlideInFormOnPages")),t.length>0?t.join(", "):h.Z.I18n.t("placeFormOthers")}(e.settings);return o().createElement(o().Fragment,null,o().createElement("td",{className:n},o().createElement("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-form-editor&id=${e.id}`},e.name?e.name:`(${h.Z.I18n.t("noName")})`),t),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("segments")},o().createElement(E,{segments:a,dimension:"large"},"user"===e.settings.segments_selected_by&&o().createElement("span",{className:"mailpoet-tags-prefix"},h.Z.I18n.t("userChoice")))),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("type")},r),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("updatedAt")},h.Z.Date.short(e.updated_at),o().createElement("br",null),h.Z.Date.time(e.updated_at)))}))}renderStatus(e){return o().createElement("div",null,o().createElement(Kt,{onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"enabled"===e.status}),o().createElement("p",null,h.Z.I18n.t("signups"),": ",e.signups.toLocaleString()))}render(){return o().createElement("div",{className:"mailpoet-listing-no-actions-on-mobile"},o().createElement(Al,null),o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,className:"mailpoet-forms-listing",location:this.props.location,params:this.props.match.params,messages:Ml,search:!1,endpoint:"forms",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Pl,bulk_actions:Ll,item_actions:Fl}))}}ql.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var $l=Ai(ql);function Ul(){return o().createElement(je.k.Provider,{value:(0,je.S)(window)},o().createElement(u.UT,null,o().createElement(et.Z,null),o().createElement(d.Route,{path:"*",component:$l})))}const Vl=document.getElementById("forms_container");Vl&&c().render(o().createElement(Ul,null),Vl);var jl=function(){return o().createElement(o().Fragment,null,o().createElement("p",null,h.Z.I18n.t("knowledgeBaseIntro")),o().createElement("ul",{className:"mailpoet-text-links"},o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/116-common-problems"},"Common Problems")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/165-newsletters"},"Newsletters")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/156-migration-questions"},"Migration Questions")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/149-sending-methods"},"Sending Methods")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/139-subscription-forms"},"Subscription Forms")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/114-getting-started"},"Getting Started")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/123-newsletter-designer"},"Newsletter Designer")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/121-subscribers-and-lists"},"Subscribers and Lists"))),o().createElement(b.Z,{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/"},h.Z.I18n.t("knowledgeBaseButton")))};function Wl(e){e.target.select()}var Yl=function(){const e=window.systemInfoData;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet_notice notice inline"},o().createElement("p",null,h.Z.I18n.t("systemInfoIntro"))),function(e){if(T.ZP.isObject(e)){const t=Object.keys(e).map((t=>`${t}: ${e[t]}`));return o().createElement("textarea",{readOnly:!0,onFocus:Wl,value:t.join("\n"),style:{width:"100%",height:"400px"}})}return o().createElement("p",null,h.Z.I18n.t("systemInfoDataError"))}(e))};function Bl(e){return o().createElement("table",{className:"widefat fixed",style:{maxWidth:e.max_width}},o().createElement("tbody",null,e.rows.map((e=>o().createElement("tr",{key:`row_${e.key}`},o().createElement("td",{className:"row-title"},e.key),o().createElement("td",null,e.value))))))}Bl.propTypes={max_width:y().string,rows:y().arrayOf(y().shape({key:y().string.isRequired,value:y().oneOfType([y().string,y().number,y().element]).isRequired})).isRequired},Bl.defaultProps={max_width:"auto"};var Hl=Bl;function zl(e){return o().createElement("span",null,!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown)}zl.propTypes={truthy:y().string,falsy:y().string,unknown:y().string,children:y().bool},zl.defaultProps={truthy:h.Z.I18n.t("yes"),falsy:h.Z.I18n.t("no"),unknown:h.Z.I18n.t("unknown"),children:null};var Kl=zl;function Gl(e){const t=e.status_data,n={active:h.Z.I18n.t("running"),inactive:h.Z.I18n.t("cronWaiting")},a=Array.isArray(t.last_error)?o().createElement(o().Fragment,null,t.last_error.map((e=>o().createElement("div",{key:e.worker},e.worker,":"," ",o().createElement("i",null,e.message))))):t.last_error;return o().createElement("div",null,o().createElement("h4",null,h.Z.I18n.t("systemStatusCronStatusTitle")),o().createElement(Hl,{max_width:"400px",rows:[{key:h.Z.I18n.t("accessible"),value:o().createElement(Kl,null,t.accessible)},{key:h.Z.I18n.t("status"),value:n[t.status]?n[t.status]:h.Z.I18n.t("unknown")},{key:h.Z.I18n.t("lastUpdated"),value:t.updated_at?h.Z.Date.full(1e3*t.updated_at):h.Z.I18n.t("unknown")},{key:h.Z.I18n.t("lastRunStarted"),value:t.run_accessed_at?h.Z.Date.full(1e3*t.run_started_at):h.Z.I18n.t("unknown")},{key:h.Z.I18n.t("lastRunCompleted"),value:t.run_completed_at?h.Z.Date.full(1e3*t.run_completed_at):h.Z.I18n.t("unknown")},{key:h.Z.I18n.t("lastSeenError"),value:a||h.Z.I18n.t("none")},{key:h.Z.I18n.t("lastSeenErrorDate"),value:t.last_error_date?h.Z.Date.full(1e3*t.last_error_date):h.Z.I18n.t("unknown")}]}))}Gl.propTypes={status_data:y().shape({accessible:y().bool,last_error_date:y().string,status:y().string,updated_at:y().number,run_accessed_at:y().number,run_completed_at:y().number,run_started_at:y().number,last_error:y().oneOfType([y().string,y().array])}).isRequired};var Ql=Gl;function Xl(e){let t=e.task.scheduled_at;t&&(t=(0,qa.default)(t,"yyyy-MM-dd HH:mm:ss",new Date));const n=(0,qa.default)(e.task.updated_at,"yyyy-MM-dd HH:mm:ss",new Date);return o().createElement("tr",null,o().createElement("td",{className:"column column-primary"},e.task.id),o().createElement("td",{className:"column"},e.task.type),o().createElement("td",{className:"column"},e.task.newsletter?o().createElement("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"},e.task.newsletter.subject||h.Z.I18n.t("preview")):h.Z.I18n.t("none")),o().createElement("td",{className:"column"},e.task.priority),e.show_scheduled_at?o().createElement("td",{className:"column-date"},o().createElement("abbr",null,`${h.Z.Date.short(t)} ${h.Z.Date.time(t)}`)):null,o().createElement("td",{className:"column-date"},o().createElement("abbr",null,`${h.Z.Date.short(n)} ${h.Z.Date.time(n)}`)))}Xl.propTypes={show_scheduled_at:y().bool,task:y().shape({id:y().number.isRequired,type:y().string.isRequired,priority:y().number.isRequired,updated_at:y().string.isRequired,scheduled_at:y().string,status:y().string,newsletter:y().shape({newsletter_id:y().number.isRequired,queue_id:y().number.isRequired,preview_url:y().string.isRequired,subject:y().string})}).isRequired},Xl.defaultProps={show_scheduled_at:!1};var Jl=Xl;function ec(e){return o().createElement("tr",null,o().createElement("th",{className:"row-title"},"Id"),o().createElement("th",{className:"row-title"},h.Z.I18n.t("type")),o().createElement("th",{className:"row-title"},h.Z.I18n.t("email")),o().createElement("th",{className:"row-title"},h.Z.I18n.t("priority")),e.show_scheduled_at?o().createElement("th",{className:"row-title"},h.Z.I18n.t("scheduledAt")):null,o().createElement("th",{className:"row-title"},h.Z.I18n.t("updatedAt")))}ec.propTypes={show_scheduled_at:y().bool},ec.defaultProps={show_scheduled_at:!1};var tc=ec;function nc(e){const t=e.show_scheduled_at?6:5;return o().createElement("table",{className:"widefat fixed striped"},o().createElement("thead",null,o().createElement(tc,{show_scheduled_at:e.show_scheduled_at})),o().createElement("tbody",null,e.tasks.length?e.tasks.map((t=>o().createElement(Jl,{key:t.id,task:t,show_scheduled_at:e.show_scheduled_at}))):o().createElement("tr",{className:"mailpoet-listing-no-items"},o().createElement("td",{colSpan:t},h.Z.I18n.t("nothingToShow")))),o().createElement("tfoot",null,o().createElement(tc,{show_scheduled_at:e.show_scheduled_at})))}nc.propTypes={show_scheduled_at:y().bool,tasks:y().arrayOf(Jl.propTypes.task).isRequired},nc.defaultProps={show_scheduled_at:!1};var ac=nc;function rc(e){const t=e.status_data;return o().createElement(o().Fragment,null,o().createElement("h4",null,h.Z.I18n.t("systemStatusQueueTitle")),o().createElement(Hl,{max_width:"400px",rows:[{key:h.Z.I18n.t("status"),value:"paused"===t.status?h.Z.I18n.t("paused"):h.Z.I18n.t("running")},{key:h.Z.I18n.t("startedAt"),value:t.started?h.Z.Date.full(1e3*t.started):h.Z.I18n.t("unknown")},{key:h.Z.I18n.t("sentEmails"),value:t.sent||0},{key:h.Z.I18n.t("retryAttempt"),value:t.retry_attempt||h.Z.I18n.t("none")},{key:h.Z.I18n.t("retryAt"),value:t.retry_at?h.Z.Date.full(1e3*t.retry_at):h.Z.I18n.t("none")},{key:h.Z.I18n.t("error"),value:t.error?t.error.error_message:h.Z.I18n.t("none")},{key:h.Z.I18n.t("totalCompletedTasks"),value:t.tasksStatusCounts.completed},{key:h.Z.I18n.t("totalRunningTasks"),value:t.tasksStatusCounts.running},{key:h.Z.I18n.t("totalPausedTasks"),value:t.tasksStatusCounts.paused},{key:h.Z.I18n.t("totalScheduledTasks"),value:t.tasksStatusCounts.scheduled}]}),o().createElement("h5",null,h.Z.I18n.t("scheduledTasks")),o().createElement(ac,{show_scheduled_at:!0,tasks:t.latestTasks.filter((e=>"scheduled"===e.status))}),o().createElement("h5",null,h.Z.I18n.t("runningTasks")),o().createElement(ac,{tasks:t.latestTasks.filter((e=>null===e.status))}),o().createElement("h5",null,h.Z.I18n.t("completedTasks")),o().createElement(ac,{tasks:t.latestTasks.filter((e=>"completed"===e.status))}))}rc.propTypes={status_data:y().shape({status:y().string,started:y().number,sent:y().number,retry_attempt:y().number,retry_at:y().number,error:y().shape({operation:y().string,error_message:y().string}),tasksStatusCounts:y().shape({completed:y().number.isRequired,running:y().number.isRequired,paused:y().number.isRequired,scheduled:y().number.isRequired}).isRequired,latestTasks:y().arrayOf(Jl.propTypes.task).isRequired}).isRequired};var ic=rc;function sc(e,t,n,a,r,i){const s=e?"success":"error";let l=e?t:n;return a&&(l=x()(l,/\[link\](.*?)\[\/link\]/g,(e=>o().createElement("a",{className:"mailpoet-text-link",href:a,"data-beacon-article":r,key:"kb-link"},e)))),o().createElement("div",{className:`mailpoet_notice notice inline notice-${s}`},o().createElement("p",null,l),i?o().createElement("p",null,o().createElement("i",null,i)):null)}var oc=function(){const e=window.systemStatusData;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet_notice notice inline"},o().createElement("p",null,e.mss.enabled?h.Z.I18n.t("systemStatusIntroCronMSS"):h.Z.I18n.t("systemStatusIntroCron"))),function(e){const t=e.cron.isReachable,n=e.cron.url,a=`${h.Z.I18n.t("systemStatusConnectionUnsuccessful")} ${h.Z.I18n.t("systemStatusCronConnectionUnsuccessfulInfo")}`,r=h.Z.I18n.t("systemStatusConnectionSuccessful"),i=t?null:e.cron.pingResponse;return o().createElement("div",null,o().createElement("h4",null,h.Z.I18n.t("systemStatusCronTitle")),o().createElement("p",null,o().createElement("a",{className:"mailpoet-text-link",href:n,target:"_blank",rel:"noopener noreferrer"},n)),sc(t,r,a,"https://kb.mailpoet.com/article/231-sending-does-not-work","5a0257ac2c7d3a272c0d7ad6",i))}(e),function(e){const t=e.mss.enabled?`${h.Z.I18n.t("systemStatusConnectionUnsuccessful")} ${h.Z.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo")}`:h.Z.I18n.t("systemStatusMSSConnectionCanNotConnect"),n=e.mss.enabled?h.Z.I18n.t("systemStatusConnectionSuccessful"):h.Z.I18n.t("systemStatusMSSConnectionCanConnect");return o().createElement("div",null,o().createElement("h4",null,h.Z.I18n.t("systemStatusMSSTitle")),sc(e.mss.isReachable,n,t,"https://kb.mailpoet.com/article/319-known-errors-when-validating-a-mailpoet-key","5ef1da9d2c7d3a10cba966c5",null))}(e),o().createElement(Ql,{status_data:e.cronStatus}),o().createElement(ic,{status_data:e.queueStatus}))},lc=function(){return o().createElement(o().Fragment,null,o().createElement("p",null,h.Z.I18n.t("yourPrivacyContent1")),o().createElement("p",null,h.Z.I18n.t("yourPrivacyContent2")),o().createElement("p",null,h.Z.I18n.t("yourPrivacyContent3")),o().createElement(b.Z,{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/"},h.Z.I18n.t("yourPrivacyButton")))};function cc(){return o().createElement(je.k.Provider,{value:(0,je.S)(window)},o().createElement(j.D,null),o().createElement(et.Z,null),o().createElement(ki.Z,{activeKey:"knowledgeBase"},o().createElement(yi.Z,{key:"knowledgeBase",title:h.Z.I18n.t("tabKnowledgeBaseTitle")},o().createElement(jl,null)),o().createElement(yi.Z,{key:"systemStatus",title:h.Z.I18n.t("tabSystemStatusTitle")},o().createElement(oc,null)),o().createElement(yi.Z,{key:"systemInfo",title:h.Z.I18n.t("tabSystemInfoTitle")},o().createElement(Yl,null)),o().createElement(yi.Z,{key:"yourPrivacy",title:h.Z.I18n.t("tabYourPrivacyTitle")},o().createElement(lc,null))))}const uc=document.getElementById("help_container");uc&&c().render(o().createElement(cc,null),uc);var dc=(0,d.withRouter)((function(e){let{children:t,location:{pathname:n}}=e;return(0,s.useEffect)((()=>{window.scrollTo(0,0)}),[n]),t||null}));function pc(e){let{activeMethod:t,onMethodChange:n}=e;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("span",{className:"mailpoet_import_heading"},h.Z.I18n.t("methodSelectionHead")),o().createElement("div",{className:"mailpoet-settings-inputs-row"},o().createElement("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"},o().createElement(w.Z,{dimension:"large",variant:"excellent",isInverted:!0},h.Z.I18n.t("seeVideo"))))),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement("div",{className:"mailpoet-settings-inputs-row"},o().createElement(ve.Z,{name:"select_method",automationId:"import-paste-method",id:"import-paste-method",checked:"paste-method"===t,value:"paste-method",onCheck:n}),o().createElement("label",{htmlFor:"import-paste-method"},h.Z.I18n.t("methodPaste"))),o().createElement("div",{className:"mailpoet-settings-inputs-row"},o().createElement(ve.Z,{name:"select_method",automationId:"import-csv-method",id:"import-csv-method",checked:"file-method"===t,value:"file-method",onCheck:n}),o().createElement("label",{htmlFor:"import-csv-method"},h.Z.I18n.t("methodUpload"))),o().createElement("div",{className:"mailpoet-settings-inputs-row"},o().createElement(ve.Z,{name:"select_method",automationId:"import-mailchimp-method",id:"import-mailchimp-method",checked:"mailchimp-method"===t,value:"mailchimp-method",onCheck:n}),o().createElement("label",{htmlFor:"import-mailchimp-method"},h.Z.I18n.t("methodMailChimp")))))}pc.propTypes={activeMethod:y().string,onMethodChange:y().func.isRequired},pc.defaultProps={activeMethod:void 0};var mc=pc;function hc(e){let{hidePrevious:t,isLastStep:n,canGoNext:a,onPreviousAction:r,onNextAction:i}=e;return o().createElement("div",{className:"mailpoet-settings-save"},!t&&o().createElement(b.Z,{type:"button",variant:"secondary",onClick:r},h.Z.I18n.t("previousStep")),o().createElement(b.Z,{type:"button",automationId:"import-next-step",isDisabled:!a,onClick:()=>{a&&i()}},h.Z.I18n.t(n?"import":"nextStep")))}hc.propTypes={canGoNext:y().bool,hidePrevious:y().bool,isLastStep:y().bool,onPreviousAction:y().func,onNextAction:y().func},hc.defaultProps={hidePrevious:!1,isLastStep:!1,canGoNext:!0,onPreviousAction:()=>{},onNextAction:()=>{}};var fc=hc;function gc(e){let{onValueChange:t,canFinish:n,onFinish:a,data:r,onPrevious:i}=e;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("label",{htmlFor:"paste_input"},h.Z.I18n.t("pasteLabel")),o().createElement("p",{className:"description"},x()(h.Z.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>o().createElement("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files","data-beacon-article":"57ce079f903360649f6e56fc",key:"kb-link",target:"_blank",rel:"noopener noreferrer"},e))))),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(de.Z,{id:"paste_input",rows:"15",placeholder:"Email, First Name, Last Name\njohn@doe.com, John, Doe\nmary@smith.com, Mary, Smith\njohnny@walker.com, Johnny, Walker",isCode:!0,onChange:e=>{t(e.target.value)},defaultValue:r})),o().createElement(fc,{canGoNext:n,onPreviousAction:i,onNextAction:a}))}gc.propTypes={onFinish:y().func,onPrevious:y().func,canFinish:y().bool.isRequired,onValueChange:y().func.isRequired,data:y().string},gc.defaultProps={onFinish:()=>{},onPrevious:()=>{},data:""};var vc=gc;function yc(e){let{onValueChange:t,canFinish:n,onFinish:a,onPrevious:r}=e;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("label",{htmlFor:"file_local"},h.Z.I18n.t("methodUpload")),o().createElement("p",{className:"description"},x()(h.Z.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>o().createElement("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files","data-beacon-article":"57ce079f903360649f6e56fc",key:"kb-link",target:"_blank",rel:"noopener noreferrer"},e))))),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(le.Z,{type:"file",id:"file_local",accept:".csv","data-automation-id":"import-file-upload-input",onChange:e=>{const n=e.target.value.match(/[^.]+$/);h.Z.Notice.hide(),null===n||"csv"!==n[0].toLowerCase()?(h.Z.Notice.error(h.Z.I18n.t("wrongFileFormat")),t("")):t(e.target.files[0])}})),o().createElement(fc,{canGoNext:n,onPreviousAction:r,onNextAction:a}))}yc.propTypes={canFinish:y().bool.isRequired,onFinish:y().func,onPrevious:y().func,onValueChange:y().func.isRequired},yc.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var bc=yc;function wc(e){let{onFinish:t,onPrevious:n}=e;const[a,r]=(0,s.useState)(""),[i,l]=(0,s.useState)(void 0),[c,u]=(0,s.useState)([]);return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("label",{htmlFor:"mailpoet_mailchimp_key_input"},o().createElement("span",{className:"mailpoet_import_heading"},h.Z.I18n.t("methodMailChimpLabel")),o().createElement("p",{className:"description"},x()(h.Z.I18n.t("methodMailChimpDescription"),/\[link\](.*?)\[\/link\]/,(e=>o().createElement("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/255-migrating-from-mailchimp-to-mailpoet#api","data-beacon-article":"5b16db842c7d3a0fa9a2aa15",key:"kb-link",target:"_blank",rel:"noopener noreferrer"},e)))))),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered"},o().createElement(le.Z,{dimension:"small",id:"mailpoet_mailchimp_key_input",type:"text",onChange:e=>{r(e.target.value),""===e.target.value.trim()&&l(void 0)}}),o().createElement("span",{className:"mailpoet-gap"}),o().createElement(b.Z,{type:"button",dimension:"small",onClick:()=>{h.Z.Modal.loading(!0),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpLists",data:{api_key:a}}).always((()=>{h.Z.Modal.loading(!1)})).done((e=>l(e.data))).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},h.Z.I18n.t("methodMailChimpVerify")),o().createElement("span",{className:"mailpoet-gap"}),o().createElement("span",null,Array.isArray(i)&&0===i.length?h.Z.I18n.t("noMailChimpLists"):null))),i?o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("methodMailChimpSelectList")),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(N,{field:{id:"segments",name:"list-selection",multiple:!0,placeholder:h.Z.I18n.t("methodMailChimpSelectPlaceholder"),forceSelect2:!0,values:i},onValueChange:e=>u(e.target.value)}))):null,o().createElement(fc,{canGoNext:Array.isArray(c)&&c.length>0,onPreviousAction:n,onNextAction:()=>{h.Z.Modal.loading(!0),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:a,lists:c}}).always((()=>{h.Z.Modal.loading(!1)})).done((e=>t(e.data))).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}}))}wc.propTypes={onFinish:y().func,onPrevious:y().func},wc.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var _c=wc,Ec=n(57460),Zc=n.n(Ec);const Ic=e=>window.roleBasedEmails.findIndex((t=>e.startsWith(`${t}@`)))>=0,Sc=e=>{let t,n=T.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)&&!Ic(n)&&n};var kc=(e,t)=>{const n=encodeURI(e).split(/%..|./).length-1;h.Z.Notice.hide(),n>window.maxPostSizeBytes?h.Z.Notice.error(h.Z.I18n.t("maxPostSizeNotice")):(h.Z.Modal.loading(!0),Zc().parse(e,function(e){return{skipEmptyLines:!0,error(){h.Z.Notice.hide(),h.Z.Notice.error(h.Z.I18n.t("dataProcessingError"))},complete(t){const n=function(e){let t=[];const n=[],a=[],r=[],i=[];let s,o,l,c,u=null,d=null,p=!1;return Object.keys(e).forEach((m=>{l=e[m].map((e=>e.trim())),c=l.length,null===d&&(d=c),c===d&&(null===u?(Object.keys(l).forEach((e=>{o=Sc(l[e]),null===u&&window.mailpoet_email_regex.test(o)&&(u=e,n[o]=!0,l[e]=o,t[o]=l)})),null===u&&0===parseInt(m,10)&&(p=!0,t[0]=l)):""!==l[u]&&(s=Sc(l[u]),T.ZP.has(n,s)?a.push(s):Ic(l[u])?i.push(l[u]):window.mailpoet_email_regex.test(s)?(n[s]=!0,l[u]=s,t[s]=l):r.push(l[u])))})),t=T.ZP.values(t),t&&(p&&t.length>=2||!p&&t.length>=1)?{header:window.mailpoet_email_regex.test(t[0][u])?null:t.shift(),subscribers:t,subscribersCount:t.length,duplicate:T.ZP.uniq(a),invalid:T.ZP.uniq(r),role:T.ZP.uniq(i)}:null}(t.data);if(n)e(n);else{let e=h.Z.I18n.t("noValidRecords");e=e.replace("[link]",'<a href="https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files" data-beacon-article="57ce079f903360649f6e56fc">'),e=e.replace("[/link]","</a>"),h.Z.Notice.error(e)}h.Z.Modal.loading(!1)}}}(t)))};function Tc(e){let{history:t,setStepMethodSelectionData:n,subscribersLimitForValidation:a}=e;const[r,i]=(0,s.useState)(void 0),[l,c]=(0,s.useState)(""),[u,d]=(0,s.useState)(void 0),p=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,a,r))},m=()=>{t.push("/step_clean_list")},f=()=>{kc("paste-method"===r?l:u,(e=>{h.Z.trackEvent("Subscribers import started",{source:"file-method"===r?"file upload":"pasted data"}),p(e)}))};return o().createElement("div",{className:"mailpoet-settings-grid"},o().createElement(mc,{activeMethod:r,onMethodChange:i}),"paste-method"===r&&o().createElement(vc,{onPrevious:m,onValueChange:c,onFinish:f,canFinish:!!l.trim(),data:l}),"file-method"===r&&o().createElement(bc,{onPrevious:m,onValueChange:d,onFinish:f,canFinish:!!u,data:u}),"mailchimp-method"===r&&o().createElement(_c,{onPrevious:m,onFinish:e=>{h.Z.trackEvent("Subscribers import started",{source:"MailChimp"}),p(e)}}),void 0===r&&o().createElement(fc,{canGoNext:!1,onPreviousAction:m}))}Tc.propTypes={history:y().shape({push:y().func.isRequired}).isRequired,setStepMethodSelectionData:y().func.isRequired,subscribersLimitForValidation:y().number.isRequired};var Cc=(0,d.withRouter)(Tc);function Nc(e){let{onProceed:t}=e;return o().createElement("div",{className:"mailpoet-clean-list-step-container"},o().createElement("p",null,h.Z.I18n.t("cleanListText1")),o().createElement("p",null,h.Z.I18n.t("cleanListText2")),o().createElement("p",null,t&&o().createElement(b.Z,{onClick:t,variant:"tertiary"},h.Z.I18n.t("listCleaningGotIt")),o().createElement(b.Z,{target:"_blank",href:"https://kb.mailpoet.com/article/287-list-cleaning-services"},h.Z.I18n.t("tryListCleaning"))))}function Dc(e){let{onSubmit:t,history:n}=e;const[a,r]=(0,s.useState)(void 0);return o().createElement("div",{className:"mailpoet-settings-grid"},o().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("validationStepHeading")),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement("div",{className:"mailpoet-settings-inputs-row"},o().createElement(ve.Z,{automationId:"mailpoet_import_validation_step_option1",id:"existing-list",checked:"existing-list"===a,value:"existing-list",onCheck:r}),o().createElement("label",{htmlFor:"existing-list"},h.Z.I18n.t("validationStepRadio1"))),o().createElement("div",{className:"mailpoet-settings-inputs-row"},o().createElement(ve.Z,{automationId:"mailpoet_import_validation_step_option2",id:"address-book",checked:"address-book"===a,value:"address-book",onCheck:r}),o().createElement("label",{htmlFor:"address-book"},h.Z.I18n.t("validationStepRadio2")))),o().createElement(fc,{canGoNext:void 0!==a,onPreviousAction:()=>n.push("step_method_selection"),onNextAction:()=>t(a)}))}Nc.propTypes={onProceed:y().func},Dc.propTypes={history:y().shape({push:y().func.isRequired}).isRequired,onSubmit:y().func.isRequired};var xc=Dc,Rc=function(){return o().createElement("div",{className:"mailpoet-clean-list-step-container","data-automation-id":"import_wrong_source_block"},o().createElement("p",null,h.Z.I18n.t("validationStepBlock1")),o().createElement("p",null,h.Z.I18n.t("validationStepBlock2")),o().createElement("p",null,o().createElement(b.Z,{href:"https://kb.mailpoet.com/article/269-reconfirm-subscribers-to-your-list",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("validationStepBlockButton"))))};function Oc(e){let{onSubmit:t}=e;const[n,a]=(0,s.useState)("over2years"),r=(0,s.useCallback)((e=>{a(e.target.value)}),[a]),i=(0,s.useCallback)((()=>{t("over2years"===n||"1to2years"===n?"notRecently":"recently")}),[t,n]);return o().createElement("div",{className:"mailpoet-settings-grid"},o().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("validationStepLastSentHeading")),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(he.Z,{defaultValue:n,onChange:r,automationId:"last_sent_to_list"},o().createElement("option",{value:"over2years"},h.Z.I18n.t("validationStepLastSentOption1")),o().createElement("option",{value:"1to2years"},h.Z.I18n.t("validationStepLastSentOption2")),o().createElement("option",{value:"less1year"},h.Z.I18n.t("validationStepLastSentOption3")),o().createElement("option",{value:"less3months"},h.Z.I18n.t("validationStepLastSentOption4")))),o().createElement("div",{className:"mailpoet-settings-save"},o().createElement(b.Z,{type:"button",automationId:"last_sent_to_list_next",onClick:i},h.Z.I18n.t("validationStepLastSentNext"))))}Oc.propTypes={onSubmit:y().func.isRequired};var Ac=Oc;function Pc(e){let{stepMethodSelectionData:t,history:n}=e;const[a,r]=(0,s.useState)(void 0),[i,l]=(0,s.useState)(void 0);(0,s.useEffect)((()=>{void 0===t&&n.replace("step_method_selection")}),[t,n]);const c=(0,s.useCallback)((e=>{l(e),"recently"===e&&n.push("step_data_manipulation")}),[n,l]);return o().createElement(o().Fragment,null,void 0===a&&o().createElement(xc,{onSubmit:r,history:n}),"address-book"===a&&o().createElement(Rc,null),"existing-list"===a&&void 0===i&&o().createElement(Ac,{onSubmit:c}),"existing-list"===a&&"notRecently"===i&&o().createElement(Nc,null))}Pc.propTypes={history:y().shape({push:y().func.isRequired,replace:y().func.isRequired}).isRequired,stepMethodSelectionData:y().shape({duplicate:y().arrayOf(y().string),header:y().arrayOf(y().string),invalid:y().arrayOf(y().string),role:y().arrayOf(y().string),subscribersCount:y().number,subscribers:y().arrayOf(y().arrayOf(y().string))})},Pc.defaultProps={stepMethodSelectionData:void 0};var Mc=(0,d.withRouter)(Pc);const Lc=e=>{let{translation:t,subscribers:n}=e,a="";return n.length&&(a=x()(t.replace("%2$s",n.join(", ")),"%1$s",(()=>o().createElement("strong",{key:t},n.length.toLocaleString()))),a=o().createElement("p",null,a)),a};function Fc(e){let{stepMethodSelectionData:t}=e;const{invalid:n,duplicate:a,role:r}=t,[i,l]=(0,s.useState)(!1),c=g()("mailpoet_subscribers_data_parse_results_details",{mailpoet_hidden:!i}),u=o().createElement(Lc,{translation:h.Z.I18n.t("importNoticeInvalid"),subscribers:n}),d=o().createElement(Lc,{translation:h.Z.I18n.t("importNoticeDuplicate"),subscribers:a});let p="";if(r.length&&(p=x()(h.Z.I18n.t("importNoticeRoleBased"),/(%1\$s|\[link\].*\[\/link\]|%2\$s)/,(e=>"%1$s"===e?o().createElement("strong",{key:"role-length"},r.length.toLocaleString()):"%2$s"===e?r.join(", "):o().createElement("a",{href:"https://kb.mailpoet.com/article/270-role-based-email-addresses-are-not-allowed","data-beacon-article":"5d0a1da404286318cac46fe5",target:"_blank",rel:"noopener noreferrer",key:e},e.replace("[link]","").replace("[/link]","")))),p=o().createElement("p",null,p)),n.length||a.length||r.length){const e=n.length+a.length+r.length;return o().createElement("div",{className:"error"},o().createElement("p",null,x()(h.Z.I18n.t("importNoticeSkipped"),"%1$s",(()=>o().createElement("strong",{key:"lengths"},e.toLocaleString())))," ",o().createElement("a",{className:"mailpoet_subscribers_data_parse_results_details_show","data-automation-id":"show-more-details",onClick:()=>l(!i),role:"button",tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),l(!i))}},h.Z.I18n.t("showMoreDetails"))),o().createElement("div",{className:c},o().createElement("hr",null),u,d,p))}return null}Lc.propTypes={translation:y().string.isRequired,subscribers:y().arrayOf(y().string).isRequired},Fc.propTypes={stepMethodSelectionData:y().shape({duplicate:y().arrayOf(y().string),invalid:y().arrayOf(y().string),role:y().arrayOf(y().string)})},Fc.defaultProps={stepMethodSelectionData:{invalid:[],duplicate:[],role:[]}};var qc=Fc;function $c(e){let{header:t,subscribers:n}=e;const a=((e,t)=>{const n=[],a=[];let r,i,s,o;return Object.keys(e[0]).forEach((l=>{r=e[0][l],i="ignore",r%1!=0&&window.mailpoet_email_regex.test(r)?i="email":t&&(s=t[l],o=window.mailpoetColumns.map((e=>e.name)).indexOf(s),-1!==o?i=window.mailpoetColumns[o].id:s&&(/first|first name|given name/i.test(s)?i="first_name":/last|last name/i.test(s)&&(i="last_name"))),i="ignore"!==i&&-1===a.indexOf(i)?i:"ignore",n[l]={column_id:i},a.push(i)})),n})(n,t);return o().createElement("tr",null,o().createElement("th",null,h.Z.I18n.t("matchData")),a.map(((e,t)=>o().createElement("th",{key:e.column_id+t},o().createElement("select",{className:"mailpoet_subscribers_column_data_match","data-column-id":e.column_id,"data-column-index":t,id:`column_${t}`})))))}function Uc(e){let{header:t}=e;return o().createElement("tr",{className:"mailpoet_header"},o().createElement("td",null),t.map((e=>o().createElement("td",{key:e},e))))}function Vc(e){let{subscriber:t,index:n}=e;return o().createElement(o().Fragment,null,o().createElement("td",null,n),t.map(((e,t)=>o().createElement("td",{key:`${e}-${n}-${t}`},e))))}function jc(e){let{subscribers:t,subscribersCount:n}=e;const a=". . .",r=Array(t[0].length).fill(a);return o().createElement(o().Fragment,null,t.slice(0,10).map(((e,t)=>o().createElement("tr",{key:`${e[0]}-${t}`},o().createElement(Vc,{subscriber:e,index:t+1})))),n>11?o().createElement("tr",{key:"filler"},o().createElement(Vc,{subscriber:r,index:a})):null,n>10?o().createElement("tr",{key:t[n-1][0]},o().createElement(Vc,{subscriber:t[n-1],index:n})):null)}function Wc(e){let{subscribersCount:t,subscribers:n,header:a}=e;return(0,s.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,a=t.params.args.data.id;"create"===a?(t.preventDefault(),m()(n).select2("close"),h.Z.Modal.popup({title:h.Z.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 h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:t}).done((t=>{const a={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:h.Z.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(a),window.mailpoetColumns.push(a),m()("select.mailpoet_subscribers_column_data_match").each((()=>{m()(n).html("").select2("destroy").select2(e)})),m()(n).data("column-id",a.id),h.Z.Modal.close()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#field_name"})})),!1}))):m()("select.mailpoet_subscribers_column_data_match").each((()=>{const e=n,r=m()(e).val();r===a&&"ignore"!==r&&(confirm(`${h.Z.I18n.t("selectedValueAlreadyMatched")} ${h.Z.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")}))})()})),o().createElement("div",{className:"subscribers_data"},o().createElement("table",{className:"mailpoet_subscribers widefat fixed"},o().createElement("thead",null,o().createElement($c,{header:a,subscribers:n})),o().createElement("tbody",null,a?o().createElement(Uc,{header:a}):null,o().createElement(jc,{subscribers:n,subscribersCount:t}))))}$c.propTypes={subscribers:y().arrayOf(y().arrayOf(y().oneOfType([y().string,y().number]))).isRequired,header:y().arrayOf(y().string)},$c.defaultProps={header:[]},Uc.propTypes={header:y().arrayOf(y().string).isRequired},Vc.propTypes={subscriber:y().arrayOf(y().oneOfType([y().string,y().number])).isRequired,index:y().node.isRequired},jc.propTypes={subscribersCount:y().number.isRequired,subscribers:y().arrayOf(y().arrayOf(y().oneOfType([y().string,y().number]))).isRequired},Wc.propTypes={subscribersCount:y().number,subscribers:y().arrayOf(y().arrayOf(y().oneOfType([y().string,y().number]))),header:y().arrayOf(y().string)},Wc.defaultProps={subscribersCount:0,subscribers:[],header:[]};var Yc=Wc;function Bc(e){let{setSelectedSegments:t}=e;const{segments:n}=(0,s.useContext)(je.k),{all:a,updateAll:r}=n,[i,l]=(0,s.useState)(a);(0,s.useLayoutEffect)((()=>{!function(e,n){const a=m()("select#mailpoet_segments_select");if(a.data("select2"))return;const r=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};a.html(""),a.select2({data:e.map((e=>({...e,text:e.name}))),dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:r,templateSelection:r}).on("change",(e=>{const n=m()('[data-id="notice_segmentSelection"]');e.currentTarget.value?m()('[data-id="notice_segmentSelection"]').remove():n.length||h.Z.Notice.error(h.Z.I18n.t("segmentSelectionRequired"),{static:!0,scroll:!0,id:"notice_segmentSelection",hideClose:!0});(e=>{t(e)})(T.ZP.pluck(a.select2("data"),"id"))}))}(i)}),[i,t]);const c=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([]),l([...i,e]),r([...i,e])};return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("label",{htmlFor:"mailpoet_segments_select"},h.Z.I18n.t("pickLists"),o().createElement("p",{className:"description"},h.Z.I18n.t("pickListsDescription")))),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered"},o().createElement("div",{className:"mailpoet-form-select mailpoet-form-input"},o().createElement("select",{id:"mailpoet_segments_select","data-placeholder":h.Z.I18n.t("select"),multiple:"multiple"},o().createElement("option",null))),o().createElement(b.Z,{variant:"tertiary",onClick:()=>{return e=c,h.Z.Modal.popup({title:h.Z.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();h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"addSegment",data:{name:t,description:n}}).done((t=>{e({id:t.data.id,name:t.data.name,text:t.data.name,subscriberCount:0}),h.Z.Modal.close()})).fail((e=>{e.errors.length>0&&(h.Z.Notice.hide(),h.Z.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#new_segment_name"}))}))})),void m()("#new_segment_cancel").on("click",(()=>{h.Z.Modal.close()}));var e}},h.Z.I18n.t("createANewList")))))}Bc.propTypes={setSelectedSegments:y().func.isRequired};var Hc=Bc;function zc(){return o().createElement("p",{className:"description"},x()(h.Z.I18n.t("consentSubscribed"),/\[link](.*?)\[\/link]/,(e=>o().createElement("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/357-why-express-consent-is-important",key:"kb-link",target:"_blank","data-beacon-article":"605ca22ac44f5d025f447f39",rel:"noopener noreferrer"},e))))}function Kc(e){let{newSubscribersStatus:t,setNewSubscribersStatus:n}=e;const a=(0,s.useCallback)((e=>{n(e.target.value)}),[n]);return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("label",{htmlFor:"new_subscribers_status"},h.Z.I18n.t("newSubscribersStatus")),o().createElement(zc,null)),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(he.Z,{id:"new_subscribers_status",placeholder:h.Z.I18n.t("select"),name:"new_subscribers_status",onChange:a,defaultValue:t},o().createElement("option",{value:"subscribed"},h.Z.I18n.t("subscribed")),o().createElement("option",{value:"inactive"},h.Z.I18n.t("inactive")),o().createElement("option",{value:"unsubscribed"},h.Z.I18n.t("unsubscribed")))))}function Gc(e){let{existingSubscribersStatus:t,setExistingSubscribersStatus:n}=e;const a=(0,s.useCallback)((e=>{n(e.target.value)}),[n]);return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("label",{htmlFor:"existing_subscribers_status"},h.Z.I18n.t("existingSubscribersStatus")),o().createElement(zc,null)),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(he.Z,{id:"existing_subscribers_status",placeholder:h.Z.I18n.t("select"),name:"existing_subscribers_status",onChange:a,defaultValue:t},o().createElement("option",{value:"dont_update"},h.Z.I18n.t("dontUpdate")),o().createElement("option",{value:"subscribed"},h.Z.I18n.t("subscribed")),o().createElement("option",{value:"inactive"},h.Z.I18n.t("inactive")),o().createElement("option",{value:"unsubscribed"},h.Z.I18n.t("unsubscribed")))))}function Qc(e){let{updateExistingSubscribers:t,setUpdateExistingSubscribers:n}=e;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("updateExistingSubscribers")),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(ve.Z,{id:"update_existing_subscribers",name:"update_existing_subscribers",value:"1",checked:t,onCheck:()=>n(!0)}),o().createElement("label",{htmlFor:"update_existing_subscribers"},h.Z.I18n.t("updateExistingSubscribersYes")),o().createElement("span",{className:"mailpoet-gap"}),o().createElement(ve.Z,{id:"dont_update_existing_subscribers",name:"update_existing_subscribers",value:"",checked:!t,onCheck:()=>n(!1)}),o().createElement("label",{htmlFor:"dont_update_existing_subscribers"},h.Z.I18n.t("updateExistingSubscribersNo"))))}Kc.propTypes={newSubscribersStatus:y().string.isRequired,setNewSubscribersStatus:y().func.isRequired},Gc.propTypes={existingSubscribersStatus:y().string.isRequired,setExistingSubscribersStatus:y().func.isRequired},Qc.propTypes={setUpdateExistingSubscribers:y().func.isRequired,updateExistingSubscribers:y().bool.isRequired};var Xc=Qc;function Jc(e){let{history:t,stepMethodSelectionData:n,subscribersLimitForValidation:a,setStepDataManipulationData:r}=e;const[i,l]=(0,s.useState)([]),[c,u]=(0,s.useState)(!0),[d,p]=(0,s.useState)("subscribed"),[f,g]=(0,s.useState)("dontUpdate");return(0,s.useEffect)((()=>{void 0===n&&t.replace("step_method_selection")}),[n,t]),void 0===n?null:o().createElement("div",{"data-automation-id":"import_data_manipulation_step"},o().createElement(qc,{stepMethodSelectionData:n}),o().createElement(Yc,{subscribersCount:n.subscribersCount,subscribers:n.subscribers,header:n.header}),o().createElement("div",{className:"mailpoet-settings-grid"},o().createElement(Hc,{setSelectedSegments:l}),o().createElement(Kc,{newSubscribersStatus:d,setNewSubscribersStatus:p}),o().createElement(Gc,{existingSubscribersStatus:f,setExistingSubscribersStatus:g}),o().createElement(Xc,{setUpdateExistingSubscribers:u,updateExistingSubscribers:c}),o().createElement(fc,{canGoNext:i.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,a)),onNextAction:()=>{((e,n,a,i,s,o)=>{const l={},c=new(m().AsyncQueue);let u=0;const d=Date.now()/1e3,p={created:0,updated:0,errors:[],segments:[]};h.Z.Modal.loading(!0);const f=(2e3,e.reduce(((e,t,n)=>(n%2e3==0&&e.push([]),e[e.length-1].push(t),e)),[]));T.ZP.each(m()("select.mailpoet_subscribers_column_data_match"),((e,t)=>{const n=m()(e).data("column-id");"ignore"!==n&&(l[n]={index:t})})),T.ZP.each(f,(()=>{c.add((e=>{e.pause(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processImport",data:JSON.stringify({columns:l,subscribers:f[u],timestamp:d,segments:n,newSubscribersStatus:a,existingSubscribersStatus:i,updateSubscribers:s})}).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=>{h.Z.Modal.loading(!1),e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),u+=1}))})),c.run(),c.onComplete((()=>{h.Z.Modal.loading(!1),p.errors.length>0&&!p.updated&&!p.created?h.Z.Notice.error(T.ZP.flatten(p.errors)):(p.segments=T.ZP.map(T.ZP.filter(p.segments,(e=>n.includes(e.id))),(e=>e.name)),r(p),t.push("step_results"))}))})(n.subscribers,i,d,f,c)},isLastStep:!0})))}n(49868),Jc.propTypes={history:y().shape({push:y().func.isRequired,replace:y().func.isRequired}).isRequired,stepMethodSelectionData:y().shape({duplicate:y().arrayOf(y().string),header:y().arrayOf(y().string),invalid:y().arrayOf(y().string),role:y().arrayOf(y().string),subscribersCount:y().number,subscribers:y().arrayOf(y().arrayOf(y().oneOfType([y().string,y().number])))}),subscribersLimitForValidation:y().number.isRequired,setStepDataManipulationData:y().func.isRequired},Jc.defaultProps={stepMethodSelectionData:void 0};var eu=(0,d.withRouter)(Jc);function tu(e){let{subscribersCount:t,segments:n,initialMessage:a}=e;if(t){let e=x()(a,"%1$s",(()=>o().createElement("strong",{key:"%1$s"},t.toLocaleString())));return e=x()(e,"%2$s",(()=>`"${n.join('", "')}"`)),o().createElement("p",null,e)}return null}function nu(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?null:o().createElement("p",null,h.Z.I18n.t("importNoAction"))}function au(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?o().createElement(o().Fragment,null,o().createElement("p",null,o().createElement("b",null,h.Z.I18n.t("congratulationResult"))),o().createElement("p",null,x()(h.Z.I18n.t("suppressionListReminder"),/\[link](.*?)\[\/link]/,(e=>o().createElement("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/359-how-to-import-a-suppression-list",key:"kb-link","data-beacon-article":"6064973ce0324b5fdfd0650c",target:"_blank",rel:"noopener noreferrer"},e))))):null}function ru(e){let{addedToSegmentWithWelcomeNotification:t}=e;return t?o().createElement("p",null,h.Z.I18n.t("importNoWelcomeEmail")):null}function iu(e){let{errors:t,createdSubscribers:n,updatedSubscribers:a,segments:r,addedToSegmentWithWelcomeNotification:i,history:l}=e;return(0,s.useEffect)((()=>{void 0===r&&0===t.length&&void 0===n&&void 0===a&&l.replace("step_method_selection")}),[r,n,t.length,l,a]),t.length&&h.Z.Notice.error(T.ZP.flatten(t)),o().createElement(o().Fragment,null,o().createElement("div",{className:"updated"},o().createElement(tu,{subscribersCount:n,segments:r,initialMessage:h.Z.I18n.t("subscribersCreated")}),o().createElement(tu,{subscribersCount:a,segments:r,initialMessage:h.Z.I18n.t("subscribersUpdated")}),o().createElement(nu,{createdSubscribers:n,updatedSubscribers:a}),o().createElement(ru,{addedToSegmentWithWelcomeNotification:i})),o().createElement(au,{createdSubscribers:n,updatedSubscribers:a}),o().createElement("div",{className:"mailpoet-settings-grid"},o().createElement("div",{className:"mailpoet-settings-save"},o().createElement(b.Z,{variant:"secondary",type:"button",onClick:()=>l.push("step_method_selection")},h.Z.I18n.t("importAgain")),o().createElement(b.Z,{type:"button",onClick:()=>{window.location.href="admin.php?page=mailpoet-subscribers"}},h.Z.I18n.t("viewSubscribers")))))}tu.propTypes={segments:y().arrayOf(y().string.isRequired),subscribersCount:y().number,initialMessage:y().string},tu.defaultProps={segments:[],subscribersCount:0,initialMessage:""},nu.propTypes={createdSubscribers:y().number,updatedSubscribers:y().number},nu.defaultProps={createdSubscribers:0,updatedSubscribers:0},au.propTypes={createdSubscribers:y().number,updatedSubscribers:y().number},au.defaultProps={createdSubscribers:0,updatedSubscribers:0},ru.propTypes={addedToSegmentWithWelcomeNotification:y().bool},ru.defaultProps={addedToSegmentWithWelcomeNotification:!1},iu.propTypes={history:y().shape({push:y().func.isRequired,replace:y().func.isRequired}).isRequired,errors:y().arrayOf(y().string.isRequired),segments:y().arrayOf(y().string.isRequired),createdSubscribers:y().number,updatedSubscribers:y().number,addedToSegmentWithWelcomeNotification:y().bool},iu.defaultProps={errors:[],segments:void 0,createdSubscribers:void 0,updatedSubscribers:void 0,addedToSegmentWithWelcomeNotification:void 0};var su=(0,d.withRouter)(iu);function ou(e){let{history:t}=e;return o().createElement(Nc,{onProceed:()=>t.push("step_method_selection")})}const lu=document.getElementById("import_container");function cu(){const[e,t]=(0,s.useState)(void 0),[n,a]=(0,s.useState)({}),r=(0,je.S)(window);return o().createElement(je.k.Provider,{value:r},o().createElement(u.UT,null,o().createElement(et.Z,null),o().createElement(dc,null,o().createElement(d.Switch,null,o().createElement(d.Route,{path:"/step_clean_list",render:e=>o().createElement(ou,e)}),o().createElement(d.Route,{path:"/step_method_selection",render:e=>o().createElement(Cc,(0,S.Z)({},e,{setStepMethodSelectionData:t,subscribersLimitForValidation:100}))}),o().createElement(d.Route,{path:"/step_input_validation",render:t=>o().createElement(Mc,(0,S.Z)({},t,{stepMethodSelectionData:e}))}),o().createElement(d.Route,{path:"/step_data_manipulation",render:t=>o().createElement(eu,(0,S.Z)({},t,{stepMethodSelectionData:e,subscribersLimitForValidation:100,setStepDataManipulationData:a}))}),o().createElement(d.Route,{path:"/step_results",render:e=>o().createElement(su,(0,S.Z)({},e,{errors:n.errors,createdSubscribers:n.created,updatedSubscribers:n.updated,segments:n.segments,addedToSegmentWithWelcomeNotification:n.added_to_segment_with_welcome_notification}))}),o().createElement(d.Route,{path:"*",render:()=>o().createElement(d.Redirect,{to:"/step_clean_list"})})))))}lu&&c().render(o().createElement(cu,null),lu);var uu=n(19675),du=n.n(uu),pu=n(56692);function mu(e){return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("welcomeWizardLetsStartTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("welcomeWizardSenderText")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("form",{id:"mailpoet_sender_form",onSubmit:t=>{t.preventDefault(),m()("#mailpoet_sender_form").parsley().validate()&&e.submit_sender()}},o().createElement(kt.r.TwoColumns,null,o().createElement("label",{htmlFor:"senderName"},o().createElement("span",{className:"mailpoet-wizard-label"},h.Z.I18n.t("senderName")),o().createElement(le.Z,{isFullWidth:!0,name:"senderName",type:"text",placeholder:"John Doe",value:e.sender?e.sender.name:"","data-parsley-required":!0,onChange:t=>e.update_sender({name:t.target.value})})),o().createElement("label",{htmlFor:"senderAddress"},o().createElement("span",{className:"mailpoet-wizard-label"},h.Z.I18n.t("senderAddress")),o().createElement(le.Z,{isFullWidth:!0,name:"senderAddress",type:"text",placeholder:"john@doe.com",value:e.sender?e.sender.address:"","data-parsley-required":!0,"data-parsley-type":"email",onChange:t=>e.update_sender({address:t.target.value})}))),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(b.Z,{isFullWidth:!0,type:"submit",withSpinner:e.loading},h.Z.I18n.t("continue")),o().createElement(b.Z,{href:"#finish",isDisabled:e.loading,isFullWidth:!0,onClick:e.finish,variant:"tertiary"},h.Z.I18n.t("finishLater"))))}m()(document).ready((()=>{let e;if(!m()("#mailpoet_subscribers_export").length)return;if(!window.exportData.segments)return;const t=du().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 a=m()("#export_lists"),r=m()("#export_columns");function i(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 s(e,t){e.data("select2")&&e.html("").select2("destroy"),e.select2({data:t,width:"20em",dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:i,templateSelection:i}).on("select2:selecting",(t=>{const n=t.params.args.data.id,a=["select","deselect"];let r;T.ZP.contains(a,n)&&(t.preventDefault(),"deselect"===n?m()(t.target).val("").trigger("change"):(r=[],T.ZP.each(e.find("option"),(e=>{const t=e.value;T.ZP.contains(a,t)||r.push(t)})),m()(t.target).val(r).trigger("change")),m()(t.target).select2("close"))})).on("change",(()=>{window.exportData.segments&&a.select2("data").length&&r.select2("data").length||!window.exportData.segments&&r.select2("data").length?n("on"):n("off")}))}e=m()("#mailpoet-export-button"),window.segments.forEach((e=>{a.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,pu.r)(e.name),e.text=(0,pu.r)(e.name)}))})),s(a,window.segments),s(r,window.subscriberFieldsSelect2),r.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;h.Z.Modal.loading(!0);const t=m()(':radio[name="option_format"]:checked').val();h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"ImportExport",action:"processExport",data:JSON.stringify({export_format_option:t,segments:!!window.exportData.segments&&a.val(),subscriber_fields:r.val()})}).always((()=>{h.Z.Modal.loading(!1)})).done((e=>{const n=h.Z.I18n.t("exportMessage").replace("%1$s",`<strong>${parseInt(e.data.totalExported,10).toLocaleString()}</strong>`).replace("[link]",`<a href="${e.data.exportFileURL}" target="_blank" >`).replace("[/link]","</a>");m()("#export_result_notice").html(`<p>${n}</p>`).show(),window.location.href=e.data.exportFileURL,h.Z.trackEvent("Subscribers export completed",{"Total exported":e.data.totalExported,"File Format":t})})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}))})),mu.propTypes={finish:y().func.isRequired,loading:y().bool.isRequired,update_sender:y().func.isRequired,submit_sender:y().func.isRequired,sender:y().shape({name:y().string,address:y().string})},mu.defaultProps={sender:null};var hu=mu;function fu(e){return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("welcomeWizardLetsStartTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("welcomeWizardSenderMigratedUserText")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(b.Z,{isFullWidth:!0,onClick:e.next,type:"button"},h.Z.I18n.t("continue")))}fu.propTypes={next:y().func.isRequired};var gu=fu;function vu(e){return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("welcomeWizardEmailCourseTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("welcomeWizardEmailCourseText")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("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"}),o().createElement(b.Z,{isFullWidth:!0,onClick:e.next,type:"button"},h.Z.I18n.t("continue")))}vu.propTypes={next:y().func.isRequired};var yu=vu,bu=o().createElement("svg",{width:"13",height:"11",viewBox:"0 0 13 11"},o().createElement("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"})),wu=o().createElement("svg",{width:"17",height:"16",viewBox:"0 0 17 16"},o().createElement("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 _u(e){let{onCheck:t,showError:n,checked:a,automationId:r,...i}=e;return o().createElement("div",{className:g()({"mailpoet-form-yesno":!0,"mailpoet-form-yesno-error":n,"mailpoet-disabled":i.disabled}),"data-automation-id":r},o().createElement("label",null,o().createElement("input",(0,S.Z)({type:"radio",checked:!0===a,onChange:()=>t(!0)},i)),o().createElement("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-yes"},bu)),o().createElement("label",null,o().createElement("input",(0,S.Z)({type:"radio",checked:!1===a,onChange:()=>t(!1)},i)),o().createElement("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-no"},wu)))}_u.propTypes={name:y().string.isRequired,checked:y().bool,onCheck:y().func.isRequired,showError:y().bool,automationId:y().string};var Eu=_u;function Zu(e){let{loading:t,submitForm:n}=e;const[a,r]=(0,s.useState)({tracking:void 0,libs3rdParty:void 0});return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("welcomeWizardUsageTrackingStepTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("welcomeWizardTrackingText")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(Ce.Z,{level:5},h.Z.I18n.t("welcomeWizardUsageTrackingStepSubTitle")),o().createElement(kt.r.TwoColumnsList,null,o().createElement(la,null,o().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList1")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList2")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList3")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList4")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList5")))),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("form",{onSubmit:function(e){return e.preventDefault(),n(a.tracking,a.libs3rdParty),!1}},o().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},o().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},o().createElement(Eu,{onCheck:e=>{const t={tracking:e,libs3rdParty:a.libs3rdParty};e&&(t.libs3rdParty=e),r(t)},checked:a.tracking,name:"mailpoet_tracking"})),o().createElement("div",null,o().createElement("p",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabel")," ",o().createElement("a",{href:"https://kb.mailpoet.com/article/130-sharing-your-data-with-us","data-beacon-article":"57ce0aaac6979108399a0454",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("welcomeWizardTrackingLink"))),o().createElement("div",{className:"mailpoet-wizard-note"},o().createElement("span",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNoteNote")),h.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNote")))),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},o().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},o().createElement(Eu,{onCheck:e=>{const t={libs3rdParty:e,tracking:a.tracking};e||(t.tracking=e),r(t)},checked:a.libs3rdParty,name:"mailpoet_libs_3rdParty"})),o().createElement("div",null,o().createElement("p",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabel")," ",o().createElement("a",{href:"https://kb.mailpoet.com/article/338-what-3rd-party-libraries-we-use","data-beacon-article":"5f7c7dd94cedfd0017dcece8",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLink"))),o().createElement("div",{className:"mailpoet-wizard-note"},o().createElement("span",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNoteNote")),h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNote")))),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(b.Z,{isFullWidth:!0,type:"submit",withSpinner:t,disabled:t},h.Z.I18n.t("continue"))))}Zu.propTypes={loading:y().bool.isRequired,submitForm:y().func.isRequired};var Iu=Zu;function Su(e){let{children:t}=e;return o().createElement("div",{className:"mailpoet-steps-content"},t)}Su.propTypes={children:y().node.isRequired};var ku=Su;function Tu(e){const[t,n]=(0,s.useState)(null),[a,r]=(0,s.useState)(null),[i,l]=(0,s.useState)(!1),c=e.isWizardStep?h.Z.I18n.t("wooCommerceSetupFinishButtonTextWizard"):h.Z.I18n.t("wooCommerceSetupFinishButtonTextStandalone");let u;return"subscribed"===a&&(u=!0),"unsubscribed"===a&&(u=!1),o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("wooCommerceSetupTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("wooCommerceSetupInfo")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("form",{onSubmit:n=>(n.preventDefault(),l(!0),null===a||null===t||e.submitForm(a,"true"===t),!1)},o().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},o().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},o().createElement(Eu,{showError:i&&null===a,checked:u,onCheck:e=>r(e?"subscribed":"unsubscribed"),name:"mailpoet_woocommerce_import_type",automationId:"woocommerce_import_type"})),o().createElement("div",null,o().createElement("p",null,x()(h.Z.I18n.t("wooCommerceSetupImportInfo"),/\[link\](.*?)\[\/link\]/,(e=>o().createElement("a",{key:e,href:"https://kb.mailpoet.com/article/284-import-old-customers-to-the-woocommerce-customers-list","data-beacon-article":"5d722c7104286364bc8ecf19",rel:"noopener noreferrer",target:"_blank"},e)))),o().createElement("div",{className:"mailpoet-wizard-note"},o().createElement("span",null,"GDPR"),h.Z.I18n.t("wooCommerceSetupImportGDPRInfo")))),o().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},o().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},o().createElement(Eu,{showError:i&&null===t,checked:t,onCheck:e=>n(e),name:"mailpoet_woocommerce_tracking",automationId:"woocommerce_tracking"})),o().createElement("div",null,o().createElement("p",null,x()(h.Z.I18n.t("wooCommerceSetupTrackingInfo"),/\[link\](.*?)\[\/link\]/,(e=>o().createElement("a",{key:e,href:"https://kb.mailpoet.com/article/280-woocommerce-cookie-tracking","data-beacon-article":"5d5fa44c2c7d3a7a4d778906",rel:"noopener noreferrer",target:"_blank"},e)))),o().createElement("div",{className:"mailpoet-wizard-note"},o().createElement("span",null,"GDPR"),h.Z.I18n.t("wooCommerceSetupTrackingGDPRInfo")))),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(b.Z,{isFullWidth:!0,type:"submit",withSpinner:e.loading,disabled:e.loading,automationId:"submit_woocommerce_setup"},c)))}Tu.propTypes={submitForm:y().func.isRequired,loading:y().bool.isRequired,isWizardStep:y().bool},Tu.defaultProps={isWizardStep:!1};var Cu=Tu;function Nu(e){return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-wizard-logo"},o().createElement("img",{src:window.mailpoet_logo_url,width:"160",height:"50",alt:"MailPoet logo"})),o().createElement(sa,{illustrationUrl:e.illustrationUrl},e.children))}Nu.propTypes={illustrationUrl:y().string.isRequired,children:y().oneOfType([y().arrayOf(y().node),y().node]).isRequired};var Du=Nu;function xu(e){let{isWizardStep:t=!1}=e;const[n,a]=(0,s.useState)(!1),r=e=>{a(!1),h.Z.Notice.showApiErrorNotice(e,{scroll:!0})},i=()=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"setupWooCommerceInitialImport"}).fail(r),l=()=>{window.location=window.finish_wizard_url},c=o().createElement(Du,{illustrationUrl:window.wizard_woocommerce_illustration_url},o().createElement(Cu,{loading:n,submitForm:(e,t)=>{a(!0);const n="basic"===h.Z.settings.tracking.level?"basic":"partial";var s;(s={woocommerce_import_screen_displayed:1,"mailpoet_subscribe_old_woocommerce_customers.enabled":"subscribed"===e?1:0,"tracking.level":t?"full":n,"woocommerce.accept_cookie_revenue_tracking.set":1},h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:s}).fail(r)).then(i).then(l)},isWizardStep:t}));return t?c:o().createElement(ku,null,c)}xu.propTypes={isWizardStep:y().bool},xu.defaultProps={isWizardStep:!1};var Ru=xu,Ou=e=>{let{name:t,address:n}=e;const a=n.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(a)>-1?(e=>{let{name:t,address:n}=e;const a=`wordpress@${window.location.hostname.replace("www.","")}`;return{sender:{name:t,address:a},reply_to:{name:t,address:n},"signup_confirmation.from.address":a,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":n,"signup_confirmation.reply_to.name":t}})({name:t,address:n}):(e=>{let{name:t,address:n}=e;return{sender:{name:t,address:n},reply_to:{name:t,address:n},"signup_confirmation.from.address":n,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":n,"signup_confirmation.reply_to.name":t}})({name:t,address:n})};const Au=()=>{let e=3;return window.has_mss_key_specified||(e+=1),window.is_woocommerce_active&&(e+=1),e},Pu=(e,t,n)=>{n<Au()?e.push(`/steps/${n+1}`):t()};var Mu=n(60054);function Lu(e){const t=Au(),n=parseInt(e.match.params.step,10),[a,r]=(0,s.useState)(!1),[i,l]=(0,s.useState)(window.sender_data);function c(){r(!0),window.location=window.finish_wizard_url}(0,s.useEffect)((()=>{(n>t||n<1)&&e.history.push("/steps/1")}),[n,t,e.history]);const u=(0,T.r$)(Pu,e.history,c);function d(e){return r(!0),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:e}).then((()=>r(!1))).fail((e=>{r(!1),e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}const p=(0,s.useCallback)(((e,t)=>{r(!0),d({analytics:{enabled:e?"1":""},"3rd_party_libs":{enabled:t?"1":""}}).then((()=>u(n)))}),[u,n]),m=(0,s.useCallback)((e=>{l({...i,...e})}),[i]),f=(0,s.useCallback)((()=>{d(Ou(i)).then((()=>u(n)))}),[u,i,n]),g=(0,s.useCallback)((e=>{e.preventDefault(),r(!0),d(Ou({address:window.admin_email,name:""})).then((()=>{window.is_woocommerce_active?u(t-1):c()}))}),[u,t]),v=(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===Au()?"WizardWooCommerceStep":"WelcomeWizardPitchMSSStep":"WelcomeWizardMigratedUserStep"})(n);return o().createElement(o().Fragment,null,o().createElement(Mu.Z,{count:t,current:n}),o().createElement(ku,null,"WelcomeWizardSenderStep"===v?o().createElement(Du,{illustrationUrl:window.wizard_sender_illustration_url},o().createElement(hu,{update_sender:m,submit_sender:f,finish:g,loading:a,sender:i})):null,"WelcomeWizardMigratedUserStep"===v?o().createElement(Du,{illustrationUrl:window.wizard_sender_illustration_url},o().createElement(gu,{next:()=>u(n)})):null,"WelcomeWizardEmailCourseStep"===v?o().createElement(Du,{illustrationUrl:window.wizard_email_course_illustration_url},o().createElement(yu,{next:()=>u(n)})):null,"WelcomeWizardUsageTrackingStep"===v?o().createElement(Du,{illustrationUrl:window.wizard_tracking_illustration_url},o().createElement(Iu,{loading:a,submitForm:p})):null,"WelcomeWizardPitchMSSStep"===v?o().createElement(Du,{illustrationUrl:window.wizard_MSS_pitch_illustration_url},o().createElement(fa,{next:()=>u(n),subscribersCount:window.subscribers_count,mailpoetAccountUrl:window.mailpoet_account_url,purchaseUrl:h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount,h.Z.currentWpUserEmail,"business",{utm_medium:"onboarding",utm_campaign:"purchase"})})):null,"WizardWooCommerceStep"===v?o().createElement(Ru,{isWizardStep:!0}):null))}Lu.propTypes={match:y().shape({params:y().shape({step:y().string}).isRequired}).isRequired,history:y().shape({push:y().func.isRequired}).isRequired};var Fu=Lu;function qu(){let e="/steps/1";window.location.search.includes("woocommerce-setup")&&(e="/woocommerce");const t=(0,je.S)(window);return o().createElement(je.k.Provider,{value:t},o().createElement(u.UT,null,o().createElement(et.Z,null),o().createElement(d.Switch,null,o().createElement(d.Route,{path:"/steps/:step",component:Fu}),o().createElement(d.Route,{path:"/woocommerce",component:Ru}),o().createElement(d.Route,{render:()=>o().createElement(d.Redirect,{to:e})}))))}const $u=document.getElementById("mailpoet-wizard-container");function Uu(){const[e,t]=(0,s.useState)(null),n=(0,je.S)(window),a=n.notices.error;function r(r){const i=r.target.name,s=r.target.checked;h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"set",data:{[i]:s?1:0}}).done((()=>{const a=e[i];a.value=s,t({...e,[i]:a});const r=`Feature '${i}' was ${s?"enabled":"disabled"}.`;n.notices.success(o().createElement("p",null,r))})).fail((e=>{e.errors.length>0&&a(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0})}))}return(0,s.useEffect)((()=>{h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"getAll"}).done((e=>{const n=e.data.reduce(((e,t)=>({...e,[t.name]:t})),{});t(n)})).fail((e=>{e.errors.length>0&&a(o().createElement(o().Fragment,null,e.errors.map((e=>o().createElement("p",null,e.message)))),{scroll:!0})}))}),[a]),null===e?o().createElement("p",null,"Loading experimental features..."):0===Object.values(e).length?o().createElement("p",null,"There are no experimental features at the moment."):o().createElement(je.k.Provider,{value:n},o().createElement(o().Fragment,null,o().createElement(et.Z,null),Object.values(e).map((e=>{const t=`experimental-feature-${e.name}`;return o().createElement("div",{key:e.name},o().createElement("label",{htmlFor:t},o().createElement("input",{id:t,type:"checkbox",name:e.name,defaultChecked:e.value,onChange:r})," ",e.name))}))))}$u&&c().render(o().createElement(qu,null),$u);const Vu=document.getElementById("experimental_features_container");Vu&&c().render(o().createElement(Uu,null),Vu);var ju=n(23520);function Wu(e){let{message:t,editing:n}=e;return n?o().createElement("textarea",{value:t,className:"mailpoet-logs-full-message",readOnly:!0}):o().createElement(o().Fragment,null,`${t.substr(0,150)}…`)}function Yu(e){let{log:t}=e;const[n,a]=(0,s.useState)(!1);return o().createElement("tr",{key:`log-row-${t.id}`},o().createElement("td",{role:"gridcell"},t.name),o().createElement("td",{onClick:function(e){(function(e){return(e.ctrlKey||e.metaKey)&&!e.altKey})(e)&&(n||a(!0))},role:"gridcell"},o().createElement(Wu,{message:t.message,editing:n})),o().createElement("td",{role:"gridcell"},h.Z.Date.full(t.created_at)))}function Bu(e){let{logs:t,onFilter:n,originalFrom:a,originalTo:r,originalSearch:i,originalOffset:l,originalLimit:c}=e;const[u,d]=(0,s.useState)(null!=a?a:void 0),[p,m]=(0,s.useState)(null!=r?r:void 0),[f,g]=(0,s.useState)(null!=l?l:""),[v,y]=(0,s.useState)(null!=c?c:""),[b,w]=(0,s.useState)(i||""),_=(0,cs.curry)(((e,t)=>{e(null!==t?h.Z.Date.format(t,{format:"Y-m-d"}):void 0)})),E=(0,s.useCallback)((()=>{const e={};u&&(e.from=u),p&&(e.to=p),f&&""!==f.trim()&&(e.offset=f),v&&""!==v.trim()&&(e.limit=v),b&&""!==b.trim()&&(e.search=b.trim()),n(e)}),[u,v,f,b,p,n]);return o().createElement("div",{className:"mailpoet-listing mailpoet-logs"},o().createElement("div",{className:"mailpoet-listing-header"},o().createElement("div",{className:"mailpoet-listing-search"},o().createElement("label",{htmlFor:"search_input",className:"screen-reader-text"},h.Z.I18n.t("searchLabel")),o().createElement(le.Z,{dimension:"small",iconStart:ju.Z,type:"search",id:"search_input",name:"s",onChange:e=>w(e.target.value),value:b,placeholder:h.Z.I18n.t("searchLabel")})),o().createElement("div",{className:"mailpoet-listing-filters"},`${h.Z.I18n.t("from")}:`,o().createElement(Dt,{dateFormat:"MMMM d, yyyy",onChange:_(d),maxDate:new Date,selected:u?(0,Ts.default)(u):void 0,dimension:"small"}),`${h.Z.I18n.t("to")}:`,o().createElement(Dt,{dateFormat:"MMMM d, yyyy",onChange:_(m),maxDate:new Date,selected:p?(0,Ts.default)(p):void 0,dimension:"small"})),o().createElement("div",{className:"mailpoet-logs-limit"},o().createElement("label",{htmlFor:"offset_input",className:"screen-reader-text"},h.Z.I18n.t("offsetLabel")),o().createElement(le.Z,{dimension:"small",id:"offset_input",name:"o",type:"number",onChange:e=>g(e.target.value),value:f,placeholder:h.Z.I18n.t("offsetLabel")})),o().createElement("div",{className:"mailpoet-logs-limit"},o().createElement("label",{htmlFor:"limit_input",className:"screen-reader-text"},h.Z.I18n.t("limitLabel")),o().createElement(le.Z,{dimension:"small",id:"limit_input",name:"l",type:"number",onChange:e=>y(e.target.value),value:v,placeholder:h.Z.I18n.t("limitLabel")})),o().createElement(xe.Button,{dimension:"small",onClick:E},h.Z.I18n.t("filter"))),o().createElement("table",{className:"mailpoet-listing-table widefat striped",role:"grid"},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",null,h.Z.I18n.t("tableHeaderName")),o().createElement("th",null,h.Z.I18n.t("tableHeaderMessage")),o().createElement("th",null,h.Z.I18n.t("tableHeaderCreatedOn")))),o().createElement("tbody",null,t.map((e=>o().createElement(Yu,{log:e,key:`log-${e.id}`}))))))}Wu.propTypes={message:y().string.isRequired,editing:y().bool.isRequired},Yu.propTypes={log:y().shape({id:y().number.isRequired,name:y().string.isRequired,message:y().string.isRequired,created_at:y().string.isRequired}).isRequired},Bu.propTypes={logs:y().arrayOf(y().shape({id:y().number.isRequired,name:y().string.isRequired,message:y().string.isRequired,created_at:y().string.isRequired})).isRequired,originalFrom:y().string,originalTo:y().string,originalSearch:y().string,originalOffset:y().string,originalLimit:y().string,onFilter:y().func.isRequired};const Hu=document.getElementById("mailpoet_logs_container");if(Hu){const e=new URL(window.location.href);c().render(o().createElement(Bu,{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,a]=t;e.searchParams.append(n,a)})),window.location.href=e.href}}),Hu)}var zu=n(13651);function Ku(e){let{onRequestClose:t}=e;const[n,a]=(0,s.useState)(!1);return m()((e=>{e(document).on("click",".notice .mailpoet-js-button-fix-this",(()=>{a(!0)}))})),o().createElement(je.k.Provider,{value:(0,je.S)(window)},o().createElement(et.Z,null),n&&o().createElement(zu.Z,{onRequestClose:()=>{a(!1),t()}}))}Ku.propTypes={onRequestClose:y().func},Ku.defaultProps={onRequestClose:cs.noop};const Gu=document.getElementById("mailpoet_set_from_address_modal");Gu&&c().render(o().createElement(Ku,{onRequestClose:()=>{window.location.href.includes("?page=mailpoet-settings")&&window.location.reload()}}),Gu);const Qu=e=>(async e=>"MailPoet"!==h.Z.mtaMethod||-1!==(await(async()=>"MailPoet"!==h.Z.mtaMethod?[]:(await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])()).indexOf(e))(e).then((e=>{if(!e)return h.Z.Notice.error(h.Z.I18n.t("mailerSendingNotResumedUnauthorized"),{scroll:!0}),h.Z.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"}),!1;h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"mailer",action:"resumeSending"}).done((()=>{h.Z.Notice.success(h.Z.I18n.t("mailerSendingResumedNotice"))})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}));m()((e=>{e(document).on("click",".notice .mailpoet-js-button-resume-sending",(e=>{Qu(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 a(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 r={p:a,P:function(e,t){var r,i=e.match(/(P+)(p+)?/)||[],s=i[1],o=i[2];if(!o)return n(e,t);switch(s){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;case"PPPP":default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",n(s,t)).replace("{{time}}",a(o,t))}};t.Z=r},24262:function(e,t,n){"use strict";function a(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 a}})},49702:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var a=n(19013),r=n(66979),i=n(7032),s=n(13882);function o(e){(0,s.Z)(1,arguments);var t=(0,i.Z)(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var a=(0,r.Z)(n);return a}var l=6048e5;function c(e){(0,s.Z)(1,arguments);var t=(0,a.default)(e),n=(0,r.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 s}});var a=n(19013),r=n(13882),i=n(66979);function s(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getUTCFullYear(),s=new Date(0);s.setUTCFullYear(n+1,0,4),s.setUTCHours(0,0,0,0);var o=(0,i.Z)(s),l=new Date(0);l.setUTCFullYear(n,0,4),l.setUTCHours(0,0,0,0);var c=(0,i.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 u}});var a=n(19013),r=n(59025),i=n(7651),s=n(13882),o=n(83946);function l(e,t){(0,s.Z)(1,arguments);var n=t||{},a=n.locale,l=a&&a.options&&a.options.firstWeekContainsDate,c=null==l?1:(0,o.Z)(l),u=null==n.firstWeekContainsDate?c:(0,o.Z)(n.firstWeekContainsDate),d=(0,i.Z)(e,t),p=new Date(0);p.setUTCFullYear(d,0,u),p.setUTCHours(0,0,0,0);var m=(0,r.Z)(p,t);return m}var c=6048e5;function u(e,t){(0,s.Z)(1,arguments);var n=(0,a.default)(e),i=(0,r.Z)(n,t).getTime()-l(n,t).getTime();return Math.round(i/c)+1}},7651:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(19013),r=n(13882),i=n(59025),s=n(83946);function o(e,t){(0,r.Z)(1,arguments);var n=(0,a.default)(e),o=n.getUTCFullYear(),l=t||{},c=l.locale,u=c&&c.options&&c.options.firstWeekContainsDate,d=null==u?1:(0,s.Z)(u),p=null==l.firstWeekContainsDate?d:(0,s.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,i.Z)(m,t),f=new Date(0);f.setUTCFullYear(o,0,p),f.setUTCHours(0,0,0,0);var g=(0,i.Z)(f,t);return n.getTime()>=h.getTime()?o+1:n.getTime()>=g.getTime()?o:o-1}},5267:function(e,t,n){"use strict";n.d(t,{Iu:function(){return i},Do:function(){return s},qp:function(){return o}});var a=["D","DD"],r=["YY","YYYY"];function i(e){return-1!==a.indexOf(e)}function s(e){return-1!==r.indexOf(e)}function o(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"))}},13882:function(e,t,n){"use strict";function a(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}n.d(t,{Z:function(){return a}})},66979:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=1,n=(0,a.default)(e),i=n.getUTCDay(),s=(i<t?7:0)+i-t;return n.setUTCDate(n.getUTCDate()-s),n.setUTCHours(0,0,0,0),n}},59025:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a=n(19013),r=n(13882),i=n(83946);function s(e,t){(0,r.Z)(1,arguments);var n=t||{},s=n.locale,o=s&&s.options&&s.options.weekStartsOn,l=null==o?0:(0,i.Z)(o),c=null==n.weekStartsOn?l:(0,i.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=(0,a.default)(e),d=u.getUTCDay(),p=(d<c?7:0)+d-c;return u.setUTCDate(u.getUTCDate()-p),u.setUTCHours(0,0,0,0),u}},83946:function(e,t,n){"use strict";function a(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}n.d(t,{Z:function(){return a}})},77349:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t);return isNaN(s)?new Date(NaN):s?(n.setDate(n.getDate()+s),n):n}},78343:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(83946),r=n(51820),i=n(13882),s=36e5;function o(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.Z)(e,n*s)}},51820:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e).getTime(),s=(0,a.Z)(t);return new Date(n+s)}},58545:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(51820),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.Z)(e,6e4*n)}},11640:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t);if(isNaN(s))return new Date(NaN);if(!s)return n;var o=n.getDate(),l=new Date(n.getTime());l.setMonth(n.getMonth()+s+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 s}});var a=n(83946),r=n(77349),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t),s=7*n;return(0,r.default)(e,s)}},21593:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(11640),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,12*n)}},36948:function(e,t,n){"use strict";n.d(t,{yJ:function(){return a},vh:function(){return r}}),Math.pow(10,8);var a=6e4,r=36e5},92300:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(24262),r=n(69119),i=n(13882),s=864e5;function o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,r.default)(t),l=n.getTime()-(0,a.Z)(n),c=o.getTime()-(0,a.Z)(o);return Math.round((l-c)/s)}},84129:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t),s=n.getFullYear()-i.getFullYear(),o=n.getMonth()-i.getMonth();return 12*s+o}},52724:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(584),r=n(24262),i=n(13882),s=6048e5;function o(e,t,n){(0,i.Z)(2,arguments);var o=(0,a.default)(e,n),l=(0,a.default)(t,n),c=o.getTime()-(0,r.Z)(o),u=l.getTime()-(0,r.Z)(l);return Math.round((c-u)/s)}},91857:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getFullYear()-i.getFullYear()}},57870:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.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 i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.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 s}});var a=n(19013),r=n(83946),i=n(13882);function s(e,t){(0,i.Z)(1,arguments);var n=t||{},s=n.locale,o=s&&s.options&&s.options.weekStartsOn,l=null==o?0:(0,r.Z)(o),c=null==n.weekStartsOn?l:(0,r.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=(0,a.default)(e),d=u.getDay(),p=6+(d<c?-7:0)-(d-c);return u.setDate(u.getDate()+p),u.setHours(23,59,59,999),u}},49546:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return P}});var a=n(12274),r=n(4958),i=n(91218),s=n(19013),o=n(13882),l=864e5,c=n(49702),u=n(7032),d=n(23324),p=n(7651);function m(e,t){for(var n=e<0?"-":"",a=Math.abs(e).toString();a.length<t;)a="0"+a;return n+a}var h=function(e,t){var n=e.getUTCFullYear(),a=n>0?n:1-n;return m("yy"===t?a%100:a,t.length)},f=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):m(n+1,2)},g=function(e,t){return m(e.getUTCDate(),t.length)},v=function(e,t){return m(e.getUTCHours()%12||12,t.length)},y=function(e,t){return m(e.getUTCHours(),t.length)},b=function(e,t){return m(e.getUTCMinutes(),t.length)},w=function(e,t){return m(e.getUTCSeconds(),t.length)},_=function(e,t){var n=t.length,a=e.getUTCMilliseconds();return m(Math.floor(a*Math.pow(10,n-3)),t.length)};function E(e,t){var n=e>0?"-":"+",a=Math.abs(e),r=Math.floor(a/60),i=a%60;if(0===i)return n+String(r);var s=t||"";return n+String(r)+s+m(i,2)}function Z(e,t){return e%60==0?(e>0?"-":"+")+m(Math.abs(e)/60,2):I(e,t)}function I(e,t){var n=t||"",a=e>0?"-":"+",r=Math.abs(e);return a+m(Math.floor(r/60),2)+n+m(r%60,2)}var S={G:function(e,t,n){var a=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});case"GGGG":default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var a=e.getUTCFullYear(),r=a>0?a:1-a;return n.ordinalNumber(r,{unit:"year"})}return h(e,t)},Y:function(e,t,n,a){var r=(0,p.Z)(e,a),i=r>0?r:1-r;return"YY"===t?m(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):m(i,t.length)},R:function(e,t){return m((0,u.Z)(e),t.length)},u:function(e,t){return m(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var a=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return m(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){var a=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return m(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){var a=e.getUTCMonth();switch(t){case"M":case"MM":return f(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){var a=e.getUTCMonth();switch(t){case"L":return String(a+1);case"LL":return m(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){var r=(0,d.Z)(e,a);return"wo"===t?n.ordinalNumber(r,{unit:"week"}):m(r,t.length)},I:function(e,t,n){var a=(0,c.Z)(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):m(a,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 a=function(e){(0,o.Z)(1,arguments);var t=(0,s.default)(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var a=t.getTime(),r=n-a;return Math.floor(r/l)+1}(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):m(a,t.length)},E:function(e,t,n){var a=e.getUTCDay();switch(t){case"E":case"EE":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"})}},e:function(e,t,n,a){var r=e.getUTCDay(),i=(r-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return m(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});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"})}},c:function(e,t,n,a){var r=e.getUTCDay(),i=(r-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return m(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});case"cccc":default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){var a=e.getUTCDay(),r=0===a?7:a;switch(t){case"i":return String(r);case"ii":return m(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});case"iiii":default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){var a=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){var a,r=e.getUTCHours();switch(a=12===r?"noon":0===r?"midnight":r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){var a,r=e.getUTCHours();switch(a=r>=17?"evening":r>=12?"afternoon":r>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var a=e.getUTCHours()%12;return 0===a&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return v(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):y(e,t)},K:function(e,t,n){var a=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):m(a,t.length)},k:function(e,t,n){var a=e.getUTCHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):m(a,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"}):w(e,t)},S:function(e,t){return _(e,t)},X:function(e,t,n,a){var r=(a._originalDate||e).getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return Z(r);case"XXXX":case"XX":return I(r);case"XXXXX":case"XXX":default:return I(r,":")}},x:function(e,t,n,a){var r=(a._originalDate||e).getTimezoneOffset();switch(t){case"x":return Z(r);case"xxxx":case"xx":return I(r);case"xxxxx":case"xxx":default:return I(r,":")}},O:function(e,t,n,a){var r=(a._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+E(r,":");case"OOOO":default:return"GMT"+I(r,":")}},z:function(e,t,n,a){var r=(a._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+E(r,":");case"zzzz":default:return"GMT"+I(r,":")}},t:function(e,t,n,a){var r=a._originalDate||e;return m(Math.floor(r.getTime()/1e3),t.length)},T:function(e,t,n,a){return m((a._originalDate||e).getTime(),t.length)}},k=n(97621),T=n(24262),C=n(5267),N=n(83946),D=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,R=/^'([^]*?)'?$/,O=/''/g,A=/[a-zA-Z]/;function P(e,t,n){(0,o.Z)(2,arguments);var l=String(t),c=n||{},u=c.locale||r.Z,d=u.options&&u.options.firstWeekContainsDate,p=null==d?1:(0,N.Z)(d),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=u.options&&u.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(!u.localize)throw new RangeError("locale must contain localize property");if(!u.formatLong)throw new RangeError("locale must contain formatLong property");var v=(0,s.default)(e);if(!(0,a.default)(v))throw new RangeError("Invalid time value");var y=(0,T.Z)(v),b=(0,i.Z)(v,y),w={firstWeekContainsDate:m,weekStartsOn:g,locale:u,_originalDate:v},_=l.match(x).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,k.Z[t])(e,u.formatLong,w):e})).join("").match(D).map((function(n){if("''"===n)return"'";var a=n[0];if("'"===a)return M(n);var r=S[a];if(r)return!c.useAdditionalWeekYearTokens&&(0,C.Do)(n)&&(0,C.qp)(n,t,e),!c.useAdditionalDayOfYearTokens&&(0,C.Iu)(n)&&(0,C.qp)(n,t,e),r(b,n,u.localize,w);if(a.match(A))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return n})).join("");return _}function M(e){return e.match(R)[1].replace(O,"'")}},55855:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getDate();return n}},20466:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getDay();return n}},85817:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getHours();return n}},9827:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return u}});var a=n(19013),r=n(584),i=n(13882);function s(e){return(0,i.Z)(1,arguments),(0,r.default)(e,{weekStartsOn:1})}function o(e){(0,i.Z)(1,arguments);var t=(0,a.default)(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=s(r),l=new Date(0);l.setFullYear(n,0,4),l.setHours(0,0,0,0);var c=s(l);return t.getTime()>=o.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function l(e){(0,i.Z)(1,arguments);var t=o(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var a=s(n);return a}var c=6048e5;function u(e){(0,i.Z)(1,arguments);var t=(0,a.default)(e),n=s(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 i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getMinutes();return n}},78966:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getMonth();return n}},56605:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.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 i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getSeconds();return n}},28789:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getTime();return n}},95570:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){return(0,r.Z)(1,arguments),(0,a.default)(e).getFullYear()}},42699:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getTime()>i.getTime()}},313:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getTime()<i.getTime()}},71381:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return r}});var a=n(13882);function r(e){return(0,a.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 i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getTime()===i.getTime()}},3151:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(69119),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getTime()===i.getTime()}},49160:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()}},86117:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(94431),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getTime()===i.getTime()}},60792:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getFullYear()===i.getFullYear()}},12274:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(71381),r=n(19013),i=n(13882);function s(e){if((0,i.Z)(1,arguments),!(0,a.default)(e)&&"number"!=typeof e)return!1;var t=(0,r.default)(e);return!isNaN(Number(t))}},24257:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e).getTime(),i=(0,a.default)(t.start).getTime(),s=(0,a.default)(t.end).getTime();if(!(i<=s))throw new RangeError("Invalid interval");return n>=i&&n<=s}},4958:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var a={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 r(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,a=e.formats[n]||e.formats[e.defaultWidth];return a}}var i={date:r({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:r({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:r({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},s={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 a,r=n||{};if("formatting"===(r.context?String(r.context):"standalone")&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,s=r.width?String(r.width):i;a=e.formattingValues[s]||e.formattingValues[i]}else{var o=e.defaultWidth,l=r.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[o]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function l(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.width,r=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],i=t.match(r);if(!i)return null;var s,o=i[0],l=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(l)?u(l,(function(e){return e.test(o)})):c(l,(function(e){return e.test(o)}));s=e.valueCallback?e.valueCallback(d):d,s=n.valueCallback?n.valueCallback(s):s;var p=t.slice(o.length);return{value:s,rest:p}}}function c(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function u(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var d,p={code:"en-US",formatDistance:function(e,t,n){var r,i=a[e];return r="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:i,formatRelative:function(e,t,n,a){return s[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),a=n%100;if(a>20||a<10)switch(a%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:(d={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(d.matchPattern);if(!n)return null;var a=n[0],r=e.match(d.parsePattern);if(!r)return null;var i=d.valueCallback?d.valueCallback(r[0]):r[0];i=t.valueCallback?t.valueCallback(i):i;var s=e.slice(a.length);return{value:i,rest:s}}),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 i}});var a=n(19013),r=n(13882);function i(e){var t,n;if((0,r.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,a.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 i}});var a=n(19013),r=n(13882);function i(e){var t,n;if((0,r.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,a.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 ie}});var a=n(4958),r=n(91218),i=n(19013);function s(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),u=n(83946),d=n(7651),p=n(13882);function m(e,t,n){(0,p.Z)(2,arguments);var a=n||{},r=a.locale,s=r&&r.options&&r.options.weekStartsOn,o=null==s?0:(0,u.Z)(s),l=null==a.weekStartsOn?o:(0,u.Z)(a.weekStartsOn);if(!(l>=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=(0,i.default)(e),d=(0,u.Z)(t),m=c.getUTCDay(),h=d%7,f=(h+7)%7,g=(f<l?7:0)+d-m;return c.setUTCDate(c.getUTCDate()+g),c}var h=n(49702),f=n(23324),g=n(66979),v=n(59025),y=/^(1[0-2]|0?\d)/,b=/^(3[0-1]|[0-2]?\d)/,w=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,_=/^(5[0-3]|[0-4]?\d)/,E=/^(2[0-3]|[0-1]?\d)/,Z=/^(2[0-4]|[0-1]?\d)/,I=/^(1[0-1]|0?\d)/,S=/^(1[0-2]|0?\d)/,k=/^[0-5]?\d/,T=/^[0-5]?\d/,C=/^\d/,N=/^\d{1,2}/,D=/^\d{1,3}/,x=/^\d{1,4}/,R=/^-?\d+/,O=/^-?\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 V(e,t,n){var a=t.match(e);if(!a)return null;var r=parseInt(a[0],10);return{value:n?n(r):r,rest:t.slice(a[0].length)}}function j(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 V(R,e,t)}function Y(e,t,n){switch(e){case 1:return V(C,t,n);case 2:return V(N,t,n);case 3:return V(D,t,n);case 4:return V(x,t,n);default:return V(new RegExp("^\\d{1,"+e+"}"),t,n)}}function B(e,t,n){switch(e){case 1:return V(O,t,n);case 2:return V(A,t,n);case 3:return V(P,t,n);case 4:return V(M,t,n);default:return V(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,a=t>0,r=a?t:1-t;if(r<=50)n=e||100;else{var i=r+50;n=e+100*Math.floor(i/100)-(e>=i%100?100:0)}return a?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,a){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,a){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,a){var r=function(e){return{year:e,isTwoDigitYear:"yy"===t}};switch(t){case"y":return Y(4,e,r);case"yo":return n.ordinalNumber(e,{unit:"year",valueCallback:r});default:return Y(t.length,e,r)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,a){var r=e.getUTCFullYear();if(n.isTwoDigitYear){var i=z(n.year,r);return e.setUTCFullYear(i,0,1),e.setUTCHours(0,0,0,0),e}var s="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(s,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,a){var r=function(e){return{year:e,isTwoDigitYear:"YY"===t}};switch(t){case"Y":return Y(4,e,r);case"Yo":return n.ordinalNumber(e,{unit:"year",valueCallback:r});default:return Y(t.length,e,r)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,a){var r=(0,d.Z)(e,a);if(n.isTwoDigitYear){var i=z(n.year,r);return e.setUTCFullYear(i,0,a.firstWeekContainsDate),e.setUTCHours(0,0,0,0),(0,v.Z)(e,a)}var s="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(s,0,a.firstWeekContainsDate),e.setUTCHours(0,0,0,0),(0,v.Z)(e,a)},incompatibleTokens:["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:{priority:130,parse:function(e,t,n,a){return B("R"===t?4:t.length,e)},set:function(e,t,n,a){var r=new Date(0);return r.setUTCFullYear(n,0,4),r.setUTCHours(0,0,0,0),(0,g.Z)(r)},incompatibleTokens:["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:{priority:130,parse:function(e,t,n,a){return B("u"===t?4:t.length,e)},set:function(e,t,n,a){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,a){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,a){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,a){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,a){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,a){var r=function(e){return e-1};switch(t){case"M":return V(y,e,r);case"MM":return Y(2,e,r);case"Mo":return n.ordinalNumber(e,{unit:"month",valueCallback:r});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,a){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,a){var r=function(e){return e-1};switch(t){case"L":return V(y,e,r);case"LL":return Y(2,e,r);case"Lo":return n.ordinalNumber(e,{unit:"month",valueCallback:r});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,a){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,a){switch(t){case"w":return V(_,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,a){return(0,v.Z)(function(e,t,n){(0,p.Z)(2,arguments);var a=(0,i.default)(e),r=(0,u.Z)(t),s=(0,f.Z)(a,n)-r;return a.setUTCDate(a.getUTCDate()-7*s),a}(e,n,a),a)},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:{priority:100,parse:function(e,t,n,a){switch(t){case"I":return V(_,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,a){return(0,g.Z)(function(e,t){(0,p.Z)(2,arguments);var n=(0,i.default)(e),a=(0,u.Z)(t),r=(0,h.Z)(n)-a;return n.setUTCDate(n.getUTCDate()-7*r),n}(e,n,a),a)},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,a){switch(t){case"d":return V(b,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return Y(t.length,e)}},validate:function(e,t,n){var a=Q(e.getUTCFullYear()),r=e.getUTCMonth();return a?t>=1&&t<=G[r]:t>=1&&t<=K[r]},set:function(e,t,n,a){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,a){switch(t){case"D":case"DD":return V(w,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return Y(t.length,e)}},validate:function(e,t,n){return Q(e.getUTCFullYear())?t>=1&&t<=366:t>=1&&t<=365},set:function(e,t,n,a){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,a){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,a){return(e=m(e,n,a)).setUTCHours(0,0,0,0),e},incompatibleTokens:["D","i","e","c","t","T"]},e:{priority:90,parse:function(e,t,n,a){var r=function(e){var t=7*Math.floor((e-1)/7);return(e+a.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return Y(t.length,e,r);case"eo":return n.ordinalNumber(e,{unit:"day",valueCallback:r});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,a){return(e=m(e,n,a)).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,a){var r=function(e){var t=7*Math.floor((e-1)/7);return(e+a.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return Y(t.length,e,r);case"co":return n.ordinalNumber(e,{unit:"day",valueCallback:r});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,a){return(e=m(e,n,a)).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,a){var r=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:r})||n.day(e,{width:"short",context:"formatting",valueCallback:r})||n.day(e,{width:"narrow",context:"formatting",valueCallback:r});case"iiiii":return n.day(e,{width:"narrow",context:"formatting",valueCallback:r});case"iiiiii":return n.day(e,{width:"short",context:"formatting",valueCallback:r})||n.day(e,{width:"narrow",context:"formatting",valueCallback:r});case"iiii":default:return n.day(e,{width:"wide",context:"formatting",valueCallback:r})||n.day(e,{width:"abbreviated",context:"formatting",valueCallback:r})||n.day(e,{width:"short",context:"formatting",valueCallback:r})||n.day(e,{width:"narrow",context:"formatting",valueCallback:r})}},validate:function(e,t,n){return t>=1&&t<=7},set:function(e,t,n,a){return(e=function(e,t){(0,p.Z)(2,arguments);var n=(0,u.Z)(t);n%7==0&&(n-=7);var a=1,r=(0,i.default)(e),s=r.getUTCDay(),o=((n%7+7)%7<a?7:0)+n-s;return r.setUTCDate(r.getUTCDate()+o),r}(e,n,a)).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,a){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,a){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["b","B","H","k","t","T"]},b:{priority:80,parse:function(e,t,n,a){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,a){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["a","B","H","k","t","T"]},B:{priority:80,parse:function(e,t,n,a){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,a){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["a","b","t","T"]},h:{priority:70,parse:function(e,t,n,a){switch(t){case"h":return V(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,a){var r=e.getUTCHours()>=12;return r&&n<12?e.setUTCHours(n+12,0,0,0):r||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,a){switch(t){case"H":return V(E,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,a){return e.setUTCHours(n,0,0,0),e},incompatibleTokens:["a","b","h","K","k","t","T"]},K:{priority:70,parse:function(e,t,n,a){switch(t){case"K":return V(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,a){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,a){switch(t){case"k":return V(Z,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=24},set:function(e,t,n,a){var r=n<=24?n%24:n;return e.setUTCHours(r,0,0,0),e},incompatibleTokens:["a","b","h","H","K","t","T"]},m:{priority:60,parse:function(e,t,n,a){switch(t){case"m":return V(k,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,a){return e.setUTCMinutes(n,0,0),e},incompatibleTokens:["t","T"]},s:{priority:50,parse:function(e,t,n,a){switch(t){case"s":return V(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,a){return e.setUTCSeconds(n,0),e},incompatibleTokens:["t","T"]},S:{priority:30,parse:function(e,t,n,a){return Y(t.length,e,(function(e){return Math.floor(e*Math.pow(10,3-t.length))}))},set:function(e,t,n,a){return e.setUTCMilliseconds(n),e},incompatibleTokens:["t","T"]},X:{priority:10,parse:function(e,t,n,a){switch(t){case"X":return j(L,e);case"XX":return j(F,e);case"XXXX":return j(q,e);case"XXXXX":return j(U,e);case"XXX":default:return j($,e)}},set:function(e,t,n,a){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","x"]},x:{priority:10,parse:function(e,t,n,a){switch(t){case"x":return j(L,e);case"xx":return j(F,e);case"xxxx":return j(q,e);case"xxxxx":return j(U,e);case"xxx":default:return j($,e)}},set:function(e,t,n,a){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","X"]},t:{priority:40,parse:function(e,t,n,a){return W(e)},set:function(e,t,n,a){return[new Date(1e3*n),{timestampIsSet:!0}]},incompatibleTokens:"*"},T:{priority:20,parse:function(e,t,n,a){return W(e)},set:function(e,t,n,a){return[new Date(n),{timestampIsSet:!0}]},incompatibleTokens:"*"}},J=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,te=/^'([^]*?)'?$/,ne=/''/g,ae=/\S/,re=/[a-zA-Z]/;function ie(e,t,n,d){(0,p.Z)(3,arguments);var m=String(e),h=String(t),f=d||{},g=f.locale||a.Z;if(!g.match)throw new RangeError("locale must contain match property");var v=g.options&&g.options.firstWeekContainsDate,y=null==v?1:(0,u.Z)(v),b=null==f.firstWeekContainsDate?y:(0,u.Z)(f.firstWeekContainsDate);if(!(b>=1&&b<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var w=g.options&&g.options.weekStartsOn,_=null==w?0:(0,u.Z)(w),E=null==f.weekStartsOn?_:(0,u.Z)(f.weekStartsOn);if(!(E>=0&&E<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(""===h)return""===m?(0,i.default)(n):new Date(NaN);var Z,I={firstWeekContainsDate:b,weekStartsOn:E,locale:g},S=[{priority:10,subPriority:-1,set:se,index:0}],k=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(Z=0;Z<k.length;Z++){var C=k[Z];!f.useAdditionalWeekYearTokens&&(0,c.Do)(C)&&(0,c.qp)(C,h,e),!f.useAdditionalDayOfYearTokens&&(0,c.Iu)(C)&&(0,c.qp)(C,h,e);var N=C[0],D=X[N];if(D){var x=D.incompatibleTokens;if(Array.isArray(x)){for(var R=void 0,O=0;O<T.length;O++){var A=T[O].token;if(-1!==x.indexOf(A)||A===N){R=T[O];break}}if(R)throw new RangeError("The format string mustn't contain `".concat(R.fullToken,"` and `").concat(C,"` at the same time"))}else if("*"===D.incompatibleTokens&&T.length)throw new RangeError("The format string mustn't contain `".concat(C,"` and any other token at the same time"));T.push({token:N,fullToken:C});var P=D.parse(m,C,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(re))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");if("''"===C?C="'":"'"===N&&(C=oe(C)),0!==m.indexOf(C))return new Date(NaN);m=m.slice(C.length)}}if(m.length>0&&ae.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,i.default)(n);if(isNaN(L))return new Date(NaN);var F=(0,r.Z)(L,(0,l.Z)(L)),q={};for(Z=0;Z<M.length;Z++){var $=M[Z];if($.validate&&!$.validate(F,$.value,I))return new Date(NaN);var U=$.set(F,q,$.value,I);U[0]?(F=U[0],s(q,U[1])):F=U}return F}function se(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 s}});var a=n(36948),r=n(13882),i=n(83946);function s(e,t){(0,r.Z)(1,arguments);var n=t||{},a=null==n.additionalDigits?2:(0,i.Z)(n.additionalDigits);if(2!==a&&1!==a&&0!==a)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 s,o=d(e);if(o.date){var l=p(o.date,a);s=m(l.restDateString,l.year)}if(!s||isNaN(s.getTime()))return new Date(NaN);var c,u=s.getTime(),h=0;if(o.time&&(h=f(o.time),isNaN(h)))return new Date(NaN);if(!o.timezone){var g=new Date(u+h),y=new Date(0);return y.setFullYear(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),y.setHours(g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds()),y}return c=v(o.timezone),isNaN(c)?new Date(NaN):new Date(u+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*)?))?$/,u=/^([+-])(\d{2})(?::?(\d{2}))?$/;function d(e){var t,n={},a=e.split(o.dateTimeDelimiter);if(a.length>2)return n;if(/:/.test(a[0])?t=a[0]:(n.date=a[0],t=a[1],o.timeZoneDelimiter.test(n.date)&&(n.date=e.split(o.timeZoneDelimiter)[0],t=e.substr(n.date.length,e.length))),t){var r=o.timezone.exec(t);r?(n.time=t.replace(r[1],""),n.timezone=r[1]):n.time=t}return n}function p(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),a=e.match(n);if(!a)return{year:NaN,restDateString:""};var r=a[1]?parseInt(a[1]):null,i=a[2]?parseInt(a[2]):null;return{year:null===i?r:100*i,restDateString:e.slice((a[1]||a[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 a=!!n[4],r=h(n[1]),i=h(n[2])-1,s=h(n[3]),o=h(n[4]),c=h(n[5])-1;if(a)return function(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}(0,o,c)?function(e,t,n){var a=new Date(0);a.setUTCFullYear(e,0,4);var r=7*(t-1)+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}(t,o,c):new Date(NaN);var u=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(y[t]||(b(e)?29:28))}(t,i,s)&&function(e,t){return t>=1&&t<=(b(e)?366:365)}(t,r)?(u.setUTCFullYear(t,i,Math.max(r,s)),u):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]),r=g(t[2]),i=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,r,i)?n*a.vh+r*a.yJ+1e3*i:NaN}function g(e){return e&&parseFloat(e.replace(",","."))||0}function v(e){if("Z"===e)return 0;var t=e.match(u);if(!t)return 0;var n="+"===t[1]?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,i)?n*(r*a.vh+i*a.yJ):NaN}var y=[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 s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t);return n.setHours(s),n}},4543:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t);return n.setMinutes(s),n}},62225:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(83946),r=n(19013),i=n(13882);function s(e){(0,i.Z)(1,arguments);var t=(0,r.default)(e),n=t.getFullYear(),a=t.getMonth(),s=new Date(0);return s.setFullYear(n,a+1,0),s.setHours(0,0,0,0),s.getDate()}function o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t),l=n.getFullYear(),c=n.getDate(),u=new Date(0);u.setFullYear(l,o,15),u.setHours(0,0,0,0);var d=s(u);return n.setMonth(o,Math.min(c,d)),n}},11503:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(83946),r=n(19013),i=n(62225),s=n(13882);function o(e,t){(0,s.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t),l=Math.floor(n.getMonth()/3)+1,c=o-l;return(0,i.default)(n,n.getMonth()+3*c)}},39880:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t);return n.setSeconds(s),n}},44749:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(s),n)}},69119:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.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 i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.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 i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getMonth(),i=n-n%3;return t.setMonth(i,1),t.setHours(0,0,0,0),t}},584:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(19013),r=n(83946),i=n(13882);function s(e,t){(0,i.Z)(1,arguments);var n=t||{},s=n.locale,o=s&&s.options&&s.options.weekStartsOn,l=null==o?0:(0,r.Z)(o),c=null==n.weekStartsOn?l:(0,r.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=(0,a.default)(e),d=u.getDay(),p=(d<c?7:0)+d-c;return u.setDate(u.getDate()-p),u.setHours(0,0,0,0),u}},38148:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.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 s}});var a=n(83946),r=n(77349),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,-n)}},88330:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(78343),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,-n)}},91218:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a=n(83946),r=n(51820),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.Z)(e,-n)}},1784:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(58545),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,-n)}},54559:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(11640),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,-n)}},77982:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(63500),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,-n)}},59319:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(21593),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,-n)}},19013:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return r}});var a=n(13882);function r(e){(0,a.Z)(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}},16245:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,n){var a,r=n||{};if("formatting"===(r.context?String(r.context):"standalone")&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,s=r.width?String(r.width):i;a=e.formattingValues[s]||e.formattingValues[i]}else{var o=e.defaultWidth,l=r.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[o]}return a[e.argumentCallback?e.argumentCallback(t):t]}},e.exports=t.default},57460:function(e,t){var n,a;void 0===(a="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,a=n&&/blob:/i.test((t.location||{}).protocol),r={},i=0,s={parse:function(n,a){var o=(a=a||{}).dynamicTyping||!1;if(_(o)&&(a.dynamicTypingFunction=o,o={}),a.dynamicTyping=o,a.transform=!!_(a.transform)&&a.transform,a.worker&&s.WORKERS_SUPPORTED){var l=function(){if(!s.WORKERS_SUPPORTED)return!1;var n,a,o=(n=t.URL||t.webkitURL||null,a=e.toString(),s.BLOB_URL||(s.BLOB_URL=n.createObjectURL(new Blob(["(",a,")();"],{type:"text/javascript"})))),l=new t.Worker(o);return l.onmessage=g,l.id=i++,r[l.id]=l}();return l.userStep=a.step,l.userChunk=a.chunk,l.userComplete=a.complete,l.userError=a.error,a.step=_(a.step),a.chunk=_(a.chunk),a.complete=_(a.complete),a.error=_(a.error),delete a.worker,void l.postMessage({input:n,config:a,workerId:l.id})}var m=null;return s.NODE_STREAM_INPUT,"string"==typeof n?m=a.download?new c(a):new d(a):!0===n.readable&&_(n.read)&&_(n.on)?m=new p(a):(t.File&&n instanceof File||n instanceof Object)&&(m=new u(a)),m.stream(n)},unparse:function(e,t){var n=!1,a=!0,r=",",i="\r\n",o='"',l=o+o,c=!1,u=null,d=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||s.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(r=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&&(i=t.newline),"string"==typeof t.quoteChar&&(o=t.quoteChar),"boolean"==typeof t.header&&(a=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");u=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+o),"boolean"==typeof t.escapeFormulae&&(d=t.escapeFormulae)}}();var p=new RegExp(h(o),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return m(null,e,c);if("object"==typeof e[0])return m(u||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),m(e.fields||[],e.data||[],c);throw new Error("Unable to serialize unrecognized input");function m(e,t,n){var s="";"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&&a){for(var c=0;c<e.length;c++)0<c&&(s+=r),s+=f(e[c],c);0<t.length&&(s+=i)}for(var u=0;u<t.length;u++){var d=o?e.length:t[u].length,p=!1,m=o?0===Object.keys(t[u]).length:0===t[u].length;if(n&&!o&&(p="greedy"===n?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===n&&o){for(var h=[],g=0;g<d;g++){var v=l?e[g]:g;h.push(t[u][v])}p=""===h.join("").trim()}if(!p){for(var y=0;y<d;y++){0<y&&!m&&(s+=r);var b=o&&l?e[y]:y;s+=f(t[u][b],y)}u<t.length-1&&(!n||0<d&&!m)&&(s+=i)}}return s}function f(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);!0===d&&"string"==typeof e&&null!==e.match(/^[=+\-@].*$/)&&(e="'"+e);var a=e.toString().replace(p,l);return"boolean"==typeof n&&n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1}(a,s.BAD_DELIMITERS)||-1<a.indexOf(r)||" "===a.charAt(0)||" "===a.charAt(a.length-1)?o+a+o:a}}};if(s.RECORD_SEP=String.fromCharCode(30),s.UNIT_SEP=String.fromCharCode(31),s.BYTE_ORDER_MARK="\ufeff",s.BAD_DELIMITERS=["\r","\n",'"',s.BYTE_ORDER_MARK],s.WORKERS_SUPPORTED=!n&&!!t.Worker,s.NODE_STREAM_INPUT=1,s.LocalChunkSize=10485760,s.RemoteChunkSize=5242880,s.DefaultDelimiter=",",s.Parser=f,s.ParserHandle=m,s.NetworkStreamer=c,s.FileStreamer=u,s.StringStreamer=d,s.ReadableStreamStreamer=p,t.jQuery){var o=t.jQuery;o.fn.parse=function(e){var n=e.config||{},a=[];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 r=0;r<this.files.length;r++)a.push({file:this.files[r],inputElem:this,instanceConfig:o.extend({},n)})})),r(),this;function r(){if(0!==a.length){var t,n,r,l=a[0];if(_(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,r=c.reason,void(_(e.error)&&e.error({name:"AbortError"},t,n,r));if("skip"===c.action)return void i();"object"==typeof c.config&&(l.instanceConfig=o.extend(l.instanceConfig,c.config))}else if("skip"===c)return void i()}var u=l.instanceConfig.complete;l.instanceConfig.complete=function(e){_(u)&&u(e,l.file,l.inputElem),i()},s.parse(l.file,l.instanceConfig)}else _(e.complete)&&e.complete()}function i(){a.splice(0,1),r()}}}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&&_(this._config.beforeFirstChunk)){var r=this._config.beforeFirstChunk(e);void 0!==r&&(e=r)}this.isFirstChunk=!1,this._halted=!1;var i=this._partialLine+e;this._partialLine="";var o=this._handle.parse(i,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=o.meta.cursor;this._finished||(this._partialLine=i.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(a)t.postMessage({results:o,workerId:s.WORKER_ID,finished:c});else if(_(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||!_(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){_(this._config.error)?this._config.error(e):a&&this._config.error&&t.postMessage({workerId:s.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=s.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=w(this._chunkLoaded,this),t.onerror=w(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var a in e)t.setRequestHeader(a,e[a])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+r)}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 u(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=s.LocalChunkSize),l.call(this,e);var a="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,a?((t=new FileReader).onload=w(this._chunkLoaded,this),t.onerror=w(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var r=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,r)}var i=t.readAsText(e,this._config.encoding);a||this._chunkLoaded({target:{result:i}})},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 d(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,a=!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(){a&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=w((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=w((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=w((function(){this._streamCleanUp(),a=!0,this._streamData("")}),this),this._streamCleanUp=w((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function m(e){var t,n,a,r=Math.pow(2,53),i=-r,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,u=0,d=0,p=!1,m=!1,g=[],v={data:[],errors:[],meta:{}};if(_(e.step)){var y=e.step;e.step=function(t){if(v=t,Z())E();else{if(E(),0===v.data.length)return;u+=t.data.length,e.preview&&u>e.preview?n.abort():(v.data=v.data[0],y(v,c))}}}function w(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function E(){if(v&&a&&(S("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),a=!1),e.skipEmptyLines)for(var t=0;t<v.data.length;t++)w(v.data[t])&&v.data.splice(t--,1);return Z()&&function(){if(v)if(Array.isArray(v.data[0])){for(var t=0;Z()&&t<v.data.length;t++)v.data[t].forEach(n);v.data.splice(0,1)}else v.data.forEach(n);function n(t,n){_(e.transformHeader)&&(t=e.transformHeader(t,n)),g.push(t)}}(),function(){if(!v||!e.header&&!e.dynamicTyping&&!e.transform)return v;function t(t,n){var a,r=e.header?{}:[];for(a=0;a<t.length;a++){var i=a,s=t[a];e.header&&(i=a>=g.length?"__parsed_extra":g[a]),e.transform&&(s=e.transform(s,i)),s=I(i,s),"__parsed_extra"===i?(r[i]=r[i]||[],r[i].push(s)):r[i]=s}return e.header&&(a>g.length?S("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+a,d+n):a<g.length&&S("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+a,d+n)),r}var n=1;return!v.data.length||Array.isArray(v.data[0])?(v.data=v.data.map(t),n=v.data.length):v.data=t(v.data,0),e.header&&v.meta&&(v.meta.fields=g),d+=n,v}()}function Z(){return e.header&&0===g.length}function I(t,n){return a=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[a]&&(e.dynamicTyping[a]=e.dynamicTypingFunction(a)),!0===(e.dynamicTyping[a]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(o.test(e)){var t=parseFloat(e);if(i<t&&t<r)return!0}return!1}(n)?parseFloat(n):l.test(n)?new Date(n):""===n?null:n):n;var a}function S(e,t,n,a){var r={type:e,code:t,message:n};void 0!==a&&(r.row=a),v.errors.push(r)}this.parse=function(r,i,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"),a=(e=e.replace(n,"")).split("\r"),r=e.split("\n"),i=1<r.length&&r[0].length<a[0].length;if(1===a.length||i)return"\n";for(var s=0,o=0;o<a.length;o++)"\n"===a[o][0]&&s++;return s>=a.length/2?"\r\n":"\r"}(r,l)),a=!1,e.delimiter)_(e.delimiter)&&(e.delimiter=e.delimiter(r),v.meta.delimiter=e.delimiter);else{var c=function(t,n,a,r,i){var o,l,c,u;i=i||[",","\t","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var d=0;d<i.length;d++){var p=i[d],m=0,h=0,g=0;c=void 0;for(var v=new f({comments:r,delimiter:p,newline:n,preview:10}).parse(t),y=0;y<v.data.length;y++)if(a&&w(v.data[y]))g++;else{var b=v.data[y].length;h+=b,void 0!==c?0<b&&(m+=Math.abs(b-c),c=b):c=b}0<v.data.length&&(h/=v.data.length-g),(void 0===l||m<=l)&&(void 0===u||u<h)&&1.99<h&&(l=m,o=p,u=h)}return{successful:!!(e.delimiter=o),bestDelimiter:o}}(r,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(a=!0,e.delimiter=s.DefaultDelimiter),v.meta.delimiter=e.delimiter}var u=b(e);return e.preview&&e.header&&u.preview++,t=r,n=new f(u),v=n.parse(t,i,o),E(),p?{meta:{paused:!0}}:v||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,n.abort(),t=_(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(p=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return m},this.abort=function(){m=!0,n.abort(),v.meta.aborted=!0,_(e.complete)&&e.complete(v),t=""}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function f(e){var t,n=(e=e||{}).delimiter,a=e.newline,r=e.comments,i=e.step,o=e.preview,l=e.fastMode,c=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof n||-1<s.BAD_DELIMITERS.indexOf(n))&&(n=","),r===n)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<s.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==a&&"\r"!==a&&"\r\n"!==a&&(a="\n");var u=0,d=!1;this.parse=function(e,s,p){if("string"!=typeof e)throw new Error("Input must be a string");var m=e.length,f=n.length,g=a.length,v=r.length,y=_(i),b=[],w=[],E=[],Z=u=0;if(!e)return M();if(l||!1!==l&&-1===e.indexOf(t)){for(var I=e.split(a),S=0;S<I.length;S++){if(E=I[S],u+=E.length,S!==I.length-1)u+=a.length;else if(p)return M();if(!r||E.substring(0,v)!==r){if(y){if(b=[],R(E.split(n)),L(),d)return M()}else R(E.split(n));if(o&&o<=S)return b=b.slice(0,o),M(!0)}}return M()}for(var k=e.indexOf(n,u),T=e.indexOf(a,u),C=new RegExp(h(c)+h(t),"g"),N=e.indexOf(t,u);;)if(e[u]!==t)if(r&&0===E.length&&e.substring(u,u+v)===r){if(-1===T)return M();u=T+g,T=e.indexOf(a,u),k=e.indexOf(n,u)}else if(-1!==k&&(k<T||-1===T))E.push(e.substring(u,k)),u=k+f,k=e.indexOf(n,u);else{if(-1===T)break;if(E.push(e.substring(u,T)),P(T+g),y&&(L(),d))return M();if(o&&b.length>=o)return M(!0)}else for(N=u,u++;;){if(-1===(N=e.indexOf(t,N+1)))return p||w.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:u}),A();if(N===m-1)return A(e.substring(u,N).replace(C,t));if(t!==c||e[N+1]!==c){if(t===c||0===N||e[N-1]!==c){-1!==k&&k<N+1&&(k=e.indexOf(n,N+1)),-1!==T&&T<N+1&&(T=e.indexOf(a,N+1));var D=O(-1===T?k:Math.min(k,T));if(e[N+1+D]===n){E.push(e.substring(u,N).replace(C,t)),e[u=N+1+D+f]!==t&&(N=e.indexOf(t,u)),k=e.indexOf(n,u),T=e.indexOf(a,u);break}var x=O(T);if(e.substring(N+1+x,N+1+x+g)===a){if(E.push(e.substring(u,N).replace(C,t)),P(N+1+x+g),k=e.indexOf(n,u),N=e.indexOf(t,u),y&&(L(),d))return M();if(o&&b.length>=o)return M(!0);break}w.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:b.length,index:u}),N++}}else N++}return A();function R(e){b.push(e),Z=u}function O(t){var n=0;if(-1!==t){var a=e.substring(N+1,t);a&&""===a.trim()&&(n=a.length)}return n}function A(t){return p||(void 0===t&&(t=e.substring(u)),E.push(t),u=m,R(E),y&&L()),M()}function P(t){u=t,R(E),E=[],T=e.indexOf(a,u)}function M(e){return{data:b,errors:w,meta:{delimiter:n,linebreak:a,aborted:d,truncated:!!e,cursor:Z+(s||0)}}}function L(){i(M()),b=[],w=[]}},this.abort=function(){d=!0},this.getCharIndex=function(){return u}}function g(e){var t=e.data,n=r[t.workerId],a=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var i={abort:function(){a=!0,v(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(_(n.userStep)){for(var s=0;s<t.results.data.length&&(n.userStep({data:t.results.data[s],errors:t.results.errors,meta:t.results.meta},i),!a);s++);delete t.results}else _(n.userChunk)&&(n.userChunk(t.results,i,t.file),delete t.results)}t.finished&&!a&&v(t.workerId,t.results)}function v(e,t){var n=r[e];_(n.userComplete)&&n.userComplete(t),n.terminate(),delete r[e]}function y(){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 w(e,t){return function(){e.apply(t,arguments)}}function _(e){return"function"==typeof e}return a&&(t.onmessage=function(e){var n=e.data;if(void 0===s.WORKER_ID&&n&&(s.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:s.WORKER_ID,results:s.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var a=s.parse(n.input,n.config);a&&t.postMessage({workerId:s.WORKER_ID,results:a,finished:!0})}}),(c.prototype=Object.create(l.prototype)).constructor=c,(u.prototype=Object.create(l.prototype)).constructor=u,(d.prototype=Object.create(d.prototype)).constructor=d,(p.prototype=Object.create(l.prototype)).constructor=p,s})?n.apply(t,[]):n)||(e.exports=a)},9198:function(e,t,n){!function(e,t,a,r,i,s,o,l,c,u,d,p,m,h,f,g,v,y,b,w,_,E,Z,I,S,k,T,C,N,D,x,R,O,A,P,M,L,F,q,$,U,V,j,W,Y,B,H,z,K,G,Q,X,J,ee,te,ne,ae,re,ie,se,oe,le,ce){"use strict";function ue(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var de=ue(t),pe=ue(r),me=ue(i),he=ue(s),fe=ue(o),ge=ue(l),ve=ue(c),ye=ue(u),be=ue(d),we=ue(p),_e=ue(m),Ee=ue(g),Ze=ue(v),Ie=ue(y),Se=ue(b),ke=ue(w),Te=ue(_),Ce=ue(E),Ne=ue(Z),De=ue(I),xe=ue(S),Re=ue(k),Oe=ue(T),Ae=ue(C),Pe=ue(N),Me=ue(D),Le=ue(x),Fe=ue(R),qe=ue(O),$e=ue(A),Ue=ue(P),Ve=ue(M),je=ue(L),We=ue(F),Ye=ue(q),Be=ue(U),He=ue(V),ze=ue(j),Ke=ue(W),Ge=ue(Y),Qe=ue(B),Xe=ue(H),Je=ue(G),et=ue(Q),tt=ue(X),nt=ue(J),at=ue(ee),rt=ue(te),it=ue(ne),st=ue(ae),ot=ue(re),lt=ue(ie),ct=ue(se),ut=ue(oe),dt=ue(le);function pt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function mt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pt(Object(n),!0).forEach((function(t){yt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ht(e){return(ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ft(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gt(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function vt(e,t,n){return t&&gt(e.prototype,t),n&&gt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bt(){return(bt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}function wt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&Et(e,t)}function _t(e){return(_t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Et(e,t){return(Et=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function It(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Zt(e)}function St(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,a=_t(e);if(t){var r=_t(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return It(this,n)}}function kt(e){return function(e){if(Array.isArray(e))return Tt(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 Tt(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)?Tt(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 Tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function Ct(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 Nt(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 Dt={p:Nt,P:function(e,t){var n,a=e.match(/(P+)(p+)?/)||[],r=a[1],i=a[2];if(!i)return Ct(e,t);switch(r){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}}",Ct(r,t)).replace("{{time}}",Nt(i,t))}},xt=12,Rt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;function Ot(e){var t=e?"string"==typeof e||e instanceof String?ct.default(e):ot.default(e):new Date;return Pt(t)?t:null}function At(e,t,n,a,r){var i=null,s=Jt(n)||Jt(Xt()),o=!0;return Array.isArray(t)?(t.forEach((function(t){var n=lt.default(e,t,new Date,{locale:s});a&&(o=Pt(n,r)&&e===fe.default(n,t,{awareOfUnicodeTokens:!0})),Pt(n,r)&&o&&(i=n)})),i):(i=lt.default(e,t,new Date,{locale:s}),a?o=Pt(i)&&e===fe.default(i,t,{awareOfUnicodeTokens:!0}):Pt(i)||(t=t.match(Rt).map((function(e){var t=e[0];return"p"===t||"P"===t?s?(0,Dt[t])(e,s.formatLong):t:e})).join(""),e.length>0&&(i=lt.default(e,t.slice(0,e.length),new Date)),Pt(i)||(i=new Date(e))),Pt(i)&&o?i:null)}function Pt(e,t){return t=t||new Date("1/1/1000"),he.default(e)&&!it.default(e,t)}function Mt(e,t,n){if("en"===n)return fe.default(e,t,{awareOfUnicodeTokens:!0});var a=Jt(n);return n&&!a&&console.warn('A locale object was not found for the provided string ["'.concat(n,'"].')),!a&&Xt()&&Jt(Xt())&&(a=Jt(Xt())),fe.default(e,t,{locale:a||null,awareOfUnicodeTokens:!0})}function Lt(e,t){var n=t.dateFormat,a=t.locale;return e&&Mt(e,Array.isArray(n)?n[0]:n,a)||""}function Ft(e,t){var n=t.hour,a=void 0===n?0:n,r=t.minute,i=void 0===r?0:r,s=t.second,o=void 0===s?0:s;return Fe.default(Le.default(Me.default(e,o),i),a)}function qt(e,t){var n=t&&Jt(t)||Xt()&&Jt(Xt());return xe.default(e,n?{locale:n}:null)}function $t(e,t){return Mt(e,"ddd",t)}function Ut(e){return He.default(e)}function Vt(e,t,n){var a=Jt(t||Xt());return ze.default(e,{locale:a,weekStartsOn:n})}function jt(e){return Ke.default(e)}function Wt(e){return Qe.default(e)}function Yt(e){return Ge.default(e)}function Bt(e,t){return e&&t?nt.default(e,t):!e&&!t}function Ht(e,t){return e&&t?tt.default(e,t):!e&&!t}function zt(e,t){return e&&t?at.default(e,t):!e&&!t}function Kt(e,t){return e&&t?et.default(e,t):!e&&!t}function Gt(e,t){return e&&t?Je.default(e,t):!e&&!t}function Qt(e,t,n){var a,r=He.default(t),i=Xe.default(n);try{a=st.default(e,{start:r,end:i})}catch(e){a=!1}return a}function Xt(){return("undefined"!=typeof window?window:n.g).__localeId__}function Jt(e){if("string"==typeof e){var t="undefined"!=typeof window?window:n.g;return t.__localeData__?t.__localeData__[e]:null}return e}function en(e,t){return Mt(qe.default(Ot(),e),"LLLL",t)}function tn(e,t){return Mt(qe.default(Ot(),e),"LLL",t)}function nn(e,t){return Mt($e.default(Ot(),e),"QQQ",t)}function an(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate,r=t.excludeDates,i=t.excludeDateIntervals,s=t.includeDates,o=t.includeDateIntervals,l=t.filterDate;return dn(e,{minDate:n,maxDate:a})||r&&r.some((function(t){return Kt(e,t)}))||i&&i.some((function(t){var n=t.start,a=t.end;return st.default(e,{start:n,end:a})}))||s&&!s.some((function(t){return Kt(e,t)}))||o&&!o.some((function(t){var n=t.start,a=t.end;return st.default(e,{start:n,end:a})}))||l&&!l(Ot(e))||!1}function rn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeDates,a=t.excludeDateIntervals;return a&&a.length>0?a.some((function(t){var n=t.start,a=t.end;return st.default(e,{start:n,end:a})})):n&&n.some((function(t){return Kt(e,t)}))||!1}function sn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate,r=t.excludeDates,i=t.includeDates,s=t.filterDate;return dn(e,{minDate:n,maxDate:a})||r&&r.some((function(t){return Ht(e,t)}))||i&&!i.some((function(t){return Ht(e,t)}))||s&&!s(Ot(e))||!1}function on(e,t,n,a){var r=Ae.default(e),i=Re.default(e),s=Ae.default(t),o=Re.default(t),l=Ae.default(a);return r===s&&r===l?i<=n&&n<=o:r<s?l===r&&i<=n||l===s&&o>=n||l<s&&l>r:void 0}function ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate,r=t.excludeDates,i=t.includeDates,s=t.filterDate;return dn(e,{minDate:n,maxDate:a})||r&&r.some((function(t){return zt(e,t)}))||i&&!i.some((function(t){return zt(e,t)}))||s&&!s(Ot(e))||!1}function cn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate;return dn(new Date(e,0,1),{minDate:n,maxDate:a})||!1}function un(e,t,n,a){var r=Ae.default(e),i=Oe.default(e),s=Ae.default(t),o=Oe.default(t),l=Ae.default(a);return r===s&&r===l?i<=n&&n<=o:r<s?l===r&&i<=n||l===s&&o>=n||l<s&&l>r:void 0}function dn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate;return n&&We.default(e,n)<0||a&&We.default(e,a)>0}function pn(e,t){return t.some((function(t){return Ce.default(t)===Ce.default(e)&&Te.default(t)===Te.default(e)}))}function mn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeTimes,a=t.includeTimes,r=t.filterTime;return n&&pn(e,n)||a&&!pn(e,a)||r&&!r(e)||!1}function hn(e,t){var n=t.minTime,a=t.maxTime;if(!n||!a)throw new Error("Both minTime and maxTime props required");var r,i=Ot(),s=Fe.default(Le.default(i,Te.default(e)),Ce.default(e)),o=Fe.default(Le.default(i,Te.default(n)),Ce.default(n)),l=Fe.default(Le.default(i,Te.default(a)),Ce.default(a));try{r=!st.default(s,{start:o,end:l})}catch(e){r=!1}return r}function fn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.includeDates,r=Ie.default(e,1);return n&&Ye.default(n,r)>0||a&&a.every((function(e){return Ye.default(e,r)>0}))||!1}function gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,a=t.includeDates,r=we.default(e,1);return n&&Ye.default(r,n)>0||a&&a.every((function(e){return Ye.default(r,e)>0}))||!1}function vn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.includeDates,r=Se.default(e,1);return n&&Be.default(n,r)>0||a&&a.every((function(e){return Be.default(e,r)>0}))||!1}function yn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,a=t.includeDates,r=_e.default(e,1);return n&&Be.default(r,n)>0||a&&a.every((function(e){return Be.default(r,e)>0}))||!1}function bn(e){var t=e.minDate,n=e.includeDates;if(n&&t){var a=n.filter((function(e){return We.default(e,t)>=0}));return Ve.default(a)}return n?Ve.default(n):t}function wn(e){var t=e.maxDate,n=e.includeDates;if(n&&t){var a=n.filter((function(e){return We.default(e,t)<=0}));return je.default(a)}return n?je.default(n):t}function _n(){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,a=0,r=e.length;a<r;a++){var i=e[a];if(me.default(i)){var s=Mt(i,"MM.dd.yyyy"),o=n.get(s)||[];o.includes(t)||(o.push(t),n.set(s,o))}else if("object"===ht(i)){var l=Object.keys(i),c=l[0],u=i[l[0]];if("string"==typeof c&&u.constructor===Array)for(var d=0,p=u.length;d<p;d++){var m=Mt(u[d],"MM.dd.yyyy"),h=n.get(m)||[];h.includes(c)||(h.push(c),n.set(m,h))}}}return n}function En(e,t,n,a,r){for(var i=r.length,s=[],o=0;o<i;o++){var l=ge.default(ve.default(e,Ce.default(r[o])),Te.default(r[o])),c=ge.default(e,(n+1)*a);rt.default(l,t)&&it.default(l,c)&&s.push(r[o])}return s}function Zn(e){return e<10?"0".concat(e):"".concat(e)}function In(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xt,n=Math.ceil(Ae.default(e)/t)*t;return{startPeriod:n-(t-1),endPeriod:n}}function Sn(e,t,n,a){for(var r=[],i=0;i<2*t+1;i++){var s=e+t-i,o=!0;n&&(o=Ae.default(n)<=s),a&&o&&(o=Ae.default(a)>=s),o&&r.push(s)}return r}var kn=function(e){wt(a,e);var n=St(a);function a(e){var r;ft(this,a),yt(Zt(r=n.call(this,e)),"renderOptions",(function(){var e=r.props.year,t=r.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:r.onChange.bind(Zt(r),t),"aria-selected":e===t?"true":void 0},e===t?de.default.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",t)})),n=r.props.minDate?Ae.default(r.props.minDate):null,a=r.props.maxDate?Ae.default(r.props.maxDate):null;return a&&r.state.yearsList.find((function(e){return e===a}))||t.unshift(de.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:r.incrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),n&&r.state.yearsList.find((function(e){return e===n}))||t.push(de.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:r.decrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t})),yt(Zt(r),"onChange",(function(e){r.props.onChange(e)})),yt(Zt(r),"handleClickOutside",(function(){r.props.onCancel()})),yt(Zt(r),"shiftYears",(function(e){var t=r.state.yearsList.map((function(t){return t+e}));r.setState({yearsList:t})})),yt(Zt(r),"incrementYears",(function(){return r.shiftYears(1)})),yt(Zt(r),"decrementYears",(function(){return r.shiftYears(-1)}));var i=e.yearDropdownItemNumber,s=e.scrollableYearDropdown,o=i||(s?10:5);return r.state={yearsList:Sn(r.props.year,o,r.props.minDate,r.props.maxDate)},r.dropdownRef=t.createRef(),r}return vt(a,[{key:"componentDidMount",value:function(){var e=this.dropdownRef.current;e&&(e.scrollTop=e.scrollHeight/2-e.clientHeight/2)}},{key:"render",value:function(){var e=pe.default({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return de.default.createElement("div",{className:e,ref:this.dropdownRef},this.renderOptions())}}]),a}(de.default.Component),Tn=ut.default(kn),Cn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{dropdownVisible:!1}),yt(Zt(e),"renderSelectOptions",(function(){for(var t=e.props.minDate?Ae.default(e.props.minDate):1900,n=e.props.maxDate?Ae.default(e.props.maxDate):2100,a=[],r=t;r<=n;r++)a.push(de.default.createElement("option",{key:r,value:r},r));return a})),yt(Zt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),yt(Zt(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:e.props.year,className:"react-datepicker__year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),yt(Zt(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))})),yt(Zt(e),"renderDropdown",(function(){return de.default.createElement(Tn,{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})})),yt(Zt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),yt(Zt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.year&&e.props.onChange(t)})),yt(Zt(e),"toggleDropdown",(function(t){e.setState({dropdownVisible:!e.state.dropdownVisible},(function(){e.props.adjustDateOnChange&&e.handleYearChange(e.props.date,t)}))})),yt(Zt(e),"handleYearChange",(function(t,n){e.onSelect(t,n),e.setOpen()})),yt(Zt(e),"onSelect",(function(t,n){e.props.onSelect&&e.props.onSelect(t,n)})),yt(Zt(e),"setOpen",(function(){e.props.setOpen&&e.props.setOpen(!0)})),e}return vt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return de.default.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component),Nn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"isSelectedMonth",(function(t){return e.props.month===t})),yt(Zt(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(Zt(e),n),"aria-selected":e.isSelectedMonth(n)?"true":void 0},e.isSelectedMonth(n)?de.default.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",t)}))})),yt(Zt(e),"onChange",(function(t){return e.props.onChange(t)})),yt(Zt(e),"handleClickOutside",(function(){return e.props.onCancel()})),e}return vt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__month-dropdown"},this.renderOptions())}}]),n}(de.default.Component),Dn=ut.default(Nn),xn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{dropdownVisible:!1}),yt(Zt(e),"renderSelectOptions",(function(e){return e.map((function(e,t){return de.default.createElement("option",{key:t,value:t},e)}))})),yt(Zt(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))})),yt(Zt(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]))})),yt(Zt(e),"renderDropdown",(function(t){return de.default.createElement(Dn,{key:"dropdown",month:e.props.month,monthNames:t,onChange:e.onChange,onCancel:e.toggleDropdown})})),yt(Zt(e),"renderScrollMode",(function(t){var n=e.state.dropdownVisible,a=[e.renderReadView(!n,t)];return n&&a.unshift(e.renderDropdown(t)),a})),yt(Zt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.month&&e.props.onChange(t)})),yt(Zt(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return vt(n,[{key:"render",value:function(){var e,t=this,n=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(e){return tn(e,t.props.locale)}:function(e){return en(e,t.props.locale)});switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode(n);break;case"select":e=this.renderSelectMode(n)}return 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 Rn(e,t){for(var n=[],a=jt(e),r=jt(t);!rt.default(a,r);)n.push(Ot(a)),a=we.default(a,1);return n}var On=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),yt(Zt(a=t.call(this,e)),"renderOptions",(function(){return a.state.monthYearsList.map((function(e){var t=Pe.default(e),n=Bt(a.props.date,e)&&Ht(a.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:a.onChange.bind(Zt(a),t),"aria-selected":n?"true":void 0},n?de.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Mt(e,a.props.dateFormat,a.props.locale))}))})),yt(Zt(a),"onChange",(function(e){return a.props.onChange(e)})),yt(Zt(a),"handleClickOutside",(function(){a.props.onCancel()})),a.state={monthYearsList:Rn(a.props.minDate,a.props.maxDate)},a}return vt(n,[{key:"render",value:function(){var e=pe.default({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return de.default.createElement("div",{className:e},this.renderOptions())}}]),n}(de.default.Component),An=ut.default(On),Pn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{dropdownVisible:!1}),yt(Zt(e),"renderSelectOptions",(function(){for(var t=jt(e.props.minDate),n=jt(e.props.maxDate),a=[];!rt.default(t,n);){var r=Pe.default(t);a.push(de.default.createElement("option",{key:r,value:r},Mt(t,e.props.dateFormat,e.props.locale))),t=we.default(t,1)}return a})),yt(Zt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),yt(Zt(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:Pe.default(jt(e.props.date)),className:"react-datepicker__month-year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),yt(Zt(e),"renderReadView",(function(t){var n=Mt(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))})),yt(Zt(e),"renderDropdown",(function(){return de.default.createElement(An,{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})})),yt(Zt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),yt(Zt(e),"onChange",(function(t){e.toggleDropdown();var n=Ot(parseInt(t));Bt(e.props.date,n)&&Ht(e.props.date,n)||e.props.onChange(n)})),yt(Zt(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return vt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return 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),Mn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"dayEl",de.default.createRef()),yt(Zt(e),"handleClick",(function(t){!e.isDisabled()&&e.props.onClick&&e.props.onClick(t)})),yt(Zt(e),"handleMouseEnter",(function(t){!e.isDisabled()&&e.props.onMouseEnter&&e.props.onMouseEnter(t)})),yt(Zt(e),"handleOnKeyDown",(function(t){" "===t.key&&(t.preventDefault(),t.key="Enter"),e.props.handleOnKeyDown(t)})),yt(Zt(e),"isSameDay",(function(t){return Kt(e.props.day,t)})),yt(Zt(e),"isKeyboardSelected",(function(){return!e.props.disabledKeyboardNavigation&&!e.isSameDay(e.props.selected)&&e.isSameDay(e.props.preSelection)})),yt(Zt(e),"isDisabled",(function(){return an(e.props.day,e.props)})),yt(Zt(e),"isExcluded",(function(){return rn(e.props.day,e.props)})),yt(Zt(e),"getHighLightedClass",(function(t){var n=e.props,a=n.day,r=n.highlightDates;if(!r)return!1;var i=Mt(a,"MM.dd.yyyy");return r.get(i)})),yt(Zt(e),"isInRange",(function(){var t=e.props,n=t.day,a=t.startDate,r=t.endDate;return!(!a||!r)&&Qt(n,a,r)})),yt(Zt(e),"isInSelectingRange",(function(){var t,n=e.props,a=n.day,r=n.selectsStart,i=n.selectsEnd,s=n.selectsRange,o=n.selectsDisabledDaysInRange,l=n.startDate,c=n.endDate,u=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return!(!(r||i||s)||!u||!o&&e.isDisabled())&&(r&&c&&(it.default(u,c)||Gt(u,c))?Qt(a,u,c):(i&&l&&(rt.default(u,l)||Gt(u,l))||!(!s||!l||c||!rt.default(u,l)&&!Gt(u,l)))&&Qt(a,l,u))})),yt(Zt(e),"isSelectingRangeStart",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,a=n.day,r=n.startDate,i=n.selectsStart,s=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Kt(a,i?s:r)})),yt(Zt(e),"isSelectingRangeEnd",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,a=n.day,r=n.endDate,i=n.selectsEnd,s=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Kt(a,i?s:r)})),yt(Zt(e),"isRangeStart",(function(){var t=e.props,n=t.day,a=t.startDate,r=t.endDate;return!(!a||!r)&&Kt(a,n)})),yt(Zt(e),"isRangeEnd",(function(){var t=e.props,n=t.day,a=t.startDate,r=t.endDate;return!(!a||!r)&&Kt(r,n)})),yt(Zt(e),"isWeekend",(function(){var t=Ne.default(e.props.day);return 0===t||6===t})),yt(Zt(e),"isAfterMonth",(function(){return void 0!==e.props.month&&(e.props.month+1)%12===Re.default(e.props.day)})),yt(Zt(e),"isBeforeMonth",(function(){return void 0!==e.props.month&&(Re.default(e.props.day)+1)%12===e.props.month})),yt(Zt(e),"isCurrentDay",(function(){return e.isSameDay(Ot())})),yt(Zt(e),"isSelected",(function(){return e.isSameDay(e.props.selected)})),yt(Zt(e),"getClassNames",(function(t){var n=e.props.dayClassName?e.props.dayClassName(t):void 0;return pe.default("react-datepicker__day",n,"react-datepicker__day--"+$t(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"))})),yt(Zt(e),"getAriaLabel",(function(){var t=e.props,n=t.day,a=t.ariaLabelPrefixWhenEnabled,r=void 0===a?"Choose":a,i=t.ariaLabelPrefixWhenDisabled,s=void 0===i?"Not available":i,o=e.isDisabled()||e.isExcluded()?s:r;return"".concat(o," ").concat(Mt(n,"PPPP",e.props.locale))})),yt(Zt(e),"getTabIndex",(function(t,n){var a=t||e.props.selected,r=n||e.props.preSelection;return e.isKeyboardSelected()||e.isSameDay(a)&&Kt(r,a)?0:-1})),yt(Zt(e),"handleFocusDay",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1;0===e.getTabIndex()&&!t.isInputFocused&&e.isSameDay(e.props.preSelection)&&(document.activeElement&&document.activeElement!==document.body||(n=!0),e.props.inline&&!e.props.shouldFocusDayInline&&(n=!1),e.props.containerRef&&e.props.containerRef.current&&e.props.containerRef.current.contains(document.activeElement)&&document.activeElement.classList.contains("react-datepicker__day")&&(n=!0)),n&&e.dayEl.current.focus({preventScroll:!0})})),yt(Zt(e),"renderDayContents",(function(){return e.props.monthShowsDuplicateDaysEnd&&e.isAfterMonth()||e.props.monthShowsDuplicateDaysStart&&e.isBeforeMonth()?null:e.props.renderDayContents?e.props.renderDayContents(De.default(e.props.day),e.props.day):De.default(e.props.day)})),yt(Zt(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:"button","aria-disabled":e.isDisabled(),"aria-current":e.isCurrentDay()?"date":void 0,"aria-selected":e.isSelected()?"true":void 0},e.renderDayContents())})),e}return vt(n,[{key:"componentDidMount",value:function(){this.handleFocusDay()}},{key:"componentDidUpdate",value:function(e){this.handleFocusDay(e)}}]),n}(de.default.Component),Ln=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"handleClick",(function(t){e.props.onClick&&e.props.onClick(t)})),e}return vt(n,[{key:"render",value:function(){var e=this.props,t=e.weekNumber,n=e.ariaLabelPrefix,a=void 0===n?"week ":n,r={"react-datepicker__week-number":!0,"react-datepicker__week-number--clickable":!!e.onClick};return de.default.createElement("div",{className:pe.default(r),"aria-label":"".concat(a," ").concat(this.props.weekNumber),onClick:this.handleClick},t)}}]),n}(de.default.Component),Fn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n)})),yt(Zt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),yt(Zt(e),"handleWeekClick",(function(t,n,a){"function"==typeof e.props.onWeekSelect&&e.props.onWeekSelect(t,n,a),e.props.shouldCloseOnSelect&&e.props.setOpen(!1)})),yt(Zt(e),"formatWeekNumber",(function(t){return e.props.formatWeekNumber?e.props.formatWeekNumber(t):qt(t)})),yt(Zt(e),"renderDays",(function(){var t=Vt(e.props.day,e.props.locale,e.props.calendarStartDay),n=[],a=e.formatWeekNumber(t);if(e.props.showWeekNumber){var r=e.props.onWeekSelect?e.handleWeekClick.bind(Zt(e),t,a):void 0;n.push(de.default.createElement(Ln,{key:"W",weekNumber:a,onClick:r,ariaLabelPrefix:e.props.ariaLabelPrefix}))}return n.concat([0,1,2,3,4,5,6].map((function(n){var a=ye.default(t,n);return de.default.createElement(Mn,{ariaLabelPrefixWhenEnabled:e.props.chooseDayAriaLabelPrefix,ariaLabelPrefixWhenDisabled:e.props.disabledDayAriaLabelPrefix,key:a.valueOf(),day:a,month:e.props.month,onClick:e.handleDayClick.bind(Zt(e),a),onMouseEnter:e.handleDayMouseEnter.bind(Zt(e),a),minDate:e.props.minDate,maxDate:e.props.maxDate,excludeDates:e.props.excludeDates,excludeDateIntervals:e.props.excludeDateIntervals,includeDates:e.props.includeDates,includeDateIntervals:e.props.includeDateIntervals,highlightDates:e.props.highlightDates,selectingDate:e.props.selectingDate,filterDate:e.props.filterDate,preSelection:e.props.preSelection,selected:e.props.selected,selectsStart:e.props.selectsStart,selectsEnd:e.props.selectsEnd,selectsRange:e.props.selectsRange,selectsDisabledDaysInRange:e.props.selectsDisabledDaysInRange,startDate:e.props.startDate,endDate:e.props.endDate,dayClassName:e.props.dayClassName,renderDayContents:e.props.renderDayContents,disabledKeyboardNavigation:e.props.disabledKeyboardNavigation,handleOnKeyDown:e.props.handleOnKeyDown,isInputFocused:e.props.isInputFocused,containerRef:e.props.containerRef,inline:e.props.inline,shouldFocusDayInline:e.props.shouldFocusDayInline,monthShowsDuplicateDaysEnd:e.props.monthShowsDuplicateDaysEnd,monthShowsDuplicateDaysStart:e.props.monthShowsDuplicateDaysStart,locale:e.props.locale})})))})),e}return vt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__week"},this.renderDays())}}],[{key:"defaultProps",get:function(){return{shouldCloseOnSelect:!0}}}]),n}(de.default.Component),qn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"MONTH_REFS",kt(Array(12)).map((function(){return de.default.createRef()}))),yt(Zt(e),"isDisabled",(function(t){return an(t,e.props)})),yt(Zt(e),"isExcluded",(function(t){return rn(t,e.props)})),yt(Zt(e),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n,e.props.orderInDisplay)})),yt(Zt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),yt(Zt(e),"handleMouseLeave",(function(){e.props.onMouseLeave&&e.props.onMouseLeave()})),yt(Zt(e),"isRangeStartMonth",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate;return!(!r||!i)&&Ht(qe.default(a,t),r)})),yt(Zt(e),"isRangeStartQuarter",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate;return!(!r||!i)&&zt($e.default(a,t),r)})),yt(Zt(e),"isRangeEndMonth",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate;return!(!r||!i)&&Ht(qe.default(a,t),i)})),yt(Zt(e),"isRangeEndQuarter",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate;return!(!r||!i)&&zt($e.default(a,t),i)})),yt(Zt(e),"isWeekInMonth",(function(t){var n=e.props.day,a=ye.default(t,6);return Ht(t,n)||Ht(a,n)})),yt(Zt(e),"isCurrentMonth",(function(e,t){return Ae.default(e)===Ae.default(Ot())&&t===Re.default(Ot())})),yt(Zt(e),"isSelectedMonth",(function(e,t,n){return Re.default(e)===t&&Ae.default(e)===Ae.default(n)})),yt(Zt(e),"isSelectedQuarter",(function(e,t,n){return Oe.default(e)===t&&Ae.default(e)===Ae.default(n)})),yt(Zt(e),"renderWeeks",(function(){for(var t=[],n=e.props.fixedHeight,a=0,r=!1,i=Vt(jt(e.props.day),e.props.locale,e.props.calendarStartDay);t.push(de.default.createElement(Fn,{ariaLabelPrefix:e.props.weekAriaLabelPrefix,chooseDayAriaLabelPrefix:e.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:e.props.disabledDayAriaLabelPrefix,key:a,day:i,month:Re.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})),!r;){a++,i=be.default(i,1);var s=n&&a>=6,o=!n&&!e.isWeekInMonth(i);if(s||o){if(!e.props.peekNextMonth)break;r=!0}}return t})),yt(Zt(e),"onMonthClick",(function(t,n){e.handleDayClick(jt(qe.default(e.props.day,n)),t)})),yt(Zt(e),"handleMonthNavigation",(function(t,n){e.isDisabled(n)||e.isExcluded(n)||(e.props.setPreSelection(n),e.MONTH_REFS[t].current&&e.MONTH_REFS[t].current.focus())})),yt(Zt(e),"onMonthKeyDown",(function(t,n){var a=t.key;if(!e.props.disabledKeyboardNavigation)switch(a){case"Enter":e.onMonthClick(t,n),e.props.setPreSelection(e.props.selected);break;case"ArrowRight":e.handleMonthNavigation(11===n?0:n+1,we.default(e.props.preSelection,1));break;case"ArrowLeft":e.handleMonthNavigation(0===n?11:n-1,Ie.default(e.props.preSelection,1))}})),yt(Zt(e),"onQuarterClick",(function(t,n){e.handleDayClick(Yt($e.default(e.props.day,n)),t)})),yt(Zt(e),"getMonthClassNames",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate,s=n.selected,o=n.minDate,l=n.maxDate,c=n.preSelection,u=n.monthClassName,d=u?u(a):void 0;return pe.default("react-datepicker__month-text","react-datepicker__month-".concat(t),d,{"react-datepicker__month--disabled":(o||l)&&sn(qe.default(a,t),e.props),"react-datepicker__month--selected":e.isSelectedMonth(a,t,s),"react-datepicker__month-text--keyboard-selected":Re.default(c)===t,"react-datepicker__month--in-range":on(r,i,t,a),"react-datepicker__month--range-start":e.isRangeStartMonth(t),"react-datepicker__month--range-end":e.isRangeEndMonth(t),"react-datepicker__month-text--today":e.isCurrentMonth(a,t)})})),yt(Zt(e),"getTabIndex",(function(t){var n=Re.default(e.props.preSelection);return e.props.disabledKeyboardNavigation||t!==n?"-1":"0"})),yt(Zt(e),"getAriaLabel",(function(t){var n=e.props,a=n.ariaLabelPrefix,r=void 0===a?"Choose":a,i=n.disabledDayAriaLabelPrefix,s=void 0===i?"Not available":i,o=n.day,l=qe.default(o,t),c=e.isDisabled(l)||e.isExcluded(l)?s:r;return"".concat(c," ").concat(Mt(l,"MMMM yyyy"))})),yt(Zt(e),"getQuarterClassNames",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate,s=n.selected,o=n.minDate,l=n.maxDate;return pe.default("react-datepicker__quarter-text","react-datepicker__quarter-".concat(t),{"react-datepicker__quarter--disabled":(o||l)&&ln($e.default(a,t),e.props),"react-datepicker__quarter--selected":e.isSelectedQuarter(a,t,s),"react-datepicker__quarter--in-range":un(r,i,t,a),"react-datepicker__quarter--range-start":e.isRangeStartQuarter(t),"react-datepicker__quarter--range-end":e.isRangeEndQuarter(t)})})),yt(Zt(e),"renderMonths",(function(){var t=e.props,n=t.showFullMonthYearPicker,a=t.showTwoColumnMonthYearPicker,r=t.showFourColumnMonthYearPicker,i=t.locale,s=t.day,o=t.selected;return(r?[[0,1,2,3],[4,5,6,7],[8,9,10,11]]:a?[[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,a){return de.default.createElement("div",{className:"react-datepicker__month-wrapper",key:a},t.map((function(t,a){return de.default.createElement("div",{ref:e.MONTH_REFS[t],key:a,onClick:function(n){e.onMonthClick(n,t)},onKeyDown:function(n){e.onMonthKeyDown(n,t)},tabIndex:e.getTabIndex(t),className:e.getMonthClassNames(t),role:"button","aria-label":e.getAriaLabel(t),"aria-current":e.isCurrentMonth(s,t)?"date":void 0,"aria-selected":e.isSelectedMonth(s,t,o)?"true":void 0},n?en(t,i):tn(t,i))})))}))})),yt(Zt(e),"renderQuarters",(function(){var t=e.props,n=t.day,a=t.selected;return de.default.createElement("div",{className:"react-datepicker__quarter-wrapper"},[1,2,3,4].map((function(t,r){return de.default.createElement("div",{key:r,onClick:function(n){e.onQuarterClick(n,t)},className:e.getQuarterClassNames(t),"aria-selected":e.isSelectedQuarter(n,t,a)?"true":void 0},nn(t,e.props.locale))})))})),yt(Zt(e),"getClassNames",(function(){var t=e.props;t.day;var n=t.selectingDate,a=t.selectsStart,r=t.selectsEnd,i=t.showMonthYearPicker,s=t.showQuarterYearPicker;return pe.default("react-datepicker__month",{"react-datepicker__month--selecting-range":n&&(a||r)},{"react-datepicker__monthPicker":i},{"react-datepicker__quarterPicker":s})})),e}return vt(n,[{key:"render",value:function(){var e=this.props,t=e.showMonthYearPicker,n=e.showQuarterYearPicker,a=e.day,r=e.ariaLabelPrefix,i=void 0===r?"month ":r;return de.default.createElement("div",{className:this.getClassNames(),onMouseLeave:this.handleMouseLeave,"aria-label":"".concat(i," ").concat(Mt(a,"yyyy-MM"))},t?this.renderMonths():n?this.renderQuarters():this.renderWeeks())}}]),n}(de.default.Component),$n=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{height:null}),yt(Zt(e),"handleClick",(function(t){(e.props.minTime||e.props.maxTime)&&hn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&mn(t,e.props)||e.props.onChange(t)})),yt(Zt(e),"isSelectedTime",(function(t,n,a){return e.props.selected&&n===Ce.default(t)&&a===Te.default(t)})),yt(Zt(e),"liClasses",(function(t,n,a){var r=["react-datepicker__time-list-item",e.props.timeClassName?e.props.timeClassName(t,n,a):void 0];return e.isSelectedTime(t,n,a)&&r.push("react-datepicker__time-list-item--selected"),((e.props.minTime||e.props.maxTime)&&hn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&mn(t,e.props))&&r.push("react-datepicker__time-list-item--disabled"),e.props.injectTimes&&(60*Ce.default(t)+Te.default(t))%e.props.intervals!=0&&r.push("react-datepicker__time-list-item--injected"),r.join(" ")})),yt(Zt(e),"handleOnKeyDown",(function(t,n){" "===t.key&&(t.preventDefault(),t.key="Enter"),"Enter"===t.key&&e.handleClick(n),e.props.handleOnKeyDown(t)})),yt(Zt(e),"renderTimes",(function(){for(var t=[],n=e.props.format?e.props.format:"p",a=e.props.intervals,r=Ut(Ot(e.props.selected)),i=1440/a,s=e.props.injectTimes&&e.props.injectTimes.sort((function(e,t){return e-t})),o=e.props.selected||e.props.openToDate||Ot(),l=Ce.default(o),c=Te.default(o),u=Fe.default(Le.default(r,c),l),d=0;d<i;d++){var p=ge.default(r,d*a);if(t.push(p),s){var m=En(r,p,d,a,s);t=t.concat(m)}}return t.map((function(t,a){return de.default.createElement("li",{key:a,onClick:e.handleClick.bind(Zt(e),t),className:e.liClasses(t,l,c),ref:function(n){(it.default(t,u)||Gt(t,u))&&(e.centerLi=n)},onKeyDown:function(n){e.handleOnKeyDown(n,t)},tabIndex:"0","aria-selected":e.isSelectedTime(t,l,c)?"true":void 0},Mt(t,n,e.props.locale))}))})),e}return vt(n,[{key:"componentDidMount",value:function(){this.list.scrollTop=n.calcCenterPosition(this.props.monthRef?this.props.monthRef.clientHeight-this.header.clientHeight:this.list.clientHeight,this.centerLi),this.props.monthRef&&this.header&&this.setState({height:this.props.monthRef.clientHeight-this.header.clientHeight})}},{key:"render",value:function(){var e=this,t=this.state.height;return 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);yt($n,"calcCenterPosition",(function(e,t){return t.offsetTop-(e/2-t.clientHeight/2)}));var Un=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),yt(Zt(a=t.call(this,e)),"YEAR_REFS",kt(Array(a.props.yearItemNumber)).map((function(){return de.default.createRef()}))),yt(Zt(a),"isDisabled",(function(e){return an(e,a.props)})),yt(Zt(a),"isExcluded",(function(e){return rn(e,a.props)})),yt(Zt(a),"updateFocusOnPaginate",(function(e){var t=function(){this.YEAR_REFS[e].current.focus()}.bind(Zt(a));window.requestAnimationFrame(t)})),yt(Zt(a),"handleYearClick",(function(e,t){a.props.onDayClick&&a.props.onDayClick(e,t)})),yt(Zt(a),"handleYearNavigation",(function(e,t){var n=a.props,r=n.date,i=n.yearItemNumber,s=In(r,i).startPeriod;a.isDisabled(t)||a.isExcluded(t)||(a.props.setPreSelection(t),e-s==-1?a.updateFocusOnPaginate(i-1):e-s===i?a.updateFocusOnPaginate(0):a.YEAR_REFS[e-s].current.focus())})),yt(Zt(a),"isSameDay",(function(e,t){return Kt(e,t)})),yt(Zt(a),"isCurrentYear",(function(e){return e===Ae.default(Ot())})),yt(Zt(a),"isKeyboardSelected",(function(e){var t=Wt(Ue.default(a.props.date,e));return!a.props.disabledKeyboardNavigation&&!a.props.inline&&!Kt(t,Wt(a.props.selected))&&Kt(t,Wt(a.props.preSelection))})),yt(Zt(a),"onYearClick",(function(e,t){var n=a.props.date;a.handleYearClick(Wt(Ue.default(n,t)),e)})),yt(Zt(a),"onYearKeyDown",(function(e,t){var n=e.key;if(!a.props.disabledKeyboardNavigation)switch(n){case"Enter":a.onYearClick(e,t),a.props.setPreSelection(a.props.selected);break;case"ArrowRight":a.handleYearNavigation(t+1,_e.default(a.props.preSelection,1));break;case"ArrowLeft":a.handleYearNavigation(t-1,Se.default(a.props.preSelection,1))}})),yt(Zt(a),"getYearClassNames",(function(e){var t=a.props,n=t.minDate,r=t.maxDate,i=t.selected;return pe.default("react-datepicker__year-text",{"react-datepicker__year-text--selected":e===Ae.default(i),"react-datepicker__year-text--disabled":(n||r)&&cn(e,a.props),"react-datepicker__year-text--keyboard-selected":a.isKeyboardSelected(e),"react-datepicker__year-text--today":a.isCurrentYear(e)})})),yt(Zt(a),"getYearTabIndex",(function(e){return a.props.disabledKeyboardNavigation?"-1":e===Ae.default(a.props.preSelection)?"0":"-1"})),a}return vt(n,[{key:"render",value:function(){for(var e=this,t=[],n=this.props,a=In(n.date,n.yearItemNumber),r=a.startPeriod,i=a.endPeriod,s=function(n){t.push(de.default.createElement("div",{ref:e.YEAR_REFS[n-r],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=r;o<=i;o++)s(o);return de.default.createElement("div",{className:"react-datepicker__year"},de.default.createElement("div",{className:"react-datepicker__year-wrapper"},t))}}]),n}(de.default.Component),Vn=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),yt(Zt(a=t.call(this,e)),"onTimeChange",(function(e){a.setState({time:e});var t=new Date;t.setHours(e.split(":")[0]),t.setMinutes(e.split(":")[1]),a.props.onChange(t)})),yt(Zt(a),"renderTimeInput",(function(){var e=a.state.time,t=a.props,n=t.date,r=t.timeString,i=t.customTimeInput;return i?de.default.cloneElement(i,{date:n,value:e,onChange:a.onTimeChange}):de.default.createElement("input",{type:"time",className:"react-datepicker-time__input",placeholder:"Time",name:"time-input",required:!0,value:e,onChange:function(e){a.onTimeChange(e.target.value||r)}})})),a.state={time:a.props.timeString},a}return vt(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 jn(e){var t=e.className,n=e.children,a=e.showPopperArrow,r=e.arrowProps,i=void 0===r?{}:r;return de.default.createElement("div",{className:t},a&&de.default.createElement("div",bt({className:"react-datepicker__triangle"},i)),n)}var Wn=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],Yn=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),yt(Zt(a=t.call(this,e)),"handleClickOutside",(function(e){a.props.onClickOutside(e)})),yt(Zt(a),"setClickOutsideRef",(function(){return a.containerRef.current})),yt(Zt(a),"handleDropdownFocus",(function(e){(function(){var e=((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).className||"").split(/\s+/);return Wn.some((function(t){return e.indexOf(t)>=0}))})(e.target)&&a.props.onDropdownFocus()})),yt(Zt(a),"getDateInView",(function(){var e=a.props,t=e.preSelection,n=e.selected,r=e.openToDate,i=bn(a.props),s=wn(a.props),o=Ot();return r||n||t||(i&&it.default(o,i)?i:s&&rt.default(o,s)?s:o)})),yt(Zt(a),"increaseMonth",(function(){a.setState((function(e){var t=e.date;return{date:we.default(t,1)}}),(function(){return a.handleMonthChange(a.state.date)}))})),yt(Zt(a),"decreaseMonth",(function(){a.setState((function(e){var t=e.date;return{date:Ie.default(t,1)}}),(function(){return a.handleMonthChange(a.state.date)}))})),yt(Zt(a),"handleDayClick",(function(e,t,n){a.props.onSelect(e,t,n),a.props.setPreSelection&&a.props.setPreSelection(e)})),yt(Zt(a),"handleDayMouseEnter",(function(e){a.setState({selectingDate:e}),a.props.onDayMouseEnter&&a.props.onDayMouseEnter(e)})),yt(Zt(a),"handleMonthMouseLeave",(function(){a.setState({selectingDate:null}),a.props.onMonthMouseLeave&&a.props.onMonthMouseLeave()})),yt(Zt(a),"handleYearChange",(function(e){a.props.onYearChange&&a.props.onYearChange(e),a.props.adjustDateOnChange&&(a.props.onSelect&&a.props.onSelect(e),a.props.setOpen&&a.props.setOpen(!0)),a.props.setPreSelection&&a.props.setPreSelection(e)})),yt(Zt(a),"handleMonthChange",(function(e){a.props.onMonthChange&&a.props.onMonthChange(e),a.props.adjustDateOnChange&&(a.props.onSelect&&a.props.onSelect(e),a.props.setOpen&&a.props.setOpen(!0)),a.props.setPreSelection&&a.props.setPreSelection(e)})),yt(Zt(a),"handleMonthYearChange",(function(e){a.handleYearChange(e),a.handleMonthChange(e)})),yt(Zt(a),"changeYear",(function(e){a.setState((function(t){var n=t.date;return{date:Ue.default(n,e)}}),(function(){return a.handleYearChange(a.state.date)}))})),yt(Zt(a),"changeMonth",(function(e){a.setState((function(t){var n=t.date;return{date:qe.default(n,e)}}),(function(){return a.handleMonthChange(a.state.date)}))})),yt(Zt(a),"changeMonthYear",(function(e){a.setState((function(t){var n=t.date;return{date:Ue.default(qe.default(n,Re.default(e)),Ae.default(e))}}),(function(){return a.handleMonthYearChange(a.state.date)}))})),yt(Zt(a),"header",(function(){var e=Vt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.state.date,a.props.locale,a.props.calendarStartDay),t=[];return a.props.showWeekNumbers&&t.push(de.default.createElement("div",{key:"W",className:"react-datepicker__day-name"},a.props.weekLabel||"#")),t.concat([0,1,2,3,4,5,6].map((function(t){var n=ye.default(e,t),r=a.formatWeekday(n,a.props.locale),i=a.props.weekDayClassName?a.props.weekDayClassName(n):void 0;return de.default.createElement("div",{key:t,className:pe.default("react-datepicker__day-name",i)},r)})))})),yt(Zt(a),"formatWeekday",(function(e,t){return a.props.formatWeekDay?function(e,t,n){return t(Mt(e,"EEEE",n))}(e,a.props.formatWeekDay,t):a.props.useWeekdaysShort?function(e,t){return Mt(e,"EEE",t)}(e,t):function(e,t){return Mt(e,"EEEEEE",t)}(e,t)})),yt(Zt(a),"decreaseYear",(function(){a.setState((function(e){var t=e.date;return{date:Se.default(t,a.props.showYearPicker?a.props.yearItemNumber:1)}}),(function(){return a.handleYearChange(a.state.date)}))})),yt(Zt(a),"renderPreviousButton",(function(){if(!a.props.renderCustomHeader){var e;switch(!0){case a.props.showMonthYearPicker:e=vn(a.state.date,a.props);break;case a.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.yearItemNumber,r=void 0===a?xt:a,i=In(Wt(Se.default(e,r)),r).endPeriod,s=n&&Ae.default(n);return s&&s>i||!1}(a.state.date,a.props);break;default:e=fn(a.state.date,a.props)}if((a.props.forceShowMonthNavigation||a.props.showDisabledMonthNavigation||!e)&&!a.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--previous"],n=a.decreaseMonth;(a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker)&&(n=a.decreaseYear),e&&a.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--previous--disabled"),n=null);var r=a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker,i=a.props,s=i.previousMonthButtonLabel,o=i.previousYearButtonLabel,l=a.props,c=l.previousMonthAriaLabel,u=void 0===c?"string"==typeof s?s:"Previous Month":c,d=l.previousYearAriaLabel,p=void 0===d?"string"==typeof o?o:"Previous Year":d;return de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:a.props.handleOnKeyDown,"aria-label":r?p:u},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"].join(" ")},r?a.props.previousYearButtonLabel:a.props.previousMonthButtonLabel))}}})),yt(Zt(a),"increaseYear",(function(){a.setState((function(e){var t=e.date;return{date:_e.default(t,a.props.showYearPicker?a.props.yearItemNumber:1)}}),(function(){return a.handleYearChange(a.state.date)}))})),yt(Zt(a),"renderNextButton",(function(){if(!a.props.renderCustomHeader){var e;switch(!0){case a.props.showMonthYearPicker:e=yn(a.state.date,a.props);break;case a.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,a=t.yearItemNumber,r=void 0===a?xt:a,i=In(_e.default(e,r),r).startPeriod,s=n&&Ae.default(n);return s&&s<i||!1}(a.state.date,a.props);break;default:e=gn(a.state.date,a.props)}if((a.props.forceShowMonthNavigation||a.props.showDisabledMonthNavigation||!e)&&!a.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--next"];a.props.showTimeSelect&&t.push("react-datepicker__navigation--next--with-time"),a.props.todayButton&&t.push("react-datepicker__navigation--next--with-today-button");var n=a.increaseMonth;(a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker)&&(n=a.increaseYear),e&&a.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--next--disabled"),n=null);var r=a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker,i=a.props,s=i.nextMonthButtonLabel,o=i.nextYearButtonLabel,l=a.props,c=l.nextMonthAriaLabel,u=void 0===c?"string"==typeof s?s:"Next Month":c,d=l.nextYearAriaLabel,p=void 0===d?"string"==typeof o?o:"Next Year":d;return de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:a.props.handleOnKeyDown,"aria-label":r?p:u},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"].join(" ")},r?a.props.nextYearButtonLabel:a.props.nextMonthButtonLabel))}}})),yt(Zt(a),"renderCurrentMonth",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.state.date,t=["react-datepicker__current-month"];return a.props.showYearDropdown&&t.push("react-datepicker__current-month--hasYearDropdown"),a.props.showMonthDropdown&&t.push("react-datepicker__current-month--hasMonthDropdown"),a.props.showMonthYearDropdown&&t.push("react-datepicker__current-month--hasMonthYearDropdown"),de.default.createElement("div",{className:t.join(" ")},Mt(e,a.props.dateFormat,a.props.locale))})),yt(Zt(a),"renderYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showYearDropdown&&!e)return de.default.createElement(Cn,{adjustDateOnChange:a.props.adjustDateOnChange,date:a.state.date,onSelect:a.props.onSelect,setOpen:a.props.setOpen,dropdownMode:a.props.dropdownMode,onChange:a.changeYear,minDate:a.props.minDate,maxDate:a.props.maxDate,year:Ae.default(a.state.date),scrollableYearDropdown:a.props.scrollableYearDropdown,yearDropdownItemNumber:a.props.yearDropdownItemNumber})})),yt(Zt(a),"renderMonthDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showMonthDropdown&&!e)return de.default.createElement(xn,{dropdownMode:a.props.dropdownMode,locale:a.props.locale,onChange:a.changeMonth,month:Re.default(a.state.date),useShortMonthInDropdown:a.props.useShortMonthInDropdown})})),yt(Zt(a),"renderMonthYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showMonthYearDropdown&&!e)return de.default.createElement(Pn,{dropdownMode:a.props.dropdownMode,locale:a.props.locale,dateFormat:a.props.dateFormat,onChange:a.changeMonthYear,minDate:a.props.minDate,maxDate:a.props.maxDate,date:a.state.date,scrollableMonthYearDropdown:a.props.scrollableMonthYearDropdown})})),yt(Zt(a),"renderTodayButton",(function(){if(a.props.todayButton&&!a.props.showTimeSelectOnly)return de.default.createElement("div",{className:"react-datepicker__today-button",onClick:function(e){return a.props.onSelect(He.default(Ot()),e)}},a.props.todayButton)})),yt(Zt(a),"renderDefaultHeader",(function(e){var t=e.monthDate,n=e.i;return de.default.createElement("div",{className:"react-datepicker__header ".concat(a.props.showTimeSelect?"react-datepicker__header--has-time-select":"")},a.renderCurrentMonth(t),de.default.createElement("div",{className:"react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(a.props.dropdownMode),onFocus:a.handleDropdownFocus},a.renderMonthDropdown(0!==n),a.renderMonthYearDropdown(0!==n),a.renderYearDropdown(0!==n)),de.default.createElement("div",{className:"react-datepicker__day-names"},a.header(t)))})),yt(Zt(a),"renderCustomHeader",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.monthDate,n=e.i;if(a.props.showTimeSelect&&!a.state.monthContainer||a.props.showTimeSelectOnly)return null;var r=fn(a.state.date,a.props),i=gn(a.state.date,a.props),s=vn(a.state.date,a.props),o=yn(a.state.date,a.props),l=!a.props.showMonthYearPicker&&!a.props.showQuarterYearPicker&&!a.props.showYearPicker;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:a.props.onDropdownFocus},a.props.renderCustomHeader(mt(mt({},a.state),{},{customHeaderCount:n,monthDate:t,changeMonth:a.changeMonth,changeYear:a.changeYear,decreaseMonth:a.decreaseMonth,increaseMonth:a.increaseMonth,decreaseYear:a.decreaseYear,increaseYear:a.increaseYear,prevMonthButtonDisabled:r,nextMonthButtonDisabled:i,prevYearButtonDisabled:s,nextYearButtonDisabled:o})),l&&de.default.createElement("div",{className:"react-datepicker__day-names"},a.header(t)))})),yt(Zt(a),"renderYearHeader",(function(){var e=a.state.date,t=a.props,n=t.showYearPicker,r=In(e,t.yearItemNumber),i=r.startPeriod,s=r.endPeriod;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},n?"".concat(i," - ").concat(s):Ae.default(e))})),yt(Zt(a),"renderHeader",(function(e){switch(!0){case void 0!==a.props.renderCustomHeader:return a.renderCustomHeader(e);case a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker:return a.renderYearHeader(e);default:return a.renderDefaultHeader(e)}})),yt(Zt(a),"renderMonths",(function(){if(!a.props.showTimeSelectOnly&&!a.props.showYearPicker){for(var e=[],t=a.props.showPreviousMonths?a.props.monthsShown-1:0,n=Ie.default(a.state.date,t),r=0;r<a.props.monthsShown;++r){var i=r-a.props.monthSelectedIn,s=we.default(n,i),o="month-".concat(r),l=r<a.props.monthsShown-1,c=r>0;e.push(de.default.createElement("div",{key:o,ref:function(e){a.monthContainer=e},className:"react-datepicker__month-container"},a.renderHeader({monthDate:s,i:r}),de.default.createElement(qn,{chooseDayAriaLabelPrefix:a.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:a.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:a.props.weekAriaLabelPrefix,onChange:a.changeMonthYear,day:s,dayClassName:a.props.dayClassName,calendarStartDay:a.props.calendarStartDay,monthClassName:a.props.monthClassName,onDayClick:a.handleDayClick,handleOnKeyDown:a.props.handleOnDayKeyDown,onDayMouseEnter:a.handleDayMouseEnter,onMouseLeave:a.handleMonthMouseLeave,onWeekSelect:a.props.onWeekSelect,orderInDisplay:r,formatWeekNumber:a.props.formatWeekNumber,locale:a.props.locale,minDate:a.props.minDate,maxDate:a.props.maxDate,excludeDates:a.props.excludeDates,excludeDateIntervals:a.props.excludeDateIntervals,highlightDates:a.props.highlightDates,selectingDate:a.state.selectingDate,includeDates:a.props.includeDates,includeDateIntervals:a.props.includeDateIntervals,inline:a.props.inline,shouldFocusDayInline:a.props.shouldFocusDayInline,fixedHeight:a.props.fixedHeight,filterDate:a.props.filterDate,preSelection:a.props.preSelection,setPreSelection:a.props.setPreSelection,selected:a.props.selected,selectsStart:a.props.selectsStart,selectsEnd:a.props.selectsEnd,selectsRange:a.props.selectsRange,selectsDisabledDaysInRange:a.props.selectsDisabledDaysInRange,showWeekNumbers:a.props.showWeekNumbers,startDate:a.props.startDate,endDate:a.props.endDate,peekNextMonth:a.props.peekNextMonth,setOpen:a.props.setOpen,shouldCloseOnSelect:a.props.shouldCloseOnSelect,renderDayContents:a.props.renderDayContents,disabledKeyboardNavigation:a.props.disabledKeyboardNavigation,showMonthYearPicker:a.props.showMonthYearPicker,showFullMonthYearPicker:a.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:a.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:a.props.showFourColumnMonthYearPicker,showYearPicker:a.props.showYearPicker,showQuarterYearPicker:a.props.showQuarterYearPicker,isInputFocused:a.props.isInputFocused,containerRef:a.containerRef,monthShowsDuplicateDaysEnd:l,monthShowsDuplicateDaysStart:c})))}return e}})),yt(Zt(a),"renderYears",(function(){if(!a.props.showTimeSelectOnly)return a.props.showYearPicker?de.default.createElement("div",{className:"react-datepicker__year--container"},a.renderHeader(),de.default.createElement(Un,bt({onDayClick:a.handleDayClick,date:a.state.date},a.props))):void 0})),yt(Zt(a),"renderTimeSection",(function(){if(a.props.showTimeSelect&&(a.state.monthContainer||a.props.showTimeSelectOnly))return de.default.createElement($n,{selected:a.props.selected,openToDate:a.props.openToDate,onChange:a.props.onTimeChange,timeClassName:a.props.timeClassName,format:a.props.timeFormat,includeTimes:a.props.includeTimes,intervals:a.props.timeIntervals,minTime:a.props.minTime,maxTime:a.props.maxTime,excludeTimes:a.props.excludeTimes,filterTime:a.props.filterTime,timeCaption:a.props.timeCaption,todayButton:a.props.todayButton,showMonthDropdown:a.props.showMonthDropdown,showMonthYearDropdown:a.props.showMonthYearDropdown,showYearDropdown:a.props.showYearDropdown,withPortal:a.props.withPortal,monthRef:a.state.monthContainer,injectTimes:a.props.injectTimes,locale:a.props.locale,handleOnKeyDown:a.props.handleOnKeyDown,showTimeSelectOnly:a.props.showTimeSelectOnly})})),yt(Zt(a),"renderInputTimeSection",(function(){var e=new Date(a.props.selected),t=Pt(e)&&Boolean(a.props.selected)?"".concat(Zn(e.getHours()),":").concat(Zn(e.getMinutes())):"";if(a.props.showTimeInput)return de.default.createElement(Vn,{date:e,timeString:t,timeInputLabel:a.props.timeInputLabel,onChange:a.props.onTimeChange,customTimeInput:a.props.customTimeInput})})),a.containerRef=de.default.createRef(),a.state={date:a.getDateInView(),selectingDate:null,monthContainer:null},a}return vt(n,[{key:"componentDidMount",value:function(){this.props.showTimeSelect&&(this.assignMonthContainer=void this.setState({monthContainer:this.monthContainer}))}},{key:"componentDidUpdate",value:function(e){this.props.preSelection&&!Kt(this.props.preSelection,e.preSelection)?this.setState({date:this.props.preSelection}):this.props.openToDate&&!Kt(this.props.openToDate,e.openToDate)&&this.setState({date:this.props.openToDate})}},{key:"render",value:function(){var e=this.props.container||jn;return de.default.createElement("div",{ref:this.containerRef},de.default.createElement(e,{className:pe.default("react-datepicker",this.props.className,{"react-datepicker--time-only":this.props.showTimeSelectOnly}),showPopperArrow:this.props.showPopperArrow,arrowProps:this.props.arrowProps},this.renderPreviousButton(),this.renderNextButton(),this.renderMonths(),this.renderYears(),this.renderTodayButton(),this.renderTimeSection(),this.renderInputTimeSection(),this.props.children))}}],[{key:"defaultProps",get:function(){return{onDropdownFocus:function(){},monthsShown:1,monthSelectedIn:0,forceShowMonthNavigation:!1,timeCaption:"Time",previousYearButtonLabel:"Previous Year",nextYearButtonLabel:"Next Year",previousMonthButtonLabel:"Previous Month",nextMonthButtonLabel:"Next Month",customTimeInput:null,yearItemNumber:xt}}}]),n}(de.default.Component),Bn=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),(a=t.call(this,e)).el=document.createElement("div"),a}return vt(n,[{key:"componentDidMount",value:function(){this.portalRoot=(this.props.portalHost||document).getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement("div"),this.portalRoot.setAttribute("id",this.props.portalId),(this.props.portalHost||document.body).appendChild(this.portalRoot)),this.portalRoot.appendChild(this.el)}},{key:"componentWillUnmount",value:function(){this.portalRoot.removeChild(this.el)}},{key:"render",value:function(){return dt.default.createPortal(this.props.children,this.el)}}]),n}(de.default.Component),Hn=function(e){return!e.disabled&&-1!==e.tabIndex},zn=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),yt(Zt(a=t.call(this,e)),"getTabChildren",(function(){return Array.prototype.slice.call(a.tabLoopRef.current.querySelectorAll("[tabindex], a, button, input, select, textarea"),1,-1).filter(Hn)})),yt(Zt(a),"handleFocusStart",(function(e){var t=a.getTabChildren();t&&t.length>1&&t[t.length-1].focus()})),yt(Zt(a),"handleFocusEnd",(function(e){var t=a.getTabChildren();t&&t.length>1&&t[0].focus()})),a.tabLoopRef=de.default.createRef(),a}return vt(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),Kn=function(e){wt(n,e);var t=St(n);function n(){return ft(this,n),t.apply(this,arguments)}return vt(n,[{key:"render",value:function(){var e,t=this.props,n=t.className,a=t.wrapperClassName,r=t.hidePopper,i=t.popperComponent,s=t.popperModifiers,o=t.popperPlacement,l=t.popperProps,c=t.targetComponent,u=t.enableTabLoop,d=t.popperOnKeyDown,p=t.portalId,m=t.portalHost;if(!r){var h=pe.default("react-datepicker-popper",n);e=de.default.createElement(ce.Popper,bt({modifiers:s,placement:o},l),(function(e){var t=e.ref,n=e.style,a=e.placement,r=e.arrowProps;return de.default.createElement(zn,{enableTabLoop:u},de.default.createElement("div",{ref:t,style:n,className:h,"data-placement":a,onKeyDown:d},de.default.cloneElement(i,{arrowProps:r})))}))}this.props.popperContainer&&(e=de.default.createElement(this.props.popperContainer,{},e)),p&&!r&&(e=de.default.createElement(Bn,{portalId:p,portalHost:m},e));var f=pe.default("react-datepicker-wrapper",a);return de.default.createElement(ce.Manager,{className:"react-datepicker-manager"},de.default.createElement(ce.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),Gn="react-datepicker-ignore-onclickoutside",Qn=ut.default(Yn),Xn="Date input not valid.",Jn=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),yt(Zt(a=t.call(this,e)),"getPreSelection",(function(){return a.props.openToDate?a.props.openToDate:a.props.selectsEnd&&a.props.startDate?a.props.startDate:a.props.selectsStart&&a.props.endDate?a.props.endDate:Ot()})),yt(Zt(a),"calcInitialState",(function(){var e,t=a.getPreSelection(),n=bn(a.props),r=wn(a.props),i=n&&it.default(t,He.default(n))?n:r&&rt.default(t,Xe.default(r))?r:t;return{open:a.props.startOpen||!1,preventFocus:!1,preSelection:null!==(e=a.props.selectsRange?a.props.startDate:a.props.selected)&&void 0!==e?e:i,highlightDates:_n(a.props.highlightDates),focused:!1,shouldFocusDayInline:!1}})),yt(Zt(a),"clearPreventFocusTimeout",(function(){a.preventFocusTimeout&&clearTimeout(a.preventFocusTimeout)})),yt(Zt(a),"setFocus",(function(){a.input&&a.input.focus&&a.input.focus({preventScroll:!0})})),yt(Zt(a),"setBlur",(function(){a.input&&a.input.blur&&a.input.blur(),a.cancelFocusInput()})),yt(Zt(a),"setOpen",(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];a.setState({open:e,preSelection:e&&a.state.open?a.state.preSelection:a.calcInitialState().preSelection,lastPreSelectChange:ta},(function(){e||a.setState((function(e){return{focused:!!t&&e.focused}}),(function(){!t&&a.setBlur(),a.setState({inputValue:null})}))}))})),yt(Zt(a),"inputOk",(function(){return me.default(a.state.preSelection)})),yt(Zt(a),"isCalendarOpen",(function(){return void 0===a.props.open?a.state.open&&!a.props.disabled&&!a.props.readOnly:a.props.open})),yt(Zt(a),"handleFocus",(function(e){a.state.preventFocus||(a.props.onFocus(e),a.props.preventOpenOnFocus||a.props.readOnly||a.setOpen(!0)),a.setState({focused:!0})})),yt(Zt(a),"cancelFocusInput",(function(){clearTimeout(a.inputFocusTimeout),a.inputFocusTimeout=null})),yt(Zt(a),"deferFocusInput",(function(){a.cancelFocusInput(),a.inputFocusTimeout=setTimeout((function(){return a.setFocus()}),1)})),yt(Zt(a),"handleDropdownFocus",(function(){a.cancelFocusInput()})),yt(Zt(a),"handleBlur",(function(e){(!a.state.open||a.props.withPortal||a.props.showTimeInput)&&a.props.onBlur(e),a.setState({focused:!1})})),yt(Zt(a),"handleCalendarClickOutside",(function(e){a.props.inline||a.setOpen(!1),a.props.onClickOutside(e),a.props.withPortal&&e.preventDefault()})),yt(Zt(a),"handleChange",(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0];if(!a.props.onChangeRaw||(a.props.onChangeRaw.apply(Zt(a),t),"function"==typeof r.isDefaultPrevented&&!r.isDefaultPrevented())){a.setState({inputValue:r.target.value,lastPreSelectChange:ea});var i=At(r.target.value,a.props.dateFormat,a.props.locale,a.props.strictParsing,a.props.minDate);!i&&r.target.value||a.setSelected(i,r,!0)}})),yt(Zt(a),"handleSelect",(function(e,t,n){if(a.setState({preventFocus:!0},(function(){return a.preventFocusTimeout=setTimeout((function(){return a.setState({preventFocus:!1})}),50),a.preventFocusTimeout})),a.props.onChangeRaw&&a.props.onChangeRaw(t),a.setSelected(e,t,!1,n),!a.props.shouldCloseOnSelect||a.props.showTimeSelect)a.setPreSelection(e);else if(!a.props.inline){a.props.selectsRange||a.setOpen(!1);var r=a.props,i=r.startDate,s=r.endDate;!i||s||it.default(e,i)||a.setOpen(!1)}})),yt(Zt(a),"setSelected",(function(e,t,n,r){var i=e;if(null===i||!an(i,a.props)){var s=a.props,o=s.onChange,l=s.selectsRange,c=s.startDate,u=s.endDate;if(!Gt(a.props.selected,i)||a.props.allowSameDay||l)if(null!==i&&(!a.props.selected||n&&(a.props.showTimeSelect||a.props.showTimeSelectOnly||a.props.showTimeInput)||(i=Ft(i,{hour:Ce.default(a.props.selected),minute:Te.default(a.props.selected),second:ke.default(a.props.selected)})),a.props.inline||a.setState({preSelection:i}),a.props.focusSelectedMonth||a.setState({monthSelectedIn:r})),l){var d=c&&u;c||u?c&&!u&&(it.default(i,c)?o([i,null],t):o([c,i],t)):o([i,null],t),d&&o([i,null],t)}else o(i,t);n||(a.props.onSelect(i,t),a.setState({inputValue:null}))}})),yt(Zt(a),"setPreSelection",(function(e){var t=void 0!==a.props.minDate,n=void 0!==a.props.maxDate,r=!0;if(e){var i=He.default(e);if(t&&n)r=Qt(e,a.props.minDate,a.props.maxDate);else if(t){var s=He.default(a.props.minDate);r=rt.default(e,s)||Gt(i,s)}else if(n){var o=Xe.default(a.props.maxDate);r=it.default(e,o)||Gt(i,o)}}r&&a.setState({preSelection:e})})),yt(Zt(a),"handleTimeChange",(function(e){var t=Ft(a.props.selected?a.props.selected:a.getPreSelection(),{hour:Ce.default(e),minute:Te.default(e)});a.setState({preSelection:t}),a.props.onChange(t),a.props.shouldCloseOnSelect&&a.setOpen(!1),a.props.showTimeInput&&a.setOpen(!0),a.setState({inputValue:null})})),yt(Zt(a),"onInputClick",(function(){a.props.disabled||a.props.readOnly||a.setOpen(!0),a.props.onInputClick()})),yt(Zt(a),"onInputKeyDown",(function(e){a.props.onKeyDown(e);var t=e.key;if(a.state.open||a.props.inline||a.props.preventOpenOnFocus){if(a.state.open){if("ArrowDown"===t||"ArrowUp"===t){e.preventDefault();var n=a.calendar.componentNode&&a.calendar.componentNode.querySelector('.react-datepicker__day[tabindex="0"]');return void(n&&n.focus({preventScroll:!0}))}var r=Ot(a.state.preSelection);"Enter"===t?(e.preventDefault(),a.inputOk()&&a.state.lastPreSelectChange===ta?(a.handleSelect(r,e),!a.props.shouldCloseOnSelect&&a.setPreSelection(r)):a.setOpen(!1)):"Escape"===t&&(e.preventDefault(),a.setOpen(!1)),a.inputOk()||a.props.onInputError({code:1,msg:Xn})}}else"ArrowDown"!==t&&"ArrowUp"!==t&&"Enter"!==t||a.onInputClick()})),yt(Zt(a),"onDayKeyDown",(function(e){a.props.onKeyDown(e);var t=e.key,n=Ot(a.state.preSelection);if("Enter"===t)e.preventDefault(),a.handleSelect(n,e),!a.props.shouldCloseOnSelect&&a.setPreSelection(n);else if("Escape"===t)e.preventDefault(),a.setOpen(!1),a.inputOk()||a.props.onInputError({code:1,msg:Xn});else if(!a.props.disabledKeyboardNavigation){var r;switch(t){case"ArrowLeft":r=Ee.default(n,1);break;case"ArrowRight":r=ye.default(n,1);break;case"ArrowUp":r=Ze.default(n,1);break;case"ArrowDown":r=be.default(n,1);break;case"PageUp":r=Ie.default(n,1);break;case"PageDown":r=we.default(n,1);break;case"Home":r=Se.default(n,1);break;case"End":r=_e.default(n,1)}if(!r)return void(a.props.onInputError&&a.props.onInputError({code:1,msg:Xn}));if(e.preventDefault(),a.setState({lastPreSelectChange:ta}),a.props.adjustDateOnChange&&a.setSelected(r),a.setPreSelection(r),a.props.inline){var i=Re.default(n),s=Re.default(r),o=Ae.default(n),l=Ae.default(r);i!==s||o!==l?a.setState({shouldFocusDayInline:!0}):a.setState({shouldFocusDayInline:!1})}}})),yt(Zt(a),"onPopperKeyDown",(function(e){"Escape"===e.key&&(e.preventDefault(),a.setState({preventFocus:!0},(function(){a.setOpen(!1),setTimeout((function(){a.setFocus(),a.setState({preventFocus:!1})}))})))})),yt(Zt(a),"onClearClick",(function(e){e&&e.preventDefault&&e.preventDefault(),a.props.selectsRange?a.props.onChange([null,null],e):a.props.onChange(null,e),a.setState({inputValue:null})})),yt(Zt(a),"clear",(function(){a.onClearClick()})),yt(Zt(a),"onScroll",(function(e){"boolean"==typeof a.props.closeOnScroll&&a.props.closeOnScroll?e.target!==document&&e.target!==document.documentElement&&e.target!==document.body||a.setOpen(!1):"function"==typeof a.props.closeOnScroll&&a.props.closeOnScroll(e)&&a.setOpen(!1)})),yt(Zt(a),"renderCalendar",(function(){return a.props.inline||a.isCalendarOpen()?de.default.createElement(Qn,{ref:function(e){a.calendar=e},locale:a.props.locale,calendarStartDay:a.props.calendarStartDay,chooseDayAriaLabelPrefix:a.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:a.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:a.props.weekAriaLabelPrefix,adjustDateOnChange:a.props.adjustDateOnChange,setOpen:a.setOpen,shouldCloseOnSelect:a.props.shouldCloseOnSelect,dateFormat:a.props.dateFormatCalendar,useWeekdaysShort:a.props.useWeekdaysShort,formatWeekDay:a.props.formatWeekDay,dropdownMode:a.props.dropdownMode,selected:a.props.selected,preSelection:a.state.preSelection,onSelect:a.handleSelect,onWeekSelect:a.props.onWeekSelect,openToDate:a.props.openToDate,minDate:a.props.minDate,maxDate:a.props.maxDate,selectsStart:a.props.selectsStart,selectsEnd:a.props.selectsEnd,selectsRange:a.props.selectsRange,startDate:a.props.startDate,endDate:a.props.endDate,excludeDates:a.props.excludeDates,excludeDateIntervals:a.props.excludeDateIntervals,filterDate:a.props.filterDate,onClickOutside:a.handleCalendarClickOutside,formatWeekNumber:a.props.formatWeekNumber,highlightDates:a.state.highlightDates,includeDates:a.props.includeDates,includeDateIntervals:a.props.includeDateIntervals,includeTimes:a.props.includeTimes,injectTimes:a.props.injectTimes,inline:a.props.inline,shouldFocusDayInline:a.state.shouldFocusDayInline,peekNextMonth:a.props.peekNextMonth,showMonthDropdown:a.props.showMonthDropdown,showPreviousMonths:a.props.showPreviousMonths,useShortMonthInDropdown:a.props.useShortMonthInDropdown,showMonthYearDropdown:a.props.showMonthYearDropdown,showWeekNumbers:a.props.showWeekNumbers,showYearDropdown:a.props.showYearDropdown,withPortal:a.props.withPortal,forceShowMonthNavigation:a.props.forceShowMonthNavigation,showDisabledMonthNavigation:a.props.showDisabledMonthNavigation,scrollableYearDropdown:a.props.scrollableYearDropdown,scrollableMonthYearDropdown:a.props.scrollableMonthYearDropdown,todayButton:a.props.todayButton,weekLabel:a.props.weekLabel,outsideClickIgnoreClass:Gn,fixedHeight:a.props.fixedHeight,monthsShown:a.props.monthsShown,monthSelectedIn:a.state.monthSelectedIn,onDropdownFocus:a.handleDropdownFocus,onMonthChange:a.props.onMonthChange,onYearChange:a.props.onYearChange,dayClassName:a.props.dayClassName,weekDayClassName:a.props.weekDayClassName,monthClassName:a.props.monthClassName,timeClassName:a.props.timeClassName,showTimeSelect:a.props.showTimeSelect,showTimeSelectOnly:a.props.showTimeSelectOnly,onTimeChange:a.handleTimeChange,timeFormat:a.props.timeFormat,timeIntervals:a.props.timeIntervals,minTime:a.props.minTime,maxTime:a.props.maxTime,excludeTimes:a.props.excludeTimes,filterTime:a.props.filterTime,timeCaption:a.props.timeCaption,className:a.props.calendarClassName,container:a.props.calendarContainer,yearItemNumber:a.props.yearItemNumber,yearDropdownItemNumber:a.props.yearDropdownItemNumber,previousMonthAriaLabel:a.props.previousMonthAriaLabel,previousMonthButtonLabel:a.props.previousMonthButtonLabel,nextMonthAriaLabel:a.props.nextMonthAriaLabel,nextMonthButtonLabel:a.props.nextMonthButtonLabel,previousYearAriaLabel:a.props.previousYearAriaLabel,previousYearButtonLabel:a.props.previousYearButtonLabel,nextYearAriaLabel:a.props.nextYearAriaLabel,nextYearButtonLabel:a.props.nextYearButtonLabel,timeInputLabel:a.props.timeInputLabel,disabledKeyboardNavigation:a.props.disabledKeyboardNavigation,renderCustomHeader:a.props.renderCustomHeader,popperProps:a.props.popperProps,renderDayContents:a.props.renderDayContents,onDayMouseEnter:a.props.onDayMouseEnter,onMonthMouseLeave:a.props.onMonthMouseLeave,selectsDisabledDaysInRange:a.props.selectsDisabledDaysInRange,showTimeInput:a.props.showTimeInput,showMonthYearPicker:a.props.showMonthYearPicker,showFullMonthYearPicker:a.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:a.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:a.props.showFourColumnMonthYearPicker,showYearPicker:a.props.showYearPicker,showQuarterYearPicker:a.props.showQuarterYearPicker,showPopperArrow:a.props.showPopperArrow,excludeScrollbar:a.props.excludeScrollbar,handleOnKeyDown:a.props.onKeyDown,handleOnDayKeyDown:a.onDayKeyDown,isInputFocused:a.state.focused,customTimeInput:a.props.customTimeInput,setPreSelection:a.setPreSelection},a.props.children):null})),yt(Zt(a),"renderDateInput",(function(){var e,t=pe.default(a.props.className,yt({},Gn,a.state.open)),n=a.props.customInput||de.default.createElement("input",{type:"text"}),r=a.props.customInputRef||"ref",i="string"==typeof a.props.value?a.props.value:"string"==typeof a.state.inputValue?a.state.inputValue:a.props.selectsRange?function(e,t,n){if(!e)return"";var a=Lt(e,n),r=t?Lt(t,n):"";return"".concat(a," - ").concat(r)}(a.props.startDate,a.props.endDate,a.props):Lt(a.props.selected,a.props);return de.default.cloneElement(n,(yt(e={},r,(function(e){a.input=e})),yt(e,"value",i),yt(e,"onBlur",a.handleBlur),yt(e,"onChange",a.handleChange),yt(e,"onClick",a.onInputClick),yt(e,"onFocus",a.handleFocus),yt(e,"onKeyDown",a.onInputKeyDown),yt(e,"id",a.props.id),yt(e,"name",a.props.name),yt(e,"autoFocus",a.props.autoFocus),yt(e,"placeholder",a.props.placeholderText),yt(e,"disabled",a.props.disabled),yt(e,"autoComplete",a.props.autoComplete),yt(e,"className",pe.default(n.props.className,t)),yt(e,"title",a.props.title),yt(e,"readOnly",a.props.readOnly),yt(e,"required",a.props.required),yt(e,"tabIndex",a.props.tabIndex),yt(e,"aria-describedby",a.props.ariaDescribedBy),yt(e,"aria-invalid",a.props.ariaInvalid),yt(e,"aria-labelledby",a.props.ariaLabelledBy),yt(e,"aria-required",a.props.ariaRequired),e))})),yt(Zt(a),"renderClearButton",(function(){var e=a.props,t=e.isClearable,n=e.selected,r=e.startDate,i=e.endDate,s=e.clearButtonTitle,o=e.clearButtonClassName,l=void 0===o?"":o,c=e.ariaLabelClose,u=void 0===c?"Close":c;return!t||null==n&&null==r&&null==i?null:de.default.createElement("button",{type:"button",className:"react-datepicker__close-icon ".concat(l).trim(),"aria-label":u,onClick:a.onClearClick,title:s,tabIndex:-1})})),a.state=a.calcInitialState(),a}return vt(n,[{key:"componentDidMount",value:function(){window.addEventListener("scroll",this.onScroll,!0)}},{key:"componentDidUpdate",value:function(e,t){var n,a;e.inline&&(n=e.selected,a=this.props.selected,n&&a?Re.default(n)!==Re.default(a)||Ae.default(n)!==Ae.default(a):n!==a)&&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:_n(this.props.highlightDates)}),t.focused||Gt(e.selected,this.props.selected)||this.setState({inputValue:null}),t.open!==this.state.open&&(!1===t.open&&!0===this.state.open&&this.props.onCalendarOpen(),!0===t.open&&!1===this.state.open&&this.props.onCalendarClose())}},{key:"componentWillUnmount",value:function(){this.clearPreventFocusTimeout(),window.removeEventListener("scroll",this.onScroll,!0)}},{key:"renderInputContainer",value:function(){return 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(Bn,{portalId:this.props.portalId,portalHost:this.props.portalHost},t)),de.default.createElement("div",null,this.renderInputContainer(),t)}return de.default.createElement(Kn,{className:this.props.popperClassName,wrapperClassName:this.props.wrapperClassName,hidePopper:!this.isCalendarOpen(),portalId:this.props.portalId,portalHost:this.props.portalHost,popperModifiers:this.props.popperModifiers,targetComponent:this.renderInputContainer(),popperContainer:this.props.popperContainer,popperComponent:e,popperPlacement:this.props.popperPlacement,popperProps:this.props.popperProps,popperOnKeyDown:this.onPopperKeyDown,enableTabLoop:this.props.enableTabLoop})}}],[{key:"defaultProps",get:function(){return{allowSameDay:!1,dateFormat:"MM/dd/yyyy",dateFormatCalendar:"LLLL yyyy",onChange:function(){},disabled:!1,disabledKeyboardNavigation:!1,dropdownMode:"scroll",onFocus:function(){},onBlur:function(){},onKeyDown:function(){},onInputClick:function(){},onSelect:function(){},onClickOutside:function(){},onMonthChange:function(){},onCalendarOpen:function(){},onCalendarClose:function(){},preventOpenOnFocus:!1,onYearChange:function(){},onInputError:function(){},monthsShown:1,readOnly:!1,withPortal:!1,selectsDisabledDaysInRange:!1,shouldCloseOnSelect:!0,showTimeSelect:!1,showTimeInput:!1,showPreviousMonths:!1,showMonthYearPicker:!1,showFullMonthYearPicker:!1,showTwoColumnMonthYearPicker:!1,showFourColumnMonthYearPicker:!1,showYearPicker:!1,showQuarterYearPicker:!1,strictParsing:!1,timeIntervals:30,timeCaption:"Time",previousMonthAriaLabel:"Previous Month",previousMonthButtonLabel:"Previous Month",nextMonthAriaLabel:"Next Month",nextMonthButtonLabel:"Next Month",previousYearAriaLabel:"Previous Year",previousYearButtonLabel:"Previous Year",nextYearAriaLabel:"Next Year",nextYearButtonLabel:"Next Year",timeInputLabel:"Time",enableTabLoop:!0,yearItemNumber:xt,renderDayContents:function(e){return e},focusSelectedMonth:!1,showPopperArrow:!0,excludeScrollbar:!0,customTimeInput:null,calendarStartDay:void 0}}}]),n}(de.default.Component),ea="input",ta="navigate";e.CalendarContainer=jn,e.default=Jn,e.getDefaultLocale=Xt,e.registerLocale=function(e,t){var a="undefined"!=typeof window?window:n.g;a.__localeData__||(a.__localeData__={}),a.__localeData__[e]=t},e.setDefaultLocale=function(e){("undefined"!=typeof window?window:n.g).__localeId__=e},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(45993),n(45697),n(89457),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(97846),n(48934))},69590:function(e){var t="undefined"!=typeof Element,n="function"==typeof Map,a="function"==typeof Set,r="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function i(e,s){if(e===s)return!0;if(e&&s&&"object"==typeof e&&"object"==typeof s){if(e.constructor!==s.constructor)return!1;var o,l,c,u;if(Array.isArray(e)){if((o=e.length)!=s.length)return!1;for(l=o;0!=l--;)if(!i(e[l],s[l]))return!1;return!0}if(n&&e instanceof Map&&s instanceof Map){if(e.size!==s.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!s.has(l.value[0]))return!1;for(u=e.entries();!(l=u.next()).done;)if(!i(l.value[1],s.get(l.value[0])))return!1;return!0}if(a&&e instanceof Set&&s instanceof Set){if(e.size!==s.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!s.has(l.value[0]))return!1;return!0}if(r&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(s)){if((o=e.length)!=s.length)return!1;for(l=o;0!=l--;)if(e[l]!==s[l])return!1;return!0}if(e.constructor===RegExp)return e.source===s.source&&e.flags===s.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===s.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===s.toString();if((o=(c=Object.keys(e)).length)!==Object.keys(s).length)return!1;for(l=o;0!=l--;)if(!Object.prototype.hasOwnProperty.call(s,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)&&!i(e[c[l]],s[c[l]]))return!1;return!0}return e!=e&&s!=s}e.exports=function(e,t){try{return i(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 a=n(45993),r=n(97846);function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(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,u=(void 0===l&&(l=0),function(){return++l}),d={},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 a;return(a=n.call(this,e)||this).__outsideClickHandler=function(e){if("function"!=typeof a.__clickOutsideHandlerProp){var t=a.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 a.__clickOutsideHandlerProp(e)},a.__getComponentNode=function(){var e=a.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():(0,r.findDOMNode)(e)},a.enableOnClickOutside=function(){if("undefined"!=typeof document&&!p[a._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[a._uid]=!0;var e=a.props.eventTypes;e.forEach||(e=[e]),d[a._uid]=function(e){var t;null!==a.componentNode&&(a.props.preventDefault&&e.preventDefault(),a.props.stopPropagation&&e.stopPropagation(),a.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,a.componentNode,a.props.outsideClickIgnoreClass)===document&&a.__outsideClickHandler(e))},e.forEach((function(e){document.addEventListener(e,d[a._uid],f(s(a),e))}))}},a.disableOnClickOutside=function(){delete p[a._uid];var e=d[a._uid];if(e&&"undefined"!=typeof document){var t=a.props.eventTypes;t.forEach||(t=[t]),t.forEach((function(t){return document.removeEventListener(t,e,f(s(a),t))})),delete d[a._uid]}},a.getRef=function(e){return a.instanceRef=e},a._uid=u(),a}h=n,(l=g).prototype=Object.create(h.prototype),l.prototype.constructor=l,i(l,h);var v=g.prototype;return v.getInstance=function(){if(e.prototype&&!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},v.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(t&&"function"==typeof t.handleClickOutside&&(this.__clickOutsideHandlerProp=t.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw new Error("WrappedComponent: "+m+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},v.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},v.componentWillUnmount=function(){this.disableOnClickOutside()},v.render=function(){var t=this.props;t.excludeScrollbar;var n=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(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,a.createElement)(e,n)},g}(a.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 s},Popper:function(){return w},Reference:function(){return Z},usePopper:function(){return g}});var a=n(45993),r=a.createContext(),i=a.createContext();function s(e){var t=e.children,n=a.useState(null),s=n[0],o=n[1],l=a.useRef(!1);a.useEffect((function(){return function(){l.current=!0}}),[]);var c=a.useCallback((function(e){l.current||o(e)}),[]);return a.createElement(r.Provider,{value:s},a.createElement(i.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),a=1;a<t;a++)n[a-1]=arguments[a];return e.apply(void 0,n)}},c=function(e,t){if("function"==typeof e)return l(e,t);null!=e&&(e.current=t)},u=function(e){return e.reduce((function(e,t){var n=t[0],a=t[1];return e[n]=a,e}),{})},d="undefined"!=typeof window&&window.document&&window.document.createElement?a.useLayoutEffect:a.useEffect,p=n(17211),m=n(69590),h=n.n(m),f=[],g=function(e,t,n){void 0===n&&(n={});var r=a.useRef(null),i={onFirstUpdate:n.onFirstUpdate,placement:n.placement||"bottom",strategy:n.strategy||"absolute",modifiers:n.modifiers||f},s=a.useState({styles:{popper:{position:i.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),o=s[0],l=s[1],c=a.useMemo((function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(e){var t=e.state,n=Object.keys(t.elements);l({styles:u(n.map((function(e){return[e,t.styles[e]||{}]}))),attributes:u(n.map((function(e){return[e,t.attributes[e]]})))})},requires:["computeStyles"]}}),[]),m=a.useMemo((function(){var e={onFirstUpdate:i.onFirstUpdate,placement:i.placement,strategy:i.strategy,modifiers:[].concat(i.modifiers,[c,{name:"applyStyles",enabled:!1}])};return h()(r.current,e)?r.current||e:(r.current=e,e)}),[i.onFirstUpdate,i.placement,i.strategy,i.modifiers,c]),g=a.useRef();return d((function(){g.current&&g.current.setOptions(m)}),[m]),d((function(){if(null!=e&&null!=t){var a=(n.createPopper||p.fi)(e,t,m);return g.current=a,function(){a.destroy(),g.current=null}}}),[e,t,n.createPopper]),{state:g.current?g.current.state:null,styles:o.styles,attributes:o.attributes,update:g.current?g.current.update:null,forceUpdate:g.current?g.current.forceUpdate:null}},v=function(){},y=function(){return Promise.resolve(null)},b=[];function w(e){var t=e.placement,n=void 0===t?"bottom":t,i=e.strategy,s=void 0===i?"absolute":i,l=e.modifiers,u=void 0===l?b:l,d=e.referenceElement,p=e.onFirstUpdate,m=e.innerRef,h=e.children,f=a.useContext(r),w=a.useState(null),_=w[0],E=w[1],Z=a.useState(null),I=Z[0],S=Z[1];a.useEffect((function(){c(m,_)}),[m,_]);var k=a.useMemo((function(){return{placement:n,strategy:s,onFirstUpdate:p,modifiers:[].concat(u,[{name:"arrow",enabled:null!=I,options:{element:I}}])}}),[n,s,p,u,I]),T=g(d||f,_,k),C=T.state,N=T.styles,D=T.forceUpdate,x=T.update,R=a.useMemo((function(){return{ref:E,style:N.popper,placement:C?C.placement:n,hasPopperEscaped:C&&C.modifiersData.hide?C.modifiersData.hide.hasPopperEscaped:null,isReferenceHidden:C&&C.modifiersData.hide?C.modifiersData.hide.isReferenceHidden:null,arrowProps:{style:N.arrow,ref:S},forceUpdate:D||v,update:x||y}}),[E,S,n,C,N,x,D]);return o(h)(R)}var _=n(42473),E=n.n(_);function Z(e){var t=e.children,n=e.innerRef,r=a.useContext(i),s=a.useCallback((function(e){c(n,e),l(r,e)}),[n,r]);return a.useEffect((function(){return function(){return c(n,null)}})),a.useEffect((function(){E()(Boolean(r),"`Reference` should not be used outside of a `Manager` component.")}),[r]),o(t)({ref:s})}},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 a,r,i;r=[n(65311)],void 0===(i="function"==typeof(a=function(t){var n=function(){if(t&&t.fn&&t.fn.select2&&t.fn.select2.amd)var n=t.fn.select2.amd;var a,r,i,s;return n&&n.requirejs||(n?r=n:n={},function(e){var t,n,s,o,l={},c={},u={},d={},p=Object.prototype.hasOwnProperty,m=[].slice,h=/\.js$/;function f(e,t){return p.call(e,t)}function g(e,t){var n,a,r,i,s,o,l,c,d,p,m,f=t&&t.split("/"),g=u.map,v=g&&g["*"]||{};if(e){for(s=(e=e.split("/")).length-1,u.nodeIdCompat&&h.test(e[s])&&(e[s]=e[s].replace(h,"")),"."===e[0].charAt(0)&&f&&(e=f.slice(0,f.length-1).concat(e)),d=0;d<e.length;d++)if("."===(m=e[d]))e.splice(d,1),d-=1;else if(".."===m){if(0===d||1===d&&".."===e[2]||".."===e[d-1])continue;d>0&&(e.splice(d-1,2),d-=2)}e=e.join("/")}if((f||v)&&g){for(d=(n=e.split("/")).length;d>0;d-=1){if(a=n.slice(0,d).join("/"),f)for(p=f.length;p>0;p-=1)if((r=g[f.slice(0,p).join("/")])&&(r=r[a])){i=r,o=d;break}if(i)break;!l&&v&&v[a]&&(l=v[a],c=d)}!i&&l&&(i=l,o=c),i&&(n.splice(0,o,i),e=n.join("/"))}return e}function v(t,a){return function(){var r=m.call(arguments,0);return"string"!=typeof r[0]&&1===r.length&&r.push(null),n.apply(e,r.concat([t,a]))}}function y(e){return function(t){l[e]=t}}function b(n){if(f(c,n)){var a=c[n];delete c[n],d[n]=!0,t.apply(e,a)}if(!f(l,n)&&!f(d,n))throw new Error("No "+n);return l[n]}function w(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function _(e){return e?w(e):[]}function E(e){return function(){return u&&u.config&&u.config[e]||{}}}s=function(e,t){var n,a,r=w(e),i=r[0],s=t[1];return e=r[1],i&&(n=b(i=g(i,s))),i?e=n&&n.normalize?n.normalize(e,(a=s,function(e){return g(e,a)})):g(e,s):(i=(r=w(e=g(e,s)))[0],e=r[1],i&&(n=b(i))),{f:i?i+"!"+e:e,n:e,pr:i,p:n}},o={require:function(e){return v(e)},exports:function(e){var t=l[e];return void 0!==t?t:l[e]={}},module:function(e){return{id:e,uri:"",exports:l[e],config:E(e)}}},t=function(t,n,a,r){var i,u,p,m,h,g,w,E=[],Z=typeof a;if(g=_(r=r||t),"undefined"===Z||"function"===Z){for(n=!n.length&&a.length?["require","exports","module"]:n,h=0;h<n.length;h+=1)if("require"===(u=(m=s(n[h],g)).f))E[h]=o.require(t);else if("exports"===u)E[h]=o.exports(t),w=!0;else if("module"===u)i=E[h]=o.module(t);else if(f(l,u)||f(c,u)||f(d,u))E[h]=b(u);else{if(!m.p)throw new Error(t+" missing "+u);m.p.load(m.n,v(r,!0),y(u),{}),E[h]=l[u]}p=a?a.apply(l[t],E):void 0,t&&(i&&i.exports!==e&&i.exports!==l[t]?l[t]=i.exports:p===e&&w||(l[t]=p))}else t&&(l[t]=a)},a=r=n=function(a,r,i,l,c){if("string"==typeof a)return o[a]?o[a](r):b(s(a,_(r)).f);if(!a.splice){if((u=a).deps&&n(u.deps,u.callback),!r)return;r.splice?(a=r,r=i,i=null):a=e}return r=r||function(){},"function"==typeof i&&(i=l,l=c),l?t(e,a,r,i):setTimeout((function(){t(e,a,r,i)}),4),n},n.config=function(e){return n(e)},a._defined=l,(i=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=a,n.require=r,n.define=i),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 a in t)"function"==typeof t[a]&&"constructor"!==a&&n.push(a);return n}t.Extend=function(e,t){var n={}.hasOwnProperty;function a(){this.constructor=e}for(var r in t)n.call(t,r)&&(e[r]=t[r]);return a.prototype=t.prototype,e.prototype=new a,e.__super__=t.prototype,e},t.Decorate=function(e,t){var a=n(t),r=n(e);function i(){var n=Array.prototype.unshift,a=t.prototype.constructor.length,r=e.prototype.constructor;a>0&&(n.call(arguments,e.prototype.constructor),r=t.prototype.constructor),r.apply(this,arguments)}t.displayName=e.displayName,i.prototype=new function(){this.constructor=i};for(var s=0;s<r.length;s++){var o=r[s];i.prototype[o]=e.prototype[o]}for(var l=function(e){var n=function(){};e in i.prototype&&(n=i.prototype[e]);var a=t.prototype[e];return function(){return Array.prototype.unshift.call(arguments,n),a.apply(this,arguments)}},c=0;c<a.length;c++){var u=a[c];i.prototype[u]=l(u)}return i};var a=function(){this.listeners={}};a.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},a.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)},a.prototype.invoke=function(e,t){for(var n=0,a=e.length;n<a;n++)e[n].apply(this,t)},t.Observable=a,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("-"),a=e;if(1!==n.length){for(var r=0;r<n.length;r++){var i=n[r];(i=i.substring(0,1).toLowerCase()+i.substring(1))in a||(a[i]={}),r==n.length-1&&(a[i]=e[t]),a=a[i]}delete e[t]}}return e},t.hasScroll=function(t,n){var a=e(n),r=n.style.overflowX,i=n.style.overflowY;return(r!==i||"hidden"!==i&&"visible"!==i)&&("scroll"===r||"scroll"===i||a.innerHeight()<n.scrollHeight||a.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 r=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-"+(++r).toString()+"-"+t.generateChars(4),e.setAttribute("data-select2-id",n)),n},t.StoreData=function(e,n,a){var r=t.GetUniqueElementId(e);t.__cache[r]||(t.__cache[r]={}),t.__cache[r][n]=a},t.GetData=function(n,a){var r=t.GetUniqueElementId(n);return a?t.__cache[r]&&null!=t.__cache[r][a]?t.__cache[r][a]:e(n).data(a):t.__cache[r]},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 a=t.getAttribute("class").trim().split(/\s+/);a=a.filter((function(e){return 0!==e.indexOf("select2-")}));var r=n.concat(a);e.setAttribute("class",r.join(" "))},t})),n.define("select2/results",["jquery","./utils"],(function(e,t){function n(e,t,a){this.$element=e,this.data=a,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 a=e('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),r=this.options.get("translations").get(t.message);a.append(n(r(t.args))),a[0].className+=" select2-results__message",this.$results.append(a)},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 a=e.results[n],r=this.option(a);t.push(r)}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(a){var r=a.map((function(e){return e.id.toString()}));n.$results.find(".select2-results__option--selectable").each((function(){var n=e(this),a=t.GetData(this,"data"),i=""+a.id;null!=a.element&&a.element.selected||null==a.element&&r.indexOf(i)>-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 a=document.createElement("li");a.classList.add("select2-results__option"),a.classList.add("select2-results__option--selectable");var r={role:"option"},i=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(var s in(null!=n.element&&i.call(n.element,":disabled")||null==n.element&&n.disabled)&&(r["aria-disabled"]="true",a.classList.remove("select2-results__option--selectable"),a.classList.add("select2-results__option--disabled")),null==n.id&&a.classList.remove("select2-results__option--selectable"),null!=n._resultId&&(a.id=n._resultId),n.title&&(a.title=n.title),n.children&&(r.role="group",r["aria-label"]=n.text,a.classList.remove("select2-results__option--selectable"),a.classList.add("select2-results__option--group")),r){var o=r[s];a.setAttribute(s,o)}if(n.children){var l=e(a),c=document.createElement("strong");c.className="select2-results__group",this.template(n,c);for(var u=[],d=0;d<n.children.length;d++){var p=n.children[d],m=this.option(p);u.push(m)}var h=e("<ul></ul>",{class:"select2-results__options select2-results__options--nested",role:"none"});h.append(u),l.append(c),l.append(h)}else this.template(n,a);return t.StoreData(a,"data",n),a},n.prototype.bind=function(n,a){var r=this,i=n.id+"-results";this.$results.attr("id",i),n.on("results:all",(function(e){r.clear(),r.append(e.data),n.isOpen()&&(r.setClasses(),r.highlightFirstItem())})),n.on("results:append",(function(e){r.append(e.data),n.isOpen()&&r.setClasses()})),n.on("query",(function(e){r.hideMessages(),r.showLoading(e)})),n.on("select",(function(){n.isOpen()&&(r.setClasses(),r.options.get("scrollAfterSelect")&&r.highlightFirstItem())})),n.on("unselect",(function(){n.isOpen()&&(r.setClasses(),r.options.get("scrollAfterSelect")&&r.highlightFirstItem())})),n.on("open",(function(){r.$results.attr("aria-expanded","true"),r.$results.attr("aria-hidden","false"),r.setClasses(),r.ensureHighlightVisible()})),n.on("close",(function(){r.$results.attr("aria-expanded","false"),r.$results.attr("aria-hidden","true"),r.$results.removeAttr("aria-activedescendant")})),n.on("results:toggle",(function(){var e=r.getHighlightedResults();0!==e.length&&e.trigger("mouseup")})),n.on("results:select",(function(){var e=r.getHighlightedResults();if(0!==e.length){var n=t.GetData(e[0],"data");e.hasClass("select2-results__option--selected")?r.trigger("close",{}):r.trigger("select",{data:n})}})),n.on("results:previous",(function(){var e=r.getHighlightedResults(),t=r.$results.find(".select2-results__option--selectable"),n=t.index(e);if(!(n<=0)){var a=n-1;0===e.length&&(a=0);var i=t.eq(a);i.trigger("mouseenter");var s=r.$results.offset().top,o=i.offset().top,l=r.$results.scrollTop()+(o-s);0===a?r.$results.scrollTop(0):o-s<0&&r.$results.scrollTop(l)}})),n.on("results:next",(function(){var e=r.getHighlightedResults(),t=r.$results.find(".select2-results__option--selectable"),n=t.index(e)+1;if(!(n>=t.length)){var a=t.eq(n);a.trigger("mouseenter");var i=r.$results.offset().top+r.$results.outerHeight(!1),s=a.offset().top+a.outerHeight(!1),o=r.$results.scrollTop()+s-i;0===n?r.$results.scrollTop(0):s>i&&r.$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){r.displayMessage(e)})),e.fn.mousewheel&&this.$results.on("mousewheel",(function(e){var t=r.$results.scrollTop(),n=r.$results.get(0).scrollHeight-t+e.deltaY,a=e.deltaY>0&&t-e.deltaY<=0,i=e.deltaY<0&&n<=r.$results.height();a?(r.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):i&&(r.$results.scrollTop(r.$results.get(0).scrollHeight-r.$results.height()),e.preventDefault(),e.stopPropagation())})),this.$results.on("mouseup",".select2-results__option--selectable",(function(n){var a=e(this),i=t.GetData(this,"data");a.hasClass("select2-results__option--selected")?r.options.get("multiple")?r.trigger("unselect",{originalEvent:n,data:i}):r.trigger("close",{}):r.trigger("select",{originalEvent:n,data:i})})),this.$results.on("mouseenter",".select2-results__option--selectable",(function(n){var a=t.GetData(this,"data");r.getHighlightedResults().removeClass("select2-results__option--highlighted").attr("aria-selected","false"),r.trigger("results:focus",{data:a,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,a=e.offset().top,r=this.$results.scrollTop()+(a-n),i=a-n;r-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(i>this.$results.outerHeight()||i<0)&&this.$results.scrollTop(r)}},n.prototype.template=function(t,n){var a=this.options.get("templateResult"),r=this.options.get("escapeMarkup"),i=a(t,n);null==i?n.style.display="none":"string"==typeof i?n.innerHTML=r(i):e(n).append(i)},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 a(e,t){this.$element=e,this.options=t,a.__super__.constructor.call(this)}return t.Extend(a,t.Observable),a.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},a.prototype.bind=function(e,t){var a=this,r=e.id+"-results";this.container=e,this.$selection.on("focus",(function(e){a.trigger("focus",e)})),this.$selection.on("blur",(function(e){a._handleBlur(e)})),this.$selection.on("keydown",(function(e){a.trigger("keypress",e),e.which===n.SPACE&&e.preventDefault()})),e.on("results:focus",(function(e){a.$selection.attr("aria-activedescendant",e.data._resultId)})),e.on("selection:update",(function(e){a.update(e.data)})),e.on("open",(function(){a.$selection.attr("aria-expanded","true"),a.$selection.attr("aria-owns",r),a._attachCloseHandler(e)})),e.on("close",(function(){a.$selection.attr("aria-expanded","false"),a.$selection.removeAttr("aria-activedescendant"),a.$selection.removeAttr("aria-owns"),a.$selection.trigger("focus"),a._detachCloseHandler(e)})),e.on("enable",(function(){a.$selection.attr("tabindex",a._tabindex),a.$selection.attr("aria-disabled","false")})),e.on("disable",(function(){a.$selection.attr("tabindex","-1"),a.$selection.attr("aria-disabled","true")}))},a.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)},a.prototype._attachCloseHandler=function(n){e(document.body).on("mousedown.select2."+n.id,(function(n){var a=e(n.target).closest(".select2");e(".select2.select2-container--open").each((function(){this!=a[0]&&t.GetData(this,"element").select2("close")}))}))},a.prototype._detachCloseHandler=function(t){e(document.body).off("mousedown.select2."+t.id)},a.prototype.position=function(e,t){t.find(".selection").append(e)},a.prototype.destroy=function(){this._detachCloseHandler(this.container)},a.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},a.prototype.isEnabled=function(){return!this.isDisabled()},a.prototype.isDisabled=function(){return this.options.get("disabled")},a})),n.define("select2/selection/single",["jquery","./base","../utils","../keys"],(function(e,t,n,a){function r(){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--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},r.prototype.bind=function(e,t){var n=this;r.__super__.bind.apply(this,arguments);var a=e.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",a).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",a),this.$selection.attr("aria-controls",a),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")}))},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("<span></span>")},r.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),a=this.display(t,n);n.empty().append(a);var r=t.title||t.text;r?n.attr("title",r):n.removeAttr("title")}else this.clear()},r})),n.define("select2/selection/multiple",["jquery","./base","../utils"],(function(e,t,n){function a(e,t){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--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},a.prototype.bind=function(t,r){var i=this;a.__super__.bind.apply(this,arguments);var s=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",s),this.$selection.on("click",(function(e){i.trigger("toggle",{originalEvent:e})})),this.$selection.on("click",".select2-selection__choice__remove",(function(t){if(!i.isDisabled()){var a=e(this).parent(),r=n.GetData(a[0],"data");i.trigger("unselect",{originalEvent:t,data:r})}})),this.$selection.on("keydown",".select2-selection__choice__remove",(function(e){i.isDisabled()||e.stopPropagation()}))},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('<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>')},a.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],a=this.$selection.find(".select2-selection__rendered").attr("id")+"-choice-",r=0;r<e.length;r++){var i=e[r],s=this.selectionContainer(),o=this.display(i,s),l=a+n.generateChars(4)+"-";i.id?l+=i.id:l+=n.generateChars(4),s.find(".select2-selection__choice__display").append(o).attr("id",l);var c=i.title||i.text;c&&s.attr("title",c);var u=this.options.get("translations").get("removeItem"),d=s.find(".select2-selection__choice__remove");d.attr("title",u()),d.attr("aria-label",u()),d.attr("aria-describedby",l),n.StoreData(s[0],"data",i),t.push(s)}this.$selection.find(".select2-selection__rendered").append(t)}},a})),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 a=t.title||t.text||n.text();return this.$selection.find(".select2-selection__rendered").attr("title",a),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 a=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(a)},e})),n.define("select2/selection/allowClear",["jquery","../keys","../utils"],(function(e,t,n){function a(){}return a.prototype.bind=function(e,t,n){var a=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){a._handleClear(e)})),t.on("keypress",(function(e){a._handleKeyboardClear(e,t)}))},a.prototype._handleClear=function(e,t){if(!this.isDisabled()){var a=this.$selection.find(".select2-selection__clear");if(0!==a.length){t.stopPropagation();var r=n.GetData(a[0],"data"),i=this.$element.val();this.$element.val(this.placeholder.id);var s={data:r};if(this.trigger("clear",s),s.prevented)this.$element.val(i);else{for(var o=0;o<r.length;o++)if(s={data:r[o]},this.trigger("unselect",s),s.prevented)return void this.$element.val(i);this.$element.trigger("input").trigger("change"),this.trigger("toggle",{})}}}},a.prototype._handleKeyboardClear=function(e,n,a){a.isOpen()||n.which!=t.DELETE&&n.which!=t.BACKSPACE||this._handleClear(n)},a.prototype.update=function(t,a){if(t.call(this,a),this.$selection.find(".select2-selection__clear").remove(),this.$selection[0].classList.remove("select2-selection--clearable"),!(this.$selection.find(".select2-selection__placeholder").length>0||0===a.length)){var r=this.$selection.find(".select2-selection__rendered").attr("id"),i=this.options.get("translations").get("removeAllItems"),s=e('<button type="button" class="select2-selection__clear" tabindex="-1"><span aria-hidden="true">&times;</span></button>');s.attr("title",i()),s.attr("aria-label",i()),s.attr("aria-describedby",r),n.StoreData(s[0],"data",a),this.$selection.prepend(s),this.$selection[0].classList.add("select2-selection--clearable")}},a})),n.define("select2/selection/search",["jquery","../utils","../keys"],(function(e,t,n){function a(e,t,n){e.call(this,t,n)}return a.prototype.render=function(t){var n=this.options.get("translations").get("search"),a=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=a,this.$search=a.find("textarea"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",n());var r=t.call(this);return this._transferTabIndex(),r.append(this.$searchContainer),r},a.prototype.bind=function(e,a,r){var i=this,s=a.id+"-results",o=a.id+"-container";e.call(this,a,r),i.$search.attr("aria-describedby",o),a.on("open",(function(){i.$search.attr("aria-controls",s),i.$search.trigger("focus")})),a.on("close",(function(){i.$search.val(""),i.resizeSearch(),i.$search.removeAttr("aria-controls"),i.$search.removeAttr("aria-activedescendant"),i.$search.trigger("focus")})),a.on("enable",(function(){i.$search.prop("disabled",!1),i._transferTabIndex()})),a.on("disable",(function(){i.$search.prop("disabled",!0)})),a.on("focus",(function(e){i.$search.trigger("focus")})),a.on("results:focus",(function(e){e.data._resultId?i.$search.attr("aria-activedescendant",e.data._resultId):i.$search.removeAttr("aria-activedescendant")})),this.$selection.on("focusin",".select2-search--inline",(function(e){i.trigger("focus",e)})),this.$selection.on("focusout",".select2-search--inline",(function(e){i._handleBlur(e)})),this.$selection.on("keydown",".select2-search--inline",(function(e){if(e.stopPropagation(),i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented(),e.which===n.BACKSPACE&&""===i.$search.val()){var a=i.$selection.find(".select2-selection__choice").last();if(a.length>0){var r=t.GetData(a[0],"data");i.searchRemoveChoice(r),e.preventDefault()}}})),this.$selection.on("click",".select2-search--inline",(function(e){i.$search.val()&&e.stopPropagation()}));var l=document.documentMode,c=l&&l<=11;this.$selection.on("input.searchcheck",".select2-search--inline",(function(e){c?i.$selection.off("input.search input.searchcheck"):i.$selection.off("keyup.search")})),this.$selection.on("keyup.search input.search",".select2-search--inline",(function(e){if(c&&"input"===e.type)i.$selection.off("input.search input.searchcheck");else{var t=e.which;t!=n.SHIFT&&t!=n.CTRL&&t!=n.ALT&&t!=n.TAB&&i.handleSearch(e)}}))},a.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},a.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},a.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")},a.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},a.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},a.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)},a})),n.define("select2/selection/selectionCss",["../utils"],(function(e){function t(){}return t.prototype.render=function(t){var n=t.call(this),a=this.options.get("selectionCssClass")||"";return-1!==a.indexOf(":all:")&&(a=a.replace(":all:",""),e.copyNonInternalCssClasses(n[0],this.$element[0])),n.addClass(a),n},t})),n.define("select2/selection/eventRelay",["jquery"],(function(e){function t(){}return t.prototype.bind=function(t,n,a){var r=this,i=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],s=["opening","closing","selecting","unselecting","clearing"];t.call(this,n,a),n.on("*",(function(t,n){if(-1!==i.indexOf(t)){n=n||{};var a=e.Event("select2:"+t,{params:n});r.$element.trigger(a),-1!==s.indexOf(t)&&(n.prevented=a.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 a=t(e);n._cache[e]=a}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 a=t.id+"-result-";return a+=e.generateChars(4),null!=n.id?a+="-"+n.id.toString():a+="-"+e.generateChars(4),a},t})),n.define("select2/data/select",["./base","../utils","jquery"],(function(e,t,n){function a(e,t){this.$element=e,this.options=t,a.__super__.constructor.call(this)}return t.Extend(a,e),a.prototype.current=function(e){var t=this;e(Array.prototype.map.call(this.$element[0].querySelectorAll(":checked"),(function(e){return t.item(n(e))})))},a.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 a=[];(e=[e]).push.apply(e,n);for(var r=0;r<e.length;r++){var i=e[r].id;-1===a.indexOf(i)&&a.push(i)}t.$element.val(a),t.$element.trigger("input").trigger("change")}));else{var n=e.id;this.$element.val(n),this.$element.trigger("input").trigger("change")}},a.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 a=[],r=0;r<n.length;r++){var i=n[r].id;i!==e.id&&-1===a.indexOf(i)&&a.push(i)}t.$element.val(a),t.$element.trigger("input").trigger("change")}))}},a.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)}))},a.prototype.destroy=function(){this.$element.find("*").each((function(){t.RemoveData(this)}))},a.prototype.query=function(e,t){var a=[],r=this;this.$element.children().each((function(){if("option"===this.tagName.toLowerCase()||"optgroup"===this.tagName.toLowerCase()){var t=n(this),i=r.item(t),s=r.matches(e,i);null!==s&&a.push(s)}})),t({results:a})},a.prototype.addOptions=function(e){this.$element.append(e)},a.prototype.option=function(e){var a;e.children?(a=document.createElement("optgroup")).label=e.text:void 0!==(a=document.createElement("option")).textContent?a.textContent=e.text:a.innerText=e.text,void 0!==e.id&&(a.value=e.id),e.disabled&&(a.disabled=!0),e.selected&&(a.selected=!0),e.title&&(a.title=e.title);var r=this._normalizeItem(e);return r.element=a,t.StoreData(a,"data",r),n(a)},a.prototype.item=function(e){var a={};if(null!=(a=t.GetData(e[0],"data")))return a;var r=e[0];if("option"===r.tagName.toLowerCase())a={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if("optgroup"===r.tagName.toLowerCase()){a={text:e.prop("label"),children:[],title:e.prop("title")};for(var i=e.children("option"),s=[],o=0;o<i.length;o++){var l=n(i[o]),c=this.item(l);s.push(c)}a.children=s}return(a=this._normalizeItem(a)).element=e[0],t.StoreData(e[0],"data",a),a},a.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)},a.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},a})),n.define("select2/data/array",["./select","../utils","jquery"],(function(e,t,n){function a(e,t){this._dataToConvert=t.get("data")||[],a.__super__.constructor.call(this,e,t)}return t.Extend(a,e),a.prototype.bind=function(e,t){a.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},a.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)),a.__super__.select.call(this,e)},a.prototype.convertToOptions=function(e){var t=this,a=this.$element.find("option"),r=a.map((function(){return t.item(n(this)).id})).get(),i=[];function s(e){return function(){return n(this).val()==e.id}}for(var o=0;o<e.length;o++){var l=this._normalizeItem(e[o]);if(r.indexOf(l.id)>=0){var c=a.filter(s(l)),u=this.item(c),d=n.extend(!0,{},l,u),p=this.option(d);c.replaceWith(p)}else{var m=this.option(l);if(l.children){var h=this.convertToOptions(l.children);m.append(h)}i.push(m)}}return i},a})),n.define("select2/data/ajax",["./array","../utils","jquery"],(function(e,t,n){function a(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),a.__super__.constructor.call(this,e,t)}return t.Extend(a,e),a.prototype._applyDefaults=function(e){var t={data:function(e){return n.extend({},e,{q:e.term})},transport:function(e,t,a){var r=n.ajax(e);return r.then(t),r.fail(a),r}};return n.extend({},t,e,!0)},a.prototype.processResults=function(e){return e},a.prototype.query=function(e,t){var a=this;null!=this._request&&("function"==typeof this._request.abort&&this._request.abort(),this._request=null);var r=n.extend({type:"GET"},this.ajaxOptions);function i(){var n=r.transport(r,(function(n){var r=a.processResults(n,e);a.options.get("debug")&&window.console&&console.error&&(r&&r.results&&Array.isArray(r.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),t(r)}),(function(){(!("status"in n)||0!==n.status&&"0"!==n.status)&&a.trigger("results:message",{message:"errorLoading"})}));a._request=n}"function"==typeof r.url&&(r.url=r.url.call(this.$element,e)),"function"==typeof r.data&&(r.data=r.data.call(this.$element,e)),this.ajaxOptions.delay&&null!=e.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(i,this.ajaxOptions.delay)):i()},a})),n.define("select2/data/tags",["jquery"],(function(e){function t(e,t,n){var a=n.get("tags"),r=n.get("createTag");void 0!==r&&(this.createTag=r);var i=n.get("insertTag");if(void 0!==i&&(this.insertTag=i),e.call(this,t,n),Array.isArray(a))for(var s=0;s<a.length;s++){var o=a[s],l=this._normalizeItem(o),c=this.option(l);this.$element.append(c)}}return t.prototype.query=function(e,t,n){var a=this;this._removeOldTags(),null!=t.term&&null==t.page?e.call(this,t,(function e(r,i){for(var s=r.results,o=0;o<s.length;o++){var l=s[o],c=null!=l.children&&!e({results:l.children},!0);if((l.text||"").toUpperCase()===(t.term||"").toUpperCase()||c)return!i&&(r.data=s,void n(r))}if(i)return!0;var u=a.createTag(t);if(null!=u){var d=a.option(u);d.attr("data-select2-tag","true"),a.addOptions([d]),a.insertTag(s,u)}r.results=s,n(r)})):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 a=n.get("tokenizer");void 0!==a&&(this.tokenizer=a),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,a){var r=this;n.term=n.term||"";var i=this.tokenizer(n,this.options,(function(t){var n=r._normalizeItem(t);if(!r.$element.find("option").filter((function(){return e(this).val()===n.id})).length){var a=r.option(n);a.attr("data-select2-tag",!0),r._removeOldTags(),r.addOptions([a])}!function(e){r.trigger("select",{data:e})}(n)}));i.term!==n.term&&(this.$search.length&&(this.$search.val(i.term),this.$search.trigger("focus")),n.term=i.term),t.call(this,n,a)},t.prototype.tokenizer=function(t,n,a,r){for(var i=a.get("tokenSeparators")||[],s=n.term,o=0,l=this.createTag||function(e){return{id:e.term,text:e.term}};o<s.length;){var c=s[o];if(-1!==i.indexOf(c)){var u=s.substr(0,o),d=l(e.extend({},n,{term:u}));null!=d?(r(d),s=s.substr(o+1)||"",o=0):o++}else o++}return{term:s}},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 a=this;e.call(this,t,n),t.on("select",(function(){a._checkIfMaximumSelected()}))},e.prototype.query=function(e,t,n){var a=this;this._checkIfMaximumSelected((function(){e.call(a,t,n)}))},e.prototype._checkIfMaximumSelected=function(e,t){var n=this;this.current((function(e){var a=null!=e?e.length:0;n.maximumSelectionLength>0&&a>=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),a=this.options.get("translations").get("search"),r=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=r,this.$search=r.find("input"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",a()),n.prepend(r),n},t.prototype.bind=function(t,n,a){var r=this,i=n.id+"-results";t.call(this,n,a),this.$search.on("keydown",(function(e){r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented()})),this.$search.on("input",(function(t){e(this).off("keyup")})),this.$search.on("keyup input",(function(e){r.handleSearch(e)})),n.on("open",(function(){r.$search.attr("tabindex",0),r.$search.attr("aria-controls",i),r.$search.trigger("focus"),window.setTimeout((function(){r.$search.trigger("focus")}),0)})),n.on("close",(function(){r.$search.attr("tabindex",-1),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.val(""),r.$search.trigger("blur")})),n.on("focus",(function(){n.isOpen()||r.$search.trigger("focus")})),n.on("results:all",(function(e){null!=e.query.term&&""!==e.query.term||(r.showSearch(e)?r.$searchContainer[0].classList.remove("select2-search--hide"):r.$searchContainer[0].classList.add("select2-search--hide"))})),n.on("results:focus",(function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$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,a){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,a)}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),a=t.length-1;a>=0;a--){var r=t[a];this.placeholder.id===r.id&&n.splice(a,1)}return n},e})),n.define("select2/dropdown/infiniteScroll",["jquery"],(function(e){function t(e,t,n,a){this.lastParams={},e.call(this,t,n,a),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 a=this;e.call(this,t,n),t.on("query",(function(e){a.lastParams=e,a.loading=!0})),t.on("query:append",(function(e){a.lastParams=e,a.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,a){this.$dropdownParent=e(a.get("dropdownParent")||document.body),t.call(this,n,a)}return n.prototype.bind=function(e,t,n){var a=this;e.call(this,t,n),t.on("open",(function(){a._showDropdown(),a._attachPositioningHandler(t),a._bindContainerResultHandlers(t)})),t.on("close",(function(){a._hideDropdown(),a._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>"),a=t.call(this);return n.append(a),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,a){var r=this,i="scroll.select2."+a.id,s="resize.select2."+a.id,o="orientationchange.select2."+a.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(i,(function(n){var a=t.GetData(this,"select2-scroll-position");e(this).scrollTop(a.y)})),e(window).on(i+" "+s+" "+o,(function(e){r._positionDropdown(),r._resizeDropdown()}))},n.prototype._detachPositioningHandler=function(n,a){var r="scroll.select2."+a.id,i="resize.select2."+a.id,s="orientationchange.select2."+a.id;this.$container.parents().filter(t.hasScroll).off(r),e(window).off(r+" "+i+" "+s)},n.prototype._positionDropdown=function(){var t=e(window),n=this.$dropdown[0].classList.contains("select2-dropdown--above"),a=this.$dropdown[0].classList.contains("select2-dropdown--below"),r=null,i=this.$container.offset();i.bottom=i.top+this.$container.outerHeight(!1);var s={height:this.$container.outerHeight(!1)};s.top=i.top,s.bottom=i.top+s.height;var o=this.$dropdown.outerHeight(!1),l=t.scrollTop(),c=t.scrollTop()+t.height(),u=l<i.top-o,d=c>i.bottom+o,p={left:i.left,top:s.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||a||(r="below"),d||!u||n?!u&&d&&n&&(r="below"):r="above",("above"==r||n&&"below"!==r)&&(p.top=s.top-h.top-o),null!=r&&(this.$dropdown[0].classList.remove("select2-dropdown--below"),this.$dropdown[0].classList.remove("select2-dropdown--above"),this.$dropdown[0].classList.add("select2-dropdown--"+r),this.$container[0].classList.remove("select2-container--below"),this.$container[0].classList.remove("select2-container--above"),this.$container[0].classList.add("select2-container--"+r)),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,a=0;a<t.length;a++){var r=t[a];r.children?n+=e(r.children):n++}return n}function t(e,t,n,a){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,a)}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 a=this;e.call(this,t,n),t.on("close",(function(e){a._handleSelectOnClose(e)}))},t.prototype._handleSelectOnClose=function(t,n){if(n&&null!=n.originalSelect2Event){var a=n.originalSelect2Event;if("select"===a._type||"unselect"===a._type)return}var r=this.getHighlightedResults();if(!(r.length<1)){var i=e.GetData(r[0],"data");null!=i.element&&i.element.selected||null==i.element&&i.selected||this.trigger("select",{data:i})}},t})),n.define("select2/dropdown/closeOnSelect",[],(function(){function e(){}return e.prototype.bind=function(e,t,n){var a=this;e.call(this,t,n),t.on("select",(function(e){a._selectTriggered(e)})),t.on("unselect",(function(e){a._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),a=this.options.get("dropdownCssClass")||"";return-1!==a.indexOf(":all:")&&(a=a.replace(":all:",""),e.copyNonInternalCssClasses(n[0],this.$element[0])),n.addClass(a),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 a=n.first(),r=e.GetData(a[0],"data").element;if(r&&r.getAttribute&&"true"===r.getAttribute("data-select2-tag"))return void a.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,a,r,i,s,o,l,c,u,d,p,m,h,f,g,v,y,b,w,_,E,Z,I,S,k,T,C,N,D){function x(){this.reset()}return x.prototype.apply=function(u){if(null==(u=e.extend(!0,{},this.defaults,u)).dataAdapter&&(null!=u.ajax?u.dataAdapter=h:null!=u.data?u.dataAdapter=m:u.dataAdapter=p,u.minimumInputLength>0&&(u.dataAdapter=c.Decorate(u.dataAdapter,v)),u.maximumInputLength>0&&(u.dataAdapter=c.Decorate(u.dataAdapter,y)),u.maximumSelectionLength>0&&(u.dataAdapter=c.Decorate(u.dataAdapter,b)),u.tags&&(u.dataAdapter=c.Decorate(u.dataAdapter,f)),null==u.tokenSeparators&&null==u.tokenizer||(u.dataAdapter=c.Decorate(u.dataAdapter,g))),null==u.resultsAdapter&&(u.resultsAdapter=t,null!=u.ajax&&(u.resultsAdapter=c.Decorate(u.resultsAdapter,Z)),null!=u.placeholder&&(u.resultsAdapter=c.Decorate(u.resultsAdapter,E)),u.selectOnClose&&(u.resultsAdapter=c.Decorate(u.resultsAdapter,k)),u.tags&&(u.resultsAdapter=c.Decorate(u.resultsAdapter,N))),null==u.dropdownAdapter){if(u.multiple)u.dropdownAdapter=w;else{var d=c.Decorate(w,_);u.dropdownAdapter=d}0!==u.minimumResultsForSearch&&(u.dropdownAdapter=c.Decorate(u.dropdownAdapter,S)),u.closeOnSelect&&(u.dropdownAdapter=c.Decorate(u.dropdownAdapter,T)),null!=u.dropdownCssClass&&(u.dropdownAdapter=c.Decorate(u.dropdownAdapter,C)),u.dropdownAdapter=c.Decorate(u.dropdownAdapter,I)}null==u.selectionAdapter&&(u.multiple?u.selectionAdapter=a:u.selectionAdapter=n,null!=u.placeholder&&(u.selectionAdapter=c.Decorate(u.selectionAdapter,r)),u.allowClear&&(u.selectionAdapter=c.Decorate(u.selectionAdapter,i)),u.multiple&&(u.selectionAdapter=c.Decorate(u.selectionAdapter,s)),null!=u.selectionCssClass&&(u.selectionAdapter=c.Decorate(u.selectionAdapter,o)),u.selectionAdapter=c.Decorate(u.selectionAdapter,l)),u.language=this._resolveLanguage(u.language),u.language.push("en");for(var D=[],x=0;x<u.language.length;x++){var R=u.language[x];-1===D.indexOf(R)&&D.push(R)}return u.language=D,u.translations=this._processTranslations(u.language,u.debug),u},x.prototype.reset=function(){function t(e){return e.replace(/[^\u0000-\u007E]/g,(function(e){return d[e]||e}))}this.defaults={amdLanguageBase:"./i18n/",autocomplete:"off",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:c.escapeMarkup,language:{},matcher:function n(a,r){if(null==a.term||""===a.term.trim())return r;if(r.children&&r.children.length>0){for(var i=e.extend(!0,{},r),s=r.children.length-1;s>=0;s--)null==n(a,r.children[s])&&i.children.splice(s,1);return i.children.length>0?i:n(a,i)}var o=t(r.text).toUpperCase(),l=t(a.term).toUpperCase();return o.indexOf(l)>-1?r: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"}},x.prototype.applyFromElement=function(e,t){var n=e.language,a=this.defaults.language,r=t.prop("lang"),i=t.closest("[lang]").prop("lang"),s=Array.prototype.concat.call(this._resolveLanguage(r),this._resolveLanguage(n),this._resolveLanguage(a),this._resolveLanguage(i));return e.language=s,e},x.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 a=[],r=0;r<n.length;r++)if(a.push(n[r]),"string"==typeof n[r]&&n[r].indexOf("-")>0){var i=n[r].split("-")[0];a.push(i)}return a},x.prototype._processTranslations=function(t,n){for(var a=new u,r=0;r<t.length;r++){var i=new u,s=t[r];if("string"==typeof s)try{i=u.loadPath(s)}catch(e){try{s=this.defaults.amdLanguageBase+s,i=u.loadPath(s)}catch(e){n&&window.console&&console.warn&&console.warn('Select2: The language file for "'+s+'" could not be automatically loaded. A fallback will be used instead.')}}else i=e.isPlainObject(s)?new u(s):s;a.extend(i)}return a},x.prototype.set=function(t,n){var a={};a[e.camelCase(t)]=n;var r=c._convertData(a);e.extend(!0,this.defaults,r)},new x})),n.define("select2/options",["jquery","./defaults","./utils"],(function(e,t,n){function a(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 a.prototype.fromElement=function(t){var a=["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 r={};function i(e,t){return t.toUpperCase()}for(var s=0;s<t[0].attributes.length;s++){var o=t[0].attributes[s].name,l="data-";if(o.substr(0,l.length)==l){var c=o.substring(l.length),u=n.GetData(t[0],c);r[c.replace(/-([a-z])/g,i)]=u}}e.fn.jquery&&"1."==e.fn.jquery.substr(0,2)&&t[0].dataset&&(r=e.extend(!0,{},t[0].dataset,r));var d=e.extend(!0,{},n.GetData(t[0]),r);for(var p in d=n._convertData(d))a.indexOf(p)>-1||(e.isPlainObject(this.options[p])?e.extend(this.options[p],d[p]):this.options[p]=d[p]);return this},a.prototype.get=function(e){return this.options[e]},a.prototype.set=function(e,t){this.options[e]=t},a})),n.define("select2/core",["jquery","./options","./utils","./keys"],(function(e,t,n,a){var r=function(e,a){null!=n.GetData(e[0],"select2")&&n.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),a=a||{},this.options=new t(a,e),r.__super__.constructor.call(this);var i=e.attr("tabindex")||0;n.StoreData(e[0],"old-tabindex",i),e.attr("tabindex","-1");var s=this.options.get("dataAdapter");this.dataAdapter=new s(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 u=this.options.get("resultsAdapter");this.results=new u(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var d=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current((function(e){d.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(r,n.Observable),r.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,"")},r.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},r.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 a=this._resolveWidth(e,"style");return null!=a?a:this._resolveWidth(e,"element")}if("element"==t){var r=e.outerWidth(!1);return r<=0?"auto":r+"px"}if("style"==t){var i=e.attr("style");if("string"!=typeof i)return null;for(var s=i.split(";"),o=0,l=s.length;o<l;o+=1){var c=s[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},r.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)},r.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})},r.prototype._registerDataEvents=function(){var e=this;this.dataAdapter.on("*",(function(t,n){e.trigger(t,n)}))},r.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,a){-1===t.indexOf(n)&&e.trigger(n,a)}))},r.prototype._registerDropdownEvents=function(){var e=this;this.dropdown.on("*",(function(t,n){e.trigger(t,n)}))},r.prototype._registerResultsEvents=function(){var e=this;this.results.on("*",(function(t,n){e.trigger(t,n)}))},r.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===a.ESC||n===a.UP&&t.altKey?(e.close(t),t.preventDefault()):n===a.ENTER||n===a.TAB?(e.trigger("results:select",{}),t.preventDefault()):n===a.SPACE&&t.ctrlKey?(e.trigger("results:toggle",{}),t.preventDefault()):n===a.UP?(e.trigger("results:previous",{}),t.preventDefault()):n===a.DOWN&&(e.trigger("results:next",{}),t.preventDefault()):(n===a.ENTER||n===a.SPACE||n===a.DOWN&&t.altKey)&&(e.open(),t.preventDefault())}))},r.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},r.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},r.prototype._syncSubtree=function(e){var t=this._isChangeMutation(e),n=this;t&&this.dataAdapter.current((function(e){n.trigger("selection:update",{data:e})}))},r.prototype.trigger=function(e,t){var n=r.__super__.trigger,a={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in a){var i=a[e],s={prevented:!1,name:e,args:t};if(n.call(this,i,s),s.prevented)return void(t.prevented=!0)}n.call(this,e,t)},r.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},r.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},r.prototype.close=function(e){this.isOpen()&&this.trigger("close",{originalEvent:e})},r.prototype.isEnabled=function(){return!this.isDisabled()},r.prototype.isDisabled=function(){return this.options.get("disabled")},r.prototype.isOpen=function(){return this.$container[0].classList.contains("select2-container--open")},r.prototype.hasFocus=function(){return this.$container[0].classList.contains("select2-container--focus")},r.prototype.focus=function(e){this.hasFocus()||(this.$container[0].classList.add("select2-container--focus"),this.trigger("focus",{}))},r.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)},r.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},r.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")},r.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},r.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},r})),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})),s=function(e){var t,n,a=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],r="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(e.event.fixHooks)for(var s=a.length;s;)e.event.fixHooks[a[--s]]=e.event.mouseHooks;var o=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var t=r.length;t;)this.addEventListener(r[--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=r.length;t;)this.removeEventListener(r[--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),a=n["offsetParent"in e.fn?"offsetParent":"parent"]();return a.length||(a=e("body")),parseInt(a.css("fontSize"),10)||parseInt(n.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function l(a){var r=a||window.event,s=i.call(arguments,1),l=0,d=0,p=0,m=0,h=0,f=0;if((a=e.event.fix(r)).type="mousewheel","detail"in r&&(p=-1*r.detail),"wheelDelta"in r&&(p=r.wheelDelta),"wheelDeltaY"in r&&(p=r.wheelDeltaY),"wheelDeltaX"in r&&(d=-1*r.wheelDeltaX),"axis"in r&&r.axis===r.HORIZONTAL_AXIS&&(d=-1*p,p=0),l=0===p?d:p,"deltaY"in r&&(l=p=-1*r.deltaY),"deltaX"in r&&(d=r.deltaX,0===p&&(l=-1*d)),0!==p||0!==d){if(1===r.deltaMode){var g=e.data(this,"mousewheel-line-height");l*=g,p*=g,d*=g}else if(2===r.deltaMode){var v=e.data(this,"mousewheel-page-height");l*=v,p*=v,d*=v}if(m=Math.max(Math.abs(p),Math.abs(d)),(!n||m<n)&&(n=m,u(r,m)&&(n/=40)),u(r,m)&&(l/=40,d/=40,p/=40),l=Math[l>=1?"floor":"ceil"](l/n),d=Math[d>=1?"floor":"ceil"](d/n),p=Math[p>=1?"floor":"ceil"](p/n),o.settings.normalizeOffset&&this.getBoundingClientRect){var y=this.getBoundingClientRect();h=a.clientX-y.left,f=a.clientY-y.top}return a.deltaX=d,a.deltaY=p,a.deltaFactor=n,a.offsetX=h,a.offsetY=f,a.deltaMode=0,s.unshift(a,l,d,p),t&&clearTimeout(t),t=setTimeout(c,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function c(){n=null}function u(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"],s):e.exports=s,n.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],(function(e,t,n,a,r){if(null==e.fn.select2){var i=["open","close","destroy"];e.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each((function(){var a=e.extend(!0,{},t);new n(e(this),a)})),this;if("string"==typeof t){var a,s=Array.prototype.slice.call(arguments,1);return this.each((function(){var e=r.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."),a=e[t].apply(e,s)})),i.indexOf(t)>-1?this:a}throw new Error("Invalid arguments for Select2: "+t)}}return null==e.fn.select2.defaults&&(e.fn.select2.defaults=a),n})),{define:n.define,require:n.require}}(),a=n.require("jquery.select2");return t.fn.select2.amd=n,a})?a.apply(t,r):a)||(e.exports=i)},42473:function(e){"use strict";e.exports=function(){}},65311:function(e){"use strict";e.exports=jQuery}},function(e){e.O(0,[351],(function(){return 78537,e(e.s=78537)})),e.O()}]);
assets/dist/js/{admin.9a3f47c7.js.LICENSE.txt → admin.517073b9.js.LICENSE.txt} RENAMED
File without changes
assets/dist/js/admin.9a3f47c7.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see admin.9a3f47c7.js.LICENSE.txt */
2
- (self.webpackChunkMailPoet3=self.webpackChunkMailPoet3||[]).push([[328],{49868:function(){jQuery.AsyncQueue=function(){var e,t,n,a,r=this,s=[],o=!1;return a=function(){var e=s.shift();e?(e.apply(r,[r]),!1===o&&a()):t&&t.apply(r)},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,a()},this.pause=function(){return o=!0,this},this.failure=function(){if(o=!0,e){var t=[r];for(i=0;i<arguments.length;i++)t.push(arguments[i]);e.apply(r,t)}},this}},56079:function(e,t,n){"use strict";var a={};n.r(a),n.d(a,{canUseWooSubscriptions:function(){return Vo},findFiltersValueForSegment:function(){return Jo},getAvailableFilters:function(){return Xo},getCustomFieldsList:function(){return Bo},getErrors:function(){return Qo},getMembershipPlans:function(){return Fo},getNewslettersList:function(){return jo},getProductCategories:function(){return Uo},getProducts:function(){return Lo},getSegment:function(){return Ho},getSegmentFilter:function(){return Go},getStaticSegmentsList:function(){return zo},getSubscriberCount:function(){return Ko},getSubscriptionProducts:function(){return qo},getWooCommerceCountries:function(){return Yo},getWooCommerceCurrencySymbol:function(){return Wo},getWordpressRoles:function(){return $o}});var r={};n.r(r),n.d(r,{handleSave:function(){return hl},pageLoaded:function(){return ml},setErrors:function(){return ol},setSegment:function(){return sl},updateSegment:function(){return ll},updateSegmentFilter:function(){return cl},updateSegmentFilterFromEvent:function(){return dl},updateSegmentFromEvent:function(){return ul},updateSubscriberCount:function(){return pl}});var i={};n.r(i),n.d(i,{LOAD_SEGMENT:function(){return gl},SAVE_SEGMENT:function(){return vl}});var s=n(45993),o=n.n(s),l=n(97846),c=n.n(l),u=n(73727),d=n(5977),p=n(65311),m=n.n(p),h=n(62948),f=n(89457),g=n.n(f),v=n(45697),y=n.n(v),b=n(57744),w=n(57578);function _(e){let{children:t,dimension:n,segments:a,strings:r}=e;return o().createElement("div",{className:"mailpoet-tags"},t,a&&a.map((e=>o().createElement(w.Z,{key:e.name,dimension:n,variant:"list"},e.name))),r&&r.map((e=>o().createElement(w.Z,{key:e,dimension:n,variant:"list"},e))))}_.propTypes={children:y().node,dimension:y().oneOf(["large"]),segments:y().arrayOf(y().shape({name:y().string.isRequired})),strings:y().arrayOf(y().string)};var E=_,Z=n(33160),I=n(57040),S=n(73126),k=n(44845),T=n(59050);n(20454);class C extends o().Component{constructor(e){super(e),(0,k.Z)(this,"getFieldId",(e=>{const t=e||this.props;return t.field.id||t.field.name})),(0,k.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(T.ZP.isArray(this.props.item[this.props.field.name]))return this.props.item[this.props.field.name].map((e=>e.id))}return null})),(0,k.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),T.ZP.isArray(e)&&void 0!==this.props.field.filter&&(e=e.filter(this.props.field.filter)),e})),(0,k.Z)(this,"getLabel",(e=>void 0!==this.props.field.getLabel?this.props.field.getLabel(e,this.props.item):e.name)),(0,k.Z)(this,"getSearchLabel",(e=>void 0!==this.props.field.getSearchLabel?this.props.field.getSearchLabel(e,this.props.item):null)),(0,k.Z)(this,"getValue",(e=>void 0!==this.props.field.getValue?this.props.field.getValue(e,this.props.item):e.id)),(0,k.Z)(this,"getCount",(e=>void 0!==this.props.field.getCount?this.props.field.getCount(e,this.props.item):null)),(0,k.Z)(this,"getTag",(e=>void 0!==this.props.field.getTag?this.props.field.getTag(e,this.props.item):null)),(0,k.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=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 a=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:a})}void 0!==this.props.field.extendSelect2Options&&(t=Object.assign(t,this.props.field.extendSelect2Options));const a=m()(`#${this.selectRef.current.id}`).select2(t);let r=!1;a.on("select2:unselecting",(()=>{r=!0})),a.on("select2:opening",(e=>{!0===r&&(r=!1,e.preventDefault())})),a.on("change",this.handleChange)})),(0,k.Z)(this,"resetSelect2",(()=>{this.destroySelect2(),this.setupSelect2()})),(0,k.Z)(this,"destroySelect2",(()=>{this.isSelect2Initialized()&&(m()(`#${this.selectRef.current.id}`).select2("destroy"),this.cleanupAfterSelect2())})),(0,k.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,k.Z)(this,"allowMultipleValues",(()=>!0===this.props.field.multiple)),(0,k.Z)(this,"isSelect2Initialized",(()=>!0===m()(`#${this.selectRef.current.id}`).hasClass("select2-hidden-accessible"))),(0,k.Z)(this,"isSelect2Component",(()=>this.allowMultipleValues()||this.props.field.forceSelect2)),(0,k.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?T.ZP.pluck(t,"id"):T.ZP.pluck(t,"id").toString(),a=this.transformChangedValue(n,t);this.props.onValueChange({target:{value:a,name:this.props.field.name,id:e.target.id}})})),(0,k.Z)(this,"transformChangedValue",((e,t)=>"function"==typeof this.props.field.transformChangedValue?this.props.field.transformChangedValue.call(this,e,t):e)),(0,k.Z)(this,"insertEmptyOption",(()=>{if(!this.allowMultipleValues())return this.props.field.placeholder?o().createElement("option",{className:"default"}):void 0})),this.selectRef=o().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),a=this.getValue(e);return o().createElement("option",{key:`option-${e.id}`,className:"default",value:a,title:n},t)}));return o().createElement("div",{className:"mailpoet-form-select mailpoet-form-input"},o().createElement("select",(0,S.Z)({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),this.insertEmptyOption(),n))}}C.propTypes={onValueChange:y().func,field:y().shape({name:y().string.isRequired,values:y().oneOfType([y().object,y().array]),getLabel:y().func,resetSelect2OnUpdate:y().bool,selected:y().func,endpoint:y().string,filter:y().func,getSearchLabel:y().func,getValue:y().func,getCount:y().func,getTag:y().func,placeholder:y().string,remoteQuery:y().object,extendSelect2Options:y().object,multiple:y().bool,forceSelect2:y().bool,transformChangedValue:y().func,disabled:y().bool,validation:y().shape({"data-parsley-required":y().bool,"data-parsley-required-message":y().string,"data-parsley-type":y().string,"data-parsley-errors-container":y().string,maxLength:y().number})}).isRequired,item:y().object,disabled:y().bool,width:y().string},C.defaultProps={onValueChange:function(){},disabled:!1,width:"",item:void 0};var N=C,D=n(27927),x=n.n(D),R=n(38287),O=function(){if(!h.Z.subscribersLimitReached)return null;const e=h.Z.hasValidApiKey,t=h.Z.I18n.t("subscribersLimitNoticeTitle").replace("[subscribersLimit]",h.Z.subscribersLimit),n=h.Z.I18n.t(e?"yourPlanLimit":"freeVersionLimit").replace("[subscribersLimit]",h.Z.subscribersLimit),a=e?h.Z.MailPoetComUrlFactory.getUpgradeUrl(h.Z.pluginPartialKey):h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount+1),r=x()(h.Z.I18n.t("youCanDisableWPUsersList"),/\[link](.*?)\[\/link]/g,(e=>o().createElement("a",{key:"goToSegments",href:"?page=mailpoet-segments"},e)));return o().createElement(R.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0},o().createElement("h3",null,t),o().createElement("p",null,n," ",h.Z.I18n.t("youNeedToUpgrade"),"active"===h.Z.wpSegmentState?o().createElement(o().Fragment,null,o().createElement("br",null),r):null),o().createElement("p",null,o().createElement("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:a},h.Z.I18n.t("upgradeNow")),e&&o().createElement(o().Fragment,null," ",o().createElement("button",{type:"button",className:"button",onClick:async()=>{await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()}},h.Z.I18n.t("refreshMySubscribers")))))};function A(e){let{mssKeyInvalid:t,subscribersCount:n}=e;return t?o().createElement(R.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0},o().createElement("h3",null,h.Z.I18n.t("allSendingPausedHeader")),o().createElement("p",null,x()(h.Z.I18n.t("allSendingPausedBody"),/\[link\](.*?)\[\/link\]/g,(e=>o().createElement("a",{href:"?page=mailpoet-settings#premium",key:"check-sending"},e)))),o().createElement("p",null,o().createElement("a",{href:`https://account.mailpoet.com?s=${n}`,className:"button button-primary",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("allSendingPausedLink")))):null}A.propTypes={mssKeyInvalid:y().bool.isRequired,subscribersCount:y().number.isRequired};var P=A,M=n(30653),L=function(){if(!h.Z.emailVolumeLimitReached)return null;const e=h.Z.I18n.t("emailVolumeLimitNoticeTitle").replace("[emailVolumeLimit]",h.Z.emailVolumeLimit),t=h.Z.I18n.t("youReachedEmailVolumeLimit").replace("[emailVolumeLimit]",h.Z.emailVolumeLimit),n=h.Z.MailPoetComUrlFactory.getUpgradeUrl(h.Z.pluginPartialKey),a=new Date,r=new Date(a.getFullYear(),a.getMonth()+1,1);let i=x()(h.Z.I18n.t("toContinueUpgradeYourPlanOrWaitUntil"),/\[link](.*?)\[\/link]/g,(e=>o().createElement("a",{target:"_blank",rel:"noreferrer",href:n,key:e},e)));return i=x()(i,/<b>\[date]<\/b>\./g,(()=>(0,M.ZP)(`<b>${h.Z.Date.short(r)}</b>.`))),o().createElement(R.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0},o().createElement("h3",null,e),o().createElement("p",null,t,o().createElement("br",null),i),o().createElement("p",null,o().createElement("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:n},h.Z.I18n.t("upgradeNow"))," ",o().createElement("button",{type:"button",className:"button",onClick:async()=>{await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"services",action:"recheckKeys"}),window.location.reload()}},h.Z.I18n.t("refreshMyEmailVolumeLimit"))))};function F(e){let{cacheCalculation:t}=e;const[n,a]=(0,s.useState)(!1),[r,i]=(0,s.useState)([]),l=(new Date).getTime()-new Date(t).getTime(),c=Math.floor(l/1e3/60);return o().createElement("div",{className:"mailpoet-subscribers-cache-notice"},x()(h.Z.I18n.t("subscribersCountWereCalculatedWithMinutesAgo"),/<abbr>(.*?)<\/abbr>/,((e,n)=>o().createElement("abbr",{key:n,title:t},e.replace(/(\{\$mins\}|\$mins)/i,String(c))))),o().createElement(b.Z,{className:"mailpoet-subscribers-cache-notice-button",type:"button",variant:"secondary",dimension:"small",onClick:()=>{a(!0),h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"settings",action:"recalculateSubscribersCountsCache"}).done((()=>{window.location.reload()})).fail((e=>{i(e.errors.map((e=>e.message))),a(!1)}))},withSpinner:n},h.Z.I18n.t("recalculateNow")),o().createElement("div",{className:"mailpoet-gap"}),r.length>0&&o().createElement(R.Z,{type:"error"},r.map((e=>o().createElement("p",{key:e},e)))))}F.propTypes={cacheCalculation:y().string.isRequired};var q=n(69223),$=n.n(q);function U(e){let{subscribersInPlan:t,subscribersInPlanLimit:n}=e;if(!1===t)return null;const a=n?o().createElement("b",{key:"subscribers_count"},h.Z.I18n.t("subscribersInPlanCount").replace("%1$d",t.toLocaleString()).replace("%2$d",n.toLocaleString())):o().createElement("b",{key:"subscribers_count"},t);return o().createElement("div",{className:"mailpoet-subscribers-in-plan"},x()(h.Z.I18n.t("subscribersInPlan"),"%s",(()=>a))," ",o().createElement($(),{tooltip:h.Z.I18n.t("subscribersInPlanTooltip"),place:"right"}),o().createElement("span",{className:"mailpoet-subscribers-in-plan-spacer"}," "))}U.propTypes={subscribersInPlan:y().oneOfType([y().number,y().oneOf([!1])]).isRequired,subscribersInPlanLimit:y().oneOfType([y().number,y().oneOf([!1])]).isRequired};var j=U,V=n(99181),W=o().createElement("svg",{viewBox:"4 4 16 16"},o().createElement("path",{d:"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"}));function Y(e){let{location:t}=e;return o().createElement(V.Q,null,o().createElement(u.rU,{className:"mailpoet-button button-secondary",to:{pathname:"/new",state:{backUrl:t?.pathname}}},W,o().createElement("span",{"data-automation-id":"add-new-subscribers-button"},h.Z.I18n.t("new"))),o().createElement("a",{className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-import","data-automation-id":"import-subscribers-button"},h.Z.I18n.t("import")),o().createElement("a",{id:"mailpoet_export_button",className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-export"},h.Z.I18n.t("export")))}Y.propTypes={location:y().object.isRequired};var B=(0,d.withRouter)(Y),H=n(53423);function z(e){let{id:t,engagementScore:n}=e;const a={unknown:{name:h.Z.I18n.t("unknownBadgeName"),type:"unknown",tooltipTitle:h.Z.I18n.t("unknownBadgeTooltip"),tooltipText:h.Z.I18n.t("tooltipUnknown")},excellent:{name:h.Z.I18n.t("excellentBadgeName"),type:"excellent",tooltipTitle:h.Z.I18n.t("excellentBadgeTooltip"),tooltipText:h.Z.I18n.t("tooltipExcellent")},good:{name:h.Z.I18n.t("goodBadgeName"),type:"good",tooltipTitle:h.Z.I18n.t("goodBadgeTooltip"),tooltipText:h.Z.I18n.t("tooltipGood")},average:{name:h.Z.I18n.t("averageBadgeName"),type:"average",tooltipTitle:h.Z.I18n.t("averageBadgeTooltip"),tooltipText:h.Z.I18n.t("tooltipAverage")}},r=`badge-${t}`;let i;i=null==n?a.unknown:n<20?a.average:n<50?a.good:a.excellent;const s=o().createElement("div",{key:`tooltip-${r}`},o().createElement("div",{className:"mailpoet-listing-stats-tooltip-title"},i.tooltipTitle.toUpperCase()),o().createElement("div",{className:"mailpoet-listing-stats-tooltip-description"},h.Z.I18n.t("engagementScoreDescription")),o().createElement("div",{className:"mailpoet-listing-stats-tooltip-content"},o().createElement(H.Z,{type:"unknown",name:h.Z.I18n.t("unknownBadgeName")})," : ",a.unknown.tooltipText,o().createElement("br",null),o().createElement(H.Z,{type:"excellent",name:h.Z.I18n.t("excellentBadgeName")})," : ",a.excellent.tooltipText,o().createElement("br",null),o().createElement(H.Z,{type:"good",name:h.Z.I18n.t("goodBadgeName")})," : ",a.good.tooltipText,o().createElement("br",null),o().createElement(H.Z,{type:"average",name:h.Z.I18n.t("averageBadgeName")})," : ",a.average.tooltipText));return o().createElement("div",{className:"mailpoet-listing-stats-opened-clicked"},null!=n&&o().createElement("div",{className:"mailpoet-listing-stats-percentages"},n.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),"%"),o().createElement("div",null,o().createElement(H.Z,{isInverted:!0,type:i.type,name:i.name,tooltip:s,tooltipId:r,tooltipPlace:"top"})))}z.propTypes={id:y().number.isRequired,engagementScore:y().number};const K=h.Z.trackingConfig.emailTrackingEnabled,G=[{name:"email",label:h.Z.I18n.t("subscriber"),sortable:!0},{name:"status",label:h.Z.I18n.t("status"),sortable:!0},{name:"segments",label:h.Z.I18n.t("lists")},{name:"statistics",label:h.Z.I18n.t("statisticsColumn"),display:K},{name:"created_at",label:h.Z.I18n.t("subscribedOn"),sortable:!0}],Q={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneSubscriberTrashed"):h.Z.I18n.t("multipleSubscribersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneSubscriberDeleted"):h.Z.I18n.t("multipleSubscribersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneSubscriberRestored"):h.Z.I18n.t("multipleSubscribersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onNoItemsFound:e=>"bounced"===e&&!window.mailpoet_premium_active&&!window.mailpoet_mss_active&&o().createElement("div",null,o().createElement("p",null,h.Z.I18n.t("bouncedSubscribersHelp")),o().createElement("p",null,o().createElement("a",{href:"admin.php?page=mailpoet-upgrade",className:"button-primary"},h.Z.I18n.t("bouncedSubscribersPremiumButtonText"))))},X=(e,t,n,a)=>o().createElement(I.Z,{title:a,onRequestClose:t,isDismissible:!0},o().createElement(N,{field:n}),o().createElement("span",{className:"mailpoet-gap-half"}),o().createElement(b.Z,{onClick:e,dimension:"small",variant:"secondary"},h.Z.I18n.t("apply"))),J=[{name:"moveToList",label:h.Z.I18n.t("moveToList"),onSelect:function(e,t){return X(e,t,{id:"move_to_segment",name:"move_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},h.Z.I18n.t("moveToList"))},getData:function(){return{segment_id:Number(m()("#move_to_segment").val())}},onSuccess:function(e){h.Z.Notice.success(h.Z.I18n.t("multipleSubscribersMovedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"addToList",label:h.Z.I18n.t("addToList"),onSelect:function(e,t){return X(e,t,{id:"add_to_segment",name:"add_to_segment",endpoint:"segments",filter:function(e){return!(e.deleted_at||"default"!==e.type)}},h.Z.I18n.t("addToList"))},getData:function(){return{segment_id:Number(m()("#add_to_segment").val())}},onSuccess:function(e){h.Z.Notice.success(h.Z.I18n.t("multipleSubscribersAddedToList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromList",label:h.Z.I18n.t("removeFromList"),onSelect:function(e,t){return X(e,t,{id:"remove_from_segment",name:"remove_from_segment",endpoint:"segments",filter:function(e){return!("default"!==e.type)}},h.Z.I18n.t("removeFromList"))},getData:function(){return{segment_id:Number(m()("#remove_from_segment").val())}},onSuccess:function(e){h.Z.Notice.success(h.Z.I18n.t("multipleSubscribersRemovedFromList").replace("%1$d",Number(e.meta.count).toLocaleString()).replace("%2$s",e.meta.segment))}},{name:"removeFromAllLists",label:h.Z.I18n.t("removeFromAllLists"),onSuccess:function(e){h.Z.Notice.success(h.Z.I18n.t("multipleSubscribersRemovedFromAllLists").replace("%1$d",Number(e.meta.count).toLocaleString()))}},{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Q.onTrash},{name:"unsubscribe",label:h.Z.I18n.t("unsubscribe"),onSelect:(e,t,n)=>{const a="all"!==n.selection?n.selected_ids.length:n.count;return o().createElement(I.Z,{title:h.Z.I18n.t("unsubscribe"),onRequestClose:t,isDismissible:!0},o().createElement("p",null,h.Z.I18n.t("unsubscribeConfirm").replace("%s",a.toLocaleString())),o().createElement("span",{className:"mailpoet-gap-half"}),o().createElement(b.Z,{onClick:e,dimension:"small",variant:"secondary",automationId:"bulk-unsubscribe-confirm"},h.Z.I18n.t("apply")))}}],ee=[{name:"statistics",label:h.Z.I18n.t("statsListingActionTitle"),link:function(e,t){return o().createElement(u.rU,{to:{pathname:`/stats/${e.id}`,state:{backUrl:t?.pathname}}},h.Z.I18n.t("statsListingActionTitle"))}},{name:"edit",label:h.Z.I18n.t("edit"),link:function(e,t){return o().createElement(u.rU,{to:{pathname:`/edit/${e.id}`,state:{backUrl:t?.pathname}}},h.Z.I18n.t("edit"))}},{name:"sendConfirmationEmail",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("resendConfirmationEmail"),display:function(e){return"unconfirmed"===e.status&&e.count_confirmations<window.mailpoet_max_confirmation_emails},onClick:function(e){return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"subscribers",action:"sendConfirmationEmail",data:{id:e.id}}).done((()=>h.Z.Notice.success(h.Z.I18n.t("oneConfirmationEmailSent")))).fail((e=>h.Z.Notice.showApiErrorNotice(e)))}},{name:"trash",className:"mailpoet-hide-on-mobile"}],te=e=>0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user);function ne(e){let{match:t}=e;const n=(0,d.useLocation)();return o().createElement("div",null,o().createElement(B,null),o().createElement(j,{subscribersInPlan:h.Z.subscribersCount,subscribersInPlanLimit:h.Z.subscribersLimit}),o().createElement(O,null),o().createElement(L,null),o().createElement(P,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),o().createElement(F,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:n,params:t.params,endpoint:"subscribers",onRenderItem:(e,t)=>{const a=g()("manage-column","column-primary","has-row-actions","column-username");let r="";switch(e.status){case"subscribed":r=h.Z.I18n.t("subscribed");break;case"unconfirmed":r=h.Z.I18n.t("unconfirmed");break;case"unsubscribed":r=h.Z.I18n.t("unsubscribed");break;case"inactive":r=h.Z.I18n.t("inactive");break;case"bounced":r=h.Z.I18n.t("bounced");break;default:r="Invalid"}const i=[];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&&i.push(t)})),o().createElement("div",null,o().createElement("td",{className:a},o().createElement(u.rU,{className:"mailpoet-listing-title",to:{pathname:`/edit/${e.id}`,state:{backUrl:n?.pathname}}},e.email),o().createElement("div",{className:"mailpoet-listing-subtitle"},e.first_name," ",e.last_name),t),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},r),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("lists")},o().createElement(E,{segments:i,dimension:"large"})),!0===K?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statisticsColumn")},o().createElement("div",{className:"mailpoet-listing-stats"},o().createElement("a",{key:`stats-link-${e.id}`,href:`#/stats/${e.id}`},o().createElement(z,{id:e.id,engagementScore:e.engagement_score})))):null,o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribedOn")},h.Z.Date.short(e.created_at),o().createElement("br",null),h.Z.Date.time(e.created_at)))},columns:G,bulk_actions:J,item_actions:ee,messages:Q,sort_by:"created_at",sort_order:"desc",isItemDeletable:te}))}ne.propTypes={match:y().shape({params:y().object}).isRequired};var ae=ne,re=n(30381),ie=n.n(re),se=n(17123),oe=n.n(se),le=n(60017);class ce extends o().Component{render(){const e=this.props.field.name||null,t=this.props.item||{};let n,a;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&&(a=this.props.field.defaultValue);let r=this.props.field.id||null;!r&&this.props.field.name&&(r=`field_${this.props.field.name}`);let i=this.props.field.className||null;return i||this.props.field.size||(i="regular-text"),o().createElement(le.Z,(0,S.Z)({type:"text",disabled:void 0!==this.props.field.disabled&&this.props.field.disabled(this.props.item),className:i,size:"auto"!==this.props.field.size&&this.props.field.size>0?this.props.field.size:null,name:e,id:r,value:n,defaultValue:a,placeholder:this.props.field.placeholder,onChange:this.props.onValueChange,customLabel:this.props.field.customLabel,tooltip:this.props.field.tooltip},this.props.field.validation))}}ce.propTypes={onValueChange:y().func,field:y().shape({name:y().string.isRequired,defaultValue:y().string,id:y().string,className:y().string,size:y().oneOfType([y().string,y().number]),disabled:y().func,placeholder:y().string,validation:y().shape({"data-parsley-required":y().bool,"data-parsley-required-message":y().string,"data-parsley-type":y().string,"data-parsley-errors-container":y().string,maxLength:y().number}),customLabel:y().string,tooltip:y().string}).isRequired,item:y().object.isRequired},ce.defaultProps={onValueChange:function(){}};var ue=ce,de=n(97972);function pe(e){return o().createElement(de.Z,(0,S.Z)({type:"text",name:e.field.name,id:`field_${e.field.name}`,value:e.item[e.field.name],placeholder:e.field.placeholder,defaultValue:e.field.defaultValue,onChange:e.onValueChange,className:e.field.className,customLabel:e.field.customLabel,tooltip:e.field.tooltip},e.field.validation))}pe.propTypes={item:y().object.isRequired,field:y().shape({name:y().string,placeholder:y().string,defaultValue:y().string,validation:y().shape({"data-parsley-required":y().bool,"data-parsley-required-message":y().string,"data-parsley-type":y().string,"data-parsley-errors-container":y().string,maxLength:y().number}),className:y().string,customLabel:y().string,tooltip:y().string}).isRequired,onValueChange:y().func.isRequired};var me=pe,he=n(2141);class fe extends o().Component{render(){if(void 0===this.props.field.values)return!1;let e,t=!1,n=!1,a=!1;void 0!==this.props.field.placeholder&&(n=o().createElement("option",{value:""},this.props.field.placeholder)),void 0!==this.props.field.filter&&(t=this.props.field.filter),T.ZP.isFunction(this.props.field.sortBy)&&(a=this.props.field.sortBy),e=a?T.ZP.map(T.ZP.sortBy(T.ZP.pairs(this.props.field.values),(e=>a(e[0],e[1]))),(e=>e[0])):Object.keys(this.props.field.values);const r=e.filter((e=>!1===t||t(this.props.item,e))).map((e=>o().createElement("option",{key:`option-${e}`,value:e},this.props.field.values[e])));return o().createElement(he.Z,(0,S.Z)({name:this.props.field.name,id:`field_${this.props.field.name}`,value:this.props.item[this.props.field.name]||"",onChange:this.props.onValueChange,automationId:this.props.automationId},this.props.field.validation),n,r)}}fe.propTypes={onValueChange:y().func,field:y().shape({name:y().string.isRequired,values:y().objectOf(y().string),placeholder:y().string,filter:y().func,sortBy:y().func,validation:y().shape({"data-parsley-required":y().bool,"data-parsley-required-message":y().string,"data-parsley-type":y().string,"data-parsley-errors-container":y().string,maxLength:y().number})}).isRequired,item:y().object.isRequired,automationId:y().string},fe.defaultProps={automationId:"",onValueChange:function(){}};var ge=fe,ve=n(84868);class ye extends o().Component{constructor(e){super(e),(0,k.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=>o().createElement("p",{key:`radio-${t}`},o().createElement(ve.Z,{checked:e===t,value:t,onCheck:this.onValueChange,name:this.props.field.name},this.props.field.values[t]))));return o().createElement("div",null,t)}}ye.propTypes={onValueChange:y().func,field:y().shape({name:y().string.isRequired,values:y().objectOf(y().string)}).isRequired,item:y().object.isRequired},ye.defaultProps={onValueChange:function(){}};var be=ye,we=n(16277);class _e extends o().Component{constructor(e){super(e),(0,k.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=>o().createElement("p",{key:`checkbox-${t}`},o().createElement(we.Z,{value:"1",checked:e,name:this.props.field.name,onCheck:this.onValueChange},this.props.field.values[t]))));return o().createElement("div",null,t)}}_e.propTypes={onValueChange:y().func.isRequired,field:y().shape({name:y().string.isRequired,values:y().objectOf(y().string)}).isRequired,item:y().object.isRequired};var Ee=_e;function Ze(e){const t=[];void 0!==e.placeholder&&t.push(o().createElement("option",{value:"",key:0},e.placeholder));const n=ie()().year();for(let e=n;e>=n-100;e-=1)t.push(o().createElement("option",{key:e,value:e},e));return o().createElement(he.Z,{isMinWidth:!0,name:`${e.name}[year]`,value:e.year,onChange:e.onValueChange},t)}function Ie(e){const t=[];void 0!==e.placeholder&&t.push(o().createElement("option",{value:"",key:0},e.placeholder));for(let n=1;n<=12;n+=1)t.push(o().createElement("option",{key:n,value:n},e.monthNames[n-1]));return o().createElement(he.Z,{isMinWidth:!0,name:`${e.name}[month]`,value:e.month,onChange:e.onValueChange},t)}function Se(e){const t=[];void 0!==e.placeholder&&t.push(o().createElement("option",{value:"",key:0},e.placeholder));for(let e=1;e<=31;e+=1)t.push(o().createElement("option",{key:e,value:e},e));return o().createElement(he.Z,{isMinWidth:!0,name:`${e.name}[day]`,value:e.day,onChange:e.onValueChange},t)}Ze.propTypes={name:y().string.isRequired,placeholder:y().string.isRequired,onValueChange:y().func.isRequired,year:y().oneOfType([y().string,y().number]).isRequired},Ie.propTypes={name:y().string.isRequired,placeholder:y().string.isRequired,onValueChange:y().func.isRequired,month:y().oneOfType([y().string,y().number]).isRequired,monthNames:y().arrayOf(y().string).isRequired},Se.propTypes={name:y().string.isRequired,placeholder:y().string.isRequired,onValueChange:y().func.isRequired,day:y().oneOfType([y().string,y().number]).isRequired};class ke extends o().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,a=null;if(null!==t&&3===t.length){[,n,a]=t;const r=Number(e.target.value);this.setState({[`${a}`]:r},(()=>{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=ie()(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 o().createElement(Ze,{onValueChange:this.onValueChange,key:"year",name:this.props.field.name,year:this.state.year,placeholder:this.props.field.year_placeholder});case"MM":return o().createElement(Ie,{onValueChange:this.onValueChange,key:"month",name:this.props.field.name,month:this.state.month,monthNames:e,placeholder:this.props.field.month_placeholder});case"DD":return o().createElement(Se,{onValueChange:this.onValueChange,key:"day",name:this.props.field.name,day:this.state.day,placeholder:this.props.field.day_placeholder});default:return o().createElement("div",null,"Invalid date type")}}));return o().createElement("div",null,n)}}ke.propTypes={item:y().object.isRequired,field:y().shape({name:y().string,day_placeholder:y().string,month_placeholder:y().string,year_placeholder:y().string,params:y().object}).isRequired,onValueChange:y().func.isRequired};var Te=ke,Ce=n(22529);class Ne extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"renderField",(e=>{let t,n=!1;e.field.description&&(n=o().createElement("p",{className:"description"},e.field.description));let a=e.field;switch(void 0!==e.field.field&&(a=m().merge(a,e.field.field)),a.type){case"text":t=o().createElement(ue,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"textarea":t=o().createElement(me,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"select":t=o().createElement(ge,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"radio":t=o().createElement(be,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"checkbox":t=o().createElement(Ee,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"selection":t=o().createElement(N,{key:`selection-field-${a.name}`,onValueChange:e.onValueChange,field:e.field,automationId:e.automationId,inline:e.inline,description:e.description,item:e.item});break;case"date":t=o().createElement(Te,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"reactComponent":t=o().createElement(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 o().createElement("div",{className:"mailpoet-form-field",key:`field-${e.index||0}`},t,n)}))}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=o().createElement(Ce.Z,{level:4},o().createElement("label",{htmlFor:`field_${this.props.field.name}`},this.props.field.label)));let n=!1;return this.props.field.tip&&(n=o().createElement("p",{className:"mailpoet-form-description"},this.props.field.tip)),o().createElement("div",{className:`mailpoet-form-field-${this.props.field.name} form-field-row-${this.props.field.name}`},t,n,e)}}Ne.propTypes={onValueChange:y().func,field:y().shape({name:y().string.isRequired,values:y().objectOf(y().string),tip:y().oneOfType([y().array,y().string]),label:y().string,fields:y().arrayOf(y().object),description:y().string}).isRequired,item:y().object.isRequired},Ne.defaultProps={onValueChange:function(){}};var De=Ne,xe=n(73816);class Re extends o().Component{constructor(e){super(e),(0,k.Z)(this,"getValues",(()=>this.props.item||this.state.item)),(0,k.Z)(this,"getErrors",(()=>this.props.errors||this.state.errors)),(0,k.Z)(this,"loadItem",(e=>{this.setState({loading:!0}),this.props.endpoint&&h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:this.props.endpoint,action:"get",data:{id:e}}).done((e=>{this.setState({loading:!1,item:e.data}),"function"==typeof this.props.onItemLoad&&this.props.onItemLoad(e.data)})).fail((()=>{this.setState({loading:!1,item:{}},(function(){this.props.history.push("/lists")}))}))})),(0,k.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&&h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:this.props.endpoint,action:"save",data:t}).always((()=>{this.setState({loading:!1})})).done((()=>{void 0!==this.props.onSuccess?this.props.onSuccess():this.props.history.push("/"),void 0!==this.props.params.id?this.props.messages.onUpdate():this.props.messages.onCreate()})).fail((e=>{e.errors.length>0&&this.setState({errors:e.errors})}))})),(0,k.Z)(this,"handleValueChange",(e=>{const{name:t,value:n}=e.target;return this.props.onChange?this.props.onChange(e):(this.setState((e=>{const a=e.item;return a[t]=n,{item:a}})),!0)})),this.formRef=o().createRef(),this.state={loading:!1,errors:[],item:{}}}componentDidMount(){void 0!==this.props.params.id?this.loadItem(this.props.params.id):oe()((()=>{this.setState({item:m()(".mailpoet_form").mailpoetSerializeObject()})}))}componentDidUpdate(e){void 0===this.props.params.id&&e.location.pathname!==this.props.location.pathname&&(oe()((()=>{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=>o().createElement("div",{className:"mailpoet_notice notice inline error is-dismissible",key:`error-${e.message}`},o().createElement("p",null,e.message)))));const t=g()("mailpoet_form",{mailpoet_form_loading:this.state.loading||this.props.loading});let n=!1,a=!1;void 0!==this.props.beforeFormContent&&(n=this.props.beforeFormContent(this.getValues())),void 0!==this.props.afterFormContent&&(a=this.props.afterFormContent(this.getValues()));const r=this.props.fields.map((e=>{let t=this.handleValueChange;return e.onBeforeChange&&(t=t=>(e.onBeforeChange(t),this.handleValueChange(t))),o().createElement(De,{field:e,item:this.getValues(),onValueChange:t,key:`field-${e.name}`,automationId:e.automationId})}));let i=!1;return i=this.props.children?this.props.children:o().createElement(xe.Button,{type:"submit",isDisabled:this.state.loading},h.Z.I18n.t("save")),o().createElement("div",null,o().createElement("div",{className:"mailpoet-form-content-around"},n),o().createElement("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},e,o().createElement("div",{className:"mailpoet-form-grid"},r,o().createElement("div",{className:"mailpoet-form-actions"},i))),o().createElement("div",{className:"mailpoet-form-content-around"},a))}}Re.propTypes={params:y().shape({id:y().string}),location:y().shape({pathname:y().string}),item:y().object,errors:y().arrayOf(y().object),endpoint:y().string,fields:y().arrayOf(y().object),messages:y().shape({onUpdate:y().func,onCreate:y().func}),loading:y().bool,children:y().array,id:y().string,automationId:y().string,beforeFormContent:y().func,afterFormContent:y().func,onItemLoad:y().func,isValid:y().func,onChange:y().func,onSubmit:y().func,onSuccess:y().func,history:y().shape({push:y().func.isRequired}).isRequired},Re.defaultProps={params:{},location:{},errors:void 0,fields:void 0,item:void 0,onItemLoad:void 0,isValid:void 0,onSuccess:void 0,onChange:void 0,loading:!1,beforeFormContent:void 0,afterFormContent:void 0,children:void 0,id:"",onSubmit:void 0,automationId:"",messages:{onUpdate:()=>{},onCreate:()=>{}},endpoint:void 0};var Oe=(0,d.withRouter)(Re),Ae=n(86529),Pe=n(71014);const Me=[{name:"email",label:h.Z.I18n.t("email"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"first_name",label:h.Z.I18n.t("firstname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"last_name",label:h.Z.I18n.t("lastname"),type:"text",disabled:function(e){return Number(e.wp_user_id>0)||1===Number(e.is_woocommerce_user)}},{name:"status",label:h.Z.I18n.t("status"),type:"select",automationId:"subscriber-status",values:{subscribed:h.Z.I18n.t("subscribed"),unconfirmed:h.Z.I18n.t("unconfirmed"),unsubscribed:h.Z.I18n.t("unsubscribed"),inactive:h.Z.I18n.t("inactive"),bounced:h.Z.I18n.t("bounced")}},{name:"segments",label:h.Z.I18n.t("lists"),type:"selection",placeholder:h.Z.I18n.t("selectList"),tip:h.Z.I18n.t("welcomeEmailTip"),api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,selected:function(e){return!1===Array.isArray(e.subscriptions)?null:e.subscriptions.filter((e=>"subscribed"===e.status)).map((e=>e.segment_id))},filter:function(e){return!e.deleted_at&&"default"===e.type},getLabel:function(e){return e.name},getCount:function(e){return e.subscribers},getSearchLabel:function(e,t){let n="";return void 0!==t.subscriptions&&t.subscriptions.forEach((t=>{if(e.id===t.segment_id&&(n=e.name,"unsubscribed"===t.status)){const e=h.Z.Date.format(t.updated_at);n+=" (%1$s)".replace("%1$s",h.Z.I18n.t("unsubscribedOn").replace("%1$s",e))}})),n}}];(window.mailpoet_custom_fields||[]).forEach((e=>{const t={name:`cf_${e.id}`,label:e.name,type:e.type};switch(e.params&&(t.params=e.params,e.params.values&&(t.values=e.params.values)),e.type){case"date":t.year_placeholder=h.Z.I18n.t("year"),t.month_placeholder=h.Z.I18n.t("month"),t.day_placeholder=h.Z.I18n.t("day");break;case"select":t.placeholder="-";break;default:t.placeholder=""}Me.push(t)}));const Le={onUpdate:function(){h.Z.Notice.success(h.Z.I18n.t("subscriberUpdated"))},onCreate:function(){h.Z.Notice.success(h.Z.I18n.t("subscriberAdded")),h.Z.trackEvent("Subscribers > Add new")}};function Fe(e){if(Number(e.wp_user_id)>0)return o().createElement("p",{className:"description"},x()(h.Z.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,((t,n)=>o().createElement("a",{key:n,href:`user-edit.php?user_id=${e.wp_user_id}`},t))))}function qe(e){return o().createElement(o().Fragment,null,e?.unsubscribes?.map((e=>{const t=ie()(e.createdAt.date).format("dddd MMMM Do YYYY [at] h:mm:ss a");let n;return n="admin"===e.source?h.Z.I18n.t("unsubscribedAdmin").replace("%1$d",t).replace("%2$d",e.meta):"manage"===e.source?h.Z.I18n.t("unsubscribedManage").replace("%1$d",t):"newsletter"===e.source?x()(h.Z.I18n.t("unsubscribedNewsletter").replace("%1$d",t),/\[link\]/g,((t,n)=>o().createElement("a",{key:n,href:`admin.php?page=mailpoet-newsletter-editor&id=${e.newsletterId}`},e.newsletterSubject))):h.Z.I18n.t("unsubscribedUnknown").replace("%1$d",t),o().createElement("p",{className:"description",key:n},n)})),o().createElement("p",{className:"description"},o().createElement("strong",null,h.Z.I18n.t("tip"))," ",h.Z.I18n.t("customFieldsTip")))}function $e(e){let{match:t}=e;const n=(0,d.useLocation)(),a=(0,d.useHistory)(),r=n.state?.backUrl||"/";return o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(Pe.Z,null),o().createElement(Ce.Z,{level:1,className:"mailpoet-title"},o().createElement("span",null,h.Z.I18n.t("subscriber")),o().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:r},h.Z.I18n.t("backToList"))),o().createElement(O,null),o().createElement(Oe,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:Me,params:t.params,messages:Le,beforeFormContent:Fe,afterFormContent:qe,onSuccess:()=>a.push(r)}))}$e.propTypes={match:y().shape({params:y().shape({id:y().string}).isRequired}).isRequired};var Ue=$e,je=n(5830),Ve=n(71304);function We(e){let{email:t}=e;const n=(0,d.useLocation)().state?.backUrl||"/";return o().createElement(Ce.Z,{level:1,className:"mailpoet-title"},o().createElement("span",null,h.Z.I18n.t("statsHeading").replace("%s",t)),o().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:n},h.Z.I18n.t("backToList")))}We.propTypes={email:y().string.isRequired};var Ye=n(83213);function Be(e){let{totalSent:t,open:n,machineOpen:a,click:r,subscriber:i}=e,s=0,l=0,c=0,u=0;const d=t-(n+a),p=t>0;return p&&(s=Math.round(n/t*100),l=Math.round(a/t*100),c=Math.round(r/t*100),u=Math.round(d/t*100)),o().createElement("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary"},o().createElement("div",{className:"mailpoet-listing"},o().createElement("table",{className:"mailpoet-listing-table"},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,h.Z.I18n.t("statsSentEmail")),o().createElement("td",null,o().createElement("b",null,t.toLocaleString())),o().createElement("td",null)),o().createElement("tr",null,o().createElement("td",null,o().createElement(w.Z,null,h.Z.I18n.t("statsOpened"))),o().createElement("td",null,o().createElement("b",null,n.toLocaleString())),o().createElement("td",null,p&&o().createElement(o().Fragment,null,s,"%"))),o().createElement("tr",null,o().createElement("td",null,o().createElement(w.Z,null,h.Z.I18n.t("statsMachineOpened")),o().createElement(Ye.Z,{tooltip:x()(h.Z.I18n.t("statsMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>o().createElement("span",{style:{pointerEvents:"all"},key:"machine-opened-info"},o().createElement("a",{href:"https://kb.mailpoet.com/article/368-what-are-machine-opens",key:"kb-link",target:"_blank","data-beacon-article":"6124b7fb21ef206e5592e188",rel:"noopener noreferrer"},e))))})),o().createElement("td",null,o().createElement("b",null,a.toLocaleString())),o().createElement("td",null,p&&o().createElement(o().Fragment,null,l,"%"))),o().createElement("tr",null,o().createElement("td",null,o().createElement(w.Z,{isInverted:!0},h.Z.I18n.t("statsClicked"))),o().createElement("td",null,o().createElement("b",null,r.toLocaleString())),o().createElement("td",null,p&&o().createElement(o().Fragment,null,c,"%"))),o().createElement("tr",null,o().createElement("td",null,h.Z.I18n.t("statsNotClicked")),o().createElement("td",null,o().createElement("b",null,d.toLocaleString())),o().createElement("td",null,p&&o().createElement(o().Fragment,null,u,"%"))),o().createElement("tr",null,o().createElement("td",null,h.Z.I18n.t("statisticsColumn")),o().createElement("td",null,o().createElement("div",{className:"mailpoet-listing-stats"},o().createElement(z,{id:i.id,engagementScore:i.engagement_score}))),o().createElement("td",null))))))}function He(e){let{revenueValue:t,count:n,averageRevenueValue:a}=e;return o().createElement("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary"},o().createElement("div",{className:"mailpoet-listing"},o().createElement("table",{className:"mailpoet-listing-table"},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,"Orders created"),o().createElement("td",null,o().createElement("b",null,n.toLocaleString()))),o().createElement("tr",null,o().createElement("td",null,"Total revenue"),o().createElement("td",null,o().createElement("b",null,t))),o().createElement("tr",null,o().createElement("td",null,"Average revenue"),o().createElement("td",null,o().createElement("b",null,a)))))))}Be.propTypes={totalSent:y().number.isRequired,open:y().number.isRequired,machineOpen:y().number.isRequired,click:y().number.isRequired,subscriber:y().shape({id:y().number.isRequired,engagement_score:y().number}).isRequired},He.propTypes={count:y().number.isRequired,revenueValue:y().string.isRequired,averageRevenueValue:y().string.isRequired};var ze=n(90074),Ke=n.n(ze),Ge=n(58901);function Qe(e){let{limitReached:t,limitValue:n,subscribersCountTowardsLimit:a,premiumActive:r,hasValidApiKey:i,hasPremiumSupport:s}=e;return o().createElement("table",{className:"mailpoet-listing-table","data-automation-id":"subscriber-stats-no-access"},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",null,h.Z.I18n.t("email")),o().createElement("th",null,h.Z.I18n.t("columnAction")),o().createElement("th",null,h.Z.I18n.t("columnCount")),o().createElement("th",null,h.Z.I18n.t("columnActionOn")))),o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{colSpan:4},o().createElement("div",{className:"mailpoet-subscriber-stats-no-access-content"},o().createElement(Ge.Z,{title:r&&t?h.Z.I18n.t("upgradeRequired"):h.Z.I18n.t("premiumFeature"),message:(()=>{let e=h.Z.I18n.t("premiumRequired");return r?(e=s?h.Z.I18n.t("planLimitReached"):h.Z.I18n.t("freeLimitReached"),o().createElement("p",null,x()(e,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?a:n)))):o().createElement("p",null,x()(e,/\[link](.*?)\[\/link]/g,(e=>o().createElement("a",{key:e,href:h.Z.premiumLink},e))))})(),actionButton:r&&t?o().createElement(b.Z,{href:i?h.Z.MailPoetComUrlFactory.getUpgradeUrl():h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(a+1)},h.Z.I18n.t("premiumBannerCtaUpgrade")):o().createElement(b.Z,{href:h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount,h.Z.currentWpUserEmail,null,{utm_medium:"stats",utm_campaign:"signup"})},h.Z.I18n.t("premiumBannerCtaFree"))}))))))}function Xe(e){let{params:t,location:n}=e;return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:4},h.Z.I18n.t("openedEmailsHeading")),!h.Z.premiumActive||h.Z.subscribersLimitReached?o().createElement(Qe,{limitReached:h.Z.subscribersLimitReached,limitValue:h.Z.subscribersLimit,subscribersCountTowardsLimit:h.Z.subscribersCount,premiumActive:h.Z.premiumActive,hasValidApiKey:h.Z.hasValidApiKey,hasPremiumSupport:h.Z.hasPremiumSupport}):Ke().applyFilters("mailpoet_subscribers_opened_emails_stats",t,n))}function Je(){const e=(0,d.useRouteMatch)(),t=(0,d.useLocation)(),[n,a]=(0,s.useState)(null),[r,i]=(0,s.useState)(!0),l=(0,Ve.S)(window).notices.error;return(0,s.useEffect)((()=>{h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"subscriberStats",action:"get",data:{subscriber_id:e.params.id}}).done((e=>{a(e.data),i(!1)})).fail((e=>{i(!1),e.errors.length>0&&l(o().createElement(o().Fragment,null,e.errors.map((e=>o().createElement("p",{key:e.message},e.message)))),{scroll:!0})}))}),[e.params.id,l]),r?o().createElement(je.Z,null):o().createElement("div",{className:"mailpoet-subscriber-stats"},o().createElement(We,{email:n.email}),o().createElement("p",null,h.Z.I18n.t("lastEngagement"),": ",n.last_engagement?h.Z.Date.format(n.last_engagement):h.Z.I18n.t("never")),o().createElement("div",{className:"mailpoet-subscriber-stats-summary-grid"},o().createElement(Be,{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&&o().createElement(He,{averageRevenueValue:n.woocommerce.formatted_average,count:n.woocommerce.count,revenueValue:n.woocommerce.formatted})),o().createElement(Xe,{params:e.params,location:t}))}Qe.propTypes={limitReached:y().bool.isRequired,limitValue:y().number.isRequired,subscribersCountTowardsLimit:y().number.isRequired,premiumActive:y().bool.isRequired,hasValidApiKey:y().bool.isRequired,hasPremiumSupport:y().bool.isRequired},Xe.propTypes={params:y().shape({id:y().string.isRequired}).isRequired};var et=n(93726);function tt(){return o().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},o().createElement(u.UT,null,o().createElement(et.Z,null),o().createElement(d.Switch,null,o().createElement(d.Route,{path:"/new",component:Ue}),o().createElement(d.Route,{path:"/edit/:id",component:Ue}),o().createElement(d.Route,{path:"/stats/:id/(.*)?",component:Je}),o().createElement(d.Route,{path:"*",component:ae}))))}const nt=document.getElementById("subscribers_container");nt&&c().render(o().createElement(tt,null),nt);var at=n(68345);class rt extends o().PureComponent{render(){const e=this.props.event,t=e.soon;let n;if(this.props.premium)n=o().createElement("a",{href:"?page=mailpoet-premium",target:"_blank"},h.Z.I18n.t("premiumFeatureLink"));else if(e.actionButtonLink&&e.actionButtonTitle)n=o().createElement("a",{href:e.actionButtonLink,target:"_blank",rel:"noopener noreferrer"},e.actionButtonTitle);else{const a=t?null:T.ZP.partial(this.props.eventsConfigurator,e.slug);n=o().createElement(b.Z,{disabled:t,onClick:a,role:"presentation",automationId:`create_${e.slug}`,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),a())}},e.actionButtonTitle||h.Z.I18n.t("setUp"))}return o().createElement("div",{"data-type":e.slug,className:"mailpoet-newsletter-type"},o().createElement("div",{className:"mailpoet-newsletter-type-image"},e.badge&&o().createElement(at.Z,{title:e.badge.text})),o().createElement("div",{className:"mailpoet-newsletter-type-content"},o().createElement(Ce.Z,{level:4},e.title," ",e.soon&&`(${h.Z.I18n.t("soon")})`),o().createElement("p",null,e.description),o().createElement("div",{className:"mailpoet-flex-grow"}),o().createElement("div",{className:"mailpoet-newsletter-type-action"},n)))}}rt.defaultProps={premium:!1},rt.propTypes={premium:y().bool,eventsConfigurator:y().func.isRequired,event:y().shape({slug:y().string.isRequired,actionButtonLink:y().string,title:y().string.isRequired,soon:y().bool,badge:y().shape({style:y().string,text:y().string}),description:y().string.isRequired,actionButtonTitle:y().string}).isRequired};var it=rt;class st extends o().Component{constructor(e){super(e),this.email=this.props.email,this.emailEvents=this.email.events,this.eventsConfigurator=this.eventsConfigurator.bind(this)}eventsConfigurator(e){h.Z.trackEvent("Emails > Automatic Type selected",{"Email type":e}),this.props.history.push(`/new/${this.email.slug}/${e}/conditions`)}render(){return T.ZP.map(this.emailEvents,((e,t)=>o().createElement(it,{premium:this.email.premium,event:e,key:t,eventsConfigurator:this.eventsConfigurator})))}}st.propTypes={email:y().shape({title:y().string.isRequired,slug:y().string.isRequired,premium:y().bool}).isRequired,history:y().shape({push:y().func.isRequired}).isRequired};var ot=(0,d.withRouter)(st),lt={woocommerce:o().createElement("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"}},o().createElement("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"}),o().createElement("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"}))},ct=n(33687);function ut(e){let{errors:t}=e;return t.length<1?null:o().createElement(R.Z,{type:"error",closable:!1},t.map((e=>o().createElement("p",{key:e.message},e.message))))}ut.propTypes={errors:y().arrayOf(y().shape({message:y().string.isRequired})).isRequired};var dt=ut;function pt(e){let{filter:t,history:n,hideClosingButton:a=!1,hideScreenOptions:r=!0}=e;const[i,l]=(0,s.useState)(!1),c=e=>{void 0!==e&&(n.push(`/new/${e}`),h.Z.trackEvent("Emails > Type selected",{"Email type":e}))},u=async()=>{h.Z.trackEvent("Emails > Type selected",{"Email type":"wc_transactional"});let e=window.mailpoet_woocommerce_transactional_email_id;if(!e)try{e=(await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"settings",action:"set",data:{"woocommerce.use_mailpoet_editor":1}})).data.woocommerce.transactional_email_id,h.Z.trackEvent("Emails > WooCommerce email customizer enabled")}catch(e){return e.errors.length>0?o().createElement(dt,{errors:e.errors}):null}return window.location.href=`?page=mailpoet-newsletter-editor&id=${e}`,null},d=e=>{const t=!0===window.mailpoet_is_new_user?"mailpoet_badge mailpoet_badge_video":"mailpoet_badge mailpoet_badge_video mailpoet_badge_video_grey";return o().createElement("div",{key:e.slug,"data-type":e.slug,className:"mailpoet-newsletter-type"},o().createElement("div",{className:"mailpoet-newsletter-type-image"}),o().createElement("div",{className:"mailpoet-newsletter-type-content"},o().createElement(Ce.Z,{level:4},e.title," ",e.beta?`(${h.Z.I18n.t("beta")})`:""),o().createElement("p",null,e.description),e.videoGuide&&o().createElement("a",{className:t,href:e.videoGuide,"data-beacon-article":e.videoGuideBeacon,target:"_blank",rel:"noopener noreferrer"},o().createElement("span",{className:"dashicons dashicons-format-video"}),h.Z.I18n.t("seeVideoGuide")),o().createElement("div",{className:"mailpoet-flex-grow"}),o().createElement("div",{className:"mailpoet-newsletter-type-action"},e.action)))},p=T.ZP.partial((e=>{l(!0),h.Z.trackEvent("Emails > Type selected",{"Email type":e}),h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"newsletters",action:"create",data:{type:e,subject:h.Z.I18n.t("draftNewsletterTitle")}}).done((e=>{n.push(`/template/${e.data.id}`)})).fail((e=>(l(!1),e.errors.length>0?o().createElement(dt,{errors:e.errors}):null)))}),"standard"),m=T.ZP.partial(c,"notification"),f=T.ZP.partial(c,"welcome"),g=T.ZP.partial(c,"re-engagement"),v=[{slug:"standard",title:h.Z.I18n.t("regularNewsletterTypeTitle"),description:h.Z.I18n.t("regularNewsletterTypeDescription"),action:o().createElement(b.Z,{automationId:"create_standard",onClick:p,tabIndex:0,withSpinner:i,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),p())}},h.Z.I18n.t("create"))},{slug:"welcome",title:h.Z.I18n.t("welcomeNewsletterTypeTitle"),description:h.Z.I18n.t("welcomeNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/254-video-guide-to-welcome-emails",videoGuideBeacon:"5b05ebf20428635ba8b2aa53",action:o().createElement(b.Z,{onClick:f,automationId:"create_welcome",withSpinner:i,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),f())},tabIndex:0},h.Z.I18n.t("setUp"))},{slug:"notification",title:h.Z.I18n.t("postNotificationNewsletterTypeTitle"),description:h.Z.I18n.t("postNotificationNewsletterTypeDescription"),videoGuide:"https://kb.mailpoet.com/article/210-video-guide-to-post-notifications",videoGuideBeacon:"59ba6fb3042863033a1cd5a5",action:o().createElement(b.Z,{automationId:"create_notification",onClick:m,withSpinner:i,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),m())}},h.Z.I18n.t("setUp"))},{slug:"re_engagement",title:h.Z.I18n.t("tabReEngagementTitle"),description:h.Z.I18n.t("reEngagementDescription"),action:o().createElement(b.Z,{automationId:"create_notification",onClick:g,withSpinner:i,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),g())}},h.Z.I18n.t("setUp"))}];let y=Ke().applyFilters("mailpoet_newsletters_types",[...v],this);t&&(y=y.filter(t));const w=h.Z.Ajax.constructGetUrl({api_version:h.Z.apiVersion,endpoint:"newsletterTemplates",action:"getAll"});return o().createElement(o().Fragment,null,r&&o().createElement(Pe.Z,null),o().createElement("link",{rel:"prefetch",href:window.mailpoet_editor_javascript_url,as:"script"}),o().createElement("div",{className:"mailpoet-newsletter-types"},!a&&o().createElement("div",{className:"mailpoet-newsletter-types-close"},o().createElement("button",{type:"button",onClick:()=>n.push("/"),className:"mailpoet-modal-close"},ct.Z)),y.map((e=>d(e)),this),(()=>{if(!window.mailpoet_woocommerce_automatic_emails)return[];let e=window.mailpoet_woocommerce_automatic_emails;return t&&(e=T.ZP.filter(e,t)),T.ZP.map(e,(e=>{const a=e;return o().createElement(o().Fragment,{key:a.slug},!t&&o().createElement("div",{className:"mailpoet-newsletter-types-separator"},o().createElement("div",{className:"mailpoet-newsletter-types-separator-line"}),o().createElement("div",{className:"mailpoet-newsletter-types-separator-logo"},lt[a.slug]||null),o().createElement("div",{className:"mailpoet-newsletter-types-separator-line"})),o().createElement(ot,{email:a,history:n}),"woocommerce"===a.slug&&(h.Z.isWoocommerceActive?[{slug:"wc_transactional",title:h.Z.I18n.t("wooCommerceCustomizerTypeTitle"),description:h.Z.I18n.t("wooCommerceCustomizerTypeDescription"),action:o().createElement(b.Z,{automationId:"customize_woocommerce",onClick:u,tabIndex:0,onKeyDown:async e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),await u())}},h.Z.I18n.t("customize"))}]:[]).map((e=>d(e)),this))}))})()),o().createElement("link",{rel:"prefetch",href:w,as:"fetch"}))}pt.propTypes={filter:y().func,hideScreenOptions:y().bool,hideClosingButton:y().bool},pt.defaultProps={filter:null,hideScreenOptions:!0,hideClosingButton:!1};var mt=(0,d.withRouter)(pt),ht=n(21526),ft=(0,d.withRouter)((e=>o().createElement(ht.Z,e))),gt=n(80416),vt=n(12912),yt=n(9185);class bt extends o().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:a}=this.props;(0,yt.Z)({message:h.Z.I18n.t("confirmTemplateDeletion").replace("%1$s",t),onConfirm:()=>{n(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"delete",data:{id:e}}).done((()=>{a(!0,e)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0}),a(!1)}))}})}onPreview(){h.Z.Modal.popup({title:this.props.name,template:'<img src="{{ thumbnail }}" />',data:this.props})}onSelect(){const{newsletterId:e,name:t,beforeSelect:n,afterSelect:a}=this.props;n(),h.Z.trackEvent("Emails > Template selected",{"Email name":t}),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:{id:e,template_id:this.props.id}}).done((e=>{a(!0,e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0}),a(!1)}))}render(){const{index:e,name:t,thumbnail:n,readonly:a}=this.props;let r="";return"string"==typeof n&&n.length>0&&(r=o().createElement("a",{className:"mailpoet-template-preview",href:"#",onClick:e=>{e.preventDefault(),this.onPreview(e)}},o().createElement("div",{className:"mailpoet-template-thumbnail"},n?o().createElement("img",{src:n,alt:h.Z.I18n.t("templatePreview"),loading:"lazy"}):""),o().createElement("div",{className:"mailpoet-template-preview-overlay"},o().createElement(b.Z,null,h.Z.I18n.t("zoom"))))),o().createElement(vt.Z,{label:t,onSelect:this.onSelect,onDelete:!1===a?this.onDelete:void 0,automationId:`select_template_${e}`,className:"mailpoet-template-two-lines"},r)}}bt.contextType=Ve.k,bt.propTypes={index:y().number.isRequired,id:y().number.isRequired,newsletterId:y().string.isRequired,name:y().string.isRequired,thumbnail:y().string,readonly:y().bool.isRequired,beforeDelete:y().func.isRequired,afterDelete:y().func.isRequired,beforeSelect:y().func.isRequired,afterSelect:y().func.isRequired},bt.defaultProps={thumbnail:null};var wt=bt;class _t extends o().Component{constructor(e){super(e),this.fileRef=o().createRef(),this.handleSubmit=this.handleSubmit.bind(this)}handleSubmit(e){if(e.preventDefault(),T.ZP.size(this.fileRef.current.files)<=0)return!1;const t=T.ZP.first(this.fileRef.current.files),n=new FileReader;return n.onload=e=>{try{this.saveTemplate(JSON.parse(e.target.result)),h.Z.trackEvent("Emails > Template imported")}catch(e){this.context.notices.error(o().createElement("p",null,h.Z.I18n.t("templateFileMalformedError")))}},n.readAsText(t),!0}saveTemplate(e){const t=e,{beforeImport:n,afterImport:a}=this.props;T.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(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:t}).done((e=>{a(!0,e.data)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0}),a(!1)}))}render(){return o().createElement("div",{className:"mailpoet-template-import"},o().createElement("h4",null,h.Z.I18n.t("importTemplateTitle"),o().createElement($(),{tooltip:h.Z.I18n.t("helpTooltipTemplateUpload"),place:"right",className:"tooltip-help-import-template"})),o().createElement("form",{onSubmit:this.handleSubmit},o().createElement("input",{type:"file",placeholder:h.Z.I18n.t("selectJsonFileToUpload"),ref:this.fileRef}),o().createElement("p",{className:"submit"},o().createElement("input",{className:"button button-primary",type:"submit",value:h.Z.I18n.t("upload")}))))}}_t.contextType=Ve.k,_t.propTypes={beforeImport:y().func.isRequired,afterImport:y().func.isRequired};var Et=_t;const Zt=[];window.mailpoet_newsletters_templates_recently_sent_count&&Zt.push({name:"recent",label:h.Z.I18n.t("recentlySent")}),Zt.push({name:"standard",label:h.Z.I18n.t("tabStandardTitle")},{name:"welcome",label:h.Z.I18n.t("tabWelcomeTitle")},{name:"notification",label:h.Z.I18n.t("tabNotificationTitle")},{name:"re_engagement",label:h.Z.I18n.t("tabReEngagementTitle")},{name:"blank",label:h.Z.I18n.t("tabBlankTitle")}),window.mailpoet_woocommerce_active&&Zt.push({name:"woocommerce",label:h.Z.I18n.t("tabWoocommerceTitle")}),Zt.push({name:"saved",label:h.Z.I18n.t("savedTemplates")});class It extends o().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(){h.Z.Ajax.get({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"getAll"}).done((e=>{0===e.data.length&&(e.data=[{name:h.Z.I18n.t("mailpoetGuideTemplateTitle"),categories:'["welcome", "notification", "standard", "woocommerce"]',readonly:!0}]),e.data.forEach(this.addTemplate),this.sortTemplates()})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0})})).always((()=>{this.selectInitialTab()}))}addTemplate(e){const t=Zt.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,a)=>{if(e.includes(t)){if(n.categories.includes('"blank"')&&!a.categories.includes('"blank"'))return-1;if(!n.categories.includes('"blank"')&&a.categories.includes('"blank"'))return 1}return n.id<a.id?1:-1}))}))}selectInitialTab(){let e,t="standard";h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:this.props.match.params.id}}).done((n=>{e=n.data.type,"automatic"===e&&(e=n.data.options.group||e),window.mailpoet_newsletters_templates_recently_sent_count?t="recent":T.ZP.findWhere(Zt,{name:n.data.type})?t=n.data.type:"automatic"===n.data.type&&T.ZP.findWhere(Zt,{name:n.data.options.group})&&(t=n.data.options.group)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key: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 o().createElement(je.Z,null);const e=Zt.concat({name:"import",label:h.Z.I18n.t("tabImportTitle")}).map((e=>Object.assign(e,{automationId:`templates-${e.name.replace(/\s+/g,"-").toLowerCase()}`})));let t=null;if("import"===this.state.selectedTab)t=o().createElement(Et,{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:o().createElement("p",null,h.Z.I18n.t("noTemplates")):e.map(((e,t)=>o().createElement(wt,{key:e.id,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}))),t=e}return o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(ft,{emailType:this.state.emailType,automationId:"email_template_selection_heading"}),o().createElement("div",{className:"mailpoet-templates"},o().createElement(gt.Z,{categories:e,active:this.state.selectedTab,onSelect:e=>this.setState({selectedTab:e})}),t))}}It.contextType=Ve.k,It.propTypes={match:y().shape({params:y().shape({id:y().string}).isRequired}).isRequired};var St=It,kt=n(11830),Tt=n(9198),Ct=n.n(Tt);function Nt(e){var t;let{dimension:n,isFullWidth:a,iconStart:r,iconEnd:i,...s}=e;return o().createElement("div",{className:g()("mailpoet-datepicker mailpoet-form-input",{[`mailpoet-form-input-${n}`]:n,"mailpoet-disabled":s.disabled,"mailpoet-full-width":a})},r,o().createElement(Ct(),(0,S.Z)({useWeekdaysShort:!0,calendarStartDay:null!==(t=s.calendarStartDay)&&void 0!==t?t:h.Z.wpWeekStartsOn},s)),i)}Nt.propTypes={dimension:y().oneOf(["small"]),isFullWidth:y().bool,iconStart:y().element,iconEnd:y().element};var Dt=Nt,xt=n(4958),Rt=n(16245),Ot=n.n(Rt);const At={abbreviated:[h.Z.I18n.t("januaryShort"),h.Z.I18n.t("februaryShort"),h.Z.I18n.t("marchShort"),h.Z.I18n.t("aprilShort"),h.Z.I18n.t("mayShort"),h.Z.I18n.t("juneShort"),h.Z.I18n.t("julyShort"),h.Z.I18n.t("augustShort"),h.Z.I18n.t("septemberShort"),h.Z.I18n.t("octoberShort"),h.Z.I18n.t("novemberShort"),h.Z.I18n.t("decemberShort")],wide:[h.Z.I18n.t("january"),h.Z.I18n.t("february"),h.Z.I18n.t("march"),h.Z.I18n.t("april"),h.Z.I18n.t("may"),h.Z.I18n.t("june"),h.Z.I18n.t("july"),h.Z.I18n.t("august"),h.Z.I18n.t("september"),h.Z.I18n.t("october"),h.Z.I18n.t("november"),h.Z.I18n.t("december")]},Pt={narrow:[h.Z.I18n.t("sundayMin"),h.Z.I18n.t("mondayMin"),h.Z.I18n.t("tuesdayMin"),h.Z.I18n.t("wednesdayMin"),h.Z.I18n.t("thursdayMin"),h.Z.I18n.t("fridayMin"),h.Z.I18n.t("saturdayMin")],abbreviated:[h.Z.I18n.t("sundayShort"),h.Z.I18n.t("mondayShort"),h.Z.I18n.t("tuesdayShort"),h.Z.I18n.t("wednesdayShort"),h.Z.I18n.t("thursdayShort"),h.Z.I18n.t("fridayShort"),h.Z.I18n.t("saturdayShort")],wide:[h.Z.I18n.t("sunday"),h.Z.I18n.t("monday"),h.Z.I18n.t("tuesday"),h.Z.I18n.t("wednesday"),h.Z.I18n.t("thursday"),h.Z.I18n.t("friday"),h.Z.I18n.t("saturday")]};xt.Z.localize.month=Ot()({values:At,defaultWidth:"wide"}),xt.Z.localize.day=Ot()({values:Pt,defaultWidth:"wide"}),xt.Z.options.weekStartsOn=void 0!==h.Z.wpWeekStartsOn?h.Z.wpWeekStartsOn:1,(0,Tt.registerLocale)("mailpoet",xt.Z);class Mt extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"onChange",((e,t)=>{const n=t,a=this.getStorageDate(e);n.target.name=this.getFieldName(),n.target.value=a,this.props.onChange(n)})),(0,k.Z)(this,"getFieldName",(()=>this.props.name||"date")),(0,k.Z)(this,"getDisplayDateFormat",(e=>h.Z.Date.convertFormat(e).replace(/D/g,"d").replace(/Y/g,"y").replace(/\[/g,"").replace(/\]/g,""))),(0,k.Z)(this,"getDate",(e=>{const t={parseFormat:this.props.storageFormat};return h.Z.Date.toDate(e,t)})),(0,k.Z)(this,"getStorageDate",(e=>{const t={format:this.props.storageFormat};return h.Z.Date.format(e,t)}))}render(){return o().createElement(Dt,(0,S.Z)({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))}}Mt.propTypes={displayFormat:y().string.isRequired,onChange:y().func.isRequired,name:y().string,storageFormat:y().string.isRequired,value:y().string.isRequired,disabled:y().bool.isRequired,validation:y().shape({"data-parsley-required":y().bool,"data-parsley-required-message":y().string,"data-parsley-type":y().string,"data-parsley-errors-container":y().string,maxLength:y().number}).isRequired,maxDate:y().instanceOf(Date)},Mt.defaultProps={name:"date",maxDate:null};var Lt=Mt;class Ft extends o().Component{render(){const e=Object.keys(this.props.timeOfDayItems).map((e=>o().createElement("option",{key:`option-${this.props.timeOfDayItems[e]}`,value:e},this.props.timeOfDayItems[e])));return o().createElement(he.Z,(0,S.Z)({name:this.props.name||"time",value:this.props.value,disabled:this.props.disabled,onChange:this.props.onChange,isMinWidth:!0},this.props.validation),e)}}Ft.propTypes={timeOfDayItems:y().objectOf(y().string).isRequired,name:y().string,value:y().string.isRequired,disabled:y().bool,onChange:y().func.isRequired,validation:y().object},Ft.defaultProps={name:"time",disabled:!1,validation:{}};var qt=Ft;class $t extends o().Component{constructor(e){super(e),(0,k.Z)(this,"DATE_TIME_SEPARATOR"," "),(0,k.Z)(this,"getDateTime",(()=>[this.state.date,this.state.time].join(this.DATE_TIME_SEPARATOR))),(0,k.Z)(this,"buildStateFromProps",(e=>{const t=e.value||this.props.defaultDateTime,[n,a]=t.split(this.DATE_TIME_SEPARATOR);return{date:n,time:a}})),(0,k.Z)(this,"handleChange",(e=>{const t={};t[e.target.name]=e.target.value,this.setState(t,this.propagateChange)})),(0,k.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||oe()((()=>{this.setState(this.buildStateFromProps(this.props))}))}render(){return o().createElement(kt.r.Column,{className:"mailpoet-datetime-container"},o().createElement(Lt,{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}),o().createElement(qt,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems}))}}$t.propTypes={value:y().string,defaultDateTime:y().string.isRequired,dateDisplayFormat:y().string.isRequired,dateStorageFormat:y().string.isRequired,onChange:y().func,name:y().string,disabled:y().bool,dateValidation:y().object.isRequired,timeValidation:y().any,timeOfDayItems:y().objectOf(y().string).isRequired,maxDate:y().instanceOf(Date)},$t.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0,value:void 0,maxDate:null};var Ut=$t,jt=n(43246);class Vt extends o().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 o().createElement(o().Fragment,null,o().createElement(ue,{item:{...this.props.item,sender_address:this.state.emailAddress},field:this.props.field,onValueChange:this.onChange}),o().createElement("div",{className:"regular-text"},o().createElement(jt.Z,{emailAddress:this.state.emailAddress,mssActive:window.mailpoet_mss_active})))}}Vt.propTypes={field:y().object.isRequired,item:y().shape({sender_address:y().string.isRequired}).isRequired,onValueChange:y().func},Vt.defaultProps={onValueChange:function(){}};var Wt=Vt;const Yt=T.ZP.once((()=>h.Z.trackEvent("User has typed a GA campaign name"))),Bt=x()(h.Z.I18n.t("gaCampaignTip"),/\[link\](.*?)\[\/link\]/g,((e,t)=>o().createElement("span",{key:t},o().createElement("br",null),o().createElement("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"},e))));var Ht={name:"ga_campaign",label:h.Z.I18n.t("gaCampaignLine"),tip:Bt,type:"text",onBeforeChange:Yt};function zt(e){let{dimension:t,onCheck:n,automationId:a,className:r,...i}=e;return o().createElement("label",{className:g()({[r]:r,"mailpoet-form-toggle":!0,[`mailpoet-form-toggle-${t}`]:t,"mailpoet-disabled":i.disabled}),"data-automation-id":a},o().createElement("input",(0,S.Z)({type:"checkbox",onChange:e=>n(e.target.checked,e)},i)),o().createElement("span",{className:"mailpoet-form-toggle-control"}))}zt.propTypes={dimension:y().oneOf(["small"]),onCheck:y().func.isRequired,automationId:y().string};var Kt=zt;const Gt=window.mailpoet_current_time||"00:00",Qt=`${window.mailpoet_tomorrow_date} 08:00:00`,Xt=window.mailpoet_schedule_time_of_day,Jt=window.mailpoet_date_display_format,en=window.mailpoet_date_storage_format;class tn extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"getCurrentValue",(()=>{const e={isScheduled:"0",scheduledAt:Qt};return T.ZP.defaults(this.props.item[this.props.field.name]||{},e)})),(0,k.Z)(this,"getDateValidation",(()=>({"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("noScheduledDateError"),"data-parsley-errors-container":"#mailpoet_scheduling"}))),(0,k.Z)(this,"isScheduled",(()=>"1"===this.getCurrentValue().isScheduled)),(0,k.Z)(this,"handleCheckboxChange",((e,t)=>{const n=t;return n.target.value=t.target.checked?"1":"0",this.handleValueChange(n)})),(0,k.Z)(this,"handleValueChange",(e=>{const t=this.getCurrentValue(),n={};return n[e.target.name]=e.target.value,this.props.onValueChange({target:{name:this.props.field.name,value:T.ZP.extend({},t,n)}})}))}render(){let e;const t=new Date;return t.setFullYear(t.getFullYear()+5),this.isScheduled()&&(e=o().createElement(o().Fragment,null,o().createElement("span",{className:"mailpoet-form-schedule-time"},h.Z.I18n.t("websiteTimeIs")," ",Gt),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{id:"mailpoet_scheduling"},o().createElement(Ut,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:Qt,timeOfDayItems:Xt,dateDisplayFormat:Jt,dateStorageFormat:en,maxDate:t})))),o().createElement("div",null,o().createElement(Kt,{checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onCheck:this.handleCheckboxChange,automationId:"email-schedule-checkbox"}),e)}}tn.propTypes={item:y().object,field:y().shape({name:y().string.isRequired,disabled:y().bool}).isRequired,onValueChange:y().func.isRequired},tn.defaultProps={item:{}};let nn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:h.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:h.Z.I18n.t("subjectLine"),tooltip:h.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:h.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:h.Z.I18n.t("preheaderLine"),tooltip:`${h.Z.I18n.t("preheaderLineTip1")} ${h.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"segments",label:h.Z.I18n.t("segments"),tip:h.Z.I18n.t("segmentsTip"),type:"selection",placeholder:h.Z.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return T.ZP.map(e,(e=>T.ZP.find(t,(t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("noSegmentsSelectedError")}},{name:"options",label:h.Z.I18n.t("scheduleIt"),type:"reactComponent",component:tn},{name:"sender",label:h.Z.I18n.t("sender"),tip:h.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:h.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Wt,placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Ht,{name:"reply-to",label:h.Z.I18n.t("replyTo"),tip:h.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:h.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:h.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];nn=Ke().applyFilters("mailpoet_newsletters_3rd_step_fields",nn);var an={getFields:function(){return nn},getSendButtonOptions:function(e){const t=e||{},n={value:"object"==typeof t.options&&"1"===t.options.isScheduled&&h.Z.Date.isInFuture(t.options.scheduledAt)?h.Z.I18n.t("schedule"):h.Z.I18n.t("send")};return"sent"!==t.status&&"sending"!==t.status||(n.disabled="disabled"),n}};const rn=window.mailpoet_time_format||"H:i",sn={immediate:h.Z.I18n.t("delayImmediately"),hours:h.Z.I18n.t("delayHoursAfter"),days:h.Z.I18n.t("delayDaysAfter"),weeks:h.Z.I18n.t("delayWeeksAfter")},on={daily:h.Z.I18n.t("daily"),weekly:h.Z.I18n.t("weekly"),monthly:h.Z.I18n.t("monthly"),nthWeekDay:h.Z.I18n.t("monthlyEvery"),immediately:h.Z.I18n.t("immediately")},ln=T.ZP.object(T.ZP.map(T.ZP.times(24,(e=>3600*e)),(e=>{const t=new Date(null);return t.setSeconds(e),[e,h.Z.Date.format(t,{format:rn,offset:0})]}))),cn={0:h.Z.I18n.t("sunday"),1:h.Z.I18n.t("monday"),2:h.Z.I18n.t("tuesday"),3:h.Z.I18n.t("wednesday"),4:h.Z.I18n.t("thursday"),5:h.Z.I18n.t("friday"),6:h.Z.I18n.t("saturday")},un=T.ZP.object(T.ZP.map(T.ZP.times(28,(e=>e)),(e=>{const t={0:h.Z.I18n.t("first"),1:h.Z.I18n.t("second"),2:h.Z.I18n.t("third")};let n;return n=void 0!==t[e]?t[e]:h.Z.I18n.t("nth").replace("%1$d",e+1),[e+1,n]}))),dn={1:h.Z.I18n.t("first"),2:h.Z.I18n.t("second"),3:h.Z.I18n.t("third"),L:h.Z.I18n.t("last")},pn={name:"intervalType",values:on},mn={name:"timeOfDay",values:ln},hn={name:"weekDay",values:cn},fn={name:"monthDay",values:un},gn={name:"nthWeekDay",values:dn};class vn extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,k.Z)(this,"handleValueChanges",(e=>{const t=this.getCurrentValue();return this.props.onValueChange({target:{name:this.props.field.name,value:T.ZP.extend({},t,e)}})})),(0,k.Z)(this,"handleIntervalChange",(e=>{const t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),this.handleValueChanges(n)})),(0,k.Z)(this,"handleTimeOfDayChange",(e=>this.handleValueChanges({timeOfDay:e.target.value}))),(0,k.Z)(this,"handleWeekDayChange",(e=>this.handleValueChanges({weekDay:e.target.value}))),(0,k.Z)(this,"handleMonthDayChange",(e=>this.handleValueChanges({monthDay:e.target.value}))),(0,k.Z)(this,"handleNthWeekDayChange",(e=>this.handleValueChanges({nthWeekDay:e.target.value})))}render(){const e=this.getCurrentValue();let t,n,a,r;return"immediately"!==e.intervalType&&(t=o().createElement(ge,{field:mn,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==e.intervalType&&"nthWeekDay"!==e.intervalType||(n=o().createElement(ge,{field:hn,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===e.intervalType&&(a=o().createElement(ge,{field:fn,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===e.intervalType&&(r=o().createElement(ge,{field:gn,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),o().createElement("div",null,o().createElement(ge,{field:pn,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{className:"mailpoet-grid-column mailpoet-flex"},r,a,n,t),"immediately"!==e.intervalType&&o().createElement("div",{className:"mailpoet-gap"}))}}vn.propTypes={item:y().object.isRequired,field:y().shape({name:y().string}).isRequired,onValueChange:y().func.isRequired};var yn=vn;let bn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:h.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:h.Z.I18n.t("subjectLine"),tooltip:h.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:h.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:h.Z.I18n.t("preheaderLine"),tooltip:`${h.Z.I18n.t("preheaderLineTip1")} ${h.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:h.Z.I18n.t("selectFrequency"),type:"reactComponent",component:yn},{name:"segments",label:h.Z.I18n.t("segments"),tip:h.Z.I18n.t("segmentsTip"),type:"selection",placeholder:h.Z.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:window.mailpoet_api_version,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return T.ZP.map(e,(e=>T.ZP.find(t,(t=>t.id===e))))},validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:h.Z.I18n.t("sender"),tip:h.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:h.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Wt,placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},Ht,{name:"reply-to",label:h.Z.I18n.t("replyTo"),tip:h.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:h.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:h.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];bn=Ke().applyFilters("mailpoet_newsletters_3rd_step_fields",bn);var wn={getFields:function(){return bn},getSendButtonOptions:function(){return{value:h.Z.I18n.t("activate")}}};const _n=window.mailpoet_roles||{},En=T.ZP.filter(window.mailpoet_segments||[],(e=>"default"===e.type)),Zn={name:"event",values:{segment:h.Z.I18n.t("onSubscriptionToList"),user:h.Z.I18n.t("onWPUserRegistration")}},In={name:"segment",placeholder:h.Z.I18n.t("selectSegmentPlaceholder"),forceSelect2:!0,values:En,getCount:e=>parseInt(e.subscribers,10).toLocaleString(),getLabel:e=>e.name,getValue:e=>e.id},Sn={name:"role",values:_n},kn={name:"afterTimeNumber",size:3,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":h.Z.I18n.t("emailCanBeScheduledUpToFiveYears")}},Tn={name:"afterTimeType",values:sn};class Cn extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,k.Z)(this,"handleValueChange",((e,t)=>{const n=this.getCurrentValue(),a={};let r=t;return"afterTimeNumber"===e&&(r=parseInt(t,10),r=Number.isNaN(r)?"":r),a[e]=r,this.props.onValueChange({target:{name:this.props.field.name,value:T.ZP.extend({},n,a)}})})),(0,k.Z)(this,"handleEventChange",(e=>this.handleValueChange("event",e.target.value))),(0,k.Z)(this,"handleSegmentChange",(e=>this.handleValueChange("segment",e.target.value))),(0,k.Z)(this,"handleRoleChange",(e=>this.handleValueChange("role",e.target.value))),(0,k.Z)(this,"handleAfterTimeNumberChange",(e=>this.handleValueChange("afterTimeNumber",e.target.value))),(0,k.Z)(this,"handleAfterTimeTypeChange",(e=>this.handleValueChange("afterTimeType",e.target.value)))}render(){const e=this.getCurrentValue();let t,n;return t="user"===e.event?o().createElement(ge,{field:Sn,item:this.getCurrentValue(),onValueChange:this.handleRoleChange}):o().createElement(N,{field:In,item:this.getCurrentValue(),onValueChange:this.handleSegmentChange}),"immediate"!==e.afterTimeType&&(n=o().createElement(ue,{field:kn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeNumberChange})),o().createElement("div",null,o().createElement(ge,{field:Zn,item:this.getCurrentValue(),onValueChange:this.handleEventChange}),o().createElement("div",{className:"mailpoet-gap"}),t,o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{className:"mailpoet-grid-column mailpoet-flex"},n,o().createElement(ge,{field:Tn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeTypeChange})),o().createElement("div",{className:"mailpoet-form-errors"}),o().createElement("div",{className:"mailpoet-gap"}))}}Cn.propTypes={history:y().shape({push:y().func.isRequired}).isRequired,item:y().object.isRequired,field:y().shape({name:y().string}).isRequired,onValueChange:y().func.isRequired};var Nn=(0,d.withRouter)(Cn);let Dn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:h.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:h.Z.I18n.t("subjectLine"),tooltip:h.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:h.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:h.Z.I18n.t("preheaderLine"),tooltip:`${h.Z.I18n.t("preheaderLineTip1")} ${h.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:h.Z.I18n.t("selectEventToSendWelcomeEmail"),type:"reactComponent",component:Nn},Ht,{name:"sender",label:h.Z.I18n.t("sender"),tip:h.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:h.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Wt,placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:h.Z.I18n.t("replyTo"),tip:h.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:h.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:h.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}];Dn=Ke().applyFilters("mailpoet_newsletters_3rd_step_fields",Dn);var xn={getFields:function(){return Dn},getSendButtonOptions:function(){return{value:h.Z.I18n.t("activate")}}};class Rn extends o().Component{constructor(e){super(e);const{item:t,event:n}=this.props;this.handleChange=this.handleChange.bind(this);const a=t.afterTimeType||n.defaultAfterTimeType||"immediate",r="minutes"===a?30:1,i=t.afterTimeNumber||r;this.state={afterTimeType:a,afterTimeNumber:i},t.afterTimeNumber===i&&t.afterTimeType===a||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 a={[t]:n},{afterTimeType:r}=this.state;"afterTimeType"===t&&r!==n&&("minutes"===r&&(a.afterTimeNumber=1),"minutes"===n&&(a.afterTimeNumber=30)),this.setState(a,this.propagateChange(a))}displayAfterTimeTypeOptions(){const{event:e}=this.props;let t=sn;e.timeDelayValues&&(t=Object.entries(e.timeDelayValues).reduce(((e,t)=>{let[n,a]=t;return e[n]=a.text,e}),{}));const{afterTimeType:n}=this.state,a={field:{id:"scheduling_time_interval",name:"scheduling_time_interval",forceSelect2:!0,values:T.ZP.map(t,((e,t)=>({name:e,id:t}))),extendSelect2Options:{minimumResultsForSearch:1/0},selected:()=>n},onValueChange:T.ZP.partial(this.handleChange,T.ZP,"afterTimeType")};return o().createElement(N,{field:a.field,onValueChange:a.onValueChange})}displayAfterTimeNumberField(){const{afterTimeNumberSize:e,event:t}=this.props,{afterTimeType:n,afterTimeNumber:a}=this.state;if("immediate"===n)return null;if(t.timeDelayValues&&t.timeDelayValues[n]&&!t.timeDelayValues[n].displayAfterTimeNumberField)return null;const r={field:{id:"scheduling_time_duration",name:"scheduling_time_duration",defaultValue:a?a.toString():"",size:e,validation:{"data-parsley-required":!0,"data-parsley-errors-container":".mailpoet-form-errors","data-parsley-scheduled-at":h.Z.I18n.t("emailCanBeScheduledUpToFiveYears")}},item:{},onValueChange:T.ZP.partial(this.handleChange,T.ZP,"afterTimeNumber")};return o().createElement(ue,{field:r.field,item:r.item,onValueChange:r.onValueChange})}propagateChange(e){const{onValueChange:t}=this.props;t&&t(e)}render(){const{event:e}=this.props;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-grid-column mailpoet-flex"},this.displayAfterTimeNumberField(),this.displayAfterTimeTypeOptions()),o().createElement("div",{className:"mailpoet-form-errors"}),o().createElement("div",{className:"mailpoet-gap"}),e.schedulingReadMoreLink&&o().createElement(o().Fragment,null,o().createElement("a",{href:e.schedulingReadMoreLink.link,target:"_blank",rel:"noopener noreferrer",className:"event-scheduling-read-more-link"},e.schedulingReadMoreLink.text),o().createElement("div",{className:"mailpoet-gap"})))}}Rn.propTypes={item:y().shape({afterTimeType:y().string.isRequired,afterTimeNumber:y().number}).isRequired,afterTimeNumberSize:y().number,onValueChange:y().func,event:y().shape({defaultAfterTimeType:y().string,timeDelayValues:y().objectOf(y().shape({text:y().string,displayAfterTimeNumberField:y().bool})),schedulingReadMoreLink:y().shape({link:y().string.isRequired,text:y().string.isRequired})}).isRequired},Rn.defaultProps={afterTimeNumberSize:3,onValueChange:null};var On=Rn;function An(e){const t=e&&e.values?e.values:[];return t?t.map((e=>({id:e.id,name:e.name}))):t}function Pn(e){let{eventOptions:t,eventSlug:n,selected:a,onValueChange:r}=e;function i(e){r&&r({eventOptionValue:e.target.value})}return o().createElement("div",null,o().createElement("div",{className:"event-option-selection"},function(){if(!t)return t;const e={field:{name:`event_options_${n}`,forceSelect2:!0,endpoint:t.endpoint,resetSelect2OnUpdate:!0,values:An(t),multiple:t.multiple||!1,placeholder:t.placeholder||!1,transformChangedValue:(e,t)=>T.ZP.map(t,(e=>({id:e.id,name:e.text}))),selected:()=>a,getLabel:T.ZP.property("name"),getValue:T.ZP.property("id"),validation:{"data-parsley-required":!0}},onValueChange:i,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"}),o().createElement(o().Fragment,null,o().createElement(N,{field:e.field,onValueChange:e.onValueChange,item:e.item}),o().createElement("div",{className:"mailpoet-gap"}))}()))}Pn.propTypes={eventOptions:y().shape({values:y().arrayOf(y().shape({id:y().string.isRequired,name:y().string.isRequired})),multiple:y().bool.isRequired,placeholder:y().string.isRequired,endpoint:y().string.isRequired}).isRequired,eventSlug:y().string.isRequired,selected:y().arrayOf(y().string).isRequired,onValueChange:y().func.isRequired};var Mn=Pn;class Ln extends o().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=T.ZP.indexBy(this.email.events,"slug"),this.segments=T.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const n=this.events[this.emailOptions.event],a=this.emailOptions.afterTimeType||n.defaultAfterTimeType||"immediate";this.state={event:n,afterTimeType:a,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,a={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return o().createElement(On,{item:a.item,event:a.event,onValueChange:a.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 o().createElement("div",{className:"event-segment-selection"},o().createElement(N,{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 a={emailSlug:this.email.slug,eventSlug:t,onValueChange:this.handleChange,eventOptions:e.options||null};return n&&n.option&&("remote"===a.eventOptions.type&&(a.eventOptions.values=n.option),a.selected=T.ZP.map(n.option,(e=>e.id))),o().createElement(Mn,{emailSlug:a.emailSlug,eventSlug:a.eventSlug,eventOptions:a.eventOptions,onValueChange:a.onValueChange,selected:a.selected})}displayHeader(){const{event:e}=this.state;return e.title}propagateChange(){const{eventSlug:e,afterTimeType:t,afterTimeNumber:n,segment:a,eventOptionValue:r}=this.state,{onValueChange:i}=this.props;if(!i)return;const s={group:this.email.slug,event:e,afterTimeType:t};n&&(s.afterTimeNumber=n),a&&(s.segment=a),r&&(s.meta=JSON.stringify({option:this.state.eventOptionValue})),i({target:{name:"options",value:s}})}render(){return o().createElement("div",null,o().createElement(Ce.Z,{level:5},this.displayHeader()),this.displayEventOptions(),this.displaySegments(),this.displayScheduling())}}Ln.propTypes={field:y().shape({email:y().shape({events:y().object.isRequired}).isRequired,emailOptions:y().object.isRequired}).isRequired,onValueChange:y().func},Ln.defaultProps={onValueChange:null};var Fn=Ln;const qn=window.mailpoet_woocommerce_automatic_emails||[];var $n={getFields:function(e){return(e=>{const t=qn[e.options.group];if(!t)return!1;const n=e.options;return[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:h.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:h.Z.I18n.t("subjectLine"),tooltip:h.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:h.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:h.Z.I18n.t("preheaderLine"),tooltip:`${h.Z.I18n.t("preheaderLineTip1")} ${h.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",label:h.Z.I18n.t("sendAutomaticEmailWhenHeading").replace("%1s",t.title),type:"reactComponent",component:Fn,email:t,emailOptions:n},Ht,{name:"sender",label:h.Z.I18n.t("sender"),tip:h.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:h.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"text",placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"empty",type:"empty"},{name:"reply-to",label:h.Z.I18n.t("replyTo"),tip:h.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:h.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:h.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]}]})(e)},getSendButtonOptions:function(){return{value:h.Z.I18n.t("activate")}}},Un=n(78230),jn=n(68041);function Vn(e){let{afterTimeNumber:t,afterTimeType:n,updateAfterTimeNumber:a,updateAfterTimeType:r,inactiveSubscribersPeriod:i}=e;const s="weeks"===n?7:30,l=Number(t)*s;let c=i;return 365===i&&(c=360),o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:4},h.Z.I18n.t("selectEventToSendReEngagementEmail")),o().createElement(kt.r.CenteredRow,{className:"mailpoet-re-engagement-scheduling"},o().createElement("p",null,h.Z.I18n.t("reEngagementTextPre")),o().createElement(le.Z,{type:"text",placeholder:h.Z.I18n.t("reEngagementAterTimeNumberPlaceholder"),value:t,onChange:(0,jn.z2)(a)}),o().createElement(he.Z,{value:n,onChange:(0,jn.z2)(r)},o().createElement("option",{value:"weeks"},"weeks"),o().createElement("option",{value:"months"},"months"))),!!i&&c<=l&&o().createElement("p",{className:"mailpoet-re-engagement-scheduling-note"},x()(h.Z.I18n.t("reEngagementEmailWarning").replace("{$months}",`${Math.floor(i/30)}`),/\[link\](.*?)\[\/link\]/g,(e=>o().createElement("a",{key:"link",href:"https://kb.mailpoet.com/article/264-inactive-subscribers",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"5cbf19622c7d3a026fd3efe1"},e)))))}function Wn(e){return o().createElement(Vn,{afterTimeNumber:e.item.options.afterTimeNumber.toString(),afterTimeType:e.item.options.afterTimeType,inactiveSubscribersPeriod:Number(h.Z.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:t=>{e.onValueChange({target:{name:"options",value:(0,Un.assoc)("afterTimeNumber",t,e.item.options)}})},updateAfterTimeType:t=>{e.onValueChange({target:{name:"options",value:(0,Un.assoc)("afterTimeType",t,e.item.options)}})}})}Vn.propTypes={afterTimeNumber:y().string.isRequired,afterTimeType:y().string.isRequired,updateAfterTimeNumber:y().func.isRequired,updateAfterTimeType:y().func.isRequired},Wn.propTypes={item:y().shape({options:y().shape({afterTimeNumber:y().oneOfType([y().number,y().string]).isRequired,afterTimeType:y().string.isRequired}).isRequired}).isRequired,onValueChange:y().func.isRequired};const Yn=[{name:"email-header",label:null,tip:null,fields:[{name:"subject",customLabel:h.Z.I18n.t("subjectLabel"),className:"mailpoet-form-field-subject",placeholder:h.Z.I18n.t("subjectLine"),tooltip:h.Z.I18n.t("subjectLineTip"),type:"text",validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("emptySubjectLineError"),maxLength:250}},{name:"preheader",customLabel:h.Z.I18n.t("preheaderLabel"),className:"mailpoet-form-field-preheader",placeholder:h.Z.I18n.t("preheaderLine"),tooltip:`${h.Z.I18n.t("preheaderLineTip1")} ${h.Z.I18n.t("preheaderLineTip2")}`,type:"textarea",validation:{maxLength:250}}]},{name:"options",type:"reactComponent",component:Wn},{name:"segments",label:h.Z.I18n.t("segments"),tip:h.Z.I18n.t("segmentsTip"),type:"selection",placeholder:h.Z.I18n.t("selectSegmentPlaceholder"),id:"mailpoet_segments",api_version:h.Z.apiVersion,endpoint:"segments",multiple:!0,filter:function(e){return!e.deleted_at&&"dynamic"!==e.type},getLabel:function(e){return e.name},getCount:function(e){return parseInt(e.subscribers,10).toLocaleString()},transformChangedValue:function(e){const t=this.getItems();return(0,Un.map)((e=>(0,Un.find)((t=>t.id===e),t)),e)},validation:{"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("noSegmentsSelectedError")}},{name:"sender",label:h.Z.I18n.t("sender"),tip:h.Z.I18n.t("senderTip"),fields:[{name:"sender_name",type:"text",placeholder:h.Z.I18n.t("senderNamePlaceholder"),validation:{"data-parsley-required":!0}},{name:"sender_address",type:"reactComponent",component:Wt,placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},{name:"reply-to",label:h.Z.I18n.t("replyTo"),tip:h.Z.I18n.t("replyToTip"),inline:!0,fields:[{name:"reply_to_name",type:"text",placeholder:h.Z.I18n.t("replyToNamePlaceholder")},{name:"reply_to_address",type:"text",placeholder:h.Z.I18n.t("replyToAddressPlaceholder"),validation:{"data-parsley-type":"email"}}]},Ht],Bn={getFields:()=>Yn,getSendButtonOptions:()=>({value:h.Z.I18n.t("activate")})};var Hn=n(7358),zn=n(31304),Kn=n.n(zn);const Gn=window.mailpoet_woocommerce_automatic_emails||[],Qn=(e,t)=>`${Kn()(t,{lower:!0}).replace(/[^a-z0-9]+/g,"-").replace(/-$/,"")||"newsletter"}_${e}`;function Xn(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)?h.Z.I18n.t("newsletterIsEmpty"):window.mailpoet_mss_active&&t.indexOf("[link:subscription_unsubscribe_url]")<0&&t.indexOf("[link:subscription_unsubscribe]")<0?h.Z.I18n.t("unsubscribeLinkMissing"):"re_engagement"===e.type&&t.indexOf("[link:subscription_re_engage_url]")<0?h.Z.I18n.t("reEngageLinkMissing"):"notification"===e.type&&t.indexOf('"type":"automatedLatestContent"')<0&&t.indexOf('"type":"automatedLatestContentLayout"')<0?h.Z.I18n.t("automatedLatestContentMissing"):"standard"===e.type&&"sent"===e.status?h.Z.I18n.t("emailAlreadySent"):"re_engagement"!==e.type||h.Z.trackingConfig.emailTrackingEnabled?void 0:o().createElement("span",{style:{pointerEvents:"all"}},x()(h.Z.I18n.t("reEngagementEmailsDisableIfTrackingIs"),/\[link\](.*?)\[\/link\]/g,(e=>o().createElement("a",{key:"advancedSettingsTabLink",href:"?page=mailpoet-settings#/advanced",rel:"noopener noreferrer"},e))))}class Jn extends o().Component{constructor(e){super(e),(0,k.Z)(this,"getFieldsByNewsletter",(e=>this.getSubtype(e).getFields(e))),(0,k.Z)(this,"getSendButtonOptions",(()=>this.getSubtype(this.state.item).getSendButtonOptions(this.state.item))),(0,k.Z)(this,"getSubtype",(e=>{switch(e.type){case"notification":return wn;case"welcome":return xn;case"re_engagement":return Bn;case"automatic":if(Gn[e.options.group])return $n;default:return an}})),(0,k.Z)(this,"getThumbnailPromise",(e=>this.state.thumbnailPromise?this.state.thumbnailPromise:(0,Hn.W0)(e))),(0,k.Z)(this,"isValid",(()=>m()("#mailpoet_newsletter").parsley().isValid())),(0,k.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,k.Z)(this,"showInvalidFromAddressError",(()=>{const e=this.state.item.sender_address;let t=x()(h.Z.I18n.t("newsletterInvalidFromAddress"),"%1$s",(()=>e));t=x()(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}),h.Z.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"})})),(0,k.Z)(this,"removeInvalidFromAddressError",(()=>{m()("#field_sender_address").parsley().removeError("invalidFromAddress",{updateClass:!0})})),(0,k.Z)(this,"loadItem",(e=>(this.setState({loading:!0}),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done((e=>{const t="draft"===e.data.status?this.getThumbnailPromise(e.meta.preview_url):null,n=e.data;n.ga_campaign||(n.ga_campaign=Qn(n.id,n.subject)),this.setState({item:e.data,fields:this.getFieldsByNewsletter(e.data),thumbnailPromise:t,validationError:Xn(e.data)})})).fail((()=>{this.setState({item:{}},(()=>{this.props.history.push("/new")}))}))))),(0,k.Z)(this,"saveTemplate",((e,t)=>{this.getThumbnailPromise(e.meta.preview_url).then((n=>{h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:{newsletter_id:e.data.id,name:e.data.subject,thumbnail_data:n,body:JSON.stringify(e.data.body),categories:'["recent"]'}}).fail((e=>{this.showError(e),this.setState({loading:!1}),h.Z.Modal.loading(!1)})),t()})).catch((e=>{this.showError({errors:[e]})}))})),(0,k.Z)(this,"loadAuthorizedEmailAddresses",(async()=>"MailPoet"!==window.mailpoet_mta_method?[]:(await h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])),(0,k.Z)(this,"handleSend",(e=>(e.preventDefault(),this.removeInvalidFromAddressError(),this.isValid()?(h.Z.Modal.loading(!0),this.isValidFromAddress().then((t=>t?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((e=>{switch(e.data.type){case"notification":case"welcome":case"automatic":case"re_engagement":return this.activateNewsletter(e);default:return this.sendNewsletter(e)}})).fail((e=>{this.showError(e),this.setState({loading:!1}),h.Z.Modal.loading(!1)})):(this.showInvalidFromAddressError(),h.Z.Modal.loading(!1))))):m()("#mailpoet_newsletter").parsley().validate()))),(0,k.Z)(this,"sendNewsletter",(e=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"add",data:{newsletter_id:this.state.item.id}}).done((t=>{this.saveTemplate(e,(()=>{if(window.mailpoet_show_congratulate_after_first_newsletter)return h.Z.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);this.props.history.push(`/${this.state.item.type||""}`),"scheduled"===t.data.status?(this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("newsletterHasBeenScheduled"))),h.Z.trackEvent("Emails > Newsletter sent",{scheduled:!0})):(this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("newsletterBeingSent")),{id:"mailpoet_notice_being_sent"}),h.Z.trackEvent("Emails > Newsletter sent",{scheduled:!1})),h.Z.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),h.Z.Modal.loading(!1)})))),(0,k.Z)(this,"activateNewsletter",(e=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:this.props.match.params.id,status:"active"}}).done((t=>{this.saveTemplate(e,(()=>{if(window.mailpoet_show_congratulate_after_first_newsletter)return h.Z.Modal.loading(!1),void this.props.history.push(`/send/congratulate/${this.state.item.id}`);const e=this.state.item.options;this.props.history.push("automatic"===this.state.item.type?`/${e.group}`:`/${this.state.item.type||""}`),"automatic"===this.state.item.type&&Gn[e.group]?this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("automaticEmailActivated").replace("%1s",Gn[e.group].title))):"welcome"===t.data.type?(this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("welcomeEmailActivated"))),h.Z.trackEvent("Emails > Welcome email activated",{"List type":e.event,Delay:`${e.afterTimeNumber} ${e.afterTimeType}`})):"notification"===t.data.type&&(this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("postNotificationActivated"))),h.Z.trackEvent("Emails > Post notifications activated",{Frequency:e.intervalType})),h.Z.Modal.loading(!1)}))})).fail((e=>{this.showError(e),this.setState({loading:!1}),h.Z.Modal.loading(!1)})))),(0,k.Z)(this,"handleResume",(e=>(e.preventDefault(),this.isValid()?this.saveNewsletter(e).done((()=>{this.setState({loading:!0})})).done((()=>{h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:this.state.item.id}}).done((()=>{this.props.history.push(`/${this.state.item.type||""}`),this.context.notices.success(o().createElement("p",null,h.Z.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,k.Z)(this,"handleSave",(e=>{e.preventDefault(),this.saveNewsletter(e).done((()=>{this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("newsletterUpdated")))})).done((()=>{const e="automatic"===this.state.item.type?this.state.item.options.group:this.state.item.type;this.props.history.push(`/${e||""}`)})).fail((e=>{this.showError(e)}))})),(0,k.Z)(this,"handleRedirectToDesign",(e=>{e.preventDefault();const t=e.target.href;this.saveNewsletter(e).done((()=>{this.context.notices.success(o().createElement("p",null,h.Z.I18n.t("newsletterUpdated")))})).done((()=>{window.location=t})).fail((e=>{this.showError(e)}))})),(0,k.Z)(this,"saveNewsletter",(()=>{const e=this.state.item;e.queue=void 0,this.setState({loading:!0});const t=T.ZP.omit(e,["body","created_at","deleted_at","hash","status","updated_at","type"]);return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:t})})),(0,k.Z)(this,"showError",(e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0})})),(0,k.Z)(this,"handleFormChange",(e=>{const t=e.target.name,n=e.target.value;return this.setState((e=>{const a=e.item,r=a.subject,i=a.ga_campaign;return a[t]=n,"subject"===t&&i===Qn(a.id,r)&&(a.ga_campaign=Qn(a.id,n)),"reply_to_address"===t&&(a[t]=n.toLowerCase()),{item:a}})),!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(),a=!(!window.mailpoet_subscribers_limit_reached&&!window.mailpoet_mss_key_pending_approval&&void 0===this.state.validationError);let r=this.state.item.type;return"automatic"===r&&(r=this.state.item.options.group||r),o().createElement("div",{className:"mailpoet-form-send-email"},o().createElement(Ae.Z,{color:"#fff"}),o().createElement(ft,{emailType:r,automationId:"newsletter_send_heading"}),o().createElement(Oe,{id:"mailpoet_newsletter",fields:t,automationId:"newsletter_send_form",item:this.state.item,loading:this.state.loading,onChange:this.handleFormChange,onSubmit:this.handleSave},o().createElement(kt.r.CenteredRow,{className:"send-newsletter-buttons"},o().createElement(xe.Button,{variant:"secondary",type:"submit",automationId:"email-save-draft"},h.Z.I18n.t("saveDraftAndClose")),e?o().createElement(xe.Button,{type:"button",onClick:this.handleResume,isDisabled:a,automationId:"email-resume"},h.Z.I18n.t("resume")):o().createElement(xe.Button,(0,S.Z)({type:"button",onClick:this.handleSend},n,{isDisabled:a,automationId:"email-submit"}),n.value||h.Z.I18n.t("send")),void 0!==this.state.validationError&&o().createElement($(),{tooltip:o().createElement("div",null,this.state.validationError),tooltipId:"helpTooltipSendEmail"})),o().createElement("p",null,h.Z.I18n.t("orSimply")," ",o().createElement("a",{className:"mailpoet-link",href:`?page=mailpoet-newsletter-editor&id=${this.props.match.params.id}`,onClick:this.handleRedirectToDesign},h.Z.I18n.t("goBackToDesign")),"."),window.mailpoet_mss_key_pending_approval&&o().createElement("div",{className:"mailpoet_error"},x()(h.Z.I18n.t("pendingKeyApprovalNotice"),/\[link\](.*?)\[\/link\]/g,(e=>o().createElement("a",{key:"pendingKeyApprovalNoticeLink",href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer"},e))))))}}Jn.contextType=Ve.k,Jn.propTypes={match:y().shape({params:y().shape({id:y().string}).isRequired}).isRequired,history:y().shape({push:y().func.isRequired}).isRequired};var ea=(0,d.withRouter)(Jn);function ta(e){const[t,n]=(0,s.useState)(!1);return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:0},h.Z.I18n.t("congratulationsSuccessHeader")),o().createElement(Ce.Z,{level:3},"welcome"===(a=e.newsletter).type?h.Z.I18n.t("congratulationsWelcomeEmailSuccessBody"):"notification"===a.type?h.Z.I18n.t("congratulationsPostNotificationSuccessBody"):"automatic"===a.type?h.Z.I18n.t("congratulationsWooSuccessBody"):"scheduled"===a.status?h.Z.I18n.t("congratulationsScheduleSuccessBody"):h.Z.I18n.t("congratulationsSendSuccessBody")),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement("img",{src:e.illustrationImageUrl,alt:"",width:"500"}),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement(xe.Button,{type:"button",dimension:"small",onClick:()=>{e.successClicked(),n(!0)},withSpinner:t},h.Z.I18n.t("close")));var a}ta.propTypes={successClicked:y().func.isRequired,illustrationImageUrl:y().string.isRequired,newsletter:y().shape({status:y().string.isRequired,type:y().string.isRequired}).isRequired};var na=ta;function aa(e){return o().createElement("div",{className:"mailpoet-wizard-step"},o().createElement("div",{className:"mailpoet-wizard-step-illustration"},o().createElement("img",{src:e.illustrationUrl,width:"500",alt:""})),o().createElement("div",{className:"mailpoet-wizard-step-content"},e.children))}aa.propTypes={illustrationUrl:y().string.isRequired,children:y().oneOfType([y().arrayOf(y().node),y().node]).isRequired};var ra=aa;function ia(e){let{children:t,isOrdered:n}=e;const a=n?"ol":"ul";return o().createElement(a,{className:`mailpoet-${a}`},t)}ia.propTypes={children:y().node.isRequired,isOrdered:y().bool};var sa=ia;function oa(){return o().createElement(sa,null,o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList1")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList2")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList4")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList5")))}function la(){return o().createElement(sa,null,o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSNotFreeList1")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSNotFreeList2")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSNotFreeList3")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSNotFreeList4")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSNotFreeList5")))}function ca(e){return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(b.Z,{isFullWidth:!0,href:e.mailpoetAccountUrl,target:"_blank",rel:"noopener noreferrer",onClick:t=>{t.preventDefault(),window.open(e.mailpoetAccountUrl),e.next()}},e.nextButtonText),o().createElement(b.Z,{isFullWidth:!0,variant:"tertiary",onClick:e.next,onKeyDown:t=>{["keydown","keypress"].includes(t.type)&&["Enter"," "].includes(t.key)&&(t.preventDefault(),e.next())},withSpinner:e.nextWithSpinner},h.Z.I18n.t("welcomeWizardMSSNoThanks")))}function ua(e){return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("welcomeWizardMSSFreeTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("welcomeWizardMSSFreeSubtitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(Ce.Z,{level:5},h.Z.I18n.t("welcomeWizardMSSFreeListTitle"),":"),o().createElement(oa,null),o().createElement(ca,{mailpoetAccountUrl:h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount,h.Z.currentWpUserEmail,"starter",{utm_medium:"onboarding",utm_campaign:"purchase"}),next:e.next,nextButtonText:h.Z.I18n.t("welcomeWizardMSSFreeButton")}))}function da(e){return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("welcomeWizardMSSNotFreeTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("welcomeWizardMSSNotFreeSubtitle"),":"),o().createElement(la,null),o().createElement(ca,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next,nextButtonText:h.Z.I18n.t("welcomeWizardMSSNotFreeButton")}))}function pa(e){return e.subscribersCount<1e3?o().createElement(ua,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next}):o().createElement(da,{mailpoetAccountUrl:e.purchaseUrl,next:e.next})}ca.propTypes={mailpoetAccountUrl:y().string.isRequired,next:y().func.isRequired,nextButtonText:y().string.isRequired,nextWithSpinner:y().bool},ca.defaultProps={nextWithSpinner:!1},ua.propTypes={next:y().func.isRequired},da.propTypes={mailpoetAccountUrl:y().string.isRequired,next:y().func.isRequired},pa.propTypes={next:y().func.isRequired,subscribersCount:y().number.isRequired,mailpoetAccountUrl:y().string.isRequired,purchaseUrl:y().string.isRequired};var ma=pa;function ha(e){const[t,n]=(0,s.useState)(!1);return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},(a=e.newsletter.type,{standard:h.Z.I18n.t("congratulationsMSSPitchHeader"),welcome:h.Z.I18n.t("congratulationsMSSPitchHeaderAutomated"),notification:h.Z.I18n.t("congratulationsMSSPitchHeaderAutomated"),woocommerce:h.Z.I18n.t("congratulationsMSSPitchHeaderAutomated")}[a]||h.Z.I18n.t("congratulationsMSSPitchHeaderAutomated"))),o().createElement(ra,{illustrationUrl:e.MSSPitchIllustrationUrl},o().createElement("div",{className:"mailpoet-welcome-wizard-step-content"},o().createElement(Ce.Z,{level:4},h.Z.I18n.t("congratulationsMSSPitchSubHeader")),o().createElement("p",null,h.Z.I18n.t(e.subscribersCount<1e3?"welcomeWizardMSSFreeSubtitle":"welcomeWizardMSSNotFreeSubtitle")),o().createElement(Ce.Z,{level:5},h.Z.I18n.t("welcomeWizardMSSFreeListTitle"),":"),o().createElement(oa,null),o().createElement(ca,{mailpoetAccountUrl:e.purchaseUrl,next:()=>{e.onFinish(),n(!0)},nextButtonText:h.Z.I18n.t("welcomeWizardMSSFreeButton"),nextWithSpinner:t}))));var a}ha.propTypes={MSSPitchIllustrationUrl:y().string.isRequired,onFinish:y().func.isRequired,subscribersCount:y().number.isRequired,purchaseUrl:y().string.isRequired,newsletter:y().shape({status:y().string.isRequired,type:y().string.isRequired}).isRequired};var fa=ha;function ga(e){return window.has_mss_key_specified?o().createElement(na,{successClicked:e.successClicked,illustrationImageUrl:e.illustrationImageUrl,newsletter:e.newsletter}):o().createElement(fa,{MSSPitchIllustrationUrl:e.MSSPitchIllustrationUrl,onFinish:e.successClicked,subscribersCount:e.subscribersCount,purchaseUrl:e.purchaseUrl,newsletter:e.newsletter})}ga.propTypes={successClicked:y().func.isRequired,illustrationImageUrl:y().string.isRequired,MSSPitchIllustrationUrl:y().string.isRequired,newsletter:y().shape({status:y().string.isRequired,type:y().string.isRequired}).isRequired,subscribersCount:y().number.isRequired,purchaseUrl:y().string.isRequired};var va=ga;function ya(e){const[t,n]=(0,s.useState)(!1);return o().createElement("div",null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("congratulationsSendFailHeader")),o().createElement(Ce.Z,{level:3},x()(h.Z.I18n.t("congratulationsSendFailExplain"),/\[link\](.*?)\[\/link\]/g,((e,t)=>o().createElement("a",{key:t,target:"_blank",rel:"noopener noreferrer",href:"https://kb.mailpoet.com/article/231-sending-does-not-work","data-beacon-article":"5a0257ac2c7d3a272c0d7ad6"},e)))),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement("img",{src:window.mailpoet_congratulations_error_image,alt:"",width:"500"}),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement(xe.Button,{dimension:"small",type:"button",onClick:()=>{e.failClicked(),n(!0)},withSpinner:t},h.Z.I18n.t("close")))}ya.propTypes={failClicked:y().func.isRequired};var ba=ya,wa=n(63438);function _a(e){return o().createElement("div",{className:"mailpoet-congratulate-loading"},e.showRichLoadingScreen&&o().createElement("div",null,o().createElement(Ce.Z,{level:0},h.Z.I18n.t("congratulationsLoadingHeader")),o().createElement(Ce.Z,{level:3},h.Z.I18n.t("congratulationsLoadingBody")),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement("div",{className:"mailpoet-gap-large"}),o().createElement(wa.Z,{size:64})))}_a.propTypes={showRichLoadingScreen:y().bool.isRequired};var Ea=_a;const Za=Math.floor(4*Math.random());function Ia(){return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:{show_congratulate_after_first_newsletter:!1}}).always((()=>{window.location=window.mailpoet_main_page}))}class Sa extends o().Component{constructor(e){super(e),this.state={loading:!0,newsletter:null,testingPassed:!1,timeStart:ie()(),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(){ie()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),ie()().subtract(6,"seconds").isAfter(this.state.timeStart)&&this.setState({minimumLoadingTimePassed:!0}),!this.state.loading&&this.state.minimumLoadingTimePassed||setTimeout(this.tick,2e3)}loadNewsletter(e){h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:e}}).done((e=>this.newsletterLoaded(e.data)))}newsletterLoaded(e){"standard"!==e.type||"scheduled"===e.status?this.setState({newsletter:e,loading:!1,minimumLoadingTimePassed:!0}):"sent"===e.status||"sending"===e.status?this.setState({newsletter:e,loading:!1,testingPassed:!0}):this.setState({newsletter:e})}renderContent(){return this.state.loading||!this.state.minimumLoadingTimePassed?(e=!this.state.newsletter,o().createElement(Ea,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:Ia,showRichLoadingScreen:e})):this.state.error?(h.Z.trackEvent("Cron testing done",{"Cron is working":"false"}),o().createElement(ba,{failClicked:()=>{window.location=window.mailpoet_main_page}})):(t=this.state.newsletter,this.state.testingPassed&&h.Z.trackEvent("Cron testing done",{"Cron is working":"true"}),o().createElement(va,{illustrationImageUrl:window.mailpoet_congratulations_success_images[Za],MSSPitchIllustrationUrl:window.mailpoet_congratulations_success_images[Za],successClicked:Ia,newsletter:t,isWoocommerceActive:window.mailpoet_woocommerce_active,subscribersCount:window.mailpoet_subscribers_count,purchaseUrl:h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount,h.Z.currentWpUserEmail,"starter",{utm_medium:"first-newsletter-congratulations",utm_campaign:"purchase"})}));var e,t}render(){return o().createElement(o().Fragment,null,o().createElement("style",{dangerouslySetInnerHTML:{__html:"body { background: #fff; overflow-x: hidden; }"}}),o().createElement("div",{className:"mailpoet-congratulate"},o().createElement("div",{className:"mailpoet-gap-large"}),this.renderContent()))}}Sa.propTypes={match:y().shape({params:y().shape({id:y().string}).isRequired}).isRequired};var ka=Sa;class Ta extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"showTemplateSelection",(e=>{this.props.history.push(`/template/${e}`)}))}componentDidMount(){h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"standard"}}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0})}))}render(){return o().createElement("div",null,o().createElement(ft,{emailType:"standard",automationId:"standard_newsletter_creation_heading"}))}}Ta.contextType=Ve.k,Ta.propTypes={history:y().shape({push:y().func.isRequired}).isRequired};var Ca=(0,d.withRouter)(Ta);const Na={name:"options",type:"reactComponent",component:yn};class Da extends o().Component{constructor(e){super(e),(0,k.Z)(this,"handleValueChange",(e=>{const t=this.state;t[e.target.name]=e.target.value,this.setState(t)})),(0,k.Z)(this,"handleNext",(()=>{h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:T.ZP.extend({},this.state,{type:"notification",subject:h.Z.I18n.t("draftPostNotificationTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0})}))})),(0,k.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 o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(ft,{emailType:"notification",automationId:"post_notification_creation_heading"}),o().createElement(kt.r.Column,{align:"center",className:"mailpoet-schedule-email"},o().createElement(Ce.Z,{level:4},h.Z.I18n.t("selectFrequency")),o().createElement(yn,{item:this.state,field:Na,onValueChange:this.handleValueChange}),o().createElement(b.Z,{isFullWidth:!0,onClick:this.handleNext,type:"button"},h.Z.I18n.t("next"))))}}Da.contextType=Ve.k,Da.propTypes={history:y().shape({push:y().func.isRequired}).isRequired};var xa=(0,d.withRouter)(Da);const Ra={name:"options",label:"Event",type:"reactComponent",component:Nn};class Oa extends o().Component{constructor(e){super(e),(0,k.Z)(this,"isValid",(()=>m()("#welcome_scheduling").parsley().isValid())),(0,k.Z)(this,"validate",(()=>m()("#welcome_scheduling").parsley().validate()));let t=window.mailpoet_segments||[],n=1;t=t.filter((e=>"default"===e.type)),T.ZP.size(t)>0&&(n=T.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()?h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:T.ZP.extend({},this.state,{type:"welcome",subject:h.Z.I18n.t("draftNewsletterTitle")})}).done((e=>{this.showTemplateSelection(e.data.id)})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})):this.validate()}showTemplateSelection(e){this.props.history.push(`/template/${e}`)}render(){return o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(ft,{emailType:"welcome",automationId:"welcome_email_creation_heading"}),o().createElement(kt.r.Column,{align:"center",className:"mailpoet-schedule-email"},o().createElement(Ce.Z,{level:4},h.Z.I18n.t("selectEventToSendWelcomeEmail")),o().createElement("form",{id:"welcome_scheduling"},o().createElement(Nn,{item:this.state,field:Ra,onValueChange:this.handleValueChange}),o().createElement(b.Z,{isFullWidth:!0,type:"submit",onClick:this.handleNext},h.Z.I18n.t("next")))))}}Oa.propTypes={history:y().shape({push:y().func.isRequired}).isRequired};var Aa=Oa;class Pa extends o().Component{static getEventOptions(e){return e.options||null}static getEventOptionsFirstValue(e){return e&&T.ZP.isArray(e.values)&&e.values[0].id?e.values[0].id:null}constructor(e){super(e),(0,k.Z)(this,"isValid",(()=>!m()("#newsletter_scheduling").parsley()||m()("#newsletter_scheduling").parsley().isValid())),(0,k.Z)(this,"validate",(()=>{m()("#newsletter_scheduling").parsley()&&m()("#newsletter_scheduling").parsley().validate()})),(0,k.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=T.ZP.filter(window.mailpoet_segments,(e=>null===e.deleted_at));const a=this.getEvent(n),r=this.constructor.getEventOptions(a),i=this.constructor.getEventOptionsFirstValue(r);this.state={event:a,eventSlug:a.slug,eventOptionValue:i,segment:a.sendToLists?this.getFirstSegment():null,afterTimeType:a.defaultAfterTimeType||"immediate",afterTimeNumber:null}}handleChange(e){const{segment:t,afterTimeNumber:n}=this.state,a=e;if(a.eventSlug){a.event=this.getEvent(a.eventSlug),a.segment=a.event.sendToLists?t||this.getFirstSegment():null;const e=this.constructor.getEventOptions(a.event);a.eventOptionValue=e?this.constructor.getEventOptionsFirstValue(e):null}a.afterTimeType&&"immediate"===a.afterTimeType?a.afterTimeNumber=null:!a.afterTimeType||a.afterTimeNumber||n||(a.afterTimeNumber=1),this.setState(a),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:a,afterTimeNumber:r,event:i,segment:s,eventOptionValue:l}=this.state,c={group:this.email.slug,event:n,afterTimeType:a};r&&(c.afterTimeNumber=r),c.sendTo=i.sendToLists?"segment":"user",s&&(c.segment=s),l&&(c.meta=JSON.stringify({option:l})),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"create",data:{type:"automatic",subject:h.Z.I18n.t("draftNewsletterTitle"),options:c}}).done((e=>{h.Z.trackEvent("Emails > New Automatic Email Created",{"Event type":c.event,"Schedule type":c.afterTimeType,"Schedule value":c.afterTimeNumber}),t.push(`/template/${e.data.id}`)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0})}))}getEvent(e){return this.emailEvents[e]}getFirstSegment(){return T.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 o().createElement(Mn,{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 o().createElement("div",{className:"event-segment-selection"},o().createElement(N,{field:t.field,onValueChange:t.onValueChange}))}displayScheduling(){const{afterTimeNumber:e,afterTimeType:t,event:n}=this.state,a={item:{afterTimeNumber:e,afterTimeType:t},event:n,onValueChange:this.handleChange};return o().createElement(On,{item:a.item,event:a.event,onValueChange:a.onValueChange})}displayEventTip(){const{event:e}=this.state;return e.tip?o().createElement("p",{className:"description"},o().createElement("strong",null,h.Z.I18n.t("tip"))," ",e.tip):null}render(){return o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(ft,{emailType:"woocommerce",automationId:"woocommerce_email_creation_heading"}),o().createElement(kt.r.Column,{align:"center",className:"mailpoet-schedule-email"},o().createElement("form",{id:"newsletter_scheduling"},o().createElement(Ce.Z,{level:4},this.displayHeader()),o().createElement("div",null,this.displayEventOptions()),o().createElement("div",null,this.displaySegments()),o().createElement("div",null,this.displayScheduling()),o().createElement(b.Z,{isFullWidth:!0,onClick:this.handleNextStep,type:"submit"},h.Z.I18n.t("next")))),this.displayEventTip())}}Pa.contextType=Ve.k,Pa.propTypes={history:y().shape({push:y().func.isRequired}).isRequired,name:y().string.isRequired,email:y().shape({title:y().string.isRequired,slug:y().string.isRequired}).isRequired};var Ma=Pa,La=n(45853),Fa=n(19013),qa=n(13882);function $a(e){return(0,qa.Z)(1,arguments),(0,Fa.default)(e).getTime()<Date.now()}var Ua=n(77349),ja=n(36948);function Va(e,t){return(0,qa.Z)(2,arguments),(0,Fa.default)(e).getTime()-(0,Fa.default)(t).getTime()}var Wa={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function Ya(e){return e?Wa[e]:Wa.trunc}var Ba=n(44732),Ha=n(65221);function za(e){let{scheduledFor:t,processed:n,total:a,isPaused:r,status:i}=e;const s=!t&&!n&&!a,l=t&&function(e){return(0,qa.Z)(1,arguments),(0,Fa.default)(e).getTime()>Date.now()}(t),c=(!t||$a(t))&&n<a,u=(!t||$a(t))&&n>=a,d="sent"===i&&void 0===a;let p=0,m=(0,Ba.Z)("notSentYet");if(l){const e=h.Z.Date.short(t),n=h.Z.Date.time(t),a=new Date,r=(0,Ua.default)(a,1),i=h.Z.Date.short(a)===e,s=h.Z.Date.short(r)===e;if(i||s){const t=Math.random().toString(36).substring(2,15),a=i?(0,Ba.Z)("today"):(0,Ba.Z)("tomorrow");m=o().createElement(o().Fragment,null,o().createElement("span",{"data-tip":!0,"data-for":t},a),o().createElement(Ha.Z,{place:"right",id:t},e),o().createElement("br",null),n)}else m=o().createElement(o().Fragment,null,e,o().createElement("br",null),n);const l=720,c=function(e,t,n){(0,qa.Z)(2,arguments);var a=Va(e,t)/ja.yJ;return Ya(null==n?void 0:n.roundingMethod)(a)}(t,a);p=c<l?c/l*100:100}else c?(m=`${h.Z.Num.toLocaleFixed(n)} / ${h.Z.Num.toLocaleFixed(a)}`,p=n/a*100):u?(m=`${h.Z.Num.toLocaleFixed(a)} / ${h.Z.Num.toLocaleFixed(a)}`,p=100):d&&(m=(0,Ba.Z)("sent"),p=100);return!r||u||d||(m=(0,Ba.Z)("paused")),o().createElement("div",{className:g()({"mailpoet-listing-status":!0,"mailpoet-listing-status-unknown":s,"mailpoet-listing-status-scheduled":l,"mailpoet-listing-status-in-progress":c,"mailpoet-listing-status-sent":u||d})},l&&o().createElement(Ga,null),o().createElement(Ka,{percentage:p}),o().createElement("div",{className:"mailpoet-listing-status-label"},m))}function Ka(e){let{percentage:t}=e;const n=16*Math.PI,a=n*(t/100),r=n-a;return o().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},o().createElement("circle",{cx:"12",cy:"12",r:"8",className:"mailpoet-listing-status-percentage-background"}),o().createElement("circle",{r:"8",cx:"12",cy:"12",fill:"none",strokeDashoffset:n/4,strokeDasharray:`${a} ${r}`,className:"mailpoet-listing-status-percentage"}))}function Ga(){return o().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},o().createElement("path",{className:"mailpoet-listing-status-scheduled-icon",strokeLinecap:"round",d:"M12 7L12 12 15 15"}))}za.propTypes={scheduledFor:y().instanceOf(Date),processed:y().number,total:y().number,isPaused:y().bool,status:y().string},Ka.propTypes={percentage:y().number.isRequired};var Qa=za;const Xa=y().shape({status:y().string,count_processed:y().string.isRequired,count_total:y().string.isRequired,scheduled_at:y().string}),Ja=y().shape({id:y().number.isRequired,sent_at:y().string,status:y().string.isRequired,queue:y().oneOfType([Xa,y().bool])});function er(e){let{newsletter:t}=e;const[n,a]=o().useState("paused"===t.queue.status),[r,i]=o().useState([]);return o().createElement(o().Fragment,null,o().createElement(dt,{errors:r}),n&&o().createElement(b.Z,{dimension:"small",onClick:()=>{i([]),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:t.id}}).done((()=>a(!1))).fail((e=>i(e.errors)))}},h.Z.I18n.t("resume")),!n&&o().createElement(b.Z,{dimension:"small",onClick:()=>{i([]),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"pause",data:{newsletter_id:t.id}}).done((()=>a(!0))).fail((e=>i(e.errors)))}},h.Z.I18n.t("pause")))}function tr(e){let{newsletter:t,mailerLog:n}=e,a=t.sent_at||t.queue.scheduled_at;a&&(a=(0,La.default)(a,"yyyy-MM-dd HH:mm:ss",new Date));const r=t.queue&&"scheduled"!==t.queue.status,i="paused"===n.status,s=o().createElement(o().Fragment,null,o().createElement(u.rU,{to:`/sending-status/${t.id}`,"data-automation-id":`sending_status_${t.id}`},o().createElement(Qa,{processed:parseInt(t.queue.count_processed,10),scheduledFor:a,total:parseInt(t.queue.count_total,10),isPaused:i,status:t.status})),"completed"!==t.queue.status&&!i&&o().createElement(er,{newsletter:t})),l=o().createElement(Qa,{scheduledFor:a,isPaused:"scheduled"===t.queue.status&&i,status:t.status});return o().createElement(o().Fragment,null,r&&s,!r&&l)}er.propTypes={newsletter:Ja.isRequired},tr.propTypes={newsletter:Ja.isRequired,mailerLog:y().shape({status:y().string}).isRequired};var nr=tr;const ar={opened:{badgeRanges:[30,10,0],badgeTypes:["excellent","good","average"],tooltipText:[h.Z.I18n.t("openedStatTooltipExcellent"),h.Z.I18n.t("openedStatTooltipGood"),h.Z.I18n.t("openedStatTooltipAverage")]},clicked:{badgeRanges:[3,1,0],badgeTypes:["excellent","good","average"],tooltipText:[h.Z.I18n.t("clickedStatTooltipExcellent"),h.Z.I18n.t("clickedStatTooltipGood"),h.Z.I18n.t("clickedStatTooltipAverage")]}},rr=(e,t)=>{const n=ar[e]||null;if(!n)return null;if(t<0||t>100)return null;const a=n.badgeRanges.length;for(let e=0;e<a;e+=1)if(t>n.badgeRanges[e])return n.badgeTypes[e];return n.badgeTypes[a-1]};function ir(e){const t={excellent:{name:h.Z.I18n.t("excellentBadgeName"),tooltipTitle:h.Z.I18n.t("excellentBadgeTooltip")},good:{name:h.Z.I18n.t("goodBadgeName"),tooltipTitle:h.Z.I18n.t("goodBadgeTooltip")},average:{name:h.Z.I18n.t("averageBadgeName"),tooltipTitle:h.Z.I18n.t("averageBadgeTooltip")}},n=rr(e.stat,e.rate),a=t[n]||null;if(!a)return null;const r=ar[e.stat]||null;if(!r)return null;const i=e.tooltipId||null,s=o().createElement("div",{key:`tooltip-${i}`},o().createElement("div",{className:"mailpoet-listing-stats-tooltip-title"},a.tooltipTitle.toUpperCase()),o().createElement("div",{className:"mailpoet-listing-stats-tooltip-content"},o().createElement(H.Z,{type:"excellent",name:t.excellent.name})," : ",r.tooltipText[0],o().createElement("br",null),o().createElement(H.Z,{type:"good",name:t.good.name})," : ",r.tooltipText[1],o().createElement("br",null),o().createElement(H.Z,{type:"average",name:t.average.name})," : ",r.tooltipText[2]));return o().createElement(H.Z,{isInverted:e.isInverted,type:n,name:a.name,tooltip:s,tooltipId:i,tooltipPlace:e.tooltipPlace})}function sr(e){let{opened:t,clicked:n,revenues:a,hideBadges:r,newsletterId:i,wrapContentInLink:s}=e;const l=h.Z.Num.toLocaleFixed(t,1),c=h.Z.Num.toLocaleFixed(n,1);let u=o().createElement("div",{className:"mailpoet-listing-stats-opened-clicked"},o().createElement("div",{className:"mailpoet-listing-stats-percentages"},c,"%",o().createElement("br",null),o().createElement("span",{className:"mailpoet-listing-stats-percentages-opens"},l,"%")),!r&&o().createElement("div",null,o().createElement(ir,{stat:"clicked",rate:n,tooltipId:`clicked-${i||"0"}`}))),d=null;if(a){const e=`revenues-${i||"0"}`;d=o().createElement("div",null,o().createElement(w.Z,{"data-tip":!0,"data-for":e},a),o().createElement(Ha.Z,{place:"top",multiline:!0,id:e},o().createElement("div",{className:"mailpoet-listing-stats-tooltip-content"},h.Z.I18n.t("revenueStatsTooltipShort"))))}return s&&(u=s(u,"opened-and-clicked"),d=s(d,"revenue")),o().createElement("div",{className:"mailpoet-listing-stats"},u,d)}ir.propTypes={stat:y().string.isRequired,rate:y().number.isRequired,tooltipId:y().string,isInverted:y().bool},ir.defaultProps={isInverted:!0},sr.propTypes={opened:y().number.isRequired,clicked:y().number.isRequired,revenues:y().string,hideBadges:y().bool,newsletterId:y().number,wrapContentInLink:y().func};var or=sr,lr=n(93723);function cr(e){let{newsletter:t,isSent:n,currentTime:a}=e,r=n;if(void 0===r&&(r=t.statistics&&t.queue&&"scheduled"!==t.queue.status),!r)return null;const i={link:`/stats/${t.id}`,onClick:Ke().applyFilters("mailpoet_newsletters_listing_stats_tracking",lr.gP)},s=Number(t.total_sent||t.queue.count_processed);let l,c,d,p,m,f=0,g=0,v=null;s>0&&(f=100*t.statistics.clicked/s,g=100*t.statistics.opened/s,v=t.statistics.revenue),void 0!==a?(l=6,c=t.queue.scheduled_at||t.queue.created_at,d=ie()(a).diff(ie()(c),"hours"),p=d<l,m=!0):(p=!1,m=!1);const y=s>=20&&t.statistics.opened>=5&&!p,b=(e,n)=>((e,t,n,a)=>a<=0||!t.link?e:t.externalLink?o().createElement("a",{key:`stats-${n}`,href:t.link,onClick:t.onClick||null},e):o().createElement(u.rU,{key:`stats-${n}`,to:t.link,onClick:t.onClick||null},e))(e,i,`${n}-${t.id}`,s),_=o().createElement(or,{opened:g,clicked:f,revenues:v&&v.value>0?v.formatted:null,hideBadges:!y,newsletterId:t.id,wrapContentInLink:b}),E=o().createElement(o().Fragment,null,_,p&&b(o().createElement(w.Z,{className:"mailpoet-listing-stats-too-early",dimension:"large",variant:"excellent",isInverted:!0},h.Z.I18n.t("checkBackInHours").replace("%1$d",l-d)),"check-back"));let Z;return m&&g<5&&d>=24&&s>=10&&(Z=o().createElement("div",null,o().createElement("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"},h.Z.I18n.t("improveThisLinkText")))),o().createElement(o().Fragment,null,E,Z)}const ur=y().shape({clicked:y().number,opened:y().number,unsubscribed:y().number,revenue:y().shape({count:y().number,currency:y().string,formatted:y().string,value:y().number})}),dr=y().shape({status:y().string,count_processed:y().string.isRequired,count_total:y().string.isRequired,created_at:y().string,scheduled_at:y().string});cr.propTypes={newsletter:y().shape({id:y().number.isRequired,queue:y().oneOfType([dr,y().bool]),total_sent:y().number,statistics:y().oneOfType([ur,y().bool])}).isRequired,isSent:y().bool,currentTime:y().string},cr.defaultProps={isSent:void 0,currentTime:void 0};var pr=cr;const mr=h.Z.trackingConfig.emailTrackingEnabled,hr={onNoItemsFound:(e,t)=>h.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterTrashed"):h.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterDeleted"):h.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterRestored"):h.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},fr=[{name:"subject",label:h.Z.I18n.t("subject"),sortable:!0},{name:"status",label:h.Z.I18n.t("status")},{name:"segments",label:h.Z.I18n.t("lists")},{name:"statistics",label:h.Z.I18n.t("statistics"),display:mr},{name:"sent_at",label:h.Z.I18n.t("sentOn"),sortable:!0}],gr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:hr.onTrash}],vr=e=>{const t=()=>{window.location.href=`?page=mailpoet-newsletter-editor&id=${e.id}`};e.queue&&"sending"===e.status&&null===e.queue.status?(0,yt.Z)({message:h.Z.I18n.t("confirmEdit"),onConfirm:t}):t()};let yr=[{name:"view",link:function(e){return o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),onClick:vr},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:function(e,t){return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{h.Z.Notice.success(h.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];yr=(0,lr.y8)(yr);class br extends o().Component{constructor(e){super(e),(0,k.Z)(this,"renderItem",((e,t,n)=>{const a=g()("manage-column","column-primary","has-row-actions");return o().createElement("div",null,o().createElement("td",{className:a},o().createElement("a",{className:"mailpoet-listing-title",href:"#",onClick:t=>{t.preventDefault(),vr(e)}},e.queue.newsletter_rendered_subject||e.subject),t),o().createElement("td",{className:"column mailpoet-listing-status-column","data-colname":h.Z.I18n.t("status")},o().createElement(nr,{newsletter:e,mailerLog:n.mta_log})),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lists")},o().createElement(E,{segments:e.segments,dimension:"large"})),!0===mr?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},o().createElement(pr,{newsletter:e,currentTime:n.current_time})):null,o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("sentOn")},e.sent_at?o().createElement(o().Fragment,null,h.Z.Date.short(e.sent_at),o().createElement("br",null),h.Z.Date.time(e.sent_at)):null))})),(0,k.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return o().createElement(o().Fragment,null,0===this.state.newslettersCount&&o().createElement(mt,{filter:e=>"standard"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"standard",base_url:"standard",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:fr,bulk_actions:gr,item_actions:yr,messages:hr,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,lr._X)(e),(0,lr.bF)(e)}}))}}br.contextType=Ve.k,br.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var wr=(0,d.withRouter)(br);const _r=window.mailpoet_roles||{},Er=window.mailpoet_segments||{},Zr=h.Z.trackingConfig.emailTrackingEnabled,Ir={onNoItemsFound:(e,t)=>h.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterTrashed"):h.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterDeleted"):h.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterRestored"):h.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},Sr=[{name:"subject",label:h.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:h.Z.I18n.t("settings")},{name:"statistics",label:h.Z.I18n.t("statistics"),display:Zr},{name:"status",label:h.Z.I18n.t("status"),width:145},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],kr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Ir.onTrash}];let Tr=[{name:"view",link:function(e){return o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:(e,t)=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{h.Z.Notice.success(h.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),onClick:lr.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];Tr=(0,lr.y8)(Tr);class Cr extends o().Component{constructor(e){super(e),(0,k.Z)(this,"updateStatus",((e,t)=>{t.persist(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&h.Z.Notice.success(h.Z.I18n.t("welcomeEmailActivated")),this.forceUpdate()})).fail((n=>{h.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,k.Z)(this,"renderStatus",(e=>{const t=h.Z.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString()),n=h.Z.I18n.t("scheduledToXSubscribers").replace("%1$d",e.total_scheduled.toLocaleString());return o().createElement("div",null,o().createElement(Kt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),o().createElement("p",{className:"mailpoet-listing-stats-description"},o().createElement(u.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`},t)," ",o().createElement("br",null),n))})),(0,k.Z)(this,"renderSettings",(e=>{let t,n,a;switch(e.options.event){case"user":t="mailpoet_all"===e.options.role?h.Z.I18n.t("welcomeEventWPUserAnyRole"):x()(h.Z.I18n.t("welcomeEventWPUserWithRole"),'"%1$s"',((t,n)=>o().createElement(w.Z,{variant:"list",key:n},_r[e.options.role])));break;default:if(a=T.ZP.find(Er,(t=>Number(t.id)===Number(e.options.segment))),void 0===a)return o().createElement(u.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`},h.Z.I18n.t("sendingToSegmentsNotSpecified"));t=x()(h.Z.I18n.t("welcomeEventSegment"),'"%1$s"',((e,t)=>o().createElement(w.Z,{variant:"list",key:t},a.name)))}if(t&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":n=h.Z.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":n=h.Z.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":n=h.Z.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":n=h.Z.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:n=h.Z.I18n.t("sendingDelayInvalid")}return o().createElement("span",null,t,n&&o().createElement("div",{className:"mailpoet-listing-schedule"},o().createElement("div",{className:"mailpoet-listing-schedule-icon"},o().createElement(Ga,null)),n))})),(0,k.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return o().createElement("div",null,o().createElement("td",{className:n},o().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),!0===Zr?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},o().createElement(pr,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})):null,o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),o().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,k.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return o().createElement(o().Fragment,null,0===this.state.newslettersCount&&o().createElement(mt,{filter:e=>"welcome"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"welcome",base_url:"welcome",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Sr,bulk_actions:kr,item_actions:Tr,messages:Ir,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,lr._X)(e),(0,lr.bF)(e)}}))}}Cr.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var Nr=(0,d.withRouter)(Cr);const Dr={onNoItemsFound:(e,t)=>h.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterTrashed"):h.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterDeleted"):h.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterRestored"):h.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},xr=[{name:"subject",label:h.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:h.Z.I18n.t("settings")},{name:"history",label:h.Z.I18n.t("history"),width:100},{name:"status",label:h.Z.I18n.t("status"),width:100},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],Rr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Dr.onTrash}],Or=[{name:"view",link:function(e){return o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),onClick:lr.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:function(e,t){return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{h.Z.Notice.success(h.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class Ar extends o().Component{constructor(e){super(e),(0,k.Z)(this,"updateStatus",((e,t)=>{t.persist(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&h.Z.Notice.success(h.Z.I18n.t("postNotificationActivated")),this.forceUpdate()})).fail((n=>{h.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,k.Z)(this,"renderStatus",(e=>o().createElement(Kt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}))),(0,k.Z)(this,"renderSettings",(e=>{let t;if(0===e.segments.length)return o().createElement(u.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`},h.Z.I18n.t("sendingToSegmentsNotSpecified"));const n=x()(h.Z.I18n.t("sendTo"),"%1$s",((t,n)=>o().createElement(E,{segments:e.segments,key:n})));switch(e.options.intervalType){case"daily":t=h.Z.I18n.t("sendDaily").replace("%1$s",ln[e.options.timeOfDay]);break;case"weekly":t=h.Z.I18n.t("sendWeekly").replace("%1$s",cn[e.options.weekDay]).replace("%2$s",ln[e.options.timeOfDay]);break;case"monthly":t=h.Z.I18n.t("sendMonthly").replace("%1$s",un[e.options.monthDay]).replace("%2$s",ln[e.options.timeOfDay]);break;case"nthWeekDay":t=h.Z.I18n.t("sendNthWeekDay").replace("%1$s",dn[e.options.nthWeekDay]).replace("%2$s",cn[e.options.weekDay]).replace("%3$s",ln[e.options.timeOfDay]);break;case"immediately":t=h.Z.I18n.t("sendImmediately");break;default:t="Invalid sending frequency"}return o().createElement("span",null,n,o().createElement("div",{className:"mailpoet-listing-schedule"},o().createElement("div",{className:"mailpoet-listing-schedule-icon"},o().createElement(Ga,null)),t))})),(0,k.Z)(this,"renderHistoryLink",(e=>0===Number(e.children_count)?o().createElement("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small mailpoet-listing-notification-status"},h.Z.I18n.t("notSentYet")):o().createElement(u.rU,{className:"mailpoet-nowrap","data-automation-id":`history-${e.id}`,to:`/notification/history/${e.id}`},o().createElement(b.Z,{className:"mailpoet-hide-on-mobile",dimension:"small"},h.Z.I18n.t("viewHistory")),o().createElement(b.Z,{className:"mailpoet-show-on-mobile mailpoet-listing-notification-status",dimension:"small",variant:"secondary"},h.Z.I18n.t("viewHistory"))))),(0,k.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return o().createElement("div",null,o().createElement("td",{className:n},o().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("history")},this.renderHistoryLink(e)),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),o().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,k.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return o().createElement(o().Fragment,null,0===this.state.newslettersCount&&o().createElement(mt,{filter:e=>"notification"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"notification",base_url:"notification",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:xr,bulk_actions:Rr,item_actions:Or,messages:Dr,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,lr._X)(e),(0,lr.bF)(e)}}))}}Ar.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var Pr=(0,d.withRouter)(Ar);const Mr=h.Z.trackingConfig.emailTrackingEnabled,Lr={onNoItemsFound:(e,t)=>h.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterTrashed"):h.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterDeleted"):h.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterRestored"):h.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},Fr=[{name:"subject",label:h.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:h.Z.I18n.t("settings")},{name:"statistics",label:h.Z.I18n.t("statistics"),display:Mr},{name:"status",label:h.Z.I18n.t("status"),width:145},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],qr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Lr.onTrash}];let $r=[{name:"view",link:function(e){return o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:(e,t)=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{h.Z.Notice.success(h.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),onClick:lr.Q2},{name:"trash",className:"mailpoet-hide-on-mobile"}];$r=(0,lr.y8)($r);class Ur extends o().Component{constructor(e){super(e),(0,k.Z)(this,"updateStatus",((e,t)=>{t.persist(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{"active"===e.data.status&&h.Z.Notice.success(h.Z.I18n.t("reEngagementEmailActivated")),this.forceUpdate()})).fail((n=>{h.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,k.Z)(this,"renderStatus",(e=>{const t=h.Z.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString());return o().createElement("div",null,o().createElement(Kt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),o().createElement("p",{className:"mailpoet-listing-stats-description"},o().createElement(u.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`},t)))})),(0,k.Z)(this,"renderSettings",(e=>{if(0===e.segments.length)return o().createElement(u.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`},h.Z.I18n.t("sendingToSegmentsNotSpecified"));const t=x()(h.Z.I18n.t("sendTo"),"%1$s",((t,n)=>o().createElement(E,{segments:e.segments,key: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 a=h.Z.I18n.t("reEngagementSettings").replace("{$count}",e.options.afterTimeNumber).replace("{$frequency}",h.Z.I18n.t(n));return o().createElement("span",null,t,o().createElement("div",{className:"mailpoet-listing-schedule"},o().createElement("div",{className:"mailpoet-listing-schedule-icon"},o().createElement(Ga,null)),a))})),(0,k.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return o().createElement("div",null,o().createElement("td",{className:n},o().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),!0===Mr?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},o().createElement(pr,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})):null,o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),o().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,k.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return o().createElement(o().Fragment,null,0===this.state.newslettersCount&&o().createElement(mt,{filter:e=>"re_engagement"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,endpoint:"newsletters",type:"re_engagement",base_url:"re_engagement",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Fr,bulk_actions:qr,item_actions:$r,messages:Lr,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,lr._X)(e),(0,lr.bF)(e)}}))}}Ur.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var jr=(0,d.withRouter)(Ur);const Vr=h.Z.trackingConfig.emailTrackingEnabled,Wr=[{name:"subject",label:h.Z.I18n.t("subject")},{name:"status",label:h.Z.I18n.t("status")},{name:"segments",label:h.Z.I18n.t("lists")},{name:"statistics",label:h.Z.I18n.t("statistics"),display:Vr},{name:"sent_at",label:h.Z.I18n.t("sentOn"),sortable:!0}],Yr={onNoItemsFound:(e,t)=>h.Z.I18n.t(t?"noItemsFound":"emptyListing"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterTrashed"):h.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterDeleted"):h.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterRestored"):h.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},Br=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Yr.onTrash}],Hr=(0,lr.y8)([{name:"view",link:function(e){return o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"trash",className:"mailpoet-hide-on-mobile"}]),zr=(e,t,n)=>{const a=g()("manage-column","column-primary","has-row-actions");return o().createElement(o().Fragment,null,o().createElement("td",{className:a},o().createElement("strong",null,o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},e.queue.newsletter_rendered_subject||e.subject)),t),o().createElement("td",{className:"column mailpoet-listing-status-column","data-colname":h.Z.I18n.t("status")},o().createElement(nr,{newsletter:e,mailerLog:n.mta_log})),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lists")},o().createElement(E,{segments:e.segments,dimension:"large"})),!0===Vr?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},o().createElement(pr,{newsletter:e,currentTime:n.current_time})):null,o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("sentOn")},e.sent_at?o().createElement(o().Fragment,null,h.Z.Date.short(e.sent_at),o().createElement("br",null),h.Z.Date.time(e.sent_at)):null))};function Kr(e){return o().createElement(o().Fragment,null,o().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:"/notification"},h.Z.I18n.t("backToPostNotifications")),o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:e.location,params:{...e.match.params,parentId:e.parentId},endpoint:"newsletters",type:"notification_history",base_url:"notification/history/:parentId",onRenderItem:zr,columns:Wr,messages:Yr,item_actions:Hr,bulk_actions:Br,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{(0,lr._X)(e),(0,lr.bF)(e)}}))}Kr.propTypes={parentId:y().string.isRequired,location:y().shape({pathname:y().string}).isRequired,match:y().shape({params:y().shape({id:y().node}).isRequired}).isRequired};var Gr=(0,d.withRouter)(Kr);const Qr=[{name:"subscriber_id",label:h.Z.I18n.t("subscriber"),sortable:!0},{name:"status",label:h.Z.I18n.t("sendingStatus")},{name:"failureReason",label:h.Z.I18n.t("failureReason")}],Xr={onNoItemsFound:()=>h.Z.I18n.t("noSendingTaskFound")};function Jr(e){const[t,n]=o().useState({id:e.match.params.id,subject:"",sent:!1});return o().useEffect((()=>{h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:t.id}}).done((e=>n({id:t.id,subject:e.data.subject,sent:null!==e.data.sent_at}))).fail((e=>h.Z.Notice.showApiErrorNotice(e)))}),[t.id]),o().createElement(o().Fragment,null,o().createElement("h1",null,h.Z.I18n.t("sendingStatusTitle")),o().createElement(ai,{newsletter:t}),o().createElement(ni,{location:e.location,params:e.match.params}))}Jr.propTypes={location:y().shape({pathname:y().string}).isRequired,match:y().shape({params:y().shape({id:y().string.isRequired}).isRequired}).isRequired};const ei=(e,t)=>e.location.pathname===t.location.pathname&&e.params.id===t.params.id,ti=e=>o().createElement("div",null,o().createElement(ri,e)),ni=o().memo((e=>{let{location:t,params:n}=e;return o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:t,params:n,endpoint:"sending_task_subscribers",base_url:"sending-status/:id",onRenderItem:ti,getListingItemKey:e=>`${e.taskId}-${e.subscriberId}`,columns:Qr,messages:Xr,auto_refresh:!0,sort_by:"failed",sort_order:"desc",afterGetItems:e=>{(0,lr._X)(e),(0,lr.bF)(e)}})}),ei);function ai(e){let{newsletter:t}=e;return t.id&&t.subject&&t.sent?o().createElement("p",null,o().createElement(u.rU,{to:`/stats/${t.id}`},t.subject)):null}function ri(e){let{error:t,failed:n,taskId:a,processed:r,email:i,subscriberId:s,lastName:l,firstName:c}=e;const u=g()("manage-column","column-primary","has-row-actions");let d=h.Z.I18n.t("unprocessed");return"1"===r&&(d="1"===n?o().createElement("span",null,h.Z.I18n.t("failed"),o().createElement("br",null),o().createElement("a",{className:"button",href:"#",onClick:e=>{e.preventDefault(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sending_task_subscribers",action:"resend",data:{taskId:a,subscriberId:s}}).done((()=>window.mailpoet_listing.forceUpdate())).fail((e=>h.Z.Notice.showApiErrorNotice(e)))}},h.Z.I18n.t("resend"))):h.Z.I18n.t("sent")),o().createElement(o().Fragment,null,o().createElement("td",{"data-automation-id":`name_${a}_${s}`,className:u},o().createElement("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-subscribers#/edit/${s}`},i),o().createElement("div",{className:"mailpoet-listing-subtitle"},`${c} ${l}`)),o().createElement("td",{className:"column","data-automation-id":`status_${a}_${s}`,"data-colname":h.Z.I18n.t("sendingStatus")},d),o().createElement("td",{className:"column","data-automation-id":`error_${a}_${s}`,"data-colname":h.Z.I18n.t("failureReason")},t))}ni.propTypes={location:y().shape({pathname:y().string}).isRequired,params:y().shape({id:y().string.isRequired}).isRequired},ai.propTypes={newsletter:y().shape({id:y().string,subject:y().string,sent:y().bool})},ai.defaultProps={newsletter:{id:null,subject:null,sent:!1}},ri.propTypes={error:y().string,email:y().string.isRequired,failed:y().string.isRequired,taskId:y().string.isRequired,lastName:y().string.isRequired,firstName:y().string.isRequired,processed:y().string.isRequired,subscriberId:y().string.isRequired},ri.defaultProps={error:""};var ii=Jr;const si=h.Z.trackingConfig.emailTrackingEnabled,oi=window.mailpoet_woocommerce_automatic_emails||{},li={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterTrashed"):h.Z.I18n.t("multipleNewslettersTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterDeleted"):h.Z.I18n.t("multipleNewslettersDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneNewsletterRestored"):h.Z.I18n.t("multipleNewslettersRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},ci=[{name:"subject",label:h.Z.I18n.t("subject"),sortable:!0},{name:"settings",label:h.Z.I18n.t("settings")},{name:"statistics",label:h.Z.I18n.t("statistics"),display:si},{name:"status",label:h.Z.I18n.t("status"),width:145},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],ui=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:li.onTrash}];let di=[{name:"view",link:function(e){return o().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),onClick:lr.Q2},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:(e,t)=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"duplicate",data:{id:e.id}}).done((e=>{h.Z.Notice.success(h.Z.I18n.t("newsletterDuplicated").replace("%1$s",e.data.subject)),t()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},{name:"trash",className:"mailpoet-hide-on-mobile"}];di=(0,lr.y8)(di);class pi extends o().Component{constructor(e){super(e),(0,k.Z)(this,"updateStatus",((e,t)=>{t.persist(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"active":"draft"}}).done((e=>{if("active"===e.data.status){const e=t.target.getAttribute("data-group"),n=oi[e];h.Z.Notice.success(h.Z.I18n.t("automaticEmailActivated").replace("%1s",n.title))}this.forceUpdate()})).fail((n=>{h.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,k.Z)(this,"renderStatus",(e=>{const t=parseInt(e.total_sent,10)>-1?h.Z.I18n.t("sentToXCustomers").replace("%1$d",e.total_sent.toLocaleString()):null;return o().createElement("div",null,o().createElement(Kt,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,"data-group":e.options.group,dimension:"small",defaultChecked:"active"===e.status}),o().createElement("p",{className:"mailpoet-listing-notification-status"},t&&o().createElement(u.rU,{to:`/sending-status/${e.id}`},t),!t&&o().createElement("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small"},h.Z.I18n.t("notSentYet"))))})),(0,k.Z)(this,"renderSettings",(e=>{const t=oi[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 a=n&&n.option?T.ZP.pluck(n.option,"name"):[];if(n&&T.ZP.isEmpty(a))return o().createElement("span",{className:"mailpoet-listing-error"},h.Z.I18n.t("automaticEmailEventOptionsNotConfigured"));let r,i;if(r=a.length>1&&"listingScheduleDisplayTextPlural"in t?x()(t.listingScheduleDisplayTextPlural,"%s",((e,t)=>o().createElement(E,{strings:a,key:t}))):x()(t.listingScheduleDisplayText,"%s",((e,t)=>o().createElement(E,{strings:a,key:t}))),r&&"immediate"!==e.options.afterTimeType)switch(e.options.afterTimeType){case"minutes":i=h.Z.I18n.t("sendingDelayMinutes").replace("%1$d",e.options.afterTimeNumber);break;case"hours":i=h.Z.I18n.t("sendingDelayHours").replace("%1$d",e.options.afterTimeNumber);break;case"days":i=h.Z.I18n.t("sendingDelayDays").replace("%1$d",e.options.afterTimeNumber);break;case"weeks":i=h.Z.I18n.t("sendingDelayWeeks").replace("%1$d",e.options.afterTimeNumber);break;default:i=h.Z.I18n.t("sendingDelayInvalid")}return o().createElement("span",null,r,i&&o().createElement("div",{className:"mailpoet-listing-schedule"},o().createElement("div",{className:"mailpoet-listing-schedule-icon"},o().createElement(Ga,null)),i))})),(0,k.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return o().createElement("div",null,o().createElement("td",{className:n},o().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),!0===si?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},o().createElement(pr,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})):null,o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),o().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,k.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={eventCounts:{},newslettersCount:void 0},this.afterGetItems=this.afterGetItems.bind(this)}afterGetItems(e){(0,lr._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:o().createElement("div",{className:"notice error"},o().createElement("p",null,h.Z.I18n.t("wooCommerceEmailsWarning")),o().createElement("p",null,o().createElement("a",{href:"?page=mailpoet-settings#woocommerce"},h.Z.I18n.t("wooCommerceEmailsWarningLink")))):null}render(){const{match:e,location:t}=this.props;return o().createElement(o().Fragment,null,this.renderWarning(),0===this.state.newslettersCount&&o().createElement(mt,{filter:e=>"woocommerce"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:t,params:e.params,endpoint:"newsletters",type:"automatic",base_url:"woocommerce",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:ci,bulk_actions:ui,item_actions:di,messages:li,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)}}))}}pi.propTypes={match:y().shape({params:y().shape({tab:y().string}).isRequired}).isRequired,location:y().object.isRequired};var mi=(0,d.withRouter)(pi),hi=function(){return o().createElement(o().Fragment,null,o().createElement("style",{dangerouslySetInnerHTML:{__html:".wrap { margin: 0 !important; }"}}))},fi=n(4840),gi=n(53681);const vi=e=>{const t=e<.1?2:1;return h.Z.Num.toLocaleFixed(e,t)};function yi(e){let{newsletter:t,isWoocommerceActive:n}=e;const a=t.total_sent||0;let r=0,i=0,s=0,l=0,c=0;a>0&&(r=100*t.statistics.clicked/a,i=100*t.statistics.opened/a,s=100*t.statistics.machineOpened/a,l=100*t.statistics.unsubscribed/a,c=100*t.statistics.bounced/a);const u=vi(r),d=vi(i),p=vi(s),m=vi(l),f=vi(c),g=a>=20&&t.statistics.opened>=5,v=o().createElement("div",{className:"mailpoet-statistics-value-small"},o().createElement("span",{className:"mailpoet-statistics-value-number"},d,"% "),h.Z.I18n.t("percentageOpened")),y=o().createElement("div",{className:"mailpoet-statistics-value-small"},o().createElement("span",{className:"mailpoet-statistics-value-number"},p,"% "),h.Z.I18n.t("percentageMachineOpened"),o().createElement(Ye.Z,{tooltip:x()(h.Z.I18n.t("percentageMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>o().createElement("span",{style:{pointerEvents:"all"},key:"machine-opened-tooltip"},o().createElement("a",{href:"https://kb.mailpoet.com/article/368-what-are-machine-opens",key:"kb-link",target:"_blank","data-beacon-article":"6124b7fb21ef206e5592e188",rel:"noopener noreferrer"},e))))})),b=o().createElement("div",{className:"mailpoet-statistics-value-small"},o().createElement("span",{className:"mailpoet-statistics-value-number"},m,"% "),h.Z.I18n.t("percentageUnsubscribed")),w=o().createElement("div",{className:"mailpoet-statistics-value-small"},o().createElement("span",{className:"mailpoet-statistics-value-number"},f,"% "),h.Z.I18n.t("percentageBounced")),_=rr("clicked",r),E=o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-statistics-value"},o().createElement("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${_}`},u,"% "),h.Z.I18n.t("percentageClicked")),g&&o().createElement(ir,{isInverted:!1,stat:"clicked",rate:r,tooltipId:`clicked-${t.id||"0"}`,tooltipPlace:"right"}));return o().createElement("div",{className:"mailpoet-stats-general"},o().createElement(kt.r.ThreeColumns,{className:"mailpoet-stats-general-top-row"},o().createElement("div",null,o().createElement("div",{className:"mailpoet-statistics-value-small"},h.Z.I18n.t("statsTotalSent"),": ",o().createElement("span",{className:"mailpoet-statistics-value-number"},a.toLocaleString()))),o().createElement("div",{className:"mailpoet-statistics-with-left-separator"},b),o().createElement("div",{className:"mailpoet-statistics-with-left-separator"},w)),o().createElement(kt.r.ThreeColumns,null,o().createElement("div",null,E),o().createElement("div",{className:"mailpoet-statistics-with-left-separator"},v,y),n&&o().createElement("div",{className:"mailpoet-statistics-with-left-separator"},Ke().applyFilters("mailpoet_newsletters_revenues_stats",null,t.statistics.revenue)),!n&&o().createElement("div",null)),o().createElement("p",{className:"mailpoet-stats-general-read-more"},o().createElement("a",{href:"https://kb.mailpoet.com/article/190-whats-a-good-email-open-rate",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"58f671152c7d3a057f8858e8"},h.Z.I18n.t("readMoreOnStats"))))}function bi(e){let{newsletter:t}=e;const n=t.queue.scheduled_at||t.queue.created_at;return o().createElement(kt.r.ThreeColumns,{className:"mailpoet-stats-info"},o().createElement("div",{className:"mailpoet-grid-span-two-columns"},o().createElement(Ce.Z,{level:1},t.subject),o().createElement("div",null,o().createElement("b",null,h.Z.Date.short(n)," • ",h.Z.Date.time(n))),Array.isArray(t.segments)&&t.segments.length&&o().createElement("div",null,o().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("statsToSegments")),": ",o().createElement(E,{dimension:"large",segments:t.segments}))),o().createElement("div",{className:"mailpoet-stats-info-sender-preview"},o().createElement("div",null,o().createElement("div",{className:"mailpoet-stats-info-key-value"},o().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("statsFromAddress"),": "),t.sender_address?t.sender_address:"-"),o().createElement("div",{className:"mailpoet-stats-info-key-value"},o().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("statsReplyToAddress"),": "),t.reply_to_address?t.reply_to_address:"-"),o().createElement("div",{className:"mailpoet-stats-info-key-value"},o().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("googleAnalytics"),": "),t.ga_campaign?t.ga_campaign:"-")),o().createElement("div",null,o().createElement(xe.Button,{href:t.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("statsPreviewNewsletter")))))}function wi(){const e=o().createElement(b.Z,{href:h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount,h.Z.currentWpUserEmail,"starter",{utm_medium:"stats",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("premiumBannerCtaFree")),t=o().createElement("p",null,h.Z.I18n.t("premiumBannerDescription")," ",o().createElement("a",{href:"admin.php?page=mailpoet-upgrade"},h.Z.I18n.t("learnMore")),".");return o().createElement("div",{className:"mailpoet-stats-premium-required"},o().createElement(Ge.Z,{title:h.Z.I18n.t("premiumFeature"),message:t,actionButton:e}))}yi.propTypes={isWoocommerceActive:y().bool.isRequired};var _i=function(){if(!window.mailpoet_display_detailed_stats)return o().createElement(wi,null);if(window.mailpoet_subscribers_limit_reached){const e=window.mailpoet_has_valid_api_key,t=h.Z.I18n.t("upgradeRequired"),n=h.Z.I18n.t(e?"newsletterYourPlanLimit":"newsletterFreeVersionLimit").replace("[subscribersLimit]",window.mailpoet_subscribers_limit).replace("[subscribersCount]",window.mailpoet_subscribers_count),a=e?"https://account.mailpoet.com/upgrade":`https://account.mailpoet.com/?s=${window.mailpoet_subscribers_count+1}`;return o().createElement("div",{className:"mailpoet-stats-premium-required"},o().createElement(Ge.Z,{title:t,message:o().createElement("p",null,n),actionButton:o().createElement(b.Z,{target:"_blank",rel:"noopener noreferrer",href:a},h.Z.I18n.t("upgradeNow"))}))}return null};function Ei(e){let{match:t,history:n,location:a}=e;const[r,i]=(0,s.useState)({item:void 0,loading:!0}),l=(0,s.useCallback)((e=>{i({loading:!0,item:r.item}),h.Z.Modal.loading(!0),h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:window.mailpoet_display_detailed_stats?"stats":"newsletters",action:window.mailpoet_display_detailed_stats?"get":"getWithStats",data:{id:e}}).always((()=>{h.Z.Modal.loading(!1)})).done((e=>{i({loading:!1,item:e.data})})).fail((e=>{h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0}),i({loading:!1}),n.push("/")}))}),[n,r.item]);(0,s.useEffect)((()=>{window.scrollTo(0,0),r.item?.id!==t.params.id&&l(t.params.id)}),[t.params.id,l,r.item]);const{item:c,loading:u}=r,d=c;return u?null:d?.subject&&!d?.queue?o().createElement("div",null,o().createElement(Ce.Z,{level:1},d.subject)):o().createElement(o().Fragment,null,o().createElement(Pe.Z,null),o().createElement(hi,null),o().createElement(V.Q,null),o().createElement("div",{className:"mailpoet-stats-page"},o().createElement(P,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),o().createElement(bi,{newsletter:d}),o().createElement(yi,{newsletter:d,isWoocommerceActive:h.Z.isWoocommerceActive}),o().createElement(fi.Z,{activeKey:"clicked"},o().createElement(gi.Z,{key:"clicked",title:h.Z.I18n.t("clickedLinks")},Ke().applyFilters("mailpoet_newsletters_clicked_links_table",o().createElement(_i,null),d.clicked_links)),Ke().applyFilters("mailpoet_newsletters_purchased_products",null,d),o().createElement(gi.Z,{key:"engagement",title:h.Z.I18n.t("subscriberEngagement")},Ke().applyFilters("mailpoet_newsletters_subscriber_engagement",o().createElement(_i,null),a,t.params,d)),o().createElement(gi.Z,{key:"bounces",title:h.Z.I18n.t("bounces"),automationId:"bounces-tab"},Ke().applyFilters("mailpoet_newsletters_bounces",o().createElement(_i,null),a,t.params)))))}Ei.propTypes={match:y().shape({params:y().shape({id:y().string.isRequired}).isRequired}).isRequired,history:y().shape({push:y().func.isRequired}).isRequired,location:y().object.isRequired};var Zi=(0,d.withRouter)(Ei),Ii=n(48228),Si=n(97762),ki=n(87903),Ti=n.n(ki);function Ci(e){const t=e.installedDaysAgo,n=t>30?h.Z.I18n.t("reviewRequestUsingForMonths").replace("[months]",Math.round(t/30)):h.Z.I18n.t("reviewRequestUsingForDays").replace("[days]",t);return o().createElement("div",{className:"mailpoet_review_request"},o().createElement("img",{src:e.reviewRequestIllustrationUrl,height:"280",width:"280",alt:""}),o().createElement("h2",null,h.Z.I18n.t("reviewRequestHeading")),o().createElement("p",null,h.Z.I18n.t("reviewRequestDidYouKnow").replace("[username]",e.username)),o().createElement("p",null,n),o().createElement("p",null,o().createElement("a",{href:"http://bit.ly/2Bi124o",target:"_blank",rel:"noopener noreferrer",className:"button button-primary"},h.Z.I18n.t("reviewRequestRateUsNow"))),o().createElement("p",null,o().createElement("a",{id:"mailpoet_review_request_not_now"},h.Z.I18n.t("reviewRequestNotNow"))))}Ci.propTypes={installedDaysAgo:y().number.isRequired,reviewRequestIllustrationUrl:y().string.isRequired,username:y().string.isRequired};var Ni=Ci;let Di=null;const xi=()=>((0,s.useLayoutEffect)((()=>{window.mailpoet_display_nps_poll&&h.Z.libs3rdPartyEnabled&&(Di||(Di=h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"analytics",action:"getTrackingData"})),Di).then((e=>{let{data:t}=e;return(e=>{let t;t=window.mailpoet_display_nps_form?"EqOgKsgZd832Sz9w":window.mailpoet_is_new_user?"6L479eVPXk7pBn6S":"k0aJAsQAWI2ERyGv",Ti()({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&&h.Z.Modal.popup({width:800,template:Si.renderToString(Ni({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",(()=>h.Z.Modal.close()))}})}}})})(t)}))}),[]),null);var Ri=e=>function(t){return xi(),o().createElement(e,t)},Oi=function(){return o().createElement(V.Q,null,o().createElement(u.rU,{id:"mailpoet-new-email",className:"mailpoet-button button-secondary",to:"/new",onClick:()=>h.Z.trackEvent("Emails > Add New"),"data-automation-id":"new_email"},W,o().createElement("span",null,h.Z.I18n.t("new"))))},Ai=(0,d.withRouter)((function(e){let{children:t,location:n}=e;return null!==(0,ht.X)(n)||(e=>e.hash.match(/^#\/new/)||e.pathname.match(/^\/new/))(n)?null:t}));function Pi(e){let{mailpoetInstalledDaysAgo:t,sendTransactionalEmails:n,mtaMethod:a,noticeDismissed:r,apiVersion:i}=e;const[l,c]=(0,s.useState)(!1),u=()=>{h.Z.Ajax.post({api_version:i,endpoint:"UserFlags",action:"set",data:{transactional_emails_opt_in_notice_dismissed:"1"}})};return t<30||n||"PHPMail"===a||"1"===r||l?null:o().createElement(R.Z,{type:"success",timeout:!1,onClose:u},o().createElement("h3",null,h.Z.I18n.t("transactionalEmailNoticeTitle")),o().createElement("p",null,h.Z.I18n.t("transactionalEmailNoticeBody")," ",o().createElement("a",{href:"https://kb.mailpoet.com/article/292-choose-how-to-send-your-wordpress-websites-emails",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("transactionalEmailNoticeBodyReadMore"))),o().createElement("p",null,o().createElement("button",{type:"button",className:"button",onClick:()=>{c(!0),h.Z.Ajax.post({api_version:i,endpoint:"settings",action:"set",data:{send_transactional_emails:"1"}}),u()}},h.Z.I18n.t("transactionalEmailNoticeCTA"))))}Pi.propTypes={mailpoetInstalledDaysAgo:y().number.isRequired,sendTransactionalEmails:y().bool.isRequired,noticeDismissed:y().string.isRequired,mtaMethod:y().string.isRequired,apiVersion:y().string.isRequired};var Mi=Pi;const Li=window.mailpoet_woocommerce_automatic_emails||[],Fi=Ri((()=>{const{parentId:e}=(0,d.useParams)();return o().createElement(o().Fragment,null,o().createElement(Ai,null,o().createElement(Oi,null)),o().createElement(Ii.Z,{activeKey:"standard",routerType:"switch-only",onSwitch:e=>(e=>h.Z.trackEvent(`Tab Emails > ${e} clicked`))(e),automationId:"newsletters_listing_tabs"},o().createElement(gi.Z,{key:"standard",route:"standard/(.*)?",title:h.Z.I18n.t("tabStandardTitle"),automationId:`tab-${h.Z.I18n.t("tabStandardTitle")}`},o().createElement(wr,null)),o().createElement(gi.Z,{key:"welcome",route:"welcome/(.*)?",title:h.Z.I18n.t("tabWelcomeTitle"),automationId:`tab-${h.Z.I18n.t("tabWelcomeTitle")}`},o().createElement(Nr,null)),o().createElement(gi.Z,{key:"notification",route:"notification/(.*)?",title:h.Z.I18n.t("tabNotificationTitle"),automationId:`tab-${h.Z.I18n.t("tabNotificationTitle")}`},e?o().createElement(Gr,{parentId:e}):o().createElement(Pr,null)),o().createElement(gi.Z,{key:"re_engagement",route:"re_engagement/(.*)?",title:h.Z.I18n.t("tabReEngagementTitle"),automationId:`tab-${h.Z.I18n.t("tabReEngagementTitle")}`},o().createElement(jr,null)),window.mailpoet_woocommerce_active&&T.ZP.map(Li,(e=>o().createElement(gi.Z,{key:e.slug,route:`${e.slug}/(.*)?`,title:e.title,automationId:`tab-${e.title}`},o().createElement(mi,null))))))}));function qi(e){let{history:t}=e;return o().createElement(mt,{history:t,hideClosingButton:0===window.mailpoet_newsletters_count})}qi.propTypes={history:y().shape({push:y().func.isRequired}).isRequired};const $i=[...(()=>{const e=[];return T.ZP.each(Li,(t=>{e.push({path:`/${t.slug}/(.*)?`,component:Fi});const{events:n}=t;T.ZP.isObject(n)&&T.ZP.each(n,(n=>{e.push({path:`/new/${t.slug}/${n.slug}/conditions`,render:e=>{const a={...e,email:t,name:n.slug};return o().createElement(Ma,a)}})})),e.push({path:`/new/${t.slug}`,render:e=>{const n={...e,email:t};return o().createElement(ot,n)}})})),e})(),{path:"/notification/history/:parentId/(.*)?",component:Fi},{path:"/(standard|welcome|notification|re_engagement)/(.*)?",component:Fi},{path:"/new/standard",component:Ca},{path:"/new/notification",component:xa},{path:"/new/welcome",component:Aa},{path:"/new/re-engagement",component:function(){let e="";h.Z.settings.deactivate_subscriber_after_inactive_days&&(e=(Math.floor(Number(h.Z.settings.deactivate_subscriber_after_inactive_days)/30)-1).toString());const[t,n]=(0,s.useState)({afterTimeNumber:e,afterTimeType:"months"}),[a,r]=(0,s.useState)([]),[i,l]=(0,s.useState)(!1),c=(0,d.useHistory)();return o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),a&&o().createElement(dt,{errors:a}),o().createElement(ft,{emailType:"re_engagement",automationId:"re_engagement_heading_creation_heading"}),o().createElement(kt.r.Column,{align:"center",className:"mailpoet-schedule-email"},o().createElement(Vn,{afterTimeNumber:t.afterTimeNumber,afterTimeType:t.afterTimeType,inactiveSubscribersPeriod:Number(h.Z.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:(0,Un.compose)([n,(0,Un.assoc)("afterTimeNumber",Un.__,t)]),updateAfterTimeType:(0,Un.compose)([n,(0,Un.assoc)("afterTimeType",Un.__,t)])}),o().createElement(b.Z,{isFullWidth:!0,onClick:()=>(r([]),l(!0),void h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"newsletters",action:"create",data:{type:"re_engagement",subject:h.Z.I18n.t("draftNewsletterTitle"),options:t}}).done((e=>{var t;t=e.data.id,c.push(`/template/${t}`)})).fail((e=>{l(!1),e.errors&&r(e.errors)}))),type:"button",isDisabled:!t.afterTimeNumber||i,withSpinner:i},h.Z.I18n.t("next"))))}},{path:"/new",component:qi},{name:"template",path:"/template/:id",component:St},{path:"/send/congratulate/:id",component:ka},{path:"/send/:id",component:ea},{path:"/sending-status/:id/(.*)?",component:ii},{path:"/stats/:id/(.*)?",component:Zi}];function Ui(){return o().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},o().createElement(u.UT,null,o().createElement(et.Z,null),o().createElement(O,null),o().createElement(L,null),o().createElement(Mi,{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}),o().createElement(P,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),o().createElement(d.Switch,null,o().createElement(d.Route,{exact:!0,path:"/",render:()=>o().createElement(d.Redirect,{to:0===window.mailpoet_newsletters_count?"/new":"/standard"})}),$i.map((e=>o().createElement(d.Route,{key:e.path,path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render}))))))}const ji=document.getElementById("newsletters_container");ji&&(window.mailpoet_listing=c().render(o().createElement(Ui,null),ji));const Vi=e=>"wp_users"===e.type,Wi=e=>"woocommerce_users"===e.type,Yi=e=>Vi(e)||Wi(e),Bi=h.Z.trackingConfig.emailTrackingEnabled,Hi=[{name:"name",label:h.Z.I18n.t("name"),sortable:!0},{name:"description",label:h.Z.I18n.t("description")},{name:"average_subscriber_score",label:h.Z.I18n.t("listScore"),display:Bi},{name:"subscribed",label:h.Z.I18n.t("subscribed"),className:"mailpoet-listing-column-narrow"},{name:"unconfirmed",label:h.Z.I18n.t("unconfirmed"),className:"mailpoet-listing-column-narrow"},{name:"unsubscribed",label:h.Z.I18n.t("unsubscribed"),className:"mailpoet-listing-column-narrow"},{name:"inactive",label:h.Z.I18n.t("inactive"),className:"mailpoet-listing-column-narrow"},{name:"bounced",label:h.Z.I18n.t("bounced"),className:"mailpoet-listing-column-narrow"},{name:"created_at",label:h.Z.I18n.t("createdOn"),sortable:!0}],zi={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneSegmentTrashed"):h.Z.I18n.t("multipleSegmentsTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneSegmentDeleted"):h.Z.I18n.t("multipleSegmentsDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneSegmentRestored"):h.Z.I18n.t("multipleSegmentsRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},Ki=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:zi.onTrash}],Gi=e=>!Yi(e),Qi=[{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return o().createElement(u.rU,{to:`/edit/${e.id}`},h.Z.I18n.t("edit"))},display:function(e){return!Yi(e)}},{name:"duplicate_segment",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:(e,t)=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"duplicate",data:{id:e.id}}).done((e=>{h.Z.Notice.success(h.Z.I18n.t("listDuplicated").replace("%1$s",e.data.name)),t()})).fail((e=>{h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),display:function(e){return!Yi(e)}},{name:"read_more",className:"mailpoet-hide-on-mobile",link:function(){return o().createElement("a",{href:"https://kb.mailpoet.com/article/133-the-wordpress-users-list",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("readMore"))},display:function(e){return Vi(e)}},{name:"synchronize_segment",label:h.Z.I18n.t("forceSync"),onClick:function(e,t){h.Z.Modal.loading(!0),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"segments",action:"synchronize",data:{type:e.type}}).done((()=>{let n=h.Z.I18n.t("listSynchronized").replace("%1$s",e.name);"woocommerce_users"===e.type&&(n=h.Z.I18n.t("listSynchronizationWasScheduled").replace("%1$s",e.name)),h.Z.Modal.loading(!1),h.Z.Notice.success(n),t()})).fail((e=>{h.Z.Modal.loading(!1),e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))},display:function(e){return Vi(e)||Wi(e)}},{name:"view_subscribers",link:function(e){return o().createElement("a",{href:e.subscribers_url,"data-automation-id":`view_subscribers_${e.name}`},h.Z.I18n.t("viewSubscribers"))}},{name:"trash",className:"mailpoet-hide-on-mobile",display:function(e){return!Wi(e)}}];class Xi extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions"),a=Number(e.subscribers_count.subscribed||0),r=Number(e.subscribers_count.unconfirmed||0),i=Number(e.subscribers_count.unsubscribed||0),s=Number(e.subscribers_count.inactive||0),l=Number(e.subscribers_count.bounced||0);let c;return c=Yi(e)?o().createElement("span",{className:"mailpoet-listing-title"},e.name):o().createElement(u.rU,{className:"mailpoet-listing-title",to:`/edit/${e.id}`},e.name),o().createElement("div",null,o().createElement("td",{className:n,"data-automation-id":`segment_name_${e.name}`},c,t),o().createElement("td",{"data-colname":h.Z.I18n.t("description")},o().createElement("abbr",null,e.description)),Bi?o().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("averageScore")},o().createElement("div",{className:"mailpoet-listing-stats"},o().createElement(z,{id:e.id,engagementScore:e.average_engagement_score}))):null,o().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribed")},o().createElement("abbr",null,a.toLocaleString())),o().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("unconfirmed")},o().createElement("abbr",null,r.toLocaleString())),o().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("unsubscribed")},o().createElement("abbr",null,i.toLocaleString())),o().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("inactive")},o().createElement("abbr",null,s.toLocaleString())),o().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("bounced")},o().createElement("abbr",null,l.toLocaleString())),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("createdOn")},h.Z.Date.short(e.created_at),o().createElement("br",null),h.Z.Date.time(e.created_at)))}))}render(){return o().createElement("div",{className:"mailpoet-segments-listing"},o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:zi,search:!1,endpoint:"segments",base_url:"lists",onRenderItem:this.renderItem,columns:Hi,bulk_actions:Ki,item_actions:Qi,sort_by:"name",sort_order:"asc",isItemDeletable:Gi,isItemToggleable:Vi}))}}Xi.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var Ji=(0,d.withRouter)(Xi);const es=[{name:"name",label:h.Z.I18n.t("name"),type:"text"},{name:"description",label:h.Z.I18n.t("description"),type:"textarea",tip:h.Z.I18n.t("segmentDescriptionTip")}],ts={onUpdate:function(){h.Z.Notice.success(h.Z.I18n.t("segmentUpdated"))},onCreate:function(){h.Z.Notice.success(h.Z.I18n.t("segmentAdded")),h.Z.trackEvent("Lists > Add new")}};function ns(e){return o().createElement("div",null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(Pe.Z,null),o().createElement(Ce.Z,{level:1,className:"mailpoet-title"},o().createElement("span",null,h.Z.I18n.t("segment")),o().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:"/"},h.Z.I18n.t("backToList"))),o().createElement(O,null),o().createElement(Oe,{endpoint:"segments",fields:es,params:e.match.params,messages:ts}))}ns.propTypes={match:y().shape({params:y().shape({id:y().string}).isRequired}).isRequired};var as=ns,rs=n(41882),is=n(94878),ss=n(1030),os=n(96486),ls=n.n(os),cs=n(54791);function us(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,rs.Z)("mailpoet-dynamic-segments-form"),i=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[])?.map((e=>{const t=e.sent_at?h.Z.Date.format(e.sent_at):h.Z.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}}));return(0,s.useEffect)((()=>{n.operator!==cs.AnyValueTypes.ANY&&n.operator!==cs.AnyValueTypes.ALL&&n.operator!==cs.AnyValueTypes.NONE&&a({operator:cs.AnyValueTypes.ANY},t),n.action===cs.EmailActionTypes.MACHINE_OPENED&&n.operator===cs.AnyValueTypes.NONE&&a({operator:cs.AnyValueTypes.ANY},t)}),[n.action,n.operator,t,a]),o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",isFullWidth:!0,value:n.operator,onChange:e=>{r("operator",t,e)}},o().createElement("option",{value:cs.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:cs.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),n.action!==cs.EmailActionTypes.MACHINE_OPENED?o().createElement("option",{value:cs.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")):null)),o().createElement(kt.r.CenteredRow,null,o().createElement(ss.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:h.Z.I18n.t("selectNewsletterPlaceholder"),options:i,automationId:"segment-email",value:(0,Un.filter)((e=>{if(!n.newsletters)return;const t=e.value;return-1!==n.newsletters.indexOf(t)}),i),onChange:e=>{a({newsletters:(0,Un.map)("value",e)},t)}})))}us.propTypes={filterIndex:y().number.isRequired};const ds=e=>!!e;function ps(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,rs.Z)("mailpoet-dynamic-segments-form"),i=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),[l,c]=(0,s.useState)([]),[u,d]=(0,s.useState)([]),[p,m]=(0,s.useState)(!1),f=i?.map((e=>{const t=e.sent_at?h.Z.Date.format(e.sent_at):h.Z.I18n.t("notSentYet");return{label:e.subject,tag:t,value:Number(e.id)}})),g=(0,s.useCallback)((()=>{var e;ds(n.newsletter_id)&&(d([]),e=n.newsletter_id,c([]),m(!0),h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"newsletter_links",action:"get",data:{newsletterId:e}}).then((e=>{const{data:t}=e,n=t.map((e=>({value:e.id,label:e.url})));m(!1),d(n)})).fail((e=>{c(e.errors)})))}),[n.newsletter_id]);return(0,s.useEffect)((()=>{g()}),[g,n.newsletter_id]),(0,s.useEffect)((()=>{n.operator!==cs.AnyValueTypes.ANY&&n.operator!==cs.AnyValueTypes.ALL&&n.operator!==cs.AnyValueTypes.NONE&&a({operator:cs.AnyValueTypes.ANY},t)}),[n.operator,t,a]),o().createElement(o().Fragment,null,l.length>0&&o().createElement(dt,{errors:l}),o().createElement(kt.r.CenteredRow,null,o().createElement(ss.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectNewsletterPlaceholder"),options:f,value:(0,Un.find)(["value",n.newsletter_id],f),onChange:e=>{a({newsletter_id:e.value,link_ids:[]},t)},automationId:"segment-email"})),o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{isMinWidth:!0,key:"select-operator",value:n.operator,onChange:e=>r("operator",t,e),automationId:"select-operator"},o().createElement("option",{value:cs.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:cs.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:cs.AnyValueTypes.NONE},h.Z.I18n.t("noneOf"))),p&&o().createElement("span",null,h.Z.I18n.t("loadingDynamicSegmentItems")),!p&&ds(n.newsletter_id)&&o().createElement(ss.Z,{isMulti:!0,dimension:"small",isFullWidth:!0,automationId:"segment-link-select",placeholder:h.Z.I18n.t("allLinksPlaceholder"),options:u.length?u:[{value:0,label:h.Z.I18n.t("noLinksHint"),isDisabled:!0}],value:(0,Un.filter)((e=>!!n.link_ids&&-1!==n.link_ids.indexOf(e.value)),u),onChange:e=>{a({link_ids:(e||[]).map((e=>e.value))},t)}})))}function ms(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,rs.Z)("mailpoet-dynamic-segments-form");return(0,s.useEffect)((()=>{void 0===n.operator&&a({operator:"more"},t)}),[a,n,t]),o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,(i=e=>"{condition}"===e?o().createElement(he.Z,{key:"select",value:n.operator,onChange:e=>{r("operator",t,e)}},o().createElement("option",{value:"more"},h.Z.I18n.t("moreThan")),o().createElement("option",{value:"less"},h.Z.I18n.t("lessThan")),o().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),o().createElement("option",{value:"not_equals"},h.Z.I18n.t("notEquals"))):"{opens}"===e?o().createElement(le.Z,{key:"input",type:"number",value:n.opens||"","data-automation-id":"segment-number-of-opens",onChange:e=>{r("opens",t,e)},min:"0",placeholder:h.Z.I18n.t("emailActionOpens")}):"string"==typeof e&&e.trim().length>1?o().createElement("div",{key:"opens"},e):null,h.Z.I18n.t("emailActionOpensSentence").split(/({condition})|({opens})|(\b[a-zA-Z]+\b)/gim).map(i))),o().createElement(kt.r.CenteredRow,null,h.Z.I18n.t("emailActionOpensDaysSentence").split(/({days})/gim).map((e=>"{days}"===e?o().createElement(le.Z,{key:"input",type:"number",value:n.days||"","data-automation-id":"segment-number-of-days",onChange:e=>{r("days",t,e)},min:"0",placeholder:h.Z.I18n.t("emailActionDays")}):"string"==typeof e&&e.trim().length>1?o().createElement("div",{key:e},e):null))));var i}ps.propTypes={filterIndex:y().number.isRequired},ms.propTypes={filterIndex:y().number.isRequired};const hs=[{value:cs.EmailActionTypes.OPENS_ABSOLUTE_COUNT,label:h.Z.I18n.t("emailActionOpensAbsoluteCount"),group:cs.SegmentTypes.Email},{value:cs.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT,label:h.Z.I18n.t("emailActionMachineOpensAbsoluteCount"),group:cs.SegmentTypes.Email},{value:cs.EmailActionTypes.OPENED,label:h.Z.I18n.t("emailActionOpened"),group:cs.SegmentTypes.Email},{value:cs.EmailActionTypes.MACHINE_OPENED,label:h.Z.I18n.t("emailActionMachineOpened"),group:cs.SegmentTypes.Email},{value:cs.EmailActionTypes.CLICKED,label:h.Z.I18n.t("emailActionClicked"),group:cs.SegmentTypes.Email},{value:cs.EmailActionTypes.CLICKED_ANY,label:h.Z.I18n.t("emailActionClickedAnyEmail"),group:cs.SegmentTypes.Email}],fs={[cs.EmailActionTypes.OPENS_ABSOLUTE_COUNT]:ms,[cs.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT]:ms,[cs.EmailActionTypes.CLICKED]:ps,[cs.EmailActionTypes.OPENED]:us,[cs.EmailActionTypes.MACHINE_OPENED]:us,[cs.EmailActionTypes.CLICKED_ANY]:null};function gs(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),a=fs[n.action];return a?o().createElement(a,{filterIndex:t}):null}var vs;gs.propTypes={filterIndex:y().number.isRequired},function(e){e.NUMBER_OF_ORDERS="numberOfOrders",e.PURCHASED_CATEGORY="purchasedCategory",e.PURCHASED_PRODUCT="purchasedProduct",e.TOTAL_SPENT="totalSpent",e.CUSTOMER_IN_COUNTRY="customerInCountry"}(vs||(vs={}));const ys=[{value:vs.CUSTOMER_IN_COUNTRY,label:h.Z.I18n.t("wooCustomerInCountry"),group:cs.SegmentTypes.WooCommerce},{value:vs.NUMBER_OF_ORDERS,label:h.Z.I18n.t("wooNumberOfOrders"),group:cs.SegmentTypes.WooCommerce},{value:vs.PURCHASED_CATEGORY,label:h.Z.I18n.t("wooPurchasedCategory"),group:cs.SegmentTypes.WooCommerce},{value:vs.PURCHASED_PRODUCT,label:h.Z.I18n.t("wooPurchasedProduct"),group:cs.SegmentTypes.WooCommerce},{value:vs.TOTAL_SPENT,label:h.Z.I18n.t("wooTotalSpent"),group:cs.SegmentTypes.WooCommerce}],bs=[vs.PURCHASED_PRODUCT,vs.PURCHASED_CATEGORY],ws=e=>{let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,rs.Z)("mailpoet-dynamic-segments-form"),i=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getProductCategories()),[]),l=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCountries()),[]),c=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getProducts()),[]),u=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCurrencySymbol()),[]),d=c.map((e=>({value:e.id,label:e.name}))),p=i.map((e=>({value:e.id,label:e.name}))),m=l.map((e=>({value:e.code,label:e.name})));let f;return(0,s.useEffect)((()=>{void 0===n.number_of_orders_type&&n.action===vs.NUMBER_OF_ORDERS&&a({number_of_orders_type:"="},t),void 0===n.total_spent_type&&n.action===vs.TOTAL_SPENT&&a({total_spent_type:">"},t),bs.includes(n.action)&&n.operator!==cs.AnyValueTypes.ALL&&n.operator!==cs.AnyValueTypes.ANY&&n.operator!==cs.AnyValueTypes.NONE&&a({operator:cs.AnyValueTypes.ANY},t),n.action===vs.CUSTOMER_IN_COUNTRY&&n.operator!==cs.AnyValueTypes.ANY&&n.operator!==cs.AnyValueTypes.NONE&&a({operator:cs.AnyValueTypes.ANY},t)}),[a,n,t]),n.action===vs.PURCHASED_PRODUCT?f=o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>a({operator:e.target.value},t),automationId:"select-operator"},o().createElement("option",{value:cs.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:cs.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:cs.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ss.Z,{isMulti:!0,dimension:"small",key:"select-segment-products",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooPurchasedProduct"),options:d,value:(0,Un.filter)((e=>{if(void 0!==n.product_ids&&0!==n.product_ids.length)return-1!==n.product_ids.indexOf(e.value)}),d),onChange:e=>a({product_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-products"}))):n.action===vs.PURCHASED_CATEGORY?f=o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>a({operator:e.target.value},t),automationId:"select-operator"},o().createElement("option",{value:cs.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:cs.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:cs.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ss.Z,{isMulti:!0,dimension:"small",key:"select-segment-category",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooPurchasedCategory"),options:p,value:(0,Un.filter)((e=>{if(void 0!==n.category_ids&&0!==n.category_ids.length)return-1!==n.category_ids.indexOf(e.value)}),p),onChange:e=>a({category_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-category"}))):n.action===vs.NUMBER_OF_ORDERS?f=o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",value:n.number_of_orders_type,onChange:e=>{r("number_of_orders_type",t,e)},automationId:"select-number-of-orders-type"},o().createElement("option",{value:"="},h.Z.I18n.t("equals")),o().createElement("option",{value:"!="},h.Z.I18n.t("notEquals")),o().createElement("option",{value:">"},h.Z.I18n.t("moreThan")),o().createElement("option",{value:"<"},h.Z.I18n.t("lessThan"))),o().createElement(le.Z,{"data-automation-id":"input-number-of-orders-count",type:"number",min:0,value:n.number_of_orders_count||"",placeholder:h.Z.I18n.t("wooNumberOfOrdersCount"),onChange:e=>{r("number_of_orders_count",t,e)}}),o().createElement("div",null,h.Z.I18n.t("wooNumberOfOrdersOrders"))),o().createElement(kt.r.CenteredRow,null,o().createElement("div",null,h.Z.I18n.t("inTheLast")),o().createElement(le.Z,{"data-automation-id":"input-number-of-orders-days",type:"number",min:1,value:n.number_of_orders_days||"",placeholder:h.Z.I18n.t("daysPlaceholder"),onChange:e=>{r("number_of_orders_days",t,e)}}),o().createElement("div",null,h.Z.I18n.t("days")))):n.action===vs.TOTAL_SPENT?f=o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",value:n.total_spent_type,onChange:e=>{r("total_spent_type",t,e)},automationId:"select-total-spent-type"},o().createElement("option",{value:"="},h.Z.I18n.t("equals")),o().createElement("option",{value:"!="},h.Z.I18n.t("notEquals")),o().createElement("option",{value:">"},h.Z.I18n.t("moreThan")),o().createElement("option",{value:"<"},h.Z.I18n.t("lessThan"))),o().createElement(le.Z,{"data-automation-id":"input-total-spent-amount",type:"number",min:0,step:.01,value:n.total_spent_amount||"",placeholder:h.Z.I18n.t("wooTotalSpentAmount"),onChange:e=>{r("total_spent_amount",t,e)}}),o().createElement("div",null,u)),o().createElement(kt.r.CenteredRow,null,o().createElement("div",null,h.Z.I18n.t("inTheLast")),o().createElement(le.Z,{"data-automation-id":"input-total-spent-days",type:"number",min:1,value:n.total_spent_days||"",placeholder:h.Z.I18n.t("daysPlaceholder"),onChange:e=>{r("total_spent_days",t,e)}}),o().createElement("div",null,h.Z.I18n.t("days")))):n.action===vs.CUSTOMER_IN_COUNTRY&&(f=o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator-country",value:n.operator,onChange:e=>a({operator:e.target.value},t),automationId:"select-operator-country"},o().createElement("option",{value:cs.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:cs.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ss.Z,{dimension:"small",key:"select-segment-country",isFullWidth:!0,isMulti:!0,placeholder:h.Z.I18n.t("selectWooCountry"),options:m,value:(0,Un.filter)((e=>{if(n.country_code)return-1!==n.country_code.indexOf(e.value)}),m),onChange:e=>a({country_code:(e||[]).map((e=>e.value))},t),automationId:"select-segment-country"})))),f};function _s(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,rs.Z)("mailpoet-dynamic-segments-form");(0,s.useEffect)((()=>{n.action===cs.SubscriberActionTypes.WORDPRESS_ROLE&&n.operator!==cs.AnyValueTypes.ANY&&n.operator!==cs.AnyValueTypes.ALL&&n.operator!==cs.AnyValueTypes.NONE&&a({operator:cs.AnyValueTypes.ANY},t)}),[a,n,t]);const i=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getWordpressRoles()),[]).map((e=>({value:e.role_id,label:e.role_name})));return o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",isFullWidth:!0,value:n.operator,onChange:e=>{r("operator",t,e)}},o().createElement("option",{value:cs.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:cs.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:cs.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ss.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,automationId:"segment-wordpress-role",placeholder:h.Z.I18n.t("selectUserRolePlaceholder"),options:i,value:(0,Un.filter)((e=>{if(n.wordpressRole)return-1!==n.wordpressRole.indexOf(e.value)}),i),onChange:e=>{a({wordpressRole:(0,Un.map)("value",e)},t)}})))}let Es;ws.propTypes={filterIndex:y().number.isRequired},_s.propTypes={filterIndex:y().number.isRequired},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"}(Es||(Es={}));const Zs=[Es.HIGHER_THAN,Es.LOWER_THAN,Es.EQUALS,Es.NOT_EQUALS,Es.UNKNOWN,Es.NOT_UNKNOWN];function Is(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,rs.Z)("mailpoet-dynamic-segments-form");return(0,s.useEffect)((()=>{Zs.includes(n.operator)||a({operator:Es.HIGHER_THAN},t),n.operator!==Es.HIGHER_THAN&&n.operator!==Es.LOWER_THAN&&n.operator!==Es.EQUALS&&n.operator!==Es.NOT_EQUALS||void 0!==n.value||a({value:""},t),n.operator!==Es.UNKNOWN&&n.operator!==Es.NOT_UNKNOWN||a({value:null},t)}),[a,n,t]),o().createElement(kt.r.CenteredRow,null,(i=e=>"{condition}"===e?o().createElement(he.Z,{key:"select",value:n.operator,automationId:"segment-subscriber-score-operator",onChange:e=>{r("operator",t,e)}},o().createElement("option",{value:Es.HIGHER_THAN},h.Z.I18n.t("higherThan")),o().createElement("option",{value:Es.LOWER_THAN},h.Z.I18n.t("lowerThan")),o().createElement("option",{value:Es.EQUALS},h.Z.I18n.t("equals")),o().createElement("option",{value:Es.NOT_EQUALS},h.Z.I18n.t("notEquals")),o().createElement("option",{value:Es.UNKNOWN},h.Z.I18n.t("unknown")),o().createElement("option",{value:Es.NOT_UNKNOWN},h.Z.I18n.t("notUnknown"))):"{score}"===e?(n.operator===Es.HIGHER_THAN||n.operator===Es.LOWER_THAN||n.operator===Es.EQUALS||n.operator===Es.NOT_EQUALS)&&o().createElement(le.Z,{key:"input",type:"number",value:n.value||"","data-automation-id":"segment-subscriber-score-value",onChange:e=>{r("value",t,e)},min:"0",placeholder:h.Z.I18n.t("subscriberScorePlaceholder")}):"string"==typeof e&&e.trim().length>0?n.operator!==Es.UNKNOWN&&n.operator!==Es.NOT_UNKNOWN&&o().createElement("div",{key:"score"},e):null,h.Z.I18n.t("subscriberScoreSentence").split(/({condition})|({score})|(\b%\b)/gim).map(i)));var i}Is.propTypes={filterIndex:y().number.isRequired};var Ss=n(23855),ks=n(12274);let Ts;!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"}(Ts||(Ts={}));const Cs=[Ts.BEFORE,Ts.AFTER,Ts.ON,Ts.NOT_ON,Ts.IN_THE_LAST,Ts.NOT_IN_THE_LAST],Ns=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return h.Z.Date.format(e,{format:"Y-m-d"})}},Ds=e=>{const t=(0,Ss.default)(e);if((0,ks.default)(t))return t};function xs(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,rs.Z)("mailpoet-dynamic-segments-form");return(0,s.useEffect)((()=>{Cs.includes(n.operator)||a({operator:Ts.BEFORE},t),n.operator!==Ts.BEFORE&&n.operator!==Ts.AFTER&&n.operator!==Ts.ON&&n.operator!==Ts.NOT_ON||void 0!==Ds(n.value)&&/^\d+-\d+-\d+$/.test(n.value)||a({value:Ns(new Date)},t),n.operator!==Ts.IN_THE_LAST&&n.operator!==Ts.NOT_IN_THE_LAST||"string"!=typeof n.value||/^\d*$/.exec(n.value)||a({value:""},t)}),[a,n,t]),o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",value:n.operator,onChange:e=>{r("operator",t,e)}},o().createElement("option",{value:Ts.BEFORE},h.Z.I18n.t("before")),o().createElement("option",{value:Ts.AFTER},h.Z.I18n.t("after")),o().createElement("option",{value:Ts.ON},h.Z.I18n.t("on")),o().createElement("option",{value:Ts.NOT_ON},h.Z.I18n.t("notOn")),o().createElement("option",{value:Ts.IN_THE_LAST},h.Z.I18n.t("inTheLast")),o().createElement("option",{value:Ts.NOT_IN_THE_LAST},h.Z.I18n.t("notInTheLast"))),(n.operator===Ts.BEFORE||n.operator===Ts.AFTER||n.operator===Ts.ON||n.operator===Ts.NOT_ON)&&o().createElement(Dt,{dateFormat:"MMM d, yyyy",onChange:e=>{a({value:Ns(e)},t)},selected:n.value?Ds(n.value):void 0}),(n.operator===Ts.IN_THE_LAST||n.operator===Ts.NOT_IN_THE_LAST)&&o().createElement(o().Fragment,null,o().createElement(le.Z,{key:"input",type:"number",value:n.value,onChange:e=>{r("value",t,e)},min:"1",placeholder:h.Z.I18n.t("daysPlaceholder")}),o().createElement("span",null,h.Z.I18n.t("daysPlaceholder"))))}function Rs(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 Os(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:a,updateSegmentFilter:r}=(0,rs.Z)("mailpoet-dynamic-segments-form");return(0,s.useEffect)((()=>{void 0===n.operator&&r({operator:"equals",value:""},t)}),[r,n,t]),o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",automationId:"text-custom-field-operator",value:n.operator,onChange:e=>{a("operator",t,e)}},o().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),o().createElement("option",{value:"not_equals"},h.Z.I18n.t("notEquals")),o().createElement("option",{value:"contains"},h.Z.I18n.t("contains")),o().createElement("option",{value:"more_than"},h.Z.I18n.t("moreThan")),o().createElement("option",{value:"less_than"},h.Z.I18n.t("lessThan"))),o().createElement(le.Z,{key:"input","data-automation-id":"text-custom-field-value",value:n.value||"",onChange:e=>{a("value",t,e)},placeholder:h.Z.I18n.t("value")}))}function As(e){return"string"==typeof e.value&&e.value.length>0}function Ps(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,rs.Z)("mailpoet-dynamic-segments-form"),r=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),i=(0,Un.find)({id:Number(n.custom_field_id)},r);if(!i)return null;const s=i.params;if(!s||!Array.isArray(s.values))return null;const l=s.values.map((e=>({value:e.value,label:e.value})));return o().createElement(ss.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectValue"),options:l,value:n.value?{value:n.value,label:n.value}:null,onChange:e=>{a({value:e.value,operator:"equals"},t)},automationId:"segment-wordpress-role"})}function Ms(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilterFromEvent:a,updateSegmentFilter:r}=(0,rs.Z)("mailpoet-dynamic-segments-form");return(0,s.useEffect)((()=>{"1"!==n.value&&"0"!==n.value&&r({operator:"equals",value:"1"},t)}),[r,n,t]),o().createElement(he.Z,{key:"select",value:n.value,onChange:e=>a("value",t,e)},o().createElement("option",{value:"1"},h.Z.I18n.t("checked")),o().createElement("option",{value:"0"},h.Z.I18n.t("unchecked")))}xs.propTypes={filterIndex:y().number.isRequired},Os.propTypes={filterIndex:y().number.isRequired},Ps.propTypes={filterIndex:y().number.isRequired},Ms.propTypes={filterIndex:y().number.isRequired};var Ls=n(95570),Fs=n(49546);function qs(e){let{onChange:t,item:n,filterIndex:a}=e;return(0,s.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Un.assign)(n,{value:"2017-01-01 00:00:00"}),a)}),[t,n,a]),o().createElement(he.Z,{key:"select",value:n.value,onChange:e=>{t((0,Un.assign)(n,{value:e.target.value}),a)}},o().createElement("option",{value:"2017-01-01 00:00:00"},h.Z.I18n.t("january")),o().createElement("option",{value:"2017-02-01 00:00:00"},h.Z.I18n.t("february")),o().createElement("option",{value:"2017-03-01 00:00:00"},h.Z.I18n.t("march")),o().createElement("option",{value:"2017-04-01 00:00:00"},h.Z.I18n.t("april")),o().createElement("option",{value:"2017-05-01 00:00:00"},h.Z.I18n.t("may")),o().createElement("option",{value:"2017-06-01 00:00:00"},h.Z.I18n.t("june")),o().createElement("option",{value:"2017-07-01 00:00:00"},h.Z.I18n.t("july")),o().createElement("option",{value:"2017-08-01 00:00:00"},h.Z.I18n.t("august")),o().createElement("option",{value:"2017-09-01 00:00:00"},h.Z.I18n.t("september")),o().createElement("option",{value:"2017-10-01 00:00:00"},h.Z.I18n.t("october")),o().createElement("option",{value:"2017-11-01 00:00:00"},h.Z.I18n.t("november")),o().createElement("option",{value:"2017-12-01 00:00:00"},h.Z.I18n.t("december")))}function $s(e){let{onChange:t,item:n,filterIndex:a}=e;const r=(0,Ls.default)(new Date);return(0,s.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Un.assign)(n,{value:`${r}-01-01 00:00:00`,operator:"equals"}),a)}),[r,t,n,a]),o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>{t((0,Un.assign)(n,{operator:e.target.value}),a)}},o().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),o().createElement("option",{value:"before"},h.Z.I18n.t("before")),o().createElement("option",{value:"after"},h.Z.I18n.t("after"))),o().createElement(he.Z,{key:"select-year",value:n.value,onChange:e=>{t((0,Un.assign)(n,{value:e.target.value}),a)}},(0,Un.range)(0,100).map((e=>o().createElement("option",{value:r-e+"-01-01 00:00:00",key:r-e},r-e)))))}qs.propTypes={filterIndex:y().number.isRequired},$s.propTypes={filterIndex:y().number.isRequired};const Us=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return(0,Fs.default)(e,"yyyy-MM-dd 00:00:00")}},js=e=>{const t=(0,Ss.default)(e);if((0,ks.default)(t))return t};function Vs(e){let{onChange:t,item:n,filterIndex:a}=e;return(0,s.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Un.assign)(n,{value:`${(0,Fs.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),a)}),[t,n,a]),o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>{t((0,Un.assign)(n,{operator:e.target.value}),a)}},o().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),o().createElement("option",{value:"before"},h.Z.I18n.t("before")),o().createElement("option",{value:"after"},h.Z.I18n.t("after"))),o().createElement(Dt,{dateFormat:"MMM d, yyyy",onChange:e=>t((0,Un.assign)(n,{value:Us(e)}),a),selected:n.value?js(n.value):void 0}))}function Ws(e){let{onChange:t,item:n,filterIndex:a}=e;return(0,s.useEffect)((()=>{void 0!==n.value&&""!==n.value||t((0,Un.assign)(n,{value:`${(0,Fs.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),a)}),[t,n,a]),o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>{t((0,Un.assign)(n,{operator:e.target.value}),a)}},o().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),o().createElement("option",{value:"before"},h.Z.I18n.t("before")),o().createElement("option",{value:"after"},h.Z.I18n.t("after"))),o().createElement(Dt,{onChange:e=>t((0,Un.assign)(n,{value:Us(e)}),a),selected:n.value?js(n.value):void 0,dateFormat:"MM/yyyy",showMonthYearPicker:!0}))}Vs.propTypes={filterIndex:y().number.isRequired},Ws.propTypes={filterIndex:y().number.isRequired};const Ys={month:qs,year:$s,year_month:Ws,year_month_day:Vs};function Bs(e){let{customField:t,filterIndex:n}=e;const a=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(n)),[n]),{updateSegmentFilter:r}=(0,rs.Z)("mailpoet-dynamic-segments-form");(0,s.useEffect)((()=>{a.date_type!==t.params.date_type&&r({date_type:t.params.date_type,value:""},n)}),[a.date_type,r,t.params.date_type,n]);const i=Ys[t.params.date_type];return i?o().createElement(i,{item:a,onChange:r,filterIndex:n}):null}var Hs;Bs.propTypes={customField:y().shape({params:y().shape({date_type:y().string.isRequired}).isRequired}).isRequired,filterIndex:y().number.isRequired},function(e){e.DATE="date",e.TEXT="text",e.TEXTAREA="textarea",e.RADIO="radio",e.CHECKBOX="checkbox",e.SELECT="select"}(Hs||(Hs={}));const zs={[Hs.TEXT]:Rs,[Hs.TEXTAREA]:Rs,[Hs.RADIO]:As,[Hs.SELECT]:As,[Hs.CHECKBOX]:function(e){return"1"===e.value||"0"===e.value},[Hs.DATE]:function(e){return("month"===e.date_type||!("string"!=typeof e.operator||e.operator.length<1))&&"string"==typeof e.value&&e.value.length>1}},Ks={[Hs.TEXT]:Os,[Hs.TEXTAREA]:Os,[Hs.RADIO]:Ps,[Hs.SELECT]:Ps,[Hs.CHECKBOX]:Ms,[Hs.DATE]:Bs};function Gs(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,rs.Z)("mailpoet-dynamic-segments-form"),r=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),i=(0,Un.find)({id:Number(n.custom_field_id)},r),s=r.map((e=>({value:e.id.toString(),label:e.name}))),l=Ks[n.custom_field_type];return o().createElement(o().Fragment,null,o().createElement("div",null,o().createElement(ss.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectCustomFieldPlaceholder"),options:s,automationId:"select-custom-field",value:(0,Un.find)((e=>{if(n.custom_field_id)return n.custom_field_id===e.value}),s),onChange:e=>{const n=(0,Un.find)({id:Number(e.value)},r);n&&a({custom_field_id:e.value,custom_field_type:n.type,operator:void 0,value:void 0},t)}})),o().createElement("div",null,l&&o().createElement(l,{customField:i,filterIndex:t})))}function Qs(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),a=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getStaticSegmentsList()),[]),{updateSegmentFilter:r,updateSegmentFilterFromEvent:i}=(0,rs.Z)("mailpoet-dynamic-segments-form");(0,s.useEffect)((()=>{n.operator!==cs.AnyValueTypes.ANY&&n.operator!==cs.AnyValueTypes.ALL&&n.operator!==cs.AnyValueTypes.NONE&&r({operator:cs.AnyValueTypes.ANY},t)}),[r,n,t]);const l=a.map((e=>({value:e.id,label:e.name})));return o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select",isFullWidth:!0,value:n.operator,onChange:e=>{i("operator",t,e)}},o().createElement("option",{value:cs.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:cs.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:cs.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ss.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:h.Z.I18n.t("searchLists"),options:l,value:(0,Un.filter)((e=>{if(!n.segments)return;const t=e.value;return-1!==n.segments.indexOf(t)}),l),onChange:e=>{r({segments:(0,Un.map)("value",e)},t)}})))}Gs.propTypes={filterIndex:y().number.isRequired},Qs.propTypes={filterIndex:y().number.isRequired};const Xs=[{value:cs.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD,label:h.Z.I18n.t("mailpoetCustomField"),group:cs.SegmentTypes.WordPressRole},{value:cs.SubscriberActionTypes.SUBSCRIBER_SCORE,label:h.Z.I18n.t("subscriberScore"),group:cs.SegmentTypes.WordPressRole},{value:cs.SubscriberActionTypes.SUBSCRIBED_DATE,label:h.Z.I18n.t("subscribedDate"),group:cs.SegmentTypes.WordPressRole},{value:cs.SubscriberActionTypes.SUBSCRIBED_TO_LIST,label:h.Z.I18n.t("subscribedToList"),group:cs.SegmentTypes.WordPressRole},{value:cs.SubscriberActionTypes.WORDPRESS_ROLE,label:h.Z.I18n.t("segmentsSubscriber"),group:cs.SegmentTypes.WordPressRole}],Js={[cs.SubscriberActionTypes.WORDPRESS_ROLE]:_s,[cs.SubscriberActionTypes.SUBSCRIBER_SCORE]:Is,[cs.SubscriberActionTypes.SUBSCRIBED_DATE]:xs,[cs.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD]:Gs,[cs.SubscriberActionTypes.SUBSCRIBED_TO_LIST]:Qs};function eo(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);let a;return a=n.action?Js[n.action]:_s,a?o().createElement(a,{filterIndex:t}):null}var to;eo.propTypes={filterIndex:y().number.isRequired},function(e){e.MEMBER_OF="isMemberOf"}(to||(to={}));const no=[{value:to.MEMBER_OF,label:h.Z.I18n.t("segmentsActiveMembership"),group:cs.SegmentTypes.WooCommerceMembership}];function ao(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,rs.Z)("mailpoet-dynamic-segments-form"),i=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getMembershipPlans()),[]).map((e=>({value:e.id,label:e.name})));return(0,s.useEffect)((()=>{n.action===to.MEMBER_OF&&n.operator!==cs.AnyValueTypes.ANY&&n.operator!==cs.AnyValueTypes.ALL&&n.operator!==cs.AnyValueTypes.NONE&&a({operator:cs.AnyValueTypes.ANY},t)}),[a,n,t]),o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>r("operator",t,e),automationId:"select-operator"},o().createElement("option",{value:cs.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:cs.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:cs.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ss.Z,{isMulti:!0,dimension:"small",key:"select-segment-membership-plan",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooMembership"),options:i,value:(0,Un.filter)((e=>!!n.plan_ids&&-1!==n.plan_ids.indexOf(e.value)),i),onChange:e=>a({plan_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-plans"})))}var ro;ao.propTypes={filterIndex:y().number.isRequired},function(e){e.ACTIVE_SUBSCRIPTIONS="hasActiveSubscription"}(ro||(ro={}));const io=[{value:ro.ACTIVE_SUBSCRIPTIONS,label:h.Z.I18n.t("segmentsActiveSubscription"),group:cs.SegmentTypes.WooCommerceSubscription}];function so(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,rs.Z)("mailpoet-dynamic-segments-form"),i=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriptionProducts()),[]).map((e=>({value:e.id,label:e.name})));return(0,s.useEffect)((()=>{n.action===ro.ACTIVE_SUBSCRIPTIONS&&n.operator!==cs.AnyValueTypes.ANY&&n.operator!==cs.AnyValueTypes.ALL&&n.operator!==cs.AnyValueTypes.NONE&&a({operator:cs.AnyValueTypes.ANY},t)}),[a,n,t]),o().createElement(o().Fragment,null,o().createElement(kt.r.CenteredRow,null,o().createElement(he.Z,{key:"select-operator",value:n.operator,onChange:e=>r("operator",t,e),automationId:"select-operator"},o().createElement("option",{value:cs.AnyValueTypes.ANY},h.Z.I18n.t("anyOf")),o().createElement("option",{value:cs.AnyValueTypes.ALL},h.Z.I18n.t("allOf")),o().createElement("option",{value:cs.AnyValueTypes.NONE},h.Z.I18n.t("noneOf")))),o().createElement(kt.r.CenteredRow,null,o().createElement(ss.Z,{isMulti:!0,dimension:"small",key:"select-segment-category",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooSubscription"),options:i,value:(0,Un.filter)((e=>!!n.product_ids&&-1!==n.product_ids.indexOf(e.value)),i),onChange:e=>a({product_ids:(e||[]).map((e=>e.value))},t),automationId:"select-segment-products"})))}so.propTypes={filterIndex:y().number.isRequired};const oo={[cs.SegmentTypes.Email]:function(e){return!!Object.values(cs.EmailActionTypes).some((t=>t===e.action))&&(e.action===cs.EmailActionTypes.CLICKED_ANY||(e.action===cs.EmailActionTypes.CLICKED?!!e.newsletter_id:e.action!==cs.EmailActionTypes.OPENS_ABSOLUTE_COUNT&&e.action!==cs.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT?Array.isArray(e.newsletters)&&e.newsletters.length>0:!!e.days&&!!e.opens&&!!e.operator))},[cs.SegmentTypes.WooCommerce]:function(e){if(!Object.values(vs).some((t=>t===e.action)))return!1;const t=void 0===e.category_ids||0===e.category_ids.length||!e.operator;if(e.action===vs.PURCHASED_CATEGORY&&t)return!1;const n=void 0===e.product_ids||0===e.product_ids.length||!e.operator;if(e.action===vs.PURCHASED_PRODUCT&&n)return!1;const a=void 0===e.country_code||0===e.country_code.length;if(e.action===vs.CUSTOMER_IN_COUNTRY&&a)return!1;const r=!e.number_of_orders_count||!e.number_of_orders_days||!e.number_of_orders_type;return!(e.action===vs.NUMBER_OF_ORDERS&&r||!(e.action!==vs.TOTAL_SPENT||e.total_spent_amount&&e.total_spent_days&&e.total_spent_type))},[cs.SegmentTypes.WordPressRole]:function(e){return e.action&&e.action!==cs.SubscriberActionTypes.WORDPRESS_ROLE?e.action===cs.SubscriberActionTypes.MAILPOET_CUSTOM_FIELD?function(e){const t=zs[e.custom_field_type];return!!t&&t(e)}(e):e.action===cs.SubscriberActionTypes.SUBSCRIBER_SCORE?function(e){if(e.operator===Es.HIGHER_THAN||e.operator===Es.LOWER_THAN||e.operator===Es.EQUALS||e.operator===Es.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===Es.UNKNOWN||e.operator===Es.NOT_UNKNOWN}(e):e.action===cs.SubscriberActionTypes.SUBSCRIBED_TO_LIST?function(e){return(e.operator===cs.AnyValueTypes.ANY||e.operator===cs.AnyValueTypes.ALL||e.operator===cs.AnyValueTypes.NONE)&&Array.isArray(e.segments)&&e.segments.length>0}(e):!(!e.operator||!e.value)&&(e.operator===Ts.BEFORE||e.operator===Ts.AFTER||e.operator===Ts.ON||e.operator===Ts.NOT_ON?/^\d+-\d+-\d+$/.test(e.value):(e.operator===Ts.IN_THE_LAST||e.operator===Ts.NOT_IN_THE_LAST)&&(/^\d+$/.test(e.value)&&Number(e.value)>0)):Array.isArray(e.wordpressRole)&&e.wordpressRole.length>0},[cs.SegmentTypes.WooCommerceMembership]:function(e){const t=!e.plan_ids||!e.plan_ids.length||!e.operator;return e.action!==to.MEMBER_OF||!t},[cs.SegmentTypes.WooCommerceSubscription]:function(e){const t=!e.product_ids||!e.product_ids.length||!e.operator;return e.action!==ro.ACTIVE_SUBSCRIPTIONS||!t}};function lo(e){return!(e.length<1)&&0===e.map((e=>void 0!==oo[e.segmentType]&&oo[e.segmentType](e))).filter((e=>!1===e)).length}let co,uo;function po(){const e=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),{updateSubscriberCount:n}=(0,rs.Z)("mailpoet-dynamic-segments-form"),a=JSON.stringify(e),r=(0,s.useRef)(1),i=(0,s.useRef)(null),l=(0,s.useRef)(!1),c=(0,s.useRef)((0,os.debounce)((function e(t){if(l.current)return void(i.current=t);i.current=null,r.current+=1;const a=r.current;l.current=!0,function(e){const t={filters:e.filters,filters_connect:e.filters_connect};return ls().isEqual(t,co)?Promise.resolve(uo):(co={filters:[...e.filters],filters_connect:e.filters_connect},h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"dynamic_segments",action:"getCount",data:e,timeout:2e4}).then((e=>{const{data:t}=e;return uo={count:t.count,errors:void 0},uo})))}(t).then((t=>{if(l.current=!1,i.current)return void e(i.current);if(a!==r.current)return;const s={loading:!1};t&&(s.count=t.count,s.errors=t.errors),n(s)}),(e=>{l.current=!1;const t={},a=e.errors.map((e=>e.message));t.loading=!1,t.count=void 0,t.errors=a,n(t)}))}),2e3,{trailing:!0}));return(0,s.useEffect)((()=>{lo(e.filters)?(n({loading:!0,count:void 0,errors:void 0}),(0,c.current)(e)):n({count:void 0,loading:!1})}),[e,a,n]),t.errors?o().createElement("div",{className:"mailpoet-form-field"},o().createElement("span",{className:"mailpoet-form-error-message"},h.Z.I18n.t("dynamicSegmentSizeCalculatingTimeout")," ",o().createElement("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"},h.Z.I18n.t("learnMore")))):t.loading||void 0!==t.count?t.loading?o().createElement("div",{className:"mailpoet-form-field"},o().createElement("span",{className:"mailpoet-form-notice-message"},h.Z.I18n.t("dynamicSegmentSizeIsCalculated"))):o().createElement("div",{className:"mailpoet-form-field"},o().createElement("span",{className:"mailpoet-form-notice-message"},h.Z.I18n.t("dynamicSegmentSize").replace("%1$d",t.count.toLocaleString()))):o().createElement("span",null)}const mo={[cs.SegmentTypes.Email]:gs,[cs.SegmentTypes.WooCommerce]:ws,[cs.SegmentTypes.WordPressRole]:eo,[cs.SegmentTypes.WooCommerceMembership]:ao,[cs.SegmentTypes.WooCommerceSubscription]:so};function ho(e){let{filterIndex:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]);if(void 0===n||void 0===mo[n.segmentType])return null;const a=mo[n.segmentType];return o().createElement(a,{filterIndex:t})}function fo(){const e=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=[cs.EmailActionTypes.OPENED,cs.EmailActionTypes.OPENS_ABSOLUTE_COUNT,cs.EmailActionTypes.MACHINE_OPENED,cs.EmailActionTypes.MACHINE_OPENS_ABSOLUTE_COUNT];let n=!1;return e.filters.forEach((e=>{t.includes(e.action)&&(n=!0)})),n?o().createElement("div",{className:"mailpoet-form-field"},o().createElement("span",{className:"mailpoet-form-notice-message"},h.Z.I18n.t("privacyProtectionNotice"))):o().createElement("span",null)}ho.propTypes={filterIndex:y().number.isRequired};const{subscribersLimitReached:go,subscribersLimit:vo,subscribersCount:yo,premiumActive:bo,hasValidApiKey:wo,hasValidPremiumKey:_o,isPremiumPluginInstalled:Eo,premiumPluginDownloadUrl:Zo,premiumPluginActivationUrl:Io,pluginPartialKey:So}=h.Z,ko=wo||_o,To=e=>{const t=h.Z.I18n.t(e);return o().createElement("p",null,x()(t,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?yo:vo)))},Co=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_blank";return o().createElement(b.Z,{href:t,target:n,rel:"noopener noreferrer"},h.Z.I18n.t(e))};function No(e){let t,n,{message:a,actionButton:r}=e;if(ko&&!bo)t=To("premiumFeatureDescription"),n=Eo?Co("premiumFeatureButtonActivatePremium",Io,"_self"):Co("premiumFeatureButtonDownloadPremium",Zo);else if(go){t=To("premiumFeatureDescriptionSubscribersLimitReached");const e=ko?h.Z.MailPoetComUrlFactory.getUpgradeUrl(So):h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(+yo+1);n=Co("premiumFeatureButtonUpgradePlan",e)}else t=a,n=r;return o().createElement(Ge.Z,{title:h.Z.I18n.t("premiumFeature"),message:t,actionButton:n})}No.propTypes={message:y().node.isRequired,actionButton:y().node.isRequired};var Do=No,xo=function(){return o().createElement(Do,{message:(()=>{const e=h.Z.I18n.t("premiumFeatureMultipleConditions");return o().createElement("p",null,x()(e,/\[link](.*?)\[\/link]/g,(e=>o().createElement("a",{key:e,href:h.Z.premiumLink,target:"_blank",rel:"noopener noreferrer"},e))))})(),actionButton:o().createElement(b.Z,{href:h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount,h.Z.currentWpUserEmail,null,{utm_medium:"segments",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("premiumBannerCtaFree"))})};const Ro=Ke().applyFilters("mailpoet_dynamic_segments_form_filters_before",(()=>null)),Oo=Ke().applyFilters("mailpoet_dynamic_filters_filter_before",(()=>null)),Ao=Ke().applyFilters("mailpoet_dynamic_filters_filter_after",(()=>o().createElement("div",{className:"mailpoet-gap"})));function Po(e){let{segmentId:t}=e;const n=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),a=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getAvailableFilters()),[]),r=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").findFiltersValueForSegment(n)),[n]),i=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),l=(0,is.Z)((e=>e("mailpoet-dynamic-segments-form").getErrors()),[]),{updateSegment:c,updateSegmentFilter:u,handleSave:d}=(0,rs.Z)("mailpoet-dynamic-segments-form"),[p,m]=(0,s.useState)(!1),f=Ke().applyFilters("mailpoet_dynamic_segments_form_add_condition_action",(()=>{m(!0)}));return o().createElement("form",{className:"mailpoet_form"},l.length>0&&o().createElement(dt,{errors:l.map((e=>({message:e})))}),o().createElement("div",{className:"mailpoet-form-grid"},o().createElement("div",{className:"mailpoet-form-field-name form-field-row-name mailpoet-segments-name-section"},o().createElement(Ce.Z,{level:4},o().createElement("label",{htmlFor:"field_name"},h.Z.I18n.t("name"))),o().createElement("div",{className:"mailpoet-form-field"},o().createElement(le.Z,{isFullWidth:!0,type:"text",name:"name",id:"field_name",defaultValue:n.name,onChange:e=>c({name:e.target.value})}))),o().createElement("div",{className:"mailpoet-form-field-description form-field-row-description mailpoet-segments-description-section"},o().createElement(Ce.Z,{level:4},o().createElement("label",{htmlFor:"field_description"},h.Z.I18n.t("description"))),o().createElement("p",{className:"mailpoet-form-description"},h.Z.I18n.t("segmentDescriptionTip")),o().createElement("div",{className:"mailpoet-form-field"},o().createElement(de.Z,{isFullWidth:!0,name:"description",id:"field_description",value:n.description,onChange:e=>c({description:e.target.value})}))),o().createElement("div",{className:"mailpoet-segments-segments-section"},o().createElement(Ce.Z,{level:4},o().createElement("label",{htmlFor:"field_filters"},h.Z.I18n.t("formPageTitle"))),o().createElement(Ro,null),Array.isArray(r)&&r.map(((e,t)=>o().createElement(o().Fragment,{key:e.index},o().createElement(kt.r.ThreeColumns,{className:"mailpoet-segments-grid",automationId:`filter-row-${t}`},o().createElement(Oo,{filterRows:r,index:t}),o().createElement(kt.r.CenteredRow,null,o().createElement(ss.Z,{dimension:"small",placeholder:h.Z.I18n.t("selectActionPlaceholder"),options:a,value:e.filterValue,onChange:e=>{u({segmentType:e.group,action:e.value},t)},automationId:"select-segment-action",isFullWidth:!0})),void 0!==e.index&&o().createElement(ho,{filterIndex:e.index})),o().createElement(Ao,{index:t})))),o().createElement(b.Z,{type:"button",variant:"tertiary",iconStart:W,onClick:e=>{e.preventDefault(),f(n,c)}},h.Z.I18n.t("addCondition"))),p&&o().createElement("div",{className:"mailpoet-grid-span-two-columns"},o().createElement(xo,null)),o().createElement("div",{className:"mailpoet-segments-counter-section"},o().createElement(po,null),o().createElement(fo,null)),o().createElement("div",{className:"mailpoet-form-actions"},o().createElement(b.Z,{type:"submit",onClick:e=>{e.preventDefault(),d(t)},isDisabled:!lo(n.filters)||void 0===i.count},h.Z.I18n.t("save")))))}Po.propTypes={segmentId:y().number};var Mo=n(61299);const Lo=e=>e.products,Fo=e=>e.membershipPlans,qo=e=>e.subscriptionProducts,$o=e=>e.wordpressRoles,Uo=e=>e.productCategories,jo=e=>e.newslettersList,Vo=e=>e.canUseWooSubscriptions,Wo=e=>e.wooCurrencySymbol,Yo=e=>e.wooCountries,Bo=e=>e.customFieldsList,Ho=e=>e.segment,zo=e=>e.staticSegmentsList,Ko=e=>e.subscriberCount,Go=(e,t)=>{let n;return Array.isArray(e.segment.filters)?(n={...e.segment.filters[t]},n):n},Qo=e=>e.errors,Xo=e=>e.allAvailableFilters,Jo=(e,t)=>{const n=[];return t.filters.forEach(((t,a)=>{e.allAvailableFilters.forEach((e=>{e.options.forEach((e=>{e.group===t.segmentType&&e.value===t.action&&n.push({filterValue:e,index:a})}))}))})),n};function el(e,t){return{...e,segment:t.segment}}function tl(e,t){return{...e,errors:t.errors}}function nl(e,t){const n=e.segment;return{...e,segment:(0,Un.assign)(n,t.segment)}}function al(e,t){const n={...e.segment};return n.filters[t.filterIndex]=(0,Un.assign)(n.filters[t.filterIndex],t.filter),{...e,segment:n}}function rl(e,t){const n=e.subscriberCount;return{...e,subscriberCount:(0,Un.assign)(n,t.subscriberCount)}}const il=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 cs.Actions.SET_SEGMENT:return el(t,n);case cs.Actions.SET_ERRORS:return tl(t,n);case cs.Actions.UPDATE_SEGMENT:return nl(t,n);case cs.Actions.UPDATE_SEGMENT_FILTER:return al(t,n);case cs.Actions.UPDATE_SUBSCRIBER_COUNT:return rl(t,n);default:return t}};function sl(e){return{type:cs.Actions.SET_SEGMENT,segment:e}}function ol(e){return{type:cs.Actions.SET_ERRORS,errors:e}}function ll(e){return{type:cs.Actions.UPDATE_SEGMENT,segment:e}}function cl(e,t){return{type:cs.Actions.UPDATE_SEGMENT_FILTER,filter:e,filterIndex:t}}function ul(e,t){return{type:cs.Actions.UPDATE_SEGMENT,segment:{[e]:t.target.value}}}function dl(e,t,n){return{type:cs.Actions.UPDATE_SEGMENT_FILTER,filter:{[e]:n.target.value},filterIndex:t}}function pl(e){return{type:cs.Actions.UPDATE_SUBSCRIBER_COUNT,subscriberCount:e}}function*ml(e){if(void 0===e)return;h.Z.Modal.loading(!0);const{res:t,success:n}=yield{type:"LOAD_SEGMENT",segmentId:e};n&&!t.is_plugin_missing||(window.location.href="admin.php?page=mailpoet-segments#/segments"),yield sl(t),h.Z.Modal.loading(!1)}function*hl(e){const t=(0,Mo.Ys)("mailpoet-dynamic-segments-form").getSegment();yield ol([]);const{error:n,success:a}=yield{type:"SAVE_SEGMENT",segment:t};var r;a?(window.location.href="admin.php?page=mailpoet-segments#/segments",void 0!==e?h.Z.Notice.success(h.Z.I18n.t("dynamicSegmentUpdated")):(r=t,h.Z.Notice.success(h.Z.I18n.t("dynamicSegmentAdded")),h.Z.trackEvent("Segments > Add new",{type:r.segmentType||"unknown type",subtype:r.action||r.wordpressRole||"unknown subtype"}))):yield ol(n)}function fl(e){let t=JSON.parse(JSON.stringify(e));return(0,Un.has)("link_id",e)&&(t=(0,Un.assign)(t,{link_id:e.link_id.toString()})),(0,Un.has)("newsletter_id",e)&&(t=(0,Un.assign)(t,{newsletter_id:e.newsletter_id.toString()})),(0,Un.has)("product_id",e)&&(t=(0,Un.assign)(t,{product_id:e.product_id.toString()})),(0,Un.has)("category_id",e)&&(t=(0,Un.assign)(t,{category_id:e.category_id.toString()})),t}async function gl(e){let{segmentId:t}=e;try{return{success:!0,res:fl((await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"dynamic_segments",action:"get",data:{id:t}})).data)}}catch(e){return{success:!1,error:e.errors.map((e=>e.message)),res:e}}}async function vl(e){let{segment:t}=e;try{return await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"dynamic_segments",action:"save",data:t}),{success:!0}}catch(e){return{success:!1,error:e.errors.map((e=>e.message))}}}function yl(e,t){const n=[{label:h.Z.I18n.t("email"),options:hs},{label:h.Z.I18n.t("wpUserRole"),options:Xs}];return h.Z.isWoocommerceActive&&n.push({label:h.Z.I18n.t("woocommerce"),options:ys}),h.Z.isWoocommerceActive&&t&&n.push({label:h.Z.I18n.t("woocommerceMemberships"),options:no}),h.Z.isWoocommerceActive&&e&&n.push({label:h.Z.I18n.t("woocommerceSubscriptions"),options:io}),n}var bl=function(){const e=(0,d.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:cs.SegmentConnectTypes.AND,filters:[{segmentType:cs.SegmentTypes.WordPressRole,action:cs.SubscriberActionTypes.WORDPRESS_ROLE}]},subscriberCount:{loading:!1},errors:[],allAvailableFilters:yl(window.mailpoet_can_use_woocommerce_subscriptions,window.mailpoet_can_use_woocommerce_memberships)},t={selectors:a,actions:r,controls:i,reducer:il(e),resolvers:{}};(0,Mo.R9)("mailpoet-dynamic-segments-form",t)})();const{pageLoaded:t}=(0,rs.Z)("mailpoet-dynamic-segments-form");return(0,s.useEffect)((()=>{t(e.params.id)}),[e.params.id,t]),o().createElement(o().Fragment,null,o().createElement(Ae.Z,{color:"#fff"}),o().createElement(Pe.Z,null),o().createElement(Ce.Z,{level:1,className:"mailpoet-title"},o().createElement("span",null,h.Z.I18n.t("formPageTitle")),o().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:"/segments"},h.Z.I18n.t("backToList"))),o().createElement(Po,{segmentId:Number(e.params.id)}))};const wl=[{name:"name",label:h.Z.I18n.t("nameColumn"),sortable:!0},{name:"description",label:h.Z.I18n.t("description"),sortable:!1},{name:"count",label:h.Z.I18n.t("subscribersCountColumn"),sortable:!1},{name:"subscribed",label:h.Z.I18n.t("subscribed"),sortable:!1},{name:"updated_at",label:h.Z.I18n.t("updatedAtColumn"),sortable:!0}],_l={onLoadingItems:()=>h.Z.I18n.t("loadingDynamicSegmentItems"),onNoItemsFound:()=>h.Z.I18n.t("noDynamicSegmentItemsFound"),onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneDynamicSegmentTrashed"):h.Z.I18n.t("multipleDynamicSegmentsTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneDynamicSegmentDeleted"):h.Z.I18n.t("multipleDynamicSegmentsDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneDynamicSegmentRestored"):h.Z.I18n.t("multipleDynamicSegmentsRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)}},El=[{name:"edit",className:"mailpoet-hide-on-mobile",link:e=>o().createElement(u.rU,{to:`/edit-segment/${e.id}`},h.Z.I18n.t("edit")),display:e=>!e.is_plugin_missing},{name:"edit_disabled",className:"mailpoet-hide-on-mobile mailpoet-disabled",link:e=>o().createElement(u.rU,{to:`/edit-segment/${e.id}`},h.Z.I18n.t("edit")),display:e=>e.is_plugin_missing},{name:"view_subscribers",link:e=>o().createElement("a",{href:e.subscribers_url},h.Z.I18n.t("viewSubscribers"))},{name:"trash",className:"mailpoet-hide-on-mobile"}],Zl=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:_l.onTrash}];function Il(e,t){return o().createElement(o().Fragment,null,o().createElement("td",{className:"column-primary","data-colname":h.Z.I18n.t("nameColumn")},o().createElement("span",{className:"mailpoet-listing-title"},e.name),t),o().createElement("td",{"data-colname":h.Z.I18n.t("description")},o().createElement("abbr",null,e.description)),e.is_plugin_missing?o().createElement("td",{colSpan:"2",className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("missingPluginMessageColumn")},e.missing_plugin_message&&e.missing_plugin_message.message&&e.missing_plugin_message.link?x()(e.missing_plugin_message.message,/\[link](.*?)\[\/link]/g,(t=>o().createElement("a",{className:"mailpoet-listing-link-important",key:"missingPluginMessageLink",href:e.missing_plugin_message.link,target:"_blank",rel:"noopener noreferrer"},t))):e.missing_plugin_message):o().createElement(o().Fragment,null,o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribersCountColumn")},parseInt(e.count_all,10).toLocaleString()),o().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribed")},parseInt(e.count_subscribed,10).toLocaleString())),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("updatedAtColumn")},h.Z.Date.short(e.created_at),o().createElement("br",null),h.Z.Date.time(e.created_at)))}function Sl(e){return o().createElement(o().Fragment,null,o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,location:e.location,params:e.match.params,search:!0,onRenderItem:Il,endpoint:"dynamic_segments",base_url:"segments",columns:wl,messages:_l,sort_by:"created_at",sort_order:"desc",item_actions:El,bulk_actions:Zl}),o().createElement("p",{className:"mailpoet_sending_methods_help help"},o().createElement("b",null,h.Z.I18n.t("segmentsTip"),":")," ",h.Z.I18n.t("segmentsTipText")," ",o().createElement("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"},h.Z.I18n.t("segmentsTipLink"))))}Sl.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var kl=(0,d.withRouter)(Sl),Tl=function(){return o().createElement(o().Fragment,null,o().createElement(V.Q,null,o().createElement(u.rU,{className:"mailpoet-button button-secondary",to:"/new"},W,o().createElement("span",null,h.Z.I18n.t("new"))),o().createElement(u.rU,{className:"mailpoet-button button-secondary",to:"/new-segment","data-automation-id":"new-segment"},W,o().createElement("span",null,h.Z.I18n.t("newSegment")))),o().createElement(j,{subscribersInPlan:h.Z.subscribersCount,subscribersInPlanLimit:h.Z.subscribersLimit}),o().createElement(F,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),o().createElement(O,null),o().createElement(L,null),o().createElement(P,{mssKeyInvalid:h.Z.hasInvalidMssApiKey,subscribersCount:h.Z.subscribersCount}))};const Cl=document.getElementById("segments_container");function Nl(){return o().createElement(o().Fragment,null,o().createElement(Tl,null),o().createElement(Ii.Z,{activeKey:"lists",routerType:"switch-only"},o().createElement(gi.Z,{key:"lists",route:"lists/(.*)?",title:h.Z.I18n.t("pageTitle")},o().createElement(Ji,null)),o().createElement(gi.Z,{key:"segments",route:"segments/(.*)?",title:h.Z.I18n.t("pageTitleSegments"),automationId:"dynamic-segments-tab"},o().createElement(kl,null))))}function Dl(){return o().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},o().createElement(u.UT,null,o().createElement(et.Z,null),o().createElement(d.Switch,null,o().createElement(d.Route,{exact:!0,path:"/",render:()=>o().createElement(d.Redirect,{to:"/lists"})}),o().createElement(d.Route,{path:"/new",component:as}),o().createElement(d.Route,{path:"/edit/:id",component:as}),o().createElement(d.Route,{path:"/new-segment",component:bl}),o().createElement(d.Route,{path:"/edit-segment/:id",component:bl}),o().createElement(d.Route,{path:"/segments/(.*)?",component:Nl}),o().createElement(d.Route,{path:"/lists/(.*)?",component:Nl}))))}Cl&&c().render(o().createElement(Dl,null),Cl);const xl=()=>{h.Z.trackEvent("Forms > Add New"),setTimeout((()=>{window.location=window.mailpoet_form_template_selection_url}),200)};function Rl(){const[e,t]=(0,s.useState)(!1);return o().createElement(V.Q,null,o().createElement(b.Z,{onClick:()=>{t(!0),xl()},withSpinner:e,automationId:"create_new_form",variant:"secondary",iconStart:W},h.Z.I18n.t("new")))}const Ol=[{name:"name",label:h.Z.I18n.t("formName"),sortable:!0},{name:"segments",label:h.Z.I18n.t("segments")},{name:"type",label:h.Z.I18n.t("type")},{name:"status",label:h.Z.I18n.t("status")},{name:"updated_at",label:h.Z.I18n.t("updatedAt"),sortable:!0}],Al={onTrash:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneFormTrashed"):h.Z.I18n.t("multipleFormsTrashed").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onDelete:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneFormDeleted"):h.Z.I18n.t("multipleFormsDeleted").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onRestore:e=>{const t=Number(e.meta.count);let n=null;n=1===t?h.Z.I18n.t("oneFormRestored"):h.Z.I18n.t("multipleFormsRestored").replace("%1$d",t.toLocaleString()),h.Z.Notice.success(n)},onNoItemsFound:()=>o().createElement("div",{className:"mailpoet-forms-add-new-row"},o().createElement("p",null,h.Z.I18n.t("noItemsFound")),o().createElement(xe.Button,{onClick:xl,automationId:"add_new_form",iconStart:W},h.Z.I18n.t("new")))},Pl=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Al.onTrash}],Ml=[{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),link:function(e){return o().createElement("a",{href:`admin.php?page=mailpoet-form-editor&id=${e.id}`},h.Z.I18n.t("edit"))}},{name:"duplicate",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("duplicate"),onClick:function(e,t){return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"duplicate",data:{id:e.id}}).done((e=>{const n=e.data.name?e.data.name:h.Z.I18n.t("noName");h.Z.Notice.success(h.Z.I18n.t("formDuplicated").replace("%1$s",n)),t()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];class Ll extends o().Component{constructor(){super(...arguments),(0,k.Z)(this,"updateStatus",((e,t)=>{t.persist(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"forms",action:"setStatus",data:{id:Number(t.target.getAttribute("data-id")),status:e?"enabled":"disabled"}}).done((e=>{"enabled"===e.data.status&&h.Z.Notice.success(h.Z.I18n.t("formActivated"))})).fail((n=>{h.Z.Notice.showApiErrorNotice(n),t.target.checked=!e}))})),(0,k.Z)(this,"isItemInactive",(e=>"disabled"===e.status)),(0,k.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions"),a=window.mailpoet_segments.filter((t=>-1!==m().inArray(t.id,e.segments))),r=function(e){const t=[];return"1"===e?.form_placement?.fixed_bar?.enabled&&t.push(h.Z.I18n.t("placeFixedBarFormOnPages")),"1"===e?.form_placement?.below_posts?.enabled&&t.push(h.Z.I18n.t("placeFormBellowPages")),"1"===e?.form_placement?.popup?.enabled&&t.push(h.Z.I18n.t("placePopupFormOnPages")),"1"===e?.form_placement?.slide_in?.enabled&&t.push(h.Z.I18n.t("placeSlideInFormOnPages")),t.length>0?t.join(", "):h.Z.I18n.t("placeFormOthers")}(e.settings);return o().createElement(o().Fragment,null,o().createElement("td",{className:n},o().createElement("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-form-editor&id=${e.id}`},e.name?e.name:`(${h.Z.I18n.t("noName")})`),t),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("segments")},o().createElement(E,{segments:a,dimension:"large"},"user"===e.settings.segments_selected_by&&o().createElement("span",{className:"mailpoet-tags-prefix"},h.Z.I18n.t("userChoice")))),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("type")},r),o().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),o().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("updatedAt")},h.Z.Date.short(e.updated_at),o().createElement("br",null),h.Z.Date.time(e.updated_at)))}))}renderStatus(e){return o().createElement("div",null,o().createElement(Kt,{onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"enabled"===e.status}),o().createElement("p",null,h.Z.I18n.t("signups"),": ",e.signups.toLocaleString()))}render(){return o().createElement("div",{className:"mailpoet-listing-no-actions-on-mobile"},o().createElement(Rl,null),o().createElement(Z.Z,{limit:window.mailpoet_listing_per_page,className:"mailpoet-forms-listing",location:this.props.location,params:this.props.match.params,messages:Al,search:!1,endpoint:"forms",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:Ol,bulk_actions:Pl,item_actions:Ml}))}}Ll.propTypes={location:y().object.isRequired,match:y().shape({params:y().object}).isRequired};var Fl=Ri(Ll);function ql(){return o().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},o().createElement(u.UT,null,o().createElement(et.Z,null),o().createElement(d.Route,{path:"*",component:Fl})))}const $l=document.getElementById("forms_container");$l&&c().render(o().createElement(ql,null),$l);var Ul=function(){return o().createElement(o().Fragment,null,o().createElement("p",null,h.Z.I18n.t("knowledgeBaseIntro")),o().createElement("ul",{className:"mailpoet-text-links"},o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/116-common-problems"},"Common Problems")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/165-newsletters"},"Newsletters")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/156-migration-questions"},"Migration Questions")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/149-sending-methods"},"Sending Methods")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/139-subscription-forms"},"Subscription Forms")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/114-getting-started"},"Getting Started")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/123-newsletter-designer"},"Newsletter Designer")),o().createElement("li",null,o().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/121-subscribers-and-lists"},"Subscribers and Lists"))),o().createElement(b.Z,{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/"},h.Z.I18n.t("knowledgeBaseButton")))};function jl(e){e.target.select()}var Vl=function(){const e=window.systemInfoData;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet_notice notice inline"},o().createElement("p",null,h.Z.I18n.t("systemInfoIntro"))),function(e){if(T.ZP.isObject(e)){const t=Object.keys(e).map((t=>`${t}: ${e[t]}`));return o().createElement("textarea",{readOnly:!0,onFocus:jl,value:t.join("\n"),style:{width:"100%",height:"400px"}})}return o().createElement("p",null,h.Z.I18n.t("systemInfoDataError"))}(e))};function Wl(e){return o().createElement("table",{className:"widefat fixed",style:{maxWidth:e.max_width}},o().createElement("tbody",null,e.rows.map((e=>o().createElement("tr",{key:`row_${e.key}`},o().createElement("td",{className:"row-title"},e.key),o().createElement("td",null,e.value))))))}Wl.propTypes={max_width:y().string,rows:y().arrayOf(y().shape({key:y().string.isRequired,value:y().oneOfType([y().string,y().number,y().element]).isRequired})).isRequired},Wl.defaultProps={max_width:"auto"};var Yl=Wl;function Bl(e){return o().createElement("span",null,!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown)}Bl.propTypes={truthy:y().string,falsy:y().string,unknown:y().string,children:y().bool},Bl.defaultProps={truthy:h.Z.I18n.t("yes"),falsy:h.Z.I18n.t("no"),unknown:h.Z.I18n.t("unknown"),children:null};var Hl=Bl;function zl(e){const t=e.status_data,n={active:h.Z.I18n.t("running"),inactive:h.Z.I18n.t("cronWaiting")},a=Array.isArray(t.last_error)?o().createElement(o().Fragment,null,t.last_error.map((e=>o().createElement("div",{key:e.worker},e.worker,":"," ",o().createElement("i",null,e.message))))):t.last_error;return o().createElement("div",null,o().createElement("h4",null,h.Z.I18n.t("systemStatusCronStatusTitle")),o().createElement(Yl,{max_width:"400px",rows:[{key:h.Z.I18n.t("accessible"),value:o().createElement(Hl,null,t.accessible)},{key:h.Z.I18n.t("status"),value:n[t.status]?n[t.status]:h.Z.I18n.t("unknown")},{key:h.Z.I18n.t("lastUpdated"),value:t.updated_at?h.Z.Date.full(1e3*t.updated_at):h.Z.I18n.t("unknown")},{key:h.Z.I18n.t("lastRunStarted"),value:t.run_accessed_at?h.Z.Date.full(1e3*t.run_started_at):h.Z.I18n.t("unknown")},{key:h.Z.I18n.t("lastRunCompleted"),value:t.run_completed_at?h.Z.Date.full(1e3*t.run_completed_at):h.Z.I18n.t("unknown")},{key:h.Z.I18n.t("lastSeenError"),value:a||h.Z.I18n.t("none")},{key:h.Z.I18n.t("lastSeenErrorDate"),value:t.last_error_date?h.Z.Date.full(1e3*t.last_error_date):h.Z.I18n.t("unknown")}]}))}zl.propTypes={status_data:y().shape({accessible:y().bool,last_error_date:y().string,status:y().string,updated_at:y().number,run_accessed_at:y().number,run_completed_at:y().number,run_started_at:y().number,last_error:y().oneOfType([y().string,y().array])}).isRequired};var Kl=zl;function Gl(e){let t=e.task.scheduled_at;t&&(t=(0,La.default)(t,"yyyy-MM-dd HH:mm:ss",new Date));const n=(0,La.default)(e.task.updated_at,"yyyy-MM-dd HH:mm:ss",new Date);return o().createElement("tr",null,o().createElement("td",{className:"column column-primary"},e.task.id),o().createElement("td",{className:"column"},e.task.type),o().createElement("td",{className:"column"},e.task.newsletter?o().createElement("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"},e.task.newsletter.subject||h.Z.I18n.t("preview")):h.Z.I18n.t("none")),o().createElement("td",{className:"column"},e.task.priority),e.show_scheduled_at?o().createElement("td",{className:"column-date"},o().createElement("abbr",null,`${h.Z.Date.short(t)} ${h.Z.Date.time(t)}`)):null,o().createElement("td",{className:"column-date"},o().createElement("abbr",null,`${h.Z.Date.short(n)} ${h.Z.Date.time(n)}`)))}Gl.propTypes={show_scheduled_at:y().bool,task:y().shape({id:y().number.isRequired,type:y().string.isRequired,priority:y().number.isRequired,updated_at:y().string.isRequired,scheduled_at:y().string,status:y().string,newsletter:y().shape({newsletter_id:y().number.isRequired,queue_id:y().number.isRequired,preview_url:y().string.isRequired,subject:y().string})}).isRequired},Gl.defaultProps={show_scheduled_at:!1};var Ql=Gl;function Xl(e){return o().createElement("tr",null,o().createElement("th",{className:"row-title"},"Id"),o().createElement("th",{className:"row-title"},h.Z.I18n.t("type")),o().createElement("th",{className:"row-title"},h.Z.I18n.t("email")),o().createElement("th",{className:"row-title"},h.Z.I18n.t("priority")),e.show_scheduled_at?o().createElement("th",{className:"row-title"},h.Z.I18n.t("scheduledAt")):null,o().createElement("th",{className:"row-title"},h.Z.I18n.t("updatedAt")))}Xl.propTypes={show_scheduled_at:y().bool},Xl.defaultProps={show_scheduled_at:!1};var Jl=Xl;function ec(e){const t=e.show_scheduled_at?6:5;return o().createElement("table",{className:"widefat fixed striped"},o().createElement("thead",null,o().createElement(Jl,{show_scheduled_at:e.show_scheduled_at})),o().createElement("tbody",null,e.tasks.length?e.tasks.map((t=>o().createElement(Ql,{key:t.id,task:t,show_scheduled_at:e.show_scheduled_at}))):o().createElement("tr",{className:"mailpoet-listing-no-items"},o().createElement("td",{colSpan:t},h.Z.I18n.t("nothingToShow")))),o().createElement("tfoot",null,o().createElement(Jl,{show_scheduled_at:e.show_scheduled_at})))}ec.propTypes={show_scheduled_at:y().bool,tasks:y().arrayOf(Ql.propTypes.task).isRequired},ec.defaultProps={show_scheduled_at:!1};var tc=ec;function nc(e){const t=e.status_data;return o().createElement(o().Fragment,null,o().createElement("h4",null,h.Z.I18n.t("systemStatusQueueTitle")),o().createElement(Yl,{max_width:"400px",rows:[{key:h.Z.I18n.t("status"),value:"paused"===t.status?h.Z.I18n.t("paused"):h.Z.I18n.t("running")},{key:h.Z.I18n.t("startedAt"),value:t.started?h.Z.Date.full(1e3*t.started):h.Z.I18n.t("unknown")},{key:h.Z.I18n.t("sentEmails"),value:t.sent||0},{key:h.Z.I18n.t("retryAttempt"),value:t.retry_attempt||h.Z.I18n.t("none")},{key:h.Z.I18n.t("retryAt"),value:t.retry_at?h.Z.Date.full(1e3*t.retry_at):h.Z.I18n.t("none")},{key:h.Z.I18n.t("error"),value:t.error?t.error.error_message:h.Z.I18n.t("none")},{key:h.Z.I18n.t("totalCompletedTasks"),value:t.tasksStatusCounts.completed},{key:h.Z.I18n.t("totalRunningTasks"),value:t.tasksStatusCounts.running},{key:h.Z.I18n.t("totalPausedTasks"),value:t.tasksStatusCounts.paused},{key:h.Z.I18n.t("totalScheduledTasks"),value:t.tasksStatusCounts.scheduled}]}),o().createElement("h5",null,h.Z.I18n.t("scheduledTasks")),o().createElement(tc,{show_scheduled_at:!0,tasks:t.latestTasks.filter((e=>"scheduled"===e.status))}),o().createElement("h5",null,h.Z.I18n.t("runningTasks")),o().createElement(tc,{tasks:t.latestTasks.filter((e=>null===e.status))}),o().createElement("h5",null,h.Z.I18n.t("completedTasks")),o().createElement(tc,{tasks:t.latestTasks.filter((e=>"completed"===e.status))}))}nc.propTypes={status_data:y().shape({status:y().string,started:y().number,sent:y().number,retry_attempt:y().number,retry_at:y().number,error:y().shape({operation:y().string,error_message:y().string}),tasksStatusCounts:y().shape({completed:y().number.isRequired,running:y().number.isRequired,paused:y().number.isRequired,scheduled:y().number.isRequired}).isRequired,latestTasks:y().arrayOf(Ql.propTypes.task).isRequired}).isRequired};var ac=nc;function rc(e,t,n,a,r,i){const s=e?"success":"error";let l=e?t:n;return a&&(l=x()(l,/\[link\](.*?)\[\/link\]/g,(e=>o().createElement("a",{className:"mailpoet-text-link",href:a,"data-beacon-article":r,key:"kb-link"},e)))),o().createElement("div",{className:`mailpoet_notice notice inline notice-${s}`},o().createElement("p",null,l),i?o().createElement("p",null,o().createElement("i",null,i)):null)}var ic=function(){const e=window.systemStatusData;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet_notice notice inline"},o().createElement("p",null,e.mss.enabled?h.Z.I18n.t("systemStatusIntroCronMSS"):h.Z.I18n.t("systemStatusIntroCron"))),function(e){const t=e.cron.isReachable,n=e.cron.url,a=`${h.Z.I18n.t("systemStatusConnectionUnsuccessful")} ${h.Z.I18n.t("systemStatusCronConnectionUnsuccessfulInfo")}`,r=h.Z.I18n.t("systemStatusConnectionSuccessful"),i=t?null:e.cron.pingResponse;return o().createElement("div",null,o().createElement("h4",null,h.Z.I18n.t("systemStatusCronTitle")),o().createElement("p",null,o().createElement("a",{className:"mailpoet-text-link",href:n,target:"_blank",rel:"noopener noreferrer"},n)),rc(t,r,a,"https://kb.mailpoet.com/article/231-sending-does-not-work","5a0257ac2c7d3a272c0d7ad6",i))}(e),function(e){const t=e.mss.enabled?`${h.Z.I18n.t("systemStatusConnectionUnsuccessful")} ${h.Z.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo")}`:h.Z.I18n.t("systemStatusMSSConnectionCanNotConnect"),n=e.mss.enabled?h.Z.I18n.t("systemStatusConnectionSuccessful"):h.Z.I18n.t("systemStatusMSSConnectionCanConnect");return o().createElement("div",null,o().createElement("h4",null,h.Z.I18n.t("systemStatusMSSTitle")),rc(e.mss.isReachable,n,t,"https://kb.mailpoet.com/article/319-known-errors-when-validating-a-mailpoet-key","5ef1da9d2c7d3a10cba966c5",null))}(e),o().createElement(Kl,{status_data:e.cronStatus}),o().createElement(ac,{status_data:e.queueStatus}))},sc=function(){return o().createElement(o().Fragment,null,o().createElement("p",null,h.Z.I18n.t("yourPrivacyContent1")),o().createElement("p",null,h.Z.I18n.t("yourPrivacyContent2")),o().createElement("p",null,h.Z.I18n.t("yourPrivacyContent3")),o().createElement(b.Z,{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/"},h.Z.I18n.t("yourPrivacyButton")))};function oc(){return o().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},o().createElement(V.D,null),o().createElement(et.Z,null),o().createElement(Ii.Z,{activeKey:"knowledgeBase"},o().createElement(gi.Z,{key:"knowledgeBase",title:h.Z.I18n.t("tabKnowledgeBaseTitle")},o().createElement(Ul,null)),o().createElement(gi.Z,{key:"systemStatus",title:h.Z.I18n.t("tabSystemStatusTitle")},o().createElement(ic,null)),o().createElement(gi.Z,{key:"systemInfo",title:h.Z.I18n.t("tabSystemInfoTitle")},o().createElement(Vl,null)),o().createElement(gi.Z,{key:"yourPrivacy",title:h.Z.I18n.t("tabYourPrivacyTitle")},o().createElement(sc,null))))}const lc=document.getElementById("help_container");lc&&c().render(o().createElement(oc,null),lc);var cc=(0,d.withRouter)((function(e){let{children:t,location:{pathname:n}}=e;return(0,s.useEffect)((()=>{window.scrollTo(0,0)}),[n]),t||null}));function uc(e){let{activeMethod:t,onMethodChange:n}=e;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("span",{className:"mailpoet_import_heading"},h.Z.I18n.t("methodSelectionHead")),o().createElement("div",{className:"mailpoet-settings-inputs-row"},o().createElement("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"},o().createElement(w.Z,{dimension:"large",variant:"excellent",isInverted:!0},h.Z.I18n.t("seeVideo"))))),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement("div",{className:"mailpoet-settings-inputs-row"},o().createElement(ve.Z,{name:"select_method",automationId:"import-paste-method",id:"import-paste-method",checked:"paste-method"===t,value:"paste-method",onCheck:n}),o().createElement("label",{htmlFor:"import-paste-method"},h.Z.I18n.t("methodPaste"))),o().createElement("div",{className:"mailpoet-settings-inputs-row"},o().createElement(ve.Z,{name:"select_method",automationId:"import-csv-method",id:"import-csv-method",checked:"file-method"===t,value:"file-method",onCheck:n}),o().createElement("label",{htmlFor:"import-csv-method"},h.Z.I18n.t("methodUpload"))),o().createElement("div",{className:"mailpoet-settings-inputs-row"},o().createElement(ve.Z,{name:"select_method",automationId:"import-mailchimp-method",id:"import-mailchimp-method",checked:"mailchimp-method"===t,value:"mailchimp-method",onCheck:n}),o().createElement("label",{htmlFor:"import-mailchimp-method"},h.Z.I18n.t("methodMailChimp")))))}uc.propTypes={activeMethod:y().string,onMethodChange:y().func.isRequired},uc.defaultProps={activeMethod:void 0};var dc=uc;function pc(e){let{hidePrevious:t,isLastStep:n,canGoNext:a,onPreviousAction:r,onNextAction:i}=e;return o().createElement("div",{className:"mailpoet-settings-save"},!t&&o().createElement(b.Z,{type:"button",variant:"secondary",onClick:r},h.Z.I18n.t("previousStep")),o().createElement(b.Z,{type:"button",automationId:"import-next-step",isDisabled:!a,onClick:()=>{a&&i()}},h.Z.I18n.t(n?"import":"nextStep")))}pc.propTypes={canGoNext:y().bool,hidePrevious:y().bool,isLastStep:y().bool,onPreviousAction:y().func,onNextAction:y().func},pc.defaultProps={hidePrevious:!1,isLastStep:!1,canGoNext:!0,onPreviousAction:()=>{},onNextAction:()=>{}};var mc=pc;function hc(e){let{onValueChange:t,canFinish:n,onFinish:a,data:r,onPrevious:i}=e;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("label",{htmlFor:"paste_input"},h.Z.I18n.t("pasteLabel")),o().createElement("p",{className:"description"},x()(h.Z.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>o().createElement("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files","data-beacon-article":"57ce079f903360649f6e56fc",key:"kb-link",target:"_blank",rel:"noopener noreferrer"},e))))),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(de.Z,{id:"paste_input",rows:"15",placeholder:"Email, First Name, Last Name\njohn@doe.com, John, Doe\nmary@smith.com, Mary, Smith\njohnny@walker.com, Johnny, Walker",isCode:!0,onChange:e=>{t(e.target.value)},defaultValue:r})),o().createElement(mc,{canGoNext:n,onPreviousAction:i,onNextAction:a}))}hc.propTypes={onFinish:y().func,onPrevious:y().func,canFinish:y().bool.isRequired,onValueChange:y().func.isRequired,data:y().string},hc.defaultProps={onFinish:()=>{},onPrevious:()=>{},data:""};var fc=hc;function gc(e){let{onValueChange:t,canFinish:n,onFinish:a,onPrevious:r}=e;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("label",{htmlFor:"file_local"},h.Z.I18n.t("methodUpload")),o().createElement("p",{className:"description"},x()(h.Z.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>o().createElement("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files","data-beacon-article":"57ce079f903360649f6e56fc",key:"kb-link",target:"_blank",rel:"noopener noreferrer"},e))))),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(le.Z,{type:"file",id:"file_local",accept:".csv","data-automation-id":"import-file-upload-input",onChange:e=>{const n=e.target.value.match(/[^.]+$/);h.Z.Notice.hide(),null===n||"csv"!==n[0].toLowerCase()?(h.Z.Notice.error(h.Z.I18n.t("wrongFileFormat")),t("")):t(e.target.files[0])}})),o().createElement(mc,{canGoNext:n,onPreviousAction:r,onNextAction:a}))}gc.propTypes={canFinish:y().bool.isRequired,onFinish:y().func,onPrevious:y().func,onValueChange:y().func.isRequired},gc.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var vc=gc;function yc(e){let{onFinish:t,onPrevious:n}=e;const[a,r]=(0,s.useState)(""),[i,l]=(0,s.useState)(void 0),[c,u]=(0,s.useState)([]);return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("label",{htmlFor:"mailpoet_mailchimp_key_input"},o().createElement("span",{className:"mailpoet_import_heading"},h.Z.I18n.t("methodMailChimpLabel")),o().createElement("p",{className:"description"},x()(h.Z.I18n.t("methodMailChimpDescription"),/\[link\](.*?)\[\/link\]/,(e=>o().createElement("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/255-migrating-from-mailchimp-to-mailpoet#api","data-beacon-article":"5b16db842c7d3a0fa9a2aa15",key:"kb-link",target:"_blank",rel:"noopener noreferrer"},e)))))),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered"},o().createElement(le.Z,{dimension:"small",id:"mailpoet_mailchimp_key_input",type:"text",onChange:e=>{r(e.target.value),""===e.target.value.trim()&&l(void 0)}}),o().createElement("span",{className:"mailpoet-gap"}),o().createElement(b.Z,{type:"button",dimension:"small",onClick:()=>{h.Z.Modal.loading(!0),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpLists",data:{api_key:a}}).always((()=>{h.Z.Modal.loading(!1)})).done((e=>l(e.data))).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}},h.Z.I18n.t("methodMailChimpVerify")),o().createElement("span",{className:"mailpoet-gap"}),o().createElement("span",null,Array.isArray(i)&&0===i.length?h.Z.I18n.t("noMailChimpLists"):null))),i?o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("methodMailChimpSelectList")),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(N,{field:{id:"segments",name:"list-selection",multiple:!0,placeholder:h.Z.I18n.t("methodMailChimpSelectPlaceholder"),forceSelect2:!0,values:i},onValueChange:e=>u(e.target.value)}))):null,o().createElement(mc,{canGoNext:Array.isArray(c)&&c.length>0,onPreviousAction:n,onNextAction:()=>{h.Z.Modal.loading(!0),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:a,lists:c}}).always((()=>{h.Z.Modal.loading(!1)})).done((e=>t(e.data))).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}}))}yc.propTypes={onFinish:y().func,onPrevious:y().func},yc.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var bc=yc,wc=n(57460),_c=n.n(wc);const Ec=e=>window.roleBasedEmails.findIndex((t=>e.startsWith(`${t}@`)))>=0,Zc=e=>{let t,n=T.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)&&!Ec(n)&&n};var Ic=(e,t)=>{const n=encodeURI(e).split(/%..|./).length-1;h.Z.Notice.hide(),n>window.maxPostSizeBytes?h.Z.Notice.error(h.Z.I18n.t("maxPostSizeNotice")):(h.Z.Modal.loading(!0),_c().parse(e,function(e){return{skipEmptyLines:!0,error(){h.Z.Notice.hide(),h.Z.Notice.error(h.Z.I18n.t("dataProcessingError"))},complete(t){const n=function(e){let t=[];const n=[],a=[],r=[],i=[];let s,o,l,c,u=null,d=null,p=!1;return Object.keys(e).forEach((m=>{l=e[m].map((e=>e.trim())),c=l.length,null===d&&(d=c),c===d&&(null===u?(Object.keys(l).forEach((e=>{o=Zc(l[e]),null===u&&window.mailpoet_email_regex.test(o)&&(u=e,n[o]=!0,l[e]=o,t[o]=l)})),null===u&&0===parseInt(m,10)&&(p=!0,t[0]=l)):""!==l[u]&&(s=Zc(l[u]),T.ZP.has(n,s)?a.push(s):Ec(l[u])?i.push(l[u]):window.mailpoet_email_regex.test(s)?(n[s]=!0,l[u]=s,t[s]=l):r.push(l[u])))})),t=T.ZP.values(t),t&&(p&&t.length>=2||!p&&t.length>=1)?{header:window.mailpoet_email_regex.test(t[0][u])?null:t.shift(),subscribers:t,subscribersCount:t.length,duplicate:T.ZP.uniq(a),invalid:T.ZP.uniq(r),role:T.ZP.uniq(i)}:null}(t.data);if(n)e(n);else{let e=h.Z.I18n.t("noValidRecords");e=e.replace("[link]",'<a href="https://kb.mailpoet.com/article/126-importing-subscribers-with-csv-files" data-beacon-article="57ce079f903360649f6e56fc">'),e=e.replace("[/link]","</a>"),h.Z.Notice.error(e)}h.Z.Modal.loading(!1)}}}(t)))};function Sc(e){let{history:t,setStepMethodSelectionData:n,subscribersLimitForValidation:a}=e;const[r,i]=(0,s.useState)(void 0),[l,c]=(0,s.useState)(""),[u,d]=(0,s.useState)(void 0),p=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,a,r))},m=()=>{t.push("/step_clean_list")},f=()=>{Ic("paste-method"===r?l:u,(e=>{h.Z.trackEvent("Subscribers import started",{source:"file-method"===r?"file upload":"pasted data"}),p(e)}))};return o().createElement("div",{className:"mailpoet-settings-grid"},o().createElement(dc,{activeMethod:r,onMethodChange:i}),"paste-method"===r&&o().createElement(fc,{onPrevious:m,onValueChange:c,onFinish:f,canFinish:!!l.trim(),data:l}),"file-method"===r&&o().createElement(vc,{onPrevious:m,onValueChange:d,onFinish:f,canFinish:!!u,data:u}),"mailchimp-method"===r&&o().createElement(bc,{onPrevious:m,onFinish:e=>{h.Z.trackEvent("Subscribers import started",{source:"MailChimp"}),p(e)}}),void 0===r&&o().createElement(mc,{canGoNext:!1,onPreviousAction:m}))}Sc.propTypes={history:y().shape({push:y().func.isRequired}).isRequired,setStepMethodSelectionData:y().func.isRequired,subscribersLimitForValidation:y().number.isRequired};var kc=(0,d.withRouter)(Sc);function Tc(e){let{onProceed:t}=e;return o().createElement("div",{className:"mailpoet-clean-list-step-container"},o().createElement("p",null,h.Z.I18n.t("cleanListText1")),o().createElement("p",null,h.Z.I18n.t("cleanListText2")),o().createElement("p",null,t&&o().createElement(b.Z,{onClick:t,variant:"tertiary"},h.Z.I18n.t("listCleaningGotIt")),o().createElement(b.Z,{target:"_blank",href:"https://kb.mailpoet.com/article/287-list-cleaning-services"},h.Z.I18n.t("tryListCleaning"))))}function Cc(e){let{onSubmit:t,history:n}=e;const[a,r]=(0,s.useState)(void 0);return o().createElement("div",{className:"mailpoet-settings-grid"},o().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("validationStepHeading")),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement("div",{className:"mailpoet-settings-inputs-row"},o().createElement(ve.Z,{automationId:"mailpoet_import_validation_step_option1",id:"existing-list",checked:"existing-list"===a,value:"existing-list",onCheck:r}),o().createElement("label",{htmlFor:"existing-list"},h.Z.I18n.t("validationStepRadio1"))),o().createElement("div",{className:"mailpoet-settings-inputs-row"},o().createElement(ve.Z,{automationId:"mailpoet_import_validation_step_option2",id:"address-book",checked:"address-book"===a,value:"address-book",onCheck:r}),o().createElement("label",{htmlFor:"address-book"},h.Z.I18n.t("validationStepRadio2")))),o().createElement(mc,{canGoNext:void 0!==a,onPreviousAction:()=>n.push("step_method_selection"),onNextAction:()=>t(a)}))}Tc.propTypes={onProceed:y().func},Cc.propTypes={history:y().shape({push:y().func.isRequired}).isRequired,onSubmit:y().func.isRequired};var Nc=Cc,Dc=function(){return o().createElement("div",{className:"mailpoet-clean-list-step-container","data-automation-id":"import_wrong_source_block"},o().createElement("p",null,h.Z.I18n.t("validationStepBlock1")),o().createElement("p",null,h.Z.I18n.t("validationStepBlock2")),o().createElement("p",null,o().createElement(b.Z,{href:"https://kb.mailpoet.com/article/269-reconfirm-subscribers-to-your-list",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("validationStepBlockButton"))))};function xc(e){let{onSubmit:t}=e;const[n,a]=(0,s.useState)("over2years"),r=(0,s.useCallback)((e=>{a(e.target.value)}),[a]),i=(0,s.useCallback)((()=>{t("over2years"===n||"1to2years"===n?"notRecently":"recently")}),[t,n]);return o().createElement("div",{className:"mailpoet-settings-grid"},o().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("validationStepLastSentHeading")),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(he.Z,{defaultValue:n,onChange:r,automationId:"last_sent_to_list"},o().createElement("option",{value:"over2years"},h.Z.I18n.t("validationStepLastSentOption1")),o().createElement("option",{value:"1to2years"},h.Z.I18n.t("validationStepLastSentOption2")),o().createElement("option",{value:"less1year"},h.Z.I18n.t("validationStepLastSentOption3")),o().createElement("option",{value:"less3months"},h.Z.I18n.t("validationStepLastSentOption4")))),o().createElement("div",{className:"mailpoet-settings-save"},o().createElement(b.Z,{type:"button",automationId:"last_sent_to_list_next",onClick:i},h.Z.I18n.t("validationStepLastSentNext"))))}xc.propTypes={onSubmit:y().func.isRequired};var Rc=xc;function Oc(e){let{stepMethodSelectionData:t,history:n}=e;const[a,r]=(0,s.useState)(void 0),[i,l]=(0,s.useState)(void 0);(0,s.useEffect)((()=>{void 0===t&&n.replace("step_method_selection")}),[t,n]);const c=(0,s.useCallback)((e=>{l(e),"recently"===e&&n.push("step_data_manipulation")}),[n,l]);return o().createElement(o().Fragment,null,void 0===a&&o().createElement(Nc,{onSubmit:r,history:n}),"address-book"===a&&o().createElement(Dc,null),"existing-list"===a&&void 0===i&&o().createElement(Rc,{onSubmit:c}),"existing-list"===a&&"notRecently"===i&&o().createElement(Tc,null))}Oc.propTypes={history:y().shape({push:y().func.isRequired,replace:y().func.isRequired}).isRequired,stepMethodSelectionData:y().shape({duplicate:y().arrayOf(y().string),header:y().arrayOf(y().string),invalid:y().arrayOf(y().string),role:y().arrayOf(y().string),subscribersCount:y().number,subscribers:y().arrayOf(y().arrayOf(y().string))})},Oc.defaultProps={stepMethodSelectionData:void 0};var Ac=(0,d.withRouter)(Oc);const Pc=e=>{let{translation:t,subscribers:n}=e,a="";return n.length&&(a=x()(t.replace("%2$s",n.join(", ")),"%1$s",(()=>o().createElement("strong",{key:t},n.length.toLocaleString()))),a=o().createElement("p",null,a)),a};function Mc(e){let{stepMethodSelectionData:t}=e;const{invalid:n,duplicate:a,role:r}=t,[i,l]=(0,s.useState)(!1),c=g()("mailpoet_subscribers_data_parse_results_details",{mailpoet_hidden:!i}),u=o().createElement(Pc,{translation:h.Z.I18n.t("importNoticeInvalid"),subscribers:n}),d=o().createElement(Pc,{translation:h.Z.I18n.t("importNoticeDuplicate"),subscribers:a});let p="";if(r.length&&(p=x()(h.Z.I18n.t("importNoticeRoleBased"),/(%1\$s|\[link\].*\[\/link\]|%2\$s)/,(e=>"%1$s"===e?o().createElement("strong",{key:"role-length"},r.length.toLocaleString()):"%2$s"===e?r.join(", "):o().createElement("a",{href:"https://kb.mailpoet.com/article/270-role-based-email-addresses-are-not-allowed","data-beacon-article":"5d0a1da404286318cac46fe5",target:"_blank",rel:"noopener noreferrer",key:e},e.replace("[link]","").replace("[/link]","")))),p=o().createElement("p",null,p)),n.length||a.length||r.length){const e=n.length+a.length+r.length;return o().createElement("div",{className:"error"},o().createElement("p",null,x()(h.Z.I18n.t("importNoticeSkipped"),"%1$s",(()=>o().createElement("strong",{key:"lengths"},e.toLocaleString())))," ",o().createElement("a",{className:"mailpoet_subscribers_data_parse_results_details_show","data-automation-id":"show-more-details",onClick:()=>l(!i),role:"button",tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),l(!i))}},h.Z.I18n.t("showMoreDetails"))),o().createElement("div",{className:c},o().createElement("hr",null),u,d,p))}return null}Pc.propTypes={translation:y().string.isRequired,subscribers:y().arrayOf(y().string).isRequired},Mc.propTypes={stepMethodSelectionData:y().shape({duplicate:y().arrayOf(y().string),invalid:y().arrayOf(y().string),role:y().arrayOf(y().string)})},Mc.defaultProps={stepMethodSelectionData:{invalid:[],duplicate:[],role:[]}};var Lc=Mc;function Fc(e){let{header:t,subscribers:n}=e;const a=((e,t)=>{const n=[],a=[];let r,i,s,o;return Object.keys(e[0]).forEach((l=>{r=e[0][l],i="ignore",r%1!=0&&window.mailpoet_email_regex.test(r)?i="email":t&&(s=t[l],o=window.mailpoetColumns.map((e=>e.name)).indexOf(s),-1!==o?i=window.mailpoetColumns[o].id:s&&(/first|first name|given name/i.test(s)?i="first_name":/last|last name/i.test(s)&&(i="last_name"))),i="ignore"!==i&&-1===a.indexOf(i)?i:"ignore",n[l]={column_id:i},a.push(i)})),n})(n,t);return o().createElement("tr",null,o().createElement("th",null,h.Z.I18n.t("matchData")),a.map(((e,t)=>o().createElement("th",{key:e.column_id+t},o().createElement("select",{className:"mailpoet_subscribers_column_data_match","data-column-id":e.column_id,"data-column-index":t,id:`column_${t}`})))))}function qc(e){let{header:t}=e;return o().createElement("tr",{className:"mailpoet_header"},o().createElement("td",null),t.map((e=>o().createElement("td",{key:e},e))))}function $c(e){let{subscriber:t,index:n}=e;return o().createElement(o().Fragment,null,o().createElement("td",null,n),t.map(((e,t)=>o().createElement("td",{key:`${e}-${n}-${t}`},e))))}function Uc(e){let{subscribers:t,subscribersCount:n}=e;const a=". . .",r=Array(t[0].length).fill(a);return o().createElement(o().Fragment,null,t.slice(0,10).map(((e,t)=>o().createElement("tr",{key:`${e[0]}-${t}`},o().createElement($c,{subscriber:e,index:t+1})))),n>11?o().createElement("tr",{key:"filler"},o().createElement($c,{subscriber:r,index:a})):null,n>10?o().createElement("tr",{key:t[n-1][0]},o().createElement($c,{subscriber:t[n-1],index:n})):null)}function jc(e){let{subscribersCount:t,subscribers:n,header:a}=e;return(0,s.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,a=t.params.args.data.id;"create"===a?(t.preventDefault(),m()(n).select2("close"),h.Z.Modal.popup({title:h.Z.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 h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:t}).done((t=>{const a={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:h.Z.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(a),window.mailpoetColumns.push(a),m()("select.mailpoet_subscribers_column_data_match").each((()=>{m()(n).html("").select2("destroy").select2(e)})),m()(n).data("column-id",a.id),h.Z.Modal.close()})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#field_name"})})),!1}))):m()("select.mailpoet_subscribers_column_data_match").each((()=>{const e=n,r=m()(e).val();r===a&&"ignore"!==r&&(confirm(`${h.Z.I18n.t("selectedValueAlreadyMatched")} ${h.Z.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")}))})()})),o().createElement("div",{className:"subscribers_data"},o().createElement("table",{className:"mailpoet_subscribers widefat fixed"},o().createElement("thead",null,o().createElement(Fc,{header:a,subscribers:n})),o().createElement("tbody",null,a?o().createElement(qc,{header:a}):null,o().createElement(Uc,{subscribers:n,subscribersCount:t}))))}Fc.propTypes={subscribers:y().arrayOf(y().arrayOf(y().oneOfType([y().string,y().number]))).isRequired,header:y().arrayOf(y().string)},Fc.defaultProps={header:[]},qc.propTypes={header:y().arrayOf(y().string).isRequired},$c.propTypes={subscriber:y().arrayOf(y().oneOfType([y().string,y().number])).isRequired,index:y().node.isRequired},Uc.propTypes={subscribersCount:y().number.isRequired,subscribers:y().arrayOf(y().arrayOf(y().oneOfType([y().string,y().number]))).isRequired},jc.propTypes={subscribersCount:y().number,subscribers:y().arrayOf(y().arrayOf(y().oneOfType([y().string,y().number]))),header:y().arrayOf(y().string)},jc.defaultProps={subscribersCount:0,subscribers:[],header:[]};var Vc=jc;function Wc(e){let{setSelectedSegments:t}=e;const{segments:n}=(0,s.useContext)(Ve.k),{all:a,updateAll:r}=n,[i,l]=(0,s.useState)(a);(0,s.useLayoutEffect)((()=>{!function(e,n){const a=m()("select#mailpoet_segments_select");if(a.data("select2"))return;const r=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};a.html(""),a.select2({data:e.map((e=>({...e,text:e.name}))),dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:r,templateSelection:r}).on("change",(e=>{const n=m()('[data-id="notice_segmentSelection"]');e.currentTarget.value?m()('[data-id="notice_segmentSelection"]').remove():n.length||h.Z.Notice.error(h.Z.I18n.t("segmentSelectionRequired"),{static:!0,scroll:!0,id:"notice_segmentSelection",hideClose:!0});(e=>{t(e)})(T.ZP.pluck(a.select2("data"),"id"))}))}(i)}),[i,t]);const c=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([]),l([...i,e]),r([...i,e])};return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("label",{htmlFor:"mailpoet_segments_select"},h.Z.I18n.t("pickLists"),o().createElement("p",{className:"description"},h.Z.I18n.t("pickListsDescription")))),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered"},o().createElement("div",{className:"mailpoet-form-select mailpoet-form-input"},o().createElement("select",{id:"mailpoet_segments_select","data-placeholder":h.Z.I18n.t("select"),multiple:"multiple"},o().createElement("option",null))),o().createElement(b.Z,{variant:"tertiary",onClick:()=>{return e=c,h.Z.Modal.popup({title:h.Z.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();h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"addSegment",data:{name:t,description:n}}).done((t=>{e({id:t.data.id,name:t.data.name,text:t.data.name,subscriberCount:0}),h.Z.Modal.close()})).fail((e=>{e.errors.length>0&&(h.Z.Notice.hide(),h.Z.Notice.error(e.errors.map((e=>e.message)),{positionAfter:"#new_segment_name"}))}))})),void m()("#new_segment_cancel").on("click",(()=>{h.Z.Modal.close()}));var e}},h.Z.I18n.t("createANewList")))))}Wc.propTypes={setSelectedSegments:y().func.isRequired};var Yc=Wc;function Bc(){return o().createElement("p",{className:"description"},x()(h.Z.I18n.t("consentSubscribed"),/\[link](.*?)\[\/link]/,(e=>o().createElement("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/357-why-express-consent-is-important",key:"kb-link",target:"_blank","data-beacon-article":"605ca22ac44f5d025f447f39",rel:"noopener noreferrer"},e))))}function Hc(e){let{newSubscribersStatus:t,setNewSubscribersStatus:n}=e;const a=(0,s.useCallback)((e=>{n(e.target.value)}),[n]);return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("label",{htmlFor:"new_subscribers_status"},h.Z.I18n.t("newSubscribersStatus")),o().createElement(Bc,null)),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(he.Z,{id:"new_subscribers_status",placeholder:h.Z.I18n.t("select"),name:"new_subscribers_status",onChange:a,defaultValue:t},o().createElement("option",{value:"subscribed"},h.Z.I18n.t("subscribed")),o().createElement("option",{value:"inactive"},h.Z.I18n.t("inactive")),o().createElement("option",{value:"unsubscribed"},h.Z.I18n.t("unsubscribed")))))}function zc(e){let{existingSubscribersStatus:t,setExistingSubscribersStatus:n}=e;const a=(0,s.useCallback)((e=>{n(e.target.value)}),[n]);return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},o().createElement("label",{htmlFor:"existing_subscribers_status"},h.Z.I18n.t("existingSubscribersStatus")),o().createElement(Bc,null)),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(he.Z,{id:"existing_subscribers_status",placeholder:h.Z.I18n.t("select"),name:"existing_subscribers_status",onChange:a,defaultValue:t},o().createElement("option",{value:"dont_update"},h.Z.I18n.t("dontUpdate")),o().createElement("option",{value:"subscribed"},h.Z.I18n.t("subscribed")),o().createElement("option",{value:"inactive"},h.Z.I18n.t("inactive")),o().createElement("option",{value:"unsubscribed"},h.Z.I18n.t("unsubscribed")))))}function Kc(e){let{updateExistingSubscribers:t,setUpdateExistingSubscribers:n}=e;return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("updateExistingSubscribers")),o().createElement("div",{className:"mailpoet-settings-inputs"},o().createElement(ve.Z,{id:"update_existing_subscribers",name:"update_existing_subscribers",value:"1",checked:t,onCheck:()=>n(!0)}),o().createElement("label",{htmlFor:"update_existing_subscribers"},h.Z.I18n.t("updateExistingSubscribersYes")),o().createElement("span",{className:"mailpoet-gap"}),o().createElement(ve.Z,{id:"dont_update_existing_subscribers",name:"update_existing_subscribers",value:"",checked:!t,onCheck:()=>n(!1)}),o().createElement("label",{htmlFor:"dont_update_existing_subscribers"},h.Z.I18n.t("updateExistingSubscribersNo"))))}Hc.propTypes={newSubscribersStatus:y().string.isRequired,setNewSubscribersStatus:y().func.isRequired},zc.propTypes={existingSubscribersStatus:y().string.isRequired,setExistingSubscribersStatus:y().func.isRequired},Kc.propTypes={setUpdateExistingSubscribers:y().func.isRequired,updateExistingSubscribers:y().bool.isRequired};var Gc=Kc;function Qc(e){let{history:t,stepMethodSelectionData:n,subscribersLimitForValidation:a,setStepDataManipulationData:r}=e;const[i,l]=(0,s.useState)([]),[c,u]=(0,s.useState)(!0),[d,p]=(0,s.useState)("subscribed"),[f,g]=(0,s.useState)("dontUpdate");return(0,s.useEffect)((()=>{void 0===n&&t.replace("step_method_selection")}),[n,t]),void 0===n?null:o().createElement("div",{"data-automation-id":"import_data_manipulation_step"},o().createElement(Lc,{stepMethodSelectionData:n}),o().createElement(Vc,{subscribersCount:n.subscribersCount,subscribers:n.subscribers,header:n.header}),o().createElement("div",{className:"mailpoet-settings-grid"},o().createElement(Yc,{setSelectedSegments:l}),o().createElement(Hc,{newSubscribersStatus:d,setNewSubscribersStatus:p}),o().createElement(zc,{existingSubscribersStatus:f,setExistingSubscribersStatus:g}),o().createElement(Gc,{setUpdateExistingSubscribers:u,updateExistingSubscribers:c}),o().createElement(mc,{canGoNext:i.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,a)),onNextAction:()=>{((e,n,a,i,s,o)=>{const l={},c=new(m().AsyncQueue);let u=0;const d=Date.now()/1e3,p={created:0,updated:0,errors:[],segments:[]};h.Z.Modal.loading(!0);const f=(2e3,e.reduce(((e,t,n)=>(n%2e3==0&&e.push([]),e[e.length-1].push(t),e)),[]));T.ZP.each(m()("select.mailpoet_subscribers_column_data_match"),((e,t)=>{const n=m()(e).data("column-id");"ignore"!==n&&(l[n]={index:t})})),T.ZP.each(f,(()=>{c.add((e=>{e.pause(),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"ImportExport",action:"processImport",data:JSON.stringify({columns:l,subscribers:f[u],timestamp:d,segments:n,newSubscribersStatus:a,existingSubscribersStatus:i,updateSubscribers:s})}).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=>{h.Z.Modal.loading(!1),e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})})),u+=1}))})),c.run(),c.onComplete((()=>{h.Z.Modal.loading(!1),p.errors.length>0&&!p.updated&&!p.created?h.Z.Notice.error(T.ZP.flatten(p.errors)):(p.segments=T.ZP.map(T.ZP.filter(p.segments,(e=>n.includes(e.id))),(e=>e.name)),r(p),t.push("step_results"))}))})(n.subscribers,i,d,f,c)},isLastStep:!0})))}n(49868),Qc.propTypes={history:y().shape({push:y().func.isRequired,replace:y().func.isRequired}).isRequired,stepMethodSelectionData:y().shape({duplicate:y().arrayOf(y().string),header:y().arrayOf(y().string),invalid:y().arrayOf(y().string),role:y().arrayOf(y().string),subscribersCount:y().number,subscribers:y().arrayOf(y().arrayOf(y().oneOfType([y().string,y().number])))}),subscribersLimitForValidation:y().number.isRequired,setStepDataManipulationData:y().func.isRequired},Qc.defaultProps={stepMethodSelectionData:void 0};var Xc=(0,d.withRouter)(Qc);function Jc(e){let{subscribersCount:t,segments:n,initialMessage:a}=e;if(t){let e=x()(a,"%1$s",(()=>o().createElement("strong",{key:"%1$s"},t.toLocaleString())));return e=x()(e,"%2$s",(()=>`"${n.join('", "')}"`)),o().createElement("p",null,e)}return null}function eu(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?null:o().createElement("p",null,h.Z.I18n.t("importNoAction"))}function tu(e){let{createdSubscribers:t,updatedSubscribers:n}=e;return t||n?o().createElement(o().Fragment,null,o().createElement("p",null,o().createElement("b",null,h.Z.I18n.t("congratulationResult"))),o().createElement("p",null,x()(h.Z.I18n.t("suppressionListReminder"),/\[link](.*?)\[\/link]/,(e=>o().createElement("a",{className:"mailpoet-link",href:"https://kb.mailpoet.com/article/359-how-to-import-a-suppression-list",key:"kb-link","data-beacon-article":"6064973ce0324b5fdfd0650c",target:"_blank",rel:"noopener noreferrer"},e))))):null}function nu(e){let{addedToSegmentWithWelcomeNotification:t}=e;return t?o().createElement("p",null,h.Z.I18n.t("importNoWelcomeEmail")):null}function au(e){let{errors:t,createdSubscribers:n,updatedSubscribers:a,segments:r,addedToSegmentWithWelcomeNotification:i,history:l}=e;return(0,s.useEffect)((()=>{void 0===r&&0===t.length&&void 0===n&&void 0===a&&l.replace("step_method_selection")}),[r,n,t.length,l,a]),t.length&&h.Z.Notice.error(T.ZP.flatten(t)),o().createElement(o().Fragment,null,o().createElement("div",{className:"updated"},o().createElement(Jc,{subscribersCount:n,segments:r,initialMessage:h.Z.I18n.t("subscribersCreated")}),o().createElement(Jc,{subscribersCount:a,segments:r,initialMessage:h.Z.I18n.t("subscribersUpdated")}),o().createElement(eu,{createdSubscribers:n,updatedSubscribers:a}),o().createElement(nu,{addedToSegmentWithWelcomeNotification:i})),o().createElement(tu,{createdSubscribers:n,updatedSubscribers:a}),o().createElement("div",{className:"mailpoet-settings-grid"},o().createElement("div",{className:"mailpoet-settings-save"},o().createElement(b.Z,{variant:"secondary",type:"button",onClick:()=>l.push("step_method_selection")},h.Z.I18n.t("importAgain")),o().createElement(b.Z,{type:"button",onClick:()=>{window.location.href="admin.php?page=mailpoet-subscribers"}},h.Z.I18n.t("viewSubscribers")))))}Jc.propTypes={segments:y().arrayOf(y().string.isRequired),subscribersCount:y().number,initialMessage:y().string},Jc.defaultProps={segments:[],subscribersCount:0,initialMessage:""},eu.propTypes={createdSubscribers:y().number,updatedSubscribers:y().number},eu.defaultProps={createdSubscribers:0,updatedSubscribers:0},tu.propTypes={createdSubscribers:y().number,updatedSubscribers:y().number},tu.defaultProps={createdSubscribers:0,updatedSubscribers:0},nu.propTypes={addedToSegmentWithWelcomeNotification:y().bool},nu.defaultProps={addedToSegmentWithWelcomeNotification:!1},au.propTypes={history:y().shape({push:y().func.isRequired,replace:y().func.isRequired}).isRequired,errors:y().arrayOf(y().string.isRequired),segments:y().arrayOf(y().string.isRequired),createdSubscribers:y().number,updatedSubscribers:y().number,addedToSegmentWithWelcomeNotification:y().bool},au.defaultProps={errors:[],segments:void 0,createdSubscribers:void 0,updatedSubscribers:void 0,addedToSegmentWithWelcomeNotification:void 0};var ru=(0,d.withRouter)(au);function iu(e){let{history:t}=e;return o().createElement(Tc,{onProceed:()=>t.push("step_method_selection")})}const su=document.getElementById("import_container");function ou(){const[e,t]=(0,s.useState)(void 0),[n,a]=(0,s.useState)({}),r=(0,Ve.S)(window);return o().createElement(Ve.k.Provider,{value:r},o().createElement(u.UT,null,o().createElement(et.Z,null),o().createElement(cc,null,o().createElement(d.Switch,null,o().createElement(d.Route,{path:"/step_clean_list",render:e=>o().createElement(iu,e)}),o().createElement(d.Route,{path:"/step_method_selection",render:e=>o().createElement(kc,(0,S.Z)({},e,{setStepMethodSelectionData:t,subscribersLimitForValidation:100}))}),o().createElement(d.Route,{path:"/step_input_validation",render:t=>o().createElement(Ac,(0,S.Z)({},t,{stepMethodSelectionData:e}))}),o().createElement(d.Route,{path:"/step_data_manipulation",render:t=>o().createElement(Xc,(0,S.Z)({},t,{stepMethodSelectionData:e,subscribersLimitForValidation:100,setStepDataManipulationData:a}))}),o().createElement(d.Route,{path:"/step_results",render:e=>o().createElement(ru,(0,S.Z)({},e,{errors:n.errors,createdSubscribers:n.created,updatedSubscribers:n.updated,segments:n.segments,addedToSegmentWithWelcomeNotification:n.added_to_segment_with_welcome_notification}))}),o().createElement(d.Route,{path:"*",render:()=>o().createElement(d.Redirect,{to:"/step_clean_list"})})))))}su&&c().render(o().createElement(ou,null),su);var lu=n(19675),cu=n.n(lu),uu=n(56692);function du(e){return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("welcomeWizardLetsStartTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("welcomeWizardSenderText")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("form",{id:"mailpoet_sender_form",onSubmit:t=>{t.preventDefault(),m()("#mailpoet_sender_form").parsley().validate()&&e.submit_sender()}},o().createElement(kt.r.TwoColumns,null,o().createElement("label",{htmlFor:"senderName"},o().createElement("span",{className:"mailpoet-wizard-label"},h.Z.I18n.t("senderName")),o().createElement(le.Z,{isFullWidth:!0,name:"senderName",type:"text",placeholder:"John Doe",value:e.sender?e.sender.name:"","data-parsley-required":!0,onChange:t=>e.update_sender({name:t.target.value})})),o().createElement("label",{htmlFor:"senderAddress"},o().createElement("span",{className:"mailpoet-wizard-label"},h.Z.I18n.t("senderAddress")),o().createElement(le.Z,{isFullWidth:!0,name:"senderAddress",type:"text",placeholder:"john@doe.com",value:e.sender?e.sender.address:"","data-parsley-required":!0,"data-parsley-type":"email",onChange:t=>e.update_sender({address:t.target.value})}))),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(b.Z,{isFullWidth:!0,type:"submit",withSpinner:e.loading},h.Z.I18n.t("continue")),o().createElement(b.Z,{href:"#finish",isDisabled:e.loading,isFullWidth:!0,onClick:e.finish,variant:"tertiary"},h.Z.I18n.t("finishLater"))))}m()(document).ready((()=>{let e;if(!m()("#mailpoet_subscribers_export").length)return;if(!window.exportData.segments)return;const t=cu().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 a=m()("#export_lists"),r=m()("#export_columns");function i(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 s(e,t){e.data("select2")&&e.html("").select2("destroy"),e.select2({data:t,width:"20em",dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:i,templateSelection:i}).on("select2:selecting",(t=>{const n=t.params.args.data.id,a=["select","deselect"];let r;T.ZP.contains(a,n)&&(t.preventDefault(),"deselect"===n?m()(t.target).val("").trigger("change"):(r=[],T.ZP.each(e.find("option"),(e=>{const t=e.value;T.ZP.contains(a,t)||r.push(t)})),m()(t.target).val(r).trigger("change")),m()(t.target).select2("close"))})).on("change",(()=>{window.exportData.segments&&a.select2("data").length&&r.select2("data").length||!window.exportData.segments&&r.select2("data").length?n("on"):n("off")}))}e=m()("#mailpoet-export-button"),window.segments.forEach((e=>{a.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,uu.r)(e.name),e.text=(0,uu.r)(e.name)}))})),s(a,window.segments),s(r,window.subscriberFieldsSelect2),r.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;h.Z.Modal.loading(!0);const t=m()(':radio[name="option_format"]:checked').val();h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"ImportExport",action:"processExport",data:JSON.stringify({export_format_option:t,segments:!!window.exportData.segments&&a.val(),subscriber_fields:r.val()})}).always((()=>{h.Z.Modal.loading(!1)})).done((e=>{const n=h.Z.I18n.t("exportMessage").replace("%1$s",`<strong>${parseInt(e.data.totalExported,10).toLocaleString()}</strong>`).replace("[link]",`<a href="${e.data.exportFileURL}" target="_blank" >`).replace("[/link]","</a>");m()("#export_result_notice").html(`<p>${n}</p>`).show(),window.location.href=e.data.exportFileURL,h.Z.trackEvent("Subscribers export completed",{"Total exported":e.data.totalExported,"File Format":t})})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}))})),du.propTypes={finish:y().func.isRequired,loading:y().bool.isRequired,update_sender:y().func.isRequired,submit_sender:y().func.isRequired,sender:y().shape({name:y().string,address:y().string})},du.defaultProps={sender:null};var pu=du;function mu(e){return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("welcomeWizardLetsStartTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("welcomeWizardSenderMigratedUserText")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(b.Z,{isFullWidth:!0,onClick:e.next,type:"button"},h.Z.I18n.t("continue")))}mu.propTypes={next:y().func.isRequired};var hu=mu;function fu(e){return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("welcomeWizardEmailCourseTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("welcomeWizardEmailCourseText")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("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"}),o().createElement(b.Z,{isFullWidth:!0,onClick:e.next,type:"button"},h.Z.I18n.t("continue")))}fu.propTypes={next:y().func.isRequired};var gu=fu,vu=o().createElement("svg",{width:"13",height:"11",viewBox:"0 0 13 11"},o().createElement("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"})),yu=o().createElement("svg",{width:"17",height:"16",viewBox:"0 0 17 16"},o().createElement("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 bu(e){let{onCheck:t,showError:n,checked:a,automationId:r,...i}=e;return o().createElement("div",{className:g()({"mailpoet-form-yesno":!0,"mailpoet-form-yesno-error":n,"mailpoet-disabled":i.disabled}),"data-automation-id":r},o().createElement("label",null,o().createElement("input",(0,S.Z)({type:"radio",checked:!0===a,onChange:()=>t(!0)},i)),o().createElement("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-yes"},vu)),o().createElement("label",null,o().createElement("input",(0,S.Z)({type:"radio",checked:!1===a,onChange:()=>t(!1)},i)),o().createElement("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-no"},yu)))}bu.propTypes={name:y().string.isRequired,checked:y().bool,onCheck:y().func.isRequired,showError:y().bool,automationId:y().string};var wu=bu;function _u(e){let{loading:t,submitForm:n}=e;const[a,r]=(0,s.useState)({tracking:void 0,libs3rdParty:void 0});return o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("welcomeWizardUsageTrackingStepTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("welcomeWizardTrackingText")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(Ce.Z,{level:5},h.Z.I18n.t("welcomeWizardUsageTrackingStepSubTitle")),o().createElement(kt.r.TwoColumnsList,null,o().createElement(sa,null,o().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList1")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList2")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList3")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList4")),o().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList5")))),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("form",{onSubmit:function(e){return e.preventDefault(),n(a.tracking,a.libs3rdParty),!1}},o().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},o().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},o().createElement(wu,{onCheck:e=>{const t={tracking:e,libs3rdParty:a.libs3rdParty};e&&(t.libs3rdParty=e),r(t)},checked:a.tracking,name:"mailpoet_tracking"})),o().createElement("div",null,o().createElement("p",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabel")," ",o().createElement("a",{href:"https://kb.mailpoet.com/article/130-sharing-your-data-with-us","data-beacon-article":"57ce0aaac6979108399a0454",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("welcomeWizardTrackingLink"))),o().createElement("div",{className:"mailpoet-wizard-note"},o().createElement("span",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNoteNote")),h.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNote")))),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},o().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},o().createElement(wu,{onCheck:e=>{const t={libs3rdParty:e,tracking:a.tracking};e||(t.tracking=e),r(t)},checked:a.libs3rdParty,name:"mailpoet_libs_3rdParty"})),o().createElement("div",null,o().createElement("p",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabel")," ",o().createElement("a",{href:"https://kb.mailpoet.com/article/338-what-3rd-party-libraries-we-use","data-beacon-article":"5f7c7dd94cedfd0017dcece8",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLink"))),o().createElement("div",{className:"mailpoet-wizard-note"},o().createElement("span",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNoteNote")),h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNote")))),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(b.Z,{isFullWidth:!0,type:"submit",withSpinner:t,disabled:t},h.Z.I18n.t("continue"))))}_u.propTypes={loading:y().bool.isRequired,submitForm:y().func.isRequired};var Eu=_u;function Zu(e){let{children:t}=e;return o().createElement("div",{className:"mailpoet-steps-content"},t)}Zu.propTypes={children:y().node.isRequired};var Iu=Zu;function Su(e){const[t,n]=(0,s.useState)(null),[a,r]=(0,s.useState)(null),[i,l]=(0,s.useState)(!1),c=e.isWizardStep?h.Z.I18n.t("wooCommerceSetupFinishButtonTextWizard"):h.Z.I18n.t("wooCommerceSetupFinishButtonTextStandalone");let u;return"subscribed"===a&&(u=!0),"unsubscribed"===a&&(u=!1),o().createElement(o().Fragment,null,o().createElement(Ce.Z,{level:1},h.Z.I18n.t("wooCommerceSetupTitle")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("p",null,h.Z.I18n.t("wooCommerceSetupInfo")),o().createElement("div",{className:"mailpoet-gap"}),o().createElement("form",{onSubmit:n=>(n.preventDefault(),l(!0),null===a||null===t||e.submitForm(a,"true"===t),!1)},o().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},o().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},o().createElement(wu,{showError:i&&null===a,checked:u,onCheck:e=>r(e?"subscribed":"unsubscribed"),name:"mailpoet_woocommerce_import_type",automationId:"woocommerce_import_type"})),o().createElement("div",null,o().createElement("p",null,x()(h.Z.I18n.t("wooCommerceSetupImportInfo"),/\[link\](.*?)\[\/link\]/,(e=>o().createElement("a",{key:e,href:"https://kb.mailpoet.com/article/284-import-old-customers-to-the-woocommerce-customers-list","data-beacon-article":"5d722c7104286364bc8ecf19",rel:"noopener noreferrer",target:"_blank"},e)))),o().createElement("div",{className:"mailpoet-wizard-note"},o().createElement("span",null,"GDPR"),h.Z.I18n.t("wooCommerceSetupImportGDPRInfo")))),o().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},o().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},o().createElement(wu,{showError:i&&null===t,checked:t,onCheck:e=>n(e),name:"mailpoet_woocommerce_tracking",automationId:"woocommerce_tracking"})),o().createElement("div",null,o().createElement("p",null,x()(h.Z.I18n.t("wooCommerceSetupTrackingInfo"),/\[link\](.*?)\[\/link\]/,(e=>o().createElement("a",{key:e,href:"https://kb.mailpoet.com/article/280-woocommerce-cookie-tracking","data-beacon-article":"5d5fa44c2c7d3a7a4d778906",rel:"noopener noreferrer",target:"_blank"},e)))),o().createElement("div",{className:"mailpoet-wizard-note"},o().createElement("span",null,"GDPR"),h.Z.I18n.t("wooCommerceSetupTrackingGDPRInfo")))),o().createElement("div",{className:"mailpoet-gap"}),o().createElement(b.Z,{isFullWidth:!0,type:"submit",withSpinner:e.loading,disabled:e.loading,automationId:"submit_woocommerce_setup"},c)))}Su.propTypes={submitForm:y().func.isRequired,loading:y().bool.isRequired,isWizardStep:y().bool},Su.defaultProps={isWizardStep:!1};var ku=Su;function Tu(e){return o().createElement(o().Fragment,null,o().createElement("div",{className:"mailpoet-wizard-logo"},o().createElement("img",{src:window.mailpoet_logo_url,width:"160",height:"50",alt:"MailPoet logo"})),o().createElement(ra,{illustrationUrl:e.illustrationUrl},e.children))}Tu.propTypes={illustrationUrl:y().string.isRequired,children:y().oneOfType([y().arrayOf(y().node),y().node]).isRequired};var Cu=Tu;function Nu(e){let{isWizardStep:t=!1}=e;const[n,a]=(0,s.useState)(!1),r=e=>{a(!1),h.Z.Notice.showApiErrorNotice(e,{scroll:!0})},i=()=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"setupWooCommerceInitialImport"}).fail(r),l=()=>{window.location=window.finish_wizard_url},c=o().createElement(Cu,{illustrationUrl:window.wizard_woocommerce_illustration_url},o().createElement(ku,{loading:n,submitForm:(e,t)=>{a(!0);const n="basic"===h.Z.settings.tracking.level?"basic":"partial";var s;(s={woocommerce_import_screen_displayed:1,"mailpoet_subscribe_old_woocommerce_customers.enabled":"subscribed"===e?1:0,"tracking.level":t?"full":n,"woocommerce.accept_cookie_revenue_tracking.set":1},h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:s}).fail(r)).then(i).then(l)},isWizardStep:t}));return t?c:o().createElement(Iu,null,c)}Nu.propTypes={isWizardStep:y().bool},Nu.defaultProps={isWizardStep:!1};var Du=Nu,xu=e=>{let{name:t,address:n}=e;const a=n.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(a)>-1?(e=>{let{name:t,address:n}=e;const a=`wordpress@${window.location.hostname.replace("www.","")}`;return{sender:{name:t,address:a},reply_to:{name:t,address:n},"signup_confirmation.from.address":a,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":n,"signup_confirmation.reply_to.name":t}})({name:t,address:n}):(e=>{let{name:t,address:n}=e;return{sender:{name:t,address:n},reply_to:{name:t,address:n},"signup_confirmation.from.address":n,"signup_confirmation.from.name":t,"signup_confirmation.reply_to.address":n,"signup_confirmation.reply_to.name":t}})({name:t,address:n})};const Ru=()=>{let e=3;return window.has_mss_key_specified||(e+=1),window.is_woocommerce_active&&(e+=1),e},Ou=(e,t,n)=>{n<Ru()?e.push(`/steps/${n+1}`):t()};var Au=n(60054);function Pu(e){const t=Ru(),n=parseInt(e.match.params.step,10),[a,r]=(0,s.useState)(!1),[i,l]=(0,s.useState)(window.sender_data);function c(){r(!0),window.location=window.finish_wizard_url}(0,s.useEffect)((()=>{(n>t||n<1)&&e.history.push("/steps/1")}),[n,t,e.history]);const u=(0,T.r$)(Ou,e.history,c);function d(e){return r(!0),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:e}).then((()=>r(!1))).fail((e=>{r(!1),e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}const p=(0,s.useCallback)(((e,t)=>{r(!0),d({analytics:{enabled:e?"1":""},"3rd_party_libs":{enabled:t?"1":""}}).then((()=>u(n)))}),[u,n]),m=(0,s.useCallback)((e=>{l({...i,...e})}),[i]),f=(0,s.useCallback)((()=>{d(xu(i)).then((()=>u(n)))}),[u,i,n]),g=(0,s.useCallback)((e=>{e.preventDefault(),r(!0),d(xu({address:window.admin_email,name:""})).then((()=>{window.is_woocommerce_active?u(t-1):c()}))}),[u,t]),v=(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===Ru()?"WizardWooCommerceStep":"WelcomeWizardPitchMSSStep":"WelcomeWizardMigratedUserStep"})(n);return o().createElement(o().Fragment,null,o().createElement(Au.Z,{count:t,current:n}),o().createElement(Iu,null,"WelcomeWizardSenderStep"===v?o().createElement(Cu,{illustrationUrl:window.wizard_sender_illustration_url},o().createElement(pu,{update_sender:m,submit_sender:f,finish:g,loading:a,sender:i})):null,"WelcomeWizardMigratedUserStep"===v?o().createElement(Cu,{illustrationUrl:window.wizard_sender_illustration_url},o().createElement(hu,{next:()=>u(n)})):null,"WelcomeWizardEmailCourseStep"===v?o().createElement(Cu,{illustrationUrl:window.wizard_email_course_illustration_url},o().createElement(gu,{next:()=>u(n)})):null,"WelcomeWizardUsageTrackingStep"===v?o().createElement(Cu,{illustrationUrl:window.wizard_tracking_illustration_url},o().createElement(Eu,{loading:a,submitForm:p})):null,"WelcomeWizardPitchMSSStep"===v?o().createElement(Cu,{illustrationUrl:window.wizard_MSS_pitch_illustration_url},o().createElement(ma,{next:()=>u(n),subscribersCount:window.subscribers_count,mailpoetAccountUrl:window.mailpoet_account_url,purchaseUrl:h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(h.Z.subscribersCount,h.Z.currentWpUserEmail,"business",{utm_medium:"onboarding",utm_campaign:"purchase"})})):null,"WizardWooCommerceStep"===v?o().createElement(Du,{isWizardStep:!0}):null))}Pu.propTypes={match:y().shape({params:y().shape({step:y().string}).isRequired}).isRequired,history:y().shape({push:y().func.isRequired}).isRequired};var Mu=Pu;function Lu(){let e="/steps/1";window.location.search.includes("woocommerce-setup")&&(e="/woocommerce");const t=(0,Ve.S)(window);return o().createElement(Ve.k.Provider,{value:t},o().createElement(u.UT,null,o().createElement(et.Z,null),o().createElement(d.Switch,null,o().createElement(d.Route,{path:"/steps/:step",component:Mu}),o().createElement(d.Route,{path:"/woocommerce",component:Du}),o().createElement(d.Route,{render:()=>o().createElement(d.Redirect,{to:e})}))))}const Fu=document.getElementById("mailpoet-wizard-container");function qu(){const[e,t]=(0,s.useState)(null),n=(0,Ve.S)(window),a=n.notices.error;function r(r){const i=r.target.name,s=r.target.checked;h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"set",data:{[i]:s?1:0}}).done((()=>{const a=e[i];a.value=s,t({...e,[i]:a});const r=`Feature '${i}' was ${s?"enabled":"disabled"}.`;n.notices.success(o().createElement("p",null,r))})).fail((e=>{e.errors.length>0&&a(e.errors.map((e=>o().createElement("p",{key:e.message},e.message))),{scroll:!0})}))}return(0,s.useEffect)((()=>{h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"getAll"}).done((e=>{const n=e.data.reduce(((e,t)=>({...e,[t.name]:t})),{});t(n)})).fail((e=>{e.errors.length>0&&a(o().createElement(o().Fragment,null,e.errors.map((e=>o().createElement("p",null,e.message)))),{scroll:!0})}))}),[a]),null===e?o().createElement("p",null,"Loading experimental features..."):0===Object.values(e).length?o().createElement("p",null,"There are no experimental features at the moment."):o().createElement(Ve.k.Provider,{value:n},o().createElement(o().Fragment,null,o().createElement(et.Z,null),Object.values(e).map((e=>{const t=`experimental-feature-${e.name}`;return o().createElement("div",{key:e.name},o().createElement("label",{htmlFor:t},o().createElement("input",{id:t,type:"checkbox",name:e.name,defaultChecked:e.value,onChange:r})," ",e.name))}))))}Fu&&c().render(o().createElement(Lu,null),Fu);const $u=document.getElementById("experimental_features_container");$u&&c().render(o().createElement(qu,null),$u);var Uu=n(23520);function ju(e){let{message:t,editing:n}=e;return n?o().createElement("textarea",{value:t,className:"mailpoet-logs-full-message",readOnly:!0}):o().createElement(o().Fragment,null,`${t.substr(0,150)}…`)}function Vu(e){let{log:t}=e;const[n,a]=(0,s.useState)(!1);return o().createElement("tr",{key:`log-row-${t.id}`},o().createElement("td",{role:"gridcell"},t.name),o().createElement("td",{onClick:function(e){(function(e){return(e.ctrlKey||e.metaKey)&&!e.altKey})(e)&&(n||a(!0))},role:"gridcell"},o().createElement(ju,{message:t.message,editing:n})),o().createElement("td",{role:"gridcell"},h.Z.Date.full(t.created_at)))}function Wu(e){let{logs:t,onFilter:n,originalFrom:a,originalTo:r,originalSearch:i,originalOffset:l,originalLimit:c}=e;const[u,d]=(0,s.useState)(null!=a?a:void 0),[p,m]=(0,s.useState)(null!=r?r:void 0),[f,g]=(0,s.useState)(null!=l?l:""),[v,y]=(0,s.useState)(null!=c?c:""),[b,w]=(0,s.useState)(i||""),_=(0,os.curry)(((e,t)=>{e(null!==t?h.Z.Date.format(t,{format:"Y-m-d"}):void 0)})),E=(0,s.useCallback)((()=>{const e={};u&&(e.from=u),p&&(e.to=p),f&&""!==f.trim()&&(e.offset=f),v&&""!==v.trim()&&(e.limit=v),b&&""!==b.trim()&&(e.search=b.trim()),n(e)}),[u,v,f,b,p,n]);return o().createElement("div",{className:"mailpoet-listing mailpoet-logs"},o().createElement("div",{className:"mailpoet-listing-header"},o().createElement("div",{className:"mailpoet-listing-search"},o().createElement("label",{htmlFor:"search_input",className:"screen-reader-text"},h.Z.I18n.t("searchLabel")),o().createElement(le.Z,{dimension:"small",iconStart:Uu.Z,type:"search",id:"search_input",name:"s",onChange:e=>w(e.target.value),value:b,placeholder:h.Z.I18n.t("searchLabel")})),o().createElement("div",{className:"mailpoet-listing-filters"},`${h.Z.I18n.t("from")}:`,o().createElement(Dt,{dateFormat:"MMMM d, yyyy",onChange:_(d),maxDate:new Date,selected:u?(0,Ss.default)(u):void 0,dimension:"small"}),`${h.Z.I18n.t("to")}:`,o().createElement(Dt,{dateFormat:"MMMM d, yyyy",onChange:_(m),maxDate:new Date,selected:p?(0,Ss.default)(p):void 0,dimension:"small"})),o().createElement("div",{className:"mailpoet-logs-limit"},o().createElement("label",{htmlFor:"offset_input",className:"screen-reader-text"},h.Z.I18n.t("offsetLabel")),o().createElement(le.Z,{dimension:"small",id:"offset_input",name:"o",type:"number",onChange:e=>g(e.target.value),value:f,placeholder:h.Z.I18n.t("offsetLabel")})),o().createElement("div",{className:"mailpoet-logs-limit"},o().createElement("label",{htmlFor:"limit_input",className:"screen-reader-text"},h.Z.I18n.t("limitLabel")),o().createElement(le.Z,{dimension:"small",id:"limit_input",name:"l",type:"number",onChange:e=>y(e.target.value),value:v,placeholder:h.Z.I18n.t("limitLabel")})),o().createElement(xe.Button,{dimension:"small",onClick:E},h.Z.I18n.t("filter"))),o().createElement("table",{className:"mailpoet-listing-table widefat striped",role:"grid"},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",null,h.Z.I18n.t("tableHeaderName")),o().createElement("th",null,h.Z.I18n.t("tableHeaderMessage")),o().createElement("th",null,h.Z.I18n.t("tableHeaderCreatedOn")))),o().createElement("tbody",null,t.map((e=>o().createElement(Vu,{log:e,key:`log-${e.id}`}))))))}ju.propTypes={message:y().string.isRequired,editing:y().bool.isRequired},Vu.propTypes={log:y().shape({id:y().number.isRequired,name:y().string.isRequired,message:y().string.isRequired,created_at:y().string.isRequired}).isRequired},Wu.propTypes={logs:y().arrayOf(y().shape({id:y().number.isRequired,name:y().string.isRequired,message:y().string.isRequired,created_at:y().string.isRequired})).isRequired,originalFrom:y().string,originalTo:y().string,originalSearch:y().string,originalOffset:y().string,originalLimit:y().string,onFilter:y().func.isRequired};const Yu=document.getElementById("mailpoet_logs_container");if(Yu){const e=new URL(window.location.href);c().render(o().createElement(Wu,{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,a]=t;e.searchParams.append(n,a)})),window.location.href=e.href}}),Yu)}var Bu=n(13651);function Hu(e){let{onRequestClose:t}=e;const[n,a]=(0,s.useState)(!1);return m()((e=>{e(document).on("click",".notice .mailpoet-js-button-fix-this",(()=>{a(!0)}))})),o().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},o().createElement(et.Z,null),n&&o().createElement(Bu.Z,{onRequestClose:()=>{a(!1),t()}}))}Hu.propTypes={onRequestClose:y().func},Hu.defaultProps={onRequestClose:os.noop};const zu=document.getElementById("mailpoet_set_from_address_modal");zu&&c().render(o().createElement(Hu,{onRequestClose:()=>{window.location.href.includes("?page=mailpoet-settings")&&window.location.reload()}}),zu);const Ku=e=>(async e=>"MailPoet"!==h.Z.mtaMethod||-1!==(await(async()=>"MailPoet"!==h.Z.mtaMethod?[]:(await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"mailer",action:"getAuthorizedEmailAddresses"})).data||[])()).indexOf(e))(e).then((e=>{if(!e)return h.Z.Notice.error(h.Z.I18n.t("mailerSendingNotResumedUnauthorized"),{scroll:!0}),h.Z.trackEvent("Unauthorized email used",{"Unauthorized email source":"send"}),!1;h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"mailer",action:"resumeSending"}).done((()=>{h.Z.Notice.success(h.Z.I18n.t("mailerSendingResumedNotice"))})).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}));m()((e=>{e(document).on("click",".notice .mailpoet-js-button-resume-sending",(e=>{Ku(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 a(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 r={p:a,P:function(e,t){var r,i=e.match(/(P+)(p+)?/)||[],s=i[1],o=i[2];if(!o)return n(e,t);switch(s){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;case"PPPP":default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",n(s,t)).replace("{{time}}",a(o,t))}};t.Z=r},24262:function(e,t,n){"use strict";function a(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 a}})},49702:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var a=n(19013),r=n(66979),i=n(7032),s=n(13882);function o(e){(0,s.Z)(1,arguments);var t=(0,i.Z)(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var a=(0,r.Z)(n);return a}var l=6048e5;function c(e){(0,s.Z)(1,arguments);var t=(0,a.default)(e),n=(0,r.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 s}});var a=n(19013),r=n(13882),i=n(66979);function s(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getUTCFullYear(),s=new Date(0);s.setUTCFullYear(n+1,0,4),s.setUTCHours(0,0,0,0);var o=(0,i.Z)(s),l=new Date(0);l.setUTCFullYear(n,0,4),l.setUTCHours(0,0,0,0);var c=(0,i.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 u}});var a=n(19013),r=n(59025),i=n(7651),s=n(13882),o=n(83946);function l(e,t){(0,s.Z)(1,arguments);var n=t||{},a=n.locale,l=a&&a.options&&a.options.firstWeekContainsDate,c=null==l?1:(0,o.Z)(l),u=null==n.firstWeekContainsDate?c:(0,o.Z)(n.firstWeekContainsDate),d=(0,i.Z)(e,t),p=new Date(0);p.setUTCFullYear(d,0,u),p.setUTCHours(0,0,0,0);var m=(0,r.Z)(p,t);return m}var c=6048e5;function u(e,t){(0,s.Z)(1,arguments);var n=(0,a.default)(e),i=(0,r.Z)(n,t).getTime()-l(n,t).getTime();return Math.round(i/c)+1}},7651:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(19013),r=n(13882),i=n(59025),s=n(83946);function o(e,t){(0,r.Z)(1,arguments);var n=(0,a.default)(e),o=n.getUTCFullYear(),l=t||{},c=l.locale,u=c&&c.options&&c.options.firstWeekContainsDate,d=null==u?1:(0,s.Z)(u),p=null==l.firstWeekContainsDate?d:(0,s.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,i.Z)(m,t),f=new Date(0);f.setUTCFullYear(o,0,p),f.setUTCHours(0,0,0,0);var g=(0,i.Z)(f,t);return n.getTime()>=h.getTime()?o+1:n.getTime()>=g.getTime()?o:o-1}},5267:function(e,t,n){"use strict";n.d(t,{Iu:function(){return i},Do:function(){return s},qp:function(){return o}});var a=["D","DD"],r=["YY","YYYY"];function i(e){return-1!==a.indexOf(e)}function s(e){return-1!==r.indexOf(e)}function o(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"))}},13882:function(e,t,n){"use strict";function a(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}n.d(t,{Z:function(){return a}})},66979:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=1,n=(0,a.default)(e),i=n.getUTCDay(),s=(i<t?7:0)+i-t;return n.setUTCDate(n.getUTCDate()-s),n.setUTCHours(0,0,0,0),n}},59025:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a=n(19013),r=n(13882),i=n(83946);function s(e,t){(0,r.Z)(1,arguments);var n=t||{},s=n.locale,o=s&&s.options&&s.options.weekStartsOn,l=null==o?0:(0,i.Z)(o),c=null==n.weekStartsOn?l:(0,i.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=(0,a.default)(e),d=u.getUTCDay(),p=(d<c?7:0)+d-c;return u.setUTCDate(u.getUTCDate()-p),u.setUTCHours(0,0,0,0),u}},83946:function(e,t,n){"use strict";function a(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}n.d(t,{Z:function(){return a}})},77349:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t);return isNaN(s)?new Date(NaN):s?(n.setDate(n.getDate()+s),n):n}},78343:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(83946),r=n(51820),i=n(13882),s=36e5;function o(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.Z)(e,n*s)}},51820:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e).getTime(),s=(0,a.Z)(t);return new Date(n+s)}},58545:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(51820),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.Z)(e,6e4*n)}},11640:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t);if(isNaN(s))return new Date(NaN);if(!s)return n;var o=n.getDate(),l=new Date(n.getTime());l.setMonth(n.getMonth()+s+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 s}});var a=n(83946),r=n(77349),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t),s=7*n;return(0,r.default)(e,s)}},21593:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(11640),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,12*n)}},36948:function(e,t,n){"use strict";n.d(t,{yJ:function(){return a},vh:function(){return r}}),Math.pow(10,8);var a=6e4,r=36e5},92300:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(24262),r=n(69119),i=n(13882),s=864e5;function o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,r.default)(t),l=n.getTime()-(0,a.Z)(n),c=o.getTime()-(0,a.Z)(o);return Math.round((l-c)/s)}},84129:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t),s=n.getFullYear()-i.getFullYear(),o=n.getMonth()-i.getMonth();return 12*s+o}},52724:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(584),r=n(24262),i=n(13882),s=6048e5;function o(e,t,n){(0,i.Z)(2,arguments);var o=(0,a.default)(e,n),l=(0,a.default)(t,n),c=o.getTime()-(0,r.Z)(o),u=l.getTime()-(0,r.Z)(l);return Math.round((c-u)/s)}},91857:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getFullYear()-i.getFullYear()}},57870:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.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 i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.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 s}});var a=n(19013),r=n(83946),i=n(13882);function s(e,t){(0,i.Z)(1,arguments);var n=t||{},s=n.locale,o=s&&s.options&&s.options.weekStartsOn,l=null==o?0:(0,r.Z)(o),c=null==n.weekStartsOn?l:(0,r.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=(0,a.default)(e),d=u.getDay(),p=6+(d<c?-7:0)-(d-c);return u.setDate(u.getDate()+p),u.setHours(23,59,59,999),u}},49546:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return P}});var a=n(12274),r=n(4958),i=n(91218),s=n(19013),o=n(13882),l=864e5,c=n(49702),u=n(7032),d=n(23324),p=n(7651);function m(e,t){for(var n=e<0?"-":"",a=Math.abs(e).toString();a.length<t;)a="0"+a;return n+a}var h=function(e,t){var n=e.getUTCFullYear(),a=n>0?n:1-n;return m("yy"===t?a%100:a,t.length)},f=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):m(n+1,2)},g=function(e,t){return m(e.getUTCDate(),t.length)},v=function(e,t){return m(e.getUTCHours()%12||12,t.length)},y=function(e,t){return m(e.getUTCHours(),t.length)},b=function(e,t){return m(e.getUTCMinutes(),t.length)},w=function(e,t){return m(e.getUTCSeconds(),t.length)},_=function(e,t){var n=t.length,a=e.getUTCMilliseconds();return m(Math.floor(a*Math.pow(10,n-3)),t.length)};function E(e,t){var n=e>0?"-":"+",a=Math.abs(e),r=Math.floor(a/60),i=a%60;if(0===i)return n+String(r);var s=t||"";return n+String(r)+s+m(i,2)}function Z(e,t){return e%60==0?(e>0?"-":"+")+m(Math.abs(e)/60,2):I(e,t)}function I(e,t){var n=t||"",a=e>0?"-":"+",r=Math.abs(e);return a+m(Math.floor(r/60),2)+n+m(r%60,2)}var S={G:function(e,t,n){var a=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});case"GGGG":default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var a=e.getUTCFullYear(),r=a>0?a:1-a;return n.ordinalNumber(r,{unit:"year"})}return h(e,t)},Y:function(e,t,n,a){var r=(0,p.Z)(e,a),i=r>0?r:1-r;return"YY"===t?m(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):m(i,t.length)},R:function(e,t){return m((0,u.Z)(e),t.length)},u:function(e,t){return m(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var a=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return m(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){var a=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return m(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){var a=e.getUTCMonth();switch(t){case"M":case"MM":return f(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){var a=e.getUTCMonth();switch(t){case"L":return String(a+1);case"LL":return m(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){var r=(0,d.Z)(e,a);return"wo"===t?n.ordinalNumber(r,{unit:"week"}):m(r,t.length)},I:function(e,t,n){var a=(0,c.Z)(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):m(a,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 a=function(e){(0,o.Z)(1,arguments);var t=(0,s.default)(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var a=t.getTime(),r=n-a;return Math.floor(r/l)+1}(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):m(a,t.length)},E:function(e,t,n){var a=e.getUTCDay();switch(t){case"E":case"EE":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"})}},e:function(e,t,n,a){var r=e.getUTCDay(),i=(r-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return m(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});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"})}},c:function(e,t,n,a){var r=e.getUTCDay(),i=(r-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return m(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});case"cccc":default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){var a=e.getUTCDay(),r=0===a?7:a;switch(t){case"i":return String(r);case"ii":return m(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});case"iiii":default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){var a=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){var a,r=e.getUTCHours();switch(a=12===r?"noon":0===r?"midnight":r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){var a,r=e.getUTCHours();switch(a=r>=17?"evening":r>=12?"afternoon":r>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var a=e.getUTCHours()%12;return 0===a&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return v(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):y(e,t)},K:function(e,t,n){var a=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):m(a,t.length)},k:function(e,t,n){var a=e.getUTCHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):m(a,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"}):w(e,t)},S:function(e,t){return _(e,t)},X:function(e,t,n,a){var r=(a._originalDate||e).getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return Z(r);case"XXXX":case"XX":return I(r);case"XXXXX":case"XXX":default:return I(r,":")}},x:function(e,t,n,a){var r=(a._originalDate||e).getTimezoneOffset();switch(t){case"x":return Z(r);case"xxxx":case"xx":return I(r);case"xxxxx":case"xxx":default:return I(r,":")}},O:function(e,t,n,a){var r=(a._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+E(r,":");case"OOOO":default:return"GMT"+I(r,":")}},z:function(e,t,n,a){var r=(a._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+E(r,":");case"zzzz":default:return"GMT"+I(r,":")}},t:function(e,t,n,a){var r=a._originalDate||e;return m(Math.floor(r.getTime()/1e3),t.length)},T:function(e,t,n,a){return m((a._originalDate||e).getTime(),t.length)}},k=n(97621),T=n(24262),C=n(5267),N=n(83946),D=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,R=/^'([^]*?)'?$/,O=/''/g,A=/[a-zA-Z]/;function P(e,t,n){(0,o.Z)(2,arguments);var l=String(t),c=n||{},u=c.locale||r.Z,d=u.options&&u.options.firstWeekContainsDate,p=null==d?1:(0,N.Z)(d),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=u.options&&u.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(!u.localize)throw new RangeError("locale must contain localize property");if(!u.formatLong)throw new RangeError("locale must contain formatLong property");var v=(0,s.default)(e);if(!(0,a.default)(v))throw new RangeError("Invalid time value");var y=(0,T.Z)(v),b=(0,i.Z)(v,y),w={firstWeekContainsDate:m,weekStartsOn:g,locale:u,_originalDate:v},_=l.match(x).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,k.Z[t])(e,u.formatLong,w):e})).join("").match(D).map((function(n){if("''"===n)return"'";var a=n[0];if("'"===a)return M(n);var r=S[a];if(r)return!c.useAdditionalWeekYearTokens&&(0,C.Do)(n)&&(0,C.qp)(n,t,e),!c.useAdditionalDayOfYearTokens&&(0,C.Iu)(n)&&(0,C.qp)(n,t,e),r(b,n,u.localize,w);if(a.match(A))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return n})).join("");return _}function M(e){return e.match(R)[1].replace(O,"'")}},55855:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getDate();return n}},20466:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getDay();return n}},85817:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getHours();return n}},9827:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return u}});var a=n(19013),r=n(584),i=n(13882);function s(e){return(0,i.Z)(1,arguments),(0,r.default)(e,{weekStartsOn:1})}function o(e){(0,i.Z)(1,arguments);var t=(0,a.default)(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=s(r),l=new Date(0);l.setFullYear(n,0,4),l.setHours(0,0,0,0);var c=s(l);return t.getTime()>=o.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function l(e){(0,i.Z)(1,arguments);var t=o(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var a=s(n);return a}var c=6048e5;function u(e){(0,i.Z)(1,arguments);var t=(0,a.default)(e),n=s(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 i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getMinutes();return n}},78966:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getMonth();return n}},56605:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.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 i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getSeconds();return n}},28789:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getTime();return n}},95570:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){return(0,r.Z)(1,arguments),(0,a.default)(e).getFullYear()}},42699:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getTime()>i.getTime()}},313:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getTime()<i.getTime()}},71381:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return r}});var a=n(13882);function r(e){return(0,a.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 i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getTime()===i.getTime()}},3151:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(69119),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getTime()===i.getTime()}},49160:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()}},86117:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(94431),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getTime()===i.getTime()}},60792:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e),i=(0,a.default)(t);return n.getFullYear()===i.getFullYear()}},12274:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(71381),r=n(19013),i=n(13882);function s(e){if((0,i.Z)(1,arguments),!(0,a.default)(e)&&"number"!=typeof e)return!1;var t=(0,r.default)(e);return!isNaN(Number(t))}},24257:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e,t){(0,r.Z)(2,arguments);var n=(0,a.default)(e).getTime(),i=(0,a.default)(t.start).getTime(),s=(0,a.default)(t.end).getTime();if(!(i<=s))throw new RangeError("Invalid interval");return n>=i&&n<=s}},4958:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var a={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 r(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,a=e.formats[n]||e.formats[e.defaultWidth];return a}}var i={date:r({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:r({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:r({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},s={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 a,r=n||{};if("formatting"===(r.context?String(r.context):"standalone")&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,s=r.width?String(r.width):i;a=e.formattingValues[s]||e.formattingValues[i]}else{var o=e.defaultWidth,l=r.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[o]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function l(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.width,r=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],i=t.match(r);if(!i)return null;var s,o=i[0],l=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(l)?u(l,(function(e){return e.test(o)})):c(l,(function(e){return e.test(o)}));s=e.valueCallback?e.valueCallback(d):d,s=n.valueCallback?n.valueCallback(s):s;var p=t.slice(o.length);return{value:s,rest:p}}}function c(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function u(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var d,p={code:"en-US",formatDistance:function(e,t,n){var r,i=a[e];return r="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:i,formatRelative:function(e,t,n,a){return s[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),a=n%100;if(a>20||a<10)switch(a%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:(d={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(d.matchPattern);if(!n)return null;var a=n[0],r=e.match(d.parsePattern);if(!r)return null;var i=d.valueCallback?d.valueCallback(r[0]):r[0];i=t.valueCallback?t.valueCallback(i):i;var s=e.slice(a.length);return{value:i,rest:s}}),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 i}});var a=n(19013),r=n(13882);function i(e){var t,n;if((0,r.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,a.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 i}});var a=n(19013),r=n(13882);function i(e){var t,n;if((0,r.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,a.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 ie}});var a=n(4958),r=n(91218),i=n(19013);function s(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),u=n(83946),d=n(7651),p=n(13882);function m(e,t,n){(0,p.Z)(2,arguments);var a=n||{},r=a.locale,s=r&&r.options&&r.options.weekStartsOn,o=null==s?0:(0,u.Z)(s),l=null==a.weekStartsOn?o:(0,u.Z)(a.weekStartsOn);if(!(l>=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=(0,i.default)(e),d=(0,u.Z)(t),m=c.getUTCDay(),h=d%7,f=(h+7)%7,g=(f<l?7:0)+d-m;return c.setUTCDate(c.getUTCDate()+g),c}var h=n(49702),f=n(23324),g=n(66979),v=n(59025),y=/^(1[0-2]|0?\d)/,b=/^(3[0-1]|[0-2]?\d)/,w=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,_=/^(5[0-3]|[0-4]?\d)/,E=/^(2[0-3]|[0-1]?\d)/,Z=/^(2[0-4]|[0-1]?\d)/,I=/^(1[0-1]|0?\d)/,S=/^(1[0-2]|0?\d)/,k=/^[0-5]?\d/,T=/^[0-5]?\d/,C=/^\d/,N=/^\d{1,2}/,D=/^\d{1,3}/,x=/^\d{1,4}/,R=/^-?\d+/,O=/^-?\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 j(e,t,n){var a=t.match(e);if(!a)return null;var r=parseInt(a[0],10);return{value:n?n(r):r,rest:t.slice(a[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 j(R,e,t)}function Y(e,t,n){switch(e){case 1:return j(C,t,n);case 2:return j(N,t,n);case 3:return j(D,t,n);case 4:return j(x,t,n);default:return j(new RegExp("^\\d{1,"+e+"}"),t,n)}}function B(e,t,n){switch(e){case 1:return j(O,t,n);case 2:return j(A,t,n);case 3:return j(P,t,n);case 4:return j(M,t,n);default:return j(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,a=t>0,r=a?t:1-t;if(r<=50)n=e||100;else{var i=r+50;n=e+100*Math.floor(i/100)-(e>=i%100?100:0)}return a?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,a){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,a){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,a){var r=function(e){return{year:e,isTwoDigitYear:"yy"===t}};switch(t){case"y":return Y(4,e,r);case"yo":return n.ordinalNumber(e,{unit:"year",valueCallback:r});default:return Y(t.length,e,r)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,a){var r=e.getUTCFullYear();if(n.isTwoDigitYear){var i=z(n.year,r);return e.setUTCFullYear(i,0,1),e.setUTCHours(0,0,0,0),e}var s="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(s,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,a){var r=function(e){return{year:e,isTwoDigitYear:"YY"===t}};switch(t){case"Y":return Y(4,e,r);case"Yo":return n.ordinalNumber(e,{unit:"year",valueCallback:r});default:return Y(t.length,e,r)}},validate:function(e,t,n){return t.isTwoDigitYear||t.year>0},set:function(e,t,n,a){var r=(0,d.Z)(e,a);if(n.isTwoDigitYear){var i=z(n.year,r);return e.setUTCFullYear(i,0,a.firstWeekContainsDate),e.setUTCHours(0,0,0,0),(0,v.Z)(e,a)}var s="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(s,0,a.firstWeekContainsDate),e.setUTCHours(0,0,0,0),(0,v.Z)(e,a)},incompatibleTokens:["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:{priority:130,parse:function(e,t,n,a){return B("R"===t?4:t.length,e)},set:function(e,t,n,a){var r=new Date(0);return r.setUTCFullYear(n,0,4),r.setUTCHours(0,0,0,0),(0,g.Z)(r)},incompatibleTokens:["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:{priority:130,parse:function(e,t,n,a){return B("u"===t?4:t.length,e)},set:function(e,t,n,a){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,a){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,a){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,a){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,a){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,a){var r=function(e){return e-1};switch(t){case"M":return j(y,e,r);case"MM":return Y(2,e,r);case"Mo":return n.ordinalNumber(e,{unit:"month",valueCallback:r});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,a){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,a){var r=function(e){return e-1};switch(t){case"L":return j(y,e,r);case"LL":return Y(2,e,r);case"Lo":return n.ordinalNumber(e,{unit:"month",valueCallback:r});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,a){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,a){switch(t){case"w":return j(_,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,a){return(0,v.Z)(function(e,t,n){(0,p.Z)(2,arguments);var a=(0,i.default)(e),r=(0,u.Z)(t),s=(0,f.Z)(a,n)-r;return a.setUTCDate(a.getUTCDate()-7*s),a}(e,n,a),a)},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:{priority:100,parse:function(e,t,n,a){switch(t){case"I":return j(_,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,a){return(0,g.Z)(function(e,t){(0,p.Z)(2,arguments);var n=(0,i.default)(e),a=(0,u.Z)(t),r=(0,h.Z)(n)-a;return n.setUTCDate(n.getUTCDate()-7*r),n}(e,n,a),a)},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,a){switch(t){case"d":return j(b,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return Y(t.length,e)}},validate:function(e,t,n){var a=Q(e.getUTCFullYear()),r=e.getUTCMonth();return a?t>=1&&t<=G[r]:t>=1&&t<=K[r]},set:function(e,t,n,a){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,a){switch(t){case"D":case"DD":return j(w,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return Y(t.length,e)}},validate:function(e,t,n){return Q(e.getUTCFullYear())?t>=1&&t<=366:t>=1&&t<=365},set:function(e,t,n,a){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,a){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,a){return(e=m(e,n,a)).setUTCHours(0,0,0,0),e},incompatibleTokens:["D","i","e","c","t","T"]},e:{priority:90,parse:function(e,t,n,a){var r=function(e){var t=7*Math.floor((e-1)/7);return(e+a.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return Y(t.length,e,r);case"eo":return n.ordinalNumber(e,{unit:"day",valueCallback:r});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,a){return(e=m(e,n,a)).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,a){var r=function(e){var t=7*Math.floor((e-1)/7);return(e+a.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return Y(t.length,e,r);case"co":return n.ordinalNumber(e,{unit:"day",valueCallback:r});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,a){return(e=m(e,n,a)).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,a){var r=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:r})||n.day(e,{width:"short",context:"formatting",valueCallback:r})||n.day(e,{width:"narrow",context:"formatting",valueCallback:r});case"iiiii":return n.day(e,{width:"narrow",context:"formatting",valueCallback:r});case"iiiiii":return n.day(e,{width:"short",context:"formatting",valueCallback:r})||n.day(e,{width:"narrow",context:"formatting",valueCallback:r});case"iiii":default:return n.day(e,{width:"wide",context:"formatting",valueCallback:r})||n.day(e,{width:"abbreviated",context:"formatting",valueCallback:r})||n.day(e,{width:"short",context:"formatting",valueCallback:r})||n.day(e,{width:"narrow",context:"formatting",valueCallback:r})}},validate:function(e,t,n){return t>=1&&t<=7},set:function(e,t,n,a){return(e=function(e,t){(0,p.Z)(2,arguments);var n=(0,u.Z)(t);n%7==0&&(n-=7);var a=1,r=(0,i.default)(e),s=r.getUTCDay(),o=((n%7+7)%7<a?7:0)+n-s;return r.setUTCDate(r.getUTCDate()+o),r}(e,n,a)).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,a){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,a){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["b","B","H","k","t","T"]},b:{priority:80,parse:function(e,t,n,a){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,a){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["a","B","H","k","t","T"]},B:{priority:80,parse:function(e,t,n,a){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,a){return e.setUTCHours(H(n),0,0,0),e},incompatibleTokens:["a","b","t","T"]},h:{priority:70,parse:function(e,t,n,a){switch(t){case"h":return j(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,a){var r=e.getUTCHours()>=12;return r&&n<12?e.setUTCHours(n+12,0,0,0):r||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,a){switch(t){case"H":return j(E,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,a){return e.setUTCHours(n,0,0,0),e},incompatibleTokens:["a","b","h","K","k","t","T"]},K:{priority:70,parse:function(e,t,n,a){switch(t){case"K":return j(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,a){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,a){switch(t){case"k":return j(Z,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=1&&t<=24},set:function(e,t,n,a){var r=n<=24?n%24:n;return e.setUTCHours(r,0,0,0),e},incompatibleTokens:["a","b","h","H","K","t","T"]},m:{priority:60,parse:function(e,t,n,a){switch(t){case"m":return j(k,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,a){return e.setUTCMinutes(n,0,0),e},incompatibleTokens:["t","T"]},s:{priority:50,parse:function(e,t,n,a){switch(t){case"s":return j(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,a){return e.setUTCSeconds(n,0),e},incompatibleTokens:["t","T"]},S:{priority:30,parse:function(e,t,n,a){return Y(t.length,e,(function(e){return Math.floor(e*Math.pow(10,3-t.length))}))},set:function(e,t,n,a){return e.setUTCMilliseconds(n),e},incompatibleTokens:["t","T"]},X:{priority:10,parse:function(e,t,n,a){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,a){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","x"]},x:{priority:10,parse:function(e,t,n,a){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,a){return t.timestampIsSet?e:new Date(e.getTime()-n)},incompatibleTokens:["t","T","X"]},t:{priority:40,parse:function(e,t,n,a){return W(e)},set:function(e,t,n,a){return[new Date(1e3*n),{timestampIsSet:!0}]},incompatibleTokens:"*"},T:{priority:20,parse:function(e,t,n,a){return W(e)},set:function(e,t,n,a){return[new Date(n),{timestampIsSet:!0}]},incompatibleTokens:"*"}},J=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,te=/^'([^]*?)'?$/,ne=/''/g,ae=/\S/,re=/[a-zA-Z]/;function ie(e,t,n,d){(0,p.Z)(3,arguments);var m=String(e),h=String(t),f=d||{},g=f.locale||a.Z;if(!g.match)throw new RangeError("locale must contain match property");var v=g.options&&g.options.firstWeekContainsDate,y=null==v?1:(0,u.Z)(v),b=null==f.firstWeekContainsDate?y:(0,u.Z)(f.firstWeekContainsDate);if(!(b>=1&&b<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var w=g.options&&g.options.weekStartsOn,_=null==w?0:(0,u.Z)(w),E=null==f.weekStartsOn?_:(0,u.Z)(f.weekStartsOn);if(!(E>=0&&E<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(""===h)return""===m?(0,i.default)(n):new Date(NaN);var Z,I={firstWeekContainsDate:b,weekStartsOn:E,locale:g},S=[{priority:10,subPriority:-1,set:se,index:0}],k=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(Z=0;Z<k.length;Z++){var C=k[Z];!f.useAdditionalWeekYearTokens&&(0,c.Do)(C)&&(0,c.qp)(C,h,e),!f.useAdditionalDayOfYearTokens&&(0,c.Iu)(C)&&(0,c.qp)(C,h,e);var N=C[0],D=X[N];if(D){var x=D.incompatibleTokens;if(Array.isArray(x)){for(var R=void 0,O=0;O<T.length;O++){var A=T[O].token;if(-1!==x.indexOf(A)||A===N){R=T[O];break}}if(R)throw new RangeError("The format string mustn't contain `".concat(R.fullToken,"` and `").concat(C,"` at the same time"))}else if("*"===D.incompatibleTokens&&T.length)throw new RangeError("The format string mustn't contain `".concat(C,"` and any other token at the same time"));T.push({token:N,fullToken:C});var P=D.parse(m,C,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(re))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");if("''"===C?C="'":"'"===N&&(C=oe(C)),0!==m.indexOf(C))return new Date(NaN);m=m.slice(C.length)}}if(m.length>0&&ae.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,i.default)(n);if(isNaN(L))return new Date(NaN);var F=(0,r.Z)(L,(0,l.Z)(L)),q={};for(Z=0;Z<M.length;Z++){var $=M[Z];if($.validate&&!$.validate(F,$.value,I))return new Date(NaN);var U=$.set(F,q,$.value,I);U[0]?(F=U[0],s(q,U[1])):F=U}return F}function se(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 s}});var a=n(36948),r=n(13882),i=n(83946);function s(e,t){(0,r.Z)(1,arguments);var n=t||{},a=null==n.additionalDigits?2:(0,i.Z)(n.additionalDigits);if(2!==a&&1!==a&&0!==a)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 s,o=d(e);if(o.date){var l=p(o.date,a);s=m(l.restDateString,l.year)}if(!s||isNaN(s.getTime()))return new Date(NaN);var c,u=s.getTime(),h=0;if(o.time&&(h=f(o.time),isNaN(h)))return new Date(NaN);if(!o.timezone){var g=new Date(u+h),y=new Date(0);return y.setFullYear(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),y.setHours(g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds()),y}return c=v(o.timezone),isNaN(c)?new Date(NaN):new Date(u+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*)?))?$/,u=/^([+-])(\d{2})(?::?(\d{2}))?$/;function d(e){var t,n={},a=e.split(o.dateTimeDelimiter);if(a.length>2)return n;if(/:/.test(a[0])?t=a[0]:(n.date=a[0],t=a[1],o.timeZoneDelimiter.test(n.date)&&(n.date=e.split(o.timeZoneDelimiter)[0],t=e.substr(n.date.length,e.length))),t){var r=o.timezone.exec(t);r?(n.time=t.replace(r[1],""),n.timezone=r[1]):n.time=t}return n}function p(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),a=e.match(n);if(!a)return{year:NaN,restDateString:""};var r=a[1]?parseInt(a[1]):null,i=a[2]?parseInt(a[2]):null;return{year:null===i?r:100*i,restDateString:e.slice((a[1]||a[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 a=!!n[4],r=h(n[1]),i=h(n[2])-1,s=h(n[3]),o=h(n[4]),c=h(n[5])-1;if(a)return function(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}(0,o,c)?function(e,t,n){var a=new Date(0);a.setUTCFullYear(e,0,4);var r=7*(t-1)+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}(t,o,c):new Date(NaN);var u=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(y[t]||(b(e)?29:28))}(t,i,s)&&function(e,t){return t>=1&&t<=(b(e)?366:365)}(t,r)?(u.setUTCFullYear(t,i,Math.max(r,s)),u):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]),r=g(t[2]),i=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,r,i)?n*a.vh+r*a.yJ+1e3*i:NaN}function g(e){return e&&parseFloat(e.replace(",","."))||0}function v(e){if("Z"===e)return 0;var t=e.match(u);if(!t)return 0;var n="+"===t[1]?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,i)?n*(r*a.vh+i*a.yJ):NaN}var y=[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 s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t);return n.setHours(s),n}},4543:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t);return n.setMinutes(s),n}},62225:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(83946),r=n(19013),i=n(13882);function s(e){(0,i.Z)(1,arguments);var t=(0,r.default)(e),n=t.getFullYear(),a=t.getMonth(),s=new Date(0);return s.setFullYear(n,a+1,0),s.setHours(0,0,0,0),s.getDate()}function o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t),l=n.getFullYear(),c=n.getDate(),u=new Date(0);u.setFullYear(l,o,15),u.setHours(0,0,0,0);var d=s(u);return n.setMonth(o,Math.min(c,d)),n}},11503:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(83946),r=n(19013),i=n(62225),s=n(13882);function o(e,t){(0,s.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t),l=Math.floor(n.getMonth()/3)+1,c=o-l;return(0,i.default)(n,n.getMonth()+3*c)}},39880:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t);return n.setSeconds(s),n}},44749:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(19013),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(s),n)}},69119:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.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 i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.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 i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getMonth(),i=n-n%3;return t.setMonth(i,1),t.setHours(0,0,0,0),t}},584:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(19013),r=n(83946),i=n(13882);function s(e,t){(0,i.Z)(1,arguments);var n=t||{},s=n.locale,o=s&&s.options&&s.options.weekStartsOn,l=null==o?0:(0,r.Z)(o),c=null==n.weekStartsOn?l:(0,r.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=(0,a.default)(e),d=u.getDay(),p=(d<c?7:0)+d-c;return u.setDate(u.getDate()-p),u.setHours(0,0,0,0),u}},38148:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var a=n(19013),r=n(13882);function i(e){(0,r.Z)(1,arguments);var t=(0,a.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 s}});var a=n(83946),r=n(77349),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,-n)}},88330:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(78343),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,-n)}},91218:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a=n(83946),r=n(51820),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.Z)(e,-n)}},1784:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(58545),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,-n)}},54559:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(11640),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,-n)}},77982:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(63500),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,-n)}},59319:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(83946),r=n(21593),i=n(13882);function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,-n)}},19013:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return r}});var a=n(13882);function r(e){(0,a.Z)(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}},16245:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,n){var a,r=n||{};if("formatting"===(r.context?String(r.context):"standalone")&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,s=r.width?String(r.width):i;a=e.formattingValues[s]||e.formattingValues[i]}else{var o=e.defaultWidth,l=r.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[o]}return a[e.argumentCallback?e.argumentCallback(t):t]}},e.exports=t.default},57460:function(e,t){var n,a;void 0===(a="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,a=n&&/blob:/i.test((t.location||{}).protocol),r={},i=0,s={parse:function(n,a){var o=(a=a||{}).dynamicTyping||!1;if(_(o)&&(a.dynamicTypingFunction=o,o={}),a.dynamicTyping=o,a.transform=!!_(a.transform)&&a.transform,a.worker&&s.WORKERS_SUPPORTED){var l=function(){if(!s.WORKERS_SUPPORTED)return!1;var n,a,o=(n=t.URL||t.webkitURL||null,a=e.toString(),s.BLOB_URL||(s.BLOB_URL=n.createObjectURL(new Blob(["(",a,")();"],{type:"text/javascript"})))),l=new t.Worker(o);return l.onmessage=g,l.id=i++,r[l.id]=l}();return l.userStep=a.step,l.userChunk=a.chunk,l.userComplete=a.complete,l.userError=a.error,a.step=_(a.step),a.chunk=_(a.chunk),a.complete=_(a.complete),a.error=_(a.error),delete a.worker,void l.postMessage({input:n,config:a,workerId:l.id})}var m=null;return s.NODE_STREAM_INPUT,"string"==typeof n?m=a.download?new c(a):new d(a):!0===n.readable&&_(n.read)&&_(n.on)?m=new p(a):(t.File&&n instanceof File||n instanceof Object)&&(m=new u(a)),m.stream(n)},unparse:function(e,t){var n=!1,a=!0,r=",",i="\r\n",o='"',l=o+o,c=!1,u=null,d=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||s.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(r=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&&(i=t.newline),"string"==typeof t.quoteChar&&(o=t.quoteChar),"boolean"==typeof t.header&&(a=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");u=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+o),"boolean"==typeof t.escapeFormulae&&(d=t.escapeFormulae)}}();var p=new RegExp(h(o),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return m(null,e,c);if("object"==typeof e[0])return m(u||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),m(e.fields||[],e.data||[],c);throw new Error("Unable to serialize unrecognized input");function m(e,t,n){var s="";"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&&a){for(var c=0;c<e.length;c++)0<c&&(s+=r),s+=f(e[c],c);0<t.length&&(s+=i)}for(var u=0;u<t.length;u++){var d=o?e.length:t[u].length,p=!1,m=o?0===Object.keys(t[u]).length:0===t[u].length;if(n&&!o&&(p="greedy"===n?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===n&&o){for(var h=[],g=0;g<d;g++){var v=l?e[g]:g;h.push(t[u][v])}p=""===h.join("").trim()}if(!p){for(var y=0;y<d;y++){0<y&&!m&&(s+=r);var b=o&&l?e[y]:y;s+=f(t[u][b],y)}u<t.length-1&&(!n||0<d&&!m)&&(s+=i)}}return s}function f(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);!0===d&&"string"==typeof e&&null!==e.match(/^[=+\-@].*$/)&&(e="'"+e);var a=e.toString().replace(p,l);return"boolean"==typeof n&&n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1}(a,s.BAD_DELIMITERS)||-1<a.indexOf(r)||" "===a.charAt(0)||" "===a.charAt(a.length-1)?o+a+o:a}}};if(s.RECORD_SEP=String.fromCharCode(30),s.UNIT_SEP=String.fromCharCode(31),s.BYTE_ORDER_MARK="\ufeff",s.BAD_DELIMITERS=["\r","\n",'"',s.BYTE_ORDER_MARK],s.WORKERS_SUPPORTED=!n&&!!t.Worker,s.NODE_STREAM_INPUT=1,s.LocalChunkSize=10485760,s.RemoteChunkSize=5242880,s.DefaultDelimiter=",",s.Parser=f,s.ParserHandle=m,s.NetworkStreamer=c,s.FileStreamer=u,s.StringStreamer=d,s.ReadableStreamStreamer=p,t.jQuery){var o=t.jQuery;o.fn.parse=function(e){var n=e.config||{},a=[];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 r=0;r<this.files.length;r++)a.push({file:this.files[r],inputElem:this,instanceConfig:o.extend({},n)})})),r(),this;function r(){if(0!==a.length){var t,n,r,l=a[0];if(_(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,r=c.reason,void(_(e.error)&&e.error({name:"AbortError"},t,n,r));if("skip"===c.action)return void i();"object"==typeof c.config&&(l.instanceConfig=o.extend(l.instanceConfig,c.config))}else if("skip"===c)return void i()}var u=l.instanceConfig.complete;l.instanceConfig.complete=function(e){_(u)&&u(e,l.file,l.inputElem),i()},s.parse(l.file,l.instanceConfig)}else _(e.complete)&&e.complete()}function i(){a.splice(0,1),r()}}}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&&_(this._config.beforeFirstChunk)){var r=this._config.beforeFirstChunk(e);void 0!==r&&(e=r)}this.isFirstChunk=!1,this._halted=!1;var i=this._partialLine+e;this._partialLine="";var o=this._handle.parse(i,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=o.meta.cursor;this._finished||(this._partialLine=i.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(a)t.postMessage({results:o,workerId:s.WORKER_ID,finished:c});else if(_(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||!_(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){_(this._config.error)?this._config.error(e):a&&this._config.error&&t.postMessage({workerId:s.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=s.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=w(this._chunkLoaded,this),t.onerror=w(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var a in e)t.setRequestHeader(a,e[a])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+r)}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 u(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=s.LocalChunkSize),l.call(this,e);var a="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,a?((t=new FileReader).onload=w(this._chunkLoaded,this),t.onerror=w(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var r=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,r)}var i=t.readAsText(e,this._config.encoding);a||this._chunkLoaded({target:{result:i}})},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 d(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,a=!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(){a&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=w((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=w((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=w((function(){this._streamCleanUp(),a=!0,this._streamData("")}),this),this._streamCleanUp=w((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function m(e){var t,n,a,r=Math.pow(2,53),i=-r,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,u=0,d=0,p=!1,m=!1,g=[],v={data:[],errors:[],meta:{}};if(_(e.step)){var y=e.step;e.step=function(t){if(v=t,Z())E();else{if(E(),0===v.data.length)return;u+=t.data.length,e.preview&&u>e.preview?n.abort():(v.data=v.data[0],y(v,c))}}}function w(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function E(){if(v&&a&&(S("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),a=!1),e.skipEmptyLines)for(var t=0;t<v.data.length;t++)w(v.data[t])&&v.data.splice(t--,1);return Z()&&function(){if(v)if(Array.isArray(v.data[0])){for(var t=0;Z()&&t<v.data.length;t++)v.data[t].forEach(n);v.data.splice(0,1)}else v.data.forEach(n);function n(t,n){_(e.transformHeader)&&(t=e.transformHeader(t,n)),g.push(t)}}(),function(){if(!v||!e.header&&!e.dynamicTyping&&!e.transform)return v;function t(t,n){var a,r=e.header?{}:[];for(a=0;a<t.length;a++){var i=a,s=t[a];e.header&&(i=a>=g.length?"__parsed_extra":g[a]),e.transform&&(s=e.transform(s,i)),s=I(i,s),"__parsed_extra"===i?(r[i]=r[i]||[],r[i].push(s)):r[i]=s}return e.header&&(a>g.length?S("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+a,d+n):a<g.length&&S("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+a,d+n)),r}var n=1;return!v.data.length||Array.isArray(v.data[0])?(v.data=v.data.map(t),n=v.data.length):v.data=t(v.data,0),e.header&&v.meta&&(v.meta.fields=g),d+=n,v}()}function Z(){return e.header&&0===g.length}function I(t,n){return a=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[a]&&(e.dynamicTyping[a]=e.dynamicTypingFunction(a)),!0===(e.dynamicTyping[a]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(o.test(e)){var t=parseFloat(e);if(i<t&&t<r)return!0}return!1}(n)?parseFloat(n):l.test(n)?new Date(n):""===n?null:n):n;var a}function S(e,t,n,a){var r={type:e,code:t,message:n};void 0!==a&&(r.row=a),v.errors.push(r)}this.parse=function(r,i,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"),a=(e=e.replace(n,"")).split("\r"),r=e.split("\n"),i=1<r.length&&r[0].length<a[0].length;if(1===a.length||i)return"\n";for(var s=0,o=0;o<a.length;o++)"\n"===a[o][0]&&s++;return s>=a.length/2?"\r\n":"\r"}(r,l)),a=!1,e.delimiter)_(e.delimiter)&&(e.delimiter=e.delimiter(r),v.meta.delimiter=e.delimiter);else{var c=function(t,n,a,r,i){var o,l,c,u;i=i||[",","\t","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var d=0;d<i.length;d++){var p=i[d],m=0,h=0,g=0;c=void 0;for(var v=new f({comments:r,delimiter:p,newline:n,preview:10}).parse(t),y=0;y<v.data.length;y++)if(a&&w(v.data[y]))g++;else{var b=v.data[y].length;h+=b,void 0!==c?0<b&&(m+=Math.abs(b-c),c=b):c=b}0<v.data.length&&(h/=v.data.length-g),(void 0===l||m<=l)&&(void 0===u||u<h)&&1.99<h&&(l=m,o=p,u=h)}return{successful:!!(e.delimiter=o),bestDelimiter:o}}(r,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(a=!0,e.delimiter=s.DefaultDelimiter),v.meta.delimiter=e.delimiter}var u=b(e);return e.preview&&e.header&&u.preview++,t=r,n=new f(u),v=n.parse(t,i,o),E(),p?{meta:{paused:!0}}:v||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,n.abort(),t=_(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(p=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return m},this.abort=function(){m=!0,n.abort(),v.meta.aborted=!0,_(e.complete)&&e.complete(v),t=""}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function f(e){var t,n=(e=e||{}).delimiter,a=e.newline,r=e.comments,i=e.step,o=e.preview,l=e.fastMode,c=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof n||-1<s.BAD_DELIMITERS.indexOf(n))&&(n=","),r===n)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<s.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==a&&"\r"!==a&&"\r\n"!==a&&(a="\n");var u=0,d=!1;this.parse=function(e,s,p){if("string"!=typeof e)throw new Error("Input must be a string");var m=e.length,f=n.length,g=a.length,v=r.length,y=_(i),b=[],w=[],E=[],Z=u=0;if(!e)return M();if(l||!1!==l&&-1===e.indexOf(t)){for(var I=e.split(a),S=0;S<I.length;S++){if(E=I[S],u+=E.length,S!==I.length-1)u+=a.length;else if(p)return M();if(!r||E.substring(0,v)!==r){if(y){if(b=[],R(E.split(n)),L(),d)return M()}else R(E.split(n));if(o&&o<=S)return b=b.slice(0,o),M(!0)}}return M()}for(var k=e.indexOf(n,u),T=e.indexOf(a,u),C=new RegExp(h(c)+h(t),"g"),N=e.indexOf(t,u);;)if(e[u]!==t)if(r&&0===E.length&&e.substring(u,u+v)===r){if(-1===T)return M();u=T+g,T=e.indexOf(a,u),k=e.indexOf(n,u)}else if(-1!==k&&(k<T||-1===T))E.push(e.substring(u,k)),u=k+f,k=e.indexOf(n,u);else{if(-1===T)break;if(E.push(e.substring(u,T)),P(T+g),y&&(L(),d))return M();if(o&&b.length>=o)return M(!0)}else for(N=u,u++;;){if(-1===(N=e.indexOf(t,N+1)))return p||w.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:u}),A();if(N===m-1)return A(e.substring(u,N).replace(C,t));if(t!==c||e[N+1]!==c){if(t===c||0===N||e[N-1]!==c){-1!==k&&k<N+1&&(k=e.indexOf(n,N+1)),-1!==T&&T<N+1&&(T=e.indexOf(a,N+1));var D=O(-1===T?k:Math.min(k,T));if(e[N+1+D]===n){E.push(e.substring(u,N).replace(C,t)),e[u=N+1+D+f]!==t&&(N=e.indexOf(t,u)),k=e.indexOf(n,u),T=e.indexOf(a,u);break}var x=O(T);if(e.substring(N+1+x,N+1+x+g)===a){if(E.push(e.substring(u,N).replace(C,t)),P(N+1+x+g),k=e.indexOf(n,u),N=e.indexOf(t,u),y&&(L(),d))return M();if(o&&b.length>=o)return M(!0);break}w.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:b.length,index:u}),N++}}else N++}return A();function R(e){b.push(e),Z=u}function O(t){var n=0;if(-1!==t){var a=e.substring(N+1,t);a&&""===a.trim()&&(n=a.length)}return n}function A(t){return p||(void 0===t&&(t=e.substring(u)),E.push(t),u=m,R(E),y&&L()),M()}function P(t){u=t,R(E),E=[],T=e.indexOf(a,u)}function M(e){return{data:b,errors:w,meta:{delimiter:n,linebreak:a,aborted:d,truncated:!!e,cursor:Z+(s||0)}}}function L(){i(M()),b=[],w=[]}},this.abort=function(){d=!0},this.getCharIndex=function(){return u}}function g(e){var t=e.data,n=r[t.workerId],a=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var i={abort:function(){a=!0,v(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(_(n.userStep)){for(var s=0;s<t.results.data.length&&(n.userStep({data:t.results.data[s],errors:t.results.errors,meta:t.results.meta},i),!a);s++);delete t.results}else _(n.userChunk)&&(n.userChunk(t.results,i,t.file),delete t.results)}t.finished&&!a&&v(t.workerId,t.results)}function v(e,t){var n=r[e];_(n.userComplete)&&n.userComplete(t),n.terminate(),delete r[e]}function y(){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 w(e,t){return function(){e.apply(t,arguments)}}function _(e){return"function"==typeof e}return a&&(t.onmessage=function(e){var n=e.data;if(void 0===s.WORKER_ID&&n&&(s.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:s.WORKER_ID,results:s.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var a=s.parse(n.input,n.config);a&&t.postMessage({workerId:s.WORKER_ID,results:a,finished:!0})}}),(c.prototype=Object.create(l.prototype)).constructor=c,(u.prototype=Object.create(l.prototype)).constructor=u,(d.prototype=Object.create(d.prototype)).constructor=d,(p.prototype=Object.create(l.prototype)).constructor=p,s})?n.apply(t,[]):n)||(e.exports=a)},9198:function(e,t,n){!function(e,t,a,r,i,s,o,l,c,u,d,p,m,h,f,g,v,y,b,w,_,E,Z,I,S,k,T,C,N,D,x,R,O,A,P,M,L,F,q,$,U,j,V,W,Y,B,H,z,K,G,Q,X,J,ee,te,ne,ae,re,ie,se,oe,le,ce){"use strict";function ue(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var de=ue(t),pe=ue(r),me=ue(i),he=ue(s),fe=ue(o),ge=ue(l),ve=ue(c),ye=ue(u),be=ue(d),we=ue(p),_e=ue(m),Ee=ue(g),Ze=ue(v),Ie=ue(y),Se=ue(b),ke=ue(w),Te=ue(_),Ce=ue(E),Ne=ue(Z),De=ue(I),xe=ue(S),Re=ue(k),Oe=ue(T),Ae=ue(C),Pe=ue(N),Me=ue(D),Le=ue(x),Fe=ue(R),qe=ue(O),$e=ue(A),Ue=ue(P),je=ue(M),Ve=ue(L),We=ue(F),Ye=ue(q),Be=ue(U),He=ue(j),ze=ue(V),Ke=ue(W),Ge=ue(Y),Qe=ue(B),Xe=ue(H),Je=ue(G),et=ue(Q),tt=ue(X),nt=ue(J),at=ue(ee),rt=ue(te),it=ue(ne),st=ue(ae),ot=ue(re),lt=ue(ie),ct=ue(se),ut=ue(oe),dt=ue(le);function pt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function mt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pt(Object(n),!0).forEach((function(t){yt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ht(e){return(ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ft(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gt(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function vt(e,t,n){return t&&gt(e.prototype,t),n&&gt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bt(){return(bt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}function wt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&Et(e,t)}function _t(e){return(_t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Et(e,t){return(Et=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function It(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Zt(e)}function St(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,a=_t(e);if(t){var r=_t(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return It(this,n)}}function kt(e){return function(e){if(Array.isArray(e))return Tt(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 Tt(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)?Tt(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 Tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function Ct(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 Nt(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 Dt={p:Nt,P:function(e,t){var n,a=e.match(/(P+)(p+)?/)||[],r=a[1],i=a[2];if(!i)return Ct(e,t);switch(r){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}}",Ct(r,t)).replace("{{time}}",Nt(i,t))}},xt=12,Rt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;function Ot(e){var t=e?"string"==typeof e||e instanceof String?ct.default(e):ot.default(e):new Date;return Pt(t)?t:null}function At(e,t,n,a,r){var i=null,s=Jt(n)||Jt(Xt()),o=!0;return Array.isArray(t)?(t.forEach((function(t){var n=lt.default(e,t,new Date,{locale:s});a&&(o=Pt(n,r)&&e===fe.default(n,t,{awareOfUnicodeTokens:!0})),Pt(n,r)&&o&&(i=n)})),i):(i=lt.default(e,t,new Date,{locale:s}),a?o=Pt(i)&&e===fe.default(i,t,{awareOfUnicodeTokens:!0}):Pt(i)||(t=t.match(Rt).map((function(e){var t=e[0];return"p"===t||"P"===t?s?(0,Dt[t])(e,s.formatLong):t:e})).join(""),e.length>0&&(i=lt.default(e,t.slice(0,e.length),new Date)),Pt(i)||(i=new Date(e))),Pt(i)&&o?i:null)}function Pt(e,t){return t=t||new Date("1/1/1000"),he.default(e)&&!it.default(e,t)}function Mt(e,t,n){if("en"===n)return fe.default(e,t,{awareOfUnicodeTokens:!0});var a=Jt(n);return n&&!a&&console.warn('A locale object was not found for the provided string ["'.concat(n,'"].')),!a&&Xt()&&Jt(Xt())&&(a=Jt(Xt())),fe.default(e,t,{locale:a||null,awareOfUnicodeTokens:!0})}function Lt(e,t){var n=t.dateFormat,a=t.locale;return e&&Mt(e,Array.isArray(n)?n[0]:n,a)||""}function Ft(e,t){var n=t.hour,a=void 0===n?0:n,r=t.minute,i=void 0===r?0:r,s=t.second,o=void 0===s?0:s;return Fe.default(Le.default(Me.default(e,o),i),a)}function qt(e,t){var n=t&&Jt(t)||Xt()&&Jt(Xt());return xe.default(e,n?{locale:n}:null)}function $t(e,t){return Mt(e,"ddd",t)}function Ut(e){return He.default(e)}function jt(e,t,n){var a=Jt(t||Xt());return ze.default(e,{locale:a,weekStartsOn:n})}function Vt(e){return Ke.default(e)}function Wt(e){return Qe.default(e)}function Yt(e){return Ge.default(e)}function Bt(e,t){return e&&t?nt.default(e,t):!e&&!t}function Ht(e,t){return e&&t?tt.default(e,t):!e&&!t}function zt(e,t){return e&&t?at.default(e,t):!e&&!t}function Kt(e,t){return e&&t?et.default(e,t):!e&&!t}function Gt(e,t){return e&&t?Je.default(e,t):!e&&!t}function Qt(e,t,n){var a,r=He.default(t),i=Xe.default(n);try{a=st.default(e,{start:r,end:i})}catch(e){a=!1}return a}function Xt(){return("undefined"!=typeof window?window:n.g).__localeId__}function Jt(e){if("string"==typeof e){var t="undefined"!=typeof window?window:n.g;return t.__localeData__?t.__localeData__[e]:null}return e}function en(e,t){return Mt(qe.default(Ot(),e),"LLLL",t)}function tn(e,t){return Mt(qe.default(Ot(),e),"LLL",t)}function nn(e,t){return Mt($e.default(Ot(),e),"QQQ",t)}function an(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate,r=t.excludeDates,i=t.excludeDateIntervals,s=t.includeDates,o=t.includeDateIntervals,l=t.filterDate;return dn(e,{minDate:n,maxDate:a})||r&&r.some((function(t){return Kt(e,t)}))||i&&i.some((function(t){var n=t.start,a=t.end;return st.default(e,{start:n,end:a})}))||s&&!s.some((function(t){return Kt(e,t)}))||o&&!o.some((function(t){var n=t.start,a=t.end;return st.default(e,{start:n,end:a})}))||l&&!l(Ot(e))||!1}function rn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeDates,a=t.excludeDateIntervals;return a&&a.length>0?a.some((function(t){var n=t.start,a=t.end;return st.default(e,{start:n,end:a})})):n&&n.some((function(t){return Kt(e,t)}))||!1}function sn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate,r=t.excludeDates,i=t.includeDates,s=t.filterDate;return dn(e,{minDate:n,maxDate:a})||r&&r.some((function(t){return Ht(e,t)}))||i&&!i.some((function(t){return Ht(e,t)}))||s&&!s(Ot(e))||!1}function on(e,t,n,a){var r=Ae.default(e),i=Re.default(e),s=Ae.default(t),o=Re.default(t),l=Ae.default(a);return r===s&&r===l?i<=n&&n<=o:r<s?l===r&&i<=n||l===s&&o>=n||l<s&&l>r:void 0}function ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate,r=t.excludeDates,i=t.includeDates,s=t.filterDate;return dn(e,{minDate:n,maxDate:a})||r&&r.some((function(t){return zt(e,t)}))||i&&!i.some((function(t){return zt(e,t)}))||s&&!s(Ot(e))||!1}function cn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate;return dn(new Date(e,0,1),{minDate:n,maxDate:a})||!1}function un(e,t,n,a){var r=Ae.default(e),i=Oe.default(e),s=Ae.default(t),o=Oe.default(t),l=Ae.default(a);return r===s&&r===l?i<=n&&n<=o:r<s?l===r&&i<=n||l===s&&o>=n||l<s&&l>r:void 0}function dn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate;return n&&We.default(e,n)<0||a&&We.default(e,a)>0}function pn(e,t){return t.some((function(t){return Ce.default(t)===Ce.default(e)&&Te.default(t)===Te.default(e)}))}function mn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeTimes,a=t.includeTimes,r=t.filterTime;return n&&pn(e,n)||a&&!pn(e,a)||r&&!r(e)||!1}function hn(e,t){var n=t.minTime,a=t.maxTime;if(!n||!a)throw new Error("Both minTime and maxTime props required");var r,i=Ot(),s=Fe.default(Le.default(i,Te.default(e)),Ce.default(e)),o=Fe.default(Le.default(i,Te.default(n)),Ce.default(n)),l=Fe.default(Le.default(i,Te.default(a)),Ce.default(a));try{r=!st.default(s,{start:o,end:l})}catch(e){r=!1}return r}function fn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.includeDates,r=Ie.default(e,1);return n&&Ye.default(n,r)>0||a&&a.every((function(e){return Ye.default(e,r)>0}))||!1}function gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,a=t.includeDates,r=we.default(e,1);return n&&Ye.default(r,n)>0||a&&a.every((function(e){return Ye.default(r,e)>0}))||!1}function vn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.includeDates,r=Se.default(e,1);return n&&Be.default(n,r)>0||a&&a.every((function(e){return Be.default(e,r)>0}))||!1}function yn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,a=t.includeDates,r=_e.default(e,1);return n&&Be.default(r,n)>0||a&&a.every((function(e){return Be.default(r,e)>0}))||!1}function bn(e){var t=e.minDate,n=e.includeDates;if(n&&t){var a=n.filter((function(e){return We.default(e,t)>=0}));return je.default(a)}return n?je.default(n):t}function wn(e){var t=e.maxDate,n=e.includeDates;if(n&&t){var a=n.filter((function(e){return We.default(e,t)<=0}));return Ve.default(a)}return n?Ve.default(n):t}function _n(){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,a=0,r=e.length;a<r;a++){var i=e[a];if(me.default(i)){var s=Mt(i,"MM.dd.yyyy"),o=n.get(s)||[];o.includes(t)||(o.push(t),n.set(s,o))}else if("object"===ht(i)){var l=Object.keys(i),c=l[0],u=i[l[0]];if("string"==typeof c&&u.constructor===Array)for(var d=0,p=u.length;d<p;d++){var m=Mt(u[d],"MM.dd.yyyy"),h=n.get(m)||[];h.includes(c)||(h.push(c),n.set(m,h))}}}return n}function En(e,t,n,a,r){for(var i=r.length,s=[],o=0;o<i;o++){var l=ge.default(ve.default(e,Ce.default(r[o])),Te.default(r[o])),c=ge.default(e,(n+1)*a);rt.default(l,t)&&it.default(l,c)&&s.push(r[o])}return s}function Zn(e){return e<10?"0".concat(e):"".concat(e)}function In(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xt,n=Math.ceil(Ae.default(e)/t)*t;return{startPeriod:n-(t-1),endPeriod:n}}function Sn(e,t,n,a){for(var r=[],i=0;i<2*t+1;i++){var s=e+t-i,o=!0;n&&(o=Ae.default(n)<=s),a&&o&&(o=Ae.default(a)>=s),o&&r.push(s)}return r}var kn=function(e){wt(a,e);var n=St(a);function a(e){var r;ft(this,a),yt(Zt(r=n.call(this,e)),"renderOptions",(function(){var e=r.props.year,t=r.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:r.onChange.bind(Zt(r),t),"aria-selected":e===t?"true":void 0},e===t?de.default.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",t)})),n=r.props.minDate?Ae.default(r.props.minDate):null,a=r.props.maxDate?Ae.default(r.props.maxDate):null;return a&&r.state.yearsList.find((function(e){return e===a}))||t.unshift(de.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:r.incrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),n&&r.state.yearsList.find((function(e){return e===n}))||t.push(de.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:r.decrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t})),yt(Zt(r),"onChange",(function(e){r.props.onChange(e)})),yt(Zt(r),"handleClickOutside",(function(){r.props.onCancel()})),yt(Zt(r),"shiftYears",(function(e){var t=r.state.yearsList.map((function(t){return t+e}));r.setState({yearsList:t})})),yt(Zt(r),"incrementYears",(function(){return r.shiftYears(1)})),yt(Zt(r),"decrementYears",(function(){return r.shiftYears(-1)}));var i=e.yearDropdownItemNumber,s=e.scrollableYearDropdown,o=i||(s?10:5);return r.state={yearsList:Sn(r.props.year,o,r.props.minDate,r.props.maxDate)},r.dropdownRef=t.createRef(),r}return vt(a,[{key:"componentDidMount",value:function(){var e=this.dropdownRef.current;e&&(e.scrollTop=e.scrollHeight/2-e.clientHeight/2)}},{key:"render",value:function(){var e=pe.default({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return de.default.createElement("div",{className:e,ref:this.dropdownRef},this.renderOptions())}}]),a}(de.default.Component),Tn=ut.default(kn),Cn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{dropdownVisible:!1}),yt(Zt(e),"renderSelectOptions",(function(){for(var t=e.props.minDate?Ae.default(e.props.minDate):1900,n=e.props.maxDate?Ae.default(e.props.maxDate):2100,a=[],r=t;r<=n;r++)a.push(de.default.createElement("option",{key:r,value:r},r));return a})),yt(Zt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),yt(Zt(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:e.props.year,className:"react-datepicker__year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),yt(Zt(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))})),yt(Zt(e),"renderDropdown",(function(){return de.default.createElement(Tn,{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})})),yt(Zt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),yt(Zt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.year&&e.props.onChange(t)})),yt(Zt(e),"toggleDropdown",(function(t){e.setState({dropdownVisible:!e.state.dropdownVisible},(function(){e.props.adjustDateOnChange&&e.handleYearChange(e.props.date,t)}))})),yt(Zt(e),"handleYearChange",(function(t,n){e.onSelect(t,n),e.setOpen()})),yt(Zt(e),"onSelect",(function(t,n){e.props.onSelect&&e.props.onSelect(t,n)})),yt(Zt(e),"setOpen",(function(){e.props.setOpen&&e.props.setOpen(!0)})),e}return vt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return de.default.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},e)}}]),n}(de.default.Component),Nn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"isSelectedMonth",(function(t){return e.props.month===t})),yt(Zt(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(Zt(e),n),"aria-selected":e.isSelectedMonth(n)?"true":void 0},e.isSelectedMonth(n)?de.default.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",t)}))})),yt(Zt(e),"onChange",(function(t){return e.props.onChange(t)})),yt(Zt(e),"handleClickOutside",(function(){return e.props.onCancel()})),e}return vt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__month-dropdown"},this.renderOptions())}}]),n}(de.default.Component),Dn=ut.default(Nn),xn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{dropdownVisible:!1}),yt(Zt(e),"renderSelectOptions",(function(e){return e.map((function(e,t){return de.default.createElement("option",{key:t,value:t},e)}))})),yt(Zt(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))})),yt(Zt(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]))})),yt(Zt(e),"renderDropdown",(function(t){return de.default.createElement(Dn,{key:"dropdown",month:e.props.month,monthNames:t,onChange:e.onChange,onCancel:e.toggleDropdown})})),yt(Zt(e),"renderScrollMode",(function(t){var n=e.state.dropdownVisible,a=[e.renderReadView(!n,t)];return n&&a.unshift(e.renderDropdown(t)),a})),yt(Zt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.month&&e.props.onChange(t)})),yt(Zt(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return vt(n,[{key:"render",value:function(){var e,t=this,n=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(e){return tn(e,t.props.locale)}:function(e){return en(e,t.props.locale)});switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode(n);break;case"select":e=this.renderSelectMode(n)}return 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 Rn(e,t){for(var n=[],a=Vt(e),r=Vt(t);!rt.default(a,r);)n.push(Ot(a)),a=we.default(a,1);return n}var On=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),yt(Zt(a=t.call(this,e)),"renderOptions",(function(){return a.state.monthYearsList.map((function(e){var t=Pe.default(e),n=Bt(a.props.date,e)&&Ht(a.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:a.onChange.bind(Zt(a),t),"aria-selected":n?"true":void 0},n?de.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Mt(e,a.props.dateFormat,a.props.locale))}))})),yt(Zt(a),"onChange",(function(e){return a.props.onChange(e)})),yt(Zt(a),"handleClickOutside",(function(){a.props.onCancel()})),a.state={monthYearsList:Rn(a.props.minDate,a.props.maxDate)},a}return vt(n,[{key:"render",value:function(){var e=pe.default({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return de.default.createElement("div",{className:e},this.renderOptions())}}]),n}(de.default.Component),An=ut.default(On),Pn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{dropdownVisible:!1}),yt(Zt(e),"renderSelectOptions",(function(){for(var t=Vt(e.props.minDate),n=Vt(e.props.maxDate),a=[];!rt.default(t,n);){var r=Pe.default(t);a.push(de.default.createElement("option",{key:r,value:r},Mt(t,e.props.dateFormat,e.props.locale))),t=we.default(t,1)}return a})),yt(Zt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),yt(Zt(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:Pe.default(Vt(e.props.date)),className:"react-datepicker__month-year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),yt(Zt(e),"renderReadView",(function(t){var n=Mt(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))})),yt(Zt(e),"renderDropdown",(function(){return de.default.createElement(An,{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})})),yt(Zt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),yt(Zt(e),"onChange",(function(t){e.toggleDropdown();var n=Ot(parseInt(t));Bt(e.props.date,n)&&Ht(e.props.date,n)||e.props.onChange(n)})),yt(Zt(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return vt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return 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),Mn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"dayEl",de.default.createRef()),yt(Zt(e),"handleClick",(function(t){!e.isDisabled()&&e.props.onClick&&e.props.onClick(t)})),yt(Zt(e),"handleMouseEnter",(function(t){!e.isDisabled()&&e.props.onMouseEnter&&e.props.onMouseEnter(t)})),yt(Zt(e),"handleOnKeyDown",(function(t){" "===t.key&&(t.preventDefault(),t.key="Enter"),e.props.handleOnKeyDown(t)})),yt(Zt(e),"isSameDay",(function(t){return Kt(e.props.day,t)})),yt(Zt(e),"isKeyboardSelected",(function(){return!e.props.disabledKeyboardNavigation&&!e.isSameDay(e.props.selected)&&e.isSameDay(e.props.preSelection)})),yt(Zt(e),"isDisabled",(function(){return an(e.props.day,e.props)})),yt(Zt(e),"isExcluded",(function(){return rn(e.props.day,e.props)})),yt(Zt(e),"getHighLightedClass",(function(t){var n=e.props,a=n.day,r=n.highlightDates;if(!r)return!1;var i=Mt(a,"MM.dd.yyyy");return r.get(i)})),yt(Zt(e),"isInRange",(function(){var t=e.props,n=t.day,a=t.startDate,r=t.endDate;return!(!a||!r)&&Qt(n,a,r)})),yt(Zt(e),"isInSelectingRange",(function(){var t,n=e.props,a=n.day,r=n.selectsStart,i=n.selectsEnd,s=n.selectsRange,o=n.selectsDisabledDaysInRange,l=n.startDate,c=n.endDate,u=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return!(!(r||i||s)||!u||!o&&e.isDisabled())&&(r&&c&&(it.default(u,c)||Gt(u,c))?Qt(a,u,c):(i&&l&&(rt.default(u,l)||Gt(u,l))||!(!s||!l||c||!rt.default(u,l)&&!Gt(u,l)))&&Qt(a,l,u))})),yt(Zt(e),"isSelectingRangeStart",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,a=n.day,r=n.startDate,i=n.selectsStart,s=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Kt(a,i?s:r)})),yt(Zt(e),"isSelectingRangeEnd",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,a=n.day,r=n.endDate,i=n.selectsEnd,s=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Kt(a,i?s:r)})),yt(Zt(e),"isRangeStart",(function(){var t=e.props,n=t.day,a=t.startDate,r=t.endDate;return!(!a||!r)&&Kt(a,n)})),yt(Zt(e),"isRangeEnd",(function(){var t=e.props,n=t.day,a=t.startDate,r=t.endDate;return!(!a||!r)&&Kt(r,n)})),yt(Zt(e),"isWeekend",(function(){var t=Ne.default(e.props.day);return 0===t||6===t})),yt(Zt(e),"isAfterMonth",(function(){return void 0!==e.props.month&&(e.props.month+1)%12===Re.default(e.props.day)})),yt(Zt(e),"isBeforeMonth",(function(){return void 0!==e.props.month&&(Re.default(e.props.day)+1)%12===e.props.month})),yt(Zt(e),"isCurrentDay",(function(){return e.isSameDay(Ot())})),yt(Zt(e),"isSelected",(function(){return e.isSameDay(e.props.selected)})),yt(Zt(e),"getClassNames",(function(t){var n=e.props.dayClassName?e.props.dayClassName(t):void 0;return pe.default("react-datepicker__day",n,"react-datepicker__day--"+$t(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"))})),yt(Zt(e),"getAriaLabel",(function(){var t=e.props,n=t.day,a=t.ariaLabelPrefixWhenEnabled,r=void 0===a?"Choose":a,i=t.ariaLabelPrefixWhenDisabled,s=void 0===i?"Not available":i,o=e.isDisabled()||e.isExcluded()?s:r;return"".concat(o," ").concat(Mt(n,"PPPP",e.props.locale))})),yt(Zt(e),"getTabIndex",(function(t,n){var a=t||e.props.selected,r=n||e.props.preSelection;return e.isKeyboardSelected()||e.isSameDay(a)&&Kt(r,a)?0:-1})),yt(Zt(e),"handleFocusDay",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1;0===e.getTabIndex()&&!t.isInputFocused&&e.isSameDay(e.props.preSelection)&&(document.activeElement&&document.activeElement!==document.body||(n=!0),e.props.inline&&!e.props.shouldFocusDayInline&&(n=!1),e.props.containerRef&&e.props.containerRef.current&&e.props.containerRef.current.contains(document.activeElement)&&document.activeElement.classList.contains("react-datepicker__day")&&(n=!0)),n&&e.dayEl.current.focus({preventScroll:!0})})),yt(Zt(e),"renderDayContents",(function(){return e.props.monthShowsDuplicateDaysEnd&&e.isAfterMonth()||e.props.monthShowsDuplicateDaysStart&&e.isBeforeMonth()?null:e.props.renderDayContents?e.props.renderDayContents(De.default(e.props.day),e.props.day):De.default(e.props.day)})),yt(Zt(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:"button","aria-disabled":e.isDisabled(),"aria-current":e.isCurrentDay()?"date":void 0,"aria-selected":e.isSelected()?"true":void 0},e.renderDayContents())})),e}return vt(n,[{key:"componentDidMount",value:function(){this.handleFocusDay()}},{key:"componentDidUpdate",value:function(e){this.handleFocusDay(e)}}]),n}(de.default.Component),Ln=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"handleClick",(function(t){e.props.onClick&&e.props.onClick(t)})),e}return vt(n,[{key:"render",value:function(){var e=this.props,t=e.weekNumber,n=e.ariaLabelPrefix,a=void 0===n?"week ":n,r={"react-datepicker__week-number":!0,"react-datepicker__week-number--clickable":!!e.onClick};return de.default.createElement("div",{className:pe.default(r),"aria-label":"".concat(a," ").concat(this.props.weekNumber),onClick:this.handleClick},t)}}]),n}(de.default.Component),Fn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n)})),yt(Zt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),yt(Zt(e),"handleWeekClick",(function(t,n,a){"function"==typeof e.props.onWeekSelect&&e.props.onWeekSelect(t,n,a),e.props.shouldCloseOnSelect&&e.props.setOpen(!1)})),yt(Zt(e),"formatWeekNumber",(function(t){return e.props.formatWeekNumber?e.props.formatWeekNumber(t):qt(t)})),yt(Zt(e),"renderDays",(function(){var t=jt(e.props.day,e.props.locale,e.props.calendarStartDay),n=[],a=e.formatWeekNumber(t);if(e.props.showWeekNumber){var r=e.props.onWeekSelect?e.handleWeekClick.bind(Zt(e),t,a):void 0;n.push(de.default.createElement(Ln,{key:"W",weekNumber:a,onClick:r,ariaLabelPrefix:e.props.ariaLabelPrefix}))}return n.concat([0,1,2,3,4,5,6].map((function(n){var a=ye.default(t,n);return de.default.createElement(Mn,{ariaLabelPrefixWhenEnabled:e.props.chooseDayAriaLabelPrefix,ariaLabelPrefixWhenDisabled:e.props.disabledDayAriaLabelPrefix,key:a.valueOf(),day:a,month:e.props.month,onClick:e.handleDayClick.bind(Zt(e),a),onMouseEnter:e.handleDayMouseEnter.bind(Zt(e),a),minDate:e.props.minDate,maxDate:e.props.maxDate,excludeDates:e.props.excludeDates,excludeDateIntervals:e.props.excludeDateIntervals,includeDates:e.props.includeDates,includeDateIntervals:e.props.includeDateIntervals,highlightDates:e.props.highlightDates,selectingDate:e.props.selectingDate,filterDate:e.props.filterDate,preSelection:e.props.preSelection,selected:e.props.selected,selectsStart:e.props.selectsStart,selectsEnd:e.props.selectsEnd,selectsRange:e.props.selectsRange,selectsDisabledDaysInRange:e.props.selectsDisabledDaysInRange,startDate:e.props.startDate,endDate:e.props.endDate,dayClassName:e.props.dayClassName,renderDayContents:e.props.renderDayContents,disabledKeyboardNavigation:e.props.disabledKeyboardNavigation,handleOnKeyDown:e.props.handleOnKeyDown,isInputFocused:e.props.isInputFocused,containerRef:e.props.containerRef,inline:e.props.inline,shouldFocusDayInline:e.props.shouldFocusDayInline,monthShowsDuplicateDaysEnd:e.props.monthShowsDuplicateDaysEnd,monthShowsDuplicateDaysStart:e.props.monthShowsDuplicateDaysStart,locale:e.props.locale})})))})),e}return vt(n,[{key:"render",value:function(){return de.default.createElement("div",{className:"react-datepicker__week"},this.renderDays())}}],[{key:"defaultProps",get:function(){return{shouldCloseOnSelect:!0}}}]),n}(de.default.Component),qn=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"MONTH_REFS",kt(Array(12)).map((function(){return de.default.createRef()}))),yt(Zt(e),"isDisabled",(function(t){return an(t,e.props)})),yt(Zt(e),"isExcluded",(function(t){return rn(t,e.props)})),yt(Zt(e),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n,e.props.orderInDisplay)})),yt(Zt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),yt(Zt(e),"handleMouseLeave",(function(){e.props.onMouseLeave&&e.props.onMouseLeave()})),yt(Zt(e),"isRangeStartMonth",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate;return!(!r||!i)&&Ht(qe.default(a,t),r)})),yt(Zt(e),"isRangeStartQuarter",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate;return!(!r||!i)&&zt($e.default(a,t),r)})),yt(Zt(e),"isRangeEndMonth",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate;return!(!r||!i)&&Ht(qe.default(a,t),i)})),yt(Zt(e),"isRangeEndQuarter",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate;return!(!r||!i)&&zt($e.default(a,t),i)})),yt(Zt(e),"isWeekInMonth",(function(t){var n=e.props.day,a=ye.default(t,6);return Ht(t,n)||Ht(a,n)})),yt(Zt(e),"isCurrentMonth",(function(e,t){return Ae.default(e)===Ae.default(Ot())&&t===Re.default(Ot())})),yt(Zt(e),"isSelectedMonth",(function(e,t,n){return Re.default(e)===t&&Ae.default(e)===Ae.default(n)})),yt(Zt(e),"isSelectedQuarter",(function(e,t,n){return Oe.default(e)===t&&Ae.default(e)===Ae.default(n)})),yt(Zt(e),"renderWeeks",(function(){for(var t=[],n=e.props.fixedHeight,a=0,r=!1,i=jt(Vt(e.props.day),e.props.locale,e.props.calendarStartDay);t.push(de.default.createElement(Fn,{ariaLabelPrefix:e.props.weekAriaLabelPrefix,chooseDayAriaLabelPrefix:e.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:e.props.disabledDayAriaLabelPrefix,key:a,day:i,month:Re.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})),!r;){a++,i=be.default(i,1);var s=n&&a>=6,o=!n&&!e.isWeekInMonth(i);if(s||o){if(!e.props.peekNextMonth)break;r=!0}}return t})),yt(Zt(e),"onMonthClick",(function(t,n){e.handleDayClick(Vt(qe.default(e.props.day,n)),t)})),yt(Zt(e),"handleMonthNavigation",(function(t,n){e.isDisabled(n)||e.isExcluded(n)||(e.props.setPreSelection(n),e.MONTH_REFS[t].current&&e.MONTH_REFS[t].current.focus())})),yt(Zt(e),"onMonthKeyDown",(function(t,n){var a=t.key;if(!e.props.disabledKeyboardNavigation)switch(a){case"Enter":e.onMonthClick(t,n),e.props.setPreSelection(e.props.selected);break;case"ArrowRight":e.handleMonthNavigation(11===n?0:n+1,we.default(e.props.preSelection,1));break;case"ArrowLeft":e.handleMonthNavigation(0===n?11:n-1,Ie.default(e.props.preSelection,1))}})),yt(Zt(e),"onQuarterClick",(function(t,n){e.handleDayClick(Yt($e.default(e.props.day,n)),t)})),yt(Zt(e),"getMonthClassNames",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate,s=n.selected,o=n.minDate,l=n.maxDate,c=n.preSelection,u=n.monthClassName,d=u?u(a):void 0;return pe.default("react-datepicker__month-text","react-datepicker__month-".concat(t),d,{"react-datepicker__month--disabled":(o||l)&&sn(qe.default(a,t),e.props),"react-datepicker__month--selected":e.isSelectedMonth(a,t,s),"react-datepicker__month-text--keyboard-selected":Re.default(c)===t,"react-datepicker__month--in-range":on(r,i,t,a),"react-datepicker__month--range-start":e.isRangeStartMonth(t),"react-datepicker__month--range-end":e.isRangeEndMonth(t),"react-datepicker__month-text--today":e.isCurrentMonth(a,t)})})),yt(Zt(e),"getTabIndex",(function(t){var n=Re.default(e.props.preSelection);return e.props.disabledKeyboardNavigation||t!==n?"-1":"0"})),yt(Zt(e),"getAriaLabel",(function(t){var n=e.props,a=n.ariaLabelPrefix,r=void 0===a?"Choose":a,i=n.disabledDayAriaLabelPrefix,s=void 0===i?"Not available":i,o=n.day,l=qe.default(o,t),c=e.isDisabled(l)||e.isExcluded(l)?s:r;return"".concat(c," ").concat(Mt(l,"MMMM yyyy"))})),yt(Zt(e),"getQuarterClassNames",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate,s=n.selected,o=n.minDate,l=n.maxDate;return pe.default("react-datepicker__quarter-text","react-datepicker__quarter-".concat(t),{"react-datepicker__quarter--disabled":(o||l)&&ln($e.default(a,t),e.props),"react-datepicker__quarter--selected":e.isSelectedQuarter(a,t,s),"react-datepicker__quarter--in-range":un(r,i,t,a),"react-datepicker__quarter--range-start":e.isRangeStartQuarter(t),"react-datepicker__quarter--range-end":e.isRangeEndQuarter(t)})})),yt(Zt(e),"renderMonths",(function(){var t=e.props,n=t.showFullMonthYearPicker,a=t.showTwoColumnMonthYearPicker,r=t.showFourColumnMonthYearPicker,i=t.locale,s=t.day,o=t.selected;return(r?[[0,1,2,3],[4,5,6,7],[8,9,10,11]]:a?[[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,a){return de.default.createElement("div",{className:"react-datepicker__month-wrapper",key:a},t.map((function(t,a){return de.default.createElement("div",{ref:e.MONTH_REFS[t],key:a,onClick:function(n){e.onMonthClick(n,t)},onKeyDown:function(n){e.onMonthKeyDown(n,t)},tabIndex:e.getTabIndex(t),className:e.getMonthClassNames(t),role:"button","aria-label":e.getAriaLabel(t),"aria-current":e.isCurrentMonth(s,t)?"date":void 0,"aria-selected":e.isSelectedMonth(s,t,o)?"true":void 0},n?en(t,i):tn(t,i))})))}))})),yt(Zt(e),"renderQuarters",(function(){var t=e.props,n=t.day,a=t.selected;return de.default.createElement("div",{className:"react-datepicker__quarter-wrapper"},[1,2,3,4].map((function(t,r){return de.default.createElement("div",{key:r,onClick:function(n){e.onQuarterClick(n,t)},className:e.getQuarterClassNames(t),"aria-selected":e.isSelectedQuarter(n,t,a)?"true":void 0},nn(t,e.props.locale))})))})),yt(Zt(e),"getClassNames",(function(){var t=e.props;t.day;var n=t.selectingDate,a=t.selectsStart,r=t.selectsEnd,i=t.showMonthYearPicker,s=t.showQuarterYearPicker;return pe.default("react-datepicker__month",{"react-datepicker__month--selecting-range":n&&(a||r)},{"react-datepicker__monthPicker":i},{"react-datepicker__quarterPicker":s})})),e}return vt(n,[{key:"render",value:function(){var e=this.props,t=e.showMonthYearPicker,n=e.showQuarterYearPicker,a=e.day,r=e.ariaLabelPrefix,i=void 0===r?"month ":r;return de.default.createElement("div",{className:this.getClassNames(),onMouseLeave:this.handleMouseLeave,"aria-label":"".concat(i," ").concat(Mt(a,"yyyy-MM"))},t?this.renderMonths():n?this.renderQuarters():this.renderWeeks())}}]),n}(de.default.Component),$n=function(e){wt(n,e);var t=St(n);function n(){var e;ft(this,n);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return yt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{height:null}),yt(Zt(e),"handleClick",(function(t){(e.props.minTime||e.props.maxTime)&&hn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&mn(t,e.props)||e.props.onChange(t)})),yt(Zt(e),"isSelectedTime",(function(t,n,a){return e.props.selected&&n===Ce.default(t)&&a===Te.default(t)})),yt(Zt(e),"liClasses",(function(t,n,a){var r=["react-datepicker__time-list-item",e.props.timeClassName?e.props.timeClassName(t,n,a):void 0];return e.isSelectedTime(t,n,a)&&r.push("react-datepicker__time-list-item--selected"),((e.props.minTime||e.props.maxTime)&&hn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&mn(t,e.props))&&r.push("react-datepicker__time-list-item--disabled"),e.props.injectTimes&&(60*Ce.default(t)+Te.default(t))%e.props.intervals!=0&&r.push("react-datepicker__time-list-item--injected"),r.join(" ")})),yt(Zt(e),"handleOnKeyDown",(function(t,n){" "===t.key&&(t.preventDefault(),t.key="Enter"),"Enter"===t.key&&e.handleClick(n),e.props.handleOnKeyDown(t)})),yt(Zt(e),"renderTimes",(function(){for(var t=[],n=e.props.format?e.props.format:"p",a=e.props.intervals,r=Ut(Ot(e.props.selected)),i=1440/a,s=e.props.injectTimes&&e.props.injectTimes.sort((function(e,t){return e-t})),o=e.props.selected||e.props.openToDate||Ot(),l=Ce.default(o),c=Te.default(o),u=Fe.default(Le.default(r,c),l),d=0;d<i;d++){var p=ge.default(r,d*a);if(t.push(p),s){var m=En(r,p,d,a,s);t=t.concat(m)}}return t.map((function(t,a){return de.default.createElement("li",{key:a,onClick:e.handleClick.bind(Zt(e),t),className:e.liClasses(t,l,c),ref:function(n){(it.default(t,u)||Gt(t,u))&&(e.centerLi=n)},onKeyDown:function(n){e.handleOnKeyDown(n,t)},tabIndex:"0","aria-selected":e.isSelectedTime(t,l,c)?"true":void 0},Mt(t,n,e.props.locale))}))})),e}return vt(n,[{key:"componentDidMount",value:function(){this.list.scrollTop=n.calcCenterPosition(this.props.monthRef?this.props.monthRef.clientHeight-this.header.clientHeight:this.list.clientHeight,this.centerLi),this.props.monthRef&&this.header&&this.setState({height:this.props.monthRef.clientHeight-this.header.clientHeight})}},{key:"render",value:function(){var e=this,t=this.state.height;return 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);yt($n,"calcCenterPosition",(function(e,t){return t.offsetTop-(e/2-t.clientHeight/2)}));var Un=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),yt(Zt(a=t.call(this,e)),"YEAR_REFS",kt(Array(a.props.yearItemNumber)).map((function(){return de.default.createRef()}))),yt(Zt(a),"isDisabled",(function(e){return an(e,a.props)})),yt(Zt(a),"isExcluded",(function(e){return rn(e,a.props)})),yt(Zt(a),"updateFocusOnPaginate",(function(e){var t=function(){this.YEAR_REFS[e].current.focus()}.bind(Zt(a));window.requestAnimationFrame(t)})),yt(Zt(a),"handleYearClick",(function(e,t){a.props.onDayClick&&a.props.onDayClick(e,t)})),yt(Zt(a),"handleYearNavigation",(function(e,t){var n=a.props,r=n.date,i=n.yearItemNumber,s=In(r,i).startPeriod;a.isDisabled(t)||a.isExcluded(t)||(a.props.setPreSelection(t),e-s==-1?a.updateFocusOnPaginate(i-1):e-s===i?a.updateFocusOnPaginate(0):a.YEAR_REFS[e-s].current.focus())})),yt(Zt(a),"isSameDay",(function(e,t){return Kt(e,t)})),yt(Zt(a),"isCurrentYear",(function(e){return e===Ae.default(Ot())})),yt(Zt(a),"isKeyboardSelected",(function(e){var t=Wt(Ue.default(a.props.date,e));return!a.props.disabledKeyboardNavigation&&!a.props.inline&&!Kt(t,Wt(a.props.selected))&&Kt(t,Wt(a.props.preSelection))})),yt(Zt(a),"onYearClick",(function(e,t){var n=a.props.date;a.handleYearClick(Wt(Ue.default(n,t)),e)})),yt(Zt(a),"onYearKeyDown",(function(e,t){var n=e.key;if(!a.props.disabledKeyboardNavigation)switch(n){case"Enter":a.onYearClick(e,t),a.props.setPreSelection(a.props.selected);break;case"ArrowRight":a.handleYearNavigation(t+1,_e.default(a.props.preSelection,1));break;case"ArrowLeft":a.handleYearNavigation(t-1,Se.default(a.props.preSelection,1))}})),yt(Zt(a),"getYearClassNames",(function(e){var t=a.props,n=t.minDate,r=t.maxDate,i=t.selected;return pe.default("react-datepicker__year-text",{"react-datepicker__year-text--selected":e===Ae.default(i),"react-datepicker__year-text--disabled":(n||r)&&cn(e,a.props),"react-datepicker__year-text--keyboard-selected":a.isKeyboardSelected(e),"react-datepicker__year-text--today":a.isCurrentYear(e)})})),yt(Zt(a),"getYearTabIndex",(function(e){return a.props.disabledKeyboardNavigation?"-1":e===Ae.default(a.props.preSelection)?"0":"-1"})),a}return vt(n,[{key:"render",value:function(){for(var e=this,t=[],n=this.props,a=In(n.date,n.yearItemNumber),r=a.startPeriod,i=a.endPeriod,s=function(n){t.push(de.default.createElement("div",{ref:e.YEAR_REFS[n-r],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=r;o<=i;o++)s(o);return de.default.createElement("div",{className:"react-datepicker__year"},de.default.createElement("div",{className:"react-datepicker__year-wrapper"},t))}}]),n}(de.default.Component),jn=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),yt(Zt(a=t.call(this,e)),"onTimeChange",(function(e){a.setState({time:e});var t=new Date;t.setHours(e.split(":")[0]),t.setMinutes(e.split(":")[1]),a.props.onChange(t)})),yt(Zt(a),"renderTimeInput",(function(){var e=a.state.time,t=a.props,n=t.date,r=t.timeString,i=t.customTimeInput;return i?de.default.cloneElement(i,{date:n,value:e,onChange:a.onTimeChange}):de.default.createElement("input",{type:"time",className:"react-datepicker-time__input",placeholder:"Time",name:"time-input",required:!0,value:e,onChange:function(e){a.onTimeChange(e.target.value||r)}})})),a.state={time:a.props.timeString},a}return vt(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 Vn(e){var t=e.className,n=e.children,a=e.showPopperArrow,r=e.arrowProps,i=void 0===r?{}:r;return de.default.createElement("div",{className:t},a&&de.default.createElement("div",bt({className:"react-datepicker__triangle"},i)),n)}var Wn=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],Yn=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),yt(Zt(a=t.call(this,e)),"handleClickOutside",(function(e){a.props.onClickOutside(e)})),yt(Zt(a),"setClickOutsideRef",(function(){return a.containerRef.current})),yt(Zt(a),"handleDropdownFocus",(function(e){(function(){var e=((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).className||"").split(/\s+/);return Wn.some((function(t){return e.indexOf(t)>=0}))})(e.target)&&a.props.onDropdownFocus()})),yt(Zt(a),"getDateInView",(function(){var e=a.props,t=e.preSelection,n=e.selected,r=e.openToDate,i=bn(a.props),s=wn(a.props),o=Ot();return r||n||t||(i&&it.default(o,i)?i:s&&rt.default(o,s)?s:o)})),yt(Zt(a),"increaseMonth",(function(){a.setState((function(e){var t=e.date;return{date:we.default(t,1)}}),(function(){return a.handleMonthChange(a.state.date)}))})),yt(Zt(a),"decreaseMonth",(function(){a.setState((function(e){var t=e.date;return{date:Ie.default(t,1)}}),(function(){return a.handleMonthChange(a.state.date)}))})),yt(Zt(a),"handleDayClick",(function(e,t,n){a.props.onSelect(e,t,n),a.props.setPreSelection&&a.props.setPreSelection(e)})),yt(Zt(a),"handleDayMouseEnter",(function(e){a.setState({selectingDate:e}),a.props.onDayMouseEnter&&a.props.onDayMouseEnter(e)})),yt(Zt(a),"handleMonthMouseLeave",(function(){a.setState({selectingDate:null}),a.props.onMonthMouseLeave&&a.props.onMonthMouseLeave()})),yt(Zt(a),"handleYearChange",(function(e){a.props.onYearChange&&a.props.onYearChange(e),a.props.adjustDateOnChange&&(a.props.onSelect&&a.props.onSelect(e),a.props.setOpen&&a.props.setOpen(!0)),a.props.setPreSelection&&a.props.setPreSelection(e)})),yt(Zt(a),"handleMonthChange",(function(e){a.props.onMonthChange&&a.props.onMonthChange(e),a.props.adjustDateOnChange&&(a.props.onSelect&&a.props.onSelect(e),a.props.setOpen&&a.props.setOpen(!0)),a.props.setPreSelection&&a.props.setPreSelection(e)})),yt(Zt(a),"handleMonthYearChange",(function(e){a.handleYearChange(e),a.handleMonthChange(e)})),yt(Zt(a),"changeYear",(function(e){a.setState((function(t){var n=t.date;return{date:Ue.default(n,e)}}),(function(){return a.handleYearChange(a.state.date)}))})),yt(Zt(a),"changeMonth",(function(e){a.setState((function(t){var n=t.date;return{date:qe.default(n,e)}}),(function(){return a.handleMonthChange(a.state.date)}))})),yt(Zt(a),"changeMonthYear",(function(e){a.setState((function(t){var n=t.date;return{date:Ue.default(qe.default(n,Re.default(e)),Ae.default(e))}}),(function(){return a.handleMonthYearChange(a.state.date)}))})),yt(Zt(a),"header",(function(){var e=jt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.state.date,a.props.locale,a.props.calendarStartDay),t=[];return a.props.showWeekNumbers&&t.push(de.default.createElement("div",{key:"W",className:"react-datepicker__day-name"},a.props.weekLabel||"#")),t.concat([0,1,2,3,4,5,6].map((function(t){var n=ye.default(e,t),r=a.formatWeekday(n,a.props.locale),i=a.props.weekDayClassName?a.props.weekDayClassName(n):void 0;return de.default.createElement("div",{key:t,className:pe.default("react-datepicker__day-name",i)},r)})))})),yt(Zt(a),"formatWeekday",(function(e,t){return a.props.formatWeekDay?function(e,t,n){return t(Mt(e,"EEEE",n))}(e,a.props.formatWeekDay,t):a.props.useWeekdaysShort?function(e,t){return Mt(e,"EEE",t)}(e,t):function(e,t){return Mt(e,"EEEEEE",t)}(e,t)})),yt(Zt(a),"decreaseYear",(function(){a.setState((function(e){var t=e.date;return{date:Se.default(t,a.props.showYearPicker?a.props.yearItemNumber:1)}}),(function(){return a.handleYearChange(a.state.date)}))})),yt(Zt(a),"renderPreviousButton",(function(){if(!a.props.renderCustomHeader){var e;switch(!0){case a.props.showMonthYearPicker:e=vn(a.state.date,a.props);break;case a.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.yearItemNumber,r=void 0===a?xt:a,i=In(Wt(Se.default(e,r)),r).endPeriod,s=n&&Ae.default(n);return s&&s>i||!1}(a.state.date,a.props);break;default:e=fn(a.state.date,a.props)}if((a.props.forceShowMonthNavigation||a.props.showDisabledMonthNavigation||!e)&&!a.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--previous"],n=a.decreaseMonth;(a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker)&&(n=a.decreaseYear),e&&a.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--previous--disabled"),n=null);var r=a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker,i=a.props,s=i.previousMonthButtonLabel,o=i.previousYearButtonLabel,l=a.props,c=l.previousMonthAriaLabel,u=void 0===c?"string"==typeof s?s:"Previous Month":c,d=l.previousYearAriaLabel,p=void 0===d?"string"==typeof o?o:"Previous Year":d;return de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:a.props.handleOnKeyDown,"aria-label":r?p:u},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"].join(" ")},r?a.props.previousYearButtonLabel:a.props.previousMonthButtonLabel))}}})),yt(Zt(a),"increaseYear",(function(){a.setState((function(e){var t=e.date;return{date:_e.default(t,a.props.showYearPicker?a.props.yearItemNumber:1)}}),(function(){return a.handleYearChange(a.state.date)}))})),yt(Zt(a),"renderNextButton",(function(){if(!a.props.renderCustomHeader){var e;switch(!0){case a.props.showMonthYearPicker:e=yn(a.state.date,a.props);break;case a.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,a=t.yearItemNumber,r=void 0===a?xt:a,i=In(_e.default(e,r),r).startPeriod,s=n&&Ae.default(n);return s&&s<i||!1}(a.state.date,a.props);break;default:e=gn(a.state.date,a.props)}if((a.props.forceShowMonthNavigation||a.props.showDisabledMonthNavigation||!e)&&!a.props.showTimeSelectOnly){var t=["react-datepicker__navigation","react-datepicker__navigation--next"];a.props.showTimeSelect&&t.push("react-datepicker__navigation--next--with-time"),a.props.todayButton&&t.push("react-datepicker__navigation--next--with-today-button");var n=a.increaseMonth;(a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker)&&(n=a.increaseYear),e&&a.props.showDisabledMonthNavigation&&(t.push("react-datepicker__navigation--next--disabled"),n=null);var r=a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker,i=a.props,s=i.nextMonthButtonLabel,o=i.nextYearButtonLabel,l=a.props,c=l.nextMonthAriaLabel,u=void 0===c?"string"==typeof s?s:"Next Month":c,d=l.nextYearAriaLabel,p=void 0===d?"string"==typeof o?o:"Next Year":d;return de.default.createElement("button",{type:"button",className:t.join(" "),onClick:n,onKeyDown:a.props.handleOnKeyDown,"aria-label":r?p:u},de.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"].join(" ")},r?a.props.nextYearButtonLabel:a.props.nextMonthButtonLabel))}}})),yt(Zt(a),"renderCurrentMonth",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.state.date,t=["react-datepicker__current-month"];return a.props.showYearDropdown&&t.push("react-datepicker__current-month--hasYearDropdown"),a.props.showMonthDropdown&&t.push("react-datepicker__current-month--hasMonthDropdown"),a.props.showMonthYearDropdown&&t.push("react-datepicker__current-month--hasMonthYearDropdown"),de.default.createElement("div",{className:t.join(" ")},Mt(e,a.props.dateFormat,a.props.locale))})),yt(Zt(a),"renderYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showYearDropdown&&!e)return de.default.createElement(Cn,{adjustDateOnChange:a.props.adjustDateOnChange,date:a.state.date,onSelect:a.props.onSelect,setOpen:a.props.setOpen,dropdownMode:a.props.dropdownMode,onChange:a.changeYear,minDate:a.props.minDate,maxDate:a.props.maxDate,year:Ae.default(a.state.date),scrollableYearDropdown:a.props.scrollableYearDropdown,yearDropdownItemNumber:a.props.yearDropdownItemNumber})})),yt(Zt(a),"renderMonthDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showMonthDropdown&&!e)return de.default.createElement(xn,{dropdownMode:a.props.dropdownMode,locale:a.props.locale,onChange:a.changeMonth,month:Re.default(a.state.date),useShortMonthInDropdown:a.props.useShortMonthInDropdown})})),yt(Zt(a),"renderMonthYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showMonthYearDropdown&&!e)return de.default.createElement(Pn,{dropdownMode:a.props.dropdownMode,locale:a.props.locale,dateFormat:a.props.dateFormat,onChange:a.changeMonthYear,minDate:a.props.minDate,maxDate:a.props.maxDate,date:a.state.date,scrollableMonthYearDropdown:a.props.scrollableMonthYearDropdown})})),yt(Zt(a),"renderTodayButton",(function(){if(a.props.todayButton&&!a.props.showTimeSelectOnly)return de.default.createElement("div",{className:"react-datepicker__today-button",onClick:function(e){return a.props.onSelect(He.default(Ot()),e)}},a.props.todayButton)})),yt(Zt(a),"renderDefaultHeader",(function(e){var t=e.monthDate,n=e.i;return de.default.createElement("div",{className:"react-datepicker__header ".concat(a.props.showTimeSelect?"react-datepicker__header--has-time-select":"")},a.renderCurrentMonth(t),de.default.createElement("div",{className:"react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(a.props.dropdownMode),onFocus:a.handleDropdownFocus},a.renderMonthDropdown(0!==n),a.renderMonthYearDropdown(0!==n),a.renderYearDropdown(0!==n)),de.default.createElement("div",{className:"react-datepicker__day-names"},a.header(t)))})),yt(Zt(a),"renderCustomHeader",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.monthDate,n=e.i;if(a.props.showTimeSelect&&!a.state.monthContainer||a.props.showTimeSelectOnly)return null;var r=fn(a.state.date,a.props),i=gn(a.state.date,a.props),s=vn(a.state.date,a.props),o=yn(a.state.date,a.props),l=!a.props.showMonthYearPicker&&!a.props.showQuarterYearPicker&&!a.props.showYearPicker;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:a.props.onDropdownFocus},a.props.renderCustomHeader(mt(mt({},a.state),{},{customHeaderCount:n,monthDate:t,changeMonth:a.changeMonth,changeYear:a.changeYear,decreaseMonth:a.decreaseMonth,increaseMonth:a.increaseMonth,decreaseYear:a.decreaseYear,increaseYear:a.increaseYear,prevMonthButtonDisabled:r,nextMonthButtonDisabled:i,prevYearButtonDisabled:s,nextYearButtonDisabled:o})),l&&de.default.createElement("div",{className:"react-datepicker__day-names"},a.header(t)))})),yt(Zt(a),"renderYearHeader",(function(){var e=a.state.date,t=a.props,n=t.showYearPicker,r=In(e,t.yearItemNumber),i=r.startPeriod,s=r.endPeriod;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},n?"".concat(i," - ").concat(s):Ae.default(e))})),yt(Zt(a),"renderHeader",(function(e){switch(!0){case void 0!==a.props.renderCustomHeader:return a.renderCustomHeader(e);case a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker:return a.renderYearHeader(e);default:return a.renderDefaultHeader(e)}})),yt(Zt(a),"renderMonths",(function(){if(!a.props.showTimeSelectOnly&&!a.props.showYearPicker){for(var e=[],t=a.props.showPreviousMonths?a.props.monthsShown-1:0,n=Ie.default(a.state.date,t),r=0;r<a.props.monthsShown;++r){var i=r-a.props.monthSelectedIn,s=we.default(n,i),o="month-".concat(r),l=r<a.props.monthsShown-1,c=r>0;e.push(de.default.createElement("div",{key:o,ref:function(e){a.monthContainer=e},className:"react-datepicker__month-container"},a.renderHeader({monthDate:s,i:r}),de.default.createElement(qn,{chooseDayAriaLabelPrefix:a.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:a.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:a.props.weekAriaLabelPrefix,onChange:a.changeMonthYear,day:s,dayClassName:a.props.dayClassName,calendarStartDay:a.props.calendarStartDay,monthClassName:a.props.monthClassName,onDayClick:a.handleDayClick,handleOnKeyDown:a.props.handleOnDayKeyDown,onDayMouseEnter:a.handleDayMouseEnter,onMouseLeave:a.handleMonthMouseLeave,onWeekSelect:a.props.onWeekSelect,orderInDisplay:r,formatWeekNumber:a.props.formatWeekNumber,locale:a.props.locale,minDate:a.props.minDate,maxDate:a.props.maxDate,excludeDates:a.props.excludeDates,excludeDateIntervals:a.props.excludeDateIntervals,highlightDates:a.props.highlightDates,selectingDate:a.state.selectingDate,includeDates:a.props.includeDates,includeDateIntervals:a.props.includeDateIntervals,inline:a.props.inline,shouldFocusDayInline:a.props.shouldFocusDayInline,fixedHeight:a.props.fixedHeight,filterDate:a.props.filterDate,preSelection:a.props.preSelection,setPreSelection:a.props.setPreSelection,selected:a.props.selected,selectsStart:a.props.selectsStart,selectsEnd:a.props.selectsEnd,selectsRange:a.props.selectsRange,selectsDisabledDaysInRange:a.props.selectsDisabledDaysInRange,showWeekNumbers:a.props.showWeekNumbers,startDate:a.props.startDate,endDate:a.props.endDate,peekNextMonth:a.props.peekNextMonth,setOpen:a.props.setOpen,shouldCloseOnSelect:a.props.shouldCloseOnSelect,renderDayContents:a.props.renderDayContents,disabledKeyboardNavigation:a.props.disabledKeyboardNavigation,showMonthYearPicker:a.props.showMonthYearPicker,showFullMonthYearPicker:a.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:a.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:a.props.showFourColumnMonthYearPicker,showYearPicker:a.props.showYearPicker,showQuarterYearPicker:a.props.showQuarterYearPicker,isInputFocused:a.props.isInputFocused,containerRef:a.containerRef,monthShowsDuplicateDaysEnd:l,monthShowsDuplicateDaysStart:c})))}return e}})),yt(Zt(a),"renderYears",(function(){if(!a.props.showTimeSelectOnly)return a.props.showYearPicker?de.default.createElement("div",{className:"react-datepicker__year--container"},a.renderHeader(),de.default.createElement(Un,bt({onDayClick:a.handleDayClick,date:a.state.date},a.props))):void 0})),yt(Zt(a),"renderTimeSection",(function(){if(a.props.showTimeSelect&&(a.state.monthContainer||a.props.showTimeSelectOnly))return de.default.createElement($n,{selected:a.props.selected,openToDate:a.props.openToDate,onChange:a.props.onTimeChange,timeClassName:a.props.timeClassName,format:a.props.timeFormat,includeTimes:a.props.includeTimes,intervals:a.props.timeIntervals,minTime:a.props.minTime,maxTime:a.props.maxTime,excludeTimes:a.props.excludeTimes,filterTime:a.props.filterTime,timeCaption:a.props.timeCaption,todayButton:a.props.todayButton,showMonthDropdown:a.props.showMonthDropdown,showMonthYearDropdown:a.props.showMonthYearDropdown,showYearDropdown:a.props.showYearDropdown,withPortal:a.props.withPortal,monthRef:a.state.monthContainer,injectTimes:a.props.injectTimes,locale:a.props.locale,handleOnKeyDown:a.props.handleOnKeyDown,showTimeSelectOnly:a.props.showTimeSelectOnly})})),yt(Zt(a),"renderInputTimeSection",(function(){var e=new Date(a.props.selected),t=Pt(e)&&Boolean(a.props.selected)?"".concat(Zn(e.getHours()),":").concat(Zn(e.getMinutes())):"";if(a.props.showTimeInput)return de.default.createElement(jn,{date:e,timeString:t,timeInputLabel:a.props.timeInputLabel,onChange:a.props.onTimeChange,customTimeInput:a.props.customTimeInput})})),a.containerRef=de.default.createRef(),a.state={date:a.getDateInView(),selectingDate:null,monthContainer:null},a}return vt(n,[{key:"componentDidMount",value:function(){this.props.showTimeSelect&&(this.assignMonthContainer=void this.setState({monthContainer:this.monthContainer}))}},{key:"componentDidUpdate",value:function(e){this.props.preSelection&&!Kt(this.props.preSelection,e.preSelection)?this.setState({date:this.props.preSelection}):this.props.openToDate&&!Kt(this.props.openToDate,e.openToDate)&&this.setState({date:this.props.openToDate})}},{key:"render",value:function(){var e=this.props.container||Vn;return de.default.createElement("div",{ref:this.containerRef},de.default.createElement(e,{className:pe.default("react-datepicker",this.props.className,{"react-datepicker--time-only":this.props.showTimeSelectOnly}),showPopperArrow:this.props.showPopperArrow,arrowProps:this.props.arrowProps},this.renderPreviousButton(),this.renderNextButton(),this.renderMonths(),this.renderYears(),this.renderTodayButton(),this.renderTimeSection(),this.renderInputTimeSection(),this.props.children))}}],[{key:"defaultProps",get:function(){return{onDropdownFocus:function(){},monthsShown:1,monthSelectedIn:0,forceShowMonthNavigation:!1,timeCaption:"Time",previousYearButtonLabel:"Previous Year",nextYearButtonLabel:"Next Year",previousMonthButtonLabel:"Previous Month",nextMonthButtonLabel:"Next Month",customTimeInput:null,yearItemNumber:xt}}}]),n}(de.default.Component),Bn=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),(a=t.call(this,e)).el=document.createElement("div"),a}return vt(n,[{key:"componentDidMount",value:function(){this.portalRoot=(this.props.portalHost||document).getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement("div"),this.portalRoot.setAttribute("id",this.props.portalId),(this.props.portalHost||document.body).appendChild(this.portalRoot)),this.portalRoot.appendChild(this.el)}},{key:"componentWillUnmount",value:function(){this.portalRoot.removeChild(this.el)}},{key:"render",value:function(){return dt.default.createPortal(this.props.children,this.el)}}]),n}(de.default.Component),Hn=function(e){return!e.disabled&&-1!==e.tabIndex},zn=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),yt(Zt(a=t.call(this,e)),"getTabChildren",(function(){return Array.prototype.slice.call(a.tabLoopRef.current.querySelectorAll("[tabindex], a, button, input, select, textarea"),1,-1).filter(Hn)})),yt(Zt(a),"handleFocusStart",(function(e){var t=a.getTabChildren();t&&t.length>1&&t[t.length-1].focus()})),yt(Zt(a),"handleFocusEnd",(function(e){var t=a.getTabChildren();t&&t.length>1&&t[0].focus()})),a.tabLoopRef=de.default.createRef(),a}return vt(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),Kn=function(e){wt(n,e);var t=St(n);function n(){return ft(this,n),t.apply(this,arguments)}return vt(n,[{key:"render",value:function(){var e,t=this.props,n=t.className,a=t.wrapperClassName,r=t.hidePopper,i=t.popperComponent,s=t.popperModifiers,o=t.popperPlacement,l=t.popperProps,c=t.targetComponent,u=t.enableTabLoop,d=t.popperOnKeyDown,p=t.portalId,m=t.portalHost;if(!r){var h=pe.default("react-datepicker-popper",n);e=de.default.createElement(ce.Popper,bt({modifiers:s,placement:o},l),(function(e){var t=e.ref,n=e.style,a=e.placement,r=e.arrowProps;return de.default.createElement(zn,{enableTabLoop:u},de.default.createElement("div",{ref:t,style:n,className:h,"data-placement":a,onKeyDown:d},de.default.cloneElement(i,{arrowProps:r})))}))}this.props.popperContainer&&(e=de.default.createElement(this.props.popperContainer,{},e)),p&&!r&&(e=de.default.createElement(Bn,{portalId:p,portalHost:m},e));var f=pe.default("react-datepicker-wrapper",a);return de.default.createElement(ce.Manager,{className:"react-datepicker-manager"},de.default.createElement(ce.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),Gn="react-datepicker-ignore-onclickoutside",Qn=ut.default(Yn),Xn="Date input not valid.",Jn=function(e){wt(n,e);var t=St(n);function n(e){var a;return ft(this,n),yt(Zt(a=t.call(this,e)),"getPreSelection",(function(){return a.props.openToDate?a.props.openToDate:a.props.selectsEnd&&a.props.startDate?a.props.startDate:a.props.selectsStart&&a.props.endDate?a.props.endDate:Ot()})),yt(Zt(a),"calcInitialState",(function(){var e,t=a.getPreSelection(),n=bn(a.props),r=wn(a.props),i=n&&it.default(t,He.default(n))?n:r&&rt.default(t,Xe.default(r))?r:t;return{open:a.props.startOpen||!1,preventFocus:!1,preSelection:null!==(e=a.props.selectsRange?a.props.startDate:a.props.selected)&&void 0!==e?e:i,highlightDates:_n(a.props.highlightDates),focused:!1,shouldFocusDayInline:!1}})),yt(Zt(a),"clearPreventFocusTimeout",(function(){a.preventFocusTimeout&&clearTimeout(a.preventFocusTimeout)})),yt(Zt(a),"setFocus",(function(){a.input&&a.input.focus&&a.input.focus({preventScroll:!0})})),yt(Zt(a),"setBlur",(function(){a.input&&a.input.blur&&a.input.blur(),a.cancelFocusInput()})),yt(Zt(a),"setOpen",(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];a.setState({open:e,preSelection:e&&a.state.open?a.state.preSelection:a.calcInitialState().preSelection,lastPreSelectChange:ta},(function(){e||a.setState((function(e){return{focused:!!t&&e.focused}}),(function(){!t&&a.setBlur(),a.setState({inputValue:null})}))}))})),yt(Zt(a),"inputOk",(function(){return me.default(a.state.preSelection)})),yt(Zt(a),"isCalendarOpen",(function(){return void 0===a.props.open?a.state.open&&!a.props.disabled&&!a.props.readOnly:a.props.open})),yt(Zt(a),"handleFocus",(function(e){a.state.preventFocus||(a.props.onFocus(e),a.props.preventOpenOnFocus||a.props.readOnly||a.setOpen(!0)),a.setState({focused:!0})})),yt(Zt(a),"cancelFocusInput",(function(){clearTimeout(a.inputFocusTimeout),a.inputFocusTimeout=null})),yt(Zt(a),"deferFocusInput",(function(){a.cancelFocusInput(),a.inputFocusTimeout=setTimeout((function(){return a.setFocus()}),1)})),yt(Zt(a),"handleDropdownFocus",(function(){a.cancelFocusInput()})),yt(Zt(a),"handleBlur",(function(e){(!a.state.open||a.props.withPortal||a.props.showTimeInput)&&a.props.onBlur(e),a.setState({focused:!1})})),yt(Zt(a),"handleCalendarClickOutside",(function(e){a.props.inline||a.setOpen(!1),a.props.onClickOutside(e),a.props.withPortal&&e.preventDefault()})),yt(Zt(a),"handleChange",(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0];if(!a.props.onChangeRaw||(a.props.onChangeRaw.apply(Zt(a),t),"function"==typeof r.isDefaultPrevented&&!r.isDefaultPrevented())){a.setState({inputValue:r.target.value,lastPreSelectChange:ea});var i=At(r.target.value,a.props.dateFormat,a.props.locale,a.props.strictParsing,a.props.minDate);!i&&r.target.value||a.setSelected(i,r,!0)}})),yt(Zt(a),"handleSelect",(function(e,t,n){if(a.setState({preventFocus:!0},(function(){return a.preventFocusTimeout=setTimeout((function(){return a.setState({preventFocus:!1})}),50),a.preventFocusTimeout})),a.props.onChangeRaw&&a.props.onChangeRaw(t),a.setSelected(e,t,!1,n),!a.props.shouldCloseOnSelect||a.props.showTimeSelect)a.setPreSelection(e);else if(!a.props.inline){a.props.selectsRange||a.setOpen(!1);var r=a.props,i=r.startDate,s=r.endDate;!i||s||it.default(e,i)||a.setOpen(!1)}})),yt(Zt(a),"setSelected",(function(e,t,n,r){var i=e;if(null===i||!an(i,a.props)){var s=a.props,o=s.onChange,l=s.selectsRange,c=s.startDate,u=s.endDate;if(!Gt(a.props.selected,i)||a.props.allowSameDay||l)if(null!==i&&(!a.props.selected||n&&(a.props.showTimeSelect||a.props.showTimeSelectOnly||a.props.showTimeInput)||(i=Ft(i,{hour:Ce.default(a.props.selected),minute:Te.default(a.props.selected),second:ke.default(a.props.selected)})),a.props.inline||a.setState({preSelection:i}),a.props.focusSelectedMonth||a.setState({monthSelectedIn:r})),l){var d=c&&u;c||u?c&&!u&&(it.default(i,c)?o([i,null],t):o([c,i],t)):o([i,null],t),d&&o([i,null],t)}else o(i,t);n||(a.props.onSelect(i,t),a.setState({inputValue:null}))}})),yt(Zt(a),"setPreSelection",(function(e){var t=void 0!==a.props.minDate,n=void 0!==a.props.maxDate,r=!0;if(e){var i=He.default(e);if(t&&n)r=Qt(e,a.props.minDate,a.props.maxDate);else if(t){var s=He.default(a.props.minDate);r=rt.default(e,s)||Gt(i,s)}else if(n){var o=Xe.default(a.props.maxDate);r=it.default(e,o)||Gt(i,o)}}r&&a.setState({preSelection:e})})),yt(Zt(a),"handleTimeChange",(function(e){var t=Ft(a.props.selected?a.props.selected:a.getPreSelection(),{hour:Ce.default(e),minute:Te.default(e)});a.setState({preSelection:t}),a.props.onChange(t),a.props.shouldCloseOnSelect&&a.setOpen(!1),a.props.showTimeInput&&a.setOpen(!0),a.setState({inputValue:null})})),yt(Zt(a),"onInputClick",(function(){a.props.disabled||a.props.readOnly||a.setOpen(!0),a.props.onInputClick()})),yt(Zt(a),"onInputKeyDown",(function(e){a.props.onKeyDown(e);var t=e.key;if(a.state.open||a.props.inline||a.props.preventOpenOnFocus){if(a.state.open){if("ArrowDown"===t||"ArrowUp"===t){e.preventDefault();var n=a.calendar.componentNode&&a.calendar.componentNode.querySelector('.react-datepicker__day[tabindex="0"]');return void(n&&n.focus({preventScroll:!0}))}var r=Ot(a.state.preSelection);"Enter"===t?(e.preventDefault(),a.inputOk()&&a.state.lastPreSelectChange===ta?(a.handleSelect(r,e),!a.props.shouldCloseOnSelect&&a.setPreSelection(r)):a.setOpen(!1)):"Escape"===t&&(e.preventDefault(),a.setOpen(!1)),a.inputOk()||a.props.onInputError({code:1,msg:Xn})}}else"ArrowDown"!==t&&"ArrowUp"!==t&&"Enter"!==t||a.onInputClick()})),yt(Zt(a),"onDayKeyDown",(function(e){a.props.onKeyDown(e);var t=e.key,n=Ot(a.state.preSelection);if("Enter"===t)e.preventDefault(),a.handleSelect(n,e),!a.props.shouldCloseOnSelect&&a.setPreSelection(n);else if("Escape"===t)e.preventDefault(),a.setOpen(!1),a.inputOk()||a.props.onInputError({code:1,msg:Xn});else if(!a.props.disabledKeyboardNavigation){var r;switch(t){case"ArrowLeft":r=Ee.default(n,1);break;case"ArrowRight":r=ye.default(n,1);break;case"ArrowUp":r=Ze.default(n,1);break;case"ArrowDown":r=be.default(n,1);break;case"PageUp":r=Ie.default(n,1);break;case"PageDown":r=we.default(n,1);break;case"Home":r=Se.default(n,1);break;case"End":r=_e.default(n,1)}if(!r)return void(a.props.onInputError&&a.props.onInputError({code:1,msg:Xn}));if(e.preventDefault(),a.setState({lastPreSelectChange:ta}),a.props.adjustDateOnChange&&a.setSelected(r),a.setPreSelection(r),a.props.inline){var i=Re.default(n),s=Re.default(r),o=Ae.default(n),l=Ae.default(r);i!==s||o!==l?a.setState({shouldFocusDayInline:!0}):a.setState({shouldFocusDayInline:!1})}}})),yt(Zt(a),"onPopperKeyDown",(function(e){"Escape"===e.key&&(e.preventDefault(),a.setState({preventFocus:!0},(function(){a.setOpen(!1),setTimeout((function(){a.setFocus(),a.setState({preventFocus:!1})}))})))})),yt(Zt(a),"onClearClick",(function(e){e&&e.preventDefault&&e.preventDefault(),a.props.selectsRange?a.props.onChange([null,null],e):a.props.onChange(null,e),a.setState({inputValue:null})})),yt(Zt(a),"clear",(function(){a.onClearClick()})),yt(Zt(a),"onScroll",(function(e){"boolean"==typeof a.props.closeOnScroll&&a.props.closeOnScroll?e.target!==document&&e.target!==document.documentElement&&e.target!==document.body||a.setOpen(!1):"function"==typeof a.props.closeOnScroll&&a.props.closeOnScroll(e)&&a.setOpen(!1)})),yt(Zt(a),"renderCalendar",(function(){return a.props.inline||a.isCalendarOpen()?de.default.createElement(Qn,{ref:function(e){a.calendar=e},locale:a.props.locale,calendarStartDay:a.props.calendarStartDay,chooseDayAriaLabelPrefix:a.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:a.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:a.props.weekAriaLabelPrefix,adjustDateOnChange:a.props.adjustDateOnChange,setOpen:a.setOpen,shouldCloseOnSelect:a.props.shouldCloseOnSelect,dateFormat:a.props.dateFormatCalendar,useWeekdaysShort:a.props.useWeekdaysShort,formatWeekDay:a.props.formatWeekDay,dropdownMode:a.props.dropdownMode,selected:a.props.selected,preSelection:a.state.preSelection,onSelect:a.handleSelect,onWeekSelect:a.props.onWeekSelect,openToDate:a.props.openToDate,minDate:a.props.minDate,maxDate:a.props.maxDate,selectsStart:a.props.selectsStart,selectsEnd:a.props.selectsEnd,selectsRange:a.props.selectsRange,startDate:a.props.startDate,endDate:a.props.endDate,excludeDates:a.props.excludeDates,excludeDateIntervals:a.props.excludeDateIntervals,filterDate:a.props.filterDate,onClickOutside:a.handleCalendarClickOutside,formatWeekNumber:a.props.formatWeekNumber,highlightDates:a.state.highlightDates,includeDates:a.props.includeDates,includeDateIntervals:a.props.includeDateIntervals,includeTimes:a.props.includeTimes,injectTimes:a.props.injectTimes,inline:a.props.inline,shouldFocusDayInline:a.state.shouldFocusDayInline,peekNextMonth:a.props.peekNextMonth,showMonthDropdown:a.props.showMonthDropdown,showPreviousMonths:a.props.showPreviousMonths,useShortMonthInDropdown:a.props.useShortMonthInDropdown,showMonthYearDropdown:a.props.showMonthYearDropdown,showWeekNumbers:a.props.showWeekNumbers,showYearDropdown:a.props.showYearDropdown,withPortal:a.props.withPortal,forceShowMonthNavigation:a.props.forceShowMonthNavigation,showDisabledMonthNavigation:a.props.showDisabledMonthNavigation,scrollableYearDropdown:a.props.scrollableYearDropdown,scrollableMonthYearDropdown:a.props.scrollableMonthYearDropdown,todayButton:a.props.todayButton,weekLabel:a.props.weekLabel,outsideClickIgnoreClass:Gn,fixedHeight:a.props.fixedHeight,monthsShown:a.props.monthsShown,monthSelectedIn:a.state.monthSelectedIn,onDropdownFocus:a.handleDropdownFocus,onMonthChange:a.props.onMonthChange,onYearChange:a.props.onYearChange,dayClassName:a.props.dayClassName,weekDayClassName:a.props.weekDayClassName,monthClassName:a.props.monthClassName,timeClassName:a.props.timeClassName,showTimeSelect:a.props.showTimeSelect,showTimeSelectOnly:a.props.showTimeSelectOnly,onTimeChange:a.handleTimeChange,timeFormat:a.props.timeFormat,timeIntervals:a.props.timeIntervals,minTime:a.props.minTime,maxTime:a.props.maxTime,excludeTimes:a.props.excludeTimes,filterTime:a.props.filterTime,timeCaption:a.props.timeCaption,className:a.props.calendarClassName,container:a.props.calendarContainer,yearItemNumber:a.props.yearItemNumber,yearDropdownItemNumber:a.props.yearDropdownItemNumber,previousMonthAriaLabel:a.props.previousMonthAriaLabel,previousMonthButtonLabel:a.props.previousMonthButtonLabel,nextMonthAriaLabel:a.props.nextMonthAriaLabel,nextMonthButtonLabel:a.props.nextMonthButtonLabel,previousYearAriaLabel:a.props.previousYearAriaLabel,previousYearButtonLabel:a.props.previousYearButtonLabel,nextYearAriaLabel:a.props.nextYearAriaLabel,nextYearButtonLabel:a.props.nextYearButtonLabel,timeInputLabel:a.props.timeInputLabel,disabledKeyboardNavigation:a.props.disabledKeyboardNavigation,renderCustomHeader:a.props.renderCustomHeader,popperProps:a.props.popperProps,renderDayContents:a.props.renderDayContents,onDayMouseEnter:a.props.onDayMouseEnter,onMonthMouseLeave:a.props.onMonthMouseLeave,selectsDisabledDaysInRange:a.props.selectsDisabledDaysInRange,showTimeInput:a.props.showTimeInput,showMonthYearPicker:a.props.showMonthYearPicker,showFullMonthYearPicker:a.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:a.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:a.props.showFourColumnMonthYearPicker,showYearPicker:a.props.showYearPicker,showQuarterYearPicker:a.props.showQuarterYearPicker,showPopperArrow:a.props.showPopperArrow,excludeScrollbar:a.props.excludeScrollbar,handleOnKeyDown:a.props.onKeyDown,handleOnDayKeyDown:a.onDayKeyDown,isInputFocused:a.state.focused,customTimeInput:a.props.customTimeInput,setPreSelection:a.setPreSelection},a.props.children):null})),yt(Zt(a),"renderDateInput",(function(){var e,t=pe.default(a.props.className,yt({},Gn,a.state.open)),n=a.props.customInput||de.default.createElement("input",{type:"text"}),r=a.props.customInputRef||"ref",i="string"==typeof a.props.value?a.props.value:"string"==typeof a.state.inputValue?a.state.inputValue:a.props.selectsRange?function(e,t,n){if(!e)return"";var a=Lt(e,n),r=t?Lt(t,n):"";return"".concat(a," - ").concat(r)}(a.props.startDate,a.props.endDate,a.props):Lt(a.props.selected,a.props);return de.default.cloneElement(n,(yt(e={},r,(function(e){a.input=e})),yt(e,"value",i),yt(e,"onBlur",a.handleBlur),yt(e,"onChange",a.handleChange),yt(e,"onClick",a.onInputClick),yt(e,"onFocus",a.handleFocus),yt(e,"onKeyDown",a.onInputKeyDown),yt(e,"id",a.props.id),yt(e,"name",a.props.name),yt(e,"autoFocus",a.props.autoFocus),yt(e,"placeholder",a.props.placeholderText),yt(e,"disabled",a.props.disabled),yt(e,"autoComplete",a.props.autoComplete),yt(e,"className",pe.default(n.props.className,t)),yt(e,"title",a.props.title),yt(e,"readOnly",a.props.readOnly),yt(e,"required",a.props.required),yt(e,"tabIndex",a.props.tabIndex),yt(e,"aria-describedby",a.props.ariaDescribedBy),yt(e,"aria-invalid",a.props.ariaInvalid),yt(e,"aria-labelledby",a.props.ariaLabelledBy),yt(e,"aria-required",a.props.ariaRequired),e))})),yt(Zt(a),"renderClearButton",(function(){var e=a.props,t=e.isClearable,n=e.selected,r=e.startDate,i=e.endDate,s=e.clearButtonTitle,o=e.clearButtonClassName,l=void 0===o?"":o,c=e.ariaLabelClose,u=void 0===c?"Close":c;return!t||null==n&&null==r&&null==i?null:de.default.createElement("button",{type:"button",className:"react-datepicker__close-icon ".concat(l).trim(),"aria-label":u,onClick:a.onClearClick,title:s,tabIndex:-1})})),a.state=a.calcInitialState(),a}return vt(n,[{key:"componentDidMount",value:function(){window.addEventListener("scroll",this.onScroll,!0)}},{key:"componentDidUpdate",value:function(e,t){var n,a;e.inline&&(n=e.selected,a=this.props.selected,n&&a?Re.default(n)!==Re.default(a)||Ae.default(n)!==Ae.default(a):n!==a)&&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:_n(this.props.highlightDates)}),t.focused||Gt(e.selected,this.props.selected)||this.setState({inputValue:null}),t.open!==this.state.open&&(!1===t.open&&!0===this.state.open&&this.props.onCalendarOpen(),!0===t.open&&!1===this.state.open&&this.props.onCalendarClose())}},{key:"componentWillUnmount",value:function(){this.clearPreventFocusTimeout(),window.removeEventListener("scroll",this.onScroll,!0)}},{key:"renderInputContainer",value:function(){return 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(Bn,{portalId:this.props.portalId,portalHost:this.props.portalHost},t)),de.default.createElement("div",null,this.renderInputContainer(),t)}return de.default.createElement(Kn,{className:this.props.popperClassName,wrapperClassName:this.props.wrapperClassName,hidePopper:!this.isCalendarOpen(),portalId:this.props.portalId,portalHost:this.props.portalHost,popperModifiers:this.props.popperModifiers,targetComponent:this.renderInputContainer(),popperContainer:this.props.popperContainer,popperComponent:e,popperPlacement:this.props.popperPlacement,popperProps:this.props.popperProps,popperOnKeyDown:this.onPopperKeyDown,enableTabLoop:this.props.enableTabLoop})}}],[{key:"defaultProps",get:function(){return{allowSameDay:!1,dateFormat:"MM/dd/yyyy",dateFormatCalendar:"LLLL yyyy",onChange:function(){},disabled:!1,disabledKeyboardNavigation:!1,dropdownMode:"scroll",onFocus:function(){},onBlur:function(){},onKeyDown:function(){},onInputClick:function(){},onSelect:function(){},onClickOutside:function(){},onMonthChange:function(){},onCalendarOpen:function(){},onCalendarClose:function(){},preventOpenOnFocus:!1,onYearChange:function(){},onInputError:function(){},monthsShown:1,readOnly:!1,withPortal:!1,selectsDisabledDaysInRange:!1,shouldCloseOnSelect:!0,showTimeSelect:!1,showTimeInput:!1,showPreviousMonths:!1,showMonthYearPicker:!1,showFullMonthYearPicker:!1,showTwoColumnMonthYearPicker:!1,showFourColumnMonthYearPicker:!1,showYearPicker:!1,showQuarterYearPicker:!1,strictParsing:!1,timeIntervals:30,timeCaption:"Time",previousMonthAriaLabel:"Previous Month",previousMonthButtonLabel:"Previous Month",nextMonthAriaLabel:"Next Month",nextMonthButtonLabel:"Next Month",previousYearAriaLabel:"Previous Year",previousYearButtonLabel:"Previous Year",nextYearAriaLabel:"Next Year",nextYearButtonLabel:"Next Year",timeInputLabel:"Time",enableTabLoop:!0,yearItemNumber:xt,renderDayContents:function(e){return e},focusSelectedMonth:!1,showPopperArrow:!0,excludeScrollbar:!0,customTimeInput:null,calendarStartDay:void 0}}}]),n}(de.default.Component),ea="input",ta="navigate";e.CalendarContainer=Vn,e.default=Jn,e.getDefaultLocale=Xt,e.registerLocale=function(e,t){var a="undefined"!=typeof window?window:n.g;a.__localeData__||(a.__localeData__={}),a.__localeData__[e]=t},e.setDefaultLocale=function(e){("undefined"!=typeof window?window:n.g).__localeId__=e},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(45993),n(45697),n(89457),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(97846),n(48934))},69590:function(e){var t="undefined"!=typeof Element,n="function"==typeof Map,a="function"==typeof Set,r="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function i(e,s){if(e===s)return!0;if(e&&s&&"object"==typeof e&&"object"==typeof s){if(e.constructor!==s.constructor)return!1;var o,l,c,u;if(Array.isArray(e)){if((o=e.length)!=s.length)return!1;for(l=o;0!=l--;)if(!i(e[l],s[l]))return!1;return!0}if(n&&e instanceof Map&&s instanceof Map){if(e.size!==s.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!s.has(l.value[0]))return!1;for(u=e.entries();!(l=u.next()).done;)if(!i(l.value[1],s.get(l.value[0])))return!1;return!0}if(a&&e instanceof Set&&s instanceof Set){if(e.size!==s.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!s.has(l.value[0]))return!1;return!0}if(r&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(s)){if((o=e.length)!=s.length)return!1;for(l=o;0!=l--;)if(e[l]!==s[l])return!1;return!0}if(e.constructor===RegExp)return e.source===s.source&&e.flags===s.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===s.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===s.toString();if((o=(c=Object.keys(e)).length)!==Object.keys(s).length)return!1;for(l=o;0!=l--;)if(!Object.prototype.hasOwnProperty.call(s,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)&&!i(e[c[l]],s[c[l]]))return!1;return!0}return e!=e&&s!=s}e.exports=function(e,t){try{return i(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 a=n(45993),r=n(97846);function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(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,u=(void 0===l&&(l=0),function(){return++l}),d={},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 a;return(a=n.call(this,e)||this).__outsideClickHandler=function(e){if("function"!=typeof a.__clickOutsideHandlerProp){var t=a.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 a.__clickOutsideHandlerProp(e)},a.__getComponentNode=function(){var e=a.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():(0,r.findDOMNode)(e)},a.enableOnClickOutside=function(){if("undefined"!=typeof document&&!p[a._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[a._uid]=!0;var e=a.props.eventTypes;e.forEach||(e=[e]),d[a._uid]=function(e){var t;null!==a.componentNode&&(a.props.preventDefault&&e.preventDefault(),a.props.stopPropagation&&e.stopPropagation(),a.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,a.componentNode,a.props.outsideClickIgnoreClass)===document&&a.__outsideClickHandler(e))},e.forEach((function(e){document.addEventListener(e,d[a._uid],f(s(a),e))}))}},a.disableOnClickOutside=function(){delete p[a._uid];var e=d[a._uid];if(e&&"undefined"!=typeof document){var t=a.props.eventTypes;t.forEach||(t=[t]),t.forEach((function(t){return document.removeEventListener(t,e,f(s(a),t))})),delete d[a._uid]}},a.getRef=function(e){return a.instanceRef=e},a._uid=u(),a}h=n,(l=g).prototype=Object.create(h.prototype),l.prototype.constructor=l,i(l,h);var v=g.prototype;return v.getInstance=function(){if(e.prototype&&!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},v.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(t&&"function"==typeof t.handleClickOutside&&(this.__clickOutsideHandlerProp=t.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw new Error("WrappedComponent: "+m+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},v.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},v.componentWillUnmount=function(){this.disableOnClickOutside()},v.render=function(){var t=this.props;t.excludeScrollbar;var n=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(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,a.createElement)(e,n)},g}(a.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 s},Popper:function(){return w},Reference:function(){return Z},usePopper:function(){return g}});var a=n(45993),r=a.createContext(),i=a.createContext();function s(e){var t=e.children,n=a.useState(null),s=n[0],o=n[1],l=a.useRef(!1);a.useEffect((function(){return function(){l.current=!0}}),[]);var c=a.useCallback((function(e){l.current||o(e)}),[]);return a.createElement(r.Provider,{value:s},a.createElement(i.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),a=1;a<t;a++)n[a-1]=arguments[a];return e.apply(void 0,n)}},c=function(e,t){if("function"==typeof e)return l(e,t);null!=e&&(e.current=t)},u=function(e){return e.reduce((function(e,t){var n=t[0],a=t[1];return e[n]=a,e}),{})},d="undefined"!=typeof window&&window.document&&window.document.createElement?a.useLayoutEffect:a.useEffect,p=n(17211),m=n(69590),h=n.n(m),f=[],g=function(e,t,n){void 0===n&&(n={});var r=a.useRef(null),i={onFirstUpdate:n.onFirstUpdate,placement:n.placement||"bottom",strategy:n.strategy||"absolute",modifiers:n.modifiers||f},s=a.useState({styles:{popper:{position:i.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),o=s[0],l=s[1],c=a.useMemo((function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(e){var t=e.state,n=Object.keys(t.elements);l({styles:u(n.map((function(e){return[e,t.styles[e]||{}]}))),attributes:u(n.map((function(e){return[e,t.attributes[e]]})))})},requires:["computeStyles"]}}),[]),m=a.useMemo((function(){var e={onFirstUpdate:i.onFirstUpdate,placement:i.placement,strategy:i.strategy,modifiers:[].concat(i.modifiers,[c,{name:"applyStyles",enabled:!1}])};return h()(r.current,e)?r.current||e:(r.current=e,e)}),[i.onFirstUpdate,i.placement,i.strategy,i.modifiers,c]),g=a.useRef();return d((function(){g.current&&g.current.setOptions(m)}),[m]),d((function(){if(null!=e&&null!=t){var a=(n.createPopper||p.fi)(e,t,m);return g.current=a,function(){a.destroy(),g.current=null}}}),[e,t,n.createPopper]),{state:g.current?g.current.state:null,styles:o.styles,attributes:o.attributes,update:g.current?g.current.update:null,forceUpdate:g.current?g.current.forceUpdate:null}},v=function(){},y=function(){return Promise.resolve(null)},b=[];function w(e){var t=e.placement,n=void 0===t?"bot