jb-calendar
Version:
jalali calendar interface web component
2 lines • 44.7 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("jb-core")):"function"==typeof define&&define.amd?define(["exports","jb-core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JBCalendar={},e.JBCore)}(this,(function(e,t){"use strict";var a,r,n,s=Object.create,i=Object.defineProperty,o=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,c=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;function d(e,t,a,r){if("a"===a&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?r:"a"===a?r.call(e):r?r.value:t.get(e)}function p(e,t,a,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,a):n?n.value=a:t.set(e,a),a}n=null!=(a=t)?s(c(a)):{},t=((e,t,a,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var n,s=l(t),c=0,d=s.length;c<d;c++)n=s[c],h.call(e,n)||n===a||i(e,n,{get:(e=>t[e]).bind(null,n),enumerable:!(r=o(t,n))||r.enumerable});return e})(!r&&a&&a.__esModule?n:i(n,"default",{value:a,enumerable:!0}),a);function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function u(e){y(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===m(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function b(e){return y(1,arguments),u(e).getDay()}function v(e){return y(1,arguments),u(e).getMonth()}function w(e){return y(1,arguments),u(e).getFullYear()}function g(e,t){y(2,arguments);var a=u(e),r=u(t);return a.getTime()===r.getTime()}function f(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}var x=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178];function j(e,t,a){return function(e){if(isNaN(e))return{jy:NaN,jm:NaN,jd:NaN};var t,a,r,n=W(e).gy,s=n-621,i=D(s,!1),o=T(n,3,i.march);if((r=e-o)>=0){if(r<=185)return{jy:s,jm:a=1+L(r,31),jd:t=M(r,31)+1};r-=186}else s-=1,r+=179,1===i.leap&&(r+=1);return a=7+L(r,30),t=M(r,30)+1,{jy:s,jm:a,jd:t}}(T(e,t,a))}function S(e,t,a){return W(function(e,t,a){var r=M(M(t,12)+12-1,12)+1,n=L(t-r,12);t=r;var s=D(e+n,!0);return T(s.gy,3,s.march)+31*(t-1)-L(t,7)*(t-7)+a-1}(e,t,a))}function D(e,t){if(isNaN(e))return t?{gy:NaN,march:NaN}:{leap:NaN,gy:NaN,march:NaN};var a,r,n,s,i,o=x.length,l=e+621,c=-14,h=x[0],d=0;for(i=1;i<o&&(d=(a=x[i])-h,!(e<a));i+=1)c=c+8*L(d,33)+L(M(d,33),4),h=a;return c=c+8*L(s=e-h,33)+L(M(s,33)+3,4),4===M(d,33)&&d-s==4&&(c+=1),n=20+c-(L(l,4)-L(3*(L(l,100)+1),4)-150),t?{gy:l,march:n}:(d-s<6&&(s=s-d+33*L(d+4,33)),-1===(r=M(M(s+1,33)-1,4))&&(r=4),{leap:r,gy:l,march:n})}function T(e,t,a){var r=L(1461*(e+L(t-8,6)+100100),4)+L(153*M(t+9,12)+2,5)+a-34840408;return r=r-L(3*L(e+100100+L(t-8,6),100),4)+752}function W(e){return isNaN(e)?{gy:NaN,gm:NaN,gd:NaN}:(t=(t=4*e+139361631)+4*L(3*L(4*e+183187720,146097),4)-3908,a=5*L(M(t,1461),4)+308,r=L(M(a,153),5)+1,n=M(L(a,153),12)+1,{gy:L(t,1461)-100100+L(8-n,6),gm:n,gd:r});var t,a,r,n}function L(e,t){return~~(e/t)}function M(e,t){return e-~~(e/t)*t}function Y(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return k(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);"Object"===a&&e.constructor&&(a=e.constructor.name);if("Map"===a||"Set"===a)return Array.from(e);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return k(e,t)}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,r=new Array(t);a<t;a++)r[a]=e[a];return r}function C(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];if(t.length>1){var r=Y(t),n=r[0],s=r[1],i=r[2],o=void 0===i?1:i,l=r.slice(3),c=S(n,s+1,o);return new Date(...[c.gy,c.gm-1,c.gd,...l])}return new Date(...t)}function N(e){f(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?C(e.getTime()):"number"==typeof e||"[object Number]"===t?C(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),C(NaN))}function E(e){var t=e.getDate(),a=e.getMonth()+1;return j(e.getFullYear(),a,t).jd}function X(e){var t=e.getDate(),a=e.getMonth()+1;return j(e.getFullYear(),a,t).jm-1}function R(e){var t=e.getDate(),a=e.getMonth()+1;return j(e.getFullYear(),a,t).jy}function O(e){return f(1,arguments),N(e).getDay()}function P(e){f(1,arguments);var t=N(e),a=R(t),r=X(t),n=C(0);return function(e){for(var t=e.getDate(),a=e.getMonth()+1,r=j(e.getFullYear(),a,t),n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];var o=s[0],l=s[1],c=void 0===l?r.jm-1:l,h=s[2],d=S(o,c+1,void 0===h?r.jd:h);e.setFullYear(d.gy,d.gm-1,d.gd)}(n,a,r+1,0),n.setHours(0,0,0,0),E(n)}function A(e){return f(1,arguments),X(N(e))}function B(e){return f(1,arguments),R(N(e))}var H=class{get value(){return`oklch(${this.lightness} ${this.chroma} ${this.hue})`}constructor(e,t){this.variableName=t,this.lightness=e.lightness,this.chroma=e.chroma,this.hue=e.hue}};function q(e){return new H({lightness:6*(3+1.3*e)*.01,chroma:.001*(14+.09*e),hue:258.36},`--jb-neutral-${e}`)}function $(e){return new H({lightness:e.lightness+.07,chroma:e.chroma+.07,hue:e.hue},`${e.variableName}-hover`)}function V(e){return new H({lightness:e.lightness-.1,chroma:e.chroma-.05,hue:e.hue},`${e.variableName}-pressed`)}function I(e){const t=Math.min(e.lightness+.12*(1-e.lightness),.985),a=e.chroma*(1-.15*(t-e.lightness));return new H({lightness:t,chroma:Number(a.toFixed(3)),hue:e.hue},`${e.variableName}-l`)}function F(e){const t=Math.max(e.lightness-.12*e.lightness,.02),a=e.chroma*(1-.15*(t-e.lightness));return new H({lightness:t,chroma:a,hue:e.hue},`${e.variableName}-d`)}function z(e){const t=Math.min(e.lightness+.65*(1-e.lightness),.93),a=.55*e.chroma*(1-.08*(t-e.lightness)),r=e.hue>=70&&e.hue<=162?5:-3,n=e.hue+r;return new H({lightness:t,chroma:Number(a.toFixed(3)),hue:n},`${e.variableName}-subtle`)}function J(e){const t=Math.max(e.lightness-.35,.22),a=Math.min(1.6*e.chroma,.28);return new H({lightness:Number(t.toFixed(3)),chroma:Number(a.toFixed(3)),hue:e.hue},`${e.variableName}-contrast`)}const _=new H({lightness:.6,chroma:.26,hue:256},"--jb-primary"),G=new H({lightness:.6,chroma:.26,hue:286},"--jb-secondary"),U=new H({lightness:.75,chroma:.18,hue:70},"--jb-yellow"),Z=new H({lightness:.68,chroma:.1484,hue:162.1},"--jb-green"),K=new H({lightness:.6,chroma:.22,hue:23.21},"--jb-red"),Q={single:{black:new H({lightness:.14,chroma:0,hue:0},"--jb-black"),white:new H({lightness:1,chroma:0,hue:0},"--jb-white"),highlight:new H({lightness:.93,chroma:.2302,hue:125.18},"--jb-highlight")},neutral:[q(0),q(1),q(2),q(3),q(4),q(5),q(6),q(7),q(8),q(9),q(10)],primary:{main:_,hover:$(_),pressed:V(_),light:I(_),dark:F(_),subtle:z(_),contrast:J(_)},secondary:{main:G,hover:$(G),pressed:V(G),light:I(G),dark:F(G),subtle:z(G),contrast:J(G)},yellow:{main:U,hover:$(U),pressed:V(U),light:I(U),dark:F(U),subtle:z(U),contrast:J(U)},green:{main:Z,hover:$(Z),pressed:V(Z),light:I(Z),dark:F(Z),subtle:z(Z),contrast:J(Z)},red:{main:K,hover:$(K),pressed:V(K),light:I(K),dark:F(K),subtle:z(K),contrast:J(K)}};function ee(e){try{const{value:t,...a}=e;window.CSS.registerProperty({...a}),function(e,t){try{t&&(document.documentElement.style.getPropertyValue(e)||document.documentElement.style.setProperty(e,t))}catch(e){}}(e.name,t)}catch(e){}}function te(){var e;ee({name:"--jb-radius",inherits:!0,syntax:"<length-percentage>",value:"1rem",initialValue:"16px"}),ee({name:"--jb-radius-xs",inherits:!0,value:"0.5rem",initialValue:"8px",syntax:"<length-percentage>"}),ee({name:"--jb-radius-sm",inherits:!0,value:"0.75rem",initialValue:"12px",syntax:"<length-percentage>"}),ee({name:"--jb-radius-lg",inherits:!0,value:"1.25rem",initialValue:"20px",syntax:"<length-percentage>"}),ee({name:"--jb-radius-xl",inherits:!0,value:"1.5rem",initialValue:"24px",syntax:"<length-percentage>"}),function(e){ee({name:e.primary.main.variableName,syntax:"<color>",inherits:!0,initialValue:e.primary.main.value}),ee({name:e.secondary.main.variableName,syntax:"<color>",inherits:!0,initialValue:e.secondary.main.value}),ee({name:"--jb-neutral",syntax:"<color>",inherits:!0,initialValue:e.neutral[0].value}),ee({name:e.single.black.variableName,syntax:"<color>",inherits:!0,initialValue:e.single.black.value}),ee({name:e.single.white.variableName,syntax:"<color>",inherits:!0,initialValue:e.single.white.value}),ee({name:e.single.highlight.variableName,syntax:"<color>",inherits:!0,initialValue:e.single.highlight.value}),ee({name:e.yellow.main.variableName,syntax:"<color>",inherits:!0,initialValue:e.yellow.main.value}),ee({name:e.green.main.variableName,syntax:"<color>",inherits:!0,initialValue:e.green.main.value}),ee({name:e.red.main.variableName,syntax:"<color>",inherits:!0,initialValue:e.red.main.value}),ee({name:"--jb-neutral",syntax:"<color>",inherits:!0,initialValue:e.neutral[0].value});for(let t=1;t<=10;t++)ee({name:e.neutral[t].variableName,syntax:"<color>",inherits:!0,initialValue:e.neutral[t].value})}(Q),ee({name:"--jb-text-primary",syntax:"<color>",inherits:!0,initialValue:(e=Q).single.black.value}),ee({name:"--jb-text-secondary",syntax:"<color>",inherits:!0,initialValue:e.neutral[7].value}),ee({name:"--jb-text-contrast",syntax:"<color>",inherits:!0,initialValue:e.single.white.value})}var ae,re,ne,se,ie,oe,le,ce,he,de,pe,me,ye,ue,be,ve,we,ge;const fe=["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],xe=["January","February","March","April","May","June","July","August","September","October","November","December"],je="JALALI";var Se,De;(De=Se||(Se={})).day="DAY",De.month="MONTH",De.year="YEAR";const Te=new Date;null==HTMLElement&&console.error("you cant render web component on a server side");var We=class extends HTMLElement{setMonthList(e,t){if(Array.isArray(t)&&12==t.length){switch(e){case"JALALI":p(this,le,t.map((e=>e)),"f");break;case"GREGORIAN":p(this,ce,t,"f")}d(this,ae,"m",ye).call(this),d(this,ae,"m",pe).call(this,this.data.selectedMonth)}else console.error("Invalid Month List",t)}get defaultCalendarData(){return d(this,oe,"f")}set defaultCalendarData(e){p(this,oe,e,"f")}get value(){return d(this,ne,"f")}set value(e){const{year:t,month:a,day:r}=e;if(t&&a&&r){d(this,ne,"f").year=t,d(this,ne,"f").month=a,d(this,ne,"f").day=r,this.data.selectedYear=t,this.data.selectedMonth=a;const e=this.shadowRoot.querySelector(".--selected");if(null!==e&&e.classList.remove("--selected"),this.data.selectedYear==t&&this.data.selectedMonth==a){const e=this.shadowRoot.querySelector(`.day-wrapper[day-number="${r}"]`);e&&e.classList.add("--selected")}}else console.error("Invalid value. please make sure you have year,month and day")}get activeSection(){return d(this,se,"f")||Se.day}set activeSection(e){if(e!=d(this,se,"f")){if(d(this,se,"f")){const e=d(this,se,"f").toLocaleLowerCase();this.elements.selectionSections[e].classList.remove("--show")}"DAY"==e&&(this.elements.selectionSections.day.classList.add("--show"),this.elements.navigatorTitle.month.classList.add("--show"),this.elements.navigatorTitle.year.classList.add("--show"),this.elements.navigatorTitle.yearRange.classList.remove("--show")),"MONTH"==e&&(this.elements.selectionSections.month.classList.add("--show"),this.elements.navigatorTitle.month.classList.remove("--show"),this.elements.navigatorTitle.year.classList.add("--show"),this.elements.navigatorTitle.yearRange.classList.remove("--show")),"YEAR"==e&&(this.elements.selectionSections.year.classList.add("--show"),this.elements.navigatorTitle.month.classList.remove("--show"),this.elements.navigatorTitle.year.classList.remove("--show"),this.elements.navigatorTitle.yearRange.classList.add("--show")),p(this,se,e,"f")}}get inputType(){return d(this,ie,"f")}set inputType(e){p(this,ie,e,"f"),this.onInputTypeChange()}get showPersianNumber(){return d(this,he,"f")}set showPersianNumber(e){"boolean"==typeof e?(p(this,he,e,"f"),this.setCalendarData()):console.error("showPersianNumber must be boolean")}get cssDirection(){return getComputedStyle(this).direction}get direction(){return d(this,de,"f")?d(this,de,"f"):this.cssDirection}set direction(e){!e||"ltr"!=e&&"rtl"!=e||p(this,de,e,"f"),this.setupStyleBaseOnCssDirection()}constructor(){super(),ae.add(this),re.set(this,{daysWrapper:{startX:null,startY:null},yearsWrapper:{startX:null}}),ne.set(this,{year:null,month:null,day:null}),se.set(this,null),ie.set(this,je),oe.set(this,{jalali:{year:B(Te),month:A(Te)+1},gregorian:{year:w(Te),month:v(Te)+1}}),le.set(this,fe),ce.set(this,xe),this.dateRestrictions=new Proxy({min:null,max:null},this.createDateRestrictionHandler()),this.data=new Proxy({selectedYear:0,selectedMonth:0,yearSelectionRange:[0,0]},this.createDataHandler()),he.set(this,!1),de.set(this,null),this.initWebComponent(),this.initProps(),this.initCalendar()}connectedCallback(){this.callOnLoadEvent(),this.setupStyleBaseOnCssDirection(),this.initCalendarLayout()}initCalendarLayout(){d(this,ae,"m",ye).call(this),this.fillDayOfWeek(),this.setCalendarData()}setupStyleBaseOnCssDirection(e=this.direction){"ltr"==e?(this.elements.navigatorTitle.nextButton.classList.add("--css-ltr"),this.elements.navigatorTitle.prevButton.classList.add("--css-ltr"),this.elements.monthDayWrapper.next.classList.add("--css-ltr"),this.elements.monthDayWrapper.prev.classList.add("--css-ltr"),this.elements.yearsWrapper.next.classList.add("--css-ltr"),this.elements.yearsWrapper.prev.classList.add("--css-ltr")):"rtl"==e&&(this.elements.navigatorTitle.nextButton.classList.remove("--css-ltr"),this.elements.navigatorTitle.prevButton.classList.remove("--css-ltr"),this.elements.monthDayWrapper.next.classList.remove("--css-ltr"),this.elements.monthDayWrapper.prev.classList.remove("--css-ltr"),this.elements.yearsWrapper.next.classList.remove("--css-ltr"),this.elements.yearsWrapper.prev.classList.remove("--css-ltr"))}fillDayOfWeek(){const e=this.inputType==je?["ش","ی","د","س","چ","پ","ج"]:["Su","Mo","Tu","We","Th","Fr","Sa"];this.elements.dayOfWeekWrapper.innerHTML="";for(let t=0;t<=6;t++){const a=document.createElement("div");a.classList.add("week-day"),a.innerHTML=e[t],this.elements.dayOfWeekWrapper.appendChild(a)}}setCalendarData(){this.inputType==je?(this.data.selectedYear=this.value.year||this.data.selectedYear||d(this,oe,"f").jalali.year,this.data.selectedMonth=this.value.month||this.data.selectedMonth||d(this,oe,"f").jalali.month,this.data.yearSelectionRange=[this.data.selectedYear-4,this.data.selectedYear+7],this.shadowRoot.querySelector(".swipe-up-text").innerHTML="نمایش سالها"):(this.data.selectedYear=this.value.year||this.data.selectedYear||d(this,oe,"f").gregorian.year,this.data.selectedMonth=this.value.month||this.data.selectedMonth||d(this,oe,"f").gregorian.month,this.data.yearSelectionRange=[this.data.selectedYear-4,this.data.selectedYear+7],this.shadowRoot.querySelector(".swipe-up-text").innerHTML="show years")}callOnLoadEvent(){const e=new CustomEvent("load",{bubbles:!0,composed:!0});this.dispatchEvent(e)}callOnInitEvent(){const e=new CustomEvent("init",{bubbles:!0,composed:!0});this.dispatchEvent(e)}initWebComponent(){const e=this.attachShadow({mode:"open"});te();const t=document.createElement("template");t.innerHTML='<style>:host{--arrow-button-border-radius: var(--jb-calendar-arrow-button-border-radius, var(--jb-radius-sm));--day-button-border-radius: var(--jb-calendar-day-button-border-radius, var(--jb-radius-sm));--month-button-border-radius: var(--jb-calendar-month-button-border-radius, var(--jb-radius-sm));--year-button-border-radius: var(--jb-calendar-year-button-border-radius, var(--jb-radius-sm));--color: var(--jb-calendar-color,var(--jb-text-primary));--arrow-button-bgcolor: var(--jb-calendar-arrow-button-bgcolor, var(--jb-neutral-10));--arrow-fill-color: var(--jb-calendar-arrow-fill-color, var(--jb-neutral-6));--day-text-color-disabled: var(--jb-calendar-day-text-color-disabled, var(--jb-neutral-8));--day-text-color-today: var(--jb-calendar-day-text-color-today, var(--jb-green));--day-bgcolor-selected: var(--jb-calendar-day-bgcolor-selected, var(--jb-neutral));--day-color-selected: var(--jb-calendar-day-color-selected, var(--jb-text-contrast));--day-bgcolor-selected-hover: var(--jb-calendar-day-bgcolor-selected-hover, var(--jb-neutral-2));--day-color-selected-hover: var(--jb-calendar-day-color-selected-hover, var(--jb-text-contrast));--day-bgcolor-hover: var(--jb-calendar-day-bgcolor-hover,var(--jb-neutral-10));--day-color-hover: var(--jb-calendar-day-color-hover, var(--jb-text-primary));--day-text-color: var(--jb-calendar-day-text-color, var(--jb-neutral-4));--status-point-bgcolor-today: var(--jb-calendar-status-point-bgcolor-today, var(--jb-green));--status-point-border-color: var(--jb-calendar-status-point-border-color, var(--jb-white));--month-bgcolor-hover: var(--jb-calendar-month-bgcolor-hover, var(--jb-neutral-10));--month-color-hover: var(--jb-calendar-month-color-hover, var(--jb-text-primary));--year-bgcolor-hover: var(--jb-calendar-year-bgcolor-hover, var(--jb-neutral-10));--year-color-hover: var(--jb-calendar-year-color-hover, var(--jb-text-primary));--swipe-up-icon-color: var(--jb-calendar-arrow-fill-color, var(--arrow-fill-color))}.jb-calendar-web-component{width:272px;height:auto;color:var(--color);font-size:16px}.jb-calendar-web-component .navigator-section{height:32px;width:100%;margin-bottom:24px;display:flex;align-items:center;justify-content:space-between;cursor:pointer}.jb-calendar-web-component .navigator-section .arrow-btn{background-color:var(--arrow-button-bgcolor);width:32px;height:32px;border-radius:var(--arrow-button-border-radius);cursor:pointer;display:flex;justify-content:center;align-items:center;user-select:none}.jb-calendar-web-component .navigator-section .arrow-btn.--css-ltr svg{transform:scaleX(-1)}.jb-calendar-web-component .navigator-section .arrow-btn svg{fill:var(--arrow-fill-color)}.jb-calendar-web-component .navigator-section .navigator-title{user-select:none}.jb-calendar-web-component .navigator-section .navigator-title .month{display:none}.jb-calendar-web-component .navigator-section .navigator-title .month.--show{display:inline}.jb-calendar-web-component .navigator-section .navigator-title .month.--show:hover{font-weight:600}.jb-calendar-web-component .navigator-section .navigator-title .year{display:none}.jb-calendar-web-component .navigator-section .navigator-title .year.--show{display:inline}.jb-calendar-web-component .navigator-section .navigator-title .year.--show:hover{font-weight:600}.jb-calendar-web-component .navigator-section .navigator-title .year-range{display:none}.jb-calendar-web-component .navigator-section .navigator-title .year-range.--show{display:inline}.jb-calendar-web-component .calendar-section{height:auto;width:100%;position:relative}.jb-calendar-web-component .calendar-section .day-selection-section{display:none}.jb-calendar-web-component .calendar-section .day-selection-section.--show{display:block}.jb-calendar-web-component .calendar-section .day-selection-section .week-day-wrapper{display:grid;grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr;grid-template-rows:1fr;gap:4px;height:32px;width:100%;margin-bottom:16px}.jb-calendar-web-component .calendar-section .day-selection-section .week-day-wrapper .week-day{height:32px;text-align:center;font-weight:800;font-variation-settings:"wght" 800;font-size:1em;user-select:none}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container{position:relative;width:100%;height:auto;overflow-x:hidden}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper{display:grid;grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr 1fr;grid-auto-rows:1fr;gap:4px 4px;height:auto;width:100%;user-select:none}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper.current-month-day-wrapper{position:static}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper.prev-month-day-wrapper{position:absolute;top:0;left:100%;width:100%;height:100%;overflow:hidden}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper.prev-month-day-wrapper.--css-ltr{left:-100%}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper.next-month-day-wrapper{position:absolute;top:0;left:-100%;width:100%;height:100%;overflow:hidden}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper.next-month-day-wrapper.--css-ltr{left:100%}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper{position:relative;height:37px;width:32px;user-select:none;cursor:pointer}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper.--disable{cursor:not-allowed}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper.--disable .day-number-wrapper{color:var(--day-text-color-disabled)}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper.--today .day-number-wrapper{color:var(--day-text-color-today)}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper.--today .status-point{display:block}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper.--selected .day-number-wrapper{color:var(--day-color-selected);background-color:var(--day-bgcolor-selected)}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper.--selected:hover .day-number-wrapper{color:var(--day-color-selected-hover);background-color:var(--day-bgcolor-selected-hover)}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper:hover .day-number-wrapper{background-color:var(--day-bgcolor-hover);color:var(--day-color-hover)}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper .day-number-wrapper{width:32px;height:32px;border-radius:var(--day-button-border-radius);color:var(--day-text-color);display:flex;align-items:center;justify-content:center}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper .day-number-wrapper .day-number{display:flex;align-items:center;justify-content:center}.jb-calendar-web-component .calendar-section .day-selection-section .month-day-container .month-day-wrapper .day-wrapper .status-point{position:absolute;width:10px;height:10px;background-color:var(--status-point-bgcolor-today);border-radius:6px;bottom:0px;left:calc(50% - 5px);display:none;z-index:1;border:1px solid var(--status-point-border-color);box-sizing:border-box}.jb-calendar-web-component .calendar-section .month-selection-section{display:none;grid-template-columns:1fr 1fr 1fr;grid-template-rows:1fr 1fr 1fr 1fr;gap:12px 8px}.jb-calendar-web-component .calendar-section .month-selection-section.--show{display:grid}.jb-calendar-web-component .calendar-section .month-selection-section .month-wrapper{width:100%;height:32px;cursor:pointer;border-radius:var(--month-button-border-radius);user-select:none}.jb-calendar-web-component .calendar-section .month-selection-section .month-wrapper:hover{background-color:var(--month-bgcolor-hover)}.jb-calendar-web-component .calendar-section .month-selection-section .month-wrapper .month-name{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.jb-calendar-web-component .calendar-section .month-selection-section .month-wrapper .month-name:hover{color:var(--month-color-hover)}.jb-calendar-web-component .calendar-section .year-selection-section{display:none;width:100%;height:100%;position:relative;overflow-x:hidden}.jb-calendar-web-component .calendar-section .year-selection-section.--show{display:block}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper{display:grid;width:100%;height:100%;grid-template-columns:1fr 1fr 1fr;grid-template-rows:1fr 1fr 1fr 1fr;gap:12px 8px;user-select:none}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper.prev-years-wrapper{position:absolute;top:0;left:100%;width:100%;height:100%;overflow:hidden}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper.prev-years-wrapper.--css-ltr{left:-100%}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper.current-years-wrapper{position:static}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper.next-years-wrapper{position:absolute;top:0;left:-100%;width:100%;height:100%;overflow:hidden}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper.next-years-wrapper.--css-ltr{left:100%}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper .year-wrapper{width:100%;height:32px;cursor:pointer;border-radius:var(--year-button-border-radius);user-select:none}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper .year-wrapper:hover{background-color:var(--year-bgcolor-hover)}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper .year-wrapper .year-number{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.jb-calendar-web-component .calendar-section .year-selection-section .years-wrapper .year-wrapper .year-number:hover{color:var(--year-color-hover)}.jb-calendar-web-component .calendar-section .swipe-up-symbol{display:none;position:absolute;bottom:0px;opacity:0;transition:all .1s 0s ease;width:100%;justify-content:center;align-items:center;flex-direction:column}.jb-calendar-web-component .calendar-section .swipe-up-symbol.--show{display:flex}.jb-calendar-web-component .calendar-section .swipe-up-symbol .swipe-up-text{font-size:.8rem}.jb-calendar-web-component .calendar-section .swipe-up-symbol .swipe-up-icon{fill:var(--swipe-up-icon-color)}</style>\n<div class="jb-calendar-web-component">\r\n <section class="navigator-section">\r\n <div class="prev-btn arrow-btn" title="قبل">\r\n <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fit="" preserveAspectRatio="xMidYMid meet">\r\n <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path>\r\n </svg>\r\n </div>\r\n <div class="navigator-title">\r\n <span class="month"></span>\r\n <span class="year"></span>\r\n <span class="year-range"></span>\r\n </div>\r\n <div class="next-btn arrow-btn" title="بعد">\r\n <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fit="" preserveAspectRatio="xMidYMid meet">\r\n <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"></path>\r\n </svg>\r\n </div>\r\n\r\n </section>\r\n <section class="calendar-section">\r\n <div class="day-selection-section">\r\n <div class="week-day-wrapper">\r\n </div>\r\n <div class="month-day-container">\r\n <div class="prev-month-day-wrapper month-day-wrapper"></div>\r\n <div class="current-month-day-wrapper month-day-wrapper"></div>\r\n <div class="next-month-day-wrapper month-day-wrapper"></div>\r\n </div>\r\n </div>\r\n <div class="month-selection-section">\r\n\r\n </div>\r\n <div class="year-selection-section">\r\n <div class="prev-years-wrapper years-wrapper"></div>\r\n <div class="current-years-wrapper years-wrapper"></div>\r\n <div class="next-years-wrapper years-wrapper"></div>\r\n </div>\r\n <div class="swipe-up-symbol">\r\n <svg class="swipe-up-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\r\n <g clip-path="url(#clip0_403_3281)">\r\n <path d="M23.7101 16.2899L15.5401 8.11994C15.0756 7.65431 14.5239 7.28488 13.9164 7.03281C13.309 6.78075 12.6578 6.651 12.0001 6.651C11.3424 6.651 10.6912 6.78075 10.0838 7.03281C9.47631 7.28488 8.92455 7.65431 8.46009 8.11994L0.290094 16.2899C0.10179 16.4782 -0.0039978 16.7336 -0.0039978 16.9999C-0.0039978 17.2662 0.10179 17.5216 0.290094 17.7099C0.478398 17.8982 0.733792 18.004 1.00009 18.004C1.2664 18.004 1.52179 17.8982 1.71009 17.7099L9.88009 9.53994C10.4426 8.97814 11.2051 8.66258 12.0001 8.66258C12.7951 8.66258 13.5576 8.97814 14.1201 9.53994L22.2901 17.7099C22.3831 17.8037 22.4937 17.8781 22.6155 17.9288C22.7374 17.9796 22.8681 18.0057 23.0001 18.0057C23.1321 18.0057 23.2628 17.9796 23.3847 17.9288C23.5065 17.8781 23.6171 17.8037 23.7101 17.7099C23.8038 17.617 23.8782 17.5064 23.929 17.3845C23.9798 17.2627 24.0059 17.132 24.0059 16.9999C24.0059 16.8679 23.9798 16.7372 23.929 16.6154C23.8782 16.4935 23.8038 16.3829 23.7101 16.2899Z"/>\r\n </g>\r\n <defs>\r\n <clipPath id="clip0_403_3281">\r\n <rect width="24" height="24" fill="white"/>\r\n </clipPath>\r\n </defs>\r\n </svg>\r\n <div class="swipe-up-text">\r\n نمایش سالها\r\n </div>\r\n </div>\r\n </section>\r\n</div>',e.appendChild(t.content.cloneNode(!0)),this.elements={selectionSections:{day:e.querySelector(".day-selection-section"),month:e.querySelector(".month-selection-section"),year:e.querySelector(".year-selection-section")},monthDayWrapper:{current:e.querySelector(".current-month-day-wrapper"),prev:e.querySelector(".prev-month-day-wrapper"),next:e.querySelector(".next-month-day-wrapper")},yearsWrapper:{current:e.querySelector(".current-years-wrapper"),prev:e.querySelector(".prev-years-wrapper"),next:e.querySelector(".next-years-wrapper")},dayOfWeekWrapper:e.querySelector(".week-day-wrapper"),navigatorTitle:{month:e.querySelector(".navigator-title .month"),year:e.querySelector(".navigator-title .year"),yearRange:e.querySelector(".navigator-title .year-range"),nextButton:e.querySelector(".next-btn"),prevButton:e.querySelector(".prev-btn"),wrapper:e.querySelector(".navigator-title")},swipeupSymbol:e.querySelector(".swipe-up-symbol")},this.registerEventHandlers(),window.matchMedia}registerEventHandlers(){this.elements.navigatorTitle.nextButton.addEventListener("click",this.onNextButtonClicked.bind(this)),this.elements.navigatorTitle.prevButton.addEventListener("click",this.onPrevButtonClicked.bind(this)),this.elements.navigatorTitle.year.addEventListener("click",this.onNavigatorTitleYearClicked.bind(this)),this.elements.navigatorTitle.month.addEventListener("click",this.onNavigatorTitleMonthClicked.bind(this)),this.elements.selectionSections.day.addEventListener("touchstart",this.onDayWrapperTouchStart.bind(this)),this.elements.selectionSections.day.addEventListener("touchmove",this.onDayWrapperTouchMove.bind(this)),this.elements.selectionSections.day.addEventListener("touchend",this.onDayWrapperTouchEnd.bind(this)),this.elements.selectionSections.year.addEventListener("touchstart",this.onYearWrapperTouchStart.bind(this)),this.elements.selectionSections.year.addEventListener("touchmove",this.onYearWrapperTouchMove.bind(this)),this.elements.selectionSections.year.addEventListener("touchend",this.onYearWrapperTouchEnd.bind(this))}onDayWrapperTouchStart(e){d(this,re,"f").daysWrapper.startX=e.touches[0].clientX,d(this,re,"f").daysWrapper.startY=e.touches[0].clientY}onDayWrapperTouchMove(e){if(null!==d(this,re,"f").daysWrapper.startX&&null!==d(this,re,"f").daysWrapper.startY){e.preventDefault();const t=e.touches[0].clientX-d(this,re,"f").daysWrapper.startX,a=e.touches[0].clientY-d(this,re,"f").daysWrapper.startY;if(Math.abs(t)>Math.abs(a))this.elements.swipeupSymbol.classList.remove("--show"),this.elements.swipeupSymbol.style.transform="translateY(0px)",this.elements.swipeupSymbol.style.opacity="0",this.elements.monthDayWrapper.current.style.transform=`translateX(${t}px)`,this.elements.monthDayWrapper.prev.style.transform=`translateX(${t}px)`,this.elements.monthDayWrapper.next.style.transform=`translateX(${t}px)`;else if(this.elements.monthDayWrapper.current.style.transform="translateX(0px)",this.elements.monthDayWrapper.prev.style.transform="translateX(0px)",this.elements.monthDayWrapper.next.style.transform="translateX(0px)",this.elements.monthDayWrapper.current.style.transform=`translateY(${a}px)`,a<0){this.elements.swipeupSymbol.classList.add("--show");const e=Math.abs(a)/70;Math.abs(a)>32?this.elements.swipeupSymbol.style.transform="translateY(0px)":this.elements.swipeupSymbol.style.transform=`translateY(${a+32}px)`,this.elements.swipeupSymbol.style.opacity=`${e}`}}}onDayWrapperTouchEnd(e){if(null!==d(this,re,"f").daysWrapper.startX){const t=e.changedTouches[0].clientX-d(this,re,"f").daysWrapper.startX;if(d(this,re,"f").daysWrapper.startX=null,Math.abs(t)>100){let e=t>0?"next":"prev";"ltr"==this.direction&&(e=t>0?"prev":"next"),"prev"==e?(this.elements.monthDayWrapper.current.style.transform="translateX(0px)",this.elements.monthDayWrapper.prev.style.transform="translateX(0px)",this.elements.monthDayWrapper.next.style.transform="translateX(0px)",this.onPrevButtonClicked()):(this.elements.monthDayWrapper.current.style.transform="translateX(0px)",this.elements.monthDayWrapper.prev.style.transform="translateX(0px)",this.elements.monthDayWrapper.next.style.transform="translateX(0px)",this.onNextButtonClicked())}else this.moveBackToPos(this.elements.monthDayWrapper.current),this.moveBackToPos(this.elements.monthDayWrapper.prev),this.moveBackToPos(this.elements.monthDayWrapper.next)}if(null!==d(this,re,"f").daysWrapper.startY){const t=e.changedTouches[0].clientY-d(this,re,"f").daysWrapper.startY;d(this,re,"f").daysWrapper.startY=null,this.elements.swipeupSymbol.classList.remove("--show"),this.elements.swipeupSymbol.style.transform="translateY(0px)",this.elements.swipeupSymbol.style.opacity="0",Math.abs(t)>70&&(this.activeSection=t>0?Se.month:Se.year)}}onYearWrapperTouchStart(e){d(this,re,"f").yearsWrapper.startX=e.touches[0].clientX}onYearWrapperTouchMove(e){null!==d(this,re,"f").yearsWrapper.startX&&(this.elements.yearsWrapper.current.style.transform=`translateX(${e.touches[0].clientX-d(this,re,"f").yearsWrapper.startX}px)`,this.elements.yearsWrapper.prev.style.transform=`translateX(${e.touches[0].clientX-d(this,re,"f").yearsWrapper.startX}px)`,this.elements.yearsWrapper.next.style.transform=`translateX(${e.touches[0].clientX-d(this,re,"f").yearsWrapper.startX}px)`)}onYearWrapperTouchEnd(e){if(null!==d(this,re,"f").yearsWrapper.startX){const t=e.changedTouches[0].clientX-d(this,re,"f").yearsWrapper.startX;d(this,re,"f").yearsWrapper.startX=null;let a=t>0?"next":"prev";"ltr"==this.direction&&(a=t>0?"prev":"next"),Math.abs(t)>100?"prev"==a?(this.elements.yearsWrapper.current.style.transform="translateX(0px)",this.elements.yearsWrapper.prev.style.transform="translateX(0px)",this.elements.yearsWrapper.next.style.transform="translateX(0px)",this.onPrevButtonClicked()):(this.elements.yearsWrapper.current.style.transform="translateX(0px)",this.elements.yearsWrapper.prev.style.transform="translateX(0px)",this.elements.yearsWrapper.next.style.transform="translateX(0px)",this.onNextButtonClicked()):(this.moveBackToPos(this.elements.yearsWrapper.current),this.moveBackToPos(this.elements.yearsWrapper.prev),this.moveBackToPos(this.elements.yearsWrapper.next))}}moveBackToPos(e){e&&(e.style.transition="transform 0.3s 0s ease",setTimeout((()=>{e.style.transition=""}),300),e.style.transform="")}createDataHandler(){const e=(e,t)=>{this.elements.navigatorTitle.year.innerHTML=this.localizeString(e.toString())},t=(e,t)=>{d(this,ae,"m",pe).call(this,e),this.fillMonthDays()},a=e=>{this.elements.navigatorTitle.yearRange.innerHTML=this.localizeString(`${e[0]} - ${e[1]}`),this.fillYearList()};return{set:(r,n,s)=>("selectedYear"==n&&(e(s,r.selectedYear),r[n]=s),"selectedMonth"==n&&(r[n]=s,t(s,r.selectedMonth)),"yearSelectionRange"==n&&Array.isArray(s)&&(r[n]=s,a(s)),!0)}}createDateRestrictionHandler(){return{set:(e,t,a)=>{switch(e[t]=a,t){case"min":case"max":"DAY"==this.activeSection&&this.fillMonthDays()}return!0}}}initProps(){this.callOnInitEvent()}selectToday(){const e=new Date;this.inputType==je?this.select(B(e),A(e)+1,O(e)):this.select(w(e),v(e)+1,b(e))}select(e,t,a){this.value={year:e,month:t,day:a}}initCalendar(){d(this,se,"f")||(this.activeSection=Se.day)}fillYearList(){this.fillYearListDom(this.data.yearSelectionRange[0],this.data.yearSelectionRange[1],"current"),this.fillYearListDom(this.data.yearSelectionRange[0]-12,this.data.yearSelectionRange[1]-12,"prev"),this.fillYearListDom(this.data.yearSelectionRange[0]+12,this.data.yearSelectionRange[1]+12,"next")}fillYearListDom(e,t,a){this.elements.yearsWrapper[a].innerHTML="";for(let r=e;r<=t;r++){const e=this.createYearDom(r);this.elements.yearsWrapper[a].appendChild(e)}}createYearDom(e){const t=document.createElement("div");t.classList.add("year-wrapper");const a=document.createElement("div");return a.classList.add("year-number"),a.innerHTML=this.localizeString(e.toString()),t.appendChild(a),t.addEventListener("click",(()=>{this.data.selectedYear=e,this.activeSection=Se.month})),t}fillMonthDaysDom(e,t,a){const r=d(this,ae,"m",be).call(this,e,t,1),n=d(this,ae,"m",ve).call(this,r);this.elements.monthDayWrapper[a].innerHTML="";for(let e=1;e<n;e++){const e=this.createEmptyDayDom();this.elements.monthDayWrapper[a].appendChild(e)}const s=d(this,ae,"m",we).call(this,r);for(let e=1;e<=s;e++){const t=d(this,ae,"m",be).call(this,this.data.selectedYear,this.data.selectedMonth,e),r=d(this,ae,"m",ge).call(this,e,this.data.selectedMonth,this.data.selectedYear),n=this.value.year==this.data.selectedYear&&this.value.month==this.data.selectedMonth&&this.value.day==e,s=!this.checkIsDayDisable(t).isAllValid,i=this.createDayDom(e,this.data.selectedYear,this.data.selectedMonth,r,n,s);this.elements.monthDayWrapper[a].appendChild(i)}}fillMonthDays(){const e=this.data.selectedMonth,t=this.data.selectedYear;let a,r,n,s;e>1?(a=e-1,r=this.data.selectedYear):(r=this.data.selectedYear-1,a=12),this.fillMonthDaysDom(r,a,"prev"),this.fillMonthDaysDom(t,e,"current"),e<12?(n=e+1,s=this.data.selectedYear):(s=this.data.selectedYear+1,n=1),this.fillMonthDaysDom(s,n,"next")}checkIsDayDisable(e){const t={min:!0,max:!0,get isAllValid(){return this.min&&this.max}};return this.dateRestrictions.min&&(t.min=function(e,t){f(2,arguments);var a=N(e),r=N(t);return a.getTime()>r.getTime()}(e,this.dateRestrictions.min)||g(e,this.dateRestrictions.min)),this.dateRestrictions.max&&(t.max=function(e,t){f(2,arguments);var a=N(e),r=N(t);return a.getTime()<r.getTime()}(e,this.dateRestrictions.max)||g(e,this.dateRestrictions.max)),t}createEmptyDayDom(){const e=document.createElement("div");return e.classList.add("empty-day"),e}createDayDom(e,t,a,r,n,s){const i=document.createElement("div");i.classList.add("day-wrapper"),i.setAttribute("day-number",e.toString()),r&&i.classList.add("--today"),n&&i.classList.add("--selected");const o=document.createElement("div");o.classList.add("day-number-wrapper");const l=document.createElement("div");l.classList.add("day-number"),l.innerHTML=this.localizeString(e.toString());const c=document.createElement("div");return c.classList.add("status-point"),o.appendChild(l),i.appendChild(c),i.appendChild(o),s?i.classList.add("--disable"):i.addEventListener("click",(()=>{this.onDayClicked(t,a,e)})),i}onDayClicked(e,t,a){this.select(e,t,a);const r=new CustomEvent("select");this.dispatchEvent(r)}onNextButtonClicked(){if("DAY"==this.activeSection){const e=this.data.selectedMonth;e<12?this.data.selectedMonth=e+1:(this.data.selectedYear=this.data.selectedYear+1,this.data.selectedMonth=1)}if("MONTH"==this.activeSection&&(this.data.selectedYear=this.data.selectedYear+1),"YEAR"==this.activeSection){const e=this.data.yearSelectionRange[0]+12,t=this.data.yearSelectionRange[1]+12;this.data.yearSelectionRange=[e,t]}}onPrevButtonClicked(){if("DAY"==this.activeSection){const e=this.data.selectedMonth;e>1?this.data.selectedMonth=e-1:(this.data.selectedYear=this.data.selectedYear-1,this.data.selectedMonth=12)}if("MONTH"==this.activeSection&&(this.data.selectedYear=this.data.selectedYear-1),"YEAR"==this.activeSection){const e=this.data.yearSelectionRange[0]-12,t=this.data.yearSelectionRange[1]-12;e>0&&(this.data.yearSelectionRange=[e,t])}}onNavigatorTitleYearClicked(){this.activeSection!=Se.day&&this.activeSection!=Se.month||(this.activeSection=Se.year)}onNavigatorTitleMonthClicked(){this.activeSection==Se.day&&(this.activeSection=Se.month)}onInputTypeChange(){this.setCalendarData(),this.fillDayOfWeek(),d(this,ae,"m",ye).call(this)}localizeString(e){return this.showPersianNumber?(0,t.enToFaDigits)(e):e}};re=new WeakMap,ne=new WeakMap,se=new WeakMap,ie=new WeakMap,oe=new WeakMap,le=new WeakMap,ce=new WeakMap,he=new WeakMap,de=new WeakMap,ae=new WeakSet,pe=function(e){const t=this.inputType==je?d(this,le,"f")[e-1]:d(this,ce,"f")[e-1];this.elements.navigatorTitle.month.innerHTML=t},me=function(e){return[2,3,4,5,6,7,1][e]},ye=function(){this.elements.selectionSections.month.innerHTML="";for(let e=1;e<13;e++){const t=d(this,ae,"m",ue).call(this,e);this.elements.selectionSections.month.appendChild(t)}},ue=function(e){const t=document.createElement("div");t.classList.add("month-wrapper");const a=document.createElement("div");a.classList.add("month-name");const r=this.inputType==je?d(this,le,"f")[e-1]:d(this,ce,"f")[e-1];return a.innerHTML=r,t.appendChild(a),t.addEventListener("click",(()=>{this.data.selectedMonth=e,this.activeSection=Se.day})),t},be=function(e,t,a){return this.inputType==je?function(e,t,a){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;return f(3,arguments),C(e,t,a,r,n,s,i)}(e,t-1,a):new Date(e,t-1,a)},ve=function(e){return this.inputType==je?d(this,ae,"m",me).call(this,O(e)):b(e)},we=function(e){return this.inputType==je?P(e):function(e){y(1,arguments);var t=u(e),a=t.getFullYear(),r=t.getMonth(),n=new Date(0);return n.setFullYear(a,r+1,0),n.setHours(0,0,0,0),n.getDate()}(e)},ge=function(e,t,a){const r=new Date;return this.inputType==je?B(r)==a&&A(r)==t-1&&function(e){return f(1,arguments),E(N(e))}(r)==e:w(r)==a&&v(r)==t-1&&function(e){return y(1,arguments),u(e).getDate()}(r)==e};!customElements.get("jb-calendar")&&window.customElements.define("jb-calendar",We),Object.defineProperty(e,"JBCalendarSections",{enumerable:!0,get:function(){return Se}}),e.JBCalendarWebComponent=We}));
//# sourceMappingURL=jb-calendar.umd.js.map