+
   \3c                   stM  a  ER[ t0 t R t^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RIH
t
 ^ R	IHt ^ R
IHt ^ RIHt ^ RIt]P                  ER\8  d   ^ RIHt M^ RIHt ^ RIHtHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI t ^ RI!t ^ RI"t#^ RI$H%t% ^ RIH&t& ^ RI'H(t( ](! RR4       ^ RI)H*t* ](! RR4       ^ RI)H+t+ ^ RI,H-t-H.t.H/t/H0t0 ]'       d	   ^ RI)H.t.H-t- ^ RI1t1Rt2 ^ RI3t3]3Ph                  ]3n5        ]3t6Rt2Rt8 ^ RI9t9Rt8Rt: ^ RI;t;Rt:Rt< ^ RI=t=Rt<Rt> ^ RI?t?Rt>Rt@ ^ RIAtARt@]P                  ! R4      tCRtDR R ltER R  ltF]6P                  ! R!4      tHER]tI. ER^OtJ]*P                  P                  ]*P                  P                  ( ,          ]*P                  P                  ( ,          ]*P                  P                  ( ,          tP^
tQ^
tRR"tS] ^ k ER_tTER`tUERatVERbtWR#tXR$R%R&R'R(/R)R*R&R+R(/R,R-R&//tY]YR$,          ]YR.&   ]YR$,          ]YR/&   ]YR$,          ]YR0&   ]YR$,          ]YR1&   ERctZ/ R2R&bR3R&bR4R&bR5R&bR6R&bR7R&bR8R&bR9R&bR:R&bR;R&bR<R&bR=R&bR>R?bR@R&bRAR&bRBR&bRCR&b/ RDR&bRER&bRFRGbRHR&bRIR&bRJR&bRKR&bRLR&bRMR&bRNR&bROR&bRPR&bRQR&bRRR&bRSR&bRTR&bRUR&bC/ RVR&bRWR&bRXR&bRYR&bRZR&bR[R&bR\R&bR]R&bR^R&bR_R&bR`R&bRaR&bRbR&bRcR&bRdR&bReR?bRfR&bC/ RgR&bRhR?bRiR&bRjR&bRkR&bRlR&bRmR&bRnR&bRoR&bRpR&bRqR&bRrR&bRsR&bRtR&bRuR&bRvR&bRwR&bC/ RxR&bRyR&bRzR&bR{R&bR|R&bR}R&bR~RGbRR&bRR&bRR&bRR&bRR&bRR&bRR&bRR&bRR&bRR&bCt[. ERdNEReNERfNERgNERhNERiNERjNERkNERlNERmNERnNERoNERpNERqNERrNERsNERtNERuNERvNERwNERxNERyNERzNER{NER|NER}NER~NERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNERNt\/ R2RR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./b/ RRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RR./bRRRR.RRR./bR3RR.RR./bR4RR.RR./bC/ R5RR.RR./bRRR.RR./bR6RR.RR./bRRRR.RRR./bR7RR.RR./bRRRR.RR./bR8RR.RR./bR9RR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bR:RR.RR./bR;RR.RR./bR<RR.RR./bR=RR.RR./bR>RR.RR./bC/ R@RR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRRR.RR./bRARR.RR./bRBRR.RR./bRCRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bC/ RRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bC/ RRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bRRR.RR./bC/ RRR.RR./bRRR.RR./bER RR.RER ./bERRR.RER./bERRR.RER./bERRR.RER./bERRR.RER./bERRR.RER./bRERR.RER./bERRR.RER	./bER
RR.RER./bERRR.RER./bRHRR.RER./bRIRR.RR$./bR/RR.RR/./bR)RR.RR)./bR1RR.RR1./bC/ R0RR.RR0./bR.RR.RR../bRJRR.RER./bRKRR.RER./bERRR.RER./bRLRR.RER./bRMRR.RER./bRNRR.RER./bRORR.RRO./bERRERR.RERR./bRPRR.RER./bRQRR.RRQ./bERRR.RER./bERRERR.RERR./bERRR.RER./bRRRR.RER./bRSRR.RER ./bC/ RTRR.RER!./bRURR.RER"./bER#RR.RER$./bRVRR.RRV./bER%RR.RER&./bRWRR.RER'./bRXRR.RER(./bER)RR.RER)./bRYRR.RER*./bER+RR.RER,./bER-RER.R.RER/R./bER0RER1R.RER2R./bER3RER4R.RR./bER5RER6R.RR./bER7RER8R.RR./bRZRR.RER9./bER:RR.RER:./bC/ R[RR.RER;./bER<RR.RER<./bR\RR.RER=./bR]RR.RER>./bER?RR.RER@./bR^RR.RERA./bERBRERCR.RERDR./bR_RR.RR_./bR`RR.RERE./bRaRR.RERF./bERGRERHR.RERIR./bRbRR.RERJ./bERKRERLR.RR./bERMRERNR.RR./bRcRR.RERO./bERPRERQR.RERRR./bERSRR.RERT./bC/ ERURR.RERU./bRdRR.RERV./bReRR.RERW./bERXRR.RERW./bRfRR.RERY./bERZRR.RERZ./bER[RER\R.RER]R./bER^RER_R.RER^R./bRgRR.RER`./bERaRR.RERa./bERbRR.RERb./bRhRR.RERc./bRiRR.RERd./bRjRR.RERe./bRkRR.RERf./bRlRR.RERg./bERhRR.RERi./bC/ ERjRR.RERj./bERkRERlR.RERmR./bERnRERoR.RERpR./bERqRR.RR./bRmRR.RERr./bRnRR.RRn./bRoRR.RERs./bERtRR.RERt./bERuRR.RERu./bERsRR.RERs./bRpRR.RERv./bRqRR.RERw./bERxRR.RERy./bRrRR.RERz./bER{RR.RER{./bER|RR.RER}./bER~RERR.RR./bC/ ERRERR.RR./bRsRR.RER./bERRR.RR./bERRR.RR./bERRERR.RR./bRtRR.RER./bERRR.RER./bERRR.RER./bRuRR.RER./bERRR.RER./bERRR.RER./bRvRR.RER./bERRERR.RERR./bRwRR.RER./bRxRR.RER./bRyRR.RER./bERRR.RER./bC/ ERRR.RER./bERRR.RER./bERRR.RER./bERRR.RER./bRzRR.RER./bR{RR.RER./bERRR.RER./bERRR.RER./bR|RR.RER./bR}RR.RER./bR~RR.RER./bERRR.RER./bERRR.RER./bERRR.RER./bERRERR.RERR./bERRERR.RERR./bRRR.RER./bC/ ERRR.RER./bERRR.RER./bERRR.RER./bERRR.RER./bRRR.RER./bERRR.RER./bRRR.RER./bERRR.RER./bERRR.RER./bRRR.RER./bRRR.RER./bERRR.RER./bERRERR.RERR./bRRR.RER./bRRR.RER./bRRRER.RER./bRRR.RER./bCRRR.RER./ERRRER.RERR./ERRR.RERR.//Ct]ER ER lt^ER ER lt_ER ER lt`ER ER lta0 RkRkRkRkERkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkERkRkRkERkERkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkER kERkERkERkERkERkERkER	kERkERkERkR/kR)kR1kR$kR0kR.kERkERkERkERkERkERkROkERkERkERkRQkERkERkERkERkER kER!kER"kER$kRVkER&kER'kER)kER(kER*kER,kERkERkERkER/kER2kER:kER9kER;kER<kER=kER>kER@kERAkERDkR_kEREkERFkERIkERJkEROkERRkERUkERTkERVkERWkERYkERZkER^kER]kERakERbkER`kERckERdkERekERfkERgkERikERjkERmkERpkERrkRnkERtkERukERskERvkERwkERykERzkER{kER}kERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkRkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERktb0 R2kRkRkERkERkRkRkRkRkRkERkRkRkRkRkRkERkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkERkRkRkRkRkRkRkERkERkR3kRkR4kERkERkERkERkERkERkR5kRkERkERkERkERkERkR6kRkERkERkERkERkRkERkRkERkERkERkR7kRkRkERkR8kERkERkERkERkR9kRkRkERkRkRkERkERkERkERkERkERkERkER kERkERkERkERkERkR:kRkERkERkR<kR=kRkR>kRkERkERkERkR@kRkRkRkRkER	kRkRkER
kERkRkRAkRkERkERkERkERkERkERkERkERkERkERkERkRBkRkRkRCkERkERkRkERkERkERkRkERkERkERkERkRkRkRkRkER kER!kER"kER#kER$kER%kER&kER'kRkER(kER)kER*kER+kER,kER-kRkER.kER/kRkER0kER1kER2kER3kRkRkER4kER5kRkER6kER7kRkER8kER9kER:kER;kER<kER=kER>kER?kER@kERAkERBkERCkERDkEREkRkERFkRkERGkRkERHkERIkERJkRkERKkRkERLkERMkERNkEROkERPkERQkERRkERSkERTkRkERUkERVkERWkERXkERYkERZkER[kER\kER]kRkER^kER_kER`kERakRkERbkERckERdkERekERfkERgkRkRkRkRkERhkRDkERikRkRkERjkERkkRkRkRkRkRkERlkRkRkERmkRkRkERnkRkRkRkRkERokRkER kERkERkERkERkERkERkREkERkERpkERqkERkERrkER	kERskERtkRFkERukER
kERkRHkERvkERkRIkR/kERwkERxkERykERzkR)kER{kER|kER}kR1kER~kERkERkERkR$kERkERkERkERkERkERkERkR0kERkR.kERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkRJkERkRKkERkRLkERkRMkERkRNkERkERkERkERkERkERkERkERkERkRPkERkERkERkERkERkRQkERkERkERkERkERkERkRRkERkERkRSkER kRUkER"kER#kER$kER%kER&kERkERkERkERkRWkER'kRXkER)kER(kERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkRYkERkER*kERkERkERkERkERkERkER+kER,kER-kER/kER0kERkER2kER3kERkER5kERkERkERkERkERkERkERkRZkERkERkR[kER;kERkERkR\kER=kERkERkERkERkERkR]kERkER>kERkERkERkERkERkERkERkER?kER@kERkERkERkERkERkERkR^kERAkERBkERkERkERkERkERkERkERkR_kERkERkERkERkERkR`kRakERFkERGkERIkRbkERJkERKkERPkERRkERSkERUkERTkERkRdkERVkERkERkERkER kERkERkERkERkRekERWkERkERkERkRfkERYkERZkER[kER^kER]kRgkERakERbkERkER	kER`kER
kERkERkERkRhkERckERkERkERXkERkRjkERkERkERkERkRlkERhkERikERjkERkkERmkERkERkERkERnkERkERkERkERkERkERkRmkERrkERkERkER kER!kRokERtkERukER"kER#kER$kER%kER&kER'kER(kERskER)kER*kRpkER+kERvkER,kER-kER.kER/kER0kER1kER2kERxkER3kERykER4kER5kER6kRrkER7kER8kER9kER:kERzkER{kER|kER}kER;kER<kER~kER=kER>kER?kER@kERkERAkERBkRskERkERCkRtkERkERkERkERDkEREkERFkERGkERHkERIkERJkERKkERLkERMkERNkERkERkRwkERkRxkERkEROkERPkERQkERRkERkERkERkERkERkRzkERkERSkERTkR{kERUkERVkERWkERXkERYkERZkER[kER\kER]kER^kER_kR~kER`kERkERkERkERakERkERkERbkERkERkERckERdkERekERkERkERfkERgkERhkERikERjkERkERkERkERkERkRkERkRkERkkERlkERmkERnkERokERpkERqkERrkERskERtkERukERvkERwkRkERkERkERkERkRkERxkERykERzkER{kER|kER}kER~kERkERkERkERkERkRkERkERkERkERkERkERkERkERkERkRkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERkERktc0 RkRkER$kRkER&kERTkERkRkRkRkRkRkRkRkRkRkRkRkER8kRkRkRkRkER_kRkRkRkRkRkRkRkERkRkERkRkRkRkRkRkER kRkRkRkERkERkERkERkR)kR$kERkERkERkERkERkER'kER(kERkER/kER,kERkERAkER@kER"kERIkERRkER`kER]kERWkERrkERukERskERykERkERkERkERkERkERkERukERkERkERekERckERdkERkERkERokERkERkRkRkERzkERkERkERkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkER	kERkERkER2kERkERkERkERkERktd]e! 4       tf]fP                  ]b4       ]fP                  ]c4       ]fP                  ]d4       / ERERbER6ERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERb/ ERERbERERbERERbRERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbR2ERbERERbRERbC/ RERbRERbRERbERERbR3ERbR4ERbERERbR5ERbERERbERERbR6ERbERERbERERbRERbERERbR7ERbRERbC/ R8ERbR9ERbERERbERERbERERbERERbERERbERERbRERbR:ERbERERbR=ERbRERbR>ERbERERbR@ERbER
ERbC/ RAERbRERbERERbERERbERERbERERbERERbRBERbRCERbRERbRDERbERERbREERbERpERbERERbERsERbRFERbC/ ER
ERbERERbRHERbRIERbRJERbRKERbRLERbRMERbERERbRNERbROERbERERbERERbERERbRPERbERERbRQERbC/ ERERbERERbRRERbRSERbRTERbRUERbER#ERbRVERbER%ERbERERbERERbRWERbRXERbERERbERERbERERbERERbC/ ERERbERERbERERbERERbERERbERERbERERbERERbRYERbERERbERERbERERbER+ERbER-ERbER0ERbER3ERbER5ERbC/ ERERbERERbERERbRZERbERERbR[ERbER<ERbERERbR\ERbERERbERERbR]ERbERERbERERbER?ERbERERbERERbC/ ERR&bERERbR^ERbERBERbERERbERERbERERbR_ERbERERbERERbR`ERbRaERbERGERbRbERbERKERbRcERbERPERbC/ ERSERbRdERbERERbERERbERERbERERbReERbERERbRfERbER[ERbRgERbERERbRhERbERERbERXERbRiERbRjERbC/ ERERbRkERbERERbRlERbERhERbERkERbERERbERnERbERERbRmERbRnERbERERbER ERbRoERbRpERbRqERbER/ERbC/ ER1ERbERxERbER4ERbRrERbER|ERbER;ERbER~ERbER=ERbER?ERbERERbERAERbRsERbERERbRtERbERDERbERFERbERHERbC/ RuERbERJERbRvERbERERbRwERbRxERbRyERbEROERbERQERbERERbRzERbR{ERbR|ERbR}ERbER_ERbR~ERbERERbC/ ERERbERERbERfERbRERbERiERbERERbERERbRERbERERbRERbERkERbERERbERmERbRERbERpERbERrERbERtERbC/ ERvERbRERbERERbRERbER~ERbRERbRERbERERbERERbRERbERERbERERbRERbERERbERERbERERbERERbCERERERERERERERERERERERERERERERER/CthER ER ltiER ER ltjER ER ltkER ER ltl]P                  ! RER7      ER ER l4       tn]6P                  ! ER4      toER ERERERERERERER/tp]P                  ! ER. ERO4      trER ER	 ltsER
 ER lttERtuER ER ltvER ER ltwER ER ltxERER ER lltyER ER ltzER ER lt{ER ER lt|ER ER lt}ER ER lt~]6P                  ! ER4      t]6P                  ! ER]6EP                   4      tER  ER! ltERER" ER# lltER$ ER% ltER& ER' ltER( ER) lt]! ER*4      ER+]! ER,4      R|]! ER-4      ER]! ER.4      ER/]! ER04      ER1]! ER24      ER3]! ER44      ER5]! ER64      ER7]! ER84      ER]! ER94      ER:]! ER;4      ER<]! ER=4      ER]! ER>4      ER]! ER?4      ER/t]P                  ! RER7      ERER@ ERA ll4       t/ ERBERCbERDEREbERFERGbERHERIbERJERKbERLERMbERNERObERPERQbERRERSbERTERUbERVERWbERXERYbERZER[bER\ER]bER^ER_bER`ERabERbERcb/ ERdERebERfERgbERhERibERjERkbERlERmbERnERobERpERqbERrERsbERtERubERvERwbERxERybERzER{bER|ER}bER~ERbERERbERERbERERbC/ ERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbCERERERERERERERERERERERERERERERERERERERER/
CtER ER lt/ ERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERb/ ERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbERERbER ERbCERERERERERERERERERERERERERERER	ER	ER
ER
ERERERERERERERER/Ct]6P                  ! EREP                  ]! ]6EP                  ]EP!                  4       4      4      4      t] ^k ER ER ltER ER ltER ER ltER ER ltER ER ltER ER ltER ER ltER ER ltER  ER! ltER" ER# ltER$ ER% ltER& ER' ltER( ER) ltER* ER+ ltER, ER- ltER. ER/ ltER0 ER1 lt]%! RER27       ! ER3 ER44      4       tERER5 ER6 llt ! ER7 ER8]4      t ! ER9 ER:]4      t ! ER; ER<]4      t ! ER= ER>4      t ! ER? ER@4      tERA ERB ltERC ERD ltERE ERF lt ! ERG ERH4      t ! ERI ERJ4      tERK ERL ltERM ERN lt ! ERO ERP4      t ! ERQ ERR4      t ! ERS ERT].EPf                  4      tERUt] ^k ]! ]^
,          4      t] ^k  ! ERV ERW4      t]ERX8X  d   ]EPt                  ! ]EPv                  ERY7      t]CEP{                  ]EP|                  4       ]CEP                  ]4       ^ RIt]EP                  ! 4       w  tt]CEP                  ERZ]EP                  4       4       ]EP                  ! ]4       R# R#   ]7 d    ^ RI6t6Rt2 E%LFi ; i  ]73 d    Rt8 E%LNi ; i  ]73 d    Rt: E%LVi ; i  ]73 d    Rt< E%L^i ; i  ]73 d    Rt> E%Lfi ; i  ]73 d    Rt@ E%Lni ; i(  z/
Utility functions used in ibus-typing-booster
Any)Tuple)List)Dict)DefaultDict)Set)Optional)Union)Iterable)Pattern)TYPE_CHECKINGN)Literal)EnumFlag)	dataclass)defaultdict)require_versionIBusz1.0)r   GLibz2.0)r   )GdkGtk	GTK_MAJORGTK_VERSION)r   r   FTzibus-typing-boosterc                0    V ^8  d   QhR\         R\         /#    textreturnstrformat   "1/usr/share/ibus-typing-booster/engine/itb_util.py__annotate__r#      s     . .C .C .    c                s8    \         P                  ! \        V 4      # )zGettext translation function.)gettextZdgettext
DOMAINNAMEr      &r"   _r)      s    J--r$   c                r   r   r   r   r!   r"   r#   r#      s      S S r$   c                s    V # )z{Mark string for translation without actually translating.

Used by gettext tools to extract strings that need translation.
 r'   r(   r"   N_r+      s	    
 Kr$   z+^tb:(?P<lang>[a-z]{1,3}):(?P<name>[^\s:]+)$NFDi@B Zfr_FRz.,)]} u   ?!;:%#«»€$¢£¥฿u    Zfr_CAz.,;?!)]}:Z*z	.,;:?!)]}Zfr_MCZfr_BEZfr_LUZfr_CHZafZastZazZbeZbgZbrZbsZcaZcsZcsbZcvZcyZdau   æÆøØåÅZdeZdsbelenZesZeuZfiu   åÅäÄöÖZfoZfrZfurZfyZgaZgdZglZgrcZgvZhawZhrZhsbZhtZhuZiaZisZitZkkZkuZkyZlbZlnZlvZmgZmiZmkZmnZmosZmtnbZndsZnlZnnZnrZnsoZnyZocZplZpltZptZquZquhZruZscZseZshZshsZskZslZsmjZsqZsrZssZstZsvZtetZtkZtnZtsZukZuzZveZviZwaZxhPinputmethodsNoIMEdictionariesZaf_ZAZaf_NAZakZak_GHZamzam-seraZam_ETarzar-kbdZar_SAZar_AEZar_BHZar_DJZar_DZZar_EGZar_ERZar_ILZar_INZar_IQZar_JOZar_KMZar_KWZar_LBZar_LYZar_MAZar_MRZar_OMZar_PSZar_QAZar_SDZar_SOZar_SYZar_TDZar_TNZar_YEZaszas-inscript2Zas_INZen_GBZast_ESZaz_AZZbe_BYZberZber_MAZbg_BGZbnzbn-inscript2Zbn_INZbr_FRZbrxzbrx-inscript2-devaZbs_BAZca_ESZca_ADZca_FRZca_ITZcopZcop_EGZcs_CZZcsb_PLZcv_RUZcy_GBZda_DKZde_DEZde_ATZde_BEZde_CHZde_LIZde_LUZdoizdoi-inscript2-devaZdsb_DEZel_GRen_USZel_CYZen_AGZen_AUZen_BSZen_BWZen_BZZen_CAZen_DKZen_GHZen_HKZen_IEZen_INZen_JMZen_MWZen_NAZen_NGZen_NZZen_PHZen_SGZen_TTZen_ZAZen_ZMZen_ZWZeoZes_Zes_ESes_ARes_BOes_CLes_COes_CRes_CUes_DOes_ECes_GTes_HNes_MXes_NIes_PAes_PEes_PRes_PYes_SVes_USes_UYes_VEZetZet_EEZeu_ESfaZfa_IRZfilZfil_PHZfjZfo_FOZfur_ITZfy_NLZfy_DEZga_IEZgd_GBZgl_ESZguzgu-inscript2Zgu_INZgv_GBheZhe_ILZhizhi-inscript2Zhi_INZhilZhil_PHZhr_HRZhsb_DEZht_HTZhu_HUZhyZhy_AMidZid_IDZis_ISZit_ITZit_CHZkk_KZZkmZkm_KHZknzkn-inscript2Zkn_INZkozko-han2Zko_KRZkokzkok-inscript2-devaZkszks-kbdZks_Devazks-inscript2-devaZku_TRZku_SYZky_KGZlaZlb_LUZln_CDZltZlt_LTZlv_LVZmaizmai-inscript2Zmai_INZmi_NZZmk_MKZmlzml-inscript2Zml_INZmn_MNZmnizmni-inscript2-bengZmni_Mteizmni-inscript2-mteiZmos_BFZmrzmr-inscript2Zmr_INZmsZms_MYZms_BNZmt_MTZnb_NOnoZnds_DEZnds_NLZnezne-romZne_NPZne_INzne-inscript2-devaZnl_NLZnl_AWZnl_BEZnn_NOZnr_ZAZnso_ZAZny_MWZoc_FRZomZom_ETZom_KEZorzor-inscript2Zor_INZpazpa-inscript2-guruZpa_INZpa_PKZpl_PLZpt_PTZpt_AOZpt_BRZqu_ECZquh_BOZroZro_ROZru_RUZru_UAZrwZrw_RWZsazsa-inscript2Zsatzsat-inscript2-devaZsc_ITZsdZsd_ArabZsd_Devazsd-inscript2-devaZse_SEZse_FIZse_NOZsh_RSZsh_MEZsh_YUZshs_CAZsizsi-wijesekaraZsi_LKZsk_SKZsl_SIZsmj_NOZsmj_SEZsoZso_SOZso_DJZso_ETZso_KEZsq_ALZsr_RSZsr_MEZsr_YUZss_ZAZst_ZAZsv_SEZsv_FIZswZsw_TZZsw_KEZtazta-inscript2Zta_INZtezte-inscript2Zte_INZtet_IDZtet_TLZthZth_THZtiZti_ERZti_ETZtk_TMZtlZtl_PHZtn_ZAZtn_BWZtpiZtpi_PGZts_ZAZuk_UAurZur_PKZur_INzur-phoneticZuz_UZZve_ZAzvi-telexZvi_VNZwa_BEZxh_ZAyizyi-yivoZyi_USZzuZzu_ZAc                F    V ^8  d   QhR\         R\        \         ,          /# r   locale_stringr   r   r   r   r!   r"   r#   r#     s      S T#Y r$   c                    \        V 4      p\        V.4       F$  pV\        9   g   K  \        V,          R,          u # 	  R.# )ah  
Gets the default input methods for a locale

:param locale_string: The name of the locale to get the default
                      input methods for

Examples:

>>> get_default_input_methods('te_IN')
['te-inscript2', 'NoIME']

>>> get_default_input_methods('ks_IN.UTF-8@devanagari')
['ks-inscript2-deva', 'NoIME']

>>> get_default_input_methods('ks_IN.UTF-8')
['ks-kbd', 'NoIME']

>>> get_default_input_methods('mni_IN.UTF-8')
['mni-inscript2-beng', 'NoIME']

>>> get_default_input_methods('mni_Mtei') # No locale in glibc for this!
['mni-inscript2-mtei', 'NoIME']

>>> get_default_input_methods('xx_YY')
['NoIME']
r3   r4   locale_normalizeexpand_languagesLOCALE_DEFAULTSrT   languagelang   &  r"   get_default_input_methodsr_     sA    6  .H (,?""4(88 - 9r$   c                rR   rS   rU   r   r!   r"   r#   r#     s      C DI r$   c                rV   )a
  
Gets the default dictionaries for a locale

:param locale_string: The name of the locale to get the default
                      dictionaries for

Examples:

>>> get_default_dictionaries('te_IN')
['te_IN', 'en_GB']

>>> get_default_dictionaries('xx_YY')
['en_US']
r5   r7   rW   r[   r^   r"   get_default_dictionariesr`     sA      .H (,?""4(88 - 9r$   c                rR   )r   imes_strr   rU   r   r!   r"   r#   r#     s"     A A AS	 Ar$   c           
     s   V R8X  d   \        \        4       4      # . pV P                  R4       Uu. uFd  q"P                  4       '       g   K  \        P
                  ! \        P                  ! R4      RVP                  4       \        P                  R7      NKf  	  up F  pW19  g   K  VP                  V4       K  	  \        V4      \        8  d-   \        P                  R\        VVR\         4       VR\         pV'       d   V# R.# u upi )a  Converts a list of input methods from a comma separated string
to a list of strings.

:param imes_str: Input methods as a comma separated string

Examples:

If the input is not empty but contains nothing which could be an
input method, the default input method ['NoIME'] is returned:

>>> input_methods_str_to_list(',,')
['NoIME']

If the input is empty, the default list of input methods for
the current locale is returned:

>>> old_lc_all = os.environ.get('LC_ALL')
>>> os.environ['LC_ALL'] = 'hi_IN.UTF-8'
>>> input_methods_str_to_list('')
['hi-inscript2', 'NoIME']

>>> if old_lc_all:
...     os.environ['LC_ALL'] = old_lc_all
... else:
...     # unneeded return value assigned to variable
...     _ = os.environ.pop('LC_ALL', None)

If the input has more than the maximum number of allowed input
methods, the list is reduced to the maximum (currently 10):

>>> input_methods_str_to_list('0, 1,2,3 ,4,5,6,7,8,9,10,11,12')
['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']


If the input contains duplicates, the duplicates are removed:

>>> input_methods_str_to_list('a ,a,b , c ,, a ,d,e,f, ')
['a', 'b', 'c', 'd', 'e', 'f']

Non-standard spellings of the special input method ['NoIME']
are converted to the standard spelling:

>>> input_methods_str_to_list('nOiMe')
['NoIME']
r-   ,Znoimer4   flagszVMore than the allowed maximum of %s input methods.
Trying to use: %s
Really using: %s
N)r_   get_effective_lc_ctypesplitstripresubescape
IGNORECASEappendlenMAXIMUM_NUMBER_OF_INPUT_METHODSLOGGERerror)ra   Zimesxime   &   r"   input_methods_str_to_listrt     s    \ 2~()?)ABBD #..-<-Q-		'*GQWWY mm--< ?KK	<
 4y22! ,112	4 4459!<s   D
AD
c                rR   )r   dictionaries_strr   rU   r   r!   r"   r#   r#   7  s"     J Js JtCy Jr$   c           
     sV   V R8X  d   \        \        4       4      # . pV P                  R4       Uu. uFd  q"P                  4       '       g   K  \        P
                  ! \        P                  ! R4      RVP                  4       \        P                  R7      NKf  	  up F8  pVR8w  d   \        V4      pV'       g   K  W19  g   K'  VP                  V4       K:  	  \        V4      \        8  d-   \        P                  R\        VVR\         4       VR\         pV'       d   V# R.# u upi )	a  
Converts a list of dictionaries from a comma separated string to
a list of strings.

;param dictionaries_str: Dictionaries as a comma separated string

Examples:

If the input is not empty but contains nothing which could be a
dictionary, the default dictionary ['en_US'] is returned:

>>> dictionaries_str_to_list(',')
['en_US']

If the input is empty, the default list of dictionaries for
the current locale is returned:

>>> old_lc_all = os.environ.get('LC_ALL')
>>> os.environ['LC_ALL'] = 'hi_IN.UTF-8'
>>> dictionaries_str_to_list('')
['hi_IN', 'en_GB']

>>> if old_lc_all:
...     os.environ['LC_ALL'] = old_lc_all
... else:
...     # unneeded return value assigned to variable
...     _ = os.environ.pop('LC_ALL', None)

If the input has more than the maximum number of allowed dictionaries
the list is reduced to the maximum (currently 10):

>>> dictionaries_str_to_list('en_AG,en_AU,en_BW,en_CA,en_DK,en_GB,en_HK,en_IE,en_IL,en_IN,en_NG,en_NZ,en_PH,en_SC,en_SG,en_US,en_ZA,en_ZM,en_ZW')
['en_AG', 'en_AU', 'en_BW', 'en_CA', 'en_DK', 'en_GB', 'en_HK', 'en_IE', 'en_IL', 'en_IN']

If the input contains duplicates, the duplicates are removed:

>>> dictionaries_str_to_list('en_US.UTF-8,en_US,en.UTF-8,en,C')
['en_US', 'en', 'en_US_POSIX']

Non-standard spellings of the special dictionary ['None']
are converted to the standard spelling:

>>> dictionaries_str_to_list('nOnE')
['None']

