UNPKG

crontab-react

Version:
28 lines (24 loc) 22.4 kB
(function(L,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("react"),require("react-select"),require("prop-types")):typeof define=="function"&&define.amd?define(["exports","react","react-select","prop-types"],O):(L=typeof globalThis<"u"?globalThis:L||self,O(L.CrontabReact={},L.React,L.Select,L.PropTypes))})(this,function(L,O,G,Z){"use strict";var he={exports:{}},Q={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Re;function Qe(){if(Re)return Q;Re=1;var g=O,y=Symbol.for("react.element"),j=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,S=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,M={key:!0,ref:!0,__self:!0,__source:!0};function I(Y,l,k){var w,A={},x=null,H=null;k!==void 0&&(x=""+k),l.key!==void 0&&(x=""+l.key),l.ref!==void 0&&(H=l.ref);for(w in l)E.call(l,w)&&!M.hasOwnProperty(w)&&(A[w]=l[w]);if(Y&&Y.defaultProps)for(w in l=Y.defaultProps,l)A[w]===void 0&&(A[w]=l[w]);return{$$typeof:y,type:Y,key:x,ref:H,props:A,_owner:S.current}}return Q.Fragment=j,Q.jsx=I,Q.jsxs=I,Q}var q={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ce;function qe(){return Ce||(Ce=1,process.env.NODE_ENV!=="production"&&function(){var g=O,y=Symbol.for("react.element"),j=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),Y=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),H=Symbol.for("react.offscreen"),B=Symbol.iterator,U="@@iterator";function ee(e){if(e===null||typeof e!="object")return null;var r=B&&e[B]||e[U];return typeof r=="function"?r:null}var W=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function T(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),s=1;s<r;s++)t[s-1]=arguments[s];J("error",e,t)}}function J(e,r,t){{var s=W.ReactDebugCurrentFrame,f=s.getStackAddendum();f!==""&&(r+="%s",t=t.concat([f]));var h=t.map(function(u){return String(u)});h.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,h)}}var re=!1,se=!1,pe=!1,le=!1,ie=!1,te;te=Symbol.for("react.module.reference");function ye(e){return!!(typeof e=="string"||typeof e=="function"||e===E||e===M||ie||e===S||e===k||e===w||le||e===H||re||se||pe||typeof e=="object"&&e!==null&&(e.$$typeof===x||e.$$typeof===A||e.$$typeof===I||e.$$typeof===Y||e.$$typeof===l||e.$$typeof===te||e.getModuleId!==void 0))}function n(e,r,t){var s=e.displayName;if(s)return s;var f=r.displayName||r.name||"";return f!==""?t+"("+f+")":t}function a(e){return e.displayName||"Context"}function o(e){if(e==null)return null;if(typeof e.tag=="number"&&T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case j:return"Portal";case M:return"Profiler";case S:return"StrictMode";case k:return"Suspense";case w:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Y:var r=e;return a(r)+".Consumer";case I:var t=e;return a(t._context)+".Provider";case l:return n(e,e.render,"ForwardRef");case A:var s=e.displayName||null;return s!==null?s:o(e.type)||"Memo";case x:{var f=e,h=f._payload,u=f._init;try{return o(u(h))}catch{return null}}}return null}var c=Object.assign,v=0,p,R,_,C,V,F,z;function ne(){}ne.__reactDisabledLog=!0;function tr(){{if(v===0){p=console.log,R=console.info,_=console.warn,C=console.error,V=console.group,F=console.groupCollapsed,z=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ne,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}v++}}function nr(){{if(v--,v===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:c({},e,{value:p}),info:c({},e,{value:R}),warn:c({},e,{value:_}),error:c({},e,{value:C}),group:c({},e,{value:V}),groupCollapsed:c({},e,{value:F}),groupEnd:c({},e,{value:z})})}v<0&&T("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var me=W.ReactCurrentDispatcher,ge;function ue(e,r,t){{if(ge===void 0)try{throw Error()}catch(f){var s=f.stack.trim().match(/\n( *(at )?)/);ge=s&&s[1]||""}return` `+ge+e}}var be=!1,ce;{var ar=typeof WeakMap=="function"?WeakMap:Map;ce=new ar}function Ne(e,r){if(!e||be)return"";{var t=ce.get(e);if(t!==void 0)return t}var s;be=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var h;h=me.current,me.current=null,tr();try{if(r){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch($){s=$}Reflect.construct(e,[],u)}else{try{u.call()}catch($){s=$}e.call(u.prototype)}}else{try{throw Error()}catch($){s=$}e()}}catch($){if($&&s&&typeof $.stack=="string"){for(var i=$.stack.split(` `),P=s.stack.split(` `),m=i.length-1,b=P.length-1;m>=1&&b>=0&&i[m]!==P[b];)b--;for(;m>=1&&b>=0;m--,b--)if(i[m]!==P[b]){if(m!==1||b!==1)do if(m--,b--,b<0||i[m]!==P[b]){var N=` `+i[m].replace(" at new "," at ");return e.displayName&&N.includes("<anonymous>")&&(N=N.replace("<anonymous>",e.displayName)),typeof e=="function"&&ce.set(e,N),N}while(m>=1&&b>=0);break}}}finally{be=!1,me.current=h,nr(),Error.prepareStackTrace=f}var X=e?e.displayName||e.name:"",Ze=X?ue(X):"";return typeof e=="function"&&ce.set(e,Ze),Ze}function or(e,r,t){return Ne(e,!1)}function sr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function fe(e,r,t){if(e==null)return"";if(typeof e=="function")return Ne(e,sr(e));if(typeof e=="string")return ue(e);switch(e){case k:return ue("Suspense");case w:return ue("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case l:return or(e.render);case A:return fe(e.type,r,t);case x:{var s=e,f=s._payload,h=s._init;try{return fe(h(f),r,t)}catch{}}}return""}var de=Object.prototype.hasOwnProperty,Ve={},Le=W.ReactDebugCurrentFrame;function ve(e){if(e){var r=e._owner,t=fe(e.type,e._source,r?r.type:null);Le.setExtraStackFrame(t)}else Le.setExtraStackFrame(null)}function lr(e,r,t,s,f){{var h=Function.call.bind(de);for(var u in e)if(h(e,u)){var i=void 0;try{if(typeof e[u]!="function"){var P=Error((s||"React class")+": "+t+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw P.name="Invariant Violation",P}i=e[u](r,u,s,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(m){i=m}i&&!(i instanceof Error)&&(ve(f),T("%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).",s||"React class",t,u,typeof i),ve(null)),i instanceof Error&&!(i.message in Ve)&&(Ve[i.message]=!0,ve(f),T("Failed %s type: %s",t,i.message),ve(null))}}}var ir=Array.isArray;function Oe(e){return ir(e)}function ur(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function cr(e){try{return Ye(e),!1}catch{return!0}}function Ye(e){return""+e}function Ue(e){if(cr(e))return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ur(e)),Ye(e)}var ae=W.ReactCurrentOwner,fr={key:!0,ref:!0,__self:!0,__source:!0},$e,Be,Ee;Ee={};function dr(e){if(de.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function vr(e){if(de.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function hr(e,r){if(typeof e.ref=="string"&&ae.current&&r&&ae.current.stateNode!==r){var t=o(ae.current.type);Ee[t]||(T('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',o(ae.current.type),e.ref),Ee[t]=!0)}}function pr(e,r){{var t=function(){$e||($e=!0,T("%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))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function yr(e,r){{var t=function(){Be||(Be=!0,T("%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))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var mr=function(e,r,t,s,f,h,u){var i={$$typeof:y,type:e,key:r,ref:t,props:u,_owner:h};return i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:f}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function gr(e,r,t,s,f){{var h,u={},i=null,P=null;t!==void 0&&(Ue(t),i=""+t),vr(r)&&(Ue(r.key),i=""+r.key),dr(r)&&(P=r.ref,hr(r,f));for(h in r)de.call(r,h)&&!fr.hasOwnProperty(h)&&(u[h]=r[h]);if(e&&e.defaultProps){var m=e.defaultProps;for(h in m)u[h]===void 0&&(u[h]=m[h])}if(i||P){var b=typeof e=="function"?e.displayName||e.name||"Unknown":e;i&&pr(u,b),P&&yr(u,b)}return mr(e,i,P,f,s,ae.current,u)}}var Te=W.ReactCurrentOwner,He=W.ReactDebugCurrentFrame;function K(e){if(e){var r=e._owner,t=fe(e.type,e._source,r?r.type:null);He.setExtraStackFrame(t)}else He.setExtraStackFrame(null)}var _e;_e=!1;function Se(e){return typeof e=="object"&&e!==null&&e.$$typeof===y}function Je(){{if(Te.current){var e=o(Te.current.type);if(e)return` Check the render method of \``+e+"`."}return""}}function br(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return` Check your code at `+r+":"+t+"."}return""}}var Ge={};function Or(e){{var r=Je();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=` Check the top-level render call using <`+t+">.")}return r}}function ze(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=Or(r);if(Ge[t])return;Ge[t]=!0;var s="";e&&e._owner&&e._owner!==Te.current&&(s=" It was passed a child from "+o(e._owner.type)+"."),K(e),T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,s),K(null)}}function Ke(e,r){{if(typeof e!="object")return;if(Oe(e))for(var t=0;t<e.length;t++){var s=e[t];Se(s)&&ze(s,r)}else if(Se(e))e._store&&(e._store.validated=!0);else if(e){var f=ee(e);if(typeof f=="function"&&f!==e.entries)for(var h=f.call(e),u;!(u=h.next()).done;)Se(u.value)&&ze(u.value,r)}}}function Er(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===l||r.$$typeof===A))t=r.propTypes;else return;if(t){var s=o(r);lr(t,e.props,"prop",s,e)}else if(r.PropTypes!==void 0&&!_e){_e=!0;var f=o(r);T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",f||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var s=r[t];if(s!=="children"&&s!=="key"){K(e),T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",s),K(null);break}}e.ref!==null&&(K(e),T("Invalid attribute `ref` supplied to `React.Fragment`."),K(null))}}function Xe(e,r,t,s,f,h){{var u=ye(e);if(!u){var i="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(i+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var P=br(f);P?i+=P:i+=Je();var m;e===null?m="null":Oe(e)?m="array":e!==void 0&&e.$$typeof===y?(m="<"+(o(e.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):m=typeof e,T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",m,i)}var b=gr(e,r,t,f,h);if(b==null)return b;if(u){var N=r.children;if(N!==void 0)if(s)if(Oe(N)){for(var X=0;X<N.length;X++)Ke(N[X],e);Object.freeze&&Object.freeze(N)}else T("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 Ke(N,e)}return e===E?Tr(b):Er(b),b}}function _r(e,r,t){return Xe(e,r,t,!0)}function Sr(e,r,t){return Xe(e,r,t,!1)}var Rr=Sr,Cr=_r;q.Fragment=E,q.jsx=Rr,q.jsxs=Cr}()),q}process.env.NODE_ENV==="production"?he.exports=Qe():he.exports=qe();var d=he.exports;const jr="";function je(g){let y=[],j=g[0],E=g[0];for(let S=1;S<g.length;S++)g[S]-g[S-1]===1||(y.push(j!==E?`${j}-${E}`:`${j}`),j=g[S]),E=g[S];return y.push(j!==E?`${j}-${E}`:`${j}`),y.join(",")}const ke=(g,y,j)=>Array.from({length:(y-g)/j+1},(E,S)=>g+S*j),er=[{value:"year",label:"Year"},{value:"month",label:"Month"},{value:"week",label:"Week"},{value:"day",label:"Day"},{value:"hour",label:"Hour"},{value:"minute",label:"Minute"}],we=[{value:1,label:"January"},{value:2,label:"February"},{value:3,label:"March"},{value:4,label:"April"},{value:5,label:"May"},{value:6,label:"June"},{value:7,label:"July"},{value:8,label:"August"},{value:9,label:"September"},{value:10,label:"October"},{value:11,label:"November"},{value:12,label:"December"}],xe=new Array(32).fill(1,1).map((g,y)=>({value:y,label:y.toString()})),Pe=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:2,label:"Tuesday"},{value:3,label:"Wednesday"},{value:4,label:"Thursday"},{value:5,label:"Friday"},{value:6,label:"Saturday"}],Me=new Array(24).fill(1).map((g,y)=>({value:y,label:y.toString()})),Fe=new Array(60).fill(1).map((g,y)=>({value:y,label:y.toString()})),Ae={minutes:"*",hours:"*",months:"*",daysOfTheMonth:"*",daysOfTheWeek:"*"},rr=/[a-z]/i,D={minutes:[],hours:[],months:[],daysOfTheMonth:[],daysOfTheWeek:[]},We={0:"minutes",1:"hours",2:"daysOfTheMonth",3:"months",4:"daysOfTheWeek"},De={0:Fe,1:Me,2:xe,3:we,4:Pe},Ie="* * * * *";function oe(g){const{shortSelectedOptions:y=!0,invalidCronStringErrorMessage:j="",value:E="",onChange:S=()=>{},disabled:M=!1}=g,[I,Y]=O.useState({value:"minute",label:"Minute"}),[l,k]=O.useState(Ae),[w,A]=O.useState(E||Ie);O.useState(""),O.useState(""),O.useState(""),O.useState(""),O.useState("");const[x,H]=O.useState({}),[B,U]=O.useState(D);O.useEffect(()=>{A(`${l.minutes} ${l.hours} ${l.daysOfTheMonth} ${l.months} ${l.daysOfTheWeek}`)},[l]),O.useEffect(()=>{S&&S({value:`${l.minutes} ${l.hours} ${l.daysOfTheMonth} ${l.months} ${l.daysOfTheWeek}`,error:!!x.cronString,minutes:l.minutes,hours:l.hours,daysOfTheMonth:l.daysOfTheMonth,months:l.months,daysOfTheWeek:l.daysOfTheWeek})},[x,l.months,l.minutes,l.hours,l.daysOfTheWeek,l.daysOfTheMonth]),O.useEffect(()=>{E&&(A(E),te(E))},[]);const ee=(n="transparent")=>({alignItems:"center",display:"flex",":before":{backgroundColor:n,borderRadius:10,content:'" "',display:"block",marginRight:8,height:10,width:10}}),W={control:n=>({...n,backgroundColor:"white"}),option:(n,{data:a,isDisabled:o,isFocused:c,isSelected:v})=>({...n,backgroundColor:o?void 0:v?"#E9F5FF ":c?"#f2f2f2":void 0,color:o?"#ccc":"black",cursor:o?"not-allowed":"default",":active":{...n[":active"],backgroundColor:o?void 0:v?"#1e99fa":"grey"}}),input:n=>({...n,...ee()}),placeholder:n=>({...n,...ee("#ccc")}),singleValue:(n,{data:a})=>({...n,...ee("grey")}),multiValueRemove:(n,{data:a})=>({...n,color:"#666"})},T=({value:n,label:a},{context:o})=>o==="menu"?d.jsx("div",{style:{display:"flex"},children:d.jsx("div",{style:{marginLeft:"4px"},children:a})}):d.jsx("div",{style:{display:"flex"},children:d.jsx("div",{style:{marginLeft:"4px"},children:a.substring(0,3)})}),J=(n,a)=>{if(n.length>0){const c=[...n].sort((p,R)=>p.value-R.value).map(p=>p.value),v=je(c);U(p=>({...p,[a]:n})),k(p=>({...p,[a]:v}))}else U(o=>({...o,[a]:"*"})),k(o=>({...o,[a]:"*"}))},re=(n,a)=>a===0?n.every(o=>o>=0&&o<=59):a===1?n.every(o=>o>=0&&o<=23):a===2?n.every(o=>o>=1&&o<=31):a===3?n.every(o=>o>=1&&o<=12):a===4?n.every(o=>o>=0&&o<=6):!1,se=(n,a)=>{const o=n.split("-"),c=Number(o[0]),v=Number(o[1]);if(o.length!==2)return!1;if(c===""||v==="")return!1;if(c>=v)return!1;const p=ke(c,v,1);return re(p,a)},pe=n=>{if(n===Ie)return!0;if(rr.test(n))return!1;const a=n.split(" ");return a.length!==5?!1:a.every((c,v)=>c.includes(",")?c.split(",").every(R=>R.includes("-")?se(R,v):re([R],v)):c.includes("-")?se(c,v):c==="*"?!0:re([c],v))},le=(n,a)=>{const o=n.split("-"),c=ke(Number(o[0]),Number(o[1]),1),v=De[a].filter(_=>c.includes(_.value)),p=v.map(_=>_.value),R=je(p);return{selectedOptions:v,cronStringForField:R}},ie=(n,a)=>De[a].filter(c=>c.value===Number(n)),te=n=>{const a=n.trim();if(!pe(a)){H({...x,cronString:j||"Crontab String is Invalid"});return}H({...x,cronString:void 0});const c=a.split(" ");let v={value:"minute",label:"Minute"};c.forEach((p,R)=>{let _=[],C="";if(p.includes(","))p.split(",").forEach(F=>{if(F.includes("-")){const{selectedOptions:z,cronStringForField:ne}=le(F,R);_=[..._,...z],C=C?`${C},${ne}`:ne}else{if(F==="*"||F!=="0"&&!Number(F))return;const z=ie(F,R);_=[..._,...z],C=C?`${C},${F}`:F}});else if(p.includes("-")){const{selectedOptions:V,cronStringForField:F}=le(p,R);_=[..._,...V],C=C?`${C},${F}`:F}else if(p==="*")_=[..._],C="*";else if(Number(p)||Number(p)===0){const V=ie(p,R);_=[..._,...V],C=C?`${C},${p}`:p}else return;U(V=>({...V,[We[R]]:_})),k(V=>({...V,[We[R]]:C}))}),c[3]!=="*"?v={value:"year",label:"Year"}:c[2]!=="*"?v={value:"month",label:"Month"}:c[4]!=="*"?v={value:"week",label:"Week"}:c[1]!=="*"?v={value:"day",label:"Day"}:c[0]!=="*"&&(v={value:"hour",label:"Hour"}),Y(v)},ye=n=>{Y(n),n.value==="minute"?(k(Ae),U(D)):n.value==="month"?(k(a=>({...a,months:"*"})),U(a=>({...a,months:D.months}))):n.value==="week"?(k(a=>({...a,months:"*",daysOfTheWeek:"*"})),U(a=>({...a,months:D.months,daysOfTheWeek:D.daysOfTheWeek}))):n.value==="day"?(k(a=>({...a,months:"*",daysOfTheWeek:"*",daysOfTheMonth:"*"})),U(a=>({...a,months:D.months,daysOfTheWeek:D.daysOfTheWeek,daysOfTheMonth:D.daysOfTheMonth}))):n.value==="hour"&&(k(a=>({...a,months:"*",daysOfTheWeek:"*",daysOfTheMonth:"*",hours:"*"})),U(a=>({...a,months:D.months,daysOfTheWeek:D.daysOfTheWeek,daysOfTheMonth:D.daysOfTheMonth,hours:D.hours})))};return d.jsxs("div",{className:"cr cr-container",children:[d.jsx("input",{type:"text",value:w,className:`cr-container-cron-input ${x.cronString&&"cr-has-error"}`,onChange:n=>{M||A(n.target.value)},onBlur:n=>{M||te(n.target.value)},style:{width:"400px"},disabled:M}),x.cronString&&d.jsx("span",{className:"cr-error-text",children:x.cronString}),d.jsxs("div",{className:"cr-container-field",children:[d.jsx("span",{children:"Period"}),d.jsx(G,{options:er,onChange:ye,name:"period",value:I,styles:W,menuShouldScrollIntoView:!1,className:"cr-container-field-period",isDisabled:M})]}),["year"].includes(I.value)&&d.jsxs("div",{className:"cr-container-field cr-container-field-month",children:[d.jsx("span",{children:"Month"}),d.jsx(G,{options:we,onChange:n=>J(n,"months"),name:"months",styles:W,isMulti:!0,delimiter:",",menuShouldScrollIntoView:!1,placeholder:d.jsx("div",{children:"Every month"}),cropWithEllipsis:!0,closeMenuOnSelect:!1,value:B.months,...y?{formatOptionLabel:T}:{},isDisabled:M})]}),["year","month"].includes(I.value)&&d.jsxs("div",{className:"cr-container-field",children:[d.jsx("span",{children:"Days of the Month"}),d.jsx(G,{options:xe,onChange:n=>J(n,"daysOfTheMonth"),styles:W,menuShouldScrollIntoView:!1,isMulti:!0,name:"daysOfTheMonth",placeholder:d.jsx("div",{children:"Every day of the month"}),value:B.daysOfTheMonth,closeMenuOnSelect:!1,isDisabled:M})]}),["year","month","week"].includes(I.value)&&d.jsxs("div",{className:"cr-container-field",children:[d.jsx("span",{children:"Days of the Week"}),d.jsx(G,{options:Pe,onChange:n=>J(n,"daysOfTheWeek"),name:"daysOfTheWeek",styles:W,menuShouldScrollIntoView:!1,isMulti:!0,placeholder:d.jsx("div",{children:"Every day of the week"}),value:B.daysOfTheWeek,closeMenuOnSelect:!1,...y?{formatOptionLabel:T}:{},isDisabled:M})]}),["year","month","week","day"].includes(I.value)&&d.jsxs("div",{className:"cr-container-field",children:[d.jsx("span",{children:"Hour"}),d.jsx(G,{options:Me,onChange:n=>J(n,"hours"),name:"hours",styles:W,menuShouldScrollIntoView:!1,isMulti:!0,placeholder:d.jsx("div",{children:"Every Hour"}),value:B.hours,closeMenuOnSelect:!1,isDisabled:M})]}),["year","month","week","day","hour"].includes(I.value)&&d.jsxs("div",{className:"cr-container-field",children:[d.jsx("span",{children:"Minutes"}),d.jsx(G,{options:Fe,onChange:n=>J(n,"minutes"),name:"minutes",styles:W,menuShouldScrollIntoView:!1,isMulti:!0,placeholder:d.jsx("div",{children:"Every Minute"}),value:B.minutes,closeMenuOnSelect:!1,isDisabled:M})]})]})}oe.propTypes={value:Z.string,invalidCronStringErrorMessage:Z.string,shortSelectedOptions:Z.bool,onChange:Z.func,disabled:Z.bool},oe.defaultProps={value:"",invalidCronStringErrorMessage:"",shortSelectedOptions:!0,onChange:()=>{},disabled:!1},L.Crontab=oe,L.default=oe,Object.defineProperties(L,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});