// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/dijit/geoenrichment/ReportPlayer/playerSupports/_CommandSupport","dojo/_base/declare dojo/_base/lang dojo/Deferred dojo/when dojo/on dojo/dom-class dojo/dom-construct esri/dijit/geoenrichment/utils/DomUtil esri/dijit/geoenrichment/utils/TooltipUtil esri/dijit/geoenrichment/ReportPlayer/dataProviders/commands/supportClasses/PlayerCommands dojo/i18n!../../../../nls/jsapi".split(" "),function(m,n,h,f,p,q,l,t,r,e,g){g=g.geoenrichment.dijit.ReportPlayer.ReportPlayer;return m(null,{_lastNonPrintCommandId:null,
_executeExportCallback:null,_executePrintCallback:null,postCreate:function(){this.inherited(arguments);this._initCommands()},_initCommands:function(){var a=this;f(this.dataProvider.getCommands&&this.dataProvider.getCommands(),function(b){a._createCommandButtons(b)})},_createCommandButtons:function(a){function b(a){var b=new h,d=new h;c.onCommandSettingsShown(b.promise);f(c._getPrintableContainer({commandId:a,showDialog:!0}),function(a){if(a){var b=a.getSelectedCommandId();b&&b!==e.PRINT&&(c._lastNonPrintCommandId=
b);f(c._executeCommand(b,{printableContainer:a}),d.resolve,d.reject)}else c.onCommandCanceled(),d.resolve()}).always(b.resolve);return d.promise}var c=this;if(a&&a.length){var d,k=a.filter(function(a){return a.id===e.PRINT?(d=a,!1):!0});k.length&&(this._executeExportCallback=function(){return b(c._lastNonPrintCommandId||k[0].id)},this._createCommandButton(k[0],this._executeExportCallback));d&&(this._executePrintCallback=function(){return b(d.id)},this._createCommandButton(d,this._executePrintCallback))}},
executeExport:function(){return this._executeExportCallback&&this._executeExportCallback()},executePrint:function(){return this._executePrintCallback&&this._executePrintCallback()},_createCommandButton:function(a,b){var c=l.create("div",{"class":"reportPlayer_commandButtonContainer dijitInline"},this.commandButtonsContainer),c=l.create("div",{"class":"reportPlayer_commandButton"},c);q.add(c,a.id===e.PRINT?"playerPrintButton":"playerExportButton");r.setTooltipToNode(c,a.id===e.PRINT?g.printInfographic:
g.exportInfographic);p(c,"click",b);return c},_executeCommand:function(a,b){var c=this;a!==e.PDF&&a!==e.DYNAMIC_HTML||!this._viewModel.dynamicReportInfo.fieldData.runReportTaskID||(b.creditsTaskID=this._viewModel.dynamicReportInfo.fieldData.runReportTaskID);var d=new h;setTimeout(function(){f(c.dataProvider.executeCommand&&c.dataProvider.executeCommand(a,c,b,function(a){c.onCommandProgress(a)}),d.resolve,d.reject)});this.onCommandStart(d.promise,a);this._showWaiting(d.promise);d.promise.always(function(){c.onCommandEnd()});
return d.promise},executeCommand:function(a,b){var c=this;return f(this._getPrintableContainer({commandId:a,showDialog:!1,printSettings:b&&b.printSettings}),function(d){return c._executeCommand(a,n.mixin({printableContainer:d},b))})},onCommandSettingsShown:function(a){},onCommandCanceled:function(){},onCommandStart:function(a,b){},onCommandProgress:function(a){},onCommandEnd:function(){}})});