authorBundle.js 193 KB

12345678910
  1. /**
  2. * IBM Confidential OCO Source Materials IBM Business Platform: Dashboards
  3. * (C) Copyright IBM Corp. 2016, 2020
  4. *
  5. * The source code for this program is not published or otherwise divested of
  6. * its trade secrets, irrespective of what has been deposited with the U.S.
  7. * Copyright Office
  8. */
  9. function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t};define("dashboard-core/js/dashboard/layout/authoring/views/feature/CommonAuthoringFeature",["jquery","underscore","../../../../../lib/@waca/core-client/js/core-client/ui/core/Class"],(function(t,e,i){return i.extend({init:function(t){this.layoutView=t,this._events=[this.layoutView.content.on("add:child",this.onContentAddItem,this),this.layoutView.model.on("add:item",this.onModelAddItem,this),this.layoutView.model.on("remove:item",this.onModelRemoveItem,this),this.layoutView.model.on("change:parent",this.onModelUpdateParent,this),this.layoutView.model.on("change:style",this.onModelUpdateStyle,this),this.layoutView.model.on("change:css",this.onModelUpdateCSS,this),this.layoutView.model.on("change:fillColor",this.onModelFillColorChange,this)]},_isTypeRegistered:function(t){var e=this.layoutView.dashboardApi.getFeature("ContentTypeRegistry");return!!e&&e.isTypeRegistered(t)},onModelFillColorChange:function(t){t.prevValue&&this.layoutView.$el.removeClass("fill-"+t.prevValue),t.value&&this.layoutView.$el.addClass("fill-"+t.value),e.each(this.layoutView.model.findDescendantsWithType("widget"),function(e){var i=this.layoutView.layoutController.getLayoutView(e.id);i&&i.notifyWidget&&i.notifyWidget("layout:fillColorChange",{data:t.data})}.bind(this))},onContentAddItem:function(t){var e=t.info,i=e.newContentId,o=e.parentId,n=e.value,r=n.type||n.spec.type;if(!this._isTypeRegistered(r))return Promise.resolve();var a=this.layoutView.layoutController,s=a.viewsMap[o].view,d=a.createLayoutModule(i,s,{addPayloadData:t.transactionToken});return d.then((function(t){return s.add(t,n.insertBefore),t.renderContent()})),this.layoutView.onItemAddDone&&d.then(this.layoutView.onItemAddDone.bind(this.layoutView,t)),d},onModelAddItem:function(t){var e=this;if(this._isTypeRegistered(t.value.parameter.model.type))return Promise.resolve();var i=t.value.parameter.model,o=this.layoutView.layoutController.createLayoutModule(i.id,this.layoutView,{addPayloadData:t.data});return o.then((function(i){return(i.parentLayout||e.layoutView).add(i,t.value.parameter.insertBefore,t),i.renderContent()})),this.layoutView.onItemAddDone&&o.then(this.layoutView.onItemAddDone.bind(this.layoutView,t)),o},onModelRemoveItem:function(t){var e=t.value.parameter,i=document.getElementById(this.layoutView.getNodeId(e));if(i){var o=i._layout;o&&(o.parentLayout&&o.parentLayout.removeChild(o,t),o.destroy(t))}},onModelUpdateParent:function(i){var o=i.value.parameter,n=o.parentId,r=t(this.layoutView.domNode.parentNode).hasClass("page");if(!r||!this.layoutView.parentLayout||n!==this.layoutView.parentLayout.id||void 0!==o.insertBefore){var a=t(":focus");t(this.layoutView.domNode).detach();var s=function(n){var s=o.insertBefore;if(this.layoutView.parentLayout=n,n.add(this.layoutView,s,i),!r){var d=e.extend({},this.layoutView.model.style),l=t(this.layoutView.domNode);this._updateStyleForNode(l,d)}"UndoRedoController"===i.sender&&this.layoutView.onResize(i),a.focus(),this._onModelUpdateParent&&this._onModelUpdateParent()}.bind(this),d=this.layoutView.layoutController.getLayoutView(n);d?s(d):this.layoutView.layoutController.layoutReady(n).done(s)}},onModelUpdateStyle:function(e){var i=e.value.parameter,o=t(this.layoutView.domNode);this.saveOriginalNodeDimension(),this._updateStyleForNode(o,i,e.sender),(i.height||i.width)&&!1!==e.data.triggerResize&&this.layoutView.onResize(e)},_updateStyleForNode:function(t,e,i){var o;for(var n in e)e.hasOwnProperty(n)&&"function"!=typeof e[n]&&(o=e[n],"height"!==n&&"width"!==n||(o||"UndoRedoController"!==i?o||(this._originalHeight=null,this._originalWidth=null):o=("height"===n?this._originalHeight:this._originalWidth)+"px"),t.css(n,o))},onModelUpdateCSS:function(e){var i=e.value,o=e.prevValue,n=t(this.layoutView.domNode);n.removeClass(o),n.addClass(i)},destroy:function(){if(this._events)for(var t=0;t<this._events.length;t++)this._events[t]&&this._events[t].remove();this._events=null},saveOriginalNodeDimension:function(){if(!this._originalHeight){var e=t(this.layoutView.domNode);this._originalHeight=e.height(),this._originalWidth=e.width()}},onResizeStep:function(){this.saveOriginalNodeDimension()}})})),define("dashboard-core/js/dashboard/layout/authoring/views/LayoutBaseView",["../../../../lib/@waca/core-client/js/core-client/ui/core/Class","../../LayoutHelper","jquery","underscore","./feature/CommonAuthoringFeature"],(function(t,e,i,o,n){var r=null;return r=t.extend({init:function(t){r.inherited("init",this,arguments),this.consumeView=t.consumeView,this.overridden={},this.added=[],this.domNode=this.consumeView.domNode,this.id=this.consumeView.id,this.layoutController=this.consumeView.layoutController,this.model=this.consumeView.model,this.getNodeId=this.consumeView.getNodeId.bind(this.consumeView),this.specializeConsumeView(["add","removeChild","onResize","onResizeStep","getWidgetPositionUpdate","getMinimumTop","getMinimumLeft","getMaximumHeight","getMaximumWidth","getPhysicalPageSize","onShow"]),this.consumeView.authorHelper=this,this.consumeView.isAuthoringMode=!0,this.commonAuthoringFeature=new n(this.consumeView),this.dashboardApi=t.dashboardApi,this.$el=i(this.domNode)},specializeConsumeView:function(t){o.each(t,function(t){this.consumeView[t]&&-1===this.added.indexOf(t)?this.overridden[t]||(this.overridden[t]=this.consumeView[t].bind(this.consumeView)):this.added.push(t),this.consumeView[t]=this[t].bind(this)}.bind(this))},restoreSpecializedFunc:function(t){this.overridden[t]&&(this.consumeView[t]=this.overridden[t])},restoreAllSpecialized:function(){for(var t in this.overridden)this.overridden.hasOwnProperty(t)&&this.restoreSpecializedFunc(t)},removeAllAddedFuncs:function(){for(var t=0;t<this.added.length;t++)this.consumeView[this.added[t]]&&(this.consumeView[this.added[t]]=null)},renderContent:function(){return this.overridden.renderContent()},onResize:function(t){this.overridden.onResize(t)},onShow:function(){this.overridden.onShow(arguments)},onResizeStep:function(){this.commonAuthoringFeature.onResizeStep()},destroy:function(){r.inherited("destroy",this,arguments),this.restoreAllSpecialized(),this.removeAllAddedFuncs(),this.commonAuthoringFeature.destroy(),this.consumeView.isAuthoringMode=!1},add:function(t,e){this.consumeView._subLayoutViews.push(t);var o=t.domNode;if(o){o.parentNode&&o.parentNode.removeChild(o);var n=e?i("#"+this.getNodeId(e),this.layoutController.$el)[0]:null;this.domNode.insertBefore(o,n)}},removeChild:function(t){this.consumeView._subLayoutViews=this.consumeView._subLayoutViews.filter((function(e){return e!==t})),t&&t.domNode&&i(t.domNode).detach()},getWidgetPositionUpdate:function(t){var e=null;if(t.node._layout){var o=t.dropPosition.before&&t.dropPosition.before._layout?t.dropPosition.before._layout.model.id:null,n=t.dropPosition.x,r=t.dropPosition.y,a=i(t.node),s=n+a.width(),d=this.getMaximumWidth();d&&s>d&&(n=d-a.width());var l=r+a.height(),h=this.getMaximumHeight();h&&l>h&&(r=h-a.height()),e={style:{left:Math.max(this.getMinimumLeft(),n)+"px",top:Math.max(this.getMinimumTop(),r)+"px"},insertBefore:o,parentId:this.model.id,id:t.node._layout.model.id},t.dropPosition.height&&(e.style.height=t.dropPosition.height+"px"),t.dropPosition.width&&(e.style.width=t.dropPosition.width+"px")}return e},getMaximumWidth:function(){var t=this.getPhysicalPageSize();return t?t.width:1/0},getMaximumHeight:function(){var t=this.getPhysicalPageSize();return t?t.height:1/0},getMinimumTop:function(){var t=parseInt(this.$el.css("padding-top"),10);return isNaN(t)?0:t},getMinimumLeft:function(){var t=parseInt(this.$el.css("padding-left"),10);return isNaN(t)?0:t},_addWidget:function(t,e){var i=this,o=this.dashboardApi.getFeature("Transaction"),n=o.startTransaction(),r=t.model,a={containerId:t.parentId,type:"widget."+r.type,spec:r,properties:t.layoutProperties.style};return this.dashboardApi.getCanvas().addContent(a,n).then((function(t){return o.endTransaction(n),i.layoutController.whenWidgetRenderComplete(t.getId()).done((function(t){var o=i.layoutController.interactionController.selectionHandler;o.deselectAll(),o.selectNode(t.domNode,{isTouch:e})}))}))},_getModelToAddFromDragObject:function(t){return this.dashboardApi.getFeature("CanvasDnD").onDrop(t)},_processWidgetSpecForPin:function(t,e){if("boardFragment"===t.contentType){var i={layout:t.content.layout,widgets:t.content.widgets,dataSources:t.content.dataSources,properties:t.content.properties,sourceName:t.sourceName};t.content.drillThrough&&(i.drillThrough=t.content.drillThrough),t.content.episodes&&(i.episodes=t.content.episodes);var o={model:i,parentId:t.parentId},n=this.model.boardModel.addFragment(o,"layoutBaseView_onPinDrop",null);n&&n.value&&n.value.parameter&&n.value.parameter.model.layout&&n.value.parameter.model.layout.id&&this.layoutController.whenWidgetRenderComplete(n.value.parameter.model.layout.id).done(function(t){var i=this.layoutController.interactionController.selectionHandler;i.deselectAll(),i.selectNode(t.domNode,{isTouch:e})}.bind(this))}else this._addWidget(t,e);this.dashboardApi.getFeature("Colors").clearLocalPaletteCache()},getPhysicalPageSize:function(t,e){var i=t||this.model.getLayoutPositioning(!0);return"absolute"===i?this.model.boardModel.layout.get("pageSize"):"relative"===i?this._getRelativePhysicalPageSize(e):{width:this.domNode.offsetWidth,height:this.domNode.offsetHeight}},_getRelativePhysicalPageSize:function(t){var o=void 0,n={};if(this.$el.is(":visible"))n={width:this.$el.width(),height:this.$el.height()};else{if(!(o=i(t?e.getLayoutContentContainer(this.layoutController.topLayoutModel.id,t,this.dashboardApi):this.layoutController.getLayoutContentContainer())).length)return{width:this.domNode.offsetWidth,height:this.domNode.offsetHeight};if("relative"===o[0]._layout.model.getLayoutPositioning(!0))n={width:o.width(),height:o.height()};else{var r=o.parent(),a=this.model.boardModel.layout.get("pageSize");n={width:r.width(),height:r.width()*(a.height/a.width)}}}return n},moveToFitBoundaries:function(t,e,i){i.top+i.height>t&&(i.top=t-i.height),i.left+i.width>e&&(i.left=e-i.width)},updateModel:function(t,e){var i=this,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.forEach((function(t){var n=i.dashboardApi.getCanvas().getContent(t.id),r=Object.assign({},e,{validatePropertyValue:!1});Object.keys(t.style).forEach((function(e){n.setPropertyValue(e,t.style[e],r)})),r.validatePropertyValue=o,Object.keys(t.style).forEach((function(e){n.setPropertyValue(e,t.style[e],r)}))}))}})})),define("dashboard-core/js/dashboard/util/PxPercentUtil",[],(function(){var t=function(){function t(){_classCallCheck(this,t)}return t.changePixelPropertiesToPercent=function(t,i,o){var n=new e(o);this._convertUnits(t,i,n)},t.changePercentPropertiesToPixel=function(t,e){var o=new i;this._convertUnits(t,e,o)},t._convertUnits=function(t,e,i){if(!t||!e)throw new Error("Invalid options specified.");this._convertProperty(t,"top",e.height,i),this._convertProperty(t,"left",e.width,i),this._convertProperty(t,"height",e.height,i),this._convertProperty(t,"width",e.width,i),this._convertProperty(t,"bottom",e.height,i,!1),this._convertProperty(t,"right",e.width,i,!1)},t._convertProperty=function(t,e,i,o){var n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t&&t[e]&&(t[e]=o.convertValue(t[e],i,n))},t}(),e=function(){function t(e){_classCallCheck(this,t),this.decimalPlaces=e}return t.prototype.convertValue=function(t,e,i){var o=t;if(t&&t.indexOf&&-1!==t.indexOf("px")){var n=100*parseFloat(t)/e;i&&(n=100-n),o=this.decimalPlaces?String(Number(n.toFixed(this.decimalPlaces)))+"%":n+"%"}return o},t}(),i=function(){function t(){_classCallCheck(this,t)}return t.prototype.convertValue=function(t,e,i){var o=t;if(t&&t.indexOf&&-1!==t.indexOf("%")){var n=parseFloat(t);o=i&&0===n?e:Math.round(e*n/100),o+="px"}return o},t}();return t})),define("dashboard-core/js/dashboard/layout/authoring/views/Absolute",["./LayoutBaseView","jquery","underscore","../../../../lib/@waca/core-client/js/core-client/utils/Deferred","../../LayoutHelper","../../../util/PxPercentUtil","../../../glass/util/InstrumentationUtil"],(function(t,e,i,o,n,r,a){var s=null;return s=t.extend({init:function(t){s.inherited("init",this,arguments),this.layoutController.topLayoutModel&&(this.layoutController.topLayoutModel.on("change:showGrid",this.renderGrid,this),this.layoutController.topLayoutModel.on("change:fitPage",this.renderGrid,this),this.layoutController.topLayoutModel.on("change:pageSize",this.onPageSize,this)),this.services=t.services,this._templateHelper=t.templateHelper,this.whenIsReadyDfd=new o,this.specializeConsumeView(["setPreferredLocation"]),this._initialize()},createDropZone:function(){var t=this;this._dropTarget=this._dndManager.addDropTarget(this.domNode,{accepts:this.accepts.bind(this),onDrop:this.onDrop.bind(this),onDragLeave:this.onDragLeave.bind(this),onDragEnd:this.onDragEnd.bind(this),onDragMove:this.onDragMove.bind(this),priority:-100,info:function(e,i){return t._getCoordsRelativeToTarget(e,i)},type:"dropOnCanvas"}),this._dropHandler=this._dndManager.registerDropHandler({accepts:function(t,e){return t.type.match(/content\..*/)&&"dropOnCanvas"===e.type},onDrop:function(e,i){t.onContentDrop(e,i)}})},_getCoordsRelativeToTarget:function(t,i){var o=e(t).offset();return{top:Math.round(i.pageY-o.top+t.scrollTop),left:Math.round(i.pageX-o.left+t.scrollLeft)}},onContentDrop:function(t,e){var i=JSON.parse(JSON.stringify(t.data)),o=i.spec.style||{};if(e&&e.info){var r={width:o.width,height:o.height,top:e.info.top,left:e.info.left};return this._stylePxToInt(r),this._setStyleWithinBounds(r),n.styleIntToPx(r),o.width=r.width,o.height=r.height,o.left=r.left,o.top=r.top,i.spec.style=o,this.dashboardApi.getFeature("Canvas").addContent(i)}this.clearDragState()},onShow:function(){s.inherited("onShow",this,arguments),this.renderGrid()},whenIsReady:function(){return this.whenIsReadyDfd.promise},destroy:function(){this._dropTarget&&(this._dropTarget.remove(),this._dropTarget=null),this._dropHandler&&(this._dropHandler.deregister(),this._dropHandler=null),this._dndManager=null,e.glassdnd&&e.glassdnd.cancelDroppable&&e.glassdnd.cancelDroppable(this.$el),this.$el.find(".absoluteLayoutGrid").remove(),this.layoutController.topLayoutModel.off("change:showGrid",this.renderGrid,this),this.layoutController.topLayoutModel.off("change:pageSize",this.onPageSize,this),s.inherited("destroy",this,arguments)},removeChild:function(){s.inherited("removeChild",this,arguments)},_initialize:function(){this._dndManager=this.dashboardApi.getFeature("DashboardDnd.internal"),this.whenIsReadyDfd.resolve(),this.createDropZone()},_getDragPositionRelativeToTarget:function(t,i){var o=e(i).offset();return{top:Math.round(t.position.y-o.top+i.scrollTop),left:Math.round(t.position.x-o.left+i.scrollLeft)}},_getDragBoxForNewDrop:function(t,e){var i=this._getDragObjectDimensions(t),o=this._getDragPositionRelativeToTarget(t,e),n={top:o.top,left:o.left,ids:[]};return n.right=n.left+parseInt(i.width,10),n.bottom=n.top+parseInt(i.height,10),n.center_x=(n.left+n.right)/2,n.center_y=(n.top+n.bottom)/2,n},_getDragObjectDimensions:function(t){var i=t.data.layoutProperties&&t.data.layoutProperties.style||{},o=e(t.avatar);return 0===o.length&&(o=e(".avatar")),{width:i.width||o.width()||"10px",height:i.height||o.height()||"10px"}},_getDragBox:function(t){var i=t.reduce((function(t,i){var o,n,r,a,s=e(i.node);return i.dropPosition?(o=i.dropPosition.y,n=i.dropPosition.x,r=o+s.outerHeight(),a=n+s.outerWidth()):(o=1/0,n=1/0,r=0,a=0),t.top=Math.min(t.top,o),t.left=Math.min(t.left,n),t.bottom=Math.max(t.bottom,r),t.right=Math.max(t.right,a),t.ids.push(i.node.id),t}),{top:1/0,left:1/0,bottom:0,right:0,ids:[]});return i.center_x=(i.left+i.right)/2,i.center_y=(i.top+i.bottom)/2,i},accepts:function(t){return this.dashboardApi.getFeature("CanvasDnD").accepts(t,{fromCanvas:!0})},onDragMove:function(t,e){this.$el.addClass("layoutDragInProgress");var i=t.data&&t.data.nodeInfoList;i&&i.length?t.dragBox=this._getDragBox(i):t.dragBox=this._getDragBoxForNewDrop(t,e),this.adjustScrollPosition(t)},_moveDrop:function(t){for(var e,o,n=[],r=0,a=t.data.nodeInfoList.length;r<a;r++)e=t.data.nodeInfoList[r],(o=this.getWidgetPositionUpdate(e))&&n.push(o);var s=this.dashboardApi.getFeature("Transaction"),d=s.startTransaction(),l=n.map((function(t){return t.id})),h={};i.reduce(n,(function(t,e){return e.insertBefore&&(t[e.id]=e.insertBefore),t}),h),this.dashboardApi.getCanvas().moveContent(this.model.id,l,d,h),this.updateModel(n,d),s.endTransaction(d)},_newDrop:function(t,i,o){var r=this,s=t.data.layoutProperties||{},d=e(i).offset();return i&&d?this._getModelToAddFromDragObject(t).then((function(e){if(e){s.style||(s.style={});var d=r._getDragPositionRelativeToTarget(t,i),l={width:s.style.width,height:s.style.height,top:d.top,left:d.left};r._stylePxToInt(l),r._setStyleWithinBounds(l),n.styleIntToPx(l),s.style.width=l.width,s.style.height=l.height,s.style.left=l.left,s.style.top=l.top;var h={parentId:r.id,model:e,layoutProperties:s};o&&a.trackWidget("created",r.dashboardApi,h.model),r._addWidget(h,t.isTouch)}})):Promise.resolve()},_onPinDrop:function(t){var e=t.data.pinSpec,i=t.isTouch,o=t.position.x,n=t.position.y,r=Math.round(n-this.$el.offset().top)+"px",a=Math.round(o-this.$el.offset().left)+"px";"boardFragment"===e.contentType&&(e.content.layout.style||(e.content.layout.style={}),e.content.layout.style.top=r,e.content.layout.style.left=a,this._resizeToFitBoundaries(this.consumeView.getMaximumHeight(),this.consumeView.getMaximumWidth(),e.content.layout.style)),e.parentId=this.id,this._processWidgetSpecForPin(e,i)},_resizeToFitBoundaries:function(t,e,i){var o=parseInt(i.width,10),n=e/o,r=parseInt(i.height,10),a=t/r;if(n<1||a<1){var s=Math.min(n,a);i.height=Math.round(r*s)+"px",i.width=Math.round(o*s)+"px",i.left=Math.round((e-Math.round(o*s))/2)+"px",i.top=Math.round((t-Math.round(r*s))/2)+"px"}},onDrop:function(t,e){var i=this;return(t.data||e?"move"===t.data.operation?Promise.resolve(this._moveDrop(t)):"pin"===t.type&&"new"===t.data.operation?Promise.resolve(this._onPinDrop(t)):this._newDrop(t,e,!0):this._newDrop(t.originalEvent,t.targetNode)).then((function(){return i.clearDragState()}))},onDragLeave:function(){this.clearDragState(!0)},onDragEnd:function(){this.clearDragState(),this.previousDragBox=null},clearDragState:function(){this.$el.removeClass("layoutDragInProgress")},_changePercentModelToPixel:function(t){var i=this.$el;i.is(":visible")||(i=e(this.layoutController.getLastVisiblePage()));var o={width:i.width(),height:i.height()};r.changePercentPropertiesToPixel(t,o)},setPreferredLocation:function(t){var e=!1;if(this._templateHelper&&!t.layoutProperties.style&&(e=this._templateHelper.setPreferredLocation(t)),!e){var i=t.layoutProperties;i.style||(i.style={});var o={width:i.style.width||"300",height:i.style.height||"300"};-1===o.width.indexOf("%")&&-1===o.height.indexOf("%")||this._changePercentModelToPixel(o);var n=parseInt(o.width,10),r=parseInt(o.height,10),a=i.style.top||i.style.left?null:this.findAvailableSpace({width:n,height:r});a&&(i.style.top=a.top+"px",i.style.left=a.left+"px",i.style.width=i.style.width||(a.width||n)+"px",i.style.height=i.style.height||(a.height||r)+"px"),t.parentId=this.model.id}},getWidgetContainerNode:function(){return this.domNode},findAvailableSpace:function(t){var e,i,o,n=this.getChildrenRectList(),r=n.slice(0).sort((function(t,e){return t.height-e.height==0?t.top-e.top==0?t.left-e.left:t.top-e.top:t.height-e.height})),a={top:0,left:0};for(e=0,i=r.length;e<i&&(o=r[e],!(a=this.findSpaceAdjacentToBottomBorder(o,t,n)));e++);var s={width:t.width,height:t.height,top:a.top,left:a.left};return this._setStyleWithinBounds(s),a.top=s.top,a.left=s.left,a.width=s.width,a.height=s.height,a},_setStyleWithinBounds:function(t){var e=this.consumeView.getMaximumWidth(),i=this.consumeView.getMaximumHeight();isFinite(i)&&isFinite(e)&&(this._resizeToFitBoundaries(i,e,t),this._stylePxToInt(t),t.width||t.height||(i>e?(t.width=Math.floor(.5*e),t.height=Math.floor(3*t.width/4)):(t.height=Math.floor(.5*i),t.width=Math.floor(4*t.height/3))),this.moveToFitBoundaries(i,e,t))},_stylePxToInt:function(t){for(var e in t)if(t.hasOwnProperty(e)){var i=t[e];i&&(t[e]=parseInt(i,10))}},findSpaceAdjacentToBottomBorder:function(t,e,o){var n=i.filter(o,(function(i){return i!==t&&t.top+t.height<i.top+i.height&&t.top+t.height+e.height+5>i.top&&i.left<=t.left+t.width+e.width+5&&i.left+i.width>=t.left-e.width}));return 0===n.length?{top:t.top+t.height+5,left:t.left}:this.findSpaceBetweenRectangles(t,n,e)},findSpaceBetweenRectangles:function(t,i,o){var n=o.width+5;i.sort((function(t,e){return t.left-e.left}));var r=t.top+t.height+5,a=i[0];if(a.left>t.left&&a.left>=n&&a.left-n>t.left-n)return{top:r,left:Math.min(t.left,a.left-n)};for(var s,d,l=e(this.getWidgetContainerNode()).width(),h=0;h<i.length;h++)if(s=i[h],(d=i[h+1])&&s.left+s.width>d.left+d.width)i[h+1]=s;else{var u=d?d.left:l;if(s.left+s.width+n<=u&&t.left+t.width+n>s.left+s.width+n)return{top:r,left:s.left+s.width+5}}return null},getChildrenRectList:function(){var t=[];t.push({top:0,left:0,height:this.getMinimumTop()-5,width:Math.round(e(this.getWidgetContainerNode()).width())}),t.push({top:0,left:0,height:Math.round(e(this.getWidgetContainerNode()).height()),width:this.getMinimumLeft()-5});var i,o,n=e(this.getWidgetContainerNode()).children().not(".relativeLayoutGrid, .absoluteLayoutGrid, .pagetemplateIndicator, .pagetemplateDropZone, .sizeDashboardIndicatorContainer");for(i=0,o=n.length;i<o;i++){var r=e(n[i]);t.push({top:r[0].offsetTop,left:r[0].offsetLeft,height:r.outerHeight(),width:r.outerWidth()})}return t},adjustScrollPosition:function(t){var e=t.dragBox,i=this.getScrollInfo(t);this.scrollToDragBox(e,i)},getScrollInfo:function(t){var e=t.dragBox,i=this.getScrollAreaNode(),o={h:i.height(),w:i.width(),scrollTop:i.scrollTop(),scrollLeft:i.scrollLeft(),$node:i,direction:[]};return this.previousDragBox&&(e.left!==this.previousDragBox.left&&(o.direction[e.left-this.previousDragBox.left>0?"right":"left"]=!0),e.top!==this.previousDragBox.top&&(o.direction[e.top-this.previousDragBox.top>0?"bottom":"top"]=!0)),this.previousDragBox=e,o},getScrollAreaNode:function(){for(var t=this.$el.parents(".page"),e=this.$el,i=0;e&&e.length&&"auto"!==e.css("overflow");)e=t.eq(i),i++;return 0===e.length&&(e=this.$el),e},scrollToDragBox:function(t,e){t.bottom>e.scrollTop+e.h&&e.direction.bottom?e.$node.scrollTop(e.scrollTop+16):e.scrollTop>t.top-2&&e.direction.top&&e.$node.scrollTop(e.scrollTop-16),t.right>e.scrollLeft+e.w&&e.direction.right?e.$node.scrollLeft(e.scrollLeft+16):e.scrollLeft>t.left-2&&e.direction.left&&e.$node.scrollLeft(e.scrollLeft-16)},renderGrid:function(){var t=this.model.getValueFromSelfOrParent("showGrid"),e=void 0!==t&&t,i=this.model.getValueFromSelfOrParent("layoutPositioning");e&&"absolute"===i?this.$el.hasClass("gridCapable")&&(this.$el.find(".absoluteLayoutGrid").remove(),this.$el.prepend("<div class=absoluteLayoutGrid></div>")):this.$el.find(".absoluteLayoutGrid").remove()},onResize:function(){s.inherited("onResize",this,arguments),this.renderGrid()},onPageSize:function(){this.renderGrid()}})})),define("dashboard-core/js/dashboard/layout/authoring/views/PageCollectionView",["./LayoutBaseView","jquery","../../../../lib/@waca/dashboard-common/dist/ui/AuthoringToolbar","../../../../lib/@waca/core-client/js/core-client/utils/EventHelper"],(function(t,e,i){var o=null;return o=t.extend({init:function(t){o.inherited("init",this,arguments),this.toolbar=t.toolbar?t.toolbar:new i({placement:"bottom",container:e("body")}),this._getViewId=this.consumeView._getViewId.bind(this.consumeView),this.htmlTemplate=t.services.getSvcSync("htmlTemplates")},destroy:function(){o.inherited("destroy",this,arguments)}})})),define("dashboard-core/js/app/ui/dnd/DnDHelper",[],(function(){return{_id:null,handleWidgetDrop:function(t,e,i){if(t)if("new"===i.data.operation){var o=this._prepareWidgetContent(e,i);t.addContent(o)}else if("move"===i.data.operation){var n=this._getContentIdList(i);t.moveContent(e,n)}},_prepareWidgetContent:function(t,e){var i=e.data.layoutProperties.style||{};return{containerId:t,layout:_extends({},i),spec:_extends({style:i},e.widgetSpec.model)}},_getContentIdList:function(t){return(t.data&&t.data.nodeInfoList).map((function(t){if(t&&t.node&&t.node._layout)return t.node._layout.model&&t.node._layout.model.id}))}}})),define("dashboard-core/js/app/ui/dialogs/GenericViewDialog",["../../../lib/@waca/core-client/js/core-client/ui/dialogs/BaseDialog"],(function(t){var e=null;return e=t.extend({_buttons:["ok","cancel"],_okCallback:null,_cancelCallback:null,init:function(t){this.title=t.title,this.view=new t.viewClass(t.viewOptions),this._okCallback=t.okCallback,this._cancelCallback=t.cancelCallback,e.inherited("init",this,arguments)},destroy:function(){this.view&&this.view.remove(),e.inherited("destroy",this,arguments)},renderContent:function(t){return this.view.render(),t.append(this.view.$el),t},renderTitle:function(t){return t.text(this.title),t},ok:function(){if(e.inherited("ok",this,arguments),this._okCallback)return this._okCallback()},cancel:function(){if(e.inherited("cancel",this,arguments),this._cancelCallback)return this._cancelCallback()},open:function(){e.inherited("open",this,arguments),this.view.onOpen&&this.view.onOpen()}})})),define("dashboard-core/js/dashboard/layout/authoring/views/Tab",["./PageCollectionView","jquery","../../../../lib/@waca/core-client/js/core-client/utils/BidiUtil","../../../../app/nls/StringResources","../../../../lib/@waca/core-client/js/core-client/utils/dom-utils","../../../../lib/@waca/core-client/js/core-client/utils/Deferred","../../../../app/ui/dnd/DnDHelper","../../../../app/ui/dialogs/GenericViewDialog","../../../views/LayoutPickerView","../../../../lib/@waca/core-client/js/core-client/utils/EventHelper"],(function(t,e,i,o,n,r,a,s,d){var l=null;return l=t.extend({init:function(t){var e=this;l.inherited("init",this,arguments),t=t||{},this._getLabelId=this.consumeView._getLabelId.bind(this.consumeView),this.specializeConsumeView(["showView","renderContent","_attachView","onAddClick","onReorder","_handleKeydown","showToolbar","deleteView","updateViewLabel","editViewTitle"]),this.services=t.services,this.config=t.config,this.layoutsPath=t.layoutsPath,this.templateListing=t.templateListing,this.whenIsReadyDfd=new r,this.backgroundChangeHandle=this.model.on("change:css",(function(){return e.consumeView.tabWidget.updateTheme()})),this.dashboardApi=t.dashboardApi,this._attachedHandles={},this._icons=this.dashboardApi.getFeature("Icons")},renderContent:function(){var t=this;return this.overridden.renderContent().then((function(){t.consumeView.tabWidget.setState({addable:!0,deleteable:t.allowTabDeletion(),draggable:!0}),t.model.items&&t.model.items.length&&t.model.items.forEach((function(e){return t._attachView(e)})),t._initializeDnd()}))},whenIsReady:function(){return this.whenIsReadyDfd.promise},destroy:function(){this._tabStripDropZone&&this._tabStripDropZone.remove(),this._tabDropHandler&&(this._tabDropHandler.deregister(),this._tabDropHandler=null),this.backgroundChangeHandle&&this.backgroundChangeHandle.remove(),this.toolbar&&this.toolbar.remove&&this.toolbar.remove(),this.toolbar=null,this.model.items.forEach(this._detachView.bind(this)),this.consumeView.updateState({addable:!1,deleteable:!1,draggable:!1}),l.inherited("destroy",this,arguments)},_initializeDnd:function(){this._dndManager=this.dashboardApi.getFeature("DashboardDnd.internal"),this.setupGlobalDropZone(),this.whenIsReadyDfd.resolve()},_attachView:function(t){var e=this;this.services.getSvcSync("TranslationService").registerView({view:this,model:t}),this._attachedHandles[t.id]=t.on("change:title",this.onTabLabelChange.bind(this,t),this),this._attachedHandles[t.id]=t.on("change:tabTextColor",(function(t){return e.consumeView.tabWidget.updateTheme(t)})),this._attachedHandles[t.id]=t.on("change:tabSelectedLineColor",(function(t){return e.consumeView.tabWidget.updateTheme(t)})),this._attachedHandles[t.id]=t.on("change:tabBackgroundColor",(function(t){return e.consumeView.tabWidget.updateTheme(t)})),this._attachedHandles[t.id]=t.on("change:tabIconColor",(function(t){return e.consumeView.tabWidget.updateTheme(t)})),this._attachedHandles[t.id]=t.on("change:tabIcon",(function(i){return e.onTabIconChange(t,i)}))},_detachView:function(t){this._attachedHandles[t.id]&&(this._attachedHandles[t.id].remove(),delete this._attachedHandles[t.id])},addTranslationIcon:function(t){var e=t&&t[0].propertyParentModel;return this.model.get("hideTab")?0:this.consumeView.tabWidget.updateTranslationIcon(e,!0)},removeTranslationIcon:function(t){var e=t&&t[0].propertyParentModel;return this.consumeView.tabWidget.updateTranslationIcon(e,!1)},_handleKeydown:function(t,e,i){var o=e.keyCode;if(this._shouldShowToolbar(e,o))return this.showToolbar(t,i),e.preventDefault(),!1;this.overridden._handleKeydown(t,e,i)},_shouldShowToolbar:function(t,e){return t.shiftKey&&121===e},moveViewBefore:function(t,e){t.id!==e&&t.getNextSiblingId()!==e&&t.updateModel({updateArray:[{id:t.id,parentId:t.getParent().id,insertBefore:e}]})},showView:function(t){this.isToolbarShown&&this.hideToolbar(),this.overridden.showView(t)},showToolbar:function(t,i){if(this.isToolbarShown)this.hideToolbar();else{this.isToolbarShown=!0,this.toolbar.clearItems();var o=this._toolbarItems(t);this.toolbar.addItems(o),this.toolbar.setSelectionContext(e(i)),this.toolbar.show()}},hideToolbar:function(){return this.isToolbarShown=!1,this.toolbar.hide()},_toolbarItems:function(t){var e=[];return e.push({icon:this._icons.getIcon("edit").id,label:o.get("toolbarActionEditTitle"),name:"rename",type:"Button",action:this.editViewTitle.bind(this,t)}),e.push({icon:this._icons.getIcon("dashboard-duplicate").id,label:o.get("duplicate"),name:"duplicate",type:"Button",action:this.duplicateTab.bind(this,t.id)}),"disabled"!==this.config.changeTabTemplate&&e.push({icon:this._icons.getIcon("template").id,label:o.get("changeTemplate"),name:"changeTemplate",type:"Button",disabled:"NoTemplate"===t.templateName,action:this.selectTemplate.bind(this,t.id)}),e},add:function(t,i){for(var o=this,n=t.model,r=this.consumeView.tabWidget.state.tabs,a=void 0,s=!0,d=0;d<r.length;d++)if(this.consumeView._getModelIdFromPanel(r[d].props.id)===n.id){s=!1,a=d;break}if(s){var l=e(this.htmlTemplate.replaceLayoutValues(this.htmlTemplate.getItemTemplate("tab","",n),this.model));l.append(t.domNode),this.$el.find(".tabPageHolder").append(l);var h=[],u=this.consumeView._createTabPanel(n,l,this.consumeView._getColorProperties());i?r.forEach((function(t){o.consumeView._getModelIdFromPanel(t.props.id)===i&&h.push(u),h.push(t)})):(h=r.slice()).push(u),this.consumeView.tabWidget.setState({tabs:h}),this.consumeView.canvas.selectContent([n.id]),this.overridden._attachView(n),this._attachView(n)}else{if(!(null===i&&a===r.length-1||r[a+1]&&this.consumeView._getModelIdFromPanel(r[a+1].props.id)===i)){var c=[];r.forEach((function(t){o.consumeView._getModelIdFromPanel(t.props.id)===i?(c.push(r[a]),c.push(t)):o.consumeView._getModelIdFromPanel(t.props.id)!==n.id&&c.push(t)})),null===i&&c.push(r[a]),this.consumeView.tabWidget.setState({tabs:c})}this.$el.find("#"+this._getViewId(n)).append(t.domNode)}!1===this.consumeView.tabWidget.state.deleteable&&this.allowTabDeletion()&&this.consumeView.tabWidget.setState({deleteable:!0})},allowTabDeletion:function(){return this.model.items.length>1},_getDefaultViewLabel:function(){for(var t=this.model.items.length,e=1;e<t+1;e++){for(var i=!0,n=0;n<t;n++)if(this.model.items[n].get("title")===o.get("defaultTabTitle",{index:e})){i=!1;break}if(i)return o.get("defaultTabTitle",{index:e})}return o.get("defaultTabTitle",{index:t+1})},onAddClick:function(){return this._invokeLifeCycleHandlers("tabs.onPressNew",{$el:this.$el}).then(function(){this._openTemplateSelectDialog()}.bind(this))},onReorder:function(t,e,i){var o=null;e+1<t.length&&(o=this.consumeView._getModelIdFromPanel(t[e+1].props.id));var n=this.consumeView._getModelIdFromPanel(i);this.moveViewBefore(this.model.findModel(n),o),this.consumeView.eventRouter.trigger("properties:refreshPane")},onTabLabelChange:function(t){this.consumeView.tabWidget.updateTabLabel(t);var e="tabIndividualStylingLink"+this.model.items.findIndex((function(e){return e.id===t.id})),i={propertyName:e,subPropertyName:"r_"+e+"0",value:t.get("title")};this.consumeView.eventRouter.trigger("properties:setValue",i),this.consumeView.eventRouter.trigger("properties:setChildValue",{propertyName:"title",value:t.get("title"),contentId:t.id})},onTabIconChange:function(t,e){if(this.consumeView.tabWidget.updateTabIcon(t),e&&"UndoRedoController"===e.sender){var i=this.consumeView.canvas.getContent(t.id);this.consumeView.eventRouter.trigger("properties:refreshChild",{content:i}),this.consumeView.eventRouter.trigger("properties:refreshPane")}},setupGlobalDropZone:function(){var t=this;this._tabStripDropZone&&this._tabStripDropZone.remove(),this._tabStripDropZone=this._dndManager.addDropTarget(e(this.consumeView.tabWidget.tabListNode),"[role=tab]",{accepts:function(t){return"widget"===t.type},onDragEnter:function(i,o){var n=t.consumeView._getPanelFromNode(o).props.hoverColor;e(o).css("background-color",n)},onDragLeave:function(i,o){var n=t.consumeView._getPanelFromNode(o).props.backgroundColor;e(o).css("background-color",n)},onDrop:function(e,i){var o=t.consumeView._getPanelFromNode(i);if("widget"===e.type&&o){var n=t.consumeView._getModelIdFromPanel(o.props.id);a.handleWidgetDrop(t.consumeView.canvas,n,e)}},info:function(e){var i=t.consumeView._getPanelFromNode(e);return i?{containerId:t.consumeView._getModelIdFromPanel(i.props.id)}:{}},type:"dropOnTab"}),this._tabDropHandler||(this._tabDropHandler=this._dndManager.registerDropHandler({accepts:function(t,e){return t.type.match(/content\..*/)&&"dropOnTab"===e.type},onDrop:function(e,i){if(i.info.containerId){var o=_extends({},e.data,{containerId:i.info.containerId});t.consumeView.canvas.addContent(o)}}}))},updateViewLabel:function(t,e){this.consumeView.canvas.getContent(t.id).setPropertyValue("title",e)},duplicateTab:function(t){this.model.boardModel.duplicateLayout(t)},deleteView:function(t){this.consumeView.canvas.removeContent(t),this.services.getSvcSync("TranslationService").deregisterView(t)},selectTemplate:function(t){this._openTemplateSelectDialog(t,!0)},_templateSelectDialogViewOptions:function(){var t=this.dashboardApi.getCanvas().getPropertyValue("excludedTemplates");t.push("NoTemplate");var e=document.createElement("div");return e.classList.add("templatePickerDialog"),{el:e,templateListing:this.templateListing,layoutsPath:this.layoutsPath,disableHeaderSection:!0,action:function(){},excludeTemplates:t}},_openTemplateSelectDialog:function(t,e){var i=this,n=void 0,r=void 0,a=void 0,l=this._templateSelectDialogViewOptions();e?!0===e&&(a=function(e){var o=e.layout;i._updateTemplateDropZones(t,o),i.lastSelectedTemplate=o.templateName,n.hide()}):a=function(t){var e=t.layout;i._addBoardLayout(e),i._setDefaultLayoutPositioning(),i.lastSelectedTemplate=e.templateName,n.hide()},l.action=function(){return r.getSelectedLayoutSpec().then(a)},n=new s({title:o.get("selectTemplateLabel"),viewClass:d,viewOptions:l,okCallback:l.action,buttons:[{text:o.get("dlg_create"),handler:l.action,type:"primary"},"cancel"],showCloseX:!0,width:"850px"}),(r=n.view).setNavigationTemplate("tab");var h=this.lastSelectedTemplate||this.model.items.length>0&&this.model.items[0].templateName||"NoTemplate";r.selectLayout(h),n.open()},_setDefaultLayoutPositioning:function(){var t=this.model.getValueFromSelfOrParent("layoutPositioning")||"relative",e=this.model.findDescendantsWithType("genericPage"),i=Array.isArray(e),o=0;for(e=i?e:e[Symbol.iterator]();;){var n;if(i){if(o>=e.length)break;n=e[o++]}else{if((o=e.next()).done)break;n=o.value}n.layoutPositioning=t}},editViewTitle:function(t){var e=this;this.hideToolbar().then((function(){e.consumeView.tabWidget.editTabLabel(!0,t)}))},_addBoardLayout:function(t){(t=t||{type:"absolute"}).title=this._getDefaultViewLabel(),t.localizedProps=["title"];var e={spec:t,containerId:this.model.id};this.consumeView.canvas.addContent(e)},_updateTemplateDropZones:function(t,e){this.model.boardModel.updateLayoutDropZones({id:t,model:e})},removeChild:function(t){var i=this;if(t){t.model.off("change:title");var o=t.model,n=this.consumeView.tabWidget.state.tabs,r=!1,a=[],s=void 0;if(n.forEach((function(t,e){i.consumeView._getModelIdFromPanel(t.props.id)===o.id?(r=!0,s=e):a.push(t)})),r){var d={tabs:a};if(this.consumeView._getViewId(o)===this.consumeView._currentViewId){var h=Math.max(s-1,0);d.selectedTab=this.consumeView._getPanelId(this.model.items[h].id)}this.consumeView.tabWidget.setState(d)}var u="#"+t.domNode.parentNode.id;e(u).remove(),l.inherited("removeChild",this,arguments),!0!==this.consumeView.tabWidget.state.deleteable||this.allowTabDeletion()||this.consumeView.tabWidget.setState({deleteable:!1})}},_invokeLifeCycleHandlers:function(t,e){return this.services.getSvc(".LifeCycleManager").then((function(i){return i.invokeLifeCycleHandlers(t,e)}))}})})),define("dashboard-core/js/dashboard/layout/authoring/views/Group",["./Absolute","../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","jquery"],(function(t,e,i){var o=null;return o=t.extend({init:function(){o.inherited("init",this,arguments),this.specializeConsumeView(["onResize","onResizeStep","onSelect","onDeselect","getWidgetPositionUpdate","getMinimumTop","getMinimumLeft","getMaximumHeight","getMaximumWidth"])},createDropZone:function(){},getFirstNonGroupAncestorView:function(){var t=i(this.domNode).parents(".pagegroup");return(t.length>0?t[t.length-1]:this.domNode)._layout.parentLayout},onSelect:function(){for(var t,e=this.model.items,i=0;i<e.length;i++)(t=this.layoutController.getLayoutView(e[i].id))&&t.onSelect&&t.onSelect(!0)},onDeselect:function(){for(var t,e=this.model.items,i=0;i<e.length;i++)(t=this.layoutController.getLayoutView(e[i].id))&&t.onDeselect&&t.onDeselect()},getPositionRelativeToPage:function(){for(var t=i(this.domNode),e={x:parseInt(t.css("left"),10),y:parseInt(t.css("top"),10)},o=t.parents(".pagegroup"),n=0;n<o.length;n++)e.x+=parseInt(i(o[n]).css("left"),10),e.y+=parseInt(i(o[n]).css("top"),10);return e},getMinimumLeft:function(){var t=this.getPositionRelativeToPage();return this.getFirstNonGroupAncestorView().getMinimumLeft()-t.x},getMinimumTop:function(){var t=this.getPositionRelativeToPage();return this.getFirstNonGroupAncestorView().getMinimumTop()-t.y},getMaximumWidth:function(){var t=this.getFirstNonGroupAncestorView().getMaximumWidth();t&&(t-=this.getPositionRelativeToPage().x);return t},getMaximumHeight:function(){var t=this.getFirstNonGroupAncestorView().getMaximumHeight();t&&(t-=this.getPositionRelativeToPage().y);return t}})})),define("dashboard-core/js/dashboard/layout/authoring/views/TemplateDropZone",["jquery","underscore","./LayoutBaseView","../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","../../../../app/nls/StringResources","../../../../lib/@waca/core-client/js/core-client/utils/Deferred","../../LayoutHelper","../../../glass/util/InstrumentationUtil"],(function(t,e,i,o,n,r,a,s){var d=null;return d=i.extend({init:function(t){d.inherited("init",this,arguments),this.services=t.services,this.specializeConsumeView(["setPreferredLocation","isLayoutRelatedToDropZone","addRelatedModel","removeRelatedModel"]),this.$el.parent().addClass("templateDropZoneContainer"),this.updateRelatedContentState(),this.whenIsReadyDfd=new r,this.initializeDropZones()},initializeDropZones:function(){this._dndManager=this.dashboardApi.getFeature("DashboardDnd.internal"),this.centerDrop||(this.centerDrop=t('<div class="centerDrop"><div class="dropIcon"><svg class="svgIcon" role="img" focusable="false"><use style="pointer-events: none; " xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#dashboard-fullscreen"></use></svg></div><div class="dropLabel">'+n.get("dropZoneLabel")+"</div></div>"),this.centerDrop.hide(),this.$el.append(this.centerDrop));var e=this.centerDrop.find(".dropIcon");this._dndManager.addDropTarget(e[0],{accepts:this.accepts.bind(this),onDrop:this.onCentreDrop.bind(this),onDragEnter:this.onCentreDragEnter.bind(this),onDragLeave:this.onCentreDragLeave.bind(this),priority:-100}),this._dndManager.addDropTarget(this.domNode,{accepts:function(){return!1},onDragEnter:this.onDragZoneEnter.bind(this),onDragLeave:this.onDragZoneLeave.bind(this),onDrop:this.onDropZoneDrop.bind(this),receiveEventsWhenNotAccepting:!0,priority:-99}),this._setupGlassDroppables(e),this.whenIsReadyDfd.resolve()},whenIsReady:function(){return this.whenIsReadyDfd.promise},_setupGlassDroppables:function(t){if(this.$el.glassDroppableV2){var e=this;t.glassDroppableV2({onDrop:this._onPinDrop.bind(this),onEnter:this.onGlassCentreDragEnter.bind(this),onLeave:this.onCentreDragLeave.bind(this),allowOnDropPropagation:!1}),this.$el.glassDroppableV2({onEnter:function(){this.id===e.$el[0].id&&e.onDragZoneEnter()},onLeave:function(){this.id===e.$el[0].id&&e.onDragZoneLeave()},onDrop:function(){return e.onDropZoneDrop(),!0},allowOnDropPropagation:!0})}},_showCenterDrop:function(t,e){var i=null;if(e){var o=t.nodeInfoList[0].node._layout;o&&(i=o.model.id)}(!this.hasMaximizedWidget()||i&&this.isWidgetMaximized(i))&&this.centerDrop.show()},onDragZoneEnter:function(t){this.inDropZone=!0;var e=t&&t.data||{},i=!e.nodeInfoList,o=e.nodeInfoList&&1===e.nodeInfoList.length;if(i||o){this._showCenterDrop(e,o);var n=this._dndManager.getDropTargetFromNode(this.centerDrop.find(".dropIcon")[0]);this._dndManager.reassessDropTarget(n)}},onDragZoneLeave:function(){this.centerDrop.hasClass("active")||this.centerDrop.hide(),this.inDropZone=!1},onDropZoneDrop:function(){this.deactivateAndhideCenterDropZone(),this.inDropZone=!1},deactivateAndhideCenterDropZone:function(){this.centerDrop&&(this.centerDrop.removeClass("active"),this.centerDrop.hide())},destroy:function(){this._dndManager&&(this._dndManager.removeDropTarget(this.centerDrop.find(".dropIcon")[0]),this._dndManager.removeDropTarget(this.domNode),this._dndManager=null),this.centerDrop.remove(),this.centerDrop=null,this.$el.parent().find(".pagetemplateDropZone")<=1&&this.$el.parent().removeClass("templateDropZoneContainer"),t.glassdnd&&t.glassdnd.cancelDroppable&&t.glassdnd.cancelDroppable(this.$el),d.inherited("destroy",this,arguments)},accepts:function(t){return this.dashboardApi.getFeature("CanvasDnD").accepts(t,{fromTemplate:!0})},onCentreDragEnter:function(){this.centerDrop.addClass("active")},onGlassCentreDragEnter:function(){this.centerDrop.show(),this.centerDrop.addClass("active")},onCentreDragLeave:function(){this.centerDrop.removeClass("active"),this.inDropZone||this.centerDrop.hide()},onCentreDrop:function(t){var e=this,i=Promise.resolve();return"move"===t.data.operation?i=Promise.resolve(this._moveDrop(t)):"pin"===t.type&&"new"===t.data.operation?i=Promise.resolve(this._onPinDrop(t)):"new"!==t.data.operation&&"MODEL_ITEM"!==t.type&&"GRID_HEADER_ITEM"!==t.type||(i=this._newDrop(t)),i.then((function(){return e.deactivateAndhideCenterDropZone()}))},_moveDrop:function(t){for(var e,i,o=[],n=0;n<t.data.nodeInfoList.length;n++)e=t.data.nodeInfoList[n].node._layout.model,i={style:{},parentId:this.model.getParent().id,id:e.id},this.setPreferredLayoutProperties(i),i.insertBefore=this.getWidgetIdForInsertBefore(),o.push(i);var r=this.dashboardApi.getFeature("Transaction"),a=r.startTransaction(),s=o.map((function(t){return t.id}));this.dashboardApi.getCanvas().moveContent(this.model.getParent().id,s,a),this.updateModel(o,a,!1),r.endTransaction(a)},_newDrop:function(t){var e=this;return this._getModelToAddFromDragObject(t).then((function(i){if(i){var o={model:i,parentId:e.id,layoutProperties:t.data.layoutProperties||{}};s.trackWidget("created",e.dashboardApi,o.model),e.setPreferredLocation(o),e._addWidget(o,t.isTouch)}}))},_onPinDrop:function(t){var e=t.data.pinSpec,i=t.isTouch;"boardFragment"===e.contentType&&this.setPreferredLayoutProperties(e.content.layout),e.parentId=this.id,this.setMaximizedStateParentLocation(e),this._processWidgetSpecForPin(e,i),this.deactivateAndhideCenterDropZone()},setPreferredLocation:function(t){this.setPreferredLayoutProperties(t.layoutProperties),this.setMaximizedStateParentLocation(t)},setMaximizedStateParentLocation:function(t){t.parentId=this.model.getParent().id,t.insertBefore=this.getWidgetIdForInsertBefore()},setPreferredLayoutProperties:function(t){if(t.style||(t.style={}),this.$el.is(":visible")){var e=this.$el.offset(),i=this.$el.parent().offset();t.style.top=Math.round(e.top-i.top),t.style.left=Math.round(e.left-i.left),t.style.height=this.$el.outerHeight(),t.style.width=this.$el.outerWidth(),this.moveToFitBoundaries(this.$el.parent().height(),this.$el.parent().width(),t.style),a.styleIntToPx(t.style)}else{var o=this.$el[0],n=this._calculateStylePercentage(o.style);t.style=n}},getWidgetIdForInsertBefore:function(){var i=this.$el.height(),o=this.$el.width(),n=this.$el.siblings(":not(.pagetemplateDropZone)"),r=e.find(n,(function(e){if(e._layout){var n=t(e);return n.outerHeight()<i-5||n.outerWidth()<o-5}return!1}));return r?r._layout.model.id:null},isLayoutRelatedToDropZone:function(t){var e={};this.setPreferredLayoutProperties(e);var i,n,r,a;if(this.$el.is(":visible")){var s=o.position(t),d=o.widgetSize(t);i=this.isNear(Math.round(s.top),e.style.top,5),n=this.isNear(Math.round(s.left),e.style.left,5),r=this.isNear(d.height,e.style.height,10),a=this.isNear(d.width,e.style.width,10)}else i=this.isNear(t.style.top,e.style.top,10),n=this.isNear(t.style.left,e.style.left,10),r=this.isNear(t.style.height,e.style.height,10),a=this.isNear(t.style.width,e.style.width,10);return i&&n&&r&&a},addRelatedModel:function(t,e){var i=this.model.relatedLayouts||"|";-1===i.indexOf("|"+t+"|")&&(i+=t+"|"),this.model.set({relatedLayouts:i},{payloadData:e.data}),this.updateRelatedContentState()},hasMaximizedWidget:function(){return!!this.model.relatedLayouts},isWidgetMaximized:function(t){return-1!==(this.model.relatedLayouts||"|").indexOf("|"+t+"|")},removeRelatedModel:function(t,e){var i=this.model.relatedLayouts;i&&-1!==i.indexOf("|"+t+"|")&&("|"===(i=i.replace("|"+t+"|","|"))&&(i=""),this.model.set({relatedLayouts:i},{payloadData:e.data})),this.updateRelatedContentState()},updateRelatedContentState:function(){this.model.relatedLayouts?this.$el.removeClass("empty"):this.$el.addClass("empty")},isNear:function(t,e,i){return Math.abs(parseInt(t,10)-parseInt(e,10))<=i},_calculateStylePercentage:function(t){var e={};return e.top=t.top,e.left=t.left,e.width=100-parseInt(t.right,10)-parseInt(t.left,10)+"%",e.height=100-parseInt(t.bottom,10)-parseInt(t.top,10)+"%",e}})})),define("dashboard-core/js/dashboard/layout/authoring/views/ScalingAbsolute",["./Absolute","jquery","underscore","../../../util/PxPercentUtil","../../../../app/util/DeepClone"],(function(t,e,i,o){var n=null;return n=t.extend({init:function(t){if(n.inherited("init",this,arguments),this.model.on("insert:item",this._onNewItem,this),this.model.items)for(var e=0;e<this.model.items.length;e++)this._setChildMonitors(this.model.items[e]);this.specializeConsumeView(["setPreferredLocation"]),this.dashboardApi=t.dashboardApi},destroy:function(){if(this.model.off("insert:item",this._onNewItem,this),this.$el.find(".relativeLayoutGrid").remove(),this.model.items)for(var t=0;t<this.model.items.length;t++)this._setChildMonitors(this.model.items[t],"off");n.inherited("destroy",this,arguments)},_setChildMonitors:function(t,e){var i="off"===e?"off":"on";t[i]("change:style",this._onChildModelStyleChange,this),t[i]("prechange:style",this._onChildModelStylePreChange,this),t[i]("change:parent",this._onChildModelUpdateParent,this)},_onNewItem:function(t){var e=this.model.findModel(t.value.parameter.model.id);this._setChildMonitors(e),this.updateStyleToPercent(e,t.data)},_onChildModelUpdateParent:function(t){if(t.value.parameter.parentId!==this.model.id){var e=this.layoutController.topLayoutModel.findModel(t.modelId);this._setChildMonitors(e,"off")}},_onChildModelStyleChange:function(t){if(t.data&&"updateStyleToPercent"!==t.data.hint&&"UndoRedoController"!==t.sender){var e=this.layoutController.topLayoutModel.findModel(t.modelId);this.updateStyleToPercent(e,t.data)}},_onChildModelStylePreChange:function(t){if("UndoRedoController"!==t.sender){var e=t.value&&t.value.style;this._changePixelModelToPercent(e)}},_changePixelModelToPercent:function(t){var i=this.$el;i.is(":visible")||(i=e(this.layoutController.getLastVisiblePage()));var n={width:i.width(),height:i.height()};o.changePixelPropertiesToPercent(t,n)},updateStyleToPercent:function(t,e){var o=this;return this.layoutController.layoutReady(t.id).then((function(){return new Promise((function(n,r){try{if(t.getParent()&&t.getParent().id===o.model.id&&t.style){var a=i.extend({},t.style);o._changePixelModelToPercent(a);var s=i.deepClone(e);s.hint="updateStyleToPercent",s.triggerResize=!1,t.updateModel({updateArray:[{style:a,id:t.id}]},null,s)}n()}catch(t){r(t)}}))}))},_moveDrop:function(t){var e=t.data.nodeInfoList[0],i=e.node._layout.model,o=i.getParent();if(n.inherited("_moveDrop",this,arguments),o.id!==this.model.id){var r=this.model.findModel(i.id);this._setChildMonitors(r),o.deselect(i.id)}},getMinimumTop:function(){var t=this.consumeView.parentLayout?this.consumeView.parentLayout.getMinimumTop():0;return-1*(this.$el.position().top+this.$el.parent().scrollTop())+t},getMinimumLeft:function(){var t=this.consumeView.parentLayout?this.consumeView.parentLayout.getMinimumLeft():0;return-1*(this.$el.position().left+this.$el.parent().scrollLeft())+t},getScrollAreaNode:function(){return this.consumeView.parentLayout.$el},renderGrid:function(){var t=this.model.getValueFromSelfOrParent("showGrid"),e=void 0!==t&&t,i=this.model.getValueFromSelfOrParent("layoutPositioning");e&&"relative"===i?this.$el.hasClass("gridCapable")&&(this.$el.find(".relativeLayoutGrid").remove(),this.$el.prepend(this._createGridSvg(this.$el[0].id,this.$el.hasClass("infoGraphic")))):this.$el.find(".relativeLayoutGrid").remove()},_createGridSvg:function(t,e){var i=this.model.getValueFromSelfOrParent("layoutPositioning"),o=this.getPhysicalPageSize(i,t),n=0;return n=e?o.width/60:o.width/100,'<div class="relativeLayoutGrid">\t\t\t\t<svg viewBox="0 0 '+o.width+" "+o.height+'" xmlns="http://www.w3.org/2000/svg">\t\t\t\t\t<defs>\t\t\t\t\t\t<pattern id="grid'+t+'" width="'+n+'" height="'+n+'" patternUnits="userSpaceOnUse">\t\t\t\t\t\t\t<path d="M '+n+" 0 L 0 0 0 "+n+'" fill="none" stroke-width="0.5"/>\t\t\t\t\t\t</pattern>\t\t\t\t\t</defs>\t\t\t\t\t<rect width="100%" height="100%" fill="url(#grid'+t+')" />\t\t\t\t</svg>\t\t\t</div>'}})})),define("dashboard-core/js/dashboard/layout/authoring/views/TemplateContainer",["jquery","./Absolute"],(function(t,e){var i=null;return i=e.extend({init:function(){i.inherited("init",this,arguments),this.scrollPosition={top:this.domNode.scrollTop,left:this.domNode.scrollLeft},this.$el.on("scroll."+this.id,this._onScroll.bind(this))},destroy:function(){i.inherited("destroy",this,arguments),this.$el.off("scroll."+this.id)},createDropZone:function(){},_onScroll:function(){var t=this.domNode.scrollTop,e=this.domNode.scrollLeft;this._dndManager.scrollChildrenCandidateDropTargets(this.domNode,this.scrollPosition.top-t,this.scrollPosition.left-e),this.scrollPosition.top=t,this.scrollPosition.left=e},_getTemplateLayoutView:function(){var e=null;if(this.model.items&&this.model.items.length>0){var i=this.model.items[0];e=t("#"+this.layoutController.modelIdToNodeId(i.id),this.layoutController.$el)[0]._layout}return e},_addWidget:function(t,e){var i=this._getTemplateLayoutView();if(i){t.parentId=i.model.id;var o=parseInt(t.layoutProperties.style.top,10),n=parseInt(t.layoutProperties.style.left,10),r=i.$el.position(),a=o-r.top-this.domNode.scrollTop,s=n-r.left-this.domNode.scrollLeft;t.layoutProperties.style.top=Math.round(Math.max(a,i.getMinimumTop()))+"px",t.layoutProperties.style.left=Math.round(Math.max(s,i.getMinimumLeft()))+"px",i.authorHelper._addWidget(t,e)}},setPreferredLocation:function(t){var e=this._getTemplateLayoutView();e&&e.setPreferredLocation&&e.setPreferredLocation(t)}})})),define("dashboard-core/js/dashboard/layout/authoring/views/TemplateIndicator",["./Absolute","../../../../lib/@waca/core-client/js/core-client/utils/Deferred"],(function(t,e){var i=null;return i=t.extend({init:function(t){i.inherited("init",this,arguments),this.services=t.services,this.specializeConsumeView(["setPreferredLocation"]),this.$el.parent().addClass("templateDropZoneContainer"),this.whenIsReadyDfd=new e,this.whenIsReadyDfd.resolve()},_initialize:function(){},destroy:function(){this.$el.parent().removeClass("templateDropZoneContainer"),i.inherited("destroy",this,arguments)},setPreferredLocation:function(t){var e=this.model.getParent().id;i.inherited("setPreferredLocation",this,arguments),t.parentId=e},getWidgetContainerNode:function(){return this.domNode.parentNode}})})),define("dashboard-core/js/dashboard/layout/authoring/TemplateHelper",["jquery"],(function(t){return function(){function e(t){if(_classCallCheck(this,e),this._model=t.model,this._layoutController=t.layoutController,this._model.on("insert:item",this._onNewItem,this),this._model.on("remove:item",this._onRemoveItem,this),this._model.items)for(var i=0;i<this._model.items.length;i++)this._setChildMonitors(this._model.items[i])}return e.prototype.destroy=function(){if(this._model.off("insert:item",this._onNewItem,this),this._model.off("remove:item",this._onRemoveItem,this),this._model.items)for(var t=0;t<this._model.items.length;t++)this._setChildMonitors(this._model.items[t],"off")},e.prototype.setPreferredLocation=function(t){var e=!1,i=this._layoutController.getLayoutView(this._model.id).$el.find(".pagetemplateDropZone.empty");return i.length>0&&(i[0]._layout.setPreferredLocation(t),e=!0),e},e.prototype._setChildMonitors=function(t,e){var i="off"===e?"off":"on";t[i]("change:style",this._onChildModelStyleChange,this),t[i]("change:parent",this._onChildModelUpdateParent,this)},e.prototype._onNewItem=function(t){var e=this._model.findModel(t.value.parameter.model.id);this._setChildMonitors(e),this._updateDropZonesState(e,t.data)},e.prototype._onRemoveItem=function(t){for(var e=this._layoutController.getLayoutView(t.modelId).$el.children(".pagetemplateDropZone"),i=t.value.parameter,o=0;o<e.length;o++)e[o]._layout.removeRelatedModel(i,t)},e.prototype._clearDropZoneState=function(t,e){for(var i=this._layoutController.getLayoutView(t.id),o=i&&i.$el?i.$el.children(".pagetemplateDropZone"):[],n=void 0,r=0;r<o.length;r++){if((n=o[r])._layout)n._layout.removeRelatedModel(t.id,e)}t.set({relatedLayouts:""},{payloadData:e.data})},e.prototype._onChildModelUpdateParent=function(t){if(t.data&&"updateStyleToPercent"!==t.data.hint&&"UndoRedoController"!==t.sender){var e=this._layoutController.topLayoutModel.findModel(t.modelId);this._clearDropZoneState(e,t.data),this._setChildMonitors(e,"off")}},e.prototype._onChildModelStyleChange=function(t){var e=this._layoutController.topLayoutModel.findModel(t.modelId);this._updateDropZonesState(e,t.data)},e.prototype._updateDropZonesState=function(e,i){var o=this;setTimeout((function(){o._layoutController.layoutReady(e.id).then((function(){for(var n=o._layoutController.dashboardApi.getCanvas().getContent(e.id),r=o._layoutController.getLayoutView(o._model.id),a=t("#"+o._layoutController.modelIdToNodeId(e.id),r.$el),s=a.siblings(".pagetemplateDropZone"),d=void 0,l=null,h=0;h<s.length;h++)(d=s[h])._layout&&function(){var t=d._layout;if(t.isLayoutRelatedToDropZone(a[0]))(l=t).addRelatedModel(e.id,i);else{var o=n.findContent();o&&0!=o.length&&o.forEach((function(e){t.removeRelatedModel(e.getId(),i)})),t.removeRelatedModel(e.id,i)}}();e.set({relatedLayouts:l?l.model.id:""},{payloadData:i.data})}))}),10)},e}()})),define("dashboard-core/js/dashboard/layout/authoring/views/GenericPage",["jquery","underscore","./Absolute","./ScalingAbsolute","../TemplateHelper","../../../util/PxPercentUtil","../../../../app/util/DeepClone"],(function(t,e,i,o,n,r){return function(){function t(e){_classCallCheck(this,t),this._options=e;var i={model:e.model,layoutController:e.layoutController};this._options.templateHelper=new n(i);var o=e.model.getValueFromSelfOrParent("layoutPositioning");this._switchLayoutView(o),this._setPageLayoutStyling(o),this._delegateView.model.on("change:layoutPositioning",this._onChangeLayoutPositioning,this)}return t.prototype.destroy=function(){this._delegateView.model.off("change:layoutPositioning",this._onChangeLayoutPositioning,this),this._delegateView.destroy(),this._options.templateHelper.destroy(),this._options.templateHelper=null},t.prototype._switchLayoutView=function(t){this._delegateView&&this._delegateView.destroy(),this._delegateView="absolute"===t?new i(this._options):new o(this._options),this._delegateView.consumeView.authorViewManager=this},t.prototype._onChangeLayoutPositioning=function(t){this._switchLayoutView(t.value),this._setPageLayoutStyling(t.value),"UndoRedoController"!==t.sender&&this._convertLayoutPositioning(t)},t.prototype._convertLayoutPositioning=function(t){var i=this._delegateView.getPhysicalPageSize("absolute"),o=this._delegateView.model.findDescendantsWithType(["widget","group"]).map((function(o){var n=e.deepClone(o.style);return"relative"===t.value?r.changePixelPropertiesToPercent(n,i):r.changePercentPropertiesToPixel(n,i),{id:o.id,style:n}})),n=this._delegateView.dashboardApi.getFeature("Transaction"),a=n.startTransactionById(t.data.undoRedoTransactionId),s="change:layoutPositioning"!==t.eventName;"absolute"===t.value&&e.extend(t.data,{hint:"updateStyleToPercent"}),this._delegateView.updateModel(o,a,s),n.endTransaction(a)},t.prototype._setPageLayoutStyling=function(t){var e="relative"===t;this._delegateView.$el.toggleClass("pagescalingAbsolute",e),this._delegateView.$el.toggleClass("pageabsolute",!e)},t}()})),define("dashboard-core/js/dashboard/layout/authoring/views/all",["./Absolute","./Tab","./Group","./TemplateDropZone","./ScalingAbsolute","./TemplateContainer","./TemplateIndicator","./GenericPage"],(function(){})),define("dashboard-core/js/dashboard/layout/authoring/interaction/BasePropertyAction",["../../../../lib/@waca/core-client/js/core-client/ui/core/Events"],(function(t){var e=null;return e=t.extend({init:function(t){this.controller=t,this.dashboardApi=t.dashboardApi,e.inherited("init",this,arguments)},refreshProperties:function(){var t=this;setTimeout((function(){return t.controller.eventRouter.trigger("properties:refreshPane")}),100)},updateModel:function(t,e){var i=this,o=this.dashboardApi.getFeature("Transaction"),n=o.startTransaction(e);t.forEach((function(t){var e=i.dashboardApi.getCanvas().getContent(t.id),o=Object.assign(n||{},{validatePropertyValue:!1});Object.keys(t.style).forEach((function(i){e.setPropertyValue(i,t.style[i],n)})),o=Object.assign(n||{},{validatePropertyValue:!0}),Object.keys(t.style).forEach((function(i){e.setPropertyValue(i,t.style[i],o)}))})),o.endTransaction(n)}})})),define("dashboard-core/js/dashboard/layout/authoring/interaction/BaseStylePropertyAction",["./BasePropertyAction"],(function(t){return t.extend({_getWidgetSize:function(t,e){var i=e[0]._layout.widget?e[0]._layout.widget:e[0]._layout;return this._getSize(t,i.$el)},_getWidgetOffset:function(t,e){var i=e[0]._layout.widget?e[0]._layout.widget:e[0]._layout;return this._getOffset(t,i.$el)-this._getOffset(t,e[0]._layout.parentLayout.$el)},_getParentDim:function(t,e){return this._getSize(t,e[0]._layout.parentLayout.$el)},_getSize:function(t,e){return"width"===t?e.width():e.height()},_getOffset:function(t,e){var i=e.offset();return"width"===t?i.left:i.top},_sanitizePercentSizeOnPage:function(t,e){var i=t;i=Math.max(Math.min(100,i),0);var o=0;return this.propertyNodes.forEach((function(t){o=Math.max(o,parseFloat(t._layout.model.style[e]))})),o+i>100&&(i=100-o),i},_updateInputProperty:function(t,e){this.ignoreOnChange=!0,t.setValue(e),t.onChangeValueHold=e,this.ignoreOnChange=!1},getUnitsFromValue:function(t){return t.replace(/[\d.-]/g,"")},getValueString:function(t,e){return String(Number(t.toFixed("px"===e?0:2)))+" "+e},changeProperty:function(t,e){if(t.ignoreOnChange)t.ignoreOnChange=!1;else{var i=parseFloat(this.getValue());if(isNaN(i))t._updateInputProperty(this,this.onChangeValueHold);else{i=t._processChange.apply(t,[e,i,this.units]);var o=t.getValueString(i,this.units);t._updateInputProperty(this,o)}}},wrapChangeProperty:function(){var t=this;return function(){var e=[t].concat(Array.prototype.slice.call(arguments));t.changeProperty.apply(this,e)}},_getValuesForProperties:function(t){var e=this;if(t.forEach((function(t){t.value=t.getProp(e.propertyNodes[0])})),this.propertyNodes.length>1)for(var i=function(i){return t.forEach((function(t){t.break||t.getProp(e.propertyNodes[i])!==t.value&&(t.value="",t.break=!0)})),"break"},o=1;o<this.propertyNodes.length;o++){if("break"===i(o))break}t.forEach((function(t){""!==t.value&&(t.value=e.getValueString(parseFloat(t.value),t.units))}))},showStyleProperties:function(t){var e=t._layout.parentLayout;return!e||!e.model||"group"!==e.model.type},getProperties:function(){this.propertyNodes=this.selectedNodes}})})),define("dashboard-core/js/app/util/ScreenReaderUtil",["jquery","../../lib/@waca/core-client/js/core-client/ui/core/Class"],(function(t,e){var i=null;return i=e.extend({INPUTBOX_ID:"boardScreenReaderInputBox",CLEAR_TIMER_DURATION:500,oCallOutClearTimer:null,init:function(){if(i.inherited("init",this,arguments),0===t("#"+this.INPUTBOX_ID).length){var e=document.createElement("div");e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",e.style.position="absolute",e.style.top="-1px",e.style.left="-1px";var o=document.createElement("input");o.type="text",o.id=this.INPUTBOX_ID,o.setAttribute("aria-selected","false"),o.setAttribute("aria-live","assertive"),o.setAttribute("tabIndex","-1"),t(e).append(o),t("body").append(e)}},callOut:function(e){this.oCallOutClearTimer&&clearInterval(this.oCallOutClearTimer),t("#"+this.INPUTBOX_ID).val(e),this.oCallOutClearTimer=setTimeout(function(){t("#"+this.INPUTBOX_ID).val("")}.bind(this),this.CLEAR_TIMER_DURATION)},destroy:function(){t("#"+this.INPUTBOX_ID).parent().remove(),i.inherited("destroy",this,arguments)}})})),define("text!dashboard-core/js/dashboard/layout/authoring/interaction/MoveEdges.html",[],(function(){return'<div edge="t" action="move" class="resizeEdge top move">\n\t<div class="resizePoint resizeHandle moveHandle">\n\t\t<div class="svgContainer">\n\t\t\t<div class="move">\n\t\t\t\t<svg class="svgIcon" xmlns:xlink="http://www.w3.org/1999/xlink" focusable="false">\n\t\t\t\t\t<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#{{!it.moveIcon}}"></use>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n'})),define("text!dashboard-core/js/dashboard/layout/authoring/interaction/LayoutIndicator.html",[],(function(){return'<div class="layoutDashboardIndicatorContainer">\n\t<div class="layoutDashboardIndicatorContent">\n\t\t<span class="layoutDashboardIndicatorText"></span>\n\t</div>\n</div>\n'})),define("dashboard-core/js/dashboard/layout/authoring/interaction/LayoutIndicator",["doT","../../../../lib/@waca/core-client/js/core-client/ui/core/View","../../../../lib/@waca/core-client/js/core-client/utils/Deferred","jquery","text!./LayoutIndicator.html"],(function(t,e,i,o,n){var r=null;return r=e.extend({OFFSET:30,init:function(t){r.inherited("init",this,arguments),this.$node=t.node},render:function(){var e=t.template(n)();this.$el=o(e),this.$node.prepend(this.$el),this.$node.is("body")?this.containerSize={width:o(window).width(),height:o(window).height()}:this.containerSize={width:this.$node.width(),height:this.$node.height()},this.$content=o(this.$el.find(".layoutDashboardIndicatorText")[0])},updatePosition:function(t){var e,i,o=0,n=0,r=this.$node.scrollLeft(),a=this.$node.scrollTop(),s=t.left+r,d=t.top+a;e=this.containerSize.width-this.$el.width()-50,i=this.containerSize.height-this.$el.height(),e-t.left<0&&(o=e-t.left),i-t.top<0&&(n=i-t.top);var l=s+this.OFFSET+o;l=l>r?l+"px":r+"px";var h=d+this.OFFSET+n;h=h>a?h+"px":a+"px",this.$el.css({top:h,left:l})},updateContent:function(t){this.$content.text(t)},remove:function(){this.$el.remove()},show:function(){this.$el.show()},hide:function(){this.$el.hide()}})})),define("dashboard-core/js/dashboard/layout/authoring/interaction/LayoutGuidelines",["jquery","underscore","../../../../lib/@waca/core-client/js/core-client/ui/core/Class"],(function(t,e,i){return i.extend({THRESHOLD:5,setup:function(i,o,n){this._aGuidelines=[],this.snapGuidelines=n,this.domNode=i;var r=t(this.domNode);e.each(r.children(".widget,.pagegroup,.pagetemplateDropZone"),function(e){if(!(o&&o.dragBox&&o.dragBox.ids.indexOf(e.id)>-1)){var n,r,a=t(e),s=a.position(),d=a.is(".pagetemplateDropZone");n=a.outerHeight(),r=a.outerWidth();var l=Math.round(s.left+i.scrollLeft+0),h=Math.round(l+r),u=Math.round(s.top+i.scrollTop+0),c=Math.round(u+n);this._addGuideline("x",l,u,c,d?"left":null),this._addGuideline("x",h,u,c,d?"right":null),this._addGuideline("x",(l+h)/2,u,c),this._addGuideline("y",u,l,h,d?"top":null),this._addGuideline("y",c,l,h,d?"bottom":null),this._addGuideline("y",(u+c)/2,l,h)}}.bind(this)),this._addGuideline("x",i.scrollWidth/2),this._addGuideline("y",i.scrollHeight/2)},_addGuideline:function(e,i,o,n,r){var a=t(this.domNode),s=this.domNode.scrollHeight-10+"px",d=this.domNode.scrollWidth-10+"px",l="x"===e?{left:i+"px",height:s}:{top:i+"px",width:d},h=t('<div class="guidelineMarker1">'),u=t('<div class="guidelineMarker2">');if(void 0!==o&&h.css("x"===e?"top":"left",o-5+"px"),void 0!==n){var c={bottom:"auto",right:"auto"};c["x"===e?"top":"left"]=n-5+"px",u.css(c)}var p=t('<div class="guideline guideline'+e+'">').css(l).append(h).append(u),g={};r&&(g.restricted=r),g[e]=i,g["axis_"+e]=p,this._aGuidelines.push(g),a.append(p)},calculateSnapPoint:function(t,e){var i=null,o={};this._aGuidelines&&this.snapGuidelines&&this._aGuidelines.forEach(function(n){!isNaN(Math.abs(t-n[e]))&&Math.abs(t-n[e])<this.THRESHOLD?(null===i||i>Math.abs(t-n[e]))&&(i=t-n[e],o=n):n[e]&&Math.abs(t-n[e])<this.THRESHOLD&&(i=t-n[e],o=n)}.bind(this));return{distance:i,show:function(){o["axis_"+e].show()}}},getAll:function(){return this._aGuidelines||[]},clear:function(){t(this.domNode).children(".guideline").remove(),this._aGuidelines=null,this.domNode=null}})})),define("dashboard-core/js/dashboard/layout/authoring/interaction/GridGuidelines",["jquery","underscore","../../../../lib/@waca/core-client/js/core-client/ui/core/Class"],(function(t,e,i){return i.extend({gridSize:0,init:function(e){var i=t(e.page);this.layoutController=e.controller;var o=this.layoutController.boardModel.layout.findModel(e.page.id);o||(o=this.layoutController.boardModel.layout),this.snapGrid=o.getValueFromSelfOrParent("snapGrid"),this.snapGrid=void 0!==this.snapGrid&&this.snapGrid;var n=o.getValueFromSelfOrParent("layoutPositioning");"absolute"===n?this.gridSize=10:"relative"===n&&(this.gridSize=this.getGridSize(i))},getGridSize:function(t){var e=0;if(t){var i=t.width();e=t.hasClass("infoGraphic")?i/60:i/100}return e},calculateSnapPoint:function(t){if(this.snapGrid){var e=t%this.gridSize;return e>this.gridSize-.5&&(e=0),{distance:e}}return{distance:null}}})})),define("dashboard-core/js/dashboard/layout/authoring/interaction/GuidelineManager",["jquery","underscore","../../../../lib/@waca/core-client/js/core-client/ui/core/Class","./LayoutGuidelines","./GridGuidelines"],(function(t,e,i,o,n){return i.extend({LayoutGuidelines:{},init:function(t){this.layoutController=t.layoutController,this.layoutGuidelines=new o},getReady:function(t,e,i){this.domNode=t,this.snapContributions=[];var o=this.layoutController.boardModel.layout.findModel(t.id);o||(o=this.layoutController.boardModel.layout);var r=o.getValueFromSelfOrParent("snapObjects");r=void 0===r||r,this.gridGuidelines=new n({page:t,controller:this.layoutController}),i||(this.layoutGuidelines.setup(t,e,r),this.snapContributions.push(this.layoutGuidelines)),this.snapContributions.push(this.gridGuidelines)},finish:function(){t(this.domNode).children(".guideline").remove(),this.domNode=null},getSnapCoordinates:function(t){var e={top:null,right:null,bottom:null,left:null},i=[],o=[],n=[],r=[];return this.snapContributions&&this.snapContributions.forEach(function(e){i.push(e.calculateSnapPoint(t.right,"x")),o.push(e.calculateSnapPoint(t.left,"x")),n.push(e.calculateSnapPoint(t.top,"y")),r.push(e.calculateSnapPoint(t.bottom,"y"))}.bind(this)),e.right=this._calculateClosestSnapPoint(i,"x"),e.left=this._calculateClosestSnapPoint(o,"x"),e.top=this._calculateClosestSnapPoint(n,"y"),e.bottom=this._calculateClosestSnapPoint(r,"y"),e},_calculateClosestSnapPoint:function(t){var e=null;return t.forEach(function(t){t.distance&&e?e.distance>Math.abs(t.distance)&&(e=t):t.distance&&!e&&(e=t)}.bind(this)),e&&e.distance?(e.show&&e.show(),e.distance):e},hideAll:function(){t(this.domNode).children(".guideline").hide()}})})),define("dashboard-core/js/dashboard/layout/authoring/interaction/Move",["./BaseStylePropertyAction","../../../../lib/@waca/core-client/js/core-client/utils/Deferred","jquery","doT","../EventHelper","../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","../../../../lib/@waca/core-client/js/core-client/ui/KeyCodes","../../../../app/util/ScreenReaderUtil","../../../../app/nls/StringResources","text!./MoveEdges.html","./LayoutIndicator","./GuidelineManager","../../../util/PxPercentUtil","../../../../lib/@waca/core-client/js/core-client/i18n/Formatter","../../../../lib/@waca/dashboard-common/dist/utils/EventChainLocal","underscore","bspopover"],(function(t,e,i,o,n,r,a,s,d,l,h,u,c,p,g,f){var v=null;return v=t.extend({_savedSelectedNodes:null,init:function(t){var i=this;v.inherited("init",this,arguments),this.controller=t,this.isDragging=!1,this._isTouch=!1,this.dropInfo={},this._guidelineManager=new u({layoutController:t.layoutController}),this._ScreenReader=new s,this.whenIsReadyDfd=new e,this._createAvatarContainer(),this._layoutIndicator=new h({node:this._$avatarContainer}),this._initialize(),this._updateLayoutIndicatorContent=f.throttle((function(t,e,o,n,r){var a=o.node;if(a&&a._layout&&a._layout.layoutController){var s=r.dropTargetNode,d=a._layout.layoutController.getLayoutContentContainerForDropTarget(s),l=i._convertCoordinates(e,t.clientX-e.offsetx-n.x,t.clientY-e.offsety-n.y,d),h=i._formatPosition(a,l,d);i._layoutIndicator.updateContent("x: "+h.left+" y: "+h.top)}}),250)},_createAvatarContainer:function(){this._$avatarContainer=i("body").children(".avatarContainer.avatarContainerNotDragging"),0===this._$avatarContainer.length&&(this._$avatarContainer=i('<div class="avatarContainer avatarContainerNotDragging"></div>'),i("body").append(this._$avatarContainer))},getAvatarContainer:function(){return this._$avatarContainer},whenIsReady:function(){return this.whenIsReadyDfd.promise},_initialize:function(){this._dndManager=this.controller.dashboardApi.getFeature("DashboardDnd.internal"),this.whenIsReadyDfd.resolve()},destroy:function(){this._dndManager&&(this._dndManager.resetDragging(),this._dndManager=null),this.resetDraggingState(),this._ScreenReader.destroy(),this._iKeyPressTimer&&clearTimeout(this._iKeyPressTimer),this._$avatarContainer.empty()},setupStartEventHandlers:function(){for(var t,e=this.dragStartMouseEvent.bind(this),i=this.initiateDragging.bind(this),o=this.onDragStart.bind(this),r=0;r<this.selectedNodes.length;r++)(t=this.selectedNodes[r])._events=[],t._events.push(n.on(t,"touchstart",i)),t._events.push(n.on(t,"mousedown",e)),t._events.push(n.on(t,"dragstart",o))},onDragStart:function(){return!1},clearStartEventHandlers:function(){for(var t,e=0;e<this.selectedNodes.length;e++)(t=this.selectedNodes[e])._events&&(r.removeEvents(t._events),t._events=null)},newSelection:function(t,e){this._resetSelectionState(),this.selectedNodes=t,this._savedSelectedNode=t,this.dropInfo.nodeInfoList=[];for(var i=0;i<t.length;i++)this.dropInfo.nodeInfoList.push({node:t[i]});this.setupStartEventHandlers(),e&&("mousedown"===e.type||"hold"===e.type||"touchstart"===e.type)&&this.selectedNodes.length>0&&this.initiateDragging(e),t.length>0?this.controller.$el.on("keydown.interactionMoveKey",this.arrowKeyPress.bind(this)):this.controller.$el.off("keydown.interactionMoveKey"),this.addMoveHandle(t)},addMoveHandle:function(t){var e=this.controller.dashboardApi.getFeature("Icons").getIcon("move"),n=o.template(l)({moveIcon:e.id});i(t).append(n).find(".moveHandle").attr("title",d.get("moveHandle"))},saveNodeInfo:function(){for(var t=0,e=this.dropInfo.nodeInfoList.length;t<e;t++)this.setNodePositionInfo(this.dropInfo.nodeInfoList[t])},_iKeyPressTimer:null,_isValidEventForArrowKeyPress:function(t){var e=i(t.target);if(t.keyCode===a.LEFT_ARROW||t.keyCode===a.RIGHT_ARROW||t.keyCode===a.UP_ARROW||t.keyCode===a.DOWN_ARROW){var o=0!==e.closest(".ba-common-tabList").length,n=new g(t),r=i(".dashboardFrameCentre").has(t.target).length>0;return!(t.shiftKey||e.hasClass("inlineText")||e.parents().hasClass("widgetFocus")||n.getProperty("preventMoveAction")||o)&&r}return!1},_calculateInitDeltasForArrowKeyPress:function(t){var e=0,i=0,o="",n=!1;switch(t.keyCode){case a.LEFT_ARROW:i=-1,o=d.get("srWidgetMoveLeft");break;case a.UP_ARROW:e=-1,o=d.get("srWidgetMoveUp");break;case a.RIGHT_ARROW:i=1,o=d.get("srWidgetMoveRight"),n=!0;break;case a.DOWN_ARROW:e=1,o=d.get("srWidgetMoveDown"),n=!0}return{iDeltaTop:e,iDeltaLeft:i,farEdge:n,sMessage:o}},_calculatePositionUpdateForNodeWhenArrowKeyPress:function(t,e,o){var n=e.iDeltaTop,r=e.iDeltaLeft,a=e.farEdge,s={left:parseInt(i(t).css("left")),top:parseInt(i(t).css("top"))},d=0,l=0,h={top:s.top,left:s.left,right:s.left+t.clientWidth,bottom:s.top+t.clientHeight},u=o.node._layout.layoutController.getLayoutContentContainer();this._guidelineManager.getReady(u,h,!0);var c=this._getNewCoordinates(h),p=this.getRevisedOffsets(c);return this._guidelineManager.gridGuidelines&&this._guidelineManager.gridGuidelines.snapGrid?(a&&(p.x=this._guidelineManager.gridGuidelines.gridSize-p.x,p.y=this._guidelineManager.gridGuidelines.gridSize-p.y),p.x<=1&&(p.x=0),p.y<=1&&(p.y=0),p.x=null===p.x||0===p.x?this._guidelineManager.gridGuidelines.gridSize:p.x,p.y=null===p.y||0===p.y?this._guidelineManager.gridGuidelines.gridSize:p.y,d=r*p.x,l=n*p.y):(d=r,l=n),o.dropPosition={x:s.left+d,y:s.top+l,before:o.oldValues.nextSibling},o.node._layout.parentLayout.getWidgetPositionUpdate(o)},_updateModelAfterArrowKeyPress:function(t,e){clearTimeout(this._iKeyPressTimer),this._iKeyPressTimer=setTimeout(function(){this.emit("move:end",{currentSelection:this.selectedNodes}),this.updateModel(t),this.refreshProperties(),this._ScreenReader.callOut(e)}.bind(this),500)},_moveNodesForArrowKeyPress:function(t){for(var e=[],i=[],o=this._calculateInitDeltasForArrowKeyPress(t),n=0,r=this.dropInfo.nodeInfoList.length;n<r;n++){var a=this.dropInfo.nodeInfoList[n];if(a.node._layout){var s=this.dropInfo.nodeInfoList[n].node,d=this._calculatePositionUpdateForNodeWhenArrowKeyPress(s,o,a);e.push(d),i.push({node:s,newPosition:{top:parseInt(d.style.top,10),left:parseInt(d.style.left,10)}})}}return this.moveNodesToNewPositions(i),{positionUpdateArray:e,sMessage:o.sMessage}},moveNodesToNewPositions:function(t){for(var e=0;e<t.length;e++){var i=t[e],o=i.node,n=i.newPosition;r.setTopLeft(o,n.top,n.left)}},arrowKeyPress:function(t){if(this._isValidEventForArrowKeyPress(t)){t.preventDefault(),this.emit("move:start",{currentSelection:this.selectedNodes}),this.saveNodeInfo();var e=this._moveNodesForArrowKeyPress(t),i=e.positionUpdateArray,o=e.sMessage;this._updateModelAfterArrowKeyPress(i,o)}},_resetSelectionState:function(){this.selectedNodes&&(this._dndManager&&this._dndManager.resetDragging(),this.dropInfo={},this.clearStartEventHandlers())},dragStopEvent:function(t,e){this.isDragging&&(this._showingLayoutIndicator=!1,this.handleDrop(e),this.resetDraggingState(),this._$avatarContainer[0].className="avatarContainer avatarContainerNotDragging",this.$lastFocus.focus(),this.controller.eventRouter.trigger("widget:stopMove"),this.emit("move:end",{currentSelection:this.selectedNodes}),this.refreshProperties(),this._guidelineManager.hideAll(),this._guidelineManager.finish(),this._layoutIndicator.remove())},resetDraggingState:function(){this.isDragging=!1,i(this.selectedNodes).removeClass("nodeDragging"),this.dropInfo.operation=null},handleDrop:function(){},dragStartMouseEvent:function(t){if(this._isTouch)return!1;("mousedown"!==t.type||1===(t.buttons||t.which)&&!t.ctrlKey)&&this.initiateDragging(t)},initiateDragging:function(t,e){var o=1===i(t.target).closest(".moveHandle").length,n=0===i(t.target).closest(".widgetContent").length;if(!o&&!n)return!0;t.preventDefault(),this.saveNodeInfo(),this._isTouch=t.isTouch,this.$lastFocus=i(":focus");var r,a=null;a=e||this._getTargetWidgetNode(t),!i(a).hasClass("moveDisabled")&&a&&(r=a._layout?a._layout.parentLayout.domNode:null,this._dndManager.startDrag({event:t,type:this.getDragDataType(),data:this.dropInfo,avatar:null,callerCallbacks:{onMove:this.dragMoveEvent.bind(this),onDragDone:this.dragStopEvent.bind(this)},moveXThreshold:3,moveYThreshold:3,currentDropZoneNode:r}))},_getTargetWidgetNode:function(t){var e=i(t.target);if(!e.is(".widget")){var o=e.parents(".widget");e=o.length?o:e.parents(".pagegroup")}return e[0]},getDragDataType:function(){return null},dragMoveEvent:function(t,e){var o=this;n.fixEvent(t);var a=void 0,s=void 0;if(!this.isDragging){this._$avatarContainer[0].className="avatarContainer avatarContainerDragging",this.emit("move:start",{currentSelection:this.selectedNodes}),this.prepareDropInfo(this.dropInfo),this.isDragging=!0;var d=[],l=[];for(a=0,s=this.dropInfo.nodeInfoList.length;a<s;a++){var h=this.dropInfo.nodeInfoList[a];d.push(h.node);var u=h.node.getBoundingClientRect();this.prepareNodeForMove(h.node),l.push(h.node);var c=h.node.parentNode.getBoundingClientRect(),p=r.getRotatedCoordinates(h.node.parentNode,t.clientX,t.clientY,c);i(h.node).addClass("nodeDragging"),r.setTopLeft(h.node,p.y,p.x);var g={top:i(h.node).position().top-h.node.offsetTop,left:i(h.node).position().left-h.node.offsetLeft};h.offsety=e.dragObject.startPosition.y-u.top+g.top,h.offsetx=e.dragObject.startPosition.x-u.left+g.left,h.parentNodeRect=c,h.position=u}if(this.dropInfo.dragBoxSize=this._calculateBoxSize(this.dropInfo.nodeInfoList),e.dragObject&&e.dropTargetNode){e.dropTargetNodeOffset=i(e.dropTargetNode).offset();var f=this._convertCoordinates(this.dropInfo.dragBoxSize,t.clientX-this.dropInfo.dragBoxSize.offsetx,t.clientY-this.dropInfo.dragBoxSize.offsety,e.dropTargetNode,e.dropTargetNodeOffset);e.dragObject.dragBox=f,e.dragObject.dragBox.ids=this.getIds(this.dropInfo.nodeInfoList).ids,this._guidelineManager.getReady(e.dropTargetNode,e.dragObject),this.postNodeForMove(l)}this.controller.eventRouter.trigger("widget:startMove",{selectedNodes:d}),i(".popover").popover("hide"),this.dropInfo.nodeInfoList.length>0&&(this._showingLayoutIndicator=!1,setTimeout((function(){o._layoutIndicator.render(),o._layoutIndicator.show(),o._showingLayoutIndicator=!0}),150))}var v=this._preMoveNode(this.dropInfo.dragBoxSize,e,t,this.dropInfo.nodeInfoList[0]);for(a=0,s=this.dropInfo.nodeInfoList.length;a<s;a++)this.moveNode(this.dropInfo.nodeInfoList[a],t,e,v);return!1},_calculateBoxSize:function(t){var e,i={top:Number.MAX_SAFE_INTEGER,left:Number.MAX_SAFE_INTEGER,bottom:Number.MIN_SAFE_INTEGER,right:Number.MIN_SAFE_INTEGER,offsety:0,offsetx:0,width:0,height:0},o=void 0;for(o=0,e=t.length;o<e;o++){var n=t[o];n.position.top<i.top&&(i.top=n.position.top,i.offsety=n.offsety),n.position.left<i.left&&(i.left=n.position.left,i.offsetx=n.offsetx),n.position.bottom>i.bottom&&(i.bottom=n.position.bottom),n.position.right>i.right&&(i.right=n.position.right)}return i.width=i.right-i.left,i.height=i.bottom-i.top,i},_preMoveNode:function(t,e,o,n){var r={x:0,y:0};if(e.dropTargetNode&&n.node._layout){e.dropTargetNodeOffset=i(e.dropTargetNode).offset();var a=this._convertCoordinates(t,o.clientX-t.offsetx,o.clientY-t.offsety,e.dropTargetNode,e.dropTargetNodeOffset),s=this._getNewCoordinates(a);r=this.getRevisedOffsets(s)}return this._showingLayoutIndicator&&n.node._layout&&(this._layoutIndicator.updatePosition({top:o.clientY,left:o.clientX}),this._updateLayoutIndicatorContent(o,t,n,r,e)),r},prepareDropInfo:function(){},prepareNodeForMove:function(t){return t},postNodeForMove:function(){},getSelectedDomNodes:function(){var t,e,i,o=[];for(t=0,e=this.dropInfo.nodeInfoList.length;t<e;t++)i=this.dropInfo.nodeInfoList[t],o.push(i.node);return o},moveNode:function(t,e,i,o){var n,a=t.node;n=r.getRotatedCoordinates(a.parentNode,e.clientX-t.offsetx-o.x,e.clientY-t.offsety-o.y,t.parentNodeRect),r.setTopLeft(a,n.y,n.x),this.handleMove(t,n,i)},_formatPosition:function(t,e,o){if(t._layout)if("relative"===t._layout.model.getValueFromSelfOrParent("layoutPositioning")){var n={top:e.top+"px",left:e.left+"px"},r={width:i(o).width(),height:i(o).height()};c.changePixelPropertiesToPercent(n,r,1),e.top=p.formatNumber(n.top.replace(/%/g,""))+" %",e.left=p.formatNumber(n.left.replace(/%/g,""))+" %"}else e.top=p.formatNumber(e.top)+" "+d.get("pixelUnit")+" ",e.left=p.formatNumber(e.left)+" "+d.get("pixelUnit")+" ";return e},getIds:function(t){return t.reduce((function(t,e){return t.ids.push(e.node.id),t}),{ids:[]})},getRevisedOffsets:function(t){var e={};return null===t.left?e.x=t.right:null===t.right?e.x=t.left:e.x=Math.abs(t.left)<Math.abs(t.right)?t.left:t.right,null===t.top?e.y=t.bottom:null===t.bottom?e.y=t.top:e.y=Math.abs(t.bottom)<Math.abs(t.top)?t.bottom:t.top,e},_convertCoordinates:function(t,e,o,n,r){var a={};if(n){var s=r||i(n).offset(),d=Math.round(e-s.left+n.scrollLeft),l=Math.round(o-s.top+n.scrollTop);a={top:l,right:d+t.width,bottom:l+t.height,left:d,center_x:d+t.width/2,center_y:l+t.height/2}}return a},_getNewCoordinates:function(t){return this._guidelineManager.hideAll(),this._guidelineManager.getSnapCoordinates(t)},handleMove:function(){},setNodePositionInfo:function(t){var e=t.node;for(t.oldValues={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,parent:e.parentElement,nextSibling:e.nextSibling};t.oldValues.nextSibling&&this.selectedNodes.indexOf(t.oldValues.nextSibling)>-1;)t.oldValues.nextSibling=t.oldValues.nextSibling.nextSibling},moveByProperty:function(t,e,i){var o=e,n="left"===t?"width":"height",r=this._getParentDim(n,this.propertyNodes),a=this._getWidgetOffset(n,this.propertyNodes);if(a+=this._getWidgetSize(n,this.propertyNodes),"px"===i){var s="left"===t?this.propertyNodes[0]._layout.parentLayout.getMinimumLeft:this.propertyNodes[0]._layout.parentLayout.getMinimumTop;o=Math.max(s(),o),o=Math.min(r-a,o)}else o=this._sanitizePercentSizeOnPage(o,n);var d=o+i,l=[];return this.propertyNodes.forEach((function(e){var i={};i[t]=d,l.push({style:i,id:e._layout.model.id})})),this.updateModel(l),o},_processChange:function(t,e,i){return this.moveByProperty("left"===t?"left":"top",e,i)},getProperties:function(){v.inherited("getProperties",this,arguments);var t=this.getUnitsFromValue(this.propertyNodes[0]._layout.model.style.left),e=[{units:t,getProp:function(t){return t._layout.model.style.left}},{units:t,getProp:function(t){return t._layout.model.style.top}}];this._getValuesForProperties(e);var i=[{type:"SectionLabel",label:d.get("propPositionLabel"),tabName:d.get("tabName_general"),sectionName:d.get("sectionName_layout"),sectionOpened:!0,order:20},{type:"Split",name:"moveWidgetSplit",id:"moveWidgetSplit",tabName:d.get("tabName_general"),sectionName:d.get("sectionName_layout"),order:21,items:[{align:"left",items:[{type:"InputLabel",label:d.get("propPositionXAxis"),name:"left",id:"left",tabName:d.get("tabName_general"),sectionName:d.get("sectionName_layout"),readOnly:!1,value:e[0].value,onChangeValueHold:e[0].value,multiline:!0,handleReturnKey:!0,units:t,onChange:this.wrapChangeProperty()}]},{align:"right",items:[{type:"InputLabel",label:d.get("propPositionYAxis"),name:"top",id:"top",tabName:d.get("tabName_general"),sectionName:d.get("sectionName_layout"),readOnly:!1,value:e[1].value,onChangeValueHold:e[1].value,multiline:!0,handleReturnKey:!0,units:t,onChange:this.wrapChangeProperty()}]}]}];return this.showStyleProperties(this.propertyNodes[0])?i:[]}})})),define("dashboard-core/js/dashboard/layout/authoring/interaction/MoveWidgets",["./Move","../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","jquery","../../../../lib/@waca/core-client/js/core-client/utils/BrowserUtils"],(function(t,e,i,o){var n=t.extend({init:function(){n.inherited("init",this,arguments),this.isIE=o.isIE()},getDragDataType:function(){return"widget"},handleDrop:function(t){t.isDropped||this.restoreOriginalPosition(),t.dragObject&&i(t.dragObject.data.nodeInfoList[0].node).parent().css("overflow","visible")},restoreOriginalPosition:function(){for(var t,e=this.dropInfo.nodeInfoList,i=0,o=e.length;i<o;i++){var n=e[i];t=n.node,n.oldValues.parent?(n.oldValues.parent.insertBefore(t,n.oldValues.nextSibling),t.style.left=n.oldValues.left,t.style.top=n.oldValues.top,t.style.height=n.oldValues.height,t.style.width=n.oldValues.width):t.parentNode.removeChild(t)}},prepareDropInfo:function(t){t.operation="move"},prepareNodeForMove:function(t){var e=i(t);return e.height(e.height()),e.width(e.width()),this._isIpadVersion13orGreater()||(e.parent().css("overflow","hidden"),this.getAvatarContainer().append(t)),t},postNodeForMove:function(t){this.isIE&&this.emit("moveWidgets:start",{nodes:t})},handleMove:function(t,o,n){var r=n.dropTargetNode;if(r){var a=i(t.node),s=void 0;s=this._isIpadVersion13orGreater()?{left:0,top:0}:n.dropTargetNodeOffset||i(r).offset();var d=Math.round(o.x-s.left+r.scrollLeft),l=Math.round(o.y-s.top+r.scrollTop),h=e.widgetSize(a);t.dropPosition={x:d,y:l,height:h.height,width:h.width,center_x:d+a.outerWidth()/2,center_y:l+a.outerHeight()/2,before:r===t.oldValues.parent?t.oldValues.nextSibling:null}}},dragMoveEvent:function(){n.inherited("dragMoveEvent",this,arguments)},dragStopEvent:function(){n.inherited("dragStopEvent",this,arguments),this.isIE&&this.emit("moveWidgets:end",{nodes:this.getSelectedDomNodes()})},_isIpadVersion13orGreater:function(){var t=window.navigator.userAgent.match(/ipad.*os\s((\d+_?){2,3})\s/i),e=t?t[1].split("_"):null;return!!e&&parseInt(e[0],10)>12}});return n})),define("dashboard-core/js/dashboard/layout/authoring/interaction/MoveGroupContent",["./Move","jquery"],(function(t,e){var i=null;return i=t.extend({init:function(){i.inherited("init",this,arguments)},getDragDataType:function(){return"groupContent"},handleDrop:function(){for(var t,i,o=[],n=0,r=this.dropInfo.nodeInfoList.length;n<r;n++)if(i=this.dropInfo.nodeInfoList[n],t=e(i.node),i.node._layout){i.dropPosition={x:parseInt(t.css("left"),10),y:parseInt(t.css("top"),10)};var a=i.node._layout.parentLayout.getWidgetPositionUpdate(i);o.push(a)}var s=this.dashboardApi.getFeature("Transaction"),d=s.startTransaction();this.updateModel(o,d),this.emit("moveGroupContent:done",{currentSelection:this.selectedNodes,undoRedoTransactionId:d.transactionId,transactionToken:d}),s.endTransaction(d)}})})),define("text!dashboard-core/js/dashboard/layout/authoring/interaction/ResizeEdges.html",[],(function(){return'<div edge="t" class="resizeEdge top">\n\t<div class="resizePoint resizeHandle"></div>\n</div>\n<div edge="r" class="resizeEdge right">\n\t<div class="resizePoint resizeHandle"></div>\n</div>\n<div edge="b" class="resizeEdge bottom">\n\t<div class="resizePoint resizeHandle"></div>\n</div>\n<div edge="l" class="resizeEdge left">\n\t<div class="resizePoint resizeHandle"></div>\n</div>\n<div edge="tr" class="resizeEdge topRight {{?it.focusModeDisabled}}focusModeDisabled{{?}}">\n\t<div class="resizePoint {{?it.rotateHandle}}resizeHandle{{?}}"></div>\n</div>\n<div edge="br" class="resizeEdge bottomRight">\n\t<div class="resizePoint resizeHandle {{?it.isMobile}}scaleCorner{{?}}">\n\t\t{{?it.isMobile}}\n\t\t<div class="svgContainer">\n\t\t\t<svg class="scale" role="img">\n\t\t\t\t<use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-scale"></use>\n\t\t\t</svg>\n\t\t</div>\n\t\t{{?}}\n\t</div>\n</div>\n<div edge="bl" class="resizeEdge bottomLeft">\n\t<div class="resizePoint resizeHandle {{?it.isMobile}}rotateCorner{{?}}">\n\t\t{{?it.isMobile}}\n\t\t<div class="svgContainer">\n\t\t\t<svg class="rotate" role="img">\n\t\t\t\t<use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-rotate"></use>\n\t\t\t</svg>\n\t\t</div>\n\t\t{{?}}\n\t</div>\n</div>\n<div edge="tl" class="resizeEdge topLeft">\n\t<div class="resizePoint resizeHandle"></div>\n</div>\n<div class="resizeEdge tl"></div>\n<div class="resizeEdge tr"></div>\n<div class="resizeEdge bl"></div>\n<div class="resizeEdge br"></div>\n{{?it.rotateHandle}}\n<div edge="tr-r" class="resizeEdge rotateEdge topRight">\n\t<div class="rotateHandle {{?it.isMobile}}large{{?}}"></div>\n</div>\n<div edge="br-r" class="resizeEdge rotateEdge bottomRight">\n\t<div class="rotateHandle {{?it.isMobile}}large{{?}}"></div>\n</div>\n<div edge="bl-r" class="resizeEdge rotateEdge bottomLeft">\n\t<div class="rotateHandle {{?it.isMobile}}large{{?}}"></div>\n</div>\n<div edge="tl-r" class="resizeEdge rotateEdge topLeft">\n\t<div class="rotateHandle {{?it.isMobile}}large{{?}}"></div>\n</div>\n{{?}}\n'})),define("text!dashboard-core/js/dashboard/layout/authoring/interaction/SizeIndicator.html",[],(function(){return'<div class="sizeDashboardIndicatorContainer">\n\t<div class="sizeDashboardIndicatorContent">\n\t\t<h2></h2>\n\t\t<span class="sizeDashboardIndicatorText"></span>\n\t\t<h2></h2>\n\t</div>\n</div>\n'})),define("dashboard-core/js/dashboard/layout/authoring/interaction/SizeIndicator",["doT","../../../../lib/@waca/core-client/js/core-client/ui/core/View","../../../../lib/@waca/core-client/js/core-client/utils/Deferred","jquery","text!./SizeIndicator.html"],(function(t,e,i,o,n){var r=null;return r=e.extend({OFFSET:25,init:function(t){r.inherited("init",this,arguments),this.$node=t.node},render:function(){var e=t.template(n)();this.$el=o(e),this.$node.prepend(this.$el),this.$content=o(this.$el.find(".sizeDashboardIndicatorText")[0])},updatePosition:function(t,e,i){var o,n;o=t.top+this.$node.scrollTop()-e.top,n=t.left+this.$node.scrollLeft()-e.left,o-this.OFFSET>=0?i?(this.$el.addClass("vertical"),this.$el.css({top:o,left:n+t.width+this.OFFSET})):this.$el.css({top:o-this.OFFSET,left:n}):i?n>=0?(this.$el.addClass("vertical"),this.$el.css({top:o,left:n+t.width+this.OFFSET})):this.$el.hide():this.$el.css({top:o+t.height+this.OFFSET/2,left:n})},updateContent:function(t,e){this.$content.text(e),this.$el.width(t)},remove:function(){this.$el.remove()},show:function(){this.$el.show()},hide:function(){this.$el.hide()}})})),define("dashboard-core/js/dashboard/layout/authoring/interaction/Resize",["./BaseStylePropertyAction","jquery","../EventHelper","../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","./GuidelineManager","underscore","text!./ResizeEdges.html","../../../../app/util/ScreenReaderUtil","../../../../app/nls/StringResources","doT","../../../../lib/@waca/core-client/js/core-client/utils/BrowserUtils","../../../../lib/@waca/core-client/js/core-client/i18n/Formatter","./LayoutIndicator","./SizeIndicator","../../../util/PxPercentUtil","bspopover"],(function(t,e,i,o,n,r,a,s,d,l,h,u,c,p,g){var f={"dashboard-core/js/dashboard/widgets/staticwidget/TextWidget":{minWidth:100,minHeight:40},default:{minWidth:25,minHeight:25}},v=t.extend({sizeIndicators:[],containerOffset:0,init:function(t){this.controller=t,v.inherited("init",this,arguments),this.dashboardApi=t.dashboardApi,this._isTouch=!1,this.resizingEvents=[],this._guidelineManager=new n({layoutController:t.layoutController}),this._ScreenReader=new s,this._observerUpdateDelay=null,this._observer=new window.MutationObserver(this.rotationMutationObserver.bind(this)),this._focusModeDisabled=t.config&&t.config.focusModeDisabled},destroy:function(){this._ScreenReader.destroy(),v.inherited("destroy",this,arguments)},addPositionIndicator:function(){this._layoutIndicator.render()},updatePositionIndicator:function(t,e){var i;this._layoutIndicator.updatePosition(t),i=d.get("widthUnit")+": "+e.width+" "+d.get("heightUnit")+": "+e.height,this._layoutIndicator.updateContent(i)},updatePositionIndicatorRotate:function(t,e){e<0&&(e+=360);var i;this._layoutIndicator.updatePosition(t),i=u.formatNumber(String(e.toFixed(1)))+"˚",this._layoutIndicator.updateContent(i)},removePositionIndicator:function(){this._layoutIndicator.remove()},newSelection:function(t){this.resizeStopEvent(),this.selectedNodes&&(this.removeResizeBorders(this.selectedNodes),this._destroyResizeIndicators(),this._layoutIndicator&&this._layoutIndicator.remove()),this.selectedNodes=t,t.length>0?this.controller.$el.on("keydown.interactionResizeKey",this.resizeRotateKeyPress.bind(this)):this.controller.$el.off("keydown.interactionResizeKey"),this.addResizeBorders(t),this.addResizeIndicators(t)},_iKeyPressTimer:null,resizeRotateKeyPress:function(t){var e=this;if(t.shiftKey&&(!t.target||"inlineText"!==t.target.className)){var i=this._getNodesForResize();if(!t.altKey||(i=i.filter((function(t){return!e.preventRotate(t)}))).length){var n,r,a,s=0,l=0,h=0,u="",c="";switch(t.keyCode){case 37:s=-1,h=-1,u=d.get("srWidgetResizeSmallerH"),c=d.get("srWidgetRotateCCW");break;case 38:l=-1,h=-1,u=d.get("srWidgetResizeSmallerV"),c=d.get("srWidgetRotateCCW");break;case 39:s=1,h=1,u=d.get("srWidgetResizeBiggerH"),c=d.get("srWidgetRotateCW");break;case 40:l=1,h=1,u=d.get("srWidgetResizeBiggerV"),c=d.get("srWidgetRotateCW");break;default:return}this.emit("resize:start",{currentSelection:this.selectedNodes});var p={},g=[],v="";return i.forEach((function(i){var y=0,m=0;if(t.altKey)a=Math.round(o.getAngleDegree(i)+h),p={rotateAngle:a},o.setRotateTransform(i,a),v=c;else{t.ctrlKey&&(l=s=s||l,u=d.get(s>0?"srWidgetResizeBigger":"srWidgetResizeSmaller"));var b=e._getParentGenericPage(i.id),_={top:i.offsetTop,left:i.offsetLeft,right:i.offsetLeft+i.clientWidth,bottom:i.offsetTop+i.clientHeight};e._guidelineManager.getReady(b.domNode,_,!0);var w=e._guidelineManager.getSnapCoordinates(_),C={};e._guidelineManager.gridGuidelines.snapGrid?(C.x=e._guidelineManager.gridGuidelines.gridSize-w.right,C.y=e._guidelineManager.gridGuidelines.gridSize-w.bottom,C.x<.5&&(C.x=0),C.y<.5&&(C.y=0),C.x=null===C.x||0===C.x?e._guidelineManager.gridGuidelines.gridSize:C.x,C.y=null===C.y||0===C.y?e._guidelineManager.gridGuidelines.gridSize:C.y,y=s*C.x,m=l*C.y):(y=s,m=l);var I=o.widgetSize(i);if(n=I.width+y,r=I.height+m,n<f.default.minWidth||r<f.default.minHeight)return;p={width:n+"px",height:r+"px"},i.style.width=n+"px",i.style.height=r+"px",v=u}i._layout&&g.push({style:p,id:i._layout.model.id})})),this._iKeyPressTimer&&clearTimeout(this._iKeyPressTimer),this._iKeyPressTimer=setTimeout(function(){var t=this.dashboardApi.getFeature("Transaction"),e=t.startTransaction();this.updateModel(g,e),this.refreshProperties(),this.emit("resize:done",{currentSelection:i,undoRedoTransactionId:e.transactionId,transactionToken:e}),t.endTransaction(e),this._ScreenReader.callOut(v)}.bind(this),500),!1}}},preventRotate:function(t){return e(t).hasClass("noRotate")},addResizeBorders:function(t){var i=this,o=l.template(a);r.each(t,(function(t){var n=e(t),r=o({rotateHandle:!i.preventRotate(t),isMobile:h.isIPad(),focusModeDisabled:i._focusModeDisabled});n.append(r),n.find(".resizeHandle").attr("title",d.get("resize")),n.find(".rotateHandle").attr("title",d.get("rotate")),i.addRotationClass(t),i.attachEventHandlers(t)}))},_showResizeIndicators:function(t,e){var i=this;t.getBoundingClientRect&&this.sizeIndicators.forEach((function(o){if(o.node.id===t.id){var n=t.getBoundingClientRect();o.height.updatePosition(n,i.containerNodeOffset,!0),o.height.updateContent(n.height,e.height),o.height.show(),o.width.updatePosition(n,i.containerNodeOffset,!1),o.width.updateContent(n.width,e.width),o.width.show()}}))},_destroyResizeIndicators:function(){this.sizeIndicators.forEach((function(t){t.height.remove(),t.width.remove()}))},_hideResizeIndicators:function(){this.sizeIndicators.forEach((function(t){t.height.hide(),t.width.hide()}))},addResizeIndicators:function(t){var e=this;Array.isArray(t)&&t.forEach((function(t){var i=e._getParentGenericPage(t.id),o=new p({node:i.$el}),n=new p({node:i.$el});o.render(),n.render(),o.hide(),n.hide(),e.sizeIndicators.push({node:t,height:o,width:n})}))},removeResizeBorders:function(t){var i,o;for(this._observer.disconnect(),this._observerUpdateDelay&&window.clearTimeout(this._observerUpdateDelay),i=0,o=t.length;i<o;i++)t[i]._isTopResizeParent=null;e(t).removeClass("resize").children(".resizeEdge:not(.border)").remove(),this.removeRotationClass(t)},attachEventHandlers:function(t){this._observer.observe(t,{attributes:!0});for(var o=e(t).children(".resizeEdge:not(.border)"),n=this.resizeStartEvent.bind(this),r=0;r<o.length;r++)i.on(o[r],"touchstart",n),i.on(o[r],"mousedown",n),i.on(o[r],"tap",this.onTap.bind(this))},onTap:function(t){e(t.currentTarget).hide();var i=document.elementFromPoint(t.clientX,t.clientY);e(t.currentTarget).show(),i!==t.currentTarget&&e(i).trigger(t)},resizeStartEvent:function(t){if(this.isResizeMouseGesture(t)){this.lastClientX=t.clientX,this.lastClientY=t.clientY;var e=this._getParentGenericPage(t.currentTarget.parentNode.id);this.containerNodeOffset=e.$el.offset(),this.initiateResizing(t),t.stopPropagation(),t.preventDefault()}},isResizeMouseGesture:function(t){var e=this._isTouch&&!t.isTouch,i="mousedown"===t.type&&(1!==(t.buttons||t.which)||t.ctrlKey);return!e&&!i},initiateResizing:function(t){this.lastClientX=t.clientX,this.lastClientY=t.clientY,this._isResizing=!0,this._isTouch=t.isTouch,this.nResizeEdge=t.currentTarget,this.resizePointCenter=o.getCenter(this.nResizeEdge),this.setupResizingEventHandlers(),this.nodeAngle=o.getAngleDegree(this.nResizeEdge.parentNode),e(".popover").popover("hide");for(var i,n=this._getNodesForResize(),r=0;r<n.length;r++){if(i=n[r],n.length>=1){var a=this._getParentGenericPage(i.id);this._layoutIndicator=new c({node:a.$el}),this.addPositionIndicator(),this._layoutIndicator.hide()}e(i).addClass("nodeResizing"),this.saveOldValues(i)}this.lastBox=this._getDragBox(n),this.emit("resize:start",{currentSelection:this.selectedNodes})},redrawResizeBorders:function(t){(t=t||{}).nodes&&(this.removeResizeBorders(t.nodes),this.addResizeBorders(t.nodes))},_findScrollableParent:function(t){var i=null;if(t){var o=e(t.domNode).css("overflow");i="auto"===o||"scroll"===o?t.domNode:this._findScrollableParent(t.parentLayout)}return i},_getScrollInfo:function(){var t=null,i=this._findScrollableParent(this._getParentLayout());if(i){var o=e(i),n=o.height(),r=o.width(),a=o.offset();t={left:a.left,top:a.top,position:o.position(),h:n,w:r,scrollTop:o.scrollTop(),scrollLeft:o.scrollLeft(),$node:o}}return t},_getNodesForResize:function(){return this.nResizeEdge&&this.nResizeEdge.parentNode&&this.nResizeEdge.parentNode._isTopResizeParent?[this.nResizeEdge.parentNode]:this.selectedNodes.filter((function(t){return!t._isTopResizeParent}))},_getParentGenericPage:function(t){var e=this.controller.layout.findTopLevelParentItem(t),i="genericPage"===e.type?[e]:e.findDescendantsWithType("genericPage");return i.length?this.controller.layoutController.getLayoutView(i[0].id):null},saveOldValues:function(t){var i=o.position(t),n=o.widgetSize(t);if(t._oldValues={height:n.height,width:n.width,top:i.top,left:i.left,rotateAngle:o.getAngleDegree(t)},e(t).is(".pagegroup"))for(var r=o.getContentWithoutDecoration(t),a=0,s=r.length;a<s;a++)this.saveOldValues(r[a])},setupResizingEventHandlers:function(){var t=this.resizeMoveEvent.bind(this),e=this.resizeStopEvent.bind(this);this.resizingEvents.push(i.on(window,"touchmove",t),i.on(window,"touchend",e),i.on(window,"mousemove",t),i.on(window,"mouseup",e))},clearResizingEventHandlers:function(){o.removeEvents(this.resizingEvents),this.resizingEvents=[]},resizeStopEvent:function(){if(this._guidelineManager.finish(),this._isResizing){this._layoutIndicator&&this._layoutIndicator.hide(),this.sizeIndicators&&this._hideResizeIndicators();var t,i=this._getNodesForResize();this.lastPageX=null,this.lastPageY=null,this._isResizing=!1,this.last=0,this.nodeAngle=null,this.nResizeEdge=null,this.resizePointCenter=null,this.clearResizingEventHandlers();for(var o=[],n=0,r=i.length;n<r;n++)t=i[n],this._addNodeStyleUpdates(t,o);var a=this.dashboardApi.getFeature("Transaction"),s=a.startTransaction();this.updateModel(o,s),this.refreshProperties();for(var d=0,l=i.length;d<l;d++)(t=i[d])._oldValues=null,t._offsetX=null,t._offsetY=null,this._cleanChildNodes(t),e(t).removeClass("nodeResizing nodeResizeMove");this.emit("resize:done",{currentSelection:i,undoRedoTransactionId:s.transactionId,transactionToken:s}),a.endTransaction(s)}},_cleanChildNodes:function(t){if(e(t).is(".pagegroup"))for(var i=o.getContentWithoutDecoration(t),n=0,r=i.length;n<r;n++)i[n]._oldValues=null},_addNodeStyleUpdates:function(t,e){if(t._layout&&t._layout.model){var i={id:t._layout.model.id,style:{}};i.style=r.extend(o.position(t),o.widgetSize(t)),Object.keys(i.style).map((function(t){return i.style[t]+="px"}));var n=o.getAngleDegree(t);t._oldValues.rotateAngle!==n&&(i.style.rotateAngle=n),e.push(i)}},adjustYOrdinate:function(t,e){var i=this.lastClientY-t.clientY;this.lastClientY=t.clientY;var o=e.top+e.h;return t.clientY>=o&&(i<=0&&(i=3,t.clientY=e.top+this.lastBox.bottom-1),t.clientY+=i),i},adjustXOrdinate:function(t,e){var i=this.lastClientX-t.clientX;this.lastClientX=t.clientX;var o=e.left+e.w;t.clientX>o&&(i<=0&&(i=3,t.clientX=e.left+this.lastBox.right),t.clientX+=i)},_canResize:function(t){return this.lastClientX!==t.clientX||this.lastClientY!==t.clientY},resizeMoveEvent:function(t){if(this._canResize(t)){var i=this._getScrollInfo();i&&(this.adjustYOrdinate(t,i),this.adjustXOrdinate(t,i)),this.applyResize(t);for(var o,n=this._getNodesForResize(),r=0,a=n.length;r<a;r++)o=n[r],e(o).addClass("nodeResizeMove");var s=this._getDragBox(n);this.lastBox=s,this.lastClientX=t.clientX,this.lastClientY=t.clientY}return!1},applyResize:function(t){if(this.nResizeEdge){var i=e(this.nResizeEdge),o=this.nResizeEdge.getAttribute("edge"),n=h.isIPad();["br","tr","bl","tl"].indexOf(o)>-1&&t.shiftKey||n&&i.is(".bottomRight")?this.scale(t,o):i.is(".rotateEdge")||n&&i.is(".bottomLeft")?this.rotate(t):this.resizeFromEdge(t)}},_getDragBox:function(t){return t.reduce((function(t,e){var i=e.getBoundingClientRect();return t.top=Math.min(t.top,i.top),t.left=Math.min(t.left,i.left),t.bottom=Math.max(t.bottom,i.bottom),t.right=Math.max(t.right,i.right),t.ids.push(e.id),t}),{top:1/0,left:1/0,bottom:0,right:0,ids:[]})},resizeFromEdge:function(t){var e=this.nResizeEdge.parentNode,i=o.position(e),n=o.getRotatedCoordinates(e,this.resizePointCenter.left,this.resizePointCenter.top),r=o.getRotatedCoordinates(e,t.clientX,t.clientY);this.resizeSelection(n,r,i,t)},_getParentLayout:function(){return this.nResizeEdge&&this.nResizeEdge.parentNode&&this.nResizeEdge.parentNode._layout&&this.nResizeEdge.parentNode._layout.parentLayout?this.nResizeEdge.parentNode._layout.parentLayout:null},resizeSelection:function(t,e,i,o){var n=this.nResizeEdge.getAttribute("edge"),r=null,a=null,s=this._getParentLayout();if(s&&s.domNode!==this._guidelineManager.domNode){var d=this._getNodesForResize().map((function(t){return t.id}));this._guidelineManager.getReady(s.domNode,{dragBox:{ids:d}})}this._guidelineManager.hideAll();var l={top:i.top+e.y,left:i.left+e.x,bottom:i.top+e.y,right:i.left+e.x},h=this._guidelineManager.getSnapCoordinates(l);-1!==n.indexOf("b")?r=e.y-t.y-h.bottom:-1!==n.indexOf("t")&&(r=t.y-(i.top+e.y-h.top-i.top)),-1!==n.indexOf("r")?a=e.x-t.x-h.right:-1!==n.indexOf("l")&&(a=t.x-(i.left+e.x-h.left-i.left)),this.addHeightWidth(r,a,n,o)},getOppositeCornerCoords:function(t){var i={t:".br",tl:".br",r:".bl",tr:".bl",b:".tl",br:".tl",l:".tr",bl:".tr"}[this.nResizeEdge.getAttribute("edge")];i&&(i=e(t).children(i)[0]);var n=i?i.getBoundingClientRect():o.getCenter(t);return o.getRotatedCoordinates(t.parentNode,n.left,n.top)},addHeightWidth:function(t,e,i,o){var n=this._getNodesForResize(),r=this.checkHeight(n,t,i),a=this.checkWidth(n,e,i);n.length>1?this._layoutIndicator.hide():this._layoutIndicator.show();for(var s=0,d=n.length;s<d;s++)this.addHeightWidthToNode(n[s],r,a,o)},_getParentView:function(t){return t._layout&&t._layout.parentLayout||{}},checkHeight:function(t,e,i){if(e){var o,n;if(-1!==i.indexOf("t")){t.sort((function(t,e){return t.offsetTop-e.offsetTop})),o=t[0];var r=(n=this._getParentView(o)).getMinimumTop?n.getMinimumTop():0;e=Math.min(o._oldValues.top-r,e)}if(-1!==i.indexOf("b")){t.sort((function(t,e){return t.offsetTop+t._oldValues.height-e.offsetTop+e._oldValues.height})),o=t[0];var a=(n=this._getParentView(o)).getMaximumHeight?n.getMaximumHeight():1/0,s=o.offsetTop+o._oldValues.height;s+e>a&&(e=a-s)}if(e<0){t.sort((function(t,e){return t._oldValues.height-e._oldValues.height}));var d=t[0],l=f.default.minHeight;d._layout&&d._layout.widgetRegistry&&(l=f[d._layout.widgetRegistry.widget]?f[d._layout.widgetRegistry.widget].minHeight:f.default.minHeight),e=-1*Math.min(Math.abs(e),d._oldValues.height-l)}}return e},checkWidth:function(t,e,i){if(e){var o,n;if(-1!==i.indexOf("l")){t.sort((function(t,e){return t.offsetLeft-e.offsetLeft})),o=t[0];var r=(n=this._getParentView(o)).getMinimumLeft?n.getMinimumLeft():0;e=Math.min(o._oldValues.left-r,e)}if(-1!==i.indexOf("r")){t.sort((function(t,e){return t.offsetLeft+t._oldValues.width-e.offsetLeft+e._oldValues.width})),o=t[0];var a=(n=this._getParentView(o)).getMaximumWidth?n.getMaximumWidth():1/0,s=o.offsetLeft+o._oldValues.width;s+e>=a&&(e=a-s)}if(e<0){t.sort((function(t,e){return t._oldValues.width-e._oldValues.width}));var d=t[0],l=f.default.minWidth;d._layout&&d._layout.widgetRegistry&&(l=f[d._layout.widgetRegistry.widget]?f[d._layout.widgetRegistry.widget].minWidth:f.default.minWidth),e=-1*Math.min(Math.abs(e),d._oldValues.width-l)}}return e},addHeightWidthToNode:function(t,e,i,o){var n={},r=null;isNaN(i)||(r=t._oldValues.width+i);var a=null;if(isNaN(e)||(a=t._oldValues.height+e),a||r){var s=this.getOppositeCornerCoords(t);this.updateSizeValue(t,"height",a),this.updateSizeValue(t,"width",r),n=this._formatHeightWidth(t),this.updatePositionIndicator({left:o.clientX-this.containerNodeOffset.left,top:o.clientY-this.containerNodeOffset.top},n);var d=this.getOppositeCornerCoords(t);this._reAlignNode(t,s,d),this._showResizeIndicators(t,n)}t._layout&&t._layout.onResizeStep&&t._layout.onResizeStep()},_formatHeightWidth:function(t){var e={};if(t.id){var i=this._getParentGenericPage(t.id);if("relative"===t._layout.model.getValueFromSelfOrParent("layoutPositioning")){var o={height:t.getBoundingClientRect().height+"px",width:t.getBoundingClientRect().width+"px"},n={width:i.$el.width(),height:i.$el.height()};g.changePixelPropertiesToPercent(o,n,1),e.height=u.formatNumber(o.height.replace(/%/g,""))+" %",e.width=u.formatNumber(o.width.replace(/%/g,""))+" %"}else e.height=u.formatNumber(String(Number(Math.round(t.getBoundingClientRect().height))))+" "+d.get("pixelUnit"),e.width=u.formatNumber(String(Number(Math.round(t.getBoundingClientRect().width))))+" "+d.get("pixelUnit")}return e},updateSizeValue:function(t,e,i){i&&(t.style[e]=i+"px")},_reAlignNode:function(t,i,n){if(e(t).is(".pageabsolute>*, .pagegroup>*, .pagetemplateDropZone>*, .pagescalingAbsolute>*, .pagegenericPage>*")){var r=o.position(t);n.y!==i.y&&(t.style.top=r.top-n.y+i.y+"px"),n.x!==i.x&&(t.style.left=r.left-n.x+i.x+"px")}},scale:function(t,e){var i=this.nResizeEdge.parentNode,n=o.position(i),r=o.getRotatedCoordinates(i,this.resizePointCenter.left,this.resizePointCenter.top),a=o.getRotatedCoordinates(i,t.clientX,t.clientY),s=this._getParentLayout();if(s&&s.domNode!==this._guidelineManager.domNode){var d=this._getNodesForResize().map((function(t){return t.id}));this._guidelineManager.getReady(s.domNode,{dragBox:{ids:d}})}this._guidelineManager.hideAll();var l={top:n.top+a.y,left:n.left+a.x,bottom:n.top+a.y,right:n.left+a.x},h=this._guidelineManager.getSnapCoordinates(l),u=a.y-r.y-h.top;-1!==e.indexOf("t")&&(u*=-1);var c=a.x-r.x-h.left;-1!==e.indexOf("l")&&(c*=-1),this.applyScale(u,c,e,t)},applyScale:function(t,e,i,o){var n=this._getNodesForResize();t&&(t=this.checkHeight(n,t,i)),e&&(e=this.checkWidth(n,e,i));for(var r=void 0,a=0,s=n.length;a<s;a++){var d=(r=n[a])._oldValues.height,l=r._oldValues.width,h=1,u=this._getParentView(r);if(t&&d<l||!e){var c=l*(h=(d+t)/d),p=u.getMaximumWidth?u.getMaximumWidth():1/0;r.offsetLeft+c>p&&(h=(l+e)/l)}else{var g=d*(h=(l+e)/l),f=u.getMaximumHeight?u.getMaximumHeight():1/0;r.offsetTop+g>f&&(h=(d+t)/d)}if(h>0){var v=this.getOppositeCornerCoords(r);r.style.height=Math.round(d*h)+"px",r.style.width=Math.round(l*h)+"px";var y=this.getOppositeCornerCoords(r);this._reAlignNode(r,v,y),r._layout&&r._layout.onResizeStep&&r._layout.onResizeStep()}this._layoutIndicator.show();var m={height:Math.round(d*h),width:Math.round(l*h)};m=this._formatHeightWidth(r,m),this.updatePositionIndicator({left:o.clientX-this.containerNodeOffset.left,top:o.clientY-this.containerNodeOffset.top},m),this._showResizeIndicators(r,m)}},rotate:function(t){var e=this.nResizeEdge.parentNode,i=o.getCenter(e),n=o.getRotatedCoordinates(e.parentNode,i.left,i.top),r=o.getRotatedCoordinates(e.parentNode,t.clientX,t.clientY),a=o.getRotatedCoordinates(e.parentNode,this.resizePointCenter.left,this.resizePointCenter.top),s=t.shiftKey;this.rotateUsingCoords(n,r,a,s,t)},move:function(){},rotateUsingCoords:function(t,e,i,n,r){for(var a=this.nResizeEdge.parentNode,s=this._getNodesForResize(),d=0,l=s.length;d<l;d++){a=s[d];var h=t.x-e.x,u=t.y-e.y,c=Math.atan2(h,u)*(180/Math.PI)*-1,p=0;i&&(p=Math.atan2(t.x-i.x,t.y-i.y)*(180/Math.PI)*-1-this.nodeAngle);var g=c-this.nodeAngle-p,f=a._oldValues.rotateAngle+g;n&&(f=45*Math.round(f/45)),s.length>1?this._layoutIndicator.hide():(this._layoutIndicator.show(),this.updatePositionIndicatorRotate({left:r.clientX-this.containerNodeOffset.left,top:r.clientY-this.containerNodeOffset.top},f)),o.setRotateTransform(a,f)}},rotationMutationObserver:function(t){var e,i=!1;for(e=0;e<t.length;e++)if("attributes"===t[e].type&&"style"===t[e].attributeName){i=!0;break}i&&(this._observerUpdateDelay&&window.clearTimeout(this._observerUpdateDelay),this._observerUpdateDelay=window.setTimeout(function(){if(this.selectedNodes)for(this.removeRotationClass(this.selectedNodes),e=0;e<this.selectedNodes.length;e++)this.addRotationClass(this.selectedNodes[e])}.bind(this),200))},addRotationClass:function(t){var i=e(t),n=0,r=i;do{n+=o.getAngleDegree(r[0]),r=r.parent()}while(r.length&&r.hasClass("pagegroup"));n=Math.floor(n/22.5%16+16)%16,n=Math.round(n/2)%4,i.addClass("curRotation"+n)},removeRotationClass:function(t){e(t).removeClass("curRotation0 curRotation1 curRotation2 curRotation3")},resizeByProperty:function(t,e,i){var o=e,n=null;n=this.propertyNodes[0]._layout&&this.propertyNodes[0]._layout.widgetRegistry&&f[this.propertyNodes[0]._layout.widgetRegistry.widget]?"width"===t?f[this.propertyNodes[0]._layout.widgetRegistry.widget].minWidth:f[this.propertyNodes[0]._layout.widgetRegistry.widget].minHeight:"width"===t?f.default.minWidth:f.default.minHeight;var r=this._getParentDim(t,this.propertyNodes),a=this._getWidgetOffset(t,this.propertyNodes);if("px"===i)o=Math.max(n,o),o=Math.min(r-a,o);else{o=Math.max(o,n/r*100);var s="width"===t?"left":"top";o=this._sanitizePercentSizeOnPage(o,s)}var d=o+i,l=[];return this.propertyNodes.forEach((function(e){var i={};i[t]=d,l.push({style:i,id:e._layout.model.id})})),this.updateModel(l),o},rotateByProperty:function(t){var e=this,i=(t%360+360)%360,o=[];return this.propertyNodes.forEach((function(t){e.preventRotate(t)||o.push({style:{rotateAngle:i},id:t._layout.model.id})})),this.updateModel(o),i},_processChange:function(t,e,i){return"rotation"===t?this.rotateByProperty(e):this.resizeByProperty("width"===t?"width":"height",e,i)},getProperties:function(){v.inherited("getProperties",this,arguments);var t=this.getUnitsFromValue(this.propertyNodes[0]._layout.model.style.width),e="°",i=this.preventRotate(this.propertyNodes[0]),n=[{units:t,getProp:function(t){return t._layout.model.style.width}},{units:t,getProp:function(t){return t._layout.model.style.height}},{units:e,getProp:function(t){return(o.getAngleDegree(t)+360)%360}}];i&&n.push({units:"",getProp:this.preventRotate}),this._getValuesForProperties(n),i&&(i=""!==n[3].value);var r=[{type:"SectionLabel",label:d.get("propResizeLabel"),tabName:d.get("tabName_general"),sectionName:d.get("sectionName_layout"),sectionOpened:!0,order:30},{type:"Split",name:"resizeWidgetSplit",id:"resizeWidgetSplit",tabName:d.get("tabName_general"),sectionName:d.get("sectionName_layout"),order:31,items:[{align:"left",items:[{type:"InputLabel",label:d.get("propResizeWidth"),name:"width",id:"width",tabName:d.get("tabName_general"),sectionName:d.get("sectionName_layout"),readOnly:!1,value:n[0].value,onChangeValueHold:n[0].value,multiline:!0,handleReturnKey:!0,units:t,onChange:this.wrapChangeProperty()}]},{align:"right",items:[{type:"InputLabel",label:d.get("propResizeHeight"),name:"height",id:"height",tabName:d.get("tabName_general"),sectionName:d.get("sectionName_layout"),readOnly:!1,value:n[1].value,onChangeValueHold:n[1].value,multiline:!0,handleReturnKey:!0,units:t,onChange:this.wrapChangeProperty()}]}]}];return i||(r.push({type:"SectionLabel",label:d.get("propRotateLabel"),tabName:d.get("tabName_general"),sectionName:d.get("sectionName_layout"),order:32}),r.push({type:"InputLabel",label:d.get("propRotateAngle"),name:"rotation",id:"rotation",tabName:d.get("tabName_general"),sectionName:d.get("sectionName_layout"),readOnly:!1,value:n[2].value,onChangeValueHold:n[2].value,handleReturnKey:!0,units:e,onChange:this.wrapChangeProperty(),order:33})),this.showStyleProperties(this.propertyNodes[0])?r:[]}});return v})),define("dashboard-core/js/dashboard/layout/authoring/interaction/AlignAction",["./BasePropertyAction","jquery","underscore","../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","../../../../app/nls/StringResources"],(function(t,e,i,o,n){var r=null;return r=t.extend({init:function(t){this.controller=t,r.inherited("init",this,arguments),this.selectedNodes=[]},newSelection:function(t){this.selectedNodes=t},getProperties:function(){var t=this.dashboardApi.getFeature("Icons"),e=this.selectedNodes.length<=1;return[{type:"IconPicker",label:n.get("toolbarActionAlign"),name:"alignWidget",id:"alignWidget",tabName:n.get("tabName_general"),sectionName:n.get("sectionName_layout"),sectionOpened:!0,readOnly:e,items:[{name:"left",label:n.get("alignWidgetLeft"),value:t.getIcon("align-left").id},{name:"center",label:n.get("alignWidgetCenter"),value:t.getIcon("align-horizontally").id},{name:"right",label:n.get("alignWidgetRight"),value:t.getIcon("align-right").id},{name:"top",label:n.get("alignWidgetTop"),value:t.getIcon("align-top").id},{name:"middle",label:n.get("alignWidgetMiddle"),value:t.getIcon("align-vertically").id},{name:"bottom",label:n.get("alignWidgetBottom"),value:t.getIcon("align-bottom").id}],onChange:this.onAlignIconClick.bind(this),order:10}]},onAlignIconClick:function(t,e){if(e&&e.length&&e[0].name&&this.selectedNodes.length>1){var i=e[0].name;this.applyAlignment(i)}},getWidgetBoxes:function(t){var i=o.position(t),n=o.widgetSize(t),r={boundingBox:e(t).position(),widgetBox:{top:i.top,left:i.left,width:n.width,height:n.height}},a=t.getBoundingClientRect();return r.boundingBox.width=a.width,r.boundingBox.height=a.height,r},applyAlignment:function(t){var e={left:this.getLeftAlignmentStyle,center:this.getCenterAlignmentStyle,right:this.getRightAlignmentStyle,top:this.getTopAlignmentStyle,middle:this.getMiddleAlignmentStyle,bottom:this.getBottomAlignmentStyle},i=[],o=this.getWidgetBoxes(this.selectedNodes[0]);i.push(o);for(var n={top:o.boundingBox.top,left:o.boundingBox.left,bottom:o.boundingBox.top+o.boundingBox.height,right:o.boundingBox.left+o.boundingBox.width},r=1;r<this.selectedNodes.length;r++){var a=this.getWidgetBoxes(this.selectedNodes[r]);i.push(a),n.top=Math.min(n.top,a.boundingBox.top),n.left=Math.min(n.left,a.boundingBox.left),n.bottom=Math.max(n.bottom,a.boundingBox.top+a.boundingBox.height),n.right=Math.max(n.right,a.boundingBox.left+a.boundingBox.width)}for(var s=[],d=0;d<this.selectedNodes.length;d++){var l=e[t](n,i[d],this.selectedNodes[d]);l&&s.push({style:l,id:this.selectedNodes[d]._layout.model.id})}s.length&&(this.updateModel(s),this.refreshProperties())},getLeftAlignmentStyle:function(t,e,i){var o=t.left;Math.round(e.boundingBox.left)!==Math.round(e.widgetBox.left)&&(o-=e.boundingBox.left-e.widgetBox.left);return{left:(o=Math.max(o,i._layout.parentLayout.getMinimumLeft()))+"px"}},getCenterAlignmentStyle:function(t,e,i){var o=t.left+(t.right-t.left)/2-e.widgetBox.width/2;Math.round(e.boundingBox.left)!==Math.round(e.widgetBox.left)&&(o-=e.boundingBox.left+e.boundingBox.width/2-(e.widgetBox.left+e.widgetBox.width/2));return{left:(o=Math.max(o,i._layout.parentLayout.getMinimumLeft()))+"px"}},getRightAlignmentStyle:function(t,e,i){var o=t.right-e.widgetBox.width;Math.round(e.boundingBox.width)!==Math.round(e.widgetBox.width)&&(o-=e.boundingBox.left+e.boundingBox.width-(e.widgetBox.left+e.widgetBox.width));return{left:(o=Math.max(o,i._layout.parentLayout.getMinimumLeft()))+"px"}},getTopAlignmentStyle:function(t,e,i){var o=t.top;Math.round(e.boundingBox.top)!==Math.round(e.widgetBox.top)&&(o-=e.boundingBox.top-e.widgetBox.top);return{top:(o=Math.max(o,i._layout.parentLayout.getMinimumTop()))+"px"}},getMiddleAlignmentStyle:function(t,e,i){var o=t.top+(t.bottom-t.top)/2-e.widgetBox.height/2;Math.round(e.boundingBox.top)!==Math.round(e.widgetBox.top)&&(o-=e.boundingBox.top+e.boundingBox.height/2-(e.widgetBox.top+e.widgetBox.height/2));return{top:(o=Math.max(o,i._layout.parentLayout.getMinimumTop()))+"px"}},getBottomAlignmentStyle:function(t,e,i){var o=t.bottom-e.widgetBox.height;Math.round(e.boundingBox.height)!==Math.round(e.widgetBox.height)&&(o-=e.boundingBox.top+e.boundingBox.height-(e.widgetBox.top+e.widgetBox.height));return{top:(o=Math.max(o,i._layout.parentLayout.getMinimumTop()))+"px"}}})})),define("dashboard-core/js/dashboard/layout/authoring/interaction/strategy/Authoring",["../../../../../lib/@waca/core-client/js/core-client/ui/core/Class","./../InteractionFactory","./../MoveWidgets","./../MoveGroupContent","./../Resize","./../ExpandAction","./../AlignAction"],(function(t,e,i,o,n,r,a){var s=t.extend({init:function(t){s.inherited("init",this,arguments),this.logger=t},destroy:function(){if(this._handlers&&this._handlers.forEach((function(t){t.remove&&t.remove()})),this._handlers=null,this._interactions){for(var t in this._interactions)if(this._interactions.hasOwnProperty(t)){var e=this._interactions[t].wrapped;e&&e.destroy&&e.destroy()}this._interactions=null}},getInteraction:function(t){var e=this._interactions[t];return e&&e.wrapped},attachInteractions:function(t){var e=this;return this._getInteractions(t,this.logger).then((function(i){e._interactions=i,e._attachInteractions(t,i)}))},_attachInteractions:function(t,e){var i=e.resize,o=e.expand,n=e.move,r=e.moveGroupContent,a=e.align,s=t.config&&t.config.focusModeDisabled;i&&t.addActionForSelector(i,".page .widget:not(.placeholderWidget)"),o&&!s&&t.addActionForSelector(o,".page .widget:not(.placeholderWidget)"),n&&t.addActionForSelector(n,".page .widget:not(.pagegroup *):not(.placeholderWidget)"),a&&t.addActionForSelector(a,".page .widget:not(.placeholderWidget)"),i&&t.addActionForSelector(i,".page .pagegroup",!0),n&&t.addActionForSelector(n,".page .pagegroup",!0),a&&t.addActionForSelector(a,".page .pagegroup",!0),r&&t.addActionForSelector(r,".pagegroup .widget"),this._handleJointInteractions(t,e)},_handleJointInteractions:function(t,e){var i=e.resize,o=(i=void 0===i?{}:i).wrapped,n=e.move,r=(n=void 0===n?{}:n).wrapped,a=e.moveGroupContent,s=(a=void 0===a?{}:a).wrapped;this._handlers=[],r&&this._handlers.push(r.on("move:end",t.finishMoveSelection,t)),o&&this._handlers.push(o.on("resize:start",t.onSelectionMoveOrResize,t)),r&&this._handlers.push(r.on("move:start",t.onSelectionMoveOrResize,t)),s&&this._handlers.push(s.on("move:start",t.onSelectionMoveOrResize,t))},_getInteractions:function(t,s){var d={resize:n,expand:r,move:i,moveGroupContent:o,align:a};return new e(t,s).getInteractions(d)}});return s})),define("dashboard-core/js/features/dashboard/actions/orderAction/OrderAction",["../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","../../../../app/nls/StringResources","underscore","../../../../lib/@waca/dashboard-common/dist/core/APIFactory","../../../../lib/@waca/dashboard-common/dist/api/ContentActionsProviderAPI"],(function(t,e,i,o,n){return function(){function r(t){var e=t.features;_classCallCheck(this,r),e&&(this.dashboard=e.API,e.ContentActions.registerProvider("order",this.getAPI()),this._dashboardState=e.DashboardState,this._icons=e.Icons)}return r.prototype.getAPI=function(){return this._api||(this._api=o.createAPI(this,[n])),this._api},r.prototype.getLifeCycleHandlers=function(){return[{name:"post:dashboard.initialize",action:this.postDashboardInitialize.bind(this)}]},r.prototype.postDashboardInitialize=function(){return this.dashboard&&(this.controller=this.dashboard.getFeature("InteractionController.internal")),Promise.resolve()},r.prototype.destroy=function(){this.dashboard=null,this.controller=null},r.prototype.getNodes=function(e){return t.getNodes(this.controller,e)},r.prototype.getParentModel=function(t){var e=this.getNodes(t);if(e.length>0)return e[0]._layout.model.getParent()},r.prototype.getItems=function(t){var e=this.getParentModel(t);return e&&e.items.filter((function(t){return"templateDropZone"!==t.type&&"templateIndicator"!==t.type}))},r.prototype._isAvailable=function(t){var e=this.getNodes(t),o=this.getItems(t);return e.length&&o.length>1&&this.dashboard.getMode()===this.dashboard.MODES.EDIT&&void 0===i.find(e,(function(t){return-1===o.indexOf(t._layout.model)}))},r.prototype._isDisabled=function(){return this._dashboardState.getUiState().focus},r.prototype.getContentActionList=function(t){return this._isAvailable(t)?[{name:"orderToFront",label:e.get("toolbarActionOrderToFront"),icon:this._icons.getIcon("bring-to-front").id,type:"Button",disabled:this._isDisabled.bind(this),actions:{apply:this.orderContent.bind(this,t,this.getItems(t).length-this.getNodes(t).length)}},{name:"orderToBack",label:e.get("toolbarActionOrderToBack"),icon:this._icons.getIcon("send-to-back").id,type:"Button",disabled:this._isDisabled.bind(this),actions:{apply:this.orderContent.bind(this,t,0)}}]:[]},r.prototype.orderContent=function(t,e){var o=this.getItems(t),n=this.getNodes(t),r=i.map(n,(function(t){return t._layout.model})),a=this.getParentModel(t),s=[],d=[],l=[],h=void 0,u=void 0,c=void 0,p=void 0;for(u=0,c=0,p=!1;u<o.length;u++)h=o[u],-1===r.indexOf(h)?(l.push(h),c++):(d.push(h),c!==e&&(p=!0));if(p){var g=l[e];for(u=0;u<r.length;u++)h=r[u],s.push({id:h.id,parentId:a.id,insertBefore:g?g.id:null});a.updateModel({updateArray:s})}},r}()})),define("dashboard-core/js/features/dashboard/actions/deleteAction/api/DeleteActionAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.setOnBeforeDeleteCallback=function(){},t}()})),define("dashboard-core/js/features/dashboard/actions/deleteAction/DeleteAction",["../../../../app/nls/StringResources","../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","jquery","underscore","../../../../lib/@waca/dashboard-common/dist/utils/DialogBlocker","../../../../dashboard/glass/util/InstrumentationUtil","../../../../lib/@waca/dashboard-common/dist/core/APIFactory","../../../../lib/@waca/dashboard-common/dist/api/ContentActionsProviderAPI","./api/DeleteActionAPI"],(function(t,e,i,o,n,r,a,s,d){return function(){function l(t){var e=this,i=t.features;_classCallCheck(this,l),i&&(this.dashboard=i.API,this._icons=i.Icons,i.ContentActions.registerProvider("delete",this.getAPI())),this.id=o.uniqueId("id"),this.dashboard.getCanvasWhenReady().then((function(t){e.canvas=t,t.on("change:selections:select",e.onContentSelectionChange,e),t.on("change:selections:deselect",e.onContentSelectionChange,e)}))}return l.prototype.getAPI=function(){return this._api||(this._api=a.createAPI(this,[s,d])),this._api},l.prototype.getLifeCycleHandlers=function(){return[{name:"post:dashboard.initialize",action:this.postDashboardInitialize.bind(this)}]},l.prototype.postDashboardInitialize=function(){return this.dashboard&&(this.transactionApi=this.dashboard.getFeature("Transaction"),this.controller=this.dashboard.getFeature("InteractionController.internal")),Promise.resolve()},l.prototype.destroy=function(){this.canvas&&(this.canvas.off("change:selections:select",this.onContentSelectionChange,this),this.canvas.off("change:selections:deselect",this.onContentSelectionChange,this),this.canvas=null),this._deRegisterEvent(),this.dashboard=null,this.controller=null,this.id=null},l.prototype.getNodes=function(t){return e.getNodes(this.controller,t)},l.prototype._isEnabled=function(t){return t.length&&this.dashboard.getMode()===this.dashboard.MODES.EDIT},l.prototype.getContentActionList=function(e){return this._isEnabled(e)?[{name:"delete",label:t.get("toolbarActionDelete"),icon:this._icons.getIcon("dashboard-delete").id,type:"Button",actions:{apply:this.deleteContent.bind(this,e)}}]:[]},l.prototype.onContentSelectionChange=function(){var t=this.canvas.getSelectedContentList().map((function(t){return t.getId()})),e=this.dashboard.getAppConfig("interactions");e&&!1===e.delete||(this._deRegisterEvent(),this._isEnabled(t)&&i("html").on("keyup.interactionDeleteKey"+this.id,this.deleteKeyPress.bind(this,t)))},l.prototype._deRegisterEvent=function(){i("html").off("keyup.interactionDeleteKey"+this.id)},l.prototype.deleteKeyPress=function(t,e){var i=e.srcElement||e.target;if(!i.tagName.toLowerCase().match(/input|textarea|select/gim)&&!this._elementIsInSlotEditor(i))return e.ctrlKey||46!==e.keyCode&&8!==e.keyCode||n.isShowingDialogBlocker()?void 0:this.deleteContent(t)},l.prototype._elementIsInSlotEditor=function(t){return t.closest(".slotEditor")},l.prototype.setOnBeforeDeleteCallback=function(t){this.onBeforeDeleteCallback=t},l.prototype.deleteContent=function(t){var e=this;if(this.controller.$el.is(":visible")){var i=void 0,o=[],n=[],a=this.transactionApi.startTransaction(),s=a.transactionId;n=this.onBeforeDeleteCallback?this.onBeforeDeleteCallback({currentSelection:t,undoRedoTransactionId:s,transactionToken:a}):this.getNodes(t);for(var d=0;d<n.length;d++)i=this.controller.layoutController.nodeIdToModelId(n[d].id),o.push(i),r.trackWidget("deleted",this.dashboard,null,i),n[d]._layout&&n[d]._layout.widgetChromeEventRouter&&n[d]._layout.widgetChromeEventRouter.trigger("widget:onDeleteAction",{data:{undoRedoTransactionId:s,transactionToken:a}});return this.controller.selectionHandler.deselectAll(),o.forEach((function(t){e.dashboard.getCanvas().removeContent(t,a)})),this._deleteAfter({ids:o,undoRedoTransactionId:s},a)}},l.prototype._deleteAfter=function(t,e){var i=this;return this.dashboard.getFeature(".LifeCycleManager").invokeLifeCycleHandlers("post:widget.delete",t).then((function(){return i.transactionApi.endTransaction(e),i.controller.onSelectionDelete()}))},l}()})),define("@dashboard-features/sampleFeature/js/api/SampleAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.doIt=function(){},t}()})),define("@dashboard-features/sampleFeature/js/SampleImpl",["@waca/dashboard-common/js/core/APIFactory","./api/SampleAPI"],(function(t,e){return function(){function i(t){var e=t.features;_classCallCheck(this,i),this._features=e}return i.prototype.getAPI=function(){return this._api||(this._api=t.createAPI(this,[e])),this._api},i.prototype.doIt=function(t){this._features.Logger.log("SampleFeature:doIt["+t+"]")},i}()})),define("@dashboard-features/dashboardDnd/js/api/DashboardDndAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.startDrag=function(){},t.prototype.registerDropTarget=function(){},t.prototype.deregisterDropTarget=function(){},t.prototype.registerDropHandler=function(){},t.prototype.deregisterDropHandler=function(){},t}()})),define("@dashboard-features/dashboardDnd/js/DashboardDndImpl",["@waca/dashboard-common/js/core/APIFactory","./api/DashboardDndAPI"],(function(t,e){return function(){function i(o){var n=o.features;_classCallCheck(this,i),this._dashboardApi=n.API,this._api=t.createAPI(this,[e])}return i.prototype.initialize=function(){var t=this;return this._dashboardApi.getDashboardSvc(".DndManager").then((function(e){t._privateApi=e}))},i.prototype.getAPI=function(t){return"internal"===t?this._privateApi:this._api},i.prototype.startDrag=function(t){this._privateApi.startDrag(t)},i.prototype.registerDropTarget=function(t){return this._privateApi.registerDropTarget(t)},i.prototype.deregisterDropTarget=function(t){this._privateApi.deregisterDropTarget(t)},i.prototype.registerDropHandler=function(t){return this._privateApi.registerDropHandler(t)},i.prototype.deregisterDropHandler=function(t){this._privateApi.deregisterDropHandler(t)},i}()})),define("@dashboard-features/save/js/SaveAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.save=function(){},t.prototype.saveAs=function(){},t}()})),define("@dashboard-features/save/js/Save",["@waca/dashboard-common/js/core/APIFactory","./SaveAPI"],(function(t,e){return function(){function i(o){var n=o.features;_classCallCheck(this,i),this._features=n,this._api=t.createAPI(this,[e])}return i.prototype.getAPI=function(){return this._api},i.prototype.destroy=function(){delete this._api},i.prototype.save=function(t){var e=this,i=this._features.internal.getBoardModel().id;if(!i){return Promise.reject({status:"fail",error:Object.assign(new Error,{code:"missingDashboardId"})})}return this._getContentService().then((function(t){return t.saveDashboard(e._features.API,i)})).then((function(i){return e._getResponse(i,t)}))},i.prototype.saveAs=function(t,e,i,o){var n=this,r=e;return-1===r.indexOf("/")&&(r="v1/objects/"+e+"/items"),this._getContentService().then((function(e){return e.saveAsDashboard(n._features.API,t,r,i)})).then((function(t){return n._getResponse(t,o)}))},i.prototype._getContentService=function(){return this._features.API.getServiceWhenReady(".DashboardContent")},i.prototype._getResponse=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["status","assetId"];return this._pick(t,e)},i.prototype._pick=function(t,e){var i={};return e.forEach((function(e){t.hasOwnProperty(e)&&(i[e]=t[e])})),i},i}()})),define("dashboard-core/js/features/dashboard/actions/groupAction/GroupAction",["../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","../../../../app/nls/StringResources","jquery","../../../../lib/@waca/dashboard-common/dist/core/APIFactory","../../../../lib/@waca/dashboard-common/dist/api/ContentActionsProviderAPI","../../../../dashboard/util/PxPercentUtil","../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils"],(function(t,e,i,o,n,r,a){return function(){function s(t){var e=t.features;_classCallCheck(this,s),e&&(this.dashboard=e.API,e.ContentActions.registerProvider("group",this.getAPI()),this.deleteAction=e.deleteAction,this._icons=e.Icons),this._handlers=[]}return s.prototype.getAPI=function(){return this._api||(this._api=o.createAPI(this,[n])),this._api},s.prototype.getLifeCycleHandlers=function(){return[{name:"post:dashboard.initialize",action:this.postDashboardInitialize.bind(this)},{name:"dashboard.layout.interactions.ready",action:this.onDashboardLayoutInteractionsReady.bind(this)}]},s.prototype.postDashboardInitialize=function(){return this.dashboard&&(this.controller=this.dashboard.getFeature("InteractionController.internal"),this.selectionHandler=this.controller.selectionHandler,this.onDashboardLayoutInteractionsReady()),Promise.resolve()},s.prototype.onDashboardLayoutInteractionsReady=function(){if(this.selectionHandler){this.deRegisterEvents(),this._handlers.push(this.selectionHandler.on("selection:before",this.beforeSelection,this)),this.deleteAction.setOnBeforeDeleteCallback(this.onBeforeDelete.bind(this));var t=this.controller.getInteraction("resize");t&&this._handlers.push(t.on("resize:done",this.recalculateGroupRect,this));var e=this.controller.getInteraction("moveGroupContent");e&&this._handlers.push(e.on("moveGroupContent:done",this.recalculateGroupRect,this))}},s.prototype.deRegisterEvents=function(){this._handlers&&this._handlers.forEach((function(t){t.remove&&t.remove()})),this._handlers=[]},s.prototype.destroy=function(){this.deRegisterEvents(),this.dashboard=null,this.controller=null,this.selectionHandler=null,this.events=null,this._handlers=null},s.prototype.getNodes=function(e){return t.getNodes(this.controller,e)},s.prototype.isGroupEnabled=function(t){var e=!1,i=this.getNodes(t);if(i.length>0){var o=null;e=!i.some((function(t){if(o&&o!==t.parentNode)return!0;o=t.parentNode}))}return this.dashboard.getMode()===this.dashboard.MODES.EDIT&&e&&i.length>1&&!this._getTopGroup(i[0])},s.prototype.isUnGroupEnabled=function(t){var e=this,o=!1,n=this.getNodes(t);return n.length>0&&(o=!n.some((function(t){return!i(t).hasClass("pagegroup")&&!e._getTopGroup(t)}))),this.dashboard.getMode()===this.dashboard.MODES.EDIT&&o},s.prototype.getContentActionList=function(t){var i=[];return this.isGroupEnabled(t)&&i.push({name:"group",label:e.get("toolbarActionGroup"),icon:this._icons.getIcon("dashboard-group").id,type:"Button",actions:{apply:this.groupContent.bind(this,t)}}),this.isUnGroupEnabled(t)&&i.push({name:"ungroup",label:e.get("toolbarActionUngroup"),icon:this._icons.getIcon("dashboard-ungroup").id,type:"Button",actions:{apply:this.ungroupContent.bind(this,t)}}),i},s.prototype._getTopGroup=function(t){var e=null,o=i(t).parents(".pagegroup");return o.length>0&&(e=o[o.length-1]),e},s.prototype.beforeSelection=function(t){var e=t.newSelection,i=t.currentSelection,o=this._getTopGroup(e),n=i.length;n>0&&this.handleMultipleSelection(i,o,t)||o&&(1===n&&i[0]===o&&"mousedown"!==t.eventType?this.selectionHandler.deselectAll():t.newSelection=o)},s.prototype.handleMultipleSelection=function(t,e,i){var o=this._getTopGroup(t[0]);return!!o&&(o!==e&&(this.selectionHandler.deselectAll(),this.selectionHandler.selectNode(o),e&&(i.newSelection=e)),!0)},s.prototype.groupContent=function(e,i){var o=this,n=this.getNodes(e);if(!(n.length<=0)){for(var a=[],s=0,d=n.length;s<d;s++){var l=n[s];if(l._layout){var h=t.position(l),u=t.widgetSize(l);a.push({position:h,bounds:u})}}var c=n[0]._layout.parentLayout.model,p=this.calculateGroupRect(n),g={type:"group",style:{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"}},f={containerId:c.id,spec:g},v=this.dashboard.getCanvas(),y=this.dashboard.getFeature("Transaction"),m=y.startTransaction();return v.addContent(f,m).then((function(t){var e=t.getId();return o.controller.layoutController.layoutReady(e).then((function(t){for(var s=n.map((function(t){return t._layout.model.id})),d=v.moveContent(e,s,m),l=0,h=n.length;l<h;l++){if(n[l]._layout){var u=a[l].position,c=a[l].bounds,g={left:u.left-p.left+"px",top:u.top-p.top+"px",width:c.width+"px",height:c.height+"px"};r.changePixelPropertiesToPercent(g,p),d[l].setPropertyValue("left",g.left,m),d[l].setPropertyValue("top",g.top,m),d[l].setPropertyValue("width",g.width,m),d[l].setPropertyValue("height",g.height,m)}}y.endTransaction(m),o.selectionHandler.deselectAll(),t&&o.selectionHandler.selectNode(t.domNode,{isTouch:!!i&&"touchstart"===i.type})}))}))}},s.prototype.ungroupContent=function(t,e,o){var n=this.getNodes(t),r=this.dashboard.getFeature("Transaction"),a=void 0;a=o?r.startTransactionById(o):r.startTransaction(),this.selectionHandler.deselectAll();var s,d,l=[];for(i(n[0]).hasClass("pagegroup")?l=this.ungroupWholeGroups(n,a):(this.ungroupIndividualNodes(n,a),l=n),r.endTransaction(a),s=l.length-1;s>=0;s--)d=l[s],this.selectionHandler.selectNode(d,{isTouch:!!e&&"touchstart"===e.type});return l},s.prototype._calculateNewStyleForEachNode=function(e,i,o){var n=i._layout.parentLayout,r=t.getAngleDegree(e),a=e.getBoundingClientRect(),s=t.getRotatedCoordinates(n.domNode,a.left,a.top),d=window.getComputedStyle(e),l=o+r,h=t.widgetSize(e);return{height:h.height+"px",width:h.width+"px",top:s.y-t.getStyleIntValue(d.marginTop)+"px",left:s.x-t.getStyleIntValue(d.marginLeft)+"px",rotateAngle:l}},s.prototype._ungroupGroupNode=function(e,i){for(var o,n,r=[],a=t.getContentWithoutDecoration(e),s={},d=0,l=a.length;d<l;d++)o=a[d],n=t.getAngleDegree(e),s[o._layout.id]=this._calculateNewStyleForEachNode(o,e,n),r.push(o);var h=this.dashboard.getCanvas(),u=h.getContent(e._layout.id),c=h.moveContent(u.getContainer().getId(),u.getChildren().map((function(t){return t.getId()})),i);return h.removeContent(u.getId(),i),c.forEach((function(t){var e=t.getId();Object.keys(s[e]).forEach((function(o){t.setPropertyValue(o,s[e][o],i)}))})),r},s.prototype.ungroupWholeGroups=function(t,e){var i,o=[],n=void 0;for(n=0,i=t.length;n<i;n++){var r=t[n],a=this._ungroupGroupNode(r,e);o=o.concat(a)}return o},s.prototype.getNodeId=function(t){this.layoutController.modelIdToNodeId(t)},s.prototype._ungroupSingleNode=function(e,o,n,r){var a=i(o).parents(".pagegroup"),s=a.length,d=this.dashboard.getCanvas();if(s>0){var l=n?e:a[s-1],h=t.radianToDegree(t.getAbsoluteAngleRadian(e,l)),u=this._calculateNewStyleForEachNode(o,l,h),c=d.getContent(o._layout.id),p=d.getContent(l._layout.id);d.moveContent(p.getContainer().getId(),[o._layout.id],r),Object.keys(u).forEach((function(t){c.setPropertyValue(t,u[t],r)}))}},s.prototype._ungroupMultipleNodes=function(t,e,o){for(var n=[],r=0;r<t.length;r++){var a=t[r];this._ungroupSingleNode(e,a,!1,o),n.push(a)}var s=this.dashboard.getCanvas(),d=s.getContent(e._layout.id).findContent();if(0==d.length)s.removeContent(e._layout.id,o);else if(1==d.length){var l=d[0].getId(),h=i(e).find("#"+l)[0];this._ungroupSingleNode(e,h,!0,o),s.removeContent(e._layout.id,o),n.push(h)}else n.push(e);return n},s.prototype.ungroupIndividualNodes=function(t,e){for(var i=[],o={},n=0;n<t.length;n++){var r=t[n],a=r.parentNode._layout.id;o[a]||(o[a]=[]),o[a].push(r)}for(var s=this._getAffectedGroups(t),d=void 0,l=void 0,h=0;h<s.length;h++){var u=s[h];d=o[u.id],l=this._ungroupMultipleNodes(d||[],u,e),i=i.concat(l)}for(var c=0;c<s.length;c++)s[c]._layout&&this.recalculateGroupRectForLayout(s[c]._layout,e.transactionId);return i},s.prototype.calculateGroupRect=function(e){var o={},n=t.getMinMaxTopLeft(e,(function(t){var e=i(t).position();e.top+=i(t).parent().scrollTop(),e.left+=i(t).parent().scrollLeft();var o=t.getBoundingClientRect();return e.height=o.height,e.width=o.width,e}));return o.width=n.maxLeft-n.minLeft,o.height=n.maxTop-n.minTop,o.top=Math.round(n.minTop),o.left=Math.round(n.minLeft),o},s.prototype.recalculateGroupRect=function(t){for(var e=t.undoRedoTransactionId,i=this._getAffectedGroups(t.currentSelection),o=0,n=i.length;o<n;o++)this.recalculateGroupRectForLayout(i[o]._layout,e)},s.prototype.onBeforeDelete=function(t){for(var e=this,i=t.currentSelection,o=this.getNodes(i),n=[],r=[],a=0;a<o.length;a++)"group"===o[a]._layout.parentLayout.model.type||"group"===o[a]._layout.model.type?n.push(o[a]):r.push(o[a]);return n.forEach((function(i){r.push.apply(r,e.ungroupContent([i.id],null,t.undoRedoTransactionId))})),r},s.prototype._getAffectedGroups=function(t){var e,o,n=[];for(e=0,o=t.length;e<o;e++)n.push(i(t[e]).parents(".pagegroup"));var r,a=[],s=0;do{r=this._affectedGroupSortStep(n,s,a),s++}while(r);return a},s.prototype._affectedGroupSortStep=function(t,e,i){var o,n,r,a,s,d=!1;for(o=0,n=t.length;o<n;o++)e<(r=t[o]).length&&(d=!0,a=r[e],-1!==(s=i.indexOf(a))&&i.splice(s,1),i.push(a));return d},s.prototype.recalculateGroupRectForLayout=function(t,e){var o=this.dashboard.getFeature("Transaction"),n=o.startTransactionById(e),s=t.domNode,d=a.getContentWithoutDecoration(s),l=a.getMinMaxTopLeft(d,(function(t){var e=a.position(t),o=i(t);return e.height=o.outerHeight(),e.width=o.outerWidth(),o.height(e.height),o.width(e.width),o.css("left",e.left),o.css("top",e.top),e})),h=a.getCenter(d[0]),u=a.getRotatedCoordinates(s.parentNode,h.left,h.top),c=l.maxLeft-l.minLeft+"px";s.style.width=c;var p=l.maxTop-l.minTop+"px";s.style.height=p;var g=a.position(s);s.style.top=g.top+l.minTop+"px",s.style.left=g.left+l.minLeft+"px";var f,v,y,m=this.dashboard.getCanvas(),b={height:s.clientHeight,width:s.clientWidth};for(f=0,v=d.length;f<v;f++)if(y=d[f],g=a.position(y),y.style.top=g.top-l.minTop+"px",y.style.left=g.left-l.minLeft+"px",y._layout){var _={top:y.style.top,left:y.style.left,height:i(y).height()+"px",width:i(y).width()+"px"},w=m.getContent(y._layout.model.id);if(w)for(var C in r.changePixelPropertiesToPercent(_,b),_)w.setPropertyValue(C,_[C],n)}h=a.getCenter(d[0]);var I=a.getRotatedCoordinates(s.parentNode,h.left,h.top),P=(g=a.position(s)).top-I.y+u.y+"px";s.style.top=P;var S=g.left-I.x+u.x+"px";s.style.left=S;var x=m.getContent(t.model.id);x.setPropertyValue("top",P,n),x.setPropertyValue("left",S,n),x.setPropertyValue("height",p,n),x.setPropertyValue("width",c,n),o.endTransaction(n)},s}()})),define("dashboard-core/js/features/dashboard/actions/duplicateAction/DuplicateAction",["../../../../app/nls/StringResources","../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","jquery","underscore","../../../../lib/@waca/dashboard-common/dist/core/APIFactory","../../../../lib/@waca/dashboard-common/dist/api/ContentActionsProviderAPI"],(function(t,e,i,o,n,r){return function(){function a(t){var e=t.features;_classCallCheck(this,a),e&&(this.dashboard=e.API,e.ContentActions.registerProvider("duplicate",this.getAPI()),this._dashboardState=e.DashboardState,this._icons=e.Icons)}return a.prototype.getAPI=function(){return this._api||(this._api=n.createAPI(this,[r])),this._api},a.prototype.getLifeCycleHandlers=function(){return[{name:"post:dashboard.initialize",action:this.postDashboardInitialize.bind(this)}]},a.prototype.postDashboardInitialize=function(){return this.dashboard&&(this.controller=this.dashboard.getFeature("InteractionController.internal")),Promise.resolve()},a.prototype.destroy=function(){this.dashboard=null,this.controller=null},a.prototype.getNodes=function(t){return e.getNodes(this.controller,t)},a.prototype._isAvailable=function(t){return t.length&&this._isSupportedVisualizations(t)&&this.dashboard.getMode()===this.dashboard.MODES.EDIT&&void 0===o.find(this.getNodes(t),(function(t){return i(t).hasClass("filterWidget")}))},a.prototype._isSupportedVisualizations=function(t){for(var e=0;e<t.length;e++)if(this._isNotSupportedVisualization(t[e]))return!1;return!0},a.prototype._isNotSupportedVisualization=function(t){var e=this.dashboard.getCanvas().getContent(t);if(!e)return!1;var i=e.getFeature("Visualization");return"widget.live"===e.getType()&&i&&"com.ibm.vis.schematicsPreview"===i.getDefinition().getId()},a.prototype._isDisabled=function(){return this._dashboardState.getUiState().focus},a.prototype.getContentActionList=function(e){return this._isAvailable(e)?[{name:"duplicate",label:t.get("duplicate"),icon:this._icons.getIcon("dashboard-duplicate").id,type:"Button",disabled:this._isDisabled.bind(this),actions:{apply:this.duplicateContent.bind(this,e)}}]:[]},a.prototype.duplicateContent=function(t,e){var i=this,n=[],r=[],a=this.controller.layoutController.getLayoutContentContainer();o.each(this.getNodes(t),function(t){var e=this.controller.layoutController.nodeIdToModelId(t.id),i=this._checkLayoutBoundLimits(t,a);i.right&&i.bottom||r.push({id:e,right:i.right,bottom:i.bottom}),n.push(e)}.bind(this));var s={modelIds:n};r.length>0&&(s.outBoundIds=r);var d=this.controller.boardModel.duplicateSelection(s);this.controller.selectionHandler.deselectAll();var l=[];return d.forEach((function(t){return l.push(t.then((function(t){return i.controller.layoutController.selectLayouts([t],e)})).catch((function(t){console.log(t)})))})),l},a.prototype._checkLayoutBoundLimits=function(t,e){var i={right:!0,bottom:!0},o=t._layout.parentLayout.getMaximumHeight(),n=t._layout.parentLayout.getMaximumWidth();if(isFinite(o)&&isFinite(n)){var r=e.clientHeight,a=e.clientWidth;if(isFinite(r)&&isFinite(a)){var s=t._layout.model,d=s.style;if(d){var l=parseFloat(s.incrementStyleValue(d.top))/100*r,h=parseFloat(s.incrementStyleValue(d.left))/100*a,u=parseFloat(d.height)/100*r,c=parseFloat(d.width)/100*a;l+u>o&&(i.bottom=!1),h+c>n&&(i.right=!1)}}}return i},a}()})),define("dashboard-core/js/features/dashboard/actions/alignAction/AlignAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.applyAction=function(){},t}()})),define("dashboard-core/js/features/dashboard/actions/alignAction/impl/AlignAction",["../../../../../lib/@waca/dashboard-common/dist/core/APIFactory","../AlignAPI","../../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","../../../../../app/nls/StringResources","jquery","../../../../../lib/@waca/dashboard-common/dist/api/ContentActionsProviderAPI"],(function(t,e,i,o,n,r){return function(){function a(t){var e=t.features;_classCallCheck(this,a),e&&(this.dashboard=e.API,e.ContentActions.registerProvider("align",this.getAPI()),this._icons=e.Icons)}return a.prototype.getAPI=function(){return this.api||(this.api=t.createAPI(this,[e,r])),this.api},a.prototype.getLifeCycleHandlers=function(){return[{name:"post:dashboard.initialize",action:this.postDashboardInitialize.bind(this)}]},a.prototype.postDashboardInitialize=function(){return this.dashboard&&(this.controller=this.dashboard.getFeature("InteractionController.internal")),Promise.resolve()},a.prototype.destroy=function(){this.dashboard=null,this.controller=null},a.prototype.getNodes=function(t){return i.getNodes(this.controller,t)},a.prototype._isEnabled=function(t){return t.length>1&&this.dashboard.getMode()===this.dashboard.MODES.EDIT},a.prototype.getContentActionList=function(t){return this._isEnabled(t)?[{name:"align",label:o.get("toolbarActionAlign"),icon:this._icons.getIcon("align-horizontally").id,type:"NextView",viewModule:"dashboard-core/js/features/dashboard/actions/alignAction/impl/AlignDialog",viewOptions:{height:290,width:110,actions:{apply:this.applyAlignment.bind(this,t)}}}]:[]},a.prototype.applyAction=function(t){if(t&&t.length&&t[0].name){var e=t[0].name,i=t[0].layoutIds;this.applyAlignment(i,e)}},a.prototype.getWidgetBoxes=function(t){var e=i.position(t),o=i.widgetSize(t),r={boundingBox:n(t).position(),widgetBox:{top:e.top,left:e.left,width:o.width,height:o.height}},a=t.getBoundingClientRect();return r.boundingBox.width=a.width,r.boundingBox.height=a.height,r},a.prototype.applyAlignment=function(t,e){var i=this,o={left:this.getLeftAlignmentStyle,center:this.getCenterAlignmentStyle,right:this.getRightAlignmentStyle,top:this.getTopAlignmentStyle,middle:this.getMiddleAlignmentStyle,bottom:this.getBottomAlignmentStyle},n=[],r=this.getNodes(t),a=this.getWidgetBoxes(r[0]);n.push(a);for(var s={top:a.boundingBox.top,left:a.boundingBox.left,bottom:a.boundingBox.top+a.boundingBox.height,right:a.boundingBox.left+a.boundingBox.width},d=1;d<r.length;d++){var l=this.getWidgetBoxes(r[d]);n.push(l),s.top=Math.min(s.top,l.boundingBox.top),s.left=Math.min(s.left,l.boundingBox.left),s.bottom=Math.max(s.bottom,l.boundingBox.top+l.boundingBox.height),s.right=Math.max(s.right,l.boundingBox.left+l.boundingBox.width)}for(var h=[],u=0;u<r.length;u++){var c=o[e](s,n[u],r[u]);c&&h.push({style:c,id:r[u]._layout.model.id})}if(h.length){var p=this.dashboard.getFeature("Transaction"),g=p.startTransaction();h.forEach((function(t){var e=i.dashboard.getCanvas().getContent(t.id);Object.keys(t.style).forEach((function(i){e.setPropertyValue(i,t.style[i],g)}))})),p.endTransaction(g)}},a.prototype.getLeftAlignmentStyle=function(t,e,i){var o=t.left;Math.round(e.boundingBox.left)!==Math.round(e.widgetBox.left)&&(o-=e.boundingBox.left-e.widgetBox.left);return{left:(o=Math.max(o,i._layout.parentLayout.getMinimumLeft()))+"px"}},a.prototype.getCenterAlignmentStyle=function(t,e,i){var o=t.left+(t.right-t.left)/2-e.widgetBox.width/2;Math.round(e.boundingBox.left)!==Math.round(e.widgetBox.left)&&(o-=e.boundingBox.left+e.boundingBox.width/2-(e.widgetBox.left+e.widgetBox.width/2));return{left:(o=Math.max(o,i._layout.parentLayout.getMinimumLeft()))+"px"}},a.prototype.getRightAlignmentStyle=function(t,e,i){var o=t.right-e.widgetBox.width;Math.round(e.boundingBox.width)!==Math.round(e.widgetBox.width)&&(o-=e.boundingBox.left+e.boundingBox.width-(e.widgetBox.left+e.widgetBox.width));return{left:(o=Math.max(o,i._layout.parentLayout.getMinimumLeft()))+"px"}},a.prototype.getTopAlignmentStyle=function(t,e,i){var o=t.top;Math.round(e.boundingBox.top)!==Math.round(e.widgetBox.top)&&(o-=e.boundingBox.top-e.widgetBox.top);return{top:(o=Math.max(o,i._layout.parentLayout.getMinimumTop()))+"px"}},a.prototype.getMiddleAlignmentStyle=function(t,e,i){var o=t.top+(t.bottom-t.top)/2-e.widgetBox.height/2;Math.round(e.boundingBox.top)!==Math.round(e.widgetBox.top)&&(o-=e.boundingBox.top+e.boundingBox.height/2-(e.widgetBox.top+e.widgetBox.height/2));return{top:(o=Math.max(o,i._layout.parentLayout.getMinimumTop()))+"px"}},a.prototype.getBottomAlignmentStyle=function(t,e,i){var o=t.bottom-e.widgetBox.height;Math.round(e.boundingBox.height)!==Math.round(e.widgetBox.height)&&(o-=e.boundingBox.top+e.boundingBox.height-(e.widgetBox.top+e.widgetBox.height));return{top:(o=Math.max(o,i._layout.parentLayout.getMinimumTop()))+"px"}},a}()})),define("dashboard-core/js/features/dashboard/actions/pinAction/PinAction",["../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","../../../../lib/@waca/core-client/js/core-client/ui/ProgressToast","../../../../app/nls/StringResources","../../../../dashboard/util/DashboardSpecHelper","../../../../app/util/ErrorUtils","jquery","../../../../lib/@waca/dashboard-common/dist/core/APIFactory","../../../../lib/@waca/dashboard-common/dist/api/ContentActionsProviderAPI","underscore"],(function(t,e,i,o,n,r,a,s,d){var l="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOS4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHdpZHRoPSI2NHB4IiBoZWlnaHQ9IjY0cHgiIHZpZXdCb3g9IjAgMCA2NCA2NCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNjQgNjQ7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOiNBRUI4Qjg7fQ0KPC9zdHlsZT4NCjxnPg0KCTxjaXJjbGUgY3g9IjgiIGN5PSI4IiByPSI2Ii8+DQoJPGNpcmNsZSBjeD0iMjQiIGN5PSI4IiByPSI2Ii8+DQoJPGNpcmNsZSBjeD0iNDAiIGN5PSI4IiByPSI2Ii8+DQoJPGNpcmNsZSBjeD0iNTYiIGN5PSI4IiByPSI2Ii8+DQoJPGNpcmNsZSBjeD0iOCIgY3k9IjI0IiByPSI2Ii8+DQoJPGNpcmNsZSBjeD0iMjQiIGN5PSIyNCIgcj0iNiIvPg0KCTxjaXJjbGUgY3g9IjQwIiBjeT0iMjQiIHI9IjYiLz4NCgk8Y2lyY2xlIGN4PSI1NiIgY3k9IjI0IiByPSI2Ii8+DQoJPGNpcmNsZSBjeD0iOCIgY3k9IjQwIiByPSI2Ii8+DQoJPGNpcmNsZSBjeD0iMjQiIGN5PSI0MCIgcj0iNiIvPg0KCTxjaXJjbGUgY3g9IjQwIiBjeT0iNDAiIHI9IjYiLz4NCgk8Y2lyY2xlIGN4PSI1NiIgY3k9IjQwIiByPSI2Ii8+DQoJPGNpcmNsZSBjeD0iOCIgY3k9IjU2IiByPSI2Ii8+DQoJPGNpcmNsZSBjeD0iMjQiIGN5PSI1NiIgcj0iNiIvPg0KCTxjaXJjbGUgY2xhc3M9InN0MCIgY3g9IjQwIiBjeT0iNTYiIHI9IjYiLz4NCgk8Y2lyY2xlIGNsYXNzPSJzdDAiIGN4PSI1NiIgY3k9IjU2IiByPSI2Ii8+DQo8L2c+DQo8L3N2Zz4NCg==";return function(){function t(e){var i=e.features;_classCallCheck(this,t),i&&(this.dashboard=i.API,this.toast={},i.ContentActions.registerProvider("pin",this.getAPI()),this._icons=i.Icons)}return t.prototype.getAPI=function(){return this._api||(this._api=a.createAPI(this,[s])),this._api},t.prototype.getLifeCycleHandlers=function(){return[{name:"post:dashboard.initialize",action:this.postDashboardInitialize.bind(this)}]},t.prototype.postDashboardInitialize=function(){return this.controller=this.dashboard.getFeature("InteractionController.internal"),this.specHelper=new o(this.controller),Promise.resolve()},t.prototype._isEnabled=function(t){return t.length&&this._isSupportedVisualizations(t)&&this.dashboard.getMode()!==this.dashboard.MODES.EDIT_GROUP&&n.hasCapability(this.dashboard,"canAuthorDashboard")},t.prototype._isSupportedVisualizations=function(t){for(var e=0;e<t.length;e++)if(this._isNotSupportedVisualization(t[e]))return!1;return!0},t.prototype._isNotSupportedVisualization=function(t){var e=this.dashboard.getCanvas().getContent(t);if(!e)return!1;var i=e.getFeature("Visualization");return"widget.live"===e.getType()&&i&&"com.ibm.vis.schematicsPreview"===i.getDefinition().getId()},t.prototype.getContentActionList=function(t){return this._isEnabled(t)?[{name:"pin",label:i.get("toolbarActionPinOld"),icon:this._icons.getIcon("pin").id,type:"Button",actions:{apply:this.pinItems.bind(this)}}]:[]},t.prototype.pinItems=function(){var t=this;return new Promise((function(o,n){var a=d.uniqueId("pinToast"),s=new e({noCancelBtn:!0,onShown:function(e){var a=[],s=t.controller.boardModel.name,d=t._createPath();return t.specHelper.getContents(!0).forEach((function(e){var i={source:"authoredview",sourceName:s,sourceUri:d+"?embed=ba1",sourceInstanceId:d,contentType:"boardFragment",content:e};if(t._shouldUsePlaceholder(e.widgets))i.thumbUri=t._getPlaceholder(e.widgets),t._pinItem(i);else{var o="group"===e.layout.type,n=r("#"+e.layout.id)[0],l=n;o||(l=r(l).find(".widgetContentWrapper")[0]);var h={widget:n,content:l},u={};t._prepareNodeStylesForThumbnail(h,u),a.push(t._createThumbnail(l).then((function(e){i.thumbUri=e,t._restoreStylesAfterThumbnail(h,u)}),(function(e){t.dashboard.getGlassCoreSvc(".Logger").error(e)})).then(t._pinItem.bind(t,i)))}})),Promise.all(a).then((function(){t.toast[e].setComplete(100,{duration:0,completeMsg:i.get("pinAddedToast"),isComplete:!0}),o()})).catch((function(){t.toast[e].fail(i.get("contentPinFailOld")),n()})).finally((function(){t.toast[e].remove(),t.toast[e]=null}))}.bind(t,a)});s.show(i.get("pinningToast")),s.indefinite(i.get("pinningToast")),t.toast[a]=s}))},t.prototype._createPath=function(){return(this.controller.gatewayUrl?this.controller.gatewayUrl:"")+"/board/"+this.controller.boardModel.id},t.prototype._shouldUsePlaceholder=function(t){return 1===t.length&&t[0].mapping&&t[0].mapping[0]&&t[0].mapping[0].graphic},t.prototype._getPlaceholder=function(t){var e;return 1===t.length&&t[0].mapping&&t[0].mapping[0]&&t[0].mapping[0].graphic&&(e=l),e},t.prototype._pinItem=function(t){return this.dashboard.getGlassSvc(".DashboardPinning").then((function(e){return e.addPin(t)}))},t.prototype._prepareNodeStylesForThumbnail=function(t,e){if(t.widget!==t.content){e.widget=t.widget.getAttribute("style")||"",e.content=t.content.getAttribute("style")||"";var i=[],o=[];e.widget.split(";").forEach((function(t){switch(t.split(":")[0].trim()){case"width":case"height":case"top":case"left":i.push(t);break;default:o.push(t)}})),t.widget.setAttribute("style",i.join(";")),t.content.setAttribute("style",e.content+";"+o.join(";"))}r(t.widget).addClass("pinThumbnail")},t.prototype._createThumbnail=function(t){return this.dashboard.getDashboardSvc(".Thumbnail").then((function(e){return e.generateImage(t)}))},t.prototype._restoreStylesAfterThumbnail=function(t,e){t.widget!==t.content&&(t.widget.setAttribute("style",e.widget),t.content.setAttribute("style",e.content)),r(t.widget).removeClass("pinThumbnail")},t}()})),define("dashboard-core/js/features/dashboard/actions/editTitleAction/EditTitleAction",["../../../../app/nls/StringResources","../../../../dashboard/util/ContentRegistryUtil","../../../../lib/@waca/dashboard-common/dist/ui/interaction/Utils","../../../../lib/@waca/dashboard-common/dist/core/APIFactory","../../../../lib/@waca/dashboard-common/dist/api/ContentActionsProviderAPI"],(function(t,e,i,o,n){return function(){function r(t){var e=t.features;_classCallCheck(this,r),e&&(this.dashboard=e.API,e.ContentActions.registerProvider("editTitle",this.getAPI()),this._icons=e.Icons)}return r.prototype.getAPI=function(){return this._api||(this._api=o.createAPI(this,[n])),this._api},r.prototype.getLifeCycleHandlers=function(){return[{name:"post:dashboard.initialize",action:this.postDashboardInitialize.bind(this)}]},r.prototype.postDashboardInitialize=function(){return this.controller=this.dashboard.getFeature("InteractionController.internal"),Promise.resolve()},r.prototype.destroy=function(){this.dashboard=null,this.controller=null},r.prototype.getNodes=function(t){return i.getNodes(this.controller,t)},r.prototype.isEnabled=function(t){if(1===t.length){this.content=this.dashboard.getCanvas().getContent(t[0]);var i=e.getCapabilities(this.content),o=void 0;if(i)o=i.getCapabilities().title;else o=this.getNodes(t)[0]._layout.supportsTitle;var n=this.dashboard.getMode()===this.dashboard.MODES.EDIT,r=(this.dashboard.getAppConfig("interactions")||{}).editTitle,a=void 0===r||!0===r||"true"===r,s=this.content&&this.content.getFeature("state"),d=Boolean(s&&!!s.getError());return o&&a&&n&&!d}return!1},r.prototype.getContentActionList=function(e){return this.isEnabled(e)?[{name:"editTitle",label:t.get("toolbarActionEditTitle"),icon:this._icons.getIcon("text-creation").id,type:"Button",actions:{apply:this.editTitle.bind(this,e)}}]:[]},r.prototype.editTitle=function(t){if(this.dashboard){var e=this.dashboard.getGlassCoreSvc(".FeatureChecker");if(e){var i=!e.checkValue("dashboard","SmartTitle","disabled"),o=this.dashboard.getCanvas().getContent(t[0]);if(i)if("noTitle"===o.getPropertyValue("titleMode"))o.setPropertyValue("titleMode","customTitle");else{var n=o.getFeature("WidgetTitleTruncate");n&&n.highlightTitle()}else o.setPropertyValue("showTitle",!1),o.setPropertyValue("showTitle",!0)}}},r.prototype.wrapTitle=function(t){var e=this.dashboard.getCanvas().getContent(t[0]).getPropertyValue("truncateTitle");this.dashboard.getCanvas().getContent(t[0]).setPropertyValue("truncateTitle",!e),this.dashboard.getCanvas().getContent(t[0]).setPropertyValue("titleMode","customTitle")},r}()})),define("dashboard-core/js/features/dashboard/actions/eventGroups/EventGroupActions",["../../../../lib/@waca/dashboard-common/dist/core/APIFactory","../../../../lib/@waca/dashboard-common/dist/api/ContentActionsProviderAPI","underscore"],(function(t,e,i){return function(){function o(t){var e=t.features;_classCallCheck(this,o),e&&(this.dashboard=e.API,this.eventGroups=e.EventGroups)}return o.prototype.getAPI=function(){return this._api||(this._api=t.createAPI(this,[e])),this._api},o.prototype._isAvailable=function(t){return t.length&&this.dashboard.getMode()===this.dashboard.MODES.EDIT_GROUP&&!this._isStaticWidget(t)},o.prototype._isStaticWidget=function(t){for(var e=0;e<t.length;e++)if(!this.eventGroups.getGroupId(t[e]))return!0;return!1},o.prototype._getDistinctGroupIdsInSelection=function(t){var e=this,o=i.map(t,(function(t){return e.eventGroups.getGroupId(t)}));return o=i.uniq(o)},o.prototype._getPageId=function(t){if(t.length>0){for(var e=this.dashboard.getCanvas().getContent(t[0]);e&&"page"!==e.getType();)e=e.getContainer();if(e)return e.getId()}return!1},o.prototype._getCountGroupsAffected=function(t){var e=this,o=0,n=this.eventGroups.getGroupIdsOnPage(this._getPageId(t));return n.length>0&&t.length>0&&(o=i.filter(n,(function(o){var n=e.eventGroups.getContentIdList(o);return n.length===i.intersection(n,t).length})).length),o},o.prototype.getNumberOfGroups=function(t){var e=this._getPageId(t);return e?this.eventGroups.getGroupIdsOnPage(e).length:0},o}()})),define("dashboard-core/js/features/dashboard/actions/eventGroups/DisconnectEventGroupAction",["./EventGroupActions","../../../../app/nls/StringResources","underscore"],(function(t,e,i){return function(t){function o(e){var i=e.features;_classCallCheck(this,o);var n=_possibleConstructorReturn(this,t.call(this,{features:i}));return i&&(i.ContentActions.registerProvider("disconnectFilterGroup",n.getAPI()),n._icons=i.Icons),n}return _inherits(o,t),o.prototype.getContentActionList=function(t){return this._isAvailable(t)?[{name:"disconnectFilterGroup",label:e.get("toolbarActionDisconnectFilterGroup"),icon:this._icons.getIcon("unlink").id,type:"Button",order:1,actions:{apply:this.execute.bind(this,t)},disabled:this.isDisabled.bind(this,t),update:!0}]:[]},o.prototype.execute=function(t){this.eventGroups.removeFromGroup(t,i.uniqueId("_disconnectFromGroup_"))},o.prototype.isDisabled=function(t){var e=this;if(this._isStaticWidget(t))return!0;if(!(this.eventGroups.getGroupIdsOnPage(this._getPageId(t)).length>0))return!0;var o=this._getCountGroupsAffected(t);return this.getNumberOfGroups(t)+t.length-o>5||0===i.filter(t,(function(t){var i=e.eventGroups.getGroupId(t);return e.eventGroups.getContentIdList(i).length>1})).length},o}(t)})),define("dashboard-core/js/features/dashboard/actions/eventGroups/LinkEventGroupAction",["./EventGroupActions","../../../../app/nls/StringResources"],(function(t,e){return function(t){function i(e){var o=e.features;_classCallCheck(this,i);var n=_possibleConstructorReturn(this,t.call(this,{features:o}));return o&&(o.ContentActions.registerProvider("linkFilterGroup",n.getAPI()),n._icons=o.Icons),n}return _inherits(i,t),i.prototype.getContentActionList=function(t){return this._isAvailable(t)?[{name:"linkFilterGroup",label:e.get("toolbarActionLinkFilterGroup"),icon:this._icons.getIcon("link").id,type:"NextView",order:2,disabled:this.isDisabled.bind(this,t),viewModule:"dashboard-core/js/app/ui/dialogs/FilterGroupsDialog",viewOptions:{height:140,width:180,labels:!1,idList:t,controller:this},update:!0}]:[]},i.prototype.isDisabled=function(t){return!!this._isStaticWidget(t)||this.getNumberOfGroups(t)<2},i.prototype.getGroups=function(t){if(this._isStaticWidget(t))return[];var e=this._getPageId(t),i=this.eventGroups.getGroupIdsOnPage(e),o=this._getDistinctGroupIdsInSelection(t);return 1===o.length?i=i.filter((function(t){return t!==o[0]})):i},i}(t)})),define("dashboard-core/js/features/dashboard/actions/eventGroups/CreateEventGroupAction",["./EventGroupActions","../../../../app/nls/StringResources","underscore"],(function(t,e,i){return function(t){function o(e){var i=e.features;_classCallCheck(this,o);var n=_possibleConstructorReturn(this,t.call(this,{features:i}));return i&&(i.ContentActions.registerProvider("createFilterGroup",n.getAPI()),n._icons=i.Icons),n}return _inherits(o,t),o.prototype.getContentActionList=function(t){return this._isAvailable(t)?[{name:"createFilterGroup",label:e.get("toolbarActionCreateFilterGroup"),icon:this._icons.getIcon("new-link").id,actions:{apply:this.execute.bind(this,t)},disabled:this.isDisabled.bind(this,t),type:"Button",order:3,update:!0}]:[]},o.prototype.execute=function(t){this.eventGroups.createGroup(t,i.uniqueId("_createGroup_"))},o.prototype.isDisabled=function(t){if(this._isStaticWidget(t))return!0;var e=this._getDistinctGroupIdsInSelection(t),i=this.eventGroups.getContentIdList(e[0]).length;if(1===e.length&&t.length===i)return!0;var o=this._getCountGroupsAffected(t);return this.getNumberOfGroups(t)-o+1>5},o}(t)})),define("dashboard-core/js/features/dashboard/actions/api/ContentActionsAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.registerProvider=function(){},t.prototype.getContentActionList=function(){},t}()})),define("dashboard-core/js/features/dashboard/actions/ContentActions",["../../../lib/@waca/dashboard-common/dist/core/APIFactory","./api/ContentActionsAPI"],(function(t,e){return function(){function i(){_classCallCheck(this,i),this.api=t.createAPI(this,[e]),this.providers={}}return i.prototype.registerProvider=function(t,e){this.providers[t]=e},i.prototype.getContentActionList=function(t){var e=[];return Object.values(this.providers).forEach((function(i){if(i.getContentActionList&&"function"==typeof i.getContentActionList){var o=null;try{o=i.getContentActionList(t)}catch(t){console.log(t)}o&&e.push.apply(e,o)}})),e},i.prototype.getAPI=function(){return this.api},i}()})),define("dashboard-core/js/features/dashboard/dnD/api/CanvasDnDAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.registerProvider=function(){},t.prototype.accepts=function(){},t.prototype.onDrop=function(){},t}()})),define("dashboard-core/js/features/dashboard/dnD/api/impl/CanvasDnD",["../CanvasDnDAPI","../../../../../lib/@waca/dashboard-common/dist/core/APIFactory"],(function(t,e){var i=["pin","widget"];return function(){function o(){_classCallCheck(this,o),this._api=e.createAPI(this,[t]),this.providers=[]}return o.prototype.destroy=function(){this.api=null,this.providers=[]},o.prototype.getAPI=function(){return this._api},o.prototype.registerProvider=function(t){var e=this.providers.find((function(e){return e.getImplType()===t.getImplType()}));null==e&&this.providers.push(t)},o.prototype.accepts=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1],i=this._getSupportedTypes(e);if(-1!==i.indexOf(t.type))return!0;var o=this.providers.find((function(i){return i.accepts(t,e)}));return!!o},o.prototype.onDrop=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.data&&"new"===t.data.operation)return Promise.resolve(t.data.model);var e=Promise.resolve();return this.providers.forEach((function(i){e=e.then((function(e){return e||i.onDrop(t)}))})),e},o.prototype._getSupportedTypes=function(t){if(t&&t.fromMultipurposeWidget)return[];var e=[].concat(i);return t&&t.fromCanvas&&e.push("groupContent"),e},o}()})),define("dashboard-core/js/features/dashboard/eventGroups/api/EventGroupsAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.groupExists=function(){},t.prototype.getGroupId=function(){},t.prototype.getGroupIdsOnPage=function(){},t.prototype.getContentIdList=function(){},t.prototype.addToGroup=function(){},t.prototype.createGroup=function(){},t.prototype.removeFromGroup=function(){},t}()})),define("dashboard-core/js/features/dashboard/eventGroups/EventGroups",["underscore","../../../lib/@waca/dashboard-common/dist/core/APIFactory","../../../lib/@waca/dashboard-common/dist/api/ContentActionsProviderAPI","../../../api/DashboardAPI","./api/EventGroupsAPI","../../../lib/@waca/dashboard-common/dist/utils/ContentUtil","../../../app/nls/StringResources"],(function(t,e,i,o,n,r,a){return function(){function o(t){var r=t.features;_classCallCheck(this,o),this.dashboard=r.API,this._dashboardState=r.DashboardState,this._api=e.createAPI(this,[n,i]),r.ContentActions.registerProvider("EventGroups",this.getAPI()),this._icons=r.Icons}return o.prototype.getAPI=function(){return this._api},o.prototype.initialize=function(){var t=this;return this.dashboard.getCanvasWhenReady().then((function(e){t.dashboard&&(t.canvas=e,t.canvas.on("move:content",t.onMoveContent,t))})),Promise.resolve()},o.prototype.onMoveContent=function(e){var i=this,o=r.getPageContent(this.canvas.getContent(e.info.containerId)).getId(),n=this.createDefaultGroupId(o),a=this._getBoardModel().eventGroups,s=t.pluck(a.getGroupsOnPage(o),"id");e.info.contentIdList.forEach((function(t){var o=[],r=i.canvas.getContent(t).findContent("type:widget");r.length?r.forEach((function(t){var e=t.getId(),i=a.findGroup(e);s.length&&i?-1!==s.findIndex((function(t){return t!==i.id}))&&o.push(e):o.push(e)})):o.push(t),i.addToGroup(n,o,e.transactionToken)}))},o.prototype.destroy=function(){this.canvas&&this.canvas.off("move:content",this.onMoveContent,this),this.dashboard=null,this._dashboardState=null,this._api=null},o.prototype.groupExists=function(t){return!!this._getBoardModel().eventGroups.get(t)},o.prototype.getGroupId=function(t){var e=this._getBoardModel().eventGroups.findGroup(t);return e?e.getId():null},o.prototype.getGroupIdsOnPage=function(t){var e=this._getBoardModel().eventGroups.getGroupsOnPage(t),i=[];return e&&e.length&&e.forEach((function(t){i.push(t.id)})),i},o.prototype.getContentIdList=function(t){var e=this._getBoardModel().eventGroups.get(t);if(e&&e.widgetIds)return JSON.parse(JSON.stringify(e.widgetIds))},o.prototype.addToGroup=function(t,e,i){var o=this._getBoardModel().eventGroups,n=this.dashboard.getFeature("Transaction"),r=n.startTransaction(i),a={payloadData:{undoRedoTransactionId:r.transactionId,transactionToken:r}};this.groupExists(t)?o.addToGroup(t,e,a):(a.targetPageId=t.slice(0,t.indexOf(":")),o.createGroup(e,a)),n.endTransaction(r)},o.prototype.createGroup=function(t,e){var i=this._getBoardModel().eventGroups,o=this.dashboard.getFeature("Transaction"),n=o.startTransaction(e),r={payloadData:{undoRedoTransactionId:n.transactionId,transactionToken:n}},a=i.createGroup(t,r);return o.endTransaction(n),a},o.prototype.removeFromGroup=function(t,e){var i=this._getBoardModel().eventGroups,o=this.dashboard.getFeature("Transaction"),n=o.startTransaction(e),r={payloadData:{undoRedoTransactionId:n.transactionId,transactionToken:n}},a=i.disconnectFromGroup(t,r);return o.endTransaction(n),a},o.prototype._getBoardModel=function(){return this.dashboard.getFeature("internal").getBoardModel()},o.prototype.createDefaultGroupId=function(t){return this._getBoardModel().eventGroups.createDefaultGroupId(t)},o.prototype.getContentActionList=function(t){var e=this,i=this._dashboardState.getUiState();return t.length>0||!1===i.authoring?[]:[{name:"EventGroups",type:"ToggleButton",baseClass:"toolbar",order:1,checked:i.eventGroups,disabled:i.focus,label:a.get("eventGroupButtonLabel"),icon:this._icons.getIcon("connect").id,action:function(){return e._dashboardState.setEventGroups(!0)},offAction:function(){return e._dashboardState.setEventGroups(!1)}}]},o}()})),define("dashboard-core/js/features/dashboard/convertToTemplate/api/ConvertToTemplateAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.convertToTemplate=function(){},t}()})),define("text!dashboard-core/js/dashboard/schema/templateSchemaMappings.json",[],(function(){return'{\n "copyright": "Licensed Materials - Property of IBM. IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2019. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.",\n "version": "versionSchema.json",\n "name": "nameSchema.json",\n "layout": "layoutSchema.json",\n "theme": "themeSchema.json",\n "specVersion": "versionSchema.json",\n "eventGroups": "eventGroupsSchema.json",\n\t "properties": "propertiesSchema.json"\n}\n'})),define("dashboard-core/js/features/dashboard/convertToTemplate/ConvertToTemplate",["./api/ConvertToTemplateAPI","@waca/dashboard-common/js/core/APIFactory","text!../../../../../dashboard/schema/schemaDefs.json","text!../../../../../dashboard/schema/templateSchemaMappings.json","text!../../../../../dashboard/schema/nameSchema.json","text!../../../../../dashboard/schema/layoutSchema.json","text!../../../../../dashboard/schema/themeSchema.json","text!../../../../../dashboard/schema/versionSchema.json","text!../../../../../dashboard/schema/eventGroupsSchema.json","text!../../../../../dashboard/schema/propertiesSchema.json","text!../../../../../dashboard/schema/widgetsTemplateSchema.json"],(function(t,e,i,o,n,r,a,s,d,l,h){return function(){function u(t){var e=t.features;_classCallCheck(this,u),this.dashboard=e.API,this._featureChecker=this.dashboard.getGlassCoreSvc(".FeatureChecker")}return u.prototype.getAPI=function(){return!this._featureChecker.checkValue("dashboard","dashboardTemplates","disabled")||this._api||(this._api={convertToTemplate:function(){return Promise.resolve()}}),this._api||(this._api=e.createAPI(this,[t])),this._api},u.prototype.convertToTemplate=function(t){var e=this;return t&&Object.keys(t).length?this._getAjv().then((function(i){var o=e._getSchemaMappings(),n={},r=Object.keys(t),a=Array.isArray(r),s=0;for(r=a?r:r[Symbol.iterator]();;){var d;if(a){if(s>=r.length)break;d=r[s++]}else{if((s=r.next()).done)break;d=s.value}var l=d,h=o[l];if(h){var u=t[l],c=i.getSchema(h);c&&(c(u),"layout"!==l||Array.isArray(u)||e._lockVisualizationType(u.items),n[l]=u)}}return n})):Promise.resolve(null)},u.prototype._lockVisualizationType=function(t){for(var e=0;e<t.length;e++){var i=t[e];i.items&&this._lockVisualizationType(i.items),"widget"===i.type&&i.features&&i.features.Models_internal&&"live"===i.features.Models_internal.type&&(i.features.Models_internal.visTypeLocked=!0)}},u.prototype._getSchemaMappings=function(){return this.schemaMappings||(this.schemaMappings=JSON.parse(o)),this.schemaMappings},u.prototype._getAjv=function(){var t=this;return this.ajv?Promise.resolve(this.ajv):new Promise((function(e,o){require(["ajv"],(function(u){try{t.ajv=new u({verbose:!0,allErrors:!0,removeAdditional:"all",schemas:[JSON.parse(i),JSON.parse(n),JSON.parse(r),JSON.parse(a),JSON.parse(s),JSON.parse(d),JSON.parse(l),JSON.parse(h)]}),e(t.ajv)}catch(t){o(t)}}),o)}))},u}()})),define("dashboard-core/js/features/dashboard/csvExport/api/CsvExportAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.export=function(){},t}()})),define("dashboard-core/js/features/dashboard/csvExport/CsvExport",["../../../lib/@waca/dashboard-common/dist/core/APIFactory","./api/CsvExportAPI"],(function(t,e){return function(){function i(o){_classCallCheck(this,i),this.dashboard=o,this.api=t.createAPI(this,[e])}return i.prototype.destroy=function(){this.dashboard=null},i.prototype.getAPI=function(){return this.api},i.prototype._toCSV=function(t){if(Array.isArray(t)){var e=function(t){var e=t;return isNaN(e)&&-1!==(e=e.toString().trim()).indexOf(",")&&(e='"'+e.replace(/"/g,'""')+'"'),e};return t.map((function(t){return t.map?t.map(e).join(","):e(t)})).join("\n")+"\n"}throw new Error("The export data must be an array")},i.prototype.export=function(t){if("string"!=typeof t)throw new Error("The filename must be a string");for(var e=this._getWindow(),i=arguments.length,o=Array(i>1?i-1:0),n=1;n<i;n++)o[n-1]=arguments[n];var r=o.map(this._toCSV.bind(this)),a=t+".csv",s=new Blob(r,{type:"text/csv"});if(!t)throw new Error("Invalid filename");var d=this._createAnchor(e);if(void 0!==d.download){var l=e.URL.createObjectURL(s);return d.setAttribute("href",l),d.setAttribute("download",a),d.style.display="none",e.document.body.appendChild(d),d.click(),e.document.body.removeChild(d),setTimeout(e.URL.revokeObjectURL.bind(this,l),5e3),s}if(e.navigator&&e.navigator.msSaveBlob)return e.navigator.msSaveBlob(s,a),s;throw new Error("This browser does not support the ability to export")},i.prototype._getWindow=function(){return window},i.prototype._createAnchor=function(t){return t.document.createElement("a")},i}()})),define("dashboard-core/js/features/dashboard/properties/PropertiesPaneAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.getProviderId=function(){},t}()})),define("dashboard-core/js/features/dashboard/properties/PropertiesPane",["../../../lib/@waca/dashboard-common/dist/core/APIFactory","./PropertiesPaneAPI","../../../app/nls/StringResources","../../../app/util/ErrorUtils"],(function(t,e,i,o){return function(){function n(t){var e=t.features;_classCallCheck(this,n),this._dashboardApi=e.API,this._slideout=e.InAppSlideoutState,this._dashboardState=e.DashboardState,this._icons=e.Icons,this._api=null}return n.prototype.getAPI=function(){return this._api},n.prototype.getProviderId=function(){return"PropertiesPane"},n.prototype.initialize=function(){var n=this;this._api=t.createAPI(this,[e]);var r=this._dashboardState.getUiState();this._slideout.registerContribution(this.getProviderId(),{name:"properties",label:i.get("commonPropertiesLabel"),icon:this._icons.getIcon("configure").id,type:"Button",order:5,text:i.get("commonPropertiesLabel"),className:"buttonWithText",disabled:function(){return r.eventGroups},isEnabled:function(t){return!(t.length>0)&&(o.hasCapability(n._dashboardApi,"canAuthorDashboard")&&r.authoring)}})},n.prototype.destroy=function(){this._dashboardApi=null,this._api=null},n}()})),define("dashboard-core/js/features/dashboard/properties/PropertiesPaneDOMAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.render=function(){},t.prototype.getPropertiesView=function(){},t.prototype.getProviderId=function(){},t.prototype.getRenderNode=function(){},t.prototype.close=function(){},t}()})),define("dashboard-core/js/features/dashboard/properties/PropertiesPaneDOM",["../../../lib/@waca/dashboard-common/dist/core/APIFactory","underscore","./PropertiesPaneDOMAPI"],(function(t,e,i){return function(){function e(t){var i=t.features;_classCallCheck(this,e),this._dashboard=i.API,this._properties=i.PropertiesPane,this._slideout=i.InAppSlideoutDOM,this._api=null}return e.prototype.getAPI=function(){return this._api},e.prototype.getProviderId=function(){return this._properties.getProviderId()},e.prototype.initialize=function(){this._api=t.createAPI(this,[i]),this._slideout.registerView(this._properties.getProviderId(),this._api)},e.prototype.getPropertiesView=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._renderNode=t.parentNode;var e=void 0,i=this._dashboard.getFeature("propertiesManager");if(t.isChild)e=i.updateChildPropertiesView(t);else{var o=this._getSelectedContentIds(),n=void 0;o&&o.length>0&&(n=o[0]),e=i.getPropertiesView(n)}return e},e.prototype._getSelectedContentIds=function(){return this._dashboard.getCanvas().getSelectedContentList().map((function(t){return t.getId()}))},e.prototype.getRenderNode=function(){return this._renderNode},e.prototype.render=function(t){var e=this._dashboard.getFeature("propertiesManager").getMostRecentChildOptions(t);return this.getPropertiesView(e).then((function(t){return e&&e.childPanelId&&(t.$el.get(0).dataset.childPanelId=e.childPanelId),t.$el.get(0)}))},e.prototype.close=function(){var t=this._dashboard.getFeature("propertiesManager");t&&t.closeAllChild(),this._renderNode=null},e.prototype.destroy=function(){this.close(),this._api=null,this._dashboard=null,this._properties=null,this._slideout=null},e}()})),define("dashboard-core/js/features/dashboard/inAppSlideout/InAppSlideoutStateAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.registerContribution=function(){},t.prototype.removeContribution=function(){},t.prototype.getContributions=function(){},t.prototype.getContribution=function(){},t.prototype.getCurrent=function(){},t.prototype.getUiState=function(){},t.prototype.onStateChange=function(){},t.prototype.isOpen=function(){},t.prototype.open=function(){},t.prototype.close=function(){},t}()})),define("dashboard-core/js/features/dashboard/inAppSlideout/InAppSlideoutState",["../../../lib/@waca/dashboard-common/dist/core/APIFactory","./InAppSlideoutStateAPI"],(function(t,e){function i(t){return JSON.parse(JSON.stringify(t))}return function(){function o(t){var e=t.features;_classCallCheck(this,o),this._dashboardApi=e.API,this._dashboardState=e.DashboardState,this._contentActions=e.ContentActions,this._contributions={items:[]},this._stateListeners=[],this._previousDashboardState=i(this._dashboardState.getUiState()),this._dashboardStateIgnoreList=["dirty"]}return o.prototype.getAPI=function(){return this._api},o.prototype.initialize=function(){this._api=t.createAPI(this,[e]),this._dashboardState.onUiStateChange(this._onUiStateChange.bind(this)),this._updateContributionSelections()},o.prototype.getUiState=function(){return this._dashboardState.getUiState().sidePanel},o.prototype._filterCaredDashboardState=function(t){var e=this;return JSON.stringify(t,(function(t,i){return-1!==e._dashboardStateIgnoreList.indexOf(t)?void 0:i}))},o.prototype._onUiStateChange=function(t){this._filterCaredDashboardState(t)!==this._filterCaredDashboardState(this._previousDashboardState)&&(this._updateContributionSelections(t.sidePanel),this._stateListeners.forEach((function(e){return e(t)}))),this._previousDashboardState=i(t)},o.prototype._updateContributionSelections=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getUiState();this._contributions.items.forEach((function(e){var i=e.contribution,o=e.id;i.selected=t.current===o}))},o.prototype.registerContribution=function(t,e){if(this.getContribution(t))throw new Error('Contribution with id "'+t+'" is already registered');e=this._populateContentContribution(t,e),this._registerContentContribution(t,e),this._contributions.items.push({id:t,contribution:e}),this._updateContributionSelections()},o.prototype._populateContentContribution=function(t,e){var i=this,o=function(){var e=i.getUiState();if(e.current===t){var o=!e.isOpen;i._dashboardState.setSidePanelOpen(o),o||i._dashboardState.setSidePanelCurrentView(null)}else i._dashboardState.setSidePanelCurrentView(t),e.isOpen||i.open()};return _extends({},e,{checked:this.getUiState().isOpen,action:o,offAction:o,selected:!1})},o.prototype._registerContentContribution=function(t,e){this._contentActions.registerProvider(t,{getContentActionList:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=[];return e.isEnabled(t)&&i.push(e),i}})},o.prototype.onStateChange=function(t){var e=this,i=this._stateListeners.push(t)-1;return function(){e._stateListeners.splice(i,1)}},o.prototype.removeContribution=function(t){var e=this._contributions.items.findIndex((function(e){return e.id===t}));if(-1===e)throw new Error('Contribution with id "'+t+'" does not exist');this._contributions.items.splice(e,1)},o.prototype.getContribution=function(t){return this._contributions.items.find((function(e){return e.id===t}))},o.prototype.getContributions=function(){return this._contributions.items},o.prototype.getCurrent=function(){var t=this.getUiState().current;return this.getContribution(t)},o.prototype.isOpen=function(){return this._dashboardState.getUiState().sidePanel.isOpen},o.prototype.open=function(){this._dashboardState.setSidePanelOpen(!0)},o.prototype.close=function(){this._dashboardState.setSidePanelOpen(!1),this._dashboardState.setSidePanelCurrentView(null)},o.prototype.destroy=function(){this._dashboardApi=null,this._api=null},o}()})),define("dashboard-core/js/features/dashboard/inAppSlideout/InAppSlideoutDOMAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.render=function(){},t.prototype.registerView=function(){},t.prototype.removeView=function(){},t.prototype.getViews=function(){},t.prototype.getView=function(){},t.prototype.onDomStateChange=function(){},t}()})),define("dashboard-core/js/features/dashboard/inAppSlideout/InAppSlideoutContainer",["react","ca-ui-toolkit","prop-types","jquery"],(function(t,e,i,o){var n=e.Container,r=e.Slideout,a=function(t,e){return t.dataset.contributionId===e},s=function(e){function i(o){_classCallCheck(this,i);var n=_possibleConstructorReturn(this,e.call(this,o));return n.contentRef=t.createRef(),n}return _inherits(i,e),i.prototype.componentDidMount=function(){this._updateInAppSlideout()},i.prototype.componentWillUnmount=function(){this._onComponentMountedChange(!1)},i.prototype.componentDidUpdate=function(){this._updateInAppSlideout()},i.prototype._getContainerNode=function(){var t=this.props.contribution.getProviderId(),e=this.contentRef.current;if(e){var i=function(t,e){return Array.from(t.childNodes).find((function(t){return a(t,e)}))}(e,t);return i||(i=function(t){var e=document.createElement("div");return e.dataset.contributionId=t,e.setAttribute("class","slideout__contributions__item"),e.style.overflow="auto",e}(t),e.appendChild(i)),i}},i.prototype._clearContainerNode=function(){var t=this._getContainerNode();t&&(t.innerHTML="")},i.prototype._updateInAppSlideout=function(){var t=this,e=this.props,i=e.contribution,o=e.options;if(i){var n=i.getProviderId();!function(t,e){Array.from(t.childNodes).forEach((function(t){t.style.display=a(t,e)?"":"none"}))}(this.contentRef.current,n);var r=this._getContainerNode();r&&i.render(_extends({},o,{parentNode:r})).then((function(e){if(e){var i=e.dataset.childPanelId;o.isChild||i?t._updateChildView(e,o):t._updateParentView(e),t._onComponentMountedChange(!0)}}))}},i.prototype._updateChildView=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.props.active;if(i){var n=this._getContainerNode(),r=n.firstElementChild;r&&(n.childNodes.length>1?e.refreshChild&&(o(r).remove(),r=n.firstElementChild):r.style.display="none",n.insertBefore(t,r),n.childNodes[0].focus())}},i.prototype._updateParentView=function(t){if(this.props.active){this._clearContainerNode();var e=this._getContainerNode();e&&(e.insertBefore(t,e.firstElementChild),e.childNodes[0].focus())}},i.prototype._onComponentMountedChange=function(t){var e=this.props,i=e.onDomStateChange,o=e.contribution;o&&o.getProviderId&&i&&i({type:t?"mounted":"unmounted",current:o.getProviderId()})},i.prototype.render=function(){var e=this.props.active;return t.createElement(n,{relative:!0,height:"100%",width:"100%"},t.createElement(r,{animationOnRender:!0,toDirection:"",active:e,width:"100%",style:{borderLeft:"1px solid #eaeaea",borderTop:"1px solid #eaeaea"}},t.createElement("div",{ref:this.contentRef,className:"slideout__contributions"})))},i}(t.Component);return s.propTypes={active:i.bool,contribution:i.object.isRequired,options:i.object,onDomStateChange:i.func},s.defaultProps={active:!1,options:{},onDomStateChange:function(){}},s})),define("dashboard-core/js/features/dashboard/inAppSlideout/InAppSlideoutDOM",["react","react-dom","../../../lib/@waca/dashboard-common/dist/core/APIFactory","./InAppSlideoutDOMAPI","./InAppSlideoutContainer","jquery"],(function(t,e,i,o,n,r){return function(){function a(t){_classCallCheck(this,a),this._slideout=t.features.InAppSlideoutState,this._api=null,this._root=null,this._currentView=null,this._views=[],this._domListeners=[],this._features=t.features}return a.prototype.getAPI=function(){return this._api},a.prototype.initialize=function(){this._api=i.createAPI(this,[o]),this._slideout.onStateChange(this._onSlideoutStateChange.bind(this))},a.prototype._onSlideoutStateChange=function(){var t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=i.sidePanel;if(this._shouldRenderSlideout(i))this.render();else if(!o.isOpen&&o.current&&this._root){var n=this.getView(o.current),r=n.instance;r.close&&r.close();var a={width:"0px"};return this._doAnimation(a,(function(){t._unmountContribution(),t._root&&e.unmountComponentAtNode(t._root),t._dashboardFrameRight&&t._root&&t._dashboardFrameRight.removeChild(t._root),t._root=null,t._triggerResizeEvent()}))}},a.prototype._doAnimation=function(t,e){return r(this._root).animate(t,"fast",e)},a.prototype._unmountContribution=function(){this._currentView&&this._currentView.unmount&&(this._currentView.unmount&&this._currentView.unmount(),this._currentView.close&&this._currentView.close()),this._currentView=null},a.prototype._triggerResizeEvent=function(){var t=document.createEvent("HTMLEvents");t.initEvent("resize",!1,!0),window.dispatchEvent(t)},a.prototype.registerView=function(t,e){if(this.getView(t))throw new Error('View with id "'+t+'" is already registered');this._views.push({id:t,instance:e})},a.prototype.removeView=function(t){var e=this._views.findIndex((function(e){return e.id===t}));if(-1===e)throw new Error('View with id "'+t+'" does not exist');this._views.splice(e,1)},a.prototype.getView=function(t){return this._views.find((function(e){return e.id===t}))},a.prototype.getViews=function(){return this._views},a.prototype._setupRenderNode=function(){var t=this;if((!this._root||!this._dashboardFrameRight)&&(this._dashboardFrameRight=r(".dashboardFrameRight:visible")[0],this._dashboardFrameRight)){this._root=document.createElement("div"),this._root.setAttribute("class","dashboardAuthoringToolsPane"),this._root.setAttribute("style","width: 0px;"),this._dashboardFrameRight.appendChild(this._root);var e=this._features.DashboardSettings.get("panelWidth"),i={width:e||"320px"};this._doAnimation(i,(function(){t._triggerResizeEvent()}))}},a.prototype.render=function(i){var o=this;return this._setupRenderNode(),new Promise((function(r,a){try{var s=o._slideout.getCurrent().id,d=o.getView(s).instance;d?(o._currentView=d,e.render(t.createElement(n,{active:o._slideout.isOpen(),contribution:d,options:i,onDomStateChange:o._onUiDomStateChange.bind(o)}),o._root,(function(){return r()}))):r()}catch(t){a(t)}}))},a.prototype.destroy=function(){this._root&&e.unmountComponentAtNode(this._root),this._dashboardFrameRight&&this._root&&this._dashboardFrameRight.removeChild(this._root),this._root=null,this._api=null,this._currentView=null,this._domListeners.length=0},a.prototype.onDomStateChange=function(t){var e=this,i=this._domListeners.push(t)-1;return function(){e._domListeners.splice(i,1)}},a.prototype._onUiDomStateChange=function(t){this._domListeners&&this._domListeners.forEach((function(e){return e(t)}))},a.prototype._shouldRenderSlideout=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=!this._currentView||this._currentView.getProviderId()!==t.sidePanel.current;return t.sidePanel.isOpen&&(e||t.dirty||t.selectionProperties)},a}()})),define("text!dashboard-core/js/dashboard/views/templates/DataGridView.html",[],(function(){return'<div class="gridTabs"></div>\n<div class="dataGridView"></div>\n'})),define("dashboard-core/js/dashboard/views/datatray/DataGridView",["jquery","doT","underscore","../../../lib/@waca/core-client/js/core-client/ui/core/View","text!../templates/DataGridView.html","../../../app/nls/StringResources","react-dom","../../../lib/@waca/core-client/js/core-client/utils/ClassFactory"],(function(t,e,i,o,n,r,a,s){var d=o.extend({init:function(t){d.inherited("init",this,arguments),this.glassContext=t.services.biGlass.glassContext,this.dashboardApi=t.dashboardApi,this.eventRouter=t.eventRouter,this.services=t.services,this.logger=this.dashboardApi.getGlassCoreSvc(".Logger"),this.dataSourceCollection=this.dashboardApi.getFeature("dataSources.deprecated").getSourcesCollection(),this._registerEvents(),this.gridState={selectedTabId:null,tabs:null},this._loadExtensions(t.appSettings),this._resetReady(),this.renderRequests=[]},_loadExtensions:function(t){var e=this;if(!this._loadExtensionsPromise){var i=[this.dashboardApi,t||{},this.eventRouter],o=this.dashboardApi.findGlassCollection("com.ibm.bi.dashboard.dataTray-extensions");this._loadExtensionsPromise=Promise.resolve(o).then((function(t){var o=[];return e.componentControllers=[],t.forEach((function(t){o.push(s.loadModule(t.class))})),Promise.all(o).then((function(t){t.forEach((function(t){e.componentControllers.push(new(Function.prototype.bind.apply(t,[null].concat(i))))}))}))}))}return this._loadExtensionsPromise},_resetReady:function(){var t=this;this._isReady=!1,this.viewReady=new Promise((function(e){t._readyView=function(){return t._isReady=!0,t._clearRenderQueue().then(e).finally(t._renderReactTabs.bind(t))}}))},_registerEvents:function(){this.registeredEvents=[this.eventRouter.on("dataSourcePanel:dataSourceSelected",this._eventHandler,this),this.eventRouter.on("tab:tabChanged",this._eventHandler,this),this.dashboardApi.getCanvas().on("change:selections",this._eventHandler,this),this.eventRouter.on("dataInVis:selected",this._eventHandler,this),this.dashboardApi.on("widget:rerendered",this._eventHandler,this),this.dashboardApi.on("shapingmodel:changed",this._eventHandler,this),this.dataSourceCollection.on("remove",this._eventHandler,this),this.on("splitterPanel:show",this._eventHandler,this),this.on("splitterPanel:hide",this._eventHandler,this)]},_eventHandler:function(t,e){return"splitterPanel:hide"===e?this._onSplitterHide():("splitterPanel:show"===e&&this._onSplitterShow(),!this.renderRequests.length&&this._isReady?(this.renderRequests.push({event:t,eventName:e}),this._clearRenderQueue().finally(this._renderReactTabs.bind(this))):(this.renderRequests.push({event:t,eventName:e}),Promise.resolve()))},_clearRenderQueue:function(){var t=this;if(!this.renderRequests.length)return Promise.resolve();var e=this.renderRequests[0];return this.renderDataTray(e.event,e.eventName).finally((function(){return t.renderRequests.shift(),t._clearRenderQueue()}))},renderDataTray:function(t,e){var o=this,n=[];return this.componentControllers.forEach((function(i){n.push(i.getTabContrib(t,e,o.gridState.selectedTabId))})),Promise.all(n).then((function(t){if(o.gridState.tabs=i.flatten(i.without(t,null)),!o.gridState.tabs.length)return o.gridState.selectedTabId=null,o._unmountComponents(),Promise.resolve();var e=i.findWhere(o.gridState.tabs,{isSelectedOnTrayRender:!0})||o.gridState.tabs[0];return e.select(o.gridState.selectedTabId,o.gridContainer).finally((function(){return o.gridState.selectedTabId=e.id}))}))},_onSplitterShow:function(){this._readyView()},_onSplitterHide:function(){this._unmountComponents(),this._resetReady()},_unmountComponents:function(){this._tabsContainer&&this.gridContainer&&(this._unmountReactComponents(),t(this._tabsContainer).empty(),t(this.gridContainer).empty())},_unmountReactComponents:function(){this._tabsContainer&&a.unmountComponentAtNode(this._tabsContainer),this.gridContainer&&a.unmountComponentAtNode(this.gridContainer)},getSplitterOpts:function(){var t=this,e=this.dashboardApi.getFeature("Icons");return this.services.getSvc(".StringResources").then((function(i){return{handleClass:"gridHandle",handleIcon:e.getIcon("table").id,hideInConsume:!0,handleOpenTitle:i.get("dataTrayHandleOpenLabel"),handleCloseTitle:i.get("dataTrayHandleCloseLabel"),view:t,initialSize:250}}))},remove:function(){return this._unmountComponents(),this.registeredEvents.length&&(this.registeredEvents.forEach((function(t){t&&t.remove&&t.remove()})),this.registeredEvents=[]),this.gridState.tabs=null,this.gridState.selectedTabId=null,d.inherited("remove",this,arguments)},render:function(){var t=this;return this._loadExtensionsPromise.then((function(){t.dotTemplate=e.template(n);var i=t.dotTemplate();return t.$el.html(i).addClass("dashboardGrid"),t.gridContainer=t.$el.find(".dataGridView")[0],t._tabsContainer=t.$el.find(".gridTabs")[0],t._readyView(),t.viewReady})).catch((function(e){t.logger.log(e)}))},getHighlightedTabId:function(){return this.gridState.selectedTabId},_renderReactTabs:function(){var t=this;if(!this.gridState.tabs||0===this.gridState.tabs.length)return Promise.resolve();var e={tabData:this.gridState.tabs,onTabChange:this.onTabChange.bind(this),selectedTab:this.gridState.selectedTabId};return new Promise((function(i,o){try{require(["ca-modeller/shaping"],(function(o){t._shapingHelper||(t._shapingHelper=new o.Shaping(t.glassContext,{featureConfig:{calculationAction:!0,customGroupCreateAction:!0,customGroupReplaceAction:!0}})),t._shapingHelper.render(o.GridTabs,e,t._tabsContainer),i()}),o)}catch(t){o(t)}}))},onTabChange:function(t){var e=i.findWhere(this.gridState.tabs,{id:t});e.select(this.gridState.selectedTabId,this.gridContainer),this.gridState.selectedTabId=e.id,this._renderReactTabs()}});return d})),define("dashboard-core/js/features/content/textEditor/TextEditorAPI",[],(function(){return function(){function t(){_classCallCheck(this,t)}return t.prototype.getCustomColorList=function(){},t.prototype.registerProvider=function(){},t}()})),define("dashboard-core/js/features/content/textEditor/impl/TextEditor",["../../../../lib/@waca/dashboard-common/dist/core/APIFactory","../TextEditorAPI"],(function(t,e){return function(){function i(t){_classCallCheck(this,i),this._customColor=t.features["Dashboard.CustomColor"],this.titles=[]}return i.prototype.initialize=function(){this._customColor.registerProvider(this)},i.prototype.destroy=function(){this._customColor&&this._customColor.deregisterProvider(this)},i.prototype.getCustomColorList=function(){return this.titles.reduce((function(t,e){return t.concat(e.textEditor.getCustomColorList())}),[])},i.prototype.getAPI=function(){return t.createAPI(this,[e])},i.prototype.registerProvider=function(t){this.titles.push(t)},i}()})),define("dashboard-core/js/authorBundle",(function(){}));