>>> dictionaries_str_to_list('a,en_GB')
['en_GB']
>>> dictionaries_str_to_list('xxxx')
['en_US']
r-   rb   ZnoneNonerc   zUMore than the allowed maximum of %s dictionaries.
Trying to use: %s
Really using: %s
Nr7   )r`   re   rf   rg   rh   ri   rj   rk   rX   rl   rm   MAXIMUM_NUMBER_OF_DICTIONARIESro   rp   )ru   r5   rq   
dictionaryrs   r"   dictionaries_str_to_listry   7  s   j 2'(>(@AA L !1 6 6s ;J ;1wwy3rvvbii/$&MM3 ;J
 )*5J:*8
+J <99! +889	; $$C%CD9%Js   D&AD&Zan_ESZca_ES_VALENCIAZckbZckb_IQZgugZkmrZkmr_TRZkmr_SYZagqZagq_CMZar_001Zar_EHZar_SSZasaZasa_TZZaz_CyrlZ
az_Cyrl_AZZaz_LatnZ
az_Latn_AZZbasZbas_CMZbemZbem_ZMZbewZbezZbez_TZZbgnZbloZbmZbm_MLZbn_BDZboZbo_CNZbo_INZbrx_INZbs_CyrlZ
bs_Cyrl_BAZbs_LatnZ
bs_Latn_BAZccpZccp_BDZccp_INZceZce_RUZcebZcggZcgg_UGchrZchr_USZckb_IRZcuZcu_RUZda_GLZdavZdav_KEZde_ITZdjeZdje_NEZduaZdua_CMZdyoZdyo_SNZdzZdz_BTZebuZebu_KEZeeZee_GHZee_TGen_001Zen_150Zen_AIZen_ASZen_ATZen_BBZen_BEZen_BIZen_BMZen_CCZen_CHZen_CKZen_CMZen_CXZen_CYZen_DEZen_DGZen_DMZen_ERZen_FIZen_FJZen_FKZen_FMZen_GDZen_GGZen_GIZen_GMZen_GUZen_GYZen_ILZen_IMZen_IOZen_JEZen_KEZen_KIZen_KNZen_KYZen_LCZen_LRZen_LSZen_MGZen_MHZen_MOZen_MPZen_MSZen_MTZen_MUZen_MYZen_NFZen_NLZen_NRZen_NUZen_PGZen_PKZen_PNZen_PRZen_PWZen_RWZen_SBZen_SCZen_SDZen_SEZen_SHZen_SIZen_SLZen_SSZen_SXZen_SZZen_TCZen_TKZen_TOZen_TVZen_TZZen_UGZen_UMen_US_POSIXZen_VCZen_VGZen_VIZen_VUZen_WSZeo_001es_419Zes_BRZes_BZZes_EAZes_GQZes_ICZes_PHZewoZewo_CMZfa_AFZffZff_AdlmZfi_FIZfo_DKZfr_BFZfr_BIZfr_BJZfr_BLZfr_CDZfr_CFZfr_CGZfr_CIZfr_CMZfr_DJZfr_DZZfr_GAZfr_GFZfr_GNZfr_GPZfr_GQZfr_HTZfr_KMZfr_MAZfr_MFZfr_MGZfr_MLZfr_MQZfr_MRZfr_MUZfr_NCZfr_NEZfr_PFZfr_PMZfr_REZfr_RWZfr_SCZfr_SNZfr_SYZfr_TDZfr_TGZfr_TNZfr_VUZfr_WFZfr_YTZfrrZgswZgsw_CHZgsw_FRZgsw_LIZguzZguz_KEZgv_IMZhaZha_GHZha_NEZha_NGZhaw_USZhi_LatnZhr_BAZigZig_NGZiiZii_CNZit_SMZit_VAZjaZja_JPZjgoZjgo_CMZjmcZjmc_TZZjvZkaZka_GEZkabZkab_DZZkamZkam_KEZkdeZkde_TZZkeaZkea_CVZkhqZkhq_MLZkiZki_KEZkk_ArabZkkjZkkj_CMZklZkl_GLZklnZkln_KEZko_KPZkok_INZks_INZksbZksb_TZZksfZksf_CMZkshZksh_DEZkwZkw_GBZlagZlag_TZZlgZlg_UGZlijZlktZlkt_USZln_AOZln_CFZln_CGZloZlo_LAZlrcZlrc_IQZlrc_IRZluZlu_CDZluoZluo_KEZluyZluy_KEZmasZmas_KEZmas_TZZmerZmer_KEZmfeZmfe_MUZmg_MGZmghZmgh_MZZmgoZmgo_CMZms_SGZmuaZmua_CMZmyZmy_MMZmznZmzn_IRZnaqZnaq_NAZnb_SJZndZnd_ZWZnl_BQZnl_CWZnl_SRZnl_SXZnmgZnmg_CMZnnhZnnh_CMZno_NOZnusZnus_SSZnynZnyn_UGosZos_GEZos_RUZpa_ArabZ
pa_Arab_PKZpa_GuruZ
pa_Guru_INZpapZpcmZprgZprg_001psZps_AFZpt_CHZpt_CVZpt_GQZpt_GWZpt_LUZpt_MOZpt_MZZpt_STZpt_TLZqu_BOZqu_PEZqucZrhgZrmZrm_CHZrnZrn_BIZro_MDZrofZrof_TZrootZru_BYZru_KGZru_KZZru_MDZrwkZrwk_TZZsahZsah_RUZsaqZsaq_KEZsbpZsbp_TZZsd_PKZsehZseh_MZZsesZses_MLZsgZsg_CFZshiZshi_LatnZshi_Latn_MAZshi_TfngZshi_Tfng_MAZsmnZsmn_FIZsnZsn_ZWZsq_MKZsq_XKZsr_CyrlZ
sr_Cyrl_BAZ
sr_Cyrl_MEZ
sr_Cyrl_RSZ
sr_Cyrl_XKZsr_LatnZ
sr_Latn_BAZ
sr_Latn_MEZ
sr_Latn_RSZ
sr_Latn_XKZsuZsv_AXZsw_CDZsw_UGZta_LKZta_MYZta_SGZteoZteo_KEZteo_UGZtgZtg_TJZtoZto_TOZtrZtr_CYZtr_TRZttZtt_RUZtwqZtwq_NEZtzmZtzm_MAZugZug_CNZuz_ArabZ
uz_Arab_AFZuz_CyrlZ
uz_Cyrl_UZZuz_LatnZ
uz_Latn_UZZvaiZvai_LatnZvai_Latn_LRZvai_VaiiZvai_Vaii_LRZvecZvoZvo_001ZvunZvun_TZZwaeZwae_CHZwoZwo_SNZxogZxog_UGZyavZyav_CMZyi_001ZyoZyo_BJZyo_NGZyueZyue_HansZyue_Hans_CNZyue_HantZyue_Hant_HKZzghZzgh_MAZzhZzh_HansZ
zh_Hans_CNZ
zh_Hans_HKZ
zh_Hans_MOZ
zh_Hans_SGzh_HantZ
zh_Hant_HKZ
zh_Hant_MOZ
zh_Hant_TWZjv_IDZsu_IDzh_TWzh_HKrv   u   🏴u   🌐Z001Z150u   🌍Z419u   🌎ZAu   🇦ZBu   🇧Cu   🇨ZDu   🇩ZEu   🇪ZFu   🇫ZGu   🇬ZHu   🇭ZIu   🇮ZJu   🇯ZKu   🇰Lu   🇱ZMu   🇲ZNu   🇳ZOu   🇴u   🇵ZQu   🇶Ru   🇷ZSu   🇸ZTu   🇹ZUu   🇺ZVu   🇻ZWu   🇼ZXu   🇽ZYu   🇾ZZu   🇿u   🇿🇦u   🇨🇲u   🇬🇭u   🇪🇹u   🌏u   🇦🇫🇮🇷🇵🇰u   🇵🇭u   🏴󠁧󠁢󠁷󠁬󠁳󠁿u   🇮🇳u   🇫🇯u   🏴󠁧󠁢󠁳󠁣󠁴󠁿u   🇬🇷u   🇻🇦u   🇮🇳🇧🇩🇲🇲u   🇳🇴u   🇳🇬u   🇮🇹c                r   )r   lookup_textr   r   r   r!   r"   r#   r#   (	  s     1 1# 1# 1r$   c                s   V \         9   d   \         V ,          # \        V 4      ^8X  d~   V P                  4       '       dh   V P                  4       '       dR   V ^ ,          \         9   d@   V ^,          \         9   d.   \         V ^ ,          ,          \         V ^,          ,          ,           # V P	                  4       '       d2   \        V 4      ^8X  d"   \         P                  V \         R,          4      # \        V 4      p\        VP                  4      ^8X  d   VP                  P                  4       '       d   VP                  P                  4       '       dz   VP                  ^ ,          \         9   d^   VP                  ^,          \         9   dB   \         VP                  ^ ,          ,          \         VP                  ^,          ,          ,           # VP                  P	                  4       '       dF   \        VP                  4      ^8X  d,   \         P                  VP                  \         R,          4      # VP                  '       d-   VP                  \         9   d   \         VP                  ,          # \         R,          # )u  Lookup a flag emoji for a lookup string or a reaonable fallback
if there is no flag.

Examples:

>>> get_flag('en_GB')
'🇬🇧'
>>> get_flag('GB')
'🇬🇧'

There is no Yugoslavia anymore, nevertheless returning '🇾🇺' is
fine, a white flag with question mark is shown in the “Noto Color
Emoji” font.

>>> get_flag('YU')
'🇾🇺'
>>> get_flag('en_001')
'🌐'
>>> get_flag('001')
'🌐'
>>> get_flag('ca_Latn_ES_VALENCIA')
'🇪🇸'
>>> get_flag('af')
'🇿🇦'
>>> get_flag('zu')
'🌍'
rv   )	FLAGSrm   ZisalphaZisupperZisdigitgetparse_locale	territoryr\   )r   locale   & r"   get_flagr   (	  s   8 e[!!KA!!!!Ne#Ne#[^$u[^'<<<[!1Q!6yyeFm44+&FF"$$&&$$&&Q5(Q5(V%%a()E&2B2B12E,FFF!!c&*:*:&;q&@yy))5=996??e3V__%%=r$   c                sh    V ^8  d   QhR\         \        ,          R\        \        \        3,          /# )r   r5   r   )r   r   r   r   r!   r"   r#   r#   [	  s&      DI $sCx. r$   c                s    / p\        4       pRpV  F+  p\        V4      pWQV&   WR9   d   RpVP                  V4       K-  	  V'       dG   VP                  4        F2  w  rgVP	                  V4      '       d   K  W;;,          V,          uu&   K4  	  V# )u,  
Examples:

>>> get_flags(['de_DE', 'fr_FR', 'eo'])
{'de_DE': '🇩🇪', 'fr_FR': '🇫🇷', 'eo': '🌍'}
>>> get_flags(['fr_FR', 'de_DE', 'fy_DE', 'eo', 'de', '150'])
{'fr_FR': '🇫🇷fr_FR', 'de_DE': '🇩🇪de_DE', 'fy_DE': '🇩🇪fy_DE', 'eo': '🌍eo', 'de': '🌍de', '150': '🌍150'}
FT)setr   additemsendswith)r5   rd   Z
flags_seenZduplicate_flagsrx   Znew_flagkeyZflag   &       r"   	get_flagsr   [	  s     E5JO"
J'$j!"Ox  # IC==%%
c!
 ' Lr$   c                $    V ^8  d   QhR\         /# r   r   r   r   r!   r"   r#   r#   u	  s       r$   c                    R\         P                  9   d   \         P                  R,          # R\         P                  9   d   \         P                  R,          # R\         P                  9   d   \         P                  R,          # R# )z'Returns the effective value of LC_CTYPELC_ALLLC_CTYPELANGr   r~   environr*   r$   r"   re   re   u	  sV    2::zz(##RZZzz*%%zz&!!r$   c                r   r   r   r   r!   r"   r#   r#   	  s      3 r$   c                 r   )z*Returns the effective value of LC_MESSAGESr   ZLC_MESSAGESr   r   r   r*   r$   r"   get_effective_lc_messagesr   	  sV    2::zz(##

"zz-((zz&!!r$   )maxsizec                <    V ^8  d   QhR\         R\        R\        /# )r   input_purpose	im_clientr   )intr   boolr   r!   r"   r#   r#   	  s!      3 3 4 r$   c                s    V \         P                  P                  39   d   R# V'       g   R# . ROpV F1  p\        P                  ! V4      P                  V4      '       g   K0   R# 	  R# )zDetect whether the focus is on a terminal

Checks input purpose first and if that is not set to TERMINAL,
checks the program name in im_client to guess whether it is
a terminal.
TF)z^xim:xterm:z^QIBusInputContext:konsole:z
^xim:rxvt:z^xim:urxvt:)InputPurposeTERMINALvaluerh   compilesearch)r   r   Zterminal_regexpsZregexp   &&  r"   detect_terminalr   	  sZ     ..4455 #::f$$Y// # r$   ZlatinZLatnZiqtelifZcyrillicZCyrlZ
devanagariZDevaLocalec                0    V ^8  d   QhR\         R\        /# r   localeIdr   )r   r   r   r!   r"   r#   r#   	  s     f% f%3 f%6 f%r$   c                s   RpRpRpRpRpV '       df   V P                  R4      pV P                  R4      p^ Tu;8:  d   V8  d   M MW^,           V pV RV WR ,           p MV^ 8  d   W^,           R pV RV p V '       dT   V P                  4       P                  R4      pV^ 8  d    V P                  4       P                  R4      pV^ 8  d   RpV RV p V '       d   V R9   d	   R	pR
pRpRp V '       dj   \        P	                  4        FQ  w  rV P                  W4      p V P                  RV
,           4      '       g   K6  T
pV P                  RV
,           R4      p KS  	  V '       d7   V P                  R4      pV^ 8  d   W^,           R P                  4       pV RV p V '       d   \        P                  V 4      pV'       dc   VP                  R4      pVP                  R4      '       d   VP                  R4      pVP                  R4      '       d   VP                  R4      pM\        P                  RV 4       \        VVVVVR7      # )u  
Parses a locale name in glibc or CLDR format and returns
language, script, territory, variant, and encoding

:param localeId: The name of the locale
:return: The parts of the locale:
         language, script, territory, variant, encoding
:rtype: A namedtuple of strings
        Locale(language=string,
               script=string,
               territory=string,
               variant=string,
               encoding=string)

It replaces glibc names for scripts like “latin”
with the iso-15924 script names like “Latn”.
I.e. these inputs all give the same result:

    “sr_latin_RS”
    “sr_Latn_RS”
    “sr_RS@latin”
    “sr_RS@Latn”

Examples:

>>> parse_locale('de_DE')
Locale(language='de', script='', territory='DE', variant='', encoding='')

>>> parse_locale('de_DE.UTF-8')
Locale(language='de', script='', territory='DE', variant='', encoding='UTF-8')

>>> parse_locale('de_DE.utf8')
Locale(language='de', script='', territory='DE', variant='', encoding='utf8')

>>> parse_locale('de_DE@euro')
Locale(language='de', script='', territory='DE', variant='EURO', encoding='')

>>> parse_locale('de_DE.ISO-8859-15')
Locale(language='de', script='', territory='DE', variant='', encoding='ISO-8859-15')

>>> parse_locale('de_DE.ISO-8859-15@euro')
Locale(language='de', script='', territory='DE', variant='EURO', encoding='ISO-8859-15')

>>> parse_locale('de_DE.iso885915@euro')
Locale(language='de', script='', territory='DE', variant='EURO', encoding='iso885915')

>>> parse_locale('gez_ER.UTF-8@abegede')
Locale(language='gez', script='', territory='ER', variant='ABEGEDE', encoding='UTF-8')

>>> parse_locale('ar_ER.UTF-8@saaho')
Locale(language='ar', script='', territory='ER', variant='SAAHO', encoding='UTF-8')

>>> parse_locale('zh_Hant_TW')
Locale(language='zh', script='Hant', territory='TW', variant='', encoding='')

>>> parse_locale('zh_TW')
Locale(language='zh', script='', territory='TW', variant='', encoding='')

>>> parse_locale('es_419')
Locale(language='es', script='', territory='419', variant='', encoding='')

>>> parse_locale('sr_latin_RS')
Locale(language='sr', script='Latn', territory='RS', variant='', encoding='')

>>> parse_locale('sr_Latn_RS')
Locale(language='sr', script='Latn', territory='RS', variant='', encoding='')

>>> parse_locale('sr_RS@latin')
Locale(language='sr', script='Latn', territory='RS', variant='', encoding='')

>>> parse_locale('sr_RS@Latn')
Locale(language='sr', script='Latn', territory='RS', variant='', encoding='')

>>> parse_locale('sr_RS.UTF-8@latin')
Locale(language='sr', script='Latn', territory='RS', variant='', encoding='UTF-8')

>>> parse_locale('ca_ES')
Locale(language='ca', script='', territory='ES', variant='', encoding='')

>>> parse_locale('ca_ES.UTF-8')
Locale(language='ca', script='', territory='ES', variant='', encoding='UTF-8')

>>> parse_locale('ca_ES_VALENCIA')
Locale(language='ca', script='', territory='ES', variant='VALENCIA', encoding='')

>>> parse_locale('ca_Latn_ES_VALENCIA')
Locale(language='ca', script='Latn', territory='ES', variant='VALENCIA', encoding='')

>>> parse_locale('ca_ES.UTF-8@valencia')
Locale(language='ca', script='', territory='ES', variant='VALENCIA', encoding='UTF-8')

>>> parse_locale('ca_ES@valencia')
Locale(language='ca', script='', territory='ES', variant='VALENCIA', encoding='')

>>> parse_locale('en_US_POSIX')
Locale(language='en', script='', territory='US', variant='POSIX', encoding='')

>>> parse_locale('POSIX')
Locale(language='en', script='', territory='US', variant='POSIX', encoding='')

>>> parse_locale('C')
Locale(language='en', script='', territory='US', variant='POSIX', encoding='')

>>> parse_locale('C.UTF-8')
Locale(language='en', script='', territory='US', variant='POSIX', encoding='UTF-8')

r-   .Z@Nz	@valenciaZ	_VALENCIAZVALENCIAPOSIXr0   ZUSr\   scriptr   z&localeId contains invalid locale id=%sr\   r   r   variantencoding)r   r   r|   )findlowerupper_glibc_script_idsr   replacer   _cldr_locale_patternmatchgroupro   infor   )r   r\   r   r   r   r   Z	dot_indexZat_indexZvalencia_indexr   Zscript_id_isor   s   &           r"   r   r   	  s$   \ HFIGHMM#&	==%	$H$ Qx8H
+hy.AAH!^A/H
+H!)..{;A%^^-22;?NQ G0H44HIGH"3"9"9";C'';H  }!455&#++C-,?D	 #<
 ==%q=
 !|}-335G	*H$**84{{:.H{{8$$X.{{;''!KK4	KK@(K8%!#	% %r$   c                r   r   r   r   r!   r"   r#   r#   m
  s     2  2 s 2 s 2 r$   c                s<   \        V 4      pVP                  pVP                  '       d   VRVP                  ,           ,          pVP                  '       d   VRVP                  ,           ,          pVP                  '       d   VRVP                  ,           ,          pV# )au  
Returns a normalized version of the locale id string
*without* the encoding.

:param localeId: The original locale id string

Examples:

>>> locale_normalize('ks_IN@devanagari')
'ks_Deva_IN'
>>> locale_normalize('ks_IN.UTF-8@devanagari')
'ks_Deva_IN'
>>> locale_normalize('tt_RU.UTF-8@iqtelif')
'tt_Latn_RU'
>>> locale_normalize('de_DE.ISO-8859-15@euro')
'de_DE_EURO'
>>> locale_normalize('gez_ER.UTF-8@abegede')
'gez_ER_ABEGEDE'
>>> locale_normalize('ar_ER.UTF-8@saaho')
'ar_ER_SAAHO'
>>> locale_normalize('es_419')
'es_419'
>>> locale_normalize('sr_RS.UTF-8@latin')
'sr_Latn_RS'
>>> locale_normalize('ca_ES.UTF-8@valencia')
'ca_ES_VALENCIA'
>>> locale_normalize('C.UTF-8')
'en_US_POSIX'
>>> locale_normalize('xxx')
'xxx'
>>> locale_normalize('')
''

An empty string is returned if the input cannot be
a valid locale id:

>>> locale_normalize('x')
''
>>> locale_normalize('xxxx')
''
r)   )r   r\   r   r   r   )r   r   Znormalized_locale_idr^   r"   rX   rX   m
  s{    T (#F &}}}fmm 33f&6&6 66~~~fnn 44r$   c                s\    V ^8  d   QhR\         \        ,          R\        \        ,          /# )r   	languagesr   )r	   r   r   r   r!   r"   r#   r#   
  s&     Q Q Q$s) Qr$   c                s   . pV  EFI  pW!9   d   K  VP                  V4       V\        9   d   RV9  d   VP                  R4       VR9   d   RV9  d   VP                  R4       VR,          R8X  d   RV9  d   VP                  R4       VR,          R8X  d   RV9  d   VP                  R4       VR,          R8X  d   RV9  d   VP                  R4       VP                  R4      pVR9  g   K  VR	,          V.8w  g   K  \        V4      ^8  g   EK  RP	                  VR
R 4      pWA9  d   VP                  V4       VP                  4        KP  	  RV9  d   VP                  R4       V# )a  Expands the given list of languages by including fallbacks.

Returns a possibly longer list of languages by adding
aliases and fallbacks.

:param languages: A list of languages (or locale names)

Examples:

>>> expand_languages(['es_MX', 'es_ES', 'ja_JP'])
['es_MX', 'es_419', 'es', 'es_ES', 'ja_JP', 'ja', 'en']

>>> expand_languages(['zh_Hant', 'zh_CN', 'zh_TW', 'zh_SG', 'zh_HK', 'zh_MO'])
['zh_Hant', 'zh_CN', 'zh', 'zh_TW', 'zh_SG', 'zh_HK', 'zh_MO', 'en']

>>> expand_languages(['ks_Deva_IN'])
['ks_Deva_IN', 'ks_Deva', 'ks', 'en']

>>> expand_languages(['ca_ES_VALENCIA'])
['ca_ES_VALENCIA', 'ca_ES', 'ca', 'en']

>>> expand_languages(['ca_Latn_ES_VALENCIA'])
['ca_Latn_ES_VALENCIA', 'ca_Latn_ES', 'ca_Latn', 'ca', 'en']

>>> expand_languages(['nb_NO'])
['nb_NO', 'no', 'nb', 'en']

>>> expand_languages(['nn_NO'])
['nn_NO', 'nn', 'en']

>>> expand_languages(['no_NO'])
['no_NO', 'nb', 'no', 'en']

>>> expand_languages(['en_GB', 'en'])
['en_GB', 'en_001', 'en']

>>> expand_languages(['sr_Latn_RS'])
['sr_Latn_RS', 'sr_Latn', 'sr', 'en']

>>> expand_languages(['ca_ES_VALENCIA'])
['ca_ES_VALENCIA', 'ca_ES', 'ca', 'en']

>>> expand_languages(['en_US_POSIX'])
['en_US_POSIX', 'en_001', 'en_US', 'en']

>>> expand_languages([])
['en']
r}   r   :Nr   Nr0   r{   r1   rO   r)   N   NN)r   r   zh_MO)r   r   r   r   )rl   SPANISH_419_LOCALESrf   rm   joinZpop)r   Zexpanded_languagesr\   Zlanguage_partsZexpanded_language   &    r"   rY   rY   
  s^   f )!!(+++ 22%%h/33!33%%i0RLD  22%%h/RLD ..%%d+RLD ..%%d+!,BB"2&8*4n%)$'HH^CR-@$A!$>&--.?@""$5 6 %%!!$'r$   c                r   r   r   r   r!   r"   r#   r#   
  s     j1 j13 j13 j1r$   c                s   \        4       pV P                  RR4      pV R8X  d#   VRR\        R4      ,           ,           ,          pEM\        '       d@   WR.pV F3  pV'       g   K  VR\        P
                  ! V VR7      ,           ,          pK5  	  EM\        '       Ed   \        V 4      pVP                  '       EdS   \        P                  P                  VP                  R7      pV'       g+   \        P                  P                  VP                  R7      pV'       g+   \        P                  P                  VP                  R	7      pV'       d   VP                  '       d   VRVP                  ,           ,          p\        P                  ! R
RV.R7      pVRVP                  VP                  4      ,           ,          p\        P                  ! R
RVP                  .R7      pVRVP                  VP                  4      ,           ,          pVP                  '       Ed!   \        P                   P                  VP                  R7      pV'       g+   \        P                   P                  VP                  R7      pV'       d   VP                  '       d   VRVP                  ,           ,          p\        P                  ! RRV.R7      pVRVP                  VP                  4      ,           ,          p\        P                  ! RRVP                  .R7      pVRVP                  VP                  4      ,           ,          p\#        V4      P%                  4       # )a  
Returns a text which can be matched against typed user input
to check whether the user might be looking for this locale

:param localeId: The name of the locale

Examples:

>>> old_lc_all = os.environ.get('LC_ALL')
>>> os.environ['LC_ALL'] = 'de_DE.UTF-8'

When using langtable:

>> locale_text_to_match('fr_FR')
'fr_fr franzosisch (frankreich) francais (france) french (france)'

>> locale_text_to_match('t')
't others, miscellaneous, various, diverse weiteres, sonstiges, verschiedenes, anderes, ubriges'

When using pycountry

>> locale_text_to_match('fr_FR')
'fr_fr french franzosisch francais france frankreich france'

>>> if old_lc_all:
...     os.environ['LC_ALL'] = old_lc_all
... else:
...     # unneeded return value assigned to variable
...     _ = os.environ.pop('LC_ALL', None)
 r-   tz'Others, Miscellaneous, Various, Diverser0   Z
languageIdZlanguageIdQueryZalpha_2Zalpha_3Zbibliographic	iso_639-3TZfallbackr   iso_3166z(Others, Miscellaneous, Various, Diverse )r   r   r)   IMPORT_LANGTABLE_SUCCESSFUL	langtablelanguage_nameIMPORT_PYCOUNTRY_SUCCESSFULr   r\   	pycountryr   r   namer%   translationr   	countriesremove_accentsr   )	r   effective_lc_messagesZtext_to_matchZquery_languagesZquery_languager   r\   gtranscountrys	   &        r"   locale_text_to_matchr   
  s   B 67$$S"-M36 ?@7A 	< 
%	$0DA-N~y'>'>'$2(4 "4 4 .
 
%	$h'??? **..v.GH$..226??2K$..22"(// 3 3HMMMx}}!44 ,,$457 v~~hmm'D!DD ,,$%/1 v~~hmm'D!DD))--f6F6F-GG#--11&:J:J1K7<<<w||!33 ,,457 v~~gll'C!CC ,,%/1 v~~gll'C!CC-(..00r$   c                r   r   r   r   r!   r"   r#   r#   f  s     ;  ; ; ; r$   c                s    Rp\        4       p\        '       d;   \        P                  ! V VR7      pV'       g   \        P                  ! V RR7      pEM\        '       Ed   \        V 4      pVP                  '       d   \        P                  P                  VP                  R7      pV'       g+   \        P                  P                  VP                  R7      pV'       g+   \        P                  P                  VP                  R7      pV'       dH   VP                  '       d6   \        P                  ! RRV.R	7      pVP                  VP                  4      pVP                  '       d   \        P                  P                  VP                  R7      pV'       g+   \        P                  P                  VP                  R7      pV'       d   VP                  '       dp   \        P                  ! R
RV.R	7      pVP                  VP                  4      pVRV^ ,          P                  4       ,           VR,          ,           R,           ,          pV'       d&   V^ ,          P                  4       VR,          ,           pV# )u  
Returns a description of the language of the locale

:param localeId: The name of the locale

Examples:

>>> old_lc_all = os.environ.get('LC_ALL')
>>> os.environ['LC_ALL'] = 'de_DE_IN.UTF-8'

>> locale_language_description('fr_FR')
'Französisch (Frankreich)'

>>> if old_lc_all:
...     os.environ['LC_ALL'] = old_lc_all
... else:
...     # unneeded return value assigned to variable
...     _ = os.environ.pop('LC_ALL', None)
r-   r   r0   r   r   r   r   Tr   r   z (r   NNZ))r   r   r   r   r   r   r\   r   r   r   r   r%   r   r   r   r   )r   Zlanguage_descriptionr   r   r\   r   r   Zcname_transr   r"   locale_language_descriptionr   f  s   * 57""(661 3 $#,#:#:#T$; 	$	$h'??? **..v.GH$..226??2K$..22"(// 3 3HMMM ,,$457 (.~~hmm'D$))--f6F6F-GG#--11&:J:J1K7<<< ,,457 %nnW\\:$;q>//11KOC$  #))+.B2.FF 	r$   c                s<    V ^8  d   QhR\         R\         R\        /# )r   r   r\   r   r   r   r   r!   r"   r#   r#     s!     $ $s $3 $ $r$   c                s   V P                  4       '       d   R# RpVP                  R4      '       d
   VR,          p\        P                  ! R\        P                  ! V4      ,           R,           4      pVP                  V 4      '       d   R# R# )a  Checks whether text ends a sentence

Used to check whether the next word after a commit should be
capitalized if auto-capitalization is enabled.

:param text: The text to check
:return: True if text ends a sentence, False if not.

Examples:

>>> text_ends_a_sentence(' ')
False
>>> text_ends_a_sentence(' hello ')
False
>>> text_ends_a_sentence(' hello . ')
True
>>> text_ends_a_sentence('. ')
True
>>> text_ends_a_sentence(' . ')
True
>>> text_ends_a_sentence('; ')
False
>>> text_ends_a_sentence('; ', language='el_GR')
True
Fz.?!r/   Z;Z[z]+[\s]*$T)isspace
startswithrh   r   rj   r   )r   r\   Zauto_capitalize_charactersZpattern_new_sentencer   r"   text_ends_a_sentencer     sr    4 ||~~!&4  "c)"::ryy344{BD""4((r$   c                r   r   tokenr   r   r   r!   r"   r#   r#             r$   c                s    V P                  4       p V '       d2   \        P                  ! V ^ ,          4      \        9   d   V R,          p K9  V # )a9  Strips some characters from the left side of a token

Characters which have a type listed in CATEGORIES_TO_STRIP_FROM_TOKENS
are stripped from the left side of a token.

The stripped token is returned.

:param token: The token where characters may be stripped from

Examples:

>>> lstrip_token(".'foo'.")
"foo'."
r   )ZlstripunicodedatacategoryCATEGORIES_TO_STRIP_FROM_TOKENSr   r(   r"   lstrip_tokenr     s8     LLNEa)-LLb	Lr$   c                r   r   r   r   r!   r"   r#   r#     r   r$   c                s    V P                  4       p V '       d.   \        P                  ! V R,          4      \        9   d   V ^ R p K5  V # )a;  Strips some characters from the right side of a token

Characters which have a type listed in CATEGORIES_TO_STRIP_FROM_TOKENS
are stripped from the right side of a token.

The stripped token is returned.

:param token: The token where characters may be stripped from

Examples:

>>> rstrip_token(".'foo'.")
".'foo"
r   )Zrstripr   r   r   r   r(   r"   rstrip_tokenr     s:     LLNEb	*.MMaLr$   c                r   r   r   r   r!   r"   r#   r#     s     - -s -s -r$   c                s*    \        \        V 4      4      # )a0  Strips some characters from both sides of a token

Characters which have a type listed in CATEGORIES_TO_STRIP_FROM_TOKENS
are stripped from both sides of a token.

The stripped token is returned.

:param token: The token where characters may be stripped from

Examples:

>>> strip_token(".'foo'.")
'foo'
)r   r   r   r(   r"   strip_tokenr     s     U+,,r$   c                rR   r   rU   r   r!   r"   r#   r#     s     $ $3 $49 $r$   c                s    \         P                  ! R4      p. pVP                  V P                  4       4       F)  p\	        V4      pV'       g   K  VP                  V4       K+  	  V# )aU  Splits a text into tokens

Returns a list of tokens

:param text: The text to tokenize

Examples:

>>> tokenize('a b c')
['a', 'b', 'c']

>>> tokenize('\n a b c')
['a', 'b', 'c']

>>> tokenize('a \n b c')
['a', 'b', 'c']

>>> tokenize('a (b) c')
['a', 'b', 'c']

>>> tokenize('a () c')
['a', 'c']

>>> tokenize('')
[]

>>> tokenize('\n')
[]
z[\s]+)rh   r   rf   rg   r   rl   )r   ZpatternZtokensZwordr   r   r"   tokenizer     sR    < jj"GFdjjl+D!5MM%  , Mr$   c                r   )r   color_stringr   r   r   r   r!   r"   r#   r#   ,  s     "2 "2s "2s "2r$   c                s   \         P                  ! 4       pVP                  V 4       \        VP                  ^,          4      ^,          ^,          \        VP
                  ^,          4      ^,          ^,          ,           \        VP                  ^,          4      ^,          ^,          ,           \        VP                  ^,          4      ^,          ,           # )uB  
Converts a color string to a 32bit  ARGB value

:param color_string: The color to convert to 32bit ARGB
                     Can be expressed in the following ways:
                         - Standard name from the X11 rgb.txt
                         - Hex value: “#rgb”, “#rrggbb”, “#rrrgggbbb”
                                      or ”#rrrrggggbbbb”
                         - RGB color: “rgb(r,g,b)”
                         - RGBA color: “rgba(r,g,b,a)”

Examples:

>>> print('%x' %color_string_to_argb('rgb(0xff, 0x10, 0x25)'))
ffff1025

>>> print('%x' %color_string_to_argb('#108040'))
ff108040

>>> print('%x' %color_string_to_argb('#fff000888'))
ffff0088

>>> print('%x' %color_string_to_argb('#ffff00008888'))
ffff0088

>>> print('%x' %color_string_to_argb('rgba(0xff, 0x10, 0x25, 0.5)'))
7fff1025
)r   ZRGBAZparser   alphaZredZgreenZblue)r   Zgdk_rgbar   r"   color_string_to_argbr   ,  s    : xxzHNN< (..4'(4/B6HLL4'(4/B68HNNT)*T1a79 8==4'(4/1 2r$   z^[SCMAGsH]-z
    (^|-)
    (
        Shift_[LR]
        |Control_[LR]
        |Alt_[LR]
        |Meta_[LR]
        |Super_[LR]
        |Hyper_[LR]
        |ISO_Level3_Shift
    )
    $
    c                r   )r   msymbolr   r   r   r!   r"   r#   r#   a  s      S T r$   c                s    \         P                  ! \        V 4      '       g   R# \         P                  ! \        V 4      '       d   R# R# )a  Check if an msymbol should trigger a commit

Examples:

>>> msymbol_triggers_commit('S- ')
True
>>> msymbol_triggers_commit('S-H-Escape')
True
>>> msymbol_triggers_commit('S-C-Return')
True
>>> msymbol_triggers_commit('C-s-Home')
True
>>> msymbol_triggers_commit('C-M-Super_R-x')
True
>>> msymbol_triggers_commit('M-A-Control_L-OK')
True
>>> msymbol_triggers_commit('M-A-ISO_Level_42_Shift_L')
True
>>> msymbol_triggers_commit('S-NotShift_L')
True
>>> msymbol_triggers_commit('S-C-Alt_R')
False
>>> msymbol_triggers_commit('G-Alt_L')
False
FT)rh   r   &MSYMBOL_TRIGGERS_COMMIT_PREFIX_PATTERN1MSYMBOL_TRIGGERS_COMMIT_FORBIDDEN_POSTFIX_PATTERN)r   r(   r"   msymbol_triggers_commitr   a  s1    4 99;WEE	yyBGLLr$   c                sH    V ^8  d   QhR\         R\        R\         R\         /# )r   r   
max_lengthellipsisr   r   r   r!   r"   r#   r#     s(     4 4s 4 4C 4C 4r$   c                st    \        V 4      V8:  d   V # V\        V4      ,
          ^,          pV RV  V W) R  2# )u   Elides a string in the middle if it is too long

Example:

>>> elide_middle('This text has more than 10 characters.', max_length=10)
'This…ers.'
Nrm   )r   r   r   Zhalfs   &&& r"   elide_middler     sG     4yJX&1,D5Dk]8*T%&\N33r$   c                r   r   r   r   r!   r"   r#   r#     s     1 13 14 1r$   c                s    \         P                  R8  d   V P                  4       # \        ;QJ d    R V  4       F  '       d   K   R# 	  R# ! R V  4       4      # )u   Checks whether all characters in text are ASCII characters

Returns “True” if the text is all ASCII, “False” if not.

:param text: The text to check

Examples:

>>> is_ascii('Abc')
True

>>> is_ascii('Naïve')
False
c              3   s>   "   T F  p\        V4      ^8  x  K  	  R# 5i)i   N)ord).0charr   r"   	<genexpr>Zis_ascii.<locals>.<genexpr>  s     044s4y34s   FT)   i   )sysversion_infoZisasciiallr'   r(   r"   is_asciir    sG     6!||~304033030304000r$   c                r   r   r   r   r!   r"   r#   r#     s     H Hs Ht Hr$   c                sj    \         ;QJ d    R V  4       F  '       d   K   R# 	  R# ! R V  4       4      # )al  Checks whether a text is invisible

Returns True if the text is invisible, False if not.

May return True for some texts which are not completely
invisible but hard to see in most fonts.

:param text: The text

Examples:

>>> is_invisible('a')
False

>>> is_invisible(' ')
True

>>> is_invisible(' a')
False

>>> is_invisible('  ')
True

>>> is_invisible('')
True
c              3   sT   "   T F  p\         P                  ! V4      R9   x  K   	  R# 5i)CcN)r  ZCfZZlZZpZZsr   r   )r   	characterr   r"   r   Zis_invisible.<locals>.<genexpr>  s+      HBFY ##I.01BFs   &(FT)r  r'   r(   r"   is_invisibler    sG    6 3 HBFH33 H3 H3 HBFH H Hr$   c                s<    V ^8  d   QhR\         R\        R\        /# )r   r   caretr   r   r   r!   r"   r#   r#     s&     G Gc G# G# Gr$   c                s   V '       d   V^ 8  d   ^ # \        V 4      pW8  d   ^ # \        '       g	   W!,
          # \        \        P                  ! RV 4      4      p^ pV F#  pVP                  4       V8  g   K  V^,          pK%  	  V# )u  Estimates number of `Left` steps to reach the caret position from the end

The exact number of `Left` steps needed to reach the caret position may
depend on the editor application used.

Examples:

>>> estimate_left_steps('ü', 1)
0
>>> estimate_left_steps('ü', 0)
1
>>> estimate_left_steps('ü', 0) # U+0308 COMBINING DIAERESIS
1
>>> estimate_left_steps('ü', 1) # U+0308 COMBINING DIAERESIS
1
>>> estimate_left_steps('ü', 2) # U+0308 COMBINING DIAERESIS
0
>>> estimate_left_steps('grün', 3)
2
>>> estimate_left_steps('क्फ़्र', 6)
0
>>> estimate_left_steps('क्फ़्र', 5)
1
>>> estimate_left_steps('क्फ़्र', 3)
1

# In reality the following needs 2 steps in gedit, gnome-text-editor, emacs, ...
>>> estimate_left_steps('क्फ़्र', 0)
1
>>> estimate_left_steps('ক্ষ্র', 5)
0
>>> estimate_left_steps('ক্ষ্র', 4)
1
>>> estimate_left_steps('ক্ষ্র', 1)
1
>>> estimate_left_steps('ক্ষ্র', 0)
1
>>> estimate_left_steps('🇩🇪', 2)
0
>>> estimate_left_steps('🇩🇪', 1)
1
>>> estimate_left_steps('🇩🇪', 0)
1
>>> estimate_left_steps('🏴󠁧󠁢󠁳󠁣󠁴󠁿', 7)
0
>>> estimate_left_steps('🏴󠁧󠁢󠁳󠁣󠁴󠁿', 6)
1
>>> estimate_left_steps('🏴󠁧󠁢󠁳󠁣󠁴󠁿', 1)
1
>>> estimate_left_steps('🏴󠁧󠁢󠁳󠁣󠁴󠁿', 0)
1
>>> estimate_left_steps('🏴󠁧󠁢󠁳󠁣󠁴󠁿', -1) # invalid caret!
0
>>> estimate_left_steps('🇩🇪🏴󠁧󠁢󠁳󠁣󠁴󠁿', 2)
1
z\X)rm   USING_REGEXlistrh   ZfinditerZend)r   r  ZlengthZclustersZstepsr      &&    r"   estimate_left_stepsr    ss    r 519YF;~BKKt,-H E99;QJE  Lr$   u   ẞZSS   ßt   Øt   øZot   ÆZAEt   æZaeu   ŒZOEu   œZoeu   Łu   łZlt   ÞZTHu   Ħu   Ŋu   Ŧc                s<    V ^8  d   QhR\         R\         R\         /# )r   r   keepr   r   r   r!   r"   r#   r#   *  s&     /F /F /FC /F /Fr$   c           
     s   V'       g   RP                  \        P                  ! RV 4       Uu. uF"  p\        P                  ! V4      R8w  g   K   VNK$  	  up4      P	                  \
        4      p\        P                  ! \        V4      # Rp\        P                  ! RV4      p\        P                  ! RV 4       F  pWA9   d   W4,          pK  TRP                  \        P                  ! RV4       Uu. uF"  p\        P                  ! V4      R8w  g   K   VNK$  	  up4      P	                  \
        4      ,          pK  	  \        P                  ! \        V4      # u upi u upi )u.  Removes accents from the text

Using “from unidecode import unidecode” is maybe more
sophisticated, but I am not sure whether I can require
“unidecode”. And maybe it cannot easily keep some accents for some
languages.

:param text: The text to change
:param keep: A string of characters which should be kept unchanged
:return: The text with some or all accents removed
         in NORMALIZATION_FORM_INTERNAL

Examples:

>>> remove_accents('Ångstrøm')
'Angstrom'

>>> remove_accents('ÅÆæŒœĳøßẞü')
'AAEaeOEoeijossSSu'

>>> remove_accents('abcÅøßẞüxyz')
'abcAossSSuxyz'

>>> unicodedata.normalize('NFC', remove_accents('abcÅøßẞüxyz', keep='åÅØø'))
'abcÅøssSSuxyz'

>>> unicodedata.normalize('NFC', remove_accents('alkoholförgiftning', keep='åÅÖö'))
'alkoholförgiftning'

r-   NFKDZMnNFC)r   r   	normalizer   Z	translateTRANS_TABLENORMALIZATION_FORM_INTERNAL)r   r  rq   resultr   s   &&   r"   r   r   )  s0   D ",,VT:0:!##A&$. A:0 11:;1G 	 $$%@&IIF  -D%%eT2<NF"''",,VT:0:!##A&$. A:0 11:;1G	H	 3   !<fEE00s   EE2EEuK  
    A few names for Unicode characters which don’t have
    any official names (That includes most control characters).

    EmojiMatcher loads a more complete list of names, but
    EmojiMatcher might not be loaded in Typing Booster if
    emoji predictions are off and loading it only for these
    names seems overkill.
     ZNULLZzSTART OF HEADINGZzSTART OF TEXTZzEND OF TEXTZzEND OF TRANSMISSIONZZENQUIRYZZACKNOWLEDGEZZBELLZ	BACKSPACE	zCHARACTER TABULATION
zLINE FEED (LF)ZzLINE TABULATIONZzFORM FEED (FF)zCARRIAGE RETURN (CR)Zz	SHIFT OUTZzSHIFT INZzDATA LINK ESCAPEZzDEVICE CONTROL ONEZzDEVICE CONTROL TWOZzDEVICE CONTROL THREEZzDEVICE CONTROL FOURZzNEGATIVE ACKNOWLEDGEZzSYNCHRONOUS IDLEZzEND OF TRANSMISSION BLOCKZCANCELZzEND OF MEDIUMZZ
SUBSTITUTEZESCAPEZzINFORMATION SEPARATOR FOURZzINFORMATION SEPARATOR THREEZzINFORMATION SEPARATOR TWOZzINFORMATION SEPARATOR ONEZDELETEt   zBREAK PERMITTED HEREt   zNO BREAK HEREt   zNEXT LINE (NEL)t   zSTART OF SELECTED AREAt   zEND OF SELECTED AREAt   zCHARACTER TABULATION SETt   z'CHARACTER TABULATION WITH JUSTIFICATIONt   zLINE TABULATION SETt   zPARTIAL LINE FORWARDt   zPARTIAL LINE BACKWARDt   zREVERSE LINE FEEDt   zSINGLE SHIFT TWOt   zSINGLE SHIFT THREEt   zDEVICE CONTROL STRINGt   zPRIVATE USE ONEt   zPRIVATE USE TWOt   zSET TRANSMIT STATEt   zCANCEL CHARACTERt   zMESSAGE WAITINGt   zSTART OF GUARDED AREAt   zEND OF GUARDED AREAt   zSTART OF STRINGt   zSINGLE CHARACTER INTRODUCERt   zCONTROL SEQUENCE INTRODUCERt   zSTRING TERMINATORt   zOPERATING SYSTEM COMMANDt   zPRIVACY MESSAGEt   zAPPLICATION PROGRAM COMMANDc                r   )r   r  r   r   r   r!   r"   r#   r#     s      C C r$   c                s    V '       d   \        V 4      ^8  d   R#  \        P                  ! V 4      pV#   \         d    \        P                  T R4      p T# i ; i)a  
Get a name for an Unicode character

:param character: The character to get the name for.
:return:          The name from unicodedata.name(character)
                  or a fallback.

Examples:

>>> unicode_name('a')
'LATIN SMALL LETTER A'
>>> unicode_name('')
'BACKSPACE'
r-   )rm   r   r   
ValueErrorUNICODE_DATA_EXTRA_NAMESr   )r  r  r   r"   unicode_namer    sY     I*=!!), M  =)--i<M=s   4 !AAu   क़u   क़u   ख़u   ख़u   ग़u   ग़u   ज़u   ज़u   ड़u   ड़u   ढ़u   ढ़u   फ़u   फ़u   य़u   य़u   ড়u   ড়u   ঢ়u   ঢ়u   য়u   য়u   ਲ਼u   ਲ਼u   ਸ਼u   ਸ਼u   ਖ਼u   ਖ਼u   ਗ਼u   ਗ਼u   ਜ਼u   ਜ਼u   ਫ਼u   ਫ਼u   ଡ଼u   ଡ଼u   ଢ଼u   ଢ଼u   གྷu   གྷu   ཌྷu   ཌྷu   དྷu   དྷu   བྷu   བྷu   ཛྷu   ཛྷu   ཀྵu   ཀྵu   ྲྀu   ྲྀu   ླྀu   ླྀu   ྒྷu   ྒྷu   ྜྷu   ྜྷu   ྡྷu   ྡྷu   ྦྷu   ྦྷu   ྫྷu   ྫྷu   ྐྵu   ྐྵu   ⫝̸u   ⫝̸u   ᴕEu   ᴕFu   ᴖ0u   ᴖ1u   ᴖ2u   ᴖ3u   ᴖ4u   ᴛBu   ᴛCu   ᴛDu   ᴛEu   ᴛFu   ᴜ0Z|c                r   r   r   r   r!   r"   r#   r#     s     E E3 E3 Er$   c                sx    V R8X  d   R# \         P                  ! RV 4      p R R lp\        P                  W4      # )uI  
Normalize to NFC **and** also recompose characters listed as
composition exclusions.

:param text: The text to normalize
:return: The normalized text

Examples:

>>> normalize_nfc_and_composition_exclusions('ড়')
'ড়'

>>> normalize_nfc_and_composition_exclusions('grün ড় ঢ় য় ড')
'grün ড় ঢ় য় ড'
r-   r  c                r   )r   r   r   )r   r   r   r!   r"   r#   Z>normalize_nfc_and_composition_exclusions.<locals>.__annotate__2  s     6 6# 6# 6r$   c                 s:    \         V P                  ^ 4      ,          # )i    )COMPOSITION_EXCLUSIONSr   )r   r(   r"   replace_exclusionsZDnormalize_nfc_and_composition_exclusions.<locals>.replace_exclusions2  s    %ekk!n55r$   )r   r  COMPOSITION_EXCLUSION_REGEXri   )r   r  r   r"   (normalize_nfc_and_composition_exclusionsr!    s9    $ rz  -D
6 '**+=DDr$   c                r   r   r   r   r!   r"   r#   r#   7  s      4 r$   c                 sp    \        4       p V '       g   R# V P                  R4      ^ ,          pVR9   d   R# R# )z
Check whether the effective LC_MESSAGES locale points to a languages
which is usually written in a right-to-left script.

:return: True if right-to-left, False if not.
Fr)   T)	r6   ZarcZdvrL   rM   r   ZsyrrP   rQ   )r   rf   )Zlc_messages_localer]   s     r"   is_right_to_left_messagesr#  7  s9     34##C(+DGG& r$   c                r   r   r   r   r!   r"   r#   r#   X  s     1 13 14 1r$   c                s    RpV  FK  p\         P                  ! V4      pV'       d
   VR8w  d   K*  RpVR9   d    R# VR8X  d    R# VR9   g   KI  RpKM  	  R# )u  Check whether a text is right-to-left text or not

:param text: The text to check

See: http://unicode.org/reports/tr9/#P2

TR9> In each paragraph, find the first character of type L, AL, or R
TR9> while skipping over any characters between an isolate initiator
TR9> and its matching PDI or, if it has no matching PDI, the end of the
TR9> paragraph

U+2069 POP DIRECTIONAL ISOLATE
U+2068 FIRST STRONG ISOLATE

Examples:

>>> is_right_to_left('Hallo!')
False

>>> is_right_to_left('﷼')
True

>>> is_right_to_left('⁨﷼⁩')
False

>>> is_right_to_left('⁨﷼⁩﷼')
True

>>> is_right_to_left('a⁨﷼⁩﷼')
False

>>> is_right_to_left('⁨a⁩⁨﷼⁩﷼')
True
FZPDITr   )ZALr   )ZLRIZRLIZFSI)r   Zbidirectional)r   Zskipr   Zbidi_catrs   r"   is_right_to_leftr$  X  s^    J D,,T2H%{"s?,,D  r$   c                r   r   r   r   r!   r"   r#   r#     s     , ,S ,S ,r$   c                s    \        V 4      '       d#   \        R4      V ,           \        R4      ,           # \        R4      V ,           \        R4      ,           # )uO  Embed the text using explicit directional embedding

Returns “RLE + text + PDF” if the text is right-to-left,
if not it returns “LRE + text + PDF”.

:param text: The text to embed

See: http://unicode.org/reports/tr9/#Explicit_Directional_Embeddings

Examples:

>>> bidi_embed('a')
'‪a‬'

>>> bidi_embed('﷼')
'‫﷼‬'
i+   i,   i*   )r$  rz   r'   r(   r"   
bidi_embedr%    s?    ( 6{T!CK//v;F++r$   c                r   r   r   r   r!   r"   r#   r#     s      # $ r$   c                sX    V  F#  p\         P                  ! V4      pVR9   g   K"   R# 	  R# )u   Returns whether “text” contains a “letter” type character

:param text: The text to check

Examples:

>>> contains_letter('Hi!')
True

>>> contains_letter(':-)')
False
TF)LlLuZLor  )r   r   r   r^   r"   contains_letterr(    s/     ''-**  r$   c                sD    V ^8  d   QhR\         P                  R\        /# )r   r   r   )r   Variantr   r   r!   r"   r#   r#     s      dll s r$   c                s   V f   R# \        V \        P                  4      '       g   \        P	                  R4       V # V P                  4       pVR8X  d   V P                  4       # VR8X  d   V P                  4       # VR8X  d   V P                  4       # VR8X  d   V P                  4       # VR8X  d   V P                  4       # VR8X  d   V P                  4       # VR	8X  d   V P                  4       # VR
8X  d   V P                  4       # V'       d   V^ ,          R8X  d   V P                  4       # \        P                  RV4       V # )z#
Convert a GLib variant to a value
Nznot a GLib.VariantZsiZurq   r   dZbZvZazunknown variant type: %s)
isinstancer   r)  ro   r   Zget_type_stringZ
get_stringZ	get_int32Z
get_uint32Z	get_int64Z
get_uint64Z
get_doubleZget_booleanZunpackrp   )r   Ztype_stringr   r"   variant_to_valuer-    s"    gt||,,()))+Kc!!##c  ""c!!##c  ""c!!##c!!##c""$$c~~{1~,~~
LL+[9Nr$   c                r   r   r"  r   r!   r"   r#   r#     s      $ r$   c            	     s    \         P                  ! R4      p V '       g   R#  \        P                  ! V R.\        P                  \        P                  RR^R7      pR#   \        P
                   d"   p\        P                  RT4        Rp?R# Rp?i\        P                   d-   p\        P                  R	YTP                  4        Rp?R# Rp?i\         d"   p\        P                  R
Y4        Rp?R# Rp?ii ; i)zECall `ibus write-cache`

:return: True on success, False on failure.
ibusFzwrite-cacheutf-8T)stdoutstderrr   checktimeoutz&ibus write-cache command timed out: %sN(Exception when calling %s: %s stderr: %sException when calling %s: %s)shutilwhich
subprocessrunPIPETimeoutExpiredro   rp   CalledProcessError	exceptionr1  	Exception)ibus_binaryZ_resultrp   s      r"   ibus_write_cacher@    s    
 ,,v&KA..-(???? $$ F=uEE  (( .6	. 	.   A+[	A 	AAs;   :A C=3BC=&C='!CC=C=C88C=c                sh    V ^8  d   QhR\         \        \         \        \        3,          3,          /# r   )r   r   r   r!   r"   r#   r#     s%     ) )c4S>12 )r$   c                 sv   \         P                  ! R4      p V '       g   / #  \        P                  ! V R.\        P                  \        P                  RRR7      p/ p\
        P                  P                  P                  VP                  4      pVP                  R4       F  pVP                  R4      pVP                  R4      pVP                  R	4      pVf   K<  VP                  '       g   KP  Vf   KV  VP                  '       g   Kj  Vf   Kp  VP                  '       g   K  RVP                  R	VP                  /W%P                  &   K  	  V#   \        P                   d"   p\        P                  RT4        R
p?/ # R
p?i\        P                    d-   p\        P#                  RYTP$                  4        R
p?/ # R
p?i\
        P                  P                  P&                   d"   p\        P#                  RT4        R
p?/ # R
p?i\(         d"   p\        P#                  RY4        R
p?/ # R
p?ii ; i)zCall `ibus read-cache` and parse engine information

:return: Dictionary containing information like this:
         {'engine name 1': {'symbol': '1', 'icon': '1.png'},
          'engine name 2': {'symbol': '2', 'icon': '2.png'},
           ...}
r.  z
read-cacher/  Tr0  r1  r   r2  z	.//enginer   ZsymboliconNz%ibus read-cache command timed out: %sr4  zFailed to parse XML output: %sr5  )r6  r7  r8  r9  r:  xmlZetreeZElementTreeZ
fromstringr0  Zfindallr   r   r;  ro   rp   r<  r=  r1  Z
ParseErrorr>  )	r?  r  Zresult_dictr   ZengineZ	name_elemZsymbol_elemZ	icon_elemrp   s	            r"   ibus_read_cacherD    s    ,,v&K	A,'????D	*
 yy$$//>ll;/FF+I ++h/KF+I%)...+0@0@0@)innnk..	/HNN+ 0 $$ E<eDD I (( .6	. 	. I 99  ++ 5,e	5 	5
 I  A+[	A 	AIAsr   B6E E 1E 7E E E %+E H8&FH8H8!G*H8,H8-H		H8H8H33H8c                r   r   r   r   r!   r"   r#   r#     s     = =C =r$   c                 s   \         P                  P                  RR4      P                  4       R8X  Ed   \        P
                  ! R4      p V '       dr    \        P                  ! V RRRRR	.R
R
R
R7      pVP                  P                  4       '       d0   \        P                  R4       VP                  P                  4       #  \        P
                  ! R4      pV'       do    \        P                  ! VRR.R
R
R
R7      pVP                  P                  4       '       d0   \        P                  R4       VP                  P                  4       #  \         P                  P                  RR4      P                  4       R8X  d   \        P
                  ! R4      pV'       dn    \        P                  ! VR.R
R
R
R7      pVP                  P                  4       '       d0   \        P                  R4       VP                  P                  4       #   \        P                  ! \        P                  \         P                   P#                  \         P                   P%                  \&        4      R4      .R
R
R
RR7      pVP                  P                  4       '       d0   \        P                  R4       VP                  P                  4       #  R#   \         d"   p\        P                  RT4        Rp?R# Rp?ii ; i  \         d"   p\        P                  RT4        Rp?R# Rp?ii ; i  \         d"   p\        P                  RT4        Rp?R# Rp?ii ; i  \         d"   p\        P                  RT4        Rp?R# Rp?ii ; i)zGet the primary selection textZXDG_SESSION_TYPEr-   Zx11Zxclipz-outz
-selectionZprimaryz-targetZUTF8_STRINGT)capture_outputr   r2  z!Got primary selection with xclip.zxclip failed: %sNZxselz-pz-oz Got primary selection with xsel.zxsel failed: %sZwaylandzwl-pastez$Got primary selection with wl-paste.zwl-paste failed: %szget_clipboard_gtk4.pyg      ?)rE  r   r2  r3  z Got primary selection with Gtk4.z#Primary selection helper failed: %s)r~   r   r   r   r6  r7  r8  r9  r0  rg   ro   r   r>  r=  r   Z
executablepathr   dirname__file__)Zxclip_binaryr  Zxclip_errorZxsel_binaryZ
xsel_errorZwl_paste_binaryZwl_paste_errorrp   s           r"   get_primary_selection_textrI    s   	zz~~("-335>||G,#!\9iP#'  ==&&((KK CD!==..00 ) ll6*# $-#'	 
 ==&&((KK BC!==..00 ) 
zz~~("-335B ,,z2#$d+#'	 
 ==&&((KK FG!==..00 )G^^WW\\"''//(35LMO ==  KK:;==&&(( !
 ]    !3[A    !2J?    !6G  G>FFGsy   ?K .K #<K:  .K: ";L) .L) B	M .M K7K22K7:L&L!!L&)M4MMN#M??Nc                st    V ^8  d   QhR\         \        \        3,          R\         \        \        3,          /# )r   dictsr   )r   r   r   r   r!   r"   r#   r#   [  s*      DcN tCH~ r$   c                 s    \        R 4      pV  F/  pVP                  4        F  w  r4WAV,          8  g   K  WAV&   K  	  K1  	  \        V4      # )a<  Merges multiple dictionaries, keeping the maximum value for each key.

:param *dicts: Variable number of dictionaries with string keys and
               integer values.
:return:       A new dictionary where each key from the input
               dictionaries maps to the maximum value found across
               all inputs.  If a key appears in only one
               dictionary, its value is preserved.

Examples:
    >>> a = {'a': 0, 'b': -1, 'c': 0, 'f': -5}
    >>> b = {'d': 0, 'b': 2, 'f': -2}
    >>> c = {'a': 5, 'e': 3, 'f': 1}
    >>> result = merge_dicts_max(a, b, c)
    >>> all(result[k] == v for k, v in
    ...     {'a':5, 'b':2, 'c':0, 'd':0, 'e':3, 'f':1}.items())
    True

    >>> merge_dicts_max({'x': 1}, {'x': 2, 'y': 3})
    {'x': 2, 'y': 3}

    >>> merge_dicts_max()  # No input dictionaries
    {}

c                  s2    \         P                  ) ^,
          # )r   )r   r   r*   r$   r"   <lambda>Z!merge_dicts_max.<locals>.<lambda>u  s    S[[L1<Lr$   )r   r   Zdict)rJ  Z
max_valuesr+  r   r   s   *    r"   merge_dicts_maxrL  [  sI    4 )44L(MJ'')JC#&"'3 $  
r$   c                sx    V ^8  d   QhR\         \        \        3,          R\         \        \        3,          RR/# )r   pdictother_pdictr   N)r   r   r   r!   r"   r#   r#   |  s4     * *CH~*,0cN*?C*r$   c                s<    V F  pW 9   g   K  W,          W&   K  	  R# )a  Update values of existing keys in a Python dict from another Python dict

Using pdict.update(other_pdict) would add keys and values from other_pdict
to pdict even for keys which do not exist in pdict. Sometimes I want
to update only existing keys and ignore new keys.

:param pdict: The Python dict to update
:param other_pdict: The Python dict to get the updates from

Examples:

>>> old_pdict = {'a': 1, 'b': 2}
>>> new_pdict = {'b': 3, 'c': 4}
>>> dict_update_existing_keys(old_pdict, new_pdict)
>>> sorted(old_pdict.items())
[('a', 1), ('b', 3)]
>>> old_pdict.update(new_pdict)
>>> sorted(old_pdict.items())
[('a', 1), ('b', 3), ('c', 4)]
Nr*   )rM  rN  r      && r"   dict_update_existing_keysrP  |  s    , <$)EJ r$   c                r   )r   r   	max_bytesr   )r   r   bytesr   r!   r"   r#   r#     s!     ' 'S 'S 'U 'r$   c                s    V P                  R4      p\        V4      V8:  d   V# VRV p  VP                  R4       V#   \         d
    TRR p K(  i ; i)zh
Truncate a UTF-8 string to at most `max_bytes` bytes,
without ever cutting a multibyte UTF-8 sequence.
UTF-8Nr   )encoderm   decodeUnicodeDecodeError)r   rQ  ZencodedZ	truncatedr   r"   utf8_safe_truncaterW    se    
 kk'"G
7|y 
#I
	'W%! 	'!#2I	's   > AAc                s(    V ^8  d   QhR\         RR/# )r   r   r   Nr   r   r!   r"   r#   r#     s     $G $G3 $G4 $Gr$   c           	     s<   \         P                  ! 4       pVR9   dm   \        P                  ! \        P                  P                  R4      4      pVP                  RV P                  R4      4       \        P                  RV 4       R# VR8X  d   \        P                  ! \        P                  P                  R4      4      p^p\        W4      p\        V4      \        V P                  R4      4      8  d(   \        P                  RWP                  RR	R
7      4       \        P                  ! V^,           4      pWEn        ^pVP!                  V\        P"                  ! V4      ^ ^ ^ 4       \        P                  RW%V4       R# \        P%                  RV4       R# )a  
Set a short process name on Linux (prctl PR_SET_NAME)
or BSD (setproctitle).

Useful to make a nicer process name show up in
apps like `gnome-system-monitor` instead of just
showing a `python3` process.

See:

https://github.com/mike-fabian/ibus-typing-booster/issues/833
Zcs   %srS  u   setproctitle → %rNZLinuxr/  u1   Process name truncated for PR_SET_NAME: %r → %rignore)errorsz#trying to set program name %r %r %rz)set_program_name: unsupported platform %r)ZFreeBSDZOpenBSDZNetBSD)platformZsystemctypesZCDLLZutilZfind_libraryZsetproctitlerT  ro   r   rW  rm   warningrU  Zcreate_string_bufferr   ZprctlZbyrefdebug)r   ZsysnameZlibcrQ  Z
name_bytesZbuffZPR_SET_NAME   &      r"   set_program_namer_    s2    ooG22{{6;;33C89%W!56)40'{{6;;33C89	'8
z?SW!566NNC'''AC **9q=9


;T 2Aq!<94zR
LL<gFr$   c                r   r   r   r   r!   r"   r#   r#     s     2 23 2r$   c                 sZ    \         '       d   \        \        P                  ! 4       4      # R# )a  
Compatibility wrapper around distro.id()

From the help of distro.id():

    This package maintains the following reliable distro ID values:

    ==============  =========================================
    Distro ID       Distribution
    ==============  =========================================
    "ubuntu"        Ubuntu
    "debian"        Debian
    "rhel"          RedHat Enterprise Linux
    "centos"        CentOS
    "fedora"        Fedora
    "sles"          SUSE Linux Enterprise Server
    "opensuse"      openSUSE
    "amazon"        Amazon Linux
    "arch"          Arch Linux
    "cloudlinux"    CloudLinux OS
    "exherbo"       Exherbo Linux
    "gentoo"        GenToo Linux
    "ibm_powerkvm"  IBM PowerKVM
    "kvmibm"        KVM for IBM z Systems
    "linuxmint"     Linux Mint
    "mageia"        Mageia
    "mandriva"      Mandriva Linux
    "parallels"     Parallels
    "pidora"        Pidora
    "raspbian"      Raspbian
    "oracle"        Oracle Linux (and Oracle Enterprise Linux)
    "scientific"    Scientific Linux
    "slackware"     Slackware
    "xenserver"     XenServer
    "openbsd"       OpenBSD
    "netbsd"        NetBSD
    "freebsd"       FreeBSD
    ==============  =========================================

There seem to be other return values, so far I know:

    "opensuse-leap" openSUSE Leap
    "opensuse-tumbleweed" openSUSE tumbleweed
    "sles"          SUSE Linux Enterprise server
    "sled"          SUSE Linux Enterprise Desktop 15 SP1

r-   )IMPORT_DISTRO_SUCCESSFULr   distrorN   r*   r$   r"   	distro_idrb    s    `  699;r$   c                s:    V ^8  d   QhR\         \        ,          /# r   r   r   r   r!   r"   r#   r#     s      49 r$   c                 s   . p \         P                  P                  \         P                  P                  \        4      R4      p\        R4      p. p\         P                  P                  R4      pV'       dG   VP                  R4       Uu. uF+  qU'       g   K  \         P                  P                  V4      NK-  	  ppV P                  V4       V P                  \         P                  P                  R4      4       V P                  \         P                  P                  R4      4       V P                  V4       V P                  V4       V P                  . RO4       V # u upi )zN
Return a list of directories where hunspell dictionaries
should be searched.
z../datazibus-typing-booster/dataZDICPATHr.   z~/.config/enchant/nuspellz~/.config/enchant/hunspell)z/usr/share/hunspellz/usr/share/myspellz/usr/share/myspell/dictsz/usr/local/share/hunspellz/usr/local/share/myspellz/usr/local/share/myspell/dicts)r~   rF  r   rG  rH  xdg_save_data_pathr   r   rf   
expanduserrl   Zextend)dirnamesZdatadirZuser_datadirZdicpathsZdicpath_stringrF  s         r"   hunspell_dirnamesrg    s   
 Hggll277??84i@G%&@ALHZZ^^I.N . 4 4S 9C 9T -BGG&&t, 9 	 COOL! OOBGG&&'BCDOOBGG&&'CDEOOGOOHOO   O#Cs   	E"#E"c                sR    V ^8  d   QhR\         R\        \         \         3,          /# r   r\   r   )r   r   r   r!   r"   r#   r#     s"      s uS#X r$   c           	     s   RpRp\        4       p\        V .4       F  pVP                  R4      '       d   V P                  R4      '       g   K3  V F  p\        P                  P                  \        P                  P                  WTR,           4      4      '       g   KN  \        P                  P                  WTR,           4      p\        P                  P                  WTR,           4      pW3u u # 	  K  	  \        P                  RW4       R# )ah  
