bs-ad-calendar-react 1.0.1

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.
@@ -0,0 +1,14 @@
1
+ (function(R,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],O):(R=typeof globalThis<"u"?globalThis:R||self,O(R.BSADCalendar={},R.React))})(this,(function(R,O){"use strict";var Ce={exports:{}},_e={};var nt;function gn(){if(nt)return _e;nt=1;var t=O,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function c(l,u,d){var h,y={},m=null,T=null;d!==void 0&&(m=""+d),u.key!==void 0&&(m=""+u.key),u.ref!==void 0&&(T=u.ref);for(h in u)a.call(u,h)&&!o.hasOwnProperty(h)&&(y[h]=u[h]);if(l&&l.defaultProps)for(h in u=l.defaultProps,u)y[h]===void 0&&(y[h]=u[h]);return{$$typeof:e,type:l,key:m,ref:T,props:y,_owner:s.current}}return _e.Fragment=r,_e.jsx=c,_e.jsxs=c,_e}var we={};var rt;function mn(){return rt||(rt=1,process.env.NODE_ENV!=="production"&&(function(){var t=O,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),v=Symbol.iterator,$="@@iterator";function Z(n){if(n===null||typeof n!="object")return null;var i=v&&n[v]||n[$];return typeof i=="function"?i:null}var _=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function k(n){{for(var i=arguments.length,f=new Array(i>1?i-1:0),p=1;p<i;p++)f[p-1]=arguments[p];I("error",n,f)}}function I(n,i,f){{var p=_.ReactDebugCurrentFrame,M=p.getStackAddendum();M!==""&&(i+="%s",f=f.concat([M]));var C=f.map(function(S){return String(S)});C.unshift("Warning: "+i),Function.prototype.apply.call(console[n],console,C)}}var A=!1,se=!1,E=!1,j=!1,le=!1,B;B=Symbol.for("react.module.reference");function oe(n){return!!(typeof n=="string"||typeof n=="function"||n===a||n===o||le||n===s||n===d||n===h||j||n===T||A||se||E||typeof n=="object"&&n!==null&&(n.$$typeof===m||n.$$typeof===y||n.$$typeof===c||n.$$typeof===l||n.$$typeof===u||n.$$typeof===B||n.getModuleId!==void 0))}function N(n,i,f){var p=n.displayName;if(p)return p;var M=i.displayName||i.name||"";return M!==""?f+"("+M+")":f}function G(n){return n.displayName||"Context"}function J(n){if(n==null)return null;if(typeof n.tag=="number"&&k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case a:return"Fragment";case r:return"Portal";case o:return"Profiler";case s:return"StrictMode";case d:return"Suspense";case h:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case l:var i=n;return G(i)+".Consumer";case c:var f=n;return G(f._context)+".Provider";case u:return N(n,n.render,"ForwardRef");case y:var p=n.displayName||null;return p!==null?p:J(n.type)||"Memo";case m:{var M=n,C=M._payload,S=M._init;try{return J(S(C))}catch{return null}}}return null}var q=Object.assign,Q=0,pe,ye,U,ve,be,De,ke;function Se(){}Se.__reactDisabledLog=!0;function Ge(){{if(Q===0){pe=console.log,ye=console.info,U=console.warn,ve=console.error,be=console.group,De=console.groupCollapsed,ke=console.groupEnd;var n={configurable:!0,enumerable:!0,value:Se,writable:!0};Object.defineProperties(console,{info:n,log:n,warn:n,error:n,group:n,groupCollapsed:n,groupEnd:n})}Q++}}function Ie(){{if(Q--,Q===0){var n={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:q({},n,{value:pe}),info:q({},n,{value:ye}),warn:q({},n,{value:U}),error:q({},n,{value:ve}),group:q({},n,{value:be}),groupCollapsed:q({},n,{value:De}),groupEnd:q({},n,{value:ke})})}Q<0&&k("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ie=_.ReactCurrentDispatcher,de;function he(n,i,f){{if(de===void 0)try{throw Error()}catch(M){var p=M.stack.trim().match(/\n( *(at )?)/);de=p&&p[1]||""}return`
2
+ `+de+n}}var xe=!1,ue;{var Je=typeof WeakMap=="function"?WeakMap:Map;ue=new Je}function qe(n,i){if(!n||xe)return"";{var f=ue.get(n);if(f!==void 0)return f}var p;xe=!0;var M=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var C;C=ie.current,ie.current=null,Ge();try{if(i){var S=function(){throw Error()};if(Object.defineProperty(S.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(S,[])}catch(V){p=V}Reflect.construct(n,[],S)}else{try{S.call()}catch(V){p=V}n.call(S.prototype)}}else{try{throw Error()}catch(V){p=V}n()}}catch(V){if(V&&p&&typeof V.stack=="string"){for(var D=V.stack.split(`
3
+ `),L=p.stack.split(`
4
+ `),P=D.length-1,F=L.length-1;P>=1&&F>=0&&D[P]!==L[F];)F--;for(;P>=1&&F>=0;P--,F--)if(D[P]!==L[F]){if(P!==1||F!==1)do if(P--,F--,F<0||D[P]!==L[F]){var z=`
5
+ `+D[P].replace(" at new "," at ");return n.displayName&&z.includes("<anonymous>")&&(z=z.replace("<anonymous>",n.displayName)),typeof n=="function"&&ue.set(n,z),z}while(P>=1&&F>=0);break}}}finally{xe=!1,ie.current=C,Ie(),Error.prepareStackTrace=M}var Me=n?n.displayName||n.name:"",fe=Me?he(Me):"";return typeof n=="function"&&ue.set(n,fe),fe}function Ke(n,i,f){return qe(n,!1)}function b(n){var i=n.prototype;return!!(i&&i.isReactComponent)}function x(n,i,f){if(n==null)return"";if(typeof n=="function")return qe(n,b(n));if(typeof n=="string")return he(n);switch(n){case d:return he("Suspense");case h:return he("SuspenseList")}if(typeof n=="object")switch(n.$$typeof){case u:return Ke(n.render);case y:return x(n.type,i,f);case m:{var p=n,M=p._payload,C=p._init;try{return x(C(M),i,f)}catch{}}}return""}var K=Object.prototype.hasOwnProperty,ae={},ze=_.ReactDebugCurrentFrame;function Ne(n){if(n){var i=n._owner,f=x(n.type,n._source,i?i.type:null);ze.setExtraStackFrame(f)}else ze.setExtraStackFrame(null)}function pr(n,i,f,p,M){{var C=Function.call.bind(K);for(var S in n)if(C(n,S)){var D=void 0;try{if(typeof n[S]!="function"){var L=Error((p||"React class")+": "+f+" type `"+S+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof n[S]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw L.name="Invariant Violation",L}D=n[S](i,S,p,f,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(P){D=P}D&&!(D instanceof Error)&&(Ne(M),k("%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).",p||"React class",f,S,typeof D),Ne(null)),D instanceof Error&&!(D.message in ae)&&(ae[D.message]=!0,Ne(M),k("Failed %s type: %s",f,D.message),Ne(null))}}}var yr=Array.isArray;function Xe(n){return yr(n)}function vr(n){{var i=typeof Symbol=="function"&&Symbol.toStringTag,f=i&&n[Symbol.toStringTag]||n.constructor.name||"Object";return f}}function br(n){try{return tn(n),!1}catch{return!0}}function tn(n){return""+n}function nn(n){if(br(n))return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",vr(n)),tn(n)}var rn=_.ReactCurrentOwner,Dr={key:!0,ref:!0,__self:!0,__source:!0},an,sn;function Sr(n){if(K.call(n,"ref")){var i=Object.getOwnPropertyDescriptor(n,"ref").get;if(i&&i.isReactWarning)return!1}return n.ref!==void 0}function Er(n){if(K.call(n,"key")){var i=Object.getOwnPropertyDescriptor(n,"key").get;if(i&&i.isReactWarning)return!1}return n.key!==void 0}function Mr(n,i){typeof n.ref=="string"&&rn.current}function _r(n,i){{var f=function(){an||(an=!0,k("%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)",i))};f.isReactWarning=!0,Object.defineProperty(n,"key",{get:f,configurable:!0})}}function wr(n,i){{var f=function(){sn||(sn=!0,k("%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)",i))};f.isReactWarning=!0,Object.defineProperty(n,"ref",{get:f,configurable:!0})}}var kr=function(n,i,f,p,M,C,S){var D={$$typeof:e,type:n,key:i,ref:f,props:S,_owner:C};return D._store={},Object.defineProperty(D._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(D,"_self",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.defineProperty(D,"_source",{configurable:!1,enumerable:!1,writable:!1,value:M}),Object.freeze&&(Object.freeze(D.props),Object.freeze(D)),D};function xr(n,i,f,p,M){{var C,S={},D=null,L=null;f!==void 0&&(nn(f),D=""+f),Er(i)&&(nn(i.key),D=""+i.key),Sr(i)&&(L=i.ref,Mr(i,M));for(C in i)K.call(i,C)&&!Dr.hasOwnProperty(C)&&(S[C]=i[C]);if(n&&n.defaultProps){var P=n.defaultProps;for(C in P)S[C]===void 0&&(S[C]=P[C])}if(D||L){var F=typeof n=="function"?n.displayName||n.name||"Unknown":n;D&&_r(S,F),L&&wr(S,F)}return kr(n,D,L,M,p,rn.current,S)}}var Ze=_.ReactCurrentOwner,on=_.ReactDebugCurrentFrame;function Ee(n){if(n){var i=n._owner,f=x(n.type,n._source,i?i.type:null);on.setExtraStackFrame(f)}else on.setExtraStackFrame(null)}var Qe;Qe=!1;function et(n){return typeof n=="object"&&n!==null&&n.$$typeof===e}function un(){{if(Ze.current){var n=J(Ze.current.type);if(n)return`
6
+
7
+ Check the render method of \``+n+"`."}return""}}function Cr(n){return""}var cn={};function Rr(n){{var i=un();if(!i){var f=typeof n=="string"?n:n.displayName||n.name;f&&(i=`
8
+
9
+ Check the top-level render call using <`+f+">.")}return i}}function ln(n,i){{if(!n._store||n._store.validated||n.key!=null)return;n._store.validated=!0;var f=Rr(i);if(cn[f])return;cn[f]=!0;var p="";n&&n._owner&&n._owner!==Ze.current&&(p=" It was passed a child from "+J(n._owner.type)+"."),Ee(n),k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',f,p),Ee(null)}}function dn(n,i){{if(typeof n!="object")return;if(Xe(n))for(var f=0;f<n.length;f++){var p=n[f];et(p)&&ln(p,i)}else if(et(n))n._store&&(n._store.validated=!0);else if(n){var M=Z(n);if(typeof M=="function"&&M!==n.entries)for(var C=M.call(n),S;!(S=C.next()).done;)et(S.value)&&ln(S.value,i)}}}function Tr(n){{var i=n.type;if(i==null||typeof i=="string")return;var f;if(typeof i=="function")f=i.propTypes;else if(typeof i=="object"&&(i.$$typeof===u||i.$$typeof===y))f=i.propTypes;else return;if(f){var p=J(i);pr(f,n.props,"prop",p,n)}else if(i.PropTypes!==void 0&&!Qe){Qe=!0;var M=J(i);k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",M||"Unknown")}typeof i.getDefaultProps=="function"&&!i.getDefaultProps.isReactClassApproved&&k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function jr(n){{for(var i=Object.keys(n.props),f=0;f<i.length;f++){var p=i[f];if(p!=="children"&&p!=="key"){Ee(n),k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",p),Ee(null);break}}n.ref!==null&&(Ee(n),k("Invalid attribute `ref` supplied to `React.Fragment`."),Ee(null))}}var hn={};function fn(n,i,f,p,M,C){{var S=oe(n);if(!S){var D="";(n===void 0||typeof n=="object"&&n!==null&&Object.keys(n).length===0)&&(D+=" 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 L=Cr();L?D+=L:D+=un();var P;n===null?P="null":Xe(n)?P="array":n!==void 0&&n.$$typeof===e?(P="<"+(J(n.type)||"Unknown")+" />",D=" Did you accidentally export a JSX literal instead of a component?"):P=typeof n,k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,D)}var F=xr(n,i,f,M,C);if(F==null)return F;if(S){var z=i.children;if(z!==void 0)if(p)if(Xe(z)){for(var Me=0;Me<z.length;Me++)dn(z[Me],n);Object.freeze&&Object.freeze(z)}else k("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 dn(z,n)}if(K.call(i,"key")){var fe=J(n),V=Object.keys(i).filter(function(Ir){return Ir!=="key"}),tt=V.length>0?"{key: someKey, "+V.join(": ..., ")+": ...}":"{key: someKey}";if(!hn[fe+tt]){var Fr=V.length>0?"{"+V.join(": ..., ")+": ...}":"{}";k(`A props object containing a "key" prop is being spread into JSX:
10
+ let props = %s;
11
+ <%s {...props} />
12
+ React keys must be passed directly to JSX without using spread:
13
+ let props = %s;
14
+ <%s key={someKey} {...props} />`,tt,fe,Fr,fe),hn[fe+tt]=!0}}return n===a?jr(F):Tr(F),F}}function Or(n,i,f){return fn(n,i,f,!0)}function Yr(n,i,f){return fn(n,i,f,!1)}var Ar=Yr,Pr=Or;we.Fragment=a,we.jsx=Ar,we.jsxs=Pr})()),we}var at;function pn(){return at||(at=1,process.env.NODE_ENV==="production"?Ce.exports=gn():Ce.exports=mn()),Ce.exports}var g=pn();const ge=[1943,4,14],st=[31,28,31,30,31,30,31,31,30,31,30,31],yn=[31,29,31,30,31,30,31,31,30,31,30,31],ee=[[[30,32,31,32,31,30,30,30,29,30,29,31],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[30,32,31,32,31,30,30,30,29,30,29,31],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[31,31,31,32,31,31,29,30,30,29,29,31],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[31,31,31,32,31,31,29,30,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[31,31,31,32,31,31,29,30,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,30,29,31],366],[[31,31,31,32,31,31,30,29,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,30],365],[[31,32,31,32,31,30,30,30,29,30,29,31],366],[[31,31,31,32,31,31,30,29,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[30,32,31,32,31,30,30,30,29,30,29,31],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,31,32,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[30,32,31,32,31,30,30,30,29,30,29,31],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[30,32,31,32,31,31,29,30,30,29,29,31],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[31,31,31,32,31,31,29,30,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[31,31,31,32,31,31,29,30,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[31,31,31,32,31,31,30,29,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,30],365],[[31,32,31,32,31,30,30,30,29,30,29,31],366],[[31,31,31,32,31,31,30,29,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,30],365],[[31,32,31,32,31,30,30,30,29,30,29,31],366],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,31,32,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[30,32,31,32,31,30,30,30,29,30,29,31],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[30,32,31,32,31,31,29,30,29,30,29,31],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[31,31,31,32,31,31,29,30,30,29,29,31],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[31,31,31,32,31,31,29,30,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[31,31,31,32,31,31,30,29,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,30],365],[[31,32,31,32,31,30,30,30,29,30,29,31],366],[[31,31,31,32,31,31,30,29,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,30],365],[[31,32,31,32,31,30,30,30,29,30,29,31],366],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[30,32,31,32,31,30,30,30,29,30,29,31],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[30,32,31,32,31,30,30,30,29,30,29,31],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[31,31,31,32,31,31,29,30,30,29,29,31],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365],[[31,32,31,32,31,30,30,30,29,29,30,31],366],[[31,31,31,32,31,31,29,30,30,29,30,30],365],[[31,31,32,31,31,31,30,29,30,29,30,30],365],[[31,31,32,32,31,30,30,29,30,29,30,30],365]];let ot=class extends Error{constructor(e){super(e),this.name="DateOutOfRangeError"}};const it=()=>ge[0]+1,ut=()=>ge[0]+ee.length-1,ct=()=>2e3,lt=()=>2e3+ee.length-1,Re=t=>t%400===0||t%4===0&&t%100!==0,Be=t=>Re(t)?yn:st,vn=(t,e,r)=>!(t<it()||t>ut()||e<1||e>12||r<1||r>Be(t)[e-1]),dt=(t,e,r)=>{let a=t*365+r;for(let s=0;s<e-1;s++)a+=st[s];return e<=2&&(t-=1),a+=Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400),a};function bn(t,e,r){const a=e+1;if(!vn(t,a,r))throw new ot("Date out of range");let s=2e3,o=1,c=1,l=Math.abs(dt(t,a,r)-dt(...ge)),u=0;for(;l>=ee[u][1];)l-=ee[u][1],s+=1,u+=1;let d=0;for(;l>=ee[u][0][d];)l-=ee[u][0][d],o+=1,d+=1;return c+=l,[s,o-1,c]}const Dn=(t,e,r)=>!(t<ct()||t>lt()||e<1||e>12||r<1||r>ee[t-2e3][0][e-1]),Sn=(t,e,r)=>{let a=r-1;const s=t-2e3;for(let o=0;o<e-1;o++)a+=ee[s][0][o];for(let o=0;o<s;o++)a+=ee[o][1];return a},En=(t,e,r)=>{const a=e+1;if(!Dn(t,a,r))throw new ot("Date out of range");let[s,o,c]=[ge[0],1,1];const l=Be(s).slice(0,ge[1]-1).reduce((y,m)=>y+m,0)+ge[2]-1;let u=Math.abs(Sn(t,a,r)+l);for(;u>=366&&Re(s)||u>=365&&!Re(s);)u-=Re(s)?366:365,s+=1;const d=Be(s);let h=0;for(;u>=d[h];)u-=d[h],o+=1,h+=1;return c+=u,[s,o-1,c]},ne={enMinYear:it,enMaxYear:ut,npMinYear:ct,npMaxYear:lt,englishToNepali:bn,nepaliToEnglish:En},ht="en",X="ne",ft=207e5,gt=198e5,Mn=5049018e5,_n=new Date(1986,0,1,0,15),Te=["Baisakh","Jestha","Asar","Shrawan","Bhadra","Aswin","Kartik","Mangsir","Poush","Magh","Falgun","Chaitra"],He=["Bai","Jes","Asa","Shr","Bhd","Asw","Kar","Man","Pou","Mag","Fal","Cha"],mt=["बैशाख","जेठ","असार","श्रावण","भाद्र","आश्विन","कार्तिक","मंसिर","पौष","माघ","फाल्गुण","चैत्र"],wn=["बै","जे","अ","श्रा","भा","आ","का","मं","पौ","मा","फा","चै"],$e=["January","February","March","April","May","June","July","August","September","October","November","December"],Le=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],kn=["जनवरी","फेब्रुअरी","मार्च","अप्रिल","मे","जुन","जुलाई","अगस्ट","सेप्टेम्बर","अक्टोबर","नोभेम्बर","डिसेम्बर"],xn=["जन","फेब","मार","अप्रि","मे","जुन","जुला","अग","सेप","अक्टो","नोभे","डिसे"],pt=["०","१","२","३","४","५","६","७","८","९"],me=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],je=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],yt=["आइत","सोम","मंगल","बुध","बिहि","शुक्र","शनि"],vt=["आइतबार","सोमबार","मंगलबार","बुधबार","बिहिबार","शुक्रबार","शनिबार"],Cn=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DD?|ddd?d?|do?|YYYY|YY|y{2,4}|yo?|a|A|hh?|HH?|mm?|ss?|SSS|x|X|.)/g,Rn=t=>{const e=t.getTime(),r=e<Mn?gt:ft,a=new Date(e+r),s=a.getUTCFullYear(),o=a.getUTCMonth(),c=a.getUTCDate(),l=a.getUTCHours(),u=a.getUTCMinutes(),d=a.getUTCSeconds(),h=a.getUTCMilliseconds(),y=a.getUTCDay();return{year:s,month0:o,day:c,hour:l,minute:u,second:d,ms:h,weekDay:y}},bt=(t,e,r,a,s,o,c)=>{const l=new Date(t,e,r,a,s,o,c);let u=l<_n?gt:ft;const d=-1*l.getTimezoneOffset()*60*1e3;return new Date(l.getTime()-u+d)},Oe=t=>{const e=t.match(Cn);return e?e.map(r=>r.startsWith("[")&&r.endsWith("]")?r.slice(1,-1):r):[]},te=t=>{if(t.length===0)return new RegExp("");let e=[...t];if(e=e.sort((a,s)=>s.length-a.length),e[0]==="")return new RegExp("");const r=`(${e.join("|")})`;return new RegExp(r)},W=t=>t.toString().padStart(2,"0"),Dt=t=>t.toString().padStart(3,"0"),Tn=t=>t.split("").map(e=>pt[e.charCodeAt(0)-48]).join(""),Y=(t,e)=>{const r=typeof t=="string"?t:String(t);return e!==X?r:Tn(r)},jn=(t,e)=>Y(t.getYear(),e).substring(2),On=(t,e)=>Y(t.getYear(),e),Yn=(t,e)=>Y(t.getEnglishYear(),e).substring(2),An=(t,e)=>Y(t.getEnglishYear(),e),Pn=(t,e)=>Y(t.getMonth()+1,e),Fn=(t,e)=>Y(W(t.getMonth()+1),e),In=(t,e)=>e===X?wn[t.getMonth()]:He[t.getMonth()],Nn=(t,e)=>e===X?mt[t.getMonth()]:Te[t.getMonth()],Bn=(t,e)=>Y(t.getEnglishMonth()+1,e),Hn=(t,e)=>Y(W(t.getEnglishMonth()+1),e),$n=(t,e)=>e===X?xn[t.getEnglishMonth()]:Le[t.getEnglishMonth()],Ln=(t,e)=>e===X?kn[t.getEnglishMonth()]:$e[t.getEnglishMonth()],Wn=(t,e)=>Y(t.getDate(),e),Un=(t,e)=>Y(W(t.getDate()),e),Vn=(t,e)=>Y(t.getEnglishDate(),e),Gn=(t,e)=>Y(W(t.getEnglishDate()),e),St=(t,e)=>Y(t.getDay(),e),Ye=(t,e)=>e===X?yt[t.getDay()]:me[t.getDay()],Et=(t,e)=>e===X?vt[t.getDay()]:je[t.getDay()],Mt=(t,e)=>Y(t.getHours(),e),_t=(t,e)=>Y(W(t.getHours()),e),wt=(t,e)=>{const r=t.getHours(),a=r>12?r-12:r;return Y(a,e)},kt=(t,e)=>{const r=t.getHours(),a=r>12?r-12:r;return Y(W(a),e)},xt=(t,e)=>Y(t.getMinutes(),e),Ct=(t,e)=>Y(W(t.getMinutes()),e),Rt=(t,e)=>Y(t.getSeconds(),e),Tt=(t,e)=>Y(W(t.getSeconds()),e),jt=(t,e)=>Y(Dt(t.getMilliseconds()),e),Ot=(t,e)=>e===X?t.getHours()>=12?"पिम":"एम":t.getHours()>=12?"PM":"AM",Yt=(t,e)=>e===X?t.getHours()>=12?"पिम":"एम":t.getHours()>=12?"pm":"am",At={YY:jn,YYYY:On,M:Pn,MM:Fn,MMM:In,MMMM:Nn,D:Wn,DD:Un,d:St,dd:Ye,ddd:Ye,dddd:Et,H:Mt,HH:_t,h:wt,hh:kt,m:xt,mm:Ct,s:Rt,ss:Tt,SSS:jt,A:Ot,a:Yt},Pt=(t,e,r)=>{const a=Oe(e),s=o=>o in At?At[o](t,r):o;return a.map(s).join("")},Jn=(t,e)=>Pt(t,e,ht),qn=(t,e)=>Pt(t,e,X),Kn=t=>{const e=W(t.getYear()),r=W(t.getMonth()+1),a=W(t.getDate()),s=W(t.getHours()),o=W(t.getMinutes()),c=W(t.getSeconds()),l=t.getMilliseconds(),u=l===0?"":`.${Dt(l)}`;return`${e}-${r}-${a} ${s}:${o}:${c}${u}`},Ft={YY:Yn,YYYY:An,M:Bn,MM:Hn,MMM:$n,MMMM:Ln,D:Vn,DD:Gn,d:St,dd:Ye,ddd:Ye,dddd:Et,H:Mt,HH:_t,h:wt,hh:kt,m:xt,mm:Ct,s:Rt,ss:Tt,SSS:jt,A:Ot,a:Yt},It=(t,e,r)=>{const a=Oe(e),s=o=>o in Ft?Ft[o](t,r):o;return a.map(s).join("")},zn=(t,e)=>It(t,e,ht),Xn=(t,e)=>It(t,e,X);function Zn(t){const e=t.split(/[-./]/,3),[r,a=1,s=1]=e.map(o=>{const c=parseInt(o,10);if(Number.isNaN(c))throw new Error("Invalid date");return c});return[r,a-1,s]}function Qn(t){if(!t)return[0,0,0,0];const[e,r="0"]=t.split(".",2),a=e.split(":",3),[s,o=0,c=0]=a.map(u=>{const d=parseInt(u,10);if(Number.isNaN(d))throw new Error("Invalid time");return d});let l=parseInt(r,10);return Number.isNaN(l)&&(l=0),[s,o,c,l]}function er(t){const[e,r]=t.split(" ",2),[a,s,o]=Zn(e),[c,l,u,d]=Qn(r);return[a,s,o,c,l,u,d]}const Nt={YY:/(\d\d)/,YYYY:/(\d\d\d\d)/,M:/(1[0-2]|0[1-9]|[1-9])/,MM:/(1[0-2]|0[1-9]|[1-9])/,D:/(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/,DD:/(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/,H:/(2[0-3]|[0-1]\d|\d)/,HH:/(2[0-3]|[0-1]\d|\d)/,hh:/(1[0-2]|0[1-9]|[1-9])/,mm:/([0-5]\d|\d)/,ss:/([0-5]\d|\d)/,SSS:/(\d\d\d)/,A:/(AM|PM)/,a:/(am|pm)/,MMMM:te(Te),MMM:te(He),dddd:te(je),ddd:te(me),dd:te(me),d:/([0-6])/};function tr(t){const e=[],r=[];for(const s of t)s in Nt?(e.push(s),r.push(Nt[s].source)):r.push(s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"));const a=r.join("");return{dateTokens:e,regex:new RegExp(`^${a}$`)}}function nr(t,e){let[r,a,s,o,c,l,u,d]=[0,1,1,0,0,0,0,0],h=!1,y=!1;for(let m=0;m<t.length;m++){const T=t[m],v=parseInt(e[m+1]);switch(T){case"YYYY":r=v;break;case"YY":r=2e3+parseInt(e[m]);break;case"MM":case"M":a=v;break;case"MMMM":a=Te.indexOf(e[m+1])+1;break;case"MMM":a=He.indexOf(e[m+1])+1;break;case"DD":case"D":s=v;break;case"HH":case"H":o=v;break;case"hh":case"h":c=v,y=!0;break;case"mm":case"m":l=v;break;case"ss":case"s":u=v;break;case"SSS":d=v;break;case"A":case"a":h=e[m+1].toLowerCase()==="pm"}}return y&&(o=c+(h?12:0)),{year:r,month0:a-1,day:s,hour:o,minute:l,second:u,ms:d}}function Bt(t,e){const r=Oe(e),{dateTokens:a,regex:s}=tr(r),o=RegExp(s).exec(t);if(!o)throw new Error("Invalid date format");const{year:c,month0:l,day:u,hour:d,minute:h,second:y,ms:m}=nr(a,o);return[c,l,u,d,h,y,m]}const Ht={YY:/(\d\d)/,YYYY:/(\d\d\d\d)/,M:/(1[0-2]|0[1-9]|[1-9])/,MM:/(1[0-2]|0[1-9]|[1-9])/,D:/(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/,DD:/(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/,H:/(2[0-3]|[0-1]\d|\d)/,HH:/(2[0-3]|[0-1]\d|\d)/,hh:/(1[0-2]|0[1-9]|[1-9])/,mm:/([0-5]\d|\d)/,ss:/([0-5]\d|\d)/,SSS:/(\d\d\d)/,A:/(AM|PM)/,a:/(am|pm)/,MMMM:te($e),MMM:te(Le),dddd:te(je),ddd:te(me),dd:te(me),d:/([0-6])/};function rr(t){const e=[],r=[];for(const s of t)s in Ht?(e.push(s),r.push(Ht[s].source)):r.push(s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"));const a=r.join("");return{dateTokens:e,regex:new RegExp(`^${a}$`)}}function ar(t,e){let[r,a,s,o,c,l,u,d]=[0,1,1,0,0,0,0,0],h=!1,y=!1;for(let m=0;m<t.length;m++){const T=t[m],v=parseInt(e[m+1]);switch(T){case"YYYY":r=v;break;case"YY":r=2e3+parseInt(e[m]);break;case"MM":case"M":a=v;break;case"MMMM":a=$e.indexOf(e[m+1])+1;break;case"MMM":a=Le.indexOf(e[m+1])+1;break;case"DD":case"D":s=v;break;case"HH":case"H":o=v;break;case"hh":case"h":c=v,y=!0;break;case"mm":case"m":l=v;break;case"ss":case"s":u=v;break;case"SSS":d=v;break;case"A":case"a":h=e[m+1].toLowerCase()==="pm"}}return y&&(o=c+(h?12:0)),{year:r,month0:a-1,day:s,hour:o,minute:l,second:u,ms:d}}function sr(t,e){const r=Oe(e),{dateTokens:a,regex:s}=rr(r),o=RegExp(s).exec(t);if(!o)throw new Error("Invalid date format");const{year:c,month0:l,day:u,hour:d,minute:h,second:y,ms:m}=ar(a,o);return[c,l,u,d,h,y,m]}function or(t){const e={एम:"AM",पिम:"PM"};mt.forEach((a,s)=>e[a]=Te[s]),vt.forEach((a,s)=>e[a]=je[s]),yt.forEach((a,s)=>e[a]=me[s]),pt.forEach((a,s)=>e[a]=String(s));const r=new RegExp(Object.keys(e).join("|"),"g");return t.replace(r,a=>e[a])}function ir(t,e){const r=or(t);return Bt(r,e)}class Ae extends Error{constructor(e){super(e),this.name="ValidationError"}}const ur=t=>{if(t<0||t>23)throw new Ae("Hour should be in the range 0-23")},cr=t=>{if(t<0||t>59)throw new Ae("Minute should be in the range 0-59")},lr=t=>{if(t<0||t>59)throw new Ae("Second should be in the range 0-59")},dr=t=>{if(t<0||t>999)throw new Ae("Millisecond should be in the range 0-999")},hr=(t,e,r,a)=>{ur(t),cr(e),lr(r),dr(a)};class H{timestamp;year;yearEn;month;monthEn;day;dayEn;hour;minute;weekDay;constructor(...e){if(e.length===0)this.initFromCurrentDate();else if(e.length===1&&e[0]instanceof Date)this.initFromEnglishDate(e[0]);else if(e.length===1&&e[0]instanceof H)this.initFromNepaliDate(e[0]);else if(e.length===1&&typeof e[0]=="string")this.parseFromString(e[0]);else if(e.length===1&&typeof e[0]=="number")this.initFromTimestamp(e[0]);else if(e.length===2&&typeof e[0]=="string"&&typeof e[1]=="string")this.parseFromStringWithFormat(e[0],e[1]);else if(e.length>=2&&e.length<=8&&e.every(r=>typeof r=="number"))this.initFromComponents(e);else throw new Error("Invalid date argument")}initFromCurrentDate(){this._setDateObject(new Date)}initFromEnglishDate(e){this._setDateObject(e)}initFromNepaliDate(e){this.set(e.year,e.month,e.day,e.hour,e.minute,e.getSeconds(),e.getMilliseconds())}parseFromString(e){const r=er(e);this.set(r[0],r[1],r[2],r[3],r[4],r[5],r[6])}initFromTimestamp(e){this._setDateObject(new Date(e))}parseFromStringWithFormat(e,r){const a=Bt(e,r);this.set(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}initFromComponents(e){this.set(e[0],e[1],e[2]??1,e[3]??0,e[4]??0,e[5]??0,e[6]??0)}_setDateObject(e,r=!0){this.timestamp=e;const{year:a,month0:s,day:o,hour:c,minute:l,weekDay:u}=Rn(e);if(this.yearEn=a,this.monthEn=s,this.dayEn=o,this.hour=c,this.minute=l,this.weekDay=u,r){const[d,h,y]=ne.englishToNepali(a,s,o);this.year=d,this.month=h,this.day=y}}getDateObject(){return this.timestamp}getYear(){return this.year}getEnglishYear(){return this.yearEn}getMonth(){return this.month}getEnglishMonth(){return this.monthEn}getDate(){return this.day}getEnglishDate(){return this.dayEn}getDay(){return this.weekDay}getHours(){return this.hour}getMinutes(){return this.minute}getSeconds(){return this.timestamp.getSeconds()}getMilliseconds(){return this.timestamp.getMilliseconds()}getTime(){return this.timestamp.getTime()}setYear(e){this.set(e,this.month,this.day,this.hour,this.minute,this.timestamp.getSeconds(),this.timestamp.getMilliseconds())}setMonth(e){this.set(this.year,e,this.day,this.hour,this.minute,this.timestamp.getSeconds(),this.timestamp.getMilliseconds())}setDate(e){this.set(this.year,this.month,e,this.hour,this.minute,this.timestamp.getSeconds(),this.timestamp.getMilliseconds())}setHours(e){this.set(this.year,this.month,this.day,e,this.minute,this.timestamp.getSeconds(),this.timestamp.getMilliseconds())}setMinutes(e){this.set(this.year,this.month,this.day,this.hour,e,this.timestamp.getSeconds(),this.timestamp.getMilliseconds())}setSeconds(e){this.set(this.year,this.month,this.day,this.hour,this.minute,e,this.timestamp.getMilliseconds())}setMilliseconds(e){this.set(this.year,this.month,this.day,this.hour,this.minute,this.timestamp.getSeconds(),e)}setTime(e){this._setDateObject(new Date(e))}set(e,r,a,s,o,c,l){hr(s,o,c,l);const[u,d,h]=ne.nepaliToEnglish(e,r,a);this.year=e,this.month=r,this.day=a,this._setDateObject(bt(u,d,h,s,o,c,l),!1)}setDateObject(e){this._setDateObject(e,!0)}format(e){return Jn(this,e)}formatNepali(e){return qn(this,e)}toString(){return Kn(this)}formatEnglishDate(e){return zn(this,e)}formatEnglishDateInNepali(e){return Xn(this,e)}static fromEnglishDate(e,r,a,s=0,o=0,c=0,l=0){const u=bt(e,r,a,s,o,c,l);return new H(u)}static parseNepaliFormat(e,r){const[a,s,o,c,l,u,d]=ir(e,r);return new H(a,s,o,c,l,u,d)}static parseEnglishDate(e,r){const[a,s,o,c,l,u,d]=sr(e,r);return H.fromEnglishDate(a,s,o,c,l,u,d)}static getDaysOfMonth(e,r){if(e<ne.npMinYear()||e>ne.npMaxYear())throw new Error("Year out of range");if(r<0||r>11)throw new Error("Month out of range");return ee[e-ne.npMinYear()][0][r]}static minSupportedDate(){return H.fromEnglishDate(ne.enMinYear(),0,1).getDateObject()}static maxSupportedDate(){return H.fromEnglishDate(ne.enMaxYear(),11,31).getDateObject()}static minSupportedNepaliDate(){return new H(ne.npMinYear(),0,1)}static maxSupportedNepaliDate(){const e=ne.npMaxYear();return new H(e,11,this.getDaysOfMonth(e,11))}static minimum(){return console.warn("`NepaliDate.minimum()` is deprecated and will be removed in a future version. Please use `NepaliDate.minSupportedDate()` instead."),this.minSupportedDate()}static maximum(){return console.warn("`NepaliDate.maximum()` is deprecated and will be removed in a future version. Please use `NepaliDate.maxSupportedDate()` instead."),this.maxSupportedDate()}}const $t=["बैशाख","जेठ","आषाढ","श्रावण","भाद्र","आश्विन","कार्तिक","मंसिर","पौष","माघ","फाल्गुन","चैत्र"],We=["Baishakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Poush","Magh","Falgun","Chaitra"],Lt=["January","February","March","April","May","June","July","August","September","October","November","December"],Wt=["आइत","सोम","मंगल","बुध","बिहि","शुक्र","शनि"],Ut=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Vt=["०","१","२","३","४","५","६","७","८","९"],fr={light:{primary:"#3b82f6",background:"#ffffff",text:"#1f2937",border:"#e5e7eb",hover:"#f3f4f6",selected:"#3b82f6",today:"#dbeafe",disabled:"#d1d5db"},dark:{primary:"#60a5fa",background:"#1f2937",text:"#f9fafb",border:"#374151",hover:"#374151",selected:"#3b82f6",today:"#1e40af",disabled:"#6b7280"}},ce=t=>t.toString().split("").map(e=>Vt[parseInt(e)]).join(""),Gt=(t,e,r)=>{if(t==="BS")try{const a=r===11?new H(e+1,0,1):new H(e,r+1,1);return new H(a.getTime()-1440*60*1e3).getDate()}catch{return 30}return new Date(e,r+1,0).getDate()},Jt=(t,e,r)=>{if(t==="BS")try{return new H(e,r,1).getDay()||0}catch{return 0}return new Date(e,r,1).getDay()},re=t=>{const e=new Date;if(t==="BS")try{const r=H.fromEnglishDate(e.getFullYear(),e.getMonth(),e.getDate());return{year:r.getYear(),month:r.getMonth(),day:r.getDate()}}catch{return{year:2081,month:0,day:1}}return{year:e.getFullYear(),month:e.getMonth(),day:e.getDate()}},qt=(t,e,r,a,s)=>{if(t==="BS")try{const o=new H(e,r,a),l=new Date(o.getEnglishYear(),o.getEnglishMonth(),o.getEnglishDate()).toISOString().split("T")[0];return{bs:`${e}-${String(r+1).padStart(2,"0")}-${String(a).padStart(2,"0")}`,ad:l,formatted:{bs:`${s[r]} ${a}, ${e}`,ad:new Date(o.getEnglishYear(),o.getEnglishMonth(),o.getEnglishDate()).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}}}catch{const o=`${e}-${String(r+1).padStart(2,"0")}-${String(a).padStart(2,"0")}`;return{bs:o,ad:o,formatted:{bs:`${s[r]} ${a}, ${e}`,ad:`${s[r]} ${a}, ${e}`}}}else{const o=new Date(e,r,a),c=o.toISOString().split("T")[0];try{const l=H.fromEnglishDate(e,r,a),u=`${l.getYear()}-${String(l.getMonth()+1).padStart(2,"0")}-${String(l.getDate()).padStart(2,"0")}`;return{ad:c,bs:u,formatted:{ad:o.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),bs:`${We[l.getMonth()]} ${l.getDate()}, ${l.getYear()}`}}}catch{return{ad:c,bs:c,formatted:{ad:o.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),bs:o.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}}}}},gr=(t,e,r)=>{const a=new Date(t.year,t.month,t.day).getTime(),s=new Date(e.year,e.month,e.day).getTime(),o=new Date(r.year,r.month,r.day).getTime();return a>=s&&a<=o},Kt=t=>{try{const[e,r,a]=t.split("-").map(Number);return!e||!r||!a?null:{year:e,month:r-1,day:a}}catch{return null}},Pe=(t,e,r,a="AD")=>{if(!e&&!r)return!1;const s=new Date(t.year,t.month,t.day).getTime();if(e){const o=Kt(e);if(o){const c=new Date(o.year,o.month,o.day).getTime();if(s<c)return!0}}if(r){const o=Kt(r);if(o){const c=new Date(o.year,o.month,o.day).getTime();if(s>c)return!0}}return!1},zt=(t="AD")=>{const e=O.useMemo(()=>re(t),[t]),[r,a]=O.useState(e.year),[s,o]=O.useState(e.month),[c,l]=O.useState(null),[u,d]=O.useState(null),[h,y]=O.useState(null);O.useEffect(()=>{a(e.year),o(e.month)},[e.year,e.month]);const m=O.useMemo(()=>{const _=Gt(t,r,s),k=Jt(t,r,s),I=[];for(let A=0;A<k;A++)I.push(null);for(let A=1;A<=_;A++)I.push(A);return I},[r,s,t]);return{currentYear:r,currentMonth:s,selectedDate:c,rangeStart:u,rangeEnd:h,today:e,calendarDays:m,setCurrentYear:a,setCurrentMonth:o,setSelectedDate:l,setRangeStart:d,setRangeEnd:y,navigateMonth:_=>{let I=s+_,A=r;for(;I>11;)I-=12,A+=1;for(;I<0;)I+=12,A-=1;o(I),a(A)},isToday:_=>r===e.year&&s===e.month&&_===e.day,isSelected:(_,k="single")=>k==="range"?!!(u&&u.year===r&&u.month===s&&u.day===_)||!!(h&&h.year===r&&h.month===s&&h.day===_):!!(c&&c.year===r&&c.month===s&&c.day===_),isInRange:_=>{if(!u||!h)return!1;const k=new Date(r,s,_).getTime(),I=new Date(u.year,u.month,u.day).getTime(),A=new Date(h.year,h.month,h.day).getTime();return k>=I&&k<=A}}},Xt=()=>[{key:"today",label:"Today",getValue:t=>{const e=re(t);return{start:e,end:e}}},{key:"yesterday",label:"Yesterday",getValue:t=>{const e=re(t),r={...e,day:e.day-1};return{start:r,end:r}}},{key:"last7days",label:"Last 7 Days",getValue:t=>{const e=re(t);return{start:{...e,day:e.day-6},end:e}}},{key:"last30days",label:"Last 30 Days",getValue:t=>{const e=re(t);return{start:{...e,day:e.day-29},end:e}}},{key:"thisMonth",label:"This Month",getValue:t=>{const e=re(t);return{start:{...e,day:1},end:e}}},{key:"lastMonth",label:"Last Month",getValue:t=>{const e=re(t),r=e.month===0?11:e.month-1,a=e.month===0?e.year-1:e.year;return{start:{year:a,month:r,day:1},end:{year:a,month:r,day:30}}}},{key:"last3months",label:"Last 3 Months",getValue:t=>{const e=re(t);return{start:{year:e.month<3?e.year-1:e.year,month:e.month<3?e.month+9:e.month-3,day:1},end:e}}}],w={calendar:"_calendar_1qlbw_1",grid:"_grid_1qlbw_11",header:"_header_1qlbw_22",navButton:"_navButton_1qlbw_29",monthYear:"_monthYear_1qlbw_55",pickerOverlay:"_pickerOverlay_1qlbw_75",pickerContent:"_pickerContent_1qlbw_85",pickerHeader:"_pickerHeader_1qlbw_95",closeButton:"_closeButton_1qlbw_109",pickerBody:"_pickerBody_1qlbw_128",pickerSection:"_pickerSection_1qlbw_132",pickerSectionHeader:"_pickerSectionHeader_1qlbw_148",yearNav:"_yearNav_1qlbw_159",yearGrid:"_yearGrid_1qlbw_191",selected:"_selected_1qlbw_211",monthGrid:"_monthGrid_1qlbw_217",dayHeader:"_dayHeader_1qlbw_249",day:"_day_1qlbw_249",dayDisabled:"_dayDisabled_1qlbw_270",dayOtherMonth:"_dayOtherMonth_1qlbw_270",daySelected:"_daySelected_1qlbw_274",dayToday:"_dayToday_1qlbw_279",dayInRange:"_dayInRange_1qlbw_285"},mr=({currentYear:t,currentMonth:e,months:r,onYearChange:a,onMonthChange:s,onClose:o,showNepaliNumbers:c=!1,convertToNepaliNumber:l=d=>d.toString(),calendarType:u})=>{const[d,h]=O.useState(Math.floor(t/12)*12),y=u==="BS"?2e3:1944,m=u==="BS"?2100:2043;return g.jsx("div",{className:w.pickerOverlay,onClick:o,children:g.jsxs("div",{className:w.pickerContent,onClick:T=>T.stopPropagation(),children:[g.jsxs("div",{className:w.pickerHeader,children:[g.jsx("h3",{children:"Select Month & Year"}),g.jsx("button",{onClick:o,className:w.closeButton,children:"×"})]}),g.jsxs("div",{className:w.pickerBody,children:[g.jsxs("div",{className:w.pickerSection,children:[g.jsxs("div",{className:w.pickerSectionHeader,children:[g.jsx("label",{children:"Year"}),g.jsxs("div",{className:w.yearNav,children:[g.jsx("button",{onClick:()=>h(Math.max(y,d-12)),disabled:d<=y,children:"«"}),g.jsxs("span",{children:[c?l(d):d," - ",c?l(d+11):d+11]}),g.jsx("button",{onClick:()=>h(Math.min(m-11,d+12)),disabled:d+11>=m,children:"»"})]})]}),g.jsx("div",{className:w.yearGrid,children:Array.from({length:12},(T,v)=>{const $=d+v;return $>m?null:g.jsx("button",{onClick:()=>a($),className:$===t?w.selected:"",children:c?l($):$},$)})})]}),g.jsxs("div",{className:w.pickerSection,children:[g.jsx("label",{children:"Month"}),g.jsx("div",{className:w.monthGrid,children:r.map((T,v)=>g.jsx("button",{onClick:()=>{s(v),o()},className:v===e?w.selected:"",children:T},v))})]})]})]})})},Ue=({currentMonth:t,currentYear:e,months:r,onNavigateMonth:a,onYearChange:s,onMonthChange:o,disabled:c=!1,showNepaliNumbers:l=!1,convertToNepaliNumber:u,calendarType:d})=>{const[h,y]=O.useState(!1);return g.jsxs("div",{className:w.header,children:[g.jsx("button",{className:w.navButton,onClick:()=>a(-12),disabled:c,"aria-label":"Previous year",title:"Previous year",children:"«"}),g.jsx("button",{className:w.navButton,onClick:()=>a(-1),disabled:c,"aria-label":"Previous month",children:"‹"}),g.jsxs("button",{className:w.monthYear,onClick:()=>y(!0),disabled:c,children:[r[t]," ",l?u(e):e]}),g.jsx("button",{className:w.navButton,onClick:()=>a(1),disabled:c,"aria-label":"Next month",children:"›"}),g.jsx("button",{className:w.navButton,onClick:()=>a(12),disabled:c,"aria-label":"Next year",title:"Next year",children:"»"}),h&&g.jsx(mr,{currentYear:e,currentMonth:t,months:r,onYearChange:s,onMonthChange:o,onClose:()=>y(!1),showNepaliNumbers:l,convertToNepaliNumber:u,calendarType:d})]})},Ve=({calendarDays:t,days:e,onDateSelect:r,isSelected:a,isInRange:s,isToday:o,isDisabled:c,disabled:l=!1,showNepaliNumbers:u=!1,convertToNepaliNumber:d})=>g.jsxs("div",{className:w.grid,children:[e.map(h=>g.jsx("div",{className:w.dayHeader,children:h},h)),t.map((h,y)=>{const m=h?c?.(h)||l:!1;return g.jsx("div",{className:`${w.day} ${h===null?w.dayOtherMonth:m?w.dayDisabled:a(h)?w.daySelected:s(h)?w.dayInRange:o(h)?w.dayToday:""}`,onClick:()=>h&&!m&&r(h),children:h?u?d(h):h:""},y)})]}),Zt=({presets:t,calendarType:e,onPresetSelect:r,activePreset:a,position:s="top"})=>{const o=c=>{const l=c.getValue(e);r(c,l)};return g.jsx("div",{style:{display:"flex",flexDirection:s==="left"?"column":"row",flexWrap:s==="top"?"wrap":"nowrap",gap:"8px",marginBottom:s==="top"?"16px":0,padding:"12px",backgroundColor:"#f8f9fa",borderRadius:"6px",border:"1px solid #e9ecef",minWidth:s==="left"?"150px":"auto",maxWidth:s==="left"?"180px":"none",flexShrink:0},children:t.map(c=>g.jsx("button",{onClick:()=>o(c),style:{padding:"6px 12px",fontSize:"12px",border:"1px solid #dee2e6",borderRadius:"4px",backgroundColor:a===c.key?"#007bff":"#ffffff",color:a===c.key?"#ffffff":"#495057",cursor:"pointer",transition:"all 0.2s"},children:c.label},c.key))})},Qt=({calendarType:t="AD",value:e,onChange:r,className:a="",showToday:s=!0,disabled:o=!1,outputFormat:c="both",onDateSelect:l,mode:u="single",onRangeSelect:d,showRangePresets:h=!1,rangePresetsPosition:y="top",predefinedRanges:m,onPresetSelect:T,renderPresets:v,showNepaliMonths:$=!1,showNepaliDays:Z=!1,showNepaliNumbers:_=!1,theme:k="light",colors:I,minDate:A,maxDate:se})=>{const{currentYear:E,currentMonth:j,selectedDate:le,rangeStart:B,rangeEnd:oe,today:N,calendarDays:G,setSelectedDate:J,setRangeStart:q,setRangeEnd:Q,setCurrentYear:pe,setCurrentMonth:ye,navigateMonth:U,isToday:ve,isSelected:be,isInRange:De}=zt(t),[ke,Se]=O.useState(),Ge=Xt(),Ie=m||Ge,ie=t==="BS"&&$?$t:t==="BS"?We:Lt,de=t==="BS"&&Z?Wt:Ut,he=(b,x)=>{x.start&&x.end&&(q(x.start),Q(x.end),Se(b.key),T?.(b,x),d?.(x))},xe=(b,x)=>{q(b),Q(x),Se(void 0),d?.({start:b,end:x})},ue=b=>{if(o)return;const x={year:E,month:j,day:b};if(Pe(x,A,se,t))return;if(u==="range"){if(Se(void 0),!B||B&&oe)q(x),Q(null);else{const ae=new Date(B.year,B.month,B.day).getTime();new Date(x.year,x.month,x.day).getTime()<ae?(q(x),Q(B),d?.({start:x,end:B})):(Q(x),d?.({start:B,end:x}))}return}J(x);const K=qt(t,E,j,b,ie);if(l?.(K),r){let ae;switch(c){case"iso":ae=K.ad;break;case"object":ae=JSON.stringify(K);break;default:ae=JSON.stringify(K);break}r(ae)}},Je=b=>{if(!o){switch(b.key){case"ArrowLeft":U(-1);break;case"ArrowRight":U(1);break;case"ArrowUp":U(-12);break;case"ArrowDown":U(12);break;case"PageUp":b.shiftKey?U(-12):U(-1);break;case"PageDown":b.shiftKey?U(12):U(1);break;default:return}b.preventDefault()}},Ke={...I?Object.entries(I).reduce((b,[x,K])=>(b[`--calendar-${x}`]=K,b),{}):{}};return g.jsxs("div",{className:`${w.calendar} ${a}`,style:Ke,"data-theme":k,onKeyDown:Je,tabIndex:0,role:"application","aria-label":"Calendar",children:[u==="range"&&v&&g.jsxs("div",{style:{display:"flex",gap:"16px"},children:[g.jsx("div",{children:v({onRangeChange:xe})}),g.jsxs("div",{style:{flex:1},children:[g.jsx(Ue,{currentMonth:j,currentYear:E,months:ie,onNavigateMonth:U,onYearChange:pe,onMonthChange:ye,disabled:o,showNepaliNumbers:_,convertToNepaliNumber:ce,calendarType:t}),g.jsx(Ve,{calendarDays:G,days:de,onDateSelect:ue,isSelected:b=>be(b,u),isInRange:De,isToday:b=>s&&ve(b),isDisabled:b=>Pe({year:E,month:j,day:b},A,se,t),disabled:o,showNepaliNumbers:_,convertToNepaliNumber:ce})]})]}),u==="range"&&h&&y==="left"&&!v&&g.jsxs("div",{style:{display:"flex",gap:"16px",flexWrap:"wrap"},children:[g.jsx(Zt,{presets:Ie,calendarType:t,onPresetSelect:he,activePreset:ke,position:"left"}),g.jsxs("div",{style:{flex:"1 1 280px",minWidth:"280px"},children:[g.jsx(Ue,{currentMonth:j,currentYear:E,months:ie,onNavigateMonth:U,onYearChange:pe,onMonthChange:ye,disabled:o,showNepaliNumbers:_,convertToNepaliNumber:ce,calendarType:t}),g.jsx(Ve,{calendarDays:G,days:de,onDateSelect:ue,isSelected:b=>be(b,u),isInRange:De,isToday:b=>s&&ve(b),isDisabled:b=>Pe({year:E,month:j,day:b},A,se,t),disabled:o,showNepaliNumbers:_,convertToNepaliNumber:ce})]})]}),(!u||u==="single"||!h&&!v||y==="top")&&g.jsxs(g.Fragment,{children:[u==="range"&&h&&g.jsx(Zt,{presets:Ie,calendarType:t,onPresetSelect:he,activePreset:ke,position:"top"}),g.jsx(Ue,{currentMonth:j,currentYear:E,months:ie,onNavigateMonth:U,onYearChange:pe,onMonthChange:ye,disabled:o,showNepaliNumbers:_,convertToNepaliNumber:ce,calendarType:t}),g.jsx(Ve,{calendarDays:G,days:de,onDateSelect:ue,isSelected:b=>be(b,u),isInRange:De,isToday:b=>s&&ve(b),isDisabled:b=>Pe({year:E,month:j,day:b},A,se,t),disabled:o,showNepaliNumbers:_,convertToNepaliNumber:ce})]})]})},Fe={datePicker:"_datePicker_pdqgs_1",input:"_input_pdqgs_7",iconButton:"_iconButton_pdqgs_36",popup:"_popup_pdqgs_62"},en=({placeholder:t="Select date",format:e="YYYY-MM-DD",onDateSelect:r,inputClassName:a="",popupClassName:s="",style:o,inputStyle:c,icon:l,showIcon:u=!0,calendarType:d="AD",...h})=>{const[y,m]=O.useState(!1),[T,v]=O.useState(null),[$,Z]=O.useState(""),_=O.useRef(null);O.useEffect(()=>{const E=j=>{_.current&&!_.current.contains(j.target)&&m(!1)};return y&&document.addEventListener("mousedown",E),()=>{document.removeEventListener("mousedown",E)}},[y]);const k=E=>{v(E);const j=d==="BS"?E.bs:E.ad;Z(j),m(!1),r?.(E)},I=E=>{const j=E.target.value,le=E.target.selectionStart||0,B=$.length;if(j===""){Z("");return}if(le===j.length&&j.length>B){const N=j.replace(/[^0-9]/g,"");let G=N;N.length>4&&N.length<=6?G=N.slice(0,4)+"-"+N.slice(4):N.length>6&&(G=N.slice(0,4)+"-"+N.slice(4,6)+"-"+N.slice(6,8)),Z(G)}else{const N=j.replace(/[^0-9-]/g,"");N.length<=10&&Z(N)}},A=()=>{const E=$.trim();if(!E){v(null);return}const j=E.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(j){const[,le,B,oe]=j,N=parseInt(B),G=parseInt(oe);if(N<1||N>12||G<1||G>32){Z(T?d==="BS"?T.formatted.bs:T.formatted.ad:"");return}const J={bs:d==="BS"?`${le}-${B}-${oe}`:"",ad:d==="AD"?`${le}-${B}-${oe}`:"",formatted:{bs:d==="BS"?E:"",ad:d==="AD"?E:""}};v(J),r?.(J)}else E.length<10&&Z(T?d==="BS"?T.formatted.bs:T.formatted.ad:"")},se=E=>{E.key==="Enter"?(A(),m(!1)):E.key==="Escape"&&m(!1)};return g.jsxs("div",{className:`${Fe.datePicker} ${a}`,ref:_,style:o,children:[g.jsx("input",{type:"text",value:$,placeholder:t||"YYYY-MM-DD",onChange:I,onBlur:A,onKeyDown:se,className:Fe.input,style:c,"aria-label":"Date picker input","aria-haspopup":"dialog","aria-expanded":y,maxLength:10}),g.jsx("button",{type:"button",className:Fe.iconButton,onClick:()=>m(!y),"aria-label":"Toggle calendar",style:{display:u?"flex":"none"},children:l||g.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[g.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),g.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),g.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),g.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),y&&g.jsx("div",{className:`${Fe.popup} ${s}`,children:g.jsx(Qt,{calendarType:d,onDateSelect:k,...h})})]})};R.Calendar=Qt,R.CalendarInput=en,R.DEFAULT_COLORS=fr,R.DatePicker=en,R.ENGLISH_DAYS=Ut,R.ENGLISH_MONTHS_AD=Lt,R.ENGLISH_MONTHS_BS=We,R.NEPALI_DAYS=Wt,R.NEPALI_DIGITS=Vt,R.NEPALI_MONTHS=$t,R.convertToNepaliNumber=ce,R.createDateOutput=qt,R.createPredefinedRanges=Xt,R.getDaysInMonth=Gt,R.getFirstDayOfMonth=Jt,R.getTodayDate=re,R.isDateInRange=gr,R.useCalendar=zt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
package/dist/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "bs-ad-calendar-react",
3
+ "version": "1.0.1",
4
+ "private": false,
5
+ "description": "A modern React calendar component supporting both Bikram Sambat (BS) and Gregorian (AD) calendars",
6
+ "type": "module",
7
+ "main": "./dist/bs-ad-calendar.umd.cjs",
8
+ "module": "./dist/bs-ad-calendar.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/bs-ad-calendar.js",
13
+ "require": "./dist/bs-ad-calendar.umd.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "build": "tsc -p tsconfig.lib.json && vite build",
22
+ "build:lib": "tsc -p tsconfig.lib.json && vite build",
23
+ "build:demo": "vite build --mode demo",
24
+ "lint": "eslint .",
25
+ "preview": "vite preview",
26
+ "predeploy": "npm run build:demo",
27
+ "deploy": "gh-pages -d dist",
28
+ "prepublishOnly": "npm run build:lib"
29
+ },
30
+ "keywords": [
31
+ "react",
32
+ "calendar",
33
+ "nepali",
34
+ "bikram-sambat",
35
+ "date-picker",
36
+ "bs",
37
+ "ad"
38
+ ],
39
+ "author": "Bibek Amatya",
40
+ "license": "MIT",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/bibekamatya/bs-ad-calendar.git"
44
+ },
45
+ "dependencies": {
46
+ "nepali-datetime": "^1.5.0"
47
+ },
48
+ "peerDependencies": {
49
+ "react": ">=16.8.0",
50
+ "react-dom": ">=16.8.0"
51
+ },
52
+ "devDependencies": {
53
+ "@eslint/js": "^9.39.1",
54
+ "@types/node": "^24.10.1",
55
+ "@types/react": "^18.0.0",
56
+ "@types/react-dom": "^18.0.0",
57
+ "@vitejs/plugin-react": "^5.1.1",
58
+ "eslint": "^9.39.1",
59
+ "eslint-plugin-react-hooks": "^7.0.1",
60
+ "eslint-plugin-react-refresh": "^0.4.24",
61
+ "gh-pages": "^6.3.0",
62
+ "globals": "^16.5.0",
63
+ "react": "^18.0.0",
64
+ "react-dom": "^18.0.0",
65
+ "typescript": "~5.9.3",
66
+ "typescript-eslint": "^8.46.4",
67
+ "vite": "^7.2.4"
68
+ }
69
+ }