wjec-one 3.9.4 → 3.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom/server"),require("immutable")):"function"==typeof define&&define.amd?define(["exports","react","react-dom/server","immutable"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WJECOne={},e.React,e.server,e.immutable)}(this,(function(e,t,r,n){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(t);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(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 c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(r,!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e))&&"[object Arguments]"!==Object.prototype.toString.call(e))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function f(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var d=["January","February","March","April","May","June","July","August","September","October","November","December"],p="dd/MM/yyyy",m="HH:mm",v=function(e){var t=e.date,r=e.format,n=void 0===r?p:r,o=t.getDate(),a=t.getMonth()+1,i=t.getFullYear().toString();return n.replace(/dd/,o.toString().padStart(2,"0")).replace(/d/,o.toString()).replace(/MMM/,d[a-1].substr(0,3)).replace(/MM/,a.toString().padStart(2,"0")).replace(/M/,a.toString()).replace(/yyyy/,i).replace(/yy/,i.substr(2))},y=function(e){var t=e.date,r=e.format,n=void 0===r?m:r,o=e.meridianStrings,a=void 0===o?{am:"am",pm:"pm"}:o,i=/h{1,2}/.test(n),u=i?t.getHours()%12||12:t.getHours();return n.replace(/HH/i,u.toString().padStart(2,"0")).replace(/H/i,u.toString()).replace(/mm/,t.getMinutes().toString().padStart(2,"0")).replace(/SS/,t.getSeconds().toString().padStart(2,"0")).replace(/AM/,i?t.getHours()<12?a.am:a.pm:"")},g=function(e){return new Date(new Date(e).setHours(0,0,0,0))},b=function(e){return"function"==typeof e},h=function(e){console.error(e)},S=function(e){console.warn(e)},O=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"production"!==process.env.NODE_ENV&&t&&h(e)},w=function(e){return"[object Object]"===Object.prototype.toString.call(e)},D=function(e){var t=[];return{addListener:function(r){if(!function(e){return t.find((function(t){return t.listener===e}))}(r)){var n=function(e){return r(e.data)};t.push({listener:r,remove:function(){return e.removeEventListener("message",n)}}),e.addEventListener("message",n)}},removeListener:function(e){var r=t.findIndex((function(t){return t.listener===e})),n=t.splice(r,1)[0];n&&n.remove()}}};e.DAYS=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],e.MONTHS=d,e.assertNever=function(e){throw new Error("Unexpected object: ".concat(e))},e.createWebWorker=function(e){return e(c({},D(self),{postMessage:function(e){return self.postMessage(e,void 0)}})),{path:""}},e.debounce=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];self.clearTimeout(t),t=self.setTimeout((function(){e.apply(void 0,o)}),r)}},e.decrementDate=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.amount,n=void 0===r?1:r,o=t.unit,a=void 0===o?"day":o,i=new Date(e);return"year"===a?i.setFullYear(e.getFullYear()-n):"month"===a?i.setMonth(e.getMonth()-n):i.setDate(e.getDate()-n),i},e.developerError=O,e.developerWarning=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"production"!==process.env.NODE_ENV&&t&&S(e)},e.filterValidEntries=function(e){return e.filter((function(e){return e&&null!=e}))},e.formatDate=v,e.formatDateTime=function(e){var t=e.date,r=e.format,n=void 0===r?"".concat(p," ").concat(m):r,o=l(e,["date","format"]),a=y(c({},o,{date:t,format:n}));return v(c({},o,{date:t,format:a}))},e.formatTime=y,e.formattedStringToPlainText=function(e){var t=[];return function e(r){var n;n=r,a.default.isValidElement(n)?a.default.Children.forEach(r.props.children,e):t.push(r.toString())}(e),t.join("")},e.getDateAtStartOfDay=g,e.getDateAtStartOfMonth=function(e){return g(new Date(new Date(e).setDate(1)))},e.getEnumKeyByValue=function(e,t){return Object.keys(e).find((function(r){return e[r]===t}))},e.getNumberOfDaysForMonth=function(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()},e.incrementDate=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.amount,n=void 0===r?1:r,o=t.unit,a=void 0===o?"day":o,i=new Date(e);return"year"===a?i.setFullYear(e.getFullYear()+n):"month"===a?i.setMonth(e.getMonth()+n):i.setDate(e.getDate()+n),i},e.initialiseWebWorker=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new Worker(e),n=D(r);return t.onError&&"function"==typeof t.onError&&(r.onerror=t.onError),c({},n,{postMessage:function(e){return r.postMessage(e,void 0)},terminate:r.terminate})},e.isArrayEqual=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.length===t.length&&e.every((function(e,n){return r?t[n]===e:t.includes(e)}))},e.isCallableFunction=b,e.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},e.isPlainObject=w,e.parseDateString=function(e){var t,r,n,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=a.format,u=a.shorthand,c=void 0===u||u,l=e&&e.trim(),f="UK"===i||!i&&(c?/^(0|1|2|3)?[0-9]\/(0|1)?[0-9]\/\d{2,4}$/.test(l):/^(0|1|2|3)[0-9]\/(0|1)[0-9]\/\d{4}$/.test(l)),d="US"===i||!i&&(c?/^(0|1)?[0-9]\/(0|1|2|3)?[0-9]\/\d{2,4}$/.test(l):/^(0|1)[0-9]\/(0|1|2|3)[0-9]\/\d{4}$/.test(l)),p=f?"dd/MM/yyyy":"MM/dd/yyyy";if(f){var m=l.split("/").map((function(e){return parseInt(e)})),y=s(m,3);r=y[0],n=y[1],o=y[2]}else if(d){var g=l.split("/").map((function(e){return parseInt(e)})),b=s(g,3);n=b[0],r=b[1],o=b[2]}if(r&&n&&o&&[2,4].includes(o.toString().length)){if(2===o.toString().length){var h=(new Date).getFullYear(),S=100*Math.floor(h/100),O=h-S;o=O<25&&o>49?S-100+o:O>75&&o<50?S+100+o:S+o}t=new Date(o,n-1,r)}var w=p.replace("dd",r&&r.toString().padStart(2,"0")).replace("MM",n&&n.toString().padStart(2,"0")).replace("yyyy",o&&o.toString());return t&&v({date:t,format:p})===w?t:void 0},e.parseTimeString=function(e){var t=s(e&&e.trim().match(/(\d+):(\d+)\s{0,}(am|pm)?/i),4),r=(t[0],t[1]),n=t[2],o=t[3],a=void 0!==o;return{hour:parseInt(r)%(a?12:24),meridian:o?o.toLowerCase():void 0,minute:parseInt(n)}},e.saveBlobAsFile=function(e,t){if(self.navigator&&self.navigator.msSaveBlob)self.navigator.msSaveBlob(e,t);else{var r=document.createElement("a"),n=URL.createObjectURL(e);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}},e.setInSafely=function(e,t,r){return t.slice(0,t.length).reduce((function(e,o,a){var i=s(e,2),u=i[0],c=i[1],l=[].concat(f(c),[o]);return a===t.length-1?u.setIn(l,r):u.getIn(l)?[u,l]:[u.setIn(l,n.Map([])),l]}),[e,[]])},e.smoothScroll=function(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.duration,o=void 0===n?500:n,a=r.element,i=void 0===a?document.documentElement:a,u=r.left,c=void 0===u?0:u,l=r.top,s=void 0===l?0:l,f=i===document.documentElement?window:i,d=c-i.scrollLeft,p=s-i.scrollTop,m=function r(n){var a=n-t,i=d*(a/o),u=p*(a/o);e||(e=n),n-e>=o?f.scrollTo(c,s):(f.scrollBy(i,u),t=n,requestAnimationFrame(r))};0===d&&0===p||requestAnimationFrame(m)},e.stripKeys=function e(t,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t;return w(t)&&(r.forEach((function(e){delete o[e]})),n&&(o=Object.keys(o).reduce((function(t,n){return c({},t,i({},n,e(o[n],r)))}),{}))),Array.isArray(t)&&(o=t.map((function(t){return e(t,r,n)}))),o},e.svgComponentToDataURL=function(e){if(t=e,n=r.renderToStaticMarkup(t),!/^<svg(.*)<\/svg>$/i.test(n))throw new Error("Only a component that returns SVG markup can be converted to a dataURL");var t,n;return"url('data:image/svg+xml,".concat(encodeURIComponent(r.renderToStaticMarkup(e)),"')")},e.throttle=function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:500},o=n.beforeDelay,a=n.limit,i=void 0===a?500:a;return function(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];r?(self.clearTimeout(t),b(o)&&o.apply(void 0,a),t=self.setTimeout((function(){Date.now()-r>=i&&(e.apply(void 0,a),r=Date.now())}),i-(Date.now()-r))):(e.apply(void 0,a),r=Date.now())}},e.transparentize=function(e,t){var r="#"===e.charAt(0),n="rgb"===e.substr(0,3);if(!r&&!n||!("number"==typeof t&&t>=0&&t<=1))return O("\n StyleUtils.transparentize only supports colors in hexadecimal or rgb(a) format.\n The desired transparency must be a value between 0 and 1\n "),e;var o,a=t;r?o=(e.length>6?e.substr(1).match(/.{1,2}/g):e.substr(1).match(/./g)).map((function(e){return parseInt("".concat(e).concat(1===e.length?e:""),16)})):o=e.match(/\d+(\.?\d+)?/g).map(parseFloat);if(void 0!==o[3]){var i=n?o[3]:o[3]/255;a=i-i*t}return"rgba(".concat(o.slice(0,3).join(","),",").concat(Math.round(100*a)/100,")")},Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom/server"),require("immutable")):"function"==typeof define&&define.amd?define(["exports","react","react-dom/server","immutable"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WJECOne={},e.React,e.server,e.immutable)}(this,(function(e,t,r,n){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(t);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(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 c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(r,!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e))&&"[object Arguments]"!==Object.prototype.toString.call(e))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function f(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var d=["January","February","March","April","May","June","July","August","September","October","November","December"],p="dd/MM/yyyy",m="HH:mm",v=function(e){var t=e.date,r=e.format,n=void 0===r?p:r,o=t.getDate(),a=t.getMonth()+1,i=t.getFullYear().toString();return n.replace(/dd/,o.toString().padStart(2,"0")).replace(/d/,o.toString()).replace(/MMM/,d[a-1].substr(0,3)).replace(/MM/,a.toString().padStart(2,"0")).replace(/M/,a.toString()).replace(/yyyy/,i).replace(/yy/,i.substr(2))},y=function(e){var t=e.date,r=e.format,n=void 0===r?m:r,o=e.meridianStrings,a=void 0===o?{am:"am",pm:"pm"}:o,i=/h{1,2}/.test(n),u=i?t.getHours()%12||12:t.getHours();return n.replace(/HH/i,u.toString().padStart(2,"0")).replace(/H/i,u.toString()).replace(/mm/,t.getMinutes().toString().padStart(2,"0")).replace(/SS/,t.getSeconds().toString().padStart(2,"0")).replace(/AM/,i?t.getHours()<12?a.am:a.pm:"")},g=function(e){return new Date(new Date(e).setHours(0,0,0,0))},b=function(e){return"function"==typeof e},h=function(e){console.error(e)},S=function(e){console.warn(e)},O=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"production"!==process.env.NODE_ENV&&t&&h(e)},w=function(e){return"[object Object]"===Object.prototype.toString.call(e)},D=function(e){var t=[];return{addListener:function(r){if(!function(e){return t.find((function(t){return t.listener===e}))}(r)){var n=function(e){return r(e.data)};t.push({listener:r,remove:function(){return e.removeEventListener("message",n)}}),e.addEventListener("message",n)}},removeListener:function(e){var r=t.findIndex((function(t){return t.listener===e})),n=t.splice(r,1)[0];n&&n.remove()}}};e.DAYS=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],e.MONTHS=d,e.assertNever=function(e){throw new Error("Unexpected object: ".concat(e))},e.createWebWorker=function(e){return e(c({},D(self),{postMessage:function(e){return self.postMessage(e,void 0)}})),{path:""}},e.debounce=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];self.clearTimeout(t),t=self.setTimeout((function(){e.apply(void 0,o)}),r)}},e.decrementDate=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.amount,n=void 0===r?1:r,o=t.unit,a=void 0===o?"day":o,i=new Date(e);return"year"===a?i.setFullYear(e.getFullYear()-n):"month"===a?i.setMonth(e.getMonth()-n):i.setDate(e.getDate()-n),i},e.developerError=O,e.developerWarning=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"production"!==process.env.NODE_ENV&&t&&S(e)},e.filterValidEntries=function(e){return e.filter((function(e){return e&&null!=e}))},e.formatDate=v,e.formatDateTime=function(e){var t=e.date,r=e.format,n=void 0===r?"".concat(p," ").concat(m):r,o=l(e,["date","format"]),a=y(c({},o,{date:t,format:n}));return v(c({},o,{date:t,format:a}))},e.formatTime=y,e.formattedStringToPlainText=function(e){var t=[];return function e(r){var n;n=r,a.default.isValidElement(n)?a.default.Children.forEach(r.props.children,e):t.push(r.toString())}(e),t.join("")},e.getDateAtStartOfDay=g,e.getDateAtStartOfMonth=function(e){return g(new Date(new Date(e).setDate(1)))},e.getEnumKeyByValue=function(e,t){return Object.keys(e).find((function(r){return e[r]===t}))},e.getNumberOfDaysForMonth=function(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()},e.incrementDate=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.amount,n=void 0===r?1:r,o=t.unit,a=void 0===o?"day":o,i=new Date(e);return"year"===a?i.setFullYear(e.getFullYear()+n):"month"===a?i.setMonth(e.getMonth()+n):i.setDate(e.getDate()+n),i},e.initialiseWebWorker=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new Worker(e),n=D(r);return t.onError&&"function"==typeof t.onError&&(r.onerror=t.onError),c({},n,{postMessage:function(e){return r.postMessage(e,void 0)},terminate:r.terminate})},e.isArrayEqual=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.length===t.length&&e.every((function(e,n){return r?t[n]===e:t.includes(e)}))},e.isCallableFunction=b,e.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},e.isPlainObject=w,e.parseDateString=function(e){var t,r,n,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=a.format,u=a.shorthand,c=void 0===u||u,l=e&&e.trim(),f="UK"===i||!i&&(c?/^(0|1|2|3)?[0-9]\/(0|1)?[0-9]\/\d{2,4}$/.test(l):/^(0|1|2|3)[0-9]\/(0|1)[0-9]\/\d{4}$/.test(l)),d="US"===i||!i&&(c?/^(0|1)?[0-9]\/(0|1|2|3)?[0-9]\/\d{2,4}$/.test(l):/^(0|1)[0-9]\/(0|1|2|3)[0-9]\/\d{4}$/.test(l)),p=f?"dd/MM/yyyy":"MM/dd/yyyy";if(f){var m=l.split("/").map((function(e){return parseInt(e)})),y=s(m,3);r=y[0],n=y[1],o=y[2]}else if(d){var g=l.split("/").map((function(e){return parseInt(e)})),b=s(g,3);n=b[0],r=b[1],o=b[2]}if(r&&n&&o&&[2,4].includes(o.toString().length)){if(2===o.toString().length){var h=(new Date).getFullYear(),S=100*Math.floor(h/100),O=h-S;o=O<25&&o>49?S-100+o:O>75&&o<50?S+100+o:S+o}t=new Date(o,n-1,r)}var w=p.replace("dd",r&&r.toString().padStart(2,"0")).replace("MM",n&&n.toString().padStart(2,"0")).replace("yyyy",o&&o.toString());return t&&v({date:t,format:p})===w?t:void 0},e.parseTimeString=function(e){var t=s(e&&e.trim().match(/(\d+):(\d+)\s{0,}(am|pm)?/i),4),r=(t[0],t[1]),n=t[2],o=t[3],a=void 0!==o;return{hour:parseInt(r)%(a?12:24),meridian:o?o.toLowerCase():void 0,minute:parseInt(n)}},e.saveBlobAsFile=function(e,t){if(self.navigator&&self.navigator.msSaveBlob)self.navigator.msSaveBlob(e,t);else{var r=document.createElement("a"),n=URL.createObjectURL(e);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}},e.setInSafely=function(e,t,r){return t.slice(0,t.length).reduce((function(e,o,a){var i=s(e,2),u=i[0],c=i[1],l=[].concat(f(c),[o]);return a===t.length-1?[u.setIn(l,r),l]:u.getIn(l)?[u,l]:[u.setIn(l,n.Map([])),l]}),[e,[]])[0]},e.smoothScroll=function(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.duration,o=void 0===n?500:n,a=r.element,i=void 0===a?document.documentElement:a,u=r.left,c=void 0===u?0:u,l=r.top,s=void 0===l?0:l,f=i===document.documentElement?window:i,d=c-i.scrollLeft,p=s-i.scrollTop,m=function r(n){var a=n-t,i=d*(a/o),u=p*(a/o);e||(e=n),n-e>=o?f.scrollTo(c,s):(f.scrollBy(i,u),t=n,requestAnimationFrame(r))};0===d&&0===p||requestAnimationFrame(m)},e.stripKeys=function e(t,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=t;return w(t)&&(r.forEach((function(e){delete o[e]})),n&&(o=Object.keys(o).reduce((function(t,n){return c({},t,i({},n,e(o[n],r)))}),{}))),Array.isArray(t)&&(o=t.map((function(t){return e(t,r,n)}))),o},e.svgComponentToDataURL=function(e){if(t=e,n=r.renderToStaticMarkup(t),!/^<svg(.*)<\/svg>$/i.test(n))throw new Error("Only a component that returns SVG markup can be converted to a dataURL");var t,n;return"url('data:image/svg+xml,".concat(encodeURIComponent(r.renderToStaticMarkup(e)),"')")},e.throttle=function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:500},o=n.beforeDelay,a=n.limit,i=void 0===a?500:a;return function(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];r?(self.clearTimeout(t),b(o)&&o.apply(void 0,a),t=self.setTimeout((function(){Date.now()-r>=i&&(e.apply(void 0,a),r=Date.now())}),i-(Date.now()-r))):(e.apply(void 0,a),r=Date.now())}},e.transparentize=function(e,t){var r="#"===e.charAt(0),n="rgb"===e.substr(0,3);if(!r&&!n||!("number"==typeof t&&t>=0&&t<=1))return O("\n StyleUtils.transparentize only supports colors in hexadecimal or rgb(a) format.\n The desired transparency must be a value between 0 and 1\n "),e;var o,a=t;r?o=(e.length>6?e.substr(1).match(/.{1,2}/g):e.substr(1).match(/./g)).map((function(e){return parseInt("".concat(e).concat(1===e.length?e:""),16)})):o=e.match(/\d+(\.?\d+)?/g).map(parseFloat);if(void 0!==o[3]){var i=n?o[3]:o[3]/255;a=i-i*t}return"rgba(".concat(o.slice(0,3).join(","),",").concat(Math.round(100*a)/100,")")},Object.defineProperty(e,"__esModule",{value:!0})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wjec-one",
3
- "version": "3.9.4",
3
+ "version": "3.9.7",
4
4
  "description": "",
