@cyberskill/shared 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(e,r,t,n,u,a,o){try{var i=e[a](o);var c=i.value}catch(e){t(e);return}if(i.done){r(c)}else{Promise.resolve(c).then(n,u)}}function n(e){return function(){var r=this,n=arguments;return new Promise(function(u,a){var o=e.apply(r,n);function i(e){t(o,u,a,i,c,"next",e)}function c(e){t(o,u,a,i,c,"throw",e)}i(undefined)})}}function u(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function a(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var u=true;var a=false;var o,i;try{for(t=t.call(e);!(u=(o=t.next()).done);u=true){n.push(o.value);if(r&&n.length===r)break}}catch(e){a=true;i=e}finally{try{if(!u&&t["return"]!=null)t["return"]()}finally{if(a)throw i}}return n}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 i(e,t){return r(e)||a(e,t)||s(e,t)||o()}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function s(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}function l(e,r){var t,n,u,a,o={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(r){return c([e,r])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(o)try{if(t=1,n&&(u=a[0]&2?n["return"]:a[0]?n["throw"]||((u=n["return"])&&u.call(n),0):n.next)&&!(u=u.call(n,a[1])).done)return u;if(n=0,u)a=[a[0]&2,u.value];switch(a[0]){case 0:case 1:u=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;n=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(u=o.trys,u=u.length>0&&u[u.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!u||a[1]>u[0]&&a[1]<u[3])){o.label=a[1];break}if(a[0]===6&&o.label<u[1]){o.label=u[1];u=a;break}if(u&&o.label<u[2]){o.label=u[2];o.ops.push(a);break}if(u[2])o.ops.pop();o.trys.pop();continue}a=r.call(e,o)}catch(e){a=[6,e];n=0}finally{t=u=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var f=Object.create;var v=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var g=function(e,r){for(var t in r)v(e,t,{get:r[t],enumerable:!0})},b=function(e,r,t,n){var u=true,a=false,o=undefined;if(r&&(typeof r==="undefined"?"undefined":c(r))=="object"||typeof r=="function")try{var i=function(){var u=l.value;!p.call(e,u)&&u!==t&&v(e,u,{get:function(){return r[u]},enumerable:!(n=y(r,u))||n.enumerable})};for(var s=h(r)[Symbol.iterator](),l;!(u=(l=s.next()).done);u=true)i()}catch(e){a=true;o=e}finally{try{if(!u&&s.return!=null){s.return()}}finally{if(a){throw o}}}return e};var m=function(e,r,t){return t=e!=null?f(d(e)):{},b(r||!e||!e.__esModule?v(t,"default",{value:e,enumerable:!0}):t,e)},w=function(e){return b(v({},"__esModule",{value:!0}),e)};var S={};g(S,{useLoading:function(){return j},useLocalStorage:function(){return $}});module.exports=w(S);var E=function(){return(typeof document==="undefined"?"undefined":c(document))>"u"?new URL("file:".concat(__filename)).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href},k=E();var O=require("react");var q=require("react"),_=(0,q.createContext)(void 0);function j(){var e=(0,O.useContext)(_);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}var x=require("react");var L=m(require("unorm"),1);var I=m(require("localforage"),1),P={get:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,I.default.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error('Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return n(function(){var t;return l(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,I.default.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,I.default.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},clear:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,I.default.clear()];case 1:r.sent();return[3,3];case 2:e=r.sent();console.error("Error clearing storage:",e);return[3,3];case 3:return[2]}})})()},key:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,I.default.key(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error("Error getting key at index ".concat(e,":"),r),null)];case 3:return[2]}})})()},keys:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,I.default.keys()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting keys:",e),[])];case 3:return[2]}})})()},length:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,I.default.length()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting storage length:",e),0)];case 3:return[2]}})})()},iterate:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,I.default.iterate(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error("Error iterating storage:",r);return[3,3];case 3:return[2]}})})()}};var A=require("graphql");var U=require("path"),z=require("url"),D=(0,z.fileURLToPath)(k),R=(0,U.dirname)(D);var C=m(require("crypto-js"),1),M=m(require("mongoose-aggregate-paginate-v2"),1),N=m(require("mongoose-paginate-v2"),1),T=m(require("slugify"),1),J=require("uuid");var F=T.default.default||T.default;var G={serialize:function(e){return JSON.stringify(e,function(e,r){return u(r,Date)?{__type:"Date",value:r.toISOString()}:r})},deserialize:function(e){return JSON.parse(e,function(e,r){return(r===null||r===void 0?void 0:r.__type)==="Date"?new Date(r.value):r})}};function $(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:G;var a=i((0,x.useState)(r),2),o=a[0],c=a[1],s=i((0,x.useState)(!1),2),f=s[0],v=s[1],y=(0,x.useCallback)(/*#__PURE__*/function(){var e=n(function(e){var r;return l(this,function(t){r=u(e,Function)?e(o):e;c(r);return[2]})});return function(r){return e.apply(this,arguments)}}(),[o]);return(0,x.useEffect)(function(){var u=!0;return n(function(){var n,a,o,i;return l(this,function(s){switch(s.label){case 0:s.trys.push([0,5,,6]);return[4,P.get(e)];case 1:n=s.sent();if(!u)return[2];if(!(n!==null))return[3,2];a=t.deserialize(n);c(a);return[3,4];case 2:o=t.serialize(r);return[4,P.set(e,o)];case 3:s.sent(),c(r);s.label=4;case 4:return[3,6];case 5:i=s.sent();console.error("Error loading value:",i),u&&c(r);return[3,6];case 6:v(!0);return[2]}})})(),function(){u=!1,v(!1)}},[e,r,t]),(0,x.useEffect)(function(){if(!f)return;n(function(){var r,n;return l(this,function(u){switch(u.label){case 0:u.trys.push([0,2,,3]);r=t.serialize(o);return[4,P.set(e,r)];case 1:u.sent();return[3,3];case 2:n=u.sent();console.error("Error saving value:",n);return[3,3];case 3:return[2]}})})()},[o,e,t,f]),[o,y]}0&&(module.exports={useLoading:useLoading,useLocalStorage:useLocalStorage});
1
+ "use strict";function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(e,r,t,n,u,a,o){try{var i=e[a](o);var c=i.value}catch(e){t(e);return}if(i.done){r(c)}else{Promise.resolve(c).then(n,u)}}function n(e){return function(){var r=this,n=arguments;return new Promise(function(u,a){var o=e.apply(r,n);function i(e){t(o,u,a,i,c,"next",e)}function c(e){t(o,u,a,i,c,"throw",e)}i(undefined)})}}function u(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function a(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var u=true;var a=false;var o,i;try{for(t=t.call(e);!(u=(o=t.next()).done);u=true){n.push(o.value);if(r&&n.length===r)break}}catch(e){a=true;i=e}finally{try{if(!u&&t["return"]!=null)t["return"]()}finally{if(a)throw i}}return n}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 i(e,t){return r(e)||a(e,t)||s(e,t)||o()}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function s(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}function l(e,r){var t,n,u,a,o={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(r){return c([e,r])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(o)try{if(t=1,n&&(u=a[0]&2?n["return"]:a[0]?n["throw"]||((u=n["return"])&&u.call(n),0):n.next)&&!(u=u.call(n,a[1])).done)return u;if(n=0,u)a=[a[0]&2,u.value];switch(a[0]){case 0:case 1:u=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;n=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(u=o.trys,u=u.length>0&&u[u.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!u||a[1]>u[0]&&a[1]<u[3])){o.label=a[1];break}if(a[0]===6&&o.label<u[1]){o.label=u[1];u=a;break}if(u&&o.label<u[2]){o.label=u[2];o.ops.push(a);break}if(u[2])o.ops.pop();o.trys.pop();continue}a=r.call(e,o)}catch(e){a=[6,e];n=0}finally{t=u=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var f=Object.create;var y=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var g=function(e,r){for(var t in r)y(e,t,{get:r[t],enumerable:!0})},b=function(e,r,t,n){var u=true,a=false,o=undefined;if(r&&(typeof r==="undefined"?"undefined":c(r))=="object"||typeof r=="function")try{var i=function(){var u=l.value;!p.call(e,u)&&u!==t&&y(e,u,{get:function(){return r[u]},enumerable:!(n=v(r,u))||n.enumerable})};for(var s=h(r)[Symbol.iterator](),l;!(u=(l=s.next()).done);u=true)i()}catch(e){a=true;o=e}finally{try{if(!u&&s.return!=null){s.return()}}finally{if(a){throw o}}}return e};var m=function(e,r,t){return t=e!=null?f(d(e)):{},b(r||!e||!e.__esModule?y(t,"default",{value:e,enumerable:!0}):t,e)},w=function(e){return b(y({},"__esModule",{value:!0}),e)};var S={};g(S,{useLoading:function(){return j},useLocalStorage:function(){return B}});module.exports=w(S);var E=function(){return(typeof document==="undefined"?"undefined":c(document))>"u"?new URL("file:".concat(__filename)).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href},k=E();var O=require("react");var q=require("react"),_=(0,q.createContext)(void 0);function j(){var e=(0,O.useContext)(_);if(!e)throw new Error("useLoading must be used within a LoadingProvider");return e}var x=require("react");var L=m(require("unorm"),1);var I=m(require("localforage"),1),P={get:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,I.default.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error('Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return n(function(){var t;return l(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,I.default.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,I.default.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},clear:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,I.default.clear()];case 1:r.sent();return[3,3];case 2:e=r.sent();console.error("Error clearing storage:",e);return[3,3];case 3:return[2]}})})()},key:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,I.default.key(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error("Error getting key at index ".concat(e,":"),r),null)];case 3:return[2]}})})()},keys:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,I.default.keys()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting keys:",e),[])];case 3:return[2]}})})()},length:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,I.default.length()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting storage length:",e),0)];case 3:return[2]}})})()},iterate:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,I.default.iterate(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error("Error iterating storage:",r);return[3,3];case 3:return[2]}})})()}};var A=require("graphql");var U=require("path"),z=require("url"),D=(0,z.fileURLToPath)(k),R=(0,U.dirname)(D);var C=m(require("crypto-js"),1),M=m(require("mongoose-aggregate-paginate-v2"),1),N=m(require("mongoose-paginate-v2"),1),T=m(require("slugify"),1),J=require("uuid");var G=T.default.default||T.default;var $={serialize:function(e){return JSON.stringify(e,function(e,r){return u(r,Date)?{__type:"Date",value:r.toISOString()}:r})},deserialize:function(e){return JSON.parse(e,function(e,r){return(r===null||r===void 0?void 0:r.__type)==="Date"?new Date(r.value):r})}};function B(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$;var u=i((0,x.useState)(r),2),a=u[0],o=u[1],c=i((0,x.useState)(!1),2),s=c[0],f=c[1],y=(0,x.useCallback)(/*#__PURE__*/function(){var e=n(function(e){var r;return l(this,function(t){if(typeof e=="function"){r=e(a);o(r)}else o(e);return[2]})});return function(r){return e.apply(this,arguments)}}(),[a]);return(0,x.useEffect)(function(){var u=!0;return n(function(){var n,a,i,c;return l(this,function(s){switch(s.label){case 0:s.trys.push([0,5,,6]);return[4,P.get(e)];case 1:n=s.sent();if(!u)return[2];if(!(n!==null))return[3,2];a=t.deserialize(n);o(a);return[3,4];case 2:i=t.serialize(r);return[4,P.set(e,i)];case 3:s.sent(),o(r);s.label=4;case 4:return[3,6];case 5:c=s.sent();console.error("Error loading value:",c),u&&o(r);return[3,6];case 6:f(!0);return[2]}})})(),function(){u=!1,f(!1)}},[e,r,t]),(0,x.useEffect)(function(){if(!s)return;n(function(){var r,n;return l(this,function(u){switch(u.label){case 0:u.trys.push([0,2,,3]);r=t.serialize(a);return[4,P.set(e,r)];case 1:u.sent();return[3,3];case 2:n=u.sent();console.error("Error saving value:",n);return[3,3];case 3:return[2]}})})()},[a,e,t,s]),[a,y]}0&&(module.exports={useLoading:useLoading,useLocalStorage:useLocalStorage});
@@ -1 +1 @@
1
- function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(r){if(Array.isArray(r))return r}function t(r,e,t,n,o,u,a){try{var s=r[u](a);var i=s.value}catch(r){t(r);return}if(s.done){e(i)}else{Promise.resolve(i).then(n,o)}}function n(r){return function(){var e=this,n=arguments;return new Promise(function(o,u){var a=r.apply(e,n);function s(r){t(a,o,u,s,i,"next",r)}function i(r){t(a,o,u,s,i,"throw",r)}s(undefined)})}}function o(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function u(r,e){var t=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(t==null)return;var n=[];var o=true;var u=false;var a,s;try{for(t=t.call(r);!(o=(a=t.next()).done);o=true){n.push(a.value);if(e&&n.length===e)break}}catch(r){u=true;s=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(u)throw s}}return n}function a(){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 s(r,t){return e(r)||u(r,t)||i(r,t)||a()}function i(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}function c(r,e){var t,n,o,u,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return u={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(r){return function(e){return i([r,e])}}function i(u){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=e.call(r,a)}catch(r){u=[6,r];n=0}finally{t=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}import{useContext as l}from"react";import{createContext as f}from"react";var h=f(void 0);function p(){var r=l(h);if(!r)throw new Error("useLoading must be used within a LoadingProvider");return r}import{useCallback as y,useEffect as v,useState as m}from"react";import g from"unorm";import b from"localforage";var d={get:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,b.getItem(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error('Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return n(function(){var t;return c(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,b.setItem(r,e)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(r,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,b.removeItem(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},clear:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,b.clear()];case 1:e.sent();return[3,3];case 2:r=e.sent();console.error("Error clearing storage:",r);return[3,3];case 3:return[2]}})})()},key:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,b.key(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error("Error getting key at index ".concat(r,":"),e),null)];case 3:return[2]}})})()},keys:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,b.keys()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting keys:",r),[])];case 3:return[2]}})})()},length:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,b.length()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting storage length:",r),0)];case 3:return[2]}})})()},iterate:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,b.iterate(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error("Error iterating storage:",e);return[3,3];case 3:return[2]}})})()}};import{GraphQLError as w}from"graphql";import{dirname as E}from"node:path";import{fileURLToPath as S}from"node:url";var k=S(import.meta.url),x=E(k);import I from"crypto-js";import _ from"mongoose-aggregate-paginate-v2";import L from"mongoose-paginate-v2";import A from"slugify";import{v4 as z}from"uuid";var O=A.default||A;var P={serialize:function(r){return JSON.stringify(r,function(r,e){return o(e,Date)?{__type:"Date",value:e.toISOString()}:e})},deserialize:function(r){return JSON.parse(r,function(r,e){return(e===null||e===void 0?void 0:e.__type)==="Date"?new Date(e.value):e})}};function j(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:P;var u=s(m(e),2),a=u[0],i=u[1],l=s(m(!1),2),f=l[0],h=l[1],p=y(/*#__PURE__*/function(){var r=n(function(r){var e;return c(this,function(t){e=o(r,Function)?r(a):r;i(e);return[2]})});return function(e){return r.apply(this,arguments)}}(),[a]);return v(function(){var o=!0;return n(function(){var n,u,a,s;return c(this,function(c){switch(c.label){case 0:c.trys.push([0,5,,6]);return[4,d.get(r)];case 1:n=c.sent();if(!o)return[2];if(!(n!==null))return[3,2];u=t.deserialize(n);i(u);return[3,4];case 2:a=t.serialize(e);return[4,d.set(r,a)];case 3:c.sent(),i(e);c.label=4;case 4:return[3,6];case 5:s=c.sent();console.error("Error loading value:",s),o&&i(e);return[3,6];case 6:h(!0);return[2]}})})(),function(){o=!1,h(!1)}},[r,e,t]),v(function(){if(!f)return;n(function(){var e,n;return c(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);e=t.serialize(a);return[4,d.set(r,e)];case 1:o.sent();return[3,3];case 2:n=o.sent();console.error("Error saving value:",n);return[3,3];case 3:return[2]}})})()},[a,r,t,f]),[a,p]}export{p as useLoading,j as useLocalStorage};
1
+ function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(r){if(Array.isArray(r))return r}function t(r,e,t,n,o,u,a){try{var s=r[u](a);var i=s.value}catch(r){t(r);return}if(s.done){e(i)}else{Promise.resolve(i).then(n,o)}}function n(r){return function(){var e=this,n=arguments;return new Promise(function(o,u){var a=r.apply(e,n);function s(r){t(a,o,u,s,i,"next",r)}function i(r){t(a,o,u,s,i,"throw",r)}s(undefined)})}}function o(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function u(r,e){var t=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(t==null)return;var n=[];var o=true;var u=false;var a,s;try{for(t=t.call(r);!(o=(a=t.next()).done);o=true){n.push(a.value);if(e&&n.length===e)break}}catch(r){u=true;s=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(u)throw s}}return n}function a(){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 s(r,t){return e(r)||u(r,t)||i(r,t)||a()}function i(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}function c(r,e){var t,n,o,u,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return u={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(r){return function(e){return i([r,e])}}function i(u){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=e.call(r,a)}catch(r){u=[6,r];n=0}finally{t=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}import{useContext as l}from"react";import{createContext as f}from"react";var h=f(void 0);function p(){var r=l(h);if(!r)throw new Error("useLoading must be used within a LoadingProvider");return r}import{useCallback as y,useEffect as v,useState as m}from"react";import g from"unorm";import b from"localforage";var d={get:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,b.getItem(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error('Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return n(function(){var t;return c(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,b.setItem(r,e)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(r,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,b.removeItem(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},clear:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,b.clear()];case 1:e.sent();return[3,3];case 2:r=e.sent();console.error("Error clearing storage:",r);return[3,3];case 3:return[2]}})})()},key:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,b.key(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error("Error getting key at index ".concat(r,":"),e),null)];case 3:return[2]}})})()},keys:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,b.keys()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting keys:",r),[])];case 3:return[2]}})})()},length:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,b.length()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting storage length:",r),0)];case 3:return[2]}})})()},iterate:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,b.iterate(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error("Error iterating storage:",e);return[3,3];case 3:return[2]}})})()}};import{GraphQLError as w}from"graphql";import{dirname as E}from"node:path";import{fileURLToPath as S}from"node:url";var k=S(import.meta.url),x=E(k);import I from"crypto-js";import _ from"mongoose-aggregate-paginate-v2";import L from"mongoose-paginate-v2";import A from"slugify";import{v4 as z}from"uuid";var O=A.default||A;var P={serialize:function(r){return JSON.stringify(r,function(r,e){return o(e,Date)?{__type:"Date",value:e.toISOString()}:e})},deserialize:function(r){return JSON.parse(r,function(r,e){return(e===null||e===void 0?void 0:e.__type)==="Date"?new Date(e.value):e})}};function j(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:P;var o=s(m(e),2),u=o[0],a=o[1],i=s(m(!1),2),l=i[0],f=i[1],h=y(/*#__PURE__*/function(){var r=n(function(r){var e;return c(this,function(t){if(typeof r=="function"){e=r(u);a(e)}else a(r);return[2]})});return function(e){return r.apply(this,arguments)}}(),[u]);return v(function(){var o=!0;return n(function(){var n,u,s,i;return c(this,function(c){switch(c.label){case 0:c.trys.push([0,5,,6]);return[4,d.get(r)];case 1:n=c.sent();if(!o)return[2];if(!(n!==null))return[3,2];u=t.deserialize(n);a(u);return[3,4];case 2:s=t.serialize(e);return[4,d.set(r,s)];case 3:c.sent(),a(e);c.label=4;case 4:return[3,6];case 5:i=c.sent();console.error("Error loading value:",i),o&&a(e);return[3,6];case 6:f(!0);return[2]}})})(),function(){o=!1,f(!1)}},[r,e,t]),v(function(){if(!l)return;n(function(){var e,n;return c(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);e=t.serialize(u);return[4,d.set(r,e)];case 1:o.sent();return[3,3];case 2:n=o.sent();console.error("Error saving value:",n);return[3,3];case 3:return[2]}})})()},[u,r,t,l]),[u,h]}export{p as useLoading,j as useLocalStorage};
@@ -1 +1 @@
1
- "use strict";function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(e,r,t,n,u,a,o){try{var i=e[a](o);var c=i.value}catch(e){t(e);return}if(i.done){r(c)}else{Promise.resolve(c).then(n,u)}}function n(e){return function(){var r=this,n=arguments;return new Promise(function(u,a){var o=e.apply(r,n);function i(e){t(o,u,a,i,c,"next",e)}function c(e){t(o,u,a,i,c,"throw",e)}i(undefined)})}}function u(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function a(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var u=true;var a=false;var o,i;try{for(t=t.call(e);!(u=(o=t.next()).done);u=true){n.push(o.value);if(r&&n.length===r)break}}catch(e){a=true;i=e}finally{try{if(!u&&t["return"]!=null)t["return"]()}finally{if(a)throw i}}return n}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 i(e,t){return r(e)||a(e,t)||s(e,t)||o()}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function s(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}function l(e,r){var t,n,u,a,o={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(r){return c([e,r])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(o)try{if(t=1,n&&(u=a[0]&2?n["return"]:a[0]?n["throw"]||((u=n["return"])&&u.call(n),0):n.next)&&!(u=u.call(n,a[1])).done)return u;if(n=0,u)a=[a[0]&2,u.value];switch(a[0]){case 0:case 1:u=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;n=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(u=o.trys,u=u.length>0&&u[u.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!u||a[1]>u[0]&&a[1]<u[3])){o.label=a[1];break}if(a[0]===6&&o.label<u[1]){o.label=u[1];u=a;break}if(u&&o.label<u[2]){o.label=u[2];o.ops.push(a);break}if(u[2])o.ops.pop();o.trys.pop();continue}a=r.call(e,o)}catch(e){a=[6,e];n=0}finally{t=u=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var f=Object.create;var y=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var b=function(e,r){for(var t in r)y(e,t,{get:r[t],enumerable:!0})},g=function(e,r,t,n){var u=true,a=false,o=undefined;if(r&&(typeof r==="undefined"?"undefined":c(r))=="object"||typeof r=="function")try{var i=function(){var u=l.value;!d.call(e,u)&&u!==t&&y(e,u,{get:function(){return r[u]},enumerable:!(n=v(r,u))||n.enumerable})};for(var s=h(r)[Symbol.iterator](),l;!(u=(l=s.next()).done);u=true)i()}catch(e){a=true;o=e}finally{try{if(!u&&s.return!=null){s.return()}}finally{if(a){throw o}}}return e};var m=function(e,r,t){return t=e!=null?f(p(e)):{},g(r||!e||!e.__esModule?y(t,"default",{value:e,enumerable:!0}):t,e)},w=function(e){return g(y({},"__esModule",{value:!0}),e)};var S={};b(S,{useLocalStorage:function(){return C}});module.exports=w(S);var k=function(){return(typeof document==="undefined"?"undefined":c(document))>"u"?new URL("file:".concat(__filename)).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href},E=k();var O=require("react");var _=m(require("unorm"),1);var j=m(require("localforage"),1),q={get:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j.default.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error('Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return n(function(){var t;return l(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,j.default.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j.default.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},clear:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,j.default.clear()];case 1:r.sent();return[3,3];case 2:e=r.sent();console.error("Error clearing storage:",e);return[3,3];case 3:return[2]}})})()},key:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j.default.key(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error("Error getting key at index ".concat(e,":"),r),null)];case 3:return[2]}})})()},keys:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,j.default.keys()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting keys:",e),[])];case 3:return[2]}})})()},length:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,j.default.length()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting storage length:",e),0)];case 3:return[2]}})})()},iterate:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j.default.iterate(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error("Error iterating storage:",r);return[3,3];case 3:return[2]}})})()}};var I=require("graphql");var x=require("path"),P=require("url"),A=(0,P.fileURLToPath)(E),L=(0,x.dirname)(A);var U=m(require("crypto-js"),1),z=m(require("mongoose-aggregate-paginate-v2"),1),D=m(require("mongoose-paginate-v2"),1),R=m(require("slugify"),1),M=require("uuid");var N=R.default.default||R.default;var T={serialize:function(e){return JSON.stringify(e,function(e,r){return u(r,Date)?{__type:"Date",value:r.toISOString()}:r})},deserialize:function(e){return JSON.parse(e,function(e,r){return(r===null||r===void 0?void 0:r.__type)==="Date"?new Date(r.value):r})}};function C(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:T;var a=i((0,O.useState)(r),2),o=a[0],c=a[1],s=i((0,O.useState)(!1),2),f=s[0],y=s[1],v=(0,O.useCallback)(/*#__PURE__*/function(){var e=n(function(e){var r;return l(this,function(t){r=u(e,Function)?e(o):e;c(r);return[2]})});return function(r){return e.apply(this,arguments)}}(),[o]);return(0,O.useEffect)(function(){var u=!0;return n(function(){var n,a,o,i;return l(this,function(s){switch(s.label){case 0:s.trys.push([0,5,,6]);return[4,q.get(e)];case 1:n=s.sent();if(!u)return[2];if(!(n!==null))return[3,2];a=t.deserialize(n);c(a);return[3,4];case 2:o=t.serialize(r);return[4,q.set(e,o)];case 3:s.sent(),c(r);s.label=4;case 4:return[3,6];case 5:i=s.sent();console.error("Error loading value:",i),u&&c(r);return[3,6];case 6:y(!0);return[2]}})})(),function(){u=!1,y(!1)}},[e,r,t]),(0,O.useEffect)(function(){if(!f)return;n(function(){var r,n;return l(this,function(u){switch(u.label){case 0:u.trys.push([0,2,,3]);r=t.serialize(o);return[4,q.set(e,r)];case 1:u.sent();return[3,3];case 2:n=u.sent();console.error("Error saving value:",n);return[3,3];case 3:return[2]}})})()},[o,e,t,f]),[o,v]}0&&(module.exports={useLocalStorage:useLocalStorage});
1
+ "use strict";function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(e,r,t,n,u,a,o){try{var i=e[a](o);var c=i.value}catch(e){t(e);return}if(i.done){r(c)}else{Promise.resolve(c).then(n,u)}}function n(e){return function(){var r=this,n=arguments;return new Promise(function(u,a){var o=e.apply(r,n);function i(e){t(o,u,a,i,c,"next",e)}function c(e){t(o,u,a,i,c,"throw",e)}i(undefined)})}}function u(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function a(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var u=true;var a=false;var o,i;try{for(t=t.call(e);!(u=(o=t.next()).done);u=true){n.push(o.value);if(r&&n.length===r)break}}catch(e){a=true;i=e}finally{try{if(!u&&t["return"]!=null)t["return"]()}finally{if(a)throw i}}return n}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 i(e,t){return r(e)||a(e,t)||s(e,t)||o()}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function s(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}function l(e,r){var t,n,u,a,o={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(r){return c([e,r])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(o)try{if(t=1,n&&(u=a[0]&2?n["return"]:a[0]?n["throw"]||((u=n["return"])&&u.call(n),0):n.next)&&!(u=u.call(n,a[1])).done)return u;if(n=0,u)a=[a[0]&2,u.value];switch(a[0]){case 0:case 1:u=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;n=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(u=o.trys,u=u.length>0&&u[u.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!u||a[1]>u[0]&&a[1]<u[3])){o.label=a[1];break}if(a[0]===6&&o.label<u[1]){o.label=u[1];u=a;break}if(u&&o.label<u[2]){o.label=u[2];o.ops.push(a);break}if(u[2])o.ops.pop();o.trys.pop();continue}a=r.call(e,o)}catch(e){a=[6,e];n=0}finally{t=u=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var f=Object.create;var y=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var b=function(e,r){for(var t in r)y(e,t,{get:r[t],enumerable:!0})},g=function(e,r,t,n){var u=true,a=false,o=undefined;if(r&&(typeof r==="undefined"?"undefined":c(r))=="object"||typeof r=="function")try{var i=function(){var u=l.value;!d.call(e,u)&&u!==t&&y(e,u,{get:function(){return r[u]},enumerable:!(n=v(r,u))||n.enumerable})};for(var s=h(r)[Symbol.iterator](),l;!(u=(l=s.next()).done);u=true)i()}catch(e){a=true;o=e}finally{try{if(!u&&s.return!=null){s.return()}}finally{if(a){throw o}}}return e};var m=function(e,r,t){return t=e!=null?f(p(e)):{},g(r||!e||!e.__esModule?y(t,"default",{value:e,enumerable:!0}):t,e)},w=function(e){return g(y({},"__esModule",{value:!0}),e)};var S={};b(S,{useLocalStorage:function(){return C}});module.exports=w(S);var k=function(){return(typeof document==="undefined"?"undefined":c(document))>"u"?new URL("file:".concat(__filename)).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href},E=k();var O=require("react");var _=m(require("unorm"),1);var j=m(require("localforage"),1),q={get:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j.default.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error('Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return n(function(){var t;return l(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,j.default.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j.default.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},clear:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,j.default.clear()];case 1:r.sent();return[3,3];case 2:e=r.sent();console.error("Error clearing storage:",e);return[3,3];case 3:return[2]}})})()},key:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j.default.key(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error("Error getting key at index ".concat(e,":"),r),null)];case 3:return[2]}})})()},keys:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,j.default.keys()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting keys:",e),[])];case 3:return[2]}})})()},length:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,j.default.length()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting storage length:",e),0)];case 3:return[2]}})})()},iterate:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j.default.iterate(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error("Error iterating storage:",r);return[3,3];case 3:return[2]}})})()}};var I=require("graphql");var x=require("path"),P=require("url"),A=(0,P.fileURLToPath)(E),L=(0,x.dirname)(A);var U=m(require("crypto-js"),1),z=m(require("mongoose-aggregate-paginate-v2"),1),D=m(require("mongoose-paginate-v2"),1),R=m(require("slugify"),1),M=require("uuid");var N=R.default.default||R.default;var T={serialize:function(e){return JSON.stringify(e,function(e,r){return u(r,Date)?{__type:"Date",value:r.toISOString()}:r})},deserialize:function(e){return JSON.parse(e,function(e,r){return(r===null||r===void 0?void 0:r.__type)==="Date"?new Date(r.value):r})}};function C(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:T;var u=i((0,O.useState)(r),2),a=u[0],o=u[1],c=i((0,O.useState)(!1),2),s=c[0],f=c[1],y=(0,O.useCallback)(/*#__PURE__*/function(){var e=n(function(e){var r;return l(this,function(t){if(typeof e=="function"){r=e(a);o(r)}else o(e);return[2]})});return function(r){return e.apply(this,arguments)}}(),[a]);return(0,O.useEffect)(function(){var u=!0;return n(function(){var n,a,i,c;return l(this,function(s){switch(s.label){case 0:s.trys.push([0,5,,6]);return[4,q.get(e)];case 1:n=s.sent();if(!u)return[2];if(!(n!==null))return[3,2];a=t.deserialize(n);o(a);return[3,4];case 2:i=t.serialize(r);return[4,q.set(e,i)];case 3:s.sent(),o(r);s.label=4;case 4:return[3,6];case 5:c=s.sent();console.error("Error loading value:",c),u&&o(r);return[3,6];case 6:f(!0);return[2]}})})(),function(){u=!1,f(!1)}},[e,r,t]),(0,O.useEffect)(function(){if(!s)return;n(function(){var r,n;return l(this,function(u){switch(u.label){case 0:u.trys.push([0,2,,3]);r=t.serialize(a);return[4,q.set(e,r)];case 1:u.sent();return[3,3];case 2:n=u.sent();console.error("Error saving value:",n);return[3,3];case 3:return[2]}})})()},[a,e,t,s]),[a,y]}0&&(module.exports={useLocalStorage:useLocalStorage});
@@ -1 +1 @@
1
- function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(r){if(Array.isArray(r))return r}function t(r,e,t,n,o,u,a){try{var s=r[u](a);var i=s.value}catch(r){t(r);return}if(s.done){e(i)}else{Promise.resolve(i).then(n,o)}}function n(r){return function(){var e=this,n=arguments;return new Promise(function(o,u){var a=r.apply(e,n);function s(r){t(a,o,u,s,i,"next",r)}function i(r){t(a,o,u,s,i,"throw",r)}s(undefined)})}}function o(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function u(r,e){var t=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(t==null)return;var n=[];var o=true;var u=false;var a,s;try{for(t=t.call(r);!(o=(a=t.next()).done);o=true){n.push(a.value);if(e&&n.length===e)break}}catch(r){u=true;s=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(u)throw s}}return n}function a(){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 s(r,t){return e(r)||u(r,t)||i(r,t)||a()}function i(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}function c(r,e){var t,n,o,u,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return u={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(r){return function(e){return i([r,e])}}function i(u){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=e.call(r,a)}catch(r){u=[6,r];n=0}finally{t=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}import{useCallback as l,useEffect as f,useState as h}from"react";import p from"unorm";import y from"localforage";var v={get:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.getItem(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error('Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return n(function(){var t;return c(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,y.setItem(r,e)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(r,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.removeItem(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},clear:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,y.clear()];case 1:e.sent();return[3,3];case 2:r=e.sent();console.error("Error clearing storage:",r);return[3,3];case 3:return[2]}})})()},key:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.key(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error("Error getting key at index ".concat(r,":"),e),null)];case 3:return[2]}})})()},keys:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,y.keys()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting keys:",r),[])];case 3:return[2]}})})()},length:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,y.length()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting storage length:",r),0)];case 3:return[2]}})})()},iterate:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.iterate(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error("Error iterating storage:",e);return[3,3];case 3:return[2]}})})()}};import{GraphQLError as m}from"graphql";import{dirname as g}from"node:path";import{fileURLToPath as b}from"node:url";var d=b(import.meta.url),w=g(d);import S from"crypto-js";import k from"mongoose-aggregate-paginate-v2";import E from"mongoose-paginate-v2";import I from"slugify";import{v4 as _}from"uuid";var x=I.default||I;var A={serialize:function(r){return JSON.stringify(r,function(r,e){return o(e,Date)?{__type:"Date",value:e.toISOString()}:e})},deserialize:function(r){return JSON.parse(r,function(r,e){return(e===null||e===void 0?void 0:e.__type)==="Date"?new Date(e.value):e})}};function z(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:A;var u=s(h(e),2),a=u[0],i=u[1],p=s(h(!1),2),y=p[0],m=p[1],g=l(/*#__PURE__*/function(){var r=n(function(r){var e;return c(this,function(t){e=o(r,Function)?r(a):r;i(e);return[2]})});return function(e){return r.apply(this,arguments)}}(),[a]);return f(function(){var o=!0;return n(function(){var n,u,a,s;return c(this,function(c){switch(c.label){case 0:c.trys.push([0,5,,6]);return[4,v.get(r)];case 1:n=c.sent();if(!o)return[2];if(!(n!==null))return[3,2];u=t.deserialize(n);i(u);return[3,4];case 2:a=t.serialize(e);return[4,v.set(r,a)];case 3:c.sent(),i(e);c.label=4;case 4:return[3,6];case 5:s=c.sent();console.error("Error loading value:",s),o&&i(e);return[3,6];case 6:m(!0);return[2]}})})(),function(){o=!1,m(!1)}},[r,e,t]),f(function(){if(!y)return;n(function(){var e,n;return c(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);e=t.serialize(a);return[4,v.set(r,e)];case 1:o.sent();return[3,3];case 2:n=o.sent();console.error("Error saving value:",n);return[3,3];case 3:return[2]}})})()},[a,r,t,y]),[a,g]}export{z as useLocalStorage};
1
+ function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(r){if(Array.isArray(r))return r}function t(r,e,t,n,o,u,a){try{var s=r[u](a);var i=s.value}catch(r){t(r);return}if(s.done){e(i)}else{Promise.resolve(i).then(n,o)}}function n(r){return function(){var e=this,n=arguments;return new Promise(function(o,u){var a=r.apply(e,n);function s(r){t(a,o,u,s,i,"next",r)}function i(r){t(a,o,u,s,i,"throw",r)}s(undefined)})}}function o(r,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](r)}else{return r instanceof e}}function u(r,e){var t=r==null?null:typeof Symbol!=="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(t==null)return;var n=[];var o=true;var u=false;var a,s;try{for(t=t.call(r);!(o=(a=t.next()).done);o=true){n.push(a.value);if(e&&n.length===e)break}}catch(r){u=true;s=r}finally{try{if(!o&&t["return"]!=null)t["return"]()}finally{if(u)throw s}}return n}function a(){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 s(r,t){return e(r)||u(r,t)||i(r,t)||a()}function i(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}function c(r,e){var t,n,o,u,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return u={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(r){return function(e){return i([r,e])}}function i(u){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=e.call(r,a)}catch(r){u=[6,r];n=0}finally{t=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}import{useCallback as l,useEffect as f,useState as h}from"react";import p from"unorm";import y from"localforage";var v={get:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.getItem(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error('Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return n(function(){var t;return c(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,y.setItem(r,e)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(r,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.removeItem(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},clear:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,y.clear()];case 1:e.sent();return[3,3];case 2:r=e.sent();console.error("Error clearing storage:",r);return[3,3];case 3:return[2]}})})()},key:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.key(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error("Error getting key at index ".concat(r,":"),e),null)];case 3:return[2]}})})()},keys:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,y.keys()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting keys:",r),[])];case 3:return[2]}})})()},length:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,y.length()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting storage length:",r),0)];case 3:return[2]}})})()},iterate:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.iterate(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error("Error iterating storage:",e);return[3,3];case 3:return[2]}})})()}};import{GraphQLError as m}from"graphql";import{dirname as g}from"node:path";import{fileURLToPath as b}from"node:url";var d=b(import.meta.url),w=g(d);import S from"crypto-js";import k from"mongoose-aggregate-paginate-v2";import E from"mongoose-paginate-v2";import I from"slugify";import{v4 as _}from"uuid";var x=I.default||I;var A={serialize:function(r){return JSON.stringify(r,function(r,e){return o(e,Date)?{__type:"Date",value:e.toISOString()}:e})},deserialize:function(r){return JSON.parse(r,function(r,e){return(e===null||e===void 0?void 0:e.__type)==="Date"?new Date(e.value):e})}};function z(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:A;var o=s(h(e),2),u=o[0],a=o[1],i=s(h(!1),2),p=i[0],y=i[1],m=l(/*#__PURE__*/function(){var r=n(function(r){var e;return c(this,function(t){if(typeof r=="function"){e=r(u);a(e)}else a(r);return[2]})});return function(e){return r.apply(this,arguments)}}(),[u]);return f(function(){var o=!0;return n(function(){var n,u,s,i;return c(this,function(c){switch(c.label){case 0:c.trys.push([0,5,,6]);return[4,v.get(r)];case 1:n=c.sent();if(!o)return[2];if(!(n!==null))return[3,2];u=t.deserialize(n);a(u);return[3,4];case 2:s=t.serialize(e);return[4,v.set(r,s)];case 3:c.sent(),a(e);c.label=4;case 4:return[3,6];case 5:i=c.sent();console.error("Error loading value:",i),o&&a(e);return[3,6];case 6:y(!0);return[2]}})})(),function(){o=!1,y(!1)}},[r,e,t]),f(function(){if(!p)return;n(function(){var e,n;return c(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);e=t.serialize(u);return[4,v.set(r,e)];case 1:o.sent();return[3,3];case 2:n=o.sent();console.error("Error saving value:",n);return[3,3];case 3:return[2]}})})()},[u,r,t,p]),[u,m]}export{z as useLocalStorage};