Version Description
- Feature: Import for Create by Mediavine
- Feature: Revision Manager TMC compatibility
- Improvement: Yoast SEO graph compatibility
- Improvement: Make sure contentUrl is set in oEmbed video metadata
- Improvement: Show equipment in classic editor preview
- Fix: Prevent wpautop bug from breaking recipe layout
- Fix: Incorrectly thinking changes were made in some cases
Download this release
Release Info
Developer | BrechtVds |
Plugin | WP Recipe Maker |
Version | 5.4.0 |
Comparing to | |
See all releases |
Code changes from version 5.3.0 to 5.4.0
- assets/js/admin-modal/recipe/index.js +5 -1
- assets/js/admin-modal/recipe/nutrition-calculation/StepCustom.js +1 -0
- dist/admin-modal.js +1 -1
- includes/admin/class-wprm-tools-manager.php +9 -5
- includes/admin/import/class-wprm-import-create.php +551 -0
- includes/class-wp-recipe-maker.php +1 -1
- includes/public/class-wprm-metadata-video.php +4 -1
- includes/public/class-wprm-metadata-yoast-seo.php +1 -3
- includes/public/class-wprm-rating-database.php +1 -1
- includes/public/class-wprm-recipe-sanitizer.php +1 -1
- includes/public/class-wprm-recipe-saver.php +8 -6
- includes/public/class-wprm-template-manager.php +2 -1
- includes/public/class-wprm-template-shortcode.php +20 -5
- includes/public/class-wprm-template-shortcodes.php +7 -20
- includes/public/shortcodes/recipe/class-wprm-sc-nutrition-container.php +1 -1
- includes/public/shortcodes/recipe/class-wprm-sc-nutrition.php +3 -1
- readme.txt +32 -1
- templates/admin/shortcode-preview.php +20 -7
- wp-recipe-maker.php +1 -1
assets/js/admin-modal/recipe/index.js
CHANGED
@@ -168,7 +168,11 @@ export default class Recipe extends Component {
|
|
168 |
}
|
169 |
|
170 |
changesMade() {
|
171 |
-
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
|
174 |
render() {
|
168 |
}
|
169 |
|
170 |
changesMade() {
|
171 |
+
if ( typeof window.lodash !== 'undefined' ) {
|
172 |
+
return ! window.lodash.isEqual( this.state.recipe, this.state.originalRecipe );
|
173 |
+
} else {
|
174 |
+
return JSON.stringify( this.state.recipe ) !== JSON.stringify( this.state.originalRecipe );
|
175 |
+
}
|
176 |
}
|
177 |
|
178 |
render() {
|
assets/js/admin-modal/recipe/nutrition-calculation/StepCustom.js
CHANGED
@@ -186,6 +186,7 @@ export default class StepCustom extends Component {
|
|
186 |
});
|
187 |
}}
|
188 |
defaultSearch={ this.props.ingredient.name }
|
|
|
189 |
/>
|
190 |
{
|
191 |
this.state.savedIngredient
|
186 |
});
|
187 |
}}
|
188 |
defaultSearch={ this.props.ingredient.name }
|
189 |
+
key={ this.props.ingredient.id }
|
190 |
/>
|
191 |
{
|
192 |
this.state.savedIngredient
|
dist/admin-modal.js
CHANGED
@@ -79,7 +79,7 @@ var n="undefined"!=typeof window&&"undefined"!=typeof document,r=["Edge","Triden
|
|
79 |
*
|
80 |
* http://api.jqueryui.com/category/ui-core/
|
81 |
*/
|
82 |
-
var r=/input|select|textarea|button|object/;function o(e){var t=e.offsetWidth<=0&&e.offsetHeight<=0;if(t&&!e.innerHTML)return!0;var n=window.getComputedStyle(e);return t?"visible"!==n.getPropertyValue("overflow"):"none"==n.getPropertyValue("display")}function i(e,t){var n=e.nodeName.toLowerCase();return(r.test(n)&&!e.disabled||"a"===n&&e.href||t)&&function(e){for(var t=e;t&&t!==document.body;){if(o(t))return!1;t=t.parentNode}return!0}(e)}function a(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var n=isNaN(t);return(n||t>=0)&&i(e,!n)}e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertNodeList=c,t.setElement=function(e){var t=e;if("string"==typeof t&&a.canUseDOM){var n=document.querySelectorAll(t);c(n,t),t="length"in n?n[0]:n}return u=t||u},t.validateElement=s,t.hide=function(e){s(e)&&(e||u).setAttribute("aria-hidden","true")},t.show=function(e){s(e)&&(e||u).removeAttribute("aria-hidden")},t.documentNotReadyOrSSRTesting=function(){u=null},t.resetForTesting=function(){u=null};var r,o=n(883),i=(r=o)&&r.__esModule?r:{default:r},a=n(659);var u=null;function c(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function s(e){return!(!e&&!u)||((0,i.default)(!1,["react-modal: App element is not defined.","Please use `Modal.setAppElement(el)` or set `appElement={el}`.","This is needed so screen readers don't see main content","when modal is opened. It is not recommended, but you can opt-out","by setting `ariaHideApp={false}`."].join(" ")),!1)}},function(e,t){var n=1e3,r=60*n,o=60*r,i=24*o,a=7*i,u=365.25*i;function c(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}e.exports=function(e,t){t=t||{};var s=typeof e;if("string"===s&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var c=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*u;case"weeks":case"week":case"w":return c*a;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*o;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===s&&!1===isNaN(e))return t.long?function(e){var t=Math.abs(e);if(t>=i)return c(e,t,i,"day");if(t>=o)return c(e,t,o,"hour");if(t>=r)return c(e,t,r,"minute");if(t>=n)return c(e,t,n,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=i)return Math.round(e/i)+"d";if(t>=o)return Math.round(e/o)+"h";if(t>=r)return Math.round(e/r)+"m";if(t>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){var r=n(907),o=n(548),i=n(550);e.exports=function(e){return i(o(e,void 0,r),e+"")}},function(e,t,n){var r=n(667),o=n(928),i=n(929),a=Object.defineProperty;t.f=n(501)?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(632),o=n(631).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(933);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(937)("keys"),o=n(939);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(785);e.exports=function(e){return Object(r(e))}},function(e,t){},,,,,function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return k});var r=n(0),o=n.n(r),i=n(769),a=n.n(i),u=(n(887),n(888),n(495)),c=n(849),s=n(797),l=n(798),f=n(799),p=n(845),d=n(809),h=n(810),m=n(811),v=n(812),g=n(2);function y(e){return(y="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 b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}a.a.setAppElement("#wprm-admin-modal");var x={"bulk-edit":c.a,menu:s.a,nutrient:l.a,nutrition:f.a,recipe:p.a,roundup:d.a,select:h.a,taxonomy:m.a,"custom-field":v.a},k=function(t){function n(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(e=function(e,t){return!t||"object"!==y(t)&&"function"!=typeof t?O(e):t}(this,w(n).call(this))).state={modalIsOpen:!1,mode:"",args:{}},e.content=o.a.createRef(),e.close=e.close.bind(O(e)),e.closeIfAllowed=e.closeIfAllowed.bind(O(e)),e}var i,c,s;return function(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&&E(e,t)}(n,r["Component"]),i=n,(c=[{key:"open",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!(arguments.length>2&&void 0!==arguments[2]&&arguments[2])&&this.state.modalIsOpen||this.setState({modalIsOpen:!0,mode:e,args:t},function(){window.onbeforeunload=function(){return Object(g.a)("Are you sure you want to leave this page?")}})}},{key:"close",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.setState({modalIsOpen:!1},function(){window.onbeforeunload=null,"function"==typeof e&&e()})}},{key:"closeIfAllowed",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!(!this.content.current||!this.content.current.hasOwnProperty("allowCloseModal"))&&this.content.current.allowCloseModal;t&&!t()||this.close(e)}},{key:"addTextToEditor",value:function(t,n){if("undefined"==typeof tinyMCE||!tinyMCE.get(n)||tinyMCE.get(n).isHidden()){var r=e("textarea#"+n).val();e("textarea#"+n).val(r+t)}else tinyMCE.get(n).focus(!0),tinyMCE.activeEditor.selection.collapse(!1),tinyMCE.activeEditor.execCommand("mceInsertContent",!1,t)}},{key:"refreshEditor",value:function(e){"undefined"!=typeof tinyMCE&&tinyMCE.get(e)&&!tinyMCE.get(e).isHidden()&&(tinyMCE.get(e).focus(!0),tinyMCE.activeEditor.setContent(tinyMCE.activeEditor.getContent()))}},{key:"render",value:function(){var e=!!x.hasOwnProperty(this.state.mode)&&x[this.state.mode];return e?o.a.createElement(a.a,{isOpen:this.state.modalIsOpen,onRequestClose:this.closeIfAllowed,overlayClassName:"wprm-admin-modal-overlay",className:"wprm-admin-modal wprm-admin-modal-".concat(this.state.mode)},o.a.createElement(u.a,{module:"Modal"},o.a.createElement(e,{ref:this.content,mode:this.state.mode,args:this.state.args,maybeCloseModal:this.closeIfAllowed}))):null}}])&&b(i.prototype,c),s&&b(i,s),n}()}).call(this,n(389))},function(e,t,n){"use strict";n.d(t,"a",function(){return m});var r=n(0),o=n.n(r),i=(n(892),n(169)),a=n(175),u=n(2);function c(e){return(c="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 s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h=function(e){return e=(e=(e=e.replace(/"/gm,"%22")).replace(/\]/gm,"%5D")).replace(/\r?\n|\r/gm,"%0A")},m=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),f(this,p(t).apply(this,arguments))}var n,c,m;return function(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&&d(e,t)}(t,r["Component"]),n=t,(c=[{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(i.a,{onCloseModal:this.props.maybeCloseModal},"WP Recipe Maker"),o.a.createElement("div",{className:"wprm-admin-modal-menu-container"},o.a.createElement("h2",null,Object(u.a)("Recipes")),o.a.createElement("div",{className:"wprm-admin-modal-menu-buttons"},o.a.createElement(a.a,{isPrimary:!0,onClick:function(){WPRM_Modal.open("recipe",e.props.args,!0)}},Object(u.a)("Create new Recipe")),o.a.createElement(a.a,{onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Insert existing Recipe"),button:Object(u.a)("Insert"),fields:{recipe:{}},insertCallback:function(t){"function"==typeof e.props.args.insertCallback&&e.props.args.insertCallback('[wprm-recipe id="'.concat(t.recipe.id,'"]'))}},!0)}},Object(u.a)("Insert existing Recipe")),o.a.createElement(a.a,{required:"premium",onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Create new from existing Recipe"),button:Object(u.a)("Clone Recipe"),fields:{recipe:{}},nextStepCallback:function(t){WPRM_Modal.open("recipe",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){s(e,t,n[t])})}return e}({},e.props.args,{recipeId:t.recipe.id,cloneRecipe:!0}),!0)}},!0)}},Object(u.a)("Create new from existing Recipe"))),o.a.createElement("h2",null,Object(u.a)("Recipe Snippets")),o.a.createElement("div",{className:"wprm-admin-modal-menu-buttons"},o.a.createElement(a.a,{help:Object(u.a)("Displays default snippet template as set in the WPRM Settings"),onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Full Snippet Template"),button:Object(u.a)("Insert"),fields:{recipe:{showFirst:!0}},insertCallback:function(t){if("function"==typeof e.props.args.insertCallback){var n="[wprm-recipe-snippet";n+=t.recipe&&t.recipe.id?' id="'.concat(t.recipe.id,'"]'):"]",e.props.args.insertCallback(n)}}},!0)}},Object(u.a)("Full Snippet Template")),o.a.createElement(a.a,{onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Jump to Recipe"),button:Object(u.a)("Insert"),fields:{recipe:{showFirst:!0}},insertCallback:function(t){if("function"==typeof e.props.args.insertCallback){var n="[wprm-recipe-jump";n+=t.recipe&&t.recipe.id?' id="'.concat(t.recipe.id,'"]'):"]",e.props.args.insertCallback(n)}}},!0)}},Object(u.a)("Jump to Recipe")),o.a.createElement(a.a,{onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Jump to Video"),button:Object(u.a)("Insert"),fields:{recipe:{showFirst:!0}},insertCallback:function(t){if("function"==typeof e.props.args.insertCallback){var n="[wprm-recipe-jump-video";n+=t.recipe&&t.recipe.id?' id="'.concat(t.recipe.id,'"]'):"]",e.props.args.insertCallback(n)}}},!0)}},Object(u.a)("Jump to Video")),o.a.createElement(a.a,{onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Print Recipe"),button:Object(u.a)("Insert"),fields:{recipe:{showFirst:!0}},insertCallback:function(t){if("function"==typeof e.props.args.insertCallback){var n="[wprm-recipe-print";n+=t.recipe&&t.recipe.id?' id="'.concat(t.recipe.id,'"]'):"]",e.props.args.insertCallback(n)}}},!0)}},Object(u.a)("Print Recipe"))),o.a.createElement("h2",null,Object(u.a)("Recipe Parts")),o.a.createElement("div",{className:"wprm-admin-modal-menu-buttons"},o.a.createElement(a.a,{required:"premium",onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Nutrition Label"),button:Object(u.a)("Insert"),fields:{recipe:{showFirst:!0}},insertCallback:function(t){if("function"==typeof e.props.args.insertCallback){var n="[wprm-nutrition-label";n+=t.recipe&&t.recipe.id?' id="'.concat(t.recipe.id,'"]'):"]",e.props.args.insertCallback(n)}}},!0)}},Object(u.a)("Nutrition Label")),o.a.createElement(a.a,{onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Recipe Video"),button:Object(u.a)("Insert"),fields:{recipe:{showFirst:!0}},insertCallback:function(t){if("function"==typeof e.props.args.insertCallback){var n="[wprm-recipe-video";n+=t.recipe&&t.recipe.id?' id="'.concat(t.recipe.id,'"]'):"]",e.props.args.insertCallback(n)}}},!0)}},Object(u.a)("Recipe Video"))),o.a.createElement("h2",null,Object(u.a)("Other Features")),o.a.createElement("div",{className:"wprm-admin-modal-menu-buttons"},o.a.createElement(a.a,{help:Object(u.a)("Use for a list of existing recipes on your website"),onClick:function(){WPRM_Modal.open("roundup",{insertCallback:function(t){if("function"==typeof e.props.args.insertCallback)if(t.hasOwnProperty("type")&&"external"===t.type){var n="[wprm-recipe-roundup-item";n+=' link="'.concat(h(t.link),'"'),n+=t.nofollow?' nofollow="1"':"",n+=t.image.id?' image="'.concat(t.image.id,'"'):"",n+=' name="'.concat(h(t.name),'"'),n+=' summary="'.concat(h(t.summary),'"'),n+="]",e.props.args.insertCallback(n)}else e.props.args.insertCallback('[wprm-recipe-roundup-item id="'.concat(t.recipe.id,'"]'))}},!0)}},Object(u.a)("Recipe Roundup Item")),o.a.createElement(a.a,{required:"elite",onClick:function(){"function"==typeof e.props.args.insertCallback&&e.props.args.insertCallback("[wprm-recipe-submission]"),e.props.maybeCloseModal()}},Object(u.a)("Recipe Submission Form")),o.a.createElement(a.a,{required:"elite",onClick:function(){"function"==typeof e.props.args.insertCallback&&e.props.args.insertCallback("[wprm-recipe-collections]"),e.props.maybeCloseModal()}},Object(u.a)("Recipe Collections")),o.a.createElement(a.a,{required:"elite",help:Object(u.a)("Find the saved collection ID on the WP Recipe Maker > Manage > Saved Collections page"),onClick:function(){"function"==typeof e.props.args.insertCallback&&e.props.args.insertCallback('[wprm-saved-collection id=""]'),e.props.maybeCloseModal()}},Object(u.a)("Saved Recipe Collection")))))}}])&&l(n.prototype,c),m&&l(n,m),t}()},function(e,t,n){"use strict";n.d(t,"a",function(){return b});var r=n(0),o=n.n(r),i=(n(893),n(2)),a=n(169),u=n(174),c=n(67),s=n(399),l=n(68),f=n(506);function p(e){return(p="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 d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){h(e,t,n[t])})}return e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?g(e):t}(this,v(t).call(this,e));var r={key:"",type:"custom",label:"",unit:"",daily:0,active:!0,calculation:"",precision:0},o=!1;return e.args.hasOwnProperty("nutrient")&&(o=!0,r=JSON.parse(JSON.stringify(e.args.nutrient))),n.state={editing:o,nutrient:r,originalNutrient:JSON.parse(JSON.stringify(r)),savingChanges:!1},n.changesMade=n.changesMade.bind(g(n)),n.saveChanges=n.saveChanges.bind(g(n)),n}var n,h,b;return function(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&&y(e,t)}(t,r["Component"]),n=t,(h=[{key:"sanitizeSlug",value:function(e){e=(e=e.trim()).toLowerCase();for(var t="àáäâèéëêìíïîòóöôùúüûñçěščřžýúůďťň·/-,:;",n=0,r=t.length;n<r;n++)e=e.replace(new RegExp(t.charAt(n),"g"),"aaaaeeeeiiiioooouuuuncescrzyuudtn______".charAt(n));return e=e.replace(".","-").replace(/[^a-z0-9\s_]/g,"").replace(/\s+/g,"_").replace(/_+/g,"_")}},{key:"saveChanges",value:function(){var e=this;this.state.nutrient.key.trim()&&this.state.nutrient.label.trim()?this.setState({savingChanges:!0},function(){f.a.updateNutrient(e.state.editing,e.state.nutrient).then(function(t){t?e.setState({originalNutrient:JSON.parse(JSON.stringify(e.state.nutrient)),savingChanges:!1},function(){"function"==typeof e.props.args.saveCallback&&e.props.args.saveCallback(e.state.nutrient),e.props.maybeCloseModal()}):(e.state.editing||!1!==t||alert(Object(i.a)("Something went wrong. Make sure this key does not exist yet.")),e.setState({savingChanges:!1}))})}):alert(Object(i.a)("A label and key are required."))}},{key:"allowCloseModal",value:function(){return!this.state.savingChanges&&(!this.changesMade()||confirm(Object(i.a)("Are you sure you want to close without saving changes?")))}},{key:"changesMade",value:function(){return JSON.stringify(this.state.nutrient)!==JSON.stringify(this.state.originalNutrient)}},{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(a.a,{onCloseModal:this.props.maybeCloseModal},this.state.editing?"".concat(Object(i.a)("Editing Nutrient")).concat(this.state.nutrient.key?" - ".concat(this.state.nutrient.key):""):"".concat(Object(i.a)("Creating new Nutrient")).concat(this.state.nutrient.key?" - ".concat(this.state.nutrient.key):"")),o.a.createElement("div",{className:"wprm-admin-modal-nutrient-container"},!1===this.state.editing&&o.a.createElement(r.Fragment,null,o.a.createElement(c.a,{id:"type",label:Object(i.a)("Type")},o.a.createElement(s.a,{options:[{value:"custom",label:Object(i.a)("Custom")},{value:"calculated",label:Object(i.a)("Calculated")}],value:this.state.nutrient.type,onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{type:t})})}})),o.a.createElement(c.a,{id:"key",label:Object(i.a)("Key")},o.a.createElement(l.a,{placeholder:Object(i.a)("my-custom-nutrient"),value:"".concat(this.state.nutrient.key),onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{key:e.sanitizeSlug(t)})})}}))),o.a.createElement(c.a,{id:"label",label:Object(i.a)("Label")},o.a.createElement(l.a,{placeholder:Object(i.a)("My Custom Nutrient"),value:this.state.nutrient.label,onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{label:t})})}})),o.a.createElement(c.a,{id:"unit",label:Object(i.a)("Unit")},o.a.createElement(l.a,{placeholder:Object(i.a)("mg"),value:this.state.nutrient.unit,onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{unit:t})})}})),o.a.createElement(c.a,{id:"daily",label:Object(i.a)("Daily Need")},o.a.createElement(l.a,{type:"number",value:0===this.state.nutrient.daily?"":this.state.nutrient.daily,onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{daily:t})})}})),"calculated"===this.state.nutrient.type&&o.a.createElement(r.Fragment,null,o.a.createElement(c.a,{id:"calculation",label:Object(i.a)("Calculation")},o.a.createElement(l.a,{placeholder:"carbohydrates - fiber",value:this.state.nutrient.calculation,onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{calculation:t})})}}),o.a.createElement("a",{href:"https://help.bootstrapped.ventures/article/199-custom-and-calculated-nutrients",target:"_blank"},Object(i.a)("Learn more"))),o.a.createElement(c.a,{id:"precision",label:Object(i.a)("Decimal Precision")},o.a.createElement(l.a,{type:"number",placeholder:"0",value:this.state.nutrient.precision,onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{precision:t})})}})))),o.a.createElement(u.a,{savingChanges:this.state.savingChanges},o.a.createElement("button",{className:"button button-primary",onClick:this.saveChanges,disabled:!this.changesMade()},Object(i.a)("Save"))))}}])&&m(n.prototype,h),b&&m(n,b),t}()},function(e,t,n){"use strict";n.d(t,"a",function(){return b});var r=n(0),o=n.n(r),i=(n(894),n(2)),a=n(176),u=n(169),c=n(174),s=n(68),l=n(412),f=n(465);function p(e){return(p="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 d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){h(e,t,n[t])})}return e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?g(e):t}(this,v(t).call(this,e));var r={id:0,amount:"",unit:"",name:"",facts:{}},o=!1;return e.args.hasOwnProperty("ingredient")?r=JSON.parse(JSON.stringify(e.args.ingredient)):e.args.hasOwnProperty("ingredientId")&&(o=!0,l.a.getCustomIngredient(e.args.ingredientId).then(function(e){if(e){var t=JSON.parse(JSON.stringify(e.ingredient));if(t){var r={id:t.id,amount:t.nutrition.amount,unit:t.nutrition.unit,name:t.name,facts:t.nutrition.nutrients};n.setState({ingredient:r,originalIngredient:JSON.parse(JSON.stringify(r)),loadingIngredient:!1})}}})),n.state={ingredient:r,originalIngredient:JSON.parse(JSON.stringify(r)),loadingIngredient:o,savingChanges:!1},n.changesMade=n.changesMade.bind(g(n)),n.saveChanges=n.saveChanges.bind(g(n)),n}var n,h,b;return function(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&&y(e,t)}(t,r["Component"]),n=t,(h=[{key:"saveChanges",value:function(){var e=this;""===this.state.ingredient.name.trim()?alert(Object(i.a)("A name is required for this saved nutrition ingredient.")):this.setState({savingChanges:!0},function(){l.a.saveCustomIngredient(e.state.ingredient.id,e.state.ingredient.amount,e.state.ingredient.unit,e.state.ingredient.name,e.state.ingredient.facts).then(function(){e.setState({originalIngredient:JSON.parse(JSON.stringify(e.state.ingredient)),savingChanges:!1},function(){"function"==typeof e.props.args.saveCallback&&e.props.args.saveCallback(e.state.ingredient),e.props.maybeCloseModal()})})})}},{key:"allowCloseModal",value:function(){return!this.state.savingChanges&&(!this.changesMade()||confirm(Object(i.a)("Are you sure you want to close without saving changes?")))}},{key:"changesMade",value:function(){return JSON.stringify(this.state.ingredient)!==JSON.stringify(this.state.originalIngredient)}},{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(u.a,{onCloseModal:this.props.maybeCloseModal},this.state.loadingIngredient?Object(i.a)("Loading Ingredient..."):o.a.createElement(r.Fragment,null,this.state.ingredient.id?"".concat(Object(i.a)("Editing Nutrition Ingredient")," #").concat(this.state.ingredient.id).concat(this.state.ingredient.name?" - ".concat(this.state.ingredient.name):""):"".concat(Object(i.a)("Creating new Nutrition Ingredient")).concat(this.state.ingredient.name?" - ".concat(this.state.ingredient.name):""))),o.a.createElement("div",{className:"wprm-admin-modal-nutrition-container"},this.state.loadingIngredient?o.a.createElement(a.a,null):o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-nutrition-custom-ingredient"},o.a.createElement(s.a,{type:"number",placeholder:Object(i.a)("Amount"),value:this.state.ingredient.amount,onChange:function(t){e.setState({ingredient:d({},e.state.ingredient,{amount:t})})}}),o.a.createElement(s.a,{placeholder:Object(i.a)("Unit"),value:this.state.ingredient.unit,onChange:function(t){e.setState({ingredient:d({},e.state.ingredient,{unit:t})})}}),o.a.createElement(s.a,{placeholder:Object(i.a)("Name (required)"),value:this.state.ingredient.name,onChange:function(t){e.setState({ingredient:d({},e.state.ingredient,{name:t})})}})),o.a.createElement(f.a,{id:"modal",facts:this.state.ingredient.facts,onChange:function(t,n){var r=d({},e.state.ingredient.facts);r[t]=n,e.setState({ingredient:d({},e.state.ingredient,{facts:r})})}}))),o.a.createElement(c.a,{savingChanges:this.state.savingChanges},o.a.createElement("button",{className:"button button-primary",onClick:this.saveChanges,disabled:!this.changesMade()},Object(i.a)("Save"))))}}])&&m(n.prototype,h),b&&m(n,b),t}()},function(e,t,n){"use strict";var r=n(896).CopyToClipboard;r.CopyToClipboard=r,e.exports=r},function(e,t,n){"use strict";var r,o;r=new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*[A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]"),o=new RegExp("^[^A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]*[֑-߿יִ-﷽ﹰ-ﻼ]"),e.exports=function(e){return e=e.toString(),o.test(e)?"rtl":r.test(e)?"ltr":"neutral"}},function(e,t){e.exports=function(e){var t=e.anchorNode,n=e.anchorOffset,r=e.focusNode,o=e.focusOffset,i=t.compareDocumentPosition(r);return!(4===i||0===i&&n<o)}},function(e,t,n){"use strict";e.exports=n(918)},function(e,t,n){e.exports=n(941)},function(e,t,n){"use strict";e.exports=n(946)},function(e,t,n){"use strict";function r(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}n.d(t,"a",function(){return r})},function(e,t,n){e.exports=n(948)},function(e,t,n){e.exports=n(956)},function(e,t,n){"use strict";n.d(t,"a",function(){return y});var r=n(0),o=n.n(r),i=(n(967),n(2)),a=n(169),u=n(174),c=n(453),s=n(417),l=n(68),f=n(444),p=n(643);function d(e){return(d="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 h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=m(this,v(t).call(this,e));var r="internal",o="",i=!1,a="",u="",c={id:0,url:""};if(e.args.fields&&e.args.fields.roundup){var s=e.args.fields.roundup;!s.id&&s.link&&(r="external",o=s.link,i=!!s.nofollow,a=s.name,u=s.summary,c.id=s.image)}return n.state={type:r,recipe:!1,link:o,nofollow:i,name:a,summary:u,image:c},n}var n,d,y;return function(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&&g(e,t)}(t,r["Component"]),n=t,(d=[{key:"selectionsMade",value:function(){return"external"===this.state.type?""!==this.state.link:!1!==this.state.recipe}},{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(a.a,{onCloseModal:this.props.maybeCloseModal},Object(i.a)("Select Roundup Recipe")),o.a.createElement("div",{className:"wprm-admin-modal-roundup-container wprm-admin-modal-roundup-container-".concat(this.state.type)},o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-label"},Object(i.a)("Type")),o.a.createElement(s.a,{id:"type",options:[{value:"internal",label:Object(i.a)("Use one of your own recipes")},{value:"external",label:Object(i.a)("Use external recipe from a different website")}],value:this.state.type,onChange:function(t){e.setState({type:t})}}),"internal"===this.state.type?o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-label"},Object(i.a)("Recipe")),o.a.createElement(p.a,{options:[],value:this.state.recipe,onValueChange:function(t){e.setState({recipe:t})}})):o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-label"},Object(i.a)("Link")),o.a.createElement(l.a,{name:"roundup-link",placeholder:"https://demo.wprecipemaker.com/amazing-vegetable-pizza/",type:"url",value:this.state.link,onChange:function(t){e.setState({link:t})}}),o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-nofollow-container"},o.a.createElement("input",{id:"wprm-admin-modal-roundup-field-nofollow",type:"checkbox",checked:this.state.nofollow,onChange:function(t){e.setState({nofollow:t.target.checked})}})," ",o.a.createElement("label",{htmlFor:"wprm-admin-modal-roundup-field-nofollow"},Object(i.a)('Add rel="nofollow" to link'))),o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-label"},Object(i.a)("Image")),o.a.createElement(c.a,{id:this.state.image.id,url:this.state.image.url,onChange:function(t,n){e.setState({image:{id:t,url:n}})}}),o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-label"},Object(i.a)("Name")),o.a.createElement(l.a,{name:"recipe-name",placeholder:Object(i.a)("Recipe Name"),value:this.state.name,onChange:function(t){e.setState({name:t})}}),o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-label"},Object(i.a)("Summary")),o.a.createElement(f.a,{placeholder:Object(i.a)("Short description of this recipe..."),value:this.state.summary,onChange:function(t){e.setState({summary:t})}}))),o.a.createElement(u.a,{savingChanges:!1},o.a.createElement("button",{className:"button button-primary",onClick:function(){"function"==typeof e.props.args.insertCallback&&e.props.args.insertCallback(e.state),e.props.maybeCloseModal()},disabled:!this.selectionsMade()},Object(i.a)("Use"))))}}])&&h(n.prototype,d),y&&h(n,y),t}()},function(e,t,n){"use strict";n.d(t,"a",function(){return m});var r=n(0),o=n.n(r),i=(n(968),n(2)),a=n(169),u=n(174),c=n(643);function s(e){return(s="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 l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return!t||"object"!==s(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h={id:0,text:Object(i.a)("First recipe on page")},m=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=f(this,p(t).call(this,e));var r=!1;return e.args.fields.recipe.showFirst&&(r=h),n.state={recipe:r},n}var n,s,m;return function(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&&d(e,t)}(t,r["Component"]),n=t,(s=[{key:"selectionsMade",value:function(){return!1!==this.state.recipe}},{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(a.a,{onCloseModal:this.props.maybeCloseModal},this.props.args.title?this.props.args.title:"WP Recipe Maker"),o.a.createElement("div",{className:"wprm-admin-modal-select-container"},this.props.args.fields.recipe?o.a.createElement(c.a,{options:this.props.args.fields.recipe.showFirst?[h]:[],value:this.state.recipe,onValueChange:function(t){e.setState({recipe:t})}}):null),o.a.createElement(u.a,{savingChanges:!1},o.a.createElement("button",{className:"button button-primary",onClick:function(){"function"==typeof e.props.args.nextStepCallback?e.props.args.nextStepCallback(e.state):("function"==typeof e.props.args.insertCallback&&e.props.args.insertCallback(e.state),e.props.maybeCloseModal())},disabled:!this.selectionsMade()},this.props.args.button?this.props.args.button:Object(i.a)("Select"))))}}])&&l(n.prototype,s),m&&l(n,m),t}()},function(e,t,n){"use strict";n.d(t,"a",function(){return y});var r=n(0),o=n.n(r),i=(n(969),n(2)),a=n(169),u=n(174),c=n(67),s=n(68),l=n(625);function f(e){return(f="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 p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){d(e,t,n[t])})}return e}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?v(e):t}(this,m(t).call(this,e));var r={key:"",singular_name:"",name:""},o=!1;return e.args.hasOwnProperty("taxonomy")&&(o=!0,r=JSON.parse(JSON.stringify(e.args.taxonomy))),n.state={editing:o,taxonomy:r,originalTaxonomy:JSON.parse(JSON.stringify(r)),savingChanges:!1},n.changesMade=n.changesMade.bind(v(n)),n.saveChanges=n.saveChanges.bind(v(n)),n}var n,d,y;return function(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&&g(e,t)}(t,r["Component"]),n=t,(d=[{key:"sanitizeSlug",value:function(e){e=(e=e.trim()).toLowerCase();for(var t="àáäâèéëêìíïîòóöôùúüûñçěščřžýúůďťň·/-,:;",n=0,r=t.length;n<r;n++)e=e.replace(new RegExp(t.charAt(n),"g"),"aaaaeeeeiiiioooouuuuncescrzyuudtn______".charAt(n));return e=e.replace(".","-").replace(/[^a-z0-9\s_]/g,"").replace(/\s+/g,"_").replace(/_+/g,"_")}},{key:"saveChanges",value:function(){var e=this;this.state.taxonomy.key.trim()&&this.state.taxonomy.singular_name.trim()&&this.state.taxonomy.name.trim()?this.setState({savingChanges:!0},function(){l.a.saveCustomTaxonomy(e.state.editing,e.state.taxonomy).then(function(t){t?e.setState({originalTaxonomy:JSON.parse(JSON.stringify(e.state.taxonomy)),savingChanges:!1},function(){"function"==typeof e.props.args.saveCallback&&e.props.args.saveCallback(e.state.taxonomy),e.props.maybeCloseModal()}):(e.state.editing||!1!==t||alert(Object(i.a)("Something went wrong. Make sure this key does not exist yet.")),e.setState({savingChanges:!1}))})}):alert(Object(i.a)("All fields are required."))}},{key:"allowCloseModal",value:function(){return!this.state.savingChanges&&(!this.changesMade()||confirm(Object(i.a)("Are you sure you want to close without saving changes?")))}},{key:"changesMade",value:function(){return JSON.stringify(this.state.taxonomy)!==JSON.stringify(this.state.originalTaxonomy)}},{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(a.a,{onCloseModal:this.props.maybeCloseModal},this.state.editing?"".concat(Object(i.a)("Editing Custom Taxonomy")).concat(this.state.taxonomy.key?" - wprm_".concat(this.state.taxonomy.key):""):"".concat(Object(i.a)("Creating new Custom Taxonomy")).concat(this.state.taxonomy.key?" - wprm_".concat(this.state.taxonomy.key):"")),o.a.createElement("div",{className:"wprm-admin-modal-taxonomy-container"},!1===this.state.editing&&o.a.createElement(c.a,{id:"key",label:Object(i.a)("Key")},o.a.createElement(s.a,{placeholder:Object(i.a)("course"),value:"wprm_".concat(this.state.taxonomy.key),onChange:function(t){var n=t.substr(5);n=e.sanitizeSlug(n),e.setState({taxonomy:p({},e.state.taxonomy,{key:n})})},disabled:this.state.editing})),o.a.createElement(c.a,{id:"singular_name",label:Object(i.a)("Singular Name")},o.a.createElement(s.a,{placeholder:Object(i.a)("Course"),value:this.state.taxonomy.singular_name,onChange:function(t){e.setState({taxonomy:p({},e.state.taxonomy,{singular_name:t})})}})),o.a.createElement(c.a,{id:"name",label:Object(i.a)("Plural Name")},o.a.createElement(s.a,{placeholder:Object(i.a)("Courses"),value:this.state.taxonomy.name,onChange:function(t){e.setState({taxonomy:p({},e.state.taxonomy,{name:t})})}}))),o.a.createElement(u.a,{savingChanges:this.state.savingChanges},o.a.createElement("button",{className:"button button-primary",onClick:this.saveChanges,disabled:!this.changesMade()},Object(i.a)("Save"))))}}])&&h(n.prototype,d),y&&h(n,y),t}()},function(e,t,n){"use strict";n.d(t,"a",function(){return b});var r=n(0),o=n.n(r),i=(n(970),n(2)),a=n(169),u=n(174),c=n(67),s=n(399),l=n(68),f=n(626);function p(e){return(p="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 d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){h(e,t,n[t])})}return e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?g(e):t}(this,v(t).call(this,e));var r={key:"",name:"",type:"text"},o=!1;return e.args.hasOwnProperty("field")&&(o=!0,r=JSON.parse(JSON.stringify(e.args.field))),n.state={editing:o,field:r,originalField:JSON.parse(JSON.stringify(r)),savingChanges:!1},n.changesMade=n.changesMade.bind(g(n)),n.saveChanges=n.saveChanges.bind(g(n)),n}var n,h,b;return function(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&&y(e,t)}(t,r["Component"]),n=t,(h=[{key:"sanitizeSlug",value:function(e){e=(e=e.trim()).toLowerCase();for(var t="àáäâèéëêìíïîòóöôùúüûñçěščřžýúůďťň·/-,:;",n=0,r=t.length;n<r;n++)e=e.replace(new RegExp(t.charAt(n),"g"),"aaaaeeeeiiiioooouuuuncescrzyuudtn______".charAt(n));return e=e.replace(".","-").replace(/[^a-z0-9\s_]/g,"").replace(/\s+/g,"_").replace(/_+/g,"_")}},{key:"saveChanges",value:function(){var e=this;this.state.field.key.trim()&&this.state.field.name.trim()?this.setState({savingChanges:!0},function(){f.a.saveCustomField(e.state.editing,e.state.field).then(function(t){t?e.setState({originalField:JSON.parse(JSON.stringify(e.state.field)),savingChanges:!1},function(){"function"==typeof e.props.args.saveCallback&&e.props.args.saveCallback(e.state.field),e.props.maybeCloseModal()}):(e.state.editing||!1!==t||alert(Object(i.a)("Something went wrong. Make sure this key does not exist yet.")),e.setState({savingChanges:!1}))})}):alert(Object(i.a)("All fields are required."))}},{key:"allowCloseModal",value:function(){return!this.state.savingChanges&&(!this.changesMade()||confirm(Object(i.a)("Are you sure you want to close without saving changes?")))}},{key:"changesMade",value:function(){return JSON.stringify(this.state.field)!==JSON.stringify(this.state.originalField)}},{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(a.a,{onCloseModal:this.props.maybeCloseModal},this.state.editing?"".concat(Object(i.a)("Editing Custom Field")).concat(this.state.field.key?" - ".concat(this.state.field.key):""):"".concat(Object(i.a)("Creating new Custom Field")).concat(this.state.field.key?" - ".concat(this.state.field.key):"")),o.a.createElement("div",{className:"wprm-admin-modal-custom-field-container"},!1===this.state.editing&&o.a.createElement(r.Fragment,null,o.a.createElement(c.a,{id:"type",label:Object(i.a)("Type")},o.a.createElement(s.a,{options:wprm_admin_modal.custom_fields.types,value:this.state.field.type,onChange:function(t){e.setState({field:d({},e.state.field,{type:t})})}})),o.a.createElement(c.a,{id:"key",label:Object(i.a)("Key")},o.a.createElement(l.a,{placeholder:Object(i.a)("my-custom-field"),value:"".concat(this.state.field.key),onChange:function(t){e.setState({field:d({},e.state.field,{key:e.sanitizeSlug(t)})})}}))),o.a.createElement(c.a,{id:"name",label:Object(i.a)("Name")},o.a.createElement(l.a,{placeholder:Object(i.a)("My Custom Field"),value:this.state.field.name,onChange:function(t){e.setState({field:d({},e.state.field,{name:t})})}}))),o.a.createElement(u.a,{savingChanges:this.state.savingChanges},o.a.createElement("button",{className:"button button-primary",onClick:this.saveChanges,disabled:!this.changesMade()},Object(i.a)("Save"))))}}])&&m(n.prototype,h),b&&m(n,b),t}()},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(0),o=n.n(r),i=n(388),a=(n(895),n(398)),u=n(2),c=n(800),s=n.n(c),l=n(169),f=n(174),p=n(176),d=function(e){var t=null;return e.id&&(t="wprm-admin-modal-fields-group-".concat(e.id)),o.a.createElement(i.Element,{className:"wprm-admin-modal-fields-group",id:t,name:t},e.header?o.a.createElement("div",{className:"wprm-admin-modal-fields-group-header"},e.header):null,o.a.createElement("div",{className:"wprm-admin-modal-fields"},e.children))},h=(n(899),n(67)),m=n(444),v=function(e){return o.a.createElement(r.Fragment,null,o.a.createElement(h.a,{label:Object(u.a)("Import from Text")},o.a.createElement(m.a,{placeholder:Object(u.a)("Paste or type recipe to start..."),value:"",onChange:function(t){t&&e.onModeChange("text-import",t)}})),o.a.createElement(h.a,{label:Object(u.a)("Import from JSON")},o.a.createElement(m.a,{placeholder:Object(u.a)("Paste the recipe JSON data to import"),value:"",onChange:function(t){if(t)try{var n=JSON.parse(t);e.onRecipeChange(n),alert(Object(u.a)("The recipe has been imported."))}catch(e){alert(Object(u.a)("No valid recipe found."))}}})))},g=(n(900),n(453)),y=n(640),b=function(e){var t=e.id>0,n=!t&&(-1==e.id||e.embed),i=t||n,a=function(t){t.preventDefault(),y.a.selectVideo(function(t){e.onChange(t.attributes.id,t.attributes.thumb.src)})};return o.a.createElement("div",{className:"wprm-admin-modal-field-video"},i?o.a.createElement(r.Fragment,null,t?o.a.createElement("div",{className:"wprm-admin-modal-field-video-preview"},o.a.createElement("img",{onClick:a,src:e.thumb}),o.a.createElement("a",{href:"#",onClick:function(t){t.preventDefault(),e.onChange(0,"")}},Object(u.a)("Remove Video"))):o.a.createElement(r.Fragment,null,o.a.createElement(m.a,{value:e.embed,onChange:function(t){e.onChange(-1,"",t)},placeholder:Object(u.a)("Use URL to the video (e.g. https://www.youtube.com/watch?v=dQw4w9WgXcQ) or the full embed code.")}),o.a.createElement("a",{href:"#",onClick:function(t){t.preventDefault(),e.onChange(0,"","")}},Object(u.a)("Remove Video")))):o.a.createElement(r.Fragment,null,o.a.createElement("button",{className:"button",onClick:a},Object(u.a)("Upload Video")),o.a.createElement("button",{className:"button",onClick:function(t){t.preventDefault(),e.onChange(-1,"")}},Object(u.a)("Embed Video"))))},w=function(e){return o.a.createElement(r.Fragment,null,o.a.createElement(h.a,{label:Object(u.a)("Image"),help:Object(u.a)("Used in the recipe metadata. Should be an image of the completed dish.")},o.a.createElement(g.a,{id:e.image.id,url:e.image.url,onChange:function(t,n){e.onRecipeChange({image_id:t,image_url:n})}})),"recipe_image"!==wprm_admin.settings.pinterest_use_for_image?o.a.createElement(h.a,{label:Object(u.a)("Pin Image"),help:Object(u.a)('Optionally set a different image to use for the "Pin Recipe" button.')},o.a.createElement(g.a,{required:"premium",id:e.pinImage.id,url:e.pinImage.url,onChange:function(t,n){e.onRecipeChange({pin_image_id:t,pin_image_url:n})}})):null,o.a.createElement(h.a,{label:Object(u.a)("Video"),help:Object(u.a)("Used in the recipe metadata. Can be displayed elsewhere on the page using the [wprm-recipe-video] shortcode.")},o.a.createElement(b,{id:e.video.id,thumb:e.video.thumb,embed:e.video.embed,onChange:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o={video_id:t,video_thumb_url:n};!1!==r&&(o.video_embed=r),e.onRecipeChange(o)}})))},O=(n(901),n(399)),E=n(68),x=n(417),k=n(4),S=n.n(k),C=n(77);function j(e,t){function n(n,r,o,i,a){var u=r[o];return null!=u||n?null==u&&n?new Error("The "+a+" `"+o+"` is marked as required in `"+i+"`, but it was not supplied."):t(u)?null:new Error("Invalid "+a+" `"+o+"` supplied to `"+i+"`, expected a Slate `"+e+"` but received: "+u):null}function r(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.apply(void 0,[!1].concat(t))}return r.isRequired=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.apply(void 0,[!0].concat(t))},r}var _={block:j("Block",function(e){return C.a.isBlock(e)}),blocks:j("List<Block>",function(e){return C.a.isBlockList(e)}),change:j("Change",function(e){return C.b.isChange(e)}),data:j("Data",function(e){return C.c.isData(e)}),document:j("Document",function(e){return C.d.isDocument(e)}),inline:j("Inline",function(e){return C.f.isInline(e)}),inlines:j("Inline",function(e){return C.f.isInlineList(e)}),leaf:j("Leaf",function(e){return C.g.isLeaf(e)}),leaves:j("List<Leaf>",function(e){return C.g.isLeafList(e)}),mark:j("Mark",function(e){return C.h.isMark(e)}),marks:j("Set<Mark>",function(e){return C.h.isMarkSet(e)}),node:j("Node",function(e){return C.i.isNode(e)}),nodes:j("List<Node>",function(e){return C.i.isNodeList(e)}),range:j("Range",function(e){return C.k.isRange(e)}),ranges:j("List<Range>",function(e){return C.k.isRangeList(e)}),selection:j("Selection",function(e){return C.l.isSelection(e)}),value:j("Value",function(e){return C.n.isValue(e)}),text:j("Text",function(e){return C.m.isText(e)}),texts:j("List<Text>",function(e){return C.m.isTextList(e)})},I=n(497),T=n.n(I),N=n(392),A=n.n(N),P=function(e,t){},D=n(129),M=n.n(D),L=n(802),R=n.n(L),F="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},B="object"===("undefined"==typeof window?"undefined":F(window))&&"object"===("undefined"==typeof document?"undefined":F(document))&&9===document.nodeType,z=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),U=void 0;if(B){var q=!0,W=!1,H=void 0;try{for(var V,G=[["edge",/Edge\/([0-9\._]+)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)$/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+)\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["android",/Android\s([0-9\.]+)/],["safari",/Version\/([0-9\._]+).*Safari/]][Symbol.iterator]();!(q=(V=G.next()).done);q=!0){var J=V.value,Z=z(J,2),Y=Z[0];if(Z[1].test(window.navigator.userAgent)){U=Y;break}}}catch(e){W=!0,H=e}finally{try{!q&&G.return&&G.return()}finally{if(W)throw H}}}var K=void 0;if(B){var X=!0,Q=!1,$=void 0;try{for(var ee,te=[["ios",/os ([\.\_\d]+) like mac os/i],["macos",/mac os x/i],["android",/android/i],["firefoxos",/mozilla\/[a-z\.\_\d]+ \((?:mobile)|(?:tablet)/i],["windows",/windows\s*(?:nt)?\s*([\.\_\d]+)/i]][Symbol.iterator]();!(X=(ee=te.next()).done);X=!0){var ne=ee.value,re=z(ne,2),oe=re[0];if(re[1].test(window.navigator.userAgent)){K=oe;break}}}catch(e){Q=!0,$=e}finally{try{!X&&te.return&&te.return()}finally{if(Q)throw $}}}var ie=[];if(B){var ae=!0,ue=!1,ce=void 0;try{for(var se,le=[["inputeventslevel1",function(e){return"inputType"in(e.InputEvent?new e.InputEvent("input"):{})}],["inputeventslevel2",function(e){var t=e.document.createElement("div");return t.contentEditable=!0,"onbeforeinput"in t}]][Symbol.iterator]();!(ae=(se=le.next()).done);ae=!0){var fe=se.value,pe=z(fe,2),de=pe[0];(0,pe[1])(window)&&ie.push(de)}}catch(e){ue=!0,ce=e}finally{try{!ae&&le.return&&le.return()}finally{if(ue)throw ce}}}var he=[[/^9([.]0|)/,28],[/^8[.]1/,27],[/^8([.]0|)/,26],[/^7[.]1/,25],[/^7([.]0|)/,24],[/^6([.]0|)/,23],[/^5[.]1/,22],[/^5([.]0|)/,21],[/^4[.]4/,20]];var me="firefox"===U,ve="safari"===U,ge="ie"===U,ye="edge"===U,be="android"===K,we="ios"===K,Oe="macos"===K,Ee=function(){if("android"!==K)return null;var e=window.navigator.userAgent.match(/Android\s([0-9\.]+)/);if(null==e)return null;var t=e[1],n=!0,r=!1,o=void 0;try{for(var i,a=he[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var u=i.value,c=z(u,2),s=c[0],l=c[1];if(t.match(s))return l}}catch(e){r=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw o}}return null}(),xe=(ie.includes("inputeventslevel1"),ie.includes("inputeventslevel2")||be&&(28===Ee||null===Ee)),ke=n(505),Se=n.n(ke),Ce=n(22),je=n(16),_e=n(454),Ie=n.n(_e),Te=n(772);function Ne(e){var t=JSON.stringify(e);return Object(Te.btoa)(encodeURIComponent(t))}function Ae(e){var t=decodeURIComponent(Object(Te.atob)(e));return JSON.parse(t)}var Pe={deserialize:function(e,t){var n=Ae(e);return C.n.fromJSON(n,t)},deserializeNode:function(e,t){var n=Ae(e);return C.i.fromJSON(n,t)},serialize:function(e,t){return Ne(e.toJSON(t))},serializeNode:function(e,t){return Ne(e.toJSON(t))}},De=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function Me(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).delimiter,n=void 0===t?"\n":t;return"document"===e.object||"block"===e.object&&C.a.isBlockList(e.nodes)?e.nodes.map(Me).join(n):e.text}var Le={deserialize:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.defaultBlock,r=void 0===n?"line":n,o=t.defaultMarks,i=void 0===o?[]:o,a=t.delimiter,u=void 0===a?"\n":a,c=t.toJSON,s=void 0!==c&&c;Ce.Set.isSet(i)&&(i=i.toArray()),r=C.i.createProperties(r),i=i.map(C.h.createProperties);var l={object:"value",document:{object:"document",data:{},nodes:e.split(u).map(function(e){return De({},r,{object:"block",data:{},nodes:[{object:"text",text:e,marks:i}]})})}};return s?l:C.n.fromJSON(l)},serialize:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Me(e.document,t)}},Re=n(400),Fe={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",splitBlock:"shift?+enter",undo:"mod+z"},Be={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},ze={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:"ctrl+y"},Ue={},qe=we||Oe,We=!qe;[].concat(Object.keys(Fe)).concat(Object.keys(Be)).concat(Object.keys(ze)).forEach(function(e){var t="is"+e[0].toUpperCase()+e.slice(1);if(!Ue[t]){var n=Fe[e],r=Be[e],o=ze[e],i=n&&Object(Re.isKeyHotkey)(n),a=r&&Object(Re.isKeyHotkey)(r),u=o&&Object(Re.isKeyHotkey)(o);Ue[t]=function(e){return!(!i||!i(e))||(!!(qe&&a&&a(e))||!!(We&&u&&u(e)))}}});var He=Ue,Ve=function(e,t){if(!e)throw new Error("Invariant failed: "+(t||""))},Ge=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Je=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Ze=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},Ye=0;var Ke=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Ye++,n=e.placeholder,r=e.when,i=e.style,a=void 0===i?{}:i;return Ve("string"==typeof n,"You must pass `SlateReactPlaceholder` an `options.placeholder` string."),Ve("string"==typeof r||"function"==typeof r,"You must pass `SlateReactPlaceholder` an `options.when` query."),{decorateNode:function(e,n,o){if(!n.query(r,e))return o();var i=o(),a=e.texts(),u=Je(a,1)[0],c=e.texts({direction:"backward"}),s=Je(c,1)[0],l=Je(u,2),f=l[0],p=l[1],d=Je(s,2),h=d[0],m=d[1],v={type:"placeholder",data:{key:t},anchor:{key:f.key,offset:0,path:p},focus:{key:h.key,offset:h.text.length,path:m}};return[].concat(Ze(i),[v])},renderDecoration:function(e,r,i){var u=e.children,c=e.decoration;if("placeholder"===c.type&&c.data.get("key")===t){var s=Ge({pointerEvents:"none",display:"inline-block",width:"0",maxWidth:"100%",whiteSpace:"nowrap",opacity:"0.333",verticalAlign:"text-top"},a);return o.a.createElement("span",null,o.a.createElement("span",{contentEditable:!1,style:s},n),u)}return i()}}},Xe=function(e,t){return e===t};var Qe=function(e,t){var n;void 0===t&&(t=Xe);var r,o=[],i=!1,a=function(e,n){return t(e,o[n],n)};return function(){for(var t=arguments.length,u=new Array(t),c=0;c<t;c++)u[c]=arguments[c];return i&&n===this&&u.length===o.length&&u.every(a)?r:(r=e.apply(this,u),i=!0,n=this,o=u,r)}},$e=["onBeforeInput","onBlur","onClick","onContextMenu","onCompositionEnd","onCompositionStart","onCopy","onCut","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onInput","onFocus","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onPaste","onSelect"],et={EDITOR:"data-slate-editor",FRAGMENT:"data-slate-fragment",KEY:"data-key",LEAF:"data-slate-leaf",LENGTH:"data-slate-length",OBJECT:"data-slate-object",OFFSET_KEY:"data-offset-key",SPACER:"data-slate-spacer",STRING:"data-slate-string",TEXT:"data-slate-object",VOID:"data-slate-void",ZERO_WIDTH:"data-slate-zero-width"},tt={BLOCK:"["+et.OBJECT+'="block"]',EDITOR:"["+et.EDITOR+"]",INLINE:"["+et.OBJECT+'="inline"]',KEY:"["+et.KEY+"]",LEAF:"["+et.LEAF+"]",OBJECT:"["+et.OBJECT+"]",STRING:"["+et.STRING+"]",TEXT:"["+et.OBJECT+'="text"]',VOID:"["+et.VOID+"]",ZERO_WIDTH:"["+et.ZERO_WIDTH+"]"},nt=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},rt=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),ot=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},it=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},at=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},ut=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},ct=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),st=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},lt=/^([\w-]+)(?::(\d+))?$/;var ft={parse:function(e){var t=lt.exec(e);if(!t)throw new Error('Invalid offset key string "'+e+'".');var n=ct(t,3),r=(n[0],n[1]),o=n[2];return{key:r,index:parseInt(o,10)}},stringify:function(e){return e.key+":"+e.index}},pt=function(e){var t=e.text,n=void 0===t?"":t,r=e.isTrailing,i=void 0!==r&&r;return o.a.createElement("span",ot({},et.STRING,!0),n,i?"\n":null)},dt=function(e){var t,n=e.length,r=void 0===n?0:n,i=e.isLineBreak,a=void 0!==i&&i;return o.a.createElement("span",(ot(t={},et.ZERO_WIDTH,a?"n":"z"),ot(t,et.LENGTH,r),t),"\ufeff",a?o.a.createElement("br",null):null)},ht=function(e){var t,n=e.marks,r=e.annotations,i=e.decorations,a=e.node,u=e.index,c=e.offset,s=e.text,l=e.editor,f=e.parent,p=e.block,d=e.leaves,h=ft.stringify({key:a.key,index:u}),m=void 0;if(l.query("isVoid",f))m=o.a.createElement(dt,{length:f.text.length});else if(""===s&&"block"===f.object&&""===f.text&&f.nodes.last()===a)m=o.a.createElement(dt,{isLineBreak:!0});else if(""===s)m=o.a.createElement(dt,null);else{var v=p.getLastText(),g=s.charAt(s.length-1),y=a===v,b=u===d.size-1;m=y&&b&&"\n"===g?o.a.createElement(pt,{isTrailing:!0,text:s}):o.a.createElement(pt,{text:s})}var w={editor:l,marks:n,annotations:r,decorations:i,node:a,offset:c,text:s},O=!0,E=!1,x=void 0;try{for(var k,S=n[Symbol.iterator]();!(O=(k=S.next()).done);O=!0){var C=k.value;(F=l.run("renderMark",it({},w,{mark:C,children:m,attributes:ot({},et.OBJECT,"mark")})))&&(m=F)}}catch(e){E=!0,x=e}finally{try{!O&&S.return&&S.return()}finally{if(E)throw x}}var j=!0,_=!1,I=void 0;try{for(var T,N=i[Symbol.iterator]();!(j=(T=N.next()).done);j=!0){var A=T.value;(F=l.run("renderDecoration",it({},w,{decoration:A,children:m,attributes:ot({},et.OBJECT,"decoration")})))&&(m=F)}}catch(e){_=!0,I=e}finally{try{!j&&N.return&&N.return()}finally{if(_)throw I}}var P=!0,D=!1,M=void 0;try{for(var L,R=r[Symbol.iterator]();!(P=(L=R.next()).done);P=!0){var F,B=L.value;(F=l.run("renderAnnotation",it({},w,{annotation:B,children:m,attributes:ot({},et.OBJECT,"annotation")})))&&(m=F)}}catch(e){D=!0,M=e}finally{try{!P&&R.return&&R.return()}finally{if(D)throw M}}var z=(ot(t={},et.LEAF,!0),ot(t,et.OFFSET_KEY,h),t);return o.a.createElement("span",z,m)};ht.propTypes={annotations:T.a.list.isRequired,block:_.block.isRequired,decorations:T.a.list.isRequired,editor:S.a.object.isRequired,index:S.a.number.isRequired,leaves:S.a.object.isRequired,marks:_.marks.isRequired,node:_.node.isRequired,offset:S.a.number.isRequired,parent:_.node.isRequired,text:S.a.string.isRequired};var mt=o.a.memo(ht,function(e,t){return t.block===e.block&&t.index===e.index&&t.marks===e.marks&&t.parent===e.parent&&t.text===e.text&&t.annotations.equals(e.annotations)&&t.decorations.equals(e.decorations)}),vt=o.a.forwardRef(function(e,t){var n,r=e.annotations,i=e.block,a=e.decorations,u=e.node,c=e.parent,s=e.editor,l=e.style,f=u.key,p=u.getLeaves(r,a),d=0;return o.a.createElement("span",it({ref:t,style:l},(ot(n={},et.OBJECT,u.object),ot(n,et.KEY,f),n)),p.map(function(e,t){var n=e.text,r=d;return d+=n.length,o.a.createElement(mt,{key:u.key+"-"+t,block:i,editor:s,index:t,annotations:e.annotations,decorations:e.decorations,marks:e.marks,node:u,offset:r,parent:c,leaves:p,text:n})}))});vt.propTypes={annotations:T.a.map.isRequired,block:_.block,decorations:T.a.list.isRequired,editor:S.a.object.isRequired,node:_.node.isRequired,parent:_.node.isRequired,style:S.a.object};var gt=o.a.memo(vt,function(e,t){return t.node===e.node&&"block"===t.parent.object&&e.parent.nodes.last()===e.node&&t.parent.nodes.last()!==t.node&&t.annotations.equals(e.annotations)&&t.decorations.equals(e.decorations)}),yt=A()("slate:void"),bt=function(e){function t(){var e,n,r;nt(this,t);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=r=ut(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),wt.call(r),ut(r,n)}return at(t,e),rt(t,[{key:"render",value:function(){var e,t=this.props,n=t.children,r=t.node,i=t.readOnly,a="block"===r.object?"div":"span",u=ot({},et.SPACER,!0),c=o.a.createElement(a,it({style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},u),this.renderText()),s=o.a.createElement(a,{contentEditable:!!i&&null},n);this.debug("render",{props:t});var l=(ot(e={},et.VOID,!0),ot(e,et.KEY,r.key),e);return o.a.createElement(a,it({contentEditable:!(!i&&"block"!==r.object)&&null},l),i?null:c,s)}}]),t}(o.a.Component);bt.propTypes={block:_.block,children:S.a.any.isRequired,editor:S.a.object.isRequired,node:_.node.isRequired,parent:_.node.isRequired,readOnly:S.a.bool.isRequired};var wt=function(){var e=this;this.debug=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var i=e.props.node,a=i.key+" ("+i.type+")";yt.apply(void 0,[t,""+a].concat(r))},this.renderText=function(){var t=e.props,n=t.annotations,r=t.block,i=t.decorations,a=t.node,u=t.readOnly,c=t.editor,s=t.textRef,l=a.getFirstText();return o.a.createElement(gt,{ref:s,annotations:n,block:"block"===a.object?a:r,decorations:i,editor:c,key:l.key,node:l,parent:a,readOnly:u})}},Ot=A()("slate:node"),Et=function(e){function t(){var e,n,r;nt(this,t);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=r=ut(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),xt.call(r),ut(r,n)}return at(t,e),rt(t,[{key:"shouldComponentUpdate",value:function(e){var t=this.props,n=t.editor.run("shouldNodeComponentUpdate",t,e),r=e,o=t;if(null!=n){if(P(!1,'As of slate-react@0.22 the `shouldNodeComponentUpdate` middleware is deprecated. You can pass specific values down the tree using React\'s built-in "context" construct instead.'),n)return!0;P(!1!==n,"Returning false in `shouldNodeComponentUpdate` does not disable Slate's internal `shouldComponentUpdate` logic. If you want to prevent updates, use React's `shouldComponentUpdate` instead.")}return r.readOnly!==o.readOnly||(r.node!==o.node||(!!(!r.selection&&o.selection||r.selection&&!o.selection||r.selection&&o.selection&&!r.selection.equals(o.selection))||(!r.annotations.equals(o.annotations)||!r.decorations.equals(o.decorations))))}},{key:"render",value:function(){var e,n=this;this.debug("render",this);var r=this.props,i=r.annotations,a=r.block,u=r.decorations,c=r.editor,s=r.node,l=r.parent,f=r.readOnly,p=r.selection,d=s.getDecorations(c),h=s.nodes.toArray().map(function(e,r){var l="text"===e.object?gt:t,h=p&&kt(s,r,p),m=d.map(function(e){return kt(s,r,e)}).filter(function(e){return e}).concat(u),v=i.map(function(e){return kt(s,r,e)}).filter(function(e){return e});return o.a.createElement(l,{block:"block"===s.object?s:a,editor:c,annotations:v,decorations:m,selection:h,key:e.key,node:e,parent:s,readOnly:f,ref:function(e){e?n.tmp.nodeRefs[r]=e:delete n.tmp.nodeRefs[r]}})}),m=(ot(e={},et.OBJECT,s.object),ot(e,et.KEY,s.key),ot(e,"ref",this.ref),e);s.isLeafBlock()&&("rtl"===s.getTextDirection()&&(m.dir="rtl"));var v=void 0;"block"===s.object?v="renderBlock":"document"===s.object?v="renderDocument":"inline"===s.object&&(v="renderInline");var g=c.run(v,{attributes:m,children:h,editor:c,isFocused:!!p&&p.isFocused,isSelected:!!p,node:s,parent:l,readOnly:f});return c.isVoid(s)?o.a.createElement(bt,it({},this.props,{textRef:function(e){e?n.tmp.nodeRefs[0]=e:delete n.tmp.nodeRefs[0]}}),g):g}}]),t}(o.a.Component);Et.propTypes={annotations:T.a.map.isRequired,block:_.block,decorations:T.a.list.isRequired,editor:S.a.object.isRequired,node:_.node.isRequired,parent:_.node,readOnly:S.a.bool.isRequired,selection:_.selection};var xt=function(){var e=this;this.tmp={nodeRefs:{}},this.ref=o.a.createRef(),this.debug=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var i=e.props.node,a=i.key,u=i.type;Ot.apply(void 0,[t,a+" ("+u+")"].concat(r))}};function kt(e,t,n){if(n.isUnset)return null;var r=e.nodes.get(t),o=n,i=o.start,a=o.end,u=i.path,c=a.path,s=u.first(),l=c.first();if(s===t)i=i.setPath(u.rest());else if(s<t&&t<=l)if("text"===r.object)i=i.moveTo(C.j.create([t]),0);else{var f=r.texts(),p=ct(f,1)[0],d=ct(p,2)[1];i=i.moveTo(d,0)}else i=null;if(l===t)a=a.setPath(c.rest());else if(s<=t&&t<l)if("text"===r.object)a=a.moveTo(C.j.create([t]),r.text.length);else{var h=r.texts({direction:"backward"}),m=ct(h,1)[0],v=ct(m,2),g=v[0],y=v[1];a=a.moveTo(y,g.text.length)}else a=null;return i&&a?n=(n=n.setStart(i)).setEnd(a):null}var St=["auto","overlay","scroll"],Ct=we&&!!window.navigator.userAgent.match(/os 11_/i);function jt(e){if(!Ct&&e.anchorNode){var t=M()(e.anchorNode),n=function(e,t){for(var n=e.parentNode,r=void 0;!r&&n.parentNode;){var o=t.getComputedStyle(n).overflowY;if(St.includes(o)){r=n;break}n=n.parentNode}return r||t.document.body}(e.anchorNode,t),r=n===t.document.body||n===t.document.documentElement,o=R()(e),i=e.getRangeAt(0).cloneRange();i.collapse(o);var a=i.getBoundingClientRect();ve&&i.collapsed&&0===a.top&&0===a.height&&(0===i.startOffset?i.setEnd(i.endContainer,1):i.setStart(i.startContainer,i.startOffset-1),0===(a=i.getBoundingClientRect()).top&&0===a.height&&i.getClientRects().length&&(a=i.getClientRects()[0]));var u=void 0,c=void 0,s=void 0,l=void 0,f=0,p=0,d=0,h=0,m=0,v=0,g=0,y=0;if(r){u=t.innerWidth,c=t.innerHeight,s=t.pageYOffset,l=t.pageXOffset}else{var b=n.offsetWidth,w=n.offsetHeight,O=n.scrollTop,E=n.scrollLeft,x=t.getComputedStyle(n),k=x.borderTopWidth,S=x.borderBottomWidth,C=x.borderLeftWidth,j=x.borderRightWidth,_=x.paddingTop,I=x.paddingBottom,T=x.paddingLeft,N=x.paddingRight,A=n.getBoundingClientRect();u=b,c=w,f=A.top+parseInt(k,10),p=A.left+parseInt(C,10),d=parseInt(k,10)+parseInt(S,10),h=parseInt(C,10)+parseInt(j,10),m=parseInt(_,10),v=parseInt(I,10),g=parseInt(T,10),y=parseInt(N,10),s=O,l=E}var P=a.top+s-f,D=a.left+l-p,L=l,F=s;D<l?L=D-g:D+a.width+h>l+u&&(L=D+h+y-u),P<s?F=P-m:P+a.height+d>s+c&&(F=P+d+v+a.height-c),r?t.scrollTo(L,F):(n.scrollTop=F,n.scrollLeft=L)}}function _t(e){if(ge){var t=window.document.body.createTextRange();t.collapse(),t.select()}else e.removeAllRanges()}var It=/Permission denied to access property "nodeType"/,Tt=A()("slate:content");Tt.update=A()("slate:update");var Nt=function(e){function t(){var e,n,r;nt(this,t);for(var i=arguments.length,a=Array(i),u=0;u<i;u++)a[u]=arguments[u];return n=r=ut(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.tmp={isUpdatingSelection:!1,nodeRef:o.a.createRef(),nodeRefs:{}},r.ref=o.a.createRef(),r.setRef=function(e){r.ref.current=e,r.props.editor.el=e},r.handlers=$e.reduce(function(e,t){return e[t]=function(e){return r.onEvent(t,e)},e},{}),r.updateSelection=function(){var e=r.props.editor,t=e.value.selection,n=t.isBackward,o=M()(r.ref.current),i=o.getSelection(),a=o.document.activeElement;if(Tt.enabled&&Tt.update("updateSelection",{selection:t.toJSON()}),i){var u=i.rangeCount,c=i.anchorNode,s=!1;if(t.isBlurred&&a===r.ref.current&&(r.ref.current.blur(),s=!0),t.isUnset&&u&&r.isInEditor(c)&&(_t(i),s=!0),t.isFocused&&a!==r.ref.current&&(r.ref.current.focus({preventScroll:!0}),s=!0),t.isFocused&&t.isSet){var l=!!u&&i.getRangeAt(0),f=e.findDOMRange(t);if(!f)return void P(!1,"Unable to find a native DOM range from the current selection.");var p=f.startContainer,d=f.startOffset,h=f.endContainer,m=f.endOffset;if(l&&(p===l.startContainer&&d===l.startOffset&&h===l.endContainer&&m===l.endOffset||p===l.endContainer&&d===l.endOffset&&h===l.startContainer&&m===l.startOffset))return;s=!0,r.tmp.isUpdatingSelection=!0,_t(i),i.setBaseAndExtent?n?i.setBaseAndExtent(f.endContainer,f.endOffset,f.startContainer,f.startOffset):i.setBaseAndExtent(f.startContainer,f.startOffset,f.endContainer,f.endOffset):i.addRange(f),jt(i),setTimeout(function(){me&&r.ref.current&&r.ref.current.focus(),r.tmp.isUpdatingSelection=!1})}s&&Tt.enabled&&(Tt("updateSelection",{selection:t,native:i,activeElement:a}),Tt.update("updateSelection-applied",{selection:t}))}},r.isInEditor=function(e){var t=void 0;try{if(8===e.nodeType)return!1;t=3===e.nodeType?e.parentNode:e}catch(e){if(me&&It.test(e.message))return!1;throw e}return t.isContentEditable&&(t===r.ref.current||t.closest(tt.EDITOR)===r.ref.current)},r.onNativeSelectionChange=Se()(function(e){r.props.readOnly||M()(e.target).document.activeElement===r.ref.current&&r.props.onEvent("onSelect",e)},100),ut(r,n)}return at(t,e),rt(t,[{key:"componentDidCatch",value:function(e,t){Tt("componentDidCatch",{error:e,info:t}),this.setState({})}},{key:"componentDidMount",value:function(){M()(this.ref.current).document.addEventListener("selectionchange",this.onNativeSelectionChange),xe&&this.ref.current.addEventListener("beforeinput",this.handlers.onBeforeInput),this.updateSelection(),this.props.onEvent("onComponentDidMount")}},{key:"componentWillUnmount",value:function(){var e=M()(this.ref.current);e&&e.document.removeEventListener("selectionchange",this.onNativeSelectionChange),xe&&this.ref.current.removeEventListener("beforeinput",this.handlers.onBeforeInput),this.props.onEvent("onComponentWillUnmount")}},{key:"componentDidUpdate",value:function(){Tt.update("componentDidUpdate"),this.updateSelection(),this.props.onEvent("onComponentDidUpdate")}},{key:"onEvent",value:function(e,t){if(Tt("onEvent",e),!this.tmp.isUpdatingSelection||"onSelect"!==e&&"onBlur"!==e&&"onFocus"!==e){if(!be&&"onSelect"===e){var n=this.props.editor,r=n.value.selection,o=M()(t.target).getSelection(),i=n.findRange(o);if(i&&i.equals(r.toRange()))return void this.updateSelection()}if("onDragEnd"===e||"onDragEnter"===e||"onDragExit"===e||"onDragLeave"===e||"onDragOver"===e||"onDragStart"===e||"onDrop"===e)if(t.target.closest(tt.EDITOR)!==this.ref.current)return;("onBeforeInput"!==e&&"onBlur"!==e&&"onCompositionEnd"!==e&&"onCompositionStart"!==e&&"onCopy"!==e&&"onCut"!==e&&"onFocus"!==e&&"onInput"!==e&&"onKeyDown"!==e&&"onKeyUp"!==e&&"onPaste"!==e&&"onSelect"!==e||this.isInEditor(t.target))&&this.props.onEvent(e,t)}}},{key:"render",value:function(){var e,t=this.props,n=this.handlers,r=t.id,i=t.className,a=t.readOnly,u=t.editor,c=t.tabIndex,s=t.role,l=t.tagName,f=t.spellCheck,p=u.value,d=l,h=p.document,m=p.selection,v=it({outline:"none",whiteSpace:"pre-wrap",wordWrap:"break-word"},a?{}:{WebkitUserModify:"read-write-plaintext-only"},t.style);Tt("render",{props:t}),this.props.onEvent("onRender");var g=(ot(e={},et.EDITOR,!0),ot(e,et.KEY,h.key),e);return o.a.createElement(d,it({key:this.props.contentKey},n,g,{ref:this.setRef,contentEditable:!a||null,suppressContentEditableWarning:!0,id:r,className:i,autoCorrect:t.autoCorrect?"on":"off",spellCheck:f,style:v,role:a?null:s||"textbox",tabIndex:c,"data-gramm":!1}),o.a.createElement(Et,{annotations:p.annotations,block:null,decorations:Object(Ce.List)(),editor:u,node:h,parent:null,readOnly:a,selection:m,ref:this.tmp.nodeRef}))}}]),t}(o.a.Component);Nt.propTypes={autoCorrect:S.a.bool.isRequired,className:S.a.string,contentKey:S.a.number,editor:S.a.object.isRequired,id:S.a.string,readOnly:S.a.bool.isRequired,role:S.a.string,spellCheck:S.a.bool.isRequired,style:S.a.object,tabIndex:S.a.number,tagName:S.a.string},Nt.defaultProps={style:{},tagName:"div"};var At=[].concat(st($e),["commands","decorateNode","queries","renderAnnotation","renderBlock","renderDecoration","renderDocument","renderEditor","renderInline","renderMark","schema"]);function Pt(){return{queries:{findDOMNode:function(e,t){t=C.j.create(t);var n=e.tmp.contentRef.current;return n?t.size?function e(t,n){if(!t)return null;if(!n.size)return t.ref?t.ref.current||null:t||null;var r=n.first(),o=n.rest();return e(t.tmp.nodeRefs[r],o)}(n.tmp.nodeRef.current,t):n.ref.current||null:null},findDOMPoint:function(e,t){var n=e.findDOMNode(t.path),r=0;if(!n)return null;var o=Array.from(n.querySelectorAll(tt.STRING+", "+tt.ZERO_WIDTH)),i=!0,a=!1,u=void 0;try{for(var c,s=o[Symbol.iterator]();!(i=(c=s.next()).done);i=!0){var l=c.value,f=l.childNodes[0],p=f.textContent.length,d=p;l.hasAttribute(et.LENGTH)&&(d=parseInt(l.getAttribute(et.LENGTH),10));var h=r+d;if(t.offset<=h)return{node:f,offset:Math.min(p,Math.max(0,t.offset-r))};r=h}}catch(e){a=!0,u=e}finally{try{!i&&s.return&&s.return()}finally{if(a)throw u}}return null},findDOMRange:function(e,t){var n=t.anchor,r=t.focus,o=t.isBackward,i=t.isCollapsed,a=e.findDOMPoint(n),u=i?a:e.findDOMPoint(r);if(!a||!u)return null;var c=M()(a.node).document.createRange(),s=o?u:a,l=o?a:u;return c.setStart(s.node,s.offset),c.setEnd(l.node,l.offset),c},findEventRange:function(e,t){t.nativeEvent&&(t=t.nativeEvent);var n=t,r=n.clientX,o=n.clientY,i=n.target;if(null==r||null==o)return null;var a=e.value.document,u=e.findPath(t.target);if(!u)return null;var c=a.getNode(u);if(e.isVoid(c)){var s=i.getBoundingClientRect(),l="inline"===c.object?r-s.left<s.left+s.width-r:o-s.top<s.top+s.height-o,f=a.createRange(),p=l?"moveToEndOfNode":"moveToStartOfNode",d=a[l?"getPreviousText":"getNextText"](u);return d?f[p](d):null}var h=M()(i),m=void 0;if(h.document.caretRangeFromPoint)m=h.document.caretRangeFromPoint(r,o);else if(h.document.caretPositionFromPoint){var v=h.document.caretPositionFromPoint(r,o);(m=h.document.createRange()).setStart(v.offsetNode,v.offset),m.setEnd(v.offsetNode,v.offset)}else if(h.document.body.createTextRange){m=h.document.body.createTextRange();try{m.moveToPoint(r,o)}catch(e){return null}}return e.findRange(m)},findNode:function(e,t){var n=e.findPath(t);return n?e.value.document.getNode(n):null},findPath:function(e,t){var n=e.tmp.contentRef.current,r=t;if(r.hasAttribute(et.KEY)||(r=r.closest(tt.KEY)),!r||!r.getAttribute(et.KEY))return null;if(r===n.ref.current)return C.j.create([]);var o=function e(t,n){if(r===t)return n;if(!t.ref)return null;if(r===t.ref.current)return n;if(!t.tmp)return null;var o=t.tmp.nodeRefs,i=Object.keys(o),a=!0,u=!1,c=void 0;try{for(var s,l=i[Symbol.iterator]();!(a=(s=l.next()).done);a=!0){var f=s.value,p=o[f],d=parseInt(f,10),h=e(p,[].concat(st(n),[d]));if(h)return h}}catch(e){u=!0,c=e}finally{try{!a&&l.return&&l.return()}finally{if(u)throw c}}return null}(n.tmp.nodeRef.current,[]);return o?C.j.create(o):null},findPoint:function(e,t,n){var r=function(e,t){if(1===e.nodeType&&e.childNodes.length){var n=t===e.childNodes.length,r=n?"backward":"forward",o=n?t-1:t;for(e=Dt(e,o,r);1===e.nodeType&&e.childNodes.length;){var i=n?e.childNodes.length-1:0;e=Dt(e,i,r)}t=n?e.textContent.length:0}return{node:e,offset:t}}(t,n),o=r.node,i=r.offset,a=M()(t),u=o.parentNode,c=u.closest(tt.LEAF),s=void 0,l=void 0,f=void 0;if(c){s=c.closest(tt.TEXT);var p=a.document.createRange();p.setStart(s,0),p.setEnd(o,i);var d=p.cloneContents(),h=d.querySelectorAll(tt.ZERO_WIDTH);Array.from(h).forEach(function(e){e.parentNode.removeChild(e)}),l=d.textContent.length,f=s}else{var m=u.closest(tt.VOID);if(!m)return null;if(!(c=m.querySelector(tt.LEAF)))return null;s=c.closest(tt.TEXT),l=(f=c).textContent.length}l===f.textContent.length&&u.hasAttribute(et.ZERO_WIDTH)&&l--;var v=e.findPath(s);return v?e.value.document.createPoint({path:v,offset:l}):null},findRange:function(e,t){var n=t.anchorNode||t.startContainer;if(!n)return null;var r=M()(n);(t instanceof r.Range||r.StaticRange&&t instanceof r.StaticRange)&&(t={anchorNode:t.startContainer,anchorOffset:t.startOffset,focusNode:t.endContainer,focusOffset:t.endOffset});var o=t,i=o.anchorNode,a=o.anchorOffset,u=o.focusNode,c=o.focusOffset,s=o.isCollapsed,l=e.value,f=e.findPoint(i,a),p=s?f:e.findPoint(u,c);return f&&p?l.document.createRange({anchor:f,focus:p}):null},findSelection:function(e,t){var n=e.value,r=n.document;if(!t.rangeCount)return null;var o=e.findRange(t);if(!o)return null;var i=o,a=i.anchor,u=i.focus,c=r.getNode(a.path),s=r.getNode(u.path),l=r.getClosestInline(a.path),f=r.getClosestInline(u.path),p=r.getClosestBlock(u.path),d=r.getClosestBlock(a.path);if(d&&!e.isVoid(d)&&0===a.offset&&p&&e.isVoid(p)&&0!==u.offset&&(o=o.setFocus(u.setOffset(0))),l&&!e.isVoid(l)&&a.offset===c.text.length){var h=r.getClosestBlock(a.path),m=r.getDepth(h.key),v=C.j.drop(a.path,m),g=h.texts({path:v}),y=ct(g,1)[0];if(y){var b=ct(y,2)[1],w=a.path.slice(0,m).concat(b);o=o.moveAnchorTo(w,0)}}if(f&&!e.isVoid(f)&&u.offset===s.text.length){var O=r.getClosestBlock(u.path),E=r.getDepth(O.key),x=C.j.drop(u.path,E),k=O.texts({path:x}),S=ct(k,1)[0];if(S){var j=ct(S,2)[1],_=u.path.slice(0,E).concat(j);o=o.moveFocusTo(_,0)}}var I=r.createSelection(o);return I=(I=I.setIsFocused(!0)).set("marks",n.selection.marks)}}}}function Dt(e,t,n){for(var r=e.childNodes,o=r[t],i=t,a=!1,u=!1;(8===o.nodeType||1===o.nodeType&&0===o.childNodes.length||1===o.nodeType&&"false"===o.getAttribute("contenteditable"))&&(!a||!u);)i>=r.length?(a=!0,i=t-1,n="backward"):i<0?(u=!0,i=t+1,n="forward"):(o=r[i],"forward"===n&&i++,"backward"===n&&i--);return o||null}function Mt(e,t,n){P(!1,"As of slate-react@0.22 the `findPoint(node, offset)` helper is deprecated in favor of `editor.findPoint(node, offset)`."),Object(je.a)(!C.n.isValue(n),"As of Slate 0.42.0, the `findPoint` utility takes an `editor` instead of a `value`.");var r=function(e,t){if(1===e.nodeType&&e.childNodes.length){var n=t===e.childNodes.length,r=n?"backward":"forward",o=n?t-1:t;for(e=Lt(e,o,r);1===e.nodeType&&e.childNodes.length;){var i=n?e.childNodes.length-1:0;e=Lt(e,i,r)}t=n?e.textContent.length:0}return{node:e,offset:t}}(e,t),o=r.node,i=r.offset,a=M()(e),u=o.parentNode,c=u.closest(tt.LEAF),s=void 0,l=void 0;if(c){var f=a.document.createRange(),p=c.closest(tt.TEXT);f.setStart(p,0),f.setEnd(o,i),l=p,s=f.cloneContents().textContent.length}else{var d=u.closest(tt.VOID);if(!d)return null;if(!(c=d.querySelector(tt.LEAF)))return null;s=(l=c).textContent.length}s===l.textContent.length&&u.hasAttribute(et.ZERO_WIDTH)&&s--;var h=c.getAttribute(et.OFFSET_KEY);if(!h)return null;var m=ft.parse(h).key,v=n.value;return v.document.hasDescendant(m)?v.document.createPoint({key:m,offset:s}):null}function Lt(e,t,n){for(var r=e.childNodes,o=r[t],i=t,a=!1,u=!1;(8===o.nodeType||1===o.nodeType&&0===o.childNodes.length||1===o.nodeType&&"false"===o.getAttribute("contenteditable"))&&(!a||!u);)i>=r.length?(a=!0,i=t-1,n="backward"):i<0?(u=!0,i=t+1,n="forward"):(o=r[i],"forward"===n&&i++,"backward"===n&&i--);return o||null}function Rt(e,t){P(!1,"As of slate-react@0.22 the `findRange(selection)` helper is deprecated in favor of `editor.findRange(selection)`."),Object(je.a)(!C.n.isValue(t),"As of Slate 0.42.0, the `findNode` utility takes an `editor` instead of a `value`.");var n=e.anchorNode||e.startContainer;if(!n)return null;var r=M()(n);(e instanceof r.Range||r.StaticRange&&e instanceof r.StaticRange)&&(e={anchorNode:e.startContainer,anchorOffset:e.startOffset,focusNode:e.endContainer,focusOffset:e.endOffset});var o=e,i=o.anchorNode,a=o.anchorOffset,u=o.focusNode,c=o.focusOffset,s=o.isCollapsed,l=t.value,f=Mt(i,a,t),p=s?f:Mt(u,c,t);return f&&p?l.document.createRange({anchor:f,focus:p}):null}function Ft(e,t,n){P(!1,"As of slate-react@0.22 the `getSelectionFromDOM(window, editor, domSelection)` helper is deprecated in favor of `editor.findSelection(domSelection)`.");var r=t.value,o=r.document;if(n.rangeCount){var i=Rt(n,t);if(i){var a=i,u=a.anchor,c=a.focus,s=o.getNode(u.path),l=o.getNode(c.path),f=o.getClosestInline(u.path),p=o.getClosestInline(c.path),d=o.getClosestBlock(c.path),h=o.getClosestBlock(u.path);if(h&&!t.isVoid(h)&&0===u.offset&&d&&t.isVoid(d)&&0!==c.offset&&(i=i.setFocus(c.setOffset(0))),f&&!t.isVoid(f)&&u.offset===s.text.length){var m=o.getClosestBlock(u.path),v=o.getDepth(m.key),g=C.j.drop(u.path,v),y=m.texts({path:g}),b=ct(y,1)[0];if(b){var w=ct(b,2)[1],O=u.path.slice(0,v).concat(w);i=i.moveAnchorTo(O,0)}}if(p&&!t.isVoid(p)&&c.offset===l.text.length){var E=o.getClosestBlock(c.path),x=o.getDepth(E.key),k=C.j.drop(c.path,x),S=E.texts({path:k}),j=ct(S,1)[0];if(j){var _=ct(j,2)[1],I=c.path.slice(0,x).concat(_);i=i.moveFocusTo(I,0)}}var T=o.createSelection(i);return T=(T=T.setIsFocused(!0)).set("marks",r.selection.marks)}}else t.blur()}function Bt(e,t){return e.nodeType===t.Node.TEXT_NODE}function zt(e,t){if(!e.length)throw new Error("elements must be an Array");var n=e[e.length-1];return{elements:e.map(function(e){return function e(t,n){var r={};return r.node=t,Bt(t,n)&&(r.text=t.textContent),r.children=Array.from(t.childNodes).map(function(t){return e(t,n)}),r}(e,t)}),parent:n.parentElement,next:n.nextElementSibling}}function Ut(e,t){var n=e.elements,r=e.next,o=e.parent;n.forEach(function(e){return function e(t,n){var r=t.node;Bt(r,n)&&r.textContent!==t.text&&(r.textContent=t.text),t.children.forEach(function(t){e(t,n),r.appendChild(t.node)});for(var o=t.children.length;r.childNodes.length>o;)r.removeChild(r.childNodes[0]);var i=r.dataset;if(i){var a=i.key;if(a){var u=new n.Set(Array.from(n.document.querySelectorAll("["+et.KEY+'="'+a+'"]')));u.delete(r),u.forEach(function(e){return e.parentElement.removeChild(e)})}}}(e,t)});var i=n[n.length-1].node;e.next?o.insertBefore(i,r):o.appendChild(i);for(var a=i,u=n.length-2;u>=0;u--){var c=n[u].node;o.insertBefore(c,a),a=c}}var qt=function(){function e(t,n){nt(this,e),this.window=M()(t[0]),this.snapshot=zt(t,this.window),this.data=n}return rt(e,[{key:"apply",value:function(){Ut(this.snapshot,this.window)}},{key:"getData",value:function(){return this.data}}]),e}();function Wt(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;return e.nodeType===n.Node.TEXT_NODE&&(e=e.parentNode),e.closest(t)}var Ht=function(){function e(t,n){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).before,o=void 0!==r&&r;nt(this,e);var i=t.getSelection(),a=Wt(i.anchorNode,tt.EDITOR+" > *"),u=[a];if(o){var c=a.previousElementSibling;c&&u.unshift(c)}this.snapshot=new qt(u),this.selection=n.findSelection(i)}return rt(e,[{key:"apply",value:function(e){var t=this.snapshot,n=this.selection;t.apply(),e.moveTo(n.anchor.path,n.anchor.offset)}}]),e}();function Vt(){}var Gt=function e(t,n){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};nt(this,e),this.__call__=function(){r.fn(),r.preventFurtherCalls()},this.preventFurtherCalls=function(){r.fn=Vt},this.resume=function(e){r.cancel(),e?(r.mode="timeout",r.timeoutId=r.window.setTimeout(r.__call__,e)):(r.mode="animationFrame",r.callbackId=r.window.requestAnimationFrame(r.__call__))},this.cancel=function(){"timeout"===r.mode?r.window.clearTimeout(r.timeoutId):r.window.cancelAnimationFrame(r.callbackId),r.onCancel&&r.onCancel()},this.__setTimeout__=function(e){null!=e&&r.window.setTimeout(function(){r.cancel(),r.preventFurtherCalls()},e)},this.fn=n,this.window=t,this.resume(),this.onCancel=o.onCancel,this.__setTimeout__(o.timeout)},Jt=A()("slate:android");Jt.reconcile=A()("slate:reconcile"),Jt("ANDROID_API_VERSION",{ANDROID_API_VERSION:Ee});var Zt=0,Yt=1;function Kt(){var e=Zt,t=new window.Set,n=null,r=null,o=null,i=null,a=!1,u=null;function c(e,n,r){var o=r.from;Jt.reconcile({from:o});var i=e.getSelection(),a=n.findSelection(i);t.forEach(function(e){n.reconcileDOMNode(e)}),n.select(a),t.clear()}return{onBeforeInput:function(t,o,c){var s=!t.nativeEvent;Jt("onBeforeInput",{isNative:s,event:t,status:e,e:Ie()(t,["data","inputType","isComposing","nativeEvent"])});var l,f=M()(t.target);if(a)return t.preventDefault(),void(a=!1);switch(Ee){case 25:break;case 26:case 27:if(i&&(i.cancel(),r.resume()),s){if("insertParagraph"===t.inputType||"insertLineBreak"===t.inputType){Jt("onBeforeInput:enter:native",{});var p=f.getSelection(),d=Ft(0,o,p);a=!0,t.preventDefault(),o.moveTo(d.anchor.path,d.anchor.offset),o.splitBlock()}}else{if(function(e,t){if(!Array.isArray(t))throw new Error("chars must be an array of one character strings");if(null==e)return!1;var n=e[e.length-1];return t.includes(n)}(t.data,["."]))return Jt("onBeforeInput:period"),r.cancel(),void(u="period");null!=(l=t.data)&&10===l[l.length-1].charCodeAt(0)&&(r&&r.cancel(),f.requestAnimationFrame(function(){Jt("onBeforeInput:enter:react",{}),n.apply(o),o.splitBlock()}))}break;case 28:i&&(i.cancel(),r.resume());break;default:e!==Yt&&c()}},onCompositionEnd:function(o,i,a){Jt("onCompositionEnd",{event:o});var s=M()(o.target),l=s.getSelection().anchorNode;switch(Ee){case 26:case 27:n=new Ht(s,i),e=Yt}u="reconcile",t.add(l),r=new Gt(s,function(){e=Zt,c(s,i,{from:"onCompositionEnd:reconciler"}),u=null})},onCompositionStart:function(n,r,o){Jt("onCompositionStart",{event:n}),e=Yt,t.clear()},onCompositionUpdate:function(e,t,n){Jt("onCompositionUpdate",{event:e})},onInput:function(n,a,s){switch(Jt("onInput",{event:n,status:e,e:Ie()(n,["data","nativeEvent","inputType","isComposing"])}),Ee){case 24:case 25:break;case 26:case 27:case 28:var l=n.nativeEvent;if(28===Ee&&"insertText"===l.inputType&&" "===l.data)return r&&r.cancel(),i&&i.cancel(),void c(window,a,{from:"onInput:space"});if((26===Ee||27===Ee)&&"period"===u){Jt("onInput:period:abort");var f=window.getSelection().anchorNode;return void t.add(f)}if("deleteContentBackward"===l.inputType){Jt("onInput:delete",{keyDownSnapshot:o});var p=M()(n.target);return r&&r.cancel(),i&&i.cancel(),void(i=new Gt(p,function(){Jt("onInput:delete:callback",{keyDownSnapshot:o}),o.apply(a),a.deleteBackward(),i=null},{onCancel:function(){i=null}}))}if(e===Yt){var d=window.getSelection().anchorNode;return void t.add(d)}if(28===Ee){Jt("onInput:fallback");var h=window.getSelection().anchorNode;return t.add(h),void window.requestAnimationFrame(function(){Jt("onInput:fallback:callback"),c(window,a,{from:"onInput:fallback"})})}break;default:if(e===Yt)return;s()}},onKeyDown:function(t,a,u){Jt("onKeyDown",{event:t,status:e,e:Ie()(t,["char","charCode","code","key","keyCode","keyIdentifier","keyLocation","location","nativeEvent","which"])});var s=M()(t.target);switch(Ee){case 25:"Enter"===t.key&&u();break;case 26:case 27:if("Enter"===t.key){if(Jt("onKeyDown:enter",{}),i)i.cancel(),t.preventDefault(),s.requestAnimationFrame(function(){Jt("onKeyDown:enter:callback"),n.apply(a),a.splitBlock()});else{t.preventDefault();var l=s.getSelection(),f=Ft(0,a,l);a.moveTo(f.anchor.path,f.anchor.offset),a.splitBlock()}return}o=new Ht(s,a,{before:!0});break;case 28:if("Enter"===t.key)return Jt("onKeyDown:enter"),t.preventDefault(),r&&r.cancel(),i&&i.cancel(),void s.requestAnimationFrame(function(){c(s,a,{from:"onKeyDown:enter"}),a.splitBlock()});o=new Ht(s,a,{before:!0}),Jt("onKeyDown:snapshot",{keyDownSnapshot:o});break;default:e!==Yt&&u()}},onSelect:function(t,n,r){switch(Jt("onSelect",{event:t,status:e}),Ee){case 26:case 27:case 28:!function(e){var t=e.getSelection(),n=t.anchorNode,r=n.parentElement.dataset;if(r&&"n"===r.slateZeroWidth&&1===n.textContent.length&&0!==t.anchorOffset){var o=e.document.createRange();o.setStart(n,0),o.setEnd(n,0),t.removeAllRanges(),t.addRange(o)}}(M()(t.target))}}}}var Xt={FRAGMENT:"application/x-slate-fragment",HTML:"text/html",NODE:"application/x-slate-node",RICH:"text/rtf",TEXT:"text/plain"};function Qt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;P(!1,"As of slate-react@0.22 the `findDOMNode(key)` helper is deprecated in favor of `editor.findDOMNode(path)`."),C.i.isNode(e)&&(e=e.key);var n=t.document.querySelector("["+et.KEY+'="'+e+'"]');if(!n)throw new Error('Unable to find a DOM node for "'+e+'". This is often because of forgetting to add `props.attributes` to a custom component.');return n}var $t=Xt.FRAGMENT,en=Xt.HTML,tn=Xt.TEXT;function nn(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};Object(je.a)(!C.n.isValue(t),"As of Slate 0.42.0, the `cloneFragment` utility takes an `editor` instead of a `value`.");var r=M()(e.target),o=r.getSelection(),i=t.value,a=i.document,u=i.fragment,c=i.selection,s=c.start,l=c.end,f=a.getClosestVoid(s.path,t),p=a.getClosestVoid(l.path,t);if(!o.isCollapsed||f){var d=Pe.serializeNode(u),h=o.getRangeAt(0),m=h.cloneContents(),v=m.childNodes[0];if(m.childNodes.forEach(function(e){e.textContent&&""!==e.textContent.trim()&&(v=e)}),p){var g=h.cloneRange(),y=Qt(p,r);g.setEndAfter(y),m=g.cloneContents()}if(f&&(v=m.childNodes[0].childNodes[1].firstChild),[].slice.call(m.querySelectorAll(tt.ZERO_WIDTH)).forEach(function(e){var t="n"===e.getAttribute(et.ZERO_WIDTH);e.textContent=t?"\n":""}),3===v.nodeType){var b=r.document.createElement("span");b.style.whiteSpace="pre",b.appendChild(v),m.appendChild(b),v=b}v.setAttribute(et.FRAGMENT,d);var w=C.n.create({document:u}),O=Le.serialize(w),E=r.document.createElement("div");if(E.appendChild(m),e.clipboardData&&e.clipboardData.setData&&!ge)return e.preventDefault(),e.clipboardData.setData(tn,O),e.clipboardData.setData($t,d),e.clipboardData.setData(en,E.innerHTML),void n();var x=e.target.closest(tt.EDITOR);E.setAttribute("contenteditable",!0),E.style.position="absolute",E.style.left="-9999px",x.appendChild(E),o.selectAllChildren(E),r.requestAnimationFrame(function(){x.removeChild(E),_t(o),o.addRange(h),n()})}}var rn=Xt.FRAGMENT,on=Xt.HTML,an=Xt.NODE,un=Xt.RICH,cn=Xt.TEXT,sn=/ data-slate-fragment="([^\s"]+)"/;function ln(e){!ge&&e.nativeEvent&&(e=e.nativeEvent);var t=e.dataTransfer||e.clipboardData,n=fn(t,rn),r=fn(t,an),o=fn(t,on),i=fn(t,un),a=fn(t,cn),u=void 0;if(!n&&o&&~o.indexOf(" "+et.FRAGMENT+'="')){var c=sn.exec(o),s=ct(c,2),l=(s[0],s[1]);l&&(n=l)}if(a){var f=function(e){var t="SLATE-DATA-EMBED::";if(e.substring(0,t.length)!==t)return{TEXT:e};try{return JSON.parse(e.substring(t.length))}catch(e){throw new Error("Unable to parse custom Slate drag event data.")}}(a);f[rn]&&(n=f[rn]),f[an]&&(r=f[an]),f[cn]&&(a=f[cn])}n&&(n=Pe.deserializeNode(n)),r&&(r=Pe.deserializeNode(r));try{t.items&&t.items.length?u=Array.from(t.items).map(function(e){return"file"===e.kind?e.getAsFile():null}).filter(function(e){return e}):t.files&&t.files.length&&(u=Array.from(t.files))}catch(e){t.files&&t.files.length&&(u=Array.from(t.files))}var p={files:u,fragment:n,html:o,node:r,rich:i,text:a};return p.type=function(e){return e.fragment?"fragment":e.node?"node":e.rich&&e.html?"html":e.rich&&e.text?"text":e.files&&e.files.length?"files":e.html?"html":e.text?"text":"unknown"}(p),p}function fn(e,t){return e.types&&e.types.length?-1!==Array.from(e.types).indexOf(t)&&e.getData(t)||null:t===cn&&e.getData("Text")||null}var pn=Xt.TEXT;function dn(e,t,n){var r=Xt[t.toUpperCase()];if(!r)throw new Error('Cannot set unknown transfer type "'+r+'".');e.nativeEvent&&(e=e.nativeEvent);var o=e.dataTransfer||e.clipboardData;try{o.setData(r,n),o.setData("text",o.getData("text"))}catch(e){var i="SLATE-DATA-EMBED::",a=o.getData(pn),u={};if(a.substring(0,i.length)===i)try{u=JSON.parse(a.substring(i.length))}catch(e){throw new Error("Failed to parse Slate data from `DataTransfer` object.")}else u[pn]=a;u[r]=n;var c=""+i+JSON.stringify(u);o.setData(pn,c)}}var hn=A()("slate:after");var mn=A()("slate:before");function vn(){var e,t,n,r,o,i,a,u=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).plugins,c=void 0===u?[]:u,s=(e=null,t=0,n=!1,r=!1,o=!1,{onBeforeInput:function(e,t,n){var r=!!e.nativeEvent;t.readOnly||r&&xe||(mn("onBeforeInput",{event:e}),n())},onBlur:function(t,n,o){if(!r&&!n.readOnly){var i=t.relatedTarget,a=t.target,u=M()(a);if(e!==u.document.activeElement){if(i){var c=n.findDOMNode([]);if(i===c)return;if(i.hasAttribute(et.SPACER))return;var s=n.findNode(i);if(c.contains(i)&&s&&!n.isVoid(s))return}mn("onBlur",{event:t}),o()}}},onClick:function(e,t,n){mn("onClick",{event:e}),n()},onCompositionEnd:function(e,r,o){var i=t;window.requestAnimationFrame(function(){t>i||(n=!1)}),mn("onCompositionEnd",{event:e}),o()},onCompositionStart:function(e,r,o){n=!0,t++,r.value.selection.isCollapsed||r.delete(),mn("onCompositionStart",{event:e}),o()},onCopy:function(e,t,n){var o=M()(e.target);r=!0,o.requestAnimationFrame(function(){return r=!1}),mn("onCopy",{event:e}),n()},onCut:function(e,t,n){if(!t.readOnly){var o=M()(e.target);r=!0,o.requestAnimationFrame(function(){return r=!1}),mn("onCut",{event:e}),n()}},onDragEnd:function(e,t,n){o=!1,mn("onDragEnd",{event:e}),n()},onDragEnter:function(e,t,n){mn("onDragEnter",{event:e}),n()},onDragExit:function(e,t,n){mn("onDragExit",{event:e}),n()},onDragLeave:function(e,t,n){mn("onDragLeave",{event:e}),n()},onDragOver:function(e,t,n){var r=t.findNode(e.target);r&&!t.isVoid(r)||e.preventDefault(),ge&&e.preventDefault(),o||(o=!0,ge||(e.nativeEvent.dataTransfer.dropEffect="move")),mn("onDragOver",{event:e}),n()},onDragStart:function(e,t,n){o=!0,mn("onDragStart",{event:e}),n()},onDrop:function(e,t,n){t.readOnly||(e.preventDefault(),mn("onDrop",{event:e}),n())},onFocus:function(t,n,o){if(!r&&!n.readOnly){var i=n.findDOMNode([]),a=M()(t.target);e=a.document.activeElement,me&&t.target!==i?i.focus():(mn("onFocus",{event:t}),o())}},onInput:function(e,t,r){n||t.value.selection.isBlurred||(mn("onInput",{event:e}),r())},onKeyDown:function(e,t,r){t.readOnly||(n?He.isCompose(e)&&e.preventDefault():(!we&&(He.isBold(e)||He.isDeleteBackward(e)||He.isDeleteForward(e)||He.isDeleteLineBackward(e)||He.isDeleteLineForward(e)||He.isDeleteWordBackward(e)||He.isDeleteWordForward(e)||He.isItalic(e)||He.isRedo(e)||He.isSplitBlock(e)||He.isTransposeCharacter(e)||He.isUndo(e))&&e.preventDefault(),mn("onKeyDown",{event:e}),r()))},onPaste:function(e,t,n){t.readOnly||(e.preventDefault(),mn("onPaste",{event:e}),n())},onSelect:function(t,o,i){if(!r&&!n&&!o.readOnly){var a=M()(t.target);e=a.document.activeElement,mn("onSelect",{event:t}),i()}}}),l=(i=null,a=!1,{onBeforeInput:function(e,t,n){var r=t.value;if(e.nativeEvent)return e.preventDefault(),t.insertText(e.data),n();var o=e.getTargetRanges(),i=ct(o,1)[0];if(!i)return n();hn("onBeforeInput",{event:e}),e.preventDefault();var a=r.document,u=r.selection,c=t.findRange(i);switch(e.inputType){case"deleteByDrag":case"deleteByCut":case"deleteContent":case"deleteContentBackward":case"deleteContentForward":t.deleteAtRange(c);break;case"deleteWordBackward":t.deleteWordBackwardAtRange(c);break;case"deleteWordForward":t.deleteWordForwardAtRange(c);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":t.deleteLineBackwardAtRange(c);break;case"deleteSoftLineForward":case"deleteHardLineForward":t.deleteLineForwardAtRange(c);break;case"insertLineBreak":case"insertParagraph":a.hasVoidParent(u.start.path,t)?t.moveToStartOfNextText():t.splitBlockAtRange(c);break;case"insertFromYank":case"insertReplacementText":case"insertText":var s=null==e.data?e.dataTransfer.getData("text/plain"):e.data;if(null==s)break;t.insertTextAtRange(c,s,u.marks),u.marks&&r.document!==t.value.document&&t.select({marks:null})}n()},onBlur:function(e,t,n){hn("onBlur",{event:e}),t.blur(),n()},onClick:function(e,t,n){if(t.readOnly)return n();var r=t.value.document,o=t.findPath(e.target);if(!o)return n();hn("onClick",{event:e});var i=r.getNode(o),a=r.getAncestors(o);i&&(t.isVoid(i)||a.some(function(e){return t.isVoid(e)}))&&t.focus().moveToEndOfNode(i),n()},onCopy:function(e,t,n){hn("onCopy",{event:e}),nn(e,t),n()},onCut:function(e,t,n){hn("onCut",{event:e}),nn(e,t,function(){var e=t.value,n=e.document,r=e.selection,o=r.end,i=void 0;if(r.isCollapsed){var a=!0,u=!1,c=void 0;try{for(var s,l=n.ancestors(o.path)[Symbol.iterator]();!(a=(s=l.next()).done);a=!0){var f=s.value,p=ct(f,2),d=p[0],h=p[1];if(t.isVoid(d)){i=h;break}}}catch(e){u=!0,c=e}finally{try{!a&&l.return&&l.return()}finally{if(u)throw c}}}i?t.removeNodeByKey(i):t.delete()}),n()},onDragEnd:function(e,t,n){hn("onDragEnd",{event:e}),i=null,n()},onDragStart:function(e,t,n){hn("onDragStart",{event:e}),i=!0;var r=t.value,o=r.document,a=t.findPath(e.target),u=o.getNode(a),c=o.getAncestors(a),s=u&&(t.isVoid(u)||c.some(function(e){return t.isVoid(e)})),l=r.blocks.some(function(e){return e===u});s&&!l&&t.moveToRangeOfNode(u);var f=t.value.fragment;dn(e,"fragment",Pe.serializeNode(f)),n()},onDrop:function(e,t,n){var r=t.value,o=r.document,a=r.selection,u=M()(e.target),c=t.findEventRange(e);if(!c)return n();hn("onDrop",{event:e});var s=ln(e),l=s.type,f=s.fragment,p=s.text;if(t.focus(),i&&a.end.offset<c.end.offset&&a.end.path.equals(c.end.path)&&(c=c.moveForward(a.start.path.equals(a.end.path)?0-a.end.offset+a.start.offset:0-a.end.offset)),i&&t.delete(),t.select(c),"text"===l||"html"===l){var d=c.anchor,h=o.hasVoidParent(d.path,t);if(h){for(var m=d.path,v=o.getNode(d.path);h;){var g=o.texts({path:m}),y=ct(g,1)[0];if(!y)break;var b=ct(y,2);v=b[0],m=b[1],h=o.hasVoidParent(m,t)}v&&t.moveToStartOfNode(v)}p&&p.split("\n").forEach(function(e,n){n>0&&t.splitBlock(),t.insertText(e)})}"fragment"===l&&t.insertFragment(f);var w=t.findDOMNode(c.focus.path);w&&w.dispatchEvent(new MouseEvent("mouseup",{view:u,bubbles:!0,cancelable:!0})),n()},onFocus:function(e,t,n){hn("onFocus",{event:e}),!a||ge||ye?t.focus():t.deselect().focus(),n()},onInput:function(e,t,n){hn("onInput");var r=M()(e.target).getSelection(),o=t.findSelection(r);o?t.select(o):t.blur();var i=r.anchorNode;t.reconcileDOMNode(i),n()},onKeyDown:function(e,t,n){hn("onKeyDown",{event:e});var r=t.value,o=r.document,i=r.selection,a=i.start,u=o.hasVoidParent(a.path,t);if(He.isSplitBlock(e)&&!we)return u?t.moveToStartOfNextText():t.splitBlock();if(He.isDeleteBackward(e)&&!we)return t.deleteCharBackward();if(He.isDeleteForward(e)&&!we)return t.deleteCharForward();if(He.isDeleteLineBackward(e))return t.deleteLineBackward();if(He.isDeleteLineForward(e))return t.deleteLineForward();if(He.isDeleteWordBackward(e))return t.deleteWordBackward();if(He.isDeleteWordForward(e))return t.deleteWordForward();if(He.isRedo(e))return t.redo();if(He.isUndo(e))return t.undo();if(He.isMoveLineBackward(e))return e.preventDefault(),t.moveToStartOfBlock();if(He.isMoveLineForward(e))return e.preventDefault(),t.moveToEndOfBlock();if(He.isExtendLineBackward(e))return e.preventDefault(),t.moveFocusToStartOfBlock();if(He.isExtendLineForward(e))return e.preventDefault(),t.moveFocusToEndOfBlock();if(He.isMoveBackward(e))return e.preventDefault(),i.isCollapsed?t.moveBackward():t.moveToStart();if(He.isMoveForward(e))return e.preventDefault(),i.isCollapsed?t.moveForward():t.moveToEnd();if(He.isMoveWordBackward(e))return e.preventDefault(),t.moveWordBackward();if(He.isMoveWordForward(e))return e.preventDefault(),t.moveWordForward();if(He.isExtendBackward(e)){var c=o.getNode(a.path),s=o.texts({path:a.path,direction:"backward"}),l=ct(s,1)[0],f=!1;if(l){var p=ct(l,2)[1];f=o.hasVoidParent(p,t)}if(u||f||""===c.text)return e.preventDefault(),t.moveFocusBackward()}if(He.isExtendForward(e)){var d=o.getNode(a.path),h=o.texts({path:a.path}),m=ct(h,1)[0],v=!1;if(m){var g=ct(m,2)[1];v=o.hasVoidParent(g,t)}if(u||v||""===d.text)return e.preventDefault(),t.moveFocusForward()}n()},onMouseDown:function(e,t,n){hn("onMouseDown",{event:e}),a=!0,n()},onMouseUp:function(e,t,n){hn("onMouseUp",{event:e}),a=!1,n()},onPaste:function(e,t,n){hn("onPaste",{event:e});var r=t.value,o=ln(e),i=o.type,a=o.fragment,u=o.text;if("fragment"===i&&t.insertFragment(a),"text"===i||"html"===i){if(!u)return n();var c=r.document,s=r.selection,l=r.startBlock;if(t.isVoid(l))return n();var f=l,p=c.getInsertMarksAtRange(s),d=Le.deserialize(u,{defaultBlock:f,defaultMarks:p}).document;t.insertFragment(d)}n()},onSelect:function(e,t,n){hn("onSelect",{event:e});var r=M()(e.target).getSelection(),o=t.findSelection(r);o?t.select(o):t.blur(),a=!1,n()}}),f=be?[Kt()]:[];return[].concat(f,[s],st(c),[l])}function gn(e){var t=e.nativeEvent||e;switch(t.type){case"keydown":return t.type+" "+JSON.stringify(t.key);case"input":case"beforeinput":case"textInput":return t.type+":"+t.inputType+" "+JSON.stringify(t.data);default:return t.type}}var yn=A()("slate:events");var bn=2e3,wn=A()("slate:batch-events");var On=A()("slate:mutations"),En=["type","oldValue","target","addedNodes","removedNodes","attributeName","attributeNamespace","nextSibling","previousSibling"];function xn(e){if(e.nodeType===window.Node.TEXT_NODE)return e.textContent;if(e.nodeType===window.Node.ELEMENT_NODE){var t=e.outerHTML,n=e.innerHTML;return null==t?JSON.stringify(e.textContent):t.slice(0,t.indexOf(n))}return"Node(type="+e.nodeType}function kn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.placeholder,n=void 0===t?"":t,r=e.plugins,i=void 0===r?[]:r,a=A.a.enabled("slate:events")?function(){var e={},t=!0,n=!1,r=void 0;try{for(var o,i=$e[Symbol.iterator]();!(t=(o=i.next()).done);t=!0)e[o.value]=function(e,t,n){var r=gn(e);yn(r),n()}}catch(e){n=!0,r=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw r}}return e}():null,u=A.a.enabled("slate:batch-events")?function(){var e=null,t=null,n=[];function r(){wn("\n"+n.join("\n")),n.length=0}function o(o){0===n.length&&(e=new Date);var i=gn(o),a=new Date;n.push("- "+(a-e)+" - "+i),clearTimeout(t),t=setTimeout(r,bn)}var i={},a=!0,u=!1,c=void 0;try{for(var s,l=$e[Symbol.iterator]();!(a=(s=l.next()).done);a=!0)i[s.value]=function(e,t,n){o(e),n()}}catch(e){u=!0,c=e}finally{try{!a&&l.return&&l.return()}finally{if(u)throw c}}return i}():null,c=A.a.enabled("slate:mutations")?function(){var e=new window.MutationObserver(function(e){var t=Array.from(e).map(function(e){var t={};return En.forEach(function(n){var r=e[n];if(null!=r)if(r instanceof window.NodeList){if(0===r.length)return;t[n]=Array.from(r).map(xn).join(", ")}else r instanceof window.Node&&(r=xn(r)),t[n]=r}),t});On.apply(void 0,[t.length+" Mutations"].concat(st(t)))}),t=null;function n(n,r,o){var i=r.findDOMNode([]);if(i===t)return o();On("start"),e.observe(i,{childList:!0,characterData:!0,attributes:!0,subtree:!0,characterDataOldValue:!0}),t=i,o()}return{onComponentDidMount:n,onComponentDidUpdate:n,onComponentWillUnmount:function(n,r,o){On("stop"),e.disconnect(),t=null,o()}}}():null,s={decorateNode:function(){return[]},renderAnnotation:function(e){var t=e.attributes,n=e.children;return o.a.createElement("span",t,n)},renderBlock:function(e){var t=e.attributes,n=e.children;return o.a.createElement("div",it({},t,{style:{position:"relative"}}),n)},renderDecoration:function(e){var t=e.attributes,n=e.children;return o.a.createElement("span",t,n)},renderDocument:function(e){return e.children},renderEditor:function(e){return e.children},renderInline:function(e){var t=e.attributes,n=e.children;return o.a.createElement("span",it({},t,{style:{position:"relative"}}),n)},renderMark:function(e){var t=e.attributes,n=e.children;return o.a.createElement("span",t,n)}},l={commands:{reconcileNode:function(e,t){var n=e.value,r=n.document,o=n.selection,i=r.getPath(t.key),a=e.findDOMNode(i),u=r.getClosestBlock(i),c=t.text,s=a.textContent,l=u.nodes.last()===t,f=s.charAt(s.length-1);if(l&&"\n"===f&&(s=s.slice(0,-1)),c!==s){var p=o.moveAnchorTo(i,0).moveFocusTo(i,c.length);p=r.resolveRange(p),e.insertTextAtRange(p,s,t.marks)}},reconcileDOMNode:function(e,t){var n=t.parentElement.closest("[data-key]"),r=e.findNode(n);e.reconcileNode(r)}}},f=Pt();return[a,u,c,vn({plugins:[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return At.reduce(function(t,n){return n in e&&(t[n]=e[n]),t},{})}(e)].concat(st(i))}),{commands:{restoreDOM:function(e){e.setState({contentKey:e.state.contentKey+1})}}},Ke({placeholder:n,when:function(e,t){return"document"===t.object&&""===t.text&&1===t.nodes.size&&1===Array.from(t.texts()).length}}),s,l,f]}var Sn=A()("slate:editor"),Cn=function(e){function t(){var e,n,r;nt(this,t);for(var i=arguments.length,a=Array(i),u=0;u<i;u++)a[u]=arguments[u];return n=r=ut(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.state={value:r.props.defaultValue,contentKey:0},r.tmp={mounted:!1,change:null,resolves:0,updates:0,contentRef:o.a.createRef()},r.resolveController=Qe(function(){var e=arguments[5];P(r.tmp.resolves<5||r.tmp.resolves!==r.tmp.updates,"A Slate <Editor> component is re-resolving the `plugins`, `schema`, `commands`, `queries` or `placeholder` prop on each update, which leads to poor performance. This is often due to passing in a new references for these props with each render by declaring them inline in your render function. Do not do this! Declare them outside your render function, or memoize them instead."),r.tmp.resolves++;var t=e(it({},r.props,{editor:r,value:r.props.value||r.state.value}));r.controller=new C.e({plugins:[t],onChange:function(e){r.tmp.mounted?r.handleChange(e):r.tmp.change=e}},{controller:r,construct:!1}),r.controller.run("onConstruct")}),ut(r,n)}return at(t,e),rt(t,[{key:"componentDidMount",value:function(){this.tmp.mounted=!0,this.tmp.updates++,this.props.autoFocus&&this.focus(),this.tmp.change&&(this.handleChange(this.tmp.change),this.tmp.change=null)}},{key:"componentDidUpdate",value:function(){this.tmp.updates++,this.tmp.change&&(this.handleChange(this.tmp.change),this.tmp.change=null)}},{key:"componentWillUnmount",value:function(){this.tmp.mounted=!1}},{key:"render",value:function(){var e=this;Sn("render",this);var t=this.props,n=t.commands,r=t.placeholder,i=t.plugins,a=t.queries,u=t.schema;this.resolveController(i,u,n,a,r,kn);var c=this.props,s=c.options,l=c.readOnly,f=c.value,p=this.state.value,d=f||p,h=this.state.contentKey;this.controller.setReadOnly(l),this.controller.setValue(d,s);var m=this.props,v=m.autoCorrect,g=m.className,y=m.id,b=m.role,w=m.spellCheck,O=m.tabIndex,E=m.style,x=m.tagName,k=o.a.createElement(Nt,{ref:this.tmp.contentRef,autoCorrect:v,className:g,contentKey:h,editor:this,id:y,onEvent:function(t,n){return e.run(t,n)},readOnly:l,role:b,spellCheck:w,style:E,tabIndex:O,tagName:x});return this.controller.run("renderEditor",it({},this.props,{editor:this,children:k}))}},{key:"handleChange",value:function(e){var t=this.props.onChange;this.state.value&&this.setState({value:e.value}),t(e)}},{key:"applyOperation",value:function(){var e;return(e=this.controller).applyOperation.apply(e,arguments)}},{key:"command",value:function(){var e;return(e=this.controller).command.apply(e,arguments)}},{key:"hasCommand",value:function(){var e;return(e=this.controller).hasCommand.apply(e,arguments)}},{key:"hasQuery",value:function(){var e;return(e=this.controller).hasQuery.apply(e,arguments)}},{key:"normalize",value:function(){var e;return(e=this.controller).normalize.apply(e,arguments)}},{key:"query",value:function(){var e;return(e=this.controller).query.apply(e,arguments)}},{key:"registerCommand",value:function(){var e;return(e=this.controller).registerCommand.apply(e,arguments)}},{key:"registerQuery",value:function(){var e;return(e=this.controller).registerQuery.apply(e,arguments)}},{key:"run",value:function(){var e;return(e=this.controller).run.apply(e,arguments)}},{key:"withoutNormalizing",value:function(){var e;return(e=this.controller).withoutNormalizing.apply(e,arguments)}},{key:"call",value:function(){var e;return(e=this.controller).call.apply(e,arguments)}},{key:"change",value:function(){var e;return(e=this.controller).change.apply(e,arguments)}},{key:"onChange",value:function(){var e;return(e=this.controller).onChange.apply(e,arguments)}},{key:"applyOperations",value:function(){var e;return(e=this.controller).applyOperations.apply(e,arguments)}},{key:"setOperationFlag",value:function(){var e;return(e=this.controller).setOperationFlag.apply(e,arguments)}},{key:"getFlag",value:function(){var e;return(e=this.controller).getFlag.apply(e,arguments)}},{key:"unsetOperationFlag",value:function(){var e;return(e=this.controller).unsetOperationFlag.apply(e,arguments)}},{key:"withoutNormalization",value:function(){var e;return(e=this.controller).withoutNormalization.apply(e,arguments)}},{key:"operations",get:function(){return this.controller.operations}},{key:"readOnly",get:function(){return this.controller.readOnly}},{key:"value",get:function(){return this.controller.value}},{key:"editor",get:function(){return this.controller.editor}},{key:"schema",get:function(){Object(je.a)(!1,"As of Slate 0.42, the `editor.schema` property no longer exists, and its functionality has been folded into the editor itself. Use the `editor` instead.")}},{key:"stack",get:function(){Object(je.a)(!1,"As of Slate 0.42, the `editor.stack` property no longer exists, and its functionality has been folded into the editor itself. Use the `editor` instead.")}}]),t}(o.a.Component);Cn.propTypes=it({autoCorrect:S.a.bool,autoFocus:S.a.bool,className:S.a.string,defaultValue:_.value,id:S.a.string,onChange:S.a.func,options:S.a.object,placeholder:S.a.any,plugins:S.a.array,readOnly:S.a.bool,role:S.a.string,schema:S.a.object,spellCheck:S.a.bool,style:S.a.object,tabIndex:S.a.number,value:_.value},$e.reduce(function(e,t){return e[t]=S.a.func,e},{})),Cn.defaultProps={autoFocus:!1,autoCorrect:!0,onChange:function(){},options:{},placeholder:"",plugins:[],readOnly:!1,schema:{},spellCheck:!0};var jn=n(803),_n=n(647),In=n.n(_n),Tn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nn=new Ce.Record({object:"string",text:""}),An={deserialize:function(e){if(e.tagName&&"br"===e.tagName.toLowerCase())return{object:"text",text:"\n",marks:[]};if("#text"===e.nodeName){if(e.nodeValue&&e.nodeValue.match(/<!--.*?-->/))return;return{object:"text",text:e.nodeValue,marks:[]}}},serialize:function(e,t){if("string"===e.object)return t.split("\n").reduce(function(e,t,n){return 0!==n&&e.push(o.a.createElement("br",{key:n})),e.push(t),e},[])}};function Pn(e){if("undefined"==typeof DOMParser)throw new Error("The native `DOMParser` global which the `Html` serializer uses by default is not present in this environment. You must supply the `options.parseHtml` function instead.");return(new DOMParser).parseFromString(e,"text/html").body||window.document.createElement("body")}var Dn=function(){var e=this;this.deserialize=function(t){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).toJSON,r=void 0!==n&&n,o=e.defaultBlock,i=(0,e.parseHtml)(t),a=Array.from(i.childNodes),u=e.deserializeElements(a);0===(u=u.reduce(function(e,t,n,r){if("block"===t.object)return e.push(t),e;if(n>0&&"block"!==r[n-1].object)return e[e.length-1].nodes.push(t),e;var i=Tn({object:"block",data:{}},o,{nodes:[t]});return e.push(i),e},[])).length&&(u=[Tn({object:"block",data:{}},o,{nodes:[{object:"text",text:"",marks:[]}]})]);var c={object:"value",document:{object:"document",data:{},nodes:u}};return r?c:C.n.fromJSON(c)},this.deserializeElements=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=[];return t.filter(e.cruftNewline).forEach(function(t){var r=e.deserializeElement(t);switch(In()(r)){case"array":n=n.concat(r);break;case"object":n.push(r)}}),n},this.deserializeElement=function(t){var n=void 0;t.tagName||(t.tagName="");var r=function(t){switch("[object NodeList]"===Object.prototype.toString.call(t)&&(t=Array.from(t)),In()(t)){case"array":return e.deserializeElements(t);case"object":return e.deserializeElement(t);case"null":case"undefined":return;default:throw new Error('The `next` argument was called with invalid children: "'+t+'".')}},o=!0,i=!1,a=void 0;try{for(var u,c=e.rules[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var s=u.value;if(s.deserialize){var l=s.deserialize(t,r),f=In()(l);if("array"!==f&&"object"!==f&&"null"!==f&&"undefined"!==f)throw new Error('A rule returned an invalid deserialized representation: "'+n+'".');if(void 0!==l){if(null===l)return null;"block"===(n="mark"===l.object?e.deserializeMark(l):l).object||"inline"===n.object?(n.data=n.data||{},n.nodes=n.nodes||[]):"text"===n.object&&(n.marks=n.marks||[],n.text=n.text||"");break}}}}catch(e){i=!0,a=e}finally{try{!o&&c.return&&c.return()}finally{if(i)throw a}}return n||r(t.childNodes)},this.deserializeMark=function(t){var n=t.type,r=t.data;return t.nodes.reduce(function(t,o){var i=function t(o){return"mark"===o.object?e.deserializeMark(o):("text"===o.object?(o.marks=o.marks||[],o.marks.push({type:n,data:r})):o.nodes&&(o.nodes=o.nodes.map(t)),o)}(o);return Array.isArray(i)?t.concat(i):(t.push(i),t)},[])},this.serialize=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.document.nodes.map(e.serializeNode).filter(function(e){return e});return!1===n.render?r:Object(jn.renderToStaticMarkup)(o.a.createElement("body",null,r)).slice(6,-7)},this.serializeNode=function(t){if("text"===t.object){var n=new Nn({text:t.text}),r=e.serializeString(n);return t.marks.reduce(function(t,n){var r=!0,o=!1,i=void 0;try{for(var a,u=e.rules[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=a.value;if(c.serialize){var s=c.serialize(n,t);if(null===s)return;if(s)return Ln(s)}}}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}throw new Error('No serializer defined for mark of type "'+n.type+'".')},r)}var o=t.nodes.map(e.serializeNode),i=!0,a=!1,u=void 0;try{for(var c,s=e.rules[Symbol.iterator]();!(i=(c=s.next()).done);i=!0){var l=c.value;if(l.serialize){var f=l.serialize(t,o);if(null===f)return;if(f)return Ln(f)}}}catch(e){a=!0,u=e}finally{try{!i&&s.return&&s.return()}finally{if(a)throw u}}throw new Error('No serializer defined for node of type "'+t.type+'".')},this.serializeString=function(t){var n=!0,r=!1,o=void 0;try{for(var i,a=e.rules[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var u=i.value;if(u.serialize){var c=u.serialize(t,t.text);if(c)return c}}}catch(e){r=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw o}}},this.cruftNewline=function(e){return!("#text"===e.nodeName&&"\n"===e.nodeValue)}},Mn=0;function Ln(e){return o.a.cloneElement(e,{key:Mn++})}var Rn=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Dn.call(this);var n=t.defaultBlock,r=void 0===n?"paragraph":n,o=t.parseHtml,i=void 0===o?Pn:o,a=t.rules,u=void 0===a?[]:a;r=C.i.createProperties(r),this.rules=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(u),[An]),this.defaultBlock=r,this.parseHtml=i},Fn=(n(919),n(70)),Bn=n.n(Fn),zn=function(e){var t=document.getElementById("wprm-admin-modal-toolbar-container");return t?Bn.a.createPortal(o.a.createElement("div",{className:"wprm-admin-modal-toolbar",onMouseDown:function(e){e.preventDefault()}},e.children),t):null},Un=n(43),qn=function(e){return o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button",onMouseDown:function(t){t.preventDefault(),e.action()}},o.a.createElement(Un.a,{type:e.type,title:e.title}))},Wn=n(438),Hn=function(e){return o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button",onMouseDown:function(t){t.preventDefault(),e.richText.editor.insertText(e.character)}},o.a.createElement(Wn.a,{content:e.title},o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button-character"},e.character)))},Vn=function(e){var t=e.richText.hasInline("code"),n=e.richText.editor;return o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button".concat(t?" wprm-admin-modal-toolbar-button-active":""),onMouseDown:function(e){if(e.preventDefault(),t)n.unwrapInline("code");else{if(!n.value.selection.isExpanded){var r=window.prompt(Object(u.a)("HTML or Shortcode:"));r&&n.insertText(r).moveFocusBackward(r.length)}n.wrapInline({type:"code"}),n.moveToEnd()}}},o.a.createElement(Un.a,{type:"code",title:t?Object(u.a)("Remove HTML or Shortcode"):Object(u.a)("Insert HTML or Shortcode")}))},Gn=function(e){var t=e.richText.hasInline("link"),n=e.richText.editor;return o.a.createElement(r.Fragment,null,t?o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button wprm-admin-modal-toolbar-button-active",onMouseDown:function(e){e.preventDefault(),n.unwrapInline("link")}},o.a.createElement(Un.a,{type:"unlink",title:Object(u.a)("Remove Link")})):o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button",onMouseDown:function(e){e.preventDefault();var t=window.prompt(Object(u.a)("Enter the URL of the link:"));t&&(n.value.selection.isExpanded||n.insertText(t).moveFocusBackward(t.length),n.wrapInline({type:"link",data:{href:t}}),n.moveToEnd())}},o.a.createElement(Un.a,{type:"link",title:t?Object(u.a)("Edit Link"):Object(u.a)("Add Link")})))},Jn=function(e){var t=e.richText.hasMark(e.type);return o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button".concat(t?" wprm-admin-modal-toolbar-button-active":""),onMouseDown:function(t){t.preventDefault(),e.richText.editor.toggleMark(e.type)}},o.a.createElement(Un.a,{type:e.type,title:e.title}))},Zn=function(e){return o.a.createElement("span",{className:"wprm-admin-modal-toolbar-spacer"})},Yn=function(e){return{href:e.data.get("href"),newTab:e.data.get("newTab"),noFollow:e.data.get("noFollow")}},Kn=function(e,t){var n=Yn(t),r=window.prompt(Object(u.a)("Enter the URL of the link:"),n.href);r?(n.href=r,e.setNodeByKey(t.key,{data:n})):""===r&&e.unwrapInline("link")},Xn=function(e,t,n){var r=Yn(t);r[n]=!r[n],e.setNodeByKey(t.key,{data:r})},Qn=function(e){var t=e.richText.editor,n=e.richText.state.value.inlines.find(function(e){return"link"===e.type});if(!n)return null;var r=Yn(n);return o.a.createElement("div",{className:"wprm-admin-modal-toolbar-link"},o.a.createElement(Un.a,{type:"link",onClick:function(){return Kn(t,n)}}),o.a.createElement("span",{className:"wprm-admin-modal-toolbar-link-value",onMouseDown:function(){return Kn(t,n)}},r.href),o.a.createElement(Zn,null),o.a.createElement(Un.a,{type:r.newTab?"checkbox-checked":"checkbox-empty",onClick:function(){return Xn(t,n,"newTab")}}),o.a.createElement("span",{className:"wprm-admin-modal-toolbar-link-value",onMouseDown:function(){return Xn(t,n,"newTab")}},Object(u.a)("Open in new tab")),o.a.createElement(Zn,null),o.a.createElement(Un.a,{type:r.noFollow?"checkbox-checked":"checkbox-empty",onClick:function(){return Xn(t,n,"noFollow")}}),o.a.createElement("span",{className:"wprm-admin-modal-toolbar-link-value",onMouseDown:function(){return Xn(t,n,"noFollow")}},Object(u.a)("Use nofollow")))},$n=n(56),er=wprm_admin.endpoints.modal,tr=!1,nr=!1,rr={getSuggestions:function(e){return tr?(nr=e,new Promise(function(e){return e(!1)})):this.getSuggestionsDebounced(e)},getSuggestionsDebounced:function(e){var t=this;return tr=!0,$n.a.call("".concat(er,"/suggest"),"POST",e).then(function(e){if(nr){var n=nr;return nr=!1,t.getSuggestionsDebounced(n)}return tr=!1,e})}};function or(e){return(or="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 ir(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ar(e,t){return!t||"object"!==or(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ur(e){return(ur=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function cr(e,t){return(cr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var sr=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=ar(this,ur(t).call(this,e)),window.wprm_admin_modal_suggestions=window.wprm_admin_modal_suggestions||{},window.wprm_admin_modal_suggestions.hasOwnProperty(e.type)||(window.wprm_admin_modal_suggestions[e.type]={}),n.state={suggestions:[],loading:!1},n}var n,i,a;return function(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&&cr(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidMount",value:function(){var e=this.props.richText.getHtmlFromValue(this.props.value);this.updateSuggestions(e)}},{key:"componentDidUpdate",value:function(e){var t=this.props.richText.getHtmlFromValue(this.props.value);t!==this.props.richText.getHtmlFromValue(e.value)&&this.updateSuggestions(t)}},{key:"updateSuggestions",value:function(e){var t=this;window.wprm_admin_modal_suggestions[this.props.type].hasOwnProperty(e)?this.setState({suggestions:window.wprm_admin_modal_suggestions[this.props.type][e]}):(this.setState({loading:!0}),rr.getSuggestions({type:this.props.type,search:e}).then(function(n){n&&(window.wprm_admin_modal_suggestions[t.props.type][e]=n.suggestions,t.setState({suggestions:n.suggestions,loading:!1}))}))}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"wprm-admin-modal-toolbar-suggest"},this.state.loading||0!==this.state.suggestions.length?o.a.createElement(r.Fragment,null,o.a.createElement("strong",null,Object(u.a)("Suggestions:")),this.state.loading?o.a.createElement(p.a,null):o.a.createElement(r.Fragment,null,this.state.suggestions.map(function(t,n){return o.a.createElement("span",{className:"wprm-admin-modal-toolbar-suggestion",onMouseDown:function(n){n.preventDefault();var r=e.props.richText.getValueFromHtml(t.name);e.props.richText.onChange({value:r})},key:n},o.a.createElement("span",{className:"wprm-admin-modal-toolbar-suggestion-text"},t.name," (",t.count,")"))}))):o.a.createElement("strong",null,Object(u.a)("No suggestions found.")))}}])&&ir(n.prototype,i),a&&ir(n,a),t}(),lr=function(e){var t={visibility:"hidden"},n=!1,r=!1;switch(e.type){case"no-styling":n=!0;break;case"no-link":r=!0;break;case"equipment":case"ingredient":r=!0}return o.a.createElement(zn,null,e.richText.hasInline("link")&&o.a.createElement(Qn,{richText:e.richText}),("ingredient"===e.type||"equipment"===e.type)&&o.a.createElement(sr,{type:e.type,richText:e.richText,value:e.value}),o.a.createElement("div",{className:"wprm-admin-modal-toolbar-buttons"},o.a.createElement("span",{style:n?t:null},o.a.createElement(Jn,{richText:e.richText,type:"bold",title:Object(u.a)("Bold")}),o.a.createElement(Jn,{richText:e.richText,type:"italic",title:Object(u.a)("Italic")}),o.a.createElement(Jn,{richText:e.richText,type:"underline",title:Object(u.a)("Underline")}),o.a.createElement(Zn,null),o.a.createElement(Jn,{richText:e.richText,type:"subscript",title:Object(u.a)("Subscript")}),o.a.createElement(Jn,{richText:e.richText,type:"superscript",title:Object(u.a)("Superscript")})),o.a.createElement(Zn,null),o.a.createElement("span",{style:r?t:null},o.a.createElement(Gn,{richText:e.richText})),o.a.createElement(Zn,null),o.a.createElement(Vn,{richText:e.richText}),o.a.createElement(qn,{type:"adjustable",title:Object(u.a)("Adjustable Shortcode"),action:function(){e.richText.editor.wrapText("[adjustable]","[/adjustable]"),e.richText.editor.moveToEnd()}}),o.a.createElement(qn,{type:"clock",title:Object(u.a)("Timer Shortcode"),action:function(){e.richText.editor.wrapText("[timer minutes=0]","[/timer]"),e.richText.editor.moveToEnd()}}),o.a.createElement(Zn,null),o.a.createElement(Hn,{richText:e.richText,character:"½"}),o.a.createElement(Hn,{richText:e.richText,character:"⅓"}),o.a.createElement(Hn,{richText:e.richText,character:"⅔"}),o.a.createElement(Hn,{richText:e.richText,character:"¼"}),o.a.createElement(Hn,{richText:e.richText,character:"¾"}),o.a.createElement(Hn,{richText:e.richText,character:"⅕"}),o.a.createElement(Hn,{richText:e.richText,character:"⅙"}),o.a.createElement(Hn,{richText:e.richText,character:"⅐"}),o.a.createElement(Hn,{richText:e.richText,character:"⅛"}),o.a.createElement(Zn,null),o.a.createElement(Hn,{richText:e.richText,character:"°"})))},fr={p:"paragraph"},pr={a:"link","wprm-code":"code"},dr={em:"italic",i:"italic",strong:"bold",b:"bold",u:"underline",sub:"subscript",sup:"superscript"},hr=[{deserialize:function(e,t){var n=fr[e.tagName.toLowerCase()];if(n)return{object:"block",type:n,data:{className:e.getAttribute("class")},nodes:t(e.childNodes)}},serialize:function(e,t){if("block"==e.object)switch(e.type){case"paragraph":return o.a.createElement("p",{className:e.data.get("className")},t)}}},{deserialize:function(e,t){var n=pr[e.tagName.toLowerCase()];if(n)switch(n){case"link":return{object:"inline",type:n,data:{className:e.getAttribute("class"),href:e.getAttribute("href"),newTab:"_blank"===e.getAttribute("target"),noFollow:!(!e.getAttribute("rel")||!e.getAttribute("rel").includes("nofollow"))},nodes:t(e.childNodes)};case"code":return{object:"inline",type:n,data:{},nodes:t([document.createTextNode(e.innerHTML)])}}},serialize:function(e,t){if("inline"==e.object)switch(e.type){case"link":return o.a.createElement("a",{className:e.data.get("className"),href:e.data.get("href"),target:e.data.get("newTab")?"_blank":null,rel:e.data.get("noFollow")?"nofollow":null},t);case"code":return o.a.createElement("wprm-code",null,t)}}},{deserialize:function(e,t){var n=dr[e.tagName.toLowerCase()];if(n)return{object:"mark",type:n,nodes:t(e.childNodes)}},serialize:function(e,t){if("mark"==e.object)switch(e.type){case"bold":return o.a.createElement("strong",null,t);case"italic":return o.a.createElement("em",null,t);case"underline":return o.a.createElement("u",null,t);case"subscript":return o.a.createElement("sub",null,t);case"superscript":return o.a.createElement("sup",null,t)}}}];function mr(e){return(mr="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 vr(){return(vr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function gr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function yr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function br(e){return(br=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function wr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Or(e,t){return(Or=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Er=Object(Re.isKeyHotkey)("enter"),xr=Object(Re.isKeyHotkey)("mod+b"),kr=Object(Re.isKeyHotkey)("mod+i"),Sr=Object(Re.isKeyHotkey)("mod+u"),Cr=new Rn({rules:hr}),jr=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==mr(t)&&"function"!=typeof t?wr(e):t}(this,br(t).call(this,e))).state={value:n.getValueFromHtml(e.value)},e.singleLine?n.schema={document:{nodes:[{match:{type:"paragraph"},min:1,max:1}]}}:n.schema=null,n.getValueFromHtml=n.getValueFromHtml.bind(wr(n)),n.onChange=n.onChange.bind(wr(n)),n.onCopy=n.onCopy.bind(wr(n)),n.onCut=n.onCut.bind(wr(n)),n.onPaste=n.onPaste.bind(wr(n)),n.onKeyDown=n.onKeyDown.bind(wr(n)),n.renderBlock=n.renderBlock.bind(wr(n)),n.renderInline=n.renderInline.bind(wr(n)),n.renderMark=n.renderMark.bind(wr(n)),n.hasMark=n.hasMark.bind(wr(n)),n.hasInline=n.hasInline.bind(wr(n)),n}var n,i,a;return function(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&&Or(e,t)}(t,r["Component"]),n=t,(i=[{key:"getValueFromHtml",value:function(e){return Cr.deserialize(e)}},{key:"getHtmlFromValue",value:function(e){var t=Cr.serialize(e);return this.props.singleLine&&(t=t.replace(/^<p>(.*)<\/p>$/gm,"$1")),t}},{key:"onChange",value:function(e){var t=e.value,n=this.getHtmlFromValue(this.state.value),r=this.getHtmlFromValue(t);n!==r&&this.props.onChange(r),this.setState({value:t})}},{key:"onCopy",value:function(e,t,n){var r=this;nn(e,t,function(){if(e.clipboardData&&e.clipboardData.setData&&!ge){var n=r.getHtmlFromValue(t.value);e.clipboardData.setData("text/html",n)}})}},{key:"onCut",value:function(e,t,n){var r=this;nn(e,t,function(){if(e.clipboardData&&e.clipboardData.setData&&!ge){var n=r.getHtmlFromValue(t.value);e.clipboardData.setData("text/html",n)}var o,i=t.value,a=i.document,u=i.selection,c=u.end;if(u.isCollapsed){var s=!0,l=!1,f=void 0;try{for(var p,d=a.ancestors(c.path)[Symbol.iterator]();!(s=(p=d.next()).done);s=!0){var h=gr(p.value,2),m=h[0],v=h[1];if(t.isVoid(m)){o=v;break}}}catch(e){l=!0,f=e}finally{try{s||null==d.return||d.return()}finally{if(l)throw f}}}o?t.removeNodeByKey(o):t.delete()})}},{key:"onPaste",value:function(e,t,n){var r=ln(e);if("html"!==r.type)return n();var o=Cr.deserialize(r.html).document;t.insertFragment(o)}},{key:"onKeyDown",value:function(e,t,n){if(this.props.onKeyDown&&this.props.onKeyDown(e),this.props.singleLine&&Er(e))e.preventDefault();else{var r;if(xr(e))r="bold";else if(kr(e))r="italic";else{if(!Sr(e))return n();r="underline"}e.preventDefault(),t.toggleMark(r)}}},{key:"render",value:function(){var e=this,t=this.props.toolbar?this.props.toolbar:"all";return o.a.createElement(r.Fragment,null,this.state.value.selection.isFocused&&o.a.createElement(lr,{richText:this,value:this.state.value,type:t}),o.a.createElement(Cn,{spellCheck:!0,className:"wprm-admin-modal-field-richtext".concat(this.props.className?" ".concat(this.props.className):""),value:this.state.value,placeholder:this.props.placeholder,onChange:this.onChange,onPaste:this.onPaste,onCopy:this.onCopy,onCut:this.onCut,renderBlock:this.renderBlock,renderInline:this.renderInline,renderMark:this.renderMark,onKeyDown:this.onKeyDown,tabIndex:0,ref:function(t){return e.editor=t},schema:this.schema}))}},{key:"renderBlock",value:function(e,t,n){switch(e.node.type){case"paragraph":return this.props.singleLine?o.a.createElement("div",{className:"wprm-admin-modal-field-richtext-singleline"},e.children):o.a.createElement("p",vr({},e.attributes,{className:e.node.data.get("className")}),e.children);default:return n()}}},{key:"renderInline",value:function(e,t,n){switch(e.node.type){case"link":return o.a.createElement("a",vr({},e.attributes,{href:e.node.data.get("href"),target:e.node.data.get("newTab")?"_blank":null,rel:e.node.data.get("noFollow")?"nofollow":null}),e.children);case"code":return o.a.createElement("span",{style:{fontFamily:"monospace"}},e.children);default:return n()}}},{key:"renderMark",value:function(e,t,n){var r=e.mark,i=e.attributes;switch(r.type){case"bold":return o.a.createElement("strong",i,e.children);case"italic":return o.a.createElement("em",i,e.children);case"underline":return o.a.createElement("u",i,e.children);case"subscript":return o.a.createElement("sub",i,e.children);case"superscript":return o.a.createElement("sup",i,e.children);default:return n()}}},{key:"hasMark",value:function(e){return this.state.value.activeMarks.some(function(t){return t.type===e})}},{key:"hasInline",value:function(e){return this.state.value.inlines.some(function(t){return t.type===e})}}])&&yr(n.prototype,i),a&&yr(n,a),t}(),_r=function(e){var t=wprm_admin_modal.options.author.find(function(t){return t.value===e.author.display});return o.a.createElement(r.Fragment,null,o.a.createElement(h.a,{id:"type",label:Object(u.a)("Recipe Type"),help:Object(u.a)("Make sure to pick the right recipe type to ensure we include the correct metadata.")},o.a.createElement(x.a,{id:"type",options:[{value:"food",label:Object(u.a)("Food Recipe")},{value:"howto",label:Object(u.a)("How-to Instructions")},{value:"other",label:Object(u.a)("Other (no metadata)")}],value:e.type,onChange:function(t){e.onRecipeChange({type:t})}})),o.a.createElement(h.a,{id:"name",label:Object(u.a)("Name")},o.a.createElement(E.a,{name:"recipe-name",placeholder:Object(u.a)("Recipe Name"),value:e.name,onChange:function(t){e.onRecipeChange({name:t})}})),o.a.createElement(h.a,{id:"summary",label:"howto"===e.type?Object(u.a)("Description"):Object(u.a)("Summary")},o.a.createElement(jr,{placeholder:Object(u.a)("Short description of this recipe..."),value:e.summary,onChange:function(t){e.onRecipeChange({summary:t})}})),t&&"same"===t.actual?null:o.a.createElement(h.a,{id:"author",label:Object(u.a)("Author")},o.a.createElement(O.a,{options:wprm_admin_modal.options.author.filter(function(e){return"same"!==e.actual}),value:e.author.display,onChange:function(t){e.onRecipeChange({author_display:t})},width:300})),t&&"custom"===t.actual&&o.a.createElement(r.Fragment,null,o.a.createElement(h.a,{id:"author-name",label:Object(u.a)("Name")},o.a.createElement(E.a,{name:"author-name",placeholder:Object(u.a)("Author Name"),value:e.author.name,onChange:function(t){e.onRecipeChange({author_name:t})}})),o.a.createElement(h.a,{id:"author-link",label:Object(u.a)("Link")},o.a.createElement(E.a,{name:"author-link",placeholder:"https://bootstrapped.ventures",type:"url",value:e.author.link,onChange:function(t){e.onRecipeChange({author_link:t})}}))),o.a.createElement(h.a,{id:"servings",label:"howto"===e.type?Object(u.a)("Yield"):Object(u.a)("Servings")},o.a.createElement(E.a,{placeholder:"4",type:"number",value:0!=e.servings.amount?e.servings.amount:"",onChange:function(t){e.onRecipeChange({servings:t})}}),o.a.createElement(E.a,{name:"servings-unit",placeholder:"howto"===e.type?Object(u.a)("candles"):Object(u.a)("people"),value:e.servings.unit,onChange:function(t){e.onRecipeChange({servings_unit:t})}})),o.a.createElement(h.a,{id:"cost",label:Object(u.a)("Estimated Cost"),help:"howto"===e.type?Object(u.a)("The estimated cost of the materials consumed when performing instructions. Used in the metadata."):null},o.a.createElement(E.a,{name:"cost",placeholder:"$5",value:e.cost,onChange:function(t){e.onRecipeChange({cost:t})}})))},Ir=(n(920),function(e){var t=parseInt(e.value.time),n=0,r=0,i=0;return t>0&&(n=Math.floor(t/24/60),r=Math.floor(t/60%24),i=Math.floor(t%60)),o.a.createElement("div",{className:"wprm-admin-modal-field-time"},o.a.createElement("div",{className:"wprm-admin-modal-field-time-parts"},o.a.createElement("input",{type:"number",value:0<n?""+n:"",onChange:function(t){var n=parseInt(t.target.value);n=isNaN(n)?0:n;var o=1440*Math.max(0,n)+60*r+i;e.onChange(o)}})," ",Object(u.a)("days"),o.a.createElement("input",{type:"number",value:0<r?""+r:"",onChange:function(t){var r=parseInt(t.target.value);r=isNaN(r)?0:r;var o=1440*n+60*Math.max(0,r)+i;e.onChange(o)}})," ",Object(u.a)("hours"),o.a.createElement("input",{type:"number",value:0<i?""+i:e.value.zero?"0":"",onChange:function(t){var o=parseInt(t.target.value);o=isNaN(o)?0:o;var i=1440*n+60*r+Math.max(0,o);e.onChange(i)}})," ",Object(u.a)("minutes")),0===t&&e.hasOwnProperty("onChangeZero")&&o.a.createElement("div",{className:"wprm-admin-modal-field-time-none"},o.a.createElement("input",{id:"wprm-admin-modal-field-time-none-".concat(e.id),type:"checkbox",checked:e.value.zero,onChange:function(t){e.onChangeZero(t.target.checked)}})," ",o.a.createElement("label",{htmlFor:"wprm-admin-modal-field-time-none-".concat(e.id)},Object(u.a)('Show "0" in template'))))}),Tr=function(e){var t=Math.max(0,parseInt(e.prep.time))+Math.max(0,parseInt(e.cook.time))+Math.max(0,parseInt(e.custom.time));return o.a.createElement(r.Fragment,null,o.a.createElement(h.a,{id:"prep-time",label:Object(u.a)("Prep Time")},o.a.createElement(Ir,{id:"prep",value:e.prep,onChange:function(t){e.onRecipeChange({prep_time:t})},onChangeZero:function(t){e.onRecipeChange({prep_time_zero:t})}})),o.a.createElement(h.a,{id:"cook-time",label:"howto"===e.type?Object(u.a)("Active Time"):Object(u.a)("Cook Time")},o.a.createElement(Ir,{id:"cook",value:e.cook,onChange:function(t){e.onRecipeChange({cook_time:t})},onChangeZero:function(t){e.onRecipeChange({cook_time_zero:t})}})),o.a.createElement(h.a,{id:"custom-time-label",label:Object(u.a)("Custom Time Label"),help:Object(u.a)("Optional extra time field that you can label yourself. Examples: Resting Time, Baking Time")},o.a.createElement(E.a,{name:"custom-time-label",placeholder:Object(u.a)("Resting Time"),value:e.customLabel,onChange:function(t){e.onRecipeChange({custom_time_label:t})}})),o.a.createElement(h.a,{id:"custom-time",label:Object(u.a)("Custom Time")},o.a.createElement(Ir,{id:"custom",value:e.custom,onChange:function(t){e.onRecipeChange({custom_time:t})},onChangeZero:function(t){e.onRecipeChange({custom_time_zero:t})}})),o.a.createElement(h.a,{id:"total-time",label:Object(u.a)("Total Time")},o.a.createElement(Ir,{id:"total",value:e.total,onChange:function(t){e.onRecipeChange({total_time:t})}}),t!==parseInt(e.total.time)&&o.a.createElement("div",null,o.a.createElement("a",{href:"#",onClick:function(n){n.preventDefault(),e.onRecipeChange({total_time:t})}},Object(u.a)("Recalculate Total Time")))))},Nr=n(645);function Ar(e){return(Ar="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 Pr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Mr(e,t){return!t||"object"!==Ar(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Lr(e){return(Lr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Rr(e,t){return(Rr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Fr=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Mr(this,Lr(t).apply(this,arguments))}var n,i,a;return function(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&&Rr(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e){return JSON.stringify(this.props.tags)!==JSON.stringify(e.tags)}},{key:"render",value:function(){var e=this,t=Object.keys(wprm_admin_modal.categories);return o.a.createElement(r.Fragment,null,t.map(function(t,n){var r=wprm_admin_modal.categories[t],i=e.props.tags.hasOwnProperty(t)?e.props.tags[t]:[];return o.a.createElement(h.a,{id:t,label:r.label,help:r.hasOwnProperty("help")?r.help:null,key:n},o.a.createElement(Nr.a,{id:t,value:i,onChange:function(n){var r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Pr(e,t,n[t])})}return e}({},e.props.tags);r[t]=n,e.props.onRecipeChange({tags:r})},width:"450px"}))}))}}])&&Dr(n.prototype,i),a&&Dr(n,a),t}(),Br=(n(921),n(922),function(e){return e.modes?o.a.createElement("div",{className:"wprm-admin-modal-field-edit-mode-container"},e.modes.map(function(t,n){return o.a.createElement("a",{href:"#",className:"wprm-admin-modal-field-edit-mode".concat(t.id===e.mode?" wprm-admin-modal-field-edit-mode-selected":""),onClick:function(n){n.preventDefault(),e.onModeChange(t.id)},key:n},t.label)})):null}),zr=n(641),Ur=n.n(zr);function qr(){return(qr=Ur.a||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Wr(e,t){var n=Object(r.useState)(function(){return{inputs:t,result:e()}})[0],o=Object(r.useRef)(n),i=Boolean(t&&o.current.inputs&&function(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(t,o.current.inputs))?o.current:{inputs:t,result:e()};return Object(r.useEffect)(function(){o.current=i},[i]),i.result}var Hr=Wr,Vr=function(e,t){return Wr(function(){return e},t)},Gr=n(804),Jr=n.n(Gr);function Zr(e,t){e.prototype=Jr()(t.prototype),e.prototype.constructor=e,e.__proto__=t}var Yr=n(773),Kr=function(){return Math.random().toString(36).substring(7).split("").join(".")},Xr={INIT:"@@redux/INIT"+Kr(),REPLACE:"@@redux/REPLACE"+Kr(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Kr()}};function Qr(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function $r(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n($r)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var o=e,i=t,a=[],u=a,c=!1;function s(){u===a&&(u=a.slice())}function l(){if(c)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(c)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var t=!0;return s(),u.push(e),function(){if(t){if(c)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,s();var n=u.indexOf(e);u.splice(n,1)}}}function p(e){if(!Qr(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,i=o(i,e)}finally{c=!1}for(var t=a=u,n=0;n<t.length;n++){(0,t[n])()}return e}return p({type:Xr.INIT}),(r={dispatch:p,subscribe:f,getState:l,replaceReducer:function(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");o=e,p({type:Xr.REPLACE})}})[Yr.a]=function(){var e,t=f;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function n(){e.next&&e.next(l())}return n(),{unsubscribe:t(n)}}})[Yr.a]=function(){return this},e},r}function eo(e,t){return function(){return t(e.apply(this,arguments))}}function to(e,t){if("function"==typeof e)return eo(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(e),r={},o=0;o<n.length;o++){var i=n[o],a=e[i];"function"==typeof a&&(r[i]=eo(a,t))}return r}function no(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ro(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}function oo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},i=t.map(function(e){return e(o)});return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){no(e,t,n[t])})}return e}({},n,{dispatch:r=ro.apply(void 0,i)(n.dispatch)})}}}var io=o.a.createContext(null);var ao=function(e){e()},uo=function(){return ao},co=null,so={notify:function(){}};var lo=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=so,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return Boolean(this.unsubscribe)},t.trySubscribe=function(){var e,t,n;this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=(e=uo(),t=[],n=[],{clear:function(){n=co,t=co},notify:function(){var r=t=n;e(function(){for(var e=0;e<r.length;e++)r[e]()})},get:function(){return n},subscribe:function(e){var r=!0;return n===t&&(n=t.slice()),n.push(e),function(){r&&t!==co&&(r=!1,n===t&&(n=t.slice()),n.splice(n.indexOf(e),1))}}}))},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=so)},e}(),fo=function(e){var t,n;function r(t){var n;n=e.call(this,t)||this;var r=t.store;n.notifySubscribers=n.notifySubscribers.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n));var o=new lo(r);return o.onStateChange=n.notifySubscribers,n.state={store:r,subscription:o},n.previousState=r.getState(),n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.componentDidMount=function(){this._isMounted=!0,this.state.subscription.trySubscribe(),this.previousState!==this.props.store.getState()&&this.state.subscription.notifyNestedSubs()},i.componentWillUnmount=function(){this.unsubscribe&&this.unsubscribe(),this.state.subscription.tryUnsubscribe(),this._isMounted=!1},i.componentDidUpdate=function(e){if(this.props.store!==e.store){this.state.subscription.tryUnsubscribe();var t=new lo(this.props.store);t.onStateChange=this.notifySubscribers,this.setState({store:this.props.store,subscription:t})}},i.notifySubscribers=function(){this.state.subscription.notifyNestedSubs()},i.render=function(){var e=this.props.context||io;return o.a.createElement(e.Provider,{value:this.state},this.props.children)},r}(r.Component);fo.propTypes={store:S.a.shape({subscribe:S.a.func.isRequired,dispatch:S.a.func.isRequired,getState:S.a.func.isRequired}),context:S.a.object,children:S.a.any};var po=fo;function ho(){return(ho=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function mo(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var vo=n(508),go=n.n(vo),yo=n(629),bo=n.n(yo),wo=n(805),Oo=[],Eo=[null,null];function xo(e,t){var n=e[1];return[t.payload,n+1]}var ko=function(){return[null,0]},So="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;function Co(e,t){void 0===t&&(t={});var n=t,i=n.getDisplayName,a=void 0===i?function(e){return"ConnectAdvanced("+e+")"}:i,u=n.methodName,c=void 0===u?"connectAdvanced":u,s=n.renderCountProp,l=void 0===s?void 0:s,f=n.shouldHandleStateChanges,p=void 0===f||f,d=n.storeKey,h=void 0===d?"store":d,m=n.withRef,v=void 0!==m&&m,g=n.forwardRef,y=void 0!==g&&g,b=n.context,w=void 0===b?io:b,O=mo(n,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"]);bo()(void 0===l,"renderCountProp is removed. render counting is built into the latest React Dev Tools profiling extension"),bo()(!v,"withRef is removed. To access the wrapped instance, use a ref on the connected component");bo()("store"===h,"storeKey has been removed and does not do anything. To use a custom Redux store for specific components, create a custom React context with React.createContext(), and pass the context object to React Redux's Provider and specific components like: <Provider context={MyContext}><ConnectedComponent context={MyContext} /></Provider>. You may also pass a {context : MyContext} option to connect");var E=w;return function(t){var n=t.displayName||t.name||"Component",i=a(n),u=ho({},O,{getDisplayName:a,methodName:c,renderCountProp:l,shouldHandleStateChanges:p,storeKey:h,displayName:i,wrappedComponentName:n,WrappedComponent:t}),s=O.pure;var f=s?r.useMemo:function(e){return e()};function d(n){var a=Object(r.useMemo)(function(){return[n.context,n.forwardedRef,mo(n,["context","forwardedRef"])]},[n]),c=a[0],s=a[1],l=a[2],d=Object(r.useMemo)(function(){return c&&c.Consumer&&Object(wo.isContextConsumer)(o.a.createElement(c.Consumer,null))?c:E},[c,E]),h=Object(r.useContext)(d),m=Boolean(n.store),v=Boolean(h)&&Boolean(h.store);bo()(m||v,'Could not find "store" in the context of "'+i+'". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to '+i+" in connect options.");var g=n.store||h.store,y=Object(r.useMemo)(function(){return function(t){return e(t.dispatch,u)}(g)},[g]),b=Object(r.useMemo)(function(){if(!p)return Eo;var e=new lo(g,m?null:h.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]},[g,m,h]),w=b[0],O=b[1],x=Object(r.useMemo)(function(){return m?h:ho({},h,{subscription:w})},[m,h,w]),k=Object(r.useReducer)(xo,Oo,ko),S=k[0][0],C=k[1];if(S&&S.error)throw S.error;var j=Object(r.useRef)(),_=Object(r.useRef)(l),I=Object(r.useRef)(),T=Object(r.useRef)(!1),N=f(function(){return I.current&&l===_.current?I.current:y(g.getState(),l)},[g,S,l]);So(function(){_.current=l,j.current=N,T.current=!1,I.current&&(I.current=null,O())}),So(function(){if(p){var e=!1,t=null,n=function(){if(!e){var n,r,o=g.getState();try{n=y(o,_.current)}catch(e){r=e,t=e}r||(t=null),n===j.current?T.current||O():(j.current=n,I.current=n,T.current=!0,C({type:"STORE_UPDATED",payload:{latestStoreState:o,error:r}}))}};w.onStateChange=n,w.trySubscribe(),n();return function(){if(e=!0,w.tryUnsubscribe(),t)throw t}}},[g,w,y]);var A=Object(r.useMemo)(function(){return o.a.createElement(t,ho({},N,{ref:s}))},[s,t,N]);return Object(r.useMemo)(function(){return p?o.a.createElement(d.Provider,{value:x},A):A},[d,A,x])}var m=s?o.a.memo(d):d;if(m.WrappedComponent=t,m.displayName=i,y){var v=o.a.forwardRef(function(e,t){return o.a.createElement(m,ho({},e,{forwardedRef:t}))});return v.displayName=i,v.WrappedComponent=t,go()(v,t)}return go()(m,t)}}var jo=Object.prototype.hasOwnProperty;function _o(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function Io(e,t){if(_o(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=0;o<n.length;o++)if(!jo.call(t,n[o])||!_o(e[n[o]],t[n[o]]))return!1;return!0}function To(e){return function(t,n){var r=e(t,n);function o(){return r}return o.dependsOnOwnProps=!1,o}}function No(e){return null!==e.dependsOnOwnProps&&void 0!==e.dependsOnOwnProps?Boolean(e.dependsOnOwnProps):1!==e.length}function Ao(e,t){return function(t,n){n.displayName;var r=function(e,t){return r.dependsOnOwnProps?r.mapToProps(e,t):r.mapToProps(e)};return r.dependsOnOwnProps=!0,r.mapToProps=function(t,n){r.mapToProps=e,r.dependsOnOwnProps=No(e);var o=r(t,n);return"function"==typeof o&&(r.mapToProps=o,r.dependsOnOwnProps=No(o),o=r(t,n)),o},r}}var Po=[function(e){return"function"==typeof e?Ao(e):void 0},function(e){return e?void 0:To(function(e){return{dispatch:e}})},function(e){return e&&"object"==typeof e?To(function(t){return to(e,t)}):void 0}];var Do=[function(e){return"function"==typeof e?Ao(e):void 0},function(e){return e?void 0:To(function(){return{}})}];function Mo(e,t,n){return ho({},n,e,t)}var Lo=[function(e){return"function"==typeof e?function(e){return function(t,n){n.displayName;var r,o=n.pure,i=n.areMergedPropsEqual,a=!1;return function(t,n,u){var c=e(t,n,u);return a?o&&i(c,r)||(r=c):(a=!0,r=c),r}}}(e):void 0},function(e){return e?void 0:function(){return Mo}}];function Ro(e,t,n,r){return function(o,i){return n(e(o,i),t(r,i),i)}}function Fo(e,t,n,r,o){var i,a,u,c,s,l=o.areStatesEqual,f=o.areOwnPropsEqual,p=o.areStatePropsEqual,d=!1;function h(o,d){var h,m,v=!f(d,a),g=!l(o,i);return i=o,a=d,v&&g?(u=e(i,a),t.dependsOnOwnProps&&(c=t(r,a)),s=n(u,c,a)):v?(e.dependsOnOwnProps&&(u=e(i,a)),t.dependsOnOwnProps&&(c=t(r,a)),s=n(u,c,a)):g?(h=e(i,a),m=!p(h,u),u=h,m&&(s=n(u,c,a)),s):s}return function(o,l){return d?h(o,l):(u=e(i=o,a=l),c=t(r,a),s=n(u,c,a),d=!0,s)}}function Bo(e,t){var n=t.initMapStateToProps,r=t.initMapDispatchToProps,o=t.initMergeProps,i=mo(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),a=n(e,i),u=r(e,i),c=o(e,i);return(i.pure?Fo:Ro)(a,u,c,e,i)}function zo(e,t,n){for(var r=t.length-1;r>=0;r--){var o=t[r](e);if(o)return o}return function(t,r){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function Uo(e,t){return e===t}var qo,Wo,Ho,Vo,Go,Jo,Zo,Yo,Ko,Xo,Qo,$o,ei,ti=(Ho=(Wo=void 0===qo?{}:qo).connectHOC,Vo=void 0===Ho?Co:Ho,Go=Wo.mapStateToPropsFactories,Jo=void 0===Go?Do:Go,Zo=Wo.mapDispatchToPropsFactories,Yo=void 0===Zo?Po:Zo,Ko=Wo.mergePropsFactories,Xo=void 0===Ko?Lo:Ko,Qo=Wo.selectorFactory,$o=void 0===Qo?Bo:Qo,function(e,t,n,r){void 0===r&&(r={});var o=r,i=o.pure,a=void 0===i||i,u=o.areStatesEqual,c=void 0===u?Uo:u,s=o.areOwnPropsEqual,l=void 0===s?Io:s,f=o.areStatePropsEqual,p=void 0===f?Io:f,d=o.areMergedPropsEqual,h=void 0===d?Io:d,m=mo(o,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),v=zo(e,Jo,"mapStateToProps"),g=zo(t,Yo,"mapDispatchToProps"),y=zo(n,Xo,"mergeProps");return Vo($o,ho({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:v,initMapDispatchToProps:g,initMergeProps:y,pure:a,areStatesEqual:c,areOwnPropsEqual:l,areStatePropsEqual:p,areMergedPropsEqual:h},m))});ei=Fn.unstable_batchedUpdates,ao=ei;var ni=function(e){var t=e.top,n=e.right,r=e.bottom,o=e.left;return{top:t,right:n,bottom:r,left:o,width:n-o,height:r-t,x:o,y:t,center:{x:(n+o)/2,y:(r+t)/2}}},ri=function(e,t){return{top:e.top-t.top,left:e.left-t.left,bottom:e.bottom+t.bottom,right:e.right+t.right}},oi=function(e,t){return{top:e.top+t.top,left:e.left+t.left,bottom:e.bottom-t.bottom,right:e.right-t.right}},ii={top:0,right:0,bottom:0,left:0},ai=function(e){var t=e.borderBox,n=e.margin,r=void 0===n?ii:n,o=e.border,i=void 0===o?ii:o,a=e.padding,u=void 0===a?ii:a,c=ni(ri(t,r)),s=ni(oi(t,i)),l=ni(oi(s,u));return{marginBox:c,borderBox:ni(t),paddingBox:s,contentBox:l,margin:r,border:i,padding:u}},ui=function(e){var t=e.slice(0,-2);if("px"!==e.slice(-2))return 0;var n=Number(t);return isNaN(n)&&Object(je.a)(!1),n},ci=function(e,t){var n,r,o=e.borderBox,i=e.border,a=e.margin,u=e.padding,c=(r=t,{top:(n=o).top+r.y,left:n.left+r.x,bottom:n.bottom+r.y,right:n.right+r.x});return ai({borderBox:c,border:i,margin:a,padding:u})},si=function(e,t){return void 0===t&&(t={x:window.pageXOffset,y:window.pageYOffset}),ci(e,t)},li=function(e,t){var n={top:ui(t.marginTop),right:ui(t.marginRight),bottom:ui(t.marginBottom),left:ui(t.marginLeft)},r={top:ui(t.paddingTop),right:ui(t.paddingRight),bottom:ui(t.paddingBottom),left:ui(t.paddingLeft)},o={top:ui(t.borderTopWidth),right:ui(t.borderRightWidth),bottom:ui(t.borderBottomWidth),left:ui(t.borderLeftWidth)};return ai({borderBox:e,margin:n,padding:r,border:o})},fi=function(e){var t=e.getBoundingClientRect(),n=window.getComputedStyle(e);return li(t,n)};function pi(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var di=function(e,t){var n;void 0===t&&(t=pi);var r,o=[],i=!1;return function(){for(var a=arguments.length,u=new Array(a),c=0;c<a;c++)u[c]=arguments[c];return i&&n===this&&t(u,o)?r:(r=e.apply(this,u),i=!0,n=this,o=u,r)}},hi=n(807),mi=n.n(hi),vi=n(648),gi=n.n(vi),yi=n(774),bi=n.n(yi),wi=function(e){var t=[],n=null,r=function(){for(var r=arguments.length,o=Array(r),i=0;i<r;i++)o[i]=arguments[i];t=o,n||(n=requestAnimationFrame(function(){n=null,e.apply(void 0,t)}))};return r.cancel=function(){n&&(cancelAnimationFrame(n),n=null)},r};n(808);function Oi(e){return-1!==e.message.indexOf("Invariant failed")}var Ei=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).onError=void 0,t.setOnError=function(e){t.onError=e},t.onFatalError=function(e){t.onError&&t.onError(),Oi(e)&&t.setState({})},t}Zr(t,e);var n=t.prototype;return n.componentDidMount=function(){window.addEventListener("error",this.onFatalError)},n.componentWillUnmount=function(){window.removeEventListener("error",this.onFatalError)},n.componentDidCatch=function(e){if(this.onFatalError(e),!Oi(e))throw e},n.render=function(){return this.props.children(this.setOnError)},t}(o.a.Component),xi={x:0,y:0},ki=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},Si=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},Ci=function(e,t){return e.x===t.x&&e.y===t.y},ji=function(e){return{x:0!==e.x?-e.x:0,y:0!==e.y?-e.y:0}},_i=function(e,t,n){var r;return void 0===n&&(n=0),(r={})[e]=t,r["x"===e?"y":"x"]=n,r},Ii=function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},Ti=function(e,t){return Math.min.apply(Math,t.map(function(t){return Ii(e,t)}))},Ni=function(e){return function(t){return{x:e(t.x),y:e(t.y)}}},Ai=function(e,t){return{top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}},Pi=function(e){return[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}]},Di=function(e,t){return t&&t.shouldClipSubject?function(e,t){var n=ni({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n}(t.pageMarginBox,e):ni(e)},Mi=function(e){var t=e.page,n=e.withPlaceholder,r=e.axis,o=e.frame,i=function(e,t,n){var r;return n&&n.increasedBy?qr({},e,((r={})[t.end]=e[t.end]+n.increasedBy[t.line],r)):e}(function(e,t){return t?Ai(e,t.scroll.diff.displacement):e}(t.marginBox,o),r,n);return{page:t,withPlaceholder:n,active:Di(i,o)}},Li=function(e,t){e.frame||Object(je.a)(!1);var n=e.frame,r=Si(t,n.scroll.initial),o=ji(r),i=qr({},n,{scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:o},max:n.scroll.max}});return qr({},e,{frame:i,subject:Mi({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i})})},Ri=function(e){},Fi=function(e){},Bi=function(e){var t=e.merge,n=e.destination;return n?n.droppableId:t?t.combine.droppableId:null};function zi(e){return mi()(e)}function Ui(e,t){if(e.findIndex)return e.findIndex(t);for(var n=0;n<e.length;n++)if(t(e[n]))return n;return-1}function qi(e,t){if(e.find)return e.find(t);var n=Ui(e,t);return-1!==n?e[n]:void 0}var Wi=di(function(e){return e.reduce(function(e,t){return e[t.descriptor.id]=t,e},{})}),Hi=di(function(e){return e.reduce(function(e,t){return e[t.descriptor.id]=t,e},{})}),Vi=di(function(e){return zi(e)}),Gi=di(function(e){return zi(e)}),Ji=function(e,t){return function(n){return e<=n&&n<=t}},Zi=function(e){var t=Ji(e.top,e.bottom),n=Ji(e.left,e.right);return function(e){return t(e.y)&&t(e.y)&&n(e.x)&&n(e.x)}},Yi=di(function(e,t){return Gi(t).filter(function(t){return e===t.descriptor.droppableId}).sort(function(e,t){return e.descriptor.index-t.descriptor.index})}),Ki={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},Xi={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},Qi=function(e,t){return e===Ki?"down"===t.vertical:"right"===t.horizontal},$i=function(e,t){return Boolean(t.wasDisplaced[e])},ea=function(e){var t=e.displaced,n=e.onLift,r=e.combineWith,o=e.displacedBy,i=Boolean(t[r]);return $i(r,n)?i?xi:ji(o.point):i?o.point:xi},ta=function(e,t,n){return n?e!==n.combine.draggableId?t:n.whenEntered:t},na=function(e){var t=e.pageBorderBoxCenterWithDroppableScrollChange,n=e.previousImpact,r=e.destination,o=e.insideDestinationWithoutDraggable,i=e.userDirection,a=e.onLift;if(!r.isCombineEnabled)return null;var u=r.axis,c=n.movement.map,s=n.movement.displacedBy,l=n.merge,f=qi(o,function(e){var n=e.descriptor.id,r=ea({displaced:c,onLift:a,combineWith:n,displacedBy:s});return function(e){var t=e.id,n=e.currentCenter,r=e.axis,o=e.borderBox,i=e.displaceBy,a=e.currentUserDirection,u=e.oldMerge,c=o[r.start]+i[r.line],s=o[r.end]+i[r.line],l=.666*o[r.size],f=ta(t,a,u),p=Qi(r,f),d=n[r.line];return p?Ji(c,c+l)(d):Ji(s-l,s)(d)}({id:n,currentCenter:t,axis:u,borderBox:e.page.borderBox,displaceBy:r,currentUserDirection:i,oldMerge:l})});return f?qr({},n,{destination:null,merge:{whenEntered:ta(f.descriptor.id,i,l),combine:{draggableId:f.descriptor.id,droppableId:r.descriptor.id}}}):null},ra=function(e){var t=Ji(e.top,e.bottom),n=Ji(e.left,e.right);return function(r){if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;var o=t(r.top)||t(r.bottom),i=n(r.left)||n(r.right);if(o&&i)return!0;var a=r.top<e.top&&r.bottom>e.bottom,u=r.left<e.left&&r.right>e.right;return!(!a||!u)||(a&&i||u&&o)}},oa=function(e){var t=Ji(e.top,e.bottom),n=Ji(e.left,e.right);return function(e){return t(e.top)&&t(e.bottom)&&n(e.left)&&n(e.right)}},ia=function(e){var t=e.target,n=e.destination,r=e.viewport,o=e.withDroppableDisplacement,i=e.isVisibleThroughFrameFn,a=o?function(e,t){var n=t.frame?t.frame.scroll.diff.displacement:xi;return Ai(e,n)}(t,n):t;return function(e,t,n){return!!t.subject.active&&n(t.subject.active)(e)}(a,n,i)&&function(e,t,n){return n(t)(e)}(a,r,i)},aa=function(e){return ia(qr({},e,{isVisibleThroughFrameFn:ra}))},ua=function(e){return ia(qr({},e,{isVisibleThroughFrameFn:oa}))},ca=function(e){var t=e.draggable,n=e.destination,r=e.previousImpact,o=e.viewport,i=e.onLift,a=e.forceShouldAnimate,u=t.descriptor.id,c=r.movement.map,s=function(e,t){var n=e.page.marginBox;if(!$i(e.descriptor.id,t))return n;var r={top:t.displacedBy.point.y,right:t.displacedBy.point.x,bottom:0,left:0};return ni(ri(n,r))}(t,i),l=aa({target:s,destination:n,viewport:o,withDroppableDisplacement:!0});return{draggableId:u,isVisible:l,shouldAnimate:function(e,t,n){return"boolean"==typeof e?e:!!t&&(!n||n.shouldAnimate)}(a,l,c[u])}},sa=di(function(e){return e.reduce(function(e,t){return e[t.draggableId]=t,e},{})}),la=di(function(e,t){var n=t[e.line];return{value:n,point:_i(e.line,n)}}),fa={displaced:[],map:{},displacedBy:{point:xi,value:0}},pa={movement:fa,destination:null,merge:null},da=di(function(e,t){return t.filter(function(t){return t.descriptor.id!==e.descriptor.id})}),ha=function(e){var t=e.pageBorderBoxCenter,n=e.draggable,r=e.draggables,o=e.droppables,i=e.previousImpact,a=e.viewport,u=e.userDirection,c=e.onLift,s=function(e){var t=e.target,n=e.droppables,r=qi(Vi(n),function(e){if(!e.isEnabled)return!1;var n=e.subject.active;return!!n&&Zi(n)(t)});return r?r.descriptor.id:null}({target:t,droppables:o});if(!s)return pa;var l,f,p=o[s],d=Yi(p.descriptor.id,r),h=da(n,d),m=(l=t,(f=p.frame)?ki(l,f.scroll.diff.value):l),v=na({pageBorderBoxCenterWithDroppableScrollChange:m,previousImpact:i,destination:p,insideDestinationWithoutDraggable:h,userDirection:u,onLift:c});return v||function(e){var t=e.pageBorderBoxCenterWithDroppableScrollChange,n=e.draggable,r=e.destination,o=e.insideDestinationWithoutDraggable,i=e.previousImpact,a=e.viewport,u=e.userDirection,c=e.onLift,s=r.axis,l=Qi(r.axis,u),f=la(r.axis,n.displaceBy),p=t[s.line],d=f.value,h=o.filter(function(e){var t=e.page.borderBox,n=t[s.start],r=t[s.end],o=$i(e.descriptor.id,c);return l?o?p<n:p<n+d:o?p<=r-d:p<=r}).map(function(e){return ca({draggable:e,destination:r,previousImpact:i,viewport:a.frame,onLift:c})}),m=o.length-h.length;return{movement:{displacedBy:f,displaced:h,map:sa(h)},destination:{droppableId:r.descriptor.id,index:m},merge:null}}({pageBorderBoxCenterWithDroppableScrollChange:m,destination:p,draggable:n,insideDestinationWithoutDraggable:h,previousImpact:i,viewport:a,userDirection:u,onLift:c})},ma=function(e){var t,n=e.draggable,r=e.home,o=e.draggables,i=e.viewport,a=la(r.axis,n.displaceBy),u=Yi(r.descriptor.id,o).slice(n.descriptor.index+1),c={displacedBy:a,wasDisplaced:u.reduce(function(e,t){return e[t.descriptor.id]=!0,e},{})},s=u.map(function(e){return ca({draggable:e,destination:r,previousImpact:pa,viewport:i.frame,forceShouldAnimate:!1,onLift:c})});return{impact:{movement:{displaced:s,map:sa(s),displacedBy:a},destination:(t=n.descriptor,{index:t.index,droppableId:t.droppableId}),merge:null},onLift:c}},va=function(e){var t=e.draggable,n=e.offset,r=e.initialWindowScroll,o=ci(t.client,n),i=si(o,r);return qr({},t,{placeholder:qr({},t.placeholder,{client:o}),client:o,page:i})},ga=function(e){var t=e.updatedDroppables,n=e.criticalId,r=e.existing,o=e.additions,i=e.removals,a=e.viewport,u=function(e){var t=e.existing,n=e.droppables,r=e.additions,o=e.removals,i=e.viewport,a={};return Vi(n).forEach(function(e){var n=e.axis,u=Yi(e.descriptor.id,t),c={},s=function(e,t){var n=c[e];c[e]=n?{indexChange:n.indexChange+t.indexChange,offset:ki(n.offset,t.offset)}:t},l=Hi(o.map(function(e){var n=t[e];return n||Object(je.a)(!1),n}).filter(function(t){return t.descriptor.droppableId===e.descriptor.id})),f=u.filter(function(e,t){if(!Boolean(l[e.descriptor.id]))return!0;var r=ji(_i(n.line,e.displaceBy[n.line]));return u.slice(t).forEach(function(e){l[e.descriptor.id]||s(e.descriptor.id,{indexChange:-1,offset:r})}),!1}),p=r.filter(function(t){return t.descriptor.droppableId===e.descriptor.id}),d=f.slice(0);p.forEach(function(e){d.splice(e.descriptor.index,0,e)});var h=Hi(p);d.forEach(function(e,t){if(Boolean(h[e.descriptor.id])){var r=_i(n.line,e.client.marginBox[n.size]);d.slice(t).forEach(function(e){h[e.descriptor.id]||s(e.descriptor.id,{indexChange:1,offset:r})})}}),d.forEach(function(e){if(!h[e.descriptor.id]){var t=c[e.descriptor.id];if(t){var n=va({draggable:e,offset:t.offset,initialWindowScroll:i.scroll.initial}),r=e.descriptor.index+t.indexChange,o=qr({},n,{descriptor:qr({},e.descriptor,{index:r})});a[n.descriptor.id]=o}}})}),qr({},t,a)}({droppables:t,existing:r,additions:o,removals:i,viewport:a}),c=u[n],s=t[c.descriptor.droppableId],l=function(e){var t=e.additions,n=e.dragging,r=e.home,o=e.viewport,i=la(r.axis,n.displaceBy);return t.map(function(e){return e.descriptor.droppableId!==r.descriptor.id?e:e.descriptor.index<n.descriptor.index?e:va({draggable:e,offset:i.point,initialWindowScroll:o.scroll.initial})})}({additions:function(e){var t=e.additions,n=e.updatedDroppables,r=e.viewport,o=r.scroll.diff.value;return t.map(function(e){var t=e.descriptor.droppableId,i=n[t].frame;i||Object(je.a)(!1);var a=i.scroll.diff.value,u=ki(o,a);return va({draggable:e,offset:u,initialWindowScroll:r.scroll.initial})})}({additions:o,updatedDroppables:t,viewport:a}),dragging:c,home:s,viewport:a}),f=qr({},u,Hi(l));return i.forEach(function(e){delete f[e]}),f},ya=function(e){var t=e.scrollHeight,n=e.scrollWidth,r=e.height,o=e.width,i=Si({x:n,y:t},{x:o,y:r});return{x:Math.max(0,i.x),y:Math.max(0,i.y)}},ba=function(e){var t=e.descriptor,n=e.isEnabled,r=e.isCombineEnabled,o=e.isFixedOnPage,i=e.direction,a=e.client,u=e.page,c=e.closest,s=function(){if(!c)return null;var e=c.scrollSize,t=c.client,n=ya({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,height:t.paddingBox.height,width:t.paddingBox.width});return{pageMarginBox:c.page.marginBox,frameClient:t,scrollSize:e,shouldClipSubject:c.shouldClipSubject,scroll:{initial:c.scroll,current:c.scroll,max:n,diff:{value:xi,displacement:xi}}}}(),l="vertical"===i?Ki:Xi;return{descriptor:t,isCombineEnabled:r,isFixedOnPage:o,axis:l,isEnabled:n,client:a,page:u,frame:s,subject:Mi({page:u,withPlaceholder:null,axis:l,frame:s})}},wa=function(e,t){return e.descriptor.droppableId===t.descriptor.id},Oa=function(e,t){return qr({},e,{scroll:qr({},e.scroll,{max:t})})},Ea=function(e,t,n){var r=e.frame;wa(t,e)&&Object(je.a)(!1),e.subject.withPlaceholder&&Object(je.a)(!1);var o=la(e.axis,t.displaceBy).point,i=function(e,t,n){var r=e.axis,o=e.subject.page.contentBox[r.size],i=Yi(e.descriptor.id,n).reduce(function(e,t){return e+t.client.marginBox[r.size]},0)+t[r.line]-o;return i<=0?null:_i(r.line,i)}(e,o,n),a={placeholderSize:o,increasedBy:i,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!r)return qr({},e,{subject:Mi({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:e.frame})});var u=i?ki(r.scroll.max,i):r.scroll.max,c=Oa(r,u);return qr({},e,{subject:Mi({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:c}),frame:c})},xa=function(e){var t=e.subject.withPlaceholder;t||Object(je.a)(!1);var n=e.frame;if(!n)return qr({},e,{subject:Mi({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null})});var r=t.oldFrameMaxScroll;r||Object(je.a)(!1);var o=Oa(n,r);return qr({},e,{subject:Mi({page:e.subject.page,axis:e.axis,frame:o,withPlaceholder:null}),frame:o})},ka=function(e){var t=e.frame;return t||Object(je.a)(!1),t},Sa=function(e,t){var n;return qr({},e,((n={})[t.descriptor.id]=t,n))},Ca=function(e){var t=e.draggable,n=e.draggables,r=e.droppables,o=e.previousImpact,i=e.impact,a=function(e){var t=e.previousImpact,n=e.impact,r=e.droppables,o=Bi(t),i=Bi(n);if(!o)return r;if(o===i)return r;var a=r[o];if(!a.subject.withPlaceholder)return r;var u=xa(a);return Sa(r,u)}({previousImpact:o,impact:i,droppables:r}),u=Bi(i);if(!u)return a;var c=r[u];if(wa(t,c))return a;if(c.subject.withPlaceholder)return a;var s=Ea(c,t,n);return Sa(a,s)},ja=function(e){var t,n,r=e.state,o=e.published;Ri("Processing dynamic changes");var i=function(e){var t=e.modified,n=e.existing,r=e.viewport;if(!t.length)return n;var o=t.map(function(e){var t=n[e.descriptor.id];t||Object(je.a)(!1);var o,i,a=Boolean(t.subject.withPlaceholder)?xa(t):t,u=a.client,c=e.client,s=ka(a),l=ka(e),f=ai({borderBox:(a.axis,o=u.borderBox,i=c.borderBox,{top:o.top,left:o.left,right:o.left+i.width,bottom:o.top+i.height}),margin:u.margin,border:u.border,padding:u.padding}),p={client:s.frameClient,page:si(s.frameClient,r.scroll.initial),shouldClipSubject:s.shouldClipSubject,scrollSize:l.scrollSize,scroll:s.scroll.initial},d=ba({descriptor:e.descriptor,isEnabled:e.isEnabled,isCombineEnabled:e.isCombineEnabled,isFixedOnPage:e.isFixedOnPage,direction:e.axis.direction,client:f,page:si(f,r.scroll.initial),closest:p});return Li(d,l.scroll.current)});return qr({},n,Wi(o))}({modified:o.modified,existing:r.dimensions.droppables,viewport:r.viewport}),a=ga({updatedDroppables:i,criticalId:r.critical.draggable.id,existing:r.dimensions.draggables,additions:o.additions,removals:o.removals,viewport:r.viewport}),u={draggable:a[r.critical.draggable.id].descriptor,droppable:i[r.critical.droppable.id].descriptor},c=r.dimensions.draggables[u.draggable.id],s=a[u.draggable.id],l={draggables:a,droppables:Ca({draggable:s,draggables:a,droppables:i,previousImpact:r.impact,impact:r.impact})},f=function(e){var t,n=e.initial,r=e.current,o=e.oldClientBorderBoxCenter,i=e.newClientBorderBoxCenter,a=e.viewport,u=Si(i,o),c={client:t={selection:ki(n.client.selection,u),borderBoxCenter:i,offset:xi},page:{selection:ki(t.selection,a.scroll.initial),borderBoxCenter:ki(t.selection,a.scroll.initial)}};return{current:function(){var e=ji(u),t=ki(r.client.offset,e),n={selection:ki(c.client.selection,t),borderBoxCenter:ki(c.client.borderBoxCenter,t),offset:t},o={selection:ki(n.selection,a.scroll.current),borderBoxCenter:ki(n.borderBoxCenter,a.scroll.current)};return Ci(r.client.borderBoxCenter,n.borderBoxCenter)||Object(je.a)(!1),{client:n,page:o}}(),initial:c}}({initial:r.initial,current:r.current,oldClientBorderBoxCenter:c.client.borderBox.center,newClientBorderBoxCenter:s.client.borderBox.center,viewport:r.viewport}),p=f.initial,d=f.current,h=ma({draggable:s,home:l.droppables[u.droppable.id],draggables:l.draggables,viewport:r.viewport}),m=h.impact,v=h.onLift,g=function(e){var t=e.movement.displaced;if(!t.length)return e;var n=t.map(function(e){return e.isVisible&&e.shouldAnimate?qr({},e,{shouldAnimate:!1}):e});return qr({},e,{movement:qr({},e.movement,{displaced:n,map:sa(n)})})}(ha({pageBorderBoxCenter:d.page.borderBoxCenter,draggable:s,draggables:l.draggables,droppables:l.droppables,previousImpact:m,viewport:r.viewport,userDirection:r.userDirection,onLift:v}));Boolean("SNAP"===r.movementMode&&!Bi(g))&&Object(je.a)(!1),Fi("Processing dynamic changes");var y=qr({phase:"DRAGGING"},r,((t={}).phase="DRAGGING",t.critical=u,t.current=d,t.initial=p,t.impact=g,t.dimensions=l,t.onLift=v,t.onLiftImpact=m,t.forceShouldAnimate=!1,t));return"COLLECTING"===r.phase?y:qr({phase:"DROP_PENDING"},y,((n={}).phase="DROP_PENDING",n.reason=r.reason,n.isWaiting=!1,n))},_a={vertical:"down",horizontal:"right"},Ia={vertical:"up",horizontal:"left"},Ta=function(e){var t=e.isMovingForward,n=e.isInHomeList,r=e.draggable,o=e.draggables,i=e.destination,a=e.insideDestination,u=e.previousImpact,c=e.onLift,s=u.destination?function(e){var t=e.isMovingForward,n=e.isInHomeList,r=e.draggable,o=e.insideDestination,i=e.location,a=o.slice(),u=i.index;!n&&a.splice(i.index,0,r);var c=t?u+1:u-1;return c<0?null:c>a.length-1?null:{proposedIndex:c,modifyDisplacement:!0}}({isMovingForward:t,isInHomeList:n,draggable:r,location:u.destination,insideDestination:a}):u.merge?function(e){var t=e.isMovingForward,n=e.destination,r=e.previousImpact,o=e.draggables,i=e.merge,a=e.onLift;if(!n.isCombineEnabled)return null;var u=r.movement,c=i.combine.draggableId,s=o[c].descriptor.index;return $i(c,a)?u.map[c]?t?{proposedIndex:s,modifyDisplacement:!0}:{proposedIndex:s-1,modifyDisplacement:!1}:t?{proposedIndex:s,modifyDisplacement:!1}:{proposedIndex:s-1,modifyDisplacement:!0}:Boolean(u.map[c])?t?{proposedIndex:s+1,modifyDisplacement:!0}:{proposedIndex:s,modifyDisplacement:!1}:t?{proposedIndex:s+1,modifyDisplacement:!1}:{proposedIndex:s,modifyDisplacement:!0}}({isMovingForward:t,destination:i,previousImpact:u,draggables:o,merge:u.merge,onLift:c}):null;if(null==s)return null;var l,f=s.proposedIndex,p=s.modifyDisplacement,d=la(i.axis,r.displaceBy),h=(l=u.movement.displaced,p?t?function(e){return e.slice(1)}(l):function(e,t){return[{draggableId:e.descriptor.id,isVisible:!0,shouldAnimate:!0}].concat(t)}(da(r,a)[f],l):l);return{movement:{displacedBy:d,displaced:h,map:sa(h)},destination:{droppableId:i.descriptor.id,index:f},merge:null}},Na=function(e,t){return t.margin[e.start]+t.borderBox[e.size]/2},Aa=function(e,t,n){return t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2},Pa=function(e){var t=e.axis,n=e.moveRelativeTo,r=e.isMoving;return _i(t.line,n.marginBox[t.end]+Na(t,r),Aa(t,n.marginBox,r))},Da=function(e){var t=e.axis,n=e.moveRelativeTo,r=e.isMoving;return _i(t.line,n.marginBox[t.start]-function(e,t){return t.margin[e.end]+t.borderBox[e.size]/2}(t,r),Aa(t,n.marginBox,r))},Ma=function(e){var t=e.movement,n=e.draggable,r=e.draggables,o=e.droppable,i=e.onLift,a=Yi(o.descriptor.id,r),u=n.page,c=o.axis;if(!a.length)return function(e){var t=e.axis,n=e.moveInto,r=e.isMoving;return _i(t.line,n.contentBox[t.start]+Na(t,r),Aa(t,n.contentBox,r))}({axis:c,moveInto:o.page,isMoving:u});var s=t.displaced,l=t.displacedBy;if(s.length){var f=r[s[0].draggableId];if($i(f.descriptor.id,i))return Da({axis:c,moveRelativeTo:f.page,isMoving:u});var p=ci(f.page,l.point);return Da({axis:c,moveRelativeTo:p,isMoving:u})}var d=a[a.length-1];if(d.descriptor.id===n.descriptor.id)return u.borderBox.center;if($i(d.descriptor.id,i)){var h=ci(d.page,ji(i.displacedBy.point));return Pa({axis:c,moveRelativeTo:h,isMoving:u})}return Pa({axis:c,moveRelativeTo:d.page,isMoving:u})},La=function(e,t){var n=e.frame;return n?ki(t,n.scroll.diff.displacement):t},Ra=function(e){var t=e.impact,n=e.draggable,r=e.droppable,o=e.draggables,i=e.onLift,a=t.merge,u=t.destination,c=n.page.borderBox.center;return r?u?Ma({movement:t.movement,draggable:n,draggables:o,droppable:r,onLift:i}):a?function(e){var t=e.combine,n=e.onLift,r=e.movement,o=e.draggables,i=t.draggableId,a=o[i].page.borderBox.center,u=ea({displaced:r.map,onLift:n,combineWith:i,displacedBy:r.displacedBy});return ki(a,u)}({movement:t.movement,combine:a.combine,draggables:o,onLift:i}):c:c},Fa=function(e){var t=Ra(e),n=e.droppable;return n?La(n,t):t},Ba=function(e,t){var n=Si(t,e.scroll.initial),r=ji(n);return{frame:ni({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:n,displacement:r}}}},za=function(e,t){return qr({},e,{movement:qr({},e.movement,{displaced:t,map:sa(t)})})},Ua=function(e){var t=e.pageBorderBoxCenter,n=e.draggable,r=function(e,t){return ki(e.scroll.diff.displacement,t)}(e.viewport,t),o=Si(r,n.page.borderBox.center);return ki(n.client.borderBox.center,o)},qa=function(e){var t=e.draggable,n=e.destination,r=e.newPageBorderBoxCenter,o=e.viewport,i=e.withDroppableDisplacement,a=e.onlyOnMainAxis,u=void 0!==a&&a,c=Si(r,t.page.borderBox.center),s={target:Ai(t.page.borderBox,c),destination:n,withDroppableDisplacement:i,viewport:o};return u?function(e){return ia(qr({},e,{isVisibleThroughFrameFn:(t=e.destination.axis,function(e){var n=Ji(e.top,e.bottom),r=Ji(e.left,e.right);return function(e){return t===Ki?n(e.top)&&n(e.bottom):r(e.left)&&r(e.right)}})}));var t}(s):ua(s)},Wa=function(e){var t=e.isMovingForward,n=e.draggable,r=e.destination,o=e.draggables,i=e.previousImpact,a=e.viewport,u=e.previousPageBorderBoxCenter,c=e.previousClientSelection,s=e.onLift;if(!r.isEnabled)return null;var l=Yi(r.descriptor.id,o),f=wa(n,r),p=function(e){var t=e.isMovingForward,n=e.isInHomeList,r=e.draggable,o=e.destination,i=e.insideDestination,a=e.previousImpact;if(!o.isCombineEnabled)return null;if(a.merge)return null;var u=a.destination;u||Object(je.a)(!1);var c,s=u.index,l=(c=i.slice(),n&&c.splice(r.descriptor.index,1),c.splice(u.index,0,r),c),f=t?s+1:s-1;if(f<0)return null;if(f>l.length-1)return null;var p=l[f];p===r&&Object(je.a)(!1);var d={whenEntered:t?_a:Ia,combine:{draggableId:p.descriptor.id,droppableId:o.descriptor.id}};return{movement:a.movement,destination:null,merge:d}}({isInHomeList:f,isMovingForward:t,draggable:n,destination:r,insideDestination:l,previousImpact:i})||Ta({isMovingForward:t,isInHomeList:f,draggable:n,draggables:o,destination:r,insideDestination:l,previousImpact:i,onLift:s});if(!p)return null;var d=Fa({impact:p,draggable:n,droppable:r,draggables:o,onLift:s});if(qa({draggable:n,destination:r,newPageBorderBoxCenter:d,viewport:a.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:Ua({pageBorderBoxCenter:d,draggable:n,viewport:a}),impact:p,scrollJumpRequest:null};var h=Si(d,u);return{clientSelection:c,impact:function(e){var t=e.impact,n=e.viewport,r=e.destination,o=e.draggables,i=e.maxScrollChange,a=e.onLift,u=t.movement.displaced,c=Ba(n,ki(n.scroll.current,i)),s=r.frame?Li(r,ki(r.frame.scroll.current,i)):r,l=u.map(function(e){if(e.isVisible)return e;var i=o[e.draggableId],u=ca({draggable:i,destination:r,previousImpact:t,viewport:c.frame,onLift:a,forceShouldAnimate:!1});if(u.isVisible)return u;var l=ca({draggable:i,destination:s,previousImpact:t,viewport:n.frame,onLift:a,forceShouldAnimate:!1});return l.isVisible?l:e});return za(t,l)}({impact:p,viewport:a,destination:r,draggables:o,maxScrollChange:h,onLift:s}),scrollJumpRequest:h}},Ha=function(e){var t=e.subject.active;return t||Object(je.a)(!1),t},Va=function(e,t){var n=e.page.borderBox.center;return $i(e.descriptor.id,t)?Si(n,t.displacedBy.point):n},Ga=function(e,t){var n=e.page.borderBox;return $i(e.descriptor.id,t)?Ai(n,ji(t.displacedBy.point)):n},Ja=function(e){var t=e.isMovingForward,n=e.previousPageBorderBoxCenter,r=e.draggable,o=e.isOver,i=e.draggables,a=e.droppables,u=e.previousImpact,c=e.viewport,s=e.onLift,l=function(e){var t=e.isMovingForward,n=e.pageBorderBoxCenter,r=e.source,o=e.droppables,i=e.viewport,a=r.subject.active;if(!a)return null;var u=r.axis,c=Ji(a[u.start],a[u.end]),s=Vi(o).filter(function(e){return e!==r}).filter(function(e){return e.isEnabled}).filter(function(e){return Boolean(e.subject.active)}).filter(function(e){return ra(i.frame)(Ha(e))}).filter(function(e){var n=Ha(e);return t?a[u.crossAxisEnd]<n[u.crossAxisEnd]:n[u.crossAxisStart]<a[u.crossAxisStart]}).filter(function(e){var t=Ha(e),n=Ji(t[u.start],t[u.end]);return c(t[u.start])||c(t[u.end])||n(a[u.start])||n(a[u.end])}).sort(function(e,n){var r=Ha(e)[u.crossAxisStart],o=Ha(n)[u.crossAxisStart];return t?r-o:o-r}).filter(function(e,t,n){return Ha(e)[u.crossAxisStart]===Ha(n[0])[u.crossAxisStart]});if(!s.length)return null;if(1===s.length)return s[0];var l=s.filter(function(e){return Ji(Ha(e)[u.start],Ha(e)[u.end])(n[u.line])});return 1===l.length?l[0]:l.length>1?l.sort(function(e,t){return Ha(e)[u.start]-Ha(t)[u.start]})[0]:s.sort(function(e,t){var r=Ti(n,Pi(Ha(e))),o=Ti(n,Pi(Ha(t)));return r!==o?r-o:Ha(e)[u.start]-Ha(t)[u.start]})[0]}({isMovingForward:t,pageBorderBoxCenter:n,source:o,droppables:a,viewport:c});if(!l)return null;var f=Yi(l.descriptor.id,i),p=function(e){var t=e.previousPageBorderBoxCenter,n=e.moveRelativeTo,r=e.insideDestination,o=e.draggable,i=e.draggables,a=e.destination,u=e.previousImpact,c=e.viewport,s=e.onLift;if(!n){if(r.length)return null;var l={movement:fa,destination:{droppableId:a.descriptor.id,index:0},merge:null},f=Fa({impact:l,draggable:o,droppable:a,draggables:i,onLift:s}),p=wa(o,a)?a:Ea(a,o,i);return qa({draggable:o,destination:p,newPageBorderBoxCenter:f,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?l:null}var d=Boolean(t[a.axis.line]<n.page.borderBox.center[a.axis.line]),h=r.indexOf(n);-1===h&&Object(je.a)(!1);var m=n.descriptor.id===o.descriptor.id?h:d?h:h+1,v=da(o,r).slice(m).map(function(e){return ca({draggable:e,destination:a,viewport:c.frame,previousImpact:u,onLift:s})});return{movement:{displacedBy:la(a.axis,o.displaceBy),displaced:v,map:sa(v)},destination:{droppableId:a.descriptor.id,index:m},merge:null}}({previousPageBorderBoxCenter:n,destination:l,draggable:r,draggables:i,moveRelativeTo:function(e){var t=e.pageBorderBoxCenter,n=e.viewport,r=e.destination,o=e.insideDestination,i=e.onLift;return o.filter(function(e){return ua({target:Ga(e,i),destination:r,viewport:n.frame,withDroppableDisplacement:!0})}).sort(function(e,n){var o=Ii(t,La(r,Va(e,i))),a=Ii(t,La(r,Va(n,i)));return o<a?-1:a<o?1:e.descriptor.index-n.descriptor.index})[0]||null}({pageBorderBoxCenter:n,viewport:c,destination:l,insideDestination:f,onLift:s}),insideDestination:f,previousImpact:u,viewport:c,onLift:s});if(!p)return null;var d=Fa({impact:p,draggable:r,droppable:l,draggables:i,onLift:s});return{clientSelection:Ua({pageBorderBoxCenter:d,draggable:r,viewport:c}),impact:p,scrollJumpRequest:null}},Za=function(e){var t=e.state,n=e.type,r=function(e,t){var n=Bi(e);return n?t[n]:null}(t.impact,t.dimensions.droppables),o=Boolean(r),i=t.dimensions.droppables[t.critical.droppable.id],a=r||i,u=a.axis.direction,c="vertical"===u&&("MOVE_UP"===n||"MOVE_DOWN"===n)||"horizontal"===u&&("MOVE_LEFT"===n||"MOVE_RIGHT"===n);if(c&&!o)return null;var s="MOVE_DOWN"===n||"MOVE_RIGHT"===n,l=t.dimensions.draggables[t.critical.draggable.id],f=t.current.page.borderBoxCenter,p=t.dimensions,d=p.draggables,h=p.droppables;return c?Wa({isMovingForward:s,previousPageBorderBoxCenter:f,draggable:l,destination:a,draggables:d,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,onLift:t.onLift}):Ja({isMovingForward:s,previousPageBorderBoxCenter:f,draggable:l,isOver:a,draggables:d,droppables:h,previousImpact:t.impact,viewport:t.viewport,onLift:t.onLift})};function Ya(e){return"DRAGGING"===e.phase||"COLLECTING"===e.phase}var Ka,Xa=function(e,t){return 0===t?e:t>0?"down":"up"},Qa=function(e,t){return 0===t?e:t>0?"right":"left"},$a=function(e){var t,n,r,o,i=e.state,a=e.clientSelection,u=e.dimensions,c=e.viewport,s=e.impact,l=e.scrollJumpRequest,f=c||i.viewport,p=f.scroll.current,d=u||i.dimensions,h=a||i.current.client.selection,m=Si(h,i.initial.client.selection),v={offset:m,selection:h,borderBoxCenter:ki(i.initial.client.borderBoxCenter,m)},g={selection:ki(v.selection,p),borderBoxCenter:ki(v.borderBoxCenter,p)},y={client:v,page:g},b=(t=i.userDirection,n=i.current.page.borderBoxCenter,r=y.page.borderBoxCenter,o=Si(r,n),{horizontal:Qa(t.horizontal,o.x),vertical:Xa(t.vertical,o.y)});if("COLLECTING"===i.phase)return qr({phase:"COLLECTING"},i,{dimensions:d,viewport:f,current:y,userDirection:b});var w=d.draggables[i.critical.draggable.id],O=s||ha({pageBorderBoxCenter:g.borderBoxCenter,draggable:w,draggables:d.draggables,droppables:d.droppables,previousImpact:i.impact,viewport:f,userDirection:b,onLift:i.onLift}),E=Ca({draggable:w,impact:O,previousImpact:i.impact,draggables:d.draggables,droppables:d.droppables});return qr({},i,{current:y,userDirection:b,dimensions:{draggables:d.draggables,droppables:E},impact:O,viewport:f,scrollJumpRequest:l||null,forceShouldAnimate:!l&&null})},eu=function(e){var t=e.impact,n=e.viewport,r=e.destination,o=e.draggables,i=e.onLift,a=e.forceShouldAnimate,u=t.movement.displaced.map(function(e){return ca({draggable:o[e.draggableId],destination:r,previousImpact:t,viewport:n.frame,onLift:i,forceShouldAnimate:a})});return za(t,u)},tu=function(e){var t=e.impact,n=e.draggable,r=e.droppable,o=e.draggables,i=e.viewport,a=e.onLift,u=Fa({impact:t,draggable:n,draggables:o,droppable:r,onLift:a});return Ua({pageBorderBoxCenter:u,draggable:n,viewport:i})},nu=function(e){var t=e.state,n=e.dimensions,r=e.viewport;"SNAP"!==t.movementMode&&Object(je.a)(!1);var o=t.impact,i=r||t.viewport,a=n||t.dimensions,u=a.draggables,c=a.droppables,s=u[t.critical.draggable.id],l=Bi(o);l||Object(je.a)(!1);var f=c[l],p=eu({impact:o,viewport:i,destination:f,draggables:u,onLift:t.onLift}),d=tu({impact:p,draggable:s,droppable:f,draggables:u,viewport:i,onLift:t.onLift});return $a({impact:p,clientSelection:d,state:t,dimensions:a,viewport:i})},ru=function(e){return"SNAP"===e.movementMode},ou=function(e,t,n){var r=function(e,t){return{draggables:e.draggables,droppables:Sa(e.droppables,t)}}(e.dimensions,t);return!ru(e)||n?$a({state:e,dimensions:r}):nu({state:e,dimensions:r})},iu={phase:"IDLE",completed:null,shouldFlush:!1},au=function(e,t){if(void 0===e&&(e=iu),"CLEAN"===t.type)return qr({},iu,{shouldFlush:t.payload.shouldFlush});if("INITIAL_PUBLISH"===t.type){"IDLE"!==e.phase&&Object(je.a)(!1);var n=t.payload,r=n.critical,o=n.clientSelection,i=n.viewport,a=n.dimensions,u=n.movementMode,c=a.draggables[r.draggable.id],s=a.droppables[r.droppable.id],l={selection:o,borderBoxCenter:c.client.borderBox.center,offset:xi},f={client:l,page:{selection:ki(l.selection,i.scroll.initial),borderBoxCenter:ki(l.selection,i.scroll.initial)}},p=Vi(a.droppables).every(function(e){return!e.isFixedOnPage}),d=ma({draggable:c,home:s,draggables:a.draggables,viewport:i}),h=d.impact;return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:u,dimensions:a,initial:f,current:f,isWindowScrollAllowed:p,impact:h,onLift:d.onLift,onLiftImpact:h,viewport:i,userDirection:_a,scrollJumpRequest:null,forceShouldAnimate:null}}var m;if("COLLECTION_STARTING"===t.type)return"COLLECTING"===e.phase||"DROP_PENDING"===e.phase?e:("DRAGGING"!==e.phase&&Object(je.a)(!1),qr({phase:"COLLECTING"},e,((m={}).phase="COLLECTING",m)));if("PUBLISH_WHILE_DRAGGING"===t.type)return"COLLECTING"!==e.phase&&"DROP_PENDING"!==e.phase&&Object(je.a)(!1),ja({state:e,published:t.payload});if("MOVE"===t.type){if("DROP_PENDING"===e.phase)return e;Ya(e)||Object(je.a)(!1);var v=t.payload.client;return Ci(v,e.current.client.selection)?e:$a({state:e,clientSelection:v,impact:ru(e)?e.impact:null})}if("UPDATE_DROPPABLE_SCROLL"===t.type){if("DROP_PENDING"===e.phase)return e;if("COLLECTING"===e.phase)return e;Ya(e)||Object(je.a)(!1);var g=t.payload,y=g.id,b=g.offset,w=e.dimensions.droppables[y];if(!w)return e;var O=Li(w,b);return ou(e,O,!1)}if("UPDATE_DROPPABLE_IS_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;Ya(e)||Object(je.a)(!1);var E=t.payload,x=E.id,k=E.isEnabled,S=e.dimensions.droppables[x];S||Object(je.a)(!1),S.isEnabled===k&&Object(je.a)(!1);var C=qr({},S,{isEnabled:k});return ou(e,C,!0)}if("UPDATE_DROPPABLE_IS_COMBINE_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;Ya(e)||Object(je.a)(!1);var j=t.payload,_=j.id,I=j.isCombineEnabled,T=e.dimensions.droppables[_];T||Object(je.a)(!1),T.isCombineEnabled===I&&Object(je.a)(!1);var N=qr({},T,{isCombineEnabled:I});return ou(e,N,!0)}if("MOVE_BY_WINDOW_SCROLL"===t.type){if("DROP_PENDING"===e.phase||"DROP_ANIMATING"===e.phase)return e;Ya(e)||Object(je.a)(!1),e.isWindowScrollAllowed||Object(je.a)(!1);var A=t.payload.newScroll;if(Ci(e.viewport.scroll.current,A))return e;var P=Ba(e.viewport,A);return ru(e)?nu({state:e,viewport:P}):$a({state:e,viewport:P})}if("UPDATE_VIEWPORT_MAX_SCROLL"===t.type){if(!Ya(e))return e;var D=t.payload.maxScroll;if(Ci(D,e.viewport.scroll.max))return e;var M=qr({},e.viewport,{scroll:qr({},e.viewport.scroll,{max:D})});return qr({phase:"DRAGGING"},e,{viewport:M})}if("MOVE_UP"===t.type||"MOVE_DOWN"===t.type||"MOVE_LEFT"===t.type||"MOVE_RIGHT"===t.type){if("COLLECTING"===e.phase||"DROP_PENDING"===e.phase)return e;"DRAGGING"!==e.phase&&Object(je.a)(!1);var L=Za({state:e,type:t.type});return L?$a({state:e,impact:L.impact,clientSelection:L.clientSelection,scrollJumpRequest:L.scrollJumpRequest}):e}if("DROP_PENDING"===t.type){var R,F=t.payload.reason;return"COLLECTING"!==e.phase&&Object(je.a)(!1),qr({phase:"DROP_PENDING"},e,((R={}).phase="DROP_PENDING",R.isWaiting=!0,R.reason=F,R))}if("DROP_ANIMATE"===t.type){var B=t.payload,z=B.completed,U=B.dropDuration,q=B.newHomeClientOffset;return"DRAGGING"!==e.phase&&"DROP_PENDING"!==e.phase&&Object(je.a)(!1),{phase:"DROP_ANIMATING",dimensions:e.dimensions,completed:z,dropDuration:U,newHomeClientOffset:q}}if("DROP_COMPLETE"===t.type){var W=t.payload;return{phase:"IDLE",completed:W.completed,shouldFlush:W.shouldFlush}}return e},uu=function(e){return{type:"PUBLISH_WHILE_DRAGGING",payload:e}},cu=function(){return{type:"COLLECTION_STARTING",payload:null}},su=function(e){return{type:"UPDATE_DROPPABLE_SCROLL",payload:e}},lu=function(e){return{type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}},fu=function(e){return{type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}},pu=function(e){return{type:"MOVE",payload:e}},du=function(e){return void 0===e&&(e={shouldFlush:!1}),{type:"CLEAN",payload:e}},hu=function(e){return{type:"DROP_COMPLETE",payload:e}},mu=function(e){return{type:"DROP",payload:e}},vu="cubic-bezier(.2,1,.1,1)",gu={drop:0,combining:.7},yu={drop:.75},bu=.2+"s "+"cubic-bezier(0.2, 0, 0, 1)",wu={fluid:"opacity "+bu,snap:"transform "+bu+", opacity "+bu,drop:function(e){var t=e+"s "+vu;return"transform "+t+", opacity "+t},outOfTheWay:"transform "+bu,placeholder:"height "+bu+", width "+bu+", margin "+bu},Ou=function(e){return Ci(e,xi)?null:"translate("+e.x+"px, "+e.y+"px)"},Eu={moveTo:Ou,drop:function(e,t){var n=Ou(e);return n?t?n+" scale("+yu.drop+")":n:null}},xu=.33,ku=.55,Su=ku-xu,Cu=function(e){var t=e.getState,n=e.dispatch;return function(e){return function(r){if("DROP"===r.type){var o=t(),i=r.payload.reason;if("COLLECTING"!==o.phase){if("IDLE"!==o.phase){"DROP_PENDING"===o.phase&&o.isWaiting&&Object(je.a)(!1),"DRAGGING"!==o.phase&&"DROP_PENDING"!==o.phase&&Object(je.a)(!1);var a=o.critical,u=o.dimensions,c=function(e){var t=e.reason,n=e.lastImpact,r=e.home,o=e.viewport,i=e.draggables,a=e.onLiftImpact,u=e.onLift,c="DROP"===t&&Boolean(Bi(n));return c?n.destination?{impact:n,didDropInsideDroppable:c}:{impact:qr({},n,{movement:fa}),didDropInsideDroppable:c}:{impact:eu({impact:a,destination:r,viewport:o,draggables:i,onLift:u,forceShouldAnimate:!0}),didDropInsideDroppable:c}}({reason:i,lastImpact:o.impact,onLift:o.onLift,onLiftImpact:o.onLiftImpact,home:o.dimensions.droppables[o.critical.droppable.id],viewport:o.viewport,draggables:o.dimensions.draggables}),s=c.impact,l=c.didDropInsideDroppable,f=u.draggables[o.critical.draggable.id],p=l?s.destination:null,d=l&&s.merge?s.merge.combine:null,h={index:a.draggable.index,droppableId:a.droppable.id},m={draggableId:f.descriptor.id,type:f.descriptor.type,source:h,reason:i,mode:o.movementMode,destination:p,combine:d},v=function(e){var t=e.impact,n=e.draggable,r=e.dimensions,o=e.viewport,i=e.onLift,a=r.draggables,u=r.droppables,c=Bi(t),s=c?u[c]:null,l=u[n.descriptor.droppableId],f=tu({impact:t,draggable:n,draggables:a,onLift:i,droppable:s||l,viewport:o}),p=Si(f,n.client.borderBox.center),d=t.merge;return d&&$i(d.combine.draggableId,i)?Si(p,i.displacedBy.point):p}({impact:s,draggable:f,dimensions:u,viewport:o.viewport,onLift:o.onLift}),g={critical:o.critical,result:m,impact:s};if(!Ci(o.current.client.offset,v)||Boolean(m.combine)){var y=function(e){var t=e.current,n=e.destination,r=e.reason,o=Ii(t,n);if(o<=0)return xu;if(o>=1500)return ku;var i=xu+Su*(o/1500);return Number(("CANCEL"===r?.6*i:i).toFixed(2))}({current:o.current.client.offset,destination:v,reason:i});n(function(e){return{type:"DROP_ANIMATE",payload:e}}({newHomeClientOffset:v,dropDuration:y,completed:g}))}else n(hu({completed:g,shouldFlush:!1}))}}else n(function(e){return{type:"DROP_PENDING",payload:e}}({reason:i}))}else e(r)}}},ju=function(e){return e+1},_u=function(e,t){var n=e.droppableId===t.droppableId,r=ju(e.index),o=ju(t.index);return n?"\n You have moved the item from position "+r+"\n to position "+o+"\n ":"\n You have moved the item from position "+r+"\n in list "+e.droppableId+"\n to list "+t.droppableId+"\n in position "+o+"\n "},Iu=function(e,t,n){return t.droppableId===n.droppableId?"\n The item "+e+"\n has been combined with "+n.draggableId:"\n The item "+e+"\n in list "+t.droppableId+"\n has been combined with "+n.draggableId+"\n in list "+n.droppableId+"\n "},Tu=function(e){return"\n The item has returned to its starting position\n of "+ju(e.index)+"\n"},Nu=function(e){return"\n You have lifted an item in position "+ju(e.source.index)+".\n Use the arrow keys to move, space bar to drop, and escape to cancel.\n"},Au=function(e){var t=e.destination;if(t)return _u(e.source,t);var n=e.combine;return n?Iu(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},Pu=function(e){if("CANCEL"===e.reason)return"\n Movement cancelled.\n "+Tu(e.source)+"\n ";var t=e.destination,n=e.combine;return t?"\n You have dropped the item.\n "+_u(e.source,t)+"\n ":n?"\n You have dropped the item.\n "+Iu(e.draggableId,e.source,n)+"\n ":"\n The item has been dropped while not over a drop area.\n "+Tu(e.source)+"\n "},Du=function(){var e=[];return{add:function(t){var n=setTimeout(function(){return function(t){var n=Ui(e,function(e){return e.timerId===t});-1===n&&Object(je.a)(!1),e.splice(n,1)[0].callback()}(n)}),r={timerId:n,callback:t};e.push(r)},flush:function(){if(e.length){var t=[].concat(e);e.length=0,t.forEach(function(e){clearTimeout(e.timerId),e.callback()})}}}},Mu=function(e,t){Ri(e),t(),Fi(e)},Lu=function(e,t){return{draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t}},Ru=function(e,t,n,r){if(e){var o=function(e){var t=!1,n=!1,r=setTimeout(function(){n=!0}),o=function(o){t||n||(t=!0,e(o),clearTimeout(r))};return o.wasCalled=function(){return t},o}(n);e(t,{announce:o}),o.wasCalled()||n(r(t))}else n(r(t))},Fu=function(e,t){var n=function(e,t){var n=Du(),r=null,o=function(n){r||Object(je.a)(!1),r=null,Mu("onDragEnd",function(){return Ru(e().onDragEnd,n,t,Pu)})};return{beforeStart:function(t,n){r&&Object(je.a)(!1),Mu("onBeforeDragStart",function(){var r=e().onBeforeDragStart;r&&r(Lu(t,n))})},start:function(o,i){r&&Object(je.a)(!1);var a=Lu(o,i);r={mode:i,lastCritical:o,lastLocation:a.source,lastCombine:null},n.add(function(){Mu("onDragStart",function(){return Ru(e().onDragStart,a,t,Nu)})})},update:function(o,i){var a=i.destination,u=i.merge?i.merge.combine:null;r||Object(je.a)(!1);var c=!function(e,t){if(e===t)return!0;var n=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,r=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&r}(o,r.lastCritical);c&&(r.lastCritical=o);var s,l,f=(s=r.lastLocation,l=a,!(null==s&&null==l||null!=s&&null!=l&&s.droppableId===l.droppableId&&s.index===l.index));f&&(r.lastLocation=a);var p=!function(e,t){return null==e&&null==t||null!=e&&null!=t&&e.draggableId===t.draggableId&&e.droppableId===t.droppableId}(r.lastCombine,u);if(p&&(r.lastCombine=u),c||f||p){var d=qr({},Lu(o,r.mode),{combine:u,destination:a});n.add(function(){Mu("onDragUpdate",function(){return Ru(e().onDragUpdate,d,t,Au)})})}},flush:function(){r||Object(je.a)(!1),n.flush()},drop:o,abort:function(){if(r){var e=qr({},Lu(r.lastCritical,r.mode),{combine:null,destination:null,reason:"CANCEL"});o(e)}}}}(e,t);return function(e){return function(t){return function(r){if("INITIAL_PUBLISH"===r.type){var o=r.payload.critical;return n.beforeStart(o,r.payload.movementMode),t(r),void n.start(o,r.payload.movementMode)}if("DROP_COMPLETE"===r.type){var i=r.payload.completed.result;return n.flush(),t(r),void n.drop(i)}if(t(r),"CLEAN"!==r.type){var a=e.getState();"DRAGGING"===a.phase&&n.update(a.critical,a.impact)}else n.abort()}}}},Bu=function(e){return function(t){return function(n){if("DROP_ANIMATION_FINISHED"===n.type){var r=e.getState();"DROP_ANIMATING"!==r.phase&&Object(je.a)(!1),e.dispatch(hu({completed:r.completed,shouldFlush:!1}))}else t(n)}}},zu=function(e){return function(t){return function(n){if(t(n),"PUBLISH_WHILE_DRAGGING"===n.type){var r=e.getState();"DROP_PENDING"===r.phase&&(r.isWaiting||e.dispatch(mu({reason:r.reason})))}}}},Uu=ro,qu=function(e){var t,n=e.dimensionMarshal,r=e.styleMarshal,o=e.getResponders,i=e.announce,a=e.autoScroller;return $r(au,Uu(oo((t=r,function(){return function(e){return function(n){"INITIAL_PUBLISH"===n.type&&t.dragging(),"DROP_ANIMATE"===n.type&&t.dropping(n.payload.completed.result.reason),"CLEAN"!==n.type&&"DROP_COMPLETE"!==n.type||t.resting(),e(n)}}}),function(e){return function(){return function(t){return function(n){"DROP_COMPLETE"!==n.type&&"CLEAN"!==n.type&&"DROP_ANIMATE"!==n.type||e.stopPublishing(),t(n)}}}}(n),function(e){return function(t){var n=t.getState,r=t.dispatch;return function(t){return function(o){if("LIFT"===o.type){var i=o.payload,a=i.id,u=i.clientSelection,c=i.movementMode,s=n();"DROP_ANIMATING"===s.phase&&r(hu({completed:s.completed,shouldFlush:!0})),"IDLE"!==n().phase&&Object(je.a)(!1);var l={draggableId:a,scrollOptions:{shouldPublishImmediately:"SNAP"===c}},f=e.startPublishing(l),p=f.critical,d=f.dimensions,h=f.viewport;r({type:"INITIAL_PUBLISH",payload:{critical:p,dimensions:d,clientSelection:u,movementMode:c,viewport:h}})}else t(o)}}}}(n),Cu,Bu,zu,function(e){return function(t){return function(n){return function(r){if(function(e){return"DROP_COMPLETE"===e.type||"DROP_ANIMATE"===e.type||"CLEAN"===e.type}(r))return e.stop(),void n(r);if(function(e){return"COLLECTION_STARTING"===e.type}(r))return e.cancelPending(),void n(r);if("INITIAL_PUBLISH"===r.type){n(r);var o=t.getState();return"DRAGGING"!==o.phase&&Object(je.a)(!1),void e.start(o)}n(r),e.scroll(t.getState())}}}}(a),Fu(o,i))))},Wu=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Hu=function(){var e=document.documentElement;return e||Object(je.a)(!1),e},Vu=function(){var e=Hu();return ya({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},Gu=function(e){var t=e.critical,n=e.scrollOptions,r=e.entries;Ri("Initial collection from DOM");var o,i,a,u,c,s,l,f=(o=Wu(),i=Vu(),a=o.y,u=o.x,c=Hu(),s=c.clientWidth,l=c.clientHeight,{frame:ni({top:a,left:u,right:u+s,bottom:a+l}),scroll:{initial:o,current:o,max:i,diff:{value:xi,displacement:xi}}}),p=f.scroll.current,d=t.droppable,h=zi(r.droppables).filter(function(e){return e.descriptor.type===d.type}).map(function(e){return e.callbacks.getDimensionAndWatchScroll(p,n)}),m=zi(r.draggables).filter(function(e){return e.descriptor.type===t.draggable.type}).map(function(e){return e.getDimension(p)}),v={draggables:Hi(m),droppables:Wi(h)};return Fi("Initial collection from DOM"),{dimensions:v,critical:t,viewport:f}},Ju=function(e,t){e.critical.draggable.type!==t.type&&Object(je.a)(!1)},Zu=function(e){var t={droppables:{},draggables:{}},n=null,r=function(e){var t=e.getEntries,n=e.callbacks,r=function(){},o={additions:{},removals:{},modified:{}},i=null,a=function(){r(),i||(i=requestAnimationFrame(function(){i=null,n.collectionStarting();var e=n.getCritical();Ri("Publish collection from DOM");var r=t(),a=o,u=a.additions,c=a.removals,s=a.modified,l=gi()(u).map(function(e){return r.draggables[e].getDimension(xi)}).sort(function(e,t){return e.descriptor.index-t.descriptor.index}),f=gi()(s).map(function(t){var n=r.droppables[t];n||Object(je.a)(!1);var o={withoutPlaceholder:!(n.descriptor.id===e.droppable.id)};return n.callbacks.recollect(o)}),p={additions:l,removals:gi()(c),modified:f};o={additions:{},removals:{},modified:{}},Fi("Publish collection from DOM"),n.publish(p)}))};return{add:function(e){o.additions[e.id]=e,o.modified[e.droppableId]=!0,o.removals[e.id]&&delete o.removals[e.id],a()},remove:function(e){o.removals[e.id]=e,o.modified[e.droppableId]=!0,o.additions[e.id]&&delete o.additions[e.id],a()},stop:function(){i&&(cancelAnimationFrame(i),i=null,o={additions:{},removals:{},modified:{}})}}}({callbacks:{publish:e.publishWhileDragging,collectionStarting:e.collectionStarting,getCritical:function(){return n||Object(je.a)(!1),n.critical}},getEntries:function(){return t}});return{registerDraggable:function(e,o){var i={descriptor:e,getDimension:o};t.draggables[e.id]=i,n&&(Ju(n,e),r.add(e))},updateDraggable:function(e,n,r){var o=t.draggables[e.id];o||Object(je.a)(!1),o.descriptor===e&&delete t.draggables[e.id];var i={descriptor:n,getDimension:r};t.draggables[n.id]=i},unregisterDraggable:function(e){var o=t.draggables[e.id];o||Object(je.a)(!1),o.descriptor===e&&(delete t.draggables[e.id],n&&(n.critical.draggable.id===e.id&&Object(je.a)(!1),Ju(n,e),r.remove(e)))},registerDroppable:function(e,r){var o=e.id;t.droppables[o]={descriptor:e,callbacks:r},n&&Object(je.a)(!1)},unregisterDroppable:function(e){var r=t.droppables[e.id];r||Object(je.a)(!1),r.descriptor===e&&(delete t.droppables[e.id],n&&Object(je.a)(!1))},updateDroppableIsEnabled:function(r,o){t.droppables[r]||Object(je.a)(!1),n&&e.updateDroppableIsEnabled({id:r,isEnabled:o})},updateDroppableIsCombineEnabled:function(r,o){t.droppables[r]||Object(je.a)(!1),n&&e.updateDroppableIsCombineEnabled({id:r,isCombineEnabled:o})},scrollDroppable:function(e,r){var o=t.droppables[e];o||Object(je.a)(!1),n&&o.callbacks.scroll(r)},updateDroppableScroll:function(r,o){t.droppables[r]||Object(je.a)(!1),n&&e.updateDroppableScroll({id:r,offset:o})},startPublishing:function(e){n&&Object(je.a)(!1);var r=t.draggables[e.draggableId];r||Object(je.a)(!1);var o=t.droppables[r.descriptor.droppableId];o||Object(je.a)(!1);var i={draggable:r.descriptor,droppable:o.descriptor};return n={critical:i},Gu({critical:i,entries:t,scrollOptions:e.scrollOptions})},stopPublishing:function(){if(n){r.stop();var e=n.critical.droppable;zi(t.droppables).filter(function(t){return t.descriptor.type===e.type}).forEach(function(e){return e.callbacks.dragStopped()}),n=null}}}},Yu=function(e,t){return"IDLE"===e.phase||"DROP_ANIMATING"===e.phase&&(e.completed.result.draggableId!==t&&"DROP"===e.completed.result.reason)},Ku=function(e){window.scrollBy(e.x,e.y)},Xu=di(function(e){return Vi(e).filter(function(e){return!!e.isEnabled&&!!e.frame})}),Qu=function(e){var t=e.center,n=e.destination,r=e.droppables;if(n){var o=r[n];return o.frame?o:null}return function(e,t){return qi(Xu(t),function(t){return t.frame||Object(je.a)(!1),Zi(t.frame.pageMarginBox)(e)})}(t,r)},$u=.25,ec=.05,tc=28,nc=function(e){return Math.pow(e,2)},rc={stopDampeningAt:1200,accelerateAt:360},oc=function(e){var t=e.startOfRange,n=e.endOfRange,r=e.current,o=n-t;return 0===o?0:(r-t)/o},ic=rc.accelerateAt,ac=rc.stopDampeningAt,uc=function(e){var t=e.distanceToEdge,n=e.thresholds,r=e.dragStartTime,o=e.shouldUseTimeDampening,i=function(e,t){if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return tc;if(e===t.startScrollingFrom)return 1;var n=oc({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),r=tc*nc(1-n);return Math.ceil(r)}(t,n);return 0===i?0:o?Math.max(function(e,t){var n=t,r=ac,o=bi()()-n;if(o>=ac)return e;if(o<ic)return 1;var i=oc({startOfRange:ic,endOfRange:r,current:o}),a=e*nc(i);return Math.ceil(a)}(i,r),1):i},cc=function(e){var t=e.container,n=e.distanceToEdges,r=e.dragStartTime,o=e.axis,i=e.shouldUseTimeDampening,a=function(e,t){return{startScrollingFrom:e[t.size]*$u,maxScrollValueAt:e[t.size]*ec}}(t,o);return n[o.end]<n[o.start]?uc({distanceToEdge:n[o.end],thresholds:a,dragStartTime:r,shouldUseTimeDampening:i}):-1*uc({distanceToEdge:n[o.start],thresholds:a,dragStartTime:r,shouldUseTimeDampening:i})},sc=Ni(function(e){return 0===e?0:e}),lc=function(e){var t=e.dragStartTime,n=e.container,r=e.subject,o=e.center,i=e.shouldUseTimeDampening,a={top:o.y-n.top,right:n.right-o.x,bottom:n.bottom-o.y,left:o.x-n.left},u=cc({container:n,distanceToEdges:a,dragStartTime:t,axis:Ki,shouldUseTimeDampening:i}),c=cc({container:n,distanceToEdges:a,dragStartTime:t,axis:Xi,shouldUseTimeDampening:i}),s=sc({x:c,y:u});if(Ci(s,xi))return null;var l=function(e){var t=e.container,n=e.subject,r=e.proposedScroll,o=n.height>t.height,i=n.width>t.width;return i||o?i&&o?null:{x:i?0:r.x,y:o?0:r.y}:r}({container:n,subject:r,proposedScroll:s});return l?Ci(l,xi)?null:l:null},fc=Ni(function(e){return 0===e?0:e>0?1:-1}),pc=(Ka=function(e,t){return e<0?e:e>t?e-t:0},function(e){var t=e.current,n=e.max,r=e.change,o=ki(t,r),i={x:Ka(o.x,n.x),y:Ka(o.y,n.y)};return Ci(i,xi)?null:i}),dc=function(e){var t=e.max,n=e.current,r=e.change,o={x:Math.max(n.x,t.x),y:Math.max(n.y,t.y)},i=fc(r),a=pc({max:o,current:n,change:i});return!a||(0!==i.x&&0===a.x||0!==i.y&&0===a.y)},hc=function(e,t){return dc({current:e.scroll.current,max:e.scroll.max,change:t})},mc=function(e,t){var n=e.frame;return!!n&&dc({current:n.scroll.current,max:n.scroll.max,change:t})},vc=function(e){var t=e.state,n=e.dragStartTime,r=e.shouldUseTimeDampening,o=e.scrollWindow,i=e.scrollDroppable,a=t.current.page.borderBoxCenter,u=t.dimensions.draggables[t.critical.draggable.id].page.marginBox;if(t.isWindowScrollAllowed){var c=function(e){var t=e.viewport,n=e.subject,r=e.center,o=e.dragStartTime,i=e.shouldUseTimeDampening,a=lc({dragStartTime:o,container:t.frame,subject:n,center:r,shouldUseTimeDampening:i});return a&&hc(t,a)?a:null}({dragStartTime:n,viewport:t.viewport,subject:u,center:a,shouldUseTimeDampening:r});if(c)return void o(c)}var s=Qu({center:a,destination:Bi(t.impact),droppables:t.dimensions.droppables});if(s){var l=function(e){var t=e.droppable,n=e.subject,r=e.center,o=e.dragStartTime,i=e.shouldUseTimeDampening,a=t.frame;if(!a)return null;var u=lc({dragStartTime:o,container:a.pageMarginBox,subject:n,center:r,shouldUseTimeDampening:i});return u&&mc(t,u)?u:null}({dragStartTime:n,droppable:s,subject:u,center:a,shouldUseTimeDampening:r});l&&i(s.descriptor.id,l)}},gc=function(e){var t=e.move,n=e.scrollDroppable,r=e.scrollWindow,o=function(e,t){if(!mc(e,t))return t;var r=function(e,t){var n=e.frame;return n&&mc(e,t)?pc({current:n.scroll.current,max:n.scroll.max,change:t}):null}(e,t);if(!r)return n(e.descriptor.id,t),null;var o=Si(t,r);return n(e.descriptor.id,o),Si(t,o)},i=function(e,t,n){if(!e)return n;if(!hc(t,n))return n;var o=function(e,t){if(!hc(e,t))return null;var n=e.scroll.max,r=e.scroll.current;return pc({current:r,max:n,change:t})}(t,n);if(!o)return r(n),null;var i=Si(n,o);return r(i),Si(n,i)};return function(e){var n=e.scrollJumpRequest;if(n){var r=Bi(e.impact);r||Object(je.a)(!1);var a=o(e.dimensions.droppables[r],n);if(a){var u=e.viewport,c=i(e.isWindowScrollAllowed,u,a);c&&function(e,n){var r=ki(e.current.client.selection,n);t({client:r})}(e,c)}}}},yc=function(e){var t=e.scrollDroppable,n=e.scrollWindow,r=e.move,o=function(e){var t=e.scrollWindow,n=e.scrollDroppable,r=wi(t),o=wi(n),i=null,a=function(e){i||Object(je.a)(!1);var t=i,n=t.shouldUseTimeDampening,a=t.dragStartTime;vc({state:e,scrollWindow:r,scrollDroppable:o,dragStartTime:a,shouldUseTimeDampening:n})},u=function(){i||Object(je.a)(!1),r.cancel(),o.cancel()};return{start:function(e){Ri("starting fluid scroller"),i&&Object(je.a)(!1);var t=bi()(),n=!1,r=function(){n=!0};vc({state:e,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:r,scrollDroppable:r}),i={dragStartTime:t,shouldUseTimeDampening:n},Fi("starting fluid scroller"),n&&a(e)},stop:function(){i&&(u(),i=null)},cancelPending:u,scroll:a}}({scrollWindow:n,scrollDroppable:t}),i=gc({move:r,scrollWindow:n,scrollDroppable:t});return{scroll:function(e){"DRAGGING"===e.phase&&("FLUID"!==e.movementMode?e.scrollJumpRequest&&i(e):o.scroll(e))},cancelPending:o.cancelPending,start:o.start,stop:o.stop}},bc="data-react-beautiful-dnd",wc=bc+"-drag-handle",Oc=bc+"-draggable",Ec=bc+"-droppable",xc=function(e,t){return e.map(function(e){var n=e.styles[t];return n?e.selector+" { "+n+" }":""}).join(" ")},kc=function(e){var t,n,r,o=(t=e,function(e){return"["+e+'="'+t+'"]'}),i=(n="\n cursor: -webkit-grab;\n cursor: grab;\n ",{selector:o(wc),styles:{always:"\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n ",resting:n,dragging:"pointer-events: none;",dropAnimating:n}}),a=[(r="\n transition: "+wu.outOfTheWay+";\n ",{selector:o(Oc),styles:{dragging:r,dropAnimating:r,userCancel:r}}),i,{selector:o(Ec),styles:{always:"overflow-anchor: none;"}},{selector:"body",styles:{dragging:"\n cursor: grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n overflow-anchor: none;\n "}}];return{always:xc(a,"always"),resting:xc(a,"resting"),dragging:xc(a,"dragging"),dropAnimating:xc(a,"dropAnimating"),userCancel:xc(a,"userCancel")}},Sc="undefined"!=typeof window?r.useLayoutEffect:r.useEffect,Cc=function(){var e=document.querySelector("head");return e||Object(je.a)(!1),e},jc=function(){var e=document.createElement("style");return e.type="text/css",e};var _c=o.a.createContext(null),Ic=function(){var e=document.body;return e||Object(je.a)(!1),e},Tc={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},Nc=function(e){return"react-beautiful-dnd-announcement-"+e};var Ac=o.a.createContext(null);function Pc(e){var t=Object(r.useRef)(e);return Object(r.useEffect)(function(){t.current=e}),t}var Dc=function(e){return{onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}};function Mc(e){return e.current||Object(je.a)(!1),e.current}function Lc(e){var t=e.uniqueId,n=e.setOnError,i=Object(r.useRef)(null);Object(r.useEffect)(function(){},[]);var a=Pc(e),u=Vr(function(){return Dc(a.current)},[a]),c=function(e){var t=Hr(function(){return Nc(e)},[e]),n=Object(r.useRef)(null);return Object(r.useEffect)(function(){n.current&&Object(je.a)(!1);var e=document.createElement("div");return n.current=e,e.id=t,e.setAttribute("aria-live","assertive"),e.setAttribute("role","log"),e.setAttribute("aria-atomic","true"),Ur()(e.style,Tc),Ic().appendChild(e),function(){var e=n.current;e||Object(je.a)(!1),Ic().removeChild(e),n.current=null}},[t]),Vr(function(e){var t=n.current;t&&(t.textContent=e)},[])}(t),s=function(e){var t=Hr(function(){return""+e},[e]),n=Hr(function(){return kc(t)},[t]),o=Object(r.useRef)(null),i=Object(r.useRef)(null),a=Vr(di(function(e){var t=i.current;t||Object(je.a)(!1),t.textContent=e}),[]),u=Vr(function(e){var t=o.current;t||Object(je.a)(!1),t.textContent=e},[]);Sc(function(){(o.current||i.current)&&Object(je.a)(!1);var e=jc(),r=jc();return o.current=e,i.current=r,e.setAttribute(bc+"-always",t),r.setAttribute(bc+"-dynamic",t),Cc().appendChild(e),Cc().appendChild(r),u(n.always),a(n.resting),function(){var e=function(e){var t=e.current;t||Object(je.a)(!1),Cc().removeChild(t),e.current=null};e(o),e(i)}},[u,a,n.always,n.resting,t]);var c=Vr(function(){return a(n.dragging)},[a,n.dragging]),s=Vr(function(e){a("DROP"!==e?n.userCancel:n.dropAnimating)},[a,n.dropAnimating,n.userCancel]),l=Vr(function(){i.current&&a(n.resting)},[a,n.resting]);return Hr(function(){return{dragging:c,dropping:s,resting:l,styleContext:t}},[c,s,l,t])}(t),l=Vr(function(e){Mc(i).dispatch(e)},[]),f=Hr(function(){return to({publishWhileDragging:uu,updateDroppableScroll:su,updateDroppableIsEnabled:lu,updateDroppableIsCombineEnabled:fu,collectionStarting:cu},l)},[l]),p=Hr(function(){return Zu(f)},[f]),d=Hr(function(){return yc(qr({scrollWindow:Ku,scrollDroppable:p.scrollDroppable},to({move:pu},l)))},[p.scrollDroppable,l]),h=Hr(function(){return qu({dimensionMarshal:p,styleMarshal:s,announce:c,autoScroller:d,getResponders:u})},[c,d,p,u,s]);i.current=h;var m=Vr(function(){var e=Mc(i);"IDLE"!==e.getState().phase&&e.dispatch(du({shouldFlush:!0}))},[]);n(m);var v=Vr(function(e){return Yu(Mc(i).getState(),e)},[]),g=Vr(function(){return Ya(Mc(i).getState())},[]),y=Hr(function(){return{marshal:p,style:s.styleContext,canLift:v,isMovementAllowed:g}},[p,v,g,s.styleContext]);return Object(r.useEffect)(function(){return m},[m]),o.a.createElement(Ac.Provider,{value:y},o.a.createElement(po,{context:_c,store:h},e.children))}var Rc=0;function Fc(e){var t=Hr(function(){return Rc++},[]);return o.a.createElement(Ei,null,function(n){return o.a.createElement(Lc,qr({setOnError:n,uniqueId:t},e),e.children)})}var Bc=function(e){return function(t){return e===t}},zc=Bc("scroll"),Uc=Bc("auto"),qc=(Bc("visible"),function(e,t){return t(e.overflowX)||t(e.overflowY)}),Wc=function(e){var t=window.getComputedStyle(e),n={overflowX:t.overflowX,overflowY:t.overflowY};return qc(n,zc)||qc(n,Uc)},Hc=function e(t){return null==t?null:t===document.body?null:t===document.documentElement?null:Wc(t)?t:e(t.parentElement)},Vc=function(e){return{x:e.scrollLeft,y:e.scrollTop}},Gc=function(e){return{closestScrollable:Hc(e),isFixedOnPage:function e(t){return!!t&&("fixed"===window.getComputedStyle(t).position||e(t.parentElement))}(e)}},Jc=function(e){var t=e.ref,n=e.descriptor,r=e.env,o=e.windowScroll,i=e.direction,a=e.isDropDisabled,u=e.isCombineEnabled,c=e.shouldClipSubject,s=r.closestScrollable,l=function(e,t){var n=fi(e);if(!t)return n;if(e!==t)return n;var r=n.paddingBox.top-t.scrollTop,o=n.paddingBox.left-t.scrollLeft,i=r+t.scrollHeight,a=o+t.scrollWidth,u=ri({top:r,right:a,bottom:i,left:o},n.border);return ai({borderBox:u,margin:n.margin,border:n.border,padding:n.padding})}(t,s),f=si(l,o),p=function(){if(!s)return null;var e=fi(s),t={scrollHeight:s.scrollHeight,scrollWidth:s.scrollWidth};return{client:e,page:si(e,o),scroll:Vc(s),scrollSize:t,shouldClipSubject:c}}();return ba({descriptor:n,isEnabled:!a,isCombineEnabled:u,isFixedOnPage:r.isFixedOnPage,direction:i,client:l,page:f,closest:p})};var Zc={passive:!1},Yc={passive:!0},Kc=function(e){return e.shouldPublishImmediately?Zc:Yc};function Xc(e){var t=Object(r.useContext)(e);return t||Object(je.a)(!1),t}var Qc=function(e){return e&&e.env.closestScrollable||null};function $c(){}var es={width:0,height:0,margin:{top:0,right:0,bottom:0,left:0}},ts=function(e){var t=e.isAnimatingOpenOnMount,n=e.placeholder,r=function(e){var t=e.isAnimatingOpenOnMount,n=e.placeholder,r=e.animate;return t?es:"close"===r?es:{height:n.client.borderBox.height,width:n.client.borderBox.width,margin:n.client.margin}}({isAnimatingOpenOnMount:t,placeholder:n,animate:e.animate});return{display:n.display,boxSizing:"border-box",width:r.width,height:r.height,marginTop:r.margin.top,marginRight:r.margin.right,marginBottom:r.margin.bottom,marginLeft:r.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:wu.placeholder}};var ns=o.a.memo(function(e){var t=Object(r.useRef)(null),n=Vr(function(){t.current&&(clearTimeout(t.current),t.current=null)},[]),i=e.animate,a=e.onTransitionEnd,u=e.onClose,c=e.styleContext,s=Object(r.useState)("open"===e.animate),l=s[0],f=s[1];Object(r.useEffect)(function(){return l?"open"!==i?(n(),f(!1),$c):t.current?$c:(t.current=setTimeout(function(){t.current=null,f(!1)}),n):$c},[i,l,n]);var p=Vr(function(e){"height"===e.propertyName&&(a(),"close"===i&&u())},[i,u,a]),d=ts({isAnimatingOpenOnMount:l,animate:e.animate,placeholder:e.placeholder});return o.a.createElement(e.placeholder.tagName,{style:d,"data-react-beautiful-dnd-placeholder":c,onTransitionEnd:p,ref:e.innerRef})}),rs=o.a.createContext(null),os=function(e){return e&&e.ownerDocument?e.ownerDocument.defaultView:window};function is(e){return e instanceof os(e).HTMLElement}var as=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state={isVisible:Boolean(t.props.on),data:t.props.on,animate:t.props.shouldAnimate&&t.props.on?"open":"none"},t.onClose=function(){"close"===t.state.animate&&t.setState({isVisible:!1})},t}return Zr(t,e),t.getDerivedStateFromProps=function(e,t){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:t.isVisible?{isVisible:!0,data:t.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:Boolean(e.on),data:e.on,animate:"none"}},t.prototype.render=function(){if(!this.state.isVisible)return null;var e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)},t}(o.a.PureComponent);var us=function(e,t){return e===t},cs=function(e){var t=e.combine,n=e.destination;return n?n.droppableId:t?t.droppableId:null},ss=function(e,t){return e===t.droppable.type},ls=function(e,t){return t.draggables[e.draggable.id]},fs=ti(function(){var e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null}},t=qr({},e,{shouldAnimatePlaceholder:!1}),n=di(function(t,n,r,o){return r.descriptor.droppableId===t?{placeholder:r.placeholder,shouldAnimatePlaceholder:!1,snapshot:o}:n?{placeholder:r.placeholder,shouldAnimatePlaceholder:!0,snapshot:o}:e}),r=di(function(e,t,n){var r=n.descriptor.id;return{isDraggingOver:t,draggingOverWith:t?r:null,draggingFromThisWith:n.descriptor.droppableId===e?r:null}});return function(o,i){var a=i.droppableId,u=i.type;if(o.isDragging){var c=o.critical;if(!ss(u,c))return e;var s=ls(c,o.dimensions),l=Bi(o.impact)===a,f=r(a,l,s);return n(a,l,s,f)}if("DROP_ANIMATING"===o.phase){var p=o.completed;if(!ss(u,p.critical))return e;var d=ls(p.critical,o.dimensions),h=r(a,cs(p.result)===a,d);return n(a,Bi(p.impact)===a,d,h)}if("IDLE"===o.phase&&!o.completed&&o.shouldFlush)return t;if("IDLE"===o.phase&&o.completed){var m=o.completed;if(!ss(u,m.critical))return e;var v=Bi(m.impact)===a,g=Boolean(m.impact.merge);return o.shouldFlush?t:v?g?e:t:e}return e}},{updateViewportMaxScroll:function(e){return{type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}}},null,{context:_c,pure:!0,areStatePropsEqual:us})(function(e){var t=Object(r.useContext)(Ac);t||Object(je.a)(!1);var n,i,a,u,c,s,l,f,p,d,h,m,v,g,y,b,w=t.style,O=t.isMovementAllowed,E=Object(r.useRef)(null),x=Object(r.useRef)(null),k=e.children,S=e.droppableId,C=e.type,j=e.direction,_=e.ignoreContainerClipping,I=e.isDropDisabled,T=e.isCombineEnabled,N=e.snapshot,A=e.updateViewportMaxScroll,P=Vr(function(){return E.current},[]),D=Vr(function(){return x.current},[]),M=Vr(function(e){E.current=e},[]),L=Vr(function(e){x.current=e},[]),R=Vr(function(){O()&&A({maxScroll:Vu()})},[O,A]);n={droppableId:S,type:C,direction:j,isDropDisabled:I,isCombineEnabled:T,ignoreContainerClipping:_,getDroppableRef:P,getPlaceholderRef:D},i=Object(r.useRef)(null),a=Xc(Ac).marshal,u=Pc(n),c=Hr(function(){return{id:n.droppableId,type:n.type}},[n.droppableId,n.type]),s=Object(r.useRef)(c),l=Hr(function(){return di(function(e,t){i.current||Object(je.a)(!1);var n={x:e,y:t};a.updateDroppableScroll(c.id,n)})},[c.id,a]),f=Vr(function(){var e=i.current;return e&&e.env.closestScrollable?Vc(e.env.closestScrollable):xi},[]),p=Vr(function(){var e=f();l(e.x,e.y)},[f,l]),d=Hr(function(){return wi(p)},[p]),h=Vr(function(){var e=i.current,t=Qc(e);e&&t||Object(je.a)(!1),e.scrollOptions.shouldPublishImmediately?p():d()},[d,p]),m=Vr(function(e,t){i.current&&Object(je.a)(!1);var n=u.current,r=n.getDroppableRef();r||Object(je.a)(!1);var o=Gc(r),a={ref:r,descriptor:c,env:o,scrollOptions:t};i.current=a;var s=Jc({ref:r,descriptor:c,env:o,windowScroll:e,direction:n.direction,isDropDisabled:n.isDropDisabled,isCombineEnabled:n.isCombineEnabled,shouldClipSubject:!n.ignoreContainerClipping});return o.closestScrollable&&o.closestScrollable.addEventListener("scroll",h,Kc(a.scrollOptions)),s},[c,h,u]),v=Vr(function(e){var t=i.current,n=Qc(t);t&&n||Object(je.a)(!1);var r=u.current,o=function(){return Jc({ref:t.ref,descriptor:t.descriptor,env:t.env,windowScroll:xi,direction:r.direction,isDropDisabled:r.isDropDisabled,isCombineEnabled:r.isCombineEnabled,shouldClipSubject:!r.ignoreContainerClipping})};return e.withoutPlaceholder?function(e,t){if(!e)return t();var n=e.style.display;e.style.display="none";var r=t();return e.style.display=n,r}(r.getPlaceholderRef(),o):o()},[u]),g=Vr(function(){var e=i.current;e||Object(je.a)(!1);var t=Qc(e);i.current=null,t&&(d.cancel(),t.removeEventListener("scroll",h,Kc(e.scrollOptions)))},[h,d]),y=Vr(function(e){var t=i.current;t||Object(je.a)(!1);var n=Qc(t);n||Object(je.a)(!1),n.scrollTop+=e.y,n.scrollLeft+=e.x},[]),b=Hr(function(){return{getDimensionAndWatchScroll:m,recollect:v,dragStopped:g,scroll:y}},[g,m,v,y]),Sc(function(){return s.current=c,a.registerDroppable(c,b),function(){i.current&&g(),a.unregisterDroppable(c)}},[b,c,g,a]),Sc(function(){i.current&&a.updateDroppableIsEnabled(s.current.id,!n.isDropDisabled)},[n.isDropDisabled,a]),Sc(function(){i.current&&a.updateDroppableIsCombineEnabled(s.current.id,n.isCombineEnabled)},[n.isCombineEnabled,a]);var F=o.a.createElement(as,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},function(e){var t=e.onClose,n=e.data,r=e.animate;return o.a.createElement(ns,{placeholder:n,onClose:t,innerRef:L,animate:r,styleContext:w,onTransitionEnd:R})}),B=Hr(function(){return{innerRef:M,placeholder:F,droppableProps:{"data-react-beautiful-dnd-droppable":w}}},[F,M,w]),z=Hr(function(){return{droppableId:S,type:C}},[S,C]);return function(e){e.props,e.getDroppableRef,e.getPlaceholderRef,Object(r.useEffect)(function(){})}({props:e,getDroppableRef:function(){return E.current},getPlaceholderRef:function(){return x.current}}),o.a.createElement(rs.Provider,{value:z},k(B,N))});fs.defaultProps={type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1};var ps={dragging:5e3,dropAnimating:4500},ds=function(e,t){return t?wu.drop(t.duration):e?wu.snap:wu.fluid},hs=function(e,t){return e?t?gu.drop:gu.combining:null},ms=function(e){return null!=e.forceShouldAnimate?e.forceShouldAnimate:"SNAP"===e.mode};function vs(e){return"DRAGGING"===e.type?(r=(n=e).dimension.client,o=n.offset,i=n.combineWith,a=n.dropping,u=Boolean(i),c=ms(n),s=Boolean(a),l=s?Eu.drop(o,u):Eu.moveTo(o),{position:"fixed",top:r.marginBox.top,left:r.marginBox.left,boxSizing:"border-box",width:r.borderBox.width,height:r.borderBox.height,transition:ds(c,a),transform:l,opacity:hs(u,s),zIndex:s?ps.dropAnimating:ps.dragging,pointerEvents:"none"}):(t=e,{transform:Eu.moveTo(t.offset),transition:t.shouldAnimateDisplacement?null:"none"});var t,n,r,o,i,a,u,c,s,l}var gs,ys,bs=function(){var e=!1;return{handle:function(){e&&Object(je.a)(!1),e=!0},isHandled:function(){return e},reset:function(){e=!1}}},ws=function(e,t){return qr({},e,t)},Os=function(e,t,n){t.forEach(function(t){var r=ws(n,t.options);e.addEventListener(t.eventName,t.fn,r)})},Es=function(e,t,n){t.forEach(function(t){var r=ws(n,t.options);e.removeEventListener(t.eventName,t.fn,r)})},xs=function(e){var t=di(function(t,n){var r={x:t,y:n};e.onMove(r)}),n=wi(function(e){return t(e.x,e.y)}),r=wi(e.onMoveUp),o=wi(e.onMoveDown),i=wi(e.onMoveRight),a=wi(e.onMoveLeft),u=wi(e.onWindowScroll);return{move:n,moveUp:r,moveDown:o,moveRight:i,moveLeft:a,windowScrollMove:u,cancel:function(){n.cancel(),r.cancel(),o.cancel(),i.cancel(),a.cancel(),u.cancel()}}},ks=27,Ss=32,Cs=37,js=38,_s=39,Is=40,Ts=(gs="visibilitychange","undefined"==typeof document?gs:qi([gs,"ms"+gs,"webkit"+gs,"moz"+gs,"o"+gs],function(e){return"on"+e in document})||gs),Ns={capture:!0},As=function(e){var t=!1,n=function(){t&&(t=!1,Es(e(),r,Ns))},r=[{eventName:"click",fn:function(e){e.preventDefault(),n()}},{eventName:"mousedown",fn:n},{eventName:"touchstart",fn:n}];return{preventNext:function(){t&&n(),t||(t=!0,Os(e(),r,Ns))},abort:n}},Ps=function(e,t){return Math.abs(t.x-e.x)>=5||Math.abs(t.y-e.y)>=5},Ds=((ys={})[13]=!0,ys[9]=!0,ys),Ms=function(e){Ds[e.keyCode]&&e.preventDefault()},Ls=0,Rs=function(){},Fs=bs();function Bs(e){return e instanceof os(e).Element}var zs,Us={input:!0,button:!0,textarea:!0,select:!0,option:!0,optgroup:!0,video:!0,audio:!0},qs=function(e,t){if(t)return!0;var n=e.target,r=e.currentTarget;return!Bs(n)||!Bs(r)||!function e(t,n){if(null==n)return!1;if(Boolean(Us[n.tagName.toLowerCase()]))return!0;var r=n.getAttribute("contenteditable");return"true"===r||""===r||n!==t&&e(t,n.parentElement)}(r,n)},Ws=function(e){return ni(e.getBoundingClientRect()).center},Hs=((zs={})[34]=!0,zs[33]=!0,zs[36]=!0,zs[35]=!0,zs);function Vs(){}var Gs=150,Js=.15,Zs=bs(),Ys=function(){},Ks=function(){var e={preventTouchMove:Ys,releaseTouchMove:Ys};if("undefined"==typeof window)return e;if(!("ontouchstart"in window))return e;var t=!1;window.addEventListener("touchmove",function(e){t&&(e.defaultPrevented||e.preventDefault())},{passive:!1,capture:!1});return{preventTouchMove:function(){t=!0},releaseTouchMove:function(){t=!1}}}();var Xs="["+wc+"]",Qs=function(e){!function(e){return Boolean(os(e).SVGElement)&&e instanceof os(e).SVGElement}(e)||Object(je.a)(!1)},$s=function(e){if(e.hasAttribute(wc))return Qs(e),e;var t=e.querySelector(Xs);return Qs(e),t||Object(je.a)(!1),is(t)||Object(je.a)(!1),t};var el,tl,nl,rl,ol=null,il={capture:!0},al=(el=!1,tl=function(){el&&(el=!1,window.removeEventListener("focus",nl,il))},nl=function(){tl(),ol=null},(rl=function(){el||(el=!0,window.addEventListener("focus",nl,il))}).cancel=function(){return tl()},rl),ul={retain:function(e){ol=e,al()},tryRestoreFocus:function(e,t){if(ol&&e===ol){ol=null,al.cancel();var n=$s(t);n&&n.focus()}}};function cl(){}function sl(e){e.preventDefault()}function ll(e){var t=Object(r.useRef)(null),n=Vr(function(e){t.current&&Object(je.a)(!1),t.current={abort:e}},[]),o=Vr(function(){t.current||Object(je.a)(!1),t.current=null},[]),i=Vr(function(){t.current||Object(je.a)(!1),t.current.abort()},[]),a=Xc(Ac),u=a.canLift,c=a.style,s=e.isDragging,l=e.isEnabled,f=e.draggableId,p=e.callbacks,d=e.getDraggableRef,h=e.getShouldRespectForcePress,m=e.canDragInteractiveElements,v=Pc(e);!function(e){var t=e.isEnabled,n=e.getDraggableRef;Object(r.useEffect)(function(){},[n,t])}({isEnabled:l,getDraggableRef:d});var g=Vr(function(){return os(d())},[d]),y=Vr(function(e){return!!l&&(!t.current&&(!!u(f)&&qs(e,m)))},[m,u,f,l]),b=function(e){var t=Object(r.useRef)(!1),n=Pc(e),o=e.getDraggableRef,i=Vr(function(){t.current=!0},[]),a=Vr(function(){t.current=!1},[]);Sc(function(){var e=n.current;if(!e.isEnabled)return cl;var r=o();r||Object(je.a)(!1);var i=$s(r);return ul.tryRestoreFocus(e.draggableId,i),function(){var e=n.current;e.isEnabled&&t.current&&(e.isDragging||e.isDropAnimating)&&ul.retain(e.draggableId)}},[o,n]);var u=Object(r.useRef)(null);return Sc(function(){if(u.current){var e=o();e&&e!==u.current&&t.current&&n.current.isEnabled&&$s(e).focus()}}),Sc(function(){u.current=o()}),{onBlur:a,onFocus:i}}(e),w=b.onBlur,O=b.onFocus,E=function(e){var t=e.canStartCapturing,n=e.getWindow,o=e.callbacks,i=e.getShouldRespectForcePress,a=e.onCaptureStart,u=e.onCaptureEnd,c=Object(r.useRef)(null),s=Object(r.useRef)(!1),l=Object(r.useRef)(Rs),f=Vr(function(){return Boolean(c.current||s.current)},[]),p=Hr(function(){return f()&&Object(je.a)(!1),xs(o)},[o,f]),d=Hr(function(){return As(n)},[n]),h=Vr(function(){if(f()){p.cancel(),l.current();var e=s.current;Fs.reset(),e&&d.preventNext(),c.current=null,s.current=!1,u()}},[f,u,d,p]),m=Vr(function(){var e=s.current;h(),e&&o.onCancel()},[o,h]),v=Vr(function(){s.current&&Object(je.a)(!1);var e=c.current;e||Object(je.a)(!1),c.current=null,s.current=!0,o.onLift({clientSelection:e,movementMode:"FLUID"})},[o]),g=Hr(function(){return f()&&Object(je.a)(!1),[{eventName:"mousemove",fn:function(e){var t=e.button,n=e.clientX,r=e.clientY;if(t===Ls){var o={x:n,y:r};if(s.current)return e.preventDefault(),void p.move(o);var i=c.current;i||(h(),Object(je.a)(!1)),Ps(i,o)&&(e.preventDefault(),v())}}},{eventName:"mouseup",fn:function(e){var t=s.current;h(),t&&(e.preventDefault(),o.onDrop())}},{eventName:"mousedown",fn:function(e){s.current&&e.preventDefault(),m()}},{eventName:"keydown",fn:function(e){if(!c.current)return e.keyCode===ks?(e.preventDefault(),void m()):void Ms(e);h()}},{eventName:"resize",fn:m},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(e){e.currentTarget===n()&&(c.current?h():p.windowScrollMove())}},{eventName:"webkitmouseforcechanged",fn:function(e){if(null!=e.webkitForce&&null!=MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN){var t=MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN,n=e.webkitForce>=t;i()?n&&m():e.preventDefault()}}},{eventName:Ts,fn:m}]},[f,m,v,p,h,o,n,i]),y=Vr(function(){var e=n(),t={capture:!0};l.current=function(){return Es(e,g,t)},Os(e,g,t)},[n,g]),b=Vr(function(e){c.current&&Object(je.a)(!1),c.current=e,a(h),y()},[y,a,h]);return Vr(function(e){if(!Fs.isHandled()&&(f()&&Object(je.a)(!1),t(e)&&e.button===Ls&&!(e.ctrlKey||e.metaKey||e.shiftKey||e.altKey))){Fs.handle(),e.preventDefault();var n={x:e.clientX,y:e.clientY};b(n)}},[t,f,b])}(Hr(function(){return{callbacks:p,getDraggableRef:d,getWindow:g,canStartCapturing:y,onCaptureStart:n,onCaptureEnd:o,getShouldRespectForcePress:h}},[p,d,g,y,n,o,h])),x=function(e){var t=e.canStartCapturing,n=e.getWindow,o=e.callbacks,i=e.onCaptureStart,a=e.onCaptureEnd,u=e.getDraggableRef,c=Object(r.useRef)(!1),s=Object(r.useRef)(Vs),l=Vr(function(){return c.current},[]),f=Hr(function(){return l()&&Object(je.a)(!1),xs(o)},[o,l]),p=Vr(function(){l()&&(f.cancel(),s.current(),c.current=!1,a())},[l,a,f]),d=Vr(function(){var e=c.current;p(),e&&o.onCancel()},[o,p]),h=Hr(function(){return l()&&Object(je.a)(!1),[{eventName:"mousedown",fn:d},{eventName:"mouseup",fn:d},{eventName:"click",fn:d},{eventName:"touchstart",fn:d},{eventName:"resize",fn:d},{eventName:"wheel",fn:d,options:{passive:!0}},{eventName:"scroll",options:{capture:!1},fn:function(e){e.currentTarget===n()&&o.onWindowScroll()}},{eventName:Ts,fn:d}]},[o,d,l,n]),m=Vr(function(){var e=n(),t={capture:!0};s.current=function(){return Es(e,h,t)},Os(e,h,t)},[n,h]),v=Vr(function(){c.current&&Object(je.a)(!1);var e=u();e||Object(je.a)(!1),c.current=!0,i(p),m();var t=Ws(e);o.onLift({clientSelection:t,movementMode:"SNAP"})},[m,o,u,i,p]);return Vr(function(e){if(!l()){if(e.defaultPrevented)return;if(!t(e))return;if(e.keyCode!==Ss)return;return e.preventDefault(),void v()}return e.keyCode===ks?(e.preventDefault(),void d()):e.keyCode===Ss?(e.preventDefault(),p(),void o.onDrop()):e.keyCode===Is?(e.preventDefault(),void f.moveDown()):e.keyCode===js?(e.preventDefault(),void f.moveUp()):e.keyCode===_s?(e.preventDefault(),void f.moveRight()):e.keyCode===Cs?(e.preventDefault(),void f.moveLeft()):void(Hs[e.keyCode]?e.preventDefault():Ms(e))},[o,t,d,l,f,v,p])}(Hr(function(){return{callbacks:p,getDraggableRef:d,getWindow:g,canStartCapturing:y,onCaptureStart:n,onCaptureEnd:o}},[p,y,d,g,o,n])),k=function(e){var t=e.callbacks,n=e.getWindow,o=e.canStartCapturing,i=e.getShouldRespectForcePress,a=e.onCaptureStart,u=e.onCaptureEnd,c=Object(r.useRef)(null),s=Object(r.useRef)(!1),l=Object(r.useRef)(!1),f=Object(r.useRef)(Ys),p=Vr(function(){return Boolean(c.current||s.current)},[]),d=Hr(function(){return As(n)},[n]),h=Hr(function(){return p()&&Object(je.a)(!1),xs(t)},[t,p]),m=Vr(function(){if(p()){if(h.cancel(),f.current(),Zs.reset(),Ks.releaseTouchMove(),l.current=!1,u(),s.current)return d.preventNext(),void(s.current=!1);var e=c.current;e||Object(je.a)(!1),clearTimeout(e.longPressTimerId),c.current=null}},[p,u,d,h]),v=Vr(function(){var e=s.current;m(),e&&t.onCancel()},[t,m]),g=Hr(function(){return p()&&Object(je.a)(!1),[{eventName:"touchmove",options:{passive:!1,capture:!1},fn:function(e){if(s.current){l.current||(l.current=!0);var t=e.touches[0],n={x:t.clientX,y:t.clientY};e.preventDefault(),h.move(n)}else m()}},{eventName:"touchend",fn:function(e){s.current?(e.preventDefault(),m(),t.onDrop()):m()}},{eventName:"touchcancel",fn:function(e){s.current?(e.preventDefault(),v()):m()}},{eventName:"touchstart",fn:v},{eventName:"orientationchange",fn:v},{eventName:"resize",fn:v},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(){c.current?m():h.windowScrollMove()}},{eventName:"contextmenu",fn:function(e){e.preventDefault()}},{eventName:"keydown",fn:function(e){s.current?(e.keyCode===ks&&e.preventDefault(),v()):v()}},{eventName:"touchforcechange",fn:function(e){i()?l.current?e.preventDefault():e.touches[0].force>=Js&&v():e.preventDefault()}},{eventName:Ts,fn:v}]},[t,v,p,i,h,m]),y=Vr(function(){var e=n(),t={capture:!0};f.current=function(){return Es(e,g,t)},Os(e,g,t)},[n,g]),b=Vr(function(){var e=c.current;e||Object(je.a)(!1),s.current=!0,c.current=null,l.current=!1,t.onLift({clientSelection:e.point,movementMode:"FLUID"})},[t]),w=Vr(function(e){c.current&&Object(je.a)(!1);var t=e.touches[0],n={point:{x:t.clientX,y:t.clientY},longPressTimerId:setTimeout(b,Gs)};c.current=n,a(m),y()},[y,a,b,m]);return function(e){Zs.isHandled()||(p()&&Object(je.a)(!1),o(e)&&(Zs.handle(),Ks.preventTouchMove(),w(e)))}}(Hr(function(){return{callbacks:p,getDraggableRef:d,getWindow:g,canStartCapturing:y,getShouldRespectForcePress:h,onCaptureStart:n,onCaptureEnd:o}},[p,d,g,y,h,n,o]));return Sc(function(){return function(){t.current&&(i(),v.current.isDragging&&v.current.callbacks.onCancel())}},[]),!l&&t.current&&(i(),v.current.isDragging&&p.onCancel()),Sc(function(){!s&&t.current&&i()},[i,s]),Hr(function(){return l?{onMouseDown:E,onKeyDown:x,onTouchStart:k,onFocus:O,onBlur:w,tabIndex:0,"data-react-beautiful-dnd-drag-handle":c,"aria-roledescription":"Draggable item. Press space bar to lift",draggable:!1,onDragStart:sl}:null},[l,w,O,x,E,k,c])}function fl(e){var t=e.draggableId,n=e.index,o=e.getDraggableRef,i=Xc(Ac).marshal,a=Xc(rs),u=a.droppableId,c=a.type,s=Hr(function(){return{id:t,droppableId:u,type:c,index:n}},[t,u,n,c]),l=Object(r.useRef)(s),f=Vr(function(e){var t=l.current,n=o();return n||Object(je.a)(!1),function(e,t,n){void 0===n&&(n=xi);var r=window.getComputedStyle(t),o=t.getBoundingClientRect(),i=li(o,r),a=si(i,n);return{descriptor:e,placeholder:{client:i,tagName:t.tagName.toLowerCase(),display:r.display},displaceBy:{x:i.marginBox.width,y:i.marginBox.height},client:i,page:a}}(t,n,e)},[o]);Sc(function(){return i.registerDraggable(l.current,f),function(){return i.unregisterDraggable(l.current)}},[f,i]),Sc(function(){if(l.current!==s){var e=l.current;l.current=s,i.updateDraggable(e,s,f)}},[s,f,i])}var pl=ti(function(){var e=di(function(e,t,n,r){return{isDragging:!0,isDropAnimating:Boolean(r),dropAnimation:r,mode:e,draggingOver:t,combineWith:n,combineTargetFor:null}}),t=di(function(e){return{isDragging:!1,isDropAnimating:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}),n={mapped:{type:"SECONDARY",offset:xi,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:t(null)}},r=di(function(e,t){return{x:e,y:t}}),o=di(function(t,n,r,o,i,a){return{mapped:{type:"DRAGGING",dropping:null,draggingOver:o,combineWith:i,mode:n,offset:t,dimension:r,forceShouldAnimate:a,snapshot:e(n,o,i,null)}}}),i=di(function(e,n,r){return void 0===n&&(n=null),{mapped:{type:"SECONDARY",offset:e,combineTargetFor:n,shouldAnimateDisplacement:r,snapshot:t(n)}}}),a=function(e,t,n){var o=n.movement.map[e],a=n.movement,u=n.merge,c=Boolean(u&&u.combine.draggableId===e),s=a.displacedBy.point,l=r(s.x,s.y);return c?i(o?l:xi,t,!o||o.shouldAnimate):o&&o.isVisible?i(l,null,o.shouldAnimate):null};return function(t,i){return function(t,n){if(t.isDragging){if(t.critical.draggable.id!==n.draggableId)return null;var i=t.current.client.offset,a=t.dimensions.draggables[n.draggableId],u=t.movementMode,c=Bi(t.impact),s=(f=t.impact).merge?f.merge.combine.draggableId:null,l=t.forceShouldAnimate;return o(r(i.x,i.y),u,a,c,s,l)}var f;if("DROP_ANIMATING"===t.phase){var p=t.completed;if(p.result.draggableId!==n.draggableId)return null;var d=t.dimensions.draggables[n.draggableId],h=p.result,m=h.mode,v=cs(h),g=function(e){return e.combine?e.combine.draggableId:null}(h),y={duration:t.dropDuration,curve:vu,moveTo:t.newHomeClientOffset,opacity:g?gu.drop:null,scale:g?yu.drop:null};return{mapped:{type:"DRAGGING",offset:t.newHomeClientOffset,dimension:d,dropping:y,draggingOver:v,combineWith:g,mode:m,forceShouldAnimate:null,snapshot:e(m,v,g,y)}}}return null}(t,i)||function(e,t){if(e.isDragging)return e.critical.draggable.id===t.draggableId?null:a(t.draggableId,e.critical.draggable.id,e.impact);if("DROP_ANIMATING"===e.phase){var n=e.completed;return n.result.draggableId===t.draggableId?null:a(t.draggableId,n.result.draggableId,n.impact)}return null}(t,i)||n}},{lift:function(e){return{type:"LIFT",payload:e}},move:pu,moveUp:function(){return{type:"MOVE_UP",payload:null}},moveDown:function(){return{type:"MOVE_DOWN",payload:null}},moveLeft:function(){return{type:"MOVE_LEFT",payload:null}},moveRight:function(){return{type:"MOVE_RIGHT",payload:null}},moveByWindowScroll:function(e){return{type:"MOVE_BY_WINDOW_SCROLL",payload:e}},drop:mu,dropAnimationFinished:function(){return{type:"DROP_ANIMATION_FINISHED",payload:null}}},null,{context:_c,pure:!0,areStatePropsEqual:us})(function(e){var t=Object(r.useRef)(null),n=Vr(function(e){t.current=e},[]),o=Vr(function(){return t.current},[]),i=Xc(Ac);Object(r.useEffect)(function(){});var a=e.children,u=e.draggableId,c=e.isDragDisabled,s=e.shouldRespectForcePress,l=e.disableInteractiveElementBlocking,f=e.index,p=e.mapped,d=e.moveUp,h=e.move,m=e.drop,v=e.moveDown,g=e.moveRight,y=e.moveLeft,b=e.moveByWindowScroll,w=e.lift,O=e.dropAnimationFinished;fl(Hr(function(){return{draggableId:u,index:f,getDraggableRef:o}},[u,o,f]));var E=Vr(function(e){Ri("LIFT"),t.current||Object(je.a)(!1),c&&Object(je.a)(!1);var n=e.clientSelection,r=e.movementMode;w({id:u,clientSelection:n,movementMode:r}),Fi("LIFT")},[u,c,w]),x=Vr(function(){return s},[s]),k=Hr(function(){return{onLift:E,onMove:function(e){return h({client:e})},onDrop:function(){return m({reason:"DROP"})},onCancel:function(){return m({reason:"CANCEL"})},onMoveUp:d,onMoveDown:v,onMoveRight:g,onMoveLeft:y,onWindowScroll:function(){return b({newScroll:Wu()})}}},[m,h,b,v,y,g,d,E]),S="DRAGGING"===p.type,C="DRAGGING"===p.type&&Boolean(p.dropping),j=ll(Hr(function(){return{draggableId:u,isDragging:S,isDropAnimating:C,isEnabled:!c,callbacks:k,getDraggableRef:o,canDragInteractiveElements:l,getShouldRespectForcePress:x}},[k,l,u,o,x,c,S,C])),_=Vr(function(e){"DRAGGING"===p.type&&p.dropping&&"transform"===e.propertyName&&O()},[O,p]);return a(Hr(function(){var e=vs(p),t="DRAGGING"===p.type&&p.dropping?_:null;return{innerRef:n,draggableProps:{"data-react-beautiful-dnd-draggable":i.style,style:e,onTransitionEnd:t},dragHandleProps:j}},[i.style,j,p,_,n]),p.snapshot)});function dl(e){return(dl="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 hl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ml(e,t){return!t||"object"!==dl(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function vl(e){return(vl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gl(e,t){return(gl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function yl(){return(yl=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}pl.defaultProps={isDragDisabled:!1,disableInteractiveElementBlocking:!1,shouldRespectForcePress:!1};var bl=Object(Re.isKeyHotkey)("tab"),wl=function(e){return o.a.createElement("div",yl({className:"wprm-admin-modal-field-ingredient-handle"},e.dragHandleProps,{tabIndex:"-1"}),o.a.createElement(Un.a,{type:"drag"}))},Ol=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ml(this,vl(t).apply(this,arguments))}var n,i,a;return function(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&&gl(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e){return JSON.stringify(this.props)!==JSON.stringify(e)}},{key:"render",value:function(){var e=this;return o.a.createElement(pl,{draggableId:"ingredient-".concat(this.props.uid),index:this.props.index},function(t,n){return"group"===e.props.type?function(e,t){return o.a.createElement("div",yl({className:"wprm-admin-modal-field-ingredient-group",ref:t.innerRef},t.draggableProps),wl(t),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-group-name-container"},o.a.createElement(jr,{singleLine:!0,className:"wprm-admin-modal-field-ingredient-group-name",toolbar:"no-styling",value:e.name,placeholder:"howto"===e.recipeType?Object(u.a)("Material Group Header"):Object(u.a)("Ingredient Group Header"),onChange:function(t){return e.onChangeName(t)},onKeyDown:function(t){bl(t)&&e.onTab(t)}})),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-after-container"},o.a.createElement(Un.a,{type:"trash",onClick:e.onDelete})))}(e.props,t):function(e,t){var n=e.amount,r=e.unit;return o.a.createElement("div",yl({className:"wprm-admin-modal-field-ingredient",ref:t.innerRef},t.draggableProps),wl(t),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-text-container"},o.a.createElement(jr,{singleLine:!0,toolbar:wprm_admin.addons.premium?"all":"no-link",className:"wprm-admin-modal-field-ingredient-amount",value:n,placeholder:"1",onChange:function(t){e.onChangeIngredient({amount:t})}}),o.a.createElement(jr,{singleLine:!0,toolbar:wprm_admin.addons.premium?"all":"no-link",value:r,placeholder:"howto"===e.recipeType?Object(u.a)("piece"):Object(u.a)("tbsp"),onChange:function(t){e.onChangeIngredient({unit:t})}}),o.a.createElement(jr,{singleLine:!0,toolbar:"ingredient",value:e.name,placeholder:"howto"===e.recipeType?Object(u.a)("paper"):Object(u.a)("olive oil"),onChange:function(t){e.onChangeIngredient({name:t,globalLink:!1})}}),o.a.createElement(jr,{singleLine:!0,toolbar:wprm_admin.addons.premium?"all":"no-link",value:e.notes,placeholder:"howto"===e.recipeType?Object(u.a)("any color"):Object(u.a)("extra virgin"),onChange:function(t){return e.onChangeIngredient({notes:t})},onKeyDown:function(t){bl(t)&&e.onTab(t)}})),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-after-container"},o.a.createElement(Un.a,{type:"trash",onClick:e.onDelete})))}(e.props,t)})}}])&&hl(n.prototype,i),a&&hl(n,a),t}();function El(e){return(El="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 xl(){return(xl=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function kl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Cl(e,t){return!t||"object"!==El(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function jl(e){return(jl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _l(e,t){return(_l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Il=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Cl(this,jl(t).call(this,e))).container=o.a.createRef(),n}var n,i,a;return function(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&&_l(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e,t){return this.props.type!==e.type||JSON.stringify(this.props.ingredients)!==JSON.stringify(e.ingredients)}},{key:"componentDidUpdate",value:function(e){if(this.props.ingredients.length>e.ingredients.length){var t=this.container.current.querySelectorAll(".wprm-admin-modal-field-ingredient-group-name, .wprm-admin-modal-field-ingredient-amount");t.length&&t[t.length-1].focus()}}},{key:"onDragEnd",value:function(e){if(e.destination){var t=JSON.parse(JSON.stringify(this.props.ingredients)),n=e.source.index,r=e.destination.index,o=t.splice(n,1)[0];t.splice(r,0,o),this.props.onRecipeChange({ingredients_flat:t})}}},{key:"addField",value:function(e){var t,n=JSON.parse(JSON.stringify(this.props.ingredients));t="group"===e?{type:"group",name:""}:{type:"ingredient",amount:"",unit:"",name:"",notes:""};var r=Math.max.apply(Math,n.map(function(e){return e.uid}));r=r<0?-1:r,t.uid=r+1,n.push(t),this.props.onRecipeChange({ingredients_flat:n})}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-edit-container",ref:this.container},o.a.createElement(Fc,{onDragEnd:this.onDragEnd.bind(this)},o.a.createElement(fs,{droppableId:"wprm-ingredients"},function(t,n){return o.a.createElement("div",xl({className:"".concat(n.isDraggingOver?" wprm-admin-modal-field-ingredient-container-draggingover":""),ref:t.innerRef},t.droppableProps),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-header-container"},o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-header"},Object(u.a)("Amount")),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-header"},Object(u.a)("Unit")),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-header"},Object(u.a)("Name")," ",o.a.createElement("span",{className:"wprm-admin-modal-field-ingredient-header-required"},"(",Object(u.a)("required"),")")),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-header"},Object(u.a)("Notes"))),e.props.ingredients.map(function(t,n){return o.a.createElement(Ol,xl({},t,{recipeType:e.props.type,index:n,key:"ingredient-".concat(t.uid),onTab:function(t){n===e.props.ingredients.length-1&&(t.preventDefault(),setTimeout(function(){e.addField("ingredient")}))},onChangeName:function(t){var r=JSON.parse(JSON.stringify(e.props.ingredients));r[n].name=t,e.props.onRecipeChange({ingredients_flat:r})},onChangeIngredient:function(t){var r=JSON.parse(JSON.stringify(e.props.ingredients));r[n]=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){kl(e,t,n[t])})}return e}({},r[n],t),e.props.onRecipeChange({ingredients_flat:r})},onDelete:function(){var t=JSON.parse(JSON.stringify(e.props.ingredients));t.splice(n,1),e.props.onRecipeChange({ingredients_flat:t})}}))}),t.placeholder)})),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-actions"},o.a.createElement("button",{className:"button",onClick:function(t){t.preventDefault(),e.addField("ingredient")}},"howto"===this.props.type?Object(u.a)("Add Material"):Object(u.a)("Add Ingredient")),o.a.createElement("button",{className:"button",onClick:function(t){t.preventDefault(),e.addField("group")}},"howto"===this.props.type?Object(u.a)("Add Material Group"):Object(u.a)("Add Ingredient Group")),o.a.createElement("p",null,Object(u.a)("Tip: use the TAB key to move from field to field and easily add ingredients."))))}}])&&Sl(n.prototype,i),a&&Sl(n,a),t}(),Tl=function(e){var t=e.ingredients;return o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-preview"},t.map(function(e,t){if("group"===e.type){if(e.name)return o.a.createElement("h3",{key:t},e.name)}else if(e.amount||e.unit||e.name||e.notes){var n="";if(e.amount&&(n+='<span className="wprm-admin-modal-field-ingredient-preview-ingredient-amount">'.concat(e.amount,"</span>")),e.unit&&(n+='<span className="wprm-admin-modal-field-ingredient-preview-ingredient-unit">'.concat(e.unit,"</span>")),e.name&&(n+='<span className="wprm-admin-modal-field-ingredient-preview-ingredient-name">'.concat(e.name,"</span>")),e.notes&&(n+='<span className="wprm-admin-modal-field-ingredient-preview-ingredient-notes">'.concat(e.notes,"</span>")),n)return o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-preview-ingredient",dangerouslySetInnerHTML:{__html:n},key:t})}return null}))},Nl=(n(791),wprm_admin.endpoints.ingredient_links),Al=function(e){var t={ingredients:e};return $n.a.call("".concat(Nl),"POST",t)},Pl=function(e){var t={links:e};return $n.a.call("".concat(Nl),"PUT",t)},Dl=n(642),Ml=n.n(Dl);function Ll(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Rl(e,t,n[t])})}return e}function Rl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Fl=function(e){var t=e.ingredient,n={url:"",nofollow:"default"},i="";if("global"===e.type||"edit-global"===e.type){if(t.hasOwnProperty("globalLink")&&!1!==t.globalLink){n=t.globalLink;var a=wprm_admin_modal.options.ingredient_link_nofollow.find(function(e){return e.value===n.nofollow});a&&(i=a.label)}}else t.hasOwnProperty("link")&&(n=t.link);var c=n&&n.url;return o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-link-container"},o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-link-ingredient"},Ml()(t.name),"edit-global"===e.type&&e.hasChanged&&o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-link-ingredient-count"},0<n.count-1?"".concat(n.count-1," ").concat(Object(u.a)("other recipe(s) affected")):Object(u.a)("This can affect other recipes"))),"global"===e.type?o.a.createElement(r.Fragment,null,e.isUpdating?o.a.createElement(p.a,null):o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-link-url".concat(c?"":" wprm-admin-modal-field-ingredient-links-link-url-none")},c?n.url:Object(u.a)("No link set")),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-link-nofollow"},c?i:""))):o.a.createElement(r.Fragment,null,o.a.createElement(E.a,{name:"ingredient-link",type:"url",value:n.url,onChange:function(t){e.onLinkChange(Ll({},n,{url:t}))}}),o.a.createElement(O.a,{options:wprm_admin_modal.options.ingredient_link_nofollow,value:n.nofollow,onChange:function(t){e.onLinkChange(Ll({},n,{nofollow:t}))},width:200})))};function Bl(e){return(Bl="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 zl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ul(e,t){return!t||"object"!==Bl(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ql(e){return(ql=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Wl(e,t){return(Wl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Hl=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Ul(this,ql(t).call(this,e))).state={isUpdating:!1},n}var n,i,a;return function(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&&Wl(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidMount",value:function(){wprm_admin.addons.premium&&this.updateGlobalLinks()}},{key:"componentDidUpdate",value:function(e){if(!this.state.isUpdating&&"custom"===this.props.type&&"global"===e.type){for(var t=JSON.parse(JSON.stringify(this.props.ingredients)),n=!1,r=0;r<t.length;r++){var o=t[r];"ingredient"===o.type&&!o.hasOwnProperty("link")&&o.hasOwnProperty("globalLink")&&o.globalLink&&(o.link={url:o.globalLink.url,nofollow:o.globalLink.nofollow},n=!0)}n&&this.props.onIngredientsChange(t)}}},{key:"updateGlobalLinks",value:function(){for(var e=this,t={},n=0;n<this.props.ingredients.length;n++){var r=this.props.ingredients[n];"ingredient"!==r.type||!r.name||r.hasOwnProperty("globalLink")&&!1!==r.globalLink||(t[n]={name:r.name})}if(0<Object.keys(t).length){var o=Object.keys(t).map(function(e){return parseInt(e)});this.setState({isUpdating:o},function(){Al(t).then(function(t){if(t&&t.links){var n=JSON.parse(JSON.stringify(e.props.ingredients));for(var r in t.links)n[parseInt(r)].globalLink=t.links[r];e.props.onIngredientsChange(n)}e.setState({isUpdating:!1})})})}}},{key:"render",value:function(){var e=this;return wprm_admin.addons.premium?this.props.ingredients.filter(function(e){return"ingredient"===e.type&&e.name}).length?o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-container"},o.a.createElement(h.a,{id:"link-type",label:Object(u.a)("Ingredient Link Type"),help:"global"===this.props.type?Object(u.a)("Global: the same link will be used for every recipe with this ingredient"):Object(u.a)("Custom: these links will only affect the recipe below")},o.a.createElement(x.a,{id:"link-type",options:[{value:"global",label:Object(u.a)("Use Global Links")},{value:"custom",label:Object(u.a)("Custom Links for this Recipe only")}],value:this.props.type,onChange:this.props.onTypeChange})),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links"},this.props.ingredients.map(function(t,n){return"group"!==t.type&&t.name?o.a.createElement(Fl,{ingredient:t,onLinkChange:function(t){var r=JSON.parse(JSON.stringify(e.props.ingredients));r[n].link=t,e.props.onIngredientsChange(r)},type:e.props.type,isUpdating:e.state.isUpdating&&e.state.isUpdating.includes(n),key:n}):null})),"global"===this.props.type&&o.a.createElement("button",{className:"button button-primary",onClick:function(){e.props.onModeChange("ingredient-links")},disabled:!1!==this.state.isUpdating},Object(u.a)("Edit Global Links"))):o.a.createElement("p",null,Object(u.a)("No ingredients set for this recipe.")):o.a.createElement("p",null,Object(u.a)("This feature is only available in")," ",o.a.createElement("a",{href:"https://bootstrapped.ventures/wp-recipe-maker/get-the-plugin/",target:"_blank"},"WP Recipe Maker Premium"),".")}}])&&zl(n.prototype,i),a&&zl(n,a),t}(),Vl=(n(959),wprm_admin.endpoints.unit_conversion),Gl=function(e){var t={ingredients:e};return $n.a.call("".concat(Vl),"POST",t)};function Jl(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;t=parseInt(t);var n=parseFloat(parseFloat(e).toFixed(t));return 0==n&&(n+=Math.pow(10,-1*t)),n}function Zl(e){e=(e=e.replace(",",".")).replace(" to ","-");var t={"¼":" 1/4","½":" 1/2","¾":" 3/4","⅐":" 1/7","⅑":" 1/9","⅒":" 1/10","⅓":" 1/3","⅔":" 2/3","⅕":" 1/5","⅖":" 2/5","⅗":" 3/5","⅘":" 4/5","⅙":" 1/6","⅚":" 5/6","⅛":" 1/8","⅜":" 3/8","⅝":" 5/8","⅞":" 7/8"},n=(e=(e=(e=(e=(e=(e+"").replace(/(\u00BC|\u00BD|\u00BE|\u2150|\u2151|\u2152|\u2153|\u2154|\u2155|\u2156|\u2157|\u2158|\u2159|\u215A|\u215B|\u215C|\u215D|\u215E)/,function(e,n){return t[n]})).replace(/(<([^>]+)>)/gi,"")).replace(/(\[([^\]]+)\])/gi,"")).replace(/[^\d\s\.\/-]/gi,"")).trim()).split(" "),r=!1;if(""!==e){r=0;for(var o=0;o<n.length;o++)if(""!==n[o].trim()){var i=n[o].split("/",2),a=parseFloat(i[0]);if(void 0!==i[1]){var u=parseFloat(i[1]);0!==u&&(a/=u)}isNaN(a)||(r+=a)}}return r}var Yl=function(e){var t=e.ingredient,n=e.isConverting,r=e.method,i=t.converted?t.converted:{2:{amount:"",unit:""}},a=function(){var e=[{label:Object(u.a)("Convert"),options:[{value:"none",label:Object(u.a)("Keep Unit")},{value:"automatic",label:Object(u.a)("Automatically")}]}],t=[];wprm_admin_modal.unit_conversion.units.weight.map(function(e){t.push({value:e,label:wprm_admin_modal.unit_conversion.units.data[e].label})}),0<t.length&&e.push({label:Object(u.a)("Weight Units"),options:t});var n=[];return wprm_admin_modal.unit_conversion.units.volume.map(function(e){n.push({value:e,label:wprm_admin_modal.unit_conversion.units.data[e].label})}),0<n.length&&e.push({label:Object(u.a)("Volume Units"),options:n}),e}(),c="".concat(t.amount," ").concat(t.unit).trim();return c="".concat(c," ").concat(t.name).trim(),t.notes&&(c+=" (".concat(t.notes,")")),o.a.createElement("tr",null,o.a.createElement("td",null,o.a.createElement(O.a,{isDisabled:n,options:a,placeholder:Object(u.a)("Convert..."),value:r,onChange:function(t){e.onMethodChange(t)},width:150})),o.a.createElement("td",{style:"failed"===r?{color:"darkred"}:null},n?o.a.createElement(p.a,null):o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-unit-conversion-fields"},o.a.createElement(jr,{singleLine:!0,value:i[2].amount,onChange:function(t){var n=i;n[2].amount=t,e.onConvertedChange(n)}}),o.a.createElement(jr,{singleLine:!0,value:i[2].unit,onChange:function(t){var n=i;n[2].unit=t,e.onConvertedChange(n)}}))),o.a.createElement("td",null,Ml()(c)))};function Kl(e){return(Kl="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 Xl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ql(e){return(Ql=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ef(e,t){return(ef=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var tf=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Kl(t)&&"function"!=typeof t?$l(e):t}(this,Ql(t).call(this,e))).state={isConverting:{},methods:{}},n.convert=n.convert.bind($l(n)),n.convertAll=n.convertAll.bind($l(n)),n}var n,i,a;return function(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&&ef(e,t)}(t,r["Component"]),n=t,(i=[{key:"convertAll",value:function(e){for(var t=[],n=0;n<this.props.ingredients.length;n++){"ingredient"===this.props.ingredients[n].type&&t.push(n)}t&&this.convert(t,e)}},{key:"convert",value:function(e,t){var n=this,r=this.state.isConverting,o=this.state.methods;if("none"===t){var i=JSON.parse(JSON.stringify(this.props.ingredients)),a=!0,u=!1,c=void 0;try{for(var s,l=e[Symbol.iterator]();!(a=(s=l.next()).done);a=!0){var f=s.value,p=this.props.ingredients[f];p.hasOwnProperty("converted")||(i[f].converted={2:{}}),i[f].converted[2].amount=p.amount,i[f].converted[2].unit=p.unit,r[f]=!1,o[f]=t}}catch(e){u=!0,c=e}finally{try{a||null==l.return||l.return()}finally{if(u)throw c}}this.props.onIngredientsChange(i)}else{var d={},h=!0,m=!1,v=void 0;try{for(var g,y=e[Symbol.iterator]();!(h=(g=y.next()).done);h=!0){var b=g.value,w=this.props.ingredients[b];d[b]={index:b,amount:Zl(w.amount),unit:w.unit,name:w.name},"automatic"!==t&&(d[b].units_to=[t]),r[b]=!0,o[b]=t}}catch(e){m=!0,v=e}finally{try{h||null==y.return||y.return()}finally{if(m)throw v}}Gl(d).then(function(e){if(e&&e.conversions){var r=JSON.parse(JSON.stringify(n.props.ingredients)),o=n.state.isConverting,i=n.state.methods;for(var a in e.conversions){var u=n.props.ingredients[parseInt(a)],c=e.conversions[a];u.hasOwnProperty("converted")||(r[a].converted={2:{}}),"none"===c.type||"failed"===c.type?(r[a].converted[2].amount=u.amount,r[a].converted[2].unit=u.unit,i[a]=c.type):(r[a].converted[2].amount=Jl(c.amount,wprmp_admin.settings.unit_conversion_round_to_decimals),r[a].converted[2].unit=c.alias,i[a]=t),o[a]=!1}n.props.onIngredientsChange(r),n.setState({isConverting:o,methods:i})}})}this.setState({isConverting:r,methods:o})}},{key:"render",value:function(){var e=this;return wprm_admin.addons.pro?wprm_admin_modal.unit_conversion?this.props.ingredients.filter(function(e){return"ingredient"===e.type&&e.name}).length?o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-unit-conversion-container"},o.a.createElement("table",{className:"wprm-admin-modal-field-ingredient-unit-conversion"},o.a.createElement("thead",null,o.a.createElement("tr",null,o.a.createElement("th",null,Object(u.a)("Conversion")),o.a.createElement("th",null,Object(u.a)("Converted")," (",wprm_admin_modal.unit_conversion.systems[2],")"),o.a.createElement("th",null,Object(u.a)("Default")," (",wprm_admin_modal.unit_conversion.systems[1],")"))),o.a.createElement("tbody",null,this.props.ingredients.map(function(t,n){return"group"!==t.type&&t.name?o.a.createElement(Yl,{ingredient:t,isConverting:e.state.isConverting[n],method:e.state.methods[n],onMethodChange:function(t){e.state.isConverting[n]||e.convert([n],t)},onConvertedChange:function(t){var r=JSON.parse(JSON.stringify(e.props.ingredients));r[n].converted=t,e.props.onIngredientsChange(r)},key:n}):null}))),o.a.createElement("button",{className:"button button-primary",onClick:function(t){t.preventDefault(),e.convertAll("automatic")}},Object(u.a)("Convert All Automatically"))):o.a.createElement("p",null,Object(u.a)("No ingredients set for this recipe.")):o.a.createElement("p",null,Object(u.a)("You need to set up this feature on the WP Recipe Maker > Settings > Unit Conversion page first.")):o.a.createElement("p",null,Object(u.a)("This feature is only available in")," ",o.a.createElement("a",{href:"https://bootstrapped.ventures/wp-recipe-maker/get-the-plugin/",target:"_blank"},"WP Recipe Maker Pro Bundle"),".")}}])&&Xl(n.prototype,i),a&&Xl(n,a),t}();function nf(e){return(nf="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 rf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function of(e,t){return!t||"object"!==nf(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function af(e){return(af=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function uf(e,t){return(uf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var cf=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=of(this,af(t).call(this,e))).state={mode:"edit"},n}var n,i,a;return function(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&&uf(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e,t){return this.state.mode!==t.mode||this.props.type!==e.type||this.props.linkType!==e.linkType||JSON.stringify(this.props.ingredients)!==JSON.stringify(e.ingredients)}},{key:"render",value:function(){var e=this,t=[{id:"edit",label:"howto"===this.props.type?Object(u.a)("Edit Materials"):Object(u.a)("Edit Ingredients")},{id:"ingredient-links",label:"howto"===this.props.type?Object(u.a)("Material Links"):Object(u.a)("Ingredient Links")},{id:"unit-conversion",label:Object(u.a)("Unit Conversion")}],n=null;switch(this.state.mode){case"unit-conversion":n=o.a.createElement(tf,{ingredients:this.props.ingredients,onIngredientsChange:function(t){e.props.onRecipeChange({ingredients_flat:t})}});break;case"ingredient-links":n=o.a.createElement(Hl,{ingredients:this.props.ingredients,onIngredientsChange:function(t){e.props.onRecipeChange({ingredients_flat:t})},type:this.props.linkType,onTypeChange:function(t){e.props.onRecipeChange({ingredient_links_type:t})},onModeChange:this.props.onModeChange});break;case"preview":n=o.a.createElement(Tl,{ingredients:this.props.ingredients});break;default:n=o.a.createElement(Il,{type:this.props.type,ingredients:this.props.ingredients,onRecipeChange:this.props.onRecipeChange})}return o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-container"},o.a.createElement(Br,{modes:t,mode:this.state.mode,onModeChange:function(t){e.setState({mode:t})}}),n)}}])&&rf(n.prototype,i),a&&rf(n,a),t}();n(960);function sf(e){return(sf="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 lf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ff(e,t){return!t||"object"!==sf(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pf(e){return(pf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function df(e,t){return(df=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function hf(){return(hf=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var mf=Object(Re.isKeyHotkey)("tab"),vf=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ff(this,pf(t).apply(this,arguments))}var n,i,a;return function(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&&df(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e){return JSON.stringify(this.props)!==JSON.stringify(e)}},{key:"render",value:function(){var e=this;return o.a.createElement(pl,{draggableId:"equipment-".concat(this.props.uid),index:this.props.index},function(t,n){return o.a.createElement("div",hf({className:"wprm-admin-modal-field-equipment",ref:t.innerRef},t.draggableProps),o.a.createElement("div",{className:"wprm-admin-modal-field-equipment-main-container"},function(e){return o.a.createElement("div",hf({className:"wprm-admin-modal-field-equipment-handle"},e.dragHandleProps,{tabIndex:"-1"}),o.a.createElement(Un.a,{type:"drag"}))}(t),o.a.createElement("div",{className:"wprm-admin-modal-field-equipment-name-container"},o.a.createElement(jr,{singleLine:!0,toolbar:"equipment",value:e.props.name,placeholder:"howto"===e.props.recipeType?Object(u.a)("Pair of scissors"):Object(u.a)("Pressure cooker"),onChange:function(t){return e.props.onChangeName(t)},onKeyDown:function(t){mf(t)&&e.props.onTab(t)}}))),o.a.createElement("div",{className:"wprm-admin-modal-field-equipment-after-container"},o.a.createElement(Un.a,{type:"trash",onClick:e.props.onDelete})))})}}])&&lf(n.prototype,i),a&&lf(n,a),t}();function gf(e){return(gf="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 yf(){return(yf=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function bf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function wf(e,t){return!t||"object"!==gf(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Of(e){return(Of=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ef(e,t){return(Ef=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var xf=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=wf(this,Of(t).call(this,e))).container=o.a.createRef(),n}var n,i,a;return function(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&&Ef(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e){return this.props.type!==e.type||JSON.stringify(this.props.equipment)!==JSON.stringify(e.equipment)}},{key:"componentDidUpdate",value:function(e){if(this.props.equipment.length>e.equipment.length){var t=this.container.current.querySelectorAll(".wprm-admin-modal-field-richtext");t.length&&t[t.length-1].focus()}}},{key:"onDragEnd",value:function(e){if(e.destination){var t=JSON.parse(JSON.stringify(this.props.equipment)),n=e.source.index,r=e.destination.index,o=t.splice(n,1)[0];t.splice(r,0,o),this.props.onRecipeChange({equipment:t})}}},{key:"addField",value:function(){var e=JSON.parse(JSON.stringify(this.props.equipment)),t={name:""},n=Math.max.apply(Math,e.map(function(e){return e.uid}));n=n<0?-1:n,t.uid=n+1,e.push(t),this.props.onRecipeChange({equipment:e})}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"wprm-admin-modal-field-equipment-container",ref:this.container},o.a.createElement(Fc,{onDragEnd:this.onDragEnd.bind(this)},o.a.createElement(fs,{droppableId:"wprm-equipment"},function(t,n){return o.a.createElement("div",yf({className:"".concat(n.isDraggingOver?" wprm-admin-modal-field-equipment-container-draggingover":""),ref:t.innerRef},t.droppableProps),e.props.equipment.map(function(t,n){return o.a.createElement(vf,yf({},t,{recipeType:e.props.type,index:n,key:"equipment-".concat(t.uid),onTab:function(t){n===e.props.equipment.length-1&&(t.preventDefault(),setTimeout(function(){e.addField()}))},onChangeName:function(t){var r=JSON.parse(JSON.stringify(e.props.equipment));r[n].name=t,e.props.onRecipeChange({equipment:r})},onDelete:function(){var t=JSON.parse(JSON.stringify(e.props.equipment));t.splice(n,1),e.props.onRecipeChange({equipment:t})}}))}),t.placeholder)})),o.a.createElement("div",{className:"wprm-admin-modal-field-equipment-actions"},o.a.createElement("button",{className:"button",onClick:function(t){t.preventDefault(),e.addField()}},Object(u.a)("Add Equipment")),o.a.createElement("p",null,Object(u.a)("Tip: use the TAB key to move from field to field and easily add equipment."))))}}])&&bf(n.prototype,i),a&&bf(n,a),t}();n(961);function kf(e){return(kf="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 Sf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Cf(e,t){return!t||"object"!==kf(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function jf(e){return(jf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _f(e,t){return(_f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function If(){return(If=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var Tf=Object(Re.isKeyHotkey)("tab"),Nf=function(e){return o.a.createElement("div",If({className:"wprm-admin-modal-field-instruction-handle"},e.dragHandleProps,{tabIndex:"-1"}),o.a.createElement(Un.a,{type:"drag"}))},Af=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Cf(this,jf(t).apply(this,arguments))}var n,i,a;return function(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&&_f(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e){return JSON.stringify(this.props)!==JSON.stringify(e)}},{key:"render",value:function(){var e=this;return o.a.createElement(pl,{draggableId:"instruction-".concat(this.props.uid),index:this.props.index},function(t,n){return"group"===e.props.type?function(e,t){return o.a.createElement("div",If({className:"wprm-admin-modal-field-instruction-group",ref:t.innerRef},t.draggableProps),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-main-container"},Nf(t),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-group-name-container"},o.a.createElement(jr,{singleLine:!0,toolbar:"no-styling",value:e.name,placeholder:Object(u.a)("Instruction Group Header"),onChange:function(t){return e.onChangeText(t)},onKeyDown:function(t){Tf(t)&&e.onTab(t)}}))),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-after-container"},o.a.createElement(Un.a,{type:"trash",onClick:e.onDelete})))}(e.props,t):function(e,t){return o.a.createElement("div",If({className:"wprm-admin-modal-field-instruction",ref:t.innerRef},t.draggableProps),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-main-container"},Nf(t),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-text-container"},o.a.createElement(jr,{value:e.text,placeholder:Object(u.a)("This is one step of the instructions."),onChange:function(t){return e.onChangeText(t)},onKeyDown:function(t){Tf(t)&&e.onTab(t)}}))),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-after-container"},o.a.createElement(Un.a,{type:"trash",onClick:e.onDelete}),o.a.createElement(g.a,{id:e.image,url:e.image_url,onChange:function(t,n){return e.onChangeImage(t,n)},disableTab:!0})))}(e.props,t)})}}])&&Sf(n.prototype,i),a&&Sf(n,a),t}();function Pf(e){return(Pf="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 Df(){return(Df=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Mf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Lf(e,t){return!t||"object"!==Pf(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Rf(e){return(Rf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ff(e,t){return(Ff=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Bf=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Lf(this,Rf(t).call(this,e))).container=o.a.createRef(),n}var n,i,a;return function(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&&Ff(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e){return JSON.stringify(this.props.instructions)!==JSON.stringify(e.instructions)}},{key:"componentDidUpdate",value:function(e){if(this.props.instructions.length>e.instructions.length){var t=this.container.current.querySelectorAll(".wprm-admin-modal-field-richtext");t.length&&t[t.length-1].focus()}}},{key:"onDragEnd",value:function(e){if(e.destination){var t=JSON.parse(JSON.stringify(this.props.instructions)),n=e.source.index,r=e.destination.index,o=t.splice(n,1)[0];t.splice(r,0,o),this.props.onRecipeChange({instructions_flat:t})}}},{key:"addField",value:function(e){var t,n=JSON.parse(JSON.stringify(this.props.instructions));t="group"===e?{type:"group",name:""}:{type:"instruction",text:"",image:0,image_url:""};var r=Math.max.apply(Math,n.map(function(e){return e.uid}));r=r<0?-1:r,t.uid=r+1,n.push(t),this.props.onRecipeChange({instructions_flat:n})}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-container",ref:this.container},o.a.createElement(Fc,{onDragEnd:this.onDragEnd.bind(this)},o.a.createElement(fs,{droppableId:"wprm-instructions"},function(t,n){return o.a.createElement("div",Df({className:"".concat(n.isDraggingOver?" wprm-admin-modal-field-instruction-container-draggingover":""),ref:t.innerRef},t.droppableProps),e.props.instructions.map(function(t,n){return o.a.createElement(Af,Df({},t,{index:n,key:"instruction-".concat(t.uid),onTab:function(t){n===e.props.instructions.length-1&&(t.preventDefault(),setTimeout(function(){e.addField("instruction")}))},onChangeText:function(r){var o=JSON.parse(JSON.stringify(e.props.instructions));"group"===t.type?o[n].name=r:o[n].text=r,e.props.onRecipeChange({instructions_flat:o})},onChangeImage:function(t,r){var o=JSON.parse(JSON.stringify(e.props.instructions));o[n].image=t,o[n].image_url=r,e.props.onRecipeChange({instructions_flat:o})},onDelete:function(){var t=JSON.parse(JSON.stringify(e.props.instructions));t.splice(n,1),e.props.onRecipeChange({instructions_flat:t})}}))}),t.placeholder)})),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-actions"},o.a.createElement("button",{className:"button",onClick:function(t){t.preventDefault(),e.addField("instruction")}},Object(u.a)("Add Instruction")),o.a.createElement("button",{className:"button",onClick:function(t){t.preventDefault(),e.addField("group")}},Object(u.a)("Add Instruction Group")),o.a.createElement("p",null,Object(u.a)("Tip: use the TAB key to move from field to field and easily add instructions."))))}}])&&Mf(n.prototype,i),a&&Mf(n,a),t}(),zf=n(412),Uf=n(175);n(962);function qf(e){return(qf="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 Wf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Hf(e,t,n[t])})}return e}function Hf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Gf(e,t){return!t||"object"!==qf(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Jf(e){return(Jf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Zf(e,t){return(Zf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Yf=-1!==Object.values(wprm_admin_modal.nutrition).findIndex(function(e){return"calculated"===e.type}),Kf=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Gf(this,Jf(t).call(this,e))).state={calculating:!1},n}var n,i,a;return function(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&&Zf(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e,t){return this.state.calculing!==t.calculating||JSON.stringify(this.props.servings)!==JSON.stringify(e.servings)||JSON.stringify(this.props.nutrition)!==JSON.stringify(e.nutrition)}},{key:"componentDidMount",value:function(){this.calculateNutrients()}},{key:"componentDidUpdate",value:function(e){JSON.stringify(this.props.nutrition)!==JSON.stringify(e.nutrition)&&this.calculateNutrients()}},{key:"calculateNutrients",value:function(){var e=this;Yf&&wprm_admin.addons.pro&&this.setState({calculating:!0},function(){zf.a.getCalculated(e.props.nutrition).then(function(t){t&&Object.keys(t.calculated).length>0&&e.props.onRecipeChange({nutrition:Wf({},e.props.nutrition,t.calculated)}),e.setState({calculating:!1})})})}},{key:"render",value:function(){var e=this,t=this.props,n=t.nutrition.hasOwnProperty("serving_size")&&t.nutrition.serving_size?t.nutrition.serving_size:"",i=t.nutrition.hasOwnProperty("serving_unit")&&t.nutrition.serving_unit?t.nutrition.serving_unit:"";return o.a.createElement(r.Fragment,null,o.a.createElement("p",null,Object(u.a)("These should be the nutrition facts for 1 serving of your recipe."),o.a.createElement("br",null),t.servings.amount?o.a.createElement(r.Fragment,null,Object(u.a)("Total servings for this recipe:")," ","".concat(t.servings.amount," ").concat(t.servings.unit)):o.a.createElement(r.Fragment,null,Object(u.a)('You don\'t have the servings field set for your recipe under "General".'))),o.a.createElement("div",{className:"wprm-admin-modal-field-nutrition-container"},wprm_admin.addons.premium?o.a.createElement(h.a,{id:"nutrition_serving_size",label:Object(u.a)("Serving Size"),help:Object(u.a)("The weight of 1 serving. Does not affect the calculation.")},o.a.createElement(E.a,{type:"number",value:n,onChange:function(e){var n=Wf({},t.nutrition,{serving_size:e});t.onRecipeChange({nutrition:n})}}),o.a.createElement(E.a,{name:"serving-unit",placeholder:Object(u.a)("g"),value:i,onChange:function(e){var n=Wf({},t.nutrition,{serving_unit:e});t.onRecipeChange({nutrition:n})}})):null,Object.keys(wprm_admin_modal.nutrition).map(function(n,i){var a=wprm_admin_modal.nutrition[n],u=t.nutrition.hasOwnProperty(n)?t.nutrition[n]:"";return"serving_size"===n?null:"calories"===n||wprm_admin.addons.premium?o.a.createElement(h.a,{id:"nutrition_".concat(n),label:a.label,key:i},"calculated"===a.type&&e.state.calculating?o.a.createElement(p.a,null):o.a.createElement(r.Fragment,null,o.a.createElement(E.a,{type:"number",value:u,onChange:function(e){var r=Wf({},t.nutrition,Hf({},n,e));t.onRecipeChange({nutrition:r})},disabled:"calculated"===a.type}),o.a.createElement("span",{className:"wprm-admin-modal-field-nutrition-unit"},a.unit))):null})),wprm_admin.addons.premium?null:o.a.createElement("p",null,Object(u.a)("More nutrients are available in")," ",o.a.createElement("a",{href:"https://bootstrapped.ventures/wp-recipe-maker/get-the-plugin/",target:"_blank"},"WP Recipe Maker Premium"),"."),o.a.createElement(Uf.a,{isPrimary:!0,required:"pro",onClick:function(){t.onModeChange("nutrition-calculation")}},Object(u.a)("Calculate Nutrition Facts")))}}])&&Vf(n.prototype,i),a&&Vf(n,a),t}(),Xf=(n(963),wprm_admin_modal.custom_fields&&wprm_admin_modal.custom_fields.fields?Object.values(wprm_admin_modal.custom_fields.fields):[]),Qf=function(e){return o.a.createElement(r.Fragment,null,Xf.map(function(t,n){var r=!!e.fields.hasOwnProperty(t.key)&&e.fields[t.key];switch(t.type){case"text":case"link":case"email":var i="link"===t.type?"url":t.type;return o.a.createElement(h.a,{label:t.name,key:n},o.a.createElement(E.a,{type:i,name:"recipe-custom-".concat(t.key),value:r||"",onChange:function(n){e.onFieldChange(t.key,n)}}));case"textarea":return o.a.createElement(h.a,{label:t.name,key:n},o.a.createElement(jr,{value:r||"",onChange:function(n){e.onFieldChange(t.key,n)}}));case"image":return o.a.createElement(h.a,{label:t.name,key:n},o.a.createElement(g.a,{id:r?r.id:0,url:r?r.url:"",onChange:function(n,r){e.onFieldChange(t.key,{id:n,url:r})}}))}}))};n(964);function $f(e){return($f="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 ep(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function tp(e){return(tp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function np(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rp(e,t){return(rp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var op=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==$f(t)&&"function"!=typeof t?np(e):t}(this,tp(t).call(this,e));var r=parseInt(wprm_admin_modal.editor_uid);return wprm_admin_modal.editor_uid=r+1,n.state={editorHtml:!1,addedListeners:!1,editorId:"wprm-admin-modal-notes-editor-".concat(r)},n.initEditor=n.initEditor.bind(np(n)),n.initTinyMCE=n.initTinyMCE.bind(np(n)),n}var n,i,a;return function(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&&rp(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidMount",value:function(){var e=document.getElementById("wprm-admin-modal-notes-placeholder").innerHTML;e=e.replace(/wprm-admin-modal-notes-editor/g,this.state.editorId),this.setState({editorHtml:e})}},{key:"componentDidUpdate",value:function(e,t){this.state.editorHtml&&!t.editorHtml&&this.initEditor()}},{key:"initEditor",value:function(){void 0!==window.tinymce?this.initTinyMCE():this.initTextarea()}},{key:"initTextarea",value:function(){var e=this,t=document.getElementById(this.state.editorId);void 0!==window.quicktags&&window.quicktags({id:this.state.editorId}),t&&(t.value=this.props.value,["input","blur"].forEach(function(n){t.addEventListener(n,function(){e.props.onChange(t.value)})}))}},{key:"initTinyMCE",value:function(){var e=this;document.getElementById("wp-".concat(this.state.editorId,"-editor-container")).outerHTML='<textarea id="'.concat(this.state.editorId,'"></textarea>');var t=tinymce.$("#wp-".concat(this.state.editorId,"-wrap"));t.removeClass("tmce-active").addClass("html-active"),this.initTextarea(),t.removeClass("html-active").addClass("tmce-active");var n={};void 0!==window.tinyMCEPreInit&&tinyMCEPreInit.hasOwnProperty("mceInit")&&tinyMCEPreInit.mceInit.hasOwnProperty("wprm-admin-modal-notes-editor")&&(n=tinyMCEPreInit.mceInit["wprm-admin-modal-notes-editor"]),n.hasOwnProperty("body_class")&&(n.body_class=n.body_class.replace(/wprm-admin-modal-notes-editor/g,this.state.editorId)),n.selector="#".concat(this.state.editorId),window.tinymce.init(n);var r=window.tinymce.get(this.state.editorId);r&&r.on("change",function(){e.props.onChange(r.getContent())})}},{key:"componentWillUnmount",value:function(){void 0!==window.tinyMCE&&window.tinyMCE.remove("#".concat(this.state.editorId))}},{key:"render",value:function(){return this.state.editorHtml?o.a.createElement("div",{id:"wprm-admin-modal-field-tinymce-container",dangerouslySetInnerHTML:{__html:this.state.editorHtml}}):o.a.createElement(p.a,null)}}])&&ep(n.prototype,i),a&&ep(n,a),t}(),ip=function(e){return o.a.createElement(h.a,{label:Object(u.a)("Recipe Notes")},o.a.createElement(op,{id:"recipe-notes",value:e.notes,onChange:function(t){e.onRecipeChange({notes:t})}}))},ap=function(e){var t=[{id:"import",name:Object(u.a)("Import"),elem:o.a.createElement(v,{onModeChange:e.onModeChange,onRecipeChange:e.onRecipeChange})},{id:"media",name:Object(u.a)("Media"),elem:o.a.createElement(w,{image:{id:e.recipe.image_id,url:e.recipe.image_url},pinImage:{id:e.recipe.pin_image_id,url:e.recipe.pin_image_url},video:{id:e.recipe.video_id,thumb:e.recipe.video_thumb_url,embed:e.recipe.video_embed},onRecipeChange:e.onRecipeChange})},{id:"general",name:Object(u.a)("General"),elem:o.a.createElement(_r,{type:e.recipe.type,name:e.recipe.name,summary:e.recipe.summary,author:{display:e.recipe.author_display,name:e.recipe.author_name,link:e.recipe.author_link},servings:{amount:e.recipe.servings,unit:e.recipe.servings_unit},cost:e.recipe.cost,onRecipeChange:e.onRecipeChange})},{id:"times",name:Object(u.a)("Times"),elem:o.a.createElement(Tr,{type:e.recipe.type,prep:{time:e.recipe.prep_time,zero:e.recipe.prep_time_zero},cook:{time:e.recipe.cook_time,zero:e.recipe.cook_time_zero},custom:{time:e.recipe.custom_time,zero:e.recipe.custom_time_zero},customLabel:e.recipe.custom_time_label,total:{time:e.recipe.total_time,zero:!1},onRecipeChange:e.onRecipeChange})},{id:"categories",name:Object(u.a)("Categories"),elem:o.a.createElement(Fr,{tags:e.recipe.tags,onRecipeChange:e.onRecipeChange})},{id:"equipment",name:Object(u.a)("Equipment"),elem:o.a.createElement(xf,{type:e.recipe.type,equipment:e.recipe.equipment,onRecipeChange:e.onRecipeChange})},{id:"ingredients",name:"howto"===e.recipe.type?Object(u.a)("Materials"):Object(u.a)("Ingredients"),elem:o.a.createElement(cf,{type:e.recipe.type,ingredients:e.recipe.ingredients_flat,linkType:e.recipe.ingredient_links_type,onRecipeChange:e.onRecipeChange,onModeChange:e.onModeChange})},{id:"instructions",name:Object(u.a)("Instructions"),elem:o.a.createElement(Bf,{instructions:e.recipe.instructions_flat,onRecipeChange:e.onRecipeChange})}];return"howto"!==e.recipe.type&&t.push({id:"nutrition",name:Object(u.a)("Nutrition"),elem:o.a.createElement(Kf,{nutrition:e.recipe.nutrition,servings:{amount:e.recipe.servings,unit:e.recipe.servings_unit},onRecipeChange:e.onRecipeChange,onModeChange:e.onModeChange})}),wprm_admin_modal.custom_fields&&wprm_admin_modal.custom_fields.fields&&0<Object.keys(wprm_admin_modal.custom_fields.fields).length&&t.push({id:"custom-fields",name:Object(u.a)("Custom Fields"),elem:o.a.createElement(Qf,{fields:e.recipe.custom_fields,onFieldChange:function(t,n){var r=Object.assign({},JSON.parse(JSON.stringify(e.recipe.custom_fields)));r[t]=n,e.onRecipeChange({custom_fields:r})}})}),t.push({id:"notes",name:Object(u.a)("Notes"),elem:o.a.createElement(ip,{notes:e.recipe.notes,onRecipeChange:e.onRecipeChange})}),o.a.createElement(r.Fragment,null,o.a.createElement(l.a,{onCloseModal:e.onCloseModal},e.loadingRecipe?Object(u.a)("Loading Recipe..."):o.a.createElement(r.Fragment,null,e.recipe.id?"".concat(Object(u.a)("Editing Recipe")," #").concat(e.recipe.id).concat(e.recipe.name?" - ".concat(e.recipe.name):""):"".concat(Object(u.a)("Creating new Recipe")).concat(e.recipe.name?" - ".concat(e.recipe.name):""))),o.a.createElement("div",{className:"wprm-admin-modal-recipe-quicklinks"},t.map(function(e,t){return o.a.createElement(i.Link,{to:"wprm-admin-modal-fields-group-".concat(e.id),containerId:"wprm-admin-modal-recipe-content",className:"wprm-admin-modal-recipe-quicklink",activeClass:"active",spy:!0,offset:-10,smooth:!0,duration:400,key:t},e.name)})),o.a.createElement(i.Element,{className:"wprm-admin-modal-content",id:"wprm-admin-modal-recipe-content"},e.loadingRecipe?o.a.createElement(p.a,null):o.a.createElement("form",{className:"wprm-admin-modal-recipe-fields"},t.map(function(t,n){return o.a.createElement(d,{header:t.name,id:t.id,key:100*e.forceRerender+n},t.elem)}))),o.a.createElement("div",{id:"wprm-admin-modal-toolbar-container"}),o.a.createElement(f.a,{savingChanges:e.savingChanges},"failed"===e.saveResult?o.a.createElement(s.a,{text:JSON.stringify(e.recipe),onCopy:function(e,t){t?alert(Object(u.a)('The recipe has been copied and can be used in the "Import from JSON" feature.')):alert(Object(u.a)("Something went wrong. Please contact support."))}},o.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault()}},Object(u.a)("Copy JSON to Clipboard"))):null,"ok"===e.saveResult?o.a.createElement("span",null,Object(u.a)("Saved successfully")):null,o.a.createElement("button",{className:"button button-primary",onClick:function(){e.saveRecipe(!1)},disabled:!e.changesMade},Object(u.a)("Save")),o.a.createElement("button",{className:"button button-primary",onClick:function(){e.changesMade?e.saveRecipe(!0):e.onCloseModal()}},e.changesMade?Object(u.a)("Save & Close"):Object(u.a)("Close"))))};function up(e){return(up="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 cp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function sp(e){return(sp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function lp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fp(e,t){return(fp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var pp=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==up(t)&&"function"!=typeof t?lp(e):t}(this,sp(t).call(this,e))).state={isSaving:!1,ingredients:JSON.parse(JSON.stringify(n.props.ingredients))},n.saveLinks=n.saveLinks.bind(lp(n)),n}var n,i,a;return function(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&&fp(e,t)}(t,r["Component"]),n=t,(i=[{key:"saveLinks",value:function(){var e=this,t=this.state.ingredients.filter(function(t,n){return!1!==t.globalLink&&JSON.stringify(t)!==JSON.stringify(e.props.ingredients[n])}).map(function(e){return{name:e.name,url:e.globalLink.url,nofollow:e.globalLink.nofollow}});this.setState({isSaving:!0},function(){Pl(t).then(function(t){t?e.props.onIngredientsChange(e.state.ingredients):e.setState({isSaving:!1})})})}},{key:"render",value:function(){var e=this,t=JSON.stringify(this.props.ingredients)!==JSON.stringify(this.state.ingredients);return o.a.createElement(r.Fragment,null,o.a.createElement(l.a,{onCloseModal:this.props.onCloseModal},Object(u.a)("Editing Global Ingredient Links")),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-container wprm-admin-modal-field-ingredient-links-edit-container"},o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links"},this.state.ingredients.map(function(t,n){return"group"!==t.type&&t.name?o.a.createElement(Fl,{ingredient:t,onLinkChange:function(t){var r=JSON.parse(JSON.stringify(e.state.ingredients));r[n].globalLink=t,e.setState({ingredients:r})},type:"edit-global",hasChanged:JSON.stringify(t)!==JSON.stringify(e.props.ingredients[n]),isUpdating:!1,key:n}):null}))),o.a.createElement(f.a,{savingChanges:this.state.isSaving},o.a.createElement("button",{className:"button",onClick:this.props.onCancel},Object(u.a)("Cancel")),o.a.createElement("button",{className:"button button-primary",onClick:this.saveLinks,disabled:!t},Object(u.a)("Save Changes"))))}}])&&cp(n.prototype,i),a&&cp(n,a),t}(),dp=(n(965),function(e){return e.ingredients.length?o.a.createElement("table",{className:"wprm-admin-modal-recipe-nutrition-calculation-source"},o.a.createElement("thead",null,o.a.createElement("tr",null,o.a.createElement("th",null,Object(u.a)("Used in Recipe")),o.a.createElement("th",null,Object(u.a)("Used for Calculation")),o.a.createElement("th",null,Object(u.a)("Nutrition Source")),o.a.createElement("th",null,Object(u.a)("API Match")))),o.a.createElement("tbody",null,e.ingredients.map(function(t,n){var r=!1;return t.nutrition.match&&"api"===t.nutrition.source&&t.nutrition.match.id&&"custom"!==t.nutrition.match.source&&(r=!0),o.a.createElement("tr",{key:n},o.a.createElement("td",null,"".concat(t.amount," ").concat(t.unit)),o.a.createElement("td",null,o.a.createElement(E.a,{type:"number",value:t.nutrition.amount,onChange:function(t){e.onIngredientChange(n,{amount:t})}}),o.a.createElement(E.a,{value:t.nutrition.unit,onChange:function(t){e.onIngredientChange(n,{unit:t})}}),t.name," ",t.notes?" (".concat(t.notes,")"):""),o.a.createElement("td",null,o.a.createElement(O.a,{options:[{value:"api",label:Object(u.a)("API")},{value:"custom",label:Object(u.a)("Saved/Custom")}],value:t.nutrition.source,onChange:function(t){e.onIngredientChange(n,{source:t})},width:150})),o.a.createElement("td",null,"api"===t.nutrition.source&&o.a.createElement("a",{href:"#",onClick:function(t){t.preventDefault(),e.onStepChange("match",{index:n})},className:r?"":"wprm-admin-modal-recipe-nutrition-calculation-source-no-match"},r?"".concat(t.nutrition.match.name).concat(t.nutrition.match.aisle?" (".concat(t.nutrition.match.aisle.toLowerCase(),")"):""):Object(u.a)("no match found"))))}))):o.a.createElement("p",null,Object(u.a)("No ingredients set for this recipe."))});function hp(e){return(hp="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 mp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function vp(e){return(vp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yp(e,t){return(yp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var bp=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==hp(t)&&"function"!=typeof t?gp(e):t}(this,vp(t).call(this,e))).searchInput=o.a.createRef();var r=e.ingredient.nutrition.matchSearch,i=e.ingredient.nutrition.matchOptions,a=!1;return!1===i&&(r=e.ingredient.name,a=!0,n.searchApi(r)),n.state={search:r,prevSearch:r,options:i,isSearching:a},n.onSearch=n.onSearch.bind(gp(n)),n.searchApi=n.searchApi.bind(gp(n)),n}var n,i,a;return function(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&&yp(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidMount",value:function(){this.searchInput.current.focus()}},{key:"onSearch",value:function(){var e=this;this.state.isSearching||""===this.state.search||this.setState({isSearching:!0},function(){e.searchApi(e.state.search)})}},{key:"searchApi",value:function(e){var t=this;zf.a.getApiOptions(e).then(function(n){n&&t.setState({options:n.matchOptions,prevSearch:e,isSearching:!1})})}},{key:"render",value:function(){var e=this,t=this.props.ingredient,n="".concat(t.amount," ").concat(t.unit," ").concat(t.name);return t.notes&&(n+=" (".concat(t.notes,")")),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-match"},o.a.createElement("p",null,o.a.createElement("strong",null,Object(u.a)("Find a match for:"))," ",n),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-match-search"},o.a.createElement("input",{ref:this.searchInput,type:"text",value:this.state.search,onChange:function(t){e.setState({search:t.target.value})},onKeyDown:function(t){13!==t.which&&13!==t.keyCode||e.onSearch()},disabled:this.state.isSearching}),o.a.createElement("button",{className:"button button-primary",onClick:this.onSearch,disabled:this.state.isSearching||""===this.state.search||this.state.prevSearch===this.state.search},Object(u.a)("Search"))),this.state.isSearching?o.a.createElement(p.a,null):o.a.createElement(r.Fragment,null,this.state.options&&0!==this.state.options.length?o.a.createElement(r.Fragment,null,!1!==this.state.prevSearch&&o.a.createElement("p",null,Object(u.a)("Results for"),' "',this.state.prevSearch,'":'),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-matches"},this.state.options.map(function(t,n){return o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-matches-option",onClick:function(){e.props.onMatchChange({match:t,matchSearch:e.state.search,matchOptions:e.state.options})},key:n},t.image?o.a.createElement("img",{className:"wprm-admin-modal-recipe-nutrition-calculation-matches-option-image",src:"https://spoonacular.com/cdn/ingredients_100x100/".concat(t.image)}):null,o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-matches-option-name"},t.name,t.aisle?" (".concat(t.aisle.toLowerCase(),")"):""))}))):o.a.createElement(r.Fragment,null,this.state.prevSearch?o.a.createElement("p",null,Object(u.a)("No ingredients found for"),' "',this.state.prevSearch,'".'):o.a.createElement("p",null,Object(u.a)("No ingredients found.")))))}}])&&mp(n.prototype,i),a&&mp(n,a),t}(),wp=n(465),Op=n(443);function Ep(e){return(Ep="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 xp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){kp(e,t,n[t])})}return e}function kp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Cp(e,t){return!t||"object"!==Ep(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function jp(e){return(jp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _p(e,t){return(_p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ip=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Cp(this,jp(t).apply(this,arguments))}var n,i,a;return function(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&&_p(e,t)}(t,r["Component"]),n=t,(i=[{key:"getOptions",value:function(e){return(e=e||this.props.defaultSearch)?zf.a.getCustomIngredients(e).then(function(e){return e?e.ingredients:[]}):Promise.resolve([])}},{key:"render",value:function(){return o.a.createElement(Op.a,{placeholder:Object(u.a)("Select or search for a saved ingredient"),value:this.props.value,onChange:this.props.onValueChange,getOptionValue:function(e){return e.id},getOptionLabel:function(e){return e.text},loadOptions:this.getOptions.bind(this),defaultOptions:!0,clearable:!1,menuPlacement:"top",styles:{control:function(e){return xp({},e,{backgroundColor:"white"})},container:function(e){return xp({},e,{width:"100%",maxWidth:"440px",marginBottom:"10px"})}}})}}])&&Sp(n.prototype,i),a&&Sp(n,a),t}();function Tp(e){return(Tp="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 Np(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ap(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Pp(e){return(Pp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Dp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mp(e,t){return(Mp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Lp=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Tp(t)&&"function"!=typeof t?Dp(e):t}(this,Pp(t).call(this,e))).state={amount:"",unit:"",name:"",facts:{},savedIngredient:!1,savedAmount:!1},n.initCustomIngredient=n.initCustomIngredient.bind(Dp(n)),n.getSavedFacts=n.getSavedFacts.bind(Dp(n)),n.useCustomFacts=n.useCustomFacts.bind(Dp(n)),n.useSavedFacts=n.useSavedFacts.bind(Dp(n)),n.useFacts=n.useFacts.bind(Dp(n)),n}var n,i,a;return function(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&&Mp(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidMount",value:function(){this.initCustomIngredient()}},{key:"componentDidUpdate",value:function(e){this.props.index!==e.index&&this.initCustomIngredient()}},{key:"initCustomIngredient",value:function(){var e=this.props.ingredient,t=e&&e.nutrition?e.nutrition.amount:"",n=e&&e.nutrition?e.nutrition.unit:"",r=e?e.name:"";this.setState({amount:t,unit:n,name:r,facts:{},savedIngredient:!1,savedAmount:!1})}},{key:"getSavedFacts",value:function(){var e=this,t={};if(this.state.savedIngredient&&this.state.savedIngredient.nutrition){var n=1;if(this.state.savedAmount&&parseFloat(this.state.savedAmount)){var r=this.state.savedIngredient.nutrition.amount?parseFloat(this.state.savedIngredient.nutrition.amount):1;n=parseFloat(this.state.savedAmount)/r}Object.keys(this.state.savedIngredient.nutrition.nutrients).map(function(r,o){var i=e.state.savedIngredient.nutrition.nutrients[r];i&&(t[r]=Jl(n*i,1))})}return t}},{key:"useCustomFacts",value:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]?""===this.state.name.trim()?alert(Object(u.a)("A name is required for this saved nutrition ingredient.")):(zf.a.saveCustomIngredient(0,this.state.amount,this.state.unit,this.state.name,this.state.facts),this.useFacts(this.state.facts)):this.useFacts(this.state.facts)}},{key:"useSavedFacts",value:function(){this.useFacts(this.getSavedFacts())}},{key:"useFacts",value:function(e){this.props.onFactsChange(e)}},{key:"render",value:function(){var e=this,t=this.props.ingredient;if(!t)return null;var n=t.nutrition&&t.nutrition.amount?"".concat(t.nutrition.amount," "):"";return n+=t.nutrition&&t.nutrition.unit?"".concat(t.nutrition.unit," "):"",n+=t.name?t.name:"",o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-custom"},o.a.createElement("h2",null,Object(u.a)("Save a new Custom Ingredient")),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-custom-ingredient"},o.a.createElement(E.a,{type:"number",placeholder:Object(u.a)("Amount"),value:this.state.amount,onChange:function(t){e.setState({amount:t})}}),o.a.createElement(E.a,{placeholder:Object(u.a)("Unit"),value:this.state.unit,onChange:function(t){e.setState({unit:t})}}),o.a.createElement(E.a,{placeholder:Object(u.a)("Name (required)"),value:this.state.name,onChange:function(t){e.setState({name:t})}})),o.a.createElement(wp.a,{id:"custom-ingredient",facts:this.state.facts,onChange:function(t,n){var r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Np(e,t,n[t])})}return e}({},e.state.facts);r[t]=n,e.setState({facts:r})}}),o.a.createElement("button",{className:"button button-primary",onClick:function(){e.useCustomFacts(!0)}},Object(u.a)("Save for Later & Use")),o.a.createElement("button",{className:"button button-primary",onClick:function(){e.useCustomFacts(!1)}},Object(u.a)("Use")),o.a.createElement("h2",null,Object(u.a)("Select a saved ingredient")),o.a.createElement(Ip,{value:!1,onValueChange:function(n){var r=n.nutrition.amount;n.nutrition&&t.nutrition&&n.nutrition.unit===t.nutrition.unit&&(r=t.nutrition.amount),e.setState({savedIngredient:n,savedAmount:r})},defaultSearch:this.props.ingredient.name}),this.state.savedIngredient?o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-custom-saved-ingredient"},o.a.createElement("strong",null,Object(u.a)("Match this equation to get the correct amounts:")),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-custom-saved-ingredient-match"},n," = ",o.a.createElement(E.a,{type:"number",value:this.state.savedAmount,onChange:function(t){e.setState({savedAmount:t})}})," ",this.state.savedIngredient.nutrition.unit," ",this.state.savedIngredient.text)),o.a.createElement(wp.a,{id:"saved-ingredient",facts:this.getSavedFacts()})):null,o.a.createElement("button",{className:"button button-primary",onClick:this.useSavedFacts,disabled:!this.state.savedIngredient},Object(u.a)("Use")))}}])&&Ap(n.prototype,i),a&&Ap(n,a),t}();function Rp(e){return(Rp="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 Fp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function zp(e,t){return!t||"object"!==Rp(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Up(e){return(Up=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function qp(e,t){return(qp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Wp=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=zp(this,Up(t).call(this,e))).state={editingIndex:!1},n}var n,i,a;return function(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&&qp(e,t)}(t,r["Component"]),n=t,(i=[{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredients"},this.props.ingredients.map(function(t,n){var r=t.amount?"".concat(t.amount," "):"";r+=t.unit?"".concat(t.unit," "):"",r+=t.name?t.name:"";var i=!!t.nutrition.match,a=i&&t.nutrition.match.name?t.nutrition.match.name:Object(u.a)("n/a"),c=[];if(t.nutrition.facts)for(var s=0,l=["calories","carbohydrates","fat","protein"];s<l.length;s++){var f=l[s];if(t.nutrition.facts[f]){var p=Jl(t.nutrition.facts[f],0);c.push("".concat(wprm_admin_modal.nutrition[f].label,": ").concat(p).concat(wprm_admin_modal.nutrition[f].unit))}}return 0<c.length&&(a+=" - ".concat(c.join(" | "))),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-container",key:n},o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient".concat(t.nutrition.factsUsed?"":" wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-not-used")},o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-select"},o.a.createElement("input",{id:"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-".concat(n),type:"checkbox",checked:t.nutrition.factsUsed,onChange:function(t){e.props.onChangeNutrition(n,{factsUsed:t.target.checked})}}),o.a.createElement("label",{htmlFor:"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-".concat(n)},r)),o.a.createElement("a",{href:"#",onClick:function(t){t.preventDefault(),e.setState({editingIndex:n!==e.state.editingIndex&&n})},className:i?"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-match":"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-no-match",style:n===e.state.editingIndex?{fontWeight:"bold"}:null},a)),n===e.state.editingIndex&&o.a.createElement(wp.a,{id:"".concat(e.props.id,"-ingredients"),facts:t.nutrition.facts,onChange:function(r,o){var i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Fp(e,t,n[t])})}return e}({},t.nutrition.facts);i[r]=o,e.props.onChangeNutrition(n,{facts:i})}}))}))}}])&&Bp(n.prototype,i),a&&Bp(n,a),t}(),Hp=function(e){return o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-summary"},e.servings?o.a.createElement("p",null,Object(u.a)("Values of all the checked ingredients will be added together and")," ",o.a.createElement("strong",null,Object(u.a)("divided by")," ",e.servings),", ",Object(u.a)("the number of servings for this recipe.")):o.a.createElement("p",null,Object(u.a)("Values of all the checked ingredients will be added together.")),0<e.apiIngredients.length&&o.a.createElement(r.Fragment,null,o.a.createElement("h2",null,Object(u.a)("API Ingredients")),o.a.createElement(Wp,{id:"api",ingredients:e.apiIngredients,onChangeNutrition:e.onApiIngredientsChange})),0<e.customIngredients.length&&o.a.createElement(r.Fragment,null,o.a.createElement("h2",null,Object(u.a)("Custom Ingredients")),o.a.createElement(Wp,{id:"custom",ingredients:e.customIngredients,onChangeNutrition:e.onCustomIngredientsChange})),o.a.createElement("h2",null,Object(u.a)("Recipe Nutrition Facts Preview")),o.a.createElement("p",null,Object(u.a)("Changes to these values can be made after confirming with the blue button.")),o.a.createElement(wp.a,{id:"summary-preview",facts:e.recipeFactsPreview}))};function Vp(e){return(Vp="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 Gp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Jp(e,t,n[t])})}return e}function Jp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Yp(e){return(Yp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Kp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xp(e,t){return(Xp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Qp=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==Vp(t)&&"function"!=typeof t?Kp(e):t}(this,Yp(t).call(this,e));var r=e.ingredients.filter(function(e){return"ingredient"===e.type&&e.name});return r=r.map(function(e){var t=e.unit;return t=(t=t.replace(/(<([^>]+)>)/gi,"")).replace(/(\[([^\]]+)\])/gi,""),e.nutrition={amount:Zl(e.amount),unit:t},e}),zf.a.getMatches(r).then(function(e){e?n.setState({ingredients:e.ingredients,calculating:!1}):n.setState({calculating:!1})}),n.state={step:"source",stepArgs:{},ingredients:[],apiIngredients:[],customIngredients:[],calculating:!0},n.onStepChange=n.onStepChange.bind(Kp(n)),n.onIngredientChange=n.onIngredientChange.bind(Kp(n)),n}var n,i,a;return function(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&&Xp(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidUpdate",value:function(e,t){var n=this;if("source"===t.step&&"summary"===this.state.step){var r=this.state.ingredients.filter(function(e){return"api"===e.nutrition.source}),o=this.state.ingredients.filter(function(e){return"custom"===e.nutrition.source}),i=!1,a="summary";0<r.length&&(i=!0,zf.a.getApiFacts(r).then(function(e){e?n.setState({calculating:!1,apiIngredients:e.ingredients}):n.setState({calculating:!1})})),0<o.length&&(a="custom"),this.setState({calculating:i,customIngredients:o,step:a})}"custom"===this.state.step&&(0===this.state.customIngredients.filter(function(e){return!e.nutrition.hasOwnProperty("facts")}).length&&this.setState({step:"summary"}))}},{key:"onStepChange",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.setState({step:e,stepArgs:t})}},{key:"onIngredientChange",value:function(e,t){var n=JSON.parse(JSON.stringify(this.state.ingredients));n[e].nutrition=Gp({},n[e].nutrition,t),this.setState({ingredients:n})}},{key:"getRecipeFacts",value:function(){var e=JSON.parse(JSON.stringify(wprm_admin_modal.nutrition));delete e.serving_size;var t={},n=this.props.servings&&parseInt(this.props.servings)>0?parseInt(this.props.servings):1;for(var r in e){var o=!1,i=!0,a=!1,u=void 0;try{for(var c,s=this.state.apiIngredients.concat(this.state.customIngredients)[Symbol.iterator]();!(i=(c=s.next()).done);i=!0){var l=c.value;l.nutrition.factsUsed&&l.nutrition.facts&&l.nutrition.facts[r]&&(o?o+=parseFloat(l.nutrition.facts[r]):o=parseFloat(l.nutrition.facts[r]))}}catch(e){a=!0,u=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw u}}o&&(o=Jl(o/=n,0)),t[r]=o}return t}},{key:"render",value:function(){var e=this,t=null;switch(this.state.step){case"source":t=o.a.createElement(dp,{ingredients:this.state.ingredients,onIngredientChange:this.onIngredientChange,onStepChange:this.onStepChange});break;case"match":var n=this.state.stepArgs.index;t=o.a.createElement(bp,{ingredient:this.state.ingredients[n],onMatchChange:function(t){e.onIngredientChange(n,Gp({},t)),e.onStepChange("source")}});break;case"custom":var i=this.state.customIngredients.findIndex(function(e){return!e.nutrition.hasOwnProperty("facts")});t=o.a.createElement(Lp,{index:i,ingredient:this.state.customIngredients[i],onFactsChange:function(t){var n=JSON.parse(JSON.stringify(e.state.customIngredients));n[i].nutrition.facts=t,e.setState({customIngredients:n})}});break;case"summary":t=o.a.createElement(Hp,{servings:this.props.servings,recipeFactsPreview:this.getRecipeFacts(),apiIngredients:this.state.apiIngredients,customIngredients:this.state.customIngredients,onApiIngredientsChange:function(t,n){var r=JSON.parse(JSON.stringify(e.state.apiIngredients));r[t].nutrition=Gp({},r[t].nutrition,n),e.setState({apiIngredients:r})},onCustomIngredientsChange:function(t,n){var r=JSON.parse(JSON.stringify(e.state.customIngredients));r[t].nutrition=Gp({},r[t].nutrition,n),e.setState({customIngredients:r})}})}var a=null,c=o.a.createElement("button",{className:"button",onClick:function(){e.onStepChange("source")}},Object(u.a)("Go Back"));switch(this.state.step){case"source":a=o.a.createElement(r.Fragment,null,o.a.createElement("button",{className:"button",onClick:this.props.onCancel},Object(u.a)("Cancel Calculation")),o.a.createElement("button",{className:"button button-primary",onClick:function(){e.onStepChange("summary")}},Object(u.a)("Go to Next Step")));break;case"match":a=o.a.createElement(r.Fragment,null,c);break;case"summary":a=o.a.createElement(r.Fragment,null,c,o.a.createElement("button",{className:"button button-primary",onClick:function(){var t=e.getRecipeFacts();e.props.onNutritionChange(t)}},Object(u.a)("Use These Values")))}return o.a.createElement(r.Fragment,null,o.a.createElement(l.a,{onCloseModal:this.props.onCloseModal},this.props.name?"".concat(this.props.name," - ").concat(Object(u.a)("Nutrition Calculation")):"".concat(Object(u.a)("Recipe")," - ").concat(Object(u.a)("Nutrition Calculation"))),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation"},this.state.calculating&&"custom"!==this.state.step?o.a.createElement(p.a,null):t),o.a.createElement(f.a,{savingChanges:this.state.calculating&&"custom"!==this.state.step},a))}}])&&Zp(n.prototype,i),a&&Zp(n,a),t}(),$p=n(95),ed=n.n($p),td=(n(966),wprm_admin.endpoints.modal),nd=function(e){var t={ingredients:e};return $n.a.call("".concat(td,"/ingredient/parse"),"POST",t)},rd=function(e){return o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-groups"},o.a.createElement("p",null,Object(u.a)("All of these will be imported. Use the checkbox to indicate group headers.")," "),e.value.map(function(t,n){return o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-groups-field",key:n},o.a.createElement("input",{type:"checkbox",checked:t.group,onChange:function(t){var r=JSON.parse(JSON.stringify(e.value));r[n].group=t.target.checked,e.onChange(r)}}),o.a.createElement("input",{type:"text",value:t.text,style:t.group?{fontWeight:"bold"}:null,onChange:function(t){var r=JSON.parse(JSON.stringify(e.value));r[n].text=t.target.value,e.onChange(r)}}))}))};function od(e){return(od="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 id(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ad(e,t,n[t])})}return e}function ad(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ud(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function cd(e){return(cd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function sd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ld(e,t){return(ld=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var fd=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==od(t)&&"function"!=typeof t?sd(e):t}(this,cd(t).call(this,e))).textInput=o.a.createRef();var r="";return e.text&&(r=n.cleanUpText(e.text)),n.state={text:r,name:!1,summary:!1,equipment:!1,ingredients:!1,instructions:!1,notes:!1,isParsing:!1},n.cleanUpText=n.cleanUpText.bind(sd(n)),n.setSelection=n.setSelection.bind(sd(n)),n.useValues=n.useValues.bind(sd(n)),n}var n,i,a;return function(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&&ld(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidMount",value:function(){this.textInput.current.focus()}},{key:"cleanUpText",value:function(e){return e=e.replace(/(<([^>]+)>)/gi,""),e=ed.a.decode(e)}},{key:"setSelection",value:function(e){var t=this.textInput.current,n=t.value.substring(t.selectionStart,t.selectionEnd);if(n=n||!1,"equipment"!==e&&"ingredients"!==e&&"instructions"!==e||(n=this.getSeperateFields(n)),n!==this.state[e]){var r={};r[e]=n,this.setState(r)}}},{key:"getSeperateFields",value:function(e){if(!1===e)return!1;var t=[],n=e.split(/[\r\n]+/),r=!0,o=!1,i=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=a.value;(c=(c=c.trim()).replace(/\d\.\s+|[a-z]\)\s+|•\s+|[A-Z]\.\s+|[IVX]+\.\s+/g,""))&&t.push({group:!1,text:c})}}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return!!t.length&&t}},{key:"useValues",value:function(){var e=this,t={};if(!1!==this.state.name&&(t.name=this.state.name),!1!==this.state.summary&&(t.summary=this.state.summary),!1!==this.state.notes&&(t.notes=this.state.notes),!1!==this.state.equipment){var n=[];this.state.equipment.map(function(e,t){n.push({uid:t,name:e.text})}),t.equipment=n}if(!1!==this.state.instructions){var r=[];this.state.instructions.map(function(e,t){e.group?r.push({uid:t,type:"group",name:e.text}):r.push({uid:t,type:"instruction",text:e.text,image:0,image_url:""})}),t.instructions_flat=r}var o=[],i={};!1!==this.state.ingredients&&(this.state.ingredients.map(function(e,t){e.group?o.push({uid:t,type:"group",name:e.text}):(o.push({uid:t,type:"ingredient",amount:"",unit:"",name:"",notes:""}),i[t]=e.text)}),t.ingredients_flat=o),0<Object.keys(i).length?this.setState({isParsing:!0},function(){nd(i).then(function(n){if(n){for(var r in n.parsed){var o=n.parsed[r];t.ingredients_flat[r]=id({},t.ingredients_flat[r],o)}e.props.onImportValues(t)}else e.setState({isParsing:!1})})}):this.props.onImportValues(t)}},{key:"render",value:function(){var e=this,t=!1!==this.state.name||!1!==this.state.summary||!1!==this.state.equipment||!1!==this.state.ingredients||!1!==this.state.instructions||!1!==this.state.notes;return o.a.createElement(r.Fragment,null,o.a.createElement(l.a,{onCloseModal:this.props.onCloseModal},this.props.recipe.name?"".concat(this.props.recipe.name," - ").concat(Object(u.a)("Import from Text")):"".concat(Object(u.a)("Recipe")," - ").concat(Object(u.a)("Import from Text"))),o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-container"},o.a.createElement("h2",null,Object(u.a)("1. Highlight text and click the corresponding button")),o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-selection"},o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-buttons"},o.a.createElement("button",{className:!1!==this.state.name?"button wprm-selection-made":"button",onClick:function(){return e.setSelection("name")}},Object(u.a)("Name")),o.a.createElement("button",{className:!1!==this.state.summary?"button wprm-selection-made":"button",onClick:function(){return e.setSelection("summary")}},Object(u.a)("Summary")),o.a.createElement("button",{className:!1!==this.state.equipment?"button wprm-selection-made":"button",onClick:function(){return e.setSelection("equipment")}},Object(u.a)("Equipment")),o.a.createElement("button",{className:!1!==this.state.ingredients?"button wprm-selection-made":"button",onClick:function(){return e.setSelection("ingredients")}},Object(u.a)("Ingredients")),o.a.createElement("button",{className:!1!==this.state.instructions?"button wprm-selection-made":"button",onClick:function(){return e.setSelection("instructions")}},Object(u.a)("Instructions")),o.a.createElement("button",{className:!1!==this.state.notes?"button wprm-selection-made":"button",onClick:function(){return e.setSelection("notes")}},Object(u.a)("Notes"))),o.a.createElement("textarea",{ref:this.textInput,value:this.state.text,placeholder:Object(u.a)("Paste or type recipe"),onChange:function(t){e.setState({text:e.cleanUpText(t.target.value)})}})),o.a.createElement("h2",null,Object(u.a)("2. Fine-tune selections")),o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-finetune"},t?o.a.createElement(r.Fragment,null,!1!==this.state.name&&o.a.createElement(h.a,{label:Object(u.a)("Name")},o.a.createElement(E.a,{name:"recipe-name",value:this.state.name,onChange:function(t){e.setState({name:t})}})),!1!==this.state.summary&&o.a.createElement(h.a,{label:Object(u.a)("Summary")},o.a.createElement(m.a,{value:this.state.summary,onChange:function(t){e.setState({summary:t})}})),!1!==this.state.equipment&&o.a.createElement(h.a,{label:Object(u.a)("Equipment")},this.state.equipment.map(function(t,n){return o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-equipment-field",key:n},o.a.createElement(E.a,{value:t.text,onChange:function(t){var r=JSON.parse(JSON.stringify(e.state.equipment));r[n].text=t,e.setState({equipment:r})}}))})),!1!==this.state.ingredients&&o.a.createElement(h.a,{label:Object(u.a)("Ingredients"),help:Object(u.a)("Use the checkboxes to indicate group headers (like Frosting and Cake)")},o.a.createElement(rd,{value:this.state.ingredients,onChange:function(t){e.setState({ingredients:t})}})),!1!==this.state.instructions&&o.a.createElement(h.a,{label:Object(u.a)("Instructions"),help:Object(u.a)("Use the checkboxes to indicate group headers (like Frosting and Cake)")},o.a.createElement(rd,{value:this.state.instructions,onChange:function(t){e.setState({instructions:t})}})),!1!==this.state.notes&&o.a.createElement(h.a,{label:Object(u.a)("Notes")},o.a.createElement(m.a,{value:this.state.notes,onChange:function(t){e.setState({notes:t})}}))):o.a.createElement("p",null,Object(u.a)("Make a selection using the buttons above first.")))),o.a.createElement(f.a,{savingChanges:this.state.isParsing},o.a.createElement("button",{className:"button",onClick:this.props.onCancel},Object(u.a)("Cancel")),o.a.createElement("button",{className:"button button-primary",onClick:this.useValues,disabled:!t},Object(u.a)("Use these Values"))))}}])&&ud(n.prototype,i),a&&ud(n,a),t}();function pd(e){return(pd="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 dd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){hd(e,t,n[t])})}return e}function hd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function md(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function vd(e){return(vd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yd(e,t){return(yd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}n.d(t,"a",function(){return bd});var bd=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==pd(t)&&"function"!=typeof t?gd(e):t}(this,vd(t).call(this,e));var r=JSON.parse(JSON.stringify(wprm_admin_modal.recipe)),o=!1;return e.args.hasOwnProperty("recipe")?r=JSON.parse(JSON.stringify(e.args.recipe)):e.args.hasOwnProperty("recipeId")&&(o=!0,a.a.getRecipe(e.args.recipeId).then(function(t){if(t){var r=JSON.parse(JSON.stringify(t.recipe));e.args.cloneRecipe&&delete r.id,n.setState({recipe:r,originalRecipe:e.args.cloneRecipe||e.args.restoreRevision?{}:JSON.parse(JSON.stringify(r)),loadingRecipe:!1,mode:"recipe"}),n.scrollToGroup()}else n.setState({loadingRecipe:!1})})),n.state={recipe:r,originalRecipe:e.args.cloneRecipe||e.args.restoreRevision?{}:JSON.parse(JSON.stringify(r)),savingChanges:!1,saveResult:!1,loadingRecipe:o,forceRerender:0,mode:"recipe"},n.scrollToGroup=n.scrollToGroup.bind(gd(n)),n.onModeChange=n.onModeChange.bind(gd(n)),n.onRecipeChange=n.onRecipeChange.bind(gd(n)),n.saveRecipe=n.saveRecipe.bind(gd(n)),n.allowCloseModal=n.allowCloseModal.bind(gd(n)),n.changesMade=n.changesMade.bind(gd(n)),n}var n,c,s;return function(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&&yd(e,t)}(t,r["Component"]),n=t,(c=[{key:"componentDidMount",value:function(){"recipe"!==this.state.mode||this.state.loadingRecipe||this.scrollToGroup()}},{key:"onModeChange",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r={mode:e};"text-import"===e&&(r.textImportText=n),this.setState(r,function(){"recipe"===e&&(n=n||"media",t.scrollToGroup(n))})}},{key:"scrollToGroup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"media";i.scroller.scrollTo("wprm-admin-modal-fields-group-".concat(e),{containerId:"wprm-admin-modal-recipe-content",offset:-10})}},{key:"onRecipeChange",value:function(e){this.setState(function(t){return{recipe:dd({},t.recipe,e)}})}},{key:"saveRecipe",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.state.savingChanges||this.setState({savingChanges:!0,saveResult:!1},function(){a.a.saveRecipe(e.state.recipe).then(function(n){if(n&&n.recipe){var r=JSON.parse(JSON.stringify(n.recipe));e.setState(function(e){return{recipe:r,originalRecipe:JSON.parse(JSON.stringify(r)),savingChanges:!1,saveResult:"ok",forceRerender:e.forceRerender+1}},function(){"function"==typeof e.props.args.saveCallback&&e.props.args.saveCallback(r),t&&e.props.maybeCloseModal(),setTimeout(function(){"ok"===e.state.saveResult&&e.setState({saveResult:!1})},3e3)})}else e.setState({savingChanges:!1,saveResult:"failed"})})})}},{key:"allowCloseModal",value:function(){switch(this.state.mode){case"nutrition-calculation":return confirm(Object(u.a)("Are you sure you want to stop calculating the nutrition facts?"))&&this.onModeChange("recipe","nutrition"),!1;case"ingredient-links":return this.onModeChange("recipe","ingredients"),!1;case"text-import":return this.onModeChange("recipe"),!1}return!this.state.savingChanges&&(!this.changesMade()||confirm(Object(u.a)("Are you sure you want to close without saving changes?")))}},{key:"changesMade",value:function(){return JSON.stringify(this.state.recipe)!==JSON.stringify(this.state.originalRecipe)}},{key:"render",value:function(){var e=this;switch(this.state.mode){case"nutrition-calculation":return o.a.createElement(Qp,{onCloseModal:this.props.maybeCloseModal,name:this.state.recipe.name,servings:this.state.recipe.servings,ingredients:this.state.recipe.ingredients_flat,onCancel:function(){e.onModeChange("recipe","nutrition")},onNutritionChange:function(t){var n={};Object.keys(wprm_admin_modal.nutrition).map(function(e,r){t.hasOwnProperty(e)?n[e]=t[e]:n[e]=!1}),n.serving_size=!!e.state.recipe.nutrition.hasOwnProperty("serving_size")&&e.state.recipe.nutrition.serving_size,n.serving_unit=!!e.state.recipe.nutrition.hasOwnProperty("serving_unit")&&e.state.recipe.nutrition.serving_unit,e.onRecipeChange({nutrition:n}),e.onModeChange("recipe","nutrition")}});case"ingredient-links":return o.a.createElement(pp,{onCloseModal:this.props.maybeCloseModal,onCancel:function(){e.onModeChange("recipe","ingredients")},ingredients:this.state.recipe.ingredients_flat,onIngredientsChange:function(t){e.onRecipeChange({ingredients_flat:t}),e.onModeChange("recipe","ingredients")}});case"text-import":return o.a.createElement(fd,{onCloseModal:this.props.maybeCloseModal,onCancel:function(){e.onModeChange("recipe")},text:this.state.textImportText,recipe:this.state.recipe,onImportValues:function(t){e.onRecipeChange(t),e.onModeChange("recipe")}});default:return o.a.createElement(ap,{onCloseModal:this.props.maybeCloseModal,changesMade:this.changesMade(),savingChanges:this.state.savingChanges,saveResult:this.state.saveResult,loadingRecipe:this.state.loadingRecipe,recipe:this.state.recipe,onRecipeChange:this.onRecipeChange,saveRecipe:this.saveRecipe,forceRerender:this.state.forceRerender,onModeChange:this.onModeChange})}}}])&&md(n.prototype,c),s&&md(n,s),t}()},,,,function(e,t,n){"use strict";var r=n(0),o=n.n(r),i=(n(889),n(56)),a=wprm_admin.endpoints.manage,u=function(e,t,n,r){var o={type:t,ids:n,action:r};return i.a.call("".concat(a,"/").concat(e,"/bulk"),"POST",o)},c=n(169),s=n(174),l=n(2),f=n(175),p=n(68),d=n(417);function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){m(e,t,n[t])})}return e}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var v=function(e){var t=!!e.action&&e.action.type,n=[{value:"change-link",label:Object(l.a)("Change Link"),default:""},{value:"change-nofollow",label:Object(l.a)("Change Link Nofollow"),default:"default"},{value:"delete",label:Object(l.a)("Delete Equipment"),default:!1}];return o.a.createElement("form",null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Select an action to perform:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-actions"},n.map(function(n){return o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-action",key:n.value},o.a.createElement("input",{type:"radio",value:n.value,name:"wprm-admin-radio-bulk-edit-action",id:"wprm-admin-radio-bulk-edit-action-".concat(n.value),checked:t===n.value,onChange:function(){var t={type:n.value,options:n.default};e.onActionChange(t)}}),o.a.createElement("label",{htmlFor:"wprm-admin-radio-bulk-edit-action-".concat(n.value)},n.label))})),t&&!1!==e.action.options&&o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Action options:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-options"},"change-link"===t&&o.a.createElement(p.a,{name:"equipment-link",value:e.action.options,placeholder:Object(l.a)("Equipment Link"),onChange:function(t){var n=h({},e.action,{options:t});e.onActionChange(n)}}),"change-nofollow"===t&&o.a.createElement(d.a,{id:"nofollow",options:wprm_admin_modal.options.equipment_link_nofollow,value:e.action.options,onChange:function(t){var n=h({},e.action,{options:t});e.onActionChange(n)}}))))};function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){y(e,t,n[t])})}return e}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var b=function(e){var t=!!e.action&&e.action.type,n=[{value:"change-group",label:Object(l.a)("Change Shopping List Group"),default:""},{value:"change-link",label:Object(l.a)("Change Link"),default:""},{value:"change-nofollow",label:Object(l.a)("Change Link Nofollow"),default:"default"},{value:"delete",label:Object(l.a)("Delete Ingredients"),default:!1}];return o.a.createElement("form",null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Select an action to perform:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-actions"},n.map(function(n){return o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-action",key:n.value},o.a.createElement("input",{type:"radio",value:n.value,name:"wprm-admin-radio-bulk-edit-action",id:"wprm-admin-radio-bulk-edit-action-".concat(n.value),checked:t===n.value,onChange:function(){var t={type:n.value,options:n.default};e.onActionChange(t)}}),o.a.createElement("label",{htmlFor:"wprm-admin-radio-bulk-edit-action-".concat(n.value)},n.label))})),t&&!1!==e.action.options&&o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Action options:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-options"},"change-group"===t&&o.a.createElement(p.a,{name:"shopping-list-group",value:e.action.options,placeholder:Object(l.a)("Shopping List Group"),onChange:function(t){var n=g({},e.action,{options:t});e.onActionChange(n)}}),"change-link"===t&&o.a.createElement(p.a,{name:"ingredient-link",value:e.action.options,placeholder:Object(l.a)("Ingredient Link"),onChange:function(t){var n=g({},e.action,{options:t});e.onActionChange(n)}}),"change-nofollow"===t&&o.a.createElement(d.a,{id:"nofollow",options:wprm_admin_modal.options.ingredient_link_nofollow,value:e.action.options,onChange:function(t){var n=g({},e.action,{options:t});e.onActionChange(n)}}))))},w=function(e){var t=!!e.action&&e.action.type,n=[{value:"delete",label:Object(l.a)("Delete Ratings"),default:!1}];return o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Select an action to perform:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-actions"},n.map(function(n){return o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-action",key:n.value},o.a.createElement("input",{type:"radio",value:n.value,name:"wprm-admin-radio-bulk-edit-action",id:"wprm-admin-radio-bulk-edit-action-".concat(n.value),checked:t===n.value,onChange:function(){var t={type:n.value,options:n.default};e.onActionChange(t)}}),o.a.createElement("label",{htmlFor:"wprm-admin-radio-bulk-edit-action-".concat(n.value)},n.label))})))},O=n(399),E=n(645);function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){k(e,t,n[t])})}return e}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=function(e){var t=!!e.action&&e.action.type,n=!1,i=[];Object.keys(wprm_admin_manage.taxonomies).map(function(e,t){var r=e.substr(5);n||(n=r),i.push({value:r,label:wprm_admin_manage.taxonomies[e].name})});var a=[];return 0<i.length&&a.push({value:"add-terms",label:Object(l.a)("Add Terms"),default:{taxonomy:n,terms:[]}},{value:"remove-terms",label:Object(l.a)("Remove Terms"),default:{taxonomy:n,terms:[]}}),a.push({value:"change-type",label:Object(l.a)("Change Recipe Type"),default:"food"},{value:"change-author",label:Object(l.a)("Change Display Author"),default:{author:"default",author_name:"",author_link:""}},{value:"export",label:Object(l.a)("Export Recipes"),default:!1,required:"premium"},{value:"delete",label:Object(l.a)("Delete Recipes"),default:!1}),o.a.createElement("form",null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Select an action to perform:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-actions"},a.map(function(n){return o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-action",key:n.value},o.a.createElement("input",{type:"radio",value:n.value,name:"wprm-admin-radio-bulk-edit-action",id:"wprm-admin-radio-bulk-edit-action-".concat(n.value),checked:t===n.value,onChange:function(){var t={type:n.value,options:n.default};n.hasOwnProperty("required")&&(t.required=n.required),e.onActionChange(t)}}),o.a.createElement("label",{htmlFor:"wprm-admin-radio-bulk-edit-action-".concat(n.value)},n.label))})),t&&!1!==e.action.options&&o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Action options:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-options"},"change-type"===t&&o.a.createElement(d.a,{id:"type",options:[{value:"food",label:Object(l.a)("Food Recipe")},{value:"howto",label:Object(l.a)("How-to Instructions")},{value:"other",label:Object(l.a)("Other (no metadata)")}],value:e.action.options,onChange:function(t){var n=x({},e.action,{options:t});e.onActionChange(n)}}),"change-author"===t&&o.a.createElement(r.Fragment,null,o.a.createElement(O.a,{options:wprm_admin_modal.options.author.filter(function(e){return"same"!==e.actual}),value:e.action.options.author,onChange:function(t){var n=x({},e.action,{options:{author:t,author_name:"",author_link:""}});e.onActionChange(n)},width:300,custom:{menuPlacement:"top",maxMenuHeight:150}}),"custom"===wprm_admin_modal.options.author.find(function(t){return t.value===e.action.options.author}).actual&&o.a.createElement(r.Fragment,null," ",o.a.createElement(p.a,{name:"author-name",placeholder:Object(l.a)("Author Name"),value:e.action.options.author_name,onChange:function(t){var n=x({},e.action,{options:x({},e.action.options,{author_name:t})});e.onActionChange(n)}})," ",o.a.createElement(p.a,{name:"author-link",placeholder:"https://bootstrapped.ventures",type:"url",value:e.action.options.author_link,onChange:function(t){var n=x({},e.action,{options:x({},e.action.options,{author_link:t})});e.onActionChange(n)}}))),("add-terms"===t||"remove-terms"===t)&&o.a.createElement(r.Fragment,null,o.a.createElement(O.a,{options:i,value:e.action.options.taxonomy,onChange:function(t){var n=x({},e.action,{options:{taxonomy:t,terms:[]}});e.onActionChange(n)},width:200,custom:{menuPlacement:"top",maxMenuHeight:150}})," ",o.a.createElement(E.a,{id:e.action.options.taxonomy,value:e.action.options.terms,onChange:function(t){var n=x({},e.action,{options:{taxonomy:e.action.options.taxonomy,terms:t}});e.onActionChange(n)},custom:{menuPlacement:"top",maxMenuHeight:200}})))))},C=function(e){var t=!!e.action&&e.action.type,n=[{value:"delete",label:Object(l.a)("Delete Terms"),default:!1}];return o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Select an action to perform:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-actions"},n.map(function(n){return o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-action",key:n.value},o.a.createElement("input",{type:"radio",value:n.value,name:"wprm-admin-radio-bulk-edit-action",id:"wprm-admin-radio-bulk-edit-action-".concat(n.value),checked:t===n.value,onChange:function(){var t={type:n.value,options:n.default};e.onActionChange(t)}}),o.a.createElement("label",{htmlFor:"wprm-admin-radio-bulk-edit-action-".concat(n.value)},n.label))})),t&&!1!==e.action.options&&o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Action options:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-options"})))};function j(e){return(j="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 _(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}n.d(t,"a",function(){return P});var A={rating:{label:Object(l.a)("Ratings"),elem:w},recipe:{label:Object(l.a)("Recipes"),elem:S},ingredient:{label:Object(l.a)("Ingredients"),elem:b},equipment:{label:Object(l.a)("Equipment"),elem:v}};Object.keys(wprm_admin_modal.categories).map(function(e){var t=wprm_admin_modal.categories[e];A[e]={label:t.label,elem:C}});var P=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==j(t)&&"function"!=typeof t?T(e):t}(this,I(t).call(this,e))).state={route:e.args.hasOwnProperty("route")?e.args.route:"recipe",type:e.args.hasOwnProperty("type")?e.args.type:"recipe",ids:e.args.hasOwnProperty("ids")?e.args.ids:[],action:!1,savingChanges:!1,result:!1},n.onBulkEdit=n.onBulkEdit.bind(T(n)),n.allowCloseModal=n.allowCloseModal.bind(T(n)),n}var n,i,a;return function(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&&N(e,t)}(t,r["Component"]),n=t,(i=[{key:"onBulkEdit",value:function(){var e=this;this.state.action&&this.setState({savingChanges:!0},function(){u(e.state.route,e.state.type,e.state.ids,e.state.action).then(function(t){var n=!1;t.hasOwnProperty("result")&&(n=t.result),e.setState({savingChanges:!1,result:n},function(){"function"==typeof e.props.args.saveCallback&&e.props.args.saveCallback(),n||e.props.maybeCloseModal()})})})}},{key:"allowCloseModal",value:function(){return!this.state.savingChanges}},{key:"changesMade",value:function(){return!(!this.state.action||!this.state.action.type)&&(!Array.isArray(this.state.action.options)||0!==this.state.action.options.length)}},{key:"render",value:function(){var e=this,t=!!A.hasOwnProperty(this.state.type)&&A[this.state.type];if(!t)return null;var n=t.elem,i="".concat(Object(l.a)("Bulk Edit")," ").concat(this.state.ids.length," ").concat(t.label);return o.a.createElement(r.Fragment,null,o.a.createElement(c.a,{onCloseModal:this.props.maybeCloseModal},i),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-container"},!1===this.state.result?o.a.createElement(n,{action:this.state.action,onActionChange:function(t){e.setState({action:t})}}):o.a.createElement("div",{dangerouslySetInnerHTML:{__html:this.state.result}})),o.a.createElement(s.a,{savingChanges:this.state.savingChanges},!1===this.state.result?o.a.createElement(f.a,{isPrimary:!0,required:this.state.action&&this.state.action.hasOwnProperty("required")?this.state.action.required:null,onClick:this.onBulkEdit,disabled:!this.changesMade()},i):o.a.createElement(f.a,{isPrimary:!0,onClick:this.props.maybeCloseModal},Object(l.a)("Close"))))}}])&&_(n.prototype,i),a&&_(n,a),t}()},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t),function(e){var t=n(70),r=n.n(t),o=n(0),i=n.n(o),a=n(796);e._babelPolyfill||n(177);var u=document.getElementById("wprm-admin-modal");u&&r.a.render(i.a.createElement(a.a,{ref:function(e){window.WPRM_Modal=e}}),u)}.call(this,n(66))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bodyOpenClassName=t.portalClassName=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=h(i),u=h(n(70)),c=h(n(4)),s=h(n(880)),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(778)),f=n(659),p=h(f),d=n(886);function h(e){return e&&e.__esModule?e:{default:e}}function m(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var v=t.portalClassName="ReactModalPortal",g=t.bodyOpenClassName="ReactModal__Body--open",y=void 0!==u.default.createPortal,b=function(){return y?u.default.createPortal:u.default.unstable_renderSubtreeIntoContainer};function w(e){return e()}var O=function(e){function t(){var e,n,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,c=Array(i),l=0;l<i;l++)c[l]=arguments[l];return n=o=m(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),o.removePortal=function(){!y&&u.default.unmountComponentAtNode(o.node),w(o.props.parentSelector).removeChild(o.node)},o.portalRef=function(e){o.portal=e},o.renderPortal=function(e){var n=b()(o,a.default.createElement(s.default,r({defaultStyles:t.defaultStyles},e)),o.node);o.portalRef(n)},m(o,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Component),o(t,[{key:"componentDidMount",value:function(){f.canUseDOM&&(y||(this.node=document.createElement("div")),this.node.className=this.props.portalClassName,w(this.props.parentSelector).appendChild(this.node),!y&&this.renderPortal(this.props))}},{key:"getSnapshotBeforeUpdate",value:function(e){return{prevParent:w(e.parentSelector),nextParent:w(this.props.parentSelector)}}},{key:"componentDidUpdate",value:function(e,t,n){if(f.canUseDOM){var r=this.props,o=r.isOpen,i=r.portalClassName;e.portalClassName!==i&&(this.node.className=i);var a=n.prevParent,u=n.nextParent;u!==a&&(a.removeChild(this.node),u.appendChild(this.node)),(e.isOpen||o)&&!y&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(f.canUseDOM&&this.node&&this.portal){var e=this.portal.state,t=Date.now(),n=e.isOpen&&this.props.closeTimeoutMS&&(e.closesAt||t+this.props.closeTimeoutMS);n?(e.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,n-t)):this.removePortal()}}},{key:"render",value:function(){return f.canUseDOM&&y?(!this.node&&y&&(this.node=document.createElement("div")),b()(a.default.createElement(s.default,r({ref:this.portalRef,defaultStyles:t.defaultStyles},this.props)),this.node)):null}}],[{key:"setAppElement",value:function(e){l.setElement(e)}}]),t}();O.propTypes={isOpen:c.default.bool.isRequired,style:c.default.shape({content:c.default.object,overlay:c.default.object}),portalClassName:c.default.string,bodyOpenClassName:c.default.string,htmlOpenClassName:c.default.string,className:c.default.oneOfType([c.default.string,c.default.shape({base:c.default.string.isRequired,afterOpen:c.default.string.isRequired,beforeClose:c.default.string.isRequired})]),overlayClassName:c.default.oneOfType([c.default.string,c.default.shape({base:c.default.string.isRequired,afterOpen:c.default.string.isRequired,beforeClose:c.default.string.isRequired})]),appElement:c.default.instanceOf(p.default),onAfterOpen:c.default.func,onRequestClose:c.default.func,closeTimeoutMS:c.default.number,ariaHideApp:c.default.bool,shouldFocusAfterRender:c.default.bool,shouldCloseOnOverlayClick:c.default.bool,shouldReturnFocusAfterClose:c.default.bool,parentSelector:c.default.func,aria:c.default.object,data:c.default.object,role:c.default.string,contentLabel:c.default.string,shouldCloseOnEsc:c.default.bool,overlayRef:c.default.func,contentRef:c.default.func},O.defaultProps={isOpen:!1,portalClassName:v,bodyOpenClassName:g,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,parentSelector:function(){return document.body}},O.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},(0,d.polyfill)(O),t.default=O},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o="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},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),u=m(a),c=m(n(4)),s=h(n(881)),l=m(n(882)),f=h(n(778)),p=h(n(885)),d=m(n(659));function h(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function m(e){return e&&e.__esModule?e:{default:e}}var v={overlay:"ReactModal__Overlay",content:"ReactModal__Content"},g=9,y=27,b=0,w=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setOverlayRef=function(e){n.overlay=e,n.props.overlayRef&&n.props.overlayRef(e)},n.setContentRef=function(e){n.content=e,n.props.contentRef&&n.props.contentRef(e)},n.afterClose=function(){var e=n.props,t=e.appElement,r=e.ariaHideApp,o=e.htmlOpenClassName,i=e.bodyOpenClassName;i&&p.remove(document.body,i),o&&p.remove(document.getElementsByTagName("html")[0],o),r&&b>0&&0===(b-=1)&&f.show(t),n.props.shouldFocusAfterRender&&(n.props.shouldReturnFocusAfterClose?(s.returnFocus(),s.teardownScopedFocus()):s.popWithoutFocus()),n.props.onAfterClose&&n.props.onAfterClose()},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(n.props.shouldFocusAfterRender&&(s.setupScopedFocus(n.node),s.markForFocusLater()),n.setState({isOpen:!0},function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen()}))},n.close=function(){n.props.closeTimeoutMS>0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return n.content&&!n.contentHasFocus()&&n.content.focus()},n.closeWithTimeout=function(){var e=Date.now()+n.props.closeTimeoutMS;n.setState({beforeClose:!0,closesAt:e},function(){n.closeTimer=setTimeout(n.closeWithoutTimeout,n.state.closesAt-Date.now())})},n.closeWithoutTimeout=function(){n.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},n.afterClose)},n.handleKeyDown=function(e){e.keyCode===g&&(0,l.default)(n.content,e),n.props.shouldCloseOnEsc&&e.keyCode===y&&(e.stopPropagation(),n.requestClose(e))},n.handleOverlayOnClick=function(e){null===n.shouldClose&&(n.shouldClose=!0),n.shouldClose&&n.props.shouldCloseOnOverlayClick&&(n.ownerHandlesClose()?n.requestClose(e):n.focusContent()),n.shouldClose=null},n.handleContentOnMouseUp=function(){n.shouldClose=!1},n.handleOverlayOnMouseDown=function(e){n.props.shouldCloseOnOverlayClick||e.target!=n.overlay||e.preventDefault()},n.handleContentOnClick=function(){n.shouldClose=!1},n.handleContentOnMouseDown=function(){n.shouldClose=!1},n.requestClose=function(e){return n.ownerHandlesClose()&&n.props.onRequestClose(e)},n.ownerHandlesClose=function(){return n.props.onRequestClose},n.shouldBeClosed=function(){return!n.state.isOpen&&!n.state.beforeClose},n.contentHasFocus=function(){return document.activeElement===n.content||n.content.contains(document.activeElement)},n.buildClassName=function(e,t){var r="object"===(void 0===t?"undefined":o(t))?t:{base:v[e],afterOpen:v[e]+"--after-open",beforeClose:v[e]+"--before-close"},i=r.base;return n.state.afterOpen&&(i=i+" "+r.afterOpen),n.state.beforeClose&&(i=i+" "+r.beforeClose),"string"==typeof t&&t?i+" "+t:i},n.attributesFromObject=function(e,t){return Object.keys(t).reduce(function(n,r){return n[e+"-"+r]=t[r],n},{})},n.state={afterOpen:!1,beforeClose:!1},n.shouldClose=null,n.moveFromContentToOverlay=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.Component),i(t,[{key:"componentDidMount",value:function(){this.props.isOpen&&this.open()}},{key:"componentDidUpdate",value:function(e,t){this.props.isOpen&&!e.isOpen?this.open():!this.props.isOpen&&e.isOpen&&this.close(),this.props.shouldFocusAfterRender&&this.state.isOpen&&!t.isOpen&&this.focusContent()}},{key:"componentWillUnmount",value:function(){this.afterClose(),clearTimeout(this.closeTimer)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,r=e.htmlOpenClassName,o=e.bodyOpenClassName;o&&p.add(document.body,o),r&&p.add(document.getElementsByTagName("html")[0],r),n&&(b+=1,f.hide(t))}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.overlayClassName,o=e.defaultStyles,i=t?{}:o.content,a=n?{}:o.overlay;return this.shouldBeClosed()?null:u.default.createElement("div",{ref:this.setOverlayRef,className:this.buildClassName("overlay",n),style:r({},a,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown},u.default.createElement("div",r({ref:this.setContentRef,style:r({},i,this.props.style.content),className:this.buildClassName("content",t),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.attributesFromObject("aria",this.props.aria||{}),this.attributesFromObject("data",this.props.data||{}),{"data-testid":this.props.testId}),this.props.children))}}]),t}();w.defaultProps={style:{overlay:{},content:{}},defaultStyles:{}},w.propTypes={isOpen:c.default.bool.isRequired,defaultStyles:c.default.shape({content:c.default.object,overlay:c.default.object}),style:c.default.shape({content:c.default.object,overlay:c.default.object}),className:c.default.oneOfType([c.default.string,c.default.object]),overlayClassName:c.default.oneOfType([c.default.string,c.default.object]),bodyOpenClassName:c.default.string,htmlOpenClassName:c.default.string,ariaHideApp:c.default.bool,appElement:c.default.instanceOf(d.default),onAfterOpen:c.default.func,onAfterClose:c.default.func,onRequestClose:c.default.func,closeTimeoutMS:c.default.number,shouldFocusAfterRender:c.default.bool,shouldCloseOnOverlayClick:c.default.bool,shouldReturnFocusAfterClose:c.default.bool,role:c.default.string,contentLabel:c.default.string,aria:c.default.object,data:c.default.object,children:c.default.node,shouldCloseOnEsc:c.default.bool,overlayRef:c.default.func,contentRef:c.default.func,testId:c.default.string},t.default=w,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.handleBlur=s,t.handleFocus=l,t.markForFocusLater=function(){a.push(document.activeElement)},t.returnFocus=function(){var e=null;try{return void(0!==a.length&&(e=a.pop()).focus())}catch(t){console.warn(["You tried to return focus to",e,"but it is not in the DOM anymore"].join(" "))}},t.popWithoutFocus=function(){a.length>0&&a.pop()},t.setupScopedFocus=function(e){u=e,window.addEventListener?(window.addEventListener("blur",s,!1),document.addEventListener("focus",l,!0)):(window.attachEvent("onBlur",s),document.attachEvent("onFocus",l))},t.teardownScopedFocus=function(){u=null,window.addEventListener?(window.removeEventListener("blur",s),document.removeEventListener("focus",l)):(window.detachEvent("onBlur",s),document.detachEvent("onFocus",l))};var r,o=n(777),i=(r=o)&&r.__esModule?r:{default:r};var a=[],u=null,c=!1;function s(){c=!0}function l(){if(c){if(c=!1,!u)return;setTimeout(function(){u.contains(document.activeElement)||((0,i.default)(u)[0]||u).focus()},0)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,i.default)(e);if(!n.length)return void t.preventDefault();var r,o=t.shiftKey,a=n[0],u=n[n.length-1];if(e===document.activeElement){if(!o)return;r=u}u!==document.activeElement||o||(r=a);a===document.activeElement&&o&&(r=u);if(r)return t.preventDefault(),void r.focus();var c=/(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);if(null==c||"Chrome"==c[1]||null!=/\biPod\b|\biPad\b/g.exec(navigator.userAgent))return;var s=n.indexOf(document.activeElement);s>-1&&(s+=o?-1:1);if(void 0===n[s])return t.preventDefault(),void(r=o?u:a).focus();t.preventDefault(),n[s].focus()};var r,o=n(777),i=(r=o)&&r.__esModule?r:{default:r};e.exports=t.default},function(e,t,n){"use strict";e.exports=function(){}},function(e,t,n){var r;
|
83 |
/*!
|
84 |
Copyright (c) 2015 Jed Watson.
|
85 |
Based on code that is Copyright 2013-2015, Facebook, Inc.
|
79 |
*
|
80 |
* http://api.jqueryui.com/category/ui-core/
|
81 |
*/
|
82 |
+
var r=/input|select|textarea|button|object/;function o(e){var t=e.offsetWidth<=0&&e.offsetHeight<=0;if(t&&!e.innerHTML)return!0;var n=window.getComputedStyle(e);return t?"visible"!==n.getPropertyValue("overflow"):"none"==n.getPropertyValue("display")}function i(e,t){var n=e.nodeName.toLowerCase();return(r.test(n)&&!e.disabled||"a"===n&&e.href||t)&&function(e){for(var t=e;t&&t!==document.body;){if(o(t))return!1;t=t.parentNode}return!0}(e)}function a(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var n=isNaN(t);return(n||t>=0)&&i(e,!n)}e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertNodeList=c,t.setElement=function(e){var t=e;if("string"==typeof t&&a.canUseDOM){var n=document.querySelectorAll(t);c(n,t),t="length"in n?n[0]:n}return u=t||u},t.validateElement=s,t.hide=function(e){s(e)&&(e||u).setAttribute("aria-hidden","true")},t.show=function(e){s(e)&&(e||u).removeAttribute("aria-hidden")},t.documentNotReadyOrSSRTesting=function(){u=null},t.resetForTesting=function(){u=null};var r,o=n(883),i=(r=o)&&r.__esModule?r:{default:r},a=n(659);var u=null;function c(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function s(e){return!(!e&&!u)||((0,i.default)(!1,["react-modal: App element is not defined.","Please use `Modal.setAppElement(el)` or set `appElement={el}`.","This is needed so screen readers don't see main content","when modal is opened. It is not recommended, but you can opt-out","by setting `ariaHideApp={false}`."].join(" ")),!1)}},function(e,t){var n=1e3,r=60*n,o=60*r,i=24*o,a=7*i,u=365.25*i;function c(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}e.exports=function(e,t){t=t||{};var s=typeof e;if("string"===s&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var c=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*u;case"weeks":case"week":case"w":return c*a;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*o;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===s&&!1===isNaN(e))return t.long?function(e){var t=Math.abs(e);if(t>=i)return c(e,t,i,"day");if(t>=o)return c(e,t,o,"hour");if(t>=r)return c(e,t,r,"minute");if(t>=n)return c(e,t,n,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=i)return Math.round(e/i)+"d";if(t>=o)return Math.round(e/o)+"h";if(t>=r)return Math.round(e/r)+"m";if(t>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){var r=n(907),o=n(548),i=n(550);e.exports=function(e){return i(o(e,void 0,r),e+"")}},function(e,t,n){var r=n(667),o=n(928),i=n(929),a=Object.defineProperty;t.f=n(501)?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(632),o=n(631).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(933);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(937)("keys"),o=n(939);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(785);e.exports=function(e){return Object(r(e))}},function(e,t){},,,,,function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return k});var r=n(0),o=n.n(r),i=n(769),a=n.n(i),u=(n(887),n(888),n(495)),c=n(849),s=n(797),l=n(798),f=n(799),p=n(845),d=n(809),h=n(810),m=n(811),v=n(812),g=n(2);function y(e){return(y="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 b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}a.a.setAppElement("#wprm-admin-modal");var x={"bulk-edit":c.a,menu:s.a,nutrient:l.a,nutrition:f.a,recipe:p.a,roundup:d.a,select:h.a,taxonomy:m.a,"custom-field":v.a},k=function(t){function n(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(e=function(e,t){return!t||"object"!==y(t)&&"function"!=typeof t?O(e):t}(this,w(n).call(this))).state={modalIsOpen:!1,mode:"",args:{}},e.content=o.a.createRef(),e.close=e.close.bind(O(e)),e.closeIfAllowed=e.closeIfAllowed.bind(O(e)),e}var i,c,s;return function(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&&E(e,t)}(n,r["Component"]),i=n,(c=[{key:"open",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!(arguments.length>2&&void 0!==arguments[2]&&arguments[2])&&this.state.modalIsOpen||this.setState({modalIsOpen:!0,mode:e,args:t},function(){window.onbeforeunload=function(){return Object(g.a)("Are you sure you want to leave this page?")}})}},{key:"close",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.setState({modalIsOpen:!1},function(){window.onbeforeunload=null,"function"==typeof e&&e()})}},{key:"closeIfAllowed",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!(!this.content.current||!this.content.current.hasOwnProperty("allowCloseModal"))&&this.content.current.allowCloseModal;t&&!t()||this.close(e)}},{key:"addTextToEditor",value:function(t,n){if("undefined"==typeof tinyMCE||!tinyMCE.get(n)||tinyMCE.get(n).isHidden()){var r=e("textarea#"+n).val();e("textarea#"+n).val(r+t)}else tinyMCE.get(n).focus(!0),tinyMCE.activeEditor.selection.collapse(!1),tinyMCE.activeEditor.execCommand("mceInsertContent",!1,t)}},{key:"refreshEditor",value:function(e){"undefined"!=typeof tinyMCE&&tinyMCE.get(e)&&!tinyMCE.get(e).isHidden()&&(tinyMCE.get(e).focus(!0),tinyMCE.activeEditor.setContent(tinyMCE.activeEditor.getContent()))}},{key:"render",value:function(){var e=!!x.hasOwnProperty(this.state.mode)&&x[this.state.mode];return e?o.a.createElement(a.a,{isOpen:this.state.modalIsOpen,onRequestClose:this.closeIfAllowed,overlayClassName:"wprm-admin-modal-overlay",className:"wprm-admin-modal wprm-admin-modal-".concat(this.state.mode)},o.a.createElement(u.a,{module:"Modal"},o.a.createElement(e,{ref:this.content,mode:this.state.mode,args:this.state.args,maybeCloseModal:this.closeIfAllowed}))):null}}])&&b(i.prototype,c),s&&b(i,s),n}()}).call(this,n(389))},function(e,t,n){"use strict";n.d(t,"a",function(){return m});var r=n(0),o=n.n(r),i=(n(892),n(169)),a=n(175),u=n(2);function c(e){return(c="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 s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h=function(e){return e=(e=(e=e.replace(/"/gm,"%22")).replace(/\]/gm,"%5D")).replace(/\r?\n|\r/gm,"%0A")},m=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),f(this,p(t).apply(this,arguments))}var n,c,m;return function(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&&d(e,t)}(t,r["Component"]),n=t,(c=[{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(i.a,{onCloseModal:this.props.maybeCloseModal},"WP Recipe Maker"),o.a.createElement("div",{className:"wprm-admin-modal-menu-container"},o.a.createElement("h2",null,Object(u.a)("Recipes")),o.a.createElement("div",{className:"wprm-admin-modal-menu-buttons"},o.a.createElement(a.a,{isPrimary:!0,onClick:function(){WPRM_Modal.open("recipe",e.props.args,!0)}},Object(u.a)("Create new Recipe")),o.a.createElement(a.a,{onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Insert existing Recipe"),button:Object(u.a)("Insert"),fields:{recipe:{}},insertCallback:function(t){"function"==typeof e.props.args.insertCallback&&e.props.args.insertCallback('[wprm-recipe id="'.concat(t.recipe.id,'"]'))}},!0)}},Object(u.a)("Insert existing Recipe")),o.a.createElement(a.a,{required:"premium",onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Create new from existing Recipe"),button:Object(u.a)("Clone Recipe"),fields:{recipe:{}},nextStepCallback:function(t){WPRM_Modal.open("recipe",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){s(e,t,n[t])})}return e}({},e.props.args,{recipeId:t.recipe.id,cloneRecipe:!0}),!0)}},!0)}},Object(u.a)("Create new from existing Recipe"))),o.a.createElement("h2",null,Object(u.a)("Recipe Snippets")),o.a.createElement("div",{className:"wprm-admin-modal-menu-buttons"},o.a.createElement(a.a,{help:Object(u.a)("Displays default snippet template as set in the WPRM Settings"),onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Full Snippet Template"),button:Object(u.a)("Insert"),fields:{recipe:{showFirst:!0}},insertCallback:function(t){if("function"==typeof e.props.args.insertCallback){var n="[wprm-recipe-snippet";n+=t.recipe&&t.recipe.id?' id="'.concat(t.recipe.id,'"]'):"]",e.props.args.insertCallback(n)}}},!0)}},Object(u.a)("Full Snippet Template")),o.a.createElement(a.a,{onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Jump to Recipe"),button:Object(u.a)("Insert"),fields:{recipe:{showFirst:!0}},insertCallback:function(t){if("function"==typeof e.props.args.insertCallback){var n="[wprm-recipe-jump";n+=t.recipe&&t.recipe.id?' id="'.concat(t.recipe.id,'"]'):"]",e.props.args.insertCallback(n)}}},!0)}},Object(u.a)("Jump to Recipe")),o.a.createElement(a.a,{onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Jump to Video"),button:Object(u.a)("Insert"),fields:{recipe:{showFirst:!0}},insertCallback:function(t){if("function"==typeof e.props.args.insertCallback){var n="[wprm-recipe-jump-video";n+=t.recipe&&t.recipe.id?' id="'.concat(t.recipe.id,'"]'):"]",e.props.args.insertCallback(n)}}},!0)}},Object(u.a)("Jump to Video")),o.a.createElement(a.a,{onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Print Recipe"),button:Object(u.a)("Insert"),fields:{recipe:{showFirst:!0}},insertCallback:function(t){if("function"==typeof e.props.args.insertCallback){var n="[wprm-recipe-print";n+=t.recipe&&t.recipe.id?' id="'.concat(t.recipe.id,'"]'):"]",e.props.args.insertCallback(n)}}},!0)}},Object(u.a)("Print Recipe"))),o.a.createElement("h2",null,Object(u.a)("Recipe Parts")),o.a.createElement("div",{className:"wprm-admin-modal-menu-buttons"},o.a.createElement(a.a,{required:"premium",onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Nutrition Label"),button:Object(u.a)("Insert"),fields:{recipe:{showFirst:!0}},insertCallback:function(t){if("function"==typeof e.props.args.insertCallback){var n="[wprm-nutrition-label";n+=t.recipe&&t.recipe.id?' id="'.concat(t.recipe.id,'"]'):"]",e.props.args.insertCallback(n)}}},!0)}},Object(u.a)("Nutrition Label")),o.a.createElement(a.a,{onClick:function(){WPRM_Modal.open("select",{title:Object(u.a)("Recipe Video"),button:Object(u.a)("Insert"),fields:{recipe:{showFirst:!0}},insertCallback:function(t){if("function"==typeof e.props.args.insertCallback){var n="[wprm-recipe-video";n+=t.recipe&&t.recipe.id?' id="'.concat(t.recipe.id,'"]'):"]",e.props.args.insertCallback(n)}}},!0)}},Object(u.a)("Recipe Video"))),o.a.createElement("h2",null,Object(u.a)("Other Features")),o.a.createElement("div",{className:"wprm-admin-modal-menu-buttons"},o.a.createElement(a.a,{help:Object(u.a)("Use for a list of existing recipes on your website"),onClick:function(){WPRM_Modal.open("roundup",{insertCallback:function(t){if("function"==typeof e.props.args.insertCallback)if(t.hasOwnProperty("type")&&"external"===t.type){var n="[wprm-recipe-roundup-item";n+=' link="'.concat(h(t.link),'"'),n+=t.nofollow?' nofollow="1"':"",n+=t.image.id?' image="'.concat(t.image.id,'"'):"",n+=' name="'.concat(h(t.name),'"'),n+=' summary="'.concat(h(t.summary),'"'),n+="]",e.props.args.insertCallback(n)}else e.props.args.insertCallback('[wprm-recipe-roundup-item id="'.concat(t.recipe.id,'"]'))}},!0)}},Object(u.a)("Recipe Roundup Item")),o.a.createElement(a.a,{required:"elite",onClick:function(){"function"==typeof e.props.args.insertCallback&&e.props.args.insertCallback("[wprm-recipe-submission]"),e.props.maybeCloseModal()}},Object(u.a)("Recipe Submission Form")),o.a.createElement(a.a,{required:"elite",onClick:function(){"function"==typeof e.props.args.insertCallback&&e.props.args.insertCallback("[wprm-recipe-collections]"),e.props.maybeCloseModal()}},Object(u.a)("Recipe Collections")),o.a.createElement(a.a,{required:"elite",help:Object(u.a)("Find the saved collection ID on the WP Recipe Maker > Manage > Saved Collections page"),onClick:function(){"function"==typeof e.props.args.insertCallback&&e.props.args.insertCallback('[wprm-saved-collection id=""]'),e.props.maybeCloseModal()}},Object(u.a)("Saved Recipe Collection")))))}}])&&l(n.prototype,c),m&&l(n,m),t}()},function(e,t,n){"use strict";n.d(t,"a",function(){return b});var r=n(0),o=n.n(r),i=(n(893),n(2)),a=n(169),u=n(174),c=n(67),s=n(399),l=n(68),f=n(506);function p(e){return(p="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 d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){h(e,t,n[t])})}return e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?g(e):t}(this,v(t).call(this,e));var r={key:"",type:"custom",label:"",unit:"",daily:0,active:!0,calculation:"",precision:0},o=!1;return e.args.hasOwnProperty("nutrient")&&(o=!0,r=JSON.parse(JSON.stringify(e.args.nutrient))),n.state={editing:o,nutrient:r,originalNutrient:JSON.parse(JSON.stringify(r)),savingChanges:!1},n.changesMade=n.changesMade.bind(g(n)),n.saveChanges=n.saveChanges.bind(g(n)),n}var n,h,b;return function(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&&y(e,t)}(t,r["Component"]),n=t,(h=[{key:"sanitizeSlug",value:function(e){e=(e=e.trim()).toLowerCase();for(var t="àáäâèéëêìíïîòóöôùúüûñçěščřžýúůďťň·/-,:;",n=0,r=t.length;n<r;n++)e=e.replace(new RegExp(t.charAt(n),"g"),"aaaaeeeeiiiioooouuuuncescrzyuudtn______".charAt(n));return e=e.replace(".","-").replace(/[^a-z0-9\s_]/g,"").replace(/\s+/g,"_").replace(/_+/g,"_")}},{key:"saveChanges",value:function(){var e=this;this.state.nutrient.key.trim()&&this.state.nutrient.label.trim()?this.setState({savingChanges:!0},function(){f.a.updateNutrient(e.state.editing,e.state.nutrient).then(function(t){t?e.setState({originalNutrient:JSON.parse(JSON.stringify(e.state.nutrient)),savingChanges:!1},function(){"function"==typeof e.props.args.saveCallback&&e.props.args.saveCallback(e.state.nutrient),e.props.maybeCloseModal()}):(e.state.editing||!1!==t||alert(Object(i.a)("Something went wrong. Make sure this key does not exist yet.")),e.setState({savingChanges:!1}))})}):alert(Object(i.a)("A label and key are required."))}},{key:"allowCloseModal",value:function(){return!this.state.savingChanges&&(!this.changesMade()||confirm(Object(i.a)("Are you sure you want to close without saving changes?")))}},{key:"changesMade",value:function(){return JSON.stringify(this.state.nutrient)!==JSON.stringify(this.state.originalNutrient)}},{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(a.a,{onCloseModal:this.props.maybeCloseModal},this.state.editing?"".concat(Object(i.a)("Editing Nutrient")).concat(this.state.nutrient.key?" - ".concat(this.state.nutrient.key):""):"".concat(Object(i.a)("Creating new Nutrient")).concat(this.state.nutrient.key?" - ".concat(this.state.nutrient.key):"")),o.a.createElement("div",{className:"wprm-admin-modal-nutrient-container"},!1===this.state.editing&&o.a.createElement(r.Fragment,null,o.a.createElement(c.a,{id:"type",label:Object(i.a)("Type")},o.a.createElement(s.a,{options:[{value:"custom",label:Object(i.a)("Custom")},{value:"calculated",label:Object(i.a)("Calculated")}],value:this.state.nutrient.type,onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{type:t})})}})),o.a.createElement(c.a,{id:"key",label:Object(i.a)("Key")},o.a.createElement(l.a,{placeholder:Object(i.a)("my-custom-nutrient"),value:"".concat(this.state.nutrient.key),onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{key:e.sanitizeSlug(t)})})}}))),o.a.createElement(c.a,{id:"label",label:Object(i.a)("Label")},o.a.createElement(l.a,{placeholder:Object(i.a)("My Custom Nutrient"),value:this.state.nutrient.label,onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{label:t})})}})),o.a.createElement(c.a,{id:"unit",label:Object(i.a)("Unit")},o.a.createElement(l.a,{placeholder:Object(i.a)("mg"),value:this.state.nutrient.unit,onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{unit:t})})}})),o.a.createElement(c.a,{id:"daily",label:Object(i.a)("Daily Need")},o.a.createElement(l.a,{type:"number",value:0===this.state.nutrient.daily?"":this.state.nutrient.daily,onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{daily:t})})}})),"calculated"===this.state.nutrient.type&&o.a.createElement(r.Fragment,null,o.a.createElement(c.a,{id:"calculation",label:Object(i.a)("Calculation")},o.a.createElement(l.a,{placeholder:"carbohydrates - fiber",value:this.state.nutrient.calculation,onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{calculation:t})})}}),o.a.createElement("a",{href:"https://help.bootstrapped.ventures/article/199-custom-and-calculated-nutrients",target:"_blank"},Object(i.a)("Learn more"))),o.a.createElement(c.a,{id:"precision",label:Object(i.a)("Decimal Precision")},o.a.createElement(l.a,{type:"number",placeholder:"0",value:this.state.nutrient.precision,onChange:function(t){e.setState({nutrient:d({},e.state.nutrient,{precision:t})})}})))),o.a.createElement(u.a,{savingChanges:this.state.savingChanges},o.a.createElement("button",{className:"button button-primary",onClick:this.saveChanges,disabled:!this.changesMade()},Object(i.a)("Save"))))}}])&&m(n.prototype,h),b&&m(n,b),t}()},function(e,t,n){"use strict";n.d(t,"a",function(){return b});var r=n(0),o=n.n(r),i=(n(894),n(2)),a=n(176),u=n(169),c=n(174),s=n(68),l=n(412),f=n(465);function p(e){return(p="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 d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){h(e,t,n[t])})}return e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?g(e):t}(this,v(t).call(this,e));var r={id:0,amount:"",unit:"",name:"",facts:{}},o=!1;return e.args.hasOwnProperty("ingredient")?r=JSON.parse(JSON.stringify(e.args.ingredient)):e.args.hasOwnProperty("ingredientId")&&(o=!0,l.a.getCustomIngredient(e.args.ingredientId).then(function(e){if(e){var t=JSON.parse(JSON.stringify(e.ingredient));if(t){var r={id:t.id,amount:t.nutrition.amount,unit:t.nutrition.unit,name:t.name,facts:t.nutrition.nutrients};n.setState({ingredient:r,originalIngredient:JSON.parse(JSON.stringify(r)),loadingIngredient:!1})}}})),n.state={ingredient:r,originalIngredient:JSON.parse(JSON.stringify(r)),loadingIngredient:o,savingChanges:!1},n.changesMade=n.changesMade.bind(g(n)),n.saveChanges=n.saveChanges.bind(g(n)),n}var n,h,b;return function(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&&y(e,t)}(t,r["Component"]),n=t,(h=[{key:"saveChanges",value:function(){var e=this;""===this.state.ingredient.name.trim()?alert(Object(i.a)("A name is required for this saved nutrition ingredient.")):this.setState({savingChanges:!0},function(){l.a.saveCustomIngredient(e.state.ingredient.id,e.state.ingredient.amount,e.state.ingredient.unit,e.state.ingredient.name,e.state.ingredient.facts).then(function(){e.setState({originalIngredient:JSON.parse(JSON.stringify(e.state.ingredient)),savingChanges:!1},function(){"function"==typeof e.props.args.saveCallback&&e.props.args.saveCallback(e.state.ingredient),e.props.maybeCloseModal()})})})}},{key:"allowCloseModal",value:function(){return!this.state.savingChanges&&(!this.changesMade()||confirm(Object(i.a)("Are you sure you want to close without saving changes?")))}},{key:"changesMade",value:function(){return JSON.stringify(this.state.ingredient)!==JSON.stringify(this.state.originalIngredient)}},{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(u.a,{onCloseModal:this.props.maybeCloseModal},this.state.loadingIngredient?Object(i.a)("Loading Ingredient..."):o.a.createElement(r.Fragment,null,this.state.ingredient.id?"".concat(Object(i.a)("Editing Nutrition Ingredient")," #").concat(this.state.ingredient.id).concat(this.state.ingredient.name?" - ".concat(this.state.ingredient.name):""):"".concat(Object(i.a)("Creating new Nutrition Ingredient")).concat(this.state.ingredient.name?" - ".concat(this.state.ingredient.name):""))),o.a.createElement("div",{className:"wprm-admin-modal-nutrition-container"},this.state.loadingIngredient?o.a.createElement(a.a,null):o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-nutrition-custom-ingredient"},o.a.createElement(s.a,{type:"number",placeholder:Object(i.a)("Amount"),value:this.state.ingredient.amount,onChange:function(t){e.setState({ingredient:d({},e.state.ingredient,{amount:t})})}}),o.a.createElement(s.a,{placeholder:Object(i.a)("Unit"),value:this.state.ingredient.unit,onChange:function(t){e.setState({ingredient:d({},e.state.ingredient,{unit:t})})}}),o.a.createElement(s.a,{placeholder:Object(i.a)("Name (required)"),value:this.state.ingredient.name,onChange:function(t){e.setState({ingredient:d({},e.state.ingredient,{name:t})})}})),o.a.createElement(f.a,{id:"modal",facts:this.state.ingredient.facts,onChange:function(t,n){var r=d({},e.state.ingredient.facts);r[t]=n,e.setState({ingredient:d({},e.state.ingredient,{facts:r})})}}))),o.a.createElement(c.a,{savingChanges:this.state.savingChanges},o.a.createElement("button",{className:"button button-primary",onClick:this.saveChanges,disabled:!this.changesMade()},Object(i.a)("Save"))))}}])&&m(n.prototype,h),b&&m(n,b),t}()},function(e,t,n){"use strict";var r=n(896).CopyToClipboard;r.CopyToClipboard=r,e.exports=r},function(e,t,n){"use strict";var r,o;r=new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*[A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]"),o=new RegExp("^[^A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]*[֑-߿יִ-﷽ﹰ-ﻼ]"),e.exports=function(e){return e=e.toString(),o.test(e)?"rtl":r.test(e)?"ltr":"neutral"}},function(e,t){e.exports=function(e){var t=e.anchorNode,n=e.anchorOffset,r=e.focusNode,o=e.focusOffset,i=t.compareDocumentPosition(r);return!(4===i||0===i&&n<o)}},function(e,t,n){"use strict";e.exports=n(918)},function(e,t,n){e.exports=n(941)},function(e,t,n){"use strict";e.exports=n(946)},function(e,t,n){"use strict";function r(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}n.d(t,"a",function(){return r})},function(e,t,n){e.exports=n(948)},function(e,t,n){e.exports=n(956)},function(e,t,n){"use strict";n.d(t,"a",function(){return y});var r=n(0),o=n.n(r),i=(n(967),n(2)),a=n(169),u=n(174),c=n(453),s=n(417),l=n(68),f=n(444),p=n(643);function d(e){return(d="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 h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=m(this,v(t).call(this,e));var r="internal",o="",i=!1,a="",u="",c={id:0,url:""};if(e.args.fields&&e.args.fields.roundup){var s=e.args.fields.roundup;!s.id&&s.link&&(r="external",o=s.link,i=!!s.nofollow,a=s.name,u=s.summary,c.id=s.image)}return n.state={type:r,recipe:!1,link:o,nofollow:i,name:a,summary:u,image:c},n}var n,d,y;return function(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&&g(e,t)}(t,r["Component"]),n=t,(d=[{key:"selectionsMade",value:function(){return"external"===this.state.type?""!==this.state.link:!1!==this.state.recipe}},{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(a.a,{onCloseModal:this.props.maybeCloseModal},Object(i.a)("Select Roundup Recipe")),o.a.createElement("div",{className:"wprm-admin-modal-roundup-container wprm-admin-modal-roundup-container-".concat(this.state.type)},o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-label"},Object(i.a)("Type")),o.a.createElement(s.a,{id:"type",options:[{value:"internal",label:Object(i.a)("Use one of your own recipes")},{value:"external",label:Object(i.a)("Use external recipe from a different website")}],value:this.state.type,onChange:function(t){e.setState({type:t})}}),"internal"===this.state.type?o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-label"},Object(i.a)("Recipe")),o.a.createElement(p.a,{options:[],value:this.state.recipe,onValueChange:function(t){e.setState({recipe:t})}})):o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-label"},Object(i.a)("Link")),o.a.createElement(l.a,{name:"roundup-link",placeholder:"https://demo.wprecipemaker.com/amazing-vegetable-pizza/",type:"url",value:this.state.link,onChange:function(t){e.setState({link:t})}}),o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-nofollow-container"},o.a.createElement("input",{id:"wprm-admin-modal-roundup-field-nofollow",type:"checkbox",checked:this.state.nofollow,onChange:function(t){e.setState({nofollow:t.target.checked})}})," ",o.a.createElement("label",{htmlFor:"wprm-admin-modal-roundup-field-nofollow"},Object(i.a)('Add rel="nofollow" to link'))),o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-label"},Object(i.a)("Image")),o.a.createElement(c.a,{id:this.state.image.id,url:this.state.image.url,onChange:function(t,n){e.setState({image:{id:t,url:n}})}}),o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-label"},Object(i.a)("Name")),o.a.createElement(l.a,{name:"recipe-name",placeholder:Object(i.a)("Recipe Name"),value:this.state.name,onChange:function(t){e.setState({name:t})}}),o.a.createElement("div",{className:"wprm-admin-modal-roundup-field-label"},Object(i.a)("Summary")),o.a.createElement(f.a,{placeholder:Object(i.a)("Short description of this recipe..."),value:this.state.summary,onChange:function(t){e.setState({summary:t})}}))),o.a.createElement(u.a,{savingChanges:!1},o.a.createElement("button",{className:"button button-primary",onClick:function(){"function"==typeof e.props.args.insertCallback&&e.props.args.insertCallback(e.state),e.props.maybeCloseModal()},disabled:!this.selectionsMade()},Object(i.a)("Use"))))}}])&&h(n.prototype,d),y&&h(n,y),t}()},function(e,t,n){"use strict";n.d(t,"a",function(){return m});var r=n(0),o=n.n(r),i=(n(968),n(2)),a=n(169),u=n(174),c=n(643);function s(e){return(s="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 l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return!t||"object"!==s(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h={id:0,text:Object(i.a)("First recipe on page")},m=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=f(this,p(t).call(this,e));var r=!1;return e.args.fields.recipe.showFirst&&(r=h),n.state={recipe:r},n}var n,s,m;return function(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&&d(e,t)}(t,r["Component"]),n=t,(s=[{key:"selectionsMade",value:function(){return!1!==this.state.recipe}},{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(a.a,{onCloseModal:this.props.maybeCloseModal},this.props.args.title?this.props.args.title:"WP Recipe Maker"),o.a.createElement("div",{className:"wprm-admin-modal-select-container"},this.props.args.fields.recipe?o.a.createElement(c.a,{options:this.props.args.fields.recipe.showFirst?[h]:[],value:this.state.recipe,onValueChange:function(t){e.setState({recipe:t})}}):null),o.a.createElement(u.a,{savingChanges:!1},o.a.createElement("button",{className:"button button-primary",onClick:function(){"function"==typeof e.props.args.nextStepCallback?e.props.args.nextStepCallback(e.state):("function"==typeof e.props.args.insertCallback&&e.props.args.insertCallback(e.state),e.props.maybeCloseModal())},disabled:!this.selectionsMade()},this.props.args.button?this.props.args.button:Object(i.a)("Select"))))}}])&&l(n.prototype,s),m&&l(n,m),t}()},function(e,t,n){"use strict";n.d(t,"a",function(){return y});var r=n(0),o=n.n(r),i=(n(969),n(2)),a=n(169),u=n(174),c=n(67),s=n(68),l=n(625);function f(e){return(f="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 p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){d(e,t,n[t])})}return e}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?v(e):t}(this,m(t).call(this,e));var r={key:"",singular_name:"",name:""},o=!1;return e.args.hasOwnProperty("taxonomy")&&(o=!0,r=JSON.parse(JSON.stringify(e.args.taxonomy))),n.state={editing:o,taxonomy:r,originalTaxonomy:JSON.parse(JSON.stringify(r)),savingChanges:!1},n.changesMade=n.changesMade.bind(v(n)),n.saveChanges=n.saveChanges.bind(v(n)),n}var n,d,y;return function(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&&g(e,t)}(t,r["Component"]),n=t,(d=[{key:"sanitizeSlug",value:function(e){e=(e=e.trim()).toLowerCase();for(var t="àáäâèéëêìíïîòóöôùúüûñçěščřžýúůďťň·/-,:;",n=0,r=t.length;n<r;n++)e=e.replace(new RegExp(t.charAt(n),"g"),"aaaaeeeeiiiioooouuuuncescrzyuudtn______".charAt(n));return e=e.replace(".","-").replace(/[^a-z0-9\s_]/g,"").replace(/\s+/g,"_").replace(/_+/g,"_")}},{key:"saveChanges",value:function(){var e=this;this.state.taxonomy.key.trim()&&this.state.taxonomy.singular_name.trim()&&this.state.taxonomy.name.trim()?this.setState({savingChanges:!0},function(){l.a.saveCustomTaxonomy(e.state.editing,e.state.taxonomy).then(function(t){t?e.setState({originalTaxonomy:JSON.parse(JSON.stringify(e.state.taxonomy)),savingChanges:!1},function(){"function"==typeof e.props.args.saveCallback&&e.props.args.saveCallback(e.state.taxonomy),e.props.maybeCloseModal()}):(e.state.editing||!1!==t||alert(Object(i.a)("Something went wrong. Make sure this key does not exist yet.")),e.setState({savingChanges:!1}))})}):alert(Object(i.a)("All fields are required."))}},{key:"allowCloseModal",value:function(){return!this.state.savingChanges&&(!this.changesMade()||confirm(Object(i.a)("Are you sure you want to close without saving changes?")))}},{key:"changesMade",value:function(){return JSON.stringify(this.state.taxonomy)!==JSON.stringify(this.state.originalTaxonomy)}},{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(a.a,{onCloseModal:this.props.maybeCloseModal},this.state.editing?"".concat(Object(i.a)("Editing Custom Taxonomy")).concat(this.state.taxonomy.key?" - wprm_".concat(this.state.taxonomy.key):""):"".concat(Object(i.a)("Creating new Custom Taxonomy")).concat(this.state.taxonomy.key?" - wprm_".concat(this.state.taxonomy.key):"")),o.a.createElement("div",{className:"wprm-admin-modal-taxonomy-container"},!1===this.state.editing&&o.a.createElement(c.a,{id:"key",label:Object(i.a)("Key")},o.a.createElement(s.a,{placeholder:Object(i.a)("course"),value:"wprm_".concat(this.state.taxonomy.key),onChange:function(t){var n=t.substr(5);n=e.sanitizeSlug(n),e.setState({taxonomy:p({},e.state.taxonomy,{key:n})})},disabled:this.state.editing})),o.a.createElement(c.a,{id:"singular_name",label:Object(i.a)("Singular Name")},o.a.createElement(s.a,{placeholder:Object(i.a)("Course"),value:this.state.taxonomy.singular_name,onChange:function(t){e.setState({taxonomy:p({},e.state.taxonomy,{singular_name:t})})}})),o.a.createElement(c.a,{id:"name",label:Object(i.a)("Plural Name")},o.a.createElement(s.a,{placeholder:Object(i.a)("Courses"),value:this.state.taxonomy.name,onChange:function(t){e.setState({taxonomy:p({},e.state.taxonomy,{name:t})})}}))),o.a.createElement(u.a,{savingChanges:this.state.savingChanges},o.a.createElement("button",{className:"button button-primary",onClick:this.saveChanges,disabled:!this.changesMade()},Object(i.a)("Save"))))}}])&&h(n.prototype,d),y&&h(n,y),t}()},function(e,t,n){"use strict";n.d(t,"a",function(){return b});var r=n(0),o=n.n(r),i=(n(970),n(2)),a=n(169),u=n(174),c=n(67),s=n(399),l=n(68),f=n(626);function p(e){return(p="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 d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){h(e,t,n[t])})}return e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?g(e):t}(this,v(t).call(this,e));var r={key:"",name:"",type:"text"},o=!1;return e.args.hasOwnProperty("field")&&(o=!0,r=JSON.parse(JSON.stringify(e.args.field))),n.state={editing:o,field:r,originalField:JSON.parse(JSON.stringify(r)),savingChanges:!1},n.changesMade=n.changesMade.bind(g(n)),n.saveChanges=n.saveChanges.bind(g(n)),n}var n,h,b;return function(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&&y(e,t)}(t,r["Component"]),n=t,(h=[{key:"sanitizeSlug",value:function(e){e=(e=e.trim()).toLowerCase();for(var t="àáäâèéëêìíïîòóöôùúüûñçěščřžýúůďťň·/-,:;",n=0,r=t.length;n<r;n++)e=e.replace(new RegExp(t.charAt(n),"g"),"aaaaeeeeiiiioooouuuuncescrzyuudtn______".charAt(n));return e=e.replace(".","-").replace(/[^a-z0-9\s_]/g,"").replace(/\s+/g,"_").replace(/_+/g,"_")}},{key:"saveChanges",value:function(){var e=this;this.state.field.key.trim()&&this.state.field.name.trim()?this.setState({savingChanges:!0},function(){f.a.saveCustomField(e.state.editing,e.state.field).then(function(t){t?e.setState({originalField:JSON.parse(JSON.stringify(e.state.field)),savingChanges:!1},function(){"function"==typeof e.props.args.saveCallback&&e.props.args.saveCallback(e.state.field),e.props.maybeCloseModal()}):(e.state.editing||!1!==t||alert(Object(i.a)("Something went wrong. Make sure this key does not exist yet.")),e.setState({savingChanges:!1}))})}):alert(Object(i.a)("All fields are required."))}},{key:"allowCloseModal",value:function(){return!this.state.savingChanges&&(!this.changesMade()||confirm(Object(i.a)("Are you sure you want to close without saving changes?")))}},{key:"changesMade",value:function(){return JSON.stringify(this.state.field)!==JSON.stringify(this.state.originalField)}},{key:"render",value:function(){var e=this;return o.a.createElement(r.Fragment,null,o.a.createElement(a.a,{onCloseModal:this.props.maybeCloseModal},this.state.editing?"".concat(Object(i.a)("Editing Custom Field")).concat(this.state.field.key?" - ".concat(this.state.field.key):""):"".concat(Object(i.a)("Creating new Custom Field")).concat(this.state.field.key?" - ".concat(this.state.field.key):"")),o.a.createElement("div",{className:"wprm-admin-modal-custom-field-container"},!1===this.state.editing&&o.a.createElement(r.Fragment,null,o.a.createElement(c.a,{id:"type",label:Object(i.a)("Type")},o.a.createElement(s.a,{options:wprm_admin_modal.custom_fields.types,value:this.state.field.type,onChange:function(t){e.setState({field:d({},e.state.field,{type:t})})}})),o.a.createElement(c.a,{id:"key",label:Object(i.a)("Key")},o.a.createElement(l.a,{placeholder:Object(i.a)("my-custom-field"),value:"".concat(this.state.field.key),onChange:function(t){e.setState({field:d({},e.state.field,{key:e.sanitizeSlug(t)})})}}))),o.a.createElement(c.a,{id:"name",label:Object(i.a)("Name")},o.a.createElement(l.a,{placeholder:Object(i.a)("My Custom Field"),value:this.state.field.name,onChange:function(t){e.setState({field:d({},e.state.field,{name:t})})}}))),o.a.createElement(u.a,{savingChanges:this.state.savingChanges},o.a.createElement("button",{className:"button button-primary",onClick:this.saveChanges,disabled:!this.changesMade()},Object(i.a)("Save"))))}}])&&m(n.prototype,h),b&&m(n,b),t}()},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(0),o=n.n(r),i=n(388),a=(n(895),n(398)),u=n(2),c=n(800),s=n.n(c),l=n(169),f=n(174),p=n(176),d=function(e){var t=null;return e.id&&(t="wprm-admin-modal-fields-group-".concat(e.id)),o.a.createElement(i.Element,{className:"wprm-admin-modal-fields-group",id:t,name:t},e.header?o.a.createElement("div",{className:"wprm-admin-modal-fields-group-header"},e.header):null,o.a.createElement("div",{className:"wprm-admin-modal-fields"},e.children))},h=(n(899),n(67)),m=n(444),v=function(e){return o.a.createElement(r.Fragment,null,o.a.createElement(h.a,{label:Object(u.a)("Import from Text")},o.a.createElement(m.a,{placeholder:Object(u.a)("Paste or type recipe to start..."),value:"",onChange:function(t){t&&e.onModeChange("text-import",t)}})),o.a.createElement(h.a,{label:Object(u.a)("Import from JSON")},o.a.createElement(m.a,{placeholder:Object(u.a)("Paste the recipe JSON data to import"),value:"",onChange:function(t){if(t)try{var n=JSON.parse(t);e.onRecipeChange(n),alert(Object(u.a)("The recipe has been imported."))}catch(e){alert(Object(u.a)("No valid recipe found."))}}})))},g=(n(900),n(453)),y=n(640),b=function(e){var t=e.id>0,n=!t&&(-1==e.id||e.embed),i=t||n,a=function(t){t.preventDefault(),y.a.selectVideo(function(t){e.onChange(t.attributes.id,t.attributes.thumb.src)})};return o.a.createElement("div",{className:"wprm-admin-modal-field-video"},i?o.a.createElement(r.Fragment,null,t?o.a.createElement("div",{className:"wprm-admin-modal-field-video-preview"},o.a.createElement("img",{onClick:a,src:e.thumb}),o.a.createElement("a",{href:"#",onClick:function(t){t.preventDefault(),e.onChange(0,"")}},Object(u.a)("Remove Video"))):o.a.createElement(r.Fragment,null,o.a.createElement(m.a,{value:e.embed,onChange:function(t){e.onChange(-1,"",t)},placeholder:Object(u.a)("Use URL to the video (e.g. https://www.youtube.com/watch?v=dQw4w9WgXcQ) or the full embed code.")}),o.a.createElement("a",{href:"#",onClick:function(t){t.preventDefault(),e.onChange(0,"","")}},Object(u.a)("Remove Video")))):o.a.createElement(r.Fragment,null,o.a.createElement("button",{className:"button",onClick:a},Object(u.a)("Upload Video")),o.a.createElement("button",{className:"button",onClick:function(t){t.preventDefault(),e.onChange(-1,"")}},Object(u.a)("Embed Video"))))},w=function(e){return o.a.createElement(r.Fragment,null,o.a.createElement(h.a,{label:Object(u.a)("Image"),help:Object(u.a)("Used in the recipe metadata. Should be an image of the completed dish.")},o.a.createElement(g.a,{id:e.image.id,url:e.image.url,onChange:function(t,n){e.onRecipeChange({image_id:t,image_url:n})}})),"recipe_image"!==wprm_admin.settings.pinterest_use_for_image?o.a.createElement(h.a,{label:Object(u.a)("Pin Image"),help:Object(u.a)('Optionally set a different image to use for the "Pin Recipe" button.')},o.a.createElement(g.a,{required:"premium",id:e.pinImage.id,url:e.pinImage.url,onChange:function(t,n){e.onRecipeChange({pin_image_id:t,pin_image_url:n})}})):null,o.a.createElement(h.a,{label:Object(u.a)("Video"),help:Object(u.a)("Used in the recipe metadata. Can be displayed elsewhere on the page using the [wprm-recipe-video] shortcode.")},o.a.createElement(b,{id:e.video.id,thumb:e.video.thumb,embed:e.video.embed,onChange:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o={video_id:t,video_thumb_url:n};!1!==r&&(o.video_embed=r),e.onRecipeChange(o)}})))},O=(n(901),n(399)),E=n(68),x=n(417),k=n(4),S=n.n(k),C=n(77);function j(e,t){function n(n,r,o,i,a){var u=r[o];return null!=u||n?null==u&&n?new Error("The "+a+" `"+o+"` is marked as required in `"+i+"`, but it was not supplied."):t(u)?null:new Error("Invalid "+a+" `"+o+"` supplied to `"+i+"`, expected a Slate `"+e+"` but received: "+u):null}function r(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.apply(void 0,[!1].concat(t))}return r.isRequired=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.apply(void 0,[!0].concat(t))},r}var _={block:j("Block",function(e){return C.a.isBlock(e)}),blocks:j("List<Block>",function(e){return C.a.isBlockList(e)}),change:j("Change",function(e){return C.b.isChange(e)}),data:j("Data",function(e){return C.c.isData(e)}),document:j("Document",function(e){return C.d.isDocument(e)}),inline:j("Inline",function(e){return C.f.isInline(e)}),inlines:j("Inline",function(e){return C.f.isInlineList(e)}),leaf:j("Leaf",function(e){return C.g.isLeaf(e)}),leaves:j("List<Leaf>",function(e){return C.g.isLeafList(e)}),mark:j("Mark",function(e){return C.h.isMark(e)}),marks:j("Set<Mark>",function(e){return C.h.isMarkSet(e)}),node:j("Node",function(e){return C.i.isNode(e)}),nodes:j("List<Node>",function(e){return C.i.isNodeList(e)}),range:j("Range",function(e){return C.k.isRange(e)}),ranges:j("List<Range>",function(e){return C.k.isRangeList(e)}),selection:j("Selection",function(e){return C.l.isSelection(e)}),value:j("Value",function(e){return C.n.isValue(e)}),text:j("Text",function(e){return C.m.isText(e)}),texts:j("List<Text>",function(e){return C.m.isTextList(e)})},I=n(497),T=n.n(I),N=n(392),A=n.n(N),P=function(e,t){},D=n(129),M=n.n(D),L=n(802),R=n.n(L),F="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},B="object"===("undefined"==typeof window?"undefined":F(window))&&"object"===("undefined"==typeof document?"undefined":F(document))&&9===document.nodeType,z=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),U=void 0;if(B){var q=!0,W=!1,H=void 0;try{for(var V,G=[["edge",/Edge\/([0-9\._]+)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)$/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+)\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["android",/Android\s([0-9\.]+)/],["safari",/Version\/([0-9\._]+).*Safari/]][Symbol.iterator]();!(q=(V=G.next()).done);q=!0){var J=V.value,Z=z(J,2),Y=Z[0];if(Z[1].test(window.navigator.userAgent)){U=Y;break}}}catch(e){W=!0,H=e}finally{try{!q&&G.return&&G.return()}finally{if(W)throw H}}}var K=void 0;if(B){var X=!0,Q=!1,$=void 0;try{for(var ee,te=[["ios",/os ([\.\_\d]+) like mac os/i],["macos",/mac os x/i],["android",/android/i],["firefoxos",/mozilla\/[a-z\.\_\d]+ \((?:mobile)|(?:tablet)/i],["windows",/windows\s*(?:nt)?\s*([\.\_\d]+)/i]][Symbol.iterator]();!(X=(ee=te.next()).done);X=!0){var ne=ee.value,re=z(ne,2),oe=re[0];if(re[1].test(window.navigator.userAgent)){K=oe;break}}}catch(e){Q=!0,$=e}finally{try{!X&&te.return&&te.return()}finally{if(Q)throw $}}}var ie=[];if(B){var ae=!0,ue=!1,ce=void 0;try{for(var se,le=[["inputeventslevel1",function(e){return"inputType"in(e.InputEvent?new e.InputEvent("input"):{})}],["inputeventslevel2",function(e){var t=e.document.createElement("div");return t.contentEditable=!0,"onbeforeinput"in t}]][Symbol.iterator]();!(ae=(se=le.next()).done);ae=!0){var fe=se.value,pe=z(fe,2),de=pe[0];(0,pe[1])(window)&&ie.push(de)}}catch(e){ue=!0,ce=e}finally{try{!ae&&le.return&&le.return()}finally{if(ue)throw ce}}}var he=[[/^9([.]0|)/,28],[/^8[.]1/,27],[/^8([.]0|)/,26],[/^7[.]1/,25],[/^7([.]0|)/,24],[/^6([.]0|)/,23],[/^5[.]1/,22],[/^5([.]0|)/,21],[/^4[.]4/,20]];var me="firefox"===U,ve="safari"===U,ge="ie"===U,ye="edge"===U,be="android"===K,we="ios"===K,Oe="macos"===K,Ee=function(){if("android"!==K)return null;var e=window.navigator.userAgent.match(/Android\s([0-9\.]+)/);if(null==e)return null;var t=e[1],n=!0,r=!1,o=void 0;try{for(var i,a=he[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var u=i.value,c=z(u,2),s=c[0],l=c[1];if(t.match(s))return l}}catch(e){r=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw o}}return null}(),xe=(ie.includes("inputeventslevel1"),ie.includes("inputeventslevel2")||be&&(28===Ee||null===Ee)),ke=n(505),Se=n.n(ke),Ce=n(22),je=n(16),_e=n(454),Ie=n.n(_e),Te=n(772);function Ne(e){var t=JSON.stringify(e);return Object(Te.btoa)(encodeURIComponent(t))}function Ae(e){var t=decodeURIComponent(Object(Te.atob)(e));return JSON.parse(t)}var Pe={deserialize:function(e,t){var n=Ae(e);return C.n.fromJSON(n,t)},deserializeNode:function(e,t){var n=Ae(e);return C.i.fromJSON(n,t)},serialize:function(e,t){return Ne(e.toJSON(t))},serializeNode:function(e,t){return Ne(e.toJSON(t))}},De=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function Me(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).delimiter,n=void 0===t?"\n":t;return"document"===e.object||"block"===e.object&&C.a.isBlockList(e.nodes)?e.nodes.map(Me).join(n):e.text}var Le={deserialize:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.defaultBlock,r=void 0===n?"line":n,o=t.defaultMarks,i=void 0===o?[]:o,a=t.delimiter,u=void 0===a?"\n":a,c=t.toJSON,s=void 0!==c&&c;Ce.Set.isSet(i)&&(i=i.toArray()),r=C.i.createProperties(r),i=i.map(C.h.createProperties);var l={object:"value",document:{object:"document",data:{},nodes:e.split(u).map(function(e){return De({},r,{object:"block",data:{},nodes:[{object:"text",text:e,marks:i}]})})}};return s?l:C.n.fromJSON(l)},serialize:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Me(e.document,t)}},Re=n(400),Fe={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",splitBlock:"shift?+enter",undo:"mod+z"},Be={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},ze={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:"ctrl+y"},Ue={},qe=we||Oe,We=!qe;[].concat(Object.keys(Fe)).concat(Object.keys(Be)).concat(Object.keys(ze)).forEach(function(e){var t="is"+e[0].toUpperCase()+e.slice(1);if(!Ue[t]){var n=Fe[e],r=Be[e],o=ze[e],i=n&&Object(Re.isKeyHotkey)(n),a=r&&Object(Re.isKeyHotkey)(r),u=o&&Object(Re.isKeyHotkey)(o);Ue[t]=function(e){return!(!i||!i(e))||(!!(qe&&a&&a(e))||!!(We&&u&&u(e)))}}});var He=Ue,Ve=function(e,t){if(!e)throw new Error("Invariant failed: "+(t||""))},Ge=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Je=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Ze=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},Ye=0;var Ke=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Ye++,n=e.placeholder,r=e.when,i=e.style,a=void 0===i?{}:i;return Ve("string"==typeof n,"You must pass `SlateReactPlaceholder` an `options.placeholder` string."),Ve("string"==typeof r||"function"==typeof r,"You must pass `SlateReactPlaceholder` an `options.when` query."),{decorateNode:function(e,n,o){if(!n.query(r,e))return o();var i=o(),a=e.texts(),u=Je(a,1)[0],c=e.texts({direction:"backward"}),s=Je(c,1)[0],l=Je(u,2),f=l[0],p=l[1],d=Je(s,2),h=d[0],m=d[1],v={type:"placeholder",data:{key:t},anchor:{key:f.key,offset:0,path:p},focus:{key:h.key,offset:h.text.length,path:m}};return[].concat(Ze(i),[v])},renderDecoration:function(e,r,i){var u=e.children,c=e.decoration;if("placeholder"===c.type&&c.data.get("key")===t){var s=Ge({pointerEvents:"none",display:"inline-block",width:"0",maxWidth:"100%",whiteSpace:"nowrap",opacity:"0.333",verticalAlign:"text-top"},a);return o.a.createElement("span",null,o.a.createElement("span",{contentEditable:!1,style:s},n),u)}return i()}}},Xe=function(e,t){return e===t};var Qe=function(e,t){var n;void 0===t&&(t=Xe);var r,o=[],i=!1,a=function(e,n){return t(e,o[n],n)};return function(){for(var t=arguments.length,u=new Array(t),c=0;c<t;c++)u[c]=arguments[c];return i&&n===this&&u.length===o.length&&u.every(a)?r:(r=e.apply(this,u),i=!0,n=this,o=u,r)}},$e=["onBeforeInput","onBlur","onClick","onContextMenu","onCompositionEnd","onCompositionStart","onCopy","onCut","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onInput","onFocus","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onPaste","onSelect"],et={EDITOR:"data-slate-editor",FRAGMENT:"data-slate-fragment",KEY:"data-key",LEAF:"data-slate-leaf",LENGTH:"data-slate-length",OBJECT:"data-slate-object",OFFSET_KEY:"data-offset-key",SPACER:"data-slate-spacer",STRING:"data-slate-string",TEXT:"data-slate-object",VOID:"data-slate-void",ZERO_WIDTH:"data-slate-zero-width"},tt={BLOCK:"["+et.OBJECT+'="block"]',EDITOR:"["+et.EDITOR+"]",INLINE:"["+et.OBJECT+'="inline"]',KEY:"["+et.KEY+"]",LEAF:"["+et.LEAF+"]",OBJECT:"["+et.OBJECT+"]",STRING:"["+et.STRING+"]",TEXT:"["+et.OBJECT+'="text"]',VOID:"["+et.VOID+"]",ZERO_WIDTH:"["+et.ZERO_WIDTH+"]"},nt=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},rt=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),ot=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},it=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},at=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},ut=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},ct=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),st=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},lt=/^([\w-]+)(?::(\d+))?$/;var ft={parse:function(e){var t=lt.exec(e);if(!t)throw new Error('Invalid offset key string "'+e+'".');var n=ct(t,3),r=(n[0],n[1]),o=n[2];return{key:r,index:parseInt(o,10)}},stringify:function(e){return e.key+":"+e.index}},pt=function(e){var t=e.text,n=void 0===t?"":t,r=e.isTrailing,i=void 0!==r&&r;return o.a.createElement("span",ot({},et.STRING,!0),n,i?"\n":null)},dt=function(e){var t,n=e.length,r=void 0===n?0:n,i=e.isLineBreak,a=void 0!==i&&i;return o.a.createElement("span",(ot(t={},et.ZERO_WIDTH,a?"n":"z"),ot(t,et.LENGTH,r),t),"\ufeff",a?o.a.createElement("br",null):null)},ht=function(e){var t,n=e.marks,r=e.annotations,i=e.decorations,a=e.node,u=e.index,c=e.offset,s=e.text,l=e.editor,f=e.parent,p=e.block,d=e.leaves,h=ft.stringify({key:a.key,index:u}),m=void 0;if(l.query("isVoid",f))m=o.a.createElement(dt,{length:f.text.length});else if(""===s&&"block"===f.object&&""===f.text&&f.nodes.last()===a)m=o.a.createElement(dt,{isLineBreak:!0});else if(""===s)m=o.a.createElement(dt,null);else{var v=p.getLastText(),g=s.charAt(s.length-1),y=a===v,b=u===d.size-1;m=y&&b&&"\n"===g?o.a.createElement(pt,{isTrailing:!0,text:s}):o.a.createElement(pt,{text:s})}var w={editor:l,marks:n,annotations:r,decorations:i,node:a,offset:c,text:s},O=!0,E=!1,x=void 0;try{for(var k,S=n[Symbol.iterator]();!(O=(k=S.next()).done);O=!0){var C=k.value;(F=l.run("renderMark",it({},w,{mark:C,children:m,attributes:ot({},et.OBJECT,"mark")})))&&(m=F)}}catch(e){E=!0,x=e}finally{try{!O&&S.return&&S.return()}finally{if(E)throw x}}var j=!0,_=!1,I=void 0;try{for(var T,N=i[Symbol.iterator]();!(j=(T=N.next()).done);j=!0){var A=T.value;(F=l.run("renderDecoration",it({},w,{decoration:A,children:m,attributes:ot({},et.OBJECT,"decoration")})))&&(m=F)}}catch(e){_=!0,I=e}finally{try{!j&&N.return&&N.return()}finally{if(_)throw I}}var P=!0,D=!1,M=void 0;try{for(var L,R=r[Symbol.iterator]();!(P=(L=R.next()).done);P=!0){var F,B=L.value;(F=l.run("renderAnnotation",it({},w,{annotation:B,children:m,attributes:ot({},et.OBJECT,"annotation")})))&&(m=F)}}catch(e){D=!0,M=e}finally{try{!P&&R.return&&R.return()}finally{if(D)throw M}}var z=(ot(t={},et.LEAF,!0),ot(t,et.OFFSET_KEY,h),t);return o.a.createElement("span",z,m)};ht.propTypes={annotations:T.a.list.isRequired,block:_.block.isRequired,decorations:T.a.list.isRequired,editor:S.a.object.isRequired,index:S.a.number.isRequired,leaves:S.a.object.isRequired,marks:_.marks.isRequired,node:_.node.isRequired,offset:S.a.number.isRequired,parent:_.node.isRequired,text:S.a.string.isRequired};var mt=o.a.memo(ht,function(e,t){return t.block===e.block&&t.index===e.index&&t.marks===e.marks&&t.parent===e.parent&&t.text===e.text&&t.annotations.equals(e.annotations)&&t.decorations.equals(e.decorations)}),vt=o.a.forwardRef(function(e,t){var n,r=e.annotations,i=e.block,a=e.decorations,u=e.node,c=e.parent,s=e.editor,l=e.style,f=u.key,p=u.getLeaves(r,a),d=0;return o.a.createElement("span",it({ref:t,style:l},(ot(n={},et.OBJECT,u.object),ot(n,et.KEY,f),n)),p.map(function(e,t){var n=e.text,r=d;return d+=n.length,o.a.createElement(mt,{key:u.key+"-"+t,block:i,editor:s,index:t,annotations:e.annotations,decorations:e.decorations,marks:e.marks,node:u,offset:r,parent:c,leaves:p,text:n})}))});vt.propTypes={annotations:T.a.map.isRequired,block:_.block,decorations:T.a.list.isRequired,editor:S.a.object.isRequired,node:_.node.isRequired,parent:_.node.isRequired,style:S.a.object};var gt=o.a.memo(vt,function(e,t){return t.node===e.node&&"block"===t.parent.object&&e.parent.nodes.last()===e.node&&t.parent.nodes.last()!==t.node&&t.annotations.equals(e.annotations)&&t.decorations.equals(e.decorations)}),yt=A()("slate:void"),bt=function(e){function t(){var e,n,r;nt(this,t);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=r=ut(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),wt.call(r),ut(r,n)}return at(t,e),rt(t,[{key:"render",value:function(){var e,t=this.props,n=t.children,r=t.node,i=t.readOnly,a="block"===r.object?"div":"span",u=ot({},et.SPACER,!0),c=o.a.createElement(a,it({style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},u),this.renderText()),s=o.a.createElement(a,{contentEditable:!!i&&null},n);this.debug("render",{props:t});var l=(ot(e={},et.VOID,!0),ot(e,et.KEY,r.key),e);return o.a.createElement(a,it({contentEditable:!(!i&&"block"!==r.object)&&null},l),i?null:c,s)}}]),t}(o.a.Component);bt.propTypes={block:_.block,children:S.a.any.isRequired,editor:S.a.object.isRequired,node:_.node.isRequired,parent:_.node.isRequired,readOnly:S.a.bool.isRequired};var wt=function(){var e=this;this.debug=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var i=e.props.node,a=i.key+" ("+i.type+")";yt.apply(void 0,[t,""+a].concat(r))},this.renderText=function(){var t=e.props,n=t.annotations,r=t.block,i=t.decorations,a=t.node,u=t.readOnly,c=t.editor,s=t.textRef,l=a.getFirstText();return o.a.createElement(gt,{ref:s,annotations:n,block:"block"===a.object?a:r,decorations:i,editor:c,key:l.key,node:l,parent:a,readOnly:u})}},Ot=A()("slate:node"),Et=function(e){function t(){var e,n,r;nt(this,t);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=r=ut(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),xt.call(r),ut(r,n)}return at(t,e),rt(t,[{key:"shouldComponentUpdate",value:function(e){var t=this.props,n=t.editor.run("shouldNodeComponentUpdate",t,e),r=e,o=t;if(null!=n){if(P(!1,'As of slate-react@0.22 the `shouldNodeComponentUpdate` middleware is deprecated. You can pass specific values down the tree using React\'s built-in "context" construct instead.'),n)return!0;P(!1!==n,"Returning false in `shouldNodeComponentUpdate` does not disable Slate's internal `shouldComponentUpdate` logic. If you want to prevent updates, use React's `shouldComponentUpdate` instead.")}return r.readOnly!==o.readOnly||(r.node!==o.node||(!!(!r.selection&&o.selection||r.selection&&!o.selection||r.selection&&o.selection&&!r.selection.equals(o.selection))||(!r.annotations.equals(o.annotations)||!r.decorations.equals(o.decorations))))}},{key:"render",value:function(){var e,n=this;this.debug("render",this);var r=this.props,i=r.annotations,a=r.block,u=r.decorations,c=r.editor,s=r.node,l=r.parent,f=r.readOnly,p=r.selection,d=s.getDecorations(c),h=s.nodes.toArray().map(function(e,r){var l="text"===e.object?gt:t,h=p&&kt(s,r,p),m=d.map(function(e){return kt(s,r,e)}).filter(function(e){return e}).concat(u),v=i.map(function(e){return kt(s,r,e)}).filter(function(e){return e});return o.a.createElement(l,{block:"block"===s.object?s:a,editor:c,annotations:v,decorations:m,selection:h,key:e.key,node:e,parent:s,readOnly:f,ref:function(e){e?n.tmp.nodeRefs[r]=e:delete n.tmp.nodeRefs[r]}})}),m=(ot(e={},et.OBJECT,s.object),ot(e,et.KEY,s.key),ot(e,"ref",this.ref),e);s.isLeafBlock()&&("rtl"===s.getTextDirection()&&(m.dir="rtl"));var v=void 0;"block"===s.object?v="renderBlock":"document"===s.object?v="renderDocument":"inline"===s.object&&(v="renderInline");var g=c.run(v,{attributes:m,children:h,editor:c,isFocused:!!p&&p.isFocused,isSelected:!!p,node:s,parent:l,readOnly:f});return c.isVoid(s)?o.a.createElement(bt,it({},this.props,{textRef:function(e){e?n.tmp.nodeRefs[0]=e:delete n.tmp.nodeRefs[0]}}),g):g}}]),t}(o.a.Component);Et.propTypes={annotations:T.a.map.isRequired,block:_.block,decorations:T.a.list.isRequired,editor:S.a.object.isRequired,node:_.node.isRequired,parent:_.node,readOnly:S.a.bool.isRequired,selection:_.selection};var xt=function(){var e=this;this.tmp={nodeRefs:{}},this.ref=o.a.createRef(),this.debug=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var i=e.props.node,a=i.key,u=i.type;Ot.apply(void 0,[t,a+" ("+u+")"].concat(r))}};function kt(e,t,n){if(n.isUnset)return null;var r=e.nodes.get(t),o=n,i=o.start,a=o.end,u=i.path,c=a.path,s=u.first(),l=c.first();if(s===t)i=i.setPath(u.rest());else if(s<t&&t<=l)if("text"===r.object)i=i.moveTo(C.j.create([t]),0);else{var f=r.texts(),p=ct(f,1)[0],d=ct(p,2)[1];i=i.moveTo(d,0)}else i=null;if(l===t)a=a.setPath(c.rest());else if(s<=t&&t<l)if("text"===r.object)a=a.moveTo(C.j.create([t]),r.text.length);else{var h=r.texts({direction:"backward"}),m=ct(h,1)[0],v=ct(m,2),g=v[0],y=v[1];a=a.moveTo(y,g.text.length)}else a=null;return i&&a?n=(n=n.setStart(i)).setEnd(a):null}var St=["auto","overlay","scroll"],Ct=we&&!!window.navigator.userAgent.match(/os 11_/i);function jt(e){if(!Ct&&e.anchorNode){var t=M()(e.anchorNode),n=function(e,t){for(var n=e.parentNode,r=void 0;!r&&n.parentNode;){var o=t.getComputedStyle(n).overflowY;if(St.includes(o)){r=n;break}n=n.parentNode}return r||t.document.body}(e.anchorNode,t),r=n===t.document.body||n===t.document.documentElement,o=R()(e),i=e.getRangeAt(0).cloneRange();i.collapse(o);var a=i.getBoundingClientRect();ve&&i.collapsed&&0===a.top&&0===a.height&&(0===i.startOffset?i.setEnd(i.endContainer,1):i.setStart(i.startContainer,i.startOffset-1),0===(a=i.getBoundingClientRect()).top&&0===a.height&&i.getClientRects().length&&(a=i.getClientRects()[0]));var u=void 0,c=void 0,s=void 0,l=void 0,f=0,p=0,d=0,h=0,m=0,v=0,g=0,y=0;if(r){u=t.innerWidth,c=t.innerHeight,s=t.pageYOffset,l=t.pageXOffset}else{var b=n.offsetWidth,w=n.offsetHeight,O=n.scrollTop,E=n.scrollLeft,x=t.getComputedStyle(n),k=x.borderTopWidth,S=x.borderBottomWidth,C=x.borderLeftWidth,j=x.borderRightWidth,_=x.paddingTop,I=x.paddingBottom,T=x.paddingLeft,N=x.paddingRight,A=n.getBoundingClientRect();u=b,c=w,f=A.top+parseInt(k,10),p=A.left+parseInt(C,10),d=parseInt(k,10)+parseInt(S,10),h=parseInt(C,10)+parseInt(j,10),m=parseInt(_,10),v=parseInt(I,10),g=parseInt(T,10),y=parseInt(N,10),s=O,l=E}var P=a.top+s-f,D=a.left+l-p,L=l,F=s;D<l?L=D-g:D+a.width+h>l+u&&(L=D+h+y-u),P<s?F=P-m:P+a.height+d>s+c&&(F=P+d+v+a.height-c),r?t.scrollTo(L,F):(n.scrollTop=F,n.scrollLeft=L)}}function _t(e){if(ge){var t=window.document.body.createTextRange();t.collapse(),t.select()}else e.removeAllRanges()}var It=/Permission denied to access property "nodeType"/,Tt=A()("slate:content");Tt.update=A()("slate:update");var Nt=function(e){function t(){var e,n,r;nt(this,t);for(var i=arguments.length,a=Array(i),u=0;u<i;u++)a[u]=arguments[u];return n=r=ut(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.tmp={isUpdatingSelection:!1,nodeRef:o.a.createRef(),nodeRefs:{}},r.ref=o.a.createRef(),r.setRef=function(e){r.ref.current=e,r.props.editor.el=e},r.handlers=$e.reduce(function(e,t){return e[t]=function(e){return r.onEvent(t,e)},e},{}),r.updateSelection=function(){var e=r.props.editor,t=e.value.selection,n=t.isBackward,o=M()(r.ref.current),i=o.getSelection(),a=o.document.activeElement;if(Tt.enabled&&Tt.update("updateSelection",{selection:t.toJSON()}),i){var u=i.rangeCount,c=i.anchorNode,s=!1;if(t.isBlurred&&a===r.ref.current&&(r.ref.current.blur(),s=!0),t.isUnset&&u&&r.isInEditor(c)&&(_t(i),s=!0),t.isFocused&&a!==r.ref.current&&(r.ref.current.focus({preventScroll:!0}),s=!0),t.isFocused&&t.isSet){var l=!!u&&i.getRangeAt(0),f=e.findDOMRange(t);if(!f)return void P(!1,"Unable to find a native DOM range from the current selection.");var p=f.startContainer,d=f.startOffset,h=f.endContainer,m=f.endOffset;if(l&&(p===l.startContainer&&d===l.startOffset&&h===l.endContainer&&m===l.endOffset||p===l.endContainer&&d===l.endOffset&&h===l.startContainer&&m===l.startOffset))return;s=!0,r.tmp.isUpdatingSelection=!0,_t(i),i.setBaseAndExtent?n?i.setBaseAndExtent(f.endContainer,f.endOffset,f.startContainer,f.startOffset):i.setBaseAndExtent(f.startContainer,f.startOffset,f.endContainer,f.endOffset):i.addRange(f),jt(i),setTimeout(function(){me&&r.ref.current&&r.ref.current.focus(),r.tmp.isUpdatingSelection=!1})}s&&Tt.enabled&&(Tt("updateSelection",{selection:t,native:i,activeElement:a}),Tt.update("updateSelection-applied",{selection:t}))}},r.isInEditor=function(e){var t=void 0;try{if(8===e.nodeType)return!1;t=3===e.nodeType?e.parentNode:e}catch(e){if(me&&It.test(e.message))return!1;throw e}return t.isContentEditable&&(t===r.ref.current||t.closest(tt.EDITOR)===r.ref.current)},r.onNativeSelectionChange=Se()(function(e){r.props.readOnly||M()(e.target).document.activeElement===r.ref.current&&r.props.onEvent("onSelect",e)},100),ut(r,n)}return at(t,e),rt(t,[{key:"componentDidCatch",value:function(e,t){Tt("componentDidCatch",{error:e,info:t}),this.setState({})}},{key:"componentDidMount",value:function(){M()(this.ref.current).document.addEventListener("selectionchange",this.onNativeSelectionChange),xe&&this.ref.current.addEventListener("beforeinput",this.handlers.onBeforeInput),this.updateSelection(),this.props.onEvent("onComponentDidMount")}},{key:"componentWillUnmount",value:function(){var e=M()(this.ref.current);e&&e.document.removeEventListener("selectionchange",this.onNativeSelectionChange),xe&&this.ref.current.removeEventListener("beforeinput",this.handlers.onBeforeInput),this.props.onEvent("onComponentWillUnmount")}},{key:"componentDidUpdate",value:function(){Tt.update("componentDidUpdate"),this.updateSelection(),this.props.onEvent("onComponentDidUpdate")}},{key:"onEvent",value:function(e,t){if(Tt("onEvent",e),!this.tmp.isUpdatingSelection||"onSelect"!==e&&"onBlur"!==e&&"onFocus"!==e){if(!be&&"onSelect"===e){var n=this.props.editor,r=n.value.selection,o=M()(t.target).getSelection(),i=n.findRange(o);if(i&&i.equals(r.toRange()))return void this.updateSelection()}if("onDragEnd"===e||"onDragEnter"===e||"onDragExit"===e||"onDragLeave"===e||"onDragOver"===e||"onDragStart"===e||"onDrop"===e)if(t.target.closest(tt.EDITOR)!==this.ref.current)return;("onBeforeInput"!==e&&"onBlur"!==e&&"onCompositionEnd"!==e&&"onCompositionStart"!==e&&"onCopy"!==e&&"onCut"!==e&&"onFocus"!==e&&"onInput"!==e&&"onKeyDown"!==e&&"onKeyUp"!==e&&"onPaste"!==e&&"onSelect"!==e||this.isInEditor(t.target))&&this.props.onEvent(e,t)}}},{key:"render",value:function(){var e,t=this.props,n=this.handlers,r=t.id,i=t.className,a=t.readOnly,u=t.editor,c=t.tabIndex,s=t.role,l=t.tagName,f=t.spellCheck,p=u.value,d=l,h=p.document,m=p.selection,v=it({outline:"none",whiteSpace:"pre-wrap",wordWrap:"break-word"},a?{}:{WebkitUserModify:"read-write-plaintext-only"},t.style);Tt("render",{props:t}),this.props.onEvent("onRender");var g=(ot(e={},et.EDITOR,!0),ot(e,et.KEY,h.key),e);return o.a.createElement(d,it({key:this.props.contentKey},n,g,{ref:this.setRef,contentEditable:!a||null,suppressContentEditableWarning:!0,id:r,className:i,autoCorrect:t.autoCorrect?"on":"off",spellCheck:f,style:v,role:a?null:s||"textbox",tabIndex:c,"data-gramm":!1}),o.a.createElement(Et,{annotations:p.annotations,block:null,decorations:Object(Ce.List)(),editor:u,node:h,parent:null,readOnly:a,selection:m,ref:this.tmp.nodeRef}))}}]),t}(o.a.Component);Nt.propTypes={autoCorrect:S.a.bool.isRequired,className:S.a.string,contentKey:S.a.number,editor:S.a.object.isRequired,id:S.a.string,readOnly:S.a.bool.isRequired,role:S.a.string,spellCheck:S.a.bool.isRequired,style:S.a.object,tabIndex:S.a.number,tagName:S.a.string},Nt.defaultProps={style:{},tagName:"div"};var At=[].concat(st($e),["commands","decorateNode","queries","renderAnnotation","renderBlock","renderDecoration","renderDocument","renderEditor","renderInline","renderMark","schema"]);function Pt(){return{queries:{findDOMNode:function(e,t){t=C.j.create(t);var n=e.tmp.contentRef.current;return n?t.size?function e(t,n){if(!t)return null;if(!n.size)return t.ref?t.ref.current||null:t||null;var r=n.first(),o=n.rest();return e(t.tmp.nodeRefs[r],o)}(n.tmp.nodeRef.current,t):n.ref.current||null:null},findDOMPoint:function(e,t){var n=e.findDOMNode(t.path),r=0;if(!n)return null;var o=Array.from(n.querySelectorAll(tt.STRING+", "+tt.ZERO_WIDTH)),i=!0,a=!1,u=void 0;try{for(var c,s=o[Symbol.iterator]();!(i=(c=s.next()).done);i=!0){var l=c.value,f=l.childNodes[0],p=f.textContent.length,d=p;l.hasAttribute(et.LENGTH)&&(d=parseInt(l.getAttribute(et.LENGTH),10));var h=r+d;if(t.offset<=h)return{node:f,offset:Math.min(p,Math.max(0,t.offset-r))};r=h}}catch(e){a=!0,u=e}finally{try{!i&&s.return&&s.return()}finally{if(a)throw u}}return null},findDOMRange:function(e,t){var n=t.anchor,r=t.focus,o=t.isBackward,i=t.isCollapsed,a=e.findDOMPoint(n),u=i?a:e.findDOMPoint(r);if(!a||!u)return null;var c=M()(a.node).document.createRange(),s=o?u:a,l=o?a:u;return c.setStart(s.node,s.offset),c.setEnd(l.node,l.offset),c},findEventRange:function(e,t){t.nativeEvent&&(t=t.nativeEvent);var n=t,r=n.clientX,o=n.clientY,i=n.target;if(null==r||null==o)return null;var a=e.value.document,u=e.findPath(t.target);if(!u)return null;var c=a.getNode(u);if(e.isVoid(c)){var s=i.getBoundingClientRect(),l="inline"===c.object?r-s.left<s.left+s.width-r:o-s.top<s.top+s.height-o,f=a.createRange(),p=l?"moveToEndOfNode":"moveToStartOfNode",d=a[l?"getPreviousText":"getNextText"](u);return d?f[p](d):null}var h=M()(i),m=void 0;if(h.document.caretRangeFromPoint)m=h.document.caretRangeFromPoint(r,o);else if(h.document.caretPositionFromPoint){var v=h.document.caretPositionFromPoint(r,o);(m=h.document.createRange()).setStart(v.offsetNode,v.offset),m.setEnd(v.offsetNode,v.offset)}else if(h.document.body.createTextRange){m=h.document.body.createTextRange();try{m.moveToPoint(r,o)}catch(e){return null}}return e.findRange(m)},findNode:function(e,t){var n=e.findPath(t);return n?e.value.document.getNode(n):null},findPath:function(e,t){var n=e.tmp.contentRef.current,r=t;if(r.hasAttribute(et.KEY)||(r=r.closest(tt.KEY)),!r||!r.getAttribute(et.KEY))return null;if(r===n.ref.current)return C.j.create([]);var o=function e(t,n){if(r===t)return n;if(!t.ref)return null;if(r===t.ref.current)return n;if(!t.tmp)return null;var o=t.tmp.nodeRefs,i=Object.keys(o),a=!0,u=!1,c=void 0;try{for(var s,l=i[Symbol.iterator]();!(a=(s=l.next()).done);a=!0){var f=s.value,p=o[f],d=parseInt(f,10),h=e(p,[].concat(st(n),[d]));if(h)return h}}catch(e){u=!0,c=e}finally{try{!a&&l.return&&l.return()}finally{if(u)throw c}}return null}(n.tmp.nodeRef.current,[]);return o?C.j.create(o):null},findPoint:function(e,t,n){var r=function(e,t){if(1===e.nodeType&&e.childNodes.length){var n=t===e.childNodes.length,r=n?"backward":"forward",o=n?t-1:t;for(e=Dt(e,o,r);1===e.nodeType&&e.childNodes.length;){var i=n?e.childNodes.length-1:0;e=Dt(e,i,r)}t=n?e.textContent.length:0}return{node:e,offset:t}}(t,n),o=r.node,i=r.offset,a=M()(t),u=o.parentNode,c=u.closest(tt.LEAF),s=void 0,l=void 0,f=void 0;if(c){s=c.closest(tt.TEXT);var p=a.document.createRange();p.setStart(s,0),p.setEnd(o,i);var d=p.cloneContents(),h=d.querySelectorAll(tt.ZERO_WIDTH);Array.from(h).forEach(function(e){e.parentNode.removeChild(e)}),l=d.textContent.length,f=s}else{var m=u.closest(tt.VOID);if(!m)return null;if(!(c=m.querySelector(tt.LEAF)))return null;s=c.closest(tt.TEXT),l=(f=c).textContent.length}l===f.textContent.length&&u.hasAttribute(et.ZERO_WIDTH)&&l--;var v=e.findPath(s);return v?e.value.document.createPoint({path:v,offset:l}):null},findRange:function(e,t){var n=t.anchorNode||t.startContainer;if(!n)return null;var r=M()(n);(t instanceof r.Range||r.StaticRange&&t instanceof r.StaticRange)&&(t={anchorNode:t.startContainer,anchorOffset:t.startOffset,focusNode:t.endContainer,focusOffset:t.endOffset});var o=t,i=o.anchorNode,a=o.anchorOffset,u=o.focusNode,c=o.focusOffset,s=o.isCollapsed,l=e.value,f=e.findPoint(i,a),p=s?f:e.findPoint(u,c);return f&&p?l.document.createRange({anchor:f,focus:p}):null},findSelection:function(e,t){var n=e.value,r=n.document;if(!t.rangeCount)return null;var o=e.findRange(t);if(!o)return null;var i=o,a=i.anchor,u=i.focus,c=r.getNode(a.path),s=r.getNode(u.path),l=r.getClosestInline(a.path),f=r.getClosestInline(u.path),p=r.getClosestBlock(u.path),d=r.getClosestBlock(a.path);if(d&&!e.isVoid(d)&&0===a.offset&&p&&e.isVoid(p)&&0!==u.offset&&(o=o.setFocus(u.setOffset(0))),l&&!e.isVoid(l)&&a.offset===c.text.length){var h=r.getClosestBlock(a.path),m=r.getDepth(h.key),v=C.j.drop(a.path,m),g=h.texts({path:v}),y=ct(g,1)[0];if(y){var b=ct(y,2)[1],w=a.path.slice(0,m).concat(b);o=o.moveAnchorTo(w,0)}}if(f&&!e.isVoid(f)&&u.offset===s.text.length){var O=r.getClosestBlock(u.path),E=r.getDepth(O.key),x=C.j.drop(u.path,E),k=O.texts({path:x}),S=ct(k,1)[0];if(S){var j=ct(S,2)[1],_=u.path.slice(0,E).concat(j);o=o.moveFocusTo(_,0)}}var I=r.createSelection(o);return I=(I=I.setIsFocused(!0)).set("marks",n.selection.marks)}}}}function Dt(e,t,n){for(var r=e.childNodes,o=r[t],i=t,a=!1,u=!1;(8===o.nodeType||1===o.nodeType&&0===o.childNodes.length||1===o.nodeType&&"false"===o.getAttribute("contenteditable"))&&(!a||!u);)i>=r.length?(a=!0,i=t-1,n="backward"):i<0?(u=!0,i=t+1,n="forward"):(o=r[i],"forward"===n&&i++,"backward"===n&&i--);return o||null}function Mt(e,t,n){P(!1,"As of slate-react@0.22 the `findPoint(node, offset)` helper is deprecated in favor of `editor.findPoint(node, offset)`."),Object(je.a)(!C.n.isValue(n),"As of Slate 0.42.0, the `findPoint` utility takes an `editor` instead of a `value`.");var r=function(e,t){if(1===e.nodeType&&e.childNodes.length){var n=t===e.childNodes.length,r=n?"backward":"forward",o=n?t-1:t;for(e=Lt(e,o,r);1===e.nodeType&&e.childNodes.length;){var i=n?e.childNodes.length-1:0;e=Lt(e,i,r)}t=n?e.textContent.length:0}return{node:e,offset:t}}(e,t),o=r.node,i=r.offset,a=M()(e),u=o.parentNode,c=u.closest(tt.LEAF),s=void 0,l=void 0;if(c){var f=a.document.createRange(),p=c.closest(tt.TEXT);f.setStart(p,0),f.setEnd(o,i),l=p,s=f.cloneContents().textContent.length}else{var d=u.closest(tt.VOID);if(!d)return null;if(!(c=d.querySelector(tt.LEAF)))return null;s=(l=c).textContent.length}s===l.textContent.length&&u.hasAttribute(et.ZERO_WIDTH)&&s--;var h=c.getAttribute(et.OFFSET_KEY);if(!h)return null;var m=ft.parse(h).key,v=n.value;return v.document.hasDescendant(m)?v.document.createPoint({key:m,offset:s}):null}function Lt(e,t,n){for(var r=e.childNodes,o=r[t],i=t,a=!1,u=!1;(8===o.nodeType||1===o.nodeType&&0===o.childNodes.length||1===o.nodeType&&"false"===o.getAttribute("contenteditable"))&&(!a||!u);)i>=r.length?(a=!0,i=t-1,n="backward"):i<0?(u=!0,i=t+1,n="forward"):(o=r[i],"forward"===n&&i++,"backward"===n&&i--);return o||null}function Rt(e,t){P(!1,"As of slate-react@0.22 the `findRange(selection)` helper is deprecated in favor of `editor.findRange(selection)`."),Object(je.a)(!C.n.isValue(t),"As of Slate 0.42.0, the `findNode` utility takes an `editor` instead of a `value`.");var n=e.anchorNode||e.startContainer;if(!n)return null;var r=M()(n);(e instanceof r.Range||r.StaticRange&&e instanceof r.StaticRange)&&(e={anchorNode:e.startContainer,anchorOffset:e.startOffset,focusNode:e.endContainer,focusOffset:e.endOffset});var o=e,i=o.anchorNode,a=o.anchorOffset,u=o.focusNode,c=o.focusOffset,s=o.isCollapsed,l=t.value,f=Mt(i,a,t),p=s?f:Mt(u,c,t);return f&&p?l.document.createRange({anchor:f,focus:p}):null}function Ft(e,t,n){P(!1,"As of slate-react@0.22 the `getSelectionFromDOM(window, editor, domSelection)` helper is deprecated in favor of `editor.findSelection(domSelection)`.");var r=t.value,o=r.document;if(n.rangeCount){var i=Rt(n,t);if(i){var a=i,u=a.anchor,c=a.focus,s=o.getNode(u.path),l=o.getNode(c.path),f=o.getClosestInline(u.path),p=o.getClosestInline(c.path),d=o.getClosestBlock(c.path),h=o.getClosestBlock(u.path);if(h&&!t.isVoid(h)&&0===u.offset&&d&&t.isVoid(d)&&0!==c.offset&&(i=i.setFocus(c.setOffset(0))),f&&!t.isVoid(f)&&u.offset===s.text.length){var m=o.getClosestBlock(u.path),v=o.getDepth(m.key),g=C.j.drop(u.path,v),y=m.texts({path:g}),b=ct(y,1)[0];if(b){var w=ct(b,2)[1],O=u.path.slice(0,v).concat(w);i=i.moveAnchorTo(O,0)}}if(p&&!t.isVoid(p)&&c.offset===l.text.length){var E=o.getClosestBlock(c.path),x=o.getDepth(E.key),k=C.j.drop(c.path,x),S=E.texts({path:k}),j=ct(S,1)[0];if(j){var _=ct(j,2)[1],I=c.path.slice(0,x).concat(_);i=i.moveFocusTo(I,0)}}var T=o.createSelection(i);return T=(T=T.setIsFocused(!0)).set("marks",r.selection.marks)}}else t.blur()}function Bt(e,t){return e.nodeType===t.Node.TEXT_NODE}function zt(e,t){if(!e.length)throw new Error("elements must be an Array");var n=e[e.length-1];return{elements:e.map(function(e){return function e(t,n){var r={};return r.node=t,Bt(t,n)&&(r.text=t.textContent),r.children=Array.from(t.childNodes).map(function(t){return e(t,n)}),r}(e,t)}),parent:n.parentElement,next:n.nextElementSibling}}function Ut(e,t){var n=e.elements,r=e.next,o=e.parent;n.forEach(function(e){return function e(t,n){var r=t.node;Bt(r,n)&&r.textContent!==t.text&&(r.textContent=t.text),t.children.forEach(function(t){e(t,n),r.appendChild(t.node)});for(var o=t.children.length;r.childNodes.length>o;)r.removeChild(r.childNodes[0]);var i=r.dataset;if(i){var a=i.key;if(a){var u=new n.Set(Array.from(n.document.querySelectorAll("["+et.KEY+'="'+a+'"]')));u.delete(r),u.forEach(function(e){return e.parentElement.removeChild(e)})}}}(e,t)});var i=n[n.length-1].node;e.next?o.insertBefore(i,r):o.appendChild(i);for(var a=i,u=n.length-2;u>=0;u--){var c=n[u].node;o.insertBefore(c,a),a=c}}var qt=function(){function e(t,n){nt(this,e),this.window=M()(t[0]),this.snapshot=zt(t,this.window),this.data=n}return rt(e,[{key:"apply",value:function(){Ut(this.snapshot,this.window)}},{key:"getData",value:function(){return this.data}}]),e}();function Wt(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;return e.nodeType===n.Node.TEXT_NODE&&(e=e.parentNode),e.closest(t)}var Ht=function(){function e(t,n){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).before,o=void 0!==r&&r;nt(this,e);var i=t.getSelection(),a=Wt(i.anchorNode,tt.EDITOR+" > *"),u=[a];if(o){var c=a.previousElementSibling;c&&u.unshift(c)}this.snapshot=new qt(u),this.selection=n.findSelection(i)}return rt(e,[{key:"apply",value:function(e){var t=this.snapshot,n=this.selection;t.apply(),e.moveTo(n.anchor.path,n.anchor.offset)}}]),e}();function Vt(){}var Gt=function e(t,n){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};nt(this,e),this.__call__=function(){r.fn(),r.preventFurtherCalls()},this.preventFurtherCalls=function(){r.fn=Vt},this.resume=function(e){r.cancel(),e?(r.mode="timeout",r.timeoutId=r.window.setTimeout(r.__call__,e)):(r.mode="animationFrame",r.callbackId=r.window.requestAnimationFrame(r.__call__))},this.cancel=function(){"timeout"===r.mode?r.window.clearTimeout(r.timeoutId):r.window.cancelAnimationFrame(r.callbackId),r.onCancel&&r.onCancel()},this.__setTimeout__=function(e){null!=e&&r.window.setTimeout(function(){r.cancel(),r.preventFurtherCalls()},e)},this.fn=n,this.window=t,this.resume(),this.onCancel=o.onCancel,this.__setTimeout__(o.timeout)},Jt=A()("slate:android");Jt.reconcile=A()("slate:reconcile"),Jt("ANDROID_API_VERSION",{ANDROID_API_VERSION:Ee});var Zt=0,Yt=1;function Kt(){var e=Zt,t=new window.Set,n=null,r=null,o=null,i=null,a=!1,u=null;function c(e,n,r){var o=r.from;Jt.reconcile({from:o});var i=e.getSelection(),a=n.findSelection(i);t.forEach(function(e){n.reconcileDOMNode(e)}),n.select(a),t.clear()}return{onBeforeInput:function(t,o,c){var s=!t.nativeEvent;Jt("onBeforeInput",{isNative:s,event:t,status:e,e:Ie()(t,["data","inputType","isComposing","nativeEvent"])});var l,f=M()(t.target);if(a)return t.preventDefault(),void(a=!1);switch(Ee){case 25:break;case 26:case 27:if(i&&(i.cancel(),r.resume()),s){if("insertParagraph"===t.inputType||"insertLineBreak"===t.inputType){Jt("onBeforeInput:enter:native",{});var p=f.getSelection(),d=Ft(0,o,p);a=!0,t.preventDefault(),o.moveTo(d.anchor.path,d.anchor.offset),o.splitBlock()}}else{if(function(e,t){if(!Array.isArray(t))throw new Error("chars must be an array of one character strings");if(null==e)return!1;var n=e[e.length-1];return t.includes(n)}(t.data,["."]))return Jt("onBeforeInput:period"),r.cancel(),void(u="period");null!=(l=t.data)&&10===l[l.length-1].charCodeAt(0)&&(r&&r.cancel(),f.requestAnimationFrame(function(){Jt("onBeforeInput:enter:react",{}),n.apply(o),o.splitBlock()}))}break;case 28:i&&(i.cancel(),r.resume());break;default:e!==Yt&&c()}},onCompositionEnd:function(o,i,a){Jt("onCompositionEnd",{event:o});var s=M()(o.target),l=s.getSelection().anchorNode;switch(Ee){case 26:case 27:n=new Ht(s,i),e=Yt}u="reconcile",t.add(l),r=new Gt(s,function(){e=Zt,c(s,i,{from:"onCompositionEnd:reconciler"}),u=null})},onCompositionStart:function(n,r,o){Jt("onCompositionStart",{event:n}),e=Yt,t.clear()},onCompositionUpdate:function(e,t,n){Jt("onCompositionUpdate",{event:e})},onInput:function(n,a,s){switch(Jt("onInput",{event:n,status:e,e:Ie()(n,["data","nativeEvent","inputType","isComposing"])}),Ee){case 24:case 25:break;case 26:case 27:case 28:var l=n.nativeEvent;if(28===Ee&&"insertText"===l.inputType&&" "===l.data)return r&&r.cancel(),i&&i.cancel(),void c(window,a,{from:"onInput:space"});if((26===Ee||27===Ee)&&"period"===u){Jt("onInput:period:abort");var f=window.getSelection().anchorNode;return void t.add(f)}if("deleteContentBackward"===l.inputType){Jt("onInput:delete",{keyDownSnapshot:o});var p=M()(n.target);return r&&r.cancel(),i&&i.cancel(),void(i=new Gt(p,function(){Jt("onInput:delete:callback",{keyDownSnapshot:o}),o.apply(a),a.deleteBackward(),i=null},{onCancel:function(){i=null}}))}if(e===Yt){var d=window.getSelection().anchorNode;return void t.add(d)}if(28===Ee){Jt("onInput:fallback");var h=window.getSelection().anchorNode;return t.add(h),void window.requestAnimationFrame(function(){Jt("onInput:fallback:callback"),c(window,a,{from:"onInput:fallback"})})}break;default:if(e===Yt)return;s()}},onKeyDown:function(t,a,u){Jt("onKeyDown",{event:t,status:e,e:Ie()(t,["char","charCode","code","key","keyCode","keyIdentifier","keyLocation","location","nativeEvent","which"])});var s=M()(t.target);switch(Ee){case 25:"Enter"===t.key&&u();break;case 26:case 27:if("Enter"===t.key){if(Jt("onKeyDown:enter",{}),i)i.cancel(),t.preventDefault(),s.requestAnimationFrame(function(){Jt("onKeyDown:enter:callback"),n.apply(a),a.splitBlock()});else{t.preventDefault();var l=s.getSelection(),f=Ft(0,a,l);a.moveTo(f.anchor.path,f.anchor.offset),a.splitBlock()}return}o=new Ht(s,a,{before:!0});break;case 28:if("Enter"===t.key)return Jt("onKeyDown:enter"),t.preventDefault(),r&&r.cancel(),i&&i.cancel(),void s.requestAnimationFrame(function(){c(s,a,{from:"onKeyDown:enter"}),a.splitBlock()});o=new Ht(s,a,{before:!0}),Jt("onKeyDown:snapshot",{keyDownSnapshot:o});break;default:e!==Yt&&u()}},onSelect:function(t,n,r){switch(Jt("onSelect",{event:t,status:e}),Ee){case 26:case 27:case 28:!function(e){var t=e.getSelection(),n=t.anchorNode,r=n.parentElement.dataset;if(r&&"n"===r.slateZeroWidth&&1===n.textContent.length&&0!==t.anchorOffset){var o=e.document.createRange();o.setStart(n,0),o.setEnd(n,0),t.removeAllRanges(),t.addRange(o)}}(M()(t.target))}}}}var Xt={FRAGMENT:"application/x-slate-fragment",HTML:"text/html",NODE:"application/x-slate-node",RICH:"text/rtf",TEXT:"text/plain"};function Qt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;P(!1,"As of slate-react@0.22 the `findDOMNode(key)` helper is deprecated in favor of `editor.findDOMNode(path)`."),C.i.isNode(e)&&(e=e.key);var n=t.document.querySelector("["+et.KEY+'="'+e+'"]');if(!n)throw new Error('Unable to find a DOM node for "'+e+'". This is often because of forgetting to add `props.attributes` to a custom component.');return n}var $t=Xt.FRAGMENT,en=Xt.HTML,tn=Xt.TEXT;function nn(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};Object(je.a)(!C.n.isValue(t),"As of Slate 0.42.0, the `cloneFragment` utility takes an `editor` instead of a `value`.");var r=M()(e.target),o=r.getSelection(),i=t.value,a=i.document,u=i.fragment,c=i.selection,s=c.start,l=c.end,f=a.getClosestVoid(s.path,t),p=a.getClosestVoid(l.path,t);if(!o.isCollapsed||f){var d=Pe.serializeNode(u),h=o.getRangeAt(0),m=h.cloneContents(),v=m.childNodes[0];if(m.childNodes.forEach(function(e){e.textContent&&""!==e.textContent.trim()&&(v=e)}),p){var g=h.cloneRange(),y=Qt(p,r);g.setEndAfter(y),m=g.cloneContents()}if(f&&(v=m.childNodes[0].childNodes[1].firstChild),[].slice.call(m.querySelectorAll(tt.ZERO_WIDTH)).forEach(function(e){var t="n"===e.getAttribute(et.ZERO_WIDTH);e.textContent=t?"\n":""}),3===v.nodeType){var b=r.document.createElement("span");b.style.whiteSpace="pre",b.appendChild(v),m.appendChild(b),v=b}v.setAttribute(et.FRAGMENT,d);var w=C.n.create({document:u}),O=Le.serialize(w),E=r.document.createElement("div");if(E.appendChild(m),e.clipboardData&&e.clipboardData.setData&&!ge)return e.preventDefault(),e.clipboardData.setData(tn,O),e.clipboardData.setData($t,d),e.clipboardData.setData(en,E.innerHTML),void n();var x=e.target.closest(tt.EDITOR);E.setAttribute("contenteditable",!0),E.style.position="absolute",E.style.left="-9999px",x.appendChild(E),o.selectAllChildren(E),r.requestAnimationFrame(function(){x.removeChild(E),_t(o),o.addRange(h),n()})}}var rn=Xt.FRAGMENT,on=Xt.HTML,an=Xt.NODE,un=Xt.RICH,cn=Xt.TEXT,sn=/ data-slate-fragment="([^\s"]+)"/;function ln(e){!ge&&e.nativeEvent&&(e=e.nativeEvent);var t=e.dataTransfer||e.clipboardData,n=fn(t,rn),r=fn(t,an),o=fn(t,on),i=fn(t,un),a=fn(t,cn),u=void 0;if(!n&&o&&~o.indexOf(" "+et.FRAGMENT+'="')){var c=sn.exec(o),s=ct(c,2),l=(s[0],s[1]);l&&(n=l)}if(a){var f=function(e){var t="SLATE-DATA-EMBED::";if(e.substring(0,t.length)!==t)return{TEXT:e};try{return JSON.parse(e.substring(t.length))}catch(e){throw new Error("Unable to parse custom Slate drag event data.")}}(a);f[rn]&&(n=f[rn]),f[an]&&(r=f[an]),f[cn]&&(a=f[cn])}n&&(n=Pe.deserializeNode(n)),r&&(r=Pe.deserializeNode(r));try{t.items&&t.items.length?u=Array.from(t.items).map(function(e){return"file"===e.kind?e.getAsFile():null}).filter(function(e){return e}):t.files&&t.files.length&&(u=Array.from(t.files))}catch(e){t.files&&t.files.length&&(u=Array.from(t.files))}var p={files:u,fragment:n,html:o,node:r,rich:i,text:a};return p.type=function(e){return e.fragment?"fragment":e.node?"node":e.rich&&e.html?"html":e.rich&&e.text?"text":e.files&&e.files.length?"files":e.html?"html":e.text?"text":"unknown"}(p),p}function fn(e,t){return e.types&&e.types.length?-1!==Array.from(e.types).indexOf(t)&&e.getData(t)||null:t===cn&&e.getData("Text")||null}var pn=Xt.TEXT;function dn(e,t,n){var r=Xt[t.toUpperCase()];if(!r)throw new Error('Cannot set unknown transfer type "'+r+'".');e.nativeEvent&&(e=e.nativeEvent);var o=e.dataTransfer||e.clipboardData;try{o.setData(r,n),o.setData("text",o.getData("text"))}catch(e){var i="SLATE-DATA-EMBED::",a=o.getData(pn),u={};if(a.substring(0,i.length)===i)try{u=JSON.parse(a.substring(i.length))}catch(e){throw new Error("Failed to parse Slate data from `DataTransfer` object.")}else u[pn]=a;u[r]=n;var c=""+i+JSON.stringify(u);o.setData(pn,c)}}var hn=A()("slate:after");var mn=A()("slate:before");function vn(){var e,t,n,r,o,i,a,u=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).plugins,c=void 0===u?[]:u,s=(e=null,t=0,n=!1,r=!1,o=!1,{onBeforeInput:function(e,t,n){var r=!!e.nativeEvent;t.readOnly||r&&xe||(mn("onBeforeInput",{event:e}),n())},onBlur:function(t,n,o){if(!r&&!n.readOnly){var i=t.relatedTarget,a=t.target,u=M()(a);if(e!==u.document.activeElement){if(i){var c=n.findDOMNode([]);if(i===c)return;if(i.hasAttribute(et.SPACER))return;var s=n.findNode(i);if(c.contains(i)&&s&&!n.isVoid(s))return}mn("onBlur",{event:t}),o()}}},onClick:function(e,t,n){mn("onClick",{event:e}),n()},onCompositionEnd:function(e,r,o){var i=t;window.requestAnimationFrame(function(){t>i||(n=!1)}),mn("onCompositionEnd",{event:e}),o()},onCompositionStart:function(e,r,o){n=!0,t++,r.value.selection.isCollapsed||r.delete(),mn("onCompositionStart",{event:e}),o()},onCopy:function(e,t,n){var o=M()(e.target);r=!0,o.requestAnimationFrame(function(){return r=!1}),mn("onCopy",{event:e}),n()},onCut:function(e,t,n){if(!t.readOnly){var o=M()(e.target);r=!0,o.requestAnimationFrame(function(){return r=!1}),mn("onCut",{event:e}),n()}},onDragEnd:function(e,t,n){o=!1,mn("onDragEnd",{event:e}),n()},onDragEnter:function(e,t,n){mn("onDragEnter",{event:e}),n()},onDragExit:function(e,t,n){mn("onDragExit",{event:e}),n()},onDragLeave:function(e,t,n){mn("onDragLeave",{event:e}),n()},onDragOver:function(e,t,n){var r=t.findNode(e.target);r&&!t.isVoid(r)||e.preventDefault(),ge&&e.preventDefault(),o||(o=!0,ge||(e.nativeEvent.dataTransfer.dropEffect="move")),mn("onDragOver",{event:e}),n()},onDragStart:function(e,t,n){o=!0,mn("onDragStart",{event:e}),n()},onDrop:function(e,t,n){t.readOnly||(e.preventDefault(),mn("onDrop",{event:e}),n())},onFocus:function(t,n,o){if(!r&&!n.readOnly){var i=n.findDOMNode([]),a=M()(t.target);e=a.document.activeElement,me&&t.target!==i?i.focus():(mn("onFocus",{event:t}),o())}},onInput:function(e,t,r){n||t.value.selection.isBlurred||(mn("onInput",{event:e}),r())},onKeyDown:function(e,t,r){t.readOnly||(n?He.isCompose(e)&&e.preventDefault():(!we&&(He.isBold(e)||He.isDeleteBackward(e)||He.isDeleteForward(e)||He.isDeleteLineBackward(e)||He.isDeleteLineForward(e)||He.isDeleteWordBackward(e)||He.isDeleteWordForward(e)||He.isItalic(e)||He.isRedo(e)||He.isSplitBlock(e)||He.isTransposeCharacter(e)||He.isUndo(e))&&e.preventDefault(),mn("onKeyDown",{event:e}),r()))},onPaste:function(e,t,n){t.readOnly||(e.preventDefault(),mn("onPaste",{event:e}),n())},onSelect:function(t,o,i){if(!r&&!n&&!o.readOnly){var a=M()(t.target);e=a.document.activeElement,mn("onSelect",{event:t}),i()}}}),l=(i=null,a=!1,{onBeforeInput:function(e,t,n){var r=t.value;if(e.nativeEvent)return e.preventDefault(),t.insertText(e.data),n();var o=e.getTargetRanges(),i=ct(o,1)[0];if(!i)return n();hn("onBeforeInput",{event:e}),e.preventDefault();var a=r.document,u=r.selection,c=t.findRange(i);switch(e.inputType){case"deleteByDrag":case"deleteByCut":case"deleteContent":case"deleteContentBackward":case"deleteContentForward":t.deleteAtRange(c);break;case"deleteWordBackward":t.deleteWordBackwardAtRange(c);break;case"deleteWordForward":t.deleteWordForwardAtRange(c);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":t.deleteLineBackwardAtRange(c);break;case"deleteSoftLineForward":case"deleteHardLineForward":t.deleteLineForwardAtRange(c);break;case"insertLineBreak":case"insertParagraph":a.hasVoidParent(u.start.path,t)?t.moveToStartOfNextText():t.splitBlockAtRange(c);break;case"insertFromYank":case"insertReplacementText":case"insertText":var s=null==e.data?e.dataTransfer.getData("text/plain"):e.data;if(null==s)break;t.insertTextAtRange(c,s,u.marks),u.marks&&r.document!==t.value.document&&t.select({marks:null})}n()},onBlur:function(e,t,n){hn("onBlur",{event:e}),t.blur(),n()},onClick:function(e,t,n){if(t.readOnly)return n();var r=t.value.document,o=t.findPath(e.target);if(!o)return n();hn("onClick",{event:e});var i=r.getNode(o),a=r.getAncestors(o);i&&(t.isVoid(i)||a.some(function(e){return t.isVoid(e)}))&&t.focus().moveToEndOfNode(i),n()},onCopy:function(e,t,n){hn("onCopy",{event:e}),nn(e,t),n()},onCut:function(e,t,n){hn("onCut",{event:e}),nn(e,t,function(){var e=t.value,n=e.document,r=e.selection,o=r.end,i=void 0;if(r.isCollapsed){var a=!0,u=!1,c=void 0;try{for(var s,l=n.ancestors(o.path)[Symbol.iterator]();!(a=(s=l.next()).done);a=!0){var f=s.value,p=ct(f,2),d=p[0],h=p[1];if(t.isVoid(d)){i=h;break}}}catch(e){u=!0,c=e}finally{try{!a&&l.return&&l.return()}finally{if(u)throw c}}}i?t.removeNodeByKey(i):t.delete()}),n()},onDragEnd:function(e,t,n){hn("onDragEnd",{event:e}),i=null,n()},onDragStart:function(e,t,n){hn("onDragStart",{event:e}),i=!0;var r=t.value,o=r.document,a=t.findPath(e.target),u=o.getNode(a),c=o.getAncestors(a),s=u&&(t.isVoid(u)||c.some(function(e){return t.isVoid(e)})),l=r.blocks.some(function(e){return e===u});s&&!l&&t.moveToRangeOfNode(u);var f=t.value.fragment;dn(e,"fragment",Pe.serializeNode(f)),n()},onDrop:function(e,t,n){var r=t.value,o=r.document,a=r.selection,u=M()(e.target),c=t.findEventRange(e);if(!c)return n();hn("onDrop",{event:e});var s=ln(e),l=s.type,f=s.fragment,p=s.text;if(t.focus(),i&&a.end.offset<c.end.offset&&a.end.path.equals(c.end.path)&&(c=c.moveForward(a.start.path.equals(a.end.path)?0-a.end.offset+a.start.offset:0-a.end.offset)),i&&t.delete(),t.select(c),"text"===l||"html"===l){var d=c.anchor,h=o.hasVoidParent(d.path,t);if(h){for(var m=d.path,v=o.getNode(d.path);h;){var g=o.texts({path:m}),y=ct(g,1)[0];if(!y)break;var b=ct(y,2);v=b[0],m=b[1],h=o.hasVoidParent(m,t)}v&&t.moveToStartOfNode(v)}p&&p.split("\n").forEach(function(e,n){n>0&&t.splitBlock(),t.insertText(e)})}"fragment"===l&&t.insertFragment(f);var w=t.findDOMNode(c.focus.path);w&&w.dispatchEvent(new MouseEvent("mouseup",{view:u,bubbles:!0,cancelable:!0})),n()},onFocus:function(e,t,n){hn("onFocus",{event:e}),!a||ge||ye?t.focus():t.deselect().focus(),n()},onInput:function(e,t,n){hn("onInput");var r=M()(e.target).getSelection(),o=t.findSelection(r);o?t.select(o):t.blur();var i=r.anchorNode;t.reconcileDOMNode(i),n()},onKeyDown:function(e,t,n){hn("onKeyDown",{event:e});var r=t.value,o=r.document,i=r.selection,a=i.start,u=o.hasVoidParent(a.path,t);if(He.isSplitBlock(e)&&!we)return u?t.moveToStartOfNextText():t.splitBlock();if(He.isDeleteBackward(e)&&!we)return t.deleteCharBackward();if(He.isDeleteForward(e)&&!we)return t.deleteCharForward();if(He.isDeleteLineBackward(e))return t.deleteLineBackward();if(He.isDeleteLineForward(e))return t.deleteLineForward();if(He.isDeleteWordBackward(e))return t.deleteWordBackward();if(He.isDeleteWordForward(e))return t.deleteWordForward();if(He.isRedo(e))return t.redo();if(He.isUndo(e))return t.undo();if(He.isMoveLineBackward(e))return e.preventDefault(),t.moveToStartOfBlock();if(He.isMoveLineForward(e))return e.preventDefault(),t.moveToEndOfBlock();if(He.isExtendLineBackward(e))return e.preventDefault(),t.moveFocusToStartOfBlock();if(He.isExtendLineForward(e))return e.preventDefault(),t.moveFocusToEndOfBlock();if(He.isMoveBackward(e))return e.preventDefault(),i.isCollapsed?t.moveBackward():t.moveToStart();if(He.isMoveForward(e))return e.preventDefault(),i.isCollapsed?t.moveForward():t.moveToEnd();if(He.isMoveWordBackward(e))return e.preventDefault(),t.moveWordBackward();if(He.isMoveWordForward(e))return e.preventDefault(),t.moveWordForward();if(He.isExtendBackward(e)){var c=o.getNode(a.path),s=o.texts({path:a.path,direction:"backward"}),l=ct(s,1)[0],f=!1;if(l){var p=ct(l,2)[1];f=o.hasVoidParent(p,t)}if(u||f||""===c.text)return e.preventDefault(),t.moveFocusBackward()}if(He.isExtendForward(e)){var d=o.getNode(a.path),h=o.texts({path:a.path}),m=ct(h,1)[0],v=!1;if(m){var g=ct(m,2)[1];v=o.hasVoidParent(g,t)}if(u||v||""===d.text)return e.preventDefault(),t.moveFocusForward()}n()},onMouseDown:function(e,t,n){hn("onMouseDown",{event:e}),a=!0,n()},onMouseUp:function(e,t,n){hn("onMouseUp",{event:e}),a=!1,n()},onPaste:function(e,t,n){hn("onPaste",{event:e});var r=t.value,o=ln(e),i=o.type,a=o.fragment,u=o.text;if("fragment"===i&&t.insertFragment(a),"text"===i||"html"===i){if(!u)return n();var c=r.document,s=r.selection,l=r.startBlock;if(t.isVoid(l))return n();var f=l,p=c.getInsertMarksAtRange(s),d=Le.deserialize(u,{defaultBlock:f,defaultMarks:p}).document;t.insertFragment(d)}n()},onSelect:function(e,t,n){hn("onSelect",{event:e});var r=M()(e.target).getSelection(),o=t.findSelection(r);o?t.select(o):t.blur(),a=!1,n()}}),f=be?[Kt()]:[];return[].concat(f,[s],st(c),[l])}function gn(e){var t=e.nativeEvent||e;switch(t.type){case"keydown":return t.type+" "+JSON.stringify(t.key);case"input":case"beforeinput":case"textInput":return t.type+":"+t.inputType+" "+JSON.stringify(t.data);default:return t.type}}var yn=A()("slate:events");var bn=2e3,wn=A()("slate:batch-events");var On=A()("slate:mutations"),En=["type","oldValue","target","addedNodes","removedNodes","attributeName","attributeNamespace","nextSibling","previousSibling"];function xn(e){if(e.nodeType===window.Node.TEXT_NODE)return e.textContent;if(e.nodeType===window.Node.ELEMENT_NODE){var t=e.outerHTML,n=e.innerHTML;return null==t?JSON.stringify(e.textContent):t.slice(0,t.indexOf(n))}return"Node(type="+e.nodeType}function kn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.placeholder,n=void 0===t?"":t,r=e.plugins,i=void 0===r?[]:r,a=A.a.enabled("slate:events")?function(){var e={},t=!0,n=!1,r=void 0;try{for(var o,i=$e[Symbol.iterator]();!(t=(o=i.next()).done);t=!0)e[o.value]=function(e,t,n){var r=gn(e);yn(r),n()}}catch(e){n=!0,r=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw r}}return e}():null,u=A.a.enabled("slate:batch-events")?function(){var e=null,t=null,n=[];function r(){wn("\n"+n.join("\n")),n.length=0}function o(o){0===n.length&&(e=new Date);var i=gn(o),a=new Date;n.push("- "+(a-e)+" - "+i),clearTimeout(t),t=setTimeout(r,bn)}var i={},a=!0,u=!1,c=void 0;try{for(var s,l=$e[Symbol.iterator]();!(a=(s=l.next()).done);a=!0)i[s.value]=function(e,t,n){o(e),n()}}catch(e){u=!0,c=e}finally{try{!a&&l.return&&l.return()}finally{if(u)throw c}}return i}():null,c=A.a.enabled("slate:mutations")?function(){var e=new window.MutationObserver(function(e){var t=Array.from(e).map(function(e){var t={};return En.forEach(function(n){var r=e[n];if(null!=r)if(r instanceof window.NodeList){if(0===r.length)return;t[n]=Array.from(r).map(xn).join(", ")}else r instanceof window.Node&&(r=xn(r)),t[n]=r}),t});On.apply(void 0,[t.length+" Mutations"].concat(st(t)))}),t=null;function n(n,r,o){var i=r.findDOMNode([]);if(i===t)return o();On("start"),e.observe(i,{childList:!0,characterData:!0,attributes:!0,subtree:!0,characterDataOldValue:!0}),t=i,o()}return{onComponentDidMount:n,onComponentDidUpdate:n,onComponentWillUnmount:function(n,r,o){On("stop"),e.disconnect(),t=null,o()}}}():null,s={decorateNode:function(){return[]},renderAnnotation:function(e){var t=e.attributes,n=e.children;return o.a.createElement("span",t,n)},renderBlock:function(e){var t=e.attributes,n=e.children;return o.a.createElement("div",it({},t,{style:{position:"relative"}}),n)},renderDecoration:function(e){var t=e.attributes,n=e.children;return o.a.createElement("span",t,n)},renderDocument:function(e){return e.children},renderEditor:function(e){return e.children},renderInline:function(e){var t=e.attributes,n=e.children;return o.a.createElement("span",it({},t,{style:{position:"relative"}}),n)},renderMark:function(e){var t=e.attributes,n=e.children;return o.a.createElement("span",t,n)}},l={commands:{reconcileNode:function(e,t){var n=e.value,r=n.document,o=n.selection,i=r.getPath(t.key),a=e.findDOMNode(i),u=r.getClosestBlock(i),c=t.text,s=a.textContent,l=u.nodes.last()===t,f=s.charAt(s.length-1);if(l&&"\n"===f&&(s=s.slice(0,-1)),c!==s){var p=o.moveAnchorTo(i,0).moveFocusTo(i,c.length);p=r.resolveRange(p),e.insertTextAtRange(p,s,t.marks)}},reconcileDOMNode:function(e,t){var n=t.parentElement.closest("[data-key]"),r=e.findNode(n);e.reconcileNode(r)}}},f=Pt();return[a,u,c,vn({plugins:[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return At.reduce(function(t,n){return n in e&&(t[n]=e[n]),t},{})}(e)].concat(st(i))}),{commands:{restoreDOM:function(e){e.setState({contentKey:e.state.contentKey+1})}}},Ke({placeholder:n,when:function(e,t){return"document"===t.object&&""===t.text&&1===t.nodes.size&&1===Array.from(t.texts()).length}}),s,l,f]}var Sn=A()("slate:editor"),Cn=function(e){function t(){var e,n,r;nt(this,t);for(var i=arguments.length,a=Array(i),u=0;u<i;u++)a[u]=arguments[u];return n=r=ut(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.state={value:r.props.defaultValue,contentKey:0},r.tmp={mounted:!1,change:null,resolves:0,updates:0,contentRef:o.a.createRef()},r.resolveController=Qe(function(){var e=arguments[5];P(r.tmp.resolves<5||r.tmp.resolves!==r.tmp.updates,"A Slate <Editor> component is re-resolving the `plugins`, `schema`, `commands`, `queries` or `placeholder` prop on each update, which leads to poor performance. This is often due to passing in a new references for these props with each render by declaring them inline in your render function. Do not do this! Declare them outside your render function, or memoize them instead."),r.tmp.resolves++;var t=e(it({},r.props,{editor:r,value:r.props.value||r.state.value}));r.controller=new C.e({plugins:[t],onChange:function(e){r.tmp.mounted?r.handleChange(e):r.tmp.change=e}},{controller:r,construct:!1}),r.controller.run("onConstruct")}),ut(r,n)}return at(t,e),rt(t,[{key:"componentDidMount",value:function(){this.tmp.mounted=!0,this.tmp.updates++,this.props.autoFocus&&this.focus(),this.tmp.change&&(this.handleChange(this.tmp.change),this.tmp.change=null)}},{key:"componentDidUpdate",value:function(){this.tmp.updates++,this.tmp.change&&(this.handleChange(this.tmp.change),this.tmp.change=null)}},{key:"componentWillUnmount",value:function(){this.tmp.mounted=!1}},{key:"render",value:function(){var e=this;Sn("render",this);var t=this.props,n=t.commands,r=t.placeholder,i=t.plugins,a=t.queries,u=t.schema;this.resolveController(i,u,n,a,r,kn);var c=this.props,s=c.options,l=c.readOnly,f=c.value,p=this.state.value,d=f||p,h=this.state.contentKey;this.controller.setReadOnly(l),this.controller.setValue(d,s);var m=this.props,v=m.autoCorrect,g=m.className,y=m.id,b=m.role,w=m.spellCheck,O=m.tabIndex,E=m.style,x=m.tagName,k=o.a.createElement(Nt,{ref:this.tmp.contentRef,autoCorrect:v,className:g,contentKey:h,editor:this,id:y,onEvent:function(t,n){return e.run(t,n)},readOnly:l,role:b,spellCheck:w,style:E,tabIndex:O,tagName:x});return this.controller.run("renderEditor",it({},this.props,{editor:this,children:k}))}},{key:"handleChange",value:function(e){var t=this.props.onChange;this.state.value&&this.setState({value:e.value}),t(e)}},{key:"applyOperation",value:function(){var e;return(e=this.controller).applyOperation.apply(e,arguments)}},{key:"command",value:function(){var e;return(e=this.controller).command.apply(e,arguments)}},{key:"hasCommand",value:function(){var e;return(e=this.controller).hasCommand.apply(e,arguments)}},{key:"hasQuery",value:function(){var e;return(e=this.controller).hasQuery.apply(e,arguments)}},{key:"normalize",value:function(){var e;return(e=this.controller).normalize.apply(e,arguments)}},{key:"query",value:function(){var e;return(e=this.controller).query.apply(e,arguments)}},{key:"registerCommand",value:function(){var e;return(e=this.controller).registerCommand.apply(e,arguments)}},{key:"registerQuery",value:function(){var e;return(e=this.controller).registerQuery.apply(e,arguments)}},{key:"run",value:function(){var e;return(e=this.controller).run.apply(e,arguments)}},{key:"withoutNormalizing",value:function(){var e;return(e=this.controller).withoutNormalizing.apply(e,arguments)}},{key:"call",value:function(){var e;return(e=this.controller).call.apply(e,arguments)}},{key:"change",value:function(){var e;return(e=this.controller).change.apply(e,arguments)}},{key:"onChange",value:function(){var e;return(e=this.controller).onChange.apply(e,arguments)}},{key:"applyOperations",value:function(){var e;return(e=this.controller).applyOperations.apply(e,arguments)}},{key:"setOperationFlag",value:function(){var e;return(e=this.controller).setOperationFlag.apply(e,arguments)}},{key:"getFlag",value:function(){var e;return(e=this.controller).getFlag.apply(e,arguments)}},{key:"unsetOperationFlag",value:function(){var e;return(e=this.controller).unsetOperationFlag.apply(e,arguments)}},{key:"withoutNormalization",value:function(){var e;return(e=this.controller).withoutNormalization.apply(e,arguments)}},{key:"operations",get:function(){return this.controller.operations}},{key:"readOnly",get:function(){return this.controller.readOnly}},{key:"value",get:function(){return this.controller.value}},{key:"editor",get:function(){return this.controller.editor}},{key:"schema",get:function(){Object(je.a)(!1,"As of Slate 0.42, the `editor.schema` property no longer exists, and its functionality has been folded into the editor itself. Use the `editor` instead.")}},{key:"stack",get:function(){Object(je.a)(!1,"As of Slate 0.42, the `editor.stack` property no longer exists, and its functionality has been folded into the editor itself. Use the `editor` instead.")}}]),t}(o.a.Component);Cn.propTypes=it({autoCorrect:S.a.bool,autoFocus:S.a.bool,className:S.a.string,defaultValue:_.value,id:S.a.string,onChange:S.a.func,options:S.a.object,placeholder:S.a.any,plugins:S.a.array,readOnly:S.a.bool,role:S.a.string,schema:S.a.object,spellCheck:S.a.bool,style:S.a.object,tabIndex:S.a.number,value:_.value},$e.reduce(function(e,t){return e[t]=S.a.func,e},{})),Cn.defaultProps={autoFocus:!1,autoCorrect:!0,onChange:function(){},options:{},placeholder:"",plugins:[],readOnly:!1,schema:{},spellCheck:!0};var jn=n(803),_n=n(647),In=n.n(_n),Tn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nn=new Ce.Record({object:"string",text:""}),An={deserialize:function(e){if(e.tagName&&"br"===e.tagName.toLowerCase())return{object:"text",text:"\n",marks:[]};if("#text"===e.nodeName){if(e.nodeValue&&e.nodeValue.match(/<!--.*?-->/))return;return{object:"text",text:e.nodeValue,marks:[]}}},serialize:function(e,t){if("string"===e.object)return t.split("\n").reduce(function(e,t,n){return 0!==n&&e.push(o.a.createElement("br",{key:n})),e.push(t),e},[])}};function Pn(e){if("undefined"==typeof DOMParser)throw new Error("The native `DOMParser` global which the `Html` serializer uses by default is not present in this environment. You must supply the `options.parseHtml` function instead.");return(new DOMParser).parseFromString(e,"text/html").body||window.document.createElement("body")}var Dn=function(){var e=this;this.deserialize=function(t){var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).toJSON,r=void 0!==n&&n,o=e.defaultBlock,i=(0,e.parseHtml)(t),a=Array.from(i.childNodes),u=e.deserializeElements(a);0===(u=u.reduce(function(e,t,n,r){if("block"===t.object)return e.push(t),e;if(n>0&&"block"!==r[n-1].object)return e[e.length-1].nodes.push(t),e;var i=Tn({object:"block",data:{}},o,{nodes:[t]});return e.push(i),e},[])).length&&(u=[Tn({object:"block",data:{}},o,{nodes:[{object:"text",text:"",marks:[]}]})]);var c={object:"value",document:{object:"document",data:{},nodes:u}};return r?c:C.n.fromJSON(c)},this.deserializeElements=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=[];return t.filter(e.cruftNewline).forEach(function(t){var r=e.deserializeElement(t);switch(In()(r)){case"array":n=n.concat(r);break;case"object":n.push(r)}}),n},this.deserializeElement=function(t){var n=void 0;t.tagName||(t.tagName="");var r=function(t){switch("[object NodeList]"===Object.prototype.toString.call(t)&&(t=Array.from(t)),In()(t)){case"array":return e.deserializeElements(t);case"object":return e.deserializeElement(t);case"null":case"undefined":return;default:throw new Error('The `next` argument was called with invalid children: "'+t+'".')}},o=!0,i=!1,a=void 0;try{for(var u,c=e.rules[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var s=u.value;if(s.deserialize){var l=s.deserialize(t,r),f=In()(l);if("array"!==f&&"object"!==f&&"null"!==f&&"undefined"!==f)throw new Error('A rule returned an invalid deserialized representation: "'+n+'".');if(void 0!==l){if(null===l)return null;"block"===(n="mark"===l.object?e.deserializeMark(l):l).object||"inline"===n.object?(n.data=n.data||{},n.nodes=n.nodes||[]):"text"===n.object&&(n.marks=n.marks||[],n.text=n.text||"");break}}}}catch(e){i=!0,a=e}finally{try{!o&&c.return&&c.return()}finally{if(i)throw a}}return n||r(t.childNodes)},this.deserializeMark=function(t){var n=t.type,r=t.data;return t.nodes.reduce(function(t,o){var i=function t(o){return"mark"===o.object?e.deserializeMark(o):("text"===o.object?(o.marks=o.marks||[],o.marks.push({type:n,data:r})):o.nodes&&(o.nodes=o.nodes.map(t)),o)}(o);return Array.isArray(i)?t.concat(i):(t.push(i),t)},[])},this.serialize=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.document.nodes.map(e.serializeNode).filter(function(e){return e});return!1===n.render?r:Object(jn.renderToStaticMarkup)(o.a.createElement("body",null,r)).slice(6,-7)},this.serializeNode=function(t){if("text"===t.object){var n=new Nn({text:t.text}),r=e.serializeString(n);return t.marks.reduce(function(t,n){var r=!0,o=!1,i=void 0;try{for(var a,u=e.rules[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=a.value;if(c.serialize){var s=c.serialize(n,t);if(null===s)return;if(s)return Ln(s)}}}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}throw new Error('No serializer defined for mark of type "'+n.type+'".')},r)}var o=t.nodes.map(e.serializeNode),i=!0,a=!1,u=void 0;try{for(var c,s=e.rules[Symbol.iterator]();!(i=(c=s.next()).done);i=!0){var l=c.value;if(l.serialize){var f=l.serialize(t,o);if(null===f)return;if(f)return Ln(f)}}}catch(e){a=!0,u=e}finally{try{!i&&s.return&&s.return()}finally{if(a)throw u}}throw new Error('No serializer defined for node of type "'+t.type+'".')},this.serializeString=function(t){var n=!0,r=!1,o=void 0;try{for(var i,a=e.rules[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var u=i.value;if(u.serialize){var c=u.serialize(t,t.text);if(c)return c}}}catch(e){r=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw o}}},this.cruftNewline=function(e){return!("#text"===e.nodeName&&"\n"===e.nodeValue)}},Mn=0;function Ln(e){return o.a.cloneElement(e,{key:Mn++})}var Rn=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Dn.call(this);var n=t.defaultBlock,r=void 0===n?"paragraph":n,o=t.parseHtml,i=void 0===o?Pn:o,a=t.rules,u=void 0===a?[]:a;r=C.i.createProperties(r),this.rules=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(u),[An]),this.defaultBlock=r,this.parseHtml=i},Fn=(n(919),n(70)),Bn=n.n(Fn),zn=function(e){var t=document.getElementById("wprm-admin-modal-toolbar-container");return t?Bn.a.createPortal(o.a.createElement("div",{className:"wprm-admin-modal-toolbar",onMouseDown:function(e){e.preventDefault()}},e.children),t):null},Un=n(43),qn=function(e){return o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button",onMouseDown:function(t){t.preventDefault(),e.action()}},o.a.createElement(Un.a,{type:e.type,title:e.title}))},Wn=n(438),Hn=function(e){return o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button",onMouseDown:function(t){t.preventDefault(),e.richText.editor.insertText(e.character)}},o.a.createElement(Wn.a,{content:e.title},o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button-character"},e.character)))},Vn=function(e){var t=e.richText.hasInline("code"),n=e.richText.editor;return o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button".concat(t?" wprm-admin-modal-toolbar-button-active":""),onMouseDown:function(e){if(e.preventDefault(),t)n.unwrapInline("code");else{if(!n.value.selection.isExpanded){var r=window.prompt(Object(u.a)("HTML or Shortcode:"));r&&n.insertText(r).moveFocusBackward(r.length)}n.wrapInline({type:"code"}),n.moveToEnd()}}},o.a.createElement(Un.a,{type:"code",title:t?Object(u.a)("Remove HTML or Shortcode"):Object(u.a)("Insert HTML or Shortcode")}))},Gn=function(e){var t=e.richText.hasInline("link"),n=e.richText.editor;return o.a.createElement(r.Fragment,null,t?o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button wprm-admin-modal-toolbar-button-active",onMouseDown:function(e){e.preventDefault(),n.unwrapInline("link")}},o.a.createElement(Un.a,{type:"unlink",title:Object(u.a)("Remove Link")})):o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button",onMouseDown:function(e){e.preventDefault();var t=window.prompt(Object(u.a)("Enter the URL of the link:"));t&&(n.value.selection.isExpanded||n.insertText(t).moveFocusBackward(t.length),n.wrapInline({type:"link",data:{href:t}}),n.moveToEnd())}},o.a.createElement(Un.a,{type:"link",title:t?Object(u.a)("Edit Link"):Object(u.a)("Add Link")})))},Jn=function(e){var t=e.richText.hasMark(e.type);return o.a.createElement("span",{className:"wprm-admin-modal-toolbar-button".concat(t?" wprm-admin-modal-toolbar-button-active":""),onMouseDown:function(t){t.preventDefault(),e.richText.editor.toggleMark(e.type)}},o.a.createElement(Un.a,{type:e.type,title:e.title}))},Zn=function(e){return o.a.createElement("span",{className:"wprm-admin-modal-toolbar-spacer"})},Yn=function(e){return{href:e.data.get("href"),newTab:e.data.get("newTab"),noFollow:e.data.get("noFollow")}},Kn=function(e,t){var n=Yn(t),r=window.prompt(Object(u.a)("Enter the URL of the link:"),n.href);r?(n.href=r,e.setNodeByKey(t.key,{data:n})):""===r&&e.unwrapInline("link")},Xn=function(e,t,n){var r=Yn(t);r[n]=!r[n],e.setNodeByKey(t.key,{data:r})},Qn=function(e){var t=e.richText.editor,n=e.richText.state.value.inlines.find(function(e){return"link"===e.type});if(!n)return null;var r=Yn(n);return o.a.createElement("div",{className:"wprm-admin-modal-toolbar-link"},o.a.createElement(Un.a,{type:"link",onClick:function(){return Kn(t,n)}}),o.a.createElement("span",{className:"wprm-admin-modal-toolbar-link-value",onMouseDown:function(){return Kn(t,n)}},r.href),o.a.createElement(Zn,null),o.a.createElement(Un.a,{type:r.newTab?"checkbox-checked":"checkbox-empty",onClick:function(){return Xn(t,n,"newTab")}}),o.a.createElement("span",{className:"wprm-admin-modal-toolbar-link-value",onMouseDown:function(){return Xn(t,n,"newTab")}},Object(u.a)("Open in new tab")),o.a.createElement(Zn,null),o.a.createElement(Un.a,{type:r.noFollow?"checkbox-checked":"checkbox-empty",onClick:function(){return Xn(t,n,"noFollow")}}),o.a.createElement("span",{className:"wprm-admin-modal-toolbar-link-value",onMouseDown:function(){return Xn(t,n,"noFollow")}},Object(u.a)("Use nofollow")))},$n=n(56),er=wprm_admin.endpoints.modal,tr=!1,nr=!1,rr={getSuggestions:function(e){return tr?(nr=e,new Promise(function(e){return e(!1)})):this.getSuggestionsDebounced(e)},getSuggestionsDebounced:function(e){var t=this;return tr=!0,$n.a.call("".concat(er,"/suggest"),"POST",e).then(function(e){if(nr){var n=nr;return nr=!1,t.getSuggestionsDebounced(n)}return tr=!1,e})}};function or(e){return(or="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 ir(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ar(e,t){return!t||"object"!==or(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ur(e){return(ur=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function cr(e,t){return(cr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var sr=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=ar(this,ur(t).call(this,e)),window.wprm_admin_modal_suggestions=window.wprm_admin_modal_suggestions||{},window.wprm_admin_modal_suggestions.hasOwnProperty(e.type)||(window.wprm_admin_modal_suggestions[e.type]={}),n.state={suggestions:[],loading:!1},n}var n,i,a;return function(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&&cr(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidMount",value:function(){var e=this.props.richText.getHtmlFromValue(this.props.value);this.updateSuggestions(e)}},{key:"componentDidUpdate",value:function(e){var t=this.props.richText.getHtmlFromValue(this.props.value);t!==this.props.richText.getHtmlFromValue(e.value)&&this.updateSuggestions(t)}},{key:"updateSuggestions",value:function(e){var t=this;window.wprm_admin_modal_suggestions[this.props.type].hasOwnProperty(e)?this.setState({suggestions:window.wprm_admin_modal_suggestions[this.props.type][e]}):(this.setState({loading:!0}),rr.getSuggestions({type:this.props.type,search:e}).then(function(n){n&&(window.wprm_admin_modal_suggestions[t.props.type][e]=n.suggestions,t.setState({suggestions:n.suggestions,loading:!1}))}))}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"wprm-admin-modal-toolbar-suggest"},this.state.loading||0!==this.state.suggestions.length?o.a.createElement(r.Fragment,null,o.a.createElement("strong",null,Object(u.a)("Suggestions:")),this.state.loading?o.a.createElement(p.a,null):o.a.createElement(r.Fragment,null,this.state.suggestions.map(function(t,n){return o.a.createElement("span",{className:"wprm-admin-modal-toolbar-suggestion",onMouseDown:function(n){n.preventDefault();var r=e.props.richText.getValueFromHtml(t.name);e.props.richText.onChange({value:r})},key:n},o.a.createElement("span",{className:"wprm-admin-modal-toolbar-suggestion-text"},t.name," (",t.count,")"))}))):o.a.createElement("strong",null,Object(u.a)("No suggestions found.")))}}])&&ir(n.prototype,i),a&&ir(n,a),t}(),lr=function(e){var t={visibility:"hidden"},n=!1,r=!1;switch(e.type){case"no-styling":n=!0;break;case"no-link":r=!0;break;case"equipment":case"ingredient":r=!0}return o.a.createElement(zn,null,e.richText.hasInline("link")&&o.a.createElement(Qn,{richText:e.richText}),("ingredient"===e.type||"equipment"===e.type)&&o.a.createElement(sr,{type:e.type,richText:e.richText,value:e.value}),o.a.createElement("div",{className:"wprm-admin-modal-toolbar-buttons"},o.a.createElement("span",{style:n?t:null},o.a.createElement(Jn,{richText:e.richText,type:"bold",title:Object(u.a)("Bold")}),o.a.createElement(Jn,{richText:e.richText,type:"italic",title:Object(u.a)("Italic")}),o.a.createElement(Jn,{richText:e.richText,type:"underline",title:Object(u.a)("Underline")}),o.a.createElement(Zn,null),o.a.createElement(Jn,{richText:e.richText,type:"subscript",title:Object(u.a)("Subscript")}),o.a.createElement(Jn,{richText:e.richText,type:"superscript",title:Object(u.a)("Superscript")})),o.a.createElement(Zn,null),o.a.createElement("span",{style:r?t:null},o.a.createElement(Gn,{richText:e.richText})),o.a.createElement(Zn,null),o.a.createElement(Vn,{richText:e.richText}),o.a.createElement(qn,{type:"adjustable",title:Object(u.a)("Adjustable Shortcode"),action:function(){e.richText.editor.wrapText("[adjustable]","[/adjustable]"),e.richText.editor.moveToEnd()}}),o.a.createElement(qn,{type:"clock",title:Object(u.a)("Timer Shortcode"),action:function(){e.richText.editor.wrapText("[timer minutes=0]","[/timer]"),e.richText.editor.moveToEnd()}}),o.a.createElement(Zn,null),o.a.createElement(Hn,{richText:e.richText,character:"½"}),o.a.createElement(Hn,{richText:e.richText,character:"⅓"}),o.a.createElement(Hn,{richText:e.richText,character:"⅔"}),o.a.createElement(Hn,{richText:e.richText,character:"¼"}),o.a.createElement(Hn,{richText:e.richText,character:"¾"}),o.a.createElement(Hn,{richText:e.richText,character:"⅕"}),o.a.createElement(Hn,{richText:e.richText,character:"⅙"}),o.a.createElement(Hn,{richText:e.richText,character:"⅐"}),o.a.createElement(Hn,{richText:e.richText,character:"⅛"}),o.a.createElement(Zn,null),o.a.createElement(Hn,{richText:e.richText,character:"°"})))},fr={p:"paragraph"},pr={a:"link","wprm-code":"code"},dr={em:"italic",i:"italic",strong:"bold",b:"bold",u:"underline",sub:"subscript",sup:"superscript"},hr=[{deserialize:function(e,t){var n=fr[e.tagName.toLowerCase()];if(n)return{object:"block",type:n,data:{className:e.getAttribute("class")},nodes:t(e.childNodes)}},serialize:function(e,t){if("block"==e.object)switch(e.type){case"paragraph":return o.a.createElement("p",{className:e.data.get("className")},t)}}},{deserialize:function(e,t){var n=pr[e.tagName.toLowerCase()];if(n)switch(n){case"link":return{object:"inline",type:n,data:{className:e.getAttribute("class"),href:e.getAttribute("href"),newTab:"_blank"===e.getAttribute("target"),noFollow:!(!e.getAttribute("rel")||!e.getAttribute("rel").includes("nofollow"))},nodes:t(e.childNodes)};case"code":return{object:"inline",type:n,data:{},nodes:t([document.createTextNode(e.innerHTML)])}}},serialize:function(e,t){if("inline"==e.object)switch(e.type){case"link":return o.a.createElement("a",{className:e.data.get("className"),href:e.data.get("href"),target:e.data.get("newTab")?"_blank":null,rel:e.data.get("noFollow")?"nofollow":null},t);case"code":return o.a.createElement("wprm-code",null,t)}}},{deserialize:function(e,t){var n=dr[e.tagName.toLowerCase()];if(n)return{object:"mark",type:n,nodes:t(e.childNodes)}},serialize:function(e,t){if("mark"==e.object)switch(e.type){case"bold":return o.a.createElement("strong",null,t);case"italic":return o.a.createElement("em",null,t);case"underline":return o.a.createElement("u",null,t);case"subscript":return o.a.createElement("sub",null,t);case"superscript":return o.a.createElement("sup",null,t)}}}];function mr(e){return(mr="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 vr(){return(vr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function gr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function yr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function br(e){return(br=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function wr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Or(e,t){return(Or=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Er=Object(Re.isKeyHotkey)("enter"),xr=Object(Re.isKeyHotkey)("mod+b"),kr=Object(Re.isKeyHotkey)("mod+i"),Sr=Object(Re.isKeyHotkey)("mod+u"),Cr=new Rn({rules:hr}),jr=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==mr(t)&&"function"!=typeof t?wr(e):t}(this,br(t).call(this,e))).state={value:n.getValueFromHtml(e.value)},e.singleLine?n.schema={document:{nodes:[{match:{type:"paragraph"},min:1,max:1}]}}:n.schema=null,n.getValueFromHtml=n.getValueFromHtml.bind(wr(n)),n.onChange=n.onChange.bind(wr(n)),n.onCopy=n.onCopy.bind(wr(n)),n.onCut=n.onCut.bind(wr(n)),n.onPaste=n.onPaste.bind(wr(n)),n.onKeyDown=n.onKeyDown.bind(wr(n)),n.renderBlock=n.renderBlock.bind(wr(n)),n.renderInline=n.renderInline.bind(wr(n)),n.renderMark=n.renderMark.bind(wr(n)),n.hasMark=n.hasMark.bind(wr(n)),n.hasInline=n.hasInline.bind(wr(n)),n}var n,i,a;return function(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&&Or(e,t)}(t,r["Component"]),n=t,(i=[{key:"getValueFromHtml",value:function(e){return Cr.deserialize(e)}},{key:"getHtmlFromValue",value:function(e){var t=Cr.serialize(e);return this.props.singleLine&&(t=t.replace(/^<p>(.*)<\/p>$/gm,"$1")),t}},{key:"onChange",value:function(e){var t=e.value,n=this.getHtmlFromValue(this.state.value),r=this.getHtmlFromValue(t);n!==r&&this.props.onChange(r),this.setState({value:t})}},{key:"onCopy",value:function(e,t,n){var r=this;nn(e,t,function(){if(e.clipboardData&&e.clipboardData.setData&&!ge){var n=r.getHtmlFromValue(t.value);e.clipboardData.setData("text/html",n)}})}},{key:"onCut",value:function(e,t,n){var r=this;nn(e,t,function(){if(e.clipboardData&&e.clipboardData.setData&&!ge){var n=r.getHtmlFromValue(t.value);e.clipboardData.setData("text/html",n)}var o,i=t.value,a=i.document,u=i.selection,c=u.end;if(u.isCollapsed){var s=!0,l=!1,f=void 0;try{for(var p,d=a.ancestors(c.path)[Symbol.iterator]();!(s=(p=d.next()).done);s=!0){var h=gr(p.value,2),m=h[0],v=h[1];if(t.isVoid(m)){o=v;break}}}catch(e){l=!0,f=e}finally{try{s||null==d.return||d.return()}finally{if(l)throw f}}}o?t.removeNodeByKey(o):t.delete()})}},{key:"onPaste",value:function(e,t,n){var r=ln(e);if("html"!==r.type)return n();var o=Cr.deserialize(r.html).document;t.insertFragment(o)}},{key:"onKeyDown",value:function(e,t,n){if(this.props.onKeyDown&&this.props.onKeyDown(e),this.props.singleLine&&Er(e))e.preventDefault();else{var r;if(xr(e))r="bold";else if(kr(e))r="italic";else{if(!Sr(e))return n();r="underline"}e.preventDefault(),t.toggleMark(r)}}},{key:"render",value:function(){var e=this,t=this.props.toolbar?this.props.toolbar:"all";return o.a.createElement(r.Fragment,null,this.state.value.selection.isFocused&&o.a.createElement(lr,{richText:this,value:this.state.value,type:t}),o.a.createElement(Cn,{spellCheck:!0,className:"wprm-admin-modal-field-richtext".concat(this.props.className?" ".concat(this.props.className):""),value:this.state.value,placeholder:this.props.placeholder,onChange:this.onChange,onPaste:this.onPaste,onCopy:this.onCopy,onCut:this.onCut,renderBlock:this.renderBlock,renderInline:this.renderInline,renderMark:this.renderMark,onKeyDown:this.onKeyDown,tabIndex:0,ref:function(t){return e.editor=t},schema:this.schema}))}},{key:"renderBlock",value:function(e,t,n){switch(e.node.type){case"paragraph":return this.props.singleLine?o.a.createElement("div",{className:"wprm-admin-modal-field-richtext-singleline"},e.children):o.a.createElement("p",vr({},e.attributes,{className:e.node.data.get("className")}),e.children);default:return n()}}},{key:"renderInline",value:function(e,t,n){switch(e.node.type){case"link":return o.a.createElement("a",vr({},e.attributes,{href:e.node.data.get("href"),target:e.node.data.get("newTab")?"_blank":null,rel:e.node.data.get("noFollow")?"nofollow":null}),e.children);case"code":return o.a.createElement("span",{style:{fontFamily:"monospace"}},e.children);default:return n()}}},{key:"renderMark",value:function(e,t,n){var r=e.mark,i=e.attributes;switch(r.type){case"bold":return o.a.createElement("strong",i,e.children);case"italic":return o.a.createElement("em",i,e.children);case"underline":return o.a.createElement("u",i,e.children);case"subscript":return o.a.createElement("sub",i,e.children);case"superscript":return o.a.createElement("sup",i,e.children);default:return n()}}},{key:"hasMark",value:function(e){return this.state.value.activeMarks.some(function(t){return t.type===e})}},{key:"hasInline",value:function(e){return this.state.value.inlines.some(function(t){return t.type===e})}}])&&yr(n.prototype,i),a&&yr(n,a),t}(),_r=function(e){var t=wprm_admin_modal.options.author.find(function(t){return t.value===e.author.display});return o.a.createElement(r.Fragment,null,o.a.createElement(h.a,{id:"type",label:Object(u.a)("Recipe Type"),help:Object(u.a)("Make sure to pick the right recipe type to ensure we include the correct metadata.")},o.a.createElement(x.a,{id:"type",options:[{value:"food",label:Object(u.a)("Food Recipe")},{value:"howto",label:Object(u.a)("How-to Instructions")},{value:"other",label:Object(u.a)("Other (no metadata)")}],value:e.type,onChange:function(t){e.onRecipeChange({type:t})}})),o.a.createElement(h.a,{id:"name",label:Object(u.a)("Name")},o.a.createElement(E.a,{name:"recipe-name",placeholder:Object(u.a)("Recipe Name"),value:e.name,onChange:function(t){e.onRecipeChange({name:t})}})),o.a.createElement(h.a,{id:"summary",label:"howto"===e.type?Object(u.a)("Description"):Object(u.a)("Summary")},o.a.createElement(jr,{placeholder:Object(u.a)("Short description of this recipe..."),value:e.summary,onChange:function(t){e.onRecipeChange({summary:t})}})),t&&"same"===t.actual?null:o.a.createElement(h.a,{id:"author",label:Object(u.a)("Author")},o.a.createElement(O.a,{options:wprm_admin_modal.options.author.filter(function(e){return"same"!==e.actual}),value:e.author.display,onChange:function(t){e.onRecipeChange({author_display:t})},width:300})),t&&"custom"===t.actual&&o.a.createElement(r.Fragment,null,o.a.createElement(h.a,{id:"author-name",label:Object(u.a)("Name")},o.a.createElement(E.a,{name:"author-name",placeholder:Object(u.a)("Author Name"),value:e.author.name,onChange:function(t){e.onRecipeChange({author_name:t})}})),o.a.createElement(h.a,{id:"author-link",label:Object(u.a)("Link")},o.a.createElement(E.a,{name:"author-link",placeholder:"https://bootstrapped.ventures",type:"url",value:e.author.link,onChange:function(t){e.onRecipeChange({author_link:t})}}))),o.a.createElement(h.a,{id:"servings",label:"howto"===e.type?Object(u.a)("Yield"):Object(u.a)("Servings")},o.a.createElement(E.a,{placeholder:"4",type:"number",value:0!=e.servings.amount?e.servings.amount:"",onChange:function(t){e.onRecipeChange({servings:t})}}),o.a.createElement(E.a,{name:"servings-unit",placeholder:"howto"===e.type?Object(u.a)("candles"):Object(u.a)("people"),value:e.servings.unit,onChange:function(t){e.onRecipeChange({servings_unit:t})}})),o.a.createElement(h.a,{id:"cost",label:Object(u.a)("Estimated Cost"),help:"howto"===e.type?Object(u.a)("The estimated cost of the materials consumed when performing instructions. Used in the metadata."):null},o.a.createElement(E.a,{name:"cost",placeholder:"$5",value:e.cost,onChange:function(t){e.onRecipeChange({cost:t})}})))},Ir=(n(920),function(e){var t=parseInt(e.value.time),n=0,r=0,i=0;return t>0&&(n=Math.floor(t/24/60),r=Math.floor(t/60%24),i=Math.floor(t%60)),o.a.createElement("div",{className:"wprm-admin-modal-field-time"},o.a.createElement("div",{className:"wprm-admin-modal-field-time-parts"},o.a.createElement("input",{type:"number",value:0<n?""+n:"",onChange:function(t){var n=parseInt(t.target.value);n=isNaN(n)?0:n;var o=1440*Math.max(0,n)+60*r+i;e.onChange(o)}})," ",Object(u.a)("days"),o.a.createElement("input",{type:"number",value:0<r?""+r:"",onChange:function(t){var r=parseInt(t.target.value);r=isNaN(r)?0:r;var o=1440*n+60*Math.max(0,r)+i;e.onChange(o)}})," ",Object(u.a)("hours"),o.a.createElement("input",{type:"number",value:0<i?""+i:e.value.zero?"0":"",onChange:function(t){var o=parseInt(t.target.value);o=isNaN(o)?0:o;var i=1440*n+60*r+Math.max(0,o);e.onChange(i)}})," ",Object(u.a)("minutes")),0===t&&e.hasOwnProperty("onChangeZero")&&o.a.createElement("div",{className:"wprm-admin-modal-field-time-none"},o.a.createElement("input",{id:"wprm-admin-modal-field-time-none-".concat(e.id),type:"checkbox",checked:e.value.zero,onChange:function(t){e.onChangeZero(t.target.checked)}})," ",o.a.createElement("label",{htmlFor:"wprm-admin-modal-field-time-none-".concat(e.id)},Object(u.a)('Show "0" in template'))))}),Tr=function(e){var t=Math.max(0,parseInt(e.prep.time))+Math.max(0,parseInt(e.cook.time))+Math.max(0,parseInt(e.custom.time));return o.a.createElement(r.Fragment,null,o.a.createElement(h.a,{id:"prep-time",label:Object(u.a)("Prep Time")},o.a.createElement(Ir,{id:"prep",value:e.prep,onChange:function(t){e.onRecipeChange({prep_time:t})},onChangeZero:function(t){e.onRecipeChange({prep_time_zero:t})}})),o.a.createElement(h.a,{id:"cook-time",label:"howto"===e.type?Object(u.a)("Active Time"):Object(u.a)("Cook Time")},o.a.createElement(Ir,{id:"cook",value:e.cook,onChange:function(t){e.onRecipeChange({cook_time:t})},onChangeZero:function(t){e.onRecipeChange({cook_time_zero:t})}})),o.a.createElement(h.a,{id:"custom-time-label",label:Object(u.a)("Custom Time Label"),help:Object(u.a)("Optional extra time field that you can label yourself. Examples: Resting Time, Baking Time")},o.a.createElement(E.a,{name:"custom-time-label",placeholder:Object(u.a)("Resting Time"),value:e.customLabel,onChange:function(t){e.onRecipeChange({custom_time_label:t})}})),o.a.createElement(h.a,{id:"custom-time",label:Object(u.a)("Custom Time")},o.a.createElement(Ir,{id:"custom",value:e.custom,onChange:function(t){e.onRecipeChange({custom_time:t})},onChangeZero:function(t){e.onRecipeChange({custom_time_zero:t})}})),o.a.createElement(h.a,{id:"total-time",label:Object(u.a)("Total Time")},o.a.createElement(Ir,{id:"total",value:e.total,onChange:function(t){e.onRecipeChange({total_time:t})}}),t!==parseInt(e.total.time)&&o.a.createElement("div",null,o.a.createElement("a",{href:"#",onClick:function(n){n.preventDefault(),e.onRecipeChange({total_time:t})}},Object(u.a)("Recalculate Total Time")))))},Nr=n(645);function Ar(e){return(Ar="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 Pr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Mr(e,t){return!t||"object"!==Ar(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Lr(e){return(Lr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Rr(e,t){return(Rr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Fr=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Mr(this,Lr(t).apply(this,arguments))}var n,i,a;return function(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&&Rr(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e){return JSON.stringify(this.props.tags)!==JSON.stringify(e.tags)}},{key:"render",value:function(){var e=this,t=Object.keys(wprm_admin_modal.categories);return o.a.createElement(r.Fragment,null,t.map(function(t,n){var r=wprm_admin_modal.categories[t],i=e.props.tags.hasOwnProperty(t)?e.props.tags[t]:[];return o.a.createElement(h.a,{id:t,label:r.label,help:r.hasOwnProperty("help")?r.help:null,key:n},o.a.createElement(Nr.a,{id:t,value:i,onChange:function(n){var r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Pr(e,t,n[t])})}return e}({},e.props.tags);r[t]=n,e.props.onRecipeChange({tags:r})},width:"450px"}))}))}}])&&Dr(n.prototype,i),a&&Dr(n,a),t}(),Br=(n(921),n(922),function(e){return e.modes?o.a.createElement("div",{className:"wprm-admin-modal-field-edit-mode-container"},e.modes.map(function(t,n){return o.a.createElement("a",{href:"#",className:"wprm-admin-modal-field-edit-mode".concat(t.id===e.mode?" wprm-admin-modal-field-edit-mode-selected":""),onClick:function(n){n.preventDefault(),e.onModeChange(t.id)},key:n},t.label)})):null}),zr=n(641),Ur=n.n(zr);function qr(){return(qr=Ur.a||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Wr(e,t){var n=Object(r.useState)(function(){return{inputs:t,result:e()}})[0],o=Object(r.useRef)(n),i=Boolean(t&&o.current.inputs&&function(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(t,o.current.inputs))?o.current:{inputs:t,result:e()};return Object(r.useEffect)(function(){o.current=i},[i]),i.result}var Hr=Wr,Vr=function(e,t){return Wr(function(){return e},t)},Gr=n(804),Jr=n.n(Gr);function Zr(e,t){e.prototype=Jr()(t.prototype),e.prototype.constructor=e,e.__proto__=t}var Yr=n(773),Kr=function(){return Math.random().toString(36).substring(7).split("").join(".")},Xr={INIT:"@@redux/INIT"+Kr(),REPLACE:"@@redux/REPLACE"+Kr(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Kr()}};function Qr(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function $r(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n($r)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var o=e,i=t,a=[],u=a,c=!1;function s(){u===a&&(u=a.slice())}function l(){if(c)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(c)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var t=!0;return s(),u.push(e),function(){if(t){if(c)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,s();var n=u.indexOf(e);u.splice(n,1)}}}function p(e){if(!Qr(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,i=o(i,e)}finally{c=!1}for(var t=a=u,n=0;n<t.length;n++){(0,t[n])()}return e}return p({type:Xr.INIT}),(r={dispatch:p,subscribe:f,getState:l,replaceReducer:function(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");o=e,p({type:Xr.REPLACE})}})[Yr.a]=function(){var e,t=f;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function n(){e.next&&e.next(l())}return n(),{unsubscribe:t(n)}}})[Yr.a]=function(){return this},e},r}function eo(e,t){return function(){return t(e.apply(this,arguments))}}function to(e,t){if("function"==typeof e)return eo(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(e),r={},o=0;o<n.length;o++){var i=n[o],a=e[i];"function"==typeof a&&(r[i]=eo(a,t))}return r}function no(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ro(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}function oo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},i=t.map(function(e){return e(o)});return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){no(e,t,n[t])})}return e}({},n,{dispatch:r=ro.apply(void 0,i)(n.dispatch)})}}}var io=o.a.createContext(null);var ao=function(e){e()},uo=function(){return ao},co=null,so={notify:function(){}};var lo=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=so,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return Boolean(this.unsubscribe)},t.trySubscribe=function(){var e,t,n;this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=(e=uo(),t=[],n=[],{clear:function(){n=co,t=co},notify:function(){var r=t=n;e(function(){for(var e=0;e<r.length;e++)r[e]()})},get:function(){return n},subscribe:function(e){var r=!0;return n===t&&(n=t.slice()),n.push(e),function(){r&&t!==co&&(r=!1,n===t&&(n=t.slice()),n.splice(n.indexOf(e),1))}}}))},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=so)},e}(),fo=function(e){var t,n;function r(t){var n;n=e.call(this,t)||this;var r=t.store;n.notifySubscribers=n.notifySubscribers.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n));var o=new lo(r);return o.onStateChange=n.notifySubscribers,n.state={store:r,subscription:o},n.previousState=r.getState(),n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.componentDidMount=function(){this._isMounted=!0,this.state.subscription.trySubscribe(),this.previousState!==this.props.store.getState()&&this.state.subscription.notifyNestedSubs()},i.componentWillUnmount=function(){this.unsubscribe&&this.unsubscribe(),this.state.subscription.tryUnsubscribe(),this._isMounted=!1},i.componentDidUpdate=function(e){if(this.props.store!==e.store){this.state.subscription.tryUnsubscribe();var t=new lo(this.props.store);t.onStateChange=this.notifySubscribers,this.setState({store:this.props.store,subscription:t})}},i.notifySubscribers=function(){this.state.subscription.notifyNestedSubs()},i.render=function(){var e=this.props.context||io;return o.a.createElement(e.Provider,{value:this.state},this.props.children)},r}(r.Component);fo.propTypes={store:S.a.shape({subscribe:S.a.func.isRequired,dispatch:S.a.func.isRequired,getState:S.a.func.isRequired}),context:S.a.object,children:S.a.any};var po=fo;function ho(){return(ho=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function mo(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var vo=n(508),go=n.n(vo),yo=n(629),bo=n.n(yo),wo=n(805),Oo=[],Eo=[null,null];function xo(e,t){var n=e[1];return[t.payload,n+1]}var ko=function(){return[null,0]},So="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;function Co(e,t){void 0===t&&(t={});var n=t,i=n.getDisplayName,a=void 0===i?function(e){return"ConnectAdvanced("+e+")"}:i,u=n.methodName,c=void 0===u?"connectAdvanced":u,s=n.renderCountProp,l=void 0===s?void 0:s,f=n.shouldHandleStateChanges,p=void 0===f||f,d=n.storeKey,h=void 0===d?"store":d,m=n.withRef,v=void 0!==m&&m,g=n.forwardRef,y=void 0!==g&&g,b=n.context,w=void 0===b?io:b,O=mo(n,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"]);bo()(void 0===l,"renderCountProp is removed. render counting is built into the latest React Dev Tools profiling extension"),bo()(!v,"withRef is removed. To access the wrapped instance, use a ref on the connected component");bo()("store"===h,"storeKey has been removed and does not do anything. To use a custom Redux store for specific components, create a custom React context with React.createContext(), and pass the context object to React Redux's Provider and specific components like: <Provider context={MyContext}><ConnectedComponent context={MyContext} /></Provider>. You may also pass a {context : MyContext} option to connect");var E=w;return function(t){var n=t.displayName||t.name||"Component",i=a(n),u=ho({},O,{getDisplayName:a,methodName:c,renderCountProp:l,shouldHandleStateChanges:p,storeKey:h,displayName:i,wrappedComponentName:n,WrappedComponent:t}),s=O.pure;var f=s?r.useMemo:function(e){return e()};function d(n){var a=Object(r.useMemo)(function(){return[n.context,n.forwardedRef,mo(n,["context","forwardedRef"])]},[n]),c=a[0],s=a[1],l=a[2],d=Object(r.useMemo)(function(){return c&&c.Consumer&&Object(wo.isContextConsumer)(o.a.createElement(c.Consumer,null))?c:E},[c,E]),h=Object(r.useContext)(d),m=Boolean(n.store),v=Boolean(h)&&Boolean(h.store);bo()(m||v,'Could not find "store" in the context of "'+i+'". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to '+i+" in connect options.");var g=n.store||h.store,y=Object(r.useMemo)(function(){return function(t){return e(t.dispatch,u)}(g)},[g]),b=Object(r.useMemo)(function(){if(!p)return Eo;var e=new lo(g,m?null:h.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]},[g,m,h]),w=b[0],O=b[1],x=Object(r.useMemo)(function(){return m?h:ho({},h,{subscription:w})},[m,h,w]),k=Object(r.useReducer)(xo,Oo,ko),S=k[0][0],C=k[1];if(S&&S.error)throw S.error;var j=Object(r.useRef)(),_=Object(r.useRef)(l),I=Object(r.useRef)(),T=Object(r.useRef)(!1),N=f(function(){return I.current&&l===_.current?I.current:y(g.getState(),l)},[g,S,l]);So(function(){_.current=l,j.current=N,T.current=!1,I.current&&(I.current=null,O())}),So(function(){if(p){var e=!1,t=null,n=function(){if(!e){var n,r,o=g.getState();try{n=y(o,_.current)}catch(e){r=e,t=e}r||(t=null),n===j.current?T.current||O():(j.current=n,I.current=n,T.current=!0,C({type:"STORE_UPDATED",payload:{latestStoreState:o,error:r}}))}};w.onStateChange=n,w.trySubscribe(),n();return function(){if(e=!0,w.tryUnsubscribe(),t)throw t}}},[g,w,y]);var A=Object(r.useMemo)(function(){return o.a.createElement(t,ho({},N,{ref:s}))},[s,t,N]);return Object(r.useMemo)(function(){return p?o.a.createElement(d.Provider,{value:x},A):A},[d,A,x])}var m=s?o.a.memo(d):d;if(m.WrappedComponent=t,m.displayName=i,y){var v=o.a.forwardRef(function(e,t){return o.a.createElement(m,ho({},e,{forwardedRef:t}))});return v.displayName=i,v.WrappedComponent=t,go()(v,t)}return go()(m,t)}}var jo=Object.prototype.hasOwnProperty;function _o(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function Io(e,t){if(_o(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=0;o<n.length;o++)if(!jo.call(t,n[o])||!_o(e[n[o]],t[n[o]]))return!1;return!0}function To(e){return function(t,n){var r=e(t,n);function o(){return r}return o.dependsOnOwnProps=!1,o}}function No(e){return null!==e.dependsOnOwnProps&&void 0!==e.dependsOnOwnProps?Boolean(e.dependsOnOwnProps):1!==e.length}function Ao(e,t){return function(t,n){n.displayName;var r=function(e,t){return r.dependsOnOwnProps?r.mapToProps(e,t):r.mapToProps(e)};return r.dependsOnOwnProps=!0,r.mapToProps=function(t,n){r.mapToProps=e,r.dependsOnOwnProps=No(e);var o=r(t,n);return"function"==typeof o&&(r.mapToProps=o,r.dependsOnOwnProps=No(o),o=r(t,n)),o},r}}var Po=[function(e){return"function"==typeof e?Ao(e):void 0},function(e){return e?void 0:To(function(e){return{dispatch:e}})},function(e){return e&&"object"==typeof e?To(function(t){return to(e,t)}):void 0}];var Do=[function(e){return"function"==typeof e?Ao(e):void 0},function(e){return e?void 0:To(function(){return{}})}];function Mo(e,t,n){return ho({},n,e,t)}var Lo=[function(e){return"function"==typeof e?function(e){return function(t,n){n.displayName;var r,o=n.pure,i=n.areMergedPropsEqual,a=!1;return function(t,n,u){var c=e(t,n,u);return a?o&&i(c,r)||(r=c):(a=!0,r=c),r}}}(e):void 0},function(e){return e?void 0:function(){return Mo}}];function Ro(e,t,n,r){return function(o,i){return n(e(o,i),t(r,i),i)}}function Fo(e,t,n,r,o){var i,a,u,c,s,l=o.areStatesEqual,f=o.areOwnPropsEqual,p=o.areStatePropsEqual,d=!1;function h(o,d){var h,m,v=!f(d,a),g=!l(o,i);return i=o,a=d,v&&g?(u=e(i,a),t.dependsOnOwnProps&&(c=t(r,a)),s=n(u,c,a)):v?(e.dependsOnOwnProps&&(u=e(i,a)),t.dependsOnOwnProps&&(c=t(r,a)),s=n(u,c,a)):g?(h=e(i,a),m=!p(h,u),u=h,m&&(s=n(u,c,a)),s):s}return function(o,l){return d?h(o,l):(u=e(i=o,a=l),c=t(r,a),s=n(u,c,a),d=!0,s)}}function Bo(e,t){var n=t.initMapStateToProps,r=t.initMapDispatchToProps,o=t.initMergeProps,i=mo(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),a=n(e,i),u=r(e,i),c=o(e,i);return(i.pure?Fo:Ro)(a,u,c,e,i)}function zo(e,t,n){for(var r=t.length-1;r>=0;r--){var o=t[r](e);if(o)return o}return function(t,r){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function Uo(e,t){return e===t}var qo,Wo,Ho,Vo,Go,Jo,Zo,Yo,Ko,Xo,Qo,$o,ei,ti=(Ho=(Wo=void 0===qo?{}:qo).connectHOC,Vo=void 0===Ho?Co:Ho,Go=Wo.mapStateToPropsFactories,Jo=void 0===Go?Do:Go,Zo=Wo.mapDispatchToPropsFactories,Yo=void 0===Zo?Po:Zo,Ko=Wo.mergePropsFactories,Xo=void 0===Ko?Lo:Ko,Qo=Wo.selectorFactory,$o=void 0===Qo?Bo:Qo,function(e,t,n,r){void 0===r&&(r={});var o=r,i=o.pure,a=void 0===i||i,u=o.areStatesEqual,c=void 0===u?Uo:u,s=o.areOwnPropsEqual,l=void 0===s?Io:s,f=o.areStatePropsEqual,p=void 0===f?Io:f,d=o.areMergedPropsEqual,h=void 0===d?Io:d,m=mo(o,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),v=zo(e,Jo,"mapStateToProps"),g=zo(t,Yo,"mapDispatchToProps"),y=zo(n,Xo,"mergeProps");return Vo($o,ho({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:v,initMapDispatchToProps:g,initMergeProps:y,pure:a,areStatesEqual:c,areOwnPropsEqual:l,areStatePropsEqual:p,areMergedPropsEqual:h},m))});ei=Fn.unstable_batchedUpdates,ao=ei;var ni=function(e){var t=e.top,n=e.right,r=e.bottom,o=e.left;return{top:t,right:n,bottom:r,left:o,width:n-o,height:r-t,x:o,y:t,center:{x:(n+o)/2,y:(r+t)/2}}},ri=function(e,t){return{top:e.top-t.top,left:e.left-t.left,bottom:e.bottom+t.bottom,right:e.right+t.right}},oi=function(e,t){return{top:e.top+t.top,left:e.left+t.left,bottom:e.bottom-t.bottom,right:e.right-t.right}},ii={top:0,right:0,bottom:0,left:0},ai=function(e){var t=e.borderBox,n=e.margin,r=void 0===n?ii:n,o=e.border,i=void 0===o?ii:o,a=e.padding,u=void 0===a?ii:a,c=ni(ri(t,r)),s=ni(oi(t,i)),l=ni(oi(s,u));return{marginBox:c,borderBox:ni(t),paddingBox:s,contentBox:l,margin:r,border:i,padding:u}},ui=function(e){var t=e.slice(0,-2);if("px"!==e.slice(-2))return 0;var n=Number(t);return isNaN(n)&&Object(je.a)(!1),n},ci=function(e,t){var n,r,o=e.borderBox,i=e.border,a=e.margin,u=e.padding,c=(r=t,{top:(n=o).top+r.y,left:n.left+r.x,bottom:n.bottom+r.y,right:n.right+r.x});return ai({borderBox:c,border:i,margin:a,padding:u})},si=function(e,t){return void 0===t&&(t={x:window.pageXOffset,y:window.pageYOffset}),ci(e,t)},li=function(e,t){var n={top:ui(t.marginTop),right:ui(t.marginRight),bottom:ui(t.marginBottom),left:ui(t.marginLeft)},r={top:ui(t.paddingTop),right:ui(t.paddingRight),bottom:ui(t.paddingBottom),left:ui(t.paddingLeft)},o={top:ui(t.borderTopWidth),right:ui(t.borderRightWidth),bottom:ui(t.borderBottomWidth),left:ui(t.borderLeftWidth)};return ai({borderBox:e,margin:n,padding:r,border:o})},fi=function(e){var t=e.getBoundingClientRect(),n=window.getComputedStyle(e);return li(t,n)};function pi(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var di=function(e,t){var n;void 0===t&&(t=pi);var r,o=[],i=!1;return function(){for(var a=arguments.length,u=new Array(a),c=0;c<a;c++)u[c]=arguments[c];return i&&n===this&&t(u,o)?r:(r=e.apply(this,u),i=!0,n=this,o=u,r)}},hi=n(807),mi=n.n(hi),vi=n(648),gi=n.n(vi),yi=n(774),bi=n.n(yi),wi=function(e){var t=[],n=null,r=function(){for(var r=arguments.length,o=Array(r),i=0;i<r;i++)o[i]=arguments[i];t=o,n||(n=requestAnimationFrame(function(){n=null,e.apply(void 0,t)}))};return r.cancel=function(){n&&(cancelAnimationFrame(n),n=null)},r};n(808);function Oi(e){return-1!==e.message.indexOf("Invariant failed")}var Ei=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).onError=void 0,t.setOnError=function(e){t.onError=e},t.onFatalError=function(e){t.onError&&t.onError(),Oi(e)&&t.setState({})},t}Zr(t,e);var n=t.prototype;return n.componentDidMount=function(){window.addEventListener("error",this.onFatalError)},n.componentWillUnmount=function(){window.removeEventListener("error",this.onFatalError)},n.componentDidCatch=function(e){if(this.onFatalError(e),!Oi(e))throw e},n.render=function(){return this.props.children(this.setOnError)},t}(o.a.Component),xi={x:0,y:0},ki=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},Si=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},Ci=function(e,t){return e.x===t.x&&e.y===t.y},ji=function(e){return{x:0!==e.x?-e.x:0,y:0!==e.y?-e.y:0}},_i=function(e,t,n){var r;return void 0===n&&(n=0),(r={})[e]=t,r["x"===e?"y":"x"]=n,r},Ii=function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},Ti=function(e,t){return Math.min.apply(Math,t.map(function(t){return Ii(e,t)}))},Ni=function(e){return function(t){return{x:e(t.x),y:e(t.y)}}},Ai=function(e,t){return{top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}},Pi=function(e){return[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}]},Di=function(e,t){return t&&t.shouldClipSubject?function(e,t){var n=ni({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n}(t.pageMarginBox,e):ni(e)},Mi=function(e){var t=e.page,n=e.withPlaceholder,r=e.axis,o=e.frame,i=function(e,t,n){var r;return n&&n.increasedBy?qr({},e,((r={})[t.end]=e[t.end]+n.increasedBy[t.line],r)):e}(function(e,t){return t?Ai(e,t.scroll.diff.displacement):e}(t.marginBox,o),r,n);return{page:t,withPlaceholder:n,active:Di(i,o)}},Li=function(e,t){e.frame||Object(je.a)(!1);var n=e.frame,r=Si(t,n.scroll.initial),o=ji(r),i=qr({},n,{scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:o},max:n.scroll.max}});return qr({},e,{frame:i,subject:Mi({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i})})},Ri=function(e){},Fi=function(e){},Bi=function(e){var t=e.merge,n=e.destination;return n?n.droppableId:t?t.combine.droppableId:null};function zi(e){return mi()(e)}function Ui(e,t){if(e.findIndex)return e.findIndex(t);for(var n=0;n<e.length;n++)if(t(e[n]))return n;return-1}function qi(e,t){if(e.find)return e.find(t);var n=Ui(e,t);return-1!==n?e[n]:void 0}var Wi=di(function(e){return e.reduce(function(e,t){return e[t.descriptor.id]=t,e},{})}),Hi=di(function(e){return e.reduce(function(e,t){return e[t.descriptor.id]=t,e},{})}),Vi=di(function(e){return zi(e)}),Gi=di(function(e){return zi(e)}),Ji=function(e,t){return function(n){return e<=n&&n<=t}},Zi=function(e){var t=Ji(e.top,e.bottom),n=Ji(e.left,e.right);return function(e){return t(e.y)&&t(e.y)&&n(e.x)&&n(e.x)}},Yi=di(function(e,t){return Gi(t).filter(function(t){return e===t.descriptor.droppableId}).sort(function(e,t){return e.descriptor.index-t.descriptor.index})}),Ki={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},Xi={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},Qi=function(e,t){return e===Ki?"down"===t.vertical:"right"===t.horizontal},$i=function(e,t){return Boolean(t.wasDisplaced[e])},ea=function(e){var t=e.displaced,n=e.onLift,r=e.combineWith,o=e.displacedBy,i=Boolean(t[r]);return $i(r,n)?i?xi:ji(o.point):i?o.point:xi},ta=function(e,t,n){return n?e!==n.combine.draggableId?t:n.whenEntered:t},na=function(e){var t=e.pageBorderBoxCenterWithDroppableScrollChange,n=e.previousImpact,r=e.destination,o=e.insideDestinationWithoutDraggable,i=e.userDirection,a=e.onLift;if(!r.isCombineEnabled)return null;var u=r.axis,c=n.movement.map,s=n.movement.displacedBy,l=n.merge,f=qi(o,function(e){var n=e.descriptor.id,r=ea({displaced:c,onLift:a,combineWith:n,displacedBy:s});return function(e){var t=e.id,n=e.currentCenter,r=e.axis,o=e.borderBox,i=e.displaceBy,a=e.currentUserDirection,u=e.oldMerge,c=o[r.start]+i[r.line],s=o[r.end]+i[r.line],l=.666*o[r.size],f=ta(t,a,u),p=Qi(r,f),d=n[r.line];return p?Ji(c,c+l)(d):Ji(s-l,s)(d)}({id:n,currentCenter:t,axis:u,borderBox:e.page.borderBox,displaceBy:r,currentUserDirection:i,oldMerge:l})});return f?qr({},n,{destination:null,merge:{whenEntered:ta(f.descriptor.id,i,l),combine:{draggableId:f.descriptor.id,droppableId:r.descriptor.id}}}):null},ra=function(e){var t=Ji(e.top,e.bottom),n=Ji(e.left,e.right);return function(r){if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;var o=t(r.top)||t(r.bottom),i=n(r.left)||n(r.right);if(o&&i)return!0;var a=r.top<e.top&&r.bottom>e.bottom,u=r.left<e.left&&r.right>e.right;return!(!a||!u)||(a&&i||u&&o)}},oa=function(e){var t=Ji(e.top,e.bottom),n=Ji(e.left,e.right);return function(e){return t(e.top)&&t(e.bottom)&&n(e.left)&&n(e.right)}},ia=function(e){var t=e.target,n=e.destination,r=e.viewport,o=e.withDroppableDisplacement,i=e.isVisibleThroughFrameFn,a=o?function(e,t){var n=t.frame?t.frame.scroll.diff.displacement:xi;return Ai(e,n)}(t,n):t;return function(e,t,n){return!!t.subject.active&&n(t.subject.active)(e)}(a,n,i)&&function(e,t,n){return n(t)(e)}(a,r,i)},aa=function(e){return ia(qr({},e,{isVisibleThroughFrameFn:ra}))},ua=function(e){return ia(qr({},e,{isVisibleThroughFrameFn:oa}))},ca=function(e){var t=e.draggable,n=e.destination,r=e.previousImpact,o=e.viewport,i=e.onLift,a=e.forceShouldAnimate,u=t.descriptor.id,c=r.movement.map,s=function(e,t){var n=e.page.marginBox;if(!$i(e.descriptor.id,t))return n;var r={top:t.displacedBy.point.y,right:t.displacedBy.point.x,bottom:0,left:0};return ni(ri(n,r))}(t,i),l=aa({target:s,destination:n,viewport:o,withDroppableDisplacement:!0});return{draggableId:u,isVisible:l,shouldAnimate:function(e,t,n){return"boolean"==typeof e?e:!!t&&(!n||n.shouldAnimate)}(a,l,c[u])}},sa=di(function(e){return e.reduce(function(e,t){return e[t.draggableId]=t,e},{})}),la=di(function(e,t){var n=t[e.line];return{value:n,point:_i(e.line,n)}}),fa={displaced:[],map:{},displacedBy:{point:xi,value:0}},pa={movement:fa,destination:null,merge:null},da=di(function(e,t){return t.filter(function(t){return t.descriptor.id!==e.descriptor.id})}),ha=function(e){var t=e.pageBorderBoxCenter,n=e.draggable,r=e.draggables,o=e.droppables,i=e.previousImpact,a=e.viewport,u=e.userDirection,c=e.onLift,s=function(e){var t=e.target,n=e.droppables,r=qi(Vi(n),function(e){if(!e.isEnabled)return!1;var n=e.subject.active;return!!n&&Zi(n)(t)});return r?r.descriptor.id:null}({target:t,droppables:o});if(!s)return pa;var l,f,p=o[s],d=Yi(p.descriptor.id,r),h=da(n,d),m=(l=t,(f=p.frame)?ki(l,f.scroll.diff.value):l),v=na({pageBorderBoxCenterWithDroppableScrollChange:m,previousImpact:i,destination:p,insideDestinationWithoutDraggable:h,userDirection:u,onLift:c});return v||function(e){var t=e.pageBorderBoxCenterWithDroppableScrollChange,n=e.draggable,r=e.destination,o=e.insideDestinationWithoutDraggable,i=e.previousImpact,a=e.viewport,u=e.userDirection,c=e.onLift,s=r.axis,l=Qi(r.axis,u),f=la(r.axis,n.displaceBy),p=t[s.line],d=f.value,h=o.filter(function(e){var t=e.page.borderBox,n=t[s.start],r=t[s.end],o=$i(e.descriptor.id,c);return l?o?p<n:p<n+d:o?p<=r-d:p<=r}).map(function(e){return ca({draggable:e,destination:r,previousImpact:i,viewport:a.frame,onLift:c})}),m=o.length-h.length;return{movement:{displacedBy:f,displaced:h,map:sa(h)},destination:{droppableId:r.descriptor.id,index:m},merge:null}}({pageBorderBoxCenterWithDroppableScrollChange:m,destination:p,draggable:n,insideDestinationWithoutDraggable:h,previousImpact:i,viewport:a,userDirection:u,onLift:c})},ma=function(e){var t,n=e.draggable,r=e.home,o=e.draggables,i=e.viewport,a=la(r.axis,n.displaceBy),u=Yi(r.descriptor.id,o).slice(n.descriptor.index+1),c={displacedBy:a,wasDisplaced:u.reduce(function(e,t){return e[t.descriptor.id]=!0,e},{})},s=u.map(function(e){return ca({draggable:e,destination:r,previousImpact:pa,viewport:i.frame,forceShouldAnimate:!1,onLift:c})});return{impact:{movement:{displaced:s,map:sa(s),displacedBy:a},destination:(t=n.descriptor,{index:t.index,droppableId:t.droppableId}),merge:null},onLift:c}},va=function(e){var t=e.draggable,n=e.offset,r=e.initialWindowScroll,o=ci(t.client,n),i=si(o,r);return qr({},t,{placeholder:qr({},t.placeholder,{client:o}),client:o,page:i})},ga=function(e){var t=e.updatedDroppables,n=e.criticalId,r=e.existing,o=e.additions,i=e.removals,a=e.viewport,u=function(e){var t=e.existing,n=e.droppables,r=e.additions,o=e.removals,i=e.viewport,a={};return Vi(n).forEach(function(e){var n=e.axis,u=Yi(e.descriptor.id,t),c={},s=function(e,t){var n=c[e];c[e]=n?{indexChange:n.indexChange+t.indexChange,offset:ki(n.offset,t.offset)}:t},l=Hi(o.map(function(e){var n=t[e];return n||Object(je.a)(!1),n}).filter(function(t){return t.descriptor.droppableId===e.descriptor.id})),f=u.filter(function(e,t){if(!Boolean(l[e.descriptor.id]))return!0;var r=ji(_i(n.line,e.displaceBy[n.line]));return u.slice(t).forEach(function(e){l[e.descriptor.id]||s(e.descriptor.id,{indexChange:-1,offset:r})}),!1}),p=r.filter(function(t){return t.descriptor.droppableId===e.descriptor.id}),d=f.slice(0);p.forEach(function(e){d.splice(e.descriptor.index,0,e)});var h=Hi(p);d.forEach(function(e,t){if(Boolean(h[e.descriptor.id])){var r=_i(n.line,e.client.marginBox[n.size]);d.slice(t).forEach(function(e){h[e.descriptor.id]||s(e.descriptor.id,{indexChange:1,offset:r})})}}),d.forEach(function(e){if(!h[e.descriptor.id]){var t=c[e.descriptor.id];if(t){var n=va({draggable:e,offset:t.offset,initialWindowScroll:i.scroll.initial}),r=e.descriptor.index+t.indexChange,o=qr({},n,{descriptor:qr({},e.descriptor,{index:r})});a[n.descriptor.id]=o}}})}),qr({},t,a)}({droppables:t,existing:r,additions:o,removals:i,viewport:a}),c=u[n],s=t[c.descriptor.droppableId],l=function(e){var t=e.additions,n=e.dragging,r=e.home,o=e.viewport,i=la(r.axis,n.displaceBy);return t.map(function(e){return e.descriptor.droppableId!==r.descriptor.id?e:e.descriptor.index<n.descriptor.index?e:va({draggable:e,offset:i.point,initialWindowScroll:o.scroll.initial})})}({additions:function(e){var t=e.additions,n=e.updatedDroppables,r=e.viewport,o=r.scroll.diff.value;return t.map(function(e){var t=e.descriptor.droppableId,i=n[t].frame;i||Object(je.a)(!1);var a=i.scroll.diff.value,u=ki(o,a);return va({draggable:e,offset:u,initialWindowScroll:r.scroll.initial})})}({additions:o,updatedDroppables:t,viewport:a}),dragging:c,home:s,viewport:a}),f=qr({},u,Hi(l));return i.forEach(function(e){delete f[e]}),f},ya=function(e){var t=e.scrollHeight,n=e.scrollWidth,r=e.height,o=e.width,i=Si({x:n,y:t},{x:o,y:r});return{x:Math.max(0,i.x),y:Math.max(0,i.y)}},ba=function(e){var t=e.descriptor,n=e.isEnabled,r=e.isCombineEnabled,o=e.isFixedOnPage,i=e.direction,a=e.client,u=e.page,c=e.closest,s=function(){if(!c)return null;var e=c.scrollSize,t=c.client,n=ya({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,height:t.paddingBox.height,width:t.paddingBox.width});return{pageMarginBox:c.page.marginBox,frameClient:t,scrollSize:e,shouldClipSubject:c.shouldClipSubject,scroll:{initial:c.scroll,current:c.scroll,max:n,diff:{value:xi,displacement:xi}}}}(),l="vertical"===i?Ki:Xi;return{descriptor:t,isCombineEnabled:r,isFixedOnPage:o,axis:l,isEnabled:n,client:a,page:u,frame:s,subject:Mi({page:u,withPlaceholder:null,axis:l,frame:s})}},wa=function(e,t){return e.descriptor.droppableId===t.descriptor.id},Oa=function(e,t){return qr({},e,{scroll:qr({},e.scroll,{max:t})})},Ea=function(e,t,n){var r=e.frame;wa(t,e)&&Object(je.a)(!1),e.subject.withPlaceholder&&Object(je.a)(!1);var o=la(e.axis,t.displaceBy).point,i=function(e,t,n){var r=e.axis,o=e.subject.page.contentBox[r.size],i=Yi(e.descriptor.id,n).reduce(function(e,t){return e+t.client.marginBox[r.size]},0)+t[r.line]-o;return i<=0?null:_i(r.line,i)}(e,o,n),a={placeholderSize:o,increasedBy:i,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!r)return qr({},e,{subject:Mi({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:e.frame})});var u=i?ki(r.scroll.max,i):r.scroll.max,c=Oa(r,u);return qr({},e,{subject:Mi({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:c}),frame:c})},xa=function(e){var t=e.subject.withPlaceholder;t||Object(je.a)(!1);var n=e.frame;if(!n)return qr({},e,{subject:Mi({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null})});var r=t.oldFrameMaxScroll;r||Object(je.a)(!1);var o=Oa(n,r);return qr({},e,{subject:Mi({page:e.subject.page,axis:e.axis,frame:o,withPlaceholder:null}),frame:o})},ka=function(e){var t=e.frame;return t||Object(je.a)(!1),t},Sa=function(e,t){var n;return qr({},e,((n={})[t.descriptor.id]=t,n))},Ca=function(e){var t=e.draggable,n=e.draggables,r=e.droppables,o=e.previousImpact,i=e.impact,a=function(e){var t=e.previousImpact,n=e.impact,r=e.droppables,o=Bi(t),i=Bi(n);if(!o)return r;if(o===i)return r;var a=r[o];if(!a.subject.withPlaceholder)return r;var u=xa(a);return Sa(r,u)}({previousImpact:o,impact:i,droppables:r}),u=Bi(i);if(!u)return a;var c=r[u];if(wa(t,c))return a;if(c.subject.withPlaceholder)return a;var s=Ea(c,t,n);return Sa(a,s)},ja=function(e){var t,n,r=e.state,o=e.published;Ri("Processing dynamic changes");var i=function(e){var t=e.modified,n=e.existing,r=e.viewport;if(!t.length)return n;var o=t.map(function(e){var t=n[e.descriptor.id];t||Object(je.a)(!1);var o,i,a=Boolean(t.subject.withPlaceholder)?xa(t):t,u=a.client,c=e.client,s=ka(a),l=ka(e),f=ai({borderBox:(a.axis,o=u.borderBox,i=c.borderBox,{top:o.top,left:o.left,right:o.left+i.width,bottom:o.top+i.height}),margin:u.margin,border:u.border,padding:u.padding}),p={client:s.frameClient,page:si(s.frameClient,r.scroll.initial),shouldClipSubject:s.shouldClipSubject,scrollSize:l.scrollSize,scroll:s.scroll.initial},d=ba({descriptor:e.descriptor,isEnabled:e.isEnabled,isCombineEnabled:e.isCombineEnabled,isFixedOnPage:e.isFixedOnPage,direction:e.axis.direction,client:f,page:si(f,r.scroll.initial),closest:p});return Li(d,l.scroll.current)});return qr({},n,Wi(o))}({modified:o.modified,existing:r.dimensions.droppables,viewport:r.viewport}),a=ga({updatedDroppables:i,criticalId:r.critical.draggable.id,existing:r.dimensions.draggables,additions:o.additions,removals:o.removals,viewport:r.viewport}),u={draggable:a[r.critical.draggable.id].descriptor,droppable:i[r.critical.droppable.id].descriptor},c=r.dimensions.draggables[u.draggable.id],s=a[u.draggable.id],l={draggables:a,droppables:Ca({draggable:s,draggables:a,droppables:i,previousImpact:r.impact,impact:r.impact})},f=function(e){var t,n=e.initial,r=e.current,o=e.oldClientBorderBoxCenter,i=e.newClientBorderBoxCenter,a=e.viewport,u=Si(i,o),c={client:t={selection:ki(n.client.selection,u),borderBoxCenter:i,offset:xi},page:{selection:ki(t.selection,a.scroll.initial),borderBoxCenter:ki(t.selection,a.scroll.initial)}};return{current:function(){var e=ji(u),t=ki(r.client.offset,e),n={selection:ki(c.client.selection,t),borderBoxCenter:ki(c.client.borderBoxCenter,t),offset:t},o={selection:ki(n.selection,a.scroll.current),borderBoxCenter:ki(n.borderBoxCenter,a.scroll.current)};return Ci(r.client.borderBoxCenter,n.borderBoxCenter)||Object(je.a)(!1),{client:n,page:o}}(),initial:c}}({initial:r.initial,current:r.current,oldClientBorderBoxCenter:c.client.borderBox.center,newClientBorderBoxCenter:s.client.borderBox.center,viewport:r.viewport}),p=f.initial,d=f.current,h=ma({draggable:s,home:l.droppables[u.droppable.id],draggables:l.draggables,viewport:r.viewport}),m=h.impact,v=h.onLift,g=function(e){var t=e.movement.displaced;if(!t.length)return e;var n=t.map(function(e){return e.isVisible&&e.shouldAnimate?qr({},e,{shouldAnimate:!1}):e});return qr({},e,{movement:qr({},e.movement,{displaced:n,map:sa(n)})})}(ha({pageBorderBoxCenter:d.page.borderBoxCenter,draggable:s,draggables:l.draggables,droppables:l.droppables,previousImpact:m,viewport:r.viewport,userDirection:r.userDirection,onLift:v}));Boolean("SNAP"===r.movementMode&&!Bi(g))&&Object(je.a)(!1),Fi("Processing dynamic changes");var y=qr({phase:"DRAGGING"},r,((t={}).phase="DRAGGING",t.critical=u,t.current=d,t.initial=p,t.impact=g,t.dimensions=l,t.onLift=v,t.onLiftImpact=m,t.forceShouldAnimate=!1,t));return"COLLECTING"===r.phase?y:qr({phase:"DROP_PENDING"},y,((n={}).phase="DROP_PENDING",n.reason=r.reason,n.isWaiting=!1,n))},_a={vertical:"down",horizontal:"right"},Ia={vertical:"up",horizontal:"left"},Ta=function(e){var t=e.isMovingForward,n=e.isInHomeList,r=e.draggable,o=e.draggables,i=e.destination,a=e.insideDestination,u=e.previousImpact,c=e.onLift,s=u.destination?function(e){var t=e.isMovingForward,n=e.isInHomeList,r=e.draggable,o=e.insideDestination,i=e.location,a=o.slice(),u=i.index;!n&&a.splice(i.index,0,r);var c=t?u+1:u-1;return c<0?null:c>a.length-1?null:{proposedIndex:c,modifyDisplacement:!0}}({isMovingForward:t,isInHomeList:n,draggable:r,location:u.destination,insideDestination:a}):u.merge?function(e){var t=e.isMovingForward,n=e.destination,r=e.previousImpact,o=e.draggables,i=e.merge,a=e.onLift;if(!n.isCombineEnabled)return null;var u=r.movement,c=i.combine.draggableId,s=o[c].descriptor.index;return $i(c,a)?u.map[c]?t?{proposedIndex:s,modifyDisplacement:!0}:{proposedIndex:s-1,modifyDisplacement:!1}:t?{proposedIndex:s,modifyDisplacement:!1}:{proposedIndex:s-1,modifyDisplacement:!0}:Boolean(u.map[c])?t?{proposedIndex:s+1,modifyDisplacement:!0}:{proposedIndex:s,modifyDisplacement:!1}:t?{proposedIndex:s+1,modifyDisplacement:!1}:{proposedIndex:s,modifyDisplacement:!0}}({isMovingForward:t,destination:i,previousImpact:u,draggables:o,merge:u.merge,onLift:c}):null;if(null==s)return null;var l,f=s.proposedIndex,p=s.modifyDisplacement,d=la(i.axis,r.displaceBy),h=(l=u.movement.displaced,p?t?function(e){return e.slice(1)}(l):function(e,t){return[{draggableId:e.descriptor.id,isVisible:!0,shouldAnimate:!0}].concat(t)}(da(r,a)[f],l):l);return{movement:{displacedBy:d,displaced:h,map:sa(h)},destination:{droppableId:i.descriptor.id,index:f},merge:null}},Na=function(e,t){return t.margin[e.start]+t.borderBox[e.size]/2},Aa=function(e,t,n){return t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2},Pa=function(e){var t=e.axis,n=e.moveRelativeTo,r=e.isMoving;return _i(t.line,n.marginBox[t.end]+Na(t,r),Aa(t,n.marginBox,r))},Da=function(e){var t=e.axis,n=e.moveRelativeTo,r=e.isMoving;return _i(t.line,n.marginBox[t.start]-function(e,t){return t.margin[e.end]+t.borderBox[e.size]/2}(t,r),Aa(t,n.marginBox,r))},Ma=function(e){var t=e.movement,n=e.draggable,r=e.draggables,o=e.droppable,i=e.onLift,a=Yi(o.descriptor.id,r),u=n.page,c=o.axis;if(!a.length)return function(e){var t=e.axis,n=e.moveInto,r=e.isMoving;return _i(t.line,n.contentBox[t.start]+Na(t,r),Aa(t,n.contentBox,r))}({axis:c,moveInto:o.page,isMoving:u});var s=t.displaced,l=t.displacedBy;if(s.length){var f=r[s[0].draggableId];if($i(f.descriptor.id,i))return Da({axis:c,moveRelativeTo:f.page,isMoving:u});var p=ci(f.page,l.point);return Da({axis:c,moveRelativeTo:p,isMoving:u})}var d=a[a.length-1];if(d.descriptor.id===n.descriptor.id)return u.borderBox.center;if($i(d.descriptor.id,i)){var h=ci(d.page,ji(i.displacedBy.point));return Pa({axis:c,moveRelativeTo:h,isMoving:u})}return Pa({axis:c,moveRelativeTo:d.page,isMoving:u})},La=function(e,t){var n=e.frame;return n?ki(t,n.scroll.diff.displacement):t},Ra=function(e){var t=e.impact,n=e.draggable,r=e.droppable,o=e.draggables,i=e.onLift,a=t.merge,u=t.destination,c=n.page.borderBox.center;return r?u?Ma({movement:t.movement,draggable:n,draggables:o,droppable:r,onLift:i}):a?function(e){var t=e.combine,n=e.onLift,r=e.movement,o=e.draggables,i=t.draggableId,a=o[i].page.borderBox.center,u=ea({displaced:r.map,onLift:n,combineWith:i,displacedBy:r.displacedBy});return ki(a,u)}({movement:t.movement,combine:a.combine,draggables:o,onLift:i}):c:c},Fa=function(e){var t=Ra(e),n=e.droppable;return n?La(n,t):t},Ba=function(e,t){var n=Si(t,e.scroll.initial),r=ji(n);return{frame:ni({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:n,displacement:r}}}},za=function(e,t){return qr({},e,{movement:qr({},e.movement,{displaced:t,map:sa(t)})})},Ua=function(e){var t=e.pageBorderBoxCenter,n=e.draggable,r=function(e,t){return ki(e.scroll.diff.displacement,t)}(e.viewport,t),o=Si(r,n.page.borderBox.center);return ki(n.client.borderBox.center,o)},qa=function(e){var t=e.draggable,n=e.destination,r=e.newPageBorderBoxCenter,o=e.viewport,i=e.withDroppableDisplacement,a=e.onlyOnMainAxis,u=void 0!==a&&a,c=Si(r,t.page.borderBox.center),s={target:Ai(t.page.borderBox,c),destination:n,withDroppableDisplacement:i,viewport:o};return u?function(e){return ia(qr({},e,{isVisibleThroughFrameFn:(t=e.destination.axis,function(e){var n=Ji(e.top,e.bottom),r=Ji(e.left,e.right);return function(e){return t===Ki?n(e.top)&&n(e.bottom):r(e.left)&&r(e.right)}})}));var t}(s):ua(s)},Wa=function(e){var t=e.isMovingForward,n=e.draggable,r=e.destination,o=e.draggables,i=e.previousImpact,a=e.viewport,u=e.previousPageBorderBoxCenter,c=e.previousClientSelection,s=e.onLift;if(!r.isEnabled)return null;var l=Yi(r.descriptor.id,o),f=wa(n,r),p=function(e){var t=e.isMovingForward,n=e.isInHomeList,r=e.draggable,o=e.destination,i=e.insideDestination,a=e.previousImpact;if(!o.isCombineEnabled)return null;if(a.merge)return null;var u=a.destination;u||Object(je.a)(!1);var c,s=u.index,l=(c=i.slice(),n&&c.splice(r.descriptor.index,1),c.splice(u.index,0,r),c),f=t?s+1:s-1;if(f<0)return null;if(f>l.length-1)return null;var p=l[f];p===r&&Object(je.a)(!1);var d={whenEntered:t?_a:Ia,combine:{draggableId:p.descriptor.id,droppableId:o.descriptor.id}};return{movement:a.movement,destination:null,merge:d}}({isInHomeList:f,isMovingForward:t,draggable:n,destination:r,insideDestination:l,previousImpact:i})||Ta({isMovingForward:t,isInHomeList:f,draggable:n,draggables:o,destination:r,insideDestination:l,previousImpact:i,onLift:s});if(!p)return null;var d=Fa({impact:p,draggable:n,droppable:r,draggables:o,onLift:s});if(qa({draggable:n,destination:r,newPageBorderBoxCenter:d,viewport:a.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:Ua({pageBorderBoxCenter:d,draggable:n,viewport:a}),impact:p,scrollJumpRequest:null};var h=Si(d,u);return{clientSelection:c,impact:function(e){var t=e.impact,n=e.viewport,r=e.destination,o=e.draggables,i=e.maxScrollChange,a=e.onLift,u=t.movement.displaced,c=Ba(n,ki(n.scroll.current,i)),s=r.frame?Li(r,ki(r.frame.scroll.current,i)):r,l=u.map(function(e){if(e.isVisible)return e;var i=o[e.draggableId],u=ca({draggable:i,destination:r,previousImpact:t,viewport:c.frame,onLift:a,forceShouldAnimate:!1});if(u.isVisible)return u;var l=ca({draggable:i,destination:s,previousImpact:t,viewport:n.frame,onLift:a,forceShouldAnimate:!1});return l.isVisible?l:e});return za(t,l)}({impact:p,viewport:a,destination:r,draggables:o,maxScrollChange:h,onLift:s}),scrollJumpRequest:h}},Ha=function(e){var t=e.subject.active;return t||Object(je.a)(!1),t},Va=function(e,t){var n=e.page.borderBox.center;return $i(e.descriptor.id,t)?Si(n,t.displacedBy.point):n},Ga=function(e,t){var n=e.page.borderBox;return $i(e.descriptor.id,t)?Ai(n,ji(t.displacedBy.point)):n},Ja=function(e){var t=e.isMovingForward,n=e.previousPageBorderBoxCenter,r=e.draggable,o=e.isOver,i=e.draggables,a=e.droppables,u=e.previousImpact,c=e.viewport,s=e.onLift,l=function(e){var t=e.isMovingForward,n=e.pageBorderBoxCenter,r=e.source,o=e.droppables,i=e.viewport,a=r.subject.active;if(!a)return null;var u=r.axis,c=Ji(a[u.start],a[u.end]),s=Vi(o).filter(function(e){return e!==r}).filter(function(e){return e.isEnabled}).filter(function(e){return Boolean(e.subject.active)}).filter(function(e){return ra(i.frame)(Ha(e))}).filter(function(e){var n=Ha(e);return t?a[u.crossAxisEnd]<n[u.crossAxisEnd]:n[u.crossAxisStart]<a[u.crossAxisStart]}).filter(function(e){var t=Ha(e),n=Ji(t[u.start],t[u.end]);return c(t[u.start])||c(t[u.end])||n(a[u.start])||n(a[u.end])}).sort(function(e,n){var r=Ha(e)[u.crossAxisStart],o=Ha(n)[u.crossAxisStart];return t?r-o:o-r}).filter(function(e,t,n){return Ha(e)[u.crossAxisStart]===Ha(n[0])[u.crossAxisStart]});if(!s.length)return null;if(1===s.length)return s[0];var l=s.filter(function(e){return Ji(Ha(e)[u.start],Ha(e)[u.end])(n[u.line])});return 1===l.length?l[0]:l.length>1?l.sort(function(e,t){return Ha(e)[u.start]-Ha(t)[u.start]})[0]:s.sort(function(e,t){var r=Ti(n,Pi(Ha(e))),o=Ti(n,Pi(Ha(t)));return r!==o?r-o:Ha(e)[u.start]-Ha(t)[u.start]})[0]}({isMovingForward:t,pageBorderBoxCenter:n,source:o,droppables:a,viewport:c});if(!l)return null;var f=Yi(l.descriptor.id,i),p=function(e){var t=e.previousPageBorderBoxCenter,n=e.moveRelativeTo,r=e.insideDestination,o=e.draggable,i=e.draggables,a=e.destination,u=e.previousImpact,c=e.viewport,s=e.onLift;if(!n){if(r.length)return null;var l={movement:fa,destination:{droppableId:a.descriptor.id,index:0},merge:null},f=Fa({impact:l,draggable:o,droppable:a,draggables:i,onLift:s}),p=wa(o,a)?a:Ea(a,o,i);return qa({draggable:o,destination:p,newPageBorderBoxCenter:f,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?l:null}var d=Boolean(t[a.axis.line]<n.page.borderBox.center[a.axis.line]),h=r.indexOf(n);-1===h&&Object(je.a)(!1);var m=n.descriptor.id===o.descriptor.id?h:d?h:h+1,v=da(o,r).slice(m).map(function(e){return ca({draggable:e,destination:a,viewport:c.frame,previousImpact:u,onLift:s})});return{movement:{displacedBy:la(a.axis,o.displaceBy),displaced:v,map:sa(v)},destination:{droppableId:a.descriptor.id,index:m},merge:null}}({previousPageBorderBoxCenter:n,destination:l,draggable:r,draggables:i,moveRelativeTo:function(e){var t=e.pageBorderBoxCenter,n=e.viewport,r=e.destination,o=e.insideDestination,i=e.onLift;return o.filter(function(e){return ua({target:Ga(e,i),destination:r,viewport:n.frame,withDroppableDisplacement:!0})}).sort(function(e,n){var o=Ii(t,La(r,Va(e,i))),a=Ii(t,La(r,Va(n,i)));return o<a?-1:a<o?1:e.descriptor.index-n.descriptor.index})[0]||null}({pageBorderBoxCenter:n,viewport:c,destination:l,insideDestination:f,onLift:s}),insideDestination:f,previousImpact:u,viewport:c,onLift:s});if(!p)return null;var d=Fa({impact:p,draggable:r,droppable:l,draggables:i,onLift:s});return{clientSelection:Ua({pageBorderBoxCenter:d,draggable:r,viewport:c}),impact:p,scrollJumpRequest:null}},Za=function(e){var t=e.state,n=e.type,r=function(e,t){var n=Bi(e);return n?t[n]:null}(t.impact,t.dimensions.droppables),o=Boolean(r),i=t.dimensions.droppables[t.critical.droppable.id],a=r||i,u=a.axis.direction,c="vertical"===u&&("MOVE_UP"===n||"MOVE_DOWN"===n)||"horizontal"===u&&("MOVE_LEFT"===n||"MOVE_RIGHT"===n);if(c&&!o)return null;var s="MOVE_DOWN"===n||"MOVE_RIGHT"===n,l=t.dimensions.draggables[t.critical.draggable.id],f=t.current.page.borderBoxCenter,p=t.dimensions,d=p.draggables,h=p.droppables;return c?Wa({isMovingForward:s,previousPageBorderBoxCenter:f,draggable:l,destination:a,draggables:d,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,onLift:t.onLift}):Ja({isMovingForward:s,previousPageBorderBoxCenter:f,draggable:l,isOver:a,draggables:d,droppables:h,previousImpact:t.impact,viewport:t.viewport,onLift:t.onLift})};function Ya(e){return"DRAGGING"===e.phase||"COLLECTING"===e.phase}var Ka,Xa=function(e,t){return 0===t?e:t>0?"down":"up"},Qa=function(e,t){return 0===t?e:t>0?"right":"left"},$a=function(e){var t,n,r,o,i=e.state,a=e.clientSelection,u=e.dimensions,c=e.viewport,s=e.impact,l=e.scrollJumpRequest,f=c||i.viewport,p=f.scroll.current,d=u||i.dimensions,h=a||i.current.client.selection,m=Si(h,i.initial.client.selection),v={offset:m,selection:h,borderBoxCenter:ki(i.initial.client.borderBoxCenter,m)},g={selection:ki(v.selection,p),borderBoxCenter:ki(v.borderBoxCenter,p)},y={client:v,page:g},b=(t=i.userDirection,n=i.current.page.borderBoxCenter,r=y.page.borderBoxCenter,o=Si(r,n),{horizontal:Qa(t.horizontal,o.x),vertical:Xa(t.vertical,o.y)});if("COLLECTING"===i.phase)return qr({phase:"COLLECTING"},i,{dimensions:d,viewport:f,current:y,userDirection:b});var w=d.draggables[i.critical.draggable.id],O=s||ha({pageBorderBoxCenter:g.borderBoxCenter,draggable:w,draggables:d.draggables,droppables:d.droppables,previousImpact:i.impact,viewport:f,userDirection:b,onLift:i.onLift}),E=Ca({draggable:w,impact:O,previousImpact:i.impact,draggables:d.draggables,droppables:d.droppables});return qr({},i,{current:y,userDirection:b,dimensions:{draggables:d.draggables,droppables:E},impact:O,viewport:f,scrollJumpRequest:l||null,forceShouldAnimate:!l&&null})},eu=function(e){var t=e.impact,n=e.viewport,r=e.destination,o=e.draggables,i=e.onLift,a=e.forceShouldAnimate,u=t.movement.displaced.map(function(e){return ca({draggable:o[e.draggableId],destination:r,previousImpact:t,viewport:n.frame,onLift:i,forceShouldAnimate:a})});return za(t,u)},tu=function(e){var t=e.impact,n=e.draggable,r=e.droppable,o=e.draggables,i=e.viewport,a=e.onLift,u=Fa({impact:t,draggable:n,draggables:o,droppable:r,onLift:a});return Ua({pageBorderBoxCenter:u,draggable:n,viewport:i})},nu=function(e){var t=e.state,n=e.dimensions,r=e.viewport;"SNAP"!==t.movementMode&&Object(je.a)(!1);var o=t.impact,i=r||t.viewport,a=n||t.dimensions,u=a.draggables,c=a.droppables,s=u[t.critical.draggable.id],l=Bi(o);l||Object(je.a)(!1);var f=c[l],p=eu({impact:o,viewport:i,destination:f,draggables:u,onLift:t.onLift}),d=tu({impact:p,draggable:s,droppable:f,draggables:u,viewport:i,onLift:t.onLift});return $a({impact:p,clientSelection:d,state:t,dimensions:a,viewport:i})},ru=function(e){return"SNAP"===e.movementMode},ou=function(e,t,n){var r=function(e,t){return{draggables:e.draggables,droppables:Sa(e.droppables,t)}}(e.dimensions,t);return!ru(e)||n?$a({state:e,dimensions:r}):nu({state:e,dimensions:r})},iu={phase:"IDLE",completed:null,shouldFlush:!1},au=function(e,t){if(void 0===e&&(e=iu),"CLEAN"===t.type)return qr({},iu,{shouldFlush:t.payload.shouldFlush});if("INITIAL_PUBLISH"===t.type){"IDLE"!==e.phase&&Object(je.a)(!1);var n=t.payload,r=n.critical,o=n.clientSelection,i=n.viewport,a=n.dimensions,u=n.movementMode,c=a.draggables[r.draggable.id],s=a.droppables[r.droppable.id],l={selection:o,borderBoxCenter:c.client.borderBox.center,offset:xi},f={client:l,page:{selection:ki(l.selection,i.scroll.initial),borderBoxCenter:ki(l.selection,i.scroll.initial)}},p=Vi(a.droppables).every(function(e){return!e.isFixedOnPage}),d=ma({draggable:c,home:s,draggables:a.draggables,viewport:i}),h=d.impact;return{phase:"DRAGGING",isDragging:!0,critical:r,movementMode:u,dimensions:a,initial:f,current:f,isWindowScrollAllowed:p,impact:h,onLift:d.onLift,onLiftImpact:h,viewport:i,userDirection:_a,scrollJumpRequest:null,forceShouldAnimate:null}}var m;if("COLLECTION_STARTING"===t.type)return"COLLECTING"===e.phase||"DROP_PENDING"===e.phase?e:("DRAGGING"!==e.phase&&Object(je.a)(!1),qr({phase:"COLLECTING"},e,((m={}).phase="COLLECTING",m)));if("PUBLISH_WHILE_DRAGGING"===t.type)return"COLLECTING"!==e.phase&&"DROP_PENDING"!==e.phase&&Object(je.a)(!1),ja({state:e,published:t.payload});if("MOVE"===t.type){if("DROP_PENDING"===e.phase)return e;Ya(e)||Object(je.a)(!1);var v=t.payload.client;return Ci(v,e.current.client.selection)?e:$a({state:e,clientSelection:v,impact:ru(e)?e.impact:null})}if("UPDATE_DROPPABLE_SCROLL"===t.type){if("DROP_PENDING"===e.phase)return e;if("COLLECTING"===e.phase)return e;Ya(e)||Object(je.a)(!1);var g=t.payload,y=g.id,b=g.offset,w=e.dimensions.droppables[y];if(!w)return e;var O=Li(w,b);return ou(e,O,!1)}if("UPDATE_DROPPABLE_IS_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;Ya(e)||Object(je.a)(!1);var E=t.payload,x=E.id,k=E.isEnabled,S=e.dimensions.droppables[x];S||Object(je.a)(!1),S.isEnabled===k&&Object(je.a)(!1);var C=qr({},S,{isEnabled:k});return ou(e,C,!0)}if("UPDATE_DROPPABLE_IS_COMBINE_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;Ya(e)||Object(je.a)(!1);var j=t.payload,_=j.id,I=j.isCombineEnabled,T=e.dimensions.droppables[_];T||Object(je.a)(!1),T.isCombineEnabled===I&&Object(je.a)(!1);var N=qr({},T,{isCombineEnabled:I});return ou(e,N,!0)}if("MOVE_BY_WINDOW_SCROLL"===t.type){if("DROP_PENDING"===e.phase||"DROP_ANIMATING"===e.phase)return e;Ya(e)||Object(je.a)(!1),e.isWindowScrollAllowed||Object(je.a)(!1);var A=t.payload.newScroll;if(Ci(e.viewport.scroll.current,A))return e;var P=Ba(e.viewport,A);return ru(e)?nu({state:e,viewport:P}):$a({state:e,viewport:P})}if("UPDATE_VIEWPORT_MAX_SCROLL"===t.type){if(!Ya(e))return e;var D=t.payload.maxScroll;if(Ci(D,e.viewport.scroll.max))return e;var M=qr({},e.viewport,{scroll:qr({},e.viewport.scroll,{max:D})});return qr({phase:"DRAGGING"},e,{viewport:M})}if("MOVE_UP"===t.type||"MOVE_DOWN"===t.type||"MOVE_LEFT"===t.type||"MOVE_RIGHT"===t.type){if("COLLECTING"===e.phase||"DROP_PENDING"===e.phase)return e;"DRAGGING"!==e.phase&&Object(je.a)(!1);var L=Za({state:e,type:t.type});return L?$a({state:e,impact:L.impact,clientSelection:L.clientSelection,scrollJumpRequest:L.scrollJumpRequest}):e}if("DROP_PENDING"===t.type){var R,F=t.payload.reason;return"COLLECTING"!==e.phase&&Object(je.a)(!1),qr({phase:"DROP_PENDING"},e,((R={}).phase="DROP_PENDING",R.isWaiting=!0,R.reason=F,R))}if("DROP_ANIMATE"===t.type){var B=t.payload,z=B.completed,U=B.dropDuration,q=B.newHomeClientOffset;return"DRAGGING"!==e.phase&&"DROP_PENDING"!==e.phase&&Object(je.a)(!1),{phase:"DROP_ANIMATING",dimensions:e.dimensions,completed:z,dropDuration:U,newHomeClientOffset:q}}if("DROP_COMPLETE"===t.type){var W=t.payload;return{phase:"IDLE",completed:W.completed,shouldFlush:W.shouldFlush}}return e},uu=function(e){return{type:"PUBLISH_WHILE_DRAGGING",payload:e}},cu=function(){return{type:"COLLECTION_STARTING",payload:null}},su=function(e){return{type:"UPDATE_DROPPABLE_SCROLL",payload:e}},lu=function(e){return{type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}},fu=function(e){return{type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}},pu=function(e){return{type:"MOVE",payload:e}},du=function(e){return void 0===e&&(e={shouldFlush:!1}),{type:"CLEAN",payload:e}},hu=function(e){return{type:"DROP_COMPLETE",payload:e}},mu=function(e){return{type:"DROP",payload:e}},vu="cubic-bezier(.2,1,.1,1)",gu={drop:0,combining:.7},yu={drop:.75},bu=.2+"s "+"cubic-bezier(0.2, 0, 0, 1)",wu={fluid:"opacity "+bu,snap:"transform "+bu+", opacity "+bu,drop:function(e){var t=e+"s "+vu;return"transform "+t+", opacity "+t},outOfTheWay:"transform "+bu,placeholder:"height "+bu+", width "+bu+", margin "+bu},Ou=function(e){return Ci(e,xi)?null:"translate("+e.x+"px, "+e.y+"px)"},Eu={moveTo:Ou,drop:function(e,t){var n=Ou(e);return n?t?n+" scale("+yu.drop+")":n:null}},xu=.33,ku=.55,Su=ku-xu,Cu=function(e){var t=e.getState,n=e.dispatch;return function(e){return function(r){if("DROP"===r.type){var o=t(),i=r.payload.reason;if("COLLECTING"!==o.phase){if("IDLE"!==o.phase){"DROP_PENDING"===o.phase&&o.isWaiting&&Object(je.a)(!1),"DRAGGING"!==o.phase&&"DROP_PENDING"!==o.phase&&Object(je.a)(!1);var a=o.critical,u=o.dimensions,c=function(e){var t=e.reason,n=e.lastImpact,r=e.home,o=e.viewport,i=e.draggables,a=e.onLiftImpact,u=e.onLift,c="DROP"===t&&Boolean(Bi(n));return c?n.destination?{impact:n,didDropInsideDroppable:c}:{impact:qr({},n,{movement:fa}),didDropInsideDroppable:c}:{impact:eu({impact:a,destination:r,viewport:o,draggables:i,onLift:u,forceShouldAnimate:!0}),didDropInsideDroppable:c}}({reason:i,lastImpact:o.impact,onLift:o.onLift,onLiftImpact:o.onLiftImpact,home:o.dimensions.droppables[o.critical.droppable.id],viewport:o.viewport,draggables:o.dimensions.draggables}),s=c.impact,l=c.didDropInsideDroppable,f=u.draggables[o.critical.draggable.id],p=l?s.destination:null,d=l&&s.merge?s.merge.combine:null,h={index:a.draggable.index,droppableId:a.droppable.id},m={draggableId:f.descriptor.id,type:f.descriptor.type,source:h,reason:i,mode:o.movementMode,destination:p,combine:d},v=function(e){var t=e.impact,n=e.draggable,r=e.dimensions,o=e.viewport,i=e.onLift,a=r.draggables,u=r.droppables,c=Bi(t),s=c?u[c]:null,l=u[n.descriptor.droppableId],f=tu({impact:t,draggable:n,draggables:a,onLift:i,droppable:s||l,viewport:o}),p=Si(f,n.client.borderBox.center),d=t.merge;return d&&$i(d.combine.draggableId,i)?Si(p,i.displacedBy.point):p}({impact:s,draggable:f,dimensions:u,viewport:o.viewport,onLift:o.onLift}),g={critical:o.critical,result:m,impact:s};if(!Ci(o.current.client.offset,v)||Boolean(m.combine)){var y=function(e){var t=e.current,n=e.destination,r=e.reason,o=Ii(t,n);if(o<=0)return xu;if(o>=1500)return ku;var i=xu+Su*(o/1500);return Number(("CANCEL"===r?.6*i:i).toFixed(2))}({current:o.current.client.offset,destination:v,reason:i});n(function(e){return{type:"DROP_ANIMATE",payload:e}}({newHomeClientOffset:v,dropDuration:y,completed:g}))}else n(hu({completed:g,shouldFlush:!1}))}}else n(function(e){return{type:"DROP_PENDING",payload:e}}({reason:i}))}else e(r)}}},ju=function(e){return e+1},_u=function(e,t){var n=e.droppableId===t.droppableId,r=ju(e.index),o=ju(t.index);return n?"\n You have moved the item from position "+r+"\n to position "+o+"\n ":"\n You have moved the item from position "+r+"\n in list "+e.droppableId+"\n to list "+t.droppableId+"\n in position "+o+"\n "},Iu=function(e,t,n){return t.droppableId===n.droppableId?"\n The item "+e+"\n has been combined with "+n.draggableId:"\n The item "+e+"\n in list "+t.droppableId+"\n has been combined with "+n.draggableId+"\n in list "+n.droppableId+"\n "},Tu=function(e){return"\n The item has returned to its starting position\n of "+ju(e.index)+"\n"},Nu=function(e){return"\n You have lifted an item in position "+ju(e.source.index)+".\n Use the arrow keys to move, space bar to drop, and escape to cancel.\n"},Au=function(e){var t=e.destination;if(t)return _u(e.source,t);var n=e.combine;return n?Iu(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},Pu=function(e){if("CANCEL"===e.reason)return"\n Movement cancelled.\n "+Tu(e.source)+"\n ";var t=e.destination,n=e.combine;return t?"\n You have dropped the item.\n "+_u(e.source,t)+"\n ":n?"\n You have dropped the item.\n "+Iu(e.draggableId,e.source,n)+"\n ":"\n The item has been dropped while not over a drop area.\n "+Tu(e.source)+"\n "},Du=function(){var e=[];return{add:function(t){var n=setTimeout(function(){return function(t){var n=Ui(e,function(e){return e.timerId===t});-1===n&&Object(je.a)(!1),e.splice(n,1)[0].callback()}(n)}),r={timerId:n,callback:t};e.push(r)},flush:function(){if(e.length){var t=[].concat(e);e.length=0,t.forEach(function(e){clearTimeout(e.timerId),e.callback()})}}}},Mu=function(e,t){Ri(e),t(),Fi(e)},Lu=function(e,t){return{draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t}},Ru=function(e,t,n,r){if(e){var o=function(e){var t=!1,n=!1,r=setTimeout(function(){n=!0}),o=function(o){t||n||(t=!0,e(o),clearTimeout(r))};return o.wasCalled=function(){return t},o}(n);e(t,{announce:o}),o.wasCalled()||n(r(t))}else n(r(t))},Fu=function(e,t){var n=function(e,t){var n=Du(),r=null,o=function(n){r||Object(je.a)(!1),r=null,Mu("onDragEnd",function(){return Ru(e().onDragEnd,n,t,Pu)})};return{beforeStart:function(t,n){r&&Object(je.a)(!1),Mu("onBeforeDragStart",function(){var r=e().onBeforeDragStart;r&&r(Lu(t,n))})},start:function(o,i){r&&Object(je.a)(!1);var a=Lu(o,i);r={mode:i,lastCritical:o,lastLocation:a.source,lastCombine:null},n.add(function(){Mu("onDragStart",function(){return Ru(e().onDragStart,a,t,Nu)})})},update:function(o,i){var a=i.destination,u=i.merge?i.merge.combine:null;r||Object(je.a)(!1);var c=!function(e,t){if(e===t)return!0;var n=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,r=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&r}(o,r.lastCritical);c&&(r.lastCritical=o);var s,l,f=(s=r.lastLocation,l=a,!(null==s&&null==l||null!=s&&null!=l&&s.droppableId===l.droppableId&&s.index===l.index));f&&(r.lastLocation=a);var p=!function(e,t){return null==e&&null==t||null!=e&&null!=t&&e.draggableId===t.draggableId&&e.droppableId===t.droppableId}(r.lastCombine,u);if(p&&(r.lastCombine=u),c||f||p){var d=qr({},Lu(o,r.mode),{combine:u,destination:a});n.add(function(){Mu("onDragUpdate",function(){return Ru(e().onDragUpdate,d,t,Au)})})}},flush:function(){r||Object(je.a)(!1),n.flush()},drop:o,abort:function(){if(r){var e=qr({},Lu(r.lastCritical,r.mode),{combine:null,destination:null,reason:"CANCEL"});o(e)}}}}(e,t);return function(e){return function(t){return function(r){if("INITIAL_PUBLISH"===r.type){var o=r.payload.critical;return n.beforeStart(o,r.payload.movementMode),t(r),void n.start(o,r.payload.movementMode)}if("DROP_COMPLETE"===r.type){var i=r.payload.completed.result;return n.flush(),t(r),void n.drop(i)}if(t(r),"CLEAN"!==r.type){var a=e.getState();"DRAGGING"===a.phase&&n.update(a.critical,a.impact)}else n.abort()}}}},Bu=function(e){return function(t){return function(n){if("DROP_ANIMATION_FINISHED"===n.type){var r=e.getState();"DROP_ANIMATING"!==r.phase&&Object(je.a)(!1),e.dispatch(hu({completed:r.completed,shouldFlush:!1}))}else t(n)}}},zu=function(e){return function(t){return function(n){if(t(n),"PUBLISH_WHILE_DRAGGING"===n.type){var r=e.getState();"DROP_PENDING"===r.phase&&(r.isWaiting||e.dispatch(mu({reason:r.reason})))}}}},Uu=ro,qu=function(e){var t,n=e.dimensionMarshal,r=e.styleMarshal,o=e.getResponders,i=e.announce,a=e.autoScroller;return $r(au,Uu(oo((t=r,function(){return function(e){return function(n){"INITIAL_PUBLISH"===n.type&&t.dragging(),"DROP_ANIMATE"===n.type&&t.dropping(n.payload.completed.result.reason),"CLEAN"!==n.type&&"DROP_COMPLETE"!==n.type||t.resting(),e(n)}}}),function(e){return function(){return function(t){return function(n){"DROP_COMPLETE"!==n.type&&"CLEAN"!==n.type&&"DROP_ANIMATE"!==n.type||e.stopPublishing(),t(n)}}}}(n),function(e){return function(t){var n=t.getState,r=t.dispatch;return function(t){return function(o){if("LIFT"===o.type){var i=o.payload,a=i.id,u=i.clientSelection,c=i.movementMode,s=n();"DROP_ANIMATING"===s.phase&&r(hu({completed:s.completed,shouldFlush:!0})),"IDLE"!==n().phase&&Object(je.a)(!1);var l={draggableId:a,scrollOptions:{shouldPublishImmediately:"SNAP"===c}},f=e.startPublishing(l),p=f.critical,d=f.dimensions,h=f.viewport;r({type:"INITIAL_PUBLISH",payload:{critical:p,dimensions:d,clientSelection:u,movementMode:c,viewport:h}})}else t(o)}}}}(n),Cu,Bu,zu,function(e){return function(t){return function(n){return function(r){if(function(e){return"DROP_COMPLETE"===e.type||"DROP_ANIMATE"===e.type||"CLEAN"===e.type}(r))return e.stop(),void n(r);if(function(e){return"COLLECTION_STARTING"===e.type}(r))return e.cancelPending(),void n(r);if("INITIAL_PUBLISH"===r.type){n(r);var o=t.getState();return"DRAGGING"!==o.phase&&Object(je.a)(!1),void e.start(o)}n(r),e.scroll(t.getState())}}}}(a),Fu(o,i))))},Wu=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Hu=function(){var e=document.documentElement;return e||Object(je.a)(!1),e},Vu=function(){var e=Hu();return ya({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},Gu=function(e){var t=e.critical,n=e.scrollOptions,r=e.entries;Ri("Initial collection from DOM");var o,i,a,u,c,s,l,f=(o=Wu(),i=Vu(),a=o.y,u=o.x,c=Hu(),s=c.clientWidth,l=c.clientHeight,{frame:ni({top:a,left:u,right:u+s,bottom:a+l}),scroll:{initial:o,current:o,max:i,diff:{value:xi,displacement:xi}}}),p=f.scroll.current,d=t.droppable,h=zi(r.droppables).filter(function(e){return e.descriptor.type===d.type}).map(function(e){return e.callbacks.getDimensionAndWatchScroll(p,n)}),m=zi(r.draggables).filter(function(e){return e.descriptor.type===t.draggable.type}).map(function(e){return e.getDimension(p)}),v={draggables:Hi(m),droppables:Wi(h)};return Fi("Initial collection from DOM"),{dimensions:v,critical:t,viewport:f}},Ju=function(e,t){e.critical.draggable.type!==t.type&&Object(je.a)(!1)},Zu=function(e){var t={droppables:{},draggables:{}},n=null,r=function(e){var t=e.getEntries,n=e.callbacks,r=function(){},o={additions:{},removals:{},modified:{}},i=null,a=function(){r(),i||(i=requestAnimationFrame(function(){i=null,n.collectionStarting();var e=n.getCritical();Ri("Publish collection from DOM");var r=t(),a=o,u=a.additions,c=a.removals,s=a.modified,l=gi()(u).map(function(e){return r.draggables[e].getDimension(xi)}).sort(function(e,t){return e.descriptor.index-t.descriptor.index}),f=gi()(s).map(function(t){var n=r.droppables[t];n||Object(je.a)(!1);var o={withoutPlaceholder:!(n.descriptor.id===e.droppable.id)};return n.callbacks.recollect(o)}),p={additions:l,removals:gi()(c),modified:f};o={additions:{},removals:{},modified:{}},Fi("Publish collection from DOM"),n.publish(p)}))};return{add:function(e){o.additions[e.id]=e,o.modified[e.droppableId]=!0,o.removals[e.id]&&delete o.removals[e.id],a()},remove:function(e){o.removals[e.id]=e,o.modified[e.droppableId]=!0,o.additions[e.id]&&delete o.additions[e.id],a()},stop:function(){i&&(cancelAnimationFrame(i),i=null,o={additions:{},removals:{},modified:{}})}}}({callbacks:{publish:e.publishWhileDragging,collectionStarting:e.collectionStarting,getCritical:function(){return n||Object(je.a)(!1),n.critical}},getEntries:function(){return t}});return{registerDraggable:function(e,o){var i={descriptor:e,getDimension:o};t.draggables[e.id]=i,n&&(Ju(n,e),r.add(e))},updateDraggable:function(e,n,r){var o=t.draggables[e.id];o||Object(je.a)(!1),o.descriptor===e&&delete t.draggables[e.id];var i={descriptor:n,getDimension:r};t.draggables[n.id]=i},unregisterDraggable:function(e){var o=t.draggables[e.id];o||Object(je.a)(!1),o.descriptor===e&&(delete t.draggables[e.id],n&&(n.critical.draggable.id===e.id&&Object(je.a)(!1),Ju(n,e),r.remove(e)))},registerDroppable:function(e,r){var o=e.id;t.droppables[o]={descriptor:e,callbacks:r},n&&Object(je.a)(!1)},unregisterDroppable:function(e){var r=t.droppables[e.id];r||Object(je.a)(!1),r.descriptor===e&&(delete t.droppables[e.id],n&&Object(je.a)(!1))},updateDroppableIsEnabled:function(r,o){t.droppables[r]||Object(je.a)(!1),n&&e.updateDroppableIsEnabled({id:r,isEnabled:o})},updateDroppableIsCombineEnabled:function(r,o){t.droppables[r]||Object(je.a)(!1),n&&e.updateDroppableIsCombineEnabled({id:r,isCombineEnabled:o})},scrollDroppable:function(e,r){var o=t.droppables[e];o||Object(je.a)(!1),n&&o.callbacks.scroll(r)},updateDroppableScroll:function(r,o){t.droppables[r]||Object(je.a)(!1),n&&e.updateDroppableScroll({id:r,offset:o})},startPublishing:function(e){n&&Object(je.a)(!1);var r=t.draggables[e.draggableId];r||Object(je.a)(!1);var o=t.droppables[r.descriptor.droppableId];o||Object(je.a)(!1);var i={draggable:r.descriptor,droppable:o.descriptor};return n={critical:i},Gu({critical:i,entries:t,scrollOptions:e.scrollOptions})},stopPublishing:function(){if(n){r.stop();var e=n.critical.droppable;zi(t.droppables).filter(function(t){return t.descriptor.type===e.type}).forEach(function(e){return e.callbacks.dragStopped()}),n=null}}}},Yu=function(e,t){return"IDLE"===e.phase||"DROP_ANIMATING"===e.phase&&(e.completed.result.draggableId!==t&&"DROP"===e.completed.result.reason)},Ku=function(e){window.scrollBy(e.x,e.y)},Xu=di(function(e){return Vi(e).filter(function(e){return!!e.isEnabled&&!!e.frame})}),Qu=function(e){var t=e.center,n=e.destination,r=e.droppables;if(n){var o=r[n];return o.frame?o:null}return function(e,t){return qi(Xu(t),function(t){return t.frame||Object(je.a)(!1),Zi(t.frame.pageMarginBox)(e)})}(t,r)},$u=.25,ec=.05,tc=28,nc=function(e){return Math.pow(e,2)},rc={stopDampeningAt:1200,accelerateAt:360},oc=function(e){var t=e.startOfRange,n=e.endOfRange,r=e.current,o=n-t;return 0===o?0:(r-t)/o},ic=rc.accelerateAt,ac=rc.stopDampeningAt,uc=function(e){var t=e.distanceToEdge,n=e.thresholds,r=e.dragStartTime,o=e.shouldUseTimeDampening,i=function(e,t){if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return tc;if(e===t.startScrollingFrom)return 1;var n=oc({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),r=tc*nc(1-n);return Math.ceil(r)}(t,n);return 0===i?0:o?Math.max(function(e,t){var n=t,r=ac,o=bi()()-n;if(o>=ac)return e;if(o<ic)return 1;var i=oc({startOfRange:ic,endOfRange:r,current:o}),a=e*nc(i);return Math.ceil(a)}(i,r),1):i},cc=function(e){var t=e.container,n=e.distanceToEdges,r=e.dragStartTime,o=e.axis,i=e.shouldUseTimeDampening,a=function(e,t){return{startScrollingFrom:e[t.size]*$u,maxScrollValueAt:e[t.size]*ec}}(t,o);return n[o.end]<n[o.start]?uc({distanceToEdge:n[o.end],thresholds:a,dragStartTime:r,shouldUseTimeDampening:i}):-1*uc({distanceToEdge:n[o.start],thresholds:a,dragStartTime:r,shouldUseTimeDampening:i})},sc=Ni(function(e){return 0===e?0:e}),lc=function(e){var t=e.dragStartTime,n=e.container,r=e.subject,o=e.center,i=e.shouldUseTimeDampening,a={top:o.y-n.top,right:n.right-o.x,bottom:n.bottom-o.y,left:o.x-n.left},u=cc({container:n,distanceToEdges:a,dragStartTime:t,axis:Ki,shouldUseTimeDampening:i}),c=cc({container:n,distanceToEdges:a,dragStartTime:t,axis:Xi,shouldUseTimeDampening:i}),s=sc({x:c,y:u});if(Ci(s,xi))return null;var l=function(e){var t=e.container,n=e.subject,r=e.proposedScroll,o=n.height>t.height,i=n.width>t.width;return i||o?i&&o?null:{x:i?0:r.x,y:o?0:r.y}:r}({container:n,subject:r,proposedScroll:s});return l?Ci(l,xi)?null:l:null},fc=Ni(function(e){return 0===e?0:e>0?1:-1}),pc=(Ka=function(e,t){return e<0?e:e>t?e-t:0},function(e){var t=e.current,n=e.max,r=e.change,o=ki(t,r),i={x:Ka(o.x,n.x),y:Ka(o.y,n.y)};return Ci(i,xi)?null:i}),dc=function(e){var t=e.max,n=e.current,r=e.change,o={x:Math.max(n.x,t.x),y:Math.max(n.y,t.y)},i=fc(r),a=pc({max:o,current:n,change:i});return!a||(0!==i.x&&0===a.x||0!==i.y&&0===a.y)},hc=function(e,t){return dc({current:e.scroll.current,max:e.scroll.max,change:t})},mc=function(e,t){var n=e.frame;return!!n&&dc({current:n.scroll.current,max:n.scroll.max,change:t})},vc=function(e){var t=e.state,n=e.dragStartTime,r=e.shouldUseTimeDampening,o=e.scrollWindow,i=e.scrollDroppable,a=t.current.page.borderBoxCenter,u=t.dimensions.draggables[t.critical.draggable.id].page.marginBox;if(t.isWindowScrollAllowed){var c=function(e){var t=e.viewport,n=e.subject,r=e.center,o=e.dragStartTime,i=e.shouldUseTimeDampening,a=lc({dragStartTime:o,container:t.frame,subject:n,center:r,shouldUseTimeDampening:i});return a&&hc(t,a)?a:null}({dragStartTime:n,viewport:t.viewport,subject:u,center:a,shouldUseTimeDampening:r});if(c)return void o(c)}var s=Qu({center:a,destination:Bi(t.impact),droppables:t.dimensions.droppables});if(s){var l=function(e){var t=e.droppable,n=e.subject,r=e.center,o=e.dragStartTime,i=e.shouldUseTimeDampening,a=t.frame;if(!a)return null;var u=lc({dragStartTime:o,container:a.pageMarginBox,subject:n,center:r,shouldUseTimeDampening:i});return u&&mc(t,u)?u:null}({dragStartTime:n,droppable:s,subject:u,center:a,shouldUseTimeDampening:r});l&&i(s.descriptor.id,l)}},gc=function(e){var t=e.move,n=e.scrollDroppable,r=e.scrollWindow,o=function(e,t){if(!mc(e,t))return t;var r=function(e,t){var n=e.frame;return n&&mc(e,t)?pc({current:n.scroll.current,max:n.scroll.max,change:t}):null}(e,t);if(!r)return n(e.descriptor.id,t),null;var o=Si(t,r);return n(e.descriptor.id,o),Si(t,o)},i=function(e,t,n){if(!e)return n;if(!hc(t,n))return n;var o=function(e,t){if(!hc(e,t))return null;var n=e.scroll.max,r=e.scroll.current;return pc({current:r,max:n,change:t})}(t,n);if(!o)return r(n),null;var i=Si(n,o);return r(i),Si(n,i)};return function(e){var n=e.scrollJumpRequest;if(n){var r=Bi(e.impact);r||Object(je.a)(!1);var a=o(e.dimensions.droppables[r],n);if(a){var u=e.viewport,c=i(e.isWindowScrollAllowed,u,a);c&&function(e,n){var r=ki(e.current.client.selection,n);t({client:r})}(e,c)}}}},yc=function(e){var t=e.scrollDroppable,n=e.scrollWindow,r=e.move,o=function(e){var t=e.scrollWindow,n=e.scrollDroppable,r=wi(t),o=wi(n),i=null,a=function(e){i||Object(je.a)(!1);var t=i,n=t.shouldUseTimeDampening,a=t.dragStartTime;vc({state:e,scrollWindow:r,scrollDroppable:o,dragStartTime:a,shouldUseTimeDampening:n})},u=function(){i||Object(je.a)(!1),r.cancel(),o.cancel()};return{start:function(e){Ri("starting fluid scroller"),i&&Object(je.a)(!1);var t=bi()(),n=!1,r=function(){n=!0};vc({state:e,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:r,scrollDroppable:r}),i={dragStartTime:t,shouldUseTimeDampening:n},Fi("starting fluid scroller"),n&&a(e)},stop:function(){i&&(u(),i=null)},cancelPending:u,scroll:a}}({scrollWindow:n,scrollDroppable:t}),i=gc({move:r,scrollWindow:n,scrollDroppable:t});return{scroll:function(e){"DRAGGING"===e.phase&&("FLUID"!==e.movementMode?e.scrollJumpRequest&&i(e):o.scroll(e))},cancelPending:o.cancelPending,start:o.start,stop:o.stop}},bc="data-react-beautiful-dnd",wc=bc+"-drag-handle",Oc=bc+"-draggable",Ec=bc+"-droppable",xc=function(e,t){return e.map(function(e){var n=e.styles[t];return n?e.selector+" { "+n+" }":""}).join(" ")},kc=function(e){var t,n,r,o=(t=e,function(e){return"["+e+'="'+t+'"]'}),i=(n="\n cursor: -webkit-grab;\n cursor: grab;\n ",{selector:o(wc),styles:{always:"\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n ",resting:n,dragging:"pointer-events: none;",dropAnimating:n}}),a=[(r="\n transition: "+wu.outOfTheWay+";\n ",{selector:o(Oc),styles:{dragging:r,dropAnimating:r,userCancel:r}}),i,{selector:o(Ec),styles:{always:"overflow-anchor: none;"}},{selector:"body",styles:{dragging:"\n cursor: grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n overflow-anchor: none;\n "}}];return{always:xc(a,"always"),resting:xc(a,"resting"),dragging:xc(a,"dragging"),dropAnimating:xc(a,"dropAnimating"),userCancel:xc(a,"userCancel")}},Sc="undefined"!=typeof window?r.useLayoutEffect:r.useEffect,Cc=function(){var e=document.querySelector("head");return e||Object(je.a)(!1),e},jc=function(){var e=document.createElement("style");return e.type="text/css",e};var _c=o.a.createContext(null),Ic=function(){var e=document.body;return e||Object(je.a)(!1),e},Tc={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},Nc=function(e){return"react-beautiful-dnd-announcement-"+e};var Ac=o.a.createContext(null);function Pc(e){var t=Object(r.useRef)(e);return Object(r.useEffect)(function(){t.current=e}),t}var Dc=function(e){return{onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}};function Mc(e){return e.current||Object(je.a)(!1),e.current}function Lc(e){var t=e.uniqueId,n=e.setOnError,i=Object(r.useRef)(null);Object(r.useEffect)(function(){},[]);var a=Pc(e),u=Vr(function(){return Dc(a.current)},[a]),c=function(e){var t=Hr(function(){return Nc(e)},[e]),n=Object(r.useRef)(null);return Object(r.useEffect)(function(){n.current&&Object(je.a)(!1);var e=document.createElement("div");return n.current=e,e.id=t,e.setAttribute("aria-live","assertive"),e.setAttribute("role","log"),e.setAttribute("aria-atomic","true"),Ur()(e.style,Tc),Ic().appendChild(e),function(){var e=n.current;e||Object(je.a)(!1),Ic().removeChild(e),n.current=null}},[t]),Vr(function(e){var t=n.current;t&&(t.textContent=e)},[])}(t),s=function(e){var t=Hr(function(){return""+e},[e]),n=Hr(function(){return kc(t)},[t]),o=Object(r.useRef)(null),i=Object(r.useRef)(null),a=Vr(di(function(e){var t=i.current;t||Object(je.a)(!1),t.textContent=e}),[]),u=Vr(function(e){var t=o.current;t||Object(je.a)(!1),t.textContent=e},[]);Sc(function(){(o.current||i.current)&&Object(je.a)(!1);var e=jc(),r=jc();return o.current=e,i.current=r,e.setAttribute(bc+"-always",t),r.setAttribute(bc+"-dynamic",t),Cc().appendChild(e),Cc().appendChild(r),u(n.always),a(n.resting),function(){var e=function(e){var t=e.current;t||Object(je.a)(!1),Cc().removeChild(t),e.current=null};e(o),e(i)}},[u,a,n.always,n.resting,t]);var c=Vr(function(){return a(n.dragging)},[a,n.dragging]),s=Vr(function(e){a("DROP"!==e?n.userCancel:n.dropAnimating)},[a,n.dropAnimating,n.userCancel]),l=Vr(function(){i.current&&a(n.resting)},[a,n.resting]);return Hr(function(){return{dragging:c,dropping:s,resting:l,styleContext:t}},[c,s,l,t])}(t),l=Vr(function(e){Mc(i).dispatch(e)},[]),f=Hr(function(){return to({publishWhileDragging:uu,updateDroppableScroll:su,updateDroppableIsEnabled:lu,updateDroppableIsCombineEnabled:fu,collectionStarting:cu},l)},[l]),p=Hr(function(){return Zu(f)},[f]),d=Hr(function(){return yc(qr({scrollWindow:Ku,scrollDroppable:p.scrollDroppable},to({move:pu},l)))},[p.scrollDroppable,l]),h=Hr(function(){return qu({dimensionMarshal:p,styleMarshal:s,announce:c,autoScroller:d,getResponders:u})},[c,d,p,u,s]);i.current=h;var m=Vr(function(){var e=Mc(i);"IDLE"!==e.getState().phase&&e.dispatch(du({shouldFlush:!0}))},[]);n(m);var v=Vr(function(e){return Yu(Mc(i).getState(),e)},[]),g=Vr(function(){return Ya(Mc(i).getState())},[]),y=Hr(function(){return{marshal:p,style:s.styleContext,canLift:v,isMovementAllowed:g}},[p,v,g,s.styleContext]);return Object(r.useEffect)(function(){return m},[m]),o.a.createElement(Ac.Provider,{value:y},o.a.createElement(po,{context:_c,store:h},e.children))}var Rc=0;function Fc(e){var t=Hr(function(){return Rc++},[]);return o.a.createElement(Ei,null,function(n){return o.a.createElement(Lc,qr({setOnError:n,uniqueId:t},e),e.children)})}var Bc=function(e){return function(t){return e===t}},zc=Bc("scroll"),Uc=Bc("auto"),qc=(Bc("visible"),function(e,t){return t(e.overflowX)||t(e.overflowY)}),Wc=function(e){var t=window.getComputedStyle(e),n={overflowX:t.overflowX,overflowY:t.overflowY};return qc(n,zc)||qc(n,Uc)},Hc=function e(t){return null==t?null:t===document.body?null:t===document.documentElement?null:Wc(t)?t:e(t.parentElement)},Vc=function(e){return{x:e.scrollLeft,y:e.scrollTop}},Gc=function(e){return{closestScrollable:Hc(e),isFixedOnPage:function e(t){return!!t&&("fixed"===window.getComputedStyle(t).position||e(t.parentElement))}(e)}},Jc=function(e){var t=e.ref,n=e.descriptor,r=e.env,o=e.windowScroll,i=e.direction,a=e.isDropDisabled,u=e.isCombineEnabled,c=e.shouldClipSubject,s=r.closestScrollable,l=function(e,t){var n=fi(e);if(!t)return n;if(e!==t)return n;var r=n.paddingBox.top-t.scrollTop,o=n.paddingBox.left-t.scrollLeft,i=r+t.scrollHeight,a=o+t.scrollWidth,u=ri({top:r,right:a,bottom:i,left:o},n.border);return ai({borderBox:u,margin:n.margin,border:n.border,padding:n.padding})}(t,s),f=si(l,o),p=function(){if(!s)return null;var e=fi(s),t={scrollHeight:s.scrollHeight,scrollWidth:s.scrollWidth};return{client:e,page:si(e,o),scroll:Vc(s),scrollSize:t,shouldClipSubject:c}}();return ba({descriptor:n,isEnabled:!a,isCombineEnabled:u,isFixedOnPage:r.isFixedOnPage,direction:i,client:l,page:f,closest:p})};var Zc={passive:!1},Yc={passive:!0},Kc=function(e){return e.shouldPublishImmediately?Zc:Yc};function Xc(e){var t=Object(r.useContext)(e);return t||Object(je.a)(!1),t}var Qc=function(e){return e&&e.env.closestScrollable||null};function $c(){}var es={width:0,height:0,margin:{top:0,right:0,bottom:0,left:0}},ts=function(e){var t=e.isAnimatingOpenOnMount,n=e.placeholder,r=function(e){var t=e.isAnimatingOpenOnMount,n=e.placeholder,r=e.animate;return t?es:"close"===r?es:{height:n.client.borderBox.height,width:n.client.borderBox.width,margin:n.client.margin}}({isAnimatingOpenOnMount:t,placeholder:n,animate:e.animate});return{display:n.display,boxSizing:"border-box",width:r.width,height:r.height,marginTop:r.margin.top,marginRight:r.margin.right,marginBottom:r.margin.bottom,marginLeft:r.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:wu.placeholder}};var ns=o.a.memo(function(e){var t=Object(r.useRef)(null),n=Vr(function(){t.current&&(clearTimeout(t.current),t.current=null)},[]),i=e.animate,a=e.onTransitionEnd,u=e.onClose,c=e.styleContext,s=Object(r.useState)("open"===e.animate),l=s[0],f=s[1];Object(r.useEffect)(function(){return l?"open"!==i?(n(),f(!1),$c):t.current?$c:(t.current=setTimeout(function(){t.current=null,f(!1)}),n):$c},[i,l,n]);var p=Vr(function(e){"height"===e.propertyName&&(a(),"close"===i&&u())},[i,u,a]),d=ts({isAnimatingOpenOnMount:l,animate:e.animate,placeholder:e.placeholder});return o.a.createElement(e.placeholder.tagName,{style:d,"data-react-beautiful-dnd-placeholder":c,onTransitionEnd:p,ref:e.innerRef})}),rs=o.a.createContext(null),os=function(e){return e&&e.ownerDocument?e.ownerDocument.defaultView:window};function is(e){return e instanceof os(e).HTMLElement}var as=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state={isVisible:Boolean(t.props.on),data:t.props.on,animate:t.props.shouldAnimate&&t.props.on?"open":"none"},t.onClose=function(){"close"===t.state.animate&&t.setState({isVisible:!1})},t}return Zr(t,e),t.getDerivedStateFromProps=function(e,t){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:t.isVisible?{isVisible:!0,data:t.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:Boolean(e.on),data:e.on,animate:"none"}},t.prototype.render=function(){if(!this.state.isVisible)return null;var e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)},t}(o.a.PureComponent);var us=function(e,t){return e===t},cs=function(e){var t=e.combine,n=e.destination;return n?n.droppableId:t?t.droppableId:null},ss=function(e,t){return e===t.droppable.type},ls=function(e,t){return t.draggables[e.draggable.id]},fs=ti(function(){var e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null}},t=qr({},e,{shouldAnimatePlaceholder:!1}),n=di(function(t,n,r,o){return r.descriptor.droppableId===t?{placeholder:r.placeholder,shouldAnimatePlaceholder:!1,snapshot:o}:n?{placeholder:r.placeholder,shouldAnimatePlaceholder:!0,snapshot:o}:e}),r=di(function(e,t,n){var r=n.descriptor.id;return{isDraggingOver:t,draggingOverWith:t?r:null,draggingFromThisWith:n.descriptor.droppableId===e?r:null}});return function(o,i){var a=i.droppableId,u=i.type;if(o.isDragging){var c=o.critical;if(!ss(u,c))return e;var s=ls(c,o.dimensions),l=Bi(o.impact)===a,f=r(a,l,s);return n(a,l,s,f)}if("DROP_ANIMATING"===o.phase){var p=o.completed;if(!ss(u,p.critical))return e;var d=ls(p.critical,o.dimensions),h=r(a,cs(p.result)===a,d);return n(a,Bi(p.impact)===a,d,h)}if("IDLE"===o.phase&&!o.completed&&o.shouldFlush)return t;if("IDLE"===o.phase&&o.completed){var m=o.completed;if(!ss(u,m.critical))return e;var v=Bi(m.impact)===a,g=Boolean(m.impact.merge);return o.shouldFlush?t:v?g?e:t:e}return e}},{updateViewportMaxScroll:function(e){return{type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}}},null,{context:_c,pure:!0,areStatePropsEqual:us})(function(e){var t=Object(r.useContext)(Ac);t||Object(je.a)(!1);var n,i,a,u,c,s,l,f,p,d,h,m,v,g,y,b,w=t.style,O=t.isMovementAllowed,E=Object(r.useRef)(null),x=Object(r.useRef)(null),k=e.children,S=e.droppableId,C=e.type,j=e.direction,_=e.ignoreContainerClipping,I=e.isDropDisabled,T=e.isCombineEnabled,N=e.snapshot,A=e.updateViewportMaxScroll,P=Vr(function(){return E.current},[]),D=Vr(function(){return x.current},[]),M=Vr(function(e){E.current=e},[]),L=Vr(function(e){x.current=e},[]),R=Vr(function(){O()&&A({maxScroll:Vu()})},[O,A]);n={droppableId:S,type:C,direction:j,isDropDisabled:I,isCombineEnabled:T,ignoreContainerClipping:_,getDroppableRef:P,getPlaceholderRef:D},i=Object(r.useRef)(null),a=Xc(Ac).marshal,u=Pc(n),c=Hr(function(){return{id:n.droppableId,type:n.type}},[n.droppableId,n.type]),s=Object(r.useRef)(c),l=Hr(function(){return di(function(e,t){i.current||Object(je.a)(!1);var n={x:e,y:t};a.updateDroppableScroll(c.id,n)})},[c.id,a]),f=Vr(function(){var e=i.current;return e&&e.env.closestScrollable?Vc(e.env.closestScrollable):xi},[]),p=Vr(function(){var e=f();l(e.x,e.y)},[f,l]),d=Hr(function(){return wi(p)},[p]),h=Vr(function(){var e=i.current,t=Qc(e);e&&t||Object(je.a)(!1),e.scrollOptions.shouldPublishImmediately?p():d()},[d,p]),m=Vr(function(e,t){i.current&&Object(je.a)(!1);var n=u.current,r=n.getDroppableRef();r||Object(je.a)(!1);var o=Gc(r),a={ref:r,descriptor:c,env:o,scrollOptions:t};i.current=a;var s=Jc({ref:r,descriptor:c,env:o,windowScroll:e,direction:n.direction,isDropDisabled:n.isDropDisabled,isCombineEnabled:n.isCombineEnabled,shouldClipSubject:!n.ignoreContainerClipping});return o.closestScrollable&&o.closestScrollable.addEventListener("scroll",h,Kc(a.scrollOptions)),s},[c,h,u]),v=Vr(function(e){var t=i.current,n=Qc(t);t&&n||Object(je.a)(!1);var r=u.current,o=function(){return Jc({ref:t.ref,descriptor:t.descriptor,env:t.env,windowScroll:xi,direction:r.direction,isDropDisabled:r.isDropDisabled,isCombineEnabled:r.isCombineEnabled,shouldClipSubject:!r.ignoreContainerClipping})};return e.withoutPlaceholder?function(e,t){if(!e)return t();var n=e.style.display;e.style.display="none";var r=t();return e.style.display=n,r}(r.getPlaceholderRef(),o):o()},[u]),g=Vr(function(){var e=i.current;e||Object(je.a)(!1);var t=Qc(e);i.current=null,t&&(d.cancel(),t.removeEventListener("scroll",h,Kc(e.scrollOptions)))},[h,d]),y=Vr(function(e){var t=i.current;t||Object(je.a)(!1);var n=Qc(t);n||Object(je.a)(!1),n.scrollTop+=e.y,n.scrollLeft+=e.x},[]),b=Hr(function(){return{getDimensionAndWatchScroll:m,recollect:v,dragStopped:g,scroll:y}},[g,m,v,y]),Sc(function(){return s.current=c,a.registerDroppable(c,b),function(){i.current&&g(),a.unregisterDroppable(c)}},[b,c,g,a]),Sc(function(){i.current&&a.updateDroppableIsEnabled(s.current.id,!n.isDropDisabled)},[n.isDropDisabled,a]),Sc(function(){i.current&&a.updateDroppableIsCombineEnabled(s.current.id,n.isCombineEnabled)},[n.isCombineEnabled,a]);var F=o.a.createElement(as,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},function(e){var t=e.onClose,n=e.data,r=e.animate;return o.a.createElement(ns,{placeholder:n,onClose:t,innerRef:L,animate:r,styleContext:w,onTransitionEnd:R})}),B=Hr(function(){return{innerRef:M,placeholder:F,droppableProps:{"data-react-beautiful-dnd-droppable":w}}},[F,M,w]),z=Hr(function(){return{droppableId:S,type:C}},[S,C]);return function(e){e.props,e.getDroppableRef,e.getPlaceholderRef,Object(r.useEffect)(function(){})}({props:e,getDroppableRef:function(){return E.current},getPlaceholderRef:function(){return x.current}}),o.a.createElement(rs.Provider,{value:z},k(B,N))});fs.defaultProps={type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1};var ps={dragging:5e3,dropAnimating:4500},ds=function(e,t){return t?wu.drop(t.duration):e?wu.snap:wu.fluid},hs=function(e,t){return e?t?gu.drop:gu.combining:null},ms=function(e){return null!=e.forceShouldAnimate?e.forceShouldAnimate:"SNAP"===e.mode};function vs(e){return"DRAGGING"===e.type?(r=(n=e).dimension.client,o=n.offset,i=n.combineWith,a=n.dropping,u=Boolean(i),c=ms(n),s=Boolean(a),l=s?Eu.drop(o,u):Eu.moveTo(o),{position:"fixed",top:r.marginBox.top,left:r.marginBox.left,boxSizing:"border-box",width:r.borderBox.width,height:r.borderBox.height,transition:ds(c,a),transform:l,opacity:hs(u,s),zIndex:s?ps.dropAnimating:ps.dragging,pointerEvents:"none"}):(t=e,{transform:Eu.moveTo(t.offset),transition:t.shouldAnimateDisplacement?null:"none"});var t,n,r,o,i,a,u,c,s,l}var gs,ys,bs=function(){var e=!1;return{handle:function(){e&&Object(je.a)(!1),e=!0},isHandled:function(){return e},reset:function(){e=!1}}},ws=function(e,t){return qr({},e,t)},Os=function(e,t,n){t.forEach(function(t){var r=ws(n,t.options);e.addEventListener(t.eventName,t.fn,r)})},Es=function(e,t,n){t.forEach(function(t){var r=ws(n,t.options);e.removeEventListener(t.eventName,t.fn,r)})},xs=function(e){var t=di(function(t,n){var r={x:t,y:n};e.onMove(r)}),n=wi(function(e){return t(e.x,e.y)}),r=wi(e.onMoveUp),o=wi(e.onMoveDown),i=wi(e.onMoveRight),a=wi(e.onMoveLeft),u=wi(e.onWindowScroll);return{move:n,moveUp:r,moveDown:o,moveRight:i,moveLeft:a,windowScrollMove:u,cancel:function(){n.cancel(),r.cancel(),o.cancel(),i.cancel(),a.cancel(),u.cancel()}}},ks=27,Ss=32,Cs=37,js=38,_s=39,Is=40,Ts=(gs="visibilitychange","undefined"==typeof document?gs:qi([gs,"ms"+gs,"webkit"+gs,"moz"+gs,"o"+gs],function(e){return"on"+e in document})||gs),Ns={capture:!0},As=function(e){var t=!1,n=function(){t&&(t=!1,Es(e(),r,Ns))},r=[{eventName:"click",fn:function(e){e.preventDefault(),n()}},{eventName:"mousedown",fn:n},{eventName:"touchstart",fn:n}];return{preventNext:function(){t&&n(),t||(t=!0,Os(e(),r,Ns))},abort:n}},Ps=function(e,t){return Math.abs(t.x-e.x)>=5||Math.abs(t.y-e.y)>=5},Ds=((ys={})[13]=!0,ys[9]=!0,ys),Ms=function(e){Ds[e.keyCode]&&e.preventDefault()},Ls=0,Rs=function(){},Fs=bs();function Bs(e){return e instanceof os(e).Element}var zs,Us={input:!0,button:!0,textarea:!0,select:!0,option:!0,optgroup:!0,video:!0,audio:!0},qs=function(e,t){if(t)return!0;var n=e.target,r=e.currentTarget;return!Bs(n)||!Bs(r)||!function e(t,n){if(null==n)return!1;if(Boolean(Us[n.tagName.toLowerCase()]))return!0;var r=n.getAttribute("contenteditable");return"true"===r||""===r||n!==t&&e(t,n.parentElement)}(r,n)},Ws=function(e){return ni(e.getBoundingClientRect()).center},Hs=((zs={})[34]=!0,zs[33]=!0,zs[36]=!0,zs[35]=!0,zs);function Vs(){}var Gs=150,Js=.15,Zs=bs(),Ys=function(){},Ks=function(){var e={preventTouchMove:Ys,releaseTouchMove:Ys};if("undefined"==typeof window)return e;if(!("ontouchstart"in window))return e;var t=!1;window.addEventListener("touchmove",function(e){t&&(e.defaultPrevented||e.preventDefault())},{passive:!1,capture:!1});return{preventTouchMove:function(){t=!0},releaseTouchMove:function(){t=!1}}}();var Xs="["+wc+"]",Qs=function(e){!function(e){return Boolean(os(e).SVGElement)&&e instanceof os(e).SVGElement}(e)||Object(je.a)(!1)},$s=function(e){if(e.hasAttribute(wc))return Qs(e),e;var t=e.querySelector(Xs);return Qs(e),t||Object(je.a)(!1),is(t)||Object(je.a)(!1),t};var el,tl,nl,rl,ol=null,il={capture:!0},al=(el=!1,tl=function(){el&&(el=!1,window.removeEventListener("focus",nl,il))},nl=function(){tl(),ol=null},(rl=function(){el||(el=!0,window.addEventListener("focus",nl,il))}).cancel=function(){return tl()},rl),ul={retain:function(e){ol=e,al()},tryRestoreFocus:function(e,t){if(ol&&e===ol){ol=null,al.cancel();var n=$s(t);n&&n.focus()}}};function cl(){}function sl(e){e.preventDefault()}function ll(e){var t=Object(r.useRef)(null),n=Vr(function(e){t.current&&Object(je.a)(!1),t.current={abort:e}},[]),o=Vr(function(){t.current||Object(je.a)(!1),t.current=null},[]),i=Vr(function(){t.current||Object(je.a)(!1),t.current.abort()},[]),a=Xc(Ac),u=a.canLift,c=a.style,s=e.isDragging,l=e.isEnabled,f=e.draggableId,p=e.callbacks,d=e.getDraggableRef,h=e.getShouldRespectForcePress,m=e.canDragInteractiveElements,v=Pc(e);!function(e){var t=e.isEnabled,n=e.getDraggableRef;Object(r.useEffect)(function(){},[n,t])}({isEnabled:l,getDraggableRef:d});var g=Vr(function(){return os(d())},[d]),y=Vr(function(e){return!!l&&(!t.current&&(!!u(f)&&qs(e,m)))},[m,u,f,l]),b=function(e){var t=Object(r.useRef)(!1),n=Pc(e),o=e.getDraggableRef,i=Vr(function(){t.current=!0},[]),a=Vr(function(){t.current=!1},[]);Sc(function(){var e=n.current;if(!e.isEnabled)return cl;var r=o();r||Object(je.a)(!1);var i=$s(r);return ul.tryRestoreFocus(e.draggableId,i),function(){var e=n.current;e.isEnabled&&t.current&&(e.isDragging||e.isDropAnimating)&&ul.retain(e.draggableId)}},[o,n]);var u=Object(r.useRef)(null);return Sc(function(){if(u.current){var e=o();e&&e!==u.current&&t.current&&n.current.isEnabled&&$s(e).focus()}}),Sc(function(){u.current=o()}),{onBlur:a,onFocus:i}}(e),w=b.onBlur,O=b.onFocus,E=function(e){var t=e.canStartCapturing,n=e.getWindow,o=e.callbacks,i=e.getShouldRespectForcePress,a=e.onCaptureStart,u=e.onCaptureEnd,c=Object(r.useRef)(null),s=Object(r.useRef)(!1),l=Object(r.useRef)(Rs),f=Vr(function(){return Boolean(c.current||s.current)},[]),p=Hr(function(){return f()&&Object(je.a)(!1),xs(o)},[o,f]),d=Hr(function(){return As(n)},[n]),h=Vr(function(){if(f()){p.cancel(),l.current();var e=s.current;Fs.reset(),e&&d.preventNext(),c.current=null,s.current=!1,u()}},[f,u,d,p]),m=Vr(function(){var e=s.current;h(),e&&o.onCancel()},[o,h]),v=Vr(function(){s.current&&Object(je.a)(!1);var e=c.current;e||Object(je.a)(!1),c.current=null,s.current=!0,o.onLift({clientSelection:e,movementMode:"FLUID"})},[o]),g=Hr(function(){return f()&&Object(je.a)(!1),[{eventName:"mousemove",fn:function(e){var t=e.button,n=e.clientX,r=e.clientY;if(t===Ls){var o={x:n,y:r};if(s.current)return e.preventDefault(),void p.move(o);var i=c.current;i||(h(),Object(je.a)(!1)),Ps(i,o)&&(e.preventDefault(),v())}}},{eventName:"mouseup",fn:function(e){var t=s.current;h(),t&&(e.preventDefault(),o.onDrop())}},{eventName:"mousedown",fn:function(e){s.current&&e.preventDefault(),m()}},{eventName:"keydown",fn:function(e){if(!c.current)return e.keyCode===ks?(e.preventDefault(),void m()):void Ms(e);h()}},{eventName:"resize",fn:m},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(e){e.currentTarget===n()&&(c.current?h():p.windowScrollMove())}},{eventName:"webkitmouseforcechanged",fn:function(e){if(null!=e.webkitForce&&null!=MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN){var t=MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN,n=e.webkitForce>=t;i()?n&&m():e.preventDefault()}}},{eventName:Ts,fn:m}]},[f,m,v,p,h,o,n,i]),y=Vr(function(){var e=n(),t={capture:!0};l.current=function(){return Es(e,g,t)},Os(e,g,t)},[n,g]),b=Vr(function(e){c.current&&Object(je.a)(!1),c.current=e,a(h),y()},[y,a,h]);return Vr(function(e){if(!Fs.isHandled()&&(f()&&Object(je.a)(!1),t(e)&&e.button===Ls&&!(e.ctrlKey||e.metaKey||e.shiftKey||e.altKey))){Fs.handle(),e.preventDefault();var n={x:e.clientX,y:e.clientY};b(n)}},[t,f,b])}(Hr(function(){return{callbacks:p,getDraggableRef:d,getWindow:g,canStartCapturing:y,onCaptureStart:n,onCaptureEnd:o,getShouldRespectForcePress:h}},[p,d,g,y,n,o,h])),x=function(e){var t=e.canStartCapturing,n=e.getWindow,o=e.callbacks,i=e.onCaptureStart,a=e.onCaptureEnd,u=e.getDraggableRef,c=Object(r.useRef)(!1),s=Object(r.useRef)(Vs),l=Vr(function(){return c.current},[]),f=Hr(function(){return l()&&Object(je.a)(!1),xs(o)},[o,l]),p=Vr(function(){l()&&(f.cancel(),s.current(),c.current=!1,a())},[l,a,f]),d=Vr(function(){var e=c.current;p(),e&&o.onCancel()},[o,p]),h=Hr(function(){return l()&&Object(je.a)(!1),[{eventName:"mousedown",fn:d},{eventName:"mouseup",fn:d},{eventName:"click",fn:d},{eventName:"touchstart",fn:d},{eventName:"resize",fn:d},{eventName:"wheel",fn:d,options:{passive:!0}},{eventName:"scroll",options:{capture:!1},fn:function(e){e.currentTarget===n()&&o.onWindowScroll()}},{eventName:Ts,fn:d}]},[o,d,l,n]),m=Vr(function(){var e=n(),t={capture:!0};s.current=function(){return Es(e,h,t)},Os(e,h,t)},[n,h]),v=Vr(function(){c.current&&Object(je.a)(!1);var e=u();e||Object(je.a)(!1),c.current=!0,i(p),m();var t=Ws(e);o.onLift({clientSelection:t,movementMode:"SNAP"})},[m,o,u,i,p]);return Vr(function(e){if(!l()){if(e.defaultPrevented)return;if(!t(e))return;if(e.keyCode!==Ss)return;return e.preventDefault(),void v()}return e.keyCode===ks?(e.preventDefault(),void d()):e.keyCode===Ss?(e.preventDefault(),p(),void o.onDrop()):e.keyCode===Is?(e.preventDefault(),void f.moveDown()):e.keyCode===js?(e.preventDefault(),void f.moveUp()):e.keyCode===_s?(e.preventDefault(),void f.moveRight()):e.keyCode===Cs?(e.preventDefault(),void f.moveLeft()):void(Hs[e.keyCode]?e.preventDefault():Ms(e))},[o,t,d,l,f,v,p])}(Hr(function(){return{callbacks:p,getDraggableRef:d,getWindow:g,canStartCapturing:y,onCaptureStart:n,onCaptureEnd:o}},[p,y,d,g,o,n])),k=function(e){var t=e.callbacks,n=e.getWindow,o=e.canStartCapturing,i=e.getShouldRespectForcePress,a=e.onCaptureStart,u=e.onCaptureEnd,c=Object(r.useRef)(null),s=Object(r.useRef)(!1),l=Object(r.useRef)(!1),f=Object(r.useRef)(Ys),p=Vr(function(){return Boolean(c.current||s.current)},[]),d=Hr(function(){return As(n)},[n]),h=Hr(function(){return p()&&Object(je.a)(!1),xs(t)},[t,p]),m=Vr(function(){if(p()){if(h.cancel(),f.current(),Zs.reset(),Ks.releaseTouchMove(),l.current=!1,u(),s.current)return d.preventNext(),void(s.current=!1);var e=c.current;e||Object(je.a)(!1),clearTimeout(e.longPressTimerId),c.current=null}},[p,u,d,h]),v=Vr(function(){var e=s.current;m(),e&&t.onCancel()},[t,m]),g=Hr(function(){return p()&&Object(je.a)(!1),[{eventName:"touchmove",options:{passive:!1,capture:!1},fn:function(e){if(s.current){l.current||(l.current=!0);var t=e.touches[0],n={x:t.clientX,y:t.clientY};e.preventDefault(),h.move(n)}else m()}},{eventName:"touchend",fn:function(e){s.current?(e.preventDefault(),m(),t.onDrop()):m()}},{eventName:"touchcancel",fn:function(e){s.current?(e.preventDefault(),v()):m()}},{eventName:"touchstart",fn:v},{eventName:"orientationchange",fn:v},{eventName:"resize",fn:v},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(){c.current?m():h.windowScrollMove()}},{eventName:"contextmenu",fn:function(e){e.preventDefault()}},{eventName:"keydown",fn:function(e){s.current?(e.keyCode===ks&&e.preventDefault(),v()):v()}},{eventName:"touchforcechange",fn:function(e){i()?l.current?e.preventDefault():e.touches[0].force>=Js&&v():e.preventDefault()}},{eventName:Ts,fn:v}]},[t,v,p,i,h,m]),y=Vr(function(){var e=n(),t={capture:!0};f.current=function(){return Es(e,g,t)},Os(e,g,t)},[n,g]),b=Vr(function(){var e=c.current;e||Object(je.a)(!1),s.current=!0,c.current=null,l.current=!1,t.onLift({clientSelection:e.point,movementMode:"FLUID"})},[t]),w=Vr(function(e){c.current&&Object(je.a)(!1);var t=e.touches[0],n={point:{x:t.clientX,y:t.clientY},longPressTimerId:setTimeout(b,Gs)};c.current=n,a(m),y()},[y,a,b,m]);return function(e){Zs.isHandled()||(p()&&Object(je.a)(!1),o(e)&&(Zs.handle(),Ks.preventTouchMove(),w(e)))}}(Hr(function(){return{callbacks:p,getDraggableRef:d,getWindow:g,canStartCapturing:y,getShouldRespectForcePress:h,onCaptureStart:n,onCaptureEnd:o}},[p,d,g,y,h,n,o]));return Sc(function(){return function(){t.current&&(i(),v.current.isDragging&&v.current.callbacks.onCancel())}},[]),!l&&t.current&&(i(),v.current.isDragging&&p.onCancel()),Sc(function(){!s&&t.current&&i()},[i,s]),Hr(function(){return l?{onMouseDown:E,onKeyDown:x,onTouchStart:k,onFocus:O,onBlur:w,tabIndex:0,"data-react-beautiful-dnd-drag-handle":c,"aria-roledescription":"Draggable item. Press space bar to lift",draggable:!1,onDragStart:sl}:null},[l,w,O,x,E,k,c])}function fl(e){var t=e.draggableId,n=e.index,o=e.getDraggableRef,i=Xc(Ac).marshal,a=Xc(rs),u=a.droppableId,c=a.type,s=Hr(function(){return{id:t,droppableId:u,type:c,index:n}},[t,u,n,c]),l=Object(r.useRef)(s),f=Vr(function(e){var t=l.current,n=o();return n||Object(je.a)(!1),function(e,t,n){void 0===n&&(n=xi);var r=window.getComputedStyle(t),o=t.getBoundingClientRect(),i=li(o,r),a=si(i,n);return{descriptor:e,placeholder:{client:i,tagName:t.tagName.toLowerCase(),display:r.display},displaceBy:{x:i.marginBox.width,y:i.marginBox.height},client:i,page:a}}(t,n,e)},[o]);Sc(function(){return i.registerDraggable(l.current,f),function(){return i.unregisterDraggable(l.current)}},[f,i]),Sc(function(){if(l.current!==s){var e=l.current;l.current=s,i.updateDraggable(e,s,f)}},[s,f,i])}var pl=ti(function(){var e=di(function(e,t,n,r){return{isDragging:!0,isDropAnimating:Boolean(r),dropAnimation:r,mode:e,draggingOver:t,combineWith:n,combineTargetFor:null}}),t=di(function(e){return{isDragging:!1,isDropAnimating:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}),n={mapped:{type:"SECONDARY",offset:xi,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:t(null)}},r=di(function(e,t){return{x:e,y:t}}),o=di(function(t,n,r,o,i,a){return{mapped:{type:"DRAGGING",dropping:null,draggingOver:o,combineWith:i,mode:n,offset:t,dimension:r,forceShouldAnimate:a,snapshot:e(n,o,i,null)}}}),i=di(function(e,n,r){return void 0===n&&(n=null),{mapped:{type:"SECONDARY",offset:e,combineTargetFor:n,shouldAnimateDisplacement:r,snapshot:t(n)}}}),a=function(e,t,n){var o=n.movement.map[e],a=n.movement,u=n.merge,c=Boolean(u&&u.combine.draggableId===e),s=a.displacedBy.point,l=r(s.x,s.y);return c?i(o?l:xi,t,!o||o.shouldAnimate):o&&o.isVisible?i(l,null,o.shouldAnimate):null};return function(t,i){return function(t,n){if(t.isDragging){if(t.critical.draggable.id!==n.draggableId)return null;var i=t.current.client.offset,a=t.dimensions.draggables[n.draggableId],u=t.movementMode,c=Bi(t.impact),s=(f=t.impact).merge?f.merge.combine.draggableId:null,l=t.forceShouldAnimate;return o(r(i.x,i.y),u,a,c,s,l)}var f;if("DROP_ANIMATING"===t.phase){var p=t.completed;if(p.result.draggableId!==n.draggableId)return null;var d=t.dimensions.draggables[n.draggableId],h=p.result,m=h.mode,v=cs(h),g=function(e){return e.combine?e.combine.draggableId:null}(h),y={duration:t.dropDuration,curve:vu,moveTo:t.newHomeClientOffset,opacity:g?gu.drop:null,scale:g?yu.drop:null};return{mapped:{type:"DRAGGING",offset:t.newHomeClientOffset,dimension:d,dropping:y,draggingOver:v,combineWith:g,mode:m,forceShouldAnimate:null,snapshot:e(m,v,g,y)}}}return null}(t,i)||function(e,t){if(e.isDragging)return e.critical.draggable.id===t.draggableId?null:a(t.draggableId,e.critical.draggable.id,e.impact);if("DROP_ANIMATING"===e.phase){var n=e.completed;return n.result.draggableId===t.draggableId?null:a(t.draggableId,n.result.draggableId,n.impact)}return null}(t,i)||n}},{lift:function(e){return{type:"LIFT",payload:e}},move:pu,moveUp:function(){return{type:"MOVE_UP",payload:null}},moveDown:function(){return{type:"MOVE_DOWN",payload:null}},moveLeft:function(){return{type:"MOVE_LEFT",payload:null}},moveRight:function(){return{type:"MOVE_RIGHT",payload:null}},moveByWindowScroll:function(e){return{type:"MOVE_BY_WINDOW_SCROLL",payload:e}},drop:mu,dropAnimationFinished:function(){return{type:"DROP_ANIMATION_FINISHED",payload:null}}},null,{context:_c,pure:!0,areStatePropsEqual:us})(function(e){var t=Object(r.useRef)(null),n=Vr(function(e){t.current=e},[]),o=Vr(function(){return t.current},[]),i=Xc(Ac);Object(r.useEffect)(function(){});var a=e.children,u=e.draggableId,c=e.isDragDisabled,s=e.shouldRespectForcePress,l=e.disableInteractiveElementBlocking,f=e.index,p=e.mapped,d=e.moveUp,h=e.move,m=e.drop,v=e.moveDown,g=e.moveRight,y=e.moveLeft,b=e.moveByWindowScroll,w=e.lift,O=e.dropAnimationFinished;fl(Hr(function(){return{draggableId:u,index:f,getDraggableRef:o}},[u,o,f]));var E=Vr(function(e){Ri("LIFT"),t.current||Object(je.a)(!1),c&&Object(je.a)(!1);var n=e.clientSelection,r=e.movementMode;w({id:u,clientSelection:n,movementMode:r}),Fi("LIFT")},[u,c,w]),x=Vr(function(){return s},[s]),k=Hr(function(){return{onLift:E,onMove:function(e){return h({client:e})},onDrop:function(){return m({reason:"DROP"})},onCancel:function(){return m({reason:"CANCEL"})},onMoveUp:d,onMoveDown:v,onMoveRight:g,onMoveLeft:y,onWindowScroll:function(){return b({newScroll:Wu()})}}},[m,h,b,v,y,g,d,E]),S="DRAGGING"===p.type,C="DRAGGING"===p.type&&Boolean(p.dropping),j=ll(Hr(function(){return{draggableId:u,isDragging:S,isDropAnimating:C,isEnabled:!c,callbacks:k,getDraggableRef:o,canDragInteractiveElements:l,getShouldRespectForcePress:x}},[k,l,u,o,x,c,S,C])),_=Vr(function(e){"DRAGGING"===p.type&&p.dropping&&"transform"===e.propertyName&&O()},[O,p]);return a(Hr(function(){var e=vs(p),t="DRAGGING"===p.type&&p.dropping?_:null;return{innerRef:n,draggableProps:{"data-react-beautiful-dnd-draggable":i.style,style:e,onTransitionEnd:t},dragHandleProps:j}},[i.style,j,p,_,n]),p.snapshot)});function dl(e){return(dl="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 hl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ml(e,t){return!t||"object"!==dl(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function vl(e){return(vl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gl(e,t){return(gl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function yl(){return(yl=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}pl.defaultProps={isDragDisabled:!1,disableInteractiveElementBlocking:!1,shouldRespectForcePress:!1};var bl=Object(Re.isKeyHotkey)("tab"),wl=function(e){return o.a.createElement("div",yl({className:"wprm-admin-modal-field-ingredient-handle"},e.dragHandleProps,{tabIndex:"-1"}),o.a.createElement(Un.a,{type:"drag"}))},Ol=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ml(this,vl(t).apply(this,arguments))}var n,i,a;return function(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&&gl(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e){return JSON.stringify(this.props)!==JSON.stringify(e)}},{key:"render",value:function(){var e=this;return o.a.createElement(pl,{draggableId:"ingredient-".concat(this.props.uid),index:this.props.index},function(t,n){return"group"===e.props.type?function(e,t){return o.a.createElement("div",yl({className:"wprm-admin-modal-field-ingredient-group",ref:t.innerRef},t.draggableProps),wl(t),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-group-name-container"},o.a.createElement(jr,{singleLine:!0,className:"wprm-admin-modal-field-ingredient-group-name",toolbar:"no-styling",value:e.name,placeholder:"howto"===e.recipeType?Object(u.a)("Material Group Header"):Object(u.a)("Ingredient Group Header"),onChange:function(t){return e.onChangeName(t)},onKeyDown:function(t){bl(t)&&e.onTab(t)}})),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-after-container"},o.a.createElement(Un.a,{type:"trash",onClick:e.onDelete})))}(e.props,t):function(e,t){var n=e.amount,r=e.unit;return o.a.createElement("div",yl({className:"wprm-admin-modal-field-ingredient",ref:t.innerRef},t.draggableProps),wl(t),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-text-container"},o.a.createElement(jr,{singleLine:!0,toolbar:wprm_admin.addons.premium?"all":"no-link",className:"wprm-admin-modal-field-ingredient-amount",value:n,placeholder:"1",onChange:function(t){e.onChangeIngredient({amount:t})}}),o.a.createElement(jr,{singleLine:!0,toolbar:wprm_admin.addons.premium?"all":"no-link",value:r,placeholder:"howto"===e.recipeType?Object(u.a)("piece"):Object(u.a)("tbsp"),onChange:function(t){e.onChangeIngredient({unit:t})}}),o.a.createElement(jr,{singleLine:!0,toolbar:"ingredient",value:e.name,placeholder:"howto"===e.recipeType?Object(u.a)("paper"):Object(u.a)("olive oil"),onChange:function(t){e.onChangeIngredient({name:t,globalLink:!1})}}),o.a.createElement(jr,{singleLine:!0,toolbar:wprm_admin.addons.premium?"all":"no-link",value:e.notes,placeholder:"howto"===e.recipeType?Object(u.a)("any color"):Object(u.a)("extra virgin"),onChange:function(t){return e.onChangeIngredient({notes:t})},onKeyDown:function(t){bl(t)&&e.onTab(t)}})),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-after-container"},o.a.createElement(Un.a,{type:"trash",onClick:e.onDelete})))}(e.props,t)})}}])&&hl(n.prototype,i),a&&hl(n,a),t}();function El(e){return(El="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 xl(){return(xl=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function kl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Cl(e,t){return!t||"object"!==El(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function jl(e){return(jl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _l(e,t){return(_l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Il=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Cl(this,jl(t).call(this,e))).container=o.a.createRef(),n}var n,i,a;return function(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&&_l(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e,t){return this.props.type!==e.type||JSON.stringify(this.props.ingredients)!==JSON.stringify(e.ingredients)}},{key:"componentDidUpdate",value:function(e){if(this.props.ingredients.length>e.ingredients.length){var t=this.container.current.querySelectorAll(".wprm-admin-modal-field-ingredient-group-name, .wprm-admin-modal-field-ingredient-amount");t.length&&t[t.length-1].focus()}}},{key:"onDragEnd",value:function(e){if(e.destination){var t=JSON.parse(JSON.stringify(this.props.ingredients)),n=e.source.index,r=e.destination.index,o=t.splice(n,1)[0];t.splice(r,0,o),this.props.onRecipeChange({ingredients_flat:t})}}},{key:"addField",value:function(e){var t,n=JSON.parse(JSON.stringify(this.props.ingredients));t="group"===e?{type:"group",name:""}:{type:"ingredient",amount:"",unit:"",name:"",notes:""};var r=Math.max.apply(Math,n.map(function(e){return e.uid}));r=r<0?-1:r,t.uid=r+1,n.push(t),this.props.onRecipeChange({ingredients_flat:n})}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-edit-container",ref:this.container},o.a.createElement(Fc,{onDragEnd:this.onDragEnd.bind(this)},o.a.createElement(fs,{droppableId:"wprm-ingredients"},function(t,n){return o.a.createElement("div",xl({className:"".concat(n.isDraggingOver?" wprm-admin-modal-field-ingredient-container-draggingover":""),ref:t.innerRef},t.droppableProps),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-header-container"},o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-header"},Object(u.a)("Amount")),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-header"},Object(u.a)("Unit")),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-header"},Object(u.a)("Name")," ",o.a.createElement("span",{className:"wprm-admin-modal-field-ingredient-header-required"},"(",Object(u.a)("required"),")")),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-header"},Object(u.a)("Notes"))),e.props.ingredients.map(function(t,n){return o.a.createElement(Ol,xl({},t,{recipeType:e.props.type,index:n,key:"ingredient-".concat(t.uid),onTab:function(t){n===e.props.ingredients.length-1&&(t.preventDefault(),setTimeout(function(){e.addField("ingredient")}))},onChangeName:function(t){var r=JSON.parse(JSON.stringify(e.props.ingredients));r[n].name=t,e.props.onRecipeChange({ingredients_flat:r})},onChangeIngredient:function(t){var r=JSON.parse(JSON.stringify(e.props.ingredients));r[n]=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){kl(e,t,n[t])})}return e}({},r[n],t),e.props.onRecipeChange({ingredients_flat:r})},onDelete:function(){var t=JSON.parse(JSON.stringify(e.props.ingredients));t.splice(n,1),e.props.onRecipeChange({ingredients_flat:t})}}))}),t.placeholder)})),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-actions"},o.a.createElement("button",{className:"button",onClick:function(t){t.preventDefault(),e.addField("ingredient")}},"howto"===this.props.type?Object(u.a)("Add Material"):Object(u.a)("Add Ingredient")),o.a.createElement("button",{className:"button",onClick:function(t){t.preventDefault(),e.addField("group")}},"howto"===this.props.type?Object(u.a)("Add Material Group"):Object(u.a)("Add Ingredient Group")),o.a.createElement("p",null,Object(u.a)("Tip: use the TAB key to move from field to field and easily add ingredients."))))}}])&&Sl(n.prototype,i),a&&Sl(n,a),t}(),Tl=function(e){var t=e.ingredients;return o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-preview"},t.map(function(e,t){if("group"===e.type){if(e.name)return o.a.createElement("h3",{key:t},e.name)}else if(e.amount||e.unit||e.name||e.notes){var n="";if(e.amount&&(n+='<span className="wprm-admin-modal-field-ingredient-preview-ingredient-amount">'.concat(e.amount,"</span>")),e.unit&&(n+='<span className="wprm-admin-modal-field-ingredient-preview-ingredient-unit">'.concat(e.unit,"</span>")),e.name&&(n+='<span className="wprm-admin-modal-field-ingredient-preview-ingredient-name">'.concat(e.name,"</span>")),e.notes&&(n+='<span className="wprm-admin-modal-field-ingredient-preview-ingredient-notes">'.concat(e.notes,"</span>")),n)return o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-preview-ingredient",dangerouslySetInnerHTML:{__html:n},key:t})}return null}))},Nl=(n(791),wprm_admin.endpoints.ingredient_links),Al=function(e){var t={ingredients:e};return $n.a.call("".concat(Nl),"POST",t)},Pl=function(e){var t={links:e};return $n.a.call("".concat(Nl),"PUT",t)},Dl=n(642),Ml=n.n(Dl);function Ll(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Rl(e,t,n[t])})}return e}function Rl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Fl=function(e){var t=e.ingredient,n={url:"",nofollow:"default"},i="";if("global"===e.type||"edit-global"===e.type){if(t.hasOwnProperty("globalLink")&&!1!==t.globalLink){n=t.globalLink;var a=wprm_admin_modal.options.ingredient_link_nofollow.find(function(e){return e.value===n.nofollow});a&&(i=a.label)}}else t.hasOwnProperty("link")&&(n=t.link);var c=n&&n.url;return o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-link-container"},o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-link-ingredient"},Ml()(t.name),"edit-global"===e.type&&e.hasChanged&&o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-link-ingredient-count"},0<n.count-1?"".concat(n.count-1," ").concat(Object(u.a)("other recipe(s) affected")):Object(u.a)("This can affect other recipes"))),"global"===e.type?o.a.createElement(r.Fragment,null,e.isUpdating?o.a.createElement(p.a,null):o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-link-url".concat(c?"":" wprm-admin-modal-field-ingredient-links-link-url-none")},c?n.url:Object(u.a)("No link set")),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-link-nofollow"},c?i:""))):o.a.createElement(r.Fragment,null,o.a.createElement(E.a,{name:"ingredient-link",type:"url",value:n.url,onChange:function(t){e.onLinkChange(Ll({},n,{url:t}))}}),o.a.createElement(O.a,{options:wprm_admin_modal.options.ingredient_link_nofollow,value:n.nofollow,onChange:function(t){e.onLinkChange(Ll({},n,{nofollow:t}))},width:200})))};function Bl(e){return(Bl="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 zl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ul(e,t){return!t||"object"!==Bl(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ql(e){return(ql=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Wl(e,t){return(Wl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Hl=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Ul(this,ql(t).call(this,e))).state={isUpdating:!1},n}var n,i,a;return function(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&&Wl(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidMount",value:function(){wprm_admin.addons.premium&&this.updateGlobalLinks()}},{key:"componentDidUpdate",value:function(e){if(!this.state.isUpdating&&"custom"===this.props.type&&"global"===e.type){for(var t=JSON.parse(JSON.stringify(this.props.ingredients)),n=!1,r=0;r<t.length;r++){var o=t[r];"ingredient"===o.type&&!o.hasOwnProperty("link")&&o.hasOwnProperty("globalLink")&&o.globalLink&&(o.link={url:o.globalLink.url,nofollow:o.globalLink.nofollow},n=!0)}n&&this.props.onIngredientsChange(t)}}},{key:"updateGlobalLinks",value:function(){for(var e=this,t={},n=0;n<this.props.ingredients.length;n++){var r=this.props.ingredients[n];"ingredient"!==r.type||!r.name||r.hasOwnProperty("globalLink")&&!1!==r.globalLink||(t[n]={name:r.name})}if(0<Object.keys(t).length){var o=Object.keys(t).map(function(e){return parseInt(e)});this.setState({isUpdating:o},function(){Al(t).then(function(t){if(t&&t.links){var n=JSON.parse(JSON.stringify(e.props.ingredients));for(var r in t.links)n[parseInt(r)].globalLink=t.links[r];e.props.onIngredientsChange(n)}e.setState({isUpdating:!1})})})}}},{key:"render",value:function(){var e=this;return wprm_admin.addons.premium?this.props.ingredients.filter(function(e){return"ingredient"===e.type&&e.name}).length?o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-container"},o.a.createElement(h.a,{id:"link-type",label:Object(u.a)("Ingredient Link Type"),help:"global"===this.props.type?Object(u.a)("Global: the same link will be used for every recipe with this ingredient"):Object(u.a)("Custom: these links will only affect the recipe below")},o.a.createElement(x.a,{id:"link-type",options:[{value:"global",label:Object(u.a)("Use Global Links")},{value:"custom",label:Object(u.a)("Custom Links for this Recipe only")}],value:this.props.type,onChange:this.props.onTypeChange})),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links"},this.props.ingredients.map(function(t,n){return"group"!==t.type&&t.name?o.a.createElement(Fl,{ingredient:t,onLinkChange:function(t){var r=JSON.parse(JSON.stringify(e.props.ingredients));r[n].link=t,e.props.onIngredientsChange(r)},type:e.props.type,isUpdating:e.state.isUpdating&&e.state.isUpdating.includes(n),key:n}):null})),"global"===this.props.type&&o.a.createElement("button",{className:"button button-primary",onClick:function(){e.props.onModeChange("ingredient-links")},disabled:!1!==this.state.isUpdating},Object(u.a)("Edit Global Links"))):o.a.createElement("p",null,Object(u.a)("No ingredients set for this recipe.")):o.a.createElement("p",null,Object(u.a)("This feature is only available in")," ",o.a.createElement("a",{href:"https://bootstrapped.ventures/wp-recipe-maker/get-the-plugin/",target:"_blank"},"WP Recipe Maker Premium"),".")}}])&&zl(n.prototype,i),a&&zl(n,a),t}(),Vl=(n(959),wprm_admin.endpoints.unit_conversion),Gl=function(e){var t={ingredients:e};return $n.a.call("".concat(Vl),"POST",t)};function Jl(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;t=parseInt(t);var n=parseFloat(parseFloat(e).toFixed(t));return 0==n&&(n+=Math.pow(10,-1*t)),n}function Zl(e){e=(e=e.replace(",",".")).replace(" to ","-");var t={"¼":" 1/4","½":" 1/2","¾":" 3/4","⅐":" 1/7","⅑":" 1/9","⅒":" 1/10","⅓":" 1/3","⅔":" 2/3","⅕":" 1/5","⅖":" 2/5","⅗":" 3/5","⅘":" 4/5","⅙":" 1/6","⅚":" 5/6","⅛":" 1/8","⅜":" 3/8","⅝":" 5/8","⅞":" 7/8"},n=(e=(e=(e=(e=(e=(e+"").replace(/(\u00BC|\u00BD|\u00BE|\u2150|\u2151|\u2152|\u2153|\u2154|\u2155|\u2156|\u2157|\u2158|\u2159|\u215A|\u215B|\u215C|\u215D|\u215E)/,function(e,n){return t[n]})).replace(/(<([^>]+)>)/gi,"")).replace(/(\[([^\]]+)\])/gi,"")).replace(/[^\d\s\.\/-]/gi,"")).trim()).split(" "),r=!1;if(""!==e){r=0;for(var o=0;o<n.length;o++)if(""!==n[o].trim()){var i=n[o].split("/",2),a=parseFloat(i[0]);if(void 0!==i[1]){var u=parseFloat(i[1]);0!==u&&(a/=u)}isNaN(a)||(r+=a)}}return r}var Yl=function(e){var t=e.ingredient,n=e.isConverting,r=e.method,i=t.converted?t.converted:{2:{amount:"",unit:""}},a=function(){var e=[{label:Object(u.a)("Convert"),options:[{value:"none",label:Object(u.a)("Keep Unit")},{value:"automatic",label:Object(u.a)("Automatically")}]}],t=[];wprm_admin_modal.unit_conversion.units.weight.map(function(e){t.push({value:e,label:wprm_admin_modal.unit_conversion.units.data[e].label})}),0<t.length&&e.push({label:Object(u.a)("Weight Units"),options:t});var n=[];return wprm_admin_modal.unit_conversion.units.volume.map(function(e){n.push({value:e,label:wprm_admin_modal.unit_conversion.units.data[e].label})}),0<n.length&&e.push({label:Object(u.a)("Volume Units"),options:n}),e}(),c="".concat(t.amount," ").concat(t.unit).trim();return c="".concat(c," ").concat(t.name).trim(),t.notes&&(c+=" (".concat(t.notes,")")),o.a.createElement("tr",null,o.a.createElement("td",null,o.a.createElement(O.a,{isDisabled:n,options:a,placeholder:Object(u.a)("Convert..."),value:r,onChange:function(t){e.onMethodChange(t)},width:150})),o.a.createElement("td",{style:"failed"===r?{color:"darkred"}:null},n?o.a.createElement(p.a,null):o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-unit-conversion-fields"},o.a.createElement(jr,{singleLine:!0,value:i[2].amount,onChange:function(t){var n=i;n[2].amount=t,e.onConvertedChange(n)}}),o.a.createElement(jr,{singleLine:!0,value:i[2].unit,onChange:function(t){var n=i;n[2].unit=t,e.onConvertedChange(n)}}))),o.a.createElement("td",null,Ml()(c)))};function Kl(e){return(Kl="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 Xl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ql(e){return(Ql=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ef(e,t){return(ef=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var tf=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Kl(t)&&"function"!=typeof t?$l(e):t}(this,Ql(t).call(this,e))).state={isConverting:{},methods:{}},n.convert=n.convert.bind($l(n)),n.convertAll=n.convertAll.bind($l(n)),n}var n,i,a;return function(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&&ef(e,t)}(t,r["Component"]),n=t,(i=[{key:"convertAll",value:function(e){for(var t=[],n=0;n<this.props.ingredients.length;n++){"ingredient"===this.props.ingredients[n].type&&t.push(n)}t&&this.convert(t,e)}},{key:"convert",value:function(e,t){var n=this,r=this.state.isConverting,o=this.state.methods;if("none"===t){var i=JSON.parse(JSON.stringify(this.props.ingredients)),a=!0,u=!1,c=void 0;try{for(var s,l=e[Symbol.iterator]();!(a=(s=l.next()).done);a=!0){var f=s.value,p=this.props.ingredients[f];p.hasOwnProperty("converted")||(i[f].converted={2:{}}),i[f].converted[2].amount=p.amount,i[f].converted[2].unit=p.unit,r[f]=!1,o[f]=t}}catch(e){u=!0,c=e}finally{try{a||null==l.return||l.return()}finally{if(u)throw c}}this.props.onIngredientsChange(i)}else{var d={},h=!0,m=!1,v=void 0;try{for(var g,y=e[Symbol.iterator]();!(h=(g=y.next()).done);h=!0){var b=g.value,w=this.props.ingredients[b];d[b]={index:b,amount:Zl(w.amount),unit:w.unit,name:w.name},"automatic"!==t&&(d[b].units_to=[t]),r[b]=!0,o[b]=t}}catch(e){m=!0,v=e}finally{try{h||null==y.return||y.return()}finally{if(m)throw v}}Gl(d).then(function(e){if(e&&e.conversions){var r=JSON.parse(JSON.stringify(n.props.ingredients)),o=n.state.isConverting,i=n.state.methods;for(var a in e.conversions){var u=n.props.ingredients[parseInt(a)],c=e.conversions[a];u.hasOwnProperty("converted")||(r[a].converted={2:{}}),"none"===c.type||"failed"===c.type?(r[a].converted[2].amount=u.amount,r[a].converted[2].unit=u.unit,i[a]=c.type):(r[a].converted[2].amount=Jl(c.amount,wprmp_admin.settings.unit_conversion_round_to_decimals),r[a].converted[2].unit=c.alias,i[a]=t),o[a]=!1}n.props.onIngredientsChange(r),n.setState({isConverting:o,methods:i})}})}this.setState({isConverting:r,methods:o})}},{key:"render",value:function(){var e=this;return wprm_admin.addons.pro?wprm_admin_modal.unit_conversion?this.props.ingredients.filter(function(e){return"ingredient"===e.type&&e.name}).length?o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-unit-conversion-container"},o.a.createElement("table",{className:"wprm-admin-modal-field-ingredient-unit-conversion"},o.a.createElement("thead",null,o.a.createElement("tr",null,o.a.createElement("th",null,Object(u.a)("Conversion")),o.a.createElement("th",null,Object(u.a)("Converted")," (",wprm_admin_modal.unit_conversion.systems[2],")"),o.a.createElement("th",null,Object(u.a)("Default")," (",wprm_admin_modal.unit_conversion.systems[1],")"))),o.a.createElement("tbody",null,this.props.ingredients.map(function(t,n){return"group"!==t.type&&t.name?o.a.createElement(Yl,{ingredient:t,isConverting:e.state.isConverting[n],method:e.state.methods[n],onMethodChange:function(t){e.state.isConverting[n]||e.convert([n],t)},onConvertedChange:function(t){var r=JSON.parse(JSON.stringify(e.props.ingredients));r[n].converted=t,e.props.onIngredientsChange(r)},key:n}):null}))),o.a.createElement("button",{className:"button button-primary",onClick:function(t){t.preventDefault(),e.convertAll("automatic")}},Object(u.a)("Convert All Automatically"))):o.a.createElement("p",null,Object(u.a)("No ingredients set for this recipe.")):o.a.createElement("p",null,Object(u.a)("You need to set up this feature on the WP Recipe Maker > Settings > Unit Conversion page first.")):o.a.createElement("p",null,Object(u.a)("This feature is only available in")," ",o.a.createElement("a",{href:"https://bootstrapped.ventures/wp-recipe-maker/get-the-plugin/",target:"_blank"},"WP Recipe Maker Pro Bundle"),".")}}])&&Xl(n.prototype,i),a&&Xl(n,a),t}();function nf(e){return(nf="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 rf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function of(e,t){return!t||"object"!==nf(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function af(e){return(af=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function uf(e,t){return(uf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var cf=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=of(this,af(t).call(this,e))).state={mode:"edit"},n}var n,i,a;return function(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&&uf(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e,t){return this.state.mode!==t.mode||this.props.type!==e.type||this.props.linkType!==e.linkType||JSON.stringify(this.props.ingredients)!==JSON.stringify(e.ingredients)}},{key:"render",value:function(){var e=this,t=[{id:"edit",label:"howto"===this.props.type?Object(u.a)("Edit Materials"):Object(u.a)("Edit Ingredients")},{id:"ingredient-links",label:"howto"===this.props.type?Object(u.a)("Material Links"):Object(u.a)("Ingredient Links")},{id:"unit-conversion",label:Object(u.a)("Unit Conversion")}],n=null;switch(this.state.mode){case"unit-conversion":n=o.a.createElement(tf,{ingredients:this.props.ingredients,onIngredientsChange:function(t){e.props.onRecipeChange({ingredients_flat:t})}});break;case"ingredient-links":n=o.a.createElement(Hl,{ingredients:this.props.ingredients,onIngredientsChange:function(t){e.props.onRecipeChange({ingredients_flat:t})},type:this.props.linkType,onTypeChange:function(t){e.props.onRecipeChange({ingredient_links_type:t})},onModeChange:this.props.onModeChange});break;case"preview":n=o.a.createElement(Tl,{ingredients:this.props.ingredients});break;default:n=o.a.createElement(Il,{type:this.props.type,ingredients:this.props.ingredients,onRecipeChange:this.props.onRecipeChange})}return o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-container"},o.a.createElement(Br,{modes:t,mode:this.state.mode,onModeChange:function(t){e.setState({mode:t})}}),n)}}])&&rf(n.prototype,i),a&&rf(n,a),t}();n(960);function sf(e){return(sf="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 lf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ff(e,t){return!t||"object"!==sf(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pf(e){return(pf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function df(e,t){return(df=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function hf(){return(hf=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var mf=Object(Re.isKeyHotkey)("tab"),vf=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ff(this,pf(t).apply(this,arguments))}var n,i,a;return function(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&&df(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e){return JSON.stringify(this.props)!==JSON.stringify(e)}},{key:"render",value:function(){var e=this;return o.a.createElement(pl,{draggableId:"equipment-".concat(this.props.uid),index:this.props.index},function(t,n){return o.a.createElement("div",hf({className:"wprm-admin-modal-field-equipment",ref:t.innerRef},t.draggableProps),o.a.createElement("div",{className:"wprm-admin-modal-field-equipment-main-container"},function(e){return o.a.createElement("div",hf({className:"wprm-admin-modal-field-equipment-handle"},e.dragHandleProps,{tabIndex:"-1"}),o.a.createElement(Un.a,{type:"drag"}))}(t),o.a.createElement("div",{className:"wprm-admin-modal-field-equipment-name-container"},o.a.createElement(jr,{singleLine:!0,toolbar:"equipment",value:e.props.name,placeholder:"howto"===e.props.recipeType?Object(u.a)("Pair of scissors"):Object(u.a)("Pressure cooker"),onChange:function(t){return e.props.onChangeName(t)},onKeyDown:function(t){mf(t)&&e.props.onTab(t)}}))),o.a.createElement("div",{className:"wprm-admin-modal-field-equipment-after-container"},o.a.createElement(Un.a,{type:"trash",onClick:e.props.onDelete})))})}}])&&lf(n.prototype,i),a&&lf(n,a),t}();function gf(e){return(gf="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 yf(){return(yf=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function bf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function wf(e,t){return!t||"object"!==gf(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Of(e){return(Of=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ef(e,t){return(Ef=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var xf=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=wf(this,Of(t).call(this,e))).container=o.a.createRef(),n}var n,i,a;return function(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&&Ef(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e){return this.props.type!==e.type||JSON.stringify(this.props.equipment)!==JSON.stringify(e.equipment)}},{key:"componentDidUpdate",value:function(e){if(this.props.equipment.length>e.equipment.length){var t=this.container.current.querySelectorAll(".wprm-admin-modal-field-richtext");t.length&&t[t.length-1].focus()}}},{key:"onDragEnd",value:function(e){if(e.destination){var t=JSON.parse(JSON.stringify(this.props.equipment)),n=e.source.index,r=e.destination.index,o=t.splice(n,1)[0];t.splice(r,0,o),this.props.onRecipeChange({equipment:t})}}},{key:"addField",value:function(){var e=JSON.parse(JSON.stringify(this.props.equipment)),t={name:""},n=Math.max.apply(Math,e.map(function(e){return e.uid}));n=n<0?-1:n,t.uid=n+1,e.push(t),this.props.onRecipeChange({equipment:e})}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"wprm-admin-modal-field-equipment-container",ref:this.container},o.a.createElement(Fc,{onDragEnd:this.onDragEnd.bind(this)},o.a.createElement(fs,{droppableId:"wprm-equipment"},function(t,n){return o.a.createElement("div",yf({className:"".concat(n.isDraggingOver?" wprm-admin-modal-field-equipment-container-draggingover":""),ref:t.innerRef},t.droppableProps),e.props.equipment.map(function(t,n){return o.a.createElement(vf,yf({},t,{recipeType:e.props.type,index:n,key:"equipment-".concat(t.uid),onTab:function(t){n===e.props.equipment.length-1&&(t.preventDefault(),setTimeout(function(){e.addField()}))},onChangeName:function(t){var r=JSON.parse(JSON.stringify(e.props.equipment));r[n].name=t,e.props.onRecipeChange({equipment:r})},onDelete:function(){var t=JSON.parse(JSON.stringify(e.props.equipment));t.splice(n,1),e.props.onRecipeChange({equipment:t})}}))}),t.placeholder)})),o.a.createElement("div",{className:"wprm-admin-modal-field-equipment-actions"},o.a.createElement("button",{className:"button",onClick:function(t){t.preventDefault(),e.addField()}},Object(u.a)("Add Equipment")),o.a.createElement("p",null,Object(u.a)("Tip: use the TAB key to move from field to field and easily add equipment."))))}}])&&bf(n.prototype,i),a&&bf(n,a),t}();n(961);function kf(e){return(kf="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 Sf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Cf(e,t){return!t||"object"!==kf(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function jf(e){return(jf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _f(e,t){return(_f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function If(){return(If=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var Tf=Object(Re.isKeyHotkey)("tab"),Nf=function(e){return o.a.createElement("div",If({className:"wprm-admin-modal-field-instruction-handle"},e.dragHandleProps,{tabIndex:"-1"}),o.a.createElement(Un.a,{type:"drag"}))},Af=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Cf(this,jf(t).apply(this,arguments))}var n,i,a;return function(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&&_f(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e){return JSON.stringify(this.props)!==JSON.stringify(e)}},{key:"render",value:function(){var e=this;return o.a.createElement(pl,{draggableId:"instruction-".concat(this.props.uid),index:this.props.index},function(t,n){return"group"===e.props.type?function(e,t){return o.a.createElement("div",If({className:"wprm-admin-modal-field-instruction-group",ref:t.innerRef},t.draggableProps),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-main-container"},Nf(t),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-group-name-container"},o.a.createElement(jr,{singleLine:!0,toolbar:"no-styling",value:e.name,placeholder:Object(u.a)("Instruction Group Header"),onChange:function(t){return e.onChangeText(t)},onKeyDown:function(t){Tf(t)&&e.onTab(t)}}))),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-after-container"},o.a.createElement(Un.a,{type:"trash",onClick:e.onDelete})))}(e.props,t):function(e,t){return o.a.createElement("div",If({className:"wprm-admin-modal-field-instruction",ref:t.innerRef},t.draggableProps),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-main-container"},Nf(t),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-text-container"},o.a.createElement(jr,{value:e.text,placeholder:Object(u.a)("This is one step of the instructions."),onChange:function(t){return e.onChangeText(t)},onKeyDown:function(t){Tf(t)&&e.onTab(t)}}))),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-after-container"},o.a.createElement(Un.a,{type:"trash",onClick:e.onDelete}),o.a.createElement(g.a,{id:e.image,url:e.image_url,onChange:function(t,n){return e.onChangeImage(t,n)},disableTab:!0})))}(e.props,t)})}}])&&Sf(n.prototype,i),a&&Sf(n,a),t}();function Pf(e){return(Pf="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 Df(){return(Df=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Mf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Lf(e,t){return!t||"object"!==Pf(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Rf(e){return(Rf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ff(e,t){return(Ff=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Bf=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Lf(this,Rf(t).call(this,e))).container=o.a.createRef(),n}var n,i,a;return function(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&&Ff(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e){return JSON.stringify(this.props.instructions)!==JSON.stringify(e.instructions)}},{key:"componentDidUpdate",value:function(e){if(this.props.instructions.length>e.instructions.length){var t=this.container.current.querySelectorAll(".wprm-admin-modal-field-richtext");t.length&&t[t.length-1].focus()}}},{key:"onDragEnd",value:function(e){if(e.destination){var t=JSON.parse(JSON.stringify(this.props.instructions)),n=e.source.index,r=e.destination.index,o=t.splice(n,1)[0];t.splice(r,0,o),this.props.onRecipeChange({instructions_flat:t})}}},{key:"addField",value:function(e){var t,n=JSON.parse(JSON.stringify(this.props.instructions));t="group"===e?{type:"group",name:""}:{type:"instruction",text:"",image:0,image_url:""};var r=Math.max.apply(Math,n.map(function(e){return e.uid}));r=r<0?-1:r,t.uid=r+1,n.push(t),this.props.onRecipeChange({instructions_flat:n})}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-container",ref:this.container},o.a.createElement(Fc,{onDragEnd:this.onDragEnd.bind(this)},o.a.createElement(fs,{droppableId:"wprm-instructions"},function(t,n){return o.a.createElement("div",Df({className:"".concat(n.isDraggingOver?" wprm-admin-modal-field-instruction-container-draggingover":""),ref:t.innerRef},t.droppableProps),e.props.instructions.map(function(t,n){return o.a.createElement(Af,Df({},t,{index:n,key:"instruction-".concat(t.uid),onTab:function(t){n===e.props.instructions.length-1&&(t.preventDefault(),setTimeout(function(){e.addField("instruction")}))},onChangeText:function(r){var o=JSON.parse(JSON.stringify(e.props.instructions));"group"===t.type?o[n].name=r:o[n].text=r,e.props.onRecipeChange({instructions_flat:o})},onChangeImage:function(t,r){var o=JSON.parse(JSON.stringify(e.props.instructions));o[n].image=t,o[n].image_url=r,e.props.onRecipeChange({instructions_flat:o})},onDelete:function(){var t=JSON.parse(JSON.stringify(e.props.instructions));t.splice(n,1),e.props.onRecipeChange({instructions_flat:t})}}))}),t.placeholder)})),o.a.createElement("div",{className:"wprm-admin-modal-field-instruction-actions"},o.a.createElement("button",{className:"button",onClick:function(t){t.preventDefault(),e.addField("instruction")}},Object(u.a)("Add Instruction")),o.a.createElement("button",{className:"button",onClick:function(t){t.preventDefault(),e.addField("group")}},Object(u.a)("Add Instruction Group")),o.a.createElement("p",null,Object(u.a)("Tip: use the TAB key to move from field to field and easily add instructions."))))}}])&&Mf(n.prototype,i),a&&Mf(n,a),t}(),zf=n(412),Uf=n(175);n(962);function qf(e){return(qf="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 Wf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Hf(e,t,n[t])})}return e}function Hf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Gf(e,t){return!t||"object"!==qf(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Jf(e){return(Jf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Zf(e,t){return(Zf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Yf=-1!==Object.values(wprm_admin_modal.nutrition).findIndex(function(e){return"calculated"===e.type}),Kf=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Gf(this,Jf(t).call(this,e))).state={calculating:!1},n}var n,i,a;return function(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&&Zf(e,t)}(t,r["Component"]),n=t,(i=[{key:"shouldComponentUpdate",value:function(e,t){return this.state.calculing!==t.calculating||JSON.stringify(this.props.servings)!==JSON.stringify(e.servings)||JSON.stringify(this.props.nutrition)!==JSON.stringify(e.nutrition)}},{key:"componentDidMount",value:function(){this.calculateNutrients()}},{key:"componentDidUpdate",value:function(e){JSON.stringify(this.props.nutrition)!==JSON.stringify(e.nutrition)&&this.calculateNutrients()}},{key:"calculateNutrients",value:function(){var e=this;Yf&&wprm_admin.addons.pro&&this.setState({calculating:!0},function(){zf.a.getCalculated(e.props.nutrition).then(function(t){t&&Object.keys(t.calculated).length>0&&e.props.onRecipeChange({nutrition:Wf({},e.props.nutrition,t.calculated)}),e.setState({calculating:!1})})})}},{key:"render",value:function(){var e=this,t=this.props,n=t.nutrition.hasOwnProperty("serving_size")&&t.nutrition.serving_size?t.nutrition.serving_size:"",i=t.nutrition.hasOwnProperty("serving_unit")&&t.nutrition.serving_unit?t.nutrition.serving_unit:"";return o.a.createElement(r.Fragment,null,o.a.createElement("p",null,Object(u.a)("These should be the nutrition facts for 1 serving of your recipe."),o.a.createElement("br",null),t.servings.amount?o.a.createElement(r.Fragment,null,Object(u.a)("Total servings for this recipe:")," ","".concat(t.servings.amount," ").concat(t.servings.unit)):o.a.createElement(r.Fragment,null,Object(u.a)('You don\'t have the servings field set for your recipe under "General".'))),o.a.createElement("div",{className:"wprm-admin-modal-field-nutrition-container"},wprm_admin.addons.premium?o.a.createElement(h.a,{id:"nutrition_serving_size",label:Object(u.a)("Serving Size"),help:Object(u.a)("The weight of 1 serving. Does not affect the calculation.")},o.a.createElement(E.a,{type:"number",value:n,onChange:function(e){var n=Wf({},t.nutrition,{serving_size:e});t.onRecipeChange({nutrition:n})}}),o.a.createElement(E.a,{name:"serving-unit",placeholder:Object(u.a)("g"),value:i,onChange:function(e){var n=Wf({},t.nutrition,{serving_unit:e});t.onRecipeChange({nutrition:n})}})):null,Object.keys(wprm_admin_modal.nutrition).map(function(n,i){var a=wprm_admin_modal.nutrition[n],u=t.nutrition.hasOwnProperty(n)?t.nutrition[n]:"";return"serving_size"===n?null:"calories"===n||wprm_admin.addons.premium?o.a.createElement(h.a,{id:"nutrition_".concat(n),label:a.label,key:i},"calculated"===a.type&&e.state.calculating?o.a.createElement(p.a,null):o.a.createElement(r.Fragment,null,o.a.createElement(E.a,{type:"number",value:u,onChange:function(e){var r=Wf({},t.nutrition,Hf({},n,e));t.onRecipeChange({nutrition:r})},disabled:"calculated"===a.type}),o.a.createElement("span",{className:"wprm-admin-modal-field-nutrition-unit"},a.unit))):null})),wprm_admin.addons.premium?null:o.a.createElement("p",null,Object(u.a)("More nutrients are available in")," ",o.a.createElement("a",{href:"https://bootstrapped.ventures/wp-recipe-maker/get-the-plugin/",target:"_blank"},"WP Recipe Maker Premium"),"."),o.a.createElement(Uf.a,{isPrimary:!0,required:"pro",onClick:function(){t.onModeChange("nutrition-calculation")}},Object(u.a)("Calculate Nutrition Facts")))}}])&&Vf(n.prototype,i),a&&Vf(n,a),t}(),Xf=(n(963),wprm_admin_modal.custom_fields&&wprm_admin_modal.custom_fields.fields?Object.values(wprm_admin_modal.custom_fields.fields):[]),Qf=function(e){return o.a.createElement(r.Fragment,null,Xf.map(function(t,n){var r=!!e.fields.hasOwnProperty(t.key)&&e.fields[t.key];switch(t.type){case"text":case"link":case"email":var i="link"===t.type?"url":t.type;return o.a.createElement(h.a,{label:t.name,key:n},o.a.createElement(E.a,{type:i,name:"recipe-custom-".concat(t.key),value:r||"",onChange:function(n){e.onFieldChange(t.key,n)}}));case"textarea":return o.a.createElement(h.a,{label:t.name,key:n},o.a.createElement(jr,{value:r||"",onChange:function(n){e.onFieldChange(t.key,n)}}));case"image":return o.a.createElement(h.a,{label:t.name,key:n},o.a.createElement(g.a,{id:r?r.id:0,url:r?r.url:"",onChange:function(n,r){e.onFieldChange(t.key,{id:n,url:r})}}))}}))};n(964);function $f(e){return($f="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 ep(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function tp(e){return(tp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function np(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rp(e,t){return(rp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var op=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==$f(t)&&"function"!=typeof t?np(e):t}(this,tp(t).call(this,e));var r=parseInt(wprm_admin_modal.editor_uid);return wprm_admin_modal.editor_uid=r+1,n.state={editorHtml:!1,addedListeners:!1,editorId:"wprm-admin-modal-notes-editor-".concat(r)},n.initEditor=n.initEditor.bind(np(n)),n.initTinyMCE=n.initTinyMCE.bind(np(n)),n}var n,i,a;return function(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&&rp(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidMount",value:function(){var e=document.getElementById("wprm-admin-modal-notes-placeholder").innerHTML;e=e.replace(/wprm-admin-modal-notes-editor/g,this.state.editorId),this.setState({editorHtml:e})}},{key:"componentDidUpdate",value:function(e,t){this.state.editorHtml&&!t.editorHtml&&this.initEditor()}},{key:"initEditor",value:function(){void 0!==window.tinymce?this.initTinyMCE():this.initTextarea()}},{key:"initTextarea",value:function(){var e=this,t=document.getElementById(this.state.editorId);void 0!==window.quicktags&&window.quicktags({id:this.state.editorId}),t&&(t.value=this.props.value,["input","blur"].forEach(function(n){t.addEventListener(n,function(){e.props.onChange(t.value)})}))}},{key:"initTinyMCE",value:function(){var e=this;document.getElementById("wp-".concat(this.state.editorId,"-editor-container")).outerHTML='<textarea id="'.concat(this.state.editorId,'"></textarea>');var t=tinymce.$("#wp-".concat(this.state.editorId,"-wrap"));t.removeClass("tmce-active").addClass("html-active"),this.initTextarea(),t.removeClass("html-active").addClass("tmce-active");var n={};void 0!==window.tinyMCEPreInit&&tinyMCEPreInit.hasOwnProperty("mceInit")&&tinyMCEPreInit.mceInit.hasOwnProperty("wprm-admin-modal-notes-editor")&&(n=tinyMCEPreInit.mceInit["wprm-admin-modal-notes-editor"]),n.hasOwnProperty("body_class")&&(n.body_class=n.body_class.replace(/wprm-admin-modal-notes-editor/g,this.state.editorId)),n.selector="#".concat(this.state.editorId),window.tinymce.init(n);var r=window.tinymce.get(this.state.editorId);r&&r.on("change",function(){e.props.onChange(r.getContent())})}},{key:"componentWillUnmount",value:function(){void 0!==window.tinyMCE&&window.tinyMCE.remove("#".concat(this.state.editorId))}},{key:"render",value:function(){return this.state.editorHtml?o.a.createElement("div",{id:"wprm-admin-modal-field-tinymce-container",dangerouslySetInnerHTML:{__html:this.state.editorHtml}}):o.a.createElement(p.a,null)}}])&&ep(n.prototype,i),a&&ep(n,a),t}(),ip=function(e){return o.a.createElement(h.a,{label:Object(u.a)("Recipe Notes")},o.a.createElement(op,{id:"recipe-notes",value:e.notes,onChange:function(t){e.onRecipeChange({notes:t})}}))},ap=function(e){var t=[{id:"import",name:Object(u.a)("Import"),elem:o.a.createElement(v,{onModeChange:e.onModeChange,onRecipeChange:e.onRecipeChange})},{id:"media",name:Object(u.a)("Media"),elem:o.a.createElement(w,{image:{id:e.recipe.image_id,url:e.recipe.image_url},pinImage:{id:e.recipe.pin_image_id,url:e.recipe.pin_image_url},video:{id:e.recipe.video_id,thumb:e.recipe.video_thumb_url,embed:e.recipe.video_embed},onRecipeChange:e.onRecipeChange})},{id:"general",name:Object(u.a)("General"),elem:o.a.createElement(_r,{type:e.recipe.type,name:e.recipe.name,summary:e.recipe.summary,author:{display:e.recipe.author_display,name:e.recipe.author_name,link:e.recipe.author_link},servings:{amount:e.recipe.servings,unit:e.recipe.servings_unit},cost:e.recipe.cost,onRecipeChange:e.onRecipeChange})},{id:"times",name:Object(u.a)("Times"),elem:o.a.createElement(Tr,{type:e.recipe.type,prep:{time:e.recipe.prep_time,zero:e.recipe.prep_time_zero},cook:{time:e.recipe.cook_time,zero:e.recipe.cook_time_zero},custom:{time:e.recipe.custom_time,zero:e.recipe.custom_time_zero},customLabel:e.recipe.custom_time_label,total:{time:e.recipe.total_time,zero:!1},onRecipeChange:e.onRecipeChange})},{id:"categories",name:Object(u.a)("Categories"),elem:o.a.createElement(Fr,{tags:e.recipe.tags,onRecipeChange:e.onRecipeChange})},{id:"equipment",name:Object(u.a)("Equipment"),elem:o.a.createElement(xf,{type:e.recipe.type,equipment:e.recipe.equipment,onRecipeChange:e.onRecipeChange})},{id:"ingredients",name:"howto"===e.recipe.type?Object(u.a)("Materials"):Object(u.a)("Ingredients"),elem:o.a.createElement(cf,{type:e.recipe.type,ingredients:e.recipe.ingredients_flat,linkType:e.recipe.ingredient_links_type,onRecipeChange:e.onRecipeChange,onModeChange:e.onModeChange})},{id:"instructions",name:Object(u.a)("Instructions"),elem:o.a.createElement(Bf,{instructions:e.recipe.instructions_flat,onRecipeChange:e.onRecipeChange})}];return"howto"!==e.recipe.type&&t.push({id:"nutrition",name:Object(u.a)("Nutrition"),elem:o.a.createElement(Kf,{nutrition:e.recipe.nutrition,servings:{amount:e.recipe.servings,unit:e.recipe.servings_unit},onRecipeChange:e.onRecipeChange,onModeChange:e.onModeChange})}),wprm_admin_modal.custom_fields&&wprm_admin_modal.custom_fields.fields&&0<Object.keys(wprm_admin_modal.custom_fields.fields).length&&t.push({id:"custom-fields",name:Object(u.a)("Custom Fields"),elem:o.a.createElement(Qf,{fields:e.recipe.custom_fields,onFieldChange:function(t,n){var r=Object.assign({},JSON.parse(JSON.stringify(e.recipe.custom_fields)));r[t]=n,e.onRecipeChange({custom_fields:r})}})}),t.push({id:"notes",name:Object(u.a)("Notes"),elem:o.a.createElement(ip,{notes:e.recipe.notes,onRecipeChange:e.onRecipeChange})}),o.a.createElement(r.Fragment,null,o.a.createElement(l.a,{onCloseModal:e.onCloseModal},e.loadingRecipe?Object(u.a)("Loading Recipe..."):o.a.createElement(r.Fragment,null,e.recipe.id?"".concat(Object(u.a)("Editing Recipe")," #").concat(e.recipe.id).concat(e.recipe.name?" - ".concat(e.recipe.name):""):"".concat(Object(u.a)("Creating new Recipe")).concat(e.recipe.name?" - ".concat(e.recipe.name):""))),o.a.createElement("div",{className:"wprm-admin-modal-recipe-quicklinks"},t.map(function(e,t){return o.a.createElement(i.Link,{to:"wprm-admin-modal-fields-group-".concat(e.id),containerId:"wprm-admin-modal-recipe-content",className:"wprm-admin-modal-recipe-quicklink",activeClass:"active",spy:!0,offset:-10,smooth:!0,duration:400,key:t},e.name)})),o.a.createElement(i.Element,{className:"wprm-admin-modal-content",id:"wprm-admin-modal-recipe-content"},e.loadingRecipe?o.a.createElement(p.a,null):o.a.createElement("form",{className:"wprm-admin-modal-recipe-fields"},t.map(function(t,n){return o.a.createElement(d,{header:t.name,id:t.id,key:100*e.forceRerender+n},t.elem)}))),o.a.createElement("div",{id:"wprm-admin-modal-toolbar-container"}),o.a.createElement(f.a,{savingChanges:e.savingChanges},"failed"===e.saveResult?o.a.createElement(s.a,{text:JSON.stringify(e.recipe),onCopy:function(e,t){t?alert(Object(u.a)('The recipe has been copied and can be used in the "Import from JSON" feature.')):alert(Object(u.a)("Something went wrong. Please contact support."))}},o.a.createElement("a",{href:"#",onClick:function(e){e.preventDefault()}},Object(u.a)("Copy JSON to Clipboard"))):null,"ok"===e.saveResult?o.a.createElement("span",null,Object(u.a)("Saved successfully")):null,o.a.createElement("button",{className:"button button-primary",onClick:function(){e.saveRecipe(!1)},disabled:!e.changesMade},Object(u.a)("Save")),o.a.createElement("button",{className:"button button-primary",onClick:function(){e.changesMade?e.saveRecipe(!0):e.onCloseModal()}},e.changesMade?Object(u.a)("Save & Close"):Object(u.a)("Close"))))};function up(e){return(up="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 cp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function sp(e){return(sp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function lp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fp(e,t){return(fp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var pp=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==up(t)&&"function"!=typeof t?lp(e):t}(this,sp(t).call(this,e))).state={isSaving:!1,ingredients:JSON.parse(JSON.stringify(n.props.ingredients))},n.saveLinks=n.saveLinks.bind(lp(n)),n}var n,i,a;return function(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&&fp(e,t)}(t,r["Component"]),n=t,(i=[{key:"saveLinks",value:function(){var e=this,t=this.state.ingredients.filter(function(t,n){return!1!==t.globalLink&&JSON.stringify(t)!==JSON.stringify(e.props.ingredients[n])}).map(function(e){return{name:e.name,url:e.globalLink.url,nofollow:e.globalLink.nofollow}});this.setState({isSaving:!0},function(){Pl(t).then(function(t){t?e.props.onIngredientsChange(e.state.ingredients):e.setState({isSaving:!1})})})}},{key:"render",value:function(){var e=this,t=JSON.stringify(this.props.ingredients)!==JSON.stringify(this.state.ingredients);return o.a.createElement(r.Fragment,null,o.a.createElement(l.a,{onCloseModal:this.props.onCloseModal},Object(u.a)("Editing Global Ingredient Links")),o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links-container wprm-admin-modal-field-ingredient-links-edit-container"},o.a.createElement("div",{className:"wprm-admin-modal-field-ingredient-links"},this.state.ingredients.map(function(t,n){return"group"!==t.type&&t.name?o.a.createElement(Fl,{ingredient:t,onLinkChange:function(t){var r=JSON.parse(JSON.stringify(e.state.ingredients));r[n].globalLink=t,e.setState({ingredients:r})},type:"edit-global",hasChanged:JSON.stringify(t)!==JSON.stringify(e.props.ingredients[n]),isUpdating:!1,key:n}):null}))),o.a.createElement(f.a,{savingChanges:this.state.isSaving},o.a.createElement("button",{className:"button",onClick:this.props.onCancel},Object(u.a)("Cancel")),o.a.createElement("button",{className:"button button-primary",onClick:this.saveLinks,disabled:!t},Object(u.a)("Save Changes"))))}}])&&cp(n.prototype,i),a&&cp(n,a),t}(),dp=(n(965),function(e){return e.ingredients.length?o.a.createElement("table",{className:"wprm-admin-modal-recipe-nutrition-calculation-source"},o.a.createElement("thead",null,o.a.createElement("tr",null,o.a.createElement("th",null,Object(u.a)("Used in Recipe")),o.a.createElement("th",null,Object(u.a)("Used for Calculation")),o.a.createElement("th",null,Object(u.a)("Nutrition Source")),o.a.createElement("th",null,Object(u.a)("API Match")))),o.a.createElement("tbody",null,e.ingredients.map(function(t,n){var r=!1;return t.nutrition.match&&"api"===t.nutrition.source&&t.nutrition.match.id&&"custom"!==t.nutrition.match.source&&(r=!0),o.a.createElement("tr",{key:n},o.a.createElement("td",null,"".concat(t.amount," ").concat(t.unit)),o.a.createElement("td",null,o.a.createElement(E.a,{type:"number",value:t.nutrition.amount,onChange:function(t){e.onIngredientChange(n,{amount:t})}}),o.a.createElement(E.a,{value:t.nutrition.unit,onChange:function(t){e.onIngredientChange(n,{unit:t})}}),t.name," ",t.notes?" (".concat(t.notes,")"):""),o.a.createElement("td",null,o.a.createElement(O.a,{options:[{value:"api",label:Object(u.a)("API")},{value:"custom",label:Object(u.a)("Saved/Custom")}],value:t.nutrition.source,onChange:function(t){e.onIngredientChange(n,{source:t})},width:150})),o.a.createElement("td",null,"api"===t.nutrition.source&&o.a.createElement("a",{href:"#",onClick:function(t){t.preventDefault(),e.onStepChange("match",{index:n})},className:r?"":"wprm-admin-modal-recipe-nutrition-calculation-source-no-match"},r?"".concat(t.nutrition.match.name).concat(t.nutrition.match.aisle?" (".concat(t.nutrition.match.aisle.toLowerCase(),")"):""):Object(u.a)("no match found"))))}))):o.a.createElement("p",null,Object(u.a)("No ingredients set for this recipe."))});function hp(e){return(hp="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 mp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function vp(e){return(vp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yp(e,t){return(yp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var bp=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==hp(t)&&"function"!=typeof t?gp(e):t}(this,vp(t).call(this,e))).searchInput=o.a.createRef();var r=e.ingredient.nutrition.matchSearch,i=e.ingredient.nutrition.matchOptions,a=!1;return!1===i&&(r=e.ingredient.name,a=!0,n.searchApi(r)),n.state={search:r,prevSearch:r,options:i,isSearching:a},n.onSearch=n.onSearch.bind(gp(n)),n.searchApi=n.searchApi.bind(gp(n)),n}var n,i,a;return function(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&&yp(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidMount",value:function(){this.searchInput.current.focus()}},{key:"onSearch",value:function(){var e=this;this.state.isSearching||""===this.state.search||this.setState({isSearching:!0},function(){e.searchApi(e.state.search)})}},{key:"searchApi",value:function(e){var t=this;zf.a.getApiOptions(e).then(function(n){n&&t.setState({options:n.matchOptions,prevSearch:e,isSearching:!1})})}},{key:"render",value:function(){var e=this,t=this.props.ingredient,n="".concat(t.amount," ").concat(t.unit," ").concat(t.name);return t.notes&&(n+=" (".concat(t.notes,")")),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-match"},o.a.createElement("p",null,o.a.createElement("strong",null,Object(u.a)("Find a match for:"))," ",n),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-match-search"},o.a.createElement("input",{ref:this.searchInput,type:"text",value:this.state.search,onChange:function(t){e.setState({search:t.target.value})},onKeyDown:function(t){13!==t.which&&13!==t.keyCode||e.onSearch()},disabled:this.state.isSearching}),o.a.createElement("button",{className:"button button-primary",onClick:this.onSearch,disabled:this.state.isSearching||""===this.state.search||this.state.prevSearch===this.state.search},Object(u.a)("Search"))),this.state.isSearching?o.a.createElement(p.a,null):o.a.createElement(r.Fragment,null,this.state.options&&0!==this.state.options.length?o.a.createElement(r.Fragment,null,!1!==this.state.prevSearch&&o.a.createElement("p",null,Object(u.a)("Results for"),' "',this.state.prevSearch,'":'),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-matches"},this.state.options.map(function(t,n){return o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-matches-option",onClick:function(){e.props.onMatchChange({match:t,matchSearch:e.state.search,matchOptions:e.state.options})},key:n},t.image?o.a.createElement("img",{className:"wprm-admin-modal-recipe-nutrition-calculation-matches-option-image",src:"https://spoonacular.com/cdn/ingredients_100x100/".concat(t.image)}):null,o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-matches-option-name"},t.name,t.aisle?" (".concat(t.aisle.toLowerCase(),")"):""))}))):o.a.createElement(r.Fragment,null,this.state.prevSearch?o.a.createElement("p",null,Object(u.a)("No ingredients found for"),' "',this.state.prevSearch,'".'):o.a.createElement("p",null,Object(u.a)("No ingredients found.")))))}}])&&mp(n.prototype,i),a&&mp(n,a),t}(),wp=n(465),Op=n(443);function Ep(e){return(Ep="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 xp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){kp(e,t,n[t])})}return e}function kp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Cp(e,t){return!t||"object"!==Ep(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function jp(e){return(jp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _p(e,t){return(_p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ip=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Cp(this,jp(t).apply(this,arguments))}var n,i,a;return function(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&&_p(e,t)}(t,r["Component"]),n=t,(i=[{key:"getOptions",value:function(e){return(e=e||this.props.defaultSearch)?zf.a.getCustomIngredients(e).then(function(e){return e?e.ingredients:[]}):Promise.resolve([])}},{key:"render",value:function(){return o.a.createElement(Op.a,{placeholder:Object(u.a)("Select or search for a saved ingredient"),value:this.props.value,onChange:this.props.onValueChange,getOptionValue:function(e){return e.id},getOptionLabel:function(e){return e.text},loadOptions:this.getOptions.bind(this),defaultOptions:!0,clearable:!1,menuPlacement:"top",styles:{control:function(e){return xp({},e,{backgroundColor:"white"})},container:function(e){return xp({},e,{width:"100%",maxWidth:"440px",marginBottom:"10px"})}}})}}])&&Sp(n.prototype,i),a&&Sp(n,a),t}();function Tp(e){return(Tp="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 Np(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ap(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Pp(e){return(Pp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Dp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mp(e,t){return(Mp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Lp=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Tp(t)&&"function"!=typeof t?Dp(e):t}(this,Pp(t).call(this,e))).state={amount:"",unit:"",name:"",facts:{},savedIngredient:!1,savedAmount:!1},n.initCustomIngredient=n.initCustomIngredient.bind(Dp(n)),n.getSavedFacts=n.getSavedFacts.bind(Dp(n)),n.useCustomFacts=n.useCustomFacts.bind(Dp(n)),n.useSavedFacts=n.useSavedFacts.bind(Dp(n)),n.useFacts=n.useFacts.bind(Dp(n)),n}var n,i,a;return function(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&&Mp(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidMount",value:function(){this.initCustomIngredient()}},{key:"componentDidUpdate",value:function(e){this.props.index!==e.index&&this.initCustomIngredient()}},{key:"initCustomIngredient",value:function(){var e=this.props.ingredient,t=e&&e.nutrition?e.nutrition.amount:"",n=e&&e.nutrition?e.nutrition.unit:"",r=e?e.name:"";this.setState({amount:t,unit:n,name:r,facts:{},savedIngredient:!1,savedAmount:!1})}},{key:"getSavedFacts",value:function(){var e=this,t={};if(this.state.savedIngredient&&this.state.savedIngredient.nutrition){var n=1;if(this.state.savedAmount&&parseFloat(this.state.savedAmount)){var r=this.state.savedIngredient.nutrition.amount?parseFloat(this.state.savedIngredient.nutrition.amount):1;n=parseFloat(this.state.savedAmount)/r}Object.keys(this.state.savedIngredient.nutrition.nutrients).map(function(r,o){var i=e.state.savedIngredient.nutrition.nutrients[r];i&&(t[r]=Jl(n*i,1))})}return t}},{key:"useCustomFacts",value:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]?""===this.state.name.trim()?alert(Object(u.a)("A name is required for this saved nutrition ingredient.")):(zf.a.saveCustomIngredient(0,this.state.amount,this.state.unit,this.state.name,this.state.facts),this.useFacts(this.state.facts)):this.useFacts(this.state.facts)}},{key:"useSavedFacts",value:function(){this.useFacts(this.getSavedFacts())}},{key:"useFacts",value:function(e){this.props.onFactsChange(e)}},{key:"render",value:function(){var e=this,t=this.props.ingredient;if(!t)return null;var n=t.nutrition&&t.nutrition.amount?"".concat(t.nutrition.amount," "):"";return n+=t.nutrition&&t.nutrition.unit?"".concat(t.nutrition.unit," "):"",n+=t.name?t.name:"",o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-custom"},o.a.createElement("h2",null,Object(u.a)("Save a new Custom Ingredient")),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-custom-ingredient"},o.a.createElement(E.a,{type:"number",placeholder:Object(u.a)("Amount"),value:this.state.amount,onChange:function(t){e.setState({amount:t})}}),o.a.createElement(E.a,{placeholder:Object(u.a)("Unit"),value:this.state.unit,onChange:function(t){e.setState({unit:t})}}),o.a.createElement(E.a,{placeholder:Object(u.a)("Name (required)"),value:this.state.name,onChange:function(t){e.setState({name:t})}})),o.a.createElement(wp.a,{id:"custom-ingredient",facts:this.state.facts,onChange:function(t,n){var r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Np(e,t,n[t])})}return e}({},e.state.facts);r[t]=n,e.setState({facts:r})}}),o.a.createElement("button",{className:"button button-primary",onClick:function(){e.useCustomFacts(!0)}},Object(u.a)("Save for Later & Use")),o.a.createElement("button",{className:"button button-primary",onClick:function(){e.useCustomFacts(!1)}},Object(u.a)("Use")),o.a.createElement("h2",null,Object(u.a)("Select a saved ingredient")),o.a.createElement(Ip,{value:!1,onValueChange:function(n){var r=n.nutrition.amount;n.nutrition&&t.nutrition&&n.nutrition.unit===t.nutrition.unit&&(r=t.nutrition.amount),e.setState({savedIngredient:n,savedAmount:r})},defaultSearch:this.props.ingredient.name,key:this.props.ingredient.id}),this.state.savedIngredient?o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-custom-saved-ingredient"},o.a.createElement("strong",null,Object(u.a)("Match this equation to get the correct amounts:")),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-custom-saved-ingredient-match"},n," = ",o.a.createElement(E.a,{type:"number",value:this.state.savedAmount,onChange:function(t){e.setState({savedAmount:t})}})," ",this.state.savedIngredient.nutrition.unit," ",this.state.savedIngredient.text)),o.a.createElement(wp.a,{id:"saved-ingredient",facts:this.getSavedFacts()})):null,o.a.createElement("button",{className:"button button-primary",onClick:this.useSavedFacts,disabled:!this.state.savedIngredient},Object(u.a)("Use")))}}])&&Ap(n.prototype,i),a&&Ap(n,a),t}();function Rp(e){return(Rp="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 Fp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function zp(e,t){return!t||"object"!==Rp(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Up(e){return(Up=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function qp(e,t){return(qp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Wp=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=zp(this,Up(t).call(this,e))).state={editingIndex:!1},n}var n,i,a;return function(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&&qp(e,t)}(t,r["Component"]),n=t,(i=[{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredients"},this.props.ingredients.map(function(t,n){var r=t.amount?"".concat(t.amount," "):"";r+=t.unit?"".concat(t.unit," "):"",r+=t.name?t.name:"";var i=!!t.nutrition.match,a=i&&t.nutrition.match.name?t.nutrition.match.name:Object(u.a)("n/a"),c=[];if(t.nutrition.facts)for(var s=0,l=["calories","carbohydrates","fat","protein"];s<l.length;s++){var f=l[s];if(t.nutrition.facts[f]){var p=Jl(t.nutrition.facts[f],0);c.push("".concat(wprm_admin_modal.nutrition[f].label,": ").concat(p).concat(wprm_admin_modal.nutrition[f].unit))}}return 0<c.length&&(a+=" - ".concat(c.join(" | "))),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-container",key:n},o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient".concat(t.nutrition.factsUsed?"":" wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-not-used")},o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-select"},o.a.createElement("input",{id:"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-".concat(n),type:"checkbox",checked:t.nutrition.factsUsed,onChange:function(t){e.props.onChangeNutrition(n,{factsUsed:t.target.checked})}}),o.a.createElement("label",{htmlFor:"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-".concat(n)},r)),o.a.createElement("a",{href:"#",onClick:function(t){t.preventDefault(),e.setState({editingIndex:n!==e.state.editingIndex&&n})},className:i?"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-match":"wprm-admin-modal-recipe-nutrition-calculation-summary-ingredient-no-match",style:n===e.state.editingIndex?{fontWeight:"bold"}:null},a)),n===e.state.editingIndex&&o.a.createElement(wp.a,{id:"".concat(e.props.id,"-ingredients"),facts:t.nutrition.facts,onChange:function(r,o){var i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Fp(e,t,n[t])})}return e}({},t.nutrition.facts);i[r]=o,e.props.onChangeNutrition(n,{facts:i})}}))}))}}])&&Bp(n.prototype,i),a&&Bp(n,a),t}(),Hp=function(e){return o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation-summary"},e.servings?o.a.createElement("p",null,Object(u.a)("Values of all the checked ingredients will be added together and")," ",o.a.createElement("strong",null,Object(u.a)("divided by")," ",e.servings),", ",Object(u.a)("the number of servings for this recipe.")):o.a.createElement("p",null,Object(u.a)("Values of all the checked ingredients will be added together.")),0<e.apiIngredients.length&&o.a.createElement(r.Fragment,null,o.a.createElement("h2",null,Object(u.a)("API Ingredients")),o.a.createElement(Wp,{id:"api",ingredients:e.apiIngredients,onChangeNutrition:e.onApiIngredientsChange})),0<e.customIngredients.length&&o.a.createElement(r.Fragment,null,o.a.createElement("h2",null,Object(u.a)("Custom Ingredients")),o.a.createElement(Wp,{id:"custom",ingredients:e.customIngredients,onChangeNutrition:e.onCustomIngredientsChange})),o.a.createElement("h2",null,Object(u.a)("Recipe Nutrition Facts Preview")),o.a.createElement("p",null,Object(u.a)("Changes to these values can be made after confirming with the blue button.")),o.a.createElement(wp.a,{id:"summary-preview",facts:e.recipeFactsPreview}))};function Vp(e){return(Vp="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 Gp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Jp(e,t,n[t])})}return e}function Jp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Yp(e){return(Yp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Kp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xp(e,t){return(Xp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Qp=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==Vp(t)&&"function"!=typeof t?Kp(e):t}(this,Yp(t).call(this,e));var r=e.ingredients.filter(function(e){return"ingredient"===e.type&&e.name});return r=r.map(function(e){var t=e.unit;return t=(t=t.replace(/(<([^>]+)>)/gi,"")).replace(/(\[([^\]]+)\])/gi,""),e.nutrition={amount:Zl(e.amount),unit:t},e}),zf.a.getMatches(r).then(function(e){e?n.setState({ingredients:e.ingredients,calculating:!1}):n.setState({calculating:!1})}),n.state={step:"source",stepArgs:{},ingredients:[],apiIngredients:[],customIngredients:[],calculating:!0},n.onStepChange=n.onStepChange.bind(Kp(n)),n.onIngredientChange=n.onIngredientChange.bind(Kp(n)),n}var n,i,a;return function(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&&Xp(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidUpdate",value:function(e,t){var n=this;if("source"===t.step&&"summary"===this.state.step){var r=this.state.ingredients.filter(function(e){return"api"===e.nutrition.source}),o=this.state.ingredients.filter(function(e){return"custom"===e.nutrition.source}),i=!1,a="summary";0<r.length&&(i=!0,zf.a.getApiFacts(r).then(function(e){e?n.setState({calculating:!1,apiIngredients:e.ingredients}):n.setState({calculating:!1})})),0<o.length&&(a="custom"),this.setState({calculating:i,customIngredients:o,step:a})}"custom"===this.state.step&&(0===this.state.customIngredients.filter(function(e){return!e.nutrition.hasOwnProperty("facts")}).length&&this.setState({step:"summary"}))}},{key:"onStepChange",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.setState({step:e,stepArgs:t})}},{key:"onIngredientChange",value:function(e,t){var n=JSON.parse(JSON.stringify(this.state.ingredients));n[e].nutrition=Gp({},n[e].nutrition,t),this.setState({ingredients:n})}},{key:"getRecipeFacts",value:function(){var e=JSON.parse(JSON.stringify(wprm_admin_modal.nutrition));delete e.serving_size;var t={},n=this.props.servings&&parseInt(this.props.servings)>0?parseInt(this.props.servings):1;for(var r in e){var o=!1,i=!0,a=!1,u=void 0;try{for(var c,s=this.state.apiIngredients.concat(this.state.customIngredients)[Symbol.iterator]();!(i=(c=s.next()).done);i=!0){var l=c.value;l.nutrition.factsUsed&&l.nutrition.facts&&l.nutrition.facts[r]&&(o?o+=parseFloat(l.nutrition.facts[r]):o=parseFloat(l.nutrition.facts[r]))}}catch(e){a=!0,u=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw u}}o&&(o=Jl(o/=n,0)),t[r]=o}return t}},{key:"render",value:function(){var e=this,t=null;switch(this.state.step){case"source":t=o.a.createElement(dp,{ingredients:this.state.ingredients,onIngredientChange:this.onIngredientChange,onStepChange:this.onStepChange});break;case"match":var n=this.state.stepArgs.index;t=o.a.createElement(bp,{ingredient:this.state.ingredients[n],onMatchChange:function(t){e.onIngredientChange(n,Gp({},t)),e.onStepChange("source")}});break;case"custom":var i=this.state.customIngredients.findIndex(function(e){return!e.nutrition.hasOwnProperty("facts")});t=o.a.createElement(Lp,{index:i,ingredient:this.state.customIngredients[i],onFactsChange:function(t){var n=JSON.parse(JSON.stringify(e.state.customIngredients));n[i].nutrition.facts=t,e.setState({customIngredients:n})}});break;case"summary":t=o.a.createElement(Hp,{servings:this.props.servings,recipeFactsPreview:this.getRecipeFacts(),apiIngredients:this.state.apiIngredients,customIngredients:this.state.customIngredients,onApiIngredientsChange:function(t,n){var r=JSON.parse(JSON.stringify(e.state.apiIngredients));r[t].nutrition=Gp({},r[t].nutrition,n),e.setState({apiIngredients:r})},onCustomIngredientsChange:function(t,n){var r=JSON.parse(JSON.stringify(e.state.customIngredients));r[t].nutrition=Gp({},r[t].nutrition,n),e.setState({customIngredients:r})}})}var a=null,c=o.a.createElement("button",{className:"button",onClick:function(){e.onStepChange("source")}},Object(u.a)("Go Back"));switch(this.state.step){case"source":a=o.a.createElement(r.Fragment,null,o.a.createElement("button",{className:"button",onClick:this.props.onCancel},Object(u.a)("Cancel Calculation")),o.a.createElement("button",{className:"button button-primary",onClick:function(){e.onStepChange("summary")}},Object(u.a)("Go to Next Step")));break;case"match":a=o.a.createElement(r.Fragment,null,c);break;case"summary":a=o.a.createElement(r.Fragment,null,c,o.a.createElement("button",{className:"button button-primary",onClick:function(){var t=e.getRecipeFacts();e.props.onNutritionChange(t)}},Object(u.a)("Use These Values")))}return o.a.createElement(r.Fragment,null,o.a.createElement(l.a,{onCloseModal:this.props.onCloseModal},this.props.name?"".concat(this.props.name," - ").concat(Object(u.a)("Nutrition Calculation")):"".concat(Object(u.a)("Recipe")," - ").concat(Object(u.a)("Nutrition Calculation"))),o.a.createElement("div",{className:"wprm-admin-modal-recipe-nutrition-calculation"},this.state.calculating&&"custom"!==this.state.step?o.a.createElement(p.a,null):t),o.a.createElement(f.a,{savingChanges:this.state.calculating&&"custom"!==this.state.step},a))}}])&&Zp(n.prototype,i),a&&Zp(n,a),t}(),$p=n(95),ed=n.n($p),td=(n(966),wprm_admin.endpoints.modal),nd=function(e){var t={ingredients:e};return $n.a.call("".concat(td,"/ingredient/parse"),"POST",t)},rd=function(e){return o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-groups"},o.a.createElement("p",null,Object(u.a)("All of these will be imported. Use the checkbox to indicate group headers.")," "),e.value.map(function(t,n){return o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-groups-field",key:n},o.a.createElement("input",{type:"checkbox",checked:t.group,onChange:function(t){var r=JSON.parse(JSON.stringify(e.value));r[n].group=t.target.checked,e.onChange(r)}}),o.a.createElement("input",{type:"text",value:t.text,style:t.group?{fontWeight:"bold"}:null,onChange:function(t){var r=JSON.parse(JSON.stringify(e.value));r[n].text=t.target.value,e.onChange(r)}}))}))};function od(e){return(od="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 id(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ad(e,t,n[t])})}return e}function ad(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ud(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function cd(e){return(cd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function sd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ld(e,t){return(ld=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var fd=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==od(t)&&"function"!=typeof t?sd(e):t}(this,cd(t).call(this,e))).textInput=o.a.createRef();var r="";return e.text&&(r=n.cleanUpText(e.text)),n.state={text:r,name:!1,summary:!1,equipment:!1,ingredients:!1,instructions:!1,notes:!1,isParsing:!1},n.cleanUpText=n.cleanUpText.bind(sd(n)),n.setSelection=n.setSelection.bind(sd(n)),n.useValues=n.useValues.bind(sd(n)),n}var n,i,a;return function(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&&ld(e,t)}(t,r["Component"]),n=t,(i=[{key:"componentDidMount",value:function(){this.textInput.current.focus()}},{key:"cleanUpText",value:function(e){return e=e.replace(/(<([^>]+)>)/gi,""),e=ed.a.decode(e)}},{key:"setSelection",value:function(e){var t=this.textInput.current,n=t.value.substring(t.selectionStart,t.selectionEnd);if(n=n||!1,"equipment"!==e&&"ingredients"!==e&&"instructions"!==e||(n=this.getSeperateFields(n)),n!==this.state[e]){var r={};r[e]=n,this.setState(r)}}},{key:"getSeperateFields",value:function(e){if(!1===e)return!1;var t=[],n=e.split(/[\r\n]+/),r=!0,o=!1,i=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=a.value;(c=(c=c.trim()).replace(/\d\.\s+|[a-z]\)\s+|•\s+|[A-Z]\.\s+|[IVX]+\.\s+/g,""))&&t.push({group:!1,text:c})}}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return!!t.length&&t}},{key:"useValues",value:function(){var e=this,t={};if(!1!==this.state.name&&(t.name=this.state.name),!1!==this.state.summary&&(t.summary=this.state.summary),!1!==this.state.notes&&(t.notes=this.state.notes),!1!==this.state.equipment){var n=[];this.state.equipment.map(function(e,t){n.push({uid:t,name:e.text})}),t.equipment=n}if(!1!==this.state.instructions){var r=[];this.state.instructions.map(function(e,t){e.group?r.push({uid:t,type:"group",name:e.text}):r.push({uid:t,type:"instruction",text:e.text,image:0,image_url:""})}),t.instructions_flat=r}var o=[],i={};!1!==this.state.ingredients&&(this.state.ingredients.map(function(e,t){e.group?o.push({uid:t,type:"group",name:e.text}):(o.push({uid:t,type:"ingredient",amount:"",unit:"",name:"",notes:""}),i[t]=e.text)}),t.ingredients_flat=o),0<Object.keys(i).length?this.setState({isParsing:!0},function(){nd(i).then(function(n){if(n){for(var r in n.parsed){var o=n.parsed[r];t.ingredients_flat[r]=id({},t.ingredients_flat[r],o)}e.props.onImportValues(t)}else e.setState({isParsing:!1})})}):this.props.onImportValues(t)}},{key:"render",value:function(){var e=this,t=!1!==this.state.name||!1!==this.state.summary||!1!==this.state.equipment||!1!==this.state.ingredients||!1!==this.state.instructions||!1!==this.state.notes;return o.a.createElement(r.Fragment,null,o.a.createElement(l.a,{onCloseModal:this.props.onCloseModal},this.props.recipe.name?"".concat(this.props.recipe.name," - ").concat(Object(u.a)("Import from Text")):"".concat(Object(u.a)("Recipe")," - ").concat(Object(u.a)("Import from Text"))),o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-container"},o.a.createElement("h2",null,Object(u.a)("1. Highlight text and click the corresponding button")),o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-selection"},o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-buttons"},o.a.createElement("button",{className:!1!==this.state.name?"button wprm-selection-made":"button",onClick:function(){return e.setSelection("name")}},Object(u.a)("Name")),o.a.createElement("button",{className:!1!==this.state.summary?"button wprm-selection-made":"button",onClick:function(){return e.setSelection("summary")}},Object(u.a)("Summary")),o.a.createElement("button",{className:!1!==this.state.equipment?"button wprm-selection-made":"button",onClick:function(){return e.setSelection("equipment")}},Object(u.a)("Equipment")),o.a.createElement("button",{className:!1!==this.state.ingredients?"button wprm-selection-made":"button",onClick:function(){return e.setSelection("ingredients")}},Object(u.a)("Ingredients")),o.a.createElement("button",{className:!1!==this.state.instructions?"button wprm-selection-made":"button",onClick:function(){return e.setSelection("instructions")}},Object(u.a)("Instructions")),o.a.createElement("button",{className:!1!==this.state.notes?"button wprm-selection-made":"button",onClick:function(){return e.setSelection("notes")}},Object(u.a)("Notes"))),o.a.createElement("textarea",{ref:this.textInput,value:this.state.text,placeholder:Object(u.a)("Paste or type recipe"),onChange:function(t){e.setState({text:e.cleanUpText(t.target.value)})}})),o.a.createElement("h2",null,Object(u.a)("2. Fine-tune selections")),o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-finetune"},t?o.a.createElement(r.Fragment,null,!1!==this.state.name&&o.a.createElement(h.a,{label:Object(u.a)("Name")},o.a.createElement(E.a,{name:"recipe-name",value:this.state.name,onChange:function(t){e.setState({name:t})}})),!1!==this.state.summary&&o.a.createElement(h.a,{label:Object(u.a)("Summary")},o.a.createElement(m.a,{value:this.state.summary,onChange:function(t){e.setState({summary:t})}})),!1!==this.state.equipment&&o.a.createElement(h.a,{label:Object(u.a)("Equipment")},this.state.equipment.map(function(t,n){return o.a.createElement("div",{className:"wprm-admin-modal-field-text-import-equipment-field",key:n},o.a.createElement(E.a,{value:t.text,onChange:function(t){var r=JSON.parse(JSON.stringify(e.state.equipment));r[n].text=t,e.setState({equipment:r})}}))})),!1!==this.state.ingredients&&o.a.createElement(h.a,{label:Object(u.a)("Ingredients"),help:Object(u.a)("Use the checkboxes to indicate group headers (like Frosting and Cake)")},o.a.createElement(rd,{value:this.state.ingredients,onChange:function(t){e.setState({ingredients:t})}})),!1!==this.state.instructions&&o.a.createElement(h.a,{label:Object(u.a)("Instructions"),help:Object(u.a)("Use the checkboxes to indicate group headers (like Frosting and Cake)")},o.a.createElement(rd,{value:this.state.instructions,onChange:function(t){e.setState({instructions:t})}})),!1!==this.state.notes&&o.a.createElement(h.a,{label:Object(u.a)("Notes")},o.a.createElement(m.a,{value:this.state.notes,onChange:function(t){e.setState({notes:t})}}))):o.a.createElement("p",null,Object(u.a)("Make a selection using the buttons above first.")))),o.a.createElement(f.a,{savingChanges:this.state.isParsing},o.a.createElement("button",{className:"button",onClick:this.props.onCancel},Object(u.a)("Cancel")),o.a.createElement("button",{className:"button button-primary",onClick:this.useValues,disabled:!t},Object(u.a)("Use these Values"))))}}])&&ud(n.prototype,i),a&&ud(n,a),t}();function pd(e){return(pd="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 dd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){hd(e,t,n[t])})}return e}function hd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function md(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function vd(e){return(vd=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yd(e,t){return(yd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}n.d(t,"a",function(){return bd});var bd=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==pd(t)&&"function"!=typeof t?gd(e):t}(this,vd(t).call(this,e));var r=JSON.parse(JSON.stringify(wprm_admin_modal.recipe)),o=!1;return e.args.hasOwnProperty("recipe")?r=JSON.parse(JSON.stringify(e.args.recipe)):e.args.hasOwnProperty("recipeId")&&(o=!0,a.a.getRecipe(e.args.recipeId).then(function(t){if(t){var r=JSON.parse(JSON.stringify(t.recipe));e.args.cloneRecipe&&delete r.id,n.setState({recipe:r,originalRecipe:e.args.cloneRecipe||e.args.restoreRevision?{}:JSON.parse(JSON.stringify(r)),loadingRecipe:!1,mode:"recipe"}),n.scrollToGroup()}else n.setState({loadingRecipe:!1})})),n.state={recipe:r,originalRecipe:e.args.cloneRecipe||e.args.restoreRevision?{}:JSON.parse(JSON.stringify(r)),savingChanges:!1,saveResult:!1,loadingRecipe:o,forceRerender:0,mode:"recipe"},n.scrollToGroup=n.scrollToGroup.bind(gd(n)),n.onModeChange=n.onModeChange.bind(gd(n)),n.onRecipeChange=n.onRecipeChange.bind(gd(n)),n.saveRecipe=n.saveRecipe.bind(gd(n)),n.allowCloseModal=n.allowCloseModal.bind(gd(n)),n.changesMade=n.changesMade.bind(gd(n)),n}var n,c,s;return function(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&&yd(e,t)}(t,r["Component"]),n=t,(c=[{key:"componentDidMount",value:function(){"recipe"!==this.state.mode||this.state.loadingRecipe||this.scrollToGroup()}},{key:"onModeChange",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r={mode:e};"text-import"===e&&(r.textImportText=n),this.setState(r,function(){"recipe"===e&&(n=n||"media",t.scrollToGroup(n))})}},{key:"scrollToGroup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"media";i.scroller.scrollTo("wprm-admin-modal-fields-group-".concat(e),{containerId:"wprm-admin-modal-recipe-content",offset:-10})}},{key:"onRecipeChange",value:function(e){this.setState(function(t){return{recipe:dd({},t.recipe,e)}})}},{key:"saveRecipe",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.state.savingChanges||this.setState({savingChanges:!0,saveResult:!1},function(){a.a.saveRecipe(e.state.recipe).then(function(n){if(n&&n.recipe){var r=JSON.parse(JSON.stringify(n.recipe));e.setState(function(e){return{recipe:r,originalRecipe:JSON.parse(JSON.stringify(r)),savingChanges:!1,saveResult:"ok",forceRerender:e.forceRerender+1}},function(){"function"==typeof e.props.args.saveCallback&&e.props.args.saveCallback(r),t&&e.props.maybeCloseModal(),setTimeout(function(){"ok"===e.state.saveResult&&e.setState({saveResult:!1})},3e3)})}else e.setState({savingChanges:!1,saveResult:"failed"})})})}},{key:"allowCloseModal",value:function(){switch(this.state.mode){case"nutrition-calculation":return confirm(Object(u.a)("Are you sure you want to stop calculating the nutrition facts?"))&&this.onModeChange("recipe","nutrition"),!1;case"ingredient-links":return this.onModeChange("recipe","ingredients"),!1;case"text-import":return this.onModeChange("recipe"),!1}return!this.state.savingChanges&&(!this.changesMade()||confirm(Object(u.a)("Are you sure you want to close without saving changes?")))}},{key:"changesMade",value:function(){return void 0!==window.lodash?!window.lodash.isEqual(this.state.recipe,this.state.originalRecipe):JSON.stringify(this.state.recipe)!==JSON.stringify(this.state.originalRecipe)}},{key:"render",value:function(){var e=this;switch(this.state.mode){case"nutrition-calculation":return o.a.createElement(Qp,{onCloseModal:this.props.maybeCloseModal,name:this.state.recipe.name,servings:this.state.recipe.servings,ingredients:this.state.recipe.ingredients_flat,onCancel:function(){e.onModeChange("recipe","nutrition")},onNutritionChange:function(t){var n={};Object.keys(wprm_admin_modal.nutrition).map(function(e,r){t.hasOwnProperty(e)?n[e]=t[e]:n[e]=!1}),n.serving_size=!!e.state.recipe.nutrition.hasOwnProperty("serving_size")&&e.state.recipe.nutrition.serving_size,n.serving_unit=!!e.state.recipe.nutrition.hasOwnProperty("serving_unit")&&e.state.recipe.nutrition.serving_unit,e.onRecipeChange({nutrition:n}),e.onModeChange("recipe","nutrition")}});case"ingredient-links":return o.a.createElement(pp,{onCloseModal:this.props.maybeCloseModal,onCancel:function(){e.onModeChange("recipe","ingredients")},ingredients:this.state.recipe.ingredients_flat,onIngredientsChange:function(t){e.onRecipeChange({ingredients_flat:t}),e.onModeChange("recipe","ingredients")}});case"text-import":return o.a.createElement(fd,{onCloseModal:this.props.maybeCloseModal,onCancel:function(){e.onModeChange("recipe")},text:this.state.textImportText,recipe:this.state.recipe,onImportValues:function(t){e.onRecipeChange(t),e.onModeChange("recipe")}});default:return o.a.createElement(ap,{onCloseModal:this.props.maybeCloseModal,changesMade:this.changesMade(),savingChanges:this.state.savingChanges,saveResult:this.state.saveResult,loadingRecipe:this.state.loadingRecipe,recipe:this.state.recipe,onRecipeChange:this.onRecipeChange,saveRecipe:this.saveRecipe,forceRerender:this.state.forceRerender,onModeChange:this.onModeChange})}}}])&&md(n.prototype,c),s&&md(n,s),t}()},,,,function(e,t,n){"use strict";var r=n(0),o=n.n(r),i=(n(889),n(56)),a=wprm_admin.endpoints.manage,u=function(e,t,n,r){var o={type:t,ids:n,action:r};return i.a.call("".concat(a,"/").concat(e,"/bulk"),"POST",o)},c=n(169),s=n(174),l=n(2),f=n(175),p=n(68),d=n(417);function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){m(e,t,n[t])})}return e}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var v=function(e){var t=!!e.action&&e.action.type,n=[{value:"change-link",label:Object(l.a)("Change Link"),default:""},{value:"change-nofollow",label:Object(l.a)("Change Link Nofollow"),default:"default"},{value:"delete",label:Object(l.a)("Delete Equipment"),default:!1}];return o.a.createElement("form",null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Select an action to perform:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-actions"},n.map(function(n){return o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-action",key:n.value},o.a.createElement("input",{type:"radio",value:n.value,name:"wprm-admin-radio-bulk-edit-action",id:"wprm-admin-radio-bulk-edit-action-".concat(n.value),checked:t===n.value,onChange:function(){var t={type:n.value,options:n.default};e.onActionChange(t)}}),o.a.createElement("label",{htmlFor:"wprm-admin-radio-bulk-edit-action-".concat(n.value)},n.label))})),t&&!1!==e.action.options&&o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Action options:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-options"},"change-link"===t&&o.a.createElement(p.a,{name:"equipment-link",value:e.action.options,placeholder:Object(l.a)("Equipment Link"),onChange:function(t){var n=h({},e.action,{options:t});e.onActionChange(n)}}),"change-nofollow"===t&&o.a.createElement(d.a,{id:"nofollow",options:wprm_admin_modal.options.equipment_link_nofollow,value:e.action.options,onChange:function(t){var n=h({},e.action,{options:t});e.onActionChange(n)}}))))};function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){y(e,t,n[t])})}return e}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var b=function(e){var t=!!e.action&&e.action.type,n=[{value:"change-group",label:Object(l.a)("Change Shopping List Group"),default:""},{value:"change-link",label:Object(l.a)("Change Link"),default:""},{value:"change-nofollow",label:Object(l.a)("Change Link Nofollow"),default:"default"},{value:"delete",label:Object(l.a)("Delete Ingredients"),default:!1}];return o.a.createElement("form",null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Select an action to perform:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-actions"},n.map(function(n){return o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-action",key:n.value},o.a.createElement("input",{type:"radio",value:n.value,name:"wprm-admin-radio-bulk-edit-action",id:"wprm-admin-radio-bulk-edit-action-".concat(n.value),checked:t===n.value,onChange:function(){var t={type:n.value,options:n.default};e.onActionChange(t)}}),o.a.createElement("label",{htmlFor:"wprm-admin-radio-bulk-edit-action-".concat(n.value)},n.label))})),t&&!1!==e.action.options&&o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Action options:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-options"},"change-group"===t&&o.a.createElement(p.a,{name:"shopping-list-group",value:e.action.options,placeholder:Object(l.a)("Shopping List Group"),onChange:function(t){var n=g({},e.action,{options:t});e.onActionChange(n)}}),"change-link"===t&&o.a.createElement(p.a,{name:"ingredient-link",value:e.action.options,placeholder:Object(l.a)("Ingredient Link"),onChange:function(t){var n=g({},e.action,{options:t});e.onActionChange(n)}}),"change-nofollow"===t&&o.a.createElement(d.a,{id:"nofollow",options:wprm_admin_modal.options.ingredient_link_nofollow,value:e.action.options,onChange:function(t){var n=g({},e.action,{options:t});e.onActionChange(n)}}))))},w=function(e){var t=!!e.action&&e.action.type,n=[{value:"delete",label:Object(l.a)("Delete Ratings"),default:!1}];return o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Select an action to perform:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-actions"},n.map(function(n){return o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-action",key:n.value},o.a.createElement("input",{type:"radio",value:n.value,name:"wprm-admin-radio-bulk-edit-action",id:"wprm-admin-radio-bulk-edit-action-".concat(n.value),checked:t===n.value,onChange:function(){var t={type:n.value,options:n.default};e.onActionChange(t)}}),o.a.createElement("label",{htmlFor:"wprm-admin-radio-bulk-edit-action-".concat(n.value)},n.label))})))},O=n(399),E=n(645);function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){k(e,t,n[t])})}return e}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=function(e){var t=!!e.action&&e.action.type,n=!1,i=[];Object.keys(wprm_admin_manage.taxonomies).map(function(e,t){var r=e.substr(5);n||(n=r),i.push({value:r,label:wprm_admin_manage.taxonomies[e].name})});var a=[];return 0<i.length&&a.push({value:"add-terms",label:Object(l.a)("Add Terms"),default:{taxonomy:n,terms:[]}},{value:"remove-terms",label:Object(l.a)("Remove Terms"),default:{taxonomy:n,terms:[]}}),a.push({value:"change-type",label:Object(l.a)("Change Recipe Type"),default:"food"},{value:"change-author",label:Object(l.a)("Change Display Author"),default:{author:"default",author_name:"",author_link:""}},{value:"export",label:Object(l.a)("Export Recipes"),default:!1,required:"premium"},{value:"delete",label:Object(l.a)("Delete Recipes"),default:!1}),o.a.createElement("form",null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Select an action to perform:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-actions"},a.map(function(n){return o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-action",key:n.value},o.a.createElement("input",{type:"radio",value:n.value,name:"wprm-admin-radio-bulk-edit-action",id:"wprm-admin-radio-bulk-edit-action-".concat(n.value),checked:t===n.value,onChange:function(){var t={type:n.value,options:n.default};n.hasOwnProperty("required")&&(t.required=n.required),e.onActionChange(t)}}),o.a.createElement("label",{htmlFor:"wprm-admin-radio-bulk-edit-action-".concat(n.value)},n.label))})),t&&!1!==e.action.options&&o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Action options:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-options"},"change-type"===t&&o.a.createElement(d.a,{id:"type",options:[{value:"food",label:Object(l.a)("Food Recipe")},{value:"howto",label:Object(l.a)("How-to Instructions")},{value:"other",label:Object(l.a)("Other (no metadata)")}],value:e.action.options,onChange:function(t){var n=x({},e.action,{options:t});e.onActionChange(n)}}),"change-author"===t&&o.a.createElement(r.Fragment,null,o.a.createElement(O.a,{options:wprm_admin_modal.options.author.filter(function(e){return"same"!==e.actual}),value:e.action.options.author,onChange:function(t){var n=x({},e.action,{options:{author:t,author_name:"",author_link:""}});e.onActionChange(n)},width:300,custom:{menuPlacement:"top",maxMenuHeight:150}}),"custom"===wprm_admin_modal.options.author.find(function(t){return t.value===e.action.options.author}).actual&&o.a.createElement(r.Fragment,null," ",o.a.createElement(p.a,{name:"author-name",placeholder:Object(l.a)("Author Name"),value:e.action.options.author_name,onChange:function(t){var n=x({},e.action,{options:x({},e.action.options,{author_name:t})});e.onActionChange(n)}})," ",o.a.createElement(p.a,{name:"author-link",placeholder:"https://bootstrapped.ventures",type:"url",value:e.action.options.author_link,onChange:function(t){var n=x({},e.action,{options:x({},e.action.options,{author_link:t})});e.onActionChange(n)}}))),("add-terms"===t||"remove-terms"===t)&&o.a.createElement(r.Fragment,null,o.a.createElement(O.a,{options:i,value:e.action.options.taxonomy,onChange:function(t){var n=x({},e.action,{options:{taxonomy:t,terms:[]}});e.onActionChange(n)},width:200,custom:{menuPlacement:"top",maxMenuHeight:150}})," ",o.a.createElement(E.a,{id:e.action.options.taxonomy,value:e.action.options.terms,onChange:function(t){var n=x({},e.action,{options:{taxonomy:e.action.options.taxonomy,terms:t}});e.onActionChange(n)},custom:{menuPlacement:"top",maxMenuHeight:200}})))))},C=function(e){var t=!!e.action&&e.action.type,n=[{value:"delete",label:Object(l.a)("Delete Terms"),default:!1}];return o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Select an action to perform:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-actions"},n.map(function(n){return o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-action",key:n.value},o.a.createElement("input",{type:"radio",value:n.value,name:"wprm-admin-radio-bulk-edit-action",id:"wprm-admin-radio-bulk-edit-action-".concat(n.value),checked:t===n.value,onChange:function(){var t={type:n.value,options:n.default};e.onActionChange(t)}}),o.a.createElement("label",{htmlFor:"wprm-admin-radio-bulk-edit-action-".concat(n.value)},n.label))})),t&&!1!==e.action.options&&o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-label"},Object(l.a)("Action options:")),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-options"})))};function j(e){return(j="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 _(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}n.d(t,"a",function(){return P});var A={rating:{label:Object(l.a)("Ratings"),elem:w},recipe:{label:Object(l.a)("Recipes"),elem:S},ingredient:{label:Object(l.a)("Ingredients"),elem:b},equipment:{label:Object(l.a)("Equipment"),elem:v}};Object.keys(wprm_admin_modal.categories).map(function(e){var t=wprm_admin_modal.categories[e];A[e]={label:t.label,elem:C}});var P=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==j(t)&&"function"!=typeof t?T(e):t}(this,I(t).call(this,e))).state={route:e.args.hasOwnProperty("route")?e.args.route:"recipe",type:e.args.hasOwnProperty("type")?e.args.type:"recipe",ids:e.args.hasOwnProperty("ids")?e.args.ids:[],action:!1,savingChanges:!1,result:!1},n.onBulkEdit=n.onBulkEdit.bind(T(n)),n.allowCloseModal=n.allowCloseModal.bind(T(n)),n}var n,i,a;return function(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&&N(e,t)}(t,r["Component"]),n=t,(i=[{key:"onBulkEdit",value:function(){var e=this;this.state.action&&this.setState({savingChanges:!0},function(){u(e.state.route,e.state.type,e.state.ids,e.state.action).then(function(t){var n=!1;t.hasOwnProperty("result")&&(n=t.result),e.setState({savingChanges:!1,result:n},function(){"function"==typeof e.props.args.saveCallback&&e.props.args.saveCallback(),n||e.props.maybeCloseModal()})})})}},{key:"allowCloseModal",value:function(){return!this.state.savingChanges}},{key:"changesMade",value:function(){return!(!this.state.action||!this.state.action.type)&&(!Array.isArray(this.state.action.options)||0!==this.state.action.options.length)}},{key:"render",value:function(){var e=this,t=!!A.hasOwnProperty(this.state.type)&&A[this.state.type];if(!t)return null;var n=t.elem,i="".concat(Object(l.a)("Bulk Edit")," ").concat(this.state.ids.length," ").concat(t.label);return o.a.createElement(r.Fragment,null,o.a.createElement(c.a,{onCloseModal:this.props.maybeCloseModal},i),o.a.createElement("div",{className:"wprm-admin-modal-bulk-edit-container"},!1===this.state.result?o.a.createElement(n,{action:this.state.action,onActionChange:function(t){e.setState({action:t})}}):o.a.createElement("div",{dangerouslySetInnerHTML:{__html:this.state.result}})),o.a.createElement(s.a,{savingChanges:this.state.savingChanges},!1===this.state.result?o.a.createElement(f.a,{isPrimary:!0,required:this.state.action&&this.state.action.hasOwnProperty("required")?this.state.action.required:null,onClick:this.onBulkEdit,disabled:!this.changesMade()},i):o.a.createElement(f.a,{isPrimary:!0,onClick:this.props.maybeCloseModal},Object(l.a)("Close"))))}}])&&_(n.prototype,i),a&&_(n,a),t}()},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t),function(e){var t=n(70),r=n.n(t),o=n(0),i=n.n(o),a=n(796);e._babelPolyfill||n(177);var u=document.getElementById("wprm-admin-modal");u&&r.a.render(i.a.createElement(a.a,{ref:function(e){window.WPRM_Modal=e}}),u)}.call(this,n(66))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bodyOpenClassName=t.portalClassName=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=h(i),u=h(n(70)),c=h(n(4)),s=h(n(880)),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(778)),f=n(659),p=h(f),d=n(886);function h(e){return e&&e.__esModule?e:{default:e}}function m(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var v=t.portalClassName="ReactModalPortal",g=t.bodyOpenClassName="ReactModal__Body--open",y=void 0!==u.default.createPortal,b=function(){return y?u.default.createPortal:u.default.unstable_renderSubtreeIntoContainer};function w(e){return e()}var O=function(e){function t(){var e,n,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,c=Array(i),l=0;l<i;l++)c[l]=arguments[l];return n=o=m(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),o.removePortal=function(){!y&&u.default.unmountComponentAtNode(o.node),w(o.props.parentSelector).removeChild(o.node)},o.portalRef=function(e){o.portal=e},o.renderPortal=function(e){var n=b()(o,a.default.createElement(s.default,r({defaultStyles:t.defaultStyles},e)),o.node);o.portalRef(n)},m(o,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Component),o(t,[{key:"componentDidMount",value:function(){f.canUseDOM&&(y||(this.node=document.createElement("div")),this.node.className=this.props.portalClassName,w(this.props.parentSelector).appendChild(this.node),!y&&this.renderPortal(this.props))}},{key:"getSnapshotBeforeUpdate",value:function(e){return{prevParent:w(e.parentSelector),nextParent:w(this.props.parentSelector)}}},{key:"componentDidUpdate",value:function(e,t,n){if(f.canUseDOM){var r=this.props,o=r.isOpen,i=r.portalClassName;e.portalClassName!==i&&(this.node.className=i);var a=n.prevParent,u=n.nextParent;u!==a&&(a.removeChild(this.node),u.appendChild(this.node)),(e.isOpen||o)&&!y&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(f.canUseDOM&&this.node&&this.portal){var e=this.portal.state,t=Date.now(),n=e.isOpen&&this.props.closeTimeoutMS&&(e.closesAt||t+this.props.closeTimeoutMS);n?(e.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,n-t)):this.removePortal()}}},{key:"render",value:function(){return f.canUseDOM&&y?(!this.node&&y&&(this.node=document.createElement("div")),b()(a.default.createElement(s.default,r({ref:this.portalRef,defaultStyles:t.defaultStyles},this.props)),this.node)):null}}],[{key:"setAppElement",value:function(e){l.setElement(e)}}]),t}();O.propTypes={isOpen:c.default.bool.isRequired,style:c.default.shape({content:c.default.object,overlay:c.default.object}),portalClassName:c.default.string,bodyOpenClassName:c.default.string,htmlOpenClassName:c.default.string,className:c.default.oneOfType([c.default.string,c.default.shape({base:c.default.string.isRequired,afterOpen:c.default.string.isRequired,beforeClose:c.default.string.isRequired})]),overlayClassName:c.default.oneOfType([c.default.string,c.default.shape({base:c.default.string.isRequired,afterOpen:c.default.string.isRequired,beforeClose:c.default.string.isRequired})]),appElement:c.default.instanceOf(p.default),onAfterOpen:c.default.func,onRequestClose:c.default.func,closeTimeoutMS:c.default.number,ariaHideApp:c.default.bool,shouldFocusAfterRender:c.default.bool,shouldCloseOnOverlayClick:c.default.bool,shouldReturnFocusAfterClose:c.default.bool,parentSelector:c.default.func,aria:c.default.object,data:c.default.object,role:c.default.string,contentLabel:c.default.string,shouldCloseOnEsc:c.default.bool,overlayRef:c.default.func,contentRef:c.default.func},O.defaultProps={isOpen:!1,portalClassName:v,bodyOpenClassName:g,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,parentSelector:function(){return document.body}},O.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},(0,d.polyfill)(O),t.default=O},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o="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},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),u=m(a),c=m(n(4)),s=h(n(881)),l=m(n(882)),f=h(n(778)),p=h(n(885)),d=m(n(659));function h(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function m(e){return e&&e.__esModule?e:{default:e}}var v={overlay:"ReactModal__Overlay",content:"ReactModal__Content"},g=9,y=27,b=0,w=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setOverlayRef=function(e){n.overlay=e,n.props.overlayRef&&n.props.overlayRef(e)},n.setContentRef=function(e){n.content=e,n.props.contentRef&&n.props.contentRef(e)},n.afterClose=function(){var e=n.props,t=e.appElement,r=e.ariaHideApp,o=e.htmlOpenClassName,i=e.bodyOpenClassName;i&&p.remove(document.body,i),o&&p.remove(document.getElementsByTagName("html")[0],o),r&&b>0&&0===(b-=1)&&f.show(t),n.props.shouldFocusAfterRender&&(n.props.shouldReturnFocusAfterClose?(s.returnFocus(),s.teardownScopedFocus()):s.popWithoutFocus()),n.props.onAfterClose&&n.props.onAfterClose()},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(n.props.shouldFocusAfterRender&&(s.setupScopedFocus(n.node),s.markForFocusLater()),n.setState({isOpen:!0},function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen()}))},n.close=function(){n.props.closeTimeoutMS>0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return n.content&&!n.contentHasFocus()&&n.content.focus()},n.closeWithTimeout=function(){var e=Date.now()+n.props.closeTimeoutMS;n.setState({beforeClose:!0,closesAt:e},function(){n.closeTimer=setTimeout(n.closeWithoutTimeout,n.state.closesAt-Date.now())})},n.closeWithoutTimeout=function(){n.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},n.afterClose)},n.handleKeyDown=function(e){e.keyCode===g&&(0,l.default)(n.content,e),n.props.shouldCloseOnEsc&&e.keyCode===y&&(e.stopPropagation(),n.requestClose(e))},n.handleOverlayOnClick=function(e){null===n.shouldClose&&(n.shouldClose=!0),n.shouldClose&&n.props.shouldCloseOnOverlayClick&&(n.ownerHandlesClose()?n.requestClose(e):n.focusContent()),n.shouldClose=null},n.handleContentOnMouseUp=function(){n.shouldClose=!1},n.handleOverlayOnMouseDown=function(e){n.props.shouldCloseOnOverlayClick||e.target!=n.overlay||e.preventDefault()},n.handleContentOnClick=function(){n.shouldClose=!1},n.handleContentOnMouseDown=function(){n.shouldClose=!1},n.requestClose=function(e){return n.ownerHandlesClose()&&n.props.onRequestClose(e)},n.ownerHandlesClose=function(){return n.props.onRequestClose},n.shouldBeClosed=function(){return!n.state.isOpen&&!n.state.beforeClose},n.contentHasFocus=function(){return document.activeElement===n.content||n.content.contains(document.activeElement)},n.buildClassName=function(e,t){var r="object"===(void 0===t?"undefined":o(t))?t:{base:v[e],afterOpen:v[e]+"--after-open",beforeClose:v[e]+"--before-close"},i=r.base;return n.state.afterOpen&&(i=i+" "+r.afterOpen),n.state.beforeClose&&(i=i+" "+r.beforeClose),"string"==typeof t&&t?i+" "+t:i},n.attributesFromObject=function(e,t){return Object.keys(t).reduce(function(n,r){return n[e+"-"+r]=t[r],n},{})},n.state={afterOpen:!1,beforeClose:!1},n.shouldClose=null,n.moveFromContentToOverlay=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.Component),i(t,[{key:"componentDidMount",value:function(){this.props.isOpen&&this.open()}},{key:"componentDidUpdate",value:function(e,t){this.props.isOpen&&!e.isOpen?this.open():!this.props.isOpen&&e.isOpen&&this.close(),this.props.shouldFocusAfterRender&&this.state.isOpen&&!t.isOpen&&this.focusContent()}},{key:"componentWillUnmount",value:function(){this.afterClose(),clearTimeout(this.closeTimer)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,r=e.htmlOpenClassName,o=e.bodyOpenClassName;o&&p.add(document.body,o),r&&p.add(document.getElementsByTagName("html")[0],r),n&&(b+=1,f.hide(t))}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.overlayClassName,o=e.defaultStyles,i=t?{}:o.content,a=n?{}:o.overlay;return this.shouldBeClosed()?null:u.default.createElement("div",{ref:this.setOverlayRef,className:this.buildClassName("overlay",n),style:r({},a,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown},u.default.createElement("div",r({ref:this.setContentRef,style:r({},i,this.props.style.content),className:this.buildClassName("content",t),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.attributesFromObject("aria",this.props.aria||{}),this.attributesFromObject("data",this.props.data||{}),{"data-testid":this.props.testId}),this.props.children))}}]),t}();w.defaultProps={style:{overlay:{},content:{}},defaultStyles:{}},w.propTypes={isOpen:c.default.bool.isRequired,defaultStyles:c.default.shape({content:c.default.object,overlay:c.default.object}),style:c.default.shape({content:c.default.object,overlay:c.default.object}),className:c.default.oneOfType([c.default.string,c.default.object]),overlayClassName:c.default.oneOfType([c.default.string,c.default.object]),bodyOpenClassName:c.default.string,htmlOpenClassName:c.default.string,ariaHideApp:c.default.bool,appElement:c.default.instanceOf(d.default),onAfterOpen:c.default.func,onAfterClose:c.default.func,onRequestClose:c.default.func,closeTimeoutMS:c.default.number,shouldFocusAfterRender:c.default.bool,shouldCloseOnOverlayClick:c.default.bool,shouldReturnFocusAfterClose:c.default.bool,role:c.default.string,contentLabel:c.default.string,aria:c.default.object,data:c.default.object,children:c.default.node,shouldCloseOnEsc:c.default.bool,overlayRef:c.default.func,contentRef:c.default.func,testId:c.default.string},t.default=w,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.handleBlur=s,t.handleFocus=l,t.markForFocusLater=function(){a.push(document.activeElement)},t.returnFocus=function(){var e=null;try{return void(0!==a.length&&(e=a.pop()).focus())}catch(t){console.warn(["You tried to return focus to",e,"but it is not in the DOM anymore"].join(" "))}},t.popWithoutFocus=function(){a.length>0&&a.pop()},t.setupScopedFocus=function(e){u=e,window.addEventListener?(window.addEventListener("blur",s,!1),document.addEventListener("focus",l,!0)):(window.attachEvent("onBlur",s),document.attachEvent("onFocus",l))},t.teardownScopedFocus=function(){u=null,window.addEventListener?(window.removeEventListener("blur",s),document.removeEventListener("focus",l)):(window.detachEvent("onBlur",s),document.detachEvent("onFocus",l))};var r,o=n(777),i=(r=o)&&r.__esModule?r:{default:r};var a=[],u=null,c=!1;function s(){c=!0}function l(){if(c){if(c=!1,!u)return;setTimeout(function(){u.contains(document.activeElement)||((0,i.default)(u)[0]||u).focus()},0)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,i.default)(e);if(!n.length)return void t.preventDefault();var r,o=t.shiftKey,a=n[0],u=n[n.length-1];if(e===document.activeElement){if(!o)return;r=u}u!==document.activeElement||o||(r=a);a===document.activeElement&&o&&(r=u);if(r)return t.preventDefault(),void r.focus();var c=/(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);if(null==c||"Chrome"==c[1]||null!=/\biPod\b|\biPad\b/g.exec(navigator.userAgent))return;var s=n.indexOf(document.activeElement);s>-1&&(s+=o?-1:1);if(void 0===n[s])return t.preventDefault(),void(r=o?u:a).focus();t.preventDefault(),n[s].focus()};var r,o=n(777),i=(r=o)&&r.__esModule?r:{default:r};e.exports=t.default},function(e,t,n){"use strict";e.exports=function(){}},function(e,t,n){var r;
|
83 |
/*!
|
84 |
Copyright (c) 2015 Jed Watson.
|
85 |
Based on code that is Copyright 2013-2015, Facebook, Inc.
|
includes/admin/class-wprm-tools-manager.php
CHANGED
@@ -224,11 +224,15 @@ class WPRM_Tools_Manager {
|
|
224 |
|
225 |
if ( $recipe ) {
|
226 |
// Get comment ratings.
|
227 |
-
$
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
|
|
|
|
|
|
|
|
232 |
|
233 |
foreach ( $comments as $comment ) {
|
234 |
$comment_rating = intval( get_comment_meta( $comment->comment_ID, 'wprm-comment-rating', true ) );
|
224 |
|
225 |
if ( $recipe ) {
|
226 |
// Get comment ratings.
|
227 |
+
$comments = array();
|
228 |
+
|
229 |
+
if ( $recipe->parent_post_id() ) {
|
230 |
+
$args = array(
|
231 |
+
'post_id' => $recipe->parent_post_id(),
|
232 |
+
'status' => 'all',
|
233 |
+
);
|
234 |
+
$comments = get_comments( $args );
|
235 |
+
}
|
236 |
|
237 |
foreach ( $comments as $comment ) {
|
238 |
$comment_rating = intval( get_comment_meta( $comment->comment_ID, 'wprm-comment-rating', true ) );
|
includes/admin/import/class-wprm-import-create.php
ADDED
@@ -0,0 +1,551 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Responsible for importing MV Create recipes.
|
4 |
+
*
|
5 |
+
* @link http://bootstrapped.ventures
|
6 |
+
* @since 5.4.0
|
7 |
+
*
|
8 |
+
* @package WP_Recipe_Maker
|
9 |
+
* @subpackage WP_Recipe_Maker/includes/admin/import
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Responsible for importing MV Create recipes.
|
14 |
+
*
|
15 |
+
* @since 5.4.0
|
16 |
+
* @package WP_Recipe_Maker
|
17 |
+
* @subpackage WP_Recipe_Maker/includes/admin/import
|
18 |
+
* @author Brecht Vandersmissen <brecht@bootstrapped.ventures>
|
19 |
+
*/
|
20 |
+
class WPRM_Import_Create extends WPRM_Import {
|
21 |
+
/**
|
22 |
+
* Get the UID of this import source.
|
23 |
+
*
|
24 |
+
* @since 5.4.0
|
25 |
+
*/
|
26 |
+
public function get_uid() {
|
27 |
+
return 'create';
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Wether or not this importer requires a manual search for recipes.
|
32 |
+
*
|
33 |
+
* @since 5.4.0
|
34 |
+
*/
|
35 |
+
public function requires_search() {
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Get the name of this import source.
|
41 |
+
*
|
42 |
+
* @since 5.4.0
|
43 |
+
*/
|
44 |
+
public function get_name() {
|
45 |
+
return 'MV Create';
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get HTML for the import settings.
|
50 |
+
*
|
51 |
+
* @since 5.4.0
|
52 |
+
*/
|
53 |
+
public function get_settings_html() {
|
54 |
+
return '';
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Get the total number of recipes to import.
|
59 |
+
*
|
60 |
+
* @since 5.4.0
|
61 |
+
*/
|
62 |
+
public function get_recipe_count() {
|
63 |
+
return count( $this->get_recipes() );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Get a list of recipes that are available to import.
|
68 |
+
*
|
69 |
+
* @since 5.4.0
|
70 |
+
* @param int $page Page of recipes to get.
|
71 |
+
*/
|
72 |
+
public function get_recipes( $page = 0 ) {
|
73 |
+
$recipes = array();
|
74 |
+
|
75 |
+
global $wpdb;
|
76 |
+
$table = $wpdb->prefix . 'mv_creations';
|
77 |
+
|
78 |
+
$mv_recipes = array();
|
79 |
+
if ( $table === $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) ) {
|
80 |
+
$mv_recipes = $wpdb->get_results( 'SELECT id, object_id, title, type FROM ' . $table . ' WHERE type IN ("recipe","diy")' );
|
81 |
+
}
|
82 |
+
|
83 |
+
foreach ( $mv_recipes as $mv_recipe ) {
|
84 |
+
if ( WPRM_POST_TYPE !== get_post_type( $mv_recipe->object_id ) ) {
|
85 |
+
$recipes[ $mv_recipe->id ] = array(
|
86 |
+
'name' => $mv_recipe->title,
|
87 |
+
'url' => admin_url( 'post.php?action=edit&id=' . intval( $mv_recipe->id ) . '&post=' . intval( $mv_recipe->object_id ) . '&post_type=mv_create&type=' . urlencode( $mv_recipe->type ) ),
|
88 |
+
);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
return $recipes;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Get recipe with the specified ID in the import format.
|
97 |
+
*
|
98 |
+
* @since 5.4.0
|
99 |
+
* @param mixed $id ID of the recipe we want to import.
|
100 |
+
* @param array $post_data POST data passed along when submitting the form.
|
101 |
+
*/
|
102 |
+
public function get_recipe( $id, $post_data ) {
|
103 |
+
global $wpdb;
|
104 |
+
$table = $wpdb->prefix . 'mv_creations';
|
105 |
+
|
106 |
+
$mv_recipe = false;
|
107 |
+
if ( $table === $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) ) {
|
108 |
+
$rows = $wpdb->get_results( 'SELECT * FROM ' . $table . ' WHERE id=' . intval( $id ) );
|
109 |
+
|
110 |
+
if ( is_array( $rows ) && 1 === count( $rows ) ) {
|
111 |
+
$mv_recipe = (array) $rows[0];
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
// Make sure we found the corresponding recipe, die otherwise.
|
116 |
+
if ( false === $mv_recipe ) {
|
117 |
+
wp_die( 'Could not find the MV table or recipe.' );
|
118 |
+
}
|
119 |
+
|
120 |
+
$post_id = isset( $mv_recipe['object_id'] ) ? intval( $mv_recipe['object_id'] ) : 0;
|
121 |
+
|
122 |
+
$recipe = array(
|
123 |
+
'import_id' => $post_id,
|
124 |
+
'import_backup' => array(
|
125 |
+
'mv_creation_id' => $id,
|
126 |
+
),
|
127 |
+
);
|
128 |
+
|
129 |
+
// Recipe type.
|
130 |
+
$recipe['type'] = 'diy' === $mv_recipe['type'] ? 'howto' : 'food';
|
131 |
+
|
132 |
+
// Featured Image.
|
133 |
+
$recipe['image_id'] = $mv_recipe['thumbnail_id'];
|
134 |
+
|
135 |
+
// Simple Matching.
|
136 |
+
$recipe['name'] = $mv_recipe['title'];
|
137 |
+
$recipe['summary'] = $mv_recipe['description'];
|
138 |
+
$recipe['cost'] = $mv_recipe['estimated_cost'];
|
139 |
+
$recipe['author_name'] = $mv_recipe['author'];
|
140 |
+
|
141 |
+
if ( $recipe['author_name'] ) {
|
142 |
+
$recipe['author_display'] = 'custom';
|
143 |
+
}
|
144 |
+
|
145 |
+
// Servings.
|
146 |
+
$mv_yield = $mv_recipe['yield'];
|
147 |
+
$match = preg_match( '/^\s*\d+/', $mv_yield, $servings_array );
|
148 |
+
if ( 1 === $match ) {
|
149 |
+
$servings = str_replace( ' ','', $servings_array[0] );
|
150 |
+
} else {
|
151 |
+
$servings = '';
|
152 |
+
}
|
153 |
+
|
154 |
+
$servings_unit = preg_replace( '/^\s*\d+\s*/', '', $mv_yield );
|
155 |
+
|
156 |
+
$recipe['servings'] = $servings;
|
157 |
+
$recipe['servings_unit'] = $servings_unit;
|
158 |
+
|
159 |
+
// Recipe times. From seconds to minutes.
|
160 |
+
$recipe['prep_time'] = intval( $mv_recipe['prep_time'] ) / 60;
|
161 |
+
$recipe['cook_time'] = intval( $mv_recipe['active_time'] ) / 60;
|
162 |
+
$recipe['custom_time'] = intval( $mv_recipe['additional_time'] ) / 60;
|
163 |
+
$recipe['custom_time_label'] = $mv_recipe['additional_time_label'];
|
164 |
+
$recipe['total_time'] = intval( $mv_recipe['total_time'] ) / 60;
|
165 |
+
|
166 |
+
// Recipe tags.
|
167 |
+
$recipe['tags'] = array();
|
168 |
+
$recipe['tags']['keyword'] = $mv_recipe['keywords'] ? array_map( 'trim', explode( ',', $mv_recipe['keywords'] ) ) : array();
|
169 |
+
|
170 |
+
$taxonomies = array(
|
171 |
+
'category' => 'course',
|
172 |
+
'mv_cuisine' => 'cuisine',
|
173 |
+
);
|
174 |
+
|
175 |
+
foreach ( $taxonomies as $mv_tag => $wprm_tag ) {
|
176 |
+
$terms = get_the_terms( $post_id, $mv_tag );
|
177 |
+
if ( $terms && ! is_wp_error( $terms ) ) {
|
178 |
+
foreach ( $terms as $term ) {
|
179 |
+
$recipe['tags'][ $wprm_tag ][] = $term->name;
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
// Recipe video.
|
185 |
+
if ( $mv_recipe['external_video'] ) {
|
186 |
+
$mv_video = (array) json_decode( $mv_recipe['external_video'] );
|
187 |
+
|
188 |
+
|
189 |
+
if ( isset( $mv_video['contentUrl'] ) ) {
|
190 |
+
$recipe['video_embed'] = $mv_video['contentUrl'];
|
191 |
+
}
|
192 |
+
} else if ( $mv_recipe['video'] ) {
|
193 |
+
$mv_video = (array) json_decode( $mv_recipe['video'] );
|
194 |
+
|
195 |
+
if ( $mv_video['key'] ) {
|
196 |
+
$key = esc_attr( $mv_video['key'] );
|
197 |
+
$recipe['video_embed'] = '<div id="' . $key . '"></div><script type="text/javascript" src="//video.mediavine.com/videos/' . $key . '.js" async data-noptimize></script>';
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
// Pinterest Image.
|
202 |
+
if ( $mv_recipe['pinterest_img_id'] ) {
|
203 |
+
$recipe['pin_image_id'] = intval( $mv_recipe['pinterest_img_id'] );
|
204 |
+
}
|
205 |
+
|
206 |
+
// Ingredients.
|
207 |
+
$mv_published = (array) json_decode( $mv_recipe['published'] );
|
208 |
+
$mv_ingredients = 'food' === $recipe['type'] ? (array) $mv_published['ingredients'] : (array) $mv_published['materials'];
|
209 |
+
$ingredients = array();
|
210 |
+
$has_ingredient_links = false;
|
211 |
+
|
212 |
+
foreach ( $mv_ingredients as $mv_group_name => $mv_group_ingredients ) {
|
213 |
+
$group = array(
|
214 |
+
'name' => 'mv-has-no-group' === $mv_group_name ? '' : $mv_group_name,
|
215 |
+
'ingredients' => array(),
|
216 |
+
);
|
217 |
+
|
218 |
+
foreach ( $mv_group_ingredients as $mv_ingredient ) {
|
219 |
+
$mv_ingredient = (array) $mv_ingredient;
|
220 |
+
$text = trim( $mv_ingredient['original_text'] );
|
221 |
+
|
222 |
+
if ( ! empty( $text ) ) {
|
223 |
+
$ingredient = array(
|
224 |
+
'raw' => $text,
|
225 |
+
);
|
226 |
+
|
227 |
+
// Check for ingredient link.
|
228 |
+
if ( $mv_ingredient['link'] ) {
|
229 |
+
$ingredient['link'] = array(
|
230 |
+
'url' => $mv_ingredient['link'],
|
231 |
+
'nofollow' => '0' === $mv_ingredient['nofollow'] ? 'follow' : 'nofollow',
|
232 |
+
);
|
233 |
+
$has_ingredient_links = true;
|
234 |
+
}
|
235 |
+
|
236 |
+
$group['ingredients'][] = $ingredient;
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
$ingredients[] = $group;
|
241 |
+
}
|
242 |
+
$recipe['ingredients'] = $ingredients;
|
243 |
+
|
244 |
+
if ( $has_ingredient_links ) {
|
245 |
+
$recipe['ingredient_links_type'] = 'custom';
|
246 |
+
}
|
247 |
+
|
248 |
+
// Equipment.
|
249 |
+
$mv_equipment = (array) $mv_published['tools'];
|
250 |
+
$equipment = array();
|
251 |
+
|
252 |
+
foreach ( $mv_equipment as $mv_group_name => $mv_group_equipment ) {
|
253 |
+
foreach ( $mv_group_equipment as $mv_item ) {
|
254 |
+
$mv_item = (array) $mv_item;
|
255 |
+
$text = trim( $mv_item['original_text'] );
|
256 |
+
|
257 |
+
if ( ! empty( $text ) ) {
|
258 |
+
$equipment[] = array(
|
259 |
+
'name' => $text,
|
260 |
+
);
|
261 |
+
}
|
262 |
+
}
|
263 |
+
}
|
264 |
+
$recipe['equipment'] = $equipment;
|
265 |
+
|
266 |
+
// Instructions.
|
267 |
+
$mv_instructions = $this->parse_blob( $mv_recipe['instructions'] );
|
268 |
+
$instructions = array();
|
269 |
+
|
270 |
+
foreach ( $mv_instructions as $mv_group ) {
|
271 |
+
$group = array(
|
272 |
+
'name' => trim( strip_tags( $mv_group['name'], '<a><strong><b><em><i><u><sub><sup>' ) ),
|
273 |
+
'instructions' => array(),
|
274 |
+
);
|
275 |
+
|
276 |
+
foreach ( $mv_group['items'] as $mv_item ) {
|
277 |
+
$text = trim( strip_tags( $mv_item, '<a><strong><b><em><i><u><sub><sup><br>' ) );
|
278 |
+
|
279 |
+
// Find any images.
|
280 |
+
preg_match_all( '/\[mv_img[^\]]*\]/i', $mv_item, $img_shortcodes );
|
281 |
+
|
282 |
+
foreach ( $img_shortcodes[0] as $img_shortcode ) {
|
283 |
+
$img_shortcode = html_entity_decode( $img_shortcode );
|
284 |
+
preg_match( '/id="?\'?(\d+)/i', $img_shortcode, $img );
|
285 |
+
|
286 |
+
if ( $img[1] ) {
|
287 |
+
$image_id = intval( $img[1] );
|
288 |
+
|
289 |
+
if ( $image_id ) {
|
290 |
+
$group['instructions'][] = array(
|
291 |
+
'text' => $text,
|
292 |
+
'image' => $image_id,
|
293 |
+
);
|
294 |
+
$text = ''; // Only add same text once.
|
295 |
+
}
|
296 |
+
}
|
297 |
+
}
|
298 |
+
|
299 |
+
if ( ! empty( $text ) ) {
|
300 |
+
$group['instructions'][] = array(
|
301 |
+
'text' => $text,
|
302 |
+
);
|
303 |
+
}
|
304 |
+
}
|
305 |
+
|
306 |
+
$instructions[] = $group;
|
307 |
+
}
|
308 |
+
$recipe['instructions'] = $instructions;
|
309 |
+
|
310 |
+
// Nutrition Facts.
|
311 |
+
$recipe['nutrition'] = array();
|
312 |
+
|
313 |
+
$mv_nutrition = (array) $mv_published['nutrition'];
|
314 |
+
|
315 |
+
// Serving size.
|
316 |
+
$mv_serving_size = isset( $mv_nutrition['serving_size'] ) ? trim( $mv_nutrition['serving_size'] ) : '';
|
317 |
+
$match = preg_match( '/^\s*\d+/', $mv_serving_size, $servings_array );
|
318 |
+
if ( 1 === $match ) {
|
319 |
+
$servings = str_replace( ' ','', $servings_array[0] );
|
320 |
+
} else {
|
321 |
+
$servings = '';
|
322 |
+
}
|
323 |
+
|
324 |
+
$servings_unit = preg_replace( '/^\s*\d+\s*/', '', $mv_serving_size );
|
325 |
+
|
326 |
+
$recipe['nutrition']['serving_size'] = $servings;
|
327 |
+
$recipe['nutrition']['serving_unit'] = $servings_unit;
|
328 |
+
|
329 |
+
// Other nutrients.
|
330 |
+
$nutrition_mapping = array(
|
331 |
+
'calories' => 'calories',
|
332 |
+
'carbohydrates' => 'carbohydrates',
|
333 |
+
'protein' => 'protein',
|
334 |
+
'total_fat' => 'fat',
|
335 |
+
'saturated_fat' => 'saturated_fat',
|
336 |
+
'unsaturated_fat' => 'polyunsaturated_fat',
|
337 |
+
'trans_fat' => 'trans_fat',
|
338 |
+
'cholesterol' => 'cholesterol',
|
339 |
+
'sodium' => 'sodium',
|
340 |
+
'fiber' => 'fiber',
|
341 |
+
'sugar' => 'sugar',
|
342 |
+
'sugar_alcohols' => 'sugar_alcohols',
|
343 |
+
);
|
344 |
+
|
345 |
+
foreach ( $nutrition_mapping as $mv_field => $wprm_field ) {
|
346 |
+
if ( isset( $mv_nutrition[ $mv_field ] ) && $mv_nutrition[ $mv_field ] ) {
|
347 |
+
$recipe['nutrition'][ $wprm_field ] = $mv_nutrition[ $mv_field ];
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
// Recipe Notes.
|
352 |
+
$notes = $mv_recipe['notes'];
|
353 |
+
|
354 |
+
// Find any images.
|
355 |
+
preg_match_all( '/\[mv_img[^\]]*\]/i', $notes, $img_shortcodes );
|
356 |
+
|
357 |
+
foreach ( $img_shortcodes[0] as $img_shortcode_encoded ) {
|
358 |
+
$img_shortcode = html_entity_decode( $img_shortcode_encoded );
|
359 |
+
preg_match( '/id="?\'?(\d+)/i', $img_shortcode, $img );
|
360 |
+
|
361 |
+
if ( $img[1] ) {
|
362 |
+
$image_id = intval( $img[1] );
|
363 |
+
|
364 |
+
if ( $image_id ) {
|
365 |
+
$image_html = wp_get_attachment_image( $image_id, 'medium' );
|
366 |
+
|
367 |
+
if ( $image_html ) {
|
368 |
+
$notes = str_replace( $img_shortcode_encoded, $image_html, $notes );
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
+
}
|
373 |
+
|
374 |
+
$recipe['notes'] = $notes;
|
375 |
+
|
376 |
+
return $recipe;
|
377 |
+
}
|
378 |
+
|
379 |
+
/**
|
380 |
+
* Replace the original recipe with the newly imported WPRM one.
|
381 |
+
*
|
382 |
+
* @since 5.4.0
|
383 |
+
* @param mixed $id ID of the recipe we want replace.
|
384 |
+
* @param mixed $wprm_id ID of the WPRM recipe to replace with.
|
385 |
+
* @param array $post_data POST data passed along when submitting the form.
|
386 |
+
*/
|
387 |
+
public function replace_recipe( $id, $wprm_id, $post_data ) {
|
388 |
+
global $wpdb;
|
389 |
+
$table = $wpdb->prefix . 'mv_creations';
|
390 |
+
|
391 |
+
$mv_recipe = false;
|
392 |
+
if ( $table === $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) ) {
|
393 |
+
$rows = $wpdb->get_results( 'SELECT * FROM ' . $table . ' WHERE id=' . intval( $id ) );
|
394 |
+
|
395 |
+
if ( is_array( $rows ) && 1 === count( $rows ) ) {
|
396 |
+
$mv_recipe = (array) $rows[0];
|
397 |
+
}
|
398 |
+
}
|
399 |
+
|
400 |
+
// Make sure we found the corresponding recipe, die otherwise.
|
401 |
+
if ( false === $mv_recipe ) {
|
402 |
+
wp_die( 'Could not find the MV table or recipe.' );
|
403 |
+
}
|
404 |
+
|
405 |
+
// Get all associated posts.
|
406 |
+
$post_ids = json_decode( $mv_recipe['associated_posts'] );
|
407 |
+
foreach ( $post_ids as $post_id ) {
|
408 |
+
$post = get_post( $post_id );
|
409 |
+
$content = $post->post_content;
|
410 |
+
|
411 |
+
// Gutenberg.
|
412 |
+
$gutenberg_matches = array();
|
413 |
+
if ( 'diy' === $mv_recipe['type'] ) {
|
414 |
+
$gutenberg_patern = '/<!--\s+wp:(mv\/diy)(\s+(\{.*?\}))?\s+(\/)?-->.*?<!--\s+\/wp:mv\/diy\s+(\/)?-->/mis';
|
415 |
+
} else {
|
416 |
+
$gutenberg_patern = '/<!--\s+wp:(mv\/recipe)(\s+(\{.*?\}))?\s+(\/)?-->.*?<!--\s+\/wp:mv\/recipe\s+(\/)?-->/mis';
|
417 |
+
}
|
418 |
+
preg_match_all( $gutenberg_patern, $content, $matches );
|
419 |
+
|
420 |
+
if ( isset( $matches[3] ) ) {
|
421 |
+
foreach ( $matches[3] as $index => $block_attributes_json ) {
|
422 |
+
if ( ! empty( $block_attributes_json ) ) {
|
423 |
+
$attributes = json_decode( $block_attributes_json, true );
|
424 |
+
|
425 |
+
if ( ! is_null( $attributes ) ) {
|
426 |
+
if ( isset( $attributes['id'] ) && $id === $attributes['id'] ) {
|
427 |
+
$content = str_ireplace( $matches[0][ $index ], '<!-- wp:wp-recipe-maker/recipe {"id":' . $wprm_id . ',"updated":' . time() . '} -->[wprm-recipe id="' . $wprm_id . '"]<!-- /wp:wp-recipe-maker/recipe -->', $content );
|
428 |
+
}
|
429 |
+
}
|
430 |
+
}
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
// Classic Editor.
|
435 |
+
$classic_pattern = '/\[mv_create\s.*?key=\"?\'?(\d+)\"?\'?.*?\]/mi';
|
436 |
+
preg_match_all( $classic_pattern, $content, $classic_matches );
|
437 |
+
|
438 |
+
if ( isset( $classic_matches[1] ) ) {
|
439 |
+
foreach ( $classic_matches[1] as $index => $mv_id ) {
|
440 |
+
if ( $id === $mv_id ) {
|
441 |
+
$content = str_ireplace( $classic_matches[0][ $index ], '[wprm-recipe id="' . $wprm_id . '"]', $content );
|
442 |
+
}
|
443 |
+
}
|
444 |
+
}
|
445 |
+
|
446 |
+
// Update post with new content including our shortcodes.
|
447 |
+
if ( $content !== $post->post_content ) {
|
448 |
+
$update_content = array(
|
449 |
+
'ID' => $post_id,
|
450 |
+
'post_content' => $content,
|
451 |
+
);
|
452 |
+
wp_update_post( $update_content );
|
453 |
+
}
|
454 |
+
}
|
455 |
+
|
456 |
+
// Migrate ratings.
|
457 |
+
$table = $wpdb->prefix . 'mv_reviews';
|
458 |
+
|
459 |
+
$mv_ratings = false;
|
460 |
+
if ( $table === $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) ) {
|
461 |
+
$rows = $wpdb->get_results( 'SELECT * FROM ' . $table . ' WHERE creation=' . intval( $id ) );
|
462 |
+
|
463 |
+
if ( is_array( $rows ) ) {
|
464 |
+
$mv_ratings = (array) $rows;
|
465 |
+
}
|
466 |
+
}
|
467 |
+
|
468 |
+
if ( $mv_ratings ) {
|
469 |
+
foreach ( $mv_ratings as $mv_rating ) {
|
470 |
+
$mv_rating = (array) $mv_rating;
|
471 |
+
|
472 |
+
$rating = array(
|
473 |
+
'recipe_id' => $wprm_id,
|
474 |
+
'user_id' => '',
|
475 |
+
'ip' => 'mv-create-' . $mv_rating['id'],
|
476 |
+
'rating' => ceil( floatval( $mv_rating['rating'] ) ),
|
477 |
+
);
|
478 |
+
|
479 |
+
WPRM_Rating_Database::add_or_update_rating( $rating );
|
480 |
+
}
|
481 |
+
}
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* Blob to array.
|
486 |
+
*
|
487 |
+
* @since 5.4.0
|
488 |
+
* @param mixed $blob Blob to parse.
|
489 |
+
*/
|
490 |
+
private function parse_blob( $blob ) {
|
491 |
+
$component_list = array();
|
492 |
+
$component_group = array(
|
493 |
+
'name' => '',
|
494 |
+
'items' => array(),
|
495 |
+
);
|
496 |
+
|
497 |
+
// Split in different parts.
|
498 |
+
$blob = preg_replace( '/<ol(\s[^>]*>|>)/mi', '$0' . PHP_EOL, $blob );
|
499 |
+
$blob = str_ireplace( '</li>', '</li>' . PHP_EOL, $blob );
|
500 |
+
$blob = str_ireplace( '</ol>', '</ol>' . PHP_EOL, $blob );
|
501 |
+
$blob = str_ireplace( '</h3>', '</h3>' . PHP_EOL, $blob );
|
502 |
+
$blob = str_ireplace( '</p>', '</p>' . PHP_EOL, $blob );
|
503 |
+
|
504 |
+
$bits = explode( PHP_EOL, $blob );
|
505 |
+
foreach ( $bits as $bit ) {
|
506 |
+
|
507 |
+
$test_bit = trim( $bit );
|
508 |
+
if ( empty( $test_bit ) ) {
|
509 |
+
continue;
|
510 |
+
}
|
511 |
+
|
512 |
+
if ( $this->is_heading( $bit ) ) {
|
513 |
+
$component_list[] = $component_group;
|
514 |
+
|
515 |
+
$component_group = array(
|
516 |
+
'name' => $bit,
|
517 |
+
'items' => array(),
|
518 |
+
);
|
519 |
+
} else {
|
520 |
+
$component_group['items'][] = $bit;
|
521 |
+
}
|
522 |
+
}
|
523 |
+
|
524 |
+
$component_list[] = $component_group;
|
525 |
+
|
526 |
+
return $component_list;
|
527 |
+
}
|
528 |
+
|
529 |
+
/**
|
530 |
+
* Check if line is heading.
|
531 |
+
*
|
532 |
+
* @since 5.4.0
|
533 |
+
* @param mixed $string String to parse.
|
534 |
+
*/
|
535 |
+
private function is_heading( $string ) {
|
536 |
+
$string = trim( $string );
|
537 |
+
// For The Red Beans:.
|
538 |
+
if ( ':' === substr( $string, -1, 1 ) ) {
|
539 |
+
return true;
|
540 |
+
}
|
541 |
+
// <strong>For The Red Beans</strong>.
|
542 |
+
if ( '<strong>' === substr( $string, 0, 8 ) && '</strong>' === substr( $string, -9, 9 ) ) {
|
543 |
+
return true;
|
544 |
+
}
|
545 |
+
// <h3>For The Red Beans</h3>.
|
546 |
+
if ( preg_match( '#^<h[1-6]>.+<\/h[1-6]>$#', $string ) ) {
|
547 |
+
return true;
|
548 |
+
}
|
549 |
+
return false;
|
550 |
+
}
|
551 |
+
}
|
includes/class-wp-recipe-maker.php
CHANGED
@@ -31,7 +31,7 @@ class WP_Recipe_Maker {
|
|
31 |
* @since 1.0.0
|
32 |
*/
|
33 |
private function define_constants() {
|
34 |
-
define( 'WPRM_VERSION', '5.
|
35 |
define( 'WPRM_PREMIUM_VERSION_REQUIRED', '5.3.0' );
|
36 |
define( 'WPRM_POST_TYPE', 'wprm_recipe' );
|
37 |
define( 'WPRM_DIR', plugin_dir_path( dirname( __FILE__ ) ) );
|
31 |
* @since 1.0.0
|
32 |
*/
|
33 |
private function define_constants() {
|
34 |
+
define( 'WPRM_VERSION', '5.4.0' );
|
35 |
define( 'WPRM_PREMIUM_VERSION_REQUIRED', '5.3.0' );
|
36 |
define( 'WPRM_POST_TYPE', 'wprm_recipe' );
|
37 |
define( 'WPRM_DIR', plugin_dir_path( dirname( __FILE__ ) ) );
|
includes/public/class-wprm-metadata-video.php
CHANGED
@@ -249,10 +249,13 @@ class WPRM_MetadataVideo {
|
|
249 |
$name = isset( $oembed_data->title ) ? $oembed_data->title : '';
|
250 |
$description = isset( $oembed_data->description ) ? $oembed_data->description : '';
|
251 |
$duration = isset( $oembed_data->duration ) ? 'PT' . intval( $oembed_data->duration ) . 'S' : '';
|
252 |
-
$content_url = isset( $oembed_data->content_url ) ? $oembed_data->content_url : '';
|
253 |
$thumbnail_url = isset( $oembed_data->thumbnail_url ) ? $oembed_data->thumbnail_url : '';
|
254 |
$upload_date = isset( $oembed_data->upload_date ) ? date( 'c', strtotime( $oembed_data->upload_date ) ) : '';
|
255 |
|
|
|
|
|
|
|
|
|
256 |
$metadata = array(
|
257 |
'name' => $name,
|
258 |
'description' => $description,
|
249 |
$name = isset( $oembed_data->title ) ? $oembed_data->title : '';
|
250 |
$description = isset( $oembed_data->description ) ? $oembed_data->description : '';
|
251 |
$duration = isset( $oembed_data->duration ) ? 'PT' . intval( $oembed_data->duration ) . 'S' : '';
|
|
|
252 |
$thumbnail_url = isset( $oembed_data->thumbnail_url ) ? $oembed_data->thumbnail_url : '';
|
253 |
$upload_date = isset( $oembed_data->upload_date ) ? date( 'c', strtotime( $oembed_data->upload_date ) ) : '';
|
254 |
|
255 |
+
// Default to oEmbed URL.
|
256 |
+
$content_url = isset( $oembed_data->content_url ) ? $oembed_data->content_url : '';
|
257 |
+
$content_url = $content_url ? $content_url : $url;
|
258 |
+
|
259 |
$metadata = array(
|
260 |
'name' => $name,
|
261 |
'description' => $description,
|
includes/public/class-wprm-metadata-yoast-seo.php
CHANGED
@@ -95,9 +95,7 @@ class WPRM_Metadata_Yoast_Seo implements WPSEO_Graph_Piece {
|
|
95 |
WPRM_Metadata::outputted_metadata_for( $this->recipe->id() );
|
96 |
$metadata['@id'] = $this->context->canonical . '#recipe';
|
97 |
|
98 |
-
$
|
99 |
-
|
100 |
-
$metadata['isPartOf'] = array( '@id' => $parent );
|
101 |
$metadata['mainEntityOfPage'] = $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH;
|
102 |
|
103 |
return $metadata;
|
95 |
WPRM_Metadata::outputted_metadata_for( $this->recipe->id() );
|
96 |
$metadata['@id'] = $this->context->canonical . '#recipe';
|
97 |
|
98 |
+
$metadata['isPartOf'] = array( '@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH );
|
|
|
|
|
99 |
$metadata['mainEntityOfPage'] = $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH;
|
100 |
|
101 |
return $metadata;
|
includes/public/class-wprm-rating-database.php
CHANGED
@@ -125,7 +125,7 @@ class WPRM_Rating_Database {
|
|
125 |
$rating['recipe_id'] = isset( $unsanitized_rating['recipe_id'] ) ? intval( $unsanitized_rating['recipe_id'] ) : 0;
|
126 |
$rating['comment_id'] = isset( $unsanitized_rating['comment_id'] ) ? intval( $unsanitized_rating['comment_id'] ) : 0;
|
127 |
$rating['user_id'] = isset( $unsanitized_rating['user_id'] ) ? intval( $unsanitized_rating['user_id'] ) : 0;
|
128 |
-
$rating['ip'] = isset( $unsanitized_rating['ip'] ) && $unsanitized_rating['ip'] ? $unsanitized_rating['ip'] : '';
|
129 |
$rating['rating'] = isset( $unsanitized_rating['rating'] ) ? intval( $unsanitized_rating['rating'] ) : 0;
|
130 |
|
131 |
// Get post ID for comment.
|
125 |
$rating['recipe_id'] = isset( $unsanitized_rating['recipe_id'] ) ? intval( $unsanitized_rating['recipe_id'] ) : 0;
|
126 |
$rating['comment_id'] = isset( $unsanitized_rating['comment_id'] ) ? intval( $unsanitized_rating['comment_id'] ) : 0;
|
127 |
$rating['user_id'] = isset( $unsanitized_rating['user_id'] ) ? intval( $unsanitized_rating['user_id'] ) : 0;
|
128 |
+
$rating['ip'] = isset( $unsanitized_rating['ip'] ) && $unsanitized_rating['ip'] ? esc_attr( $unsanitized_rating['ip'] ) : '';
|
129 |
$rating['rating'] = isset( $unsanitized_rating['rating'] ) ? intval( $unsanitized_rating['rating'] ) : 0;
|
130 |
|
131 |
// Get post ID for comment.
|
includes/public/class-wprm-recipe-sanitizer.php
CHANGED
@@ -119,7 +119,7 @@ class WPRM_Recipe_Sanitizer {
|
|
119 |
if ( isset( $ingredient_group['ingredients'] ) ) {
|
120 |
foreach ( $ingredient_group['ingredients'] as $ingredient ) {
|
121 |
if ( isset( $ingredient['raw'] ) && ! isset( $ingredient['name'] ) ) {
|
122 |
-
$ingredient = WPRM_Recipe_Parser::parse_ingredient( $ingredient['raw'] );
|
123 |
}
|
124 |
|
125 |
$sanitized_ingredient = array(
|
119 |
if ( isset( $ingredient_group['ingredients'] ) ) {
|
120 |
foreach ( $ingredient_group['ingredients'] as $ingredient ) {
|
121 |
if ( isset( $ingredient['raw'] ) && ! isset( $ingredient['name'] ) ) {
|
122 |
+
$ingredient = array_replace( $ingredient, WPRM_Recipe_Parser::parse_ingredient( $ingredient['raw'] ) );
|
123 |
}
|
124 |
|
125 |
$sanitized_ingredient = array(
|
includes/public/class-wprm-recipe-saver.php
CHANGED
@@ -119,12 +119,8 @@ class WPRM_Recipe_Saver {
|
|
119 |
|
120 |
// Nutrition fields.
|
121 |
if ( isset( $recipe['nutrition'] ) ) {
|
122 |
-
$
|
123 |
-
|
124 |
-
foreach ( $nutrition_fields as $nutrient => $options ) {
|
125 |
-
if ( isset( $recipe['nutrition'][ $nutrient ] ) ) {
|
126 |
-
$meta[ 'wprm_nutrition_' . $nutrient ] = $recipe['nutrition'][ $nutrient ];
|
127 |
-
}
|
128 |
}
|
129 |
}
|
130 |
|
@@ -238,6 +234,12 @@ class WPRM_Recipe_Saver {
|
|
238 |
return;
|
239 |
}
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
if ( 'trash' !== $post->post_status ) {
|
242 |
$categories = get_the_terms( $post, 'category' );
|
243 |
$cat_ids = ! $categories || is_wp_error( $categories ) ? array() : wp_list_pluck( $categories, 'term_id' );
|
119 |
|
120 |
// Nutrition fields.
|
121 |
if ( isset( $recipe['nutrition'] ) ) {
|
122 |
+
foreach ( $recipe['nutrition'] as $nutrient => $value ) {
|
123 |
+
$meta[ 'wprm_nutrition_' . $nutrient ] = $value;
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
}
|
126 |
|
234 |
return;
|
235 |
}
|
236 |
|
237 |
+
// Skip Revision Manager TMC revisions.
|
238 |
+
$rm_tmc = get_post_meta( $post_id, 'linked_post_id', true );
|
239 |
+
if ( $rm_tmc ) {
|
240 |
+
return;
|
241 |
+
}
|
242 |
+
|
243 |
if ( 'trash' !== $post->post_status ) {
|
244 |
$categories = get_the_terms( $post, 'category' );
|
245 |
$cat_ids = ! $categories || is_wp_error( $categories ) ? array() : wp_list_pluck( $categories, 'term_id' );
|
includes/public/class-wprm-template-manager.php
CHANGED
@@ -184,7 +184,8 @@ class WPRM_Template_Manager {
|
|
184 |
* @param mixed $type Type of template we want to get, defaults to single.
|
185 |
*/
|
186 |
public static function get_template_styles( $recipe, $type = 'single' ) {
|
187 |
-
$
|
|
|
188 |
return '<style type="text/css">' . self::get_template_css( $template ) . '</style>';
|
189 |
}
|
190 |
|
184 |
* @param mixed $type Type of template we want to get, defaults to single.
|
185 |
*/
|
186 |
public static function get_template_styles( $recipe, $type = 'single' ) {
|
187 |
+
$recipe_type = $recipe ? $recipe->type() : 'food';
|
188 |
+
$template = self::get_template_by_type( $type, $recipe_type );
|
189 |
return '<style type="text/css">' . self::get_template_css( $template ) . '</style>';
|
190 |
}
|
191 |
|
includes/public/class-wprm-template-shortcode.php
CHANGED
@@ -40,17 +40,32 @@ class WPRM_Template_Shortcode {
|
|
40 |
$text = str_ireplace( '<p><br></p>', '', $text );
|
41 |
$text = str_ireplace( '<p><br/></p>', '', $text );
|
42 |
|
43 |
-
// Replace last occurence of </p> by </div
|
44 |
$pos = strripos( $text, '</p>' );
|
45 |
if( false !== $pos ) {
|
46 |
-
$text = substr_replace( $text, '</
|
47 |
}
|
48 |
|
49 |
-
// Replace <p> by <
|
50 |
-
$text =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
// Replace remaining </p> with spacer.
|
53 |
-
$text = str_ireplace( '</p>', '</
|
54 |
|
55 |
return trim( do_shortcode( $text ) );
|
56 |
}
|
40 |
$text = str_ireplace( '<p><br></p>', '', $text );
|
41 |
$text = str_ireplace( '<p><br/></p>', '', $text );
|
42 |
|
43 |
+
// Replace last occurence of </p> by </span>. Use span and not div to prevent layouts from breaking.
|
44 |
$pos = strripos( $text, '</p>' );
|
45 |
if( false !== $pos ) {
|
46 |
+
$text = substr_replace( $text, '</span>', $pos, 4 );
|
47 |
}
|
48 |
|
49 |
+
// Replace <p> by <span> while keeping any attributes (text-align!).
|
50 |
+
$text = preg_replace_callback(
|
51 |
+
'/<p(\s[^>]*>|>)/mi',
|
52 |
+
function( $match ) {
|
53 |
+
$atts = $match[1];
|
54 |
+
|
55 |
+
// Use block style.
|
56 |
+
if ( false !== stripos( $atts, ' style="' ) ) {
|
57 |
+
$atts = str_ireplace( ' style="', ' style="display: block;', $atts );
|
58 |
+
} else {
|
59 |
+
$atts = str_ireplace( '>', ' style="display: block;">', $atts );
|
60 |
+
}
|
61 |
+
|
62 |
+
return '<span' . $atts;
|
63 |
+
},
|
64 |
+
$text
|
65 |
+
);
|
66 |
|
67 |
// Replace remaining </p> with spacer.
|
68 |
+
$text = str_ireplace( '</p>', '</span>[wprm-spacer]', $text );
|
69 |
|
70 |
return trim( do_shortcode( $text ) );
|
71 |
}
|
includes/public/class-wprm-template-shortcodes.php
CHANGED
@@ -286,26 +286,13 @@ class WPRM_Template_Shortcodes {
|
|
286 |
);
|
287 |
break;
|
288 |
case 'nutrition_fields':
|
289 |
-
$
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
'polyunsaturated_fat' => 'Polyunsaturated Fat',
|
297 |
-
'monounsaturated_fat' => 'Monounsaturated Fat',
|
298 |
-
'trans_fat' => 'Trans Fat',
|
299 |
-
'cholesterol' => 'Cholesterol',
|
300 |
-
'sodium' => 'Sodium',
|
301 |
-
'potassium' => 'Potassium',
|
302 |
-
'fiber' => 'Fiber',
|
303 |
-
'sugar' => 'Sugar',
|
304 |
-
'vitamin_a' => 'Vitamin A',
|
305 |
-
'vitamin_c' => 'Vitamin C',
|
306 |
-
'calcium' => 'Calcium',
|
307 |
-
'iron' => 'Iron',
|
308 |
-
);
|
309 |
break;
|
310 |
case 'recipe_tags':
|
311 |
$keys = array();
|
286 |
);
|
287 |
break;
|
288 |
case 'nutrition_fields':
|
289 |
+
$nutrition_fields = WPRM_Nutrition::get_fields();
|
290 |
+
|
291 |
+
foreach ( $nutrition_fields as $nutrient => $options ) {
|
292 |
+
$nutrition_fields[ $nutrient ] = $options['label'];
|
293 |
+
}
|
294 |
+
|
295 |
+
$shortcodes[ $shortcode ][ $attribute ]['options'] = $nutrition_fields;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
break;
|
297 |
case 'recipe_tags':
|
298 |
$keys = array();
|
includes/public/shortcodes/recipe/class-wprm-sc-nutrition-container.php
CHANGED
@@ -94,7 +94,7 @@ class WPRM_SC_Nutrition_Container extends WPRM_Template_Shortcode {
|
|
94 |
|
95 |
$recipe = WPRM_Template_Shortcodes::get_recipe( $atts['id'] );
|
96 |
$nutrition = WPRM_SC_Nutrition::shortcode( $atts );
|
97 |
-
if (
|
98 |
return '';
|
99 |
}
|
100 |
|
94 |
|
95 |
$recipe = WPRM_Template_Shortcodes::get_recipe( $atts['id'] );
|
96 |
$nutrition = WPRM_SC_Nutrition::shortcode( $atts );
|
97 |
+
if ( false === $nutrition || '' === $nutrition ) {
|
98 |
return '';
|
99 |
}
|
100 |
|
includes/public/shortcodes/recipe/class-wprm-sc-nutrition.php
CHANGED
@@ -80,7 +80,9 @@ class WPRM_SC_Nutrition extends WPRM_Template_Shortcode {
|
|
80 |
$nutrition_fields = WPRM_Nutrition::get_fields();
|
81 |
$value = isset( $nutrition[ $atts['field'] ] ) ? $nutrition[ $atts['field'] ] : false;
|
82 |
|
83 |
-
|
|
|
|
|
84 |
if ( $show_daily ) {
|
85 |
$daily = isset( $nutrition_fields[ $atts['field'] ]['daily'] ) ? $nutrition_fields[ $atts['field'] ]['daily'] : false;
|
86 |
|
80 |
$nutrition_fields = WPRM_Nutrition::get_fields();
|
81 |
$value = isset( $nutrition[ $atts['field'] ] ) ? $nutrition[ $atts['field'] ] : false;
|
82 |
|
83 |
+
return $value;
|
84 |
+
|
85 |
+
if ( $value !== false && ( WPRM_Settings::get( 'nutrition_label_zero_values' ) || $value ) ) {
|
86 |
if ( $show_daily ) {
|
87 |
$daily = isset( $nutrition_fields[ $atts['field'] ]['daily'] ) ? $nutrition_fields[ $atts['field'] ]['daily'] : false;
|
88 |
|
readme.txt
CHANGED
@@ -71,6 +71,8 @@ Even more add-ons can add the following functionality:
|
|
71 |
|
72 |
Currently using another recipe plugin? No problem! You can easily migrate all your existing recipes to WP Recipe Maker if you're using any of the following plugins:
|
73 |
|
|
|
|
|
74 |
* EasyRecipe
|
75 |
* WP Ultimate Recipe
|
76 |
* Meal Planner Pro
|
@@ -78,7 +80,6 @@ Currently using another recipe plugin? No problem! You can easily migrate all yo
|
|
78 |
* ZipList and Zip Recipes
|
79 |
* Yummly
|
80 |
* Yumprint Recipe Card
|
81 |
-
* Tasty Recipes
|
82 |
* FoodiePress
|
83 |
* Cooked
|
84 |
* Cookbook
|
@@ -123,6 +124,24 @@ Yes! We pride ourselves on offering awesome support and almost always answer sup
|
|
123 |
6. Fully compatible with the Classic Editor.
|
124 |
|
125 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
= 5.3.0 =
|
127 |
* Feature: Show number of ratings with shortcode
|
128 |
* Improvement: Parent Post ID on the ratings manage page
|
@@ -791,6 +810,18 @@ Yes! We pride ourselves on offering awesome support and almost always answer sup
|
|
791 |
* Feature: Fallback recipe when the plugin is disabled
|
792 |
|
793 |
== Upgrade notice ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
794 |
= 5.3.0 =
|
795 |
Update for a variety of fixes
|
796 |
|
71 |
|
72 |
Currently using another recipe plugin? No problem! You can easily migrate all your existing recipes to WP Recipe Maker if you're using any of the following plugins:
|
73 |
|
74 |
+
* Tasty Recipes
|
75 |
+
* Create by Mediavine
|
76 |
* EasyRecipe
|
77 |
* WP Ultimate Recipe
|
78 |
* Meal Planner Pro
|
80 |
* ZipList and Zip Recipes
|
81 |
* Yummly
|
82 |
* Yumprint Recipe Card
|
|
|
83 |
* FoodiePress
|
84 |
* Cooked
|
85 |
* Cookbook
|
124 |
6. Fully compatible with the Classic Editor.
|
125 |
|
126 |
== Changelog ==
|
127 |
+
= 5.4.0 =
|
128 |
+
* Feature: Import for Create by Mediavine
|
129 |
+
* Feature: Revision Manager TMC compatibility
|
130 |
+
* Improvement: Yoast SEO graph compatibility
|
131 |
+
* Improvement: Make sure contentUrl is set in oEmbed video metadata
|
132 |
+
* Improvement: Show equipment in classic editor preview
|
133 |
+
* Fix: Prevent wpautop bug from breaking recipe layout
|
134 |
+
* Fix: Incorrectly thinking changes were made in some cases
|
135 |
+
|
136 |
+
= 5.3.3 =
|
137 |
+
* Fix: Problem with Find Ratings tool
|
138 |
+
|
139 |
+
= 5.3.2 =
|
140 |
+
* Fix: Shortcode in block problem not resolving
|
141 |
+
|
142 |
+
= 5.3.1 =
|
143 |
+
* Fix: Shortcode problem
|
144 |
+
|
145 |
= 5.3.0 =
|
146 |
* Feature: Show number of ratings with shortcode
|
147 |
* Improvement: Parent Post ID on the ratings manage page
|
810 |
* Feature: Fallback recipe when the plugin is disabled
|
811 |
|
812 |
== Upgrade notice ==
|
813 |
+
= 5.4.0 =
|
814 |
+
A few smaller features and fixes
|
815 |
+
|
816 |
+
= 5.3.3 =
|
817 |
+
Update when getting incorrect comment rating totals
|
818 |
+
|
819 |
+
= 5.3.2 =
|
820 |
+
Update when using the Gutenberg Editor
|
821 |
+
|
822 |
+
= 5.3.1 =
|
823 |
+
Update when using the Classic Editor
|
824 |
+
|
825 |
= 5.3.0 =
|
826 |
Update for a variety of fixes
|
827 |
|
templates/admin/shortcode-preview.php
CHANGED
@@ -17,7 +17,7 @@ if ( $image ) :
|
|
17 |
<span contentEditable="false" style="display: inline-block; float: right; margin: 0 10px 10px 0;"><?php echo wp_kses_post( $image ); ?></span>
|
18 |
<?php endif; // Image. ?>
|
19 |
|
20 |
-
<span contentEditable="false" style="display: inline-block; margin-bottom: 10px;"><?php echo esc_html( $recipe->name() ); ?></span>
|
21 |
<span contentEditable="false" style="display: block; font-size: 12px; margin-bottom: 10px;"><?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $recipe->summary() ) ) ); ?></span>
|
22 |
|
23 |
<span contentEditable="false" style="display: block; margin-bottom: 10px;">
|
@@ -83,6 +83,19 @@ if ( $image ) :
|
|
83 |
<?php endif; // Author. ?>
|
84 |
</span>
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
<?php
|
87 |
$ingredients = $recipe->ingredients();
|
88 |
if ( count( $ingredients ) > 0 ) : ?>
|
@@ -90,20 +103,20 @@ if ( count( $ingredients ) > 0 ) : ?>
|
|
90 |
<?php foreach ( $ingredients as $ingredient_group ) : ?>
|
91 |
<span contentEditable="false" style="display: block; margin-bottom: 10px;">
|
92 |
<?php if ( $ingredient_group['name'] ) : ?>
|
93 |
-
<span contentEditable="false" style="display: block; font-size: 12px; font-weight: bold;"><?php echo esc_html( $ingredient_group['name'] ); ?></span>
|
94 |
<?php endif; // Ingredient group name. ?>
|
95 |
<?php foreach ( $ingredient_group['ingredients'] as $ingredient ) : ?>
|
96 |
<span contentEditable="false" style="display: block; font-size: 12px;">
|
97 |
-
|
98 |
<?php if ( $ingredient['amount'] ) : ?>
|
99 |
-
<?php echo esc_html( $ingredient['amount'] ); ?>
|
100 |
<?php endif; // Ingredient amount. ?>
|
101 |
<?php if ( $ingredient['unit'] ) : ?>
|
102 |
-
<?php echo esc_html( $ingredient['unit'] ); ?>
|
103 |
<?php endif; // Ingredient unit. ?>
|
104 |
-
<?php echo esc_html( $ingredient['name'] ); ?>
|
105 |
<?php if ( $ingredient['notes'] ) : ?>
|
106 |
-
<span contentEditable="false" style="padding-left: 5px; font-size: 10px;"><?php echo esc_html( $ingredient['notes'] ); ?></span>
|
107 |
<?php endif; // Ingredient notes. ?>
|
108 |
</span>
|
109 |
<?php endforeach; // Ingredients. ?>
|
@@ -119,7 +132,7 @@ if ( count( $instructions ) > 0 ) : ?>
|
|
119 |
<?php foreach ( $instructions as $instruction_group ) : ?>
|
120 |
<span contentEditable="false" style="display: block; margin-bottom: 10px;">
|
121 |
<?php if ( $instruction_group['name'] ) : ?>
|
122 |
-
<span contentEditable="false" style="display: block; font-size: 12px; font-weight: bold;"><?php echo esc_html( $instruction_group['name'] ); ?></span>
|
123 |
<?php endif; // instruction group name. ?>
|
124 |
<?php foreach ( $instruction_group['instructions'] as $index => $instruction ) : ?>
|
125 |
<span contentEditable="false" style="display: block; font-size: 12px;">
|
17 |
<span contentEditable="false" style="display: inline-block; float: right; margin: 0 10px 10px 0;"><?php echo wp_kses_post( $image ); ?></span>
|
18 |
<?php endif; // Image. ?>
|
19 |
|
20 |
+
<span contentEditable="false" style="display: inline-block; margin-bottom: 10px;"><?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $recipe->name() ) ) ); ?></span>
|
21 |
<span contentEditable="false" style="display: block; font-size: 12px; margin-bottom: 10px;"><?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $recipe->summary() ) ) ); ?></span>
|
22 |
|
23 |
<span contentEditable="false" style="display: block; margin-bottom: 10px;">
|
83 |
<?php endif; // Author. ?>
|
84 |
</span>
|
85 |
|
86 |
+
<?php
|
87 |
+
$equipment = $recipe->equipment();
|
88 |
+
if ( count( $equipment ) > 0 ) : ?>
|
89 |
+
<span contentEditable="false" style="display: block; margin-top: 10px; margin-bottom: 10px;">
|
90 |
+
<?php foreach ( $equipment as $equipment ) : ?>
|
91 |
+
<span contentEditable="false" style="display: block; font-size: 12px;">
|
92 |
+
-
|
93 |
+
<?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $equipment['name'] ) ) ); ?>
|
94 |
+
</span>
|
95 |
+
<?php endforeach; // equipment. ?>
|
96 |
+
</span>
|
97 |
+
<?php endif; // equipment. ?>
|
98 |
+
|
99 |
<?php
|
100 |
$ingredients = $recipe->ingredients();
|
101 |
if ( count( $ingredients ) > 0 ) : ?>
|
103 |
<?php foreach ( $ingredients as $ingredient_group ) : ?>
|
104 |
<span contentEditable="false" style="display: block; margin-bottom: 10px;">
|
105 |
<?php if ( $ingredient_group['name'] ) : ?>
|
106 |
+
<span contentEditable="false" style="display: block; font-size: 12px; font-weight: bold;"><?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $ingredient_group['name'] ) ) ); ?></span>
|
107 |
<?php endif; // Ingredient group name. ?>
|
108 |
<?php foreach ( $ingredient_group['ingredients'] as $ingredient ) : ?>
|
109 |
<span contentEditable="false" style="display: block; font-size: 12px;">
|
110 |
-
|
111 |
<?php if ( $ingredient['amount'] ) : ?>
|
112 |
+
<?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $ingredient['amount'] ) ) ); ?>
|
113 |
<?php endif; // Ingredient amount. ?>
|
114 |
<?php if ( $ingredient['unit'] ) : ?>
|
115 |
+
<?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $ingredient['unit'] ) ) ); ?>
|
116 |
<?php endif; // Ingredient unit. ?>
|
117 |
+
<?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $ingredient['name'] ) ) ); ?>
|
118 |
<?php if ( $ingredient['notes'] ) : ?>
|
119 |
+
<span contentEditable="false" style="padding-left: 5px; font-size: 10px;"><?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $ingredient['notes'] ) ) ); ?></span>
|
120 |
<?php endif; // Ingredient notes. ?>
|
121 |
</span>
|
122 |
<?php endforeach; // Ingredients. ?>
|
132 |
<?php foreach ( $instructions as $instruction_group ) : ?>
|
133 |
<span contentEditable="false" style="display: block; margin-bottom: 10px;">
|
134 |
<?php if ( $instruction_group['name'] ) : ?>
|
135 |
+
<span contentEditable="false" style="display: block; font-size: 12px; font-weight: bold;"><?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $instruction_group['name'] ) ) ); ?></span>
|
136 |
<?php endif; // instruction group name. ?>
|
137 |
<?php foreach ( $instruction_group['instructions'] as $index => $instruction ) : ?>
|
138 |
<span contentEditable="false" style="display: block; font-size: 12px;">
|
wp-recipe-maker.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* Plugin Name: WP Recipe Maker
|
16 |
* Plugin URI: http://bootstrapped.ventures/wp-recipe-maker/
|
17 |
* Description: The easy and user-friendly recipe plugin for everyone. Automatic JSON-LD metadata for better SEO will get you more visitors!
|
18 |
-
* Version: 5.
|
19 |
* Author: Bootstrapped Ventures
|
20 |
* Author URI: http://bootstrapped.ventures/
|
21 |
* License: GPL-2.0+
|
15 |
* Plugin Name: WP Recipe Maker
|
16 |
* Plugin URI: http://bootstrapped.ventures/wp-recipe-maker/
|
17 |
* Description: The easy and user-friendly recipe plugin for everyone. Automatic JSON-LD metadata for better SEO will get you more visitors!
|
18 |
+
* Version: 5.4.0
|
19 |
* Author: Bootstrapped Ventures
|
20 |
* Author URI: http://bootstrapped.ventures/
|
21 |
* License: GPL-2.0+
|