// Autogenerated by Kumi Codegen for schema KUMI_031f3aedfffe4329e9a9ba9c9a1b21b3b04919c8b1c1e484b8db833ffeac7cf4
export class KumiCompiledModule {
  _shift_cols_right_zero(input) {
    let out = [];
    let t1 = input["rows"];
    let t6 = t1.length
    const t12 = 1;
    const t14 = 0;
    t1.forEach((rows_el_2, rows_i_3) => {
      let out_1 = [];
      let t7 = rows_i_3 % t6;
      let t8 = t7 + t6;
      let t9 = t8 % t6;
      let t10 = t1[t9]
      let t11 = t10.length
      let t19 = t11 - t12;
      rows_el_2.forEach((col_el_4, col_i_5) => {
        let t13 = col_i_5 - t12;
        let t15 = t13 >= t14;
        let t16 = t13 < t11;
        let t17 = t15 && t16;
        let t21 = Math.min(Math.max(t13, t14), t19);
        let t22 = t10[t21]
        let t24 = t17 ? t22 : t14;
        out_1.push(t24);
      });
      out.push(out_1);
    });
    return out;
  }

  _shift_cols_right_clamp(input) {
    let out = [];
    let t25 = input["rows"];
    let t30 = t25.length
    const t36 = 1;
    const t40 = 0;
    t25.forEach((rows_el_26, rows_i_27) => {
      let out_1 = [];
      let t31 = rows_i_27 % t30;
      let t32 = t31 + t30;
      let t33 = t32 % t30;
      let t34 = t25[t33]
      let t35 = t34.length
      let t39 = t35 - t36;
      rows_el_26.forEach((col_el_28, col_i_29) => {
        let t37 = col_i_29 - t36;
        let t41 = Math.min(Math.max(t37, t40), t39);
        let t42 = t34[t41]
        out_1.push(t42);
      });
      out.push(out_1);
    });
    return out;
  }

  _shift_cols_right_wrap(input) {
    let out = [];
    let t43 = input["rows"];
    let t48 = t43.length
    const t54 = 1;
    t43.forEach((rows_el_44, rows_i_45) => {
      let out_1 = [];
      let t49 = rows_i_45 % t48;
      let t50 = t49 + t48;
      let t51 = t50 % t48;
      let t52 = t43[t51]
      let t53 = t52.length
      rows_el_44.forEach((col_el_46, col_i_47) => {
        let t55 = col_i_47 - t54;
        let t56 = t55 % t53;
        let t57 = t56 + t53;
        let t58 = t57 % t53;
        let t59 = t52[t58]
        out_1.push(t59);
      });
      out.push(out_1);
    });
    return out;
  }

  _shift_cols_left_zero(input) {
    let out = [];
    let t60 = input["rows"];
    let t65 = t60.length
    const t71 = -1;
    const t73 = 0;
    const t77 = 1;
    t60.forEach((rows_el_61, rows_i_62) => {
      let out_1 = [];
      let t66 = rows_i_62 % t65;
      let t67 = t66 + t65;
      let t68 = t67 % t65;
      let t69 = t60[t68]
      let t70 = t69.length
      let t78 = t70 - t77;
      rows_el_61.forEach((col_el_63, col_i_64) => {
        let t72 = col_i_64 - t71;
        let t74 = t72 >= t73;
        let t75 = t72 < t70;
        let t76 = t74 && t75;
        let t80 = Math.min(Math.max(t72, t73), t78);
        let t81 = t69[t80]
        let t83 = t76 ? t81 : t73;
        out_1.push(t83);
      });
      out.push(out_1);
    });
    return out;
  }

  _shift_cols_left_clamp(input) {
    let out = [];
    let t84 = input["rows"];
    let t89 = t84.length
    const t95 = -1;
    const t97 = 1;
    const t99 = 0;
    t84.forEach((rows_el_85, rows_i_86) => {
      let out_1 = [];
      let t90 = rows_i_86 % t89;
      let t91 = t90 + t89;
      let t92 = t91 % t89;
      let t93 = t84[t92]
      let t94 = t93.length
      let t98 = t94 - t97;
      rows_el_85.forEach((col_el_87, col_i_88) => {
        let t96 = col_i_88 - t95;
        let t100 = Math.min(Math.max(t96, t99), t98);
        let t101 = t93[t100]
        out_1.push(t101);
      });
      out.push(out_1);
    });
    return out;
  }

  _shift_cols_left_wrap(input) {
    let out = [];
    let t102 = input["rows"];
    let t107 = t102.length
    const t113 = -1;
    t102.forEach((rows_el_103, rows_i_104) => {
      let out_1 = [];
      let t108 = rows_i_104 % t107;
      let t109 = t108 + t107;
      let t110 = t109 % t107;
      let t111 = t102[t110]
      let t112 = t111.length
      rows_el_103.forEach((col_el_105, col_i_106) => {
        let t114 = col_i_106 - t113;
        let t115 = t114 % t112;
        let t116 = t115 + t112;
        let t117 = t116 % t112;
        let t118 = t111[t117]
        out_1.push(t118);
      });
      out.push(out_1);
    });
    return out;
  }

