UNPKG

@devlander/hooks

Version:
3 lines (2 loc) 40.4 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-native"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react","react-native","react/jsx-runtime"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).DevlanderHooks={},e.React,e.ReactNative,e.jsxRuntime)}(this,(function(e,t,r,n){"use strict";function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t,r,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function a(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function u(e){i(a,n,o,u,s,"next",e)}function s(e){i(a,n,o,u,s,"throw",e)}u(void 0)}))}}function u(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(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 l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(){c=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function f(e,t,r,n){var i=t&&t.prototype instanceof h?t:h,a=Object.create(i.prototype),u=new _(n||[]);return o(a,"_invoke",{value:C(e,r,u)}),a}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var p="suspendedStart",y="suspendedYield",v="executing",g="completed",m={};function h(){}function w(){}function E(){}var b={};l(b,a,(function(){return this}));var S=Object.getPrototypeOf,O=S&&S(S(D([])));O&&O!==r&&n.call(O,a)&&(b=O);var T=E.prototype=h.prototype=Object.create(b);function L(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(o,i,a,u){var s=d(e[o],e,i);if("throw"!==s.type){var l=s.arg,c=l.value;return c&&"object"==typeof c&&n.call(c,"__await")?t.resolve(c.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(c).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,u)}))}u(s.arg)}var i;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function C(t,r,n){var o=p;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var s=A(u,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=d(t,r,n);if("normal"===l.type){if(o=n.done?g:y,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=g,n.method="throw",n.arg=l.arg)}}}function A(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,A(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=d(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function R(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(R,this),this.reset(!0)}function D(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return w.prototype=E,o(T,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:w,configurable:!0}),w.displayName=l(E,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,l(e,s,"GeneratorFunction")),e.prototype=Object.create(T),e},t.awrap=function(e){return{__await:e}},L(x.prototype),l(x.prototype,u,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},L(T),l(T,s,"Generator"),l(T,a,(function(){return this})),l(T,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=D,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:D(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,u=[],s=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(u.push(n.value),u.length!==t);s=!0);}catch(e){l=!0,o=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||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 p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function y(e,t){if(e){if("string"==typeof e)return o(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}var v,g,m;e.DeviceCategory=void 0,(v=e.DeviceCategory||(e.DeviceCategory={})).ExtraSmall="ExtraSmall",v.Small="Small",v.Medium="Medium",v.Large="Large",v.ExtraLarge="ExtraLarge",e.DeviceCategoryType=void 0,(g=e.DeviceCategoryType||(e.DeviceCategoryType={})).SmallMobile="SmallMobile",g.Mobile="Mobile",g.Tablet="Tablet",g.Desktop="Desktop",g.LargeDesktop="LargeDesktop",g.TV="TV",e.ViewportCategory=void 0,(m=e.ViewportCategory||(e.ViewportCategory={})).ExtraSmall="ExtraSmall",m.Small="Small",m.Medium="Medium",m.Large="Large",m.ExtraLarge="ExtraLarge";var h=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["window","screen"],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.forcePortrait,a=o.forceLandscape,u=o.mediaQueryConfig,s=t.useMemo((function(){return{extraSmall:{maxWidth:360},small:{minWidth:360,maxWidth:640},medium:{minWidth:640,maxWidth:1024},large:{minWidth:1024,maxWidth:1440},extraLarge:{minWidth:1440}}}),[]),c=t.useMemo((function(){return l(l({},s),u)}),[s,u]),d=f(t.useState((function(){return r.Dimensions.get(n.includes("window")?"window":"screen")})),2),p=d[0],y=d[1],v=t.useRef(null),g=t.useCallback((function(e){var t=e.window,r=e.screen;v.current&&clearTimeout(v.current),v.current=setTimeout((function(){y(n.includes("window")?t:r)}),100)}),[n]);t.useEffect((function(){var e=r.Dimensions.addEventListener("change",g);return function(){return e.remove()}}),[g]);var m=t.useMemo((function(){return!!i||!a&&p.height>p.width}),[p,i,a]),h=t.useMemo((function(){var t=p.width,r=c.extraSmall,n=c.small,o=c.medium,i=c.large,a=c.extraLarge;return r&&t<=(r.maxWidth||0)?e.ViewportCategory.ExtraSmall:n&&t>=(n.minWidth||0)&&t<=(n.maxWidth||1/0)?e.ViewportCategory.Small:o&&t>=(o.minWidth||0)&&t<=(o.maxWidth||1/0)?e.ViewportCategory.Medium:i&&t>=(i.minWidth||0)&&t<=(i.maxWidth||1/0)?e.ViewportCategory.Large:(a&&a.minWidth,e.ViewportCategory.ExtraLarge)}),[p,c]);return t.useMemo((function(){return{isExtraSmall:h===e.ViewportCategory.ExtraSmall,isSmall:h===e.ViewportCategory.Small,isMedium:h===e.ViewportCategory.Medium,isLarge:h===e.ViewportCategory.Large,isExtraLarge:h===e.ViewportCategory.ExtraLarge,isPortrait:m,dimensions:p,orientation:m?"portrait":"landscape",viewportCategory:h}}),[h,m,p])};function w(e,t){switch(t.type){case"SET_FIELD":return l(l({},e),{},{formValues:l(l({},e.formValues),{},u({},t.field,t.value))});case"SET_ERRORS":return l(l({},e),{},{formErrors:t.errors});case"RESET_FORM":return l(l({},e),{},{formValues:t.values,formErrors:{}});default:return e}}var E;!function(e){e.NONE="",e.K="K",e.M="M",e.B="B",e.T="T",e.P="P",e.E="E"}(E||(E={}));function b(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 S(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){T(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function O(e){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O(e)}function T(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L(e){return function(e){if(Array.isArray(e))return x(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return x(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(e,t):void 0}}(e)||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 x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var C,A,R,I,_,D,j,M,N=function(e){return"[object Object]"===Object.prototype.toString.call(e)};function k(e,t,r,n){var o=S({},r),i=function(e,t){"number"==typeof t&&(t=t.toString());for(var r=t.toLowerCase(),n=Object.keys(e),o=n.length;o-- >0;){var i=n[o];if(r===i.toString().toLowerCase())return i}return null}(r,t)||t;N(r[i])&&N(e)?r[i]=n(o,t,e):N(e)?r[i]=n({},t,e):Array.isArray(e)?r[i]=e.slice():r[i]=e}function P(e){return new Promise((function(t,r){if("undefined"==typeof Blob||!(e instanceof Blob))return r(new Error("The provided value is not a valid Blob."));if("undefined"==typeof FileReader)return r(new Error("FileReader is not available in this environment."));var n=new FileReader;n.readAsDataURL(e),n.onloadend=function(){t(n.result)},n.onerror=function(){r(new Error("Error occurred while reading the Blob."))}}))}function F(e,t){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allOwnKeys,n=void 0!==r&&r;if(null!=e)if("object"!==O(e)&&(e=[e]),Array.isArray(e))for(var o=0,i=e.length;o<i;o++)t.call(null,e[o],o,e);else for(var a=n?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,s=0;s<u;s++){var l=a[s];t.call(null,e[l],l,e)}}!function(e){e.Only="Only",e.Exclusive="Exclusive to",e.Solely="Solely in"}(C||(C={})),function(e){e.IncludedIn="Included in",e.FoundWithin="Found in",e.PresentIn="Present in"}(A||(A={})),function(e){e.And="and",e.AsWellAs="as well as",e.AlongWith="along with"}(R||(R={})),function(e){e.STRING="string",e.OBJECT="object",e.ARRAY="array",e.NUMBER="number",e.MATRIX="matrix"}(I||(I={})),function(e){e.None=" ",e.Range="Range",e.Amount="Amount"}(_||(_={})),function(e){e.Empty=" ",e.UpTo="up to",e.About="about",e.Around="around",e.Approximately="approximately"}(D||(D={})),function(e){e.HTTPS="https://",e.HTTP="http://",e.NONE=""}(j||(j={})),function(e){e["4:3"]="4:3",e["16:9"]="16:9",e["1:1"]="1:1",e["3:2"]="3:2",e["8:5"]="8:5"}(M||(M={}));var U,V=function(e){return null==e||"object"===O(e)&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length},G=(U=Object.create(null),function(e){var t=toString.call(e);return U[t]||(U[t]=t.slice(8,-1).toLowerCase())}),B=function(e){return e=e.toLowerCase(),function(t){return G(t)===e}};function W(){for(var e={},t=function(t,r){k(t,r,e,W)},r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];for(var i=0,a=n;i<a.length;i++){var u=a[i];u&&F(u,t)}return e}B("ArrayBuffer"),B("Date"),B("File");var H=function e(t,r){var n=S({},t);return Object.keys(r).forEach((function(t){var o=r[t],i=n[t];Array.isArray(o)&&Array.isArray(i)?n[t]=[].concat(L(i),L(o)):"object"!==O(o)||null===o||Array.isArray(o)||"object"!==O(i)||Array.isArray(i)?n[t]=o:n[t]=e(i,o)})),n},z=function(){var e=f(t.useState({width:0,height:0,x:0,y:0}),2),r=e[0],n=e[1];return[r,t.useCallback((function(e){var t=e.nativeEvent.layout;n(t)}),[])]};function K(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.3125,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.3521;return{borderTopRightRadius:("string"==typeof e&&e.includes("%")?parseFloat(e.replace("%","")):Number(e))/100*r*100,borderBottomLeftRadius:("string"==typeof t&&t.includes("%")?parseFloat(t.replace("%","")):Number(t))/100*n*100}}function J(){var e=r.Dimensions.get("window");return e.height>=e.width?"portrait":"landscape"}var Y=function(e,t){switch(t.type){case"SET_LAYOUT":var n=t.payload.x+t.payload.width>r.Dimensions.get("window").width;return l(l({},e),{},{layout:t.payload,isOverflowing:n});case"SET_TEMP_UNIT":return l(l({},e),{},{tempUnit:t.payload});case"CONFIRM_UNIT":return l(l({},e),{},{unit:e.tempUnit});default:throw new Error("Unhandled action type")}},q=function(e,t){return"SET_LAYOUT"===t.type?t.payload:e},Z={tileCount:1,loadingTileCount:!0};function $(e,t){switch(t.type){case"SET_TILE_COUNT":return l(l({},e),{},{tileCount:t.payload});case"SET_LOADING":return l(l({},e),{},{loadingTileCount:t.payload});default:return e}}var Q={loading:!1,errors:[],resolvedSrc:void 0},X=function(e,t){switch(t.type){case"FETCH_INIT":return l(l({},e),{},{loading:!0,errors:[]});case"FETCH_SUCCESS":return l(l({},e),{},{loading:!1,resolvedSrc:t.payload});case"FETCH_FAILURE":return l(l({},e),{},{loading:!1,errors:[].concat(d(e.errors),[t.payload])});default:return e}};var ee={logs:{error:{},info:{},success:{},warning:{}},logsEmpty:{error:!0,info:!0,success:!0,warning:!0},toasts:{severity:"info",open:!1,message:"",autoHideDuration:1e4},loading:{}},te=function(e,t){switch(t.type){case"SET_LOGS":return l(l({},e),{},{logs:l(l({},e.logs),{},u({},t.payload.severity,t.payload.logs)),logsEmpty:l(l({},e.logsEmpty),{},u({},t.payload.severity,!1))});case"CLEAR_LOGS":return l(l({},e),{},{logs:l(l({},e.logs),{},u({},t.payload,{})),logsEmpty:l(l({},e.logsEmpty),{},u({},t.payload,!0))});default:return e}};var re={xs:{portrait:320,landscape:480},sm:{portrait:360,landscape:600},md:{portrait:768,landscape:1024},lg:{portrait:1024,landscape:1366},xl:{portrait:1440,landscape:1920}};function ne(){var e=r.Dimensions.get("window"),t=e.width;return e.height>=t?"portrait":"landscape"}function oe(e){var t=r.Dimensions.get("window").width,n=ne();return t>=e.xl[n]?"xl":t>=e.lg[n]?"lg":t>=e.md[n]?"md":t>=e.sm[n]?"sm":"xs"}function ie(e,t){return"SET_DIMENSIONS"===t.type?l(l({},e),{},{width:t.payload.width,orientation:ne(),sizeCategory:oe(t.payload.breakpoints)}):e}var ae;e.VisibilityOffset=void 0,(ae=e.VisibilityOffset||(e.VisibilityOffset={}))[ae.FULL=1]="FULL",ae[ae.PARTIAL=.5]="PARTIAL",ae[ae.MINIMAL=.25]="MINIMAL";var ue=function(e,t){switch(t.type){case"SET_DIMENSIONS":return l(l({},e),{},{dimensions:t.payload});case"SET_LAST_VALUE":return l(l({},e),{},{lastValue:t.payload});default:return e}},se={fileData:"",alert:"",loading:!1},le=function(e,t){switch(t.type){case"SET_FILE_DATA":return l(l({},e),{},{fileData:t.payload,loading:!1});case"SET_ALERT":return l(l({},e),{},{alert:t.payload,loading:!1});case"SET_LOADING":return l(l({},e),{},{loading:!0});default:return e}};function ce(){return{left:37,up:38,right:39,down:40,spacebar:32,pageup:33,pagedown:34,end:35,home:36}}function fe(){function e(e){e.preventDefault()}return{preventDefault:e,preventDefaultForScrollKeys:function(t){if({left:37,up:38,right:39,down:40,spacebar:32,pageup:33,pagedown:34,end:35,home:36}[t.keyCode])return e(t),!1}}}var de={isLoading:!1,isLoggingIn:!1,isLoggingOut:!1,isRefreshing:!1,isContinuingAsGuest:!1,isRegistering:!1,session:null,isGuest:!1,isUser:!1,status:"loggedOut",error:null,loginError:null,logoutError:null,refreshError:null,guestError:null,registerError:null};function pe(e,t){switch(t.type){case"INITIALIZING":return l(l({},e),{},{isLoading:!0,status:"initializing"});case"INITIALIZE":return l(l({},e),{},{isLoading:!1,session:t.payload.session,isGuest:t.payload.isGuest,isUser:!!t.payload.session,status:t.payload.session?"loggedIn":"loggedOut",error:null});case"SET_LOADING":return l(l({},e),{},u({},t.payload,!0));case"AUTH_SUCCESS":return l(l({},e),{},{isLoggingIn:"login"!==t.payload.actionType&&e.isLoggingIn,isRegistering:"register"!==t.payload.actionType&&e.isRegistering,session:t.payload.session,isUser:!0,loginError:null,registerError:null});case"LOGOUT_SUCCESS":return l(l({},e),{},{isLoggingOut:!1,session:null,isUser:!1,logoutError:null});case"CONTINUE_AS_GUEST_SUCCESS":return l(l({},e),{},{isContinuingAsGuest:!1,session:null,isGuest:!0,guestError:null});case"REFRESH_SUCCESS":return l(l({},e),{},{isRefreshing:!1,refreshError:null});case"ERROR":return l(l({},e),{},u(u({},t.payload.method,!1),"".concat(t.payload.method,"Error"),t.payload.message));case"RESET":return l({},de);default:return e}}function ye(){var e=f(t.useReducer(pe,de),2);return[e[0],e[1]]}var ve=t.createContext(null),ge=t.createContext(null);var me;e.NavigationKey=void 0,(me=e.NavigationKey||(e.NavigationKey={})).Enter="Enter",me.Tab="Tab",me.ArrowDown="ArrowDown",me.ArrowUp="ArrowUp",me.ArrowLeft="ArrowLeft",me.ArrowRight="ArrowRight",me.Space=" ",e.AuthDispatchContext=ge,e.AuthProvider=function(e){var t=e.children,r=f(ye(),2),o=r[0],i=r[1];return n.jsx(ve.Provider,{value:o,children:n.jsx(ge.Provider,{value:i,children:t})})},e.AuthStateContext=ve,e.authReducer=pe,e.defaultBreakpoints=re,e.formReducer=w,e.getOrientation=J,e.initialAuthState=de,e.loggingReducer=function(e,t){switch(t.type){case"SET_LOGS":var r=t.payload,n=r.logs,o=r.severity;return l(l({},e),{},{logs:l(l({},e.logs),{},u({},o,l(l({},e.logs[o]),n))),logsEmpty:l(l({},e.logsEmpty),{},u({},o,0===Object.keys(n).length))});case"CLEAR_LOGS":var i=t.payload;return l(l({},e),{},{logs:l(l({},e.logs),{},u({},i,{})),logsEmpty:l(l({},e.logsEmpty),{},u({},i,!0))});case"TOGGLE_TOAST":var a=t.payload,s=a.severity,c=a.open,f=a.message,d=void 0===f?"":f,p=a.autoHideDuration,y=void 0===p?1e4:p;return l(l({},e),{},{toasts:{severity:s,open:c,message:d,autoHideDuration:y}});case"SET_LOADING":var v=t.payload,g=v.id,m=v.loading;return l(l({},e),{},{loading:l(l({},e.loading),{},u({},g,m))});default:return e}},e.useAbbreviateNumber=function(e){var r=e||{},n=r.input,o=r.rounding,i=void 0===o?"none":o,a=r.case,u=void 0===a?"upper":a,s=t.useMemo((function(){var e=function(e,t){var r=[E.NONE,E.K,E.M,E.B,E.T,E.P,E.E];if(void 0===e)return"";var n="string"==typeof e?parseFloat(e):e;if(isNaN(n))return"Invalid input";var o=Math.log10(Math.abs(n))/3|0;if(0===o)return n.toString();var i=r[o],a=n/Math.pow(10,3*o);if(null!=t&&t.rounding)switch(t.rounding){case"up":a=Math.ceil(10*a)/10;break;case"down":a=Math.floor(10*a)/10}return"lower"===(null==t?void 0:t.case)?i=i.toLowerCase():"upper"===(null==t?void 0:t.case)&&(i=i.toUpperCase()),a.toFixed(1)+i}(n,{rounding:i,case:u});return e.replace(/\.0(?=[A-Za-z])/,"")}),[n,i,u]);return s},e.useAuthDispatch=function(){var e=t.useContext(ge);if(null===e)throw new Error("useAuthDispatch must be used within an AuthProvider");return e},e.useAuthReducer=ye,e.useAuthState=function(){var e=t.useContext(ve);if(null===e)throw new Error("useAuthState must be used within an AuthProvider");return e},e.useClientOnlyValue=function(e,t){return t},e.useColorsAndLocations=function(e){return t.useMemo((function(){var t=e.colors||[],r=e.locations||[],n=Math.max(t.length,r.length);return r.length<t.length&&(r=[].concat(d(r),[1])),{colors:Array.from({length:n},(function(e,r){return t[r]||"#FFFFFF"})),locations:Array.from({length:n},(function(e,t){return r[t]||0}))}}),[e.colors,e.locations])},e.useConditionalCallback=function(e,r){var n=Array.isArray(r)?r.every(Boolean):r;return t.useCallback((function(){e&&"function"==typeof e&&n&&e.apply(void 0,arguments)}),[e,n])},e.useConsistentKey=function(e,r){return t.useMemo((function(){var t=/^[a-zA-Z\s]+$/.test(e),n=t?e:r,o=t?r:e;if(n&&o){var i=n.replace(/\s+/g,"").toLowerCase().replace(/[^a-z0-9]/gi,"");return"".concat(o,"-").concat(i,"-key")}}),[e,r])},e.useContainerStyle=function(e,r){return t.useMemo((function(){var t=e?Array.isArray(e)?e.reduce((function(e,t){return l(l({},e),t)}),{}):e:{},n=r?Array.isArray(r)?r.reduce((function(e,t){return l(l({},e),t)}),{}):r:{};return l(l({},t),n)}),[e,r])},e.useDebounce=function(e,r){var n=f(t.useState(e),2),o=n[0],i=n[1];return t.useEffect((function(){var t=setTimeout((function(){i(e)}),r);return function(){clearTimeout(t)}}),[e,r]),o},e.useDeviceResponsiveState=h,e.useElementSize=function(){var e=t.useRef(null),r=f(t.useState({width:0,height:0,x:0,y:0}),2),n=r[0],o=r[1];return t.useEffect((function(){var t=function(){if(e.current){var t=e.current.getBoundingClientRect();o({width:t.width||0,height:t.height||0,x:t.x||0,y:t.y||0})}};return t(),window.addEventListener("resize",t),function(){window.removeEventListener("resize",t)}}),[]),[n,e]},e.useFileUploader=function(e){var r=e.validFileTypes,n=void 0===r?["image/jpeg","image/png","application/pdf"]:r,o=e.fileSizeLimit,i=void 0===o?1e6:o,u=e.Compressor,s=e.compressionOptions,d=void 0===s?{}:s,p=e.onProcessStart,y=e.onProcessEnd,v=f(t.useReducer(le,se),2),g=v[0],m=v[1],h=t.useRef(null),w=t.useCallback((function(e){m({type:"SET_ALERT",payload:e})}),[]),E=t.useCallback((function(e){return n.includes(e.type)?!(e.size>=i)||(w("Please upload a file smaller than ".concat(i/1e6,"MB")),!1):(w("Please upload a valid file type (".concat(n.join(", "),")")),!1)}),[i,n,w]),b=t.useCallback(function(){var e=a(c().mark((function e(t){var r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(m({type:"SET_LOADING"}),null==p||p(),e.prev=2,!u||!t.type.startsWith("image/")){e.next=7;break}new u(t,l(l({convertSize:50,quality:.5},d),{},{success:function(){var e=a(c().mark((function e(t){var r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,P(t);case 2:r=e.sent,m({type:"SET_FILE_DATA",payload:r}),null==y||y();case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),error:function(e){w("Error compressing image: ".concat(e.message)),null==y||y()}})),e.next=12;break;case 7:return e.next=9,P(t);case 9:r=e.sent,m({type:"SET_FILE_DATA",payload:r}),null==y||y();case 12:e.next=19;break;case 14:e.prev=14,e.t0=e.catch(2),console.error(e.t0),w("Error processing file"),null==y||y();case 19:case"end":return e.stop()}}),e,null,[[2,14]])})));return function(t){return e.apply(this,arguments)}}(),[u,d,w,p,y]),S=t.useCallback((function(e){h.current&&clearTimeout(h.current),h.current=setTimeout((function(){e&&E(e)&&b(e)}),300)}),[E,b]);return{fileData:g.fileData,alert:g.alert,loading:g.loading,handleFileChange:S}},e.useFormManager=function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=f(t.useReducer(w,{formValues:e,formErrors:{}}),2),i=o[0],a=o[1],s=function(e){var t=e.name,r=e.value;a({type:"SET_FIELD",field:t,value:r})};return{formState:i,handleChange:s,handleSubmit:function(){(function(){var e={};for(var t in n)if(n.hasOwnProperty(t)){var r=t,o=n[r],u=o?o(i.formValues[r]):null;u&&(e[r]=u)}return a({type:"SET_ERRORS",errors:e}),0===Object.keys(e).length})()&&r(i.formValues)},setFormErrors:function(e){a({type:"SET_ERRORS",errors:e})},resetForm:function(){a({type:"RESET_FORM",values:e})},getInputProps:function(e){return{value:i.formValues[e],onChangeText:function(t){return s({name:e,value:t})},onSubmitEditing:function(){var t,r=null===(t=n[e])||void 0===t?void 0:t.call(n,i.formValues[e]);r&&a({type:"SET_ERRORS",errors:l(l({},i.formErrors),{},u({},e,r))})},onFocus:function(){a({type:"SET_ERRORS",errors:l(l({},i.formErrors),{},u({},e,""))})},onBlur:function(){var t,r=null===(t=n[e])||void 0===t?void 0:t.call(n,i.formValues[e]);r&&a({type:"SET_ERRORS",errors:l(l({},i.formErrors),{},u({},e,r))})}}}}},e.useFormattedParagraphs=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=t.useMemo((function(){return e.split("\n")}),[e]);return t.useMemo((function(){return r.filter((function(e){return""!==e.trim()}))}),[r]).join("\n")},e.useGetMediaQueryInfo=function(){var e=h().dimensions.width;return{platform:r.Platform.OS,xSmall:e<640,small:e>=640&&e<768,medium:e>=768&&e<1024,large:e>=1024&&e<1280,xLarge:e>=1280&&e<1536,xxLarge:e>=1536}},e.useImageStyle=function(e,r){return t.useMemo((function(){var t=e&&!V(e)?e:{},n=r&&!V(r)?r:{};return l(l({},t),n)}),[e,r])},e.useIsMounted=function(){var e=t.useRef(!1);return t.useEffect((function(){return e.current=!0,function(){e.current=!1}}),[]),e},e.useKeyCodes=ce,e.useLeafStyle=function(e){var r=e.containerStyle,n=e.additionalContainerStyleFromTheme,o=e.imageStyle,i=f(z(),2),a=i[0],u=i[1],s=t.useMemo((function(){return H({maxWidth:"100%",maxHeight:"100%",overflow:"hidden",borderTopLeftRadius:0,borderTopRightRadius:25,borderBottomLeftRadius:25,borderBottomRightRadius:0},l(l({},n),r))}),[n,r]),c=t.useMemo((function(){return K(a.width||0,a.height||0)}),[a]),d=t.useMemo((function(){return l(l({},s),{},{borderTopRightRadius:c.borderTopRightRadius,borderBottomLeftRadius:c.borderBottomLeftRadius})}),[s,c]),p=t.useMemo((function(){return l({maxWidth:"100%",maxHeight:"100%",borderTopLeftRadius:0,borderBottomRightRadius:0},o)}),[o]),y=t.useMemo((function(){return K(a.width||0,a.height||0)}),[a]);return{mergedContainerStyles:d,mergedImageStyles:t.useMemo((function(){return l(l({},p),{},{borderTopRightRadius:y.borderTopRightRadius,borderBottomLeftRadius:y.borderBottomLeftRadius})}),[p,y]),setSize:u}},e.useLoggingReducer=function(e){var r=f(t.useReducer(te,ee),2),n=r[0],o=r[1],i=function(t,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];e.loggers.forEach((function(e){var n=e[t];n&&n.apply(void 0,[r].concat(o))}))};return{logState:n,dispatch:o,logInfo:function(e){i("info",e),o({type:"SET_LOGS",payload:{logs:e,severity:"info"}})},logError:function(e){i("error",e),o({type:"SET_LOGS",payload:{logs:e,severity:"error"}})},logSuccess:function(e){i("log",e),o({type:"SET_LOGS",payload:{logs:e,severity:"success"}})},logWarning:function(e){i("warn",e),o({type:"SET_LOGS",payload:{logs:e,severity:"warning"}})},resetLogs:function(e){e?o({type:"CLEAR_LOGS",payload:e}):["info","error","success","warning"].forEach((function(e){o({type:"CLEAR_LOGS",payload:e})}))}}},e.useMergedObjects=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var o=t.useMemo((function(){return JSON.stringify(r)}),[r]);return t.useMemo((function(){var e=JSON.parse(o);if(!e||0===e.length)return{};var t=e.filter((function(e){return null!=e}));return W.apply(void 0,[{}].concat(d(t)))}),[o])},e.useMergedProps=function(e,r){var n=t.useCallback((function(e,t){for(var r in t)t[r]&&"object"===p(t[r])&&!Array.isArray(t[r])?(e[r]&&"object"===p(e[r])||(e[r]={}),n(e[r],t[r])):e[r]=t[r];return e}),[]);return t.useMemo((function(){return n(l({},e),r)}),[n,e,r])},e.useNextInputFocus=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.navigationKey,n=void 0===r?"Enter":r,o=e.scrollIntoViewOptions,i=void 0===o?{behavior:"smooth",block:"center"}:o,a=t.useRef([]),u=t.useCallback((function(e,t){e&&(a.current[t]=e)}),[]),s=t.useCallback((function(e,t,r){if(e.key===n)if(e.preventDefault(),t<r-1){var o=a.current[t+1];if(o){o.focus();var u=o.getBoundingClientRect();(u.top<0||u.bottom>(window.innerHeight||document.documentElement.clientHeight))&&o.scrollIntoView(i)}}else{var s=e.target.closest("form");s&&s.requestSubmit()}}),[n,i]);return{setInputRef:u,handleKeyDown:s}},e.useNextTextInputFocus=function(e){var n=t.useRef([]);return{registerInput:t.useCallback((function(e,t){e&&(n.current[t]=e)}),[]),handleNextInput:t.useCallback((function(t){var o=n.current[t+1];o?o.focus():(e&&e(),r.Keyboard.dismiss())}),[e])}},e.useOnClickByClassName=function(e){var r=e.className,n=void 0===r?"onclick-class":r,o=e.onClick;return t.useCallback((function(e){e.target&&e.target.className&&"function"==typeof e.target.className.includes&&e.target.className.includes(n)&&"function"==typeof o&&o()}),[n,o])},e.useOnPressByStyle=function(e){var n=e.styleName,o=e.onPress;return t.useCallback((function(e){var t=r.StyleSheet.flatten(e);if(t&&t[n]&&"function"==typeof o)return o}),[n,o])},e.useOrientation=function(){var e=f(t.useState(J()),2),n=e[0],o=e[1],i=function(){var e=r.Dimensions.get("window"),t=e.height,n=e.width;o(t>=n?"portrait":"landscape")};return t.useEffect((function(){var e=r.Dimensions.addEventListener("change",i);return function(){null!=e&&e.remove&&e.remove()}}),[]),n},e.useOverflowAdjuster=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=f(t.useReducer(Y,{unit:e,tempUnit:e,isOverflowing:!1,layout:{width:0,x:0}}),2),i=o[0],a=o[1],u=t.useCallback((function(e){var t=e.nativeEvent.layout.width,o=e.nativeEvent.layout.x;a({type:"SET_LAYOUT",payload:{width:t,x:o}});for(var u=i.tempUnit,s=r.Dimensions.get("window").width;u>0&&o+t>s;)u-=n,t-=n;a({type:"SET_TEMP_UNIT",payload:u}),o+t<=s&&a({type:"CONFIRM_UNIT"})}),[i.tempUnit,n]);return{unit:i.unit,onLayout:u,isOverflowing:i.isOverflowing}},e.useOverflowDetection=function(){var e=f(t.useReducer(q,{width:0,x:0}),2),n=e[0],o=e[1],i=r.Dimensions.get("window").width;return{onLayout:t.useCallback((function(e){var t=e.nativeEvent.layout,r=t.width,n=t.x;o({type:"SET_LAYOUT",payload:{width:r,x:n}})}),[]),isOverflowing:n.x+n.width>i}},e.usePreventDefault=fe,e.useResponsive=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:re,n=t.useMemo((function(){return l(l({},re),e)}),[e]),o=t.useReducer(ie,function(e){return{orientation:ne(),sizeCategory:oe(e),width:r.Dimensions.get("window").width}}(n)),i=f(o,2),a=i[0],u=i[1];return t.useEffect((function(){var e=r.Dimensions.addEventListener("change",(function(e){var t=e.window;u({type:"SET_DIMENSIONS",payload:{width:t.width,breakpoints:n}})}));return function(){return e.remove()}}),[n]),{orientation:a.orientation,sizeCategory:a.sizeCategory,getResponsiveValue:function(e,t){var r,o,i=a.orientation,u=n[t][i],s=function(e){var t=["xs","sm","md","lg","xl"],r=t.indexOf(e);return t[r+1]||e}(t),l=n[s]?n[s][i]:u,c=e.min,f=e.max;return(a.width-(r=u))*(f-(o=c))/(l-r)+o}}},e.useResponsiveColumns=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{xs:320,sm:576,md:768,lg:992},o=f(t.useReducer($,Z),2),i=o[0],a=o[1],u=t.useRef(null),s=t.useCallback((function(){var t=r.Dimensions.get("window"),o=t.width,i=o>t.height?"landscape":"portrait",a="xs";o<=n.xs?a="xs":o<=n.sm?a="sm":o<=n.md?a="md":o<=n.lg&&(a="lg");var u=e[i][a];return void 0!==e.minColumns&&(u=Math.max(e.minColumns,u)),void 0!==e.maxColumns&&(u=Math.min(e.maxColumns,u)),u}),[e,n]);return t.useEffect((function(){var e=function(){a({type:"SET_LOADING",payload:!0}),u.current&&clearTimeout(u.current),u.current=setTimeout((function(){var e=s();a({type:"SET_TILE_COUNT",payload:e}),a({type:"SET_LOADING",payload:!1})}),200)};e();var t=r.Dimensions.addEventListener("change",e);return function(){u.current&&clearTimeout(u.current),t.remove()}}),[e,n,s]),{tileCount:i.tileCount,loadingTileCount:i.loadingTileCount}},e.useScrollControl=function(){var e=fe(),t=e.preventDefault,r=e.preventDefaultForScrollKeys;return{disableScroll:function(){window.addEventListener&&(window.addEventListener("DOMMouseScroll",t,!1),document.addEventListener("wheel",t,{passive:!1}),window.onwheel=t,window.ontouchmove=t,document.onkeydown=r)},enableScroll:function(){window.removeEventListener&&(window.removeEventListener("DOMMouseScroll",t,!1),document.removeEventListener("wheel",t),window.onwheel=null,window.ontouchmove=null,document.onkeydown=null)}}},e.useSectionListData=function(e){var r=e.configs,n=e.options||{},o=n.transformItem,i=n.transformHeader,a=n.emptyStateFallback,u=n.debug,s=t.useMemo((function(){return d(r)}),[r]);return t.useEffect((function(){u&&s.forEach((function(e,t){e.title&&Array.isArray(e.items)?e.items.forEach((function(t,r){t.id||console.error("Invalid item at index ".concat(r,' in section "').concat(e.title,'": Expected an id.'))})):console.error("Invalid config at index ".concat(t,": Expected a title and items array."))}))}),[s,u]),{sections:t.useMemo((function(){return!s.length&&a?a:s.map((function(e){return{title:i?i(e.title):e.title,data:e.items.map((function(e){return o?o(e):e}))}}))}),[s,o,i,a])}},e.useSrcResolver=function(e){var r=f(t.useReducer(X,Q),2),n=r[0],o=r[1];return t.useEffect((function(){var t=function(){var t=a(c().mark((function t(){var r;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o({type:"FETCH_INIT"}),t.prev=1,"string"!=typeof e){t.next=6;break}o({type:"FETCH_SUCCESS",payload:e}),t.next=15;break;case 6:if(!(e&&"object"===p(e)&&"uri"in e&&e.uri)){t.next=10;break}o({type:"FETCH_SUCCESS",payload:e.uri}),t.next=15;break;case 10:if("function"!=typeof e){t.next=15;break}return t.next=13,e();case 13:r=t.sent,o({type:"FETCH_SUCCESS",payload:r});case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(1),console.error("Error resolving source:",t.t0),o({type:"FETCH_FAILURE",payload:{key:"resolve",error:t.t0 instanceof Error?t.t0:new Error(String(t.t0))}});case 21:case"end":return t.stop()}}),t,null,[[1,17]])})));return function(){return t.apply(this,arguments)}}();t()}),[e]),{loading:n.loading,errors:n.errors,resolvedSrc:n.resolvedSrc}},e.useSubmitEditing=function(e){var r=e.onSubmitEditing,n=t.useRef(null),o=t.useCallback((function(e){"Enter"!==e.key&&"Return"!==e.key||!r||(e.preventDefault(),r())}),[r]);return{handleKeyDown:o,inputRef:n}},e.useTextStyle=function(e,r){var n=t.useMemo((function(){return JSON.stringify(e||{})}),[e]),o=t.useMemo((function(){return JSON.stringify(r||{})}),[r]);return t.useMemo((function(){var e=JSON.parse(n),t=JSON.parse(o);return l(l({},e),t)}),[n,o])},e.useViewSize=z,e.useViewportInfo=function(){var e=f(t.useState(r.Dimensions.get("window")),2),n=e[0],o=e[1],i=f(t.useState(r.Dimensions.get("screen")),2),a=i[0],u=i[1];return t.useEffect((function(){var e=r.Dimensions.addEventListener("change",(function(e){o(e.window),u(e.screen)}));return function(){return e.remove()}}),[]),{windowDimensions:n,screenDimensions:a}},e.useVisibilitySensor=function(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=t.useRef(null),u=f(t.useReducer(ue,{dimensions:{rectTop:0,rectBottom:0,rectWidth:0},lastValue:!1}),2),s=u[0],c=u[1],d=t.useMemo((function(){return l({visibilityOffset:e.VisibilityOffset.FULL,checkInterval:1e3},o)}),[o]),p=t.useCallback((function(){if(!i){var e=setInterval((function(){a.current&&a.current.measure((function(e,t,r,n,o,i){c({type:"SET_DIMENSIONS",payload:{rectTop:i,rectBottom:i+n,rectWidth:o+r}})}))}),d.checkInterval);return function(){return clearInterval(e)}}}),[d.checkInterval,i]);return t.useEffect((function(){var e=p();return function(){e&&e()}}),[p]),t.useEffect((function(){var e=r.Dimensions.get("window"),t=d.visibilityOffset,o=e.height*t,i=s.dimensions.rectBottom>o&&s.dimensions.rectTop>=0&&s.dimensions.rectWidth>0&&s.dimensions.rectWidth<=e.width;s.lastValue!==i&&(c({type:"SET_LAST_VALUE",payload:i}),n(i))}),[s.dimensions,s.lastValue,n,d]),a}})); //# sourceMappingURL=index.js.map