/**
* IBM Confidential OCO Source Materials IBM Business Platform: CA Reporting
* (C) Copyright IBM Corp. 2018
*
* The source code for this program is not published or otherwise divested of
* its trade secrets, irrespective of what has been deposited with the U.S.
* Copyright Office
*/
define("bi/authoring/nls/AuthoringMessages",{root:!0,cs:!0,cy:!0,da:!0,de:!0,es:!0,fi:!0,fr:!0,gl:!0,hr:!0,hu:!0,it:!0,ja:!0,kk:!0,ko:!0,nb:!0,nl:!0,no:!0,pl:!0,pt:!0,"pt-br":!0,ro:!0,ru:!0,sl:!0,sv:!0,th:!0,tr:!0,zh:!0,"zh-cn":!0,"zh-tw":!0}),define("bi/authoring/nls/root/AuthoringMessages",{no_output_format_capability:"The user does not have the assigned capability to generate %{outputFormat} output.",authoring_welcome:"Reporting",report_view_of:"Report view of %{reportName}",no_action_available:"You are currently not authorized to access this object.",viewer_welcome:"Reporting",dataset_welcome:"Data set",powerplay_view_of:"PowerPlay view of %{reportName}"}),define("bi/authoring/nls/StringResource",["i18n!bi/authoring/nls/AuthoringMessages","bi/glass/utils/Lexicon"],function(localeResources,Lexicon){"use strict";var lexicon=new Lexicon({data:localeResources,verbose:!0}),StringResources=function(){};return StringResources.prototype.get=function(key,interpolationOptions){return lexicon.translate(key,interpolationOptions)},new StringResources}),define("bi/authoring/utils/pat/rsPromptParameters",[],function(){"use strict";function xmlEncode(v_sString){return v_sString.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")}function addClassicViewerPrompts(v_elForm,v_aPromptParameters){for(var i=0;i"}function buildBoundRangeXML(v_oValue){return'"}function buildUnboundedEndRangeXML(v_oValue){return'"}function buildUnboundedStartRangeXML(v_oValue){return'"}function convertPromptValuesToXML(v_aValues){for(var v_sXMLValues="",i=0;i"+v_sXMLValues+"";var v_elInput=v_elForm.appendChild(document.createElement("input"));v_elInput.type="hidden",v_elInput.name="p_"+v_sName,v_elInput.value=v_sXMLValues}}function valueToSimpleJson(v_oValue){switch(v_oValue.type){case"simpleParmValueItem":delete v_oValue.type,delete v_oValue.inclusive;break;case"boundRangeParmValueItem":v_oValue={boundRange:{start:v_oValue.start,end:v_oValue.end}};break;case"unboundedStartRangeParmValueItem":v_oValue={unboundedStartRange:{end:v_oValue.end}};break;case"unboundedEndRangeParmValueItem":v_oValue={unboundedEndRange:{start:v_oValue.start}}}return v_oValue}function groupPromptParamters(v_oPromptParameters,v_oPromptParametersComplex){var v_aPromptParametersComplex;if("string"==typeof v_oPromptParametersComplex)try{v_oPromptParametersComplex=JSON.parse(v_oPromptParametersComplex)}catch(e){return void console.log("rsPromptParameters.groupPromptParamters ... invalid promptParameters input : "+v_oPromptParametersComplex)}v_oPromptParameters||(v_oPromptParameters={}),v_oPromptParametersComplex&&(Array.isArray(v_oPromptParametersComplex)?v_aPromptParametersComplex=v_oPromptParametersComplex:"string"==typeof v_oPromptParametersComplex.name?v_aPromptParametersComplex=[v_oPromptParametersComplex]:Object.keys(v_oPromptParametersComplex).forEach(function(key){v_oPromptParameters[key]=v_oPromptParametersComplex[key]}));for(var i=0;v_aPromptParametersComplex&&i'):(v_aValue.push(">"),v_aValue.push(xmlEncode(v_oValue.toString())),v_aValue.push(""))),v_aValue.join("")}function emitUseDisplay(v_oValue){return emitValue("use",v_oValue.use)+emitValue("display",v_oValue.display)}function buildSimpleParmValue(v_oValue){return'- true'+emitUseDisplay(v_oValue)+"
"}function buildBoundRangeParmValue(v_oValue){return'- truetrue'+emitUseDisplay(v_oValue.boundRange.start)+'true'+emitUseDisplay(v_oValue.boundRange.end)+"
"}function buildUnboundedEndRangeParmValue(v_oValue){return'- truetrue'+emitUseDisplay(v_oValue.unboundedEndRange.start)+"
"}function buildUnboundedStartRangeParmValue(v_oValue){return'- truetrue'+emitUseDisplay(v_oValue.unboundedStartRange.end)+"
"}function buildBusParameterValues(v_oPromptParameters,v_oPromptParametersComplex,v_sParamsTagName){var v_sParameterValues="',v_oPromptParameters=groupPromptParamters(v_oPromptParameters,v_oPromptParametersComplex);for(var v_sName in v_oPromptParameters)if(v_oPromptParameters.hasOwnProperty(v_sName)){v_sParameterValues+='- ',v_sParameterValues+=''+xmlEncode(v_sName)+"",v_sParameterValues+='';for(var v_aCurParams=v_oPromptParameters[v_sName],v_iCurParamsLen=v_aCurParams.length,i=0;v_iCurParamsLen>i;i++){var v_oValue=v_aCurParams[i];v_oValue.hasOwnProperty("use")?v_sParameterValues+=buildSimpleParmValue(v_oValue):v_oValue.hasOwnProperty("boundRange")?v_sParameterValues+=buildBoundRangeParmValue(v_oValue):v_oValue.hasOwnProperty("unboundedEndRange")?v_sParameterValues+=buildUnboundedEndRangeParmValue(v_oValue):v_oValue.hasOwnProperty("unboundedStartRange")&&(v_sParameterValues+=buildUnboundedStartRangeParmValue(v_oValue))}v_sParameterValues+="",v_sParameterValues+="
"}return v_sParameterValues+=""}function convertValueToBoundedRangeFormat(v_oValue){v_oValue.boundRange={start:{use:v_oValue.start.use,display:v_oValue.start.display},end:{use:v_oValue.end.use,display:v_oValue.end.display}},delete v_oValue.start,delete v_oValue.end}function convertValueToUnboundedStartRangeFormat(v_oValue){v_oValue.unboundedStartRange={end:{use:v_oValue.end.use,display:v_oValue.end.display}},delete v_oValue.end}function convertValueToUnboundedEndRangeFormat(v_oValue){v_oValue.unboundedEndRange={start:{use:v_oValue.start.use,display:v_oValue.start.display}},delete v_oValue.start}return{cvAddPromptParameters:function(v_elForm,v_aPromptParameters,v_aPromptParametersComplex){console.log("rsPromptParameters.cvAddPromptParameters ..."),addClassicViewerPrompts(v_elForm,v_aPromptParameters),addClassicViewerPromptsComplex(v_elForm,v_aPromptParametersComplex)},rsBuildPromptParameters:function(v_oPromptParameters,v_oPromptParametersComplex,v_sParamsTagName){return v_oPromptParameters||v_oPromptParametersComplex?buildBusParameterValues(v_oPromptParameters,v_oPromptParametersComplex,v_sParamsTagName):""},rsBuildParameterUrl:function(v_oUrlMap,v_oPromptParameters){var v_aPromptParameters=Array.isArray(v_oPromptParameters)?v_oPromptParameters:[v_oPromptParameters];v_aPromptParameters.forEach(function(v_oPara){if("undefined"!=typeof v_oPara){var v_aValues=Array.isArray(v_oPara.value)?v_oPara.value:[v_oPara.value];v_aValues.forEach(function(v_oValue){switch(v_oValue.type){case"boundRangeParmValueItem":convertValueToBoundedRangeFormat(v_oValue);break;case"unboundedStartRangeParmValueItem":convertValueToUnboundedStartRangeFormat(v_oValue);break;case"unboundedEndRangeParmValueItem":convertValueToUnboundedEndRangeFormat(v_oValue)}delete v_oValue.type,delete v_oValue.inclusive})}}),v_oUrlMap.promptParameters=v_oPromptParameters?JSON.stringify(v_aPromptParameters):null},convertParameterArrayToObject:function(v_aParameters){var v_oParameters={};return v_aParameters&&v_aParameters.length>0&&v_aParameters.forEach(function(v_oParameter){v_oParameter&&v_oParameter.name&&(v_oParameters[v_oParameter.name]=v_oParameter.value)}),v_oParameters}}}),define("bi/authoring/utils/rsCommon",["jquery","q","doT","bi/commons/utils/Utils","bi/authoring/utils/pat/rsPromptParameters"],function($,Q,dot,Utils,rsPromptParameters){"use strict";function findPromptParameters(options){var v_oPromptParameters;for(var v_sKey in options)if(options.hasOwnProperty(v_sKey)&&v_sKey.length>2&&0==v_sKey.indexOf("p_")&&options[v_sKey]){var v_sName=v_sKey.substring(2);v_oPromptParameters||(v_oPromptParameters={}),v_oPromptParameters[v_sName]||(v_oPromptParameters[v_sName]=[]);for(var v_aOptions=Array.isArray(options[v_sKey])?options[v_sKey]:[options[v_sKey]],i=0;i/g,">").replace(/'/g,"'").replace(/"/g,""")},decodeAndMoveCMProperties:function(options){if(options&&options.cmPropStr&&!options.cmProperties){var v_oCmProperties;try{v_oCmProperties=JSON.parse(options.cmPropStr)}catch(e){v_oCmProperties=null}v_oCmProperties&&(options.cmProperties=v_oCmProperties)}if(delete options.cmPropStr,options&&options.reportPropStr&&!options.reportProperties){var v_oReportProperties;try{v_oReportProperties=JSON.parse(options.reportPropStr)}catch(e){v_oReportProperties=null}v_oReportProperties&&(options.reportProperties=v_oReportProperties)}delete options.reportPropStr},decodeAndMoveRSOptions:function(options){if(options&&options.rsEncodedOptions){var v_oRsOptions=JSON.parse(options.rsEncodedOptions);Object.keys(v_oRsOptions).forEach(function(v_sKey){options[v_sKey]=v_oRsOptions[v_sKey]}),delete options.rsEncodedOptions}},M_aConvertList:["isViewer","isNew","isApplication","a11y","bidi","runInAdvancedViewer","prompt","rsFinalRunOptions","promptParameters","ui_appbar","ui_navbar"],convertStringQSToValues:function(options,glassContext,trimURLParameterValues){var v_bStringOnlyQS=glassContext.getCoreSvc(".FeatureChecker").checkValue("ba-glass","stringOnlyQS","enabled");if(v_bStringOnlyQS)for(var propertyName in options)if(options[propertyName])if(-1!=this.M_aConvertList.indexOf(propertyName)){if("object"==typeof options[propertyName])this.convertStringQSToValues(options[propertyName],glassContext);else if("string"==typeof options[propertyName])if("true"===options[propertyName])options[propertyName]=!0;else if("false"===options[propertyName])options[propertyName]=!1;else{var v_numberValue=Number(options[propertyName]);options[propertyName]=isNaN(v_numberValue)?options[propertyName]:v_numberValue}}else 0==propertyName.indexOf("p_")&&trimURLParameterValues===!0&&(options[propertyName]=options[propertyName].trim())},getAvailableOutputs:function(glassContext,v_oOutputProperties){return glassContext.getSvc(".Content").then(function(v_oContentSvc){var v_sCMQueryUrl=v_oContentSvc.getBaseObjectsURL()+"/"+v_oOutputProperties.parent[0].id+"/outputs?fields=dataDescriptor,parent,locale,format,permissions,ancestors,lastPage";return v_oContentSvc.get(v_sCMQueryUrl,{})})},getContent:function(options,v_oContentView,rsShareHelper){var v_oCmProperties,v_bOnlyBookmarkContent=options&&"bookmark"==options.mode,v_oReturn={};if(v_oContentView.cmProperties){if(v_oReturn=rsShareHelper.buildShareUrlMap(v_oContentView),v_oCmProperties={id:v_oContentView.cmProperties.id,type:v_oContentView.cmProperties.type,defaultName:v_oContentView.cmProperties.defaultName,permissions:v_oContentView.cmProperties.permissions},"output"==v_oContentView.cmProperties.type){if(v_oContentView.cmProperties.ancestors){var v_sReportName=v_oContentView.cmProperties.ancestors[v_oContentView.cmProperties.ancestors.length-2].defaultName;v_oCmProperties.defaultName=v_sReportName+" - "+v_oContentView.cmProperties.modificationTime.substring(0,10)+" - "+v_oContentView.cmProperties.format}v_oCmProperties.modificationTime=v_oContentView.cmProperties.modificationTime,v_oCmProperties.format=v_oContentView.cmProperties.format,v_oContentView.cmProperties.parent&&v_oContentView.cmProperties.parent.length>0&&(v_oCmProperties.parent=[{id:v_oContentView.cmProperties.parent[0].id,type:v_oContentView.cmProperties.parent[0].type}]),v_oContentView.reportProperties&&(v_oReturn.reportPropStr=JSON.stringify({id:v_oContentView.reportProperties.id,type:v_oContentView.reportProperties.type,defaultName:v_oContentView.reportProperties.defaultName})),v_oReturn.type="output",delete v_oReturn.objRef}v_oReturn.cmPropStr=JSON.stringify(v_oCmProperties)}return v_oContentView.id&&(v_oReturn.id=v_oContentView.id),v_bOnlyBookmarkContent?delete v_oReturn.promptParameters:v_oReturn.application=v_oContentView.getApplicationContent(v_oReturn,v_oCmProperties),v_oReturn}}}),define("bi/authoring/utils/rsIFrameManager",["jquery","q","bi/authoring/utils/rsCommon"],function($,Q,rsCommon){"use strict";function isMyParentTheTopWindow(w){try{return Boolean(w.parent==w.top)}catch(e){return!1}}var rsIFrameManager={};return rsIFrameManager.m_iNewFrameId=1,rsIFrameManager.F_LaunchRS=function(v_oParameters,v_oGlassContext,v_oLaunchParameters){console.info("rsperf: rsIFrameManager.F_LaunchRS ..."),this.m_oLaunchParameters=v_oLaunchParameters?v_oLaunchParameters:null;var v_bPrelaunchTest=!1;if(v_bPrelaunchTest&&this.F_PreLaunch(v_oGlassContext),this.m_oPrelaunchRSPromise&&"datasets"!==v_oGlassContext.currentAppView.currentContentView.perspective){console.time("rsIFrameManager.F_LaunchRS->f_relaunchRSIFrameInView");var v_oIFramePromise=this.m_oPrelaunchRSPromise;if(this.m_oPrelaunchRSPromise=null,console.time("rsperf: Waiting for RS relaunch"),v_oIFramePromise.isFulfilled())return this.f_relaunchRSIFrameInView(v_oParameters,v_oLaunchParameters,v_oIFramePromise.inspect().value);var v_oRelaunchDeferred=Q.defer();return v_oIFramePromise.then(this.f_relaunchRSIFrameInView.bind(this,v_oParameters,v_oLaunchParameters)).done(function(v_idIFrameAuthoring){v_oRelaunchDeferred.resolve(v_idIFrameAuthoring)}),v_oRelaunchDeferred.promise}console.time("rsperf: Launch RS->OnRSApplicationReadyForObservers");var v_oLaunchDeferred=Q.defer();return this.f_launchRS(v_oGlassContext,v_oParameters,this.f_onLaunchReadyForObservers.bind(this,v_oGlassContext,v_oLaunchDeferred),v_oLaunchDeferred.reject.bind(v_oLaunchDeferred,new Error("rsIFrameManager: error during f_launchRS"))),v_oLaunchDeferred.promise},rsIFrameManager.f_relaunchRSIFrameInView=function(v_oParameters,v_oLaunchParameters,v_iframeAuthoring){console.timeEnd("rsIFrameManager.F_LaunchRS->f_relaunchRSIFrameInView");var v_oIFrameLaunchedDeferred=Q.defer();console.timeEnd("rsperf: Waiting for RS relaunch"),console.time("rsperf: Launch from prelaunch RS->OnRSApplicationReadyForObservers"),v_iframeAuthoring.OnRSApplicationReadyForObservers=function(){v_oIFrameLaunchedDeferred.resolve(v_iframeAuthoring.id),console.timeEnd("rsperf: Launch from prelaunch RS->OnRSApplicationReadyForObservers")}.bind(this);var v_oRsParameters=JSON.parse(v_oParameters.rsParameters);return v_iframeAuthoring.contentWindow.Application.Relaunch(v_oRsParameters,v_oLaunchParameters),v_oIFrameLaunchedDeferred.promise},rsIFrameManager.f_getBodyRect=function(el){var v_elScrollable=document.documentElement,v_oRect=el.getBoundingClientRect(),v_oBodyRect=document.body.getBoundingClientRect();return{top:v_oRect.top-v_oBodyRect.top+(v_elScrollable.scrollTop?v_elScrollable.scrollTop:0),left:v_oRect.left-v_oBodyRect.left+(v_elScrollable.scrollLeft?v_elScrollable.scrollLeft:0),width:v_oRect.width,height:v_oRect.height}},rsIFrameManager.F_PositionAndSizeIFrame=function($elContainer,v_iframeAuthoring){function f_getZIndex(v_el){for(var v_elCur=v_el;v_elCur&&"#document"!=v_elCur.nodeName;){var v_oStyle=v_elCur.ownerDocument.defaultView.getComputedStyle(v_elCur,null),v_iValue=parseInt(v_oStyle.zIndex,10);if(!isNaN(v_iValue)&&0!==v_iValue)return v_iValue;v_elCur=v_elCur.parentNode}return 0}var v_oRect=this.f_getBodyRect($elContainer.get(0));v_iframeAuthoring.style.top=v_oRect.top+"px",v_iframeAuthoring.style.left=v_oRect.left+"px",v_iframeAuthoring.style.width=v_oRect.width+"px",v_iframeAuthoring.style.height=v_oRect.height+"px",v_iframeAuthoring.style.zIndex=f_getZIndex($elContainer.get(0))+1,v_iframeAuthoring.style.visibility="visible"},rsIFrameManager.F_HideIFrame=function(v_iframeAuthoring){v_iframeAuthoring.style.top="-5000px",v_iframeAuthoring.style.left="-5000px",v_iframeAuthoring.style.zIndex=-1,v_iframeAuthoring.style.visibility="hidden"},rsIFrameManager.F_DetachIFrame=function(v_iframeAuthoring){var v_oApplication=v_iframeAuthoring.contentWindow.Application;v_oApplication&&v_oApplication.DetachFromGlass(),this.m_divRSFrameHolder.removeChild(v_iframeAuthoring)},rsIFrameManager.f_createRSIFrame=function(v_oParameters){var v_aHTML=[];return v_aHTML.push(''),v_aHTML.join("")},rsIFrameManager.f_onLaunchReadyForObservers=function(v_oGlassContext,v_oDeferred,v_iframeAuthoring){console.timeEnd("rsperf: Launch RS->OnRSApplicationReadyForObservers");var v_oApplication=v_iframeAuthoring.contentWindow.Application;v_oApplication.GlassContext=v_oGlassContext,
v_oApplication.LaunchParameters=this.m_oLaunchParameters,v_oDeferred.resolve(v_iframeAuthoring.id)},rsIFrameManager.f_HTMLEncode=function(s){return s.replace(/&/g,"&").replace(//g,">")},rsIFrameManager.f_HTMLAttributeEncode=function(s){return this.f_HTMLEncode(s).replace(/'/g,"'").replace(/"/g,""")},rsIFrameManager.f_prelaunchRS=function(v_oGlassContext,v_fnOnLaunched,v_fnOnLaunchError){console.time("rsperf: prelaunch RS");var v_oRsParameters=rsCommon.createRSParameters({},v_oGlassContext);v_oRsParameters.prelaunchRS=!0,this.f_launchRS(v_oGlassContext,rsCommon.createTemplateParameters(v_oRsParameters),this.f_onPrelaunchRSReadyForObservers.bind(this,v_oGlassContext,v_fnOnLaunched),v_fnOnLaunchError)},rsIFrameManager.f_launchRS=function(v_oGlassContext,v_oParameters,v_fnOnLaunched,v_fnOnLaunchError){this.m_divRSFrameHolder||($("body").prepend(''),this.m_divRSFrameHolder=$("body").find("div").get(0));var $divRSFrameHolder=$(this.m_divRSFrameHolder);$divRSFrameHolder.prepend(this.f_createRSIFrame(v_oParameters));var v_iframeAuthoring=$divRSFrameHolder.find("iframe").get(0);v_iframeAuthoring.id="rsIFrameManager_"+this.m_iNewFrameId++,v_iframeAuthoring.OnRSApplicationReadyForObservers=v_fnOnLaunched.bind(null,v_iframeAuthoring),v_iframeAuthoring.onerror=v_fnOnLaunchError},rsIFrameManager.f_onPrelaunchRSReadyForObservers=function(v_oGlassContext,v_fnOnLaunched,v_iframeAuthoring){var v_oApplication=v_iframeAuthoring.contentWindow.Application;v_oApplication.GlassContext=v_oGlassContext,v_oApplication.LaunchParameters=this.m_oLaunchParameters,v_oApplication.SharedState.Get("isAppLoaded")?this.f_onPrelaunchAppLoaded(v_iframeAuthoring,v_fnOnLaunched):v_oApplication.SharedState.AddObserver("rsIFrameManager","isAppLoaded",this.f_onPrelaunchAppLoaded.bind(this,v_iframeAuthoring,v_fnOnLaunched,!0))},rsIFrameManager.f_onPrelaunchAppLoaded=function(v_iframeAuthoring,v_fnOnLaunched,v_bRemoveObserver){if(console.timeEnd("rsperf: prelaunch RS"),v_bRemoveObserver){var v_oApplication=v_iframeAuthoring.contentWindow.Application;v_oApplication.SharedState.RemoveObserver("rsIFrameManager","isAppLoaded")}setTimeout(v_fnOnLaunched.bind(null,v_iframeAuthoring),0)},rsIFrameManager.F_PreLaunch=function(v_oGlassContext){if(!this.m_oPrelaunchRSPromise){var v_oDefer=Q.defer();this.m_oPrelaunchRSPromise=v_oDefer.promise,this.f_prelaunchRS(v_oGlassContext,function(v_idIFrameAuthoring){v_oDefer.resolve(v_idIFrameAuthoring)}.bind(this),v_oDefer.resolve.bind(v_oDefer,null))}},rsIFrameManager}),define("text!bi/authoring/res/DatasetList.xml",[],function(){return'\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n \n \n\n'}),define("bi/authoring/utils/pat/rsLaunchParameters",["jquery","text!bi/authoring/res/DatasetList.xml"],function($,datasetList){var getOpenerLaunchParameters=function(v_bParent){var v_oOpenerLaunchParameters;try{v_oOpenerLaunchParameters=v_bParent?window.opener.parent.require("bi/authoring/utils/pat/rsLaunchParameters"):window.opener.require("bi/authoring/utils/pat/rsLaunchParameters")}catch(e){}return v_oOpenerLaunchParameters},rsLaunchParameters={m_oParameterMap:{},m_oTemplates:{DatasetList:datasetList}};return rsLaunchParameters.GetTemplate=function(v_sTemplate){return this.m_oTemplates[v_sTemplate]},rsLaunchParameters.Store=function(v_oData,v_bJSONEncode,v_bUseParent){var v_sKey=(v_bUseParent?"-":"")+Date.now().toString();if(v_bJSONEncode){var v_oAdd=new Map,v_aRemove=[];Object.keys(v_oData).forEach(function(key){"object"!=typeof v_oData[key]||void 0==v_oData[key]||"function"==typeof v_oData[key].toString&&v_oData[key].toString().indexOf("Window")>=0||(v_oAdd.set("JSON_"+key,JSON.stringify(v_oData[key])),v_aRemove.push(key))});for(var idx=0;idx=0&&(v_oNonExtendable[p]=v_oReturn[p],delete v_oReturn[p]);try{v_oReturn=$.extend(!0,{},v_oReturn)}catch(e){console.log("rsLaunchParameters.Retrieve failed to extend launch parameters")}for(var p in v_oNonExtendable)v_oReturn[p]=v_oNonExtendable[p];var v_oParsed={};for(var p in v_oReturn)if(0==p.indexOf("JSON_")&&v_oReturn.hasOwnProperty(p)){var v_sP=p.slice(5);v_oParsed[v_sP]=JSON.parse(v_oReturn[p])}for(var p in v_oParsed)v_oParsed.hasOwnProperty(p)&&(v_oReturn[p]=v_oParsed[p],delete v_oReturn["JSON_"+p])}delete v_oOpenerLaunchParameters.m_oParameterMap[v_sKey]}}return v_oReturn},rsLaunchParameters}),define("bi/authoring/utils/rsOpenHelper",["jquery","q","bi/authoring/utils/rsIFrameManager","bi/authoring/utils/rsCommon","bi/authoring/nls/StringResource","bi/commons/utils/LegacyUtils","bi/authoring/utils/pat/rsLaunchParameters","bi/authoring/utils/pat/rsPromptParameters"],function($,Q,rsIFrameManager,rsCommon,StringResource,LegacyUtils,rsLaunchParameters,rsPromptParameters){"use strict";function getLegacyUtils(){return legacyUtils||(legacyUtils=LegacyUtils,legacyUtils.getLegacyLaunchUrl||(legacyUtils.getLegacyLaunchUrl=function(glassContext,tool,object,action){var qParms=this._getLaunchParms(glassContext,tool,object);return qParms["ui.action"]=action,this._getUrl(qParms)}.bind(LegacyUtils))),legacyUtils}function getLegacyLaunchUrl(oOpenSpec){var tool="query"==oOpenSpec.cmProperties.type?"QueryStudio":"AnalysisStudio",searchPath='storeID("'+oOpenSpec.cmProperties.id+'")',v_sLaunchURL=getLegacyUtils().getLegacyLaunchUrl(oOpenSpec.glassContext,tool,searchPath,"edit");void 0!=oOpenSpec.urlMap.prompt&&(v_sLaunchURL=v_sLaunchURL+"&prompt="+(oOpenSpec.urlMap.prompt?"true":"false"));var v_sParameterValuesXML=oOpenSpec.urlMap.parameterValuesXML;return!v_sParameterValuesXML&&oOpenSpec.urlMap.parameterValuesJSON&&(v_sParameterValuesXML=rsPromptParameters.rsBuildPromptParameters(null,oOpenSpec.urlMap.parameterValuesJSON,"parameters")),v_sParameterValuesXML&&(v_sLaunchURL=v_sLaunchURL+"&ui.drillThroughTargetParameterValues="+encodeURIComponent(v_sParameterValuesXML)),v_sLaunchURL}function runActiveReportInNewWindow(urlMap){var deferred=Q.defer(),v_sCmPath='storeID("'+urlMap.id+'")',v_sA11y=urlMap.a11y?"&"+encodeURIComponent("system.http://developer.cognos.com/ceba/constants/systemOptionEnum#accessibilityFeatures")+"=true":"",v_sBidi=urlMap.bidi?"&"+encodeURIComponent("biDirectional.http://developer.cognos.com/ceba/constants/biDirectionalOptionEnum#biDirectionalFeaturesEnabled")+"=true":"",v_sPrompt=void 0!=urlMap.prompt?"&run.prompt="+urlMap.prompt:"",v_sUri="v1/disp?b_action=cognosViewer&ui.action=run&ui.object="+v_sCmPath+v_sPrompt+v_sA11y+v_sBidi;try{var v_oWin=window.open(v_sUri,"","");v_oWin.focus(),deferred.resolve(v_oWin)}catch(e){rsCommon.reject(deferred,"Failed to opend window: "+e.toString(),"rsOpenHelper.runActiveReportInNewWindow")}finally{return deferred.promise}}function isActiveReport(cmProperties){return rsCommon.isObjectOfType(cmProperties,"interactiveReport")}function isDataSet2(cmProperties){return rsCommon.isObjectOfType(cmProperties,"dataSet2")}function isReport_ish(cmProperties){return rsCommon.isObjectOfType(cmProperties,["report","reportView","reportTemplate","interactiveReport","dataSet2","query","analysis"])}function loadCmProperties(v_oUrlMap,v_oCmProperties){v_oCmProperties&&(v_oUrlMap.cmProperties=v_oCmProperties,v_oUrlMap.id=v_oCmProperties.id,v_oUrlMap.type=v_oCmProperties.type)}function getType(v_sId,glassContext){var v_sSearchPathUrl="v1/search_path?searchPath="+encodeURIComponent("storeID('"+v_sId+"')")+"&fields=type";return glassContext.services.fetch.get(v_sSearchPathUrl).then(function(v_oCmInfoResponse){return v_oCmInfoResponse.data.data[0].type})}function determineDefaultAction(v_sActionId,v_oCmProperties,glassContext,urlMap){if(urlMap&&(urlMap.m_oPromptContext||urlMap.m_oLaunchParameters&&urlMap.m_oLaunchParameters.promptContext))return glassContext.hasCapability("canUseCognosViewer")?"run":"none";var v_sAction;if(v_oCmProperties&&v_oCmProperties.defaultPortalAction){var v_bDefault=!0;v_sAction=v_oCmProperties.defaultPortalAction;var v_sType=v_oCmProperties.type;switch(v_sActionId){case"com.ibm.bi.authoring.run":case"com.ibm.bi.contentApps.action.runAs":case"com.ibm.bi.authoringContrib.runBtn":v_sAction="run",v_bDefault=!1;break;default:v_sActionId&&-1==v_sActionId.indexOf("com.ibm.bi.contentApps.defaultAction.")&&(v_sAction="edit",v_bDefault=!1)}switch(v_sType){case"dataSet2":v_sAction=-1!=v_oCmProperties.permissions.indexOf("read")&&glassContext.hasCapability("canUseMyDataSets")?"edit":null;break;case"reportTemplate":v_sAction=-1!=v_oCmProperties.permissions.indexOf("read")&&glassContext.hasCapability("canUseReportStudio")?"edit":null;break;case"reportView":"edit"==v_sAction&&(v_sAction=v_bDefault?"run":null);default:var v_sStudioCapability,v_bIsLegacy=!1;switch(v_sType){case"query":v_sStudioCapability="canUseQueryStudio",v_bIsLegacy=!0;break;case"analysis":v_sStudioCapability="canUseAnalysisStudio",v_bIsLegacy=!0;break;default:v_sStudioCapability="canUseReportStudio"}if(v_bIsLegacy&&"edit"==v_sAction){var v_bTool=LegacyUtils.canUseLegacyTool(glassContext,"query"==v_sType?"QueryStudio":"AnalysisStudio");v_sAction=v_bTool?"legacy":"run"}switch(v_sAction){case"edit":case"legacy":-1!=v_oCmProperties.permissions.indexOf("read")&&glassContext.hasCapability(v_sStudioCapability)||(v_sAction=-1!=v_oCmProperties.permissions.indexOf("execute")&&v_bDefault?"run":null);break;case"run":-1==v_oCmProperties.permissions.indexOf("execute")&&(v_sAction=-1!=v_oCmProperties.permissions.indexOf("read")&&v_bDefault?"viewOutput":null);break;case"viewOutput":-1==v_oCmProperties.permissions.indexOf("read")&&(v_sAction=-1!=v_oCmProperties.permissions.indexOf("execute")&&v_bDefault?"run":null);break;default:v_sAction=null}"run"!=v_sAction&&"viewOutput"!=v_sAction||glassContext.hasCapability("canUseCognosViewer")||(v_sAction=null)}}else urlMap&&urlMap.isNew&&(v_sAction=urlMap.isViewer?glassContext.hasCapability("canUseCognosViewer")?"run":"none":"authoring"==urlMap.perspective?glassContext.hasCapability("canUseReportStudio")?"edit":"none":"datasets"==urlMap.perspective&&glassContext.hasCapability("canUseMyDataSets")?"edit":"none");return v_sAction}function determineAction(v_oOpenSpec){var v_sAction,v_sCreateType,v_bAllowLegacy=!0;switch(v_oOpenSpec.actionId){case"com.ibm.bi.authoring.run":case"com.ibm.bi.contentApps.action.runAs":v_sAction="run";break;case"com.ibm.bi.authoring.createReportFromModule":case"com.ibm.bi.authoring.createReportFromPackage":v_sCreateType="report",v_sAction="edit";break;case"com.ibm.bi.datasets.createDataSetFromModule":case"com.ibm.bi.datasets.createDataSetFromPackage":v_sCreateType="dataSet2",v_sAction="edit";break;case"com.ibm.bi.authoring.convertToReport":v_sAction="edit",v_bAllowLegacy=!1;break;default:v_sAction=v_oOpenSpec.urlMap.action}var sObjectType=v_oOpenSpec.urlMap.cmProperties?v_oOpenSpec.urlMap.cmProperties.type:void 0;switch(sObjectType){case"reportVersion":case"output":v_sAction=v_oOpenSpec.glassContext.hasCapability("canUseCognosViewer")?"viewOutput":"none";break;default:switch(v_sAction){case"run":case"edit":case"viewOutput":(v_oOpenSpec.urlMap.isNew||!isReport_ish(v_oOpenSpec.urlMap.cmProperties))&&(v_sAction=v_oOpenSpec.glassContext.hasCapability("dataSet2"==v_sCreateType?"canUseMyDataSets":"canUseReportStudio")?"edit":"none"),"edit"!=v_sAction||"query"!=sObjectType&&"analysis"!=sObjectType||!v_bAllowLegacy||(v_sAction=LegacyUtils.canUseLegacyTool(v_oOpenSpec.glassContext,"query"==sObjectType?"QueryStudio":"AnalysisStudio")?"legacy":"run");break;case"default":case void 0:v_sAction=determineDefaultAction(v_oOpenSpec.actionId,v_oOpenSpec.urlMap.cmProperties,v_oOpenSpec.glassContext,v_oOpenSpec.urlMap),v_oOpenSpec.defaultAction=!0;break;default:v_sAction=null}}v_oOpenSpec.urlMap.action=v_sAction}function prepareUrlMap(v_oOpenSpec,v_oCmProperties){var urlMap=v_oOpenSpec.urlMap||{};rsCommon.convertStringQSToValues(urlMap,v_oOpenSpec.glassContext,v_oOpenSpec.trimURLParameterValues);var dataset=!1;switch(v_oOpenSpec.actionId){case"com.ibm.bi.datasets.createDataSetFromModule":case"com.ibm.bi.datasets.createDataSetFromPackage":urlMap.startingTemplate="DatasetList",dataset=!0,urlMap.isNew=!0;break;case"com.ibm.bi.contentApps.defaultAction.dataSet2":case"com.ibm.bi.datasets.editDataset":dataset=!0;break;case"com.ibm.bi.authoring.createReportFromModule":case"com.ibm.bi.authoring.createReportFromPackage":urlMap.isNew=!0;break;default:dataset=isDataSet2(v_oCmProperties)||!v_oCmProperties&&"datasets"==urlMap.perspective,urlMap.isNew=!isReport_ish(v_oCmProperties)}return loadCmProperties(urlMap,v_oCmProperties),urlMap.isApplication=isActiveReport(v_oCmProperties),!urlMap.perspective&&dataset&&(urlMap.perspective="datasets"),urlMap.UIProfile="datasets"==urlMap.perspective?"TitanDataset":"Titan",rsCommon.decodeAndMoveRSOptions(urlMap),v_oOpenSpec.urlMap=urlMap,determineAction(v_oOpenSpec),v_oOpenSpec}function convertToObjectFromCmOptionsArray(aCmOptions){if(!aCmOptions||!Array.isArray(aCmOptions))return aCmOptions;var oReturn={};return aCmOptions.forEach(function(oOption){"undefined"==typeof oReturn[oOption.name]?oReturn[oOption.name]=oOption.value:Array.isArray(oReturn[oOption.name])?oReturn[oOption.name].push(oOption.value):oReturn[oOption.name]=[oReturn[oOption.name],oOption.value]}),oReturn}function convertCmOptionsToSimpleArray(cmProperties){cmProperties.options=convertToObjectFromCmOptionsArray(cmProperties.options),cmProperties.base&&cmProperties.base.length>0&&cmProperties.base[0]&&(cmProperties.base[0].options=convertToObjectFromCmOptionsArray(cmProperties.base[0].options))}function getCMInfoForOpen(cmProperties,v_aProperties,glassContext){var deferred=Q.defer(),v_sReportViewUrl="v1/objects/"+cmProperties.id,v_aFields=[];v_aProperties.forEach(function(v_sField){v_aFields.push(v_sField)}),v_aFields.join(",");var v_sReportViewPropsUrl=v_sReportViewUrl.concat("?fields=",v_aFields.join(","));return glassContext.services.ajax.ajax({url:v_sReportViewPropsUrl,type:"GET",dataType:"json"}).fail(function(err){console.log("rsOpenHelper.getCMInfo ... FAILED"),deferred.reject(err)}).done(function(resp){if(!resp||!resp.data||resp.data.length<=0)return void rsCommon.reject(deferred,"unexpected response","rsOpenHelper.getCMInfoForOpen");var v_oData=resp.data[0];convertCmOptionsToSimpleArray(v_oData),convertCmOptionsToSimpleArray(cmProperties);var v_oCurrentCmProperties=cmProperties;for(var v_sProperty in v_oCurrentCmProperties)v_oCurrentCmProperties.hasOwnProperty(v_sProperty)&&void 0==v_oData[v_sProperty]&&(v_oData[v_sProperty]=v_oCurrentCmProperties[v_sProperty]);deferred.resolve(v_oData)}),deferred.promise}function f_determineMissingProperties(v_aProperties,v_oCmProperties){for(var v_aMissingProperties=[],len=v_aProperties.length,i=0;len>i;++i){var v_sProperty=v_aProperties[i];"undefined"==typeof v_oCmProperties[v_sProperty]&&v_aMissingProperties.push(v_sProperty)}return v_aMissingProperties}function extractProperties(v_aPropertiesSpec,type){var v_aProperties;if(v_aPropertiesSpec){v_aProperties=[];for(var idx=0;idxi;++i)v_aRequestProperties.push("base."+v_aRequestProperties[i]);else"report"!=v_oCmProperties.type||v_oCmProperties.metadataModelPackage&&v_oCmProperties.metadataModelPackage[0]&&v_oCmProperties.metadataModelPackage[0].effectiveUserCapabilities||v_aRequestProperties.push("metadataModelPackage.effectiveUserCapabilities");v_aRequestProperties.length>0?getCMInfoForOpen(v_oCmProperties,v_aRequestProperties,glassContext)["catch"](function(err){console.log("rsOpenHelper.retreiveCMInfo ... FAILED"),deferred.reject(err)}).then(function(v_oUpdatedCmProperties){deferred.resolve(v_oUpdatedCmProperties)}):deferred.resolve(v_oCmProperties);break;default:var v_aRequestProperties=f_determineMissingProperties(extractProperties(v_aPropertiesSpec,null)||["type","searchPath"],v_oCmProperties);v_aRequestProperties.length>0?getCMInfoForOpen(v_oCmProperties,v_aRequestProperties,glassContext)["catch"](function(err){console.log("rsOpenHelper.retreiveCMInfo ... FAILED"),deferred.reject(err)}).then(function(v_oUpdatedCmProperties){deferred.resolve(v_oUpdatedCmProperties)}):deferred.resolve(v_oCmProperties)}return deferred.promise}function isOutputFormatSupportedInAdvancedViewer(v_sOutputFormat){return-1!==["HTML","PDF","spreadsheetML","xlsxData","CSV","XML"].indexOf(v_sOutputFormat)}function isOutputForDownload(v_sOutputFormat){return-1!==["spreadsheetML","xlsxData","CSV","XML"].indexOf(v_sOutputFormat)}function getValueFromFieldIfDefined(v_o,v_sField){return v_o&&"undefined"!=typeof v_o[v_sField]&&null!==v_o[v_sField]?{value:v_o[v_sField]}:void 0}function getFirstValueFromArrayFieldIfDefined(v_o,v_sField){var o=getValueFromFieldIfDefined(v_o,v_sField);if(o){var a=o.value;if(!(a.length<1))return{value:Array.isArray(a)?a[0]:a}}}function determineRunInAdvancedViewer(v_oProperties){var o=getValueFromFieldIfDefined(v_oProperties,"runInAdvancedViewer");return o?o.value:!1}function isRunInAdvancedViewer(v_oOpenSpec,v_sFormat){var v_bRunInAdvancedViewer=!1,v_oCmProperties=v_oOpenSpec.urlMap.cmProperties;return determineRunInAdvancedViewer(v_oCmProperties&&v_oCmProperties.base?v_oCmProperties.base[0]:v_oCmProperties)&&(v_bRunInAdvancedViewer=!0),v_bRunInAdvancedViewer&&v_sFormat&&!isOutputFormatSupportedInAdvancedViewer(v_sFormat)&&(v_bRunInAdvancedViewer=!1),v_bRunInAdvancedViewer}function consolidateAndReconcileRunOptions(v_oOpenSpec){var urlMap=v_oOpenSpec.urlMap,v_oCmBaseProperties=urlMap.cmProperties&&urlMap.cmProperties.base?urlMap.cmProperties.base[0]:null,v_oCmProperties=urlMap.cmProperties||{},v_oPreferences=v_oOpenSpec.glassContext.services.userProfile.preferences;if(void 0==urlMap.format){var v_sFormat=v_oPreferences.format,o=getFirstValueFromArrayFieldIfDefined(v_oCmBaseProperties&&v_oCmBaseProperties.options,"outputFormat");o&&(v_sFormat=o.value||v_sFormat),o=getFirstValueFromArrayFieldIfDefined(v_oCmProperties.options,"outputFormat"),o&&(v_sFormat=o.value||v_sFormat),(isActiveReport(v_oCmProperties)||!rsCommon.isOutputFormatAllowed(v_sFormat,v_oOpenSpec.glassContext))&&(v_sFormat="HTML"),o=getValueFromFieldIfDefined(v_oOpenSpec.runOptions,"format"),o&&(v_sFormat=o.value||v_sFormat),urlMap.format=v_sFormat}if(void 0==urlMap.a11y){var v_bA11y=v_oPreferences.accessibilityFeatures,o=getValueFromFieldIfDefined(v_oCmBaseProperties&&v_oCmBaseProperties.options,"http://developer.cognos.com/ceba/constants/systemOptionEnum#accessibilityFeatures");o&&(v_bA11y=o.value||v_bA11y),o=getValueFromFieldIfDefined(v_oCmProperties.options,"http://developer.cognos.com/ceba/constants/systemOptionEnum#accessibilityFeatures"),o&&(v_bA11y=o.value||v_bA11y),urlMap.a11y=v_bA11y}if(void 0==urlMap.bidi&&(urlMap.bidi=v_oPreferences.biDirectionalFeaturesEnabled),urlMap.Download=isOutputForDownload(urlMap.format)?"true":"false",void 0==urlMap.prompt){var v_bPrompt;o=getValueFromFieldIfDefined(v_oCmBaseProperties&&v_oCmBaseProperties.options,"prompt"),o&&(v_bPrompt=o.value),o=getValueFromFieldIfDefined(v_oCmProperties.options,"prompt"),o&&(v_bPrompt=o.value),o=urlMap.m_oLaunchParameters&&urlMap.m_oLaunchParameters.RunOptions?getValueFromFieldIfDefined(urlMap.m_oLaunchParameters.RunOptions,"Prompt"):getValueFromFieldIfDefined(urlMap,"Prompt"),o&&(v_bPrompt="string"==typeof o.value?"true"===o.value:!!o.value),o=getValueFromFieldIfDefined(v_oOpenSpec.runOptions,"prompt"),o&&(v_bPrompt=o.value),urlMap.prompt=v_bPrompt}}function getActiveReportOutputURL(v_oCMProperties,v_oOutputProperties){var v_sReportId,v_sOutputId;return v_oOutputProperties?(v_sReportId=v_oCMProperties.id,v_sOutputId=v_oOutputProperties.id):"output"==v_oCMProperties.type?(v_sReportId=v_oCMProperties.parent[0].parent[0].id,v_sOutputId=v_oCMProperties.id):(v_sReportId=v_oCMProperties.id,v_sOutputId="default"),"v1/disp/repository/sid/cm/rid/"+v_sReportId+"/oid/"+v_sOutputId+"/content/mht/content"}function openUrlViaForm(sHref,bNewWindow){var v_nDrillForm;try{var v_sTarget="_self";if(bNewWindow&&(v_sTarget="rsTarget"+Date.now(),!window.open("",v_sTarget)))return!1;var v_aUrlParts=sHref.split("?");if(v_nDrillForm=document.body.appendChild(document.createElement("form")),v_nDrillForm.setAttribute("name","drillForm"),v_nDrillForm.setAttribute("method","post"),v_nDrillForm.setAttribute("action",decodeURIComponent(v_aUrlParts[0])),v_nDrillForm.setAttribute("target",v_sTarget),v_nDrillForm.style.display="none",2==v_aUrlParts.length)for(var v_aParams=v_aUrlParts[1].split("&"),i=0;i0){var v_oOutput=v_oSavedOutputResp.data[0];if("reportVersion"==v_oCmProperties.type)return v_oOutput.parent[0]=v_oCmProperties,v_oOutput;var v_sCMQueryUrl=v_oContentSvc.getBaseObjectsURL()+"/"+v_oOutput.parent[0].id+"?fields=decoratedSpecification,id,parent";return v_oContentSvc.get(v_sCMQueryUrl,{}).then(function(v_oVersionResponse){var v_oVersion=v_oVersionResponse.data[0];return v_oVersion.parent[0]=v_oCmProperties,v_oOutput.parent[0]=v_oVersion,v_oOutput})}return null})})}function resolveUrlMapForSavedOutput(v_oOpenSpec){return v_oOpenSpec.urlMap.action?"viewOutput"!=v_oOpenSpec.urlMap.action?Q.resolve(v_oOpenSpec):getSavedOutput(v_oOpenSpec.glassContext,v_oOpenSpec.urlMap.cmProperties,v_oOpenSpec.urlMap.format,v_oOpenSpec.urlMap.contentLocale).fail(function(err){return Q.resolve(null)}).then(function(v_oOutput){if(v_oOutput&&"output"==v_oOutput.type&&"dataSet"!=v_oOutput.format){var v_bActiveReport=isActiveReport(v_oOutput),v_sActiveReportOutputHref=v_bActiveReport?getActiveReportOutputURL(v_oOutput):null;if(v_sActiveReportOutputHref&&(!v_oOutput.dataDescriptor||"interactive"!=v_oOutput.dataDescriptor.type))return v_oOpenSpec.href=v_sActiveReportOutputHref,Q.resolve(v_oOpenSpec);var v_oUrlMap=v_oOpenSpec.urlMap;return rsCommon.getAvailableOutputs(v_oOpenSpec.glassContext,v_oOutput).then(function(v_oSavedOutputFormats){if(!v_oSavedOutputFormats||!v_oSavedOutputFormats.data||v_oSavedOutputFormats.data.length<=0)return Q.reject(new Error("unexpected response for rsCommon.getAvailableOutputs"));v_oUrlMap.perspective="classicviewer",(v_oOutput.dataDescriptor&&"interactive"==v_oOutput.dataDescriptor.type||"PDF"==v_oOutput.format)&&(v_oUrlMap.perspective="authoring",v_oUrlMap.outputSpec=v_oOutput.parent[0].decoratedSpecification),v_oOpenSpec.glassContext.isEmbedded()&&(v_oUrlMap.perspective+="_embedded"),v_bActiveReport?delete v_oUrlMap.format:v_oUrlMap.format=v_oOutput.format||v_oUrlMap.format;for(var v_oOutputLookup={},i=0;i"+v_o.end;try{this.measure(v_sName,v_o.start,v_o.end)}catch(e){}},this);for(var v_aPerformanceFields=["navigationStart","unloadEventStart","unloadEventEnd","redirectStart","redirectEnd","fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"],v_oPerformanceOut={timing:{}},iframe=v_oView.m_iframeAuthoring||v_oView.m_iframeClassicViewer,v_oPerformanceIn=iframe.contentWindow.performance,iPField=0;iPField0&&(v_oUrlMap.prompt=!1,rsPromptParameters.rsBuildParameterUrl(v_oUrlMap,v_aParameters))}}}return v_oUrlMap}function buildShareUrl(v_oOpenSpec,v_oCmProperties){var v_oUrlMap=createShareUrl(v_oOpenSpec,v_oCmProperties);return retrievePromptParameters(v_oOpenSpec,v_oUrlMap)}function prepareShareUrlMap(v_oOpenSpec){var deferred=Q.defer();return OpenHelper.retreiveCMInfo(v_oOpenSpec.cmProperties,v_oOpenSpec.glassContext,M_aShareProperties).then(buildShareUrl.bind(null,v_oOpenSpec)).fail(function(err){console.log("OpenHelper.prepareShareUrlMap ... FAILED"),deferred.reject(err)}).done(function(v_oUrlMap){deferred.resolve(v_oUrlMap)}),deferred.promise}var M_aShareProperties=[{property:"id",type:null},{property:"type",type:null},{property:"burstKey",type:["output"]},{property:"parent",type:null}];return{getShareUrlMap:function(v_oOpenSpec){var deferred=Q.defer();return prepareShareUrlMap(v_oOpenSpec)["catch"](function(err){console.log("rsShareHelper.getShareUrlMap ... FAILED"),deferred.reject(err)}).done(function(v_oUrlMap){deferred.resolve(v_oUrlMap)}),deferred.promise},buildShareUrlMap:function(v_oContentView){var v_oCmProperties=v_oContentView.cmProperties,glassContext=v_oContentView.glassContext,v_oOpenSpec={mode:"current",glassContext:glassContext,contentView:v_oContentView};return buildShareUrl(v_oOpenSpec,v_oCmProperties)},isShareable:function(v_oCurrentContentView,v_bEmbed){var v_bShareable=!1;if(v_oCurrentContentView&&v_oCurrentContentView.canRun()){var v_oAuthoringApp=v_oCurrentContentView.getAuthoringApplication();"datasets"==v_oCurrentContentView.perspective?v_bShareable=!v_bEmbed:("classicviewer"==v_oCurrentContentView.perspective||v_oAuthoringApp&&v_oAuthoringApp.SharedState.Get("isViewer"))&&v_oAuthoringApp&&v_oAuthoringApp.SharedState.Get("storeID")&&(v_bShareable=!0)}return v_bShareable}}}),define("bi/authoring/rsContentView",["bi/glass/app/ContentView","jquery","q","bi/authoring/nls/StringResource","bi/commons/utils/Utils","bi/authoring/utils/rsCommon","bi/authoring/utils/rsOpenHelper","bi/authoring/utils/rsPerformance","bi/authoring/utils/rsIFrameManager","bi/authoring/utils/pat/rsLaunchParameters","bi/authoring/utils/pat/rsPromptParameters","bi/authoring/utils/rsShareHelper","bi/admin/common/utils/parameters/ParameterValues"],function(ContentView,$,Q,StringResource,Utils,rsCommon,rsOpenHelper,rsPerformance,rsIFrameManager,rsLaunchParameters,rsPromptParameters,rsShareHelper,ParameterValues){"use strict";function handleTruthyValueAlreadySetOrAddObserver(v_oApplication,v_sPropertyName,v_fnOnChangeCallback){v_oApplication.SharedState.Get(v_sPropertyName)?v_fnOnChangeCallback():v_oApplication.SharedState.AddObserver(v_sObserverId,v_sPropertyName,v_fnOnChangeCallback)}function handleTruthyValueAlreadySetAndAddObserver(v_oApplication,v_sPropertyName,v_fnOnChangeCallback){v_oApplication.SharedState.Get(v_sPropertyName)&&v_fnOnChangeCallback(),v_oApplication.SharedState.AddObserver(v_sObserverId,v_sPropertyName,v_fnOnChangeCallback)}var v_sObserverId="/authoring/js/rsContentView",v_aSpecModificationPluginIds=["com.ibm.bi.authoring.saveAsBtn","com.ibm.bi.authoring.undoBtn","com.ibm.bi.authoring.redoBtn","com.ibm.bi.authoring.toggleEditViewer"],rsContentView=ContentView.extend({init:function(options,appView){this.m_oLaunchPromise=options.launchPromise,delete options.launchPromise,rsCommon.decodeAndMoveCMProperties(options),rsCommon.convertStringQSToValues(options,options.glassContext),rsCommon.decodeAndMoveRSOptions(options),rsContentView.inherited("init",this,arguments),this.m_fOnWindowResize=this.syncIFrameSizeToView.bind(this),window.addEventListener("resize",this.m_fOnWindowResize,!1),this.m_oAppView=appView;var v_oAppViewFirstLoadedDeferred=Q.defer();this.m_oRemoveAppViewLoadedHandler=this.glassContext.getCoreSvc(".Events").on("appView:loaded",this._handleFirstAppViewOnLoaded.bind(this,v_oAppViewFirstLoadedDeferred),this),this.m_oAppViewFirstLoadedPromise=v_oAppViewFirstLoadedDeferred.promise,this.m_oRSParameters=this.m_oRSParameters||{};try{var v_oLaunchParameters=rsLaunchParameters.Retrieve(this.launchParametersKey);if(v_oLaunchParameters?this.m_oLaunchParameters=v_oLaunchParameters:window.parent&&this.launchParametersRef&&(this.m_oLaunchParameters=window.parent[options.launchParametersRef]),window.opener&&!window.opener.closed&&window.opener.RSParameters)if(this.isNemesis){var o=window.opener.RSParameters;for(var v_sAttrName in o)"reportXML"==v_sAttrName?(this.m_oRSParameters.useGlassReportXML=!0,this.m_sReportSpecFromOpener=o[v_sAttrName]):this.m_oRSParameters[v_sAttrName]=o[v_sAttrName];this.m_oRSParameters.useGlassReportXML&&(this.m_oRSParameters.model=""),o.AppOnLoad&&(this.AppOnLoad=window.opener[o.AppOnLoad])}else if(!this.m_oLaunchParameters&&!this.isHomepage){var v_oSrcParameters=window.opener.RSParameters;window.opener.RSParameters=void 0,this.startingTemplate=v_oSrcParameters.startingTemplate,this.moduleId=v_oSrcParameters.module,this.isViewer=v_oSrcParameters.isViewer,this.m_oLaunchParameters=rsLaunchParameters.Retrieve(v_oSrcParameters.launchParametersKey),this.moduleId&&!this.moduleSearchPath&&this.startingTemplate&&(this.m_bIsTryIt=!0,this.moduleSearchPath='storeID("'+this.moduleId+'")',this.action="run",console.log("rsContentView.init() - launched from try it setting module search path "+this.m_oRSParameters.moduleSearchPath))}}catch(e){console.log("rsContentView.init() - Call to window.opener failed, assume it doesn't exist")}this.m_bDisableRsLockUnlock=!1,this.m_bFullyInitialized=!1},_postInit:function(){if(!this.m_bFullyInitialized){this.m_bFullyInitialized=!0;var options=this;options.parameterValuesJSON&&(options.parameterValuesXML=rsPromptParameters.rsBuildPromptParameters(void 0,options.parameterValuesJSON),delete options.parameterValuesJSON),this.m_oLaunchPromise||$.extend(this.m_oRSParameters,rsCommon.createRSParameters(options,this.glassContext)),this.m_bNewlyCreatedReport=this.m_oRSParameters.reportStoreID?!1:!0,options.isSlideout&&(this.m_bDisableRsLockUnlock=!0),this.m_oLaunchParameters&&this.m_oLaunchParameters.RunOptions&&(this.m_oRSParameters.rsFinalRunOptions||(this.m_oRSParameters.rsFinalRunOptions={}),this.m_oLaunchParameters.RunOptions.OutputFormat&&(this.m_oRSParameters.rsFinalRunOptions.format=this.m_oLaunchParameters.RunOptions.OutputFormat),this.m_oLaunchParameters.RunOptions.isApplication&&(this.m_oRSParameters.rsFinalRunOptions.isApplication=this.m_oLaunchParameters.RunOptions.isApplication),this.m_oLaunchParameters.RunOptions.globalParameters&&(this.m_oRSParameters.rsFinalRunOptions.globalParameters=this.m_oLaunchParameters.RunOptions.globalParameters)),this.m_bInitialIsViewerState=this.m_oRSParameters.isViewer,this.m_oLaunchParameters&&this.m_oLaunchParameters.parameterValuesJSON&&(this.m_oLaunchParameters.parameterValuesXML=rsPromptParameters.rsBuildPromptParameters(void 0,this.m_oLaunchParameters.parameterValuesJSON),delete this.m_oLaunchParameters.parameterValuesJSON)}},render:function(){if(this.rsResolved)return this._render();!this.cmProperties&&this.objRef&&(this.cmProperties={id:this.objRef,type:this.type});var v_oOpenSpec={cmProperties:this.cmProperties,glassContext:this.glassContext,urlMap:this};return rsOpenHelper.resolveUrlMap(v_oOpenSpec).then(function(v_oResolvedOpenSpec){return $.extend(this,v_oResolvedOpenSpec.urlMap),this._render()}.bind(this))},_render:function(){this._postInit();var $renderDeferred=$.Deferred();if(this.m_oRSParameters.closePerspective||"none"==this.action){var v_oState={isViewer:!0,objectType:"",runInAdvancedViewer:!0};if(this._updatePlugins(v_oState),this.m_oRSParameters.closePerspective){var v_sError=StringResource.get("no_output_format_capability",{outputFormat:this.m_oRSParameters.rsFinalRunOptions.format});$renderDeferred.reject({message:v_sError})}else{var v_sError=StringResource.get("no_action_available");this.glassContext.showToast(v_sError,{type:"warning",btnLabel:"OK",callback:function(){this.glassContext.closeAppView("authoring",this.id)}.bind(this)}),$renderDeferred.resolve()}return $renderDeferred.promise()}if(rsPerformance.mark("rsContentView.render"),console.timeEnd("rsperf: onSelectItem->render"),console.time("rsperf: render->OnRSApplicationReadyForObservers"),$renderDeferred.resolve(this),this.m_oAppView.$(".navbar").addClass("narrow"),!this.m_oLaunchPromise){var v_oTemplateParameters=rsCommon.createTemplateParameters(this.m_oRSParameters);this.m_oLaunchPromise=rsIFrameManager.F_LaunchRS(v_oTemplateParameters,this.glassContext,this.m_oLaunchParameters)}this.m_oLaunchPromise["catch"](function(err){console.log(err),this.hackUnlockGlass(),$renderDeferred.reject(err)}.bind(this)).done(this._onRSApplicationReady.bind(this,$renderDeferred));var v_oState={isViewer:this.m_bInitialIsViewerState,objectType:"",runInAdvancedViewer:this.m_bNewlyCreatedReport};this.cmProperties&&(v_oState.objectType=this.cmProperties.type,this.cmProperties.runInAdvancedViewer&&(v_oState.runInAdvancedViewer=!0)),this._updatePlugins(v_oState);var v_oGlassActionToInstrumentationEventType={run:"Ran Process",viewOutput:"Read Object",edit:"Read Object",create:"Created Object"},v_sInstrumentationType=v_oGlassActionToInstrumentationEventType[this.action];if(v_sInstrumentationType&&this.glassContext){var v_oInstrumentationService=this.glassContext.getCoreSvc(".Instrumentation");if(v_oInstrumentationService&&v_oInstrumentationService.enabled){var v_sType,v_sId;if("output"==this.type&&this.cmProperties){var v_oVersionedAncestor=this.cmProperties.parent[0].parent[0];v_oVersionedAncestor=v_oVersionedAncestor.base||v_oVersionedAncestor,v_sType=v_oVersionedAncestor.type,v_sId=v_oVersionedAncestor.id}else v_sType=this.type,v_sId=this.id;v_sInstrumentationType===v_oGlassActionToInstrumentationEventType.edit&&this.isNew&&(v_sInstrumentationType=v_oGlassActionToInstrumentationEventType.create,v_sId="null",v_sType||(v_sType="report"));var v_oEvent={type:v_sInstrumentationType,objectType:v_sType,object:v_sId,milestoneName:v_sInstrumentationType+"_"+v_sType};v_sInstrumentationType===v_oGlassActionToInstrumentationEventType.run&&(v_oEvent.processType="Run a Report"),-1!==[v_oGlassActionToInstrumentationEventType.run,v_oGlassActionToInstrumentationEventType.viewOutput].indexOf(v_sInstrumentationType)&&(v_oEvent["custom.viewer"]="interactive",v_oEvent["custom.outputFormat"]=this.format),v_oInstrumentationService.track(v_oEvent)}}return this.hackLockGlass(),$renderDeferred.promise()},getTitle:function(){return this.isApplicationLoaded()?this.getAuthoringApplication().SharedState.Get("reportName"):StringResource.get("datasets"==this.perspective?"dataset_welcome":"authoring_welcome")},getIcon:function(){var v_sIcon;if("datasets"==this.perspective)v_sIcon="common-dataset";else{var v_sReportType=this.getAuthoringApplication()&&this.getAuthoringApplication().SharedState.Get("objectType");switch(v_sReportType){case"interactiveReport":v_sIcon="common-interactiveReport";break;case"reportView":v_sIcon="common-report_view";break;default:v_sIcon="common-report"}}return v_sIcon},getIconTooltip:function(){return StringResource.get("datasets"==this.perspective?"dataset_welcome":"authoring_welcome")},getType:function(){var v_sObjectType;return this.isApplicationLoaded()&&(v_sObjectType=this.getAuthoringApplication().SharedState.Get("objectType")),v_sObjectType},isDirty:function(){var v_oSharedState=this.getAuthoringApplication()?this.getAuthoringApplication().SharedState:null,v_sObjectType=v_oSharedState?v_oSharedState.Get("objectType"):"";if("reportView"==v_sObjectType||this.isNemesis||!this.isApplicationLoaded()||this.m_bIsTryIt)return!1;var v_bIsModified=v_oSharedState&&v_oSharedState.Get("isModified"),v_bIsViewer=v_oSharedState&&v_oSharedState.Get("isViewer");if(v_bIsModified&&v_bIsViewer){var v_bRead=!this.cmProperties||!this.cmProperties.permissions||-1!=this.cmProperties.permissions.indexOf("read"),v_bWrite=!this.cmProperties||!this.cmProperties.permissions||-1!=this.cmProperties.permissions.indexOf("write"),v_bSaveAsCapabilities=this.glassContext.hasCapability("canUseReportStudio")&&this.glassContext.hasCapability("canUseReportStudioFileManagement");v_bRead&&(v_bWrite||v_bSaveAsCapabilities)||(v_bIsModified=!1)}return v_bIsModified},getAuthoringApplication:function(){return rsCommon.getAuthoringApplicationFromIFrame(this.m_iframeAuthoring)},isApplicationLoaded:function(){var v_Application=this.getAuthoringApplication();return!(!v_Application||!v_Application.SharedState.Get("isAppLoaded"))},canRun:function(){var v_oAuthoringApp=this.getAuthoringApplication();return v_oAuthoringApp.SharedState.Get("canRun")},getContent:function(options){return rsCommon.getContent(options,this,rsShareHelper)},getApplicationContent:function(v_oContent,v_oCmProperties){var application={};if(this.isApplicationLoaded()){var v_oAuthoringApp=this.getAuthoringApplication(),v_sStoreID=v_oAuthoringApp.SharedState.Get("storeID");application.storeID=v_sStoreID,application.isModified=v_oAuthoringApp.SharedState.Get("isModified"),application.cmSearchPath=v_oAuthoringApp.SharedState.Get("cmSearchPath"),application.reportName=this.getTitle(),v_oCmProperties||(console.log("rsContentView.getContent no .cmProperties"),v_oCmProperties={type:void 0});var v_sType=v_oContent.objRef&&v_oContent.type||v_oCmProperties&&v_oCmProperties.type;"reportTemplate"===v_sType||"dataSet2"===v_sType?application.type=v_sType:v_oAuthoringApp.SharedState.Get("isActiveReport")?application.type="interactiveReport":application.type="report"}return application},onAppLoaded:function(){var v_Application=this.getAuthoringApplication();this.m_oAppViewFirstLoadedPromise.done(function(){rsIFrameManager.F_PositionAndSizeIFrame(this.$el,this.m_iframeAuthoring),this.hackUnlockGlass(),handleTruthyValueAlreadySetAndAddObserver(v_Application,"reportName",this.updateTitle.bind(this)),handleTruthyValueAlreadySetOrAddObserver(v_Application,"isReportLoaded",this._on_isReportLoaded.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"isViewer",this._on_isViewer.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"isActiveReport",this._on_isActiveReport.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"runInAdvancedViewer",this._on_runInAdvancedViewer.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"viewer",this._on_viewer.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"isModified",this._on_isModified.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"storeID",this._on_storeID.bind(this)),this.onSavedCallback&&(v_Application.SharedState.AddObserver(null,"onDatasetSaved",this.onSavedCallback),delete this.onSavedCallback),this.onCancelCallback&&(v_Application.SharedState.AddObserver(null,"onDatasetCancelled",this.onCancelCallback),delete this.onCancelCallback),handleTruthyValueAlreadySetOrAddObserver(v_Application,"firstBeforeDraw",this.onViewBeforeFirstDraw.bind(this)),handleTruthyValueAlreadySetOrAddObserver(v_Application,"firstAfterDraw",this.onViewAfterFirstDraw.bind(this)),this.isNew&&!rsOpenHelper.isReport_ish(this.cmProperties)&&delete this.cmProperties}.bind(this))},onViewBeforeFirstDraw:function(){console.time("rsperf: ViewBeforeDraw->ViewAfterDraw"),rsPerformance.mark("rsContentView.onViewBeforeDraw")},onViewAfterFirstDraw:function(){rsPerformance.mark("rsContentView.onViewAfterDraw"),rsPerformance.mark("authoring-selectItemAndDraw-stop"),console.timeEnd("rsperf: ViewBeforeDraw->ViewAfterDraw"),console.timeEnd("rsperf: total_RunReport"),this.glassContext&&this.glassContext.isDevInstall&&this.glassContext.isDevInstall()&&rsPerformance.summarizeInteractiveViewerRun(this);var v_Application=this.getAuthoringApplication();this.m_oLaunchParameters&&this.m_oLaunchParameters.promptContext||!v_Application.GetUserDataSetting("PreLaunchRS")||rsIFrameManager.F_PreLaunch(this.glassContext)},enablePluginForApplicationState:function(v_oOption){var v_oState=this.getAuthoringApplication().SharedState.Get(v_oOption.state);this._setEnableForPlugins(v_oState,[v_oOption.plugin])},highlightPluginForApplicationState:function(v_oOption){var v_oState=this.getAuthoringApplication().SharedState.Get(v_oOption.state),v_oPlugin=this.glassContext.findPlugin(v_oOption.plugin);v_oPlugin?v_oState?(console.log("rsContentView press %s",v_oOption.plugin),v_oPlugin.setPressed()):(console.log("rsContentView unpress %s",v_oOption.plugin),v_oPlugin.setUnpressed()):console.log("rsContentView highlightPluginForApplicationState - could not find plugin: %s",v_oOption.plugin)},showPluginForApplicationState:function(v_oOption){var v_oPlugin=this.glassContext.findPlugin(v_oOption.plugin);if(v_oPlugin){var v_oState=this.getAuthoringApplication().SharedState.Get(v_oOption.state);v_oState?v_oPlugin.show():v_oPlugin.hide()}else console.log("rsContentView showPluginForApplicationState - could not find plugin: %s",v_oOption.plugin)},_setDisplayForPlugins:function(v_bShow,v_aPluginIds){v_aPluginIds.forEach(function(v_sPluginId){var v_oPlugin=this._hackFindPlugin(v_sPluginId);v_oPlugin?v_bShow?v_oPlugin.show():v_oPlugin.hide():console.log("could not find plugin: %s",v_sPluginId)},this)},_setEnableForPlugins:function(v_bEnable,v_aPluginIds){v_aPluginIds.forEach(function(v_sPluginId){var v_oPlugin=this._hackFindPlugin(v_sPluginId);v_oPlugin?v_bEnable?v_oPlugin.enable():v_oPlugin.disable():console.log("could not find plugin: %s",v_sPluginId)},this)},_updatePlugins:function(v_oState){var v_aEditIds=["com.ibm.bi.authoring.runMenu","com.ibm.bi.authoring.insertableObjectsBtn"],v_aViewerIds=["com.ibm.bi.authoring.runBtn","com.ibm.bi.authoring.refreshBtn","com.ibm.bi.authoring.consumptionFilter","com.ibm.bi.contentApps.teamFoldersSlideout","com.ibm.bi.contentApps.myContentFoldersSlideout","com.ibm.bi.search.search","com.ibm.bi.contentApps.mruSlideout"];if(this.m_bIsTryIt)this._setDisplayForPlugins(!1,v_aViewerIds),this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.saveAsBtn","com.ibm.bi.authoring.outputBtn","com.ibm.bi.authoring.runMenu"]);else if("output"==v_oState.objectType){var v_bRun=-1!=this.cmProperties.permissions.indexOf("execute");this._setDisplayForPlugins(v_bRun,["com.ibm.bi.authoring.outputBtn"]),this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.runBtn","com.ibm.bi.authoring.insertableObjectsBtn","com.ibm.bi.authoring.runMenu","com.ibm.bi.authoring.refreshBtn","com.ibm.bi.authoring.consumptionFilter","com.ibm.bi.authoring.saveAsBtn","com.ibm.bi.authoring.undoBtn","com.ibm.bi.authoring.redoBtn"])}else"reportView"==v_oState.objectType&&this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.saveAsBtn"]),this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.outputBtn"]),this._setDisplayForPlugins(!v_oState.isViewer,v_aEditIds),this._setDisplayForPlugins(v_oState.isViewer,v_aViewerIds),v_oState.isViewer||this._setDisplayForPlugins(!1,["com.ibm.bi.contentApps.customFoldersSlideout"]),v_oState.isViewer&&"PDF"==this.m_oRSParameters.rsFinalRunOptions.format&&this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.consumptionFilter"]),this._setDisplayForPlugins(!(v_oState.isViewer&&v_oState.isFromRS),["com.ibm.bi.glass.common.operations"]);var v_bRead=!this.cmProperties||!this.cmProperties.permissions||-1!=this.cmProperties.permissions.indexOf("read"),v_bCanToggleEditView=this.glassContext.hasCapability("canUseReportStudio")&&"report"==v_oState.objectType&&v_oState.runInAdvancedViewer&&!v_oState.useReadOnlyViewer&&!this.m_bIsTryIt&&!(v_oState.isViewer&&v_oState.isFromRS)&&(!v_oState.isViewer||v_bRead);"interactiveReport"==v_oState.objectType&&this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.consumptionFilter","com.ibm.bi.authoring.refreshBtn","com.ibm.bi.authoring.outputBtn"]),this.getAuthoringApplication()?(v_oState.isViewer||this.getAuthoringApplication().SharedState.Set(null,"showFilters",!1),this.getAuthoringApplication().SharedState.Set(null,"canToggleEditView",v_bCanToggleEditView)):this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.toggleEditViewer"]);
},_updatePluginsForNewState:function(){var v_oState={isViewer:this.getAuthoringApplication().SharedState.Get("isViewer"),objectType:this.getAuthoringApplication().SharedState.Get("objectType"),runInAdvancedViewer:this.getAuthoringApplication().SharedState.Get("runInAdvancedViewer"),useReadOnlyViewer:this.getAuthoringApplication().SharedState.Get("useReadOnlyViewer")};this.m_oLaunchParameters&&this.m_oLaunchParameters.RunOptions&&1==this.m_oLaunchParameters.RunOptions.isFromRS&&(v_oState.isFromRS=!0),this._updatePlugins(v_oState)},_on_isViewer:function(){this._updatePluginsForNewState()},_on_isActiveReport:function(){this._updatePluginsForNewState()},_on_runInAdvancedViewer:function(){this._updatePluginsForNewState()},_on_viewer:function(){var v_Application=this.getAuthoringApplication();this._setDisplayForPlugins("HTML"==v_Application.SharedState.Get("viewer").toUpperCase(),v_aSpecModificationPluginIds),this._updatePluginsForNewState(),this._updateButtonState()},_on_storeID:function(){var v_Application=this.getAuthoringApplication(),v_sStoreId=v_Application.SharedState.Get("storeID");!v_sStoreId||this.cmProperties&&v_sStoreId==this.cmProperties.id||rsOpenHelper.updateCmProperties(this,v_sStoreId).then(function(){this._updatePluginsForNewState(),this.glassContext.updateCurrentCachedAppView()}.bind(this))},_updateButtonState:function(){var v_Application=this.getAuthoringApplication(),v_aStateAndPlugin=[{state:"canUndo",plugin:"com.ibm.bi.authoring.undoBtn"},{state:"canRedo",plugin:"com.ibm.bi.authoring.redoBtn"},{state:"canRun",plugin:"com.ibm.bi.authoring.runBtn"},{state:"canRun",plugin:"com.ibm.bi.authoring.runMenu"},{state:"canRun",plugin:"com.ibm.bi.authoring.refreshBtn"}];v_aStateAndPlugin.forEach(function(v_o){this.enablePluginForApplicationState(v_o),v_Application.SharedState.AddObserver(v_sObserverId,v_o.state,this.enablePluginForApplicationState.bind(this,v_o))},this)},_on_isReportLoaded:function(){var v_Application=this.getAuthoringApplication();if(v_Application.SharedState.Get("useReadOnlyViewer")){this._setDisplayForPlugins(!1,v_aSpecModificationPluginIds);var v_oStateAndPlugin={state:"canRun",plugin:"com.ibm.bi.authoring.runBtn"};this.enablePluginForApplicationState(v_oStateAndPlugin),v_Application.SharedState.AddObserver(v_sObserverId,v_oStateAndPlugin.state,this.enablePluginForApplicationState.bind(this,v_oStateAndPlugin))}else{this._updateButtonState();var v_aLeftSideStateAndPlugin=[{state:"showInsertableObjects",plugin:"com.ibm.bi.authoring.insertableObjectsBtn"}];v_aLeftSideStateAndPlugin.forEach(function(v_o){this.highlightPluginForApplicationState(v_o),v_Application.SharedState.AddObserver(v_sObserverId,v_o.state,this.highlightPluginForApplicationState.bind(this,v_o))},this);var v_sToggleEditPluginId="com.ibm.bi.authoring.toggleEditViewer",v_oToggleEditButtonPlugin=this._hackFindPlugin(v_sToggleEditPluginId);if(v_oToggleEditButtonPlugin){var v_bIsViewer=v_Application.SharedState.Get("isViewer");v_bIsViewer?v_oToggleEditButtonPlugin.setUnpressed():v_oToggleEditButtonPlugin.setPressed(),this._updateToggleEditView(),v_Application.SharedState.AddObserver(v_sObserverId,"canToggleEditView",this._updateToggleEditView.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"canEditReport",this._updateToggleEditView.bind(this))}else console.log("could not find plugin: %s",v_sToggleEditPluginId)}this._updatePluginsForNewState();var v_oMRU,v_oDummyCmProperties={type:this.type};rsOpenHelper.isReport_ish(v_oDummyCmProperties)?this.objRef?(v_oMRU={},v_oMRU.id=this.objRef,v_oMRU.type=this.getAuthoringApplication().SharedState.Get("objectType"),v_oMRU.defaultName=this.getAuthoringApplication().SharedState.Get("reportName")):this.cmProperties&&(v_oMRU=$.extend(!0,{},this.cmProperties)):this.reportProperties&&(v_oMRU=$.extend(!0,{},this.reportProperties)),v_oMRU&&this._addToMRU(v_oMRU),this.updateTitle()},_addToMRU:function(mruEntry){return this.glassContext.getSvc(".Content").then(function(contentSvc){return contentSvc.addToMRU(mruEntry)})},_updateToggleEditView:function(){var v_Application=this.getAuthoringApplication();if(v_Application.SharedState.Get("canToggleEditView")&&v_Application.SharedState.Get("canEditReport")){var v_oPlugin=this.glassContext.findPlugin("com.ibm.bi.authoring.toggleEditViewer");v_oPlugin&&v_oPlugin.show()}},_on_isModified:function(){var v_oSharedState=this.getAuthoringApplication().SharedState,v_bCantSaveModified=!1,v_bIsModified=v_oSharedState.Get("isModified");if(v_bIsModified&&v_oSharedState.Get("isViewer")){var v_bRead=!this.cmProperties||!this.cmProperties.permissions||-1!=this.cmProperties.permissions.indexOf("read"),v_bWrite=!this.cmProperties||!this.cmProperties.permissions||-1!=this.cmProperties.permissions.indexOf("write"),v_bSaveAsCapabilities=this.glassContext.hasCapability("canUseReportStudio")&&this.glassContext.hasCapability("canUseReportStudioFileManagement");v_bCantSaveModified=!v_bRead||!v_bWrite&&!v_bSaveAsCapabilities}v_bCantSaveModified?(this.glassContext.showToast(this.getAuthoringApplication().GetString("IDS_MSG_EDITS_LOST"),{type:"info"}),this._setEnableForPlugins(!1,["com.ibm.bi.authoring.saveAsBtn"])):this._setEnableForPlugins(!0,["com.ibm.bi.authoring.saveAsBtn"]),this.trigger("change:dirty",{value:v_bIsModified})},updateTitle:function(){var v_sReportName=this.getAuthoringApplication().SharedState.Get("reportName");this.trigger("change:title",{value:v_sReportName})},_addGlassBodyObserver:function(){void 0===this.m_bIsIE&&(this.m_bIsIE=(-1!=navigator.userAgent.toLowerCase().search(/trident\/([0-9]+\.[0-9]+)/)?parseFloat(RegExp.$1):0)>=7),this.m_bIsIE&&(this.m_oBodyObserver=new MutationObserver(function(){var v_aClasses=["openedMenu","openedSlideout","openedAppViewSlideout","openedDialog"];v_aClasses.some(function(s){return this.contains(s)},document.body.classList)?this.m_iframeAuthoring.contentDocument.body.classList.add("clsGlassUiDisplayed"):this.m_iframeAuthoring.contentDocument.body.classList.remove("clsGlassUiDisplayed")}.bind(this)),this.m_oBodyObserver.observe(document.body,{attributes:!0,attributeFilter:["class"]}))},_removeGlassBodyObserver:function(){this.m_oBodyObserver&&(this.m_oBodyObserver.disconnect(),this.m_oBodyObserver=null)},show:function(){rsContentView.inherited("show",this,arguments),this.m_iframeAuthoring&&(setTimeout(rsIFrameManager.F_PositionAndSizeIFrame.bind(rsIFrameManager,this.$el,this.m_iframeAuthoring),0),this.getAuthoringApplication().Activate()),this._addGlassBodyObserver()},deactivate:function(){this._removeGlassBodyObserver(),this.m_iframeAuthoring&&(this.getAuthoringApplication().Deactivate(),rsIFrameManager.F_HideIFrame(this.m_iframeAuthoring))},remove:function(){var v_oApplication=this.getAuthoringApplication();return this.m_bIsTryIt&&v_oApplication.DeleteTempModule(this.moduleId),this.m_fOnWindowResize&&(window.removeEventListener("resize",this.m_fOnWindowResize,!1),this.m_fOnWindowResize=null),this.m_oRemoveAppViewLoadedHandler&&(this.m_oRemoveAppViewLoadedHandler.remove(),this.m_oRemoveAppViewLoadedHandler=void 0),this.m_iframeAuthoring&&(rsIFrameManager.F_DetachIFrame(this.m_iframeAuthoring),this.m_iframeAuthoring=null),this.m_oLaunchPromise=null,this.m_oAppView=null,!0},isMenuItemVisible:function(context){if(!this.getAuthoringApplication())return!0;var v_sMenuItem=context.target.itemId;if(v_sMenuItem){var v_oCurrentContentView=context.glassContext.currentAppView.currentContentView,v_bIsViewer=this.getAuthoringApplication().SharedState.Get("isViewer");switch(v_sMenuItem){case"com.ibm.bi.share.subscribe":if(!v_bIsViewer||!rsShareHelper.isShareable(v_oCurrentContentView,!1))return!1;break;case"com.ibm.bi.glass.common.setHome":if(!v_bIsViewer||!rsShareHelper.isShareable(v_oCurrentContentView,!1)||this.getAuthoringApplication().SharedState.Get("isActiveReport"))return!1}}return!0},addPdfCssPositionStyling:function(v_sPositionStyle){this.$el[0].style.position=v_sPositionStyle},removePdfCssPositionStyling:function(){this.$el[0].style.position=""},_onRSApplicationReady:function(v_oContentViewDeferred,v_idIFrameAuthoring){this.m_iframeAuthoring=document.getElementById(v_idIFrameAuthoring),console.timeEnd("rsperf: render->OnRSApplicationReadyForObservers"),rsPerformance.mark("rsContentView._onRSApplicationReady");var v_oApplication=this.getAuthoringApplication();this.glassContext.getCoreSvc(".UserProfile").getCapabilities().then(function(v_aCapabilities){v_oApplication.SetGlassInfo({glassView:this,glassContext:this.glassContext,launchParameters:this.m_oLaunchParameters,capabilities:v_aCapabilities}),handleTruthyValueAlreadySetOrAddObserver(v_oApplication,"isAppLoaded",this.onAppLoaded.bind(this)),v_oContentViewDeferred.resolve(this)}.bind(this))},_onRsLaunchError:function(v_oDeferred){console.log("rsContentView._onRsLaunchError(). "),this.hackUnlockGlass(),v_oDeferred.reject(new Error("rsContentView: error during iframe load"))},_hackFindPlugin:function(id){return rsCommon._hackFindPlugin(this.m_oAppView,id)},hackLockGlass:function(){this.m_bDisableRsLockUnlock||rsCommon.hackLockGlass(this.m_oAppView)},hackUnlockGlass:function(){this.m_bDisableRsLockUnlock||rsCommon.hackUnlockGlass(this.m_oAppView)},getReportSpec:function(){return this.m_sReportSpecFromOpener},launchInExploration:function(v_nReport,v_aSelectionIids,v_sReportSpec,v_sExploreStoreID){return require(["bi/authoring/utils/V5ToDashboard"],function(V5ToDashboard){var v_oAuthoringApp=this.getAuthoringApplication();return V5ToDashboard.LaunchInExploration(v_nReport,v_oAuthoringApp,v_aSelectionIids,v_sReportSpec,v_sExploreStoreID,this.glassContext).then(function(){})}.bind(this))},syncIFrameSizeToView:function(){this.m_iframeAuthoring&&"visible"==this.m_iframeAuthoring.style.visibility&&rsIFrameManager.F_PositionAndSizeIFrame(this.$el,this.m_iframeAuthoring)},getParameterValues:function(bStripCredentials){var v_oAuthoringApp=this.getAuthoringApplication(),v_aParameters=null,v_aAppParameters=v_oAuthoringApp.GetParameterValues();return v_aAppParameters&&(v_aParameters=[],v_aAppParameters.length>0&&v_aAppParameters.forEach(function(v_oParameter){bStripCredentials&&v_oParameter&&v_oParameter.name&&0==v_oParameter.name.indexOf("credential:")||v_aParameters.push(v_oParameter)})),v_aParameters},getParameters:function(){var v_oAuthoringApp=this.getAuthoringApplication();if(v_oAuthoringApp&&v_oAuthoringApp.SharedState.Get("isViewer")){if(v_oAuthoringApp.SharedState.Get("isActiveReport"))return{};var v_aParameters=this.getParameterValues(!0);return rsPromptParameters.convertParameterArrayToObject(v_aParameters)}return null},updateGlobalParameters:function(v_oNewGlobalParameters,v_oGlassContext){var v_Application=this.getAuthoringApplication();if(v_Application&&v_oNewGlobalParameters&&!v_Application.SharedState.Get("isActiveReport")){var v_aGlobalParameters=rsCommon.convertToArray(v_oGlassContext?v_oGlassContext.services.userProfile.userProfileSettings.parameter_values:null),v_sGlobalParameters=v_aGlobalParameters.length?JSON.stringify(v_aGlobalParameters):null,v_aGlobalParametersDelta=rsCommon.convertToArray(v_oNewGlobalParameters),v_sGlobalParametersDelta=v_aGlobalParametersDelta.length?JSON.stringify(v_aGlobalParametersDelta):null,v_oParameters={globalParameters:v_sGlobalParameters,globalParametersDelta:v_sGlobalParametersDelta};v_Application.SharedState.Call(null,"updateGlobalParameters",v_oParameters)}},getShareableItemsForCollaboration:function(){if(this.isApplicationLoaded()&&this.m_iframeAuthoring){var v_oAuthoringApp=this.getAuthoringApplication();if(v_oAuthoringApp){var doc=this.m_iframeAuthoring.contentDocument,body=doc.body;if(v_oAuthoringApp.SharedState.Get("isActiveReport")){var iframes=doc.querySelectorAll("iframe");iframes&&1===iframes.length&&(body=iframes[0].contentDocument.body)}return[{el:body,label:v_oAuthoringApp.SharedState.Get("reportName")}]}}return[]},_handleFirstAppViewOnLoaded:function(v_oDeferred,v_oEvent,v_sEventName){"appView:loaded"==v_sEventName&&v_oEvent&&v_oEvent.appView&&v_oEvent.appView==this.m_oAppView&&(console.info("rsContentView._handleFirstAppViewOnLoaded"),v_oDeferred.resolve(!0),this.m_oRemoveAppViewLoadedHandler.remove(),this.m_oRemoveAppViewLoadedHandler=void 0)},setFocus:function(){if(this.isApplicationLoaded()){var v_oApplication=this.getAuthoringApplication();v_oApplication&&v_oApplication.SharedState&&v_oApplication.SharedState.Get("isReportLoaded")&&v_oApplication.SetFocusToWorkarea()}else rsContentView.inherited("setFocus",this,arguments)}});return rsContentView}),define("bi/authoring/plugins/rsAppButtonActions",["bi/glass/app/plugins/ButtonActionInterface"],function(ButtonActionInterface){"use strict";var AuthoringButtonActionInterface=ButtonActionInterface.extend({onPress:function(context){var v_sObserverId="rsAppButtonActions";console.log("rsAppButtonActions pressed"),console.log("context.target.plugin.itemSpec.id: %s",context.target.plugin.itemSpec.id);var v_sId=context.target.plugin.itemSpec.id,v_oContentView=context.glassContext.currentAppView.currentContentView,v_Application=v_oContentView.getAuthoringApplication();if(v_Application){switch(v_sId){case"com.ibm.bi.authoring.undoBtn":v_Application.SharedState.Call(v_sObserverId,"undo");break;case"com.ibm.bi.authoring.redoBtn":v_Application.SharedState.Call(v_sObserverId,"redo");break;case"com.ibm.bi.authoring.insertableObjectsBtn":v_Application.SharedState.Toggle(v_sObserverId,"showInsertableObjects");break;case"com.ibm.bi.authoring.toggleEditViewer":v_Application.ToggleBetweenEditViewModes(v_sObserverId);break;case"com.ibm.bi.authoring.refreshBtn":var v_oParameters={Prompt:!1};v_Application.SharedState.Call(null,"refresh",v_oParameters);break;case"com.ibm.bi.authoring.consumptionFilter":v_Application.SharedState.Toggle(v_sObserverId,"showFilters");break;default:return void console.log("Unhandled label: "+v_sId)}v_Application.GlassButton_onPress(v_sId)}}});return AuthoringButtonActionInterface}),define("bi/authoring/plugins/rsAppMenuActions",["bi/glass/app/plugins/MenuActionInterface"],function(MenuActionInterface){"use strict";var AuthoringMenu=MenuActionInterface.extend({onSelectItem:function(context){var v_sMenuItem=context.target.itemId;console.log("rsAppMenu.onSelectItem selected item %s",v_sMenuItem);var v_Application=context.glassContext.currentAppView.currentContentView.getAuthoringApplication();if(v_Application){switch(v_sMenuItem){case"com.ibm.bi.authoring.editOverflow_resetParameters":case"com.ibm.bi.authoring.editOverflow_clearParameters":var v_oParameters={Prompt:!1};v_Application.SharedState.Call(null,v_sMenuItem.substring(v_sMenuItem.lastIndexOf("_")+1),v_oParameters);break;case"com.ibm.bi.datasets.editOverflow_setParameters":v_Application.SharedState.Call(null,v_sMenuItem.substring(v_sMenuItem.lastIndexOf("_")+1));break;default:return void console.log("unhandled menu item")}var v_targetId=context.target.plugin&&context.target.plugin.id;v_targetId&&v_Application.GlassButton_onPress(v_targetId),v_Application.GlassMenu_onSelectItem(v_sMenuItem)}},isItemVisible:function(context){var v_sMenuItem=context.target.itemId;console.log("rsAppMenu.isItemVisible item %s",v_sMenuItem);var v_Application=context.glassContext.currentAppView.currentContentView.getAuthoringApplication();if(!v_Application)return!1;switch(v_sMenuItem){case"com.ibm.bi.datasets.editOverflow_setParameters":return"datasets"==context.glassContext.currentAppView.currentContentView.perspective;case"com.ibm.bi.authoring.editOverflow_conditionalStyles":case"com.ibm.bi.authoring.editOverflow_clearParameters":if(v_Application.SharedState.Get("isViewer"))return!1}return!0}});return AuthoringMenu}),define("bi/authoring/plugins/rsAppRunMenuActions",["bi/glass/app/plugins/MenuActionInterface"],function(MenuActionInterface){"use strict";var AuthoringMenu=MenuActionInterface.extend({onSelectItem:function(context){var v_sMenuItem=context.target.itemId;console.log("rsAppRunMenu.onSelectItem selected item "+v_sMenuItem);var v_Application=context.glassContext.currentAppView.currentContentView.getAuthoringApplication();if(v_Application){switch(v_sMenuItem){case"com.ibm.bi.authoring.run_show_run_options":return void window.setTimeout(v_Application.ShowRunOptions.bind(v_Application),0);case"com.ibm.bi.viewer.run":case"com.ibm.bi.viewer.runHtml":case"com.ibm.bi.viewer.run_html_ar":case"com.ibm.bi.viewer.runPdf":var v_oParameters={Prompt:"com.ibm.bi.viewer.run"==v_sMenuItem};switch(v_sMenuItem){case"com.ibm.bi.viewer.runHtml":case"com.ibm.bi.viewer.run_html_ar":v_oParameters.OutputFormat="HTML";break;case"com.ibm.bi.viewer.runPdf":v_oParameters.OutputFormat="PDF"}v_Application.SharedState.Call(null,v_sMenuItem.substring(v_sMenuItem.lastIndexOf(".")+1),v_oParameters);break;case"com.ibm.bi.authoring.run_html":case"com.ibm.bi.authoring.run_pdf":case"com.ibm.bi.authoring.run_excel2007":case"com.ibm.bi.authoring.run_excel2007data":case"com.ibm.bi.authoring.run_csv":case"com.ibm.bi.authoring.run_html_ar":case"com.ibm.bi.authoring.run_html_ar_download":case"com.ibm.bi.authoring.run_xml":case"com.ibm.bi.viewer.run_excel2007":case"com.ibm.bi.viewer.run_excel2007data":case"com.ibm.bi.viewer.run_csv":case"com.ibm.bi.viewer.run_html_ar_download":case"com.ibm.bi.viewer.run_xml":var v_oParameters={OutputFormat:null},v_bViewerAction=v_sMenuItem.indexOf(".viewer.")>0;v_bViewerAction&&(v_oParameters.Prompt=!1);var v_bRunInNewViewer=v_bViewerAction||v_Application.SharedState.Get("runInAdvancedViewer");switch(v_sMenuItem){case"com.ibm.bi.authoring.run_html_ar":v_oParameters.OutputFormat="HTML",v_oParameters.Download="false",v_oParameters.isApplication=v_Application.SharedState.Get("isActiveReport");break;case"com.ibm.bi.authoring.run_html_ar_download":case"com.ibm.bi.viewer.run_html_ar_download":v_oParameters.OutputFormat="HTML",v_oParameters.Download="true",v_oParameters.isApplication=v_Application.SharedState.Get("isActiveReport");break;case"com.ibm.bi.authoring.run_html":v_oParameters.OutputFormat="HTML",v_bRunInNewViewer&&(v_oParameters.isViewer=!0);break;case"com.ibm.bi.authoring.run_pdf":v_oParameters.OutputFormat="PDF",v_bRunInNewViewer&&(v_oParameters.isViewer=!0);break;case"com.ibm.bi.authoring.run_excel2007":case"com.ibm.bi.viewer.run_excel2007":v_oParameters.OutputFormat="spreadsheetML",v_bRunInNewViewer&&(v_oParameters.Download="true");break;case"com.ibm.bi.authoring.run_excel2007data":case"com.ibm.bi.viewer.run_excel2007data":v_oParameters.OutputFormat="xlsxData",v_bRunInNewViewer&&(v_oParameters.Download="true");break;case"com.ibm.bi.authoring.run_csv":case"com.ibm.bi.viewer.run_csv":v_oParameters.OutputFormat="CSV",v_bRunInNewViewer&&(v_oParameters.Download="true");break;case"com.ibm.bi.authoring.run_xml":case"com.ibm.bi.viewer.run_xml":v_oParameters.OutputFormat="XML",v_bRunInNewViewer&&(v_oParameters.Download="true");break;default:var v_sIdxValue=v_sMenuItem.indexOf("_"),v_sValue=v_sMenuItem.slice(v_sIdxValue+1);console.warn("using implicit output format: %s",v_sValue)}v_bViewerAction||(v_oParameters.isFromRS=!0),v_Application.SharedState.Call(null,"runInNewWindow",v_oParameters);break;default:return void console.warn("Unhandled item: "+v_sMenuItem)}v_Application.GlassMenu_onSelectItem(v_sMenuItem)}},isItemVisible:function(context){console.log("rsAppRunMenu.isItemVisible");var v_sMenuItem=context.target.itemId;console.log("v_sMenuItem: "+v_sMenuItem);var v_Application=context.glassContext.currentAppView.currentContentView.getAuthoringApplication();if(!v_Application)return!1;var v_bCanRun=v_Application.SharedState.Get("canRun"),v_bActiveReport=v_Application.SharedState.Get("isActiveReport"),v_bIsViewer=v_Application.SharedState.Get("isViewer");switch(v_sMenuItem){case"com.ibm.bi.viewer.run":case"com.ibm.bi.authoring.refresh":return!1;case"com.ibm.bi.authoring.run_html_ar":return v_bActiveReport&&v_bCanRun;case"com.ibm.bi.authoring.run_html_ar_download":case"com.ibm.bi.viewer.run_html_ar_download":return v_bActiveReport&&v_bCanRun;case"com.ibm.bi.authoring.run_show_run_options":case"com.ibm.bi.viewer.run_html_ar":return v_bCanRun&&!v_bIsViewer;case"com.ibm.bi.authoring.run_csv":case"com.ibm.bi.viewer.run_csv":return!v_bActiveReport&&v_bCanRun&&context.glassContext.hasCapability("canGenerateCSVOutput");case"com.ibm.bi.viewer.runPdf":return!v_bActiveReport&&v_bCanRun&&context.glassContext.hasCapability("canGeneratePDFOutput");case"com.ibm.bi.authoring.run_pdf":return!v_bActiveReport&&v_bCanRun&&context.glassContext.hasCapability("canGeneratePDFOutput");case"com.ibm.bi.authoring.run_html":return!v_bActiveReport&&v_bCanRun;case"com.ibm.bi.viewer.runHtml":return!v_bActiveReport&&v_bCanRun;case"com.ibm.bi.authoring.run_xml":case"com.ibm.bi.viewer.run_xml":return!v_bActiveReport&&v_bCanRun&&context.glassContext.hasCapability("canGenerateXMLOutput");case"com.ibm.bi.authoring.run_excel2007":case"com.ibm.bi.authoring.run_excel2007data":case"com.ibm.bi.viewer.run_excel2007":case"com.ibm.bi.viewer.run_excel2007data":return!v_bActiveReport&&v_bCanRun&&context.glassContext.hasCapability("canGenerateXLSOutput");default:return!v_bActiveReport&&v_bCanRun}}});return AuthoringMenu}),define("bi/authoring/plugins/rsAppSaveAsMenuActions",["bi/glass/app/plugins/MenuActionInterface"],function(MenuActionInterface){"use strict";var AuthoringMenu=MenuActionInterface.extend({onSelectItem:function(context){var v_sMenuItem=context.target.itemId,v_Application=context.glassContext.currentAppView.currentContentView.getAuthoringApplication();if(v_Application){switch(v_sMenuItem){case"com.ibm.bi.authoring.save_as":v_Application.SaveAsReport();break;case"com.ibm.bi.authoring.convert_to_active_report":v_Application.ConvertToActiveReport();break;case"com.ibm.bi.authoring.convert_to_template":v_Application.ConvertToTemplate();break;case"com.ibm.bi.authoring.save_as_report_view":v_Application.SaveAsReportView();break;case"com.ibm.bi.authoring.save":case"com.ibm.bi.datasets.dataset_save":var v_oCmProperties=context.glassContext.currentAppView.currentContentView.cmProperties;if("com.ibm.bi.authoring.save"==v_sMenuItem&&v_Application.SharedState.Get("isViewer")&&v_oCmProperties&&-1==v_oCmProperties.permissions.indexOf("read")){context.glassContext.showToast(v_Application.GetString("IDS_MSG_NO_PERMISSIONS_TO_SAVE"),{type:"error"});break}v_oCmProperties&&-1==v_oCmProperties.permissions.indexOf("write")?"com.ibm.bi.authoring.save"==v_sMenuItem&&v_Application.SharedState.Get("isViewer")&&context.glassContext.hasCapability("canUseReportStudio")&&context.glassContext.hasCapability("canUseReportStudioFileManagement")?v_Application.SaveAsReport():context.glassContext.showToast(v_Application.GetString("IDS_MSG_NO_PERMISSIONS_TO_SAVE"),{type:"error"}):v_Application.Save();break;case"com.ibm.bi.datasets.refresh":v_Application.SaveDataSet(function(v_sFileName,v_sStoreID){var options={id:v_sStoreID,name:v_sFileName,showToastWhenDone:!0,glassContext:context.glassContext};context.glassContext.getSvc(".DatasetExecutionService").then(function(DatasetExecutionService){DatasetExecutionService.execute(options)})});break;default:return void console.warn("Unhandled item: "+v_sMenuItem)}v_Application.GlassMenu_onSelectItem(v_sMenuItem)}},isItemVisible:function(context){var v_sMenuItem=context.target.itemId,v_Application=context.glassContext.currentAppView.currentContentView.getAuthoringApplication();if(v_Application){var v_bResult,v_oCmProperties=context.glassContext.currentAppView.currentContentView.cmProperties,v_bRead=!v_oCmProperties||-1!=v_oCmProperties.permissions.indexOf("read");switch(v_sMenuItem){case"com.ibm.bi.authoring.save_as_report_view":v_bResult=v_Application.SharedState.Get("isViewer")&&v_Application.SharedState.Get("cmSearchPath")&&!v_Application.SharedState.Get("isModified");break;case"com.ibm.bi.datasets.dataset_save":v_bResult=v_Application.SharedState.Get("isModified");break;case"com.ibm.bi.authoring.save":v_bResult=!1;break;case"com.ibm.bi.authoring.save_as":v_bResult=context.glassContext.hasCapability("canUseReportStudio")&&context.glassContext.hasCapability("canUseReportStudioFileManagement")?v_Application.SharedState.Get("isViewer")?v_bRead:!0:!1;break;case"com.ibm.bi.datasets.refresh":v_bResult=v_Application.SharedState.Get("isModified");break;case"com.ibm.bi.authoring.convert_to_active_report":v_bResult=!v_Application.SharedState.Get("isViewer")&&!v_Application.SharedState.Get("isActiveReport");break;case"com.ibm.bi.authoring.convert_to_template":v_bResult=!v_Application.SharedState.Get("isViewer");break;default:v_bResult=!0}return v_bResult}}});return AuthoringMenu}),define("bi/authoring/utils/rsSaveReportView",["q","bi/authoring/nls/StringResource"],function(Q,StringResource){"use strict";return{saveReportView:function(v_oCmProperties,v_oContext){var v_oSaveDeferred=Q.defer();return require(["bi/commons/ui/content/dialog/SaveAsDialog"],function(SaveAsDialog){var v_oDialog=new SaveAsDialog({glassContext:v_oContext.glassContext,defaultFileName:StringResource.get("powerPlay8Report"===v_oCmProperties.type?"powerplay_view_of":"report_view_of",{reportName:v_oCmProperties.defaultName}),ancestors:v_oCmProperties.ancestors,service:{context:v_oContext,inheritBaseProperties:function(oData){var deferred=Q.defer();if("reportView"===oData.type){var sUrl;sUrl=v_oCmProperties._meta?v_oCmProperties._meta.links.self.url:v_oCmProperties.selfUrl,v_oContext.glassContext.services.ajax.ajax({url:sUrl+"?fields=executionFormat,executionLocale,options,parameters",dataType:"json",type:"GET"}).then(function(response){var data=response.data[0];oData.executionFormat=data.executionFormat,oData.executionLocale=data.executionLocale,oData.options=data.options,oData.parameters=data.parameters,deferred.resolve()},function(error){deferred.reject(error)})}else deferred.resolve();return deferred.promise},save:function(v_oService,v_oSelection,v_sName,v_bOverwrite){v_oDialog.hide();var v_oData={type:"powerPlay8Report"===v_oCmProperties.type?"powerPlay8ReportView":"reportView",defaultName:v_sName,base:[{searchPath:'storeID("'+v_oCmProperties.id+'")',type:"baseClass"}]},v_oDeferred=Q.defer();return this.inheritBaseProperties(v_oData).then(function(){var v_sUrl=v_oSelection.url+"?updateAction="+(v_bOverwrite?"replace":"fail");v_oService.context.glassContext.services.ajax.post(v_sUrl,{contentType:"application/json",processData:!1,dataType:"text",data:JSON.stringify(v_oData)}).fail(function(d,request){var v_oResponse=request.responseJSON;!v_oResponse&&request.responseText&&(v_oResponse=JSON.parse(request.responseText)),"cmDuplicateName"===v_oResponse.errorCode?v_oDeferred.reject({isDuplicate:!0}):(v_oDeferred.reject(),v_oSaveDeferred.reject())}).done(function(v_oResult){try{v_oContext.target.plugin.activeObject.oListControl.contentView.refresh()}catch(e){}v_oDeferred.resolve(v_oResult),v_oSaveDeferred.resolve(v_oResult)})},function(){v_oDeferred.reject(),v_oSaveDeferred.reject()}),v_oDeferred.promise}}});v_oDialog.open()}),v_oSaveDeferred.promise}}}),define("bi/authoring/plugins/rsContextMenuActions",["bi/glass/app/plugins/MenuActionInterface","jquery","q","bi/authoring/utils/rsOpenHelper","bi/authoring/utils/rsShareHelper","bi/authoring/utils/rsPerformance","bi/authoring/utils/rsSaveReportView"],function(MenuActionInterface,$,Q,OpenHelper,ShareHelper,rsPerformance,rsSaveReportView){"use strict";var rsContextMenuActions=MenuActionInterface.extend({isItemVisible:function(context){if(!context.target)return!1;if(!context.target.activeObject&&!context.target.objectInformation)return!1;var v_oCMInfo;if(context.target.activeObject){var v_aSelectedContext=context.target.activeObject.aSelectedContext;if(1!==v_aSelectedContext.length)return!1;v_oCMInfo=v_aSelectedContext[0]}else context.target.objectInformation&&(v_oCMInfo=context.target.objectInformation);"string"==typeof v_oCMInfo.disabled&&(v_oCMInfo.disabled="true"==v_oCMInfo.disabled?!0:"false"==v_oCMInfo.disabled?!1:v_oCMInfo.disabled);var v_sCapabilityToCheck="canUseReportStudio",v_sPermission="read";switch(context.target.itemId){case"com.ibm.bi.authoring.convertToReport":if(-1===["analysis","query"].indexOf(v_oCMInfo.type))return!1;break;case"com.ibm.bi.authoring.createReportFromModule":if("module"!==v_oCMInfo.type)return!1;if(v_oCMInfo.disabled)return!1;break;case"com.ibm.bi.authoring.createReportFromPackage":if("package"!==v_oCMInfo.type)return!1;if(v_oCMInfo.disabled)return!1;if(!v_oCMInfo.effectiveUserCapabilities||-1===v_oCMInfo.effectiveUserCapabilities.indexOf(v_sCapabilityToCheck))return!1;break;case"com.ibm.bi.datasets.editDataset":if("dataSet2"!==v_oCMInfo.type)return!1;v_sCapabilityToCheck="canUseMyDataSets";break;case"com.ibm.bi.authoring.editReport":if(-1===["interactiveReport","report","reportTemplate"].indexOf(v_oCMInfo.type))return!1;if("report"===v_oCMInfo.type&&v_oCMInfo.metadataModelPackage&&v_oCMInfo.metadataModelPackage[0]&&v_oCMInfo.metadataModelPackage[0].effectiveUserCapabilities&&-1===v_oCMInfo.metadataModelPackage[0].effectiveUserCapabilities.indexOf(v_sCapabilityToCheck))return!1;break;case"com.ibm.bi.authoring.saveAsReportView":if(-1===["interactiveReport","report","query","analysis"].indexOf(v_oCMInfo.type))return!1;v_sCapabilityToCheck=void 0,v_sPermission=void 0;break;case"com.ibm.bi.authoring.saveAsPowerPlayView":if("powerPlay8Report"!==v_oCMInfo.type)return!1;v_sCapabilityToCheck=void 0,v_sPermission=void 0;break;case"com.ibm.bi.contentApps.action.runAs":if(-1===["interactiveReport","report","reportView","query","analysis","powerPlay8Report","powerPlay8ReportView"].indexOf(v_oCMInfo.type))return!1;if(v_sCapabilityToCheck="canUseCognosViewerRunWithOptions",v_sPermission="execute","reportView"===v_oCMInfo.type){if(null===v_oCMInfo.base)return!1;if(v_oCMInfo.base[0]&&v_oCMInfo.base[0].permissions&&-1===v_oCMInfo.base[0].permissions.indexOf(v_sPermission))return!1}break;case"com.ibm.bi.contentApps.defaultAction.interactiveReport":case"com.ibm.bi.contentApps.defaultAction.report":case"com.ibm.bi.contentApps.defaultAction.dataSet2":case"com.ibm.bi.contentApps.defaultAction.reportTemplate":case"com.ibm.bi.contentApps.defaultAction.reportView":case"com.ibm.bi.contentApps.defaultAction.query":case"com.ibm.bi.contentApps.defaultAction.analysis":return context.target.itemId.indexOf(v_oCMInfo.type)>0&&null!==OpenHelper.determineDefaultAction(context.target.itemId,v_oCMInfo,context.glassContext);case"com.ibm.bi.datasets.createDataSetFromModule":if("module"!==v_oCMInfo.type)return!1;if(v_oCMInfo.disabled)return!1;v_sCapabilityToCheck="canUseMyDataSets";break;case"com.ibm.bi.datasets.createDataSetFromPackage":if("package"!==v_oCMInfo.type)return!1;if(v_oCMInfo.disabled)return!1;v_sCapabilityToCheck="canUseMyDataSets";break;case"com.ibm.bi.datasets.datasets-divider-top":case"com.ibm.bi.datasets.datasets-divider-bottom":return!0;default:return!1}if(v_sCapabilityToCheck&&!context.glassContext.hasCapability(v_sCapabilityToCheck))return!1;var v_aPermissions=v_oCMInfo.permissions;return v_aPermissions?v_sPermission&&-1==v_aPermissions.indexOf(v_sPermission)?!1:!0:!1},isVisible:function(context){var v_bShareable=!1;if(context&&context.target&&context.target.itemId&&context.glassContext)switch(context.target.itemId){case"com.ibm.bi.glass.common.shareContextual":v_bShareable=!0;break;case"com.ibm.bi.glass.common.embedContextual":if(context.target.activeObject){var v_oCmProperties=context.target.activeObject.aSelectedContext[0];v_oCmProperties&&"dataSet2"!==v_oCmProperties.type&&(v_bShareable=!0)}break;case"com.ibm.bi.glass.common.operations.shareCurrent":case"com.ibm.bi.glass.common.operations.embedCurrent":var v_oCurrentContentView=context.glassContext.currentAppView.currentContentView;v_bShareable=ShareHelper.isShareable(v_oCurrentContentView,"com.ibm.bi.glass.common.operations.embedCurrent"===context.target.itemId);break;default:console.log("Unsupported isVisible menu action item : "+context.target.itemId)}return v_bShareable},execute:function(context){var v_oCmProperties,deferred=Q.defer();context.target&&context.target.activeObject?v_oCmProperties=context.target.activeObject.aSelectedContext[0]:context.target&&context.target.objectInformation&&(v_oCmProperties=context.target.objectInformation);
var v_fExecute,v_oCurrentContentView=context.glassContext&&context.glassContext.currentAppView&&context.glassContext.currentAppView.currentContentView,v_oOpenSpec={cmProperties:v_oCmProperties,mode:context.mode,glassContext:context.glassContext,contentView:v_oCurrentContentView};return"defaultAction"==context.mode?(v_oOpenSpec.cmProperties=v_oOpenSpec.cmProperties||{id:context.urlMap.id,type:context.urlMap.type},v_oOpenSpec.urlMap=context.urlMap,v_fExecute=OpenHelper.getPerspective):(v_oOpenSpec.cmProperties=v_oOpenSpec.cmProperties||v_oCurrentContentView.cmProperties,v_fExecute=ShareHelper.getShareUrlMap),v_fExecute(v_oOpenSpec)["catch"](function(err){console.log("rsContextMenuActions.execte ... FAILED."),deferred.reject(err)}).done(function(v_oUrlMap){deferred.resolve(v_oUrlMap)}),deferred.promise},doAction:function(context){var $dfd=$.Deferred();return this.onSelectItem(context)["catch"](function(err){console.log("rsContextMenuActions.doAction ... FAILED"),$dfd.reject(err)}).done(function(result){$dfd.resolve(result)}),$dfd.promise()},canExecute:function(context){return this.isItemVisible(context)},onSelectItem:function(context){rsPerformance.clearMeasures(),rsPerformance.clearMarks(),rsPerformance.mark("authoring-selectItemAndDraw-start"),rsPerformance.mark("rsContextMenuActions.onSelectItem"),console.time("rsperf: total_RunReport"),console.time("rsperf: onSelectItem->render");var v_oCmProperties,deferred=Q.defer();if(context.target&&context.target.activeObject)v_oCmProperties=context.target.activeObject.aSelectedContext[0];else{if(!context.target||!context.target.objectInformation)return console.log("rsContextMenuActions.onSelectItem ... FAILED -- no target"),deferred.reject(new Error(context.target.toString())),deferred.promise;v_oCmProperties=context.target.objectInformation}return"com.ibm.bi.authoring.saveAsReportView"===context.target.itemId||"com.ibm.bi.authoring.saveAsPowerPlayView"===context.target.itemId?rsSaveReportView.saveReportView(v_oCmProperties,context)["catch"](function(err){deferred.reject(err)}).done(function(result){deferred.resolve(result)}):OpenHelper.openView({cmProperties:v_oCmProperties,actionId:context.target.itemId,glassContext:context.glassContext,runOptions:context.target.runOptions})["catch"](function(err){console.log("rsContextMenuActions.onSelectItem ... FAILED"),deferred.reject(err)}).done(function(result){deferred.resolve(result)}),deferred.promise},getShareableItems:function(context){var items=[],view=context.glassContext.getCurrentContentView();return view&&view.getShareableItemsForCollaboration&&(items=view.getShareableItemsForCollaboration()),Q.resolve(items)}});return rsContextMenuActions}),define("bi/authoring/plugins/rsCreateMenuActions",["bi/glass/app/plugins/MenuActionInterface"],function(MenuActionInterface){var CreateReportMenu=MenuActionInterface.extend({onSelectItem:function(context){var v_sMenuItem=context.target.itemId;console.log("CreateReportMenu, "+v_sMenuItem+", selected"),console.log("CREATE TEMPLATE SELECTED."),context.glassContext.openAppView("authoring",{content:{id:Date.now().toString()}})},isItemVisible:function(context){return console.log("rsAppRunMenu.isItemVisible"),context.glassContext.hasCapability("canUseReportStudio")?!0:!1}});return CreateReportMenu}),define("bi/authoring/utils/U_Object",[],function(){var U_Object={};return U_Object.F_IsEmpty=function(o){for(var s in o)return!1;return!0},U_Object.F_ToValueArray=Object.values?function(o){return Object.values(o)}:function(o){var a=[];for(var s in o)a.push(o[s]);return a},U_Object.F_GetLength=function(o){var i=0;for(var s in o)i++;return i},U_Object.F_Copy=Object.assign?function(o){return Object.assign({},o)}:function(o){var v_oCopy={};for(var s in o)v_oCopy[s]=o[s];return v_oCopy},U_Object.F_TypeOf=function(v){var s=typeof v;if("object"==s){if(!v)return"null";if(Array.isArray(v))return"array"}return s},U_Object.F_Clone=function(o){switch(this.F_TypeOf(o)){case"number":case"string":case"boolean":case"undefined":return o;case"object":var v_oClone={};for(var s in o)o.hasOwnProperty(s)&&(v_oClone[s]=this.F_Clone(o[s]));return v_oClone;case"array":for(var v_aClone=[],v_iLength=o.length,i=0;v_iLength>i;i++)v_aClone[i]=this.F_Clone(o[i]);return v_aClone;case"function":}},U_Object.F_Subtract=function(o1,o2){var v_oNew=this.F_Copy(o1);for(var s in o2)delete v_oNew[s];return v_oNew},U_Object.F_Compare=function(o1,o2){if(this.F_GetLength(o1)!=this.F_GetLength(o2))return!1;for(var v_sPropName in o1){if("undefined"==typeof o2[v_sPropName])return!1;var v_oVal1=o1[v_sPropName],v_oVal2=o2[v_sPropName],v_bEqual=!1;switch(typeof o1[v_sPropName]){case"object":v_bEqual=this.F_Compare(v_oVal1,v_oVal2);break;case"function":v_bEqual=v_oVal1.toString()===v_oVal2.toString();break;default:v_bEqual=v_oVal1===v_oVal2}if(!v_bEqual)return!1}return!0},U_Object}),define("bi/authoring/utils/U_Blocker",[],function(){var m_divEventBlocker,K_iKeyTab=9,f_stopTabKey=function(e){e.keyCode==K_iKeyTab&&(e.preventDefault(),e.stopPropagation())},U_Blocker={};return U_Blocker.F_ShowEventBlocker=function(v_iZIndex){return m_divEventBlocker||(m_divEventBlocker=document.body.appendChild(document.createElement("DIV")),m_divEventBlocker.onkeydown=f_stopTabKey,m_divEventBlocker.style.position="absolute",m_divEventBlocker.style.left="0",m_divEventBlocker.style.top="0",m_divEventBlocker.style.width="100%",m_divEventBlocker.style.height="100%"),m_divEventBlocker.style.zIndex=v_iZIndex,m_divEventBlocker.style.visibility="visible",m_divEventBlocker},U_Blocker.F_HideEventBlocker=function(){m_divEventBlocker&&(m_divEventBlocker.style.visibility="hidden",["onmousedown","onmouseup","onmousemove","onclick","ondblclick","onmouseover","onmouseout"].forEach(function(s){this[s]=null},m_divEventBlocker))},U_Blocker}),define("bi/authoring/utils/U_ClearableTimeout",[],function(){var f_timeoutHandler=function(v_fn,v_oTimeoutHandle){null!==v_oTimeoutHandle.m_iTimeoutId&&(v_oTimeoutHandle.m_iTimeoutId=null,v_fn())},U_ClearableTimeout={};return U_ClearableTimeout.F_Create=function(v_fn,v_iTimeout){var v_oTimeoutHandle={};return v_oTimeoutHandle.m_iTimeoutId=setTimeout(f_timeoutHandler.bind(this,v_fn,v_oTimeoutHandle),v_iTimeout),v_oTimeoutHandle},U_ClearableTimeout.F_Clear=function(v_oTimeoutHandle){if(v_oTimeoutHandle.m_iTimeoutId){var v_iTimeoutId=v_oTimeoutHandle.m_iTimeoutId;v_oTimeoutHandle.m_iTimeoutId=null,clearTimeout(v_iTimeoutId)}},U_ClearableTimeout}),define("bi/authoring/utils/rsPromptHandler",["bi/authoring/utils/pat/rsLaunchParameters","bi/authoring/utils/U_Blocker","bi/authoring/utils/U_Object","bi/authoring/utils/U_ClearableTimeout"],function(rsLaunchParameters,U_Blocker,U_Object,U_ClearableTimeout){var rsPromptHandler={};return rsPromptHandler.k_iPollPromptWindow=1e3,rsPromptHandler.m_oPromptListeners={},rsPromptHandler.m_oPromptWindows={},rsPromptHandler.m_iPromptId=0,rsPromptHandler.f_getPromptId=function(){return++this.m_iPromptId},rsPromptHandler.f_createSoapPromptLaunchParameters=function(v_docSOAPResponse,v_fnOkCallback){return this.f_createPromptLaunchParameters(v_docSOAPResponse,null,v_fnOkCallback)},rsPromptHandler.f_createPromptLaunchParameters=function(v_docSOAPResponse,v_oRequest,v_fnOkCallback){var v_oLaunchParameters={promptFnOkCallback:v_fnOkCallback,reportXML:null};return v_docSOAPResponse&&(v_oLaunchParameters.promptSOAPResponse=(new XMLSerializer).serializeToString(v_docSOAPResponse)),v_oRequest&&(v_oLaunchParameters.promptRequest=v_oRequest),v_oLaunchParameters},rsPromptHandler.f_createRestPromptLaunchParameters=function(v_oRequest,v_fnOkCallback){return this.f_createPromptLaunchParameters(null,v_oRequest,v_fnOkCallback)},rsPromptHandler.f_prompting_OkCallback=function(v_sPromptId,v_oResponse,v_oAttachments,v_sParameters,v_oOpener){var pdsState={v_sClientContext:v_sPromptId,response:v_oResponse,attachments:v_oAttachments,parameters:v_sParameters,opener:v_oOpener},v_oOpener=null;"Cancel"!=pdsState.state&&(pdsState.parameters,this.m_oPromptListeners[pdsState.v_sClientContext].F_SetPromptCallbackResponse&&this.m_oPromptListeners[pdsState.v_sClientContext].F_SetPromptCallbackResponse(pdsState.response,pdsState.attachments),v_oOpener=pdsState.opener);var v_sClientContext=pdsState.v_sClientContext;if(!v_sClientContext)for(var s in this.m_oPromptWindows)v_sClientContext=s;if(this.m_iLastPromptTimeoutId&&(U_ClearableTimeout.F_Clear(this.m_iLastPromptTimeoutId),this.m_iLastPromptTimeoutId=null),setTimeout(function(v_sClientContext){this.f_fireOnPromptingComplete(v_sClientContext),v_oOpener&&v_oOpener.close()}.bind(rsPromptHandler,v_sClientContext),0),delete this.m_oPromptWindows[v_sClientContext],U_Object.F_IsEmpty(this.m_oPromptWindows))U_Blocker.F_HideEventBlocker();else for(var s in this.m_oPromptWindows){this.m_oPromptWindows[s].focus();break}},rsPromptHandler.F_DoPrompting=function(v_oListener,v_docSOAPResponse,v_oGlassContext){var v_frmPrompting,v_sUrl,v_oLaunchParameters,v_sPromptId=this.f_getPromptId();v_oLaunchParameters=this.f_createSoapPromptLaunchParameters(v_docSOAPResponse,this.f_prompting_OkCallback.bind(this,v_sPromptId)),v_oLaunchParameters.promptOutputPages=v_oListener.getOutputPages(v_docSOAPResponse);var v_oContext={urlMap:{perspective:"authoring",isViewer:!0,UIProfile:"Titan",promptResponse:"promptPage",ui_appbar:!1,ui_navbar:!1,launchParametersKey:rsLaunchParameters.Store(v_oLaunchParameters)}};return v_sUrl=v_oGlassContext.getUrl(v_oContext),this.f_launchPrompt(v_oListener,v_sUrl,v_frmPrompting,v_oLaunchParameters,v_sPromptId)},rsPromptHandler.f_onPromptBlockerMouseDown=function(){for(var s in this.m_oPromptWindows)return void this.m_oPromptWindows[s].focus();U_Blocker.F_HideEventBlocker()},rsPromptHandler.f_launchPrompt=function(v_oListener,v_sUrl,v_frmPrompting,v_oLaunchParameters,v_sPromptId){var v_elBlocker=U_Blocker.F_ShowEventBlocker(1e6);return v_elBlocker.onmousedown=this.f_onPromptBlockerMouseDown.bind(this),this.m_oPromptListeners[v_sPromptId]=v_oListener,this.m_oPromptWindows[v_sPromptId]=window.open(v_sUrl,v_frmPrompting?v_frmPrompting.target:"_blank","directories=no,location=no,status=no,toolbar=no,resizable=yes,scrollbars=yes,top=100,left=100,height=600,width=1000"),Boolean(this.m_oPromptWindows[v_sPromptId])?(this.m_oPromptWindows[v_sPromptId].focus(),v_frmPrompting&&v_frmPrompting.submit(),v_oLaunchParameters&&(v_oLaunchParameters.promptOpener=this.m_oPromptWindows[v_sPromptId]),this.m_iLastPromptTimeoutId=U_ClearableTimeout.F_Create(this.f_checkPromptingWindowState.bind(this,v_sPromptId),this.k_iPollPromptWindow),!0):(U_Blocker.F_HideEventBlocker(),!1)},rsPromptHandler.f_checkPromptingWindowState=function(v_sPromptId){if(this.m_iLastPromptTimeoutId=null,this.m_oPromptWindows[v_sPromptId]){var v_bWindowClosed=!1;try{v_bWindowClosed=this.m_oPromptWindows[v_sPromptId].closed}catch(e){v_bWindowClosed=!0}if(v_bWindowClosed){if(delete this.m_oPromptWindows[v_sPromptId],U_Object.F_IsEmpty(this.m_oPromptWindows))U_Blocker.F_HideEventBlocker();else for(var s in this.m_oPromptWindows){this.m_oPromptWindows[s].focus();break}setTimeout(this.f_fireOnPromptingComplete.bind(this,v_sPromptId),0)}else this.m_iLastPromptTimeoutId=U_ClearableTimeout.F_Create(this.f_checkPromptingWindowState.bind(this,v_sPromptId),this.k_iPollPromptWindow)}},rsPromptHandler.f_OnUnLoad=function(v_fOnUnLoad){for(var v_sPromptId in this.m_oPromptWindows){var v_bWindowClosed=!1;try{v_bWindowClosed=this.m_oPromptWindows[v_sPromptId].closed}catch(e){v_bWindowClosed=!0}if(!v_bWindowClosed)try{this.m_oPromptWindows[v_sPromptId].close()}catch(e){}delete this.m_oPromptWindows[v_sPromptId]}v_fOnUnLoad&&v_fOnUnLoad()},rsPromptHandler.f_fireOnPromptingComplete=function(v_sClientContext){this.m_oPromptListeners[v_sClientContext]&&this.m_oPromptListeners[v_sClientContext].F_OnServerPromptingComplete&&this.m_oPromptListeners[v_sClientContext].F_OnServerPromptingComplete(),delete this.m_oPromptListeners[v_sClientContext]},rsPromptHandler.F_DoRestPrompting=function(v_oListener,v_oRequest,v_oGlassContext){var v_iPromptId=this.f_getPromptId(),v_oLaunchParameters=this.f_createRestPromptLaunchParameters(v_oRequest,this.f_prompting_OkCallback.bind(this,v_iPromptId)),v_oContext={urlMap:{perspective:"authoring",isViewer:!0,UIProfile:"Titan",promptResponse:"url",ui_appbar:!1,ui_navbar:!1,launchParametersKey:rsLaunchParameters.Store(v_oLaunchParameters,!0)}},v_sUrl=v_oGlassContext.getUrl(v_oContext);return this.f_launchPrompt(v_oListener,v_sUrl,null,v_oLaunchParameters,v_iPromptId)},window.onunload=rsPromptHandler.f_OnUnLoad.bind(rsPromptHandler,window.onunload),rsPromptHandler}),define("bi/authoring/utils/C_rsRestRequest",["bi/authoring/utils/U_Object","bi/authoring/utils/rsPromptHandler"],function(U_Object,rsPromptHandler){function C_rsRestRequest(v_oGlassContext,v_oListener,v_oRequest){this.m_oGlassContext=v_oGlassContext,this.m_oListener=v_oListener,this.m_oRequest=v_oRequest,this.m_oPromptCallbackResponse=null,this.M_iResponseDelay=0}function f_fireEvent(v_sEvent){this.m_oListener&&this.m_oListener[v_sEvent]&&setTimeout(this.m_oListener[v_sEvent].bind(this.m_oListener,this),0)}function f_onRestResponseDontCare(){}function f_doResponseProcessing(){if(202==this.F_GetStatus())f_processAsyncResponse.bind(this)();else{if(this.m_bAborted)return;this.F_ProcessResponse(),f_fireEvent.bind(this)("F_Request_OnComplete")}}function f_initiateResponseProcessing(){return this.M_iResponseDelay?void setTimeout(f_doResponseProcessing.bind(this),this.M_iResponseDelay):void f_doResponseProcessing.bind(this)()}function f_onRestResponseOK(v_oResponseData,v_sStatus,v_oXHR){this.m_oResponseData=v_oResponseData,this.m_oXHR=v_oXHR,f_initiateResponseProcessing.bind(this)()}function f_onRestResponseFailed(v_sStatus,v_oXHR,v_sErrorThrown){this.m_oXHR=v_oXHR,this.m_oFailed={status:v_sStatus,error:v_sErrorThrown,response:this.F_GetResponseText()},this.F_OnFailed(),f_initiateResponseProcessing.bind(this)()}function f_processAsyncResponse(){var v_bPrompting=this.m_oResponseData&&"prompting"==this.m_oResponseData.status,v_sLocation=this.m_oXHR.getResponseHeader("Location"),v_sAffinity=this.m_oXHR.getResponseHeader("X-CA-Affinity"),v_oRequestHeaders={};v_sAffinity&&(v_oRequestHeaders["X-CA-Affinity"]=v_sAffinity);var v_oRequest={url:v_sLocation,headers:v_oRequestHeaders};this.m_bAborted?(v_oRequest.type="DELETE",Application.GlassContext.services.ajax.ajax(v_oRequest).done(f_onRestResponseDontCare.bind(this)).fail(f_onRestResponseDontCare.bind(this))):(v_oRequest.type="GET",v_bPrompting?(v_oRequest.dataType="text",rsPromptHandler.F_DoRestPrompting(this,v_oRequest,this.m_oGlassContext)||(this.m_oFailed={status:"popup blocked"},this.F_ProcessResponse(),f_fireEvent.bind(this)("F_Request_OnComplete"))):this.m_oGlassContext.services.ajax.ajax(v_oRequest).done(f_onRestResponseOK.bind(this)).fail(f_onRestResponseFailed.bind(this)))}function f_getPropertyInTryCatch(o,p){try{return o[p]}catch(e){return null}}var f_processAsyncResponse;return C_rsRestRequest.prototype.F_GetListener=function(){return this.m_oListener},C_rsRestRequest.prototype.F_SetListener=function(v_oListener){this.m_oListener=v_oListener},C_rsRestRequest.prototype.F_SetHeaders=function(v_oRequestHeaders){return v_oRequestHeaders},C_rsRestRequest.prototype.F_Send=function(){this.m_oRequest.headers=this.F_SetHeaders(this.m_oRequest.headers),this.m_oGlassContext.services.ajax.ajax(this.m_oRequest).done(f_onRestResponseOK.bind(this)).fail(f_onRestResponseFailed.bind(this))},C_rsRestRequest.prototype.F_Abort=function(){this.m_bAborted=!0,f_fireEvent.bind(this)("F_Request_OnAborted"),this.F_SetListener(null)},C_rsRestRequest.prototype.F_GetStatus=function(){return this.m_oXHR?f_getPropertyInTryCatch(this.m_oXHR,"status"):null},C_rsRestRequest.prototype.F_ProcessResponse=function(){},C_rsRestRequest.prototype.F_GetResponseData=function(){return this.m_oResponseData},C_rsRestRequest.prototype.F_GetResponseText=function(){return this.m_oXHR?this.m_oXHR.responseText:null},C_rsRestRequest.prototype.F_OnFailed=function(){},C_rsRestRequest.prototype.F_GetFailed=function(){return this.m_oFailed},C_rsRestRequest.prototype.F_SetPromptCallbackResponse=function(v_oResponse,v_oAttachments){this.m_oPromptCallbackResponse=v_oResponse?U_Object.F_Clone(v_oResponse):null},C_rsRestRequest.prototype.F_OnServerPromptingComplete=function(){this.m_oPromptCallbackResponse?(this.m_oResponseData=this.m_oPromptCallbackResponse,this.m_oPromptCallbackResponse=null,this.m_oFailed=null,this.F_ProcessResponse()):this.m_oFailed={status:"cancelled"},f_fireEvent.bind(this)("F_Request_OnComplete")},C_rsRestRequest}),define("bi/authoring/plugins/rsDrillInfoService",["baglass/core-client/js/core-client/ui/core/Class","q","bi/authoring/utils/C_rsRestRequest"],function(Class,Q,C_rsRestRequest){"use strict";var rsDrillInfoService=Class.extend({init:function(attributes){this._glassContext=attributes.glassContext,rsDrillInfoService.inherited("init",this,arguments)},getParameters:function(storeId){this.deferred=Q.defer();var v_oRequest={url:"v1/reports/"+storeId+"/parameters?&layoutParameters=true",type:"GET",dataType:"json"},v_oRestRequest=new C_rsRestRequest(this._glassContext,this,v_oRequest);return v_oRestRequest.F_Send(),this.deferred.promise},F_Request_OnComplete:function(v_oRequest){var fail=v_oRequest.F_GetFailed();fail?this.deferred.reject(fail):this.deferred.resolve(v_oRequest.F_GetResponseData())}});return rsDrillInfoService}),define("bi/authoring/utils/V5ToDashboard",["q","bi/authoring/nls/StringResource"],function(Q,StringResource){var V5ToDashboard={};V5ToDashboard.K_iNODE_ELEMENT=1;var v_bRunInProduction=!1;return V5ToDashboard.LaunchInExploration=function(v_nReport,v_oAuthoringApp,v_aSelectionIids,v_sReportSpec,v_sExploreStoreID,v_oGlassContext){var v_oDBSpec;v_bRunInProduction=!0;var v_sStoreID=v_oAuthoringApp.SharedState.Get("storeID"),v_sExistingExploreSpec=null;return this.f_getExploreSpec(v_sExploreStoreID,v_oGlassContext).then(function(v_oExploreData){return v_oExploreData&&v_oExploreData.data[0]&&v_oExploreData.data[0].specification&&(v_sExistingExploreSpec=v_oExploreData.data[0].specification),this.ConvertV5toDBFrag(v_nReport,v_sStoreID,v_aSelectionIids,v_sReportSpec,v_oGlassContext)}.bind(this)).then(function(v_oDBFragSpec){return v_oDBSpec=v_oDBFragSpec,v_oGlassContext.getSvc(".ConversionService")}).then(function(conversionSvc){return conversionSvc.convert("DASHBOARD","EXPLORE",JSON.stringify(v_oDBSpec))}).then(function(v_sExploreSpec){console.log("RS->DB->EX spec: "+v_sExploreSpec);var v_oEXSpec=JSON.parse(v_sExploreSpec);v_sExistingExploreSpec&&(v_oEXSpec=this.f_mergeNewExplorationIntoExisting(v_oEXSpec,JSON.parse(v_sExistingExploreSpec)),console.log("Merged exploration spec: "+JSON.stringify(v_oEXSpec)));var perspectiveOptions={content:{boardSpec:v_oEXSpec,isAuthoringMode:!0,openAppViewCallback:function(){}},id:"Explore_"+Date.now()};return v_oGlassContext.openAppView("explore",perspectiveOptions)}.bind(this)).then(function(view){return view?(v_nReport.selectSingleNode("./layouts//dataSource/reportExpression")&&v_oGlassContext.showToast(v_oAuthoringApp.GetString("IDS_MSG_UNSUPPORTED_LAYOUT_CALC_IN_EXPLORE"),{type:"warning"}),view.currentContentView.openDatasetpane(!1)):void 0})},V5ToDashboard.f_getExploreSpec=function(v_sExploreStoreID,v_oGlassContext){return v_sExploreStoreID?v_oGlassContext.services.ajax.ajax({url:"v1/objects/"+v_sExploreStoreID+"?fields=specification",type:"GET"}):Q.resolve(null)},V5ToDashboard.f_mergeNewExplorationIntoExisting=function(v_oNewExploreSpec,v_oExistingExploreSpec){for(var v_aNewWidgetsKeys=Object.keys(v_oNewExploreSpec.widgets),i=0;iDB spec: "+JSON.stringify(v_oDBSpec)),v_oDBSpec},V5ToDashboard.f_validateReportSelections=function(v_nReport,v_aSelectionIids){var v_aValidSelectionIids=v_aSelectionIids;if(1===v_aSelectionIids.length){var v_nSingleNodeSelection=v_bRunInProduction?v_nReport.selectSingleNode(".//*[@iid='"+v_aSelectionIids[0]+"']"):v_nReport.querySelector("[iid="+v_aSelectionIids[0]+"]");if("pageBody"===v_nSingleNodeSelection.nodeName||"table"===v_nSingleNodeSelection.nodeName){v_aValidSelectionIids=[];for(var nlContents=v_bRunInProduction?v_nSingleNodeSelection.selectNodes(".//contents"):v_nSingleNodeSelection.querySelectorAll("contents"),i=0;i query[name='"+v_aRefQueryNames[j]+"']");v_aQueries.push(v_nQuery)}return v_aQueries},V5ToDashboard.f_convertV5DataItemSortToDB=function(v_nSelection,v_nDataItem,v_sDataItemName,v_sDataItemIndex){var v_nLayoutSortItem,v_aSelection=[],v_bIsDescending=null;switch(v_nSelection.nodeName){case"list":v_nLayoutSortItem=v_bRunInProduction?v_nSelection.selectSingleNode(".//sortList/sortItem[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("sortList > sortItem[refDataItem='"+v_sDataItemName+"']");break;case"crosstab":case"viz":case"vizControl":case"mapChart":v_nLayoutSortItem=v_bRunInProduction?v_nSelection.selectSingleNode(".//*[@refDataItem='"+v_sDataItemName+"']//sortList/sortItem"):v_nSelection.querySelector("* > [refDataItem='"+v_sDataItemName+"'] > sortList > sortItem")}if(v_nLayoutSortItem)v_bIsDescending="descending"==v_nLayoutSortItem.getAttribute("sortOrder");else{var v_nSetSorting=v_bRunInProduction?v_nDataItem.selectSingleNode(".//setSorting"):v_nDataItem.querySelector("setSorting");v_nSetSorting&&(v_bIsDescending="false"==v_nSetSorting.getAttribute("ascending"))}return null!=v_bIsDescending&&v_aSelection.push({operation:"order",sort:{type:v_bIsDescending?"desc":"asc",priority:v_sDataItemIndex,by:"caption"}}),v_aSelection},V5ToDashboard.f_getXMLAttribute=function(v_nParent,v_sName){if(!v_nParent||!v_sName)return null;var v_nXMLAttribute=v_bRunInProduction?v_nParent.selectSingleNode(".//XMLAttributes/XMLAttribute[@name='"+v_sName+"']"):v_nParent.querySelector("XMLAttributes > XMLAttribute[name='"+v_sName+"']"),v_sXMLAttributeValue=v_nXMLAttribute?v_nXMLAttribute.getAttribute("value"):null;return v_sXMLAttributeValue},V5ToDashboard.K_iDataUsage_Fact=2,V5ToDashboard.K_sDataUsage_Fact="fact",V5ToDashboard.f_getDataUsage=function(v_nDataItem){return this.f_getXMLAttribute(v_nDataItem,"RS_dataUsage")||this.K_sDataUsage_Unknown},V5ToDashboard.F_IsLikelyMeasure=function(v_nDataItem){switch(v_nDataItem.nodeName){case"dataItem":return this.f_getDataUsage(v_nDataItem)==this.K_iDataUsage_Fact||this.f_getDataUsage(v_nDataItem)==this.K_sDataUsage_Fact;case"dataItemMeasure":case"dataItemCalculatedMeasure":case"dataItemMeasurePercentage":return!0}return!1},V5ToDashboard.F_IsLikelyCalculation=function(v_nDataItem){switch(v_nDataItem.nodeName){case"dataItemCalculatedMember":case"dataItemCalculatedMeasure":case"dataItemMeasurePercentage":return!0}return!1},V5ToDashboard.f_convertV5FormatToDB=function(v_nSelection,v_nDataItem,v_sDataItemName){var v_oFormat={};if(this.F_IsLikelyMeasure(v_nDataItem)){var v_nDataFormat;switch(v_nSelection.nodeName){case"list":var v_nListColumnBody=this.f_getAncestorNode(v_bRunInProduction?v_nSelection.selectSingleNode(".//listColumnBody//*[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("listColumnBody * [refDataItem='"+v_sDataItemName+"']"),"listColumnBody");v_nDataFormat=v_bRunInProduction?v_nListColumnBody.selectSingleNode(".//style//dataFormat"):v_nListColumnBody.querySelector("style > dataFormat");break;case"crosstab":v_nDataFormat=v_bRunInProduction?v_nSelection.selectSingleNode(".//crosstabFactCell//style//dataFormat"):v_nSelection.querySelector("crosstabFactCell > style > dataFormat");break;case"viz":break;case"vizControl":break;case"mapChart":}v_nDataFormat&&v_nDataFormat.firstElementChild&&(v_oFormat.formatSpec={},this.f_convertV5DataFormatToDB(v_nDataFormat.firstElementChild,v_oFormat.formatSpec))}return v_oFormat},V5ToDashboard.f_getAncestorNode=function(v_nCurrentNode,v_sAncestorName){
return v_nCurrentNode&&v_nCurrentNode.parentNode?v_nCurrentNode.parentNode.nodeName==v_sAncestorName?v_nCurrentNode.parentNode:this.f_getAncestorNode(v_nCurrentNode.parentNode,v_sAncestorName):null},V5ToDashboard.f_getDataItems=function(v_nQuery){return v_bRunInProduction?v_nQuery.selectNodes(".//selection/*"):v_nQuery.querySelector("selection").childNodes},V5ToDashboard.f_getDataItem=function(v_nQuery,v_sDataItemName){return v_bRunInProduction?v_nQuery.selectSingleNode(".//*[@name='"+v_sDataItemName+"']"):v_nQuery.querySelector("* [name='"+v_sDataItemName+"']")},V5ToDashboard.f_escapeEndBracket=function(v_sName){return v_sName.replace(/\]/g,"]]")},V5ToDashboard.f_addV5DataItemToDBDataView=function(v_nSelection,v_sQueryName,v_nDataItem,v_sRefName,v_oDataView,v_iIndex){if(!this.f_isDataItemUsedInSelection(v_nDataItem,v_nSelection,v_sRefName))return!1;var v_sDataItemName=v_nDataItem.getAttribute("name"),v_aSelection=this.f_convertV5DataItemSortToDB(v_nSelection,v_nDataItem,v_sDataItemName,v_iIndex),v_oFormat=this.f_convertV5FormatToDB(v_nSelection,v_nDataItem,v_sDataItemName),v_sV5DataItemAggregate=v_nDataItem.getAttribute("aggregate"),v_sDBDataItemAggregate=v_sV5DataItemAggregate?this.f_convertAggregateOpToDB(v_sV5DataItemAggregate):"",v_sDataItemNameFull="["+this.f_escapeEndBracket(v_sQueryName)+"].["+this.f_escapeEndBracket(v_sDataItemName)+"]",v_oDataItem={id:v_sDataItemNameFull,itemId:v_sDataItemNameFull,itemLabel:v_sDataItemName};return v_aSelection&&v_aSelection.length>0&&(v_oDataItem.selection=v_aSelection),v_oFormat&&v_oFormat.formatSpec&&(v_oDataItem.format=v_oFormat),v_sDBDataItemAggregate&&(v_oDataItem.aggregate=v_sDBDataItemAggregate),v_oDataView.dataItems.push(v_oDataItem),!0},V5ToDashboard.f_setListWidget=function(v_oWidget,v_nSelection,v_nQuery,v_oDataView){var v_oSlot={};v_oSlot.name="grid_cols",v_oSlot.dataItems=[];for(var v_sQueryName=v_nQuery.getAttribute("name"),v_nlDataItemValue=v_bRunInProduction?v_nSelection.selectNodes(".//listColumnBody//*[@refDataItem]"):v_nSelection.querySelectorAll("* listColumnBody * [refDataItem]"),i=0;i dsFilters > dsFilter"),j=0;j dsFilterInValue");for(i=0;i0&&v_nFilterTo.childNodes.length>0){v_FilterFrom=Number(v_nFilterFrom.childNodes[0].nodeValue),v_FilterTo=Number(v_nFilterTo.childNodes[0].nodeValue),v_oDBFilter.values.push({d:v_FilterFrom,u:v_FilterFrom},{d:v_FilterTo,u:v_FilterTo}),v_oDBFilter.operator="true"===v_nFilter.getAttribute("not")?"notbetween":"between";break}if(v_nFilterFrom.childNodes.length>0&&0==v_nFilterTo.childNodes.length){v_FilterFrom=Number(v_nFilterFrom.childNodes[0].nodeValue),v_oDBFilter.values.push({d:v_FilterFrom,u:v_FilterFrom}),v_oDBFilter.operator="gt";break}if(0==v_nFilterFrom.childNodes.length&&v_nFilterTo.childNodes.length>0){v_FilterTo=Number(v_nFilterTo.childNodes[0].nodeValue),v_oDBFilter.values.push({d:v_FilterTo,u:v_FilterTo}),v_oDBFilter.operator="lt";break}}},V5ToDashboard.f_convertCompareOperatorToDB=function(v_nFilterCompare){var v_bIsNot="true"===v_nFilterCompare.getAttribute("not");switch(v_nFilterCompare.getAttribute("operator")){case"greaterThan":case"greaterThanEqual":return v_bIsNot?"lt":"gt";case"lessThan":case"lessThanEqual":return v_bIsNot?"gt":"lt";case"equal":return"eq"}return"eq"},V5ToDashboard.f_setCrosstabWidget=function(v_oWidget,v_nSelection,v_nQuery,v_oDataView){var v_sQueryName=v_nQuery.getAttribute("name");v_oWidget.slotmapping.slots=[{name:"row_level1",dataItems:[],caption:"Rows",id:"row_level1"},{name:"column_level1",dataItems:[],caption:"Columns",id:"column_level1"},{name:"values",dataItems:[],caption:"Values",id:"values"}];var v_sRefDataItem,v_nDataItem,i,v_nlRowsCrosstabNodeMember=v_bRunInProduction?v_nSelection.selectNodes(".//crosstabRows//crosstabNodeMember"):v_nSelection.querySelectorAll("crosstabRows * crosstabNodeMember");for(i=v_nlRowsCrosstabNodeMember.length-1;i>=0;i--)v_sRefDataItem=v_nlRowsCrosstabNodeMember.item(i).getAttribute("refDataItem"),v_nDataItem=this.f_getDataItem(v_nQuery,v_sRefDataItem),this.f_addV5DataItemToDBDataView(v_nSelection,v_sQueryName,v_nDataItem,"refDataItem",v_oDataView,i)&&v_oWidget.slotmapping.slots[0].dataItems.push(v_sRefDataItem);var v_nlColsCrosstabNodeMember=v_bRunInProduction?v_nSelection.selectNodes(".//crosstabColumns//crosstabNodeMember"):v_nSelection.querySelectorAll("crosstabColumns * crosstabNodeMember");for(i=v_nlColsCrosstabNodeMember.length-1;i>=0;i--)if(v_sRefDataItem=v_nlColsCrosstabNodeMember.item(i).getAttribute("refDataItem"),v_nDataItem=this.f_getDataItem(v_nQuery,v_sRefDataItem),this.f_addV5DataItemToDBDataView(v_nSelection,v_sQueryName,v_nDataItem,"refDataItem",v_oDataView,i)){var v_iSlotIndex=1;this.F_IsLikelyMeasure(v_nDataItem)&&(v_iSlotIndex=2),v_oWidget.slotmapping.slots[v_iSlotIndex].dataItems.push(v_sRefDataItem)}var v_nCrosstabCornerDataItemLabel=v_bRunInProduction?v_nSelection.selectSingleNode(".//crosstabCorner//*[@refDataItem]"):v_nSelection.querySelector("crosstabCorner * [refDataItem]");v_nCrosstabCornerDataItemLabel&&(v_sRefDataItem=v_nCrosstabCornerDataItemLabel.getAttribute("refDataItem"),v_nDataItem=this.f_getDataItem(v_nQuery,v_sRefDataItem),this.f_addV5DataItemToDBDataView(v_nSelection,v_sQueryName,v_nDataItem,"refDataItem",v_oDataView,0),v_oWidget.slotmapping.slots[2].dataItems.push(v_sRefDataItem)),v_oWidget.data.dataViews.push(v_oDataView),v_oWidget.visId="crosstab"},V5ToDashboard.f_convertAggregateOpToDB=function(v_sV5AggregateOp){switch(v_sV5AggregateOp){case"average":return"avg";case"summarize":return"sum";case"minimum":return"min";case"maximum":return"max";case"count":return"count";case"countDistinct":return"countdistinct";default:return null}},V5ToDashboard.f_setVizControlWidget=function(v_oWidget,v_nSelection,v_aQueries,v_aDataViews,v_nlReportDataStore){v_oWidget.visId=this.f_convertV5VidaTypeToDB(v_nSelection),this.f_addVizControlPropertiesToWidget(v_oWidget,v_nSelection);var v_aLayers=[];"com.ibm.vis.rave2bundletiledmap"==v_oWidget.visId&&(v_oWidget.slotmapping.layers=[]);for(var i=0;i *"),i=0;i *"),i=0;i * [refDataItem='"+v_sDataItemName+"']"))v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories";else switch(v_sVizType){case"rave-library-area,area":case"rave-library-line,line":case"rave-library-bubble,point":v_oSlot.name=v_oSlot.caption=v_oSlot.id="series";break;default:v_oSlot.name=v_oSlot.caption=v_oSlot.id="color"}v_oSlot.dataItems=[],v_oSlot.dataItems.push(v_sDataItemName);break;case"rave-library-bubble,scatter":v_bIsMeasure?(v_nVizValue=v_bRunInProduction?v_nSelection.selectSingleNode(".//vizValue[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizValue[refDataItem='"+v_sDataItemName+"']"),v_oSlot.name=v_oSlot.caption=v_oSlot.id=v_nVizValue.getAttribute("idField")):(v_bRunInProduction?v_nSelection.selectSingleNode(".//vizCategoryEdge[@refEdge='labelEdge']//*[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizCategoryEdge[refEdge='labelEdge'] > * [refDataItem='"+v_sDataItemName+"']"))?v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories":v_oSlot.name=v_oSlot.caption=v_oSlot.id="color";break;case"rave-library-dial,dial":v_bIsMeasure?v_oSlot.name=v_oSlot.caption=v_oSlot.id="values":(v_bRunInProduction?v_nSelection.selectSingleNode(".//vizCategoryEdge[@refEdge='labelEdge']//*[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizCategoryEdge[refEdge='labelEdge'] > * [refDataItem='"+v_sDataItemName+"']"))?v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories":v_oSlot.name=v_oSlot.caption=v_oSlot.id="color";break;case"rave-library-bubble,packedBubble":case"rave-library-wordcloud,wordcloud":v_bIsMeasure?v_oSlot.name=v_oSlot.caption=v_oSlot.id="size":(v_bRunInProduction?v_nSelection.selectSingleNode(".//vizCategoryEdge[@refEdge='labelEdge']//*[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizCategoryEdge[refEdge='labelEdge'] > * [refDataItem='"+v_sDataItemName+"']"))?v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories":v_oSlot.name=v_oSlot.caption=v_oSlot.id="color";break;case"rave-library-pie,pie":v_bIsMeasure?v_oSlot.name=v_oSlot.caption=v_oSlot.id="values":v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories";break;case"rave-library-heatmap,heatmap":v_bIsMeasure?v_oSlot.name=v_oSlot.caption=v_oSlot.id="color":(v_bRunInProduction?v_nSelection.selectSingleNode(".//vizCategoryEdge[@refEdge='xEdge']//*[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizCategoryEdge[refEdge='xEdge'] > * [refDataItem='"+v_sDataItemName+"']"))?v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories":v_oSlot.name=v_oSlot.caption=v_oSlot.id="series";break;case"rave-library-bubble,bubble":v_bIsMeasure?(v_nVizValue=v_bRunInProduction?v_nSelection.selectSingleNode(".//vizValue[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizValue[refDataItem='"+v_sDataItemName+"']"),v_oSlot.name=v_oSlot.caption=v_oSlot.id=v_nVizValue.getAttribute("idField")):v_oSlot.name=v_oSlot.caption=v_oSlot.id="color";break;case"rave-library-composite,compositeOneDataSet":v_bIsMeasure?(v_nVizValue=v_bRunInProduction?v_nSelection.selectSingleNode(".//vizValue[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizValue[refDataItem='"+v_sDataItemName+"']"),v_oSlot.name=v_oSlot.caption=v_oSlot.id="yLine"==v_nVizValue.getAttribute("idField")?"lineValue":"columnValue"):v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories";break;default:return null}return v_oSlot},V5ToDashboard.f_createVizControlSlot=function(v_nSelection,v_nDataItem,v_sVisId){var v_sDataItemName=v_nDataItem.getAttribute("name"),v_oSlot={};v_oSlot.dataItems=[],v_oSlot.dataItems.push(v_sDataItemName);var v_nVcSlotData=this.f_getAncestorNode(v_bRunInProduction?v_nSelection.selectSingleNode(".//*[@refDsColumn='"+v_sDataItemName+"']"):v_nSelection.querySelector("[refDsColumn='"+v_sDataItemName+"']"),"vcSlotData");if("com.ibm.vis.rave2bundletiledmap"==v_sVisId){var v_nVcSlotDataSet=this.f_getAncestorNode(v_bRunInProduction?v_nSelection.selectSingleNode(".//*[@refDsColumn='"+v_sDataItemName+"']"):v_nSelection.querySelector("[refDsColumn='"+v_sDataItemName+"']"),"vcDataSet");v_oSlot.layerId=v_nVcSlotDataSet.getAttribute("idDataSet")}var v_sIdSlot=(v_bRunInProduction?v_nSelection.selectSingleNode(".//vcDataSet").getAttribute("refDataStore"):v_nSelection.querySelector("vcDataSet").getAttribute("refDataStore"),v_nVcSlotData.getAttribute("idSlot"));return v_oSlot.name=v_oSlot.caption=v_oSlot.id=v_sIdSlot,v_oSlot},V5ToDashboard}),define("bi/authoring/plugins/rsReportToDashboardService",["baglass/core-client/js/core-client/ui/core/Class","q","bi/authoring/utils/V5ToDashboard"],function(Class,Q,V5ToDashboard){"use strict";var rsReportToDashboardService=Class.extend({init:function(attributes){this._glassContext=attributes.glassContext,rsReportToDashboardService.inherited("init",this,arguments)},convertReportToDashboard:function(){return this.deferred=Q.defer(),this._glassContext.getCoreSvc(".Clipboard").get().then(function(v_oExternalCopy){if(v_oExternalCopy&&"REPORT"==v_oExternalCopy.type){var v_nSourceReport=(new DOMParser).parseFromString(v_oExternalCopy.spec,"text/xml").documentElement,v_aSelectionIids=v_oExternalCopy.selectionIids;V5ToDashboard.ConvertV5toDB(v_nSourceReport,v_aSelectionIids,this._glassContext).then(function(v_oDBSpec){this.deferred.resolve(JSON.stringify(v_oDBSpec))}.bind(this))}else this.deferred.resolve("")}.bind(this)),this.deferred.promise}});return rsReportToDashboardService}),define("js/authoring/bundle",function(){});