Find the hunspell dictionary file for a language

:param language: The language of the dictionary to search for

The returned Tuple contains (dic_path, aff_path) where
dic_path is the full path of the .dic file found
and aff_path is the full path of the .aff file found.
If no dictionary can be found for the requested language,
the return value is ('', '').
r-   r0   z.dicz.affzNo file %s.dic found in %sr-   r-   )	rg  rY   r   r~   rF  isfiler   ro   r\  )r\   dic_pathaff_pathrf  r]   rG  s   &     r"   find_hunspell_dictionaryrm    s     HH+-H (,??4  )<)<T)B)B Gww~~bggll76MBCC77<<?77<<? ++	   - NN$h:Or$   c                sr    V ^8  d   QhR\         R\        \         \         \        \         ,          3,          /# rh  )r   r   r   r   r!   r"   r#   r#   =  s0     F6 F6F6S$s) 34F6r$   c                s"   \        V 4      w  rV'       g   RR. 3# \        P                  RV4       Rp\        P                  P                  V4      '       d   Rp \        VRRR7      ;_uu_ 4       pVP                  4       P                  RR4      pR	R	R	4       T'       d}   \        P                   ! R\        P"                  4      pTP%                  T4      pT'       d)   TP'                  R4      p\        P                  RY24       M.\        P                  RT4       M\        P                  RW!V4       . p	 \        WR7      ;_uu_ 4       p
V
P)                  4       p	R	R	R	4       T	'       g   RR. 3# \        P                  RY4       T	 Uu. uFD  p\,        P.                  ! \0        \        P2                  ! RRTP                  RR4      4      4      NKF  	  ppYT3#   + '       g   i     ELT; i  \        \        3 d7   p\        P                  R
Y&P                  P                  T4        R	p?ELR	p?i\         d7   p\        P                  RY&P                  P                  T4        R	p?ELR	p?ii ; i  + '       g   i     EL%; i  \*        \        \        3 Ed"   p\        P                  RYTP                  P                  T4       Rp \        YR7      ;_uu_ 4       p
T
P)                  4       p	R	R	R	4        R	p?EK    + '       g   i      R	p?EL; i  \*        \        \        3 dA   p\        P                  RYTP                  P                  T4       RR. 3u R	p?u R	p?# R	p?i\         d@   p\        P                  RYP                  P                  T4       RR. 3u R	p?u R	p?# R	p?ii ; iR	p?i\         d;   p\        P                  RYP                  P                  T4       RR. 3u R	p?# R	p?ii ; iu upi )a  
Open the hunspell dictionary file for a language

