upconta.frontend-utils 2.0.0 → 2.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.
@@ -15,6 +15,10 @@ declare const useVistaPrincipal: <T>(args: {
15
15
  sinOptions?: true;
16
16
  optionsPath?: string;
17
17
  tipoUsuario?: "administrador";
18
+ filtros?: Record<string, {
19
+ text: string;
20
+ value: string;
21
+ }>;
18
22
  }) => {
19
23
  data: T[];
20
24
  isLoading: boolean;
@@ -31,3 +31,4 @@ export declare const rewrites: {
31
31
  source: string;
32
32
  destination: string;
33
33
  }[];
34
+ export declare const generarObjectId: () => string;
@@ -1,4 +1,4 @@
1
- import e,{useState as r,useEffect as n,createContext as t,useContext as o,useRef as a,useMemo as i,forwardRef as s,useImperativeHandle as l}from"react";import c from"next/link";import{useRouter as u,Router as d}from"next/router";import{ReloadOutlined as f,QuestionCircleOutlined as p,ExclamationCircleOutlined as m,DeleteOutlined as v,CheckCircleTwoTone as h,LoadingOutlined as y,LoginOutlined as g,LogoutOutlined as b,HourglassOutlined as x,MailOutlined as j,EditOutlined as w,StopOutlined as S,CloudUploadOutlined as I,CheckCircleOutlined as k,CloseCircleOutlined as C,SaveOutlined as N,HistoryOutlined as P,MenuUnfoldOutlined as E,MenuFoldOutlined as O}from"@ant-design/icons";import{Input as _,Button as T,Typography as F,Breadcrumb as R,App as D,Form as L,Space as q,Skeleton as U,Tooltip as B,Table as A,AutoComplete as $,Select as M,InputNumber as z,List as Y,Radio as V,Modal as W,Divider as X,Drawer as H,Timeline as J,ConfigProvider as K,Layout as Q,Badge as G}from"antd";import Z from"axios";import ee from"swr/immutable";import re from"dayjs";import{setCookie as ne,deleteCookie as te}from"cookies-next";import{debounce as oe}from"ts-debounce";import ae,{useSWRConfig as ie}from"swr";import se from"antd/locale/es_ES";var le=function(){return le=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},le.apply(this,arguments)};function ce(e,r,n,t){return new(n||(n=Promise))((function(o,a){function i(e){try{l(t.next(e))}catch(e){a(e)}}function s(e){try{l(t.throw(e))}catch(e){a(e)}}function l(e){var r;e.done?o(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(i,s)}l((t=t.apply(e,r||[])).next())}))}function ue(e,r){var n,t,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,t&&(o=2&s[0]?t.return:s[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,s[1])).done)return o;switch(t=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++,t=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=r.call(e,a)}catch(e){s=[6,e],t=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function de(e,r,n){if(n||2===arguments.length)for(var t,o=0,a=r.length;o<a;o++)!t&&o in r||(t||(t=Array.prototype.slice.call(r,0,o)),t[o]=r[o]);return e.concat(t||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;var fe,pe={exports:{}},me={};var ve,he={};
1
+ import e,{useState as r,useEffect as n,createContext as t,useContext as o,useRef as a,useMemo as i,forwardRef as s,useImperativeHandle as l}from"react";import c from"next/link";import{useRouter as u,Router as d}from"next/router";import{ReloadOutlined as f,QuestionCircleOutlined as p,ExclamationCircleOutlined as m,DeleteOutlined as v,CheckCircleTwoTone as h,LoadingOutlined as y,LoginOutlined as g,LogoutOutlined as b,HourglassOutlined as x,MailOutlined as j,EditOutlined as w,StopOutlined as S,CloudUploadOutlined as I,CheckCircleOutlined as k,CloseCircleOutlined as C,SaveOutlined as N,HistoryOutlined as P,MenuUnfoldOutlined as O,MenuFoldOutlined as E}from"@ant-design/icons";import{Input as _,Button as T,Typography as F,Breadcrumb as R,App as D,Form as L,Space as q,Skeleton as U,Tooltip as $,Table as A,AutoComplete as B,Select as M,InputNumber as z,List as Y,Radio as V,Modal as W,Divider as X,Drawer as H,Timeline as J,ConfigProvider as K,Layout as Q,Badge as G,DatePicker as Z}from"antd";import ee from"axios";import re from"swr/immutable";import ne from"dayjs";import{setCookie as te,deleteCookie as oe}from"cookies-next";import{debounce as ae}from"ts-debounce";import ie,{useSWRConfig as se}from"swr";import le from"antd/locale/es_ES";var ce=function(){return ce=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},ce.apply(this,arguments)};function ue(e,r,n,t){return new(n||(n=Promise))((function(o,a){function i(e){try{l(t.next(e))}catch(e){a(e)}}function s(e){try{l(t.throw(e))}catch(e){a(e)}}function l(e){var r;e.done?o(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(i,s)}l((t=t.apply(e,r||[])).next())}))}function de(e,r){var n,t,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,t&&(o=2&s[0]?t.return:s[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,s[1])).done)return o;switch(t=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++,t=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=r.call(e,a)}catch(e){s=[6,e],t=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function fe(e,r,n){if(n||2===arguments.length)for(var t,o=0,a=r.length;o<a;o++)!t&&o in r||(t||(t=Array.prototype.slice.call(r,0,o)),t[o]=r[o]);return e.concat(t||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;var pe,me={exports:{}},ve={};var he,ye={};
2
2
  /**
3
3
  * @license React
4
4
  * react-jsx-runtime.development.js
@@ -7,5 +7,5 @@ import e,{useState as r,useEffect as n,createContext as t,useContext as o,useRef
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?pe.exports=function(){if(fe)return me;fe=1;var r=e,n=Symbol.for("react.element"),t=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(e,r,t){var s,l={},c=null,u=null;for(s in void 0!==t&&(c=""+t),void 0!==r.key&&(c=""+r.key),void 0!==r.ref&&(u=r.ref),r)o.call(r,s)&&!i.hasOwnProperty(s)&&(l[s]=r[s]);if(e&&e.defaultProps)for(s in r=e.defaultProps)void 0===l[s]&&(l[s]=r[s]);return{$$typeof:n,type:e,key:c,ref:u,props:l,_owner:a.current}}return me.Fragment=t,me.jsx=s,me.jsxs=s,me}():pe.exports=(ve||(ve=1,"production"!==process.env.NODE_ENV&&function(){var r,n=e,t=Symbol.for("react.element"),o=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),h=Symbol.iterator,y=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];!function(e,r,n){var t=y.ReactDebugCurrentFrame.getStackAddendum();""!==t&&(r+="%s",n=n.concat([t]));var o=n.map((function(e){return String(e)}));o.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,o)}("error",e,n)}function b(e){return e.displayName||"Context"}function x(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 a:return"Fragment";case o:return"Portal";case s:return"Profiler";case i:return"StrictMode";case d:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return b(e)+".Consumer";case l:return b(e._context)+".Provider";case u:return function(e,r,n){var t=e.displayName;if(t)return t;var o=r.displayName||r.name||"";return""!==o?n+"("+o+")":n}(e,e.render,"ForwardRef");case p:var r=e.displayName||null;return null!==r?r:x(e.type)||"Memo";case m:var n=e,t=n._payload,v=n._init;try{return x(v(t))}catch(e){return null}}return null}r=Symbol.for("react.module.reference");var j,w,S,I,k,C,N,P=Object.assign,E=0;function O(){}O.__reactDisabledLog=!0;var _,T=y.ReactCurrentDispatcher;function F(e,r,n){if(void 0===_)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_=t&&t[1]||""}return"\n"+_+e}var R,D=!1,L="function"==typeof WeakMap?WeakMap:Map;function q(e,r){if(!e||D)return"";var n,t=R.get(e);if(void 0!==t)return t;D=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=T.current,T.current=null,function(){if(0===E){j=console.log,w=console.info,S=console.warn,I=console.error,k=console.group,C=console.groupCollapsed,N=console.groupEnd;var e={configurable:!0,enumerable:!0,value:O,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}E++}();try{if(r){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){n=e}Reflect.construct(e,[],i)}else{try{i.call()}catch(e){n=e}e.call(i.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(r){if(r&&n&&"string"==typeof r.stack){for(var s=r.stack.split("\n"),l=n.stack.split("\n"),c=s.length-1,u=l.length-1;c>=1&&u>=0&&s[c]!==l[u];)u--;for(;c>=1&&u>=0;c--,u--)if(s[c]!==l[u]){if(1!==c||1!==u)do{if(c--,--u<0||s[c]!==l[u]){var d="\n"+s[c].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),"function"==typeof e&&R.set(e,d),d}}while(c>=1&&u>=0);break}}}finally{D=!1,T.current=o,function(){if(0==--E){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},e,{value:j}),info:P({},e,{value:w}),warn:P({},e,{value:S}),error:P({},e,{value:I}),group:P({},e,{value:k}),groupCollapsed:P({},e,{value:C}),groupEnd:P({},e,{value:N})})}E<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var f=e?e.displayName||e.name:"",p=f?F(f):"";return"function"==typeof e&&R.set(e,p),p}function U(e,r,n){if(null==e)return"";if("function"==typeof e)return q(e,!(!(t=e.prototype)||!t.isReactComponent));var t;if("string"==typeof e)return F(e);switch(e){case d:return F("Suspense");case f:return F("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case u:return q(e.render,!1);case p:return U(e.type,r,n);case m:var o=e,a=o._payload,i=o._init;try{return U(i(a),r,n)}catch(e){}}return""}R=new L;var B=Object.prototype.hasOwnProperty,A={},$=y.ReactDebugCurrentFrame;function M(e){if(e){var r=e._owner,n=U(e.type,e._source,r?r.type:null);$.setExtraStackFrame(n)}else $.setExtraStackFrame(null)}var z=Array.isArray;function Y(e){return z(e)}function V(e){return""+e}function W(e){if(function(e){try{return V(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)),V(e)}var X,H,J=y.ReactCurrentOwner,K={key:!0,ref:!0,__self:!0,__source:!0};function Q(e,r,n,o,a){var i,s={},l=null,c=null;for(i in void 0!==n&&(W(n),l=""+n),function(e){if(B.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return void 0!==e.key}(r)&&(W(r.key),l=""+r.key),function(e){if(B.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return void 0!==e.ref}(r)&&(c=r.ref,function(e){"string"==typeof e.ref&&J.current}(r)),r)B.call(r,i)&&!K.hasOwnProperty(i)&&(s[i]=r[i]);if(e&&e.defaultProps){var u=e.defaultProps;for(i in u)void 0===s[i]&&(s[i]=u[i])}if(l||c){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,r){var n=function(){X||(X=!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)",r))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(s,d),c&&function(e,r){var n=function(){H||(H=!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)",r))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(s,d)}return function(e,r,n,o,a,i,s){var l={$$typeof:t,type:e,key:r,ref:n,props:s,_owner:i,_store:{}};return Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,c,a,o,J.current,s)}var G,Z=y.ReactCurrentOwner,ee=y.ReactDebugCurrentFrame;function re(e){if(e){var r=e._owner,n=U(e.type,e._source,r?r.type:null);ee.setExtraStackFrame(n)}else ee.setExtraStackFrame(null)}function ne(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}function te(){if(Z.current){var e=x(Z.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}G=!1;var oe={};function ae(e,r){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var r=te();if(!r){var n="string"==typeof e?e:e.displayName||e.name;n&&(r="\n\nCheck the top-level render call using <"+n+">.")}return r}(r);if(!oe[n]){oe[n]=!0;var t="";e&&e._owner&&e._owner!==Z.current&&(t=" It was passed a child from "+x(e._owner.type)+"."),re(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.',n,t),re(null)}}}function ie(e,r){if("object"==typeof e)if(Y(e))for(var n=0;n<e.length;n++){var t=e[n];ne(t)&&ae(t,r)}else if(ne(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var r=h&&e[h]||e["@@iterator"];return"function"==typeof r?r:null}(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)ne(a.value)&&ae(a.value,r)}}function se(e){var r,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)r=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==u&&n.$$typeof!==p)return;r=n.propTypes}if(r){var t=x(n);!function(e,r,n,t,o){var a=Function.call.bind(B);for(var i in e)if(a(e,i)){var s=void 0;try{if("function"!=typeof e[i]){var l=Error((t||"React class")+": "+n+" 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 l.name="Invariant Violation",l}s=e[i](r,i,t,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(M(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).",t||"React class",n,i,typeof s),M(null)),s instanceof Error&&!(s.message in A)&&(A[s.message]=!0,M(o),g("Failed %s type: %s",n,s.message),M(null))}}(r,e.props,"prop",t,e)}else void 0===n.PropTypes||G||(G=!0,g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",x(n)||"Unknown"));"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var le={};function ce(e,n,o,h,y,b){var j=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===s||e===i||e===d||e===f||e===v||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===p||e.$$typeof===l||e.$$typeof===c||e.$$typeof===u||e.$$typeof===r||void 0!==e.getModuleId)}(e);if(!j){var w,S="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(S+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),S+=te(),null===e?w="null":Y(e)?w="array":void 0!==e&&e.$$typeof===t?(w="<"+(x(e.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):w=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",w,S)}var I=Q(e,n,o,y,b);if(null==I)return I;if(j){var k=n.children;if(void 0!==k)if(h)if(Y(k)){for(var C=0;C<k.length;C++)ie(k[C],e);Object.freeze&&Object.freeze(k)}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 ie(k,e)}if(B.call(n,"key")){var N=x(e),P=Object.keys(n).filter((function(e){return"key"!==e})),E=P.length>0?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}";le[N+E]||(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} />',E,N,P.length>0?"{"+P.join(": ..., ")+": ...}":"{}",N),le[N+E]=!0)}return e===a?function(e){for(var r=Object.keys(e.props),n=0;n<r.length;n++){var t=r[n];if("children"!==t&&"key"!==t){re(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",t),re(null);break}}null!==e.ref&&(re(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),re(null))}(I):se(I),I}var ue=function(e,r,n){return ce(e,r,n,!1)},de=function(e,r,n){return ce(e,r,n,!0)};he.Fragment=a,he.jsx=ue,he.jsxs=de}()),he);var ye=pe.exports,ge=function(e){return e.paths?ye.jsx(R,{items:e.paths.map((function(e){var r=e.to,n=e.label;return{title:r?ye.jsx(c,{href:r,children:n}):n}}))}):null},be=function(e){var t,o=e.defaultInsert,a=void 0!==o&&o,i=e.loading,s=void 0!==i&&i,l=function(e,r){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(n[t[o]]=e[t[o]])}return n}(e,["defaultInsert","loading"]),d=u(),p=d.pathname,m=r(""),v=m[0],h=m[1],y=new URLSearchParams(d.query),g=function(){var e=new URLSearchParams(y.toString());(e.get("q")||"")!==v&&(v?e.set("q",v):e.delete("q"),e.delete("page"),d.push({query:Object.fromEntries(e)}))},b=ye.jsxs("div",{className:"flex w-full md:w-auto flex-wrap md:flex-nowrap gap-2 justify-end",children:[!0!==l.ocultarBuscador?ye.jsx(_.Search,{value:v,placeholder:"Ingresar búsqueda",onChange:function(e){return h(e.target.value||"")},onSearch:g,onPressEnter:g}):null,null!==a?a||ye.jsx(c,{href:(t=p,t.endsWith("/")&&(t=t.slice(0,-1)),t+"/insert"),children:ye.jsx(T,{type:"primary",children:"Insertar"})}):null,l.onRefrescar?ye.jsx("div",{children:ye.jsx(T,{loading:s,title:"Refrescar datos",icon:ye.jsx(f,{}),onClick:l.onRefrescar})}):null,l.children]});return n((function(){d.isReady&&h(y.get("q")||"")}),[d.isReady]),ye.jsxs("div",{className:"flex md:flex-row flex-col md:items-end items-start justify-between gap-6 mb-8",children:[ye.jsxs("div",{children:[ye.jsx(ge,{paths:l.paths}),ye.jsx(F.Title,{className:"!mb-0 mt-4",children:l.title}),l.subtitle&&ye.jsx(F.Title,{level:3,type:"secondary",className:"!font-normal !m-0",children:l.subtitle})]}),null!==l.column?l.column||b:null]})},xe={host:{api:process.env.NEXT_PUBLIC_API,apiOpen:process.env.NEXT_PUBLIC_API_OPEN,restify:process.env.NEXT_PUBLIC_RESTIFY,restifyOpen:process.env.NEXT_PUBLIC_RESTIFY_OPEN,utils:process.env.NEXT_PUBLIC_UTILS,utilsOpen:process.env.NEXT_PUBLIC_UTILS_OPEN},userTokenName:"",adminTokenName:"",cookieDominio:"",cookiePath:void 0},je=function(e){return ce(void 0,void 0,void 0,(function(){var r,n,t,o,a,i;return ue(this,(function(s){switch(s.label){case 0:if(!((r=(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]),t=(n=JSON).parse,[4,r.text()];case 2:return[2,{message:t.apply(n,[s.sent()]).message,tipo:"error"}];case 3:return s.sent(),o={},[4,r.text()];case 4:return[2,(o.message=s.sent(),o.tipo="error",o)];case 5:return[2,{message:r,tipo:"error"}]}}))}))},we=function(){var e=D.useApp(),r=e.modal,n=e.message,t=e.notification;return{showError:function(e,n){return ce(void 0,void 0,void 0,(function(){var t;return ue(this,(function(o){switch(o.label){case 0:return[4,je(e)];case 1:return t=o.sent(),r[t.tipo]({title:(null==n?void 0:n.title)||"Proceso fallido",width:450,content:ye.jsxs(ye.Fragment,{children:[t.message,null==n?void 0:n.cuerpoAdicional]}),okType:"danger"}),[2]}}))}))},modal:r,message:n,notification:t}},Se=function(e){return"administrador"===e?xe.adminTokenName:xe.userTokenName},Ie=function(e,r){ne(Se(r.usuario),e,{domain:xe.cookieDominio,maxAge:604800,path:xe.cookiePath})},ke=function(e){te(Se(e),{domain:xe.cookieDominio,path:xe.cookiePath})},Ce=function(e,r){var n=e.includes("/v4")?xe.host.apiOpen:xe.host.restifyOpen;if(n){var t=new URL(e.replace(/^\/api/,""),n),o="";return r&&(o=new URLSearchParams(r).toString()),t.href+(o?"?"+o:"")}},Ne=function(e,r){for(var n=(r=(r=r.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split("."),t=0,o=n.length;t<o;++t){var a=n[t];if(!e||!(a in e))return;e=e[a]}return e},Pe=function(e){var r,n=0;if(0===e.length)return n;for(r=0;r<e.length;r++)n=(n<<5)-n+e.charCodeAt(r),n|=0;return n},Ee=function(e,r){void 0===r&&(r="/login");var n=r.includes("://"),t=new URL(n?r:window.location.origin+r);("/"!==e.asPath||n)&&t.searchParams.append("redirect",n?window.location.href:e.asPath),n?window.location.href=t.href:e.push(t.pathname+t.search)};function Oe(e,r){void 0===r&&(r=2);var n=Math.pow(10,r);return Math.round(+(e*n).toFixed(2))/n}var _e=[{source:"/api/v4/:path*",destination:"".concat(process.env.NEXT_PUBLIC_API,"/v4/:path*")},{source:"/api/:path*",destination:"".concat(process.env.NEXT_PUBLIC_RESTIFY,"/:path*")},{source:"/utils/:path*",destination:"".concat(process.env.NEXT_PUBLIC_UTILS,"/:path*")}],Te=t(null);function Fe(){return o(Te)}var Re=function(e){var t=u(),o=r(!1),a=o[0],i=o[1],s=r(),l=s[0],c=s[1];return n((function(){ce(void 0,void 0,void 0,(function(){var e,r,n;return ue(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Promise.all([Z.get("/api/v3/auth/user"),Z.get("/api/v3/businesses/me/configurations",{params:{fields:"comprobantes nDecimals invoice"}})])];case 1:return e=t.sent(),r=e[0].data,n=e[1].data,r.configuraciones=n,[2,r];case 2:return t.sent(),[2,null];case 3:return[2]}}))})).then((function(r){r?(i(!0),c(r)):Ee(t,e.pathLogin)}))}),[]),a?ye.jsx(Te.Provider,{value:{business:l,nombreEmpresa:l.business,nombreUsuario:l.user,testEnviroment:l.configs.useTestEnviroment,usuarioEsAdmin:"admin"===l.userType,getPermisos:function(e){var r,n,o,a,i,s,c,u,d,f={leer:!1,escribir:!1,eliminar:!1,anular:!1},p=e||t.route;if("admin"===(null==l?void 0:l.userType))return{leer:!0,escribir:!0,eliminar:!0,anular:!0};var m=p.split("/"),v=m[1],h=m[2],y=null==l?void 0:l.modules.find((function(e){return e.key===v}));if(!y)return f;for(var g=0,b=y.submodules;g<b.length;g++){var x=b[g];if(x.key&&x.key===h){f={leer:!!(null===(r=x.permisos)||void 0===r?void 0:r.includes("leer")),escribir:!!(null===(n=x.permisos)||void 0===n?void 0:n.includes("escribir")),eliminar:!!(null===(o=x.permisos)||void 0===o?void 0:o.includes("eliminar")),anular:!!(null===(a=x.permisos)||void 0===a?void 0:a.includes("anular"))};break}var j=null===(i=x.items)||void 0===i?void 0:i.find((function(e){return e.key===h}));if(j){f={leer:!!(null===(s=j.permisos)||void 0===s?void 0:s.includes("leer")),escribir:!!(null===(c=j.permisos)||void 0===c?void 0:c.includes("escribir")),eliminar:!!(null===(u=j.permisos)||void 0===u?void 0:u.includes("eliminar")),anular:!!(null===(d=j.permisos)||void 0===d?void 0:d.includes("anular"))};break}}return f},hasModule:function(e,r){var n=null==l?void 0:l.modules.find((function(r){return r.key===e}));return!!n&&re(r).isAfter(n.operationDate)}},children:e.children}):ye.jsx("div",{className:"w-full h-screen flex items-center justify-center",children:"Cargando..."})},De={empresa:function(e,r){return ce(void 0,void 0,void 0,(function(){return ue(this,(function(e){switch(e.label){case 0:return r?[4,Z.get("/api/v3/auth/business/"+r)]:[2];case 1:if(e.sent().data)throw new Error("La empresa ya se encuentra registrada");return[2]}}))}))}},Le={required:function(e){return void 0===e&&(e="El campo es requerido"),{required:!0,message:e}},min:function(e,r){return void 0===r&&(r="Debe tener mínimo ".concat(e.toString()," caracteres")),{min:e,message:r}},max:function(e,r){return void 0===r&&(r="Debe tener máximo ".concat(e.toString()," caracteres")),{max:e,message:r}},email:function(e){return void 0===e&&(e="El correo electrónico no es válido"),{type:"email",message:e}},pattern:function(e,r){return void 0===r&&(r="No cumple el formato requerido"),{pattern:e,message:r}},unico:function(e){return{validator:oe(De[e],300)}},correos:function(){return{validator:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return ce(void 0,de([e],r,!0),void 0,(function(e,r){return void 0===r&&(r=[]),ue(this,(function(e){if(r.some((function(e){return!e.includes("@")})))throw new Error("Alguno de los correos no es válido");return[2]}))}))}}},diasDiferencia:function(e,r){return void 0===r&&(r="La fecha ingresada no es válido"),{validator:function(n,t){return ce(void 0,void 0,void 0,(function(){var n;return ue(this,(function(o){if(n=re(t).startOf("day").diff(re().startOf("day"),"day"),e<0?n<e:n>e)throw new Error(r);return[2]}))}))}}}},qe="es-EC",Ue={currency:function(e,r){return void 0===r&&(r=2),e||(e=0),new Intl.NumberFormat(qe,{style:"currency",currency:"USD",minimumFractionDigits:r}).format("number"==typeof e?e:parseFloat(e))},date:function(e,r){return void 0===r&&(r="DD/MM/YYYY"),re(e).format(r)},completeDate:function(e){return re(e).format("DD/MM/YYYY HH:mm:ss")},month:function(e){return re(e).format("MM/YYYY")},percent:function(e,r){return void 0===r&&(r=2),e||(e=0),new Intl.NumberFormat(qe,{style:"percent",minimumFractionDigits:r}).format("number"==typeof e?e:parseFloat(e))}},Be=function(e){var r=u(),n=we().showError,t=ie().mutate,o=ee(e.sinOptions?null:(e.optionsPath||e.endpoint)+"/get-options",(function(e){return ce(void 0,void 0,void 0,(function(){return ue(this,(function(r){switch(r.label){case 0:return[4,Z.get(e)];case 1:return[2,r.sent().data]}}))}))})).data,a=void 0===o?{}:o,i=new URLSearchParams(le(le({},e.params),r.query)).toString(),s=e.endpoint+(i?"?"+i:""),l=ae(r.isReady?s:null,(function(e){return ce(void 0,void 0,void 0,(function(){return ue(this,(function(r){switch(r.label){case 0:return[4,Z.get(e)];case 1:return[2,r.sent().data]}}))}))}),{keepPreviousData:!0}),c=l.data,d=l.error,f=l.isLoading,p=(null==c?void 0:c.data)||[],m=(null==c?void 0:c.total)||0,v=new URLSearchParams(r.query),h=v.get("page"),y=h?parseInt(h):1,g=v.get("limit"),b=g?parseInt(g):20,x={loading:f,dataSource:p,rowKey:"_id",bordered:!0,pagination:{current:y,defaultPageSize:b,total:m},onChange:function(e,n,t){return ce(void 0,void 0,void 0,(function(){var n,o,a,i;return ue(this,(function(s){return n=v.toString(),o=new URLSearchParams(n),e.current!==y&&("1"===(a=e.current.toString())?o.delete("page"):o.set("page",a)),e.pageSize!==b&&("20"===(i=e.pageSize.toString())?o.delete("limit"):o.set("limit",i)),Array.isArray(t)||("ascend"===t.order?o.set("sort",t.field):"descend"===t.order?o.set("sort","-"+t.field):o.delete("sort")),n!==o.toString()&&r.push({query:Object.fromEntries(o)}),[2]}))}))}},j=function(){t(s)};return{data:p,isLoading:f,error:d,options:a,endpoint:e.endpoint,endpointWithHost:Ce(e.endpoint),mainroute:r.route,tableProps:x,axios:Z,init:j,getOpt:function(e,r){var n,t=null===(n=a[e])||void 0===n?void 0:n.find((function(e){return e.id===r}));return t?t.description:""},remove:function(r){return ce(void 0,void 0,void 0,(function(){var t;return ue(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,Z.delete("string"==typeof r?e.endpoint+"/"+r:r.endpoint)];case 1:return o.sent(),j(),[3,3];case 2:return t=o.sent(),n(t),[3,3];case 3:return[2]}}))}))},cancel:function(r){return ce(void 0,void 0,void 0,(function(){var t;return ue(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,Z.delete("string"==typeof r?e.endpoint+"/"+r+"/cancel":r.endpoint)];case 1:return o.sent(),j(),[3,3];case 2:return t=o.sent(),n(t),[3,3];case 3:return[2]}}))}))}}},Ae=function(e){var t=L.useForm()[0],o=r(!1),i=o[0],s=o[1],l=r(!1),f=l[0],m=l[1],v=u(),h=we(),y=h.showError,g=h.message,b=function(e){var t=a(!1),o=we().modal,i=a(0),s=r(0),l=s[0],c=s[1],u=function(){if(!window.confirm("¿Estás seguro que quieres salir?"))throw"Route Canceled";m(),localStorage.removeItem(e)},f=function(e){e.preventDefault()},m=function(){t.current=!1,window.removeEventListener("beforeunload",f),d.events.off("routeChangeStart",u),localStorage.removeItem(e),c(0)};return n((function(){if(t.current)return i.current!==l&&(window.addEventListener("beforeunload",f),d.events.on("routeChangeStart",u)),function(){window.removeEventListener("beforeunload",f),d.events.off("routeChangeStart",u)}}),[i.current,l]),{cambiarHashInicial:function(e){var r=Pe(JSON.stringify(e));c(r),i.current=r},cambiarDatosFormulario:function(r){if(t.current&&0!==i.current){var n=JSON.stringify(r),o=Pe(n);c(o),o===i.current?localStorage.removeItem(e):localStorage.setItem(e,n)}},limpiar:m,reanudar:function(){t.current=!0},obtenerDataEmergencia:function(){return ce(void 0,void 0,void 0,(function(){var r,n;return ue(this,(function(a){switch(a.label){case 0:return r=localStorage.getItem(e),[4,new Promise((function(e){if(!r)return e(void 0);o.confirm({title:"Existen datos guardados",icon:ye.jsx(p,{}),content:"Hubo un cierre inesperado pero los datos fueron guardados temporalmente ¿Deseas recuperarlos?",onOk:function(){return e(JSON.parse(r))},onCancel:function(){return e(void 0)}})}))];case 1:return n=a.sent(),t.current=!0,[2,n]}}))}))}}}(v.asPath),x=a("emitir"),j=a(e.data),w=a(),S=ee(e.sinOptions?null:e.endpoint+"/get-options",(function(e){return ce(void 0,void 0,void 0,(function(){return ue(this,(function(r){switch(r.label){case 0:return[4,Z.get(e)];case 1:return[2,r.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,I=void 0===S?{}:S;n((function(){w.current=e.registroId,w.current||(w.current=e.soloParaInsertar?void 0:v.query.id)}),[null==e?void 0:e.registroId,e.soloParaInsertar]);var k=v.asPath.replace(/\/(insert|[\w]*\/edit$)/g,"")||"/",C=function(r){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return ce(void 0,de([r],n,!0),void 0,(function(r,n){var t,o,a,l,c,u,d,f;return void 0===n&&(n={}),ue(this,(function(p){switch(p.label){case 0:if(!0===i)return[2];s(!0),b.limpiar(),t=n.endpoint||e.endpoint,o=n.params||void 0,p.label=1;case 1:return p.trys.push([1,6,,7]),a=void 0,w.current?[4,Z.put(t+"/"+w.current,r,{params:o})]:[3,3];case 2:return a=p.sent().data,[3,5];case 3:return[4,Z.post(t,r,{params:o})];case 4:a=p.sent().data,p.label=5;case 5:return!0!==n.noRedirect?(g.success("Guardado correctamente"),v.push(k)):s(!1),[2,a];case 6:if(l=p.sent(),s(!1),n.noShowError)throw l;return y(l),c=null===(f=null===(d=null==l?void 0:l.response)||void 0===d?void 0:d.data)||void 0===f?void 0:f.comprobante,u="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 u.includes(e)}))?v.push(k):!n.noRedirect&&c&&c!==w.current?(w.current=c,v.push(k+"/"+c+"/edit")):b.reanudar(),[3,7];case 7:return[2]}}))}))},N=ye.jsxs(q,{children:[ye.jsx(T,{type:"primary",loading:i,onClick:function(){return t.submit()},children:"Guardar"}),ye.jsx(c,{href:k,children:ye.jsx(T,{children:"Cancelar"})})]}),P=ye.jsxs(ye.Fragment,{children:[ye.jsx(U,{paragraph:{rows:3,width:"100%"},className:"mb-4"}),ye.jsx(U,{paragraph:{rows:4,width:"100%"},className:"mb-4"}),ye.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[ye.jsx(U,{paragraph:{rows:4,width:"100%"}}),ye.jsx(U,{paragraph:{rows:4,width:"100%"}})]}),ye.jsxs(q,{children:[ye.jsx(U.Button,{}),ye.jsx(U.Button,{})]})]}),E=function(){return g.warning("Revisa los errores del formulario")},O={form:t,autoComplete:"off",initialValues:e.data,onFinish:C,layout:"vertical",onFinishFailed:E};return n((function(){if(e.recuperacionEmergencia){var r=setInterval((function(){if(f){var e=t.getFieldsValue();b.cambiarDatosFormulario(e)}}),1e3);return function(){return clearInterval(r)}}}),[f]),n((function(){if(v.isReady){w.current=v.query.id;var r=setTimeout((function(){e.soloParaInsertar?m(!0):ce(void 0,void 0,void 0,(function(){var r,n,o;return ue(this,(function(a){switch(a.label){case 0:return r=!1,[4,b.obtenerDataEmergencia()];case 1:return(n=a.sent())?(w.current=n._id,r=!0,[3,4]):[3,2];case 2:return w.current?[4,Z.get("".concat(e.endpoint,"/").concat(w.current),{params:e.params})]:[3,4];case 3:n=a.sent().data,a.label=4;case 4:return n?[4,null===(o=e.formatearDataInicial)||void 0===o?void 0:o.call(e,n)]:[3,6];case 5:a.sent(),t.setFieldsValue(n),j.current=n,a.label=6;case 6:return[2,r?e.data:n||e.data]}}))})).then((function(r){var n;return Promise.all([b.cambiarHashInicial(r),null===(n=e.onMounted)||void 0===n?void 0:n.call(e)])})).then((function(){return m(!0)}))}),200);return function(){return clearTimeout(r)}}}),[v.query.id,v.isReady]),{form:t,router:v,options:I,tipoEmision:x,objectId:w.current,mainroute:k,isLoading:i,isReady:f,data:j.current,endpoint:e.endpoint,axios:Z,onSubmit:C,onMainRouter:function(){return v.push(k)},setIsLoading:s,preventor:b,ModoCarga:P,BotonesPorDefecto:N,onMensajeValidacion:E,getOption:function(e,r){var n,t;return(null===(t=null===(n=I[e])||void 0===n?void 0:n.find((function(e){return e.id===r})))||void 0===t?void 0:t.description)||""},formProps:O}},$e=function(e){var n=r(),t=n[0],o=n[1],a=r(!1),i=a[0],s=a[1];return ye.jsx(B,{title:"Click para confirmar",open:!!t,children:ye.jsx(T,{loading:i,title:e.title,disabled:e.disabled,danger:!!t,icon:t?ye.jsx(m,{}):ye.jsx(v,{}),onClick:function(){return ce(void 0,void 0,void 0,(function(){var r;return ue(this,(function(n){switch(n.label){case 0:return t?[3,1]:(r=setTimeout((function(){return o(void 0)}),1500),o(r),[3,3]);case 1:return s(!0),[4,e.onConfirm()];case 2:n.sent(),o(void 0),clearTimeout(t),s(!1),n.label=3;case 3:return[2]}}))}))}})})},Me=function(e){var n=r(!1),t=n[0],o=n[1],a=ee(t&&e.autocompletar?"/api/v4/administrative/clients/nombres-info-adicional":null,(function(e){return ce(void 0,void 0,void 0,(function(){return ue(this,(function(r){switch(r.label){case 0:return[4,Z.get(e)];case 1:return[2,r.sent().data.map((function(e){return{label:e,value:e}}))]}}))}))})).data,i=void 0===a?[]:a;return ye.jsx(L.List,{name:e.name,children:function(r,n){return ye.jsxs("div",{children:[ye.jsxs("div",{className:"flex items-center justify-between mb-4",children:[ye.jsx(F.Title,{level:3,className:"mb-0",children:"Información adicional"}),ye.jsx(T,{type:"dashed",onClick:function(){return n.add({})},children:"Agregar"})]}),ye.jsxs(A,{dataSource:r,rowClassName:"align-top",bordered:!0,pagination:!1,children:[ye.jsx(A.Column,{title:"Nombre",render:function(r){var n=r.name;return ye.jsx(L.Item,{className:"mb-0",name:[n,"nombre"],rules:[Le.required()],children:e.autocompletar?ye.jsx($,{options:i,maxLength:300,placeholder:"Ingresar el nombre",onFocus:function(){return o(!0)}}):ye.jsx(_,{maxLength:300,placeholder:"Ingresar el nombre"})})}},"name"),ye.jsx(A.Column,{title:"Descripción",render:function(e){var r=e.name;return ye.jsx(L.Item,{className:"mb-0",name:[r,"valor"],rules:[Le.required()],children:ye.jsx(_,{placeholder:"Ingresar la descripción"})})}},"description"),ye.jsx(A.Column,{width:1,render:function(e){var r=e.name;return ye.jsx($e,{title:"¿Eliminar información adicional?",onConfirm:function(){return n.remove(r)}})}},"opciones")]})]})}})},ze=function(e){var n=L.useFormInstance(),t=r([]),o=t[0],a=t[1],s=i((function(){var r=e.rules||[];switch(e.type){case"ruc":return{label:"RUC",placeholder:"Ingresar el RUC",max:13,rules:de(de([],r,!0),[Le.pattern(/^[0-9]{13}$/,"El ruc debe tener 13 caracteres numéricos")],!1)};case"ci":return{label:"Cédula",placeholder:"Ingresar la cédula",max:10,rules:de(de([],r,!0),[Le.pattern(/^[0-9]{10}$/,"La cédula debe tener 10 caracteres numéricos")],!1)};default:return{label:"Nº identificación",placeholder:"Ingresar el número de identificación",rules:r}}}),[e.type]),l=oe((function(r){return ce(void 0,void 0,void 0,(function(){var n,t;return ue(this,(function(i){switch(i.label){case 0:if(!e.campoNombre||r.length<6||!["ci","ruc"].includes(e.type))return 0!==o.length&&a([]),[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,Z.get("/utils/clientes/buscar",{params:{identificador:r,tipo:"ci"===e.type?"cedula":"ruc"}})];case 2:return n=i.sent().data,a(n.map((function(e){return{value:e.identificador,nombre:e.nombre,label:ye.jsxs(ye.Fragment,{children:[ye.jsx("b",{children:e.identificador}),ye.jsx("br",{}),e.nombre]})}}))),[3,4];case 3:return t=i.sent(),console.error(t),[3,4];case 4:return[2]}}))}))}),500);return ye.jsx(L.Item,le({name:e.name,rules:s.rules,normalize:function(e){return e.trim().toUpperCase()},className:e.className,dependencies:e.dependencies},e.hiddenLabel?{}:{label:e.label||s.label},{children:ye.jsx($,{options:o,onSelect:function(r,t){n.setFieldValue(e.campoNombre,t.nombre)},onSearch:l,placeholder:e.placeholder||s.placeholder,maxLength:s.max,disabled:e.disabled,onChange:function(r){var n;return null===(n=e.onChange)||void 0===n?void 0:n.call(e,r)}})}))},Ye=function(e){var r=e.form,n=L.useWatch("address",r),t=L.useWatch("direcciones",r);return ye.jsx(L.List,{name:"direcciones",children:function(e,o){return ye.jsxs("div",{className:"mb-6",children:[ye.jsxs("div",{className:"flex items-center justify-between",children:[ye.jsx(F.Title,{level:3,className:"!m-0",children:"Direcciones"}),ye.jsx(T,{type:"dashed",onClick:function(){return o.add("")},children:"Agregar"})]}),ye.jsx(Y,{itemLayout:"horizontal",dataSource:e,renderItem:function(a){return ye.jsx(Y.Item,{actions:[ye.jsx(L.Item,{shouldUpdate:function(e,r){return JSON.stringify(e.direcciones)!==JSON.stringify(r.direcciones)},noStyle:!0,children:function(e){var r=e.setFieldValue,o=t[a.name];return ye.jsx(V,{checked:o===n,onClick:function(){return r("address",o)},children:"Por defecto"})}},"unico"),ye.jsx($e,{onConfirm:function(){t[a.name]===n&&r.setFieldValue("address",""),o.remove(a.name)}},"eliminar")],children:ye.jsx(Y.Item.Meta,{description:ye.jsx(L.Item,{name:a.name,rules:[Le.required()],className:"mb-0",children:ye.jsx(_,{placeholder:"Ingresar la dirección",onChange:function(n){1===e.length&&r.setFieldValue("address",n.target.value)}})})})})}})]})}})},Ve=function(){var e=r(!1),n=e[0],t=e[1],o=ee(n?"/api/v4/administrative/clients/etiquetas":null,(function(e){return ce(void 0,void 0,void 0,(function(){return ue(this,(function(r){switch(r.label){case 0:return[4,Z.get(e)];case 1:return[2,r.sent().data.etiquetas]}}))}))})).data,a=void 0===o?[]:o;return ye.jsx(L.Item,{name:"etiquetas",label:"Etiqueta",children:ye.jsx($,{options:a.map((function(e){return{label:e,value:e}})),placeholder:"Ingresar o seleccionar una etiqueta",onFocus:function(){return t(!0)}})})},We=s((function(e,r){var t,o,a=u(),s=Fe().hasModule,c=Ae({endpoint:"/api/v3/administrative/"+e.type+"s",soloParaInsertar:!0===e.ocultarBotones,params:{$getAllFields:"true"},data:{id:"",idType:"04",subjectType:"01",direcciones:[],address:"",name:""}}),d=L.useWatch("idType",c.form),f="client"===e.type,p="provider"===e.type,m="transporter"===e.type,v=ee("08"===d?"/api/v3/administrative/retenciones-v2/get-options":null,(function(e){return ce(void 0,void 0,void 0,(function(){return ue(this,(function(r){switch(r.label){case 0:return[4,Z.get(e)];case 1:return[2,r.sent().data.PaisesParaisosFiscales.map((function(e){return{label:e.description,value:parseInt(e.id)}}))]}}))}))})).data,h=i((function(){switch(d){case"04":return"ruc";case"05":return"ci";default:return"other"}}),[d]);l(r,(function(){return{form:c.form,onSubmit:c.onSubmit}}));var y="grid grid-cols-1 md:grid-cols-2 gap-x-6";return n((function(){var r=JSON.parse(JSON.stringify(a.query)),n=r.name,t=r.idType,o=r.identificador;t&&o&&n&&e.type}),[a.query]),c.isReady?ye.jsxs(L,le({},c.formProps,{layout:"vertical",children:[ye.jsxs("div",{className:y,children:[ye.jsx(L.Item,{name:"idType",label:"Tipo de identificación",rules:[Le.required()],children:ye.jsx(M,{options:null===(t=c.options.TiposDeIdentificacion)||void 0===t?void 0:t.map((function(e){return{label:e.description,value:e.id}}))})}),ye.jsx(ze,{name:"id",campoNombre:"name",type:h,rules:[Le.required()]}),ye.jsx(L.Item,{name:"name",label:"Nombres / Razón social",rules:[Le.required()],children:ye.jsx(_,{placeholder:"Ingresar la razón social"})}),ye.jsx(L.Item,{name:"subjectType",label:"Tipo de sujeto",rules:[Le.required()],children:ye.jsx(M,{options:null===(o=c.options.TiposDePersona)||void 0===o?void 0:o.map((function(e){return{label:e.description,value:e.id}}))})}),ye.jsx(L.Item,{name:"phone",label:"Télefono 1",children:ye.jsx(_,{type:"phone",placeholder:"Ingresar el teléfono 1"})}),f?ye.jsx(L.Item,{name:"cellphone",label:"Télefono 2",children:ye.jsx(_,{type:"phone",placeholder:"Ingresar el teléfono 2"})}):null,ye.jsx(L.Item,{name:"email",label:"Correo electrónico",rules:[Le.email()],normalize:function(e){return e.trim()},children:ye.jsx(_,{placeholder:"Ingresar el correo electrónico"})}),!m&&ye.jsx(L.Item,{name:"optionalEmail",label:"Correos electrónicos alternativos",rules:[Le.correos()],children:ye.jsx(M,{mode:"tags",placeholder:"Ingresar uno o varios correos alternativos",open:!1,suffixIcon:null})})]}),ye.jsx(L.Item,{name:"address",className:"hidden",children:ye.jsx(_,{})}),!m&&ye.jsx(Ye,{form:c.form}),ye.jsx(F.Title,{level:3,children:"Otra información"}),ye.jsxs("div",{className:y,children:[f&&s("treasury")?ye.jsxs(ye.Fragment,{children:[ye.jsx(L.Item,{name:"creditQuotaDollars",label:"Cupo de crédito en dólares",children:ye.jsx(z,{className:"w-full",precision:2,min:0,placeholder:"Ingresar el cupo de crédito en dólares"})}),ye.jsx(L.Item,{name:"creditQuotaDays",label:"Cupo de crédito en días",children:ye.jsx(z,{className:"w-full",precision:0,min:0,placeholder:"Ingresar el cupo de crédito en días"})})]}):null,p&&s("contability")&&ye.jsx(Je,{name:"accountingAccount",type:"cuentas-contables"}),p&&s("treasury")&&ye.jsx(L.Item,{name:"diasPlazo",label:"Días plazo",children:ye.jsx(z,{className:"w-full",precision:0,min:0,placeholder:"Ingresar los días plazo"})}),m?ye.jsx(L.Item,{name:"licensePlate",label:"Placa",rules:[Le.required()],children:ye.jsx(M,{mode:"tags",placeholder:"Ingresar una o varias placas",open:!1,suffixIcon:null})}):null,f?ye.jsxs(ye.Fragment,{children:[ye.jsx(Je,{name:"vendedor",type:"sellers"}),ye.jsx(L.Item,{name:"descuento",label:"Descuento adicional para facturas (%)",children:ye.jsx(z,{className:"w-full",precision:2,max:100,suffix:"%",placeholder:"Ingresar el descuento"})}),"08"===d?ye.jsx(L.Item,{name:"paisExportacion",label:"País de exportación",children:ye.jsx(M,{allowClear:!0,showSearch:!0,placeholder:"Seleccionar el país de exportación",optionFilterProp:"children",filterOption:function(e,r){var n;return(null!==(n=null==r?void 0:r.label)&&void 0!==n?n:"").toLowerCase().includes(e.toLowerCase())},options:v})}):null,ye.jsx(Ve,{})]}):null]}),ye.jsx("div",{className:"mb-5",children:ye.jsx(Me,{name:"informacionAdicional",autocompletar:!0})}),e.ocultarBotones?null:c.BotonesPorDefecto]})):c.ModoCarga})),Xe=function(e){var r=a(e.options),n=i((function(){return function(e){switch(e.tipo){case"mesas":return{label:"Mesa",endpoint:"/api/v4/restaurantes/mesas",params:{fields:"codigo estado descripcion ordenActual lugar"},field:"codigo",placeholder:"Ingresa el código de mesas",title:function(e){return e.codigo},subtitle:function(e){return e.lugar}};case"meseros":return{label:"Mesero",endpoint:"/api/v4/restaurantes/meseros",params:{fields:"name codigo"},field:"name",placeholder:"Ingresa un mesero",title:function(e){return e.name},subtitle:function(e){return e.codigo}};case"cuentas-contables":return{label:"Cuenta contable",endpoint:"/api/v3/contability/chart-of-accounts",params:{fields:"codigo descripcion tipoDeCuenta auxiliar signo",tipoDeCuenta:"D"},field:"codigo",placeholder:"Ingrese el código de la cuenta",title:function(e){return e.codigo},subtitle:function(e){return e.descripcion},preBusquedaQ:function(e){return/^\d+\./.test(e)?"^"+e:e}};default:return{withOptions:!0,label:"Cliente",endpoint:"/api/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},modal:{title:"Clientes",getTexto:function(e){return e.name},componente:function(e){return ye.jsx(We,{ref:e.ref,type:"client",ocultarBotones:!0})}}}}}({opciones:r,tipo:e.tipo})}),[e.tipo]),t=ee(n.withOptions&&!e.options?n.endpoint+"/get-options":null,(function(e){return ce(void 0,void 0,void 0,(function(){return ue(this,(function(r){switch(r.label){case 0:return[4,Z.get(e)];case 1:return[2,r.sent().data]}}))}))}),{revalidateOnFocus:!1}).data;return t&&(r.current=t),n},He=function(e){var t=we().message,o=Fe().getPermisos,s=e.values.customDocumentId||"_id",l=r(!1),c=l[0],u=l[1],d=r(),f=d[0],p=d[1],m=r(!1),v=m[0],g=m[1],b=r(!1),x=b[0],j=b[1],w=a(!1),S=r(""),I=S[0],k=S[1],C=a(null),N=!0===e.canCreate&&!!e.values.modal,P=i((function(){var r=new URLSearchParams(le(le(le({limit:"50"},e.values.params),e.params),e.value?{_id:e.value}:I?{q:I}:{})).toString();return r?"?"+r:""}),[e.value,I,e.params]),E=ee(c?e.values.endpoint+P:null,(function(e){return ce(void 0,void 0,void 0,(function(){return ue(this,(function(r){switch(r.label){case 0:return[4,Z.get(e)];case 1:return[2,r.sent().data.data]}}))}))}),{keepPreviousData:!0}),O=E.data,T=void 0===O?[]:O,R=E.isLoading;E.mutate;var D=i((function(){switch(e.type){case"clients":case"providers":case"transporters":return o("/administrative/".concat(e.type))}}),[e.type]);n((function(){if(!q&&void 0!==f){var e=setTimeout((function(){k(f),u(!0)}),500);return function(){return clearTimeout(e)}}}),[f]);var L=i((function(){return T.map((function(r){var n,t,o=Ne(r,s),a=e.values.title(r),i=null===(t=(n=e.values).subtitle)||void 0===t?void 0:t.call(n,r);return{key:o,value:o,texto:i,item:r,label:ye.jsxs("div",{children:[ye.jsxs("div",{children:[ye.jsx("b",{className:"mr-1",children:a}),e.value===o?ye.jsx(h,{twoToneColor:"#52c41a"}):void 0]}),i?ye.jsx("div",{className:"text-wrap",children:i}):null]})}}))||[]}),[e.value,T]),q=i((function(){if(e.value)return T.find((function(r){return Ne(r,s)===e.value}))}),[e.value,T]),U=i((function(){return!0===R?ye.jsx(y,{}):q&&!e.llenarCuandoTipea?ye.jsx(h,{twoToneColor:"#52c41a"}):ye.jsx("span",{})}),[R,q]);return n((function(){e.value&&u(!0)}),[e.value]),n((function(){var r,n;if(q){var t=Ne(q,e.values.field),o=null===(r=e.values.formItemTexto||e.values.subtitle)||void 0===r?void 0:r(q);e.onSetTextoExtra(o||""),p(t),u(!1)}else e.onSetTextoExtra("");!0===w.current&&(null===(n=e.onSelect)||void 0===n||n.call(e,q||null))}),[q]),n((function(){var e=setTimeout((function(){w.current=!0}),1e3);return function(){return clearTimeout(e)}}),[]),ye.jsxs(ye.Fragment,{children:[N?ye.jsx(W,{title:e.values.modal.title,open:v,width:720,zIndex:1100,maskClosable:!1,styles:{body:{padding:0}},confirmLoading:x,onOk:function(){return ce(void 0,void 0,void 0,(function(){var r,n,o,a,i,s;return ue(this,(function(l){switch(l.label){case 0:r=C.current,n=r.form,o=r.onSubmit,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,n.validateFields()];case 2:return l.sent(),[3,4];case 3:return l.sent(),[2,t.warning("Revisa los errores del formulario")];case 4:return j(!0),a=n.getFieldsValue(),[4,o(a,{noRedirect:!0})];case 5:return i=l.sent(),j(!1),i?(n.resetFields(),null===(s=e.onChange)||void 0===s||s.call(e,i._id),g(!1),[2]):[2]}}))}))},onCancel:function(){return g(!1)},children:e.values.modal.componente({ref:C})}):null,ye.jsx($,{options:L,value:f,dropdownRender:function(e){return ye.jsxs(ye.Fragment,{children:[N&&(null==D?void 0:D.escribir)?ye.jsxs(ye.Fragment,{children:[ye.jsx(F.Link,{className:"block px-3 py-1",onClick:function(){g(!0)},children:"Añadir nuevo"}),ye.jsx(X,{className:"!m-0"})]}):null,e]})},notFoundContent:"Sin resultados",disabled:e.disabled,onFocus:function(){e.value||u(!0)},onSelect:function(r){var n;u(!1),null===(n=e.onChange)||void 0===n||n.call(e,r)},onSearch:function(r){var n,t;e.llenarCuandoTipea?null===(n=e.onChange)||void 0===n||n.call(e,r):e.value&&(null===(t=e.onChange)||void 0===t||t.call(e,null)),p(r)},children:ye.jsx(_,{placeholder:e.values.placeholder,suffix:U})})]})};He.displayName="BuscadorSeeker";var Je=function(e){var n=r(""),t=n[0],o=n[1],a=Xe({tipo:e.type,options:void 0});return a?ye.jsx(L.Item,{name:e.name,label:null===e.label?void 0:e.label||a.label,extra:e.hideMessage?void 0:t,rules:e.required?[Le.required()]:[{}],className:e.classNameFormItem,children:ye.jsx(He,{type:e.type,canCreate:e.canCreate,values:a,params:e.params,onSetTextoExtra:function(r){e.hideMessage||o(r)},onSelect:e.onSelect,llenarCuandoTipea:e.llenarCuandoTipea,disabled:e.disabled,cuerpoCrear:e.cuerpoCrear,initialValue:e.initialValue})}):null};Je.displayName="Seeker";var Ke=t(null);function Qe(){return o(Ke)}var Ge=function(e){var n=r([]),t=n[0],o=n[1];return ye.jsxs(Ke.Provider,{value:{setBitacora:o},children:[ye.jsx(Ze,{bitacora:t,setBitacora:o}),e.children]})},Ze=function(e){return ye.jsx(H,{title:"Bitácora",placement:"right",closable:!1,open:0!==e.bitacora.length,onClose:function(){return e.setBitacora([])},children:ye.jsx(J,{items:e.bitacora.map((function(e,r){var n=function(e){switch(e){case"created":case"creacion-masiva":return{color:"green"};case"draft":return{color:"orange",icon:ye.jsx(N,{})};case"failed":return{color:"red",icon:ye.jsx(C,{})};case"issued":case"used":return{color:"green",icon:ye.jsx(k,{})};case"sent":return{color:"#1890FF",icon:ye.jsx(I,{})};case"pre-canceled":return{color:"#FFA500",icon:ye.jsx(p,{})};case"canceled":case"reversado":return{color:"red",icon:ye.jsx(S,{})};case"edit":return{color:"#1890FF",icon:ye.jsx(w,{})};case"email":return{color:"#00CCFF",icon:ye.jsx(j,{})};case"deleted":return{color:"red",icon:ye.jsx(v,{})};case"intermitencia":return{color:"red",icon:ye.jsx(x,{})};case"exit-notice":return{color:"red",icon:ye.jsx(b,{})};case"exit-notice-deleted":return{color:"green",icon:ye.jsx(g,{})}}}(e.type);return{color:null==n?void 0:n.color,key:"movimiento"+r,dot:null==n?void 0:n.icon,children:ye.jsxs(ye.Fragment,{children:[e.nota," ",ye.jsx("br",{}),Ue.completeDate(e.date)]})}}))})})},er="#F34D24",rr=function(e){var t=r(!1),o=t[0],a=t[1];return n((function(){a(!0)}),[]),o?ye.jsx(Ge,{children:ye.jsx(K,{locale:se,theme:{token:{colorPrimary:er,colorLink:er,fontFamily:'"Inter", "SF Pro", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif',colorTextDisabled:"#00000080"},components:{Layout:{headerBg:"rgba(245,245,245,0.5)",siderBg:"#0F141E"},Menu:{darkItemBg:"#0F141E",darkSubMenuItemBg:"#0A0E15"},Tag:{marginXS:0}}},children:ye.jsx(D,{children:ye.jsx(Q,{className:(e.className||"")+" min-h-screen w-full",style:e.style,children:e.children})})})}):null},nr=function(e){var t=Qe().setBitacora,o=r(!1),a=o[0],s=o[1],l=i((function(){return Array.isArray(e.movimientos)&&0!==e.movimientos.length}),[e.movimientos]),c=function(){l&&t(e.movimientos)};return n((function(){var r;s(null===(r=e.movimientos)||void 0===r?void 0:r.some((function(e){return!!e.mostrarBadge})))}),[e.movimientos]),ye.jsx(G,{dot:a,children:e.usarIcono?ye.jsx(P,{title:"Ver historial",className:l?"":"text-gray-300 cursor-not-allowed",onClick:c}):ye.jsx(T,{icon:ye.jsx(P,{}),title:"Ver historial",disabled:!l,onClick:c})})},tr=function(){return{hora:(new Date).toLocaleTimeString(),fecha:(new Date).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"})}},or=function(e){var t=r(tr()),o=t[0],a=t[1];return n((function(){var e=setInterval((function(){return a(tr())}),1e3);return function(){return clearInterval(e)}}),[]),ye.jsxs("div",{className:e.className,children:[ye.jsx("div",{className:"text-3xl font-bold",children:o.hora}),ye.jsx("div",{className:"text-xl text-gray-500",children:o.fecha})]})},ar=function(e){var n=r(!0),t=n[0],o=n[1],a=r(!1),i=a[0],s=a[1];return ye.jsxs(ye.Fragment,{children:[e.sidebar?ye.jsxs(Q.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:t,collapsible:!0,width:"230px",onBreakpoint:function(e){o(e),s(e)},children:[ye.jsx(c,{href:e.sidebar.title.href,children:ye.jsx("div",{className:"flex justify-center items-center h-16 text-lg text-white font-bold",children:ye.jsx("div",{children:e.sidebar.title.label})})}),e.sidebar.menu]}):null,ye.jsxs(Q,{className:i||t?"ml-0":"ml-[230px]",onClick:!t&&i?function(e){e.stopPropagation(),e.preventDefault(),o(!0)}:void 0,children:[e.navbar?ye.jsx(Q.Header,{className:"border-b top-0 !z-[2] sticky !px-4 backdrop-blur-xl",children:ye.jsxs("div",{className:"flex justify-between items-center h-full",children:[ye.jsx("div",{children:e.sidebar?ye.jsx(T,{type:"text",icon:t?ye.jsx(E,{}):ye.jsx(O,{}),onClick:function(){return o(!t)},children:e.navbar.title}):e.navbar.title}),e.navbar.options?ye.jsx("div",{children:e.navbar.options}):ye.jsx("div",{})]})}):null,ye.jsx(Q.Content,{className:"m-4 md:m-8 xl:mx-16 xl:my-8",children:e.children}),e.footer?ye.jsx(Q.Footer,{className:"!text-gray-500",children:e.footer}):null]})]})};export{Ue as $filtros,Le as $reglas,$e as BotonConfirmacion,nr as BotonMovimientos,Re as ContextoEmpresa,We as FormularioPersonas,be as Header,ze as IdentificadorPersona,ar as LayoutBase,or as Reloj,Je as Seeker,rr as TemaPrincipal,Ie as crearToken,ke as destruirToken,Ce as getApiEndpoint,Ne as getNestedPath,Pe as hashear,Oe as nDecimals,Ee as redireccionarLogin,_e as rewrites,Fe as useContextoEmpresa,Qe as useFrontendUtils,we as useUtils,Ae as useVistaInsertar,Be as useVistaPrincipal};
10
+ */"production"===process.env.NODE_ENV?me.exports=function(){if(pe)return ve;pe=1;var r=e,n=Symbol.for("react.element"),t=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(e,r,t){var s,l={},c=null,u=null;for(s in void 0!==t&&(c=""+t),void 0!==r.key&&(c=""+r.key),void 0!==r.ref&&(u=r.ref),r)o.call(r,s)&&!i.hasOwnProperty(s)&&(l[s]=r[s]);if(e&&e.defaultProps)for(s in r=e.defaultProps)void 0===l[s]&&(l[s]=r[s]);return{$$typeof:n,type:e,key:c,ref:u,props:l,_owner:a.current}}return ve.Fragment=t,ve.jsx=s,ve.jsxs=s,ve}():me.exports=(he||(he=1,"production"!==process.env.NODE_ENV&&function(){var r,n=e,t=Symbol.for("react.element"),o=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),h=Symbol.iterator,y=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];!function(e,r,n){var t=y.ReactDebugCurrentFrame.getStackAddendum();""!==t&&(r+="%s",n=n.concat([t]));var o=n.map((function(e){return String(e)}));o.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,o)}("error",e,n)}function b(e){return e.displayName||"Context"}function x(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 a:return"Fragment";case o:return"Portal";case s:return"Profiler";case i:return"StrictMode";case d:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return b(e)+".Consumer";case l:return b(e._context)+".Provider";case u:return function(e,r,n){var t=e.displayName;if(t)return t;var o=r.displayName||r.name||"";return""!==o?n+"("+o+")":n}(e,e.render,"ForwardRef");case p:var r=e.displayName||null;return null!==r?r:x(e.type)||"Memo";case m:var n=e,t=n._payload,v=n._init;try{return x(v(t))}catch(e){return null}}return null}r=Symbol.for("react.module.reference");var j,w,S,I,k,C,N,P=Object.assign,O=0;function E(){}E.__reactDisabledLog=!0;var _,T=y.ReactCurrentDispatcher;function F(e,r,n){if(void 0===_)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_=t&&t[1]||""}return"\n"+_+e}var R,D=!1,L="function"==typeof WeakMap?WeakMap:Map;function q(e,r){if(!e||D)return"";var n,t=R.get(e);if(void 0!==t)return t;D=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=T.current,T.current=null,function(){if(0===O){j=console.log,w=console.info,S=console.warn,I=console.error,k=console.group,C=console.groupCollapsed,N=console.groupEnd;var e={configurable:!0,enumerable:!0,value:E,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}O++}();try{if(r){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){n=e}Reflect.construct(e,[],i)}else{try{i.call()}catch(e){n=e}e.call(i.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(r){if(r&&n&&"string"==typeof r.stack){for(var s=r.stack.split("\n"),l=n.stack.split("\n"),c=s.length-1,u=l.length-1;c>=1&&u>=0&&s[c]!==l[u];)u--;for(;c>=1&&u>=0;c--,u--)if(s[c]!==l[u]){if(1!==c||1!==u)do{if(c--,--u<0||s[c]!==l[u]){var d="\n"+s[c].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),"function"==typeof e&&R.set(e,d),d}}while(c>=1&&u>=0);break}}}finally{D=!1,T.current=o,function(){if(0==--O){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},e,{value:j}),info:P({},e,{value:w}),warn:P({},e,{value:S}),error:P({},e,{value:I}),group:P({},e,{value:k}),groupCollapsed:P({},e,{value:C}),groupEnd:P({},e,{value:N})})}O<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var f=e?e.displayName||e.name:"",p=f?F(f):"";return"function"==typeof e&&R.set(e,p),p}function U(e,r,n){if(null==e)return"";if("function"==typeof e)return q(e,!(!(t=e.prototype)||!t.isReactComponent));var t;if("string"==typeof e)return F(e);switch(e){case d:return F("Suspense");case f:return F("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case u:return q(e.render,!1);case p:return U(e.type,r,n);case m:var o=e,a=o._payload,i=o._init;try{return U(i(a),r,n)}catch(e){}}return""}R=new L;var $=Object.prototype.hasOwnProperty,A={},B=y.ReactDebugCurrentFrame;function M(e){if(e){var r=e._owner,n=U(e.type,e._source,r?r.type:null);B.setExtraStackFrame(n)}else B.setExtraStackFrame(null)}var z=Array.isArray;function Y(e){return z(e)}function V(e){return""+e}function W(e){if(function(e){try{return V(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)),V(e)}var X,H,J=y.ReactCurrentOwner,K={key:!0,ref:!0,__self:!0,__source:!0};function Q(e,r,n,o,a){var i,s={},l=null,c=null;for(i in void 0!==n&&(W(n),l=""+n),function(e){if($.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return void 0!==e.key}(r)&&(W(r.key),l=""+r.key),function(e){if($.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return void 0!==e.ref}(r)&&(c=r.ref,function(e){"string"==typeof e.ref&&J.current}(r)),r)$.call(r,i)&&!K.hasOwnProperty(i)&&(s[i]=r[i]);if(e&&e.defaultProps){var u=e.defaultProps;for(i in u)void 0===s[i]&&(s[i]=u[i])}if(l||c){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,r){var n=function(){X||(X=!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)",r))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(s,d),c&&function(e,r){var n=function(){H||(H=!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)",r))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(s,d)}return function(e,r,n,o,a,i,s){var l={$$typeof:t,type:e,key:r,ref:n,props:s,_owner:i,_store:{}};return Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,c,a,o,J.current,s)}var G,Z=y.ReactCurrentOwner,ee=y.ReactDebugCurrentFrame;function re(e){if(e){var r=e._owner,n=U(e.type,e._source,r?r.type:null);ee.setExtraStackFrame(n)}else ee.setExtraStackFrame(null)}function ne(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}function te(){if(Z.current){var e=x(Z.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}G=!1;var oe={};function ae(e,r){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var r=te();if(!r){var n="string"==typeof e?e:e.displayName||e.name;n&&(r="\n\nCheck the top-level render call using <"+n+">.")}return r}(r);if(!oe[n]){oe[n]=!0;var t="";e&&e._owner&&e._owner!==Z.current&&(t=" It was passed a child from "+x(e._owner.type)+"."),re(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.',n,t),re(null)}}}function ie(e,r){if("object"==typeof e)if(Y(e))for(var n=0;n<e.length;n++){var t=e[n];ne(t)&&ae(t,r)}else if(ne(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var r=h&&e[h]||e["@@iterator"];return"function"==typeof r?r:null}(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)ne(a.value)&&ae(a.value,r)}}function se(e){var r,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)r=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==u&&n.$$typeof!==p)return;r=n.propTypes}if(r){var t=x(n);!function(e,r,n,t,o){var a=Function.call.bind($);for(var i in e)if(a(e,i)){var s=void 0;try{if("function"!=typeof e[i]){var l=Error((t||"React class")+": "+n+" 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 l.name="Invariant Violation",l}s=e[i](r,i,t,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(M(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).",t||"React class",n,i,typeof s),M(null)),s instanceof Error&&!(s.message in A)&&(A[s.message]=!0,M(o),g("Failed %s type: %s",n,s.message),M(null))}}(r,e.props,"prop",t,e)}else void 0===n.PropTypes||G||(G=!0,g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",x(n)||"Unknown"));"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var le={};function ce(e,n,o,h,y,b){var j=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===s||e===i||e===d||e===f||e===v||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===p||e.$$typeof===l||e.$$typeof===c||e.$$typeof===u||e.$$typeof===r||void 0!==e.getModuleId)}(e);if(!j){var w,S="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(S+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),S+=te(),null===e?w="null":Y(e)?w="array":void 0!==e&&e.$$typeof===t?(w="<"+(x(e.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):w=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",w,S)}var I=Q(e,n,o,y,b);if(null==I)return I;if(j){var k=n.children;if(void 0!==k)if(h)if(Y(k)){for(var C=0;C<k.length;C++)ie(k[C],e);Object.freeze&&Object.freeze(k)}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 ie(k,e)}if($.call(n,"key")){var N=x(e),P=Object.keys(n).filter((function(e){return"key"!==e})),O=P.length>0?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}";le[N+O]||(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} />',O,N,P.length>0?"{"+P.join(": ..., ")+": ...}":"{}",N),le[N+O]=!0)}return e===a?function(e){for(var r=Object.keys(e.props),n=0;n<r.length;n++){var t=r[n];if("children"!==t&&"key"!==t){re(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",t),re(null);break}}null!==e.ref&&(re(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),re(null))}(I):se(I),I}var ue=function(e,r,n){return ce(e,r,n,!1)},de=function(e,r,n){return ce(e,r,n,!0)};ye.Fragment=a,ye.jsx=ue,ye.jsxs=de}()),ye);var ge=me.exports,be=function(e){return e.paths?ge.jsx(R,{items:e.paths.map((function(e){var r=e.to,n=e.label;return{title:r?ge.jsx(c,{href:r,children:n}):n}}))}):null},xe=function(e){var t,o=e.defaultInsert,a=void 0!==o&&o,i=e.loading,s=void 0!==i&&i,l=function(e,r){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(n[t[o]]=e[t[o]])}return n}(e,["defaultInsert","loading"]),d=u(),p=d.pathname,m=r(""),v=m[0],h=m[1],y=new URLSearchParams(d.query),g=function(){var e=new URLSearchParams(y.toString());(e.get("q")||"")!==v&&(v?e.set("q",v):e.delete("q"),e.delete("page"),d.push({query:Object.fromEntries(e)}))},b=ge.jsxs("div",{className:"flex w-full md:w-auto flex-wrap md:flex-nowrap gap-2 justify-end",children:[!0!==l.ocultarBuscador?ge.jsx(_.Search,{value:v,placeholder:"Ingresar búsqueda",onChange:function(e){return h(e.target.value||"")},onSearch:g,onPressEnter:g}):null,null!==a?a||ge.jsx(c,{href:(t=p,t.endsWith("/")&&(t=t.slice(0,-1)),t+"/insert"),children:ge.jsx(T,{type:"primary",children:"Insertar"})}):null,l.onRefrescar?ge.jsx("div",{children:ge.jsx(T,{loading:s,title:"Refrescar datos",icon:ge.jsx(f,{}),onClick:l.onRefrescar})}):null,l.children]});return n((function(){d.isReady&&h(y.get("q")||"")}),[d.isReady]),ge.jsxs("div",{className:"flex md:flex-row flex-col md:items-end items-start justify-between gap-6 mb-8",children:[ge.jsxs("div",{children:[ge.jsx(be,{paths:l.paths}),ge.jsx(F.Title,{className:"!mb-0 mt-4",children:l.title}),l.subtitle&&ge.jsx(F.Title,{level:3,type:"secondary",className:"!font-normal !m-0",children:l.subtitle})]}),null!==l.column?l.column||b:null]})},je={host:{api:process.env.NEXT_PUBLIC_API,apiOpen:process.env.NEXT_PUBLIC_API_OPEN,restify:process.env.NEXT_PUBLIC_RESTIFY,restifyOpen:process.env.NEXT_PUBLIC_RESTIFY_OPEN,utils:process.env.NEXT_PUBLIC_UTILS,utilsOpen:process.env.NEXT_PUBLIC_UTILS_OPEN},userTokenName:"",adminTokenName:"",cookieDominio:"",cookiePath:void 0},we=function(e){return ue(void 0,void 0,void 0,(function(){var r,n,t,o,a,i;return de(this,(function(s){switch(s.label){case 0:if(!((r=(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]),t=(n=JSON).parse,[4,r.text()];case 2:return[2,{message:t.apply(n,[s.sent()]).message,tipo:"error"}];case 3:return s.sent(),o={},[4,r.text()];case 4:return[2,(o.message=s.sent(),o.tipo="error",o)];case 5:return[2,{message:r,tipo:"error"}]}}))}))},Se=function(){var e=D.useApp(),r=e.modal,n=e.message,t=e.notification;return{showError:function(e,n){return ue(void 0,void 0,void 0,(function(){var t;return de(this,(function(o){switch(o.label){case 0:return[4,we(e)];case 1:return t=o.sent(),r[t.tipo]({title:(null==n?void 0:n.title)||"Proceso fallido",width:450,content:ge.jsxs(ge.Fragment,{children:[t.message,null==n?void 0:n.cuerpoAdicional]}),okType:"danger"}),[2]}}))}))},modal:r,message:n,notification:t}},Ie=function(e){return"administrador"===e?je.adminTokenName:je.userTokenName},ke=function(e,r){te(Ie(r.usuario),e,{domain:je.cookieDominio,maxAge:604800,path:je.cookiePath})},Ce=function(e){oe(Ie(e),{domain:je.cookieDominio,path:je.cookiePath})},Ne=function(e,r){var n=e.includes("/v4")?je.host.apiOpen:je.host.restifyOpen;if(n){var t=new URL(e.replace(/^\/api/,""),n),o="";return r&&(o=new URLSearchParams(r).toString()),t.href+(o?"?"+o:"")}},Pe=function(e,r){for(var n=(r=(r=r.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split("."),t=0,o=n.length;t<o;++t){var a=n[t];if(!e||!(a in e))return;e=e[a]}return e},Oe=function(e){var r,n=0;if(0===e.length)return n;for(r=0;r<e.length;r++)n=(n<<5)-n+e.charCodeAt(r),n|=0;return n},Ee=function(e,r){void 0===r&&(r="/login");var n=r.includes("://"),t=new URL(n?r:window.location.origin+r);("/"!==e.asPath||n)&&t.searchParams.append("redirect",n?window.location.href:e.asPath),n?window.location.href=t.href:e.push(t.pathname+t.search)};function _e(e,r){void 0===r&&(r=2);var n=Math.pow(10,r);return Math.round(+(e*n).toFixed(2))/n}var Te=[{source:"/api/v4/:path*",destination:"".concat(process.env.NEXT_PUBLIC_API,"/v4/:path*")},{source:"/api/:path*",destination:"".concat(process.env.NEXT_PUBLIC_RESTIFY,"/:path*")},{source:"/utils/:path*",destination:"".concat(process.env.NEXT_PUBLIC_UTILS,"/:path*")}],Fe=function(){return((new Date).getTime()/1e3|0).toString(16)+"xxxxxxxxxxxxxxxx".replace(/[x]/g,(function(){return(16*Math.random()|0).toString(16)})).toLowerCase()},Re=t(null);function De(){return o(Re)}var Le=function(e){var t=u(),o=r(!1),a=o[0],i=o[1],s=r(),l=s[0],c=s[1];return n((function(){ue(void 0,void 0,void 0,(function(){var e,r,n;return de(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Promise.all([ee.get("/api/v3/auth/user"),ee.get("/api/v3/businesses/me/configurations",{params:{fields:"comprobantes nDecimals invoice"}})])];case 1:return e=t.sent(),r=e[0].data,n=e[1].data,r.configuraciones=n,[2,r];case 2:return t.sent(),[2,null];case 3:return[2]}}))})).then((function(r){r?(i(!0),c(r)):Ee(t,e.pathLogin)}))}),[]),a?ge.jsx(Re.Provider,{value:{business:l,nombreEmpresa:l.business,nombreUsuario:l.user,testEnviroment:l.configs.useTestEnviroment,usuarioEsAdmin:"admin"===l.userType,getPermisos:function(e){var r,n,o,a,i,s,c,u,d,f={leer:!1,escribir:!1,eliminar:!1,anular:!1},p=e||t.route;if("admin"===(null==l?void 0:l.userType))return{leer:!0,escribir:!0,eliminar:!0,anular:!0};var m=p.split("/"),v=m[1],h=m[2],y=null==l?void 0:l.modules.find((function(e){return e.key===v}));if(!y)return f;for(var g=0,b=y.submodules;g<b.length;g++){var x=b[g];if(x.key&&x.key===h){f={leer:!!(null===(r=x.permisos)||void 0===r?void 0:r.includes("leer")),escribir:!!(null===(n=x.permisos)||void 0===n?void 0:n.includes("escribir")),eliminar:!!(null===(o=x.permisos)||void 0===o?void 0:o.includes("eliminar")),anular:!!(null===(a=x.permisos)||void 0===a?void 0:a.includes("anular"))};break}var j=null===(i=x.items)||void 0===i?void 0:i.find((function(e){return e.key===h}));if(j){f={leer:!!(null===(s=j.permisos)||void 0===s?void 0:s.includes("leer")),escribir:!!(null===(c=j.permisos)||void 0===c?void 0:c.includes("escribir")),eliminar:!!(null===(u=j.permisos)||void 0===u?void 0:u.includes("eliminar")),anular:!!(null===(d=j.permisos)||void 0===d?void 0:d.includes("anular"))};break}}return f},hasModule:function(e,r){var n=null==l?void 0:l.modules.find((function(r){return r.key===e}));return!!n&&ne(r).isAfter(n.operationDate)}},children:e.children}):ge.jsx("div",{className:"w-full h-screen flex items-center justify-center",children:"Cargando..."})},qe={empresa:function(e,r){return ue(void 0,void 0,void 0,(function(){return de(this,(function(e){switch(e.label){case 0:return r?[4,ee.get("/api/v3/auth/business/"+r)]:[2];case 1:if(e.sent().data)throw new Error("La empresa ya se encuentra registrada");return[2]}}))}))}},Ue={required:function(e){return void 0===e&&(e="El campo es requerido"),{required:!0,message:e}},min:function(e,r){return void 0===r&&(r="Debe tener mínimo ".concat(e.toString()," caracteres")),{min:e,message:r}},max:function(e,r){return void 0===r&&(r="Debe tener máximo ".concat(e.toString()," caracteres")),{max:e,message:r}},email:function(e){return void 0===e&&(e="El correo electrónico no es válido"),{type:"email",message:e}},pattern:function(e,r){return void 0===r&&(r="No cumple el formato requerido"),{pattern:e,message:r}},unico:function(e){return{validator:ae(qe[e],300)}},correos:function(){return{validator:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return ue(void 0,fe([e],r,!0),void 0,(function(e,r){return void 0===r&&(r=[]),de(this,(function(e){if(r.some((function(e){return!e.includes("@")})))throw new Error("Alguno de los correos no es válido");return[2]}))}))}}},diasDiferencia:function(e,r){return void 0===r&&(r="La fecha ingresada no es válido"),{validator:function(n,t){return ue(void 0,void 0,void 0,(function(){var n;return de(this,(function(o){if(n=ne(t).startOf("day").diff(ne().startOf("day"),"day"),e<0?n<e:n>e)throw new Error(r);return[2]}))}))}}}},$e="es-EC",Ae={currency:function(e,r){return void 0===r&&(r=2),e||(e=0),new Intl.NumberFormat($e,{style:"currency",currency:"USD",minimumFractionDigits:r}).format("number"==typeof e?e:parseFloat(e))},date:function(e,r){return void 0===r&&(r="DD/MM/YYYY"),ne(e).format(r)},completeDate:function(e){return ne(e).format("DD/MM/YYYY HH:mm:ss")},month:function(e){return ne(e).format("MM/YYYY")},percent:function(e,r){return void 0===r&&(r=2),e||(e=0),new Intl.NumberFormat($e,{style:"percent",minimumFractionDigits:r}).format("number"==typeof e?e:parseFloat(e))}},Be=function(e){var r=u(),n=Se().showError,t=se().mutate,o=re(e.sinOptions?null:(e.optionsPath||e.endpoint)+"/get-options",(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(r){switch(r.label){case 0:return[4,ee.get(e)];case 1:return[2,r.sent().data]}}))}))})).data,a=void 0===o?{}:o,i=new URLSearchParams(ce(ce({},e.params),r.query)).toString(),s=e.endpoint+(i?"?"+i:""),l=ie(r.isReady?s:null,(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(r){switch(r.label){case 0:return[4,ee.get(e)];case 1:return[2,r.sent().data]}}))}))}),{keepPreviousData:!0}),c=l.data,d=l.error,f=l.isLoading,p=(null==c?void 0:c.data)||[],m=(null==c?void 0:c.total)||0,v=new URLSearchParams(r.query),h=v.get("page"),y=h?parseInt(h):1,g=v.get("limit"),b=g?parseInt(g):20,x={loading:f,dataSource:p,rowKey:"_id",bordered:!0,pagination:{current:y,defaultPageSize:b,total:m},onChange:function(n,t,o){return ue(void 0,void 0,void 0,(function(){var a,i,s,l,c;return de(this,(function(u){return a=v.toString(),i=new URLSearchParams(a),n.current!==y&&("1"===(s=n.current.toString())?i.delete("page"):i.set("page",s)),n.pageSize!==b&&("20"===(l=n.pageSize.toString())?i.delete("limit"):i.set("limit",l)),Array.isArray(o)||("ascend"===o.order?i.set("sort",o.field):"descend"===o.order?i.set("sort","-"+o.field):i.delete("sort")),c=[],Object.entries(t).forEach((function(r){var n=r[0],t=r[1];t&&0!==t.length?t.some((function(r){return Object.values(e.filtros||{}).some((function(e){return e.value===r}))}))?(c.push(n),t.forEach((function(e){new URLSearchParams(e).forEach((function(e,r){i.set(r,e)}))}))):1===t.length&&/\{\$(gte?|lte?)\}/.test(t[0])?i.set(n,t[0]):i.set(n,"{$in}"+t.join(",")):i.delete(n)})),e.filtros&&Object.entries(e.filtros).forEach((function(e){var r=e[0],n=e[1];c.includes(r)||new URLSearchParams(n.value).forEach((function(e,r){i.get(r)===e&&i.delete(r)}))})),a!==i.toString()&&r.push({query:Object.fromEntries(i)}),[2]}))}))}},j=function(){t(s)};return{data:p,isLoading:f,error:d,options:a,endpoint:e.endpoint,endpointWithHost:Ne(e.endpoint),mainroute:r.route,tableProps:x,axios:ee,init:j,getOpt:function(e,r){var n,t=null===(n=a[e])||void 0===n?void 0:n.find((function(e){return e.id===r}));return t?t.description:""},remove:function(r){return ue(void 0,void 0,void 0,(function(){var t;return de(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,ee.delete("string"==typeof r?e.endpoint+"/"+r:r.endpoint)];case 1:return o.sent(),j(),[3,3];case 2:return t=o.sent(),n(t),[3,3];case 3:return[2]}}))}))},cancel:function(r){return ue(void 0,void 0,void 0,(function(){var t;return de(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,ee.delete("string"==typeof r?e.endpoint+"/"+r+"/cancel":r.endpoint)];case 1:return o.sent(),j(),[3,3];case 2:return t=o.sent(),n(t),[3,3];case 3:return[2]}}))}))}}},Me=function(e){var t=L.useForm()[0],o=r(!1),i=o[0],s=o[1],l=r(!1),f=l[0],m=l[1],v=u(),h=Se(),y=h.showError,g=h.message,b=function(e){var t=a(!1),o=Se().modal,i=a(0),s=r(0),l=s[0],c=s[1],u=function(){if(!window.confirm("¿Estás seguro que quieres salir?"))throw"Route Canceled";m(),localStorage.removeItem(e)},f=function(e){e.preventDefault()},m=function(){t.current=!1,window.removeEventListener("beforeunload",f),d.events.off("routeChangeStart",u),localStorage.removeItem(e),c(0)};return n((function(){if(t.current)return i.current!==l&&(window.addEventListener("beforeunload",f),d.events.on("routeChangeStart",u)),function(){window.removeEventListener("beforeunload",f),d.events.off("routeChangeStart",u)}}),[i.current,l]),{cambiarHashInicial:function(e){var r=Oe(JSON.stringify(e));c(r),i.current=r},cambiarDatosFormulario:function(r){if(t.current&&0!==i.current){var n=JSON.stringify(r),o=Oe(n);c(o),o===i.current?localStorage.removeItem(e):localStorage.setItem(e,n)}},limpiar:m,reanudar:function(){t.current=!0},obtenerDataEmergencia:function(){return ue(void 0,void 0,void 0,(function(){var r,n;return de(this,(function(a){switch(a.label){case 0:return r=localStorage.getItem(e),[4,new Promise((function(e){if(!r)return e(void 0);o.confirm({title:"Existen datos guardados",icon:ge.jsx(p,{}),content:"Hubo un cierre inesperado pero los datos fueron guardados temporalmente ¿Deseas recuperarlos?",onOk:function(){return e(JSON.parse(r))},onCancel:function(){return e(void 0)}})}))];case 1:return n=a.sent(),t.current=!0,[2,n]}}))}))}}}(v.asPath),x=a("emitir"),j=a(e.data),w=a(),S=re(e.sinOptions?null:e.endpoint+"/get-options",(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(r){switch(r.label){case 0:return[4,ee.get(e)];case 1:return[2,r.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,I=void 0===S?{}:S;n((function(){w.current=e.registroId,w.current||(w.current=e.soloParaInsertar?void 0:v.query.id)}),[null==e?void 0:e.registroId,e.soloParaInsertar]);var k=v.asPath.replace(/\/(insert|[\w]*\/edit$)/g,"")||"/",C=function(r){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return ue(void 0,fe([r],n,!0),void 0,(function(r,n){var t,o,a,l,c,u,d,f;return void 0===n&&(n={}),de(this,(function(p){switch(p.label){case 0:if(!0===i)return[2];s(!0),b.limpiar(),t=n.endpoint||e.endpoint,o=n.params||void 0,p.label=1;case 1:return p.trys.push([1,6,,7]),a=void 0,w.current?[4,ee.put(t+"/"+w.current,r,{params:o})]:[3,3];case 2:return a=p.sent().data,[3,5];case 3:return[4,ee.post(t,r,{params:o})];case 4:a=p.sent().data,p.label=5;case 5:return!0!==n.noRedirect?(g.success("Guardado correctamente"),v.push(k)):s(!1),[2,a];case 6:if(l=p.sent(),s(!1),n.noShowError)throw l;return y(l),c=null===(f=null===(d=null==l?void 0:l.response)||void 0===d?void 0:d.data)||void 0===f?void 0:f.comprobante,u="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 u.includes(e)}))?v.push(k):!n.noRedirect&&c&&c!==w.current?(w.current=c,v.push(k+"/"+c+"/edit")):b.reanudar(),[3,7];case 7:return[2]}}))}))},N=ge.jsxs(q,{children:[ge.jsx(T,{type:"primary",loading:i,onClick:function(){return t.submit()},children:"Guardar"}),ge.jsx(c,{href:k,children:ge.jsx(T,{children:"Cancelar"})})]}),P=ge.jsxs(ge.Fragment,{children:[ge.jsx(U,{paragraph:{rows:3,width:"100%"},className:"mb-4"}),ge.jsx(U,{paragraph:{rows:4,width:"100%"},className:"mb-4"}),ge.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[ge.jsx(U,{paragraph:{rows:4,width:"100%"}}),ge.jsx(U,{paragraph:{rows:4,width:"100%"}})]}),ge.jsxs(q,{children:[ge.jsx(U.Button,{}),ge.jsx(U.Button,{})]})]}),O=function(){return g.warning("Revisa los errores del formulario")},E={form:t,autoComplete:"off",initialValues:e.data,onFinish:C,layout:"vertical",onFinishFailed:O};return n((function(){if(e.recuperacionEmergencia){var r=setInterval((function(){if(f){var e=t.getFieldsValue();b.cambiarDatosFormulario(e)}}),1e3);return function(){return clearInterval(r)}}}),[f]),n((function(){if(v.isReady){w.current=v.query.id;var r=setTimeout((function(){e.soloParaInsertar?m(!0):ue(void 0,void 0,void 0,(function(){var r,n,o;return de(this,(function(a){switch(a.label){case 0:return r=!1,[4,b.obtenerDataEmergencia()];case 1:return(n=a.sent())?(w.current=n._id,r=!0,[3,4]):[3,2];case 2:return w.current?[4,ee.get("".concat(e.endpoint,"/").concat(w.current),{params:e.params})]:[3,4];case 3:n=a.sent().data,a.label=4;case 4:return n?[4,null===(o=e.formatearDataInicial)||void 0===o?void 0:o.call(e,n)]:[3,6];case 5:a.sent(),t.setFieldsValue(n),j.current=n,a.label=6;case 6:return[2,r?e.data:n||e.data]}}))})).then((function(r){var n;return Promise.all([b.cambiarHashInicial(r),null===(n=e.onMounted)||void 0===n?void 0:n.call(e)])})).then((function(){return m(!0)}))}),200);return function(){return clearTimeout(r)}}}),[v.query.id,v.isReady]),{form:t,router:v,options:I,tipoEmision:x,objectId:w.current,mainroute:k,isLoading:i,isReady:f,data:j.current,endpoint:e.endpoint,axios:ee,onSubmit:C,onMainRouter:function(){return v.push(k)},setIsLoading:s,preventor:b,ModoCarga:P,BotonesPorDefecto:N,onMensajeValidacion:O,getOption:function(e,r){var n,t;return(null===(t=null===(n=I[e])||void 0===n?void 0:n.find((function(e){return e.id===r})))||void 0===t?void 0:t.description)||""},formProps:E}},ze=function(e){var n=r(),t=n[0],o=n[1],a=r(!1),i=a[0],s=a[1];return ge.jsx($,{title:"Click para confirmar",open:!!t,children:ge.jsx(T,{loading:i,title:e.title,disabled:e.disabled,danger:!!t,icon:t?ge.jsx(m,{}):ge.jsx(v,{}),onClick:function(){return ue(void 0,void 0,void 0,(function(){var r;return de(this,(function(n){switch(n.label){case 0:return t?[3,1]:(r=setTimeout((function(){return o(void 0)}),1500),o(r),[3,3]);case 1:return s(!0),[4,e.onConfirm()];case 2:n.sent(),o(void 0),clearTimeout(t),s(!1),n.label=3;case 3:return[2]}}))}))}})})},Ye=function(e){var n=r(!1),t=n[0],o=n[1],a=re(t&&e.autocompletar?"/api/v4/administrative/clients/nombres-info-adicional":null,(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(r){switch(r.label){case 0:return[4,ee.get(e)];case 1:return[2,r.sent().data.map((function(e){return{label:e,value:e}}))]}}))}))})).data,i=void 0===a?[]:a;return ge.jsx(L.List,{name:e.name,children:function(r,n){return ge.jsxs("div",{children:[ge.jsxs("div",{className:"flex items-center justify-between mb-4",children:[ge.jsx(F.Title,{level:3,className:"mb-0",children:"Información adicional"}),ge.jsx(T,{type:"dashed",onClick:function(){return n.add({})},children:"Agregar"})]}),ge.jsxs(A,{dataSource:r,rowClassName:"align-top",bordered:!0,pagination:!1,children:[ge.jsx(A.Column,{title:"Nombre",render:function(r){var n=r.name;return ge.jsx(L.Item,{className:"mb-0",name:[n,"nombre"],rules:[Ue.required()],children:e.autocompletar?ge.jsx(B,{options:i,maxLength:300,placeholder:"Ingresar el nombre",onFocus:function(){return o(!0)}}):ge.jsx(_,{maxLength:300,placeholder:"Ingresar el nombre"})})}},"name"),ge.jsx(A.Column,{title:"Descripción",render:function(e){var r=e.name;return ge.jsx(L.Item,{className:"mb-0",name:[r,"valor"],rules:[Ue.required()],children:ge.jsx(_,{placeholder:"Ingresar la descripción"})})}},"description"),ge.jsx(A.Column,{width:1,render:function(e){var r=e.name;return ge.jsx(ze,{title:"¿Eliminar información adicional?",onConfirm:function(){return n.remove(r)}})}},"opciones")]})]})}})},Ve=function(e){var n=L.useFormInstance(),t=r([]),o=t[0],a=t[1],s=i((function(){var r=e.rules||[];switch(e.type){case"ruc":return{label:"RUC",placeholder:"Ingresar el RUC",max:13,rules:fe(fe([],r,!0),[Ue.pattern(/^[0-9]{13}$/,"El ruc debe tener 13 caracteres numéricos")],!1)};case"ci":return{label:"Cédula",placeholder:"Ingresar la cédula",max:10,rules:fe(fe([],r,!0),[Ue.pattern(/^[0-9]{10}$/,"La cédula debe tener 10 caracteres numéricos")],!1)};default:return{label:"Nº identificación",placeholder:"Ingresar el número de identificación",rules:r}}}),[e.type]),l=ae((function(r){return ue(void 0,void 0,void 0,(function(){var n,t;return de(this,(function(i){switch(i.label){case 0:if(!e.campoNombre||r.length<6||!["ci","ruc"].includes(e.type))return 0!==o.length&&a([]),[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,ee.get("/utils/clientes/buscar",{params:{identificador:r,tipo:"ci"===e.type?"cedula":"ruc"}})];case 2:return n=i.sent().data,a(n.map((function(e){return{value:e.identificador,nombre:e.nombre,label:ge.jsxs(ge.Fragment,{children:[ge.jsx("b",{children:e.identificador}),ge.jsx("br",{}),e.nombre]})}}))),[3,4];case 3:return t=i.sent(),console.error(t),[3,4];case 4:return[2]}}))}))}),500);return ge.jsx(L.Item,ce({name:e.name,rules:s.rules,normalize:function(e){return e.trim().toUpperCase()},className:e.className,dependencies:e.dependencies},e.hiddenLabel?{}:{label:e.label||s.label},{children:ge.jsx(B,{options:o,onSelect:function(r,t){n.setFieldValue(e.campoNombre,t.nombre)},onSearch:l,placeholder:e.placeholder||s.placeholder,maxLength:s.max,disabled:e.disabled,onChange:function(r){var n;return null===(n=e.onChange)||void 0===n?void 0:n.call(e,r)}})}))},We=function(e){var r=e.form,n=L.useWatch("address",r),t=L.useWatch("direcciones",r);return ge.jsx(L.List,{name:"direcciones",children:function(e,o){return ge.jsxs("div",{className:"mb-6",children:[ge.jsxs("div",{className:"flex items-center justify-between",children:[ge.jsx(F.Title,{level:3,className:"!m-0",children:"Direcciones"}),ge.jsx(T,{type:"dashed",onClick:function(){return o.add("")},children:"Agregar"})]}),ge.jsx(Y,{itemLayout:"horizontal",dataSource:e,renderItem:function(a){return ge.jsx(Y.Item,{actions:[ge.jsx(L.Item,{shouldUpdate:function(e,r){return JSON.stringify(e.direcciones)!==JSON.stringify(r.direcciones)},noStyle:!0,children:function(e){var r=e.setFieldValue,o=t[a.name];return ge.jsx(V,{checked:o===n,onClick:function(){return r("address",o)},children:"Por defecto"})}},"unico"),ge.jsx(ze,{onConfirm:function(){t[a.name]===n&&r.setFieldValue("address",""),o.remove(a.name)}},"eliminar")],children:ge.jsx(Y.Item.Meta,{description:ge.jsx(L.Item,{name:a.name,rules:[Ue.required()],className:"mb-0",children:ge.jsx(_,{placeholder:"Ingresar la dirección",onChange:function(n){1===e.length&&r.setFieldValue("address",n.target.value)}})})})})}})]})}})},Xe=function(){var e=r(!1),n=e[0],t=e[1],o=re(n?"/api/v4/administrative/clients/etiquetas":null,(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(r){switch(r.label){case 0:return[4,ee.get(e)];case 1:return[2,r.sent().data.etiquetas]}}))}))})).data,a=void 0===o?[]:o;return ge.jsx(L.Item,{name:"etiquetas",label:"Etiqueta",children:ge.jsx(B,{options:a.map((function(e){return{label:e,value:e}})),placeholder:"Ingresar o seleccionar una etiqueta",onFocus:function(){return t(!0)}})})},He=s((function(e,r){var t,o,a=u(),s=De().hasModule,c=Me({endpoint:"/api/v3/administrative/"+e.type+"s",soloParaInsertar:!0===e.ocultarBotones,params:{$getAllFields:"true"},data:{id:"",idType:"04",subjectType:"01",direcciones:[],address:"",name:""}}),d=L.useWatch("idType",c.form),f="client"===e.type,p="provider"===e.type,m="transporter"===e.type,v=re("08"===d?"/api/v3/administrative/retenciones-v2/get-options":null,(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(r){switch(r.label){case 0:return[4,ee.get(e)];case 1:return[2,r.sent().data.PaisesParaisosFiscales.map((function(e){return{label:e.description,value:parseInt(e.id)}}))]}}))}))})).data,h=i((function(){switch(d){case"04":return"ruc";case"05":return"ci";default:return"other"}}),[d]);l(r,(function(){return{form:c.form,onSubmit:c.onSubmit}}));var y="grid grid-cols-1 md:grid-cols-2 gap-x-6";return n((function(){var r=JSON.parse(JSON.stringify(a.query)),n=r.name,t=r.idType,o=r.identificador;t&&o&&n&&e.type}),[a.query]),c.isReady?ge.jsxs(L,ce({},c.formProps,{layout:"vertical",children:[ge.jsxs("div",{className:y,children:[ge.jsx(L.Item,{name:"idType",label:"Tipo de identificación",rules:[Ue.required()],children:ge.jsx(M,{options:null===(t=c.options.TiposDeIdentificacion)||void 0===t?void 0:t.map((function(e){return{label:e.description,value:e.id}}))})}),ge.jsx(Ve,{name:"id",campoNombre:"name",type:h,rules:[Ue.required()]}),ge.jsx(L.Item,{name:"name",label:"Nombres / Razón social",rules:[Ue.required()],children:ge.jsx(_,{placeholder:"Ingresar la razón social"})}),ge.jsx(L.Item,{name:"subjectType",label:"Tipo de sujeto",rules:[Ue.required()],children:ge.jsx(M,{options:null===(o=c.options.TiposDePersona)||void 0===o?void 0:o.map((function(e){return{label:e.description,value:e.id}}))})}),ge.jsx(L.Item,{name:"phone",label:"Télefono 1",children:ge.jsx(_,{type:"phone",placeholder:"Ingresar el teléfono 1"})}),f?ge.jsx(L.Item,{name:"cellphone",label:"Télefono 2",children:ge.jsx(_,{type:"phone",placeholder:"Ingresar el teléfono 2"})}):null,ge.jsx(L.Item,{name:"email",label:"Correo electrónico",rules:[Ue.email()],normalize:function(e){return e.trim()},children:ge.jsx(_,{placeholder:"Ingresar el correo electrónico"})}),!m&&ge.jsx(L.Item,{name:"optionalEmail",label:"Correos electrónicos alternativos",rules:[Ue.correos()],children:ge.jsx(M,{mode:"tags",placeholder:"Ingresar uno o varios correos alternativos",open:!1,suffixIcon:null})})]}),ge.jsx(L.Item,{name:"address",className:"hidden",children:ge.jsx(_,{})}),!m&&ge.jsx(We,{form:c.form}),ge.jsx(F.Title,{level:3,children:"Otra información"}),ge.jsxs("div",{className:y,children:[f&&s("treasury")?ge.jsxs(ge.Fragment,{children:[ge.jsx(L.Item,{name:"creditQuotaDollars",label:"Cupo de crédito en dólares",children:ge.jsx(z,{className:"w-full",precision:2,min:0,placeholder:"Ingresar el cupo de crédito en dólares"})}),ge.jsx(L.Item,{name:"creditQuotaDays",label:"Cupo de crédito en días",children:ge.jsx(z,{className:"w-full",precision:0,min:0,placeholder:"Ingresar el cupo de crédito en días"})})]}):null,p&&s("contability")&&ge.jsx(Qe,{name:"accountingAccount",type:"cuentas-contables"}),p&&s("treasury")&&ge.jsx(L.Item,{name:"diasPlazo",label:"Días plazo",children:ge.jsx(z,{className:"w-full",precision:0,min:0,placeholder:"Ingresar los días plazo"})}),m?ge.jsx(L.Item,{name:"licensePlate",label:"Placa",rules:[Ue.required()],children:ge.jsx(M,{mode:"tags",placeholder:"Ingresar una o varias placas",open:!1,suffixIcon:null})}):null,f?ge.jsxs(ge.Fragment,{children:[ge.jsx(Qe,{name:"vendedor",type:"sellers"}),ge.jsx(L.Item,{name:"descuento",label:"Descuento adicional para facturas (%)",children:ge.jsx(z,{className:"w-full",precision:2,max:100,suffix:"%",placeholder:"Ingresar el descuento"})}),"08"===d?ge.jsx(L.Item,{name:"paisExportacion",label:"País de exportación",children:ge.jsx(M,{allowClear:!0,showSearch:!0,placeholder:"Seleccionar el país de exportación",optionFilterProp:"children",filterOption:function(e,r){var n;return(null!==(n=null==r?void 0:r.label)&&void 0!==n?n:"").toLowerCase().includes(e.toLowerCase())},options:v})}):null,ge.jsx(Xe,{})]}):null]}),ge.jsx("div",{className:"mb-5",children:ge.jsx(Ye,{name:"informacionAdicional",autocompletar:!0})}),e.ocultarBotones?null:c.BotonesPorDefecto]})):c.ModoCarga})),Je=function(e){var r=a(e.options),n=i((function(){return function(e){switch(e.tipo){case"mesas":return{label:"Mesa",endpoint:"/api/v4/restaurantes/mesas",params:{fields:"codigo estado descripcion ordenActual lugar"},field:"codigo",placeholder:"Ingresa el código de mesas",title:function(e){return e.codigo},subtitle:function(e){return e.lugar}};case"meseros":return{label:"Mesero",endpoint:"/api/v4/restaurantes/meseros",params:{fields:"name codigo"},field:"name",placeholder:"Ingresa un mesero",title:function(e){return e.name},subtitle:function(e){return e.codigo}};case"cuentas-contables":return{label:"Cuenta contable",endpoint:"/api/v3/contability/chart-of-accounts",params:{fields:"codigo descripcion tipoDeCuenta auxiliar signo",tipoDeCuenta:"D"},field:"codigo",placeholder:"Ingrese el código de la cuenta",title:function(e){return e.codigo},subtitle:function(e){return e.descripcion},preBusquedaQ:function(e){return/^\d+\./.test(e)?"^"+e:e}};default:return{withOptions:!0,label:"Cliente",endpoint:"/api/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},modal:{title:"Clientes",getTexto:function(e){return e.name},componente:function(e){return ge.jsx(He,{ref:e.ref,type:"client",ocultarBotones:!0})}}}}}({opciones:r,tipo:e.tipo})}),[e.tipo]),t=re(n.withOptions&&!e.options?n.endpoint+"/get-options":null,(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(r){switch(r.label){case 0:return[4,ee.get(e)];case 1:return[2,r.sent().data]}}))}))}),{revalidateOnFocus:!1}).data;return t&&(r.current=t),n},Ke=function(e){var t=Se().message,o=De().getPermisos,s=e.values.customDocumentId||"_id",l=r(!1),c=l[0],u=l[1],d=r(),f=d[0],p=d[1],m=r(!1),v=m[0],g=m[1],b=r(!1),x=b[0],j=b[1],w=a(!1),S=r(""),I=S[0],k=S[1],C=a(null),N=!0===e.canCreate&&!!e.values.modal,P=i((function(){var r=new URLSearchParams(ce(ce(ce({limit:"50"},e.values.params),e.params),e.value?{_id:e.value}:I?{q:I}:{})).toString();return r?"?"+r:""}),[e.value,I,e.params]),O=re(c?e.values.endpoint+P:null,(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(r){switch(r.label){case 0:return[4,ee.get(e)];case 1:return[2,r.sent().data.data]}}))}))}),{keepPreviousData:!0}),E=O.data,T=void 0===E?[]:E,R=O.isLoading;O.mutate;var D=i((function(){switch(e.type){case"clients":case"providers":case"transporters":return o("/administrative/".concat(e.type))}}),[e.type]);n((function(){if(!q&&void 0!==f){var e=setTimeout((function(){k(f),u(!0)}),500);return function(){return clearTimeout(e)}}}),[f]);var L=i((function(){return T.map((function(r){var n,t,o=Pe(r,s),a=e.values.title(r),i=null===(t=(n=e.values).subtitle)||void 0===t?void 0:t.call(n,r);return{key:o,value:o,texto:i,item:r,label:ge.jsxs("div",{children:[ge.jsxs("div",{children:[ge.jsx("b",{className:"mr-1",children:a}),e.value===o?ge.jsx(h,{twoToneColor:"#52c41a"}):void 0]}),i?ge.jsx("div",{className:"text-wrap",children:i}):null]})}}))||[]}),[e.value,T]),q=i((function(){if(e.value)return T.find((function(r){return Pe(r,s)===e.value}))}),[e.value,T]),U=i((function(){return!0===R?ge.jsx(y,{}):q&&!e.llenarCuandoTipea?ge.jsx(h,{twoToneColor:"#52c41a"}):ge.jsx("span",{})}),[R,q]);return n((function(){e.value&&u(!0)}),[e.value]),n((function(){var r,n;if(q){var t=Pe(q,e.values.field),o=null===(r=e.values.formItemTexto||e.values.subtitle)||void 0===r?void 0:r(q);e.onSetTextoExtra(o||""),p(t),u(!1)}else e.onSetTextoExtra("");!0===w.current&&(null===(n=e.onSelect)||void 0===n||n.call(e,q||null))}),[q]),n((function(){var e=setTimeout((function(){w.current=!0}),1e3);return function(){return clearTimeout(e)}}),[]),ge.jsxs(ge.Fragment,{children:[N?ge.jsx(W,{title:e.values.modal.title,open:v,width:720,zIndex:1100,maskClosable:!1,styles:{body:{padding:0}},confirmLoading:x,onOk:function(){return ue(void 0,void 0,void 0,(function(){var r,n,o,a,i,s;return de(this,(function(l){switch(l.label){case 0:r=C.current,n=r.form,o=r.onSubmit,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,n.validateFields()];case 2:return l.sent(),[3,4];case 3:return l.sent(),[2,t.warning("Revisa los errores del formulario")];case 4:return j(!0),a=n.getFieldsValue(),[4,o(a,{noRedirect:!0})];case 5:return i=l.sent(),j(!1),i?(n.resetFields(),null===(s=e.onChange)||void 0===s||s.call(e,i._id),g(!1),[2]):[2]}}))}))},onCancel:function(){return g(!1)},children:e.values.modal.componente({ref:C})}):null,ge.jsx(B,{options:L,value:f,dropdownRender:function(e){return ge.jsxs(ge.Fragment,{children:[N&&(null==D?void 0:D.escribir)?ge.jsxs(ge.Fragment,{children:[ge.jsx(F.Link,{className:"block px-3 py-1",onClick:function(){g(!0)},children:"Añadir nuevo"}),ge.jsx(X,{className:"!m-0"})]}):null,e]})},notFoundContent:"Sin resultados",disabled:e.disabled,onFocus:function(){e.value||u(!0)},onSelect:function(r){var n;u(!1),null===(n=e.onChange)||void 0===n||n.call(e,r)},onSearch:function(r){var n,t;e.llenarCuandoTipea?null===(n=e.onChange)||void 0===n||n.call(e,r):e.value&&(null===(t=e.onChange)||void 0===t||t.call(e,null)),p(r)},children:ge.jsx(_,{placeholder:e.values.placeholder,suffix:U})})]})};Ke.displayName="BuscadorSeeker";var Qe=function(e){var n=r(""),t=n[0],o=n[1],a=Je({tipo:e.type,options:void 0});return a?ge.jsx(L.Item,{name:e.name,label:null===e.label?void 0:e.label||a.label,extra:e.hideMessage?void 0:t,rules:e.required?[Ue.required()]:[{}],className:e.classNameFormItem,children:ge.jsx(Ke,{type:e.type,canCreate:e.canCreate,values:a,params:e.params,onSetTextoExtra:function(r){e.hideMessage||o(r)},onSelect:e.onSelect,llenarCuandoTipea:e.llenarCuandoTipea,disabled:e.disabled,cuerpoCrear:e.cuerpoCrear,initialValue:e.initialValue})}):null};Qe.displayName="Seeker";var Ge=t(null);function Ze(){return o(Ge)}var er=function(e){var n=r([]),t=n[0],o=n[1];return ge.jsxs(Ge.Provider,{value:{setBitacora:o},children:[ge.jsx(rr,{bitacora:t,setBitacora:o}),e.children]})},rr=function(e){return ge.jsx(H,{title:"Bitácora",placement:"right",closable:!1,open:0!==e.bitacora.length,onClose:function(){return e.setBitacora([])},children:ge.jsx(J,{items:e.bitacora.map((function(e,r){var n=function(e){switch(e){case"created":case"creacion-masiva":return{color:"green"};case"draft":return{color:"orange",icon:ge.jsx(N,{})};case"failed":return{color:"red",icon:ge.jsx(C,{})};case"issued":case"used":return{color:"green",icon:ge.jsx(k,{})};case"sent":return{color:"#1890FF",icon:ge.jsx(I,{})};case"pre-canceled":return{color:"#FFA500",icon:ge.jsx(p,{})};case"canceled":case"reversado":return{color:"red",icon:ge.jsx(S,{})};case"edit":return{color:"#1890FF",icon:ge.jsx(w,{})};case"email":return{color:"#00CCFF",icon:ge.jsx(j,{})};case"deleted":return{color:"red",icon:ge.jsx(v,{})};case"intermitencia":return{color:"red",icon:ge.jsx(x,{})};case"exit-notice":return{color:"red",icon:ge.jsx(b,{})};case"exit-notice-deleted":return{color:"green",icon:ge.jsx(g,{})}}}(e.type);return{color:null==n?void 0:n.color,key:"movimiento"+r,dot:null==n?void 0:n.icon,children:ge.jsxs(ge.Fragment,{children:[e.nota," ",ge.jsx("br",{}),Ae.completeDate(e.date)]})}}))})})},nr="#F34D24",tr=function(e){var t=r(!1),o=t[0],a=t[1];return n((function(){a(!0)}),[]),o?ge.jsx(er,{children:ge.jsx(K,{locale:le,theme:{token:{colorPrimary:nr,colorLink:nr,fontFamily:'"Inter", "SF Pro", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif',colorTextDisabled:"#00000080"},components:{Layout:{headerBg:"rgba(245,245,245,0.5)",siderBg:"#0F141E"},Menu:{darkItemBg:"#0F141E",darkSubMenuItemBg:"#0A0E15"},Tag:{marginXS:0}}},children:ge.jsx(D,{children:ge.jsx(Q,{className:(e.className||"")+" min-h-screen w-full",style:e.style,children:e.children})})})}):null},or=function(e){var t=Ze().setBitacora,o=r(!1),a=o[0],s=o[1],l=i((function(){return Array.isArray(e.movimientos)&&0!==e.movimientos.length}),[e.movimientos]),c=function(){l&&t(e.movimientos)};return n((function(){var r;s(null===(r=e.movimientos)||void 0===r?void 0:r.some((function(e){return!!e.mostrarBadge})))}),[e.movimientos]),ge.jsx(G,{dot:a,children:e.usarIcono?ge.jsx(P,{title:"Ver historial",className:l?"":"text-gray-300 cursor-not-allowed",onClick:c}):ge.jsx(T,{icon:ge.jsx(P,{}),title:"Ver historial",disabled:!l,onClick:c})})},ar=function(){return{hora:(new Date).toLocaleTimeString(),fecha:(new Date).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"})}},ir=function(e){var t=r(ar()),o=t[0],a=t[1];return n((function(){var e=setInterval((function(){return a(ar())}),1e3);return function(){return clearInterval(e)}}),[]),ge.jsxs("div",{className:e.className,children:[ge.jsx("div",{className:"text-3xl font-bold",children:o.hora}),ge.jsx("div",{className:"text-xl text-gray-500",children:o.fecha})]})},sr=function(e){var n=r([null,null]),t=n[0],o=n[1];return ge.jsxs("div",{className:"w-64",children:[ge.jsx("div",{className:"p-2",children:ge.jsx(Z.RangePicker,{value:t,onCalendarChange:function(r){o(r);var n=r[0],t=r[1];if(n&&t){var a=n.startOf("day").toISOString(),i=t.endOf("day").toISOString();e.setSelectedKeys(["{$gte}".concat(a,"{$lte}").concat(i)])}}})}),ge.jsx(X,{className:"m-0"}),ge.jsxs("div",{className:"flex p-2 justify-between",children:[ge.jsx(T,{size:"small",type:"text",onClick:function(){var r;o([null,null]),null===(r=e.clearFilters)||void 0===r||r.call(e),e.confirm()},children:"Reiniciar"}),ge.jsx(T,{disabled:!t[0]||!t[1],type:"primary",onClick:function(){return e.confirm()},size:"small",children:"Aceptar"})]})]})},lr=function(e){var n=r(!0),t=n[0],o=n[1],a=r(!1),i=a[0],s=a[1];return ge.jsxs(ge.Fragment,{children:[e.sidebar?ge.jsxs(Q.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:t,collapsible:!0,width:"230px",onBreakpoint:function(e){o(e),s(e)},children:[ge.jsx(c,{href:e.sidebar.title.href,children:ge.jsx("div",{className:"flex justify-center items-center h-16 text-lg text-white font-bold",children:ge.jsx("div",{children:e.sidebar.title.label})})}),e.sidebar.menu]}):null,ge.jsxs(Q,{className:i||t?"ml-0":"ml-[230px]",onClick:!t&&i?function(e){e.stopPropagation(),e.preventDefault(),o(!0)}:void 0,children:[e.navbar?ge.jsx(Q.Header,{className:"border-b top-0 !z-[2] sticky !px-4 backdrop-blur-xl",children:ge.jsxs("div",{className:"flex justify-between items-center h-full",children:[ge.jsx("div",{children:e.sidebar?ge.jsx(T,{type:"text",icon:t?ge.jsx(O,{}):ge.jsx(E,{}),onClick:function(){return o(!t)},children:e.navbar.title}):e.navbar.title}),e.navbar.options?ge.jsx("div",{children:e.navbar.options}):ge.jsx("div",{})]})}):null,ge.jsx(Q.Content,{className:"m-4 md:m-8 xl:mx-16 xl:my-8",children:e.children}),e.footer?ge.jsx(Q.Footer,{className:"!text-gray-500",children:e.footer}):null]})]})};export{Ae as $filtros,Ue as $reglas,ze as BotonConfirmacion,or as BotonMovimientos,Le as ContextoEmpresa,sr as FiltroFechas,He as FormularioPersonas,xe as Header,Ve as IdentificadorPersona,lr as LayoutBase,ir as Reloj,Qe as Seeker,tr as TemaPrincipal,ke as crearToken,Ce as destruirToken,Fe as generarObjectId,Ne as getApiEndpoint,Pe as getNestedPath,Oe as hashear,_e as nDecimals,Ee as redireccionarLogin,Te as rewrites,De as useContextoEmpresa,Ze as useFrontendUtils,Se as useUtils,Me as useVistaInsertar,Be as useVistaPrincipal};
11
11
  //# sourceMappingURL=index.js.map