
    )'hx                     $   d dl Z d dlZ	  ed      Zi ddddddddd	d
ddddddddddddddddddddddd d!d!d"dd#d$d%d&d'd(d)	Z e j
                  d*e j                        Z e j
                  d+e j                        Zd-d,Z	y).    N($  aftncnaftnsepaftnsepc
annotation	atnauthoratndateatnicnatnid	atnparentatnrefatntimeatrfend	atrfstartauthor
backgroundbkmkend	bkmkstartblipuidbuptimcategorycolorschememappingcolortblcommentcompanycreatim	datafield	datastoredefchpdefpapdodoccommdocvar
dptxbxtextebcendebcstartfactoidnamefaltfchars	ffdeftext
ffentrymcr	ffexitmcrffformat
ffhelptextfflffname
ffstattextfilefiletblfldinstfldtypefnamefontembfontfilefonttblfooterfooterffooterlfooterrfootnote	formfieldftncnftnsepftnsepcg	generatorgridtblheaderheaderfheaderlheaderrhlhlfr	hlinkbasehllochlsrchsvhtmltaginfokeycodekeywordslatentstyleslcharslevelnumbers	leveltextlfolevellinkvallist	listlevellistnamelistoverridelistoverridetablelistpictureliststylename	listtablelisttextlsdlockedexceptmaccmaccPr	mailmergemalnmalnScrmanagermargPrmbarmbarPrmbaseJcmbegChr
mborderBoxmborderBoxPrmboxmboxPrmchrmcountmctrlPrmdmdegmdegHidemdenmdiffmdPrmemendChrmeqArrmeqArrPrmfmfNamemfPrmfuncmfuncPr	mgroupChrmgroupChrPrmgrowmhideBot	mhideLeft
mhideRightmhideTopmhtmltagmlimmlimlocmlimlow	mlimlowPrmlimupp	mlimuppPrmmmmaddfieldnamemmath	mmathPictmmathPrmmaxdistmmcmmcJcmmconnectstrmmconnectstrdatammcPrmmcsmmdatasourcemmheadersourcemmmailsubjectmmodsommodsofiltermmodsofldmpdatammodsomappedname
mmodsonamemmodsorecipdata
mmodsosort	mmodsosrcmmodsotable	mmodsoudlmmodsoudldatammodsouniquetagmmPrmmquerymmrmnarymnaryPrmnoBreakmnummobjDistmoMath
moMathParamoMathParaPrmopEmumphantmphantPrmplcHidemposmrmradmradPrmrPrmsepChrmshowmshpmsPremsPrePrmsSubmsSubPrmsSubSup
msSubSupPrmsSupmsSupPrmstrikeBLTRmstrikeHmstrikeTLBRmstrikeVmsubmsubHidemsupmsupHidemtranspmtypemvertJcmvfmfmvfmlmvtofmvtolmzeroAsc	mzeroDescmzeroWidnesttablepropsnextfilenonesttablesobjaliasobjclassobjdataobjectobjnameobjsectobjtime	oldcprops	oldpprops	oldsprops	oldtpropsoleclsidoperatorpanosepasswordpasswordhashpgppgptblpicproppictpnpnseclvlpntextpntxtapntxtbprintimprivatepropnameprotend	protstartprotusertblpxeresultrevtblrevtimrsidtblrxeshpshpgrpshpinstshppictshprsltshptxtsnsp	staticval
stylesheetsubjectsvsvbtctemplate	themedatatitletxeudupr	userpropswgrffmtfilterwindowcaptionwritereservationwritereservhashxexformxmlattrnamexmlattrvaluexmlclosexmlnamexmlnstblxmlopenpar
sectz

pagelinetab	emdashu   —endashu   –emspaceu    enspaceu    qmspaceu    bulletu   •lquoteu   ‘rquoteu   ’	ldblquoteu   “	rdblquoteu   ”rowcell|    {}\   ­u   ‑)	nestcell~r(  r<  r=  r>  r?  -_zO\\([a-z]{1,32})(-?\d{1,10})?[ ]?|\\'([0-9a-f]{2})|\\([^a-z])|([{}])|[\r\n]+|(.)zP(\{\\field\{\s*\\\*\\fldinst\{.*HYPERLINK\s(\".*\")\}{2}\s*\{.*?\s+(.*?)\}{2,3})c                    t        j                  t        d|       } g }d}d}d}d}d}t        j	                  |       D ]}  }	|	j                         \  }
}}}}}|r-|s+|t        j                  |      j                  ||      z  }d}|r<d}|dk(  r|j                  ||f       g|d	k(  sm|r|j                         \  }}d}d
}|r#d}|t        v r|r|t        |   z  }|dk(  sd
}|
rd}|
t        v rd
}n |
dk(  rd| }	 t        j                  |       |r|
t        v r|t        |
   z  }|
dk(  rt!        |      }|
dk(  s||}t!        |      }|dk  r|dz  }|t#        |      z  }|}:|r)|dkD  r|dz  }H|rLt!        |d      }|s|}^||z  }e|si|dkD  r|dz  }u|ry||z  } |S # t        $ r d}Y w xY w)aW   Converts the rtf text to plain text.

    Parameters
    ----------
    text : str
        The rtf text
    encoding : str
        Input encoding which is ignored if the rtf file contains an explicit codepage directive, 
        as it is typically the case. Defaults to `cp1252` encoding as it the most commonly used.
    errors : str
        How to handle encoding errors. Default is "strict", which throws an error. Another
        option is "ignore" which, as the name says, ignores encoding errors.

    Returns
    -------
    str
        the converted rtf text as a python unicode string
    z\1(\2)F   r   N )encodingerrorsr=  r>  T*ansicpgcputf8ucui      )resub
HYPERLINKSPATTERNfinditergroupsbytesfromhexdecodeappendpopspecialcharsdestinationscodecslookupLookupErrorintchr)textrH  rI  stack	ignorableucskipcurskiphexesoutmatchwordarg_hexcharbracetcharcs                    X/home/kushmeetdev/Regenta/Chatbot/venv/lib/python3.12/site-packages/striprtf/striprtf.pyrtf_to_textrs  b   s   & 66*j$/DEIFGE
C!!$' C.3lln+c4ue5=='...PPCEG|fi01#(-		%FI
 F $IG|# ,t,,3 	G|# 	"u:&MM(+ %|D))S;$GCA1uW3q6MC$G{1bM ETME{1uGCH JA # &%H&s   G  GG)cp1252strict)
rQ  r^  	frozensetr]  r\  compile
IGNORECASErT  rS  rs       rr  <module>r{     sQ   	   ) )\	4
F F D	
 
4 h h x x x h h h    
4!" C#$ 		
		
		5< "**VMM
 RZZWMM
_rz  