UNPKG

react-busser

Version:

An evented object for scalable and precise communication across ReactJS Components

31 lines 59.7 kB
import n,{useCallback as e,useEffect as t,useRef as r,useMemo as o,useState as i,useContext as u}from"react";import{useReactToPrint as a}from"react-to-print";import{effect as c,useComputed as s,useSignal as l,signal as f}from"@preact/signals-react";import{useLocation as d,useHistory as v}from"react-router-dom";import p from"lodash.debounce";import h from"lodash.isempty";function m(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.push.apply(t,r)}return t}function g(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?m(Object(t),!0).forEach((function(e){T(n,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):m(Object(t)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))}))}return n}function y(n){var e=function(n,e){if("object"!=typeof n||!n)return n;var t=n[Symbol.toPrimitive];if(void 0!==t){var r=t.call(n,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(n)}(n,"string");return"symbol"==typeof e?e:String(e)}function w(n){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},w(n)}function b(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function S(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,y(r.key),r)}}function E(n,e,t){return e&&S(n.prototype,e),t&&S(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function T(n,e,t){return(e=y(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function A(n,e){return C(n)||function(n,e){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var r,o,i,u,a=[],c=!0,s=!1;try{if(i=(t=t.call(n)).next,0===e){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=i.call(t)).done)&&(a.push(r.value),a.length!==e);c=!0);}catch(n){s=!0,o=n}finally{try{if(!c&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(s)throw o}}return a}}(n,e)||x(n,e)||O()}function P(n){return function(n){if(Array.isArray(n))return _(n)}(n)||$(n)||x(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(n){if(Array.isArray(n))return n}function $(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}function x(n,e){if(n){if("string"==typeof n)return _(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_(n,e):void 0}}function _(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function O(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function L(n){var e=r();return null!==e.current||void 0!==e.current?e.current:e.current=f(n)}!function(){var n="text/plain";(function(){(console.warn||console.log).apply(console,arguments)}).bind("[clipboard-polyfill]");var e,t,r,o="undefined"==typeof window?void 0:window,i="undefined"==typeof globalThis?void 0:globalThis,u=null!=(r=null==(e=o)?void 0:e.Promise)?r:null==(t=i)?void 0:t.Promise;var a,c,s,l,f,d="undefined"==typeof navigator?void 0:navigator,v=null==d?void 0:d.clipboard,p=null==(a=null==v?void 0:v.read)?void 0:a.bind(v),h=null==(c=null==v?void 0:v.readText)?void 0:c.bind(v),m=null==(s=null==v?void 0:v.write)?void 0:s.bind(v),g=null==(l=null==v?void 0:v.writeText)?void 0:l.bind(v),y=null==(f=o)?void 0:f.ClipboardItem,w=function(){if(!u)throw new Error("No `Promise` implementation available for `clipboard-polyfill`. Consider using: https://github.com/lgarron/clipboard-polyfill#flat-file-version-with-promise-included");return u}(),b=o;function S(){return"undefined"==typeof ClipboardEvent&&void 0!==(null==b?void 0:b.clipboardData)&&void 0!==(null==b?void 0:b.clipboardData.setData)}function E(e,t,r){for(var o in e.success=!0,t){var i=t[o],u=r.clipboardData;u.setData(o,i),o===n&&u.getData(o)!==i&&(e.success=!1)}r.preventDefault()}function T(n){var e={success:!1},t=E.bind(this,e,n);document.addEventListener("copy",t);try{document.execCommand("copy")}finally{document.removeEventListener("copy",t)}return e.success}function A(n,e){P(n);var t=T(e);return C(),t}function P(n){var e=document.getSelection();if(e){var t=document.createRange();t.selectNodeContents(n),e.removeAllRanges(),e.addRange(t)}}function C(){var n=document.getSelection();n&&n.removeAllRanges()}function $(e){var t,r=n in e;if(S()){if(!r)throw new Error("No `text/plain` value was specified.");if(t=e[n],b.clipboardData&&b.clipboardData.setData("Text",t))return!0;throw new Error("Copying failed, possibly because the user rejected it.")}return!!T(e)||(navigator.userAgent.indexOf("Edge")>-1||(!!A(document.body,e)||(!!function(n){var e=document.createElement("div");e.setAttribute("style","-webkit-user-select: text !important"),e.textContent="temporary element",document.body.appendChild(e);var t=A(e,n);return document.body.removeChild(e),t}(e)||!!function(n){var e=document.createElement("div");e.setAttribute("style","-webkit-user-select: text !important");var t=e;e.attachShadow&&(t=e.attachShadow({mode:"open"}));var r=document.createElement("span");r.innerText=n,t.appendChild(r),document.body.appendChild(e),P(r);var o=document.execCommand("copy");return C(),document.body.removeChild(e),o}(e[n]))))}function x(n,e){for(var t=[],r=0;r<n.length;r++){var o=n[r];t.push(e(o))}return w.all(t).then((function(e){for(var t={},r=0;r<n.length;r++)t[n[r]]=e[r];return t}))}var _=w.resolve(),O=function(){return w.resolve(!0)},L=w.resolve(!1);function k(n){return new w((function(e,t){try{e(n())}catch(n){t(n)}}))}function j(e){return k((function(){return w.resolve(function(e){if(!$(function(e){var t={};return t[n]=e,t}(e)))throw new Error("writeText() failed")}(e))}))}function I(){return k((function(){if(h)return h();if(S()){var n=function(){if(!b.clipboardData)throw new Error("Cannot read IE clipboard Data ");var n=b.clipboardData.getData("Text");if(""===n)throw new Error("Empty clipboard or could not read plain text from clipboard");return n}();return w.resolve(n)}throw new Error("Read is not supported in your browser.")}))}function N(n,e){for(var t=0;t<n.length;t++){if(-1!==n[t].types.indexOf(e))return!0}return!1}var R=function(n,e){var t,r=Object.keys(n),o={};for(var i in n){var u=n[i];o[i]="string"==typeof u?D(i,u):u}return{types:r,presentationStyle:null!=(t=null==e?void 0:e.presentationStyle)?t:"unspecified",getType:function(n){return w.resolve(o[n])}}};function D(n,e){return new Blob([e],{type:n})}function F(n){return x(n.types,(function(e){return n.getType(e)})).then((function(e){return new w((function(t,r){var o={};n.presentationStyle&&(o.presentationStyle=n.presentationStyle),y?t(new y(e,o)):r("window.ClipboardItem is not defined")}))}))}function q(e){var t={};return t[n]=D(e,n),new R(t)}function B(n,e){return n.getType(e).then((function(n){return e=n,new w((function(n,t){var r=new FileReader;r.addEventListener("load",(function(){var e=r.result;"string"==typeof e?n(e):t("could not convert blob to string")})),r.readAsText(e)}));var e}))}navigator.clipboard||(navigator.clipboard={}),navigator.clipboard.read=function(){return k((function(){return p?p():I().then((function(n){return[q(n)]}))}))},navigator.clipboard.readText=I,navigator.clipboard.write=function(e){return k((function(){if(m&&y){var t=m;return w.all(e.map(F)).then((function(r){return t(r).then(O).catch((function(t){if(!N(e,n)&&!N(e,"text/html"))throw t;return L}))}))}return L})).then((function(t){return t?_:(N(e,n),function(n){return x(n.types,(function(e){return B(n,e)}))}(e[0]).then((function(n){if(!$(n))throw new Error("write() failed")})))}))},navigator.clipboard.writeText=function(n){return g?g(n).catch((function(){return j(n)})):j(n)},window.ClipboardItem=R}();var k=function(n){var e=(l||L)("function"==typeof n?n():n);return[e,function(n){e.value="function"!=typeof n?n:n(e.peek())}]},j=function(){var n=e(arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]);t((function(){return c(n)}),[])},I=function(n){return{signals:k,container:i}[arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"signals":"container"](n)},N=function(n){return{signals:j,container:t}[arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"signals":"container"](n)},R=s;function D(n,e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!t)return new Promise((function(n,t){window.addEventListener("beforeprint",(function n(){e.onBeforePrint(),window.removeEventListener("beforeprint",n)})),window.addEventListener("afterprint",(function n(){e.onAfterPrint(),window.removeEventListener("afterprint",n)})),setTimeout((function(){try{n(window.print())}catch(n){var r=n instanceof Error?n:new Error("Cannot print page");"function"==typeof e.onPrintError&&e.onPrintError("print",r),t(r)}}),50)}));Promise.resolve(n(null,"function"==typeof e.content?void 0:function(){return t.current}))}} /**! * `useUICommands` ReactJS hook */ var F=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{print:{}},e=Object.assign({},{documentTitle:"",onBeforeGetContent:function(){return Promise.resolve(void 0)},onBeforePrint:function(){},onAfterPrint:function(){},onPrintError:function(){},removeAfterPrint:!0,nowPrinting:function(){}},n.print);t((function(){if(void 0===navigator.clipboard||void 0===navigator.clipboard.writeText||void 0===navigator.clipboard.readText){var n=document.getElementById("__react-busser-clipboard");n||((n=document.createElement("textarea")).style.position="fixed",n.style.width="2em",n.style.height="1em",n.style.padding="0px",n.style.border="none",n.style.outline="none",n.style.boxShadow="none",n.style.fontSize="0px",n.id="__react-busser-clipboard",n.style.opacity="0",n.tabIndex=0,n.dataset.clipboardObject="polyfill-stub",n.style.backgroundColor="transparent",document.body.appendChild(n))}var t="undefined"!=typeof window&&"matchMedia"in window&&window.matchMedia("print"),r=function(n){!!n.matches&&e.nowPrinting()};if(t)try{t.addListener(r)}catch(n){t.addEventListener("change",r)}return function(){if(void 0===navigator.clipboard||void 0===navigator.clipboard.writeText||void 0===navigator.clipboard.readText){var n=document.getElementById("__react-busser-clipboard");n&&n.parentNode&&n.parentNode.removeChild(n)}if(t)try{t.removeListener(r)}catch(n){t.removeEventListener("change",r)}}}),[]);var i=a(e),u=r({copy:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0;try{if("undefined"!=typeof navigator&&void 0!==navigator.clipboard){if(void 0!==navigator.permissions&&"function"==typeof navigator.permissions.query){var t="text/plain",r=new Blob([n],{type:t}),o=[new window.ClipboardItem(T({},t,r))];return navigator.permissions.query({name:"clipboard-write"}).then((function(n){if("granted"===n.state||"prompt"===n.state)return navigator.clipboard.write(o).then((function(){return!1}))}),(function(){return Promise.reject(new Error("Permission not granted!"))}))}return navigator.clipboard.writeText(n).then((function(){return!1}))}}catch(t){var i=document.queryCommandSupported&&document.queryCommandSupported("copy")||document.queryCommandEnabled("copy"),u=document.getElementById("__react-busser-clipboard");if(!e&&u){u.textContent=n;var a="number"==typeof u.selectionStart?u.selectionStart:-1;u.focus(),-1!==a?u.select():u.setSelectionRange(0,n.length);try{if(i&&document.execCommand("copy"))return Promise.resolve(!0);throw new Error("Cannot copy to clipboard")}catch(n){return Promise.reject(n)}}else if(document.hasFocus()){var c=e||document.activeElement;if(c&&"string"==typeof c.tagName&&("true"===c.contentEditable||"inherit"===c.contentEditable||"#document"!==c.nodeName)){var s=document.getSelection();if("function"==typeof c.select&&["INPUT","TEXTAREA"].includes(c.tagName))c.setSelectionRange(0,9999),s=document.getSelection();else{var l=document.createRange();try{l.setStart(c.firstChild,0),l.setEnd(c.firstChild,c.innerText.length)}catch(n){}s.removeAllRanges(),s.addRange(l)}if(null===s.focusNode){var f=document.getElementById("__react-busser-clipboard");f&&(f.textContent=n,f.focus(),f.select(),s=document.getSelection())}var d=null!==s.focusNode?s.toString():n;if(i)try{if(document.execCommand("copy"))return Promise.resolve(!0)}catch(n){return""===window.name?(window.name=":- "+d,Promise.resolve(!1)):Promise.reject(new Error("Cannot copy to clipboard"))}return Promise.reject(new Error("Cannot copy to clipboard"))}}return Promise.reject(t)}},paste:function(n){var e=document.queryCommandSupported&&document.queryCommandSupported("insertText")||document.queryCommandEnabled("insertText");try{return navigator.clipboard.readText().then((function(t){if("string"!=typeof t&&n){var r=n;if(r&&("true"===r.contentEditable||"inherit"===r.contentEditable||"#document"!==r.nodeName)&&(r.focus(),-1!==("number"==typeof r.selectionStart?r.selectionStart:-1)&&e))try{if(document.execCommand("insertText",!1,t))return""}catch(n){}}return t}))}catch(o){if(!n){var t=document.getElementById("__react-busser-clipboard");if(t&&e)try{if(document.execCommand("insertText",!1,t.value))return Promise.resolve(t.value);throw new Error("Cannot copy to clipboard")}catch(n){if(!window.name.startsWith(":- "))return Promise.reject(n);var r=window.name.replace(":- ","");if(document.execCommand("insertText",!1,r))return window.name="",Promise.resolve(r)}return Promise.reject(new Error("Cannot copy to clipboard"))}return document.hasFocus()?Promise.resolve(window.name):Promise.reject(o)}},print:D(i,e)}).current;return o((function(){return{hub:{copy:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return u.copy.apply(null,e)},paste:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return u.paste.apply(null,e)},print:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return u.print.apply(null,e)}}}}),[])},q=function(){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};b(this,n);var t={},r=this;r.awayTimeout="number"!=typeof e.awayTimeout?3e3:e.awayTimeout,r.onAway=e.onAway,r.onStopped=e.onStopped,r.onAwayBack=e.onAwayBack,r.onScreenVisible=e.onVisible,r.onScreenHidden=e.onHidden,this.isUserAway=!1,this.isStopped=!0,this.lastActive=(new Date).getTime(),this.awayTimestamp=0,this.listener=void 0,this.awayTimer=null,this._isVisible=!0,this.setup=function(){t.$$onload=window.onload,t.$$onclick=window.onclick,t.$$onpointermove=window.onpointermove,t.$$onmousedown=window.onmousedown,t.$$ontouchstart=window.ontouchstart,t.$$onkeydown=window.onkeydown,t.$$onscroll=window.onscroll,t.$$onmouseover=window.onmouseover,t.$$onmousewheel=window.onmousewheel,t.$$onfocus=window.onfocus,t.$$_reSize=null,window.onload=function(){t.$$onload&&t.$$onload(),r.onActive()},window.onclick=function(){t.$$onclick&&t.$$onclick(),r.onActive()},t.$$_reSize=function(){r.onActive()},window.addEventListener("resize",t.$$_reSize,!1),window.onpointermove=function(){t.$$onpointermove&&t.$$onpointermove(),r.onActive()},window.onmousedown=function(){t.$$onmousedown&&t.$$onmousedown(),r.onActive()},window.ontouchstart=function(){t.$$ontouchstart&&t.$$ontouchstart(),r.onActive()},window.onkeydown=function(){t.$$onkeydown&&t.$$onkeydown(),r.onActive()},window.onscroll=function(){t.$$onscroll&&t.$$onscroll(),r.onActive()},window.onmousewheel=function(){t.$$onmousewheel&&t.$$onmousewheel(),r.onActive()},window.onfocus=function(){t.$$onfocus&&t.$$onfocus(),r.onActive()},window.onmouseover=function(){t.$$onmouseover&&t.$$onmouseover(),r.onActive()}},this.teardown=function(){window.onfocus=t.$$onfocus,window.onload=t.$$onload,window.onclick=t.$$onclick,window.onpointermove=t.$$onpointermove,window.onmousedown=t.$$onmousedown,window.ontouchstart=t.$$ontouchstart||null,window.onkeydown=t.$$onkeydown,window.onscroll=t.$$onscroll,window.onmousewheel=t.$$onmousewheel,window.onmouseover=t.$$onmouseover,window.removeEventListener("resize",t.$$_reSize,!1),t.$$_reSize=null,t={},this.lastActive=(new Date).getTime(),this._isVisible=!0}}return E(n,[{key:"onActive",value:function(){return this.awayTimestamp=(new Date).getTime()+this.awayTimeout,this.isUserAway&&("function"==typeof this.onAwayBack&&this.onAwayBack(),this.start()),this.isUserAway=!1,!0}},{key:"start",value:function(){var n=this;return void 0===this.listener&&(this.listener=function(){n.handleVisibilityChange()},"function"==typeof document.addEventListener&&(window.addEventListener("focus",this.listener,!1),void 0!==document.hidden?document.addEventListener("visibilitychange",this.listener,!1):document.addEventListener("webkitvisibilitychange",this.listener,!1))),this.awayTimestamp=(new Date).getTime()+this.awayTimeout,null!==this.awayTimer&&clearTimeout(this.awayTimer),"function"==typeof this.setup&&this.isStopped&&this.setup(),this.awayTimer=setTimeout((function(){return n.checkAway()}),this.awayTimeout+100),this.isStopped=!1,this}},{key:"stop",value:function(){return null!==this.awayTimer&&clearTimeout(this.awayTimer),void 0!==this.listener&&("function"==typeof document.removeEventListener&&(window.removeEventListener("focus",this.listener,!1),document.removeEventListener("visibilitychange",this.listener,!1),document.removeEventListener("webkitvisibilitychange",this.listener,!1)),this.listener=void 0),this.isStopped=!0,"function"==typeof this.onStopped&&(this.onStopped(),"function"==typeof this.teardown&&this.teardown()),this}},{key:"setAwayTimeout",value:function(n){return this.awayTimeout=parseInt(n,10),this}},{key:"checkAway",value:function(){var n=this,e=(new Date).getTime();if(e<this.awayTimestamp)return this.isUserAway=!1,void(this.awayTimer=setTimeout((function(){return n.checkAway()}),this.awayTimestamp-e+100));null!==this.awayTimer&&clearTimeout(this.awayTimer),this.isUserAway=!0,this.lastActive=(new Date).getTime(),"function"==typeof this.onAway&&this.onAway()}},{key:"handleVisibilityChange",value:function(){if("function"==typeof this.onScreenHidden&&"hidden"===document.visibilityState){if(!this._isVisible)return;return null!==this.awayTimer&&clearTimeout(this.awayTimer),this._isVisible=!1,this.isUserAway=!0,this.lastActive=(new Date).getTime(),this.onScreenHidden(),void("function"==typeof this.onAway&&this.onAway())}if(!document.hasFocus()&&"function"==typeof this.onScreenVisible&&("hidden"in document&&!1===document.hidden||"visible"===document.visibilityState)){if(this._isVisible)return;this._isVisible=!0,this.onActive(),this.onScreenVisible()}}}]),n}(),B=function(n){var e=n.onPageNotActive,r=void 0===e?function(){}:e,o=n.onPageNowActive,u=void 0===o?function(){}:o,a=n.onStopped,c=void 0===a?function(){}:a,s=n.onPageHidden,l=void 0===s?function(){}:s,f=n.onPageVisible,d=void 0===f?function(){}:f,v=n.ACTIVITY_TIMEOUT_DURATION,p=void 0===v?3e3:v,h=A(i((function(){return new q({awayTimeout:p,onAway:r,onAwayBack:u,onVisible:d,onStopped:c,onHidden:l})})),1)[0];return t((function(){return h.isStopped&&h.start(),function(){h.isStopped||h.stop()}}),[]),{updatePageActivityTimeoutInMilliseconds:function(n){h.setAwayTimeout(String(n))}}},U=n.createContext(null);function V(e){var t=e.children;if(!({}.hasOwnProperty.call(n,"useMemo")&&{}.hasOwnProperty.call(n,"useCallback")))return new Error("EventBusProvider[Error]: You are using a ReactJS version that ddoesn't support memo hooks");var r=o((function(){return{}}),[]);return n.createElement(U.Provider,{value:r},t)} /**! * `useBus()` ReactJS hook */var z=function(n){var e=n.subscribes,t=void 0===e?[]:e,o=n.fires,i=void 0===o?[]:o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"<no bus name>",c=u(U),s=r({eventsFired:{},eventsFiredCount:0,eventsSubscribed:{},eventsSubscribedCount:t.length,eventsFiredPath:[]});if(null==c)throw new Error('[react-busser]: "useBus()" must be used with the <EventBusProvider>');var l=r({on:function(n,e){c[n]||(c[n]=[]),"function"==typeof e&&(-1===t.indexOf(n)&&(s.current.eventsSubscribedCount=t.push(n)),void 0===s.current.eventsSubscribed[n]&&(s.current.eventsSubscribed[n]={}),s.current.eventsSubscribed[n].timestamp=Date.now(),s.current.eventsSubscribed[n].name=a,c[n].push(e))},off:function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=0;e<t.length;e++){var r=t[e],o=c[r];if(o){var i=o.indexOf(n);-1!==i?o.splice(i,1):delete c[r]}}},emit:function(n){var e=[];if(n in c&&i.indexOf(n)>-1){for(var t=c[n],r=arguments.length,o=new Array(r>1?r-1:0),u=1;u<r;u++)o[u-1]=arguments[u];for(var l=0;l<t.length;l++){var f=t[l];"function"==typeof f&&(s.current.eventsFiredCount++,void 0===s.current.eventsFired[n]&&(s.current.eventsFiredPath.push({eventName:o}),s.current.eventsFired[n]={}),s.current.eventsFired[n].timestamp=Date.now(),s.current.eventsFired[n].data=o,s.current.eventsFired[n].name=a,e.push(f.apply(null,o)))}}return e}}).current;return[Object.freeze(l),s.current]},J=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return null},t=r(n||function(){return null});return t.current=n,e((function(){return t.current.apply(t,arguments)}),[])},H=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(n){return n},r=[n],o=A(z({subscribes:r,fires:r},arguments.length>2&&void 0!==arguments[2]?arguments[2]:"<no name>"),1)[0],i=J(t);return e((function(){var e=i.apply(void 0,arguments);o.emit.apply(o,Array.isArray(e)?[n].concat(P(e)):[n,e])}),[o,n,i])},K=function(n,t){var r=J(arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(n){return n});return e((function(){var e=r.apply(void 0,arguments);n.emit.apply(n,Array.isArray(e)?[t].concat(P(e)):[t,e])}),[n,t,r])},M=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"<no name>",u=Array.isArray(n)||"string"!=typeof n,a=r(u?n:[n]).current,c=A(z({subscribes:a,fires:a},i),2),s=c[0],l=c[1],f=o((function(){return u?a.map((function(n){return function(n){return e.bind(null,n)}(n)})):[e]}),[u,a,e]);return t((function(){return a.forEach((function(n,e){s.on(n,f[e])})),function(){var n=-1;a.forEach((function(){++n,s.off(f[n])}))}}),[s,a,f]),[s,l]},G=function(n,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){return[!1,"Are you sure ?"]},o=H(n,(function(n){return n}),arguments.length>2&&void 0!==arguments[2]?arguments[2]:"<no name>"),i=J(r||function(){return[!1,"Are you sure ?"]});t((function(){if(!e||"function"!=typeof e.block||"string"!=typeof n)return function(){return null};var t=e.block((function(){for(var n=arguments.length,e=new Array(n),r=0;r<n;r++)e[r]=arguments[r];var u=A(i.apply(void 0,e),2),a=u[0],c=u[1];if(a){if(!window.confirm(c))return o([].concat(e,[!1])),!1;t(),o([].concat(e,[!0]))}}));return function(){return t()}}),[e,o,n,i])},W=function(n,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=H(n,(function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return{location:e[0],action:e[1]}}),arguments.length>2&&void 0!==arguments[2]?arguments[2]:"<no name>"),i=J(r||function(){});t((function(){if(!e||"function"!=typeof e.listen||"string"!=typeof n)return function(){return null};var t=e.listen((function(){i(),o.apply(void 0,arguments)}));return function(){return t()}}),[e,o,n,i])},Q=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return Promise.resolve(!1)},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"<no name>",o=A(i(null),2),u=o[0],a=o[1],c=e("string"==typeof n?function(n){try{var e=t(n);return e instanceof Promise?e:Promise.reject(!1)}catch(n){a(n)}}:function(n,e){try{var r=t(n,e);return r instanceof Promise?r:Promise.reject(!1)}catch(n){a(n)}}),s=A(M(n,c,r),2),l=s[0];return[void 0,function(n,e){return K(l,n,e)},u,s[1]]},Y=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"<no name>";if("string"!=typeof r)throw new Error('[react-busser]: "useProperty()" invalid `initial` argument');var u=A(i(r),2),a=u[0],c=u[1],s=A(i(null),2),l=s[0],f=s[1],d=e("string"!=typeof n?function(n,e){c((function(r){var o;try{o=t(r,e,n)}catch(n){setTimeout((function(){return f(n)}),0),o=r}return o}))}:function(n){c((function(e){var r;try{r=t(e,n)}catch(n){setTimeout((function(){return f(n)}),0),r=e}return r}))},[t]),v=A(M(n,d,o),2),p=v[0];return[a,function(n,e){return K(p,n,e)},l,v[1]]},X=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"<no name>";if("string"!=typeof r)throw new Error('[react-busser]: "useProperty()" invalid `initial` argument');var i=A(k(r),2),u=i[0],a=i[1],c=A(k(null),2),s=c[0],l=c[1],f=e("string"!=typeof n?function(n,e){a((function(r){var o;try{o=t(r,e,n)}catch(n){setTimeout((function(){return l(n)}),0),o=r}return o}))}:function(n){a((function(e){var r;try{r=t(e,n)}catch(n){setTimeout((function(){return l(n)}),0),r=e}return r}))},[t]),d=A(M(n,f,o),2),v=d[0];return[u,function(n,e){return K(v,n,e)},s,d[1]]},Z=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"<no name>";if(!Array.isArray(r))throw new Error('[react-busser]: "useList()" invalid `initial` argument');var u=A(i(r),2),a=u[0],c=u[1],s=A(i(null),2),l=s[0],f=s[1],d=e("string"!=typeof n?function(n,e){c((function(r){var o;try{o=t(r,e,n)}catch(n){setTimeout((function(){return f(n)}),0),o=r}return o}))}:function(n){c((function(e){var r;try{r=t(e,n)}catch(n){setTimeout((function(){return f(n)}),0),r=e}return r}))},[t]),v=A(M(n,d,o),2),p=v[0];return[a,function(n,e){return K(p,n,e)},l,v[1]]},nn=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"<no name>";if(!Array.isArray(r))throw new Error('[react-busser]: "useSignalsList()" invalid `initial` argument');var i=A(k(r),2),u=i[0],a=i[1],c=A(k(null),2),s=c[0],l=c[1],f=e("string"!=typeof n?function(n,e){a((function(r){var o;try{o=t(r,e,n)}catch(n){setTimeout((function(){return l(n)}),0),o=r}return o}))}:function(n){a((function(e){var r;try{r=t(e,n)}catch(n){setTimeout((function(){return l(n)}),0),r=e}return r}))},[t]),d=A(M(n,f,o),2),v=d[0];return[u,function(n,e){return K(v,n,e)},s,d[1]]},en=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"<no name>";if(!(r instanceof Object))throw new Error('[react-busser]: "useComposite()" invalid `initial` argument');var u=A(i(g({},r)),2),a=u[0],c=u[1],s=A(i(null),2),l=s[0],f=s[1],d=e("string"!=typeof n?function(n,e){c((function(r){try{return g({},t(r,e,n))}catch(n){return setTimeout((function(){return f(n)}),0),r}}))}:function(n){c((function(e){try{return g({},t(e,n))}catch(n){return setTimeout((function(){return f(n)}),0),e}}))},[t]),v=A(M(n,d,o),2),p=v[0];return[a,function(n,e){return K(p,n,e)},l,v[1]]},tn=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"<no name>";if(!(r instanceof Object))throw new Error('[react-busser]: "useSignalsComposite()" invalid `initial` argument');var i=A(k(g({},r)),2),u=i[0],a=i[1],c=A(k(null),2),s=c[0],l=c[1],f=e("string"!=typeof n?function(n,e){a((function(r){try{return g({},t(r,e,n))}catch(n){return setTimeout((function(){return l(n)}),0),r}}))}:function(n){a((function(e){try{return g({},t(e,n))}catch(n){return setTimeout((function(){return l(n)}),0),e}}))},[t]),d=A(M(n,f,o),2),v=d[0];return[u,function(n,e){return K(v,n,e)},s,d[1]]},rn=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0,u=o.start,a=void 0===u?0:u,c=o.min,s=void 0===c?Number.MIN_SAFE_INTEGER:c,l=o.max,f=void 0===l?Number.MAX_SAFE_INTEGER:l,d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"<no name>";if("number"!=typeof a||"number"!=typeof s||"number"!=typeof f)throw new Error('[react-busser]: "useCount()" incorrect count bounds data type');if(a<s||a>f)throw new Error('[react-busser]: "useCount()" incorrect count bounds range');var v=r({min:s,max:f}),p=A(i(a),2),h=p[0],m=p[1],g=A(i(null),2),y=g[0],w=g[1],b=e((function(n,e){m((function(r){var o=r+1,i=r-1,u=v.current;try{return i<u.min&&o>u.max?r:t(r,e,n)}catch(n){return setTimeout((function(){return w(n)}),0),r}}))}),[t]),S=A(M(n,b,d),2),E=S[0];return[h,function(n,e){return K(E,n,e)},y,S[1]]},on=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0,i=o.start,u=void 0===i?0:i,a=o.min,c=void 0===a?Number.MIN_SAFE_INTEGER:a,s=o.max,l=void 0===s?Number.MAX_SAFE_INTEGER:s,f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"<no name>";if("number"!=typeof u||"number"!=typeof c||"number"!=typeof l)throw new Error('[react-busser]: "useSignalsCount()" incorrect count bounds data type');if(u<c||u>l)throw new Error('[react-busser]: "useSignalsCount()" incorrect count bounds range');var d=r({min:c,max:l}),v=A(k(u),2),p=v[0],h=v[1],m=A(k(null),2),g=m[0],y=m[1],w=e((function(n,e){h((function(r){var o=r+1,i=r-1,u=d.current;try{return i<u.min&&o>u.max?r:t(r,e,n)}catch(n){return setTimeout((function(){return y(n)}),0),r}}))}),[t]),b=A(M(n,w,f),2),S=b[0];return[p,function(n,e){return K(S,n,e)},g,b[1]]},un=function(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:500,r=!0;return function(){if(r){var o=n.call.apply(n,[null].concat(P(e)));return r=!1,setTimeout((function(){r=!0}),t),o}return function(){}}},an=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n.includes(".")?n.split(".").reduce((function(n,e){return"object"===w(n)?n[e]:n}),e):e[n]},cn=function(){var n,e,t,r,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",u=[];n:for(n=0;n<o.length;++n){for(e=0;e<u.length;++e)if(t=u[e],t=""!==i&&"string"!=typeof t?an(i,t):t,r=o[n],t===(r=""!==i&&"string"!=typeof r?an(i,r):r))continue n;u.push(o[n])}return u}; /**! * `useUpon()` ReactJS hook */function sn(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r={};for(var o in t||(t=[]),n)if(n.hasOwnProperty(o)&&"__proto__"!==o&&-1==t.indexOf(n[o]))if(e.hasOwnProperty(o))if(n[o]===Object(n[o])){var i=sn(n[o],e[o]);Object.keys(i).length>0&&(r[o]=i)}else n[o]!==e[o]&&(void 0===n[o]&&(r[o]="undefined"),null===n[o]?r[o]=null:"function"==typeof n[o]?r[o]="function":"object"===w(n[o])?r[o]="object":r[o]=n[o]);else r[o]=n[o];return r}var ln,fn=function(n,e){return!h(sn(n,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]))},dn=n.createContext(null),vn=function(){var n=r(!0);return n.current?(n.current=!1,!0):n.current},pn=function(n){var e=n.storageType,t=void 0===e?"local":e;return{setToStorage:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r="session"===t?sessionStorage:localStorage;if(r&&"function"==typeof r.setItem)try{if(null!==e&&"string"==typeof n)return r.setItem(n,"string"==typeof e?e:JSON.stringify(e)),!0}catch(n){if("QuotaExceededError"===n.name)return!1}return!1},hasKeyInStorage:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e="session"===t?sessionStorage:localStorage;return Object.keys(e).filter((function(e){return e.toLowerCase()===n.toLowerCase()})).length>0},hasKeyPrefixInStorage:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e="session"===t?sessionStorage:localStorage;return Object.keys(e).filter((function(e){return e.toLowerCase().startsWith(n.toLowerCase())})).length>0},clearFromStorage:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e="session"===t?sessionStorage:localStorage;if(e&&"function"==typeof e.removeItem){try{e.removeItem(n)}catch(n){return!1}return!0}return!1},getFromStorage:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="session"===t?sessionStorage:localStorage,o=null;try{r&&"function"==typeof r.getItem&&null===(o=r.getItem(n))&&void 0!==e&&r.setItem(n,"string"==typeof e?e:JSON.stringify(e))}catch(u){"SecurityError"===u.name&&(o=null)}var i=null;try{i=o?JSON.parse(o):e}catch(n){var u;i=e,"SyntaxError"===n.name&&null!==o&&(i=o)}return i}}},hn=new Set,mn=(ln=hn,function(n,e,t){return{getState:function(e){return""!==e&&e?e&&"string"==typeof e?n.current[e]:{}:JSON.parse(JSON.stringify(n.current))},dispatch:function(r){var o,i,u=this.getState("");if("function"==typeof r){var a=r(u);o=a.slice,i=a.value}else o=r.slice,i=r.value;void 0===o?n.current=i:n.current[o]=i,"none"!==e.persistOn&&t(e.persistKey,n.current);var c,s=function(n,e){var t="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=x(n))||e&&n&&"number"==typeof n.length){t&&(n=t);var r=0,o=function(){};return{s:o,n:function(){return r>=n.length?{done:!0}:{done:!1,value:n[r++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){t=t.call(n)},n:function(){var n=t.next();return u=n.done,n},e:function(n){a=!0,i=n},f:function(){try{u||null==t.return||t.return()}finally{if(a)throw i}}}}(ln);try{for(s.s();!(c=s.n()).done;){var l=A(c.value,2),f=l[0],d=l[1],v=w(d?u[d]:u),p=w(d?n.current[d]:n.current),h=!1;h="object"===v||"object"===p?fn(n.current,u):d?u[d]!==n.current[d]:u!==n.current,d&&!h||f(d?n.current[d]:n.current)}}catch(n){s.e(n)}finally{s.f()}},subscribe:function(n,e){var t=[n,e];return ln.add(t),function(){ln.delete(t)}}}}),gn=function(e){var t=e.children,i=e.initialGlobalState,u=void 0===i?{}:i,a=e.persistence,c=void 0===a?{persistOn:"none",persistKey:"___$key___"}:a;if(!({}.hasOwnProperty.call(n,"useMemo")&&{}.hasOwnProperty.call(n,"useCallback")))return new Error("SharedGlobalStateProvider[Error]: You are using a ReactJS version that doesn't support memo hooks");var s=pn({storageType:"local"===c.persistOn?c.persistOn:"session"}),l=s.setToStorage,f=s.getFromStorage,d=s.hasKeyInStorage,v=r(f(c.persistKey,u||{})),p=o((function(){return mn(v,c,l)}),[v,c.persistKey,c.persistOn]);return"none"===c.persistOn||d(c.persistKey)||l(c.persistKey,v.current),n.createElement(dn.Provider,{value:p},t)},yn=function(n){var e=function(e){n(e)};t((function(){return window.addEventListener("storage",e),function(){window.removeEventListener("storage",e)}}),[])},wn=function(n){var e=n.storageType,t=void 0===e?"local":e,r=u(dn);if(null===r)throw new Error("useBrowserStorageWithEncryption[Error]: Load shared state provider before using hook");var o=r.getState("$__encryption-helpers");o||(console.error("`useBrowserStorageWithEncryption()` is missing `encryptionHelpers` from shared state"),o={});var i=o,a=i.encrypt,c=void 0===a?function(n){return String(n)}:a,s=i.decrypt,l=void 0===s?function(n){return n}:s,f=pn({storageType:t}),d=f.setToStorage,v=f.clearFromStorage,p=f.hasKeyInStorage,h=f.hasKeyPrefixInStorage,m=f.getFromStorage;return{setToStorage:function(n){var e=c(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null);return"string"==typeof e&&d(n,e)},hasKeyInStorage:function(){return p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")},hasKeyPrefixInStorage:function(){return h(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")},clearFromStorage:function(){return v(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")},getFromStorage:function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=l(m(n,e));return t||e}}}; /**! * `useOutsideClick()` ReactJS hook */ function bn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},e=r(null),o=function(t){e.current&&(e.current.contains(t.target)||"function"==typeof n&&n(e.current,t.target))};return t((function(){return window.document.addEventListener("click",o),function(){window.document.removeEventListener("click",o)}}),[]),[e]}var Sn=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=function(t){e.includes(t.key)&&"function"==typeof n&&n(t.key,t.target)};t((function(){return window.document.addEventListener("keyup",r),function(){window.document.removeEventListener("keyup",r)}}),[])},En={sortBy:function(){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(n){return n},t="string"==typeof n||"number"==typeof n?function(t){return"object"!==w(t)?t:e?e(t[n]):t[n]}:function(n){return e?e(n):n},r="ASC"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ASC")?1:-1;return function(n,e){var o=t(n),i=t(e);return r*((o>i)-(i>o))}}},Tn={specific:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[""];return""===n?e:e.filter((function(e){return t.reduce((function(t,r){var o="object"!==w(e)?e:an(r,e),i="string"==typeof o?o.toLowerCase():String(o).toLowerCase(),u=n.toLowerCase();return""===n||i.indexOf(u)>-1||t}),!1)}))},fuzzy:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[""];if(""===n)return e;var r=n.split(""),o=Array.prototype.concat.apply([],r.map((function(n){return e.filter((function(e){return t.reduce((function(t,r){var o=n.toLowerCase(),i="object"!==w(e)?e:an(r,e),u=!0;return-1===("string"==typeof i?i.toLowerCase():String(i).toLowerCase()).indexOf(o)&&(u=!1),u||t}),!1)}))})));return cn(t.flatMap((function(n){return cn(o,n)})))},complete:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[""];return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).filter((function(t){return e.reduce((function(e,r){for(var o="object"!==w(t)?t:an(r,t),i="string"==typeof o?o.toLowerCase():String(o).toLowerCase(),u=n.toLowerCase(),a=!0,c=-1,s=0,l=u[s]||null;null!==l;){if(-1===(c=i.indexOf(l,c+1))){a=!1;break}l=u[s+=1]||null}return a||e}),!1)}))}},An=function(){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];b(this,n),this.length=0,Array.isArray(e)&&this.push.apply(this,e)}return E(n,[{key:"isEmpty",value:function(){return 0===this.length}},{key:"size",value:function(){return this.length}},{key:"peek",value:function(){return this[this.size()-1]}},{key:"peer",value:function(){return this[0]}},{key:"push",value:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return Array.prototype.push.apply(this,e)}},{key:"pop",value:function(){return Array.prototype.pop.call(this)}},{key:"replaceTop",value:function(){this.pop(),this.push.apply(this,arguments)}},{key:"toJSON",value:function(){return"[ "+Array.prototype.slice.call(this,0).join(", ")+" ]"}},{key:"toObject",value:function(){try{return JSON.parse(this.toJSON())}catch(n){return n instanceof Error&&"SyntaxError"===n.name?Array.prototype.slice.call(this,0,this.size()):[]}}}]),n}(),Pn=function(){var n=r(!1);return t((function(){return n.current=!0,function(){n.current=!1}}),[]),n.current},Cn=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=r(void 0);return t((function(){e.current!==n&&(e.current=n)}),[n]),e.current},$n=function(){var n=A(k((function(){return"undefined"!=typeof window&&document.hasFocus()})),2),e=n[0],t=n[1],r=function(){t(document.hasFocus())};return j((function(){return window.addEventListener("blur",r),window.addEventListener("focus",r),function(){window.removeEventListener("blur",r),window.removeEventListener("focus",r)}}),[]),e},xn=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},e=arguments.length>1?arguments[1]:void 0,r=e.when,o=void 0!==r&&r,i=e.message,u=void 0===i?"":i,a=e.extraWatchProperty;t((function(){function e(t){return t.preventDefault(),n.call(null,t.target),window.removeEventListener("beforeunload",e),""!==u?(t.returnValue=u,u):void(t.returnValue=void 0)}return o&&window.addEventListener("beforeunload",e),function(){o&&window.removeEventListener("beforeunload",e)}}),[o,u,void 0===a?"":a])},_n=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},e=arguments.length>1?arguments[1]:void 0,t=e.when,r=void 0!==t&&t,o=e.message,i=void 0===o?"":o;j((function(){var e=function(e){return e.preventDefault(),n.call(null,e.target),e.returnValue=i,i};return r&&window.addEventListener("beforeunload",e),function(){return window.removeEventListener("beforeunload",e)}}),[r,i])}; /**! * @SOURCE_COPY: https://blog.logrocket.com/use-state-url-persist-state-usesearchparams/ * * `useSearchParamsState()` ReactJS hook */ function On(n,e,r){var o=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=d(),t=v();return[new URLSearchParams(e?e.search:t.location.search),function(r){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=new URLSearchParams(r),u=new URL("".concat(e.pathname).concat(i.toString().replace(/^([^?]+)/,"?$1")),window.location.origin);if(o)window.location.assign(u.href);else{if(r instanceof URLSearchParams)return void t.replace(u.href.replace(window.location.origin,""));n?t.replace(u.href.replace(window.location.origin,"")):t.push(u.href.replace(window.location.origin,""))}}]}("boolean"==typeof e&&e),i=A(o,2),u=i[0],a=i[1],c=u.get("string"==typeof n?n:""),s=null!=c?c:r||null;t((function(){r&&!c&&(u.set(n,r),a(new URLSearchParams(u.toString())))}),[r]);var l=function(e){return"function"==typeof Object.fromEntries?Object.assign({},Object.fromEntries(u.entries()),T({},n,encodeURIComponent(e))):Object.assign({},P(u.entries()).reduce((function(n,e){var t=A(e,2),r=t[0],o=t[1];return g(g({},n),{},T({},r,o))}),{}),T({},n,encodeURIComponent(e)))};return[s,function(e){var t={};"string"==typeof e?t=l(e):"function"==typeof e&&(t=l(e(u.get(n)))),a(t)},function(){var e=l(void 0);delete e[n],a(e)}]} /**! * `useIsDOMElementVisibleOnScreen()` ReactJS hook */var Ln=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{root:null,threshold:0},e=r(null),o=A(i(!1),2),u=o[0],a=o[1];return t((function(){var t=e.current,r=function(n){return a((function(){return n.isIntersecting}))},o=new window.IntersectionObserver((function(n){return n.forEach(r)}),n);return t&&o.observe(t),function(){return t&&o.unobserve(t)}}),[n]),[u,e]},kn=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{root:null,threshold:0},e=r(null),t=A(k(!1),2),o=t[0],i=t[1];return j((function(){var t=e.current,r=function(n){return i((function(){return n.isIntersecting}))},o=new window.IntersectionObserver((function(n){return n.forEach(r)}),n);return t&&o.observe(t),function(){return t&&o.unobserve(t)}}),[n]),[o,e]},jn=function(n){var t=n.useBrowserPrompt,r=void 0!==t&&t,o=A(i(!1),2),u=o[0],a=o[1],c=A(i(null),2),s=c[0],l=c[1];return{verifyConfimation:u,getUserConfirmation:e((function(n,e){if(r){var t=window.confirm(n);window.setTimeout((function(){"function"==typeof e&&e(t)}),1e3)}else l((function(n){"function"==typeof e&&e(n)})),a(!0)}),[r]),allowTransition:function(){a(!1),null!==s&&s(!0)},blockTransition:function(){a(!0),null!==s&&s(!1)}}},In=function(n){var e=n.unsavedChangesRouteKeysMap,o=void 0===e?{"/":"$___root_unsaved_items__"}:e,i=n.appPathnamePrefix,u=void 0===i?"/":i,a=n.getUserConfirmation,c=n.promptMessage,s=void 0===c?"You have unsaved items on this web page. Would you like to discard them ?":c,l=n.shouldBlockRoutingTo,f=void 0===l?function(){return!1}:l,p=n.onNavigation,h=void 0===p?function(){}:p,m=d(),g=v(),y=pn({storageType:"session"}),w=y.setToStorage,b=y.getFromStorage,S=y.clearFromStorage,E=r([m]),T=function(n,e){var t=b("$__former_url",m.pathname),r=o[t.replace(u,"/")]||"";if("saved"!==b(r,"saved"))return a(s,function(n,e,t){return function(r){return r?(w(n,"saved"),window.dispatchEvent(new Event("beforediscardunsaveditems")),!f(e.pathname)&&void t()):(w(n,"pending"),!1)}}(r,n,e))},A=function(n,e){var t=b("$__nav_stack",["".concat(document.location.origin).concat(m.pathname)]),r=function(n,e,t){var r=new An(n.current?n.current.slice(0):[]),o=e.toLowerCase();switch(o){case"pop":case"push":case"replace":return"replace"!==o?"pop"===o?(w("$__former_url",r.peek().pathname),r.pop()):(w("$__former_url",r.peek().pathname),r.push(t)):(w("$__former_url",r.peek().pathname),r.replaceTop(t)),r.toObject();default:return r.toObject()}}(E.current,e,n);w("$__nav_stack",r.map((function(n){return"".concat(document.location.origin).concat(n.pathname)}))),E.current=r;return h(g,{currentPathname:n.pathname,previousPathname:(t[t.length-1]||"").replace(document.location.origin,""),navigationDirection:{0:"refreshnavigation","-1":"backwardnavigation",1:"forwardnavigation","-9":"freshnavigation"}["PUSH"===e?"1":"POP"===e?"-1":"0"]})};return t((function(){var n=g.block((function(e){return T(e,n)})),e=g.listen((function(n,e){return A(n,e)}));return function(){if("function"==typeof n){for(var t in o)o.hasOwnProperty(t)&&w(t,"saved");n()}e()}}),[g]),t((function(){function n(e){e.preventDefault(),window.setTimeout((function(){window&&!window.closed||(S("$__former_url"),S("$__nav_stack"))}),0),window.removeEventListener("beforeunload",n),e.returnValue=void 0}return window.addEventListener("beforeunload",n),function(){window.removeEventListener("beforeunload",n)}}),[]),{get navigationList(){return E.current},getBreadCrumbsList:function(){for(var n,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",t=null,r=E.current.slice(0).reverse(),o=[],i=e.match(/(?:^\/)?[^/]+/g),a=C(n=i)||$(n)||x(n)||O(),c=a[0],s=a.slice(1).length+1,l=e.startsWith(u)?c:"".concat(u.startsWith("/")?u:"/"+u).concat(u.endsWith("/")?c.replace(/^\//,""):c.replace(/^([^/])/,"/$1")),f=0;f<r.length;f++){var d=r[f],v=d.pathname.split("/").length-1;if(!d.pathname.includes(l)){"/"===d.pathname&&(t=d);break}o.map((function(n){return n.pathname})).includes(d.pathname)||v<=s&&o.push(d)}return null!==t&&o.push(t),o.reverse()}}},Nn=function(){return(0,pn({storageType:"session"}).getFromStorage)("$__former_url",null)}; /**! * `useSignalsIsDOMElementVisibleOnScreen()` ReactJS hook */ /**! * `useTextFilteredList()` ReactJS hook */ function Rn(n,a){var c,s=n.text,l=void 0===s?"":s,f=n.page,d=void 0===f?1:f,v=n.list,h=a.filterTaskName,m=void 0===h?"specific":h,y=a.fetchRemoteFilteredList,w=void 0===y?function(){return Promise.resolve([])}:y,b=a.filterUpdateCallback,S=void 0===b?function(n){return function(){}}:b,E=a.onListChanged,T=void 0===E?function(n){}:E,P=r(Tn),C=u(dn),$=o((function(){return P.current}),[]);C&&(c=C.getState("$___text-filter-algos"));var x=($=Object.assign($,c||{}))?$[m]:function(){return[]},_=A(i((function(){return{text:l,isLoading:!1,list:v,page:d}})),2),O=_[0],L=_[1],k=r(p((function(n,e){return"function"==typeof w?w(n,e):Promise.resolve([])}),50)).current,j=e((function(n,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[""];if(e&&"change"===e.type&&"value"in e.target&&!e.defaultPrevented){var r=e.target.value;if(""===r)return void L((function(n){return g(g({},n),{},{text:r,isLoading:!1,list:v,page:1})}));L((function(n){return g(g({},n),{},{text:r,isLoading:!0})}));var o=n(r,v,t);if(0===o.length)return void(k(r,t)||new Promise((function(n){n([])}))).then((function(e){return L((function(o){return g(g({},o),{},{isLoading:!1,page:1,list:e.__fromCache?n(r,e,t):e})}))}));L({text:r,isLoading:!1,list:o,page:1})}}),[k,v]);return t((function(){0!==v.length?""===O.text?0===O.list.length||O.list.length!==v.length||O.list!==v?L((function(n){return g(g({},n),{},{list:v})})):O.page!==d&&L((function(n){return g(g({},n),{},{page:d,list:v})})):O.text===l&&O.list!==v&&L((function(n){return g(g({},n),{},{list:v})})):O.list.length!==v.length&&""===O.text&&L((function(n){return g(g({},n),{},{list:v})}))}),[v,l,O,d]),t((function(){var n=un(S,[O],1500),e=function(){};retur