)L iC ddlmZddlmZmZmZmZmZmZddl m Z erddl m Z dgZ ede ZGdd eeZd d Zy ) ) annotations) TYPE_CHECKINGIterableListTypeVarcastoverload)OneStyleAndTextTuple) SupportsIndexexplode_text_fragments_T)boundcteZdZdZdZd dZd fd Zd dZed dZ ed dZ dfd Z xZ S) _ExplodedListz Wrapper around a list, that marks it as 'exploded'. As soon as items are added or the list is extended, the new items are automatically exploded as well. Tc(|j|gyN)extend)selfitems a/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/prompt_toolkit/layout/utils.pyappendz_ExplodedList.appends TFc6t|t|yr)superrr )rlst __class__s rrz_ExplodedList.extends -c23rctr)NotImplementedError)rindexrs rinsertz_ExplodedList.insert!s!!rcyrrrvalues r __setitem__z_ExplodedList.__setitem__&sDGrcyrr"r#s rr%z_ExplodedList.__setitem__)sFIrct|ts|j}t||dz}t|tr t d|g}t ||t|y)zl Ensure that when `(style_str, 'long string')` is set, the string will be exploded. zList[_T]N) isinstanceslice __index__tuplerrr%r )rrr$ int_indexrs rr%z_ExplodedList.__setitem__,sX%')I)Y]3E eU #eW-E E#9%#@Ar)rr returnNone)r Iterable[_T]r.r/)rr rr r.r/)rr r$r r.r/)rr*r$r0r.r/)rzSupportsIndex | slicer$z_T | Iterable[_T]r.r/) __name__ __module__ __qualname____doc__explodedrrr r r% __classcell__)rs@rrrscH4" GG II B* B3D B  B Brrct|tr|Sg}|D]"^}}}|D]}|j||g|$t|S)a. Turn a list of (style_str, text) tuples into another list where each string is exactly one character. It should be fine to call this function several times. Calling this on a list that is already exploded, is a null operation. :param fragments: List of (style, text) tuples. )r)rr) fragmentsresultstylestringrestcs rr r <sa)]+F )-v -A MM5!+d+ , --   rN)r8r0r.z_ExplodedList[_T]) __future__rtypingrrrrrr "prompt_toolkit.formatted_text.baser typing_extensionsr __all__r rr r"rrrCsJ"IIC/  T-.(BDH(BV!r