!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=179)}([function(e,t){e.exports=wp.i18n},,function(e,t,n){e.exports=n(48)},function(e,t,n){var r=n(39),o=n(40),i=n(41);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;n0&&void 0!==arguments[0]&&arguments[0],t=document.createElement("div");if(e){var n=Object(a.select)("core/editor").getBlocksForSerialization().filter(function(e){return!c.includes(e.name)&&e.isValid});t.innerHTML=Object(i.serialize)(n)}else t.innerHTML=Object(a.select)("core/editor").getEditedPostContent();return t}function s(e){var t=e.entryspacing,n=e.hangingindent,r=e.maxoffset,o=e.linespacing,i=e.secondFieldAlign;return Object.assign({},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 u(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;--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 k}),n.d(t,"b",function(){return O});var r=n(2),o=n.n(r),i=n(11),a=n.n(i),c=n(9),l=n.n(c),s=n(8),u=n.n(s),f=n(10),p=n.n(f),m=n(3),h=n.n(m),d=n(16),g=n.n(d),b=n(4),y=n.n(b),v=n(5),_=n.n(v),w=n(18),x=n.n(w),E=function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;y()(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 _()(e,[{key:"getItem",value:function(e){return this.cache[e]||null}},{key:"removeItem",value:function(e){this.cache=x.a.omit(this.cache,e)}},{key:"setItem",value:function(e,t){this.cache=Object.assign({},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(127),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(108),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(18),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(23),m=n(128),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 w});var r=n(20),o=n.n(r),i=n(4),a=n.n(i),c=n(5),l=n.n(c),s=n(9),u=n.n(s),f=n(8),p=n.n(f),m=n(10),h=n.n(m),d=n(6),g=n(22),b=n.n(g),y=n(130),v=n.n(y),_=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o0&&wp.element.createElement(u,{className:"abt-bibliography__body"},r.map(function(t,n){var i=t.content,a=t.id;return c?wp.element.createElement(Z,{key:a,id:a,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(w.RichText.Content,{key:a,"data-id":a,tagName:"li",className:E()("csl-entry",z.a.item),value:i})}))))}}]),t}(v.Component),Z=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(w.RichText.Content,{tagName:"li","data-id":n,className:E()("csl-entry",z.a.item),value:t}),wp.element.createElement("div",{className:z.a.buttonList},wp.element.createElement(_.IconButton,{icon:"arrow-up-alt2",disabled:!o,label:Object(a.__)("Move item up","academic-bloggers-toolkit"),onClick:function(){return o&&o()}}),wp.element.createElement(_.IconButton,{icon:"trash",label:Object(a.__)("Remove item","academic-bloggers-toolkit"),onClick:function(){return i()}}),wp.element.createElement(_.IconButton,{icon:"arrow-down-alt2",disabled:!r,label:Object(a.__)("Move item down","academic-bloggers-toolkit"),onClick:function(){return r&&r()}})))},$=Object(D.compose)([Object(q.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)})}})])(W),Q=function(e){function t(){return u()(this,t),h()(this,g()(t).apply(this,arguments))}return y()(t,e),p()(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(a.__)("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(w.RichText.Content,{key:t,"data-id":r,tagName:"li",className:"csl-entry",value:n})})))}}]),t}(v.Component),ee=["abt/static-bibliography",{title:Object(a.__)("Static Bibliography","academic-bloggers-toolkit"),category:"widgets",description:Object(a.__)("Display a static list of references.","academic-bloggers-toolkit"),icon:"welcome-learn-more",keywords:[Object(a.__)("reference","academic-bloggers-toolkit"),Object(a.__)("citation","academic-bloggers-toolkit"),Object(a.__)("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||P()(),content:t?Object(O.c)(t):e.innerHTML}});return Object(i.createBlock)("abt/static-bibliography",{items:n})}}}]},edit:$,save:Q}];i.registerBlockType.apply(void 0,o()(L)),i.registerBlockType.apply(void 0,o()(A)),i.registerBlockType.apply(void 0,o()(ee))}]); //# sourceMappingURL=editor-blocks.js.map