## Disable Terminal Logging
export OS_ACTIVITY_MODE=DISABLE
export OS_ACTIVITY_DT_MODE=DISABLE

# Set the theme colors
autoload -U colors && colors
export TERM=xterm-256color

# For cleaner Filza installs on Dopamine
if [ -z $SHELL ]; then
    bash
fi

if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
  stty erase '^H'
fi

if [[ $UID -eq 0 ]]; then
    export HOME=/var/root
else
    export HOME=/var/mobile
    cd "$HOME"
fi

export SSL_CERT_DIR=/var/jb/etc/ssl/certs
export SSL_CERT_FILE=/var/jb/etc/ssl/certs/cacert.pem
export CURL_CA_BUNDLE=/var/jb/etc/ssl/certs/cacert.pem
export TIME_STYLE="+%b.%e"
export BAT_THEME="Monokai Extended Bright"
export PROMPT_DIRTRIM=2

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        # We have color support; assume it's compliant with Ecma-48
        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
        # a case would tend to support setf rather than setaf.)
        color_prompt=yes
    elif [ -x /var/bin/tput ] && tput setaf 1 >&/dev/null; then
        color_prompt=yes
    else
        color_prompt=
    fi
fi

# enable color support of ls and also add handy aliases
    d=/var/mobile/.dircolorsrc
    test -r $d && eval "$(dircolors $d)"

    alias random='source /var/mobile/.zsh_randomcolors'

    alias ls='ls --color=auto -p'
    alias dir='dir --color=auto'
    alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'

# some more ls aliases
alias ll='ls -A'
alias la='ls -alF'
alias l='ls -CF'
alias lsd='ls -ld $PWD'
alias lo='sudo ls -lO'
alias lk='ls -AlGghL'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f /var/mobile/.bash_aliases ]; then
    source /var/mobile/.bash_aliases
fi

## Default prompt style (minty, randomcolors, or leave blank)
export prompt_style=minty

## minty colors
RED="%F{196}"
WHITE="%F{231}"
MINT="%F{085}"
COOL="%F{081}"
NEON="%F{154}"
AQUA="%F{159}"
RESET="%F{reset}"

function precmd {
if [ "$color_prompt" = yes ]; then
    if [ "$prompt_style" = randomcolors ]; then
        source /var/mobile/.zsh_randomcolors
    else
        if [[ $UID -ne 0 ]]; then
            export PS1="${MINT}%n${WHITE}@${COOL}%m${WHITE}[%(4~|.../%2~|%~)]${MINT}\$ ${AQUA}"
        else
            export PS1="${RED}%n${WHITE}@${COOL}%m${WHITE}[%(4~|.../%2~|%~)]${RED}# ${NEON}"
        fi
    fi
fi
}

precmd

if [[ ! -z "$OBJC_DISABLE_INITIALIZE_FORK_SAFETY" ]]; then
    PS1="%n@%m[%~]$ "
fi
unset color_prompt force_color_prompt

# Functions
function mkdircd () { mkdir -p "$@" && eval cd "\"\$$#\""; }

lol()
{
  if [ -t 1 ]; then
      "$@" | lolcat
  else
      "$@"
  fi
}
[ -d /var/theos ] && export THEOS=/var/theos || :