public byte[] Bld(Xowe_wiki cur_wiki, Xoae_page page, Xow_popup_itm popup_itm, Bry_bfr wrdx_bfr) {
   if (output_js_clean) cur_wiki.Html_mgr().Js_cleaner().Clean_bfr(wiki, page.Ttl(), wrdx_bfr, 0);
   if (output_tidy)
     cur_wiki.Html_mgr().Tidy_mgr().Exec_tidy(wrdx_bfr, Bool_.Y, page.Url_bry_safe());
   byte[] hdom_bry = wrdx_bfr.To_bry_and_clear();
   String page_url =
       wrdx_bfr.Add(page.Wiki().Domain_bry())
           .Add(gplx.xowa.htmls.hrefs.Xoh_href_.Bry__wiki)
           .Add(
               gplx.langs.htmls.encoders.Gfo_url_encoder_.Href.Encode(
                   page.Ttl()
                       .Full_db())) // NOTE: was page.Url().Raw(), but that doesn't work for
                                    // Special:Search; PAGE:en.w:Earth and "Quotations";
                                    // DATE:2014-06-29
           .To_str_and_clear();
   fmtr_popup.Bld_bfr_many(
       wrdx_bfr,
       hdom_bry,
       wiki.Lang().Dir_ltr_bry(),
       page_url,
       String_.new_u8(page.Ttl().Full_txt_w_ttl_case()),
       popup_itm.Popup_id(),
       Xow_popup_html_bldr_.Bld_fmtr_wiki(
           fmtr_wiki,
           wrdx_bfr,
           cur_wiki.Domain_bry(),
           page.Wiki().Domain_bry()) // NOTE: use cur_wiki, not page_wiki; DATE:2014-06-28
       ,
       gplx.core.ios.Io_size_.To_str(page.Db().Text().Text_bry().length),
       page.Db().Page().Modified_on().XtoStr_fmt_yyyy_MM_dd_HH_mm_ss(),
       Xow_popup_html_bldr_.Bld_fmtr_viewed(fmtr_viewed, app, wiki, wrdx_bfr, page.Ttl()),
       app.Fsys_mgr().Root_dir().To_http_file_bry());
   return wrdx_bfr.To_bry_and_clear();
 }
class Wdata_fmtr__json implements gplx.core.brys.Bfr_arg {
  private final Bry_bfr tmp_bfr = Bry_bfr_.Reset(255);
  private Xoapi_toggle_itm toggle_itm;
  private Wdata_toc_data toc_data;
  private Json_doc jdoc;

  public void Init_by_ctor(Wdata_toc_data toc_data, Xoapi_toggle_mgr toggle_mgr) {
    this.toc_data = toc_data.Itms_len_enable_n_();
    this.toggle_itm =
        toggle_mgr.Get_or_new("wikidatawiki-json")
            .Html_toggle_hdr_cls_(Bry_.new_a7("overflow:auto;"));
  }

  public void Init_by_lang(Wdata_hwtr_msgs msgs) {
    toc_data.Orig_(msgs.Json_div_hdr());
    toggle_itm.Init_msgs(msgs.Toggle_title_y(), msgs.Toggle_title_n());
  }

  public void Init_by_wdoc(Json_doc jdoc) {
    this.jdoc = jdoc;
    toc_data.Make(0);
  }

  public void Bfr_arg__add(Bry_bfr bfr) {
    if (jdoc == null) return; // TEST: wdoc doesn't have jdoc
    jdoc.Root_nde().Print_as_json(tmp_bfr, 0);
    fmtr.Bld_bfr_many(
        bfr,
        toc_data.Href(),
        toc_data.Text(),
        toggle_itm.Html_toggle_btn(),
        toggle_itm.Html_toggle_hdr(),
        tmp_bfr.To_bry_and_clear());
  }

  private final Bry_fmtr fmtr =
      Bry_fmtr.new_(
          String_.Concat_lines_nl_skip_last(
              "",
              "  <h2 class='wb-section-heading' id='~{hdr_href}'>~{hdr_text}~{toggle_btn}</h2>",
              "  <div class='visualClear'></div>",
              "  <pre~{toggle_hdr}>~{json}",
              "  </pre>",
              "  </div>"),
          "hdr_href",
          "hdr_text",
          "toggle_btn",
          "toggle_hdr",
          "json");
}