upconta.frontend-utils 1.0.22 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dist/cjs/index.js +1 -1
- package/.dist/cjs/index.js.map +1 -1
- package/.dist/esm/index.js +2 -2
- package/.dist/esm/index.js.map +1 -1
- package/.dist/style/main.css +5 -1
- package/Readme.md +50 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -0
package/.dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e,{useState as r,useEffect as n,createContext as t,useContext as o,useRef as i,useMemo as a,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 k,CheckCircleOutlined as I,CloseCircleOutlined as C,SaveOutlined as N,HistoryOutlined as O,MenuUnfoldOutlined as
|
|
1
|
+
import e,{useState as r,useEffect as n,createContext as t,useContext as o,useRef as i,useMemo as a,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 k,CheckCircleOutlined as I,CloseCircleOutlined as C,SaveOutlined as N,HistoryOutlined as O,MenuUnfoldOutlined as P,MenuFoldOutlined as E}from"@ant-design/icons";import{Input as F,Button as R,Typography as T,Breadcrumb as _,App as D,Form as L,Space as q,Skeleton as A,Tooltip as $,Table as U,AutoComplete as M,Select as B,InputNumber as z,List as W,Radio as Y,Modal as V,Divider as H,Drawer as J,Timeline as K,ConfigProvider as Q,Layout as X,Badge as G}from"antd";import Z from"swr/immutable";import ee from"dayjs";import re from"axios";import{getCookie as ne,setCookie as te,deleteCookie as oe}from"cookies-next";import{debounce as ie}from"ts-debounce";import ae,{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,i){function a(e){try{l(t.next(e))}catch(e){i(e)}}function s(e){try{l(t.throw(e))}catch(e){i(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(a,s)}l((t=t.apply(e,r||[])).next())}))}function de(e,r){var n,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)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 i.label++,{value:s[1],done:!1};case 5:i.label++,t=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=r.call(e,i)}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,i=r.length;o<i;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?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,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={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)&&!a.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:i.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"),i=Symbol.for("react.fragment"),a=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 i:return"Fragment";case o:return"Portal";case s:return"Profiler";case a: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,k,I,C,N,O=Object.assign,F=0;function P(){}P.__reactDisabledLog=!0;var E,R=y.ReactCurrentDispatcher;function T(e,r,n){if(void 0===E)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);E=t&&t[1]||""}return"\n"+E+e}var _,D=!1,L="function"==typeof WeakMap?WeakMap:Map;function q(e,r){if(!e||D)return"";var n,t=_.get(e);if(void 0!==t)return t;D=!0;var o,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=R.current,R.current=null,function(){if(0===F){j=console.log,w=console.info,S=console.warn,k=console.error,I=console.group,C=console.groupCollapsed,N=console.groupEnd;var e={configurable:!0,enumerable:!0,value:P,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}F++}();try{if(r){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){n=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){n=e}e.call(a.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&&_.set(e,d),d}}while(c>=1&&u>=0);break}}}finally{D=!1,R.current=o,function(){if(0==--F){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:O({},e,{value:j}),info:O({},e,{value:w}),warn:O({},e,{value:S}),error:O({},e,{value:k}),group:O({},e,{value:I}),groupCollapsed:O({},e,{value:C}),groupEnd:O({},e,{value:N})})}F<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var f=e?e.displayName||e.name:"",p=f?T(f):"";return"function"==typeof e&&_.set(e,p),p}function A(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 T(e);switch(e){case d:return T("Suspense");case f:return T("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case u:return q(e.render,!1);case p:return A(e.type,r,n);case m:var o=e,i=o._payload,a=o._init;try{return A(a(i),r,n)}catch(e){}}return""}_=new L;var $=Object.prototype.hasOwnProperty,U={},B=y.ReactDebugCurrentFrame;function M(e){if(e){var r=e._owner,n=A(e.type,e._source,r?r.type:null);B.setExtraStackFrame(n)}else B.setExtraStackFrame(null)}var z=Array.isArray;function W(e){return z(e)}function Y(e){return""+e}function V(e){if(function(e){try{return Y(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)),Y(e)}var H,J,K,Q=y.ReactCurrentOwner,X={key:!0,ref:!0,__self:!0,__source:!0};function G(e,r,n,o,i){var a,s={},l=null,c=null;for(a in void 0!==n&&(V(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)&&(V(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,r){if("string"==typeof e.ref&&Q.current&&r&&Q.current.stateNode!==r){var n=x(Q.current.type);K[n]||(g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',x(Q.current.type),e.ref),K[n]=!0)}}(r,i)),r)$.call(r,a)&&!X.hasOwnProperty(a)&&(s[a]=r[a]);if(e&&e.defaultProps){var u=e.defaultProps;for(a in u)void 0===s[a]&&(s[a]=u[a])}if(l||c){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,r){var n=function(){H||(H=!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(){J||(J=!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,i,a,s){var l={$$typeof:t,type:e,key:r,ref:n,props:s,_owner:a,_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:i}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,c,i,o,Q.current,s)}K={};var Z,ee=y.ReactCurrentOwner,re=y.ReactDebugCurrentFrame;function ne(e){if(e){var r=e._owner,n=A(e.type,e._source,r?r.type:null);re.setExtraStackFrame(n)}else re.setExtraStackFrame(null)}function te(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}function oe(){if(ee.current){var e=x(ee.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}Z=!1;var ie={};function ae(e,r){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var r=oe();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(!ie[n]){ie[n]=!0;var t="";e&&e._owner&&e._owner!==ee.current&&(t=" It was passed a child from "+x(e._owner.type)+"."),ne(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),ne(null)}}}function se(e,r){if("object"==typeof e)if(W(e))for(var n=0;n<e.length;n++){var t=e[n];te(t)&&ae(t,r)}else if(te(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 i,a=o.call(e);!(i=a.next()).done;)te(i.value)&&ae(i.value,r)}}function le(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 i=Function.call.bind($);for(var a in e)if(i(e,a)){var s=void 0;try{if("function"!=typeof e[a]){var l=Error((t||"React class")+": "+n+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}s=e[a](r,a,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,a,typeof s),M(null)),s instanceof Error&&!(s.message in U)&&(U[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||Z||(Z=!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 ce={};function ue(e,n,o,h,y,b){var j=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===s||e===a||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+=oe(),null===e?w="null":W(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 k=G(e,n,o,y,b);if(null==k)return k;if(j){var I=n.children;if(void 0!==I)if(h)if(W(I)){for(var C=0;C<I.length;C++)se(I[C],e);Object.freeze&&Object.freeze(I)}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 se(I,e)}if($.call(n,"key")){var N=x(e),O=Object.keys(n).filter((function(e){return"key"!==e})),F=O.length>0?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}";ce[N+F]||(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} />',F,N,O.length>0?"{"+O.join(": ..., ")+": ...}":"{}",N),ce[N+F]=!0)}return e===i?function(e){for(var r=Object.keys(e.props),n=0;n<r.length;n++){var t=r[n];if("children"!==t&&"key"!==t){ne(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",t),ne(null);break}}null!==e.ref&&(ne(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),ne(null))}(k):le(k),k}var de=function(e,r,n){return ue(e,r,n,!1)},fe=function(e,r,n){return ue(e,r,n,!0)};ye.Fragment=i,ye.jsx=de,ye.jsxs=fe}()),ye);var ge=me.exports,be=function(e){return e.paths?ge.jsx(_,{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,i=void 0!==o&&o,a=e.loading,s=void 0!==a&&a,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(E.Search,{value:v,placeholder:"Ingresar búsqueda",onChange:function(e){return h(e.target.value||"")},onSearch:g,onPressEnter:g}):null,null!==i?i||ge.jsx(c,{href:(t=p,t.endsWith("/")&&(t=t.slice(0,-1)),t+"/insert"),children:ge.jsx(R,{type:"primary",children:"Insertar"})}):null,l.onRefrescar?ge.jsx("div",{children:ge.jsx(R,{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(T.Title,{className:"!mb-0 mt-4",children:l.title}),l.subtitle&&ge.jsx(T.Title,{level:3,type:"secondary",className:"!font-normal !m-0",children:l.subtitle})]}),null!==l.column?l.column||b:null]})},je={hostUtils:"https://utils.upconta.com",hostFastify:"",hostRestify:"",userTokenName:"",adminTokenName:"",cookieDominio:"",cookiePath:void 0},we=function(e){je=ce(ce({},je),e)},Se=function(e){return ue(void 0,void 0,void 0,(function(){var r,n,t,o,i,a;return de(this,(function(s){switch(s.label){case 0:if(!((r=(null===(i=e.response)||void 0===i?void 0:i.data)?(null===(a=e.response.data)||void 0===a?void 0:a.message)||e.response.data:e.message)instanceof Blob))return[3,5];s.label=1;case 1:return s.trys.push([1,3,,5]),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"}]}}))}))},ke=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,Se(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},Ce=function(e,r){var n="";n=!e||"fastify"===e||e.includes("/v4")?je.hostFastify:"utils"===e?je.hostUtils:je.hostRestify;var t=re.create({baseURL:n});return"utils"!==e&&(t.defaults.headers.common.Authorization=ne(Ie(null==r?void 0:r.tipo),{domain:je.cookieDominio,path:je.cookiePath})),t},Ne=function(e,r){te(Ie(r.usuario),e,{domain:je.cookieDominio,maxAge:604800,path:je.cookiePath})},Oe=function(e){oe(Ie(e),{domain:je.cookieDominio,path:je.cookiePath})},Fe=function(e,r){var n=new URL(e,e.includes("/v4")?je.hostFastify:je.hostRestify),t="";return r&&(t=new URLSearchParams(r).toString()),n.href+(t?"?"+t:"")},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 i=n[t];if(!e||!(i in e))return;e=e[i]}return e},Ee=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},Re=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 Te(e,r){void 0===r&&(r=2);var n=Math.pow(10,r);return Math.round(+(e*n).toFixed(2))/n}var _e=t(null);function De(){return o(_e)}var Le=function(e){var t=u(),o=r(!1),i=o[0],a=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,t;return de(this,(function(o){switch(o.label){case 0:e=Ce("restify"),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Promise.all([e.get("/v3/auth/user"),e.get("/v3/businesses/me/configurations",{params:{fields:"comprobantes nDecimals invoice"}})])];case 2:return r=o.sent(),n=r[0].data,t=r[1].data,n.configuraciones=t,[2,n];case 3:return o.sent(),[2,null];case 4:return[2]}}))})).then((function(r){r?(a(!0),c(r)):Re(t,e.pathLogin)}))}),[]),i?ge.jsx(_e.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,i,a,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===(i=x.permisos)||void 0===i?void 0:i.includes("anular"))};break}var j=null===(a=x.items)||void 0===a?void 0:a.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&&ee(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,Ce("restify").get("/v3/auth/business/"+r)]:[2];case 1:if(e.sent().data)throw new Error("La empresa ya se encuentra registrada");return[2]}}))}))}},Ae={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:ie(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=ee(t).startOf("day").diff(ee().startOf("day"),"day"),e<0?n<e:n>e)throw new Error(r);return[2]}))}))}}}},$e="es-EC",Ue={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"),ee(e).format(r)},completeDate:function(e){return ee(e).format("DD/MM/YYYY HH:mm:ss")},month:function(e){return ee(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=Ce(e.endpoint,{tipo:e.tipoUsuario||"usuario"}),n=u(),t=ke().showError,o=se().mutate,i=Z(e.sinOptions?null:(e.optionsPath||e.endpoint)+"/get-options",(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(n){switch(n.label){case 0:return[4,r.get(e)];case 1:return[2,n.sent().data]}}))}))})).data,a=void 0===i?{}:i,s=new URLSearchParams(ce(ce({},e.params),n.query)).toString(),l=e.endpoint+(s?"?"+s:""),c=ae(n.isReady?l:null,(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(n){switch(n.label){case 0:return[4,r.get(e)];case 1:return[2,n.sent().data]}}))}))}),{keepPreviousData:!0}),d=c.data,f=c.error,p=c.isLoading,m=(null==d?void 0:d.data)||[],v=(null==d?void 0:d.total)||0,h=new URLSearchParams(n.query),y=h.get("page"),g=y?parseInt(y):1,b=h.get("limit"),x=b?parseInt(b):20,j={loading:p,dataSource:m,rowKey:"_id",bordered:!0,pagination:{current:g,defaultPageSize:x,total:v},onChange:function(e,r,t){return ue(void 0,void 0,void 0,(function(){var r,o,i,a;return de(this,(function(s){return r=h.toString(),o=new URLSearchParams(r),e.current!==g&&("1"===(i=e.current.toString())?o.delete("page"):o.set("page",i)),e.pageSize!==x&&("20"===(a=e.pageSize.toString())?o.delete("limit"):o.set("limit",a)),Array.isArray(t)||("ascend"===t.order?o.set("sort",t.field):"descend"===t.order?o.set("sort","-"+t.field):o.delete("sort")),r!==o.toString()&&n.push({query:Object.fromEntries(o)}),[2]}))}))}},w=function(){o(l)};return{data:m,isLoading:p,error:f,options:a,endpoint:e.endpoint,endpointWithHost:Fe(e.endpoint),mainroute:n.route,tableProps:j,axios:r,init:w,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(n){return ue(void 0,void 0,void 0,(function(){var o;return de(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,r.delete("string"==typeof n?e.endpoint+"/"+n:n.endpoint)];case 1:return i.sent(),w(),[3,3];case 2:return o=i.sent(),t(o),[3,3];case 3:return[2]}}))}))},cancel:function(n){return ue(void 0,void 0,void 0,(function(){var o;return de(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,r.delete("string"==typeof n?e.endpoint+"/"+n+"/cancel":n.endpoint)];case 1:return i.sent(),w(),[3,3];case 2:return o=i.sent(),t(o),[3,3];case 3:return[2]}}))}))}}},Me=function(e){var t=Ce(e.endpoint,{tipo:e.tipoUsuario||"usuario"}),o=L.useForm()[0],a=r(!1),s=a[0],l=a[1],f=r(!1),m=f[0],v=f[1],h=u(),y=ke(),g=y.showError,b=y.message,x=function(e){var t=i(!1),o=ke().modal,a=i(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 a.current!==l&&(window.addEventListener("beforeunload",f),d.events.on("routeChangeStart",u)),function(){window.removeEventListener("beforeunload",f),d.events.off("routeChangeStart",u)}}),[a.current,l]),{cambiarHashInicial:function(e){var r=Ee(JSON.stringify(e));c(r),a.current=r},cambiarDatosFormulario:function(r){if(t.current&&0!==a.current){var n=JSON.stringify(r),o=Ee(n);c(o),o===a.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(i){switch(i.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=i.sent(),t.current=!0,[2,n]}}))}))}}}(h.asPath),j=i("emitir"),w=i(e.data),S=i(),k=Z(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,t.get(e)];case 1:return[2,r.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,I=void 0===k?{}:k;n((function(){S.current=e.registroId,S.current||(S.current=e.soloParaInsertar?void 0:h.query.id)}),[null==e?void 0:e.registroId,e.soloParaInsertar]);var C=h.asPath.replace(/\/(insert|[\w]*\/edit$)/g,"")||"/",N=function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return ue(void 0,fe([r],n,!0),void 0,(function(r,n){var o,i,a,c,u,d,f,p;return void 0===n&&(n={}),de(this,(function(m){switch(m.label){case 0:if(!0===s)return[2];l(!0),x.limpiar(),o=n.endpoint||e.endpoint,i=n.params||void 0,m.label=1;case 1:return m.trys.push([1,6,,7]),a=void 0,S.current?[4,t.put(o+"/"+S.current,r,{params:i})]:[3,3];case 2:return a=m.sent().data,[3,5];case 3:return[4,t.post(o,r,{params:i})];case 4:a=m.sent().data,m.label=5;case 5:return!0!==n.noRedirect?(b.success("Guardado correctamente"),h.push(C)):l(!1),[2,a];case 6:if(c=m.sent(),l(!1),n.noShowError)throw c;return g(c),u=null===(p=null===(f=null==c?void 0:c.response)||void 0===f?void 0:f.data)||void 0===p?void 0:p.comprobante,d="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 d.includes(e)}))?h.push(C):!n.noRedirect&&u&&u!==S.current?(S.current=u,h.push(C+"/"+u+"/edit")):x.reanudar(),[3,7];case 7:return[2]}}))}))},O=ge.jsxs(q,{children:[ge.jsx(R,{type:"primary",loading:s,onClick:function(){return o.submit()},children:"Guardar"}),ge.jsx(c,{href:C,children:ge.jsx(R,{children:"Cancelar"})})]}),F=ge.jsxs(ge.Fragment,{children:[ge.jsx(A,{paragraph:{rows:3,width:"100%"},className:"mb-4"}),ge.jsx(A,{paragraph:{rows:4,width:"100%"},className:"mb-4"}),ge.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[ge.jsx(A,{paragraph:{rows:4,width:"100%"}}),ge.jsx(A,{paragraph:{rows:4,width:"100%"}})]}),ge.jsxs(q,{children:[ge.jsx(A.Button,{}),ge.jsx(A.Button,{})]})]}),P=function(){return b.warning("Revisa los errores del formulario")},E={form:o,autoComplete:"off",initialValues:e.data,onFinish:N,layout:"vertical",onFinishFailed:P};return n((function(){if(e.recuperacionEmergencia){var r=setInterval((function(){if(m){var e=o.getFieldsValue();x.cambiarDatosFormulario(e)}}),1e3);return function(){return clearInterval(r)}}}),[m]),n((function(){if(h.isReady){S.current=h.query.id;var r=setTimeout((function(){e.soloParaInsertar?v(!0):ue(void 0,void 0,void 0,(function(){var r,n,i;return de(this,(function(a){switch(a.label){case 0:return r=!1,[4,x.obtenerDataEmergencia()];case 1:return(n=a.sent())?(S.current=n._id,r=!0,[3,4]):[3,2];case 2:return S.current?[4,t.get("".concat(e.endpoint,"/").concat(S.current),{params:e.params})]:[3,4];case 3:n=a.sent().data,a.label=4;case 4:return n?[4,null===(i=e.formatearDataInicial)||void 0===i?void 0:i.call(e,n)]:[3,6];case 5:a.sent(),o.setFieldsValue(n),w.current=n,a.label=6;case 6:return[2,r?e.data:n||e.data]}}))})).then((function(r){var n;return Promise.all([x.cambiarHashInicial(r),null===(n=e.onMounted)||void 0===n?void 0:n.call(e)])})).then((function(){return v(!0)}))}),200);return function(){return clearTimeout(r)}}}),[h.query.id,h.isReady]),{form:o,router:h,options:I,tipoEmision:j,objectId:S.current,mainroute:C,isLoading:s,isReady:m,data:w.current,endpoint:e.endpoint,axios:t,onSubmit:N,onMainRouter:function(){return h.push(C)},setIsLoading:l,preventor:x,ModoCarga:F,BotonesPorDefecto:O,onMensajeValidacion:P,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],i=r(!1),a=i[0],s=i[1];return ge.jsx($,{title:"Click para confirmar",open:!!t,children:ge.jsx(R,{loading:a,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]}}))}))}})})},We=function(e){var n=r(!1),t=n[0],o=n[1],i=Z(t&&e.autocompletar?"/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,Ce(e).get(e)];case 1:return[2,r.sent().data.map((function(e){return{label:e,value:e}}))]}}))}))})).data,a=void 0===i?[]:i;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(T.Title,{level:3,className:"mb-0",children:"Información adicional"}),ge.jsx(R,{type:"dashed",onClick:function(){return n.add({})},children:"Agregar"})]}),ge.jsxs(U,{dataSource:r,rowClassName:"align-top",bordered:!0,pagination:!1,children:[ge.jsx(U.Column,{title:"Nombre",render:function(r){var n=r.name;return ge.jsx(L.Item,{className:"mb-0",name:[n,"nombre"],rules:[Ae.required()],children:e.autocompletar?ge.jsx(B,{options:a,maxLength:300,placeholder:"Ingresar el nombre",onFocus:function(){return o(!0)}}):ge.jsx(E,{maxLength:300,placeholder:"Ingresar el nombre"})})}},"name"),ge.jsx(U.Column,{title:"Descripción",render:function(e){var r=e.name;return ge.jsx(L.Item,{className:"mb-0",name:[r,"valor"],rules:[Ae.required()],children:ge.jsx(E,{placeholder:"Ingresar la descripción"})})}},"description"),ge.jsx(U.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")]})]})}})},Ye=function(e){var n=L.useFormInstance(),t=r([]),o=t[0],i=t[1],s=a((function(){var r=e.rules||[];switch(e.type){case"ruc":return{label:"RUC",placeholder:"Ingresar el RUC",max:13,rules:fe(fe([],r,!0),[Ae.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),[Ae.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=ie((function(r){return ue(void 0,void 0,void 0,(function(){var n,t,a;return de(this,(function(s){switch(s.label){case 0:if(n=Ce("utils"),!e.campoNombre||r.length<6||!["ci","ruc"].includes(e.type))return 0!==o.length&&i([]),[2];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.get("/clientes/buscar",{params:{identificador:r,tipo:"ci"===e.type?"cedula":"ruc"}})];case 2:return t=s.sent().data,i(t.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 a=s.sent(),console.error(a),[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)}})}))},Ve=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(T.Title,{level:3,className:"!m-0",children:"Direcciones"}),ge.jsx(R,{type:"dashed",onClick:function(){return o.add("")},children:"Agregar"})]}),ge.jsx(W,{itemLayout:"horizontal",dataSource:e,renderItem:function(i){return ge.jsx(W.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[i.name];return ge.jsx(Y,{checked:o===n,onClick:function(){return r("address",o)},children:"Por defecto"})}},"unico"),ge.jsx(ze,{onConfirm:function(){t[i.name]===n&&r.setFieldValue("address",""),o.remove(i.name)}},"eliminar")],children:ge.jsx(W.Item.Meta,{description:ge.jsx(L.Item,{name:i.name,rules:[Ae.required()],className:"mb-0",children:ge.jsx(E,{placeholder:"Ingresar la dirección",onChange:function(n){1===e.length&&r.setFieldValue("address",n.target.value)}})})})})}})]})}})},He=function(){var e=r(!1),n=e[0],t=e[1],o=Z(n?"/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,Ce(e).get(e)];case 1:return[2,r.sent().data.etiquetas]}}))}))})).data,i=void 0===o?[]:o;return ge.jsx(L.Item,{name:"etiquetas",label:"Etiqueta",children:ge.jsx(B,{options:i.map((function(e){return{label:e,value:e}})),placeholder:"Ingresar o seleccionar una etiqueta",onFocus:function(){return t(!0)}})})},Je=s((function(e,r){var t,o,i=u(),s=De().hasModule,c=Me({endpoint:"/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=Z("08"===d?"/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,Ce(e).get(e)];case 1:return[2,r.sent().data.PaisesParaisosFiscales.map((function(e){return{label:e.description,value:parseInt(e.id)}}))]}}))}))})).data,h=a((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(i.query)),n=r.name,t=r.idType,o=r.identificador;t&&o&&n&&e.type}),[i.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:[Ae.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(Ye,{name:"id",campoNombre:"name",type:h,rules:[Ae.required()]}),ge.jsx(L.Item,{name:"name",label:"Nombres / Razón social",rules:[Ae.required()],children:ge.jsx(E,{placeholder:"Ingresar la razón social"})}),ge.jsx(L.Item,{name:"subjectType",label:"Tipo de sujeto",rules:[Ae.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(E,{type:"phone",placeholder:"Ingresar el teléfono 1"})}),f?ge.jsx(L.Item,{name:"cellphone",label:"Télefono 2",children:ge.jsx(E,{type:"phone",placeholder:"Ingresar el teléfono 2"})}):null,ge.jsx(L.Item,{name:"email",label:"Correo electrónico",rules:[Ae.email()],normalize:function(e){return e.trim()},children:ge.jsx(E,{placeholder:"Ingresar el correo electrónico"})}),!m&&ge.jsx(L.Item,{name:"optionalEmail",label:"Correos electrónicos alternativos",rules:[Ae.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(E,{})}),!m&&ge.jsx(Ve,{form:c.form}),ge.jsx(T.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(Xe,{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:[Ae.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(Xe,{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(He,{})]}):null]}),ge.jsx("div",{className:"mb-5",children:ge.jsx(We,{name:"informacionAdicional",autocompletar:!0})}),e.ocultarBotones?null:c.BotonesPorDefecto]})):c.ModoCarga})),Ke=function(e){var r=i(e.options),n=a((function(){return function(e){switch(e.tipo){case"mesas":return{label:"Mesa",endpoint:"/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:"/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:"/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:"/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(Je,{ref:e.ref,type:"client",ocultarBotones:!0})}}}}}({opciones:r,tipo:e.tipo})}),[e.tipo]),t=Z(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,Ce(n.endpoint).get(e)];case 1:return[2,r.sent().data]}}))}))}),{revalidateOnFocus:!1}).data;return t&&(r.current=t),n},Qe=function(e){var t=ke().message,o=De().getPermisos,s=e.values.customDocumentId||"_id",l=Ce(e.values.endpoint),c=r(!1),u=c[0],d=c[1],f=r(),p=f[0],m=f[1],v=r(!1),g=v[0],b=v[1],x=r(!1),j=x[0],w=x[1],S=i(!1),k=r(""),I=k[0],C=k[1],N=i(null),O=!0===e.canCreate&&!!e.values.modal,F=a((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]),P=Z(u?e.values.endpoint+F:null,(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(r){switch(r.label){case 0:return[4,l.get(e)];case 1:return[2,r.sent().data.data]}}))}))}),{keepPreviousData:!0}),R=P.data,_=void 0===R?[]:R,D=P.isLoading;P.mutate;var L=a((function(){switch(e.type){case"clients":case"providers":case"transporters":return o("/administrative/".concat(e.type))}}),[e.type]);n((function(){if(!A&&void 0!==p){var e=setTimeout((function(){C(p),d(!0)}),500);return function(){return clearTimeout(e)}}}),[p]);var q=a((function(){return _.map((function(r){var n,t,o=Pe(r,s),i=e.values.title(r),a=null===(t=(n=e.values).subtitle)||void 0===t?void 0:t.call(n,r);return{key:o,value:o,texto:a,item:r,label:ge.jsxs("div",{children:[ge.jsxs("div",{children:[ge.jsx("b",{className:"mr-1",children:i}),e.value===o?ge.jsx(h,{twoToneColor:"#52c41a"}):void 0]}),a?ge.jsx("div",{className:"text-wrap",children:a}):null]})}}))||[]}),[e.value,_]),A=a((function(){if(e.value)return _.find((function(r){return Pe(r,s)===e.value}))}),[e.value,_]),$=a((function(){return!0===D?ge.jsx(y,{}):A&&!e.llenarCuandoTipea?ge.jsx(h,{twoToneColor:"#52c41a"}):ge.jsx("span",{})}),[D,A]);return n((function(){e.value&&d(!0)}),[e.value]),n((function(){var r,n;if(A){var t=Pe(A,e.values.field),o=null===(r=e.values.formItemTexto||e.values.subtitle)||void 0===r?void 0:r(A);e.onSetTextoExtra(o||""),m(t),d(!1)}else e.onSetTextoExtra("");!0===S.current&&(null===(n=e.onSelect)||void 0===n||n.call(e,A||null))}),[A]),n((function(){var e=setTimeout((function(){S.current=!0}),1e3);return function(){return clearTimeout(e)}}),[]),ge.jsxs(ge.Fragment,{children:[O?ge.jsx(V,{title:e.values.modal.title,open:g,width:720,zIndex:1100,maskClosable:!1,styles:{body:{padding:0}},confirmLoading:j,onOk:function(){return ue(void 0,void 0,void 0,(function(){var r,n,o,i,a,s;return de(this,(function(l){switch(l.label){case 0:r=N.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 w(!0),i=n.getFieldsValue(),[4,o(i,{noRedirect:!0})];case 5:return a=l.sent(),w(!1),a?(n.resetFields(),null===(s=e.onChange)||void 0===s||s.call(e,a._id),b(!1),[2]):[2]}}))}))},onCancel:function(){return b(!1)},children:e.values.modal.componente({ref:N})}):null,ge.jsx(B,{options:q,value:p,dropdownRender:function(e){return ge.jsxs(ge.Fragment,{children:[O&&(null==L?void 0:L.escribir)?ge.jsxs(ge.Fragment,{children:[ge.jsx(T.Link,{className:"block px-3 py-1",onClick:function(){b(!0)},children:"Añadir nuevo"}),ge.jsx(H,{className:"!m-0"})]}):null,e]})},notFoundContent:"Sin resultados",disabled:e.disabled,onFocus:function(){e.value||d(!0)},onSelect:function(r){var n;d(!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)),m(r)},children:ge.jsx(E,{placeholder:e.values.placeholder,suffix:$})})]})};Qe.displayName="BuscadorSeeker";var Xe=function(e){var n=r(""),t=n[0],o=n[1],i=Ke({tipo:e.type,options:void 0});return i?ge.jsx(L.Item,{name:e.name,label:null===e.label?void 0:e.label||i.label,extra:e.hideMessage?void 0:t,rules:e.required?[Ae.required()]:[{}],className:e.classNameFormItem,children:ge.jsx(Qe,{type:e.type,canCreate:e.canCreate,values:i,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};Xe.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(J,{title:"Bitácora",placement:"right",closable:!1,open:0!==e.bitacora.length,onClose:function(){return e.setBitacora([])},children:ge.jsx(K,{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(I,{})};case"sent":return{color:"#1890FF",icon:ge.jsx(k,{})};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",{}),Ue.completeDate(e.date)]})}}))})})},nr="#F34D24",tr="#FFFFFF",or=function(e){var t=r(!1),o=t[0],i=t[1];return n((function(){i(!0)}),[]),o?ge.jsx(er,{children:ge.jsx(Q,{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:{bodyBg:tr,headerBg:tr,siderBg:"#0F141E"},Menu:{darkItemBg:"#0F141E",darkSubMenuItemBg:"#0A0E15"},Tag:{marginXS:0}}},children:ge.jsx(D,{children:ge.jsx(X,{className:(e.className||"")+" min-h-screen w-full",style:e.style,children:e.children})})})}):null},ir=function(e){var t=Ze().setBitacora,o=r(!1),i=o[0],s=o[1],l=a((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:i,children:e.usarIcono?ge.jsx(O,{title:"Ver historial",className:l?"":"text-gray-300 cursor-not-allowed",onClick:c}):ge.jsx(R,{icon:ge.jsx(O,{}),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"})}},sr=function(e){var t=r(ar()),o=t[0],i=t[1];return n((function(){var e=setInterval((function(){return i(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})]})},lr=function(e){var n=r(!0),t=n[0],o=n[1],i=r(!1),a=i[0],s=i[1];return ge.jsxs(ge.Fragment,{children:[e.sidebar?ge.jsxs(X.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(X,{className:a||t?"ml-0":"ml-[230px]",onClick:!t&&a?function(e){e.stopPropagation(),e.preventDefault(),o(!0)}:void 0,children:[e.navbar?ge.jsx(X.Header,{className:"border-b top-0 !z-[2] sticky !px-4",children:ge.jsxs("div",{className:"flex justify-between items-center h-full",children:[ge.jsx("div",{children:ge.jsx(R,{type:"text",icon:t?ge.jsx(F,{}):ge.jsx(P,{}),onClick:function(){return o(!t)},children:e.navbar.title})}),e.navbar.options?ge.jsx("div",{children:e.navbar.options}):ge.jsx("div",{})]})}):null,ge.jsx(X.Content,{className:"m-4 md:m-8 xl:mx-16 xl:my-8",children:e.children}),e.footer?ge.jsx(X.Footer,{className:"!text-gray-500",children:e.footer}):null]})]})};export{Ue as $filtros,Ae as $reglas,ze as BotonConfirmacion,ir as BotonMovimientos,Le as ContextoEmpresa,Je as FormularioPersonas,xe as Header,Ye as IdentificadorPersona,lr as LayoutBase,sr as Reloj,Xe as Seeker,or as TemaPrincipal,we as configurarUtils,Ne as crearToken,Oe as destruirToken,Fe as getApiEndpoint,Ce as getAxios,Pe as getNestedPath,Ee as hashear,Te as nDecimals,Re as redireccionarLogin,De as useContextoEmpresa,Ze as useFrontendUtils,ke as useUtils,Me 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,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={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)&&!a.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:i.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"),i=Symbol.for("react.fragment"),a=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 i:return"Fragment";case o:return"Portal";case s:return"Profiler";case a: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,k,I,C,N,O=Object.assign,P=0;function E(){}E.__reactDisabledLog=!0;var F,R=y.ReactCurrentDispatcher;function T(e,r,n){if(void 0===F)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);F=t&&t[1]||""}return"\n"+F+e}var _,D=!1,L="function"==typeof WeakMap?WeakMap:Map;function q(e,r){if(!e||D)return"";var n,t=_.get(e);if(void 0!==t)return t;D=!0;var o,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=R.current,R.current=null,function(){if(0===P){j=console.log,w=console.info,S=console.warn,k=console.error,I=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})}P++}();try{if(r){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){n=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){n=e}e.call(a.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&&_.set(e,d),d}}while(c>=1&&u>=0);break}}}finally{D=!1,R.current=o,function(){if(0==--P){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:O({},e,{value:j}),info:O({},e,{value:w}),warn:O({},e,{value:S}),error:O({},e,{value:k}),group:O({},e,{value:I}),groupCollapsed:O({},e,{value:C}),groupEnd:O({},e,{value:N})})}P<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var f=e?e.displayName||e.name:"",p=f?T(f):"";return"function"==typeof e&&_.set(e,p),p}function A(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 T(e);switch(e){case d:return T("Suspense");case f:return T("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case u:return q(e.render,!1);case p:return A(e.type,r,n);case m:var o=e,i=o._payload,a=o._init;try{return A(a(i),r,n)}catch(e){}}return""}_=new L;var $=Object.prototype.hasOwnProperty,U={},M=y.ReactDebugCurrentFrame;function B(e){if(e){var r=e._owner,n=A(e.type,e._source,r?r.type:null);M.setExtraStackFrame(n)}else M.setExtraStackFrame(null)}var z=Array.isArray;function W(e){return z(e)}function Y(e){return""+e}function V(e){if(function(e){try{return Y(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)),Y(e)}var H,J,K,Q=y.ReactCurrentOwner,X={key:!0,ref:!0,__self:!0,__source:!0};function G(e,r,n,o,i){var a,s={},l=null,c=null;for(a in void 0!==n&&(V(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)&&(V(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,r){if("string"==typeof e.ref&&Q.current&&r&&Q.current.stateNode!==r){var n=x(Q.current.type);K[n]||(g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',x(Q.current.type),e.ref),K[n]=!0)}}(r,i)),r)$.call(r,a)&&!X.hasOwnProperty(a)&&(s[a]=r[a]);if(e&&e.defaultProps){var u=e.defaultProps;for(a in u)void 0===s[a]&&(s[a]=u[a])}if(l||c){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,r){var n=function(){H||(H=!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(){J||(J=!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,i,a,s){var l={$$typeof:t,type:e,key:r,ref:n,props:s,_owner:a,_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:i}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,c,i,o,Q.current,s)}K={};var Z,ee=y.ReactCurrentOwner,re=y.ReactDebugCurrentFrame;function ne(e){if(e){var r=e._owner,n=A(e.type,e._source,r?r.type:null);re.setExtraStackFrame(n)}else re.setExtraStackFrame(null)}function te(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}function oe(){if(ee.current){var e=x(ee.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}Z=!1;var ie={};function ae(e,r){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var r=oe();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(!ie[n]){ie[n]=!0;var t="";e&&e._owner&&e._owner!==ee.current&&(t=" It was passed a child from "+x(e._owner.type)+"."),ne(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),ne(null)}}}function se(e,r){if("object"==typeof e)if(W(e))for(var n=0;n<e.length;n++){var t=e[n];te(t)&&ae(t,r)}else if(te(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 i,a=o.call(e);!(i=a.next()).done;)te(i.value)&&ae(i.value,r)}}function le(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 i=Function.call.bind($);for(var a in e)if(i(e,a)){var s=void 0;try{if("function"!=typeof e[a]){var l=Error((t||"React class")+": "+n+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}s=e[a](r,a,t,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(B(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,a,typeof s),B(null)),s instanceof Error&&!(s.message in U)&&(U[s.message]=!0,B(o),g("Failed %s type: %s",n,s.message),B(null))}}(r,e.props,"prop",t,e)}else void 0===n.PropTypes||Z||(Z=!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 ce={};function ue(e,n,o,h,y,b){var j=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===s||e===a||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+=oe(),null===e?w="null":W(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 k=G(e,n,o,y,b);if(null==k)return k;if(j){var I=n.children;if(void 0!==I)if(h)if(W(I)){for(var C=0;C<I.length;C++)se(I[C],e);Object.freeze&&Object.freeze(I)}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 se(I,e)}if($.call(n,"key")){var N=x(e),O=Object.keys(n).filter((function(e){return"key"!==e})),P=O.length>0?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}";ce[N+P]||(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} />',P,N,O.length>0?"{"+O.join(": ..., ")+": ...}":"{}",N),ce[N+P]=!0)}return e===i?function(e){for(var r=Object.keys(e.props),n=0;n<r.length;n++){var t=r[n];if("children"!==t&&"key"!==t){ne(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",t),ne(null);break}}null!==e.ref&&(ne(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),ne(null))}(k):le(k),k}var de=function(e,r,n){return ue(e,r,n,!1)},fe=function(e,r,n){return ue(e,r,n,!0)};ye.Fragment=i,ye.jsx=de,ye.jsxs=fe}()),ye);var ge=me.exports,be=function(e){return e.paths?ge.jsx(_,{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,i=void 0!==o&&o,a=e.loading,s=void 0!==a&&a,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(F.Search,{value:v,placeholder:"Ingresar búsqueda",onChange:function(e){return h(e.target.value||"")},onSearch:g,onPressEnter:g}):null,null!==i?i||ge.jsx(c,{href:(t=p,t.endsWith("/")&&(t=t.slice(0,-1)),t+"/insert"),children:ge.jsx(R,{type:"primary",children:"Insertar"})}):null,l.onRefrescar?ge.jsx("div",{children:ge.jsx(R,{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(T.Title,{className:"!mb-0 mt-4",children:l.title}),l.subtitle&&ge.jsx(T.Title,{level:3,type:"secondary",className:"!font-normal !m-0",children:l.subtitle})]}),null!==l.column?l.column||b:null]})},je={hostUtils:"https://utils.upconta.com",hostFastify:"",hostRestify:"",userTokenName:"",adminTokenName:"",cookieDominio:"",cookiePath:void 0},we=function(e){je=ce(ce({},je),e)},Se=function(e){return ue(void 0,void 0,void 0,(function(){var r,n,t,o,i,a;return de(this,(function(s){switch(s.label){case 0:if(!((r=(null===(i=e.response)||void 0===i?void 0:i.data)?(null===(a=e.response.data)||void 0===a?void 0:a.message)||e.response.data:e.message)instanceof Blob))return[3,5];s.label=1;case 1:return s.trys.push([1,3,,5]),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"}]}}))}))},ke=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,Se(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},Ce=function(e,r){var n="";n=!e||"fastify"===e||e.includes("/v4")?je.hostFastify:"utils"===e?je.hostUtils:je.hostRestify;var t=re.create({baseURL:n});return"utils"!==e&&(t.defaults.headers.common.Authorization=ne(Ie(null==r?void 0:r.tipo),{domain:je.cookieDominio,path:je.cookiePath})),t},Ne=function(e,r){te(Ie(r.usuario),e,{domain:je.cookieDominio,maxAge:604800,path:je.cookiePath})},Oe=function(e){oe(Ie(e),{domain:je.cookieDominio,path:je.cookiePath})},Pe=function(e,r){var n=new URL(e,e.includes("/v4")?je.hostFastify:je.hostRestify),t="";return r&&(t=new URLSearchParams(r).toString()),n.href+(t?"?"+t:"")},Ee=function(e,r){for(var n=(r=(r=r.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split("."),t=0,o=n.length;t<o;++t){var i=n[t];if(!e||!(i in e))return;e=e[i]}return e},Fe=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},Re=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 Te(e,r){void 0===r&&(r=2);var n=Math.pow(10,r);return Math.round(+(e*n).toFixed(2))/n}var _e=t(null);function De(){return o(_e)}var Le=function(e){var t=u(),o=r(!1),i=o[0],a=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,t;return de(this,(function(o){switch(o.label){case 0:e=Ce("restify"),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Promise.all([e.get("/v3/auth/user"),e.get("/v3/businesses/me/configurations",{params:{fields:"comprobantes nDecimals invoice"}})])];case 2:return r=o.sent(),n=r[0].data,t=r[1].data,n.configuraciones=t,[2,n];case 3:return o.sent(),[2,null];case 4:return[2]}}))})).then((function(r){r?(a(!0),c(r)):Re(t,e.pathLogin)}))}),[]),i?ge.jsx(_e.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,i,a,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===(i=x.permisos)||void 0===i?void 0:i.includes("anular"))};break}var j=null===(a=x.items)||void 0===a?void 0:a.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&&ee(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,Ce("restify").get("/v3/auth/business/"+r)]:[2];case 1:if(e.sent().data)throw new Error("La empresa ya se encuentra registrada");return[2]}}))}))}},Ae={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:ie(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=ee(t).startOf("day").diff(ee().startOf("day"),"day"),e<0?n<e:n>e)throw new Error(r);return[2]}))}))}}}},$e="es-EC",Ue={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"),ee(e).format(r)},completeDate:function(e){return ee(e).format("DD/MM/YYYY HH:mm:ss")},month:function(e){return ee(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))}},Me=function(e){var r=Ce(e.endpoint,{tipo:e.tipoUsuario||"usuario"}),n=u(),t=ke().showError,o=se().mutate,i=Z(e.sinOptions?null:(e.optionsPath||e.endpoint)+"/get-options",(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(n){switch(n.label){case 0:return[4,r.get(e)];case 1:return[2,n.sent().data]}}))}))})).data,a=void 0===i?{}:i,s=new URLSearchParams(ce(ce({},e.params),n.query)).toString(),l=e.endpoint+(s?"?"+s:""),c=ae(n.isReady?l:null,(function(e){return ue(void 0,void 0,void 0,(function(){return de(this,(function(n){switch(n.label){case 0:return[4,r.get(e)];case 1:return[2,n.sent().data]}}))}))}),{keepPreviousData:!0}),d=c.data,f=c.error,p=c.isLoading,m=(null==d?void 0:d.data)||[],v=(null==d?void 0:d.total)||0,h=new URLSearchParams(n.query),y=h.get("page"),g=y?parseInt(y):1,b=h.get("limit"),x=b?parseInt(b):20,j={loading:p,dataSource:m,rowKey:"_id",bordered:!0,pagination:{current:g,defaultPageSize:x,total:v},onChange:function(e,r,t){return ue(void 0,void 0,void 0,(function(){var r,o,i,a;return de(this,(function(s){return r=h.toString(),o=new URLSearchParams(r),e.current!==g&&("1"===(i=e.current.toString())?o.delete("page"):o.set("page",i)),e.pageSize!==x&&("20"===(a=e.pageSize.toString())?o.delete("limit"):o.set("limit",a)),Array.isArray(t)||("ascend"===t.order?o.set("sort",t.field):"descend"===t.order?o.set("sort","-"+t.field):o.delete("sort")),r!==o.toString()&&n.push({query:Object.fromEntries(o)}),[2]}))}))}},w=function(){o(l)};return{data:m,isLoading:p,error:f,options:a,endpoint:e.endpoint,endpointWithHost:Pe(e.endpoint),mainroute:n.route,tableProps:j,axios:r,init:w,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(n){return ue(void 0,void 0,void 0,(function(){var o;return de(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,r.delete("string"==typeof n?e.endpoint+"/"+n:n.endpoint)];case 1:return i.sent(),w(),[3,3];case 2:return o=i.sent(),t(o),[3,3];case 3:return[2]}}))}))},cancel:function(n){return ue(void 0,void 0,void 0,(function(){var o;return de(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,r.delete("string"==typeof n?e.endpoint+"/"+n+"/cancel":n.endpoint)];case 1:return i.sent(),w(),[3,3];case 2:return o=i.sent(),t(o),[3,3];case 3:return[2]}}))}))}}},Be=function(e){var t=Ce(e.endpoint,{tipo:e.tipoUsuario||"usuario"}),o=L.useForm()[0],a=r(!1),s=a[0],l=a[1],f=r(!1),m=f[0],v=f[1],h=u(),y=ke(),g=y.showError,b=y.message,x=function(e){var t=i(!1),o=ke().modal,a=i(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 a.current!==l&&(window.addEventListener("beforeunload",f),d.events.on("routeChangeStart",u)),function(){window.removeEventListener("beforeunload",f),d.events.off("routeChangeStart",u)}}),[a.current,l]),{cambiarHashInicial:function(e){var r=Fe(JSON.stringify(e));c(r),a.current=r},cambiarDatosFormulario:function(r){if(t.current&&0!==a.current){var n=JSON.stringify(r),o=Fe(n);c(o),o===a.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(i){switch(i.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=i.sent(),t.current=!0,[2,n]}}))}))}}}(h.asPath),j=i("emitir"),w=i(e.data),S=i(),k=Z(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,t.get(e)];case 1:return[2,r.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,I=void 0===k?{}:k;n((function(){S.current=e.registroId,S.current||(S.current=e.soloParaInsertar?void 0:h.query.id)}),[null==e?void 0:e.registroId,e.soloParaInsertar]);var C=h.asPath.replace(/\/(insert|[\w]*\/edit$)/g,"")||"/",N=function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return ue(void 0,fe([r],n,!0),void 0,(function(r,n){var o,i,a,c,u,d,f,p;return void 0===n&&(n={}),de(this,(function(m){switch(m.label){case 0:if(!0===s)return[2];l(!0),x.limpiar(),o=n.endpoint||e.endpoint,i=n.params||void 0,m.label=1;case 1:return m.trys.push([1,6,,7]),a=void 0,S.current?[4,t.put(o+"/"+S.current,r,{params:i})]:[3,3];case 2:return a=m.sent().data,[3,5];case 3:return[4,t.post(o,r,{params:i})];case 4:a=m.sent().data,m.label=5;case 5:return!0!==n.noRedirect?(b.success("Guardado correctamente"),h.push(C)):l(!1),[2,a];case 6:if(c=m.sent(),l(!1),n.noShowError)throw c;return g(c),u=null===(p=null===(f=null==c?void 0:c.response)||void 0===f?void 0:f.data)||void 0===p?void 0:p.comprobante,d="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 d.includes(e)}))?h.push(C):!n.noRedirect&&u&&u!==S.current?(S.current=u,h.push(C+"/"+u+"/edit")):x.reanudar(),[3,7];case 7:return[2]}}))}))},O=ge.jsxs(q,{children:[ge.jsx(R,{type:"primary",loading:s,onClick:function(){return o.submit()},children:"Guardar"}),ge.jsx(c,{href:C,children:ge.jsx(R,{children:"Cancelar"})})]}),P=ge.jsxs(ge.Fragment,{children:[ge.jsx(A,{paragraph:{rows:3,width:"100%"},className:"mb-4"}),ge.jsx(A,{paragraph:{rows:4,width:"100%"},className:"mb-4"}),ge.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[ge.jsx(A,{paragraph:{rows:4,width:"100%"}}),ge.jsx(A,{paragraph:{rows:4,width:"100%"}})]}),ge.jsxs(q,{children:[ge.jsx(A.Button,{}),ge.jsx(A.Button,{})]})]}),E=function(){return b.warning("Revisa los errores del formulario")},F={form:o,autoComplete:"off",initialValues:e.data,onFinish:N,layout:"vertical",onFinishFailed:E};return n((function(){if(e.recuperacionEmergencia){var r=setInterval((function(){if(m){var e=o.getFieldsValue();x.cambiarDatosFormulario(e)}}),1e3);return function(){return clearInterval(r)}}}),[m]),n((function(){if(h.isReady){S.current=h.query.id;var r=setTimeout((function(){e.soloParaInsertar?v(!0):ue(void 0,void 0,void 0,(function(){var r,n,i;return de(this,(function(a){switch(a.label){case 0:return r=!1,[4,x.obtenerDataEmergencia()];case 1:return(n=a.sent())?(S.current=n._id,r=!0,[3,4]):[3,2];case 2:return S.current?[4,t.get("".concat(e.endpoint,"/").concat(S.current),{params:e.params})]:[3,4];case 3:n=a.sent().data,a.label=4;case 4:return n?[4,null===(i=e.formatearDataInicial)||void 0===i?void 0:i.call(e,n)]:[3,6];case 5:a.sent(),o.setFieldsValue(n),w.current=n,a.label=6;case 6:return[2,r?e.data:n||e.data]}}))})).then((function(r){var n;return Promise.all([x.cambiarHashInicial(r),null===(n=e.onMounted)||void 0===n?void 0:n.call(e)])})).then((function(){return v(!0)}))}),200);return function(){return clearTimeout(r)}}}),[h.query.id,h.isReady]),{form:o,router:h,options:I,tipoEmision:j,objectId:S.current,mainroute:C,isLoading:s,isReady:m,data:w.current,endpoint:e.endpoint,axios:t,onSubmit:N,onMainRouter:function(){return h.push(C)},setIsLoading:l,preventor:x,ModoCarga:P,BotonesPorDefecto:O,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:F}},ze=function(e){var n=r(),t=n[0],o=n[1],i=r(!1),a=i[0],s=i[1];return ge.jsx($,{title:"Click para confirmar",open:!!t,children:ge.jsx(R,{loading:a,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]}}))}))}})})},We=function(e){var n=r(!1),t=n[0],o=n[1],i=Z(t&&e.autocompletar?"/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,Ce(e).get(e)];case 1:return[2,r.sent().data.map((function(e){return{label:e,value:e}}))]}}))}))})).data,a=void 0===i?[]:i;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(T.Title,{level:3,className:"mb-0",children:"Información adicional"}),ge.jsx(R,{type:"dashed",onClick:function(){return n.add({})},children:"Agregar"})]}),ge.jsxs(U,{dataSource:r,rowClassName:"align-top",bordered:!0,pagination:!1,children:[ge.jsx(U.Column,{title:"Nombre",render:function(r){var n=r.name;return ge.jsx(L.Item,{className:"mb-0",name:[n,"nombre"],rules:[Ae.required()],children:e.autocompletar?ge.jsx(M,{options:a,maxLength:300,placeholder:"Ingresar el nombre",onFocus:function(){return o(!0)}}):ge.jsx(F,{maxLength:300,placeholder:"Ingresar el nombre"})})}},"name"),ge.jsx(U.Column,{title:"Descripción",render:function(e){var r=e.name;return ge.jsx(L.Item,{className:"mb-0",name:[r,"valor"],rules:[Ae.required()],children:ge.jsx(F,{placeholder:"Ingresar la descripción"})})}},"description"),ge.jsx(U.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")]})]})}})},Ye=function(e){var n=L.useFormInstance(),t=r([]),o=t[0],i=t[1],s=a((function(){var r=e.rules||[];switch(e.type){case"ruc":return{label:"RUC",placeholder:"Ingresar el RUC",max:13,rules:fe(fe([],r,!0),[Ae.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),[Ae.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=ie((function(r){return ue(void 0,void 0,void 0,(function(){var n,t,a;return de(this,(function(s){switch(s.label){case 0:if(n=Ce("utils"),!e.campoNombre||r.length<6||!["ci","ruc"].includes(e.type))return 0!==o.length&&i([]),[2];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.get("/clientes/buscar",{params:{identificador:r,tipo:"ci"===e.type?"cedula":"ruc"}})];case 2:return t=s.sent().data,i(t.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 a=s.sent(),console.error(a),[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(M,{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)}})}))},Ve=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(T.Title,{level:3,className:"!m-0",children:"Direcciones"}),ge.jsx(R,{type:"dashed",onClick:function(){return o.add("")},children:"Agregar"})]}),ge.jsx(W,{itemLayout:"horizontal",dataSource:e,renderItem:function(i){return ge.jsx(W.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[i.name];return ge.jsx(Y,{checked:o===n,onClick:function(){return r("address",o)},children:"Por defecto"})}},"unico"),ge.jsx(ze,{onConfirm:function(){t[i.name]===n&&r.setFieldValue("address",""),o.remove(i.name)}},"eliminar")],children:ge.jsx(W.Item.Meta,{description:ge.jsx(L.Item,{name:i.name,rules:[Ae.required()],className:"mb-0",children:ge.jsx(F,{placeholder:"Ingresar la dirección",onChange:function(n){1===e.length&&r.setFieldValue("address",n.target.value)}})})})})}})]})}})},He=function(){var e=r(!1),n=e[0],t=e[1],o=Z(n?"/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,Ce(e).get(e)];case 1:return[2,r.sent().data.etiquetas]}}))}))})).data,i=void 0===o?[]:o;return ge.jsx(L.Item,{name:"etiquetas",label:"Etiqueta",children:ge.jsx(M,{options:i.map((function(e){return{label:e,value:e}})),placeholder:"Ingresar o seleccionar una etiqueta",onFocus:function(){return t(!0)}})})},Je=s((function(e,r){var t,o,i=u(),s=De().hasModule,c=Be({endpoint:"/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=Z("08"===d?"/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,Ce(e).get(e)];case 1:return[2,r.sent().data.PaisesParaisosFiscales.map((function(e){return{label:e.description,value:parseInt(e.id)}}))]}}))}))})).data,h=a((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(i.query)),n=r.name,t=r.idType,o=r.identificador;t&&o&&n&&e.type}),[i.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:[Ae.required()],children:ge.jsx(B,{options:null===(t=c.options.TiposDeIdentificacion)||void 0===t?void 0:t.map((function(e){return{label:e.description,value:e.id}}))})}),ge.jsx(Ye,{name:"id",campoNombre:"name",type:h,rules:[Ae.required()]}),ge.jsx(L.Item,{name:"name",label:"Nombres / Razón social",rules:[Ae.required()],children:ge.jsx(F,{placeholder:"Ingresar la razón social"})}),ge.jsx(L.Item,{name:"subjectType",label:"Tipo de sujeto",rules:[Ae.required()],children:ge.jsx(B,{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(F,{type:"phone",placeholder:"Ingresar el teléfono 1"})}),f?ge.jsx(L.Item,{name:"cellphone",label:"Télefono 2",children:ge.jsx(F,{type:"phone",placeholder:"Ingresar el teléfono 2"})}):null,ge.jsx(L.Item,{name:"email",label:"Correo electrónico",rules:[Ae.email()],normalize:function(e){return e.trim()},children:ge.jsx(F,{placeholder:"Ingresar el correo electrónico"})}),!m&&ge.jsx(L.Item,{name:"optionalEmail",label:"Correos electrónicos alternativos",rules:[Ae.correos()],children:ge.jsx(B,{mode:"tags",placeholder:"Ingresar uno o varios correos alternativos",open:!1,suffixIcon:null})})]}),ge.jsx(L.Item,{name:"address",className:"hidden",children:ge.jsx(F,{})}),!m&&ge.jsx(Ve,{form:c.form}),ge.jsx(T.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(Xe,{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:[Ae.required()],children:ge.jsx(B,{mode:"tags",placeholder:"Ingresar una o varias placas",open:!1,suffixIcon:null})}):null,f?ge.jsxs(ge.Fragment,{children:[ge.jsx(Xe,{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(B,{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(He,{})]}):null]}),ge.jsx("div",{className:"mb-5",children:ge.jsx(We,{name:"informacionAdicional",autocompletar:!0})}),e.ocultarBotones?null:c.BotonesPorDefecto]})):c.ModoCarga})),Ke=function(e){var r=i(e.options),n=a((function(){return function(e){switch(e.tipo){case"mesas":return{label:"Mesa",endpoint:"/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:"/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:"/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:"/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(Je,{ref:e.ref,type:"client",ocultarBotones:!0})}}}}}({opciones:r,tipo:e.tipo})}),[e.tipo]),t=Z(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,Ce(n.endpoint).get(e)];case 1:return[2,r.sent().data]}}))}))}),{revalidateOnFocus:!1}).data;return t&&(r.current=t),n},Qe=function(e){var t=ke().message,o=De().getPermisos,s=e.values.customDocumentId||"_id",l=Ce(e.values.endpoint),c=r(!1),u=c[0],d=c[1],f=r(),p=f[0],m=f[1],v=r(!1),g=v[0],b=v[1],x=r(!1),j=x[0],w=x[1],S=i(!1),k=r(""),I=k[0],C=k[1],N=i(null),O=!0===e.canCreate&&!!e.values.modal,P=a((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]),E=Z(u?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,l.get(e)];case 1:return[2,r.sent().data.data]}}))}))}),{keepPreviousData:!0}),R=E.data,_=void 0===R?[]:R,D=E.isLoading;E.mutate;var L=a((function(){switch(e.type){case"clients":case"providers":case"transporters":return o("/administrative/".concat(e.type))}}),[e.type]);n((function(){if(!A&&void 0!==p){var e=setTimeout((function(){C(p),d(!0)}),500);return function(){return clearTimeout(e)}}}),[p]);var q=a((function(){return _.map((function(r){var n,t,o=Ee(r,s),i=e.values.title(r),a=null===(t=(n=e.values).subtitle)||void 0===t?void 0:t.call(n,r);return{key:o,value:o,texto:a,item:r,label:ge.jsxs("div",{children:[ge.jsxs("div",{children:[ge.jsx("b",{className:"mr-1",children:i}),e.value===o?ge.jsx(h,{twoToneColor:"#52c41a"}):void 0]}),a?ge.jsx("div",{className:"text-wrap",children:a}):null]})}}))||[]}),[e.value,_]),A=a((function(){if(e.value)return _.find((function(r){return Ee(r,s)===e.value}))}),[e.value,_]),$=a((function(){return!0===D?ge.jsx(y,{}):A&&!e.llenarCuandoTipea?ge.jsx(h,{twoToneColor:"#52c41a"}):ge.jsx("span",{})}),[D,A]);return n((function(){e.value&&d(!0)}),[e.value]),n((function(){var r,n;if(A){var t=Ee(A,e.values.field),o=null===(r=e.values.formItemTexto||e.values.subtitle)||void 0===r?void 0:r(A);e.onSetTextoExtra(o||""),m(t),d(!1)}else e.onSetTextoExtra("");!0===S.current&&(null===(n=e.onSelect)||void 0===n||n.call(e,A||null))}),[A]),n((function(){var e=setTimeout((function(){S.current=!0}),1e3);return function(){return clearTimeout(e)}}),[]),ge.jsxs(ge.Fragment,{children:[O?ge.jsx(V,{title:e.values.modal.title,open:g,width:720,zIndex:1100,maskClosable:!1,styles:{body:{padding:0}},confirmLoading:j,onOk:function(){return ue(void 0,void 0,void 0,(function(){var r,n,o,i,a,s;return de(this,(function(l){switch(l.label){case 0:r=N.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 w(!0),i=n.getFieldsValue(),[4,o(i,{noRedirect:!0})];case 5:return a=l.sent(),w(!1),a?(n.resetFields(),null===(s=e.onChange)||void 0===s||s.call(e,a._id),b(!1),[2]):[2]}}))}))},onCancel:function(){return b(!1)},children:e.values.modal.componente({ref:N})}):null,ge.jsx(M,{options:q,value:p,dropdownRender:function(e){return ge.jsxs(ge.Fragment,{children:[O&&(null==L?void 0:L.escribir)?ge.jsxs(ge.Fragment,{children:[ge.jsx(T.Link,{className:"block px-3 py-1",onClick:function(){b(!0)},children:"Añadir nuevo"}),ge.jsx(H,{className:"!m-0"})]}):null,e]})},notFoundContent:"Sin resultados",disabled:e.disabled,onFocus:function(){e.value||d(!0)},onSelect:function(r){var n;d(!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)),m(r)},children:ge.jsx(F,{placeholder:e.values.placeholder,suffix:$})})]})};Qe.displayName="BuscadorSeeker";var Xe=function(e){var n=r(""),t=n[0],o=n[1],i=Ke({tipo:e.type,options:void 0});return i?ge.jsx(L.Item,{name:e.name,label:null===e.label?void 0:e.label||i.label,extra:e.hideMessage?void 0:t,rules:e.required?[Ae.required()]:[{}],className:e.classNameFormItem,children:ge.jsx(Qe,{type:e.type,canCreate:e.canCreate,values:i,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};Xe.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(J,{title:"Bitácora",placement:"right",closable:!1,open:0!==e.bitacora.length,onClose:function(){return e.setBitacora([])},children:ge.jsx(K,{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(I,{})};case"sent":return{color:"#1890FF",icon:ge.jsx(k,{})};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",{}),Ue.completeDate(e.date)]})}}))})})},nr="#F34D24",tr=function(e){var t=r(!1),o=t[0],i=t[1];return n((function(){i(!0)}),[]),o?ge.jsx(er,{children:ge.jsx(Q,{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(X,{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),i=o[0],s=o[1],l=a((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:i,children:e.usarIcono?ge.jsx(O,{title:"Ver historial",className:l?"":"text-gray-300 cursor-not-allowed",onClick:c}):ge.jsx(R,{icon:ge.jsx(O,{}),title:"Ver historial",disabled:!l,onClick:c})})},ir=function(){return{hora:(new Date).toLocaleTimeString(),fecha:(new Date).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"})}},ar=function(e){var t=r(ir()),o=t[0],i=t[1];return n((function(){var e=setInterval((function(){return i(ir())}),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(!0),t=n[0],o=n[1],i=r(!1),a=i[0],s=i[1];return ge.jsxs(ge.Fragment,{children:[e.sidebar?ge.jsxs(X.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(X,{className:a||t?"ml-0":"ml-[230px]",onClick:!t&&a?function(e){e.stopPropagation(),e.preventDefault(),o(!0)}:void 0,children:[e.navbar?ge.jsx(X.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(R,{type:"text",icon:t?ge.jsx(P,{}):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(X.Content,{className:"m-4 md:m-8 xl:mx-16 xl:my-8",children:e.children}),e.footer?ge.jsx(X.Footer,{className:"!text-gray-500",children:e.footer}):null]})]})};export{Ue as $filtros,Ae as $reglas,ze as BotonConfirmacion,or as BotonMovimientos,Le as ContextoEmpresa,Je as FormularioPersonas,xe as Header,Ye as IdentificadorPersona,sr as LayoutBase,ar as Reloj,Xe as Seeker,tr as TemaPrincipal,we as configurarUtils,Ne as crearToken,Oe as destruirToken,Pe as getApiEndpoint,Ce as getAxios,Ee as getNestedPath,Fe as hashear,Te as nDecimals,Re as redireccionarLogin,De as useContextoEmpresa,Ze as useFrontendUtils,ke as useUtils,Be as useVistaInsertar,Me as useVistaPrincipal};
|
|
11
11
|
//# sourceMappingURL=index.js.map
|