5
5
  "main": "legacy/index.js",
6
6
  "module": "index.js",
package/store/index.d.ts CHANGED
@@ -12,21 +12,23 @@ export declare type SimpleAction = {
12
12
  export interface TypedList<T> extends List<TypeOrListOrTypedMap<T>> {
13
13
  first<NSV>(notSetValue?: NSV): TypeOrListOrTypedMap<T>;
14
14
  last<NSV>(notSetValue?: NSV): TypeOrListOrTypedMap<T>;
15
+ map<M>(mapper: (value: TypeOrListOrTypedMap<T>, key: number, iter: this) => M, context?: unknown): TypedList<M>;
15
16
  push(entry: TypeOrListOrTypedMap<T>): TypedList<T>;
16
17
  push(...entries: Array<TypeOrListOrTypedMap<T>>): TypedList<T>;
18
+ set(index: number, value: TypeOrListOrTypedMap<T>): TypedList<T>;
17
19
  toJS(): T[];
18
20
  }
19
- export declare type TypeOrListOrTypedMap<T> = T extends any[] ? TypedList<T[number]> : (T extends Date ? Date : T extends object ? TypedMap<T> : T);
20
- export interface TypedMap<T> extends Map<keyof T, any> {
21
+ export declare type TypeOrListOrTypedMap<T> = T extends any[] ? TypedList<T[number]> : (T extends Date ? Date : T extends {
22
+ [key: string]: unknown;
23
+ } ? TypedMap<T> : T);
24
+ export interface TypedMap<T extends {
25
+ [key: string]: unknown;
26
+ }> extends Map<keyof T, any> {
21
27
  get<K extends keyof T>(key: K, notSetValue?: TypeOrListOrTypedMap<T[K]>): TypeOrListOrTypedMap<T[K]>;
22
- getIn<K1 extends keyof T, K2 extends (keyof T[K1]) | undefined = undefined, K3 extends (keyof T[K1][K2]) | undefined = undefined, K4 extends (keyof T[K1][K2][K3]) | undefined = undefined, K5 extends (keyof T[K1][K2][K3][K4]) | undefined = undefined, K6 extends (keyof T[K1][K2][K3][K4][K5]) | undefined = undefined, R extends unknown = (K6 extends undefined ? unknown : TypeOrListOrTypedMap<T[K1][K2][K3][K4][K5][K6]>) | (K5 extends undefined ? unknown : K6 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3][K4][K5]> : unknown) | (K4 extends undefined ? unknown : K5 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3][K4]> : unknown) | (K3 extends undefined ? unknown : K4 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3]> : unknown) | (K2 extends undefined ? unknown : K3 extends undefined ? TypeOrListOrTypedMap<T[K1][K2]> : unknown) | (K2 extends undefined ? TypeOrListOrTypedMap<T[K1]> : unknown)>(searchKeyPath: [K1] | [K1, K2] | [K1, K2, K3] | [K1, K2, K3, K4] | [K1, K2, K3, K4, K5] | [K1, K2, K3, K4, K5, K6], notSetValue?: R): R;
28
+ getIn<K1 extends keyof T, K2 extends (keyof T[K1]) | undefined = undefined, K3 extends (keyof T[K1][K2]) | undefined = undefined, K4 extends (keyof T[K1][K2][K3]) | undefined = undefined, K5 extends (keyof T[K1][K2][K3][K4]) | undefined = undefined, K6 extends (keyof T[K1][K2][K3][K4][K5]) | undefined = undefined, R = (K6 extends undefined ? never : TypeOrListOrTypedMap<T[K1][K2][K3][K4][K5][K6]>) | (K5 extends undefined ? never : K6 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3][K4][K5]> : never) | (K4 extends undefined ? never : K5 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3][K4]> : never) | (K3 extends undefined ? never : K4 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3]> : never) | (K2 extends undefined ? never : K3 extends undefined ? TypeOrListOrTypedMap<T[K1][K2]> : never) | (K2 extends undefined ? TypeOrListOrTypedMap<T[K1]> : never)>(searchKeyPath: [K1] | [K1, K2] | [K1, K2, K3] | [K1, K2, K3, K4] | [K1, K2, K3, K4, K5] | [K1, K2, K3, K4, K5, K6], notSetValue?: R): R;
23
29
  set<K extends keyof T>(key: K, value: TypeOrListOrTypedMap<T[K]>): this;
