
    ihoJ                    \   d dl mZ d dlmZ d dlmZmZ d dlmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZmZmZmZmZ d dlm Z m!Z!m"Z" d dl#m$Z$m%Z%m&Z&m'Z'm(Z( erd dl)m*Z*  e%ed	ed
ed
ed	ed
ed
edi      Z+ G d de$e e!e"      Z, G d de,      Z- G d de,      Z. G d d      Z/y)    )annotations)gettext)OptionalTYPE_CHECKING)JANFEBMARAPRMAYJUNSEPOCTDECMONTUEWEDTHUFRISATSUN_get_nth_weekday_of_month)
GOVERNMENTOPTIONALPUBLICSCHOOLWORKDAY)ChineseCalendarHolidaysInternationalHolidaysStaticHolidays)ObservedHolidayBaseObservedRuleSAT_TO_PREV_WORKDAYSUN_TO_NEXT_WORKDAYSAT_SUN_TO_NEXT_WORKDAY)date   c                       e Zd ZdZdZ ed      Z ed      Z ed      ZdZ	e
eeeefZdZdZ fd	Zdd
Z	 d	 	 	 	 	 	 	 ddZd Zd Zd Zd Zd Z xZS )Taiwanu
  Taiwan holidays.

    References:
        * <https://zh.wikipedia.org/wiki/中華民國節日與歲時列表>
        * <https://en.wikipedia.org/wiki/Public_holidays_in_Taiwan>

    Commemorative Day and Day Implementation Method Amendments:
        * [Ministry of Interior (87) Order No. 8706459](https://web.archive.org/web/20250501035936/https://zh.wikisource.org/wiki/紀念日及節日實施辦法_(民國87年))
        * [Ministry of Interior (88) Order No. 8897074](https://web.archive.org/web/20250429134107/https://zh.wikisource.org/wiki/紀念日及節日實施辦法_(民國88年))
        * [Ministry of Interior (89) Order No. 8972185](https://web.archive.org/web/20250429134119/https://zh.wikisource.org/wiki/紀念日及節日實施辦法_(民國89年2月))
        * [Ministry of Interior (89) Order No. 8962562](https://web.archive.org/web/20250429134023/https://zh.wikisource.org/wiki/紀念日及節日實施辦法_(民國89年12月))
        * [Ministry of Interior Order No. 0950045320](https://web.archive.org/web/20240916001724/https://law.moj.gov.tw/LawClass/LawOldVer.aspx?pcode=D0020033&lnndate=20060309&lser=001)
        * [Ministry of Interior Order No. 0960110433](https://web.archive.org/web/20240915222212/https://law.moj.gov.tw/LawClass/LawOldVer.aspx?pcode=D0020033&lnndate=20070711&lser=001)
        * [Ministry of Interior Order No. 0960131407](https://web.archive.org/web/20240915222212/https://law.moj.gov.tw/LawClass/LawOldVer.aspx?pcode=D0020033&lnndate=20070711&lser=001)
        * [Ministry of Interior Order No. 0960155673](https://web.archive.org/web/20240916000901/https://law.moj.gov.tw/LawClass/LawOldVer.aspx?pcode=D0020033&lnndate=20071003&lser=001)
        * [Ministry of Interior Order No. 0990212117](https://web.archive.org/web/20240916004712/https://law.moj.gov.tw/LawClass/LawOldVer.aspx?pcode=D0020033&lnndate=20101102&lser=001)
        * [Ministry of Interior Order No. 1010307327 and 1030128812](https://web.archive.org/web/20240919205138/https://law.moj.gov.tw/LawClass/LawOldVer.aspx?pcode=D0020033&lnndate=20120925&lser=001)
        * [Ministry of Interior Order No. 1030182404](https://web.archive.org/web/20250227171607/https://law.moj.gov.tw/LawClass/LawAll.aspx?pcode=D0020033)
        * [Decree No. 11400053171](https://web.archive.org/web/20250602210918/https://law.moj.gov.tw/News/newsdetail.aspx?msgid=191745)

    Checked With:
        * [DGPA Work Calendar (1998-2025; Chinese)](https://web.archive.org/web/20250307201828/https://www.dgpa.gov.tw/informationlist?uid=30)
        * [DGPA Work Calendar (2001-2025; English)](https://web.archive.org/web/20240606012108/http://www.dgpa.gov.tw/en/informationlist?uid=353)
    TWu   %s（推定）u   %s（補假，推定）u   %s（補假）zh_TW)en_USthzh_CNr,     c                    t        j                  |        t        j                  |        t        j                  | t               |j                  dt        t        z          t        |   |i | y )Nobserved_rule)	r   __init__r   r   TaiwanStaticHolidays
setdefaultr"   r#   super)selfargskwargs	__class__s      Y/var/www/api/v1/venv_fitandmore/lib/python3.12/site-packages/holidays/countries/taiwan.pyr3   zTaiwan.__init__\   sY    ((.&&t,&:;/+>AT+TU$)&)    c                B   |j                   dk  rt        h}|j                         t        k(  rc|t	        dt        |j
                  |j                         t	        dt        |j
                  |j                         hv r|j                  t               |S t        t        h}|S )N        )yearr   weekdayr   r   monthadd)r7   dtweekends      r;   _get_weekendzTaiwan._get_weekendc   s    77d?eGzz|s"-abhhH-abhhH  KK$  CjGr<   c           	         | j                   |k  ry| j                  d      }t        |      D ]F  }| j                  |      }|D ].  }| j	                  ||||k(  rt        |      dkD  rt        n|       0 H y)ub  
        Taiwan's General Observance Rule first started in 2015 as per
        decreed in 內政部台內民字第1030182404號令.

        Children's Day Special Observance Rule first started in 2012 as per
        decreed in 內政部台內民字第1010307327號令 - as this doesn't affect 2011 ones,
        as such the logic is simplified.
        N	   兒童節r&   )_yeartrsortedget_list_add_observedlenCHILDRENS_DAY_RULE)r7   dtsrulesincechildrens_dayrE   namesnames           r;   _populate_observedzTaiwan._populate_observedr   sv     :: ,+BMM"%E""*.-*?CJQRN&X\	  r<   c                   t               }t               }t        d      }|j                  | j                  |             | j                  dk\  r| j                  | j                  |       t        d      }| j                  dk\  r |j                  | j                  |             |j                  | j                  |             t        d      }|j                  | j                  |             |j                  | j                  |             |j                  | j                  |             |j                  | j                  t        d                   | j                  dk\  r)|j                  | j                  t        d	                   |j                  | j                  t        d
                   | j                  dk\  r| j                  t        d             |j                  | j!                  t        d                   |j                  | j#                  t        d                   | j                  dk\  r| j%                  t        d             |j                  | j'                  t        d                   | j                  dk\  r4| j)                  t        d             | j+                  t        d             | j,                  r*| j/                  |       | j/                  |t0        d       y y )N   中華民國開國紀念日  )rV   u   農曆除夕i     春節u   和平紀念日i  rI      民族掃墓節	   勞動節	   端午節u	   中秋節     孔子誕辰紀念日u	   國慶日u-   臺灣光復暨金門古寧頭大捷紀念日   行憲紀念日i  )rR   rS   )setrK   rD   _add_new_years_dayrJ   rN   _next_year_new_years_day%_add_chinese_day_before_new_years_eve_add_chinese_new_years_eve_add_chinese_new_years_day_add_chinese_new_years_day_two _add_chinese_new_years_day_three_add_holiday_feb_28_add_holiday_apr_4_add_qingming_festival_add_labor_day_add_dragon_boat_festival_add_mid_autumn_festival_add_holiday_sep_28_add_holiday_oct_10_add_holiday_oct_25_add_holiday_dec_25observedrW   r$   )r7   dts_observeddts_observed_forwardrV   s       r;   _populate_public_holidaysz Taiwan._populate_public_holidays   sm   u"u /00067::t<<4H .!:: $$T%O%OPT%UV  !@!@!FG (|  !@!@!FG  !D!DT!JK  !F!Ft!LM 	11"5F2GHI::T44R_EF 	44R8I5JKL::;0 	77;HI 	66r+GH::$$R(?%@A 	11"[/BC::$$R(W%XY $$R(9%:;==##L1 ##$8?V^b#c	 r<   c                \   | j                   dk  r| j                  t        d             | j                  t        d             | j	                  t        d             | j                  t        d             | j                  t        d             | j                  t        d             y y )Nr>   rY   r`      臺灣光復節!   先總統　蔣公誕辰紀念日   國父誕辰紀念日ra   )rJ   _add_new_years_day_tworK   rp   rr   _add_holiday_oct_31_add_holiday_nov_12rs   r7   s    r;   _populate_school_holidaysz Taiwan._populate_school_holidays   s    ::''+H(IJ $$R(?%@A $$R(9%:; $$R(K%LM $$R(?%@A $$R(9%:;# r<   c                x    | j                          | j                  dk  r| j                  t        d             y y )Nr>      革命先烈紀念日)r   rJ   _add_holiday_mar_29rK   r   s    r;   _populate_government_holidaysz$Taiwan._populate_government_holidays   s3    &&(::$$R(?%@A r<   c                    | j                   dk  r| j                  t        d             | j                  t        d             y )Nr_   r]   	   軍人節)rJ   rm   rK   _add_holiday_sep_3r   s    r;   _populate_optional_holidaysz"Taiwan._populate_optional_holidays   s4    ::;0 	;0r<   c                   | j                  t        d             | j                  t        d             | j                  t        d             | j                  t        d             | j	                  t        d             | j                  t        d             | j                  dk  r| j                  t        d             | j                  d	k  r| j                  t        d
             | j                  dk\  r| j                  t        d             | j                  dk\  r| j                  t        d             | j                  t        d             | j                  dk  r4| j                  t        d             | j                  t        d             | j	                  t        d             | j                  dk  r| j                  t        d             | j                  dk  r| j                  t        d             | j                  dk\  r| j                  t        d             | j                  dk\  r5| j                  t        d             | j!                  t        d             y y )Nu   國父逝世紀念日u	   植樹節u	   青年節u	   教師節u   中華文化復興節	   婦女節  u   先總統蔣公逝世紀念日  rI   r>      佛陀誕辰紀念日  u	   道教節r     r`   ry   r{   ra     rz   u   反侵略日i  u   解嚴紀念日u   臺灣聯合國日)_add_holiday_mar_12rK   r   rp   r~   _add_womens_dayrJ   rl   rk   _add_chinese_birthday_of_buddharg   rr   rs   r}   _add_holiday_mar_14_add_holiday_jul_15_add_united_nations_dayr   s    r;   _populate_workday_holidaysz!Taiwan._populate_workday_holidays   s     $;!<= 	  K1 	  K1 	  K1 	  $;!<= 	R_-::''+K(LM::##B{O4::004K1LM::++B{O< $$R(?%@AzzT!((,C)DE ((,=)>? $$R(?%@AzzT!((,=)>?zzT!((,O)PQ::$$R%78::$$R(9%:; ((,@)AB r<   )rE   r%   returnzset[int])NrZ   )rQ   z	set[date]rR   zOptional[ObservedRule]rS   intr   None)__name__
__module____qualname____doc__countryrK   estimated_labelobserved_estimated_labelobserved_labeldefault_languager   r   r   r   r   supported_categoriessupported_languages
start_yearr3   rG   rW   rw   r   r   r   r   __classcell__)r:   s   @r;   r*   r*   5   s    2 G)*O!";<()N&&&'J;J*  QU$:JM	4<d|<(B1ACr<   r*   c                      e Zd Zy)r+   Nr   r   r    r<   r;   r+   r+   1      r<   r+   c                      e Zd Zy)TWNNr   r   r<   r;   r   r   5  r   r<   r   c            
      *   e Zd ZdZ ed      Z ed      Z ed      Z ed      Zi de	de	dfd	e
d
e
dfdededfdededfdededfe	de	dfededfededffde
de
dfe
de
dfededffdededfde
d ed!fed edfed"ed
ffd#ed$edfededffd%e
ded d&fd'ed(e
dfeded!fed)edffd*ed edfededfededffd+e	ded"fed"ed
ffd,ede
dfed-edfed.edffd/e
ded$fed0edfeded0ffd1ededfeded.ffd2ed!e
d
fe
de
dfe
d ed!fed edfe	ded3fededfededffededfe
d edfd4Ze	d!efe	d!effe	d!efe	d!effe	defe	defed! ed5      ffd6Ze
d" ed7      fe	d ed8      ffe
d ed9      fed ed:      ffed ed;      fe	defd<Zy=)>r4   a  Taiwan special holidays.

    DGPA, Executive Yuan Work Calendars:
        * [1998](https://web.archive.org/web/20240119034602/https://www.dgpa.gov.tw/information?pid=4979&uid=30)
        * [1999](https://web.archive.org/web/20240119034606/https://www.dgpa.gov.tw/information?pid=4978&uid=30)
        * [2000](https://web.archive.org/web/20231230164623/https://www.dgpa.gov.tw/information?uid=30&pid=4977)
        * [2001](https://web.archive.org/web/20220809165413/https://www.dgpa.gov.tw/en/information?uid=353&pid=6199)
        * [2002](https://web.archive.org/web/20220809163821/https://www.dgpa.gov.tw/en/information?uid=353&pid=6198)
        * [2003](https://web.archive.org/web/20220809161706/https://www.dgpa.gov.tw/en/information?uid=353&pid=6197)
        * [2004](https://web.archive.org/web/20220809175339/https://www.dgpa.gov.tw/en/information?uid=353&pid=6196)
        * [2005](https://web.archive.org/web/20220809173619/https://www.dgpa.gov.tw/en/information?uid=353&pid=6195)
        * [2006](https://web.archive.org/web/20250427175035/https://www.dgpa.gov.tw/en/information?uid=353&pid=6192)
        * [2007](https://web.archive.org/web/20250427175157/https://www.dgpa.gov.tw/en/information?uid=353&pid=6194)
        * [2008](https://web.archive.org/web/20250427175031/https://www.dgpa.gov.tw/en/information?uid=353&pid=6191)
        * [2009](https://web.archive.org/web/20250427175008/https://www.dgpa.gov.tw/en/information?uid=353&pid=6190)
        * [2010](https://web.archive.org/web/20240913193941/https://www.dgpa.gov.tw/en/information?pid=6189&uid=353)
        * [2011](https://web.archive.org/web/20250427175006/https://www.dgpa.gov.tw/en/information?uid=353&pid=6188)
        * [2012](https://web.archive.org/web/20250427175006/https://www.dgpa.gov.tw/en/information?uid=353&pid=6187)
        * [2013](https://web.archive.org/web/20250427174956/https://www.dgpa.gov.tw/en/information?uid=353&pid=6186)
        * [2014](https://web.archive.org/web/20220809133242/https://www.dgpa.gov.tw/en/information?uid=353&pid=6183)
        * [2015](https://web.archive.org/web/20220809133240/https://www.dgpa.gov.tw/en/information?uid=353&pid=6182)
        * [2016](https://web.archive.org/web/20220809133238/https://www.dgpa.gov.tw/en/information?uid=353&pid=6180)
        * [2017](https://web.archive.org/web/20220809133236/https://www.dgpa.gov.tw/en/information?uid=353&pid=6178)
        * [2018](https://web.archive.org/web/20240518122217/https://www.dgpa.gov.tw/en/information?uid=353&pid=7730)
        * [2019](https://web.archive.org/web/20240422121421/http://www.dgpa.gov.tw/en/information?uid=353&pid=8178)
        * [2020](https://web.archive.org/web/20240914094053/https://www.dgpa.gov.tw/en/information?pid=9724&uid=353)
        * [2021](https://web.archive.org/web/20240615041915/https://www.dgpa.gov.tw/en/information?uid=353&pid=10181)
        * [2022](https://web.archive.org/web/20220809133226/https://www.dgpa.gov.tw/en/information?uid=353&pid=10659)
        * [2023](https://web.archive.org/web/20220809133225/https://www.dgpa.gov.tw/en/information?uid=353&pid=11016)
        * [2024](https://web.archive.org/web/20250414165829/https://www.dgpa.gov.tw/en/information?uid=353&pid=11402)
        * [2025](https://web.archive.org/web/20250121091032/https://www.dgpa.gov.tw/en/information?uid=353&pid=11979)
    z%Y-%m-%du   休息日（%s日起取代）r   rI   r>         r         i        r   	      r                  i  r?   
         r      i     r@           rZ   i  i        i  i  i  r&      i     i  i     )i  r   r_   r   )r0     r>   r[   r\   rY   r^   r   )r0   r   r>   r   N)r   r   r   r   rK   substituted_date_formatsubstituted_label
womens_dayrT   r
   r   r   r   r	   r   r   r   r   special_public_holidays"special_optional_holidays_observed special_public_holidays_observedr   r<   r;   r4   r4   9  s   D !n :; KJ {OMBsAsABsBR B 	sAsAB 	sAsB	B
 	"c1!S""c2"c2	
B 	!S""c2"c1
B  	sBQ!B" 	"c1"c1"c2
#B, 	"c2"c2
-B4 	sAsB%5B6 	"c2"c1"c2
7B@ 	"c2"c1!S"
ABJ 	!S""c2
KBR 	!S"!S""c1
SB\ 	"c2"c2!S"
]Bf 	"c2"c2
gBn 	sAsBoBr "c1"c1"c2!S""c2!S"
 AsBBQCBN !]#!Z 

 !]#!Z 

 !]#!Z !R_%	
*&( "bl#!R)*+	
 !R567"bo&	
 B234A}%($r<   r4   N)0
__future__r   r   rK   typingr   r   holidays.calendars.gregorianr   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   holidays.constantsr   r   r   r   r   holidays.groupsr   r   r   holidays.observed_holiday_baser    r!   r"   r#   r$   datetimer%   rP   r*   r+   r   r4   r   r<   r;   <module>r      s    # ! *    & M L Z Z  !3CS"c2sBPSUWY\^`"ab yC "9;PR` yCx	 		& 	T Tr<   