package mapped;

import java.io.UnsupportedEncodingException;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

@ObfuscatedName("sv")
public class class474 implements class473 {
   @ObfuscatedName("ah")
   JSONObject field4813;

   public class474(byte[] var1) throws UnsupportedEncodingException {
      this.method8574_base(var1);
   }

   public class474(JSONObject var1) {
      this.field4813 = var1;
   }

   public class474(String var1) throws UnsupportedEncodingException {
      this.method8575_base(var1);
   }

   @ObfuscatedName("at")
   @ObfuscatedSignature(
      descriptor = "(B)Lsi;",
      garbageValue = "-24"
   )
   public class472 vmethod8594_base() {
      return class472.field4810;
   }

   @ObfuscatedName("ah")
   @ObfuscatedSignature(
      descriptor = "(B)[B",
      garbageValue = "0"
   )
   public byte[] vmethod8587_base() throws UnsupportedEncodingException {
      return this.field4813 == null?new byte[0]:this.field4813.toString().getBytes("UTF-8");
   }

   @ObfuscatedName("aa")
   @ObfuscatedSignature(
      descriptor = "([BI)V",
      garbageValue = "-1436694020"
   )
   void method8574_base(byte[] var1) throws UnsupportedEncodingException {
      String var2 = new String(var1, "UTF-8");
      this.method8575_base(var2);
   }

   @ObfuscatedName("ac")
   @ObfuscatedSignature(
      descriptor = "(Ljava/lang/String;I)V",
      garbageValue = "1963139059"
   )
   void method8575_base(String var1) throws UnsupportedEncodingException {
      try {
         if(var1.charAt(0) == '{') {
            this.field4813 = new JSONObject(var1);
         } else {
            if(var1.charAt(0) != '[') {
               throw new UnsupportedEncodingException("Invalid JSON passed to the JSON content builder.");
            }

            JSONArray var2 = new JSONArray(var1);
            this.field4813 = new JSONObject();
            this.field4813.put("arrayValues", var2);
         }
      } catch (JSONException var3) {
         throw new UnsupportedEncodingException(var3.getMessage());
      }

   }

   @ObfuscatedName("al")
   @ObfuscatedSignature(
      descriptor = "(B)Lorg/json/JSONObject;",
      garbageValue = "70"
   )
   public JSONObject method8573_base() {
      return this.field4813;
   }
}