24
- setIn<K1 extends keyof T, K2 extends (keyof T[K1]) | undefined = undefined, K3 extends (keyof T[K1][K2]) | undefined = undefined, K4 extends (keyof T[K1][K2][K3]) | undefined = undefined, K5 extends (keyof T[K1][K2][K3][K4]) | undefined = undefined, K6 extends (keyof T[K1][K2][K3][K4][K5]) | undefined = undefined, V = (K6 extends undefined ? unknown : TypeOrListOrTypedMap<T[K1][K2][K3][K4][K5][K6]>) | (K5 extends undefined ? unknown : K6 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3][K4][K5]> : unknown) | (K4 extends undefined ? unknown : K5 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3][K4]> : unknown) | (K3 extends undefined ? unknown : K4 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3]> : unknown) | (K2 extends undefined ? unknown : K3 extends undefined ? TypeOrListOrTypedMap<T[K1][K2]> : unknown) | (K2 extends undefined ? TypeOrListOrTypedMap<T[K1]> : unknown)>(searchKeyPath: [K1] | [K1, K2] | [K1, K2, K3] | [K1, K2, K3, K4] | [K1, K2, K3, K4, K5] | [K1, K2, K3, K4, K5, K6], value: V): this;
25
- toJS(): T extends {
26
- [key: string]: unknown;
27
- } ? T : {
28
- [key: string]: unknown;
29
- };
30
+ setIn<K1 extends keyof T, K2 extends (keyof T[K1]) | undefined = undefined, K3 extends (keyof T[K1][K2]) | undefined = undefined, K4 extends (keyof T[K1][K2][K3]) | undefined = undefined, K5 extends (keyof T[K1][K2][K3][K4]) | undefined = undefined, K6 extends (keyof T[K1][K2][K3][K4][K5]) | undefined = undefined, V = (K6 extends undefined ? never : TypeOrListOrTypedMap<T[K1][K2][K3][K4][K5][K6]>) | (K5 extends undefined ? never : K6 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3][K4][K5]> : never) | (K4 extends undefined ? never : K5 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3][K4]> : never) | (K3 extends undefined ? never : K4 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3]> : never) | (K2 extends undefined ? never : K3 extends undefined ? TypeOrListOrTypedMap<T[K1][K2]> : never) | (K2 extends undefined ? TypeOrListOrTypedMap<T[K1]> : never)>(searchKeyPath: [K1] | [K1, K2] | [K1, K2, K3] | [K1, K2, K3, K4] | [K1, K2, K3, K4, K5] | [K1, K2, K3, K4, K5, K6], value: V): this;
31
+ toJS(): T;
30
32
  }