:param language: The language of the dictionary to open

The returned Tuple looks  like this:

    (dic_path, dictionary_encoding, wordlist)

where dic_path is the full path of the dictionary file found,
dictionary_encoding is the encoding of that dictionary file,
and wordlist is a list of words found in that file.
If no dictionary can be found for the requested language,
the return value is ('', '', []).
r-   z%s file found.rS  z
ISO-8859-1rX  r   rY  z
r  Nz"Error loading .aff File %s: %s: %sz-Unexpected error loading .aff File %s: %s: %sz0^[\s]*SET[\s]+(?P<encoding>[-a-zA-Z0-9_]+)[\s]*$r   z"dictionary encoding=%s found in %szNo encoding found in %sz4%s file missing. Trying to open %s using %s encoding)r   zAloading %s as %s encoding failed, fall back to ISO-8859-1. %s: %sz3loading %s as %s encoding failed, giving up. %s: %sz-Unexpected error loading .dic File %s: %s: %sz)Successfully loaded %s using %s encoding.z[/\t ].*)rm  ro   r   r~   rF  rj  openreadr   FileNotFoundErrorPermissionErrorr=  	__class____name__r>  rh   r   	MULTILINEr   r   	readlinesrV  r   r  r  ri   )r\   rk  rl  Zdictionary_encodingZ
aff_bufferZaff_filerp   Zencoding_patternr   Z
dic_bufferZdic_fileZerror2rq   Z	word_lists   &             r"    get_hunspell_dictionary_wordlistrw  =  s}   " 4H=XB|
KK (+!	ww~~h
	Hh+%' '*2%]]_44VTB
' !zzC  %++J7E&+kk*&=#8'3 -x9 	B 3	5 J(99X!++-J :8 B|
KK3'^ 	 A 	'FF;AIIdB$78	: 	   955[' ' ' "?3 	HA%'?'?H H 	H?%'?'?H H	H. :99 1?C  .5??+C+CU	L +	 h==%//1
 >===="!! 	  Eu/G/GQ B< 	 ?//22F< B<		 
  ;oo..	7 B|	ds  G1 1!GG1 9J I:J A
PG.	(G1 .G1 1I7+H33I7 I7+I22I7:J	J J P	%.OL (L9L LL L  N>60M1&N>'O+P	1N>>N>?/N9.N>/O3P	9N>>OP	P	/P>P	P	)Zfrozenc                   sD   a  ] tR tRt o RtRtRtRtRtRt	V 3R lt
RtV tR# )	PredictionCandidatei  a  
A dataclass containing the parts of a prediction candidate
found in the user database, the (hunspell) dictionaries, produced
by hunspell spellchecking, found by the emoji matcher, or found by
looking up related matches.

phrase: str = ''              The candidate itself, i.e. the text
                              which might be eventually committed.
user_freq: float = 0.0        A number indicating a usage frequency.
                              If the candidate comes from the user database,
                              this is a floating point number between 0 and 1.
                              If the candidate comes from the emoji matcher,
                              it is some bigger floating point number.
                              If the candidate comes from looking up related
                              stuff it is usually a small integer  number.
comment: str = ''             May give some extra  information about
                              the candidate, for example the name of an emoji.
                              This is just some extra information, it will not be
                              committed.
from_user_db: bool = False    True if this candidate comes from the
                              user database, False if not.
spell_checking: bool = False  True if this candidate was produced
                              by spellchecking, False if not.

r-           Fc                sV   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[ ;R&   S[;R&   S[;R&   # )r   phrase	user_freqcommentfrom_user_dbspell_checking)r   floatr   r    __classdict__   "r"   r#   Z PredictionCandidate.__annotate__  sF     6 7 8 9 : ; < = >  ? r$   r*   N)rt  
__module____qualname____firstlineno____doc__rz  r{  r|  r}  r~  Z__annotate_func____static_attributes____classdictcell__r     @r"   rx  rx    s,     2 FIGL N?  r$   rx  c          	      s    V ^8  d   QhR\         \        \        3,          R\        R\        R\
        \        ,          /# )r   phrase_frequenciestitlemax_candidatesr   )r   r   r  r   r   r   rx  r   r!   r"   r#   r#     s?     $ $ e,$$ $ &**=%>$r$   c           	     s0   V '       g   . # V P                  4        UUu/ uF  w  r4\        V4      VbK  	  ppp\        VP                  4       R R7      RV  UUu. uF  w  r4\        W4R7      NK  	  pppV'       g   V# . p\	        4       pV Fz  p	V	P
                  R,          P                  4       V	P
                  R,          ,           p
W9  g   KD  VP                  \        WP                  R7      4       VP                  V
4       K|  	  V# u uppi u uppi )zSorts the phrase_frequencies dictionary and returns the best
candidates.

Should *not* change the phrase_frequencies dictionary!
c                 sV    RV ^,          ,          \        V ^ ,          4      V ^ ,          3# )r   r   r   rq   r(   r"   rK  Z!best_candidates.<locals>.<lambda>  s$    qtG!IaD'r$   r   N)rz  r{  r   r   )
r   r!  sortedrx  r   rz  r  rl   r{  r   )r  r  r  rz  ZfreqZphrase_frequencies_normalizedZ
candidatesZcandidates_titleZseen_phrasesZ	candidateZphrase_titles   &&&        r"   best_candidatesr    s)    	
 /446%86LF 	18$>6 " %8 	,224	
 +N	,-	, F 	6:	,  - 245L	 ''+113i6F6Fr6JJ+###'3F3FHI \*   /%8-s   DDc                   s   a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	V 3R lR lt
V 3R lR ltRtRtRtRtRtRtRtRtRtRtV tR# )
Capabilitei  av  Compatibility class to handle IBus.Capabilite the same way no matter
what version of ibus is used.

For example, older versions of ibus might not have IBus.Capabilite.SYNC_PROCESS_KEY_V2
(or maybe even do not have IBus.Capabilite at all). Then

    capabilities & IBus.Capabilite.SYNC_PROCESS_KEY_V2

will produce an exception. But when using this compatibility class

    capabilities & IBus.Capabilite.SYNC_PROCESS_KEY_V2

will just be False but not cause an exception.

>>> int(Capabilite.PREEDIT_TEXT)
1

>>> Capabilite.PREEDIT_TEXT == 1
True

>>> Capabilite.PREEDIT_TEXT | 2
3

>>> 2 | Capabilite.PREEDIT_TEXT
3

>>> int(Capabilite.PREEDIT_TEXT | Capabilite.AUXILIARY_TEXT)
3

>>> 3 == Capabilite.AUXILIARY_TEXT | Capabilite.PREEDIT_TEXT
True

>>> 3 == Capabilite.AUXILIARY_TEXT | IBus.Capabilite.PREEDIT_TEXT
True

>>> Capabilite.PREEDIT_TEXT == IBus.Capabilite.PREEDIT_TEXT
True
c                &   < V ^8  d   QhRS[ RS[/# r   attrr   r   r   r  r  r"   r#   Capabilite.__annotate__3        3 3 r$   c                    \         P                  V 4      p\        \        R 4      '       dK   \        \        P                  V4      '       d+   \        \        \        P                  V4      4      Vn        V# ^ Vn        V# )r  )object__new__hasattrr   r  r   getattr_value_Zclsr  ZobjrO  r"   r  ZCapabilite.__new__3  sY    nnS!4&&74??D+I+Igdoot<=CK 
 CK
r$   c                    < V ^8  d   QhRS[ /# r   r   r  r  r"   r#   r  ;       ! ! !r$   c                ,    \        V P                  4      # Nr   r  selfr(   r"   __int__ZCapabilite.__int__;      4<<  r$   c                r  r   otherr   r   r   r  r  r"   r#   r  >  s      C D r$   c                s<   V P                   VP                   J g   VP                   \        P                  J d!   \        \	        V 4      \	        V4      8H  4      # VP                   \        J g   VP                   \
        J d   \        \	        V 4      V8H  4      # \        # r  )rs  r   r  r   r   r  NotImplementedr  r     &&r"   __eq__ZCapabilite.__eq__>  sk    NNeoo-$//1D	SZ/00??c!U__%=D	U*++r$   c                &   < V ^8  d   QhRS[ RS[ /# r  r    r  r  r"   r#   r  F  s      C C r$   c                s:   V P                   VP                   J d   V P                  VP                  ,          # VP                   \        P                  J d   \	        V 4      \	        V4      ,          # VP                   \        J d   \	        V 4      V,          # \
        # r  rs  r   r   r  r   r  r  r  r"   __or__ZCapabilite.__or__F  i    >>U__,::++??doo-t9s5z))??c!t9u$$r$   c                r  r  r    r  r  r"   r#   r  O       " "S "S "r$   c                $    V P                  V4      # r  r  r  r  r"   __ror__ZCapabilite.__ror__O      {{5!!r$   c                r  r  r    r  r  r"   r#   r  R  s      S S r$   c                s:   V P                   VP                   J d   V P                  VP                  ,          # VP                   \        P                  J d   \	        V 4      \	        V4      ,          # VP                   \        J d   \	        V 4      V,          # \
        # r  r  r  r  r"   __and__ZCapabilite.__and__R  r  r$   c                r  r  r    r  r  r"   r#   r  [       # #c #c #r$   c                r  r  r  r  r  r"   __rand__ZCapabilite.__rand__[      ||E""r$   PREEDIT_TEXTAUXILIARY_TEXTLOOKUP_TABLEFOCUSPROPERTYSURROUNDING_TEXTOSKSYNC_PROCESS_KEYSYNC_PROCESS_KEY_V2r*   N)rt  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r"   r  r    s     %L ! !  " " # # "L%N!LEH)
C)/r$   r  c                   s   a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	V 3R lR lt
V 3R lR ltRtRtRtRtRtRtRtRtRtRtRtRtV tR# )r   ih  a  Compatibility class to handle InputPurpose the same way no matter
what version of ibus is used.

For example, older versions of ibus might not have
IBus.InputPurpose.TERMINAL and then

    input_purpose == IBus.InputPurpose.TERMINAL

will produce an exception. But when using this compatibility class

    input_purpose == InputPurpose.TERMINAL

will just be False but not cause an exception.

See also:

https://docs.gtk.org/gtk3/enum.InputPurpose.html
https://docs.gtk.org/gtk4/enum.InputPurpose.html

Examples:

>>> int(InputPurpose.PASSWORD)
8

>>> 8 == InputPurpose.PASSWORD
True

>>> int(InputPurpose.PIN)
9

>>> InputPurpose.PASSWORD <= InputPurpose.PIN
True

>>> InputPurpose.PASSWORD == Gtk.InputPurpose.PASSWORD
True

>>> InputPurpose.PASSWORD == IBus.InputPurpose.PASSWORD
True
c                r  r  r  r  r  r"   r#   InputPurpose.__annotate__  r  r$   c                s    \         P                  V 4      p\        \        R 4      '       dK   \        \        P                  V4      '       d+   \        \        \        P                  V4      4      Vn        V# RVn        V# )r   r   )r  r  r  r   r   r   r  r  r  rO  r"   r  ZInputPurpose.__new__  s]    nnS!3''GC4D4Dd,K,Kgc&6&6=>CK 
 CK
r$   c                r  r   r  r  r  r"   r#   r    r  r$   c                r  r  r  r  r(   r"   r  ZInputPurpose.__int__  r  r$   c                r  r  r  r  r  r"   r#   r          C D r$   c                sf   V P                   VP                   J g=   VP                   \        P                  J g   VP                   \        P                  J d   \	        V 4      \	        V4      8H  # VP                   \        J g   VP                   \
        J d   \        \	        V 4      V8H  4      # \        # r  rs  r   r   r   r   r  r   r  r  r  r"   r  ZInputPurpose.__eq__  sz    NNeoo-#"2"22$"3"33t9E
**??c!U__%=D	U*++r$   c                r  r  r  r  r  r"   r#   r    r  r$   c                sf   V P                   VP                   J g=   VP                   \        P                  J g   VP                   \        P                  J d   \	        V 4      \	        V4      8  # VP                   \        J g   VP                   \
        J d   \        \	        V 4      V8  4      # \        # r  r  r  r  r"   __gt__ZInputPurpose.__gt__  sz    NNeoo-#"2"22$"3"33t9s5z))??c!U__%=D	E)**r$   c                r  r  r  r  r  r"   r#   r    r  r$   c                sx   V P                   VP                   J g=   VP                   \        P                  J g   VP                   \        P                  J d!   \	        \        V 4      \        V4      8  4      # VP                   \
        J g   VP                   \        J d   \	        \        V 4      V8  4      # \        # r  rs  r   r   r   r   r   r  r  r  r  r"   __lt__ZInputPurpose.__lt__  s    NNeoo-#"2"22$"3"33D	CJ.//??c!U__%=D	E)**r$   c                r  r  r  r  r  r"   r#   r    r  r$   c                sx   V P                   VP                   J g=   VP                   \        P                  J g   VP                   \        P                  J d!   \	        \        V 4      \        V4      8  4      # VP                   \
        J g   VP                   \        J d   \	        \        V 4      V8  4      # \        # r  r  r  r  r"   __ge__ZInputPurpose.__ge__      NNeoo-#"2"22$"3"33D	SZ/00??c!U__%=D	U*++r$   c                r  r  r  r  r  r"   r#   r    r  r$   c                sx   V P                   VP                   J g=   VP                   \        P                  J g   VP                   \        P                  J d!   \	        \        V 4      \        V4      8*  4      # VP                   \
        J g   VP                   \        J d   \	        \        V 4      V8*  4      # \        # r  r  r  r  r"   __le__ZInputPurpose.__le__  r  r$   	FREE_FORMALPHADIGITSNUMBERPHONEURLEMAILNAMEPASSWORDPINr   r*   N)rt  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r"   r   r   h  s     &N ! !      IEFFE
CEDH
CHr$   r   c                   s   a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	V 3R lR lt
V 3R lR ltRtRtRtRtRtRtRtRtRtRtRtRtRtRtV tR# ) 
InputHintsi  a)  Compatibility class to handle InputHints the same way no matter
what version of ibus is used.

For example, older versions of ibus might not have IBus.InputHints.PRIVATE
(or maybe even do not have IBus.InputHints at all). Then

    input_hints & IBus.InputHints.PRIVATE

will produce an exception. But when using this compatibility class

    input_hints & InputHints.PRIVATE

will just be False but not cause an exception.

See also:

https://docs.gtk.org/gtk3/flags.InputHints.html
https://docs.gtk.org/gtk4/flags.InputHints.html

Examples:

>>> int(InputHints.SPELLCHECK)
1

>>> InputHints.SPELLCHECK == 1
True

>>> InputHints.SPELLCHECK | 2
3

>>> 2 | InputHints.SPELLCHECK
3

>>> int(InputHints.NO_SPELLCHECK | InputHints.SPELLCHECK)
3

>>> 3 == InputHints.NO_SPELLCHECK | InputHints.SPELLCHECK
True

>>> 3 == InputHints.NO_SPELLCHECK | Gtk.InputHints.SPELLCHECK
True

>>> 3 == InputHints.NO_SPELLCHECK | IBus.InputHints.SPELLCHECK
True

>>> InputHints.SPELLCHECK == IBus.InputHints.SPELLCHECK
True

>>> InputHints.SPELLCHECK == Gtk.InputHints.SPELLCHECK
True
c                r  r  r  r  r  r"   r#   InputHints.__annotate__  r  r$   c                r  )r  )r  r  r  r   r  r   r  r  r  rO  r"   r  ZInputHints.__new__  sY    nnS!3%%'#..$*G*Ggcnnd;<CK 
 CK
r$   c                r  r   r  r  r  r"   r#   r    r  r$   c                r  r  r  r  r(   r"   r  ZInputHints.__int__  r  r$   c                r  r  r  r  r  r"   r#   r    r  r$   c                sx   V P                   VP                   J g=   VP                   \        P                  J g   VP                   \        P                  J d!   \	        \        V 4      \        V4      8H  4      # VP                   \
        J g   VP                   \        J d   \	        \        V 4      V8H  4      # \        # r  )rs  r   r  r   r   r   r  r  r  r  r"   r  ZInputHints.__eq__  s{    NNeoo-#..0$//1D	SZ/00??c!U__%=D	U*++r$   c                r  r  r    r  r  r"   r#   r    s      C C r$   c                sv   V P                   VP                   J d   V P                  VP                  ,          # VP                   \        P                  J g   VP                   \        P                  J d   \        V 4      \        V4      ,          # VP                   \
        J d   \        V 4      V,          # \        # r  rs  r   r   r  r   r   r  r  r  r"   r  ZInputHints.__or__  y    >>U__,::++OOs~~-$//1t9s5z))??c!t9u$$r$   c                r  r  r    r  r  r"   r#   r  &  r  r$   c                r  r  r  r  r  r"   r  ZInputHints.__ror__&  r  r$   c                r  r  r    r  r  r"   r#   r  )  s      S S r$   c                sv   V P                   VP                   J d   V P                  VP                  ,          # VP                   \        P                  J g   VP                   \        P                  J d   \        V 4      \        V4      ,          # VP                   \
        J d   \        V 4      V,          # \        # r  r  r  r  r"   r  ZInputHints.__and__)  r  r$   c                r  r  r    r  r  r"   r#   r  3  r  r$   c                r  r  r  r  r  r"   r  ZInputHints.__rand__3  r  r$   NONE
SPELLCHECKNO_SPELLCHECKWORD_COMPLETION	LOWERCASEUPPERCASE_CHARSUPPERCASE_WORDSUPPERCASE_SENTENCESINHIBIT_OSKVERTICAL_WRITINGEMOJINO_EMOJIPRIVATEr*   N)rt  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r"   r  r    s     2f ! !  " " # # DJ#M'OI'O'O/K)EHGr$   r  c                   s  a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	V 3R lR lt
V 3R lR ltV 3R lR ltRV 3R lR lltV 3R lR ltV 3R lR ltR V 3R lR lltR!V 3R lR lltRtV tR# )"ComposeSequencesiD  zClass to handle compose sequences.

Finds all compose files, i.e. the system wide compose file
for the current locale and the compose files from the users
home directory and stores the compose sequences found there
in an internal variable.
c                   < V ^8  d   QhRR/# r   r   Nr*   r  r  r"   r#   ComposeSequences.__annotate__L  s     I* I*$ I*r$   c                sh   / \         P                  \         P                  b\         P                  \         P                  b\         P
                  \         P                  b\         P                  \         P                  b\         P                  \         P                  b\         P                  \         P                  b\         P                  \         P                  b\         P                  \         P                   b\         P"                  \         P$                  b\         P&                  \         P(                  b\         P*                  \         P,                  b\         P.                  \         P0                  b\         P2                  \         P4                  b\         P6                  \         P8                  b\         P:                  \         P<                  b\         P>                  \         P                  bV n         \         P                  \         P                  \         P                  \         P                  \         P                  \         P
                  \         P                  \         P                  \         P                  \         P                  \         P                  \         P                  \         P                  \         P                  \         P                   \         P                  \         P$                  \         P"                  \         P(                  \         P&                  \         P,                  \         P*                  \         P0                  \         P.                  \         P4                  \         P2                  \         P8                  \         P6                  \         P<                  \         P:                  /V n!        / \         PD                  R b\         PF                  Rb\         PH                  Rb\         PJ                  Rb\         PL                  Rb\         PN                  Rb\         PP                  Rb\         PR                  Rb\         PT                  Rb\         PV                  R	b\         PX                  R
b\         PZ                  Rb\         P\                  Rb\         P^                  Rb\         P`                  Rb\         Pb                  Rb\         Pd                  Rb/ \         Pf                  Rb\         Ph                  Rb\         Pj                  Rb\         Pl                  Rb\         Pn                  Rb\         Pp                  Rb\         Pr                  Rb\         Pt                  Rb\         Pv                  Rb\         Px                  Rb\         Pz                  Rb\         P|                  Rb\         P~                  Rb\         P                  Rb\         P                  Rb\         P                  Rb\         P                  RbC/ \         P                  R b\         P                  Rb\         P                  R!b\         P                  R"b\         P                  R#b\         P                  R$b\         P                  R%b\         P                  R&b\         P                  R'b\         P                  R(b\         P                  R)b\         P                  R*b\         P                  R+b\         P                  R,b\         P                  R-bR.R/bR0R1bCR2R3R4R5/CV nS        \        \         R64      '       d   R7V P                  \        \         R64      &   \        \         R84      '       d   R9V P                  \        \         R84      &   \        \         R:4      '       d   R;V P                  \        \         R:4      &   \        \         R<4      '       d   R=V P                  \        \         R<4      &   / \         PF                  R>b\         PH                  R?b\         PJ                  R@b\         PL                  RAb\         PN                  RBb\         PP                  RCb\         PR                  RDb\         PT                  REb\         PV                  RFb\         PX                  RGb\         PZ                  RHb\         P\                  RIb\         P^                  RJb\         P`                  RKb\         Pb                  RLb\         Pd                  RMb\         Pf                  RNb/ \         Pj                  R@b\         Pl                  ROb\         Pn                  RPb\         Pp                  RQb\         Pr                  RRb\         Pv                  RSb\         Px                  RTb\         Pz                  RUb\         P|                  RVb\         P~                  RWb\         P                  RXb\         P                  RYb\         P                  R>b\         P                  RZb\         P                  R[b\         P                  RYb\         P                  R\bC\         P                  R]\         P                  R]\         P                  R^\         P                  R^\         P                  R_\         P                  R_\         P                  R`\         P                  R`\         P                  Ra\         P                  Ra\         P                  Rb\         P                  Rc/CV nV        \        \         R64      '       d   RdV P                  \        \         R64      &   \        \         R84      '       d   ReV P                  \        \         R84      &   \        \         R:4      '       d   RfV P                  \        \         R:4      &   \        \         R<4      '       d   RgV P                  \        \         R<4      &   / V nW        . p\        P                  P                  Rh4      ;'       g     \        P                  P                  Ri4      p\        P                  P                  V4      '       d>   \        P                  ! V\        P                  4      '       d   VP                  V4       MVP                  V P                  4       4       VP                  \        P                  P                  Rj4      4       VP                  \        P                  P                  Rk4      4       VP                  \        P                  P                  Rl4      4       V F  pV P                  V4       K  	  Rm# )n   ·u   ᾿u   ˙u   ῾u   ˚t   ´u    ̮u   ꞈrb   u    ̤r   u   ˍu   ˳u   ˷u   ˘u   ˇt   ¸Z^t   ¤t   ¨u   ˝u   ˵Z`u   μu    ̉u    ̛u    ̑u   ͺt   ¯u   ˛~u   ゜/u   ゛u   ぁ   あu   ぃu   いu   ぅu   うu   ぇu   えu   ぉu   おu   əu   Əi r  i u   ᵉi u   ∞i u   ―ZKEY_dead_lowliner)   ZKEY_dead_aboveverticallineu    ̍ZKEY_dead_belowverticallineu    ̩ZKEY_dead_longsolidusoverlayu    ̸u   ̓u   ̇u   ̔u   ̊u   ́u   ̮u   ̭u   ̦u   ̤u   ̣u   ̱u   ̥u   ̰u   ̆u   ̌u   ̧u   ̂u   ̈u   ̋u   ̏u   ̀u   ̉u   ̛u   ̑u   ͅu   ̄u   ̨u   ̃u   ゚u   ̵u   Ιu   ͣu   ͥu   ͧu   ͤu   ͦu   ᷪ u   ᷪu   ̲u   ̍u   ̩u   ̸ZXCOMPOSEFILEz~/.XComposez~/.config/gtk-3.0/Composez~/.config/gtk-4.0/Composez~/.config/ibus/ComposeN)cr   ZKEY_KP_0ZKEY_0ZKEY_KP_1ZKEY_1ZKEY_KP_2ZKEY_2ZKEY_KP_3ZKEY_3ZKEY_KP_4ZKEY_4ZKEY_KP_5ZKEY_5ZKEY_KP_6ZKEY_6ZKEY_KP_7ZKEY_7ZKEY_KP_9ZKEY_8ZKEY_KP_EqualZ	KEY_equalZKEY_KP_DivideZ	KEY_slashZKEY_KP_MultiplyZKEY_asteriskZKEY_KP_SubtractZ	KEY_minusZ
KEY_KP_AddZKEY_plusZKEY_KP_DecimalZ
KEY_periodZKEY_KP_Space_keypad_keyvals_non_keypad_keyvalsKEY_Multi_keyZKEY_dead_abovecommaZKEY_dead_abovedotZKEY_dead_abovereversedcommaZKEY_dead_aboveringZKEY_dead_acuteZKEY_dead_belowbreveZKEY_dead_belowcircumflexZKEY_dead_belowcommaZKEY_dead_belowdiaeresisZKEY_dead_belowdotZKEY_dead_belowmacronZKEY_dead_belowringZKEY_dead_belowtildeZKEY_dead_breveZKEY_dead_caronZKEY_dead_cedillaZKEY_dead_circumflexZKEY_dead_currencyZKEY_dead_dasiaZKEY_dead_diaeresisZKEY_dead_doubleacuteZKEY_dead_doublegraveZKEY_dead_graveZKEY_dead_greekZKEY_dead_hookZKEY_dead_hornZKEY_dead_invertedbreveZKEY_dead_iotaZKEY_dead_macronZKEY_dead_ogonekZKEY_dead_perispomeniZKEY_dead_psiliZKEY_dead_semivoiced_soundZKEY_dead_strokeZKEY_dead_tildeZKEY_dead_voiced_soundZ
KEY_dead_aZ
KEY_dead_AZ
KEY_dead_iZ
KEY_dead_IZ
KEY_dead_uZ
KEY_dead_UZ
KEY_dead_eZ
KEY_dead_EZ
KEY_dead_oZ
KEY_dead_OZKEY_dead_small_schwaZKEY_dead_capital_schwa_preedit_representationsr  r  
_dead_keys_compose_sequencesr~   r   r   rF  re  rj  ZaccessZR_OKrl   _locale_compose_file_read_compose_file)r  Zcompose_file_pathsZuser_compose_filerF  rs   r"   __init__ZComposeSequences.__init__L  s    
MM4:: 
MM4:: 
 MM4:: 
 MM4::	 

 MM4:: 
 MM4:: 
 MM4:: 
 MM4:: 
 MM4:: 
 t~~ 
  
   $"3"3 
   $.. 
 OOT]] 
  
  tzz! 
* JJJJJJJJJJJJJJJJJJNND--NND..t33NND00MM4??OOT00$
 "I)
 I)
  $$e!I)
" ""D#I)
$ ,,e%I)
& ##T'I)
( )I)
* $$n+I)
, ))5-I)
. $$c/I)
0 ((.1I)
2 ""C3I)
4 %%t5I)
6 ##T7I)
8 $$d9I)
: ;I)
< =I)
> !!4?I)
@ $$cAI)
B ""DCI)
D EI)
F ##TGI)
H %%tII)
J %%tKI)
L MI)
N OI)
P QI)
R SI)
T ''UI)
V WI)
X   $YI)
Z   $[I)
\ %%s]I)
^ _I)
` **EaI)
b   #cI)
d eI)
f &&gI)
j OOUkI)
l OOUmI)
n OOUoI)
p OOUqI)
r OOUsI)
t OOUuI)
v OOUwI)
x OOUyI)
z OOU{I)
| OOU}I)
~ %%tI)
@ ''AI)
J KI)
L MI)
N QI)
%x 4+,,58 ))0134566?M )):;=4566?M )):;=4677@N ));<>I

 $$hI
 ""HI
 ,,hI
 ##XI
 I
 $$hI
 ))8I
 $$hI
 (((I
 ""HI
 %%xI
  ##X!I
" $$h#I
$ %I
& 'I
( !!8)I
* $$h+I
4 5I
6 ##X7I
8 %%x9I
: %%x;I
< =I
D EI
F GI
H ''II
J KI
L   (MI
N   (OI
R %%xSI
V WI
X **HYI
Z   ([I
b cI
d &&eI
j OOXOOXOOXOOXOOXOOXOOXOOXOOXOOX%%y''AI
x 4+,,5= OO0134566?G OO:;=4566?G OO:;=4677@H OO;<>24& JJNN A A!ww11-@ 	GGNN,--		+RWW55 %%&78 %%d&?&?&AB%%""#>?A%%""#>?A%%""#;<>D 'D##D) 'r$   c                s*   < V ^8  d   QhRS[ RS[ RR/# )r   sequencer  r   Nr   r  r  r"   r#   r    s'     Z5 Z5c Z53 Z54 Z5r$   c                sZ   \         P                  ! RRV4      P                  4       P                  4       p. pV Fy  p\         P                  ! RV4      '       d7   \        VR,          ^4      pV^8  d
   VR,          pVP                  V4       KV   VP                  \        \        RV 24      4       K{  	  V'       g   R# V P                  pVR	8X  dT   V FK  p	W9  d    R# \        W,          \         4      '       g   \#        W,          4      ^8X  d   W  R# W,          pKM  	  R# V F5  p	W9  g   \        W,          \         4      '       d   / W&   Tp
T	pW,          pK7  	  VX
X&   R#   \         d8   p\        P                  RYWP                  P                  T4        Rp? R# Rp?ii ; i)
um  Adds a compose sequence to self._compose_sequences

:param sequence: Keysyms of the compose sequence as written
                 in Compose files
:param result: The result which should be inserted when typing that
               compose sequence

Examples:

If a Compose file contains a line like:

    <Multi_key> <asciitilde> <dead_circumflex> <A>      : "Ẫ"   U1EAA # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE

Then “sequence” is “<Multi_key> <asciitilde> <dead_circumflex> <A>”
(whitespace in the sequence string is ignored) and “result” is “Ẫ”.

If conflicting compose sequences are added using this function,
the sequence added last wins. For example wenn calling:

    _add_compose_sequence('<Multi_key> <t> <e> <s> <t>', '😇')
    _add_compose_sequence('<Multi_key> <t> <e> <s> <t> <s>', '😇')

the sequence stored in self._compose_sequences is

    <Multi_key> <t> <e> <s> <t> <s> : "😇"

and the previously stored shorter sequence

    <Multi_key> <t> <e> <s> <t> : "😇"

has been deleted. When now calling

    _add_compose_sequence('<Multi_key> <t> <e> <s>', '😇')

the sequence stored in self._compose_sequences is now

    <Multi_key> <t> <e> <s> : "😇"

and both previously stored longer sequences have been deleted.
I.e. the last stored sequence always wins in case of conflicts.

It also implements this small syntax extension idea by Matthias Clasen:
unwanted compose sequences can be removed by using an empty result
string. I.e. if

    <Multi_key> <t> <e> <s> : ""

comes last, the sequence <Multi_key> <t> <e> <s> and all
longer sequences starting exactly like that become undefined.
z[<>\s]+r   zU[0-9a-fA-F]{4,5}r      ZKEY_z<Invalid compose sequence. keysym "%s" does not exist. %s: %sNr-   )rh   ri   rg   rf   r   r   rl   r  r   ZAttributeErrorro   rp   rs  rt  r  r,  r   rm   )r  r  r  Znameskeyvalsr   Z
code_pointrp   compose_sequenceskeyvalZlast_compose_sequencesZlast_keyvals   &&&         r"   _add_compose_sequenceZ&ComposeSequences._add_compose_sequence  s   j z31779??ADxx,d33 b2.
$*,Jz*NN744v#?@   33R<!208#>>,45:)1$5$=! " F//7==,.!)%6" K 1 9  /5{+5 & LL=oo66? s   "E((F*3+F%%F*c                r  r   r   r  r  r"   r#   r    s     
 
3 
r$   c                s,    Rp\        R V 4       R4      # )z}Returns the system directory for compose files

Checks common locations and defaults to
/usr/share/X11/locale if none exist.
/usr/share/X11/localec              3   st   "   T F.  p\         P                  P                  V4      '       g   K*  Vx  K0  	  R # 5ir  )r~   rF  isdir)r   rF  r   r"   r   Z5ComposeSequences._xorg_locale_path.<locals>.<genexpr>   s#     G/d277==3FTT/s   '8
8)r  z/usr/local/lib/X11/localez/usr/local/share/X11/localez/usr/lib/X11/locale)Znext)r  Zxorg_locale_pathsr   r"   _xorg_locale_pathZ"ComposeSequences._xorg_locale_path  s%    
 G/G#
 	
r$   c                r  r   r   r  r  r"   r#   r    s      c r$   c                s   \         P                  ! \         P                  R7      w  rV'       g   RpV'       g   RpVR9  d   \        P	                  RW4       VR3 Fb  p\
        P                  P                  V P                  4       VR,           R4      p\
        P                  P                  V4      '       g   K`  Vu # 	  R# )	zIReturns the full path of the default compose file for the current
