ably-ui 8.7.0.dev.6053fb4 → 8.7.0.dev.7072b07

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +6 -6
  3. data/README.md +7 -3
  4. data/lib/ably_ui/core/code/component.css +2 -0
  5. data/lib/ably_ui/core/code/component.js +739 -1
  6. data/lib/ably_ui/core/company_autocomplete/component.css +2 -0
  7. data/lib/ably_ui/core/company_autocomplete/component.js +1161 -1
  8. data/lib/ably_ui/core/connect_state_wrapper/component.js +22 -1
  9. data/lib/ably_ui/core/contact_footer/component.css +2 -0
  10. data/lib/ably_ui/core/contact_footer/component.js +211 -1
  11. data/lib/ably_ui/core/cookie_message/component.css +2 -0
  12. data/lib/ably_ui/core/cookie_message/component.js +82 -1
  13. data/lib/ably_ui/core/core.rb +8 -4
  14. data/lib/ably_ui/core/customer_logos/component.js +22 -1
  15. data/lib/ably_ui/core/dropdown_menu/component.js +22 -1
  16. data/lib/ably_ui/core/feature_footer/component.css +2 -0
  17. data/lib/ably_ui/core/feature_footer/component.js +211 -1
  18. data/lib/ably_ui/core/featured_link/component.css +2 -0
  19. data/lib/ably_ui/core/featured_link/component.js +82 -1
  20. data/lib/ably_ui/core/flash/component.css +2 -0
  21. data/lib/ably_ui/core/flash/component.js +82 -1
  22. data/lib/ably_ui/core/footer/component.css +3 -1
  23. data/lib/ably_ui/core/footer/component.js +82 -1
  24. data/lib/ably_ui/core/footer/footer.html.erb +18 -23
  25. data/lib/ably_ui/core/icon/component.js +22 -1
  26. data/lib/ably_ui/core/images/best-support-2023.svg +1 -0
  27. data/lib/ably_ui/core/images/fastest-implementation-2023.svg +1 -0
  28. data/lib/ably_ui/core/images/high-performer-2023.svg +1 -0
  29. data/lib/ably_ui/core/images/highest-user-adoption-2023.svg +1 -0
  30. data/lib/ably_ui/core/loader/component.js +22 -1
  31. data/lib/ably_ui/core/logo/component.js +22 -1
  32. data/lib/ably_ui/core/meganav/component.css +3 -3
  33. data/lib/ably_ui/core/meganav/component.js +992 -1
  34. data/lib/ably_ui/core/meganav/component.json +1 -1
  35. data/lib/ably_ui/core/meganav/meganav.rb +4 -4
  36. data/lib/ably_ui/core/meganav_blog_posts_list/component.js +1159 -1
  37. data/lib/ably_ui/core/meganav_content_company/component.js +22 -1
  38. data/lib/ably_ui/core/meganav_content_company/meganav_content_company.html.erb +9 -0
  39. data/lib/ably_ui/core/meganav_content_developers/component.js +22 -1
  40. data/lib/ably_ui/core/meganav_content_developers/meganav_content_developers.html.erb +18 -2
  41. data/lib/ably_ui/core/meganav_content_products/component.js +22 -0
  42. data/lib/ably_ui/core/{meganav_content_platform/meganav_content_platform.html.erb → meganav_content_products/meganav_content_products.html.erb} +15 -33
  43. data/lib/ably_ui/core/{meganav_content_platform/meganav_content_platform.rb → meganav_content_products/meganav_content_products.rb} +1 -1
  44. data/lib/ably_ui/core/meganav_content_use_cases/component.js +22 -1
  45. data/lib/ably_ui/core/meganav_content_use_cases/meganav_content_use_cases.html.erb +42 -38
  46. data/lib/ably_ui/core/meganav_control/component.js +241 -1
  47. data/lib/ably_ui/core/meganav_control_mobile_dropdown/component.js +180 -1
  48. data/lib/ably_ui/core/meganav_control_mobile_panel_close/component.js +142 -1
  49. data/lib/ably_ui/core/meganav_control_mobile_panel_open/component.js +170 -1
  50. data/lib/ably_ui/core/meganav_items_desktop/component.js +22 -1
  51. data/lib/ably_ui/core/meganav_items_desktop/meganav_items_desktop.rb +1 -1
  52. data/lib/ably_ui/core/meganav_items_mobile/component.js +22 -1
  53. data/lib/ably_ui/core/meganav_items_signed_in/component.js +22 -1
  54. data/lib/ably_ui/core/meganav_search/component.js +22 -1
  55. data/lib/ably_ui/core/meganav_search_autocomplete/component.js +295 -1
  56. data/lib/ably_ui/core/meganav_search_panel/component.js +22 -1
  57. data/lib/ably_ui/core/meganav_search_suggestions/component.js +258 -1
  58. data/lib/ably_ui/core/notice/component.css +2 -0
  59. data/lib/ably_ui/core/notice/component.js +872 -1
  60. data/lib/ably_ui/core/scripts.js +1465 -1
  61. data/lib/ably_ui/core/showcase/component.css +2 -0
  62. data/lib/ably_ui/core/showcase/component.js +343 -1
  63. data/lib/ably_ui/core/sign_out_link/component.js +22 -1
  64. data/lib/ably_ui/core/slider/component.css +2 -0
  65. data/lib/ably_ui/core/slider/component.js +255 -1
  66. data/lib/ably_ui/core/sprites.svg +93 -0
  67. data/lib/ably_ui/core/styles.css +3 -7
  68. data/lib/ably_ui/core/uptime/component.css +2 -0
  69. data/lib/ably_ui/core/uptime/component.js +82 -1
  70. data/lib/ably_ui/reset/scripts.js +1 -1
  71. data/lib/ably_ui/reset/styles.css +1 -11
  72. data/lib/ably_ui/version.rb +1 -1
  73. metadata +9 -5
  74. data/lib/ably_ui/core/meganav_content_platform/component.js +0 -1
