upconta.frontend-utils 1.0.0 → 1.0.2
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.
- package/.dist/cjs/components/LayoutBase.d.ts +17 -0
- package/.dist/cjs/components/index.d.ts +1 -0
- package/.dist/cjs/index.js +11 -2
- package/.dist/cjs/index.js.map +1 -1
- package/.dist/cjs/libs/hooks/confirmacion-salida.d.ts +13 -0
- package/.dist/cjs/libs/hooks/vista-insertar.d.ts +60 -0
- package/.dist/cjs/libs/hooks/vista-principal.d.ts +2 -8
- package/.dist/cjs/libs/index.d.ts +1 -0
- package/.dist/cjs/libs/utils.d.ts +5 -0
- package/.dist/esm/index.js +11 -2
- package/.dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
declare const LayoutBase: FC<{
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
sidebar?: {
|
|
5
|
+
title: {
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
href: string;
|
|
8
|
+
};
|
|
9
|
+
menu?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
navbar?: {
|
|
12
|
+
title: string;
|
|
13
|
+
options?: ReactNode;
|
|
14
|
+
};
|
|
15
|
+
footer?: ReactNode;
|
|
16
|
+
}>;
|
|
17
|
+
export default LayoutBase;
|
package/.dist/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react"),t=require("next/link"),r=require("next/router"),n=require("@ant-design/icons"),o=require("antd"),
|
|
1
|
+
"use strict";var e=require("react"),t=require("next/link"),r=require("next/router"),n=require("@ant-design/icons"),o=require("antd"),i=require("axios"),a=require("cookies-next"),s=require("dayjs"),u=require("ts-debounce"),c=require("swr"),l=require("antd/locale/es_ES");!function(e,t){void 0===t&&(t={});var r=t.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".fixed{position:fixed}.sticky{position:sticky}.top-0{top:0}.\\!z-\\[2\\]{z-index:2!important}.\\!m-0{margin:0!important}.m-4{margin:1rem}.\\!mb-0{margin-bottom:0!important}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.ml-0{margin-left:0}.ml-\\[230px\\]{margin-left:230px}.mt-4{margin-top:1rem}.flex{display:flex}.grid{display:grid}.h-16{height:4rem}.h-full{height:100%}.min-h-screen{min-height:100vh}.w-full{width:100%}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.border-b{border-bottom-width:1px}.\\!px-4{padding-left:1rem!important;padding-right:1rem!important}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.\\!font-normal{font-weight:400!important}.font-bold{font-weight:700}.\\!text-gray-500{--tw-text-opacity:1!important;color:rgb(107 114 128/var(--tw-text-opacity))!important}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.ant-table{overflow-x:auto}@media (min-width:768px){.md\\:m-8{margin:2rem}.md\\:w-auto{width:auto}.md\\:flex-row{flex-direction:row}.md\\:flex-nowrap{flex-wrap:nowrap}.md\\:items-end{align-items:flex-end}}@media (min-width:1280px){.xl\\:m-16{margin:4rem}}",{insertAt:"top"});var f=function(){return f=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},f.apply(this,arguments)};function d(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))}function p(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function m(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var v,y={exports:{}},h={};var g,b={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.development.js
|
|
@@ -7,5 +7,14 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/"production"===process.env.NODE_ENV?m.exports=function(){if(y)return v;y=1;var t=e,r=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,n){var s,u={},c=null,l=null;for(s in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(l=t.ref),t)o.call(t,s)&&!i.hasOwnProperty(s)&&(u[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===u[s]&&(u[s]=t[s]);return{$$typeof:r,type:e,key:c,ref:l,props:u,_owner:a.current}}return v.Fragment=n,v.jsx=s,v.jsxs=s,v}():m.exports=(h||(h=1,"production"!==process.env.NODE_ENV&&function(){var t=e,r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),m=Symbol.iterator,v="@@iterator",h=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];!function(e,t,r){var n=h.ReactDebugCurrentFrame.getStackAddendum();""!==n&&(t+="%s",r=r.concat([n]));var o=r.map((function(e){return String(e)}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}("error",e,r)}var w,x=!1,S=!1,j=!1,k=!1,O=!1;function _(e){return e.displayName||"Context"}function R(e){if(null==e)return null;if("number"==typeof e.tag&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case l:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case u:return _(e)+".Consumer";case s:return _(e._context)+".Provider";case c:return function(e,t,r){var n=e.displayName;if(n)return n;var o=t.displayName||t.name||"";return""!==o?r+"("+o+")":r}(e,e.render,"ForwardRef");case p:var t=e.displayName||null;return null!==t?t:R(e.type)||"Memo";case d:var r=e,y=r._payload,m=r._init;try{return R(m(y))}catch(e){return null}}return null}w=Symbol.for("react.module.reference");var E,P,T,F,N,D,C,q=Object.assign,$=0;function I(){}I.__reactDisabledLog=!0;var L,A=h.ReactCurrentDispatcher;function U(e,t,r){if(void 0===L)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);L=n&&n[1]||""}return"\n"+L+e}var Y,B=!1,W="function"==typeof WeakMap?WeakMap:Map;function M(e,t){if(!e||B)return"";var r,n=Y.get(e);if(void 0!==n)return n;B=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=A.current,A.current=null,function(){if(0===$){E=console.log,P=console.info,T=console.warn,F=console.error,N=console.group,D=console.groupCollapsed,C=console.groupEnd;var e={configurable:!0,enumerable:!0,value:I,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}$++}();try{if(t){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(i,[])}catch(e){r=e}Reflect.construct(e,[],i)}else{try{i.call()}catch(e){r=e}e.call(i.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),u=r.stack.split("\n"),c=s.length-1,l=u.length-1;c>=1&&l>=0&&s[c]!==u[l];)l--;for(;c>=1&&l>=0;c--,l--)if(s[c]!==u[l]){if(1!==c||1!==l)do{if(c--,--l<0||s[c]!==u[l]){var f="\n"+s[c].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),"function"==typeof e&&Y.set(e,f),f}}while(c>=1&&l>=0);break}}}finally{B=!1,A.current=o,function(){if(0==--$){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:q({},e,{value:E}),info:q({},e,{value:P}),warn:q({},e,{value:T}),error:q({},e,{value:F}),group:q({},e,{value:N}),groupCollapsed:q({},e,{value:D}),groupEnd:q({},e,{value:C})})}$<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var p=e?e.displayName||e.name:"",d=p?U(p):"";return"function"==typeof e&&Y.set(e,d),d}function z(e,t,r){if(null==e)return"";if("function"==typeof e)return M(e,!(!(n=e.prototype)||!n.isReactComponent));var n;if("string"==typeof e)return U(e);switch(e){case l:return U("Suspense");case f:return U("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return M(e.render,!1);case p:return z(e.type,t,r);case d:var o=e,a=o._payload,i=o._init;try{return z(i(a),t,r)}catch(e){}}return""}Y=new W;var H=Object.prototype.hasOwnProperty,V={},J=h.ReactDebugCurrentFrame;function K(e){if(e){var t=e._owner,r=z(e.type,e._source,t?t.type:null);J.setExtraStackFrame(r)}else J.setExtraStackFrame(null)}var X=Array.isArray;function G(e){return X(e)}function Q(e){return""+e}function Z(e){if(function(e){try{return Q(e),!1}catch(e){return!0}}(e))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),Q(e)}var ee,te,re,ne=h.ReactCurrentOwner,oe={key:!0,ref:!0,__self:!0,__source:!0};re={};var ae=function(e,t,n,o,a,i,s){var u={$$typeof:r,type:e,key:t,ref:n,props:s,_owner:i,_store:{}};return Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(u,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(u,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u};function ie(e,t,r,n,o){var a,i={},s=null,u=null;for(a in void 0!==r&&(Z(r),s=""+r),function(e){if(H.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(Z(t.key),s=""+t.key),function(e){if(H.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(u=t.ref,function(e,t){if("string"==typeof e.ref&&ne.current&&t&&ne.current.stateNode!==t){var r=R(ne.current.type);re[r]||(b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',R(ne.current.type),e.ref),re[r]=!0)}}(t,o)),t)H.call(t,a)&&!oe.hasOwnProperty(a)&&(i[a]=t[a]);if(e&&e.defaultProps){var c=e.defaultProps;for(a in c)void 0===i[a]&&(i[a]=c[a])}if(s||u){var l="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var r=function(){ee||(ee=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(i,l),u&&function(e,t){var r=function(){te||(te=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(i,l)}return ae(e,s,u,o,n,ne.current,i)}var se,ue=h.ReactCurrentOwner,ce=h.ReactDebugCurrentFrame;function le(e){if(e){var t=e._owner,r=z(e.type,e._source,t?t.type:null);ce.setExtraStackFrame(r)}else ce.setExtraStackFrame(null)}function fe(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}function pe(){if(ue.current){var e=R(ue.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}se=!1;var de={};function ye(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=pe();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!de[r]){de[r]=!0;var n="";e&&e._owner&&e._owner!==ue.current&&(n=" It was passed a child from "+R(e._owner.type)+"."),le(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),le(null)}}}function me(e,t){if("object"==typeof e)if(G(e))for(var r=0;r<e.length;r++){var n=e[r];fe(n)&&ye(n,t)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=m&&e[m]||e[v];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)fe(a.value)&&ye(a.value,t)}}function ve(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==c&&r.$$typeof!==p)return;t=r.propTypes}if(t){var n=R(r);!function(e,t,r,n,o){var a=Function.call.bind(H);for(var i in e)if(a(e,i)){var s=void 0;try{if("function"!=typeof e[i]){var u=Error((n||"React class")+": "+r+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}s=e[i](t,i,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(K(o),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,i,typeof s),K(null)),s instanceof Error&&!(s.message in V)&&(V[s.message]=!0,K(o),b("Failed %s type: %s",r,s.message),K(null))}}(t,e.props,"prop",n,e)}else void 0===r.PropTypes||se||(se=!0,b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R(r)||"Unknown"));"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var he={};function ge(e,t,n,m,v,h){var g=function(e){return"string"==typeof e||"function"==typeof e||!!(e===o||e===i||O||e===a||e===l||e===f||k||e===y||x||S||j)||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===p||e.$$typeof===s||e.$$typeof===u||e.$$typeof===c||e.$$typeof===w||void 0!==e.getModuleId)}(e);if(!g){var _,E="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(E+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),E+=pe(),null===e?_="null":G(e)?_="array":void 0!==e&&e.$$typeof===r?(_="<"+(R(e.type)||"Unknown")+" />",E=" Did you accidentally export a JSX literal instead of a component?"):_=typeof e,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",_,E)}var P=ie(e,t,n,v,h);if(null==P)return P;if(g){var T=t.children;if(void 0!==T)if(m)if(G(T)){for(var F=0;F<T.length;F++)me(T[F],e);Object.freeze&&Object.freeze(T)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else me(T,e)}if(H.call(t,"key")){var N=R(e),D=Object.keys(t).filter((function(e){return"key"!==e})),C=D.length>0?"{key: someKey, "+D.join(": ..., ")+": ...}":"{key: someKey}";he[N+C]||(b('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',C,N,D.length>0?"{"+D.join(": ..., ")+": ...}":"{}",N),he[N+C]=!0)}return e===o?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var n=t[r];if("children"!==n&&"key"!==n){le(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),le(null);break}}null!==e.ref&&(le(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),le(null))}(P):ve(P),P}var be=function(e,t,r){return ge(e,t,r,!1)},we=function(e,t,r){return ge(e,t,r,!0)};g.Fragment=o,g.jsx=be,g.jsxs=we}()),g);var b=m.exports,w=function(e){return e.paths?b.jsx(o.Breadcrumb,{items:e.paths.map((function(e){var r=e.to,n=e.label;return{title:r?b.jsx(t,{href:r,children:n}):n}}))}):null},x={hostFastify:"",hostRestify:"",userTokenName:"",adminTokenName:"",cookieDominio:""},S=function(e){return p(void 0,void 0,void 0,(function(){var t,r,n,o,a,i;return d(this,(function(s){switch(s.label){case 0:if(!((t=(null===(a=e.response)||void 0===a?void 0:a.data)?(null===(i=e.response.data)||void 0===i?void 0:i.message)||e.response.data:e.message)instanceof Blob))return[3,5];s.label=1;case 1:return s.trys.push([1,3,,5]),n=(r=JSON).parse,[4,t.text()];case 2:return[2,n.apply(r,[s.sent()]).message];case 3:return s.sent(),o={},[4,t.text()];case 4:return[2,(o.message=s.sent(),o.tipo="error",o)];case 5:return[2,{message:t,tipo:"error"}]}}))}))},j=function(){var e=o.App.useApp(),t=e.modal,r=e.message,n=e.notification;return{showError:function(e,r){return p(void 0,void 0,void 0,(function(){var n;return d(this,(function(o){switch(o.label){case 0:return[4,S(e)];case 1:return n=o.sent(),t[n.tipo]({title:(null==r?void 0:r.title)||"Proceso fallido",width:450,content:b.jsxs(b.Fragment,{children:[n.message,null==r?void 0:r.cuerpoAdicional]}),okType:"danger"}),[2]}}))}))},modal:t,message:r,notification:n}},k=function(e,t){var r="";r=!e||"fastify"===e||e.includes("/v4")?x.hostFastify:x.hostRestify;var n=x.userTokenName;if("administrador"===(null==t?void 0:t.tipo))n=x.adminTokenName;var o=a.create({baseURL:r});return o.defaults.headers.common.Authorization=i.getCookie(n,{domain:x.cookieDominio}),o},O=function(e,t){var r=new URL(e,e.includes("v4")?x.hostFastify:x.hostRestify),n="";return t&&(n=new URLSearchParams(t).toString()),r.href+(n?"?"+n:"")},_={empresa:function(e,t){return p(void 0,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return t?[4,k("restify").get("/v3/auth/business/"+t)]:[2];case 1:if(e.sent().data)throw new Error("La empresa ya se encuentra registrada");return[2]}}))}))}},R={required:function(e){return void 0===e&&(e="El campo es requerido"),{required:!0,message:e}},min:function(e,t){return void 0===t&&(t="Debe tener mínimo ".concat(e.toString()," caracteres")),{min:e,message:t}},max:function(e,t){return void 0===t&&(t="Debe tener máximo ".concat(e.toString()," caracteres")),{max:e,message:t}},email:function(e){return void 0===e&&(e="El correo electrónico no es válido"),{type:"email",message:e}},pattern:function(e,t){return void 0===t&&(t="No cumple el formato requerido"),{pattern:e,message:t}},unico:function(e){return{validator:u.debounce(_[e],300)}},correos:function(){return{validator:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return p(void 0,function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([e],t,!0),void 0,(function(e,t){return void 0===t&&(t=[]),d(this,(function(e){if(t.some((function(e){return!e.includes("@")})))throw new Error("Alguno de los correos no es válido");return[2]}))}))}}},diasDiferencia:function(e,t){return void 0===t&&(t="La fecha ingresada no es válido"),{validator:function(r,n){return p(void 0,void 0,void 0,(function(){var r;return d(this,(function(o){if(r=s(n).startOf("day").diff(s().startOf("day"),"day"),e<0?r<e:r>e)throw new Error(t);return[2]}))}))}}}},E="es-EC",P={currency:function(e,t){return void 0===t&&(t=2),e||(e=0),new Intl.NumberFormat(E,{style:"currency",currency:"USD",minimumFractionDigits:t}).format("number"==typeof e?e:parseFloat(e))},date:function(e,t){return void 0===t&&(t="DD/MM/YYYY"),s(e).format(t)},completeDate:function(e){return s(e).format("DD/MM/YYYY HH:mm:ss")},month:function(e){return s(e).format("MM/YYYY")},percent:function(e,t){return void 0===t&&(t=2),e||(e=0),new Intl.NumberFormat(E,{style:"percent",minimumFractionDigits:t}).format("number"==typeof e?e:parseFloat(e))}};var T="#F34D24",F="#FFFFFF";exports.$filtros=P,exports.$reglas=R,exports.Header=function(a){var i,s=a.defaultInsert,u=void 0!==s&&s,c=a.loading,l=void 0!==c&&c,f=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(a,["defaultInsert","loading"]),p=r.useRouter(),d=p.pathname,y=e.useState(""),m=y[0],v=y[1],h=new URLSearchParams(p.query),g=function(){var e=new URLSearchParams(h.toString());(e.get("q")||"")!==m&&(m?e.set("q",m):e.delete("q"),e.delete("page"),p.push({query:Object.fromEntries(e)}))},x=b.jsxs("div",{className:"flex w-full md:w-auto flex-wrap md:flex-nowrap gap-2 justify-end",children:[!0!==f.ocultarBuscador?b.jsx(o.Input.Search,{value:m,placeholder:"Ingresar búsqueda",onChange:function(e){return v(e.target.value||"")},onSearch:g,onPressEnter:g}):null,null!==u?u||b.jsx(t,{href:(i=d,i.endsWith("/")&&(i=i.slice(0,-1)),i+"/insert"),children:b.jsx(o.Button,{type:"primary",children:"Insertar"})}):null,f.onRefrescar?b.jsx("div",{children:b.jsx(o.Button,{loading:l,title:"Refrescar datos",icon:b.jsx(n.ReloadOutlined,{}),onClick:f.onRefrescar})}):null,f.children]});return e.useEffect((function(){p.isReady&&v(h.get("q")||"")}),[p.isReady]),b.jsxs("div",{className:"flex md:flex-row flex-col md:items-end items-start justify-between gap-6 mb-6",children:[b.jsxs("div",{children:[b.jsx(w,{paths:f.paths}),b.jsx(o.Typography.Title,{className:"!mb-0 mt-4",children:f.title}),f.subtitle&&b.jsx(o.Typography.Title,{level:3,type:"secondary",className:"!font-normal !m-0",children:f.subtitle})]}),null!==f.column?f.column||x:null]})},exports.Seeker=function(t){var r=e.useState(""),n=r[0];r[1];var a=function(t){var r=this,n=e.useRef(t.defaultOptions),o=(t.type,{withOptions:!0,label:"Cliente",endpoint:"/v3/administrative/clients",params:{fields:"idType id name phone email address",estado:"activo"},field:"id",placeholder:"Ingresar la identificación del cliente",title:function(e){return"".concat(e.id)},subtitle:function(e){return e.name},preBusquedaQ:function(e){return void 0===e&&(e=""),e=e.trim(),/^\d+/.test(e)?"^"+e:e}});if(!o)return null;var a=k(o.endpoint),i=c(o.withOptions&&!t.defaultOptions?o.endpoint+"/get-options":null,(function(e){return p(r,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,a.get(e)];case 1:return[2,t.sent().data]}}))}))}),{revalidateOnFocus:!1}).data;return i&&(n.current=i),o}({type:t.type,defaultOptions:void 0});return a?b.jsx(o.Form.Item,{name:t.name,label:t.hideLabel?void 0:t.label||a.label,extra:t.hideMessage?void 0:n,rules:t.required?[R.required()]:[{}],className:t.classNameFormItem}):null},exports.TemaPrincipal=function(t){var r=e.useState(!1),n=r[0],a=r[1];return e.useEffect((function(){a(!0)}),[]),n?b.jsx(o.ConfigProvider,{locale:l,theme:{token:{colorPrimary:T,colorLink:T,colorTextDisabled:"#00000080"},components:{Layout:{bodyBg:F,headerBg:F}}},children:b.jsx(o.App,{children:b.jsx(o.Layout,{className:t.className,style:t.style,children:t.children})})}):null},exports.configurarUtils=function(e){x=f(f({},x),e)},exports.getApiEndpoint=O,exports.getAxios=k,exports.useUtils=j,exports.useVistaPrincipal=function(e){var t=k(e.endpoint),n=r.useRouter(),o=j().showError,a=c.useSWRConfig().mutate,i=c(e.sinOptions?null:e.optionsPath||e.endpoint+"/get-options",(function(e){return p(void 0,void 0,void 0,(function(){return d(this,(function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,s=void 0===i?{}:i,u=new URLSearchParams(f(f({},e.params),n.query)).toString(),l=e.endpoint+(u?"?"+u:""),y=c(n.isReady?l:null,(function(e){return p(void 0,void 0,void 0,(function(){return d(this,(function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent().data]}}))}))})),m=y.data,v=y.error,h=y.isLoading,g=(null==m?void 0:m.data)||[],b=(null==m?void 0:m.total)||0,w=new URLSearchParams(n.query),x=w.get("page"),S=x?parseInt(x):1,_=w.get("limit"),R=_?parseInt(_):20,E={loading:h,dataSource:g,rowKey:"_id",bordered:!0,pagination:{current:S,defaultPageSize:R,total:b},onChange:function(e,t,r){return p(void 0,void 0,void 0,(function(){var t,o,a,i;return d(this,(function(s){return t=w.toString(),o=new URLSearchParams(t),e.current!==S&&("1"===(a=e.current.toString())?o.delete("page"):o.set("page",a)),e.pageSize!==R&&("20"===(i=e.pageSize.toString())?o.delete("limit"):o.set("limit",i)),Array.isArray(r)||("ascend"===r.order?o.set("sort",r.field):"descend"===r.order?o.set("sort","-"+r.field):o.delete("sort")),t!==o.toString()&&n.push({query:Object.fromEntries(o)}),[2]}))}))}},P=function(){a(l)};return{data:g,isLoading:h,error:v,options:s,endpoint:e.endpoint,endpointWithHost:O(e.endpoint),mainroute:n.route,tableProps:E,init:P,getOpt:function(e,t){var r,n=null===(r=s[e])||void 0===r?void 0:r.find((function(e){return e.id===t}));return n?n.description:""},remove:function(r){return p(void 0,void 0,void 0,(function(){var n;return d(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t.delete("string"==typeof r?e.endpoint+"/"+r:r.endpoint)];case 1:return a.sent(),P(),[3,3];case 2:return n=a.sent(),o(n),[3,3];case 3:return[2]}}))}))},cancel:function(r){return p(void 0,void 0,void 0,(function(){var n;return d(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t.delete("string"==typeof r?e.endpoint+"/"+r+"/cancel":r.endpoint)];case 1:return a.sent(),P(),[3,3];case 2:return n=a.sent(),o(n),[3,3];case 3:return[2]}}))}))}}};
|
|
10
|
+
*/"production"===process.env.NODE_ENV?y.exports=function(){if(v)return h;v=1;var t=e,r=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,n){var s,u={},c=null,l=null;for(s in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(l=t.ref),t)o.call(t,s)&&!a.hasOwnProperty(s)&&(u[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===u[s]&&(u[s]=t[s]);return{$$typeof:r,type:e,key:c,ref:l,props:u,_owner:i.current}}return h.Fragment=n,h.jsx=s,h.jsxs=s,h}():y.exports=(g||(g=1,"production"!==process.env.NODE_ENV&&function(){var t=e,r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),v=Symbol.iterator,y="@@iterator",h=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];!function(e,t,r){var n=h.ReactDebugCurrentFrame.getStackAddendum();""!==n&&(t+="%s",r=r.concat([n]));var o=r.map((function(e){return String(e)}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}("error",e,r)}var w,x=!1,S=!1,O=!1,_=!1,E=!1;function j(e){return e.displayName||"Context"}function k(e){if(null==e)return null;if("number"==typeof e.tag&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case n:return"Portal";case a:return"Profiler";case i:return"StrictMode";case l:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case u:return j(e)+".Consumer";case s:return j(e._context)+".Provider";case c:return function(e,t,r){var n=e.displayName;if(n)return n;var o=t.displayName||t.name||"";return""!==o?r+"("+o+")":r}(e,e.render,"ForwardRef");case d:var t=e.displayName||null;return null!==t?t:k(e.type)||"Memo";case p:var r=e,m=r._payload,v=r._init;try{return k(v(m))}catch(e){return null}}return null}w=Symbol.for("react.module.reference");var R,T,L,D,C,P,I,F=Object.assign,N=0;function A(){}A.__reactDisabledLog=!0;var q,V=h.ReactCurrentDispatcher;function $(e,t,r){if(void 0===q)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);q=n&&n[1]||""}return"\n"+q+e}var B,M=!1,U="function"==typeof WeakMap?WeakMap:Map;function W(e,t){if(!e||M)return"";var r,n=B.get(e);if(void 0!==n)return n;M=!0;var o,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=V.current,V.current=null,function(){if(0===N){R=console.log,T=console.info,L=console.warn,D=console.error,C=console.group,P=console.groupCollapsed,I=console.groupEnd;var e={configurable:!0,enumerable:!0,value:A,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}N++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){r=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){r=e}e.call(a.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),u=r.stack.split("\n"),c=s.length-1,l=u.length-1;c>=1&&l>=0&&s[c]!==u[l];)l--;for(;c>=1&&l>=0;c--,l--)if(s[c]!==u[l]){if(1!==c||1!==l)do{if(c--,--l<0||s[c]!==u[l]){var f="\n"+s[c].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),"function"==typeof e&&B.set(e,f),f}}while(c>=1&&l>=0);break}}}finally{M=!1,V.current=o,function(){if(0==--N){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:R}),info:F({},e,{value:T}),warn:F({},e,{value:L}),error:F({},e,{value:D}),group:F({},e,{value:C}),groupCollapsed:F({},e,{value:P}),groupEnd:F({},e,{value:I})})}N<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var d=e?e.displayName||e.name:"",p=d?$(d):"";return"function"==typeof e&&B.set(e,p),p}function Y(e,t,r){if(null==e)return"";if("function"==typeof e)return W(e,!(!(n=e.prototype)||!n.isReactComponent));var n;if("string"==typeof e)return $(e);switch(e){case l:return $("Suspense");case f:return $("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return W(e.render,!1);case d:return Y(e.type,t,r);case p:var o=e,i=o._payload,a=o._init;try{return Y(a(i),t,r)}catch(e){}}return""}B=new U;var z=Object.prototype.hasOwnProperty,H={},K=h.ReactDebugCurrentFrame;function G(e){if(e){var t=e._owner,r=Y(e.type,e._source,t?t.type:null);K.setExtraStackFrame(r)}else K.setExtraStackFrame(null)}var J=Array.isArray;function X(e){return J(e)}function Q(e){return""+e}function Z(e){if(function(e){try{return Q(e),!1}catch(e){return!0}}(e))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),Q(e)}var ee,te,re,ne=h.ReactCurrentOwner,oe={key:!0,ref:!0,__self:!0,__source:!0};re={};var ie=function(e,t,n,o,i,a,s){var u={$$typeof:r,type:e,key:t,ref:n,props:s,_owner:a,_store:{}};return Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(u,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(u,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u};function ae(e,t,r,n,o){var i,a={},s=null,u=null;for(i in void 0!==r&&(Z(r),s=""+r),function(e){if(z.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(Z(t.key),s=""+t.key),function(e){if(z.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(u=t.ref,function(e,t){if("string"==typeof e.ref&&ne.current&&t&&ne.current.stateNode!==t){var r=k(ne.current.type);re[r]||(g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',k(ne.current.type),e.ref),re[r]=!0)}}(t,o)),t)z.call(t,i)&&!oe.hasOwnProperty(i)&&(a[i]=t[i]);if(e&&e.defaultProps){var c=e.defaultProps;for(i in c)void 0===a[i]&&(a[i]=c[i])}if(s||u){var l="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var r=function(){ee||(ee=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(a,l),u&&function(e,t){var r=function(){te||(te=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(a,l)}return ie(e,s,u,o,n,ne.current,a)}var se,ue=h.ReactCurrentOwner,ce=h.ReactDebugCurrentFrame;function le(e){if(e){var t=e._owner,r=Y(e.type,e._source,t?t.type:null);ce.setExtraStackFrame(r)}else ce.setExtraStackFrame(null)}function fe(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}function de(){if(ue.current){var e=k(ue.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}se=!1;var pe={};function me(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=de();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!pe[r]){pe[r]=!0;var n="";e&&e._owner&&e._owner!==ue.current&&(n=" It was passed a child from "+k(e._owner.type)+"."),le(e),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),le(null)}}}function ve(e,t){if("object"==typeof e)if(X(e))for(var r=0;r<e.length;r++){var n=e[r];fe(n)&&me(n,t)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=v&&e[v]||e[y];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var i,a=o.call(e);!(i=a.next()).done;)fe(i.value)&&me(i.value,t)}}function ye(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==c&&r.$$typeof!==d)return;t=r.propTypes}if(t){var n=k(r);!function(e,t,r,n,o){var i=Function.call.bind(z);for(var a in e)if(i(e,a)){var s=void 0;try{if("function"!=typeof e[a]){var u=Error((n||"React class")+": "+r+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}s=e[a](t,a,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(G(o),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,a,typeof s),G(null)),s instanceof Error&&!(s.message in H)&&(H[s.message]=!0,G(o),g("Failed %s type: %s",r,s.message),G(null))}}(t,e.props,"prop",n,e)}else void 0===r.PropTypes||se||(se=!0,g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",k(r)||"Unknown"));"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var he={};function ge(e,t,n,v,y,h){var b=function(e){return"string"==typeof e||"function"==typeof e||!!(e===o||e===a||E||e===i||e===l||e===f||_||e===m||x||S||O)||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===d||e.$$typeof===s||e.$$typeof===u||e.$$typeof===c||e.$$typeof===w||void 0!==e.getModuleId)}(e);if(!b){var j,R="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(R+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),R+=de(),null===e?j="null":X(e)?j="array":void 0!==e&&e.$$typeof===r?(j="<"+(k(e.type)||"Unknown")+" />",R=" Did you accidentally export a JSX literal instead of a component?"):j=typeof e,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",j,R)}var T=ae(e,t,n,y,h);if(null==T)return T;if(b){var L=t.children;if(void 0!==L)if(v)if(X(L)){for(var D=0;D<L.length;D++)ve(L[D],e);Object.freeze&&Object.freeze(L)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ve(L,e)}if(z.call(t,"key")){var C=k(e),P=Object.keys(t).filter((function(e){return"key"!==e})),I=P.length>0?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}";he[C+I]||(g('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',I,C,P.length>0?"{"+P.join(": ..., ")+": ...}":"{}",C),he[C+I]=!0)}return e===o?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var n=t[r];if("children"!==n&&"key"!==n){le(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),le(null);break}}null!==e.ref&&(le(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),le(null))}(T):ye(T),T}var be=function(e,t,r){return ge(e,t,r,!1)},we=function(e,t,r){return ge(e,t,r,!0)};b.Fragment=o,b.jsx=be,b.jsxs=we}()),b);var w,x=y.exports,S=function(e){return e.paths?x.jsx(o.Breadcrumb,{items:e.paths.map((function(e){var r=e.to,n=e.label;return{title:r?x.jsx(t,{href:r,children:n}):n}}))}):null},O={hostFastify:"",hostRestify:"",userTokenName:"",adminTokenName:"",cookieDominio:""},_=function(e){return d(void 0,void 0,void 0,(function(){var t,r,n,o,i,a;return p(this,(function(s){switch(s.label){case 0:if(!((t=(null===(i=e.response)||void 0===i?void 0:i.data)?(null===(a=e.response.data)||void 0===a?void 0:a.message)||e.response.data:e.message)instanceof Blob))return[3,5];s.label=1;case 1:return s.trys.push([1,3,,5]),n=(r=JSON).parse,[4,t.text()];case 2:return[2,n.apply(r,[s.sent()]).message];case 3:return s.sent(),o={},[4,t.text()];case 4:return[2,(o.message=s.sent(),o.tipo="error",o)];case 5:return[2,{message:t,tipo:"error"}]}}))}))},E=function(){var e=o.App.useApp(),t=e.modal,r=e.message,n=e.notification;return{showError:function(e,r){return d(void 0,void 0,void 0,(function(){var n;return p(this,(function(o){switch(o.label){case 0:return[4,_(e)];case 1:return n=o.sent(),t[n.tipo]({title:(null==r?void 0:r.title)||"Proceso fallido",width:450,content:x.jsxs(x.Fragment,{children:[n.message,null==r?void 0:r.cuerpoAdicional]}),okType:"danger"}),[2]}}))}))},modal:t,message:r,notification:n}},j=function(e){return"administrador"===e?O.adminTokenName:O.userTokenName},k=function(e,t){var r="";r=!e||"fastify"===e||e.includes("/v4")?O.hostFastify:O.hostRestify;var n=i.create({baseURL:r});return n.defaults.headers.common.Authorization=a.getCookie(j(null==t?void 0:t.tipo),{domain:O.cookieDominio}),n},R=function(e,t){var r=new URL(e,e.includes("v4")?O.hostFastify:O.hostRestify),n="";return t&&(n=new URLSearchParams(t).toString()),r.href+(n?"?"+n:"")},T=function(e){var t,r=0;if(0===e.length)return r;for(t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r},L={empresa:function(e,t){return d(void 0,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return t?[4,k("restify").get("/v3/auth/business/"+t)]:[2];case 1:if(e.sent().data)throw new Error("La empresa ya se encuentra registrada");return[2]}}))}))}},D={required:function(e){return void 0===e&&(e="El campo es requerido"),{required:!0,message:e}},min:function(e,t){return void 0===t&&(t="Debe tener mínimo ".concat(e.toString()," caracteres")),{min:e,message:t}},max:function(e,t){return void 0===t&&(t="Debe tener máximo ".concat(e.toString()," caracteres")),{max:e,message:t}},email:function(e){return void 0===e&&(e="El correo electrónico no es válido"),{type:"email",message:e}},pattern:function(e,t){return void 0===t&&(t="No cumple el formato requerido"),{pattern:e,message:t}},unico:function(e){return{validator:u.debounce(L[e],300)}},correos:function(){return{validator:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return d(void 0,m([e],t,!0),void 0,(function(e,t){return void 0===t&&(t=[]),p(this,(function(e){if(t.some((function(e){return!e.includes("@")})))throw new Error("Alguno de los correos no es válido");return[2]}))}))}}},diasDiferencia:function(e,t){return void 0===t&&(t="La fecha ingresada no es válido"),{validator:function(r,n){return d(void 0,void 0,void 0,(function(){var r;return p(this,(function(o){if(r=s(n).startOf("day").diff(s().startOf("day"),"day"),e<0?r<e:r>e)throw new Error(t);return[2]}))}))}}}},C="es-EC",P={currency:function(e,t){return void 0===t&&(t=2),e||(e=0),new Intl.NumberFormat(C,{style:"currency",currency:"USD",minimumFractionDigits:t}).format("number"==typeof e?e:parseFloat(e))},date:function(e,t){return void 0===t&&(t="DD/MM/YYYY"),s(e).format(t)},completeDate:function(e){return s(e).format("DD/MM/YYYY HH:mm:ss")},month:function(e){return s(e).format("MM/YYYY")},percent:function(e,t){return void 0===t&&(t=2),e||(e=0),new Intl.NumberFormat(C,{style:"percent",minimumFractionDigits:t}).format("number"==typeof e?e:parseFloat(e))}},I={exports:{}},F={};var N,A={};
|
|
11
|
+
/**
|
|
12
|
+
* @license React
|
|
13
|
+
* use-sync-external-store-shim.development.js
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the MIT license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*/"production"===process.env.NODE_ENV?I.exports=function(){if(w)return F;w=1;var t=e,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,i=t.useLayoutEffect,a=t.useDebugValue;function s(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),u=n({inst:{value:r,getSnapshot:t}}),c=u[0].inst,l=u[1];return i((function(){c.value=r,c.getSnapshot=t,s(c)&&l({inst:c})}),[e,r,t]),o((function(){return s(c)&&l({inst:c}),e((function(){s(c)&&l({inst:c})}))}),[e]),a(r),r};return F.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:u,F}():I.exports=(N||(N=1,"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=e,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];!function(e,t,n){var o=r.ReactDebugCurrentFrame.getStackAddendum();""!==o&&(t+="%s",n=n.concat([o]));var i=n.map((function(e){return String(e)}));i.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,i)}("error",e,n)}var o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=t.useState,a=t.useEffect,s=t.useLayoutEffect,u=t.useDebugValue,c=!1,l=!1;function f(e){var t=e.getSnapshot,r=e.value;try{var n=t();return!o(r,n)}catch(e){return!0}}var d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t,r){return t()}:function(e,r,d){c||void 0!==t.startTransition&&(c=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var p=r();if(!l){var m=r();o(p,m)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var v=i({inst:{value:p,getSnapshot:r}}),y=v[0].inst,h=v[1];return s((function(){y.value=p,y.getSnapshot=r,f(y)&&h({inst:y})}),[e,p,r]),a((function(){return f(y)&&h({inst:y}),e((function(){f(y)&&h({inst:y})}))}),[e]),u(p),p},p=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d;A.useSyncExternalStore=p,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),A);var q=I.exports;const V=()=>{},$=V(),B=Object,M=e=>e===$,U=e=>"function"==typeof e,W=(e,t)=>({...e,...t}),Y=new WeakMap;let z=0;const H=e=>{const t=typeof e,r=e&&e.constructor,n=r==Date;let o,i;if(B(e)!==e||n||r==RegExp)o=n?e.toJSON():"symbol"==t?e.toString():"string"==t?JSON.stringify(e):""+e;else{if(o=Y.get(e),o)return o;if(o=++z+"~",Y.set(e,o),r==Array){for(o="@",i=0;i<e.length;i++)o+=H(e[i])+",";Y.set(e,o)}if(r==B){o="#";const t=B.keys(e).sort();for(;!M(i=t.pop());)M(e[i])||(o+=i+":"+H(e[i])+",");Y.set(e,o)}}return o},K=new WeakMap,G={},J={},X="undefined",Q=typeof window!=X,Z=typeof document!=X,ee=(e,t)=>{const r=K.get(e);return[()=>!M(t)&&e.get(t)||G,n=>{if(!M(t)){const o=e.get(t);t in J||(J[t]=o),r[5](t,W(o,n),o||G)}},r[6],()=>!M(t)&&t in J?J[t]:!M(t)&&e.get(t)||G]};let te=!0;const[re,ne]=Q&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[V,V],oe={isOnline:()=>te,isVisible:()=>{const e=Z&&document.visibilityState;return M(e)||"hidden"!==e}},ie={initFocus:e=>(Z&&document.addEventListener("visibilitychange",e),re("focus",e),()=>{Z&&document.removeEventListener("visibilitychange",e),ne("focus",e)}),initReconnect:e=>{const t=()=>{te=!0,e()},r=()=>{te=!1};return re("online",t),re("offline",r),()=>{ne("online",t),ne("offline",r)}}},ae=!e.useId,se=!Q||"Deno"in window,ue=e=>Q&&typeof window.requestAnimationFrame!=X?window.requestAnimationFrame(e):setTimeout(e,1),ce=se?e.useEffect:e.useLayoutEffect,le="undefined"!=typeof navigator&&navigator.connection,fe=!se&&le&&(["slow-2g","2g"].includes(le.effectiveType)||le.saveData),de=e=>{if(U(e))try{e=e()}catch(t){e=""}const t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?H(e):"",t]};let pe=0;const me=()=>++pe;var ve=3,ye=0,he=2,ge=1;async function be(...e){const[t,r,n,o]=e,i=W({populateCache:!0,throwOnError:!0},"boolean"==typeof o?{revalidate:o}:o||{});let a=i.populateCache;const s=i.rollbackOnError;let u=i.optimisticData;const c=i.throwOnError;if(U(r)){const e=r,n=[],o=t.keys();for(const r of o)!/^\$(inf|sub)\$/.test(r)&&e(t.get(r)._k)&&n.push(r);return Promise.all(n.map(l))}return l(r);async function l(r){const[o]=de(r);if(!o)return;const[l,f]=ee(t,o),[d,p,m,v]=K.get(t),y=()=>{const e=d[o];return(U(i.revalidate)?i.revalidate(l().data,r):!1!==i.revalidate)&&(delete m[o],delete v[o],e&&e[0])?e[0](2).then((()=>l().data)):l().data};if(e.length<3)return y();let h,g=n;const b=me();p[o]=[b,0];const w=!M(u),x=l(),S=x.data,O=x._c,_=M(O)?S:O;if(w&&(u=U(u)?u(_,S):u,f({data:u,_c:_})),U(g))try{g=g(_)}catch(e){h=e}if(g&&U(g.then)){if(g=await g.catch((e=>{h=e})),b!==p[o][0]){if(h)throw h;return g}h&&w&&(e=>"function"==typeof s?s(e):!1!==s)(h)&&(a=!0,f({data:_,_c:$}))}if(a&&!h)if(U(a)){const e=a(g,_);f({data:e,error:$,_c:$})}else f({data:g,error:$,_c:$});if(p[o][1]=me(),Promise.resolve(y()).then((()=>{f({_c:$})})),!h)return g;if(c)throw h}}const we=(e,t)=>{for(const r in e)e[r][0]&&e[r][0](t)},[xe,Se]=((e,t)=>{if(!K.has(e)){const r=W(ie,t),n={},o=be.bind($,e);let i=V;const a={},s=(e,t)=>{const r=a[e]||[];return a[e]=r,r.push(t),()=>r.splice(r.indexOf(t),1)},u=(t,r,n)=>{e.set(t,r);const o=a[t];if(o)for(const e of o)e(r,n)},c=()=>{if(!K.has(e)&&(K.set(e,[n,{},{},{},o,u,s]),!se)){const t=r.initFocus(setTimeout.bind($,we.bind($,n,0))),o=r.initReconnect(setTimeout.bind($,we.bind($,n,1)));i=()=>{t&&t(),o&&o(),K.delete(e)}}};return c(),[e,o,c,i]}return[e,K.get(e)[4]]})(new Map),Oe=W({onLoadingSlow:V,onSuccess:V,onError:V,onErrorRetry:(e,t,r,n,o)=>{const i=r.errorRetryCount,a=o.retryCount,s=~~((Math.random()+.5)*(1<<(a<8?a:8)))*r.errorRetryInterval;!M(i)&&a>i||setTimeout(n,s,o)},onDiscarded:V,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:fe?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:fe?5e3:3e3,compare:(e,t)=>H(e)==H(t),isPaused:()=>!1,cache:xe,mutate:Se,fallback:{}},oe),_e=e.createContext({}),Ee=Q&&window.__SWR_DEVTOOLS_USE__,je=Ee?window.__SWR_DEVTOOLS_USE__:[],ke=e=>U(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],Re=je.concat((e=>(t,r,n)=>e(t,r&&((...e)=>{const[n]=de(t),[,,,o]=K.get(xe);if(n.startsWith("$inf$"))return r(...e);const i=o[n];return M(i)?r(...e):(delete o[n],i)}),n)));Ee&&(window.__SWR_DEVTOOLS_REACT__=e);const Te=e.use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;throw"rejected"===e.status?e.reason:(e.status="pending",e.then((t=>{e.status="fulfilled",e.value=t}),(t=>{e.status="rejected",e.reason=t})),e)}),Le={dedupe:!0},De=(Ce=(t,r,n)=>{const{cache:o,compare:i,suspense:a,fallbackData:s,revalidateOnMount:u,revalidateIfStale:c,refreshInterval:l,refreshWhenHidden:f,refreshWhenOffline:d,keepPreviousData:p}=n,[m,v,y,h]=K.get(o),[g,b]=de(t),w=e.useRef(!1),x=e.useRef(!1),S=e.useRef(g),O=e.useRef(r),_=e.useRef(n),E=()=>_.current,j=()=>E().isVisible()&&E().isOnline(),[k,R,T,L]=ee(o,g),D=e.useRef({}).current,C=M(s)?n.fallback[g]:s,P=(e,t)=>{for(const r in D){const n=r;if("data"===n){if(!i(e[n],t[n])){if(!M(e[n]))return!1;if(!i(H,t[n]))return!1}}else if(t[n]!==e[n])return!1}return!0},I=e.useMemo((()=>{const e=!!g&&!!r&&(M(u)?!E().isPaused()&&!a&&(!!M(c)||c):u),t=t=>{const r=W(t);return delete r._k,e?{isValidating:!0,isLoading:!0,...r}:r},n=k(),o=L(),i=t(n),s=n===o?i:t(o);let l=i;return[()=>{const e=t(k());return P(e,l)?(l.data=e.data,l.isLoading=e.isLoading,l.isValidating=e.isValidating,l.error=e.error,l):(l=e,e)},()=>s]}),[o,g]),F=q.useSyncExternalStore(e.useCallback((e=>T(g,((t,r)=>{P(r,t)||e()}))),[o,g]),I[0],I[1]),N=!w.current,A=m[g]&&m[g].length>0,V=F.data,B=M(V)?C:V,Y=F.error,z=e.useRef(B),H=p?M(V)?z.current:V:B,G=!(A&&!M(Y))&&(N&&!M(u)?u:!E().isPaused()&&(a?!M(B)&&c:M(B)||c)),J=!!(g&&r&&N&&G),X=M(F.isValidating)?J:F.isValidating,Q=M(F.isLoading)?J:F.isLoading,Z=e.useCallback((async e=>{const t=O.current;if(!g||!t||x.current||E().isPaused())return!1;let r,o,a=!0;const s=e||{},u=!y[g]||!s.dedupe,c=()=>ae?!x.current&&g===S.current&&w.current:g===S.current,l={isValidating:!1,isLoading:!1},f=()=>{R(l)},d=()=>{const e=y[g];e&&e[1]===o&&delete y[g]},p={isValidating:!0};M(k().data)&&(p.isLoading=!0);try{if(u&&(R(p),n.loadingTimeout&&M(k().data)&&setTimeout((()=>{a&&c()&&E().onLoadingSlow(g,n)}),n.loadingTimeout),y[g]=[t(b),me()]),[r,o]=y[g],r=await r,u&&setTimeout(d,n.dedupingInterval),!y[g]||y[g][1]!==o)return u&&c()&&E().onDiscarded(g),!1;l.error=$;const e=v[g];if(!M(e)&&(o<=e[0]||o<=e[1]||0===e[1]))return f(),u&&c()&&E().onDiscarded(g),!1;const s=k().data;l.data=i(s,r)?s:r,u&&c()&&E().onSuccess(r,g,n)}catch(e){d();const t=E(),{shouldRetryOnError:r}=t;t.isPaused()||(l.error=e,u&&c()&&(t.onError(e,g,t),(!0===r||U(r)&&r(e))&&(E().revalidateOnFocus&&E().revalidateOnReconnect&&!j()||t.onErrorRetry(e,g,t,(e=>{const t=m[g];t&&t[0]&&t[0](ve,e)}),{retryCount:(s.retryCount||0)+1,dedupe:!0}))))}return a=!1,f(),!0}),[g,o]),te=e.useCallback(((...e)=>be(o,S.current,...e)),[]);if(ce((()=>{O.current=r,_.current=n,M(V)||(z.current=V)})),ce((()=>{if(!g)return;const e=Z.bind($,Le);let t=0;const r=((e,t,r)=>{const n=t[e]||(t[e]=[]);return n.push(r),()=>{const e=n.indexOf(r);e>=0&&(n[e]=n[n.length-1],n.pop())}})(g,m,((r,n={})=>{if(r==ye){const r=Date.now();E().revalidateOnFocus&&r>t&&j()&&(t=r+E().focusThrottleInterval,e())}else if(r==ge)E().revalidateOnReconnect&&j()&&e();else{if(r==he)return Z();if(r==ve)return Z(n)}}));return x.current=!1,S.current=g,w.current=!0,R({_k:b}),G&&(M(B)||se?e():ue(e)),()=>{x.current=!0,r()}}),[g]),ce((()=>{let e;function t(){const t=U(l)?l(k().data):l;t&&-1!==e&&(e=setTimeout(r,t))}function r(){k().error||!f&&!E().isVisible()||!d&&!E().isOnline()?t():Z(Le).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[l,f,d,g]),e.useDebugValue(H),a&&M(B)&&g){if(!ae&&se)throw new Error("Fallback data is required when using suspense in SSR.");O.current=r,_.current=n,x.current=!1;const e=h[g];if(!M(e)){const t=te(e);Te(t)}if(!M(Y))throw Y;{const e=Z(Le);M(H)||(e.status="fulfilled",e.value=!0),Te(e)}}return{mutate:te,get data(){return D.data=!0,H},get error(){return D.error=!0,Y},get isValidating(){return D.isValidating=!0,X},get isLoading(){return D.isLoading=!0,Q}}},function(...t){const r=W(Oe,e.useContext(_e)),[n,o,i]=ke(t),a=((e,t)=>{const r=W(e,t);if(t){const{use:n,fallback:o}=e,{use:i,fallback:a}=t;n&&i&&(r.use=n.concat(i)),o&&a&&(r.fallback=W(o,a))}return r})(r,i);let s=Ce;const{use:u}=a,c=(u||[]).concat(Re);for(let e=c.length;e--;)s=c[e](s);return s(n,o||a.fetcher||null,a)});var Ce;const Pe=((e,t)=>(...r)=>{const[n,o,i]=ke(r),a=(i.use||[]).concat(t);return e(n,o,{...i,use:a})})(De,(e=>(t,r,n)=>(n.revalidateOnFocus=!1,n.revalidateIfStale=!1,n.revalidateOnReconnect=!1,e(t,r,n))));var Ie="#F34D24",Fe="#FFFFFF";exports.$filtros=P,exports.$reglas=D,exports.Header=function(i){var a,s=i.defaultInsert,u=void 0!==s&&s,c=i.loading,l=void 0!==c&&c,f=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(i,["defaultInsert","loading"]),d=r.useRouter(),p=d.pathname,m=e.useState(""),v=m[0],y=m[1],h=new URLSearchParams(d.query),g=function(){var e=new URLSearchParams(h.toString());(e.get("q")||"")!==v&&(v?e.set("q",v):e.delete("q"),e.delete("page"),d.push({query:Object.fromEntries(e)}))},b=x.jsxs("div",{className:"flex w-full md:w-auto flex-wrap md:flex-nowrap gap-2 justify-end",children:[!0!==f.ocultarBuscador?x.jsx(o.Input.Search,{value:v,placeholder:"Ingresar búsqueda",onChange:function(e){return y(e.target.value||"")},onSearch:g,onPressEnter:g}):null,null!==u?u||x.jsx(t,{href:(a=p,a.endsWith("/")&&(a=a.slice(0,-1)),a+"/insert"),children:x.jsx(o.Button,{type:"primary",children:"Insertar"})}):null,f.onRefrescar?x.jsx("div",{children:x.jsx(o.Button,{loading:l,title:"Refrescar datos",icon:x.jsx(n.ReloadOutlined,{}),onClick:f.onRefrescar})}):null,f.children]});return e.useEffect((function(){d.isReady&&y(h.get("q")||"")}),[d.isReady]),x.jsxs("div",{className:"flex md:flex-row flex-col md:items-end items-start justify-between gap-6 mb-6",children:[x.jsxs("div",{children:[x.jsx(S,{paths:f.paths}),x.jsx(o.Typography.Title,{className:"!mb-0 mt-4",children:f.title}),f.subtitle&&x.jsx(o.Typography.Title,{level:3,type:"secondary",className:"!font-normal !m-0",children:f.subtitle})]}),null!==f.column?f.column||b:null]})},exports.LayoutBase=function(r){var i=e.useState(!0),a=i[0],s=i[1],u=e.useState(!1),c=u[0],l=u[1];return x.jsxs(x.Fragment,{children:[r.sidebar?x.jsxs(o.Layout.Sider,{style:{overflow:"auto",height:"100vh",position:"fixed",insetInlineStart:0,top:0,bottom:0,scrollbarWidth:"thin",scrollbarColor:"unset",zIndex:10},breakpoint:"md",collapsedWidth:0,trigger:null,collapsed:a,collapsible:!0,width:"230px",onBreakpoint:function(e){s(e),l(e)},children:[x.jsx(t,{href:r.sidebar.title.href,children:x.jsx("div",{className:"flex justify-center items-center h-16 text-lg text-white font-bold",children:x.jsx("div",{children:r.sidebar.title.label})})}),r.sidebar.menu]}):null,x.jsxs(o.Layout,{className:c||a?"ml-0":"ml-[230px]",onClick:!a&&c?function(e){e.stopPropagation(),e.preventDefault(),s(!0)}:void 0,children:[r.navbar?x.jsx(o.Layout.Header,{className:"border-b top-0 !z-[2] sticky !px-4",children:x.jsxs("div",{className:"flex justify-between items-center h-full",children:[r.navbar.title?x.jsx("div",{children:x.jsx(o.Button,{type:"text",icon:a?x.jsx(n.MenuUnfoldOutlined,{}):x.jsx(n.MenuFoldOutlined,{}),onClick:function(){return s(!a)},children:r.navbar.title})}):x.jsx("div",{}),r.navbar.options?x.jsx("div",{children:r.navbar.options}):x.jsx("div",{})]})}):null,x.jsx(o.Layout.Content,{className:"m-4 md:m-8 xl:m-16",children:r.children}),r.footer?x.jsx(o.Layout.Footer,{className:"!text-gray-500",children:r.footer}):null]})]})},exports.Seeker=function(t){var r=e.useState(""),n=r[0];r[1];var i=function(t){var r=this,n=e.useRef(t.defaultOptions),o=(t.type,{withOptions:!0,label:"Cliente",endpoint:"/v3/administrative/clients",params:{fields:"idType id name phone email address",estado:"activo"},field:"id",placeholder:"Ingresar la identificación del cliente",title:function(e){return"".concat(e.id)},subtitle:function(e){return e.name},preBusquedaQ:function(e){return void 0===e&&(e=""),e=e.trim(),/^\d+/.test(e)?"^"+e:e}});if(!o)return null;var i=k(o.endpoint),a=c(o.withOptions&&!t.defaultOptions?o.endpoint+"/get-options":null,(function(e){return d(r,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return[4,i.get(e)];case 1:return[2,t.sent().data]}}))}))}),{revalidateOnFocus:!1}).data;return a&&(n.current=a),o}({type:t.type,defaultOptions:void 0});return i?x.jsx(o.Form.Item,{name:t.name,label:t.hideLabel?void 0:t.label||i.label,extra:t.hideMessage?void 0:n,rules:t.required?[D.required()]:[{}],className:t.classNameFormItem}):null},exports.TemaPrincipal=function(t){var r=e.useState(!1),n=r[0],i=r[1];return e.useEffect((function(){i(!0)}),[]),n?x.jsx(o.ConfigProvider,{locale:l,theme:{token:{colorPrimary:Ie,colorLink:Ie,colorTextDisabled:"#00000080"},components:{Layout:{bodyBg:Fe,headerBg:Fe}}},children:x.jsx(o.App,{children:x.jsx(o.Layout,{className:t.className+" min-h-screen",style:t.style,hasSider:!0,children:t.children})})}):null},exports.configurarUtils=function(e){O=f(f({},O),e)},exports.crearToken=function(e,t){a.setCookie(j(t.usuario),e,{domain:O.cookieDominio,maxAge:604800})},exports.destruirToken=function(e){a.deleteCookie(j(e),{domain:O.cookieDominio})},exports.getApiEndpoint=R,exports.getAxios=k,exports.hashear=T,exports.useUtils=E,exports.useVistaInsertar=function(i){var a=k(i.endpoint),s=o.Form.useForm()[0],u=e.useState(!1),c=u[0],l=u[1],f=e.useState(!1),v=f[0],y=f[1],h=r.useRouter(),g=E(),b=g.showError,w=g.message,S=function(t){var o=e.useRef(!1),i=E().modal,a=e.useRef(0),s=e.useState(0),u=s[0],c=s[1],l=function(){if(!window.confirm("¿Estás seguro que quieres salir?"))throw"Route Canceled";m(),localStorage.removeItem(t)},f=function(e){e.preventDefault()},m=function(){o.current=!1,window.removeEventListener("beforeunload",f),r.Router.events.off("routeChangeStart",l),localStorage.removeItem(t),c(0)};return e.useEffect((function(){if(o.current)return a.current!==u&&(window.addEventListener("beforeunload",f),r.Router.events.on("routeChangeStart",l)),function(){window.removeEventListener("beforeunload",f),r.Router.events.off("routeChangeStart",l)}}),[a.current,u]),{cambiarHashInicial:function(e){var t=T(JSON.stringify(e));c(t),a.current=t},cambiarDatosFormulario:function(e){if(o.current&&0!==a.current){var r=JSON.stringify(e),n=T(r);c(n),n===a.current?localStorage.removeItem(t):localStorage.setItem(t,r)}},limpiar:m,reanudar:function(){o.current=!0},obtenerDataEmergencia:function(){return d(void 0,void 0,void 0,(function(){var e,r;return p(this,(function(a){switch(a.label){case 0:return e=localStorage.getItem(t),[4,new Promise((function(t){if(!e)return t(void 0);i.confirm({title:"Existen datos guardados",icon:x.jsx(n.QuestionCircleOutlined,{}),content:"Hubo un cierre inesperado pero los datos fueron guardados temporalmente ¿Deseas recuperarlos?",onOk:function(){return t(JSON.parse(e))},onCancel:function(){return t(void 0)}})}))];case 1:return r=a.sent(),o.current=!0,[2,r]}}))}))}}}(h.asPath),O=e.useRef("emitir"),_=e.useRef(h.query.id),j=Pe(i.sinOptions?null:i.endpoint+"/get-options",(function(e){return d(void 0,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return[4,a.get(e)];case 1:return[2,t.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,R=void 0===j?{}:j;e.useEffect((function(){_.current=i.registroId,_.current||(_.current=i.soloParaInsertar?void 0:h.query.id)}),[null==i?void 0:i.registroId,i.soloParaInsertar]);var L=h.asPath.replace(/\/(insert|[\w]*\/edit$)/g,"")||"/",D=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return d(void 0,m([e],t,!0),void 0,(function(e,t){var r,n,o,s,u,f,d,m;return void 0===t&&(t={}),p(this,(function(p){switch(p.label){case 0:if(!0===c)return[2];l(!0),S.limpiar(),r=t.endpoint||i.endpoint,n=t.params||void 0,p.label=1;case 1:return p.trys.push([1,6,,7]),o=void 0,_.current?[4,a.put(r+"/"+_.current,e,{params:n})]:[3,3];case 2:return o=p.sent().data,[3,5];case 3:return[4,a.post(r,e,{params:n})];case 4:o=p.sent().data,p.label=5;case 5:return!0!==t.noRedirect?(w.success("Guardado correctamente"),h.push(L)):l(!1),[2,o];case 6:if(s=p.sent(),l(!1),t.noShowError)throw s;return b(s),u=null===(m=null===(d=null==s?void 0:s.response)||void 0===d?void 0:d.data)||void 0===m?void 0:m.comprobante,f="pruebas",["Hostname/IP does not match certificate's altnames:","El servidor del SRI no ha respondido en un largo tiempo por lo que se ha cerrado la conexión."].some((function(e){return f.includes(e)}))?h.push(L):!t.noRedirect&&u&&u!==_.current?(_.current=u,h.push(L+"/"+u+"/edit")):S.reanudar(),[3,7];case 7:return[2]}}))}))},C=x.jsxs(o.Space,{children:[x.jsx(o.Button,{type:"primary",loading:c,onClick:function(){return s.submit()},children:"Guardar"}),x.jsx(t,{href:L,children:x.jsx(o.Button,{children:"Cancelar"})})]}),P=x.jsxs(x.Fragment,{children:[x.jsx(o.Skeleton,{paragraph:{rows:3,width:"100%"},className:"mb-4"}),x.jsx(o.Skeleton,{paragraph:{rows:4,width:"100%"},className:"mb-4"}),x.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[x.jsx(o.Skeleton,{paragraph:{rows:4,width:"100%"}}),x.jsx(o.Skeleton,{paragraph:{rows:4,width:"100%"}})]}),x.jsxs(o.Space,{children:[x.jsx(o.Skeleton.Button,{}),x.jsx(o.Skeleton.Button,{})]})]}),I=function(){return w.warning("Revisa los errores del formulario")},F={form:s,autoComplete:"off",initialValues:i.data,onFinish:D,layout:"vertical",onFinishFailed:I};return e.useEffect((function(){if(i.recuperacionEmergencia){var e=setInterval((function(){if(v){var e=s.getFieldsValue();S.cambiarDatosFormulario(e)}}),1e3);return function(){return clearInterval(e)}}}),[v]),e.useEffect((function(){var e=setTimeout((function(){i.soloParaInsertar||d(void 0,void 0,void 0,(function(){var e,t,r;return p(this,(function(n){switch(n.label){case 0:return e=!1,[4,S.obtenerDataEmergencia()];case 1:return(t=n.sent())?(_.current=t._id,e=!0,[3,4]):[3,2];case 2:return _.current?[4,a.get("".concat(i.endpoint,"/").concat(_.current),{params:i.params})]:[3,4];case 3:t=n.sent().data,n.label=4;case 4:return t?[4,null===(r=i.formatearDataInicial)||void 0===r?void 0:r.call(i,t)]:[3,6];case 5:n.sent(),s.setFieldsValue(t),n.label=6;case 6:return[2,e?i.data:t||i.data]}}))})).then((function(e){var t;return Promise.all([S.cambiarHashInicial(e),null===(t=i.onMounted)||void 0===t?void 0:t.call(i)])})).then((function(){return y(!0)}))}),200);return function(){return clearTimeout(e)}}),[h.query.id]),{form:s,router:h,options:R,tipoEmision:O,objectId:_.current,mainroute:L,isLoading:c,isReady:v,data:i.data,endpoint:i.endpoint,onSubmit:D,onMainRouter:function(){return h.push(L)},setIsLoading:l,preventor:S,ModoCarga:P,BotonesPorDefecto:C,onMensajeValidacion:I,getOption:function(e,t){var r,n;return(null===(n=null===(r=R[e])||void 0===r?void 0:r.find((function(e){return e.id===t})))||void 0===n?void 0:n.description)||""},formProps:F}},exports.useVistaPrincipal=function(e){var t=k(e.endpoint),n=r.useRouter(),o=E().showError,i=c.useSWRConfig().mutate,a=Pe(e.sinOptions?null:(e.optionsPath||e.endpoint)+"/get-options",(function(e){return d(void 0,void 0,void 0,(function(){return p(this,(function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent().data]}}))}))})).data,s=void 0===a?{}:a,u=new URLSearchParams(f(f({},e.params),n.query)).toString(),l=e.endpoint+(u?"?"+u:""),m=c(n.isReady?l:null,(function(e){return d(void 0,void 0,void 0,(function(){return p(this,(function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent().data]}}))}))})),v=m.data,y=m.error,h=m.isLoading,g=(null==v?void 0:v.data)||[],b=(null==v?void 0:v.total)||0,w=new URLSearchParams(n.query),x=w.get("page"),S=x?parseInt(x):1,O=w.get("limit"),_=O?parseInt(O):20,j={loading:h,dataSource:g,rowKey:"_id",bordered:!0,pagination:{current:S,defaultPageSize:_,total:b},onChange:function(e,t,r){return d(void 0,void 0,void 0,(function(){var t,o,i,a;return p(this,(function(s){return t=w.toString(),o=new URLSearchParams(t),e.current!==S&&("1"===(i=e.current.toString())?o.delete("page"):o.set("page",i)),e.pageSize!==_&&("20"===(a=e.pageSize.toString())?o.delete("limit"):o.set("limit",a)),Array.isArray(r)||("ascend"===r.order?o.set("sort",r.field):"descend"===r.order?o.set("sort","-"+r.field):o.delete("sort")),t!==o.toString()&&n.push({query:Object.fromEntries(o)}),[2]}))}))}},T=function(){i(l)};return{data:g,isLoading:h,error:y,options:s,endpoint:e.endpoint,endpointWithHost:R(e.endpoint),mainroute:n.route,tableProps:j,init:T,getOpt:function(e,t){var r,n=null===(r=s[e])||void 0===r?void 0:r.find((function(e){return e.id===t}));return n?n.description:""},remove:function(r){return d(void 0,void 0,void 0,(function(){var n;return p(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,t.delete("string"==typeof r?e.endpoint+"/"+r:r.endpoint)];case 1:return i.sent(),T(),[3,3];case 2:return n=i.sent(),o(n),[3,3];case 3:return[2]}}))}))},cancel:function(r){return d(void 0,void 0,void 0,(function(){var n;return p(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,t.delete("string"==typeof r?e.endpoint+"/"+r+"/cancel":r.endpoint)];case 1:return i.sent(),T(),[3,3];case 2:return n=i.sent(),o(n),[3,3];case 3:return[2]}}))}))}}};
|
|
11
20
|
//# sourceMappingURL=index.js.map
|