!function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t,r,n,o,u,a){try{var i=e[u](a),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(n,o)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(o,u){var a=e.apply(t,n);function i(e){r(a,o,u,i,c,"next",e)}function c(e){r(a,o,u,i,c,"throw",e)}i(void 0)}))}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],_n=!0,n=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(_n=(u=a.next()).done)&&(r.push(u.value),!t||r.length!==t);_n=!0);}catch(e){n=!0,o=e}finally{try{_n||null==a.return||a.return()}finally{if(n)throw o}}return r}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e,t)||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.")}()}e.r(t),e.d(t,{onSubKey:function(){return y},useApiFetch:function(){return p}});var a=window.regeneratorRuntime,i=e.n(a),c=window.React,f=window.wp.apiFetch,s=e.n(f),l=function(e){return e.json?e.json():Promise.reject(e)},p=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=(0,c.useState)(),a=u(o,2),f=a[0],p=a[1],d=(0,c.useState)({}),v=u(d,2),b=v[0],y=v[1],h=(0,c.useState)(),g=u(h,2),w=g[0],O=g[1];return(0,c.useEffect)((function(){var o=function(){var t=n(i().mark((function t(){var n,o,u,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r.fetchHeaders){t.next=11;break}return t.next=3,s()({path:e,parse:!1});case 3:return n=t.sent,(o={}).totalPages=parseInt(n.headers.get("X-WP-TotalPages"),10),o.total=parseInt(n.headers.get("X-WP-Total"),10),t.next=9,l(n);case 9:return u=t.sent,t.abrupt("return",{response:u,responseHeaders:o});case 11:return t.next=13,s()({path:e});case 13:return a=t.sent,t.abrupt("return",{response:a});case 15:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();(f||w)&&(O(void 0),p(void 0));var u=t=o().then((function(e){var n=e.response,o=e.responseHeaders;u===t&&(r.callback&&r.callback(n),y(o),p(n))})).catch((function(e){O(e)}));return function(){t=void 0}}),[e]),r.fetchHeaders?[f,b,w]:[f,w]};function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var y=function(e){return function(t){return function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,o=n[e];if(void 0===o)return r;var u=t(r[o],n);return u===r[o]?r:b(b({},r),{},d({},o,u))}}};(window.nisje=window.nisje||{}).data=t}();