UNPKG

cyl-hooks-tools

Version:

基于react上下文实现的权限管理

2 lines 27.3 kB
/*! For license information please see useCollector.js.LICENSE.txt */ !function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react"),require("pullstate")):"function"==typeof define&&define.amd?define(["react","pullstate"],r):"object"==typeof exports?exports.cylHooksTools=r(require("react"),require("pullstate")):t.cylHooksTools=r(t.react,t.pullstate)}(self,((t,r)=>(()=>{"use strict";var e={240:(t,r,e)=>{e.d(r,{default:()=>c});var n=e(156);function o(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,r){if(!t)return;if("string"==typeof t)return i(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return i(t,r)}(t)||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 i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function a(t){setTimeout(t,0)}function u(t,r){var e,n,i=function(){},a=!1,u=t.apply(void 0,[function(){return e}].concat(o(r)));return function t(r,e,o){var c,l;try{if(r){var f=u.return();c=f.value,l=f.done}else if(e){var s=u.throw(e);c=s.value,l=s.done}else{var h=u.next(o);c=h.value,l=h.done}}catch(t){return void console.warn("Uncaught exception in useCo",t)}if(l)return a=!0,void(n=c);var p=!1;Promise.resolve(c).then((function(r){p||t(!1,void 0,r)})).catch((function(r){p||t(!1,r,void 0)})),i=function(){p||(p=!0,t(!0,void 0,void 0))}}(!1,void 0,void 0),function(){a?"function"==typeof n&&n():(e=!0,i())}}const c={useCoEffect:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if("function"!=typeof t||"GeneratorFunction"!==(t.constructor.displayName||t.constructor.name))throw new Error("useCo only accepts generator function");(0,n.useEffect)((function(){var r=u(t,[]);return function(){return a((function(){return r()}))}}),r)},useCoCallback:function(t,r){if("function"!=typeof t||"GeneratorFunction"!==(t.constructor.displayName||t.constructor.name))throw new Error("useCoCallback only accepts generator function");var e=(0,n.useRef)((function(){}));return(0,n.useEffect)((function(){return function(){return a((function(){return e.current()}))}}),r),(0,n.useCallback)((function(){e.current();for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];e.current=u(t,n)}),r)}}},853:(t,r,e)=>{function n(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||i(t)||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 o(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=i(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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 a,u=!0,c=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==e.return||e.return()}finally{if(c)throw a}}}}function i(t,r){if(t){if("string"==typeof t)return a(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(t,r):void 0}}function a(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function u(t,r){var e,n={"Y+":r.getFullYear().toString(),"m+":(r.getMonth()+1).toString(),"d+":r.getDate().toString(),"H+":r.getHours().toString(),"M+":r.getMinutes().toString(),"S+":r.getSeconds().toString()};for(var o in n)(e=new RegExp("("+o+")").exec(t))&&(t=t.replace(e[1],1==e[1].length?n[o]:n[o].padStart(e[1].length,"0")));return t}e.d(r,{default:()=>c});const c={parseJsonGraceful:function(t){try{return JSON.parse(t)}catch(t){return null}},sleep:function(t){return new Promise((function(r){return setTimeout(r,t)}))},logger:{info:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"blue",n=new Date(r);console.info("%c".concat(u("YYYY-mm-dd HH:MM:SS",n)," INFO: "),"color: ".concat(e,";"),t)},error:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"red",n=new Date(r);console.error("%c".concat(u("YYYY-mm-dd HH:MM:SS",n)," ERROR: "),"color: ".concat(e,";"),t)},warn:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"black",n=new Date(r);console.warn("%c".concat(u("YYYY-mm-dd HH:MM:SS",n)," WARN: "),"color: ".concat(e,";"),t)},log:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),e=new Date(r);console.log("".concat(u("YYYY-mm-dd HH:MM:SS",e),": "),t)},success:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"green",n=new Date(r);console.log("%c".concat(u("YYYY-mm-dd HH:MM:SS",n)," SUCCESS: "),"color: ".concat(e,";"),t)}},makeFriendly:function(t){return t>=1e8?t=Math.round(t/1e7)/10+"亿":t>=1e4&&(t=Math.round(t/1e3)/10+"万"),t},formatSeconds:function(t){if("number"!=typeof t)throw new Error("value需要number类型");var r=parseInt(t),e=0,n=0;r>60&&(e=parseInt(r/60),r=parseInt(r%60),e>60&&(n=parseInt(e/60),e=parseInt(e%60)));var o=parseInt(r)+"秒";return e>0&&(o=parseInt(e)+"分"+o),n>0&&(o=parseInt(n)+"小时"+o),o},Uint8ArrayToString:function(t){for(var r="",e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return r},dataSourceSliceOfECharts:function(t,r){var e,i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60,u=arguments.length>3?arguments[3]:void 0,c=0,l=[],f=o(t);try{var s=function(){var t=i.value;if(null==t||!t.timeStamp)throw new Error("no timeStamp"+JSON.stringify(t));var o=Math.round(t.timeStamp/1e3);if(0===c){var a;l.push([1e3*o].concat(n(null===(a=r(t,c,o))||void 0===a?void 0:a.map((function(r){return t[r]})))))}else{for(var u,f=c+1;f<o;f++){var s;l.push([1e3*f].concat(n(null===(s=r(e,f,o))||void 0===s?void 0:s.map((function(r){return t[r]})))))}l.push([1e3*o].concat(n(null===(u=r(t,c,o))||void 0===u?void 0:u.map((function(r){return t[r]})))))}c=o,e=t};for(f.s();!(i=f.n()).done;)s()}catch(t){f.e(t)}finally{f.f()}if(l.length>a)l=l.slice(l.length-a),u&&u(l,l.length-a);else if(l.length<a)for(var h=l.length;h<a;h++)c+=1,l.push([1e3*c,null]);return l},ninePath:function(t,r){var e=t.scale||2;return{"border-image-slice":"".concat(t.top," ").concat(t.right," ").concat(t.bottom," ").concat(t.left," fill"),"border-image-width":"".concat(t.top/e,"px ").concat(t.right/e,"px ").concat(t.bottom/e,"px ").concat(t.left/e,"px"),"border-image-outset":"0px 0px 0px 0px","border-image-repeat":"stretch stretch","border-image-source":"url(".concat(t.source,")"),"border-width":"".concat(r.top/e,"px ").concat(r.right/e,"px ").concat(r.bottom/e,"px ").concat(r.left/e,"px"),"border-style":"solid","box-sizing":"border-box","min-width":"".concat((t.left+t.right)/e,"px"),"min-height":"".concat((t.top+t.bottom)/e,"px")}}}},331:t=>{t.exports=r},156:r=>{r.exports=t}},n={};function o(t){var r=n[t];if(void 0!==r)return r.exports;var i=n[t]={exports:{}};return e[t](i,i.exports,o),i.exports}o.n=t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return o.d(r,{a:r}),r},o.d=(t,r)=>{for(var e in r)o.o(r,e)&&!o.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:r[e]})},o.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r);var i={};return(()=>{o.d(i,{default:()=>m});var t=o(156),r=o(853);o(331);r.default.logger;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(){n=function(){return t};var t={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function f(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{f({},"")}catch(t){f=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof y?r:y,a=Object.create(o.prototype),u=new _(n||[]);return i(a,"_invoke",{value:E(t,e,u)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p={};function y(){}function v(){}function d(){}var m={};f(m,u,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(A([])));b&&b!==r&&o.call(b,u)&&(m=b);var w=d.prototype=y.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(r){f(t,r,(function(t){return this._invoke(r,t)}))}))}function S(t,r){function n(i,a,u,c){var l=h(t[i],t,a);if("throw"!==l.type){var f=l.arg,s=f.value;return s&&"object"==e(s)&&o.call(s,"__await")?r.resolve(s.__await).then((function(t){n("next",t,u,c)}),(function(t){n("throw",t,u,c)})):r.resolve(s).then((function(t){f.value=t,u(f)}),(function(t){return n("throw",t,u,c)}))}c(l.arg)}var a;i(this,"_invoke",{value:function(t,e){function o(){return new r((function(r,o){n(t,e,r,o)}))}return a=a?a.then(o,o):o()}})}function E(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return I()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var u=L(a,e);if(u){if(u===p)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var c=h(t,r,e);if("normal"===c.type){if(n=e.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(n="completed",e.method="throw",e.arg=c.arg)}}}function L(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,L(t,r),"throw"===r.method))return p;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=h(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,p;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,p):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function O(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function j(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function A(t){if(t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,n=function r(){for(;++e<t.length;)if(o.call(t,e))return r.value=t[e],r.done=!1,r;return r.value=void 0,r.done=!0,r};return n.next=n}}return{next:I}}function I(){return{value:void 0,done:!0}}return v.prototype=d,i(w,"constructor",{value:d,configurable:!0}),i(d,"constructor",{value:v,configurable:!0}),v.displayName=f(d,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,f(t,l,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},x(S.prototype),f(S.prototype,c,(function(){return this})),t.AsyncIterator=S,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new S(s(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(w),f(w,l,"Generator"),f(w,u,(function(){return this})),f(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=A,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function e(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var u=o.call(i,"catchLoc"),c=o.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),p},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),j(e),p}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:A(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),p}},t}function a(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==e)return;var n,o,i=[],a=!0,u=!1;try{for(e=e.call(t);!(a=(n=e.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==e.return||e.return()}finally{if(u)throw o}}return i}(t,r)||function(t,r){if(!t)return;if("string"==typeof t)return u(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return u(t,r)}(t,r)||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 u(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}var c=o(240).default.useCoEffect;function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function f(){f=function(){return t};var t={},r=Object.prototype,e=r.hasOwnProperty,n=Object.defineProperty||function(t,r,e){t[r]=e.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{c({},"")}catch(t){c=function(t,r,e){return t[r]=e}}function s(t,r,e,o){var i=r&&r.prototype instanceof y?r:y,a=Object.create(i.prototype),u=new _(o||[]);return n(a,"_invoke",{value:E(t,e,u)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p={};function y(){}function v(){}function d(){}var m={};c(m,i,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(A([])));b&&b!==r&&e.call(b,i)&&(m=b);var w=d.prototype=y.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(r){c(t,r,(function(t){return this._invoke(r,t)}))}))}function S(t,r){function o(n,i,a,u){var c=h(t[n],t,i);if("throw"!==c.type){var f=c.arg,s=f.value;return s&&"object"==l(s)&&e.call(s,"__await")?r.resolve(s.__await).then((function(t){o("next",t,a,u)}),(function(t){o("throw",t,a,u)})):r.resolve(s).then((function(t){f.value=t,a(f)}),(function(t){return o("throw",t,a,u)}))}u(c.arg)}var i;n(this,"_invoke",{value:function(t,e){function n(){return new r((function(r,n){o(t,e,r,n)}))}return i=i?i.then(n,n):n()}})}function E(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return I()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var u=L(a,e);if(u){if(u===p)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var c=h(t,r,e);if("normal"===c.type){if(n=e.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(n="completed",e.method="throw",e.arg=c.arg)}}}function L(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,L(t,r),"throw"===r.method))return p;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=h(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,p;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,p):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function O(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function j(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function A(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n<t.length;)if(e.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:I}}function I(){return{value:void 0,done:!0}}return v.prototype=d,n(w,"constructor",{value:d,configurable:!0}),n(d,"constructor",{value:v,configurable:!0}),v.displayName=c(d,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,c(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},x(S.prototype),c(S.prototype,a,(function(){return this})),t.AsyncIterator=S,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new S(s(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(w),c(w,u,"Generator"),c(w,i,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=A,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!t)for(var r in this)"t"===r.charAt(0)&&e.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=e.call(i,"catchLoc"),c=e.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),p},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),j(e),p}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:A(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),p}},t}function s(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function h(t){return function(t){if(Array.isArray(t))return d(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||v(t)||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(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=v(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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,a=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(u)throw i}}}}function y(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==e)return;var n,o,i=[],a=!0,u=!1;try{for(e=e.call(t);!(a=(n=e.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(t){u=!0,o=t}finally{try{a||null==e.return||e.return()}finally{if(u)throw o}}return i}(t,r)||v(t,r)||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 v(t,r){if(t){if("string"==typeof t)return d(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?d(t,r):void 0}}function d(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}const m={useCollector:function(r,e){var n=y((0,t.useState)([]),2),o=n[0],i=n[1];return(0,t.useEffect)((function(){i((function(t){var n,o,i=((null==r?void 0:r.map(e))||[]).filter((function(t){return null!=t})),a=p(i);try{for(a.s();!(o=a.n()).done;){var u=o.value;(n||t).indexOf(u)<0&&(n||(n=h(t)),n.push(u))}}catch(t){a.e(t)}finally{a.f()}return n&&(n=n.filter((function(t){return i.indexOf(t)>=0}))),n||t}))}),[r]),o},useApiCollectionFetcher:function(r,e,o,i){var u=y((0,t.useState)([[],[]]),2),l=y(u[0],2),v=(l[0],l[1]),d=u[1];(0,t.useEffect)((function(){d((function(t){var r,n,i=y(t,2),a=i[0],u=i[1],c=p(((null==e?void 0:e.map(o))||[]).filter((function(t){return null!=t})));try{for(c.s();!(n=c.n()).done;){var l=n.value;(r||u).indexOf(l)<0&&a.indexOf(l)<0&&(r||(r=h(u)),r.push(l))}}catch(t){c.e(t)}finally{c.f()}return r?[a,r]:t}))}),[e]);var m=y((0,t.useState)([]),2),g=m[0],b=m[1],w=function(r,e){for(var o=arguments.length,i=new Array(o>2?o-2:0),u=2;u<o;u++)i[u-2]=arguments[u];var l=r,f=[void 0,!0,void 0],s=a((0,t.useState)(f),2),h=s[0],p=s[1];return c(n().mark((function t(){var o;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,p((function(t){return[t[0],!0,void 0]})),t.next=4,e.apply(void 0,[r].concat(i));case 4:o=t.sent,p([o,!1,void 0]),t.next=11;break;case 8:t.prev=8,t.t0=t.catch(0),p((function(r){return[r[0],!1,t.t0]}));case 11:case"end":return t.stop()}}),t,null,[[0,8]])})),[].concat(i)),!l.__api_loading&&h[1]&&(l.__api_loading=!0),!l.__api_error&&h[2]&&(l.__api_error=h[2]),h}(r,function(){var t,r=(t=f().mark((function t(r,e){return f().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e&&e.length?i(r,e):[]);case 1:case"end":return t.stop()}}),t)})),function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function a(t){s(i,n,o,a,u,"next",t)}function u(t){s(i,n,o,a,u,"throw",t)}a(void 0)}))});return function(t,e){return r.apply(this,arguments)}}(),v),x=y(w,3),S=x[0],E=x[1],L=x[2];return(0,t.useEffect)((function(){S&&(b((function(t){return[].concat(h(t),h(S))})),d((function(t){var r=y(t,2),e=r[0],n=r[1];return[[].concat(h(e),h(n)),n.length>0?[]:n]})))}),[S]),[g,E,L]}}})(),i=i.default})()));