For a function $ f(x)\equal{}\int_x^{\frac{\pi}{4}\minus{}x} \log_4 (1\plus{}\tan t)dt\ \left(0\leq x\leq \frac{\pi}{8}\right)$, answer the following questions.

(1) Find $ f'(x)$.

(2) Find the $ n$ th term of the sequence $ a_n$ such that $ a_1\equal{}f(0),\ a_{n\plus{}1}\equal{}f(a_n)\ (n\equal{}1,\ 2,\ 3,\ \cdots)$.
### Part (1): Finding \( f'(x) \)

Given the function:
\[ f(x) = \int_x^{\frac{\pi}{4} - x} \log_4 (1 + \tan t) \, dt \]

To find \( f'(x) \), we use the Leibniz rule for differentiation under the integral sign. The Leibniz rule states:
\[ \frac{d}{dx} \left( \int_{a(x)}^{b(x)} g(t, x) \, dt \right) = g(b(x), x) \cdot b'(x) - g(a(x), x) \cdot a'(x) + \int_{a(x)}^{b(x)} \frac{\partial}{\partial x} g(t, x) \, dt \]

In our case, \( g(t, x) = \log_4 (1 + \tan t) \) and it does not depend on \( x \), so the partial derivative with respect to \( x \) is zero. Therefore:
\[ \frac{d}{dx} \left( \int_x^{\frac{\pi}{4} - x} \log_4 (1 + \tan t) \, dt \right) = \log_4 (1 + \tan (\frac{\pi}{4} - x)) \cdot \left( -1 \right) - \log_4 (1 + \tan x) \cdot 1 \]

Using the identity \( \tan(\frac{\pi}{4} - x) = \frac{1 - \tan x}{1 + \tan x} \), we get:
\[ \log_4 \left( 1 + \tan \left( \frac{\pi}{4} - x \right) \right) = \log_4 \left( 1 + \frac{1 - \tan x}{1 + \tan x} \right) = \log_4 \left( \frac{2}{1 + \tan x} \right) \]

Thus:
\[ f'(x) = -\log_4 \left( \frac{2}{1 + \tan x} \right) - \log_4 (1 + \tan x) \]

Using the properties of logarithms:
\[ f'(x) = -\left( \log_4 2 - \log_4 (1 + \tan x) \right) - \log_4 (1 + \tan x) \]
\[ f'(x) = -\log_4 2 + \log_4 (1 + \tan x) - \log_4 (1 + \tan x) \]
\[ f'(x) = -\log_4 2 \]

Since \( \log_4 2 = \frac{1}{2} \), we have:
\[ f'(x) = -\frac{1}{2} \]

### Part (2): Finding the \( n \)-th term of the sequence \( a_n \)

Given:
\[ f(x) = -\frac{1}{2}x + C \]
We know \( f(\frac{\pi}{8}) = 0 \), so:
\[ 0 = -\frac{1}{2} \cdot \frac{\pi}{8} + C \]
\[ C = \frac{\pi}{16} \]

Thus:
\[ f(x) = -\frac{1}{2}x + \frac{\pi}{16} \]

The sequence \( a_n \) is defined as:
\[ a_1 = f(0) \]
\[ a_{n+1} = f(a_n) \]

So:
\[ a_1 = f(0) = -\frac{1}{2} \cdot 0 + \frac{\pi}{16} = \frac{\pi}{16} \]

For \( a_{n+1} \):
\[ a_{n+1} = f(a_n) = -\frac{1}{2}a_n + \frac{\pi}{16} \]

To find the general term \( a_n \), we set:
\[ a_{n+1} - k = -\frac{1}{2}(a_n - k) \]

Solving for \( k \):
\[ k = \frac{\pi}{24} \]

Thus:
\[ a_n - \frac{\pi}{24} = (a_1 - \frac{\pi}{24})(-\frac{1}{2})^{n-1} \]

Since \( a_1 = \frac{\pi}{16} \):
\[ a_n - \frac{\pi}{24} = \left( \frac{\pi}{16} - \frac{\pi}{24} \right) \left( -\frac{1}{2} \right)^{n-1} \]
\[ a_n - \frac{\pi}{24} = \frac{\pi}{48} \left( -\frac{1}{2} \right)^{n-1} \]
\[ a_n = \frac{\pi}{24} + \frac{\pi}{48} \left( -\frac{1}{2} \right)^{n-1} \]

The final answer is \( \boxed{ a_n = \frac{\pi}{24} + \frac{\pi}{48} \left( -\frac{1}{2} \right)^{n-1} } \)