forked from Juby210/discord-jadx
67 lines
4.4 KiB
Java
67 lines
4.4 KiB
Java
package com.discord.widgets.botuikit;
|
|
|
|
import c0.t.k;
|
|
import c0.z.d.m;
|
|
import c0.z.d.o;
|
|
import com.discord.api.botuikit.ActionComponent;
|
|
import com.discord.api.botuikit.Component;
|
|
import com.discord.api.botuikit.LayoutComponent;
|
|
import com.discord.models.botuikit.MessageComponent;
|
|
import com.discord.widgets.botuikit.ComponentChatListState;
|
|
import com.discord.widgets.botuikit.ComponentStateMapper;
|
|
import java.util.Stack;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function2;
|
|
import kotlin.jvm.internal.Ref$ObjectRef;
|
|
/* compiled from: ComponentStateMapper.kt */
|
|
public final class ComponentStateMapper$processComponentsToMessageComponents$1 extends o implements Function2<Integer, Component, Unit> {
|
|
public final /* synthetic */ Stack $childComponentsLevelStack;
|
|
public final /* synthetic */ Ref$ObjectRef $childrenComponents;
|
|
public final /* synthetic */ ComponentExperiments $componentExperiments;
|
|
public final /* synthetic */ ComponentChatListState.ComponentStoreState $componentState;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public ComponentStateMapper$processComponentsToMessageComponents$1(ComponentChatListState.ComponentStoreState componentStoreState, ComponentExperiments componentExperiments, Ref$ObjectRef ref$ObjectRef, Stack stack) {
|
|
super(2);
|
|
this.$componentState = componentStoreState;
|
|
this.$componentExperiments = componentExperiments;
|
|
this.$childrenComponents = ref$ObjectRef;
|
|
this.$childComponentsLevelStack = stack;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function2
|
|
public /* bridge */ /* synthetic */ Unit invoke(Integer num, Component component) {
|
|
invoke(num.intValue(), component);
|
|
return Unit.a;
|
|
}
|
|
|
|
/* JADX WARNING: Unknown variable types count: 2 */
|
|
public final void invoke(int i, Component component) {
|
|
LayoutComponent parentLayoutComponent;
|
|
m.checkNotNullParameter(component, "component");
|
|
if (component instanceof ActionComponent) {
|
|
MessageComponent createActionMessageComponent = ComponentStateMapper.INSTANCE.createActionMessageComponent((ActionComponent) component, i, this.$componentState, this.$componentExperiments);
|
|
if (createActionMessageComponent != null) {
|
|
this.$childrenComponents.element.getComponents()[this.$childrenComponents.element.getCurrentComponentInsertionIndex()] = createActionMessageComponent;
|
|
}
|
|
ComponentStateMapper.ChildComponents childComponents = this.$childrenComponents.element;
|
|
childComponents.setCurrentComponentInsertionIndex(childComponents.getCurrentComponentInsertionIndex() + 1);
|
|
} else if (component instanceof LayoutComponent) {
|
|
this.$childComponentsLevelStack.push(this.$childrenComponents.element);
|
|
LayoutComponent layoutComponent = (LayoutComponent) component;
|
|
this.$childrenComponents.element = new ComponentStateMapper.ChildComponents(i, layoutComponent, 0, layoutComponent.a().size(), 4, null);
|
|
}
|
|
while (this.$childrenComponents.element.getCurrentComponentInsertionIndex() == this.$childrenComponents.element.getTotal() && (parentLayoutComponent = this.$childrenComponents.element.getParentLayoutComponent()) != null) {
|
|
MessageComponent messageLayoutComponent = ComponentStateMapper.INSTANCE.toMessageLayoutComponent(parentLayoutComponent, this.$childrenComponents.element.getLayoutComponentIndex(), k.filterNotNull(this.$childrenComponents.element.getComponents()), this.$componentExperiments);
|
|
Ref$ObjectRef ref$ObjectRef = this.$childrenComponents;
|
|
Object pop = this.$childComponentsLevelStack.pop();
|
|
m.checkNotNullExpressionValue(pop, "childComponentsLevelStack.pop()");
|
|
ref$ObjectRef.element = (ComponentStateMapper.ChildComponents) pop;
|
|
this.$childrenComponents.element.getComponents()[this.$childrenComponents.element.getCurrentComponentInsertionIndex()] = messageLayoutComponent;
|
|
ComponentStateMapper.ChildComponents childComponents2 = this.$childrenComponents.element;
|
|
childComponents2.setCurrentComponentInsertionIndex(childComponents2.getCurrentComponentInsertionIndex() + 1);
|
|
}
|
|
}
|
|
}
|