content: package com.google.android.material.chip;
  
  import android.content.Context;
  import android.graphics.drawable.Drawable;
  import android.util.AttributeSet;
  import android.view.View;
  import android.view.ViewGroup;
  import android.view.accessibility.AccessibilityNodeInfo;
  import androidx.core.view.ViewCompat;
  import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
  import com.google.android.material.R;
  import com.google.android.material.internal.CheckableGroup;
  import com.google.android.material.internal.FlowLayout;
  import java.util.List;
  
  public class ChipGroup extends FlowLayout {
      private static final int DEF_STYLE_RES = R.style.Widget_MaterialComponents_ChipGroup;
      /* access modifiers changed from: private */
      public final CheckableGroup<Chip> checkableGroup;
      private int chipSpacingHorizontal;
      private int chipSpacingVertical;
      private final int defaultCheckedId;
      /* access modifiers changed from: private */
      public OnCheckedStateChangeListener onCheckedStateChangeListener;
      private final PassThroughHierarchyChangeListener passThroughListener;
  
      public static class LayoutParams extends ViewGroup.MarginLayoutParams {
          public LayoutParams(int width, int height) {
              super(width, height);
          }
  
          public LayoutParams(Context context, AttributeSet attrs) {
              super(context, attrs);
          }
  
          public LayoutParams(ViewGroup.LayoutParams source) {
              super(source);
          }
  
          public LayoutParams(ViewGroup.MarginLayoutParams source) {
              super(source);
          }
      }
  
      @Deprecated
      public interface OnCheckedChangeListener {
          void onCheckedChanged(ChipGroup chipGroup, int i);
      }
  
      public interface OnCheckedStateChangeListener {
          void onCheckedChanged(ChipGroup chipGroup, List<Integer> list);
      }
  
      private class PassThroughHierarchyChangeListener implements ViewGroup.OnHierarchyChangeListener {
          /* access modifiers changed from: private */
          public ViewGroup.OnHierarchyChangeListener onHierarchyChangeListener;
  
          private PassThroughHierarchyChangeListener() {
          }
  
          public void onChildViewAdded(View parent, View child) {
              if (parent == ChipGroup.this && (child instanceof Chip)) {
                  if (child.getId() == -1) {
                      child.setId(ViewCompat.generateViewId());
                  }
                  ChipGroup.this.checkableGroup.addCheckable((Chip) child);
              }
              ViewGroup.OnHierarchyChangeListener onHierarchyChangeListener2 = this.onHierarchyChangeListener;
              if (onHierarchyChangeListener2 != null) {
                  onHierarchyChangeListener2.onChildViewAdded(parent, child);
              }
          }
  
          public void onChildViewRemoved(View parent, View child) {
              ChipGroup chipGroup = ChipGroup.this;
              if (parent == chipGroup && (child instanceof Chip)) {
                  chipGroup.checkableGroup.removeCheckable((Chip) child);
              }
              ViewGroup.OnHierarchyChangeListener onHierarchyChangeListener2 = this.onHierarchyChangeListener;
              if (onHierarchyChangeListener2 != null) {
                  onHierarchyChangeListener2.onChildViewRemoved(parent, child);
              }
          }
      }
  
      public ChipGroup(Context context) {
          this(context, (AttributeSet) null);
      }
  
      public ChipGroup(Context context, AttributeSet attrs) {
          this(context, attrs, R.attr.chipGroupStyle);
      }
  
      /* JADX WARNING: Illegal instructions before constructor call */
      /* Code decompiled incorrectly, please refer to instructions dump. */
      public ChipGroup(android.content.Context r10, android.util.AttributeSet r11, int r12) {
          /*
              r9 = this;
              int r4 = DEF_STYLE_RES
              android.content.Context r0 = com.google.android.material.theme.overlay.MaterialThemeOverlay.wrap(r10, r11, r12, r4)
              r9.<init>(r0, r11, r12)
              com.google.android.material.internal.CheckableGroup r6 = new com.google.android.material.internal.CheckableGroup
              r6.<init>()
              r9.checkableGroup = r6
              com.google.android.material.chip.ChipGroup$PassThroughHierarchyChangeListener r7 = new com.google.android.material.chip.ChipGroup$PassThroughHierarchyChangeListener
              r0 = 0
              r7.<init>()
              r9.passThroughListener = r7
              android.content.Context r10 = r9.getContext()
              int[] r2 = com.google.android.material.R.styleable.ChipGroup
              r8 = 0
              int[] r5 = new int[r8]
              r0 = r10
              r1 = r11
              r3 = r12
              android.content.res.TypedArray r0 = com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(r0, r1, r2, r3, r4, r5)
              int r1 = com.google.android.material.R.styleable.ChipGroup_chipSpacing
              int r1 = r0.getDimensionPixelOffset(r1, r8)
              int r2 = com.google.android.material.R.styleable.ChipGroup_chipSpacingHorizontal
              int r2 = r0.getDimensionPixelOffset(r2, r1)
              r9.setChipSpacingHorizontal(r2)
              int r2 = com.google.android.material.R.styleable.ChipGroup_chipSpacingVertical
              int r2 = r0.getDimensionPixelOffset(r2, r1)
              r9.setChipSpacingVertical(r2)
              int r2 = com.google.android.material.R.styleable.ChipGroup_singleLine
              boolean r2 = r0.getBoolean(r2, r8)
              r9.setSingleLine((boolean) r2)
              int r2 = com.google.android.material.R.styleable.ChipGroup_singleSelection
              boolean r2 = r0.getBoolean(r2, r8)
              r9.setSingleSelection((boolean) r2)
              int r2 = com.google.android.material.R.styleable.ChipGroup_selectionRequired
              boolean r2 = r0.getBoolean(r2, r8)
              r9.setSelectionRequired(r2)
              int r2 = com.google.android.material.R.styleable.ChipGroup_checkedChip
              r3 = -1
              int r2 = r0.getResourceId(r2, r3)
              r9.defaultCheckedId = r2
              r0.recycle()
              com.google.android.material.chip.ChipGroup$1 r2 = new com.google.android.material.chip.ChipGroup$1
              r2.<init>()
              r6.setOnCheckedStateChangeListener(r2)
              super.setOnHierarchyChangeListener(r7)
              r2 = 1
              androidx.core.view.ViewCompat.setImportantForAccessibility(r9, r2)
              return
          */
          throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.chip.ChipGroup.<init>(android.content.Context, android.util.AttributeSet, int):void");
      }
  
      private int getChipCount() {
          int i = 0;
          for (int i2 = 0; i2 < getChildCount(); i2++) {
              if (getChildAt(i2) instanceof Chip) {
                  i++;
              }
          }
          return i;
      }
  
      public void check(int id) {
          this.checkableGroup.check(id);
      }
  
      /* access modifiers changed from: protected */
      public boolean checkLayoutParams(ViewGroup.LayoutParams p) {
          return super.checkLayoutParams(p) && (p instanceof LayoutParams);
      }
  
      public void clearCheck() {
          this.checkableGroup.clearCheck();
      }
  
      /* access modifiers changed from: protected */
      public ViewGroup.LayoutParams generateDefaultLayoutParams() {
          return new LayoutParams(-2, -2);
      }
  
      public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs) {
          return new LayoutParams(getContext(), attrs);
      }
  
      /* access modifiers changed from: protected */
      public ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams lp) {
          return new LayoutParams(lp);
      }
  
      public int getCheckedChipId() {
          return this.checkableGroup.getSingleCheckedId();
      }
  
      public List<Integer> getCheckedChipIds() {
          return this.checkableGroup.getCheckedIdsSortedByChildOrder(this);
      }
  
      public int getChipSpacingHorizontal() {
          return this.chipSpacingHorizontal;
      }
  
      public int getChipSpacingVertical() {
          return this.chipSpacingVertical;
      }
  
      /* access modifiers changed from: package-private */
      public int getIndexOfChip(View child) {
          if (!(child instanceof Chip)) {
              return -1;
          }
          int i = 0;
          for (int i2 = 0; i2 < getChildCount(); i2++) {
              if (getChildAt(i2) instanceof Chip) {
                  if (((Chip) getChildAt(i2)) == child) {
                      return i;
                  }
                  i++;
              }
          }
          return -1;
      }
  
      public boolean isSelectionRequired() {
          return this.checkableGroup.isSelectionRequired();
      }
  
      public boolean isSingleLine() {
          return super.isSingleLine();
      }
  
      public boolean isSingleSelection() {
          return this.checkableGroup.isSingleSelection();
      }
  
      /* access modifiers changed from: protected */
      public void onFinishInflate() {
          super.onFinishInflate();
          int i = this.defaultCheckedId;
          if (i != -1) {
              this.checkableGroup.check(i);
          }
      }
  
      public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
          super.onInitializeAccessibilityNodeInfo(info);
          AccessibilityNodeInfoCompat.wrap(info).setCollectionInfo(AccessibilityNodeInfoCompat.CollectionInfoCompat.obtain(getRowCount(), isSingleLine() ? getChipCount() : -1, false, isSingleSelection() ? 1 : 2));
      }
  
      public void setChipSpacing(int chipSpacing) {
          setChipSpacingHorizontal(chipSpacing);
          setChipSpacingVertical(chipSpacing);
      }
  
      public void setChipSpacingHorizontal(int chipSpacingHorizontal2) {
          if (this.chipSpacingHorizontal != chipSpacingHorizontal2) {
              this.chipSpacingHorizontal = chipSpacingHorizontal2;
              setItemSpacing(chipSpacingHorizontal2);
              requestLayout();
          }
      }
  
      public void setChipSpacingHorizontalResource(int id) {
          setChipSpacingHorizontal(getResources().getDimensionPixelOffset(id));
      }
  
      public void setChipSpacingResource(int id) {
          setChipSpacing(getResources().getDimensionPixelOffset(id));
      }
  
      public void setChipSpacingVertical(int chipSpacingVertical2) {
          if (this.chipSpacingVertical != chipSpacingVertical2) {
              this.chipSpacingVertical = chipSpacingVertical2;
              setLineSpacing(chipSpacingVertical2);
              requestLayout();
          }
      }
  
      public void setChipSpacingVerticalResource(int id) {
          setChipSpacingVertical(getResources().getDimensionPixelOffset(id));
      }
  
      @Deprecated
      public void setDividerDrawableHorizontal(Drawable divider) {
          throw new UnsupportedOperationException("Changing divider drawables have no effect. ChipGroup do not use divider drawables as spacing.");
      }
  
      @Deprecated
      public void setDividerDrawableVertical(Drawable divider) {
          throw new UnsupportedOperationException("Changing divider drawables have no effect. ChipGroup do not use divider drawables as spacing.");
      }
  
      @Deprecated
      public void setFlexWrap(int flexWrap) {
          throw new UnsupportedOperationException("Changing flex wrap not allowed. ChipGroup exposes a singleLine attribute instead.");
      }
  
      @Deprecated
      public void setOnCheckedChangeListener(final OnCheckedChangeListener listener) {
          if (listener == null) {
              setOnCheckedStateChangeListener((OnCheckedStateChangeListener) null);
          } else {
              setOnCheckedStateChangeListener(new OnCheckedStateChangeListener() {
                  public void onCheckedChanged(ChipGroup group, List<Integer> list) {
                      if (ChipGroup.this.checkableGroup.isSingleSelection()) {
                          listener.onCheckedChanged(group, ChipGroup.this.getCheckedChipId());
                      }
                  }
              });
          }
      }
  
      public void setOnCheckedStateChangeListener(OnCheckedStateChangeListener listener) {
          this.onCheckedStateChangeListener = listener;
      }
  
      public void setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener listener) {
          ViewGroup.OnHierarchyChangeListener unused = this.passThroughListener.onHierarchyChangeListener = listener;
      }
  
      public void setSelectionRequired(boolean selectionRequired) {
          this.checkableGroup.setSelectionRequired(selectionRequired);
      }
  
      @Deprecated
      public void setShowDividerHorizontal(int dividerMode) {
          throw new UnsupportedOperationException("Changing divider modes has no effect. ChipGroup do not use divider drawables as spacing.");
      }
  
      @Deprecated
      public void setShowDividerVertical(int dividerMode) {
          throw new UnsupportedOperationException("Changing divider modes has no effect. ChipGroup do not use divider drawables as spacing.");
      }
  
      public void setSingleLine(int id) {
          setSingleLine(getResources().getBoolean(id));
      }
  
      public void setSingleLine(boolean singleLine) {
          super.setSingleLine(singleLine);
      }
  
      public void setSingleSelection(int id) {
          setSingleSelection(getResources().getBoolean(id));
      }
  
      public void setSingleSelection(boolean singleSelection) {
          this.checkableGroup.setSingleSelection(singleSelection);
      }
  }
  