@@ -1 +1,1159 @@
1
- !function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("redux")):"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.AblyUi=r(require("redux")):(t.AblyUi=t.AblyUi||{},t.AblyUi.Core=t.AblyUi.Core||{},t.AblyUi.Core.MeganavBlogPostsList=r(t[void 0]))}(this,(function(t){return(()=>{var r={7757:(t,r,e)=>{e(5666)},5666:t=>{var r=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(t){u=function(t,r,e){return t[r]=e}}function l(t,r,e,n){var o=r&&r.prototype instanceof v?r:v,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,r,e){var n=s;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return C()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=E(a,e);if(c){if(c===d)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===s)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=p;var u=f(t,r,e);if("normal"===u.type){if(n=e.done?y:h,u.arg===d)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var s="suspendedStart",h="suspendedYield",p="executing",y="completed",d={};function v(){}function g(){}function m(){}var b={};b[i]=function(){return this};var w=Object.getPrototypeOf,x=w&&w(w(_([])));x&&x!==e&&n.call(x,i)&&(b=x);var O=m.prototype=v.prototype=Object.create(b);function L(t){["next","throw","return"].forEach((function(r){u(t,r,(function(t){return this._invoke(r,t)}))}))}function j(t,r){function e(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==typeof s&&n.call(s,"__await")?r.resolve(s.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new r((function(r,o){e(t,n,r,o)}))}return o=o?o.then(i,i):i()}}function E(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,E(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function A(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function P(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function _(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:C}}function C(){return{value:r,done:!0}}return g.prototype=O.constructor=m,m.constructor=g,g.displayName=u(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===g||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,c,"GeneratorFunction")),t.prototype=Object.create(O),t},t.awrap=function(t){return{__await:t}},L(j.prototype),j.prototype[a]=function(){return this},t.AsyncIterator=j,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new j(l(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(O),u(O,c,"Generator"),O[i]=function(){return this},O.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=_,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(P),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=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"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),P(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;P(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:_(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),d}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}},5044:r=>{"use strict";r.exports=t}},e={};function n(t){var o=e[t];if(void 0!==o)return o.exports;var i=e[t]={exports:{}};return r[t](i,i.exports,n),i.exports}n.d=(t,r)=>{for(var e in r)n.o(r,e)&&!n.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:r[e]})},n.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r);var o={};return(()=>{"use strict";n.d(o,{default:()=>f});var t=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return r.querySelectorAll("[data-id=".concat(t,"]"))};function r(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function e(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(r){i(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))}))}return t}function i(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}n(7757);var a={recent:null},c=(i({},"blogPosts",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,r=arguments.length>1?arguments[1]:void 0;return"blog/loaded"===r.type?e(e({},t),{},{recent:r.payload}):t})),function(t){var r;return null===(r=t.getState().blogPosts)||void 0===r?void 0:r.recent}),u=(n(5044),function(t,r){var e=function(){if(!window.AblyUi.RemoteDataStore)throw new Error("Remote store was called before one was created");return window.AblyUi.RemoteDataStore}(),n=t(e);e.subscribe((function(){var o=t(e);o!==n&&(n=o,r(o))}))});function l(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}const f=function(){u(c,(function(r){if(Array.isArray(r)&&r.length>0){var e=t("meganav-company-panel-blog-section"),n=t("meganav-company-panel-recent-blog-posts");Array.from(n).forEach((function(t){var e=document.createDocumentFragment();r.forEach((function(t){return e.appendChild((i=(r=t).link,a=r.title,c=r.pubDate,n=["li","a","p","p"].map((function(t){return document.createElement(t)})),o=4,u=function(t){if(Array.isArray(t))return t}(n)||function(t,r){var e=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null!=e){var n,o,i=[],a=!0,c=!1;try{for(e=e.call(t);!(a=(n=e.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==e.return||e.return()}finally{if(c)throw o}}return i}}(n,o)||function(t,r){if(t){if("string"==typeof t)return l(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?l(t,r):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),f=u[0],s=u[1],h=u[2],p=u[3],s.href=i,s.classList.add("ui-meganav-media","group"),h.textContent=a,h.classList.add("ui-meganav-media-heading"),p.textContent=c,p.classList.add("ui-meganav-media-copy"),s.appendChild(h),s.appendChild(p),f.appendChild(s),f));var r,n,o,i,a,c,u,f,s,h,p})),t.appendChild(e)})),Array.from(e).forEach((function(t){return t.classList.remove("hidden")}))}}))}})(),o.default})()}));
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("redux"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["AblyUi"] = factory(require("redux"));
8
+ else
9
+ root["AblyUi"] = root["AblyUi"] || {}, root["AblyUi"]["Core"] = root["AblyUi"]["Core"] || {}, root["AblyUi"]["Core"]["MeganavBlogPostsList"] = factory(root[undefined]);
10
+ })(this, (__WEBPACK_EXTERNAL_MODULE_redux__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ var __webpack_modules__ = ({
13
+
14
+ /***/ "./node_modules/@babel/runtime/regenerator/index.js":
15
+ /*!**********************************************************!*\
16
+ !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
17
+ \**********************************************************/
18
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
19
+
20
+ module.exports = __webpack_require__(/*! regenerator-runtime */ "./node_modules/regenerator-runtime/runtime.js");
21
+
22
+
23
+ /***/ }),
24
+
25
+ /***/ "./src/core/dom-query.js":
26
+ /*!*******************************!*\
27
+ !*** ./src/core/dom-query.js ***!
28
+ \*******************************/
29
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
30
+
31
+ "use strict";
32
+ __webpack_require__.r(__webpack_exports__);
33
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
34
+ /* harmony export */ "queryId": () => (/* binding */ queryId),
35
+ /* harmony export */ "queryIdAll": () => (/* binding */ queryIdAll)
36
+ /* harmony export */ });
37
+ var queryId = function queryId(val) {
38
+ var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
39
+ return root.querySelector("[data-id=".concat(val, "]"));
40
+ };
41
+ var queryIdAll = function queryIdAll(val) {
42
+ var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
43
+ return root.querySelectorAll("[data-id=".concat(val, "]"));
44
+ };
45
+
46
+ /***/ }),
47
+
48
+ /***/ "./src/core/remote-blogs-posts.js":
49
+ /*!****************************************!*\
50
+ !*** ./src/core/remote-blogs-posts.js ***!
51
+ \****************************************/
52
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
53
+
54
+ "use strict";
55
+ __webpack_require__.r(__webpack_exports__);
56
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
57
+ /* harmony export */ "fetchBlogPosts": () => (/* binding */ fetchBlogPosts),
58
+ /* harmony export */ "reducerBlogPosts": () => (/* binding */ reducerBlogPosts),
59
+ /* harmony export */ "selectRecentBlogPosts": () => (/* binding */ selectRecentBlogPosts)
60
+ /* harmony export */ });
61
+ /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
62
+ /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
63
+ /* harmony import */ var _remote_data_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./remote-data-util */ "./src/core/remote-data-util.js");
64
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
65
+
66
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
67
+
68
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
69
+
70
+
71
+
72
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
73
+
74
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
75
+
76
+
77
+
78
+ var fetchBlogPosts = /*#__PURE__*/function () {
79
+ var _ref = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(store, blogUrl) {
80
+ var res, payload;
81
+ return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
82
+ while (1) {
83
+ switch (_context.prev = _context.next) {
84
+ case 0:
85
+ _context.prev = 0;
86
+
87
+ if (blogUrl) {
88
+ _context.next = 4;
89
+ break;
90
+ }
91
+
92
+ console.log("Skipping fetching blog posts, invalid blogUrl: \"".concat(blogUrl, "\""));
93
+ return _context.abrupt("return");
94
+
95
+ case 4:
96
+ _context.next = 6;
97
+ return fetch(blogUrl);
98
+
99
+ case 6:
100
+ res = _context.sent;
101
+
102
+ if (!(0,_remote_data_util__WEBPACK_IMPORTED_MODULE_1__.isJsonResponse)(res.headers.get("content-type"))) {
103
+ _context.next = 14;
104
+ break;
105
+ }
106
+
107
+ _context.next = 10;
108
+ return res.json();
109
+
110
+ case 10:
111
+ payload = _context.sent;
112
+ store.dispatch({
113
+ type: "blog/loaded",
114
+ payload: payload
115
+ });
116
+ _context.next = 15;
117
+ break;
118
+
119
+ case 14:
120
+ throw new Error("Blog posts url is not serving json");
121
+
122
+ case 15:
123
+ _context.next = 20;
124
+ break;
125
+
126
+ case 17:
127
+ _context.prev = 17;
128
+ _context.t0 = _context["catch"](0);
129
+ console.warn("Could not fetch blog posts due to error:", _context.t0);
130
+
131
+ case 20:
132
+ case "end":
133
+ return _context.stop();
134
+ }
135
+ }
136
+ }, _callee, null, [[0, 17]]);
137
+ }));
138
+
139
+ return function fetchBlogPosts(_x, _x2) {
140
+ return _ref.apply(this, arguments);
141
+ };
142
+ }();
143
+
144
+ var initialState = {
145
+ recent: null
146
+ };
147
+ var REDUCER_KEY = "blogPosts";
148
+
149
+ var reducerBlogPosts = _defineProperty({}, REDUCER_KEY, function () {
150
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
151
+ var action = arguments.length > 1 ? arguments[1] : undefined;
152
+
153
+ switch (action.type) {
154
+ case "blog/loaded":
155
+ return _objectSpread(_objectSpread({}, state), {}, {
156
+ recent: action.payload
157
+ });
158
+
159
+ default:
160
+ return state;
161
+ }
162
+ });
163
+
164
+ var selectRecentBlogPosts = function selectRecentBlogPosts(store) {
165
+ var _store$getState$REDUC;
166
+
167
+ return (_store$getState$REDUC = store.getState()[REDUCER_KEY]) === null || _store$getState$REDUC === void 0 ? void 0 : _store$getState$REDUC.recent;
168
+ };
169
+
170
+
171
+
172
+ /***/ }),
173
+
174
+ /***/ "./src/core/remote-data-store.js":
175
+ /*!***************************************!*\
176
+ !*** ./src/core/remote-data-store.js ***!
177
+ \***************************************/
178
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
179
+
180
+ "use strict";
181
+ __webpack_require__.r(__webpack_exports__);
182
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
183
+ /* harmony export */ "attachStoreToWindow": () => (/* binding */ attachStoreToWindow),
184
+ /* harmony export */ "connectState": () => (/* binding */ connectState),
185
+ /* harmony export */ "createRemoteDataStore": () => (/* binding */ createRemoteDataStore),
186
+ /* harmony export */ "getRemoteDataStore": () => (/* binding */ getRemoteDataStore)
187
+ /* harmony export */ });
188
+ /* harmony import */ var redux__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! redux */ "redux");
189
+ /* harmony import */ var redux__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(redux__WEBPACK_IMPORTED_MODULE_0__);
190
+
191
+ var attachStoreToWindow = function attachStoreToWindow(store) {
192
+ window.AblyUi = window.AblyUi || {};
193
+ window.AblyUi.RemoteDataStore = store;
194
+ };
195
+ var getRemoteDataStore = function getRemoteDataStore() {
196
+ if (!window.AblyUi.RemoteDataStore) {
197
+ throw new Error("Remote store was called before one was created");
198
+ }
199
+
200
+ return window.AblyUi.RemoteDataStore;
201
+ };
202
+ var connectState = function connectState(selector, setState) {
203
+ var store = getRemoteDataStore();
204
+ var cachedOldState = selector(store);
205
+ store.subscribe(function () {
206
+ var newState = selector(store); // Do nothing, state is the same
207
+
208
+ if (newState === cachedOldState) {
209
+ return;
210
+ }
211
+
212
+ cachedOldState = newState;
213
+ setState(newState);
214
+ });
215
+ };
216
+ var createRemoteDataStore = function createRemoteDataStore(reducers) {
217
+ return (0,redux__WEBPACK_IMPORTED_MODULE_0__.createStore)((0,redux__WEBPACK_IMPORTED_MODULE_0__.combineReducers)(reducers));
218
+ };
219
+
220
+ /***/ }),
221
+
222
+ /***/ "./src/core/remote-data-util.js":
223
+ /*!**************************************!*\
224
+ !*** ./src/core/remote-data-util.js ***!
225
+ \**************************************/
226
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
227
+
228
+ "use strict";
229
+ __webpack_require__.r(__webpack_exports__);
230
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
231
+ /* harmony export */ "isJsonResponse": () => (/* binding */ isJsonResponse)
232
+ /* harmony export */ });
233
+ // isJsonResponse is useful for environments where hitting an endpoint
234
+ // would return an html page (eg. Gatsby local dev)
235
+ var isJsonResponse = function isJsonResponse(contentType) {
236
+ return contentType && contentType.includes("application/json");
237
+ };
238
+
239
+ /***/ }),
240
+
241
+ /***/ "./node_modules/regenerator-runtime/runtime.js":
242
+ /*!*****************************************************!*\
243
+ !*** ./node_modules/regenerator-runtime/runtime.js ***!
244
+ \*****************************************************/
245
+ /***/ ((module) => {
246
+
247
+ /**
248
+ * Copyright (c) 2014-present, Facebook, Inc.
249
+ *
250
+ * This source code is licensed under the MIT license found in the
251
+ * LICENSE file in the root directory of this source tree.
252
+ */
253
+
254
+ var runtime = (function (exports) {
255
+ "use strict";
256
+
257
+ var Op = Object.prototype;
258
+ var hasOwn = Op.hasOwnProperty;
259
+ var undefined; // More compressible than void 0.
260
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
261
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
262
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
263
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
264
+
265
+ function define(obj, key, value) {
266
+ Object.defineProperty(obj, key, {
267
+ value: value,
268
+ enumerable: true,
269
+ configurable: true,
270
+ writable: true
271
+ });
272
+ return obj[key];
273
+ }
274
+ try {
275
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
276
+ define({}, "");
277
+ } catch (err) {
278
+ define = function(obj, key, value) {
279
+ return obj[key] = value;
280
+ };
281
+ }
282
+
283
+ function wrap(innerFn, outerFn, self, tryLocsList) {
284
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
285
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
286
+ var generator = Object.create(protoGenerator.prototype);
287
+ var context = new Context(tryLocsList || []);
288
+
289
+ // The ._invoke method unifies the implementations of the .next,
290
+ // .throw, and .return methods.
291
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
292
+
293
+ return generator;
294
+ }
295
+ exports.wrap = wrap;
296
+
297
+ // Try/catch helper to minimize deoptimizations. Returns a completion
298
+ // record like context.tryEntries[i].completion. This interface could
299
+ // have been (and was previously) designed to take a closure to be
300
+ // invoked without arguments, but in all the cases we care about we
301
+ // already have an existing method we want to call, so there's no need
302
+ // to create a new function object. We can even get away with assuming
303
+ // the method takes exactly one argument, since that happens to be true
304
+ // in every case, so we don't have to touch the arguments object. The
305
+ // only additional allocation required is the completion record, which
306
+ // has a stable shape and so hopefully should be cheap to allocate.
307
+ function tryCatch(fn, obj, arg) {
308
+ try {
309
+ return { type: "normal", arg: fn.call(obj, arg) };
310
+ } catch (err) {
311
+ return { type: "throw", arg: err };
312
+ }
313
+ }
314
+
315
+ var GenStateSuspendedStart = "suspendedStart";
316
+ var GenStateSuspendedYield = "suspendedYield";
317
+ var GenStateExecuting = "executing";
318
+ var GenStateCompleted = "completed";
319
+
320
+ // Returning this object from the innerFn has the same effect as
321
+ // breaking out of the dispatch switch statement.
322
+ var ContinueSentinel = {};
323
+
324
+ // Dummy constructor functions that we use as the .constructor and
325
+ // .constructor.prototype properties for functions that return Generator
326
+ // objects. For full spec compliance, you may wish to configure your
327
+ // minifier not to mangle the names of these two functions.
328
+ function Generator() {}
329
+ function GeneratorFunction() {}
330
+ function GeneratorFunctionPrototype() {}
331
+
332
+ // This is a polyfill for %IteratorPrototype% for environments that
333
+ // don't natively support it.
334
+ var IteratorPrototype = {};
335
+ IteratorPrototype[iteratorSymbol] = function () {
336
+ return this;
337
+ };
338
+
339
+ var getProto = Object.getPrototypeOf;
340
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
341
+ if (NativeIteratorPrototype &&
342
+ NativeIteratorPrototype !== Op &&
343
+ hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
344
+ // This environment has a native %IteratorPrototype%; use it instead
345
+ // of the polyfill.
346
+ IteratorPrototype = NativeIteratorPrototype;
347
+ }
348
+
349
+ var Gp = GeneratorFunctionPrototype.prototype =
350
+ Generator.prototype = Object.create(IteratorPrototype);
351
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
352
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
353
+ GeneratorFunction.displayName = define(
354
+ GeneratorFunctionPrototype,
355
+ toStringTagSymbol,
356
+ "GeneratorFunction"
357
+ );
358
+
359
+ // Helper for defining the .next, .throw, and .return methods of the
360
+ // Iterator interface in terms of a single ._invoke method.
361
+ function defineIteratorMethods(prototype) {
362
+ ["next", "throw", "return"].forEach(function(method) {
363
+ define(prototype, method, function(arg) {
364
+ return this._invoke(method, arg);
365
+ });
366
+ });
367
+ }
368
+
369
+ exports.isGeneratorFunction = function(genFun) {
370
+ var ctor = typeof genFun === "function" && genFun.constructor;
371
+ return ctor
372
+ ? ctor === GeneratorFunction ||
373
+ // For the native GeneratorFunction constructor, the best we can
374
+ // do is to check its .name property.
375
+ (ctor.displayName || ctor.name) === "GeneratorFunction"
376
+ : false;
377
+ };
378
+
379
+ exports.mark = function(genFun) {
380
+ if (Object.setPrototypeOf) {
381
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
382
+ } else {
383
+ genFun.__proto__ = GeneratorFunctionPrototype;
384
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
385
+ }
386
+ genFun.prototype = Object.create(Gp);
387
+ return genFun;
388
+ };
389
+
390
+ // Within the body of any async function, `await x` is transformed to
391
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
392
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
393
+ // meant to be awaited.
394
+ exports.awrap = function(arg) {
395
+ return { __await: arg };
396
+ };
397
+
398
+ function AsyncIterator(generator, PromiseImpl) {
399
+ function invoke(method, arg, resolve, reject) {
400
+ var record = tryCatch(generator[method], generator, arg);
401
+ if (record.type === "throw") {
402
+ reject(record.arg);
403
+ } else {
404
+ var result = record.arg;
405
+ var value = result.value;
406
+ if (value &&
407
+ typeof value === "object" &&
408
+ hasOwn.call(value, "__await")) {
409
+ return PromiseImpl.resolve(value.__await).then(function(value) {
410
+ invoke("next", value, resolve, reject);
411
+ }, function(err) {
412
+ invoke("throw", err, resolve, reject);
413
+ });
414
+ }
415
+
416
+ return PromiseImpl.resolve(value).then(function(unwrapped) {
417
+ // When a yielded Promise is resolved, its final value becomes
418
+ // the .value of the Promise<{value,done}> result for the
419
+ // current iteration.
420
+ result.value = unwrapped;
421
+ resolve(result);
422
+ }, function(error) {
423
+ // If a rejected Promise was yielded, throw the rejection back
424
+ // into the async generator function so it can be handled there.
425
+ return invoke("throw", error, resolve, reject);
426
+ });
427
+ }
428
+ }
429
+
430
+ var previousPromise;
431
+
432
+ function enqueue(method, arg) {
433
+ function callInvokeWithMethodAndArg() {
434
+ return new PromiseImpl(function(resolve, reject) {
435
+ invoke(method, arg, resolve, reject);
436
+ });
437
+ }
438
+
439
+ return previousPromise =
440
+ // If enqueue has been called before, then we want to wait until
441
+ // all previous Promises have been resolved before calling invoke,
442
+ // so that results are always delivered in the correct order. If
443
+ // enqueue has not been called before, then it is important to
444
+ // call invoke immediately, without waiting on a callback to fire,
445
+ // so that the async generator function has the opportunity to do
446
+ // any necessary setup in a predictable way. This predictability
447
+ // is why the Promise constructor synchronously invokes its
448
+ // executor callback, and why async functions synchronously
449
+ // execute code before the first await. Since we implement simple
450
+ // async functions in terms of async generators, it is especially
451
+ // important to get this right, even though it requires care.
452
+ previousPromise ? previousPromise.then(
453
+ callInvokeWithMethodAndArg,
454
+ // Avoid propagating failures to Promises returned by later
455
+ // invocations of the iterator.
456
+ callInvokeWithMethodAndArg
457
+ ) : callInvokeWithMethodAndArg();
458
+ }
459
+
460
+ // Define the unified helper method that is used to implement .next,
461
+ // .throw, and .return (see defineIteratorMethods).
462
+ this._invoke = enqueue;
463
+ }
464
+
465
+ defineIteratorMethods(AsyncIterator.prototype);
466
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
467
+ return this;
468
+ };
469
+ exports.AsyncIterator = AsyncIterator;
470
+
471
+ // Note that simple async functions are implemented on top of
472
+ // AsyncIterator objects; they just return a Promise for the value of
473
+ // the final result produced by the iterator.
474
+ exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
475
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
476
+
477
+ var iter = new AsyncIterator(
478
+ wrap(innerFn, outerFn, self, tryLocsList),
479
+ PromiseImpl
480
+ );
481
+
482
+ return exports.isGeneratorFunction(outerFn)
483
+ ? iter // If outerFn is a generator, return the full iterator.
484
+ : iter.next().then(function(result) {
485
+ return result.done ? result.value : iter.next();
486
+ });
487
+ };
488
+
489
+ function makeInvokeMethod(innerFn, self, context) {
490
+ var state = GenStateSuspendedStart;
491
+
492
+ return function invoke(method, arg) {
493
+ if (state === GenStateExecuting) {
494
+ throw new Error("Generator is already running");
495
+ }
496
+
497
+ if (state === GenStateCompleted) {
498
+ if (method === "throw") {
499
+ throw arg;
500
+ }
501
+
502
+ // Be forgiving, per 25.3.3.3.3 of the spec:
503
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
504
+ return doneResult();
505
+ }
506
+
507
+ context.method = method;
508
+ context.arg = arg;
509
+
510
+ while (true) {
511
+ var delegate = context.delegate;
512
+ if (delegate) {
513
+ var delegateResult = maybeInvokeDelegate(delegate, context);
514
+ if (delegateResult) {
515
+ if (delegateResult === ContinueSentinel) continue;
516
+ return delegateResult;
517
+ }
518
+ }
519
+
520
+ if (context.method === "next") {
521
+ // Setting context._sent for legacy support of Babel's
522
+ // function.sent implementation.
523
+ context.sent = context._sent = context.arg;
524
+
525
+ } else if (context.method === "throw") {
526
+ if (state === GenStateSuspendedStart) {
527
+ state = GenStateCompleted;
528
+ throw context.arg;
529
+ }
530
+
531
+ context.dispatchException(context.arg);
532
+
533
+ } else if (context.method === "return") {
534
+ context.abrupt("return", context.arg);
535
+ }
536
+
537
+ state = GenStateExecuting;
538
+
539
+ var record = tryCatch(innerFn, self, context);
540
+ if (record.type === "normal") {
541
+ // If an exception is thrown from innerFn, we leave state ===
542
+ // GenStateExecuting and loop back for another invocation.
543
+ state = context.done
544
+ ? GenStateCompleted
545
+ : GenStateSuspendedYield;
546
+
547
+ if (record.arg === ContinueSentinel) {
548
+ continue;
549
+ }
550
+
551
+ return {
552
+ value: record.arg,
553
+ done: context.done
554
+ };
555
+
556
+ } else if (record.type === "throw") {
557
+ state = GenStateCompleted;
558
+ // Dispatch the exception by looping back around to the
559
+ // context.dispatchException(context.arg) call above.
560
+ context.method = "throw";
561
+ context.arg = record.arg;
562
+ }
563
+ }
564
+ };
565
+ }
566
+
567
+ // Call delegate.iterator[context.method](context.arg) and handle the
568
+ // result, either by returning a { value, done } result from the
569
+ // delegate iterator, or by modifying context.method and context.arg,
570
+ // setting context.delegate to null, and returning the ContinueSentinel.
571
+ function maybeInvokeDelegate(delegate, context) {
572
+ var method = delegate.iterator[context.method];
573
+ if (method === undefined) {
574
+ // A .throw or .return when the delegate iterator has no .throw
575
+ // method always terminates the yield* loop.
576
+ context.delegate = null;
577
+
578
+ if (context.method === "throw") {
579
+ // Note: ["return"] must be used for ES3 parsing compatibility.
580
+ if (delegate.iterator["return"]) {
581
+ // If the delegate iterator has a return method, give it a
582
+ // chance to clean up.
583
+ context.method = "return";
584
+ context.arg = undefined;
585
+ maybeInvokeDelegate(delegate, context);
586
+
587
+ if (context.method === "throw") {
588
+ // If maybeInvokeDelegate(context) changed context.method from
589
+ // "return" to "throw", let that override the TypeError below.
590
+ return ContinueSentinel;
591
+ }
592
+ }
593
+
594
+ context.method = "throw";
595
+ context.arg = new TypeError(
596
+ "The iterator does not provide a 'throw' method");
597
+ }
598
+
599
+ return ContinueSentinel;
600
+ }
601
+
602
+ var record = tryCatch(method, delegate.iterator, context.arg);
603
+
604
+ if (record.type === "throw") {
605
+ context.method = "throw";
606
+ context.arg = record.arg;
607
+ context.delegate = null;
608
+ return ContinueSentinel;
609
+ }
610
+
611
+ var info = record.arg;
612
+
613
+ if (! info) {
614
+ context.method = "throw";
615
+ context.arg = new TypeError("iterator result is not an object");
616
+ context.delegate = null;
617
+ return ContinueSentinel;
618
+ }
619
+
620
+ if (info.done) {
621
+ // Assign the result of the finished delegate to the temporary
622
+ // variable specified by delegate.resultName (see delegateYield).
623
+ context[delegate.resultName] = info.value;
624
+
625
+ // Resume execution at the desired location (see delegateYield).
626
+ context.next = delegate.nextLoc;
627
+
628
+ // If context.method was "throw" but the delegate handled the
629
+ // exception, let the outer generator proceed normally. If
630
+ // context.method was "next", forget context.arg since it has been
631
+ // "consumed" by the delegate iterator. If context.method was
632
+ // "return", allow the original .return call to continue in the
633
+ // outer generator.
634
+ if (context.method !== "return") {
635
+ context.method = "next";
636
+ context.arg = undefined;
637
+ }
638
+
639
+ } else {
640
+ // Re-yield the result returned by the delegate method.
641
+ return info;
642
+ }
643
+
644
+ // The delegate iterator is finished, so forget it and continue with
645
+ // the outer generator.
646
+ context.delegate = null;
647
+ return ContinueSentinel;
648
+ }
649
+
650
+ // Define Generator.prototype.{next,throw,return} in terms of the
651
+ // unified ._invoke helper method.
652
+ defineIteratorMethods(Gp);
653
+
654
+ define(Gp, toStringTagSymbol, "Generator");
655
+
656
+ // A Generator should always return itself as the iterator object when the
657
+ // @@iterator function is called on it. Some browsers' implementations of the
658
+ // iterator prototype chain incorrectly implement this, causing the Generator
659
+ // object to not be returned from this call. This ensures that doesn't happen.
660
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
661
+ Gp[iteratorSymbol] = function() {
662
+ return this;
663
+ };
664
+
665
+ Gp.toString = function() {
666
+ return "[object Generator]";
667
+ };
668
+
669
+ function pushTryEntry(locs) {
670
+ var entry = { tryLoc: locs[0] };
671
+
672
+ if (1 in locs) {
673
+ entry.catchLoc = locs[1];
674
+ }
675
+
676
+ if (2 in locs) {
677
+ entry.finallyLoc = locs[2];
678
+ entry.afterLoc = locs[3];
679
+ }
680
+
681
+ this.tryEntries.push(entry);
682
+ }
683
+
684
+ function resetTryEntry(entry) {
685
+ var record = entry.completion || {};
686
+ record.type = "normal";
687
+ delete record.arg;
688
+ entry.completion = record;
689
+ }
690
+
691
+ function Context(tryLocsList) {
692
+ // The root entry object (effectively a try statement without a catch
693
+ // or a finally block) gives us a place to store values thrown from
694
+ // locations where there is no enclosing try statement.
695
+ this.tryEntries = [{ tryLoc: "root" }];
696
+ tryLocsList.forEach(pushTryEntry, this);
697
+ this.reset(true);
698
+ }
699
+
700
+ exports.keys = function(object) {
701
+ var keys = [];
702
+ for (var key in object) {
703
+ keys.push(key);
704
+ }
705
+ keys.reverse();
706
+
707
+ // Rather than returning an object with a next method, we keep
708
+ // things simple and return the next function itself.
709
+ return function next() {
710
+ while (keys.length) {
711
+ var key = keys.pop();
712
+ if (key in object) {
713
+ next.value = key;
714
+ next.done = false;
715
+ return next;
716
+ }
717
+ }
718
+
719
+ // To avoid creating an additional object, we just hang the .value
720
+ // and .done properties off the next function object itself. This
721
+ // also ensures that the minifier will not anonymize the function.
722
+ next.done = true;
723
+ return next;
724
+ };
725
+ };
726
+
727
+ function values(iterable) {
728
+ if (iterable) {
729
+ var iteratorMethod = iterable[iteratorSymbol];
730
+ if (iteratorMethod) {
731
+ return iteratorMethod.call(iterable);
732
+ }
733
+
734
+ if (typeof iterable.next === "function") {
735
+ return iterable;
736
+ }
737
+
738
+ if (!isNaN(iterable.length)) {
739
+ var i = -1, next = function next() {
740
+ while (++i < iterable.length) {
741
+ if (hasOwn.call(iterable, i)) {
742
+ next.value = iterable[i];
743
+ next.done = false;
744
+ return next;
745
+ }
746
+ }
747
+
748
+ next.value = undefined;
749
+ next.done = true;
750
+
751
+ return next;
752
+ };
753
+
754
+ return next.next = next;
755
+ }
756
+ }
757
+
758
+ // Return an iterator with no values.
759
+ return { next: doneResult };
760
+ }
761
+ exports.values = values;
762
+
763
+ function doneResult() {
764
+ return { value: undefined, done: true };
765
+ }
766
+
767
+ Context.prototype = {
768
+ constructor: Context,
769
+
770
+ reset: function(skipTempReset) {
771
+ this.prev = 0;
772
+ this.next = 0;
773
+ // Resetting context._sent for legacy support of Babel's
774
+ // function.sent implementation.
775
+ this.sent = this._sent = undefined;
776
+ this.done = false;
777
+ this.delegate = null;
778
+
779
+ this.method = "next";
780
+ this.arg = undefined;
781
+
782
+ this.tryEntries.forEach(resetTryEntry);
783
+
784
+ if (!skipTempReset) {
785
+ for (var name in this) {
786
+ // Not sure about the optimal order of these conditions:
787
+ if (name.charAt(0) === "t" &&
788
+ hasOwn.call(this, name) &&
789
+ !isNaN(+name.slice(1))) {
790
+ this[name] = undefined;
791
+ }
792
+ }
793
+ }
794
+ },
795
+
796
+ stop: function() {
797
+ this.done = true;
798
+
799
+ var rootEntry = this.tryEntries[0];
800
+ var rootRecord = rootEntry.completion;
801
+ if (rootRecord.type === "throw") {
802
+ throw rootRecord.arg;
803
+ }
804
+
805
+ return this.rval;
806
+ },
807
+
808
+ dispatchException: function(exception) {
809
+ if (this.done) {
810
+ throw exception;
811
+ }
812
+
813
+ var context = this;
814
+ function handle(loc, caught) {
815
+ record.type = "throw";
816
+ record.arg = exception;
817
+ context.next = loc;
818
+
819
+ if (caught) {
820
+ // If the dispatched exception was caught by a catch block,
821
+ // then let that catch block handle the exception normally.
822
+ context.method = "next";
823
+ context.arg = undefined;
824
+ }
825
+
826
+ return !! caught;
827
+ }
828
+
829
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
830
+ var entry = this.tryEntries[i];
831
+ var record = entry.completion;
832
+
833
+ if (entry.tryLoc === "root") {
834
+ // Exception thrown outside of any try block that could handle
835
+ // it, so set the completion value of the entire function to
836
+ // throw the exception.
837
+ return handle("end");
838
+ }
839
+
840
+ if (entry.tryLoc <= this.prev) {
841
+ var hasCatch = hasOwn.call(entry, "catchLoc");
842
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
843
+
844
+ if (hasCatch && hasFinally) {
845
+ if (this.prev < entry.catchLoc) {
846
+ return handle(entry.catchLoc, true);
847
+ } else if (this.prev < entry.finallyLoc) {
848
+ return handle(entry.finallyLoc);
849
+ }
850
+
851
+ } else if (hasCatch) {
852
+ if (this.prev < entry.catchLoc) {
853
+ return handle(entry.catchLoc, true);
854
+ }
855
+
856
+ } else if (hasFinally) {
857
+ if (this.prev < entry.finallyLoc) {
858
+ return handle(entry.finallyLoc);
859
+ }
860
+
861
+ } else {
862
+ throw new Error("try statement without catch or finally");
863
+ }
864
+ }
865
+ }
866
+ },
867
+
868
+ abrupt: function(type, arg) {
869
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
870
+ var entry = this.tryEntries[i];
871
+ if (entry.tryLoc <= this.prev &&
872
+ hasOwn.call(entry, "finallyLoc") &&
873
+ this.prev < entry.finallyLoc) {
874
+ var finallyEntry = entry;
875
+ break;
876
+ }
877
+ }
878
+
879
+ if (finallyEntry &&
880
+ (type === "break" ||
881
+ type === "continue") &&
882
+ finallyEntry.tryLoc <= arg &&
883
+ arg <= finallyEntry.finallyLoc) {
884
+ // Ignore the finally entry if control is not jumping to a
885
+ // location outside the try/catch block.
886
+ finallyEntry = null;
887
+ }
888
+
889
+ var record = finallyEntry ? finallyEntry.completion : {};
890
+ record.type = type;
891
+ record.arg = arg;
892
+
893
+ if (finallyEntry) {
894
+ this.method = "next";
895
+ this.next = finallyEntry.finallyLoc;
896
+ return ContinueSentinel;
897
+ }
898
+
899
+ return this.complete(record);
900
+ },
901
+
902
+ complete: function(record, afterLoc) {
903
+ if (record.type === "throw") {
904
+ throw record.arg;
905
+ }
906
+
907
+ if (record.type === "break" ||
908
+ record.type === "continue") {
909
+ this.next = record.arg;
910
+ } else if (record.type === "return") {
911
+ this.rval = this.arg = record.arg;
912
+ this.method = "return";
913
+ this.next = "end";
914
+ } else if (record.type === "normal" && afterLoc) {
915
+ this.next = afterLoc;
916
+ }
917
+
918
+ return ContinueSentinel;
919
+ },
920
+
921
+ finish: function(finallyLoc) {
922
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
923
+ var entry = this.tryEntries[i];
924
+ if (entry.finallyLoc === finallyLoc) {
925
+ this.complete(entry.completion, entry.afterLoc);
926
+ resetTryEntry(entry);
927
+ return ContinueSentinel;
928
+ }
929
+ }
930
+ },
931
+
932
+ "catch": function(tryLoc) {
933
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
934
+ var entry = this.tryEntries[i];
935
+ if (entry.tryLoc === tryLoc) {
936
+ var record = entry.completion;
937
+ if (record.type === "throw") {
938
+ var thrown = record.arg;
939
+ resetTryEntry(entry);
940
+ }
941
+ return thrown;
942
+ }
943
+ }
944
+
945
+ // The context.catch method must only be called with a location
946
+ // argument that corresponds to a known catch block.
947
+ throw new Error("illegal catch attempt");
948
+ },
949
+
950
+ delegateYield: function(iterable, resultName, nextLoc) {
951
+ this.delegate = {
952
+ iterator: values(iterable),
953
+ resultName: resultName,
954
+ nextLoc: nextLoc
955
+ };
956
+
957
+ if (this.method === "next") {
958
+ // Deliberately forget the last sent value so that we don't
959
+ // accidentally pass it on to the delegate.
960
+ this.arg = undefined;
961
+ }
962
+
963
+ return ContinueSentinel;
964
+ }
965
+ };
966
+
967
+ // Regardless of whether this script is executing as a CommonJS module
968
+ // or not, return the runtime object so that we can declare the variable
969
+ // regeneratorRuntime in the outer scope, which allows this module to be
970
+ // injected easily by `bin/regenerator --include-runtime script.js`.
971
+ return exports;
972
+
973
+ }(
974
+ // If this script is executing as a CommonJS module, use module.exports
975
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
976
+ // object. Either way, the resulting object will be used to initialize
977
+ // the regeneratorRuntime variable at the top of this file.
978
+ true ? module.exports : 0
979
+ ));
980
+
981
+ try {
982
+ regeneratorRuntime = runtime;
983
+ } catch (accidentalStrictMode) {
984
+ // This module should not be running in strict mode, so the above
985
+ // assignment should always work unless something is misconfigured. Just
986
+ // in case runtime.js accidentally runs in strict mode, we can escape
987
+ // strict mode using a global Function call. This could conceivably fail
988
+ // if a Content Security Policy forbids using Function, but in that case
989
+ // the proper solution is to fix the accidental strict mode problem. If
990
+ // you've misconfigured your bundler to force strict mode and applied a
991
+ // CSP to forbid Function, and you're not willing to fix either of those
992
+ // problems, please detail your unique predicament in a GitHub issue.
993
+ Function("r", "regeneratorRuntime = r")(runtime);
994
+ }
995
+
996
+
997
+ /***/ }),
998
+
999
+ /***/ "redux":
1000
+ /*!*********************************************************!*\
1001
+ !*** external {"commonjs":"redux","commonjs2":"redux"} ***!
1002
+ \*********************************************************/
1003
+ /***/ ((module) => {
1004
+
1005
+ "use strict";
1006
+ module.exports = __WEBPACK_EXTERNAL_MODULE_redux__;
1007
+
1008
+ /***/ })
1009
+
1010
+ /******/ });
1011
+ /************************************************************************/
1012
+ /******/ // The module cache
1013
+ /******/ var __webpack_module_cache__ = {};
1014
+ /******/
1015
+ /******/ // The require function
1016
+ /******/ function __webpack_require__(moduleId) {
1017
+ /******/ // Check if module is in cache
1018
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
1019
+ /******/ if (cachedModule !== undefined) {
1020
+ /******/ return cachedModule.exports;
1021
+ /******/ }
1022
+ /******/ // Create a new module (and put it into the cache)
1023
+ /******/ var module = __webpack_module_cache__[moduleId] = {
1024
+ /******/ // no module.id needed
1025
+ /******/ // no module.loaded needed
1026
+ /******/ exports: {}
1027
+ /******/ };
1028
+ /******/
1029
+ /******/ // Execute the module function
1030
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
1031
+ /******/
1032
+ /******/ // Return the exports of the module
1033
+ /******/ return module.exports;
1034
+ /******/ }
1035
+ /******/
1036
+ /************************************************************************/
1037
+ /******/ /* webpack/runtime/compat get default export */
1038
+ /******/ (() => {
1039
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
1040
+ /******/ __webpack_require__.n = (module) => {
1041
+ /******/ var getter = module && module.__esModule ?
1042
+ /******/ () => (module['default']) :
1043
+ /******/ () => (module);
1044
+ /******/ __webpack_require__.d(getter, { a: getter });
1045
+ /******/ return getter;
1046
+ /******/ };
1047
+ /******/ })();
1048
+ /******/
1049
+ /******/ /* webpack/runtime/define property getters */
1050
+ /******/ (() => {
1051
+ /******/ // define getter functions for harmony exports
1052
+ /******/ __webpack_require__.d = (exports, definition) => {
1053
+ /******/ for(var key in definition) {
1054
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
1055
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
1056
+ /******/ }
1057
+ /******/ }
1058
+ /******/ };
1059
+ /******/ })();
1060
+ /******/
1061
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
1062
+ /******/ (() => {
1063
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
1064
+ /******/ })();
1065
+ /******/
1066
+ /******/ /* webpack/runtime/make namespace object */
1067
+ /******/ (() => {
1068
+ /******/ // define __esModule on exports
1069
+ /******/ __webpack_require__.r = (exports) => {
1070
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1071
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1072
+ /******/ }
1073
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
1074
+ /******/ };
1075
+ /******/ })();
1076
+ /******/
1077
+ /************************************************************************/
1078
+ var __webpack_exports__ = {};
1079
+ // This entry need to be wrapped in an IIFE because it need to be in strict mode.
1080
+ (() => {
1081
+ "use strict";
1082
+ /*!****************************************************!*\
1083
+ !*** ./src/core/MeganavBlogPostsList/component.js ***!
1084
+ \****************************************************/
1085
+ __webpack_require__.r(__webpack_exports__);
1086
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1087
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1088
+ /* harmony export */ });
1089
+ /* harmony import */ var _dom_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../dom-query */ "./src/core/dom-query.js");
1090
+ /* harmony import */ var _remote_blogs_posts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../remote-blogs-posts */ "./src/core/remote-blogs-posts.js");
1091
+ /* harmony import */ var _remote_data_store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../remote-data-store */ "./src/core/remote-data-store.js");
1092
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1093
+
1094
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1095
+
1096
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1097
+
1098
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1099
+
1100
+ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
1101
+
1102
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1103
+
1104
+
1105
+
1106
+
1107
+
1108
+ var template = function template(_ref) {
1109
+ var link = _ref.link,
1110
+ title = _ref.title,
1111
+ pubDate = _ref.pubDate;
1112
+
1113
+ var _map = ["li", "a", "p", "p"].map(function (el) {
1114
+ return document.createElement(el);
1115
+ }),
1116
+ _map2 = _slicedToArray(_map, 4),
1117
+ li = _map2[0],
1118
+ a = _map2[1],
1119
+ heading = _map2[2],
1120
+ copy = _map2[3];
1121
+
1122
+ a.href = link;
1123
+ a.classList.add("ui-meganav-media", "group");
1124
+ heading.textContent = title;
1125
+ heading.classList.add("ui-meganav-media-heading");
1126
+ copy.textContent = pubDate;
1127
+ copy.classList.add("ui-meganav-media-copy");
1128
+ a.appendChild(heading);
1129
+ a.appendChild(copy);
1130
+ li.appendChild(a);
1131
+ return li;
1132
+ };
1133
+
1134
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (function () {
1135
+ (0,_remote_data_store__WEBPACK_IMPORTED_MODULE_2__.connectState)(_remote_blogs_posts__WEBPACK_IMPORTED_MODULE_1__.selectRecentBlogPosts, function (recentBlogPosts) {
1136
+ if (Array.isArray(recentBlogPosts) && recentBlogPosts.length > 0) {
1137
+ var sections = (0,_dom_query__WEBPACK_IMPORTED_MODULE_0__.queryIdAll)("meganav-company-panel-blog-section");
1138
+ var containers = (0,_dom_query__WEBPACK_IMPORTED_MODULE_0__.queryIdAll)("meganav-company-panel-recent-blog-posts");
1139
+ Array.from(containers).forEach(function (container) {
1140
+ var fragment = document.createDocumentFragment();
1141
+ recentBlogPosts.forEach(function (post) {
1142
+ return fragment.appendChild(template(post));
1143
+ });
1144
+ container.appendChild(fragment);
1145
+ });
1146
+ Array.from(sections).forEach(function (section) {
1147
+ return section.classList.remove("hidden");
1148
+ });
1149
+ }
1150
+ });
1151
+ });
1152
+ })();
1153
+
1154
+ __webpack_exports__ = __webpack_exports__["default"];
1155
+ /******/ return __webpack_exports__;
1156
+ /******/ })()
1157
+ ;
1158
+ });
1159
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29yZS9NZWdhbmF2QmxvZ1Bvc3RzTGlzdC9jb21wb25lbnQuanMiLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLHVDQUF1Qyx1REFBdUQ7QUFDOUYsQ0FBQztBQUNELE87Ozs7Ozs7OztBQ1ZBLGdIQUErQzs7Ozs7Ozs7Ozs7Ozs7Ozs7QUNBeEMsSUFBTUEsT0FBTyxHQUFHLFNBQVZBLE9BQVUsQ0FBQ0MsR0FBRDtBQUFBLE1BQU1DLElBQU4sdUVBQWFDLFFBQWI7QUFBQSxTQUNyQkQsSUFBSSxDQUFDRSxhQUFMLG9CQUErQkgsR0FBL0IsT0FEcUI7QUFBQSxDQUFoQjtBQUdBLElBQU1JLFVBQVUsR0FBRyxTQUFiQSxVQUFhLENBQUNKLEdBQUQ7QUFBQSxNQUFNQyxJQUFOLHVFQUFhQyxRQUFiO0FBQUEsU0FDeEJELElBQUksQ0FBQ0ksZ0JBQUwsb0JBQWtDTCxHQUFsQyxPQUR3QjtBQUFBLENBQW5COzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7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GVDb21wbGV0ZWRcbiAgICAgICAgICAgIDogR2VuU3RhdGVTdXNwZW5kZWRZaWVsZDtcblxuICAgICAgICAgIGlmIChyZWNvcmQuYXJnID09PSBDb250aW51ZVNlbnRpbmVsKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdmFsdWU6IHJlY29yZC5hcmcsXG4gICAgICAgICAgICBkb25lOiBjb250ZXh0LmRvbmVcbiAgICAgICAgICB9O1xuXG4gICAgICAgIH0gZWxzZSBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgIHN0YXRlID0gR2VuU3RhdGVDb21wbGV0ZWQ7XG4gICAgICAgICAgLy8gRGlzcGF0Y2ggdGhlIGV4Y2VwdGlvbiBieSBsb29waW5nIGJhY2sgYXJvdW5kIHRvIHRoZVxuICAgICAgICAgIC8vIGNvbnRleHQuZGlzcGF0Y2hFeGNlcHRpb24oY29udGV4dC5hcmcpIGNhbGwgYWJvdmUuXG4gICAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgICAgY29udGV4dC5hcmcgPSByZWNvcmQuYXJnO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfTtcbiAgfVxuXG4gIC8vIENhbGwgZGVsZWdhdGUuaXRlcmF0b3JbY29udGV4dC5tZXRob2RdKGNvbnRleHQuYXJnKSBhbmQgaGFuZGxlIHRoZVxuICAvLyByZXN1bHQsIGVpdGhlciBieSByZXR1cm5pbmcgYSB7IHZhbHVlLCBkb25lIH0gcmVzdWx0IGZyb20gdGhlXG4gIC8vIGRlbGVnYXRlIGl0ZXJhdG9yLCBvciBieSBtb2RpZnlpbmcgY29udGV4dC5tZXRob2QgYW5kIGNvbnRleHQuYXJnLFxuICAvLyBzZXR0aW5nIGNvbnRleHQuZGVsZWdhdGUgdG8gbnVsbCwgYW5kIHJldHVybmluZyB0aGUgQ29ud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b21cbiAgICAgICAgICAgIC8vIFwicmV0dXJuXCIgdG8gXCJ0aHJvd1wiLCBsZXQgdGhhdCBvdmVycmlkZSB0aGUgVHlwZUVycm9yIGJlbG93LlxuICAgICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgIGNvbnRleHQuYXJnID0gbmV3IFR5cGVFcnJvcihcbiAgICAgICAgICBcIlRoZSBpdGVyYXRvciBkb2VzIG5vdCBwcm92aWRlIGEgJ3Rocm93JyBtZXRob2RcIik7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciByZWNvcmQgPSB0cnlDYXRjaChtZXRob2QsIGRlbGVnYXRlLml0ZXJhdG9yLCBjb250ZXh0LmFyZyk7XG5cbiAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICBjb250ZXh0LmFyZyA9IHJlY29yZC5hcmc7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciBpbmZvID0gcmVjb3JkLmFyZztcblxuICAgIGlmICghIGluZm8pIHtcbiAgICAgIGNvbnRleHQubWV0aG9kID0gXCJ0aHJvd1wiO1xuICAgICAgY29udGV4dC5hcmcgPSBuZXcgVHlwZUVycm9yKFwiaXRlcmF0b3IgcmVzdWx0IGlzIG5vdCBhbiBvYmplY3RcIik7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIGlmIChpbmZvLmRvbmUpIHtcbiAgICAgIC8vIEFzc2lnb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hlc2UgY29uZGl0aW9uczpcbiAgICAgICAgICBpZiAobmFtZS5jaGFyQXQoMCkgPT09IFwidFwiICYmXG4gICAgICAgICAgICAgIGhhc093bi5jYWxsKHRoaXMsIG5hbWUpICYmXG4gICAgICAgICAgICAgICFpc05hTigrbmFtZS5zbGljZSgxKSkpIHtcbiAgICAgICAgICAgIHRoaXNbbmFtZV0gPSB1bmRlZmluZWQ7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcblxuICAgIHN0b3A6IGZ1bmN0aW9uKCkge1xuICAgICAgdGhpcy5kb25lID0gdHJ1ZTtcblxuICAgICAgdmFyIHJvb3RFbnRyeSA9IHRoaXMudHJ5RW50cmllc1swXTtcbiAgICAgIHZhciByb290UmVjb3JkID0gcm9vdEVudHJ5LmNvbXBsZXRpb247XG4gICAgICBpZiAocm9vdFJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgdGhyb3cgcm9vdFJlY29yZC5hcmc7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiB0aGlzLnJ2YWw7XG4gICAgfSxcblxuICAgIGRpc3BhdGNoRXhjZXB0aW9uOiBmdW5jdGlvbihleGNlcHRpb24pIHtcbiAgICAgIGlmICh0aGlzLmRvbmUpIHtcbiAgICAgICAgdGhyb3cgZXhjZXB0aW9uO1xuICAgICAgfVxuXG4gICAgICB2YXIgY29udGV4dCA9IHRoaXM7XG4gICAgICBmdW5jdGlvbiBoYW5kbGUobG9jLCBjYXVnaHQpIHtcbiAgICAgICAgcmVjb3JkLnR5cGUgPSBcInRocm93XCI7XG4gICAgICAgIHJlY29yZC5hcmcgPSBleGNlcHRpb247XG4gICAgICAgIGNvbnRleHQubmV4dCA9IGxvYztcblxuICAgICAgICBpZiAoY2F1Z2h0KSB7XG4gICAgICAgICAgLy8gSWYgdGhlIGRpc3BhdGNoZWQgZXhjZXB0aW9uIHdhcyBjYXVnaHQgYnkgYSBjYXRjaCBibG9jayxcbiAgICAgIC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nByZXYgPCBlbnRyeS5jYXRjaExvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmNhdGNoTG9jLCB0cnVlKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodGhpcy5wcmV2IDwgZW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmZpbmFsbHlMb2MpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIGlmIChoYXNDYXRjaCkge1xuICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGVudHJ5LmNhdGNoTG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuY2F0Y2hMb2MsIHRydWUpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIGlmIChoYXNGaW5hbGx5KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmZpbmFsbHlMb2MpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcInRyeSBzdGF0ZW1lbnQgd2l0aG91dCBjYXRjaCBvciBmaW5hbGx5XCIpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG5cbiAgICBhYnJ1cHQ6IGZ1bmN0aW9uKHR5cGUsIGFyZykge1xuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIGlmIChlbnRyeS50cnlMb2MgPD0gdGhpcy5wcmV2ICYmXG4gICAgICAgICAgICBoYXNPd24uY2FsbChlbnRyeSwgXCJmaW5hbGx5TG9jXCIpICYmXG4gICAgICAgICAgICB0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgdmFyIGZpbmFsbHlFbnRyeSA9IGVudHJ5O1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIGlmIChmaW5hbGx5RW50cnkgJiZcbiAgICAgICAgICAodHlwZSA9PT0gXCJicmVha1wiIHx8XG4gICAgICAgICAgIHR5cGUgPT09IFwiY29udGludWVcIikgJiZcbiAgICAgICAgICBmaW5hbGx5RW50cnkudHJ5TG9jIDw9IGFyZyAmJlxuICAgICAgICAgIGFyZyA8PSBmaW5hbGx5RW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAvLyBJZ25vcmUgdGhlIGZpbmFsbHkgZW50cnkgaWYgY29udHJvbCBpcyBub3QganVtcGluZyB0byBhXG4gICAgICAgIC8vIGxvY2F0aW9uIG91dHNpZGUgdGhlIHRyeS9jYXRjaCBibG9jay5cbiAgICAgICAgZmluYWxseUVudHJ5ID0gbnVsbDtcbiAgICAgIH1cblxuICAgICAgdmFyIHJlY29yZCA9IGZpbmFsbHlFbnRyeSA/IGZpbmFsbHlFbnRyeS5jb21wbGV0aW9uIDoge307XG4gICAgICByZWNvcmQudHlwZSA9IHR5cGU7XG4gICAgICByZWNvcmQuYXJnID0gYXJnO1xuXG4gICAgICBpZiAoZmluYWxseUVudHJ5KSB7XG4gICAgICAgIHRoaXMubWV0aG9kID0gXCJuZXh0XCI7XG4gICAgICAgIHRoaXMubmV4dCA9IGZpbmFsbHlFbnRyeS5maW5hbGx5TG9jO1xuICAgICAgICByZXR1cm4gQ29udGludWVTZW50aW5lbDtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHRoaXMuY29tcGxldGUocmVjb3JkKTtcbiAgICB9LFxuXG4gICAgY29tcGxldGU6IGZ1bmN0aW9uKHJlY29yZCwgYWZ0ZXJMb2MpIHtcbiAgICAgIGlmIChyZWNvcmQudH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