!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=140)}([,,function(t,e,r){t.exports=r(53)},function(t,e,r){var n=r(49),o=r(50),i=r(51);t.exports=function(t){return n(t)||o(t)||i()}},,function(t,e){t.exports=wp.data},function(t,e,r){var n=r(41),o=r(42),i=r(43);t.exports=function(t,e){return n(t)||o(t,e)||i()}},function(t,e,r){var n=r(11);t.exports=function(t){for(var e=1;e=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},b=n=function(){function t(){u()(this,t)}return l()(t,null,[{key:"create",value:function(t){var e=document.createElement("span");return e.className=n.className,e.id=h()(),e.dataset.items=JSON.stringify(t),e.contentEditable="false",e.outerHTML}},{key:"getItems",value:function(t){return JSON.parse(t.dataset.items||t.dataset.reflist||"[]")}}]),t}();b.className="abt-citation",b.legacyClassNames=[n.className,"abt_cite"],b.selector=y.a.apply(void 0,a()(n.legacyClassNames.map(function(t){return{classNames:[t],attributes:{id:!0}}}))),b=n=m([function(t){return}],b);var g=o=function(){function t(){u()(this,t)}return l()(t,null,[{key:"create",value:function(t){var e=document.createElement("span");return e.className=o.className,e.id=h()(),e.dataset.note=t,e.contentEditable="false",e.outerHTML}},{key:"createMarker",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=["*","†","‡","§","¶","#"];return t>=0?o.createMarker(t-r.length,e+r[t%r.length]):"".concat(v.a).concat(e).concat(v.a,"")}}]),t}();g.className="abt-footnote",g.legacyClassNames=[o.className],g.selector=y.a.apply(void 0,a()(o.legacyClassNames.map(function(t){return{classNames:[t],attributes:{id:!0}}}))),g=o=m([function(t){return}],g)},,function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,r){var n=r(52);t.exports=function(t,e){if(null==t)return{};var r,o,i=n(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}},,,function(t,e){function r(t,e){for(var r=0;r0&&void 0!==arguments[0]&&arguments[0],e=document.createElement("div");if(t){var r=Object(u.select)("core/editor").getBlocksForSerialization().filter(function(t){return!s.includes(t.name)&&t.isValid});e.innerHTML=Object(c.serialize)(r)}else e.innerHTML=Object(u.select)("core/editor").getEditedPostContent();return e}function f(t){var e=t.entryspacing,r=t.hangingindent,n=t.maxoffset,o=t.linespacing,i=t.secondFieldAlign;return a()({},e?{"data-entryspacing":"".concat(e)}:void 0,r?{"data-hangingindent":"".concat(r)}:void 0,n?{"data-maxoffset":"".concat(n)}:void 0,o?{"data-linespacing":"".concat(o)}:void 0,i?{"data-second-field-align":i}:void 0)}function d(t){if("string"==typeof t){var e=document.createElement("div");e.innerHTML=t;var r=e.querySelector(".csl-entry");if(!r)throw new Error('Outer HTML of item must be a div with className "csl-entry"');t=r}var n=t,i=[],a=!0,c=!1,u=void 0;try{for(var s,l=t.children[Symbol.iterator]();!(a=(s=l.next()).done);a=!0){var f=s.value;if(f.classList.contains("csl-indent"))break;f.classList.contains("csl-left-margin")?i=[].concat(o()(i),[f]):f.classList.contains("csl-right-inline")&&(f.outerHTML=f.innerHTML)}}catch(t){c=!0,u=t}finally{try{a||null==l.return||l.return()}finally{if(c)throw u}}return i.forEach(function(t){return n.removeChild(t)}),n.innerHTML.trim()}},,,,function(t,e){t.exports=wp.url},function(t,e){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},r(e)}t.exports=r},,,function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(e){return"function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?t.exports=n=function(t){return r(t)}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":r(t)},n(e)}t.exports=n},,,function(t,e,r){var n=r(33),o=r(67);t.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?o(t):e}},function(t,e,r){var n=r(44);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}},,,,function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(n=(a=c.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(e,n)}t.exports=r},,function(t,e,r){"use strict";r.d(e,"a",function(){return _}),r.d(e,"b",function(){return k});var n=r(2),o=r.n(n),i=r(8),a=r.n(i),c=r(36),u=r.n(c),s=r(30),l=r.n(s),f=r(37),d=r.n(f),p=r(3),h=r.n(p),v=r(11),y=r.n(v),m=r(7),b=r.n(m),g=r(15),x=r.n(g),w=r(19),E=r.n(w),S=r(10),O=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;x()(this,t),this.PREFIX="ABT_CACHE_",this.VERSION="v1.0",this.KEY="".concat(this.PREFIX).concat(this.VERSION),this._cache=this.storageIsAvailable()?top.localStorage:this.createFallbackStorage();this.ITEM_KEY=e,this.EXPIRES=Date.now()+864e5*n;var o=this.KEY,i=this.PREFIX;Object.keys(this._cache).filter(function(t){return t.startsWith(i)&&t!==o}).forEach(function(t){return r._cache.removeItem(t)})}return E()(t,[{key:"getItem",value:function(t){return this.cache[t]||null}},{key:"removeItem",value:function(t){this.cache=Object(S.omit)(this.cache,t)}},{key:"setItem",value:function(t,e){this.cache=b()({},this.cache,y()({},t,e))}},{key:"storageIsAvailable",value:function(){try{var t=window.localStorage;return t.setItem("__storage_test__","test"),t.removeItem("__storage_test__"),!0}catch(t){return!1}}},{key:"createFallbackStorage",value:function(){return{_value:new Map,get length(){return this._value.size},clear:function(){this._value.clear()},getItem:function(t){return this._value.get(t)||null},key:function(t){return h()(this._value.keys())[t]||null},removeItem:function(t){this._value.delete(t)},setItem:function(t,e){this._value.set(t,e)}}}},{key:"cache",get:function(){var t=this.EXPIRES,e=this.ITEM_KEY,r=this.KEY,n=JSON.parse(this._cache.getItem(r)||"{}"),o=n[e];return(!o||o.expires=0||(o[r]=t[r]);return o}},function(t,e,r){var n=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,i=Object.create(o.prototype),a=new I(n||[]);return i._invoke=function(t,e,r){var n=l;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw i;return T()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=O(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=s(t,e,r);if("normal"===u.type){if(n=r.done?p:f,u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l="suspendedStart",f="suspendedYield",d="executing",p="completed",h={};function v(){}function y(){}function m(){}var b={};b[i]=function(){return this};var g=Object.getPrototypeOf,x=g&&g(g(j([])));x&&x!==r&&n.call(x,i)&&(b=x);var w=m.prototype=v.prototype=Object.create(b);function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function S(t){var e;this._invoke=function(r,o){function i(){return new Promise(function(e,i){!function e(r,o,i,a){var c=s(t[r],t,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,i,a)},function(t){e("throw",t,i,a)}):Promise.resolve(l).then(function(t){u.value=t,i(u)},function(t){return e("throw",t,i,a)})}a(c.arg)}(r,o,e,i)})}return e=e?e.then(i,i):i()}}function O(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,O(t,r),"throw"===r.method))return h;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var o=s(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,h;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,h):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function j(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:j(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),h}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e){var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);t.exports=function(){return r(n),n}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);t.exports=function(t,e){var n=e||0,o=r;return[o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]]].join("")}},function(t,e,r){"use strict";r.d(e,"a",function(){return l});var n=r(2),o=r.n(n),i=r(7),a=r.n(i),c=r(8),u=r.n(c),s=r(29);function l(t,e){return f.apply(this,arguments)}function f(){return(f=u()(o.a.mark(function t(e,r){return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",fetch(ajaxurl,{method:"POST",headers:{"Content-type":"application/x-www-form-urlencoded"},body:Object(s.addQueryArgs)(void 0,a()({_wpnonce:_abt_nonce,action:e},r)).slice(1),credentials:"same-origin"}));case 1:case"end":return t.stop()}},t)}))).apply(this,arguments)}},,,,,,,,,,,function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},,,,,,,,function(t,e){t.exports=CSL},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e,r){"use strict";var n=r(6),o=r.n(n),i=r(15),a=r.n(i),c=r(19),u=r.n(c),s=r(5),l=r(75),f=r(10),d=r(46),p=function(){function t(e){a()(this,t),this.sys={retrieveItem:function(t){var e=Object(s.select)("abt/data").getItemById(t);if(!e)throw new Error('CSL Data could not be found for item ID "'.concat(t,'"'));return e},retrieveLocale:function(t){var e=d.a.getItem(t);if(!e)throw new Error('Requested locale "'.concat(t,'" was not prefetched'));return e}};var r=t.instance;if(r)return r.style!==e&&(r.style=e,r.engine=new l.Engine(r.sys,r.style),r.engine.opt.development_extensions.wrap_url_and_doi=!0),r;t.instance=this,this.style=e,this.engine=new l.Engine(this.sys,this.style),this.engine.opt.development_extensions.wrap_url_and_doi=!0}return u()(t,[{key:"parseCitations",value:function(t){var e=this;return this.engine.rebuildProcessorState(t).map(function(t){var r=o()(t,3),n=r[0];return{id:n,html:r[2],sortedItems:JSON.stringify(e.registry.citationById[n].sortedItems.map(function(t){return o()(t,1)[0].id}))}})}},{key:"bibliography",get:function(){var t;try{if(!(t=this.engine.makeBibliography()))return{items:[],meta:{}}}catch(t){return{items:[],meta:{}}}var e=t,r=o()(e,2),n=r[0],i=r[1],a=n.entryspacing,c=n.hangingindent,u=n.linespacing,s=n.maxoffset,l=n["second-field-align"];return{meta:{entryspacing:a,hangingindent:c,linespacing:u,maxoffset:s,secondFieldAlign:l||void 0},items:Object(f.zipWith)(Object(f.flatten)(n.entry_ids),i,function(t,e){return{id:t,content:e}})}}},{key:"registry",get:function(){return this.engine.registry.citationreg}}]),t}();p.instance=null,e.a=p},,,,,,,,,,,,,,,function(t,e,r){"use strict";t.exports=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return e>>>0}},,,,,,,,,,,function(t,e,r){"use strict";r.r(e);var n={};r.r(n),r.d(n,"addReference",function(){return Y}),r.d(n,"addReferences",function(){return J}),r.d(n,"removeFootnote",function(){return q}),r.d(n,"removeFootnotes",function(){return K}),r.d(n,"removeReference",function(){return G}),r.d(n,"removeReferences",function(){return V}),r.d(n,"updateReference",function(){return U}),r.d(n,"removeAllCitations",function(){return z}),r.d(n,"parseCitations",function(){return X}),r.d(n,"parseFootnotes",function(){return W}),r.d(n,"setStyle",function(){return Q});var o={};r.r(o),r.d(o,"getCitationStyles",function(){return st});var i={};r.r(i),r.d(i,"getCitationStyles",function(){return vt}),r.d(i,"getStyle",function(){return yt}),r.d(i,"getCitationsByIndex",function(){return mt}),r.d(i,"getCitedItems",function(){return bt}),r.d(i,"getFootnotes",function(){return gt}),r.d(i,"getItems",function(){return xt}),r.d(i,"getSortedItems",function(){return wt}),r.d(i,"getItemById",function(){return Et}),r.d(i,"getSerializedState",function(){return St}),r.d(i,"getUncitedItems",function(){return Ot});var a={};r.r(a),r.d(a,"clearSelectedItems",function(){return kt}),r.d(a,"setIdentifierKind",function(){return It}),r.d(a,"setSidebarSortMode",function(){return jt}),r.d(a,"setSidebarSortOrder",function(){return Tt}),r.d(a,"toggleItemSelected",function(){return Lt});var c={};r.r(c),r.d(c,"getIdentifierKind",function(){return Rt}),r.d(c,"getSelectedItems",function(){return At}),r.d(c,"getSidebarSortMode",function(){return Mt}),r.d(c,"getSidebarSortOrder",function(){return Pt});var u=r(3),s=r.n(u),l=r(5),f=r(7),d=r.n(f),p=r(2),h=r.n(p),v=r(20),y=r(9),m=r(24),b=r(25),g=r(13),x=r(114),w=r(8),E=r.n(w),S=r(56),O=r(46);var _={FETCH_CITATION_STYLES:function(){var t=E()(h.a.mark(function t(){var e;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(S.a)("get_style_json");case 2:return e=t.sent,t.abrupt("return",e.json());case 4:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}(),FETCH_LOCALE:function(){var t=E()(h.a.mark(function t(e){var r;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.style,t.abrupt("return",O.a.fetchItem(r));case 2:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),FETCH_STYLE:function(){var t=E()(h.a.mark(function t(e){var r;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.id,t.abrupt("return",O.b.fetchItem(r));case 2:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),SAVE_STATE:function(){var t=E()(h.a.mark(function t(e){var r,n,o;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.id,n=e.state,t.next=3,Object(S.a)("update_abt_state",{post_id:r,state:n});case 3:return o=t.sent,t.abrupt("return",o.json());case 5:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()},k=h.a.mark(Y),I=h.a.mark(J),j=h.a.mark(q),T=h.a.mark(K),L=h.a.mark(G),N=h.a.mark(V),C=h.a.mark(U),R=h.a.mark(z),A=h.a.mark(X),M=h.a.mark(W),P=h.a.mark(Q),D=h.a.mark(Z),F=h.a.mark($),H=h.a.mark(tt),B=h.a.mark(et);function Y(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,J([t]);case 2:case"end":return e.stop()}},k)}function J(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,{type:"ADD_REFERENCES",data:t};case 2:return e.next=4,Z();case 4:case"end":return e.stop()}},I)}function q(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,K([t]);case 2:case"end":return e.stop()}},j)}function K(t){var e,r,n,o,i,a,c,u;return h.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:for(e=Object(b.a)(),r=0,n=!0,o=!1,i=void 0,s.prev=5,a=e.querySelectorAll(g.b.selector)[Symbol.iterator]();!(n=(c=a.next()).done);n=!0)u=c.value,t.includes("".concat(u.id,"-ref"))&&u.parentNode&&(u.parentNode.removeChild(u),r++);s.next=13;break;case 9:s.prev=9,s.t0=s.catch(5),o=!0,i=s.t0;case 13:s.prev=13,s.prev=14,n||null==a.return||a.return();case 16:if(s.prev=16,!o){s.next=19;break}throw i;case 19:return s.finish(16);case 20:return s.finish(13);case 21:if(!(r>0)){s.next=24;break}return s.next=24,Z();case 24:case"end":return s.stop()}},T,null,[[5,9,13,21],[14,,16,20]])}function G(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,V([t]);case 2:case"end":return e.stop()}},L)}function V(t){var e,r;return h.a.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return e=Object(b.a)(),r=s()(e.querySelectorAll(g.a.selector)).reduce(function(e,r){var n=g.a.getItems(r),o=n.filter(function(e){return!t.includes(e)});return 0===o.length&&r.parentNode?r.parentNode.removeChild(r):r.dataset.items=JSON.stringify(o),e.filter(function(t){return!n.includes(t)})},s()(t)),n.next=4,Object(l.dispatch)("core/block-editor").resetBlocks(Object(v.parse)(e.innerHTML));case 4:if(!(r.length>0)){n.next=9;break}return n.next=7,{type:"REMOVE_REFERENCES",itemIds:r};case 7:return n.next=9,Z();case 9:case"end":return n.stop()}},N)}function U(t){var e;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return e=Object(l.select)("abt/data").getCitedItems().findIndex(function(e){return e.id===t.id})>=0,r.next=3,{type:"UPDATE_REFERENCE",data:t};case 3:if(!e){r.next=6;break}return r.next=6,X();case 6:return r.next=8,Z();case 8:case"end":return r.stop()}},C)}function z(){var t,e,r,n,o,i,a;return h.a.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:for(t=Object(b.a)(),e=!0,r=!1,n=void 0,c.prev=4,o=t.querySelectorAll(g.a.selector)[Symbol.iterator]();!(e=(i=o.next()).done);e=!0)(a=i.value).parentNode&&a.parentNode.removeChild(a);c.next=12;break;case 8:c.prev=8,c.t0=c.catch(4),r=!0,n=c.t0;case 12:c.prev=12,c.prev=13,e||null==o.return||o.return();case 15:if(c.prev=15,!r){c.next=18;break}throw n;case 18:return c.finish(15);case 19:return c.finish(12);case 20:return c.next=22,Object(l.dispatch)("core/block-editor").resetBlocks(Object(v.parse)(t.innerHTML));case 22:case"end":return c.stop()}},R,null,[[4,8,12,20],[13,,15,19]])}function X(){var t,e,r;return h.a.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,o=void 0,i=void 0,o=Object(l.select)("abt/data").getStyle(),i=o.value,"custom"===o.kind?i:{type:"FETCH_STYLE",id:i};case 2:return t=n.sent,n.next=5,{type:"FETCH_LOCALE",style:t};case 5:return e=new x.a(t),r=e.parseCitations(Object(l.select)("abt/data").getCitationsByIndex()),n.next=9,$(e.bibliography);case 9:return n.next=11,et(r);case 11:case"end":return n.stop()}var o,i},A)}function W(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(t=Object(b.a)()).querySelectorAll(g.b.selector).forEach(function(t,e){t.innerHTML=g.b.createMarker(e)}),e.next=4,Object(l.dispatch)("core/block-editor").resetBlocks(Object(v.parse)(t.innerHTML));case 4:return e.next=6,tt();case 6:case"end":return e.stop()}},M)}function Q(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,{type:"SET_STYLE",style:t};case 2:return e.next=4,X();case 4:return e.next=6,Z();case 6:case"end":return e.stop()}},P)}function Z(){return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,{type:"SAVE_STATE",id:Object(l.select)("core/editor").getCurrentPostId(),state:Object(l.select)("abt/data").getSerializedState().meta._abt_state};case 2:return t.next=4,Object(l.dispatch)("core/editor").autosave();case 4:case"end":return t.stop()}},D)}function $(t){var e,r,n,o;return h.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(e=t.items,r=t.meta,n=Object(l.select)("core/block-editor").getBlocks(),o=n.find(function(t){return"abt/bibliography"===t.name}),!(e.length>0&&o)){i.next=8;break}return i.next=6,Object(l.dispatch)("core/block-editor").updateBlockAttributes(o.clientId,d()({},r,{items:e}));case 6:i.next=16;break;case 8:if(!(e.length>0)||o){i.next=13;break}return i.next=11,Object(l.dispatch)("core/block-editor").insertBlock(Object(v.createBlock)("abt/bibliography",d()({},r,{items:e})),n.length,void 0,!1);case 11:i.next=16;break;case 13:if(0!==e.length||!o){i.next=16;break}return i.next=16,Object(l.dispatch)("core/block-editor").removeBlock(o.clientId);case 16:case"end":return i.stop()}},F)}function tt(){var t,e,r,n;return h.a.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(t=Object(l.select)("abt/data").getFootnotes(),e=Object(l.select)("core/block-editor").getBlocks(),r=e.findIndex(function(t){return"abt/footnotes"===t.name}),n=e.findIndex(function(t){return"abt/bibliography"===t.name}),!(t.length>0&&r>=0)){o.next=9;break}return o.next=7,Object(l.dispatch)("core/block-editor").updateBlockAttributes(e[r].clientId,{items:t});case 7:o.next=17;break;case 9:if(!(t.length>0&&-1===r)){o.next=14;break}return o.next=12,Object(l.dispatch)("core/block-editor").insertBlock(Object(v.createBlock)("abt/footnotes",{items:t}),n>0?n:e.length,void 0,!1);case 12:o.next=17;break;case 14:if(!(0===t.length&&r>=0)){o.next=17;break}return o.next=17,Object(l.dispatch)("core/block-editor").removeBlock(e[r].clientId);case 17:case"end":return o.stop()}},H)}function et(t){var e,r,n,o,i,a,c;return h.a.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:for(e=Object(b.a)(),r=!0,n=!1,o=void 0,u.prev=4,i=function(){var t=c.value,r=t.html,n=t.id,o=t.sortedItems,i=e.querySelector(m.a.apply(void 0,s()(g.a.legacyClassNames.map(function(t){return{classNames:[t],attributes:{id:n}}}))));i&&(i.innerHTML=r,i.dataset.items=o,i.firstElementChild?(i.dataset.hasChildren="true",i.firstElementChild.innerHTML=y.a+i.firstElementChild.innerHTML+y.a):(delete i.dataset.hasChildren,i.innerHTML=y.a+r+y.a))},a=t[Symbol.iterator]();!(r=(c=a.next()).done);r=!0)i();u.next=13;break;case 9:u.prev=9,u.t0=u.catch(4),n=!0,o=u.t0;case 13:u.prev=13,u.prev=14,r||null==a.return||a.return();case 16:if(u.prev=16,!n){u.next=19;break}throw o;case 19:return u.finish(16);case 20:return u.finish(13);case 21:return u.next=23,Object(l.dispatch)("core/block-editor").resetBlocks(Object(v.parse)(e.innerHTML));case 23:case"end":return u.stop()}},B,null,[[4,9,13,21],[14,,16,20]])}var rt=r(16),nt=r.n(rt),ot=r(129),it=r.n(ot),at=d()({citationStyles:{renamed:{},styles:[]}},Object(m.b)("abt-editor-state"));var ct=Object(l.combineReducers)({citationStyles:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:at.citationStyles,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case"SET_CITATION_STYLES":return e.styles;default:return t}},references:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:at.references,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case"ADD_REFERENCES":var r=e.data.map(function(t){t.id;var e=nt()(t,["id"]);return d()({},e,{id:"".concat(it()(JSON.stringify(e)))})}).filter(function(e){var r=e.id;return-1===t.findIndex(function(t){return t.id===r})});return r.length>0?[].concat(s()(t),s()(r)):t;case"REMOVE_REFERENCES":return t.filter(function(t){var r=t.id;return!e.itemIds.includes(r)});case"UPDATE_REFERENCE":var n=t.findIndex(function(t){return t.id===e.data.id});return-1===n?[].concat(s()(t),[e.data]):[].concat(s()(t.slice(0,n)),[e.data],s()(t.slice(n+1)));default:return t}},style:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:at.style,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case"SET_STYLE":return e.style;default:return t}}}),ut=h.a.mark(st);function st(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,{type:"FETCH_CITATION_STYLES"};case 2:return t=e.sent,e.abrupt("return",{type:"SET_CITATION_STYLES",styles:t});case 4:case"end":return e.stop()}},ut)}var lt=r(6),ft=r.n(lt),dt=r(10),pt=r.n(dt),ht=r(22);function vt(t){return Object(ht.a)(t.citationStyles)}function yt(t){return Object(ht.a)(t.style)}function mt(t){var e=Object(b.a)(!0);return s()(e.querySelectorAll(g.a.selector)).map(function(e,r){return{citationID:e.id,citationItems:g.a.getItems(e).reduce(function(e,r){var n=Et(t,r);return void 0!==n?[].concat(s()(e),[{id:r,item:n}]):e},[]),properties:{index:r,noteIndex:0}}})}function bt(t){var e=Object(b.a)(!0);return pt()(s()(e.querySelectorAll(g.a.selector))).flatMap(g.a.getItems).uniq().map(Object(dt.partial)(Et,t)).compact().value()}function gt(){var t=Object(b.a)(),e=document.createElement("div"),r=document.createElement("div"),n=document.createElement("div");return r.className="abt-footnotes-item__marker",n.className="abt-footnotes-item__content",e.appendChild(r),e.appendChild(n),s()(t.querySelectorAll(g.b.selector)).map(function(t){return r.innerHTML=t.innerHTML,n.textContent=t.dataset.note||"",{id:"".concat(t.id,"-ref"),content:e.innerHTML}})}function xt(t,e){switch(e){case"cited":return bt(t);case"uncited":return Ot(t);default:return Object(ht.a)(t.references)}}function wt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"title",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"asc",n=arguments.length>3?arguments[3]:void 0;return Object(dt.orderBy)(xt(t,n),function(t){switch(e){case"date":var r=Object(dt.get)(t.issued,"[date-parts][0]",[-5e3]),n=ft()(r,3),o=n[0],i=n[1],a=void 0===i?0:i,c=n[2];return new Date(o,a,void 0===c?1:c).toJSON();case"publication":return Object(ht.b)(t,["journalAbbreviation","container-title-short","container-title","publisher"],"~");case"title":default:return t.title||"~"}},r)}function Et(t,e){return Object(ht.a)(t.references.find(function(t){return t.id===e}))}function St(t){var e=t.references,r=t.style;return{meta:{_abt_state:JSON.stringify({references:e,style:r})}}}function Ot(t){return Object(dt.differenceWith)(t.references,bt(t),function(t,e){return t.id===e.id})}var _t=["abt/data",{actions:n,controls:_,reducer:ct,resolvers:o,selectors:i}];function kt(){return{type:"CLEAR_SELECTED_ITEMS"}}function It(t){return{type:"SET_IDENTIFIER_KIND",kind:t}}function jt(t){return{type:"SET_SIDEBAR_SORT_MODE",mode:t}}function Tt(t){return{type:"SET_SIDEBAR_SORT_ORDER",order:t}}function Lt(t){return{type:"TOGGLE_ITEM_SELECTED",id:t}}var Nt={identifierKind:"doi"};var Ct={selectedItems:[],sortMode:"title",sortOrder:"asc"};function Rt(t){return t.addReferenceDialog.identifierKind}function At(t){return s()(t.sidebar.selectedItems)}function Mt(t){return t.sidebar.sortMode}function Pt(t){return t.sidebar.sortOrder}var Dt=["abt/ui",{actions:a,reducer:Object(l.combineReducers)({addReferenceDialog:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Nt,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case"SET_IDENTIFIER_KIND":return d()({},t,{identifierKind:e.kind});default:return t}},sidebar:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ct,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case"CLEAR_SELECTED_ITEMS":return d()({},t,{selectedItems:[]});case"SET_SIDEBAR_SORT_MODE":return d()({},t,{sortMode:e.mode});case"SET_SIDEBAR_SORT_ORDER":return d()({},t,{sortOrder:e.order});case"TOGGLE_ITEM_SELECTED":return d()({},t,{selectedItems:t.selectedItems.includes(e.id)?t.selectedItems.filter(function(t){return t!==e.id}):[].concat(s()(t.selectedItems),[e.id])});default:return t}}}),selectors:c}];l.registerStore.apply(void 0,s()(_t)),l.registerStore.apply(void 0,s()(Dt))}]); //# sourceMappingURL=editor-stores.js.map