# Path: sanskrit_parser/base/sanskrit_base.py
# class SanskritImmutableString(SanskritString):
#     """ Immutable version of SanskritString
#     """
#     def __init__(self, thing=None, encoding=None, unicode_encoding='utf-8'):
#         super().__init__(thing, encoding, unicode_encoding)
# 
#     def __hash__(self):
#         return hash(str(self))
# 
#     def __eq__(self, other):
#         return str(self) == str(other)
# 
#     def __ne__(self, other):
#         return str(self) != str(other)
# 
# SLP1 = sanscript.SLP1
# 
# Path: sanskrit_parser/generator/operations.py
# def adesha(a, f, t):
#     p = str(f).find(str(a))
#     if p != -1:
#         return str(t)[p]
#     else:
#         return a
# 
# Path: sanskrit_parser/generator/maheshvara.py
# def isInPratyahara(p, s):
# def isSavarna(p, s):


from sanskrit_parser.base.sanskrit_base import SanskritImmutableString, SLP1
from .operations import adesha
from .maheshvara import ms, isInPratyahara, isSavarna
from sanskrit_parser.generator.pratipadika import *  # noqa: F403


def zwutva(s: str):
    return adesha(s, "stTdDn", "zwWqQR")


def jashtva(s: str):
    return adesha(s, "JBGQDjbgqdKPCWTcwtkpSzsh", "jbgqdjbgqdgbjqdjqdgbjqdg")


def chartva(s: str):
    return adesha(s, "kKgGcCjJwWqQtTdDpPbB", "kkkkccccwwwwttttpppp")


def kutva(s: str):
    return adesha(s, "cCjJY", "kKgGN")


def vargatritiya(s: str):
    return adesha(s, "kKgGcCjJwWqQtTdDpPbB", "GGGGJJJJQQQQDDDDBBBB")


def adivriddhi(s: str):
    r = ""
    av = False
    for _s in s:
        if (not av) and isInPratyahara("ac", SanskritImmutableString(_s, encoding=SLP1)):
            r = r + vriddhi(_s)
            av = True
        else:

# Path: sanskrit_parser/base/sanskrit_base.py
# class SanskritImmutableString(SanskritString):
#     """ Immutable version of SanskritString
#     """
#     def __init__(self, thing=None, encoding=None, unicode_encoding='utf-8'):
#         super().__init__(thing, encoding, unicode_encoding)
# 
#     def __hash__(self):
#         return hash(str(self))
# 
#     def __eq__(self, other):
#         return str(self) == str(other)
# 
#     def __ne__(self, other):
#         return str(self) != str(other)
# 
# SLP1 = sanscript.SLP1
# 
# Path: sanskrit_parser/generator/operations.py
# def adesha(a, f, t):
#     p = str(f).find(str(a))
#     if p != -1:
#         return str(t)[p]
#     else:
#         return a
# 
# Path: sanskrit_parser/generator/maheshvara.py
# def isInPratyahara(p, s):
# def isSavarna(p, s):


# Path: sanskrit_parser/generator/paribhasha.py
from sanskrit_parser.base.sanskrit_base import SanskritImmutableString, SLP1
from .operations import adesha
from .maheshvara import ms, isInPratyahara, isSavarna
from sanskrit_parser.generator.pratipadika import *  # noqa: F403



def zwutva(s: str):
    return adesha(s, "stTdDn", "zwWqQR")


def jashtva(s: str):
    return adesha(s, "JBGQDjbgqdKPCWTcwtkpSzsh", "jbgqdjbgqdgbjqdjqdgbjqdg")


def chartva(s: str):
    return adesha(s, "kKgGcCjJwWqQtTdDpPbB", "kkkkccccwwwwttttpppp")


def kutva(s: str):
    return adesha(s, "cCjJY", "kKgGN")


def vargatritiya(s: str):
    return adesha(s, "kKgGcCjJwWqQtTdDpPbB", "GGGGJJJJQQQQDDDDBBBB")


def adivriddhi(s: str):
    r = ""
    av = False
    for _s in s:
        if (not av) and isInPratyahara("ac", SanskritImmutableString(_s, encoding=SLP1)):
            r = r + vriddhi(_s)
            av = True
        else:

            r = r + _s