  _shift_rows_down_zero(input) {
    let out = [];
    let t119 = input["rows"];
    let t124 = t119.length
    const t125 = 1;
    const t127 = 0;
    let t132 = t124 - t125;
    t119.forEach((rows_el_120, rows_i_121) => {
      let out_1 = [];
      let t126 = rows_i_121 - t125;
      let t128 = t126 >= t127;
      let t129 = t126 < t124;
      let t134 = Math.min(Math.max(t126, t127), t132);
      let t130 = t128 && t129;
      let t135 = t119[t134]
      let t136 = t135.length
      rows_el_120.forEach((col_el_122, col_i_123) => {
        let t137 = col_i_123 % t136;
        let t138 = t137 + t136;
        let t139 = t138 % t136;
        let t140 = t135[t139]
        let t142 = t130 ? t140 : t127;
        out_1.push(t142);
      });
      out.push(out_1);
    });
    return out;
  }

  _shift_rows_down_clamp(input) {
    let out = [];
    let t143 = input["rows"];
    let t148 = t143.length
    const t149 = 1;
    const t153 = 0;
    let t152 = t148 - t149;
    t143.forEach((rows_el_144, rows_i_145) => {
      let out_1 = [];
      let t150 = rows_i_145 - t149;
      let t154 = Math.min(Math.max(t150, t153), t152);
      let t155 = t143[t154]
      let t156 = t155.length
      rows_el_144.forEach((col_el_146, col_i_147) => {
        let t157 = col_i_147 % t156;
        let t158 = t157 + t156;
        let t159 = t158 % t156;
        let t160 = t155[t159]
        out_1.push(t160);
      });
      out.push(out_1);
    });
    return out;
  }

  _shift_rows_down_wrap(input) {
    let out = [];
    let t161 = input["rows"];
    let t166 = t161.length
    const t167 = 1;
    t161.forEach((rows_el_162, rows_i_163) => {
      let out_1 = [];
      let t168 = rows_i_163 - t167;
      let t169 = t168 % t166;
      let t170 = t169 + t166;
      let t171 = t170 % t166;
      let t172 = t161[t171]
      let t173 = t172.length
      rows_el_162.forEach((col_el_164, col_i_165) => {
        let t174 = col_i_165 % t173;
        let t175 = t174 + t173;
        let t176 = t175 % t173;
        let t177 = t172[t176]
        out_1.push(t177);
      });
      out.push(out_1);
    });
    return out;
  }

  _shift_rows_up_zero(input) {
    let out = [];
    let t178 = input["rows"];
    let t183 = t178.length
    const t184 = -1;
    const t186 = 0;
    const t190 = 1;
    let t191 = t183 - t190;
    t178.forEach((rows_el_179, rows_i_180) => {
      let out_1 = [];
      let t185 = rows_i_180 - t184;
      let t187 = t185 >= t186;
      let t188 = t185 < t183;
      let t193 = Math.min(Math.max(t185, t186), t191);
      let t189 = t187 && t188;
      let t194 = t178[t193]
      let t195 = t194.length
      rows_el_179.forEach((col_el_181, col_i_182) => {
        let t196 = col_i_182 % t195;
        let t197 = t196 + t195;
        let t198 = t197 % t195;
        let t199 = t194[t198]
        let t201 = t189 ? t199 : t186;
        out_1.push(t201);
      });
      out.push(out_1);
    });
    return out;
  }

  _shift_rows_up_clamp(input) {
    let out = [];
    let t202 = input["rows"];
    let t207 = t202.length
    const t208 = -1;
    const t210 = 1;
    const t212 = 0;
    let t211 = t207 - t210;
    t202.forEach((rows_el_203, rows_i_204) => {
      let out_1 = [];
      let t209 = rows_i_204 - t208;
      let t213 = Math.min(Math.max(t209, t212), t211);
      let t214 = t202[t213]
      let t215 = t214.length
      rows_el_203.forEach((col_el_205, col_i_206) => {
        let t216 = col_i_206 % t215;
        let t217 = t216 + t215;
        let t218 = t217 % t215;
        let t219 = t214[t218]
        out_1.push(t219);
      });
      out.push(out_1);
    });
    return out;
  }

  _shift_rows_up_wrap(input) {
    let out = [];
    let t220 = input["rows"];
    let t225 = t220.length
    const t226 = -1;
    t220.forEach((rows_el_221, rows_i_222) => {
      let out_1 = [];
      let t227 = rows_i_222 - t226;
      let t228 = t227 % t225;
      let t229 = t228 + t225;
      let t230 = t229 % t225;
      let t231 = t220[t230]
      let t232 = t231.length
      rows_el_221.forEach((col_el_223, col_i_224) => {
        let t233 = col_i_224 % t232;
        let t234 = t233 + t232;
        let t235 = t234 % t232;
        let t236 = t231[t235]
        out_1.push(t236);
      });
      out.push(out_1);
    });
    return out;
  }

}