locale
)r   r7   rS  z%Not running in an UTF-8 locale: %s.%sz.UTF-8ZComposer-   )rS  Zutf8)
r   Z	getlocaler   ro   r\  r~   rF  r   r  rj  )r  Zlc_ctype_localeZlc_ctype_encodingZlocZlocale_compose_filer   r"   r  Z%ComposeSequences._locale_compose_file  s     .4-=-=__.&*%O  '$55NNB*?#W-C"$'',,&&(#.)#Eww~~122**	 .
 r$   c                $   < V ^8  d   QhRS[ RR/# )r   compose_pathr   Nr   r  r  r"   r#   r    s     >= >=s >=t >=r$   c                s   V'       d&   \         P                  P                  V4      '       g   \        P	                  RV4       R#  \        VRRR7      ;_uu_ 4       pVP                  4       pRRR4       X'       g   \        P                  RT4       R# \        P	                  RT4       \         P"                  ! R4      p\         P"                  ! R4      pT EFX  pTP%                  4       '       g   K  TP'                  T4      pT'       d   TP)                  R4      p	T	P+                  RT P-                  4       4      p	T	P+                  RT P/                  4       4      p	T	P+                  R\         P                  P1                  R4      4      p	\         P                  P3                  T	4      p	T P5                  T	4       TP'                  T4      pT'       g   EK  TP)                  R4      p
TP)                  R4      pTP+                  RR4      pTP+                  RR4      pT P7                  Y4       EK[  	  R#   + '       g   i     EL; i  \         dB   p\        P                  RT\        R4      TP                  P                  T4        Rp?ELRp?i\         dB   p\        P                  RT\        R4      TP                  P                  T4        Rp?ELhRp?i\         dB   p\        P                  RT\        R	4      TP                  P                  T4        Rp?ELRp?i\         dB   p\        P                  R
T\        R4      TP                  P                  T4        Rp?ELRp?ii ; i)zReads a compose file and stores the compose sequences
found  there in self._compose_sequences.

:param compose_path: Path to a compose file to read
z%Skipping reading of compose file "%s"NrS  rX  rn  Error loading %s: %s: %s: %sFile not foundPermission errorUnicode decoding error'Unexpected error loading %s: %s: %s: %sUnknown errorFile %s has no contentzReading compose file %sz)^\s*include\s*"(?P<include_path>[^"]+)".*zF^\s*(?P<sequence>(<[a-zA-Z0-9_]+>\s*)+):\s*"(?P<result>(\\"|[^"])*)".*include_pathz%Sz%Lz%Hr  r  r  \""z\\Z\)r~   rF  rj  ro   r   ro  rv  rq  r=  r)   rs  rt  rr  rV  r>  r\  rh   r   rg   r   r   r   r  r  re  Znormpathr  r  )r  r  Zcompose_fileZlinesrp   Zinclude_patternZcompose_sequence_patternZliner   r  r  r  s   &&          r"   r  Z#ComposeSequences._read_compose_file  s    277>>,#?#?KK?N	>l&%' '*6$..0'( NN3\B-|< **8:#%::.$/  D::<<#**40E${{>:+33$002 4+33$335 7+33"'',,S1 3!ww//=''5,33D9Eu ;;z2X.s35**8<) A' ' ' ! 	>;)1-=+>"__55u> >  	>;)1-?+@"__55u> > " 	>;)1-E+F"__55u> >  	>F)1_+="__55u> >	>sl   I H9.I 9I
	I 
I M76JM7!M7"6KM7+M7,6L((M75M766M22M7c                6   < V ^8  d   QhRS[ S[,          RS[/# r   r  r   r   r   r   r  r  r"   r#   r  X  s#     A Ad3i AC Ar$   c                sh   RpV F  pV P                  VR.4      pV P                  V\        P                  .4      pV'       d   W$,          pKI  V'       d   W%,          pK[  W0P                  9   d   W P                  V,          ,          pK  \        P                  ! V4      pV'       d/   \
        P                  ! VR4      f   VR,          pK  W&,          pK  V\        V4      ,          pK  	  \        V4      ^8  d6   V^ ,          V P                  \        P                  .4      8X  d
   VR,          # V# )ur  Returns a text to display in the preedit for a partially
typed compose sequence.

:param keyvals: A list of key values
:return: The text to display in the preedit for a partially
         typed compose sequence consisting of these key values

Examples:

>>> c = ComposeSequences()
>>> c.preedit_representation([IBus.KEY_Multi_key, IBus.KEY_asciitilde, IBus.KEY_dead_circumflex])
'~^'
>>> c.preedit_representation([IBus.KEY_Multi_key, IBus.KEY_asciitilde, IBus.KEY_Multi_key, IBus.KEY_dead_circumflex])
'~·^'
>>> c.preedit_representation([IBus.KEY_Multi_key])
'·'
>>> c.preedit_representation([IBus.KEY_dead_macron])
'¯'
>>> c.preedit_representation([0x01EB])
'ǫ'
>>> c.preedit_representation([IBus.KEY_dead_macron, 0x01EB])
'¯ǫ'
>>> c.preedit_representation([IBus.KEY_1])
'1'
>>> c.preedit_representation([IBus.KEY_KP_1]) == c.preedit_representation([IBus.KEY_1])
True
>>> c.preedit_representation([IBus.KEY_slash])
'/'
>>> c.preedit_representation([IBus.KEY_KP_Divide]) == c.preedit_representation([IBus.KEY_slash])
True
>>> c.preedit_representation([IBus.KEY_space])
' '
>>> c.preedit_representation([IBus.KEY_nobreakspace])
' '
r-   i% Nr  r   )composer   Z	KEY_spacer  keyval_to_unicoder   r   rz   rm   preedit_representationr  )r  r  representationr  Zcompose_with_25ccZcompose_with_spaceZibus_keyval_to_unicode   &&     r"   r  Z'ComposeSequences.preedit_representationX  s   L F $fj-A B!%vt~~.F!G 3#4888"?"?"GG)-)?)?)G&)"''(>EM&$.&@"c&k1N# $ !#1**D,>,>+?@A
 ""%%r$   c                sF   < V ^8  d   QhRS[ S[,          RS[S[,          /# r  )r   r   r   r   r  r  r"   r#   r    s-     d@ d@9d@)1#d@r$   c                s   V'       g   R# Rp\        V4       F  w  r4V\        V4      ^,
          8  d0   W@P                  9  d    R# V P                  V,          V,           pKK  W@P                  9   d    R# \        V4      ^8X  d    R# \        P                  ! V4      pV'       d   \
        P                  ! V4      R9  d    R# WR,           pK  	  \
        P                  ! RV4      # )uY  
Interprets a list of key values as a dead key sequence

:param keyvals: A list of key values
:return:
    None:
        Incomplete sequence
        The key values are not yet a complete dead key
        sequence, but it is still possible to get a
        dead key sequence by adding more key values.
    '' (empty string):
        Empty sequence or invalid sequence.
        Either the sequence is empty or
        there is no such dead key sequence, adding more
        key values could not make it a valid sequence.
    'text' (any non empty string):
        Complete dead key sequence, valid.
        The returned string contains the result of the valid
        dead key sequence.

Examples:

>>> c = ComposeSequences()

Empty sequence:

>>> c._compose_dead_key_sequence([])
''

Incomplete sequences:

>>> repr(c._compose_dead_key_sequence([IBus.KEY_dead_circumflex]))
'None'

>>> repr(c._compose_dead_key_sequence([IBus.KEY_dead_circumflex, IBus.KEY_dead_tilde]))
'None'

Invalid sequences:

>>> c._compose_dead_key_sequence([IBus.KEY_dead_circumflex, IBus.KEY_Multi_key])
''

>>> c._compose_dead_key_sequence([IBus.KEY_dead_circumflex, IBus.KEY_BackSpace])
''

>>> c._compose_dead_key_sequence([IBus.KEY_dead_circumflex, IBus.KEY_openstar])
''

Complete, valid sequences:

>>> c._compose_dead_key_sequence([IBus.KEY_dead_circumflex, IBus.KEY_x])
'x̂'

>>> c._compose_dead_key_sequence([IBus.KEY_dead_tilde, IBus.KEY_n])
'ñ'

>>> c._compose_dead_key_sequence([IBus.KEY_dead_macron, IBus.KEY_dead_abovedot, IBus.KEY_e])
'ė̄'

>>> c._compose_dead_key_sequence([IBus.KEY_dead_abovedot, IBus.KEY_dead_macron, IBus.KEY_e])
'ē̇'

>>> c._compose_dead_key_sequence([IBus.KEY_dead_belowdot, IBus.KEY_dead_abovedot, IBus.KEY_d])
'ḍ̇'

>>> c._compose_dead_key_sequence([IBus.KEY_dead_abovedot, IBus.KEY_dead_belowdot, IBus.KEY_d])
'ḍ̇'

>>> c._compose_dead_key_sequence([IBus.KEY_dead_abovedot, IBus.KEY_dead_belowdot, IBus.KEY_s])
'ṩ'

>>> c._compose_dead_key_sequence([IBus.KEY_dead_belowdot, IBus.KEY_dead_abovedot, IBus.KEY_s])
'ṩ'

>>> c._compose_dead_key_sequence([IBus.KEY_dead_doublegrave, IBus.KEY_Cyrillic_a])
'а̏'
r-   Nr  )r'  r&  )Z	enumeraterm   r  r   r  r   r   r  )r  r  Zcombining_sequenceZindexr  r  r
  r"   _compose_dead_key_sequenceZ+ComposeSequences._compose_dead_key_sequence  s    b &w/MEs7|a''0%)__&0&1" __,w<1$ 226:	!"++I6lJ%.%C" 0  $$U,>??r$   c                r  r   r  r   r   r   r  r  r"   r#   r    s     7 73 74 7r$   c                s0    \        WP                  9   4      # )z
Checks whether a key with the value keyval starts Compose sequence

:return: True if the key can start a Compose sequence, False if not
)r   r  r  r  r  r"   is_start_keyZComposeSequences.is_start_key  s     F55566r$   c                sL   < V ^8  d   QhRS[ S[,          RS[RS[S[,          /# )r   r  keypad_fallbackr   )r   r   r   r   r   r  r  r"   r#   r  	  s6     g g#Yg "g .6c]gr$   c                s   V'       g   R# V P                   pV EF(  pWC9   d:   \        W4,          \        4      '       d   \        W4,          4      u # W4,          pKC  V'       dc   W@P                  9   dS   V P                  V,          pWS9   d:   \        W5,          \        4      '       d   \        W5,          4      u # W5,          pK  V'       dd   W@P                  9   dT   V P                  V,          pWS9   d;   \        W5,          \        4      '       d   \        W5,          4      u # W5,          pEK  V P                  V4      u # 	  R# )u  
Interprets a list of key values as a compose sequence

:param keyvals: A list of key values
:param keypad_fallback: Whether fallbacks from KP_1 to 1,
                        KP_Divide to minus, ... (and the
                        (other way round) should be tried.
:return:
    None:
        Incomplete sequence
        The key values are not yet a complete compose
        sequence, but it is still possible to get a
        complete compose sequence by adding more key values.
    '' (empty string):
        Empty sequence or invalid sequence.
        Either the sequence is empty or
        there is no such compose sequence, adding more
        key values could not make it a valid sequence.
    'text' (any non empty string):
        Complete sequence, valid.
        The returned string contains the result of the valid
        compose sequence.

Examples:

>>> c = ComposeSequences()

Incomplete sequence:

>>> repr(c.compose([IBus.KEY_Multi_key, IBus.KEY_asciitilde, IBus.KEY_dead_circumflex]))
'None'

Empty sequence:

>>> c.compose([])
''

Invalid sequence:

>>> c._compose_dead_key_sequence([IBus.KEY_dead_circumflex, IBus.KEY_openstar])
''

Complete, valid sequence:

>>> c.compose([IBus.KEY_Multi_key, IBus.KEY_asciitilde, IBus.KEY_dead_circumflex, IBus.KEY_A])
'Ẫ'

Complete, valid sequence, with trailing junk (IBus.KEY_B is junk):

>>> c.compose([IBus.KEY_Multi_key, IBus.KEY_asciitilde, IBus.KEY_dead_circumflex, IBus.KEY_A, IBus.KEY_B])
'Ẫ'

Not defined in any Compose file, but nevertheless valid
because it is interpreted as a “reasonable” dead key sequence:

>>> c.compose([IBus.KEY_dead_circumflex, IBus.KEY_x])
'x̂'

With keypad_fallback this sequence exists:

>>> c.compose([IBus.KEY_Multi_key, IBus.KEY_KP_1, IBus.KEY_KP_2], keypad_fallback=True)
'½'

Without keypad_fallback this sequence does not exist:

>>> c.compose([IBus.KEY_Multi_key, IBus.KEY_KP_1, IBus.KEY_KP_2], keypad_fallback=False)
''
r-   N)r  r,  r   r  r  r  )r  r  r  r   r  Zfallback_keyvals   &&&   r"   r  ZComposeSequences.compose	  s   T  33F*/7==0899$5$=!6-A-A#A"&"6"6v">"7!"3"DcJJ"#4#EFF(9(J%6-E-E#E"&":":6"B"7!"3"DcJJ"#4#EFF(9(J% 227;;3 4 r$   c                r  r  r  r  r  r"   r#   r  r  s#     } }T#Y }3 }r$   c                s   RpV EF7  p\         P                  ! V4      p\         P                  ! V4      pVR8X  d   W P                  V,          ,          pKR  VP	                  R4      '       d$   VRV P                  V,          ,           ,          pK  VP	                  R4      '       d    V\         P                  ! V4      ,          pK  VR8X  d   VR,          pK  V'       d7   VP                  4       '       d!   V\         P                  ! V4      ,          pEK  V'       d   W%,          pEK%  V\        V4      ,          pEK:  	  V# )u0  Returns a string representation of a compose sequence

:param keyvals: The compose sequence as a list of key values

Useful to display a compose sequence in short and human
readable form in a lookup table to show possible compose
completions.

Actually I would really like to use
self.preedit_representation() for this, why introduce yet
another function which does “almost” the same?

The reasons for making a difference between preedit and lookup
representation are:

1) <space> and <nobreakspace>:
   Using ' ' as the preedit representation for
   <space> and ' ' for <nobreakspace> is perfectly fine.
   One knows which key one has just typed and one can also
   see that something happened in the preedit because
   the preedit is usually underlined. And such whitespace with
   an underline is visible feedback in the preedit.
   But in the lookup table it would be invisible.
   (By the way, the is <KP_Space> for? It exists in the
   system Compose file).

2) <tilde> and <dead_tilde> and similar pairs:
   These are not the same thing in a compose sequence
   If the user has typed one of these, it is no problem if they are
   displayed the same way in the preedit, the user knows which key
   she pressed and then it represents that key well enough. But
   if it is shown in a lookup table to show possible completions,
   the user needs to know which key to press next, <tilde> or <dead_tilde>.
   Some keyboard layouts actually have both!
   (Alexander Graf suggested to make that differerence in the lookup
   table *only if* the current keyboard layout actually has both.
   I am thinking about that, I am not sure whether this is a good idea.)

3) In the preedit representation, <1> and <KP_1> are both represented
   as '1', <slash> and <KP_Divide> are both represented as '/'.
   Again no problem if the user has just typed this, but a problem
   if one needs to know what to type next *exactly*. For example,
   the system Compose file contains:

   <Multi_key> <slash> <o>     : "ø"
   <Multi_key> <o> <slash>     : "ø"
   <Multi_key> <KP_Divide> <o> : "ø"

   but *not*:

   <Multi_key> <o> <KP_Divide> : "ø"

   So if the user has typed <Multi_key> <o>, the next key
   to complete the sequence can be <slash> but *not* <KP_Divide>!

   Similar situation for 1 and KP_1 and all other pairs of keys
   which have equivalents on the “normal” key area and the keypad.

   I tend to consider this bugs in the Compose file.

   Maybe I could avoid this by not displaying completions involving
   KP_something *at all*. Because most of these cases (maybe all cases?)
   the sequences can by typed in two different orders using the “normal”
   key area but only in one specific order using the keypad. I.e.
   showing the completions involving keypad keys adds only very
   little value. Therefore, I decided to omit them for the moment
   by calling self.find_compose_completions()
   with omit_sequences_involving_keypad=True.
   As long as I do this, 3) doesn’t matter.

Examples:

>>> c = ComposeSequences()
>>> sequence = [IBus.KEY_Multi_key, IBus.KEY_dead_tilde, IBus.KEY_a]
>>> c.lookup_representation(sequence)
'·💀~a'

>>> sequence = [IBus.KEY_Multi_key, IBus.KEY_dead_tilde, IBus.KEY_space]
>>> c.lookup_representation(sequence)
'·💀~␠'

>>> c.lookup_representation([IBus.KEY_nobreakspace])
'nobreakspace'

>>> c.lookup_representation([IBus.KEY_1])
'1'

>>> c.lookup_representation([IBus.KEY_KP_1])
'KP_1'
>>> c.lookup_representation([IBus.KEY_KP_Divide])
'KP_Divide'

>>> c.lookup_representation([IBus.KEY_dead_macron])
'💀¯'
>>> c.lookup_representation([IBus.KEY_dead_macron, IBus.KEY_dead_ogonek])
'💀¯💀˛'
>>> c.lookup_representation([IBus.KEY_dead_macron, IBus.KEY_dead_ogonek, IBus.KEY_o])
'💀¯💀˛o'
>>> c.lookup_representation([0x01EB])
'ǫ'
>>> c.lookup_representation([IBus.KEY_dead_macron, 0x01EB])
'💀¯ǫ'

