!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=187)}([function(e,t){e.exports=wp.i18n},,function(e,t,n){e.exports=n(51)},function(e,t,n){var r=n(41),o=n(42),i=n(43);e.exports=function(e){return r(e)||o(e)||i()}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}},,,,function(e,t){e.exports=wp.editor},,,,function(e,t){e.exports=wp.blocks},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t,n){var r=n(77),o=n(78);e.exports=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var c=0;c<16;++c)t[i+c]=a[c];return t||o(a)}},function(e,t,n){"use strict";n.d(t,"a",function(){return u}),n.d(t,"b",function(){return f}),n.d(t,"c",function(){return p});var r=n(3),o=n.n(r),i=n(8),a=n.n(i),c=n(34),l=n(14),s=["core/freeform","core/html"];function u(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=document.createElement("div");if(e){var n=Object(l.select)("core/editor").getBlocksForSerialization().filter(function(e){return!s.includes(e.name)&&e.isValid});t.innerHTML=Object(c.serialize)(n)}else t.innerHTML=Object(l.select)("core/editor").getEditedPostContent();return t}function f(e){var t=e.entryspacing,n=e.hangingindent,r=e.maxoffset,o=e.linespacing,i=e.secondFieldAlign;return a()({},t?{"data-entryspacing":"".concat(t)}:void 0,n?{"data-hangingindent":"".concat(n)}:void 0,r?{"data-maxoffset":"".concat(r)}:void 0,o?{"data-linespacing":"".concat(o)}:void 0,i?{"data-second-field-align":i}:void 0)}function p(e){if("string"==typeof e){var t=document.createElement("div");t.innerHTML=e;var n=t.querySelector(".csl-entry");if(!n)throw new Error('Outer HTML of item must be a div with className "csl-entry"');e=n}var r=e,i=[],a=!0,c=!1,l=void 0;try{for(var s,u=e.children[Symbol.iterator]();!(a=(s=u.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(e){c=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(c)throw l}}return i.forEach(function(e){return r.removeChild(e)}),r.innerHTML.trim()}},,,,function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t=0||(o[n]=e[n]);return o}},function(e,t,n){var r=function(e){"use strict";var t,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function l(e,t,n,r){var o=t&&t.prototype instanceof d?t:d,i=Object.create(o.prototype),a=new S(r||[]);return i._invoke=function(e,t,n){var r=u;return function(o,i){if(r===p)throw new Error("Generator is already running");if(r===m){if("throw"===o)throw i;return N()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===u)throw r=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var l=s(e,t,n);if("normal"===l.type){if(r=n.done?m:f,l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r=m,n.method="throw",n.arg=l.arg)}}}(e,n,a),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var u="suspendedStart",f="suspendedYield",p="executing",m="completed",h={};function d(){}function g(){}function b(){}var y={};y[i]=function(){return this};var v=Object.getPrototypeOf,_=v&&v(v(I([])));_&&_!==n&&r.call(_,i)&&(y=_);var w=b.prototype=d.prototype=Object.create(y);function x(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function E(e){var t;this._invoke=function(n,o){function i(){return new Promise(function(t,i){!function t(n,o,i,a){var c=s(e[n],e,o);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==typeof u&&r.call(u,"__await")?Promise.resolve(u.__await).then(function(e){t("next",e,i,a)},function(e){t("throw",e,i,a)}):Promise.resolve(u).then(function(e){l.value=e,i(l)},function(e){return t("throw",e,i,a)})}a(c.arg)}(n,o,t,i)})}return t=t?t.then(i,i):i()}}function k(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,k(e,n),"throw"===n.method))return h;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var o=s(r,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,h;var i=o.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function I(e){if(e){var n=e[i];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function n(){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 l=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(l&&s){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),j(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),h}},e}(e.exports);try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},,,,,,,,,,,,,,,,,,function(e,t){e.exports=CSL},function(e,t,n){"use strict";n.d(t,"a",function(){return j}),n.d(t,"b",function(){return S});var r=n(2),o=n.n(r),i=n(12),a=n.n(i),c=n(10),l=n.n(c),s=n(9),u=n.n(s),f=n(11),p=n.n(f),m=n(3),h=n.n(m),d=n(16),g=n.n(d),b=n(8),y=n.n(b),v=n(4),_=n.n(v),w=n(5),x=n.n(w),E=n(19),k=n.n(E),O=function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;_()(this,e),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=t,this.EXPIRES=Date.now()+864e5*r;var o=this.KEY,i=this.PREFIX;Object.keys(this._cache).filter(function(e){return e.startsWith(i)&&e!==o}).forEach(function(e){return n._cache.removeItem(e)})}return x()(e,[{key:"getItem",value:function(e){return this.cache[e]||null}},{key:"removeItem",value:function(e){this.cache=k.a.omit(this.cache,e)}},{key:"setItem",value:function(e,t){this.cache=y()({},this.cache,g()({},e,t))}},{key:"storageIsAvailable",value:function(){try{var e=window.localStorage;return e.setItem("__storage_test__","test"),e.removeItem("__storage_test__"),!0}catch(e){return!1}}},{key:"createFallbackStorage",value:function(){return{_value:new Map,get length(){return this._value.size},clear:function(){this._value.clear()},getItem:function(e){return this._value.get(e)||null},key:function(e){return h()(this._value.keys())[e]||null},removeItem:function(e){this._value.delete(e)},setItem:function(e,t){this._value.set(e,t)}}}},{key:"cache",get:function(){var e=this.EXPIRES,t=this.ITEM_KEY,n=this.KEY,r=JSON.parse(this._cache.getItem(n)||"{}"),o=r[t];return(!o||o.expires>>((3&t)<<3)&255;return o}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",function(){return i});n(6);var r=n(135),o=n.n(r);function i(e){var t=e.count;return React.createElement("span",{className:o.a.icon},t)}},function(e,t,n){"use strict";n(6);var r=n(113),o=n.n(r);t.a=function(e){var t=e.items,n=e.onItemClick,r=e.onItemDoubleClick,i=e.renderItem,a=e.selectedItems,c=void 0===a?[]:a;return wp.element.createElement("div",{className:o.a.list,role:"listbox","aria-multiselectable":!0},t.map(function(e){return wp.element.createElement("div",{key:e.id,className:o.a.item,role:"option","aria-selected":c.includes(e.id),onClick:function(){return n&&n(e.id)},onDoubleClick:function(){return r&&r(e.id)}},i(e))}))}},function(e,t,n){e.exports={list:"style__list___sXSVw",item:"style__item___3Ltyn"}},,function(e,t,n){"use strict";n(6);var r=n(0),o=n(4),i=n.n(o),a=n(5),c=n.n(a),l=n(19),s=n.n(l),u=function(){function e(){i()(this,e)}return c()(e,null,[{key:"getYear",value:function(e){return e&&e.raw?new Date(e.raw).getUTCFullYear():s.a.get(e,"[date-parts][0][0]",Object(r._x)("n.d.",'Abbreviation for "no date"',"academic-bloggers-toolkit"))}}]),e}(),f=function(){function e(){i()(this,e)}return c()(e,null,[{key:"getNames",value:function(e,t){return e.slice(0,t).map(function(e){var t=e.family,n=e.given,r=e.literal;return r||(t?"".concat(t," ").concat(n?n[0]:"").trim():"")}).filter(Boolean).join(", ")+"."}}]),e}(),p=n(25),m=n(136),h=n.n(m);function d(e){return wp.element.createElement(wp.element.Fragment,null,wp.element.createElement("strong",null,e.title),e.author&&e.author.length>0&&wp.element.createElement("div",{className:h.a.authors},f.getNames(e.author,3)),wp.element.createElement("div",null,wp.element.createElement("i",null,Object(p.b)(e,["journalAbbreviation","container-title-short","container-title","publisher"],Object(r._x)("n.p.",'Abbreviation for "no publisher"',"academic-bloggers-toolkit"))),wp.element.createElement("span",null,u.getYear(e.issued))))}n.d(t,"a",function(){return d})},,,,,,,,,,,,,,,,,,,,function(e,t,n){e.exports={icon:"style__icon___S3vp9"}},function(e,t,n){e.exports={authors:"style__authors___3xZGF"}},function(e,t,n){"use strict";n.d(t,"a",function(){return x});var r=n(21),o=n.n(r),i=n(26),a=n.n(i),c=n(4),l=n.n(c),s=n(5),u=n.n(s),f=n(10),p=n.n(f),m=n(9),h=n.n(m),d=n(11),g=n.n(d),b=n(6),y=n(24),v=n.n(y),_=n(138),w=n.n(_),x=function(e){function t(){var e;return l()(this,t),(e=p()(this,h()(t).apply(this,arguments))).ref=e.props.inputRef||Object(b.createRef)(),e.handleBlur=function(t){t.currentTarget.value=t.currentTarget.value.trim(),e.handleChange(t),e.props.onBlur(t)},e.handleChange=function(t){var n=e.state.offset;t.currentTarget.style.height="auto",t.currentTarget.style.height="".concat(t.currentTarget.scrollHeight+n,"px"),e.props.onChange(t)},e}return g()(t,e),u()(t,[{key:"componentDidMount",value:function(){var e=this.ref.current;if(e){var t=e.offsetHeight-e.clientHeight;this.setState({offset:t}),e.style.height="auto",e.style.height="".concat(e.scrollHeight+t,"px")}}},{key:"render",value:function(){var e=this.props,t=e.className,n=a()(e,["className"]);return React.createElement("textarea",o()({},n,{className:v()(w.a.textarea,t),ref:this.ref,rows:1,onBlur:this.handleBlur,onChange:this.handleChange}))}}]),t}(b.Component);x.defaultProps={onBlur:function(){},onChange:function(){}}},function(e,t,n){e.exports={textarea:"style__textarea___g5DyY"}},function(e,t,n){"use strict";var r=n(17),o=n.n(r),i=n(4),a=n.n(i),c=n(5),l=n.n(c),s=n(14),u=n(70),f=n(19),p=n.n(f),m=n(71),h=function(){function e(t){a()(this,e),this.sys={retrieveItem:function(e){var t=Object(s.select)("abt/data").getItemById(e);if(!t)throw new Error('CSL Data could not be found for item ID "'.concat(e,'"'));return t},retrieveLocale:function(e){var t=m.a.getItem(e);if(!t)throw new Error('Requested locale "'.concat(e,'" was not prefetched'));return t}};var n=e.instance;if(n)return n.style!==t&&(n.style=t,n.engine=new u.Engine(n.sys,n.style),n.engine.opt.development_extensions.wrap_url_and_doi=!0),n;e.instance=this,this.style=t,this.engine=new u.Engine(this.sys,this.style),this.engine.opt.development_extensions.wrap_url_and_doi=!0}return l()(e,[{key:"parseCitations",value:function(e){var t=this;return this.engine.rebuildProcessorState(e).map(function(e){var n=o()(e,3),r=n[0];return{id:r,html:n[2],sortedItems:JSON.stringify(t.registry.citationById[r].sortedItems.map(function(e){return o()(e,1)[0].id}))}})}},{key:"bibliography",get:function(){var e;try{if(!(e=this.engine.makeBibliography()))return{items:[],meta:{}}}catch(e){return{items:[],meta:{}}}var t=e,n=o()(t,2),r=n[0],i=n[1],a=r.entryspacing,c=r.hangingindent,l=r.linespacing,s=r.maxoffset,u=r["second-field-align"];return{meta:{entryspacing:a,hangingindent:c,linespacing:l,maxoffset:s,secondFieldAlign:u||void 0},items:p.a.zipWith(p.a.flatten(r.entry_ids),i,function(e,t){return{id:e,content:t}})}}},{key:"registry",get:function(){return this.engine.registry.citationreg}}]),e}();h.instance=null,t.a=h},,,function(e,t,n){e.exports={item:"style__item___x_svo",buttonList:"style__button-list___D2Txs",row:"style__row___zDq5B"}},,,,,,,,,,,,,,function(e,t,n){e.exports={heading:"style__heading___2dqtH",summary:"style__summary___1Srnv"}},,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){},function(e,t,n){},,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(3),o=n.n(r),i=n(34),a=(n(179),n(180),n(8)),c=n.n(a),l=n(0),s=n(21),u=n.n(s),f=n(4),p=n.n(f),m=n(5),h=n.n(m),d=n(10),g=n.n(d),b=n(9),y=n.n(b),v=n(11),_=n.n(v),w=n(6),x=n(13),E=n(30),k=n(24),O=n.n(k),j=n(137),S=n(37),I=n(156),N=n.n(I),L=function(e){function t(){var e;return p()(this,t),(e=g()(this,y()(t).apply(this,arguments))).maybeRenderHeading=function(){var t=e.props,n=t.attributes,r=n.heading,o=n.headingAlign,i=n.headingLevel,a=n.isToggleable,c=t.isSelected,s=t.setAttributes;if(!c&&!r)return null;var u="h".concat(i);return wp.element.createElement(u,{className:O()({"abt-bibliography__heading":!a},N.a.heading),style:{textAlign:o}},c&&wp.element.createElement(j.a,{placeholder:Object(l.__)("Write heading...","academic-bloggers-toolkit"),value:r,onChange:function(e){var t=e.currentTarget.value;s({heading:t})},onBlur:function(){return!r&&s({isToggleable:!1})}}),!c&&r)},e}return _()(t,e),h()(t,[{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.setAttributes,r=t.heading,i=t.headingAlign,a=t.headingLevel,c=t.isToggleable,s=t.items,f=Object(S.b)(t);return wp.element.createElement(wp.element.Fragment,null,wp.element.createElement(E.InspectorControls,null,wp.element.createElement(x.PanelBody,{title:Object(l.__)("Bibliography Settings","academic-bloggers-toolkit")},wp.element.createElement("p",null,Object(l.__)("Heading Level","academic-bloggers-toolkit")),wp.element.createElement(x.Toolbar,{controls:o()(Array(6).keys()).map(function(e){return{icon:"heading",title:"".concat(Object(l.__)("Heading","academic-bloggers-toolkit")," ").concat(e+1),isActive:e+1===a,onClick:function(){return n({headingLevel:e+1})},subscript:"".concat(e+1)}})}),wp.element.createElement("p",null,Object(l.__)("Heading Alignment","academic-bloggers-toolkit")),wp.element.createElement(E.AlignmentToolbar,{value:i,onChange:function(e){return n({headingAlign:e})}}),wp.element.createElement(x.ToggleControl,{label:Object(l.__)("Enable toggle","academic-bloggers-toolkit"),checked:c,help:Object(l.__)("Toggle mode can only be enabled if the bibliography has a heading.","academic-bloggers-toolkit"),onChange:function(e){return r&&n({isToggleable:e})}}))),wp.element.createElement("section",{className:"abt-bibliography",role:"region","aria-label":Object(l.__)("Bibliography","academic-bloggers-toolkit")},c&&wp.element.createElement("details",null,wp.element.createElement("summary",{className:N.a.summary},this.maybeRenderHeading()),wp.element.createElement("ol",u()({className:"abt-bibliography__body"},f),s.map(function(e){var t=e.content,n=e.id;return wp.element.createElement(E.RichText.Content,{key:n,tagName:"li",id:n,value:t})}))),!c&&wp.element.createElement(wp.element.Fragment,null,this.maybeRenderHeading(),wp.element.createElement("ol",u()({className:"abt-bibliography__body"},f),s.map(function(e){var t=e.content,n=e.id;return wp.element.createElement(E.RichText.Content,{key:n,tagName:"li",id:n,value:t})})))))}}]),t}(w.Component),T=function(e){function t(){return p()(this,t),g()(this,y()(t).apply(this,arguments))}return _()(t,e),h()(t,[{key:"render",value:function(){var e=this.props.attributes,t=e.heading,n=e.headingLevel,r=e.isToggleable,o=e.items,i=e.headingAlign,a=Object(S.b)(this.props.attributes),c="h".concat(n),s=i?{style:{textAlign:i}}:{};return t&&r?wp.element.createElement("section",{className:"abt-bibliography",role:"region","aria-label":Object(l.__)("Bibliography","academic-bloggers-toolkit")},wp.element.createElement("details",null,wp.element.createElement("summary",null,wp.element.createElement(c,u()({},s,{className:"abt-bibliography__heading"}),t)),wp.element.createElement("ol",u()({className:"abt-bibliography__body"},a),o.map(function(e){var t=e.content,n=e.id;return wp.element.createElement(E.RichText.Content,{key:n,tagName:"li",id:n,value:t})})))):t?wp.element.createElement("section",{className:"abt-bibliography",role:"region","aria-label":Object(l.__)("Bibliography","academic-bloggers-toolkit")},wp.element.createElement(c,u()({},s,{className:"abt-bibliography__heading"}),t),wp.element.createElement("ol",u()({className:"abt-bibliography__body"},a),o.map(function(e){var t=e.content,n=e.id;return wp.element.createElement(E.RichText.Content,{key:n,tagName:"li",id:n,value:t})}))):wp.element.createElement("section",{className:"abt-bibliography",role:"region","aria-label":Object(l.__)("Bibliography","academic-bloggers-toolkit")},wp.element.createElement("ol",u()({className:"abt-bibliography__body"},a),o.map(function(e){var t=e.content,n=e.id;return wp.element.createElement(E.RichText.Content,{key:n,tagName:"li",id:n,value:t})})))}}]),t}(w.Component),C=["abt/bibliography",{title:Object(l.__)("Bibliography","academic-bloggers-toolkit"),category:"widgets",description:Object(l.__)("Display a list of your cited references.","academic-bloggers-toolkit"),icon:"welcome-learn-more",attributes:{entryspacing:{type:"string",source:"attribute",attribute:"data-entryspacing",selector:".abt-bibliography__body"},hangingindent:{type:"string",source:"attribute",attribute:"data-hangingindent",selector:".abt-bibliography__body"},linespacing:{type:"string",source:"attribute",attribute:"data-linespacing",selector:".abt-bibliography__body"},maxoffset:{type:"string",source:"attribute",attribute:"data-maxoffset",selector:".abt-bibliography__body"},secondFieldAlign:{type:"string",source:"attribute",attribute:"data-second-field-align",selector:".abt-bibliography__body"},items:{type:"array",default:[],source:"query",selector:"li",query:{id:{source:"attribute",type:"string",attribute:"id"},content:{source:"html",type:"string"}}},heading:{type:"string",default:""},headingLevel:{type:"number",default:3},headingAlign:{type:"string"},isToggleable:{type:"boolean",default:!1}},supports:{html:!1,inserter:!1,multiple:!1,reusable:!1},transforms:{from:[{type:"raw",selector:".abt-bibliography",transform:function(e){var t=e.querySelector(".abt-bibliography__heading"),n=e.querySelector(".abt-bibliography__container");if(n&&0!==n.children.length){var r={items:o()(n.children).map(function(e){return{id:e.id,content:e.innerHTML}})};if(t&&t.textContent){var a=/^H([1-6])$/i,l=t.dataset.headingLevel,s=t.nodeName,u=t.textContent,f=a.exec(s);if(f)r=c()({},r,{heading:u,headingLevel:parseInt(f[1],10)});else{if("BUTTON"!==s||!l)return;f=a.exec(l),r=c()({},r,{heading:u,headingLevel:parseInt(f?f[1]:"3",10),isToggleable:!0})}}return Object(i.createBlock)("abt/bibliography",r)}}}]},edit:L,save:T}],A=function(e){function t(){return p()(this,t),g()(this,y()(t).apply(this,arguments))}return _()(t,e),h()(t,[{key:"render",value:function(){var e=this.props.attributes.items;return wp.element.createElement("section",{className:"abt-footnotes",role:"region","aria-label":Object(l.__)("Footnotes","academic-bloggers-toolkit")},wp.element.createElement("hr",null),wp.element.createElement("ol",null,e.map(function(e){var t=e.content,n=e.id;return wp.element.createElement(E.RichText.Content,{key:n,tagName:"li",id:n,className:"abt-footnotes-item",value:t})})))}}]),t}(w.Component),P=function(e){function t(){return p()(this,t),g()(this,y()(t).apply(this,arguments))}return _()(t,e),h()(t,[{key:"render",value:function(){var e=this.props.attributes.items;return wp.element.createElement("section",{className:"abt-footnotes",role:"region","aria-label":Object(l.__)("Footnotes","academic-bloggers-toolkit")},wp.element.createElement("hr",null),wp.element.createElement("ol",null,e.map(function(e){var t=e.content,n=e.id;return wp.element.createElement(E.RichText.Content,{key:n,tagName:"li",id:n,className:"abt-footnotes-item",value:t})})))}}]),t}(w.Component),R=["abt/footnotes",{title:Object(l.__)("Footnotes","academic-bloggers-toolkit"),category:"widgets",description:Object(l.__)("Display a list of footnotes","academic-bloggers-toolkit"),icon:"testimonial",attributes:{items:{type:"array",default:[],source:"query",selector:"li",query:{id:{source:"attribute",type:"string",attribute:"id"},content:{source:"html",type:"string"}}}},supports:{html:!1,inserter:!1,multiple:!1,reusable:!1},edit:A,save:P}],B=n(36),M=n.n(B),F=n(2),H=n.n(F),D=n(12),q=n.n(D),Y=n(20),G=n(14),V=n(111),J=n(115),K=n(112),X=n(71),U=n(25),z=n(139),W=n(142),Z=n.n(W),$=function(e){function t(){var e;return p()(this,t),(e=g()(this,y()(t).apply(this,arguments))).makeItemMover=function(t,n){var r=e.props,o=r.attributes.items,i=r.setAttributes;if(!("up"===n&&0===t||"down"===n&&t===o.length-1))return function(){return i({items:Object(U.c)(o,t,t+("up"===n?-1:1))})}},e.addItem=function(){var t=q()(H.a.mark(function t(n){var r,i,a,l,s,u,f,p;return H.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.props,i=r.attributes.items,a=r.references,l=r.setAttributes,s=a.find(function(e){return e.id===n})){t.next=4;break}return t.abrupt("return");case 4:return t.next=6,X.b.fetchItem(Object(G.select)("abt/data").getStyle().value);case 6:return u=t.sent,t.next=9,X.a.fetchItem(u);case 9:(f=new z.a(u)).parseCitations([{citationID:"",citationItems:[{id:s.id,item:s}],properties:{index:0,noteIndex:0}}]),(p=f.bibliography.items[0])&&l({items:[].concat(o()(i),[c()({},p,{content:Object(S.c)(p.content)})])});case 13:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),e}return _()(t,e),h()(t,[{key:"render",value:function(){var e=this,t=this.props,n=t.attributes,r=n.items,i=n.orderedList,a=t.isSelected,c=t.references,s=t.setAttributes,u=i?"ol":"ul";return wp.element.createElement(wp.element.Fragment,null,wp.element.createElement(E.InspectorControls,null,wp.element.createElement(x.PanelBody,null,Object(l.__)("Double click on one or more items in the list below to insert them into the end of the list.","academic-bloggers-toolkit"),wp.element.createElement(x.PanelBody,{icon:wp.element.createElement(V.a,{count:c.length}),initialOpen:!1,title:Object(l.__)("Available References","academic-bloggers-toolkit")},wp.element.createElement(K.a,{items:c,renderItem:J.a,onItemDoubleClick:this.addItem})))),wp.element.createElement(E.BlockFormatControls,null,wp.element.createElement(x.Toolbar,{controls:[{icon:"editor-ul",title:Object(l.__)("Convert to unordered list","academic-bloggers-toolkit"),isActive:!1===i,onClick:function(){i&&s({orderedList:!1})}},{icon:"editor-ol",title:Object(l.__)("Convert to ordered list","academic-bloggers-toolkit"),isActive:!0===i,onClick:function(){i||s({orderedList:!0})}}]})),wp.element.createElement("section",{className:"abt-static-bib",role:"region","aria-label":Object(l.__)("References","academic-bloggers-toolkit")},0===r.length&&wp.element.createElement(x.Placeholder,{icon:"welcome-learn-more",label:Object(l.__)("No references added yet","academic-bloggers-toolkit")},Object(l.__)('Add references to this list by double clicking one or more items listed in the "Avaliable References" section of the block settings panel.',"academic-bloggers-toolkit")),r.length>0&&wp.element.createElement(u,{className:"abt-bibliography__body"},r.map(function(t,n){var i=t.content,c=t.id;return a?wp.element.createElement(Q,{key:c,id:c,content:i,onMoveUp:e.makeItemMover(n,"up"),onRemove:function(){return s({items:[].concat(o()(r.slice(0,n)),o()(r.slice(n+1)))})},onMoveDown:e.makeItemMover(n,"down")}):wp.element.createElement(E.RichText.Content,{key:c,"data-id":c,tagName:"li",className:O()("csl-entry",Z.a.item),value:i})}))))}}]),t}(w.Component),Q=function(e){var t=e.content,n=e.id,r=e.onMoveDown,o=e.onMoveUp,i=e.onRemove;return wp.element.createElement("div",{key:n,className:Z.a.row},wp.element.createElement(E.RichText.Content,{tagName:"li","data-id":n,className:O()("csl-entry",Z.a.item),value:t}),wp.element.createElement("div",{className:Z.a.buttonList},wp.element.createElement(x.IconButton,{icon:"arrow-up-alt2",disabled:!o,label:Object(l.__)("Move item up","academic-bloggers-toolkit"),onClick:function(){return o&&o()}}),wp.element.createElement(x.IconButton,{icon:"trash",label:Object(l.__)("Remove item","academic-bloggers-toolkit"),onClick:function(){return i()}}),wp.element.createElement(x.IconButton,{icon:"arrow-down-alt2",disabled:!r,label:Object(l.__)("Move item down","academic-bloggers-toolkit"),onClick:function(){return r&&r()}})))},ee=Object(Y.compose)([Object(G.withSelect)(function(e,t){var n=t.attributes.items.map(function(e){return e.id});return{references:e("abt/data").getSortedItems().filter(function(e){return!n.includes(e.id)})}})])($),te=function(e){function t(){return p()(this,t),g()(this,y()(t).apply(this,arguments))}return _()(t,e),h()(t,[{key:"render",value:function(){var e=this.props.attributes,t=e.items,n=e.orderedList?"ol":"ul";return wp.element.createElement("section",{className:"abt-static-bib",role:"region","aria-label":Object(l.__)("References","academic-bloggers-toolkit")},wp.element.createElement(n,{className:"abt-bibliography__body"},t.map(function(e,t){var n=e.content,r=e.id;return wp.element.createElement(E.RichText.Content,{key:t,"data-id":r,tagName:"li",className:"csl-entry",value:n})})))}}]),t}(w.Component),ne=["abt/static-bibliography",{title:Object(l.__)("Static Bibliography","academic-bloggers-toolkit"),category:"widgets",description:Object(l.__)("Display a static list of references.","academic-bloggers-toolkit"),icon:"welcome-learn-more",keywords:[Object(l.__)("reference","academic-bloggers-toolkit"),Object(l.__)("citation","academic-bloggers-toolkit"),Object(l.__)("sources","academic-bloggers-toolkit")],attributes:{items:{type:"array",source:"query",selector:"li",default:[],query:{content:{type:"string",source:"html"},id:{type:"string",source:"attribute",attribute:"data-id"}}},orderedList:{type:"boolean",default:!0}},supports:{anchor:!0,html:!1},transforms:{from:[{type:"raw",selector:".abt-static-bib",transform:function(e){var t=e.querySelector(".abt-bibliography__container");if(t){var n=o()(t.children).map(function(e){var t=e.querySelector(".csl-entry");return{id:e.id||M()(),content:t?Object(S.c)(t):e.innerHTML}});return Object(i.createBlock)("abt/static-bibliography",{items:n})}}}]},edit:ee,save:te}];i.registerBlockType.apply(void 0,o()(C)),i.registerBlockType.apply(void 0,o()(R)),i.registerBlockType.apply(void 0,o()(ne))}]); //# sourceMappingURL=editor-blocks.js.map