Local periods of strings Local periods

Take a non-empty string s.
The local period of s at index i is the smallest positive integer n such that for each 0 &le; k &lt; n, we have s[i+k] = s[i-n+k] whenever both sides are defined.
Alternatively, it is the minimal length of a nonempty string w such that if the concatenation w w is placed next to s so that the second copy of w begins at index i of s, then the two strings agree wherever they overlap.

As an example, let's compute the local period of s = "abaabbab" at (0-based) index 2.


Try n = 1: then s[2+0] ≠ s[2-1+0], so this choice is not correct.
Try n = 2: then s[2+0] = s[2-2+0] but s[2+1] ≠ s[2-2+1], so this is also not correct.
Try n = 3: then s[2+0-3] is not defined, s[2+1] = s[2-3+1] and s[2+2] = s[2-3+2]. Thus the local period is 3.


Here is a visualization of the local periods using the second definition, with semicolons added between the two copies of w for clarity:

index      a b a a b b a b      period
 0       a;a                     1
 1       b a;b a                 2
 2       a a b;a a b             3
 3             a;a               1
 4     b b a b a a;b b a b a a   6
 5                 b;b           1
 6               a b b;a b b     3
 7                   b a;b a     2


Note that w is not necessarily a substring of s.
This happens here in the index-4 case.

The task

Your input is a nonempty string s of lowercase ASCII characters.
It can be taken as a list of characters if desired.
Your output shall be the list containing the local period of s at each of its indices.
In the above example, the correct output would be [1,2,3,1,6,1,3,2].

The lowest byte count in each language wins.
Standard code-golf rules apply.

Test cases

a -&gt; [1]
hi -&gt; [1, 2]
www -&gt; [1, 1, 1]
xcxccxc -&gt; [1, 2, 2, 5, 1, 3, 2]
abcbacb -&gt; [1, 4, 7, 7, 7, 3, 3]
nininini -&gt; [1, 2, 2, 2, 2, 2, 2, 2]
abaabbab -&gt; [1, 2, 3, 1, 6, 1, 3, 2]
woppwoppw -&gt; [1, 4, 4, 1, 4, 4, 4, 1, 4]
qwertyuiop -&gt; [1, 10, 10, 10, 10, 10, 10, 10, 10, 10]
deededeededede -&gt; [1, 3, 1, 5, 2, 2, 5, 1, 12, 2, 2, 2, 2, 2]
abababcabababcababcabababcaba -&gt; [1, 2, 2, 2, 2, 7, 7, 7, 7, 2, 2, 2, 19, 19, 5, 5, 2, 5, 5, 12, 12, 2, 2, 2, 7, 7, 5, 5, 2]
Java 8, 167 154 152 bytes

s-&gt;{int l=s.length,r[]=new int[l],i=0,n,k;for(;i&lt;l;r[i++]=n)n:for(n=0;;){for(k=++n;k--&gt;0;)if(i+k&lt;l&amp;i+k&gt;=n&amp;&amp;s[i+k]!=s[i-n+k])continue n;break;}return r;}

-2 bytes thanks to @ceilingcat.
Try it online.
Explanation:
s-&gt;{                          // Method with char-array parameter and int-array return-type
  int l=s.length,             //  Length of the input-array
      r[]=new int[l],         //  Result-array of the same size 
      i=0,n,k;                //  Integers `i`, `n`, and `k` as defined in the challenge
  for(;i&lt;l;                   //  Loop `i` in the range [0, `l`):
      r[i++]=n)               //    After every iteration: Add `n` to the array
    n:for(n=0;;){             //   Inner loop `n` from 0 upwards indefinitely
      for(k=++n;k--&gt;0;)       //    Inner loop `k` in the range [`n`, 0]:
                              //    (by first increasing `n` by 1 with `++n`)
        if(i+k&lt;l&amp;i+k&gt;=n)      //     If `i+k` and `i-n+k` are both within bounds,
           &amp;&amp;s[i+k]!=s[i-n+k])//     and if `s[i+k]` is not equal to `s[i-n+k]`:
          continue n;         //      Continue loop `n`
                              //    If we haven't encountered the `continue n` in loop `k`:
      break;}                 //     Break loop `n`
  return r;}                  //  Return the result