"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.validateRedPacketStatusTransition=exports.isRedPacketInNoAnimationFlow=exports.isRedPacketAnimationRunning=exports.isLuckymoneyEnabled=exports.hasUndoAwardCondition=exports.getVisibleRedPacketStatus=exports.getUserStatusByStatus=exports.getRedPacketAnimationMode=exports.getNoAnimationFlowStage=exports.WithdrawStatus=exports.RedPacketType=exports.RedPacketStatus=exports.RedPacketAnimationMode=exports.OpenRedPacketType=exports.NoAnimationFlowStage=exports.LuckyMoneyResult=void 0;var LuckyMoneyResult={ERROR:-1,WIN:1,LOSE:2,UNATTENDED:3,ATTENDED:4};exports.LuckyMoneyResult=LuckyMoneyResult;var WithdrawStatus={INIT:0,ING:1,YES:2,NO:3,CELL:4};exports.WithdrawStatus=WithdrawStatus;var RedPacketStatus={INIT:0,SENT:1,OPENING:2,SUCCESS:3,FAILED:4,RETRACT:5};exports.RedPacketStatus=RedPacketStatus;var OpenRedPacketType={AUTO:0,MANUAL:1};exports.OpenRedPacketType=OpenRedPacketType;var RedPacketType={CASH:0,POINT:1};exports.RedPacketType=RedPacketType;var RedPacketAnimationMode={STANDARD:0,NO_ANIMATION:1};exports.RedPacketAnimationMode=RedPacketAnimationMode;var NoAnimationFlowStage={WAITING_RESULT:"waiting_result",COUNTDOWN:"countdown"};exports.NoAnimationFlowStage=NoAnimationFlowStage;var getRedPacketAnimationMode=function(e){return(null==e?void 0:e.Animation)===RedPacketAnimationMode.NO_ANIMATION?RedPacketAnimationMode.NO_ANIMATION:RedPacketAnimationMode.STANDARD};exports.getRedPacketAnimationMode=getRedPacketAnimationMode;var getUserStatusByStatus=function(e,t){if(void 0===t)return e===RedPacketStatus.INIT?LuckyMoneyResult.UNATTENDED:LuckyMoneyResult.ERROR;switch(t){case LuckyMoneyResult.LOSE:case LuckyMoneyResult.WIN:return RedPacketStatus.FAILED!==e?t:LuckyMoneyResult.ERROR;case LuckyMoneyResult.UNATTENDED:case LuckyMoneyResult.ATTENDED:return RedPacketStatus.INIT!==e?t:LuckyMoneyResult.ERROR;default:return LuckyMoneyResult.ERROR}};exports.getUserStatusByStatus=getUserStatusByStatus;var validateRedPacketStatusTransition=function(e,t){return(e!==RedPacketStatus.SUCCESS&&e!==RedPacketStatus.FAILED||t===RedPacketStatus.RETRACT)&&e!==RedPacketStatus.RETRACT};exports.validateRedPacketStatusTransition=validateRedPacketStatusTransition;var isRedPacketInNoAnimationFlow=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=(null==t?void 0:t.noAnimationFlowMap)||{};return Boolean(e&&a[e])};exports.isRedPacketInNoAnimationFlow=isRedPacketInNoAnimationFlow;var getNoAnimationFlowStage=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=(null==t?void 0:t.noAnimationFlowMap)||{};return e?a[e]:void 0};exports.getNoAnimationFlowStage=getNoAnimationFlowStage;var isRedPacketAnimationRunning=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Boolean((null==e?void 0:e.rainingRedPacketID)||(null==e?void 0:e.activeNoAnimationRevealRedPacketID))};exports.isRedPacketAnimationRunning=isRedPacketAnimationRunning;var getVisibleRedPacketStatus=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=null==e?void 0:e.RedPacketID,n=null==e?void 0:e.RedPacketStatus;return[RedPacketStatus.SUCCESS,RedPacketStatus.FAILED].includes(n)&&((null==t?void 0:t.rainingRedPacketID)===a||isRedPacketInNoAnimationFlow(a,t))||isRedPacketInNoAnimationFlow(a,t)?RedPacketStatus.OPENING:n};exports.getVisibleRedPacketStatus=getVisibleRedPacketStatus;var hasUndoAwardCondition=function(e){return Object.keys(e||{}).some(function(t){return 2===e[t]})};exports.hasUndoAwardCondition=hasUndoAwardCondition;var isLuckymoneyEnabled=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.Feature||e.feature||e.Features||{};return!1!==t.luckymoney&&!1!==t.Luckymoney&&!1!==t.LUCKYMONEY};exports.isLuckymoneyEnabled=isLuckymoneyEnabled;