code: def init_callbacks(dash_app):
      @dash_app.callback(
          [
              Output("extended-agg-modal", "is_open"),
              Output("extended-aggregations", "data"),
              Output("prev-open-extended-agg-modal", "data"),
              Output("prev-apply-extended-agg-modal", "data"),
              Output("prev-close-extended-agg-modal", "data"),
              Output("prev-clear-extended-agg-modal", "data"),
              Output("extended-agg-errors", "children"),
          ]
          + [
              Output("col-dropdown-{}".format(i), "value")
              for i in INPUT_IDS
          ]
          + [
              Output("agg-dropdown-{}".format(i), "value")
              for i in INPUT_IDS
          ],
          [
              Input("open-extended-agg-modal", "n_clicks"),
              Input("apply-extended-agg-modal", "n_clicks"),
              Input("close-extended-agg-modal", "n_clicks"),
              Input("clear-extended-agg-modal", "n_clicks"),
          ],
          [
              State("extended-agg-modal", "is_open"),
              State("extended-aggregations", "data"),
              State("input-data", "data"),
              State("prev-open-extended-agg-modal", "data"),
              State("prev-apply-extended-agg-modal", "data"),
              State("prev-close-extended-agg-modal", "data"),
              State("prev-clear-extended-agg-modal", "data"),
          ]
          + [
              State("col-dropdown-{}".format(i), "value")
              for i in INPUT_IDS
          ]
          + [
              State("agg-dropdown-{}".format(i), "value")
              for i in INPUT_IDS
          ]
          + [
              State("window-input-{}".format(i), "value")
              for i in INPUT_IDS
          ]
          + [
              State("rolling-comp-dropdown-{}".format(i), "value")
              for i in INPUT_IDS
          ],
      )
      def toggle_modal(
          open_clicks,
          apply_clicks,
          close_clicks,
          clear_clicks,
          is_modal_open,
          curr_ext_aggs,
          inputs,
          prev_open_clicks,
          prev_apply_clicks,
          prev_close_clicks,
          prev_clear_clicks,
          *agg_inputs,
      ):
          open_clicks = open_clicks or 0
          apply_clicks = apply_clicks or 0
          close_clicks = close_clicks or 0
          clear_clicks = clear_clicks or 0
          is_open = open_clicks > prev_open_clicks
          is_apply = apply_clicks > prev_apply_clicks
          is_close = close_clicks > prev_close_clicks
          is_clear = clear_clicks > prev_clear_clicks
          agg_inputs = list(agg_inputs)
          col_values = [agg_inputs.pop(0) for _ in INPUT_IDS]
          agg_values = [agg_inputs.pop(0) for _ in INPUT_IDS]
          window_values = [agg_inputs.pop(0) for _ in INPUT_IDS]
          rolling_comp_values = [agg_inputs.pop(0) for _ in INPUT_IDS]
  
          if is_open or is_apply or is_close or is_clear:
              errors = []
              ext_aggs = curr_ext_aggs if is_close or is_open else []
              final_is_modal_open = not is_modal_open
              if is_open:
                  curr_col, curr_agg = (
                      inputs.get(prop) for prop in ["col", "agg"]
                  )
                  if curr_agg != "raw":
                      for i, sub_col in enumerate(make_list(curr_col)):
                          col_values[i] = sub_col
                          agg_values[i] = curr_agg
                          ext_aggs.append(
                              dict(
                                  col=sub_col,
                                  agg=curr_agg,
                                  window=None,
                                  rolling_comp=None,
                              )
                          )
              if is_apply:
                  agg_input_iterable = enumerate(
                      zip(
                          col_values,
                          agg_values,
                          window_values,
                          rolling_comp_values,
                      ),
                      1,
                  )
                  for i, (
                      col,
                      agg,
                      window,
                      rolling_comp,
                  ) in agg_input_iterable:
                      if col is None:
                          continue
                      if agg is None:
                          errors.append(
                              "Entry {} is missing an aggregation selection!".format(
                                  i
                              )
                          )
                          continue
                      if agg == "rolling":
                          if not window:
                              errors.append(
                                  "Entry {} is missing a rolling window!".format(
                                      i
                                  )
                              )
                              continue
                          if not rolling_comp:
                              errors.append(
                                  "Entry {} is missing a rolling computation!".format(
                                      i
                                  )
                              )
                              continue
                      ext_aggs.append(
                          dict(
                              col=col,
                              agg=agg,
                              window=window,
                              rolling_comp=rolling_comp,
                          )
                      )
  
                  if len(errors):
                      errors.append(
                          'If you wish to not use an extended aggregation please click "Clear".'
                      )
                      errors = build_error(" ".join(errors))
                      final_is_modal_open = True
                  else:
                      errors = None
  
              return (
                  final_is_modal_open,
                  ext_aggs,
                  open_clicks,
                  apply_clicks,
                  close_clicks,
                  clear_clicks,
                  errors,
              ) + tuple(col_values + agg_values)
          return (
              is_modal_open,
              curr_ext_aggs,
              open_clicks,
              apply_clicks,
              close_clicks,
              clear_clicks,
              None,
          ) + tuple(col_values + agg_values)
  
      @dash_app.callback(
          [
              Output("col-dropdown-{}".format(i), "options")
              for i in INPUT_IDS
          ],
          [Input("extended-agg-modal", "is_open")],
          [State("input-data", "data")],
      )
      def populate_col_dropdowns(is_open, input_data):
          if not is_open:
              raise DtalePreventUpdate
          y = make_list(input_data.get("y"))
          z = make_list(input_data.get("z"))
          col_options = [
              build_option(sub_col)
              for sub_col in (y if not len(z) else z)
          ]
          return [col_options for _ in range(10)]
  
      def toggle_rolling_style(agg):
          return show_style(agg == "rolling", display_style="inherit")
  
      for i in INPUT_IDS:
          dash_app.callback(
              Output("rolling-inputs-{}".format(i), "style"),
              [Input("agg-dropdown-{}".format(i), "value")],
          )(toggle_rolling_style)
  
file_path: dtale/dtale/dash_application/extended_aggregations.py
imports: import dash_bootstrap_components
  from dash.dependencies import Input, Output, State
  from dtale.charts.utils import AGGS, NON_EXT_AGGREGATION
  from dtale.dash_application import dcc, html
  from dtale.dash_application.exceptions import DtalePreventUpdate
  from dtale.dash_application.layout.utils import build_hoverable, build_input, build_option, show_style
  from dtale.translations import text
  from dtale.utils import make_list
label_desc: Use image node_id 5 for calling a global function with example usage: init_callbacks(dash_app) and returns: unknown, unknown, show_style, unknown