/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
var i=class{constructor(l){this.hooks=l,this.pendingDeployedSolutionId=null,this._isCancelling=!1,this.handleDeployCancelled=()=>{this.pendingDeployedSolutionId=null,this.hooks.onDeployCancelled?.()},this.handleDeployFailed=o=>{if(this.pendingDeployedSolutionId=null,this._isCancelling){this.closeDialogs();return}this.hooks.onDeployFailedReal?.(o.detail?.error),this.closeDialogs(!0)},this.handleDeploySuccess=o=>{this.pendingDeployedSolutionId=o?.detail||null;let e=this.hooks.deployingDialogRef.value;e&&(e.isWaitingForCard=!0,e.deploymentProgress=100),this.hooks.onDeploySuccess?.(o?.detail||"")},this.deployProgressStart=o=>{let e=this.hooks.deployingDialogRef.value;e&&(e.card=this.hooks.getCard(),e.abortController=o.detail,e.deploymentProgress=0,e.isWaitingForCard=!1,e.open=!0),this.hooks.deployDialogRef.value&&this.hooks.deployDialogRef.value.classList.add("display-none"),this.hooks.onDeployStarted?.(o.detail)},this.deployProgressUpdated=o=>{let e=this.hooks.deployingDialogRef.value;e&&(e.deploymentProgress=o.detail.progress)},this.handleDeploymentProcessCancelled=()=>{this.pendingDeployedSolutionId=null,this._isCancelling=!0,this.hooks.onDeploymentProcessCancelled?.()},this.handleDeployedCardReady=async o=>{!this.pendingDeployedSolutionId||o.detail?.card?.id!==this.pendingDeployedSolutionId||(this.pendingDeployedSolutionId=null,this.closeDialogs(),await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))),this.hooks.onDeployedCardReady?.(o.detail))},this.handleDeploymentFallback=o=>{!this.pendingDeployedSolutionId||o.detail?.solutionId!==this.pendingDeployedSolutionId||(this.pendingDeployedSolutionId=null,this.closeDialogs(),this.hooks.onDeploymentFallback?.(o.detail))}}closeDialogs(l=!1){this._isCancelling&&(this.hooks.onCloseAfterCancel?.(),this._isCancelling=!1),this.hooks.deployingDialogRef.value&&this.hooks.deployingDialogRef.value.close();let o=this.hooks.deployDialogRef.value;o&&(o.classList.remove("display-none"),l?o.open=!0:o.close(!1))}};export{i as a};
