MailPoet Newsletters (New) - Version 3.74.3

Version Description

  • 2021-12-07 =
  • Added: new segment "subscribed to list";
  • Improved: more options for "purchased product" segment;
  • Improved: more performant WooCommerce customers names sync;
  • Improved: simplified tracking settings in MailPoet > Settings > Advanced;
  • Fixed: issue in WooCommerce checkout integration;
  • Fixed: popup form is displayed again after dismissed when 'After submit' is set to 'Go to Page'.
Download this release

Release Info

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

Code changes from version 3.74.2 to 3.74.3

assets/dist/js/admin.364f67d4.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! For license information please see admin.364f67d4.js.LICENSE.txt */
2
+ (self.webpackChunkMailPoet3=self.webpackChunkMailPoet3||[]).push([[328],{49868:function(){jQuery.AsyncQueue=function(){var e,t,n,a,r=this,o=[],s=!1;return a=function(){var e=o.shift();e?(e.apply(r,[r]),!1===s&&a()):t&&t.apply(r)},this.onFailure=function(t){e=t},this.onComplete=function(e){t=e},this.add=function(e){return o.push(e),this},this.storeData=function(e){return n=e,this},this.lastCallbackData=function(){return n},this.run=function(){s=!1,a()},this.pause=function(){return s=!0,this},this.failure=function(){if(s=!0,e){var t=[r];for(i=0;i<arguments.length;i++)t.push(arguments[i]);e.apply(r,t)}},this}},88029:function(e,t,n){"use strict";var a={};n.r(a),n.d(a,{canUseWooSubscriptions:function(){return Ds},findFiltersValueForSegment:function(){return $s},getAvailableFilters:function(){return qs},getCustomFieldsList:function(){return Os},getErrors:function(){return Fs},getNewslettersList:function(){return Ns},getProductCategories:function(){return Ts},getProducts:function(){return Ss},getSegment:function(){return Ps},getSegmentFilter:function(){return As},getStaticSegmentsList:function(){return Ls},getSubscriberCount:function(){return Ms},getSubscriptionProducts:function(){return ks},getWooCommerceCountries:function(){return Rs},getWooCommerceCurrencySymbol:function(){return xs},getWordpressRoles:function(){return Cs}});var r={};n.r(r),n.d(r,{handleSave:function(){return Gs},pageLoaded:function(){return Ks},setErrors:function(){return Ws},setSegment:function(){return js},updateSegment:function(){return Vs},updateSegmentFilter:function(){return Ys},updateSegmentFilterFromEvent:function(){return Hs},updateSegmentFromEvent:function(){return Bs},updateSubscriberCount:function(){return zs}});var i={};n.r(i),n.d(i,{LOAD_SEGMENT:function(){return Xs},SAVE_SEGMENT:function(){return Js}});var o=n(45993),s=n.n(o),l=n(97846),c=n.n(l),u=n(73727),d=n(5977),p=n(65311),m=n.n(p),h=n(76867),f=n(16277),g=n.n(f),v=n(45697),b=n.n(v),y=n(57744),w=n(57578);const E=({children:e,dimension:t,segments:n,strings:a})=>s().createElement("div",{className:"mailpoet-tags"},e,n&&n.map((e=>s().createElement(w.Z,{key:e.name,dimension:t,variant:"list"},e.name))),a&&a.map((e=>s().createElement(w.Z,{key:e,dimension:t,variant:"list"},e))));E.propTypes={children:b().node,dimension:b().oneOf(["large"]),segments:b().arrayOf(b().shape({name:b().string.isRequired})),strings:b().arrayOf(b().string)};var _=E,Z=n(49593),I=n.n(Z),S=n(57040),k=n(73126),C=n(44845),T=n(59050);n(20454);class N extends s().Component{constructor(e){super(e),(0,C.Z)(this,"getFieldId",(e=>{const t=e||this.props;return t.field.id||t.field.name})),(0,C.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,C.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,C.Z)(this,"getLabel",(e=>void 0!==this.props.field.getLabel?this.props.field.getLabel(e,this.props.item):e.name)),(0,C.Z)(this,"getSearchLabel",(e=>void 0!==this.props.field.getSearchLabel?this.props.field.getSearchLabel(e,this.props.item):null)),(0,C.Z)(this,"getValue",(e=>void 0!==this.props.field.getValue?this.props.field.getValue(e,this.props.item):e.id)),(0,C.Z)(this,"getCount",(e=>void 0!==this.props.field.getCount?this.props.field.getCount(e,this.props.item):null)),(0,C.Z)(this,"getTag",(e=>void 0!==this.props.field.getTag?this.props.field.getTag(e,this.props.item):null)),(0,C.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,C.Z)(this,"resetSelect2",(()=>{this.destroySelect2(),this.setupSelect2()})),(0,C.Z)(this,"destroySelect2",(()=>{this.isSelect2Initialized()&&(m()(`#${this.selectRef.current.id}`).select2("destroy"),this.cleanupAfterSelect2())})),(0,C.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,C.Z)(this,"allowMultipleValues",(()=>!0===this.props.field.multiple)),(0,C.Z)(this,"isSelect2Initialized",(()=>!0===m()(`#${this.selectRef.current.id}`).hasClass("select2-hidden-accessible"))),(0,C.Z)(this,"isSelect2Component",(()=>this.allowMultipleValues()||this.props.field.forceSelect2)),(0,C.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,C.Z)(this,"transformChangedValue",((e,t)=>"function"==typeof this.props.field.transformChangedValue?this.props.field.transformChangedValue.call(this,e,t):e)),(0,C.Z)(this,"insertEmptyOption",(()=>{if(!this.allowMultipleValues())return this.props.field.placeholder?s().createElement("option",{className:"default"}):void 0})),this.selectRef=s().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 s().createElement("option",{key:`option-${e.id}`,className:"default",value:a,title:n},t)}));return s().createElement("div",{className:"mailpoet-form-select mailpoet-form-input"},s().createElement("select",(0,k.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))}}N.propTypes={onValueChange:b().func,field:b().shape({name:b().string.isRequired,values:b().oneOfType([b().object,b().array]),getLabel:b().func,resetSelect2OnUpdate:b().bool,selected:b().func,endpoint:b().string,filter:b().func,getSearchLabel:b().func,getValue:b().func,getCount:b().func,getTag:b().func,placeholder:b().string,remoteQuery:b().object,extendSelect2Options:b().object,multiple:b().bool,forceSelect2:b().bool,transformChangedValue:b().func,disabled:b().bool,validation:b().shape({"data-parsley-required":b().bool,"data-parsley-required-message":b().string,"data-parsley-type":b().string,"data-parsley-errors-container":b().string,maxLength:b().number})}).isRequired,item:b().object,disabled:b().bool,width:b().string},N.defaultProps={onValueChange:function(){},disabled:!1,width:"",item:void 0};var D=N,x=n(27927),R=n.n(x),O=n(38287),P=()=>{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?"https://account.mailpoet.com/upgrade":`https://account.mailpoet.com/?s=${h.Z.subscribersCount+1}`,r=R()(h.Z.I18n.t("youCanDisableWPUsersList"),/\[link](.*?)\[\/link]/g,(e=>s().createElement("a",{key:"goToSegments",href:"?page=mailpoet-segments"},e)));return s().createElement(O.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0},s().createElement("h3",null,t),s().createElement("p",null,n," ",h.Z.I18n.t("youNeedToUpgrade"),"active"===h.Z.wpSegmentState?s().createElement(s().Fragment,null,s().createElement("br",null),r):null),s().createElement("p",null,s().createElement("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:a},h.Z.I18n.t("upgradeNow")),e&&s().createElement(s().Fragment,null," ",s().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")))))};const L=({mssKeyInvalid:e,subscribersCount:t})=>e?s().createElement(O.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0},s().createElement("h3",null,h.Z.I18n.t("allSendingPausedHeader")),s().createElement("p",null,R()(h.Z.I18n.t("allSendingPausedBody"),/\[link\](.*?)\[\/link\]/g,(e=>s().createElement("a",{href:"?page=mailpoet-settings#premium",key:"check-sending"},e)))),s().createElement("p",null,s().createElement("a",{href:`https://account.mailpoet.com?s=${t}`,className:"button button-primary",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("allSendingPausedLink")))):null;L.propTypes={mssKeyInvalid:b().bool.isRequired,subscribersCount:b().number.isRequired};var M=L;function A({cacheCalculation:e}){const[t,n]=(0,o.useState)(!1),[a,r]=(0,o.useState)([]),i=(new Date).getTime()-new Date(e).getTime(),l=Math.floor(i/1e3/60);return s().createElement("div",{className:"mailpoet-subscribers-cache-notice"},R()(h.Z.I18n.t("subscribersCountWereCalculatedWithMinutesAgo"),/<abbr>(.*?)<\/abbr>/,(t=>s().createElement("abbr",{title:e},t.replace(/(\{\$mins\}|\$mins)/,String(l))))),s().createElement(y.Z,{className:"mailpoet-subscribers-cache-notice-button",type:"button",variant:"secondary",dimension:"small",onClick:()=>{n(!0),h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"settings",action:"recalculateSubscribersCountsCache"}).done((()=>{window.location.reload()})).fail((e=>{r(e.errors.map((e=>e.message))),n(!1)}))},withSpinner:t},h.Z.I18n.t("recalculateNow")),s().createElement("div",{className:"mailpoet-gap"}),a.length>0&&s().createElement(O.Z,{type:"error"},a.map((e=>s().createElement("p",{key:e},e)))))}A.propTypes={cacheCalculation:b().string.isRequired};var F=n(92155),q=n.n(F);const $=({subscribersInPlan:e,subscribersInPlanLimit:t})=>{if(!1===e)return null;const n=t?s().createElement("b",{key:"subscribers_count"},h.Z.I18n.t("subscribersInPlanCount").replace("%1$d",e.toLocaleString()).replace("%2$d",t.toLocaleString())):s().createElement("b",{key:"subscribers_count"},e);return s().createElement("div",{className:"mailpoet-subscribers-in-plan"},R()(h.Z.I18n.t("subscribersInPlan"),"%s",(()=>n))," ",s().createElement(q(),{tooltip:h.Z.I18n.t("subscribersInPlanTooltip"),place:"right"}),s().createElement("span",{className:"mailpoet-subscribers-in-plan-spacer"}," "))};$.propTypes={subscribersInPlan:b().oneOfType([b().number,b().oneOf([!1])]).isRequired,subscribersInPlanLimit:b().oneOfType([b().number,b().oneOf([!1])]).isRequired};var U=$,j=n(99181),W=s().createElement("svg",{viewBox:"4 4 16 16"},s().createElement("path",{d:"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"}));const V=({location:e})=>s().createElement(s().Fragment,null,s().createElement(j.Q,null,s().createElement(u.rU,{className:"mailpoet-button button-secondary",to:{pathname:"/new",state:{backUrl:null==e?void 0:e.pathname}}},W,s().createElement("span",{"data-automation-id":"add-new-subscribers-button"},h.Z.I18n.t("new"))),s().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")),s().createElement("a",{id:"mailpoet_export_button",className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-export"},h.Z.I18n.t("export"))));V.propTypes={location:b().object.isRequired};var Y=(0,d.withRouter)(V),B=n(65221);function H({name:e,tooltip:t,tooltipId:n,tooltipPlace:a,type:r,isInverted:i}){return s().createElement("span",null,s().createElement(w.Z,{isInverted:i,variant:r,"data-tip":!0,"data-for":n},e),t&&s().createElement(B.Z,{place:a||"top",multiline:!0,id:n||t.toString()},t))}H.propTypes={name:b().string.isRequired,tooltip:b().oneOfType([b().string,b().node]),tooltipId:b().string,type:b().oneOf(["average","good","excellent","unknown"]),isInverted:b().bool},H.defaultProps={isInverted:!0};var z=H;const K=({id:e,engagementScore:t})=>{const n={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")}},a=`badge-${e}`;let r;r=null==t?n.unknown:t<20?n.average:t<50?n.good:n.excellent;const i=s().createElement("div",{key:`tooltip-${a}`},s().createElement("div",{className:"mailpoet-listing-stats-tooltip-title"},r.tooltipTitle.toUpperCase()),s().createElement("div",{className:"mailpoet-listing-stats-tooltip-description"},h.Z.I18n.t("engagementScoreDescription")),s().createElement("div",{className:"mailpoet-listing-stats-tooltip-content"},s().createElement(z,{type:"unknown",name:h.Z.I18n.t("unknownBadgeName")})," : ",n.unknown.tooltipText,s().createElement("br",null),s().createElement(z,{type:"excellent",name:h.Z.I18n.t("excellentBadgeName")})," : ",n.excellent.tooltipText,s().createElement("br",null),s().createElement(z,{type:"good",name:h.Z.I18n.t("goodBadgeName")})," : ",n.good.tooltipText,s().createElement("br",null),s().createElement(z,{type:"average",name:h.Z.I18n.t("averageBadgeName")})," : ",n.average.tooltipText));return s().createElement("div",{className:"mailpoet-listing-stats-opened-clicked"},null!=t&&s().createElement("div",{className:"mailpoet-listing-stats-percentages"},t.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),"%"),s().createElement("div",null,s().createElement(z,{isInverted:!0,type:r.type,name:r.name,tooltip:i,tooltipId:a,tooltipPlace:"top"})))};K.propTypes={id:b().number.isRequired,engagementScore:b().number};const G=h.Z.trackingConfig.emailTrackingEnabled,Q=[{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:G},{name:"created_at",label:h.Z.I18n.t("subscribedOn"),sortable:!0}],X={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&&s().createElement("div",null,s().createElement("p",null,h.Z.I18n.t("bouncedSubscribersHelp")),s().createElement("p",null,s().createElement("a",{href:"admin.php?page=mailpoet-premium",className:"button-primary"},h.Z.I18n.t("bouncedSubscribersPremiumButtonText"))))},J=(e,t,n,a)=>s().createElement(S.Z,{title:a,onRequestClose:t,isDismissible:!0},s().createElement(D,{field:n}),s().createElement("span",{className:"mailpoet-gap-half"}),s().createElement(y.Z,{onClick:e,dimension:"small",variant:"secondary"},h.Z.I18n.t("apply"))),ee=[{name:"moveToList",label:h.Z.I18n.t("moveToList"),onSelect:function(e,t){return J(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 J(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 J(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:X.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 s().createElement(S.Z,{title:h.Z.I18n.t("unsubscribe"),onRequestClose:t,isDismissible:!0},s().createElement("p",null,h.Z.I18n.t("unsubscribeConfirm").replace("%s",a.toLocaleString())),s().createElement("span",{className:"mailpoet-gap-half"}),s().createElement(y.Z,{onClick:e,dimension:"small",variant:"secondary",automationId:"bulk-unsubscribe-confirm"},h.Z.I18n.t("apply")))}}],te=[{name:"statistics",label:h.Z.I18n.t("statsListingActionTitle"),link:function(e,t){return s().createElement(u.rU,{to:{pathname:`/stats/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}}},h.Z.I18n.t("statsListingActionTitle"))}},{name:"edit",label:h.Z.I18n.t("edit"),link:function(e,t){return s().createElement(u.rU,{to:{pathname:`/edit/${e.id}`,state:{backUrl:null==t?void 0: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"}],ne=e=>0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user),ae=({match:e})=>{const t=(0,d.useLocation)();return s().createElement("div",null,s().createElement(Y,null),s().createElement(U,{subscribersInPlan:h.Z.subscribersCount,subscribersInPlanLimit:h.Z.subscribersLimit}),s().createElement(P,null),s().createElement(M,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),s().createElement(A,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),s().createElement(I(),{limit:window.mailpoet_listing_per_page,location:t,params:e.params,endpoint:"subscribers",onRenderItem:(e,n)=>{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)})),s().createElement("div",null,s().createElement("td",{className:a},s().createElement(u.rU,{className:"mailpoet-listing-title",to:{pathname:`/edit/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}}},e.email),s().createElement("div",{className:"mailpoet-listing-subtitle"},e.first_name," ",e.last_name),n),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},r),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("lists")},s().createElement(_,{segments:i,dimension:"large"})),!0===G?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statisticsColumn")},s().createElement("div",{className:"mailpoet-listing-stats"},s().createElement("a",{key:`stats-link-${e.id}`,href:`#/stats/${e.id}`},s().createElement(K,{id:e.id,engagementScore:e.engagement_score})))):null,s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribedOn")},h.Z.Date.short(e.created_at),s().createElement("br",null),h.Z.Date.time(e.created_at)))},columns:Q,bulk_actions:ee,item_actions:te,messages:X,sort_by:"created_at",sort_order:"desc",isItemDeletable:ne}))};ae.propTypes={match:b().shape({params:b().object}).isRequired};var re=ae,ie=n(30381),oe=n.n(ie),se=n(17123),le=n.n(se),ce=n(60017);class ue extends s().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"),s().createElement(ce.Z,(0,k.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))}}ue.propTypes={onValueChange:b().func,field:b().shape({name:b().string.isRequired,defaultValue:b().string,id:b().string,className:b().string,size:b().oneOfType([b().string,b().number]),disabled:b().func,placeholder:b().string,validation:b().shape({"data-parsley-required":b().bool,"data-parsley-required-message":b().string,"data-parsley-type":b().string,"data-parsley-errors-container":b().string,maxLength:b().number}),customLabel:b().string,tooltip:b().string}).isRequired,item:b().object.isRequired},ue.defaultProps={onValueChange:function(){}};var de=ue,pe=n(97972);const me=e=>s().createElement(pe.Z,(0,k.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));me.propTypes={item:b().object.isRequired,field:b().shape({name:b().string,placeholder:b().string,defaultValue:b().string,validation:b().shape({"data-parsley-required":b().bool,"data-parsley-required-message":b().string,"data-parsley-type":b().string,"data-parsley-errors-container":b().string,maxLength:b().number}),className:b().string,customLabel:b().string,tooltip:b().string}).isRequired,onValueChange:b().func.isRequired};var he=me,fe=n(2141);class ge extends s().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=s().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=>s().createElement("option",{key:`option-${e}`,value:e},this.props.field.values[e])));return s().createElement(fe.Z,(0,k.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)}}ge.propTypes={onValueChange:b().func,field:b().shape({name:b().string.isRequired,values:b().objectOf(b().string),placeholder:b().string,filter:b().func,sortBy:b().func,validation:b().shape({"data-parsley-required":b().bool,"data-parsley-required-message":b().string,"data-parsley-type":b().string,"data-parsley-errors-container":b().string,maxLength:b().number})}).isRequired,item:b().object.isRequired,automationId:b().string},ge.defaultProps={automationId:"",onValueChange:function(){}};var ve=ge,be=n(84868);class ye extends s().Component{constructor(e){super(e),(0,C.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=>s().createElement("p",{key:`radio-${t}`},s().createElement(be.Z,{checked:e===t,value:t,onCheck:this.onValueChange,name:this.props.field.name},this.props.field.values[t]))));return s().createElement("div",null,t)}}ye.propTypes={onValueChange:b().func,field:b().shape({name:b().string.isRequired,values:b().objectOf(b().string)}).isRequired,item:b().object.isRequired},ye.defaultProps={onValueChange:function(){}};var we=ye,Ee=n(89828);class _e extends s().Component{constructor(e){super(e),(0,C.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=>s().createElement("p",{key:`checkbox-${t}`},s().createElement(Ee.Z,{value:"1",checked:e,name:this.props.field.name,onCheck:this.onValueChange},this.props.field.values[t]))));return s().createElement("div",null,t)}}_e.propTypes={onValueChange:b().func.isRequired,field:b().shape({name:b().string.isRequired,values:b().objectOf(b().string)}).isRequired,item:b().object.isRequired};var Ze=_e;function Ie(e){const t=[];void 0!==e.placeholder&&t.push(s().createElement("option",{value:"",key:0},e.placeholder));const n=oe()().year();for(let e=n;e>=n-100;e-=1)t.push(s().createElement("option",{key:e,value:e},e));return s().createElement(fe.Z,{isMinWidth:!0,name:`${e.name}[year]`,value:e.year,onChange:e.onValueChange},t)}function Se(e){const t=[];void 0!==e.placeholder&&t.push(s().createElement("option",{value:"",key:0},e.placeholder));for(let n=1;n<=12;n+=1)t.push(s().createElement("option",{key:n,value:n},e.monthNames[n-1]));return s().createElement(fe.Z,{isMinWidth:!0,name:`${e.name}[month]`,value:e.month,onChange:e.onValueChange},t)}function ke(e){const t=[];void 0!==e.placeholder&&t.push(s().createElement("option",{value:"",key:0},e.placeholder));for(let e=1;e<=31;e+=1)t.push(s().createElement("option",{key:e,value:e},e));return s().createElement(fe.Z,{isMinWidth:!0,name:`${e.name}[day]`,value:e.day,onChange:e.onValueChange},t)}Ie.propTypes={name:b().string.isRequired,placeholder:b().string.isRequired,onValueChange:b().func.isRequired,year:b().oneOfType([b().string,b().number]).isRequired},Se.propTypes={name:b().string.isRequired,placeholder:b().string.isRequired,onValueChange:b().func.isRequired,month:b().oneOfType([b().string,b().number]).isRequired,monthNames:b().arrayOf(b().string).isRequired},ke.propTypes={name:b().string.isRequired,placeholder:b().string.isRequired,onValueChange:b().func.isRequired,day:b().oneOfType([b().string,b().number]).isRequired};class Ce extends s().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=oe()(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 s().createElement(Ie,{onValueChange:this.onValueChange,key:"year",name:this.props.field.name,year:this.state.year,placeholder:this.props.field.year_placeholder});case"MM":return s().createElement(Se,{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 s().createElement(ke,{onValueChange:this.onValueChange,key:"day",name:this.props.field.name,day:this.state.day,placeholder:this.props.field.day_placeholder});default:return s().createElement("div",null,"Invalid date type")}}));return s().createElement("div",null,n)}}Ce.propTypes={item:b().object.isRequired,field:b().shape({name:b().string,day_placeholder:b().string,month_placeholder:b().string,year_placeholder:b().string,params:b().object}).isRequired,onValueChange:b().func.isRequired};var Te=Ce,Ne=n(22529);class De extends s().Component{constructor(...e){super(...e),(0,C.Z)(this,"renderField",(e=>{let t,n=!1;e.field.description&&(n=s().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=s().createElement(de,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"textarea":t=s().createElement(he,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"select":t=s().createElement(ve,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"radio":t=s().createElement(we,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"checkbox":t=s().createElement(Ze,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"selection":t=s().createElement(D,{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=s().createElement(Te,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"reactComponent":t=s().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 s().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=s().createElement(Ne.Z,{level:4},s().createElement("label",{htmlFor:`field_${this.props.field.name}`},this.props.field.label)));let n=!1;return this.props.field.tip&&(n=s().createElement("p",{className:"mailpoet-form-description"},this.props.field.tip)),s().createElement("div",{className:`mailpoet-form-field-${this.props.field.name} form-field-row-${this.props.field.name}`},t,n,e)}}De.propTypes={onValueChange:b().func,field:b().shape({name:b().string.isRequired,values:b().objectOf(b().string),tip:b().oneOfType([b().array,b().string]),label:b().string,fields:b().arrayOf(b().object),description:b().string}).isRequired,item:b().object.isRequired},De.defaultProps={onValueChange:function(){}};var xe=De,Re=n(76599);class Oe extends s().Component{constructor(e){super(e),(0,C.Z)(this,"getValues",(()=>this.props.item||this.state.item)),(0,C.Z)(this,"getErrors",(()=>this.props.errors||this.state.errors)),(0,C.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,C.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,C.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=s().createRef(),this.state={loading:!1,errors:[],item:{}}}componentDidMount(){void 0!==this.props.params.id?this.loadItem(this.props.params.id):le()((()=>{this.setState({item:m()(".mailpoet_form").mailpoetSerializeObject()})}))}componentDidUpdate(e){void 0===this.props.params.id&&e.location.pathname!==this.props.location.pathname&&(le()((()=>{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=>s().createElement("div",{className:"mailpoet_notice notice inline error is-dismissible",key:`error-${e.message}`},s().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))),s().createElement(xe,{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:s().createElement(Re.Button,{type:"submit",isDisabled:this.state.loading},h.Z.I18n.t("save")),s().createElement("div",null,s().createElement("div",{className:"mailpoet-form-content-around"},n),s().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,s().createElement("div",{className:"mailpoet-form-grid"},r,s().createElement("div",{className:"mailpoet-form-actions"},i))),s().createElement("div",{className:"mailpoet-form-content-around"},a))}}Oe.propTypes={params:b().shape({id:b().string}),location:b().shape({pathname:b().string}),item:b().object,errors:b().arrayOf(b().object),endpoint:b().string,fields:b().arrayOf(b().object),messages:b().shape({onUpdate:b().func,onCreate:b().func}),loading:b().bool,children:b().array,id:b().string,automationId:b().string,beforeFormContent:b().func,afterFormContent:b().func,onItemLoad:b().func,isValid:b().func,onChange:b().func,onSubmit:b().func,onSuccess:b().func,history:b().shape({push:b().func.isRequired}).isRequired},Oe.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 Pe=(0,d.withRouter)(Oe),Le=n(86529),Me=n(71014);const Ae=[{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=""}Ae.push(t)}));const Fe={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 qe(e){if(Number(e.wp_user_id)>0)return s().createElement("p",{className:"description"},R()(h.Z.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,((t,n)=>s().createElement("a",{key:n,href:`user-edit.php?user_id=${e.wp_user_id}`},t))))}function $e(e){var t;return s().createElement(s().Fragment,null,null==e||null===(t=e.unsubscribes)||void 0===t?void 0:t.map((e=>{const t=oe()(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?R()(h.Z.I18n.t("unsubscribedNewsletter").replace("%1$d",t),/\[link\]/g,((t,n)=>s().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),s().createElement("p",{className:"description",key:n},n)})),s().createElement("p",{className:"description"},s().createElement("strong",null,h.Z.I18n.t("tip"))," ",h.Z.I18n.t("customFieldsTip")))}const Ue=({match:e})=>{var t;const n=(0,d.useLocation)(),a=(0,d.useHistory)(),r=(null===(t=n.state)||void 0===t?void 0:t.backUrl)||"/";return s().createElement("div",null,s().createElement(Le.Z,{color:"#fff"}),s().createElement(Me.Z,null),s().createElement(Ne.Z,{level:1,className:"mailpoet-title"},s().createElement("span",null,h.Z.I18n.t("subscriber")),s().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:r},h.Z.I18n.t("backToList"))),s().createElement(P,null),s().createElement(Pe,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:Ae,params:e.params,messages:Fe,beforeFormContent:qe,afterFormContent:$e,onSuccess:()=>a.push(r)}))};Ue.propTypes={match:b().shape({params:b().shape({id:b().string}).isRequired}).isRequired};var je=Ue,We=n(5830),Ve=n(71304),Ye=({email:e})=>{var t;const n=(null===(t=(0,d.useLocation)().state)||void 0===t?void 0:t.backUrl)||"/";return s().createElement(Ne.Z,{level:1,className:"mailpoet-title"},s().createElement("span",null,h.Z.I18n.t("statsHeading").replace("%s",e)),s().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:n},h.Z.I18n.t("backToList")))},Be=n(83213),He=({totalSent:e,open:t,machineOpen:n,click:a,subscriber:r})=>{let i=0,o=0,l=0,c=0;const u=e-(t+n),d=e>0;return d&&(i=Math.round(t/e*100),o=Math.round(n/e*100),l=Math.round(a/e*100),c=Math.round(u/e*100)),s().createElement("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary"},s().createElement("div",{className:"mailpoet-listing"},s().createElement("table",{className:"mailpoet-listing-table"},s().createElement("tbody",null,s().createElement("tr",null,s().createElement("td",null,h.Z.I18n.t("statsSentEmail")),s().createElement("td",null,s().createElement("b",null,e.toLocaleString())),s().createElement("td",null)),s().createElement("tr",null,s().createElement("td",null,s().createElement(w.Z,null,h.Z.I18n.t("statsOpened"))),s().createElement("td",null,s().createElement("b",null,t.toLocaleString())),s().createElement("td",null,d&&s().createElement(s().Fragment,null,i,"%"))),s().createElement("tr",null,s().createElement("td",null,s().createElement(w.Z,null,h.Z.I18n.t("statsMachineOpened")),s().createElement(Be.default,{tooltip:R()(h.Z.I18n.t("statsMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>s().createElement("span",{style:{pointerEvents:"all"},key:"machine-opened-info"},s().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))))})),s().createElement("td",null,s().createElement("b",null,n.toLocaleString())),s().createElement("td",null,d&&s().createElement(s().Fragment,null,o,"%"))),s().createElement("tr",null,s().createElement("td",null,s().createElement(w.Z,{isInverted:!0},h.Z.I18n.t("statsClicked"))),s().createElement("td",null,s().createElement("b",null,a.toLocaleString())),s().createElement("td",null,d&&s().createElement(s().Fragment,null,l,"%"))),s().createElement("tr",null,s().createElement("td",null,h.Z.I18n.t("statsNotClicked")),s().createElement("td",null,s().createElement("b",null,u.toLocaleString())),s().createElement("td",null,d&&s().createElement(s().Fragment,null,c,"%"))),s().createElement("tr",null,s().createElement("td",null,h.Z.I18n.t("statisticsColumn")),s().createElement("td",null,s().createElement("div",{className:"mailpoet-listing-stats"},s().createElement(K,{id:r.id,engagementScore:r.engagement_score}))),s().createElement("td",null))))))},ze=({revenueValue:e,count:t,averageRevenueValue:n})=>s().createElement("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary"},s().createElement("div",{className:"mailpoet-listing"},s().createElement("table",{className:"mailpoet-listing-table"},s().createElement("tbody",null,s().createElement("tr",null,s().createElement("td",null,"Orders created"),s().createElement("td",null,s().createElement("b",null,t.toLocaleString()))),s().createElement("tr",null,s().createElement("td",null,"Total revenue"),s().createElement("td",null,s().createElement("b",null,e))),s().createElement("tr",null,s().createElement("td",null,"Average revenue"),s().createElement("td",null,s().createElement("b",null,n))))))),Ke=n(68390),Ge=n.n(Ke);const Qe=({title:e})=>s().createElement("span",{className:"mailpoet-badge"},e);Qe.propTypes={title:b().string.isRequired};var Xe=Qe;const Je=({title:e,message:t,actionButton:n})=>s().createElement("div",{className:"mailpoet-premium-required"},s().createElement("div",{className:"mailpoet-premium-required-message"},s().createElement(Ne.Z,{level:5},s().createElement(Xe,{title:"Premium"})," ",e),t),s().createElement("div",{className:"mailpoet-premium-required-button"},n));Je.propTypes={title:b().string.isRequired,message:b().node.isRequired,actionButton:b().node.isRequired};var et=Je;const tt=({limitReached:e,limitValue:t,subscribersCountTowardsLimit:n,premiumActive:a,hasValidApiKey:r,hasPremiumSupport:i})=>s().createElement("table",{className:"mailpoet-listing-table","data-automation-id":"subscriber-stats-no-access"},s().createElement("thead",null,s().createElement("tr",null,s().createElement("th",null,h.Z.I18n.t("email")),s().createElement("th",null,h.Z.I18n.t("columnAction")),s().createElement("th",null,h.Z.I18n.t("columnCount")),s().createElement("th",null,h.Z.I18n.t("columnActionOn")))),s().createElement("tbody",null,s().createElement("tr",null,s().createElement("td",{colSpan:4},s().createElement("div",{className:"mailpoet-subscriber-stats-no-access-content"},s().createElement(et,{title:a&&e?h.Z.I18n.t("upgradeRequired"):h.Z.I18n.t("premiumFeature"),message:(()=>{let e=h.Z.I18n.t("premiumRequired");return a?(e=i?h.Z.I18n.t("planLimitReached"):h.Z.I18n.t("freeLimitReached"),s().createElement("p",null,R()(e,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?n:t)))):s().createElement("p",null,R()(e,/\[link](.*?)\[\/link]/g,(e=>s().createElement("a",{key:e,href:h.Z.premiumLink},e))))})(),actionButton:a&&e?s().createElement(y.Z,{href:r?h.Z.MailPoetComUrlFactory.getUpgradeUrl():h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(n+1)},h.Z.I18n.t("premiumBannerCtaUpgrade")):s().createElement(y.Z,{href:h.Z.MailPoetComUrlFactory.getFreePlanUrl({utm_medium:"stats",utm_campaign:"signup"})},h.Z.I18n.t("premiumBannerCtaFree"))}))))));tt.propTypes={limitReached:b().bool.isRequired,limitValue:b().number.isRequired,subscribersCountTowardsLimit:b().number.isRequired,premiumActive:b().bool.isRequired,hasValidApiKey:b().bool.isRequired,hasPremiumSupport:b().bool.isRequired};var nt=tt;const at=({params:e,location:t})=>s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:4},h.Z.I18n.t("openedEmailsHeading")),!h.Z.premiumActive||h.Z.subscribersLimitReached?s().createElement(nt,{limitReached:h.Z.subscribersLimitReached,limitValue:h.Z.subscribersLimit,subscribersCountTowardsLimit:h.Z.subscribersCount,premiumActive:h.Z.premiumActive,hasValidApiKey:h.Z.hasValidApiKey,hasPremiumSupport:h.Z.hasPremiumSupport}):Ge().applyFilters("mailpoet_subscribers_opened_emails_stats",e,t));at.propTypes={params:b().shape({id:b().string.isRequired}).isRequired};var rt=at;const it=()=>{const e=(0,d.useRouteMatch)(),t=(0,d.useLocation)(),[n,a]=(0,o.useState)(null),[r,i]=(0,o.useState)(!0),l=(0,Ve.S)(window).notices.error;return(0,o.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(s().createElement(s().Fragment,null,e.errors.map((e=>s().createElement("p",{key:e.message},e.message)))),{scroll:!0})}))}),[e.params.id,l]),r?s().createElement(We.Z,null):s().createElement("div",{className:"mailpoet-subscriber-stats"},s().createElement(Ye,{email:n.email}),s().createElement("p",null,h.Z.I18n.t("lastEngagement"),": ",n.last_engagement?h.Z.Date.format(n.last_engagement):h.Z.I18n.t("never")),s().createElement("div",{className:"mailpoet-subscriber-stats-summary-grid"},s().createElement(He,{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&&s().createElement(ze,{averageRevenueValue:n.woocommerce.formatted_average,count:n.woocommerce.count,revenueValue:n.woocommerce.formatted})),s().createElement(rt,{params:e.params,location:t}))};var ot=n(93726);const st=()=>s().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},s().createElement(u.UT,null,s().createElement(ot.Z,null),s().createElement(d.Switch,null,s().createElement(d.Route,{path:"/new",component:je}),s().createElement(d.Route,{path:"/edit/:id",component:je}),s().createElement(d.Route,{path:"/stats/:id/(.*)?",component:it}),s().createElement(d.Route,{path:"*",component:re})))),lt=document.getElementById("subscribers_container");lt&&c().render(s().createElement(st,null),lt);class ct extends s().PureComponent{render(){const e=this.props.event,t=e.soon;let n;if(this.props.premium)n=s().createElement("a",{href:"?page=mailpoet-premium",target:"_blank"},h.Z.I18n.t("premiumFeatureLink"));else if(e.actionButtonLink&&e.actionButtonTitle)n=s().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=s().createElement(y.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 s().createElement("div",{"data-type":e.slug,className:"mailpoet-newsletter-type"},s().createElement("div",{className:"mailpoet-newsletter-type-image"},e.badge&&s().createElement(Xe,{title:e.badge.text})),s().createElement("div",{className:"mailpoet-newsletter-type-content"},s().createElement(Ne.Z,{level:4},e.title," ",e.soon&&`(${h.Z.I18n.t("soon")})`),s().createElement("p",null,e.description),s().createElement("div",{className:"mailpoet-flex-grow"}),s().createElement("div",{className:"mailpoet-newsletter-type-action"},n)))}}ct.defaultProps={premium:!1},ct.propTypes={premium:b().bool,eventsConfigurator:b().func.isRequired,event:b().shape({slug:b().string.isRequired,actionButtonLink:b().string,title:b().string.isRequired,soon:b().bool,badge:b().shape({style:b().string,text:b().string}),description:b().string.isRequired,actionButtonTitle:b().string}).isRequired};var ut=ct;class dt extends s().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)=>s().createElement(ut,{premium:this.email.premium,event:e,key:t,eventsConfigurator:this.eventsConfigurator})))}}dt.propTypes={email:b().shape({title:b().string.isRequired,slug:b().string.isRequired,premium:b().bool}).isRequired,history:b().shape({push:b().func.isRequired}).isRequired};var pt=(0,d.withRouter)(dt),mt={woocommerce:s().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"}},s().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"}),s().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"}))},ht=n(33687);const ft=({errors:e})=>e.length<1?null:s().createElement(O.Z,{type:"error",closable:!1},e.map((e=>s().createElement("p",{key:e.message},e.message))));ft.propTypes={errors:b().arrayOf(b().shape({message:b().string.isRequired})).isRequired};var gt=ft;const vt=({filter:e,history:t,hideClosingButton:n=!1,hideScreenOptions:a=!0})=>{const[r,i]=(0,o.useState)(!1),l=e=>{void 0!==e&&(t.push(`/new/${e}`),h.Z.trackEvent("Emails > Type selected",{"Email type":e}))},c=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?s().createElement(gt,{errors:e.errors}):null}return window.location.href=`?page=mailpoet-newsletter-editor&id=${e}`,null},u=e=>{const t=!0===window.mailpoet_is_new_user?"mailpoet_badge mailpoet_badge_video":"mailpoet_badge mailpoet_badge_video mailpoet_badge_video_grey";return s().createElement("div",{key:e.slug,"data-type":e.slug,className:"mailpoet-newsletter-type"},s().createElement("div",{className:"mailpoet-newsletter-type-image"}),s().createElement("div",{className:"mailpoet-newsletter-type-content"},s().createElement(Ne.Z,{level:4},e.title," ",e.beta?`(${h.Z.I18n.t("beta")})`:""),s().createElement("p",null,e.description),e.videoGuide&&s().createElement("a",{className:t,href:e.videoGuide,"data-beacon-article":e.videoGuideBeacon,target:"_blank",rel:"noopener noreferrer"},s().createElement("span",{className:"dashicons dashicons-format-video"}),h.Z.I18n.t("seeVideoGuide")),s().createElement("div",{className:"mailpoet-flex-grow"}),s().createElement("div",{className:"mailpoet-newsletter-type-action"},e.action)))},d=T.ZP.partial((e=>{i(!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=>{t.push(`/template/${e.data.id}`)})).fail((e=>(i(!1),e.errors.length>0?s().createElement(gt,{errors:e.errors}):null)))}),"standard"),p=T.ZP.partial(l,"notification"),m=T.ZP.partial(l,"welcome"),f=T.ZP.partial(l,"re-engagement"),g=[{slug:"standard",title:h.Z.I18n.t("regularNewsletterTypeTitle"),description:h.Z.I18n.t("regularNewsletterTypeDescription"),action:s().createElement(y.Z,{automationId:"create_standard",onClick:d,tabIndex:0,withSpinner:r,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),d())}},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:s().createElement(y.Z,{onClick:m,automationId:"create_welcome",withSpinner:r,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),m())},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:s().createElement(y.Z,{automationId:"create_notification",onClick:p,withSpinner:r,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),p())}},h.Z.I18n.t("setUp"))},{slug:"re_engagement",title:h.Z.I18n.t("tabReEngagementTitle"),description:h.Z.I18n.t("reEngagementDescription"),action:s().createElement(y.Z,{automationId:"create_notification",onClick:f,withSpinner:r,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),f())}},h.Z.I18n.t("setUp"))}];let v=Ge().applyFilters("mailpoet_newsletters_types",[...g],void 0);e&&(v=v.filter(e));const b=h.Z.Ajax.constructGetUrl({api_version:h.Z.apiVersion,endpoint:"newsletterTemplates",action:"getAll"});return s().createElement(s().Fragment,null,a&&s().createElement(Me.Z,null),s().createElement("link",{rel:"prefetch",href:window.mailpoet_editor_javascript_url,as:"script"}),s().createElement("div",{className:"mailpoet-newsletter-types"},!n&&s().createElement("div",{className:"mailpoet-newsletter-types-close"},s().createElement("button",{type:"button",onClick:()=>t.push("/"),className:"mailpoet-modal-close"},ht.Z)),v.map((e=>u(e)),void 0),(()=>{if(!window.mailpoet_woocommerce_automatic_emails)return[];let n=window.mailpoet_woocommerce_automatic_emails;return e&&(n=T.ZP.filter(n,e)),T.ZP.map(n,(n=>{const a=n;return s().createElement(s().Fragment,{key:a.slug},!e&&s().createElement("div",{className:"mailpoet-newsletter-types-separator"},s().createElement("div",{className:"mailpoet-newsletter-types-separator-line"}),s().createElement("div",{className:"mailpoet-newsletter-types-separator-logo"},mt[a.slug]||null),s().createElement("div",{className:"mailpoet-newsletter-types-separator-line"})),s().createElement(pt,{email:a,history:t}),"woocommerce"===a.slug&&(h.Z.isWoocommerceActive?[{slug:"wc_transactional",title:h.Z.I18n.t("wooCommerceCustomizerTypeTitle"),description:h.Z.I18n.t("wooCommerceCustomizerTypeDescription"),action:s().createElement(y.Z,{automationId:"customize_woocommerce",onClick:c,tabIndex:0,onKeyDown:async e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),await c())}},h.Z.I18n.t("customize"))}]:[]).map((e=>u(e)),void 0))}))})()),s().createElement("link",{rel:"prefetch",href:b,as:"fetch"}))};vt.propTypes={filter:b().func,hideScreenOptions:b().bool,hideClosingButton:b().bool},vt.defaultProps={filter:null,hideScreenOptions:!0,hideClosingButton:!1};var bt=(0,d.withRouter)(vt),yt=n(21526),wt=(0,d.withRouter)((e=>s().createElement(yt.Z,e))),Et=n(80416),_t=n(12912),Zt=n(97762);const It=e=>(h.Z.Modal.popup({title:e.title,template:Zt.renderToString(s().createElement(s().Fragment,null,s().createElement("p",null,e.message),s().createElement("button",{id:"mailpoet_alert_cancel",className:"button button-secondary",type:"button"},e.cancelLabel),s().createElement("button",{id:"mailpoet_alert_confirm",className:"button button-primary",type:"submit"},e.confirmLabel))),onInit:()=>{document.getElementById("mailpoet_alert_confirm").addEventListener("click",(()=>{h.Z.Modal.close(),e.onConfirm()})),document.getElementById("mailpoet_alert_cancel").addEventListener("click",(()=>h.Z.Modal.close()))}}),null);function St(e){Zt.renderToString(s().createElement(It,{title:e.title,message:e.message,cancelLabel:e.cancelLabel,confirmLabel:e.confirmLabel,onConfirm:e.onConfirm}))}It.propTypes={title:b().string,message:b().string.isRequired,cancelLabel:b().string,confirmLabel:b().string,onConfirm:b().func.isRequired},It.defaultProps={title:h.Z.I18n.t("confirmTitle"),cancelLabel:h.Z.I18n.t("cancelLabel"),confirmLabel:h.Z.I18n.t("confirmLabel")};class kt extends s().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;St({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=>s().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=>s().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=s().createElement("a",{className:"mailpoet-template-preview",href:"#",onClick:e=>{e.preventDefault(),this.onPreview(e)}},s().createElement("div",{className:"mailpoet-template-thumbnail"},n?s().createElement("img",{src:n,alt:h.Z.I18n.t("templatePreview"),loading:"lazy"}):""),s().createElement("div",{className:"mailpoet-template-preview-overlay"},s().createElement(y.Z,null,h.Z.I18n.t("zoom"))))),s().createElement(_t.Z,{label:t,onSelect:this.onSelect,onDelete:!1===a?this.onDelete:void 0,automationId:`select_template_${e}`,className:"mailpoet-template-two-lines"},r)}}kt.contextType=Ve.k,kt.propTypes={index:b().number.isRequired,id:b().number.isRequired,newsletterId:b().string.isRequired,name:b().string.isRequired,thumbnail:b().string,readonly:b().bool.isRequired,beforeDelete:b().func.isRequired,afterDelete:b().func.isRequired,beforeSelect:b().func.isRequired,afterSelect:b().func.isRequired},kt.defaultProps={thumbnail:null};var Ct=kt;class Tt extends s().Component{constructor(e){super(e),this.fileRef=s().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(s().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=>s().createElement("p",{key:e.message},e.message))),{scroll:!0}),a(!1)}))}render(){return s().createElement("div",{className:"mailpoet-template-import"},s().createElement("h4",null,h.Z.I18n.t("importTemplateTitle"),s().createElement(q(),{tooltip:h.Z.I18n.t("helpTooltipTemplateUpload"),place:"right",className:"tooltip-help-import-template"})),s().createElement("form",{onSubmit:this.handleSubmit},s().createElement("input",{type:"file",placeholder:h.Z.I18n.t("selectJsonFileToUpload"),ref:this.fileRef}),s().createElement("p",{className:"submit"},s().createElement("input",{className:"button button-primary",type:"submit",value:h.Z.I18n.t("upload")}))))}}Tt.contextType=Ve.k,Tt.propTypes={beforeImport:b().func.isRequired,afterImport:b().func.isRequired};var Nt=Tt;const Dt=[];window.mailpoet_newsletters_templates_recently_sent_count&&Dt.push({name:"recent",label:h.Z.I18n.t("recentlySent")}),Dt.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&&Dt.push({name:"woocommerce",label:h.Z.I18n.t("tabWoocommerceTitle")}),Dt.push({name:"saved",label:h.Z.I18n.t("savedTemplates")});class xt extends s().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=>s().createElement("p",{key:e.message},e.message))),{scroll:!0})})).always((()=>{this.selectInitialTab()}))}addTemplate(e){const t=Dt.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(Dt,{name:n.data.type})?t=n.data.type:"automatic"===n.data.type&&T.ZP.findWhere(Dt,{name:n.data.options.group})&&(t=n.data.options.group)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>s().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 s().createElement(We.Z,null);const e=Dt.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=s().createElement(Nt,{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:s().createElement("p",null,h.Z.I18n.t("noTemplates")):e.map(((e,t)=>s().createElement(Ct,{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 s().createElement("div",null,s().createElement(Le.Z,{color:"#fff"}),s().createElement(wt,{emailType:this.state.emailType,automationId:"email_template_selection_heading"}),s().createElement("div",{className:"mailpoet-templates"},s().createElement(Et.Z,{categories:e,active:this.state.selectedTab,onSelect:e=>this.setState({selectedTab:e})}),t))}}xt.contextType=Ve.k,xt.propTypes={match:b().shape({params:b().shape({id:b().string}).isRequired}).isRequired};var Rt=xt,Ot=n(11830),Pt=n(9198),Lt=n.n(Pt);const Mt=({dimension:e,isFullWidth:t,iconStart:n,iconEnd:a,...r})=>{var i;return s().createElement("div",{className:g()("mailpoet-datepicker mailpoet-form-input",{[`mailpoet-form-input-${e}`]:e,"mailpoet-disabled":r.disabled,"mailpoet-full-width":t})},n,s().createElement(Lt(),(0,k.Z)({useWeekdaysShort:!0,calendarStartDay:null!==(i=r.calendarStartDay)&&void 0!==i?i:h.Z.wpWeekStartsOn},r)),a)};Mt.propTypes={dimension:b().oneOf(["small"]),isFullWidth:b().bool,iconStart:b().element,iconEnd:b().element};var At=Mt,Ft=n(4958),qt=n(16245),$t=n.n(qt);const Ut={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")]},jt={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")]};Ft.Z.localize.month=$t()({values:Ut,defaultWidth:"wide"}),Ft.Z.localize.day=$t()({values:jt,defaultWidth:"wide"}),Ft.Z.options.weekStartsOn=void 0!==h.Z.wpWeekStartsOn?h.Z.wpWeekStartsOn:1,(0,Pt.registerLocale)("mailpoet",Ft.Z);class Wt extends s().Component{constructor(...e){super(...e),(0,C.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,C.Z)(this,"getFieldName",(()=>this.props.name||"date")),(0,C.Z)(this,"getDisplayDateFormat",(e=>h.Z.Date.convertFormat(e).replace(/D/g,"d").replace(/Y/g,"y").replace(/\[/g,"").replace(/\]/g,""))),(0,C.Z)(this,"getDate",(e=>{const t={parseFormat:this.props.storageFormat};return h.Z.Date.toDate(e,t)})),(0,C.Z)(this,"getStorageDate",(e=>{const t={format:this.props.storageFormat};return h.Z.Date.format(e,t)}))}render(){return s().createElement(At,(0,k.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))}}Wt.propTypes={displayFormat:b().string.isRequired,onChange:b().func.isRequired,name:b().string,storageFormat:b().string.isRequired,value:b().string.isRequired,disabled:b().bool.isRequired,validation:b().shape({"data-parsley-required":b().bool,"data-parsley-required-message":b().string,"data-parsley-type":b().string,"data-parsley-errors-container":b().string,maxLength:b().number}).isRequired,maxDate:b().instanceOf(Date)},Wt.defaultProps={name:"date",maxDate:null};var Vt=Wt;class Yt extends s().Component{render(){const e=Object.keys(this.props.timeOfDayItems).map((e=>s().createElement("option",{key:`option-${this.props.timeOfDayItems[e]}`,value:e},this.props.timeOfDayItems[e])));return s().createElement(fe.Z,(0,k.Z)({name:this.props.name||"time",value:this.props.value,disabled:this.props.disabled,onChange:this.props.onChange,isMinWidth:!0},this.props.validation),e)}}Yt.propTypes={timeOfDayItems:b().objectOf(b().string).isRequired,name:b().string,value:b().string.isRequired,disabled:b().bool,onChange:b().func.isRequired,validation:b().object},Yt.defaultProps={name:"time",disabled:!1,validation:{}};var Bt=Yt;class Ht extends s().Component{constructor(e){super(e),(0,C.Z)(this,"DATE_TIME_SEPARATOR"," "),(0,C.Z)(this,"getDateTime",(()=>[this.state.date,this.state.time].join(this.DATE_TIME_SEPARATOR))),(0,C.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,C.Z)(this,"handleChange",(e=>{const t={};t[e.target.name]=e.target.value,this.setState(t,this.propagateChange)})),(0,C.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||le()((()=>{this.setState(this.buildStateFromProps(this.props))}))}render(){return s().createElement(Ot.r.Column,{className:"mailpoet-datetime-container"},s().createElement(Vt,{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}),s().createElement(Bt,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems}))}}Ht.propTypes={value:b().string,defaultDateTime:b().string.isRequired,dateDisplayFormat:b().string.isRequired,dateStorageFormat:b().string.isRequired,onChange:b().func,name:b().string,disabled:b().bool,dateValidation:b().object.isRequired,timeValidation:b().any,timeOfDayItems:b().objectOf(b().string).isRequired,maxDate:b().instanceOf(Date)},Ht.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0,value:void 0,maxDate:null};var zt=Ht,Kt=n(43246);class Gt extends s().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 s().createElement(s().Fragment,null,s().createElement(de,{item:{...this.props.item,sender_address:this.state.emailAddress},field:this.props.field,onValueChange:this.onChange}),s().createElement("div",{className:"regular-text"},s().createElement(Kt.Z,{emailAddress:this.state.emailAddress,mssActive:window.mailpoet_mss_active})))}}Gt.propTypes={field:b().object.isRequired,item:b().shape({sender_address:b().string.isRequired}).isRequired,onValueChange:b().func},Gt.defaultProps={onValueChange:function(){}};var Qt=Gt;const Xt=T.ZP.once((()=>h.Z.trackEvent("User has typed a GA campaign name"))),Jt=R()(h.Z.I18n.t("gaCampaignTip"),/\[link\](.*?)\[\/link\]/g,((e,t)=>s().createElement("span",{key:t},s().createElement("br",null),s().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 en={name:"ga_campaign",label:h.Z.I18n.t("gaCampaignLine"),tip:Jt,type:"text",onBeforeChange:Xt};const tn=({dimension:e,onCheck:t,automationId:n,className:a,...r})=>s().createElement("label",{className:g()({[a]:a,"mailpoet-form-toggle":!0,[`mailpoet-form-toggle-${e}`]:e,"mailpoet-disabled":r.disabled}),"data-automation-id":n},s().createElement("input",(0,k.Z)({type:"checkbox",onChange:e=>t(e.target.checked,e)},r)),s().createElement("span",{className:"mailpoet-form-toggle-control"}));tn.propTypes={dimension:b().oneOf(["small"]),onCheck:b().func.isRequired,automationId:b().string};var nn=tn;const an=window.mailpoet_current_time||"00:00",rn=`${window.mailpoet_current_date} 00:00:00`,on=window.mailpoet_schedule_time_of_day,sn=window.mailpoet_date_display_format,ln=window.mailpoet_date_storage_format;class cn extends s().Component{constructor(...e){super(...e),(0,C.Z)(this,"getCurrentValue",(()=>{const e={isScheduled:"0",scheduledAt:rn};return T.ZP.defaults(this.props.item[this.props.field.name]||{},e)})),(0,C.Z)(this,"getDateValidation",(()=>({"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("noScheduledDateError"),"data-parsley-errors-container":"#mailpoet_scheduling"}))),(0,C.Z)(this,"isScheduled",(()=>"1"===this.getCurrentValue().isScheduled)),(0,C.Z)(this,"handleCheckboxChange",((e,t)=>{const n=t;return n.target.value=t.target.checked?"1":"0",this.handleValueChange(n)})),(0,C.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=s().createElement(s().Fragment,null,s().createElement("span",{className:"mailpoet-form-schedule-time"},h.Z.I18n.t("websiteTimeIs")," ",an),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{id:"mailpoet_scheduling"},s().createElement(zt,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:rn,timeOfDayItems:on,dateDisplayFormat:sn,dateStorageFormat:ln,maxDate:t})))),s().createElement("div",null,s().createElement(nn,{checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onCheck:this.handleCheckboxChange,automationId:"email-schedule-checkbox"}),e)}}cn.propTypes={item:b().object,field:b().shape({name:b().string.isRequired,disabled:b().bool}).isRequired,onValueChange:b().func.isRequired},cn.defaultProps={item:{}};let un=[{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:cn},{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:Qt,placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},en,{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"}}]}];un=Ge().applyFilters("mailpoet_newsletters_3rd_step_fields",un);var dn={getFields:function(){return un},getSendButtonOptions:function(e){const t=e||{},n={value:"object"==typeof t.options&&"1"===t.options.isScheduled?h.Z.I18n.t("schedule"):h.Z.I18n.t("send")};return"sent"!==t.status&&"sending"!==t.status||(n.disabled="disabled"),n}};const pn=window.mailpoet_time_format||"H:i",mn={immediate:h.Z.I18n.t("delayImmediately"),hours:h.Z.I18n.t("delayHoursAfter"),days:h.Z.I18n.t("delayDaysAfter"),weeks:h.Z.I18n.t("delayWeeksAfter")},hn={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")},fn=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:pn,offset:0})]}))),gn={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")},vn=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]}))),bn={1:h.Z.I18n.t("first"),2:h.Z.I18n.t("second"),3:h.Z.I18n.t("third"),L:h.Z.I18n.t("last")},yn={name:"intervalType",values:hn},wn={name:"timeOfDay",values:fn},En={name:"weekDay",values:gn},_n={name:"monthDay",values:vn},Zn={name:"nthWeekDay",values:bn};class In extends s().Component{constructor(...e){super(...e),(0,C.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,C.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,C.Z)(this,"handleIntervalChange",(e=>{const t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),this.handleValueChanges(n)})),(0,C.Z)(this,"handleTimeOfDayChange",(e=>this.handleValueChanges({timeOfDay:e.target.value}))),(0,C.Z)(this,"handleWeekDayChange",(e=>this.handleValueChanges({weekDay:e.target.value}))),(0,C.Z)(this,"handleMonthDayChange",(e=>this.handleValueChanges({monthDay:e.target.value}))),(0,C.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=s().createElement(ve,{field:wn,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==e.intervalType&&"nthWeekDay"!==e.intervalType||(n=s().createElement(ve,{field:En,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===e.intervalType&&(a=s().createElement(ve,{field:_n,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===e.intervalType&&(r=s().createElement(ve,{field:Zn,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),s().createElement("div",null,s().createElement(ve,{field:yn,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{className:"mailpoet-grid-column mailpoet-flex"},r,a,n,t),"immediately"!==e.intervalType&&s().createElement("div",{className:"mailpoet-gap"}))}}In.propTypes={item:b().object.isRequired,field:b().shape({name:b().string}).isRequired,onValueChange:b().func.isRequired};var Sn=In;let kn=[{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:Sn},{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:Qt,placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},en,{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"}}]}];kn=Ge().applyFilters("mailpoet_newsletters_3rd_step_fields",kn);var Cn={getFields:function(){return kn},getSendButtonOptions:function(){return{value:h.Z.I18n.t("activate")}}};const Tn=window.mailpoet_roles||{},Nn=T.ZP.filter(window.mailpoet_segments||[],(e=>"default"===e.type)),Dn={name:"event",values:{segment:h.Z.I18n.t("onSubscriptionToList"),user:h.Z.I18n.t("onWPUserRegistration")}},xn={name:"segment",placeholder:h.Z.I18n.t("selectSegmentPlaceholder"),forceSelect2:!0,values:Nn,getCount:e=>parseInt(e.subscribers,10).toLocaleString(),getLabel:e=>e.name,getValue:e=>e.id},Rn={name:"role",values:Tn},On={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")}},Pn={name:"afterTimeType",values:mn};class Ln extends s().Component{constructor(...e){super(...e),(0,C.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,C.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,C.Z)(this,"handleEventChange",(e=>this.handleValueChange("event",e.target.value))),(0,C.Z)(this,"handleSegmentChange",(e=>this.handleValueChange("segment",e.target.value))),(0,C.Z)(this,"handleRoleChange",(e=>this.handleValueChange("role",e.target.value))),(0,C.Z)(this,"handleAfterTimeNumberChange",(e=>this.handleValueChange("afterTimeNumber",e.target.value))),(0,C.Z)(this,"handleAfterTimeTypeChange",(e=>this.handleValueChange("afterTimeType",e.target.value)))}render(){const e=this.getCurrentValue();let t,n;return t="user"===e.event?s().createElement(ve,{field:Rn,item:this.getCurrentValue(),onValueChange:this.handleRoleChange}):s().createElement(D,{field:xn,item:this.getCurrentValue(),onValueChange:this.handleSegmentChange}),"immediate"!==e.afterTimeType&&(n=s().createElement(de,{field:On,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeNumberChange})),s().createElement("div",null,s().createElement(ve,{field:Dn,item:this.getCurrentValue(),onValueChange:this.handleEventChange}),s().createElement("div",{className:"mailpoet-gap"}),t,s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{className:"mailpoet-grid-column mailpoet-flex"},n,s().createElement(ve,{field:Pn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeTypeChange})),s().createElement("div",{className:"mailpoet-form-errors"}),s().createElement("div",{className:"mailpoet-gap"}))}}Ln.propTypes={history:b().shape({push:b().func.isRequired}).isRequired,item:b().object.isRequired,field:b().shape({name:b().string}).isRequired,onValueChange:b().func.isRequired};var Mn=(0,d.withRouter)(Ln);let An=[{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:Mn},en,{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:Qt,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"}}]}];An=Ge().applyFilters("mailpoet_newsletters_3rd_step_fields",An);var Fn={getFields:function(){return An},getSendButtonOptions:function(){return{value:h.Z.I18n.t("activate")}}};class qn extends s().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=mn;e.timeDelayValues&&(t=Object.entries(e.timeDelayValues).reduce(((e,[t,n])=>(e[t]=n.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 s().createElement(D,{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 s().createElement(de,{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 s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-grid-column mailpoet-flex"},this.displayAfterTimeNumberField(),this.displayAfterTimeTypeOptions()),s().createElement("div",{className:"mailpoet-form-errors"}),s().createElement("div",{className:"mailpoet-gap"}),e.schedulingReadMoreLink&&s().createElement(s().Fragment,null,s().createElement("a",{href:e.schedulingReadMoreLink.link,target:"_blank",rel:"noopener noreferrer",className:"event-scheduling-read-more-link"},e.schedulingReadMoreLink.text),s().createElement("div",{className:"mailpoet-gap"})))}}qn.propTypes={item:b().shape({afterTimeType:b().string.isRequired,afterTimeNumber:b().number}).isRequired,afterTimeNumberSize:b().number,onValueChange:b().func,event:b().shape({defaultAfterTimeType:b().string,timeDelayValues:b().objectOf(b().shape({text:b().string,displayAfterTimeNumberField:b().bool})),schedulingReadMoreLink:b().shape({link:b().string.isRequired,text:b().string.isRequired})}).isRequired},qn.defaultProps={afterTimeNumberSize:3,onValueChange:null};var $n=qn;function Un(e){const t=e&&e.values?e.values:[];return t?t.map((e=>({id:e.id,name:e.name}))):t}const jn=({eventOptions:e,eventSlug:t,selected:n,onValueChange:a})=>{function r(e){a&&a({eventOptionValue:e.target.value})}return s().createElement("div",null,s().createElement("div",{className:"event-option-selection"},function(){if(!e)return e;const a={field:{name:`event_options_${t}`,forceSelect2:!0,endpoint:e.endpoint,resetSelect2OnUpdate:!0,values:Un(e),multiple:e.multiple||!1,placeholder:e.placeholder||!1,transformChangedValue:(e,t)=>T.ZP.map(t,(e=>({id:e.id,name:e.text}))),selected:()=>n,getLabel:T.ZP.property("name"),getValue:T.ZP.property("id"),validation:{"data-parsley-required":!0}},onValueChange:r,item:{action:""}};return"product_categories"===e.endpoint&&(a.field.name="category_id",a.item={action:"purchasedCategory"}),"products"===e.endpoint&&(a.field.name="product_id",a.item={action:"purchasedProduct"}),s().createElement(s().Fragment,null,s().createElement(D,{field:a.field,onValueChange:a.onValueChange,item:a.item}),s().createElement("div",{className:"mailpoet-gap"}))}()))};jn.propTypes={eventOptions:b().shape({values:b().arrayOf(b().shape({id:b().string.isRequired,name:b().string.isRequired})),multiple:b().bool.isRequired,placeholder:b().string.isRequired,endpoint:b().string.isRequired}).isRequired,eventSlug:b().string.isRequired,selected:b().arrayOf(b().string).isRequired,onValueChange:b().func.isRequired};var Wn=jn;class Vn extends s().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 s().createElement($n,{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 s().createElement("div",{className:"event-segment-selection"},s().createElement(D,{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))),s().createElement(Wn,{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 o={group:this.email.slug,event:e,afterTimeType:t};n&&(o.afterTimeNumber=n),a&&(o.segment=a),r&&(o.meta=JSON.stringify({option:this.state.eventOptionValue})),i({target:{name:"options",value:o}})}render(){return s().createElement("div",null,s().createElement(Ne.Z,{level:5},this.displayHeader()),this.displayEventOptions(),this.displaySegments(),this.displayScheduling())}}Vn.propTypes={field:b().shape({email:b().shape({events:b().object.isRequired}).isRequired,emailOptions:b().object.isRequired}).isRequired,onValueChange:b().func},Vn.defaultProps={onValueChange:null};var Yn=Vn;const Bn=window.mailpoet_woocommerce_automatic_emails||[];var Hn={getFields:function(e){return(e=>{const t=Bn[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:Yn,email:t,emailOptions:n},en,{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")}}},zn=n(78230),Kn=n(68041);function Gn({afterTimeNumber:e,afterTimeType:t,updateAfterTimeNumber:n,updateAfterTimeType:a,inactiveSubscribersPeriod:r}){const i="weeks"===t?7:30,o=Number(e)*i;let l=r;return 365===r&&(l=360),s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:4},h.Z.I18n.t("selectEventToSendReEngagementEmail")),s().createElement(Ot.r.CenteredRow,{className:"mailpoet-re-engagement-scheduling"},s().createElement("p",null,h.Z.I18n.t("reEngagementTextPre")),s().createElement(ce.Z,{type:"text",placeholder:h.Z.I18n.t("reEngagementAterTimeNumberPlaceholder"),value:e,onChange:(0,Kn.z2)(n)}),s().createElement(fe.Z,{value:t,onChange:(0,Kn.z2)(a)},s().createElement("option",{value:"weeks"},"weeks"),s().createElement("option",{value:"months"},"months"))),!!r&&l<=o&&s().createElement("p",{className:"mailpoet-re-engagement-scheduling-note"},R()(h.Z.I18n.t("reEngagementEmailWarning").replace("{$months}",Math.floor(r/30)),/\[link\](.*?)\[\/link\]/g,(e=>s().createElement("a",{key:"link",href:"https://kb.mailpoet.com/article/264-inactive-subscribers",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"5cbf19622c7d3a026fd3efe1"},e)))))}function Qn(e){return s().createElement(Gn,{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,zn.assoc)("afterTimeNumber",t,e.item.options)}})},updateAfterTimeType:t=>{e.onValueChange({target:{name:"options",value:(0,zn.assoc)("afterTimeType",t,e.item.options)}})}})}Gn.propTypes={afterTimeNumber:b().string.isRequired,afterTimeType:b().string.isRequired,updateAfterTimeNumber:b().func.isRequired,updateAfterTimeType:b().func.isRequired},Qn.propTypes={item:b().shape({options:b().shape({afterTimeNumber:b().oneOfType([b().number,b().string]).isRequired,afterTimeType:b().string.isRequired}).isRequired}).isRequired,onValueChange:b().func.isRequired};const Xn=[{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:Qn},{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,zn.map)((e=>(0,zn.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:Qt,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"}}]},en],Jn={getFields:()=>Xn,getSendButtonOptions:()=>({value:h.Z.I18n.t("activate")})};var ea=n(7358),ta=n(31304),na=n.n(ta);const aa=window.mailpoet_woocommerce_automatic_emails||[],ra=(e,t)=>`${na()(t,{lower:!0}).replace(/[^a-z0-9]+/g,"-").replace(/-$/,"")||"newsletter"}_${e}`;function ia(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:s().createElement("span",{style:{pointerEvents:"all"}},R()(h.Z.I18n.t("reEngagementEmailsDisableIfTrackingIs"),/\[link\](.*?)\[\/link\]/g,(e=>s().createElement("a",{key:"advancedSettingsTabLink",href:"?page=mailpoet-settings#/advanced",rel:"noopener noreferrer"},e))))}class oa extends s().Component{constructor(e){super(e),(0,C.Z)(this,"getFieldsByNewsletter",(e=>this.getSubtype(e).getFields(e))),(0,C.Z)(this,"getSendButtonOptions",(()=>this.getSubtype(this.state.item).getSendButtonOptions(this.state.item))),(0,C.Z)(this,"getSubtype",(e=>{switch(e.type){case"notification":return Cn;case"welcome":return Fn;case"re_engagement":return Jn;case"automatic":if(aa[e.options.group])return Hn;default:return dn}})),(0,C.Z)(this,"getThumbnailPromise",(e=>this.state.thumbnailPromise?this.state.thumbnailPromise:(0,ea.W0)(e))),(0,C.Z)(this,"isValid",(()=>m()("#mailpoet_newsletter").parsley().isValid())),(0,C.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,C.Z)(this,"showInvalidFromAddressError",(()=>{const e=this.state.item.sender_address;let t=R()(h.Z.I18n.t("newsletterInvalidFromAddress"),"%1$s",(()=>e));t=R()(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,C.Z)(this,"removeInvalidFromAddressError",(()=>{m()("#field_sender_address").parsley().removeError("invalidFromAddress",{updateClass:!0})})),(0,C.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=ra(n.id,n.subject)),this.setState({item:e.data,fields:this.getFieldsByNewsletter(e.data),thumbnailPromise:t,validationError:ia(e.data)})})).fail((()=>{this.setState({item:{}},(()=>{this.props.history.push("/new")}))}))))),(0,C.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,C.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,C.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,C.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(s().createElement("p",null,h.Z.I18n.t("newsletterHasBeenScheduled"))),h.Z.trackEvent("Emails > Newsletter sent",{scheduled:!0})):(this.context.notices.success(s().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,C.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&&aa[e.group]?this.context.notices.success(s().createElement("p",null,h.Z.I18n.t("automaticEmailActivated").replace("%1s",aa[e.group].title))):"welcome"===t.data.type?(this.context.notices.success(s().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(s().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,C.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(s().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,C.Z)(this,"handleSave",(e=>{e.preventDefault(),this.saveNewsletter(e).done((()=>{this.context.notices.success(s().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,C.Z)(this,"handleRedirectToDesign",(e=>{e.preventDefault();const t=e.target.href;this.saveNewsletter(e).done((()=>{this.context.notices.success(s().createElement("p",null,h.Z.I18n.t("newsletterUpdated")))})).done((()=>{window.location=t})).fail((e=>{this.showError(e)}))})),(0,C.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,C.Z)(this,"showError",(e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>s().createElement("p",{key:e.message},e.message))),{scroll:!0})})),(0,C.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===ra(a.id,r)&&(a.ga_campaign=ra(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),s().createElement("div",{className:"mailpoet-form-send-email"},s().createElement(Le.Z,{color:"#fff"}),s().createElement(wt,{emailType:r,automationId:"newsletter_send_heading"}),s().createElement(Pe,{id:"mailpoet_newsletter",fields:t,automationId:"newsletter_send_form",item:this.state.item,loading:this.state.loading,onChange:this.handleFormChange,onSubmit:this.handleSave},s().createElement(Ot.r.CenteredRow,{className:"send-newsletter-buttons"},s().createElement(Re.Button,{variant:"secondary",type:"submit",automationId:"email-save-draft"},h.Z.I18n.t("saveDraftAndClose")),e?s().createElement(Re.Button,{type:"button",onClick:this.handleResume,isDisabled:a,automationId:"email-resume"},h.Z.I18n.t("resume")):s().createElement(Re.Button,(0,k.Z)({type:"button",onClick:this.handleSend},n,{isDisabled:a,automationId:"email-submit"}),n.value||h.Z.I18n.t("send")),void 0!==this.state.validationError&&s().createElement(q(),{tooltip:s().createElement("div",null,this.state.validationError),tooltipId:"helpTooltipSendEmail"})),s().createElement("p",null,h.Z.I18n.t("orSimply")," ",s().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&&s().createElement("div",{className:"mailpoet_error"},R()(h.Z.I18n.t("pendingKeyApprovalNotice"),/\[link\](.*?)\[\/link\]/g,(e=>s().createElement("a",{key:"pendingKeyApprovalNoticeLink",href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer"},e))))))}}oa.contextType=Ve.k,oa.propTypes={match:b().shape({params:b().shape({id:b().string}).isRequired}).isRequired,history:b().shape({push:b().func.isRequired}).isRequired};var sa=(0,d.withRouter)(oa);function la(e){const[t,n]=(0,o.useState)(!1);return s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:0},h.Z.I18n.t("congratulationsSuccessHeader")),s().createElement(Ne.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")),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement("img",{src:e.illustrationImageUrl,alt:"",width:"500"}),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement(Re.Button,{type:"button",dimension:"small",onClick:()=>{e.successClicked(),n(!0)},withSpinner:t},h.Z.I18n.t("close")));var a}la.propTypes={successClicked:b().func.isRequired,illustrationImageUrl:b().string.isRequired,newsletter:b().shape({status:b().string.isRequired,type:b().string.isRequired}).isRequired};var ca=la;const ua=e=>s().createElement("div",{className:"mailpoet-wizard-step"},s().createElement("div",{className:"mailpoet-wizard-step-illustration"},s().createElement("img",{src:e.illustrationUrl,width:"500",alt:""})),s().createElement("div",{className:"mailpoet-wizard-step-content"},e.children));ua.propTypes={illustrationUrl:b().string.isRequired,children:b().oneOfType([b().arrayOf(b().node),b().node]).isRequired};var da=ua;const pa=({children:e,isOrdered:t})=>{const n=t?"ol":"ul";return s().createElement(n,{className:`mailpoet-${n}`},e)};pa.propTypes={children:b().node.isRequired,isOrdered:b().bool};var ma=pa;const ha=()=>s().createElement(ma,null,s().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList1")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList2")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList4")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList5"))),fa=e=>s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(y.Z,{isFullWidth:!0,href:e.mailpoetAccountUrl,target:"_blank",rel:"noopener noreferrer",onClick:t=>{t.preventDefault(),window.open(e.mailpoetAccountUrl),e.next()}},e.nextButtonText),s().createElement(y.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")));fa.propTypes={mailpoetAccountUrl:b().string.isRequired,next:b().func.isRequired,nextButtonText:b().string.isRequired,nextWithSpinner:b().bool},fa.defaultProps={nextWithSpinner:!1};const ga=e=>s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("welcomeWizardMSSFreeTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("welcomeWizardMSSFreeSubtitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(Ne.Z,{level:5},h.Z.I18n.t("welcomeWizardMSSFreeListTitle"),":"),s().createElement(ha,null),s().createElement(fa,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next,nextButtonText:h.Z.I18n.t("welcomeWizardMSSFreeButton")}));ga.propTypes={mailpoetAccountUrl:b().string.isRequired,next:b().func.isRequired};const va=e=>s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("welcomeWizardMSSNotFreeTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("welcomeWizardMSSNotFreeSubtitle"),":"),s().createElement(ha,null),s().createElement(fa,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next,nextButtonText:h.Z.I18n.t("welcomeWizardMSSNotFreeButton")}));va.propTypes={mailpoetAccountUrl:b().string.isRequired,next:b().func.isRequired};const ba=e=>s().createElement(s().Fragment,null,e.subscribersCount<1e3?s().createElement(ga,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next}):s().createElement(va,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next}));ba.propTypes={next:b().func.isRequired,subscribersCount:b().number.isRequired,mailpoetAccountUrl:b().string.isRequired};var ya=ba;function wa(e){const[t,n]=(0,o.useState)(!1);return s().createElement(s().Fragment,null,s().createElement(Ne.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"))),s().createElement(da,{illustrationUrl:e.MSSPitchIllustrationUrl},s().createElement("div",{className:"mailpoet-welcome-wizard-step-content"},s().createElement(Ne.Z,{level:4},h.Z.I18n.t("congratulationsMSSPitchSubHeader")),s().createElement("p",null,h.Z.I18n.t(e.subscribersCount<1e3?"welcomeWizardMSSFreeSubtitle":"welcomeWizardMSSNotFreeSubtitle")),s().createElement(Ne.Z,{level:5},h.Z.I18n.t("welcomeWizardMSSFreeListTitle"),":"),s().createElement(ha,null),s().createElement(fa,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:()=>{e.onFinish(),n(!0)},nextButtonText:h.Z.I18n.t("welcomeWizardMSSFreeButton"),nextWithSpinner:t}))));var a}wa.propTypes={MSSPitchIllustrationUrl:b().string.isRequired,onFinish:b().func.isRequired,subscribersCount:b().number.isRequired,mailpoetAccountUrl:b().string.isRequired,newsletter:b().shape({status:b().string.isRequired,type:b().string.isRequired}).isRequired};var Ea=wa;function _a(e){return window.has_mss_key_specified?s().createElement(ca,{successClicked:e.successClicked,illustrationImageUrl:e.illustrationImageUrl,newsletter:e.newsletter}):s().createElement(Ea,{MSSPitchIllustrationUrl:e.MSSPitchIllustrationUrl,onFinish:e.successClicked,subscribersCount:e.subscribersCount,mailpoetAccountUrl:e.mailpoetAccountUrl,newsletter:e.newsletter})}_a.propTypes={successClicked:b().func.isRequired,illustrationImageUrl:b().string.isRequired,MSSPitchIllustrationUrl:b().string.isRequired,newsletter:b().shape({status:b().string.isRequired,type:b().string.isRequired}).isRequired,subscribersCount:b().number.isRequired,mailpoetAccountUrl:b().string.isRequired};var Za=_a;function Ia(e){const[t,n]=(0,o.useState)(!1);return s().createElement("div",null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("congratulationsSendFailHeader")),s().createElement(Ne.Z,{level:3},R()(h.Z.I18n.t("congratulationsSendFailExplain"),/\[link\](.*?)\[\/link\]/g,((e,t)=>s().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)))),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement("img",{src:window.mailpoet_congratulations_error_image,alt:"",width:"500"}),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement(Re.Button,{dimension:"small",type:"button",onClick:()=>{e.failClicked(),n(!0)},withSpinner:t},h.Z.I18n.t("close")))}Ia.propTypes={failClicked:b().func.isRequired};var Sa=Ia,ka=n(63438);function Ca(e){return s().createElement("div",{className:"mailpoet-congratulate-loading"},e.showRichLoadingScreen&&s().createElement("div",null,s().createElement(Ne.Z,{level:0},h.Z.I18n.t("congratulationsLoadingHeader")),s().createElement(Ne.Z,{level:3},h.Z.I18n.t("congratulationsLoadingBody")),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement(ka.Z,{size:64})))}Ca.propTypes={showRichLoadingScreen:b().bool.isRequired};var Ta=Ca;const Na=Math.floor(4*Math.random());function Da(){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 xa extends s().Component{constructor(e){super(e),this.state={loading:!0,newsletter:null,testingPassed:!1,timeStart:oe()(),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(){oe()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),oe()().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,s().createElement(Ta,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:Da,showRichLoadingScreen:e})):this.state.error?(h.Z.trackEvent("Cron testing done",{"Cron is working":"false"}),s().createElement(Sa,{failClicked:()=>{window.location=window.mailpoet_main_page}})):(t=this.state.newsletter,this.state.testingPassed&&h.Z.trackEvent("Cron testing done",{"Cron is working":"true"}),s().createElement(Za,{illustrationImageUrl:window.mailpoet_congratulations_success_images[Na],MSSPitchIllustrationUrl:window.mailpoet_congratulations_success_images[Na],successClicked:Da,newsletter:t,isWoocommerceActive:window.mailpoet_woocommerce_active,subscribersCount:window.mailpoet_subscribers_count,mailpoetAccountUrl:window.mailpoet_account_url}));var e,t}render(){return s().createElement(s().Fragment,null,s().createElement("style",{dangerouslySetInnerHTML:{__html:"body { background: #fff; overflow-x: hidden; }"}}),s().createElement("div",{className:"mailpoet-congratulate"},s().createElement("div",{className:"mailpoet-gap-large"}),this.renderContent()))}}xa.propTypes={match:b().shape({params:b().shape({id:b().string}).isRequired}).isRequired};var Ra=xa;class Oa extends s().Component{constructor(...e){super(...e),(0,C.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=>s().createElement("p",{key:e.message},e.message))),{scroll:!0})}))}render(){return s().createElement("div",null,s().createElement(wt,{emailType:"standard",automationId:"standard_newsletter_creation_heading"}))}}Oa.contextType=Ve.k,Oa.propTypes={history:b().shape({push:b().func.isRequired}).isRequired};var Pa=(0,d.withRouter)(Oa);const La={name:"options",type:"reactComponent",component:Sn};class Ma extends s().Component{constructor(e){super(e),(0,C.Z)(this,"handleValueChange",(e=>{const t=this.state;t[e.target.name]=e.target.value,this.setState(t)})),(0,C.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=>s().createElement("p",{key:e.message},e.message))),{scroll:!0})}))})),(0,C.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 s().createElement("div",null,s().createElement(Le.Z,{color:"#fff"}),s().createElement(wt,{emailType:"notification",automationId:"post_notification_creation_heading"}),s().createElement(Ot.r.Column,{align:"center",className:"mailpoet-schedule-email"},s().createElement(Ne.Z,{level:4},h.Z.I18n.t("selectFrequency")),s().createElement(Sn,{item:this.state,field:La,onValueChange:this.handleValueChange}),s().createElement(y.Z,{isFullWidth:!0,onClick:this.handleNext,type:"button"},h.Z.I18n.t("next"))))}}Ma.contextType=Ve.k,Ma.propTypes={history:b().shape({push:b().func.isRequired}).isRequired};var Aa=(0,d.withRouter)(Ma);const Fa={name:"options",label:"Event",type:"reactComponent",component:Mn};class qa extends s().Component{constructor(e){super(e),(0,C.Z)(this,"isValid",(()=>m()("#welcome_scheduling").parsley().isValid())),(0,C.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 s().createElement("div",null,s().createElement(Le.Z,{color:"#fff"}),s().createElement(wt,{emailType:"welcome",automationId:"welcome_email_creation_heading"}),s().createElement(Ot.r.Column,{align:"center",className:"mailpoet-schedule-email"},s().createElement(Ne.Z,{level:4},h.Z.I18n.t("selectEventToSendWelcomeEmail")),s().createElement("form",{id:"welcome_scheduling"},s().createElement(Mn,{item:this.state,field:Fa,onValueChange:this.handleValueChange}),s().createElement(y.Z,{isFullWidth:!0,type:"submit",onClick:this.handleNext},h.Z.I18n.t("next")))))}}qa.propTypes={history:b().shape({push:b().func.isRequired}).isRequired};var $a=qa;class Ua extends s().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,C.Z)(this,"isValid",(()=>!m()("#newsletter_scheduling").parsley()||m()("#newsletter_scheduling").parsley().isValid())),(0,C.Z)(this,"validate",(()=>{m()("#newsletter_scheduling").parsley()&&m()("#newsletter_scheduling").parsley().validate()})),(0,C.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.constructor.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.constructor.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:o,eventOptionValue:l}=this.state,c={group:this.email.slug,event:n,afterTimeType:a};r&&(c.afterTimeNumber=r),c.sendTo=i.sendToLists?"segment":"user",o&&(c.segment=o),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=>s().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 s().createElement(Wn,{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 s().createElement("div",{className:"event-segment-selection"},s().createElement(D,{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 s().createElement($n,{item:a.item,event:a.event,onValueChange:a.onValueChange})}displayEventTip(){const{event:e}=this.state;return e.tip?s().createElement("p",{className:"description"},s().createElement("strong",null,h.Z.I18n.t("tip"))," ",e.tip):null}render(){return s().createElement("div",null,s().createElement(Le.Z,{color:"#fff"}),s().createElement(wt,{emailType:"woocommerce",automationId:"woocommerce_email_creation_heading"}),s().createElement(Ot.r.Column,{align:"center",className:"mailpoet-schedule-email"},s().createElement("form",{id:"newsletter_scheduling"},s().createElement(Ne.Z,{level:4},this.displayHeader()),s().createElement("div",null,this.displayEventOptions()),s().createElement("div",null,this.displaySegments()),s().createElement("div",null,this.displayScheduling()),s().createElement(y.Z,{isFullWidth:!0,onClick:this.handleNextStep,type:"submit"},h.Z.I18n.t("next")))),this.displayEventTip())}}Ua.contextType=Ve.k,Ua.propTypes={history:b().shape({push:b().func.isRequired}).isRequired,name:b().string.isRequired,email:b().shape({title:b().string.isRequired,slug:b().string.isRequired}).isRequired};var ja=Ua,Wa=n(45853),Va=n(19013),Ya=n(13882);function Ba(e){return(0,Ya.Z)(1,arguments),(0,Va.default)(e).getTime()<Date.now()}function Ha(e,t){return(0,Ya.Z)(2,arguments),(0,Va.default)(e).getTime()-(0,Va.default)(t).getTime()}Math.pow(10,8);var za={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function Ka(e){return e?za[e]:za.trunc}var Ga=n(44732);const Qa=({scheduledFor:e,processed:t,total:n,isPaused:a,status:r})=>{const i=!e&&!t&&!n,o=e&&function(e){return(0,Ya.Z)(1,arguments),(0,Va.default)(e).getTime()>Date.now()}(e),l=(!e||Ba(e))&&t<n,c=(!e||Ba(e))&&t>=n,u="sent"===r&&void 0===n;let d=0,p=s().createElement(s().Fragment,null,(0,Ga.Z)("notSentYet"));if(o){const t=720,n=function(e,t,n){(0,Ya.Z)(2,arguments);var a=Ha(e,t)/6e4;return Ka(null==n?void 0:n.roundingMethod)(a)}(e,new Date);p=s().createElement(s().Fragment,null,h.Z.Date.short(e),s().createElement("br",null),h.Z.Date.time(e)),d=n<t?n/t*100:100}else l?(p=s().createElement(s().Fragment,null,`${h.Z.Num.toLocaleFixed(t)} / ${h.Z.Num.toLocaleFixed(n)}`),d=t/n*100):c?(p=s().createElement(s().Fragment,null,`${h.Z.Num.toLocaleFixed(n)} / ${h.Z.Num.toLocaleFixed(n)}`),d=100):u&&(p=s().createElement(s().Fragment,null,(0,Ga.Z)("sent")),d=100);return!a||c||u||(p=s().createElement(s().Fragment,null,(0,Ga.Z)("paused"))),s().createElement("div",{className:g()({"mailpoet-listing-status":!0,"mailpoet-listing-status-unknown":i,"mailpoet-listing-status-scheduled":o,"mailpoet-listing-status-in-progress":l,"mailpoet-listing-status-sent":c||u})},o&&s().createElement(Ja,null),s().createElement(Xa,{percentage:d}),s().createElement("div",{className:"mailpoet-listing-status-label"},p))};Qa.propTypes={scheduledFor:b().instanceOf(Date),processed:b().number,total:b().number,isPaused:b().bool,status:b().string};const Xa=({percentage:e})=>{const t=16*Math.PI,n=t*(e/100),a=t-n;return s().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},s().createElement("circle",{cx:"12",cy:"12",r:"8",className:"mailpoet-listing-status-percentage-background"}),s().createElement("circle",{r:"8",cx:"12",cy:"12",fill:"none",strokeDashoffset:t/4,strokeDasharray:`${n} ${a}`,className:"mailpoet-listing-status-percentage"}))};Xa.propTypes={percentage:b().number.isRequired};const Ja=()=>s().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},s().createElement("path",{className:"mailpoet-listing-status-scheduled-icon",strokeLinecap:"round",d:"M12 7L12 12 15 15"}));var er=Qa;const tr=b().shape({status:b().string,count_processed:b().string.isRequired,count_total:b().string.isRequired,scheduled_at:b().string}),nr=b().shape({id:b().number.isRequired,sent_at:b().string,status:b().string.isRequired,queue:b().oneOfType([tr,b().bool])}),ar=({newsletter:e})=>{const[t,n]=s().useState("paused"===e.queue.status),[a,r]=s().useState([]);return s().createElement(s().Fragment,null,s().createElement(gt,{errors:a}),t&&s().createElement(y.Z,{dimension:"small",onClick:()=>{r([]),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:e.id}}).done((()=>n(!1))).fail((e=>r(e.errors)))}},h.Z.I18n.t("resume")),!t&&s().createElement(y.Z,{dimension:"small",onClick:()=>{r([]),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"pause",data:{newsletter_id:e.id}}).done((()=>n(!0))).fail((e=>r(e.errors)))}},h.Z.I18n.t("pause")))};ar.propTypes={newsletter:nr.isRequired};const rr=({newsletter:e,mailerLog:t})=>{let n=e.sent_at||e.queue.scheduled_at;n&&(n=(0,Wa.default)(n,"yyyy-MM-dd HH:mm:ss",new Date));const a=e.queue&&"scheduled"!==e.queue.status,r="paused"===t.status,i=s().createElement(s().Fragment,null,s().createElement(u.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`},s().createElement(er,{processed:parseInt(e.queue.count_processed,10),scheduledFor:n,total:parseInt(e.queue.count_total,10),isPaused:r,status:e.status})),"completed"!==e.queue.status&&!r&&s().createElement(ar,{newsletter:e})),o=s().createElement(er,{scheduledFor:n,isPaused:"scheduled"===e.queue.status&&r,status:e.status});return s().createElement(s().Fragment,null,a&&i,!a&&o)};rr.propTypes={newsletter:nr.isRequired,mailerLog:b().shape({status:b().string}).isRequired};var ir=rr;const or={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=or[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]},lr=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=or[e.stat]||null;if(!r)return null;const i=e.tooltipId||null,o=s().createElement("div",{key:`tooltip-${i}`},s().createElement("div",{className:"mailpoet-listing-stats-tooltip-title"},a.tooltipTitle.toUpperCase()),s().createElement("div",{className:"mailpoet-listing-stats-tooltip-content"},s().createElement(z,{type:"excellent",name:t.excellent.name})," : ",r.tooltipText[0],s().createElement("br",null),s().createElement(z,{type:"good",name:t.good.name})," : ",r.tooltipText[1],s().createElement("br",null),s().createElement(z,{type:"average",name:t.average.name})," : ",r.tooltipText[2]));return s().createElement(z,{isInverted:e.isInverted,type:n,name:a.name,tooltip:o,tooltipId:i,tooltipPlace:e.tooltipPlace})};lr.propTypes={stat:b().string.isRequired,rate:b().number.isRequired,tooltipId:b().string,isInverted:b().bool},lr.defaultProps={isInverted:!0};const cr=({opened:e,clicked:t,revenues:n,hideBadges:a,newsletterId:r,wrapContentInLink:i})=>{const o=h.Z.Num.toLocaleFixed(e,1),l=h.Z.Num.toLocaleFixed(t,1);let c=s().createElement("div",{className:"mailpoet-listing-stats-opened-clicked"},s().createElement("div",{className:"mailpoet-listing-stats-percentages"},l,"%",s().createElement("br",null),s().createElement("span",{className:"mailpoet-listing-stats-percentages-opens"},o,"%")),!a&&s().createElement("div",null,s().createElement(lr,{stat:"clicked",rate:t,tooltipId:`clicked-${r||"0"}`}))),u=null;if(n){const e=`revenues-${r||"0"}`;u=s().createElement("div",null,s().createElement(w.Z,{"data-tip":!0,"data-for":e},n),s().createElement(B.Z,{place:"top",multiline:!0,id:e},s().createElement("div",{className:"mailpoet-listing-stats-tooltip-content"},h.Z.I18n.t("revenueStatsTooltipShort"))))}return i&&(c=i(c,"opened-and-clicked"),u=i(u,"revenue")),s().createElement("div",{className:"mailpoet-listing-stats"},c,u)};cr.propTypes={opened:b().number.isRequired,clicked:b().number.isRequired,revenues:b().string,hideBadges:b().bool,newsletterId:b().number,wrapContentInLink:b().func};var ur=cr;const dr=()=>{h.Z.trackEvent("User has clicked a CTA to view detailed stats")},pr=e=>(e.unshift({name:"stats",link:function(e){return s().createElement(u.rU,{to:`/stats/${e.id}`,onClick:Ge().applyFilters("mailpoet_newsletters_listing_stats_tracking",dr)},h.Z.I18n.t("statsListingActionTitle"))},display:function(e){const t=e.queue&&e.queue.count_processed;return Number(e.total_sent||t)>0}}),e),mr=e=>{e.meta.mta_log.error&&"authorization"===e.meta.mta_log.error.operation&&(h.Z.Notice.hide("mailpoet_notice_being_sent"),e.meta.mta_log.error.error_message.indexOf("mailpoet-js-button-resume-sending")>=0&&m()(".mailpoet-js-error-unauthorized-emails-notice").hide(),h.Z.Notice.error(e.meta.mta_log.error.error_message,{static:!0,id:"mailpoet_authorization_error"}))},hr=e=>{if(!1!==e.meta.cron_accessible)return void h.Z.Notice.hide("mailpoet_cron_error");const t=R()(h.Z.I18n.t("cronNotAccessibleNotice"),/\[link\](.*?)\[\/link\]/g,(e=>s().createElement("a",{href:"https://kb.mailpoet.com/article/231-sending-does-not-work","data-beacon-article":"5a0257ac2c7d3a272c0d7ad6",target:"_blank",rel:"noopener noreferrer",key:"check-cron"},e)));h.Z.Notice.error("",{static:!0,id:"mailpoet_cron_error"}),c().render(s().createElement("div",null,s().createElement("p",null,t)),m()('[data-id="mailpoet_cron_error"]')[0])},fr=({newsletter:e,isSent:t,currentTime:n})=>{let a=t;if(void 0===a&&(a=e.statistics&&e.queue&&"scheduled"!==e.queue.status),!a)return null;const r={link:`/stats/${e.id}`,onClick:Ge().applyFilters("mailpoet_newsletters_listing_stats_tracking",dr)},i=Number(e.total_sent||e.queue.count_processed);let o,l,c,d,p,m=0,f=0,g=null;i>0&&(m=100*e.statistics.clicked/i,f=100*e.statistics.opened/i,g=e.statistics.revenue),void 0!==n?(o=6,l=e.queue.scheduled_at||e.queue.created_at,c=oe()(n).diff(oe()(l),"hours"),d=c<o,p=!0):(d=!1,p=!1);const v=i>=20&&e.statistics.opened>=5&&!d,b=(t,n)=>((e,t,n,a)=>a<=0||!t.link?e:t.externalLink?s().createElement("a",{key:`stats-${n}`,href:t.link,onClick:t.onClick||null},e):s().createElement(u.rU,{key:`stats-${n}`,to:t.link,onClick:t.onClick||null},e))(t,r,`${n}-${e.id}`,i),y=s().createElement(ur,{opened:f,clicked:m,revenues:g&&g.value>0?g.formatted:null,hideBadges:!v,newsletterId:e.id,wrapContentInLink:b}),E=s().createElement(s().Fragment,null,y,d&&b(s().createElement(w.Z,{className:"mailpoet-listing-stats-too-early",dimension:"large",variant:"excellent",isInverted:!0},h.Z.I18n.t("checkBackInHours").replace("%1$d",o-c)),"check-back"));let _;return p&&f<5&&c>=24&&i>=10&&(_=s().createElement("div",null,s().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")))),s().createElement(s().Fragment,null,E,_)},gr=b().shape({clicked:b().number,opened:b().number,unsubscribed:b().number,revenue:b().shape({count:b().number,currency:b().string,formatted:b().string,value:b().number})}),vr=b().shape({status:b().string,count_processed:b().string.isRequired,count_total:b().string.isRequired,created_at:b().string,scheduled_at:b().string});fr.propTypes={newsletter:b().shape({id:b().number.isRequired,queue:b().oneOfType([vr,b().bool]),total_sent:b().number,statistics:b().oneOfType([gr,b().bool])}).isRequired,isSent:b().bool,currentTime:b().string},fr.defaultProps={isSent:void 0,currentTime:void 0};var br=fr;const yr=h.Z.trackingConfig.emailTrackingEnabled,wr={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)}},Er=[{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:yr},{name:"sent_at",label:h.Z.I18n.t("sentOn"),sortable:!0}],_r=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:wr.onTrash}],Zr=e=>{const t=()=>{window.location.href=`?page=mailpoet-newsletter-editor&id=${e.id}`};e.queue&&"sending"===e.status&&null===e.queue.status?St({message:h.Z.I18n.t("confirmEdit"),onConfirm:t}):t()};let Ir=[{name:"view",link:function(e){return s().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:Zr},{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"}];Ir=pr(Ir);class Sr extends s().Component{constructor(e){super(e),(0,C.Z)(this,"renderItem",((e,t,n)=>{const a=g()("manage-column","column-primary","has-row-actions");return s().createElement("div",null,s().createElement("td",{className:a},s().createElement("a",{className:"mailpoet-listing-title",href:"#",onClick:t=>{t.preventDefault(),Zr(e)}},e.queue.newsletter_rendered_subject||e.subject),t),s().createElement("td",{className:"column mailpoet-listing-status-column","data-colname":h.Z.I18n.t("status")},s().createElement(ir,{newsletter:e,mailerLog:n.mta_log})),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lists")},s().createElement(_,{segments:e.segments,dimension:"large"})),!0===yr?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},s().createElement(br,{newsletter:e,currentTime:n.current_time})):null,s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("sentOn")},e.sent_at?s().createElement(s().Fragment,null,h.Z.Date.short(e.sent_at),s().createElement("br",null),h.Z.Date.time(e.sent_at)):null))})),(0,C.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return s().createElement(s().Fragment,null,0===this.state.newslettersCount&&s().createElement(bt,{filter:e=>"standard"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&s().createElement(I(),{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:Er,bulk_actions:_r,item_actions:Ir,messages:wr,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})}mr(e),hr(e)}}))}}Sr.contextType=Ve.k,Sr.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var kr=(0,d.withRouter)(Sr);const Cr=window.mailpoet_roles||{},Tr=window.mailpoet_segments||{},Nr=h.Z.trackingConfig.emailTrackingEnabled,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:"statistics",label:h.Z.I18n.t("statistics"),display:Nr},{name:"status",label:h.Z.I18n.t("status"),width:145},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],Rr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Dr.onTrash}];let Or=[{name:"view",link:function(e){return s().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",link:function(e){return s().createElement("a",{href:`?page=mailpoet-newsletter-editor&id=${e.id}`},h.Z.I18n.t("edit"))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];Or=pr(Or);class Pr extends s().Component{constructor(e){super(e),(0,C.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,C.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 s().createElement("div",null,s().createElement(nn,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),s().createElement("p",{className:"mailpoet-listing-stats-description"},s().createElement(u.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`},t)," ",s().createElement("br",null),n))})),(0,C.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"):R()(h.Z.I18n.t("welcomeEventWPUserWithRole"),'"%1$s"',((t,n)=>s().createElement(w.Z,{variant:"list",key:n},Cr[e.options.role])));break;default:if(a=T.ZP.find(Tr,(t=>Number(t.id)===Number(e.options.segment))),void 0===a)return s().createElement(u.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`},h.Z.I18n.t("sendingToSegmentsNotSpecified"));t=R()(h.Z.I18n.t("welcomeEventSegment"),'"%1$s"',((e,t)=>s().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 s().createElement("span",null,t,n&&s().createElement("div",{className:"mailpoet-listing-schedule"},s().createElement("div",{className:"mailpoet-listing-schedule-icon"},s().createElement(Ja,null)),n))})),(0,C.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return s().createElement("div",null,s().createElement("td",{className:n},s().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),!0===Nr?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},s().createElement(br,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})):null,s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),s().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,C.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return s().createElement(s().Fragment,null,0===this.state.newslettersCount&&s().createElement(bt,{filter:e=>"welcome"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&s().createElement(I(),{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: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})}mr(e),hr(e)}}))}}Pr.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var Lr=(0,d.withRouter)(Pr);const Mr={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)}},Ar=[{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}],Fr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Mr.onTrash}],qr=[{name:"view",link:function(e){return s().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return s().createElement("a",{href:`?page=mailpoet-newsletter-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:"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 $r extends s().Component{constructor(e){super(e),(0,C.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,C.Z)(this,"renderStatus",(e=>s().createElement(nn,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}))),(0,C.Z)(this,"renderSettings",(e=>{let t;if(0===e.segments.length)return s().createElement(u.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`},h.Z.I18n.t("sendingToSegmentsNotSpecified"));const n=R()(h.Z.I18n.t("sendTo"),"%1$s",((t,n)=>s().createElement(_,{segments:e.segments,key:n})));switch(e.options.intervalType){case"daily":t=h.Z.I18n.t("sendDaily").replace("%1$s",fn[e.options.timeOfDay]);break;case"weekly":t=h.Z.I18n.t("sendWeekly").replace("%1$s",gn[e.options.weekDay]).replace("%2$s",fn[e.options.timeOfDay]);break;case"monthly":t=h.Z.I18n.t("sendMonthly").replace("%1$s",vn[e.options.monthDay]).replace("%2$s",fn[e.options.timeOfDay]);break;case"nthWeekDay":t=h.Z.I18n.t("sendNthWeekDay").replace("%1$s",bn[e.options.nthWeekDay]).replace("%2$s",gn[e.options.weekDay]).replace("%3$s",fn[e.options.timeOfDay]);break;case"immediately":t=h.Z.I18n.t("sendImmediately");break;default:t="Invalid sending frequency"}return s().createElement("span",null,n,s().createElement("div",{className:"mailpoet-listing-schedule"},s().createElement("div",{className:"mailpoet-listing-schedule-icon"},s().createElement(Ja,null)),t))})),(0,C.Z)(this,"renderHistoryLink",(e=>0===Number(e.children_count)?s().createElement("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small mailpoet-listing-notification-status"},h.Z.I18n.t("notSentYet")):s().createElement(u.rU,{className:"mailpoet-nowrap","data-automation-id":`history-${e.id}`,to:`/notification/history/${e.id}`},s().createElement(y.Z,{className:"mailpoet-hide-on-mobile",dimension:"small"},h.Z.I18n.t("viewHistory")),s().createElement(y.Z,{className:"mailpoet-show-on-mobile mailpoet-listing-notification-status",dimension:"small",variant:"secondary"},h.Z.I18n.t("viewHistory"))))),(0,C.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return s().createElement("div",null,s().createElement("td",{className:n},s().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("history")},this.renderHistoryLink(e)),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),s().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,C.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return s().createElement(s().Fragment,null,0===this.state.newslettersCount&&s().createElement(bt,{filter:e=>"notification"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&s().createElement(I(),{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:Ar,bulk_actions:Fr,item_actions:qr,messages:Mr,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})}mr(e),hr(e)}}))}}$r.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var Ur=(0,d.withRouter)($r);const jr=h.Z.trackingConfig.emailTrackingEnabled,Wr={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:"settings",label:h.Z.I18n.t("settings")},{name:"statistics",label:h.Z.I18n.t("statistics"),display:jr},{name:"status",label:h.Z.I18n.t("status"),width:145},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],Yr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Wr.onTrash}];let Br=[{name:"view",link:function(e){return s().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",link:function(e){return s().createElement("a",{href:`?page=mailpoet-newsletter-editor&id=${e.id}`},h.Z.I18n.t("edit"))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];Br=pr(Br);class Hr extends s().Component{constructor(e){super(e),(0,C.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,C.Z)(this,"renderStatus",(e=>{const t=h.Z.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString());return s().createElement("div",null,s().createElement(nn,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),s().createElement("p",{className:"mailpoet-listing-stats-description"},s().createElement(u.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`},t)))})),(0,C.Z)(this,"renderSettings",(e=>{if(0===e.segments.length)return s().createElement(u.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`},h.Z.I18n.t("sendingToSegmentsNotSpecified"));const t=R()(h.Z.I18n.t("sendTo"),"%1$s",((t,n)=>s().createElement(_,{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 s().createElement("span",null,t,s().createElement("div",{className:"mailpoet-listing-schedule"},s().createElement("div",{className:"mailpoet-listing-schedule-icon"},s().createElement(Ja,null)),a))})),(0,C.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return s().createElement("div",null,s().createElement("td",{className:n},s().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),!0===jr?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},s().createElement(br,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})):null,s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),s().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,C.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return s().createElement(s().Fragment,null,0===this.state.newslettersCount&&s().createElement(bt,{filter:e=>"re_engagement"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&s().createElement(I(),{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:Vr,bulk_actions:Yr,item_actions:Br,messages:Wr,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})}mr(e),hr(e)}}))}}Hr.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var zr=(0,d.withRouter)(Hr);const Kr=h.Z.trackingConfig.emailTrackingEnabled,Gr=[{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:Kr},{name:"sent_at",label:h.Z.I18n.t("sentOn"),sortable:!0}],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)}},Xr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Qr.onTrash}],Jr=pr([{name:"view",link:function(e){return s().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"trash",className:"mailpoet-hide-on-mobile"}]),ei=(e,t,n)=>{const a=g()("manage-column","column-primary","has-row-actions");return s().createElement(s().Fragment,null,s().createElement("td",{className:a},s().createElement("strong",null,s().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},e.queue.newsletter_rendered_subject||e.subject)),t),s().createElement("td",{className:"column mailpoet-listing-status-column","data-colname":h.Z.I18n.t("status")},s().createElement(ir,{newsletter:e,mailerLog:n.mta_log})),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lists")},s().createElement(_,{segments:e.segments,dimension:"large"})),!0===Kr?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},s().createElement(br,{newsletter:e,currentTime:n.current_time})):null,s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("sentOn")},e.sent_at?s().createElement(s().Fragment,null,h.Z.Date.short(e.sent_at),s().createElement("br",null),h.Z.Date.time(e.sent_at)):null))},ti=e=>s().createElement(s().Fragment,null,s().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:"/notification"},h.Z.I18n.t("backToPostNotifications")),s().createElement(I(),{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:ei,columns:Gr,messages:Qr,item_actions:Jr,bulk_actions:Xr,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{mr(e),hr(e)}}));ti.propTypes={parentId:b().string.isRequired,location:b().shape({pathname:b().string}).isRequired,match:b().shape({params:b().shape({id:b().node}).isRequired}).isRequired};var ni=(0,d.withRouter)(ti);const ai=[{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")}],ri={onNoItemsFound:()=>h.Z.I18n.t("noSendingTaskFound")},ii=e=>{const[t,n]=s().useState({id:e.match.params.id,subject:"",sent:!1});return s().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]),s().createElement(s().Fragment,null,s().createElement("h1",null,h.Z.I18n.t("sendingStatusTitle")),s().createElement(li,{newsletter:t}),s().createElement(si,{location:e.location,params:e.match.params}))};ii.propTypes={location:b().shape({pathname:b().string}).isRequired,match:b().shape({params:b().shape({id:b().string.isRequired}).isRequired}).isRequired};const oi=(e,t)=>e.location.pathname===t.location.pathname&&e.params.id===t.params.id,si=s().memo((({location:e,params:t})=>s().createElement(I(),{limit:window.mailpoet_listing_per_page,location:e,params:t,endpoint:"sending_task_subscribers",base_url:"sending-status/:id",onRenderItem:e=>s().createElement("div",null,s().createElement(ci,e)),getListingItemKey:e=>`${e.taskId}-${e.subscriberId}`,columns:ai,messages:ri,auto_refresh:!0,sort_by:"failed",sort_order:"desc",afterGetItems:e=>{mr(e),hr(e)}})),oi);si.propTypes={location:b().shape({pathname:b().string}).isRequired,params:b().shape({id:b().string.isRequired}).isRequired};const li=({newsletter:e})=>e.id&&e.subject&&e.sent?s().createElement("p",null,s().createElement(u.rU,{to:`/stats/${e.id}`},e.subject)):null;li.propTypes={newsletter:b().shape({id:b().string,subject:b().string,sent:b().bool})},li.defaultProps={newsletter:{id:null,subject:null,sent:!1}};const ci=({error:e,failed:t,taskId:n,processed:a,email:r,subscriberId:i,lastName:o,firstName:l})=>{const c=g()("manage-column","column-primary","has-row-actions");let u=h.Z.I18n.t("unprocessed");return"1"===a&&(u="1"===t?s().createElement("span",null,h.Z.I18n.t("failed"),s().createElement("br",null),s().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:n,subscriberId:i}}).done((()=>window.mailpoet_listing.forceUpdate())).fail((e=>h.Z.Notice.showApiErrorNotice(e)))}},h.Z.I18n.t("resend"))):h.Z.I18n.t("sent")),s().createElement(s().Fragment,null,s().createElement("td",{"data-automation-id":`name_${n}_${i}`,className:c},s().createElement("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-subscribers#/edit/${i}`},r),s().createElement("div",{className:"mailpoet-listing-subtitle"},`${l} ${o}`)),s().createElement("td",{className:"column","data-automation-id":`status_${n}_${i}`,"data-colname":h.Z.I18n.t("sendingStatus")},u),s().createElement("td",{className:"column","data-automation-id":`error_${n}_${i}`,"data-colname":h.Z.I18n.t("failureReason")},e))};ci.propTypes={error:b().string,email:b().string.isRequired,failed:b().string.isRequired,taskId:b().string.isRequired,lastName:b().string.isRequired,firstName:b().string.isRequired,processed:b().string.isRequired,subscriberId:b().string.isRequired},ci.defaultProps={error:""};var ui=ii;const di=h.Z.trackingConfig.emailTrackingEnabled,pi=window.mailpoet_woocommerce_automatic_emails||{},mi={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)}},hi=[{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:di},{name:"status",label:h.Z.I18n.t("status"),width:145},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],fi=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:mi.onTrash}];let gi=[{name:"view",link:function(e){return s().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return s().createElement("a",{href:`?page=mailpoet-newsletter-editor&id=${e.id}`},h.Z.I18n.t("edit"))}},{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"}];gi=pr(gi);class vi extends s().Component{constructor(e){super(e),(0,C.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=pi[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,C.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 s().createElement("div",null,s().createElement(nn,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,"data-group":e.options.group,dimension:"small",defaultChecked:"active"===e.status}),s().createElement("p",{className:"mailpoet-listing-notification-status"},t&&s().createElement(u.rU,{to:`/sending-status/${e.id}`},t),!t&&s().createElement("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small"},h.Z.I18n.t("notSentYet"))))})),(0,C.Z)(this,"renderSettings",(e=>{const t=pi[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 s().createElement("span",{className:"mailpoet-listing-error"},h.Z.I18n.t("automaticEmailEventOptionsNotConfigured"));let r,i;if(r=a.length>1&&"listingScheduleDisplayTextPlural"in t?R()(t.listingScheduleDisplayTextPlural,"%s",((e,t)=>s().createElement(_,{strings:a,key:t}))):R()(t.listingScheduleDisplayText,"%s",((e,t)=>s().createElement(_,{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 s().createElement("span",null,r,i&&s().createElement("div",{className:"mailpoet-listing-schedule"},s().createElement("div",{className:"mailpoet-listing-schedule-icon"},s().createElement(Ja,null)),i))})),(0,C.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return s().createElement("div",null,s().createElement("td",{className:n},s().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),!0===di?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},s().createElement(br,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})):null,s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),s().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,C.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={eventCounts:{},newslettersCount:void 0},this.afterGetItems=this.afterGetItems.bind(this)}afterGetItems(e){mr(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:s().createElement("div",{className:"notice error"},s().createElement("p",null,h.Z.I18n.t("wooCommerceEmailsWarning")),s().createElement("p",null,s().createElement("a",{href:"?page=mailpoet-settings#woocommerce"},h.Z.I18n.t("wooCommerceEmailsWarningLink")))):null}render(){const{match:e,location:t}=this.props;return s().createElement(s().Fragment,null,this.renderWarning(),0===this.state.newslettersCount&&s().createElement(bt,{filter:e=>"woocommerce"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&s().createElement(I(),{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:hi,bulk_actions:fi,item_actions:gi,messages:mi,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)}}))}}vi.propTypes={match:b().shape({params:b().shape({tab:b().string}).isRequired}).isRequired,location:b().object.isRequired};var bi=(0,d.withRouter)(vi),yi=()=>s().createElement(s().Fragment,null,s().createElement("style",{dangerouslySetInnerHTML:{__html:".wrap { margin: 0 !important; }"}})),wi=n(4840),Ei=n(53681);const _i=e=>{const t=e<.1?2:1;return h.Z.Num.toLocaleFixed(e,t)},Zi=({newsletter:e,isWoocommerceActive:t})=>{const n=e.total_sent||0;let a=0,r=0,i=0,o=0,l=0;n>0&&(a=100*e.statistics.clicked/n,r=100*e.statistics.opened/n,i=100*e.statistics.machineOpened/n,o=100*e.statistics.unsubscribed/n,l=100*e.statistics.bounced/n);const c=_i(a),u=_i(r),d=_i(i),p=_i(o),m=_i(l),f=n>=20&&e.statistics.opened>=5,g=s().createElement("div",{className:"mailpoet-statistics-value-small"},s().createElement("span",{className:"mailpoet-statistics-value-number"},u,"% "),h.Z.I18n.t("percentageOpened")),v=s().createElement("div",{className:"mailpoet-statistics-value-small"},s().createElement("span",{className:"mailpoet-statistics-value-number"},d,"% "),h.Z.I18n.t("percentageMachineOpened"),s().createElement(Be.default,{tooltip:R()(h.Z.I18n.t("percentageMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>s().createElement("span",{style:{pointerEvents:"all"},key:"machine-opened-tooltip"},s().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=s().createElement("div",{className:"mailpoet-statistics-value-small"},s().createElement("span",{className:"mailpoet-statistics-value-number"},p,"% "),h.Z.I18n.t("percentageUnsubscribed")),y=s().createElement("div",{className:"mailpoet-statistics-value-small"},s().createElement("span",{className:"mailpoet-statistics-value-number"},m,"% "),h.Z.I18n.t("percentageBounced")),w=sr("clicked",a),E=s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-statistics-value"},s().createElement("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${w}`},c,"% "),h.Z.I18n.t("percentageClicked")),f&&s().createElement(lr,{isInverted:!1,stat:"clicked",rate:a,tooltipId:`clicked-${e.id||"0"}`,tooltipPlace:"right"}));return s().createElement("div",{className:"mailpoet-stats-general"},s().createElement(Ot.r.ThreeColumns,{className:"mailpoet-stats-general-top-row"},s().createElement("div",null,s().createElement("div",{className:"mailpoet-statistics-value-small"},h.Z.I18n.t("statsTotalSent"),": ",s().createElement("span",{className:"mailpoet-statistics-value-number"},n.toLocaleString()))),s().createElement("div",{className:"mailpoet-statistics-with-left-separator"},b),s().createElement("div",{className:"mailpoet-statistics-with-left-separator"},y)),s().createElement(Ot.r.ThreeColumns,null,s().createElement("div",null,E),s().createElement("div",{className:"mailpoet-statistics-with-left-separator"},g,v),t&&s().createElement("div",{className:"mailpoet-statistics-with-left-separator"},Ge().applyFilters("mailpoet_newsletters_revenues_stats",null,e.statistics.revenue)),!t&&s().createElement("div",null)),s().createElement("p",{className:"mailpoet-stats-general-read-more"},s().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"))))};Zi.propTypes={isWoocommerceActive:b().bool.isRequired};const Ii=({newsletter:e})=>{const t=e.queue.scheduled_at||e.queue.created_at;return s().createElement(Ot.r.ThreeColumns,{className:"mailpoet-stats-info"},s().createElement("div",{className:"mailpoet-grid-span-two-columns"},s().createElement(Ne.Z,{level:1},e.subject),s().createElement("div",null,s().createElement("b",null,h.Z.Date.short(t)," • ",h.Z.Date.time(t))),Array.isArray(e.segments)&&e.segments.length&&s().createElement("div",null,s().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("statsToSegments")),": ",s().createElement(_,{dimension:"large",segments:e.segments}))),s().createElement("div",{className:"mailpoet-stats-info-sender-preview"},s().createElement("div",null,s().createElement("div",{className:"mailpoet-stats-info-key-value"},s().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("statsFromAddress"),": "),e.sender_address?e.sender_address:"-"),s().createElement("div",{className:"mailpoet-stats-info-key-value"},s().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("statsReplyToAddress"),": "),e.reply_to_address?e.reply_to_address:"-"),s().createElement("div",{className:"mailpoet-stats-info-key-value"},s().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("googleAnalytics"),": "),e.ga_campaign?e.ga_campaign:"-")),s().createElement("div",null,s().createElement(Re.Button,{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("statsPreviewNewsletter")))))},Si=()=>{const e=s().createElement(y.Z,{href:h.Z.MailPoetComUrlFactory.getFreePlanUrl({utm_medium:"stats",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("premiumBannerCtaFree")),t=s().createElement("p",null,h.Z.I18n.t("premiumBannerDescription")," ",s().createElement("a",{href:"admin.php?page=mailpoet-premium"},h.Z.I18n.t("learnMore")),".");return s().createElement("div",{className:"mailpoet-stats-premium-required"},s().createElement(et,{title:h.Z.I18n.t("premiumFeature"),message:t,actionButton:e}))};var ki=()=>{if(!window.mailpoet_display_detailed_stats)return s().createElement(Si,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 s().createElement("div",{className:"mailpoet-stats-premium-required"},s().createElement(et,{title:t,message:s().createElement("p",null,n),actionButton:s().createElement(y.Z,{target:"_blank",rel:"noopener noreferrer",href:a},h.Z.I18n.t("upgradeNow"))}))}return null};const Ci=({match:e,history:t,location:n})=>{const[a,r]=(0,o.useState)({item:void 0,loading:!0}),i=(0,o.useCallback)((e=>{r({loading:!0,item:a.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=>{r({loading:!1,item:e.data})})).fail((e=>{h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0}),r({loading:!1}),t.push("/")}))}),[t,a.item]);(0,o.useEffect)((()=>{var t;window.scrollTo(0,0),(null===(t=a.item)||void 0===t?void 0:t.id)!==e.params.id&&i(e.params.id)}),[e.params.id,i,a.item]);const{item:l,loading:c}=a,u=l;return c?null:null==u||!u.subject||null!=u&&u.queue?s().createElement(s().Fragment,null,s().createElement(Me.Z,null),s().createElement(yi,null),s().createElement(j.Q,null),s().createElement("div",{className:"mailpoet-stats-page"},s().createElement(M,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),s().createElement(Ii,{newsletter:u}),s().createElement(Zi,{newsletter:u,isWoocommerceActive:h.Z.isWoocommerceActive}),s().createElement(wi.Z,{activeKey:"clicked"},s().createElement(Ei.Z,{key:"clicked",title:h.Z.I18n.t("clickedLinks")},Ge().applyFilters("mailpoet_newsletters_clicked_links_table",s().createElement(ki,null),u.clicked_links)),Ge().applyFilters("mailpoet_newsletters_purchased_products",null,u),s().createElement(Ei.Z,{key:"engagement",title:h.Z.I18n.t("subscriberEngagement")},Ge().applyFilters("mailpoet_newsletters_subscriber_engagement",s().createElement(ki,null),n,e.params,u)),s().createElement(Ei.Z,{key:"bounces",title:h.Z.I18n.t("bounces"),automationId:"bounces-tab"},Ge().applyFilters("mailpoet_newsletters_bounces",s().createElement(ki,null),n,e.params))))):s().createElement("div",null,s().createElement(Ne.Z,{level:1},u.subject))};Ci.propTypes={match:b().shape({params:b().shape({id:b().string.isRequired}).isRequired}).isRequired,history:b().shape({push:b().func.isRequired}).isRequired,location:b().object.isRequired};var Ti=(0,d.withRouter)(Ci),Ni=n(48228),Di=n(87903),xi=n.n(Di);const Ri=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 s().createElement("div",{className:"mailpoet_review_request"},s().createElement("img",{src:e.reviewRequestIllustrationUrl,height:"280",width:"280",alt:""}),s().createElement("h2",null,h.Z.I18n.t("reviewRequestHeading")),s().createElement("p",null,h.Z.I18n.t("reviewRequestDidYouKnow").replace("[username]",e.username)),s().createElement("p",null,n),s().createElement("p",null,s().createElement("a",{href:"http://bit.ly/2Bi124o",target:"_blank",rel:"noopener noreferrer",className:"button button-primary"},h.Z.I18n.t("reviewRequestRateUsNow"))),s().createElement("p",null,s().createElement("a",{id:"mailpoet_review_request_not_now"},h.Z.I18n.t("reviewRequestNotNow"))))};Ri.propTypes={installedDaysAgo:b().number.isRequired,reviewRequestIllustrationUrl:b().string.isRequired,username:b().string.isRequired};var Oi=Ri;let Pi=null;const Li=()=>((0,o.useLayoutEffect)((()=>{window.mailpoet_display_nps_poll&&h.Z.libs3rdPartyEnabled&&(Pi||(Pi=h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"analytics",action:"getTrackingData"})),Pi).then((({data:e})=>(e=>{let t;t=window.mailpoet_display_nps_form?"EqOgKsgZd832Sz9w":window.mailpoet_is_new_user?"6L479eVPXk7pBn6S":"k0aJAsQAWI2ERyGv",xi()({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:Zt.renderToString(Oi({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()))}})}}})})(e)))}),[]),null);var Mi=e=>t=>(Li(),s().createElement(e,t)),Ai=()=>s().createElement(s().Fragment,null,s().createElement(j.Q,null,s().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,s().createElement("span",null,h.Z.I18n.t("new"))))),Fi=(0,d.withRouter)((({children:e,location:t})=>null!==(0,yt.X)(t)||(e=>e.hash.match(new RegExp("^#/new"))||e.pathname.match(new RegExp("^/new")))(t)?null:e));const qi=({mailpoetInstalledDaysAgo:e,sendTransactionalEmails:t,mtaMethod:n,noticeDismissed:a,apiVersion:r})=>{const[i,l]=(0,o.useState)(!1),c=()=>{h.Z.Ajax.post({api_version:r,endpoint:"UserFlags",action:"set",data:{transactional_emails_opt_in_notice_dismissed:"1"}})};return e<30||t||"PHPMail"===n||"1"===a||i?null:s().createElement(O.Z,{type:"success",timeout:!1,onClose:c},s().createElement("h3",null,h.Z.I18n.t("transactionalEmailNoticeTitle")),s().createElement("p",null,h.Z.I18n.t("transactionalEmailNoticeBody")," ",s().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"))),s().createElement("p",null,s().createElement("button",{type:"button",className:"button",onClick:()=>{l(!0),h.Z.Ajax.post({api_version:r,endpoint:"settings",action:"set",data:{send_transactional_emails:"1"}}),c()}},h.Z.I18n.t("transactionalEmailNoticeCTA"))))};qi.propTypes={mailpoetInstalledDaysAgo:b().number.isRequired,sendTransactionalEmails:b().bool.isRequired,noticeDismissed:b().string.isRequired,mtaMethod:b().string.isRequired,apiVersion:b().string.isRequired};var $i=qi;const Ui=window.mailpoet_woocommerce_automatic_emails||[],ji=Mi((()=>{const{parentId:e}=(0,d.useParams)();return s().createElement(s().Fragment,null,s().createElement(Fi,null,s().createElement(Ai,null)),s().createElement(Ni.Z,{activeKey:"standard",routerType:"switch-only",onSwitch:e=>(e=>h.Z.trackEvent(`Tab Emails > ${e} clicked`))(e),automationId:"newsletters_listing_tabs"},s().createElement(Ei.Z,{key:"standard",route:"standard/(.*)?",title:h.Z.I18n.t("tabStandardTitle"),automationId:`tab-${h.Z.I18n.t("tabStandardTitle")}`},s().createElement(kr,null)),s().createElement(Ei.Z,{key:"welcome",route:"welcome/(.*)?",title:h.Z.I18n.t("tabWelcomeTitle"),automationId:`tab-${h.Z.I18n.t("tabWelcomeTitle")}`},s().createElement(Lr,null)),s().createElement(Ei.Z,{key:"notification",route:"notification/(.*)?",title:h.Z.I18n.t("tabNotificationTitle"),automationId:`tab-${h.Z.I18n.t("tabNotificationTitle")}`},e?s().createElement(ni,{parentId:e}):s().createElement(Ur,null)),s().createElement(Ei.Z,{key:"re_engagement",route:"re_engagement/(.*)?",title:h.Z.I18n.t("tabReEngagementTitle"),automationId:`tab-${h.Z.I18n.t("tabReEngagementTitle")}`},s().createElement(zr,null)),window.mailpoet_woocommerce_active&&T.ZP.map(Ui,(e=>s().createElement(Ei.Z,{key:e.slug,route:`${e.slug}/(.*)?`,title:e.title,automationId:`tab-${e.title}`},s().createElement(bi,null))))))})),Wi=({history:e})=>s().createElement(bt,{history:e,hideClosingButton:0===window.mailpoet_newsletters_count});Wi.propTypes={history:b().shape({push:b().func.isRequired}).isRequired};const Vi=[...(()=>{const e=[];return T.ZP.each(Ui,(t=>{e.push({path:`/${t.slug}/(.*)?`,component:ji});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 s().createElement(ja,a)}})})),e.push({path:`/new/${t.slug}`,render:e=>{const n={...e,email:t};return s().createElement(pt,n)}})})),e})(),{path:"/notification/history/:parentId/(.*)?",component:ji},{path:"/(standard|welcome|notification|re_engagement)/(.*)?",component:ji},{path:"/new/standard",component:Pa},{path:"/new/notification",component:Aa},{path:"/new/welcome",component:$a},{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,o.useState)({afterTimeNumber:e,afterTimeType:"months"}),[a,r]=(0,o.useState)([]),[i,l]=(0,o.useState)(!1),c=(0,d.useHistory)();return s().createElement("div",null,s().createElement(Le.Z,{color:"#fff"}),a&&s().createElement(gt,{errors:a}),s().createElement(wt,{emailType:"re_engagement",automationId:"re_engagement_heading_creation_heading"}),s().createElement(Ot.r.Column,{align:"center",className:"mailpoet-schedule-email"},s().createElement(Gn,{afterTimeNumber:t.afterTimeNumber,afterTimeType:t.afterTimeType,inactiveSubscribersPeriod:Number(h.Z.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:(0,zn.compose)([n,(0,zn.assoc)("afterTimeNumber",zn.__,t)]),updateAfterTimeType:(0,zn.compose)([n,(0,zn.assoc)("afterTimeType",zn.__,t)])}),s().createElement(y.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:Wi},{name:"template",path:"/template/:id",component:Rt},{path:"/send/congratulate/:id",component:Ra},{path:"/send/:id",component:sa},{path:"/sending-status/:id/(.*)?",component:ui},{path:"/stats/:id/(.*)?",component:Ti}],Yi=()=>s().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},s().createElement(u.UT,null,s().createElement(ot.Z,null),s().createElement(P,null),s().createElement($i,{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}),s().createElement(M,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),s().createElement(d.Switch,null,s().createElement(d.Route,{exact:!0,path:"/",render:()=>s().createElement(d.Redirect,{to:0===window.mailpoet_newsletters_count?"/new":"/standard"})}),Vi.map((e=>s().createElement(d.Route,{key:e.path,path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render})))))),Bi=document.getElementById("newsletters_container");Bi&&(window.mailpoet_listing=c().render(s().createElement(Yi,null),Bi));const Hi=e=>"wp_users"===e.type,zi=e=>"woocommerce_users"===e.type,Ki=e=>Hi(e)||zi(e),Gi=h.Z.trackingConfig.emailTrackingEnabled,Qi=[{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:Gi},{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}],Xi={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)}},Ji=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Xi.onTrash}],eo=e=>!Ki(e),to=[{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return s().createElement(u.rU,{to:`/edit/${e.id}`},h.Z.I18n.t("edit"))},display:function(e){return!Ki(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!Ki(e)}},{name:"read_more",className:"mailpoet-hide-on-mobile",link:function(){return s().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 Hi(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 Hi(e)||zi(e)}},{name:"view_subscribers",link:function(e){return s().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!zi(e)}}];class no extends s().Component{constructor(...e){super(...e),(0,C.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),o=Number(e.subscribers_count.inactive||0),l=Number(e.subscribers_count.bounced||0);let c;return c=Ki(e)?s().createElement("span",{className:"mailpoet-listing-title"},e.name):s().createElement(u.rU,{className:"mailpoet-listing-title",to:`/edit/${e.id}`},e.name),s().createElement("div",null,s().createElement("td",{className:n,"data-automation-id":`segment_name_${e.name}`},c,t),s().createElement("td",{"data-colname":h.Z.I18n.t("description")},s().createElement("abbr",null,e.description)),Gi?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("averageScore")},s().createElement("div",{className:"mailpoet-listing-stats"},s().createElement(K,{id:e.id,engagementScore:e.average_engagement_score}))):null,s().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribed")},s().createElement("abbr",null,a.toLocaleString())),s().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("unconfirmed")},s().createElement("abbr",null,r.toLocaleString())),s().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("unsubscribed")},s().createElement("abbr",null,i.toLocaleString())),s().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("inactive")},s().createElement("abbr",null,o.toLocaleString())),s().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("bounced")},s().createElement("abbr",null,l.toLocaleString())),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("createdOn")},h.Z.Date.short(e.created_at),s().createElement("br",null),h.Z.Date.time(e.created_at)))}))}render(){return s().createElement("div",{className:"mailpoet-segments-listing"},s().createElement(I(),{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:Xi,search:!1,endpoint:"segments",base_url:"lists",onRenderItem:this.renderItem,columns:Qi,bulk_actions:Ji,item_actions:to,sort_by:"name",sort_order:"asc",isItemDeletable:eo,isItemToggleable:Hi}))}}no.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var ao=(0,d.withRouter)(no);const ro=[{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")}],io={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")}},oo=e=>s().createElement("div",null,s().createElement(Le.Z,{color:"#fff"}),s().createElement(Me.Z,null),s().createElement(Ne.Z,{level:1,className:"mailpoet-title"},s().createElement("span",null,h.Z.I18n.t("segment")),s().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:"/"},h.Z.I18n.t("backToList"))),s().createElement(P,null),s().createElement(Pe,{endpoint:"segments",fields:ro,params:e.match.params,messages:io}));oo.propTypes={match:b().shape({params:b().shape({id:b().string}).isRequired}).isRequired};var so=oo,lo=n(41882),co=n(94878),uo=n(14772);let po,mo,ho,fo,go,vo;!function(e){e.Email="email",e.WordPressRole="userRole",e.SubscribedDate="subscribedDate",e.WooCommerce="woocommerce",e.WooCommerceSubscription="woocommerceSubscription"}(po||(po={})),function(e){e.OPENS_ABSOLUTE_COUNT="opensAbsoluteCount",e.MACHINE_OPENS_ABSOLUTE_COUNT="machineOpensAbsoluteCount",e.OPENED="opened",e.MACHINE_OPENED="machineOpened",e.NOT_OPENED="notOpened",e.CLICKED="clicked",e.CLICKED_ANY="clickedAny",e.NOT_CLICKED="notClicked"}(mo||(mo={})),function(e){e.MAILPOET_CUSTOM_FIELD="mailpoetCustomField",e.WORDPRESS_ROLE="wordpressRole",e.SUBSCRIBED_DATE="subscribedDate",e.SUBSCRIBER_SCORE="subscriberScore",e.SUBSCRIBED_TO_LIST="subscribedToList"}(ho||(ho={})),function(e){e.AND="and",e.OR="or"}(fo||(fo={})),function(e){e.ANY="any",e.ALL="all",e.NONE="none"}(go||(go={})),function(e){e.SET_SEGMENT="SET_SEGMENT",e.SET_ERRORS="SET_ERRORS",e.UPDATE_SEGMENT="UPDATE_SEGMENT",e.UPDATE_SEGMENT_FILTER="UPDATE_SEGMENT_FILTER",e.UPDATE_SUBSCRIBER_COUNT="UPDATE_SUBSCRIBER_COUNT"}(vo||(vo={}));const bo=()=>{const e=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),{updateSegment:t}=(0,lo.Z)("mailpoet-dynamic-segments-form");return e.filters.length<=1?null:s().createElement(s().Fragment,null,s().createElement("div",null,s().createElement("label",{className:"mailpoet-form-radio","data-automation-id":"dynamic-segment-condition-type-and"},s().createElement("input",{type:"radio",value:fo.AND,checked:e.filters_connect===fo.AND,onChange:e=>t({filters_connect:e.target.value})}),s().createElement("span",{className:"mailpoet-form-radio-control"}),s().createElement("span",null,R()(h.Z.I18n.t("allConditions"),/<strong>(.*?)<\/strong>/g,((e,t)=>s().createElement("strong",{key:t},e))))),s().createElement("label",{className:"mailpoet-form-radio","data-automation-id":"dynamic-segment-condition-type-or"},s().createElement("input",{type:"radio",value:fo.OR,checked:e.filters_connect===fo.OR,onChange:e=>t({filters_connect:e.target.value})}),s().createElement("span",{className:"mailpoet-form-radio-control"}),s().createElement("span",null,R()(h.Z.I18n.t("anyConditions"),/<strong>(.*?)<\/strong>/g,((e,t)=>s().createElement("strong",{key:t},e)))))),s().createElement("div",{className:"mailpoet-gap"}))},yo=({index:e})=>{const t=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]);return t.filters.length<=1||e===t.filters.length-1?s().createElement("div",{className:"mailpoet-gap"}):s().createElement("p",null,s().createElement("span",{className:"mailpoet-gap"}),s().createElement("strong",null,t.filters_connect===fo.AND?h.Z.I18n.t("filterConnectAnd").toUpperCase():h.Z.I18n.t("filterConnectOr").toUpperCase()))};yo.propTypes={index:b().number.isRequired};const wo=(e,t)=>(e===mo.CLICKED||e===mo.NOT_CLICKED)&&null!=t,Eo=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n}=(0,lo.Z)("mailpoet-dynamic-segments-form"),a=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),[r,i]=(0,o.useState)([]),[l,c]=(0,o.useState)([]),[u,d]=(0,o.useState)(!1),p=null==a?void 0:a.map((e=>{const t=e.sent_at?h.Z.Date.format(e.sent_at):h.Z.I18n.t("notSentYet");return{label:`${e.subject} (${t})`,value:e.id}})),m=(0,o.useCallback)((()=>{var e;wo(t.action,t.newsletter_id)&&(c([]),e=t.newsletter_id,i([]),d(!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})));d(!1),c(n)})).fail((e=>{i(e.errors)})))}),[t.action,t.newsletter_id]);return(0,o.useEffect)((()=>{m()}),[m,t.action,t.newsletter_id]),s().createElement(s().Fragment,null,r.length>0&&s().createElement(gt,{errors:r}),s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectNewsletterPlaceholder"),options:p,value:(0,zn.find)(["value",t.newsletter_id],p),onChange:t=>{n({newsletter_id:t.value},e)},automationId:"segment-email"})),u&&h.Z.I18n.t("loadingDynamicSegmentItems"),!!l.length&&wo(t.action,t.newsletter_id)&&s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectLinkPlaceholder"),options:l,value:(0,zn.find)(["value",Number(t.link_id)],l),onChange:t=>{n({link_id:t.value},e)}})))};Eo.propTypes={filterIndex:b().number.isRequired};const _o=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n,updateSegmentFilterFromEvent:a}=(0,lo.Z)("mailpoet-dynamic-segments-form");return(0,o.useEffect)((()=>{void 0===t.operator&&n({operator:"more"},e)}),[n,t,e]),s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,(r=n=>"{condition}"===n?s().createElement(fe.Z,{key:"select",value:t.operator,onChange:t=>{a("operator",e,t)}},s().createElement("option",{value:"more"},h.Z.I18n.t("moreThan")),s().createElement("option",{value:"less"},h.Z.I18n.t("lessThan"))):"{opens}"===n?s().createElement(ce.Z,{key:"input",type:"number",value:t.opens||"","data-automation-id":"segment-number-of-opens",onChange:t=>{a("opens",e,t)},min:"0",placeholder:h.Z.I18n.t("emailActionOpens")}):"string"==typeof n&&n.trim().length>1?s().createElement("div",{key:"opens"},n):null,h.Z.I18n.t("emailActionOpensSentence").split(/({condition})|({opens})|(\b[a-zA-Z]+\b)/gim).map(r))),s().createElement(Ot.r.CenteredRow,null,h.Z.I18n.t("emailActionOpensDaysSentence").split(/({days})/gim).map((n=>"{days}"===n?s().createElement(ce.Z,{key:"input",type:"number",value:t.days||"","data-automation-id":"segment-number-of-days",onChange:t=>{a("days",e,t)},min:"0",placeholder:h.Z.I18n.t("emailActionDays")}):"string"==typeof n&&n.trim().length>1?s().createElement("div",{key:n},n):null))));var r};_o.propTypes={filterIndex:b().number.isRequired};const Zo=[{value:mo.OPENS_ABSOLUTE_COUNT,label:h.Z.I18n.t("emailActionOpensAbsoluteCount"),group:po.Email},{value:mo.MACHINE_OPENS_ABSOLUTE_COUNT,label:h.Z.I18n.t("emailActionMachineOpensAbsoluteCount"),group:po.Email},{value:mo.OPENED,label:h.Z.I18n.t("emailActionOpened"),group:po.Email},{value:mo.MACHINE_OPENED,label:h.Z.I18n.t("emailActionMachineOpened"),group:po.Email},{value:mo.NOT_OPENED,label:h.Z.I18n.t("emailActionNotOpened"),group:po.Email},{value:mo.CLICKED,label:h.Z.I18n.t("emailActionClicked"),group:po.Email},{value:mo.CLICKED_ANY,label:h.Z.I18n.t("emailActionClickedAnyEmail"),group:po.Email},{value:mo.NOT_CLICKED,label:h.Z.I18n.t("emailActionNotClicked"),group:po.Email}],Io={[mo.OPENS_ABSOLUTE_COUNT]:_o,[mo.MACHINE_OPENS_ABSOLUTE_COUNT]:_o,[mo.CLICKED]:Eo,[mo.NOT_CLICKED]:Eo,[mo.OPENED]:Eo,[mo.MACHINE_OPENED]:Eo,[mo.NOT_OPENED]:Eo,[mo.CLICKED_ANY]:null},So=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),n=Io[t.action];return n?s().createElement(n,{filterIndex:e}):null};var ko;So.propTypes={filterIndex:b().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"}(ko||(ko={}));const Co=[{value:ko.CUSTOMER_IN_COUNTRY,label:h.Z.I18n.t("wooCustomerInCountry"),group:po.WooCommerce},{value:ko.NUMBER_OF_ORDERS,label:h.Z.I18n.t("wooNumberOfOrders"),group:po.WooCommerce},{value:ko.PURCHASED_CATEGORY,label:h.Z.I18n.t("wooPurchasedCategory"),group:po.WooCommerce},{value:ko.PURCHASED_PRODUCT,label:h.Z.I18n.t("wooPurchasedProduct"),group:po.WooCommerce},{value:ko.TOTAL_SPENT,label:h.Z.I18n.t("wooTotalSpent"),group:po.WooCommerce}],To=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n,updateSegmentFilterFromEvent:a}=(0,lo.Z)("mailpoet-dynamic-segments-form"),r=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getProductCategories()),[]),i=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCountries()),[]),l=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getProducts()),[]),c=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCurrencySymbol()),[]),u=l.map((e=>({value:e.id,label:e.name}))),d=r.map((e=>({value:e.id,label:e.name}))),p=i.map((e=>({value:e.code,label:e.name})));let m;return(0,o.useEffect)((()=>{void 0===t.number_of_orders_type&&t.action===ko.NUMBER_OF_ORDERS&&n({number_of_orders_type:"="},e),void 0===t.total_spent_type&&t.action===ko.TOTAL_SPENT&&n({total_spent_type:">"},e),t.action===ko.PURCHASED_PRODUCT&&t.operator!==go.ALL&&t.operator!==go.ANY&&t.operator!==go.NONE&&n({operator:go.ANY},e)}),[n,t,e]),t.action===ko.PURCHASED_PRODUCT?m=s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select-operator",value:t.operator,onChange:t=>n({operator:t.target.value},e),automationId:"select-operator"},s().createElement("option",{value:go.ANY},h.Z.I18n.t("anyOf")),s().createElement("option",{value:go.ALL},h.Z.I18n.t("allOf")),s().createElement("option",{value:go.NONE},h.Z.I18n.t("noneOf")))),s().createElement(Ot.r.CenteredRow,null,s().createElement(uo.Z,{isMulti:!0,dimension:"small",key:"select-segment-products",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooPurchasedProduct"),options:u,value:(0,zn.filter)((e=>{if(void 0!==t.product_ids&&0!==t.product_ids.length)return-1!==t.product_ids.indexOf(e.value)}),u),onChange:t=>n({product_ids:(t||[]).map((e=>e.value))},e),automationId:"select-segment-products"}))):t.action===ko.PURCHASED_CATEGORY?m=s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",key:"select-segment-category",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooPurchasedCategory"),options:d,value:(0,zn.find)(["value",t.category_id],d),onChange:t=>n({category_id:t.value},e),automationId:"select-segment-category"})):t.action===ko.NUMBER_OF_ORDERS?m=s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select",value:t.number_of_orders_type,onChange:t=>{a("number_of_orders_type",e,t)},automationId:"select-number-of-orders-type"},s().createElement("option",{value:"="},h.Z.I18n.t("equal")),s().createElement("option",{value:">"},h.Z.I18n.t("moreThan")),s().createElement("option",{value:"<"},h.Z.I18n.t("lessThan"))),s().createElement(ce.Z,{"data-automation-id":"input-number-of-orders-count",type:"number",min:0,value:t.number_of_orders_count||"",placeholder:h.Z.I18n.t("wooNumberOfOrdersCount"),onChange:t=>{a("number_of_orders_count",e,t)}}),s().createElement("div",null,h.Z.I18n.t("wooNumberOfOrdersOrders"))),s().createElement(Ot.r.CenteredRow,null,s().createElement("div",null,h.Z.I18n.t("inTheLast")),s().createElement(ce.Z,{"data-automation-id":"input-number-of-orders-days",type:"number",min:1,value:t.number_of_orders_days||"",placeholder:h.Z.I18n.t("daysPlaceholder"),onChange:t=>{a("number_of_orders_days",e,t)}}),s().createElement("div",null,h.Z.I18n.t("days")))):t.action===ko.TOTAL_SPENT?m=s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select",value:t.total_spent_type,onChange:t=>{a("total_spent_type",e,t)},automationId:"select-total-spent-type"},s().createElement("option",{value:">"},h.Z.I18n.t("moreThan")),s().createElement("option",{value:"<"},h.Z.I18n.t("lessThan"))),s().createElement(ce.Z,{"data-automation-id":"input-total-spent-amount",type:"number",min:0,step:.01,value:t.total_spent_amount||"",placeholder:h.Z.I18n.t("wooTotalSpentAmount"),onChange:t=>{a("total_spent_amount",e,t)}}),s().createElement("div",null,c)),s().createElement(Ot.r.CenteredRow,null,s().createElement("div",null,h.Z.I18n.t("inTheLast")),s().createElement(ce.Z,{"data-automation-id":"input-total-spent-days",type:"number",min:1,value:t.total_spent_days||"",placeholder:h.Z.I18n.t("daysPlaceholder"),onChange:t=>{a("total_spent_days",e,t)}}),s().createElement("div",null,h.Z.I18n.t("days")))):t.action===ko.CUSTOMER_IN_COUNTRY&&(m=s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",key:"select-segment-country",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooCountry"),options:p,value:(0,zn.find)(["value",t.country_code],p),onChange:t=>n({country_code:t.value},e),automationId:"select-segment-country"}))),m};To.propTypes={filterIndex:b().number.isRequired};const No=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n}=(0,lo.Z)("mailpoet-dynamic-segments-form"),a=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getWordpressRoles()),[]).map((e=>({value:e.role_id,label:e.role_name})));return s().createElement("div",null,s().createElement(uo.Z,{isFullWidth:!0,placeholder:h.Z.I18n.t("selectUserRolePlaceholder"),options:a,value:(0,zn.find)((e=>{if(t.wordpressRole)return t.wordpressRole.toLowerCase()===e.value.toLowerCase()}),a),onChange:t=>{n({wordpressRole:t.value},e)},automationId:"segment-wordpress-role"}))};let Do;No.propTypes={filterIndex:b().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"}(Do||(Do={}));const xo=[Do.HIGHER_THAN,Do.LOWER_THAN,Do.EQUALS,Do.NOT_EQUALS,Do.UNKNOWN,Do.NOT_UNKNOWN],Ro=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n,updateSegmentFilterFromEvent:a}=(0,lo.Z)("mailpoet-dynamic-segments-form");return(0,o.useEffect)((()=>{xo.includes(t.operator)||n({operator:Do.HIGHER_THAN},e),t.operator!==Do.HIGHER_THAN&&t.operator!==Do.LOWER_THAN&&t.operator!==Do.EQUALS&&t.operator!==Do.NOT_EQUALS||void 0!==t.value||n({value:""},e),t.operator!==Do.UNKNOWN&&t.operator!==Do.NOT_UNKNOWN||n({value:null},e)}),[n,t,e]),s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,(r=n=>"{condition}"===n?s().createElement(fe.Z,{key:"select",value:t.operator,automationId:"segment-subscriber-score-operator",onChange:t=>{a("operator",e,t)}},s().createElement("option",{value:Do.HIGHER_THAN},h.Z.I18n.t("higherThan")),s().createElement("option",{value:Do.LOWER_THAN},h.Z.I18n.t("lowerThan")),s().createElement("option",{value:Do.EQUALS},h.Z.I18n.t("equals")),s().createElement("option",{value:Do.NOT_EQUALS},h.Z.I18n.t("notEquals")),s().createElement("option",{value:Do.UNKNOWN},h.Z.I18n.t("unknown")),s().createElement("option",{value:Do.NOT_UNKNOWN},h.Z.I18n.t("notUnknown"))):"{score}"===n?(t.operator===Do.HIGHER_THAN||t.operator===Do.LOWER_THAN||t.operator===Do.EQUALS||t.operator===Do.NOT_EQUALS)&&s().createElement(ce.Z,{key:"input",type:"number",value:t.value||"","data-automation-id":"segment-subscriber-score-value",onChange:t=>{a("value",e,t)},min:"0",placeholder:h.Z.I18n.t("subscriberScorePlaceholder")}):"string"==typeof n&&n.trim().length>0?t.operator!==Do.UNKNOWN&&t.operator!==Do.NOT_UNKNOWN&&s().createElement("div",{key:"score"},n):null,h.Z.I18n.t("subscriberScoreSentence").split(/({condition})|({score})|(\b%\b)/gim).map(r))));var r};Ro.propTypes={filterIndex:b().number.isRequired};var Oo=n(23855),Po=n(12274);let Lo;!function(e){e.BEFORE="before",e.AFTER="after",e.IN_THE_LAST="inTheLast",e.NOT_IN_THE_LAST="notInTheLast"}(Lo||(Lo={}));const Mo=[Lo.BEFORE,Lo.AFTER,Lo.IN_THE_LAST,Lo.NOT_IN_THE_LAST],Ao=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"})}},Fo=e=>{const t=(0,Oo.default)(e);if((0,Po.default)(t))return t},qo=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n,updateSegmentFilterFromEvent:a}=(0,lo.Z)("mailpoet-dynamic-segments-form");return(0,o.useEffect)((()=>{Mo.includes(t.operator)||n({operator:Lo.BEFORE},e),t.operator!==Lo.BEFORE&&t.operator!==Lo.AFTER||void 0!==Fo(t.value)&&new RegExp(/^\d+-\d+-\d+$/).test(t.value)||n({value:Ao(new Date)},e),t.operator!==Lo.IN_THE_LAST&&t.operator!==Lo.NOT_IN_THE_LAST||"string"!=typeof t.value||new RegExp(/^\d*$/).exec(t.value)||n({value:""},e)}),[n,t,e]),s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select",value:t.operator,onChange:t=>{a("operator",e,t)}},s().createElement("option",{value:Lo.BEFORE},h.Z.I18n.t("before")),s().createElement("option",{value:Lo.AFTER},h.Z.I18n.t("after")),s().createElement("option",{value:Lo.IN_THE_LAST},h.Z.I18n.t("inTheLast")),s().createElement("option",{value:Lo.NOT_IN_THE_LAST},h.Z.I18n.t("notInTheLast"))),(t.operator===Lo.BEFORE||t.operator===Lo.AFTER)&&s().createElement(At,{dateFormat:"MMMM d, yyyy",onChange:t=>{n({value:Ao(t)},e)},maxDate:new Date,selected:t.value?Fo(t.value):void 0}),(t.operator===Lo.IN_THE_LAST||t.operator===Lo.NOT_IN_THE_LAST)&&s().createElement(s().Fragment,null,s().createElement(ce.Z,{key:"input",type:"number",value:t.value,onChange:t=>{a("value",e,t)},min:"1",placeholder:h.Z.I18n.t("daysPlaceholder")}),s().createElement("span",null,h.Z.I18n.t("daysPlaceholder")))))};function $o(e){return"string"==typeof e.value&&e.value.length>0&&("equals"===e.operator||"contains"===e.operator)}qo.propTypes={filterIndex:b().number.isRequired};const Uo=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilterFromEvent:n,updateSegmentFilter:a}=(0,lo.Z)("mailpoet-dynamic-segments-form");return(0,o.useEffect)((()=>{void 0===t.operator&&a({operator:"equals",value:""},e)}),[a,t,e]),s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select",automationId:"text-custom-field-operator",value:t.operator,onChange:t=>{n("operator",e,t)}},s().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),s().createElement("option",{value:"contains"},h.Z.I18n.t("contains"))),s().createElement(ce.Z,{key:"input","data-automation-id":"text-custom-field-value",value:t.value||"",onChange:t=>{n("value",e,t)},placeholder:h.Z.I18n.t("value")})))};function jo(e){return"string"==typeof e.value&&e.value.length>0}Uo.propTypes={filterIndex:b().number.isRequired};const Wo=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n}=(0,lo.Z)("mailpoet-dynamic-segments-form"),a=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),r=(0,zn.find)({id:Number(t.custom_field_id)},a);if(!r)return null;const i=r.params;if(!i||!Array.isArray(i.values))return null;const o=i.values.map((e=>({value:e.value,label:e.value})));return s().createElement(s().Fragment,null,s().createElement(uo.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectValue"),options:o,value:t.value?{value:t.value,label:t.value}:null,onChange:t=>{n({value:t.value,operator:"equals"},e)},automationId:"segment-wordpress-role"}))};Wo.propTypes={filterIndex:b().number.isRequired};const Vo=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilterFromEvent:n,updateSegmentFilter:a}=(0,lo.Z)("mailpoet-dynamic-segments-form");return(0,o.useEffect)((()=>{"1"!==t.value&&"0"!==t.value&&a({operator:"equals",value:"1"},e)}),[a,t,e]),s().createElement(s().Fragment,null,s().createElement(fe.Z,{key:"select",value:t.value,onChange:t=>n("value",e,t)},s().createElement("option",{value:"1"},h.Z.I18n.t("checked")),s().createElement("option",{value:"0"},h.Z.I18n.t("unchecked"))))};Vo.propTypes={filterIndex:b().number.isRequired};var Yo=n(95570),Bo=n(49546);const Ho=({onChange:e,item:t,filterIndex:n})=>((0,o.useEffect)((()=>{void 0!==t.value&&""!==t.value||e((0,zn.assign)(t,{value:"2017-01-01 00:00:00"}),n)}),[e,t,n]),s().createElement(fe.Z,{key:"select",value:t.value,onChange:a=>{e((0,zn.assign)(t,{value:a.target.value}),n)}},s().createElement("option",{value:"2017-01-01 00:00:00"},h.Z.I18n.t("january")),s().createElement("option",{value:"2017-02-01 00:00:00"},h.Z.I18n.t("february")),s().createElement("option",{value:"2017-03-01 00:00:00"},h.Z.I18n.t("march")),s().createElement("option",{value:"2017-04-01 00:00:00"},h.Z.I18n.t("april")),s().createElement("option",{value:"2017-05-01 00:00:00"},h.Z.I18n.t("may")),s().createElement("option",{value:"2017-06-01 00:00:00"},h.Z.I18n.t("june")),s().createElement("option",{value:"2017-07-01 00:00:00"},h.Z.I18n.t("july")),s().createElement("option",{value:"2017-08-01 00:00:00"},h.Z.I18n.t("august")),s().createElement("option",{value:"2017-09-01 00:00:00"},h.Z.I18n.t("september")),s().createElement("option",{value:"2017-10-01 00:00:00"},h.Z.I18n.t("october")),s().createElement("option",{value:"2017-11-01 00:00:00"},h.Z.I18n.t("november")),s().createElement("option",{value:"2017-12-01 00:00:00"},h.Z.I18n.t("december"))));Ho.propTypes={filterIndex:b().number.isRequired};const zo=({onChange:e,item:t,filterIndex:n})=>{const a=(0,Yo.default)(new Date);return(0,o.useEffect)((()=>{void 0!==t.value&&""!==t.value||e((0,zn.assign)(t,{value:`${a}-01-01 00:00:00`,operator:"equals"}),n)}),[a,e,t,n]),s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select-operator",value:t.operator,onChange:a=>{e((0,zn.assign)(t,{operator:a.target.value}),n)}},s().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),s().createElement("option",{value:"before"},h.Z.I18n.t("before")),s().createElement("option",{value:"after"},h.Z.I18n.t("after"))),s().createElement(fe.Z,{key:"select-year",value:t.value,onChange:a=>{e((0,zn.assign)(t,{value:a.target.value}),n)}},(0,zn.range)(0,100).map((e=>s().createElement("option",{value:a-e+"-01-01 00:00:00",key:a-e},a-e)))))};zo.propTypes={filterIndex:b().number.isRequired};const Ko=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return(0,Bo.default)(e,"yyyy-MM-dd 00:00:00")}},Go=e=>{const t=(0,Oo.default)(e);if((0,Po.default)(t))return t},Qo=({onChange:e,item:t,filterIndex:n})=>((0,o.useEffect)((()=>{void 0!==t.value&&""!==t.value||e((0,zn.assign)(t,{value:`${(0,Bo.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),n)}),[e,t,n]),s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select-operator",value:t.operator,onChange:a=>{e((0,zn.assign)(t,{operator:a.target.value}),n)}},s().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),s().createElement("option",{value:"before"},h.Z.I18n.t("before")),s().createElement("option",{value:"after"},h.Z.I18n.t("after"))),s().createElement(At,{dateFormat:"MMMM d, yyyy",onChange:a=>e((0,zn.assign)(t,{value:Ko(a)}),n),selected:t.value?Go(t.value):void 0})));Qo.propTypes={filterIndex:b().number.isRequired};const Xo=({onChange:e,item:t,filterIndex:n})=>((0,o.useEffect)((()=>{void 0!==t.value&&""!==t.value||e((0,zn.assign)(t,{value:`${(0,Bo.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),n)}),[e,t,n]),s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select-operator",value:t.operator,onChange:a=>{e((0,zn.assign)(t,{operator:a.target.value}),n)}},s().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),s().createElement("option",{value:"before"},h.Z.I18n.t("before")),s().createElement("option",{value:"after"},h.Z.I18n.t("after"))),s().createElement(At,{onChange:a=>e((0,zn.assign)(t,{value:Ko(a)}),n),selected:t.value?Go(t.value):void 0,dateFormat:"MM/yyyy",showMonthYearPicker:!0})));Xo.propTypes={filterIndex:b().number.isRequired};const Jo={month:Ho,year:zo,year_month:Xo,year_month_day:Qo},es=({customField:e,filterIndex:t})=>{const n=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,lo.Z)("mailpoet-dynamic-segments-form");(0,o.useEffect)((()=>{n.date_type!==e.params.date_type&&a({date_type:e.params.date_type,value:""},t)}),[n.date_type,a,e.params.date_type,t]);const r=Jo[e.params.date_type];return r?s().createElement(s().Fragment,null,s().createElement(r,{item:n,onChange:a,filterIndex:t})):null};var ts;es.propTypes={customField:b().shape({params:b().shape({date_type:b().string.isRequired}).isRequired}).isRequired,filterIndex:b().number.isRequired},function(e){e.DATE="date",e.TEXT="text",e.TEXTAREA="textarea",e.RADIO="radio",e.CHECKBOX="checkbox",e.SELECT="select"}(ts||(ts={}));const ns={[ts.TEXT]:$o,[ts.TEXTAREA]:$o,[ts.RADIO]:jo,[ts.SELECT]:jo,[ts.CHECKBOX]:function(e){return"1"===e.value||"0"===e.value},[ts.DATE]:function(e){return("month"===e.date_type||!("string"!=typeof e.operator||e.operator.length<1))&&"string"==typeof e.value&&e.value.length>1}},as={[ts.TEXT]:Uo,[ts.TEXTAREA]:Uo,[ts.RADIO]:Wo,[ts.SELECT]:Wo,[ts.CHECKBOX]:Vo,[ts.DATE]:es},rs=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n}=(0,lo.Z)("mailpoet-dynamic-segments-form"),a=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),r=(0,zn.find)({id:Number(t.custom_field_id)},a),i=a.map((e=>({value:e.id.toString(),label:e.name}))),o=as[t.custom_field_type];return s().createElement(s().Fragment,null,s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectCustomFieldPlaceholder"),options:i,automationId:"select-custom-field",value:(0,zn.find)((e=>{if(t.custom_field_id)return t.custom_field_id===e.value}),i),onChange:t=>{const r=(0,zn.find)({id:Number(t.value)},a);r&&n({custom_field_id:t.value,custom_field_type:r.type,operator:void 0,value:void 0},e)}})),s().createElement("div",null,o&&s().createElement(o,{customField:r,filterIndex:e})))};rs.propTypes={filterIndex:b().number.isRequired};const is=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),n=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getStaticSegmentsList()),[]),{updateSegmentFilter:a,updateSegmentFilterFromEvent:r}=(0,lo.Z)("mailpoet-dynamic-segments-form");(0,o.useEffect)((()=>{t.operator!==go.ANY&&t.operator!==go.ALL&&t.operator!==go.NONE&&a({operator:go.ANY},e)}),[a,t,e]);const i=n.map((e=>({value:e.id,label:e.name})));return s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select",isFullWidth:!0,value:t.operator,onChange:t=>{r("operator",e,t)}},s().createElement("option",{value:go.ANY},h.Z.I18n.t("anyOf")),s().createElement("option",{value:go.ALL},h.Z.I18n.t("allOf")),s().createElement("option",{value:go.NONE},h.Z.I18n.t("noneOf")))),s().createElement(Ot.r.CenteredRow,null,s().createElement(uo.Z,{dimension:"small",isFullWidth:!0,isMulti:!0,placeholder:h.Z.I18n.t("searchLists"),options:i,value:(0,zn.filter)((e=>{if(!t.segments)return;const n=e.value;return-1!==t.segments.indexOf(n)}),i),onChange:t=>{a({segments:(0,zn.map)("value",t)},e)}})))};is.propTypes={filterIndex:b().number.isRequired};const os=[{value:ho.MAILPOET_CUSTOM_FIELD,label:h.Z.I18n.t("mailpoetCustomField"),group:po.WordPressRole},{value:ho.SUBSCRIBER_SCORE,label:h.Z.I18n.t("subscriberScore"),group:po.WordPressRole},{value:ho.SUBSCRIBED_DATE,label:h.Z.I18n.t("subscribedDate"),group:po.WordPressRole},{value:ho.SUBSCRIBED_TO_LIST,label:h.Z.I18n.t("subscribedToList"),group:po.WordPressRole},{value:ho.WORDPRESS_ROLE,label:h.Z.I18n.t("segmentsSubscriber"),group:po.WordPressRole}],ss={[ho.WORDPRESS_ROLE]:No,[ho.SUBSCRIBER_SCORE]:Ro,[ho.SUBSCRIBED_DATE]:qo,[ho.MAILPOET_CUSTOM_FIELD]:rs,[ho.SUBSCRIBED_TO_LIST]:is},ls=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]);let n;return n=t.action?ss[t.action]:No,n?s().createElement(n,{filterIndex:e}):null};var cs;ls.propTypes={filterIndex:b().number.isRequired},function(e){e.ACTIVE_SUBSCRIPTIONS="hasActiveSubscription"}(cs||(cs={}));const us=[{value:cs.ACTIVE_SUBSCRIPTIONS,label:h.Z.I18n.t("segmentsActiveSubscription"),group:po.WooCommerceSubscription}],ds=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n}=(0,lo.Z)("mailpoet-dynamic-segments-form"),a=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriptionProducts()),[]).map((e=>({value:e.id,label:e.name})));return s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooSubscription"),automationId:"segment-woo-subscription-action",options:a,value:(0,zn.find)(["value",t.product_id],a),onChange:t=>{n({product_id:t.value},e)}}))};ds.propTypes={filterIndex:b().number.isRequired};const ps={[po.Email]:function(e){return!(!Object.values(mo).some((t=>t===e.action))||e.action!==mo.CLICKED_ANY&&(e.action!==mo.OPENS_ABSOLUTE_COUNT&&e.action!==mo.MACHINE_OPENS_ABSOLUTE_COUNT?!e.newsletter_id:!e.days||!e.opens||!e.operator))},[po.WooCommerce]:function(e){if(!Object.values(ko).some((t=>t===e.action)))return!1;if(e.action===ko.PURCHASED_CATEGORY&&!e.category_id)return!1;const t=void 0===e.product_ids||0===e.product_ids.length||!e.operator;if(e.action===ko.PURCHASED_PRODUCT&&t)return!1;if(e.action===ko.CUSTOMER_IN_COUNTRY&&!e.country_code)return!1;const n=!e.number_of_orders_count||!e.number_of_orders_days||!e.number_of_orders_type;return!(e.action===ko.NUMBER_OF_ORDERS&&n||!(e.action!==ko.TOTAL_SPENT||e.total_spent_amount&&e.total_spent_days&&e.total_spent_type))},[po.WordPressRole]:function(e){return e.action&&e.action!==ho.WORDPRESS_ROLE?e.action===ho.MAILPOET_CUSTOM_FIELD?function(e){const t=ns[e.custom_field_type];return!!t&&t(e)}(e):e.action===ho.SUBSCRIBER_SCORE?function(e){if(e.operator===Do.HIGHER_THAN||e.operator===Do.LOWER_THAN||e.operator===Do.EQUALS||e.operator===Do.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===Do.UNKNOWN||e.operator===Do.NOT_UNKNOWN}(e):e.action===ho.SUBSCRIBED_TO_LIST?function(e){return(e.operator===go.ANY||e.operator===go.ALL||e.operator===go.NONE)&&Array.isArray(e.segments)&&e.segments.length>0}(e):!(!e.operator||!e.value)&&(e.operator===Lo.BEFORE||e.operator===Lo.AFTER?new RegExp(/^\d+-\d+-\d+$/).test(e.value):(e.operator===Lo.IN_THE_LAST||e.operator===Lo.NOT_IN_THE_LAST)&&(new RegExp(/^\d+$/).test(e.value)&&Number(e.value)>0)):!!e.wordpressRole},[po.WooCommerceSubscription]:function(e){return!(e.action===cs.ACTIVE_SUBSCRIPTIONS&&!e.product_id)}};function ms(e){return!(e.length<1)&&0===e.map((e=>void 0!==ps[e.segmentType]&&ps[e.segmentType](e))).filter((e=>!1===e)).length}var hs=n(96486),fs=n.n(hs);let gs,vs;const bs=()=>{const e=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),{updateSubscriberCount:n}=(0,lo.Z)("mailpoet-dynamic-segments-form"),a=JSON.stringify(e);return(0,o.useEffect)((()=>{var t;ms(e.filters)?(t=e,n({loading:!0,count:void 0,errors:void 0}),function(e){const t={filters:e.filters,filters_connect:e.filters_connect};return fs().isEqual(t,gs)?Promise.resolve(vs):(gs={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 vs={count:t.count,errors:void 0},vs})))}(t).then((e=>{const t={loading:!1};e&&(t.count=e.count,t.errors=e.errors),n(t)}),(e=>{const t={},a=e.errors.map((e=>e.message));t.loading=!1,t.count=void 0,t.errors=a,n(t)}))):n({count:void 0,loading:!1})}),[e,a,n]),t.errors?s().createElement("div",{className:"mailpoet-form-field"},s().createElement("span",{className:"mailpoet-form-error-message"},h.Z.I18n.t("dynamicSegmentSizeCalculatingTimeout"))):t.loading||void 0!==t.count?t.loading?s().createElement("div",{className:"mailpoet-form-field"},s().createElement("span",{className:"mailpoet-form-notice-message"},h.Z.I18n.t("dynamicSegmentSizeIsCalculated"))):s().createElement("div",{className:"mailpoet-form-field"},s().createElement("span",{className:"mailpoet-form-notice-message"},h.Z.I18n.t("dynamicSegmentSize").replace("%1$d",t.count.toLocaleString()))):s().createElement("span",null)},ys={[po.Email]:So,[po.WooCommerce]:To,[po.WordPressRole]:ls,[po.WooCommerceSubscription]:ds},ws=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]);if(void 0===t||void 0===ys[t.segmentType])return null;const n=ys[t.segmentType];return s().createElement(n,{filterIndex:e})};ws.propTypes={filterIndex:b().number.isRequired};const Es=s().createElement("svg",{viewBox:"0 0 24 24"},s().createElement("path",{d:"M20 14H4V10H20V14Z"})),_s=()=>{const e=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=[mo.OPENED,mo.OPENS_ABSOLUTE_COUNT,mo.MACHINE_OPENED,mo.MACHINE_OPENS_ABSOLUTE_COUNT,mo.NOT_OPENED];let n=!1;return e.filters.forEach((e=>{t.includes(e.action)&&(n=!0)})),n?s().createElement("div",{className:"mailpoet-form-field"},s().createElement("span",{className:"mailpoet-form-notice-message"},h.Z.I18n.t("privacyProtectionNotice"))):s().createElement("span",null)},Zs=({segmentId:e})=>{const t=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),n=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getAvailableFilters()),[]),a=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").findFiltersValueForSegment(t)),[t]),r=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),i=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getErrors()),[]),{updateSegment:o,updateSegmentFilter:l,handleSave:c}=(0,lo.Z)("mailpoet-dynamic-segments-form");return s().createElement("form",{className:"mailpoet_form"},i.length>0&&s().createElement(gt,{errors:i.map((e=>({message:e})))}),s().createElement("div",{className:"mailpoet-form-grid"},s().createElement("div",{className:"mailpoet-form-field-name form-field-row-name mailpoet-segments-name-section"},s().createElement(Ne.Z,{level:4},s().createElement("label",{htmlFor:"field_name"},h.Z.I18n.t("name"))),s().createElement("div",{className:"mailpoet-form-field"},s().createElement(ce.Z,{isFullWidth:!0,type:"text",name:"name",id:"field_name",defaultValue:t.name,onChange:e=>o({name:e.target.value})}))),s().createElement("div",{className:"mailpoet-form-field-description form-field-row-description mailpoet-segments-description-section"},s().createElement(Ne.Z,{level:4},s().createElement("label",{htmlFor:"field_description"},h.Z.I18n.t("description"))),s().createElement("p",{className:"mailpoet-form-description"},h.Z.I18n.t("segmentDescriptionTip")),s().createElement("div",{className:"mailpoet-form-field"},s().createElement(pe.Z,{isFullWidth:!0,name:"description",id:"field_description",value:t.description,onChange:e=>o({description:e.target.value})}))),s().createElement("div",{className:"mailpoet-segments-segments-section"},s().createElement(Ne.Z,{level:4},s().createElement("label",{htmlFor:"field_filters"},h.Z.I18n.t("formPageTitle"))),s().createElement(bo,null),Array.isArray(a)&&a.map(((e,r)=>s().createElement(s().Fragment,{key:e.index},s().createElement(Ot.r.ThreeColumns,{automationId:`filter-row-${r}`},a.length>1&&s().createElement("a",{href:void 0,className:"mailpoet-form-segment-delete","data-automation-id":"delete-filter-row",onClick:e=>{e.preventDefault();const n=t.filters;n.splice(r,1),o({filters:n})}},Es),s().createElement(Ot.r.CenteredRow,null,s().createElement(uo.Z,{dimension:"small",placeholder:h.Z.I18n.t("selectActionPlaceholder"),options:n,value:e.filterValue,onChange:e=>{l({segmentType:e.group,action:e.value},r)},automationId:"select-segment-action",isFullWidth:!0})),void 0!==e.index&&s().createElement(ws,{filterIndex:e.index})),s().createElement(yo,{index:r})))),s().createElement(y.Z,{type:"button",variant:"tertiary",iconStart:W,onClick:e=>{e.preventDefault();const n=t.filters;n.push({segmentType:po.WordPressRole,action:ho.WORDPRESS_ROLE}),o({filters:n})}},h.Z.I18n.t("addCondition"))),s().createElement("div",{className:"mailpoet-segments-counter-section"},s().createElement(bs,null),s().createElement(_s,null)),s().createElement("div",{className:"mailpoet-form-actions"},s().createElement(y.Z,{type:"submit",onClick:t=>{t.preventDefault(),c(e)},isDisabled:!ms(t.filters)||void 0===r.count},h.Z.I18n.t("save")))))};Zs.propTypes={segmentId:b().number};var Is=n(61299);const Ss=e=>e.products,ks=e=>e.subscriptionProducts,Cs=e=>e.wordpressRoles,Ts=e=>e.productCategories,Ns=e=>e.newslettersList,Ds=e=>e.canUseWooSubscriptions,xs=e=>e.wooCurrencySymbol,Rs=e=>e.wooCountries,Os=e=>e.customFieldsList,Ps=e=>e.segment,Ls=e=>e.staticSegmentsList,Ms=e=>e.subscriberCount,As=(e,t)=>{let n;return Array.isArray(e.segment.filters)?(n={...e.segment.filters[t]},n):n},Fs=e=>e.errors,qs=e=>e.allAvailableFilters,$s=(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},Us=e=>(t=e,n)=>{switch(n.type){case vo.SET_SEGMENT:return function(e,t){return{...e,segment:t.segment}}(t,n);case vo.SET_ERRORS:return function(e,t){return{...e,errors:t.errors}}(t,n);case vo.UPDATE_SEGMENT:return function(e,t){const n=e.segment;return{...e,segment:(0,zn.assign)(n,t.segment)}}(t,n);case vo.UPDATE_SEGMENT_FILTER:return function(e,t){const n={...e.segment};return n.filters[t.filterIndex]=(0,zn.assign)(n.filters[t.filterIndex],t.filter),{...e,segment:n}}(t,n);case vo.UPDATE_SUBSCRIBER_COUNT:return function(e,t){const n=e.subscriberCount;return{...e,subscriberCount:(0,zn.assign)(n,t.subscriberCount)}}(t,n);default:return t}};function js(e){return{type:vo.SET_SEGMENT,segment:e}}function Ws(e){return{type:vo.SET_ERRORS,errors:e}}function Vs(e){return{type:vo.UPDATE_SEGMENT,segment:e}}function Ys(e,t){return{type:vo.UPDATE_SEGMENT_FILTER,filter:e,filterIndex:t}}function Bs(e,t){return{type:vo.UPDATE_SEGMENT,segment:{[e]:t.target.value}}}function Hs(e,t,n){return{type:vo.UPDATE_SEGMENT_FILTER,filter:{[e]:n.target.value},filterIndex:t}}function zs(e){return{type:vo.UPDATE_SUBSCRIBER_COUNT,subscriberCount:e}}function*Ks(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 js(t),h.Z.Modal.loading(!1)}function*Gs(e){const t=(0,Is.Ys)("mailpoet-dynamic-segments-form").getSegment();yield Ws([]);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 Ws(n)}function Qs(e){let t=JSON.parse(JSON.stringify(e));return(0,zn.has)("link_id",e)&&(t=(0,zn.assign)(t,{link_id:e.link_id.toString()})),(0,zn.has)("newsletter_id",e)&&(t=(0,zn.assign)(t,{newsletter_id:e.newsletter_id.toString()})),(0,zn.has)("product_id",e)&&(t=(0,zn.assign)(t,{product_id:e.product_id.toString()})),(0,zn.has)("category_id",e)&&(t=(0,zn.assign)(t,{category_id:e.category_id.toString()})),t}async function Xs({segmentId:e}){try{return{success:!0,res:Qs((await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"dynamic_segments",action:"get",data:{id:e}})).data)}}catch(e){return{success:!1,error:e.errors.map((e=>e.message)),res:e}}}async function Js({segment:e}){try{return await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"dynamic_segments",action:"save",data:e}),{success:!0}}catch(e){return{success:!1,error:e.errors.map((e=>e.message))}}}function el(e){const t=[{label:h.Z.I18n.t("email"),options:Zo},{label:h.Z.I18n.t("wpUserRole"),options:os}];return h.Z.isWoocommerceActive&&t.push({label:h.Z.I18n.t("woocommerce"),options:Co}),h.Z.isWoocommerceActive&&e&&t.push({label:h.Z.I18n.t("woocommerceSubscriptions"),options:us}),t}var tl=()=>{const e=(0,d.useRouteMatch)();(()=>{const e={products:window.mailpoet_products,staticSegmentsList:window.mailpoet_static_segments_list,subscriptionProducts:window.mailpoet_subscription_products,productCategories:window.mailpoet_product_categories,newslettersList:window.mailpoet_newsletters_list,wordpressRoles:window.wordpress_editable_roles_list,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:fo.AND,filters:[{segmentType:po.WordPressRole,action:ho.WORDPRESS_ROLE}]},subscriberCount:{loading:!1},errors:[],allAvailableFilters:el(window.mailpoet_can_use_woocommerce_subscriptions)},t={selectors:a,actions:r,controls:i,reducer:Us(e),resolvers:{}};(0,Is.R9)("mailpoet-dynamic-segments-form",t)})();const{pageLoaded:t}=(0,lo.Z)("mailpoet-dynamic-segments-form");return(0,o.useEffect)((()=>{t(e.params.id)}),[e.params.id,t]),s().createElement(s().Fragment,null,s().createElement(Le.Z,{color:"#fff"}),s().createElement(Me.Z,null),s().createElement(Ne.Z,{level:1,className:"mailpoet-title"},s().createElement("span",null,h.Z.I18n.t("formPageTitle")),s().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:"/segments"},h.Z.I18n.t("backToList"))),s().createElement(Zs,{segmentId:Number(e.params.id)}))};const nl=[{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}],al={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)}},rl=[{name:"edit",className:"mailpoet-hide-on-mobile",link:e=>s().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=>s().createElement(u.rU,{to:`/edit-segment/${e.id}`},h.Z.I18n.t("edit")),display:e=>e.is_plugin_missing},{name:"view_subscribers",link:e=>s().createElement("a",{href:e.subscribers_url},h.Z.I18n.t("viewSubscribers"))},{name:"trash",className:"mailpoet-hide-on-mobile"}],il=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:al.onTrash}];function ol(e,t){return s().createElement(s().Fragment,null,s().createElement("td",{className:"column-primary","data-colname":h.Z.I18n.t("nameColumn")},s().createElement("span",{className:"mailpoet-listing-title"},e.name),t),s().createElement("td",{"data-colname":h.Z.I18n.t("description")},s().createElement("abbr",null,e.description)),e.is_plugin_missing?s().createElement("td",{colSpan:"2",className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("missingPluginMessageColumn")},e.missing_plugin_message):s().createElement(s().Fragment,null,s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribersCountColumn")},parseInt(e.count_all,10).toLocaleString()),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribed")},parseInt(e.count_subscribed,10).toLocaleString())),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("updatedAtColumn")},h.Z.Date.short(e.created_at),s().createElement("br",null),h.Z.Date.time(e.created_at)))}function sl(e){return s().createElement(s().Fragment,null,s().createElement(I(),{limit:window.mailpoet_listing_per_page,location:e.location,params:e.match.params,search:!0,onRenderItem:ol,endpoint:"dynamic_segments",base_url:"segments",columns:nl,messages:al,sort_by:"created_at",sort_order:"desc",item_actions:rl,bulk_actions:il}),s().createElement("p",{className:"mailpoet_sending_methods_help help"},s().createElement("b",null,h.Z.I18n.t("segmentsTip"),":")," ",h.Z.I18n.t("segmentsTipText")," ",s().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:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var ll=(0,d.withRouter)(sl),cl=()=>s().createElement(s().Fragment,null,s().createElement(j.Q,null,s().createElement(u.rU,{className:"mailpoet-button button-secondary",to:"/new"},W,s().createElement("span",null,h.Z.I18n.t("new"))),s().createElement(u.rU,{className:"mailpoet-button button-secondary",to:"/new-segment","data-automation-id":"new-segment"},W,s().createElement("span",null,h.Z.I18n.t("newSegment")))),s().createElement(U,{subscribersInPlan:h.Z.subscribersCount,subscribersInPlanLimit:h.Z.subscribersLimit}),s().createElement(A,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),s().createElement(P,null),s().createElement(M,{mssKeyInvalid:h.Z.hasInvalidMssApiKey,subscribersCount:h.Z.subscribersCount}));const ul=document.getElementById("segments_container"),dl=()=>s().createElement(s().Fragment,null,s().createElement(cl,null),s().createElement(Ni.Z,{activeKey:"lists",routerType:"switch-only"},s().createElement(Ei.Z,{key:"lists",route:"lists/(.*)?",title:h.Z.I18n.t("pageTitle")},s().createElement(ao,null)),s().createElement(Ei.Z,{key:"segments",route:"segments/(.*)?",title:h.Z.I18n.t("pageTitleSegments"),automationId:"dynamic-segments-tab"},s().createElement(ll,null)))),pl=()=>s().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},s().createElement(u.UT,null,s().createElement(ot.Z,null),s().createElement(d.Switch,null,s().createElement(d.Route,{exact:!0,path:"/",render:()=>s().createElement(d.Redirect,{to:"/lists"})}),s().createElement(d.Route,{path:"/new",component:so}),s().createElement(d.Route,{path:"/edit/:id",component:so}),s().createElement(d.Route,{path:"/new-segment",component:tl}),s().createElement(d.Route,{path:"/edit-segment/:id",component:tl}),s().createElement(d.Route,{path:"/segments/(.*)?",component:dl}),s().createElement(d.Route,{path:"/lists/(.*)?",component:dl}))));ul&&c().render(s().createElement(pl,null),ul);const ml=()=>{h.Z.trackEvent("Forms > Add New"),setTimeout((()=>{window.location=window.mailpoet_form_template_selection_url}),200)},hl=()=>{const[e,t]=(0,o.useState)(!1);return s().createElement(j.Q,null,s().createElement(y.Z,{onClick:()=>{t(!0),ml()},withSpinner:e,automationId:"create_new_form",variant:"secondary",iconStart:W},h.Z.I18n.t("new")))},fl=[{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}],gl={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:()=>s().createElement("div",{className:"mailpoet-forms-add-new-row"},s().createElement("p",null,h.Z.I18n.t("noItemsFound")),s().createElement(Re.Button,{onClick:ml,automationId:"add_new_form",iconStart:W},h.Z.I18n.t("new")))},vl=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:gl.onTrash}],bl=[{name:"edit",className:"mailpoet-hide-on-mobile",label:h.Z.I18n.t("edit"),link:function(e){return s().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 yl extends s().Component{constructor(...e){super(...e),(0,C.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,C.Z)(this,"isItemInactive",(e=>"disabled"===e.status)),(0,C.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){var t,n,a,r,i,o,s,l;const c=[];return"1"===(null==e||null===(t=e.form_placement)||void 0===t||null===(n=t.fixed_bar)||void 0===n?void 0:n.enabled)&&c.push(h.Z.I18n.t("placeFixedBarFormOnPages")),"1"===(null==e||null===(a=e.form_placement)||void 0===a||null===(r=a.below_posts)||void 0===r?void 0:r.enabled)&&c.push(h.Z.I18n.t("placeFormBellowPages")),"1"===(null==e||null===(i=e.form_placement)||void 0===i||null===(o=i.popup)||void 0===o?void 0:o.enabled)&&c.push(h.Z.I18n.t("placePopupFormOnPages")),"1"===(null==e||null===(s=e.form_placement)||void 0===s||null===(l=s.slide_in)||void 0===l?void 0:l.enabled)&&c.push(h.Z.I18n.t("placeSlideInFormOnPages")),c.length>0?c.join(", "):h.Z.I18n.t("placeFormOthers")}(e.settings);return s().createElement(s().Fragment,null,s().createElement("td",{className:n},s().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),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("segments")},s().createElement(_,{segments:a,dimension:"large"},"user"===e.settings.segments_selected_by&&s().createElement("span",{className:"mailpoet-tags-prefix"},h.Z.I18n.t("userChoice")))),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("type")},r),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("updatedAt")},h.Z.Date.short(e.updated_at),s().createElement("br",null),h.Z.Date.time(e.updated_at)))}))}renderStatus(e){return s().createElement("div",null,s().createElement(nn,{onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"enabled"===e.status}),s().createElement("p",null,h.Z.I18n.t("signups"),": ",e.signups.toLocaleString()))}render(){return s().createElement("div",{className:"mailpoet-listing-no-actions-on-mobile"},s().createElement(hl,null),s().createElement(I(),{limit:window.mailpoet_listing_per_page,className:"mailpoet-forms-listing",location:this.props.location,params:this.props.match.params,messages:gl,search:!1,endpoint:"forms",onRenderItem:this.renderItem,isItemInactive:this.isItemInactive,columns:fl,bulk_actions:vl,item_actions:bl}))}}yl.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var wl=Mi(yl);const El=()=>s().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},s().createElement(u.UT,null,s().createElement(ot.Z,null),s().createElement(d.Route,{path:"*",component:wl}))),_l=document.getElementById("forms_container");_l&&c().render(s().createElement(El,null),_l);var Zl=function(){return s().createElement(s().Fragment,null,s().createElement("p",null,h.Z.I18n.t("knowledgeBaseIntro")),s().createElement("ul",{className:"mailpoet-text-links"},s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/116-common-problems"},"Common Problems")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/165-newsletters"},"Newsletters")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/156-migration-questions"},"Migration Questions")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/149-sending-methods"},"Sending Methods")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/139-subscription-forms"},"Subscription Forms")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/114-getting-started"},"Getting Started")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/123-newsletter-designer"},"Newsletter Designer")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/121-subscribers-and-lists"},"Subscribers and Lists"))),s().createElement(y.Z,{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/"},h.Z.I18n.t("knowledgeBaseButton")))};function Il(e){e.target.select()}var Sl=function(){const e=window.systemInfoData;return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet_notice notice inline"},s().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 s().createElement("textarea",{readOnly:!0,onFocus:Il,value:t.join("\n"),style:{width:"100%",height:"400px"}})}return s().createElement("p",null,h.Z.I18n.t("systemInfoDataError"))}(e))};const kl=e=>s().createElement("table",{className:"widefat fixed",style:{maxWidth:e.max_width}},s().createElement("tbody",null,e.rows.map((e=>s().createElement("tr",{key:`row_${e.key}`},s().createElement("td",{className:"row-title"},e.key),s().createElement("td",null,e.value))))));kl.propTypes={max_width:b().string,rows:b().arrayOf(b().shape({key:b().string.isRequired,value:b().oneOfType([b().string,b().number,b().element]).isRequired})).isRequired},kl.defaultProps={max_width:"auto"};var Cl=kl;const Tl=e=>s().createElement("span",null,!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown);Tl.propTypes={truthy:b().string,falsy:b().string,unknown:b().string,children:b().bool},Tl.defaultProps={truthy:h.Z.I18n.t("yes"),falsy:h.Z.I18n.t("no"),unknown:h.Z.I18n.t("unknown"),children:null};var Nl=Tl;const Dl=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)?s().createElement(s().Fragment,null,t.last_error.map((e=>s().createElement("div",{key:e.worker},e.worker,":"," ",s().createElement("i",null,e.message))))):t.last_error;return s().createElement("div",null,s().createElement("h4",null,h.Z.I18n.t("systemStatusCronStatusTitle")),s().createElement(Cl,{max_width:"400px",rows:[{key:h.Z.I18n.t("accessible"),value:s().createElement(Nl,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")}]}))};Dl.propTypes={status_data:b().shape({accessible:b().bool,last_error_date:b().string,status:b().string,updated_at:b().number,run_accessed_at:b().number,run_completed_at:b().number,run_started_at:b().number,last_error:b().oneOfType([b().string,b().array])}).isRequired};var xl=Dl;const Rl=e=>{let t=e.task.scheduled_at;t&&(t=(0,Wa.default)(t,"yyyy-MM-dd HH:mm:ss",new Date));const n=(0,Wa.default)(e.task.updated_at,"yyyy-MM-dd HH:mm:ss",new Date);return s().createElement("tr",null,s().createElement("td",{className:"column column-primary"},e.task.id),s().createElement("td",{className:"column"},e.task.type),s().createElement("td",{className:"column"},e.task.newsletter?s().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")),s().createElement("td",{className:"column"},e.task.priority),e.show_scheduled_at?s().createElement("td",{className:"column-date"},s().createElement("abbr",null,`${h.Z.Date.short(t)} ${h.Z.Date.time(t)}`)):null,s().createElement("td",{className:"column-date"},s().createElement("abbr",null,`${h.Z.Date.short(n)} ${h.Z.Date.time(n)}`)))};Rl.propTypes={show_scheduled_at:b().bool,task:b().shape({id:b().number.isRequired,type:b().string.isRequired,priority:b().number.isRequired,updated_at:b().string.isRequired,scheduled_at:b().string,status:b().string,newsletter:b().shape({newsletter_id:b().number.isRequired,queue_id:b().number.isRequired,preview_url:b().string.isRequired,subject:b().string})}).isRequired},Rl.defaultProps={show_scheduled_at:!1};var Ol=Rl;const Pl=e=>s().createElement("tr",null,s().createElement("th",{className:"row-title"},"Id"),s().createElement("th",{className:"row-title"},h.Z.I18n.t("type")),s().createElement("th",{className:"row-title"},h.Z.I18n.t("email")),s().createElement("th",{className:"row-title"},h.Z.I18n.t("priority")),e.show_scheduled_at?s().createElement("th",{className:"row-title"},h.Z.I18n.t("scheduledAt")):null,s().createElement("th",{className:"row-title"},h.Z.I18n.t("updatedAt")));Pl.propTypes={show_scheduled_at:b().bool},Pl.defaultProps={show_scheduled_at:!1};var Ll=Pl;const Ml=e=>{const t=e.show_scheduled_at?6:5;return s().createElement("table",{className:"widefat fixed striped"},s().createElement("thead",null,s().createElement(Ll,{show_scheduled_at:e.show_scheduled_at})),s().createElement("tbody",null,e.tasks.length?e.tasks.map((t=>s().createElement(Ol,{key:t.id,task:t,show_scheduled_at:e.show_scheduled_at}))):s().createElement("tr",{className:"mailpoet-listing-no-items"},s().createElement("td",{colSpan:t},h.Z.I18n.t("nothingToShow")))),s().createElement("tfoot",null,s().createElement(Ll,{show_scheduled_at:e.show_scheduled_at})))};Ml.propTypes={show_scheduled_at:b().bool,tasks:b().arrayOf(Ol.propTypes.task).isRequired},Ml.defaultProps={show_scheduled_at:!1};var Al=Ml;const Fl=e=>{const t=e.status_data;return s().createElement(s().Fragment,null,s().createElement("h4",null,h.Z.I18n.t("systemStatusQueueTitle")),s().createElement(Cl,{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}]}),s().createElement("h5",null,h.Z.I18n.t("scheduledTasks")),s().createElement(Al,{show_scheduled_at:!0,tasks:t.latestTasks.filter((e=>"scheduled"===e.status))}),s().createElement("h5",null,h.Z.I18n.t("runningTasks")),s().createElement(Al,{tasks:t.latestTasks.filter((e=>null===e.status))}),s().createElement("h5",null,h.Z.I18n.t("completedTasks")),s().createElement(Al,{tasks:t.latestTasks.filter((e=>"completed"===e.status))}))};Fl.propTypes={status_data:b().shape({status:b().string,started:b().number,sent:b().number,retry_attempt:b().number,retry_at:b().number,error:b().shape({operation:b().string,error_message:b().string}),tasksStatusCounts:b().shape({completed:b().number.isRequired,running:b().number.isRequired,paused:b().number.isRequired,scheduled:b().number.isRequired}).isRequired,latestTasks:b().arrayOf(Ol.propTypes.task).isRequired}).isRequired};var ql=Fl;function $l(e,t,n,a,r){const i=e?"success":"error";let o=e?h.Z.I18n.t("systemStatusConnectionSuccessful"):`${h.Z.I18n.t("systemStatusConnectionUnsuccessful")} ${t}`;return n&&(o=R()(o,/\[link\](.*?)\[\/link\]/g,(e=>s().createElement("a",{className:"mailpoet-text-link",href:n,"data-beacon-article":a,key:"kb-link"},e)))),s().createElement("div",{className:`mailpoet_notice notice inline notice-${i}`},s().createElement("p",null,o),r?s().createElement("p",null,s().createElement("i",null,r)):null)}var Ul=function(){const e=window.systemStatusData;return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet_notice notice inline"},s().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("systemStatusCronConnectionUnsuccessfulInfo"),r=t?null:e.cron.pingResponse;return s().createElement("div",null,s().createElement("h4",null,h.Z.I18n.t("systemStatusCronTitle")),s().createElement("p",null,s().createElement("a",{className:"mailpoet-text-link",href:n,target:"_blank",rel:"noopener noreferrer"},n)),$l(t,a,"https://kb.mailpoet.com/article/231-sending-does-not-work","5a0257ac2c7d3a272c0d7ad6",r))}(e),function(e){if(!e.mss.enabled)return;const t=e.mss.enabled.isReachable;return s().createElement("div",null,s().createElement("h4",null,h.Z.I18n.t("systemStatusMSSTitle")),$l(t,h.Z.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo"),!1))}(e),s().createElement(xl,{status_data:e.cronStatus}),s().createElement(ql,{status_data:e.queueStatus}))},jl=function(){return s().createElement(s().Fragment,null,s().createElement("p",null,h.Z.I18n.t("yourPrivacyContent1")),s().createElement("p",null,h.Z.I18n.t("yourPrivacyContent2")),s().createElement("p",null,h.Z.I18n.t("yourPrivacyContent3")),s().createElement(y.Z,{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/"},h.Z.I18n.t("yourPrivacyButton")))};const Wl=()=>s().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},s().createElement(j.D,null),s().createElement(ot.Z,null),s().createElement(Ni.Z,{activeKey:"knowledgeBase"},s().createElement(Ei.Z,{key:"knowledgeBase",title:h.Z.I18n.t("tabKnowledgeBaseTitle")},s().createElement(Zl,null)),s().createElement(Ei.Z,{key:"systemStatus",title:h.Z.I18n.t("tabSystemStatusTitle")},s().createElement(Ul,null)),s().createElement(Ei.Z,{key:"systemInfo",title:h.Z.I18n.t("tabSystemInfoTitle")},s().createElement(Sl,null)),s().createElement(Ei.Z,{key:"yourPrivacy",title:h.Z.I18n.t("tabYourPrivacyTitle")},s().createElement(jl,null)))),Vl=document.getElementById("help_container");Vl&&c().render(s().createElement(Wl,null),Vl);var Yl=(0,d.withRouter)((({children:e,location:{pathname:t}})=>((0,o.useEffect)((()=>{window.scrollTo(0,0)}),[t]),e||null)));function Bl({activeMethod:e,onMethodChange:t}){return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("span",{className:"mailpoet_import_heading"},h.Z.I18n.t("methodSelectionHead")),s().createElement("div",{className:"mailpoet-settings-inputs-row"},s().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"},s().createElement(w.Z,{dimension:"large",variant:"excellent",isInverted:!0},h.Z.I18n.t("seeVideo"))))),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement("div",{className:"mailpoet-settings-inputs-row"},s().createElement(be.Z,{name:"select_method",automationId:"import-paste-method",id:"import-paste-method",checked:"paste-method"===e,value:"paste-method",onCheck:t}),s().createElement("label",{htmlFor:"import-paste-method"},h.Z.I18n.t("methodPaste"))),s().createElement("div",{className:"mailpoet-settings-inputs-row"},s().createElement(be.Z,{name:"select_method",automationId:"import-csv-method",id:"import-csv-method",checked:"file-method"===e,value:"file-method",onCheck:t}),s().createElement("label",{htmlFor:"import-csv-method"},h.Z.I18n.t("methodUpload"))),s().createElement("div",{className:"mailpoet-settings-inputs-row"},s().createElement(be.Z,{name:"select_method",automationId:"import-mailchimp-method",id:"import-mailchimp-method",checked:"mailchimp-method"===e,value:"mailchimp-method",onCheck:t}),s().createElement("label",{htmlFor:"import-mailchimp-method"},h.Z.I18n.t("methodMailChimp")))))}Bl.propTypes={activeMethod:b().string,onMethodChange:b().func.isRequired},Bl.defaultProps={activeMethod:void 0};var Hl=Bl;const zl=({hidePrevious:e,isLastStep:t,canGoNext:n,onPreviousAction:a,onNextAction:r})=>s().createElement("div",{className:"mailpoet-settings-save"},!e&&s().createElement(y.Z,{type:"button",variant:"secondary",onClick:a},h.Z.I18n.t("previousStep")),s().createElement(y.Z,{type:"button",automationId:"import-next-step",isDisabled:!n,onClick:()=>{n&&r()}},h.Z.I18n.t(t?"import":"nextStep")));zl.propTypes={canGoNext:b().bool,hidePrevious:b().bool,isLastStep:b().bool,onPreviousAction:b().func,onNextAction:b().func},zl.defaultProps={hidePrevious:!1,isLastStep:!1,canGoNext:!0,onPreviousAction:()=>{},onNextAction:()=>{}};var Kl=zl;const Gl=({onValueChange:e,canFinish:t,onFinish:n,data:a,onPrevious:r})=>s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("label",{htmlFor:"paste_input"},h.Z.I18n.t("pasteLabel")),s().createElement("p",{className:"description"},R()(h.Z.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>s().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))))),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(pe.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:t=>{e(t.target.value)},defaultValue:a})),s().createElement(Kl,{canGoNext:t,onPreviousAction:r,onNextAction:n}));Gl.propTypes={onFinish:b().func,onPrevious:b().func,canFinish:b().bool.isRequired,onValueChange:b().func.isRequired,data:b().string},Gl.defaultProps={onFinish:()=>{},onPrevious:()=>{},data:""};var Ql=Gl;const Xl=({onValueChange:e,canFinish:t,onFinish:n,onPrevious:a})=>s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("label",{htmlFor:"file_local"},h.Z.I18n.t("methodUpload")),s().createElement("p",{className:"description"},R()(h.Z.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>s().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))))),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(ce.Z,{type:"file",id:"file_local",accept:".csv","data-automation-id":"import-file-upload-input",onChange:t=>{const n=t.target.value.match(/[^.]+$/);h.Z.Notice.hide(),null===n||"csv"!==n[0].toLowerCase()?(h.Z.Notice.error(h.Z.I18n.t("wrongFileFormat")),e("")):e(t.target.files[0])}})),s().createElement(Kl,{canGoNext:t,onPreviousAction:a,onNextAction:n}));Xl.propTypes={canFinish:b().bool.isRequired,onFinish:b().func,onPrevious:b().func,onValueChange:b().func.isRequired},Xl.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var Jl=Xl;const ec=({onFinish:e,onPrevious:t})=>{const[n,a]=(0,o.useState)(""),[r,i]=(0,o.useState)(void 0),[l,c]=(0,o.useState)([]);return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("label",{htmlFor:"mailpoet_mailchimp_key_input"},s().createElement("span",{className:"mailpoet_import_heading"},h.Z.I18n.t("methodMailChimpLabel")),s().createElement("p",{className:"description"},R()(h.Z.I18n.t("methodMailChimpDescription"),/\[link\](.*?)\[\/link\]/,(e=>s().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)))))),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered"},s().createElement(ce.Z,{dimension:"small",id:"mailpoet_mailchimp_key_input",type:"text",onChange:e=>{a(e.target.value),""===e.target.value.trim()&&i(void 0)}}),s().createElement("span",{className:"mailpoet-gap"}),s().createElement(y.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:n}}).always((()=>{h.Z.Modal.loading(!1)})).done((e=>i(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")),s().createElement("span",{className:"mailpoet-gap"}),s().createElement("span",null,Array.isArray(r)&&0===r.length?h.Z.I18n.t("noMailChimpLists"):null))),r?s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("methodMailChimpSelectList")),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(D,{field:{id:"segments",name:"list-selection",multiple:!0,placeholder:h.Z.I18n.t("methodMailChimpSelectPlaceholder"),forceSelect2:!0,values:r},onValueChange:e=>c(e.target.value)}))):null,s().createElement(Kl,{canGoNext:Array.isArray(l)&&l.length>0,onPreviousAction:t,onNextAction:()=>{h.Z.Modal.loading(!0),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:n,lists:l}}).always((()=>{h.Z.Modal.loading(!1)})).done((t=>e(t.data))).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}}))};ec.propTypes={onFinish:b().func,onPrevious:b().func},ec.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var tc=ec,nc=n(57460),ac=n.n(nc);const rc=e=>window.roleBasedEmails.findIndex((t=>e.startsWith(`${t}@`)))>=0,ic=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)&&!rc(n)&&n};var oc=(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),ac().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 o,s,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=>{s=ic(l[e]),null===u&&window.mailpoet_email_regex.test(s)&&(u=e,n[s]=!0,l[e]=s,t[s]=l)})),null===u&&0===parseInt(m,10)&&(p=!0,t[0]=l)):""!==l[u]&&(o=ic(l[u]),T.ZP.has(n,o)?a.push(o):rc(l[u])?i.push(l[u]):window.mailpoet_email_regex.test(o)?(n[o]=!0,l[u]=o,t[o]=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({history:e,setStepMethodSelectionData:t,subscribersLimitForValidation:n}){const[a,r]=(0,o.useState)(void 0),[i,l]=(0,o.useState)(""),[c,u]=(0,o.useState)(void 0),d=r=>{t(r),e.push(((e,t,n)=>void 0===e||void 0===e.subscribersCount||e.subscribersCount<t||"mailchimp-method"===n?"step_data_manipulation":"step_input_validation")(r,n,a))},p=()=>{e.push("/step_clean_list")},m=()=>{oc("paste-method"===a?i:c,(e=>{h.Z.trackEvent("Subscribers import started",{source:"file-method"===a?"file upload":"pasted data"}),d(e)}))};return s().createElement("div",{className:"mailpoet-settings-grid"},s().createElement(Hl,{activeMethod:a,onMethodChange:r}),"paste-method"===a&&s().createElement(Ql,{onPrevious:p,onValueChange:l,onFinish:m,canFinish:!!i.trim(),data:i}),"file-method"===a&&s().createElement(Jl,{onPrevious:p,onValueChange:u,onFinish:m,canFinish:!!c,data:c}),"mailchimp-method"===a&&s().createElement(tc,{onPrevious:p,onFinish:e=>{h.Z.trackEvent("Subscribers import started",{source:"MailChimp"}),d(e)}}),void 0===a&&s().createElement(Kl,{canGoNext:!1,onPreviousAction:p}))}sc.propTypes={history:b().shape({push:b().func.isRequired}).isRequired,setStepMethodSelectionData:b().func.isRequired,subscribersLimitForValidation:b().number.isRequired};var lc=(0,d.withRouter)(sc),cc=({onProceed:e})=>s().createElement("div",{className:"mailpoet-clean-list-step-container"},s().createElement("p",null,h.Z.I18n.t("cleanListText1")),s().createElement("p",null,h.Z.I18n.t("cleanListText2")),s().createElement("p",null,e&&s().createElement(y.Z,{onClick:e,variant:"tertiary"},h.Z.I18n.t("listCleaningGotIt")),s().createElement(y.Z,{target:"_blank",href:"https://kb.mailpoet.com/article/287-list-cleaning-services"},h.Z.I18n.t("tryListCleaning"))));function uc({onSubmit:e,history:t}){const[n,a]=(0,o.useState)(void 0);return s().createElement("div",{className:"mailpoet-settings-grid"},s().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("validationStepHeading")),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement("div",{className:"mailpoet-settings-inputs-row"},s().createElement(be.Z,{automationId:"mailpoet_import_validation_step_option1",id:"existing-list",checked:"existing-list"===n,value:"existing-list",onCheck:a}),s().createElement("label",{htmlFor:"existing-list"},h.Z.I18n.t("validationStepRadio1"))),s().createElement("div",{className:"mailpoet-settings-inputs-row"},s().createElement(be.Z,{automationId:"mailpoet_import_validation_step_option2",id:"address-book",checked:"address-book"===n,value:"address-book",onCheck:a}),s().createElement("label",{htmlFor:"address-book"},h.Z.I18n.t("validationStepRadio2")))),s().createElement(Kl,{canGoNext:void 0!==n,onPreviousAction:()=>t.push("step_method_selection"),onNextAction:()=>e(n)}))}uc.propTypes={history:b().shape({push:b().func.isRequired}).isRequired,onSubmit:b().func.isRequired};var dc=uc,pc=function(){return s().createElement("div",{className:"mailpoet-clean-list-step-container","data-automation-id":"import_wrong_source_block"},s().createElement("p",null,h.Z.I18n.t("validationStepBlock1")),s().createElement("p",null,h.Z.I18n.t("validationStepBlock2")),s().createElement("p",null,s().createElement(y.Z,{href:"https://kb.mailpoet.com/article/269-reconfirm-subscribers-to-your-list",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("validationStepBlockButton"))))};function mc({onSubmit:e}){const[t,n]=(0,o.useState)("over2years"),a=(0,o.useCallback)((e=>{n(e.target.value)}),[n]),r=(0,o.useCallback)((()=>{e("over2years"===t||"1to2years"===t?"notRecently":"recently")}),[e,t]);return s().createElement("div",{className:"mailpoet-settings-grid"},s().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("validationStepLastSentHeading")),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(fe.Z,{defaultValue:t,onChange:a,automationId:"last_sent_to_list"},s().createElement("option",{value:"over2years"},h.Z.I18n.t("validationStepLastSentOption1")),s().createElement("option",{value:"1to2years"},h.Z.I18n.t("validationStepLastSentOption2")),s().createElement("option",{value:"less1year"},h.Z.I18n.t("validationStepLastSentOption3")),s().createElement("option",{value:"less3months"},h.Z.I18n.t("validationStepLastSentOption4")))),s().createElement("div",{className:"mailpoet-settings-save"},s().createElement(y.Z,{type:"button",automationId:"last_sent_to_list_next",onClick:r},h.Z.I18n.t("validationStepLastSentNext"))))}mc.propTypes={onSubmit:b().func.isRequired};var hc=mc;function fc({stepMethodSelectionData:e,history:t}){const[n,a]=(0,o.useState)(void 0),[r,i]=(0,o.useState)(void 0);(0,o.useEffect)((()=>{void 0===e&&t.replace("step_method_selection")}),[e,t]);const l=(0,o.useCallback)((e=>{i(e),"recently"===e&&t.push("step_data_manipulation")}),[t,i]);return s().createElement(s().Fragment,null,void 0===n&&s().createElement(dc,{onSubmit:a,history:t}),"address-book"===n&&s().createElement(pc,null),"existing-list"===n&&void 0===r&&s().createElement(hc,{onSubmit:l}),"existing-list"===n&&"notRecently"===r&&s().createElement(cc,null))}fc.propTypes={history:b().shape({push:b().func.isRequired,replace:b().func.isRequired}).isRequired,stepMethodSelectionData:b().shape({duplicate:b().arrayOf(b().string),header:b().arrayOf(b().string),invalid:b().arrayOf(b().string),role:b().arrayOf(b().string),subscribersCount:b().number,subscribers:b().arrayOf(b().arrayOf(b().string))})},fc.defaultProps={stepMethodSelectionData:void 0};var gc=(0,d.withRouter)(fc);const vc=({translation:e,subscribers:t})=>{let n="";return t.length&&(n=R()(e.replace("%2$s",t.join(", ")),"%1$s",(()=>s().createElement("strong",{key:e},t.length.toLocaleString()))),n=s().createElement("p",null,n)),n};vc.propTypes={translation:b().string.isRequired,subscribers:b().arrayOf(b().string).isRequired};const bc=({stepMethodSelectionData:e})=>{const{invalid:t,duplicate:n,role:a}=e,[r,i]=(0,o.useState)(!1),l=g()("mailpoet_subscribers_data_parse_results_details",{mailpoet_hidden:!r}),c=s().createElement(vc,{translation:h.Z.I18n.t("importNoticeInvalid"),subscribers:t}),u=s().createElement(vc,{translation:h.Z.I18n.t("importNoticeDuplicate"),subscribers:n});let d="";if(a.length&&(d=R()(h.Z.I18n.t("importNoticeRoleBased"),/(%1\$s|\[link\].*\[\/link\]|%2\$s)/,(e=>"%1$s"===e?s().createElement("strong",{key:"role-length"},a.length.toLocaleString()):"%2$s"===e?a.join(", "):s().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]","")))),d=s().createElement("p",null,d)),t.length||n.length||a.length){const e=t.length+n.length+a.length;return s().createElement("div",{className:"error"},s().createElement("p",null,R()(h.Z.I18n.t("importNoticeSkipped"),"%1$s",(()=>s().createElement("strong",{key:"lengths"},e.toLocaleString())))," ",s().createElement("a",{className:"mailpoet_subscribers_data_parse_results_details_show","data-automation-id":"show-more-details",onClick:()=>i(!r),role:"button",tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),i(!r))}},h.Z.I18n.t("showMoreDetails"))),s().createElement("div",{className:l},s().createElement("hr",null),c,u,d))}return null};bc.propTypes={stepMethodSelectionData:b().shape({duplicate:b().arrayOf(b().string),invalid:b().arrayOf(b().string),role:b().arrayOf(b().string)})},bc.defaultProps={stepMethodSelectionData:{invalid:[],duplicate:[],role:[]}};var yc=bc;function wc({header:e,subscribers:t}){const n=((e,t)=>{const n=[],a=[];let r,i,o,s;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&&(o=t[l],s=window.mailpoetColumns.map((e=>e.name)).indexOf(o),-1!==s?i=window.mailpoetColumns[s].id:o&&(/first|first name|given name/i.test(o)?i="first_name":/last|last name/i.test(o)&&(i="last_name"))),i="ignore"!==i&&-1===a.indexOf(i)?i:"ignore",n[l]={column_id:i},a.push(i)})),n})(t,e);return s().createElement("tr",null,s().createElement("th",null,h.Z.I18n.t("matchData")),n.map(((e,t)=>s().createElement("th",{key:e.column_id+t},s().createElement("select",{className:"mailpoet_subscribers_column_data_match","data-column-id":e.column_id,"data-column-index":t,id:`column_${t}`})))))}function Ec({header:e}){return s().createElement("tr",{className:"mailpoet_header"},s().createElement("td",null),e.map((e=>s().createElement("td",{key:e},e))))}function _c({subscriber:e,index:t}){return s().createElement(s().Fragment,null,s().createElement("td",null,t),e.map(((e,n)=>s().createElement("td",{key:`${e}-${t}-${n}`},e))))}function Zc({subscribers:e,subscribersCount:t}){const n=". . .",a=Array(e[0].length).fill(n);return s().createElement(s().Fragment,null,e.slice(0,10).map(((e,t)=>s().createElement("tr",{key:`${e[0]}-${t}`},s().createElement(_c,{subscriber:e,index:t+1})))),t>11?s().createElement("tr",{key:"filler"},s().createElement(_c,{subscriber:a,index:n})):null,t>10?s().createElement("tr",{key:e[t-1][0]},s().createElement(_c,{subscriber:e[t-1],index:t})):null)}function Ic({subscribersCount:e,subscribers:t,header:n}){return(0,o.useLayoutEffect)((()=>{m()("select.mailpoet_subscribers_column_data_match").select2({data:window.mailpoetColumnsSelect2,width:"15em",templateResult:e=>e.name,templateSelection:e=>e.name}).on("select2:selecting",(e=>{const t=e.currentTarget,n=e.params.args.data.id;"create"===n?(e.preventDefault(),m()(t).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 e=m()("#form_field_new").mailpoetSerializeObject();return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:e}).done((e=>{const n={id:e.data.id,name:e.data.name,type:e.data.type,params:e.data.params,custom:!0};2===window.mailpoetColumnsSelect2.length&&window.mailpoetColumnsSelect2.push({name:h.Z.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(n),window.mailpoetColumns.push(n),m()("select.mailpoet_subscribers_column_data_match").each((()=>{m()(t).html("").select2("destroy").select2({data:window.mailpoetColumnsSelect2,width:"15em",templateResult:e=>e.name,templateSelection:e=>e.name})})),m()(t).data("column-id",n.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 a=t,r=m()(a).val();r===n&&"ignore"!==r&&(confirm(`${h.Z.I18n.t("selectedValueAlreadyMatched")} ${h.Z.I18n.t("confirmCorrespondingColumn")}`)?m()(a).data("column-id","ignore"):(e.preventDefault(),m()(t).select2("close")))}))})).on("select2:select",(e=>{const t=e.currentTarget,n=e.params.data.id;m()(t).data("column-id",n)})),m().map(m()(".mailpoet_subscribers_column_data_match"),(e=>{const t=m()(e).data("column-id");m()(e).val(t).trigger("change")}))})),s().createElement("div",{className:"subscribers_data"},s().createElement("table",{className:"mailpoet_subscribers widefat fixed"},s().createElement("thead",null,s().createElement(wc,{header:n,subscribers:t})),s().createElement("tbody",null,n?s().createElement(Ec,{header:n}):null,s().createElement(Zc,{subscribers:t,subscribersCount:e}))))}wc.propTypes={subscribers:b().arrayOf(b().arrayOf(b().oneOfType([b().string,b().number]))).isRequired,header:b().arrayOf(b().string)},wc.defaultProps={header:[]},Ec.propTypes={header:b().arrayOf(b().string).isRequired},_c.propTypes={subscriber:b().arrayOf(b().oneOfType([b().string,b().number])).isRequired,index:b().node.isRequired},Zc.propTypes={subscribersCount:b().number.isRequired,subscribers:b().arrayOf(b().arrayOf(b().oneOfType([b().string,b().number]))).isRequired},Ic.propTypes={subscribersCount:b().number,subscribers:b().arrayOf(b().arrayOf(b().oneOfType([b().string,b().number]))),header:b().arrayOf(b().string)},Ic.defaultProps={subscribersCount:0,subscribers:[],header:[]};var Sc=Ic;function kc({setSelectedSegments:e}){const{segments:t}=(0,o.useContext)(Ve.k),{all:n,updateAll:a}=t,[r,i]=(0,o.useState)(n);(0,o.useLayoutEffect)((()=>{!function(t,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:t.map((e=>({...e,text:e.name}))),dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:r,templateSelection:r}).on("change",(t=>{const n=m()('[data-id="notice_segmentSelection"]');t.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});(t=>{e(t)})(T.ZP.pluck(a.select2("data"),"id"))}))}(r)}),[r,e]);const l=t=>{!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"))}(),e([]),i([...r,t]),a([...r,t])};return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("label",{htmlFor:"mailpoet_segments_select"},h.Z.I18n.t("pickLists"),s().createElement("p",{className:"description"},h.Z.I18n.t("pickListsDescription")))),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered"},s().createElement("div",{className:"mailpoet-form-select mailpoet-form-input"},s().createElement("select",{id:"mailpoet_segments_select","data-placeholder":h.Z.I18n.t("select"),multiple:"multiple"},s().createElement("option",null))),s().createElement(y.Z,{variant:"tertiary",onClick:()=>{return e=l,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")))))}kc.propTypes={setSelectedSegments:b().func.isRequired};var Cc=kc;const Tc=()=>s().createElement("p",{className:"description"},R()(h.Z.I18n.t("consentSubscribed"),/\[link](.*?)\[\/link]/,(e=>s().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)))),Nc=({newSubscribersStatus:e,setNewSubscribersStatus:t})=>{const n=(0,o.useCallback)((e=>{t(e.target.value)}),[t]);return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("label",{htmlFor:"new_subscribers_status"},h.Z.I18n.t("newSubscribersStatus")),s().createElement(Tc,null)),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(fe.Z,{id:"new_subscribers_status",placeholder:h.Z.I18n.t("select"),name:"new_subscribers_status",onChange:n,defaultValue:e},s().createElement("option",{value:"subscribed"},h.Z.I18n.t("subscribed")),s().createElement("option",{value:"inactive"},h.Z.I18n.t("inactive")),s().createElement("option",{value:"unsubscribed"},h.Z.I18n.t("unsubscribed")))))};Nc.propTypes={newSubscribersStatus:b().string.isRequired,setNewSubscribersStatus:b().func.isRequired};const Dc=({existingSubscribersStatus:e,setExistingSubscribersStatus:t})=>{const n=(0,o.useCallback)((e=>{t(e.target.value)}),[t]);return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("label",{htmlFor:"existing_subscribers_status"},h.Z.I18n.t("existingSubscribersStatus")),s().createElement(Tc,null)),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(fe.Z,{id:"existing_subscribers_status",placeholder:h.Z.I18n.t("select"),name:"existing_subscribers_status",onChange:n,defaultValue:e},s().createElement("option",{value:"dont_update"},h.Z.I18n.t("dontUpdate")),s().createElement("option",{value:"subscribed"},h.Z.I18n.t("subscribed")),s().createElement("option",{value:"inactive"},h.Z.I18n.t("inactive")),s().createElement("option",{value:"unsubscribed"},h.Z.I18n.t("unsubscribed")))))};function xc({updateExistingSubscribers:e,setUpdateExistingSubscribers:t}){return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("updateExistingSubscribers")),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(be.Z,{id:"update_existing_subscribers",name:"update_existing_subscribers",value:"1",checked:e,onCheck:()=>t(!0)}),s().createElement("label",{htmlFor:"update_existing_subscribers"},h.Z.I18n.t("updateExistingSubscribersYes")),s().createElement("span",{className:"mailpoet-gap"}),s().createElement(be.Z,{id:"dont_update_existing_subscribers",name:"update_existing_subscribers",value:"",checked:!e,onCheck:()=>t(!1)}),s().createElement("label",{htmlFor:"dont_update_existing_subscribers"},h.Z.I18n.t("updateExistingSubscribersNo"))))}Dc.propTypes={existingSubscribersStatus:b().string.isRequired,setExistingSubscribersStatus:b().func.isRequired},xc.propTypes={setUpdateExistingSubscribers:b().func.isRequired,updateExistingSubscribers:b().bool.isRequired};var Rc=xc;function Oc({history:e,stepMethodSelectionData:t,subscribersLimitForValidation:n,setStepDataManipulationData:a}){const[r,i]=(0,o.useState)([]),[l,c]=(0,o.useState)(!0),[u,d]=(0,o.useState)("subscribed"),[p,f]=(0,o.useState)("dontUpdate");return(0,o.useEffect)((()=>{void 0===t&&e.replace("step_method_selection")}),[t,e]),void 0===t?null:s().createElement("div",{"data-automation-id":"import_data_manipulation_step"},s().createElement(yc,{stepMethodSelectionData:t}),s().createElement(Sc,{subscribersCount:t.subscribersCount,subscribers:t.subscribers,header:t.header}),s().createElement("div",{className:"mailpoet-settings-grid"},s().createElement(Cc,{setSelectedSegments:i}),s().createElement(Nc,{newSubscribersStatus:u,setNewSubscribersStatus:d}),s().createElement(Dc,{existingSubscribersStatus:p,setExistingSubscribersStatus:f}),s().createElement(Rc,{setUpdateExistingSubscribers:c,updateExistingSubscribers:l}),s().createElement(Kl,{canGoNext:r.length>0,onPreviousAction:()=>e.push(function(e,t){return void 0===e||void 0===e.subscribersCount||e.subscribersCount<t?"step_method_selection":"step_input_validation"}(t,n)),onNextAction:()=>{((t,n,r,i,o,s)=>{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,t.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:r,existingSubscribersStatus:i,updateSubscribers:o})}).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)),a(p),e.push("step_results"))}))})(t.subscribers,r,u,p,l)},isLastStep:!0})))}n(49868),Oc.propTypes={history:b().shape({push:b().func.isRequired,replace:b().func.isRequired}).isRequired,stepMethodSelectionData:b().shape({duplicate:b().arrayOf(b().string),header:b().arrayOf(b().string),invalid:b().arrayOf(b().string),role:b().arrayOf(b().string),subscribersCount:b().number,subscribers:b().arrayOf(b().arrayOf(b().oneOfType([b().string,b().number])))}),subscribersLimitForValidation:b().number.isRequired,setStepDataManipulationData:b().func.isRequired},Oc.defaultProps={stepMethodSelectionData:void 0};var Pc=(0,d.withRouter)(Oc);function Lc({subscribersCount:e,segments:t,initialMessage:n}){if(e){let a=R()(n,"%1$s",(()=>s().createElement("strong",{key:"%1$s"},e.toLocaleString())));return a=R()(a,"%2$s",(()=>`"${t.join('", "')}"`)),s().createElement("p",null,a)}return null}function Mc({createdSubscribers:e,updatedSubscribers:t}){return e||t?null:s().createElement("p",null,h.Z.I18n.t("importNoAction"))}function Ac({createdSubscribers:e,updatedSubscribers:t}){return e||t?s().createElement(s().Fragment,null,s().createElement("p",null,s().createElement("b",null,h.Z.I18n.t("congratulationResult"))),s().createElement("p",null,R()(h.Z.I18n.t("suppressionListReminder"),/\[link](.*?)\[\/link]/,(e=>s().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 Fc({addedToSegmentWithWelcomeNotification:e}){return e?s().createElement("p",null,h.Z.I18n.t("importNoWelcomeEmail")):null}function qc({errors:e,createdSubscribers:t,updatedSubscribers:n,segments:a,addedToSegmentWithWelcomeNotification:r,history:i}){return(0,o.useEffect)((()=>{void 0===a&&0===e.length&&void 0===t&&void 0===n&&i.replace("step_method_selection")}),[a,t,e.length,i,n]),e.length&&h.Z.Notice.error(T.ZP.flatten(e)),s().createElement(s().Fragment,null,s().createElement("div",{className:"updated"},s().createElement(Lc,{subscribersCount:t,segments:a,initialMessage:h.Z.I18n.t("subscribersCreated")}),s().createElement(Lc,{subscribersCount:n,segments:a,initialMessage:h.Z.I18n.t("subscribersUpdated")}),s().createElement(Mc,{createdSubscribers:t,updatedSubscribers:n}),s().createElement(Fc,{addedToSegmentWithWelcomeNotification:r})),s().createElement(Ac,{createdSubscribers:t,updatedSubscribers:n}),s().createElement("div",{className:"mailpoet-settings-grid"},s().createElement("div",{className:"mailpoet-settings-save"},s().createElement(y.Z,{variant:"secondary",type:"button",onClick:()=>i.push("step_method_selection")},h.Z.I18n.t("importAgain")),s().createElement(y.Z,{type:"button",onClick:()=>{window.location.href="admin.php?page=mailpoet-subscribers"}},h.Z.I18n.t("viewSubscribers")))))}Lc.propTypes={segments:b().arrayOf(b().string.isRequired),subscribersCount:b().number,initialMessage:b().string},Lc.defaultProps={segments:[],subscribersCount:0,initialMessage:""},Mc.propTypes={createdSubscribers:b().number,updatedSubscribers:b().number},Mc.defaultProps={createdSubscribers:0,updatedSubscribers:0},Ac.propTypes={createdSubscribers:b().number,updatedSubscribers:b().number},Ac.defaultProps={createdSubscribers:0,updatedSubscribers:0},Fc.propTypes={addedToSegmentWithWelcomeNotification:b().bool},Fc.defaultProps={addedToSegmentWithWelcomeNotification:!1},qc.propTypes={history:b().shape({push:b().func.isRequired,replace:b().func.isRequired}).isRequired,errors:b().arrayOf(b().string.isRequired),segments:b().arrayOf(b().string.isRequired),createdSubscribers:b().number,updatedSubscribers:b().number,addedToSegmentWithWelcomeNotification:b().bool},qc.defaultProps={errors:[],segments:void 0,createdSubscribers:void 0,updatedSubscribers:void 0,addedToSegmentWithWelcomeNotification:void 0};var $c=(0,d.withRouter)(qc),Uc=({history:e})=>s().createElement(cc,{onProceed:()=>e.push("step_method_selection")});const jc=document.getElementById("import_container"),Wc=()=>{const[e,t]=(0,o.useState)(void 0),[n,a]=(0,o.useState)({}),r=(0,Ve.S)(window);return s().createElement(Ve.k.Provider,{value:r},s().createElement(u.UT,null,s().createElement(ot.Z,null),s().createElement(Yl,null,s().createElement(d.Switch,null,s().createElement(d.Route,{path:"/step_clean_list",render:e=>s().createElement(Uc,e)}),s().createElement(d.Route,{path:"/step_method_selection",render:e=>s().createElement(lc,(0,k.Z)({},e,{setStepMethodSelectionData:t,subscribersLimitForValidation:100}))}),s().createElement(d.Route,{path:"/step_input_validation",render:t=>s().createElement(gc,(0,k.Z)({},t,{stepMethodSelectionData:e}))}),s().createElement(d.Route,{path:"/step_data_manipulation",render:t=>s().createElement(Pc,(0,k.Z)({},t,{stepMethodSelectionData:e,subscribersLimitForValidation:100,setStepDataManipulationData:a}))}),s().createElement(d.Route,{path:"/step_results",render:e=>s().createElement($c,(0,k.Z)({},e,{errors:n.errors,createdSubscribers:n.created,updatedSubscribers:n.updated,segments:n.segments,addedToSegmentWithWelcomeNotification:n.added_to_segment_with_welcome_notification}))}),s().createElement(d.Route,{path:"*",render:()=>s().createElement(d.Redirect,{to:"/step_clean_list"})})))))};jc&&c().render(s().createElement(Wc,null),jc);var Vc=n(19675),Yc=n.n(Vc),Bc=n(56692);m()(document).ready((()=>{let e;if(!m()("#mailpoet_subscribers_export").length)return;if(!window.exportData.segments)return;const t=Yc().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 o(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=>{T.ZP.contains(a,e.value)||r.push(e.value)})),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,Bc.r)(e.name),e.text=(0,Bc.r)(e.name)}))})),o(a,window.segments),o(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})}))}))}));const Hc=e=>s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("welcomeWizardLetsStartTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("welcomeWizardSenderText")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("form",{id:"mailpoet_sender_form",onSubmit:t=>{t.preventDefault(),m()("#mailpoet_sender_form").parsley().validate()&&e.submit_sender()}},s().createElement(Ot.r.TwoColumns,null,s().createElement("label",{htmlFor:"senderName"},s().createElement("span",{className:"mailpoet-wizard-label"},h.Z.I18n.t("senderName")),s().createElement(ce.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})})),s().createElement("label",{htmlFor:"senderAddress"},s().createElement("span",{className:"mailpoet-wizard-label"},h.Z.I18n.t("senderAddress")),s().createElement(ce.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})}))),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(y.Z,{isFullWidth:!0,type:"submit",withSpinner:e.loading},h.Z.I18n.t("continue")),s().createElement(y.Z,{href:"#finish",isDisabled:e.loading,isFullWidth:!0,onClick:e.finish,variant:"tertiary"},h.Z.I18n.t("finishLater"))));Hc.propTypes={finish:b().func.isRequired,loading:b().bool.isRequired,update_sender:b().func.isRequired,submit_sender:b().func.isRequired,sender:b().shape({name:b().string,address:b().string})},Hc.defaultProps={sender:null};var zc=Hc;const Kc=e=>s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("welcomeWizardLetsStartTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("welcomeWizardSenderMigratedUserText")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(y.Z,{isFullWidth:!0,onClick:e.next,type:"button"},h.Z.I18n.t("continue")));Kc.propTypes={next:b().func.isRequired};var Gc=Kc;const Qc=e=>s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("welcomeWizardEmailCourseTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("welcomeWizardEmailCourseText")),s().createElement("div",{className:"mailpoet-gap"}),s().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"}),s().createElement(y.Z,{isFullWidth:!0,onClick:e.next,type:"button"},h.Z.I18n.t("continue")));Qc.propTypes={next:b().func.isRequired};var Xc=Qc,Jc=s().createElement("svg",{width:"13",height:"11",viewBox:"0 0 13 11"},s().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"})),eu=s().createElement("svg",{width:"17",height:"16",viewBox:"0 0 17 16"},s().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"}));const tu=({onCheck:e,showError:t,checked:n,automationId:a,...r})=>s().createElement("div",{className:g()({"mailpoet-form-yesno":!0,"mailpoet-form-yesno-error":t,"mailpoet-disabled":r.disabled}),"data-automation-id":a},s().createElement("label",null,s().createElement("input",(0,k.Z)({type:"radio",checked:!0===n,onChange:()=>e(!0)},r)),s().createElement("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-yes"},Jc)),s().createElement("label",null,s().createElement("input",(0,k.Z)({type:"radio",checked:!1===n,onChange:()=>e(!1)},r)),s().createElement("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-no"},eu)));tu.propTypes={name:b().string.isRequired,checked:b().bool,onCheck:b().func.isRequired,showError:b().bool,automationId:b().string};var nu=tu;const au=({loading:e,submitForm:t})=>{const[n,a]=(0,o.useState)({tracking:void 0,libs3rdParty:void 0});return s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("welcomeWizardUsageTrackingStepTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("welcomeWizardTrackingText")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(Ne.Z,{level:5},h.Z.I18n.t("welcomeWizardUsageTrackingStepSubTitle")),s().createElement(Ot.r.TwoColumnsList,null,s().createElement(ma,null,s().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList1")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList2")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList3")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList4")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList5")))),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("form",{onSubmit:function(e){return e.preventDefault(),t(n.tracking,n.libs3rdParty),!1}},s().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},s().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},s().createElement(nu,{onCheck:e=>{const t={tracking:e,libs3rdParty:n.libs3rdParty};e&&(t.libs3rdParty=e),a(t)},checked:n.tracking,name:"mailpoet_tracking"})),s().createElement("div",null,s().createElement("p",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabel")," ",s().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"))),s().createElement("div",{className:"mailpoet-wizard-note"},s().createElement("span",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNoteNote")),h.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNote")))),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},s().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},s().createElement(nu,{onCheck:e=>{const t={libs3rdParty:e,tracking:n.tracking};e||(t.tracking=e),a(t)},checked:n.libs3rdParty,name:"mailpoet_libs_3rdParty"})),s().createElement("div",null,s().createElement("p",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabel")," ",s().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"))),s().createElement("div",{className:"mailpoet-wizard-note"},s().createElement("span",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNoteNote")),h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNote")))),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(y.Z,{isFullWidth:!0,type:"submit",withSpinner:e,disabled:e},h.Z.I18n.t("continue"))))};au.propTypes={loading:b().bool.isRequired,submitForm:b().func.isRequired};var ru=au;const iu=({children:e})=>s().createElement("div",{className:"mailpoet-steps-content"},e);iu.propTypes={children:b().node.isRequired};var ou=iu;const su=e=>{const[t,n]=(0,o.useState)(null),[a,r]=(0,o.useState)(null),[i,l]=(0,o.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),s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("wooCommerceSetupTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("wooCommerceSetupInfo")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("form",{onSubmit:n=>(n.preventDefault(),l(!0),null===a||null===t||e.submitForm(a,"true"===t),!1)},s().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},s().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},s().createElement(nu,{showError:i&&null===a,checked:u,onCheck:e=>r(e?"subscribed":"unsubscribed"),name:"mailpoet_woocommerce_import_type",automationId:"woocommerce_import_type"})),s().createElement("div",null,s().createElement("p",null,R()(h.Z.I18n.t("wooCommerceSetupImportInfo"),/\[link\](.*?)\[\/link\]/,(e=>s().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)))),s().createElement("div",{className:"mailpoet-wizard-note"},s().createElement("span",null,"GDPR"),h.Z.I18n.t("wooCommerceSetupImportGDPRInfo")))),s().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},s().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},s().createElement(nu,{showError:i&&null===t,checked:t,onCheck:e=>n(e),name:"mailpoet_woocommerce_tracking",automationId:"woocommerce_tracking"})),s().createElement("div",null,s().createElement("p",null,R()(h.Z.I18n.t("wooCommerceSetupTrackingInfo"),/\[link\](.*?)\[\/link\]/,(e=>s().createElement("a",{key:e,href:"https://kb.mailpoet.com/article/280-woocommerce-cookie-tracking","data-beacon-article":"5d5fa44c2c7d3a7a4d778906",rel:"noopener noreferrer",target:"_blank"},e)))),s().createElement("div",{className:"mailpoet-wizard-note"},s().createElement("span",null,"GDPR"),h.Z.I18n.t("wooCommerceSetupTrackingGDPRInfo")))),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(y.Z,{isFullWidth:!0,type:"submit",withSpinner:e.loading,disabled:e.loading,automationId:"submit_woocommerce_setup"},c)))};su.propTypes={submitForm:b().func.isRequired,loading:b().bool.isRequired,isWizardStep:b().bool},su.defaultProps={isWizardStep:!1};var lu=su;const cu=e=>s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-wizard-logo"},s().createElement("img",{src:window.mailpoet_logo_url,width:"160",height:"50",alt:"MailPoet logo"})),s().createElement(da,{illustrationUrl:e.illustrationUrl},e.children));cu.propTypes={illustrationUrl:b().string.isRequired,children:b().oneOfType([b().arrayOf(b().node),b().node]).isRequired};var uu=cu;const du=({isWizardStep:e=!1})=>{const[t,n]=(0,o.useState)(!1),a=e=>{n(!1),h.Z.Notice.showApiErrorNotice(e,{scroll:!0})},r=()=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"setupWooCommerceInitialImport"}).fail(a),i=()=>{window.location=window.finish_wizard_url},l=s().createElement(uu,{illustrationUrl:window.wizard_woocommerce_illustration_url},s().createElement(lu,{loading:t,submitForm:(e,t)=>{var o;n(!0);const s="basic"===(null===(o=h.Z.settings.tracking)||void 0===o?void 0:o.level)?"basic":"partial";var l;(l={woocommerce_import_screen_displayed:1,"mailpoet_subscribe_old_woocommerce_customers.enabled":"subscribed"===e?1:0,"tracking.level":t?"full":s,"woocommerce.accept_cookie_revenue_tracking.set":1},h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:l}).fail(a)).then(r).then(i)},isWizardStep:e}));return e?l:s().createElement(ou,null,l)};du.propTypes={isWizardStep:b().bool},du.defaultProps={isWizardStep:!1};var pu=du,mu=({name:e,address:t})=>{const n=t.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(n)>-1?(({name:e,address:t})=>{const n=`wordpress@${window.location.hostname.replace("www.","")}`;return{sender:{name:e,address:n},reply_to:{name:e,address:t},"signup_confirmation.from.address":n,"signup_confirmation.from.name":e,"signup_confirmation.reply_to.address":t,"signup_confirmation.reply_to.name":e}})({name:e,address:t}):(({name:e,address:t})=>({sender:{name:e,address:t},reply_to:{name:e,address:t},"signup_confirmation.from.address":t,"signup_confirmation.from.name":e,"signup_confirmation.reply_to.address":t,"signup_confirmation.reply_to.name":e}))({name:e,address:t})};const hu=()=>{let e=3;return window.has_mss_key_specified||(e+=1),window.is_woocommerce_active&&(e+=1),e},fu=(e,t,n)=>{n<hu()?e.push(`/steps/${n+1}`):t()};var gu=n(60054);const vu=e=>{const t=hu(),n=parseInt(e.match.params.step,10),[a,r]=(0,o.useState)(!1),[i,l]=(0,o.useState)(window.sender_data);function c(){r(!0),window.location=window.finish_wizard_url}(0,o.useEffect)((()=>{(n>t||n<1)&&e.history.push("/steps/1")}),[n,t,e.history]);const u=(0,T.r$)(fu,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,o.useCallback)(((e,t)=>{r(!0),d({analytics:{enabled:e?"1":""},"3rd_party_libs":{enabled:t?"1":""}}).then((()=>u(n)))}),[u,n]),m=(0,o.useCallback)((e=>{l({...i,...e})}),[i]),f=(0,o.useCallback)((()=>{d(mu(i)).then((()=>u(n)))}),[u,i,n]),g=(0,o.useCallback)((e=>{e.preventDefault(),r(!0),d(mu({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===hu()?"WizardWooCommerceStep":"WelcomeWizardPitchMSSStep":"WelcomeWizardMigratedUserStep"})(n);return s().createElement(s().Fragment,null,s().createElement(gu.Z,{count:t,current:n}),s().createElement(ou,null,"WelcomeWizardSenderStep"===v?s().createElement(uu,{illustrationUrl:window.wizard_sender_illustration_url},s().createElement(zc,{update_sender:m,submit_sender:f,finish:g,loading:a,sender:i})):null,"WelcomeWizardMigratedUserStep"===v?s().createElement(uu,{illustrationUrl:window.wizard_sender_illustration_url},s().createElement(Gc,{next:()=>u(n)})):null,"WelcomeWizardEmailCourseStep"===v?s().createElement(uu,{illustrationUrl:window.wizard_email_course_illustration_url},s().createElement(Xc,{next:()=>u(n)})):null,"WelcomeWizardUsageTrackingStep"===v?s().createElement(uu,{illustrationUrl:window.wizard_tracking_illustration_url},s().createElement(ru,{loading:a,submitForm:p})):null,"WelcomeWizardPitchMSSStep"===v?s().createElement(uu,{illustrationUrl:window.wizard_MSS_pitch_illustration_url},s().createElement(ya,{next:()=>u(n),subscribersCount:window.subscribers_count,mailpoetAccountUrl:window.mailpoet_account_url})):null,"WizardWooCommerceStep"===v?s().createElement(pu,{isWizardStep:!0}):null))};vu.propTypes={match:b().shape({params:b().shape({step:b().string}).isRequired}).isRequired,history:b().shape({push:b().func.isRequired}).isRequired};var bu=vu;const yu=()=>{let e="/steps/1";window.location.search.includes("woocommerce-setup")&&(e="/woocommerce");const t=(0,Ve.S)(window);return s().createElement(Ve.k.Provider,{value:t},s().createElement(u.UT,null,s().createElement(ot.Z,null),s().createElement(d.Switch,null,s().createElement(d.Route,{path:"/steps/:step",component:bu}),s().createElement(d.Route,{path:"/woocommerce",component:pu}),s().createElement(d.Route,{render:()=>s().createElement(d.Redirect,{to:e})}))))},wu=document.getElementById("mailpoet-wizard-container");wu&&c().render(s().createElement(yu,null),wu);const Eu=()=>{const[e,t]=(0,o.useState)(null),n=(0,Ve.S)(window),a=n.notices.error;function r(r){const i=r.target.name,o=r.target.checked;h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"set",data:{[i]:o?1:0}}).done((()=>{const a=e[i];a.value=o,t({...e,[i]:a});const r=`Feature '${i}' was ${o?"enabled":"disabled"}.`;n.notices.success(s().createElement("p",null,r))})).fail((e=>{e.errors.length>0&&a(e.errors.map((e=>s().createElement("p",{key:e.message},e.message))),{scroll:!0})}))}return(0,o.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(s().createElement(s().Fragment,null,e.errors.map((e=>s().createElement("p",null,e.message)))),{scroll:!0})}))}),[a]),null===e?s().createElement("p",null,"Loading experimental features..."):0===Object.values(e).length?s().createElement("p",null,"There are no experimental features at the moment."):s().createElement(Ve.k.Provider,{value:n},s().createElement(s().Fragment,null,s().createElement(ot.Z,null),Object.values(e).map((e=>{const t=`experimental-feature-${e.name}`;return s().createElement("div",{key:e.name},s().createElement("label",{htmlFor:t},s().createElement("input",{id:t,type:"checkbox",name:e.name,defaultChecked:e.value,onChange:r})," ",e.name))}))))},_u=document.getElementById("experimental_features_container");_u&&c().render(s().createElement(Eu,null),_u);var Zu=n(23520);const Iu=({message:e,editing:t})=>t?s().createElement("textarea",{value:e,className:"mailpoet-logs-full-message",readOnly:!0}):s().createElement(s().Fragment,null,`${e.substr(0,150)}…`);Iu.propTypes={message:b().string.isRequired,editing:b().bool.isRequired};const Su=({log:e})=>{const[t,n]=(0,o.useState)(!1);return s().createElement("tr",{key:`log-row-${e.id}`},s().createElement("td",{role:"gridcell"},e.name),s().createElement("td",{onClick:function(e){(function(e){return(e.ctrlKey||e.metaKey)&&!e.altKey})(e)&&(t||n(!0))},role:"gridcell"},s().createElement(Iu,{message:e.message,editing:t})),s().createElement("td",{role:"gridcell"},h.Z.Date.full(e.created_at)))};Su.propTypes={log:b().shape({id:b().number.isRequired,name:b().string.isRequired,message:b().string.isRequired,created_at:b().string.isRequired}).isRequired};const ku=({logs:e,onFilter:t,originalFrom:n,originalTo:a,originalSearch:r,originalOffset:i,originalLimit:l})=>{const[c,u]=(0,o.useState)(null!=n?n:void 0),[d,p]=(0,o.useState)(null!=a?a:void 0),[m,f]=(0,o.useState)(null!=i?i:""),[g,v]=(0,o.useState)(null!=l?l:""),[b,y]=(0,o.useState)(r||""),w=(0,hs.curry)(((e,t)=>{e(null!==t?h.Z.Date.format(t,{format:"Y-m-d"}):void 0)})),E=(0,o.useCallback)((()=>{const e={};c&&(e.from=c),d&&(e.to=d),m&&""!==m.trim()&&(e.offset=m),g&&""!==g.trim()&&(e.limit=g),b&&""!==b.trim()&&(e.search=b.trim()),t(e)}),[c,g,m,b,d,t]);return s().createElement("div",{className:"mailpoet-listing mailpoet-logs"},s().createElement("div",{className:"mailpoet-listing-header"},s().createElement("div",{className:"mailpoet-listing-search"},s().createElement("label",{htmlFor:"search_input",className:"screen-reader-text"},h.Z.I18n.t("searchLabel")),s().createElement(ce.Z,{dimension:"small",iconStart:Zu.Z,type:"search",id:"search_input",name:"s",onChange:e=>y(e.target.value),value:b,placeholder:h.Z.I18n.t("searchLabel")})),s().createElement("div",{className:"mailpoet-listing-filters"},`${h.Z.I18n.t("from")}:`,s().createElement(At,{dateFormat:"MMMM d, yyyy",onChange:w(u),maxDate:new Date,selected:c?(0,Oo.default)(c):void 0,dimension:"small"}),`${h.Z.I18n.t("to")}:`,s().createElement(At,{dateFormat:"MMMM d, yyyy",onChange:w(p),maxDate:new Date,selected:d?(0,Oo.default)(d):void 0,dimension:"small"})),s().createElement("div",{className:"mailpoet-logs-limit"},s().createElement("label",{htmlFor:"offset_input",className:"screen-reader-text"},h.Z.I18n.t("offsetLabel")),s().createElement(ce.Z,{dimension:"small",id:"offset_input",name:"o",type:"number",onChange:e=>f(e.target.value),value:m,placeholder:h.Z.I18n.t("offsetLabel")})),s().createElement("div",{className:"mailpoet-logs-limit"},s().createElement("label",{htmlFor:"limit_input",className:"screen-reader-text"},h.Z.I18n.t("limitLabel")),s().createElement(ce.Z,{dimension:"small",id:"limit_input",name:"l",type:"number",onChange:e=>v(e.target.value),value:g,placeholder:h.Z.I18n.t("limitLabel")})),s().createElement(Re.Button,{dimension:"small",onClick:E},h.Z.I18n.t("filter"))),s().createElement("table",{className:"mailpoet-listing-table widefat striped",role:"grid"},s().createElement("thead",null,s().createElement("tr",null,s().createElement("th",null,h.Z.I18n.t("tableHeaderName")),s().createElement("th",null,h.Z.I18n.t("tableHeaderMessage")),s().createElement("th",null,h.Z.I18n.t("tableHeaderCreatedOn")))),s().createElement("tbody",null,e.map((e=>s().createElement(Su,{log:e,key:`log-${e.id}`}))))))};ku.propTypes={logs:b().arrayOf(b().shape({id:b().number.isRequired,name:b().string.isRequired,message:b().string.isRequired,created_at:b().string.isRequired})).isRequired,originalFrom:b().string,originalTo:b().string,originalSearch:b().string,originalOffset:b().string,originalLimit:b().string,onFilter:b().func.isRequired};const Cu=document.getElementById("mailpoet_logs_container");if(Cu){const e=new URL(window.location.href);c().render(s().createElement(ku,{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,n])=>{e.searchParams.append(t,n)})),window.location.href=e.href}}),Cu)}var Tu=n(13651);const Nu=({onRequestClose:e})=>{const[t,n]=(0,o.useState)(!1);return m()((e=>{e(document).on("click",".notice .mailpoet-js-button-fix-this",(()=>{n(!0)}))})),s().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},s().createElement(ot.Z,null),t&&s().createElement(Tu.Z,{onRequestClose:()=>{n(!1),e()}}))};Nu.propTypes={onRequestClose:b().func},Nu.defaultProps={onRequestClose:hs.noop};const Du=document.getElementById("mailpoet_set_from_address_modal");Du&&c().render(s().createElement(Nu,{onRequestClose:()=>{window.location.href.includes("?page=mailpoet-settings")&&window.location.reload()}}),Du);const xu=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=>xu(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+)?/),o=i[1],s=i[2];if(!s)return n(e,t);switch(o){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(o,t)).replace("{{time}}",a(s,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),o=n(13882);function s(e){(0,o.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,o.Z)(1,arguments);var t=(0,a.default)(e),n=(0,r.Z)(t).getTime()-s(t).getTime();return Math.round(n/l)+1}},7032:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(19013),r=n(66979),i=n(13882);function o(e){(0,i.Z)(1,arguments);var t=(0,a.default)(e),n=t.getUTCFullYear(),o=new Date(0);o.setUTCFullYear(n+1,0,4),o.setUTCHours(0,0,0,0);var s=(0,r.Z)(o),l=new Date(0);l.setUTCFullYear(n,0,4),l.setUTCHours(0,0,0,0);var c=(0,r.Z)(l);return t.getTime()>=s.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(83946),o=n(7651),s=n(13882);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,i.Z)(l),u=null==n.firstWeekContainsDate?c:(0,i.Z)(n.firstWeekContainsDate),d=(0,o.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 s}});var a=n(83946),r=n(19013),i=n(59025),o=n(13882);function s(e,t){(0,o.Z)(1,arguments);var n=(0,r.default)(e,t),s=n.getUTCFullYear(),l=t||{},c=l.locale,u=c&&c.options&&c.options.firstWeekContainsDate,d=null==u?1:(0,a.Z)(u),p=null==l.firstWeekContainsDate?d:(0,a.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(s+1,0,p),m.setUTCHours(0,0,0,0);var h=(0,i.Z)(m,t),f=new Date(0);f.setUTCFullYear(s,0,p),f.setUTCHours(0,0,0,0);var g=(0,i.Z)(f,t);return n.getTime()>=h.getTime()?s+1:n.getTime()>=g.getTime()?s:s-1}},5267:function(e,t,n){"use strict";n.d(t,{Iu:function(){return i},Do:function(){return o},qp:function(){return s}});var a=["D","DD"],r=["YY","YYYY"];function i(e){return-1!==a.indexOf(e)}function o(e){return-1!==r.indexOf(e)}function s(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(),o=(i<t?7:0)+i-t;return n.setUTCDate(n.getUTCDate()-o),n.setUTCHours(0,0,0,0),n}},59025:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(83946),r=n(19013),i=n(13882);function o(e,t){(0,i.Z)(1,arguments);var n=t||{},o=n.locale,s=o&&o.options&&o.options.weekStartsOn,l=null==s?0:(0,a.Z)(s),c=null==n.weekStartsOn?l:(0,a.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=(0,r.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 o}});var a=n(83946),r=n(19013),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t);return isNaN(o)?new Date(NaN):o?(n.setDate(n.getDate()+o),n):n}},78343: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),o=36e5;function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.Z)(e,n*o)}},51820:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(83946),r=n(19013),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e).getTime(),o=(0,a.Z)(t);return new Date(n+o)}},58545: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);function o(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 o}});var a=n(83946),r=n(19013),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t);if(isNaN(o))return new Date(NaN);if(!o)return n;var s=n.getDate(),l=new Date(n.getTime());l.setMonth(n.getMonth()+o+1,0);var c=l.getDate();return s>=c?l:(n.setFullYear(l.getFullYear(),l.getMonth(),s),n)}},63500:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(83946),r=n(77349),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t),o=7*n;return(0,r.default)(e,o)}},21593:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(83946),r=n(11640),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,12*n)}},92300:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(24262),r=n(69119),i=n(13882),o=864e5;function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t),l=n.getTime()-(0,a.Z)(n),c=s.getTime()-(0,a.Z)(s);return Math.round((l-c)/o)}},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),o=n.getFullYear()-i.getFullYear(),s=n.getMonth()-i.getMonth();return 12*o+s}},52724:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(584),r=n(24262),i=n(13882),o=6048e5;function s(e,t,n){(0,i.Z)(2,arguments);var s=(0,a.default)(e,n),l=(0,a.default)(t,n),c=s.getTime()-(0,r.Z)(s),u=l.getTime()-(0,r.Z)(l);return Math.round((c-u)/o)}},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 o}});var a=n(19013),r=n(83946),i=n(13882);function o(e,t){(0,i.Z)(1,arguments);var n=t||{},o=n.locale,s=o&&o.options&&o.options.weekStartsOn,l=null==s?0:(0,r.Z)(s),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 L}});var a=n(12274),r=n(4958),i=n(91218),o=n(19013);function s(e,t){for(var n=e<0?"-":"",a=Math.abs(e).toString();a.length<t;)a="0"+a;return n+a}var l=function(e,t){var n=e.getUTCFullYear(),a=n>0?n:1-n;return s("yy"===t?a%100:a,t.length)},c=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):s(n+1,2)},u=function(e,t){return s(e.getUTCDate(),t.length)},d=function(e,t){return s(e.getUTCHours()%12||12,t.length)},p=function(e,t){return s(e.getUTCHours(),t.length)},m=function(e,t){return s(e.getUTCMinutes(),t.length)},h=function(e,t){return s(e.getUTCSeconds(),t.length)},f=function(e,t){var n=t.length,a=e.getUTCMilliseconds();return s(Math.floor(a*Math.pow(10,n-3)),t.length)},g=n(13882),v=864e5,b=n(49702),y=n(7032),w=n(23324),E=n(7651);function _(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 o=t||"";return n+String(r)+o+s(i,2)}function Z(e,t){return e%60==0?(e>0?"-":"+")+s(Math.abs(e)/60,2):I(e,t)}function I(e,t){var n=t||"",a=e>0?"-":"+",r=Math.abs(e);return a+s(Math.floor(r/60),2)+n+s(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 l(e,t)},Y:function(e,t,n,a){var r=(0,E.Z)(e,a),i=r>0?r:1-r;return"YY"===t?s(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):s(i,t.length)},R:function(e,t){return s((0,y.Z)(e),t.length)},u:function(e,t){return s(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 s(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 s(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 c(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 s(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,w.Z)(e,a);return"wo"===t?n.ordinalNumber(r,{unit:"week"}):s(r,t.length)},I:function(e,t,n){var a=(0,b.Z)(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):s(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):u(e,t)},D:function(e,t,n){var a=function(e){(0,g.Z)(1,arguments);var t=(0,o.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/v)+1}(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):s(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 s(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 s(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 s(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 d(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):p(e,t)},K:function(e,t,n){var a=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):s(a,t.length)},k:function(e,t,n){var a=e.getUTCHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):s(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):h(e,t)},S:function(e,t){return f(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"+_(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"+_(r,":");case"zzzz":default:return"GMT"+I(r,":")}},t:function(e,t,n,a){var r=a._originalDate||e;return s(Math.floor(r.getTime()/1e3),t.length)},T:function(e,t,n,a){return s((a._originalDate||e).getTime(),t.length)}},k=n(97621),C=n(24262),T=n(5267),N=n(83946),D=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,R=/^'([^]*?)'?$/,O=/''/g,P=/[a-zA-Z]/;function L(e,t,n){(0,g.Z)(2,arguments);var s=String(t),l=n||{},c=l.locale||r.Z,u=c.options&&c.options.firstWeekContainsDate,d=null==u?1:(0,N.Z)(u),p=null==l.firstWeekContainsDate?d:(0,N.Z)(l.firstWeekContainsDate);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=c.options&&c.options.weekStartsOn,h=null==m?0:(0,N.Z)(m),f=null==l.weekStartsOn?h:(0,N.Z)(l.weekStartsOn);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!c.localize)throw new RangeError("locale must contain localize property");if(!c.formatLong)throw new RangeError("locale must contain formatLong property");var v=(0,o.default)(e);if(!(0,a.default)(v))throw new RangeError("Invalid time value");var b=(0,C.Z)(v),y=(0,i.Z)(v,b),w={firstWeekContainsDate:p,weekStartsOn:f,locale:c,_originalDate:v},E=s.match(x).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,k.Z[t])(e,c.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!l.useAdditionalWeekYearTokens&&(0,T.Do)(n)&&(0,T.qp)(n,t,e),!l.useAdditionalDayOfYearTokens&&(0,T.Iu)(n)&&(0,T.qp)(n,t,e),r(y,n,c.localize,w);if(a.match(P))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return n})).join("");return E}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 o(e){return(0,i.Z)(1,arguments),(0,r.default)(e,{weekStartsOn:1})}function s(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 s=o(r),l=new Date(0);l.setFullYear(n,0,4),l.setHours(0,0,0,0);var c=o(l);return t.getTime()>=s.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function l(e){(0,i.Z)(1,arguments);var t=s(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var a=o(n);return a}var c=6048e5;function u(e){(0,i.Z)(1,arguments);var t=(0,a.default)(e),n=o(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){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getFullYear();return n}},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 o}});var a=n(71381),r=n(19013),i=n(13882);function o(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(),o=(0,a.default)(t.end).getTime();if(!(i<=o))throw new RangeError("Invalid interval");return n>=i&&n<=o}},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"})},o={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function s(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,o=r.width?String(r.width):i;a=e.formattingValues[o]||e.formattingValues[i]}else{var s=e.defaultWidth,l=r.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[s]}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 o,s=i[0],l=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(l)?u(l,(function(e){return e.test(s)})):c(l,(function(e){return e.test(s)}));o=e.valueCallback?e.valueCallback(d):d,o=n.valueCallback?n.valueCallback(o):o;var p=t.slice(s.length);return{value:o,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 o[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:s({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:s({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:s({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:s({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:s({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 o=e.slice(a.length);return{value:i,rest:o}}),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 o(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 s=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,o=r&&r.options&&r.options.weekStartsOn,s=null==o?0:(0,u.Z)(o),l=null==a.weekStartsOn?s:(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),b=/^(1[0-2]|0?\d)/,y=/^(3[0-1]|[0-2]?\d)/,w=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,E=/^(5[0-3]|[0-4]?\d)/,_=/^(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/,C=/^[0-5]?\d/,T=/^\d/,N=/^\d{1,2}/,D=/^\d{1,3}/,x=/^\d{1,4}/,R=/^-?\d+/,O=/^-?\d/,P=/^-?\d{1,2}/,L=/^-?\d{1,3}/,M=/^-?\d{1,4}/,A=/^([+-])(\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 W(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 V(e,t){return j(R,e,t)}function Y(e,t,n){switch(e){case 1:return j(T,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(P,t,n);case 3:return j(L,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 o="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(o,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 o="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(o,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(b,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(b,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,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),o=(0,f.Z)(a,n)-r;return a.setUTCDate(a.getUTCDate()-7*o),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,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(y,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),o=r.getUTCDay(),s=((n%7+7)%7<a?7:0)+n-o;return r.setUTCDate(r.getUTCDate()+s),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","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","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);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:["a","b","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(C,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=59},set:function(e,t,n,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 W(A,e);case"XX":return W(F,e);case"XXXX":return W(q,e);case"XXXXX":return W(U,e);case"XXX":default:return W($,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 W(A,e);case"xx":return W(F,e);case"xxxx":return W(q,e);case"xxxxx":return W(U,e);case"xxx":default:return W($,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 V(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 V(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,b=null==v?1:(0,u.Z)(v),y=null==f.firstWeekContainsDate?b:(0,u.Z)(f.firstWeekContainsDate);if(!(y>=1&&y<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var w=g.options&&g.options.weekStartsOn,E=null==w?0:(0,u.Z)(w),_=null==f.weekStartsOn?E:(0,u.Z)(f.weekStartsOn);if(!(_>=0&&_<=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:y,weekStartsOn:_,locale:g},S=[{priority:10,subPriority:-1,set:oe,index:0}],k=h.match(ee).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,s.Z[t])(e,g.formatLong,I):e})).join("").match(J),C=[];for(Z=0;Z<k.length;Z++){var T=k[Z];!f.useAdditionalWeekYearTokens&&(0,c.Do)(T)&&(0,c.qp)(T,h,e),!f.useAdditionalDayOfYearTokens&&(0,c.Iu)(T)&&(0,c.qp)(T,h,e);var N=T[0],D=X[N];if(D){var x=D.incompatibleTokens;if(Array.isArray(x)){for(var R=void 0,O=0;O<C.length;O++){var P=C[O].token;if(-1!==x.indexOf(P)||P===N){R=C[O];break}}if(R)throw new RangeError("The format string mustn't contain `".concat(R.fullToken,"` and `").concat(T,"` at the same time"))}else if("*"===D.incompatibleTokens&&C.length)throw new RangeError("The format string mustn't contain `".concat(T,"` and any other token at the same time"));C.push({token:N,fullToken:T});var L=D.parse(m,T,g.match,I);if(!L)return new Date(NaN);S.push({priority:D.priority,subPriority:D.subPriority||0,set:D.set,validate:D.validate,value:L.value,index:S.length}),m=L.rest}else{if(N.match(re))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");if("''"===T?T="'":"'"===N&&(T=se(T)),0!==m.indexOf(T))return new Date(NaN);m=m.slice(T.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]})),A=(0,i.default)(n);if(isNaN(A))return new Date(NaN);var F=(0,r.Z)(A,(0,l.Z)(A)),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],o(q,U[1])):F=U}return F}function oe(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 se(e){return e.match(te)[1].replace(ne,"'")}},23855:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return u}});var a=n(83946),r=n(13882),i=36e5,o={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},s=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,l=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,c=/^([+-])(\d{2})(?::?(\d{2}))?$/;function u(e,t){(0,r.Z)(1,arguments);var n=t||{},i=null==n.additionalDigits?2:(0,a.Z)(n.additionalDigits);if(2!==i&&1!==i&&0!==i)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 o,s=d(e);if(s.date){var l=p(s.date,i);o=m(l.restDateString,l.year)}if(isNaN(o)||!o)return new Date(NaN);var c,u=o.getTime(),h=0;if(s.time&&(h=f(s.time),isNaN(h)||null===h))return new Date(NaN);if(!s.timezone){var g=new Date(u+h),b=new Date(0);return b.setFullYear(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),b.setHours(g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds()),b}return c=v(s.timezone),isNaN(c)?new Date(NaN):new Date(u+h+c)}function d(e){var t,n={},a=e.split(o.dateTimeDelimiter);if(a.length>2)return n;if(/:/.test(a[0])?(n.date=null,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:null};var r=a[1]&&parseInt(a[1]),i=a[2]&&parseInt(a[2]);return{year:null==i?r:100*i,restDateString:e.slice((a[1]||a[2]).length)}}function m(e,t){if(null===t)return null;var n=e.match(s);if(!n)return null;var a=!!n[4],r=h(n[1]),i=h(n[2])-1,o=h(n[3]),l=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,l,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,l,c):new Date(NaN);var u=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(b[t]||(y(e)?29:28))}(t,i,o)&&function(e,t){return t>=1&&t<=(y(e)?366:365)}(t,r)?(u.setUTCFullYear(t,i,Math.max(r,o)),u):new Date(NaN)}function h(e){return e?parseInt(e):1}function f(e){var t=e.match(l);if(!t)return null;var n=g(t[1]),a=g(t[2]),r=g(t[3]);return function(e,t,n){return 24===e?0===t&&0===n:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}(n,a,r)?n*i+6e4*a+1e3*r:NaN}function g(e){return e&&parseFloat(e.replace(",","."))||0}function v(e){if("Z"===e)return 0;var t=e.match(c);if(!t)return 0;var n="+"===t[1]?-1:1,a=parseInt(t[2]),r=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,r)?n*(a*i+6e4*r):NaN}var b=[31,null,31,30,31,30,31,31,30,31,30,31];function y(e){return e%400==0||e%4==0&&e%100}},37042: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 o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t);return n.setHours(o),n}},4543: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 o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t);return n.setMinutes(o),n}},62225: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 o(e){(0,i.Z)(1,arguments);var t=(0,r.default)(e),n=t.getFullYear(),a=t.getMonth(),o=new Date(0);return o.setFullYear(n,a+1,0),o.setHours(0,0,0,0),o.getDate()}function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t),l=n.getFullYear(),c=n.getDate(),u=new Date(0);u.setFullYear(l,s,15),u.setHours(0,0,0,0);var d=o(u);return n.setMonth(s,Math.min(c,d)),n}},11503: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(62225),o=n(13882);function s(e,t){(0,o.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t),l=Math.floor(n.getMonth()/3)+1,c=s-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 o}});var a=n(83946),r=n(19013),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t);return n.setSeconds(o),n}},44749: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 o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(o),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 o}});var a=n(19013),r=n(83946),i=n(13882);function o(e,t){(0,i.Z)(1,arguments);var n=t||{},o=n.locale,s=o&&o.options&&o.options.weekStartsOn,l=null==s?0:(0,r.Z)(s),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 o}});var a=n(83946),r=n(77349),i=n(13882);function o(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 o}});var a=n(83946),r=n(78343),i=n(13882);function o(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 o}});var a=n(83946),r=n(51820),i=n(13882);function o(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 o}});var a=n(83946),r=n(58545),i=n(13882);function o(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 o}});var a=n(83946),r=n(11640),i=n(13882);function o(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 o}});var a=n(83946),r=n(63500),i=n(13882);function o(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 o}});var a=n(83946),r=n(21593),i=n(13882);function o(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,o=r.width?String(r.width):i;a=e.formattingValues[o]||e.formattingValues[i]}else{var s=e.defaultWidth,l=r.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[s]}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,o={parse:function(n,a){var s=(a=a||{}).dynamicTyping||!1;if(E(s)&&(a.dynamicTypingFunction=s,s={}),a.dynamicTyping=s,a.transform=!!E(a.transform)&&a.transform,a.worker&&o.WORKERS_SUPPORTED){var l=function(){if(!o.WORKERS_SUPPORTED)return!1;var n,a,s=(n=t.URL||t.webkitURL||null,a=e.toString(),o.BLOB_URL||(o.BLOB_URL=n.createObjectURL(new Blob(["(",a,")();"],{type:"text/javascript"})))),l=new t.Worker(s);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=E(a.step),a.chunk=E(a.chunk),a.complete=E(a.complete),a.error=E(a.error),delete a.worker,void l.postMessage({input:n,config:a,workerId:l.id})}var m=null;return o.NODE_STREAM_INPUT,"string"==typeof n?m=a.download?new c(a):new d(a):!0===n.readable&&E(n.read)&&E(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",s='"',l=s+s,c=!1,u=null,d=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||o.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&&(s=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+s),"boolean"==typeof t.escapeFormulae&&(d=t.escapeFormulae)}}();var p=new RegExp(h(s),"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 o="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var s=Array.isArray(e)&&0<e.length,l=!Array.isArray(t[0]);if(s&&a){for(var c=0;c<e.length;c++)0<c&&(o+=r),o+=f(e[c],c);0<t.length&&(o+=i)}for(var u=0;u<t.length;u++){var d=s?e.length:t[u].length,p=!1,m=s?0===Object.keys(t[u]).length:0===t[u].length;if(n&&!s&&(p="greedy"===n?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===n&&s){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 b=0;b<d;b++){0<b&&!m&&(o+=r);var y=s&&l?e[b]:b;o+=f(t[u][y],b)}u<t.length-1&&(!n||0<d&&!m)&&(o+=i)}}return o}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,o.BAD_DELIMITERS)||-1<a.indexOf(r)||" "===a.charAt(0)||" "===a.charAt(a.length-1)?s+a+s:a}}};if(o.RECORD_SEP=String.fromCharCode(30),o.UNIT_SEP=String.fromCharCode(31),o.BYTE_ORDER_MARK="\ufeff",o.BAD_DELIMITERS=["\r","\n",'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!n&&!!t.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=f,o.ParserHandle=m,o.NetworkStreamer=c,o.FileStreamer=u,o.StringStreamer=d,o.ReadableStreamStreamer=p,t.jQuery){var s=t.jQuery;s.fn.parse=function(e){var n=e.config||{},a=[];return this.each((function(e){if("INPUT"!==s(this).prop("tagName").toUpperCase()||"file"!==s(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:s.extend({},n)})})),r(),this;function r(){if(0!==a.length){var t,n,r,l=a[0];if(E(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(e.error)&&e.error({name:"AbortError"},t,n,r));if("skip"===c.action)return void i();"object"==typeof c.config&&(l.instanceConfig=s.extend(l.instanceConfig,c.config))}else if("skip"===c)return void i()}var u=l.instanceConfig.complete;l.instanceConfig.complete=function(e){E(u)&&u(e,l.file,l.inputElem),i()},o.parse(l.file,l.instanceConfig)}else E(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=y(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new m(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&E(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 s=this._handle.parse(i,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=s.meta.cursor;this._finished||(this._partialLine=i.substring(l-this._baseIndex),this._baseIndex=l),s&&s.data&&(this._rowCount+=s.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(a)t.postMessage({results:s,workerId:o.WORKER_ID,finished:c});else if(E(this._config.chunk)&&!n){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);s=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!c||!E(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):a&&this._config.error&&t.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.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=o.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,s=/^\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(e.step)){var b=e.step;e.step=function(t){if(v=t,Z())_();else{if(_(),0===v.data.length)return;u+=t.data.length,e.preview&&u>e.preview?n.abort():(v.data=v.data[0],b(v,c))}}}function w(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function _(){if(v&&a&&(S("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.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(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,o=t[a];e.header&&(i=a>=g.length?"__parsed_extra":g[a]),e.transform&&(o=e.transform(o,i)),o=I(i,o),"__parsed_extra"===i?(r[i]=r[i]||[],r[i].push(o)):r[i]=o}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(s.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,s){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 o=0,s=0;s<a.length;s++)"\n"===a[s][0]&&o++;return o>=a.length/2?"\r\n":"\r"}(r,l)),a=!1,e.delimiter)E(e.delimiter)&&(e.delimiter=e.delimiter(r),v.meta.delimiter=e.delimiter);else{var c=function(t,n,a,r,i){var s,l,c,u;i=i||[",","\t","|",";",o.RECORD_SEP,o.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),b=0;b<v.data.length;b++)if(a&&w(v.data[b]))g++;else{var y=v.data[b].length;h+=y,void 0!==c?0<y&&(m+=Math.abs(y-c),c=y):c=y}0<v.data.length&&(h/=v.data.length-g),(void 0===l||m<=l)&&(void 0===u||u<h)&&1.99<h&&(l=m,s=p,u=h)}return{successful:!!(e.delimiter=s),bestDelimiter:s}}(r,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(a=!0,e.delimiter=o.DefaultDelimiter),v.meta.delimiter=e.delimiter}var u=y(e);return e.preview&&e.header&&u.preview++,t=r,n=new f(u),v=n.parse(t,i,s),_(),p?{meta:{paused:!0}}:v||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,n.abort(),t=E(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(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,s=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<o.BAD_DELIMITERS.indexOf(n))&&(n=","),r===n)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<o.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==a&&"\r"!==a&&"\r\n"!==a&&(a="\n");var u=0,d=!1;this.parse=function(e,o,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,b=E(i),y=[],w=[],_=[],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(_=I[S],u+=_.length,S!==I.length-1)u+=a.length;else if(p)return M();if(!r||_.substring(0,v)!==r){if(b){if(y=[],R(_.split(n)),A(),d)return M()}else R(_.split(n));if(s&&s<=S)return y=y.slice(0,s),M(!0)}}return M()}for(var k=e.indexOf(n,u),C=e.indexOf(a,u),T=new RegExp(h(c)+h(t),"g"),N=e.indexOf(t,u);;)if(e[u]!==t)if(r&&0===_.length&&e.substring(u,u+v)===r){if(-1===C)return M();u=C+g,C=e.indexOf(a,u),k=e.indexOf(n,u)}else if(-1!==k&&(k<C||-1===C))_.push(e.substring(u,k)),u=k+f,k=e.indexOf(n,u);else{if(-1===C)break;if(_.push(e.substring(u,C)),L(C+g),b&&(A(),d))return M();if(s&&y.length>=s)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:y.length,index:u}),P();if(N===m-1)return P(e.substring(u,N).replace(T,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!==C&&C<N+1&&(C=e.indexOf(a,N+1));var D=O(-1===C?k:Math.min(k,C));if(e[N+1+D]===n){_.push(e.substring(u,N).replace(T,t)),e[u=N+1+D+f]!==t&&(N=e.indexOf(t,u)),k=e.indexOf(n,u),C=e.indexOf(a,u);break}var x=O(C);if(e.substring(N+1+x,N+1+x+g)===a){if(_.push(e.substring(u,N).replace(T,t)),L(N+1+x+g),k=e.indexOf(n,u),N=e.indexOf(t,u),b&&(A(),d))return M();if(s&&y.length>=s)return M(!0);break}w.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:y.length,index:u}),N++}}else N++}return P();function R(e){y.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 P(t){return p||(void 0===t&&(t=e.substring(u)),_.push(t),u=m,R(_),b&&A()),M()}function L(t){u=t,R(_),_=[],C=e.indexOf(a,u)}function M(e){return{data:y,errors:w,meta:{delimiter:n,linebreak:a,aborted:d,truncated:!!e,cursor:Z+(o||0)}}}function A(){i(M()),y=[],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:b,resume:b};if(E(n.userStep)){for(var o=0;o<t.results.data.length&&(n.userStep({data:t.results.data[o],errors:t.results.errors,meta:t.results.meta},i),!a);o++);delete t.results}else E(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];E(n.userComplete)&&n.userComplete(t),n.terminate(),delete r[e]}function b(){throw new Error("Not implemented.")}function y(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=y(e[n]);return t}function w(e,t){return function(){e.apply(t,arguments)}}function E(e){return"function"==typeof e}return a&&(t.onmessage=function(e){var n=e.data;if(void 0===o.WORKER_ID&&n&&(o.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:o.WORKER_ID,results:o.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var a=o.parse(n.input,n.config);a&&t.postMessage({workerId:o.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,o})?n.apply(t,[]):n)||(e.exports=a)},9198:function(e,t,n){!function(e,t,a,r,i,o,s,l,c,u,d,p,m,h,f,g,v,b,y,w,E,_,Z,I,S,k,C,T,N,D,x,R,O,P,L,M,A,F,q,$,U,j,W,V,Y,B,H,z,K,G,Q,X,J,ee,te,ne,ae,re,ie,oe,se,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(o),fe=ue(s),ge=ue(l),ve=ue(c),be=ue(u),ye=ue(d),we=ue(p),Ee=ue(m),_e=ue(g),Ze=ue(v),Ie=ue(b),Se=ue(y),ke=ue(w),Ce=ue(E),Te=ue(_),Ne=ue(Z),De=ue(I),xe=ue(S),Re=ue(k),Oe=ue(C),Pe=ue(T),Le=ue(N),Me=ue(D),Ae=ue(x),Fe=ue(R),qe=ue(O),$e=ue(P),Ue=ue(L),je=ue(M),We=ue(A),Ve=ue(F),Ye=ue(q),Be=ue(U),He=ue(j),ze=ue(W),Ke=ue(V),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),ot=ue(ae),st=ue(re),lt=ue(ie),ct=ue(oe),ut=ue(se),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){bt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ht(e){return(ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ft(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gt(e,t){for(var n=0;n<t.length;n++){var 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),e}function bt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yt(){return(yt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var 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");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_t(e,t)}function Et(e){return(Et=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _t(e,t){return(_t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function 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=Et(e);if(t){var r=Et(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 Ct(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function Tt(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function 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 Tt(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}}",Tt(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):st.default(e):new Date;return Lt(t)?t:null}function Pt(e,t,n,a,r){var i=null,o=Jt(n)||Jt(Xt()),s=!0;return Array.isArray(t)?(t.forEach((function(t){var n=lt.default(e,t,new Date,{locale:o});a&&(s=Lt(n,r)&&e===fe.default(n,t,{awareOfUnicodeTokens:!0})),Lt(n,r)&&s&&(i=n)})),i):(i=lt.default(e,t,new Date,{locale:o}),a?s=Lt(i)&&e===fe.default(i,t,{awareOfUnicodeTokens:!0}):Lt(i)||(t=t.match(Rt).map((function(e){var t=e[0];return"p"===t||"P"===t?o?(0,Dt[t])(e,o.formatLong):t:e})).join(""),e.length>0&&(i=lt.default(e,t.slice(0,e.length),new Date)),Lt(i)||(i=new Date(e))),Lt(i)&&s?i:null)}function Lt(e,t){return t=t||new Date("1/1/1000"),he.default(e)&&rt.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 At(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,o=t.second,s=void 0===o?0:o;return Fe.default(Ae.default(Me.default(e,s),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 Wt(e){return Ke.default(e)}function Vt(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=ot.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.includeDates,o=t.filterDate;return dn(e,{minDate:n,maxDate:a})||r&&r.some((function(t){return Kt(e,t)}))||i&&!i.some((function(t){return Kt(e,t)}))||o&&!o(Ot(e))||!1}function rn(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).excludeDates;return t&&t.some((function(t){return Kt(e,t)}))||!1}function on(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate,r=t.excludeDates,i=t.includeDates,o=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)}))||o&&!o(Ot(e))||!1}function sn(e,t,n,a){var r=Pe.default(e),i=Re.default(e),o=Pe.default(t),s=Re.default(t),l=Pe.default(a);return r===o&&r===l?i<=n&&n<=s:r<o?l===r&&i<=n||l===o&&s>=n||l<o&&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,o=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)}))||o&&!o(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=Pe.default(e),i=Oe.default(e),o=Pe.default(t),s=Oe.default(t),l=Pe.default(a);return r===o&&r===l?i<=n&&n<=s:r<o?l===r&&i<=n||l===o&&s>=n||l<o&&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&&Ve.default(e,n)<0||a&&Ve.default(e,a)>0}function pn(e,t){return t.some((function(t){return Te.default(t)===Te.default(e)&&Ce.default(t)===Ce.default(e)}))}function mn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeTimes,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(),o=Fe.default(Ae.default(i,Ce.default(e)),Te.default(e)),s=Fe.default(Ae.default(i,Ce.default(n)),Te.default(n)),l=Fe.default(Ae.default(i,Ce.default(a)),Te.default(a));try{r=!ot.default(o,{start:s,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 bn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,a=t.includeDates,r=Ee.default(e,1);return n&&Be.default(r,n)>0||a&&a.every((function(e){return Be.default(r,e)>0}))||!1}function yn(e){var t=e.minDate,n=e.includeDates;if(n&&t){var a=n.filter((function(e){return Ve.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 Ve.default(e,t)<=0}));return We.default(a)}return n?We.default(n):t}function En(){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 o=Mt(i,"MM.dd.yyyy"),s=n.get(o)||[];s.includes(t)||(s.push(t),n.set(o,s))}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 _n(e,t,n,a,r){for(var i=r.length,o=[],s=0;s<i;s++){var l=ge.default(ve.default(e,Te.default(r[s])),Ce.default(r[s])),c=ge.default(e,(n+1)*a);rt.default(l,t)&&it.default(l,c)&&o.push(r[s])}return o}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(Pe.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 o=e+t-i,s=!0;n&&(s=Pe.default(n)<=o),a&&s&&(s=Pe.default(a)>=o),s&&r.push(o)}return r}var kn=function(e){wt(n,e);var t=St(n);function n(e){var a;ft(this,n),bt(Zt(a=t.call(this,e)),"renderOptions",(function(){var e=a.props.year,t=a.state.yearsList.map((function(t){return de.default.createElement("div",{className:e===t?"react-datepicker__year-option react-datepicker__year-option--selected_year":"react-datepicker__year-option",key:t,onClick:a.onChange.bind(Zt(a),t)},e===t?de.default.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",t)})),n=a.props.minDate?Pe.default(a.props.minDate):null,r=a.props.maxDate?Pe.default(a.props.maxDate):null;return r&&a.state.yearsList.find((function(e){return e===r}))||t.unshift(de.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:a.incrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),n&&a.state.yearsList.find((function(e){return e===n}))||t.push(de.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:a.decrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t})),bt(Zt(a),"onChange",(function(e){a.props.onChange(e)})),bt(Zt(a),"handleClickOutside",(function(){a.props.onCancel()})),bt(Zt(a),"shiftYears",(function(e){var t=a.state.yearsList.map((function(t){return t+e}));a.setState({yearsList:t})})),bt(Zt(a),"incrementYears",(function(){return a.shiftYears(1)})),bt(Zt(a),"decrementYears",(function(){return a.shiftYears(-1)}));var r=e.yearDropdownItemNumber,i=e.scrollableYearDropdown,o=r||(i?10:5);return a.state={yearsList:Sn(a.props.year,o,a.props.minDate,a.props.maxDate)},a}return vt(n,[{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},this.renderOptions())}}]),n}(de.default.Component),Cn=ut.default(kn),Tn=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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{dropdownVisible:!1}),bt(Zt(e),"renderSelectOptions",(function(){for(var t=e.props.minDate?Pe.default(e.props.minDate):1900,n=e.props.maxDate?Pe.default(e.props.maxDate):2100,a=[],r=t;r<=n;r++)a.push(de.default.createElement("option",{key:r,value:r},r));return a})),bt(Zt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),bt(Zt(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:e.props.year,className:"react-datepicker__year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),bt(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))})),bt(Zt(e),"renderDropdown",(function(){return de.default.createElement(Cn,{key:"dropdown",year:e.props.year,onChange:e.onChange,onCancel:e.toggleDropdown,minDate:e.props.minDate,maxDate:e.props.maxDate,scrollableYearDropdown:e.props.scrollableYearDropdown,yearDropdownItemNumber:e.props.yearDropdownItemNumber})})),bt(Zt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),bt(Zt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.year&&e.props.onChange(t)})),bt(Zt(e),"toggleDropdown",(function(t){e.setState({dropdownVisible:!e.state.dropdownVisible},(function(){e.props.adjustDateOnChange&&e.handleYearChange(e.props.date,t)}))})),bt(Zt(e),"handleYearChange",(function(t,n){e.onSelect(t,n),e.setOpen()})),bt(Zt(e),"onSelect",(function(t,n){e.props.onSelect&&e.props.onSelect(t,n)})),bt(Zt(e),"setOpen",(function(){e.props.setOpen&&e.props.setOpen(!0)})),e}return vt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return 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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"renderOptions",(function(){return e.props.monthNames.map((function(t,n){return de.default.createElement("div",{className:e.props.month===n?"react-datepicker__month-option react-datepicker__month-option--selected_month":"react-datepicker__month-option",key:t,onClick:e.onChange.bind(Zt(e),n)},e.props.month===n?de.default.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",t)}))})),bt(Zt(e),"onChange",(function(t){return e.props.onChange(t)})),bt(Zt(e),"handleClickOutside",(function(){return e.props.onCancel()})),e}return vt(n,[{key:"render",value:function(){return 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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{dropdownVisible:!1}),bt(Zt(e),"renderSelectOptions",(function(e){return e.map((function(e,t){return de.default.createElement("option",{key:t,value:t},e)}))})),bt(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))})),bt(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]))})),bt(Zt(e),"renderDropdown",(function(t){return de.default.createElement(Dn,{key:"dropdown",month:e.props.month,monthNames:t,onChange:e.onChange,onCancel:e.toggleDropdown})})),bt(Zt(e),"renderScrollMode",(function(t){var n=e.state.dropdownVisible,a=[e.renderReadView(!n,t)];return n&&a.unshift(e.renderDropdown(t)),a})),bt(Zt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.month&&e.props.onChange(t)})),bt(Zt(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return vt(n,[{key:"render",value:function(){var e,t=this,n=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(e){return tn(e,t.props.locale)}:function(e){return en(e,t.props.locale)});switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode(n);break;case"select":e=this.renderSelectMode(n)}return 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=Wt(e),r=Wt(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),bt(Zt(a=t.call(this,e)),"renderOptions",(function(){return a.state.monthYearsList.map((function(e){var t=Le.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)},n?de.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Mt(e,a.props.dateFormat,a.props.locale))}))})),bt(Zt(a),"onChange",(function(e){return a.props.onChange(e)})),bt(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),Pn=ut.default(On),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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{dropdownVisible:!1}),bt(Zt(e),"renderSelectOptions",(function(){for(var t=Wt(e.props.minDate),n=Wt(e.props.maxDate),a=[];!rt.default(t,n);){var r=Le.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})),bt(Zt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),bt(Zt(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:Le.default(Wt(e.props.date)),className:"react-datepicker__month-year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),bt(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))})),bt(Zt(e),"renderDropdown",(function(){return de.default.createElement(Pn,{key:"dropdown",date:e.props.date,dateFormat:e.props.dateFormat,onChange:e.onChange,onCancel:e.toggleDropdown,minDate:e.props.minDate,maxDate:e.props.maxDate,scrollableMonthYearDropdown:e.props.scrollableMonthYearDropdown,locale:e.props.locale})})),bt(Zt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),bt(Zt(e),"onChange",(function(t){e.toggleDropdown();var n=Ot(parseInt(t));Bt(e.props.date,n)&&Ht(e.props.date,n)||e.props.onChange(n)})),bt(Zt(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return vt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return 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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"dayEl",de.default.createRef()),bt(Zt(e),"handleClick",(function(t){!e.isDisabled()&&e.props.onClick&&e.props.onClick(t)})),bt(Zt(e),"handleMouseEnter",(function(t){!e.isDisabled()&&e.props.onMouseEnter&&e.props.onMouseEnter(t)})),bt(Zt(e),"handleOnKeyDown",(function(t){" "===t.key&&(t.preventDefault(),t.key="Enter"),e.props.handleOnKeyDown(t)})),bt(Zt(e),"isSameDay",(function(t){return Kt(e.props.day,t)})),bt(Zt(e),"isKeyboardSelected",(function(){return!e.props.disabledKeyboardNavigation&&!e.isSameDay(e.props.selected)&&e.isSameDay(e.props.preSelection)})),bt(Zt(e),"isDisabled",(function(){return an(e.props.day,e.props)})),bt(Zt(e),"isExcluded",(function(){return rn(e.props.day,e.props)})),bt(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)})),bt(Zt(e),"isInRange",(function(){var t=e.props,n=t.day,a=t.startDate,r=t.endDate;return!(!a||!r)&&Qt(n,a,r)})),bt(Zt(e),"isInSelectingRange",(function(){var t,n=e.props,a=n.day,r=n.selectsStart,i=n.selectsEnd,o=n.selectsRange,s=n.startDate,l=n.endDate,c=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return!(!(r||i||o)||!c||e.isDisabled())&&(r&&l&&(it.default(c,l)||Gt(c,l))?Qt(a,c,l):(i&&s&&(rt.default(c,s)||Gt(c,s))||!(!o||!s||l||!rt.default(c,s)&&!Gt(c,s)))&&Qt(a,s,c))})),bt(Zt(e),"isSelectingRangeStart",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,a=n.day,r=n.startDate,i=n.selectsStart,o=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Kt(a,i?o:r)})),bt(Zt(e),"isSelectingRangeEnd",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,a=n.day,r=n.endDate,i=n.selectsEnd,o=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Kt(a,i?o:r)})),bt(Zt(e),"isRangeStart",(function(){var t=e.props,n=t.day,a=t.startDate,r=t.endDate;return!(!a||!r)&&Kt(a,n)})),bt(Zt(e),"isRangeEnd",(function(){var t=e.props,n=t.day,a=t.startDate,r=t.endDate;return!(!a||!r)&&Kt(r,n)})),bt(Zt(e),"isWeekend",(function(){var t=Ne.default(e.props.day);return 0===t||6===t})),bt(Zt(e),"isOutsideMonth",(function(){return void 0!==e.props.month&&e.props.month!==Re.default(e.props.day)})),bt(Zt(e),"getClassNames",(function(t){var n=e.props.dayClassName?e.props.dayClassName(t):void 0;return pe.default("react-datepicker__day",n,"react-datepicker__day--"+$t(e.props.day),{"react-datepicker__day--disabled":e.isDisabled(),"react-datepicker__day--excluded":e.isExcluded(),"react-datepicker__day--selected":e.isSameDay(e.props.selected),"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.isSameDay(Ot()),"react-datepicker__day--weekend":e.isWeekend(),"react-datepicker__day--outside-month":e.isOutsideMonth()},e.getHighLightedClass("react-datepicker__day--highlighted"))})),bt(Zt(e),"getAriaLabel",(function(){var t=e.props,n=t.day,a=t.ariaLabelPrefixWhenEnabled,r=void 0===a?"Choose":a,i=t.ariaLabelPrefixWhenDisabled,o=void 0===i?"Not available":i,s=e.isDisabled()||e.isExcluded()?o:r;return"".concat(s," ").concat(Mt(n,"PPPP",e.props.locale))})),bt(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})),bt(Zt(e),"handleFocusDay",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1;0===e.getTabIndex()&&!t.isInputFocused&&e.isSameDay(e.props.preSelection)&&(document.activeElement&&document.activeElement!==document.body||(n=!0),e.props.inline&&!e.props.shouldFocusDayInline&&(n=!1),e.props.containerRef&&e.props.containerRef.current&&e.props.containerRef.current.contains(document.activeElement)&&document.activeElement.classList.contains("react-datepicker__day")&&(n=!0)),n&&e.dayEl.current.focus({preventScroll:!0})})),bt(Zt(e),"renderDayContents",(function(){if(e.isOutsideMonth()){if(e.props.monthShowsDuplicateDaysEnd&&De.default(e.props.day)<10)return null;if(e.props.monthShowsDuplicateDaysStart&&De.default(e.props.day)>20)return null}return e.props.renderDayContents?e.props.renderDayContents(De.default(e.props.day),e.props.day):De.default(e.props.day)})),bt(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()},e.renderDayContents())})),e}return vt(n,[{key:"componentDidMount",value:function(){this.handleFocusDay()}},{key:"componentDidUpdate",value:function(e){this.handleFocusDay(e)}}]),n}(de.default.Component),An=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 bt(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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n)})),bt(Zt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),bt(Zt(e),"handleWeekClick",(function(t,n,a){"function"==typeof e.props.onWeekSelect&&e.props.onWeekSelect(t,n,a),e.props.shouldCloseOnSelect&&e.props.setOpen(!1)})),bt(Zt(e),"formatWeekNumber",(function(t){return e.props.formatWeekNumber?e.props.formatWeekNumber(t):qt(t)})),bt(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(An,{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=be.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,includeDates:e.props.includeDates,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,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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"MONTH_REFS",kt(Array(12)).map((function(){return de.default.createRef()}))),bt(Zt(e),"isDisabled",(function(t){return an(t,e.props)})),bt(Zt(e),"isExcluded",(function(t){return rn(t,e.props)})),bt(Zt(e),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n,e.props.orderInDisplay)})),bt(Zt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),bt(Zt(e),"handleMouseLeave",(function(){e.props.onMouseLeave&&e.props.onMouseLeave()})),bt(Zt(e),"isRangeStartMonth",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate;return!(!r||!i)&&Ht(qe.default(a,t),r)})),bt(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)})),bt(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)})),bt(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)})),bt(Zt(e),"isWeekInMonth",(function(t){var n=e.props.day,a=be.default(t,6);return Ht(t,n)||Ht(a,n)})),bt(Zt(e),"renderWeeks",(function(){for(var t=[],n=e.props.fixedHeight,a=0,r=!1,i=jt(Wt(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,includeDates:e.props.includeDates,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,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=ye.default(i,1);var o=n&&a>=6,s=!n&&!e.isWeekInMonth(i);if(o||s){if(!e.props.peekNextMonth)break;r=!0}}return t})),bt(Zt(e),"onMonthClick",(function(t,n){e.handleDayClick(Wt(qe.default(e.props.day,n)),t)})),bt(Zt(e),"handleMonthNavigation",(function(t,n){e.isDisabled(n)||e.isExcluded(n)||(e.props.setPreSelection(n),e.MONTH_REFS[t].current&&e.MONTH_REFS[t].current.focus())})),bt(Zt(e),"onMonthKeyDown",(function(t,n){var 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))}})),bt(Zt(e),"onQuarterClick",(function(t,n){e.handleDayClick(Yt($e.default(e.props.day,n)),t)})),bt(Zt(e),"getMonthClassNames",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate,o=n.selected,s=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":(s||l)&&on(qe.default(a,t),e.props),"react-datepicker__month--selected":Re.default(a)===t&&Pe.default(a)===Pe.default(o),"react-datepicker__month-text--keyboard-selected":Re.default(c)===t,"react-datepicker__month--in-range":sn(r,i,t,a),"react-datepicker__month--range-start":e.isRangeStartMonth(t),"react-datepicker__month--range-end":e.isRangeEndMonth(t)})})),bt(Zt(e),"getTabIndex",(function(t){var n=Re.default(e.props.preSelection);return e.props.disabledKeyboardNavigation||t!==n?"-1":"0"})),bt(Zt(e),"getAriaLabel",(function(t){var n=e.props,a=n.ariaLabelPrefix,r=void 0===a?"Choose":a,i=n.disabledDayAriaLabelPrefix,o=void 0===i?"Not available":i,s=n.day,l=qe.default(s,t),c=e.isDisabled(l)||e.isExcluded(l)?o:r;return"".concat(c," ").concat(Mt(l,"MMMM yyyy"))})),bt(Zt(e),"getQuarterClassNames",(function(t){var n=e.props,a=n.day,r=n.startDate,i=n.endDate,o=n.selected,s=n.minDate,l=n.maxDate;return pe.default("react-datepicker__quarter-text","react-datepicker__quarter-".concat(t),{"react-datepicker__quarter--disabled":(s||l)&&ln($e.default(a,t),e.props),"react-datepicker__quarter--selected":Oe.default(a)===t&&Pe.default(a)===Pe.default(o),"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)})})),bt(Zt(e),"renderMonths",(function(){var t=e.props,n=t.showFullMonthYearPicker,a=t.showTwoColumnMonthYearPicker,r=t.showFourColumnMonthYearPicker,i=t.locale;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)},n?en(t,i):tn(t,i))})))}))})),bt(Zt(e),"renderQuarters",(function(){return de.default.createElement("div",{className:"react-datepicker__quarter-wrapper"},[1,2,3,4].map((function(t,n){return de.default.createElement("div",{key:n,onClick:function(n){e.onQuarterClick(n,t)},className:e.getQuarterClassNames(t)},nn(t,e.props.locale))})))})),bt(Zt(e),"getClassNames",(function(){var t=e.props;t.day;var n=t.selectingDate,a=t.selectsStart,r=t.selectsEnd,i=t.showMonthYearPicker,o=t.showQuarterYearPicker;return pe.default("react-datepicker__month",{"react-datepicker__month--selecting-range":n&&(a||r)},{"react-datepicker__monthPicker":i},{"react-datepicker__quarterPicker":o})})),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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{height:null}),bt(Zt(e),"handleClick",(function(t){(e.props.minTime||e.props.maxTime)&&hn(t,e.props)||(e.props.excludeTimes||e.props.includeTimes||e.props.filterTime)&&mn(t,e.props)||e.props.onChange(t)})),bt(Zt(e),"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.props.selected&&n===Te.default(t)&&a===Ce.default(t)&&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*Te.default(t)+Ce.default(t))%e.props.intervals!=0&&r.push("react-datepicker__time-list-item--injected"),r.join(" ")})),bt(Zt(e),"handleOnKeyDown",(function(t,n){" "===t.key&&(t.preventDefault(),t.key="Enter"),"Enter"===t.key&&e.handleClick(n),e.props.handleOnKeyDown(t)})),bt(Zt(e),"renderTimes",(function(){for(var t=[],n=e.props.format?e.props.format:"p",a=e.props.intervals,r=Ut(Ot(e.props.selected)),i=1440/a,o=e.props.injectTimes&&e.props.injectTimes.sort((function(e,t){return e-t})),s=e.props.selected||e.props.openToDate||Ot(),l=Te.default(s),c=Ce.default(s),u=Fe.default(Ae.default(r,c),l),d=0;d<i;d++){var p=ge.default(r,d*a);if(t.push(p),o){var m=_n(r,p,d,a,o);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"},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);bt($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),bt(Zt(a=t.call(this,e)),"YEAR_REFS",kt(Array(a.props.yearItemNumber)).map((function(){return de.default.createRef()}))),bt(Zt(a),"isDisabled",(function(e){return an(e,a.props)})),bt(Zt(a),"isExcluded",(function(e){return rn(e,a.props)})),bt(Zt(a),"updateFocusOnPaginate",(function(e){var t=function(){this.YEAR_REFS[e].current.focus()}.bind(Zt(a));window.requestAnimationFrame(t)})),bt(Zt(a),"handleYearClick",(function(e,t){a.props.onDayClick&&a.props.onDayClick(e,t)})),bt(Zt(a),"handleYearNavigation",(function(e,t){var n=a.props,r=n.date,i=n.yearItemNumber,o=In(r,i).startPeriod;a.isDisabled(t)||a.isExcluded(t)||(a.props.setPreSelection(t),e-o==-1?a.updateFocusOnPaginate(i-1):e-o===i?a.updateFocusOnPaginate(0):a.YEAR_REFS[e-o].current.focus())})),bt(Zt(a),"isSameDay",(function(e,t){return Kt(e,t)})),bt(Zt(a),"isKeyboardSelected",(function(e){var t=Vt(Ue.default(a.props.date,e));return!a.props.disabledKeyboardNavigation&&!a.props.inline&&!Kt(t,Vt(a.props.selected))&&Kt(t,Vt(a.props.preSelection))})),bt(Zt(a),"onYearClick",(function(e,t){var n=a.props.date;a.handleYearClick(Vt(Ue.default(n,t)),e)})),bt(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,Ee.default(a.props.preSelection,1));break;case"ArrowLeft":a.handleYearNavigation(t-1,Se.default(a.props.preSelection,1))}})),bt(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===Pe.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":e===Pe.default(Ot())})})),bt(Zt(a),"getYearTabIndex",(function(e){return a.props.disabledKeyboardNavigation?"-1":e===Pe.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,o=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},n))},s=r;s<=i;s++)o(s);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),bt(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)})),bt(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 Wn(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",yt({className:"react-datepicker__triangle"},i)),n)}var Vn=["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),bt(Zt(a=t.call(this,e)),"handleClickOutside",(function(e){a.props.onClickOutside(e)})),bt(Zt(a),"setClickOutsideRef",(function(){return a.containerRef.current})),bt(Zt(a),"handleDropdownFocus",(function(e){(function(){var e=((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).className||"").split(/\s+/);return Vn.some((function(t){return e.indexOf(t)>=0}))})(e.target)&&a.props.onDropdownFocus()})),bt(Zt(a),"getDateInView",(function(){var e=a.props,t=e.preSelection,n=e.selected,r=e.openToDate,i=yn(a.props),o=wn(a.props),s=Ot();return r||n||t||(i&&it.default(s,i)?i:o&&rt.default(s,o)?o:s)})),bt(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)}))})),bt(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)}))})),bt(Zt(a),"handleDayClick",(function(e,t,n){a.props.onSelect(e,t,n),a.props.setPreSelection&&a.props.setPreSelection(e)})),bt(Zt(a),"handleDayMouseEnter",(function(e){a.setState({selectingDate:e}),a.props.onDayMouseEnter&&a.props.onDayMouseEnter(e)})),bt(Zt(a),"handleMonthMouseLeave",(function(){a.setState({selectingDate:null}),a.props.onMonthMouseLeave&&a.props.onMonthMouseLeave()})),bt(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)})),bt(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)})),bt(Zt(a),"handleMonthYearChange",(function(e){a.handleYearChange(e),a.handleMonthChange(e)})),bt(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)}))})),bt(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)}))})),bt(Zt(a),"changeMonthYear",(function(e){a.setState((function(t){var n=t.date;return{date:Ue.default(qe.default(n,Re.default(e)),Pe.default(e))}}),(function(){return a.handleMonthYearChange(a.state.date)}))})),bt(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=be.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)})))})),bt(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)})),bt(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)}))})),bt(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(Vt(Se.default(e,r)),r).endPeriod,o=n&&Pe.default(n);return o&&o>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,o=i.previousMonthButtonLabel,s=i.previousYearButtonLabel,l=a.props,c=l.previousMonthAriaLabel,u=void 0===c?"string"==typeof o?o:"Previous Month":c,d=l.previousYearAriaLabel,p=void 0===d?"string"==typeof s?s:"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))}}})),bt(Zt(a),"increaseYear",(function(){a.setState((function(e){var t=e.date;return{date:Ee.default(t,a.props.showYearPicker?a.props.yearItemNumber:1)}}),(function(){return a.handleYearChange(a.state.date)}))})),bt(Zt(a),"renderNextButton",(function(){if(!a.props.renderCustomHeader){var e;switch(!0){case a.props.showMonthYearPicker:e=bn(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(Ee.default(e,r),r).startPeriod,o=n&&Pe.default(n);return o&&o<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,o=i.nextMonthButtonLabel,s=i.nextYearButtonLabel,l=a.props,c=l.nextMonthAriaLabel,u=void 0===c?"string"==typeof o?o:"Next Month":c,d=l.nextYearAriaLabel,p=void 0===d?"string"==typeof s?s:"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))}}})),bt(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))})),bt(Zt(a),"renderYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showYearDropdown&&!e)return de.default.createElement(Tn,{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:Pe.default(a.state.date),scrollableYearDropdown:a.props.scrollableYearDropdown,yearDropdownItemNumber:a.props.yearDropdownItemNumber})})),bt(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})})),bt(Zt(a),"renderMonthYearDropdown",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showMonthYearDropdown&&!e)return de.default.createElement(Ln,{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})})),bt(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)})),bt(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)))})),bt(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),o=vn(a.state.date,a.props),s=bn(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:o,nextYearButtonDisabled:s})),l&&de.default.createElement("div",{className:"react-datepicker__day-names"},a.header(t)))})),bt(Zt(a),"renderYearHeader",(function(){var e=a.state.date,t=a.props,n=t.showYearPicker,r=In(e,t.yearItemNumber),i=r.startPeriod,o=r.endPeriod;return de.default.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},n?"".concat(i," - ").concat(o):Pe.default(e))})),bt(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)}})),bt(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,o=we.default(n,i),s="month-".concat(r),l=r<a.props.monthsShown-1,c=r>0;e.push(de.default.createElement("div",{key:s,ref:function(e){a.monthContainer=e},className:"react-datepicker__month-container"},a.renderHeader({monthDate:o,i:r}),de.default.createElement(qn,{chooseDayAriaLabelPrefix:a.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:a.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:a.props.weekAriaLabelPrefix,onChange:a.changeMonthYear,day:o,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,highlightDates:a.props.highlightDates,selectingDate:a.state.selectingDate,includeDates:a.props.includeDates,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,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}})),bt(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,yt({onDayClick:a.handleDayClick,date:a.state.date},a.props))):void 0})),bt(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})})),bt(Zt(a),"renderInputTimeSection",(function(){var e=new Date(a.props.selected),t=Lt(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||Wn;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=document.getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement("div"),this.portalRoot.setAttribute("id",this.props.portalId),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),bt(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)})),bt(Zt(a),"handleFocusStart",(function(e){var t=a.getTabChildren();t&&t.length>1&&t[t.length-1].focus()})),bt(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,o=t.popperModifiers,s=t.popperPlacement,l=t.popperProps,c=t.targetComponent,u=t.enableTabLoop,d=t.popperOnKeyDown,p=t.portalId;if(!r){var m=pe.default("react-datepicker-popper",n);e=de.default.createElement(ce.Popper,yt({modifiers:o,placement:s},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:m,"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},e));var h=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:h},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),bt(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()})),bt(Zt(a),"calcInitialState",(function(){var e,t=a.getPreSelection(),n=yn(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:En(a.props.highlightDates),focused:!1,shouldFocusDayInline:!1}})),bt(Zt(a),"clearPreventFocusTimeout",(function(){a.preventFocusTimeout&&clearTimeout(a.preventFocusTimeout)})),bt(Zt(a),"setFocus",(function(){a.input&&a.input.focus&&a.input.focus({preventScroll:!0})})),bt(Zt(a),"setBlur",(function(){a.input&&a.input.blur&&a.input.blur(),a.cancelFocusInput()})),bt(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})}))}))})),bt(Zt(a),"inputOk",(function(){return me.default(a.state.preSelection)})),bt(Zt(a),"isCalendarOpen",(function(){return void 0===a.props.open?a.state.open&&!a.props.disabled&&!a.props.readOnly:a.props.open})),bt(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})})),bt(Zt(a),"cancelFocusInput",(function(){clearTimeout(a.inputFocusTimeout),a.inputFocusTimeout=null})),bt(Zt(a),"deferFocusInput",(function(){a.cancelFocusInput(),a.inputFocusTimeout=setTimeout((function(){return a.setFocus()}),1)})),bt(Zt(a),"handleDropdownFocus",(function(){a.cancelFocusInput()})),bt(Zt(a),"handleBlur",(function(e){(!a.state.open||a.props.withPortal||a.props.showTimeInput)&&a.props.onBlur(e),a.setState({focused:!1})})),bt(Zt(a),"handleCalendarClickOutside",(function(e){a.props.inline||a.setOpen(!1),a.props.onClickOutside(e),a.props.withPortal&&e.preventDefault()})),bt(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=Pt(r.target.value,a.props.dateFormat,a.props.locale,a.props.strictParsing,a.props.minDate);!i&&r.target.value||a.setSelected(i,r,!0)}})),bt(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,o=r.endDate;!i||o||it.default(e,i)||a.setOpen(!1)}})),bt(Zt(a),"setSelected",(function(e,t,n,r){var i=e;if(null===i||!an(i,a.props)){var o=a.props,s=o.onChange,l=o.selectsRange,c=o.startDate,u=o.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:Te.default(a.props.selected),minute:Ce.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)?s([i,null],t):s([c,i],t)):s([i,null],t),d&&s([i,null],t)}else s(i,t);n||(a.props.onSelect(i,t),a.setState({inputValue:null}))}})),bt(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 o=He.default(a.props.minDate);r=rt.default(e,o)||Gt(i,o)}else if(n){var s=Xe.default(a.props.maxDate);r=it.default(e,s)||Gt(i,s)}}r&&a.setState({preSelection:e})})),bt(Zt(a),"handleTimeChange",(function(e){var t=Ft(a.props.selected?a.props.selected:a.getPreSelection(),{hour:Te.default(e),minute:Ce.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})})),bt(Zt(a),"onInputClick",(function(){a.props.disabled||a.props.readOnly||a.setOpen(!0),a.props.onInputClick()})),bt(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()})),bt(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=_e.default(n,1);break;case"ArrowRight":r=be.default(n,1);break;case"ArrowUp":r=Ze.default(n,1);break;case"ArrowDown":r=ye.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=Ee.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),o=Re.default(r),s=Pe.default(n),l=Pe.default(r);i!==o||s!==l?a.setState({shouldFocusDayInline:!0}):a.setState({shouldFocusDayInline:!1})}}})),bt(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})}))})))})),bt(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})})),bt(Zt(a),"clear",(function(){a.onClearClick()})),bt(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)})),bt(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,filterDate:a.props.filterDate,onClickOutside:a.handleCalendarClickOutside,formatWeekNumber:a.props.formatWeekNumber,highlightDates:a.state.highlightDates,includeDates:a.props.includeDates,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,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})),bt(Zt(a),"renderDateInput",(function(){var e,t=pe.default(a.props.className,bt({},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=At(e,n),r=t?At(t,n):"";return"".concat(a," - ").concat(r)}(a.props.startDate,a.props.endDate,a.props):At(a.props.selected,a.props);return de.default.cloneElement(n,(bt(e={},r,(function(e){a.input=e})),bt(e,"value",i),bt(e,"onBlur",a.handleBlur),bt(e,"onChange",a.handleChange),bt(e,"onClick",a.onInputClick),bt(e,"onFocus",a.handleFocus),bt(e,"onKeyDown",a.onInputKeyDown),bt(e,"id",a.props.id),bt(e,"name",a.props.name),bt(e,"autoFocus",a.props.autoFocus),bt(e,"placeholder",a.props.placeholderText),bt(e,"disabled",a.props.disabled),bt(e,"autoComplete",a.props.autoComplete),bt(e,"className",pe.default(n.props.className,t)),bt(e,"title",a.props.title),bt(e,"readOnly",a.props.readOnly),bt(e,"required",a.props.required),bt(e,"tabIndex",a.props.tabIndex),bt(e,"aria-describedby",a.props.ariaDescribedBy),bt(e,"aria-invalid",a.props.ariaInvalid),bt(e,"aria-labelledby",a.props.ariaLabelledBy),bt(e,"aria-required",a.props.ariaRequired),e))})),bt(Zt(a),"renderClearButton",(function(){var e=a.props,t=e.isClearable,n=e.selected,r=e.startDate,i=e.endDate,o=e.clearButtonTitle,s=e.clearButtonClassName,l=void 0===s?"":s,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:o,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)||Pe.default(n)!==Pe.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:En(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},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,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,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=Wn,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(16277),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(85455))},38698:function(e,t,n){"use strict";var a=n(27418),r=n(45993);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=60106,s=60107,l=60108,c=60114,u=60109,d=60110,p=60112,m=60113,h=60120,f=60115,g=60116,v=60121,b=60117,y=60119,w=60129,E=60131;if("function"==typeof Symbol&&Symbol.for){var _=Symbol.for;o=_("react.portal"),s=_("react.fragment"),l=_("react.strict_mode"),c=_("react.profiler"),u=_("react.provider"),d=_("react.context"),p=_("react.forward_ref"),m=_("react.suspense"),h=_("react.suspense_list"),f=_("react.memo"),g=_("react.lazy"),v=_("react.block"),b=_("react.fundamental"),y=_("react.scope"),w=_("react.debug_trace_mode"),E=_("react.legacy_hidden")}function Z(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case s:return"Fragment";case o:return"Portal";case c:return"Profiler";case l:return"StrictMode";case m:return"Suspense";case h:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case d:return(e.displayName||"Context")+".Consumer";case u:return(e._context.displayName||"Context")+".Provider";case p:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case f:return Z(e.type);case v:return Z(e._render);case g:t=e._payload,e=e._init;try{return Z(e(t))}catch(e){}}return null}var I=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,S={};function k(e,t){for(var n=0|e._threadCount;n<=t;n++)e[n]=e._currentValue2,e._threadCount=n+1}for(var C=new Uint16Array(16),T=0;15>T;T++)C[T]=T+1;C[15]=0;var N=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,D=Object.prototype.hasOwnProperty,x={},R={};function O(e){return!!D.call(R,e)||!D.call(x,e)&&(N.test(e)?R[e]=!0:(x[e]=!0,!1))}function P(e,t,n,a,r,i,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=a,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var L={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){L[e]=new P(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];L[t]=new P(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){L[e]=new P(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){L[e]=new P(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){L[e]=new P(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){L[e]=new P(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){L[e]=new P(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){L[e]=new P(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){L[e]=new P(e,5,!1,e.toLowerCase(),null,!1,!1)}));var M=/[\-:]([a-z])/g;function A(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(M,A);L[t]=new P(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(M,A);L[t]=new P(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(M,A);L[t]=new P(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){L[e]=new P(e,1,!1,e.toLowerCase(),null,!1,!1)})),L.xlinkHref=new P("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){L[e]=new P(e,1,!1,e.toLowerCase(),null,!0,!0)}));var F=/["'&<>]/;function q(e){if("boolean"==typeof e||"number"==typeof e)return""+e;e=""+e;var t=F.exec(e);if(t){var n,a="",r=0;for(n=t.index;n<e.length;n++){switch(e.charCodeAt(n)){case 34:t="&quot;";break;case 38:t="&amp;";break;case 39:t="&#x27;";break;case 60:t="&lt;";break;case 62:t="&gt;";break;default:continue}r!==n&&(a+=e.substring(r,n)),r=n+1,a+=t}e=r!==n?a+e.substring(r,n):a}return e}function $(e,t){var n,a=L.hasOwnProperty(e)?L[e]:null;return(n="style"!==e)&&(n=null!==a?0===a.type:2<e.length&&("o"===e[0]||"O"===e[0])&&("n"===e[1]||"N"===e[1])),n||function(e,t,n,a){if(null==t||function(e,t,n,a){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e;default:return!1}}(e,t,n))return!0;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(e,t,a)?"":null!==a?(e=a.attributeName,3===(n=a.type)||4===n&&!0===t?e+'=""':(a.sanitizeURL&&(t=""+t),e+'="'+q(t)+'"')):O(e)?e+'="'+q(t)+'"':""}var U="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},j=null,W=null,V=null,Y=!1,B=!1,H=null,z=0;function K(){if(null===j)throw Error(i(321));return j}function G(){if(0<z)throw Error(i(312));return{memoizedState:null,queue:null,next:null}}function Q(){return null===V?null===W?(Y=!1,W=V=G()):(Y=!0,V=W):null===V.next?(Y=!1,V=V.next=G()):(Y=!0,V=V.next),V}function X(e,t,n,a){for(;B;)B=!1,z+=1,V=null,n=e(t,a);return J(),n}function J(){j=null,B=!1,W=null,z=0,V=H=null}function ee(e,t){return"function"==typeof t?t(e):t}function te(e,t,n){if(j=K(),V=Q(),Y){var a=V.queue;if(t=a.dispatch,null!==H&&void 0!==(n=H.get(a))){H.delete(a),a=V.memoizedState;do{a=e(a,n.action),n=n.next}while(null!==n);return V.memoizedState=a,[a,t]}return[V.memoizedState,t]}return e=e===ee?"function"==typeof t?t():t:void 0!==n?n(t):t,V.memoizedState=e,e=(e=V.queue={last:null,dispatch:null}).dispatch=ae.bind(null,j,e),[V.memoizedState,e]}function ne(e,t){if(j=K(),t=void 0===t?null:t,null!==(V=Q())){var n=V.memoizedState;if(null!==n&&null!==t){var a=n[1];e:if(null===a)a=!1;else{for(var r=0;r<a.length&&r<t.length;r++)if(!U(t[r],a[r])){a=!1;break e}a=!0}if(a)return n[0]}}return e=e(),V.memoizedState=[e,t],e}function ae(e,t,n){if(!(25>z))throw Error(i(301));if(e===j)if(B=!0,e={action:n,next:null},null===H&&(H=new Map),void 0===(n=H.get(t)))H.set(t,e);else{for(t=n;null!==t.next;)t=t.next;t.next=e}}function re(){}var ie=null,oe={readContext:function(e){var t=ie.threadID;return k(e,t),e[t]},useContext:function(e){K();var t=ie.threadID;return k(e,t),e[t]},useMemo:ne,useReducer:te,useRef:function(e){j=K();var t=(V=Q()).memoizedState;return null===t?(e={current:e},V.memoizedState=e):t},useState:function(e){return te(ee,e)},useLayoutEffect:function(){},useCallback:function(e,t){return ne((function(){return e}),t)},useImperativeHandle:re,useEffect:re,useDebugValue:re,useDeferredValue:function(e){return K(),e},useTransition:function(){return K(),[function(e){e()},!1]},useOpaqueIdentifier:function(){return(ie.identifierPrefix||"")+"R:"+(ie.uniqueID++).toString(36)},useMutableSource:function(e,t){return K(),t(e._source)}},se="http://www.w3.org/1999/xhtml";function le(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}var ce={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},ue=a({menuitem:!0},ce),de={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},pe=["Webkit","ms","Moz","O"];Object.keys(de).forEach((function(e){pe.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),de[t]=de[e]}))}));var me=/([A-Z])/g,he=/^ms-/,fe=r.Children.toArray,ge=I.ReactCurrentDispatcher,ve={listing:!0,pre:!0,textarea:!0},be=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,ye={},we={},Ee=Object.prototype.hasOwnProperty,_e={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null};function Ze(e,t){if(void 0===e)throw Error(i(152,Z(t)||"Component"))}var Ie=function(){function e(e,t,n){r.isValidElement(e)?e.type!==s?e=[e]:(e=e.props.children,e=r.isValidElement(e)?[e]:fe(e)):e=fe(e),e={type:null,domNamespace:se,children:e,childIndex:0,context:S,footer:""};var a=C[0];if(0===a){var o=C,l=2*(a=o.length);if(!(65536>=l))throw Error(i(304));var c=new Uint16Array(l);for(c.set(o),(C=c)[0]=a+1,o=a;o<l-1;o++)C[o]=o+1;C[l-1]=0}else C[0]=C[a];this.threadID=a,this.stack=[e],this.exhausted=!1,this.currentSelectValue=null,this.previousWasTextNode=!1,this.makeStaticMarkup=t,this.suspenseDepth=0,this.contextIndex=-1,this.contextStack=[],this.contextValueStack=[],this.uniqueID=0,this.identifierPrefix=n&&n.identifierPrefix||""}var t=e.prototype;return t.destroy=function(){if(!this.exhausted){this.exhausted=!0,this.clearProviders();var e=this.threadID;C[e]=C[0],C[0]=e}},t.pushProvider=function(e){var t=++this.contextIndex,n=e.type._context,a=this.threadID;k(n,a);var r=n[a];this.contextStack[t]=n,this.contextValueStack[t]=r,n[a]=e.props.value},t.popProvider=function(){var e=this.contextIndex,t=this.contextStack[e],n=this.contextValueStack[e];this.contextStack[e]=null,this.contextValueStack[e]=null,this.contextIndex--,t[this.threadID]=n},t.clearProviders=function(){for(var e=this.contextIndex;0<=e;e--)this.contextStack[e][this.threadID]=this.contextValueStack[e]},t.read=function(e){if(this.exhausted)return null;var t=ie;ie=this;var n=ge.current;ge.current=oe;try{for(var a=[""],r=!1;a[0].length<e;){if(0===this.stack.length){this.exhausted=!0;var o=this.threadID;C[o]=C[0],C[0]=o;break}var s=this.stack[this.stack.length-1];if(r||s.childIndex>=s.children.length){var l=s.footer;if(""!==l&&(this.previousWasTextNode=!1),this.stack.pop(),"select"===s.type)this.currentSelectValue=null;else if(null!=s.type&&null!=s.type.type&&s.type.type.$$typeof===u)this.popProvider(s.type);else if(s.type===m){this.suspenseDepth--;var c=a.pop();if(r){r=!1;var d=s.fallbackFrame;if(!d)throw Error(i(303));this.stack.push(d),a[this.suspenseDepth]+="\x3c!--$!--\x3e";continue}a[this.suspenseDepth]+=c}a[this.suspenseDepth]+=l}else{var p=s.children[s.childIndex++],h="";try{h+=this.render(p,s.context,s.domNamespace)}catch(e){if(null!=e&&"function"==typeof e.then)throw Error(i(294));throw e}a.length<=this.suspenseDepth&&a.push(""),a[this.suspenseDepth]+=h}}return a[0]}finally{ge.current=n,ie=t,J()}},t.render=function(e,t,n){if("string"==typeof e||"number"==typeof e)return""==(n=""+e)?"":this.makeStaticMarkup?q(n):this.previousWasTextNode?"\x3c!-- --\x3e"+q(n):(this.previousWasTextNode=!0,q(n));if(e=(t=function(e,t,n){function o(r,o){var s=o.prototype&&o.prototype.isReactComponent,l=function(e,t,n,a){if(a&&"object"==typeof(a=e.contextType)&&null!==a)return k(a,n),a[n];if(e=e.contextTypes){for(var r in n={},e)n[r]=t[r];t=n}else t=S;return t}(o,t,n,s),c=[],u=!1,d={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===c)return null},enqueueReplaceState:function(e,t){u=!0,c=[t]},enqueueSetState:function(e,t){if(null===c)return null;c.push(t)}};if(s){if(s=new o(r.props,l,d),"function"==typeof o.getDerivedStateFromProps){var p=o.getDerivedStateFromProps.call(null,r.props,s.state);null!=p&&(s.state=a({},s.state,p))}}else if(j={},s=o(r.props,l,d),null==(s=X(o,r.props,s,l))||null==s.render)return void Ze(e=s,o);if(s.props=r.props,s.context=l,s.updater=d,void 0===(d=s.state)&&(s.state=d=null),"function"==typeof s.UNSAFE_componentWillMount||"function"==typeof s.componentWillMount)if("function"==typeof s.componentWillMount&&"function"!=typeof o.getDerivedStateFromProps&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&"function"!=typeof o.getDerivedStateFromProps&&s.UNSAFE_componentWillMount(),c.length){d=c;var m=u;if(c=null,u=!1,m&&1===d.length)s.state=d[0];else{p=m?d[0]:s.state;var h=!0;for(m=m?1:0;m<d.length;m++){var f=d[m];null!=(f="function"==typeof f?f.call(s,p,r.props,l):f)&&(h?(h=!1,p=a({},p,f)):a(p,f))}s.state=p}}else c=null;if(Ze(e=s.render(),o),"function"==typeof s.getChildContext&&"object"==typeof(r=o.childContextTypes)){var g=s.getChildContext();for(var v in g)if(!(v in r))throw Error(i(108,Z(o)||"Unknown",v))}g&&(t=a({},t,g))}for(;r.isValidElement(e);){var s=e,l=s.type;if("function"!=typeof l)break;o(s,l)}return{child:e,context:t}}(e,t,this.threadID)).child,t=t.context,null===e||!1===e)return"";if(!r.isValidElement(e)){if(null!=e&&null!=e.$$typeof){if((n=e.$$typeof)===o)throw Error(i(257));throw Error(i(258,n.toString()))}return e=fe(e),this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),""}var v=e.type;if("string"==typeof v)return this.renderDOM(e,t,n);switch(v){case E:case w:case l:case c:case h:case s:return e=fe(e.props.children),this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),"";case m:throw Error(i(294));case y:throw Error(i(343))}if("object"==typeof v&&null!==v)switch(v.$$typeof){case p:j={};var _=v.render(e.props,e.ref);return _=X(v.render,e.props,_,e.ref),_=fe(_),this.stack.push({type:null,domNamespace:n,children:_,childIndex:0,context:t,footer:""}),"";case f:return e=[r.createElement(v.type,a({ref:e.ref},e.props))],this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),"";case u:return n={type:e,domNamespace:n,children:v=fe(e.props.children),childIndex:0,context:t,footer:""},this.pushProvider(e),this.stack.push(n),"";case d:v=e.type,_=e.props;var I=this.threadID;return k(v,I),v=fe(_.children(v[I])),this.stack.push({type:e,domNamespace:n,children:v,childIndex:0,context:t,footer:""}),"";case b:throw Error(i(338));case g:return v=(_=(v=e.type)._init)(v._payload),e=[r.createElement(v,a({ref:e.ref},e.props))],this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),""}throw Error(i(130,null==v?v:typeof v,""))},t.renderDOM=function(e,t,n){var o=e.type.toLowerCase();if(n===se&&le(o),!ye.hasOwnProperty(o)){if(!be.test(o))throw Error(i(65,o));ye[o]=!0}var s=e.props;if("input"===o)s=a({type:void 0},s,{defaultChecked:void 0,defaultValue:void 0,value:null!=s.value?s.value:s.defaultValue,checked:null!=s.checked?s.checked:s.defaultChecked});else if("textarea"===o){var l=s.value;if(null==l){l=s.defaultValue;var c=s.children;if(null!=c){if(null!=l)throw Error(i(92));if(Array.isArray(c)){if(!(1>=c.length))throw Error(i(93));c=c[0]}l=""+c}null==l&&(l="")}s=a({},s,{value:void 0,children:""+l})}else if("select"===o)this.currentSelectValue=null!=s.value?s.value:s.defaultValue,s=a({},s,{value:void 0});else if("option"===o){c=this.currentSelectValue;var u=function(e){if(null==e)return e;var t="";return r.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(s.children);if(null!=c){var d=null!=s.value?s.value+"":u;if(l=!1,Array.isArray(c)){for(var p=0;p<c.length;p++)if(""+c[p]===d){l=!0;break}}else l=""+c===d;s=a({selected:void 0,children:void 0},s,{selected:l,children:u})}}if(l=s){if(ue[o]&&(null!=l.children||null!=l.dangerouslySetInnerHTML))throw Error(i(137,o));if(null!=l.dangerouslySetInnerHTML){if(null!=l.children)throw Error(i(60));if("object"!=typeof l.dangerouslySetInnerHTML||!("__html"in l.dangerouslySetInnerHTML))throw Error(i(61))}if(null!=l.style&&"object"!=typeof l.style)throw Error(i(62))}l=s,c=this.makeStaticMarkup,u=1===this.stack.length,d="<"+e.type;e:if(-1===o.indexOf("-"))p="string"==typeof l.is;else switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":p=!1;break e;default:p=!0}for(E in l)if(Ee.call(l,E)){var m=l[E];if(null!=m){if("style"===E){var h=void 0,f="",g="";for(h in m)if(m.hasOwnProperty(h)){var v=0===h.indexOf("--"),b=m[h];if(null!=b){if(v)var y=h;else if(y=h,we.hasOwnProperty(y))y=we[y];else{var w=y.replace(me,"-$1").toLowerCase().replace(he,"-ms-");y=we[y]=w}f+=g+y+":",g=h,f+=v=null==b||"boolean"==typeof b||""===b?"":v||"number"!=typeof b||0===b||de.hasOwnProperty(g)&&de[g]?(""+b).trim():b+"px",g=";"}}m=f||null}h=null,p?_e.hasOwnProperty(E)||(h=O(h=E)&&null!=m?h+'="'+q(m)+'"':""):h=$(E,m),h&&(d+=" "+h)}}c||u&&(d+=' data-reactroot=""');var E=d;l="",ce.hasOwnProperty(o)?E+="/>":(E+=">",l="</"+e.type+">");e:{if(null!=(c=s.dangerouslySetInnerHTML)){if(null!=c.__html){c=c.__html;break e}}else if("string"==typeof(c=s.children)||"number"==typeof c){c=q(c);break e}c=null}return null!=c?(s=[],ve.hasOwnProperty(o)&&"\n"===c.charAt(0)&&(E+="\n"),E+=c):s=fe(s.children),e=e.type,n=null==n||"http://www.w3.org/1999/xhtml"===n?le(e):"http://www.w3.org/2000/svg"===n&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":n,this.stack.push({domNamespace:n,type:o,children:s,childIndex:0,context:t,footer:l}),this.previousWasTextNode=!1,E},e}();t.renderToNodeStream=function(){throw Error(i(207))},t.renderToStaticMarkup=function(e,t){e=new Ie(e,!0,t);try{return e.read(1/0)}finally{e.destroy()}},t.renderToStaticNodeStream=function(){throw Error(i(208))},t.renderToString=function(e,t){e=new Ie(e,!1,t);try{return e.read(1/0)}finally{e.destroy()}},t.version="17.0.2"},97762:function(e,t,n){"use strict";e.exports=n(38698)},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,o){if(e===o)return!0;if(e&&o&&"object"==typeof e&&"object"==typeof o){if(e.constructor!==o.constructor)return!1;var s,l,c,u;if(Array.isArray(e)){if((s=e.length)!=o.length)return!1;for(l=s;0!=l--;)if(!i(e[l],o[l]))return!1;return!0}if(n&&e instanceof Map&&o instanceof Map){if(e.size!==o.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!o.has(l.value[0]))return!1;for(u=e.entries();!(l=u.next()).done;)if(!i(l.value[1],o.get(l.value[0])))return!1;return!0}if(a&&e instanceof Set&&o instanceof Set){if(e.size!==o.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!o.has(l.value[0]))return!1;return!0}if(r&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(o)){if((s=e.length)!=o.length)return!1;for(l=s;0!=l--;)if(e[l]!==o[l])return!1;return!0}if(e.constructor===RegExp)return e.source===o.source&&e.flags===o.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===o.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===o.toString();if((s=(c=Object.keys(e)).length)!==Object.keys(o).length)return!1;for(l=s;0!=l--;)if(!Object.prototype.hasOwnProperty.call(o,c[l]))return!1;if(t&&e instanceof Element)return!1;for(l=s;0!=l--;)if(("_owner"!==c[l]&&"__v"!==c[l]&&"__o"!==c[l]||!e.$$typeof)&&!i(e[c[l]],o[c[l]]))return!1;return!0}return e!=e&&o!=o}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 o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(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&&s(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(o(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(o(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}},85455:function(e,t,n){"use strict";n.r(t),n.d(t,{Manager:function(){return o},Popper:function(){return Ce},Reference:function(){return De},usePopper:function(){return Ze}});var a=n(45993),r=a.createContext(),i=a.createContext();function o(e){var t=e.children,n=a.useState(null),o=n[0],s=n[1],l=a.useRef(!1);a.useEffect((function(){return function(){l.current=!0}}),[]);var c=a.useCallback((function(e){l.current||s(e)}),[]);return a.createElement(r.Provider,{value:o},a.createElement(i.Provider,{value:c},t))}var s=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;function p(e){var t=e.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left,x:t.left,y:t.top}}function m(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function h(e){var t=m(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function f(e){return e instanceof m(e).Element||e instanceof Element}function g(e){return e instanceof m(e).HTMLElement||e instanceof HTMLElement}function v(e){return"undefined"!=typeof ShadowRoot&&(e instanceof m(e).ShadowRoot||e instanceof ShadowRoot)}function b(e){return e?(e.nodeName||"").toLowerCase():null}function y(e){return((f(e)?e.ownerDocument:e.document)||window.document).documentElement}function w(e){return p(y(e)).left+h(e).scrollLeft}function E(e){return m(e).getComputedStyle(e)}function _(e){var t=E(e),n=t.overflow,a=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+a)}function Z(e,t,n){void 0===n&&(n=!1);var a,r,i=y(t),o=p(e),s=g(t),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(s||!s&&!n)&&(("body"!==b(t)||_(i))&&(l=(a=t)!==m(a)&&g(a)?{scrollLeft:(r=a).scrollLeft,scrollTop:r.scrollTop}:h(a)),g(t)?((c=p(t)).x+=t.clientLeft,c.y+=t.clientTop):i&&(c.x=w(i))),{x:o.left+l.scrollLeft-c.x,y:o.top+l.scrollTop-c.y,width:o.width,height:o.height}}function I(e){var t=p(e),n=e.offsetWidth,a=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-a)<=1&&(a=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:a}}function S(e){return"html"===b(e)?e:e.assignedSlot||e.parentNode||(v(e)?e.host:null)||y(e)}function k(e){return["html","body","#document"].indexOf(b(e))>=0?e.ownerDocument.body:g(e)&&_(e)?e:k(S(e))}function C(e,t){var n;void 0===t&&(t=[]);var a=k(e),r=a===(null==(n=e.ownerDocument)?void 0:n.body),i=m(a),o=r?[i].concat(i.visualViewport||[],_(a)?a:[]):a,s=t.concat(o);return r?s:s.concat(C(S(o)))}function T(e){return["table","td","th"].indexOf(b(e))>=0}function N(e){return g(e)&&"fixed"!==E(e).position?e.offsetParent:null}function D(e){for(var t=m(e),n=N(e);n&&T(n)&&"static"===E(n).position;)n=N(n);return n&&("html"===b(n)||"body"===b(n)&&"static"===E(n).position)?t:n||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&g(e)&&"fixed"===E(e).position)return null;for(var n=S(e);g(n)&&["html","body"].indexOf(b(n))<0;){var a=E(n);if("none"!==a.transform||"none"!==a.perspective||"paint"===a.contain||-1!==["transform","perspective"].indexOf(a.willChange)||t&&"filter"===a.willChange||t&&a.filter&&"none"!==a.filter)return n;n=n.parentNode}return null}(e)||t}var x="top",R="bottom",O="right",P="left",L="auto",M=[x,R,O,P],A="start",F="end",q="viewport",$="popper",U=M.reduce((function(e,t){return e.concat([t+"-"+A,t+"-"+F])}),[]),j=[].concat(M,[L]).reduce((function(e,t){return e.concat([t,t+"-"+A,t+"-"+F])}),[]),W=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function V(e){var t=new Map,n=new Set,a=[];function r(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var a=t.get(e);a&&r(a)}})),a.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||r(e)})),a}var Y={placement:"bottom",modifiers:[],strategy:"absolute"};function B(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function H(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,a=void 0===n?[]:n,r=t.defaultOptions,i=void 0===r?Y:r;return function(e,t,n){void 0===n&&(n=i);var r,o,s={placement:"bottom",orderedModifiers:[],options:Object.assign({},Y,i),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},l=[],c=!1,u={state:s,setOptions:function(n){d(),s.options=Object.assign({},i,s.options,n),s.scrollParents={reference:f(e)?C(e):e.contextElement?C(e.contextElement):[],popper:C(t)};var r,o,c=function(e){var t=V(e);return W.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}((r=[].concat(a,s.options.modifiers),o=r.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e}),{}),Object.keys(o).map((function(e){return o[e]}))));return s.orderedModifiers=c.filter((function(e){return e.enabled})),s.orderedModifiers.forEach((function(e){var t=e.name,n=e.options,a=void 0===n?{}:n,r=e.effect;if("function"==typeof r){var i=r({state:s,name:t,instance:u,options:a});l.push(i||function(){})}})),u.update()},forceUpdate:function(){if(!c){var e=s.elements,t=e.reference,n=e.popper;if(B(t,n)){s.rects={reference:Z(t,D(n),"fixed"===s.options.strategy),popper:I(n)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach((function(e){return s.modifiersData[e.name]=Object.assign({},e.data)}));for(var a=0;a<s.orderedModifiers.length;a++)if(!0!==s.reset){var r=s.orderedModifiers[a],i=r.fn,o=r.options,l=void 0===o?{}:o,d=r.name;"function"==typeof i&&(s=i({state:s,options:l,name:d,instance:u})||s)}else s.reset=!1,a=-1}}},update:(r=function(){return new Promise((function(e){u.forceUpdate(),e(s)}))},function(){return o||(o=new Promise((function(e){Promise.resolve().then((function(){o=void 0,e(r())}))}))),o}),destroy:function(){d(),c=!0}};if(!B(e,t))return u;function d(){l.forEach((function(e){return e()})),l=[]}return u.setOptions(n).then((function(e){!c&&n.onFirstUpdate&&n.onFirstUpdate(e)})),u}}var z={passive:!0},K={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,a=e.options,r=a.scroll,i=void 0===r||r,o=a.resize,s=void 0===o||o,l=m(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&c.forEach((function(e){e.addEventListener("scroll",n.update,z)})),s&&l.addEventListener("resize",n.update,z),function(){i&&c.forEach((function(e){e.removeEventListener("scroll",n.update,z)})),s&&l.removeEventListener("resize",n.update,z)}},data:{}};function G(e){return e.split("-")[0]}function Q(e){return e.split("-")[1]}function X(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function J(e){var t,n=e.reference,a=e.element,r=e.placement,i=r?G(r):null,o=r?Q(r):null,s=n.x+n.width/2-a.width/2,l=n.y+n.height/2-a.height/2;switch(i){case x:t={x:s,y:n.y-a.height};break;case R:t={x:s,y:n.y+n.height};break;case O:t={x:n.x+n.width,y:l};break;case P:t={x:n.x-a.width,y:l};break;default:t={x:n.x,y:n.y}}var c=i?X(i):null;if(null!=c){var u="y"===c?"height":"width";switch(o){case A:t[c]=t[c]-(n[u]/2-a[u]/2);break;case F:t[c]=t[c]+(n[u]/2-a[u]/2)}}return t}var ee={name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=J({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},te=Math.max,ne=Math.min,ae=Math.round,re={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ie(e){var t,n=e.popper,a=e.popperRect,r=e.placement,i=e.offsets,o=e.position,s=e.gpuAcceleration,l=e.adaptive,c=e.roundOffsets,u=!0===c?function(e){var t=e.x,n=e.y,a=window.devicePixelRatio||1;return{x:ae(ae(t*a)/a)||0,y:ae(ae(n*a)/a)||0}}(i):"function"==typeof c?c(i):i,d=u.x,p=void 0===d?0:d,h=u.y,f=void 0===h?0:h,g=i.hasOwnProperty("x"),v=i.hasOwnProperty("y"),b=P,w=x,_=window;if(l){var Z=D(n),I="clientHeight",S="clientWidth";Z===m(n)&&"static"!==E(Z=y(n)).position&&(I="scrollHeight",S="scrollWidth"),Z=Z,r===x&&(w=R,f-=Z[I]-a.height,f*=s?1:-1),r===P&&(b=O,p-=Z[S]-a.width,p*=s?1:-1)}var k,C=Object.assign({position:o},l&&re);return s?Object.assign({},C,((k={})[w]=v?"0":"",k[b]=g?"0":"",k.transform=(_.devicePixelRatio||1)<2?"translate("+p+"px, "+f+"px)":"translate3d("+p+"px, "+f+"px, 0)",k)):Object.assign({},C,((t={})[w]=v?f+"px":"",t[b]=g?p+"px":"",t.transform="",t))}var oe={left:"right",right:"left",bottom:"top",top:"bottom"};function se(e){return e.replace(/left|right|bottom|top/g,(function(e){return oe[e]}))}var le={start:"end",end:"start"};function ce(e){return e.replace(/start|end/g,(function(e){return le[e]}))}function ue(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&v(n)){var a=t;do{if(a&&e.isSameNode(a))return!0;a=a.parentNode||a.host}while(a)}return!1}function de(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function pe(e,t){return t===q?de(function(e){var t=m(e),n=y(e),a=t.visualViewport,r=n.clientWidth,i=n.clientHeight,o=0,s=0;return a&&(r=a.width,i=a.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(o=a.offsetLeft,s=a.offsetTop)),{width:r,height:i,x:o+w(e),y:s}}(e)):g(t)?function(e){var t=p(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):de(function(e){var t,n=y(e),a=h(e),r=null==(t=e.ownerDocument)?void 0:t.body,i=te(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=te(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),s=-a.scrollLeft+w(e),l=-a.scrollTop;return"rtl"===E(r||n).direction&&(s+=te(n.clientWidth,r?r.clientWidth:0)-i),{width:i,height:o,x:s,y:l}}(y(e)))}function me(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function he(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function fe(e,t){void 0===t&&(t={});var n=t,a=n.placement,r=void 0===a?e.placement:a,i=n.boundary,o=void 0===i?"clippingParents":i,s=n.rootBoundary,l=void 0===s?q:s,c=n.elementContext,u=void 0===c?$:c,d=n.altBoundary,m=void 0!==d&&d,h=n.padding,v=void 0===h?0:h,w=me("number"!=typeof v?v:he(v,M)),_=u===$?"reference":$,Z=e.elements.reference,I=e.rects.popper,k=e.elements[m?_:u],T=function(e,t,n){var a="clippingParents"===t?function(e){var t=C(S(e)),n=["absolute","fixed"].indexOf(E(e).position)>=0&&g(e)?D(e):e;return f(n)?t.filter((function(e){return f(e)&&ue(e,n)&&"body"!==b(e)})):[]}(e):[].concat(t),r=[].concat(a,[n]),i=r[0],o=r.reduce((function(t,n){var a=pe(e,n);return t.top=te(a.top,t.top),t.right=ne(a.right,t.right),t.bottom=ne(a.bottom,t.bottom),t.left=te(a.left,t.left),t}),pe(e,i));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}(f(k)?k:k.contextElement||y(e.elements.popper),o,l),N=p(Z),P=J({reference:N,element:I,strategy:"absolute",placement:r}),L=de(Object.assign({},I,P)),A=u===$?L:N,F={top:T.top-A.top+w.top,bottom:A.bottom-T.bottom+w.bottom,left:T.left-A.left+w.left,right:A.right-T.right+w.right},U=e.modifiersData.offset;if(u===$&&U){var j=U[r];Object.keys(F).forEach((function(e){var t=[O,R].indexOf(e)>=0?1:-1,n=[x,R].indexOf(e)>=0?"y":"x";F[e]+=j[n]*t}))}return F}function ge(e,t,n){return te(e,ne(t,n))}function ve(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function be(e){return[x,O,R,P].some((function(t){return e[t]>=0}))}var ye=H({defaultModifiers:[K,ee,{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,a=n.gpuAcceleration,r=void 0===a||a,i=n.adaptive,o=void 0===i||i,s=n.roundOffsets,l=void 0===s||s,c={placement:G(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,ie(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,ie(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},a=t.attributes[e]||{},r=t.elements[e];g(r)&&b(r)&&(Object.assign(r.style,n),Object.keys(a).forEach((function(e){var t=a[e];!1===t?r.removeAttribute(e):r.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var a=t.elements[e],r=t.attributes[e]||{},i=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});g(a)&&b(a)&&(Object.assign(a.style,i),Object.keys(r).forEach((function(e){a.removeAttribute(e)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,a=e.name,r=n.offset,i=void 0===r?[0,0]:r,o=j.reduce((function(e,n){return e[n]=function(e,t,n){var a=G(e),r=[P,x].indexOf(a)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,o=i[0],s=i[1];return o=o||0,s=(s||0)*r,[P,O].indexOf(a)>=0?{x:s,y:o}:{x:o,y:s}}(n,t.rects,i),e}),{}),s=o[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[a]=o}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,a=e.name;if(!t.modifiersData[a]._skip){for(var r=n.mainAxis,i=void 0===r||r,o=n.altAxis,s=void 0===o||o,l=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,p=n.altBoundary,m=n.flipVariations,h=void 0===m||m,f=n.allowedAutoPlacements,g=t.options.placement,v=G(g),b=l||(v!==g&&h?function(e){if(G(e)===L)return[];var t=se(e);return[ce(e),t,ce(t)]}(g):[se(g)]),y=[g].concat(b).reduce((function(e,n){return e.concat(G(n)===L?function(e,t){void 0===t&&(t={});var n=t,a=n.placement,r=n.boundary,i=n.rootBoundary,o=n.padding,s=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?j:l,u=Q(a),d=u?s?U:U.filter((function(e){return Q(e)===u})):M,p=d.filter((function(e){return c.indexOf(e)>=0}));0===p.length&&(p=d);var m=p.reduce((function(t,n){return t[n]=fe(e,{placement:n,boundary:r,rootBoundary:i,padding:o})[G(n)],t}),{});return Object.keys(m).sort((function(e,t){return m[e]-m[t]}))}(t,{placement:n,boundary:u,rootBoundary:d,padding:c,flipVariations:h,allowedAutoPlacements:f}):n)}),[]),w=t.rects.reference,E=t.rects.popper,_=new Map,Z=!0,I=y[0],S=0;S<y.length;S++){var k=y[S],C=G(k),T=Q(k)===A,N=[x,R].indexOf(C)>=0,D=N?"width":"height",F=fe(t,{placement:k,boundary:u,rootBoundary:d,altBoundary:p,padding:c}),q=N?T?O:P:T?R:x;w[D]>E[D]&&(q=se(q));var $=se(q),W=[];if(i&&W.push(F[C]<=0),s&&W.push(F[q]<=0,F[$]<=0),W.every((function(e){return e}))){I=k,Z=!1;break}_.set(k,W)}if(Z)for(var V=function(e){var t=y.find((function(t){var n=_.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return I=t,"break"},Y=h?3:1;Y>0&&"break"!==V(Y);Y--);t.placement!==I&&(t.modifiersData[a]._skip=!0,t.placement=I,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,a=e.name,r=n.mainAxis,i=void 0===r||r,o=n.altAxis,s=void 0!==o&&o,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,d=n.padding,p=n.tether,m=void 0===p||p,h=n.tetherOffset,f=void 0===h?0:h,g=fe(t,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),v=G(t.placement),b=Q(t.placement),y=!b,w=X(v),E="x"===w?"y":"x",_=t.modifiersData.popperOffsets,Z=t.rects.reference,S=t.rects.popper,k="function"==typeof f?f(Object.assign({},t.rects,{placement:t.placement})):f,C={x:0,y:0};if(_){if(i||s){var T="y"===w?x:P,N="y"===w?R:O,L="y"===w?"height":"width",M=_[w],F=_[w]+g[T],q=_[w]-g[N],$=m?-S[L]/2:0,U=b===A?Z[L]:S[L],j=b===A?-S[L]:-Z[L],W=t.elements.arrow,V=m&&W?I(W):{width:0,height:0},Y=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},B=Y[T],H=Y[N],z=ge(0,Z[L],V[L]),K=y?Z[L]/2-$-z-B-k:U-z-B-k,J=y?-Z[L]/2+$+z+H+k:j+z+H+k,ee=t.elements.arrow&&D(t.elements.arrow),ae=ee?"y"===w?ee.clientTop||0:ee.clientLeft||0:0,re=t.modifiersData.offset?t.modifiersData.offset[t.placement][w]:0,ie=_[w]+K-re-ae,oe=_[w]+J-re;if(i){var se=ge(m?ne(F,ie):F,M,m?te(q,oe):q);_[w]=se,C[w]=se-M}if(s){var le="x"===w?x:P,ce="x"===w?R:O,ue=_[E],de=ue+g[le],pe=ue-g[ce],me=ge(m?ne(de,ie):de,ue,m?te(pe,oe):pe);_[E]=me,C[E]=me-ue}}t.modifiersData[a]=C}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,a=e.name,r=e.options,i=n.elements.arrow,o=n.modifiersData.popperOffsets,s=G(n.placement),l=X(s),c=[P,O].indexOf(s)>=0?"height":"width";if(i&&o){var u=function(e,t){return me("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:he(e,M))}(r.padding,n),d=I(i),p="y"===l?x:P,m="y"===l?R:O,h=n.rects.reference[c]+n.rects.reference[l]-o[l]-n.rects.popper[c],f=o[l]-n.rects.reference[l],g=D(i),v=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,b=h/2-f/2,y=u[p],w=v-d[c]-u[m],E=v/2-d[c]/2+b,_=ge(y,E,w),Z=l;n.modifiersData[a]=((t={})[Z]=_,t.centerOffset=_-E,t)}},effect:function(e){var t=e.state,n=e.options.element,a=void 0===n?"[data-popper-arrow]":n;null!=a&&("string"!=typeof a||(a=t.elements.popper.querySelector(a)))&&ue(t.elements.popper,a)&&(t.elements.arrow=a)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,a=t.rects.reference,r=t.rects.popper,i=t.modifiersData.preventOverflow,o=fe(t,{elementContext:"reference"}),s=fe(t,{altBoundary:!0}),l=ve(o,a),c=ve(s,r,i),u=be(l),d=be(c);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}}]}),we=n(69590),Ee=n.n(we),_e=[],Ze=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||_e},o=a.useState({styles:{popper:{position:i.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),s=o[0],l=o[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"]}}),[]),p=a.useMemo((function(){var e={onFirstUpdate:i.onFirstUpdate,placement:i.placement,strategy:i.strategy,modifiers:[].concat(i.modifiers,[c,{name:"applyStyles",enabled:!1}])};return Ee()(r.current,e)?r.current||e:(r.current=e,e)}),[i.onFirstUpdate,i.placement,i.strategy,i.modifiers,c]),m=a.useRef();return d((function(){m.current&&m.current.setOptions(p)}),[p]),d((function(){if(null!=e&&null!=t){var a=(n.createPopper||ye)(e,t,p);return m.current=a,function(){a.destroy(),m.current=null}}}),[e,t,n.createPopper]),{state:m.current?m.current.state:null,styles:s.styles,attributes:s.attributes,update:m.current?m.current.update:null,forceUpdate:m.current?m.current.forceUpdate:null}},Ie=function(){},Se=function(){return Promise.resolve(null)},ke=[];function Ce(e){var t=e.placement,n=void 0===t?"bottom":t,i=e.strategy,o=void 0===i?"absolute":i,l=e.modifiers,u=void 0===l?ke:l,d=e.referenceElement,p=e.onFirstUpdate,m=e.innerRef,h=e.children,f=a.useContext(r),g=a.useState(null),v=g[0],b=g[1],y=a.useState(null),w=y[0],E=y[1];a.useEffect((function(){c(m,v)}),[m,v]);var _=a.useMemo((function(){return{placement:n,strategy:o,onFirstUpdate:p,modifiers:[].concat(u,[{name:"arrow",enabled:null!=w,options:{element:w}}])}}),[n,o,p,u,w]),Z=Ze(d||f,v,_),I=Z.state,S=Z.styles,k=Z.forceUpdate,C=Z.update,T=a.useMemo((function(){return{ref:b,style:S.popper,placement:I?I.placement:n,hasPopperEscaped:I&&I.modifiersData.hide?I.modifiersData.hide.hasPopperEscaped:null,isReferenceHidden:I&&I.modifiersData.hide?I.modifiersData.hide.isReferenceHidden:null,arrowProps:{style:S.arrow,ref:E},forceUpdate:k||Ie,update:C||Se}}),[b,E,n,I,S,C,k]);return s(h)(T)}var Te=n(42473),Ne=n.n(Te);function De(e){var t=e.children,n=e.innerRef,r=a.useContext(i),o=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(){Ne()(Boolean(r),"`Reference` should not be used outside of a `Manager` component.")}),[r]),s(t)({ref:o})}},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,o;return n&&n.requirejs||(n?r=n:n={},function(e){var t,n,o,s,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,o,s,l,c,d,p,m,f=t&&t.split("/"),g=u.map,v=g&&g["*"]||{};if(e){for(o=(e=e.split("/")).length-1,u.nodeIdCompat&&h.test(e[o])&&(e[o]=e[o].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,s=d;break}if(i)break;!l&&v&&v[a]&&(l=v[a],c=d)}!i&&l&&(i=l,s=c),i&&(n.splice(0,s,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 b(e){return function(t){l[e]=t}}function y(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(e){return e?w(e):[]}function _(e){return function(){return u&&u.config&&u.config[e]||{}}}o=function(e,t){var n,a,r=w(e),i=r[0],o=t[1];return e=r[1],i&&(n=y(i=g(i,o))),i?e=n&&n.normalize?n.normalize(e,(a=o,function(e){return g(e,a)})):g(e,o):(i=(r=w(e=g(e,o)))[0],e=r[1],i&&(n=y(i))),{f:i?i+"!"+e:e,n:e,pr:i,p:n}},s={require:function(e){return v(e)},exports:function(e){var t=l[e];return void 0!==t?t:l[e]={}},module:function(e){return{id:e,uri:"",exports:l[e],config:_(e)}}},t=function(t,n,a,r){var i,u,p,m,h,g,w,_=[],Z=typeof a;if(g=E(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=o(n[h],g)).f))_[h]=s.require(t);else if("exports"===u)_[h]=s.exports(t),w=!0;else if("module"===u)i=_[h]=s.module(t);else if(f(l,u)||f(c,u)||f(d,u))_[h]=y(u);else{if(!m.p)throw new Error(t+" missing "+u);m.p.load(m.n,v(r,!0),b(u),{}),_[h]=l[u]}p=a?a.apply(l[t],_):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 s[a]?s[a](r):y(o(a,E(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 o=0;o<r.length;o++){var s=r[o];i.prototype[s]=e.prototype[s]}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 o 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 s=r[o];a.setAttribute(o,s)}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 o=r.$results.offset().top,s=i.offset().top,l=r.$results.scrollTop()+(s-o);0===a?r.$results.scrollTop(0):s-o<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),o=a.offset().top+a.outerHeight(!1),s=r.$results.scrollTop()+o-i;0===n?r.$results.scrollTop(0):o>i&&r.$results.scrollTop(s)}})),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 o=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",o),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],o=this.selectionContainer(),s=this.display(i,o),l=a+n.generateChars(4)+"-";i.id?l+=i.id:l+=n.generateChars(4),o.find(".select2-selection__choice__display").append(s).attr("id",l);var c=i.title||i.text;c&&o.attr("title",c);var u=this.options.get("translations").get("removeItem"),d=o.find(".select2-selection__choice__remove");d.attr("title",u()),d.attr("aria-label",u()),d.attr("aria-describedby",l),n.StoreData(o[0],"data",i),t.push(o)}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 o={data:r};if(this.trigger("clear",o),o.prevented)this.$element.val(i);else{for(var s=0;s<r.length;s++)if(o={data:r[s]},this.trigger("unselect",o),o.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"),o=e('<button type="button" class="select2-selection__clear" tabindex="-1"><span aria-hidden="true">&times;</span></button>');o.attr("title",i()),o.attr("aria-label",i()),o.attr("aria-describedby",r),n.StoreData(o[0],"data",a),this.$selection.prepend(o),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,o=a.id+"-results",s=a.id+"-container";e.call(this,a,r),i.$search.attr("aria-describedby",s),a.on("open",(function(){i.$search.attr("aria-controls",o),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"],o=["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!==o.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),o=r.matches(e,i);null!==o&&a.push(o)}})),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"),o=[],s=0;s<i.length;s++){var l=n(i[s]),c=this.item(l);o.push(c)}a.children=o}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 o(e){return function(){return n(this).val()==e.id}}for(var s=0;s<e.length;s++){var l=this._normalizeItem(e[s]);if(r.indexOf(l.id)>=0){var c=a.filter(o(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 o=0;o<a.length;o++){var s=a[o],l=this._normalizeItem(s),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 o=r.results,s=0;s<o.length;s++){var l=o[s],c=null!=l.children&&!e({results:l.children},!0);if((l.text||"").toUpperCase()===(t.term||"").toUpperCase()||c)return!i&&(r.data=o,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(o,u)}r.results=o,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")||[],o=n.term,s=0,l=this.createTag||function(e){return{id:e.term,text:e.term}};s<o.length;){var c=o[s];if(-1!==i.indexOf(c)){var u=o.substr(0,s),d=l(e.extend({},n,{term:u}));null!=d?(r(d),o=o.substr(s+1)||"",s=0):s++}else s++}return{term:o}},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,o="resize.select2."+a.id,s="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+" "+o+" "+s,(function(e){r._positionDropdown(),r._resizeDropdown()}))},n.prototype._detachPositioningHandler=function(n,a){var r="scroll.select2."+a.id,i="resize.select2."+a.id,o="orientationchange.select2."+a.id;this.$container.parents().filter(t.hasScroll).off(r),e(window).off(r+" "+i+" "+o)},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 o={height:this.$container.outerHeight(!1)};o.top=i.top,o.bottom=i.top+o.height;var s=this.$dropdown.outerHeight(!1),l=t.scrollTop(),c=t.scrollTop()+t.height(),u=l<i.top-s,d=c>i.bottom+s,p={left:i.left,top:o.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=o.top-h.top-s),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,o,s,l,c,u,d,p,m,h,f,g,v,b,y,w,E,_,Z,I,S,k,C,T,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,b)),u.maximumSelectionLength>0&&(u.dataAdapter=c.Decorate(u.dataAdapter,y)),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,_)),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,E);u.dropdownAdapter=d}0!==u.minimumResultsForSearch&&(u.dropdownAdapter=c.Decorate(u.dropdownAdapter,S)),u.closeOnSelect&&(u.dropdownAdapter=c.Decorate(u.dropdownAdapter,C)),null!=u.dropdownCssClass&&(u.dropdownAdapter=c.Decorate(u.dropdownAdapter,T)),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,o)),null!=u.selectionCssClass&&(u.selectionAdapter=c.Decorate(u.selectionAdapter,s)),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),o=r.children.length-1;o>=0;o--)null==n(a,r.children[o])&&i.children.splice(o,1);return i.children.length>0?i:n(a,i)}var s=t(r.text).toUpperCase(),l=t(a.term).toUpperCase();return s.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"),o=Array.prototype.concat.call(this._resolveLanguage(r),this._resolveLanguage(n),this._resolveLanguage(a),this._resolveLanguage(i));return e.language=o,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,o=t[r];if("string"==typeof o)try{i=u.loadPath(o)}catch(e){try{o=this.defaults.amdLanguageBase+o,i=u.loadPath(o)}catch(e){n&&window.console&&console.warn&&console.warn('Select2: The language file for "'+o+'" could not be automatically loaded. A fallback will be used instead.')}}else i=e.isPlainObject(o)?new u(o):o;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 o=0;o<t[0].attributes.length;o++){var s=t[0].attributes[o].name,l="data-";if(s.substr(0,l.length)==l){var c=s.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 o=this.options.get("dataAdapter");this.dataAdapter=new o(e,this.options);var s=this.render();this._placeContainer(s);var l=this.options.get("selectionAdapter");this.selection=new l(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,s);var c=this.options.get("dropdownAdapter");this.dropdown=new c(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,s);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 o=i.split(";"),s=0,l=o.length;s<l;s+=1){var c=o[s].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],o={prevented:!1,name:e,args:t};if(n.call(this,i,o),o.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})),o=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 o=a.length;o;)e.event.fixHooks[a[--o]]=e.event.mouseHooks;var s=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",s.getLineHeight(this)),e.data(this,"mousewheel-page-height",s.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,o=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),s.settings.normalizeOffset&&this.getBoundingClientRect){var b=this.getBoundingClientRect();h=a.clientX-b.left,f=a.clientY-b.top}return a.deltaX=d,a.deltaY=p,a.deltaFactor=n,a.offsetX=h,a.offsetY=f,a.deltaMode=0,o.unshift(a,l,d,p),t&&clearTimeout(t),t=setTimeout(c,200),(e.event.dispatch||e.event.handle).apply(this,o)}}function c(){n=null}function u(e,t){return s.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"],o):e.exports=o,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,o=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,o)})),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 88029,e(e.s=88029)})),e.O()}]);
assets/dist/js/{admin.55a2a0cf.js.LICENSE.txt → admin.364f67d4.js.LICENSE.txt} RENAMED
File without changes
assets/dist/js/admin.55a2a0cf.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see admin.55a2a0cf.js.LICENSE.txt */
2
- (self.webpackChunkMailPoet3=self.webpackChunkMailPoet3||[]).push([[328],{49868:function(){jQuery.AsyncQueue=function(){var e,t,n,a,r=this,o=[],s=!1;return a=function(){var e=o.shift();e?(e.apply(r,[r]),!1===s&&a()):t&&t.apply(r)},this.onFailure=function(t){e=t},this.onComplete=function(e){t=e},this.add=function(e){return o.push(e),this},this.storeData=function(e){return n=e,this},this.lastCallbackData=function(){return n},this.run=function(){s=!1,a()},this.pause=function(){return s=!0,this},this.failure=function(){if(s=!0,e){var t=[r];for(i=0;i<arguments.length;i++)t.push(arguments[i]);e.apply(r,t)}},this}},28988:function(e,t,n){"use strict";var a={};n.r(a),n.d(a,{canUseWooSubscriptions:function(){return Ts},findFiltersValueForSegment:function(){return As},getAvailableFilters:function(){return Ls},getCustomFieldsList:function(){return xs},getErrors:function(){return Ms},getNewslettersList:function(){return Cs},getProductCategories:function(){return ks},getProducts:function(){return Zs},getSegment:function(){return Rs},getSegmentFilter:function(){return Ps},getSubscriberCount:function(){return Os},getSubscriptionProducts:function(){return Is},getWooCommerceCountries:function(){return Ds},getWooCommerceCurrencySymbol:function(){return Ns},getWordpressRoles:function(){return Ss}});var r={};n.r(r),n.d(r,{handleSave:function(){return Hs},pageLoaded:function(){return Bs},setErrors:function(){return $s},setSegment:function(){return qs},updateSegment:function(){return Us},updateSegmentFilter:function(){return js},updateSegmentFilterFromEvent:function(){return Vs},updateSegmentFromEvent:function(){return Ws},updateSubscriberCount:function(){return Ys}});var i={};n.r(i),n.d(i,{LOAD_SEGMENT:function(){return Ks},SAVE_SEGMENT:function(){return Gs}});var o=n(45993),s=n.n(o),l=n(97846),c=n.n(l),u=n(73727),d=n(5977),p=n(65311),m=n.n(p),h=n(76867),f=n(16277),g=n.n(f),v=n(45697),b=n.n(v),y=n(57744),w=n(57578);const E=({children:e,dimension:t,segments:n,strings:a})=>s().createElement("div",{className:"mailpoet-tags"},e,n&&n.map((e=>s().createElement(w.Z,{key:e.name,dimension:t,variant:"list"},e.name))),a&&a.map((e=>s().createElement(w.Z,{key:e,dimension:t,variant:"list"},e))));E.propTypes={children:b().node,dimension:b().oneOf(["large"]),segments:b().arrayOf(b().shape({name:b().string.isRequired})),strings:b().arrayOf(b().string)};var _=E,Z=n(49593),I=n.n(Z),S=n(57040),k=n(73126),C=n(44845),T=n(59050);n(20454);class N extends s().Component{constructor(e){super(e),(0,C.Z)(this,"getFieldId",(e=>{const t=e||this.props;return t.field.id||t.field.name})),(0,C.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,C.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,C.Z)(this,"getLabel",(e=>void 0!==this.props.field.getLabel?this.props.field.getLabel(e,this.props.item):e.name)),(0,C.Z)(this,"getSearchLabel",(e=>void 0!==this.props.field.getSearchLabel?this.props.field.getSearchLabel(e,this.props.item):null)),(0,C.Z)(this,"getValue",(e=>void 0!==this.props.field.getValue?this.props.field.getValue(e,this.props.item):e.id)),(0,C.Z)(this,"getCount",(e=>void 0!==this.props.field.getCount?this.props.field.getCount(e,this.props.item):null)),(0,C.Z)(this,"getTag",(e=>void 0!==this.props.field.getTag?this.props.field.getTag(e,this.props.item):null)),(0,C.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,C.Z)(this,"resetSelect2",(()=>{this.destroySelect2(),this.setupSelect2()})),(0,C.Z)(this,"destroySelect2",(()=>{this.isSelect2Initialized()&&(m()(`#${this.selectRef.current.id}`).select2("destroy"),this.cleanupAfterSelect2())})),(0,C.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,C.Z)(this,"allowMultipleValues",(()=>!0===this.props.field.multiple)),(0,C.Z)(this,"isSelect2Initialized",(()=>!0===m()(`#${this.selectRef.current.id}`).hasClass("select2-hidden-accessible"))),(0,C.Z)(this,"isSelect2Component",(()=>this.allowMultipleValues()||this.props.field.forceSelect2)),(0,C.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,C.Z)(this,"transformChangedValue",((e,t)=>"function"==typeof this.props.field.transformChangedValue?this.props.field.transformChangedValue.call(this,e,t):e)),(0,C.Z)(this,"insertEmptyOption",(()=>{if(!this.allowMultipleValues())return this.props.field.placeholder?s().createElement("option",{className:"default"}):void 0})),this.selectRef=s().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 s().createElement("option",{key:`option-${e.id}`,className:"default",value:a,title:n},t)}));return s().createElement("div",{className:"mailpoet-form-select mailpoet-form-input"},s().createElement("select",(0,k.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))}}N.propTypes={onValueChange:b().func,field:b().shape({name:b().string.isRequired,values:b().oneOfType([b().object,b().array]),getLabel:b().func,resetSelect2OnUpdate:b().bool,selected:b().func,endpoint:b().string,filter:b().func,getSearchLabel:b().func,getValue:b().func,getCount:b().func,getTag:b().func,placeholder:b().string,remoteQuery:b().object,extendSelect2Options:b().object,multiple:b().bool,forceSelect2:b().bool,transformChangedValue:b().func,disabled:b().bool,validation:b().shape({"data-parsley-required":b().bool,"data-parsley-required-message":b().string,"data-parsley-type":b().string,"data-parsley-errors-container":b().string,maxLength:b().number})}).isRequired,item:b().object,disabled:b().bool,width:b().string},N.defaultProps={onValueChange:function(){},disabled:!1,width:"",item:void 0};var D=N,x=n(27927),R=n.n(x),O=n(38287),P=()=>{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?"https://account.mailpoet.com/upgrade":`https://account.mailpoet.com/?s=${h.Z.subscribersCount+1}`,r=R()(h.Z.I18n.t("youCanDisableWPUsersList"),/\[link](.*?)\[\/link]/g,(e=>s().createElement("a",{key:"goToSegments",href:"?page=mailpoet-segments"},e)));return s().createElement(O.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0},s().createElement("h3",null,t),s().createElement("p",null,n," ",h.Z.I18n.t("youNeedToUpgrade"),"active"===h.Z.wpSegmentState?s().createElement(s().Fragment,null,s().createElement("br",null),r):null),s().createElement("p",null,s().createElement("a",{target:"_blank",rel:"noopener noreferrer",className:"button button-primary",href:a},h.Z.I18n.t("upgradeNow")),e&&s().createElement(s().Fragment,null," ",s().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")))))};const M=({mssKeyInvalid:e,subscribersCount:t})=>e?s().createElement(O.Z,{type:"error",timeout:!1,closable:!1,renderInPlace:!0},s().createElement("h3",null,h.Z.I18n.t("allSendingPausedHeader")),s().createElement("p",null,R()(h.Z.I18n.t("allSendingPausedBody"),/\[link\](.*?)\[\/link\]/g,(e=>s().createElement("a",{href:"?page=mailpoet-settings#premium",key:"check-sending"},e)))),s().createElement("p",null,s().createElement("a",{href:`https://account.mailpoet.com?s=${t}`,className:"button button-primary",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("allSendingPausedLink")))):null;M.propTypes={mssKeyInvalid:b().bool.isRequired,subscribersCount:b().number.isRequired};var L=M;function A({cacheCalculation:e}){const[t,n]=(0,o.useState)(!1),[a,r]=(0,o.useState)([]),i=(new Date).getTime()-new Date(e).getTime(),l=Math.floor(i/1e3/60);return s().createElement("div",{className:"mailpoet-subscribers-cache-notice"},h.Z.I18n.t("subscribersCountWereCalculated")," ",s().createElement("abbr",{title:e},`${String(l)} ${String(h.Z.I18n.t("subscribersMinutesAgo"))}`),s().createElement(y.Z,{className:"mailpoet-subscribers-cache-notice-button",type:"button",variant:"secondary",dimension:"small",onClick:()=>{n(!0),h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"settings",action:"recalculateSubscribersCountsCache"}).done((()=>{window.location.reload()})).fail((e=>{r(e.errors.map((e=>e.message))),n(!1)}))},withSpinner:t},h.Z.I18n.t("recalculateNow")),s().createElement("div",{className:"mailpoet-gap"}),a.length>0&&s().createElement(O.Z,{type:"error"},a.map((e=>s().createElement("p",{key:e},e)))))}A.propTypes={cacheCalculation:b().string.isRequired};var F=n(92155),q=n.n(F);const $=({subscribersInPlan:e,subscribersInPlanLimit:t})=>{if(!1===e)return null;const n=t?s().createElement("b",{key:"subscribers_count"},h.Z.I18n.t("subscribersInPlanCount").replace("%1$d",e.toLocaleString()).replace("%2$d",t.toLocaleString())):s().createElement("b",{key:"subscribers_count"},e);return s().createElement("div",{className:"mailpoet-subscribers-in-plan"},R()(h.Z.I18n.t("subscribersInPlan"),"%s",(()=>n))," ",s().createElement(q(),{tooltip:h.Z.I18n.t("subscribersInPlanTooltip"),place:"right"}),s().createElement("span",{className:"mailpoet-subscribers-in-plan-spacer"}," "))};$.propTypes={subscribersInPlan:b().oneOfType([b().number,b().oneOf([!1])]).isRequired,subscribersInPlanLimit:b().oneOfType([b().number,b().oneOf([!1])]).isRequired};var U=$,j=n(99181),W=s().createElement("svg",{viewBox:"4 4 16 16"},s().createElement("path",{d:"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"}));const V=({location:e})=>s().createElement(s().Fragment,null,s().createElement(j.Q,null,s().createElement(u.rU,{className:"mailpoet-button button-secondary",to:{pathname:"/new",state:{backUrl:null==e?void 0:e.pathname}}},W,s().createElement("span",{"data-automation-id":"add-new-subscribers-button"},h.Z.I18n.t("new"))),s().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")),s().createElement("a",{id:"mailpoet_export_button",className:"mailpoet-button not-small-screen button-secondary",href:"?page=mailpoet-export"},h.Z.I18n.t("export"))));V.propTypes={location:b().object.isRequired};var Y=(0,d.withRouter)(V),B=n(65221);function H({name:e,tooltip:t,tooltipId:n,tooltipPlace:a,type:r,isInverted:i}){return s().createElement("span",null,s().createElement(w.Z,{isInverted:i,variant:r,"data-tip":!0,"data-for":n},e),t&&s().createElement(B.Z,{place:a||"top",multiline:!0,id:n||t.toString()},t))}H.propTypes={name:b().string.isRequired,tooltip:b().oneOfType([b().string,b().node]),tooltipId:b().string,type:b().oneOf(["average","good","excellent","unknown"]),isInverted:b().bool},H.defaultProps={isInverted:!0};var z=H;const K=({id:e,engagementScore:t})=>{const n={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")}},a=`badge-${e}`;let r;r=null==t?n.unknown:t<20?n.average:t<50?n.good:n.excellent;const i=s().createElement("div",{key:`tooltip-${a}`},s().createElement("div",{className:"mailpoet-listing-stats-tooltip-title"},r.tooltipTitle.toUpperCase()),s().createElement("div",{className:"mailpoet-listing-stats-tooltip-description"},h.Z.I18n.t("engagementScoreDescription")),s().createElement("div",{className:"mailpoet-listing-stats-tooltip-content"},s().createElement(z,{type:"unknown",name:h.Z.I18n.t("unknownBadgeName")})," : ",n.unknown.tooltipText,s().createElement("br",null),s().createElement(z,{type:"excellent",name:h.Z.I18n.t("excellentBadgeName")})," : ",n.excellent.tooltipText,s().createElement("br",null),s().createElement(z,{type:"good",name:h.Z.I18n.t("goodBadgeName")})," : ",n.good.tooltipText,s().createElement("br",null),s().createElement(z,{type:"average",name:h.Z.I18n.t("averageBadgeName")})," : ",n.average.tooltipText));return s().createElement("div",{className:"mailpoet-listing-stats-opened-clicked"},null!=t&&s().createElement("div",{className:"mailpoet-listing-stats-percentages"},t.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),"%"),s().createElement("div",null,s().createElement(z,{isInverted:!0,type:r.type,name:r.name,tooltip:i,tooltipId:a,tooltipPlace:"top"})))};K.propTypes={id:b().number.isRequired,engagementScore:b().number};const G=!!window.mailpoet_tracking_enabled,Q=[{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:G},{name:"created_at",label:h.Z.I18n.t("subscribedOn"),sortable:!0}],X={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&&s().createElement("div",null,s().createElement("p",null,h.Z.I18n.t("bouncedSubscribersHelp")),s().createElement("p",null,s().createElement("a",{href:"admin.php?page=mailpoet-premium",className:"button-primary"},h.Z.I18n.t("bouncedSubscribersPremiumButtonText"))))},J=(e,t,n,a)=>s().createElement(S.Z,{title:a,onRequestClose:t,isDismissible:!0},s().createElement(D,{field:n}),s().createElement("span",{className:"mailpoet-gap-half"}),s().createElement(y.Z,{onClick:e,dimension:"small",variant:"secondary"},h.Z.I18n.t("apply"))),ee=[{name:"moveToList",label:h.Z.I18n.t("moveToList"),onSelect:function(e,t){return J(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 J(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 J(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:X.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 s().createElement(S.Z,{title:h.Z.I18n.t("unsubscribe"),onRequestClose:t,isDismissible:!0},s().createElement("p",null,h.Z.I18n.t("unsubscribeConfirm").replace("%s",a.toLocaleString())),s().createElement("span",{className:"mailpoet-gap-half"}),s().createElement(y.Z,{onClick:e,dimension:"small",variant:"secondary",automationId:"bulk-unsubscribe-confirm"},h.Z.I18n.t("apply")))}}],te=[{name:"statistics",label:h.Z.I18n.t("statsListingActionTitle"),link:function(e,t){return s().createElement(u.rU,{to:{pathname:`/stats/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}}},h.Z.I18n.t("statsListingActionTitle"))}},{name:"edit",label:h.Z.I18n.t("edit"),link:function(e,t){return s().createElement(u.rU,{to:{pathname:`/edit/${e.id}`,state:{backUrl:null==t?void 0: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"}],ne=e=>0===Number(e.wp_user_id)&&0===Number(e.is_woocommerce_user),ae=({match:e})=>{const t=(0,d.useLocation)();return s().createElement("div",null,s().createElement(Y,null),s().createElement(U,{subscribersInPlan:h.Z.subscribersCount,subscribersInPlanLimit:h.Z.subscribersLimit}),s().createElement(P,null),s().createElement(L,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),s().createElement(A,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),s().createElement(I(),{limit:window.mailpoet_listing_per_page,location:t,params:e.params,endpoint:"subscribers",onRenderItem:(e,n)=>{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)})),s().createElement("div",null,s().createElement("td",{className:a},s().createElement(u.rU,{className:"mailpoet-listing-title",to:{pathname:`/edit/${e.id}`,state:{backUrl:null==t?void 0:t.pathname}}},e.email),s().createElement("div",{className:"mailpoet-listing-subtitle"},e.first_name," ",e.last_name),n),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},r),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("lists")},s().createElement(_,{segments:i,dimension:"large"})),!0===G?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statisticsColumn")},s().createElement("div",{className:"mailpoet-listing-stats"},s().createElement("a",{key:`stats-link-${e.id}`,href:`#/stats/${e.id}`},s().createElement(K,{id:e.id,engagementScore:e.engagement_score})))):null,s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribedOn")},h.Z.Date.short(e.created_at),s().createElement("br",null),h.Z.Date.time(e.created_at)))},columns:Q,bulk_actions:ee,item_actions:te,messages:X,sort_by:"created_at",sort_order:"desc",isItemDeletable:ne}))};ae.propTypes={match:b().shape({params:b().object}).isRequired};var re=ae,ie=n(30381),oe=n.n(ie),se=n(17123),le=n.n(se),ce=n(60017);class ue extends s().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"),s().createElement(ce.Z,(0,k.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))}}ue.propTypes={onValueChange:b().func,field:b().shape({name:b().string.isRequired,defaultValue:b().string,id:b().string,className:b().string,size:b().oneOfType([b().string,b().number]),disabled:b().func,placeholder:b().string,validation:b().shape({"data-parsley-required":b().bool,"data-parsley-required-message":b().string,"data-parsley-type":b().string,"data-parsley-errors-container":b().string,maxLength:b().number}),customLabel:b().string,tooltip:b().string}).isRequired,item:b().object.isRequired},ue.defaultProps={onValueChange:function(){}};var de=ue,pe=n(97972);const me=e=>s().createElement(pe.Z,(0,k.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));me.propTypes={item:b().object.isRequired,field:b().shape({name:b().string,placeholder:b().string,defaultValue:b().string,validation:b().shape({"data-parsley-required":b().bool,"data-parsley-required-message":b().string,"data-parsley-type":b().string,"data-parsley-errors-container":b().string,maxLength:b().number}),className:b().string,customLabel:b().string,tooltip:b().string}).isRequired,onValueChange:b().func.isRequired};var he=me,fe=n(2141);class ge extends s().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=s().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=>s().createElement("option",{key:`option-${e}`,value:e},this.props.field.values[e])));return s().createElement(fe.Z,(0,k.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)}}ge.propTypes={onValueChange:b().func,field:b().shape({name:b().string.isRequired,values:b().objectOf(b().string),placeholder:b().string,filter:b().func,sortBy:b().func,validation:b().shape({"data-parsley-required":b().bool,"data-parsley-required-message":b().string,"data-parsley-type":b().string,"data-parsley-errors-container":b().string,maxLength:b().number})}).isRequired,item:b().object.isRequired,automationId:b().string},ge.defaultProps={automationId:"",onValueChange:function(){}};var ve=ge,be=n(84868);class ye extends s().Component{constructor(e){super(e),(0,C.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=>s().createElement("p",{key:`radio-${t}`},s().createElement(be.Z,{checked:e===t,value:t,onCheck:this.onValueChange,name:this.props.field.name},this.props.field.values[t]))));return s().createElement("div",null,t)}}ye.propTypes={onValueChange:b().func,field:b().shape({name:b().string.isRequired,values:b().objectOf(b().string)}).isRequired,item:b().object.isRequired},ye.defaultProps={onValueChange:function(){}};var we=ye,Ee=n(89828);class _e extends s().Component{constructor(e){super(e),(0,C.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=>s().createElement("p",{key:`checkbox-${t}`},s().createElement(Ee.Z,{value:"1",checked:e,name:this.props.field.name,onCheck:this.onValueChange},this.props.field.values[t]))));return s().createElement("div",null,t)}}_e.propTypes={onValueChange:b().func.isRequired,field:b().shape({name:b().string.isRequired,values:b().objectOf(b().string)}).isRequired,item:b().object.isRequired};var Ze=_e;function Ie(e){const t=[];void 0!==e.placeholder&&t.push(s().createElement("option",{value:"",key:0},e.placeholder));const n=oe()().year();for(let e=n;e>=n-100;e-=1)t.push(s().createElement("option",{key:e,value:e},e));return s().createElement(fe.Z,{isMinWidth:!0,name:`${e.name}[year]`,value:e.year,onChange:e.onValueChange},t)}function Se(e){const t=[];void 0!==e.placeholder&&t.push(s().createElement("option",{value:"",key:0},e.placeholder));for(let n=1;n<=12;n+=1)t.push(s().createElement("option",{key:n,value:n},e.monthNames[n-1]));return s().createElement(fe.Z,{isMinWidth:!0,name:`${e.name}[month]`,value:e.month,onChange:e.onValueChange},t)}function ke(e){const t=[];void 0!==e.placeholder&&t.push(s().createElement("option",{value:"",key:0},e.placeholder));for(let e=1;e<=31;e+=1)t.push(s().createElement("option",{key:e,value:e},e));return s().createElement(fe.Z,{isMinWidth:!0,name:`${e.name}[day]`,value:e.day,onChange:e.onValueChange},t)}Ie.propTypes={name:b().string.isRequired,placeholder:b().string.isRequired,onValueChange:b().func.isRequired,year:b().oneOfType([b().string,b().number]).isRequired},Se.propTypes={name:b().string.isRequired,placeholder:b().string.isRequired,onValueChange:b().func.isRequired,month:b().oneOfType([b().string,b().number]).isRequired,monthNames:b().arrayOf(b().string).isRequired},ke.propTypes={name:b().string.isRequired,placeholder:b().string.isRequired,onValueChange:b().func.isRequired,day:b().oneOfType([b().string,b().number]).isRequired};class Ce extends s().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=oe()(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 s().createElement(Ie,{onValueChange:this.onValueChange,key:"year",name:this.props.field.name,year:this.state.year,placeholder:this.props.field.year_placeholder});case"MM":return s().createElement(Se,{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 s().createElement(ke,{onValueChange:this.onValueChange,key:"day",name:this.props.field.name,day:this.state.day,placeholder:this.props.field.day_placeholder});default:return s().createElement("div",null,"Invalid date type")}}));return s().createElement("div",null,n)}}Ce.propTypes={item:b().object.isRequired,field:b().shape({name:b().string,day_placeholder:b().string,month_placeholder:b().string,year_placeholder:b().string,params:b().object}).isRequired,onValueChange:b().func.isRequired};var Te=Ce,Ne=n(22529);class De extends s().Component{constructor(...e){super(...e),(0,C.Z)(this,"renderField",(e=>{let t,n=!1;e.field.description&&(n=s().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=s().createElement(de,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"textarea":t=s().createElement(he,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"select":t=s().createElement(ve,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"radio":t=s().createElement(we,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"checkbox":t=s().createElement(Ze,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"selection":t=s().createElement(D,{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=s().createElement(Te,{onValueChange:e.onValueChange,field:e.field,item:e.item,automationId:e.automationId,inline:e.inline,description:e.description});break;case"reactComponent":t=s().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 s().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=s().createElement(Ne.Z,{level:4},s().createElement("label",{htmlFor:`field_${this.props.field.name}`},this.props.field.label)));let n=!1;return this.props.field.tip&&(n=s().createElement("p",{className:"mailpoet-form-description"},this.props.field.tip)),s().createElement("div",{className:`mailpoet-form-field-${this.props.field.name} form-field-row-${this.props.field.name}`},t,n,e)}}De.propTypes={onValueChange:b().func,field:b().shape({name:b().string.isRequired,values:b().objectOf(b().string),tip:b().oneOfType([b().array,b().string]),label:b().string,fields:b().arrayOf(b().object),description:b().string}).isRequired,item:b().object.isRequired},De.defaultProps={onValueChange:function(){}};var xe=De,Re=n(76599);class Oe extends s().Component{constructor(e){super(e),(0,C.Z)(this,"getValues",(()=>this.props.item||this.state.item)),(0,C.Z)(this,"getErrors",(()=>this.props.errors||this.state.errors)),(0,C.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,C.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,C.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=s().createRef(),this.state={loading:!1,errors:[],item:{}}}componentDidMount(){void 0!==this.props.params.id?this.loadItem(this.props.params.id):le()((()=>{this.setState({item:m()(".mailpoet_form").mailpoetSerializeObject()})}))}componentDidUpdate(e){void 0===this.props.params.id&&e.location.pathname!==this.props.location.pathname&&(le()((()=>{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=>s().createElement("div",{className:"mailpoet_notice notice inline error is-dismissible",key:`error-${e.message}`},s().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))),s().createElement(xe,{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:s().createElement(Re.Button,{type:"submit",isDisabled:this.state.loading},h.Z.I18n.t("save")),s().createElement("div",null,s().createElement("div",{className:"mailpoet-form-content-around"},n),s().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,s().createElement("div",{className:"mailpoet-form-grid"},r,s().createElement("div",{className:"mailpoet-form-actions"},i))),s().createElement("div",{className:"mailpoet-form-content-around"},a))}}Oe.propTypes={params:b().shape({id:b().string}),location:b().shape({pathname:b().string}),item:b().object,errors:b().arrayOf(b().object),endpoint:b().string,fields:b().arrayOf(b().object),messages:b().shape({onUpdate:b().func,onCreate:b().func}),loading:b().bool,children:b().array,id:b().string,automationId:b().string,beforeFormContent:b().func,afterFormContent:b().func,onItemLoad:b().func,isValid:b().func,onChange:b().func,onSubmit:b().func,onSuccess:b().func,history:b().shape({push:b().func.isRequired}).isRequired},Oe.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 Pe=(0,d.withRouter)(Oe),Me=n(86529),Le=n(71014);const Ae=[{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=""}Ae.push(t)}));const Fe={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 qe(e){if(Number(e.wp_user_id)>0)return s().createElement("p",{className:"description"},R()(h.Z.I18n.t("WPUserEditNotice"),/\[link\](.*?)\[\/link\]/g,((t,n)=>s().createElement("a",{key:n,href:`user-edit.php?user_id=${e.wp_user_id}`},t))))}function $e(e){var t;return s().createElement(s().Fragment,null,null==e||null===(t=e.unsubscribes)||void 0===t?void 0:t.map((e=>{const t=oe()(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?R()(h.Z.I18n.t("unsubscribedNewsletter").replace("%1$d",t),/\[link\]/g,((t,n)=>s().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),s().createElement("p",{className:"description",key:n},n)})),s().createElement("p",{className:"description"},s().createElement("strong",null,h.Z.I18n.t("tip"))," ",h.Z.I18n.t("customFieldsTip")))}const Ue=({match:e})=>{var t;const n=(0,d.useLocation)(),a=(0,d.useHistory)(),r=(null===(t=n.state)||void 0===t?void 0:t.backUrl)||"/";return s().createElement("div",null,s().createElement(Me.Z,{color:"#fff"}),s().createElement(Le.Z,null),s().createElement(Ne.Z,{level:1,className:"mailpoet-title"},s().createElement("span",null,h.Z.I18n.t("subscriber")),s().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:r},h.Z.I18n.t("backToList"))),s().createElement(P,null),s().createElement(Pe,{automationId:"subscriber_edit_form",endpoint:"subscribers",fields:Ae,params:e.params,messages:Fe,beforeFormContent:qe,afterFormContent:$e,onSuccess:()=>a.push(r)}))};Ue.propTypes={match:b().shape({params:b().shape({id:b().string}).isRequired}).isRequired};var je=Ue,We=n(5830),Ve=n(71304),Ye=({email:e})=>{var t;const n=(null===(t=(0,d.useLocation)().state)||void 0===t?void 0:t.backUrl)||"/";return s().createElement(Ne.Z,{level:1,className:"mailpoet-title"},s().createElement("span",null,h.Z.I18n.t("statsHeading").replace("%s",e)),s().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:n},h.Z.I18n.t("backToList")))},Be=n(83213),He=({totalSent:e,open:t,machineOpen:n,click:a,subscriber:r})=>{let i=0,o=0,l=0,c=0;const u=e-(t+n),d=e>0;return d&&(i=Math.round(t/e*100),o=Math.round(n/e*100),l=Math.round(a/e*100),c=Math.round(u/e*100)),s().createElement("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary"},s().createElement("div",{className:"mailpoet-listing"},s().createElement("table",{className:"mailpoet-listing-table"},s().createElement("tbody",null,s().createElement("tr",null,s().createElement("td",null,h.Z.I18n.t("statsSentEmail")),s().createElement("td",null,s().createElement("b",null,e.toLocaleString())),s().createElement("td",null)),s().createElement("tr",null,s().createElement("td",null,s().createElement(w.Z,null,h.Z.I18n.t("statsOpened"))),s().createElement("td",null,s().createElement("b",null,t.toLocaleString())),s().createElement("td",null,d&&s().createElement(s().Fragment,null,i,"%"))),s().createElement("tr",null,s().createElement("td",null,s().createElement(w.Z,null,h.Z.I18n.t("statsMachineOpened")),s().createElement(Be.default,{tooltip:R()(h.Z.I18n.t("statsMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>s().createElement("span",{style:{pointerEvents:"all"},key:"machine-opened-info"},s().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))))})),s().createElement("td",null,s().createElement("b",null,n.toLocaleString())),s().createElement("td",null,d&&s().createElement(s().Fragment,null,o,"%"))),s().createElement("tr",null,s().createElement("td",null,s().createElement(w.Z,{isInverted:!0},h.Z.I18n.t("statsClicked"))),s().createElement("td",null,s().createElement("b",null,a.toLocaleString())),s().createElement("td",null,d&&s().createElement(s().Fragment,null,l,"%"))),s().createElement("tr",null,s().createElement("td",null,h.Z.I18n.t("statsNotClicked")),s().createElement("td",null,s().createElement("b",null,u.toLocaleString())),s().createElement("td",null,d&&s().createElement(s().Fragment,null,c,"%"))),s().createElement("tr",null,s().createElement("td",null,h.Z.I18n.t("statisticsColumn")),s().createElement("td",null,s().createElement("div",{className:"mailpoet-listing-stats"},s().createElement(K,{id:r.id,engagementScore:r.engagement_score}))),s().createElement("td",null))))))},ze=({revenueValue:e,count:t,averageRevenueValue:n})=>s().createElement("div",{className:"mailpoet-tab-content mailpoet-subscriber-stats-summary"},s().createElement("div",{className:"mailpoet-listing"},s().createElement("table",{className:"mailpoet-listing-table"},s().createElement("tbody",null,s().createElement("tr",null,s().createElement("td",null,"Orders created"),s().createElement("td",null,s().createElement("b",null,t.toLocaleString()))),s().createElement("tr",null,s().createElement("td",null,"Total revenue"),s().createElement("td",null,s().createElement("b",null,e))),s().createElement("tr",null,s().createElement("td",null,"Average revenue"),s().createElement("td",null,s().createElement("b",null,n))))))),Ke=n(68390),Ge=n.n(Ke);const Qe=({title:e})=>s().createElement("span",{className:"mailpoet-badge"},e);Qe.propTypes={title:b().string.isRequired};var Xe=Qe;const Je=({title:e,message:t,actionButton:n})=>s().createElement("div",{className:"mailpoet-premium-required"},s().createElement("div",{className:"mailpoet-premium-required-message"},s().createElement(Ne.Z,{level:5},s().createElement(Xe,{title:"Premium"})," ",e),t),s().createElement("div",{className:"mailpoet-premium-required-button"},n));Je.propTypes={title:b().string.isRequired,message:b().node.isRequired,actionButton:b().node.isRequired};var et=Je;const tt=({limitReached:e,limitValue:t,subscribersCountTowardsLimit:n,premiumActive:a,hasValidApiKey:r,hasPremiumSupport:i})=>s().createElement("table",{className:"mailpoet-listing-table","data-automation-id":"subscriber-stats-no-access"},s().createElement("thead",null,s().createElement("tr",null,s().createElement("th",null,h.Z.I18n.t("email")),s().createElement("th",null,h.Z.I18n.t("columnAction")),s().createElement("th",null,h.Z.I18n.t("columnCount")),s().createElement("th",null,h.Z.I18n.t("columnActionOn")))),s().createElement("tbody",null,s().createElement("tr",null,s().createElement("td",{colSpan:4},s().createElement("div",{className:"mailpoet-subscriber-stats-no-access-content"},s().createElement(et,{title:a&&e?h.Z.I18n.t("upgradeRequired"):h.Z.I18n.t("premiumFeature"),message:(()=>{let e=h.Z.I18n.t("premiumRequired");return a?(e=i?h.Z.I18n.t("planLimitReached"):h.Z.I18n.t("freeLimitReached"),s().createElement("p",null,R()(e,/(\[subscribersCount]|\[subscribersLimit])/g,(e=>"[subscribersCount]"===e?n:t)))):s().createElement("p",null,R()(e,/\[link](.*?)\[\/link]/g,(e=>s().createElement("a",{key:e,href:h.Z.premiumLink},e))))})(),actionButton:a&&e?s().createElement(y.Z,{href:r?h.Z.MailPoetComUrlFactory.getUpgradeUrl():h.Z.MailPoetComUrlFactory.getPurchasePlanUrl(n+1)},h.Z.I18n.t("premiumBannerCtaUpgrade")):s().createElement(y.Z,{href:h.Z.MailPoetComUrlFactory.getFreePlanUrl({utm_medium:"stats",utm_campaign:"signup"})},h.Z.I18n.t("premiumBannerCtaFree"))}))))));tt.propTypes={limitReached:b().bool.isRequired,limitValue:b().number.isRequired,subscribersCountTowardsLimit:b().number.isRequired,premiumActive:b().bool.isRequired,hasValidApiKey:b().bool.isRequired,hasPremiumSupport:b().bool.isRequired};var nt=tt;const at=({params:e,location:t})=>s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:4},h.Z.I18n.t("openedEmailsHeading")),!h.Z.premiumActive||h.Z.subscribersLimitReached?s().createElement(nt,{limitReached:h.Z.subscribersLimitReached,limitValue:h.Z.subscribersLimit,subscribersCountTowardsLimit:h.Z.subscribersCount,premiumActive:h.Z.premiumActive,hasValidApiKey:h.Z.hasValidApiKey,hasPremiumSupport:h.Z.hasPremiumSupport}):Ge().applyFilters("mailpoet_subscribers_opened_emails_stats",e,t));at.propTypes={params:b().shape({id:b().string.isRequired}).isRequired};var rt=at;const it=()=>{const e=(0,d.useRouteMatch)(),t=(0,d.useLocation)(),[n,a]=(0,o.useState)(null),[r,i]=(0,o.useState)(!0),l=(0,Ve.S)(window).notices.error;return(0,o.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(s().createElement(s().Fragment,null,e.errors.map((e=>s().createElement("p",{key:e.message},e.message)))),{scroll:!0})}))}),[e.params.id,l]),r?s().createElement(We.Z,null):s().createElement("div",{className:"mailpoet-subscriber-stats"},s().createElement(Ye,{email:n.email}),s().createElement("p",null,h.Z.I18n.t("lastEngagement"),": ",n.last_engagement?h.Z.Date.format(n.last_engagement):h.Z.I18n.t("never")),s().createElement("div",{className:"mailpoet-subscriber-stats-summary-grid"},s().createElement(He,{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&&s().createElement(ze,{averageRevenueValue:n.woocommerce.formatted_average,count:n.woocommerce.count,revenueValue:n.woocommerce.formatted})),s().createElement(rt,{params:e.params,location:t}))};var ot=n(93726);const st=()=>s().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},s().createElement(u.UT,null,s().createElement(ot.Z,null),s().createElement(d.Switch,null,s().createElement(d.Route,{path:"/new",component:je}),s().createElement(d.Route,{path:"/edit/:id",component:je}),s().createElement(d.Route,{path:"/stats/:id/(.*)?",component:it}),s().createElement(d.Route,{path:"*",component:re})))),lt=document.getElementById("subscribers_container");lt&&c().render(s().createElement(st,null),lt);class ct extends s().PureComponent{render(){const e=this.props.event,t=e.soon;let n;if(this.props.premium)n=s().createElement("a",{href:"?page=mailpoet-premium",target:"_blank"},h.Z.I18n.t("premiumFeatureLink"));else if(e.actionButtonLink&&e.actionButtonTitle)n=s().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=s().createElement(y.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 s().createElement("div",{"data-type":e.slug,className:"mailpoet-newsletter-type"},s().createElement("div",{className:"mailpoet-newsletter-type-image"},e.badge&&s().createElement(Xe,{title:e.badge.text})),s().createElement("div",{className:"mailpoet-newsletter-type-content"},s().createElement(Ne.Z,{level:4},e.title," ",e.soon&&`(${h.Z.I18n.t("soon")})`),s().createElement("p",null,e.description),s().createElement("div",{className:"mailpoet-flex-grow"}),s().createElement("div",{className:"mailpoet-newsletter-type-action"},n)))}}ct.defaultProps={premium:!1},ct.propTypes={premium:b().bool,eventsConfigurator:b().func.isRequired,event:b().shape({slug:b().string.isRequired,actionButtonLink:b().string,title:b().string.isRequired,soon:b().bool,badge:b().shape({style:b().string,text:b().string}),description:b().string.isRequired,actionButtonTitle:b().string}).isRequired};var ut=ct;class dt extends s().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)=>s().createElement(ut,{premium:this.email.premium,event:e,key:t,eventsConfigurator:this.eventsConfigurator})))}}dt.propTypes={email:b().shape({title:b().string.isRequired,slug:b().string.isRequired,premium:b().bool}).isRequired,history:b().shape({push:b().func.isRequired}).isRequired};var pt=(0,d.withRouter)(dt),mt={woocommerce:s().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"}},s().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"}),s().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"}))},ht=n(33687);const ft=({errors:e})=>e.length<1?null:s().createElement(O.Z,{type:"error",closable:!1},e.map((e=>s().createElement("p",{key:e.message},e.message))));ft.propTypes={errors:b().arrayOf(b().shape({message:b().string.isRequired})).isRequired};var gt=ft;const vt=({filter:e,history:t,hideClosingButton:n=!1,hideScreenOptions:a=!0})=>{const[r,i]=(0,o.useState)(!1),l=e=>{void 0!==e&&(t.push(`/new/${e}`),h.Z.trackEvent("Emails > Type selected",{"Email type":e}))},c=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?s().createElement(gt,{errors:e.errors}):null}return window.location.href=`?page=mailpoet-newsletter-editor&id=${e}`,null},u=e=>{const t=!0===window.mailpoet_is_new_user?"mailpoet_badge mailpoet_badge_video":"mailpoet_badge mailpoet_badge_video mailpoet_badge_video_grey";return s().createElement("div",{key:e.slug,"data-type":e.slug,className:"mailpoet-newsletter-type"},s().createElement("div",{className:"mailpoet-newsletter-type-image"}),s().createElement("div",{className:"mailpoet-newsletter-type-content"},s().createElement(Ne.Z,{level:4},e.title," ",e.beta?`(${h.Z.I18n.t("beta")})`:""),s().createElement("p",null,e.description),e.videoGuide&&s().createElement("a",{className:t,href:e.videoGuide,"data-beacon-article":e.videoGuideBeacon,target:"_blank",rel:"noopener noreferrer"},s().createElement("span",{className:"dashicons dashicons-format-video"}),h.Z.I18n.t("seeVideoGuide")),s().createElement("div",{className:"mailpoet-flex-grow"}),s().createElement("div",{className:"mailpoet-newsletter-type-action"},e.action)))},d=T.ZP.partial((e=>{i(!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=>{t.push(`/template/${e.data.id}`)})).fail((e=>(i(!1),e.errors.length>0?s().createElement(gt,{errors:e.errors}):null)))}),"standard"),p=T.ZP.partial(l,"notification"),m=T.ZP.partial(l,"welcome"),f=T.ZP.partial(l,"re-engagement"),g=[{slug:"standard",title:h.Z.I18n.t("regularNewsletterTypeTitle"),description:h.Z.I18n.t("regularNewsletterTypeDescription"),action:s().createElement(y.Z,{automationId:"create_standard",onClick:d,tabIndex:0,withSpinner:r,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),d())}},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:s().createElement(y.Z,{onClick:m,automationId:"create_welcome",withSpinner:r,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),m())},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:s().createElement(y.Z,{automationId:"create_notification",onClick:p,withSpinner:r,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),p())}},h.Z.I18n.t("setUp"))},{slug:"re_engagement",title:h.Z.I18n.t("tabReEngagementTitle"),description:h.Z.I18n.t("reEngagementDescription"),action:s().createElement(y.Z,{automationId:"create_notification",onClick:f,withSpinner:r,tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),f())}},h.Z.I18n.t("setUp"))}];let v=Ge().applyFilters("mailpoet_newsletters_types",[...g],void 0);e&&(v=v.filter(e));const b=h.Z.Ajax.constructGetUrl({api_version:h.Z.apiVersion,endpoint:"newsletterTemplates",action:"getAll"});return s().createElement(s().Fragment,null,a&&s().createElement(Le.Z,null),s().createElement("link",{rel:"prefetch",href:window.mailpoet_editor_javascript_url,as:"script"}),s().createElement("div",{className:"mailpoet-newsletter-types"},!n&&s().createElement("div",{className:"mailpoet-newsletter-types-close"},s().createElement("button",{type:"button",onClick:()=>t.push("/"),className:"mailpoet-modal-close"},ht.Z)),v.map((e=>u(e)),void 0),(()=>{if(!window.mailpoet_woocommerce_automatic_emails)return[];let n=window.mailpoet_woocommerce_automatic_emails;return e&&(n=T.ZP.filter(n,e)),T.ZP.map(n,(n=>{const a=n;return s().createElement(s().Fragment,{key:a.slug},!e&&s().createElement("div",{className:"mailpoet-newsletter-types-separator"},s().createElement("div",{className:"mailpoet-newsletter-types-separator-line"}),s().createElement("div",{className:"mailpoet-newsletter-types-separator-logo"},mt[a.slug]||null),s().createElement("div",{className:"mailpoet-newsletter-types-separator-line"})),s().createElement(pt,{email:a,history:t}),"woocommerce"===a.slug&&(h.Z.isWoocommerceActive?[{slug:"wc_transactional",title:h.Z.I18n.t("wooCommerceCustomizerTypeTitle"),description:h.Z.I18n.t("wooCommerceCustomizerTypeDescription"),action:s().createElement(y.Z,{automationId:"customize_woocommerce",onClick:c,tabIndex:0,onKeyDown:async e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),await c())}},h.Z.I18n.t("customize"))}]:[]).map((e=>u(e)),void 0))}))})()),s().createElement("link",{rel:"prefetch",href:b,as:"fetch"}))};vt.propTypes={filter:b().func,hideScreenOptions:b().bool,hideClosingButton:b().bool},vt.defaultProps={filter:null,hideScreenOptions:!0,hideClosingButton:!1};var bt=(0,d.withRouter)(vt),yt=n(21526),wt=(0,d.withRouter)((e=>s().createElement(yt.Z,e))),Et=n(80416),_t=n(12912),Zt=n(97762);const It=e=>(h.Z.Modal.popup({title:e.title,template:Zt.renderToString(s().createElement(s().Fragment,null,s().createElement("p",null,e.message),s().createElement("button",{id:"mailpoet_alert_cancel",className:"button button-secondary",type:"button"},e.cancelLabel),s().createElement("button",{id:"mailpoet_alert_confirm",className:"button button-primary",type:"submit"},e.confirmLabel))),onInit:()=>{document.getElementById("mailpoet_alert_confirm").addEventListener("click",(()=>{h.Z.Modal.close(),e.onConfirm()})),document.getElementById("mailpoet_alert_cancel").addEventListener("click",(()=>h.Z.Modal.close()))}}),null);function St(e){Zt.renderToString(s().createElement(It,{title:e.title,message:e.message,cancelLabel:e.cancelLabel,confirmLabel:e.confirmLabel,onConfirm:e.onConfirm}))}It.propTypes={title:b().string,message:b().string.isRequired,cancelLabel:b().string,confirmLabel:b().string,onConfirm:b().func.isRequired},It.defaultProps={title:h.Z.I18n.t("confirmTitle"),cancelLabel:h.Z.I18n.t("cancelLabel"),confirmLabel:h.Z.I18n.t("confirmLabel")};class kt extends s().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;St({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=>s().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=>s().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=s().createElement("a",{className:"mailpoet-template-preview",href:"#",onClick:e=>{e.preventDefault(),this.onPreview(e)}},s().createElement("div",{className:"mailpoet-template-thumbnail"},n?s().createElement("img",{src:n,alt:h.Z.I18n.t("templatePreview"),loading:"lazy"}):""),s().createElement("div",{className:"mailpoet-template-preview-overlay"},s().createElement(y.Z,null,h.Z.I18n.t("zoom"))))),s().createElement(_t.Z,{label:t,onSelect:this.onSelect,onDelete:!1===a?this.onDelete:void 0,automationId:`select_template_${e}`,className:"mailpoet-template-two-lines"},r)}}kt.contextType=Ve.k,kt.propTypes={index:b().number.isRequired,id:b().number.isRequired,newsletterId:b().string.isRequired,name:b().string.isRequired,thumbnail:b().string,readonly:b().bool.isRequired,beforeDelete:b().func.isRequired,afterDelete:b().func.isRequired,beforeSelect:b().func.isRequired,afterSelect:b().func.isRequired},kt.defaultProps={thumbnail:null};var Ct=kt;class Tt extends s().Component{constructor(e){super(e),this.fileRef=s().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(s().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=>s().createElement("p",{key:e.message},e.message))),{scroll:!0}),a(!1)}))}render(){return s().createElement("div",{className:"mailpoet-template-import"},s().createElement("h4",null,h.Z.I18n.t("importTemplateTitle"),s().createElement(q(),{tooltip:h.Z.I18n.t("helpTooltipTemplateUpload"),place:"right",className:"tooltip-help-import-template"})),s().createElement("form",{onSubmit:this.handleSubmit},s().createElement("input",{type:"file",placeholder:h.Z.I18n.t("selectJsonFileToUpload"),ref:this.fileRef}),s().createElement("p",{className:"submit"},s().createElement("input",{className:"button button-primary",type:"submit",value:h.Z.I18n.t("upload")}))))}}Tt.contextType=Ve.k,Tt.propTypes={beforeImport:b().func.isRequired,afterImport:b().func.isRequired};var Nt=Tt;const Dt=[];window.mailpoet_newsletters_templates_recently_sent_count&&Dt.push({name:"recent",label:h.Z.I18n.t("recentlySent")}),Dt.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&&Dt.push({name:"woocommerce",label:h.Z.I18n.t("tabWoocommerceTitle")}),Dt.push({name:"saved",label:h.Z.I18n.t("savedTemplates")});class xt extends s().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=>s().createElement("p",{key:e.message},e.message))),{scroll:!0})})).always((()=>{this.selectInitialTab()}))}addTemplate(e){const t=Dt.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(Dt,{name:n.data.type})?t=n.data.type:"automatic"===n.data.type&&T.ZP.findWhere(Dt,{name:n.data.options.group})&&(t=n.data.options.group)})).fail((e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>s().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 s().createElement(We.Z,null);const e=Dt.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=s().createElement(Nt,{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:s().createElement("p",null,h.Z.I18n.t("noTemplates")):e.map(((e,t)=>s().createElement(Ct,{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 s().createElement("div",null,s().createElement(Me.Z,{color:"#fff"}),s().createElement(wt,{emailType:this.state.emailType,automationId:"email_template_selection_heading"}),s().createElement("div",{className:"mailpoet-templates"},s().createElement(Et.Z,{categories:e,active:this.state.selectedTab,onSelect:e=>this.setState({selectedTab:e})}),t))}}xt.contextType=Ve.k,xt.propTypes={match:b().shape({params:b().shape({id:b().string}).isRequired}).isRequired};var Rt=xt,Ot=n(11830),Pt=n(9198),Mt=n.n(Pt);const Lt=({dimension:e,isFullWidth:t,iconStart:n,iconEnd:a,...r})=>{var i;return s().createElement("div",{className:g()("mailpoet-datepicker mailpoet-form-input",{[`mailpoet-form-input-${e}`]:e,"mailpoet-disabled":r.disabled,"mailpoet-full-width":t})},n,s().createElement(Mt(),(0,k.Z)({useWeekdaysShort:!0,calendarStartDay:null!==(i=r.calendarStartDay)&&void 0!==i?i:h.Z.wpWeekStartsOn},r)),a)};Lt.propTypes={dimension:b().oneOf(["small"]),isFullWidth:b().bool,iconStart:b().element,iconEnd:b().element};var At=Lt,Ft=n(4958),qt=n(16245),$t=n.n(qt);const Ut={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")]},jt={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")]};Ft.Z.localize.month=$t()({values:Ut,defaultWidth:"wide"}),Ft.Z.localize.day=$t()({values:jt,defaultWidth:"wide"}),Ft.Z.options.weekStartsOn=void 0!==h.Z.wpWeekStartsOn?h.Z.wpWeekStartsOn:1,(0,Pt.registerLocale)("mailpoet",Ft.Z);class Wt extends s().Component{constructor(...e){super(...e),(0,C.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,C.Z)(this,"getFieldName",(()=>this.props.name||"date")),(0,C.Z)(this,"getDisplayDateFormat",(e=>h.Z.Date.convertFormat(e).replace(/D/g,"d").replace(/Y/g,"y").replace(/\[/g,"").replace(/\]/g,""))),(0,C.Z)(this,"getDate",(e=>{const t={parseFormat:this.props.storageFormat};return h.Z.Date.toDate(e,t)})),(0,C.Z)(this,"getStorageDate",(e=>{const t={format:this.props.storageFormat};return h.Z.Date.format(e,t)}))}render(){return s().createElement(At,(0,k.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))}}Wt.propTypes={displayFormat:b().string.isRequired,onChange:b().func.isRequired,name:b().string,storageFormat:b().string.isRequired,value:b().string.isRequired,disabled:b().bool.isRequired,validation:b().shape({"data-parsley-required":b().bool,"data-parsley-required-message":b().string,"data-parsley-type":b().string,"data-parsley-errors-container":b().string,maxLength:b().number}).isRequired,maxDate:b().instanceOf(Date)},Wt.defaultProps={name:"date",maxDate:null};var Vt=Wt;class Yt extends s().Component{render(){const e=Object.keys(this.props.timeOfDayItems).map((e=>s().createElement("option",{key:`option-${this.props.timeOfDayItems[e]}`,value:e},this.props.timeOfDayItems[e])));return s().createElement(fe.Z,(0,k.Z)({name:this.props.name||"time",value:this.props.value,disabled:this.props.disabled,onChange:this.props.onChange,isMinWidth:!0},this.props.validation),e)}}Yt.propTypes={timeOfDayItems:b().objectOf(b().string).isRequired,name:b().string,value:b().string.isRequired,disabled:b().bool,onChange:b().func.isRequired,validation:b().object},Yt.defaultProps={name:"time",disabled:!1,validation:{}};var Bt=Yt;class Ht extends s().Component{constructor(e){super(e),(0,C.Z)(this,"DATE_TIME_SEPARATOR"," "),(0,C.Z)(this,"getDateTime",(()=>[this.state.date,this.state.time].join(this.DATE_TIME_SEPARATOR))),(0,C.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,C.Z)(this,"handleChange",(e=>{const t={};t[e.target.name]=e.target.value,this.setState(t,this.propagateChange)})),(0,C.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||le()((()=>{this.setState(this.buildStateFromProps(this.props))}))}render(){return s().createElement(Ot.r.Column,{className:"mailpoet-datetime-container"},s().createElement(Vt,{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}),s().createElement(Bt,{name:"time",value:this.state.time,onChange:this.handleChange,disabled:this.props.disabled,validation:this.props.timeValidation,timeOfDayItems:this.props.timeOfDayItems}))}}Ht.propTypes={value:b().string,defaultDateTime:b().string.isRequired,dateDisplayFormat:b().string.isRequired,dateStorageFormat:b().string.isRequired,onChange:b().func,name:b().string,disabled:b().bool,dateValidation:b().object.isRequired,timeValidation:b().any,timeOfDayItems:b().objectOf(b().string).isRequired,maxDate:b().instanceOf(Date)},Ht.defaultProps={onChange:void 0,name:"",disabled:!1,timeValidation:void 0,value:void 0,maxDate:null};var zt=Ht,Kt=n(43246);class Gt extends s().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 s().createElement(s().Fragment,null,s().createElement(de,{item:{...this.props.item,sender_address:this.state.emailAddress},field:this.props.field,onValueChange:this.onChange}),s().createElement("div",{className:"regular-text"},s().createElement(Kt.Z,{emailAddress:this.state.emailAddress,mssActive:window.mailpoet_mss_active})))}}Gt.propTypes={field:b().object.isRequired,item:b().shape({sender_address:b().string.isRequired}).isRequired,onValueChange:b().func},Gt.defaultProps={onValueChange:function(){}};var Qt=Gt;const Xt=T.ZP.once((()=>h.Z.trackEvent("User has typed a GA campaign name"))),Jt=R()(h.Z.I18n.t("gaCampaignTip"),/\[link\](.*?)\[\/link\]/g,((e,t)=>s().createElement("span",{key:t},s().createElement("br",null),s().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 en={name:"ga_campaign",label:h.Z.I18n.t("gaCampaignLine"),tip:Jt,type:"text",onBeforeChange:Xt};const tn=({dimension:e,onCheck:t,automationId:n,className:a,...r})=>s().createElement("label",{className:g()({[a]:a,"mailpoet-form-toggle":!0,[`mailpoet-form-toggle-${e}`]:e,"mailpoet-disabled":r.disabled}),"data-automation-id":n},s().createElement("input",(0,k.Z)({type:"checkbox",onChange:e=>t(e.target.checked,e)},r)),s().createElement("span",{className:"mailpoet-form-toggle-control"}));tn.propTypes={dimension:b().oneOf(["small"]),onCheck:b().func.isRequired,automationId:b().string};var nn=tn;const an=window.mailpoet_current_time||"00:00",rn=`${window.mailpoet_current_date} 00:00:00`,on=window.mailpoet_schedule_time_of_day,sn=window.mailpoet_date_display_format,ln=window.mailpoet_date_storage_format;class cn extends s().Component{constructor(...e){super(...e),(0,C.Z)(this,"getCurrentValue",(()=>{const e={isScheduled:"0",scheduledAt:rn};return T.ZP.defaults(this.props.item[this.props.field.name]||{},e)})),(0,C.Z)(this,"getDateValidation",(()=>({"data-parsley-required":!0,"data-parsley-required-message":h.Z.I18n.t("noScheduledDateError"),"data-parsley-errors-container":"#mailpoet_scheduling"}))),(0,C.Z)(this,"isScheduled",(()=>"1"===this.getCurrentValue().isScheduled)),(0,C.Z)(this,"handleCheckboxChange",((e,t)=>{const n=t;return n.target.value=t.target.checked?"1":"0",this.handleValueChange(n)})),(0,C.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=s().createElement(s().Fragment,null,s().createElement("span",{className:"mailpoet-form-schedule-time"},h.Z.I18n.t("websiteTimeIs")," ",an),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{id:"mailpoet_scheduling"},s().createElement(zt,{name:"scheduledAt",value:this.getCurrentValue().scheduledAt,onChange:this.handleValueChange,disabled:this.props.field.disabled,dateValidation:this.getDateValidation(),defaultDateTime:rn,timeOfDayItems:on,dateDisplayFormat:sn,dateStorageFormat:ln,maxDate:t})))),s().createElement("div",null,s().createElement(nn,{checked:this.isScheduled(),disabled:this.props.field.disabled,name:"isScheduled",onCheck:this.handleCheckboxChange,automationId:"email-schedule-checkbox"}),e)}}cn.propTypes={item:b().object,field:b().shape({name:b().string.isRequired,disabled:b().bool}).isRequired,onValueChange:b().func.isRequired},cn.defaultProps={item:{}};let un=[{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:cn},{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:Qt,placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},en,{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"}}]}];un=Ge().applyFilters("mailpoet_newsletters_3rd_step_fields",un);var dn={getFields:function(){return un},getSendButtonOptions:function(e){const t=e||{},n={value:"object"==typeof t.options&&"1"===t.options.isScheduled?h.Z.I18n.t("schedule"):h.Z.I18n.t("send")};return"sent"!==t.status&&"sending"!==t.status||(n.disabled="disabled"),n}};const pn=window.mailpoet_time_format||"H:i",mn={immediate:h.Z.I18n.t("delayImmediately"),hours:h.Z.I18n.t("delayHoursAfter"),days:h.Z.I18n.t("delayDaysAfter"),weeks:h.Z.I18n.t("delayWeeksAfter")},hn={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")},fn=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:pn,offset:0})]}))),gn={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")},vn=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]}))),bn={1:h.Z.I18n.t("first"),2:h.Z.I18n.t("second"),3:h.Z.I18n.t("third"),L:h.Z.I18n.t("last")},yn={name:"intervalType",values:hn},wn={name:"timeOfDay",values:fn},En={name:"weekDay",values:gn},_n={name:"monthDay",values:vn},Zn={name:"nthWeekDay",values:bn};class In extends s().Component{constructor(...e){super(...e),(0,C.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,C.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,C.Z)(this,"handleIntervalChange",(e=>{const t=e.target.value,n={};n.intervalType=t,"monthly"===t&&(n.monthDay="1"),this.handleValueChanges(n)})),(0,C.Z)(this,"handleTimeOfDayChange",(e=>this.handleValueChanges({timeOfDay:e.target.value}))),(0,C.Z)(this,"handleWeekDayChange",(e=>this.handleValueChanges({weekDay:e.target.value}))),(0,C.Z)(this,"handleMonthDayChange",(e=>this.handleValueChanges({monthDay:e.target.value}))),(0,C.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=s().createElement(ve,{field:wn,item:this.getCurrentValue(),onValueChange:this.handleTimeOfDayChange})),"weekly"!==e.intervalType&&"nthWeekDay"!==e.intervalType||(n=s().createElement(ve,{field:En,item:this.getCurrentValue(),onValueChange:this.handleWeekDayChange})),"monthly"===e.intervalType&&(a=s().createElement(ve,{field:_n,item:this.getCurrentValue(),onValueChange:this.handleMonthDayChange})),"nthWeekDay"===e.intervalType&&(r=s().createElement(ve,{field:Zn,item:this.getCurrentValue(),onValueChange:this.handleNthWeekDayChange})),s().createElement("div",null,s().createElement(ve,{field:yn,item:this.getCurrentValue(),onValueChange:this.handleIntervalChange,automationId:"newsletter_interval_type"}),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{className:"mailpoet-grid-column mailpoet-flex"},r,a,n,t),"immediately"!==e.intervalType&&s().createElement("div",{className:"mailpoet-gap"}))}}In.propTypes={item:b().object.isRequired,field:b().shape({name:b().string}).isRequired,onValueChange:b().func.isRequired};var Sn=In;let kn=[{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:Sn},{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:Qt,placeholder:h.Z.I18n.t("senderAddressPlaceholder"),validation:{"data-parsley-required":!0,"data-parsley-type":"email"}}]},en,{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"}}]}];kn=Ge().applyFilters("mailpoet_newsletters_3rd_step_fields",kn);var Cn={getFields:function(){return kn},getSendButtonOptions:function(){return{value:h.Z.I18n.t("activate")}}};const Tn=window.mailpoet_roles||{},Nn=T.ZP.filter(window.mailpoet_segments||[],(e=>"default"===e.type)),Dn={name:"event",values:{segment:h.Z.I18n.t("onSubscriptionToList"),user:h.Z.I18n.t("onWPUserRegistration")}},xn={name:"segment",placeholder:h.Z.I18n.t("selectSegmentPlaceholder"),forceSelect2:!0,values:Nn,getCount:e=>parseInt(e.subscribers,10).toLocaleString(),getLabel:e=>e.name,getValue:e=>e.id},Rn={name:"role",values:Tn},On={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")}},Pn={name:"afterTimeType",values:mn};class Mn extends s().Component{constructor(...e){super(...e),(0,C.Z)(this,"getCurrentValue",(()=>this.props.item[this.props.field.name]||{})),(0,C.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,C.Z)(this,"handleEventChange",(e=>this.handleValueChange("event",e.target.value))),(0,C.Z)(this,"handleSegmentChange",(e=>this.handleValueChange("segment",e.target.value))),(0,C.Z)(this,"handleRoleChange",(e=>this.handleValueChange("role",e.target.value))),(0,C.Z)(this,"handleAfterTimeNumberChange",(e=>this.handleValueChange("afterTimeNumber",e.target.value))),(0,C.Z)(this,"handleAfterTimeTypeChange",(e=>this.handleValueChange("afterTimeType",e.target.value)))}render(){const e=this.getCurrentValue();let t,n;return t="user"===e.event?s().createElement(ve,{field:Rn,item:this.getCurrentValue(),onValueChange:this.handleRoleChange}):s().createElement(D,{field:xn,item:this.getCurrentValue(),onValueChange:this.handleSegmentChange}),"immediate"!==e.afterTimeType&&(n=s().createElement(de,{field:On,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeNumberChange})),s().createElement("div",null,s().createElement(ve,{field:Dn,item:this.getCurrentValue(),onValueChange:this.handleEventChange}),s().createElement("div",{className:"mailpoet-gap"}),t,s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{className:"mailpoet-grid-column mailpoet-flex"},n,s().createElement(ve,{field:Pn,item:this.getCurrentValue(),onValueChange:this.handleAfterTimeTypeChange})),s().createElement("div",{className:"mailpoet-form-errors"}),s().createElement("div",{className:"mailpoet-gap"}))}}Mn.propTypes={history:b().shape({push:b().func.isRequired}).isRequired,item:b().object.isRequired,field:b().shape({name:b().string}).isRequired,onValueChange:b().func.isRequired};var Ln=(0,d.withRouter)(Mn);let An=[{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:Ln},en,{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:Qt,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"}}]}];An=Ge().applyFilters("mailpoet_newsletters_3rd_step_fields",An);var Fn={getFields:function(){return An},getSendButtonOptions:function(){return{value:h.Z.I18n.t("activate")}}};class qn extends s().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=mn;e.timeDelayValues&&(t=Object.entries(e.timeDelayValues).reduce(((e,[t,n])=>(e[t]=n.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 s().createElement(D,{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 s().createElement(de,{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 s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-grid-column mailpoet-flex"},this.displayAfterTimeNumberField(),this.displayAfterTimeTypeOptions()),s().createElement("div",{className:"mailpoet-form-errors"}),s().createElement("div",{className:"mailpoet-gap"}),e.schedulingReadMoreLink&&s().createElement(s().Fragment,null,s().createElement("a",{href:e.schedulingReadMoreLink.link,target:"_blank",rel:"noopener noreferrer",className:"event-scheduling-read-more-link"},e.schedulingReadMoreLink.text),s().createElement("div",{className:"mailpoet-gap"})))}}qn.propTypes={item:b().shape({afterTimeType:b().string.isRequired,afterTimeNumber:b().number}).isRequired,afterTimeNumberSize:b().number,onValueChange:b().func,event:b().shape({defaultAfterTimeType:b().string,timeDelayValues:b().objectOf(b().shape({text:b().string,displayAfterTimeNumberField:b().bool})),schedulingReadMoreLink:b().shape({link:b().string.isRequired,text:b().string.isRequired})}).isRequired},qn.defaultProps={afterTimeNumberSize:3,onValueChange:null};var $n=qn;function Un(e){const t=e&&e.values?e.values:[];return t?t.map((e=>({id:e.id,name:e.name}))):t}const jn=({eventOptions:e,eventSlug:t,selected:n,onValueChange:a})=>{function r(e){a&&a({eventOptionValue:e.target.value})}return s().createElement("div",null,s().createElement("div",{className:"event-option-selection"},function(){if(!e)return e;const a={field:{name:`event_options_${t}`,forceSelect2:!0,endpoint:e.endpoint,resetSelect2OnUpdate:!0,values:Un(e),multiple:e.multiple||!1,placeholder:e.placeholder||!1,transformChangedValue:(e,t)=>T.ZP.map(t,(e=>({id:e.id,name:e.text}))),selected:()=>n,getLabel:T.ZP.property("name"),getValue:T.ZP.property("id"),validation:{"data-parsley-required":!0}},onValueChange:r,item:{action:""}};return"product_categories"===e.endpoint&&(a.field.name="category_id",a.item={action:"purchasedCategory"}),"products"===e.endpoint&&(a.field.name="product_id",a.item={action:"purchasedProduct"}),s().createElement(s().Fragment,null,s().createElement(D,{field:a.field,onValueChange:a.onValueChange,item:a.item}),s().createElement("div",{className:"mailpoet-gap"}))}()))};jn.propTypes={eventOptions:b().shape({values:b().arrayOf(b().shape({id:b().string.isRequired,name:b().string.isRequired})),multiple:b().bool.isRequired,placeholder:b().string.isRequired,endpoint:b().string.isRequired}).isRequired,eventSlug:b().string.isRequired,selected:b().arrayOf(b().string).isRequired,onValueChange:b().func.isRequired};var Wn=jn;class Vn extends s().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 s().createElement($n,{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 s().createElement("div",{className:"event-segment-selection"},s().createElement(D,{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))),s().createElement(Wn,{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 o={group:this.email.slug,event:e,afterTimeType:t};n&&(o.afterTimeNumber=n),a&&(o.segment=a),r&&(o.meta=JSON.stringify({option:this.state.eventOptionValue})),i({target:{name:"options",value:o}})}render(){return s().createElement("div",null,s().createElement(Ne.Z,{level:5},this.displayHeader()),this.displayEventOptions(),this.displaySegments(),this.displayScheduling())}}Vn.propTypes={field:b().shape({email:b().shape({events:b().object.isRequired}).isRequired,emailOptions:b().object.isRequired}).isRequired,onValueChange:b().func},Vn.defaultProps={onValueChange:null};var Yn=Vn;const Bn=window.mailpoet_woocommerce_automatic_emails||[];var Hn={getFields:function(e){return(e=>{const t=Bn[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:Yn,email:t,emailOptions:n},en,{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")}}},zn=n(78230),Kn=n(68041);function Gn({afterTimeNumber:e,afterTimeType:t,updateAfterTimeNumber:n,updateAfterTimeType:a,inactiveSubscribersPeriod:r}){const i="weeks"===t?7:30,o=Number(e)*i;let l=r;return 365===r&&(l=360),s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:4},h.Z.I18n.t("selectEventToSendReEngagementEmail")),s().createElement(Ot.r.CenteredRow,{className:"mailpoet-re-engagement-scheduling"},s().createElement("p",null,h.Z.I18n.t("reEngagementTextPre")),s().createElement(ce.Z,{type:"text",placeholder:h.Z.I18n.t("reEngagementAterTimeNumberPlaceholder"),value:e,onChange:(0,Kn.z2)(n)}),s().createElement(fe.Z,{value:t,onChange:(0,Kn.z2)(a)},s().createElement("option",{value:"weeks"},"weeks"),s().createElement("option",{value:"months"},"months"))),!!r&&l<=o&&s().createElement("p",{className:"mailpoet-re-engagement-scheduling-note"},R()(h.Z.I18n.t("reEngagementEmailWarning").replace("{$months}",Math.floor(r/30)),/\[link\](.*?)\[\/link\]/g,(e=>s().createElement("a",{key:"link",href:"https://kb.mailpoet.com/article/264-inactive-subscribers",target:"_blank",rel:"noopener noreferrer","data-beacon-article":"5cbf19622c7d3a026fd3efe1"},e)))))}function Qn(e){return s().createElement(Gn,{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,zn.assoc)("afterTimeNumber",t,e.item.options)}})},updateAfterTimeType:t=>{e.onValueChange({target:{name:"options",value:(0,zn.assoc)("afterTimeType",t,e.item.options)}})}})}Gn.propTypes={afterTimeNumber:b().string.isRequired,afterTimeType:b().string.isRequired,updateAfterTimeNumber:b().func.isRequired,updateAfterTimeType:b().func.isRequired},Qn.propTypes={item:b().shape({options:b().shape({afterTimeNumber:b().oneOfType([b().number,b().string]).isRequired,afterTimeType:b().string.isRequired}).isRequired}).isRequired,onValueChange:b().func.isRequired};const Xn=[{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:Qn},{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,zn.map)((e=>(0,zn.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:Qt,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"}}]},en],Jn={getFields:()=>Xn,getSendButtonOptions:()=>({value:h.Z.I18n.t("activate")})};var ea=n(7358),ta=n(31304),na=n.n(ta);const aa=window.mailpoet_woocommerce_automatic_emails||[],ra=(e,t)=>`${na()(t,{lower:!0}).replace(/[^a-z0-9]+/g,"-").replace(/-$/,"")||"newsletter"}_${e}`;function ia(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||window.mailpoet_tracking_enabled?void 0:s().createElement("span",{style:{pointerEvents:"all"}},R()(h.Z.I18n.t("reEngagementEmailsDisableIfTrackingIs"),/\[link\](.*?)\[\/link\]/g,(e=>s().createElement("a",{key:"advancedSettingsTabLink",href:"?page=mailpoet-settings#/advanced",rel:"noopener noreferrer"},e))))}class oa extends s().Component{constructor(e){super(e),(0,C.Z)(this,"getFieldsByNewsletter",(e=>this.getSubtype(e).getFields(e))),(0,C.Z)(this,"getSendButtonOptions",(()=>this.getSubtype(this.state.item).getSendButtonOptions(this.state.item))),(0,C.Z)(this,"getSubtype",(e=>{switch(e.type){case"notification":return Cn;case"welcome":return Fn;case"re_engagement":return Jn;case"automatic":if(aa[e.options.group])return Hn;default:return dn}})),(0,C.Z)(this,"getThumbnailPromise",(e=>this.state.thumbnailPromise?this.state.thumbnailPromise:(0,ea.W0)(e))),(0,C.Z)(this,"isValid",(()=>m()("#mailpoet_newsletter").parsley().isValid())),(0,C.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,C.Z)(this,"showInvalidFromAddressError",(()=>{const e=this.state.item.sender_address;let t=R()(h.Z.I18n.t("newsletterInvalidFromAddress"),"%1$s",(()=>e));t=R()(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,C.Z)(this,"removeInvalidFromAddressError",(()=>{m()("#field_sender_address").parsley().removeError("invalidFromAddress",{updateClass:!0})})),(0,C.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=ra(n.id,n.subject)),this.setState({item:e.data,fields:this.getFieldsByNewsletter(e.data),thumbnailPromise:t,validationError:ia(e.data)})})).fail((()=>{this.setState({item:{}},(()=>{this.props.history.push("/new")}))}))))),(0,C.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,C.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,C.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,C.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(s().createElement("p",null,h.Z.I18n.t("newsletterHasBeenScheduled"))),h.Z.trackEvent("Emails > Newsletter sent",{scheduled:!0})):(this.context.notices.success(s().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,C.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&&aa[e.group]?this.context.notices.success(s().createElement("p",null,h.Z.I18n.t("automaticEmailActivated").replace("%1s",aa[e.group].title))):"welcome"===t.data.type?(this.context.notices.success(s().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(s().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,C.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(s().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,C.Z)(this,"handleSave",(e=>{e.preventDefault(),this.saveNewsletter(e).done((()=>{this.context.notices.success(s().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,C.Z)(this,"handleRedirectToDesign",(e=>{e.preventDefault();const t=e.target.href;this.saveNewsletter(e).done((()=>{this.context.notices.success(s().createElement("p",null,h.Z.I18n.t("newsletterUpdated")))})).done((()=>{window.location=t})).fail((e=>{this.showError(e)}))})),(0,C.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,C.Z)(this,"showError",(e=>{e.errors.length>0&&this.context.notices.error(e.errors.map((e=>s().createElement("p",{key:e.message},e.message))),{scroll:!0})})),(0,C.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===ra(a.id,r)&&(a.ga_campaign=ra(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),s().createElement("div",{className:"mailpoet-form-send-email"},s().createElement(Me.Z,{color:"#fff"}),s().createElement(wt,{emailType:r,automationId:"newsletter_send_heading"}),s().createElement(Pe,{id:"mailpoet_newsletter",fields:t,automationId:"newsletter_send_form",item:this.state.item,loading:this.state.loading,onChange:this.handleFormChange,onSubmit:this.handleSave},s().createElement(Ot.r.CenteredRow,{className:"send-newsletter-buttons"},s().createElement(Re.Button,{variant:"secondary",type:"submit",automationId:"email-save-draft"},h.Z.I18n.t("saveDraftAndClose")),e?s().createElement(Re.Button,{type:"button",onClick:this.handleResume,isDisabled:a,automationId:"email-resume"},h.Z.I18n.t("resume")):s().createElement(Re.Button,(0,k.Z)({type:"button",onClick:this.handleSend},n,{isDisabled:a,automationId:"email-submit"}),n.value||h.Z.I18n.t("send")),void 0!==this.state.validationError&&s().createElement(q(),{tooltip:s().createElement("div",null,this.state.validationError),tooltipId:"helpTooltipSendEmail"})),s().createElement("p",null,h.Z.I18n.t("orSimply")," ",s().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&&s().createElement("div",{className:"mailpoet_error"},R()(h.Z.I18n.t("pendingKeyApprovalNotice"),/\[link\](.*?)\[\/link\]/g,(e=>s().createElement("a",{key:"pendingKeyApprovalNoticeLink",href:"https://account.mailpoet.com/authorization",target:"_blank",rel:"noopener noreferrer"},e))))))}}oa.contextType=Ve.k,oa.propTypes={match:b().shape({params:b().shape({id:b().string}).isRequired}).isRequired,history:b().shape({push:b().func.isRequired}).isRequired};var sa=(0,d.withRouter)(oa);function la(e){const[t,n]=(0,o.useState)(!1);return s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:0},h.Z.I18n.t("congratulationsSuccessHeader")),s().createElement(Ne.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")),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement("img",{src:e.illustrationImageUrl,alt:"",width:"500"}),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement(Re.Button,{type:"button",dimension:"small",onClick:()=>{e.successClicked(),n(!0)},withSpinner:t},h.Z.I18n.t("close")));var a}la.propTypes={successClicked:b().func.isRequired,illustrationImageUrl:b().string.isRequired,newsletter:b().shape({status:b().string.isRequired,type:b().string.isRequired}).isRequired};var ca=la;const ua=e=>s().createElement("div",{className:"mailpoet-wizard-step"},s().createElement("div",{className:"mailpoet-wizard-step-illustration"},s().createElement("img",{src:e.illustrationUrl,width:"500",alt:""})),s().createElement("div",{className:"mailpoet-wizard-step-content"},e.children));ua.propTypes={illustrationUrl:b().string.isRequired,children:b().oneOfType([b().arrayOf(b().node),b().node]).isRequired};var da=ua;const pa=({children:e,isOrdered:t})=>{const n=t?"ol":"ul";return s().createElement(n,{className:`mailpoet-${n}`},e)};pa.propTypes={children:b().node.isRequired,isOrdered:b().bool};var ma=pa;const ha=()=>s().createElement(ma,null,s().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList1")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList2")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList4")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardMSSList5"))),fa=e=>s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(y.Z,{isFullWidth:!0,href:e.mailpoetAccountUrl,target:"_blank",rel:"noopener noreferrer",onClick:t=>{t.preventDefault(),window.open(e.mailpoetAccountUrl),e.next()}},e.nextButtonText),s().createElement(y.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")));fa.propTypes={mailpoetAccountUrl:b().string.isRequired,next:b().func.isRequired,nextButtonText:b().string.isRequired,nextWithSpinner:b().bool},fa.defaultProps={nextWithSpinner:!1};const ga=e=>s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("welcomeWizardMSSFreeTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("welcomeWizardMSSFreeSubtitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(Ne.Z,{level:5},h.Z.I18n.t("welcomeWizardMSSFreeListTitle"),":"),s().createElement(ha,null),s().createElement(fa,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next,nextButtonText:h.Z.I18n.t("welcomeWizardMSSFreeButton")}));ga.propTypes={mailpoetAccountUrl:b().string.isRequired,next:b().func.isRequired};const va=e=>s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("welcomeWizardMSSNotFreeTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("welcomeWizardMSSNotFreeSubtitle"),":"),s().createElement(ha,null),s().createElement(fa,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next,nextButtonText:h.Z.I18n.t("welcomeWizardMSSNotFreeButton")}));va.propTypes={mailpoetAccountUrl:b().string.isRequired,next:b().func.isRequired};const ba=e=>s().createElement(s().Fragment,null,e.subscribersCount<1e3?s().createElement(ga,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next}):s().createElement(va,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:e.next}));ba.propTypes={next:b().func.isRequired,subscribersCount:b().number.isRequired,mailpoetAccountUrl:b().string.isRequired};var ya=ba;function wa(e){const[t,n]=(0,o.useState)(!1);return s().createElement(s().Fragment,null,s().createElement(Ne.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"))),s().createElement(da,{illustrationUrl:e.MSSPitchIllustrationUrl},s().createElement("div",{className:"mailpoet-welcome-wizard-step-content"},s().createElement(Ne.Z,{level:4},h.Z.I18n.t("congratulationsMSSPitchSubHeader")),s().createElement("p",null,h.Z.I18n.t(e.subscribersCount<1e3?"welcomeWizardMSSFreeSubtitle":"welcomeWizardMSSNotFreeSubtitle")),s().createElement(Ne.Z,{level:5},h.Z.I18n.t("welcomeWizardMSSFreeListTitle"),":"),s().createElement(ha,null),s().createElement(fa,{mailpoetAccountUrl:e.mailpoetAccountUrl,next:()=>{e.onFinish(),n(!0)},nextButtonText:h.Z.I18n.t("welcomeWizardMSSFreeButton"),nextWithSpinner:t}))));var a}wa.propTypes={MSSPitchIllustrationUrl:b().string.isRequired,onFinish:b().func.isRequired,subscribersCount:b().number.isRequired,mailpoetAccountUrl:b().string.isRequired,newsletter:b().shape({status:b().string.isRequired,type:b().string.isRequired}).isRequired};var Ea=wa;function _a(e){return window.has_mss_key_specified?s().createElement(ca,{successClicked:e.successClicked,illustrationImageUrl:e.illustrationImageUrl,newsletter:e.newsletter}):s().createElement(Ea,{MSSPitchIllustrationUrl:e.MSSPitchIllustrationUrl,onFinish:e.successClicked,subscribersCount:e.subscribersCount,mailpoetAccountUrl:e.mailpoetAccountUrl,newsletter:e.newsletter})}_a.propTypes={successClicked:b().func.isRequired,illustrationImageUrl:b().string.isRequired,MSSPitchIllustrationUrl:b().string.isRequired,newsletter:b().shape({status:b().string.isRequired,type:b().string.isRequired}).isRequired,subscribersCount:b().number.isRequired,mailpoetAccountUrl:b().string.isRequired};var Za=_a;function Ia(e){const[t,n]=(0,o.useState)(!1);return s().createElement("div",null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("congratulationsSendFailHeader")),s().createElement(Ne.Z,{level:3},R()(h.Z.I18n.t("congratulationsSendFailExplain"),/\[link\](.*?)\[\/link\]/g,((e,t)=>s().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)))),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement("img",{src:window.mailpoet_congratulations_error_image,alt:"",width:"500"}),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement(Re.Button,{dimension:"small",type:"button",onClick:()=>{e.failClicked(),n(!0)},withSpinner:t},h.Z.I18n.t("close")))}Ia.propTypes={failClicked:b().func.isRequired};var Sa=Ia,ka=n(63438);function Ca(e){return s().createElement("div",{className:"mailpoet-congratulate-loading"},e.showRichLoadingScreen&&s().createElement("div",null,s().createElement(Ne.Z,{level:0},h.Z.I18n.t("congratulationsLoadingHeader")),s().createElement(Ne.Z,{level:3},h.Z.I18n.t("congratulationsLoadingBody")),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement("div",{className:"mailpoet-gap-large"}),s().createElement(ka.Z,{size:64})))}Ca.propTypes={showRichLoadingScreen:b().bool.isRequired};var Ta=Ca;const Na=Math.floor(4*Math.random());function Da(){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 xa extends s().Component{constructor(e){super(e),this.state={loading:!0,newsletter:null,testingPassed:!1,timeStart:oe()(),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(){oe()().subtract(20,"second").isAfter(this.state.timeStart)&&this.setState({error:!0,loading:!1}),this.state.loading&&this.loadNewsletter(this.props.match.params.id),oe()().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,s().createElement(Ta,{illustrationImageUrl:window.mailpoet_congratulations_loading_image,successClicked:Da,showRichLoadingScreen:e})):this.state.error?(h.Z.trackEvent("Cron testing done",{"Cron is working":"false"}),s().createElement(Sa,{failClicked:()=>{window.location=window.mailpoet_main_page}})):(t=this.state.newsletter,this.state.testingPassed&&h.Z.trackEvent("Cron testing done",{"Cron is working":"true"}),s().createElement(Za,{illustrationImageUrl:window.mailpoet_congratulations_success_images[Na],MSSPitchIllustrationUrl:window.mailpoet_congratulations_success_images[Na],successClicked:Da,newsletter:t,isWoocommerceActive:window.mailpoet_woocommerce_active,subscribersCount:window.mailpoet_subscribers_count,mailpoetAccountUrl:window.mailpoet_account_url}));var e,t}render(){return s().createElement(s().Fragment,null,s().createElement("style",{dangerouslySetInnerHTML:{__html:"body { background: #fff; overflow-x: hidden; }"}}),s().createElement("div",{className:"mailpoet-congratulate"},s().createElement("div",{className:"mailpoet-gap-large"}),this.renderContent()))}}xa.propTypes={match:b().shape({params:b().shape({id:b().string}).isRequired}).isRequired};var Ra=xa;class Oa extends s().Component{constructor(...e){super(...e),(0,C.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=>s().createElement("p",{key:e.message},e.message))),{scroll:!0})}))}render(){return s().createElement("div",null,s().createElement(wt,{emailType:"standard",automationId:"standard_newsletter_creation_heading"}))}}Oa.contextType=Ve.k,Oa.propTypes={history:b().shape({push:b().func.isRequired}).isRequired};var Pa=(0,d.withRouter)(Oa);const Ma={name:"options",type:"reactComponent",component:Sn};class La extends s().Component{constructor(e){super(e),(0,C.Z)(this,"handleValueChange",(e=>{const t=this.state;t[e.target.name]=e.target.value,this.setState(t)})),(0,C.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=>s().createElement("p",{key:e.message},e.message))),{scroll:!0})}))})),(0,C.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 s().createElement("div",null,s().createElement(Me.Z,{color:"#fff"}),s().createElement(wt,{emailType:"notification",automationId:"post_notification_creation_heading"}),s().createElement(Ot.r.Column,{align:"center",className:"mailpoet-schedule-email"},s().createElement(Ne.Z,{level:4},h.Z.I18n.t("selectFrequency")),s().createElement(Sn,{item:this.state,field:Ma,onValueChange:this.handleValueChange}),s().createElement(y.Z,{isFullWidth:!0,onClick:this.handleNext,type:"button"},h.Z.I18n.t("next"))))}}La.contextType=Ve.k,La.propTypes={history:b().shape({push:b().func.isRequired}).isRequired};var Aa=(0,d.withRouter)(La);const Fa={name:"options",label:"Event",type:"reactComponent",component:Ln};class qa extends s().Component{constructor(e){super(e),(0,C.Z)(this,"isValid",(()=>m()("#welcome_scheduling").parsley().isValid())),(0,C.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 s().createElement("div",null,s().createElement(Me.Z,{color:"#fff"}),s().createElement(wt,{emailType:"welcome",automationId:"welcome_email_creation_heading"}),s().createElement(Ot.r.Column,{align:"center",className:"mailpoet-schedule-email"},s().createElement(Ne.Z,{level:4},h.Z.I18n.t("selectEventToSendWelcomeEmail")),s().createElement("form",{id:"welcome_scheduling"},s().createElement(Ln,{item:this.state,field:Fa,onValueChange:this.handleValueChange}),s().createElement(y.Z,{isFullWidth:!0,type:"submit",onClick:this.handleNext},h.Z.I18n.t("next")))))}}qa.propTypes={history:b().shape({push:b().func.isRequired}).isRequired};var $a=qa;class Ua extends s().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,C.Z)(this,"isValid",(()=>!m()("#newsletter_scheduling").parsley()||m()("#newsletter_scheduling").parsley().isValid())),(0,C.Z)(this,"validate",(()=>{m()("#newsletter_scheduling").parsley()&&m()("#newsletter_scheduling").parsley().validate()})),(0,C.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.constructor.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.constructor.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:o,eventOptionValue:l}=this.state,c={group:this.email.slug,event:n,afterTimeType:a};r&&(c.afterTimeNumber=r),c.sendTo=i.sendToLists?"segment":"user",o&&(c.segment=o),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=>s().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 s().createElement(Wn,{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 s().createElement("div",{className:"event-segment-selection"},s().createElement(D,{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 s().createElement($n,{item:a.item,event:a.event,onValueChange:a.onValueChange})}displayEventTip(){const{event:e}=this.state;return e.tip?s().createElement("p",{className:"description"},s().createElement("strong",null,h.Z.I18n.t("tip"))," ",e.tip):null}render(){return s().createElement("div",null,s().createElement(Me.Z,{color:"#fff"}),s().createElement(wt,{emailType:"woocommerce",automationId:"woocommerce_email_creation_heading"}),s().createElement(Ot.r.Column,{align:"center",className:"mailpoet-schedule-email"},s().createElement("form",{id:"newsletter_scheduling"},s().createElement(Ne.Z,{level:4},this.displayHeader()),s().createElement("div",null,this.displayEventOptions()),s().createElement("div",null,this.displaySegments()),s().createElement("div",null,this.displayScheduling()),s().createElement(y.Z,{isFullWidth:!0,onClick:this.handleNextStep,type:"submit"},h.Z.I18n.t("next")))),this.displayEventTip())}}Ua.contextType=Ve.k,Ua.propTypes={history:b().shape({push:b().func.isRequired}).isRequired,name:b().string.isRequired,email:b().shape({title:b().string.isRequired,slug:b().string.isRequired}).isRequired};var ja=Ua,Wa=n(45853),Va=n(19013),Ya=n(13882);function Ba(e){return(0,Ya.Z)(1,arguments),(0,Va.default)(e).getTime()<Date.now()}function Ha(e,t){return(0,Ya.Z)(2,arguments),(0,Va.default)(e).getTime()-(0,Va.default)(t).getTime()}Math.pow(10,8);var za={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function Ka(e){return e?za[e]:za.trunc}var Ga=n(44732);const Qa=({scheduledFor:e,processed:t,total:n,isPaused:a,status:r})=>{const i=!e&&!t&&!n,o=e&&function(e){return(0,Ya.Z)(1,arguments),(0,Va.default)(e).getTime()>Date.now()}(e),l=(!e||Ba(e))&&t<n,c=(!e||Ba(e))&&t>=n,u="sent"===r&&void 0===n;let d=0,p=s().createElement(s().Fragment,null,(0,Ga.Z)("notSentYet"));if(o){const t=720,n=function(e,t,n){(0,Ya.Z)(2,arguments);var a=Ha(e,t)/6e4;return Ka(null==n?void 0:n.roundingMethod)(a)}(e,new Date);p=s().createElement(s().Fragment,null,h.Z.Date.short(e),s().createElement("br",null),h.Z.Date.time(e)),d=n<t?n/t*100:100}else l?(p=s().createElement(s().Fragment,null,`${h.Z.Num.toLocaleFixed(t)} / ${h.Z.Num.toLocaleFixed(n)}`),d=t/n*100):c?(p=s().createElement(s().Fragment,null,`${h.Z.Num.toLocaleFixed(n)} / ${h.Z.Num.toLocaleFixed(n)}`),d=100):u&&(p=s().createElement(s().Fragment,null,(0,Ga.Z)("sent")),d=100);return!a||c||u||(p=s().createElement(s().Fragment,null,(0,Ga.Z)("paused"))),s().createElement("div",{className:g()({"mailpoet-listing-status":!0,"mailpoet-listing-status-unknown":i,"mailpoet-listing-status-scheduled":o,"mailpoet-listing-status-in-progress":l,"mailpoet-listing-status-sent":c||u})},o&&s().createElement(Ja,null),s().createElement(Xa,{percentage:d}),s().createElement("div",{className:"mailpoet-listing-status-label"},p))};Qa.propTypes={scheduledFor:b().instanceOf(Date),processed:b().number,total:b().number,isPaused:b().bool,status:b().string};const Xa=({percentage:e})=>{const t=16*Math.PI,n=t*(e/100),a=t-n;return s().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},s().createElement("circle",{cx:"12",cy:"12",r:"8",className:"mailpoet-listing-status-percentage-background"}),s().createElement("circle",{r:"8",cx:"12",cy:"12",fill:"none",strokeDashoffset:t/4,strokeDasharray:`${n} ${a}`,className:"mailpoet-listing-status-percentage"}))};Xa.propTypes={percentage:b().number.isRequired};const Ja=()=>s().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},s().createElement("path",{className:"mailpoet-listing-status-scheduled-icon",strokeLinecap:"round",d:"M12 7L12 12 15 15"}));var er=Qa;const tr=b().shape({status:b().string,count_processed:b().string.isRequired,count_total:b().string.isRequired,scheduled_at:b().string}),nr=b().shape({id:b().number.isRequired,sent_at:b().string,status:b().string.isRequired,queue:b().oneOfType([tr,b().bool])}),ar=({newsletter:e})=>{const[t,n]=s().useState("paused"===e.queue.status),[a,r]=s().useState([]);return s().createElement(s().Fragment,null,s().createElement(gt,{errors:a}),t&&s().createElement(y.Z,{dimension:"small",onClick:()=>{r([]),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"resume",data:{newsletter_id:e.id}}).done((()=>n(!1))).fail((e=>r(e.errors)))}},h.Z.I18n.t("resume")),!t&&s().createElement(y.Z,{dimension:"small",onClick:()=>{r([]),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sendingQueue",action:"pause",data:{newsletter_id:e.id}}).done((()=>n(!0))).fail((e=>r(e.errors)))}},h.Z.I18n.t("pause")))};ar.propTypes={newsletter:nr.isRequired};const rr=({newsletter:e,mailerLog:t})=>{let n=e.sent_at||e.queue.scheduled_at;n&&(n=(0,Wa.default)(n,"yyyy-MM-dd HH:mm:ss",new Date));const a=e.queue&&"scheduled"!==e.queue.status,r="paused"===t.status,i=s().createElement(s().Fragment,null,s().createElement(u.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`},s().createElement(er,{processed:parseInt(e.queue.count_processed,10),scheduledFor:n,total:parseInt(e.queue.count_total,10),isPaused:r,status:e.status})),"completed"!==e.queue.status&&!r&&s().createElement(ar,{newsletter:e})),o=s().createElement(er,{scheduledFor:n,isPaused:"scheduled"===e.queue.status&&r,status:e.status});return s().createElement(s().Fragment,null,a&&i,!a&&o)};rr.propTypes={newsletter:nr.isRequired,mailerLog:b().shape({status:b().string}).isRequired};var ir=rr;const or={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=or[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]},lr=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=or[e.stat]||null;if(!r)return null;const i=e.tooltipId||null,o=s().createElement("div",{key:`tooltip-${i}`},s().createElement("div",{className:"mailpoet-listing-stats-tooltip-title"},a.tooltipTitle.toUpperCase()),s().createElement("div",{className:"mailpoet-listing-stats-tooltip-content"},s().createElement(z,{type:"excellent",name:t.excellent.name})," : ",r.tooltipText[0],s().createElement("br",null),s().createElement(z,{type:"good",name:t.good.name})," : ",r.tooltipText[1],s().createElement("br",null),s().createElement(z,{type:"average",name:t.average.name})," : ",r.tooltipText[2]));return s().createElement(z,{isInverted:e.isInverted,type:n,name:a.name,tooltip:o,tooltipId:i,tooltipPlace:e.tooltipPlace})};lr.propTypes={stat:b().string.isRequired,rate:b().number.isRequired,tooltipId:b().string,isInverted:b().bool},lr.defaultProps={isInverted:!0};const cr=({opened:e,clicked:t,revenues:n,hideBadges:a,newsletterId:r,wrapContentInLink:i})=>{const o=h.Z.Num.toLocaleFixed(e,1),l=h.Z.Num.toLocaleFixed(t,1);let c=s().createElement("div",{className:"mailpoet-listing-stats-opened-clicked"},s().createElement("div",{className:"mailpoet-listing-stats-percentages"},l,"%",s().createElement("br",null),s().createElement("span",{className:"mailpoet-listing-stats-percentages-opens"},o,"%")),!a&&s().createElement("div",null,s().createElement(lr,{stat:"clicked",rate:t,tooltipId:`clicked-${r||"0"}`}))),u=null;if(n){const e=`revenues-${r||"0"}`;u=s().createElement("div",null,s().createElement(w.Z,{"data-tip":!0,"data-for":e},n),s().createElement(B.Z,{place:"top",multiline:!0,id:e},s().createElement("div",{className:"mailpoet-listing-stats-tooltip-content"},h.Z.I18n.t("revenueStatsTooltipShort"))))}return i&&(c=i(c,"opened-and-clicked"),u=i(u,"revenue")),s().createElement("div",{className:"mailpoet-listing-stats"},c,u)};cr.propTypes={opened:b().number.isRequired,clicked:b().number.isRequired,revenues:b().string,hideBadges:b().bool,newsletterId:b().number,wrapContentInLink:b().func};var ur=cr;const dr=()=>{h.Z.trackEvent("User has clicked a CTA to view detailed stats")},pr=e=>(e.unshift({name:"stats",link:function(e){return s().createElement(u.rU,{to:`/stats/${e.id}`,onClick:Ge().applyFilters("mailpoet_newsletters_listing_stats_tracking",dr)},h.Z.I18n.t("statsListingActionTitle"))},display:function(e){const t=e.queue&&e.queue.count_processed;return Number(e.total_sent||t)>0}}),e),mr=e=>{e.meta.mta_log.error&&"authorization"===e.meta.mta_log.error.operation&&(h.Z.Notice.hide("mailpoet_notice_being_sent"),e.meta.mta_log.error.error_message.indexOf("mailpoet-js-button-resume-sending")>=0&&m()(".mailpoet-js-error-unauthorized-emails-notice").hide(),h.Z.Notice.error(e.meta.mta_log.error.error_message,{static:!0,id:"mailpoet_authorization_error"}))},hr=e=>{if(!1!==e.meta.cron_accessible)return void h.Z.Notice.hide("mailpoet_cron_error");const t=R()(h.Z.I18n.t("cronNotAccessibleNotice"),/\[link\](.*?)\[\/link\]/g,(e=>s().createElement("a",{href:"https://kb.mailpoet.com/article/231-sending-does-not-work","data-beacon-article":"5a0257ac2c7d3a272c0d7ad6",target:"_blank",rel:"noopener noreferrer",key:"check-cron"},e)));h.Z.Notice.error("",{static:!0,id:"mailpoet_cron_error"}),c().render(s().createElement("div",null,s().createElement("p",null,t)),m()('[data-id="mailpoet_cron_error"]')[0])},fr=({newsletter:e,isSent:t,currentTime:n})=>{let a=t;if(void 0===a&&(a=e.statistics&&e.queue&&"scheduled"!==e.queue.status),!a)return null;const r={link:`/stats/${e.id}`,onClick:Ge().applyFilters("mailpoet_newsletters_listing_stats_tracking",dr)},i=Number(e.total_sent||e.queue.count_processed);let o,l,c,d,p,m=0,f=0,g=null;i>0&&(m=100*e.statistics.clicked/i,f=100*e.statistics.opened/i,g=e.statistics.revenue),void 0!==n?(o=6,l=e.queue.scheduled_at||e.queue.created_at,c=oe()(n).diff(oe()(l),"hours"),d=c<o,p=!0):(d=!1,p=!1);const v=i>=20&&e.statistics.opened>=5&&!d,b=(t,n)=>((e,t,n,a)=>a<=0||!t.link?e:t.externalLink?s().createElement("a",{key:`stats-${n}`,href:t.link,onClick:t.onClick||null},e):s().createElement(u.rU,{key:`stats-${n}`,to:t.link,onClick:t.onClick||null},e))(t,r,`${n}-${e.id}`,i),y=s().createElement(ur,{opened:f,clicked:m,revenues:g&&g.value>0?g.formatted:null,hideBadges:!v,newsletterId:e.id,wrapContentInLink:b}),E=s().createElement(s().Fragment,null,y,d&&b(s().createElement(w.Z,{className:"mailpoet-listing-stats-too-early",dimension:"large",variant:"excellent",isInverted:!0},h.Z.I18n.t("checkBackInHours").replace("%1$d",o-c)),"check-back"));let _;return p&&f<5&&c>=24&&i>=10&&(_=s().createElement("div",null,s().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")))),s().createElement(s().Fragment,null,E,_)},gr=b().shape({clicked:b().number,opened:b().number,unsubscribed:b().number,revenue:b().shape({count:b().number,currency:b().string,formatted:b().string,value:b().number})}),vr=b().shape({status:b().string,count_processed:b().string.isRequired,count_total:b().string.isRequired,created_at:b().string,scheduled_at:b().string});fr.propTypes={newsletter:b().shape({id:b().number.isRequired,queue:b().oneOfType([vr,b().bool]),total_sent:b().number,statistics:b().oneOfType([gr,b().bool])}).isRequired,isSent:b().bool,currentTime:b().string},fr.defaultProps={isSent:void 0,currentTime:void 0};var br=fr;const yr=!!window.mailpoet_tracking_enabled,wr={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)}},Er=[{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:yr},{name:"sent_at",label:h.Z.I18n.t("sentOn"),sortable:!0}],_r=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:wr.onTrash}],Zr=e=>{const t=()=>{window.location.href=`?page=mailpoet-newsletter-editor&id=${e.id}`};e.queue&&"sending"===e.status&&null===e.queue.status?St({message:h.Z.I18n.t("confirmEdit"),onConfirm:t}):t()};let Ir=[{name:"view",link:function(e){return s().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:Zr},{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"}];Ir=pr(Ir);class Sr extends s().Component{constructor(e){super(e),(0,C.Z)(this,"renderItem",((e,t,n)=>{const a=g()("manage-column","column-primary","has-row-actions");return s().createElement("div",null,s().createElement("td",{className:a},s().createElement("a",{className:"mailpoet-listing-title",href:"#",onClick:t=>{t.preventDefault(),Zr(e)}},e.queue.newsletter_rendered_subject||e.subject),t),s().createElement("td",{className:"column mailpoet-listing-status-column","data-colname":h.Z.I18n.t("status")},s().createElement(ir,{newsletter:e,mailerLog:n.mta_log})),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lists")},s().createElement(_,{segments:e.segments,dimension:"large"})),!0===yr?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},s().createElement(br,{newsletter:e,currentTime:n.current_time})):null,s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("sentOn")},e.sent_at?s().createElement(s().Fragment,null,h.Z.Date.short(e.sent_at),s().createElement("br",null),h.Z.Date.time(e.sent_at)):null))})),(0,C.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return s().createElement(s().Fragment,null,0===this.state.newslettersCount&&s().createElement(bt,{filter:e=>"standard"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&s().createElement(I(),{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:Er,bulk_actions:_r,item_actions:Ir,messages:wr,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})}mr(e),hr(e)}}))}}Sr.contextType=Ve.k,Sr.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var kr=(0,d.withRouter)(Sr);const Cr=window.mailpoet_roles||{},Tr=window.mailpoet_segments||{},Nr=!!window.mailpoet_tracking_enabled,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:"statistics",label:h.Z.I18n.t("statistics"),display:Nr},{name:"status",label:h.Z.I18n.t("status"),width:145},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],Rr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Dr.onTrash}];let Or=[{name:"view",link:function(e){return s().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",link:function(e){return s().createElement("a",{href:`?page=mailpoet-newsletter-editor&id=${e.id}`},h.Z.I18n.t("edit"))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];Or=pr(Or);class Pr extends s().Component{constructor(e){super(e),(0,C.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,C.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 s().createElement("div",null,s().createElement(nn,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),s().createElement("p",{className:"mailpoet-listing-stats-description"},s().createElement(u.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`},t)," ",s().createElement("br",null),n))})),(0,C.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"):R()(h.Z.I18n.t("welcomeEventWPUserWithRole"),'"%1$s"',((t,n)=>s().createElement(w.Z,{variant:"list",key:n},Cr[e.options.role])));break;default:if(a=T.ZP.find(Tr,(t=>Number(t.id)===Number(e.options.segment))),void 0===a)return s().createElement(u.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`},h.Z.I18n.t("sendingToSegmentsNotSpecified"));t=R()(h.Z.I18n.t("welcomeEventSegment"),'"%1$s"',((e,t)=>s().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 s().createElement("span",null,t,n&&s().createElement("div",{className:"mailpoet-listing-schedule"},s().createElement("div",{className:"mailpoet-listing-schedule-icon"},s().createElement(Ja,null)),n))})),(0,C.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return s().createElement("div",null,s().createElement("td",{className:n},s().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),!0===Nr?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},s().createElement(br,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})):null,s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),s().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,C.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return s().createElement(s().Fragment,null,0===this.state.newslettersCount&&s().createElement(bt,{filter:e=>"welcome"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&s().createElement(I(),{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: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})}mr(e),hr(e)}}))}}Pr.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var Mr=(0,d.withRouter)(Pr);const 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)}},Ar=[{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}],Fr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Lr.onTrash}],qr=[{name:"view",link:function(e){return s().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return s().createElement("a",{href:`?page=mailpoet-newsletter-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:"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 $r extends s().Component{constructor(e){super(e),(0,C.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,C.Z)(this,"renderStatus",(e=>s().createElement(nn,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}))),(0,C.Z)(this,"renderSettings",(e=>{let t;if(0===e.segments.length)return s().createElement(u.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`},h.Z.I18n.t("sendingToSegmentsNotSpecified"));const n=R()(h.Z.I18n.t("sendTo"),"%1$s",((t,n)=>s().createElement(_,{segments:e.segments,key:n})));switch(e.options.intervalType){case"daily":t=h.Z.I18n.t("sendDaily").replace("%1$s",fn[e.options.timeOfDay]);break;case"weekly":t=h.Z.I18n.t("sendWeekly").replace("%1$s",gn[e.options.weekDay]).replace("%2$s",fn[e.options.timeOfDay]);break;case"monthly":t=h.Z.I18n.t("sendMonthly").replace("%1$s",vn[e.options.monthDay]).replace("%2$s",fn[e.options.timeOfDay]);break;case"nthWeekDay":t=h.Z.I18n.t("sendNthWeekDay").replace("%1$s",bn[e.options.nthWeekDay]).replace("%2$s",gn[e.options.weekDay]).replace("%3$s",fn[e.options.timeOfDay]);break;case"immediately":t=h.Z.I18n.t("sendImmediately");break;default:t="Invalid sending frequency"}return s().createElement("span",null,n,s().createElement("div",{className:"mailpoet-listing-schedule"},s().createElement("div",{className:"mailpoet-listing-schedule-icon"},s().createElement(Ja,null)),t))})),(0,C.Z)(this,"renderHistoryLink",(e=>0===Number(e.children_count)?s().createElement("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small mailpoet-listing-notification-status"},h.Z.I18n.t("notSentYet")):s().createElement(u.rU,{className:"mailpoet-nowrap","data-automation-id":`history-${e.id}`,to:`/notification/history/${e.id}`},s().createElement(y.Z,{className:"mailpoet-hide-on-mobile",dimension:"small"},h.Z.I18n.t("viewHistory")),s().createElement(y.Z,{className:"mailpoet-show-on-mobile mailpoet-listing-notification-status",dimension:"small",variant:"secondary"},h.Z.I18n.t("viewHistory"))))),(0,C.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return s().createElement("div",null,s().createElement("td",{className:n},s().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("history")},this.renderHistoryLink(e)),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),s().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,C.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return s().createElement(s().Fragment,null,0===this.state.newslettersCount&&s().createElement(bt,{filter:e=>"notification"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&s().createElement(I(),{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:Ar,bulk_actions:Fr,item_actions:qr,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})}mr(e),hr(e)}}))}}$r.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var Ur=(0,d.withRouter)($r);const jr=!!window.mailpoet_tracking_enabled,Wr={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:"settings",label:h.Z.I18n.t("settings")},{name:"statistics",label:h.Z.I18n.t("statistics"),display:jr},{name:"status",label:h.Z.I18n.t("status"),width:145},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],Yr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Wr.onTrash}];let Br=[{name:"view",link:function(e){return s().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",link:function(e){return s().createElement("a",{href:`?page=mailpoet-newsletter-editor&id=${e.id}`},h.Z.I18n.t("edit"))}},{name:"trash",className:"mailpoet-hide-on-mobile"}];Br=pr(Br);class Hr extends s().Component{constructor(e){super(e),(0,C.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,C.Z)(this,"renderStatus",(e=>{const t=h.Z.I18n.t("sentToXSubscribers").replace("%1$d",e.total_sent.toLocaleString());return s().createElement("div",null,s().createElement(nn,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"active"===e.status}),s().createElement("p",{className:"mailpoet-listing-stats-description"},s().createElement(u.rU,{to:`/sending-status/${e.id}`,"data-automation-id":`sending_status_${e.id}`},t)))})),(0,C.Z)(this,"renderSettings",(e=>{if(0===e.segments.length)return s().createElement(u.rU,{className:"mailpoet-listing-error",to:`/send/${e.id}`},h.Z.I18n.t("sendingToSegmentsNotSpecified"));const t=R()(h.Z.I18n.t("sendTo"),"%1$s",((t,n)=>s().createElement(_,{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 s().createElement("span",null,t,s().createElement("div",{className:"mailpoet-listing-schedule"},s().createElement("div",{className:"mailpoet-listing-schedule-icon"},s().createElement(Ja,null)),a))})),(0,C.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return s().createElement("div",null,s().createElement("td",{className:n},s().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),!0===jr?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},s().createElement(br,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})):null,s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),s().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,C.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={newslettersCount:void 0}}render(){return s().createElement(s().Fragment,null,0===this.state.newslettersCount&&s().createElement(bt,{filter:e=>"re_engagement"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&s().createElement(I(),{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:Vr,bulk_actions:Yr,item_actions:Br,messages:Wr,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})}mr(e),hr(e)}}))}}Hr.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var zr=(0,d.withRouter)(Hr);const Kr=!!window.mailpoet_tracking_enabled,Gr=[{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:Kr},{name:"sent_at",label:h.Z.I18n.t("sentOn"),sortable:!0}],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)}},Xr=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Qr.onTrash}],Jr=pr([{name:"view",link:function(e){return s().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"trash",className:"mailpoet-hide-on-mobile"}]),ei=(e,t,n)=>{const a=g()("manage-column","column-primary","has-row-actions");return s().createElement(s().Fragment,null,s().createElement("td",{className:a},s().createElement("strong",null,s().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},e.queue.newsletter_rendered_subject||e.subject)),t),s().createElement("td",{className:"column mailpoet-listing-status-column","data-colname":h.Z.I18n.t("status")},s().createElement(ir,{newsletter:e,mailerLog:n.mta_log})),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lists")},s().createElement(_,{segments:e.segments,dimension:"large"})),!0===Kr?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},s().createElement(br,{newsletter:e,currentTime:n.current_time})):null,s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("sentOn")},e.sent_at?s().createElement(s().Fragment,null,h.Z.Date.short(e.sent_at),s().createElement("br",null),h.Z.Date.time(e.sent_at)):null))},ti=e=>s().createElement(s().Fragment,null,s().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:"/notification"},h.Z.I18n.t("backToPostNotifications")),s().createElement(I(),{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:ei,columns:Gr,messages:Qr,item_actions:Jr,bulk_actions:Xr,auto_refresh:!0,sort_by:"sent_at",sort_order:"desc",afterGetItems:e=>{mr(e),hr(e)}}));ti.propTypes={parentId:b().string.isRequired,location:b().shape({pathname:b().string}).isRequired,match:b().shape({params:b().shape({id:b().node}).isRequired}).isRequired};var ni=(0,d.withRouter)(ti);const ai=[{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")}],ri={onNoItemsFound:()=>h.Z.I18n.t("noSendingTaskFound")},ii=e=>{const[t,n]=s().useState({id:e.match.params.id,subject:"",sent:!1});return s().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]),s().createElement(s().Fragment,null,s().createElement("h1",null,h.Z.I18n.t("sendingStatusTitle")),s().createElement(li,{newsletter:t}),s().createElement(si,{location:e.location,params:e.match.params}))};ii.propTypes={location:b().shape({pathname:b().string}).isRequired,match:b().shape({params:b().shape({id:b().string.isRequired}).isRequired}).isRequired};const oi=(e,t)=>e.location.pathname===t.location.pathname&&e.params.id===t.params.id,si=s().memo((({location:e,params:t})=>s().createElement(I(),{limit:window.mailpoet_listing_per_page,location:e,params:t,endpoint:"sending_task_subscribers",base_url:"sending-status/:id",onRenderItem:e=>s().createElement("div",null,s().createElement(ci,e)),getListingItemKey:e=>`${e.taskId}-${e.subscriberId}`,columns:ai,messages:ri,auto_refresh:!0,sort_by:"failed",sort_order:"desc",afterGetItems:e=>{mr(e),hr(e)}})),oi);si.propTypes={location:b().shape({pathname:b().string}).isRequired,params:b().shape({id:b().string.isRequired}).isRequired};const li=({newsletter:e})=>e.id&&e.subject&&e.sent?s().createElement("p",null,s().createElement(u.rU,{to:`/stats/${e.id}`},e.subject)):null;li.propTypes={newsletter:b().shape({id:b().string,subject:b().string,sent:b().bool})},li.defaultProps={newsletter:{id:null,subject:null,sent:!1}};const ci=({error:e,failed:t,taskId:n,processed:a,email:r,subscriberId:i,lastName:o,firstName:l})=>{const c=g()("manage-column","column-primary","has-row-actions");let u=h.Z.I18n.t("unprocessed");return"1"===a&&(u="1"===t?s().createElement("span",null,h.Z.I18n.t("failed"),s().createElement("br",null),s().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:n,subscriberId:i}}).done((()=>window.mailpoet_listing.forceUpdate())).fail((e=>h.Z.Notice.showApiErrorNotice(e)))}},h.Z.I18n.t("resend"))):h.Z.I18n.t("sent")),s().createElement(s().Fragment,null,s().createElement("td",{"data-automation-id":`name_${n}_${i}`,className:c},s().createElement("a",{className:"mailpoet-listing-title",href:`admin.php?page=mailpoet-subscribers#/edit/${i}`},r),s().createElement("div",{className:"mailpoet-listing-subtitle"},`${l} ${o}`)),s().createElement("td",{className:"column","data-automation-id":`status_${n}_${i}`,"data-colname":h.Z.I18n.t("sendingStatus")},u),s().createElement("td",{className:"column","data-automation-id":`error_${n}_${i}`,"data-colname":h.Z.I18n.t("failureReason")},e))};ci.propTypes={error:b().string,email:b().string.isRequired,failed:b().string.isRequired,taskId:b().string.isRequired,lastName:b().string.isRequired,firstName:b().string.isRequired,processed:b().string.isRequired,subscriberId:b().string.isRequired},ci.defaultProps={error:""};var ui=ii;const di=!!window.mailpoet_tracking_enabled,pi=window.mailpoet_woocommerce_automatic_emails||{},mi={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)}},hi=[{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:di},{name:"status",label:h.Z.I18n.t("status"),width:145},{name:"updated_at",label:h.Z.I18n.t("lastModifiedOn"),sortable:!0}],fi=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:mi.onTrash}];let gi=[{name:"view",link:function(e){return s().createElement("a",{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("preview"))}},{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return s().createElement("a",{href:`?page=mailpoet-newsletter-editor&id=${e.id}`},h.Z.I18n.t("edit"))}},{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"}];gi=pr(gi);class vi extends s().Component{constructor(e){super(e),(0,C.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=pi[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,C.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 s().createElement("div",null,s().createElement(nn,{className:"mailpoet-listing-status-toggle",onCheck:this.updateStatus,"data-id":e.id,"data-group":e.options.group,dimension:"small",defaultChecked:"active"===e.status}),s().createElement("p",{className:"mailpoet-listing-notification-status"},t&&s().createElement(u.rU,{to:`/sending-status/${e.id}`},t),!t&&s().createElement("span",{className:"mailpoet-listing-status-unknown mailpoet-font-extra-small"},h.Z.I18n.t("notSentYet"))))})),(0,C.Z)(this,"renderSettings",(e=>{const t=pi[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 s().createElement("span",{className:"mailpoet-listing-error"},h.Z.I18n.t("automaticEmailEventOptionsNotConfigured"));let r,i;if(r=a.length>1&&"listingScheduleDisplayTextPlural"in t?R()(t.listingScheduleDisplayTextPlural,"%s",((e,t)=>s().createElement(_,{strings:a,key:t}))):R()(t.listingScheduleDisplayText,"%s",((e,t)=>s().createElement(_,{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 s().createElement("span",null,r,i&&s().createElement("div",{className:"mailpoet-listing-schedule"},s().createElement("div",{className:"mailpoet-listing-schedule-icon"},s().createElement(Ja,null)),i))})),(0,C.Z)(this,"renderItem",((e,t)=>{const n=g()("manage-column","column-primary","has-row-actions");return s().createElement("div",null,s().createElement("td",{className:n},s().createElement("a",{className:"mailpoet-listing-title",href:`?page=mailpoet-newsletter-editor&id=${e.id}`},e.subject),t),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("settings")},this.renderSettings(e)),!0===di?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("statistics")},s().createElement(br,{newsletter:e,isSent:e.total_sent>0&&!!e.statistics})):null,s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("lastModifiedOn")},h.Z.Date.short(e.updated_at),s().createElement("br",null),h.Z.Date.time(e.updated_at)))})),(0,C.Z)(this,"isItemInactive",(e=>"draft"===e.status)),this.state={eventCounts:{},newslettersCount:void 0},this.afterGetItems=this.afterGetItems.bind(this)}afterGetItems(e){mr(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:s().createElement("div",{className:"notice error"},s().createElement("p",null,h.Z.I18n.t("wooCommerceEmailsWarning")),s().createElement("p",null,s().createElement("a",{href:"?page=mailpoet-settings#woocommerce"},h.Z.I18n.t("wooCommerceEmailsWarningLink")))):null}render(){const{match:e,location:t}=this.props;return s().createElement(s().Fragment,null,this.renderWarning(),0===this.state.newslettersCount&&s().createElement(bt,{filter:e=>"woocommerce"===e.slug,hideScreenOptions:!1,hideClosingButton:!0}),0!==this.state.newslettersCount&&s().createElement(I(),{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:hi,bulk_actions:fi,item_actions:gi,messages:mi,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)}}))}}vi.propTypes={match:b().shape({params:b().shape({tab:b().string}).isRequired}).isRequired,location:b().object.isRequired};var bi=(0,d.withRouter)(vi),yi=()=>s().createElement(s().Fragment,null,s().createElement("style",{dangerouslySetInnerHTML:{__html:".wrap { margin: 0 !important; }"}})),wi=n(4840),Ei=n(53681);const _i=e=>{const t=e<.1?2:1;return h.Z.Num.toLocaleFixed(e,t)},Zi=({newsletter:e,isWoocommerceActive:t})=>{const n=e.total_sent||0;let a=0,r=0,i=0,o=0,l=0;n>0&&(a=100*e.statistics.clicked/n,r=100*e.statistics.opened/n,i=100*e.statistics.machineOpened/n,o=100*e.statistics.unsubscribed/n,l=100*e.statistics.bounced/n);const c=_i(a),u=_i(r),d=_i(i),p=_i(o),m=_i(l),f=n>=20&&e.statistics.opened>=5,g=s().createElement("div",{className:"mailpoet-statistics-value-small"},s().createElement("span",{className:"mailpoet-statistics-value-number"},u,"% "),h.Z.I18n.t("percentageOpened")),v=s().createElement("div",{className:"mailpoet-statistics-value-small"},s().createElement("span",{className:"mailpoet-statistics-value-number"},d,"% "),h.Z.I18n.t("percentageMachineOpened"),s().createElement(Be.default,{tooltip:R()(h.Z.I18n.t("percentageMachineOpenedTooltip"),/\[link](.*?)\[\/link]/,(e=>s().createElement("span",{style:{pointerEvents:"all"},key:"machine-opened-tooltip"},s().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=s().createElement("div",{className:"mailpoet-statistics-value-small"},s().createElement("span",{className:"mailpoet-statistics-value-number"},p,"% "),h.Z.I18n.t("percentageUnsubscribed")),y=s().createElement("div",{className:"mailpoet-statistics-value-small"},s().createElement("span",{className:"mailpoet-statistics-value-number"},m,"% "),h.Z.I18n.t("percentageBounced")),w=sr("clicked",a),E=s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-statistics-value"},s().createElement("span",{className:`mailpoet-statistics-value-number mailpoet-statistics-value-number-${w}`},c,"% "),h.Z.I18n.t("percentageClicked")),f&&s().createElement(lr,{isInverted:!1,stat:"clicked",rate:a,tooltipId:`clicked-${e.id||"0"}`,tooltipPlace:"right"}));return s().createElement("div",{className:"mailpoet-stats-general"},s().createElement(Ot.r.ThreeColumns,{className:"mailpoet-stats-general-top-row"},s().createElement("div",null,s().createElement("div",{className:"mailpoet-statistics-value-small"},h.Z.I18n.t("statsTotalSent"),": ",s().createElement("span",{className:"mailpoet-statistics-value-number"},n.toLocaleString()))),s().createElement("div",{className:"mailpoet-statistics-with-left-separator"},b),s().createElement("div",{className:"mailpoet-statistics-with-left-separator"},y)),s().createElement(Ot.r.ThreeColumns,null,s().createElement("div",null,E),s().createElement("div",{className:"mailpoet-statistics-with-left-separator"},g,v),t&&s().createElement("div",{className:"mailpoet-statistics-with-left-separator"},Ge().applyFilters("mailpoet_newsletters_revenues_stats",null,e.statistics.revenue)),!t&&s().createElement("div",null)),s().createElement("p",{className:"mailpoet-stats-general-read-more"},s().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"))))};Zi.propTypes={isWoocommerceActive:b().bool.isRequired};const Ii=({newsletter:e})=>{const t=e.queue.scheduled_at||e.queue.created_at;return s().createElement(Ot.r.ThreeColumns,{className:"mailpoet-stats-info"},s().createElement("div",{className:"mailpoet-grid-span-two-columns"},s().createElement(Ne.Z,{level:1},e.subject),s().createElement("div",null,s().createElement("b",null,h.Z.Date.short(t)," • ",h.Z.Date.time(t))),Array.isArray(e.segments)&&e.segments.length&&s().createElement("div",null,s().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("statsToSegments")),": ",s().createElement(_,{dimension:"large",segments:e.segments}))),s().createElement("div",{className:"mailpoet-stats-info-sender-preview"},s().createElement("div",null,s().createElement("div",{className:"mailpoet-stats-info-key-value"},s().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("statsFromAddress"),": "),e.sender_address?e.sender_address:"-"),s().createElement("div",{className:"mailpoet-stats-info-key-value"},s().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("statsReplyToAddress"),": "),e.reply_to_address?e.reply_to_address:"-"),s().createElement("div",{className:"mailpoet-stats-info-key-value"},s().createElement("span",{className:"mailpoet-stats-info-key"},h.Z.I18n.t("googleAnalytics"),": "),e.ga_campaign?e.ga_campaign:"-")),s().createElement("div",null,s().createElement(Re.Button,{href:e.preview_url,target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("statsPreviewNewsletter")))))},Si=()=>{const e=s().createElement(y.Z,{href:h.Z.MailPoetComUrlFactory.getFreePlanUrl({utm_medium:"stats",utm_campaign:"signup"}),target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("premiumBannerCtaFree")),t=s().createElement("p",null,h.Z.I18n.t("premiumBannerDescription")," ",s().createElement("a",{href:"admin.php?page=mailpoet-premium"},h.Z.I18n.t("learnMore")),".");return s().createElement("div",{className:"mailpoet-stats-premium-required"},s().createElement(et,{title:h.Z.I18n.t("premiumFeature"),message:t,actionButton:e}))};var ki=()=>{if(!window.mailpoet_display_detailed_stats)return s().createElement(Si,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 s().createElement("div",{className:"mailpoet-stats-premium-required"},s().createElement(et,{title:t,message:s().createElement("p",null,n),actionButton:s().createElement(y.Z,{target:"_blank",rel:"noopener noreferrer",href:a},h.Z.I18n.t("upgradeNow"))}))}return null};const Ci=({match:e,history:t,location:n})=>{const[a,r]=(0,o.useState)({item:void 0,loading:!0}),i=(0,o.useCallback)((e=>{r({loading:!0,item:a.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=>{r({loading:!1,item:e.data})})).fail((e=>{h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0}),r({loading:!1}),t.push("/")}))}),[t,a.item]);(0,o.useEffect)((()=>{var t;window.scrollTo(0,0),(null===(t=a.item)||void 0===t?void 0:t.id)!==e.params.id&&i(e.params.id)}),[e.params.id,i,a.item]);const{item:l,loading:c}=a,u=l;return c?null:null==u||!u.subject||null!=u&&u.queue?s().createElement(s().Fragment,null,s().createElement(Le.Z,null),s().createElement(yi,null),s().createElement(j.Q,null),s().createElement("div",{className:"mailpoet-stats-page"},s().createElement(L,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),s().createElement(Ii,{newsletter:u}),s().createElement(Zi,{newsletter:u,isWoocommerceActive:h.Z.isWoocommerceActive}),s().createElement(wi.Z,{activeKey:"clicked"},s().createElement(Ei.Z,{key:"clicked",title:h.Z.I18n.t("clickedLinks")},Ge().applyFilters("mailpoet_newsletters_clicked_links_table",s().createElement(ki,null),u.clicked_links)),Ge().applyFilters("mailpoet_newsletters_purchased_products",null,u),s().createElement(Ei.Z,{key:"engagement",title:h.Z.I18n.t("subscriberEngagement")},Ge().applyFilters("mailpoet_newsletters_subscriber_engagement",s().createElement(ki,null),n,e.params,u)),s().createElement(Ei.Z,{key:"bounces",title:h.Z.I18n.t("bounces"),automationId:"bounces-tab"},Ge().applyFilters("mailpoet_newsletters_bounces",s().createElement(ki,null),n,e.params))))):s().createElement("div",null,s().createElement(Ne.Z,{level:1},u.subject))};Ci.propTypes={match:b().shape({params:b().shape({id:b().string.isRequired}).isRequired}).isRequired,history:b().shape({push:b().func.isRequired}).isRequired,location:b().object.isRequired};var Ti=(0,d.withRouter)(Ci),Ni=n(48228),Di=n(87903),xi=n.n(Di);const Ri=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 s().createElement("div",{className:"mailpoet_review_request"},s().createElement("img",{src:e.reviewRequestIllustrationUrl,height:"280",width:"280",alt:""}),s().createElement("h2",null,h.Z.I18n.t("reviewRequestHeading")),s().createElement("p",null,h.Z.I18n.t("reviewRequestDidYouKnow").replace("[username]",e.username)),s().createElement("p",null,n),s().createElement("p",null,s().createElement("a",{href:"http://bit.ly/2Bi124o",target:"_blank",rel:"noopener noreferrer",className:"button button-primary"},h.Z.I18n.t("reviewRequestRateUsNow"))),s().createElement("p",null,s().createElement("a",{id:"mailpoet_review_request_not_now"},h.Z.I18n.t("reviewRequestNotNow"))))};Ri.propTypes={installedDaysAgo:b().number.isRequired,reviewRequestIllustrationUrl:b().string.isRequired,username:b().string.isRequired};var Oi=Ri;let Pi=null;const Mi=()=>((0,o.useLayoutEffect)((()=>{window.mailpoet_display_nps_poll&&h.Z.libs3rdPartyEnabled&&(Pi||(Pi=h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"analytics",action:"getTrackingData"})),Pi).then((({data:e})=>(e=>{let t;t=window.mailpoet_display_nps_form?"EqOgKsgZd832Sz9w":window.mailpoet_is_new_user?"6L479eVPXk7pBn6S":"k0aJAsQAWI2ERyGv",xi()({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:Zt.renderToString(Oi({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()))}})}}})})(e)))}),[]),null);var Li=e=>t=>(Mi(),s().createElement(e,t)),Ai=()=>s().createElement(s().Fragment,null,s().createElement(j.Q,null,s().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,s().createElement("span",null,h.Z.I18n.t("new"))))),Fi=(0,d.withRouter)((({children:e,location:t})=>null!==(0,yt.X)(t)||(e=>e.hash.match(new RegExp("^#/new"))||e.pathname.match(new RegExp("^/new")))(t)?null:e));const qi=({mailpoetInstalledDaysAgo:e,sendTransactionalEmails:t,mtaMethod:n,noticeDismissed:a,apiVersion:r})=>{const[i,l]=(0,o.useState)(!1),c=()=>{h.Z.Ajax.post({api_version:r,endpoint:"UserFlags",action:"set",data:{transactional_emails_opt_in_notice_dismissed:"1"}})};return e<30||t||"PHPMail"===n||"1"===a||i?null:s().createElement(O.Z,{type:"success",timeout:!1,onClose:c},s().createElement("h3",null,h.Z.I18n.t("transactionalEmailNoticeTitle")),s().createElement("p",null,h.Z.I18n.t("transactionalEmailNoticeBody")," ",s().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"))),s().createElement("p",null,s().createElement("button",{type:"button",className:"button",onClick:()=>{l(!0),h.Z.Ajax.post({api_version:r,endpoint:"settings",action:"set",data:{send_transactional_emails:"1"}}),c()}},h.Z.I18n.t("transactionalEmailNoticeCTA"))))};qi.propTypes={mailpoetInstalledDaysAgo:b().number.isRequired,sendTransactionalEmails:b().bool.isRequired,noticeDismissed:b().string.isRequired,mtaMethod:b().string.isRequired,apiVersion:b().string.isRequired};var $i=qi;const Ui=window.mailpoet_woocommerce_automatic_emails||[],ji=Li((()=>{const{parentId:e}=(0,d.useParams)();return s().createElement(s().Fragment,null,s().createElement(Fi,null,s().createElement(Ai,null)),s().createElement(Ni.Z,{activeKey:"standard",routerType:"switch-only",onSwitch:e=>(e=>h.Z.trackEvent(`Tab Emails > ${e} clicked`))(e),automationId:"newsletters_listing_tabs"},s().createElement(Ei.Z,{key:"standard",route:"standard/(.*)?",title:h.Z.I18n.t("tabStandardTitle"),automationId:`tab-${h.Z.I18n.t("tabStandardTitle")}`},s().createElement(kr,null)),s().createElement(Ei.Z,{key:"welcome",route:"welcome/(.*)?",title:h.Z.I18n.t("tabWelcomeTitle"),automationId:`tab-${h.Z.I18n.t("tabWelcomeTitle")}`},s().createElement(Mr,null)),s().createElement(Ei.Z,{key:"notification",route:"notification/(.*)?",title:h.Z.I18n.t("tabNotificationTitle"),automationId:`tab-${h.Z.I18n.t("tabNotificationTitle")}`},e?s().createElement(ni,{parentId:e}):s().createElement(Ur,null)),s().createElement(Ei.Z,{key:"re_engagement",route:"re_engagement/(.*)?",title:h.Z.I18n.t("tabReEngagementTitle"),automationId:`tab-${h.Z.I18n.t("tabReEngagementTitle")}`},s().createElement(zr,null)),window.mailpoet_woocommerce_active&&T.ZP.map(Ui,(e=>s().createElement(Ei.Z,{key:e.slug,route:`${e.slug}/(.*)?`,title:e.title,automationId:`tab-${e.title}`},s().createElement(bi,null))))))})),Wi=({history:e})=>s().createElement(bt,{history:e,hideClosingButton:0===window.mailpoet_newsletters_count});Wi.propTypes={history:b().shape({push:b().func.isRequired}).isRequired};const Vi=[...(()=>{const e=[];return T.ZP.each(Ui,(t=>{e.push({path:`/${t.slug}/(.*)?`,component:ji});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 s().createElement(ja,a)}})})),e.push({path:`/new/${t.slug}`,render:e=>{const n={...e,email:t};return s().createElement(pt,n)}})})),e})(),{path:"/notification/history/:parentId/(.*)?",component:ji},{path:"/(standard|welcome|notification|re_engagement)/(.*)?",component:ji},{path:"/new/standard",component:Pa},{path:"/new/notification",component:Aa},{path:"/new/welcome",component:$a},{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,o.useState)({afterTimeNumber:e,afterTimeType:"months"}),[a,r]=(0,o.useState)([]),[i,l]=(0,o.useState)(!1),c=(0,d.useHistory)();return s().createElement("div",null,s().createElement(Me.Z,{color:"#fff"}),a&&s().createElement(gt,{errors:a}),s().createElement(wt,{emailType:"re_engagement",automationId:"re_engagement_heading_creation_heading"}),s().createElement(Ot.r.Column,{align:"center",className:"mailpoet-schedule-email"},s().createElement(Gn,{afterTimeNumber:t.afterTimeNumber,afterTimeType:t.afterTimeType,inactiveSubscribersPeriod:Number(h.Z.settings.deactivate_subscriber_after_inactive_days),updateAfterTimeNumber:(0,zn.compose)([n,(0,zn.assoc)("afterTimeNumber",zn.__,t)]),updateAfterTimeType:(0,zn.compose)([n,(0,zn.assoc)("afterTimeType",zn.__,t)])}),s().createElement(y.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:Wi},{name:"template",path:"/template/:id",component:Rt},{path:"/send/congratulate/:id",component:Ra},{path:"/send/:id",component:sa},{path:"/sending-status/:id/(.*)?",component:ui},{path:"/stats/:id/(.*)?",component:Ti}],Yi=()=>s().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},s().createElement(u.UT,null,s().createElement(ot.Z,null),s().createElement(P,null),s().createElement($i,{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}),s().createElement(L,{mssKeyInvalid:window.mailpoet_mss_key_invalid,subscribersCount:window.mailpoet_subscribers_count}),s().createElement(d.Switch,null,s().createElement(d.Route,{exact:!0,path:"/",render:()=>s().createElement(d.Redirect,{to:0===window.mailpoet_newsletters_count?"/new":"/standard"})}),Vi.map((e=>s().createElement(d.Route,{key:e.path,path:e.path,component:e.component,name:e.name||null,data:e.data||null,render:e.render})))))),Bi=document.getElementById("newsletters_container");Bi&&(window.mailpoet_listing=c().render(s().createElement(Yi,null),Bi));const Hi=e=>"wp_users"===e.type,zi=e=>"woocommerce_users"===e.type,Ki=e=>Hi(e)||zi(e),Gi=!!window.mailpoet_tracking_enabled,Qi=[{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:Gi},{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}],Xi={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)}},Ji=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:Xi.onTrash}],eo=e=>!Ki(e),to=[{name:"edit",className:"mailpoet-hide-on-mobile",link:function(e){return s().createElement(u.rU,{to:`/edit/${e.id}`},h.Z.I18n.t("edit"))},display:function(e){return!Ki(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!Ki(e)}},{name:"read_more",className:"mailpoet-hide-on-mobile",link:function(){return s().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 Hi(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((()=>{h.Z.Modal.loading(!1),h.Z.Notice.success(h.Z.I18n.t("listSynchronized").replace("%1$s",e.name)),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 Hi(e)||zi(e)}},{name:"view_subscribers",link:function(e){return s().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!zi(e)}}];class no extends s().Component{constructor(...e){super(...e),(0,C.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),o=Number(e.subscribers_count.inactive||0),l=Number(e.subscribers_count.bounced||0);let c;return c=Ki(e)?s().createElement("span",{className:"mailpoet-listing-title"},e.name):s().createElement(u.rU,{className:"mailpoet-listing-title",to:`/edit/${e.id}`},e.name),s().createElement("div",null,s().createElement("td",{className:n,"data-automation-id":`segment_name_${e.name}`},c,t),s().createElement("td",{"data-colname":h.Z.I18n.t("description")},s().createElement("abbr",null,e.description)),Gi?s().createElement("td",{className:"column mailpoet-listing-stats-column","data-colname":h.Z.I18n.t("averageScore")},s().createElement("div",{className:"mailpoet-listing-stats"},s().createElement(K,{id:e.id,engagementScore:e.average_engagement_score}))):null,s().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribed")},s().createElement("abbr",null,a.toLocaleString())),s().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("unconfirmed")},s().createElement("abbr",null,r.toLocaleString())),s().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("unsubscribed")},s().createElement("abbr",null,i.toLocaleString())),s().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("inactive")},s().createElement("abbr",null,o.toLocaleString())),s().createElement("td",{className:"mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("bounced")},s().createElement("abbr",null,l.toLocaleString())),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("createdOn")},h.Z.Date.short(e.created_at),s().createElement("br",null),h.Z.Date.time(e.created_at)))}))}render(){return s().createElement("div",{className:"mailpoet-segments-listing"},s().createElement(I(),{limit:window.mailpoet_listing_per_page,location:this.props.location,params:this.props.match.params,messages:Xi,search:!1,endpoint:"segments",base_url:"lists",onRenderItem:this.renderItem,columns:Qi,bulk_actions:Ji,item_actions:to,sort_by:"name",sort_order:"asc",isItemDeletable:eo,isItemToggleable:Hi}))}}no.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var ao=(0,d.withRouter)(no);const ro=[{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")}],io={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")}},oo=e=>s().createElement("div",null,s().createElement(Me.Z,{color:"#fff"}),s().createElement(Le.Z,null),s().createElement(Ne.Z,{level:1,className:"mailpoet-title"},s().createElement("span",null,h.Z.I18n.t("segment")),s().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:"/"},h.Z.I18n.t("backToList"))),s().createElement(P,null),s().createElement(Pe,{endpoint:"segments",fields:ro,params:e.match.params,messages:io}));oo.propTypes={match:b().shape({params:b().shape({id:b().string}).isRequired}).isRequired};var so=oo,lo=n(41882),co=n(94878),uo=n(14772);let po,mo,ho,fo,go;!function(e){e.Email="email",e.WordPressRole="userRole",e.SubscribedDate="subscribedDate",e.WooCommerce="woocommerce",e.WooCommerceSubscription="woocommerceSubscription"}(po||(po={})),function(e){e.OPENS_ABSOLUTE_COUNT="opensAbsoluteCount",e.MACHINE_OPENS_ABSOLUTE_COUNT="machineOpensAbsoluteCount",e.OPENED="opened",e.MACHINE_OPENED="machineOpened",e.NOT_OPENED="notOpened",e.CLICKED="clicked",e.CLICKED_ANY="clickedAny",e.NOT_CLICKED="notClicked"}(mo||(mo={})),function(e){e.MAILPOET_CUSTOM_FIELD="mailpoetCustomField",e.WORDPRESS_ROLE="wordpressRole",e.SUBSCRIBED_DATE="subscribedDate",e.SUBSCRIBER_SCORE="subscriberScore"}(ho||(ho={})),function(e){e.AND="and",e.OR="or"}(fo||(fo={})),function(e){e.SET_SEGMENT="SET_SEGMENT",e.SET_ERRORS="SET_ERRORS",e.UPDATE_SEGMENT="UPDATE_SEGMENT",e.UPDATE_SEGMENT_FILTER="UPDATE_SEGMENT_FILTER",e.UPDATE_SUBSCRIBER_COUNT="UPDATE_SUBSCRIBER_COUNT"}(go||(go={}));const vo=()=>{const e=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),{updateSegment:t}=(0,lo.Z)("mailpoet-dynamic-segments-form");return e.filters.length<=1?null:s().createElement(s().Fragment,null,s().createElement("div",null,s().createElement("label",{className:"mailpoet-form-radio","data-automation-id":"dynamic-segment-condition-type-and"},s().createElement("input",{type:"radio",value:fo.AND,checked:e.filters_connect===fo.AND,onChange:e=>t({filters_connect:e.target.value})}),s().createElement("span",{className:"mailpoet-form-radio-control"}),s().createElement("span",null,R()(h.Z.I18n.t("allConditions"),/<strong>(.*?)<\/strong>/g,((e,t)=>s().createElement("strong",{key:t},e))))),s().createElement("label",{className:"mailpoet-form-radio","data-automation-id":"dynamic-segment-condition-type-or"},s().createElement("input",{type:"radio",value:fo.OR,checked:e.filters_connect===fo.OR,onChange:e=>t({filters_connect:e.target.value})}),s().createElement("span",{className:"mailpoet-form-radio-control"}),s().createElement("span",null,R()(h.Z.I18n.t("anyConditions"),/<strong>(.*?)<\/strong>/g,((e,t)=>s().createElement("strong",{key:t},e)))))),s().createElement("div",{className:"mailpoet-gap"}))},bo=({index:e})=>{const t=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]);return t.filters.length<=1||e===t.filters.length-1?s().createElement("div",{className:"mailpoet-gap"}):s().createElement("p",null,s().createElement("span",{className:"mailpoet-gap"}),s().createElement("strong",null,t.filters_connect===fo.AND?h.Z.I18n.t("filterConnectAnd").toUpperCase():h.Z.I18n.t("filterConnectOr").toUpperCase()))};bo.propTypes={index:b().number.isRequired};const yo=(e,t)=>(e===mo.CLICKED||e===mo.NOT_CLICKED)&&null!=t,wo=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n}=(0,lo.Z)("mailpoet-dynamic-segments-form"),a=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getNewslettersList()),[]),[r,i]=(0,o.useState)([]),[l,c]=(0,o.useState)([]),[u,d]=(0,o.useState)(!1),p=null==a?void 0:a.map((e=>{const t=e.sent_at?h.Z.Date.format(e.sent_at):h.Z.I18n.t("notSentYet");return{label:`${e.subject} (${t})`,value:e.id}})),m=(0,o.useCallback)((()=>{var e;yo(t.action,t.newsletter_id)&&(c([]),e=t.newsletter_id,i([]),d(!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})));d(!1),c(n)})).fail((e=>{i(e.errors)})))}),[t.action,t.newsletter_id]);return(0,o.useEffect)((()=>{m()}),[m,t.action,t.newsletter_id]),s().createElement(s().Fragment,null,r.length>0&&s().createElement(gt,{errors:r}),s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectNewsletterPlaceholder"),options:p,value:(0,zn.find)(["value",t.newsletter_id],p),onChange:t=>{n({newsletter_id:t.value},e)},automationId:"segment-email"})),u&&h.Z.I18n.t("loadingDynamicSegmentItems"),!!l.length&&yo(t.action,t.newsletter_id)&&s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectLinkPlaceholder"),options:l,value:(0,zn.find)(["value",Number(t.link_id)],l),onChange:t=>{n({link_id:t.value},e)}})))};wo.propTypes={filterIndex:b().number.isRequired};const Eo=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n,updateSegmentFilterFromEvent:a}=(0,lo.Z)("mailpoet-dynamic-segments-form");return(0,o.useEffect)((()=>{void 0===t.operator&&n({operator:"more"},e)}),[n,t,e]),s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,(r=n=>"{condition}"===n?s().createElement(fe.Z,{key:"select",value:t.operator,onChange:t=>{a("operator",e,t)}},s().createElement("option",{value:"more"},h.Z.I18n.t("moreThan")),s().createElement("option",{value:"less"},h.Z.I18n.t("lessThan"))):"{opens}"===n?s().createElement(ce.Z,{key:"input",type:"number",value:t.opens||"","data-automation-id":"segment-number-of-opens",onChange:t=>{a("opens",e,t)},min:"0",placeholder:h.Z.I18n.t("emailActionOpens")}):"string"==typeof n&&n.trim().length>1?s().createElement("div",{key:"opens"},n):null,h.Z.I18n.t("emailActionOpensSentence").split(/({condition})|({opens})|(\b[a-zA-Z]+\b)/gim).map(r))),s().createElement(Ot.r.CenteredRow,null,h.Z.I18n.t("emailActionOpensDaysSentence").split(/({days})/gim).map((n=>"{days}"===n?s().createElement(ce.Z,{key:"input",type:"number",value:t.days||"","data-automation-id":"segment-number-of-days",onChange:t=>{a("days",e,t)},min:"0",placeholder:h.Z.I18n.t("emailActionDays")}):"string"==typeof n&&n.trim().length>1?s().createElement("div",{key:n},n):null))));var r};Eo.propTypes={filterIndex:b().number.isRequired};const _o=[{value:mo.OPENS_ABSOLUTE_COUNT,label:h.Z.I18n.t("emailActionOpensAbsoluteCount"),group:po.Email},{value:mo.MACHINE_OPENS_ABSOLUTE_COUNT,label:h.Z.I18n.t("emailActionMachineOpensAbsoluteCount"),group:po.Email},{value:mo.OPENED,label:h.Z.I18n.t("emailActionOpened"),group:po.Email},{value:mo.MACHINE_OPENED,label:h.Z.I18n.t("emailActionMachineOpened"),group:po.Email},{value:mo.NOT_OPENED,label:h.Z.I18n.t("emailActionNotOpened"),group:po.Email},{value:mo.CLICKED,label:h.Z.I18n.t("emailActionClicked"),group:po.Email},{value:mo.CLICKED_ANY,label:h.Z.I18n.t("emailActionClickedAnyEmail"),group:po.Email},{value:mo.NOT_CLICKED,label:h.Z.I18n.t("emailActionNotClicked"),group:po.Email}],Zo={[mo.OPENS_ABSOLUTE_COUNT]:Eo,[mo.MACHINE_OPENS_ABSOLUTE_COUNT]:Eo,[mo.CLICKED]:wo,[mo.NOT_CLICKED]:wo,[mo.OPENED]:wo,[mo.MACHINE_OPENED]:wo,[mo.NOT_OPENED]:wo,[mo.CLICKED_ANY]:null},Io=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),n=Zo[t.action];return n?s().createElement(n,{filterIndex:e}):null};var So;Io.propTypes={filterIndex:b().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"}(So||(So={}));const ko=[{value:So.CUSTOMER_IN_COUNTRY,label:h.Z.I18n.t("wooCustomerInCountry"),group:po.WooCommerce},{value:So.NUMBER_OF_ORDERS,label:h.Z.I18n.t("wooNumberOfOrders"),group:po.WooCommerce},{value:So.PURCHASED_CATEGORY,label:h.Z.I18n.t("wooPurchasedCategory"),group:po.WooCommerce},{value:So.PURCHASED_PRODUCT,label:h.Z.I18n.t("wooPurchasedProduct"),group:po.WooCommerce},{value:So.TOTAL_SPENT,label:h.Z.I18n.t("wooTotalSpent"),group:po.WooCommerce}],Co=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n,updateSegmentFilterFromEvent:a}=(0,lo.Z)("mailpoet-dynamic-segments-form"),r=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getProductCategories()),[]),i=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCountries()),[]),l=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getProducts()),[]),c=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getWooCommerceCurrencySymbol()),[]),u=l.map((e=>({value:e.id,label:e.name}))),d=r.map((e=>({value:e.id,label:e.name}))),p=i.map((e=>({value:e.code,label:e.name})));let m;return(0,o.useEffect)((()=>{void 0===t.number_of_orders_type&&t.action===So.NUMBER_OF_ORDERS&&n({number_of_orders_type:"="},e),void 0===t.total_spent_type&&t.action===So.TOTAL_SPENT&&n({total_spent_type:">"},e)}),[n,t,e]),t.action===So.PURCHASED_PRODUCT?m=s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",key:"select-segment-product",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooPurchasedProduct"),options:u,value:(0,zn.find)(["value",t.product_id],u),onChange:t=>n({product_id:t.value},e),automationId:"select-segment-product"})):t.action===So.PURCHASED_CATEGORY?m=s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",key:"select-segment-category",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooPurchasedCategory"),options:d,value:(0,zn.find)(["value",t.category_id],d),onChange:t=>n({category_id:t.value},e),automationId:"select-segment-category"})):t.action===So.NUMBER_OF_ORDERS?m=s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select",value:t.number_of_orders_type,onChange:t=>{a("number_of_orders_type",e,t)},automationId:"select-number-of-orders-type"},s().createElement("option",{value:"="},h.Z.I18n.t("equal")),s().createElement("option",{value:">"},h.Z.I18n.t("moreThan")),s().createElement("option",{value:"<"},h.Z.I18n.t("lessThan"))),s().createElement(ce.Z,{"data-automation-id":"input-number-of-orders-count",type:"number",min:0,value:t.number_of_orders_count||"",placeholder:h.Z.I18n.t("wooNumberOfOrdersCount"),onChange:t=>{a("number_of_orders_count",e,t)}}),s().createElement("div",null,h.Z.I18n.t("wooNumberOfOrdersOrders"))),s().createElement(Ot.r.CenteredRow,null,s().createElement("div",null,h.Z.I18n.t("inTheLast")),s().createElement(ce.Z,{"data-automation-id":"input-number-of-orders-days",type:"number",min:1,value:t.number_of_orders_days||"",placeholder:h.Z.I18n.t("daysPlaceholder"),onChange:t=>{a("number_of_orders_days",e,t)}}),s().createElement("div",null,h.Z.I18n.t("days")))):t.action===So.TOTAL_SPENT?m=s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select",value:t.total_spent_type,onChange:t=>{a("total_spent_type",e,t)},automationId:"select-total-spent-type"},s().createElement("option",{value:">"},h.Z.I18n.t("moreThan")),s().createElement("option",{value:"<"},h.Z.I18n.t("lessThan"))),s().createElement(ce.Z,{"data-automation-id":"input-total-spent-amount",type:"number",min:0,step:.01,value:t.total_spent_amount||"",placeholder:h.Z.I18n.t("wooTotalSpentAmount"),onChange:t=>{a("total_spent_amount",e,t)}}),s().createElement("div",null,c)),s().createElement(Ot.r.CenteredRow,null,s().createElement("div",null,h.Z.I18n.t("inTheLast")),s().createElement(ce.Z,{"data-automation-id":"input-total-spent-days",type:"number",min:1,value:t.total_spent_days||"",placeholder:h.Z.I18n.t("daysPlaceholder"),onChange:t=>{a("total_spent_days",e,t)}}),s().createElement("div",null,h.Z.I18n.t("days")))):t.action===So.CUSTOMER_IN_COUNTRY&&(m=s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",key:"select-segment-country",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooCountry"),options:p,value:(0,zn.find)(["value",t.country_code],p),onChange:t=>n({country_code:t.value},e),automationId:"select-segment-country"}))),m};Co.propTypes={filterIndex:b().number.isRequired};const To=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n}=(0,lo.Z)("mailpoet-dynamic-segments-form"),a=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getWordpressRoles()),[]).map((e=>({value:e.role_id,label:e.role_name})));return s().createElement("div",null,s().createElement(uo.Z,{isFullWidth:!0,placeholder:h.Z.I18n.t("selectUserRolePlaceholder"),options:a,value:(0,zn.find)((e=>{if(t.wordpressRole)return t.wordpressRole.toLowerCase()===e.value.toLowerCase()}),a),onChange:t=>{n({wordpressRole:t.value},e)},automationId:"segment-wordpress-role"}))};let No;To.propTypes={filterIndex:b().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"}(No||(No={}));const Do=[No.HIGHER_THAN,No.LOWER_THAN,No.EQUALS,No.NOT_EQUALS,No.UNKNOWN,No.NOT_UNKNOWN],xo=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n,updateSegmentFilterFromEvent:a}=(0,lo.Z)("mailpoet-dynamic-segments-form");return(0,o.useEffect)((()=>{Do.includes(t.operator)||n({operator:No.HIGHER_THAN},e),t.operator!==No.HIGHER_THAN&&t.operator!==No.LOWER_THAN&&t.operator!==No.EQUALS&&t.operator!==No.NOT_EQUALS||void 0!==t.value||n({value:""},e),t.operator!==No.UNKNOWN&&t.operator!==No.NOT_UNKNOWN||n({value:null},e)}),[n,t,e]),s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,(r=n=>"{condition}"===n?s().createElement(fe.Z,{key:"select",value:t.operator,automationId:"segment-subscriber-score-operator",onChange:t=>{a("operator",e,t)}},s().createElement("option",{value:No.HIGHER_THAN},h.Z.I18n.t("higherThan")),s().createElement("option",{value:No.LOWER_THAN},h.Z.I18n.t("lowerThan")),s().createElement("option",{value:No.EQUALS},h.Z.I18n.t("equals")),s().createElement("option",{value:No.NOT_EQUALS},h.Z.I18n.t("notEquals")),s().createElement("option",{value:No.UNKNOWN},h.Z.I18n.t("unknown")),s().createElement("option",{value:No.NOT_UNKNOWN},h.Z.I18n.t("notUnknown"))):"{score}"===n?(t.operator===No.HIGHER_THAN||t.operator===No.LOWER_THAN||t.operator===No.EQUALS||t.operator===No.NOT_EQUALS)&&s().createElement(ce.Z,{key:"input",type:"number",value:t.value||"","data-automation-id":"segment-subscriber-score-value",onChange:t=>{a("value",e,t)},min:"0",placeholder:h.Z.I18n.t("subscriberScorePlaceholder")}):"string"==typeof n&&n.trim().length>0?t.operator!==No.UNKNOWN&&t.operator!==No.NOT_UNKNOWN&&s().createElement("div",{key:"score"},n):null,h.Z.I18n.t("subscriberScoreSentence").split(/({condition})|({score})|(\b%\b)/gim).map(r))));var r};xo.propTypes={filterIndex:b().number.isRequired};var Ro=n(23855),Oo=n(12274);let Po;!function(e){e.BEFORE="before",e.AFTER="after",e.IN_THE_LAST="inTheLast",e.NOT_IN_THE_LAST="notInTheLast"}(Po||(Po={}));const Mo=[Po.BEFORE,Po.AFTER,Po.IN_THE_LAST,Po.NOT_IN_THE_LAST],Lo=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"})}},Ao=e=>{const t=(0,Ro.default)(e);if((0,Oo.default)(t))return t},Fo=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n,updateSegmentFilterFromEvent:a}=(0,lo.Z)("mailpoet-dynamic-segments-form");return(0,o.useEffect)((()=>{Mo.includes(t.operator)||n({operator:Po.BEFORE},e),t.operator!==Po.BEFORE&&t.operator!==Po.AFTER||void 0!==Ao(t.value)&&new RegExp(/^\d+-\d+-\d+$/).test(t.value)||n({value:Lo(new Date)},e),t.operator!==Po.IN_THE_LAST&&t.operator!==Po.NOT_IN_THE_LAST||"string"!=typeof t.value||new RegExp(/^\d*$/).exec(t.value)||n({value:""},e)}),[n,t,e]),s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select",value:t.operator,onChange:t=>{a("operator",e,t)}},s().createElement("option",{value:Po.BEFORE},h.Z.I18n.t("before")),s().createElement("option",{value:Po.AFTER},h.Z.I18n.t("after")),s().createElement("option",{value:Po.IN_THE_LAST},h.Z.I18n.t("inTheLast")),s().createElement("option",{value:Po.NOT_IN_THE_LAST},h.Z.I18n.t("notInTheLast"))),(t.operator===Po.BEFORE||t.operator===Po.AFTER)&&s().createElement(At,{dateFormat:"MMMM d, yyyy",onChange:t=>{n({value:Lo(t)},e)},maxDate:new Date,selected:t.value?Ao(t.value):void 0}),(t.operator===Po.IN_THE_LAST||t.operator===Po.NOT_IN_THE_LAST)&&s().createElement(s().Fragment,null,s().createElement(ce.Z,{key:"input",type:"number",value:t.value,onChange:t=>{a("value",e,t)},min:"1",placeholder:h.Z.I18n.t("daysPlaceholder")}),s().createElement("span",null,h.Z.I18n.t("daysPlaceholder")))))};function qo(e){return"string"==typeof e.value&&e.value.length>0&&("equals"===e.operator||"contains"===e.operator)}Fo.propTypes={filterIndex:b().number.isRequired};const $o=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilterFromEvent:n,updateSegmentFilter:a}=(0,lo.Z)("mailpoet-dynamic-segments-form");return(0,o.useEffect)((()=>{void 0===t.operator&&a({operator:"equals",value:""},e)}),[a,t,e]),s().createElement(s().Fragment,null,s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select",automationId:"text-custom-field-operator",value:t.operator,onChange:t=>{n("operator",e,t)}},s().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),s().createElement("option",{value:"contains"},h.Z.I18n.t("contains"))),s().createElement(ce.Z,{key:"input","data-automation-id":"text-custom-field-value",value:t.value||"",onChange:t=>{n("value",e,t)},placeholder:h.Z.I18n.t("value")})))};function Uo(e){return"string"==typeof e.value&&e.value.length>0}$o.propTypes={filterIndex:b().number.isRequired};const jo=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n}=(0,lo.Z)("mailpoet-dynamic-segments-form"),a=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),r=(0,zn.find)({id:Number(t.custom_field_id)},a);if(!r)return null;const i=r.params;if(!i||!Array.isArray(i.values))return null;const o=i.values.map((e=>({value:e.value,label:e.value})));return s().createElement(s().Fragment,null,s().createElement(uo.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectValue"),options:o,value:t.value?{value:t.value,label:t.value}:null,onChange:t=>{n({value:t.value,operator:"equals"},e)},automationId:"segment-wordpress-role"}))};jo.propTypes={filterIndex:b().number.isRequired};const Wo=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilterFromEvent:n,updateSegmentFilter:a}=(0,lo.Z)("mailpoet-dynamic-segments-form");return(0,o.useEffect)((()=>{"1"!==t.value&&"0"!==t.value&&a({operator:"equals",value:"1"},e)}),[a,t,e]),s().createElement(s().Fragment,null,s().createElement(fe.Z,{key:"select",value:t.value,onChange:t=>n("value",e,t)},s().createElement("option",{value:"1"},h.Z.I18n.t("checked")),s().createElement("option",{value:"0"},h.Z.I18n.t("unchecked"))))};Wo.propTypes={filterIndex:b().number.isRequired};var Vo=n(95570),Yo=n(49546);const Bo=({onChange:e,item:t,filterIndex:n})=>((0,o.useEffect)((()=>{void 0!==t.value&&""!==t.value||e((0,zn.assign)(t,{value:"2017-01-01 00:00:00"}),n)}),[e,t,n]),s().createElement(fe.Z,{key:"select",value:t.value,onChange:a=>{e((0,zn.assign)(t,{value:a.target.value}),n)}},s().createElement("option",{value:"2017-01-01 00:00:00"},h.Z.I18n.t("january")),s().createElement("option",{value:"2017-02-01 00:00:00"},h.Z.I18n.t("february")),s().createElement("option",{value:"2017-03-01 00:00:00"},h.Z.I18n.t("march")),s().createElement("option",{value:"2017-04-01 00:00:00"},h.Z.I18n.t("april")),s().createElement("option",{value:"2017-05-01 00:00:00"},h.Z.I18n.t("may")),s().createElement("option",{value:"2017-06-01 00:00:00"},h.Z.I18n.t("june")),s().createElement("option",{value:"2017-07-01 00:00:00"},h.Z.I18n.t("july")),s().createElement("option",{value:"2017-08-01 00:00:00"},h.Z.I18n.t("august")),s().createElement("option",{value:"2017-09-01 00:00:00"},h.Z.I18n.t("september")),s().createElement("option",{value:"2017-10-01 00:00:00"},h.Z.I18n.t("october")),s().createElement("option",{value:"2017-11-01 00:00:00"},h.Z.I18n.t("november")),s().createElement("option",{value:"2017-12-01 00:00:00"},h.Z.I18n.t("december"))));Bo.propTypes={filterIndex:b().number.isRequired};const Ho=({onChange:e,item:t,filterIndex:n})=>{const a=(0,Vo.default)(new Date);return(0,o.useEffect)((()=>{void 0!==t.value&&""!==t.value||e((0,zn.assign)(t,{value:`${a}-01-01 00:00:00`,operator:"equals"}),n)}),[a,e,t,n]),s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select-operator",value:t.operator,onChange:a=>{e((0,zn.assign)(t,{operator:a.target.value}),n)}},s().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),s().createElement("option",{value:"before"},h.Z.I18n.t("before")),s().createElement("option",{value:"after"},h.Z.I18n.t("after"))),s().createElement(fe.Z,{key:"select-year",value:t.value,onChange:a=>{e((0,zn.assign)(t,{value:a.target.value}),n)}},(0,zn.range)(0,100).map((e=>s().createElement("option",{value:a-e+"-01-01 00:00:00",key:a-e},a-e)))))};Ho.propTypes={filterIndex:b().number.isRequired};const zo=e=>{if(null!==e){if(Array.isArray(e))throw new Error("convertDateToString can process only single date array given");return(0,Yo.default)(e,"yyyy-MM-dd 00:00:00")}},Ko=e=>{const t=(0,Ro.default)(e);if((0,Oo.default)(t))return t},Go=({onChange:e,item:t,filterIndex:n})=>((0,o.useEffect)((()=>{void 0!==t.value&&""!==t.value||e((0,zn.assign)(t,{value:`${(0,Yo.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),n)}),[e,t,n]),s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select-operator",value:t.operator,onChange:a=>{e((0,zn.assign)(t,{operator:a.target.value}),n)}},s().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),s().createElement("option",{value:"before"},h.Z.I18n.t("before")),s().createElement("option",{value:"after"},h.Z.I18n.t("after"))),s().createElement(At,{dateFormat:"MMMM d, yyyy",onChange:a=>e((0,zn.assign)(t,{value:zo(a)}),n),selected:t.value?Ko(t.value):void 0})));Go.propTypes={filterIndex:b().number.isRequired};const Qo=({onChange:e,item:t,filterIndex:n})=>((0,o.useEffect)((()=>{void 0!==t.value&&""!==t.value||e((0,zn.assign)(t,{value:`${(0,Yo.default)(new Date,"yyyy-MM-dd")} 00:00:00`,operator:"equals"}),n)}),[e,t,n]),s().createElement(Ot.r.CenteredRow,null,s().createElement(fe.Z,{key:"select-operator",value:t.operator,onChange:a=>{e((0,zn.assign)(t,{operator:a.target.value}),n)}},s().createElement("option",{value:"equals"},h.Z.I18n.t("equals")),s().createElement("option",{value:"before"},h.Z.I18n.t("before")),s().createElement("option",{value:"after"},h.Z.I18n.t("after"))),s().createElement(At,{onChange:a=>e((0,zn.assign)(t,{value:zo(a)}),n),selected:t.value?Ko(t.value):void 0,dateFormat:"MM/yyyy",showMonthYearPicker:!0})));Qo.propTypes={filterIndex:b().number.isRequired};const Xo={month:Bo,year:Ho,year_month:Qo,year_month_day:Go},Jo=({customField:e,filterIndex:t})=>{const n=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSegmentFilter(t)),[t]),{updateSegmentFilter:a}=(0,lo.Z)("mailpoet-dynamic-segments-form");(0,o.useEffect)((()=>{n.date_type!==e.params.date_type&&a({date_type:e.params.date_type,value:""},t)}),[n.date_type,a,e.params.date_type,t]);const r=Xo[e.params.date_type];return r?s().createElement(s().Fragment,null,s().createElement(r,{item:n,onChange:a,filterIndex:t})):null};var es;Jo.propTypes={customField:b().shape({params:b().shape({date_type:b().string.isRequired}).isRequired}).isRequired,filterIndex:b().number.isRequired},function(e){e.DATE="date",e.TEXT="text",e.TEXTAREA="textarea",e.RADIO="radio",e.CHECKBOX="checkbox",e.SELECT="select"}(es||(es={}));const ts={[es.TEXT]:qo,[es.TEXTAREA]:qo,[es.RADIO]:Uo,[es.SELECT]:Uo,[es.CHECKBOX]:function(e){return"1"===e.value||"0"===e.value},[es.DATE]:function(e){return("month"===e.date_type||!("string"!=typeof e.operator||e.operator.length<1))&&"string"==typeof e.value&&e.value.length>1}},ns={[es.TEXT]:$o,[es.TEXTAREA]:$o,[es.RADIO]:jo,[es.SELECT]:jo,[es.CHECKBOX]:Wo,[es.DATE]:Jo},as=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n}=(0,lo.Z)("mailpoet-dynamic-segments-form"),a=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getCustomFieldsList()),[]),r=(0,zn.find)({id:Number(t.custom_field_id)},a),i=a.map((e=>({value:e.id.toString(),label:e.name}))),o=ns[t.custom_field_type];return s().createElement(s().Fragment,null,s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectCustomFieldPlaceholder"),options:i,automationId:"select-custom-field",value:(0,zn.find)((e=>{if(t.custom_field_id)return t.custom_field_id===e.value}),i),onChange:t=>{const r=(0,zn.find)({id:Number(t.value)},a);r&&n({custom_field_id:t.value,custom_field_type:r.type,operator:void 0,value:void 0},e)}})),s().createElement("div",null,o&&s().createElement(o,{customField:r,filterIndex:e})))};as.propTypes={filterIndex:b().number.isRequired};const rs=[{value:ho.MAILPOET_CUSTOM_FIELD,label:h.Z.I18n.t("mailpoetCustomField"),group:po.WordPressRole},{value:ho.SUBSCRIBER_SCORE,label:h.Z.I18n.t("subscriberScore"),group:po.WordPressRole},{value:ho.SUBSCRIBED_DATE,label:h.Z.I18n.t("subscribedDate"),group:po.WordPressRole},{value:ho.WORDPRESS_ROLE,label:h.Z.I18n.t("segmentsSubscriber"),group:po.WordPressRole}],is={[ho.WORDPRESS_ROLE]:To,[ho.SUBSCRIBER_SCORE]:xo,[ho.SUBSCRIBED_DATE]:Fo,[ho.MAILPOET_CUSTOM_FIELD]:as},os=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]);let n;return n=t.action?is[t.action]:To,n?s().createElement(n,{filterIndex:e}):null};var ss;os.propTypes={filterIndex:b().number.isRequired},function(e){e.ACTIVE_SUBSCRIPTIONS="hasActiveSubscription"}(ss||(ss={}));const ls=[{value:ss.ACTIVE_SUBSCRIPTIONS,label:h.Z.I18n.t("segmentsActiveSubscription"),group:po.WooCommerceSubscription}],cs=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]),{updateSegmentFilter:n}=(0,lo.Z)("mailpoet-dynamic-segments-form"),a=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriptionProducts()),[]).map((e=>({value:e.id,label:e.name})));return s().createElement("div",null,s().createElement(uo.Z,{dimension:"small",isFullWidth:!0,placeholder:h.Z.I18n.t("selectWooSubscription"),automationId:"segment-woo-subscription-action",options:a,value:(0,zn.find)(["value",t.product_id],a),onChange:t=>{n({product_id:t.value},e)}}))};cs.propTypes={filterIndex:b().number.isRequired};const us={[po.Email]:function(e){return!(!Object.values(mo).some((t=>t===e.action))||e.action!==mo.CLICKED_ANY&&(e.action!==mo.OPENS_ABSOLUTE_COUNT&&e.action!==mo.MACHINE_OPENS_ABSOLUTE_COUNT?!e.newsletter_id:!e.days||!e.opens||!e.operator))},[po.WooCommerce]:function(e){if(!Object.values(So).some((t=>t===e.action)))return!1;if(e.action===So.PURCHASED_CATEGORY&&!e.category_id)return!1;if(e.action===So.PURCHASED_PRODUCT&&!e.product_id)return!1;if(e.action===So.CUSTOMER_IN_COUNTRY&&!e.country_code)return!1;const t=!e.number_of_orders_count||!e.number_of_orders_days||!e.number_of_orders_type;return!(e.action===So.NUMBER_OF_ORDERS&&t||!(e.action!==So.TOTAL_SPENT||e.total_spent_amount&&e.total_spent_days&&e.total_spent_type))},[po.WordPressRole]:function(e){return e.action&&e.action!==ho.WORDPRESS_ROLE?e.action===ho.MAILPOET_CUSTOM_FIELD?function(e){const t=ts[e.custom_field_type];return!!t&&t(e)}(e):e.action===ho.SUBSCRIBER_SCORE?function(e){if(e.operator===No.HIGHER_THAN||e.operator===No.LOWER_THAN||e.operator===No.EQUALS||e.operator===No.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===No.UNKNOWN||e.operator===No.NOT_UNKNOWN}(e):!(!e.operator||!e.value)&&(e.operator===Po.BEFORE||e.operator===Po.AFTER?new RegExp(/^\d+-\d+-\d+$/).test(e.value):(e.operator===Po.IN_THE_LAST||e.operator===Po.NOT_IN_THE_LAST)&&(new RegExp(/^\d+$/).test(e.value)&&Number(e.value)>0)):!!e.wordpressRole},[po.WooCommerceSubscription]:function(e){return!(e.action===ss.ACTIVE_SUBSCRIPTIONS&&!e.product_id)}};function ds(e){return!(e.length<1)&&0===e.map((e=>void 0!==us[e.segmentType]&&us[e.segmentType](e))).filter((e=>!1===e)).length}var ps=n(96486),ms=n.n(ps);let hs,fs;const gs=()=>{const e=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),{updateSubscriberCount:n}=(0,lo.Z)("mailpoet-dynamic-segments-form"),a=JSON.stringify(e);return(0,o.useEffect)((()=>{var t;ds(e.filters)?(t=e,n({loading:!0,count:void 0,errors:void 0}),function(e){const t={filters:e.filters,filters_connect:e.filters_connect};return ms().isEqual(t,hs)?Promise.resolve(fs):(hs={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 fs={count:t.count,errors:void 0},fs})))}(t).then((e=>{const t={loading:!1};e&&(t.count=e.count,t.errors=e.errors),n(t)}),(e=>{const t={},a=e.errors.map((e=>e.message));t.loading=!1,t.count=void 0,t.errors=a,n(t)}))):n({count:void 0,loading:!1})}),[e,a,n]),t.errors?s().createElement("div",{className:"mailpoet-form-field"},s().createElement("span",{className:"mailpoet-form-error-message"},h.Z.I18n.t("dynamicSegmentSizeCalculatingTimeout"))):t.loading||void 0!==t.count?t.loading?s().createElement("div",{className:"mailpoet-form-field"},s().createElement("span",{className:"mailpoet-form-notice-message"},h.Z.I18n.t("dynamicSegmentSizeIsCalculated"))):s().createElement("div",{className:"mailpoet-form-field"},s().createElement("span",{className:"mailpoet-form-notice-message"},h.Z.I18n.t("dynamicSegmentSize").replace("%1$d",t.count.toLocaleString()))):s().createElement("span",null)},vs={[po.Email]:Io,[po.WooCommerce]:Co,[po.WordPressRole]:os,[po.WooCommerceSubscription]:cs},bs=({filterIndex:e})=>{const t=(0,co.Z)((t=>t("mailpoet-dynamic-segments-form").getSegmentFilter(e)),[e]);if(void 0===t||void 0===vs[t.segmentType])return null;const n=vs[t.segmentType];return s().createElement(n,{filterIndex:e})};bs.propTypes={filterIndex:b().number.isRequired};const ys=s().createElement("svg",{viewBox:"0 0 24 24"},s().createElement("path",{d:"M20 14H4V10H20V14Z"})),ws=()=>{const e=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),t=[mo.OPENED,mo.OPENS_ABSOLUTE_COUNT,mo.MACHINE_OPENED,mo.MACHINE_OPENS_ABSOLUTE_COUNT,mo.NOT_OPENED];let n=!1;return e.filters.forEach((e=>{t.includes(e.action)&&(n=!0)})),n?s().createElement("div",{className:"mailpoet-form-field"},s().createElement("span",{className:"mailpoet-form-notice-message"},h.Z.I18n.t("privacyProtectionNotice"))):s().createElement("span",null)},Es=({segmentId:e})=>{const t=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSegment()),[]),n=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getAvailableFilters()),[]),a=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").findFiltersValueForSegment(t)),[t]),r=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getSubscriberCount()),[]),i=(0,co.Z)((e=>e("mailpoet-dynamic-segments-form").getErrors()),[]),{updateSegment:o,updateSegmentFilter:l,handleSave:c}=(0,lo.Z)("mailpoet-dynamic-segments-form");return s().createElement("form",{className:"mailpoet_form"},i.length>0&&s().createElement(gt,{errors:i.map((e=>({message:e})))}),s().createElement("div",{className:"mailpoet-form-grid"},s().createElement("div",{className:"mailpoet-form-field-name form-field-row-name mailpoet-segments-name-section"},s().createElement(Ne.Z,{level:4},s().createElement("label",{htmlFor:"field_name"},h.Z.I18n.t("name"))),s().createElement("div",{className:"mailpoet-form-field"},s().createElement(ce.Z,{isFullWidth:!0,type:"text",name:"name",id:"field_name",defaultValue:t.name,onChange:e=>o({name:e.target.value})}))),s().createElement("div",{className:"mailpoet-form-field-description form-field-row-description mailpoet-segments-description-section"},s().createElement(Ne.Z,{level:4},s().createElement("label",{htmlFor:"field_description"},h.Z.I18n.t("description"))),s().createElement("p",{className:"mailpoet-form-description"},h.Z.I18n.t("segmentDescriptionTip")),s().createElement("div",{className:"mailpoet-form-field"},s().createElement(pe.Z,{isFullWidth:!0,name:"description",id:"field_description",value:t.description,onChange:e=>o({description:e.target.value})}))),s().createElement("div",{className:"mailpoet-segments-segments-section"},s().createElement(Ne.Z,{level:4},s().createElement("label",{htmlFor:"field_filters"},h.Z.I18n.t("formPageTitle"))),s().createElement(vo,null),Array.isArray(a)&&a.map(((e,r)=>s().createElement(s().Fragment,{key:e.index},s().createElement(Ot.r.ThreeColumns,{automationId:`filter-row-${r}`},a.length>1&&s().createElement("a",{href:void 0,className:"mailpoet-form-segment-delete","data-automation-id":"delete-filter-row",onClick:e=>{e.preventDefault();const n=t.filters;n.splice(r,1),o({filters:n})}},ys),s().createElement(uo.Z,{dimension:"small",placeholder:h.Z.I18n.t("selectActionPlaceholder"),options:n,value:e.filterValue,onChange:e=>{l({segmentType:e.group,action:e.value},r)},automationId:"select-segment-action",isFullWidth:!0}),void 0!==e.index&&s().createElement(bs,{filterIndex:e.index})),s().createElement(bo,{index:r})))),s().createElement(y.Z,{type:"button",variant:"tertiary",iconStart:W,onClick:e=>{e.preventDefault();const n=t.filters;n.push({segmentType:po.WordPressRole,action:ho.WORDPRESS_ROLE}),o({filters:n})}},h.Z.I18n.t("addCondition"))),s().createElement("div",{className:"mailpoet-segments-counter-section"},s().createElement(gs,null),s().createElement(ws,null)),s().createElement("div",{className:"mailpoet-form-actions"},s().createElement(y.Z,{type:"submit",onClick:t=>{t.preventDefault(),c(e)},isDisabled:!ds(t.filters)||void 0===r.count},h.Z.I18n.t("save")))))};Es.propTypes={segmentId:b().number};var _s=n(61299);const Zs=e=>e.products,Is=e=>e.subscriptionProducts,Ss=e=>e.wordpressRoles,ks=e=>e.productCategories,Cs=e=>e.newslettersList,Ts=e=>e.canUseWooSubscriptions,Ns=e=>e.wooCurrencySymbol,Ds=e=>e.wooCountries,xs=e=>e.customFieldsList,Rs=e=>e.segment,Os=e=>e.subscriberCount,Ps=(e,t)=>{let n;return Array.isArray(e.segment.filters)?(n={...e.segment.filters[t]},n):n},Ms=e=>e.errors,Ls=e=>e.allAvailableFilters,As=(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},Fs=e=>(t=e,n)=>{switch(n.type){case go.SET_SEGMENT:return function(e,t){return{...e,segment:t.segment}}(t,n);case go.SET_ERRORS:return function(e,t){return{...e,errors:t.errors}}(t,n);case go.UPDATE_SEGMENT:return function(e,t){const n=e.segment;return{...e,segment:(0,zn.assign)(n,t.segment)}}(t,n);case go.UPDATE_SEGMENT_FILTER:return function(e,t){const n={...e.segment};return n.filters[t.filterIndex]=(0,zn.assign)(n.filters[t.filterIndex],t.filter),{...e,segment:n}}(t,n);case go.UPDATE_SUBSCRIBER_COUNT:return function(e,t){const n=e.subscriberCount;return{...e,subscriberCount:(0,zn.assign)(n,t.subscriberCount)}}(t,n);default:return t}};function qs(e){return{type:go.SET_SEGMENT,segment:e}}function $s(e){return{type:go.SET_ERRORS,errors:e}}function Us(e){return{type:go.UPDATE_SEGMENT,segment:e}}function js(e,t){return{type:go.UPDATE_SEGMENT_FILTER,filter:e,filterIndex:t}}function Ws(e,t){return{type:go.UPDATE_SEGMENT,segment:{[e]:t.target.value}}}function Vs(e,t,n){return{type:go.UPDATE_SEGMENT_FILTER,filter:{[e]:n.target.value},filterIndex:t}}function Ys(e){return{type:go.UPDATE_SUBSCRIBER_COUNT,subscriberCount:e}}function*Bs(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 qs(t),h.Z.Modal.loading(!1)}function*Hs(e){const t=(0,_s.Ys)("mailpoet-dynamic-segments-form").getSegment();yield $s([]);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 $s(n)}function zs(e){let t=JSON.parse(JSON.stringify(e));return(0,zn.has)("link_id",e)&&(t=(0,zn.assign)(t,{link_id:e.link_id.toString()})),(0,zn.has)("newsletter_id",e)&&(t=(0,zn.assign)(t,{newsletter_id:e.newsletter_id.toString()})),(0,zn.has)("product_id",e)&&(t=(0,zn.assign)(t,{product_id:e.product_id.toString()})),(0,zn.has)("category_id",e)&&(t=(0,zn.assign)(t,{category_id:e.category_id.toString()})),t}async function Ks({segmentId:e}){try{return{success:!0,res:zs((await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"dynamic_segments",action:"get",data:{id:e}})).data)}}catch(e){return{success:!1,error:e.errors.map((e=>e.message)),res:e}}}async function Gs({segment:e}){try{return await h.Z.Ajax.post({api_version:h.Z.apiVersion,endpoint:"dynamic_segments",action:"save",data:e}),{success:!0}}catch(e){return{success:!1,error:e.errors.map((e=>e.message))}}}function Qs(e){const t=[{label:h.Z.I18n.t("email"),options:_o},{label:h.Z.I18n.t("wpUserRole"),options:rs}];return h.Z.isWoocommerceActive&&t.push({label:h.Z.I18n.t("woocommerce"),options:ko}),h.Z.isWoocommerceActive&&e&&t.push({label:h.Z.I18n.t("woocommerceSubscriptions"),options:ls}),t}var Xs=()=>{const e=(0,d.useRouteMatch)();(()=>{const e={products:window.mailpoet_products,subscriptionProducts:window.mailpoet_subscription_products,productCategories:window.mailpoet_product_categories,newslettersList:window.mailpoet_newsletters_list,wordpressRoles:window.wordpress_editable_roles_list,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:fo.AND,filters:[{segmentType:po.WordPressRole,action:ho.WORDPRESS_ROLE}]},subscriberCount:{loading:!1},errors:[],allAvailableFilters:Qs(window.mailpoet_can_use_woocommerce_subscriptions)},t={selectors:a,actions:r,controls:i,reducer:Fs(e),resolvers:{}};(0,_s.R9)("mailpoet-dynamic-segments-form",t)})();const{pageLoaded:t}=(0,lo.Z)("mailpoet-dynamic-segments-form");return(0,o.useEffect)((()=>{t(e.params.id)}),[e.params.id,t]),s().createElement(s().Fragment,null,s().createElement(Me.Z,{color:"#fff"}),s().createElement(Le.Z,null),s().createElement(Ne.Z,{level:1,className:"mailpoet-title"},s().createElement("span",null,h.Z.I18n.t("formPageTitle")),s().createElement(u.rU,{className:"mailpoet-button button button-secondary button-small",to:"/segments"},h.Z.I18n.t("backToList"))),s().createElement(Es,{segmentId:Number(e.params.id)}))};const Js=[{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}],el={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)}},tl=[{name:"edit",className:"mailpoet-hide-on-mobile",link:e=>s().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=>s().createElement(u.rU,{to:`/edit-segment/${e.id}`},h.Z.I18n.t("edit")),display:e=>e.is_plugin_missing},{name:"view_subscribers",link:e=>s().createElement("a",{href:e.subscribers_url},h.Z.I18n.t("viewSubscribers"))},{name:"trash",className:"mailpoet-hide-on-mobile"}],nl=[{name:"trash",label:h.Z.I18n.t("moveToTrash"),onSuccess:el.onTrash}];function al(e,t){return s().createElement(s().Fragment,null,s().createElement("td",{className:"column-primary","data-colname":h.Z.I18n.t("nameColumn")},s().createElement("span",{className:"mailpoet-listing-title"},e.name),t),s().createElement("td",{"data-colname":h.Z.I18n.t("description")},s().createElement("abbr",null,e.description)),e.is_plugin_missing?s().createElement("td",{colSpan:"2",className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("missingPluginMessageColumn")},e.missing_plugin_message):s().createElement(s().Fragment,null,s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribersCountColumn")},parseInt(e.count_all,10).toLocaleString()),s().createElement("td",{className:"column mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("subscribed")},parseInt(e.count_subscribed,10).toLocaleString())),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("updatedAtColumn")},h.Z.Date.short(e.created_at),s().createElement("br",null),h.Z.Date.time(e.created_at)))}function rl(e){return s().createElement(s().Fragment,null,s().createElement(I(),{limit:window.mailpoet_listing_per_page,location:e.location,params:e.match.params,search:!0,onRenderItem:al,endpoint:"dynamic_segments",base_url:"segments",columns:Js,messages:el,sort_by:"created_at",sort_order:"desc",item_actions:tl,bulk_actions:nl}),s().createElement("p",{className:"mailpoet_sending_methods_help help"},s().createElement("b",null,h.Z.I18n.t("segmentsTip"),":")," ",h.Z.I18n.t("segmentsTipText")," ",s().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"))))}rl.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var il=(0,d.withRouter)(rl),ol=()=>s().createElement(s().Fragment,null,s().createElement(j.Q,null,s().createElement(u.rU,{className:"mailpoet-button button-secondary",to:"/new"},W,s().createElement("span",null,h.Z.I18n.t("new"))),s().createElement(u.rU,{className:"mailpoet-button button-secondary",to:"/new-segment","data-automation-id":"new-segment"},W,s().createElement("span",null,h.Z.I18n.t("newSegment")))),s().createElement(U,{subscribersInPlan:h.Z.subscribersCount,subscribersInPlanLimit:h.Z.subscribersLimit}),s().createElement(A,{cacheCalculation:window.mailpoet_subscribers_counts_cache_created_at}),s().createElement(P,null),s().createElement(L,{mssKeyInvalid:h.Z.hasInvalidMssApiKey,subscribersCount:h.Z.subscribersCount}));const sl=document.getElementById("segments_container"),ll=()=>s().createElement(s().Fragment,null,s().createElement(ol,null),s().createElement(Ni.Z,{activeKey:"lists",routerType:"switch-only"},s().createElement(Ei.Z,{key:"lists",route:"lists/(.*)?",title:h.Z.I18n.t("pageTitle")},s().createElement(ao,null)),s().createElement(Ei.Z,{key:"segments",route:"segments/(.*)?",title:h.Z.I18n.t("pageTitleSegments"),automationId:"dynamic-segments-tab"},s().createElement(il,null)))),cl=()=>s().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},s().createElement(u.UT,null,s().createElement(ot.Z,null),s().createElement(d.Switch,null,s().createElement(d.Route,{exact:!0,path:"/",render:()=>s().createElement(d.Redirect,{to:"/lists"})}),s().createElement(d.Route,{path:"/new",component:so}),s().createElement(d.Route,{path:"/edit/:id",component:so}),s().createElement(d.Route,{path:"/new-segment",component:Xs}),s().createElement(d.Route,{path:"/edit-segment/:id",component:Xs}),s().createElement(d.Route,{path:"/segments/(.*)?",component:ll}),s().createElement(d.Route,{path:"/lists/(.*)?",component:ll}))));sl&&c().render(s().createElement(cl,null),sl);const ul=()=>{h.Z.trackEvent("Forms > Add New"),setTimeout((()=>{window.location=window.mailpoet_form_template_selection_url}),200)},dl=()=>{const[e,t]=(0,o.useState)(!1);return s().createElement(j.Q,null,s().createElement(y.Z,{onClick:()=>{t(!0),ul()},withSpinner:e,automationId:"create_new_form",variant:"secondary",iconStart:W},h.Z.I18n.t("new")))},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:()=>s().createElement("div",{className:"mailpoet-forms-add-new-row"},s().createElement("p",null,h.Z.I18n.t("noItemsFound")),s().createElement(Re.Button,{onClick:ul,automationId:"add_new_form",iconStart:W},h.Z.I18n.t("new")))},hl=[{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 s().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 gl extends s().Component{constructor(...e){super(...e),(0,C.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,C.Z)(this,"isItemInactive",(e=>"disabled"===e.status)),(0,C.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){var t,n,a,r,i,o,s,l;const c=[];return"1"===(null==e||null===(t=e.form_placement)||void 0===t||null===(n=t.fixed_bar)||void 0===n?void 0:n.enabled)&&c.push(h.Z.I18n.t("placeFixedBarFormOnPages")),"1"===(null==e||null===(a=e.form_placement)||void 0===a||null===(r=a.below_posts)||void 0===r?void 0:r.enabled)&&c.push(h.Z.I18n.t("placeFormBellowPages")),"1"===(null==e||null===(i=e.form_placement)||void 0===i||null===(o=i.popup)||void 0===o?void 0:o.enabled)&&c.push(h.Z.I18n.t("placePopupFormOnPages")),"1"===(null==e||null===(s=e.form_placement)||void 0===s||null===(l=s.slide_in)||void 0===l?void 0:l.enabled)&&c.push(h.Z.I18n.t("placeSlideInFormOnPages")),c.length>0?c.join(", "):h.Z.I18n.t("placeFormOthers")}(e.settings);return s().createElement(s().Fragment,null,s().createElement("td",{className:n},s().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),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("segments")},s().createElement(_,{segments:a,dimension:"large"},"user"===e.settings.segments_selected_by&&s().createElement("span",{className:"mailpoet-tags-prefix"},h.Z.I18n.t("userChoice")))),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("type")},r),s().createElement("td",{className:"column","data-colname":h.Z.I18n.t("status")},this.renderStatus(e)),s().createElement("td",{className:"column-date mailpoet-hide-on-mobile","data-colname":h.Z.I18n.t("updatedAt")},h.Z.Date.short(e.updated_at),s().createElement("br",null),h.Z.Date.time(e.updated_at)))}))}renderStatus(e){return s().createElement("div",null,s().createElement(nn,{onCheck:this.updateStatus,"data-id":e.id,dimension:"small",defaultChecked:"enabled"===e.status}),s().createElement("p",null,h.Z.I18n.t("signups"),": ",e.signups.toLocaleString()))}render(){return s().createElement("div",{className:"mailpoet-listing-no-actions-on-mobile"},s().createElement(dl,null),s().createElement(I(),{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:hl,item_actions:fl}))}}gl.propTypes={location:b().object.isRequired,match:b().shape({params:b().object}).isRequired};var vl=Li(gl);const bl=()=>s().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},s().createElement(u.UT,null,s().createElement(ot.Z,null),s().createElement(d.Route,{path:"*",component:vl}))),yl=document.getElementById("forms_container");yl&&c().render(s().createElement(bl,null),yl);var wl=function(){return s().createElement(s().Fragment,null,s().createElement("p",null,h.Z.I18n.t("knowledgeBaseIntro")),s().createElement("ul",{className:"mailpoet-text-links"},s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/116-common-problems"},"Common Problems")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/165-newsletters"},"Newsletters")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/156-migration-questions"},"Migration Questions")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/149-sending-methods"},"Sending Methods")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/139-subscription-forms"},"Subscription Forms")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/114-getting-started"},"Getting Started")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/123-newsletter-designer"},"Newsletter Designer")),s().createElement("li",null,s().createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/category/121-subscribers-and-lists"},"Subscribers and Lists"))),s().createElement(y.Z,{target:"_blank",rel:"noreferrer noopener",href:"https://kb.mailpoet.com/"},h.Z.I18n.t("knowledgeBaseButton")))};function El(e){e.target.select()}var _l=function(){const e=window.systemInfoData;return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet_notice notice inline"},s().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 s().createElement("textarea",{readOnly:!0,onFocus:El,value:t.join("\n"),style:{width:"100%",height:"400px"}})}return s().createElement("p",null,h.Z.I18n.t("systemInfoDataError"))}(e))};const Zl=e=>s().createElement("table",{className:"widefat fixed",style:{maxWidth:e.max_width}},s().createElement("tbody",null,e.rows.map((e=>s().createElement("tr",{key:`row_${e.key}`},s().createElement("td",{className:"row-title"},e.key),s().createElement("td",null,e.value))))));Zl.propTypes={max_width:b().string,rows:b().arrayOf(b().shape({key:b().string.isRequired,value:b().oneOfType([b().string,b().number,b().element]).isRequired})).isRequired},Zl.defaultProps={max_width:"auto"};var Il=Zl;const Sl=e=>s().createElement("span",null,!0===e.children&&e.truthy||!1===e.children&&e.falsy||e.unknown);Sl.propTypes={truthy:b().string,falsy:b().string,unknown:b().string,children:b().bool},Sl.defaultProps={truthy:h.Z.I18n.t("yes"),falsy:h.Z.I18n.t("no"),unknown:h.Z.I18n.t("unknown"),children:null};var kl=Sl;const Cl=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)?s().createElement(s().Fragment,null,t.last_error.map((e=>s().createElement("div",{key:e.worker},e.worker,":"," ",s().createElement("i",null,e.message))))):t.last_error;return s().createElement("div",null,s().createElement("h4",null,h.Z.I18n.t("systemStatusCronStatusTitle")),s().createElement(Il,{max_width:"400px",rows:[{key:h.Z.I18n.t("accessible"),value:s().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")}]}))};Cl.propTypes={status_data:b().shape({accessible:b().bool,last_error_date:b().string,status:b().string,updated_at:b().number,run_accessed_at:b().number,run_completed_at:b().number,run_started_at:b().number,last_error:b().oneOfType([b().string,b().array])}).isRequired};var Tl=Cl;const Nl=e=>{let t=e.task.scheduled_at;t&&(t=(0,Wa.default)(t,"yyyy-MM-dd HH:mm:ss",new Date));const n=(0,Wa.default)(e.task.updated_at,"yyyy-MM-dd HH:mm:ss",new Date);return s().createElement("tr",null,s().createElement("td",{className:"column column-primary"},e.task.id),s().createElement("td",{className:"column"},e.task.type),s().createElement("td",{className:"column"},e.task.newsletter?s().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")),s().createElement("td",{className:"column"},e.task.priority),e.show_scheduled_at?s().createElement("td",{className:"column-date"},s().createElement("abbr",null,`${h.Z.Date.short(t)} ${h.Z.Date.time(t)}`)):null,s().createElement("td",{className:"column-date"},s().createElement("abbr",null,`${h.Z.Date.short(n)} ${h.Z.Date.time(n)}`)))};Nl.propTypes={show_scheduled_at:b().bool,task:b().shape({id:b().number.isRequired,type:b().string.isRequired,priority:b().number.isRequired,updated_at:b().string.isRequired,scheduled_at:b().string,status:b().string,newsletter:b().shape({newsletter_id:b().number.isRequired,queue_id:b().number.isRequired,preview_url:b().string.isRequired,subject:b().string})}).isRequired},Nl.defaultProps={show_scheduled_at:!1};var Dl=Nl;const xl=e=>s().createElement("tr",null,s().createElement("th",{className:"row-title"},"Id"),s().createElement("th",{className:"row-title"},h.Z.I18n.t("type")),s().createElement("th",{className:"row-title"},h.Z.I18n.t("email")),s().createElement("th",{className:"row-title"},h.Z.I18n.t("priority")),e.show_scheduled_at?s().createElement("th",{className:"row-title"},h.Z.I18n.t("scheduledAt")):null,s().createElement("th",{className:"row-title"},h.Z.I18n.t("updatedAt")));xl.propTypes={show_scheduled_at:b().bool},xl.defaultProps={show_scheduled_at:!1};var Rl=xl;const Ol=e=>{const t=e.show_scheduled_at?6:5;return s().createElement("table",{className:"widefat fixed striped"},s().createElement("thead",null,s().createElement(Rl,{show_scheduled_at:e.show_scheduled_at})),s().createElement("tbody",null,e.tasks.length?e.tasks.map((t=>s().createElement(Dl,{key:t.id,task:t,show_scheduled_at:e.show_scheduled_at}))):s().createElement("tr",{className:"mailpoet-listing-no-items"},s().createElement("td",{colSpan:t},h.Z.I18n.t("nothingToShow")))),s().createElement("tfoot",null,s().createElement(Rl,{show_scheduled_at:e.show_scheduled_at})))};Ol.propTypes={show_scheduled_at:b().bool,tasks:b().arrayOf(Dl.propTypes.task).isRequired},Ol.defaultProps={show_scheduled_at:!1};var Pl=Ol;const Ml=e=>{const t=e.status_data;return s().createElement(s().Fragment,null,s().createElement("h4",null,h.Z.I18n.t("systemStatusQueueTitle")),s().createElement(Il,{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}]}),s().createElement("h5",null,h.Z.I18n.t("scheduledTasks")),s().createElement(Pl,{show_scheduled_at:!0,tasks:t.latestTasks.filter((e=>"scheduled"===e.status))}),s().createElement("h5",null,h.Z.I18n.t("runningTasks")),s().createElement(Pl,{tasks:t.latestTasks.filter((e=>null===e.status))}),s().createElement("h5",null,h.Z.I18n.t("completedTasks")),s().createElement(Pl,{tasks:t.latestTasks.filter((e=>"completed"===e.status))}))};Ml.propTypes={status_data:b().shape({status:b().string,started:b().number,sent:b().number,retry_attempt:b().number,retry_at:b().number,error:b().shape({operation:b().string,error_message:b().string}),tasksStatusCounts:b().shape({completed:b().number.isRequired,running:b().number.isRequired,paused:b().number.isRequired,scheduled:b().number.isRequired}).isRequired,latestTasks:b().arrayOf(Dl.propTypes.task).isRequired}).isRequired};var Ll=Ml;function Al(e,t,n,a,r){const i=e?"success":"error";let o=e?h.Z.I18n.t("systemStatusConnectionSuccessful"):`${h.Z.I18n.t("systemStatusConnectionUnsuccessful")} ${t}`;return n&&(o=R()(o,/\[link\](.*?)\[\/link\]/g,(e=>s().createElement("a",{className:"mailpoet-text-link",href:n,"data-beacon-article":a,key:"kb-link"},e)))),s().createElement("div",{className:`mailpoet_notice notice inline notice-${i}`},s().createElement("p",null,o),r?s().createElement("p",null,s().createElement("i",null,r)):null)}var Fl=function(){const e=window.systemStatusData;return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet_notice notice inline"},s().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("systemStatusCronConnectionUnsuccessfulInfo"),r=t?null:e.cron.pingResponse;return s().createElement("div",null,s().createElement("h4",null,h.Z.I18n.t("systemStatusCronTitle")),s().createElement("p",null,s().createElement("a",{className:"mailpoet-text-link",href:n,target:"_blank",rel:"noopener noreferrer"},n)),Al(t,a,"https://kb.mailpoet.com/article/231-sending-does-not-work","5a0257ac2c7d3a272c0d7ad6",r))}(e),function(e){if(!e.mss.enabled)return;const t=e.mss.enabled.isReachable;return s().createElement("div",null,s().createElement("h4",null,h.Z.I18n.t("systemStatusMSSTitle")),Al(t,h.Z.I18n.t("systemStatusMSSConnectionUnsuccessfulInfo"),!1))}(e),s().createElement(Tl,{status_data:e.cronStatus}),s().createElement(Ll,{status_data:e.queueStatus}))},ql=function(){return s().createElement(s().Fragment,null,s().createElement("p",null,h.Z.I18n.t("yourPrivacyContent1")),s().createElement("p",null,h.Z.I18n.t("yourPrivacyContent2")),s().createElement("p",null,h.Z.I18n.t("yourPrivacyContent3")),s().createElement(y.Z,{target:"_blank",rel:"noreferrer noopener",href:"https://www.mailpoet.com/privacy-notice/"},h.Z.I18n.t("yourPrivacyButton")))};const $l=()=>s().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},s().createElement(j.D,null),s().createElement(ot.Z,null),s().createElement(Ni.Z,{activeKey:"knowledgeBase"},s().createElement(Ei.Z,{key:"knowledgeBase",title:h.Z.I18n.t("tabKnowledgeBaseTitle")},s().createElement(wl,null)),s().createElement(Ei.Z,{key:"systemStatus",title:h.Z.I18n.t("tabSystemStatusTitle")},s().createElement(Fl,null)),s().createElement(Ei.Z,{key:"systemInfo",title:h.Z.I18n.t("tabSystemInfoTitle")},s().createElement(_l,null)),s().createElement(Ei.Z,{key:"yourPrivacy",title:h.Z.I18n.t("tabYourPrivacyTitle")},s().createElement(ql,null)))),Ul=document.getElementById("help_container");Ul&&c().render(s().createElement($l,null),Ul);var jl=(0,d.withRouter)((({children:e,location:{pathname:t}})=>((0,o.useEffect)((()=>{window.scrollTo(0,0)}),[t]),e||null)));function Wl({activeMethod:e,onMethodChange:t}){return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("span",{className:"mailpoet_import_heading"},h.Z.I18n.t("methodSelectionHead")),s().createElement("div",{className:"mailpoet-settings-inputs-row"},s().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"},s().createElement(w.Z,{dimension:"large",variant:"excellent",isInverted:!0},h.Z.I18n.t("seeVideo"))))),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement("div",{className:"mailpoet-settings-inputs-row"},s().createElement(be.Z,{name:"select_method",automationId:"import-paste-method",id:"import-paste-method",checked:"paste-method"===e,value:"paste-method",onCheck:t}),s().createElement("label",{htmlFor:"import-paste-method"},h.Z.I18n.t("methodPaste"))),s().createElement("div",{className:"mailpoet-settings-inputs-row"},s().createElement(be.Z,{name:"select_method",automationId:"import-csv-method",id:"import-csv-method",checked:"file-method"===e,value:"file-method",onCheck:t}),s().createElement("label",{htmlFor:"import-csv-method"},h.Z.I18n.t("methodUpload"))),s().createElement("div",{className:"mailpoet-settings-inputs-row"},s().createElement(be.Z,{name:"select_method",automationId:"import-mailchimp-method",id:"import-mailchimp-method",checked:"mailchimp-method"===e,value:"mailchimp-method",onCheck:t}),s().createElement("label",{htmlFor:"import-mailchimp-method"},h.Z.I18n.t("methodMailChimp")))))}Wl.propTypes={activeMethod:b().string,onMethodChange:b().func.isRequired},Wl.defaultProps={activeMethod:void 0};var Vl=Wl;const Yl=({hidePrevious:e,isLastStep:t,canGoNext:n,onPreviousAction:a,onNextAction:r})=>s().createElement("div",{className:"mailpoet-settings-save"},!e&&s().createElement(y.Z,{type:"button",variant:"secondary",onClick:a},h.Z.I18n.t("previousStep")),s().createElement(y.Z,{type:"button",automationId:"import-next-step",isDisabled:!n,onClick:()=>{n&&r()}},h.Z.I18n.t(t?"import":"nextStep")));Yl.propTypes={canGoNext:b().bool,hidePrevious:b().bool,isLastStep:b().bool,onPreviousAction:b().func,onNextAction:b().func},Yl.defaultProps={hidePrevious:!1,isLastStep:!1,canGoNext:!0,onPreviousAction:()=>{},onNextAction:()=>{}};var Bl=Yl;const Hl=({onValueChange:e,canFinish:t,onFinish:n,data:a,onPrevious:r})=>s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("label",{htmlFor:"paste_input"},h.Z.I18n.t("pasteLabel")),s().createElement("p",{className:"description"},R()(h.Z.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>s().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))))),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(pe.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:t=>{e(t.target.value)},defaultValue:a})),s().createElement(Bl,{canGoNext:t,onPreviousAction:r,onNextAction:n}));Hl.propTypes={onFinish:b().func,onPrevious:b().func,canFinish:b().bool.isRequired,onValueChange:b().func.isRequired,data:b().string},Hl.defaultProps={onFinish:()=>{},onPrevious:()=>{},data:""};var zl=Hl;const Kl=({onValueChange:e,canFinish:t,onFinish:n,onPrevious:a})=>s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("label",{htmlFor:"file_local"},h.Z.I18n.t("methodUpload")),s().createElement("p",{className:"description"},R()(h.Z.I18n.t("pasteDescription"),/\[link\](.*?)\[\/link\]/,(e=>s().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))))),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(ce.Z,{type:"file",id:"file_local",accept:".csv","data-automation-id":"import-file-upload-input",onChange:t=>{const n=t.target.value.match(/[^.]+$/);h.Z.Notice.hide(),null===n||"csv"!==n[0].toLowerCase()?(h.Z.Notice.error(h.Z.I18n.t("wrongFileFormat")),e("")):e(t.target.files[0])}})),s().createElement(Bl,{canGoNext:t,onPreviousAction:a,onNextAction:n}));Kl.propTypes={canFinish:b().bool.isRequired,onFinish:b().func,onPrevious:b().func,onValueChange:b().func.isRequired},Kl.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var Gl=Kl;const Ql=({onFinish:e,onPrevious:t})=>{const[n,a]=(0,o.useState)(""),[r,i]=(0,o.useState)(void 0),[l,c]=(0,o.useState)([]);return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("label",{htmlFor:"mailpoet_mailchimp_key_input"},s().createElement("span",{className:"mailpoet_import_heading"},h.Z.I18n.t("methodMailChimpLabel")),s().createElement("p",{className:"description"},R()(h.Z.I18n.t("methodMailChimpDescription"),/\[link\](.*?)\[\/link\]/,(e=>s().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)))))),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered"},s().createElement(ce.Z,{dimension:"small",id:"mailpoet_mailchimp_key_input",type:"text",onChange:e=>{a(e.target.value),""===e.target.value.trim()&&i(void 0)}}),s().createElement("span",{className:"mailpoet-gap"}),s().createElement(y.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:n}}).always((()=>{h.Z.Modal.loading(!1)})).done((e=>i(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")),s().createElement("span",{className:"mailpoet-gap"}),s().createElement("span",null,Array.isArray(r)&&0===r.length?h.Z.I18n.t("noMailChimpLists"):null))),r?s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("methodMailChimpSelectList")),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(D,{field:{id:"segments",name:"list-selection",multiple:!0,placeholder:h.Z.I18n.t("methodMailChimpSelectPlaceholder"),forceSelect2:!0,values:r},onValueChange:e=>c(e.target.value)}))):null,s().createElement(Bl,{canGoNext:Array.isArray(l)&&l.length>0,onPreviousAction:t,onNextAction:()=>{h.Z.Modal.loading(!0),h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"getMailChimpSubscribers",data:{api_key:n,lists:l}}).always((()=>{h.Z.Modal.loading(!1)})).done((t=>e(t.data))).fail((e=>{e.errors.length>0&&h.Z.Notice.error(e.errors.map((e=>e.message)),{scroll:!0})}))}}))};Ql.propTypes={onFinish:b().func,onPrevious:b().func},Ql.defaultProps={onFinish:()=>{},onPrevious:()=>{}};var Xl=Ql,Jl=n(57460),ec=n.n(Jl);const tc=e=>window.roleBasedEmails.findIndex((t=>e.startsWith(`${t}@`)))>=0,nc=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)&&!tc(n)&&n};var ac=(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),ec().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 o,s,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=>{s=nc(l[e]),null===u&&window.mailpoet_email_regex.test(s)&&(u=e,n[s]=!0,l[e]=s,t[s]=l)})),null===u&&0===parseInt(m,10)&&(p=!0,t[0]=l)):""!==l[u]&&(o=nc(l[u]),T.ZP.has(n,o)?a.push(o):tc(l[u])?i.push(l[u]):window.mailpoet_email_regex.test(o)?(n[o]=!0,l[u]=o,t[o]=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 rc({history:e,setStepMethodSelectionData:t,subscribersLimitForValidation:n}){const[a,r]=(0,o.useState)(void 0),[i,l]=(0,o.useState)(""),[c,u]=(0,o.useState)(void 0),d=r=>{t(r),e.push(((e,t,n)=>void 0===e||void 0===e.subscribersCount||e.subscribersCount<t||"mailchimp-method"===n?"step_data_manipulation":"step_input_validation")(r,n,a))},p=()=>{e.push("/step_clean_list")},m=()=>{ac("paste-method"===a?i:c,(e=>{h.Z.trackEvent("Subscribers import started",{source:"file-method"===a?"file upload":"pasted data"}),d(e)}))};return s().createElement("div",{className:"mailpoet-settings-grid"},s().createElement(Vl,{activeMethod:a,onMethodChange:r}),"paste-method"===a&&s().createElement(zl,{onPrevious:p,onValueChange:l,onFinish:m,canFinish:!!i.trim(),data:i}),"file-method"===a&&s().createElement(Gl,{onPrevious:p,onValueChange:u,onFinish:m,canFinish:!!c,data:c}),"mailchimp-method"===a&&s().createElement(Xl,{onPrevious:p,onFinish:e=>{h.Z.trackEvent("Subscribers import started",{source:"MailChimp"}),d(e)}}),void 0===a&&s().createElement(Bl,{canGoNext:!1,onPreviousAction:p}))}rc.propTypes={history:b().shape({push:b().func.isRequired}).isRequired,setStepMethodSelectionData:b().func.isRequired,subscribersLimitForValidation:b().number.isRequired};var ic=(0,d.withRouter)(rc),oc=({onProceed:e})=>s().createElement("div",{className:"mailpoet-clean-list-step-container"},s().createElement("p",null,h.Z.I18n.t("cleanListText1")),s().createElement("p",null,h.Z.I18n.t("cleanListText2")),s().createElement("p",null,e&&s().createElement(y.Z,{onClick:e,variant:"tertiary"},h.Z.I18n.t("listCleaningGotIt")),s().createElement(y.Z,{target:"_blank",href:"https://kb.mailpoet.com/article/287-list-cleaning-services"},h.Z.I18n.t("tryListCleaning"))));function sc({onSubmit:e,history:t}){const[n,a]=(0,o.useState)(void 0);return s().createElement("div",{className:"mailpoet-settings-grid"},s().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("validationStepHeading")),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement("div",{className:"mailpoet-settings-inputs-row"},s().createElement(be.Z,{automationId:"mailpoet_import_validation_step_option1",id:"existing-list",checked:"existing-list"===n,value:"existing-list",onCheck:a}),s().createElement("label",{htmlFor:"existing-list"},h.Z.I18n.t("validationStepRadio1"))),s().createElement("div",{className:"mailpoet-settings-inputs-row"},s().createElement(be.Z,{automationId:"mailpoet_import_validation_step_option2",id:"address-book",checked:"address-book"===n,value:"address-book",onCheck:a}),s().createElement("label",{htmlFor:"address-book"},h.Z.I18n.t("validationStepRadio2")))),s().createElement(Bl,{canGoNext:void 0!==n,onPreviousAction:()=>t.push("step_method_selection"),onNextAction:()=>e(n)}))}sc.propTypes={history:b().shape({push:b().func.isRequired}).isRequired,onSubmit:b().func.isRequired};var lc=sc,cc=function(){return s().createElement("div",{className:"mailpoet-clean-list-step-container","data-automation-id":"import_wrong_source_block"},s().createElement("p",null,h.Z.I18n.t("validationStepBlock1")),s().createElement("p",null,h.Z.I18n.t("validationStepBlock2")),s().createElement("p",null,s().createElement(y.Z,{href:"https://kb.mailpoet.com/article/269-reconfirm-subscribers-to-your-list",target:"_blank",rel:"noopener noreferrer"},h.Z.I18n.t("validationStepBlockButton"))))};function uc({onSubmit:e}){const[t,n]=(0,o.useState)("over2years"),a=(0,o.useCallback)((e=>{n(e.target.value)}),[n]),r=(0,o.useCallback)((()=>{e("over2years"===t||"1to2years"===t?"notRecently":"recently")}),[e,t]);return s().createElement("div",{className:"mailpoet-settings-grid"},s().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("validationStepLastSentHeading")),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(fe.Z,{defaultValue:t,onChange:a,automationId:"last_sent_to_list"},s().createElement("option",{value:"over2years"},h.Z.I18n.t("validationStepLastSentOption1")),s().createElement("option",{value:"1to2years"},h.Z.I18n.t("validationStepLastSentOption2")),s().createElement("option",{value:"less1year"},h.Z.I18n.t("validationStepLastSentOption3")),s().createElement("option",{value:"less3months"},h.Z.I18n.t("validationStepLastSentOption4")))),s().createElement("div",{className:"mailpoet-settings-save"},s().createElement(y.Z,{type:"button",automationId:"last_sent_to_list_next",onClick:r},h.Z.I18n.t("validationStepLastSentNext"))))}uc.propTypes={onSubmit:b().func.isRequired};var dc=uc;function pc({stepMethodSelectionData:e,history:t}){const[n,a]=(0,o.useState)(void 0),[r,i]=(0,o.useState)(void 0);(0,o.useEffect)((()=>{void 0===e&&t.replace("step_method_selection")}),[e,t]);const l=(0,o.useCallback)((e=>{i(e),"recently"===e&&t.push("step_data_manipulation")}),[t,i]);return s().createElement(s().Fragment,null,void 0===n&&s().createElement(lc,{onSubmit:a,history:t}),"address-book"===n&&s().createElement(cc,null),"existing-list"===n&&void 0===r&&s().createElement(dc,{onSubmit:l}),"existing-list"===n&&"notRecently"===r&&s().createElement(oc,null))}pc.propTypes={history:b().shape({push:b().func.isRequired,replace:b().func.isRequired}).isRequired,stepMethodSelectionData:b().shape({duplicate:b().arrayOf(b().string),header:b().arrayOf(b().string),invalid:b().arrayOf(b().string),role:b().arrayOf(b().string),subscribersCount:b().number,subscribers:b().arrayOf(b().arrayOf(b().string))})},pc.defaultProps={stepMethodSelectionData:void 0};var mc=(0,d.withRouter)(pc);const hc=({translation:e,subscribers:t})=>{let n="";return t.length&&(n=R()(e.replace("%2$s",t.join(", ")),"%1$s",(()=>s().createElement("strong",{key:e},t.length.toLocaleString()))),n=s().createElement("p",null,n)),n};hc.propTypes={translation:b().string.isRequired,subscribers:b().arrayOf(b().string).isRequired};const fc=({stepMethodSelectionData:e})=>{const{invalid:t,duplicate:n,role:a}=e,[r,i]=(0,o.useState)(!1),l=g()("mailpoet_subscribers_data_parse_results_details",{mailpoet_hidden:!r}),c=s().createElement(hc,{translation:h.Z.I18n.t("importNoticeInvalid"),subscribers:t}),u=s().createElement(hc,{translation:h.Z.I18n.t("importNoticeDuplicate"),subscribers:n});let d="";if(a.length&&(d=R()(h.Z.I18n.t("importNoticeRoleBased"),/(%1\$s|\[link\].*\[\/link\]|%2\$s)/,(e=>"%1$s"===e?s().createElement("strong",{key:"role-length"},a.length.toLocaleString()):"%2$s"===e?a.join(", "):s().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]","")))),d=s().createElement("p",null,d)),t.length||n.length||a.length){const e=t.length+n.length+a.length;return s().createElement("div",{className:"error"},s().createElement("p",null,R()(h.Z.I18n.t("importNoticeSkipped"),"%1$s",(()=>s().createElement("strong",{key:"lengths"},e.toLocaleString())))," ",s().createElement("a",{className:"mailpoet_subscribers_data_parse_results_details_show","data-automation-id":"show-more-details",onClick:()=>i(!r),role:"button",tabIndex:0,onKeyDown:e=>{["keydown","keypress"].includes(e.type)&&["Enter"," "].includes(e.key)&&(e.preventDefault(),i(!r))}},h.Z.I18n.t("showMoreDetails"))),s().createElement("div",{className:l},s().createElement("hr",null),c,u,d))}return null};fc.propTypes={stepMethodSelectionData:b().shape({duplicate:b().arrayOf(b().string),invalid:b().arrayOf(b().string),role:b().arrayOf(b().string)})},fc.defaultProps={stepMethodSelectionData:{invalid:[],duplicate:[],role:[]}};var gc=fc;function vc({header:e,subscribers:t}){const n=((e,t)=>{const n=[],a=[];let r,i,o,s;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&&(o=t[l],s=window.mailpoetColumns.map((e=>e.name)).indexOf(o),-1!==s?i=window.mailpoetColumns[s].id:o&&(/first|first name|given name/i.test(o)?i="first_name":/last|last name/i.test(o)&&(i="last_name"))),i="ignore"!==i&&-1===a.indexOf(i)?i:"ignore",n[l]={column_id:i},a.push(i)})),n})(t,e);return s().createElement("tr",null,s().createElement("th",null,h.Z.I18n.t("matchData")),n.map(((e,t)=>s().createElement("th",{key:e.column_id+t},s().createElement("select",{className:"mailpoet_subscribers_column_data_match","data-column-id":e.column_id,"data-column-index":t,id:`column_${t}`})))))}function bc({header:e}){return s().createElement("tr",{className:"mailpoet_header"},s().createElement("td",null),e.map((e=>s().createElement("td",{key:e},e))))}function yc({subscriber:e,index:t}){return s().createElement(s().Fragment,null,s().createElement("td",null,t),e.map(((e,n)=>s().createElement("td",{key:`${e}-${t}-${n}`},e))))}function wc({subscribers:e,subscribersCount:t}){const n=". . .",a=Array(e[0].length).fill(n);return s().createElement(s().Fragment,null,e.slice(0,10).map(((e,t)=>s().createElement("tr",{key:`${e[0]}-${t}`},s().createElement(yc,{subscriber:e,index:t+1})))),t>11?s().createElement("tr",{key:"filler"},s().createElement(yc,{subscriber:a,index:n})):null,t>10?s().createElement("tr",{key:e[t-1][0]},s().createElement(yc,{subscriber:e[t-1],index:t})):null)}function Ec({subscribersCount:e,subscribers:t,header:n}){return(0,o.useLayoutEffect)((()=>{m()("select.mailpoet_subscribers_column_data_match").select2({data:window.mailpoetColumnsSelect2,width:"15em",templateResult:e=>e.name,templateSelection:e=>e.name}).on("select2:selecting",(e=>{const t=e.currentTarget,n=e.params.args.data.id;"create"===n?(e.preventDefault(),m()(t).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 e=m()("#form_field_new").mailpoetSerializeObject();return h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"customFields",action:"save",data:e}).done((e=>{const n={id:e.data.id,name:e.data.name,type:e.data.type,params:e.data.params,custom:!0};2===window.mailpoetColumnsSelect2.length&&window.mailpoetColumnsSelect2.push({name:h.Z.I18n.t("userColumns"),children:[]}),window.mailpoetColumnsSelect2[2].children.push(n),window.mailpoetColumns.push(n),m()("select.mailpoet_subscribers_column_data_match").each((()=>{m()(t).html("").select2("destroy").select2({data:window.mailpoetColumnsSelect2,width:"15em",templateResult:e=>e.name,templateSelection:e=>e.name})})),m()(t).data("column-id",n.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 a=t,r=m()(a).val();r===n&&"ignore"!==r&&(confirm(`${h.Z.I18n.t("selectedValueAlreadyMatched")} ${h.Z.I18n.t("confirmCorrespondingColumn")}`)?m()(a).data("column-id","ignore"):(e.preventDefault(),m()(t).select2("close")))}))})).on("select2:select",(e=>{const t=e.currentTarget,n=e.params.data.id;m()(t).data("column-id",n)})),m().map(m()(".mailpoet_subscribers_column_data_match"),(e=>{const t=m()(e).data("column-id");m()(e).val(t).trigger("change")}))})),s().createElement("div",{className:"subscribers_data"},s().createElement("table",{className:"mailpoet_subscribers widefat fixed"},s().createElement("thead",null,s().createElement(vc,{header:n,subscribers:t})),s().createElement("tbody",null,n?s().createElement(bc,{header:n}):null,s().createElement(wc,{subscribers:t,subscribersCount:e}))))}vc.propTypes={subscribers:b().arrayOf(b().arrayOf(b().oneOfType([b().string,b().number]))).isRequired,header:b().arrayOf(b().string)},vc.defaultProps={header:[]},bc.propTypes={header:b().arrayOf(b().string).isRequired},yc.propTypes={subscriber:b().arrayOf(b().oneOfType([b().string,b().number])).isRequired,index:b().node.isRequired},wc.propTypes={subscribersCount:b().number.isRequired,subscribers:b().arrayOf(b().arrayOf(b().oneOfType([b().string,b().number]))).isRequired},Ec.propTypes={subscribersCount:b().number,subscribers:b().arrayOf(b().arrayOf(b().oneOfType([b().string,b().number]))),header:b().arrayOf(b().string)},Ec.defaultProps={subscribersCount:0,subscribers:[],header:[]};var _c=Ec;function Zc({setSelectedSegments:e}){const{segments:t}=(0,o.useContext)(Ve.k),{all:n,updateAll:a}=t,[r,i]=(0,o.useState)(n);(0,o.useLayoutEffect)((()=>{!function(t,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:t.map((e=>({...e,text:e.name}))),dropdownCssClass:"mailpoet-form-select2-dropdown",escapeMarkup:e=>e,templateResult:r,templateSelection:r}).on("change",(t=>{const n=m()('[data-id="notice_segmentSelection"]');t.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});(t=>{e(t)})(T.ZP.pluck(a.select2("data"),"id"))}))}(r)}),[r,e]);const l=t=>{!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"))}(),e([]),i([...r,t]),a([...r,t])};return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("label",{htmlFor:"mailpoet_segments_select"},h.Z.I18n.t("pickLists"),s().createElement("p",{className:"description"},h.Z.I18n.t("pickListsDescription")))),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered"},s().createElement("div",{className:"mailpoet-form-select mailpoet-form-input"},s().createElement("select",{id:"mailpoet_segments_select","data-placeholder":h.Z.I18n.t("select"),multiple:"multiple"},s().createElement("option",null))),s().createElement(y.Z,{variant:"tertiary",onClick:()=>{return e=l,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")))))}Zc.propTypes={setSelectedSegments:b().func.isRequired};var Ic=Zc;const Sc=()=>s().createElement("p",{className:"description"},R()(h.Z.I18n.t("consentSubscribed"),/\[link](.*?)\[\/link]/,(e=>s().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)))),kc=({newSubscribersStatus:e,setNewSubscribersStatus:t})=>{const n=(0,o.useCallback)((e=>{t(e.target.value)}),[t]);return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("label",{htmlFor:"new_subscribers_status"},h.Z.I18n.t("newSubscribersStatus")),s().createElement(Sc,null)),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(fe.Z,{id:"new_subscribers_status",placeholder:h.Z.I18n.t("select"),name:"new_subscribers_status",onChange:n,defaultValue:e},s().createElement("option",{value:"subscribed"},h.Z.I18n.t("subscribed")),s().createElement("option",{value:"inactive"},h.Z.I18n.t("inactive")),s().createElement("option",{value:"unsubscribed"},h.Z.I18n.t("unsubscribed")))))};kc.propTypes={newSubscribersStatus:b().string.isRequired,setNewSubscribersStatus:b().func.isRequired};const Cc=({existingSubscribersStatus:e,setExistingSubscribersStatus:t})=>{const n=(0,o.useCallback)((e=>{t(e.target.value)}),[t]);return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},s().createElement("label",{htmlFor:"existing_subscribers_status"},h.Z.I18n.t("existingSubscribersStatus")),s().createElement(Sc,null)),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(fe.Z,{id:"existing_subscribers_status",placeholder:h.Z.I18n.t("select"),name:"existing_subscribers_status",onChange:n,defaultValue:e},s().createElement("option",{value:"dont_update"},h.Z.I18n.t("dontUpdate")),s().createElement("option",{value:"subscribed"},h.Z.I18n.t("subscribed")),s().createElement("option",{value:"inactive"},h.Z.I18n.t("inactive")),s().createElement("option",{value:"unsubscribed"},h.Z.I18n.t("unsubscribed")))))};function Tc({updateExistingSubscribers:e,setUpdateExistingSubscribers:t}){return s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-settings-label"},h.Z.I18n.t("updateExistingSubscribers")),s().createElement("div",{className:"mailpoet-settings-inputs"},s().createElement(be.Z,{id:"update_existing_subscribers",name:"update_existing_subscribers",value:"1",checked:e,onCheck:()=>t(!0)}),s().createElement("label",{htmlFor:"update_existing_subscribers"},h.Z.I18n.t("updateExistingSubscribersYes")),s().createElement("span",{className:"mailpoet-gap"}),s().createElement(be.Z,{id:"dont_update_existing_subscribers",name:"update_existing_subscribers",value:"",checked:!e,onCheck:()=>t(!1)}),s().createElement("label",{htmlFor:"dont_update_existing_subscribers"},h.Z.I18n.t("updateExistingSubscribersNo"))))}Cc.propTypes={existingSubscribersStatus:b().string.isRequired,setExistingSubscribersStatus:b().func.isRequired},Tc.propTypes={setUpdateExistingSubscribers:b().func.isRequired,updateExistingSubscribers:b().bool.isRequired};var Nc=Tc;function Dc({history:e,stepMethodSelectionData:t,subscribersLimitForValidation:n,setStepDataManipulationData:a}){const[r,i]=(0,o.useState)([]),[l,c]=(0,o.useState)(!0),[u,d]=(0,o.useState)("subscribed"),[p,f]=(0,o.useState)("dontUpdate");return(0,o.useEffect)((()=>{void 0===t&&e.replace("step_method_selection")}),[t,e]),void 0===t?null:s().createElement("div",{"data-automation-id":"import_data_manipulation_step"},s().createElement(gc,{stepMethodSelectionData:t}),s().createElement(_c,{subscribersCount:t.subscribersCount,subscribers:t.subscribers,header:t.header}),s().createElement("div",{className:"mailpoet-settings-grid"},s().createElement(Ic,{setSelectedSegments:i}),s().createElement(kc,{newSubscribersStatus:u,setNewSubscribersStatus:d}),s().createElement(Cc,{existingSubscribersStatus:p,setExistingSubscribersStatus:f}),s().createElement(Nc,{setUpdateExistingSubscribers:c,updateExistingSubscribers:l}),s().createElement(Bl,{canGoNext:r.length>0,onPreviousAction:()=>e.push(function(e,t){return void 0===e||void 0===e.subscribersCount||e.subscribersCount<t?"step_method_selection":"step_input_validation"}(t,n)),onNextAction:()=>{((t,n,r,i,o,s)=>{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,t.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:r,existingSubscribersStatus:i,updateSubscribers:o})}).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)),a(p),e.push("step_results"))}))})(t.subscribers,r,u,p,l)},isLastStep:!0})))}n(49868),Dc.propTypes={history:b().shape({push:b().func.isRequired,replace:b().func.isRequired}).isRequired,stepMethodSelectionData:b().shape({duplicate:b().arrayOf(b().string),header:b().arrayOf(b().string),invalid:b().arrayOf(b().string),role:b().arrayOf(b().string),subscribersCount:b().number,subscribers:b().arrayOf(b().arrayOf(b().oneOfType([b().string,b().number])))}),subscribersLimitForValidation:b().number.isRequired,setStepDataManipulationData:b().func.isRequired},Dc.defaultProps={stepMethodSelectionData:void 0};var xc=(0,d.withRouter)(Dc);function Rc({subscribersCount:e,segments:t,initialMessage:n}){if(e){let a=R()(n,"%1$s",(()=>s().createElement("strong",{key:"%1$s"},e.toLocaleString())));return a=R()(a,"%2$s",(()=>`"${t.join('", "')}"`)),s().createElement("p",null,a)}return null}function Oc({createdSubscribers:e,updatedSubscribers:t}){return e||t?null:s().createElement("p",null,h.Z.I18n.t("importNoAction"))}function Pc({createdSubscribers:e,updatedSubscribers:t}){return e||t?s().createElement(s().Fragment,null,s().createElement("p",null,s().createElement("b",null,h.Z.I18n.t("congratulationResult"))),s().createElement("p",null,R()(h.Z.I18n.t("suppressionListReminder"),/\[link](.*?)\[\/link]/,(e=>s().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 Mc({addedToSegmentWithWelcomeNotification:e}){return e?s().createElement("p",null,h.Z.I18n.t("importNoWelcomeEmail")):null}function Lc({errors:e,createdSubscribers:t,updatedSubscribers:n,segments:a,addedToSegmentWithWelcomeNotification:r,history:i}){return(0,o.useEffect)((()=>{void 0===a&&0===e.length&&void 0===t&&void 0===n&&i.replace("step_method_selection")}),[a,t,e.length,i,n]),e.length&&h.Z.Notice.error(T.ZP.flatten(e)),s().createElement(s().Fragment,null,s().createElement("div",{className:"updated"},s().createElement(Rc,{subscribersCount:t,segments:a,initialMessage:h.Z.I18n.t("subscribersCreated")}),s().createElement(Rc,{subscribersCount:n,segments:a,initialMessage:h.Z.I18n.t("subscribersUpdated")}),s().createElement(Oc,{createdSubscribers:t,updatedSubscribers:n}),s().createElement(Mc,{addedToSegmentWithWelcomeNotification:r})),s().createElement(Pc,{createdSubscribers:t,updatedSubscribers:n}),s().createElement("div",{className:"mailpoet-settings-grid"},s().createElement("div",{className:"mailpoet-settings-save"},s().createElement(y.Z,{variant:"secondary",type:"button",onClick:()=>i.push("step_method_selection")},h.Z.I18n.t("importAgain")),s().createElement(y.Z,{type:"button",onClick:()=>{window.location.href="admin.php?page=mailpoet-subscribers"}},h.Z.I18n.t("viewSubscribers")))))}Rc.propTypes={segments:b().arrayOf(b().string.isRequired),subscribersCount:b().number,initialMessage:b().string},Rc.defaultProps={segments:[],subscribersCount:0,initialMessage:""},Oc.propTypes={createdSubscribers:b().number,updatedSubscribers:b().number},Oc.defaultProps={createdSubscribers:0,updatedSubscribers:0},Pc.propTypes={createdSubscribers:b().number,updatedSubscribers:b().number},Pc.defaultProps={createdSubscribers:0,updatedSubscribers:0},Mc.propTypes={addedToSegmentWithWelcomeNotification:b().bool},Mc.defaultProps={addedToSegmentWithWelcomeNotification:!1},Lc.propTypes={history:b().shape({push:b().func.isRequired,replace:b().func.isRequired}).isRequired,errors:b().arrayOf(b().string.isRequired),segments:b().arrayOf(b().string.isRequired),createdSubscribers:b().number,updatedSubscribers:b().number,addedToSegmentWithWelcomeNotification:b().bool},Lc.defaultProps={errors:[],segments:void 0,createdSubscribers:void 0,updatedSubscribers:void 0,addedToSegmentWithWelcomeNotification:void 0};var Ac=(0,d.withRouter)(Lc),Fc=({history:e})=>s().createElement(oc,{onProceed:()=>e.push("step_method_selection")});const qc=document.getElementById("import_container"),$c=()=>{const[e,t]=(0,o.useState)(void 0),[n,a]=(0,o.useState)({}),r=(0,Ve.S)(window);return s().createElement(Ve.k.Provider,{value:r},s().createElement(u.UT,null,s().createElement(ot.Z,null),s().createElement(jl,null,s().createElement(d.Switch,null,s().createElement(d.Route,{path:"/step_clean_list",render:e=>s().createElement(Fc,e)}),s().createElement(d.Route,{path:"/step_method_selection",render:e=>s().createElement(ic,(0,k.Z)({},e,{setStepMethodSelectionData:t,subscribersLimitForValidation:100}))}),s().createElement(d.Route,{path:"/step_input_validation",render:t=>s().createElement(mc,(0,k.Z)({},t,{stepMethodSelectionData:e}))}),s().createElement(d.Route,{path:"/step_data_manipulation",render:t=>s().createElement(xc,(0,k.Z)({},t,{stepMethodSelectionData:e,subscribersLimitForValidation:100,setStepDataManipulationData:a}))}),s().createElement(d.Route,{path:"/step_results",render:e=>s().createElement(Ac,(0,k.Z)({},e,{errors:n.errors,createdSubscribers:n.created,updatedSubscribers:n.updated,segments:n.segments,addedToSegmentWithWelcomeNotification:n.added_to_segment_with_welcome_notification}))}),s().createElement(d.Route,{path:"*",render:()=>s().createElement(d.Redirect,{to:"/step_clean_list"})})))))};qc&&c().render(s().createElement($c,null),qc);var Uc=n(19675),jc=n.n(Uc),Wc=n(56692);m()(document).ready((()=>{let e;if(!m()("#mailpoet_subscribers_export").length)return;if(!window.exportData.segments)return;const t=jc().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 o(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=>{T.ZP.contains(a,e.value)||r.push(e.value)})),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,Wc.r)(e.name),e.text=(0,Wc.r)(e.name)}))})),o(a,window.segments),o(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})}))}))}));const Vc=e=>s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("welcomeWizardLetsStartTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("welcomeWizardSenderText")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("form",{id:"mailpoet_sender_form",onSubmit:t=>{t.preventDefault(),m()("#mailpoet_sender_form").parsley().validate()&&e.submit_sender()}},s().createElement(Ot.r.TwoColumns,null,s().createElement("label",{htmlFor:"senderName"},s().createElement("span",{className:"mailpoet-wizard-label"},h.Z.I18n.t("senderName")),s().createElement(ce.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})})),s().createElement("label",{htmlFor:"senderAddress"},s().createElement("span",{className:"mailpoet-wizard-label"},h.Z.I18n.t("senderAddress")),s().createElement(ce.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})}))),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(y.Z,{isFullWidth:!0,type:"submit",withSpinner:e.loading},h.Z.I18n.t("continue")),s().createElement(y.Z,{href:"#finish",isDisabled:e.loading,isFullWidth:!0,onClick:e.finish,variant:"tertiary"},h.Z.I18n.t("finishLater"))));Vc.propTypes={finish:b().func.isRequired,loading:b().bool.isRequired,update_sender:b().func.isRequired,submit_sender:b().func.isRequired,sender:b().shape({name:b().string,address:b().string})},Vc.defaultProps={sender:null};var Yc=Vc;const Bc=e=>s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("welcomeWizardLetsStartTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("welcomeWizardSenderMigratedUserText")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(y.Z,{isFullWidth:!0,onClick:e.next,type:"button"},h.Z.I18n.t("continue")));Bc.propTypes={next:b().func.isRequired};var Hc=Bc;const zc=e=>s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("welcomeWizardEmailCourseTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("welcomeWizardEmailCourseText")),s().createElement("div",{className:"mailpoet-gap"}),s().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"}),s().createElement(y.Z,{isFullWidth:!0,onClick:e.next,type:"button"},h.Z.I18n.t("continue")));zc.propTypes={next:b().func.isRequired};var Kc=zc,Gc=s().createElement("svg",{width:"13",height:"11",viewBox:"0 0 13 11"},s().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"})),Qc=s().createElement("svg",{width:"17",height:"16",viewBox:"0 0 17 16"},s().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"}));const Xc=({onCheck:e,showError:t,checked:n,automationId:a,...r})=>s().createElement("div",{className:g()({"mailpoet-form-yesno":!0,"mailpoet-form-yesno-error":t,"mailpoet-disabled":r.disabled}),"data-automation-id":a},s().createElement("label",null,s().createElement("input",(0,k.Z)({type:"radio",checked:!0===n,onChange:()=>e(!0)},r)),s().createElement("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-yes"},Gc)),s().createElement("label",null,s().createElement("input",(0,k.Z)({type:"radio",checked:!1===n,onChange:()=>e(!1)},r)),s().createElement("span",{className:"mailpoet-form-yesno-control mailpoet-form-yesno-no"},Qc)));Xc.propTypes={name:b().string.isRequired,checked:b().bool,onCheck:b().func.isRequired,showError:b().bool,automationId:b().string};var Jc=Xc;const eu=({loading:e,submitForm:t})=>{const[n,a]=(0,o.useState)({tracking:void 0,libs3rdParty:void 0});return s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("welcomeWizardUsageTrackingStepTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("welcomeWizardTrackingText")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(Ne.Z,{level:5},h.Z.I18n.t("welcomeWizardUsageTrackingStepSubTitle")),s().createElement(Ot.r.TwoColumnsList,null,s().createElement(ma,null,s().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList1")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList2")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList3")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList4")),s().createElement("li",null,h.Z.I18n.t("welcomeWizardTrackingList5")))),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("form",{onSubmit:function(e){return e.preventDefault(),t(n.tracking,n.libs3rdParty),!1}},s().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},s().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},s().createElement(Jc,{onCheck:e=>{const t={tracking:e,libs3rdParty:n.libs3rdParty};e&&(t.libs3rdParty=e),a(t)},checked:n.tracking,name:"mailpoet_tracking"})),s().createElement("div",null,s().createElement("p",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabel")," ",s().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"))),s().createElement("div",{className:"mailpoet-wizard-note"},s().createElement("span",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNoteNote")),h.Z.I18n.t("welcomeWizardUsageTrackingStepTrackingLabelNote")))),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},s().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},s().createElement(Jc,{onCheck:e=>{const t={libs3rdParty:e,tracking:n.tracking};e||(t.tracking=e),a(t)},checked:n.libs3rdParty,name:"mailpoet_libs_3rdParty"})),s().createElement("div",null,s().createElement("p",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabel")," ",s().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"))),s().createElement("div",{className:"mailpoet-wizard-note"},s().createElement("span",null,h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNoteNote")),h.Z.I18n.t("welcomeWizardUsageTrackingStepLibs3rdPartyLabelNote")))),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(y.Z,{isFullWidth:!0,type:"submit",withSpinner:e,disabled:e},h.Z.I18n.t("continue"))))};eu.propTypes={loading:b().bool.isRequired,submitForm:b().func.isRequired};var tu=eu;const nu=({children:e})=>s().createElement("div",{className:"mailpoet-steps-content"},e);nu.propTypes={children:b().node.isRequired};var au=nu;const ru=e=>{const[t,n]=(0,o.useState)(null),[a,r]=(0,o.useState)(null),[i,l]=(0,o.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),s().createElement(s().Fragment,null,s().createElement(Ne.Z,{level:1},h.Z.I18n.t("wooCommerceSetupTitle")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("p",null,h.Z.I18n.t("wooCommerceSetupInfo")),s().createElement("div",{className:"mailpoet-gap"}),s().createElement("form",{onSubmit:n=>(n.preventDefault(),l(!0),null===a||null===t||e.submitForm(a,"true"===t),!1)},s().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},s().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},s().createElement(Jc,{showError:i&&null===a,checked:u,onCheck:e=>r(e?"subscribed":"unsubscribed"),name:"mailpoet_woocommerce_import_type",automationId:"woocommerce_import_type"})),s().createElement("div",null,s().createElement("p",null,R()(h.Z.I18n.t("wooCommerceSetupImportInfo"),/\[link\](.*?)\[\/link\]/,(e=>s().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)))),s().createElement("div",{className:"mailpoet-wizard-note"},s().createElement("span",null,"GDPR"),h.Z.I18n.t("wooCommerceSetupImportGDPRInfo")))),s().createElement("div",{className:"mailpoet-wizard-woocommerce-option"},s().createElement("div",{className:"mailpoet-wizard-woocommerce-toggle"},s().createElement(Jc,{showError:i&&null===t,checked:t,onCheck:e=>n(e),name:"mailpoet_woocommerce_tracking",automationId:"woocommerce_tracking"})),s().createElement("div",null,s().createElement("p",null,R()(h.Z.I18n.t("wooCommerceSetupTrackingInfo"),/\[link\](.*?)\[\/link\]/,(e=>s().createElement("a",{key:e,href:"https://kb.mailpoet.com/article/280-woocommerce-cookie-tracking","data-beacon-article":"5d5fa44c2c7d3a7a4d778906",rel:"noopener noreferrer",target:"_blank"},e)))),s().createElement("div",{className:"mailpoet-wizard-note"},s().createElement("span",null,"GDPR"),h.Z.I18n.t("wooCommerceSetupTrackingGDPRInfo")))),s().createElement("div",{className:"mailpoet-gap"}),s().createElement(y.Z,{isFullWidth:!0,type:"submit",withSpinner:e.loading,disabled:e.loading,automationId:"submit_woocommerce_setup"},c)))};ru.propTypes={submitForm:b().func.isRequired,loading:b().bool.isRequired,isWizardStep:b().bool},ru.defaultProps={isWizardStep:!1};var iu=ru;const ou=e=>s().createElement(s().Fragment,null,s().createElement("div",{className:"mailpoet-wizard-logo"},s().createElement("img",{src:window.mailpoet_logo_url,width:"160",height:"50",alt:"MailPoet logo"})),s().createElement(da,{illustrationUrl:e.illustrationUrl},e.children));ou.propTypes={illustrationUrl:b().string.isRequired,children:b().oneOfType([b().arrayOf(b().node),b().node]).isRequired};var su=ou;const lu=({isWizardStep:e=!1})=>{const[t,n]=(0,o.useState)(!1),a=e=>{n(!1),h.Z.Notice.showApiErrorNotice(e,{scroll:!0})},r=()=>h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"importExport",action:"setupWooCommerceInitialImport"}).fail(a),i=()=>{window.location=window.finish_wizard_url},l=s().createElement(su,{illustrationUrl:window.wizard_woocommerce_illustration_url},s().createElement(iu,{loading:t,submitForm:(e,t)=>{var o;n(!0),(o={woocommerce_import_screen_displayed:1,"mailpoet_subscribe_old_woocommerce_customers.enabled":"subscribed"===e?1:0,"woocommerce.accept_cookie_revenue_tracking.enabled":t?1:0,"woocommerce.accept_cookie_revenue_tracking.set":1},h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:o}).fail(a)).then(r).then(i)},isWizardStep:e}));return e?l:s().createElement(au,null,l)};lu.propTypes={isWizardStep:b().bool},lu.defaultProps={isWizardStep:!1};var cu=lu,uu=({name:e,address:t})=>{const n=t.split("@").pop().toLowerCase();return window.mailpoet_free_domains.indexOf(n)>-1?(({name:e,address:t})=>{const n=`wordpress@${window.location.hostname.replace("www.","")}`;return{sender:{name:e,address:n},reply_to:{name:e,address:t},"signup_confirmation.from.address":n,"signup_confirmation.from.name":e,"signup_confirmation.reply_to.address":t,"signup_confirmation.reply_to.name":e}})({name:e,address:t}):(({name:e,address:t})=>({sender:{name:e,address:t},reply_to:{name:e,address:t},"signup_confirmation.from.address":t,"signup_confirmation.from.name":e,"signup_confirmation.reply_to.address":t,"signup_confirmation.reply_to.name":e}))({name:e,address:t})};const du=()=>{let e=3;return window.has_mss_key_specified||(e+=1),window.is_woocommerce_active&&(e+=1),e},pu=(e,t,n)=>{n<du()?e.push(`/steps/${n+1}`):t()};var mu=n(60054);const hu=e=>{const t=du(),n=parseInt(e.match.params.step,10),[a,r]=(0,o.useState)(!1),[i,l]=(0,o.useState)(window.sender_data);function c(){r(!0),window.location=window.finish_wizard_url}(0,o.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,o.useCallback)(((e,t)=>{r(!0),d({analytics:{enabled:e?"1":""},"3rd_party_libs":{enabled:t?"1":""}}).then((()=>u(n)))}),[u,n]),m=(0,o.useCallback)((e=>{l({...i,...e})}),[i]),f=(0,o.useCallback)((()=>{d(uu(i)).then((()=>u(n)))}),[u,i,n]),g=(0,o.useCallback)((e=>{e.preventDefault(),r(!0),d(uu({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===du()?"WizardWooCommerceStep":"WelcomeWizardPitchMSSStep":"WelcomeWizardMigratedUserStep"})(n);return s().createElement(s().Fragment,null,s().createElement(mu.Z,{count:t,current:n}),s().createElement(au,null,"WelcomeWizardSenderStep"===v?s().createElement(su,{illustrationUrl:window.wizard_sender_illustration_url},s().createElement(Yc,{update_sender:m,submit_sender:f,finish:g,loading:a,sender:i})):null,"WelcomeWizardMigratedUserStep"===v?s().createElement(su,{illustrationUrl:window.wizard_sender_illustration_url},s().createElement(Hc,{next:()=>u(n)})):null,"WelcomeWizardEmailCourseStep"===v?s().createElement(su,{illustrationUrl:window.wizard_email_course_illustration_url},s().createElement(Kc,{next:()=>u(n)})):null,"WelcomeWizardUsageTrackingStep"===v?s().createElement(su,{illustrationUrl:window.wizard_tracking_illustration_url},s().createElement(tu,{loading:a,submitForm:p})):null,"WelcomeWizardPitchMSSStep"===v?s().createElement(su,{illustrationUrl:window.wizard_MSS_pitch_illustration_url},s().createElement(ya,{next:()=>u(n),subscribersCount:window.subscribers_count,mailpoetAccountUrl:window.mailpoet_account_url})):null,"WizardWooCommerceStep"===v?s().createElement(cu,{isWizardStep:!0}):null))};hu.propTypes={match:b().shape({params:b().shape({step:b().string}).isRequired}).isRequired,history:b().shape({push:b().func.isRequired}).isRequired};var fu=hu;const gu=()=>{let e="/steps/1";window.location.search.includes("woocommerce-setup")&&(e="/woocommerce");const t=(0,Ve.S)(window);return s().createElement(Ve.k.Provider,{value:t},s().createElement(u.UT,null,s().createElement(ot.Z,null),s().createElement(d.Switch,null,s().createElement(d.Route,{path:"/steps/:step",component:fu}),s().createElement(d.Route,{path:"/woocommerce",component:cu}),s().createElement(d.Route,{render:()=>s().createElement(d.Redirect,{to:e})}))))},vu=document.getElementById("mailpoet-wizard-container");vu&&c().render(s().createElement(gu,null),vu);const bu=()=>{const[e,t]=(0,o.useState)(null),n=(0,Ve.S)(window),a=n.notices.error;function r(r){const i=r.target.name,o=r.target.checked;h.Z.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"featureFlags",action:"set",data:{[i]:o?1:0}}).done((()=>{const a=e[i];a.value=o,t({...e,[i]:a});const r=`Feature '${i}' was ${o?"enabled":"disabled"}.`;n.notices.success(s().createElement("p",null,r))})).fail((e=>{e.errors.length>0&&a(e.errors.map((e=>s().createElement("p",{key:e.message},e.message))),{scroll:!0})}))}return(0,o.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(s().createElement(s().Fragment,null,e.errors.map((e=>s().createElement("p",null,e.message)))),{scroll:!0})}))}),[a]),null===e?s().createElement("p",null,"Loading experimental features..."):0===Object.values(e).length?s().createElement("p",null,"There are no experimental features at the moment."):s().createElement(Ve.k.Provider,{value:n},s().createElement(s().Fragment,null,s().createElement(ot.Z,null),Object.values(e).map((e=>{const t=`experimental-feature-${e.name}`;return s().createElement("div",{key:e.name},s().createElement("label",{htmlFor:t},s().createElement("input",{id:t,type:"checkbox",name:e.name,defaultChecked:e.value,onChange:r})," ",e.name))}))))},yu=document.getElementById("experimental_features_container");yu&&c().render(s().createElement(bu,null),yu);var wu=n(23520);const Eu=({message:e,editing:t})=>t?s().createElement("textarea",{value:e,className:"mailpoet-logs-full-message",readOnly:!0}):s().createElement(s().Fragment,null,`${e.substr(0,150)}…`);Eu.propTypes={message:b().string.isRequired,editing:b().bool.isRequired};const _u=({log:e})=>{const[t,n]=(0,o.useState)(!1);return s().createElement("tr",{key:`log-row-${e.id}`},s().createElement("td",{role:"gridcell"},e.name),s().createElement("td",{onClick:function(e){(function(e){return(e.ctrlKey||e.metaKey)&&!e.altKey})(e)&&(t||n(!0))},role:"gridcell"},s().createElement(Eu,{message:e.message,editing:t})),s().createElement("td",{role:"gridcell"},h.Z.Date.full(e.created_at)))};_u.propTypes={log:b().shape({id:b().number.isRequired,name:b().string.isRequired,message:b().string.isRequired,created_at:b().string.isRequired}).isRequired};const Zu=({logs:e,onFilter:t,originalFrom:n,originalTo:a,originalSearch:r,originalOffset:i,originalLimit:l})=>{const[c,u]=(0,o.useState)(null!=n?n:void 0),[d,p]=(0,o.useState)(null!=a?a:void 0),[m,f]=(0,o.useState)(null!=i?i:""),[g,v]=(0,o.useState)(null!=l?l:""),[b,y]=(0,o.useState)(r||""),w=(0,ps.curry)(((e,t)=>{e(null!==t?h.Z.Date.format(t,{format:"Y-m-d"}):void 0)})),E=(0,o.useCallback)((()=>{const e={};c&&(e.from=c),d&&(e.to=d),m&&""!==m.trim()&&(e.offset=m),g&&""!==g.trim()&&(e.limit=g),b&&""!==b.trim()&&(e.search=b.trim()),t(e)}),[c,g,m,b,d,t]);return s().createElement("div",{className:"mailpoet-listing mailpoet-logs"},s().createElement("div",{className:"mailpoet-listing-header"},s().createElement("div",{className:"mailpoet-listing-search"},s().createElement("label",{htmlFor:"search_input",className:"screen-reader-text"},h.Z.I18n.t("searchLabel")),s().createElement(ce.Z,{dimension:"small",iconStart:wu.Z,type:"search",id:"search_input",name:"s",onChange:e=>y(e.target.value),value:b,placeholder:h.Z.I18n.t("searchLabel")})),s().createElement("div",{className:"mailpoet-listing-filters"},`${h.Z.I18n.t("from")}:`,s().createElement(At,{dateFormat:"MMMM d, yyyy",onChange:w(u),maxDate:new Date,selected:c?(0,Ro.default)(c):void 0,dimension:"small"}),`${h.Z.I18n.t("to")}:`,s().createElement(At,{dateFormat:"MMMM d, yyyy",onChange:w(p),maxDate:new Date,selected:d?(0,Ro.default)(d):void 0,dimension:"small"})),s().createElement("div",{className:"mailpoet-logs-limit"},s().createElement("label",{htmlFor:"offset_input",className:"screen-reader-text"},h.Z.I18n.t("offsetLabel")),s().createElement(ce.Z,{dimension:"small",id:"offset_input",name:"o",type:"number",onChange:e=>f(e.target.value),value:m,placeholder:h.Z.I18n.t("offsetLabel")})),s().createElement("div",{className:"mailpoet-logs-limit"},s().createElement("label",{htmlFor:"limit_input",className:"screen-reader-text"},h.Z.I18n.t("limitLabel")),s().createElement(ce.Z,{dimension:"small",id:"limit_input",name:"l",type:"number",onChange:e=>v(e.target.value),value:g,placeholder:h.Z.I18n.t("limitLabel")})),s().createElement(Re.Button,{dimension:"small",onClick:E},h.Z.I18n.t("filter"))),s().createElement("table",{className:"mailpoet-listing-table widefat striped",role:"grid"},s().createElement("thead",null,s().createElement("tr",null,s().createElement("th",null,h.Z.I18n.t("tableHeaderName")),s().createElement("th",null,h.Z.I18n.t("tableHeaderMessage")),s().createElement("th",null,h.Z.I18n.t("tableHeaderCreatedOn")))),s().createElement("tbody",null,e.map((e=>s().createElement(_u,{log:e,key:`log-${e.id}`}))))))};Zu.propTypes={logs:b().arrayOf(b().shape({id:b().number.isRequired,name:b().string.isRequired,message:b().string.isRequired,created_at:b().string.isRequired})).isRequired,originalFrom:b().string,originalTo:b().string,originalSearch:b().string,originalOffset:b().string,originalLimit:b().string,onFilter:b().func.isRequired};const Iu=document.getElementById("mailpoet_logs_container");if(Iu){const e=new URL(window.location.href);c().render(s().createElement(Zu,{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,n])=>{e.searchParams.append(t,n)})),window.location.href=e.href}}),Iu)}var Su=n(13651);const ku=({onRequestClose:e})=>{const[t,n]=(0,o.useState)(!1);return m()((e=>{e(document).on("click",".notice .mailpoet-js-button-fix-this",(()=>{n(!0)}))})),s().createElement(Ve.k.Provider,{value:(0,Ve.S)(window)},s().createElement(ot.Z,null),t&&s().createElement(Su.Z,{onRequestClose:()=>{n(!1),e()}}))};ku.propTypes={onRequestClose:b().func},ku.defaultProps={onRequestClose:ps.noop};const Cu=document.getElementById("mailpoet_set_from_address_modal");Cu&&c().render(s().createElement(ku,{onRequestClose:()=>{window.location.href.includes("?page=mailpoet-settings")&&window.location.reload()}}),Cu);const Tu=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=>Tu(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+)?/),o=i[1],s=i[2];if(!s)return n(e,t);switch(o){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(o,t)).replace("{{time}}",a(s,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),o=n(13882);function s(e){(0,o.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,o.Z)(1,arguments);var t=(0,a.default)(e),n=(0,r.Z)(t).getTime()-s(t).getTime();return Math.round(n/l)+1}},7032:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(19013),r=n(66979),i=n(13882);function o(e){(0,i.Z)(1,arguments);var t=(0,a.default)(e),n=t.getUTCFullYear(),o=new Date(0);o.setUTCFullYear(n+1,0,4),o.setUTCHours(0,0,0,0);var s=(0,r.Z)(o),l=new Date(0);l.setUTCFullYear(n,0,4),l.setUTCHours(0,0,0,0);var c=(0,r.Z)(l);return t.getTime()>=s.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(83946),o=n(7651),s=n(13882);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,i.Z)(l),u=null==n.firstWeekContainsDate?c:(0,i.Z)(n.firstWeekContainsDate),d=(0,o.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 s}});var a=n(83946),r=n(19013),i=n(59025),o=n(13882);function s(e,t){(0,o.Z)(1,arguments);var n=(0,r.default)(e,t),s=n.getUTCFullYear(),l=t||{},c=l.locale,u=c&&c.options&&c.options.firstWeekContainsDate,d=null==u?1:(0,a.Z)(u),p=null==l.firstWeekContainsDate?d:(0,a.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(s+1,0,p),m.setUTCHours(0,0,0,0);var h=(0,i.Z)(m,t),f=new Date(0);f.setUTCFullYear(s,0,p),f.setUTCHours(0,0,0,0);var g=(0,i.Z)(f,t);return n.getTime()>=h.getTime()?s+1:n.getTime()>=g.getTime()?s:s-1}},5267:function(e,t,n){"use strict";n.d(t,{Iu:function(){return i},Do:function(){return o},qp:function(){return s}});var a=["D","DD"],r=["YY","YYYY"];function i(e){return-1!==a.indexOf(e)}function o(e){return-1!==r.indexOf(e)}function s(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(),o=(i<t?7:0)+i-t;return n.setUTCDate(n.getUTCDate()-o),n.setUTCHours(0,0,0,0),n}},59025:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(83946),r=n(19013),i=n(13882);function o(e,t){(0,i.Z)(1,arguments);var n=t||{},o=n.locale,s=o&&o.options&&o.options.weekStartsOn,l=null==s?0:(0,a.Z)(s),c=null==n.weekStartsOn?l:(0,a.Z)(n.weekStartsOn);if(!(c>=0&&c<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=(0,r.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 o}});var a=n(83946),r=n(19013),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t);return isNaN(o)?new Date(NaN):o?(n.setDate(n.getDate()+o),n):n}},78343: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),o=36e5;function s(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.Z)(e,n*o)}},51820:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(83946),r=n(19013),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e).getTime(),o=(0,a.Z)(t);return new Date(n+o)}},58545: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);function o(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 o}});var a=n(83946),r=n(19013),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t);if(isNaN(o))return new Date(NaN);if(!o)return n;var s=n.getDate(),l=new Date(n.getTime());l.setMonth(n.getMonth()+o+1,0);var c=l.getDate();return s>=c?l:(n.setFullYear(l.getFullYear(),l.getMonth(),s),n)}},63500:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(83946),r=n(77349),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t),o=7*n;return(0,r.default)(e,o)}},21593:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var a=n(83946),r=n(11640),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,a.Z)(t);return(0,r.default)(e,12*n)}},92300:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(24262),r=n(69119),i=n(13882),o=864e5;function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,r.default)(t),l=n.getTime()-(0,a.Z)(n),c=s.getTime()-(0,a.Z)(s);return Math.round((l-c)/o)}},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),o=n.getFullYear()-i.getFullYear(),s=n.getMonth()-i.getMonth();return 12*o+s}},52724:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var a=n(584),r=n(24262),i=n(13882),o=6048e5;function s(e,t,n){(0,i.Z)(2,arguments);var s=(0,a.default)(e,n),l=(0,a.default)(t,n),c=s.getTime()-(0,r.Z)(s),u=l.getTime()-(0,r.Z)(l);return Math.round((c-u)/o)}},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 o}});var a=n(19013),r=n(83946),i=n(13882);function o(e,t){(0,i.Z)(1,arguments);var n=t||{},o=n.locale,s=o&&o.options&&o.options.weekStartsOn,l=null==s?0:(0,r.Z)(s),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 M}});var a=n(12274),r=n(4958),i=n(91218),o=n(19013);function s(e,t){for(var n=e<0?"-":"",a=Math.abs(e).toString();a.length<t;)a="0"+a;return n+a}var l=function(e,t){var n=e.getUTCFullYear(),a=n>0?n:1-n;return s("yy"===t?a%100:a,t.length)},c=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):s(n+1,2)},u=function(e,t){return s(e.getUTCDate(),t.length)},d=function(e,t){return s(e.getUTCHours()%12||12,t.length)},p=function(e,t){return s(e.getUTCHours(),t.length)},m=function(e,t){return s(e.getUTCMinutes(),t.length)},h=function(e,t){return s(e.getUTCSeconds(),t.length)},f=function(e,t){var n=t.length,a=e.getUTCMilliseconds();return s(Math.floor(a*Math.pow(10,n-3)),t.length)},g=n(13882),v=864e5,b=n(49702),y=n(7032),w=n(23324),E=n(7651);function _(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 o=t||"";return n+String(r)+o+s(i,2)}function Z(e,t){return e%60==0?(e>0?"-":"+")+s(Math.abs(e)/60,2):I(e,t)}function I(e,t){var n=t||"",a=e>0?"-":"+",r=Math.abs(e);return a+s(Math.floor(r/60),2)+n+s(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 l(e,t)},Y:function(e,t,n,a){var r=(0,E.Z)(e,a),i=r>0?r:1-r;return"YY"===t?s(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):s(i,t.length)},R:function(e,t){return s((0,y.Z)(e),t.length)},u:function(e,t){return s(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 s(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 s(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 c(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 s(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,w.Z)(e,a);return"wo"===t?n.ordinalNumber(r,{unit:"week"}):s(r,t.length)},I:function(e,t,n){var a=(0,b.Z)(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):s(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):u(e,t)},D:function(e,t,n){var a=function(e){(0,g.Z)(1,arguments);var t=(0,o.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/v)+1}(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):s(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 s(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 s(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 s(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 d(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):p(e,t)},K:function(e,t,n){var a=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):s(a,t.length)},k:function(e,t,n){var a=e.getUTCHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):s(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):h(e,t)},S:function(e,t){return f(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"+_(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"+_(r,":");case"zzzz":default:return"GMT"+I(r,":")}},t:function(e,t,n,a){var r=a._originalDate||e;return s(Math.floor(r.getTime()/1e3),t.length)},T:function(e,t,n,a){return s((a._originalDate||e).getTime(),t.length)}},k=n(97621),C=n(24262),T=n(5267),N=n(83946),D=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,R=/^'([^]*?)'?$/,O=/''/g,P=/[a-zA-Z]/;function M(e,t,n){(0,g.Z)(2,arguments);var s=String(t),l=n||{},c=l.locale||r.Z,u=c.options&&c.options.firstWeekContainsDate,d=null==u?1:(0,N.Z)(u),p=null==l.firstWeekContainsDate?d:(0,N.Z)(l.firstWeekContainsDate);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=c.options&&c.options.weekStartsOn,h=null==m?0:(0,N.Z)(m),f=null==l.weekStartsOn?h:(0,N.Z)(l.weekStartsOn);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!c.localize)throw new RangeError("locale must contain localize property");if(!c.formatLong)throw new RangeError("locale must contain formatLong property");var v=(0,o.default)(e);if(!(0,a.default)(v))throw new RangeError("Invalid time value");var b=(0,C.Z)(v),y=(0,i.Z)(v,b),w={firstWeekContainsDate:p,weekStartsOn:f,locale:c,_originalDate:v},E=s.match(x).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,k.Z[t])(e,c.formatLong,w):e})).join("").match(D).map((function(n){if("''"===n)return"'";var a=n[0];if("'"===a)return L(n);var r=S[a];if(r)return!l.useAdditionalWeekYearTokens&&(0,T.Do)(n)&&(0,T.qp)(n,t,e),!l.useAdditionalDayOfYearTokens&&(0,T.Iu)(n)&&(0,T.qp)(n,t,e),r(y,n,c.localize,w);if(a.match(P))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return n})).join("");return E}function L(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 o(e){return(0,i.Z)(1,arguments),(0,r.default)(e,{weekStartsOn:1})}function s(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 s=o(r),l=new Date(0);l.setFullYear(n,0,4),l.setHours(0,0,0,0);var c=o(l);return t.getTime()>=s.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function l(e){(0,i.Z)(1,arguments);var t=s(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var a=o(n);return a}var c=6048e5;function u(e){(0,i.Z)(1,arguments);var t=(0,a.default)(e),n=o(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){(0,r.Z)(1,arguments);var t=(0,a.default)(e),n=t.getFullYear();return n}},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 o}});var a=n(71381),r=n(19013),i=n(13882);function o(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(),o=(0,a.default)(t.end).getTime();if(!(i<=o))throw new RangeError("Invalid interval");return n>=i&&n<=o}},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"})},o={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function s(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,o=r.width?String(r.width):i;a=e.formattingValues[o]||e.formattingValues[i]}else{var s=e.defaultWidth,l=r.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[s]}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 o,s=i[0],l=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(l)?u(l,(function(e){return e.test(s)})):c(l,(function(e){return e.test(s)}));o=e.valueCallback?e.valueCallback(d):d,o=n.valueCallback?n.valueCallback(o):o;var p=t.slice(s.length);return{value:o,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 o[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:s({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:s({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:s({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:s({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:s({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 o=e.slice(a.length);return{value:i,rest:o}}),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 o(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 s=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,o=r&&r.options&&r.options.weekStartsOn,s=null==o?0:(0,u.Z)(o),l=null==a.weekStartsOn?s:(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),b=/^(1[0-2]|0?\d)/,y=/^(3[0-1]|[0-2]?\d)/,w=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,E=/^(5[0-3]|[0-4]?\d)/,_=/^(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/,C=/^[0-5]?\d/,T=/^\d/,N=/^\d{1,2}/,D=/^\d{1,3}/,x=/^\d{1,4}/,R=/^-?\d+/,O=/^-?\d/,P=/^-?\d{1,2}/,M=/^-?\d{1,3}/,L=/^-?\d{1,4}/,A=/^([+-])(\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 W(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 V(e,t){return j(R,e,t)}function Y(e,t,n){switch(e){case 1:return j(T,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(P,t,n);case 3:return j(M,t,n);case 4:return j(L,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 o="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(o,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 o="era"in t&&1!==t.era?1-n.year:n.year;return e.setUTCFullYear(o,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(b,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(b,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,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),o=(0,f.Z)(a,n)-r;return a.setUTCDate(a.getUTCDate()-7*o),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,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(y,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),o=r.getUTCDay(),s=((n%7+7)%7<a?7:0)+n-o;return r.setUTCDate(r.getUTCDate()+s),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","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","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);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:["a","b","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(C,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return Y(t.length,e)}},validate:function(e,t,n){return t>=0&&t<=59},set:function(e,t,n,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 W(A,e);case"XX":return W(F,e);case"XXXX":return W(q,e);case"XXXXX":return W(U,e);case"XXX":default:return W($,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 W(A,e);case"xx":return W(F,e);case"xxxx":return W(q,e);case"xxxxx":return W(U,e);case"xxx":default:return W($,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 V(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 V(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,b=null==v?1:(0,u.Z)(v),y=null==f.firstWeekContainsDate?b:(0,u.Z)(f.firstWeekContainsDate);if(!(y>=1&&y<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var w=g.options&&g.options.weekStartsOn,E=null==w?0:(0,u.Z)(w),_=null==f.weekStartsOn?E:(0,u.Z)(f.weekStartsOn);if(!(_>=0&&_<=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:y,weekStartsOn:_,locale:g},S=[{priority:10,subPriority:-1,set:oe,index:0}],k=h.match(ee).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,s.Z[t])(e,g.formatLong,I):e})).join("").match(J),C=[];for(Z=0;Z<k.length;Z++){var T=k[Z];!f.useAdditionalWeekYearTokens&&(0,c.Do)(T)&&(0,c.qp)(T,h,e),!f.useAdditionalDayOfYearTokens&&(0,c.Iu)(T)&&(0,c.qp)(T,h,e);var N=T[0],D=X[N];if(D){var x=D.incompatibleTokens;if(Array.isArray(x)){for(var R=void 0,O=0;O<C.length;O++){var P=C[O].token;if(-1!==x.indexOf(P)||P===N){R=C[O];break}}if(R)throw new RangeError("The format string mustn't contain `".concat(R.fullToken,"` and `").concat(T,"` at the same time"))}else if("*"===D.incompatibleTokens&&C.length)throw new RangeError("The format string mustn't contain `".concat(T,"` and any other token at the same time"));C.push({token:N,fullToken:T});var M=D.parse(m,T,g.match,I);if(!M)return new Date(NaN);S.push({priority:D.priority,subPriority:D.subPriority||0,set:D.set,validate:D.validate,value:M.value,index:S.length}),m=M.rest}else{if(N.match(re))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");if("''"===T?T="'":"'"===N&&(T=se(T)),0!==m.indexOf(T))return new Date(NaN);m=m.slice(T.length)}}if(m.length>0&&ae.test(m))return new Date(NaN);var L=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]})),A=(0,i.default)(n);if(isNaN(A))return new Date(NaN);var F=(0,r.Z)(A,(0,l.Z)(A)),q={};for(Z=0;Z<L.length;Z++){var $=L[Z];if($.validate&&!$.validate(F,$.value,I))return new Date(NaN);var U=$.set(F,q,$.value,I);U[0]?(F=U[0],o(q,U[1])):F=U}return F}function oe(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 se(e){return e.match(te)[1].replace(ne,"'")}},23855:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return u}});var a=n(83946),r=n(13882),i=36e5,o={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},s=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,l=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,c=/^([+-])(\d{2})(?::?(\d{2}))?$/;function u(e,t){(0,r.Z)(1,arguments);var n=t||{},i=null==n.additionalDigits?2:(0,a.Z)(n.additionalDigits);if(2!==i&&1!==i&&0!==i)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 o,s=d(e);if(s.date){var l=p(s.date,i);o=m(l.restDateString,l.year)}if(isNaN(o)||!o)return new Date(NaN);var c,u=o.getTime(),h=0;if(s.time&&(h=f(s.time),isNaN(h)||null===h))return new Date(NaN);if(!s.timezone){var g=new Date(u+h),b=new Date(0);return b.setFullYear(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),b.setHours(g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds()),b}return c=v(s.timezone),isNaN(c)?new Date(NaN):new Date(u+h+c)}function d(e){var t,n={},a=e.split(o.dateTimeDelimiter);if(a.length>2)return n;if(/:/.test(a[0])?(n.date=null,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:null};var r=a[1]&&parseInt(a[1]),i=a[2]&&parseInt(a[2]);return{year:null==i?r:100*i,restDateString:e.slice((a[1]||a[2]).length)}}function m(e,t){if(null===t)return null;var n=e.match(s);if(!n)return null;var a=!!n[4],r=h(n[1]),i=h(n[2])-1,o=h(n[3]),l=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,l,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,l,c):new Date(NaN);var u=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(b[t]||(y(e)?29:28))}(t,i,o)&&function(e,t){return t>=1&&t<=(y(e)?366:365)}(t,r)?(u.setUTCFullYear(t,i,Math.max(r,o)),u):new Date(NaN)}function h(e){return e?parseInt(e):1}function f(e){var t=e.match(l);if(!t)return null;var n=g(t[1]),a=g(t[2]),r=g(t[3]);return function(e,t,n){return 24===e?0===t&&0===n:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}(n,a,r)?n*i+6e4*a+1e3*r:NaN}function g(e){return e&&parseFloat(e.replace(",","."))||0}function v(e){if("Z"===e)return 0;var t=e.match(c);if(!t)return 0;var n="+"===t[1]?-1:1,a=parseInt(t[2]),r=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,r)?n*(a*i+6e4*r):NaN}var b=[31,null,31,30,31,30,31,31,30,31,30,31];function y(e){return e%400==0||e%4==0&&e%100}},37042: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 o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t);return n.setHours(o),n}},4543: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 o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t);return n.setMinutes(o),n}},62225: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 o(e){(0,i.Z)(1,arguments);var t=(0,r.default)(e),n=t.getFullYear(),a=t.getMonth(),o=new Date(0);return o.setFullYear(n,a+1,0),o.setHours(0,0,0,0),o.getDate()}function s(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t),l=n.getFullYear(),c=n.getDate(),u=new Date(0);u.setFullYear(l,s,15),u.setHours(0,0,0,0);var d=o(u);return n.setMonth(s,Math.min(c,d)),n}},11503: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(62225),o=n(13882);function s(e,t){(0,o.Z)(2,arguments);var n=(0,r.default)(e),s=(0,a.Z)(t),l=Math.floor(n.getMonth()/3)+1,c=s-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 o}});var a=n(83946),r=n(19013),i=n(13882);function o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t);return n.setSeconds(o),n}},44749: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 o(e,t){(0,i.Z)(2,arguments);var n=(0,r.default)(e),o=(0,a.Z)(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(o),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 o}});var a=n(19013),r=n(83946),i=n(13882);function o(e,t){(0,i.Z)(1,arguments);var n=t||{},o=n.locale,s=o&&o.options&&o.options.weekStartsOn,l=null==s?0:(0,r.Z)(s),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 o}});var a=n(83946),r=n(77349),i=n(13882);function o(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 o}});var a=n(83946),r=n(78343),i=n(13882);function o(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 o}});var a=n(83946),r=n(51820),i=n(13882);function o(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 o}});var a=n(83946),r=n(58545),i=n(13882);function o(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 o}});var a=n(83946),r=n(11640),i=n(13882);function o(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 o}});var a=n(83946),r=n(63500),i=n(13882);function o(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 o}});var a=n(83946),r=n(21593),i=n(13882);function o(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,o=r.width?String(r.width):i;a=e.formattingValues[o]||e.formattingValues[i]}else{var s=e.defaultWidth,l=r.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[s]}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,o={parse:function(n,a){var s=(a=a||{}).dynamicTyping||!1;if(E(s)&&(a.dynamicTypingFunction=s,s={}),a.dynamicTyping=s,a.transform=!!E(a.transform)&&a.transform,a.worker&&o.WORKERS_SUPPORTED){var l=function(){if(!o.WORKERS_SUPPORTED)return!1;var n,a,s=(n=t.URL||t.webkitURL||null,a=e.toString(),o.BLOB_URL||(o.BLOB_URL=n.createObjectURL(new Blob(["(",a,")();"],{type:"text/javascript"})))),l=new t.Worker(s);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=E(a.step),a.chunk=E(a.chunk),a.complete=E(a.complete),a.error=E(a.error),delete a.worker,void l.postMessage({input:n,config:a,workerId:l.id})}var m=null;return o.NODE_STREAM_INPUT,"string"==typeof n?m=a.download?new c(a):new d(a):!0===n.readable&&E(n.read)&&E(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",s='"',l=s+s,c=!1,u=null,d=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||o.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&&(s=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+s),"boolean"==typeof t.escapeFormulae&&(d=t.escapeFormulae)}}();var p=new RegExp(h(s),"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 o="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var s=Array.isArray(e)&&0<e.length,l=!Array.isArray(t[0]);if(s&&a){for(var c=0;c<e.length;c++)0<c&&(o+=r),o+=f(e[c],c);0<t.length&&(o+=i)}for(var u=0;u<t.length;u++){var d=s?e.length:t[u].length,p=!1,m=s?0===Object.keys(t[u]).length:0===t[u].length;if(n&&!s&&(p="greedy"===n?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===n&&s){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 b=0;b<d;b++){0<b&&!m&&(o+=r);var y=s&&l?e[b]:b;o+=f(t[u][y],b)}u<t.length-1&&(!n||0<d&&!m)&&(o+=i)}}return o}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,o.BAD_DELIMITERS)||-1<a.indexOf(r)||" "===a.charAt(0)||" "===a.charAt(a.length-1)?s+a+s:a}}};if(o.RECORD_SEP=String.fromCharCode(30),o.UNIT_SEP=String.fromCharCode(31),o.BYTE_ORDER_MARK="\ufeff",o.BAD_DELIMITERS=["\r","\n",'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!n&&!!t.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=f,o.ParserHandle=m,o.NetworkStreamer=c,o.FileStreamer=u,o.StringStreamer=d,o.ReadableStreamStreamer=p,t.jQuery){var s=t.jQuery;s.fn.parse=function(e){var n=e.config||{},a=[];return this.each((function(e){if("INPUT"!==s(this).prop("tagName").toUpperCase()||"file"!==s(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:s.extend({},n)})})),r(),this;function r(){if(0!==a.length){var t,n,r,l=a[0];if(E(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(e.error)&&e.error({name:"AbortError"},t,n,r));if("skip"===c.action)return void i();"object"==typeof c.config&&(l.instanceConfig=s.extend(l.instanceConfig,c.config))}else if("skip"===c)return void i()}var u=l.instanceConfig.complete;l.instanceConfig.complete=function(e){E(u)&&u(e,l.file,l.inputElem),i()},o.parse(l.file,l.instanceConfig)}else E(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=y(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new m(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&E(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 s=this._handle.parse(i,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=s.meta.cursor;this._finished||(this._partialLine=i.substring(l-this._baseIndex),this._baseIndex=l),s&&s.data&&(this._rowCount+=s.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(a)t.postMessage({results:s,workerId:o.WORKER_ID,finished:c});else if(E(this._config.chunk)&&!n){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);s=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!c||!E(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):a&&this._config.error&&t.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.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=o.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,s=/^\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(e.step)){var b=e.step;e.step=function(t){if(v=t,Z())_();else{if(_(),0===v.data.length)return;u+=t.data.length,e.preview&&u>e.preview?n.abort():(v.data=v.data[0],b(v,c))}}}function w(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function _(){if(v&&a&&(S("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.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(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,o=t[a];e.header&&(i=a>=g.length?"__parsed_extra":g[a]),e.transform&&(o=e.transform(o,i)),o=I(i,o),"__parsed_extra"===i?(r[i]=r[i]||[],r[i].push(o)):r[i]=o}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(s.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,s){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 o=0,s=0;s<a.length;s++)"\n"===a[s][0]&&o++;return o>=a.length/2?"\r\n":"\r"}(r,l)),a=!1,e.delimiter)E(e.delimiter)&&(e.delimiter=e.delimiter(r),v.meta.delimiter=e.delimiter);else{var c=function(t,n,a,r,i){var s,l,c,u;i=i||[",","\t","|",";",o.RECORD_SEP,o.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),b=0;b<v.data.length;b++)if(a&&w(v.data[b]))g++;else{var y=v.data[b].length;h+=y,void 0!==c?0<y&&(m+=Math.abs(y-c),c=y):c=y}0<v.data.length&&(h/=v.data.length-g),(void 0===l||m<=l)&&(void 0===u||u<h)&&1.99<h&&(l=m,s=p,u=h)}return{successful:!!(e.delimiter=s),bestDelimiter:s}}(r,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(a=!0,e.delimiter=o.DefaultDelimiter),v.meta.delimiter=e.delimiter}var u=y(e);return e.preview&&e.header&&u.preview++,t=r,n=new f(u),v=n.parse(t,i,s),_(),p?{meta:{paused:!0}}:v||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,n.abort(),t=E(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(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,s=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<o.BAD_DELIMITERS.indexOf(n))&&(n=","),r===n)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<o.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==a&&"\r"!==a&&"\r\n"!==a&&(a="\n");var u=0,d=!1;this.parse=function(e,o,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,b=E(i),y=[],w=[],_=[],Z=u=0;if(!e)return L();if(l||!1!==l&&-1===e.indexOf(t)){for(var I=e.split(a),S=0;S<I.length;S++){if(_=I[S],u+=_.length,S!==I.length-1)u+=a.length;else if(p)return L();if(!r||_.substring(0,v)!==r){if(b){if(y=[],R(_.split(n)),A(),d)return L()}else R(_.split(n));if(s&&s<=S)return y=y.slice(0,s),L(!0)}}return L()}for(var k=e.indexOf(n,u),C=e.indexOf(a,u),T=new RegExp(h(c)+h(t),"g"),N=e.indexOf(t,u);;)if(e[u]!==t)if(r&&0===_.length&&e.substring(u,u+v)===r){if(-1===C)return L();u=C+g,C=e.indexOf(a,u),k=e.indexOf(n,u)}else if(-1!==k&&(k<C||-1===C))_.push(e.substring(u,k)),u=k+f,k=e.indexOf(n,u);else{if(-1===C)break;if(_.push(e.substring(u,C)),M(C+g),b&&(A(),d))return L();if(s&&y.length>=s)return L(!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:y.length,index:u}),P();if(N===m-1)return P(e.substring(u,N).replace(T,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!==C&&C<N+1&&(C=e.indexOf(a,N+1));var D=O(-1===C?k:Math.min(k,C));if(e[N+1+D]===n){_.push(e.substring(u,N).replace(T,t)),e[u=N+1+D+f]!==t&&(N=e.indexOf(t,u)),k=e.indexOf(n,u),C=e.indexOf(a,u);break}var x=O(C);if(e.substring(N+1+x,N+1+x+g)===a){if(_.push(e.substring(u,N).replace(T,t)),M(N+1+x+g),k=e.indexOf(n,u),N=e.indexOf(t,u),b&&(A(),d))return L();if(s&&y.length>=s)return L(!0);break}w.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:y.length,index:u}),N++}}else N++}return P();function R(e){y.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 P(t){return p||(void 0===t&&(t=e.substring(u)),_.push(t),u=m,R(_),b&&A()),L()}function M(t){u=t,R(_),_=[],C=e.indexOf(a,u)}function L(e){return{data:y,errors:w,meta:{delimiter:n,linebreak:a,aborted:d,truncated:!!e,cursor:Z+(o||0)}}}function A(){i(L()),y=[],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:b,resume:b};if(E(n.userStep)){for(var o=0;o<t.results.data.length&&(n.userStep({data:t.results.data[o],errors:t.results.errors,meta:t.results.meta},i),!a);o++);delete t.results}else E(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];E(n.userComplete)&&n.userComplete(t),n.terminate(),delete r[e]}function b(){throw new Error("Not implemented.")}function y(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=y(e[n]);return t}function w(e,t){return function(){e.apply(t,arguments)}}function E(e){return"function"==typeof e}return a&&(t.onmessage=function(e){var n=e.data;if(void 0===o.WORKER_ID&&n&&(o.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:o.WORKER_ID,results:o.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var a=o.parse(n.input,n.config);a&&t.postMessage({workerId:o.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,o})?n.apply(t,[]):n)||(e.exports=a)},9198:function(e,t,n){!function(e,t,a,r,i,o,s,l,c,u,d,p,m,h,f,g,v,b,y,w,E,_,Z,I,S,k,C,T,N,D,x,R,O,P,M,L,A,F,q,$,U,j,W,V,Y,B,H,z,K,G,Q,X,J,ee,te,ne,ae,re,ie,oe,se,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(o),fe=ue(s),ge=ue(l),ve=ue(c),be=ue(u),ye=ue(d),we=ue(p),Ee=ue(m),_e=ue(g),Ze=ue(v),Ie=ue(b),Se=ue(y),ke=ue(w),Ce=ue(E),Te=ue(_),Ne=ue(Z),De=ue(I),xe=ue(S),Re=ue(k),Oe=ue(C),Pe=ue(T),Me=ue(N),Le=ue(D),Ae=ue(x),Fe=ue(R),qe=ue(O),$e=ue(P),Ue=ue(M),je=ue(L),We=ue(A),Ve=ue(F),Ye=ue(q),Be=ue(U),He=ue(j),ze=ue(W),Ke=ue(V),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),ot=ue(ae),st=ue(re),lt=ue(ie),ct=ue(oe),ut=ue(se),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){bt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ht(e){return(ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ft(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gt(e,t){for(var n=0;n<t.length;n++){var 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),e}function bt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yt(){return(yt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var 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");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_t(e,t)}function Et(e){return(Et=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _t(e,t){return(_t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function 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=Et(e);if(t){var r=Et(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 Ct(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function Tt(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function 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 Tt(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}}",Tt(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):st.default(e):new Date;return Mt(t)?t:null}function Pt(e,t,n,a,r){var i=null,o=Jt(n)||Jt(Xt()),s=!0;return Array.isArray(t)?(t.forEach((function(t){var n=lt.default(e,t,new Date,{locale:o});a&&(s=Mt(n,r)&&e===fe.default(n,t,{awareOfUnicodeTokens:!0})),Mt(n,r)&&s&&(i=n)})),i):(i=lt.default(e,t,new Date,{locale:o}),a?s=Mt(i)&&e===fe.default(i,t,{awareOfUnicodeTokens:!0}):Mt(i)||(t=t.match(Rt).map((function(e){var t=e[0];return"p"===t||"P"===t?o?(0,Dt[t])(e,o.formatLong):t:e})).join(""),e.length>0&&(i=lt.default(e,t.slice(0,e.length),new Date)),Mt(i)||(i=new Date(e))),Mt(i)&&s?i:null)}function Mt(e,t){return t=t||new Date("1/1/1000"),he.default(e)&&rt.default(e,t)}function Lt(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 At(e,t){var n=t.dateFormat,a=t.locale;return e&&Lt(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,o=t.second,s=void 0===o?0:o;return Fe.default(Ae.default(Le.default(e,s),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 Lt(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 Wt(e){return Ke.default(e)}function Vt(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=ot.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 Lt(qe.default(Ot(),e),"LLLL",t)}function tn(e,t){return Lt(qe.default(Ot(),e),"LLL",t)}function nn(e,t){return Lt($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.includeDates,o=t.filterDate;return dn(e,{minDate:n,maxDate:a})||r&&r.some((function(t){return Kt(e,t)}))||i&&!i.some((function(t){return Kt(e,t)}))||o&&!o(Ot(e))||!1}function rn(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).excludeDates;return t&&t.some((function(t){return Kt(e,t)}))||!1}function on(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minDate,a=t.maxDate,r=t.excludeDates,i=t.includeDates,o=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)}))||o&&!o(Ot(e))||!1}function sn(e,t,n,a){var r=Pe.default(e),i=Re.default(e),o=Pe.default(t),s=Re.default(t),l=Pe.default(a);return r===o&&r===l?i<=n&&n<=s:r<o?l===r&&i<=n||l===o&&s>=n||l<o&&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,o=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)}))||o&&!o(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=Pe.default(e),i=Oe.default(e),o=Pe.default(t),s=Oe.default(t),l=Pe.default(a);return r===o&&r===l?i<=n&&n<=s:r<o?l===r&&i<=n||l===o&&s>=n||l<o&&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&&Ve.default(e,n)<0||a&&Ve.default(e,a)>0}function pn(e,t){return t.some((function(t){return Te.default(t)===Te.default(e)&&Ce.default(t)===Ce.default(e)}))}function mn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.excludeTimes,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(),o=Fe.default(Ae.default(i,Ce.default(e)),Te.default(e)),s=Fe.default(Ae.default(i,Ce.default(n)),Te.default(n)),l=Fe.default(Ae.default(i,Ce.default(a)),Te.default(a));try{r=!ot.default(o,{start:s,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 bn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.maxDate,a=t.includeDates,r=Ee.default(e,1);return n&&Be.default(r,n)>0||a&&a.every((function(e){return Be.default(r,e)>0}))||!1}function yn(e){var t=e.minDate,n=e.includeDates;if(n&&t){var a=n.filter((function(e){return Ve.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 Ve.default(e,t)<=0}));return We.default(a)}return n?We.default(n):t}function En(){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 o=Lt(i,"MM.dd.yyyy"),s=n.get(o)||[];s.includes(t)||(s.push(t),n.set(o,s))}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=Lt(u[d],"MM.dd.yyyy"),h=n.get(m)||[];h.includes(c)||(h.push(c),n.set(m,h))}}}return n}function _n(e,t,n,a,r){for(var i=r.length,o=[],s=0;s<i;s++){var l=ge.default(ve.default(e,Te.default(r[s])),Ce.default(r[s])),c=ge.default(e,(n+1)*a);rt.default(l,t)&&it.default(l,c)&&o.push(r[s])}return o}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(Pe.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 o=e+t-i,s=!0;n&&(s=Pe.default(n)<=o),a&&s&&(s=Pe.default(a)>=o),s&&r.push(o)}return r}var kn=function(e){wt(n,e);var t=St(n);function n(e){var a;ft(this,n),bt(Zt(a=t.call(this,e)),"renderOptions",(function(){var e=a.props.year,t=a.state.yearsList.map((function(t){return de.default.createElement("div",{className:e===t?"react-datepicker__year-option react-datepicker__year-option--selected_year":"react-datepicker__year-option",key:t,onClick:a.onChange.bind(Zt(a),t)},e===t?de.default.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",t)})),n=a.props.minDate?Pe.default(a.props.minDate):null,r=a.props.maxDate?Pe.default(a.props.maxDate):null;return r&&a.state.yearsList.find((function(e){return e===r}))||t.unshift(de.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:a.incrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),n&&a.state.yearsList.find((function(e){return e===n}))||t.push(de.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:a.decrementYears},de.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t})),bt(Zt(a),"onChange",(function(e){a.props.onChange(e)})),bt(Zt(a),"handleClickOutside",(function(){a.props.onCancel()})),bt(Zt(a),"shiftYears",(function(e){var t=a.state.yearsList.map((function(t){return t+e}));a.setState({yearsList:t})})),bt(Zt(a),"incrementYears",(function(){return a.shiftYears(1)})),bt(Zt(a),"decrementYears",(function(){return a.shiftYears(-1)}));var r=e.yearDropdownItemNumber,i=e.scrollableYearDropdown,o=r||(i?10:5);return a.state={yearsList:Sn(a.props.year,o,a.props.minDate,a.props.maxDate)},a}return vt(n,[{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},this.renderOptions())}}]),n}(de.default.Component),Cn=ut.default(kn),Tn=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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{dropdownVisible:!1}),bt(Zt(e),"renderSelectOptions",(function(){for(var t=e.props.minDate?Pe.default(e.props.minDate):1900,n=e.props.maxDate?Pe.default(e.props.maxDate):2100,a=[],r=t;r<=n;r++)a.push(de.default.createElement("option",{key:r,value:r},r));return a})),bt(Zt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),bt(Zt(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:e.props.year,className:"react-datepicker__year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),bt(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))})),bt(Zt(e),"renderDropdown",(function(){return de.default.createElement(Cn,{key:"dropdown",year:e.props.year,onChange:e.onChange,onCancel:e.toggleDropdown,minDate:e.props.minDate,maxDate:e.props.maxDate,scrollableYearDropdown:e.props.scrollableYearDropdown,yearDropdownItemNumber:e.props.yearDropdownItemNumber})})),bt(Zt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),bt(Zt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.year&&e.props.onChange(t)})),bt(Zt(e),"toggleDropdown",(function(t){e.setState({dropdownVisible:!e.state.dropdownVisible},(function(){e.props.adjustDateOnChange&&e.handleYearChange(e.props.date,t)}))})),bt(Zt(e),"handleYearChange",(function(t,n){e.onSelect(t,n),e.setOpen()})),bt(Zt(e),"onSelect",(function(t,n){e.props.onSelect&&e.props.onSelect(t,n)})),bt(Zt(e),"setOpen",(function(){e.props.setOpen&&e.props.setOpen(!0)})),e}return vt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return 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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"renderOptions",(function(){return e.props.monthNames.map((function(t,n){return de.default.createElement("div",{className:e.props.month===n?"react-datepicker__month-option react-datepicker__month-option--selected_month":"react-datepicker__month-option",key:t,onClick:e.onChange.bind(Zt(e),n)},e.props.month===n?de.default.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",t)}))})),bt(Zt(e),"onChange",(function(t){return e.props.onChange(t)})),bt(Zt(e),"handleClickOutside",(function(){return e.props.onCancel()})),e}return vt(n,[{key:"render",value:function(){return 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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{dropdownVisible:!1}),bt(Zt(e),"renderSelectOptions",(function(e){return e.map((function(e,t){return de.default.createElement("option",{key:t,value:t},e)}))})),bt(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))})),bt(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]))})),bt(Zt(e),"renderDropdown",(function(t){return de.default.createElement(Dn,{key:"dropdown",month:e.props.month,monthNames:t,onChange:e.onChange,onCancel:e.toggleDropdown})})),bt(Zt(e),"renderScrollMode",(function(t){var n=e.state.dropdownVisible,a=[e.renderReadView(!n,t)];return n&&a.unshift(e.renderDropdown(t)),a})),bt(Zt(e),"onChange",(function(t){e.toggleDropdown(),t!==e.props.month&&e.props.onChange(t)})),bt(Zt(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return vt(n,[{key:"render",value:function(){var e,t=this,n=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(e){return tn(e,t.props.locale)}:function(e){return en(e,t.props.locale)});switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode(n);break;case"select":e=this.renderSelectMode(n)}return 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=Wt(e),r=Wt(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),bt(Zt(a=t.call(this,e)),"renderOptions",(function(){return a.state.monthYearsList.map((function(e){var t=Me.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)},n?de.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Lt(e,a.props.dateFormat,a.props.locale))}))})),bt(Zt(a),"onChange",(function(e){return a.props.onChange(e)})),bt(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),Pn=ut.default(On),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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"state",{dropdownVisible:!1}),bt(Zt(e),"renderSelectOptions",(function(){for(var t=Wt(e.props.minDate),n=Wt(e.props.maxDate),a=[];!rt.default(t,n);){var r=Me.default(t);a.push(de.default.createElement("option",{key:r,value:r},Lt(t,e.props.dateFormat,e.props.locale))),t=we.default(t,1)}return a})),bt(Zt(e),"onSelectChange",(function(t){e.onChange(t.target.value)})),bt(Zt(e),"renderSelectMode",(function(){return de.default.createElement("select",{value:Me.default(Wt(e.props.date)),className:"react-datepicker__month-year-select",onChange:e.onSelectChange},e.renderSelectOptions())})),bt(Zt(e),"renderReadView",(function(t){var n=Lt(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))})),bt(Zt(e),"renderDropdown",(function(){return de.default.createElement(Pn,{key:"dropdown",date:e.props.date,dateFormat:e.props.dateFormat,onChange:e.onChange,onCancel:e.toggleDropdown,minDate:e.props.minDate,maxDate:e.props.maxDate,scrollableMonthYearDropdown:e.props.scrollableMonthYearDropdown,locale:e.props.locale})})),bt(Zt(e),"renderScrollMode",(function(){var t=e.state.dropdownVisible,n=[e.renderReadView(!t)];return t&&n.unshift(e.renderDropdown()),n})),bt(Zt(e),"onChange",(function(t){e.toggleDropdown();var n=Ot(parseInt(t));Bt(e.props.date,n)&&Ht(e.props.date,n)||e.props.onChange(n)})),bt(Zt(e),"toggleDropdown",(function(){return e.setState({dropdownVisible:!e.state.dropdownVisible})})),e}return vt(n,[{key:"render",value:function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return 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),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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"dayEl",de.default.createRef()),bt(Zt(e),"handleClick",(function(t){!e.isDisabled()&&e.props.onClick&&e.props.onClick(t)})),bt(Zt(e),"handleMouseEnter",(function(t){!e.isDisabled()&&e.props.onMouseEnter&&e.props.onMouseEnter(t)})),bt(Zt(e),"handleOnKeyDown",(function(t){" "===t.key&&(t.preventDefault(),t.key="Enter"),e.props.handleOnKeyDown(t)})),bt(Zt(e),"isSameDay",(function(t){return Kt(e.props.day,t)})),bt(Zt(e),"isKeyboardSelected",(function(){return!e.props.disabledKeyboardNavigation&&!e.isSameDay(e.props.selected)&&e.isSameDay(e.props.preSelection)})),bt(Zt(e),"isDisabled",(function(){return an(e.props.day,e.props)})),bt(Zt(e),"isExcluded",(function(){return rn(e.props.day,e.props)})),bt(Zt(e),"getHighLightedClass",(function(t){var n=e.props,a=n.day,r=n.highlightDates;if(!r)return!1;var i=Lt(a,"MM.dd.yyyy");return r.get(i)})),bt(Zt(e),"isInRange",(function(){var t=e.props,n=t.day,a=t.startDate,r=t.endDate;return!(!a||!r)&&Qt(n,a,r)})),bt(Zt(e),"isInSelectingRange",(function(){var t,n=e.props,a=n.day,r=n.selectsStart,i=n.selectsEnd,o=n.selectsRange,s=n.startDate,l=n.endDate,c=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return!(!(r||i||o)||!c||e.isDisabled())&&(r&&l&&(it.default(c,l)||Gt(c,l))?Qt(a,c,l):(i&&s&&(rt.default(c,s)||Gt(c,s))||!(!o||!s||l||!rt.default(c,s)&&!Gt(c,s)))&&Qt(a,s,c))})),bt(Zt(e),"isSelectingRangeStart",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,a=n.day,r=n.startDate,i=n.selectsStart,o=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Kt(a,i?o:r)})),bt(Zt(e),"isSelectingRangeEnd",(function(){var t;if(!e.isInSelectingRange())return!1;var n=e.props,a=n.day,r=n.endDate,i=n.selectsEnd,o=null!==(t=e.props.selectingDate)&&void 0!==t?t:e.props.preSelection;return Kt(a,i?o:r)})),bt(Zt(e),"isRangeStart",(function(){var t=e.props,n=t.day,a=t.startDate,r=t.endDate;return!(!a||!r)&&Kt(a,n)})),bt(Zt(e),"isRangeEnd",(function(){var t=e.props,n=t.day,a=t.startDate,r=t.endDate;return!(!a||!r)&&Kt(r,n)})),bt(Zt(e),"isWeekend",(function(){var t=Ne.default(e.props.day);return 0===t||6===t})),bt(Zt(e),"isOutsideMonth",(function(){return void 0!==e.props.month&&e.props.month!==Re.default(e.props.day)})),bt(Zt(e),"getClassNames",(function(t){var n=e.props.dayClassName?e.props.dayClassName(t):void 0;return pe.default("react-datepicker__day",n,"react-datepicker__day--"+$t(e.props.day),{"react-datepicker__day--disabled":e.isDisabled(),"react-datepicker__day--excluded":e.isExcluded(),"react-datepicker__day--selected":e.isSameDay(e.props.selected),"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.isSameDay(Ot()),"react-datepicker__day--weekend":e.isWeekend(),"react-datepicker__day--outside-month":e.isOutsideMonth()},e.getHighLightedClass("react-datepicker__day--highlighted"))})),bt(Zt(e),"getAriaLabel",(function(){var t=e.props,n=t.day,a=t.ariaLabelPrefixWhenEnabled,r=void 0===a?"Choose":a,i=t.ariaLabelPrefixWhenDisabled,o=void 0===i?"Not available":i,s=e.isDisabled()||e.isExcluded()?o:r;return"".concat(s," ").concat(Lt(n,"PPPP",e.props.locale))})),bt(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})),bt(Zt(e),"handleFocusDay",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1;0===e.getTabIndex()&&!t.isInputFocused&&e.isSameDay(e.props.preSelection)&&(document.activeElement&&document.activeElement!==document.body||(n=!0),e.props.inline&&!e.props.shouldFocusDayInline&&(n=!1),e.props.containerRef&&e.props.containerRef.current&&e.props.containerRef.current.contains(document.activeElement)&&document.activeElement.classList.contains("react-datepicker__day")&&(n=!0)),n&&e.dayEl.current.focus({preventScroll:!0})})),bt(Zt(e),"renderDayContents",(function(){if(e.isOutsideMonth()){if(e.props.monthShowsDuplicateDaysEnd&&De.default(e.props.day)<10)return null;if(e.props.monthShowsDuplicateDaysStart&&De.default(e.props.day)>20)return null}return e.props.renderDayContents?e.props.renderDayContents(De.default(e.props.day),e.props.day):De.default(e.props.day)})),bt(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()},e.renderDayContents())})),e}return vt(n,[{key:"componentDidMount",value:function(){this.handleFocusDay()}},{key:"componentDidUpdate",value:function(e){this.handleFocusDay(e)}}]),n}(de.default.Component),An=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 bt(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 bt(Zt(e=t.call.apply(t,[this].concat(r))),"handleDayClick",(function(t,n){e.props.onDayClick&&e.props.onDayClick(t,n)})),bt(Zt(e),"handleDayMouseEnter",(function(t){e.props.onDayMouseEnter&&e.props.onDayMouseEnter(t)})),bt(Zt(e),"handleWeekClick",(function(t,n,a){"function"==typeof e.props.onWeekSelect&&e.props.onWeekSelect(t,n,a),e.props.shouldCloseOnSelect&&e.props.setOpen(!1)})),bt(Zt(e),"formatWeekNumber",(function(t){return e.props.formatWeekNumber?e.props.formatWeekNumber(t):qt(t)})),bt(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(An,{key:"W",weekNumber