upconta.frontend-utils 2.1.1 → 2.2.0

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