31
33
  declare type Reducers<T> = {
32
34
  [K in keyof T]: Reducer<T[K], SimpleAction>;
@@ -1,4 +1,6 @@
1
1
  import Immutable from 'immutable';
2
2
  import { TypedList, TypedMap } from '../index';
3
- export declare const arrayToTypedList: <T>(jsValue: T[], reviver?: (key: string | number, sequence: Immutable.Collection.Keyed<string, unknown> | Immutable.Collection.Indexed<unknown>, path?: (string | number)[]) => unknown) => T extends TypedMap<infer U> ? TypedList<U> : TypedList<T>;
4
- export declare const objectToTypedMap: <T extends object>(jsValue: T, reviver?: (key: string | number, sequence: Immutable.Collection.Keyed<string, unknown> | Immutable.Collection.Indexed<unknown>, path?: (string | number)[]) => unknown) => TypedMap<T>;
3
+ export declare const arrayToTypedList: <T>(jsValue: T[], reviver?: (key: string | number, sequence: Immutable.Collection.Keyed<string, unknown> | Immutable.Collection.Indexed<unknown>, path?: (string | number)[]) => unknown) => TypedList<T>;
4
+ export declare const objectToTypedMap: <T extends {
5
+ [key: string]: unknown;
6
+ }>(jsValue: T, reviver?: (key: string | number, sequence: Immutable.Collection.Keyed<string, unknown> | Immutable.Collection.Indexed<unknown>, path?: (string | number)[]) => unknown) => TypedMap<T>;
@@ -1,2 +1,4 @@
1
1
  import { TypeOrListOrTypedMap, TypedMap } from '../store';
2
- export declare const setInSafely: <T extends any, K1 extends keyof T, K2 extends keyof T[K1] = undefined, K3 extends keyof T[K1][K2] = undefined, K4 extends keyof T[K1][K2][K3] = undefined, K5 extends keyof T[K1][K2][K3][K4] = undefined, K6 extends keyof T[K1][K2][K3][K4][K5] = undefined, V = (K6 extends undefined ? never : TypeOrListOrTypedMap<T[K1][K2][K3][K4][K5][K6]>) | (K5 extends undefined ? never : K6 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3][K4][K5]> : never) | (K4 extends undefined ? never : K5 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3][K4]> : never) | (K3 extends undefined ? never : K4 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3]> : never) | (K2 extends undefined ? never : K3 extends undefined ? TypeOrListOrTypedMap<T[K1][K2]> : never) | (K2 extends undefined ? TypeOrListOrTypedMap<T[K1]> : never)>(map: TypedMap<T>, keys: [K1] | [K1, K2] | [K1, K2, K3] | [K1, K2, K3, K4] | [K1, K2, K3, K4, K5] | [K1, K2, K3, K4, K5, K6], value: V) => TypedMap<T>;
2
+ export declare const setInSafely: <T extends {
3
+ [key: string]: unknown;
4
+ }, K1 extends keyof T, K2 extends keyof T[K1] = undefined, K3 extends keyof T[K1][K2] = undefined, K4 extends keyof T[K1][K2][K3] = undefined, K5 extends keyof T[K1][K2][K3][K4] = undefined, K6 extends keyof T[K1][K2][K3][K4][K5] = undefined, V = (K6 extends undefined ? never : TypeOrListOrTypedMap<T[K1][K2][K3][K4][K5][K6]>) | (K5 extends undefined ? never : K6 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3][K4][K5]> : never) | (K4 extends undefined ? never : K5 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3][K4]> : never) | (K3 extends undefined ? never : K4 extends undefined ? TypeOrListOrTypedMap<T[K1][K2][K3]> : never) | (K2 extends undefined ? never : K3 extends undefined ? TypeOrListOrTypedMap<T[K1][K2]> : never) | (K2 extends undefined ? TypeOrListOrTypedMap<T[K1]> : never)>(map: TypedMap<T>, keys: [K1] | [K1, K2] | [K1, K2, K3] | [K1, K2, K3, K4] | [K1, K2, K3, K4, K5] | [K1, K2, K3, K4, K5, K6], value: V) => TypedMap<T>;
package/utils/index.js CHANGED
@@ -1 +1 @@
1
- import t from"react";import{renderToStaticMarkup as e}from"react-dom/server";import{Map as r}from"immutable";var n=function(){var t,e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.duration,o=void 0===n?500:n,a=r.element,i=void 0===a?document.documentElement:a,u=r.left,c=void 0===u?0:u,l=r.top,f=void 0===l?0:l,s=i===document.documentElement?window:i,d=c-i.scrollLeft,p=f-i.scrollTop,m=function r(n){var a=n-e,i=d*(a/o),u=p*(a/o);t||(t=n),n-t>=o?s.scrollTo(c,f):(s.scrollBy(i,u),e=n,requestAnimationFrame(r))};0===d&&0===p||requestAnimationFrame(m)};function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(r,!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(r).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function u(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},a=Object.keys(t);for(n=0;n<a.length;n++)r=a[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)r=a[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function c(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t))&&"[object Arguments]"!==Object.prototype.toString.call(t))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,a=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function l(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var f=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],s=["January","February","March","April","May","June","July","August","September","October","November","December"],d=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.amount,n=void 0===r?1:r,o=e.unit,a=void 0===o?"day":o,i=new Date(t);return"year"===a?i.setFullYear(t.getFullYear()-n):"month"===a?i.setMonth(t.getMonth()-n):i.setDate(t.getDate()-n),i},p=function(t){var e=t.date,r=t.format,n=void 0===r?"dd/MM/yyyy":r,o=e.getDate(),a=e.getMonth()+1,i=e.getFullYear().toString();return n.replace(/dd/,o.toString().padStart(2,"0")).replace(/d/,o.toString()).replace(/MMM/,s[a-1].substr(0,3)).replace(/MM/,a.toString().padStart(2,"0")).replace(/M/,a.toString()).replace(/yyyy/,i).replace(/yy/,i.substr(2))},m=function(t){var e=t.date,r=t.format,n=void 0===r?"HH:mm":r,o=t.meridianStrings,a=void 0===o?{am:"am",pm:"pm"}:o,i=/h{1,2}/.test(n),u=i?e.getHours()%12||12:e.getHours();return n.replace(/HH/i,u.toString().padStart(2,"0")).replace(/H/i,u.toString()).replace(/mm/,e.getMinutes().toString().padStart(2,"0")).replace(/SS/,e.getSeconds().toString().padStart(2,"0")).replace(/AM/,i?e.getHours()<12?a.am:a.pm:"")},v=function(t){var e=t.date,r=t.format,n=void 0===r?"".concat("dd/MM/yyyy"," ").concat("HH:mm"):r,o=u(t,["date","format"]),a=m(i({},o,{date:e,format:n}));return p(i({},o,{date:e,format:a}))},y=function(t){return new Date(new Date(t).setHours(0,0,0,0))},g=function(t){return y(new Date(new Date(t).setDate(1)))},h=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0).getDate()},b=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.amount,n=void 0===r?1:r,o=e.unit,a=void 0===o?"day":o,i=new Date(t);return"year"===a?i.setFullYear(t.getFullYear()+n):"month"===a?i.setMonth(t.getMonth()+n):i.setDate(t.getDate()+n),i},S=function(t){return"[object Date]"===Object.prototype.toString.call(t)},w=function(t){var e,r,n,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=a.format,u=a.shorthand,l=void 0===u||u,f=t&&t.trim(),s="UK"===i||!i&&(l?/^(0|1|2|3)?[0-9]\/(0|1)?[0-9]\/\d{2,4}$/.test(f):/^(0|1|2|3)[0-9]\/(0|1)[0-9]\/\d{4}$/.test(f)),d="US"===i||!i&&(l?/^(0|1)?[0-9]\/(0|1|2|3)?[0-9]\/\d{2,4}$/.test(f):/^(0|1)[0-9]\/(0|1|2|3)[0-9]\/\d{4}$/.test(f)),m=s?"dd/MM/yyyy":"MM/dd/yyyy";if(s){var v=f.split("/").map((function(t){return parseInt(t)})),y=c(v,3);r=y[0],n=y[1],o=y[2]}else if(d){var g=f.split("/").map((function(t){return parseInt(t)})),h=c(g,3);n=h[0],r=h[1],o=h[2]}if(r&&n&&o&&[2,4].includes(o.toString().length)){if(2===o.toString().length){var b=(new Date).getFullYear(),S=100*Math.floor(b/100),w=b-S;o=w<25&&o>49?S-100+o:w>75&&o<50?S+100+o:S+o}e=new Date(o,n-1,r)}var O=m.replace("dd",r&&r.toString().padStart(2,"0")).replace("MM",n&&n.toString().padStart(2,"0")).replace("yyyy",o&&o.toString());return e&&p({date:e,format:m})===O?e:void 0},O=function(t){var e=c(t&&t.trim().match(/(\d+):(\d+)\s{0,}(am|pm)?/i),4),r=(e[0],e[1]),n=e[2],o=e[3],a=void 0!==o;return{hour:parseInt(r)%(a?12:24),meridian:o?o.toLowerCase():void 0,minute:parseInt(n)}},M=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];self.clearTimeout(e),e=self.setTimeout((function(){t.apply(void 0,o)}),r)}},j=function(e){var r=[];return function e(n){var o;o=n,t.isValidElement(o)?t.Children.forEach(n.props.children,e):r.push(n.toString())}(e),r.join("")},D=function(t){return"function"==typeof t},E=function(t){if(r=e(t),!/^<svg(.*)<\/svg>$/i.test(r))throw new Error("Only a component that returns SVG markup can be converted to a dataURL");var r;return"url('data:image/svg+xml,".concat(encodeURIComponent(e(t)),"')")},A=function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:500},o=n.beforeDelay,a=n.limit,i=void 0===a?500:a;return function(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];r?(self.clearTimeout(e),D(o)&&o.apply(void 0,a),e=self.setTimeout((function(){Date.now()-r>=i&&(t.apply(void 0,a),r=Date.now())}),i-(Date.now()-r))):(t.apply(void 0,a),r=Date.now())}},I=function(t){console.error(t)},F=function(t){console.warn(t)},H=function(t){throw new Error("Unexpected object: ".concat(t))},L=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"production"!==process.env.NODE_ENV&&e&&I(t)},P=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"production"!==process.env.NODE_ENV&&e&&F(t)},T=function(t){return t.filter((function(t){return t&&null!=t}))},U=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t.length===e.length&&t.every((function(t,n){return r?e[n]===t:e.includes(t)}))},k=function(t,e){return Object.keys(t).find((function(r){return t[r]===e}))},x=function(t){return"[object Object]"===Object.prototype.toString.call(t)},Y=function(t,e){if(self.navigator&&self.navigator.msSaveBlob)self.navigator.msSaveBlob(t,e);else{var r=document.createElement("a"),n=URL.createObjectURL(t);r.href=n,r.download=e,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}},R=function t(e,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=e;return x(e)&&(r.forEach((function(t){delete a[t]})),n&&(a=Object.keys(a).reduce((function(e,n){return i({},e,o({},n,t(a[n],r)))}),{}))),Array.isArray(e)&&(a=e.map((function(e){return t(e,r,n)}))),a},N=function(t,e,n){return e.slice(0,e.length).reduce((function(t,o,a){var i=c(t,2),u=i[0],f=i[1],s=[].concat(l(f),[o]);return a===e.length-1?u.setIn(s,n):u.getIn(s)?[u,s]:[u.setIn(s,r([])),s]}),[t,[]])},$=function(t,e){var r="#"===t.charAt(0),n="rgb"===t.substr(0,3);if(!r&&!n||!("number"==typeof e&&e>=0&&e<=1))return L("\n StyleUtils.transparentize only supports colors in hexadecimal or rgb(a) format.\n The desired transparency must be a value between 0 and 1\n "),t;var o,a=e;r?o=(t.length>6?t.substr(1).match(/.{1,2}/g):t.substr(1).match(/./g)).map((function(t){return parseInt("".concat(t).concat(1===t.length?t:""),16)})):o=t.match(/\d+(\.?\d+)?/g).map(parseFloat);if(void 0!==o[3]){var i=n?o[3]:o[3]/255;a=i-i*e}return"rgba(".concat(o.slice(0,3).join(","),",").concat(Math.round(100*a)/100,")")},C=function(t){var e=[];return{addListener:function(r){if(!function(t){return e.find((function(e){return e.listener===t}))}(r)){var n=function(t){return r(t.data)};e.push({listener:r,remove:function(){return t.removeEventListener("message",n)}}),t.addEventListener("message",n)}},removeListener:function(t){var r=e.findIndex((function(e){return e.listener===t})),n=e.splice(r,1)[0];n&&n.remove()}}},V=function(t){return t(i({},C(self),{postMessage:function(t){return self.postMessage(t,void 0)}})),{path:""}},B=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new Worker(t),n=C(r);return e.onError&&"function"==typeof e.onError&&(r.onerror=e.onError),i({},n,{postMessage:function(t){return r.postMessage(t,void 0)},terminate:r.terminate})};export{f as DAYS,s as MONTHS,H as assertNever,V as createWebWorker,M as debounce,d as decrementDate,L as developerError,P as developerWarning,T as filterValidEntries,p as formatDate,v as formatDateTime,m as formatTime,j as formattedStringToPlainText,y as getDateAtStartOfDay,g as getDateAtStartOfMonth,k as getEnumKeyByValue,h as getNumberOfDaysForMonth,b as incrementDate,B as initialiseWebWorker,U as isArrayEqual,D as isCallableFunction,S as isDate,x as isPlainObject,w as parseDateString,O as parseTimeString,Y as saveBlobAsFile,N as setInSafely,n as smoothScroll,R as stripKeys,E as svgComponentToDataURL,A as throttle,$ as transparentize};
1
+ import t from"react";import{renderToStaticMarkup as e}from"react-dom/server";import{Map as r}from"immutable";var n=function(){var t,e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.duration,o=void 0===n?500:n,a=r.element,i=void 0===a?document.documentElement:a,u=r.left,c=void 0===u?0:u,l=r.top,f=void 0===l?0:l,s=i===document.documentElement?window:i,d=c-i.scrollLeft,p=f-i.scrollTop,m=function r(n){var a=n-e,i=d*(a/o),u=p*(a/o);t||(t=n),n-t>=o?s.scrollTo(c,f):(s.scrollBy(i,u),e=n,requestAnimationFrame(r))};0===d&&0===p||requestAnimationFrame(m)};function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(r,!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(r).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function u(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},a=Object.keys(t);for(n=0;n<a.length;n++)r=a[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)r=a[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function c(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t))&&"[object Arguments]"!==Object.prototype.toString.call(t))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,a=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function l(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var f=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],s=["January","February","March","April","May","June","July","August","September","October","November","December"],d=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.amount,n=void 0===r?1:r,o=e.unit,a=void 0===o?"day":o,i=new Date(t);return"year"===a?i.setFullYear(t.getFullYear()-n):"month"===a?i.setMonth(t.getMonth()-n):i.setDate(t.getDate()-n),i},p=function(t){var e=t.date,r=t.format,n=void 0===r?"dd/MM/yyyy":r,o=e.getDate(),a=e.getMonth()+1,i=e.getFullYear().toString();return n.replace(/dd/,o.toString().padStart(2,"0")).replace(/d/,o.toString()).replace(/MMM/,s[a-1].substr(0,3)).replace(/MM/,a.toString().padStart(2,"0")).replace(/M/,a.toString()).replace(/yyyy/,i).replace(/yy/,i.substr(2))},m=function(t){var e=t.date,r=t.format,n=void 0===r?"HH:mm":r,o=t.meridianStrings,a=void 0===o?{am:"am",pm:"pm"}:o,i=/h{1,2}/.test(n),u=i?e.getHours()%12||12:e.getHours();return n.replace(/HH/i,u.toString().padStart(2,"0")).replace(/H/i,u.toString()).replace(/mm/,e.getMinutes().toString().padStart(2,"0")).replace(/SS/,e.getSeconds().toString().padStart(2,"0")).replace(/AM/,i?e.getHours()<12?a.am:a.pm:"")},v=function(t){var e=t.date,r=t.format,n=void 0===r?"".concat("dd/MM/yyyy"," ").concat("HH:mm"):r,o=u(t,["date","format"]),a=m(i({},o,{date:e,format:n}));return p(i({},o,{date:e,format:a}))},y=function(t){return new Date(new Date(t).setHours(0,0,0,0))},g=function(t){return y(new Date(new Date(t).setDate(1)))},h=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0).getDate()},b=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.amount,n=void 0===r?1:r,o=e.unit,a=void 0===o?"day":o,i=new Date(t);return"year"===a?i.setFullYear(t.getFullYear()+n):"month"===a?i.setMonth(t.getMonth()+n):i.setDate(t.getDate()+n),i},S=function(t){return"[object Date]"===Object.prototype.toString.call(t)},w=function(t){var e,r,n,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=a.format,u=a.shorthand,l=void 0===u||u,f=t&&t.trim(),s="UK"===i||!i&&(l?/^(0|1|2|3)?[0-9]\/(0|1)?[0-9]\/\d{2,4}$/.test(f):/^(0|1|2|3)[0-9]\/(0|1)[0-9]\/\d{4}$/.test(f)),d="US"===i||!i&&(l?/^(0|1)?[0-9]\/(0|1|2|3)?[0-9]\/\d{2,4}$/.test(f):/^(0|1)[0-9]\/(0|1|2|3)[0-9]\/\d{4}$/.test(f)),m=s?"dd/MM/yyyy":"MM/dd/yyyy";if(s){var v=f.split("/").map((function(t){return parseInt(t)})),y=c(v,3);r=y[0],n=y[1],o=y[2]}else if(d){var g=f.split("/").map((function(t){return parseInt(t)})),h=c(g,3);n=h[0],r=h[1],o=h[2]}if(r&&n&&o&&[2,4].includes(o.toString().length)){if(2===o.toString().length){var b=(new Date).getFullYear(),S=100*Math.floor(b/100),w=b-S;o=w<25&&o>49?S-100+o:w>75&&o<50?S+100+o:S+o}e=new Date(o,n-1,r)}var O=m.replace("dd",r&&r.toString().padStart(2,"0")).replace("MM",n&&n.toString().padStart(2,"0")).replace("yyyy",o&&o.toString());return e&&p({date:e,format:m})===O?e:void 0},O=function(t){var e=c(t&&t.trim().match(/(\d+):(\d+)\s{0,}(am|pm)?/i),4),r=(e[0],e[1]),n=e[2],o=e[3],a=void 0!==o;return{hour:parseInt(r)%(a?12:24),meridian:o?o.toLowerCase():void 0,minute:parseInt(n)}},M=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];self.clearTimeout(e),e=self.setTimeout((function(){t.apply(void 0,o)}),r)}},j=function(e){var r=[];return function e(n){var o;o=n,t.isValidElement(o)?t.Children.forEach(n.props.children,e):r.push(n.toString())}(e),r.join("")},D=function(t){return"function"==typeof t},E=function(t){if(r=e(t),!/^<svg(.*)<\/svg>$/i.test(r))throw new Error("Only a component that returns SVG markup can be converted to a dataURL");var r;return"url('data:image/svg+xml,".concat(encodeURIComponent(e(t)),"')")},A=function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:500},o=n.beforeDelay,a=n.limit,i=void 0===a?500:a;return function(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];r?(self.clearTimeout(e),D(o)&&o.apply(void 0,a),e=self.setTimeout((function(){Date.now()-r>=i&&(t.apply(void 0,a),r=Date.now())}),i-(Date.now()-r))):(t.apply(void 0,a),r=Date.now())}},I=function(t){console.error(t)},F=function(t){console.warn(t)},H=function(t){throw new Error("Unexpected object: ".concat(t))},L=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"production"!==process.env.NODE_ENV&&e&&I(t)},P=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"production"!==process.env.NODE_ENV&&e&&F(t)},T=function(t){return t.filter((function(t){return t&&null!=t}))},U=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t.length===e.length&&t.every((function(t,n){return r?e[n]===t:e.includes(t)}))},k=function(t,e){return Object.keys(t).find((function(r){return t[r]===e}))},x=function(t){return"[object Object]"===Object.prototype.toString.call(t)},Y=function(t,e){if(self.navigator&&self.navigator.msSaveBlob)self.navigator.msSaveBlob(t,e);else{var r=document.createElement("a"),n=URL.createObjectURL(t);r.href=n,r.download=e,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}},R=function t(e,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=e;return x(e)&&(r.forEach((function(t){delete a[t]})),n&&(a=Object.keys(a).reduce((function(e,n){return i({},e,o({},n,t(a[n],r)))}),{}))),Array.isArray(e)&&(a=e.map((function(e){return t(e,r,n)}))),a},N=function(t,e,n){return e.slice(0,e.length).reduce((function(t,o,a){var i=c(t,2),u=i[0],f=i[1],s=[].concat(l(f),[o]);return a===e.length-1?[u.setIn(s,n),s]:u.getIn(s)?[u,s]:[u.setIn(s,r([])),s]}),[t,[]])[0]},$=function(t,e){var r="#"===t.charAt(0),n="rgb"===t.substr(0,3);if(!r&&!n||!("number"==typeof e&&e>=0&&e<=1))return L("\n StyleUtils.transparentize only supports colors in hexadecimal or rgb(a) format.\n The desired transparency must be a value between 0 and 1\n "),t;var o,a=e;r?o=(t.length>6?t.substr(1).match(/.{1,2}/g):t.substr(1).match(/./g)).map((function(t){return parseInt("".concat(t).concat(1===t.length?t:""),16)})):o=t.match(/\d+(\.?\d+)?/g).map(parseFloat);if(void 0!==o[3]){var i=n?o[3]:o[3]/255;a=i-i*e}return"rgba(".concat(o.slice(0,3).join(","),",").concat(Math.round(100*a)/100,")")},C=function(t){var e=[];return{addListener:function(r){if(!function(t){return e.find((function(e){return e.listener===t}))}(r)){var n=function(t){return r(t.data)};e.push({listener:r,remove:function(){return t.removeEventListener("message",n)}}),t.addEventListener("message",n)}},removeListener:function(t){var r=e.findIndex((function(e){return e.listener===t})),n=e.splice(r,1)[0];n&&n.remove()}}},V=function(t){return t(i({},C(self),{postMessage:function(t){return self.postMessage(t,void 0)}})),{path:""}},B=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new Worker(t),n=C(r);return e.onError&&"function"==typeof e.onError&&(r.onerror=e.onError),i({},n,{postMessage:function(t){return r.postMessage(t,void 0)},terminate:r.terminate})};export{f as DAYS,s as MONTHS,H as assertNever,V as createWebWorker,M as debounce,d as decrementDate,L as developerError,P as developerWarning,T as filterValidEntries,p as formatDate,v as formatDateTime,m as formatTime,j as formattedStringToPlainText,y as getDateAtStartOfDay,g as getDateAtStartOfMonth,k as getEnumKeyByValue,h as getNumberOfDaysForMonth,b as incrementDate,B as initialiseWebWorker,U as isArrayEqual,D as isCallableFunction,S as isDate,x as isPlainObject,w as parseDateString,O as parseTimeString,Y as saveBlobAsFile,N as setInSafely,n as smoothScroll,R as stripKeys,E as svgComponentToDataURL,A as throttle,$ as transparentize};