r-   Z	Multi_keyZdead_u   💀KP_Zspaceu   ␠)r   keyval_namer  r  r   r   rz   )r  r  r  r  r!  Zkeyval_unicoder
  r"   lookup_representationZ&ComposeSequences.lookup_representationr  s    V F**62K!33F;Nk)"?"?"GG''00&4+H+H+P"PP''..$"2"26"::'%'N$:$:$<$<$"2"26"::0#f+-! " r$   c                sV   < V ^8  d   QhRS[ S[ S[,          ,          RS[ S[,          /# )r   keyval_sequencesr   r  r  r  r"   r#   r    s)      $(cO8<S	r$   c                s\    . pV F#  pVP                  V P                  V4      4       K%  	  V# )u  Returns a list of string representations (for lookup tables) of
compose sequences given as lists of key values

This is only for testing self.find_compose_completions().

:param keyval_sequences: A List containing lists of key values

Examples:

>>> c = ComposeSequences()
>>> sequence1 = [IBus.KEY_Multi_key, IBus.KEY_minus]
>>> sequence2 = [IBus.KEY_Multi_key, IBus.KEY_period]
>>> keyval_sequences = [sequence1, sequence2]
>>> c._lookup_representations(keyval_sequences)
['·-', '·.']

)rl   r"  )r  r#  ZrepresentationsZkeyval_sequencer   r"   _lookup_representationsZ(ComposeSequences._lookup_representations  s7    * /O""**?;=  0 r$   Nc                s   < V ^8  d   QhRS[ S[S[S[ S[S[3,          S[3,          3,          RS[S[S[,          ,          RS[S[S[,          ,          RS[RS[S[S[,          ,          /# )r   r   partial_sequenceavailable_keyvalsomit_sequences_involving_keypadr   )	r   r   r   r   r   r   r   r   r   r  r  r"   r#   r    st     ," ,"#CtCH~s/B)C$CD," 'tCy1,"  (C1	,"
 .2,"
 >B$s)_,"r$   c                s^   Vf   . p. pV F  pV'       d	   Wc9  d   K  V'       d.   \         P                  ! V4      P                  R4      '       d   KH  W&.,           pW,          p\        V\        4      '       d   VP                  V4       K  Tp	WPP                  V	VVR7      ,          pK  	  V# )an  Lists all possible compose sequences in a dictionary

Returns a list of possible sequences, each sequence is a list
of key values

:param compose_sequences: The compose_sequences dictionary
                          to check for possible sequences
:param available_keyvals: The key values available to type
                          compose sequences. Sequences from
                          the compose_sequences dictionary
                          which require key values not in this
                          Set are not listed.
                          If this parameter is None, *All*
                          sequences in the compose_sequences
                          dictionary are listed.
:param omit_sequences_involving_keypad: Omit all sequences
                                        containing any
                                        keys on the keypad.
r   )r%  r&  )r   r!  r   r,  r   rl   list_compose_sequences)
r  r   r%  r&  r'  Zpossible_sequencesr  Znew_partial_sequencer   Znew_compose_sequences
   &&&&&     r"   r(  Z'ComposeSequences.list_compose_sequences  s    2 #!.0'F V%D/$$V,77>>#3h#> %-E%%%"))*>?',$"&A&A(';(9 'B '; ;" (  "!r$   c          
      s   < V ^8  d   QhRS[ S[,          RS[S[S[,          ,          RS[RS[ S[ S[,          ,          /# )r   r  r&  r'  r   )r   r   r   r   r   r  r  r"   r#   r  :  sO     R R#YR  (C1R .2	R >B$s)_	Rr$   c                s    V'       g   . # V P                   pV F/  pWT9  d   . u # WE,          p\        V\        4      '       g   K-  . u # 	  V P                  V. VVR7      p\	        VR R7      # )u	  Lists all possible compose sequences in the dictionary starting
with keyvals using only available_keyvals to complete a
sequence.

Only the dictionary created from the Compose files read is
considered, “automatic dead key sequences” are *not* included
in the possible completions.

:param kevals: The key values which started the compose sequence
:param available_keyvals: The key values available to complete the
                          compose sequence

Examples:

>>> c = ComposeSequences()
>>> keyvals = [IBus.KEY_Multi_key, IBus.KEY_minus, IBus.KEY_minus]
>>> available_keyvals = None
>>> completions = c.find_compose_completions(keyvals, available_keyvals)
>>> completions
[[32], [45], [46]]
>>> c._lookup_representations(completions)
['␠', '-', '.']

>>> available_keyvals = set((IBus.KEY_Multi_key, IBus.KEY_minus, IBus.KEY_period))
>>> completions = c.find_compose_completions(keyvals, available_keyvals)
>>> c._lookup_representations(completions)
['-', '.']

>>> keyvals = [IBus.KEY_Multi_key]
>>> available_keyvals = set((IBus.KEY_macron, IBus.KEY_a, IBus.KEY_e, IBus.KEY_x))
>>> completions = c.find_compose_completions(keyvals, available_keyvals)
>>> completions
[[97, 97], [97, 101], [101, 101], [120, 120], [175, 97], [175, 101]]

>>> c._lookup_representations(completions)
['aa', 'ae', 'ee', 'xx', '¯a', '¯e']

As automatic dead key sequences should not be included,
['x'] should not appear as a possible completion here:

>>> keyvals = [IBus.KEY_dead_grave]
>>> available_keyvals = [IBus.KEY_a, IBus.KEY_x]
>>> completions = c.find_compose_completions(keyvals, available_keyvals)
>>> c._lookup_representations(completions)
['a']

>>> keyvals = [IBus.KEY_Multi_key, IBus.KEY_asciicircum]
>>> available_keyvals = [IBus.KEY_3, IBus.KEY_KP_3]
>>> completions = c.find_compose_completions(keyvals, available_keyvals)
>>> c._lookup_representations(completions)
['3']
>>> completions = c.find_compose_completions(keyvals, available_keyvals, omit_sequences_involving_keypad=False)
>>> c._lookup_representations(completions)
['3', 'KP_3']
)r%  r&  r'  c                 s    \        V 4      V 3# r  r   r  r(   r"   rK  Z;ComposeSequences.find_compose_completions.<locals>.<lambda>  s    a&%r$   r  )r  r,  r   r(  r  )r  r  r&  r'  r   r  Z	sequencess   &&&&   r"   find_compose_completionsZ)ComposeSequences.find_compose_completions:  s    | I 33F.	 1 9+S11	  //! 1.M	 0 O	
 i 	r$   )r  r  r  r  r  )T)NNT)NT)rt  r  r  r  r  r  r  r  r  r  r  r  r  r  r"  r$  r(  r)  r  r  r  r  r"   r  r  D  s     I* I*V
Z5 Z5x
 
" (>= >=@A AFd@ d@L7 7g gR} }~ 6," ,"\R R Rr$   r  c                   sD  a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR  ltV 3R! lR" ltR#tV tR$# )%
M17nDbInfoi  zTClass to find and store information about the available input
methods from m17n-db.
c                r  r  r*   r  r  r"   r#   M17nDbInfo.__annotate__  s     	 	$ 	r$   c                s    . V n         / V n        R V n        ^ V n        ^ V n        ^ V n        V P                  4        V P                  4        V P                  4        R# r-   N)	_dirs_imes_version_major_version_minor_version_micro_version_get_version
_find_dirs
_find_imesr  r(   r"   r  ZM17nDbInfo.__init__  sO     "
02
#$#$#$r$   c                r  r  r*   r  r  r"   r#   r+    s     - -d -r$   c                s   \         P                  ! R4      pRV n        V'       dz    \        P                  ! VR.\        P
                  \        P
                  RRR7      pVP                  P                  4       V n        \        P                  RWP                  4       V P                  '       dQ   V P                  P#                  R4      w  rEp\%        V4      V n        \%        V4      V n        \%        V4      V n        R	# R	#   \         d6   p\        P                  RYP                  P                  T4        R	p?LR	p?i\        P                   dA   p\        P                  R
TTP                  P                  Y3P                  4        R	p?LR	p?i\          d7   p\        P                  RYP                  P                  T4        R	p?EL1R	p?ii ; i)zGets the version of m17n-dbm17n-dbr-   z-vr/  TrA  %s printed: %s!Exception when calling %s: %s: %sN,Exception when calling %s: %s: %s stderr: %sr   )r6  r7  r/  r8  r9  r:  r0  rg   ro   r   rq  r=  rs  rt  r<  r1  r>  rf   r   r0  r1  r2  )r  m17n_db_binaryr  rp   ZmajorZminorZmicror^  r"   r3  ZM17nDbInfo._get_version  sm   i0E##T*%??%??$D	2
 !' 3 3 5,nmmL ===$(MM$7$7$<!U5"%e*D"%e*D"%e*D	  % E  7"OO$<$<eE E 00 C  B"OO,,e\\C C  E  7"OO$<$<eE EEs<   A8D G+D>>GG6FGG+GGc                r  r  r*   r  r  r"   r#   r+    s     1J 1JD 1Jr$   c                s0   . V n         \        P                  ! R4      pV'       g    \        P                  P	                  R4      pRp\
        P                  ! R4      pV'       dj    \        P                  ! V.\        P                  \        P                  RRR7      pVP                  P                  4       p\        P                  RW24       \        P                  P+                  V4      '       g5   RpV F,  p\        P                  P+                  V4      '       g   K*  Tp M	  \        P                  P+                  V4      '       d   V P                   P-                  V4       \        P                  P+                  V4      '       d   V P                   P-                  V4       R
# \        P/                  RV4       R
#   \         d7   p\        P                  R	Y5P                   P"                  T4        R
p?EL/R
p?i\        P$                   dB   p\        P                  RTTP                   P"                  YUP&                  4        R
p?ELR
p?i\(         d7   p\        P                  R	Y5P                   P"                  T4        R
p?ELR
p?ii ; i)zqFinds the directories which contain the m17n input methods which
can be used and stores the result in self._dirs
ZM17NDIRz	~/.m17n.dr-   r6  r/  TrA  r7  r8  Nr9  z*System m17n directory "%s" does not exist.)z/usr/share/m17nz/usr/local/share/m17n)r-  r~   ZgetenvrF  re  r6  r7  r8  r9  r:  r0  rg   ro   r   rq  r=  rs  rt  r<  r1  r>  r  rl   rp   )r  Zuser_dirZ
system_dirr:  r  rp   rf  rG  r   r"   r4  ZM17nDbInfo._find_dirs  s    
99Y'ww))+6H
i0E##$%??%??$D	2
 $]]002
,nI ww}}Z((H $77==))!(J $ 77==""JJh'77==$$JJj)LL<jJ7 % E  7"OO$<$<eE E 00 C  B"OO,,e\\C C  E  7"OO$<$<eE EEs=   &A(G J+G==JJ6IJJ+JJc                r  r  r*   r  r  r"   r#   r+    s     f; f;D f;r$   c                s   / V n         RRR\        R4      R\        R4      RRR\        P                  P	                  \
        P                  ! 4       R	4      /V P                   R
&   V P                   EF
  p\        P                  ! \        P                  P	                  VR4      4       EF  p \        VRRR7      ;_uu_ 4       pVP                  4       pRRR4       X'       g   \        P'                  RT4       KT  \(        P*                  ! R\(        P,                  \(        P.                  ,          \(        P0                  ,          4      pTP3                  T4      pT'       g   \        P'                  RT4       K  TP5                  R4      pTP5                  R4      p	T	R8X  d   \        P7                  RT4       EK  TR,           T	,           p
YP                   9   d3   \        P'                  RYT P                   T
,          R,          4       EKh  RT/T P                   T
&   \        P                  P	                  TRTR,           T	,           R ,           4      p\        P                  P	                  TRT	R ,           4      p\        P                  P9                  T4      '       d   YP                   T
,          R&   M:\        P                  P9                  T4      '       d   YP                   T
,          R&   RT P                   T
,          9  d   \        P'                  R!YT4       \(        P*                  ! R"\(        P,                  \(        P.                  ,          \(        P0                  ,          4      pTP3                  T4      pT'       d7   TP5                  R4      P;                  R#R$4      pYP                   T
,          R&   \(        P*                  ! R%\(        P,                  \(        P.                  ,          \(        P0                  ,          4      pTP3                  T4      pT'       d8   TP5                  R4      P;                  R#R$4      pTT P                   T
,          R&   Y@P                   T
,          R&   EK  	  EK  	  R#   + '       g   i     EL; i  \         dB   p\        P                  RT\        R4      TP                  P                  T4        Rp?EL Rp?i\          dB   p\        P                  RT\        R4      TP                  P                  T4        Rp?ELJRp?i\"         dB   p\        P                  RT\        R4      TP                  P                  T4        Rp?ELRp?i\$         dB   p\        P                  RT\        R4      TP                  P                  T4        Rp?ELRp?ii ; i)&zSearches the directories in self._dirs for usable input methods and
stores information about the input methods found in the
self._imes dictionary.
rF  r-   r  zNative KeyboarddescriptionzDirect keyboard input. This is not really an input method, it uses directly whatever comes from the current keyboard layout without any further changes. So no transliteration or composing is done here.contentrB  z6share/icons/hicolor/48x48/apps/ibus-typing-booster.pngr4   z*.mimrS  rX  rn  Nr  r	  r
  r  r  r  r  z8\(\s*input-method\s+(?P<lang>.+?)\s+(?P<name>.+?)[\s()]+u+   File %s does not contain “input-method”r]   r   ZniluI   File %s has name “nil”.Therefore, it is not actually an input method.Z-u:   Duplicate input method: “%s”.Implemented in %s and %s.Ziconsz.pnguG   No icon found for input method: “%s”. Neither file %s nor %s exist.z/\([\s]*title[\s]*"(?P<title>.+?)(?<!\\)"[\s]*\)r  r  zA\([\s]*description[\s]*(\(_)?"(?P<description>.+?)(?<!\\)"[\s]*\))r.  r)   r~   rF  r   itb_versionZ
get_prefixr-  globro  rp  rq  ro   r=  rs  rt  rr  rV  r>  r\  rh   r   ZDOTALLru  ZUNICODEr   r   r   rj  r   )r  rG  Zmim_pathZime_fileZfull_contentsrp   Zinput_method_patternr   r]   r   rr   Zicon_path_longZicon_path_shortZtitle_patternr  Zdescription_patternr;  s   &                r"   r5  ZM17nDbInfo._find_imes  ss   
 
BQ()1 ! rBGGLL&&(HJ

7 zzG IIbggll7G&DEFh'.%-/ /2:(0/( %NN#;XF')zz<IIbll*2::5(7$ -33MBNNE " {{6*{{6*5=KKI " Sj4'**$NN4tzz#v'>@ #)8"4

3!#WdSj4&7&&@"B"$'',,WdVm#577>>.11.<JJsOF+WW^^O44.=JJsOF+C0NN8_> !#

FIIbll*2::5!7 &,,];!KK088DE/4JJsOG,&(jjBIIbll*2::5'7# ,22=A"'++m"<"D"Ds#$K5@DJJsOM2-:

3	*a F "/ / / ) F$$%C%-q1A/B%*__%=%=uF F ' F$$%C%-q1C/D%*__%=%=uF F * F$$%C%-q1I/J%*__%=%=uF F ! F$$%N%-q/A%*__%=%=uF FFsl   -RR	RRRRV? 6SV?)V?*6T&&V?3V?46U00V?=V?>6V::V?c                r  r   r   r  r  r"   r#   r+  X  s      S r$   c                    V P                   # )zReturns the version of m17n-db)r/  r  r(   r"   get_versionZM17nDbInfo.get_versionX  s    }}r$   c                r  r   r  r  r  r"   r#   r+  \       # #3 #r$   c                r?  z2Returns the major version of m17n-db as an integer)r0  r  r(   r"   get_major_versionZM17nDbInfo.get_major_version\      """r$   c                r  r   r  r  r  r"   r#   r+  `  rA  r$   c                r?  rB  )r1  r  r(   r"   get_minor_versionZM17nDbInfo.get_minor_version`  rD  r$   c                r  r   r  r  r  r"   r#   r+  d  rA  r$   c                r?  rB  )r2  r  r(   r"   get_micro_versionZM17nDbInfo.get_micro_versiond  rD  r$   c                0   < V ^8  d   QhRS[ S[,          /# r   rc  r  r  r"   r#   r+  h  s      $s) r$   c                s(    V P                   R,          # )a  
Returns the list of directories  which contain the m17n input methods.

There has to be one system directory (e.g. /usr/share/m17n) and
it is possible that there is also a user directory indicated
by the M17NDIR environment variable. If the environment
variable M17NDIR is not set, the user directory is '~/.m17n.d'.
if that directory exists.

:return: A list of one or two directories

:NNN)r-  r  r(   r"   get_dirsZM17nDbInfo.get_dirsh  s     zz!}r$   c                rG  r   rc  r  r  r"   r#   r+  w  s     " "$s) "r$   c                r  )zGet a list of the available input methods

The special input method 'NoIME' should always be first
in the list returned.

:return: A list of names of the available input methods.
)r  r.  r  r(   r"   get_imesZM17nDbInfo.get_imesw  s     djj!!r$   c                r  r   rr   r   r   r  r  r"   r#   r+         	 	C 	C 	r$   c                    WP                   9   d3   RV P                   V,          9   d   V P                   V,          R,          # R# )u   Get the full path of the implementation file of the input method.

:param ime: Name of the input method
:return: Path of the implementation file of the input method.
         Empty string if no file has been found implementing “ime”
rF  r-   r.  r  rr   r  r"   get_pathZM17nDbInfo.get_path  3     **4::c?!:::c?6**r$   c                r  rJ  r   r  r  r"   r#   r+    s     	 	S 	S 	r$   c                rL  )zGet the title of the input method.

:param ime: Name of the input method
:return: Title of the input method.
         Empty string if no title has been found.
r  r-   rM  rN  r  r"   	get_titleZM17nDbInfo.get_title  s3     **DJJsO!;::c?7++r$   c                r  rJ  r   r  r  r"   r#   r+    s     	 	3 	3 	r$   c                rL  )zGet the description of the input method.

:param ime: Name of the input method
:return: Description of the input method.
         Empty string if no description has been found.
r;  r-   rM  rN  r  r"   get_descriptionZM17nDbInfo.get_description  s3     **$**S/!A::c?=11r$   c                r  rJ  r   r  r  r"   r#   r+    s     	 	s 	s 	r$   c                rL  )zGet the content of the implementation file of the input method.

:param ime: Name of the input method
:return: Content of the implementation file of the input method.
         Empty string if no content has been found.
r<  r-   rM  rN  r  r"   get_contentZM17nDbInfo.get_content  s3     **djjo!=::c?9--r$   c                r  rJ  r   r  r  r"   r#   r+    rK  r$   c                rL  )zGet the full path of the icon file of the input method.

:param ime: Name of the input method
:return: Path of the icon file of the input method.
         Empty string if no icon file has been found.
rB  r-   rM  rN  r  r"   get_iconZM17nDbInfo.get_icon  rP  r$   c                r  r   r   r  r  r"   r#   r+    s          r$   c                r  r  )reprr.  r  r(   r"   __str__ZM17nDbInfo.__str__  s    DJJr$   )r-  r.  r0  r2  r1  r/  N)rt  r  r  r  r  r  r3  r4  r5  r@  rC  rE  rF  rH  rI  rO  rQ  rR  rS  rT  rV  r  r  r  r  r"   r*  r*    s     	 	- -@1J 1Jff; f;P # ## ## # " "	 		 		 		 		 	   r$   r*  c                r   )r   resourcer   r   r   r!   r"   r#   r#     s      # # r$   c                 s   \         P                  P                  R4      ;'       g?    \         P                  P	                  \         P                  P                  R4      RR4      p\         P                  P                  ! V !  pVP                  R4      '       d   Q h\         P                  P	                  W4      p\         P                  P                  V4      '       g   \         P                  ! VRR7       V# )z^
Compatibility function for systems which do not have pyxdg.
(For example openSUSE Leap 42.1)
ZXDG_DATA_HOMEr  z.localZsharer  T)Zexist_ok)	r~   r   r   rF  r   re  r   r  Zmakedirs)rW  Zxdg_data_homeZresource_joinedrF  s   *   r"   rd  rd    s     JJNN?3 4 4rww||
3784MggllH-O))#....77<<7D77==
D4(Kr$   c                r   )r   r   r   r   r   r!   r"   r#   r#     s     K KS KT Kr$   c                s   a  S P                  4       o \        ;QJ d    V 3R lR 4       F  '       g   K   R# 	  R# ! V 3R lR 4       4      # )u   Checks whether a desktop named “name” is used

:return: True if such a desktop is used,
         False if not.

Example: is_desktop('gnome'), is_desktop('i3')
c              3   s   <"   T F6  pS\         P                  P                  VR 4      P                  4       9   x  K8  	  R# 5ir,  )r~   r   r   r   )r   Zenv_varr   s   & r"   r   Zis_desktop.<locals>.<genexpr>  s<      K 	J  	

w+1133Is   >ATF)ZXDG_CURRENT_DESKTOPZXDG_SESSION_DESKTOPZDESKTOP_SESSION)r   Zany)r   s   fr"   
is_desktoprX    sY     ::<D3 K 	JK33 K3 K3 K 	JK K Kr$   c                s>    V ^8  d   QhR\         \        R3,          /# )r   r   .)r   r   r   r!   r"   r#   r#     s     ' 'sCx 'r$   c                 sn    \         P                  ! RR.\         P                  R7      P                  R4      P	                  4       p RRRRRR/p\        P                  ! RT \        P                  4      pT'       g   R
# TP                  ^4      P                  R	4      p. pT FM  pTP                  4       pYa9   d   TP                  Y,          4       K2   TP                  \        T4      4       KO  	  \!        T4      #   \         P
                  \        3 d    R
u # i ; i  \         d    R
u u # i ; i)u   Returns the gnome-shell version as a tuple

`gnome-shell --version` prints something like 'GNOME Shell 48.2'

Pre-releases are mapped as:
  alpha → -3, beta → -2, rc → -1

Examples:
  '48.3' → (48, 3)
  '49.alpha.1' → (49, -3, 1)

:return: A tuple or empty tuple () on failure.
zgnome-shellz	--version)r1  r/  r   ZbetaZrcz!(\d+(?:\.(?:\d+|alpha|beta|rc))+)r   r*   iir   )r8  Zcheck_outputZSTDOUTrU  rg   r<  rq  rh   r   rk   r   rf   r   rl   r   r  tuple)ZoutputZpre_release_mapr   ZpartsZversionZpartr   s          r"   get_gnome_shell_versionrZ    s   ((K($$&&,fWoeeg 	 	bO II:bmm-E	KKN  %EG

#NN?12s4y)  >+ ))+<= 	&  	s$   AC? D"?DD"D43D4c                   s   a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )KeyvalsToKeycodesi
  a  Class to convert key values to key codes.

Key values (Key symbols) are the codes which are sent whenever a
key is pressed or released.

Key codes are identifying numbers for physical keys.

The mapping from key values to key codes is usually not bijective,
a key value can be generated from different key codes (if that same value
is mapped to different hardware keys in the keyboard layout)
and a certain hardware key with a certain key code can generate different
key values depending on which modifier was pressed.
c                r  r  r*   r  r  r"   r#   KeyvalsToKeycodes.__annotate__  s     . .$ .r$   c                s    / V n         \        P                  P                  4       pV'       g)   \        P                  R V4       V P                  4        R#  \        ^8  d   V P                  V4       MV P                  V4        V P                   '       g(   \        P                  R4       V P                  4        R# R#   \         d2   p\        P                  RT4       T P                  4         Rp?R# Rp?ii ; i)z%Gdk.Display.get_default() returned %sNz'Exception while initializing keymap: %sz5No keycodes found, falling back to standard US layout)keyvals_to_keycodesr   DisplayZget_defaultro   r\  _fallback_to_std_us_layoutr   
_init_gtk4
_init_gtk3r>  r=  )r  displayrp   r^   r"   r  ZKeyvalsToKeycodes.__init__  s    9; ++))+NNBGL++-	A~((
 '''NNRS++- (	  	FN++-	s   C 4C C=&C88C=c                8   < V ^8  d   QhRS[ P                  RR/# r   rb  r   Nr   r^  r  r  r"   r#   r\  ,  s#     Z4 Z4#++ Z4$ Z4r$   c                s    \         P                  P                  p\        ^R4       EFd  pVP	                  V4      p VP	                  V4      p. pRp\        T\        4      '       d   TpRpM\        T\        4      '       d[   \        T4      ^8X  d3   Tw  rp
T'       g   K{  T	e   \        T	4      M. pT
e   \        T
4      MRpM9\        P                  RT4       K  \        P                  R\        T4      4       K  T'       g   T'       g   K  \        4       pT'       d/   T F'  pT'       g   K  TP                  \        T4      4       K)  	  MNT FH  p\!        TR4      '       g   K   \        \#        TR4      4      pT'       g   K7  TP                  T4       KJ  	  T'       g   EK  \        T4      p TP%                  T\         P                  P&                  ^ 4      vpppT'       d#   T'       d   TP                  \        T4      4        TP%                  Y2^ 4      vpppT'       d#   T'       d   TP                  \        T4      4       T F8  pT'       g   K  T P(                  P+                  T. 4      P-                  T4       K:  	  EKg  	  R#   \
         d#   p\        P                  RY54        Rp?EK  Rp?ii ; i  \
         d     EK  i ; i  \
         d	    Rp^ p ELi ; i  \
         d    Rp^ p Li ; i)z+Gtk4 implementation (no Gdk.Keymap exists).   z"display.map_keycode(%d) raised: %sNz7display.map_keycode returned unexpected tuple shape: %rz/display.map_keycode returned unexpected type %rr  F)r   ModifierTypeZALT_MASKrangeZmap_keycoder>  ro   r]  r,  r	  rY  rm   Ztyper   r   r   r  r  translate_keyboard_state
SHIFT_MASKr]  
setdefaultrl   )r  rb  
altgr_modskeycoder  rp   Z	keys_listZkeyvals_from_resultsuccessZkeys_objZkeyvals_objbase_keyvalsZkvZkall_keyvalsZokr  r)   s   &&                r"   r`  ZKeyvalsToKeycodes._init_gtk4,  s    %%..
 Q}G
 ((1F ,,W5 .0I7;&$''"	&*#FE**v;!#5;2G{" 2:2FXBI-8-D[)$ ( LLQ  EL" %8%(UL"-Br$((R1 .
 #Aq(++%!$WQ%9!:B 2(,,R0 #  $'$5K!(!A!AS--88!"=FQ
 fF,!(!A!A",FQ
 fF,%6,,77$$*F7O &W %  A7RX  ) %$%    sM   J*K5.KK+J?J::J?KKK('K(+K=<K=c                rc  rd  re  r  r  r"   r#   r\    s     *4 *4#++ *4$ *4r$   c                s8   \         P                  P                  V4      pV'       g   \        P	                  R4       R# \         P
                  P                  \         P
                  ! R4      ,          \         P
                  P                  ,          p\        ^R4       F  pVP                  V4      w  rVpV'       g   K!  \        T;'       g    . 4      pVP                  V\         P
                  P                  ^ 4      w  pp	p
ppV'       d   VP                  V	4       VP                  WC^ 4      w  pp	p
ppV'       d   V	'       d   VP                  V	4       V F8  p	V	'       g   K  V P                  P                  V	. 4      P!                  V4       K:  	  K  	  R# )z%Gtk3 implementation using Gdk.Keymap.zCould not get keymapNrf  i   )r   ZKeymapZget_for_displayro   r\  rg  	MOD1_MASK	MOD5_MASKrh  Zget_entries_for_keycoder   ri  rj  r   r]  rk  rl   )r  rb  Zkeymaprl  rm  rn  Z_keysro  rp  r  Z_effective_groupZ_comsumed_modifiersZ_locked_modifiersZ_consumed_modifierss   &&            r"   ra  ZKeyvalsToKeycodes._init_gtk3  sW   ++G4NN12
 &&W%&&&' 	 Q}G+1+I+I,(GL$'(:(:$;K
 #)"A"A#**55q#:	 W '
 #)"A"Aa#)	 W 6'%6,,77$$*F7O &- %r$   c                r  r  r*   r  r  r"   r#   r\    s     J JD Jr$   c                s    \         P                  ^q.\         P                  ^.\         P                  ^&./V n        V P
                  P                  V P                  4       R# )z1Fallback mapping for when keycode detection failsN)r   ZKEY_LeftZKEY_BackSpaceZKEY_a_std_us_keyvals_to_keycodesr]  updater  r(   r"   r_  Z,KeyvalsToKeycodes._fallback_to_std_us_layout  sM     MMC5JJ,
( 	  ''(H(HIr$   c                rG  r   )r   r   r  r  r"   r#   r\    s     4 4S 4r$   c                sH    \        V P                  P                  4       4      # )z;Returns the Set of keyvals available on the keyboard layout)r   r]  keysr  r(   r"   r  ZKeyvalsToKeycodes.keyvals  s    4++00233r$   c                6   < V ^8  d   QhRS[ RS[S[ ,          /# r  r   r   r  r  r"   r#   r\    s     	 	s 	tCy 	r$   c                sL    WP                   9   d   V P                   V,          # . # )zReturns a list of key codes of the hardware keys which can generate
the given key value on the current keyboard layout.

:param keyval: A key value
:return: A list of key codes of hardware keys, possibly empty
)r]  r  r  r"   keycodesZKeyvalsToKeycodes.keycodes  s&     ---++F33	r$   c                r  r  r  r  r  r"   r#   r\    s      c c r$   c                sJ    V P                  V4      pV'       d
   V^ ,          # ^ # )a  Returns one key code of one hardware key which can generate the
given key value (there may be more than one, see the
keycodes() function.

:param keyval: A key value
:return: One key code of a hardware key which can generate
         the given key value, between 9 and 255
)rx  )r  r  rx  rO  r"   rm  ZKeyvalsToKeycodes.keycode  s"     ==(A;r$   c                rv  r  rw  r  r  r"   r#   r\    s      C DI r$   c                s    WP                   9   d5   V P                   V,           Uu. uF  p\        ^ V^,
          4      NK  	  up# . # u upi )u  Returns a list of ibus key codes of the hardware keys which can
generate the given key value on the current keyboard layout.

ibus key codes are calculated by subtracting 8 from the
“normal” key codes.  The smallest possible keycode seems to be
9 (usually mapped to Escape).  Therefore, after subtracting 8
it is at least 1.

:param keyval: A key value
:return: A list of ibus key codes of hardware keys, possibly empty
         The key codes are between 1 and 247
)r]  max)r  r  rq   rO  r"   ibus_keycodesZKeyvalsToKeycodes.ibus_keycodes  sG     ---+/+C+CF+KL+KaC1q5M+KLL	 Ms   Ac                r  r  r  r  r  r"   r#   r\    s     0 03 03 0r$   c                sF    \        ^ V P                  V4      ^,
          4      # )u  Returns one ibus key code of one hardware key which can generate
the given key value (there may be more than one, see the
ibus_keycodes() function)

ibus key codes are calculated by subtracting 8 from the
“normal” key codes.  The smallest possible keycode seems to be
9 (usually mapped to Escape).  Therefore, after subtracting 8
it is at least 1.

:param keyval: A key value
:return: One ibus key code of a hardware key which can generate
         the given key value. It will be between 1 and 247.
)ry  rm  r  r  r"   ibus_keycodeZKeyvalsToKeycodes.ibus_keycode  s     1dll6*Q.//r$   c                r  r   r   r  r  r"   r#   r\    s       r$   c           	     s    R p\        V P                  4       F;  pVRV R\        P                  ! V4       RV P                  V,           R2,          pK=  	  V# )r-   zkeyval: z name: z keycodes: r  )r  r]  r   r!  )r  Zreturn_stringr  r^   r"   rV  ZKeyvalsToKeycodes.__str__  sj    T556F6( #))&12 3!55f=>bBCM 7
 r$   )rs  r]  N)rt  r  r  r  r  r  r`  ra  r_  r  rx  rm  rz  r{  rV  r  r  r  r  r"   r[  r[  
  st     . .(Z4 Z4x*4 *4XJ J4 4	 	  "0 0  r$   r[  c                   sl   a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltRt	V t
R# )KeyEventi
  zKKey event class used to make the checking of details of the key
event easy
c                0   < V ^8  d   QhRS[ RS[ RS[ RR/# )r   r  rm  stater   Nr  r  r  r"   r#   KeyEvent.__annotate__  s/     l& l&s l&S l& l& l&r$   c                s   Wn         W n        W0n        \        \        P
                  ! V P                   4      4      V n        \        P                  ! R V P                  4      '       d.   RR\        V P                  R,          ^4      ,           R 2V n        \        P                  ! V P                   4      V n        V P                  V n        V P                  '       g   V P                  V n        V P                  R9   d   V P                  V n        V P                  \        P                  P                  ,          ^ 8g  V n        V P                  \        P                  P                   ,          ^ 8g  V n        V P                  \        P                  P$                  ,          ^ 8g  V n        V P                  \        P                  P(                  ,          ^ 8g  V n        V P                  \        P                  P,                  ,          ^ 8g  V n        V P                  \        P                  P0                  ,          ^ 8g  V n        V P                  \        P                  P4                  ,          ^ 8g  V n        V P                  \        P                  P8                  ,          ^ 8g  V n        V P                  \        P                  P<                  ,          ^ 8g  V n        V P                  \        P                  P@                  ,          ^ 8g  V n!        V P                  \        P                  PD                  ,          ^ 8g  V n#        V P                  \        P                  PH                  ,          ^ 8g  V n%        V P                  \        P                  PL                  ,          ^ 8g  V n'        V P                  \        P                  PP                  ,          ^ 8g  V n)        V P                  \        P                  PT                  ,          ^ 8g  V n+        V P                  \        P                  PX                  ,          ^ 8g  V n-        V P                  \        P                  P\                  ,          ^ 8g  V n/        V P                  \        P                  P`                  ,          ^ 8g  V n1        \e        V P                  4      '       Ed%   V PB                  '       d   RV P                  ,           V n        V PF                  '       d   RV P                  ,           V n        V P6                  '       d   RV P                  ,           V n        V P&                  '       d   RV P                  ,           V n        V P                  '       dk   V P                  Pg                  4       '       g3   V P                  Pi                  4       '       d   V P                  '       g   R	V P                  ,           V n        R
V n5        RV n6        RV n7        R# )zU\+[0-9a-fA-F]{4,5}Z0xr  r   NNrq   zs-zG-zA-zC-zS-ry  FN)r  r  r  r  r  )8valcoder~  r   r   r!  r   rh   r   r   r  unicoder   rg  rj  shift	LOCK_MASKlockCONTROL_MASKcontrol
SUPER_MASKsuper
HYPER_MASKhyper	META_MASKmetarq  mod1	MOD2_MASKmod2	MOD3_MASKmod3	MOD4_MASKmod4rr  mod5ZBUTTON1_MASKbutton1ZBUTTON2_MASKbutton2ZBUTTON3_MASKbutton3ZBUTTON4_MASKbutton4ZBUTTON5_MASKbutton5RELEASE_MASKreleaseMODIFIER_MASKmodifierr  r   Zisprintabletimehandled
translated)r  r  rm  r~     &&&&r"   r  ZKeyEvent.__init__  s   	
((23	88*DII66 Y#diimR*@@CDDI--dhh7|||||99DL<<??  99DLZZ$"3"3">">>!C
JJ!2!2!<!<<A	zzD$5$5$B$BBaGZZ$"3"3">">>!C
ZZ$"3"3">">>!C
JJ!2!2!<!<<A	JJ!2!2!<!<<A	JJ!2!2!<!<<A	JJ!2!2!<!<<A	JJ!2!2!<!<<A	JJ!2!2!<!<<A	zzD$5$5$B$BBaGzzD$5$5$B$BBaGzzD$5$5$B$BBaGzzD$5$5$B$BBaGzzD$5$5$B$BBaGzzD$5$5$B$BBaG

T%6%6%D%DDIDLL!!
 yyy
  $dll2yyy#dll2yyy#dll2|||#dll2


\\))++ LL4466 LLL.  $dll2	 # !&r$   c                r  r  r  r   r  r  r"   r#   r  |        F t r$   c                s    \        V\        4      '       g   \        # V P                  VP                  8X  d9   V P                  VP                  8X  d   V P
                  VP
                  8X  d   R # R# TFr,  r|  r  r  r  r~  r  r  r"   r  ZKeyEvent.__eq__|  sK    %**!!HH		!II+JJ%++-r$   c                r  r  r  r  r  r"   r#   r    r  r$   c                s    \        V\        4      '       g   \        # V P                  VP                  8w  g7   V P                  VP                  8w  g   V P
                  VP
                  8w  d   R # R# r  r  r  r  r"   __ne__ZKeyEvent.__ne__  sK    %**!!HH		!99

*::,r$   c                r  r   r   r  r  r"   r#   r    s     - - -r$   c                sd   \        R P                  . RNV P                  R NRNV P                   NRNV P                  R NRNV P
                   NRNV P                   NRNV P                   NRNV P                   NR	NV P                   NR
NV P                   NRNV P                   NRNV P                   NRNV P                   NRNV P                   NRNV P                   NRNV P                    NRNV P"                   NRNV P$                   NRNV P&                   NRNV P(                   NRNV P*                   NRNV P,                   NRNV P.                   NRNV P0                   NRNV P2                   NRNV P4                   NRNV P6                   NRNV P8                   N4      4      # )r-   zval=Z08xz code=z	 state=0xu	    name=“u   ” unicode=“u   ” msymbol=“u
   ” shift=z lock=z	 control=z super=z hyper=z meta=z mod1=z mod2=z mod3=z mod4=z mod5=z	 button1=z	 button2=z	 button3=z	 button4=z	 button5=z	 release=z
 modifier=z time=z	 handled=z translated=)rU  r   r  r  r~  r   r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r(   r"   rV  ZKeyEvent.__str__  s   , ,d ,488C. , ! ,II;,,zz#&,', yyk,", ,,	,(	,
 ,,,
(, ZZL,!, II;,, ||n,%, ZZL,!, ZZL,!, II;,, II;,, II;,, II;,, II;,,  II;!, !," ||n#,"%#,$ ||n%,$%%,& ||n',&%',( ||n),(%),* ||n+,*%+,, ||n-,,%-,. /,.'/,0 II;1,01,2 ||n3,2%3,4 //*5,- 	-r$   )r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r  r  r~  r  r  r  r  r  N)rt  r  r  r  r  r  r  r  rV  r  r  r  r  r"   r|  r|  
  s5     l& l&\  - -r$   r|  c                r   )r   keyeventr   )r|  r   r   r!   r"   r#   r#     s     1 1X 1# 1r$   c                s   RpV P                   '       d
   VR,          pV P                  '       d
   VR,          pV P                  '       d
   VR,          pV P                  '       d
   VR,          pV P                  '       d
   VR,          pV P
                  '       d
   VR,          pV P                  '       d
   VR,          pV P                  '       d
   VR	,          pV P                  '       d
   VR
,          pV P                  '       d
   VR,          pV P                  '       d
   VR,          pWP                  ,          pV# )a  Calculates a keybinding string from a key event.

Examples:

>>> keyevent_to_keybinding(KeyEvent(IBus.KEY_Left, 0, 0))
'Left'

>>> keyevent_to_keybinding(KeyEvent(0x0100263a, 0, 0))
'0x100263a'

>>> keyevent_to_keybinding(KeyEvent(0x0101F923, 0, 0))
'0x101f923'

>>> keyevent_to_keybinding(KeyEvent(IBus.KEY_Left, 0, IBus.ModifierType.SHIFT_MASK | IBus.ModifierType.CONTROL_MASK))
'Shift+Control+Left'

>>> keyevent_to_keybinding(KeyEvent(0x0100263A, 0, IBus.ModifierType.SHIFT_MASK | IBus.ModifierType.CONTROL_MASK))
'Shift+Control+0x100263a'

>>> keyevent_to_keybinding(KeyEvent(0x0101F923, 0, IBus.ModifierType.SHIFT_MASK | IBus.ModifierType.CONTROL_MASK))
'Shift+Control+0x101f923'
r-   Shift+Lock+Control+Super+Hyper+Meta+Mod1+Mod2+Mod3+Mod4+Mod5+)r  r  r  r  r  r  r  r  r  r  r  r   )r  
keybindingr   r"   keyevent_to_keybindingr    s    2 J~~~h
}}}g
j 
~~~h
~~~h
}}}g
}}}g
}}}g
}}}g
}}}g
}}}g
--Jr$   c                r   )r   r  r   )r   r|  r   r!   r"   r#   r#     s     7& 7&s 7&x 7&r$   c                sv   V P                  R4      R,          p\        P                  ! V4      pV\        P                  8X  d1   \        P
                  ! RV4      '       d   \        VR,          ^4      p^ pRV 9   d"   V\        P                  P                  ,          pRV 9   d"   V\        P                  P                  ,          pRV 9   d"   V\        P                  P                  ,          pRV 9   d"   V\        P                  P                  ,          pRV 9   d"   V\        P                  P                  ,          pR	V 9   d"   V\        P                  P                  ,          pR
V 9   d"   V\        P                  P                  ,          pRV 9   d"   V\        P                  P                  ,          pRV 9   d"   V\        P                  P                   ,          pRV 9   d"   V\        P                  P"                  ,          pRV 9   d"   V\        P                  P$                  ,          p\'        V^ V4      # )a  Returns a key event object created from a key binding string.

Examples:

>>> keybinding_to_keyevent('Shift+Control+Left').val == IBus.KEY_Left
True

>>> keybinding_to_keyevent('Shift+Control+Left').name
'Left'

>>> keybinding_to_keyevent('Shift+Control+Left').state == IBus.ModifierType.SHIFT_MASK | IBus.ModifierType.CONTROL_MASK
True

>>> f"0x{keybinding_to_keyevent('Shift+Control+0x100263a').val:08x}"
'0x0100263a'

>>> f"0x{keybinding_to_keyevent('Shift+Control+0x101F923').val:08x}"
'0x0101f923'

>>> f"0x{keybinding_to_keyevent('Shift+Control+0x101G923').val:08x}"
'0x00ffffff'

>>> keybinding_to_keyevent('Shift+Control+0x101G923').val == IBus.KEY_VoidSymbol
True
Z+z0x10[0-9a-fA-F]{5}r  r  r  r  r  r  r  r  r  r  r  r  r   )rf   r   Zkeyval_from_nameZKEY_VoidSymbolrh   r   r   rg  rj  r  r  r  r  r  rq  r  r  r  rr  r|  )r  r   r  r~  rs   r"   keybinding_to_keyeventr    s   8 C $D""4(F$$$2G)N)NT"Xr"E:""---*"",,,Z""///:""---:""---*"",,,*"",,,*"",,,*"",,,*"",,,*"",,,FAu%%r$   c                   sZ   a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltR	tV t	R
# )HotKeysi  zQClass to make checking whether a key matches a hotkey for a certain
command easy
c                sJ   < V ^8  d   QhRS[ S[S[S[,          3,          RR/# )r   keybindingsr   N)r   r   r   r  r  r"   r#   HotKeys.__annotate__  s(     
< 
<Dd3i$8 
<T 
<r$   c                s,   / V n         V F  pW,           Fw  p\        V4      pVP                  pVP                  \        ,          pW P                   9   d&   V P                   V,          P                  WV34       Kf  WV3.V P                   V&   Ky  	  K  	  R # r  )_hotkeysr  r  r~  KEYBINDING_STATE_MASKrl   )r  r  commandr  r   r  r~  r  r"   r  ZHotKeys.__init__  sz    :<"G)22
,Z8gg		$99mm+MM'*113,?/2l^DMM'* 3 #r$   c                s@   < V ^8  d   QhRS[ S[S[S[3,          RS[/# )r   command_key_tupler   )r   r|  r   r   r  r  r"   r#   r  (  s)     2 2%*8Xs+B%C2HL2r$   c                sP   \        V\        4      '       g   R # V^,          pV^,          pV^ ,          pVf   TpVP                  pVP                  pVP                  R9   Ed   VP                  V8w  gY   VP                  \
        P                  P                  ,          '       g(   V\
        P                  P                  ,          '       g   R # V\
        P                  P                  ( ,          pVP                  R9   d%   V\
        P                  P                  ( ,          pEMHVP                  R9   d%   V\
        P                  P                  ( ,          pEMVP                  R9   d$   V\
        P                  P                  ( ,          pMVP                  R9   dF   V\
        P                  P                  ( ,          pV\
        P                  P                  ( ,          pMVP                  R9   dF   V\
        P                  P                  ( ,          pV\
        P                  P                  ( ,          pM3VP                  R9   d#   V\
        P                  P                  ( ,          pV\        ,          pW P                   9   d   WV3V P                   V,          9   d   R# R # )	FT)Shift_LShift_R	Control_L	Control_RAlt_LAlt_RMeta_LMeta_RSuper_LSuper_RISO_Level3_Shift)r  r  )r  r  )r  r  )r  r  )r  r  )r  )r,  rY  r  r~  r   r   rg  r  rj  r  rq  r  r  r  rr  r  r  )r  r  r  r   Zprev_keyr  r~  r  r"   __contains__ZHotKeys.__contains__(  s   +U33#A&"$Q' Hgg		88 , , #>>D$5$5$B$BBBt00====d''4444Exx11$++666677$++8888//$++555533$++6666$++555511$++5555$++555522$++5555--mm#|t}}W55r$   c                r  r   r   r  r  r"   r#   r  \  s     # # #r$   c                r  r  )rU  r  r  r(   r"   rV  ZHotKeys.__str__\  s    DMM""r$   )r  N)
rt  r  r  r  r  r  r  rV  r  r  r  r  r"   r  r    s)     
< 
<2 2h# #r$   r  c                   s   a  ] tR tRt o Rt]! R4      RR3V 3R lR lltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )ItbKeyInputDialogi_  z
Unified Gtk3/Gtk4 dialog for capturing a single key or key combination.
API-compatible with the original Gtk3 MessageDialog version.
z	Key inputNc                sX   < V ^8  d   QhRS[ RS[P                  RS[P                  RR/# )r   r  parentparent_popoverr   N)r   r   WindowZPopoverr  r  r"   r#   ItbKeyInputDialog.__annotate__d  s=     ' '
 ' JJ'  KK' 48'r$   c                s    R V n         R V n        V'       d   VP                  4        \        ^8  d   V P	                  W4       R # V P                  W4       R # r  )e	_responseZpopdownr   _build_gtk4_build_gtk3)r  r  r  r  r  r"   r  ZItbKeyInputDialog.__init__d  sG     -159""$>U+&r$   c                >   < V ^8  d   QhRS[ RS[P                  RR/# r   r  r  r   Nr   r   r  r  r  r"   r#   r  u  s&       cjj T r$   c                s   \         P                  ! VV\         P                  P                  \         P                  P
                  R7      V n        V P                  P                  \        R4      \         P                  P                  4       V P                  P                  R4       V P                  P                  R\        R4      ,          4       V P                  P                  \        R4      4       V P                  P                  RV P                  4       V P                  P                  RV P                   4       V'       d   V P                  P#                  V4       V P                  P%                  4        R	# )
z Build Gtk3 version of the dialog)r  r  Zmessage_typeZbuttonsCancelT<big><b>%s</b></big>)Please press a key (or a key combination)2The dialog will be closed when the key is releasedzkey-press-eventzkey-release-eventN)r   ZMessageDialogZMessageTypeZINFOZButtonsTyper  dialog
add_buttonr)   ResponseTyper  	set_modal
set_markupZformat_secondary_textconnect_on_key_press_gtk3_on_key_release_gtk3set_transient_forshow)r  r  r     &&&r"   r  ZItbKeyInputDialog._build_gtk3u  s   ''--OO((	*
 	q{C,<,<,C,CDd#" ;<	=	> 	)) BC		E
 	-t/F/FG/1J1JKKK))&1r$   c                >   < V ^8  d   QhRS[ P                  RRRS[/# )r   _widgeteventGdk.EventKeyr   r   ZWidgetr   r  r  r"   r#   r    s-        
	r$   c                s^    VP                   VP                  4       \        ,          3V n        R# zCalled when a key is pressedT)r  Z	get_stater  r  )r  r  r  r  r"   r  Z$ItbKeyInputDialog._on_key_press_gtk3  s'     ,,//#&;;=r$   c                r  )r   r  _eventr  r   r  r  r  r"   r#   r    s-        
	r$   c                sl    V P                   P                  \        P                  P                  4       R# zCalled when a key is releasedT)r  responser   r  OK)r  r  r  r  r"   r  Z&ItbKeyInputDialog._on_key_release_gtk3  s%     	S--001r$   c                r  r  r  r  r  r"   r#   r    s+     C C Ccjj CT Cr$   c                s  a  \         P                  ! VVR R7      S n        S P                  P                  \	        R4      \         P
                  P                  4       \         P                  ! \         P                  P                  ^R7      pVP                  ^4       VP                  ^4       VP                  ^4       VP                  ^4       S P                  P                  V4       \         P                  ! 4       pVP!                  R\	        R4      ,          4       VP#                  ^ 4       VP%                  V4       \         P                  ! \	        R4      R7      pVP#                  ^ 4       VP'                  R 4       VP%                  V4       \         P                  ! \         P                  P(                  ^R7      pVP+                  \         P,                  P.                  4       VP                  ^4       VP%                  V4       \         P0                  ! \	        R4      R7      pVP%                  V4       \         P2                  ! 4       pVP5                  RS P6                  4       VP5                  R	S P8                  4       S P                  P;                  V4       S P                  P=                  R 4       R
 R lp	R V 3R llp
R V 3R llpVP5                  RV4       S P                  P5                  RV
4       S P                  P5                  RV	4       S P                  P?                  4        R# )T)r  Ztransient_forZmodalr  )ZorientationZspacingr  r  r  )Zlabelzkey-pressedzkey-releasedc                <    V ^8  d   QhR\         P                  RR/# )r   r  r   N)r   Dialogr   r!   r"   r#   3ItbKeyInputDialog._build_gtk4.<locals>.__annotate__  s     	% 	%SZZ 	%D 	%r$   c                sz    V P                  4        V P                  4       pV'       d   VP                  4        R# R# )zTry to grab pointer and inputN)Z
grab_focusZget_default_widget)r  Zdefaultr   r"   on_dialog_mappedZ7ItbKeyInputDialog._build_gtk4.<locals>.on_dialog_mapped  s0    //1G""$ r$   c                s\    V ^8  d   QhR\         P                  R\         P                  RR/# )r   r  response_idr   N)r   r  r  r   r!   r"   r#   r    s+     	 	

 	9I9I 	d 	r$   c                s\   < VSn          V P                  4        R#   \         d     R# i ; i)z.Handle responses (cancel button, dialog close)N)r  hider>  )r  r  r  s   &&r"   on_responseZ2ItbKeyInputDialog._build_gtk4.<locals>.on_response  s*    (DN s    ++c                r  )r   _buttonr   N)r   Buttonr   r!   r"   r#   r    s     	 	szz 	d 	r$   c                s   < \         P                  P                  Sn         SP                  P                  4        R#   \         d     R# i ; i)z(Called when the cancel button is clickedN)r   r  r  r  r  r  r>  )r  r  s   &r"   on_cancel_clickedZ8ItbKeyInputDialog._build_gtk4.<locals>.on_cancel_clicked  s=     --44DN  " s   > AAZclickedr  mapN) r   r  r  r  r)   r  r  ZBoxZOrientationZVERTICALZset_margin_topZset_margin_bottomZset_margin_startZset_margin_endZ	set_childZLabelr  Z
set_xalignrl   Zset_wrapZ
HORIZONTALZ
set_halignZAlignZENDr  ZEventControllerKeyr  _on_key_press_gtk4_on_key_release_gtk4Zadd_controllerZset_focusablepresent)r  r  r  ZboxZtitle_labelZ	sec_labelZ
button_boxZcancel_buttonZ
controllerr  r  r  s   f&&         r"   r  ZItbKeyInputDialog._build_gtk4  sb   jj  	q{C,<,<,C,CDgg#//":":BG2b!R 2c"iik" :;	<	= 	q!

;IIA A	%B C	
 	Q4 

9WW)C)CQO
ciimm,!!"%

:

85-(++-
=$*A*AB>4+D+DE"":.!!$'	%	 		 	 	i):;J4E#34r$   c          
      6   < V ^8  d   QhRRRS[ RS[ RS[ RS[/# )r   _controllerGtk.EventControllerKeyr  _keycoder~  r   r  r  r  r"   r#   r    s=     	 	1	 	 		
 	 
	r$   c                s,    W$\         ,          3V n        R# r  )r  r  )r  r  r  r  r~     &&&&&r"   r  Z$ItbKeyInputDialog._on_key_press_gtk4  s     "778r$   c          
      r  )r   r  r   _keyvalr  _stater   r  r  r  r"   r#   r    s=      1  	
  
r$   c                s    \         P                  P                  V n         V P                  P                  4        R#   \         d     R# i ; ir  )r   r  r  r  r  r  r>  )r  r  r  r  r  r  r"   r  Z&ItbKeyInputDialog._on_key_release_gtk4  sH     )),,	KK   		s   = AAc                r  r   r  r  r  r"   r#   r    s     # #S #r$   c                sz  a a \         ^8  d$   \        S P                  P                  4       4      # \        P
                  ! 4       oR VV 3R llp\        P                  ! ^V4       SP                  4        S P                  f$   \        \        P                  P                  4      # \        S P                  4      # )zGtk4 run() emulationc                r   r   r"  r   r!   r"   r#   Z+ItbKeyInputDialog.run.<locals>.__annotate__  s     	 	$ 	r$   c                  sH   < SP                   e   S P                  4        R# R# )NFT)r  Zquit)loopr  s   r"   _quit_when_readyZ/ItbKeyInputDialog.run.<locals>._quit_when_ready  s    ~~)		r$   )r   r   r  r9  r   ZMainLoopZtimeout_addr  r   r  r  )r  r  r  s   f @r"   r9  ZItbKeyInputDialog.run  s    q=t{{())}}	 	 	-.
>>!s''..//4>>""r$   c                r  r  r*   r  r  r"   r#   r    s       r$   c                s`     V P                   P                  4        R#   \         d     R# i ; i)zCommon to Gtk3 and Gtk4N)r  destroyr>  r  r(   r"   r  ZItbKeyInputDialog.destroy  s)    	KK! 		s    --)r  r  r  )rt  r  r  r  r  r)   r  r  r  r  r  r  r  r9  r  r  r  r  r  r"   r  r  _  sv      ;!%*.' '" 4  C CJ	 	 # #( r$   r  c                   sL   a  ] tR tRt o RtR	V 3R lR lltV 3R lR ltRtV tR# )
ItbAboutDialogi  u+   
The “About” dialog for Typing Booster
Nc                sH   < V ^8  d   QhRS[ S[P                  ,          RR/# )r   r  r   N)r   r   r  r  r  r"   r#   ItbAboutDialog.__annotate__   s$     > > 4 > >r$   c           	     s   \         ^8  d!   \        P                  P                  V 4       M \        P                  P                  WR7       Ve4   V P	                  V4       V P                  R4       V P                  R4       V P                  R4       V P                  R\        P                  ! 4        24       V P                  R4       V P                  R\        P                  ! 4        RR	P                  R
 \         4       4       24       V P                  \!        R4      4       V P#                  R4       V P%                  RR.4       V P'                  \!        R4      4       V P)                  R.4       V P+                  R4       V P-                  \!        R4      R,           R,           4       V P/                  R4       V P1                  R4       V P3                  \        P4                  P6                  4       \         ^8  d   V P9                  RV P:                  4       MV P9                  RV P:                  4       V P=                  4        V P?                  4        R# )i   )r  NTr-   u   🚀 ibus-typing-booster u   🚀 ibus-typing-boosterzibus-typing-booster-z, Gtk r   c              3   s8   "   T F  p\        V4      x  K  	  R # 5ir  r   )r   r*  r   r"   r   Z*ItbAboutDialog.__init__.<locals>.<genexpr>3  s     ;{!s1vv{s   z,A completion input method to speedup typing.u$   Copyright © 2012–2025 Mike FABIANz$Mike FABIAN <maiku.fabian@gmail.com>z'Anish Patil <anish.developer@gmail.com>ztranslator-creditsz0http://mike-fabian.github.io/ibus-typing-boosterzOnline documentation:r   a  
        This program is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/>
        zclose-requestr  ) r   r   AboutDialogr  r  r  Zset_destroy_with_parentZset_logo_icon_nameZ	set_titler=  r@  r_  Zset_versionr   r   Zset_commentsr)   Zset_copyrightZset_authorsZset_translator_creditsZset_documentersZset_websiteZset_website_labelZset_licenseZset_wrap_licenseZset_license_typeZLicenseZGPL_3_0r  on_close_aboutdialogr  r  )r  r  r  r"   r  ZItbAboutDialog.__init__   s   >OO$$T*OO$$T$9""6*NN4 ((. 	#'(?(?(A'BC	E&	(";#:#:#<"=SXX;{;<=?	@ 	<=	?2	425 	 	##"#	% 	2 	 	>	@%&FG	H 	  	 	d#ckk112>LL$*C*CDLLT%>%>?		r$   c                r  )r   _argsr   Nr    r  r  r"   r#   r	  `  s      3 4 r$   c                s&    V P                  4        R# )u   
The “About” dialog has been closed by the user

:param _about_dialog: The “About” dialog
:param _response: The response when the “About” dialog was closed
N)r  )r  r  s   &*r"   r  Z#ItbAboutDialog.on_close_aboutdialog`  s     	r$   r*   r  )	rt  r  r  r  r  r  r  r  r  r  r  r"   r  r    s     > >@ r$   r  i>  c                   s~   a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	Rt
V tR# )MicrophoneStreamim  ao  Opens a recording stream as a generator yielding the audio chunks.

This code is from:

https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/speech/cloud-client/transcribe_streaming_mic.py

https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/LICENSE

GoogleCloudPlatform/python-docs-samples is licensed under the
Apache License 2.0
c                r  )r   ratechunkr  r  r  r"   r#   MicrophoneStream.__annotate__y  s     1 1S 1 1r$   c                s|    Wn         W n        \        P                  ! 4       V n        R V n        RV n        RV n        R# TN)_rate_chunkqueueZQueue_buffclosed_audio_interface_audio_stream)r  r  r  r  r"   r  ZMicrophoneStream.__init__y  s2    
 (-{{}
;?,0r$   c                r  r   r    r  r  r"   r#   r    s      3 r$   c           	     s    \         P                  ! 4       V n        V P                  P                  \         P                  ^V P
                  RV P                  V P                  R7      V n        RV n	        V # )r   T)r    Zchannelsr  ZinputZframes_per_bufferZstream_callbackF)
pyaudioZPyAudior  ro  ZpaInt16r  r  _fill_bufferr  r  r  r(   r"   	__enter__ZMicrophoneStream.__enter__  sc     ' 1!2277?? TZZ$++ !-- 8 

 r$   c                r}  )r   _type_value
_tracebackr   Nr    r  r  r"   r#   r    s)     	. 	.c 	.3 	.C 	.D 	.r$   c                s2   V P                   '       d5   V P                   P                  4        V P                   P                  4        R V n        V P                  P                  R4       V P                  '       d   V P                  P                  4        R# R# r  )r  Zstop_streamZcloser  r  putr  Z	terminate)r  r  r  r  r  r"   __exit__ZMicrophoneStream.__exit__  sn    **,$$& 	

t   !!++- !r$   c                sL   < V ^8  d   QhRS[ RS[ RS[ RS[ RS[RS[ 3,          /# )r   in_data_frame_count
_time_info_status_flagsr   N)r   r   r  r  r"   r#   r    sF     ( (( ( 	(
 (
 $)s#3(r$   c                s\    V P                   P                  V4       R\        P                  3# )zAContinuously collect data from the audio stream, into the buffer.N)r  r  r  Z
paContinue)r  r!  r"  r#  r$  r  r"   r  ZMicrophoneStream._fill_buffer  s%     	

wW''''r$   c                rG  r   )r	   rR  r  r  r"   r#   r    s     ! !8E? !r$   c              #  sJ  "   V P                   '       g]   V P                  P                  RR7      pVf   R# V.p  V P                  P                  RR7      pVf   R# VP                  V4       K7  R#   \        P
                   d     Mi ; iRP                  T4      x  K  5i)z(
Generator method yielding audio chunks
T)ZblockNFr$   )r  r  r   rl   r  ZEmptyr   )r  r  Zdatar^   r"   	generatorZMicrophoneStream.generator  s      +++ JJNNN.E}7D  JJNNN7E}KK&   {{  ((4. s9   B#&B# A3 B#A3 /B#3BB#
BB#)r  r  r  r  r  r  N)rt  r  r  r  r  r  r  r   r  r%  r  r  r  r  r"   r  r  m  s<     
1 1 $	. 	.( (! !r$   r  Z__main__)Zstreamzremove_accents() cache info: %sc                s    V ^8  d   Qh/ ^ \         9   d   \        R,          ;R&   ^\         9   d   \        \        ,          ;R&   ^\         9   d
   \        ;R&   ^\         9   d
   \        ;R&   # )r   r  r   
AUDIO_RATEAUDIO_CHUNK)r  r,   ZNFKCr  )__conditional_annotations__r   r
   r   r   r   r!   r"   r#   r#      sq      D K JW%AB JEFp= =WS\ =GpnZ  C oZpZ ( 'S 'qZr$   )r   i   )ZinZjpZkrZus)
Leftr)  r)  r)  r)  S-Rightr*  r*  r*  r*  il    l    l    )ZPoZPiZPfZPsZPeZPcZPd)ztb:zh:tonepy.*u   调)ztb:zh:quicku   簡)z
tb:zh:py.*u   拼)ztb:zh:pinyin.*r2   )ztb:zh:cangjie.*u   倉)ztb:zh:bopomofo.*u   ㄅ)ztb:yi:.+u   ש)ztb:vi:nom.*u   喃)ztb:vi:han.*u   越)ztb:vi:.+u   ắ)ztb:ur:.+   خ)ztb:th:.+u   ท)z	tb:tai:.+u   ꫞)ztb:ru:.+u   Я)ztb:ps:.+r+  )ztb:oj:.+u   ᐏ)z	tb:nsk:.+   ᐃ)ztb:lo:.+u   ກ)ztb:km:.+u   ក)z	tb:kk:kbdu   Қ)ztb:kk:arabicu   ق)ztb:ja:.+r  )ztb:iu:.+r,  )ztb:ii:.+u   ꆈ)ztb:fa:.+u   ف)ztb:cr:.+r,  )ztb:bo:.+u   ཀ)ztb:am:.+u   አ)ztb:te:.+u   క)ztb:ta:.+u   க)ztb:si:.+u   සි)ztb:sd:.+   क)ztb:sat:.+devar-  )ztb:sat:.+olcku   ᱚ)ztb:sa:.+r-  )ztb:pa:.+u   ਕ)ztb:or:.+u   କ)ztb:ne:.+r-  )ztb:mr:.+r-  )ztb:mni:.+mteiu   ꯀ)ztb:mni:.+beng   ক)ztb:ml:.+u   ക)z	tb:mai:.+r-  )z	tb:ks:kbdr+  )ztb:ks:.+r-  )z	tb:kok:.+r-  )ztb:kn:.+u   ಕ)ztb:hi:.+r-  )ztb:gu:.+u   ક)z	tb:doi:.+r-  )z	tb:brx:.+r-  )ztb:bn:.+r.  )ztb:as:.+r.  )z.*u   ⌨z^(?P<language>[a-z]{2,3}(?=$|@|_[A-Z][a-z]{3}(?=$|@|_[A-Z0-9]{2,3}(?=$|@))|_[A-Z0-9]{2,3}(?=$|@)))(?:_(?P<script>[A-Z][a-z]{3})(?=$|@|_[A-Z0-9]{2,3}(?=$|@))){0,1}(?:_(?P<territory>[A-Z0-9]{2,3})(?=$|@)){0,1}r   )r8   rB   r9   r:   r;   r<   r=   r>   r?   r@   rA   rC   rD   rE   rF   rG   rH   rI   rJ   rK   ri  )iP   u   …)r-   )Fi   )r(  r  Ztypingr   r   r   r   r   r   r   r   r	   r
   r   r   r   r   Ztyping_extensionsZenumr   r   r~   Z	functoolsZcollectionsr   r   Zloggingr6  r8  r>  r%   rZ  r[  Zctypes.utilZxml.etree.ElementTreerC  Zdataclassesr   r   Zgir   Zgi.repositoryr   r   Zitb_gtkr   r   r   r   r=  r  ZregexZVERSION1ZDEFAULT_VERSIONrh   ZImportErrorr`  ra  ZIMPORT_PYAUDIO_SUCCESSFULr  ZIMPORT_QUEUE_SUCCESSFULr  r   r   r   r   Z	getLoggerro   r&   r)   r+   r   ZM17N_ENGINE_NAME_PATTERNZAVAILABLE_IBUS_KEYMAPSZANTHY_HENKAN_WIDErg  r  r  r  r  r  rw   rn   r  Z	INT32_MAXZ
UINT32_MAXZ	INT64_MAXZ
UINT64_MAXZSHORTCUT_USER_FREQZFIX_WHITESPACE_CHARACTERSr   ZACCENT_LANGUAGESZM17N_IME_SYMBOLSrZ   r_   r`   rt   ry   ZHUNSPELL_DICTIONARIESZCLDR_ANNOTATION_FILESZGOOGLE_SPEECH_TO_TEXT_LANGUAGESr   ZSUPPORTED_DICTIONARIESrt  r   r   r   re   r   Z	lru_cacher   r   r   Z
namedtupler   r   rX   r   rY   r   r   r   r   r   r   r   r   r   ZVERBOSEr   r   r   r  r  r  r   r  r   r  r  r  r   r  rj   ru  r   r!  r#  r$  r%  r(  r-  r@  rD  rI  rL  rP  rW  r_  rb  rg  rm  rw  rx  r  r  r   r  r  r*  rd  rX  rZ  r[  r|  r  r  r  r  r
  r  r&  r   r'  r  rt  ZStreamHandlerr1  ZLOG_HANDLERZsetLevelZDEBUGZ
addHandlerZdoctestZtestmodZFAILEDZ
_ATTEMPTEDr   Z
cache_infoZexitr#   )r(  r  r"   <module>r/     s?z  &             
v)  	              ! #        4 4 '  !NNE	BK ! %# " & $   $" $ ("& $ ("& 
		0	1"
. ::24  2   	##"""#"""# """#  "$  #% EJ  J 	
 	
  gr' j"5 +r		  &?w%G ' "%>w%G ' "%>w%G ' "%>w%G ' "# V"V	2V 	"V 	"	V
 	"V 	"V 	"V 	"V 	"V 
2V 	"V 	"V 	.V 	"V 
2V  	"!V" 	"#V$ 	"%V& 	"'V( 	.)V* 	"+V, 	"-V. 
2/V0 	"1V2 	"3V4 	"5V6 	"7V8 
29V: 	";V< 
2=V> 	"?V@ 
2AVB 	"CVD 	"EVF 	"GVH 	"IVJ 	"KVL 	"MVN 	"OVP 	"QVR 	"SVT 	"UVV 	"WVX 	"YVZ 	"[V\ 	"]V^ 	"_V` 
2aVb 	"cVd 	.eVf 
2gVh 	"iVj 	.kVl 	"mVn 
2oVp 	"qVr 	"sVt 	"uVv 
2wVx 	"yVz 	"{V| 
2}V~ 	"V@ 	"AVB 	"CVD 	"EVF 
2GVH 	"IVJ 	"KVL 
2MVN 	"OVP 	"QVR 	"SVT 	"UVV 	.WVX 
2YVZ 	"[V\ 	"]V^ 	"_V` 	"aVb 	"cVd 	"eVf 	"gVh 	"iVj 	"kV pR4 5R6 7R8 9R: ;R<  =R> !?R@ ARB CRD ERF GRH IRJ KRL MRN ORP QRR SRT URV WRX YRZ [R\ ]R^ _R` aRb cRd eRf gRh iRj kRl mRn oRp qRr sRt uRv wRx yRz {R| }R~ R@ ARB CRD ERF GRH IRJ KRL MRN ORP QRR SRT URV WRX YRZ [R\ ]Rb cR hm 	>G9nwi
@m nwi'Cm 	>G9nwi
@m 	>I;	
Bm 	>Hg.	
Jm nx1>G9Mm nx1>G9Mm nx1>G9Mm nx1>G9Mm nx1>G9Mm  nx1>G9M!m" nx1>G9M#m$ nx1>G9M%m& nx1>G9M'm( nx1>G9M)m* nx1>G9M+m, nx1>G9M-m. nx1>G9M/m0 nx1>G9M1m2 nx1>G9M3m4 nx1>G9M5m6 nx1>G9M7m8 nx1>G9M9m: nx1>G9M;m< nx1>G9M=m> nx1>G9M?m@ nx1>G9MAmB nx1>G9MCmD nx1>G9MEmF nh0.7)LGmH nx1>G9MImR 	>NG4GW-/SmV 
NWI~zBWmX 	>G9nwi
@YmZ 	>G9nwi
@[m\ 
NWI~zB]m^ 	>G9nwi
@_m` 	>NG4GW-/amd 	>G9nwi
@emf 
N17;WI'gmj 	>G9nwi
@kml 	>G9nwi
@mmn nwi'Comp nwi'Cqmr nwi'Csmt 
NWI~zBumv 	>G9nwi
@wmx 
NWI~zBymz 	>G9nwi
@{m| 	>G9nwi
@}m~ 	>G9nwi
@m@ 	>7)^gY
?AmB nwi'CCmD nwi'CEmF nwi'CGmH nwi'CImJ nwi'CKmL 
N17;WI'MmP 
NWI~zBQmR 	>G9nwi
@SmT 	>G9nwi
@UmV nwi'CWmX nwi'CYmZ nwi'C[m\ nwi'C]m^ nwi'C_m` nwi'Camb nwi'Ccmd nwi'Cemf nwi'Cgmh nwi'Cimj nwi'Ckml nwi'Cmmn nwi'Comp nwi'Cqmr nwi'Csmt nwi'Cumv nwi'Cwmx nwi'Cymz nwi'C{m| nwi'C}m~ nwi'Cm@ nwi'CAmB nwi'CCmD nwi'CEmF nwi'CGmH 	>G9ntf
=ImJ 
NWI~yAKmL nwi'CMmN nwi'COmP nwi'CQmR nwi'CSmT nwi'CUmV nwi'CWmX nwi'CYmZ nwi'C[m\ nwi'C]m^ nwi'C_m` nwi'Camb nwi'Ccmd nwi'Cemf nwi'Cgmh nwi'Cimj nwi'Ckml nwi'Cmmn nwi'Comp nwi'Cqmr nwi'Csmt nwi'Cumv 	>G9nwi
@wmx 	>G9nwi
@ymz 	>G9nwi
@{m| 
NWI~zB}m~ 	>G9ntf
=m@ 	>G9nwi
@AmB 	>G9nwi
@CmD nwi'CEmF nwi'CGmH nwi'CImJ nwi'CKmL nwi'CMmN 
NWI~zBOmP 	>G9nwi
@QmR nwi'CSmT 	>G9nwi
@UmV 	>G9nwi
@WmX 	>G9nwi
@YmZ 
NWI~w?[m\ 	>NG4GW-/]m` 	>G9nwi
@amb 
NWI~w?cmd 	>G9nwi
@emf 	>NG4GW-/gmj 
NWI~zBkml 	>G9nwi
@mmn 
NWI~zBomp 	>G9nwi
@qmr 	>G9nwi
@smt 	>G9nwi
@umv 	>G9ntf
=wmx 	>G9nwi
@ymz 	>G9nwi
@{m| 	>G9nwi
@}m~ nwi'Cm@ 	>G9nwi
@AmB 	>G9nwi
@CmJ 	>NG4GW-/KmN 	>Iw/GW-/OmR 
^2G<gY(SmV 	>Hg.	
JWmX !4g >	+Ym\ 	>G9nwi
@]m^ nwi'C_m` 	>G9nwi
@amb 	>G9ntf
=cmd 	>G9nwi
@emf 	>G9nwi
@gmh 	>G9nwi
@imj 	>G9nwi
@kml 
N_g6Xw/1mmp 	>G9ntf
=qmr 	>G9nwi
@smt 	>G9nwi
@umv 	>NG4GW-/wmz 	>G9nwi
@{m| 
N17;WI'}m@ "6!@',AmD 
NWI~zBEmF 	>NG4GW-/GmJ 	>G9nwi
@KmL nwi'CMmN 	>G9nwi
@OmP 	>G9nwi
@QmR 	>G9nwi
@SmT 
NWI~zBUmV ~y.8*EWmX 	>Hg.GW-/Ym\ n2G<w02]m` 	>G9nwi
@amb nwi'Ccmd nwi'Cemf 	>G9nwi
@gmh 	>G9nwi
@imj 
NWI~zBkml 	>G9nwi
@mmn 	>G9nwi
@omp 	>G9nwi
@qmr nwi'Csmt 	>NG4GW-/umx 	>/9GW-/ym| nwi'C}m~ 	>G9nwi
@m@ 
NWI~w?AmB 	>G9nwi
@CmD nwi'CEmF nwi'CGmH nwi'CImJ 	>G9nwi
@KmL 
NWI~zBMmN 	>G9nwi
@OmP 	>G9nwi
@QmR nwi'CSmT 	>G9nwi
@UmV 	>NG4G9&WmZ 
N17;WI'[m^ 	>G9nwi
@_m` 	>G9nwi
@amb 	>G9Ecmd !4g >	+emh 	>G9nwi
@imj nwi'Ckml nwi'Cmmn 	>G9nwi
@omp nwi'Cqmr nwi'Csmt 
NWI~zBumv 	>OW5GW-/wmz 	>G9nwi
@{m| 	>G9nwi
@}m~ 
NWI~zBm@ ~y.8*EAmB 	>G9nwi
@CmD nwi'CEmF nwi'CGmH nwi'CImJ 	>G9nwi
@KmL 	>G9nwi
@MmN nwi'COmP nwi'CQmR 	>G9nwi
@SmT 	>G9nwi
@UmV 	>G9nwi
@WmX nwi'CYmZ 	>G9nwi
@[m\ nwi'C]md 	>NG4GW-/emh 	>NG4GW-/iml 
NWI~zBmmn ~y.8*Eomp 	>G9nwi
@qmr 	>G9nwi
@smt nwi'Cumv 	>G9nwi
@wmx 	>G9nwi
@ymz 	>G9nwi
@{m| nwi'C}m~ 
NWI~zBm@	 	>G9nwi
@A	mB	 	>G9nwi
@C	mD	 	>G9nwi
@E	mF	 n}g6w02G	mJ	 	>G9nwi
@K	mL	 	>G9nwi
@M	mN	 	>GZ0.7)
LO	mP	 	>G9nwi
@Q	mR	 	>G9nwi
@>GY/w02>G9nw6H
IY	m^	B*AFJX~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~  !~" #~$ %~& '~( )~* +~, -~. /~0 1~2 3~4 5~6 7~8 9~: ;~< =~> ?~@ A~B C~D E~F G~H I~J K~L M~N O~P Q~R S~T U~V W~X Y~Z [~\ ]~^ _~` a~b c~d e~f 
g~h i~j k~l m~n o~p q~r s~t u~v w~x y~z {~| }~~ ~@ A~B C~D E~F G~H I~J K~L M~N O~P Q~R S~T U~V W~X Y~Z [~\ ]~^ _~` a~b c~d e~f g~h i~j k~l m~n o~p q~r s~t u~v w~x 	y~z {~| }~~ ~@ A~B C~D E~F G~H I~J K~L M~N O~P Q~R S~T U~V W~X Y~Z [~\ ]~^ _~` a~b c~d e~f g~h i~j k~l 	m~n o~p q~r s~t u~v w~x y~z {~| }~~ ~@ A~B C~D E~F G~H 
I~J K~L 
M~N O~P 
Q~R S~T U~V W~X Y~Z [~\ ]~^ _~` a~b 	c~d e~f g~h i~j k~l m~n o~p 
q~r s~t u~v w~x y~z {~| }~~ ~@ 	A~B C~D E~F G~H I~J K~L 	M~N O~P Q~R S~T U~V W~X Y~Z [~\ ]~^ _~` a~b c~d e~f g~h i~j k~l m~n o~p q~r s~t u~v w~x y~z {~| }~~ ~@ A~B C~D 
E~F G~H I~J K~L M~N O~P Q~R S~T U~V W~X Y~Z [~\ ]~^ _~` a~b c~d e~f g~h i~j k~l m~n o~p q~r s~t u~v w~x y~z {~| }~~ ~@ A~B C~D E~F G~H I~J K~L M~N O~P Q~R S~T U~V W~X Y~Z [~\ 	]~^ _~` a~b c~d e~f g~h i~j k~l m~n o~p q~r s~t u~v w~x y~z 	{~ @
 	   
  	  	  	   !" #$ %& '( )* +, -. /0 12 34 56 78 9: ;< => ?@ AB CD EF GH IJ KL MN OP QR ST UV 	WX YZ 
[\ ]^ 
_` ab 	cd ef gh ij kl 
mn op 	qr st 
uv wx 
yz 
{| }~ 	@ AB 
CD 
EF 	GH IJ 	KL MN OP 	QR ST UV 	WX YZ 
[\ ]^ 	_` ab cd ef gh 	ij kl mn op qr st 
uv wx yz 	{| }~ 
@ 
AB CD 
EF GH 
IJ KL MN 	OP QR 	ST UV 	WX 	YZ [\ 	]^ _` ab 
cd ef 	gh ij kl mn op qr st uv 
wx yz 
{| 
}~ @ 
AB CD 
EF GH 	IJ KL 
MN OP 	QR ST UV 	WX YZ [\ 	]^ _` ab cd ef gh ij kl mn op qr st uv wx yz {| }~ @ AB CD EF GH IJ KL MN OP QR ST UV WX YZ [\ ]^ _` ab cd ef gh ij kl mn op qr st uv wx yz {| }~ @ AB CD EF GH IJ KL MN OP QR ST UV WX YZ [\ ]^ _` ab cd ef gh ij kl mn op qr st uv wx yz {| }~ @ AB CD EF GH IJ KL MN OP QR ST UV WX YZ [\ ]^ _` ab cd ef gh ij kl mn op 	qr st 	uv wx yz {| }~ @ AB CD EF GH IJ KL MN OP QR ST UV WX YZ [\ ]^ _` ab cd ef gh ij kl mn 	op qr 	st uv 
wx yz 	{| }~ @	 	A	B	 C	D	 	E	F	 G	H	 
I	J	 K	L	 	M	N	 O	P	 Q	R	 	S	T	 U	V	 W	X	 Y	Z	 [	\	 ]	^	 _	`	 a	b	 c	d	 e	f	 g	h	 i	j	 k	l	 m	n	 o	p	 q	r	 s	t	 u	v	 w	x	 y	z	 {	|	 }	~	 	@
 A
B
 C
D
 E
F
 G
H
 I
J
 K
L
 M
N
 O
P
 Q
R
 S
T
 U
V
 W
X
 Y
Z
 [
\
 ]
^
 _
`
 a
b
 c
d
 e
f
 g
h
 i
j
 k
l
 m
n
 o
p
 
q
r
 
s
t
 u
v
 	w
x
 y
z
 	{
|
 }
~
 	
@ AB 	CD EF 
GH IJ KL MN 	OP QR 
ST UV 	WX YZ 	[\ ]^ _` ab 
cd ef 	gh ij 	kl mn op 	qr st uv 
wx yz 	{| }~ 	@ AB 	CD EF 	GH IJ 	KL MN 	OP QR 	ST UV WX YZ [\ 	]^ _` 
ab cd 
ef gh 	ij 	kl mn 
op qr 
st uv 
wx yz 
{| }~ 
@ AB 	CD EF 	GH IJ KL 
MN OP 	QR ST 
UV WX 	YZ [\ 	]^ _` 	ab cd ef 
gh ij 	kl mn 
op qr 
st uv 
wx yz 	{| 	}~ @ 	AB CD 
EF GH 	IJ KL 	MN OP 
QR 
ST UV 	WX YZ [\ ]^ _` 	ab cd 
ef gh ij 	kl mn 	op qr 
st uv 
wx yz 	{| }~ 
@ 
AB CD EF 
GH IJ 
KL MN 	OP QR 
ST UV 
WX YZ 	[\ 	]^ _` 	ab cd 	ef gh 
ij 	kl mn 	op qr st uv 	wx yz 
{| }~ 	@ AB 
CD EF 
GH IJ 	KL MN OP 	QR ST 
UV WX YZ 	[\ ]^ _` 	ab cd ef gh ij kl mn op 
qr st 	uv wx 
yz {| 	}~ @ 
AB 
CD EF 
GH IJ 	KL 	MN OP QR 	ST UV 	WX YZ [\ 	]^ _` ab cd ef 
gh 
ij 	kl mn 
op qr 	st uv 	wx yz {| }~ @ AB CD EF GH IJ KL MN OP 	QR ST UV WX 
YZ 
[\ 	]^ _` 	ab cd 	ef gh ij 
kl mn op 	qr st uv wx yz {| }~ 	@ AB 
CD EF 	GH 
IJ KL 
MN OP 
QR 
ST UV 	WX 	YZ [\ 	]^ _` ab cd 
ef gh 
ij kl 	mn op 
qr st uv wx yz 	{| }~ 	@ AB 	CD EF 
GH IJ 	KL MN 	OP QR ST UV WX 	YZ [\ ]^ _` 	ab cd ef gh ij kl mn op qr st uv 	wx 	yz {| }~ @ 	AB CD EF GH IJ 	KL MN OP QR ST 	UV WX 
YZ [\ ]^ 	_` ab 	cd ef 	gh ij kl 	mn op 	qr 	st uv 	wx yz {| 	}~ @ 
AB CD 
EF GH 	IJ KL 	MN OP 	QR ST UV 	WX YZ [\ ]^ _` ab cd 
ef gh ij kl mn 
op 	qr st 	uv wx 
yz {| 
}~ @ 	AB CD 	EF 
GH IJ 
KL MN 	OP QR 	ST UV WX 
YZ [\ ]^ _` ab 
cd ef 	gh ij kl mn op qr st uv wx yz 	{| } BB# B# B# B# B# B#  !B#" #B#$ %B#& 'B#( )B#* +B#, -B#. /B#0 1B#2 3B#4 5B#6 7B#8 9B#: ;B#< =B#> ?B#@ AB#B CB#D EB#F GB#H IB#J KB#L MB#N OB#P QB#R SB#T UB#V WB#X YB#Z [B#\ ]B#^ _B#` aB#b cB#d eB#f gB#h iB#j kB#l mB#n oB#p qB#r sB#t uB#v wB#x yB#z {B#| }B#~ B#@ AB#B CB#D EB#F GB#H IB#J KB#L MB#N OB#P QB#R SB#T UB#V WB#X YB#Z [B#\ ]B#^ _B#` aB#b cB#d eB#f gB#h iB#j kB#l mB#n oB#p qB#r sB#t uB#v wB#x yB#z {B#| }B#~ B#@ AB#B CB#D EB#F GB#H IB#J KB#L MB#N OB#P QB#R SB#T UB#V WB#X YB#Z [B#\ ]B#^ _B#` aB#b cB#d eB#f gB#h iB#j kB#l mB#n oB#p qB#r sB#t uB#v wB#x yB#z {B#| }B#~ B#@ AB#B 	CB# H     3 4   3 4   = >Y	
FY	
FY	 
6Y	 
6	Y	
 
6Y	 Y	 Y	 Y	 Y	 Y	 Y	 Y	 Y	 Y	 Y	  !Y	" #Y	$ %Y	& 'Y	( )Y	* +Y	, -Y	. /Y	0 1Y	2 3Y	4 5Y	6 7Y	8 9Y	: ;Y	< =Y	> ?Y	@ 	*AY	B 
:CY	D 	*EY	F 	*GY	H 	&IY	J 	&KY	L 
6MY	N 
6OY	P 	&QY	R 
6SY	T 	&UY	V 
6WY	X 
6YY	Z 	&[Y	\ 
%]Y	^ 	&_Y	` 	&aY	b 	&cY	d 	&eY	f 
6gY	h 	&iY	j 	&kY	l 
6mY	n 	&oY	p 
:qY	r 
6sY	t 
6uY	v 
6wY	x 
6yY	z 	&{Y	| 	&}Y	~ 	&Y	@ +AY	B 	&CY	D 
6EY	F 	&GY	H 
6IY	J 
6KY	L 
:MY	N 
6OY	P 
6QY	R 	&SY	T 
6UY	V 	&WY	X 	&YY	Z 	&[Y	\ 	&]Y	^ 	&_Y	` 	&aY	b 	&cY	d 
6eY	f 	&gY	h 	&iY	j 	&kY	l 
6mY	n 	*oY	p 	&qY	r 	&sY	t 
6uY	v 	&wY	x 	&yY	z 	&{Y	| +}Y	~ 	&Y	@ 
:AY	B 
6CY	D 	&EY	F 
6GY	H 	&IY	J 	&KY	L 
6MY	N 	&OY	P 	&QY	R 	&SY	T 
6UY	V 	&WY	X 	&YY	Z 	&[Y	\ 	&]Y	^ 	&_Y	` 	&aY	b 	&cY	d 	&eY	f 	&gY	h 	&iY	j 
6kY	l 
6mY	n 	&oY	p VqY	r 	&sY	t 
6uY	v 
6wY	x 
6yY	z 
6{Y	| 
6}Y	~ 	&Y	@ 	&AY	B 
6CY	D 	&EY	F 
6GY	H 	&IY	J 	&KY	L 	&MY	N 
6OY	P 	&QY	R 
6SY	T 
6UY	V 
6WY	X 	&YY	Z 	&[Y	\ 	&]Y	^ 	*_Y	` 
6aY	b 	&cY	d 	&eY	f 
6gY	h 	&iY	j 	&kY	l 
6mY	n 	&oY	p 	&qY	r 
6sY	t buY	v 
6wY	x 	&yY	z 
6{Y	| 
6}Y	~ 
6Y	@ 
6AY	B 	&CY	D 
6EY	F 
6GY	H 	&IY	J 	&KY	L 	&MY	N 	&OY	P 
%QY	R 
6SY	T 	&UY	V 	&WY	X 	&YY	Z 
6[Y	\ 	&]Y	^ 
6_Y	` 
6aY	b 	&cY	d 	&eY	f 
6gY	h 	&iY	j 	&kY	l 
6mY	n 	&oY	p 
6qY	r 	*sY	t 	&uY	v 
6wY	x 
6yY	z 	&{Y	| 
6}Y	~ 	&Y	@ 	&AY	B 	&CY	D 	&EY	F 	&GY	H 
:IY	J 	&KY	L 
6MY	N 
6OY	P 	&QY	R 	&SY	T 	&UY	V 
6WY	X 	&YY	Z 	&[Y	\ 	&]Y	^ 
6_Y	` 	&aY	b 	&cY	d 
6eY	f 	*gY	h 
6iY	j 
6kY	l 
:mY	n 
6oY	p 	*qY	r 	&sY	t 	&uY	v 
6wY	x 
6yY	z 	&{Y	| 	&}Y	~ 
6Y	@ 
6AY	B 	&CY	D 	&EY	F 	&GY	H 
6IY	J 
6KY	L 	&MY	N 	&OY	P 	&QY	R 	&SY	T 	&UY	V 	&WY	X 	&YY	Z 	&[Y	\ 	&]Y	^ 	&_Y	` 	&aY	b 
6cY	d 
6eY	f 	&gY	h 	&iY	j 	&kY	l 	&mY	n 	&oY	p 	&qY	r 	&sY	t 
6uY	v 	&wY	x 	&yY	z 	&{Y	| 
6}Y	~ 
6Y	@ 	&AY	B 	&CY	D 	&EY	F 	&GY	H 
6IY	J 	&KY	L 	&MY	N 	&OY	P 
6QY	R 	&SY	T 
6UY	V 	&WY	X 	&YY	Z 
6[Y	\ 
6]Y	^ 	&_Y	` 	&aY	b 
6	6&vv&qY	v1f4 T" #0 zz . V v&  
		>
@f%P2 h Qfj1X; z$ $L,,-"$L"2H *,* &46JJ 
5 1@4 41&H<Gb JItIsIsItItItItIsIsItIsIsIs4 T"/F /F #/FbG	 G  G oG mG #G iG  m!G" f#G$ k%G& $'G( )G* +G, -G. $/G0 k1G2 j3G4  5G6 "7G8 "9G: $;G< #=G> $?G@  AGB )CGD hEGF oGGH lIGJ hKGL *MGN +OGP )QGR )SGT hUGV $WGX oYGZ [G\ &]G^ $_G` (aGb 7cGd #eGf $gGh %iGj !kGl  mGn "oGp %qGr sGt uGv "wGx  yGz %#++!(+MG R.XHX HX H	X
 HX HX HX HX HX HX HX HX HX HX HX  H!X" H#X$ H%X& H'X( H)X* H+X, H-X. H/X0 H1X2 H3X4 H5X6 H7X8 H9X: H;X< H=X> H?X@ HAXB HCXD HEXP HQXR IIIIIIIIIIIIIkX v -/JJHHS2779:;-=  =E<B1f,0&>8)V=~B*4'"$GL2h<<F6P $! ! !@$ $LZ0 Z0xj4 jXn n`H HT"k  k Z	0K'R~ ~@`- `-D1f7&rE# E#N{ {zKS__ K\ 
 zB' 'T! T!l z''szz:K
OOGMM"
k""??,VZ
KK1>3L3L3NOHHV c[  K 	~ %$%$ 	~ & %& 	~ $#$ 	~ ("'( 	~ ("'(s   BY BY% 'BY6 0BZ 9BZ BZ) YBY"Y!BY"Y%
BY3Y2BY3Y6
BZZBZZ
BZZBZZ
BZ&Z%BZ&Z)
BZ7Z6BZ7