/*! For license information please see app.d4223eeb.js.LICENSE.txt */ (()=>{var e,t={72672:e=>{e.exports={name:"Singular Server",buildDate:"Thu Nov 21 2024 04:47:24 GMT+0000 (Coordinated Universal Time)",gitRev:"5121656a354bb11e95d04ec8b78b1f8fe4dc983e",longNameVersion:"47"}},85553:(e,t,a)=>{"use strict";var i=a(40961),n=a.n(i),s=a(40927),o=a.n(s),l=a(14794),r=a(16918),c=a.n(r),d=a(17334),p=a.n(d),m=a(79988),u=a(74316),h=a(25897),f=a(25160),g=a.n(f),v=a(88534),b=a.n(v),y=a(47500),E=a.n(y),w=a(15734),S=a.n(w),N=a(13023),C=a(24510),x=a(79378),I=a(34357),k=a(31018),D=a.n(k),A=a(3808);a(17604);const R=o().createClass({displayName:"BoundingBox",getInitialState:function(){return this.selectedHandle=null,this._selectedTile=null,this._selectedGroup=null,this.mouseDownScreenX=0,this.mouseDownScreenY=0,this.lastAnchorX=0,this.lastAnchorY=0,this.shiftKey=!1,this.isInMouseDown=!1,{}},componentDidMount:function(){$(window).on("mouseup",this.window_mouseup)},componentWillUnmount:function(){$(window).off("mouseup",this.window_mouseup)},setWidgetTreeSelection:function(e,t){this.widgetTreeSelectedGroup=e,this.widgetTreeSelectedTile=t,e&&(this.movementOriginBBoxStyle=null)},window_mouseup:function(e){e.preventDefault(),this.shiftKey=!1,this.movementOriginBBoxStyle=null,this.isInMouseDown=!1,this.forceUpdate()},window_mousemove:function(e){if(1!=this.isInMouseDown){$(".selection-outline").css("border-style","solid 20px");var t=$(".selection-outline").offset().top,a=$(".selection-outline").offset().left,i=$(".selection-outline").width()/2,n=$(".selection-outline").height()/2,s=a+i,o=t+n,l=e.pageX-s,r=e.pageY-o,c="",d=function(e,t,a){return e>=t&&e<=a},p=l<0?-1*l:l,m=r<0?-1*r:r;if(p<=i&&m<=n)c=function(e,t,a,i){var n="";switch(!0){case 1==e&&1==t:n=i+a;break;case 1==e&&0==t:n=a;break;case 0==e&&1==t:n=i;break;default:n="move"}return n}(d(p,i-5,i),d(m,n-5,n),l<0?"w":"e",r<0?"n":"s");""!=c&&"move"!=c&&(c+="-resize"),$("#onair"+this.currentWidgetId).css("cursor",c),$(".selection-outline").css("cursor",c),$("#onairPreview").css("cursor",c),this.cursorValue=c,e.preventDefault()}},drawMovementOrigin:function(e){if(e){var t;this.currentWidgetId=e.id;var a=$("#onairPreview"),i=$("#onair"+e.id);if(i.length>0){t=$.extend(!0,{},i[0].getBoundingClientRect());var n=a[0].getBoundingClientRect(),s=t.right-t.left,o=t.bottom-t.top,l=Math.max(-3,n.top-t.top),r=Math.max(-3,n.left-t.left),c=Math.min(s+3,s-(t.right-n.right)-1),d=Math.min(o+3,o-(t.bottom-n.bottom)-1);s>0&&o>0&&(this.movementOriginBBoxStyle={left:t.left,top:t.top,width:s,height:o,display:"inline",pointerEvents:"none",clip:"rect( "+l+"px,"+c+"px,"+d+"px,"+r+"px)"})}}else this.movementOriginBBoxStyle=null},getCurrentCursorType:function(){return this.cursorValue},render:function(){var e={left:0,top:0,width:0,height:0,display:"none"},t=null,a=null;if(this.widgetTreeSelectedGroup&&!this.widgetTreeSelectedTile){var i=this.props.sbRef.child("tiles").val();for(var n in this.widgetTreeSelectedGroup.items)if(!i[n]||i[n].layout.visible){var s=$("#onair"+n);if(s.length>0){var l=$.extend(!0,{},s[0].getBoundingClientRect());a?(a.left=Math.min(a.left,l.left),a.right=Math.max(a.right,l.right),a.top=Math.min(a.top,l.top),a.bottom=Math.max(a.bottom,l.bottom)):a=l}}}var r=$("#onair"+this.props.item.id);r.length>0&&(t=$.extend(!0,{},r[0].getBoundingClientRect()));var c,d=$("#onairPreview");if(d&&t){var p=d[0].getBoundingClientRect(),m=t.right-t.left,u=t.bottom-t.top,h=Math.max(-3,p.top-t.top),f=Math.max(-3,p.left-t.left),g=Math.min(m+3,m-(t.right-p.right)-1),v=Math.min(u+3,u-(t.bottom-p.bottom)-1);m>0&&u>0&&(e={left:t.left,top:t.top,width:m,height:u,display:"inline",clip:"rect( "+h+"px,"+g+"px,"+v+"px,"+f+"px)"},m<12&&(c=!0),u<12&&(c=!0))}a&&t&&(a.left=Math.min(a.left,t.left),a.right=Math.max(a.right,t.right),a.top=Math.min(a.top,t.top),a.bottom=Math.max(a.bottom,t.bottom));var b=null,y={left:0,top:0,width:0,height:0,display:"none",pointerEvents:"none"};if(a){var E=d[0].getBoundingClientRect(),w=a.right-a.left,S=a.bottom-a.top,N=Math.max(-3,E.top-a.top),C=Math.max(-3,E.left-a.left),x=Math.min(w+3,w-(a.right-E.right)-1),I=Math.min(S+3,S-(a.bottom-E.bottom)-1);w>0&&S>0&&(y={left:a.left,top:a.top,width:w,height:S,display:"inline",pointerEvents:"none",clip:"rect( "+N+"px,"+x+"px,"+I+"px,"+C+"px)"}),b=o().createElement("div",{className:"selection-outline-additional",style:y})}var k=null;if(this.movementOriginBBoxStyle&&(k=o().createElement("div",{id:"movementOrigin",className:"selection-outline-additional",style:this.movementOriginBBoxStyle})),this.props.item&&this.props.visible){var D,A=this.props.sbRef.child("tiles").val()[this.props.item.id];D=A?this.props.sbRef.child("groups").val()[this.props.item.groupId]:this.props.sbRef.child("groups").val()[this.props.item.id];var R={anchor:{x:50,y:50}};A?R=A.layout:D&&(R=D.layout);var P="calc("+R.anchor.x+"% - 3px)",T="calc("+R.anchor.y+"% - 3px)";return o().createElement("div",null,o().createElement("div",{className:"selection-outline",id:"handle body",style:e},o().createElement("div",{className:"selection-outline-label"},""),o().createElement("div",{className:"handle center",id:"handle center",style:{visibility:c?"hidden":"visible",left:P,top:T}})),b,k)}return null}});var P=a(80765),T=a(99227),M=a.n(T);a(228);var O=a(48766).EffectSelections,L=o().createClass({displayName:"RangeSlider",isMouseDown:!1,selection:"",sliderHost:null,firstSnap:-1,offsetToBody:0,getInitialState:function(){return{begin:this.props.begin,end:this.props.end}},componentDidMount:function(){this.sliderHost=n().findDOMNode(this.refs.sliderHost),this.sliderBody=n().findDOMNode(this.refs.sliderBody),$(document).on("mousemove",this.onMouseMove),$(document).on("mouseup",this.onMouseUp)},componentWillUnmount:function(){$(document).off("mousemove",this.onMouseMove),$(document).off("mouseup",this.onMouseUp)},setBeginAndEnd:function(e,t){null!=e&&ethis.state.begin&&this.setState({end:Math.max(0,t)})},componentWillReceiveProps:function(e){this.setState({begin:e.begin,end:e.end});var t=this.props.snapPoints.concat([]),a=t.indexOf(e.begin);a>-1&&t.splice(a,1),(a=t.indexOf(e.end))>-1&&t.splice(a,1),this.setState({snapPoints:t})},onMouseDown:function(e){this.selection=e.target.id,this.isMouseDown=!0,this.mouseDownScreenX=e.screenX;var t=this.getPosition(this.sliderBody);this.offsetToBody=e.clientX-t.x,this.selection||(this.selection="handle-body")},getPosition:function(e){for(var t=0,a=0;e;)t+=e.offsetLeft-e.scrollLeft+e.clientLeft,a+=e.offsetTop-e.scrollTop+e.clientTop,e=e.offsetParent;return{x:t,y:a}},onMouseMove:function(e){var t=this;if(this.isMouseDown)if(e.stopPropagation(),e.preventDefault(),"none"==this.props.snap){var a=e.screenX-this.mouseDownScreenX;if(this.mouseDownScreenX=e.screenX,"handle-left"==this.selection){var i=this.state.begin+a;this.setBeginAndEnd(i)}else if("handle-right"==this.selection){var n=this.state.end+a;this.setBeginAndEnd(null,n)}else if("handle-body"==this.selection){var s=this.state.end-this.state.begin;i=Math.max(0,this.state.begin+a),this.setBeginAndEnd(i,i+s)}}else if("object"==this.props.snap){if(0==this.state.snapPoints.length)return;var o=this.getPosition(this.sliderHost),l=e.clientX-o.x,r=[];"handle-left"==this.selection||"handle-right"==this.selection?(this.state.snapPoints.map((function(e){var t=Math.abs(l-e,e);r.push({dist:t,snap:e})})),c=r.sort((function(e,t){return e.dist-t.dist}))[0].snap,"handle-left"==this.selection?this.setBeginAndEnd(c):"handle-right"==this.selection&&this.setBeginAndEnd(null,c)):"handle-body"==this.selection&&(this.state.snapPoints.map((function(e){var a=Math.abs(l-e-t.offsetToBody,e);r.push({dist:a,snap:e})})),c=r.sort((function(e,t){return e.dist-t.dist}))[0].snap,s=this.state.end-this.state.begin,this.setBeginAndEnd(c,c+s))}else{o=this.getPosition(this.sliderHost),l=e.clientX-o.x;var c=Math.floor(l/this.props.snap)*this.props.snap;"handle-left"==this.selection?this.setBeginAndEnd(c):"handle-right"==this.selection?this.setBeginAndEnd(null,c):"handle-body"==this.selection&&(s=this.state.end-this.state.begin,c=Math.floor((l-this.offsetToBody)/this.props.snap)*this.props.snap,c=Math.max(0,c),this.setBeginAndEnd(c,c+s))}},onMouseUp:function(e){this.isMouseDown&&(this.isMouseDown=!1,this.selection="",this.props.onChange&&this.props.onChange({begin:this.state.begin,end:this.state.end}))},onContextMenu:function(e){$(this.refs.animPanelTrigger).children().click(),e.stopPropagation(),e.preventDefault()},render:function(){var e,t,a,i=this.state.end-this.state.begin,n={left:this.state.begin+"px",width:i+"px"};return e=i>=120?o().createElement("div",{className:"anim-info",onMouseDown:this.onMouseDown},o().createElement("span",{className:"anim-edit button",ref:"animPanelTrigger"},this.props.animPanel.panelOverlay),o().createElement("span",{className:"anim-type"},(t=this.props.anim.effect,(a=O.find((function(e){return e.id===t})))?a.title:t)),o().createElement("span",{className:"anim-duration"},M()(this.props.anim.duration).format("0.00")+"s")):o().createElement("div",{className:"anim-info",onMouseDown:this.onMouseDown},o().createElement("span",{className:"anim-edit button",ref:"animPanelTrigger"},this.props.animPanel.panelOverlay)),o().createElement("div",{className:"range-slider",onContextMenu:this.onContextMenu,ref:"sliderHost"},o().createElement("div",{id:"handle-body",className:"range-slider-body",ref:"sliderBody",style:n,onMouseDown:this.onMouseDown,disabled:this.props.disabled},e,o().createElement("div",{id:"handle-left",className:"range-slider-handle-left",onMouseDown:this.onMouseDown,disabled:this.props.disabled}),o().createElement("div",{id:"handle-right",className:"range-slider-handle-right",onMouseDown:this.onMouseDown,disabled:this.props.disabled})))}});const V=L;var F=a(45659),_=a(9769);const B=o().createClass({displayName:"TimelineRow",getInitialState:function(){return{}},componentWillMount:function(){},callSetSnapShot:function(e,t,a){var i=F.getRulerSecToPixel(e,t),n=F.getRulerSecToPixel(e,a);this.props.onSetSnapPoints&&this.props.onSetSnapPoints(this.props.ownerId,[i,n])},componentWillReceiveProps:function(e){this.props.zoom!=e.zoom&&this.callSetSnapShot(e.zoom,e.begin,e.end)},componentDidMount:function(){this.callSetSnapShot(this.props.zoom,this.props.begin,this.props.end)},shouldComponentUpdate:function(e,t){return!_.compareObject(this.props,e)},onChange:function(e){if(this.props.onChange){var t={begin:F.getRulerPixelToSec(this.props.zoom,e.begin),end:F.getRulerPixelToSec(this.props.zoom,e.end)};this.props.onChange(t)}this.props.onSetSnapPoints&&this.props.onSetSnapPoints(this.props.ownerId,[e.begin,e.end])},render:function(){var e=F.getRulerSecToPixel(this.props.zoom,this.props.begin),t=F.getRulerSecToPixel(this.props.zoom,this.props.end),a=F.getRuler(this.props.zoom).hSpace;"none"!=this.props.snap&&"object"!=this.props.snap||(a=this.props.snap);var i={};return this.props.animItem&&this.props.animationPanel&&(i.duration=this.props.animItem.keyframes[this.props.animationPanel][1]-this.props.animItem.keyframes[this.props.animationPanel][0],i.easing=this.props.animItem.effects[this.props.animationPanel].easing,i.effect=this.props.animItem.effects[this.props.animationPanel].effect,i.property=this.props.animItem.effects[this.props.animationPanel].property),o().createElement(V,{begin:e,end:t,snap:a,snapPoints:this.props.snapPoints,onChange:this.onChange,anim:i,animPanel:this.props.animPanel,onAnimationStateMoveTo:this.props.onAnimationStateMoveTo,onAnimEffectChanged:this.props.onAnimEffectChanged,onAnimValueChanged:this.props.onAnimValueChanged})}}),U=o().createClass({displayName:"HScroller",render:function(){var e={left:this.props.position};return o().createElement("div",{className:"h-scroller"},o().createElement("div",{className:"children",style:e},this.props.children))}});var W=a(24316),Y=a(87195),j=a.n(Y),H=a(58776),z=a.n(H),G=a(16524),K=a(83384),q=a(9769);const J=o().createClass({displayName:"WidgetTreeItem",mixins:[W.A],getInitialState:function(){return{}},componentDidMount:function(){var e=this;$(document).mouseup((function(t){var a=n().findDOMNode(e.refs.dropdownMenu),i=$(a);q.getMouseEventType(t)!=K.MOUSE_RIGHT_CLICK&&(i.is(t.target)||0!==i.has(t.target).length||i.removeClass("show"))}))},componentWillMount:function(){this.sBindAsObject(this.props.sbRef.parent.child(this.props.tileId).child("settings/linkTimeline"),"linkTimeline"),this.sBindAsObject(this.props.sbRef.child("tiles").child(this.props.tileId),"tile"),this.sBindAsObject(this.props.sbRootRef.child("compositionProps").child("snapshot").child(this.props.tileId),"snapshotUrl")},shouldComponentUpdate:function(e,t){return this.state.tile.id==e.selection.id||this.props.selection.id!=e.selection.id&&this.state.tile.id==this.props.selection.id||this.props.uiSettings.timelineSnap!=e.uiSettings.timelineSnap||this.props.uiSettings.timelineZoom!=e.uiSettings.timelineZoom||!(q.compareObject(this.state,t)&&this.state.tile.thumbnail==t.tile.thumbnail&&this.state.tile.name==t.tile.name&&this.state.tile.layout.visible==t.tile.layout.visible&&this.props.showTimeline==e.showTimeline&&this.props.hScrollerPositions==e.hScrollerPositions&&this.props.animationPanel==e.animationPanel&&this.props.filter==e.filter&&q.compareObject(this.state.tile.effects,t.tile.effects)&&q.compareObject(this.state.tile.keyframes,t.tile.keyframes)&&q.compareObject(this.props.adaptationGlobals,e.adaptationGlobals))},nameChanged:function(e){this.props.onWidgetNameChange&&this.props.onWidgetNameChange(this.state.tile.id,e.name),this.finishEditing()},onVisibleToggle:function(e){e.stopPropagation(),this.props.onWidgetVisibleToggle&&this.props.onWidgetVisibleToggle(this.state.tile.id)},onKeyframesChange:function(e,t){this.props.onKeyframesChange({id:this.state.tile.id,begin:t.begin,end:t.end,timeline:e})},onSetSnapPoints:function(e,t,a){this.props.onSetSnapPoints&&this.props.onSetSnapPoints(e,t,a)},startEditing:function(){try{$(".widget-tree-item").sortable("disable"),$(".widget-tree-group").sortable("disable")}catch(e){}},finishEditing:function(){try{$(".widget-tree-item").sortable("enable"),$(".widget-tree-group").sortable("enable")}catch(e){}},render:function(){if(this.props.filter&&-1==this.state.tile.name.toLowerCase().indexOf(this.props.filter.toLowerCase()))return!1;if(!this.state.tile.layout)return!1;var e=this.state.tile.thumbnail;e||(e="/widgets/"+this.state.tile.widget+"/icon.png");var t,a,i,n,s,l,r,c=g().executeAdaptation(this.props.adaptationGlobals,this.state.tile.layout.adaptations),d="list-group-item";if(!1===this.state.tile.layout.visible||0==c?(d+=" disabled",t=!0===this.state.tile.layout.visible?o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"adaptiveHidden"},"Hidden by Adaptive")},o().createElement("i",{className:"fa fa-eye-slash adaptive eye-icon",onMouseDown:this.onVisibleToggle})):o().createElement("i",{className:"fa fa-eye-slash eye-icon",onMouseDown:this.onVisibleToggle})):t=o().createElement("i",{className:"fa fa-eye eye-icon",onMouseDown:this.onVisibleToggle}),"composition"==this.state.tile.type)a="fa fa-cube",s=this.state.snapshotUrl,i=o().createElement("i",{className:"fa fa-arrow-circle-o-right",onClick:this.gotoComp});else switch(this.state.tile.widget){case 1032:a="fa fa-font";break;case 642:a="fa fa-picture-o";break;case 1022:a="fa fa-square";break;case 1052:a="fa fa-circle";break;case 812:a="fa fa-video-camera";break;default:a="fa fa-puzzle-piece"}q.isInteractivityEnabled(this.state.tile.layout,!0)&&(l=o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"interactivityEnabled"},"Interactivity Enabled")},o().createElement("i",{className:"fa fa-crosshairs eye-icon"})));var p=this.props.uiSettings;p||(p={timelineZoom:0,timelineSnap:"grid"}),this.props.showTimeline&&this.state.tile.effects&&this.state.tile.keyframes&&(r="none"!=this.state.tile.effects[this.props.animationPanel].effect?o().createElement(B,{onChange:this.onKeyframesChange.bind(this,this.props.animationPanel),key:this.props.animationPanel,animationPanel:this.props.animationPanel,animPanel:this.props.animPanel,animItem:this.state.tile,ownerId:this.state.tile.id,begin:this.state.tile.keyframes[this.props.animationPanel][0],end:this.state.tile.keyframes[this.props.animationPanel][1],zoom:p.timelineZoom,snap:p.timelineSnap,snapPoints:this.props.snapPoints[this.props.animationPanel],onSetSnapPoints:this.onSetSnapPoints.bind(this,this.props.animationPanel),onAnimEffectChanged:this.props.onAnimEffectChanged,onAnimValueChanged:this.props.onAnimValueChanged}):o().createElement("div",null,this.props.animPanel.panelOverlay)),"composition"==this.state.tile.type&&"none"==this.state.tile.effects[this.props.animationPanel].effect&&(r=void 0),this.props.selection.id==this.state.tile.id&&(d+=" active");var m=!1;this.props.renameItem&&this.props.renameItem.id==this.state.tile.id&&(m=!0);var u=function(e,t,a){return o().createElement("li",{style:{borderTop:"1px solid #3c3c3c"}},o().createElement("a",{tabIndex:"-1",className:"u-cursor-pointer",onClick:a},o().createElement("span",null,e," ",o().createElement("span",{className:"shortcut-description"},t))))},h="",f=null;if("composition"==this.state.tile.type){var v="Link Timeline",b=this.props.sbRef.parent.child(this.state.tile.id).child("settings/linkTimeline").get(),y="timeline-full ";b&&(v="Unlink Timeline",y="timeline-full linkedTimeline",h="linked-timeline"),n=u(v,"",this.linkTimeline.bind(this,this.state.tile.id,!b));var E=this.props.sbRootRef.child("compositionProps").child("logicLayers").child(this.props.tileId).val();E&&E.tag&&(f=o().createElement("div",{style:{width:"8px",height:"8px",backgroundColor:E.tag,position:"absolute",left:"6px",top:"7px",borderRadius:"4px"}}))}var w,S="Ctrl";return navigator.platform.toUpperCase().indexOf("MAC")>=0&&(S="CMD"),w=s&&"string"==typeof s?o().createElement("i",{className:a+" subcomp-popover",onClick:this.selectWidget.bind(this,G.PROPERTIES)},o().createElement("img",{src:s,className:"subcomp-snapshot"})):o().createElement("i",{className:a,onClick:this.selectWidget.bind(this,G.PROPERTIES)}),o().createElement("li",{className:d,id:this.state.tile.id,onContextMenu:this.contextMenu,onMouseDown:this.selectWidget.bind(this,null),onDoubleClick:this.gotoComp,"data-group":this.props.group.id},f,o().createElement("span",{className:"list-group-item-panel "+h},o().createElement("span",{className:"pull-right widget-tools"},l,i,t,o().createElement("div",{className:"btn-group"},o().createElement("i",{ref:"dropdownTrigger",className:"fa fa-ellipsis-v","data-toggle":"dropdown",style:{display:"none"}}),o().createElement("ul",{id:"context-menu-widget-item-"+this.state.tile.id,ref:"dropdownMenu",className:"dropdown-menu",role:"menu"},u("Cut","("+S+" + x)",this.cutItem),u("Copy","("+S+" + c)",this.copyItem),u("Paste","("+S+" + v)",this.pasteItem),u("Delete","(DEL)",this.deleteItem),u("Duplicate","("+S+" + d)",this.duplicateItem),n))),o().createElement("i",{className:"fa"}),w,o().createElement("span",{className:"item-label",style:{display:"inline-block",width:"120px"}},o().createElement(P.A,{key:this.state.tile.name,text:this.state.tile.name,paramName:"name",className:"inline-label",activeClassName:"inline-edit",change:this.nameChanged,onNavigate:this.onNavigate,editing:m,startEditing:this.startEditing,finishEditing:this.finishEditing,cancelEditing:this.finishEditing}))),o().createElement("span",{className:this.state.tile.type+" list-group-item-timeline"},o().createElement("span",{className:y},o().createElement(U,{position:this.props.hScrollerPositions[this.props.animationPanel]},r))))},onNavigate:function(e,t){this.props.onNavigateItem&&this.props.onNavigateItem(this.state.tile.id,e,t)},gotoComp:function(e){if(e.stopPropagation(),-1==e.target.className.toString().indexOf("eye-icon")&&this.props.onGotoComp){var t=this.props.sbRootRef.child("compositions").val(),a=this.props.sbCompositionRef.key,i=!1;for(var n in t){var s=t[n];if(s.tiles){for(var o in s.data)if(s.data[o].composition==a){i=!0;break}if(i)break}}i?this.props.onGotoComp(this.state.tile,{compositionDataNodes:[],compositionControlNode:{},compositionWidgetNode:{}}):this.props.onGotoComp(this.state.tile,{compositionDataNodes:this.props.sbCompositionRef.child("dataSources").child("composition").child("dataNodes").val(),compositionControlNode:this.props.sbCompositionRef.child("dataSources").child("composition").child("controlNode").val(),compositionWidgetNode:this.props.sbCompositionRef.child("dataSources").child("composition").child("widgetNode").val()})}},selectWidget:function(e,t){this.props.onWidgetSelect&&this.props.onWidgetSelect(e,this.state.tile,this.props.group),document.activeElement&&document.activeElement.blur(),t.stopPropagation()},contextMenu:function(e){n().findDOMNode(this.refs.dropdownTrigger);var t=n().findDOMNode(this.refs.dropdownMenu);q.dropdownClearAllContextExceptCurrentElement($(t)),q.dropDownFixPosition($(t),e),$(t).toggleClass("show"),e.stopPropagation(),e.preventDefault()},deleteItem:function(e){this.props.onWidgetDelete&&this.props.onWidgetDelete(this.state.tile,this.props.group),this.closeContextMenu(),e.stopPropagation()},duplicateItem:function(e){this.props.onWidgetDuplicate&&this.props.onWidgetDuplicate(this.state.tile,this.props.group),this.closeContextMenu(),e.stopPropagation()},linkTimeline:function(e,t){this.props.onLinkTimeline&&this.props.onLinkTimeline(e,t),this.closeContextMenu()},copyItem:function(e){this.props.onCopy&&this.props.onCopy(),this.closeContextMenu(),e.stopPropagation()},cutItem:function(e){this.copyItem(e),this.deleteItem(e)},pasteItem:function(e){this.props.onPaste&&this.props.onPaste(),this.closeContextMenu(),e.stopPropagation()},closeContextMenu:function(){var e=n().findDOMNode(this.refs.dropdownMenu);$(e).removeClass("show")}});function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&(l=$(r[0]).attr("id")),o&&o!=n){$(this).sortable("cancel");var c=a.item.data("group"),d=a.item.attr("id");e.props.onWidgetRemoveFromGroup&&e.props.onWidgetRemoveFromGroup(d,c),e.pendingModified.push({tileId:d,cursor:l})}else{var p=e.pendingModified.pop();if(p)if("last"==p.cursor)i.push(p.tileId);else{var m=i.indexOf(p.cursor);-1!=m&&i.splice(m,0,p.tileId)}else $(this).sortable("cancel")}var u=[];i.forEach((function(e,t){if(e){var a=s+t;u.push({id:e,priority:a})}})),e.props.onWidgetSort&&e.props.onWidgetSort(u,n)}}).disableSelection()},nameChanged:function(e){this.props.onGroupNameChange&&this.props.onGroupNameChange(this.state.group.id,e.name),this.finishEditing()},onVisibleToggle:function(e){e.stopPropagation(),this.props.onGroupVisibleToggle&&this.props.onGroupVisibleToggle(this.state.group.id)},onKeyframesChange:function(e,t){this.props.onKeyframesChange({id:this.state.group.id,begin:t.begin,end:t.end,timeline:e})},onSetSnapPoints:function(e,t,a){this.props.onSetSnapPoints&&this.props.onSetSnapPoints(e,t,a)},onNavigateItem:function(e,t,a){this.props.onNavigateItem&&this.props.onNavigateItem(e,t,a)},onNavigate:function(e,t){this.onNavigateItem(this.state.group.id,e,t)},startEditing:function(){try{$(".widget-tree-item").sortable("disable"),$(".widget-tree-group").sortable("disable")}catch(e){}},finishEditing:function(){try{$(".widget-tree-item").sortable("enable"),$(".widget-tree-group").sortable("enable")}catch(e){}},render:function(){var e=this,t=function(t,a){return o().createElement(J,X({key:t.tile.id,tileId:t.tile.id,group:t.group},e.props,{hScrollerPositions:e.props.hScrollerPositions,animationPanel:e.props.animationPanel,navigateItem:this.navigateItem,adaptationGlobals:this.props.adaptationGlobals}))}.bind(this),a=[];for(var i in this.state.group.items){var n=this.state.group.items[i];a.push({tile:this.state.group.items[n.id],priority:n.priority,group:this.state.group})}a.sort((function(e,t){return(e.priority>t.priority)-.5})),this.props.selection&&this.props.selection.id==this.state.group.id&&this.props.selection.type;var s,l,r={},c="list-group-item group-item";0==a.length?(s="fa fa-fw",0==this.state.group.expand?(l="fa fa-folder",c+=" group-close"):(l="fa fa-folder-open",c+=" group-open")):0==this.state.group.expand?(r={maxHeight:"0px"},s="fa fa-caret-right caret",l="fa fa-folder",c+=" group-close"):(s="fa fa-caret-down caret",l="fa fa-folder-open",c+=" group-open"),this.props.selection.id==this.state.group.id&&(c+=" active");var d,p,m,u=g().executeAdaptation(this.props.adaptationGlobals,this.state.group.layout.adaptations);if(!1===this.state.group.layout.visible||0==u?(c+=" disabled",d=!0===this.state.group.layout.visible?o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"adaptiveHidden"},"Hidden by Adaptive")},o().createElement("i",{className:"fa fa-eye-slash adaptive eye-icon",onMouseDown:this.onVisibleToggle})):o().createElement("i",{className:"fa fa-eye-slash eye-icon",onMouseDown:this.onVisibleToggle})):d=o().createElement("i",{className:"fa fa-eye eye-icon",onMouseDown:this.onVisibleToggle}),Z.isInteractivityEnabled(this.state.group.layout,!0)&&(p=o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"interactivityEnabled"},"Events Enabled")},o().createElement("i",{className:"fa fa-crosshairs interactive-icon"}))),this.props.showTimeline&&this.state.group.effects&&this.state.group.keyframes){var h=this.props.uiSettings;h||(h={timelineZoom:0,timelineSnap:"grid"}),m="none"!=this.state.group.effects[this.props.animationPanel].effect?o().createElement(B,{onChange:this.onKeyframesChange.bind(this,this.props.animationPanel),key:this.props.animationPanel,animationPanel:this.props.animationPanel,animPanel:this.props.animPanel,animItem:this.state.group,ownerId:this.state.group.id,begin:this.state.group.keyframes[this.props.animationPanel][0],end:this.state.group.keyframes[this.props.animationPanel][1],zoom:h.timelineZoom,snap:h.timelineSnap,snapPoints:this.props.snapPoints[this.props.animationPanel],onSetSnapPoints:this.onSetSnapPoints.bind(this,this.props.animationPanel)}):o().createElement("div",null,this.props.animPanel.panelOverlay)}var f=!1;this.props.renameItem&&this.props.renameItem.id==this.state.group.id&&(f=!0);var v=function(e,t,a){return o().createElement("li",{style:{borderTop:"1px solid #3c3c3c"}},o().createElement("a",{tabIndex:"-1",className:"u-cursor-pointer",onClick:a},o().createElement("span",null,e," ",o().createElement("span",{className:"shortcut-description"},t))))},b="Ctrl";return navigator.platform.toUpperCase().indexOf("MAC")>=0&&(b="CMD"),o().createElement("li",{className:c,id:this.state.group.id,onMouseDown:this.selectGroup,onDoubleClick:this.toggleExpand,onContextMenu:this.contextMenu},o().createElement("span",{className:"list-group-item-panel"},o().createElement("span",{className:"pull-right widget-tools"},p,d,o().createElement("div",{className:"btn-group"},o().createElement("i",{ref:"dropdownTrigger",className:"fa fa-ellipsis-v","data-toggle":"dropdown",style:{display:"none"}}),o().createElement("ul",{id:"context-menu-group-item-"+this.state.group.id,ref:"dropdownMenu",className:"dropdown-menu",role:"menu"},v("Cut","("+b+" + x)",this.cutItem),v("Copy","("+b+" + c)",this.copyItem),v("Paste","("+b+" + v)",this.pasteItem),v("Delete","(DEL)",this.deleteItem),v("Duplicate","("+b+" + d)",this.duplicateItem)))),o().createElement("i",{className:s,onClick:this.toggleExpand}),o().createElement("i",{className:l,onClick:this.toggleExpand}),o().createElement(P.A,{key:this.state.group.name,text:this.state.group.name,paramName:"name",className:"inline-label",activeClassName:"group-inline-edit",change:this.nameChanged,onNavigate:this.onNavigate,editing:f,startEditing:this.startEditing,finishEditing:this.finishEditing,cancelEditing:this.finishEditing})),o().createElement("span",{className:"group list-group-item-timeline"},o().createElement("span",{className:"timeline-full"},o().createElement(U,{position:this.props.hScrollerPositions[this.props.animationPanel]},m))),o().createElement("span",null,o().createElement("ul",{className:"widget-tree-item list-group composition-tree-subgroup",id:this.state.group.id,"data-zindex":this.state.group.layout.zindex,style:r},a.map(t))))},selectGroup:function(){this.props.onGroupSelect&&this.props.onGroupSelect(this.state.group),document.activeElement&&document.activeElement.blur()},toggleExpand:function(e){e.stopPropagation(),-1==e.target.className.toString().indexOf("eye-icon")&&this.props.onGroupExpandToggle&&this.props.onGroupExpandToggle(this.state.group.id)},contextMenu:function(e){n().findDOMNode(this.refs.dropdownTrigger);var t=n().findDOMNode(this.refs.dropdownMenu);Z.dropdownClearAllContextExceptCurrentElement($(t)),Z.dropDownFixPosition($(t),e),$(t).toggleClass("show"),e.stopPropagation(),e.preventDefault()},deleteItem:function(e){this.props.onGroupDelete&&this.props.onGroupDelete(this.state.group),this.closeContextMenu(),e.stopPropagation()},duplicateItem:function(e){this.props.onGroupDuplicate&&this.props.onGroupDuplicate(this.state.group),this.closeContextMenu(),e.stopPropagation()},copyItem:function(e){this.props.onCopy&&this.props.onCopy(),this.closeContextMenu(),e.stopPropagation()},cutItem:function(e){this.copyItem(e),this.deleteItem(e)},pasteItem:function(e){this.props.onPaste&&this.props.onPaste(),this.closeContextMenu(),e.stopPropagation()},closeContextMenu:function(){var e=n().findDOMNode(this.refs.dropdownMenu);$(e).removeClass("show")}});var te=a(66828),ae=a(91605),ie=a(72761),ne=a.n(ie),se=a(94108),oe=a(52871);function le(e){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},le(e)}const re=o().createClass({displayName:"EasingGizmo",mixins:[oe.A],localData:{gradientRenderer:"",previewWidth:231,previewHeight:231,easePath:""},easingSelections:[{id:"linear",title:"Linear"},{id:"power1",title:"Power1"},{id:"power2",title:"Power2"},{id:"power3",title:"Power3"},{id:"power4",title:"Power4"},{id:"back",title:"Back"},{id:"elastic",title:"Elastic"},{id:"bounce",title:"Bounce"},{id:"rough",title:"Rough"},{id:"slowmo",title:"Slow Motion"},{id:"stepped",title:"Stepped"},{id:"circ",title:"Circ"},{id:"expo",title:"Expo"},{id:"sine",title:"Sine"}],inOutSelection:[{id:"in",title:"In"},{id:"inOut",title:"In and Out"},{id:"out",title:"Out"}],roughTemplateSelections:[{id:"linear",title:"Linear"},{id:"power1",title:"Power1"},{id:"power2",title:"Power2"},{id:"power3",title:"Power3"},{id:"power4",title:"Power4"},{id:"back",title:"Back"},{id:"elastic",title:"Elastic"},{id:"bounce",title:"Bounce"},{id:"slowmo",title:"Slow Motion"},{id:"stepped",title:"Stepped"},{id:"circ",title:"Circ"},{id:"expo",title:"Expo"},{id:"sine",title:"Sine"}],roughEasingSelections:[{id:"in",title:"In"},{id:"out",title:"Out"},{id:"inOut",title:"In and Out"}],roughTaperSelections:[{id:"none",title:"None"},{id:"in",title:"In"},{id:"out",title:"Out"},{id:"inOut",title:"In and Out"}],getInitialState:function(){return{selectedEase:""}},componentWillMount:function(){},componentWillUnmount:function(){},componentWillReceiveProps:function(e){},componentDidMount:function(){this.localData.gradientRenderer=ne()(this.refs.gradientPreview).size("100%","100%"),this.setState({selectedEase:this.props.value.easing}),this.drawEasingPreview(this.props.value)},onTweenUpdate:function(){},componentDidUpdate:function(){},PropValueChanged:function(e,t,a){"easing"==e&&this.setState({selectedEase:t});var i={};$.extend(!0,i,this.props.value),i[e]=t,this.props.onValueChanged(this.props.name,i)},render:function(){var e=this.props.value;switch(void 0!==e&&"object"===le(e)||(e={}),0==e.hasOwnProperty("easing")&&(e.easing="power1"),e.easing){case"back":0==e.hasOwnProperty("parBack")&&(e.parBack=1.7);break;case"elastic":0==e.hasOwnProperty("parElastic1")&&(e.parElastic1=1.2),0==e.hasOwnProperty("parElastic2")&&(e.parElastic2=.3);break;case"slowmo":0==e.hasOwnProperty("parSlowmo1")&&(e.parSlowmo1=.3),0==e.hasOwnProperty("parSlowmo2")&&(e.parSlowmo2=.7);break;case"stepped":0==e.hasOwnProperty("parStepped")&&(e.parStepped=10);break;case"rough":0==e.hasOwnProperty("parRoughTemplate")&&(e.parRoughTemplate="power1"),0==e.hasOwnProperty("parRoughEasing")&&(e.parRoughEasing="in"),0==e.hasOwnProperty("parRoughStrength")&&(e.parRoughStrength=.2),0==e.hasOwnProperty("parRoughPoints")&&(e.parRoughPoints=10),0==e.hasOwnProperty("parRoughTaper")&&(e.parRoughTaper="inOut"),0==e.hasOwnProperty("parRoughRandomize")&&(e.parRoughRandomize=!0),0==e.hasOwnProperty("parRoughClamp")&&(e.parRoughClamp=!1)}""!=this.localData.gradientRenderer&&(this.drawEasingPreview(e),""!=this.localData.easePath&&TweenLite.fromTo("#"+this.localData.easePath,5,{drawSVG:"0%"},{drawSVG:"100%"}));var t,a=function(e){return o().createElement("li",{key:e.id,onClick:this.PropValueChanged.bind(this,"easing",e.id),className:this.state.selectedEase==e.id?"active":""},e.title)}.bind(this),i=null;switch(e.easing){case"back":i=o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Overshoot"),o().createElement("td",null,o().createElement(te.A,{name:"parBack",resetValue:1.7,step:.01,format:"0.01",min:0,max:10,value:e.parBack,onValueChanged:this.PropValueChanged,disabled:this.props.disabled})))));break;case"elastic":i=o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Amplitude"),o().createElement("td",null,o().createElement(te.A,{name:"parElastic1",resetValue:1.2,step:.01,format:"0.01",min:.05,max:3,value:e.parElastic1,onValueChanged:this.PropValueChanged,disabled:this.props.disabled}))),o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Period"),o().createElement("td",null,o().createElement(te.A,{name:"parElastic2",resetValue:.3,step:.01,format:"0.01",min:.05,max:2,value:e.parElastic2,onValueChanged:this.PropValueChanged,disabled:this.props.disabled})))));break;case"rough":i=o().createElement("div",null,o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Template"),o().createElement("td",null,o().createElement("div",{className:"dropdown"},o().createElement(ae.A,{name:"parRoughTemplate",selections:this.roughTemplateSelections,value:e.parRoughTemplate,onValueChanged:this.PropValueChanged,disabled:this.props.disabled})))),o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Easing"),o().createElement("td",null,o().createElement("div",{className:"dropdown"},o().createElement(ae.A,{name:"parRoughEasing",selections:this.roughEasingSelections,value:e.parRoughEasing,onValueChanged:this.PropValueChanged,disabled:this.props.disabled})))),o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Strength"),o().createElement("td",null,o().createElement(te.A,{name:"parRoughStrength",resetValue:.2,step:.01,format:"0.01",min:0,max:2,value:e.parRoughStrength,onValueChanged:this.PropValueChanged,disabled:this.props.disabled}))),o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Points"),o().createElement("td",null,o().createElement(te.A,{name:"parRoughPoints",resetValue:10,step:1,format:"1",min:1,max:300,value:e.parRoughPoints,onValueChanged:this.PropValueChanged,disabled:this.props.disabled}))),o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Taper"),o().createElement("td",null,o().createElement("div",{className:"dropdown"},o().createElement(ae.A,{name:"parRoughTaper",selections:this.roughTaperSelections,value:e.parRoughTaper,onValueChanged:this.PropValueChanged,disabled:this.props.disabled})))),o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Randomize"),o().createElement("td",null,o().createElement(se.A,{name:"parRoughRandomize",value:e.parRoughRandomize,onValueChanged:this.PropValueChanged,disabled:this.props.disabled}))),o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Clamp"),o().createElement("td",null,o().createElement(se.A,{name:"parRoughClamp",value:e.parRoughClamp,onValueChanged:this.PropValueChanged,disabled:this.props.disabled}))))));break;case"slowmo":i=o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Linear Ratio"),o().createElement("td",null,o().createElement(te.A,{name:"parSlowmo1",resetValue:.3,step:.01,format:"0.01",min:.05,max:1,value:e.parSlowmo1,onValueChanged:this.PropValueChanged,disabled:this.props.disabled}))),o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Power"),o().createElement("td",null,o().createElement(te.A,{name:"parSlowmo2",resetValue:.7,step:.01,format:"0.01",min:.05,max:3,value:e.parSlowmo2,onValueChanged:this.PropValueChanged,disabled:this.props.disabled})))));break;case"stepped":i=o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Steps"),o().createElement("td",null,o().createElement(te.A,{name:"parStepped",resetValue:10,step:1,format:"1",min:1,max:1e3,value:e.parStepped,onValueChanged:this.PropValueChanged,disabled:this.props.disabled})))))}return t="linear"==e.easing||"stepped"==e.easing||"rough"==e.easing||"slowmo"==e.easing?null:o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{className:"td-label"},"Type:"),o().createElement("td",null,o().createElement("div",{className:"dropdown"},o().createElement(ae.A,{key:"inOut",name:"inOut",selections:this.inOutSelection,value:e.inOut,onValueChanged:this.PropValueChanged,disabled:this.props.disabled})))))),o().createElement("div",{className:"easingGizmo"},o().createElement("div",{className:"singular-panel easing-list"},o().createElement("div",{className:"panel"},o().createElement("div",{className:"panel-header"},"Effects"),o().createElement("div",{className:"panel-body"},o().createElement("ul",{className:"singular-list"},this.easingSelections.map(a))))),o().createElement("div",{className:"easingPreview",ref:"gradientPreview",style:{width:this.localData.previewWidth+"px",height:this.localData.previewHeight+"px"}}),o().createElement("div",{className:"easing-options"},o().createElement("div",{className:"easing-type-selectors"},t),o().createElement("div",{className:"easing-properties"},i)))},drawEasingPreview:function(e){var t=this.localData.gradientRenderer;if(void 0!==t&&""!=t){for(var a=this.generateGreensockEasing(e),i=this.localData.previewWidth,n=(this.localData.previewHeight,9999),s=-9999,o=[],l=0;l<=i;l++){var r=1-a.getRatio(l/i);rs&&(s=r),o.push(r)}var c=1/(s-n),d=[];for(l=0;l<=i;l++)d.push([l,(o[l]-n)*c*this.localData.previewHeight]);t.clear(),t.viewbox(-10,-15,this.localData.previewWidth+20,this.localData.previewHeight+30);for(var p,m=t.polyline(d).fill("none").stroke({width:2,color:"#dcdee3"}),u=(d.length,0),h=0;h0&&(u+=Math.sqrt(Math.pow(f.x-p.x,2)+Math.pow(f.y-p.y,2))),p=f}t.polyline([d]).fill("none").stroke({width:4,color:"#4279AC",dasharray:u,dashoffset:u}).animate(3e3).during((function(e,t){this.attr({"stroke-dashoffset":t(u,0)})}));var g=(1-n)*c*this.localData.previewHeight;t.line(0,g,this.localData.previewWidth,g).fill("none").stroke({width:1,color:"#000"}),t.text("0 %").move(0,g+2).fill("#fff");var v=(0-n)*c*this.localData.previewHeight;t.line(0,v,this.localData.previewWidth,v).fill("none").stroke({width:1,color:"#000"}),t.text("100 %").move(0,v+2).fill("#fff")}}});var ce=a(50942),de=a.n(ce),pe=a(5876),me=a(9769),ue=a(48766);const he=o().createClass({displayName:"AnimationPanel",mixins:[pe.A],shouldComponentUpdate:function(e,t){return!me.compareObject(this.props,e)},AnimationPaste:function(){var e=this.onFetchClipBoardData("effects");if(e&&void 0!==this.props.state){var t=e[this.props.state];if(t){var a=this.onFetchClipBoardData("keyframes");if(a){var i=a[this.props.state];i&&(this.props.showWidgetAnimation||"widget"!=t.effect)&&(this.props.onEffect("effect",t.effect),this.props.onValueChanged("property",t.property),this.props.onValueChanged("easing",t.easing),this.props.onValueChanged("begin",i[0]),this.props.onValueChanged("duration",i[1]-i[0]))}}}},render:function(){if($.isEmptyObject(this.props.anim))return o().createElement("tr",null);if(!this.props.anim.effect)return o().createElement("tr",null);var e=[],t=ue.EffectSelections;this.props.isUpdateAnimation&&(t=ue.EffectSelectionsUpdateAnimation),t.map(function(t){t.id==this.props.anim.effect&&(e=t.property)}.bind(this));var a=!1;e.map(function(e){e.id==this.props.anim.property&&(a=!0)}.bind(this));var i=this.props.disabled,n=!1;0==a&&(this.props.anim.property=e[0].id,"none"==this.props.anim.property&&(n=!0));var s=o().createElement(de(),{id:"popover"},o().createElement(re,{name:"easing",value:this.props.anim.easing,onValueChanged:this.props.onValueChanged})),l="dropdown";"dropup"==this.props.menuStyle&&(l="dropup");var r,c=ue.EffectSelections;return this.props.isUpdateAnimation?c=ue.EffectSelectionsUpdateAnimation:this.props.showWidgetAnimation||(c=ue.EffectSelections.slice(0,-1)),this.props.showPasteButton&&(r=o().createElement("td",null,o().createElement("button",{tabIndex:"-1",type:"button",className:"btn btn-default btn-sm relative v2",style:{boxShadow:"none",height:"28px"},onClick:this.AnimationPaste},o().createElement("i",{className:"fa fa-clipboard"})))),o().createElement("div",null,o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement(ae.A,{name:"effect",selections:c,className:l,value:this.props.anim.effect,onValueChanged:this.props.onEffect,disabled:i})),o().createElement("td",null,o().createElement(ae.A,{name:"property",selections:e,className:l,disabled:n||i,value:this.props.anim.property,onValueChanged:this.props.onValueChanged})),o().createElement("td",null," "),o().createElement("td",null,o().createElement(te.A,{name:"duration",resetValue:1,step:.01,unit:"s",format:"0.01",min:0,max:60,value:this.props.anim.duration,showSlider:!1,onValueChanged:this.props.onValueChanged,disabled:n||i})),o().createElement("td",null,o().createElement(j(),{tabIndex:"-1",trigger:"click",rootClose:!0,placement:this.props.gizmoOverlayPlacement,overlay:s},o().createElement("button",{className:"btn btn-default",tabIndex:"-1",disabled:n||i},this.props.anim.easing.easing," ",o().createElement("i",{className:"fa fa-sliders"})))),r))))}});var fe=a(95093),ge=a.n(fe),ve=a(57453),be=a(33738),ye=a(9769),Ee=a(82465),we=[];const Se=o().createClass({displayName:"WidgetInstanceInfo",getInitialState:function(){return this.widgetVersionGetHandler=null,this.itemType=null,this.widget=null,this.tileId=null,this.widgetID=null,this.widgetVersion=null,{showBusyIcon:!1,currentVersionchangeDate:null,isVersionUpToDate:!1,isDeveloperVersion:!1}},componentWillMount:function(){this.updateEditor(this.props.item)},componentWillReceiveProps:function(e){this.updateEditor(e.item)},componentWillUnmount:function(){null!=this.widgetVersionGetHandler&&(this.widgetVersionGetHandler.abort(),this.widgetVersionGetHandler=null)},componentDidMount:function(){},shouldComponentUpdate:function(e,t){return!0},getElementFromWidgetCache:function(e){if(!e||void 0===e.id)return null;for(var t=0,a=we.length;tthis.props.screenVisibleRange.right?e.opacity=0:e.opacity=1;var t=M()(this.props.cursorLabel).format("0.00");return o().createElement("div",{className:"cursor",style:e,onMouseDown:this.onMouseDown},o().createElement("div",{className:"handle"},o().createElement("div",{className:"handle-label"},t)))}});const Ie=o().createClass({displayName:"Ruler",getPosition:function(e){for(var t=0,a=0;e;)t+=e.offsetLeft-e.scrollLeft+e.clientLeft,a+=e.offsetTop-e.scrollTop+e.clientTop,e=e.offsetParent;return{x:t,y:a}},onCursorChange:function(e){if(this.props.onCursorChange){var t=Ne.getRulerPixelToSec(this.props.zoom,e);this.props.onCursorChange(t)}},onMouseDown:function(e){this.isMouseDown=!0;var t=this.getPosition(this.rulerBody),a=e.clientX-t.x;this.onCursorChange(a),e.stopPropagation(),e.preventDefault()},onMouseMove:function(e){if(this.isMouseDown){var t=this.getPosition(this.rulerBody),a=e.clientX-t.x;a<0&&(a=0),this.onCursorChange(a)}},onMouseUp:function(e){this.isMouseDown=!1},componentDidMount:function(){$(document).on("mouseup",this.onMouseUp),$(document).on("mousemove",this.onMouseMove),this.rulerBody=n().findDOMNode(this.refs.rulerBody),this.props.onComponentDidMount&&this.props.onComponentDidMount(),this.forceUpdate()},componentWillUnmount:function(e){$(document).off("mouseup",this.onMouseUp),$(document).off("mousemove",this.onMouseMove)},render:function(){var e,t,a,i,n=[];a=Ne.getRuler(this.props.zoom).hSpace,i=Ne.getRuler(this.props.zoom).secPerTick;for(var s=0;s++*a1?"tick-label tick-label-small":"tick-label tick-label-medium");var l=o().createElement("div",{key:s,className:e,style:{left:s*a+"px"}},o().createElement("div",{className:t}," ",M()(s*i).format("0.0")," "));n.push(l)}var r,c=Ne.getRulerSecToPixel(this.props.zoom,this.props.timelinePosition),d=this.getPosition(this.rulerBody),p={left:d.x,top:d.y,width:$(this.rulerBody).width(),height:$(this.rulerBody).height()};return this.props.showCursor&&(r=o().createElement(xe,{onUpdate:this.onCursorChange,pos:c,top:this.props.cursorTop,height:this.props.cursorHeight,frame:p,screenVisibleRange:this.props.screenVisibleRange,cursorLabel:this.props.timelinePosition})),o().createElement("div",{className:"ruler",ref:"rulerBody",onMouseDown:this.onMouseDown},r,o().createElement("div",null,n))}}),ke=o().createClass({displayName:"HScrollerBar",isMouseDown:!1,getInitialState:function(){return{pos:0}},onMouseDown:function(e){this.isMouseDown=!0,this.mouseDownPosX=e.screenX},onMouseMove:function(e){if(this.isMouseDown){e.stopPropagation(),e.preventDefault();var t=e.screenX-this.mouseDownPosX;this.mouseDownPosX=e.screenX;var a=this.state.pos+t,i=$(this.scrollbarBody).width(),n=$(this.scrollbarContainer).width();a+i>n&&(a=n-i),a<0&&(a=0),this.setState({pos:a}),this.props.onUpdate&&this.props.onUpdate(a)}},onMouseUp:function(e){this.isMouseDown=!1,this.props.onChange&&this.props.onChange(this.state.pos)},componentDidMount:function(){$(document).on("mousemove",this.onMouseMove),$(document).on("mouseup",this.onMouseUp),this.scrollbarBody=n().findDOMNode(this.refs.scrollbarBody),this.scrollbarContainer=n().findDOMNode(this.refs.scrollbarContainer)},componentWillUnmount:function(){$(document).off("mousemove",this.onMouseMove),$(document).off("mouseup",this.onMouseUp)},render:function(){var e={left:this.state.pos,width:this.props.contentCurrentWidth/this.props.contentWidth*100+"%"};return o().createElement("span",{className:"h-scrollbar",ref:"scrollbarContainer"},o().createElement("span",{className:"scrollbar",ref:"scrollbarBody",style:e,onMouseDown:this.onMouseDown}))}});var De=a(42880),Ae=a.n(De),Re=a(9769),Pe=a(82465),Te="All",Me="Discontinued",Oe="My Account",Le="Shared with my account";const Ve={getInitialState:function(){return{widgetList:[],filteredWidgets:[],widgetCategories:[],selectedModalWidgetTab:"",mouseOverModalWidgetTab:"",filter:"",isDevelopmentMode:!1,showBusyIcon:!1}},getWidgets:function(e){this.setState({showBusyIcon:!0});var t="/widgets/json";e&&(t+="?status="+e),S().get(t).set("Content-Type","application/json").end(function(e,t){if(e)this.setState({showBusyIcon:!1}),N.A.add(N.A.TYPE.ERROR,{title:"Cannot get widget from database",description:e.message});else{if(t.headers.location)return void(window.location=t.headers.location);var a=[],i=[],n=t.body;for(var s in h.A.addWidgets(n),n.forEach((function(e,t){if(e.type="widget",e.category){var a=parseInt(window.singularUser.account.accountId);a==e.account_id&&(e.category+="|"+Oe),a!=e.account_id&&0!=e.account_id&&(e.category+="|"+Le),e.category.split("|").forEach((function(e,t){i[e]?i[e]++:i[e]=1}))}})),i[Me]&&i[Oe]&&(i[Oe]-=i[Me]),i)a.push({name:s,count:i[s]});a.sort((function(e,t){return e.name==Me?1:t.name==Me?-1:e.name.localeCompare(t.name)})),a.forEach((function(e,t){e.name===Le&&(a.splice(t,1),a.unshift(e))})),a.forEach((function(e,t){e.name===Oe&&(a.splice(t,1),a.unshift(e))}));var o=n.length;i[Me]&&(o-=i[Me]),a.unshift({name:Te,count:o}),n.sort((function(e,t){return e.name.localeCompare(t.name)})),this.setState({widgetList:n,widgetCategories:a,selectedModalWidgetTab:Te}),this.filterWidget({name:Te,count:n.length}),this.setState({showBusyIcon:!1})}}.bind(this))},componentDidMount:function(){this.getWidgets(""),$("#widgetBrowserModal").on("show.bs.modal",function(){setTimeout((function(){$("#widget-search-box").focus(),$("#widget-search-box").select()}),500)}.bind(this))},developmentModeChanged:function(e,t){this.setState({isDevelopmentMode:t},function(){this.getWidgets(this.state.isDevelopmentMode?"development":"")}.bind(this))},onSearchBoxFilterChanged:function(e){this.setState({filter:e.target.value})},onSearchBoxFilterKeyDown:function(e){"Escape"==e.key&&""!=this.state.filter&&(this.setState({filter:""}),e.preventDefault(),e.stopPropagation())},clearSearchBox:function(){this.setState({filter:""})},renderModal:function(e,t){var a=function(e,t){return""!=this.state.filter.trim()&&-1==e.name.toLowerCase().indexOf(this.state.filter.trim().toLowerCase())?null:o().createElement("div",{key:e.id,className:e.name+"-widget browser-item-wrapper",title:e.description},o().createElement("div",{className:"component center-block",onClick:this.addWidget.bind(this,e)},o().createElement("div",{className:"icon"},o().createElement(ve.A,{src:e.thumbnail,fallbackImage:Re.getDefaultIconFromBrowserShortType(Pe.WIDGET),initialImage:"/images/loading-bubbles.svg"})),o().createElement("div",{className:"title",style:{textOverflow:"ellipsis",whiteSpace:"nowrap"}},e.name)))}.bind(this),i=function(e,t){var a=e.name;return e.name==this.state.selectedModalWidgetTab&&(a+=" active"),o().createElement("li",{key:e.name,className:a,onClick:this.filterWidget.bind(this,e),onMouseOver:this.modalTabMouseOver.bind(this,e)},e.name," ",o().createElement("span",{className:"pull-right"},e.count))}.bind(this),n=this.state.filter?"form-control dirty":"form-control",s=this.state.filter?"fa fa-times input-clear-icon":"fa fa-times input-clear-icon hidden";if(0==this.state.showBusyIcon)var l=o().createElement("div",{className:"panel-body"},o().createElement("div",{className:"row browser-tree component-tree font-tree"},"widget"==e?this.state.filteredWidgets.map(a):""));else l=o().createElement("div",{className:"panel-body"},o().createElement("div",{className:"row browser-tree component-tree font-tree",style:{width:"100%",height:"100%"}},o().createElement("img",{style:{margin:"0 auto"},src:"/images/loading-bubbles.svg",className:"loader"})));var r=null;return window.singularUser.account.permission.permDevTool&&(r=o().createElement("div",{className:"col-sm-4",style:{paddingTop:"5px"}},o().createElement("div",{style:{float:"right"}},"Show Dev Versions"),o().createElement("div",{style:{float:"right"}},o().createElement(se.A,{name:"a",title:"Development",value:this.state.isDevelopmentMode,onValueChanged:this.developmentModeChanged})))),o().createElement("div",{id:t,className:"modal fade u-displaynone singular-modal",tabIndex:"-1",role:"dialog",style:{overflow:"hidden"}},o().createElement("div",{className:"modal-dialog modal-lg",role:"document"},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-header"},o().createElement("button",{tabIndex:"-1",type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},o().createElement("span",{"aria-hidden":"true"},"×")),o().createElement("h4",{className:"modal-title",id:"myModalLabel"}," ","widget"==e?"Widgets":"Compositions")),o().createElement("div",{className:"modal-body"},o().createElement("div",{className:"row lists-wrapper"},o().createElement("div",{className:"col-sm-3 list-wrapper left-menu left-menu hidden-md-down"},o().createElement("div",{className:"panel full-modal"},o().createElement("div",{className:"panel-header"},"Categories"),o().createElement("div",{className:"panel-body"},o().createElement("ul",{className:"browser-tree font-tree"},"widget"==e?this.state.widgetCategories.map(i):"")))),o().createElement("div",{className:"col-sm-9 list-wrapper"},o().createElement("div",{className:"row fontBrowserOptions"},o().createElement("div",{className:"col-md-8"},o().createElement("i",{className:s,onClick:this.clearSearchBox}),o().createElement("input",{id:"widget-search-box",value:this.state.filter,className:n,style:{paddingLeft:"20px"},type:"text",onChange:this.onSearchBoxFilterChanged,onKeyDown:this.onSearchBoxFilterKeyDown}),o().createElement("i",{className:"fa fa-search input-icon"})),r),o().createElement("div",{className:"panel no-header"},l)))))))},filterWidget:function(e){var t=this.state.widgetList.filter((function(t,a){var i=t.category?t.category.split("|"):"";if(e.name===Te||-1!==i.indexOf(e.name)){if((e.name===Te||e.name===Oe||e.name===Le)&&-1!=i.indexOf(Me))return;return t}}));this.setState({filteredWidgets:t,selectedModalWidgetTab:e.name})},modalTabMouseOver:function(e){this.setState({mouseOverModalWidgetTab:e.name})}};var Fe=a(45659),_e=a.n(Fe),Be=a(33287),Ue=a.n(Be),We=a(56027),Ye=a(50313),je=a(9769);const He={onWidgetNameChange:function(e,t){var a={};a.name=t,this.props.sbRef.child("tiles").child(e).update(a),this.props.forceCompositionUpdate()},onWidgetDelete:function(e,t){var a=this,i=this.props.sbRef.child("groups").child(t.id).val();this.props.sbRef.beginBatch();var n=e.id,s=[],o=h.A.getWidgetById(e.widget,e.version);if(o&&o.model&&o.model.fields&&Array.isArray(o.model.fields)){var l=this.props.sbRef.child("data/"+n).val();o.model.fields.forEach((function(e){"composition"==e.type&&l[e.id]&&s.push(l[e.id])}))}this.props.sbRef.child("groups").child(i.id).child("items").child(n).remove(),this.props.sbRef.child("tiles").child(n).remove(),this.props.sbRef.child("data").child(n).remove(),this.props.sbRef.child("dataLinks").child(n).remove(),this.props.sbRef.child("nodeRefs").child(n).remove(),s.forEach((function(e){a.removeComposition(e)})),"composition"==e.type&&this.removeComposition(e.id);var r,c=[];for(var d in i.items)c.push(i.items[d]);c.sort((function(e,t){return(e.priority>t.priority)-.5}));for(var p=0;p=0&&(r=c[p-1].id),r){var m=this.props.sbRef.child("tiles").child(r).val();this.props.onWidgetSelect(null,m,i)}else this.props.onGroupSelect(i);this.props.sbRef.endBatch()},onWidgetDuplicate:function(e,t){this.onGroupDuplicate(t)},removeComposition:function(e){var t=this,a=this.props.sbRootRef.child("compositions").val(),i=[];We.A.getCompositionChildren(e,a,i),i.push(e),i.forEach((function(e){for(var i in t.props.sbRootRef.child("compositions").child(e).remove(),t.props.sbRootRef.child("compositionStates").child(e).remove(),We.A.COMPOSITION_PROPS.forEach((function(a){t.props.sbRootRef.child("compositionProps").child(a).child(e).remove()})),a){var n=a[i];if(n.tiles)for(var s in n.tiles)if(n.tiles[s].layout){var o=n.tiles[s].layout.events;if(o)for(var l in o)o[l].controlComp==e&&t.props.sbRootRef.child("compositions").child(i).child("tiles").child(s).child("layout").child("events").child(l).child("controlComp").remove()}}}))},onWidgetAdd:function(e){"widget"==e.type&&h.A.addWidget(e),this.props.sbRef.beginBatch();var t=this.props.sbRef.child("groups"),a=this.props.sbRef.child("tiles"),i=this.getGroupArray(),n=i[0],s=0;if(this.props.selection)if("group"==this.props.selection.type)(o=i.filter(function(e){if(e.id==this.props.selection.id)return e}.bind(this))).length>0&&(n=o[0]);else{var o=i.filter(function(e){for(var t in e.items)if(e.items[t].id==this.props.selection.id)return e}.bind(this));o.length>0&&(n=o[0],s=this.props.selection.id)}var l=t.child(n.id).child("items"),r=0,c=0,d=[];for(var p in n.items)d.push(n.items[p]);d.sort((function(e,t){return e.priority-t.priority-.5}));for(var m=0==s?1:0,u=0;u25&&e<75&&t<25?a="Top":e>75&&t<25?a="TopRight":e<25&&t>25&&t<75?a="Left":e>25&&e<75&&t>25&&t<75?a="Center":e>75&&t>25&&t<75?a="Right":e<25&&t>75?a="BottomLeft":e>25&&e<75&&t>75?a="Bottom":e>75&&t>75&&(a="BottomRight"),this.setState({selected:a})},onClick:function(e){if(1!=this.props.disabled){var t=0,a=0;switch(e){case"TopLeft":t=0,a=0;break;case"Top":t=50,a=0;break;case"TopRight":t=100,a=0;break;case"Left":t=0,a=50;break;case"Center":t=50,a=50;break;case"Right":t=100,a=50;break;case"BottomLeft":t=0,a=100;break;case"Bottom":t=50,a=100;break;case"BottomRight":t=100,a=100;break;default:return}this.props.onValueChanged&&this.props.onValueChanged(this.props.name,{x:t,y:a}),this.translateValuesIntoPresets(t,a)}},PropValueChanged:function(e,t){var a,i;"x"==e?(a=Number(t),i=Number(this.props.value.y)):(a=Number(this.props.value.x),i=Number(t)),this.props.onValueChanged(this.props.name,{x:a,y:i}),this.translateValuesIntoPresets(a,i)},render:function(){var e=o().createElement("svg",{width:"19",height:"19",viewBox:"0 0 19 19"},o().createElement("path",{d:"M10 13H9v3H6l3.5 3 3.5-3h-3v-3zm9-3.5L16 6v3h-3v1h3v3l3-3.5zM9.5 11c.8 0 1.5-.7 1.5-1.5S10.3 8 9.5 8 8 8.7 8 9.5 8.7 11 9.5 11z"})),t=o().createElement("svg",{width:"19",height:"19",viewBox:"0 0 19 19"},o().createElement("path",{d:"M3 6L0 9.5 3 13v-3h3V9H3V6zm16 3.5L16 6v3h-3v1h3v3l3-3.5zM10 13H9v3H6l3.5 3 3.5-3h-3v-3zm-.5-2c.8 0 1.5-.7 1.5-1.5S10.3 8 9.5 8 8 8.7 8 9.5 8.7 11 9.5 11z"})),a=o().createElement("svg",{width:"19",height:"19",viewBox:"0 0 19 19"},o().createElement("path",{d:"M10 16v-3H9v3H6l3.5 3 3.5-3h-3zM3 6L0 9.5 3 13v-3h3V9H3V6zm6.5 5c.8 0 1.5-.7 1.5-1.5S10.3 8 9.5 8 8 8.7 8 9.5 8.7 11 9.5 11z"})),i=o().createElement("svg",{width:"19",height:"19",viewBox:"0 0 19 19"},o().createElement("path",{d:"M10 13H9v3H6l3.5 3 3.5-3h-3v-3zm9-3.5L16 6v3h-3v1h3v3l3-3.5zM6 3h3v3h1V3h3L9.5 0 6 3zm5 6.5c0-.8-.7-1.5-1.5-1.5S8 8.7 8 9.5 8.7 11 9.5 11s1.5-.7 1.5-1.5z"})),n=o().createElement("svg",{width:"19",height:"19",viewBox:"0 0 19 19"},o().createElement("path",{d:"M3 6L0 9.5 3 13v-3h3V9H3V6zm7 7H9v3H6l3.5 3 3.5-3h-3v-3zm9-3.5L16 6v3h-3v1h3v3l3-3.5zM6 3h3v3h1V3h3L9.5 0 6 3zm5 6.5c0-.8-.7-1.5-1.5-1.5S8 8.7 8 9.5 8.7 11 9.5 11s1.5-.7 1.5-1.5z"})),s=o().createElement("svg",{width:"19",height:"19",viewBox:"0 0 19 19"},o().createElement("path",{d:"M9 6h1V3h3L9.5 0 6 3h3v3zm1 7H9v3H6l3.5 3 3.5-3h-3v-3zM3 6L0 9.5 3 13v-3h3V9H3V6zm5 3.5c0 .8.7 1.5 1.5 1.5s1.5-.7 1.5-1.5S10.3 8 9.5 8 8 8.7 8 9.5z"})),l=o().createElement("svg",{width:"19",height:"19",viewBox:"0 0 19 19"},o().createElement("path",{d:"M6 3h3v3h1V3h3L9.5 0 6 3zm13 6.5L16 6v3h-3v1h3v3l3-3.5zM9.5 8C8.7 8 8 8.7 8 9.5S8.7 11 9.5 11s1.5-.7 1.5-1.5S10.3 8 9.5 8z"})),r=o().createElement("svg",{width:"19",height:"19",viewBox:"0 0 19 19"},o().createElement("path",{d:"M3 6L0 9.5 3 13v-3h3V9H3V6zm16 3.5L16 6v3h-3v1h3v3l3-3.5zM6 3h3v3h1V3h3L9.5 0 6 3zm3.5 5C8.7 8 8 8.7 8 9.5S8.7 11 9.5 11s1.5-.7 1.5-1.5S10.3 8 9.5 8z"})),c=o().createElement("svg",{width:"19",height:"19",viewBox:"0 0 19 19"},o().createElement("path",{d:"M3 6L0 9.5 3 13v-3h3V9H3V6zm6 0h1V3h3L9.5 0 6 3h3v3zm.5 2C8.7 8 8 8.7 8 9.5S8.7 11 9.5 11s1.5-.7 1.5-1.5S10.3 8 9.5 8z"})),d=o().createElement("svg",{width:"19",height:"19",viewBox:"0 0 19 19"},o().createElement("rect",{x:"8",y:"8",width:"3",height:"3",rx:"2",fillRule:"evenodd"})),p=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15"},o().createElement("g",{fillRule:"evenodd",fill:"currentColor"},o().createElement("path",{d:"M6 8.293V1h1v7.293l.207.207L7 8.707V9h-.293L1.55 14.157l-.707-.707L6 8.293z",opacity:".3"}),o().createElement("path",{d:"M15 8.5L12 6v5l3-2.5zM6 8h6v1H6V8zm6.5-6.333L11.25 0H10l1.875 2.5L10 5h1.25l1.25-1.667L13.75 5H15l-1.875-2.5L15 0h-1.25L12.5 1.667z"}))),m=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15"},o().createElement("g",{fillRule:"evenodd",fill:"currentColor"},o().createElement("path",{d:"M6.293 8H6v.293L.843 13.45l.707.707L6.707 9H14V8H6.707L6.5 7.793 6.293 8z",opacity:".3"}),o().createElement("path",{d:"M6.5 0L4 3h5L6.5 0zM6 9V3h1v6H6zm6.5-7.506L13.753 0H15l-2 2.5V5h-1V2.5L10 0h1.25l1.25 1.494z"}))),u=function(e,t){return this.state.selected!=e&&(t=d),o().createElement("div",{className:"anchorGizmoElement",onClick:this.onClick.bind(this,e)},t)}.bind(this),h=o().createElement("div",{className:"anchorGizmo"},o().createElement("div",{className:"anchorGizmoValues"},o().createElement("div",{className:"form-inline"},o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,p),o().createElement("td",null,o().createElement(te.A,{name:"x",resetValue:50,step:.1,unit:"%",format:"0.0[0]",min:0,max:100,value:this.props.value.x,onValueChanged:this.PropValueChanged,disabled:this.props.disabled}))),o().createElement("tr",null,o().createElement("td",null,m),o().createElement("td",null,o().createElement(te.A,{name:"y",title:m,resetValue:50,step:.1,unit:"%",format:"0.0[0]",min:0,max:100,value:this.props.value.y,onValueChanged:this.PropValueChanged,disabled:this.props.disabled}))))))),o().createElement("div",{className:"form-group anchorGizmoFrame",disabled:this.props.disabled},u("TopLeft",e),u("Top",t),u("TopRight",a),o().createElement("br",null),u("Left",i),u("Center",n),u("Right",s),o().createElement("br",null),u("BottomLeft",l),u("Bottom",r),u("BottomRight",c)));return this.props.renderInline&&(h=o().createElement("tr",null,o().createElement("td",null,o().createElement("div",{style:{margin:"8px 0px 16px 0px"}},p),o().createElement("div",null,m)),o().createElement("td",{className:"rotation-prop"},o().createElement(te.A,{name:"x",resetValue:50,step:.1,unit:"%",format:"0.0[0]",min:0,max:100,value:this.props.value.x,onValueChanged:this.PropValueChanged,disabled:this.props.disabled}),o().createElement(te.A,{name:"y",title:m,resetValue:50,step:.1,unit:"%",format:"0.0[0]",min:0,max:100,value:this.props.value.y,onValueChanged:this.PropValueChanged,disabled:this.props.disabled})),o().createElement("td",{rowSpan:"2"},o().createElement("div",{className:"form-group anchorGizmoFrame",disabled:this.props.disabled,style:{marginLeft:"10px",marginTop:"3px !important"}},u("TopLeft",e),u("Top",t),u("TopRight",a),o().createElement("br",null),u("Left",i),u("Center",n),u("Right",s),o().createElement("br",null),u("BottomLeft",l),u("Bottom",r),u("BottomRight",c))))),h}});const $e=Ge;var Ke=a(76716),qe=a(74199);function Je(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a"),a.compositionDataNodes[o]);if(this.props.compositionStack&&this.props.compositionStack.length>1){var l,r,c="",d=function(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=function(e,t){if(e){if("string"==typeof e)return Je(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Je(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,l=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return o=e.done,e},e:function(e){l=!0,s=e},f:function(){try{o||null==a.return||a.return()}finally{if(l)throw s}}}}(this.props.compositionStack);try{for(d.s();!(r=d.n()).done;){var p=r.value;if(p.inheritedProps.compositionDataNodes)for(var m in p.inheritedProps.compositionDataNodes)s(l+" / ",this.__getSourceLocation(c),p.inheritedProps.compositionDataNodes[m]);p.inheritedProps.compositionControlNode&&s(l+" / ",this.__getSourceLocation(c),p.inheritedProps.compositionControlNode),c="root"==p.compId?"":p.compId,l=void 0===l?"Root":p.name}}catch(e){d.e(e)}finally{d.f()}}var u=!1;a.compositionControlNode&&(u=s("",this.__getSourceLocation(""),a.compositionControlNode)),0==u&&i.push({node:{name:"Control Node"}}),a.compositionWidgetNode&&s("",this.__getSourceLocation(""),a.compositionWidgetNode,"widgetNode"),this.setState({availableNodes:i},function(){if(!n){var e=null;i.length&&(e=i[i.length-1].node),e&&this.showFieldInDataNode(e,!0)}}.bind(this))}},__getSourceLocation:function(e){return[e,"dataSources","composition"]},showFieldInDataNode:function(e,t,a){var i=null,n=null;if(e&&e.item){a?i=a:this.currentStores.dataLink&&this.currentStores.dataLink[this.props.nodeRefKey]&&(i=this.currentStores.dataLink[this.props.nodeRefKey]);var s=[],o=e.item.model.fields,l=0;for(var r in e.payload){var c=r,d="",p="",m=l++;for(var u in o)if(r==o[u].id){(c=o[u].title)!=o[u].id&&(c+=" ("+o[u].id+")"),d=o[u].type,void 0!==o[u].index&&(m=o[u].index),p=u;break}"infotext"!=d&&(s.push({sourceInfo:{sourceIndex:e.index,sourceKey:r,sourceKeyId:p,sourceType:e.type,sourceLocation:e.sourceLocation,sortIndex:m},name:r,title:c}),i&&t&&i.sourceKey==r&&(n=c))}var h=s.sort((function(e,t){return e.sourceInfo.sortIndex>t.sourceInfo.sortIndex?1:e.sourceInfo.sortIndex")}),this.getAvailableNodes()},isDuplicateControlName:function(e){if(this.currentStores.compositionControlNode){var t=this.currentStores.compositionControlNode.model;if(e&&t&&t.fields)for(var a in t.fields)if(t.fields[a]&&t.fields[a].id==e)return!0}return!1},setNewFieldName:function(e){void 0===e&&(this.props.widgetName&&(e=this.props.widgetName),this.props.targetTitle&&(e+=" "+this.props.targetTitle));var t=!0;""!=e&&(t=this.isDuplicateControlName(e)),this.setState({newFieldName:e,disableAddButton:t})},onNewFieldNameChange:function(e){this.setNewFieldName(e.target.value)},handleKeyDown:function(e){if(".[]#$/\\".includes(e.key))return e.preventDefault(),void e.stopPropagation();"Enter"===e.key&&this.addAutoControlNode()},render:function(){if(!this.props.enableDataLink)return null;var e,t=function(e,t){var a;switch(e.node.type){case"dataNode":a=o().createElement("i",{className:"fa fa-database",style:{width:"15px",textAlign:"center"}});break;case"widgetNode":a=o().createElement("i",{className:"fa fa-wrench",style:{width:"15px",textAlign:"center"}});break;default:a=o().createElement("i",{className:"fa fa-gamepad",style:{width:"15px",textAlign:"center"}})}return o().createElement("li",{key:t,onClick:this.showFieldInDataNode.bind(this,e.node,!1,null)},o().createElement("a",null,a," ",e.node.name))}.bind(this),a=this.state.filterValue.trim().toLowerCase(),i=function(e,t){return""!=a&&-1===e.title.toLowerCase().indexOf(a)?null:o().createElement("li",{key:t,onClick:this.selectDataField.bind(this,e.sourceInfo)},o().createElement("a",null,e.title))}.bind(this);this.currentStores.dataLink&&this.currentStores.dataLink[this.props.nodeRefKey]?e=o().createElement("button",{type:"button",className:"btn btn-danger width160",tabIndex:"-1",onClick:this.unlinkDataField},"Unlink"):(this.state.selectedDataNode&&"controlNode"==this.state.selectedDataNode.type&&this.state.selectedDataNode.sourceLocation&&""==this.state.selectedDataNode.sourceLocation[0]&&!this.state.selectedFieldName||this.state.selectedDataNode&&void 0===this.state.selectedDataNode.item)&&!this.props.disableAddToControlNodeButton&&(e=o().createElement("div",{style:{display:"flex"}},o().createElement("input",{type:"text",style:{top:"1px",marginRight:"3px"},placeholder:"enter unique name",className:"form-control",onChange:this.onNewFieldNameChange,onKeyDown:this.handleKeyDown,value:this.state.newFieldName}),o().createElement("button",{className:"btn btn-default",style:{flex:"0 1 50px"},tabIndex:"-1",onClick:this.addAutoControlNode,disabled:this.state.disableAddButton},"Add")));var n,s,l=o().createElement("div",{className:"selector",style:{width:"250px",marginLeft:"10px"}},e),r="Select a field";this.state.selectedFieldName&&(r=this.state.selectedFieldName),n=this.state.dropDownOpen?o().createElement("input",{type:"text",className:"form-control",value:this.state.filterValue,placeholder:r,onChange:this.onFilterValueChanged,onKeyDown:this.onFilterKeyDown,style:{left:"-1px",top:"-2px",width:"calc(100% + 2px)",height:"100%",position:"absolute"},ref:"filterInputField"}):o().createElement("div",{style:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}},r),s=this.state.availableFields.length?o().createElement("div",{className:"selector",ref:"dropdownInput"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle width160 h-100","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},n,o().createElement("span",{className:"caret"})),o().createElement("ul",{className:"dropdown-menu"},this.state.availableFields.map(i))):o().createElement("div",{className:"selector",ref:"dropdownInput"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle width160",disabled:!0,"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},"No fields exist",o().createElement("span",{className:"caret"})));var c,d="Select a node";return this.state.selectedNodeName&&(d=this.state.selectedNodeName),c=this.state.availableNodes.length?o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle width160","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},o().createElement("div",{style:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}},d),o().createElement("span",{className:"caret"})):o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle width160",disabled:!0,"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},"No nodes exist",o().createElement("span",{className:"caret"})),o().createElement("div",{className:"row datanode-browser-inline"},o().createElement("div",{className:"col-12"},o().createElement("div",{className:"panel singular-panel"},o().createElement("div",{className:"panel-header"},"Link Browser"),o().createElement("div",{className:"panel-body",style:{display:"flex",flexDirection:"row"}},o().createElement("div",{className:"selector"},c,o().createElement("ul",{className:"dropdown-menu"},this.state.availableNodes.map(t))),s,l))))}});var Ze=a(9769);const Qe=o().createClass({displayName:"NodeRefFieldWrapper",mixins:[W.A],componentWillMount:function(){var e=this.props.nodeRefParams.params;this.sBindAsObject(e.sbCompositionRef.child("nodeRefs").child(e.sbRef.key),"nodeRef")},componentWillUnmount:function(){this.sUnbind("nodeRef")},render:function(){var e=this.props.nodeRefParams.params,t="linkable",a=Ze.genNodeRefKeyFromLocation(this.props.nodeRefParams.targetLocation);this.state.nodeRef&&this.state.nodeRef[a]&&(t="linked");var i={},n=["nodeRefParams","name","onValueChanged","children"];for(var s in this.props)n.includes(s)||(i[s]=this.props[s]);var l=o().createElement(de(),{id:"popover",className:"popover-animate-opacity"},o().createElement(Xe,{sbRef:e.sbRef,sbCompositionRef:e.sbCompositionRef,compositionStack:e.compositionStack,rootRtdbRef:e.rootRtdbRef,nodeRefKey:a,targetLocation:this.props.nodeRefParams.targetLocation,widgetName:e.sbRef.val().name,targetTitle:this.props.nodeRefParams.targetTitle?this.props.nodeRefParams.targetTitle:this.props.nodeRefParams.title,fieldType:e.fieldType,fieldProperties:i,enableDataLink:!0,disableDataNode:this.props.disableDataNode,disableAddToControlNodeButton:this.props.disableAddToControlNodeButton})),r=o().createElement(j(),{trigger:"click",rootClose:!0,animation:!1,placement:"bottom",overlay:l},o().createElement("span",null,this.props.nodeRefParams.title)),c={};$.extend(!0,c,this.props,{disabled:"linked"==t});var d=o().cloneElement(e.inputElement,c);return o().createElement("tr",null,o().createElement("td",{className:t+" label-col"},o().createElement("span",null,r)),o().createElement("td",null,d,this.props.children))}});var et=a(97376),tt=a(9769);const at=o().createClass({displayName:"TransformProperties",mixins:[W.A,pe.A],localData:{lockSizeFactor:0},getInitialState:function(){return{}},componentWillMount:function(){this.sBindAsObject(this.props.sbRef.child("layout"),"layout")},componentDidMount:function(){this.calculateLockSizeFactor(this.state.layout.lockSize)},shouldComponentUpdate:function(e,t){return!1===this.props.active&&!0===e.active||0==tt.compareObject(this.state.layout,t.layout)||0==tt.compareObject(this.props.settings,e.settings)},render:function(){if(!1===this.props.active)return!1;var e=this.state.layout,t=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",className:"svg-label"},o().createElement("g",{fill:"currentColor",fillRule:"evenodd"},o().createElement("path",{d:"M6 8.293V1h1v7.293l.207.207L7 8.707V9h-.293L1.55 14.157l-.707-.707L6 8.293z",opacity:".3"}),o().createElement("path",{d:"M15 8.5L12 6v5l3-2.5zM6 8h6v1H6V8zm6.5-6.333L11.25 0H10l1.875 2.5L10 5h1.25l1.25-1.667L13.75 5H15l-1.875-2.5L15 0h-1.25L12.5 1.667z"}))),a=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",className:"svg-label"},o().createElement("g",{fill:"currentColor",fillRule:"evenodd"},o().createElement("path",{d:"M6.293 8H6v.293L.843 13.45l.707.707L6.707 9H14V8H6.707L6.5 7.793 6.293 8z",opacity:".3"}),o().createElement("path",{d:"M6.5 0L4 3h5L6.5 0zM6 9V3h1v6H6zm6.5-7.506L13.753 0H15l-2 2.5V5h-1V2.5L10 0h1.25l1.25 1.494z"}))),i=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",className:"svg-label"},o().createElement("g",{fill:"currentColor",fillRule:"evenodd"},o().createElement("path",{id:"svg_3",opacity:"0.3",d:"m2.87501,12.60548l0,-8.91799l1,0l0,8.91799l-1,0z",stroke:"null"}),o().createElement("path",{id:"svg_4",d:"m13.25003,3.37501l-3.16666,-2.5l0,5l3.16666,-2.5zm-3.16666,-0.5l0,1l-7.20837,0l0,-0.87501l7.20837,-0.12499z",stroke:"null"}),o().createElement("path",{id:"svg_5",d:"m9.18757,8.85438l-1.25,-1.667l-1.25,0l1.875,2.5l-1.875,2.5l1.25,0l1.25,-1.667l1.25,1.667l1.25,0l-1.875,-2.5l1.875,-2.5l-1.25,0l-1.25,1.667z"}))),n=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",className:"svg-label"},o().createElement("g",{fill:"currentColor",fillRule:"evenodd"},o().createElement("path",{id:"svg_3",opacity:"0.3",d:"m7.43748,6.54302l0,-8.91799l1,0l0,8.91799l-1,0z",stroke:"null",transform:"rotate(90 7.9374799728393555,2.084024906158448) "}),o().createElement("path",{id:"svg_4",d:"m8.25005,6.81249l-3.16666,-2.5l0,5l3.16666,-2.5zm-3.16666,-0.5l0,1l-7.20837,0l0,-0.87501l7.20837,-0.12499z",stroke:"null",transform:"rotate(90 3.062541246414184,6.812479972839356) "}),o().createElement("path",{d:"m9.25001,7.49393l1.253,-1.494l1.247,0l-2,2.5l0,2.5l-1,0l0,-2.5l-2,-2.5l1.25,0l1.25,1.494z",id:"svg_4"}))),s=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",className:"svg-label"},o().createElement("g",{fill:"currentColor",fillRule:"evenodd"},o().createElement("path",{d:"M7 8h7v1H6l1-1zM6 1h1v7L6 9V1z",opacity:".3"}),o().createElement("path",{d:"M0 15h4l-4-4v4zm6.85-6.15l-4.5 4.5-.7-.7 4.5-4.5.7.7zM15 1h-1.25L11 4h1.25L15 1zm-4-1h4v1h-4V0zm0 4h4v1h-4V4z"}))),l=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",className:"svg-label"},o().createElement("path",{d:"M12.5 1.667L11.25 0H10l1.875 2.5L10 5h1.25l1.25-1.667L13.75 5H15l-1.875-2.5L15 0h-1.25L12.5 1.667zM2.017 9.997C2.172 12.774 3.613 15 5.502 15 7.502 15 9 12.502 9 9.5S7.502 4 5.502 4c-1.127 0-2.094.792-2.724 2.02h1.16C4.374 5.38 4.925 5 5.5 5 6.814 5 8 6.98 8 9.5S6.814 14 5.502 14c-1.225 0-2.34-1.723-2.484-4.002h1.99L2.504 7.01 0 9.998h2.017z",fill:"currentColor",fillRule:"evenodd"})),r=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",className:"svg-label"},o().createElement("path",{d:"M12.5 1.494L13.753 0H15l-2 2.5V5h-1V2.5L10 0h1.25l1.25 1.494zm-6.502 11.49C8.773 12.827 11 11.386 11 9.497 11 7.497 8.502 6 5.5 6S0 7.498 0 9.498c0 1.127.792 2.094 2.02 2.724v-1.16C1.38 10.626 1 10.075 1 9.5 1 8.186 2.98 7 5.5 7S10 8.186 10 9.498c0 1.225-1.723 2.34-4.002 2.484v-1.99L3.01 12.496 5.998 15v-2.017z",fill:"currentColor",fillRule:"evenodd"})),c=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",className:"svg-label"},o().createElement("path",{d:"M4.988 4.01a5.547 5.547 0 0 0-3.394 1.606c-2.125 2.125-2.125 5.666 0 7.79 2.124 2.125 5.666 2.125 7.79 0 2.054-2.053 2.125-5.24.354-7.435l-.708.71c1.346 1.77 1.346 4.32-.283 5.95-1.842 1.84-4.675 1.84-6.445.07a4.488 4.488 0 0 1 0-6.372A4.685 4.685 0 0 1 4.988 5.01v1.998l3.005-2.504L4.988 2v2.01zM15 1h-1.25L11 4h1.25L15 1zm-4-1h4v1h-4V0zm0 4h4v1h-4V4z",fill:"currentColor",fillRule:"evenodd"})),d="constrain-proportion-selector";1==e.lockSize&&(d+=" locked");var p=[{unit:"%",step:"0.1",resetValue:"0.0",format:"0.0[0]"},{unit:"px",step:"1",resetValue:"0",format:"0"}],m=[{unit:"%",step:"0.1",resetValue:"100.0",format:"0.0[0]",min:"0.0",max:"10000.0"},{unit:"px",step:"1",resetValue:"300",format:"0",min:"0",max:"10000"}],u="group"==this.props.type?"groups":"tiles",h={sbRef:this.props.sbRef,sbCompositionRef:this.props.sbCompositionRef,compositionStack:this.props.compositionStack,rootRtdbRef:this.props.rootRtdbRef,fieldType:"number",inputElement:o().createElement(te.A,null)},f=null,g=null;return 1==(this.props.settings&&this.props.settings.perspectiveActive)?(f=o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,l," "),o().createElement("td",null,o().createElement(te.A,{name:"rotateX",resetValue:0,step:.1,format:"0.0[0]",min:-9999,max:9999,value:e.rotateX,unit:"deg",onValueChanged:this.PropValueChanged}))),o().createElement("tr",null,o().createElement("td",null,r),o().createElement("td",null,o().createElement(te.A,{name:"rotateY",resetValue:0,step:.1,format:"0.0[0]",min:-9999,max:9999,value:e.rotateY,unit:"deg",onValueChanged:this.PropValueChanged}))),o().createElement("tr",null,o().createElement("td",null,c),o().createElement("td",null,o().createElement(te.A,{name:"rotateZ",resetValue:0,step:.1,format:"0.0[0]",min:-9999,max:9999,value:e.rotateZ,unit:"deg",onValueChanged:this.PropValueChanged})))),g=o().createElement("tr",null,o().createElement("td",null,s),o().createElement("td",null,o().createElement(te.A,{name:"zPos",resetValue:0,step:1,format:"0",value:e.zPos,unit:"px",onValueChanged:this.PropValueChanged})))):f=o().createElement("tbody",null,o().createElement(Qe,{nodeRefParams:{title:c,targetTitle:"Rotate Z",params:h,targetLocation:["",u,"","layout","rotateZ"]},name:"rotateZ",resetValue:0,step:.1,format:"0.0[0]",min:-9999,max:9999,value:e.rotateZ,unit:"deg",onValueChanged:this.PropValueChanged})),o().createElement("div",{className:"element-properties-wrapper"},o().createElement("div",{className:"panel panel-default panel-element narrow grouped-properties"},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"position")}),o().createElement("span",{className:"panel-label"},"Position")),o().createElement("table",{className:"singular-form"},o().createElement("tbody",null,o().createElement(Qe,{nodeRefParams:{title:i,targetTitle:"Position X",params:h,targetLocation:["",u,"","layout","left"]},name:"left",resetValue:0,step:1,format:"0.0",unitCollection:p,value:e.left,unitName:"leftUnit",unit:e.leftUnit,onValueChanged:this.PropValueChanged}),o().createElement(Qe,{nodeRefParams:{title:n,targetTitle:"Position Y",params:h,targetLocation:["",u,"","layout","top"]},name:"top",resetValue:0,step:1,format:"0.0",unitCollection:p,value:e.top,unitName:"topUnit",unit:e.topUnit,onValueChanged:this.PropValueChanged}),g)))),o().createElement("div",{className:"panel panel-default panel-element narrow grouped-properties"},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"size")}),o().createElement("span",{className:"panel-label"},"Size")),o().createElement("table",{className:"singular-form"},o().createElement("tbody",null,o().createElement(Qe,{nodeRefParams:{title:t,targetTitle:"Width",params:h,targetLocation:["",u,"","layout","width"]},name:"width",resetValue:100,step:.1,format:"0.0[0]",unitCollection:m,min:0,max:1e4,value:e.width,unitName:"widthUnit",unit:e.widthUnit,onValueChanged:this.SizeValueChanged}),o().createElement(Qe,{nodeRefParams:{title:a,targetTitle:"Height",params:h,targetLocation:["",u,"","layout","height"]},name:"height",resetValue:100,step:.1,format:"0.0[0]",unitCollection:m,min:0,max:1e4,value:e.height,unitName:"heightUnit",unit:e.heightUnit,onValueChanged:this.SizeValueChanged},o().createElement("div",{onClick:this.lockSizeClicked,className:d,style:{right:"0px"}})))))),o().createElement("div",{className:"panel panel-default panel-element narrow grouped-properties"},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"rotation")}),o().createElement("span",{className:"panel-label"},"Rotation")),o().createElement("table",{className:"singular-form"},f))),o().createElement("div",{className:"panel panel-default panel-element narrow grouped-properties"},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"anchor")}),o().createElement("span",{className:"panel-label"},"Anchor Point")),o().createElement("table",null,o().createElement("tbody",null,o().createElement($e,{name:"anchor",resetValue:{x:50,y:50},value:e.anchor,onValueChanged:this.AnchorValueChanged,renderInline:!0}))))))},PropertyPaste:function(e){var t=this.onFetchClipBoardData("layout");if(t)switch(e){case"position":this.props.sbRef.child("layout").update({left:t.left,leftUnit:t.leftUnit,top:t.top,topUnit:t.topUnit,zPos:t.zPos});break;case"rotation":this.props.sbRef.child("layout").update({rotateX:t.rotateX,rotateY:t.rotateY,rotateZ:t.rotateZ});break;case"size":this.props.sbRef.child("layout").update({width:t.width,widthUnit:t.widthUnit,height:t.height,heightUnit:t.heightUnit,lockSize:t.lockSize}),this.calculateLockSizeFactor(t.lockSize,t.width,t.height);break;case"anchor":this.props.sbRef.child("layout").update({anchor:t.anchor})}},PropValueChanged:function(e,t){tt.compareObject(this.props.sbRef.child("layout").child(e).val(),t)||this.props.sbRef.child("layout").child(e).set(t)},SizeValueChanged:function(e,t,a){if(1==this.state.layout.lockSize&&("heightUnit"==e||"widthUnit"==e))return(n={}).heightUnit=t,n.widthUnit=t,void this.props.sbRef.child("layout").update(n);if(1==this.state.layout.lockSize&&("height"==e||"width"==e)){var i=Number(t);if(t===this.state.layout[e])return;var n={};return"width"==e?(0==this.localData.lockSizeFactor?n.height=i:n.height=M()(i/this.localData.lockSizeFactor).format(a.toString()),n.width=t):(0==this.localData.lockSizeFactor?n.width=i:n.width=M()(i*this.localData.lockSizeFactor).format(a.toString()),n.height=t),void this.props.sbRef.child("layout").update(n)}this.props.sbRef.child("layout").child(e).set(t)},lockSizeClicked:function(){var e={};e.lockSize=!this.state.layout.lockSize,1==e.lockSize&&(e.heightUnit=this.state.layout.widthUnit),this.props.sbRef.child("layout").update(e),this.calculateLockSizeFactor(e.lockSize)},calculateLockSizeFactor:function(e,t,a){void 0===t&&(t=this.state.layout.width),null==a&&(a=this.state.layout.height),0==e||0==Number(a)?this.localData.lockSizeFactor=0:this.localData.lockSizeFactor=Number(t)/Number(a)*1},AnchorValueChanged:function(e,t){var a={},i=0,n=0,s=Number(this.state.layout.width);this.state.layout.widthUnit;var o=Number(this.state.layout.height);this.state.layout.heightUnit,this.state.layout.anchor.x!=t.x&&(i=(Number(this.state.layout.anchor.x)-t.x)*(100-s)/100),this.state.layout.anchor.y!=t.y&&(n=(Number(this.state.layout.anchor.y)-t.y)*(100-o)/100),this.state.layout.leftUnit,this.state.layout.topUnit,a.left=Number(this.state.layout.left)+i,a.top=Number(this.state.layout.top)+n,a.anchor=t;var l=this.props.sbRef.child("layout").val();tt.compareObject(l.anchor,a.anchor)&&l.left==a.left&&l.top==a.top||this.props.sbRef.child("layout").update(a)}});var it=a(31486),nt=(a(92643),a(9769)),st=a(57437);const ot=o().createClass({displayName:"EffectProperties",mixins:[W.A,pe.A],localData:{lockSizeFactor:0},getInitialState:function(){return{}},componentWillMount:function(){this.sBindAsObject(this.props.sbRef.child("layout"),"layout")},componentDidMount:function(){this.calculateLockScaleFactor(this.state.layout.lockScale)},shouldComponentUpdate:function(e,t){return!nt.compareObject(t,this.state)||!nt.compareObject(e,this.props)},render:function(){if(!1===this.props.active)return!1;var e=this.state.layout,t="constrain-proportion-selector";1==e.lockScale&&(t+=" locked");var a,i,n=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",className:"svg-label"},o().createElement("g",{fill:"currentColor",fillRule:"evenodd"},o().createElement("path",{d:"M6 8.293V1h1v7.293l.207.207L7 8.707V9h-.293L1.55 14.157l-.707-.707L6 8.293z",opacity:".3"}),o().createElement("path",{d:"M15 8.5L12 6v5l3-2.5zM6 8h6v1H6V8zm6.5-6.333L11.25 0H10l1.875 2.5L10 5h1.25l1.25-1.667L13.75 5H15l-1.875-2.5L15 0h-1.25L12.5 1.667z"}))),s=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",className:"svg-label"},o().createElement("g",{fill:"currentColor",fillRule:"evenodd"},o().createElement("path",{d:"M6.293 8H6v.293L.843 13.45l.707.707L6.707 9H14V8H6.707L6.5 7.793 6.293 8z",opacity:".3"}),o().createElement("path",{d:"M6.5 0L4 3h5L6.5 0zM6 9V3h1v6H6zm6.5-7.506L13.753 0H15l-2 2.5V5h-1V2.5L10 0h1.25l1.25 1.494z"}))),l=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",className:"svg-label"},o().createElement("g",{fill:"currentColor",fillRule:"evenodd"},o().createElement("path",{id:"svg_3",opacity:"0.3",d:"m2.87501,12.60548l0,-8.91799l1,0l0,8.91799l-1,0z",stroke:"null"}),o().createElement("path",{id:"svg_4",d:"m13.25003,3.37501l-3.16666,-2.5l0,5l3.16666,-2.5zm-3.16666,-0.5l0,1l-7.20837,0l0,-0.87501l7.20837,-0.12499z",stroke:"null"}),o().createElement("path",{id:"svg_5",d:"m9.18757,8.85438l-1.25,-1.667l-1.25,0l1.875,2.5l-1.875,2.5l1.25,0l1.25,-1.667l1.25,1.667l1.25,0l-1.875,-2.5l1.875,-2.5l-1.25,0l-1.25,1.667z"}))),r=o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",className:"svg-label"},o().createElement("g",{fill:"currentColor",fillRule:"evenodd"},o().createElement("path",{id:"svg_3",opacity:"0.3",d:"m7.43748,6.54302l0,-8.91799l1,0l0,8.91799l-1,0z",stroke:"null",transform:"rotate(90 7.9374799728393555,2.084024906158448) "}),o().createElement("path",{id:"svg_4",d:"m8.25005,6.81249l-3.16666,-2.5l0,5l3.16666,-2.5zm-3.16666,-0.5l0,1l-7.20837,0l0,-0.87501l7.20837,-0.12499z",stroke:"null",transform:"rotate(90 3.062541246414184,6.812479972839356) "}),o().createElement("path",{d:"m9.25001,7.49393l1.253,-1.494l1.247,0l-2,2.5l0,2.5l-1,0l0,-2.5l-2,-2.5l1.25,0l1.25,1.494z",id:"svg_4"})));if(this.props.styles&&this.props.styles.length){var c=[{id:"",title:"No styles"}].concat(this.props.styles);a=o().createElement("tr",null,o().createElement("td",null,"Style"),o().createElement("td",null,o().createElement(ae.A,{key:"Style",name:"style",selections:c,value:this.props.item.style,onValueChanged:this.styleValueChanged})))}if("group"==this.props.type){var d=!1;void 0!==e.groupClipChildren&&(d=e.groupClipChildren);var p=!0;void 0!==e.groupBorderRadiusMode&&(p=e.groupBorderRadiusMode);var m=0,u=0,h=0,f=0;void 0!==e.groupBorderRadiusValueTL&&(m=e.groupBorderRadiusValueTL),void 0!==e.groupBorderRadiusValueTR&&(u=e.groupBorderRadiusValueTR),void 0!==e.groupBorderRadiusValueBL&&(h=e.groupBorderRadiusValueBL),void 0!==e.groupBorderRadiusValueBR&&(f=e.groupBorderRadiusValueBR);var g,v=!0;d&&(v=!1),g=p?o().createElement("div",null,o().createElement(te.A,{name:"groupBorderRadiusValueTL",resetValue:0,step:.1,unit:"%",format:"0.0",min:0,max:100,value:m,showSlider:!1,onValueChanged:this.BorderChanged,disabled:v})):o().createElement("div",null,o().createElement("div",{className:"border-field-icon"},o().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",style:{display:"block",transform:"translate(0px, 0px)"}},o().createElement("path",{opacity:".4",fillRule:"evenodd",clipRule:"evenodd",d:"M9 2h5v5h-2V4H9V2zm3 7h2v5H9v-2h3V9zM2 14V9h2v3h3v2H2z",fill:"currentColor"}),o().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 2a3 3 0 0 0-3 3v2h2V5a1 1 0 0 1 1-1h2V2H5z",fill:"currentColor"})),o().createElement(te.A,{name:"groupBorderRadiusValueTL",resetValue:0,step:.1,unit:"%",format:"0.0",min:0,max:100,value:m,showSlider:!1,onValueChanged:this.BorderChanged,disabled:v})),o().createElement("div",{className:"border-field-icon"},o().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",style:{display:"block",transform:"translate(0px, 0px)"}},o().createElement("path",{opacity:".4",fillRule:"evenodd",clipRule:"evenodd",d:"M14 9v5H9v-2h3V9h2zm-7 3v2H2V9h2v3h3zM2 2h5v2H4v3H2V2z",fill:"currentColor"}),o().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14 5a3 3 0 0 0-3-3H9v2h2a1 1 0 0 1 1 1v2h2V5z",fill:"currentColor"})),o().createElement(te.A,{name:"groupBorderRadiusValueTR",resetValue:0,step:.1,unit:"%",format:"0.0",min:0,max:100,value:u,showSlider:!1,onValueChanged:this.BorderChanged,disabled:v})),o().createElement("div",{className:"border-field-icon"},o().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",style:{display:"block",transform:"translate(0px, 0px)"}},o().createElement("path",{opacity:".4",fillRule:"evenodd",clipRule:"evenodd",d:"M7 14H2V9h2v3h3v2zM4 7H2V2h5v2H4v3zm10-5v5h-2V4H9V2h5z",fill:"currentColor"}),o().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 14a3 3 0 0 0 3-3V9h-2v2a1 1 0 0 1-1 1H9v2h2z",fill:"currentColor"})),o().createElement(te.A,{name:"groupBorderRadiusValueBL",resetValue:0,step:.1,unit:"%",format:"0.0",min:0,max:100,value:h,showSlider:!1,onValueChanged:this.BorderChanged,disabled:v})),o().createElement("div",{className:"border-field-icon"},o().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",style:{display:"block",transform:"translate(0px, 0px)"}},o().createElement("path",{opacity:".4",fillRule:"evenodd",clipRule:"evenodd",d:"M2 7V2h5v2H4v3H2zm7-3V2h5v5h-2V4H9zm5 10H9v-2h3V9h2v5z",fill:"currentColor"}),o().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 11a3 3 0 0 0 3 3h2v-2H5a1 1 0 0 1-1-1V9H2v2z",fill:"currentColor"})),o().createElement(te.A,{name:"groupBorderRadiusValueBR",resetValue:0,step:.1,unit:"%",format:"0.0",min:0,max:100,value:f,showSlider:!1,onValueChanged:this.BorderChanged,disabled:v})));var b={display:"grid",gridTemplateColumns:"auto auto auto",gridGap:"5px"};v&&(b.pointerEvents="none"),i=o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,"Clip Children"),o().createElement("td",null,o().createElement(se.A,{name:"groupClipChildren",value:d,onValueChanged:this.PropValueChanged}))),o().createElement("tr",null,o().createElement("td",{style:{verticalAlign:"top",paddingTop:"8px"}},"Border Radius"),o().createElement("td",null,o().createElement("div",{className:"border-radius",style:b,disabled:v},o().createElement("div",{style:{paddingTop:"8px"},className:"border-property-toggle"},o().createElement("svg",{onClick:this.PropValueChanged.bind(this,"groupBorderRadiusMode",!0),width:"16",height:"16",viewBox:"0 0 16 16",className:"border-radius-icon",style:{color:p&&!v?"rgb(235, 235, 235)":"rgb(115, 115, 115)",display:"block",transform:"translate(0px, 0px)"}},o().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 2a3 3 0 0 0-3 3v6a3 3 0 0 0 3 3h6a3 3 0 0 0 3-3V5a3 3 0 0 0-3-3H5zm0 2a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H5z",fill:"currentColor"}))),o().createElement("div",{style:{paddingTop:"8px"},className:"border-property-toggle"},o().createElement("svg",{onClick:this.PropValueChanged.bind(this,"groupBorderRadiusMode",!1),width:"16",height:"16",viewBox:"0 0 16 16",className:"border-radius-icon",style:{color:p||v?"rgb(115, 115, 115)":"rgb(235, 235, 235)",display:"block",transform:"translate(0px, 0px)"}},o().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 2a3 3 0 0 0-3 3v2h2V5a1 1 0 0 1 1-1h2V2H5zm6 0a3 3 0 0 1 3 3v2h-2V5a1 1 0 0 0-1-1H9V2h2zM5 14a3 3 0 0 1-3-3V9h2v2a1 1 0 0 0 1 1h2v2H5zm6 0a3 3 0 0 0 3-3V9h-2v2a1 1 0 0 1-1 1H9v2h2z",fill:"currentColor"}))),g)))))}var y,E,w=!0,S=this.props.settings;if(void 0!==S&&void 0!==S.perspectiveActive&&0!=S.perspectiveActive||(w=!1),1==w){var N=!1;void 0!==e.backfaceVisibility&&(N=e.backfaceVisibility),y=o().createElement("tr",null,o().createElement("td",null,"Backface Visibility"),o().createElement("td",null,o().createElement(se.A,{name:"backfaceVisibility",value:N,onValueChanged:this.PropValueChanged})))}(y||a||i)&&(E=o().createElement("div",{className:"panel panel-default panel-element grouped-properties"},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"renderOptions")}),o().createElement("span",{className:"panel-label"},"Render Options")),o().createElement("table",null,o().createElement("tbody",null,a,y)),i)));var C=st.opacity,x=st.filterBlur,I=st.filterBrightness,k=st.filterContrast,D=st.filterGrayscale,A=st.filterHueRotate,R=st.filterInvert,P=st.filterSaturate,T=st.filterSepia,M=st.filterDropShadowMode,O=st.filterDropShadowX,L=st.filterDropShadowY,V=st.filterDropShadowBlur,F=st.filterDropShadowSpread,_=st.filterDropShadowColor,B=st.filterDropShadowInset;void 0!==e.opacity&&(C=e.opacity),void 0!==e.filterBlur&&(x=e.filterBlur),void 0!==e.filterBrightness&&(I=e.filterBrightness),void 0!==e.filterContrast&&(k=e.filterContrast),void 0!==e.filterGrayscale&&(D=e.filterGrayscale),void 0!==e.filterHueRotate&&(A=e.filterHueRotate),void 0!==e.filterInvert&&(R=e.filterInvert),void 0!==e.filterSepia&&(T=e.filterSepia),void 0!==e.filterSaturate&&(P=e.filterSaturate),void 0!==e.filterDropShadowMode&&(M=e.filterDropShadowMode),void 0!==e.filterDropShadowX&&(O=e.filterDropShadowX),void 0!==e.filterDropShadowY&&(L=e.filterDropShadowY),void 0!==e.filterDropShadowBlur&&(V=e.filterDropShadowBlur),void 0!==e.filterDropShadowSpread&&(F=e.filterDropShadowSpread),void 0!==e.filterDropShadowColor&&(_=e.filterDropShadowColor),void 0!==e.filterDropShadowInset&&(B=e.filterDropShadowInset);var U="drop"==M,W="none"==M,Y="group"==this.props.type?"groups":"tiles",j={sbRef:this.props.sbRef,sbCompositionRef:this.props.sbCompositionRef,compositionStack:this.props.compositionStack,rootRtdbRef:this.props.rootRtdbRef,fieldType:"number",inputElement:o().createElement(te.A,null)};return o().createElement("div",{className:"element-properties-wrapper"},o().createElement("div",{className:"panel panel-default panel-element grouped-properties"},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"shadow")}),o().createElement("span",{className:"panel-label"},"Shadow")),o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,"Type"),o().createElement("td",null,o().createElement(ae.A,{name:"filterDropShadowMode",selections:[{id:"none",title:"None"},{id:"box",title:"Box Shadow"},{id:"drop",title:"Drop Shadow"}],value:M,onValueChanged:this.PropValueChanged}))),o().createElement("tr",null,o().createElement("td",null,l),o().createElement("td",null,o().createElement(te.A,{name:"filterDropShadowX",resetValue:0,step:1,unit:"px",format:"0",min:-100,max:100,value:O,showSlider:!1,onValueChanged:this.PropValueChanged,disabled:W}))),o().createElement("tr",null,o().createElement("td",null,r),o().createElement("td",null,o().createElement(te.A,{name:"filterDropShadowY",resetValue:0,step:1,unit:"px",format:"0",min:-100,max:100,value:L,showSlider:!1,onValueChanged:this.PropValueChanged,disabled:W}))),o().createElement("tr",null,o().createElement("td",null,"Blur"),o().createElement("td",null,o().createElement(te.A,{name:"filterDropShadowBlur",resetValue:0,step:1,unit:"px",format:"0",min:0,max:100,value:V,showSlider:!1,onValueChanged:this.PropValueChanged,disabled:W}))),o().createElement("tr",null,o().createElement("td",null,"Spread"),o().createElement("td",null,o().createElement(te.A,{name:"filterDropShadowSpread",resetValue:0,step:1,unit:"px",format:"0",min:-50,max:50,value:F,showSlider:!1,onValueChanged:this.PropValueChanged,disabled:W||U}))),o().createElement("tr",null,o().createElement("td",null,"Color"),o().createElement("td",null,o().createElement(it.A,{name:"filterDropShadowColor",value:_,onValueChanged:this.PropValueChanged,disabled:W}))),o().createElement("tr",null,o().createElement("td",null,"Inset"),o().createElement("td",null,o().createElement(se.A,{name:"filterDropShadowInset",value:B,onValueChanged:this.PropValueChanged,disabled:W||U}))))))),o().createElement("div",{className:"panel panel-default panel-element grouped-properties"},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"filters")}),o().createElement("span",{className:"panel-label"},"Filters")),o().createElement("table",{className:"singular-form"},o().createElement("tbody",null,o().createElement(Qe,{nodeRefParams:{title:"Visibility",params:{sbRef:this.props.sbRef,sbCompositionRef:this.props.sbCompositionRef,compositionStack:this.props.compositionStack,rootRtdbRef:this.props.rootRtdbRef,fieldType:"checkbox",inputElement:o().createElement(se.A,null)},targetLocation:["",Y,"","layout","visible"]},name:"visible",value:this.state.layout.visible,onValueChanged:this.PropValueChanged}),o().createElement(Qe,{nodeRefParams:{title:"Opacity",params:j,targetLocation:["",Y,"","layout","opacity"]},name:"opacity",resetValue:100,step:1,unit:"%",format:"0.0",min:0,max:100,value:C,showSlider:!1,onValueChanged:this.PropValueChanged}),o().createElement(Qe,{nodeRefParams:{title:"Brightness",params:j,targetLocation:["",Y,"","layout","filterBrightness"]},name:"filterBrightness",resetValue:100,step:1,unit:"%",format:"0.0",min:0,max:200,value:I,showSlider:!1,onValueChanged:this.PropValueChanged}),o().createElement(Qe,{nodeRefParams:{title:"Blur",params:j,targetLocation:["",Y,"","layout","filterBlur"]},name:"filterBlur",resetValue:0,step:1,unit:"px",format:"0",min:0,max:300,value:x,showSlider:!1,onValueChanged:this.PropValueChanged}),o().createElement(Qe,{nodeRefParams:{title:"Contrast",params:j,targetLocation:["",Y,"","layout","filterContrast"]},name:"filterContrast",resetValue:100,step:1,unit:"%",format:"0.0",min:0,max:200,value:k,showSlider:!1,onValueChanged:this.PropValueChanged}),o().createElement(Qe,{nodeRefParams:{title:"Grayscale",params:j,targetLocation:["",Y,"","layout","filterGrayscale"]},name:"filterGrayscale",resetValue:0,step:1,unit:"%",format:"0.0",min:0,max:100,value:D,showSlider:!1,onValueChanged:this.PropValueChanged}),o().createElement(Qe,{nodeRefParams:{title:"Hue",params:j,targetLocation:["",Y,"","layout","filterHueRotate"]},name:"filterHueRotate",resetValue:0,step:1,unit:"deg",format:"0.0",min:0,max:360,value:A,showSlider:!1,onValueChanged:this.PropValueChanged}),o().createElement(Qe,{nodeRefParams:{title:"Invert",params:j,targetLocation:["",Y,"","layout","filterInvert"]},name:"filterInvert",resetValue:0,step:1,unit:"%",format:"0.0",min:0,max:100,value:R,showSlider:!1,onValueChanged:this.PropValueChanged}),o().createElement(Qe,{nodeRefParams:{title:"Saturate",params:j,targetLocation:["",Y,"","layout","filterSaturate"]},name:"filterSaturate",resetValue:100,step:1,unit:"%",format:"0.0",min:0,max:500,value:P,showSlider:!1,onValueChanged:this.PropValueChanged}),o().createElement(Qe,{nodeRefParams:{title:"Sepia",params:j,targetLocation:["",Y,"","layout","filterSepia"]},name:"filterSepia",resetValue:0,step:1,unit:"%",format:"0.0",min:0,max:100,value:T,showSlider:!1,onValueChanged:this.PropValueChanged}),void 0)))),o().createElement("div",{className:"panel panel-default panel-element narrow grouped-properties"},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"scale")}),o().createElement("span",{className:"panel-label"},"Scale")),o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,n),o().createElement("td",null,o().createElement(te.A,{name:"scaleX",resetValue:100,step:1,format:"0.0",min:-1e4,max:1e4,value:e.scaleX,unit:"%",onValueChanged:this.ScaleValueChanged}))),o().createElement("tr",null,o().createElement("td",null,s),o().createElement("td",null,o().createElement(te.A,{name:"scaleY",resetValue:100,step:1,format:"0.0",min:-1e4,max:1e4,value:e.scaleY,unit:"%",onValueChanged:this.ScaleValueChanged}),o().createElement("div",{onClick:this.lockScaleClicked,className:t}))))))),o().createElement("div",{className:"panel panel-default panel-element narrow grouped-properties"},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"skew")}),o().createElement("span",{className:"panel-label"},"Skew")),o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,n),o().createElement("td",null,o().createElement(te.A,{name:"skewX",resetValue:0,step:1,format:"0.0",min:-89.9,max:89.9,value:e.skewX,unit:"deg",onValueChanged:this.PropValueChanged}))),o().createElement("tr",null,o().createElement("td",null,s),o().createElement("td",null,o().createElement(te.A,{name:"skewY",resetValue:0,step:1,format:"0.0",min:-89.9,max:89.9,value:e.skewY,unit:"deg",onValueChanged:this.PropValueChanged}))))))),void 0,E)},PropValueChanged:function(e,t){nt.compareObject(this.props.sbRef.child("layout").child(e).val(),t)||this.props.sbRef.child("layout").child(e).set(t)},BorderChanged:function(e,t){if("group"==this.props.type)if(void 0===this.state.layout.groupBorderRadiusMode||1==this.state.layout.groupBorderRadiusMode){var a={groupBorderRadiusMode:!0};a.groupBorderRadiusValueTL=t,a.groupBorderRadiusValueTR=t,a.groupBorderRadiusValueBL=t,a.groupBorderRadiusValueBR=t,this.props.sbRef.child("layout").update(a)}else this.props.sbRef.child("layout").child(e).set(t)},MaskValueChanged:function(e,t){var a={};null==this.state.layout.mask?(a.mask={},a.mask[e]=t,this.props.sbRef.child("layout").update(a)):(a[e]=t,this.props.sbRef.child("layout").child("mask").update(a))},styleValueChanged:function(e,t){this.props.sbRef.child("style").set(t)},ScaleValueChanged:function(e,t,a){if(1!=this.state.layout.lockScale||"scaleX"!=e&&"scaleY"!=e)this.props.sbRef.child("layout").child(e).set(t);else{var i=Number(t);if(t===this.state.layout[e])return;var n={};"scaleX"==e?(0==this.localData.lockScaleFactor?n.scaleY=i:n.scaleY=M()(i/this.localData.lockScaleFactor).format(a.toString()),n.scaleX=t):(0==this.localData.lockScaleFactor?n.scaleX=i:n.scaleX=M()(i*this.localData.lockScaleFactor).format(a.toString()),n.scaleY=t),this.props.sbRef.child("layout").update(n)}},lockScaleClicked:function(){var e=!this.state.layout.lockScale;this.props.sbRef.child("layout").child("lockScale").set(e),this.calculateLockScaleFactor(e)},calculateLockScaleFactor:function(e,t,a){void 0===t&&(t=this.state.layout.scaleX),null==a&&(a=this.state.layout.scaleY),0==e||0==Number(t)?this.localData.lockScaleFactor=0:this.localData.lockScaleFactor=Number(t)/Number(a)*1},PropertyPaste:function(e){var t=this.onFetchClipBoardData("layout");if(t){var a={},i=function(e){void 0!==t[e]&&(a[e]=t[e])};switch(e){case"shadow":i("filterDropShadowMode"),i("filterDropShadowX"),i("filterDropShadowY"),i("filterDropShadowBlur"),i("filterDropShadowSpread"),i("filterDropShadowColor"),i("filterDropShadowInset");break;case"filters":i("visible"),i("opacity"),i("filterBlur"),i("filterBrightness"),i("filterContrast"),i("filterGrayscale"),i("filterHueRotate"),i("filterInvert"),i("filterSepia"),i("filterSaturate"),i("blendMode");break;case"scale":this.props.sbRef.child("layout").update({lockScale:t.lockScale,scaleX:t.scaleX,scaleY:t.scaleY}),this.calculateLockScaleFactor(t.lockScale,t.scaleX,t.scaleY);break;case"skew":this.props.sbRef.child("layout").update({skewX:t.skewX,skewY:t.skewY});break;case"renderOptions":i("backfaceVisibility"),i("groupClipChildren"),i("style"),i("groupBorderRadiusMode"),i("groupBorderRadiusValueTL"),i("groupBorderRadiusValueTR"),i("groupBorderRadiusValueBL"),i("groupBorderRadiusValueBR");break;default:return}0!=Object.entries(a).length&&this.props.sbRef.child("layout").update(a)}}});var lt=a(2774);function rt(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=function(e,t){if(e){if("string"==typeof e)return ct(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?ct(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,l=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return o=e.done,e},e:function(e){l=!0,s=e},f:function(){try{o||null==a.return||a.return()}finally{if(l)throw s}}}}function ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a=n.length)&&this.setState({properyInMenuIndex:0});var s=this.state.selectedEvent;if(!t[s]){var o=Object.keys(t);"cursor"==(s=o[0])&&(s=o[1])}this.setState({filteredProperty:n,layout:a,event:t,selectedEvent:s})},componentWillMount:function(){this.props.sbRef.child("layout").on("value",this.updateEditor)},componentWillUnmount:function(){this.props.sbRef.child("layout").off("value",this.updateEditor)},componentDidMount:function(){},shouldComponentUpdate:function(e,t){return!1===this.props.active&&!0===e.active||0==pt.compareObject(this.props,e)||0==pt.compareObject(this.state,t)},render:function(){if(!1===this.props.active)return!1;var e,t,a,i,n,s=function(e,t){return o().createElement("li",{key:"property-"+t},o().createElement("a",{onClick:this.menuPropertyChanged.bind(this,t)},e.title))}.bind(this),l=function(e,t){return o().createElement("li",{key:"line"+t,className:this.state.selectedEvent==e?"active":""},o().createElement(se.A,{name:"active",value:this.state.event[e].active,onValueChanged:this.propertyChanged.bind(this,e)}),o().createElement("span",{onClick:this.selectEvent.bind(this,e)},pt.getTitleFromSelection(dt.EVENT_SELECTION,e)),o().createElement("i",{className:"fa fa-times-circle btn-delete",onClick:this.deleteEvent.bind(this,e)}))}.bind(this),r="None",c=!0;if(-1!=this.state.properyInMenuIndex&&this.state.filteredProperty.length>0&&(r=this.state.filteredProperty[this.state.properyInMenuIndex].title,c=!1),this.state.selectedEvent){var d=function(e,t){return o().createElement("li",{key:"mode-"+t},o().createElement("a",{onClick:this.propertyChanged.bind(this,this.state.selectedEvent,"controlMode",e.id)},e.title))}.bind(this),p=function(e,t){var a;return e.children&&(a=o().createElement("ul",{className:"sub-menu"},e.children.map(p))),o().createElement("li",{key:"comp-"+t},o().createElement("a",{onClick:this.propertyChanged.bind(this,this.state.selectedEvent,"controlComp",e.id)},e.name),a)}.bind(this),m=this.state.event[this.state.selectedEvent],u=!0;m.messageActive&&(u=!1);var h=!0;m.controlActive&&(h=!1),e=o().createElement("table",{style:{width:"100%"}},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{colSpan:"999"},o().createElement("h3",{style:{marginLeft:"-5px"}},"Send Message to Composition Script",o().createElement("div",{className:"group-panel-options pull-right"},o().createElement("span",null,"Active"),o().createElement(se.A,{name:"messageActive",value:m.messageActive,onValueChanged:this.propertyChanged.bind(this,this.state.selectedEvent)}))))),o().createElement("tr",{style:{height:"45px"}},o().createElement("td",null,"Info"),o().createElement("td",null,o().createElement(lt.A,{name:"messageInfo",value:m.messageInfo,disabled:u,onValueChanged:this.propertyChanged.bind(this,this.state.selectedEvent)}))),o().createElement("tr",null,o().createElement("td",{colSpan:"999"},o().createElement("h3",{style:{marginLeft:"-5px"}},"Control Sub-Composition",o().createElement("div",{className:"group-panel-options pull-right"},o().createElement("span",null,"Active"),o().createElement(se.A,{name:"controlActive",value:m.controlActive,onValueChanged:this.propertyChanged.bind(this,this.state.selectedEvent)}))))),o().createElement("tr",{style:{height:"45px"}},o().createElement("td",null,"Composition"),o().createElement("td",null,o().createElement("div",{className:"btn-group",style:{width:"170px"}},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:h},o().createElement("div",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},(t=this.state.compTree,a=m.controlComp,i=null,n=function(e,t){e.forEach((function(e){if(!i){if(e.id!=t)return e.children?n(e.children,t):void 0;i=e.name}}))},t&&n(t,a),i||"Select"))),o().createElement("ul",{className:"dropdown-menu nested"},this.state.compTree.map(p))))),o().createElement("tr",{style:{height:"45px"}},o().createElement("td",null,"Mode"),o().createElement("td",null,o().createElement("div",{className:"btn-group",style:{width:"170px"}},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:h},pt.getTitleFromSelection(dt.CONTROL_MODE_SELECTION,m.controlMode)),o().createElement("ul",{className:"dropdown-menu"},dt.CONTROL_MODE_SELECTION.map(d)))))))}var f=function(e,t){return o().createElement("li",{key:"property-"+t},o().createElement("a",{onClick:this.mouseCursorPropertyChanged.bind(this,e.id)},e.title))}.bind(this),g="Default";if(this.state.event.cursor){var v,b=rt(dt.MOUSE_CURSORS);try{for(b.s();!(v=b.n()).done;){var y=v.value;if(y.id==this.state.event.cursor){g=y.title;break}}}catch(e){b.e(e)}finally{b.f()}}var E,w=!pt.isInteractivityEnabled(this.state.layout),S=[],N=rt(dt.EVENT_SELECTION);try{for(N.s();!(E=N.n()).done;){var C=E.value;this.state.event[C.id]&&S.push(C.id)}}catch(e){N.e(e)}finally{N.f()}return o().createElement("div",{className:"element-properties-wrapper"},o().createElement("div",{className:"panel panel-default panel-element grouped-properties"},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"events")}),o().createElement("span",{className:"panel-label"},"Event")),o().createElement("div",{className:"",style:{margin:"0px",display:"flex",float:"left"}},o().createElement("div",{className:"",style:{padding:"0px",display:"flex"}},o().createElement("div",{className:"panel panel-default grouped-properties behavior-list"},o().createElement("div",{className:"input-group",style:{marginBottom:"5px"}},o().createElement("div",{className:"input-group-btn"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle",style:{width:"120px"},"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:c},r,o().createElement("span",{className:"caret"})),o().createElement("ul",{className:"dropdown-menu"},this.state.filteredProperty.map(s)),o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-primary",onClick:this.addEvent,disabled:c,style:{height:"29px"}},"Add"))),o().createElement("ul",{style:{height:"300px",overflow:"auto"}},S.map(l)))),o().createElement("div",{className:"",style:{display:"flex"}},o().createElement("div",{className:"panel panel-default grouped-properties behavior-properties",style:{width:"300px"}},e))))),o().createElement("div",{className:"panel panel-default panel-element grouped-properties"},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"miscellaneous")}),o().createElement("span",{className:"panel-label"},"Miscellaneous")),o().createElement("div",{className:"",style:{margin:"0px",display:"flex"}},o().createElement("div",{className:"",style:{padding:"0px",display:"flex"}},o().createElement("table",{style:{width:"100%"}},o().createElement("tbody",null,o().createElement("tr",{style:{height:"45px"}},o().createElement("td",null,"Mouse Pointer"),o().createElement("td",null,o().createElement("div",{className:"btn-group",style:{width:"170px"}},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle",style:{width:"120px"},"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:w},g,o().createElement("span",{className:"caret"})),o().createElement("ul",{className:"dropdown-menu"},dt.MOUSE_CURSORS.map(f))))))))))))},updateEventObject:function(e){this.props.sbRef.child("layout").child("events").set(e)},menuPropertyChanged:function(e){this.setState({properyInMenuIndex:e})},mouseCursorPropertyChanged:function(e){var t={};$.extend(!0,t,this.state.event),t.cursor=e,this.updateEventObject(t)},addEvent:function(){if(-1!=this.state.properyInMenuIndex&&null!=this.state.filteredProperty[this.state.properyInMenuIndex]){var e=this.state.filteredProperty[this.state.properyInMenuIndex].id,t={};$.extend(!0,t,this.state.event),t[e]={active:!0,messageActive:!0,messageInfo:"",controlActive:!1,controlComp:null,controlMode:"toggle"},this.updateEventObject(t)}},deleteEvent:function(e){var t={};$.extend(!0,t,this.state.event),delete t[e],this.updateEventObject(t)},selectEvent:function(e){this.setState({selectedEvent:e})},propertyChanged:function(e,t,a){var i={};$.extend(!0,i,this.state.event),i[e][t]=a,this.updateEventObject(i)},PropertyPaste:function(e){var t=this.onFetchClipBoardData("layout");if(t){if("events"==e)if(t.events){var a=Object.assign({},t.events);delete a.cursor,this.props.sbRef.child("layout").child("events").set(a)}else this.props.sbRef.child("layout").child("events").remove();if("miscellaneous"==e&&t.events){var i={cursor:t.events.cursor};this.props.sbRef.child("layout").child("events").set(i)}}}});function ut(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=function(e,t){if(e){if("string"==typeof e)return ht(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?ht(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,l=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return o=e.done,e},e:function(e){l=!0,s=e},f:function(){try{o||null==a.return||a.return()}finally{if(l)throw s}}}}function ht(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a=i.length)&&this.setState({properyInMenuIndex:0}),this.setState({filteredProperty:i,layout:a,adaptation:t})},componentWillMount:function(){this.props.sbRef.child("layout").on("value",this.updateEditor)},componentWillUnmount:function(){this.props.sbRef.child("layout").off("value",this.updateEditor)},componentDidMount:function(){},shouldComponentUpdate:function(e,t){return!1===this.props.active&&!0===e.active||0==gt.compareObject(this.props,e)||0==gt.compareObject(this.state,t)},updateAdaptationObject:function(e){this.props.sbRef.child("layout").child("adaptations").set(e)},menuPropertyChanged:function(e){this.setState({properyInMenuIndex:e})},addAdaptation:function(){if(-1!=this.state.properyInMenuIndex&&null!=this.state.filteredProperty[this.state.properyInMenuIndex]){var e=this.state.filteredProperty[this.state.properyInMenuIndex].id,t={active:!0};switch(e){case"interactive":t.value={},ft.ADAPTATION_INTERACTIVE.map((function(e){t.value[e.id]=!0}));break;case"screenSize":t.value={},ft.ADAPTATION_SCREEN_SIZES.map((function(e){t.value[e.id]=!0}));break;case"layout":t.value={},ft.ADAPTATION_LAYOUTS.map((function(e){t.value[e.id]=!0}));break;case"textDirection":t.value={},ft.ADAPTATION_TEXT_DIRECTIONS.map((function(e){t.value[e.id]=!0}));break;case"language":t.value="en",t.operation=ft.OPERATION_SELECTION[0].id;break;case"custom1":case"custom2":case"custom3":t.value="",t.operation=ft.OPERATION_SELECTION[0].id}var a={};$.extend(!0,a,this.state.adaptation),a[e]=t,this.updateAdaptationObject(a)}},deleteAdaptation:function(e){var t={};$.extend(!0,t,this.state.adaptation),delete t[e],this.updateAdaptationObject(t)},propertyChanged:function(e,t,a){var i={};$.extend(!0,i,this.state.adaptation),i[e][t]=a,this.updateAdaptationObject(i)},onToggleButtonChanged:function(e,t,a,i){if(i.ctrlKey||i.altKey){var n=Object.assign({},this.state.adaptation[e].value);n||(n={});var s,o=ut(this.getAdaptationList(e));try{for(o.s();!(s=o.n()).done;){var l=s.value.id;l!=t&&(n[l]?delete n[l]:n[l]||(n[l]=!0))}}catch(e){o.e(e)}finally{o.f()}this.propertyChanged(e,"value",n)}else this.onValueChanged(e,t,a)},onValueChanged:function(e,t,a){var i=Object.assign({},this.state.adaptation[e].value);i||(i={}),i[t]&&0==a?delete i[t]:i[t]||1!=a||(i[t]=!0),this.propertyChanged(e,"value",i)},onLanguageChanged:function(e,t){this.propertyChanged(e,"value",t)},onCustomChanged:function(e,t){this.propertyChanged(e,"value",t)},onOperationChanged:function(e,t){this.propertyChanged(e,"operation",t)},getAdaptationList:function(e){switch(e){case"interactive":return ft.ADAPTATION_INTERACTIVE;case"screenSize":return ft.ADAPTATION_SCREEN_SIZES;case"layout":return ft.ADAPTATION_LAYOUTS;case"textDirection":return ft.ADAPTATION_TEXT_DIRECTIONS}},render:function(){if(!1===this.props.active)return!1;var e=this.props.adaptationGlobals;e||(e={});var t=1;ft.ADAPTATION_INTERACTIVE.length>t&&(t=ft.ADAPTATION_INTERACTIVE.length),ft.ADAPTATION_SCREEN_SIZES.length-1>t&&(t=ft.ADAPTATION_SCREEN_SIZES.length-1),ft.ADAPTATION_LAYOUTS.length-1>t&&(t=ft.ADAPTATION_LAYOUTS.length-1),ft.ADAPTATION_TEXT_DIRECTIONS.length>t&&(t=ft.ADAPTATION_TEXT_DIRECTIONS.length);var a,i=100/(t+1),n=function(a){var n=this.state.adaptation[a];if(!n)return null;var s=function(e){var t=function(t,a){return o().createElement("li",{key:a},o().createElement("a",{onClick:this.onOperationChanged.bind(this,e,t.id)},t.title))}.bind(this);return o().createElement("div",{className:"btn-group"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},gt.getTitleFromSelection(ft.OPERATION_SELECTION,n.operation)),o().createElement("ul",{className:"dropdown-menu"},ft.OPERATION_SELECTION.map(t)))}.bind(this);if("language"==a){var l="fa fa-eye-slash";g().checkString(n,e[a])&&(l="fa fa-eye");var r=(100-i)/4;return o().createElement("div",{key:a,className:"adaptive-properties",style:{gridTemplateColumns:"".concat(r,"% ").concat(r,"% ").concat(2*r,"% ").concat(i,"%")}},o().createElement("div",{className:"adaptive-property"},gt.getTitleFromSelection(ft.ADAPTATION_SELECTION,a)),o().createElement("div",{className:"adaptive-property"},s(a)),o().createElement("div",{className:"adaptive-property"},o().createElement(lt.A,{name:a,value:n.value,onValueChanged:this.onLanguageChanged})),o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:a},"Shows the result of comparing the adaptive property with the global property.")},o().createElement("div",{className:"adaptive-property property-result"},o().createElement("div",null,o().createElement("div",{className:"adaptive-property"},o().createElement("i",{className:l}))),o().createElement("div",null,"Result"))))}if("custom1"==a||"custom2"==a||"custom3"==a){var c="fa fa-eye-slash";g().checkString(n,e[a])&&(c="fa fa-eye");var d=(100-i)/4;return o().createElement("div",{key:a,className:"adaptive-properties",style:{gridTemplateColumns:"".concat(d,"% ").concat(d,"% ").concat(2*d,"% ").concat(i,"%")}},o().createElement("div",{className:"adaptive-property"},gt.getTitleFromSelection(ft.ADAPTATION_SELECTION,a)),o().createElement("div",{className:"adaptive-property"},s(a)),o().createElement("div",{className:"adaptive-property"},o().createElement(lt.A,{name:a,value:n.value,onValueChanged:this.onCustomChanged})),o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:a},"Shows the result of comparing the adaptive property with the global property.")},o().createElement("div",{className:"adaptive-property property-result"},o().createElement("div",null,o().createElement("div",{className:"adaptive-property"},o().createElement("i",{className:c}))),o().createElement("div",null,"Result"))))}if("interactive"==a||"screenSize"==a||"layout"==a||"textDirection"==a){var p=[];n.value&&(p=n.value);var m=0,u=function(e){if("automatic"==e.id)return null;m++;var t=!1;p[e.id]&&(t=!0);var i=o().createElement("div",{key:m,className:"adaptive-property"},o().createElement("div",null,o().createElement(se.A,{name:e.id,value:t,onValueChanged:this.onToggleButtonChanged.bind(this,a)})),o().createElement("div",null,e.title));return e.tooltip?o().createElement(j(),{key:m,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:e.id},e.tooltip)},i):i}.bind(this),h=this.getAdaptationList(a),f=[];h.length0&&(d=this.state.filteredProperty[this.state.properyInMenuIndex].title,p=!1);var m=function(e,t){return o().createElement("li",{key:"property-"+t},o().createElement("a",{onClick:this.menuPropertyChanged.bind(this,t)},e.title))}.bind(this);return o().createElement("div",null,o().createElement("div",{className:"element-properties-wrapper"},o().createElement("div",{className:"panel panel-default panel-element grouped-properties",style:{width:"100%",maxWidth:"550px"}},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"adaptations")}),o().createElement("span",{className:"panel-label"},"Adaptive")),o().createElement("div",{className:"panel panel-default grouped-properties",style:{background:"#434343"}},o().createElement("div",{className:"group-help-text"},"Use the adaptive settings to toggle if this element is rendered based on the global variables of the output, ",o().createElement("a",{href:"https://singularlive.zendesk.com/hc/en-us/articles/360028595691-Introduction-to-Adaptive-Overlays",target:"_blank",tabIndex:"-1"},"click here")," to learn about adaptive rendering."),o().createElement("div",{className:"input-group",style:{margin:"10px"}},o().createElement("div",{className:"input-group-btn"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle",style:{width:"120px"},"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:p},d,o().createElement("span",{className:"caret"})),o().createElement("ul",{className:"dropdown-menu"},this.state.filteredProperty.map(m)),o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-primary",style:{height:"29px"},onClick:this.addAdaptation,disabled:p},"Add"))),o().createElement("ul",null))))),l.map(s))},PropertyPaste:function(e){var t=this.onFetchClipBoardData("layout");if(t&&"adaptations"==e)if(t.adaptations){var a=Object.assign({},t.adaptations);delete a.cursor,this.props.sbRef.child("layout").child("adaptations").set(a)}else this.props.sbRef.child("layout").child("adaptations").remove()}});var bt=a(16524),yt=a(9769);const Et=o().createClass({displayName:"GroupProperties",getInitialState:function(){return{currentTab:null}},componentDidMount:function(){this.manageTimeline()},shouldComponentUpdate:function(e,t){return 0==yt.compareObject(this.props,e)||this.state.currentTab!=ze.current},saveTab:function(e){ze.current=e,this.manageTimeline(),this.setState({currentTab:e})},manageTimeline:function(){ze.current==bt.ANIMATION?this.props.onShowTimeline(!0):this.props.onShowTimeline(!1)},render:function(){var e=ze.current;return e!=bt.CONTROL&&e!=bt.UPDATE&&e!=bt.BEHAVIOR||(e=bt.TRANSFORM),o().createElement("div",{className:"tab-area"},o().createElement("ul",{className:"nav nav-tabs",role:"tablist"},o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:e==bt.TRANSFORM?"active":"",href:"#transform",onClick:this.saveTab.bind(this,bt.TRANSFORM)},"Transform")),o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:e==bt.ANIMATION?"active":"",href:"#animation",onClick:this.saveTab.bind(this,bt.ANIMATION)},"Animation")),o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:e==bt.EFFECT?"active":"",href:"#effect",onClick:this.saveTab.bind(this,bt.EFFECT)},"Effect")),o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:e==bt.EVENT?"active":"",href:"#event",onClick:this.saveTab.bind(this,bt.EVENT)},"Event")),o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:e==bt.ADAPTIVE?"active":"",href:"#adaptive",onClick:this.saveTab.bind(this,bt.ADAPTIVE)},"Adaptive"))),o().createElement("div",{className:"tab-content comp-tab-content"},o().createElement("div",{role:"tabpanel",className:"tab-pane "+(e==bt.TRANSFORM?"active":""),id:"transform"},o().createElement(at,{type:"group",sbRef:this.props.sbRef,rootRtdbRef:this.props.rootRtdbRef,sbCompositionRef:this.props.sbCompositionRef,compositionStack:this.props.compositionStack,settings:this.props.settings})),o().createElement("div",{role:"tabpanel",className:"tab-pane "+(e==bt.ANIMATION?"active":""),id:"animation"}),o().createElement("div",{role:"tabpanel",className:"tab-pane "+(e==bt.EFFECT?"active":""),id:"effect"},o().createElement(ot,{type:"group",sbRef:this.props.sbRef,sbCompositionRef:this.props.sbCompositionRef,rootRtdbRef:this.props.rootRtdbRef,compositionStack:this.props.compositionStack,settings:this.props.settings})),o().createElement("div",{role:"tabpanel",className:"tab-pane "+(e==bt.EVENT?"active":""),id:"event"},o().createElement(mt,{active:e==bt.EVENT,type:"group",styles:this.props.styles,sbRef:this.props.sbRef,sbAllCompsRef:this.props.sbAllCompsRef,sbRootCompRef:this.props.sbRootCompRef,sbCompositionRef:this.props.sbCompositionRef,compositionStack:this.props.compositionStack,settings:this.props.settings})),o().createElement("div",{role:"tabpanel",className:"tab-pane "+(e==bt.ADAPTIVE?"active":""),id:"adaptive"},o().createElement(vt,{active:e==bt.ADAPTIVE,type:"widget",styles:this.props.styles,sbRef:this.props.sbRef,sbAllCompsRef:this.props.sbAllCompsRef,sbRootCompRef:this.props.sbRootCompRef,sbCompositionRef:this.props.sbCompositionRef,compositionStack:this.props.compositionStack,settings:this.props.settings,adaptationGlobals:this.props.adaptationGlobals}))))}});function wt(e){return wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wt(e)}var St=function(){this.history={past:[],present:void 0,future:[]}};St.prototype.compareObject=function(e,t){if(e===t)return!0;if(!(e instanceof Object&&t instanceof Object))return!1;if(e.constructor!==t.constructor)return!1;for(var a in e)if(e.hasOwnProperty(a)){if(!t.hasOwnProperty(a))return!1;if(e[a]!==t[a]){if("object"!==wt(e[a]))return!1;if(!this.compareObject(e[a],t[a]))return!1}}for(a in t)if(t.hasOwnProperty(a)&&!e.hasOwnProperty(a))return!1;return!0},St.prototype.length=function(){var e=this.history.past,t=this.history.future;return e.length+1+t.length},St.prototype.getPresent=function(){return this.history.present},St.prototype.insertState=function(e){var t=this.history.past,a=this.history.present;if(!this.compareObject(a,e)){var i=this.length(this.history)>=100;if(void 0===a)this.history={past:[],present:e,future:[]};else{var n={};$.extend(!0,n,a,e),this.history={past:[].concat(t.slice(i?1:0),[a]),present:n,future:[]}}}},St.prototype.undo=function(){var e=this.history.past,t=this.history.present,a=this.history.future;e.length<=0||(this.history={past:e.slice(0,e.length-1),present:e[e.length-1],future:[t].concat(a)})},St.prototype.redo=function(){var e=this.history.past,t=this.history.present,a=this.history.future;a.length<=0||(this.history={future:a.slice(1,a.length),present:a[0],past:[].concat(e,[t])})},new St;var Nt=a(45659),Ct=a(9769);const xt={onGroupNameChange:function(e,t){var a={};a.name=t,this.props.sbRef.child("groups").child(e).update(a)},onGroupDelete:function(e){var t=this,a=this.props.sbRef.child("groups").child(e.id).val();this.props.sbRef.beginBatch();var i,n,s=this.props.sbRef.child("tiles").val(),o=a.id,l=function(){i=a.items[r];var e=[],o=h.A.getWidgetById(s[r].widget,s[r].version);if(o&&o.model&&o.model.fields&&Array.isArray(o.model.fields)){var l=t.props.sbRef.child("data/"+r).val();o.model.fields.forEach((function(t){"composition"==t.type&&l[t.id]&&e.push(l[t.id])}))}n=t.getTiles()[i.id],t.props.sbRef.child("tiles").child(i.id).remove(),t.props.sbRef.child("data").child(i.id).remove(),t.props.sbRef.child("dataLinks").child(i.id).remove(),t.props.sbRef.child("nodeRefs").child(i.id).remove(),e.forEach((function(e){t.removeComposition(e)})),"composition"==n.type&&t.removeComposition(n.id)};for(var r in a.items)l();var c,d=0,p=this.props.sbRef.child("groups").val();for(c=Ct.getGroupArray(p),d=0;d=0&&(m=c[d-1].id),this.props.sbRef.child("groups").child(o).remove(),m){var u=this.props.sbRef.child("groups").child(m).val();this.props.onGroupSelect(u)}this.forceUpdate(),this.props.sbRef.endBatch()},onGroupSort:function(e){var t=this.props.sbRef.child("groups");this.props.sbRef.beginBatch(),e.forEach((function(e,a){var i=t.child(e.groupId);i.update({priority:e.priority}),i.child("layout").update({zindex:e.priority})})),this.props.sbRef.endBatch()},onGroupAdd:function(e,t,a){this.props.sbRef.beginBatch();var i=this.props.sbRef.child("groups"),n=i.push(),s={id:n.key,name:a,priority:t,expand:1,layout:Ue().getDefaultLayout(t)};n.set(s),i.child(s.id+"/keyframes").set(Nt.getDefaultKeyframes()),i.child(s.id+"/effects").set(Nt.getDefaultEffects()),e.forEach((function(e,t){var a=i.child(e.groupId);a.update({priority:e.priority}),a.child("layout").update({zindex:e.priority})})),this.props.onGroupSelect(s),this.props.sbRef.endBatch()},onGroupVisibleToggle:function(e){var t=!this.getGroups()[e].layout.visible;this.props.sbRef.child("groups").child(e).child("layout").update({visible:t})},onGroupExpandToggle:function(e){this.getGroups();var t=this.getGroups()[e];this.props.sbRef.child("groups").child(e).update({expand:!t.expand})},onGroupExpandAll:function(){for(var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.getGroups(),a=Object.keys(t),i=0,n=a.length;i=0&&(N="CMD");var C,x=o().createElement("span",null,"Undo ",o().createElement("span",{className:"tooltip-shortcut"},"(",N," + z)")),I=o().createElement("span",null,"Redo ",o().createElement("span",{className:"tooltip-shortcut"},"(",N," + y)")),k=o().createElement("span",null,"Copy ",o().createElement("span",{className:"tooltip-shortcut"},"(",N," + c)")),D=o().createElement("span",null,"Paste ",o().createElement("span",{className:"tooltip-shortcut"},"(",N," + v)")),A=o().createElement("span",null,"Composition navigator ",o().createElement("span",{className:"tooltip-shortcut"},"(",N," + f)"));return C=this.state.groupExpand?o().createElement("span",null,"Close all groups ",o().createElement("span",{className:"tooltip-shortcut"},"(",N," + e)")):o().createElement("span",null,"Open all groups ",o().createElement("span",{className:"tooltip-shortcut"},"(",N," + e)")),o().createElement("div",{className:"widget-tree-list-area"},o().createElement("div",{className:"widget-tree-back-panel-divider"}),o().createElement("div",{className:"comp-tree-menu toolbox"},o().createElement("div",{className:"widget-shortcut",id:"widget-shortcut-group",onClick:this.addGroup.bind(this,"Group")},o().createElement("i",{className:"fa fa-folder"})),o().createElement("div",{className:"widget-shortcut",id:"widget-shortcut-text",onClick:this.onAddWidgetShortcut.bind(this,"text")},o().createElement("i",{className:"fa fa-font"})),o().createElement("div",{className:"widget-shortcut widget-shortcut-circle",id:"widget-shortcut-circle",onClick:this.onAddWidgetShortcut.bind(this,"circle")},o().createElement("i",{className:"fa fa-circle widget-shortcut-circle"})),o().createElement("div",{className:"widget-shortcut",id:"widget-shortcut-rectangle",onClick:this.onAddWidgetShortcut.bind(this,"rectangle")},o().createElement("i",{className:"fa fa-square"})),o().createElement("div",{className:"widget-shortcut",id:"widget-shortcut-image",onClick:this.onAddWidgetShortcut.bind(this,"image")},o().createElement("i",{className:"fa fa-picture-o"})),o().createElement("div",{className:"widget-shortcut",id:"widget-shortcut-video",onClick:this.onAddWidgetShortcut.bind(this,"video")},o().createElement("i",{className:"fa fa-video-camera"}))),o().createElement("div",{className:"comp-tree-menu wide"},o().createElement("div",{className:"comp-nav-wrapper pull-left"},o().createElement(j(),{placement:"right",delayShow:500,overlay:o().createElement(z(),{id:"comp-nav-tooltip"},A)},o().createElement("button",{tabIndex:"-1",className:S,onClick:this.props.onToggleCompositionNavigator},o().createElement("i",{className:"fa fa-tasks"})))),o().createElement("div",{className:"widget-tree-filter pull-left"},E,o().createElement("input",{type:"text",className:"form-control filter-input",placeholder:"Filter ...",value:this.state.widgetTreeFilter,onKeyDown:this.onFilterKeyDown,onChange:this.onFilterChanged})),o().createElement("div",{className:"widget-tree-toolbar pull-left"},o().createElement("div",{className:"dropdown v2 add-item"},o().createElement("button",{tabIndex:"-1",className:"btn btn-default btn-sm dropdown-toggle",id:"compostion-tree-filter-selector","data-toggle":"dropdown","aria-expanded":"false"},"Add",o().createElement("span",{className:"caret"})),o().createElement("ul",{className:"dropdown-menu",style:{width:"175px"}},o().createElement("li",{onClick:this.addGroup.bind(this,"Group")},o().createElement("a",null,o().createElement("span",null,"Group ",o().createElement("span",{className:"shortcut-description"},"(",N," +g)")))),o().createElement("li",{"data-toggle":"modal","data-target":"#widgetBrowserModal"},o().createElement("a",null,o().createElement("span",null,"Widget ",o().createElement("span",{className:"shortcut-description"},"(",N," +b)")))),o().createElement("li",{onClick:this.addNewComposition},o().createElement("a",null,o().createElement("span",null,"New Sub-composition ",o().createElement("span",{className:"shortcut-description"},"(",N," +m)")))))),o().createElement("div",{className:"input-group-btn tools"},o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"Copy"},k)},o().createElement("button",{tabIndex:"-1",className:"btn btn-default btn-sm relative v2",onClick:this.onCopy},o().createElement("i",{className:"fa fa-clone"}))),o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"Paste"},D)},o().createElement("button",{tabIndex:"-1",className:"btn btn-default btn-sm relative v2",onClick:this.onPaste,style:{borderLeft:"0px"}},o().createElement("i",{className:"fa fa-clipboard"}))),o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"Undo"},x)},o().createElement("button",{tabIndex:"-1",className:"btn btn-default btn-sm relative v2",disabled:this.props.sbRef.undoStackCount()<=0,onClick:this.undo,style:{borderLeft:"0px"}},o().createElement("i",{className:"fa fa-undo"}))),o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"Redo"},I)},o().createElement("button",{tabIndex:"-1",className:"btn btn-default btn-sm relative v2",disabled:this.props.sbRef.redoStackCount()<=0,onClick:this.redo,style:{borderLeft:"0px"}},o().createElement("i",{className:"fa fa-repeat"}))),o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"Redo"},C)},o().createElement("button",{tabIndex:"-1",className:"btn btn-default btn-sm relative v2",onClick:this.expandTree,style:{borderLeft:"0px"}},o().createElement("i",{className:this.state.groupExpand?"fa fa-minus":"fa fa-plus"}))))),b,o().createElement("div",{className:"animation-right-menu"},o().createElement("div",{className:"row"},o().createElement("div",{className:"col-sm-12"},o().createElement(Ae(),{value:g.timelineZoom,onChange:this.onTimelineZoom,min:0,max:6,step:1}),o().createElement("div",{className:"btn-group"},o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"snap-grid"},"Snap to grid")},o().createElement("button",{tabIndex:"-1",className:("grid"==g.timelineSnap?"active ":"")+"btn btn-sm btn-default v2",onClick:this.onToggleTimelineSnap},o().createElement("i",{className:"fa fa-align-justify"}))),o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"timelineProgress"},"Show timeline progress during animation")},o().createElement("button",{tabIndex:"-1",className:(g.disableTimelineUpdate?"":"active ")+"btn btn-sm btn-default v2",onClick:this.onToggleTimelineUpdate},o().createElement("svg",{width:"16px",height:"16px",viewBox:"-3 2 22 22",preserveAspectRatio:"none",style:{fill:"currentColor"}},o().createElement("g",null,o().createElement("path",{fillRule:"evenodd",d:"M-0-0C-0-0 7-0 7-0 7-0 7 10.67 7 10.67 7 10.67 4.2 16 4.2 16 4.2 16 2.8 16 2.8 16 2.8 16-0 10.67-0 10.67-0 10.67-0-0-0-0ZM 9 7C 9 7 16 9.8 16 9.8 16 9.8 16 11.27 16 11.27 16 11.27 9 14 9 14 9 14 9 7 9 7Z"}),o().createElement("path",{fillRule:"evenodd",d:"M 3.5 10.88C 3.5 10.88 4 9.93 4 9.93 4 9.93 4 3 4 3 4 3 3 3 3 3 3 3 3 9.93 3 9.93 3 9.93 3.5 10.88 3.5 10.88M 4.2 16C 4.2 16 2.8 16 2.8 16 2.8 16-0 10.67-0 10.67-0 10.67-0 0-0 0-0 0 7 0 7 0 7 0 7 10.67 7 10.67 7 10.67 4.2 16 4.2 16 4.2 16 4.2 16 4.2 16ZM 9 14C 9 14 9 7 9 7 9 7 16 9.8 16 9.8 16 9.8 16 11.27 16 11.27 16 11.27 9 14 9 14 9 14 9 14 9 14Z"}))))))))),o().createElement("div",{className:"ruler-wrapper top u-displaynone"},o().createElement("span",{className:"timeline-full"},o().createElement(U,{position:this.state.hScrollerPositions[this.state.animationPanel],ref:"ruler"},c)))),o().createElement("div",{className:"animation-scrollbar-wrapper",ref:"compositionTreeArea"},o().createElement("div",{className:"widget-tree-scrollbar"},o().createElement("div",{className:"scroll-content"},o().createElement("ul",{className:"widget-tree-group list-group composition-tree"},w.map(p))))),o().createElement("div",{className:"widget-tree-toolbox-bottom"},o().createElement(Se,{sbRef:this.props.sbRef,item:this.state.selectedItem,forceUpdateIFrame:this.props.forceUpdateIFrame})),o().createElement("div",{className:"animation-wrapper u-displaynone"},o().createElement("div",{className:"scrollbar-wrapper"},o().createElement("span",{className:"timeline-full"},d)),o().createElement("div",{className:"effect-wrapper"},o().createElement("span",{className:"timeline-full"},f[this.state.animationPanel]))),this.renderModal("widget","widgetBrowserModal"),o().createElement("div",{id:"compBrowserModal",className:"modal fade u-displaynone singular-modal-v2",tabIndex:"-1",role:"dialog"},o().createElement("div",{className:"modal-dialog modal-lg",role:"document"},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-body"},o().createElement(kt.A,{rtdbFolderRef:Dt.A.rtdbFolderRef(),ref:"browser",showHeader:!0,browserTitle:"Composition",showInspector:!1,showSearch:!0,browserStyle:"composition-selector-modal"}))))))},addGroup:function(e,t){var a=9999;if(this.props.selection)if("group"==this.props.selection.type)a=this.props.selection.id;else{var i=Object.keys(this.getGroups());i.length>0&&(a=this.getGroups()[i[0]].id)}var n=[];$.isEmptyObject(this.getGroups())||(n=$(".widget-tree-group").sortable("toArray"));for(var s=0,o=9999,l=[],r=0,c=0;c2&&void 0!==arguments[2])||arguments[2];if(""!=t&&"filled"!=t)for(var i=this.getGroupArray(),n=0,s=i.length;n0&&(0==this.canSeeGroupChildren(i[n-1])?o=i[n-1]:(o=this.getItemFromGroup(i[n-1],"last"),r=i[n-1],l="widget")),"parent"==t){var p=this.props.exitSubcomp();if(!p)return;var m=this.getSelectionForItemId(p.compId);if(!m)return;r=m.group,o=m.item,l="widget"}o||(o=i[n],c=Math.random())}else if(1==this.canSeeGroupChildren(i[n]))for(var u=this.getSortedItemsOfGroupAsArray(i[n]),h=0,f=u.length;ht.priority)-.5})),t}});function Ot(e){return Ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ot(e)}var Lt=a(9769),Vt=a(48766).EffectSelectionsUpdateAnimation;const Ft=o().createClass({displayName:"UpdateProperties",mixins:[W.A,pe.A],shouldComponentUpdate:function(e,t){return!1===this.props.active&&!0===e.active||0==Lt.compareObject(this.state.layout.updateAnimation,t.layout.updateAnimation)},componentWillMount:function(){this.sBindAsObject(this.props.sbRef.child("layout"),"layout")},render:function(){if(!1===this.props.active)return!1;var e=this.state.layout.updateAnimation;void 0!==e&&"object"===Ot(e)||(e={});var t=e.in,a=e.out,i=this.props.disabled;return 0==e.active&&(i=!0),o().createElement("div",{className:"element-properties-wrapper"},o().createElement("div",{className:"panel panel-default panel-element grouped-properties"},o().createElement("div",{className:"panel-body",style:{minWidth:"521px"}},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"updateAnimation")}),o().createElement("span",{className:"panel-label"},"Update Animation"),o().createElement("div",{className:"group-panel-options pull-right"},o().createElement("span",null,"Active"),o().createElement(se.A,{name:"active",value:e.active,onValueChanged:this.PropertyChanged}))),o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,"Out"),o().createElement("td",null,o().createElement(he,{anim:a,onEffect:this.EffectChanged.bind(this,"out"),onValueChanged:this.ValueChanged.bind(this,"out"),gizmoOverlayPlacement:"bottom",isUpdateAnimation:!0,disabled:i}))),o().createElement("tr",null,o().createElement("td",null,"In"),o().createElement("td",null,o().createElement(he,{anim:t,onEffect:this.EffectChanged.bind(this,"in"),onValueChanged:this.ValueChanged.bind(this,"in"),gizmoOverlayPlacement:"bottom",isUpdateAnimation:!0,disabled:i}))),o().createElement("tr",null,o().createElement("td",null,"Offset"),o().createElement("td",null,o().createElement("table",{style:{width:"100%"}},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement(te.A,{name:"offset",resetValue:0,step:.01,unit:"s",format:"0.01",min:-5,max:5,value:e.offset,showSlider:!1,onValueChanged:this.PropertyChanged,disabled:i})),o().createElement("td",null,o().createElement("div",{className:"group-panel-options pull-right",style:{top:"9px"}},o().createElement("span",{style:{top:"-2px",position:"relative"}},"Always execute"),o().createElement(se.A,{name:"alwaysExecute",tabIndex:"-1",value:e.alwaysExecute,onValueChanged:this.PropertyChanged,disabled:i})))))))))))))},PropertyChanged:function(e,t){this.props.sbRef.child("layout").child("updateAnimation").child(e).set(t)},ValueChanged:function(e,t,a){this.props.sbRef.child("layout").child("updateAnimation").child(e).child(t).set(a)},TestUpdateAnimation:function(){console.log("TestUpdateAnimation")},EffectChanged:function(e,t,a){var i=!1;Vt.map(function(t){t.id==a&&(t.property.map(function(t){t.id==this.state.layout.updateAnimation[e].property&&(i=!0)}.bind(this)),0==i&&this.props.sbRef.child("layout").child("updateAnimation").child(e).child("property").set(t.property[0].id))}.bind(this)),this.props.sbRef.child("layout").child("updateAnimation").child(e).child(t).set(a)},PropertyPaste:function(e){var t=this.onFetchClipBoardData("layout");t&&"updateAnimation"==e&&(t.updateAnimation?this.props.sbRef.child("layout").child("updateAnimation").set(t.updateAnimation):this.props.sbRef.child("layout").child("updateAnimation").remove())}});function _t(e){return _t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_t(e)}const Bt=o().createClass({displayName:"BehaviorProperties",mixins:[W.A,pe.A],getInitialState:function(){return{behavior:[],properyInMenuIndex:0,selectedProperty:null}},filteredPropertySelections:[],propertySelections:[{id:"opacity",title:"Opacity"},{id:"positionX",title:"Position X"},{id:"positionY",title:"Position Y"},{id:"positionZ",title:"Position Z"},{id:"rotationX",title:"Rotation X"},{id:"rotationY",title:"Rotation Y"},{id:"rotationZ",title:"Rotation Z"},{id:"scale",title:"Scale"},{id:"scaleX",title:"Scale X"},{id:"scaleY",title:"Scale Y"}],effectSelections:[{id:"drift",title:"Drift"},{id:"loop+",title:"Loop +"},{id:"loop-",title:"Loop -"},{id:"pingpong",title:"Ping Pong"}],easingSelections:[{id:"linear",title:"Linear"},{id:"power1",title:"Power1"},{id:"power2",title:"Power2"},{id:"power3",title:"Power3"},{id:"back",title:"Back"},{id:"elastic",title:"Elastic"},{id:"bounce",title:"Bounce"},{id:"rough",title:"Rough"},{id:"slomo",title:"Slow Motion"},{id:"steppedease",title:"Stepped"},{id:"circ",title:"Circ"},{id:"expo",title:"Expo"},{id:"sine",title:"Sine"}],updateEditor:function(e){var t=null;e.val()&&(t=e.val().behavior),0==Array.isArray(t)&&(t=[]),this.filteredPropertySelections=[],this.propertySelections.map(function(e,a){var i=!1;t.map((function(t){t.property!=e.id&&("scale"!=e.id||"scaleX"!=t.property&&"scaleY"!=t.property)&&("scaleX"!=e.id&&"scaleY"!=e.id||"scale"!=t.property)||(i=!0)})),0==i&&this.filteredPropertySelections.push(e)}.bind(this)),(-1==this.state.properyInMenuIndex||this.state.properyInMenuIndex>=this.filteredPropertySelections.length)&&this.setState({properyInMenuIndex:0});var a=0;t.map(function(e,t){null!==this.state.selectedProperty&&this.state.selectedProperty.property==e.property&&(a=t)}.bind(this)),t.length>a?this.setState({selectedProperty:t[a]}):this.setState({selectedProperty:null}),this.setState({behavior:t})},componentWillMount:function(){this.props.sbRef.child("layout").on("value",this.updateEditor)},componentWillUnmount:function(){this.props.sbRef.child("layout").off("value",this.updateEditor)},componentDidMount:function(){},shouldComponentUpdate:function(e,t){return!1===this.props.active&&e.active,!0},render:function(){if(!1===this.props.active)return!1;var e,t,a,i=function(e,t){return e.map((function(e){if(e.id==t)return e.title}))||"Title not found"},n=function(e,t){return o().createElement("li",{key:"effect-"+t},o().createElement("a",{onClick:this.propertyChanged.bind(this,this.state.selectedProperty.property,"effect",e.id)},e.title))}.bind(this),s=function(e,t){var a="";return null!==this.state.selectedProperty&&(a=this.state.selectedProperty.property),o().createElement("li",{key:"line"+t,className:a==e.property?"active":""},o().createElement(se.A,{name:"active",value:e.active,onValueChanged:this.propertyChanged.bind(this,e.property)}),o().createElement("span",{onClick:this.selectProperty.bind(this,e)},i(this.propertySelections,e.property)),o().createElement("i",{className:"fa fa-times-circle btn-delete",onClick:this.deleteProperty.bind(this,t)}))}.bind(this),l=function(){if(null==this.state.selectedProperty)return o().createElement("div",{className:"panel behavior-properties",style:{minWidth:"354px"}});var e=!1;0==this.state.selectedProperty.active&&(e=!0);var t=o().createElement(de(),{id:"popover"},o().createElement(re,{name:"easing",title:"Easing Editor",value:this.state.selectedProperty.easing,onValueChanged:this.propertyChanged.bind(this,this.state.selectedProperty.property)}));return o().createElement("table",{style:{width:"420px"}},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",{style:{width:"15%"}}),o().createElement("th",{style:{width:"40%"}}),o().createElement("th",{style:{width:"10%"}}),o().createElement("th",{style:{width:"35%"}}))),o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,"Effect"),o().createElement("td",null,o().createElement("div",{className:"btn-group width110"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:e},i(this.effectSelections,this.state.selectedProperty.effect)),o().createElement("ul",{className:"dropdown-menu"},this.effectSelections.map(n)))),o().createElement("td",null,"Easing"),o().createElement("td",null,o().createElement(j(),{trigger:"click",rootClose:!0,placement:"bottom",overlay:t},o().createElement("button",{className:"btn btn-default width110",tabIndex:"-1",disabled:e},this.state.selectedProperty.easing.easing,o().createElement("i",{className:"fa fa-sliders pull-right"}))))),o().createElement("tr",null,o().createElement("td",null,"Value Min"),o().createElement("td",null,o().createElement(te.A,{name:"valueMin",resetValue:0,step:.1,format:"0.0",min:-999,max:999,disabled:e,value:this.state.selectedProperty.valueMin,unit:this.state.selectedProperty.valueUnit,onValueChanged:this.propertyChanged.bind(this,this.state.selectedProperty.property)})),o().createElement("td",null,"Max"),o().createElement("td",null,o().createElement(te.A,{name:"valueMax",resetValue:0,step:.1,format:"0.0",min:-999,max:999,disabled:e,value:this.state.selectedProperty.valueMax,unit:this.state.selectedProperty.valueUnit,onValueChanged:this.propertyChanged.bind(this,this.state.selectedProperty.property)}))),o().createElement("tr",null,o().createElement("td",null,"Duration"),o().createElement("td",null,o().createElement(te.A,{name:"duration",resetValue:0,step:.1,format:"0.0",min:.1,max:999,disabled:e,value:this.state.selectedProperty.duration,unit:"s",onValueChanged:this.propertyChanged.bind(this,this.state.selectedProperty.property)})),o().createElement("td",null,"Range"),o().createElement("td",null,o().createElement(te.A,{name:"durationRange",resetValue:0,step:.1,format:"0.0",min:0,max:999,disabled:e,value:this.state.selectedProperty.durationRange,unit:"s",onValueChanged:this.propertyChanged.bind(this,this.state.selectedProperty.property)}))),o().createElement("tr",null,o().createElement("td",null,"Delay"),o().createElement("td",null,o().createElement(te.A,{name:"delay",resetValue:0,step:.1,format:"0.0",min:0,max:999,disabled:e,value:this.state.selectedProperty.delay,unit:"s",onValueChanged:this.propertyChanged.bind(this,this.state.selectedProperty.property)})),o().createElement("td",null,"Range"),o().createElement("td",null,o().createElement(te.A,{name:"delayRange",resetValue:0,step:.1,format:"0.0",min:0,max:999,disabled:e,value:this.state.selectedProperty.delayRange,unit:"s",onValueChanged:this.propertyChanged.bind(this,this.state.selectedProperty.property)})))))}.bind(this),r="None",c=!0;return-1!=this.state.properyInMenuIndex&&this.filteredPropertySelections.length>0&&(r=this.filteredPropertySelections[this.state.properyInMenuIndex].title,c=!1),o().createElement("div",{className:"element-properties-wrapper"},o().createElement("div",{className:"panel panel-default panel-element grouped-properties"},o().createElement("div",{className:"panel-body"},o().createElement("h3",{className:"panel-clipboard"},o().createElement(et.A,{checkProperty:"layout",onPaste:this.PropertyPaste.bind(this,"behavior")}),o().createElement("span",{className:"panel-label"},"Behavior Animation")),o().createElement("div",{className:"",style:{margin:"0px",display:"flex",float:"left"}},o().createElement("div",{className:"",style:{padding:"0px",display:"flex"}},o().createElement("div",{className:"panel panel-default grouped-properties behavior-list"},o().createElement("div",{className:"input-group",style:{marginBottom:"5px"}},o().createElement("div",{className:"input-group-btn",style:{display:"flex"}},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle",style:{width:"124px"},"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:c},r,o().createElement("span",{className:"caret"})),o().createElement("ul",{className:"dropdown-menu"},this.filteredPropertySelections.map(function(e,t){return o().createElement("li",{key:"property-"+t},o().createElement("a",{onClick:this.currentPropertyChanged.bind(this,t)},e.title))}.bind(this))),o().createElement("button",(e={type:"button",tabIndex:"-1",className:"btn btn-primary",style:{height:"29px"},onClick:this.addProperty,disabled:c},a="-1",(t=function(e){var t=function(e){if("object"!=_t(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=_t(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_t(t)?t:t+""}(t="tabIndex"))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e),"Add"))),o().createElement("ul",null,this.state.behavior.map(s)))),o().createElement("div",{className:"",style:{display:"flex"}},o().createElement("div",{className:"panel panel-default grouped-properties behavior-properties"},l()))))))},updateBehaviorObject:function(e){e.sort((function(e,t){return e.propertyt.property?1:0})),this.props.sbRef.child("layout").child("behavior").set(e)},currentPropertyChanged:function(e){this.setState({properyInMenuIndex:e})},addProperty:function(){var e=this.state.behavior.slice(0);if(-1!=this.state.properyInMenuIndex&&null!=this.filteredPropertySelections[this.state.properyInMenuIndex]){var t=this.filteredPropertySelections[this.state.properyInMenuIndex].id,a={active:!0,property:t,effect:"pingpong",duration:2,durationRange:0,delay:0,delayRange:0,easing:{easing:"power1",inOut:"inOut"}};switch(t){case"positionX":case"positionY":case"positionZ":a.valueMin=-50,a.valueMax=50,a.valueUnit="%";break;case"rotationX":case"rotationY":case"rotationZ":a.valueMin=-90,a.valueMax=90,a.valueUnit="deg";break;case"scaleX":case"scaleY":case"scale":a.valueMin=50,a.valueMax=200,a.valueUnit="%";break;case"opacity":a.valueMin=0,a.valueMax=100,a.valueUnit="%"}e.push(a),this.updateBehaviorObject(e)}},deleteProperty:function(e){var t=this.state.behavior.slice(0);void 0!==t[e]&&t.splice(e,1),this.updateBehaviorObject(t)},selectProperty:function(e){this.setState({selectedProperty:e})},propertyChanged:function(e,t,a){var i=this.state.behavior.slice(0);i.map((function(i,n){e==i.property&&(i[t]=a)})),this.updateBehaviorObject(i)},PropertyPaste:function(e){var t=this.onFetchClipBoardData("layout");t&&"behavior"==e&&(t.behavior?this.props.sbRef.child("layout").child("behavior").set(t.behavior):this.props.sbRef.child("layout").child("behavior").remove())}});var Ut=a(5517);a(9769);const Wt=o().createClass({displayName:"WidgetParamProperties",onStyleChanged:function(e,t){},componentWillMonth:function(){},shouldComponentUpdate:function(e,t){return!1===this.props.active&&e.active,!0},render:function(){if(!1===this.props.active)return!1;if("widget"==this.props.sbRef.val().type)return o().createElement("div",{className:"element-properties-wrapper"},o().createElement(Ut.A,{sbRef:this.props.sbRef,sbRootRef:this.props.sbRootRef,sbFieldsRef:this.props.sbFieldsRef,sbCompositionRef:this.props.sbCompositionRef,compositionStack:this.props.compositionStack,onEditCompStandalone:this.props.onEditCompStandalone,sbButtonsRef:this.props.sbButtonsRef,rootRtdbRef:this.props.rootRtdbRef,enableDataLink:!0}));var e,t=(e=this.props.subCompID?this.props.sbRootRef.child("compositions").child(this.props.subCompID):this.props.sbRootRef.child("compositions").child(this.props.sbRef.val().id)).child("dataSources").child("composition").child("controlNode");return o().createElement("div",{className:"element-properties-wrapper"},o().createElement(Ut.A,{sbRef:e,sbFieldsRef:t.child("payload"),sbCompositionRef:e,model:t.child("model").val(),fields:t.child("payload").val(),enableDataLink:!1,controlNodeButtonMode:!0}))}});var Yt=a(16524),jt=a(9769);const Ht=o().createClass({displayName:"WidgetProperties",getInitialState:function(){return{currentTab:null}},componentDidMount:function(){this.manageTimeline()},shouldComponentUpdate:function(e,t){return 0==jt.compareObject(this.props,e)||this.state.currentTab!=ze.current},saveTab:function(e){ze.current=e,this.manageTimeline(),this.setState({currentTab:e})},manageTimeline:function(){ze.current==Yt.ANIMATION?this.props.onShowTimeline(!0):this.props.onShowTimeline(!1)},showHelp:function(e){window.open(e,e).focus()},render:function(){var e,t="Control Properties",a=!1,i=!1,n=!1,s=this.props.sbRef.val(),l="composition"===s.type;if(this.props.sbRef&&s&&"widget"==s.type){var r=h.A.getWidgetById(s.widget,s.version);null!=r&&(i=r.supportCustomAnimation,n=r.supportInteractivity,r.helpEnabled&&r.helpUrl&&(e=o().createElement("i",{className:"fa fa-question-circle",style:{display:"flex",color:"rgb(88, 184, 72)",position:"relative",top:"4px",left:"5px"},onClick:this.showHelp.bind(this,r.helpUrl)})),t=r.name,r&&r.model&&r.model.fields&&Array.isArray(r.model.fields)&&r.model.fields.forEach((function(e){"composition"==e.type&&(a=!0)})))}var c,d=ze.current;return a||l||i||n?d==Yt.UPDATE&&(d=Yt.TRANSFORM):c=o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:d==Yt.UPDATE?"active":"",href:"#update",onClick:this.saveTab.bind(this,Yt.UPDATE)},"Update")),o().createElement("div",{className:"tab-area"},o().createElement("ul",{className:"nav nav-tabs",role:"tablist"},o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:d==Yt.TRANSFORM?"active":"",href:"#transform",onClick:this.saveTab.bind(this,Yt.TRANSFORM)},"Transform")),o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:d==Yt.ANIMATION?"active":"",href:"#animation",onClick:this.saveTab.bind(this,Yt.ANIMATION)},"Animation")),o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:d==Yt.EFFECT?"active":"",href:"#effect",onClick:this.saveTab.bind(this,Yt.EFFECT)},"Effect")),o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:d==Yt.EVENT?"active":"",href:"#event",onClick:this.saveTab.bind(this,Yt.EVENT)},"Event")),o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:d==Yt.ADAPTIVE?"active":"",href:"#adaptive",onClick:this.saveTab.bind(this,Yt.ADAPTIVE)},"Adaptive")),c,o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:d==Yt.BEHAVIOR?"active":"",href:"#behavior",onClick:this.saveTab.bind(this,Yt.BEHAVIOR)},"Behavior")),o().createElement("li",{className:"nav-item",id:"widget-property-tab"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",className:d==Yt.CONTROL?"active widgetProps":"widgetProps",href:"#control",onClick:this.saveTab.bind(this,Yt.CONTROL)},o().createElement("div",{style:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",float:"left",maxWidth:"130px"}},t),e))),o().createElement("div",{className:"tab-content comp-tab-content"},o().createElement("div",{role:"tabpanel",className:"tab-pane "+(d==Yt.ANIMATION?"active":""),id:"animation"}),o().createElement("div",{role:"tabpanel",className:"tab-pane "+(d==Yt.TRANSFORM?"active":""),id:"transform"},o().createElement(at,{active:d==Yt.TRANSFORM,type:"widget",sbRef:this.props.sbRef,rootRtdbRef:this.props.rootRtdbRef,sbCompositionRef:this.props.sbCompositionRef,compositionStack:this.props.compositionStack,settings:this.props.settings})),o().createElement("div",{role:"tabpanel",className:"tab-pane "+(d==Yt.EFFECT?"active":""),id:"effect"},o().createElement(ot,{active:d==Yt.EFFECT,type:"widget",styles:this.props.styles,sbRef:this.props.sbRef,rootRtdbRef:this.props.rootRtdbRef,sbCompositionRef:this.props.sbCompositionRef,compositionStack:this.props.compositionStack,settings:this.props.settings})),o().createElement("div",{role:"tabpanel",className:"tab-pane "+(d==Yt.EVENT?"active":""),id:"event"},o().createElement(mt,{active:d==Yt.EVENT,type:"widget",styles:this.props.styles,sbRef:this.props.sbRef,sbAllCompsRef:this.props.sbAllCompsRef,sbRootCompRef:this.props.sbRootCompRef,sbCompositionRef:this.props.sbCompositionRef,compositionStack:this.props.compositionStack,settings:this.props.settings})),o().createElement("div",{role:"tabpanel",className:"tab-pane "+(d==Yt.ADAPTIVE?"active":""),id:"adative"},o().createElement(vt,{active:d==Yt.ADAPTIVE,type:"widget",styles:this.props.styles,sbRef:this.props.sbRef,sbAllCompsRef:this.props.sbAllCompsRef,sbRootCompRef:this.props.sbRootCompRef,sbCompositionRef:this.props.sbCompositionRef,compositionStack:this.props.compositionStack,settings:this.props.settings,adaptationGlobals:this.props.adaptationGlobals})),o().createElement("div",{role:"tabpanel",className:"tab-pane "+(d==Yt.UPDATE?"active":""),id:"update"},o().createElement(Ft,{active:d==Yt.UPDATE,type:"widget",styles:this.props.styles,sbRef:this.props.sbRef,settings:this.props.settings})),o().createElement("div",{role:"tabpanel",className:"tab-pane "+(d==Yt.BEHAVIOR?"active":""),id:"behavior"},o().createElement(Bt,{active:d==Yt.BEHAVIOR,type:"widget",styles:this.props.styles,sbRef:this.props.sbRef,settings:this.props.settings})),o().createElement("div",{role:"tabpanel",className:"tab-pane "+(d==Yt.CONTROL?"active":""),id:"control"},o().createElement(Wt,{active:d==Yt.CONTROL,sbRef:this.props.sbRef,sbRootRef:this.props.sbRootRef,sbCompositionRef:this.props.sbCompositionRef,compositionStack:this.props.compositionStack,sbFieldsRef:this.props.sbFieldsRef,sbButtonsRef:this.props.sbButtonsRef,rootRtdbRef:this.props.rootRtdbRef,onEditCompStandalone:this.props.onEditCompStandalone}))))}});var zt=a(4213),Gt=a.n(zt),$t=a(82765),Kt=a.n($t),qt=a(45261),Jt=a(82465),Xt=a(9769),Zt=o().createClass({displayName:"CompositionProperties",mixins:[D()],getInitialState:function(){return this.defaultAppHandler=null,this.generateUuidHandler=null,{defaultAppIcon:"",defaultAppName:"No default app selected",defaultAppBusy:!1,compositionUuid:window.singularScene.uuid,compositionId:window.singularScene.id,generateUuidBusy:!1}},shouldComponentUpdate:function(e,t){return!Xt.compareObject(this.props,e)||!Xt.compareObject(this.state,t)},componentWillMount:function(){this.props.settings&&this.fetchDefaultAppData(this.props.settings.defaultAppID)},componentWillReceiveProps:function(e){!e.settings||null!=this.props.settings&&this.props.settings.defaultAppID==e.settings.defaultAppID||this.fetchDefaultAppData(e.settings.defaultAppID)},PropValueChanged:function(e,t){this.props.onSettings&&this.props.onSettings(e,t)},onUISettings:function(e,t){this.props.onUISettings&&this.props.onUISettings(e,t)},export:function(){var e=JSON.stringify(this.props.sbRef.root.val()),t=new Blob([e],{type:"text/plain;charset=utf-8"});Gt().saveAs(t,"export.json")},fetchDefaultAppData:function(e){if(e){this.setState({defaultAppBusy:!0}),this.defaultAppHandler&&this.defaultAppHandler.abort();var t=Jt.API_ENDPOINTS.at+"json?status=development";this.defaultAppHandler=S().get(t).set("Content-Type","application/json").end(function(t,a){if(this.defaultAppHandler=null,t)N.A.add(N.A.TYPE.ERROR,{title:"Cannot get default app info",description:t.message}),this.setState({defaultAppIcon:"",defaultAppName:"No default app specified",defaultAppBusy:!1});else{if(a.headers.location)return void(window.location=a.headers.location);for(var i=a.body,n=0,s=i.length;ni&&(s=i>0?e[i-1]:null);var o=function(t,a){var i=e.find((function(e){return e.key===t}));i&&i&&i.item.activeId===a&&(i.item.activeId=null)};if(null===s){if("field"===n.type)o(n.parentId,n.item.id),n.parentId=null;else if("group"===n.type&&"field"===e[i].type)return}else if("group"===n.type&&"field"===s.type);else if("group"===n.type&&"group"===s.type);else if("field"===n.type&&"group"===s.type)n.parentId!==s.key&&(o(n.parentId,n.item.id),n.parentId=s.key);else{if("field"!==n.type||"field"!==s.type)return;n.parentId!==s.parentId&&(o(n.parentId,n.item.id),n.parentId=s.parentId)}var l=ua()(e,t.oldIndex,t.newIndex),r=l.filter((function(e){return"field"===e.type})),c={};r.map((function(e,t){e.item.index=t,c[e.key]=e.item}));var d=l.filter((function(e){return"group"===e.type})).map((function(e){return e.item}));d.forEach((function(e){var t=l.filter((function(t){return t.parentId===e.id}));e.childIds=t.map((function(e){return e.item.id}))})),this.props.onSort(c,d)},onSortOver:function(e,t){var a=e[t.index],i=null;t.newIndex>0&&(i=t.newIndex0&&e.childIds.forEach((function(t){s.forEach((function(a,i){a.field.id===t&&(n.push({type:"field",key:a.key,item:a.field,parentId:e.id}),s.splice(i,1))}))}))}));var l=[];s.forEach((function(e){l.push({type:"field",key:e.key,item:e.field,parentId:null})})),n.unshift.apply(n,l);var r=(0,pa.Zj)((function(t){var a=t.fieldId,i=t.isGroup,n=t.field,s=t.parentId;return o().createElement(da,{id:n.id,title:n.title,type:i?"group":n.type,fieldId:a,hasChildren:i&&n.childIds&&n.childIds.length,parentId:s,selected:e.props.selected===a,onGetControlNodeType:e.props.onGetControlNodeType,onSelect:e.onSelect,onDeleteField:e.props.onDeleteField,onDeleteGroup:e.props.onDeleteGroup})})),c=(0,pa.q6)((function(t){var a=t.items;return o().createElement("div",{className:"control-node-list",ref:function(t){e.refNodeList=t}},a.map((function(e,t){return o().createElement(r,{key:e.key,isGroup:"group"===e.type,fieldId:e.key,field:e.item,parentId:e.parentId,index:t})})))}));return o().createElement(c,{items:n,onSortEnd:function(t){return e.onSortEnd(n,t)},shouldCancelStart:function(e){},updateBeforeSortStart:function(e){e.index},onSortStart:function(e,t){},onSortMove:function(e){},onSortOver:function(t){return e.onSortOver(n,t)},axis:"y",lockAxis:"y",distance:5,pressThreshold:5,lockToContainerEdges:!0,helperClass:"dragging"})}});var ga=a(9769);const va=o().createClass({displayName:"CheckboxNumber",getInitialState:function(){return{backupValue:void 0}},componentWillMount:function(){void 0===this.props.value||""===this.props.value?this.setState({backupValue:this.props.default}):this.setState({backupValue:this.props.value})},shouldComponentUpdate:function(e,t){return!ga.compareObject(t,this.state)||!ga.compareObject(e,this.props)},render:function(){var e=this,t=this.props.value,a=!0;return""!==t&&null!=t||(a=!1,t=this.state.backupValue),o().createElement("span",{className:"checkbutton-number"},o().createElement("span",null,o().createElement(se.A,{name:"active",value:a,onValueChanged:function(t,a){a?e.props.onValueChanged(e.state.backupValue):e.props.onValueChanged(null)}})),o().createElement(te.A,{name:"number",resetValue:this.props.default,value:t,disabled:!a,width:"99px",step:this.props.step||"1",format:this.props.step||"1",unit:this.props.unit,onValueChanged:function(t,a){e.setState({backupValue:a}),e.props.onValueChanged(a)}}))}});var ba=a(9769);const ya=o().createClass({displayName:"ControlNodeDetails",getInitialState:function(){return{fieldId:"",fieldIdValue:"",fieldIdOriginalValue:"",fieldIdValueValid:!0,fieldIdLocked:!1}},componentWillMount:function(){this.setInitialStateValues(this.props)},componentWillReceiveProps:function(e){this.setInitialStateValues(e)},shouldComponentUpdate:function(e,t){return!ba.compareObject(e,this.props)||!ba.compareObject(t,this.state)},setInitialStateValues:function(e){if(this.state.fieldId!==e.selected){var t=this.getCurrentModelField(e.model,e.selected);t?this.setState({fieldId:e.selected,fieldIdOriginalValue:t.id,fieldIdValue:t.id,fieldIdValueValid:!0,fieldIdLocked:t.id===t.title}):this.setState({fieldId:"",fieldIdOriginalValue:"",fieldIdValue:"",fieldIdValueValid:!0,fieldIdLocked:!0})}},getCurrentModelField:function(e,t){if(t&&e&&e.fields)return e.fields[t]},getModelFieldValue:function(e){var t=this.getCurrentModelField(this.props.model,this.props.selected);if(t&&void 0!==t[e])return t[e]},getPayloadFieldValue:function(e){var t=this.props.payload;return t&&void 0!==t[e]?t[e]:""},onModelFieldIdChanged:function(e,t){var a=this.verifyModelFieldId(t,this.state.fieldId,!0);this.setState({fieldIdValueValid:null!==a,fieldIdValue:null!==a?a:t})},onModelFieldIdBlur:function(e,t){var a=this.verifyModelFieldId(t.target.value,this.state.fieldId);if(a)this.state.fieldIdOriginalValue!==a&&(this.props.onModelFieldIdChanged(this.state.fieldId,this.state.fieldIdOriginalValue,a),this.state.fieldIdLocked&&this.onModelFieldPropertyChanged("title",a),this.setState({fieldIdValueValid:!0,fieldIdOriginalValue:a,fieldIdValue:a}));else{var i=this.getCurrentModelField(this.props.model,this.props.selected);i&&this.setState({fieldIdOriginalValue:i.id,fieldIdValue:i.id,fieldIdValueValid:!0})}},onModelFieldIdKeyDown:function(e,t){if("Escape"===t.key){var a=this.getCurrentModelField(this.props.model,this.props.selected);a&&this.setState({fieldIdOriginalValue:a.id,fieldIdValue:a.id,fieldIdValueValid:!0})}"Enter"===t.key&&this.state.fieldIdValueValid&&this.onModelFieldIdBlur(e,t)},onModelFieldPropertyChanged:function(e,t){this.props.onModelFieldPropertyChanged(this.state.fieldId,e,t)},onPayloadFieldValueChanged:function(e,t){this.props.onPayloadFieldValueChanged(e,t)},verifyModelFieldId:function(e,t,a){if("string"!=typeof e)return null;for(var i=e.replace(/[\/\.\[\]\#\$]/g,""),n=0;n"==c.sourceLocation[0]?a:""==c.sourceLocation[0]?this.props.sbCompositionRef.parent.parent.key:c.sourceLocation[0])==e&&n&&n(this.props.sbCompositionRef.parent.child(a).child(s).child(o).child(r))}}},onTypeChange:function(e,t){var a=this;this.setState({currentType:t},(function(){a.verifyNodeId(a.state.controlNodeFieldId,!1)}))},onFieldIdChanged:function(e,t,a){if(t!=a){var i=this.props.sbCompositionRef.child("dataSources").child("composition").child("controlNode");i.beginBatch(),i.child("payload").child(a).set(i.child("payload").child(t).val()),i.child("payload").child(t).remove();var n=this.props.sbCompositionRef.parent.val(),s=this.props.sbCompositionRef.key;for(var o in n){var l=n[o];this.__checkDataLink(s,l,o,t,(function(e){e.child("key").set(a)})),this.__checkNodeRefLink(s,l,o,t,(function(e){e.child("sourceKey").set(a)}))}i.child("model").child("fields").child(e).child("id").set(a);var r=i.child("model").child("groups").val();r&&r.length&&(r.forEach((function(e){e.childIds&&e.childIds.length&&(e.childIds=e.childIds.map((function(e){return e===t?a:e}))),e.activeId===t&&(e.activeId=a)})),i.child("model").child("groups").set(r)),i.endBatch()}},onControlNodeChanged:function(e,t,a){var i=this.props.sbCompositionRef.child("dataSources").child("composition").child("controlNode").child("model").child("fields").child(e).child(t);if(null!==a){if("selections"===t&&"object"!==Ca(a)){try{a=JSON.parse(a)}catch(e){}a||(a=[])}i.set(a)}else i.remove()},onControlNodeValueChanged:function(e,t){this.props.sbCompositionRef.child("dataSources").child("composition").child("controlNode").child("payload").child(e).set(t)},onGroupPropertyChanged:function(e,t,a){var i=this.props.sbCompositionRef.child("dataSources").child("composition").child("controlNode").child("model").child("groups"),n=i.val();n&&n.length&&n.forEach((function(i){i.id===e&&(i[t]=a)})),i.set(n)},onUiStateChanged:function(e,t){var a=function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,l=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return o=e.done,e},e:function(e){l=!0,s=e},f:function(){try{o||null==a.return||a.return()}finally{if(l)throw s}}}}(t.body);try{for(o.s();!(n=o.n()).done;){var l=n.value;s=Math.max(l.revision_id,s)}}catch(e){o.e(e)}finally{o.f()}a=t.body,i=s}this.setState({isSaving:!1,isLoading:!1,isRestoring:!1,deleteRevision:null,revisions:a,revisionNumber:i})}.bind(this))},createRevision:function(){if(!this.state.isSaving&&0!=this.state.revisionNameValid){var e=$(n().findDOMNode(this.refs.description));this.setState({isSaving:!0});var t=e.val();S().post("/apiv1/compositions/"+window.singularScene.id+"/revisions").send({scene_id:window.singularScene.id,revision_id:this.state.revisionNumber+1,description:t}).set("Content-Type","application/x-www-form-urlencoded").end(function(a,i){if(a)N.A.add(N.A.TYPE.ERROR,{title:"Could not create revision "+t,description:a.message}),this.setState({isSaving:!1});else{if(i.headers.location)return void(window.location=i.headers.location);e.val("")}}.bind(this))}},restoreRevision:function(e){this.props.onBusy(!0),this.setState({isRestoring:!0}),S().post("/apiv1/compositions/"+window.singularScene.id+"/revisions/"+e.id+"/restore").end(),S().get("/apiv1/compositions/"+window.singularScene.id+"/revisions/"+e.id+"/content").end(function(t,a){if(t)return N.A.add(N.A.TYPE.ERROR,{title:"Could not restore revision: "+e.description,description:t.message}),this.setState({isRestoring:!1}),void this.props.onBusy(!1);var i=a.body;i.editingIds||(i.editingIds={}),i.editingIds[this.props.editingId]=!0,this.props.sbRef.child("groups").set(null),i.reloadPageAfterWritten=!0,i.saveScript=!0,i.restore=!0,this.props.sbRef.parent.parent.set(i)}.bind(this))},deleteRevision:function(e){this.setState({deleteRevision:e}),S().delete("/apiv1/compositions/"+window.singularScene.id+"/revisions/"+e.id).end(function(e,t){if(e)N.A.add(N.A.TYPE.ERROR,{title:"Delete revision failed",description:e.message});else if(t.headers.location)return this.setState({deleteRevision:null}),void(window.location=t.headers.location)}.bind(this))},render:function(){var e,t;this.state.isSaving&&(e=o().createElement("li",{className:"saving-placeholder"},o().createElement("img",{style:{height:"47px"},src:"/images/loading-bubbles.svg",className:"loader"}))),0==this.state.revisions.length&&(t=o().createElement("li",null,o().createElement("div",{className:"timeline-badge"},o().createElement("i",{className:"fa fa-exclamation"})),o().createElement("div",{className:"timeline-panel"},o().createElement("div",{className:"timeline-body warning-msg"},"No revisions have been created yet"))));var a=function(e){var t=!1;if(this.state.deleteRevision&&(t=!0,this.state.deleteRevision.id==e.id))return o().createElement("li",{key:e.id,className:"saving-placeholder"},o().createElement("img",{style:{height:"47px"},src:"/images/loading-bubbles.svg",className:"loader"}));var a=e.storageUrl?e.storageUrl:window.singularUrlBase+"apiv1/compositions/"+window.singularScene.id+"/revisions/"+e.id+"/content";return o().createElement("li",{key:e.id},o().createElement("div",{className:"timeline-badge"},o().createElement("i",{className:"fa fa-clock-o"})),o().createElement("div",{className:"timeline-panel"},o().createElement("span",{className:"timeline-id"},e.revision_id),o().createElement("div",{className:"timeline-heading"},o().createElement("h4",{className:"timeline-title"},e.description,o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"delete"},"Delete revision")},o().createElement("button",{tabIndex:"-1",onClick:this.deleteRevision.bind(this,e),className:"btn btn-danger",disabled:t,style:{height:"29px"}},o().createElement("i",{className:"fa fa-trash-o"}))),o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"restore"},"Restore composition from revision")},o().createElement("button",{tabIndex:"-1",onClick:this.restoreRevision.bind(this,e),className:"btn btn-default",disabled:t},o().createElement("i",{className:"fa fa-refresh"}))),o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"copy"},"Copy revision URL to clipboard")},o().createElement("div",{style:{float:"right"}},o().createElement(Kt(),{className:"btn btn-default","data-clipboard-text":a,"button-tabIndex":"-1"},o().createElement("i",{className:"fa fa-clipboard"})))))),o().createElement("div",{className:"timeline-body"},o().createElement("p",{className:"text-muted"},ge()(e.created_at).format("YYYY-MM-DD HH:mm:ss")," -"," ",ge()(e.created_at).fromNow()," by ",e.user_email))))}.bind(this);if(1==this.state.isLoading&&this.state.revision&&0==this.state.revision.length||1==this.state.isRestoring)return o().createElement("div",null,o().createElement("ul",{className:"timeline"},o().createElement("li",{className:"saving-placeholder"},o().createElement("img",{src:"/images/loading-bubbles.svg",className:"loader"}))));var i=!1;return(this.state.isSaving||this.state.deleteRevision||0==this.state.revisionNameValid)&&(i=!0),o().createElement("div",null,o().createElement("ul",{className:"timeline"},o().createElement("li",null,o().createElement("div",{className:"timeline-badge"},o().createElement("i",{className:"fa fa-star"})),o().createElement("div",{className:"timeline-panel"},o().createElement("div",{className:"timeline-body"},o().createElement("div",{className:"input-group"},o().createElement("input",{type:"text",className:"form-control",placeholder:"Description",onKeyUp:this.onKeyUp,ref:"description",disabled:this.state.isSaving}),o().createElement("span",{className:"input-group-btn"},o().createElement("button",{className:"btn btn-primary",style:{height:"28px"},tabIndex:"-1",type:"button",onClick:this.createRevision,disabled:i},"Create")))),o().createElement("div",{className:"timeline-footer"},"New revisions will be created from the last saved version of your composition"))),e,t,this.state.revisions.map(a)))}});var Ta=a(3757),Ma=a(9769);const Oa=o().createClass({displayName:"DisplayVariantListItem",getInitialState:function(){return{}},shouldComponentUpdate:function(e,t){return!Ma.compareObject(e,this.props)||!Ma.compareObject(t,this.state)},render:function(){var e=this,t="variant-list-item";return this.props.selected&&(t+=" selected"),o().createElement("div",{className:t,onClick:function(){return e.props.onSelect(e.props.name)}},o().createElement("div",{className:"variant-list-item-container"},o().createElement("div",{className:"title"},this.props.name),o().createElement("div",{className:"delete"},o().createElement("i",{className:"fa fa-trash",onClick:function(t){t.stopPropagation(),e.props.onDelete(e.props.name)}}))))}});var La=a(9769),Va=a(24113),Fa=/^[a-zA-Z0-9\-._~]*$/;const _a=o().createClass({displayName:"DisplayVariants",getInitialState:function(){return{variantNameValid:!1,variantName:"",newVariantNameValid:!1,newVariantName:"",variantDescription:""}},shouldComponentUpdate:function(e,t){return!La.compareObject(this.props,e)||!La.compareObject(this.state,t)},componentWillMount:function(){this.initParams(this.props)},componentWillReceiveProps:function(e){this.initParams(e)},initParams:function(e){if(e.displayVariants&&e.displayVariants.active){var t=e.displayVariants.variants,a=t.findIndex((function(t){return t.name===e.displayVariants.active}));if(-1===a)return console.log("Could not find current variant"),null;this.setState({variantName:e.displayVariants.active,variantNameValid:!0,variantDescription:t[a].description||""})}},verifyVariantName:function(e){var t=-1,a=this.props.displayVariants;return a&&a.variants&&a.variants.length&&(t=a.variants.findIndex((function(t){return t.name===e}))),!(""===e||!Fa.test(e)||-1!==t)},addVariant:function(){if(this.state.newVariantNameValid){var e;e=this.props.displayVariants&&this.props.displayVariants.variants?{active:this.state.newVariantName,variants:this.props.displayVariants.variants.slice()}:{active:this.state.newVariantName,variants:[]};var t={name:this.state.newVariantName,resolution:Va.VARIANT_RESOLUTIONS[1].id};e.variants.push(t),this.props.onDisplayVariantsChanged(e),this.setState({newVariantName:"",newVariantNameValid:!1,variantName:this.state.newVariantName,variantNameValid:!0,variantDescription:""})}},deleteVariant:function(e){var t,a=this.props.displayVariants;if(-1!==(t=a.variants.findIndex((function(t){return t.name===e})))){var i=a.active;if(a.active===a.variants[t].name){var n=a.variants.length;i=n>1?t===n-1?a.variants[n-2].name:a.variants[t+1].name:""}var s=a.variants.slice();s.splice(t,1),this.props.onDisplayVariantsChanged({active:i,variants:s})}},sortVariant:function(e){var t=this.props.displayVariants;this.props.onDisplayVariantsChanged({active:t.active,variants:ua()(t.variants,e.oldIndex,e.newIndex)})},changeVariantName:function(e,t){var a=JSON.parse(JSON.stringify(this.props.displayVariants));a.active=e,a.variants[t].name=e,this.props.onDisplayVariantsChanged(a)},changeVariantDescription:function(e,t){var a=JSON.parse(JSON.stringify(this.props.displayVariants));a.variants[t].description=e,this.props.onDisplayVariantsChanged(a)},changeVariantResolution:function(e,t){var a=JSON.parse(JSON.stringify(this.props.displayVariants));a.variants[t].resolution=e,this.props.onDisplayVariantsChanged(a)},render:function(){var e=this,t="variants",a=this.props.displayVariants;return a&&a.variants&&0!==a.variants.length||(t="globals"),o().createElement("div",{className:"display-variants"},"globals"!==t?null:o().createElement(Ta.A,{adaptationGlobals:e.props.adaptationGlobals,onAdaptationGlobalsChanged:e.props.onAdaptationGlobalsChanged}),function(){if("variants"!==t)return null;var i=a.variants.findIndex((function(e){return e.name===a.active}));if(-1===i)return console.log("Could not find current variant"),null;var n,s=a.variants[i],l=function(t){e.verifyVariantName(t,i)?e.changeVariantName(t,i):e.setState({variantNameValid:!0,variantName:a.active})},r=(0,pa.Zj)((function(t){var i=t.item;return o().createElement(Oa,{key:i.name,name:i.name,selected:i.name===a.active,onSelect:function(t){e.props.onDisplayVariantsChanged({active:t,variants:a.variants}),e.setState({variantName:t,variantNameValid:!0})},onDelete:function(t){e.deleteVariant(t)}})})),c=(0,pa.q6)((function(t){return t.items,o().createElement("div",{className:"control-node-list",ref:function(t){e.refNodeList=t}},a.variants.map((function(e,t){return o().createElement(r,{key:e.name,item:e,index:t})})))}));return o().createElement("div",{className:"body"},o().createElement("div",{className:"variant-list"},o().createElement(c,{items:a.variants,onSortEnd:e.sortVariant,axis:"y",lockAxis:"y",distance:5,pressThreshold:5,lockToContainerEdges:!0,helperClass:"dragging"})),o().createElement("div",{className:"variant-editor"},o().createElement("div",{className:"full-width-header"},"Name and resolution"),o().createElement("div",{className:"variant-name"},o().createElement("div",{className:"title"},"Name"),o().createElement("div",{style:{position:"relative"}},o().createElement("input",{type:"text",value:e.state.variantName,onChange:function(t){var a=t.target.value,i=!0;s.name!==a&&(i=e.verifyVariantName(a)),e.setState({variantNameValid:i,variantName:t.target.value})},onBlur:function(e){l(e.target.value)},onKeyDown:function(t){Fa.test(t.key)?("Escape"===t.key&&e.setState({variantNameValid:!0,variantName:a.active}),"Enter"===t.key&&l(t.target.value)):t.preventDefault()},className:"form-control name-input",placeholder:"Enter variant name"}),!e.state.variantNameValid&&e.state.variantName&&o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"name-error"},"Variant names have to be unique and only contain A-Z, a-z, 0-9 and -._~")},o().createElement("span",{className:"variant-name-error"},o().createElement("i",{className:"fa fa-exclamation-triangle"}))))),o().createElement("div",{className:"variant-description"},o().createElement("div",{className:"title"},"Description"),o().createElement("input",{type:"text",value:e.state.variantDescription,onChange:function(t){e.setState({variantDescription:t.target.value})},onBlur:function(t){e.changeVariantDescription(t.target.value,i)},onKeyDown:function(t){"Escape"===t.key&&e.setState({variantDescription:s.description||""}),"Enter"===t.key&&e.changeVariantDescription(t.target.value,i)},className:"form-control description-input",placeholder:""})),o().createElement("div",{className:"variant-resolution"},o().createElement("div",{className:"title"},"Resolution"),o().createElement("div",{className:"btn-group",style:{width:"170px"}},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{width:"170px"}},La.getTitleFromSelection(Va.VARIANT_RESOLUTIONS,s.resolution)),o().createElement("ul",{className:"dropdown-menu"},Va.VARIANT_RESOLUTIONS.map((function(t,a){return o().createElement("li",{key:a},o().createElement("a",{onClick:function(){return e.changeVariantResolution(t.id,i)}},t.title))}))))),o().createElement("div",{className:"variant-resolution-info"},(n=Va.VARIANT_RESOLUTIONS.find((function(e){return e.id===s.resolution})))?n.info:"Unknown resolution"),o().createElement("div",{className:"full-width-header"},"Adaptive Globals"),o().createElement("div",{className:"variant-globals"},o().createElement(Ta.A,{adaptationGlobals:a.variants[i].globals||{},onAdaptationGlobalsChanged:function(t){var n=JSON.parse(JSON.stringify(a));n.variants[i].globals=Object.assign({},t),e.props.onDisplayVariantsChanged(n)}}))))}())}});var Ba=a(9769);const Ua=o().createClass({displayName:"RightPanelProperties",getInitialState:function(){return{errorLogCount:0,warningLogCount:0}},componentWillMount:function(){var e=N.A.getCountByType();this.setState({errorLogCount:e.error,warningLogCount:e.warning})},shouldComponentUpdate:function(e,t){return!Ba.compareObject(this.props,e)||!Ba.compareObject(this.state,t)},componentDidMount:function(){var e=this;$(this.refs.controlNode).tab("show"),this.refs&&this.refs.browser&&(this.browserRef=this.refs.browser.refs.child,this.browserRef.filterByType("d"),this.browserRef.config({useDefaultItemDoubleClick:!1,onItemDoubleClick:this.onItemDoubleClick})),$("#datanodeBrowserModal").on("shown.bs.modal",(function(){e.browserRef.modalPending&&(e.browserRef.modalPending=!1)}))},componentWillReceiveProps:function(e){e.standaloneOnAir&&!this.props.standaloneOnAir?$(this.refs.widgetNode).tab("show"):!e.standaloneOnAir&&this.props.standaloneOnAir&&$(this.refs.controlNode).tab("show")},widgetNodeExists:function(e){if(e.standaloneOnAir){var t=e.sbCompositionRef.child("dataSources").child("composition").child("widgetNode").val();return!(!t||!t.payload)}return!1},onLogChanged:function(e){this.setState({errorLogCount:e.error,warningLogCount:e.warning})},onUpdateDnmRef:function(e){var t=this;this.onItemDoubleClick||(this.onItemDoubleClick=function(e){return t.onItemDoubleClick.dnm.onSelectDatanode(e)},this.onItemDoubleClick.setDnsManager=function(e){return t.onItemDoubleClick.dnm=e}),this.onItemDoubleClick.setDnsManager(e)},render:function(){var e;return this.props.standaloneOnAir||(e={display:"none"}),o().createElement("div",{className:"tab-area"},o().createElement("ul",{className:"nav nav-tabs",role:"tablist"},o().createElement("li",{className:"nav-item",style:e},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",href:"#widgetNode",ref:"widgetNode",style:{display:"flex",alignItems:"center"}},o().createElement("i",{className:"fa fa-database",style:{width:"20px",textAlign:"center"}}),"Widget Node")),o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",href:"#controlNode",ref:"controlNode",style:{display:"flex",alignItems:"center"}},o().createElement("i",{className:"fa fa-gamepad",style:{width:"20px",textAlign:"center"}}),"Control Nodes")),o().createElement("li",{className:"nav-item"},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",href:"#dataNode",ref:"dataNode",style:{display:"flex",alignItems:"center"}},o().createElement("i",{className:"fa fa-database",style:{width:"20px",textAlign:"center"}}),"Data Nodes")),o().createElement("li",{className:"nav-item terminal-tab",style:{display:"inherit",position:"absolute",right:"0px"}},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",href:"#revisions"},"Revisions"),o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",href:"#globals"},"Globals"),o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",href:"#settings"},"Settings"))),o().createElement("div",{className:"tab-content rightpanel-tab-content"},o().createElement("div",{role:"tabpanel",className:"tab-pane",id:"widgetNode"},o().createElement(Aa,{key:this.props.sbCompositionRef.key,sbCompositionRef:this.props.sbCompositionRef})),o().createElement("div",{role:"tabpanel",className:"tab-pane",id:"controlNode"},o().createElement(Da,{key:this.props.sbCompositionRef.key,rtdbRef:this.props.rtdbRef,sbRef:this.props.sbRef,sbCompositionRef:this.props.sbCompositionRef,onNotification:this.props.onNotification})),o().createElement("div",{role:"tabpanel",className:"tab-pane",id:"dataNode"},o().createElement(aa,{key:this.props.sbCompositionRef.key,rtdbRef:this.props.rtdbRef,sbRef:this.props.sbRef,onUpdateRef:this.onUpdateDnmRef,compositionStack:this.props.compositionStack,sbCompositionRef:this.props.sbCompositionRef})),o().createElement("div",{role:"tabpanel",className:"tab-pane",id:"revisions"},o().createElement(Pa,{rtdbRef:this.props.rtdbRef,sbRef:this.props.sbRef,editingId:this.props.editingId,onBusy:this.props.onBusy})),o().createElement("div",{role:"tabpanel",className:"tab-pane",id:"settings"},o().createElement(Qt,{mainCompositionName:this.props.mainCompositionName,onMainCompositionNameChanged:this.props.onMainCompositionNameChanged,settings:this.props.settings,onSettings:this.props.onSettings,uiSettings:this.props.uiSettings,onUISettings:this.props.onUISettings,sbMainRef:this.props.sbMainRef,sbRef:this.props.sbRef})),o().createElement("div",{role:"tabpanel",className:"tab-pane",id:"globals"},o().createElement(_a,{adaptationGlobals:this.props.adaptationGlobals,onAdaptationGlobalsChanged:this.props.onAdaptationGlobalsChanged,displayVariants:this.props.displayVariants,onDisplayVariantsChanged:this.props.onDisplayVariantsChanged}))),o().createElement("div",{id:"datanodeBrowserModal",className:"modal fade u-displaynone singular-modal-v2",tabIndex:"-1",role:"dialog"},o().createElement("div",{className:"modal-dialog modal-lg",role:"document"},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-body"},o().createElement(kt.A,{rtdbFolderRef:Dt.A.rtdbFolderRef(),showHeader:!0,browserTitle:"Datanode",showSearch:!0,ref:"browser",showInspector:!1,browserStyle:"datanode-selector-modal",showClose:!0,modalId:"datanodeBrowserModal"}))))))}});var Wa=a(92171),Ya=a(79806);const ja=o().createClass({displayName:"DisplayVariantSelector",getInitialState:function(){return{}},changeVariant:function(e){var t=JSON.parse(JSON.stringify(this.props.displayVariants));t.active=e,this.props.onDisplayVariantsChanged(t)},render:function(){var e=this,t=this.props.displayVariants.active,a=this.props.displayVariants.variants;return o().createElement("div",{className:"display-variant-selector"},o().createElement("div",{className:"title"},"Display variant"),o().createElement("div",{className:"btn-group",style:{width:"170px"}},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},t),o().createElement("ul",{className:"dropdown-menu"},a.map((function(t,a){return o().createElement("li",{key:a},o().createElement("a",{onClick:function(){return e.changeVariant(t.name)}},t.name))})))))}});var Ha=a(63210),za=a(9769),Ga=a(70782);const $a=o().createClass({displayName:"CompositionNavigatorList",mixins:[W.A],getInitialState:function(){return{logicLayerMenuOpen:!1,logicLayerCompId:null,showWidgetSubComp:!0,showLinkedSubComp:!0,mode:"composer",searchString:""}},componentWillMount:function(){var e=this;setTimeout((function(){e.props.sbAllCompsRef.on("value",(function(t){e.setState({allComps:t.val()})})),e.sBindAsObject(e.props.sbRootCompRef,"rootComp"),e.sBindAsObject(e.props.sbCompStatesRef,"compStates"),e.sBindAsObject(e.props.sbLogicLayersRef,"logicLayers")}),1)},componentDidMount:function(){},componentWillUnmount:function(){},componentWillReceiveProps:function(e){},shouldComponentUpdate:function(e,t){return!za.compareObject(this.props,e)||!za.compareObject(this.state,t)},componentDidUpdate:function(){},onCompositionControl:function(e,t,a){this.props.compositionNavControl&&(a.stopPropagation(),a.preventDefault(),this.props.compositionNavControl(e,t))},onNavigateComposition:function(e,t){t.widgetCompInfo?this.props.onEditCompStandalone&&this.props.onEditCompStandalone(t.widgetCompInfo.field.id,t.widgetCompInfo.field.title,t.widgetCompInfo.id,t.id,t.widgetCompInfo.parentId):this.props.onNavigateComposition&&this.props.onNavigateComposition(t)},onOpenLogicLayerMenu:function(e,t){this.setState({logicLayerMenuOpen:!0,logicLayerCompId:e})},onSelectLogicLayer:function(e,t){var a=this;"In"!=this.state.compStates[this.state.logicLayerCompId]||this.state.logicLayers[this.state.logicLayerCompId]||$("#btn-in-"+this.state.logicLayerCompId).click();var i=null,n=Object.keys(this.state.logicLayers).find(function(t,a){return this.state.logicLayers[t].name==e}.bind(this));if(n)i=this.state.logicLayers[n].tag;else{for(var s=function(){var e=Ga[o];if(!Object.keys(a.state.logicLayers).find(function(t,a){return this.state.logicLayers[t].tag==e}.bind(a)))return i=e,1},o=0,l=Ga.length;owindow.innerWidth&&(a=window.innerWidth-n),a<0&&(a=0),i+s>window.innerHeight&&(i=window.innerHeight-s),i<0&&(i=0),this.setState({panelLeft:a,panelTop:i,panelWidth:n,panelHeight:s})}},componentWillUnmount:function(){},componentWillReceiveProps:function(e){},shouldComponentUpdate:function(e,t){return!Ka.compareObject(this.props,e)||!Ka.compareObject(this.state,t)},componentDidUpdate:function(){var e=n().findDOMNode(this.refs.floatingPanel).getBoundingClientRect();this.setState({windowOffsetTop:e.top,windowOffsetLeft:e.left})},resizeDown:function(e){this.setState({mouseMode:"resize",mouseStartX:e.pageX,mouseStartY:e.pageY,panelResizeStartWidth:this.state.panelWidth,panelResizeStartHeight:this.state.panelHeight})},positionDown:function(e){e.preventDefault(),e.stopPropagation(),this.setState({mouseMode:"move",mouseStartX:e.pageX,mouseStartY:e.pageY,panelMoveStartTop:this.state.panelTop,panelMoveStartLeft:this.state.panelLeft})},mouseMove:function(e){if(e.preventDefault(),e.stopPropagation(),null!=this.state.mouseMode){var t=e.pageX-this.state.mouseStartX,a=e.pageY-this.state.mouseStartY;if("resize"==this.state.mouseMode){var i=this.state.panelResizeStartWidth+t,n=this.state.panelResizeStartHeight+a;i<500&&(i=500),n<200&&(n=200),this.setState({panelWidth:i,panelHeight:n})}else{var s=this.state.panelMoveStartLeft+t,o=this.state.panelMoveStartTop+a,l=this.state.snapRange;swindow.innerWidth-l&&(s=window.innerWidth-this.state.panelWidth),s<0&&(s=0)),owindow.innerHeight-l&&(o=window.innerHeight-this.state.panelHeight),o<0&&(o=0)),this.setState({panelLeft:s,panelTop:o})}}},mouseUp:function(e){e.preventDefault(),e.stopPropagation(),this.setState({mouseMode:null});var t={left:this.state.panelLeft,top:this.state.panelTop,width:this.state.panelWidth,height:this.state.panelHeight};try{localStorage.setItem("CompositionNavigatorPosAndSize",JSON.stringify(t))}catch(e){}},onClose:function(){this.props.onClose&&this.props.onClose()},onCompositionControl:function(e,t,a){a.stopPropagation(),a.preventDefault(),this.props.compositionNavControl(e,t)},render:function(){var e,t={left:this.state.panelLeft+"px",top:this.state.panelTop+"px",width:this.state.panelWidth+"px",height:this.state.panelHeight+"px"};if(1==this.props.visible?t.visibility="visible":t.visibility="hidden",null!=this.state.mouseMode){var a={width:window.innerWidth,height:window.innerHeight,position:"absolute",left:-this.state.windowOffsetLeft,top:-this.state.windowOffsetTop,zIndex:1001};e=o().createElement("div",{style:a,onMouseMove:this.mouseMove,onMouseUp:this.mouseUp})}return o().createElement("div",{style:t,ref:"floatingPanel",className:"comp-nav-window"},o().createElement("div",{className:"comp-nav-header"},o().createElement("div",{className:"comp-nav-header-title",onMouseDown:this.positionDown},o().createElement("span",null,"Composition Navigator")),o().createElement("div",{className:"comp-nav-header-ibox",onClick:this.onClose},o().createElement("i",{className:"fa fa-times"}))),o().createElement($a,{rootCompName:this.props.rootCompName,sbAllCompsRef:this.props.sbAllCompsRef,sbRootCompRef:this.props.sbRootCompRef,sbCompStatesRef:this.props.sbCompStatesRef,sbLogicLayersRef:this.props.sbLogicLayersRef,onNavigateComposition:this.props.onNavigateComposition,onEditCompStandalone:this.props.onEditCompStandalone,compositionNavControl:this.props.compositionNavControl,selectLogicLayer:this.props.selectLogicLayer,activeCompId:this.props.activeCompId,mode:"composer"}),o().createElement("div",{className:"resizer",onMouseDown:this.resizeDown},o().createElement("i",{className:"fa fa-caret-down",style:{transform:"rotate(310deg)"}})),e)}});var Ja=a(25798),Xa=a(84348),Za=a(71906),Qa=a.n(Za),ei=a(37321),ti=a.n(ei);function ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);awindow.innerHeight-250)&&(i=window.innerHeight/2,this.localStorageSetItem("splitPaneHorizontal",i),this.forceUpdate()),(!s||s<500||s>window.innerWidth-650)&&(s=window.innerWidth/2,this.localStorageSetItem("splitPaneVertical",s),this.forceUpdate()),this.resizeRightPanelWindow(parseInt(i)),this.state.uiSettings.showInteractiveHighlight){var l=this.onAirRefCollection[this.props.sbRef.key];l&&l.setInteractiveHighlight(this.state.uiSettings.showInteractiveHighlight)}this.props.onOff({id:this.props.editingId,off:!1});try{singularanalytics.event(analyticEventType.COMP_OPENED,window.singularScene.account_id,"UI",window.location.hostname,{element_id:window.singularScene.id,user_id:window.singularUser.id,metadata:singularanalytics.getUIMetadata(analyticEventType.COMP_OPENED,{plan:window.singularUser.account.subscription.subscription_plan,brand:window.singularUser.account.brand})})}catch(e){console.error(e)}window.addEventListener("beforeunload",function(e){var t=null;return"done"!==this.state.savingState&&!0!==this.state.failToSaveToFirebase&&(e.preventDefault(),t="The composition was changed but not saved yet. Are you sure you want to close the page?",(e||window.event).returnValue=t),t}.bind(this),!1)},setSelection:function(e){if(e)this.setState({selection:e}),this.selections[this.sbRef.key]=e,this.boundingBoxRef&&this.state.uiSettings.showBoundingBox&&("widget"!=this.state.selection.type&&"composition"!=this.state.selection.type||0==this.state.selection.id?this.boundingBoxRef.drawMovementOrigin():this.boundingBoxRef.drawMovementOrigin(this.sbRef.child("tiles").val()[this.state.selection.id]));else{var t=this.getGroupArray();t.sort((function(e,t){return(e.priority>t.priority)-.5})),this.onGroupSelect(t[0])}},moveSelectedObject:function(e,t){this.getOnAirRef().moveSelectedObject(e,t)},componentWillUnmount:function(){this.firebaseUnbind()},componentDidUpdate:function(){var e=this.state.uiSettings.showBoundingBox?"default":"auto";$("#onairPreview").css("cursor",e),this.state.showEditedByOtherUser&&this.props.onOff({id:this.props.editingId,off:!0})},shouldComponentUpdate:function(e,t){return!oi.compareObject(t,this.state)},checkEditingNumber:function(e){e.exists()&&!e.val()[this.props.editingId]&&(this.props.rtdbRef.child("editingIds").off("value",this.checkEditingNumber),this.setState({showEditedByOtherUser:!0}))},ToggleGuidesMenu:function(e){zE.identify({name:window.singularUser.name,email:window.singularUser.email}),zE.activate({hideOnClose:!0})},firebaseAnimationState:function(e){var t,a,i;e.exists()?this.setState({animationState:e.val()}):this.setState({animationState:"Out1"}),this.timelineIsUpdated||(this.timelineIsUpdated=!0,e.exists()&&(t=e.val()),i="Out1"==t||"In"==t?"In":"Out",a="Out1"==t?0:"In"==t?this.getDuration().In:this.getDuration().Out,this.updateTimeline(e.key,i,a),this.updateMasterTimeline(i,a))},firebaseBind:function(e,t){this.rtdbRef=e.rtdbRef;var a=this.sbRef=e.sbRef;if(this.sBindAsObject(e.sbRef.child("settings"),"settings"),this.props.sbRef.child("compositionStates").child(this.sbRef.key).on("value",this.firebaseAnimationState),!t)if(a.key!=this.props.sbRef.key&&this.state.uiSettings.showActiveCompInPreview){var i=this.tileProperties[this.sbRef.key];i&&this.setState({standaloneOnAir:this.sbRef.key,standaloneOnAirWidth:i.width,standaloneOnAirHeight:i.height})}else""==this.tempEditCompId&&this.setState({standaloneOnAir:null});this.setSelection(this.selections[this.sbRef.key])},firebaseUnbind:function(){this.state.compositionStack.length&&(this.sUnbind("composition"),this.props.sbRef.child("compositionStates").child(this.sbRef.key).off("value",this.firebaseAnimationState))},firebaseGoTo:function(e,t,a,i){var n={name:e.name,compId:e.compId,inheritedProps:e.inheritedProps,rtdbRef:t,sbRef:a,editCompInfo:i};this.firebaseUnbind(),this.state.compositionStack.push(n),this.firebaseBind(n)},firebaseGoBack:function(e){var t={};if(this.state.compositionStack.length>1){for(var a=0;a=0;)s=this.state.compositionStack[o].editCompInfo,o--;s?this._editWidgetComp(s):this.tempEditCompId=""}return this.forceUpdate(),t},_editWidgetComp:function(e,t){this.tempEditCompId=e.compKey,this.setState({busy:!0});var a=this,i=function(){var n,s=a.onAirRefCollection[a.props.sbRef.key];s&&(n=s.getIFrameRef(null,e.widgetTileId,!0))&&n.initHasBeenCalled&&(n.onSingularEditComp(e.widgetFieldId),1)?(a.setState({busy:!1}),t&&t()):setTimeout(i,1e3)};i()},onGotoComp:function(e,t,a){if("composition"==e.type){var i=this.props.rtdbRef.child("compositions").child(e.id),n=this.sbRef.parent.child(e.id),s={};$.extend(!0,s,t),this.firebaseGoTo({name:e.name,compId:e.id,inheritedProps:s},i,n,a)}},onMessage:function(e){"edit-comp-standalone"==e.message?(this.setState({standaloneOnAir:this.tempEditCompId,standaloneOnAirWidth:e.params.width,standaloneOnAirHeight:e.params.height}),e.params.widgetNodes&&this.writeWidgetNodes(e.params.widgetNodes)):"widget-log"==e.message&&N.A.add(e.params.type,{title:e.params.log.title,description:e.params.log.description,compositionId:e.params.compositionId,tileId:e.params.tileId})},onBusy:function(e){this.setState({busy:e})},writeWidgetNodes:function(e){var t=this.props.sbRef.child("compositions").child(this.state.standaloneOnAir);if(t.exists()){var a={id:"widgetNode",name:"Widget Node",model:{fields:{}},payload:{}},i=t.child("dataSources").child("composition").child("widgetNode"),n=0;for(var s in e){var o=e[s];if(o.id&&o.type&&o.title){var l=i.push().key;a.model.fields[l]=o,a.payload[o.id]=o.defaultValue,n++}}n>0&&i.set(a)}},onEditCompStandalone:function(e,t,a,i,n){var s=this.sbRef.key;if(""==a){var o=this.props.sbRef.child("compositions").push();oi.createDefaultGroupForComposition(o),a=o.key,this.props.sbRef.child("compositionStates").child(a).set("In"),this.props.sbRef.child("compositions").child(s).child("data").child(i).child(e).set(a)}var l=this.state.compositionStack.length,r=this.firebaseGoBack(l-1)[a];r||(r=a),this._navigateToTileFromRoot(r)},exitEditCompStandalone:function(e){var t=this;if(Xa.A.ReleaseIframe(e.widgetTileId),this.tempEditCompId="",null!=this.state.standaloneOnAir){var a=this.props.sbRef.child("compositions").child(e.compKey),i=a.key,n=JSON.parse(JSON.stringify(a.val())),s=ni.v4(),o=this.props.sbRef.child("compositions/"+s);o.set(n);var l=this.props.sbRef.child("compositionStates").child(i),r=l.val();r||(r="In"),this.props.sbRef.child("compositionStates").child(s).set(r);var c=this.props.sbRef.child("compositionProps").val();We.A.COMPOSITION_PROPS.forEach((function(e){c[e]&&void 0!==c[e][i]&&t.props.sbRef.child("compositionProps").child(e).child(s).set(c[e][i]),t.props.sbRef.child("compositionProps").child(e).child(i).remove()})),l.remove(),a.remove(),e.compRef.child("data").child(e.widgetTileId).child(e.widgetFieldId).set(o.key),this.state.standaloneOnAir&&this.setState({standaloneOnAir:null});var d={};return d[a.key]=s,d}},onShowTimeline:function(e){this.setState({showTimeline:e}),e?($(".animation-wrapper").show(),$(".ruler-wrapper.top").show(),$(".animation-right-menu").show(),$(".comp-properties-panel").css("height",0),$(".composition-tree .list-group-item.active").css("width",""),$(".composition-tree .list-group-item").css("width","")):($(".animation-wrapper").hide(),$(".ruler-wrapper.top").hide(),$(".animation-right-menu").hide(),$(".comp-properties-panel").css("height","100%"),$(".composition-tree .list-group-item.active").css("width","360px"))},onDataChange:function(e){},hideBlockInputToPreview:function(){$(document).unbind("mouseup",this.hideBlockInputToPreview),$(this.blockInputToPreview).css("display","none")},splitPaneChange:function(e,t){this.blockInputToPreview&&($(this.blockInputToPreview).css("display","block"),$(document).mouseup(this.hideBlockInputToPreview)),$("#onairPreview").trigger("splitPaneChange"),"splitPaneHorizontal"==e&&this.resizeRightPanelWindow(t),this.localStorageSetItem(e,t),this.forceUpdate(),this.widgetTreeRef&&this.widgetTreeRef.forceUpdate(),setTimeout((function(){$("#onairPreview").trigger("splitPaneChange")}),100)},resizeRightPanelWindow:function(e){},onSettings:function(e,t){var a={};if(a[e]=t,"linkTimeline"==e)if(this.sbRef.key!=this.props.sbRef.key)if(t){var i=null,n=this.props.sbRef.child("compositions").val();for(var s in n){var o=n[s];if(o.tiles)for(var l in o.tiles)if(o.tiles[l].id==this.sbRef.key){i=s;break}}i||(i=this.props.sbRef.key),i&&(a.parentTimeline=i)}else this.sbRef.child("settings").child("parentTimeline").remove();else a[e]=!1,this.sbRef.child("settings").child("parentTimeline").remove();this.sbRef.child("settings").update(a)},onUISettings:function(e,t){var a=this,i={};"object"===ii(e)?i=e:i[e]=t,this.props.sbRef.child("uiSettings").update(i,!1),("editorResolutionWidth"==e||"editorResolutionHeight"==e||e.editorResolutionWidth||e.editorResolutionHeight)&&(this.UISettingsTimeoutHandler&&clearTimeout(this.UISettingsTimeoutHandler),this.UISettingsTimeoutHandler=setTimeout((function(){a.UISettingsTimeoutHandler=null,a.onResolutionSelect(a.state.uiSettings.editorResolution)}),200))},onLinkTimeline:function(e,t){this.props.sbRef.child("compositions").child(e).child("settings").child("linkTimeline").set(t),t?this.props.sbRef.child("compositions").child(e).child("settings").child("parentTimeline").set(this.sbRef.key):this.props.sbRef.child("compositions").child(e).child("settings").child("parentTimeline").remove(),t&&this.props.sbRef.child("compositionProps").child("logicLayers").child(e).remove()},onTimeline2Active:function(e,t){this.props.sbRef.child("compositionProps").child("timeline2Active").child(e).set(t)},getCompositionAnimationDuration:function(e,t){var a=0,i=0,n=t[e];for(var s in n.groups){var o=n.groups[s];"none"!=o.effects.In.effect&&(a=Math.max(a,o.keyframes.In[1])),"none"!=o.effects.Out.effect&&(i=Math.max(i,o.keyframes.Out[1]))}for(var l in n.tiles){var r=n.tiles[l];if("none"!=r.effects.In.effect&&(a=Math.max(a,r.keyframes.In[1])),"none"!=r.effects.Out.effect&&(i=Math.max(i,r.keyframes.Out[1])),"composition"==r.type&&t[r.id]&&t[r.id].settings&&t[r.id].settings.linkTimeline){var c=this.getCompositionAnimationDuration(r.id,t);a=Math.max(a,c.In),i=Math.max(i,c.Out)}}return{In:a,Out:i}},getGroupArray:function(){var e=[],t=this.sbRef.child("groups").val();for(var a in t)e.push(t[a]);return e},getTileArray:function(){var e=[],t=this.sbRef.child("tiles").val();for(var a in t)e.push(t[a]);return e},getDuration:function(){var e=0,t=0,a=this.props.sbRef.child("compositions").val();return this.getGroupArray().forEach((function(a){"none"!=a.effects.In.effect&&(e=Math.max(e,a.keyframes.In[1])),"none"!=a.effects.Out.effect&&(t=Math.max(t,a.keyframes.Out[1]))})),this.getTileArray().forEach((function(i){if("none"!=i.effects.In.effect&&(e=Math.max(e,i.keyframes.In[1])),"none"!=i.effects.Out.effect&&(t=Math.max(t,i.keyframes.Out[1])),"composition"==i.type&&a[i.id]&&a[i.id].settings&&a[i.id].settings.linkTimeline){var n=oi.getCompositionAnimationDuration(i.id,a);e=Math.max(e,n.In),t=Math.max(t,n.Out)}})),{In:e,Out:t}},updateMasterTimeline:function(e,t){var a=this.getDuration();if("In"==e){var i=Math.min(a.In,t);this.setState({masterTimelinePosition:i})}else if("Out"==e){var n=Math.min(a.In+a.Out,t+a.In);this.setState({masterTimelinePosition:n})}},updateTimelineByMasterTimelinePosition:function(e){var t=this.state.timelinePositions,a=this.getDuration(),i="In";e<=a.In?(t.In=Math.max(e,0),i="In",t.Out=0):(t.Out=Math.min(e-a.In,a.Out),i="Out",t.In=a.In),this.setState({timelinePositions:t,compActiveTimeline:i})},updateTimeline:function(e,t,a){if(e==this.sbRef.key){var i=this.state.timelinePositions,n=this.getDuration();i[t]=Math.min(a,n[t]),"In"==t?i.Out=0:"Out"==t&&(i.In=n.In),this.setState({timelinePositions:i,compActiveTimeline:t})}},getOnAirRef:function(e){return e?this.onAirRefCollection[e]:this.onAirRefCollection[this.sbRef.key]},onTimelinePosition:function(e,t,a){var i,n=this.getDuration();0==n.In&&0==n.Out||(this.updateTimeline(e,t,a),this.updateMasterTimeline(t,a),this.state.settings.linkTimeline&&(i=this.state.settings.parentTimeline),this.getOnAirRef(i).setTimelinePosition(e,t,a),this.updateBoundingBox())},onMasterTimelinePosition:function(e){var t,a=this.getDuration(),i=Math.min(e,a.In+a.Out);this.updateTimelineByMasterTimelinePosition(e),this.setState({masterTimelinePosition:i}),this.state.settings.linkTimeline&&(t=this.state.settings.parentTimeline),e<=a.In?this.getOnAirRef(t).setTimelinePosition(this.sbRef.key,"In",Math.max(e,0)):this.getOnAirRef(t).setTimelinePosition(this.sbRef.key,"Out",Math.min(e-a.In,a.Out)),this.updateBoundingBox()},onOnAirTimelinePosition:function(e,t,a){this.updateBoundingBox(),this.state.uiSettings&&!0===this.state.uiSettings.disableTimelineUpdate||this.state.showTimeline&&(this.updateTimeline(e,t,a),e==this.sbRef.key&&this.updateMasterTimeline(t,a))},onAnimationStateMoveFromTo:function(e,t){var a=this.sbRef.key;Ye.A.compAnimationState[a][a]=e,this.onAnimationStateMoveTo(t,{position:0,forceFromEditor:!0})},onAnimationStateMoveTo:function(e,t){var a=this,i=this.sbRef.key,n=Ye.A.compAnimationState[i][i];if(n){var s=this.props.sbRef.child("compositionProps").child("timeline2Active").val(),o=!0;void 0!==s[i]&&!1===s[i]&&(o=!1);var l=oi.getAnimationState(n,e,o).to;this.setState({animationState:l});var r={};r.id=Math.random();var c={name:"play2"};c.target=this.sbRef.key,c.to=l,c.options=t;for(var d=this.props.sbRef.child("compositions").val(),p=c.target;d&&d[p]&&d[p].settings&&d[p].settings.linkTimeline;)p=d[p].settings.parentTimeline;c.target=p,r.commands=[],r.commands.push(c);var m=this.props.sbRef.child("compositionProps").child("logicLayers").val();si.computeLogicLayerCompositionStates(p,p,n,m,s).forEach((function(e){r.commands.unshift({name:c.name,target:e.timeline,to:e.state}),a.props.sbRef.child("compositionStates").child(e.timeline).set(e.state)})),this.props.sbRef.child("command").set(r,!1),this.props.sbRef.child("compositionStates").child(this.sbRef.key).set(l)}},compositionNavControlAll:function(e,t){var a=this.props.sbRef.child("compositions").val(),i=(this.props.sbRef.child("compositionStates").val(),Object.keys(a));i=i.filter((function(e){return!!a[e].settings&&!a[e].settings.linkTimeline}));var n={};n.id=Math.random(),n.commands=[];for(var s=0;s0)this.onDisplayVariantsChanged(this.state.displayVariants);else{e||(e=0);var t=(0,Wa.H)(e);-1==e?(t.width=this.state.uiSettings.editorResolutionWidth,t.height=this.state.uiSettings.editorResolutionHeight):(this.props.sbRef.child("uiSettings/editorResolutionWidth").set(t.width,!1),this.props.sbRef.child("uiSettings/editorResolutionHeight").set(t.height,!1)),this.onUISettings("editorResolution",e),this.setState({editorWidth:t.width,editorHeight:t.height},(function(){this.onAirRefCollection[this.props.sbRef.key].resizeRenderWindow(),this.boundingBoxRef.drawMovementOrigin()}))}},forceCompositionUpdate:function(){this.forceUpdate()},onValueChanged:function(e,t,a){"Master-Timeline-Position"==t&&this.onMasterTimelinePosition(a)},toggleBoundingBox:function(){this.props.sbRef.child("uiSettings").update({showBoundingBox:!this.state.uiSettings.showBoundingBox},!1)},toggleInteractiveHighlight:function(){var e=!this.state.uiSettings.showInteractiveHighlight;this.props.sbRef.child("uiSettings").update({showInteractiveHighlight:e},!1);var t=this.onAirRefCollection[this.props.sbRef.key];t&&t.setInteractiveHighlight(e)},toggleWatermark:function(){this.props.sbRef.child("uiSettings").update({showWatermark:!this.state.uiSettings.showWatermark},!1)},togglePreviewSnap:function(){this.props.sbRef.child("uiSettings").update({previewSnap:!this.state.uiSettings.previewSnap},!1)},onCaptureThumbnail:function(){var e=this;this.setState({captureSnapshotBusy:!0});var t=function(){e.setState({captureSnapshotBusy:!1}),$("#captureThumbnailWarningModal").modal("show")};chrome.runtime?chrome.runtime.sendMessage("boklmleedokpmjohcpimedlfoggbchjc",{},function(e){if(e){var a=window.singularScene.id,i=oi.getApiEndpointFromBrowserShortType("c")+a+"/thumbnail",n=oi.dataURItoFile(e,a+".png"),s=S().put(i);s.field("name",n.name),window.singularScene.foldersToUpdateRecent&&window.singularScene.foldersToUpdateRecent.length>0&&s.field("folder",window.singularScene.foldersToUpdateRecent[0]),s.attach("file",n),s.end(function(e,t){e?this.onNotification("Failed to upload thumbnail","error",5,"tc"):this.onNotification("The composition thumbnail has been updated","info",5,"tc"),this.setState({captureSnapshotBusy:!1})}.bind(this))}else-1!==chrome.runtime.lastError.message.indexOf("Could not establish connection.")?t():(this.setState({captureSnapshotBusy:!1}),this.onNotification(chrome.runtime.lastError.message,"error",5,"tc"))}.bind(this)):t()},onCaptureSubComp:function(){var e=this;chrome.runtime?(this.setState({captureSubcompMessage:"Initializing sub composition snapshot",captureSubcompCancel:!1,captureSubcompBusy:!0}),$.extend(!0,{},this.props.sbRef.child("compositionStates").val()),this.compositionNavControlAll("Out1",!0),setTimeout((function(){var t=e.props.sbRef.child("compositions").val(),a=[],i=function(e){var n=t[e];for(var s in n.tiles){var o=n.tiles[s];"composition"==o.type&&t[o.id]&&(0==t[o.id].settings.linkTimeline?a.push(o.id):this.props.sbRef.child("compositionProps").child("snapshot").child(o.id).set(""),i(o.id))}}.bind(e);i(e.props.sbRef.key),e.uploadSubcompsThumbnail(a,(function(t,a){e.props.sbRef.child("compositionProps").child("snapshot").child(t).set(a)}),(function(){e.setState({captureSubcompMessage:void 0,captureSubcompCancel:!1,captureSubcompBusy:!1})}))}),500)):$("#captureThumbnailWarningModal").modal("show")},uploadSubcompsThumbnail:function(e,t,a){var i=this,n=0;E().eachSeries(e,(function(a,s){i.state.captureSubcompCancel?s():(n++,i.setState({captureSubcompMessage:"Processing sub composition "+n+" of "+e.length}),l.A.controlLib.jump2(a,a,"In"),setTimeout((function(){chrome.runtime.sendMessage("boklmleedokpmjohcpimedlfoggbchjc",{},(function(e){if(l.A.controlLib.jump2(a,a,"Out1"),e){var i=window.singularScene.id,n=oi.getApiEndpointFromBrowserShortType("c")+i+"/subcompimage",o=oi.dataURItoFile(e,i+".png"),r=S().post(n);r.field("key",a),r.attach("file",o),r.end((function(e,i){e?s(e):(i.body.url&&t&&t(a,i.body.url),s())}))}else s("cannot connect")}))}),100))}),(function(e,t){e&&("cannot connect"==e?-1!==chrome.runtime.lastError.message.indexOf("Could not establish connection.")&&$("#captureThumbnailWarningModal").modal("show"):i.onNotification("Failed to upload sub composition snapshot","error",5,"tc")),S().post("/apiv1/compositions/"+window.singularScene.id+"/subcompimage/log").end(),a&&a()}))},toggleShowActiveComp:function(){this.props.sbRef.child("uiSettings").update({showActiveCompInPreview:!this.state.uiSettings.showActiveCompInPreview},!1)},onOnAirWidgetSelect:function(e,t,a){this.sbRef.child("tiles").val()[a]&&this.__onWidgetSelect(a,"widget",t,"")},onWidgetTreeDeleteButton:function(){if(this.selectedTile){var e=this.props.sbRef.child("compositions").child(this.sbRef.key).child("groups").val();for(var t in e){var a=e[t];if(a.items&&a.items[this.selectedTile.id]){this.selectedGroup=a;break}}this.widgetTreeRef.onWidgetDelete(this.selectedTile,this.selectedGroup)}else this.selectedGroup&&this.widgetTreeRef.onGroupDelete(this.selectedGroup)},onWidgetSelect:function(e,t,a){null==e&&(e=""),this.__onWidgetSelect(t.id,t.type,a.id,e)},__onWidgetSelect:function(e,t,a,i){var n={id:e,type:t,groupId:a,startTab:i};this.setSelection(n),this.selectedTile=this.sbRef.child("tiles").val()[e],this.boundingBoxRef&&this.state.uiSettings.showBoundingBox&&this.boundingBoxRef.drawMovementOrigin(this.sbRef.child("tiles").val()[e]);var s=this.getOnAirRef();s&&(s.OnAirMouseMixinGroupId=null,s.OnAirMouseMixinTileId=e)},onGroupSelect:function(e){if(e){var t={id:e.id,type:"group"};this.setSelection(t),this.selectedGroup=e,this.selectedTile=null,this.resetRenameItem();var a=this.getOnAirRef();a&&(a.OnAirMouseMixinGroupId=e.id,a.OnAirMouseMixinTileId=null)}},onSaveComposition:function(){this.props.onManualSave&&"changed"===this.state.savingState&&this.props.onManualSave()},onSetSelection:function(e){this.setSelection(e),this.resetRenameItem()},onRenameItem:function(e){this.setState({renameItem:e})},resetRenameItem:function(){this.setState({renameItem:{id:0,type:"widget"}})},updateBoundingBox:function(){this.boundingBoxRef&&this.state.uiSettings.showBoundingBox&&(this.boundingBoxRef.setWidgetTreeSelection(this.selectedGroup,this.selectedTile),this.boundingBoxRef.forceUpdate())},onOnAirElementUpdate:function(){var e=this;this.updateBoundingBox(),setTimeout((function(){e.updateBoundingBox()}),100)},onTileProperties:function(e,t){this.tileProperties||(this.tileProperties={}),this.tileProperties[e]||(this.tileProperties[e]={}),$.extend(!0,this.tileProperties[e],t)},onPopoutPreviewWindow:function(){window.open(window.location.href.replace("edit","preview?bgcolor=black"))},onOpenScriptEditor:function(e){var t=window.location.href.replace("edit","script");e&&(t+="?"+e),window.open(t)},nameChanged:function(e){if(document.title=e.name,1==this.state.compositionStack.length){var t={name:e.name};window.singularScene.foldersToUpdateRecent&&window.singularScene.foldersToUpdateRecent.length>0&&(t.folder=window.singularScene.foldersToUpdateRecent[0]),S().put("/apiv1/compositions/"+window.singularScene.id+"/metadata").send(t).set("Content-Type","application/x-www-form-urlencoded").end(function(t,a){if(t)N.A.add(N.A.TYPE.ERROR,{title:"Cannot rename composition",description:t.message});else{if(a.headers.location)return void(window.location=a.headers.location);this.onMainCompositionNameChanged(e.name)}}.bind(this))}else this.state.compositionStack.length>1?this.state.compositionStack[this.state.compositionStack.length-2].sbRef.child("tiles").child(this.sbRef.key).update({name:e.name}):console.log("Invalid composition stack")},onCaptureSubcompCancel:function(){this.setState({captureSubcompCancel:!0})},doesCompScriptExist:function(){if(this.props.sbRef.child("script").exists()&&this.props.sbRef.child("script").val().length)return!0;for(var e=this.props.sbRef.child("compositionProps").child("scripts").val(),t=0,a=Object.entries(e);t0){var t=this.state.compositionStack;t[0].name=e,this.setState({compositionStack:t})}this.setState({mainCompositionName:e})},onAdaptationGlobalsChanged:function(e){this.props.sbRef.child("adaptationGlobals").set(e),this.setState({adaptationGlobals:e})},onDisplayVariantsChanged:function(e){var t=e.variants.filter((function(t){return t.name==e.active}))[0],a=1920,i=1080;if(t){var n,s=ri.VARIANT_RESOLUTIONS.find((function(e){return e.id===t.resolution}));s&&(a=s.width,i=s.height),n=g().addDefaultValues(n),$.extend(!0,n,t.globals),n=g().initializeGlobals(n,a,i),this.onAdaptationGlobalsChanged(n)}else a=this.state.uiSettings.editorResolutionWidth,i=this.state.uiSettings.editorResolutionHeight;this.props.sbRef.child("displayVariants").set(e),this.setState({displayVariants:e,editorWidth:a,editorHeight:i},(function(){this.onAirRefCollection[this.props.sbRef.key].resizeRenderWindow(),this.boundingBoxRef.drawMovementOrigin()}))},onToggleCompositionNavigator:function(e){var t=this;this.setState({compositionNavigatorActive:!this.state.compositionNavigatorActive},(function(){t.localStorageSetItem("singularCompNavActive",t.state.compositionNavigatorActive.toString())}))},_navigateToTileFromRoot:function(e){var t,a,i=function(e,t){for(var a in e)if(-1!=e[a].indexOf(t))return a;return null},n=this.props.sbRef.child("compositions").val(),s=this.props.sbRef.key,o=We.A.getParentChildren(s,n),l=e,r=o[0],c=o[1],d=oi.getCompositionName(n,e);if(c[e]){d=c[e][0],a=c[e][1];var p=i(r,e);t={widgetFieldId:c[e][3],widgetTileId:c[e][2],compRef:this.props.sbRef.child("compositions").child(p),compKey:e,parent:p}}for(var m=[{id:e,name:d,widgetCompInfo:a,editCompInfo:t}],u=null;l!=s;)for(var h in r)if(-1!=r[h].indexOf(l)){var f=oi.getCompositionName(n,h),g=void 0,v=void 0;if(c[h]){f=c[h][0],v=c[h][1];var b=i(r,h);g={widgetFieldId:c[h][3],widgetTileId:c[h][2],compRef:this.props.sbRef.child("compositions").child(b),compKey:h,parent:b}}m[0].inheritedProps={compositionDataNodes:this.props.sbRef.child("compositions").child(h).child("dataSources").child("composition").child("dataNodes").val(),compositionControlNode:this.props.sbRef.child("compositions").child(h).child("dataSources").child("composition").child("controlNode").val(),compositionWidgetNode:this.props.sbRef.child("compositions").child(h).child("dataSources").child("composition").child("widgetNode").val()},m.unshift({id:h,name:f,widgetCompInfo:v,editCompInfo:g}),l=h;break}m[0].name="root",this.firebaseUnbind();for(var y=null,E=1;E1&&(e=this.state.compositionStack[this.state.compositionStack.length-1],this.onBreadCrumbClick(this.state.compositionStack[this.state.compositionStack.length-2])),e},onBreadCrumbClick:function(e){e.editCompInfo?this.onEditCompStandalone(e.editCompInfo.widgetFieldId,e.name,e.editCompInfo.compKey,e.editCompInfo.widgetTileId,e.editCompInfo.parent):this.onNavigateComposition({id:e.compId})},onNavigateComposition:function(e){var t=this.state.compositionStack.length;this.firebaseGoBack(t-1),null!=e.id&&"root"!=e.id&&this._navigateToTileFromRoot(e.id)},onNagivateToWidgetInComp:function(e,t,a){this.sbRef.key!=a&&this.onNavigateComposition({id:a}),this.__onWidgetSelect(e,"widget",t,"")},forceUpdateIFrame:function(e){var t=this.getOnAirRef().getIFrameRef(this.sbRef.key,e);t.forceRandomNumber=Math.random(),t.forceUpdate()}}),pi=o().createClass({displayName:"CompositionConfirmEdit",getInitialState:function(){return{confirmEdit:!1,confirmEditMessage:""}},componentDidMount:function(){var e=this.props.activeUser,t=this.props.isScriptEditor?"script":"composition",a="This "+t+" is currently being edited by user "+e+". Clicking OK will close the "+t+" editor for user "+e+" and allow you to edit this "+t+".";this.setState({confirmEdit:!0,confirmEditMessage:a})},actionconfirmEdit:function(){this.props.rtdbFileRef.update({dontAsk:!0},(function(){window.location.reload()}))},actionCancel:function(){window.location.href="/dashboard"},render:function(){var e=this;return o().createElement(Qa(),{key:"sweetalertlogout",show:1==this.state.confirmEdit,title:"",text:this.state.confirmEditMessage,showCancelButton:!0,onConfirm:function(){e.setState({confirmEdit:!1}),e.actionconfirmEdit()},onCancel:function(){e.setState({confirmEdit:!1}),e.actionCancel()},onEscapeKey:function(){e.setState({confirmEdit:!1}),e.actionCancel()},onOutsideClick:function(){e.props.disableOutsideClick||(e.setState({confirmEdit:!1}),e.actionCancel())}})}});var mi=a(70187),ui=a(9769);const hi=o().createClass({displayName:"ScriptEditorMenu",getInitialState:function(){return{fetchScriptLibraryBusy:!1,scriptLibraryContent:null,fetchScriptBusy:!1}},componentDidMount:function(){this.fetchScriptLibrary()},componentWillUnmount:function(){},componentDidUpdate:function(){},shouldComponentUpdate:function(e,t){return!ui.compareObject(e,this.props)||!ui.compareObject(t,this.state)},fetchScriptLibrary:function(){this.setState({fetchScriptLibraryBusy:!0}),S().get("https://script.singular.live/examples/InventoryVer2.json").end(function(e,t){if(e)console.log("cannot read script editor library");else{if(t.headers.location)return void(window.location=t.headers.location);var a;try{a=JSON.parse(t.text)}catch(e){console.log("cannot read script editor library. Parsing failed")}a&&a.content&&this.setState({scriptLibraryContent:a.content})}this.setState({fetchScriptLibraryBusy:!1})}.bind(this))},onInsertExampleScript:function(e){this.setState({fetchScriptBusy:!0}),S().get("https://s3.amazonaws.com/script.singular.live/examples/"+e.file).end(function(e,t){if(e)console.log("cannot read script");else{if(t.headers.location)return void(window.location=t.headers.location);this.props.onInsertText(t.text)}this.setState({fetchScriptBusy:!1})}.bind(this))},render:function(){var e,t=function(e,t){return o().createElement(j(),{key:t,placement:"right",delayShow:500,overlay:o().createElement(z(),{id:"tip-"+t},e.info)},o().createElement("li",null,o().createElement("a",{onClick:this.onInsertExampleScript.bind(this,e)},e.name)))}.bind(this),a=[],i=!0;if(this.state.scriptLibraryContent)switch(this.props.currentFileId){case"overlay":a=this.state.scriptLibraryContent.overlay,i=!1;break;case"global":a=this.state.scriptLibraryContent.global,i=!1;break;case void 0:a=[];break;default:a=this.state.scriptLibraryContent.compositions,i=!1}e=this.state.fetchScriptBusy?o().createElement("div",null,o().createElement("button",{className:"btn btn-default",tabIndex:"-1"},o().createElement("img",{src:"/images/loading-bubbles.svg",style:{height:"28px"}}))):o().createElement("div",{className:"btn-group"},o().createElement(j(),{placement:"bottom",overlay:o().createElement(z(),{id:"help"},"Script Library")},o().createElement("button",{tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:i},o().createElement("i",{style:{position:"relative",left:"-6px"},className:"fa fa-book"}))),o().createElement("ul",{className:"dropdown-menu dropdown-menu-right"},a.map(t)));var n=o().createElement("div",{className:"btn-group"},o().createElement(j(),{placement:"bottom",overlay:o().createElement(z(),{id:"help"},"Developer Resources")},o().createElement("button",{tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},o().createElement("i",{style:{position:"relative",left:"-6px"},className:"fa fa-question"}))),o().createElement("ul",{className:"dropdown-menu dropdown-menu-right"},o().createElement("li",null,o().createElement("a",{href:"https://developer.singular.live/composition-scripting/introduction",target:"_blank"},"Composition Script")),o().createElement("li",null,o().createElement("a",{href:"https://developer.singular.live/data-stream-api/introduction",target:"_blank"},"Data streams")),o().createElement("li",null,o().createElement("a",{href:"https://developer.singular.live/software-development-kits/overlay-sdk",target:"_blank"},"Singular Overlay SDK")),o().createElement("li",null,o().createElement("a",{href:"https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts",target:"_blank"},"Code Editor Keyboard Shortcuts"))));return o().createElement("div",{style:{display:"flex"}},e,n)}});var fi=a(23233),gi=a.n(fi),vi=a(9769);const bi=o().createClass({displayName:"ScriptEditorSettings",getInitialState:function(){return{}},shouldComponentUpdate:function(e,t){return!vi.compareObject(e,this.props)||!vi.compareObject(t,this.state)},componentWillReceiveProps:function(e){e.editorSettings&&this.setState(Object.assign({},e.editorSettings))},open:function(){$("#scriptEditorSettingsModal").modal("show")},onPropertyChanged:function(e,t){var a={};t.target&&void 0!==t.target.checked?a[e]=t.target.checked:a[e]=t,this.setState(a,function(){this.props.onScriptEditorSettings&&this.props.onScriptEditorSettings(this.state)}.bind(this))},render:function(){var e=function(e,t){var a=this.state[t];return void 0===a&&(a=!1),o().createElement("tr",null,o().createElement("td",null,o().createElement("span",{className:"lbl"},e)),o().createElement("td",null,o().createElement("label",{className:"switch rounded small",style:{margin:"0px"}},o().createElement("input",{className:"switch-input",style:{visibility:"inherit"},type:"checkbox",checked:a,onChange:this.onPropertyChanged.bind(this,t)}),o().createElement("span",{className:"switch-label","data-on":"ON","data-off":"OFF"}),o().createElement("span",{className:"switch-handle"}))))}.bind(this),t="12px";this.state.fontSize&&(t=this.state.fontSize);var a=2;return this.state.tabSize&&(a=this.state.tabSize),this.state.renderWhitespace&&this.state.tabSizrenderWhitespace,this.state.keyboardHandler&&this.state.keyboardHandler,o().createElement("div",{id:"scriptEditorSettingsModal",className:"modal fade u-displaynone singular-modal",tabIndex:"-1",role:"dialog"},o().createElement("div",{className:"modal-dialog modal-lg",role:"document",style:{width:"400px",top:"60px"}},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-header",style:{padding:"10px 15px 0px 15px"}},o().createElement("div",{style:{fontSize:"16px",display:"inline-block"}},"Code Editor Settings"),o().createElement("button",{tabIndex:"-1",type:"button",className:"close","data-dismiss":"modal","aria-label":"Close",style:{padding:"0px",display:"inline-block"}},o().createElement("span",{"aria-hidden":"true"},o().createElement("i",{className:"fa fa-times",style:{position:"relative",fontSize:"12px",top:"-6px"}})))),o().createElement("div",{className:"modal-body"},o().createElement("div",{style:{display:"flex",justifyContent:"space-between",maxWidth:"690px"}},o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement("span",{className:"lbl"},"Tab Size")),o().createElement("td",null,o().createElement("div",{className:"dropdown"},o().createElement("button",{className:"btn btn-default dropdown-toggle",type:"button","data-toggle":"dropdown",style:{margin:"0px"}},a,o().createElement("span",{className:"caret"})),o().createElement("ul",{className:"dropdown-menu",style:{minWidth:"110px",textAlign:"center"}},o().createElement("li",null,o().createElement("a",{onClick:this.onPropertyChanged.bind(this,"tabSize","2")},"2")),o().createElement("li",null,o().createElement("a",{onClick:this.onPropertyChanged.bind(this,"tabSize","4")},"4")),o().createElement("li",null,o().createElement("a",{onClick:this.onPropertyChanged.bind(this,"tabSize","8")},"8")))))),o().createElement("tr",null,o().createElement("td",null,o().createElement("span",{className:"lbl"},"Font Size")),o().createElement("td",null,o().createElement("div",{className:"dropdown"},o().createElement("button",{className:"btn btn-default dropdown-toggle",type:"button","data-toggle":"dropdown",style:{margin:"0px"}},t,o().createElement("span",{className:"caret"})),o().createElement("ul",{className:"dropdown-menu",style:{minWidth:"110px",textAlign:"center"}},o().createElement("li",null,o().createElement("a",{onClick:this.onPropertyChanged.bind(this,"fontSize","10px")},"10px")),o().createElement("li",null,o().createElement("a",{onClick:this.onPropertyChanged.bind(this,"fontSize","12px")},"12px")),o().createElement("li",null,o().createElement("a",{onClick:this.onPropertyChanged.bind(this,"fontSize","14px")},"14px")),o().createElement("li",null,o().createElement("a",{onClick:this.onPropertyChanged.bind(this,"fontSize","18px")},"18px")))))),e("Dark Theme","darkTheme"),e("Show Line Numbers","lineNumbers"),e("Wrap Lines","wrapLines"),e("Indent with Tabs","indentWithTabs"),e("Render Whitespace","renderWhitespace"))))))))}});var yi=a(95474),Ei=a.n(yi),wi=a(9769);const Si=o().createClass({displayName:"CodeEditorTabs",getInitialState:function(){return this.editorsHaveBeenInitialized=!1,{editors:void 0,searchString:""}},componentWillMount:function(){this.componentWillReceiveProps(this.props)},componentWillReceiveProps:function(e){if(e.initialState&&e.files&&e.files.length&&0==this.editorsHaveBeenInitialized){var t=[];if(e.initialState.tabs.forEach((function(a){e.files.find((function(e){return e.id==a.id}))&&t.push({id:a.id})})),0==t.length){var a,i=e.files.find((function(e){return"none"!=e.state}));i||(i=e.files.find((function(e){return"Root Composition"==e.name})))?a=i.id:e.files[0]&&(a=e.files[0].id),a&&t.push({id:a})}this.setState({editors:t});var n,s=t.find((function(t){return t.id==e.initialState.selected}));s?n=s.id:t[0]&&(n=t[0].id),this.selectTab(n),this.editorsHaveBeenInitialized=!0}},shouldComponentUpdate:function(e,t){return!wi.compareObject(e,this.props)||!wi.compareObject(t,this.state)},componentDidUpdate:function(e,t){this.editorsHaveBeenInitialized&&t&&this.state&&(!wi.compareObject(t.editors,this.state.editors)||e.currentFileID!=this.props.currentFileID)&&this.saveEditorTabs()},resetEditors:function(){this.editorsHaveBeenInitialized=!1},saveEditorTabs:function(){this.props.onEditorTabsSave&&this.props.onEditorTabsSave({selected:this.props.currentFileID,tabs:this.state.editors})},selectTab:function(e){this.props.onCurrentFileIdChanged(e)},closeTab:function(e,t){var a=this.props.currentFileID;if(a==e)for(var i=0;i0?this.state.editors[i-1].id:void 0;break}var n=this.state.editors.filter((function(t){return t.id!=e}));this.setState({editors:n}),a!=this.props.currentFileID&&this.selectTab(a),t.preventDefault(),t.stopPropagation()},addTab:function(e){if(this.state.editors&&this.state.editors.find((function(t){return t.id==e})))this.selectTab(e);else{var t=[];this.state.editors&&(t=this.state.editors.slice()),t.push({id:e}),this.setState({editors:t}),this.selectTab(e)}},onSortEnd:function(e){this.setState({editors:ua()(this.state.editors,e.oldIndex,e.newIndex)})},adjustDropDownPosition:function(){if(this.refs.AddFileDropDownButton&&this.refs.AllTabs){var e=this.refs.AddFileDropDownButton.getBoundingClientRect(),t=this.refs.AllTabs.getBoundingClientRect(),a=-2;e.right+151>t.right&&(a=-151),this.refs.AddFileDropDownMenuOffset.style.left=a+"px"}},onSearchChanged:function(e){this.setState({searchString:e.target.value})},onClearSearch:function(e){this.setState({searchString:""}),$(this.refs.AddFileDropDown).addClass("open")},onSearchKeyDown:function(e){"Escape"==e.key&&this.onClearSearch()},render:function(){var e,t=function(e){switch(e){case"exists":return o().createElement("i",{className:"fa fa-check-circle code-editor-tab-icon"});case"changed":return o().createElement("i",{className:"fa fa-circle code-editor-tab-icon"});case"error":return o().createElement("i",{className:"fa fa-exclamation-circle code-editor-tab-icon",style:{color:"red"}});case"eval":return o().createElement("i",{className:"fa fa-circle-o-notch fa-spin code-editor-tab-icon-spinner"});default:return o().createElement("i",{className:"fa fa-close code-editor-tab-icon",style:{color:"transparent"}})}},a=function(e){var a=10*e.level,i={left:a+"px",width:"calc(100% - "+(a+15)+"px)"};return this.state.searchString&&-1!==e.name.toUpperCase().indexOf(this.state.searchString.toUpperCase())&&(i.color="#f0ad4e"),o().createElement("li",{key:"key-"+e.id,className:"code-editor-tab-add-dropdown-item"},o().createElement("a",{onClick:this.addTab.bind(this,e.id)},t(e.state),o().createElement("div",{className:"code-editor-tab-label",style:i},e.name)))}.bind(this);e=this.state.searchString?o().createElement("i",{className:"fa fa-times input-clear-icon-widget-tree",onClick:this.onClearSearch}):o().createElement("i",{className:"fa fa-search filter-input-icon"});var i=o().createElement("div",{className:"dropdown code-editor-tab-add",ref:"AddFileDropDown"},o().createElement("button",{className:"btn btn-default dropdown-toggle code-editor-tab-add-button",tabIndex:"-1","data-toggle":"dropdown",onMouseDown:this.adjustDropDownPosition,ref:"AddFileDropDownButton"},o().createElement("i",{className:"fa fa-plus"})),o().createElement("div",{ref:"AddFileDropDownMenuOffset",style:{left:"-2px",top:"-30px",position:"relative"}},o().createElement("div",{className:"dropdown-menu dropdown-container"},o().createElement("div",{className:"widget-tree-filter",style:{position:"relative",display:"inline-block"}},e,o().createElement("input",{type:"text",className:"form-control filter-input",placeholder:"Find ...",value:this.state.searchString,onKeyDown:this.onSearchKeyDown,onChange:this.onSearchChanged,style:{width:"188px"}})),o().createElement("ul",{className:"dropdown-menu code-editor-tab-add-dropdown"},this.props.files.map(a))))),n=(0,pa.Zj)(function(e){var a=this.props.files.find((function(t){return t.id==e.value.id})),i="code-editor-tab";return a.id==this.props.currentFileID&&(i+=" active"),o().createElement(j(),{placement:"bottom",delayShow:500,overlay:o().createElement(z(),{id:a.id},a.toolTip)},o().createElement("div",{key:a.id,className:i,onClick:this.selectTab.bind(this,a.id)},t(a.state),o().createElement("div",{className:"code-editor-tab-label"},a.name),o().createElement("div",{className:"code-editor-tab-close",onClick:this.closeTab.bind(this,a.id)},o().createElement("i",{className:"fa fa-close"}))))}.bind(this)),s=[];this.state.editors&&(s=this.state.editors.filter(function(e){return this.props.files.find((function(t){return t.id==e.id}))}.bind(this)));var l=(0,pa.q6)((function(e){var t=e.items;return o().createElement("div",{className:"code-editor-tabs"},t.map((function(e,t){return o().createElement(n,{key:e.id,index:t,value:e})})))}));return o().createElement("div",{style:{width:"100%",display:"flex",background:"linear-gradient(#3e3e3e, #2b2b2b)",borderBottom:"solid 2px #212121"},ref:"AllTabs"},o().createElement(l,{items:s,onSortEnd:this.onSortEnd,axis:"x",lockAxis:"x",distance:5,pressThreshold:5,lockToContainerEdges:!0,helperClass:"code-editor-tab-drag"}),i)}});a(8263),a(74144),a(77011),a(42e3),a(6464),a(88949),a(88821),a(16398);var Ni=a(9769),Ci=a(56574),xi=a(62418),Ii=a(11206);const ki=o().createClass({displayName:"CodeEditor",getInitialState:function(){return this.localFiles={},this.aceEditorSessions={},this.oldSaveButtonState=void 0,this.compDSUpdate=void 0,{savingState:"done",currentFileID:null,initialTabState:void 0,script:"",evalStatus:"",evalStatusErrorList:[],compTreeRoot:void 0,compTreeStructure:{}}},componentWillMount:function(){},componentDidMount:function(){var e=this;if(this.onLoadComposition(),window.addEventListener("message",this.previewWindowScriptMessageReceived,!1),window.addEventListener("beforeunload",function(e){var t=null;return this.didScriptChangeSinceLastSave()&&(e.preventDefault(),t="The script was changed but not saved. Are you sure you want to close the page?",(e||window.event).returnValue=t),t}.bind(this),!1),setTimeout((function(){e.refs.aceEditorRef&&e.refs.aceEditorRef.editor&&e.state.currentFileID&&void 0!==e.localFiles[e.state.currentFileID]&&e.refs.aceEditorRef.editor.getSession().setValue(e.localFiles[e.state.currentFileID].script)}),2e3),window.singularScene.datastore&&!this.compDSUpdate){var t=new(c())(null);new(b())(t,window.singularScene.datastore,window.singularScene.pv).then((function(t){var a=t.update;e.compDSUpdate=a}))}},componentDidUpdate:function(){var e=this.refs.aceEditorRef;e&&e.editor.resize()},shouldComponentUpdate:function(e,t){return!Ni.compareObject(e,this.props)||!Ni.compareObject(t,this.state)},onLoadComposition:function(){this.refs.CodeEditorTabs&&this.refs.CodeEditorTabs.resetEditors(),this.loadCompositionData(),this.loadScriptData(),this.loadInitialTabState()},loadScriptData:function(){var e=this;this.localFiles={},this.props.sbRef.child("script").once("value",(function(t){var a="";if(t.exists()){a=t.val();try{a=Ei().decompress(a,{inputEncoding:"StorageBinaryString"})}catch(e){}}e.setLocalProperty("overlay","script",a),e.aceEditorSessions.overlay&&e.aceEditorSessions.overlay.setValue(a),e.setLocalProperty("overlay","lastSaveScript",a),a.length&&(e.props.safemode?e.setLocalProperty("overlay","evalStatus","ok"):e.setLocalProperty("overlay","evalStatus","eval")),e.updateEditor()})),this.props.sbRef.child("compositionProps").child("scripts").once("value",(function(t){if(t.exists()){var a=t.val();Object.keys(a).forEach(function(e){var t=a[e];try{t=Ei().decompress(t,{inputEncoding:"StorageBinaryString"})}catch(e){}this.setLocalProperty(e,"script",t),this.aceEditorSessions[e]&&this.aceEditorSessions[e].setValue(t),this.setLocalProperty(e,"lastSaveScript",t),t.length&&(this.props.safemode?this.setLocalProperty(e,"evalStatus","ok"):this.setLocalProperty(e,"evalStatus","eval"))}.bind(e)),e.updateEditor()}})),this.props.safemode&&setTimeout(function(){this.updateEditor()}.bind(this),1e3)},loadCompositionData:function(){var e=this;this.setState({compTreeRoot:void 0,compTreeStructure:{}}),this.props.sbRef.child("compositions").once("value",(function(t){var a=t.val(),i=e.props.sbRef.key,n={};Ni.getSubcompositionNamesEx(a,i,n),e.setState({compTreeRoot:i,compTreeStructure:n})}))},loadInitialTabState:function(){var e=this;this.setState({initialTabState:void 0}),this.props.rtdbRef.child("scriptEditorTabs").once("value",(function(t){var a=t.val();a||(a={tabs:[],selected:null}),e.setState({initialTabState:a,currentFileID:a.selected})}))},setLocalProperty:function(e,t,a){this.localFiles[e]||(this.localFiles[e]={script:"",lastSaveScript:"",evalStatus:"",evalStatusErrorList:[]}),this.localFiles[e][t]=a,"evalStatus"==t&&this.setState({forceRender:Math.random()})},didScriptChangeSinceLastSave:function(){var e=this,t=!1;return Object.keys(this.localFiles).forEach((function(a){e.localFiles[a].script!=e.localFiles[a].lastSaveScript&&(t=!0)})),t},updateUpdateSaveButtonChangedState:function(e){this.oldSaveButtonState!==e&&(e?this.props.onSaveButtonStateChanged("HighlightOn"):this.props.onSaveButtonStateChanged("HighlightOff"),this.oldSaveButtonState=e)},onScriptChange:function(e){this.setLocalProperty(this.state.currentFileID,"script",e),this.setState({script:e}),this.updateUpdateSaveButtonChangedState(this.didScriptChangeSinceLastSave())},onSave:function(){var e,t,a=this,i={},n={};for(var s in Object.keys(this.localFiles).forEach(function(a){this.setLocalProperty(a,"evalStatusErrorList",[]);var s=this.localFiles[a].script;this.localFiles[a].lastSaveScript!=s&&(this.setLocalProperty(a,"lastSaveScript",s),s.length?this.props.safemode?this.setLocalProperty(a,"evalStatus","ok"):this.setLocalProperty(a,"evalStatus","eval"):this.setLocalProperty(a,"evalStatus","none"),"overlay"===a?e=Ei().compress(s,{outputEncoding:"StorageBinaryString"}):i[a]=Ei().compress(s,{outputEncoding:"StorageBinaryString"})),"overlay"===a?t=Ei().compress(s,{outputEncoding:"StorageBinaryString"}):n[a]=Ei().compress(s,{outputEncoding:"StorageBinaryString"})}.bind(this)),this.updateEditor(),i)0==i[s].length&&(i[s]=null);var o={},l={};for(var r in n)0==n[r].length?delete n[r]:o[r]=!0;for(var c in this.state.compTreeStructure)o[c]||(l[c]=!0);this.localFiles.global&&""==this.localFiles.global.script&&(l.global=!0);try{this.props.onSaveButtonStateChanged("saving");var d=0,p=function(){1==d?(this.props.onSaveButtonStateChanged("done"),this.updateUpdateSaveButtonChangedState(!1)):d++}.bind(this);Ci.uploadCompositionJSON(JSON.stringify({overlayScript:t,subCompScripts:n,noScripts:l}),window.singularScene.id,"script",(function(t,n){Ci.updateCompositionMetadata({id:window.singularScene.id,s3_script:1},(function(t,n){t&&console.error(t),void 0!==e?(a.props.sbRef.child("script").set(e),a.props.rtdbRef.child("ts").set({".sv":"timestamp"}),a.compDSUpdate&&a.compDSUpdate({ts:Date.now()}),p()):(a.props.onCompileScript("overlay"),p()),0!==Object.keys(i).length?(a.props.sbRef.child("compositionProps").child("scripts").update(i),a.props.rtdbRef.child("ts").set({".sv":"timestamp"}),a.compDSUpdate&&a.compDSUpdate({ts:Date.now()}),p()):(a.props.onCompileScript("compScript"),p())}))}))}catch(e){this.props.onSaveButtonStateChanged("error")}},onEditorTabsSave:function(e){this.props.rtdbRef.child("scriptEditorTabs").set(e,(function(){}))},previewWindowScriptMessageReceived:function(e){if(e&&e.data&&e.data.type&&e.data.params)switch(e.data.type){case"overlay_ready":console.log("Message to Overlay SDK: ready: ",e.data.params);break;case"overlay_error":console.log("Message to Overlay SDK: error: ",e.data.params);break;case"overlay_message":console.log("Message to Overlay SDK: message: ",e.data.params);break;case"overlay_transformElement":console.log("Message to Overlay SDK: transformElement: ",e.data.params);break;case"overlay_controlVideo":console.log("Message to Overlay SDK: controlVideo: ",e.data.params);break;case"overlay_controlAudio":console.log("Message to Overlay SDK: controlAudio: ",e.data.params);break;case"CompositionScriptEditorMessage":var t=e.data.params.type,a=e.data.params.message,i=e.data.params.line,n=e.data.params.compId;switch(null==n&&(n="overlay"),this.props.onPreviewWindowMessageReceived(t,a),t){case"ok":this.setLocalProperty(n,"evalStatus","ok");break;case"eval":this.setLocalProperty(n,"evalStatus","eval"),this.setLocalProperty(n,"evalStatusErrorList",[]);break;case"error":var s=this.state.evalStatusErrorList.slice();s.push({info:a,line:i}),this.setLocalProperty(n,"evalStatus","error"),this.setLocalProperty(n,"evalStatusErrorList",s);break;default:console.log("previewWindowScriptMessageReceived unknown "+e.data.type+" params",e.data.params)}this.updateEditor();break;default:console.log("SingularOverlay: onMessage: invalid type "+e.data.type)}},updateEditor:function(e){if(e||(e=this.state.currentFileID),e){var t=this.localFiles[e];t||(t={script:"",lastSaveScript:"",evalStatus:"",evalStatusErrorList:[]},this.localFiles[e]=t),e==this.state.currentFileID&&t.script===this.state.script&&t.evalStatus===this.state.evalStatus&&Ni.compareObject(t.evalStatusErrorList,this.state.evalStatusErrorList)||this.setState({currentFileID:e,script:t.script,evalStatus:t.evalStatus,evalStatusErrorList:Object.assign(t.evalStatusErrorList)})}},onCurrentFileIdChanged:function(e){if(this.props.onCurrentFileIdChanged&&this.props.onCurrentFileIdChanged(e),null!=e){var t=this.refs.aceEditorRef.editor;null==this.aceEditorSessions[e]&&(this.aceEditorSessions[e]=ace.createEditSession("","ace/mode/javascript"),this.localFiles[e]&&this.localFiles[e].script&&this.aceEditorSessions[e].setValue(this.localFiles[e].script)),e!=this.state.currentFileID&&(this.state.currentFileID&&(this.aceEditorSessions[this.state.currentFileID]=t.getSession()),t.setSession(this.aceEditorSessions[e]),this.setState({currentFileID:e}),this.updateEditor(e)),t.focus()}else this.setState({currentFileID:null,script:"",evalStatus:"",evalStatusErrorList:[]})},getFileState:function(e){var t=this.localFiles[e];return t&&t.script?t.script!=t.lastSaveScript?"changed":"ok"==t.evalStatus?t.script.length?"exists":"none":t.evalStatus:"none"},onScriptBeautify:function(){var e=this.refs.aceEditorRef.editor,t=e.getValue(),a={indent_size:this.props.editorSettings.tabSize,indent_char:" ",max_preserve_newlines:"5",preserve_newlines:!0,keep_array_indentation:!1,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1},i=xi.js(t,a),n=e.getCursorPosition();e.session.mergeUndoDeltas=!0,e.setValue(i),e.session.mergeUndoDeltas=!0,e.clearSelection(),e.session.mergeUndoDeltas=!1,e.focus(),e.moveCursorToPosition(n),this.onScriptChange(i)},onInsertText:function(e){var t=this.refs.aceEditorRef.editor,a=t.getCursorPosition();t.session.insert(a,e),t.focus(),this.onScriptChange(t.getValue())},render:function(){var e=this,t="monokai";0==this.props.editorSettings.darkTheme&&(t="xcode");var a="active";this.props.disabled&&(a="disabled");var i=this.state.script,n=this.props.disabled;this.state.currentFileID||(i="",n=!0);var s,l,r,c,d=0,p=0,m=0;Object.keys(this.localFiles).forEach((function(t){var a=e.localFiles[t].script;a&&0!==a.length&&(d++,p+=a.length,m+=(a.match(/\n/g)||"").length+1)})),d||p||m?(l=1==d?" 1 file ":Ni.numberWithCommas(d)+" files ",r=1==m?" 1 line ":Ni.numberWithCommas(m)+" lines ",c=1==p?" 1 byte":Ni.numberWithCommas(p)+" bytes",s=o().createElement("span",{style:{float:"right",whiteSpace:"pre"}},l+r+c)):s=o().createElement("span",{style:{float:"right",whiteSpace:"pre"}},"0 files 0 lines 0 bytes");var u,h=[];try{Ii.parseScript(i)}catch(e){h.push({row:e.lineNumber-1,column:e.column,text:e.description,type:"error"}),u="Syntax Error: "+e.description+" at line "+e.lineNumber+" col "+e.column}switch(this.state.evalStatus){case"ok":u||(u="OK");break;case"eval":u="Compiling ...";break;case"error":if(this.state.evalStatusErrorList.length){var f=this.state.evalStatusErrorList[0],g=f.line,v="";g&&g.line&&(h.push({row:g.line-1,column:g.col-1,text:f.info,type:"error"}),v=" - line "+g.line+" col "+g.col),u="Error: "+f.info+" "+v}else u="Error: unknown"}var b=[];if(this.state.compTreeRoot){b.push({id:"overlay",name:"Overlay Script",state:this.getFileState("overlay"),toolTip:"Overlay Script",level:0}),b.push({id:"global",name:"Global Script",state:this.getFileState("global"),toolTip:"global",level:0}),b.push({id:this.state.compTreeRoot,name:"Root Composition",state:this.getFileState(this.state.compTreeRoot),toolTip:"Root",level:0});var y=function(e,t,a){var i=[];Object.keys(e).forEach(function(t){i.push({name:e[t],id:t})}.bind(this)),i.sort((function(e,t){return e.name>t.name?1:e.namet.id?1:e.idt.name?1:e.versiont.version?1:0})),void 0!==this.state.selectedWidget&&(e=t[this.state.selectedWidget]),null==e&&(e=t[0]);var a=[];void 0!==e&&(a=e.model.fields),a.sort((function(e,t){return e.idt.id?1:0}));var i={overflow:"hidden",textOverflow:"ellipsis",display:"block",whiteSpace:"nowrap",width:"100%"},n=function(t,a){var n="";return e&&e.id==t.id&&e.version==t.version&&(n="selected"),Li.createElement("tr",{key:a,className:n,onClick:this.selectWidget.bind(this,a)},Li.createElement("td",{style:{paddingTop:"0px",lineHeight:"1",verticalAlign:"middle",paddingBottom:"0px"}},Li.createElement("img",{src:t.thumbnail,style:{width:"32px",height:"32px"}})),Li.createElement("td",{style:{verticalAlign:"middle"}},Li.createElement("div",{style:i},t.name)),Li.createElement("td",{style:{verticalAlign:"middle",textAlign:"center"}},Li.createElement("div",null,t.id)),Li.createElement("td",{style:{verticalAlign:"middle",textAlign:"center"}},Li.createElement("div",null,t.version)),Li.createElement("td",{style:{verticalAlign:"middle",textAlign:"center"}},Li.createElement("div",{style:i},t.status)))}.bind(this),s=function(e,t){return Li.createElement("tr",{key:t},Li.createElement("td",{style:{verticalAlign:"middle"}},Li.createElement("div",{style:i},e.id)),Li.createElement("td",{style:{verticalAlign:"middle"}},Li.createElement("div",{style:i},e.title)),Li.createElement("td",{style:{verticalAlign:"middle"}},Li.createElement("div",null,e.type)))}.bind(this);return Li.createElement("div",{className:"widget-explorer"},Li.createElement("div",{style:{width:"400px",height:"100%",float:"left"}},Li.createElement("div",{style:{height:"25px",textAlign:"left",paddingTop:"5px",paddingLeft:"7px",fontSize:"14px"}},"Widgets in composition"),Li.createElement("div",{style:{width:"100%",height:"calc(100% - 25px)",overflowX:"hidden",overflowY:"scroll"}},Li.createElement("table",{className:"table dark-header selectable"},Li.createElement("thead",null,Li.createElement("tr",{style:{height:"26px"}},Li.createElement("th",{style:{width:"10%"}}),Li.createElement("th",{style:{width:"50%",textAlign:"left",verticalAlign:"middle"}},"Name"),Li.createElement("th",{style:{width:"10%",textAlign:"center",verticalAlign:"middle"}},"ID"),Li.createElement("th",{style:{width:"10%",textAlign:"center",verticalAlign:"middle"}},"Version"),Li.createElement("th",{style:{width:"20%",textAlign:"center",verticalAlign:"middle"}},"Status"))),Li.createElement("tbody",null,t.map(n))))),Li.createElement("div",{style:{width:"calc(100% - 400px)",height:"100%",float:"left"}},Li.createElement("div",{style:{height:"25px",textAlign:"left",paddingTop:"5px",paddingLeft:"7px",fontSize:"14px"}},"Fields of the selected widget"),Li.createElement("div",{style:{width:"100%",height:"calc(100% - 25px)",overflowX:"hidden",overflowY:"scroll"}},Li.createElement("table",{className:"table table-striped dark-header"},Li.createElement("thead",null,Li.createElement("tr",{style:{height:"26px"}},Li.createElement("th",{style:{width:"35%",textAlign:"left",verticalAlign:"middle"}},"ID"),Li.createElement("th",{style:{width:"35%",textAlign:"left",verticalAlign:"middle"}},"Name"),Li.createElement("th",{style:{width:"30%",textAlign:"left",verticalAlign:"middle"}},"Type"))),Li.createElement("tbody",null,a.map(s))))))}});var _i=a(9769);const Bi=o().createClass({displayName:"ControlPanel",getInitialState:function(){return{}},componentWillMount:function(){},shouldComponentUpdate:function(e,t){return!_i.compareObject(this.props,e)||!_i.compareObject(this.state,t)},componentDidMount:function(){$(this.refs.compositionControl).tab("show")},componentWillUnmount:function(){},componentDidUpdate:function(){},componentWillReceiveProps:function(e){},forceRedraw:function(){this.refs.compositionControlRef&&this.refs.compositionControlRef.forceRedraw()},compositionNavControl:function(e,t,a,i){this.refs.compositionControlRef&&this.refs.compositionControlRef.compositionNavControl(e,t,a,i)},render:function(){var e=!1;return this.props.hideGlobals&&(e=!0),o().createElement("div",{style:{width:"100%",height:"100%"}},o().createElement("div",{className:"tab-area"},o().createElement("ul",{className:"nav nav-tabs",role:"tablist"},o().createElement("li",{className:"nav-item active",style:{minWidth:"100px",maxWidth:"200px"}},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",href:"#compositionControl",ref:"compositionControl"},"Composition Control")),!e&&o().createElement("li",{className:"nav-item",style:{minWidth:"100px",maxWidth:"200px"}},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",href:"#adaptation",ref:"adaptation"},"Globals")),o().createElement("li",{className:"nav-item",style:{minWidth:"100px",maxWidth:"200px"}},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",href:"#widgetExplorer",ref:"widgetExplorer"},"Widget Explorer")),o().createElement("li",{className:"nav-item",style:{minWidth:"100px",maxWidth:"200px"}},o().createElement("a",{"data-toggle":"tab",tabIndex:"-1",href:"#overlaySimulator",ref:"overlaySimulator"},"Overlay SDK Simulator"))),o().createElement("div",{className:"tab-content rightpanel-tab-content CompositionControlArea"},o().createElement("div",{role:"tabpanel",className:"tab-pane active",id:"compositionControl"},o().createElement(Ti,{forceReload:this.props.forceReload,rtdbRef:this.props.rtdbRef,sbRef:this.props.sbRef,onSetPayload:this.props.onSetPayload,showBusy:this.props.showBusy,ref:"compositionControlRef"})),!e&&o().createElement("div",{role:"tabpanel",className:"tab-pane",id:"adaptation",style:{padding:"5px"}},o().createElement(Ta.A,{rtdbRef:this.props.rtdbRef,sbRef:this.props.sbRef,onAdaptationGlobalsChanged:this.props.onAdaptationGlobalsChanged,adaptationGlobals:this.props.adaptationGlobals,ref:"adaptation"})),o().createElement("div",{role:"tabpanel",className:"tab-pane",id:"widgetExplorer",style:{padding:"5px"}},o().createElement(Fi,{forceReload:this.props.forceReload,ref:"widgetExplorerRef"})),o().createElement("div",{role:"tabpanel",className:"tab-pane",id:"overlaySimulator",style:{padding:"5px"}},o().createElement(Oi,{scriptPreviewEditor:this.props.scriptPreviewEditor,ref:"overlaySimulatorRef"})))))}});function Ui(e){return Ui="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ui(e)}var Wi=a(24113),Yi="seEditingIds";const ji=o().createClass({displayName:"CompositionScriptEditor",mixins:[W.A],getInitialState:function(){var e=!0;return new URLSearchParams(window.location.search).has("safemode")&&(this.safemode=!0,e=!1),this.skipFirstCall=!1,this.scriptPreviewEditor=void 0,{showEditedByOtherUser:!1,paneHorizontal:Math.round(window.innerHeight/2),paneVertical:Math.round(window.innerWidth/2),paneFillInForm:200,previewInteractive:!0,uiSettings:null,showInteractiveHighlight:!1,loadingPreviewBusy:e,adaptationGlobals:null}},loadScriptEditorSettings:function(){var e;try{e=localStorage.getItem("CompositionScriptEditor")}catch(e){}if(e){var t;try{t=JSON.parse(e)}catch(e){}if(t){var a={};void 0!==t.paneHorizontal&&(a.paneHorizontal=t.paneHorizontal),void 0!==t.paneVertical&&(a.paneVertical=t.paneVertical),this.setState(a)}}},componentWillMount:function(){var e=this;this.loadScriptEditorSettings(),this.props.sbRef.child("command").on("value",(function(t){try{e.getScriptPreviewEditor().document.getElementById("SingularPlayer").contentWindow.singularCompLib.onFirebaseTimelineCommand(t)}catch(e){}}));var t=this.props.sbRef.child("uiSettings").val(),a=this.props.sbRef.child("adaptationGlobals").val(),i=this.props.sbRef.child("displayVariants").val();this.setState({uiSettings:t,adaptationGlobals:a,displayVariants:i}),this.props.rtdbRef.child(Yi).on("value",this.checkEditingNumber)},componentWillUnmount:function(){},componentDidUpdate:function(){this.state.showEditedByOtherUser&&this.props.onOff({id:this.props.editingId,off:!0})},componentDidMount:function(){this.props.onOff({id:this.props.editingId,off:!1});try{singularanalytics.event(analyticEventType.COMP_SCRIPT_OPENED,window.singularScene.account_id,"UI",window.location.hostname,{element_id:window.singularScene.id,user_id:window.singularUser.id,metadata:singularanalytics.getUIMetadata(analyticEventType.COMP_SCRIPT_OPENED,{plan:window.singularUser.account.subscription.subscription_plan,brand:window.singularUser.account.brand})})}catch(e){console.error(e)}},getScriptPreviewEditor:function(){return void 0===this.scriptPreviewEditor&&document.getElementById("ScriptEditorPreview")&&(this.scriptPreviewEditor=document.getElementById("ScriptEditorPreview").contentWindow),this.scriptPreviewEditor},saveLocalStorage:function(){var e={paneHorizontal:this.state.paneHorizontal,paneVertical:this.state.paneVertical};try{localStorage.setItem("CompositionScriptEditor",JSON.stringify(e))}catch(e){}},splitPaneChange:function(e,t){var a={};a[e]=t,this.setState(a,this.saveLocalStorage()),this.refs.controlPanelRef&&this.refs.controlPanelRef.forceRedraw()},onDragStarted:function(){this.setState({previewInteractive:!1})},onDragFinished:function(){this.setState({previewInteractive:!0,forceRenderScriptEditor:Math.random()})},compositionNavControl:function(e,t){this.refs.controlPanelRef&&this.refs.controlPanelRef.compositionNavControl(e,t)},onSetPayload:function(e,t,a){var i={};i[t]=a;var n=this.getScriptPreviewEditor();if(n&&n.document){var s=n.document.getElementById("SingularPlayer");s&&s.contentWindow&&s.contentWindow.singularOnAirRef&&s.contentWindow.singularOnAirRef.setControlNodeOffline&&s.contentWindow.singularOnAirRef.setControlNodeOffline(e,i)}},onPreviewWindowMessageReceived:function(e,t){"error"==e&&(this.setState({loadingPreviewBusy:!1}),this.setInteractiveHighlight())},onScriptEditorPreviewLoad:function(){var e=this,t=function(){e.scriptPreviewEditor=void 0;try{if(e.getScriptPreviewEditor()._singular_composition_ready){for(var a in e.setState({loadingPreviewBusy:!1}),e.setInteractiveHighlight(),e.state.uiSettings&&e.onResolutionSelect(e.state.uiSettings.editorResolution),e.onDisplayVariantsChanged(e.state.displayVariants),e.getScriptPreviewEditor().document.getElementById("SingularPlayer").contentWindow.addEventListener("message",(function(t){try{var a=JSON.parse(t.data);"_singular_comp_command"!=a.event&&"_singular_update_ui_from_script"!=a.event||("setPayload"==a.params.command?(e.props.sbRef.child("compositions").child(a.params.compId).child("dataSources/composition/controlNode/payload").update(a.params.payload),"_singular_update_ui_from_script"!=a.event&&e.getScriptPreviewEditor().postMessage({event:"_singular_composition_payload_changed",params:{compId:a.params.compId,compositionId:a.params.compId,payload:a.params.payload}},"*")):"playTo"!=a.params.command&&"jumpTo"!=a.params.command||e.refs.controlPanelRef.compositionNavControl(a.params.compId,a.params.to,!0))}catch(e){console.error(e)}})),e.getScriptPreviewEditor().document.getElementById("SingularPlayer").contentWindow.onSingularMessage=function(t){if("processAction"==t.type){var a,i=t.compId;switch(t.state){case"in":a="In";break;case"out":a="Out";break;case"toggle":a="In"==e.props.sbRef.child("compositionStates").child(i).val()?"Out":"In"}e.refs.controlPanelRef.compositionNavControl(i,a,!0)}},e.props.lastPayloads){for(var i in e.props.lastPayloads[a])e.onSetPayload(a,i,e.props.lastPayloads[a][i]);e.props.sbRef.child("compositions").child(a).child("dataSources/composition/controlNode/payload").update(e.props.lastPayloads[a])}for(var a in e.props.lastStates)e.refs.controlPanelRef.compositionNavControl(a,e.props.lastStates[a],!1,!0);e.props.lastAdaptationGlobals&&Object.keys(e.props.lastAdaptationGlobals).length>0&&e._setAdaptationGlobalsToOutput(e.props.lastAdaptationGlobals),e.getScriptPreviewEditor().document.getElementById("SingularPlayer").contentWindow.document.getElementsByClassName("root-onair")[0].style.backgroundColor="black";var n=e.getScriptPreviewEditor().document.getElementById("SingularPlayer").contentWindow.singularScriptCompInfoForUI;for(var s in n.payloads){var o=n.payloads[s];e.props.sbRef.child("compositions").child(s).child("dataSources/composition/controlNode/payload").update(o),e.getScriptPreviewEditor().postMessage({event:"_singular_composition_payload_changed",params:{compId:s,compositionId:s,payload:o}},"*")}for(var s in n.states)e.refs.controlPanelRef.compositionNavControl(s,n.states[s],!0);e.props.sbRef.child("compositionProps/scripts").on("value",(function(t){e.skipFirstCall&&e.onCompileScript("compScript",t.val()),e.skipFirstCall=!0}))}else setTimeout(t,100)}catch(e){setTimeout(t,100)}};setTimeout(t,100)},onReloadComposition:function(){var e=this;this.setState({loadingPreviewBusy:!0},(function(){e.props.onReload(!0)}))},onToggleInteractiveHighlight:function(){this.setInteractiveHighlight(!this.state.showInteractiveHighlight)},setInteractiveHighlight:function(e){void 0===e?e=this.state.showInteractiveHighlight:this.setState({showInteractiveHighlight:e});try{var t=this.getScriptPreviewEditor();t&&t.document.getElementById("SingularPlayer").contentWindow.singularSetInteractiveHighlight(e)}catch(e){}},onResolutionSelect:function(e){var t=Object.assign({},this.state.uiSettings);t.editorResolution=e;var a=(0,Wa.H)(e);-1==e?(a.width=this.state.uiSettings.editorResolutionWidth?this.state.uiSettings.editorResolutionWidth:1920,a.height=this.state.uiSettings.editorResolutionHeight?this.state.uiSettings.editorResolutionHeight:1080):(t.editorResolutionWidth=a.width,t.editorResolutionHeight=a.height),this.setState({uiSettings:t}),this.getScriptPreviewEditor().document.getElementById("SingularPlayer").contentWindow.singularResizeComp(a.width,a.height)},onDisplayVariantsChanged:function(e){if(this.setState({displayVariants:e}),e.active){var t=e.variants.find((function(t){return t.name===e.active}));if(t){var a,i=1920,n=1080;if(t.resolution){var s=Wi.VARIANT_RESOLUTIONS.find((function(e){return e.id===t.resolution}));s&&(i=s.width,n=s.height,this.getScriptPreviewEditor().document.getElementById("SingularPlayer").contentWindow.singularResizeComp(s.width||1920,s.height||1080))}t.globals&&(a=g().addDefaultValues(a),$.extend(!0,a,t.globals),a=g().initializeGlobals(a,i,n),this._setAdaptationGlobalsToOutput(a))}}},onUISettings:function(e,t){var a,i=this;"object"===Ui(e)?a=Object.assign({},this.state.uiSettings,e):(a=Object.assign({},this.state.uiSettings))[e]=t,this.setState({uiSettings:a}),this.UISettingsTimeoutHandler=setTimeout((function(){i.UISettingsTimeoutHandler=null,i.onResolutionSelect(i.state.uiSettings.editorResolution)}),200)},ToggleGuidesMenu:function(e){zE.identify({name:window.singularUser.name,email:window.singularUser.email}),zE.activate({hideOnClose:!0})},onAdaptationGlobalsChanged:function(e){var t=this;this.setState({adaptationGlobals:e},(function(){t.props.sbRef.child("adaptationGlobals").update(e),t._setAdaptationGlobalsToOutput(e)}))},onCompileScript:function(e,t){var a=this;if("overlay"==e){var i=function(e){a.getScriptPreviewEditor().postMessage(JSON.stringify({event:"_singular_setScript",params:{script:e}}),"*")};void 0===t?this.props.sbRef.child("script").on("value",(function(e){i(e.val())})):i(t)}else{var n=function(e){a.getScriptPreviewEditor().document.getElementById("SingularPlayer").contentWindow.postMessage(JSON.stringify({event:"_singular_setScript",params:{script:e}}),"*")};void 0===t?this.props.sbRef.child("compositionProps/scripts").on("value",(function(e){n(e.val())})):n(t)}},_setAdaptationGlobalsToOutput:function(e){try{this.getScriptPreviewEditor().document.getElementById("SingularPlayer").contentWindow.postMessage(JSON.stringify({event:"_singular_setAdaptationGlobals",params:{data:e}}),"*"),this.getScriptPreviewEditor().postMessage({event:"_singular_setAdaptationGlobals",params:{adaptationGlobals:e},fromScriptEditor:!0},"*")}catch(e){console.error(e)}},checkEditingNumber:function(e){e.exists()&&!e.val()[this.props.editingId]&&(this.props.rtdbRef.child(Yi).off("value",this.checkEditingNumber),this.setState({showEditedByOtherUser:!0}))},render:function(){if(1==this.state.showEditedByOtherUser)return o().createElement("div",{style:{width:"100%",height:"100%"}},o().createElement(Qa(),{show:!0,title:"",text:"This script is being edited by another user",onConfirm:function(){window.location="/dashboard"},onEscapeKey:function(){window.location="/dashboard"},onOutsideClick:function(){window.location="/dashboard"}}));var e;e=this.state.previewInteractive?"auto":"none";var t,a,i,n="";this.state.showInteractiveHighlight&&(n="active"),t=1==this.safemode?o().createElement("div",{style:{textAlign:"center",marginTop:"40px"}},o().createElement("span",{style:{fontSize:"14px"}},"Safemode is enabled"),o().createElement("br",null),"You can edit and save your scripts, but the render engine will not compile or execute them.",o().createElement("br",null),"If you accidentially create an infinite loop you can use the safemode to recover your scripts."):window.singularCompId?o().createElement("iframe",{title:"Composition Script Editor",key:this.props.forceReload,onLoad:this.onScriptEditorPreviewLoad,id:"ScriptEditorPreview",src:"/compositions/"+window.singularCompId+"/preview?variant=[disable_display_variant]",style:{width:"100%",height:"100%",pointerEvents:e,border:"0px"}}):o().createElement("div",null,"Could not generate preview window"),this.state.uiSettings&&void 0!==this.state.uiSettings.editorResolution?(a=(0,Wa.H)(this.state.uiSettings.editorResolution),-1==this.state.uiSettings.editorResolution&&((a=(0,Wa.H)(-1)).width=this.state.uiSettings.editorResolutionWidth?this.state.uiSettings.editorResolutionWidth:1920,a.height=this.state.uiSettings.editorResolutionHeight?this.state.uiSettings.editorResolutionHeight:1080)):a=(0,Wa.H)(0),this.state.loadingPreviewBusy&&(i=o().createElement("div",{style:{width:"100%",height:"100%",color:"#b0b0b0"}},o().createElement("img",{src:"/images/loading-bubbles.svg",style:{left:"45%",top:"45%",width:"10%",height:"10%",position:"absolute"}})));var s,l,r=this.state.displayVariants,c=r&&r.variants&&r.variants.length;return this.safemode||(s=o().createElement(Bi,{forceReload:this.props.forceReload,rtdbRef:this.props.rtdbRef,sbRef:this.props.sbRef,ref:"controlPanelRef",onSetPayload:this.onSetPayload,onAdaptationGlobalsChanged:this.onAdaptationGlobalsChanged,adaptationGlobals:this.state.adaptationGlobals,showBusy:this.state.loadingPreviewBusy,hideGlobals:c,scriptPreviewEditor:this.getScriptPreviewEditor()})),l=c?o().createElement("div",{className:"tool"},o().createElement(ja,{displayVariants:r,onDisplayVariantsChanged:this.onDisplayVariantsChanged})):o().createElement("div",{className:"tool"},o().createElement(Ya.A,{onResolutionSelect:this.onResolutionSelect,selectedRes:a,uiSettings:this.state.uiSettings,onUISettings:this.onUISettings,optionsClassName:"render-options-menu-gray-scroll"})),o().createElement("div",{style:{width:"100%",height:"100%",backgroundColor:"rgb(56, 56, 56)"}},o().createElement("div",{style:{width:"100%",height:"100%",position:"relative"}},o().createElement(Ha.A,{split:"vertical",minSize:500,maxSize:window.innerWidth-650,defaultSize:this.state.paneVertical,onChange:this.splitPaneChange.bind(this,"paneVertical"),onDragStarted:this.onDragStarted,onDragFinished:this.onDragFinished},o().createElement(Ai,{id:"script",rtdbRef:this.props.rtdbRef,sbRef:this.props.sbRef,loadingBusy:this.state.loadingPreviewBusy,onReloadComposition:this.onReloadComposition,onPreviewWindowMessageReceived:this.onPreviewWindowMessageReceived,onCompileScript:this.onCompileScript,forceRender:this.state.forceRenderScriptEditor,safemode:this.safemode}),o().createElement("div",{style:{width:"100%",height:"100%",position:"relative"}},o().createElement(Ha.A,{split:"horizontal",minSize:250,maxSize:window.innerHeight-250,defaultSize:this.state.paneHorizontal,onChange:this.splitPaneChange.bind(this,"paneHorizontal"),onDragStarted:this.onDragStarted,onDragFinished:this.onDragFinished},o().createElement("div",{style:{width:"100%",height:"100%"}},o().createElement("div",{className:"onairPreviewToolbar",style:{width:"100%",height:"30px",display:"flex",alignItems:"center"}},o().createElement(j(),{placement:"bottom",delayShow:500,overlay:o().createElement(z(),{id:"toggleInteractiveHighlight"},"Toggle Interactive Zones")},o().createElement("div",{className:"tool "+n,onClick:this.onToggleInteractiveHighlight},o().createElement("i",{className:"fa fa-crosshairs"}))),l,o().createElement("div",{className:"tool right guides-button",onClick:this.ToggleGuidesMenu,style:{background:"#58b848"}},o().createElement("i",{className:"fa fa-question"}))),o().createElement("div",{style:{width:"100%",height:"calc(100% - 30px)"}},t,i)),o().createElement("div",{style:{width:"100%",height:"100%"}},s))))),o().createElement(Dt.A.imageSingleton,null),o().createElement(Dt.A.audioSingleton,null),o().createElement(Ja.A.colorPickerSingleton,null))}});var Hi=a(9769),zi=a(82445);const Gi=o().createClass({displayName:"AccountStatusSummary",getInitialState:function(){return this.renderIntervalId=null,{}},componentDidMount:function(){var e=this;this.renderIntervalId=setInterval((function(){e.setState({redraw:Math.random})}),6e4)},componentWillUnmount:function(){this.renderIntervalId&&clearInterval(this.renderIntervalId)},openUrl:function(e){window.open(e,"_self").focus()},render:function(){var e,t,a,i=window.singularUser.account.subscription,n=zi.SubscriptionPlans.find((function(e){if(e.id==i.subscription_plan)return e})),s="Free";if(n&&(s=n.title),i.expires_on){var l=ge()(i.expires_on).diff(ge()());l<-72e5?(e="Expired "+Hi.millisecondsToString(-l,"short")+" ago","event"==i.subscription_plan||i.subscription_plan):"event"!=i.subscription_plan&&"trial"!=i.subscription_plan||l<2592e5&&(e=Hi.millisecondsToString(l,"short")+" left")}return(i.storage_limit0&&this.onCreate())},render:function(){var e,t;if(this.state.createBusy)e=o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader",style:{height:"47px",margin:"18px"}});else{var a=!0;this.state.name.trim().length>0&&(a=!1),e=o().createElement("button",{className:"btn btn-primary",onClick:this.onCreate,disabled:a},"Create"),t=o().createElement("button",{className:"btn btn-secondary",onClick:this.onCancel,"data-dismiss":"modal","aria-label":"Close"},"Cancel")}return o().createElement("div",{className:"modal-dialog modal-lg",role:"document"},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-header"},o().createElement("button",{tabIndex:"-1",className:"close","data-dismiss":"modal","aria-label":"Close",onClick:this.onCancel},o().createElement("span",{"aria-hidden":"true"},o().createElement("i",{style:{width:"20px",height:"20px",position:"relative"},className:"fa fa-times"}))),o().createElement("h4",{className:"modal-title",id:"myModalLabel"},"Create Output")),o().createElement("div",{className:"modal-body",style:{borderRadius:"0px"}},o().createElement("div",{className:"device-config"},o().createElement("label",{className:"third"},"Name"),o().createElement("input",{className:"form-control align-left select-input",style:{width:"100%"},value:this.state.name,onChange:this.onChangeName,onKeyDown:this.onKeyDown,ref:"firstInput"}))),o().createElement("div",{className:"modal-footer",style:{borderRadius:"0px 0px 5px 5px"}},e,t)))}});a(15286);var rn=a(9769);const cn=o().createClass({displayName:"WebOutputStatusDialog",getInitialState:function(){return{appInstanceRequest:null,appInstanceLoading:!1,appInstance:"",deviceRequest:null,deviceLoading:!1,device:"",compositionRequest:null,compositionLoading:!1,composition:"",confirmDetachOutput:!1}},componentWillMount:function(){this.FetchDeviceInfo(this.props.deviceID),this.FetchAppInstanceInfo(this.props.appID)},shouldComponentUpdate:function(e,t){return!rn.compareObject(e,this.props)||!rn.compareObject(t,this.state)},componentWillReceiveProps:function(e){this.props.appID!=e.appID?this.FetchAppInstanceInfo(e.appID):this.props.compExtractId!=e.compExtractId&&this.FetchAppInstanceInfo(this.props.appID),this.props.deviceID!=e.deviceID&&this.FetchDeviceInfo(e.deviceID)},FetchAppInstanceInfo:function(e){this.setState({appInstance:null,composition:null}),e&&(this.setState({appInstanceLoading:!0}),this.appInstanceRequest&&this.appInstanceRequest.abort(),this.appInstanceRequest=S().get(rn.appendAccessTokenUrl("/apiv1/appinstances/"+e)).end(function(t,a){if(t)N.A.add(N.A.TYPE.ERROR,{title:"Failed to load control app info "+e,description:t});else if(a.headers.location)return void(window.location=a.headers.location);var i=a.body;this.setState({appInstance:i,appInstanceLoading:!1}),i&&i.outputs&&i.outputs.length&&i.outputs[0]&&i.outputs[0].composition?this.FetchCompositionInfo(i.outputs[0].composition.id):this.setState({composition:null}),this.appInstanceRequest=null}.bind(this)))},FetchCompositionInfo:function(e){e?(this.setState({compositionLoading:!0}),this.compositionRequest&&this.compositionRequest.abort(),this.compositionRequest=S().post(rn.appendAccessTokenUrl("/apiv1/browser/items")).send([{refId:e,type:"composition"}]).end(function(e,t){if(e)this.props.onNotification("Failed to fetch composition info","error",5,"tc"),this.setState({composition:null});else if(t.headers.location)return void(window.location=t.headers.location);t.body&&t.body[0]&&this.setState({composition:t.body[0]}),this.setState({compositionLoading:!1}),this.compositionRequest=null}.bind(this))):this.setState({composition:null})},FetchDeviceInfo:function(e){this.setState({device:null}),e&&(this.setState({deviceLoading:!0}),this.deviceRequest&&this.deviceRequest.abort(),this.deviceRequest=S().get(rn.appendAccessTokenUrl("/apiv1/devices/"+e)).end(function(t,a){if(t)N.A.add(N.A.TYPE.ERROR,{title:"Failed to device info "+e,description:t});else if(a.headers.location)return void(window.location=a.headers.location);this.setState({device:a.body,deviceLoading:!1}),this.deviceRequest=null}.bind(this)))},open:function(){this.refs.OutputUrlDialog&&$(this.refs.OutputUrlDialog).modal("show")},close:function(){this.refs.OutputUrlDialog&&$(this.refs.OutputUrlDialog).modal("hide")},onDetachApp:function(){this.props.onDetachApp&&this.props.onDetachApp(this.state.device)},render:function(){var e,t,a,i=function(e,t,a,i){var n={width:"34px",height:"34px"};return"composition"===i&&e&&(n={width:"34px",height:"34px"}),o().createElement("div",{className:"component-object"},o().createElement(be.A,{imageUrl:e,defaultImageUrl:t,style:n}),o().createElement("div",{className:"component-details"},o().createElement("div",null,a.name),o().createElement("div",{style:{fontSize:"11px"}},a.id)))};this.state.compositionLoading||this.state.appInstanceLoading?e=o().createElement("div",{style:{width:"100%",marginTop:"17%"}},o().createElement("img",{style:{margin:"auto",display:"block"},src:"/images/loading-bubbles-blue.svg",className:"loader"})):(t=this.state.appInstance?i(this.state.appInstance.thumbnail,"/images/default-appInstance-icon.png",this.state.appInstance,"app"):o().createElement("div",{className:"component-object",style:{fontSize:"11px",padding:"0px"}},"No control app assigned to this output"),a=this.state.composition?i(this.state.composition.thumbnail,"/images/default-composition-icon.png",this.state.composition,"composition"):o().createElement("div",{className:"component-object",style:{fontSize:"11px"}},"No composition assigned to this output"),e=o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement("span",{className:"lbl"},"Control Application")),o().createElement("td",null,t)),o().createElement("tr",null,o().createElement("td",null," "),o().createElement("td",{style:{paddingTop:"0px"}},o().createElement("span",{className:"help-text"},"This is the control application that is currently attached to this output."))),o().createElement("tr",null,o().createElement("td",null,o().createElement("span",{className:"lbl"},"Composition")),o().createElement("td",null,a)),o().createElement("tr",null,o().createElement("td",null," "),o().createElement("td",{style:{paddingTop:"0px"}},o().createElement("span",{className:"help-text"},"This is the composition that is currently being sent to this output."))))));var n=!0;this.state.appInstance&&(n=!1);var s="Output Status";return this.state.device&&this.state.device.name&&(s="Output Status - "+this.state.device.name),o().createElement("div",{id:"outputDeviceStatus",className:"modal fade u-displaynone singular-modal singular-modal-white",tabIndex:"-1",role:"dialog",ref:"OutputUrlDialog"},o().createElement("div",{className:"modal-dialog modal-lg",role:"document"},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-header"},o().createElement("button",{tabIndex:"-1",type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},o().createElement("span",{"aria-hidden":"true"},o().createElement("i",{style:{width:"20px",height:"20px",position:"relative"},className:"fa fa-times"}))),o().createElement("h4",{className:"modal-title",id:"myModalLabel"},s)),o().createElement("div",{className:"modal-body"},o().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},e)),o().createElement("div",{className:"modal-footer"},o().createElement("button",{className:"btn-detach-device","data-dismiss":"modal",disabled:n,onClick:this.onDetachApp},"Detach Output")))))}});var dn=a(53045),pn=a(9769);const mn=o().createClass({displayName:"SearchField",getInitialState:function(){return{searchValue:""}},componentDidMount:function(){},shouldComponentUpdate:function(e,t){return!pn.compareObject(e,this.props)||!pn.compareObject(t,this.state)},onChange:function(e){this.setState({searchValue:e.target.value}),"immediate"==this.props.mode&&this.props.onSearch&&this.props.onSearch(e.target.value)},onKeyDown:function(e){"Escape"==e.key&&this.clearSearchBox()},onKeyPress:function(e){"Enter"==e.key&&this.props.onSearch&&this.props.onSearch(this.state.searchValue)},clearSearchBox:function(){this.setState({searchValue:""}),this.props.onSearch&&this.props.onSearch("")},render:function(){var e=this.state.searchValue?"fa fa-times":"fa fa-times hidden",t=this.state.searchValue?"fa fa-search hidden":"fa fa-search",a="Search for something ...";return void 0!==this.props.placeholder&&(a=this.props.placeholder),o().createElement("div",{role:"search",className:"navbar-form-custom"},o().createElement("div",{className:"input-group search-wrapper",style:{width:"100%",height:"33px"}},o().createElement("span",{className:"search-icon"},o().createElement("i",{className:t}),o().createElement("i",{className:e,onClick:this.clearSearchBox})),o().createElement("input",{type:"text",placeholder:a,className:"portal-form-control search",name:"top-search",id:"top-search",onChange:this.onChange,onKeyDown:this.onKeyDown,onKeyPress:this.onKeyPress,value:this.state.searchValue,autoComplete:"off"})))}});var un=a(9769);const hn=o().createClass({displayName:"OutputManager",mixins:[D()],getInitialState:function(){return this.currentOutputRequest=null,this.accountDevicesSubscribe=null,{outputData:[],outputLoadInProgress:!1,searchValue:"",sortList:"Status",confirmDeleteOutput:!1,outputToDelete:null,selectedOutput:null,confirmDetachOutput:!1,outputToDetach:null}},componentDidMount:function(){this.setState({outputLoadInProgress:!0}),this.loadOutputs()},componentWillUnmount:function(){},loadOutputs:function(){this.currentOutputRequest&&this.currentOutputRequest.abort();var e=null;this.currentOutputRequest=S().get("apiv1/devices?type=2").set("Content-Type","application/json").end(function(t,a){if(a.headers.location)window.location=a.headers.location;else{if(this.currentOutputRequest=null,e=[],t)console.log("error while reading output: "+t),this.setState({outputLoadInProgress:!1});else for(var i=0,n=a.body.length;i0&&this.state.outputData.map(function(a,i){var n=a.name||"";""!=t&&-1==n.toUpperCase().indexOf(t)||e.push(a)}.bind(this)),this.sortList(e),e},onListElementSelected:function(e,t){},onDelete:function(e){e&&e.id&&this.setState({outputToDelete:e,confirmDeleteOutput:!0})},onDeleteExeute:function(){var e=this.state.outputToDelete,t=this.state.outputData;this.setState({outputData:[],outputLoadInProgress:!0,confirmDeleteOutput:!1,outputToDelete:null}),S().delete("/apiv1/devices/"+e.id).set("Content-Type","application/json").end(function(e,a){a.headers.location?window.location=a.headers.location:e?(console.log("error while deleting output: "+e),this.setState({outputData:t})):this.loadOutputs(null)}.bind(this))},onDetachApp:function(e){e&&e.id&&this.setState({outputToDetach:e,confirmDetachOutput:!0})},onDetachAppExecute:function(){var e=this.state.outputToDetach;this.setState({outputLoadInProgress:!0}),S().delete(un.appendAccessTokenUrl("/apiv1/devices/"+e.id+"/appinstance")).set("Content-Type","application/json").end(function(e,t){t.headers.location?window.location=t.headers.location:e?(console.log("error while detaching app: "+e),this.setState({outputLoadInProgress:!1})):this.loadOutputs(null)}.bind(this))},onShowOutputUrlDialog:function(e,t){this.setState({selectedOutput:e},this.refs.WebOutputUrlModal.open(t))},onShowOutputStatusDialog:function(e){this.setState({selectedOutput:e},this.refs.WebOutputStatusModal.open)},render:function(){var e,t,a,i=this;if(1==this.state.outputLoadInProgress)e=o().createElement("tr",{key:"busy",style:{backgroundColor:"transparent"}},o().createElement("td",{colSpan:"9"},o().createElement("img",{style:{height:"40px",display:"block",margin:"20px auto"},src:"/images/loading-bubbles-blue.svg",className:"loader"})));else if(this.state.outputData&&0!==this.state.outputData.length){var n=window.singularUser.account.subscription.weboutput_limit;e=this.getFilteredAndSortedList().map(function(e,t){var a=!1;return n<=0&&(a=!0),n--,o().createElement(sn,{key:e.id,style:{cursor:"pointer"},output:e,usageWarning:a,onSelect:this.onListElementSelected,onDelete:this.onDelete,onDetachApp:this.onDetachApp,onShowOutputUrlDialog:this.onShowOutputUrlDialog,onShowOutputStatusDialog:this.onShowOutputStatusDialog})}.bind(this))}else e=o().createElement("tr",{key:"message",style:{backgroundColor:"white"}},o().createElement("td",{colSpan:"8"},o().createElement("div",{className:"no-info-message"},"There are no outputs defined")));this.state.confirmDeleteOutput&&(t="Are you sure you want to delete output "+this.state.outputToDelete.name+"?"),this.state.confirmDetachOutput&&(a="Are you sure you want to detach the control app from output "+this.state.outputToDetach.name+"?");var s,l,r,c="",d="";if(this.state.selectedOutput){var p=this.state.selectedOutput;s=p.id,l=p.appinstance_id,c=window.singularUrlBase+"devices/"+p.encoded_id,d=p.encoded_id,r="Output URL - "+p.name}return o().createElement("div",{id:"singular-browser",className:"portal"},o().createElement(ti(),{ref:"notificationSystem",style:!1}),o().createElement("div",{id:"outputManager-wrapper"},o().createElement(Ji,null),o().createElement("section",{className:"nav-bar"},o().createElement("div",{className:"left-area"},"Output Manager"),o().createElement("div",{className:"right-area"})),o().createElement("section",{className:"secondary nav-bar"},o().createElement("div",{className:"left-area"},o().createElement("button",{className:"btn btn-white",onClick:this.showCreateOutputDialog,style:{width:"150px"}},"New")),o().createElement("div",{className:"right-area"},o().createElement(mn,{mode:"immediate",onSearch:this.onSearchChange}),o().createElement("div",{className:"dropdown-group dropdown-white"},o().createElement("button",{className:"btn btn-white","data-toggle":"dropdown"},o().createElement("i",{className:"fa fa-sort-amount-desc",style:{left:"10px",float:"left"}}),o().createElement("span",{style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",width:"145px"}},this.state.sortList),o().createElement("i",{className:"fa fa-caret-down",style:{right:"10px",left:"auto"}})),o().createElement("ul",{className:"dropdown-menu dropdown-menu-right",style:{overflow:"hidden",right:"0px",top:"34px"}},o().createElement("li",null,o().createElement("a",{href:"javascript:",onClick:this.onSortList.bind(this,"Name")},"Name")),o().createElement("li",null,o().createElement("a",{href:"javascript:",onClick:this.onSortList.bind(this,"Status")},"Status")))))),o().createElement("section",{className:"portal-content"},o().createElement("div",{style:{height:"calc(100% - 70px)",position:"relative",overflowY:"scroll",width:"60%",margin:"auto",top:"5px"}},o().createElement("table",{className:"portal-table",style:{userSelect:"none",fontSize:"14px"}},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",{style:{width:"5%",textAlign:"center"}}),o().createElement("th",{style:{width:"10%",textAlign:"center"},className:"Status"==this.state.sortList?"col-status sortable sorted":"col-status sortable",onClick:this.onSortList.bind(this,"Status")},"Status"),o().createElement("th",{style:{width:"40%"},className:"Name"==this.state.sortList?"sortable sorted":"sortable",onClick:this.onSortList.bind(this,"Name")},"Name"),o().createElement("th",{style:{width:"40%"}},"App Name"),o().createElement("th",{style:{width:"5%",textAlign:"center"}}))),o().createElement("tbody",null,e)))),o().createElement("div",{id:"CreateOutputModal",className:"modal fade u-displaynone singular-modal singular-modal-white ",tabIndex:"-1",role:"dialog"},o().createElement(ln,{onCreate:this.createOutput,ref:"CreateOutputModal"})),o().createElement(cn,{deviceID:s,appID:l,onDetachApp:this.onDetachApp,onNotification:this.onNotification,ref:"WebOutputStatusModal"}),o().createElement("div",{className:"app-header-tools"},o().createElement(dn.A,{url:c,token:d,onNotification:this.onNotification,header:r,ref:"WebOutputUrlModal"})),o().createElement(Qa(),{show:1==this.state.confirmDeleteOutput,title:"",text:t,showCancelButton:!0,onConfirm:function(){i.setState({confirmDeleteOutput:!1}),i.onDeleteExeute()},onCancel:function(){i.setState({confirmDeleteOutput:!1})},onEscapeKey:function(){i.setState({confirmDeleteOutput:!1})},onOutsideClick:function(){i.setState({confirmDeleteOutput:!1})}}),o().createElement(Qa(),{show:1==this.state.confirmDetachOutput,title:"",text:a,showCancelButton:!0,onConfirm:function(){i.setState({confirmDetachOutput:!1}),i.onDetachAppExecute()},onCancel:function(){i.setState({confirmDetachOutput:!1})},onEscapeKey:function(){i.setState({confirmDetachOutput:!1})},onOutsideClick:function(){i.setState({confirmDetachOutput:!1})}})))}});var fn=a(7299),gn=a(9769);const vn=o().createClass({displayName:"OutputListItem",mixins:[D()],getInitialState:function(){return this.currentRenameRequest=null,{user:null,compID:null,appName:null,fetchingData:!1,renameActive:!1,renameBusy:!1}},componentWillMount:function(){},componentDidMount:function(){},componentWillUpdate:function(e,t){},componentWillUnmount:function(){},onSelect:function(){this.props.onSelect&&this.props.onSelect(this.props.dataStream)},onOpenDataStreamStatus:function(){this.props.onShowDataStreamStatusDialog&&this.props.onShowDataStreamStatusDialog(this.props.dataStream)},onDelete:function(){this.props.onDelete&&this.props.onDelete(this.props.dataStream)},onRename:function(){this.setState({renameActive:!0})},onRenameExecute:function(e){var t=e.name;this.currentRenameRequest&&this.currentRenameRequest.abort(),this.setState({renameBusy:!0}),this.currentRenameRequest=S().put("/apiv1/datastreams/"+this.props.dataStream.id).set("Content-Type","application/json").send({name:t}).end(function(e,a){a.headers.location?window.location=a.headers.location:(this.currentRenameRequest=null,e?this.onNotification("Cannot rename data stream","error",5,"tc"):this.props.dataStream.name=t,this.setState({renameBusy:!1}))}.bind(this))},onFinishRename:function(){this.setState({renameActive:!1})},onDoubleClick:function(){this.onOpenDataStreamStatus()},onCopyClipboard:function(e){this.props.onNotification&&this.props.onNotification(e+" copied to clipboard","success",5,"tc")},render:function(){var e=this.props.dataStream;if(!e)return null;var t,a,i=o().createElement("td",{style:{textAlign:"center"}},o().createElement("div",{className:"btn-group dropdown-white",role:"group"},o().createElement("i",{className:"fa fa-ellipsis-v","data-toggle":"dropdown",style:{padding:"20px 7px"}}),o().createElement("ul",{className:"dropdown-menu dropdown-menu-right",style:{width:"200px"}},o().createElement("li",null,o().createElement("a",{href:"javascript:",onClick:this.onOpenDataStreamStatus},"Status"),o().createElement("a",{href:"javascript:",onClick:this.onRename},"Rename"),o().createElement("a",{href:"javascript:",onClick:this.onDelete},"Delete")))));t=this.state.renameBusy?o().createElement("td",{onClick:this.onSelect,onDoubleClick:this.onDoubleClick},o().createElement("img",{style:{height:"40px",width:"40px"},src:"/images/loading-bubbles-blue.svg",className:"loader"})):o().createElement("td",{onClick:this.onSelect,onDoubleClick:this.onDoubleClick},o().createElement(P.A,{text:e.name,paramName:"name",className:"",activeClassName:"dataStream-item-edit",editing:this.state.renameActive,change:this.onRenameExecute,cancelEditing:this.onFinishRename,finishEditing:this.onFinishRename,preventDoubleClickEditing:!1})),this.props.usageWarning&&(a=o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"admin"},"You are over your data stream limit.")},o().createElement("i",{className:"fa fa-warning",style:{color:"#f7531b",fontSize:"15px",top:"1px",position:"relative",left:"4px"}})),this.props.style.backgroundColor="#feece7");var n={width:"220px",height:"auto",fontSize:"14px",border:"solid 1px #dadada",boxShadow:"none",color:"#808394",borderRadius:"4px",margin:"0px",userSelect:"all",background:"#fff",display:"inline-block"},s=o().createElement("td",{onClick:this.onSelect},o().createElement("div",{style:{display:"flex",alignItems:"center"}},o().createElement("input",{type:"text",className:"form-control v2",style:n,placeholder:"No Token generated",value:e.private_token,disabled:!0}),o().createElement(fn.A,{text:"https://datastream.singular.live/datastreams/"+e.private_token,options:{format:"text/plain"},onCopy:this.onCopyClipboard.bind(this,"Private Token")},o().createElement("button",{className:"tool-button",style:{fontSize:"12px",lineHeight:"35px",height:"35px",marginLeft:"2px",marginRight:"5px"}},o().createElement("i",{className:"fa fa-clipboard"}))))),l=o().createElement("td",{onClick:this.onSelect},o().createElement("div",{style:{display:"flex",alignItems:"center"}},o().createElement("input",{type:"text",className:"form-control v2",style:n,placeholder:"No Token generated",value:e.public_token,disabled:!0}),o().createElement(fn.A,{text:e.public_token,options:{format:"text/plain"},onCopy:this.onCopyClipboard.bind(this,"Public Token")},o().createElement("button",{className:"tool-button",style:{fontSize:"12px",lineHeight:"35px",height:"35px",marginLeft:"2px",marginRight:"5px"}},o().createElement("i",{className:"fa fa-clipboard"}))))),r=o().createElement("td",{style:{textAlign:"center"}},gn.numberWithCommas(this.props.numberOfConnections));return o().createElement("tr",{style:this.props.style},o().createElement("td",{onClick:this.onSelect,onDoubleClick:this.onDoubleClick,className:"col-status"},a),o().createElement("td",{onClick:this.onSelect,onDoubleClick:this.onDoubleClick,className:"col-status"},e.id),t,s,l,r,i)}});var bn=a(9769);const yn=o().createClass({displayName:"CreateDataStreamEditor",getInitialState:function(){return{name:"New Data Stream",createBusy:!1}},shouldComponentUpdate:function(e,t){return!bn.compareObject(e,this.props)||!bn.compareObject(t,this.state)},focusFirstInput:function(){this.refs.firstInput&&setTimeout(function(){this.refs.firstInput.focus(),this.refs.firstInput.select()}.bind(this),500)},onChangeName:function(e){this.setState({name:e.target.value})},onCreate:function(){this.setState({createBusy:!0}),S().post("/apiv1/datastreams").send({name:this.state.name}).end(function(e,t){if(e)this.onNotification("Cannot create data stream","error",5,"tc");else{if(t.headers.location)return void(window.location=t.headers.location);this.props.onCreate&&this.props.onCreate(t.body)}this.setState({createBusy:!1,name:""})}.bind(this))},onCancel:function(){this.props.onCancel&&this.props.onCancel()},onKeyDown:function(e){"Enter"==e.key&&(e.preventDefault(),e.stopPropagation(),e.target.value.trim().length>0&&this.onCreate())},render:function(){var e,t;if(this.state.createBusy)e=o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader",style:{height:"47px",margin:"18px"}});else{var a=!0;this.state.name.trim().length>0&&(a=!1),e=o().createElement("button",{className:"btn btn-primary",onClick:this.onCreate,disabled:a},"Create"),t=o().createElement("button",{className:"btn btn-secondary",onClick:this.onCancel,"data-dismiss":"modal","aria-label":"Close"},"Cancel")}return o().createElement("div",{className:"modal-dialog modal-lg",role:"document"},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-header"},o().createElement("button",{tabIndex:"-1",className:"close","data-dismiss":"modal","aria-label":"Close",onClick:this.onCancel},o().createElement("span",{"aria-hidden":"true"},o().createElement("i",{style:{width:"20px",height:"20px",position:"relative"},className:"fa fa-times"}))),o().createElement("h4",{className:"modal-title",id:"myModalLabel"},"Create Data Stream")),o().createElement("div",{className:"modal-body",style:{borderRadius:"0px"}},o().createElement("div",{className:"device-config"},o().createElement("label",{className:"third"},"Name"),o().createElement("input",{className:"form-control align-left select-input",style:{width:"100%"},value:this.state.name,onChange:this.onChangeName,onKeyDown:this.onKeyDown,ref:"firstInput"}))),o().createElement("div",{className:"modal-footer",style:{borderRadius:"0px 0px 5px 5px"}},e,t)))}});var En=a(78450),wn=a.n(En),Sn=a(95093),Nn=a(9769),Cn=a(62418);const xn=o().createClass({displayName:"DataStreamStatusDialog",getInitialState:function(){return this.generateRequest=null,this.dataStreamID=null,this.updateIntervalHandler=null,{generateBusy:!1,dataStreamStatus:null,dataStreamPayload:null}},componentWillMount:function(){},componentDidMount:function(){var e=this;this.refs.DataStreamDialog&&$(this.refs.DataStreamDialog).on("hide.bs.modal",(function(){e.close("modal")}))},shouldComponentUpdate:function(e,t){return!Nn.compareObject(e,this.props)||!Nn.compareObject(t,this.state)},componentWillReceiveProps:function(e){},componentWillUnmount:function(){this.releaseAllHandlers()},releaseAllHandlers:function(){this.updateIntervalHandler&&(clearInterval(this.updateIntervalHandler),this.updateIntervalHandler=null),this.generateRequest&&(this.generateRequest.abort(),this.generateRequest=null),this.disconnectFromDataStream(),this.setState({dataStreamStatus:null,dataStreamPayload:null})},onDataStreamReceive:function(e,t){"message"==e&&this.setState({dataStreamPayload:t}),this.setState({dataStreamStatus:e})},connectToDataStream:function(e){this.setState({dataStreamStatus:null,dataStreamPayload:null}),e?this.dataStreamID!=e.id&&(this.dataStreamConnection=Nn.createDataStream(e.public_token,this.onDataStreamReceive,null),this.dataStreamID=e.id):this.disconnectFromDataStream()},disconnectFromDataStream:function(){this.dataStreamConnection&&(this.dataStreamConnection.close(),this.dataStreamConnection=null,this.dataStreamID=null)},open:function(){var e=this;this.setState({dataStreamStatus:null,dataStreamPayload:null}),this.connectToDataStream(this.props.dataStream),this.updateIntervalHandler&&clearInterval(this.updateIntervalHandler),this.updateIntervalHandler=setInterval((function(){e.setState({random:Math.random()})}),1e3),this.refs.DataStreamDialog&&$(this.refs.DataStreamDialog).modal("show")},close:function(e){this.releaseAllHandlers(),this.disconnectFromDataStream(),this.refs.DataStreamDialog&&!e&&$(this.refs.DataStreamDialog).modal("hide")},generatePrivateToken:function(){this.generateToken("privatetoken")},generatePublicToken:function(){this.generateToken("publictoken")},generateToken:function(e){var t=this.props.dataStream.id;t&&(this.generateRequest&&this.generateRequest.abort(),this.setState({generateBusy:!0}),this.generateRequest=S().post("/apiv1/datastreams/"+t+"/"+e).end(function(e,t){if(e)this.onNotification("Cannot generate token for data stream","error",5,"tc");else if(t.headers.location)return void(window.location=t.headers.location);this.generateRequest=null,this.props.onReload(),this.setState({generateBusy:!1})}.bind(this)))},onCopyClipboard:function(e){this.props.onNotification&&this.props.onNotification(e+" copied to clipboard","success",5,"tc")},render:function(){var e=this.props.dataStream,t="Data Stream Status";e&&e.name&&(t="Data Stream Status - "+e.name);var a,i,n="Data has never been sent",s=JSON.stringify({});e&&e.payload&&(s=e.payload),this.state.dataStreamPayload&&(s=JSON.stringify(this.state.dataStreamPayload));try{var l=JSON.parse(s);if(l.payload&&(s=Cn.js(JSON.stringify(l.payload),{indent_size:2,indent_char:" ",max_preserve_newlines:"5",preserve_newlines:!0,keep_array_indentation:!1,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1})),"message"!==this.state.dataStreamStatus)n="";else if(l.ts){var r=Sn(l.ts);n=r.format("YYYY-MM-DD HH:mm:ss")+" "+Nn.millisecondsToString(-r.diff(Sn()+wn().ServerDate.getOffset()),"short")+" ago"}}catch(e){}switch(this.state.dataStreamStatus){case"connecting":a=o().createElement("div",null,o().createElement("i",{className:"fa gateway-status fa-circle pending",style:{padding:"5px"}}),"Connecting");break;case"open":case"message":a=o().createElement("div",null,o().createElement("i",{className:"fa gateway-status fa-circle active",style:{padding:"5px"}}),"Connected");break;case"error":a=o().createElement("div",null,o().createElement("i",{className:"fa gateway-status fa-exclamation-circle error",style:{padding:"5px"}}),"Cannot connect to data stream");break;default:a=o().createElement("div",null,o().createElement("i",{className:"fa gateway-status fa-circle inactive",style:{padding:"5px"}}),"Not connected")}i=1==this.props.numberOfConnections?"1 connection active":Nn.numberWithCommas(this.props.numberOfConnections)+" connections active";var c,d,p=o().createElement("div",{style:{display:"flex",flexDirection:"row",top:"3px",position:"relative",alignItems:"center",color:"rgb(154, 154, 154)"}},o().createElement("input",{type:"text",className:"form-control v2",style:{width:"300px",position:"relative",top:"3px"},value:n,disabled:!0}),a,o().createElement("div",{style:{flexGrow:"1",textAlign:"right"}},i));return c=!e||this.props.busy||this.state.generateBusy?o().createElement("img",{style:{height:"44px",width:"300px"},src:"/images/loading-bubbles-blue.svg",className:"loader"}):o().createElement("div",{style:{top:"3px",position:"relative"}},o().createElement("input",{type:"text",className:"form-control v2",style:{width:"300px",display:"inline-block"},placeholder:"No Token generated",value:e.private_token,disabled:!0}),o().createElement("div",{className:"input-group-btn",style:{fontSize:"12px",display:"inline-block"}},o().createElement(fn.A,{text:e.private_token,options:{format:"text/plain"},onCopy:this.onCopyClipboard.bind(this,"Private Token")},o().createElement("button",{className:"tool-button"},o().createElement("i",{className:"fa fa-clipboard"}))),o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"regenerate"},"Generate token")},o().createElement("button",{tabIndex:"-1",onClick:this.generatePrivateToken,className:"tool-button"},o().createElement("i",{className:"fa fa-refresh fa-lg"}))))),d=!e||this.props.busy||this.state.generateBusy?o().createElement("img",{style:{height:"44px",width:"300px"},src:"/images/loading-bubbles-blue.svg",className:"loader"}):o().createElement("div",{style:{top:"3px",position:"relative"}},o().createElement("input",{type:"text",className:"form-control v2",style:{width:"300px",display:"inline-block"},placeholder:"No Token generated",value:e.public_token,disabled:!0}),o().createElement("div",{className:"input-group-btn",style:{fontSize:"12px",display:"inline-block"}},o().createElement(fn.A,{text:e.public_token,options:{format:"text/plain"},onCopy:this.onCopyClipboard.bind(this,"Public Token")},o().createElement("button",{className:"tool-button"},o().createElement("i",{className:"fa fa-clipboard"}))),o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"regenerate"},"Generate token")},o().createElement("button",{tabIndex:"-1",onClick:this.generatePublicToken,className:"tool-button"},o().createElement("i",{className:"fa fa-refresh fa-lg"}))))),o().createElement("div",{id:"dataStreamStatus",className:"modal fade u-displaynone singular-modal singular-modal-white",tabIndex:"-1",role:"dialog",ref:"DataStreamDialog"},o().createElement("div",{className:"modal-dialog modal-lg",role:"document",style:{maxWidth:"90%",width:"1300px"}},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-header"},o().createElement("button",{tabIndex:"-1",type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},o().createElement("span",{"aria-hidden":"true"},o().createElement("i",{style:{width:"20px",height:"20px",position:"relative"},className:"fa fa-times"}))),o().createElement("h4",{className:"modal-title",id:"myModalLabel"},t)),o().createElement("div",{className:"modal-body"},o().createElement("div",null,o().createElement("table",{style:{width:"100%"}},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",{style:{width:"15%"}}),o().createElement("th",{style:{width:"85%"}}))),o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,"Private Token"),o().createElement("td",null,c)),o().createElement("tr",null,o().createElement("td",null),o().createElement("td",null,o().createElement("div",{style:{fontSize:"12px",color:"rgb(154, 154, 154)",position:"relative",top:"-3px",marginBottom:"5px"}},"Use the private token to send data to the stream. For more information about the REST API click"," ",o().createElement("a",{target:"_blank",href:"https://api.singular.live/#59563b90-8f36-453e-9f14-ee71d05813ff"},"here")))),o().createElement("tr",null,o().createElement("td",null,"Public Token"),o().createElement("td",null,d)),o().createElement("tr",null,o().createElement("td",null),o().createElement("td",null,o().createElement("div",{style:{fontSize:"12px",color:"rgb(154, 154, 154)",position:"relative",top:"-3px",marginBottom:"5px"}},"Use the public token to receive the data in the composition script. For more information click"," ",o().createElement("a",{target:"_blank",href:"https://support.singular.live/hc/en-us/articles/360058676471-Data-Streams"},"here")))),o().createElement("tr",{style:{height:"50px"}},o().createElement("td",null,o().createElement("div",{style:{position:"relative",top:"3px"}},"Last update")),o().createElement("td",null,p)),o().createElement("tr",null,o().createElement("td",{style:{verticalAlign:"top"}},"Current Payload"),o().createElement("td",null,o().createElement("div",{style:{height:"500px",width:"100%"}},o().createElement(ea.A,{name:"dataStreamJson",id:"DataStream",className:"widget-version-json",width:"100%",height:"100%",value:s,disabled:!0,theme:"light"})))))))))))}}),In=o().createClass({displayName:"DataStreamManager",mixins:[D()],getInitialState:function(){return this.currentDataStreamRequest=null,this.currentDataStreamConnectionRequest=null,this.dataStreamConnectionInterval=null,{dataStreamData:[],dataStreamLoadInProgress:!1,dataStreamConnections:[],searchValue:"",sortList:"ID",confirmDeleteDataStream:!1,dataStreamToDelete:null,selectedDataStream:null}},componentDidMount:function(){var e=this;this.loadDataStreams(),this.dataStreamConnectionInterval=setInterval((function(){e.fetchDataStreamConnections()}),5e3),this.fetchDataStreamConnections()},componentWillUnmount:function(){this.currentDataStreamRequest&&this.currentDataStreamRequest.abort(),this.currentDataStreamConnectionRequest&&this.currentDataStreamConnectionRequest.abort()},fetchDataStreamConnections:function(){this.currentDataStreamConnectionRequest&&this.currentDataStreamConnectionRequest.abort(),this.currentDataStreamConnectionRequest=S().get("apiv1/datastreams/clients").set("Content-Type","application/json").end(function(e,t){if(t.headers.location)window.location=t.headers.location;else{this.currentDataStreamConnectionRequest=null;var a=[];e?(this.onNotification("Cannot read data stream connections","error",5,"tc"),this.setState({dataStreamLoadInProgress:!1})):a=t.body,this.setState({dataStreamConnections:a})}}.bind(this))},loadDataStreams:function(){this.setState({dataStreamLoadInProgress:!0}),this.currentDataStreamRequest&&this.currentDataStreamRequest.abort(),this.currentDataStreamRequest=S().get("apiv1/datastreams").set("Content-Type","application/json").end(function(e,t){if(t.headers.location)window.location=t.headers.location;else{this.currentDataStreamRequest=null;var a=[];e?(this.onNotification("Cannot read data streams","error",5,"tc"),this.setState({dataStreamLoadInProgress:!1})):a=t.body;var i=this.state.selectedDataStream;i&&(i=a.find((function(e){if(i.id==e.id)return e}))),this.setState({dataStreamData:a,selectedDataStream:i,dataStreamLoadInProgress:!1})}}.bind(this))},onSearchChange:function(e){this.setState({searchValue:e})},onNotification:function(e,t,a,i){this.refs.notificationSystem.addNotification({message:e,level:t,autoDismiss:a,position:i})},showCreateDataStreamDialog:function(){$("#CreateDataStreamModal").modal("show"),this.refs.CreateDataStreamModal.focusFirstInput()},createDataStream:function(){this.setState({dataStreamLoadInProgress:!0}),this.loadDataStreams(),$("#CreateDataStreamModal").modal("hide")},onSortList:function(e){this.setState({sortList:e})},sortList:function(e){var t=function(e,t){var a=e.id,i=t.id;return null==a?-1:null==i?1:a==i?0:an?-1:1}.bind(this);e.sort(function(e,n){switch(this.state.sortList){case"Name":default:return a(e,n);case"ID":return t(e,n);case"Connected":return i(e,n)}}.bind(this))},getFilteredAndSortedList:function(){var e=[],t=this.state.searchValue;return t=t?t.toUpperCase():"",this.state.dataStreamData&&this.state.dataStreamData.length>0&&this.state.dataStreamData.map(function(a){if(""!=t){var i=a.name||"",n=a.private_token||"",s=a.public_token||"";if(a.id!=t&&-1==i.toUpperCase().indexOf(t)&&-1==n.toUpperCase().indexOf(t)&&-1==s.toUpperCase().indexOf(t))return}e.push(a)}.bind(this)),this.sortList(e),e},onDelete:function(e){e&&e.id&&this.setState({dataStreamToDelete:e,confirmDeleteDataStream:!0})},onDeleteExecute:function(){var e=this.state.dataStreamToDelete;this.setState({dataStreamLoadInProgress:!0,confirmDeleteDataStream:!1,dataStreamToDelete:null}),S().delete("/apiv1/datastreams/"+e.id).set("Content-Type","application/json").end(function(e,t){t.headers.location?window.location=t.headers.location:(e&&this.onNotification("Cannot delete data stream","error",5,"tc"),this.loadDataStreams())}.bind(this))},onShowDataStreamStatusDialog:function(e){this.setState({selectedDataStream:e},this.refs.DataStreamStatusModal.open)},getNumberOfConnections:function(e){var t=0;return e&&this.state.dataStreamConnections&&void 0!==this.state.dataStreamConnections[e.public_token]&&(t=this.state.dataStreamConnections[e.public_token]),t},render:function(){var e,t,a=this;if(1==this.state.dataStreamLoadInProgress)e=o().createElement("tr",{key:"busy",style:{backgroundColor:"transparent"}},o().createElement("td",{colSpan:"9"},o().createElement("img",{style:{height:"40px",display:"block",margin:"20px auto"},src:"/images/loading-bubbles-blue.svg",className:"loader"})));else if(this.state.dataStreamData&&0!==this.state.dataStreamData.length){var i=999999999;e=this.getFilteredAndSortedList().map(function(e,t){var a=!1;return i<=0&&(a=!0),i--,o().createElement(vn,{key:e.id,style:{cursor:"pointer"},dataStream:e,numberOfConnections:this.getNumberOfConnections(e),usageWarning:a,onDelete:this.onDelete,onShowDataStreamStatusDialog:this.onShowDataStreamStatusDialog,onNotification:this.onNotification})}.bind(this))}else e=o().createElement("tr",{key:"message",style:{backgroundColor:"white"}},o().createElement("td",{colSpan:"8"},o().createElement("div",{className:"no-info-message"},"There are no data streams defined")));return this.state.confirmDeleteDataStream&&(t="Are you sure you want to delete data stream "+this.state.dataStreamToDelete.name+"?"),o().createElement("div",{id:"singular-browser",className:"portal"},o().createElement(ti(),{ref:"notificationSystem",style:!1}),o().createElement("div",{id:"dataStreamManager-wrapper"},o().createElement(Ji,null),o().createElement("section",{className:"nav-bar"},o().createElement("div",{className:"left-area"},"Data Streams"),o().createElement("div",{className:"right-area"})),o().createElement("section",{className:"secondary nav-bar"},o().createElement("div",{className:"left-area"},o().createElement("button",{className:"btn btn-white",onClick:this.showCreateDataStreamDialog,style:{width:"150px"}},"New")),o().createElement("div",{className:"right-area"},o().createElement(mn,{mode:"immediate",onSearch:this.onSearchChange}),o().createElement("div",{className:"dropdown-group dropdown-white"},o().createElement("button",{className:"btn btn-white","data-toggle":"dropdown"},o().createElement("i",{className:"fa fa-sort-amount-desc",style:{left:"10px",float:"left"}}),o().createElement("span",{style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",width:"145px"}},this.state.sortList),o().createElement("i",{className:"fa fa-caret-down",style:{right:"10px",left:"auto"}})),o().createElement("ul",{className:"dropdown-menu dropdown-menu-right",style:{overflow:"hidden"}},o().createElement("li",null,o().createElement("a",{href:"javascript:",onClick:this.onSortList.bind(this,"ID")},"ID")),o().createElement("li",null,o().createElement("a",{href:"javascript:",onClick:this.onSortList.bind(this,"Name")},"Name")),o().createElement("li",null,o().createElement("a",{href:"javascript:",onClick:this.onSortList.bind(this,"Connected")},"Connected")))))),o().createElement("section",{className:"portal-content"},o().createElement("div",{style:{height:"calc(100% - 70px)",position:"relative",overflowY:"scroll",maxWidth:"90%",margin:"auto",top:"5px",width:"1500px"}},o().createElement("table",{className:"portal-table",style:{userSelect:"none",fontSize:"14px"}},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",{style:{width:"5%",textAlign:"center"}}),o().createElement("th",{style:{width:"5%",textAlign:"center"},className:"ID"==this.state.sortList?"col-status sortable sorted":"col-status sortable",onClick:this.onSortList.bind(this,"ID")},"ID"),o().createElement("th",{style:{width:"25%"},className:"Name"==this.state.sortList?"sortable sorted":"sortable",onClick:this.onSortList.bind(this,"Name")},"Name"),o().createElement("th",{style:{width:"25%"}},"Private Token"),o().createElement("th",{style:{width:"25%"}},"Public Token"),o().createElement("th",{style:{width:"10%",textAlign:"center"},className:"Connected"==this.state.sortList?"col-status sortable sorted":"col-status sortable",onClick:this.onSortList.bind(this,"Connected")},"# connected"),o().createElement("th",{style:{width:"5%",textAlign:"center"}}))),o().createElement("tbody",null,e)))),o().createElement("div",{id:"CreateDataStreamModal",className:"modal fade u-displaynone singular-modal singular-modal-white ",tabIndex:"-1",role:"dialog"},o().createElement(yn,{onCreate:this.createDataStream,onNotification:this.onNotification,ref:"CreateDataStreamModal"})),o().createElement(xn,{dataStream:this.state.selectedDataStream,numberOfConnections:this.getNumberOfConnections(this.state.selectedDataStream),onNotification:this.onNotification,onReload:this.loadDataStreams,busy:this.state.dataStreamLoadInProgress,ref:"DataStreamStatusModal"}),o().createElement(Qa(),{show:1==this.state.confirmDeleteDataStream,title:"",text:t,showCancelButton:!0,onConfirm:function(){a.setState({confirmDeleteDataStream:!1}),a.onDeleteExecute()},onCancel:function(){a.setState({confirmDeleteDataStream:!1})},onEscapeKey:function(){a.setState({confirmDeleteDataStream:!1})},onOutsideClick:function(){a.setState({confirmDeleteDataStream:!1})}})))}}),kn=o().createClass({displayName:"WidgetVersion",getInitialState:function(){return{widgetJson:"{}",left:0,top:0,width:50,height:50,supportCustomAnimation:!1,supportInteractivity:!1,helpEnabled:!1,helpUrl:"",saveActive:!1}},componentWillMount:function(){this.setState({widgetJson:this.props.version.widgetJson,left:this.props.version.left,top:this.props.version.top,width:this.props.version.width,height:this.props.version.height,supportCustomAnimation:this.props.version.supportCustomAnimation,supportInteractivity:this.props.version.supportInteractivity,helpEnabled:this.props.version.helpEnabled,helpUrl:this.props.version.helpUrl})},componentWillReceiveProps:function(e){},saveVersion:function(){if(this.state.widgetJson!=this.props.version.widgetJson||this.state.left!=this.props.version.left||this.state.top!=this.props.version.top||this.state.width!=this.props.version.width||this.state.height!=this.props.version.height||this.state.supportCustomAnimation!=this.props.version.supportCustomAnimation||this.state.supportInteractivity!=this.props.version.supportInteractivity||this.state.helpEnabled!=this.props.version.helpEnabled||this.state.helpUrl!=this.props.version.helpUrl){var e={widgetJson:this.state.widgetJson,left:this.state.left,top:this.state.top,width:this.state.width,height:this.state.height,supportCustomAnimation:this.state.supportCustomAnimation,supportInteractivity:this.state.supportInteractivity,helpEnabled:this.state.helpEnabled,helpUrl:this.state.helpUrl};this.setState({saveActive:!0}),S().put("/widgets/"+this.props.version.widget_id+"/versions/"+this.props.version.version+"/metadata").send(e).end(function(e,t){if(this.setState({saveActive:!1}),e)N.A.add(N.A.TYPE.ERROR,{title:"Save Widget ID "+this.props.version.widget_id,description:e});else{if(t.headers.location)return void(window.location=t.headers.location);this.props.rebuildParentCallback&&this.props.rebuildParentCallback()}}.bind(this))}},ValueChanged:function(e,t){var a={};a[e]=t,this.setState(a)},handler:function(e){this.setState({widgetJson:e})},render:function(){var e,t=!0;if("development"==this.props.version.status&&(t=!1),1==this.state.saveActive)e=o().createElement("div",{className:"panel-body"},o().createElement("div",{className:"row browser-tree component-tree font-tree",style:{width:"100%",height:"100%"}},o().createElement("img",{style:{display:"block",margin:"0 auto"},src:"/images/loading-bubbles-blue.svg",className:"loader"})));else{var a="";this.state.helpUrl&&(a=this.state.helpUrl),e=o().createElement("div",null,o().createElement("div",{className:"property-group",style:{width:"calc(100% - 20px)"}},o().createElement("div",{className:"group-title"},"UI Definition for Version #",this.props.version.version," (",this.props.version.status,")"),o().createElement("div",{className:"group-body"},o().createElement(ea.A,{name:"widgetJson",id:"WV"+this.props.version.id,className:"widget-version-json",value:this.state.widgetJson,onValueChanged:this.ValueChanged,onSave:this.saveVersion,disabled:t,theme:"light"}))),o().createElement("div",{className:"property-group",style:{width:"calc(100% - 20px)"}},o().createElement("div",{className:"group-title"},"Default Properties"),o().createElement("div",{className:"group-body"},o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{colSpan:"2",style:{verticalAlign:"middle",textAlign:"left"}},"Transformation")),o().createElement("tr",null,o().createElement("td",{style:{verticalAlign:"middle"}},"Left"),o().createElement("td",null,o().createElement(te.A,{name:"left",resetValue:"0.0",step:"1",format:"0.0",min:"0.0",max:"100.0",value:this.state.left,unit:"%",onValueChanged:this.ValueChanged,disabled:t,theme:"light"})),o().createElement("td",{style:{verticalAlign:"middle",textAlign:"left"}},"Top"),o().createElement("td",null,o().createElement(te.A,{name:"top",resetValue:"0.0",step:"1",format:"0.0",min:"0.0",max:"100.0",value:this.state.top,unit:"%",onValueChanged:this.ValueChanged,disabled:t,theme:"light"}))),o().createElement("tr",null,o().createElement("td",{style:{verticalAlign:"middle"}},"Width"),o().createElement("td",null,o().createElement(te.A,{name:"width",resetValue:"50.0",step:"1",format:"0.0",min:"0.0",max:"100.0",value:this.state.width,unit:"%",onValueChanged:this.ValueChanged,disabled:t,theme:"light"})),o().createElement("td",{style:{verticalAlign:"middle"}},"Height"),o().createElement("td",null,o().createElement(te.A,{name:"height",resetValue:"50.0",step:"1",format:"0.0",min:"0.0",max:"100.0",value:this.state.height,unit:"%",onValueChanged:this.ValueChanged,disabled:t,theme:"light"})))))),o().createElement("div",{className:"group-body"},o().createElement("table",{className:""},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{style:{verticalAlign:"middle",textAlign:"left"}},"Custom State Animation"),o().createElement("td",null,o().createElement(se.A,{name:"supportCustomAnimation",defaultValue:!1,value:this.state.supportCustomAnimation,disabled:t,onValueChanged:this.ValueChanged,theme:"light"}))),o().createElement("tr",null,o().createElement("td",{style:{verticalAlign:"middle",textAlign:"left"}},"Interactive"),o().createElement("td",null,o().createElement(se.A,{name:"supportInteractivity",defaultValue:!1,value:this.state.supportInteractivity,disabled:t,onValueChanged:this.ValueChanged,theme:"light"}))),o().createElement("tr",null,o().createElement("td",{style:{verticalAlign:"middle",textAlign:"left"}},"Help"),o().createElement("td",null,o().createElement(se.A,{name:"helpEnabled",defaultValue:!1,value:this.state.helpEnabled,disabled:t,onValueChanged:this.ValueChanged,theme:"light"}))),o().createElement("tr",null,o().createElement("td",{style:{verticalAlign:"middle"}},"URL"),o().createElement("td",null,o().createElement(lt.A,{name:"helpUrl",defaultValue:"",value:a,width:"500px",disabled:t||!this.state.helpEnabled,onValueChanged:this.ValueChanged,theme:"light"}))))))))}return o().createElement("div",null,e)}});var Dn=a(68204),An=a.n(Dn),Rn=a(9769),Pn=a(82465);const Tn=o().createClass({displayName:"WidgetInfo",getInitialState:function(){return this.widgetVersionHandler=null,this.shareAccountHandler=null,this.scShareToPreviousInputValue="",this.scShareToCurrentInputValue="",{deploykey:"",versions:[],selectedVersion:null,showBusyIcon:!1,showBusyShare:!0,shareAccounts:[],originalAccounts:[]}},componentWillMount:function(){this.getVersions(),this.props.widget.deploykey&&this.setState({deploykey:this.props.widget.deploykey})},componentDidMount:function(){this.readShareAccounts()},componentDidUpdate:function(){if(this.refs.selectedDomElement){var e=n().findDOMNode(this.refs.selectedDomElement);e&&e.scrollIntoViewIfNeeded(!0)}},componentWillUnmount:function(){this.widgetVersionHandler&&this.widgetVersionHandler.abort(),this.shareAccountHandler&&this.shareAccountHandler.abort()},getVersions:function(){this.setState({showBusyIcon:!0}),this.widgetVersionHandler=S().get("/widgets/"+this.props.widget.id+"/versions").set("Content-Type","application/json").end(function(e,t){var a=[],i=-1;if(this.state.selectedVersion&&(i=this.state.selectedVersion.version),e)N.A.add(N.A.TYPE.ERROR,{title:"Cannot get widget version info",description:e.message}),this.props.notificationSys.addNotification({message:"Cannot get widget version info",level:"error",autoDismiss:5,position:"tc"});else{if(t.headers.location)return void(window.location=t.headers.location);a=t.body}a.sort((function(e,t){return Number(t.version)-Number(e.version)}));var n=null;if(a.length>0){-1==i&&(n=a[0]);for(var s=0;s=0&&(e="Save (CMD + S)"),{sortAlphaMode:"AlphaAscending",layoutMode:"Grid",infoActive:!1,saveShortcut:e}},componentDidMount:function(){},SortAlphaClicked:function(e){this.setState({sortAlphaMode:e}),this.sortAlphaCallback&&this.sortAlphaCallback(e)},LayoutClicked:function(e){this.setState({layoutMode:e}),this.layoutCallback&&this.layoutCallback(e)},ToggleInfo:function(e){this.setState({infoActive:e}),this.infoCallback&&this.infoCallback(e)},render:function(){var e=function(e,t){if(null==e.type)return null;var a,i=!1;switch(e.disabled&&(i=!0),e.type){case"AddUser":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"AddUser"},"Add User")},o().createElement("button",{className:"btn btn-white",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-user-plus fa-lg"})));case"InviteUser":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"InviteUser"},"Invite User")},o().createElement("button",{className:"btn btn-white",style:{width:"100px"},tabIndex:"-1",onClick:e.callback,disabled:i},"Invite User"));case"AddUserSSO":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"InviteUser"},"Add single sign-on user")},o().createElement("button",{className:"btn btn-white",style:{width:"100px"},tabIndex:"-1",onClick:e.callback,disabled:i},"Add SSO User"));case"AddWidget":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"AddWidget"},"Add Widget")},o().createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-plus-circle fa-lg"})));case"AddAppTemplate":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"AddAppTemplate"},"Add App")},o().createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-plus-circle fa-lg"})));case"AddAccount":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"AddAccount"},"Add Account")},o().createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-plus-circle fa-lg"})));case"Save":switch(e.state){case"Armed":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"Save"},this.state.saveShortcut)},o().createElement("button",{className:"btn btn-white icon-only armed",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-save fa-lg"})));case"Busy":return o().createElement("button",{key:t,className:"btn btn-white icon-only",tabIndex:"-1"},o().createElement("i",{className:"fa fa-spinner fa-lg"}));default:return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"Save"},this.state.saveShortcut)},o().createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-save fa-lg"})))}case"Duplicate":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"Duplicate"},"Duplicate")},o().createElement("button",{className:"btn btn-white",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-copy fa-lg"})));case"Delete":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"Delete"},"Delete")},o().createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-trash fa-lg"})));case"SortAlpha":var n;n=null==e.mode?this.state.sortAlphaMode:e.mode,this.sortAlphaCallback=e.callback,"AlphaDescending"===n?(r="AlphaAscending",a="fa fa-sort-alpha-desc fa-lg",d="Sort alphabetically descending"):(r="AlphaDescending",a="fa fa-sort-alpha-asc fa-lg",d="Sort alphabetically ascending");var s=o().createElement(z(),{id:"Sort"},d);return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:s},o().createElement("button",{className:"btn btn-white",tabIndex:"-1",onClick:this.SortAlphaClicked.bind(this,r),disabled:i},o().createElement("i",{className:a})));case"Divider":return o().createElement("div",{key:t,className:"dash-divider",disabled:i});case"Info":var l;return a="dash-button",(l=null==e.active?this.state.infoActive:e.active)&&(a="dash-button active"),this.infoCallback=e.callback,o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"ToggleInspector"},"Toggle Inspector")},o().createElement("div",{className:a,tabIndex:"-1",onClick:this.ToggleInfo.bind(this,!l),disabled:i},o().createElement("i",{className:"fa fa-info-circle fa-lg"})));case"Layout":var r,c,d;return c=null==e.mode?this.state.layoutMode:e.lmode,this.layoutCallback=e.callback,"List"===c?(r="Grid",a="fa fa-list fa-lg",d="Grid view"):(r="List",d="List view",a="fa fa-th-large fa-lg"),s=o().createElement(z(),{id:"Layout"},d),o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:s},o().createElement("button",{className:"btn btn-white",tabIndex:"-1",onClick:this.LayoutClicked.bind(this,r),disabled:i},o().createElement("i",{className:a})));case"AddReleaseNote":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"AddReleaseNote"},"Add Release Note")},o().createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-plus-circle fa-lg"})));case"UpdateReleaseNote":var p="btn btn-white icon-only";return"Armed"===e.state&&(p+=" armed"),o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"UpdateReleaseNote"},"Update Release Note")},o().createElement("button",{className:p,tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-floppy-o fa-lg"})));case"CancelReleaseNote":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"CancelReleaseNote"},"Cancel Release Note")},o().createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-times fa-lg"})));case"DeleteReleaseNote":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"DelReleaseNote"},"Delete Release Note")},o().createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-trash-o fa-lg"})));case"AddConnection":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"AddConnection"},"Add Connection")},o().createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-plus-circle fa-lg"})));case"UpdateConnection":return p="btn btn-white","Armed"===e.state&&(p+=" armed"),o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"UpdateConnection"},"Update Connection")},o().createElement("button",{className:p,tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-floppy-o fa-lg"})));case"CancelConnection":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"CancelConnection"},"Cancel Connection")},o().createElement("button",{className:"btn btn-white",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-times fa-lg"})));case"DeleteConnection":return o().createElement(j(),{key:t,placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"DelConnection"},"Delete Connection")},o().createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:e.callback,disabled:i},o().createElement("i",{className:"fa fa-trash-o fa-lg"})));default:return o().createElement("div",{key:t})}}.bind(this);return o().createElement("div",{className:"dashboard-toolbar",style:{display:"flex",marginLeft:"auto"}},this.props.configuration.map(e))}});var On=a(9769),Ln=a(82465);const Vn=o().createClass({displayName:"WidgetEditor",_notificationSystem:null,getInitialState:function(){return{groupedWidgetList:{},widgetList:[],selectedWidget:null,widgetListFilter:"",saveIconState:"Normal",confirmDelete:!1,confirmDeleteMessage:""}},componentDidMount:function(){var e=this;this.loadData(),this._notificationSystem=this.refs.notificationSystem,It.A.createShortcut("mod+s",(function(){e.actionSave()}),this.refs.topElement)},componentDidUpdate:function(){if(this.refs.selectedDomElement){var e=n().findDOMNode(this.refs.selectedDomElement);e&&e.scrollIntoViewIfNeeded(!0)}},loadData:function(){this.setState({isLoading:!0,saveIconState:"Normal"}),S().get("/widgets/jsonpure?status=development").set("Content-Type","application/json").end(function(e,t){if(e)console.log(e);else{if(t.headers.location)return void(window.location=t.headers.location);var a=[];t.body.forEach((function(e,t){if(e.category){var i=e.category.replace(/,/g," "),n={name:e.name,id:e.id,categories:i,widget:e};a.push(n)}})),a.sort((function(e,t){return(e.name.toUpperCase()>t.name.toUpperCase())-.5})),this.setState({widgetList:a});var i=null;if(this.state.selectedWidget)for(var n=0,s=a.length;n0&&(i=a[0]),this.setState({selectedWidget:i})}this.setState({isLoading:!1})}.bind(this))},selectWidget:function(e){this.setState({selectedWidget:e,saveIconState:"Normal"})},actionAdd:function(){this.setState({isLoading:!0}),S().post("/widgets/new").send({name:"Default Name",access:"public",category:"Default"}).end(function(e,t){if(e)N.A.add(N.A.TYPE.ERROR,{title:"Cannot create widget",description:e.message}),this._notificationSystem.addNotification({message:"Could not create new widget",level:"error",autoDismiss:5,position:"tc"});else{if(t.headers.location)return void(window.location=t.headers.location);var a=t.body,i=this.state.widgetList,n={name:a.name,id:a.id,categories:a.category,widget:a};i.push(n),i.sort((function(e,t){return(e.name.toUpperCase()>t.name.toUpperCase())-.5})),this.setState({selectedWidget:n,widgetList:i}),this._notificationSystem.addNotification({message:"A new widget has been created successfully ",level:"success",autoDismiss:5,position:"tc"})}this.setState({isLoading:!1})}.bind(this))},onNotifyChange:function(){this.setState({saveIconState:"Armed"})},actionSave:function(){this.setState({saveIconState:"Normal"}),null!=this.state.selectedWidget?this.refs.widgetInfo.saveWidget(this.loadData):this._notificationSystem.addNotification({message:"Could not save widget because no widget is selected",level:"warning",autoDismiss:5,position:"tc"})},openDeleteDialog:function(){null!=this.state.selectedWidget&&this.setState({confirmDelete:!0,confirmDeleteMessage:"Are you sure you want to delete widget "+this.state.selectedWidget.name+"?"})},actionDelete:function(){this.setState({saveIconState:"Normal",confirmDelete:!1,confirmDeleteMessage:"",isLoading:!0}),null!=this.state.selectedWidget?S().delete("/widgets/"+this.state.selectedWidget.id).end(function(e,t){if(e)N.A.add(N.A.TYPE.ERROR,{title:"Cannot delete widget",description:e.message}),this._notificationSystem.addNotification({message:"Could not delete widget",level:"error",autoDismiss:5,position:"tc"});else{if(t.headers.location)return void(window.location=t.headers.location);this.loadData(),this._notificationSystem.addNotification({message:"Widget was successfully deleted",level:"success",autoDismiss:5,position:"tc"})}this.setState({isLoading:!0})}.bind(this)):this._notificationSystem.addNotification({message:"Could not delete widget because no widget is selected",level:"warning",autoDismiss:5,position:"tc"})},onSearch:function(e){this.setState({widgetListFilter:e})},render:function(){var e,t,a=this,i=function(e,t){var a,i="";if(this.state.selectedWidget&&this.state.selectedWidget.id==e.id)i+=" active",a="selectedDomElement";else if(""!=this.state.widgetListFilter){var n=this.state.widgetListFilter.toUpperCase().trim();if(-1==e.name.toUpperCase().indexOf(n)&&-1==e.categories.toUpperCase().indexOf(n)&&-1==e.id.toString().indexOf(n))return null}return o().createElement("li",{key:"widget-"+t,className:i,onMouseDown:this.selectWidget.bind(this,e),ref:a},o().createElement("div",{className:"widget-name"},e.name),o().createElement("div",{className:"widget-category"},e.categories))}.bind(this);On.getDefaultIconFromBrowserShortType(Ln.WIDGET),this.state.isLoading?e=o().createElement("div",{style:{width:"100%",textAlign:"center"}},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"})):(e=this.state.widgetList.length>0?o().createElement("div",{className:"navigator-wrapper"},o().createElement("ul",{className:"dashboard-tree large-items"},this.state.widgetList.map(i))):o().createElement("div",{style:{textAlign:"center",paddingTop:"20px"}},"No widgets have been created"),this.state.selectedWidget&&(this.state.selectedWidget.name,this.state.selectedWidget.thumbnail&&this.state.selectedWidget.thumbnail,t=o().createElement(Tn,{key:this.state.selectedWidget.id,widget:this.state.selectedWidget.widget,onNotifyChange:this.onNotifyChange,ref:"widgetInfo",notificationSys:this._notificationSystem})));var n=[];return this.state.selectedWidget&&(n=[{type:"Delete",callback:this.openDeleteDialog},{type:"Save",callback:this.actionSave,state:this.state.saveIconState}]),o().createElement("div",{className:"height-100p",ref:"topElement"},o().createElement(ti(),{ref:"notificationSystem",style:!1}),o().createElement("div",{className:"height-100p"},o().createElement(Ji,null),o().createElement("div",{id:"singular-browser",className:"portal"},o().createElement("div",{className:"singular-browser-body"},o().createElement("section",{className:"nav-bar"},o().createElement("div",{className:"left-area"},"Widget Manager"),o().createElement("div",{className:"right-area"}," ")),o().createElement("section",{className:"secondary nav-bar"},o().createElement("div",{className:"left-area"},o().createElement("button",{id:"btnDropNewItem",type:"button",tabIndex:"-1",onClick:this.actionAdd,className:"btn btn-primary new-show-btn",style:{width:"125px"},"aria-expanded":"false"},"New Widget")),o().createElement("div",{className:"right-area"},o().createElement("div",null,o().createElement(mn,{mode:"immediate",onSearch:this.onSearch,onSearchClick:this.onSearch,onClearSearchClick:this.onSearch.bind(this,"")})),o().createElement("div",null,o().createElement(Mn,{configuration:n}))),o().createElement("div",null)),o().createElement("nav",{className:"singular-browser-nav",style:{height:"calc(100% - 120px",borderRight:"solid 1px #ccc"}},e),o().createElement("div",{className:"singular-browser-content",style:{top:"120px"}},o().createElement("div",{className:"widget-detail-wrapper"},t))))),o().createElement(Qa(),{show:1==this.state.confirmDelete,title:"",text:this.state.confirmDeleteMessage,showCancelButton:!0,animation:!1,onConfirm:function(){a.setState({confirmDelete:!1}),a.actionDelete()},onCancel:function(){a.setState({confirmDelete:!1})},onEscapeKey:function(){a.setState({confirmDelete:!1})},onOutsideClick:function(){a.setState({confirmDelete:!1})}}))}});var Fn=a(18093),_n=a.n(Fn),Bn=a(9769),Un=a.n(Bn),Wn=a(89603),Yn=a.n(Wn),jn=a(40927),Hn=a(15734),zn=a(95093),Gn=a(82465),$n={toolbar:[[{font:[]}],[{header:[1,2,3,4,5,6,!1]}],["bold","italic","underline","strike","blockquote","code-block"],[{list:"ordered"},{list:"bullet"},{indent:"-1"},{indent:"+1"}],[{color:[]},{background:[]}],[{align:[]}],["link"],["clean"]]},Kn=["header","bold","italic","underline","strike","blockquote","code-block","list","bullet","indent","align","link","color","background"];const qn=jn.createClass({displayName:"MarketplaceItem",getInitialState:function(){var e=this;return this.currentContentIndex=-1,this.browserComposition=null,this.browserApp=null,this.imageDropzone=[],this.videoDropzone=[],this.SortableItem=(0,pa.Zj)(function(e){var t=this,a=e.value,i=e.arrayIndex,n="Browse ...";if(a.element&&a.element.id){var s=Un().getDefaultIconFromBrowserShortType(a.element.type);a.element.thumbnail&&(s=a.element.thumbnail),n=jn.createElement("div",{className:"element-container"},jn.createElement("img",{src:s,className:"element-thumbnail"}),jn.createElement("span",{className:"element-name"},a.element.name))}var o,l,r="";if(a.displayVariants&&a.displayVariants.variants&&a.displayVariants.variants.length){r=JSON.stringify(a.displayVariants);var c=a.displayVariants;r=jn.createElement("div",{className:"display-variant-content"},jn.createElement("div",{className:"display-variant-header"},"Default variant: ",c.active),c.variants.map((function(e,t){return jn.createElement("div",{className:"display-variant-variant",key:t},jn.createElement("div",null,jn.createElement("b",null,e.name),": ",e.resolution),jn.createElement("div",null,e.description||"No description"))})))}else r=jn.createElement("div",{style:{paddingLeft:"30px"}},"No display variants");return o=this.state.imageUploadBusy?jn.createElement("div",{className:"button-list"},jn.createElement("img",{src:"/images/loading-bubbles-blue.svg",style:{width:"30px",height:"30px"}})):a.imageURL?jn.createElement("div",{className:"button-list"},jn.createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:function(){return t.onContentListPropertyChanged("imageURL",i,"")}},jn.createElement("i",{className:"fa fa-times fa-lg"})),jn.createElement(Kt(),{className:"btn btn-white icon-only","data-clipboard-text":a.imageURL,"button-tabIndex":"-1"},jn.createElement("i",{className:"fa fa-clipboard fa-lg"}))):jn.createElement("div",{className:"button-list"},jn.createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:function(){return t.imageDropzone[i].open()}},jn.createElement("i",{className:"fa fa-upload fa-lg"}))),l=this.state.videoUploadBusy?jn.createElement("div",{className:"button-list"},jn.createElement("img",{src:"/images/loading-bubbles-blue.svg",style:{width:"30px",height:"30px"}})):a.videoURL?jn.createElement("div",{className:"button-list"},jn.createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:function(){return t.onContentListPropertyChanged("videoURL",i,"")}},jn.createElement("i",{className:"fa fa-times fa-lg"})),jn.createElement(Kt(),{className:"btn btn-white icon-only","data-clipboard-text":a.videoURL,"button-tabIndex":"-1"},jn.createElement("i",{className:"fa fa-clipboard fa-lg"}))):jn.createElement("div",{className:"button-list"},jn.createElement("button",{className:"btn btn-white icon-only",tabIndex:"-1",onClick:function(){return t.videoDropzone[i].open()}},jn.createElement("i",{className:"fa fa-upload fa-lg"}))),jn.createElement("div",{key:i,className:"contentItem"},jn.createElement("button",{className:"btn btn-white element-icon",tabIndex:"-1",onClick:this.onContentListBrowseElement.bind(this,i)},n),jn.createElement("div",{className:"component name"},jn.createElement("div",{className:"detail-label"},"Name"),jn.createElement("div",null,jn.createElement("input",{type:"text",className:"form-control",value:a.name,onChange:function(e){return t.onContentListPropertyChanged("name",i,e.target.value)}}))),jn.createElement(_n(),{className:"component asset",onDrop:function(e){return t.onContentListUploadImage(i,e)},ref:function(e){return t.imageDropzone[i]=e},disableClick:!0,multiple:!1,accept:".jpg,.jpeg,.png,.webp,.gif,.svg",disablePreview:!0},jn.createElement("div",{className:"detail-label"},"Image"),jn.createElement("div",{className:"image-url"},jn.createElement("div",{className:"preview"},jn.createElement("img",{className:"small",src:a.imageURL,onError:function(e){e.currentTarget.src="/images/broken-file.png"}}),jn.createElement("img",{className:"large",src:a.imageURL,onError:function(e){e.currentTarget.src="/images/broken-file.png"}})),o)),jn.createElement(_n(),{className:"component asset",onDrop:function(e){return t.onContentListUploadVideo(i,e)},ref:function(e){return t.videoDropzone[i]=e},disableClick:!0,multiple:!1,accept:".webm,.mp4,.avi,.mov",disablePreview:!0},jn.createElement("div",{className:"detail-label"},"Video"),jn.createElement("div",{className:"image-url"},jn.createElement("div",{className:"preview"},jn.createElement("video",{className:"small",autoPlay:!0,muted:!0,loop:!0,src:a.videoURL+(this.state.videoCacheBuster?"?"+this.state.videoCacheBuster:"")}),jn.createElement("video",{className:"large",autoPlay:!0,muted:!0,loop:!0,src:a.videoURL+(this.state.videoCacheBuster?"?"+this.state.videoCacheBuster:"")})),l)),jn.createElement("div",{className:"display-variant-info"},r),jn.createElement("button",{className:"btn btn-white icon-only component delete",tabIndex:"-1",onClick:this.onContentListDelete.bind(this,i)},jn.createElement("i",{className:"fa fa-times fa-lg"})))}.bind(this)),this.SortableList=(0,pa.q6)((function(t){var a=t.items;return jn.createElement("div",{className:""},a.map((function(t,a){return jn.createElement(e.SortableItem,{key:a,index:a,value:t,arrayIndex:a})})))})),{duplicateBusy:!1,itemName:"",itemTags:[],itemDescription:"


",itemMarker:"",itemStatus:"draft",itemContent:{type:"",content:[]},itemDisplay:"",itemTagType:"",itemTagFunction:"",itemTagCategory:"",itemTagDataSource:"",itemTagTheme:"",itemFeatured:"",itemNewRelease:"",panelOpenProperties:!0,panelOpenDescription:!0,imageUploadBusy:!1,videoUploadBusy:!1,videoCacheBuster:null}},componentDidMount:function(){window.addEventListener("beforeunload",this.handleWindowClose,!1),this.componentDidUpdate(),this.assignLocalData(this.props.item)},componentWillUnmount:function(){window.removeEventListener("beforeunload",this.handleWindowClose)},componentDidUpdate:function(){var e=this;this.browserComposition=this.refs.compositionBrowserModal.refs.child,this.browserApp=this.refs.appinstanceBrowserModal.refs.child,this.browserComposition.filterByType("c"),this.browserApp.filterByType("ai"),$("#compBrowserModal"+Gn.MARKETITEM_FULLNAME_MAP.c).on("shown.bs.modal",(function(){e.browserComposition.modalPending&&(e.browserComposition.modalPending=!1)})),$("#compBrowserModal"+Gn.MARKETITEM_FULLNAME_MAP.ai).on("shown.bs.modal",(function(){e.browserApp.modalPending&&(e.browserApp.modalPending=!1)}))},shouldComponentUpdate:function(e,t){return!Un().compareObject(t,this.state)||!Un().compareObject(e,this.props)},componentWillReceiveProps:function(e){this.props.item&&e.item&&this.props.item.id==e.item.id||this.assignLocalData(e.item)},handleWindowClose:function(e){var t=null;return this.didLocalDataChange()&&(e.preventDefault(),t="There are unsaved changes. Are you sure you want to continue?",(e||window.event).returnValue=t),t},assignLocalData:function(e){if(e){var t=[];try{t=(t=JSON.parse(e.tags)).length?t.map((function(e){return{className:"Select-create-option-placeholder",label:e,value:e}})):[]}catch(e){}var a={type:"",content:[]};try{a=JSON.parse(e.content)}catch(e){}this.setState({itemName:e.name,itemTags:t,itemContent:a,itemDescription:e.description,itemMarker:e.marker,itemStatus:e.status||"draft",itemDisplay:e.display||"",itemTagType:e.tag_type,itemTagFunction:e.tag_function,itemTagCategory:e.tag_category,itemTagDataSource:e.tag_datasource,itemTagTheme:e.tag_theme,itemFeatured:e.featured,itemNewRelease:e.new_release})}},didLocalDataChange:function(){if(!this.props.item)return!1;if(this.state.imageUploadBusy||this.state.videoUploadBusy)return!0;var e=this.props.item;if(this.state.itemName!=e.name||this.state.itemDescription!=e.description||this.state.itemMarker!=e.marker||this.state.itemStatus!=e.status||this.state.itemDisplay!=e.display||this.state.itemTagType!=e.tag_type||this.state.itemTagFunction!=e.tag_function||this.state.itemTagCategory!=e.tag_category||this.state.itemTagDataSource!=e.tag_datasource||this.state.itemTagTheme!=e.tag_theme||this.state.itemFeatured!=e.featured||this.state.itemNewRelease!=e.new_release)return!0;var t=this.state.itemTags.map((function(e){return e.value}));return!((e.tags||!t.length)&&JSON.stringify(t)==e.tags&&(!e.content&&0==this.state.itemContent.content.length||JSON.stringify(this.state.itemContent)==e.content))},onSaveItem:function(){var e=this.state.itemTags.map((function(e){return e.value})),t={name:this.state.itemName,tags:JSON.stringify(e),content:JSON.stringify(this.state.itemContent),description:this.state.itemDescription,marker:this.state.itemMarker,status:this.state.itemStatus,display:this.state.itemDisplay,tag_type:this.state.itemTagType,tag_function:this.state.itemTagFunction,tag_category:this.state.itemTagCategory,tag_datasource:this.state.itemTagDataSource,tag_theme:this.state.itemTagTheme,featured:this.state.itemFeatured,new_release:this.state.itemNewRelease?zn(this.state.itemNewRelease).format():0};this.props.onSave(this.props.item.id,t)},onNotifyChange:function(){this.props.onNotifyChange&&(this.didLocalDataChange()?this.props.onNotifyChange("Armed"):this.props.onNotifyChange("Normal"))},onNameChanged:function(e){this.setState({itemName:e.target.value},this.onNotifyChange)},onTagsChanged:function(e){this.setState({itemTags:e},this.onNotifyChange)},onDescriptionChanged:function(e,t,a,i){i.getHTML(),this.setState({itemDescription:e},this.onNotifyChange)},onMarkerChanged:function(e){this.setState({itemMarker:e.target.value},this.onNotifyChange)},onItemStatusChanged:function(e){this.setState({itemStatus:e},this.onNotifyChange)},onItemFeaturedChanged:function(e){this.setState({itemFeatured:e},this.onNotifyChange)},onItemNewReleaseChanged:function(e){var t=0;e&&(t=new Date((new Date).valueOf()+864e5*e-1e3).valueOf()),this.setState({itemNewRelease:t},this.onNotifyChange)},onSelectionChanged:function(e,t){var a={};a[e]=t,this.setState(a)},onAddContentItem:function(e){var t=$.extend(!0,{},this.state.itemContent);t.type=e,t.content.push({name:"New Name",element:{id:null,thumbnail:"",name:"",type:e},imageURL:"",videoURL:""}),this.setState({itemContent:t},this.onNotifyChange)},onContentListDelete:function(e){var t=$.extend(!0,{},this.state.itemContent);t.content.splice(e,1),this.setState({itemContent:t},this.onNotifyChange)},controlBrowserDialog:function(e){switch(this.state.itemContent.type){case"composition":$("#compBrowserModal"+Gn.MARKETITEM_FULLNAME_MAP.c).modal(e);break;case"app":$("#compBrowserModal"+Gn.MARKETITEM_FULLNAME_MAP.ai).modal(e);break;default:return void console.log("invalid type in controlBrowserDialog ",this.state.itemContent.type)}},onContentListBrowseElement:function(e){this.currentContentIndex=e,this.controlBrowserDialog("show")},onSelectContentElement:function(e){this.controlBrowserDialog("hide"),this.setState({duplicateBusy:!0});var t,a={sendEmail:0,targetFolder:"root",target_email:"difita9671@aieen.com",toMarketplace:1};"composition"==this.state.itemContent.type?(a.comp_id=e.refId,t="/apiv1/compositions/duplicateto"):(a.app_id=e.refId,t="/apiv1/appinstances/duplicateto"),Hn.post(t).send(a).end(function(t,a){var i=this;if(t)this.props.notificationSystem.addNotification({message:"Could not send item ID "+e.refId+" to marketplace",level:"error",autoDismiss:5,position:"tc"}),this.setState({duplicateBusy:!1});else{if(a.headers.location)return void(window.location=a.headers.location);var n=a.body,s=$.extend(!0,{},this.state.itemContent);if(s.content[this.currentContentIndex].element={id:n.id,name:n.name,thumbnail:n.thumbnail,type:n.type},s.content[this.currentContentIndex].name=n.name,"composition"!=this.state.itemContent.type){console.log("get the display variant data",n);var o="/apiv2/controlapps/"+n.token+"/displayvariants";Hn.get(o).end((function(e,t){e?(console.log("Failed to get display variant data",e),s.content[i.currentContentIndex].displayVariants=null):(console.log("display variant data",t.body),s.content[i.currentContentIndex].displayVariants=t.body),i.setState({itemContent:s,duplicateBusy:!1},i.onNotifyChange)}))}else this.setState({itemContent:s,duplicateBusy:!1},this.onNotifyChange)}}.bind(this))},onContentListPropertyChanged:function(e,t,a){var i=$.extend(!0,{},this.state.itemContent);i.content[t][e]=a,this.setState({itemContent:i},this.onNotifyChange)},monitorVideoUploadStatus:function(e,t){var a=this;Hn.get(e+"?rand="+Math.random()).end((function(i,n){if(i)403===n.statusCode?setTimeout((function(){a.monitorVideoUploadStatus(e,t)}),2e3):(a.setState({videoUploadBusy:!1}),a.props.notificationSystem.addNotification({message:"Failed to transcode video",level:"error",autoDismiss:5,position:"tc"}));else{var s;if(n.text)try{s=JSON.parse(n.text)}catch(e){}s&&"PROGRESSING"!==s.state||setTimeout((function(){a.monitorVideoUploadStatus(e,t)}),2e3),"COMPLETED"!==s.state&&"FAILED"!==s.state||(a.setState({videoUploadBusy:!1}),"FAILED"===s.state?(a.props.notificationSystem.addNotification({message:"Failed to transcode video",level:"error",autoDismiss:5,position:"tc"}),a.onContentListPropertyChanged("videoURL",t,"")):a.setState({videoCacheBuster:Math.random()}))}}))},onContentListUploadImage:function(e,t){var a=this;this.setState({imageUploadBusy:!0});var i=t[0].name;Hn.post("/apiv1/transcoder/image/sign").send({ext:i.substring(i.lastIndexOf(".")+1,i.length)||i}).end((function(i,n){if(i)a.props.notificationSystem.addNotification({message:"Failed to authorize image upload",level:"error",autoDismiss:5,position:"tc"}),a.setState({imageUploadBusy:!1});else{if(n.headers.location)return void(window.location=n.headers.location);var s=n.body,o=s.url;Hn.put(o).send(t[0]).end((function(t,i){a.setState({imageUploadBusy:!1}),t?(a.props.notificationSystem.addNotification({message:"Failed to upload image file",level:"error",autoDismiss:5,position:"tc"}),a.onContentListPropertyChanged("imageURL",e,"")):a.onContentListPropertyChanged("imageURL",e,s.output)}))}}))},onContentListUploadVideo:function(e,t){var a=this;this.setState({videoUploadBusy:!0}),Hn.post("/apiv1/transcoder/video/sign").end((function(i,n){if(i)a.props.notificationSystem.addNotification({message:"Failed to authorize video upload",level:"error",autoDismiss:5,position:"tc"}),a.setState({videoUploadBusy:!1});else{if(n.headers.location)return void(window.location=n.headers.location);var s=n.body,o=s.status,l="https://assets.singular.live/library/"+s.account+"/videos/"+s.file+".webm",r=s.url;a.onContentListPropertyChanged("videoURL",e,l),Hn.put(r).send(t[0]).end((function(t,i){t?(a.props.notificationSystem.addNotification({message:"Failed to upload video file",level:"error",autoDismiss:5,position:"tc"}),a.setState({videoUploadBusy:!1}),a.onContentListPropertyChanged("videoURL",e,"")):a.monitorVideoUploadStatus(o,e)}))}}))},onSortEnd:function(e){var t=$.extend(!0,{},this.state.itemContent);t.content=ua()(t.content,e.oldIndex,e.newIndex),this.setState({itemContent:t},this.onNotifyChange)},render:function(){var e,t=this,a=["c","ai"].map(function(e){var t=Gn.MARKETITEM_FULLNAME_MAP[e]+"BrowserModal",a="compBrowserModal"+Gn.MARKETITEM_FULLNAME_MAP[e];return jn.createElement("div",{id:a,key:a,className:"modal fade u-displaynone singular-modal compBrowserModal",tabIndex:"-1",role:"dialog",style:{overflow:"hidden"}},jn.createElement("div",{id:"compBrowserModalDoc",className:"modal-dialog modal-lg",role:"document"},jn.createElement("div",{className:"modal-content"},jn.createElement("div",{className:"modal-body"},jn.createElement(kt.A,{rtdbFolderRef:window.singularRtdbCoreRef.child("accounts").child(window.singularUser.account.accountId).child("assets"),key:t,ref:t,modalId:a,browserTitle:Gn.BROWSERITEM_NICENAME_MAP[e],showClose:!0,showInspector:!1,showTypeSelection:!1,showHeader:!1,showSearch:!1,enableRealtimeUpdate:!1,onItemDoubleClick:this.onSelectContentElement,useDefaultItemDoubleClick:!1,browserStyle:"composition-selector-modal",showRevisionSelection:!1,dblClicktoSelectedFolder:!1})))))}.bind(this));if(this.props.busy||!this.props.item||this.state.duplicateBusy)return(this.props.busy||this.state.duplicateBusy)&&(e=jn.createElement("div",{style:{width:"100%",textAlign:"center"}},jn.createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"}))),jn.createElement("div",{className:"widget-detail-body developer-manager",style:{height:"auto"}},jn.createElement("div",{className:"details-panel",style:{visibility:"hidden",height:"0px"}},jn.createElement("div",{className:"details-panel-body",ref:"detailsPanelBody"})),e,jn.createElement("div",{key:"browserModelWindows"},a));var i,n,s="undefined";this.props.item.updated_at&&(s=zn(this.props.item.updated_at).format("YYYY-MM-DD HH:mm:ss"));var o=jn.createElement("button",{className:"btn btn-white",onClick:this.onAddContentItem.bind(this,"composition")},"Add Composition"),l=jn.createElement("button",{className:"btn btn-white",onClick:this.onAddContentItem.bind(this,"app")},"Add Control App");this.state.itemContent&&this.state.itemContent.type&&this.state.itemContent.content.length?(i=jn.createElement(this.SortableList,{items:this.state.itemContent.content,onSortEnd:this.onSortEnd,axis:"y",lockAxis:"y",distance:5,pressThreshold:5,lockToContainerEdges:!0,helperClass:"contentItemBackground",helperContainer:this.refs.detailsPanelBody}),n="composition"==this.state.itemContent.type?jn.createElement("div",{className:"buttons"},o):jn.createElement("div",{className:"buttons"},l)):n=jn.createElement("div",{className:"buttons"},o,l);var r,c=0;return this.state.itemNewRelease&&(c=Un().getMarketplaceNewReleaseDaysLeft(this.state.itemNewRelease))&&(r=c+" days left"),jn.createElement("div",{className:"widget-detail-body developer-manager",style:{height:"auto"}},jn.createElement("div",{className:"details-panel"},jn.createElement("div",{className:"details-panel-header"},jn.createElement("span",null,"Properties and metadata"),jn.createElement("button",{className:"btn btn-white icon-only v2",tabIndex:"-1",onClick:function(){return t.setState({panelOpenProperties:!t.state.panelOpenProperties})},style:{marginLeft:"auto"}},this.state.panelOpenProperties&&jn.createElement("i",{className:"fa fa-chevron-down"}),!this.state.panelOpenProperties&&jn.createElement("i",{className:"fa fa-chevron-up"}))),this.state.panelOpenProperties&&jn.createElement("div",{className:"details-panel-body",style:{paddingBottom:"2px"}},jn.createElement("table",{className:"details-table"},jn.createElement("thead",null,jn.createElement("tr",null,jn.createElement("th",{style:{width:"70%"}}),jn.createElement("th",{style:{width:"30%"}}))),jn.createElement("tbody",null,jn.createElement("tr",null,jn.createElement("td",null,jn.createElement("div",{className:"detail-label"},"Name"),jn.createElement("div",null,jn.createElement("input",{type:"text",className:"form-control",value:this.state.itemName,onChange:this.onNameChanged}))),jn.createElement("td",null,jn.createElement("div",{className:"detail-label"},"ID"),jn.createElement("div",null,jn.createElement("input",{type:"text",className:"form-control",value:this.props.item.id,disabled:"disabled"})))),jn.createElement("tr",null,jn.createElement("td",null,jn.createElement("div",{className:"detail-label"},"Tags"),jn.createElement("div",{style:{position:"relative",top:"2px"}},jn.createElement(An().Creatable,{className:"singularSelect creatable white",multi:!0,backspaceToRemoveMessage:"",onChange:this.onTagsChanged,value:this.state.itemTags,placeholder:"Enter tags",arrowRenderer:function(){},menuRenderer:function(){}}))),jn.createElement("td",null,jn.createElement("div",{className:"detail-label"},"Last saved"),jn.createElement("div",null,jn.createElement("input",{type:"text",className:"form-control",value:s,disabled:"disabled"})))),jn.createElement("tr",null,jn.createElement("td",{colSpan:"2"},jn.createElement("div",{className:"menu-panel"},jn.createElement("div",{className:"menu-group"},jn.createElement("div",{className:"detail-label"},"Display"),jn.createElement("div",{className:"selection-input"},jn.createElement(ae.A,{theme:"light",name:"itemDisplay",selections:this.props.displaySelection,value:this.state.itemDisplay,onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}}))),jn.createElement("div",{className:"menu-group"},jn.createElement("div",{className:"detail-label"},"Type"),jn.createElement("div",{className:"selection-input"},jn.createElement(ae.A,{theme:"light",name:"itemTagType",useFilter:!0,selections:this.props.typeSelection,value:this.state.itemTagType,onEnterKey:function(e,a){return t.onSelectionChanged(e,a)},onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}}))),jn.createElement("div",{className:"menu-group"},jn.createElement("div",{className:"detail-label"},"Function"),jn.createElement("div",{className:"selection-input"},jn.createElement(ae.A,{theme:"light",name:"itemTagFunction",useFilter:!0,selections:this.props.functionSelection,value:this.state.itemTagFunction,onEnterKey:function(e,a){return t.onSelectionChanged(e,a)},onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}}))),jn.createElement("div",{className:"menu-group"},jn.createElement("div",{className:"detail-label"},"Category"),jn.createElement("div",{className:"selection-input"},jn.createElement(ae.A,{theme:"light",name:"itemTagCategory",useFilter:!0,selections:this.props.categorySelection,value:this.state.itemTagCategory,onEnterKey:function(e,a){return t.onSelectionChanged(e,a)},onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}}))),jn.createElement("div",{className:"menu-group"},jn.createElement("div",{className:"detail-label"},"Data Source"),jn.createElement("div",{className:"selection-input"},jn.createElement(ae.A,{theme:"light",name:"itemTagDataSource",useFilter:!0,selections:this.props.dataSourceSelection,value:this.state.itemTagDataSource,onEnterKey:function(e,a){return t.onSelectionChanged(e,a)},onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}}))),jn.createElement("div",{className:"menu-group"},jn.createElement("div",{className:"detail-label"},"Theme"),jn.createElement("div",{className:"selection-input"},jn.createElement(ae.A,{theme:"light",name:"itemTagTheme",useFilter:!0,selections:this.props.themeSelection,value:this.state.itemTagTheme,onEnterKey:function(e,a){return t.onSelectionChanged(e,a)},onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}})))))),jn.createElement("tr",null,jn.createElement("td",{colSpan:"2"},jn.createElement("div",{className:"detail-label"},"Marker"),jn.createElement("div",{className:"image-url"},jn.createElement("div",{className:"preview"},jn.createElement("img",{className:"small",src:this.state.itemMarker,onError:function(e){e.currentTarget.src="/images/broken-file.png"}}),jn.createElement("img",{className:"large",src:this.state.itemMarker,onError:function(e){e.currentTarget.src="/images/broken-file.png"}})),jn.createElement("input",{type:"text",className:"form-control",value:this.state.itemMarker,onChange:this.onMarkerChanged})))),jn.createElement("tr",null,jn.createElement("td",{colSpan:"2"},jn.createElement("div",{className:"menu-panel split"},jn.createElement("div",{className:"menu-group"},jn.createElement("div",{className:"detail-label"},"Status"),jn.createElement("div",{className:"dropdown dropdown-white modifier-toggle",style:{width:"110px",top:"-4px"}},jn.createElement("button",{className:"btn btn-white dropdown-toggle","data-toggle":"dropdown"},"published"==this.state.itemStatus?"Published":"Draft"),jn.createElement("ul",{className:"dropdown-menu dropdown-menu"},jn.createElement("li",null,jn.createElement("a",{onClick:this.onItemStatusChanged.bind(this,"draft")},"Draft")),jn.createElement("li",null,jn.createElement("a",{onClick:this.onItemStatusChanged.bind(this,"published")},"Published"))))),jn.createElement("div",{className:"menu-group"},jn.createElement("div",{className:"detail-label"},"Featured"),jn.createElement("div",{className:"dropdown dropdown-white modifier-toggle",style:{width:"110px",top:"-4px"}},jn.createElement("button",{className:"btn btn-white dropdown-toggle","data-toggle":"dropdown"},"1"===String(this.state.itemFeatured)?"Yes":"No"),jn.createElement("ul",{className:"dropdown-menu dropdown-menu"},jn.createElement("li",null,jn.createElement("a",{onClick:this.onItemFeaturedChanged.bind(this,"0")},"No")),jn.createElement("li",null,jn.createElement("a",{onClick:this.onItemFeaturedChanged.bind(this,"1")},"Yes"))))),jn.createElement("div",{className:"menu-group"},jn.createElement("div",{className:"detail-label"},"New Release"),jn.createElement("div",{className:"dropdown dropdown-white modifier-toggle",style:{width:"110px",top:"-4px"}},jn.createElement("button",{className:"btn btn-white dropdown-toggle","data-toggle":"dropdown"},0===c?"No":"Yes"),jn.createElement("ul",{className:"dropdown-menu dropdown-menu"},jn.createElement("li",null,jn.createElement("a",{onClick:this.onItemNewReleaseChanged.bind(this,0)},"No")),jn.createElement("li",null,jn.createElement("a",{onClick:this.onItemNewReleaseChanged.bind(this,7)},"7 days")),jn.createElement("li",null,jn.createElement("a",{onClick:this.onItemNewReleaseChanged.bind(this,14)},"14 days"))))),r&&jn.createElement("div",{style:{position:"relative",left:"-10px",top:"6px"}},r),jn.createElement("div",{className:"menu-group right"},jn.createElement("div",{className:"detail-label"}," "),jn.createElement("div",{className:"input-group-btn",style:{top:"-3px",position:"relative"}},jn.createElement(Kt(),{className:"btn btn-white","data-clipboard-text":window.location.host+"/dashboard?templateLibraryItem="+this.props.item.id,"button-tabIndex":"-1",style:{height:"30px",float:"right",paddingLeft:"18px"}},jn.createElement("i",{className:"fa fa-clipboard fa-lg"}),jn.createElement("span",null,"Copy deep link"))))))))))),jn.createElement("div",{className:"details-panel"},jn.createElement("div",{className:"details-panel-header"},jn.createElement("span",null,"Description"),jn.createElement("button",{className:"btn btn-white icon-only v2",tabIndex:"-1",onClick:function(){return t.setState({panelOpenDescription:!t.state.panelOpenDescription})},style:{marginLeft:"auto"}},this.state.panelOpenDescription&&jn.createElement("i",{className:"fa fa-chevron-down"}),!this.state.panelOpenDescription&&jn.createElement("i",{className:"fa fa-chevron-up"}))),this.state.panelOpenDescription&&jn.createElement("div",{className:"details-panel-body"},jn.createElement(Yn(),{theme:"snow",modules:$n,formats:Kn,value:this.state.itemDescription,onChange:this.onDescriptionChanged,preserveWhitespace:!0}))),jn.createElement("div",{className:"details-panel"},jn.createElement("div",{className:"details-panel-header"},jn.createElement("span",null,"Content and variants")),jn.createElement("div",{className:"details-panel-body",ref:"detailsPanelBody"},i,n)),jn.createElement("div",{key:"browserModelWindows"},a))}});var Jn=o().createClass({displayName:"MarketplaceManager",_notificationSystem:null,getInitialState:function(){return{itemList:[],selectedItem:null,itemListFilter:"",saveIconState:"Normal",confirmDelete:!1,confirmDeleteMessage:"",showNotSavedDialog:!1,futureSelectedItem:null,futureNewItem:!1,filterStatus:"",filterDisplay:"",filterType:"",filterCategory:"",filterDataSource:"",filterLayout:"",filterTheme:"",filterFunction:"",filterFeatured:"",filterNewRelease:""}},componentDidMount:function(){var e=this;this.loadData(),this._notificationSystem=this.refs.notificationSystem,It.A.createShortcut("mod+s",(function(){e.actionSave()}),this.refs.topElement)},componentDidUpdate:function(){if(this.refs.selectedDomElement){var e=n().findDOMNode(this.refs.selectedDomElement);e&&e.scrollIntoViewIfNeeded(!0)}},shouldComponentUpdate:function(e,t){return!Un().compareObject(t,this.state)||!Un().compareObject(e,this.props)},loadData:function(){this.setState({isLoading:!0,saveIconState:"Normal"}),S().get("/apiv1/marketplace/items").set("Content-Type","application/json").end(function(e,t){if(e)this._notificationSystem.addNotification({message:"Could not fetch items from server",level:"error",autoDismiss:5,position:"tc"}),this.setState({isLoading:!1});else{if(t.headers.location)return void(window.location=t.headers.location);for(var a=t.body,i=0,n=a.length;it.name.toUpperCase())-.5}));var o=null;if(this.state.selectedItem)for(var l=0,r=a.length;l0&&(o=a[0]),this.setState({itemList:a,selectedItem:o,isLoading:!1})}}.bind(this))},saveItem:function(e,t){this.setState({isLoading:!0,saveIconState:"Normal"}),S().put("apiv1/marketplace/items/"+e).send(t).end(function(t,a){if(t)this._notificationSystem.addNotification({message:"Could not save item "+e,level:"error",autoDismiss:5,position:"tc"}),this.setState({isLoading:!1});else{if(a.headers.location)return void(window.location=a.headers.location);this.loadData()}}.bind(this))},selectItem:function(e){e&&(!this.state.futureSelectedItem&&this.refs.marketplaceItem&&this.refs.marketplaceItem.didLocalDataChange()?this.setState({showNotSavedDialog:!0,futureSelectedItem:e}):this.setState({selectedItem:e,futureSelectedItem:null,saveIconState:"Normal"}))},actionAdd:function(){!this.state.futureNewItem&&this.refs.marketplaceItem&&this.refs.marketplaceItem.didLocalDataChange()?this.setState({showNotSavedDialog:!0,futureNewItem:!0}):(this.setState({isLoading:!0,futureNewItem:!1}),S().post("apiv1/marketplace/items").send({name:"New item",description:"


",tags:"[]",status:"draft"}).end(function(e,t){if(e)this._notificationSystem.addNotification({message:"Could not create new item",level:"error",autoDismiss:5,position:"tc"}),this.setState({isLoading:!1});else{if(this.setState({selectedItem:t.body}),t.headers.location)return void(window.location=t.headers.location);this.loadData()}}.bind(this)))},onNotifyChange:function(e){this.setState({saveIconState:e})},actionSave:function(){this.setState({saveIconState:"Normal"}),this.state.selectedItem?this.refs.marketplaceItem.onSaveItem():this._notificationSystem.addNotification({message:"Could not save item because no item is selected",level:"warning",autoDismiss:5,position:"tc"})},openDeleteDialog:function(){this.state.selectedItem&&this.setState({confirmDelete:!0,confirmDeleteMessage:"Are you sure you want to delete item "+this.state.selectedItem.name+"?"})},actionDelete:function(){this.setState({saveIconState:"Normal",confirmDelete:!1,confirmDeleteMessage:"",isLoading:!0}),null!=this.state.selectedItem&&S().delete("apiv1/marketplace/items/"+this.state.selectedItem.id).end(function(e,t){if(e)this._notificationSystem.addNotification({message:"Could not delete item",level:"error",autoDismiss:5,position:"tc"}),this.setState({isLoading:!1});else{if(t.headers.location)return void(window.location=t.headers.location);this._notificationSystem.addNotification({message:"Item was successfully deleted",level:"success",autoDismiss:5,position:"tc"}),this.loadData()}}.bind(this))},onSearch:function(e){this.setState({itemListFilter:e})},onSelectionChanged:function(e,t){var a={};a[e]=t,this.setState(a)},render:function(){var e,t=this,a=!1,i=0,n=function(e,t){var n="",s="";if(""!=this.state.itemListFilter){var l=this.state.itemListFilter.toUpperCase().trim();if(-1==e.name.toUpperCase().indexOf(l)&&-1==e.id.toString().indexOf(l)&&-1==e.tags.toUpperCase().indexOf(l))return null}if(this.state.filterStatus&&e.status&&this.state.filterStatus!=e.status)return null;if(this.state.filterDisplay&&e.display&&this.state.filterDisplay!=e.display)return null;if(this.state.filterCategory&&this.state.filterCategory!=e.tag_category)return null;if(this.state.filterDataSource&&this.state.filterDataSource!=e.tag_datasource)return null;if(this.state.filterTheme&&this.state.filterTheme!=e.tag_theme)return null;if(this.state.filterFunction&&this.state.filterFunction!=e.tag_function)return null;if(""!==this.state.filterFeatured&&this.state.filterFeatured!==String(e.featured))return null;if(""!==this.state.filterNewRelease){var r=Un().getMarketplaceNewReleaseDaysLeft(e.new_release);if("0"===this.state.filterNewRelease&&r||"1"===this.state.filterNewRelease&&!r)return null}if(this.state.filterType&&this.state.filterType!=e.tag_type)return null;if(this.state.filterLayout){var c=!1;if(e.contentObj&&e.contentObj.content&&e.contentObj.content.length){var d=e.contentObj.content[0];d.displayVariants&&(c=Un().displayVariantHasLayout(d.displayVariants.variants,this.state.filterLayout))}if(!c)return null}i++,this.state.selectedItem&&this.state.selectedItem.id==e.id&&(n+=" active",s="selectedDomElement",a=!0);var p=o().createElement("span",{style:{color:"red",fontSize:"10px"}},"No tags assigned");if(e.tags)try{var m=JSON.parse(e.tags);m&&m.length&&(p=m.map((function(e,t){return o().createElement("span",{key:t,style:{background:"#f1f1f1",border:"1px solid #e5e6e7",borderRadius:"2px",color:"#333333",padding:"1px 2px 1px 2px",marginRight:"2px",fontSize:"10px"}},e)})))}catch(e){}var u=o().createElement("i",{className:"fa fa-edit",style:{color:"orange"}});return"published"==e.status&&(u=o().createElement("i",{className:"fa fa-check-circle",style:{color:"green"}})),o().createElement("li",{key:"widget-"+t,className:n,onMouseDown:this.selectItem.bind(this,e),ref:s},o().createElement("div",{style:{position:"absolute",left:"-2px",top:"14px"}},u),o().createElement("div",{className:"widget-name"},e.name),o().createElement("div",{className:"widget-category"},p))}.bind(this);this.state.isLoading?e=o().createElement("div",{style:{width:"100%",textAlign:"center"}},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"})):this.state.itemList.length?(e=o().createElement("div",{className:"navigator-wrapper"},o().createElement("ul",{className:"dashboard-tree large-items"},this.state.itemList.map(n))),0==i&&(e=o().createElement("div",{style:{textAlign:"center",paddingTop:"20px"}},"No items match the filter"))):e=o().createElement("div",{style:{textAlign:"center",paddingTop:"20px"}},"No items have been created");var s,l=function(e,t){var a=[{id:"",title:"Any"}];if(e&&e.length){var i=[];e.map((function(e){var a=e[t];a&&-1===i.indexOf(a)&&i.push(a)})),i.sort(),i.map((function(e){a.push({id:e,title:e})}))}return a},r=this.state.itemList,c=l(r,"tag_type"),d=l(r,"tag_function"),p=l(r,"tag_category"),m=l(r,"tag_datasource"),u=l(r,"tag_theme"),h=[{id:"",title:"Any"},{id:"uno",title:"UNO Portal"},{id:"dashboard",title:"Dashboard"}],f=[{id:"",title:"Any"},{id:"0",title:"No"},{id:"1",title:"Yes"}],g=[{id:"",title:"Any"},{id:"0",title:"No"},{id:"1",title:"Yes"}],v=[];return 0==this.state.isLoading&&this.state.selectedItem&&a&&(v=[{type:"Delete",callback:this.openDeleteDialog},{type:"Save",callback:this.actionSave,state:this.state.saveIconState}]),this.state.selectedItem&&a&&(s=o().createElement(qn,{item:this.state.selectedItem,busy:this.state.isLoading,onNotifyChange:this.onNotifyChange,onSave:this.saveItem,notificationSystem:this._notificationSystem,displaySelection:h,typeSelection:c,functionSelection:d,categorySelection:p,dataSourceSelection:m,themeSelection:u,featuredSelection:f,newReleaseSelection:g,ref:"marketplaceItem"})),o().createElement("div",{className:"height-100p",ref:"topElement"},o().createElement(ti(),{ref:"notificationSystem",style:!1}),o().createElement("div",{id:"MarketplaceManager",className:"height-100p"},o().createElement(Ji,null),o().createElement("div",{id:"singular-browser",className:"portal"},o().createElement("div",{className:"singular-browser-body"},o().createElement("section",{className:"nav-bar"},o().createElement("div",{className:"left-area"},"Template Library"),o().createElement("div",{className:"right-area"}," ")),o().createElement("section",{className:"secondary nav-bar"},o().createElement("div",{className:"left-area"},o().createElement("button",{id:"btnDropNewItem",type:"button",tabIndex:"-1",onClick:this.actionAdd,className:"btn btn-primary new-show-btn",style:{width:"125px"},"aria-expanded":"false"},"New ",this.props.title)),o().createElement("div",{className:"right-area"},o().createElement("div",{className:"search-and-menus"},o().createElement(mn,{mode:"immediate",onSearch:this.onSearch,onSearchClick:this.onSearch,onClearSearchClick:this.onSearch.bind(this,"")}),o().createElement("div",{className:"filter-menu"},o().createElement("div",null,"Status"),o().createElement(ae.A,{theme:"light",name:"filterStatus",selections:[{id:"",title:"Any"},{id:"draft",title:"Draft"},{id:"published",title:"Published"}],value:this.state.filterStatus,onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}})),o().createElement("div",{className:"filter-menu"},o().createElement("div",null,"Display"),o().createElement(ae.A,{theme:"light",name:"filterDisplay",selections:h,value:this.state.filterDisplay,onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}})),o().createElement("div",{className:"filter-menu"},o().createElement("div",null,"Type"),o().createElement(ae.A,{theme:"light",name:"filterType",selections:c,value:this.state.filterType,onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}})),o().createElement("div",{className:"filter-menu"},o().createElement("div",null,"Function"),o().createElement(ae.A,{theme:"light",name:"filterFunction",selections:d,value:this.state.filterFunction,onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}})),o().createElement("div",{className:"filter-menu"},o().createElement("div",null,"Category"),o().createElement(ae.A,{theme:"light",name:"filterCategory",selections:p,value:this.state.filterCategory,onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}})),o().createElement("div",{className:"filter-menu"},o().createElement("div",null,"Layout"),o().createElement(ae.A,{theme:"light",name:"filterLayout",selections:[{id:"",title:"Any"},{id:"landscape",title:"Landscape"},{id:"portrait",title:"Portrait"},{id:"square",title:"Square"},{id:"responsive",title:"Responsive"}],value:this.state.filterLayout,onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}})),o().createElement("div",{className:"filter-menu"},o().createElement("div",null,"Data Source"),o().createElement(ae.A,{theme:"light",name:"filterDataSource",selections:m,value:this.state.filterDataSource,onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}})),o().createElement("div",{className:"filter-menu"},o().createElement("div",null,"Theme"),o().createElement(ae.A,{theme:"light",name:"filterTheme",selections:u,value:this.state.filterTheme,onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}})),o().createElement("div",{className:"filter-menu"},o().createElement("div",null,"Featured"),o().createElement(ae.A,{theme:"light",name:"filterFeatured",selections:f,value:this.state.filterFeatured,onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}})),o().createElement("div",{className:"filter-menu"},o().createElement("div",null,"New Release"),o().createElement(ae.A,{theme:"light",name:"filterNewRelease",selections:g,value:this.state.filterNewRelease,onValueChanged:function(e,a){return t.onSelectionChanged(e,a)}}))),o().createElement("div",null,o().createElement(Mn,{configuration:v}))),o().createElement("div",null)),o().createElement("nav",{className:"singular-browser-nav",style:{borderRight:"solid 1px #ccc",height:"calc(100% - 120px"}},e),o().createElement("div",{className:"singular-browser-content",style:{top:"120px"}},o().createElement("div",{className:"widget-detail-wrapper"},s))))),o().createElement(Qa(),{show:1==this.state.confirmDelete,title:"",text:this.state.confirmDeleteMessage,showCancelButton:!0,animation:!1,onConfirm:function(){t.setState({confirmDelete:!1}),t.actionDelete()},onCancel:function(){t.setState({confirmDelete:!1})},onEscapeKey:function(){t.setState({confirmDelete:!1})},onOutsideClick:function(){t.setState({confirmDelete:!1})}}),o().createElement(Qa(),{show:1==this.state.showNotSavedDialog,title:"",text:"Changed you made were not saved.",showCancelButton:!0,confirmButtonText:"Save",cancelButtonText:"Discard",animation:!1,onConfirm:function(){t.setState({showNotSavedDialog:!1}),t.actionSave(),t.state.futureSelectedItem?t.selectItem(t.state.futureSelectedItem):t.actionAdd()},onCancel:function(){t.setState({showNotSavedDialog:!1}),t.state.futureSelectedItem?t.selectItem(t.state.futureSelectedItem):t.actionAdd()},onEscapeKey:function(){t.setState({showNotSavedDialog:!1})},onOutsideClick:function(){t.setState({showNotSavedDialog:!1})}}))}});const Xn=Jn;function Zn(e){return Zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zn(e)}function Qn(e,t,a){return(t=function(e){var t=function(e){if("object"!=Zn(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=Zn(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Zn(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var es=a(9769),ts=a(82465);const as=o().createClass({displayName:"CompositionSelector",getInitialState:function(){return this.compositionInfoXhrRequest=null,this.revisionXhrRequest=null,{compositionLoading:!1,compositionName:"Please select a composition",compositionThumbnail:null,compositionError:!1,revisionsLoading:!1,revisions:null}},componentWillMount:function(){this.FetchCompositionInfo(this.props.value)},componentDidMount:function(){this.browserRef=this.refs.browser.refs.child,this.browserRef.filterByType(ts.COMPOSITION)},componentWillReceiveProps:function(e){this.props.value&&e.value&&this.props.value.id!=e.value.id&&this.FetchCompositionInfo(e.value)},componentDidUpdate:function(){},componentWillUnmount:function(){this.compositionInfoXhrRequest&&this.compositionInfoXhrRequest.abort(),this.revisionXhrRequest&&this.revisionXhrRequest.abort()},FetchCompositionInfo:function(e){e?(this.setState({compositionLoading:!0}),this.compositionInfoXhrRequest&&this.compositionInfoXhrRequest.abort(),this.compositionInfoXhrRequest=S().post("/apiv1/browser/items").send([{refId:e.refId,type:"composition"}]).end(function(t,a){if(t)return N.A.add(N.A.TYPE.ERROR,{title:"Fetch composition info "+e.id,description:t}),this.setState(Qn(Qn(Qn({compositionName:"Cannot fetch composition info",revisions:null,compositionThumbnail:null,compositionLoading:!1},"revisions",null),"revisionsLoading",!1),"compositionError",!0)),void(this.compositionInfoXhrRequest=null);a.headers.location?window.location=a.headers.location:(a.body&&a.body[0]?(this.setState({compositionName:a.body[0].name,compositionThumbnail:a.body[0].thumbnail,compositionLoading:!1,compositionError:!1}),this.loadRevisions(a.body[0].id)):this.setState({compositionName:"Please select a composition",compositionThumbnail:null,compositionLoading:!1,revisions:null,revisionsLoading:!1,compositionError:!1}),this.compositionInfoXhrRequest=null)}.bind(this))):this.setState({compositionName:"Please select a composition",compositionThumbnail:null,compositionLoading:!1,compositionError:!1,revisions:null,revisionsLoading:!1})},loadRevisions:function(e){this.setState({revisionsLoading:!0}),this.revisionXhrRequest&&this.revisionXhrRequest.abort(),this.revisionXhrRequest=S().get("/apiv1/compositions/"+e+"/revisions").set("Content-Type","application/json").end(function(e,t){if(this.setState({revisionsLoading:!1}),e)this.setState({revisions:null}),N.A.add(N.A.TYPE.ERROR,{title:"Could not read revision list from server",description:e.message});else{if(t.headers.location)return void(window.location=t.headers.location);for(var a=[{id:"latest",title:"Current"}],i=0,n=t.body.length;i0){-1==i&&(n=a[0]);for(var s=0;st.name.toUpperCase())-.5})),this.setState({appTemplateList:a});var i=null;if(this.state.selectedappTemplate)for(var n=0,s=a.length;n0&&(i=a[0]),this.setState({selectedappTemplate:i})}this.setState({isLoading:!1})}.bind(this))},selectappTemplate:function(e){this.setState({selectedappTemplate:e,saveIconState:"Normal"})},actionAdd:function(){this.setState({isLoading:!0}),S().post("/apptemplates/new").send({name:"Default Name",access:"public",category:"Default"}).end(function(e,t){if(e)N.A.add(N.A.TYPE.ERROR,{title:"Cannot create appTemplate",description:e.message}),this._notificationSystem.addNotification({message:"Could not create new app",level:"error",autoDismiss:5,position:"tc"});else{if(t.headers.location)return void(window.location=t.headers.location);var a=t.body,i=this.state.appTemplateList,n={name:a.name,id:a.id,categories:a.category,appTemplate:a};i.push(n),i.sort((function(e,t){return(e.name.toUpperCase()>t.name.toUpperCase())-.5})),this.setState({selectedappTemplate:n,appTemplateList:i})}this._notificationSystem.addNotification({message:"New app has been created successfully",level:"success",autoDismiss:5,position:"tc"}),this.setState({isLoading:!1})}.bind(this))},onNotifyChange:function(){this.setState({saveIconState:"Armed"})},actionSave:function(){this.setState({saveIconState:"Normal"}),null!=this.state.selectedappTemplate?this.refs.appTemplateInfo.saveappTemplate(this.loadData):(console.log("cannot save, no Apps selected"),this._notificationSystem.addNotification({message:"No app is selected to save",level:"error",autoDismiss:5,position:"tc"}))},openDeleteDialog:function(){null!=this.state.selectedappTemplate&&this.setState({confirmDelete:!0,confirmDeleteMessage:"Are you sure you want to delete control app "+this.state.selectedappTemplate.name+"?"})},actionDelete:function(){this.setState({saveIconState:"Normal",confirmDelete:!1,confirmDeleteMessage:"",isLoading:!0}),null!=this.state.selectedappTemplate?S().delete("/apptemplates/"+this.state.selectedappTemplate.id).end(function(e,t){if(e)N.A.add(N.A.TYPE.ERROR,{title:"Cannot delete App",description:e.message}),this._notificationSystem.addNotification({message:"Could not delete the app",level:"error",autoDismiss:5,position:"tc"});else{if(t.headers.location)return void(window.location=t.headers.location);this._notificationSystem.addNotification({message:"The app has been deleted",level:"success",autoDismiss:5,position:"tc"}),this.loadData()}this.setState({isLoading:!0})}.bind(this)):(console.log("cannot delete, no App selected"),this._notificationSystem.addNotification({message:"No app was selected to delete",level:"error",autoDismiss:5,position:"tc"}))},onSearch:function(e){this.setState({appTemplateListFilter:e})},render:function(){var e,t,a=this,i=function(e,t){var a,i="appTemplate-item";if(this.state.selectedappTemplate&&this.state.selectedappTemplate.id==e.id)i+=" active",a="selectedDomElement";else if(""!=this.state.appTemplateListFilter){var n=this.state.appTemplateListFilter.toUpperCase().trim();if(-1==e.name.toUpperCase().indexOf(n)&&-1==e.categories.toUpperCase().indexOf(n)&&-1==e.id.toString().indexOf(n))return null}return o().createElement("li",{key:"appTemplate-"+t,className:i,onMouseDown:this.selectappTemplate.bind(this,e),ref:a},o().createElement("div",{className:"widget-name"},e.name),o().createElement("div",{className:"widget-category"},e.categories))}.bind(this);this.state.isLoading?e=o().createElement("div",{style:{width:"100%",textAlign:"center"}},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"})):(e=this.state.appTemplateList.length>0?o().createElement("div",{className:"navigator-wrapper"},o().createElement("ul",{className:"dashboard-tree large-items"},this.state.appTemplateList.map(i))):o().createElement("div",{style:{textAlign:"center",paddingTop:"20px"}},"No apps have been created"),this.state.selectedappTemplate&&(this.state.selectedappTemplate.name,this.state.selectedappTemplate.thumbnail,t=o().createElement(ds,{key:this.state.selectedappTemplate.id,appTemplate:this.state.selectedappTemplate.appTemplate,onNotifyChange:this.onNotifyChange,ref:"appTemplateInfo",notificationSys:this._notificationSystem})));var n=[];return this.state.selectedappTemplate&&(n=[{type:"Delete",callback:this.openDeleteDialog},{type:"Save",callback:this.actionSave,state:this.state.saveIconState}]),o().createElement("div",{className:"height-100p",ref:"topElement"},o().createElement(ti(),{ref:"notificationSystem",style:!1}),o().createElement("div",{className:"height-100p"},o().createElement(Ji,null),o().createElement("div",{id:"singular-browser",className:"portal"},o().createElement("div",{className:"singular-browser-body"},o().createElement("section",{className:"nav-bar"},o().createElement("div",{className:"left-area"},"App Manager"),o().createElement("div",{className:"right-area"}," ")),o().createElement("section",{className:"secondary nav-bar"},o().createElement("div",{className:"left-area"},o().createElement("button",{id:"btnDropNewItem",type:"button",tabIndex:"-1",onClick:this.actionAdd,className:"btn btn-primary new-show-btn",style:{width:"125px"},"aria-expanded":"false"},"New App")),o().createElement("div",{className:"right-area"},o().createElement("div",null,o().createElement(mn,{mode:"immediate",onSearch:this.onSearch,onSearchClick:this.onSearch,onClearSearchClick:this.onSearch.bind(this,"")})),o().createElement("div",null,o().createElement(Mn,{configuration:n}))),o().createElement("div",null)),o().createElement("nav",{className:"singular-browser-nav",style:{height:"calc(100% - 120px",borderRight:"solid 1px #ccc"}},e),o().createElement("div",{className:"singular-browser-content",style:{top:"120px"}},o().createElement("div",{className:"widget-detail-wrapper"},t))))),o().createElement(Qa(),{show:1==this.state.confirmDelete,title:"",text:this.state.confirmDeleteMessage,showCancelButton:!0,animation:!1,onConfirm:function(){a.setState({confirmDelete:!1}),a.actionDelete()},onCancel:function(){a.setState({confirmDelete:!1})},onEscapeKey:function(){a.setState({confirmDelete:!1})},onOutsideClick:function(){a.setState({confirmDelete:!1})}}))}});var ms=a(45465),us=a.n(ms);const hs=o().createClass({displayName:"CKEditor",getInitialState:function(){return this.elementName="editor_"+this.props.id,this.componentDidMount=this.componentDidMount.bind(this),{}},componentDidMount:function(){CKEDITOR.replace(this.elementName,{toolbar:[["Bold","Italic","-","NumberedList","BulletedList","-","Outdent","Indent"]]}),CKEDITOR.instances[this.elementName].on("change",function(){var e=CKEDITOR.instances[this.elementName].getData();this.props.onChange(e)}.bind(this))},setData:function(e){CKEDITOR.instances[this.elementName].setData(e)},render:function(){return o().createElement("textarea",{name:this.elementName})}});a(88170);const fs=o().createClass({displayName:"ReleaseNoteInfo",onInputChanged:function(e,t){this.props.onReleaseNoteInfoChanged&&("published_at"==e&&(t=ge()(t,"x").utc().format("YYYY-MM-DDTHH:mm:ss.000Z")),this.props.onReleaseNoteInfoChanged(e,t))},setDescriptionText:function(e){this.refs.txtDescEditor.setData(e)},render:function(){var e=this,t=this.props.releasenote,a=new Date;t.published_at&&(a=ge()(t.published_at).toDate());var i=o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Id"),o().createElement("td",{className:"field-col"},t.id)),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Title"),o().createElement("td",{className:"field-col"},o().createElement("input",{id:"txtTitle",name:"txtTitle",type:"text",value:t.title,className:"form-control",placeholder:"please enter Title",onChange:function(t){return e.onInputChanged("title",t.target.value)}}))),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Status"),o().createElement("td",{className:"field-col"},o().createElement("select",{id:"ddlStatus",name:"ddlStatus",value:t.status,className:"form-control",onChange:function(t){return e.onInputChanged("status",t.target.value)}},o().createElement("option",{value:"published"},"Published"),o().createElement("option",{value:"draft"},"Draft")))),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Published Time"),o().createElement("td",{className:"field-col dpk"},o().createElement(us(),{value:a,inputProps:{id:"dpkPublishedTime",placeholder:"please enter published time",readOnly:"true"},dateFormat:"MM/DD/YYYY",timeFormat:"HH:mm",ref:"dpkPublished",onChange:function(t){return e.onInputChanged("published_at",t)}}))),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Url"),o().createElement("td",{className:"field-col"},o().createElement("input",{type:"text",value:t.url,className:"form-control",placeholder:"please enter Url",onChange:function(t){return e.onInputChanged("url",t.target.value)}}))),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Type"),o().createElement("td",{className:"field-col"},o().createElement("select",{value:t.type,className:"form-control",onChange:function(t){return e.onInputChanged("type",t.target.value)}},o().createElement("option",{value:"update"},"Update"),o().createElement("option",{value:"new-feature"},"New Feature"),o().createElement("option",{value:"bug-fix"},"Bug Fix")))),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Category"),o().createElement("td",{className:"field-col"},o().createElement("select",{value:t.category||"none",className:"form-control",onChange:function(t){return e.onInputChanged("category",t.target.value)}},o().createElement("option",{value:"none"},"No Category"),o().createElement("option",{value:"spark"},"Spark"),o().createElement("option",{value:"studio"},"Studio"),o().createElement("option",{value:"dashboard"},"Dashboard"),o().createElement("option",{value:"composer"},"Composer"),o().createElement("option",{value:"api"},"API")))),o().createElement("tr",null,o().createElement("td",{className:"label-col",style:{verticalAlign:"top"}},"Description"),o().createElement("td",{className:"field-col"},o().createElement(hs,{id:"txtDesc",value:t.description,onChange:function(t){return e.onInputChanged("description",t)},ref:"txtDescEditor"})))));return o().createElement("div",{style:{height:"100%"}},o().createElement("div",{className:"profile-properties",style:{marginRight:"0px"}},o().createElement("div",{className:"property-group",style:{width:"calc(100% - 20px)"}},o().createElement("div",{className:"group-title"},"Update details"),o().createElement("div",{className:"group-body"},i))))}});var gs=a(88170);const vs=o().createClass({displayName:"ReleaseNoteList",getInitialState:function(){return this.latestDeleteId=0,{releaseNotesData:[],showBusyIcon:!1,activeReleaseNote:this.getEmptyActiveReleaseNote(),confirmDelete:!1}},getEmptyActiveReleaseNote:function(){return{id:0,title:"",description:"",status:"draft",url:"",type:"update",published_at:new Date}},componentDidMount:function(){this.loadAllReleaseNotes()},loadAllReleaseNotes:function(){this.setState({releaseNotesData:[],showBusyIcon:!0}),0==this.state.activeReleaseNote.id&&this.refs.releaseNoteInfo.setDescriptionText(""),S().get("/apiv1/releasenotes").set("Content-Type","application/json").end(function(e,t){if(t.headers.location)window.location=t.headers.location;else{var a,i=[];e?(console.log("error while reading release notes: "+e),this.setState({showBusyIcon:!1})):i=t.body,i.sort((function(e,t){return e.id>t.id?-1:e.ida&&(a=s):a=s)}a||(a=i.length?i[0]:this.getEmptyActiveReleaseNote()),this.setState({releaseNotesData:i,showBusyIcon:!1}),this.selectedReleaseNote(a),this.latestDeleteId=0}}.bind(this))},selectedReleaseNote:function(e){var t=this.state.activeReleaseNote;JSON.stringify(e)!=JSON.stringify(t)&&(this.setState({activeReleaseNote:e}),this.refs.releaseNoteInfo.setDescriptionText(e.description),this.props.onRowSelected&&this.props.onRowSelected())},onReleaseNoteInfoChanged:function(e,t){var a=this.state.activeReleaseNote,i={};$.extend(!0,i,a),i[e]=t,JSON.stringify(i)!=JSON.stringify(a)&&(this.setState({activeReleaseNote:i}),this.props.onInfoChanged&&this.props.onInfoChanged())},onReleaseNoteInfoAction:function(e){switch(e){case"Create":var t=this.state.activeReleaseNote;this.setState({showBusyIcon:!0}),t.id=0,S().post("/apiv1/releasenotes/").send(t).end(function(e,t){this.loadAllReleaseNotes()}.bind(this));break;case"Update":t=this.state.activeReleaseNote,this.setState({showBusyIcon:!0}),S().put("/apiv1/releasenotes/"+t.id).send(t).end(function(e,t){this.loadAllReleaseNotes()}.bind(this));break;case"Delete":this.setState({confirmDelete:!0});break;case"Cancel":this.setState({activeReleaseNote:this.getEmptyActiveReleaseNote()}),this.refs.releaseNoteInfo.setDescriptionText("")}},actionDelete:function(){1==this.state.confirmDelete&&this.setState({confirmDelete:!1});var e=this.state.activeReleaseNote;this.latestDeleteId=e.id,this.setState({showBusyIcon:!0}),S().delete("/apiv1/releasenotes/"+e.id).end(function(e,t){this.loadAllReleaseNotes()}.bind(this))},getDateTimeDisplayed:function(e){return e?ge()(e).format("MMMM DD, YYYY HH:mm"):""},render:function(){var e,t=this,a=o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",{style:{width:"5%",textAlign:"center"}},"ID"),o().createElement("th",{style:{width:"35%",textAlign:"left"}},"Title"),o().createElement("th",{style:{width:"10%",textAlign:"center"}},"Status"),o().createElement("th",{style:{width:"10%",textAlign:"center"}},"Type"),o().createElement("th",{style:{width:"10%",textAlign:"center"}},"Category"),o().createElement("th",{style:{width:"15%",textAlign:"center"}},"Published"),o().createElement("th",{style:{width:"15%",textAlign:"center"}},"Modified"))),i=function(e){var t=this.props.search.toUpperCase();if(""!=t&&-1==e.title.toUpperCase().indexOf(t))return null;var a="";this.state.activeReleaseNote&&this.state.activeReleaseNote.id==e.id&&(a=" active");var i=gs.STATUS_NAME_MAP[e.status]||"",n=gs.TYPE_NAME_MAP[e.type]||"",s=gs.CATEGORY_NAME_MAP[e.category]||"No Category";return o().createElement("tr",{key:e.id,onClick:this.selectedReleaseNote.bind(this,e),className:a},o().createElement("td",{style:{textAlign:"center"}},e.id),o().createElement("td",{style:{textAlign:"left"}},e.title),o().createElement("td",{style:{textAlign:"center"}},i),o().createElement("td",{style:{textAlign:"center"}},n),o().createElement("td",{style:{textAlign:"center"}},s),o().createElement("td",{style:{textAlign:"center",whiteSpace:"nowrap"}},this.getDateTimeDisplayed(e.published_at)),o().createElement("td",{style:{textAlign:"center",whiteSpace:"nowrap"}},this.getDateTimeDisplayed(e.updated_at)))}.bind(this);e=this.state.showBusyIcon?o().createElement("table",{className:"widget-version-list",style:{overflowY:"scroll"}},a,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{colSpan:"100%",style:{textAlign:"center"}},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"}))))):o().createElement("table",{className:"widget-version-list",style:{overflowY:"scroll"}},a,o().createElement("tbody",null,this.state.releaseNotesData.map(i)));var n=o().createElement(fs,{ref:"releaseNoteInfo",releasenote:this.state.activeReleaseNote,onReleaseNoteInfoAction:this.onReleaseNoteInfoAction,onReleaseNoteInfoChanged:this.onReleaseNoteInfoChanged});return o().createElement("div",{className:"profile-wrapper",style:{height:"calc(100% - 43px)"}},o().createElement("div",{className:"releasenote-administration-wrapper"},o().createElement("div",{className:"releasenote-list",style:{overflow:"scroll",height:"100%",marginLeft:"5px",marginTop:"10px",width:"calc(100% - 562px)"}},e),o().createElement("div",{className:"profile-wrapper"},n)),o().createElement(Qa(),{show:1==this.state.confirmDelete,title:"",text:"Are you sure you want to delete?",showCancelButton:!0,onConfirm:function(){t.actionDelete()},onCancel:function(){1==t.state.confirmDelete&&t.setState({confirmDelete:!1})},onEscapeKey:function(){1==t.state.confirmDelete&&t.setState({confirmDelete:!1})},onOutsideClick:function(){1==t.state.confirmDelete&&t.setState({confirmDelete:!1})}}))}}),bs=o().createClass({displayName:"ReleaseNoteEditor",getInitialState:function(){return{searchValue:"",mode:"Create",saveIconState:"Normal"}},componentDidMount:function(){},onAdd:function(){this.onToolbarCallback("Create"),this.setState({mode:"Create"})},onUpdate:function(){this.onToolbarCallback("Update"),this.setState({mode:"Create"})},onCancel:function(){this.onToolbarCallback("Cancel"),this.setState({mode:"Create"})},onDelete:function(){this.onToolbarCallback("Delete"),this.setState({mode:"Create"})},onToolbarCallback:function(e){this.refs.releaseNoteList.onReleaseNoteInfoAction(e)},onRowSelected:function(){this.setState({mode:"Update",saveIconState:"Normal"})},onInfoChanged:function(){"Armed"!=this.state.saveIconState&&this.setState({saveIconState:"Armed"})},onSearchChange:function(e){this.setState({searchValue:e})},render:function(){var e=o().createElement(vs,{search:this.state.searchValue,onRowSelected:this.onRowSelected,onInfoChanged:this.onInfoChanged,ref:"releaseNoteList"}),t=[];return"Create"==this.state.mode?t.push({type:"AddReleaseNote",callback:this.onAdd}):(t.push({type:"AddReleaseNote",callback:this.onAdd}),t.push({type:"UpdateReleaseNote",callback:this.onUpdate,state:this.state.saveIconState}),t.push({type:"CancelReleaseNote",callback:this.onCancel}),t.push({type:"DeleteReleaseNote",callback:this.onDelete})),o().createElement("div",{style:{height:"100%"}},o().createElement(Ji,null),o().createElement("div",{id:"singular-browser",className:"portal"},o().createElement("section",{className:"nav-bar"},o().createElement("div",{className:"left-area"},"Release Notes"),o().createElement("div",{className:"right-area"})),o().createElement("section",{className:"secondary nav-bar"},o().createElement("div",{className:"left-area"}),o().createElement("div",{className:"right-area"},o().createElement(mn,{mode:"immediate",onSearch:this.onSearchChange}),o().createElement(Mn,{configuration:t}))),o().createElement("div",{className:"singular-browser-body"},o().createElement("div",{className:"singular-browser-content",style:{width:"100%",left:"0px"}},o().createElement("div",{style:{height:"100%"}},e)))))}});function ys(e){return ys="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ys(e)}function Es(e,t,a){return(t=function(e){var t=function(e){if("object"!=ys(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=ys(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ys(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var ws=a(88170);const Ss=o().createClass({displayName:"ViewReleasenotes",getInitialState:function(){return this.hasNoteData=!1,{navigateItems:[],releaseNotes:[],showBusyIcon:!1,searchValue:"",userLastSeenId:0,selectedMonthYear:ge()(new Date).format("MMMM YYYY"),currentMonthYear:ge()(new Date).format("MMMM YYYY"),currentMonthYearValue:ge()(new Date).format("YYYYMM")}},componentDidMount:function(){this.getUserReleaseNotes()},onSearch:function(e){this.setState({searchValue:e})},onChangeYear:function(e){this.setState({selectedMonthYear:e})},getUserReleaseNotes:function(){this.setState({navigateItems:[],userLastSeenId:0,releaseNotes:[],showBusyIcon:!0}),S().get("/apiv1/releasenotes/userreleasenotes").set("Content-Type","application/json").end(function(e,t){if(t.headers.location)window.location=t.headers.location;else{var a=[],i=[],n=0;if(e)console.log("error while reading release notes: "+e);else{if(n=t.body.userLastSeenId,0==(a=t.body.data).length)a=[];else{var s="|"+this.state.currentMonthYear+"|";i.push({text:this.state.currentMonthYear,value:this.state.currentMonthYearValue});for(var o=0;ot.value?-1:e==t?0:1})),a.sort((function(e,t){var a=e.published_at,i=t.published_at;return a>i?-1:a==i?0:1}))}this.setState({navigateItems:i,userLastSeenId:n,releaseNotes:a,showBusyIcon:!1})}}}.bind(this))},render:function(){this.state.selectedMonthYear.toString();var e,t,a=function(e){var t,a=e.text;return e.value,this.state.selectedMonthYear==a&&(t=" active"),o().createElement("li",{className:t,key:a,onClick:this.onChangeYear.bind(this,a)},o().createElement("span",{style:{display:"inline-block",top:"6px"}},o().createElement("div",{className:"asset-label"},a)))}.bind(this),i=function(e){if(ge()(e.published_at).format("MMMM YYYY")!=this.state.selectedMonthYear)return null;var t,a=this.state.searchValue.toUpperCase();if(""!=a&&-1==e.title.toUpperCase().indexOf(a))return null;0==this.hasNoteData&&(this.hasNoteData=!0);var i,n="";e.id>this.state.userLastSeenId&&(t=o().createElement("span",{className:"label label-info",style:{marginRight:"10px"}},"New"));var s,l=o().createElement("span",{className:"label label-default",style:{marginRight:"10px"}},ws.CATEGORY_NAME_MAP[e.category]||"No Category");switch(i=ge()(e.published_at).format("MMMM DD, YYYY"),e.type){case"update":n=o().createElement("span",{style:{color:"#8bc34a",fontWeight:"300"}},"Update");break;case"new-feature":n=o().createElement("span",{style:{color:"#2196f3",fontWeight:"300"}},"New Feature");break;case"bug-fix":n=o().createElement("span",{style:{color:"#F44336",fontWeight:"300"}},"Bug Fix")}return e.url&&(s=o().createElement("div",null,o().createElement("a",{href:e.url,target:"_blank",className:"btn btn-primary"},"More Info"))),o().createElement("div",{className:"release-note"},o().createElement("h2",null,t,n," - ",e.title," "),o().createElement("div",{className:"update-datetime"},l,i),o().createElement("div",{dangerouslySetInnerHTML:{__html:e.description},className:"release-note-content"}),s)}.bind(this);return this.state.showBusyIcon?(e=o().createElement("ul",{className:"dashboard-tree"},o().createElement("ul",{id:"folder-tree-item-root"},o().createElement("img",{src:"/images/loading-bubbles.svg",className:"loader"}))),t=null):(e=o().createElement("ul",{className:"dashboard-tree"},o().createElement("ul",{id:"folder-tree-item-root"},this.state.navigateItems.map(a))),this.hasNoteData=!1,t=this.state.releaseNotes.map(i),0==this.hasNoteData&&(t=o().createElement("div",{style:Es(Es({width:"100% !important"},"width","100%"),"textAlign","center")},o().createElement("div",{className:"group-body"},o().createElement("div",{className:"col-xs-12 col-md-12 vcenter"},o().createElement("span",{className:"h3"},"We are polishing the engine, squishing the bugs, bolting on the shiny new parts. Updates will be posted soon!")))))),o().createElement("div",{className:"height-100p",style:{overflowY:"hidden"}},o().createElement(Ji,null),o().createElement("div",{id:"singular-browser",className:"portal"},o().createElement("div",{className:"singular-browser-body",style:{height:"100%"}},o().createElement("section",{className:"nav-bar"},o().createElement("div",{className:"left-area"},"Release Notes"),o().createElement("div",{className:"right-area"}," ")),o().createElement("section",{className:"secondary nav-bar"},o().createElement("div",{className:"left-area"}," "),o().createElement("div",{className:"right-area"},o().createElement("div",null,o().createElement(mn,{mode:"immediate",onSearch:this.onSearch,onSearchClick:this.onSearch,onClearSearchClick:this.onSearch.bind(this,"")})),o().createElement("div",null," ")),o().createElement("div",null)),o().createElement("nav",{className:"singular-browser-nav",style:{padding:"20px"}},o().createElement("div",{className:"navigator-wrapper"},e)),o().createElement("div",{className:"singular-browser-content",style:{top:"120px",height:"calc(100% - 180px)",left:"200px",width:"calc(100% - 200px)"}},o().createElement("div",{className:"singular-browser-content-scroll",style:{overflowY:"auto",height:"100%"}},o().createElement("div",{className:"release-note-wrapper"},o().createElement("h1",null,"Release Notes - ",this.state.selectedMonthYear.toString()),t))))))}});var Ns=a(94948),Cs=a.n(Ns);const xs=o().createClass({displayName:"UserInfo",getInitialState:function(){return{currentPassword:"",newPassword:"",repeatPassword:"",changePasswordState:!1,changePasswordError:"",passwordBusy:!1,currentAccountName:""}},componentWillMount:function(){this.setState({currentAccountName:this.props.accountName})},componentWillReceiveProps:function(e){(this.props.user&&!e.user||!this.props.user&&e.user||this.props.user.id!=e.user.id)&&this.cancelPassword(),e.accountName!=this.props.accountName&&this.setState({currentAccountName:e.accountName})},onPropertiesChanged:function(e,t){this.props.onActiveUserPropertiesChanged&&this.props.onActiveUserPropertiesChanged(e,t.target.value)},onToggleChanged:function(e,t){this.props.onActiveUserPropertiesChanged&&this.props.onActiveUserPropertiesChanged(e,t.target.checked)},onAccountNameChanged:function(e){this.setState({currentAccountName:e.target.value}),this.props.onAccountNameChanged&&this.props.onAccountNameChanged(e.target.value)},onCurrentPasswordChanged:function(e){this.setState({currentPassword:e.target.value}),this.props.onActiveUserPropertiesChanged&&this.props.onActiveUserPropertiesChanged("currentpassword",e.target.value)},onNewPasswordChanged:function(e){this.setState({newPassword:e.target.value}),this.props.onActiveUserPropertiesChanged&&this.props.onActiveUserPropertiesChanged("password",e.target.value)},onRepeatPasswordChanged:function(e){this.setState({repeatPassword:e.target.value}),this.props.onActiveUserPropertiesChanged&&this.props.onActiveUserPropertiesChanged("repeatpassword",e.target.value)},changePassword:function(){this.setState({changePasswordState:!0,changePasswordError:""})},savePassword:function(){var e;if("UserAdministration"==this.props.mode){var t={userId:this.props.user.id,password:this.state.newPassword,confirmpassword:this.state.repeatPassword};e=S().put("/apiv1/users/changepasswordadmin").send(t)}else t={currentpassword:this.state.currentPassword,password:this.state.newPassword,confirmpassword:this.state.repeatPassword},e=S().put("/apiv1/users/changepassword").send(t);this.setState({passwordBusy:!0,changePasswordError:""}),e.end(function(e,t){if(e){var a=JSON.parse(t.text),i=a.error?a.error.message:a.message;this.props.onNotification("Cannot change password: "+i,"error",10,"tc"),this.setState({changePasswordError:i}),this.setState({passwordBusy:!1})}else{if(t.headers.location)return void(window.location=t.headers.location);"UserProfile"!=this.props.mode&&0==this.props.user.emailVerified&&this.props.user.id!=window.singularUser.account.accountAdminId?S().put("/apiv1/users/"+this.props.user.id+"/verify").end(function(e,t){if(e)this.props.onNotification("Cannot verify email: "+t.error.message,"error",10,"tc"),this.setState({passwordBusy:!1});else{if(t.headers.location)return void(window.location=t.headers.location);this.props.onActiveUserPropertiesChanged&&this.props.onActiveUserPropertiesChanged("emailVerified",!0),this.cancelPassword()}}.bind(this)):this.cancelPassword()}}.bind(this))},cancelPassword:function(){this.setState({changePasswordState:!1,currentPassword:"",newPassword:"",repeatPassword:"",changePasswordError:"",passwordBusy:!1})},onChangeEmail:function(){var e=this,t=this.props.user.id,a=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;Cs()({title:"Please enter a new email",input:"text",inputAttributes:{autocapitalize:"off",style:"color: #595959"},confirmButtonText:"Confirm",showLoaderOnConfirm:!0,onOpen:function(){Cs().disableConfirmButton(),Cs().getInput().addEventListener("keyup",(function(e){a.test(e.target.value)?Cs().enableConfirmButton():Cs().disableConfirmButton()}))},preConfirm:function(i){if(a.test(i)&&""!=i){var n=new FormData;n.append("user_id",t),n.append("email",i),fetch("/apiv1/users/changeemail/",{method:"PUT",body:n}).then((function(t){t.json().then((function(e){return{data:e,status:t.status}})).then((function(t){200!==t.status?Cs()({title:"Failed to change email",text:t.data.error.message,type:"error"}):(e.props.loadAllUsers(),Cs()({title:"Success",type:"success"}))}))}))}else Cs().disableLoading(),Cs().showValidationError("Please enter a valid email")}})},render:function(){if(!this.props.user)return null;var e,t,a={};$.extend(!0,a,this.props.user,this.props.mutatedUser),e=o().createElement("input",{type:"text",className:"form-control",disabled:!0,readOnly:!0,value:a.email}),0==a.emailVerified&&(t=o().createElement("span",{style:{position:"relative",top:"15px"}},"The email of this user hasn't been verified yet. The user has to follow the verification link that was sent to this email or you can change the password here to verify the user."));var i=o().createElement("div",{className:"details-panel",style:{margin:"10px auto 0px auto"}},o().createElement("div",{className:"details-panel-header"},"Details"),o().createElement("div",{className:"details-panel-body"},o().createElement("table",{className:"details-table"},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Created"),o().createElement("div",{style:{fontWeight:"300"}},ge()(a.created_at).format("YYYY-MM-DD HH:mm:ss")))),o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Modified"),o().createElement("div",{style:{fontWeight:"300"}},ge()(a.updated_at).fromNow())))),o().createElement("tr",null,o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Last Login"),o().createElement("div",{style:{fontWeight:"300"}},a.lastloggedin_at?ge()(a.lastloggedin_at).fromNow():"never"))),o().createElement("td",null)))),t)),n=!1;"UserProfile"==this.props.mode&&(n=!0);var s,l,r,c,d,p,m,u,h=!1;if(a.id==window.singularUser.account.accountAdminId&&(h=!0),0==this.state.changePasswordState&&"CreateUser"!=this.props.mode)s=o().createElement("tr",null,o().createElement("td",{style:{padding:"0px"}},o().createElement("div",{style:{display:"flex",width:"100%"}},o().createElement("input",{type:"password",className:"form-control",readOnly:!0,disabled:!0,value:"fakePassword",style:{flex:"1"}}),o().createElement("button",{className:"btn btn-white",type:"button",onClick:this.changePassword,style:{left:"-10px",height:"30px",lineHeight:"1",position:"relative",top:"-5px",padding:"2px 15px"}},o().createElement("i",{className:"fa fa-pencil",style:{float:"none",position:"static"}})))));else{var f;"UserProfile"==this.props.mode&&(s=o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Password"),o().createElement("td",{className:"field-col"},o().createElement("input",{type:"password",className:"form-control",value:this.state.currentPassword,onChange:this.onCurrentPasswordChanged})))),f="UserProfile"==this.props.mode?"New":"Password",l=o().createElement("tr",null,o().createElement("td",{className:"label-col"},f),o().createElement("td",{className:"field-col"},o().createElement("input",{type:"password",className:"form-control",value:this.state.newPassword,onChange:this.onNewPasswordChanged}))),r=o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Repeat"),o().createElement("td",{className:"field-col"},o().createElement("input",{type:"password",className:"form-control",value:this.state.repeatPassword,onChange:this.onRepeatPasswordChanged}))),"CreateUser"!=this.props.mode&&(c=1==this.state.passwordBusy?o().createElement("tr",null,o().createElement("td",{className:"label-col"}),o().createElement("td",{className:"field-col"},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",style:{height:"35px"}}))):"UserAdministration"===this.props.mode?o().createElement("tr",null,o().createElement("td",{style:{padding:"0px"},colSpan:"2"},o().createElement("div",{style:{display:"flex",justifyContent:"space-around"}},o().createElement("button",{className:"btn btn-white",tabIndex:"-1",type:"button",onClick:this.savePassword,style:{width:"80px"}},"Save"),o().createElement("button",{className:"btn btn-white",tabIndex:"-1",type:"button",onClick:this.cancelPassword,style:{width:"80px",marginLeft:"10px"}},"Cancel")))):o().createElement("tr",null,o().createElement("td",{className:"label-col"}),o().createElement("td",{className:"field-col"},o().createElement("button",{className:"btn btn-white",tabIndex:"-1",type:"button",onClick:this.savePassword,style:{width:"80px"}},"Save"),o().createElement("button",{className:"btn btn-white",tabIndex:"-1",type:"button",onClick:this.cancelPassword,style:{width:"80px",marginLeft:"10px"}},"Cancel"))));var g=this.state.changePasswordError;this.props.passwordError&&(g=this.props.passwordError),d=o().createElement("tr",null,o().createElement("td",{className:"label-col"}),o().createElement("td",{className:"field-col"},g))}return a.id==window.singularUser.account.accountAdminId&&(p=o().createElement("div",{style:{marginLeft:"30px"}},o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"admin"},"This is the admin user")},o().createElement("i",{className:"fa fa-diamond"})))),"UserProfile"==this.props.mode&&a.id==window.singularUser.account.accountAdminId&&(m=o().createElement("div",{className:"details-panel",style:{margin:"10px auto 0px auto"}},o().createElement("div",{className:"details-panel-header"},"Account"),o().createElement("div",{className:"details-panel-body"},o().createElement("table",{className:"details-table"},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Account Name"),o().createElement("div",null,o().createElement("input",{type:"text",className:"form-control",value:this.state.currentAccountName,onChange:this.onAccountNameChanged})))))))))),u=a.is_sso?o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Single sign-on"),o().createElement("div",null,"More info will be here"))):o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Password"),o().createElement("div",null,o().createElement("table",null,o().createElement("tbody",null,s,l,r,c,d))))),o().createElement("div",{className:"developer-manager",style:{height:this.props.height,overflow:"auto",padding:"0px 5px"}},o().createElement("div",{className:"details-panel",style:{margin:"10px auto 0px auto"}},o().createElement("div",{className:"details-panel-header"},"User Information ",p),o().createElement("div",{className:"details-panel-body"},"UserAdministration"!==this.props.mode&&o().createElement("table",{className:"details-table"},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"First name"),o().createElement("div",null,o().createElement("input",{type:"text",className:"form-control",value:a.firstName,onChange:this.onPropertiesChanged.bind(this,"firstName")})))),o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Last name"),o().createElement("div",null,o().createElement("input",{type:"text",className:"form-control",value:a.lastName?a.lastName:"",onChange:this.onPropertiesChanged.bind(this,"lastName")}))))),o().createElement("tr",null,o().createElement("td",{style:{verticalAlign:"top"}},o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Email Address"),o().createElement("div",null,e))),u))),"UserAdministration"===this.props.mode&&o().createElement("table",{className:"details-table"},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"First name"),o().createElement("div",null,o().createElement("input",{type:"text",className:"form-control",value:a.firstName,onChange:this.onPropertiesChanged.bind(this,"firstName")}))))),o().createElement("tr",null,o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Last name"),o().createElement("div",null,o().createElement("input",{type:"text",className:"form-control",value:a.lastName?a.lastName:"",onChange:this.onPropertiesChanged.bind(this,"lastName")}))))),o().createElement("tr",null,o().createElement("td",null,o().createElement("div",{className:"detail-label"},"Email Address"),o().createElement("div",{style:{display:"flex",width:"100%"}},o().createElement("input",{type:"email",className:"form-control",readOnly:!0,disabled:!0,value:a.email,style:{flex:"1"}}),o().createElement("button",{className:"btn btn-white",type:"button",onClick:this.onChangeEmail,style:{left:"-10px",height:"30px",lineHeight:"1",position:"relative",top:"-5px",padding:"2px 15px"}},o().createElement("i",{className:"fa fa-pencil",style:{float:"none",position:"static"}}))))),o().createElement("tr",null,u))))),o().createElement("div",{className:"details-panel",style:{margin:"10px auto 0px auto"}},o().createElement("div",{className:"details-panel-header"},"User Settings"),o().createElement("div",{className:"details-panel-body"},o().createElement("table",{className:"details-table"},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement("div",{className:"detail-label"},"User Administration")),o().createElement("td",null,o().createElement("label",{className:"switch"},o().createElement("input",{type:"checkbox",className:"switch-input",id:"perUser",checked:a.permUserManagement,onChange:this.onToggleChanged.bind(this,"permUserManagement"),disabled:n||h}),o().createElement("span",{className:"switch-label","data-on":"ON","data-off":"OFF"}),o().createElement("span",{className:"switch-handle"})))),o().createElement("tr",null,o().createElement("td",null,o().createElement("div",{className:"detail-label"},"Developer Tools")),o().createElement("td",null,o().createElement("label",{className:"switch"},o().createElement("input",{type:"checkbox",className:"switch-input",id:"perDev",checked:a.permDevTool,onChange:this.onToggleChanged.bind(this,"permDevTool"),disabled:n}),o().createElement("span",{className:"switch-label","data-on":"ON","data-off":"OFF"}),o().createElement("span",{className:"switch-handle"})))),o().createElement("tr",null,o().createElement("td",null,o().createElement("div",{className:"detail-label"},"Server Status Notification Email")),o().createElement("td",null,o().createElement("label",{className:"switch"},o().createElement("input",{type:"checkbox",className:"switch-input",id:"perDev",checked:a.email_status_notification,onChange:this.onToggleChanged.bind(this,"email_status_notification"),disabled:n}),o().createElement("span",{className:"switch-label","data-on":"ON","data-off":"OFF"}),o().createElement("span",{className:"switch-handle"})))))))),m,i)}}),Is=o().createClass({displayName:"UserProfile",getInitialState:function(){return{user:{},mutatedUser:{},mutatedAccountName:window.singularUser.account.accountName||null,showBusyIcon:!1,saveIconState:"Normal"}},componentWillMount:function(){},componentDidMount:function(){this.loadProfile()},loadProfile:function(){this.setState({showBusyIcon:!0,user:null}),S().get("/apiv1/users/me").set("Content-Type","application/json").end(function(e,t){if(e)console.log("error while reading user profile: "+e),this.setState({showBusyIcon:!1});else{if(t.headers.location)return void(window.location=t.headers.location);this.setState({user:t.body,showBusyIcon:!1})}}.bind(this))},onChange:function(e,t){var a=this.state.mutatedUser;a[e]=t,this.setState({mutatedUser:a}),"password"!=e&&"repeatpassword"!=e&&"currentpassword"!=e&&this.setState({saveIconState:"Armed"})},onAccountNameChanged:function(e){this.setState({saveIconState:"Armed",mutatedAccountName:e})},actionSave:function(){this.props.onNotification("Saving data","info",5,"tc"),this.setState({saveIconState:"Busy"}),E().parallel([function(e){var t={},a=!1;null!=this.state.mutatedUser.lastName&&(t.lastName=this.state.mutatedUser.lastName,a=!0),null!=this.state.mutatedUser.firstName&&(t.firstName=this.state.mutatedUser.firstName,a=!0),a?S().put("/apiv1/users/"+this.state.user.id+"/metadata").send(t).end(function(t,a){if(t)console.log("cannot save user data"),e("cannot save user data");else{if(a.headers.location)return void(window.location=a.headers.location);e(null,"done")}}.bind(this)):e(null,"done_nochange")}.bind(this),function(e){if(this.state.mutatedAccountName!=window.singularUser.account.accountName){var t={name:this.state.mutatedAccountName};S().post("/apiv1/accounts/rename").send(t).end(function(t,a){if(t)console.log("cannot rename account data"),e("cannot rename account data");else{if(a.headers.location)return void(window.location=a.headers.location);window.singularUser.account.accountName=this.state.mutatedAccountName,e(null,"done")}}.bind(this))}else e(null,"done_nochange")}.bind(this)],function(e,t){if(e)this.props.onNotification("Cannot save data","error",5,"tc");else{var a=t[0];t[1],"done"==a&&this.loadProfile(),this.props.onNotification("Data save successfully","success",5,"tc")}this.setState({saveIconState:"Normal"})}.bind(this))},render:function(){var e;e=1==this.state.showBusyIcon?o().createElement("div",{className:"loader-wrapper"},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"})):o().createElement(xs,{user:this.state.user,mode:"UserProfile",mutatedUser:this.state.mutatedUser,accountName:window.singularUser.account.accountName,onActiveUserPropertiesChanged:this.onChange,onAccountNameChanged:this.onAccountNameChanged,onNotification:this.props.onNotification,height:"calc(100% - 75px)"});var t=[{type:"Save",callback:this.actionSave,state:this.state.saveIconState}];return o().createElement("div",{className:"profile-wrapper"},o().createElement("div",{className:"singular-browser-body-tools"},o().createElement(Mn,{configuration:t})),o().createElement("div",{style:{height:"100%"}},e))}});var ks=a(8229),Ds=a.n(ks);const As=o().createClass({displayName:"UserAdministration",getInitialState:function(){return this.fetchUserRequest=null,{users:[],activeUser:null,mutateUserData:this.getDefaultNewUserData(),showBusyIcon:!1,createUserActive:!1,passwordError:null,confirmDelete:!1,confirmDeleteMessage:"",inviteUserMode:null,inviteUserEmailValid:!1,inviteUserEmail:"",inviteUserFirstName:"",inviteUserLastName:"",searchString:""}},getDefaultNewUserData:function(){return{firstName:"New",lastName:"User",permCompEditor:1}},componentDidMount:function(){this.loadAllUsers()},componentWillUnmount:function(){this.fetchUserRequest&&this.fetchUserRequest.abort()},componentDidUpdate:function(){if(this.refs.selectedDomElement){var e=n().findDOMNode(this.refs.selectedDomElement);e&&e.scrollIntoViewIfNeeded(!0)}},loadAllUsers:function(){this.setState({showBusyIcon:!0,users:[]}),this.fetchUserRequest=S().get("/apiv1/users").set("Content-Type","application/json").end(function(e,t){if(t.headers.location)window.location=t.headers.location;else{var a=[];e?(this.props.onNotification("Error while reading users: "+e,"error",15,"tc"),this.selectActiveUserInList(),this.setState({showBusyIcon:!1})):a=t.body,a.sort((function(e,t){return e.email.localeCompare(t.email)})),this.setState({users:a}),this.selectActiveUserInList(),this.setState({showBusyIcon:!1}),this.fetchUserRequest=null}}.bind(this))},selectUser:function(e){var t={};$.extend(!0,t,e),this.setState({activeUser:e,mutateUserData:t,createUserActive:!1,passwordError:null}),this.onNotifyChange("selectUser")},onNotifyChange:function(e){"selectUser"!=e?this.setState({saveIconState:"Armed"}):this.setState({saveIconState:"Normal",createNewUser:!1})},selectActiveUserInList:function(){var e=null;if(null!=this.state.activeUser)for(var t=0,a=this.state.users.length;t0?this.selectUser(this.state.users[0]):this.selectUser(null)},onActiveUserPropertiesChanged:function(e,t){var a={};$.extend(!0,a,this.state.mutateUserData),a[e]=t,this.setState({mutateUserData:a}),this.setState({mutateUserData:a}),("password"!=e&&"repeatpassword"!=e&&"currentpassword"!=e||1==this.state.createUserActive)&&this.onNotifyChange()},actionSave:function(){if(this.state.activeUser&&(0!==Object.keys(this.state.mutateUserData).length||this.state.mutateUserData.constructor!==Object)){var e=this.state.activeUser.id,t={};$.extend(!0,t,this.state.mutateUserData),1!=this.state.createUserActive?(this.setState({showBusyIcon:!0}),S().put("/apiv1/users/"+e+"/metadata").send(t).end(function(e,t){if(e)this.props.onNotification("Cannot save user data","error",15,"tc");else{if(t.headers.location)return void(window.location=t.headers.location);this.loadAllUsers()}}.bind(this))):this.createUserOnServer(t)}},actionAddUser:function(){this.setState({createUserActive:!0,mutateUserData:this.getDefaultNewUserData()})},onAddUserSSO:function(){this.setState({inviteUserMode:"AddSSO"}),$("#inviteUserModal").modal("show")},onInviteUser:function(){this.setState({inviteUserMode:"Invite"}),$("#inviteUserModal").modal("show")},actionSendInvite:function(){if($("#inviteUserModal").modal("hide"),0!=this.state.inviteUserEmailValid){var e;e="AddSSO"==this.state.inviteUserMode?"/apiv1/users/invitesso":"/apiv1/users/invite";var t={email:this.state.inviteUserEmail,firstName:this.state.inviteUserFirstName,lastName:this.state.inviteUserLastName,permDashboard:1,permCompEditor:1};S().post(e).send(t).end(function(e,t){if(e)t&&t.body&&t.body.error&&this.props.onNotification("Cannot invite user: "+t.body.error.message,"error",15,"tc");else{if(t.headers.location)return void(window.location=t.headers.location);this.loadAllUsers(),this.setState({inviteUserEmailValid:!1,inviteUserEmail:"",inviteUserFirstName:"",inviteUserLastName:""})}}.bind(this))}},inviteUserEmailChanged:function(e){var t=e.target.value;this.setState({inviteUserEmail:t,inviteUserEmailValid:Ds().email(t)})},inviteUserFirstNameChanged:function(e){this.setState({inviteUserFirstName:e.target.value})},inviteUserLastNameChanged:function(e){this.setState({inviteUserLastName:e.target.value})},createUserOnServer:function(e){S().post("/apiv1/users/").send(e).end(function(e,t){if(e)this.setState({passwordError:t.body.error.message});else{if(t.headers.location)return void(window.location=t.headers.location);var a=t.body;this.setState({activeUser:a,mutateUserData:{},createUserActive:!1,passwordError:null}),this.loadAllUsers()}}.bind(this))},openDeleteDialog:function(){null!=this.state.activeUser&&this.setState({confirmDelete:!0,confirmDeleteMessage:"Are you sure you want to delete user "+this.state.activeUser.email+"?"})},actionDeleteUser:function(){this.setState({showBusyIcon:!0,confirmDelete:!1,confirmDeleteMessage:""}),S().delete("/apiv1/users/"+this.state.activeUser.id).end(function(e,t){e&&(this.props.onNotification("Cannot delete user","error",15,"tc"),this.setState({showBusyIcon:!1})),this.loadAllUsers()}.bind(this))},onAddUser:function(){this.actionAddUser(),this.setState({createNewUser:!0})},onDeleteUser:function(){this.openDeleteDialog(),this.setState({saveIconState:"Normal",createNewUser:!1})},onSaveUser:function(){this.actionSave(),this.setState({saveIconState:"Normal",createNewUser:!1})},onSearchChange:function(e){this.setState({searchString:e})},render:function(){var e=this;if(!window.singularUser.account.permission.permUserManagement)return null;var t,a,i=!1,n=window.singularUser.account.subscription.user_limit,s=function(e){var t,a,s=this.state.searchString.toUpperCase();if(""!=s&&-1==e.email.toUpperCase().indexOf(s)&&-1==e.id.toString().indexOf(s))return null;n<=0&&(t=o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"admin"},"You are over your user limit.")},o().createElement("i",{className:"fa fa-warning",style:{color:"#f7531b",fontSize:"15px",top:"1px",position:"relative",left:"4px"}})),a={backgroundColor:"#feece7"}),n--;var l="",r=null;0==this.state.createUserActive&&this.state.activeUser&&this.state.activeUser.id==e.id&&(l=" active",r="selectedDomElement",i=!0,a=void 0);var c="never";e.lastloggedin_at&&(c=ge()(e.lastloggedin_at).fromNow());var d;return d=0==e.emailVerified?o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"pending"},"Email address is not verified yet")},o().createElement("i",{className:"fa fa-circle account-status pending"})):e.id==window.singularUser.account.accountAdminId?o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"admin"},"This is the admin user")},o().createElement("i",{className:"fa fa-diamond account-status active"})):o().createElement("i",{className:"fa fa-circle account-status active"}),o().createElement("tr",{key:e.id,onMouseDown:this.selectUser.bind(this,e),className:l,style:a,ref:r},o().createElement("td",{style:{textAlign:"center"}},t),o().createElement("td",{style:{textAlign:"center"}},d),o().createElement("td",{style:{textAlign:"center"}},e.id),o().createElement("td",null,e.email),o().createElement("td",null,ge()(e.created_at).format("YYYY-MM-DD HH:mm:ss")),o().createElement("td",null,c))}.bind(this),l=o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",{style:{width:"2%",textAlign:"center"}},o().createElement("span",{className:"table-header"})),o().createElement("th",{style:{width:"5%",textAlign:"center"}},o().createElement("span",{className:"table-header"},"Status")),o().createElement("th",{style:{width:"7%",textAlign:"center"}},o().createElement("span",{className:"table-header"},"ID")),o().createElement("th",{style:{width:"46%"}},o().createElement("span",{className:"table-header"},"Email")),o().createElement("th",{style:{width:"20%"}},o().createElement("span",{className:"table-header"},"Created")),o().createElement("th",{style:{width:"20%"}},o().createElement("span",{className:"table-header"},"Last login")))),r="UserAdministration";1==this.state.createUserActive&&(r="CreateUser"),this.state.showBusyIcon?t=o().createElement("table",{className:"widget-version-list",style:{overflowY:"scroll"}},l,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{colSpan:"100%",style:{textAlign:"center"}},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"}))))):(t=o().createElement("table",{className:"widget-version-list",style:{overflowY:"scroll"}},l,o().createElement("tbody",null,this.state.users.map(s))),i&&(a=o().createElement(xs,{user:this.state.activeUser,mode:r,mutatedUser:this.state.mutateUserData,onActiveUserPropertiesChanged:this.onActiveUserPropertiesChanged,passwordError:this.state.passwordError,onNotification:this.props.onNotification,loadAllUsers:this.loadAllUsers,height:"100%"})));var c,d,p=[];if(1==this.state.createNewUser)p=[{type:"Save",callback:this.onSaveUser,state:this.state.saveIconState}];else{var m=!1;this.state.activeUser&&this.state.activeUser.id==window.singularUser.account.accountAdminId&&(m=!0),p=window.singularUser.account.is_sso?[{type:"InviteUser",callback:this.onInviteUser},{type:"AddUserSSO",callback:this.onAddUserSSO},{type:"Save",callback:this.onSaveUser,state:this.state.saveIconState},{type:"Delete",callback:this.onDeleteUser,disabled:m}]:[{type:"InviteUser",callback:this.onInviteUser},{type:"Save",callback:this.onSaveUser,state:this.state.saveIconState},{type:"Delete",callback:this.onDeleteUser,disabled:m}]}return"AddSSO"==this.state.inviteUserMode?(c="Add single sign-on user",d="Add User"):(c="Invite user",d="Send Invite"),o().createElement("div",{className:"profile-wrapper",style:{height:"100%"}},o().createElement("div",{className:"singular-browser-body-tools"},o().createElement("div",{className:"portal-search-wrapper",style:{padding:"10px"}},o().createElement(mn,{mode:"immediate",onSearch:this.onSearchChange})),o().createElement(Mn,{configuration:p})),o().createElement("div",{className:"user-administration-wrapper"},o().createElement("div",{className:"user-list"},t),o().createElement("div",{className:"profile-wrapper"},a)),o().createElement(Qa(),{show:1==this.state.confirmDelete,title:"",text:this.state.confirmDeleteMessage,showCancelButton:!0,onConfirm:function(){e.setState({confirmDelete:!1}),e.actionDeleteUser()},onCancel:function(){e.setState({confirmDelete:!1})},onEscapeKey:function(){e.setState({confirmDelete:!1})},onOutsideClick:function(){e.setState({confirmDelete:!1})}}),o().createElement("div",{id:"inviteUserModal",className:"modal fade u-displaynone singular-modal singular-modal-white ",tabIndex:"-1",role:"dialog"},o().createElement("div",{className:"modal-dialog modal-lg",role:"document"},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-header"},o().createElement("button",{tabIndex:"-1",className:"close","data-dismiss":"modal","aria-label":"Close"},o().createElement("span",{"aria-hidden":"true"},o().createElement("i",{style:{width:"20px",height:"20px",position:"relative"},className:"fa fa-times"}))),o().createElement("h4",{className:"modal-title"},c)),o().createElement("div",{className:"modal-body",style:{borderRadius:"0px"}},o().createElement("table",{style:{width:"70%",margin:"auto"}},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement("span",{className:"lbl"},"Email")),o().createElement("td",null,o().createElement("input",{className:"form-control align-left text-input",type:"email",placeholder:"please enter email",onChange:this.inviteUserEmailChanged,value:this.state.inviteUserEmail}))),o().createElement("tr",null,o().createElement("td",null,o().createElement("span",{className:"lbl"},"First Name")),o().createElement("td",null,o().createElement("input",{className:"form-control align-left text-input",type:"text",placeholder:"",onChange:this.inviteUserFirstNameChanged,value:this.state.inviteUserFirstName}))),o().createElement("tr",null,o().createElement("td",null,o().createElement("span",{className:"lbl"},"Last Name")),o().createElement("td",null,o().createElement("input",{className:"form-control align-left text-input",type:"text",placeholder:"",onChange:this.inviteUserLastNameChanged,value:this.state.inviteUserLastName})))))),o().createElement("div",{className:"modal-footer"},o().createElement("button",{className:"btn btn-primary",onClick:this.actionSendInvite,disabled:!this.state.inviteUserEmailValid},d),o().createElement("button",{className:"btn btn-secondary","data-dismiss":"modal"},"Cancel"))))))}}),Rs=o().createClass({displayName:"AccountRemoval",getInitialState:function(){return{confirmDeleteText:""}},componentWillMount:function(){},componentDidMount:function(){},onTextChange:function(e){this.setState({confirmDeleteText:e})},openDeleteAccountModal:function(){$("#accountRemovalDialog").modal("show")},closeDeleteAccountModal:function(){$("#accountRemovalDialog").modal("hide")},processDeleteAccount:function(){var e=this;this.props.onNotification("Deleting Account","info",5,"tc"),E().series([function(e){S().delete("/apiv1/accounts/"+window.singularUser.account.accountId).set("Content-Type","application/json").end((function(t,a){t?e(t):e(null,"next")}))}],(function(t,a){t?(console.log(t),e.props.onNotification("Error while delete account: "+t,"error",15,"tc")):window.location.href="/users/logout"}))},render:function(){var e=this,t="I am sure"==this.state.confirmDeleteText?"":"disable";return o().createElement("div",{className:"profile-wrapper",style:{height:"100%"}},o().createElement("div",{className:"singular-browser-body"},o().createElement("div",{className:"developer-manager"},o().createElement("div",{className:"details-panel"},o().createElement("div",{className:"details-panel-body text-center"},o().createElement("h1",{style:{color:"#f00"}},"!! WARNING !!"),o().createElement("h2",{style:{color:"#f00",paddingTop:"15px"}},"This will delete all data stored in your account and this operation cannot be undone."),o().createElement("p",{style:{paddingTop:"15px"}},o().createElement("a",{onClick:function(){return e.openDeleteAccountModal()},className:"btn btn-danger",style:{backgroundColor:"red",border:"solid 1px red",color:"white"}},"Delete Account")))))),o().createElement("div",{id:"accountRemovalDialog",className:"modal fade u-displaynone singular-modal-white",tabIndex:"-1",role:"dialog"},o().createElement("div",{className:"vertical-alignment-helper"},o().createElement("div",{className:"modal-dialog vertical-align-center",role:"document"},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-header"},o().createElement("button",{tabIndex:"-1",type:"button",className:"close","data-dismiss":"modal","aria-label":"Close",onClick:this.closeDeleteAccountModal},o().createElement("span",{"aria-hidden":"true"},o().createElement("i",{style:{width:"20px",height:"20px",position:"relative"},className:"fa fa-times"}))),o().createElement("h4",{className:"modal-title",id:"myModalLabel"},"Delete Account")),o().createElement("div",{className:"modal-body",style:{borderRadius:"0px"}},o().createElement("p",{style:{color:"#3E4042"}},'Are you sure you want to delete this account?  Please type "I am sure" into the text box below.'),o().createElement("p",null,o().createElement("input",{type:"text",className:"form-control",value:this.state.confirmDeleteText,onChange:function(t){e.onTextChange(t.target.value)}}))),o().createElement("div",{className:"modal-footer"},o().createElement("button",{tabIndex:"-1",onClick:this.processDeleteAccount,className:"btn btn-primary",disabled:t},"Ok"),o().createElement("button",{tabIndex:"-1",onClick:this.closeDeleteAccountModal,className:"btn btn-secondary"},"Cancel")))))))}});var Ps=a(15236),Ts=a(95093),Ms=a(9769);const Os=o().createClass({displayName:"TimeSeries",getInitialState:function(){return{expand:!1}},componentWillMount:function(){},componentDidMount:function(){},onToggleInfo:function(){this.setState({expand:!this.state.expand})},render:function(){var e,t=this,a=function(e){return Ts(e).format("MMM D")}.bind(this),i=function(e){switch(this.props.chartYFormat){case"number":return Ms.numberWithCommas(e);case"shortnumber":return Ms.shortNumber(e);case"filesize":return Ms.humanFileSize(e);default:return e}}.bind(this),n=function(e){return["",i(e)]}.bind(this),s="fa fa-chevron-up";if(this.state.expand){var l,r;if(s="fa fa-chevron-down",this.props.chartYLimit&&(l=o().createElement(Ps.N1,{type:"monotone",dataKey:this.props.chartYLimit,stroke:"red",animationDuration:500})),this.props.chartSymbol){var c=function(e){return o().createElement("rect",{x:e.cx-12,y:e.cy-6,fill:"rgb(247, 83, 27)",stroke:"darkred",width:"25",height:"12",rx:"3"})};r=this.props.chartData.map((function(e,a){if(e[t.props.chartSymbol])return o().createElement(Ps.rR,{key:a,x:e[t.props.chartXKey],y:0,label:o().createElement(Ps.JU,{value:Ms.shortNumber(e[t.props.chartSymbol]),position:"center",offset:25,fill:"#666",style:{fontSize:"8px"}}),shape:c})}))}e=this.props.busy?o().createElement("div",{className:"chart"},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader",style:{margin:"auto",position:"relative",display:"block",top:"125px"}})):o().createElement("div",{className:"chart"},o().createElement(Ps.uf,{width:"100%",height:"100%"},o().createElement(Ps.bl,{data:this.props.chartData,margin:{top:30}},o().createElement(Ps.WX,{dataKey:this.props.chartXKey,tickFormatter:a,minTickGap:50,padding:{left:30,right:30}}),o().createElement(Ps.h8,{tickFormatter:i,type:"number",allowDecimals:!1,width:100}),o().createElement(Ps.dC,{stroke:"#ccc"}),o().createElement(Ps.N1,{type:"monotone",dataKey:this.props.chartYKey,stroke:"#8884d8",animationDuration:500}),l,r,o().createElement(Ps.m_,{formatter:n,labelFormatter:a,separator:"",cursor:!1}))))}var d=Number(this.props.limit);isNaN(d)&&(d=0);var p,m,u,h,f=Number(this.props.value);if(isNaN(f)&&(f=0),null==this.props.limit||999999==this.props.limit)p=o().createElement("span",null,i(f)," of"," ",o().createElement("span",{className:"infinite-symbol"},"∞")),m=o().createElement("div",{className:"neutral"},o().createElement("div",{className:"ok",style:{width:"0%"}}));else if(p=o().createElement("span",null,i(f)," of ",o().createElement("b",null,i(d))),f>=d){var g=d/f*100;m=o().createElement("div",{className:"over-limit"},o().createElement("div",{className:"ok",style:{width:g+"%"}})),u=d>0?Math.round(f/d*100)+"%":o().createElement("span",null,"∞")}else{var v=0;d>0&&(v=f/d*100,u=Math.round(v)+"%"),m=o().createElement("div",{className:"neutral"},o().createElement("div",{className:"ok",style:{width:v+"%"}}))}return h=this.props.symbolIcon&&this.props.symbolValue?o().createElement("div",{className:"symbol"},o().createElement("span",{style:{float:"right"}},o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"symbol"},this.props.symbolInfo)},o().createElement("i",{className:"symbolIcon "+this.props.symbolIcon})),o().createElement("span",{className:"symbolValue"},Ms.numberWithCommas(this.props.symbolValue)))):o().createElement("div",{className:"symbol"}),o().createElement("div",{className:"timeseries"},o().createElement("div",{className:"header"},o().createElement("div",{className:"title"},this.props.title),o().createElement("div",{className:"info"},p),o().createElement("div",{className:"bar"},m),o().createElement("div",{className:"percent"},u),h,o().createElement("div",{className:"expand"},o().createElement("button",{className:"btn btn-white icon-only v2 pull-right",onClick:this.onToggleInfo,style:{padding:"5px 10px"}},o().createElement("i",{className:s})))),e)}});var Ls=a(9769),Vs="https://api.singular.live/#rate-limits";const Fs=o().createClass({displayName:"UsageSummary",getInitialState:function(){return{expand:!0}},componentWillMount:function(){},componentDidMount:function(){},onToggleInfo:function(){this.setState({expand:!this.state.expand})},generateDataStatus:function(e){if(!e)return{status:"error",shortDescription:"No data available",longDescription:""};var t=window.singularUser.account.subscription,a=0,i=0,n={};e.forEach((function(e){void 0!==e.burst_api_violations&&(a+=e.burst_api_violations),void 0!==e.burst_data_violations&&(i+=e.burst_data_violations),void 0!==e.daily_api_limit&&void 0!==e.daily_api_usage&&e.daily_api_limit0&&o().createElement("span",null,Ls.numberWithCommas(a)," REST API call burst violations",o().createElement("br",null)),i>0&&o().createElement("span",null,Ls.numberWithCommas(i)," REST API data burst violations",o().createElement("br",null)),n.dailyApi&&o().createElement("span",null,"Daily REST API call limit exceeded",o().createElement("br",null)),n.dailyData&&o().createElement("span",null,"Daily REST API data limit exceeded",o().createElement("br",null)),n.dailySdkApi&&o().createElement("span",null,"Daily App SDK call limit exceeded",o().createElement("br",null)),n.dailySdkData&&o().createElement("span",null,"Daily App SDK data limit exceeded",o().createElement("br",null))))}return{status:r,shortDescription:c,longDescription:s}},render:function(){var e,t,a,i,n="fa fa-chevron-up";if(this.state.expand&&(n="fa fa-chevron-down"),this.props.busy)a=o().createElement("img",{src:"/images/loading-bubbles-blue.svg",style:{margin:"-10px"}});else{var s=this.generateDataStatus(this.props.data);switch(t=s.shortDescription,e=this.state.expand?s.longDescription:o().createElement("div",null),s.status){case"warning":a=o().createElement("i",{className:"fa fa-exclamation-triangle",style:{color:"#ffa500"}});break;case"error":a=o().createElement("i",{className:"fa fa-exclamation-triangle",style:{color:"#ff9800"}});break;case"ok":case"default":a=o().createElement("i",{className:"fa fa-check-circle",style:{color:"#08a708"}})}}return e&&(i=o().createElement("button",{className:"btn btn-white icon-only v2 pull-right",onClick:this.onToggleInfo,style:{padding:"5px 10px"}},o().createElement("i",{className:n}))),o().createElement("div",{className:"usage-summary",style:{borderBottom:"1px solid lightgrey",paddingBottom:"15px"}},o().createElement("div",{className:"header"},o().createElement("div",{className:"title"},"Usage Status"),o().createElement("div",{className:"icon"},a),o().createElement("div",{className:"info"},t),o().createElement("div",{className:"expand"},i)),e)}});var _s=a(79841);const Bs=o().createClass({displayName:"AccountStatus",getInitialState:function(){return this.fetchAccountStatusHandler,{accountStatusBusy:!1,accountStatusData:null,dateRange:"last30Days"}},componentWillMount:function(){this.fetchAccountStatus(this.state.dateRange)},fetchAccountStatus:function(e){var t=this;this.setState({accountStatusBusy:!0,accountStatusData:null}),this.fetchAccountStatusHandler&&this.fetchAccountStatusHandler.abort();var a=this.getDateRangeProperties(e),i={begin:a.begin,end:a.end,step:a.step,stepText:a.stepText};this.fetchAccountStatusHandler=S().post("/apiv1/subscription/usage",i).end((function(e,a){if(t.fetchAccountStatusHandler=null,e)t.setState({accountStatusBusy:!1}),t.props.onNotification&&t.props.onNotification("Failed to fetch account usage stats","error",5,"tc"),t.setState({accountStatusBusy:!1,accountStatusData:null});else{var i=window.singularUser.account.subscription;a.body.forEach((function(e){ge()(e.date).isSame(ge()(),"day")&&(e.burst_api_limit=i.burst_api_limit,e.burst_api_violations=i.burst_api_violations,e.burst_data_limit=i.burst_data_limit,e.burst_data_violations=i.burst_data_violations,e.daily_api_limit=i.daily_api_limit,e.daily_api_usage=i.daily_api_usage,e.daily_data_limit=i.daily_data_limit,e.daily_data_usage=i.daily_data_usage,e.sdk_daily_api_usage=i.sdk_daily_api_usage,e.sdk_daily_data_usage=i.sdk_daily_data_usage,e.storage_limit=i.storage_limit,e.storage_usage=i.storage_usage,e.user_limit=i.user_limit,e.user_usage=i.user_usage,e.weboutput_limit=i.weboutput_limit,e.weboutput_usage=i.weboutput_usage),e.daily_api_limit||(e.daily_api_limit=i.daily_api_limit),e.daily_data_limit||(e.daily_data_limit=i.daily_data_limit),e.weboutput_limit>999&&(e.weboutput_limit=void 0),e.user_limit>999&&(e.user_limit=void 0)})),t.setState({accountStatusBusy:!1,accountStatusData:a.body})}}))},componentWillUnmount:function(){this.fetchAccountStatusHandler&&this.fetchAccountStatusHandler.abort()},selectDropdown:function(e){this.setState({dateRange:e}),this.fetchAccountStatus(e)},getDateRangeProperties:function(e){var t="Singular Usage Stats - ";switch(e){case"thisMonth":return{name:"This Month",begin:ge()().utc().startOf("month").format("YYYY-MM-DDTHH:mm:ss.000Z"),end:ge()().utc().endOf("month").format("YYYY-MM-DDTHH:mm:ss.000Z"),step:86400,stepText:"day",filename:t+ge()().utc().startOf("month").format("YYYY-MM")+" daily"};case"previousMonth":return{name:"Previous Month",begin:ge()().utc().subtract(1,"months").startOf("month").format("YYYY-MM-DDTHH:mm:ss.000Z"),end:ge()().utc().subtract(1,"months").endOf("month").format("YYYY-MM-DDTHH:mm:ss.000Z"),step:86400,stepText:"day",filename:t+ge()().utc().subtract(1,"months").format("YYYY-MM")+" daily"};case"thisYear":return{name:"This Year",begin:ge()().utc().startOf("year").format("YYYY-MM-DDTHH:mm:ss.000Z"),end:ge()().utc().endOf("year").format("YYYY-MM-DDTHH:mm:ss.000Z"),step:86400,stepText:"day",filename:t+ge()().utc().startOf("year").format("YYYY")+" weekly"};case"previousYear":return{name:"Previous Year",begin:ge()().utc().subtract(1,"years").startOf("year").format("YYYY-MM-DDTHH:mm:ss.000Z"),end:ge()().utc().subtract(1,"years").endOf("year").format("YYYY-MM-DDTHH:mm:ss.000Z"),step:604800,stepText:"week",filename:t+ge()().utc().subtract(1,"years").startOf("year").format("YYYY")+" weekly"};case"last52Weeks":return{name:"Last 52 Weeks",begin:ge()().utc().subtract(1,"years").startOf("day").format("YYYY-MM-DDTHH:mm:ss.000Z"),end:ge()().utc().endOf("day").format("YYYY-MM-DDTHH:mm:ss.000Z"),step:604800,stepText:"week",filename:t+ge()().utc().subtract(1,"years").format("YYYY-MM-DD")+" until "+ge()().utc().format("YYYY-MM-DD")+" weekly"};default:return{name:"Last 30 Days",begin:ge()().utc().subtract(1,"months").startOf("day").format("YYYY-MM-DDTHH:mm:ss.000Z"),end:ge()().utc().endOf("day").format("YYYY-MM-DDTHH:mm:ss.000Z"),step:86400,stepText:"day",filename:t+ge()().utc().subtract(1,"months").format("YYYY-MM-DD")+" until "+ge()().utc().format("YYYY-MM-DD")+" daily"}}},render:function(){var e=this.getDateRangeProperties(this.state.dateRange),t=window.singularUser.account.subscription;return o().createElement("div",{className:"developer-manager",style:{height:"calc(100% - 9px)"}},o().createElement("div",{className:"details-panel",style:{height:"100%",display:"flex",flexDirection:"column",maxWidth:"70%"}},o().createElement("div",{className:"details-panel-header"},o().createElement("span",null,"Usage stats and history"),o().createElement("div",{className:"dropdown dropdown-white",style:{marginLeft:"auto"}},o().createElement("button",{tabIndex:"-1",className:"btn btn-white dropdown-toggle","data-toggle":"dropdown","aria-expanded":"false",style:{width:"150px"}},e.name),o().createElement("ul",{className:"dropdown-menu"},o().createElement("li",null,o().createElement("a",{className:"dropdown-item",onClick:this.selectDropdown.bind(this,"last30Days")},this.getDateRangeProperties("last30Days").name)),o().createElement("li",null,o().createElement("a",{className:"dropdown-item",onClick:this.selectDropdown.bind(this,"thisMonth")},this.getDateRangeProperties("thisMonth").name)),o().createElement("li",null,o().createElement("a",{className:"dropdown-item",onClick:this.selectDropdown.bind(this,"previousMonth")},this.getDateRangeProperties("previousMonth").name)),o().createElement("li",null,o().createElement("a",{className:"dropdown-item",onClick:this.selectDropdown.bind(this,"last52Weeks")},this.getDateRangeProperties("last52Weeks").name)),o().createElement("li",null,o().createElement("a",{className:"dropdown-item",onClick:this.selectDropdown.bind(this,"thisYear")},this.getDateRangeProperties("thisYear").name)),o().createElement("li",null,o().createElement("a",{className:"dropdown-item",onClick:this.selectDropdown.bind(this,"previousYear")},this.getDateRangeProperties("previousYear").name)))),o().createElement(_s.A,{className:"btn btn-white",data:this.state.accountStatusData,filename:e.filename+".csv",tabIndex:"-1",disabled:this.state.accountStatusBusy,style:{marginLeft:"10px",width:"100px"}},"Export")),o().createElement("div",{className:"details-panel-body",style:{overflow:"scroll",height:"calc(100% - 35px)",padding:"5px 0px 10px 5px"}},o().createElement("div",{className:"account-status"},o().createElement(Fs,{data:this.state.accountStatusData,busy:this.state.accountStatusBusy}),o().createElement(Os,{title:"Users",limit:t.user_limit,value:t.user_usage,chartData:this.state.accountStatusData,chartXKey:"date",chartYKey:"user_usage",chartYLimit:"user_limit",chartYFormat:"number",busy:this.state.accountStatusBusy}),o().createElement("span",{className:"divider"}),o().createElement(Os,{title:"Outputs",limit:t.weboutput_limit,value:t.weboutput_usage,chartData:this.state.accountStatusData,chartXKey:"date",chartYKey:"weboutput_usage",chartYLimit:"weboutput_limit",chartYFormat:"number",busy:this.state.accountStatusBusy}),o().createElement("span",{className:"divider"}),o().createElement(Os,{title:"Storage",limit:t.storage_limit,value:t.storage_usage,chartData:this.state.accountStatusData,chartXKey:"date",chartYKey:"storage_usage",chartYLimit:"storage_limit",chartYFormat:"filesize",busy:this.state.accountStatusBusy}),o().createElement("span",{className:"divider"}),o().createElement(Os,{title:"REST API calls",limit:t.daily_api_limit,value:t.daily_api_usage,chartData:this.state.accountStatusData,chartXKey:"date",chartYKey:"daily_api_usage",chartYLimit:"daily_api_limit",chartYFormat:"shortnumber",chartSymbol:"burst_api_violations",symbolIcon:"fa fa-warning",symbolInfo:"REST API call burst violations today",symbolValue:t.burst_api_violations,busy:this.state.accountStatusBusy}),o().createElement("span",{className:"divider"}),o().createElement(Os,{title:"REST API data",limit:t.daily_data_limit,value:t.daily_data_usage,chartData:this.state.accountStatusData,chartXKey:"date",chartYKey:"daily_data_usage",chartYLimit:"daily_data_limit",chartYFormat:"filesize",chartSymbol:"burst_data_violations",symbolIcon:"fa fa-warning",symbolInfo:"REST API data burst violations today",symbolValue:t.burst_data_violations,busy:this.state.accountStatusBusy}),o().createElement("span",{className:"divider"}),o().createElement(Os,{title:"App SDK calls",limit:t.daily_api_limit,value:t.sdk_daily_api_usage,chartData:this.state.accountStatusData,chartXKey:"date",chartYKey:"sdk_daily_api_usage",chartYLimit:"daily_api_limit",chartYFormat:"shortnumber",busy:this.state.accountStatusBusy}),o().createElement("span",{className:"divider"}),o().createElement(Os,{title:"App SDK data",limit:t.daily_data_limit,value:t.sdk_daily_data_usage,chartData:this.state.accountStatusData,chartXKey:"date",chartYKey:"sdk_daily_data_usage",chartYLimit:"daily_data_limit",chartYFormat:"filesize",busy:this.state.accountStatusBusy})))))}});var Us=a(72672),Ws=a.n(Us);const Ys=o().createClass({displayName:"About",getInitialState:function(){return{showBusyIcon:!1}},componentDidMount:function(){this.loadAboutData()},loadAboutData:function(){this.setState({showBusyIcon:!0}),S().get("/apiv1/users/me").set("Content-Type","application/json").end(function(e,t){if(e)console.log("error while reading user profile: "+e),this.setState({showBusyIcon:!1});else{if(t.headers.location)return void(window.location=t.headers.location);this.setState({showBusyIcon:!1})}}.bind(this))},render:function(){var e,t;return 1==this.state.showBusyIcon?e=o().createElement("div",{className:"loader-wrapper"},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"})):(e=o().createElement("div",{className:"details-panel"},o().createElement("div",{className:"details-panel-header"},"Account and User Information"),o().createElement("div",{className:"details-panel-body"},o().createElement("table",{className:"details-table"},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Account Name"),o().createElement("div",{style:{fontWeight:"300"}},window.singularUser.account.accountName))),o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Account ID"),o().createElement("div",{style:{fontWeight:"300"}},window.singularUser.account.accountId)))),o().createElement("tr",null,o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"User Name"),o().createElement("div",{style:{fontWeight:"300"}},window.singularUser.email))),o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"User ID"),o().createElement("div",{style:{fontWeight:"300"}},window.singularUser.id)))))))),t=o().createElement("div",{className:"details-panel"},o().createElement("div",{className:"details-panel-header"},"Singular Server Info"),o().createElement("div",{className:"details-panel-body"},o().createElement("table",{className:"details-table"},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Version"),o().createElement("div",{style:{fontWeight:"300"}},Ws().longNameVersion))),o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Build Number"),o().createElement("div",{style:{fontWeight:"300"}},Ws().gitRev)))),o().createElement("tr",null,o().createElement("td",null,o().createElement("div",null,o().createElement("div",{className:"detail-label"},"Build Date"),o().createElement("div",{style:{fontWeight:"300"}},ge()(Ws().buildDate).format("YYYY-MM-DD HH:mm:ss")))),o().createElement("td",null," "))))))),o().createElement("div",{className:"profile-wrapper"},o().createElement("div",{className:"developer-manager",style:{height:"calc(100% - 75px)",overflow:"auto"}},e,t))}}),js=o().createClass({displayName:"Billing",getInitialState:function(){return{invoices:[],busy:!0}},componentDidMount:function(){S().get("/paymentapi/listinvoices?limit=500").set("Accept","application/json").end(function(e,t){e||this.setState({invoices:t.body.data,busy:!1})}.bind(this))},downloadReceipt:function(e){window.open(e)},openReceipt:function(e){window.open(e)},render:function(){return this.state.busy?o().createElement("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center"}},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",style:{left:"50%",top:"40%",position:"absolute"}})):(e=0!=this.state.invoices.length||this.state.busy?this.state.invoices.map(function(e,t){var a="not paid";e.status_transitions&&e.status_transitions.paid_at&&(a=ge()(1e3*e.status_transitions.paid_at).format("YYYY-MM-DD HH:mm:ss"));var i="Unknown product",n=null,s=null;e.lines.data.length>0?(n=e.lines.data[0].period.start,s=e.lines.data[0].period.end):e.period_start&&e.period_end&&(n=e.period_start,s=e.period_end),n&&s&&(i="Subscription fee from "+ge()(1e3*n).format("YYYY-MM-DD")+" until "+ge()(1e3*s).format("YYYY-MM-DD"));var l=o().createElement("i",{className:"error fa fa-exclamation-circle"});e.paid&&(l=o().createElement("i",{className:"ok fa fa-check-circle"}));var r,c,d=(Number(e.amount_paid)/100).toFixed(2)+" "+e.currency.toUpperCase();return e.hosted_invoice_url&&(r=o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"OpenInvoice"},"Open invoice")},o().createElement("button",{tabIndex:"-1",onClick:this.openReceipt.bind(this,e.hosted_invoice_url)},o().createElement("i",{className:"fa fa-external-link"})))),e.invoice_pdf&&(c=o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"DownloadInvoice"},"Download invoice pdf")},o().createElement("button",{tabIndex:"-1",onClick:this.downloadReceipt.bind(this,e.invoice_pdf)},o().createElement("i",{className:"fa fa fa-file-pdf-o"})))),o().createElement("div",{className:"billing-item",key:t},o().createElement("div",{className:"panel panel-default"},o().createElement("div",{className:"panel-body"},o().createElement("div",{className:"header"},o().createElement("div",{className:"status"},l),o().createElement("div",{className:"description"},i),o().createElement("div",{className:"links"},r,c)),o().createElement("div",{className:"tables"},o().createElement("div",{className:"id"},o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,"Transaction ID"),o().createElement("td",null,e.id)),o().createElement("tr",null,o().createElement("td",null,"Transaction Date"),o().createElement("td",null,a))))),o().createElement("div",{className:"amount"},o().createElement("table",null,o().createElement("tbody",null,o().createElement("tr",{style:{fontWeight:"bold"}},o().createElement("td",null,"Amount Paid"),o().createElement("td",{style:{textAlign:"right"}},d)))))))))}.bind(this)):o().createElement("div",{style:{padding:"50px",textAlign:"center",fontSize:"20px"}},"Billing history is empty"),o().createElement("div",{className:"billing-wrapper"},o().createElement("div",{className:"billing-list"},e)));var e}});var Hs=a(40927),zs=a(15734),Gs=a(9769),$s=a(82445);const Ks=Hs.createClass({displayName:"Subscription",getInitialState:function(){var e=new URLSearchParams(window.location.search),t=!1;e.has("checkPaymentStatus")&&e.get("checkPaymentStatus")&&(t=!0);var a=!1;return e.has("showSubscriptionInfo")&&e.get("showSubscriptionInfo")&&(a=!0),this.paymentTimeoutHandler=null,this.paymentStatusHandler=null,this.checkPaymentStatusAttempt=5,{errorMessage:null,showLoading:!1,startupBusy:!0,checkPaymentStatus:t,showSubscriptionInfo:a}},componentDidMount:function(){var e=this;this.state.checkPaymentStatus&&(this.paymentTimeoutHandler=setInterval((function(){e.paymentStatusHandler&&e.paymentStatusHandler.abort(),e.paymentStatusHandler=zs.get("/apiv1/accounts/payment").end((function(t,a){e.paymentStatusHandler=null,t&&e.setState({errorMessage:"Cannot connect to subscription server"}),(t||a.body&&!a.body.payment_status||e.checkPaymentStatusAttempt--<=0)&&(clearInterval(e.paymentTimeoutHandler),window.location.href="/users/settings/subscription?showSubscriptionInfo=true")}))}),2e3)),this.getSubscription()},componentWillUnmount:function(){this.paymentTimeoutHandler&&clearInterval(this.paymentTimeoutHandler),this.paymentStatusHandler&&this.paymentStatusHandler.abort()},getSubscription:function(){var e=this;zs.get("/paymentapi/subscription").end((function(t,a){if(t)e.setState({errorMessage:"Cannot fetch subscription",showLoading:!1});else{var i=a.body.price;null==i&&(i=a.body.prices.sort((function(e,t){return(e.price>t.price)-.5}))[0]),e.setState({startupBusy:!1,paymentInfo:a.body,selectedPrice:i,selectedPlan:a.body.selection})}}))},onContactUs:function(e){var t=this;this.setState({showLoading:!0});var a=e.plan;zs.post("/paymentapi/contactus").send({planId:a}).end((function(e,a){e?t.setState({errorMessage:"Failed to send message"}):t.setState({errorMessage:"Your request was successfully submitted"}),t.setState({showLoading:!1})}))},onCancel:function(){var e=this,t={cancelAt:"endPeriod",subscription:this.state.paymentInfo.subscription};this.setState({showLoading:!0},(function(a){return zs.post("/paymentapi/cancelPlan").send(t).set("Accept","application/json").end((function(t,a){t?e.setState({errorMessage:"Failed to cancel subscription",showLoading:!1}):location.reload()}))}))},onCheckout:function(){var e=this;this.setState({showLoading:!0});var t="/paymentapi/session/?id="+this.state.selectedPrice.id;this.state.coupon&&(t+="&coupon="+this.state.coupon.id),zs.get(t).end((function(t,a){t?e.setState({errorMessage:a.body.message,showLoading:!1}):Stripe(window.stripePK).redirectToCheckout({sessionId:a.body.id})}))},onSelectSubscription:function(e){this.setState({selectedPlan:e.currentTarget.dataset.value})},onSelectPrice:function(e){var t=e.currentTarget.dataset.value,a=this.state.paymentInfo.prices.filter((function(e){return e.id==t}));this.setState({selectedPrice:a[0]})},onSelectCoupon:function(e){this.setState({coupon:e})},render:function(){var e=this;if(this.state.errorMessage)return Hs.createElement("div",null,Hs.createElement(Qa(),{show:null!=this.state.errorMessage,title:"",text:this.state.errorMessage,onConfirm:function(){e.setState({errorMessage:void 0,showLoading:!1})},onCancel:function(){e.setState({errorMessage:void 0,showLoading:!1})},onEscapeKey:function(){e.setState({errorMessage:void 0,showLoading:!1})},onOutsideClick:function(){e.setState({errorMessage:void 0,showLoading:!1})}}));if(this.state.showLoading&&!this.state.errorMessage||null==this.state.paymentInfo)return Hs.createElement("div",{className:"singularLoader"},Hs.createElement("img",{src:"/images/loading-bubbles-blue.svg"}));if(this.state.checkPaymentStatus)return Hs.createElement("div",{className:"singularLoader"},"Waiting for payment system",Hs.createElement("img",{src:"/images/loading-bubbles-blue.svg"}));var t,a,i,n,s,o=function(){if(e.state.startupBusy)return Hs.createElement("div",{style:{height:"21px"}},Hs.createElement("img",{src:"/images/loading-bubbles-blue.svg",style:{margin:"auto",display:"block"}}));var t,a,i,n=e.state.paymentInfo.canceled?" (canceled)":"",s=e.state.paymentInfo.selection,o=$s.SubscriptionPlans.filter((function(e){return e.id==s}))[0].title+n,l=e.state.paymentInfo.activeUntil?new Date(e.state.paymentInfo.activeUntil):null;if(l){var r,c=ge()(l).diff(ge()());r=e.state.paymentInfo.canceled&&"professional"==e.state.paymentInfo.subscription?"Renews on ":"Expires on ",t=c<-72e5?Hs.createElement("p",{style:{color:"red",whiteSpace:"pre"}},r+ge()(l).format("YYYY-MM-DD HH:mm:ss")+" "+Gs.millisecondsToString(-c,"short")+" ago"):Hs.createElement("p",null,r+ge()(l).format("YYYY-MM-DD HH:mm:ss"))}return"PAYMENT_FAILED"==e.state.paymentInfo.paymentStatus&&(e.state.paymentInfo.charge_failed&&(i=" on "+ge()(e.state.paymentInfo.charge_failed).format("YYYY-MM-DD HH:mm:ss")),a=Hs.createElement("span",{style:{color:"red",paddingLeft:"20px"}},"Payment failed ",i)),Hs.createElement("div",{style:{height:"21px"}},Hs.createElement("span",null,Hs.createElement("b",null,o)),a,Hs.createElement("span",{style:{float:"right"}},t))}(),l=(a=e.state.selectedPrice&&e.state.selectedPrice.id,i=e.state.selectedPrice?e.state.selectedPrice.price:0,n=Hs.createElement("button",{className:"btn btn-primary",style:{width:"180px",marginRight:"30px"},onClick:e.onCheckout},"Subscribe"),e.state.paymentInfo.subscription&&"PAYMENT_FAILED"!==e.state.paymentInfo.paymentStatus&&(n=Hs.createElement("button",{className:"btn btn-white",style:{width:"180px",margin:"0px 30px 0px 0px"},onClick:e.onCancel},"Downgrade to Free Account"),t=Hs.createElement("div",{style:{display:"flex",alignItems:"center"}},Hs.createElement("button",{className:"btn btn-primary",style:{width:"180px",margin:"0px"},onClick:function(){e.setState({showLoading:!0}),zs.post("/paymentapi/create-customer-portal-session").end((function(t,a){t?e.setState({errorMessage:"Cannot connect to Customer Portal"}):window.open(a.body.url),e.setState({showLoading:!1})}))}},"Open Payment Portal"),Hs.createElement("span",{style:{paddingLeft:"10px",color:"#b3b3b3"}},"Update payment method and billing information here")),1==e.state.paymentInfo.canceled&&(n=null)),Hs.createElement("div",null,Hs.createElement("div",{className:"payment-info-offset"}),Hs.createElement("div",{style:{display:"flex"}},Hs.createElement("div",{className:"singular-container-list",style:{width:"50%"}},e.state.paymentInfo.prices.sort((function(e,t){return(e.price>t.price)-.5})).map((function(t,i){var n=a==t.id?"radio-button-icon selected":"radio-button-icon",s=null!=e.state.paymentInfo.subscription,o=s?"singular-container-list-item-disabled":"singular-container-list-item",l=s?function(e){return null}:e.onSelectPrice;return Hs.createElement("div",{className:o,key:i,"data-value":t.id,onClick:l,style:{paddingTop:"5px",paddingBottom:"5px"}},Hs.createElement("div",{className:n}),Hs.createElement("div",{style:{margin:"0px 10px"}},"$"+t.price+" / "+t.nickname))}))),Hs.createElement("div",{style:{width:"50%",alignSelf:"flex-end"}})),function(){var t,a;if(e.state.coupon){var n,s=e.state.coupon.percentOff,o=e.state.coupon.amountOff,l=0;s?(l=i*parseFloat(s)/100,n=Hs.createElement("div",{className:"order-item"},"Discount (",s,"%)")):(o&&(l=parseFloat(o)),n=Hs.createElement("div",{className:"order-item"},"Discount")),a=Hs.createElement("div",{className:"order-list-item discount"},n,Hs.createElement("div",{className:"order-item-total"},"-$",l.toLocaleString())),t=i-l}else t=i;return Hs.createElement("div",{className:"order-list",style:{paddingTop:"0px"}},Hs.createElement("div",{className:"order-list-item price"},Hs.createElement("div",{className:"order-item"},"Price"),Hs.createElement("div",{className:"order-item-price"},"$",i.toLocaleString())),a,Hs.createElement("div",{className:"order-list-item total"},Hs.createElement("div",{className:"order-item"},"Total"),Hs.createElement("div",{className:"order-item-total"},"$",t.toLocaleString())))}(),Hs.createElement("div",{style:{position:"relative",top:"-24px",left:"22px",display:"flex"}},n,t))),r=function(t){return t==e.state.paymentInfo.selection?void 0:Hs.createElement("div",{style:{position:"relative",paddingLeft:"24px",top:"-24px"}},Hs.createElement("div",{style:{borderTop:"1px solid #929292",marginRight:"24px",marginBottom:"15px"}}),Hs.createElement("button",{className:"btn btn-primary",style:{width:"120px"},onClick:e.onContactUs.bind(e,{plan:t})},"Apply"))},c="nonprofit"!=e.state.paymentInfo.selection&&Hs.createElement("div",{style:{position:"relative",paddingLeft:"24px",top:"-24px",marginTop:"18px"}},Hs.createElement("div",{style:{borderTop:"1px solid #929292",marginRight:"24px",marginBottom:"15px"}}),Hs.createElement("button",{className:"btn btn-primary",style:{width:"120px"},onClick:function(e){window.location.href="https://www.singular.live/schools"}},"Apply as a School"),Hs.createElement("button",{className:"btn btn-primary",style:{width:"120px",marginLeft:"20px"},onClick:function(e){window.location.href="https://www.singular.live/nonprofits"}},"Apply as a Nonprofit")),d=(s=function(e,t,a,i){return Hs.createElement("div",{className:"details-panel",style:{marginBottom:"10px"}},Hs.createElement("div",{className:"details-panel-header"},e),Hs.createElement("div",{className:"details-panel-body"},Hs.createElement("div",{className:"section-caption"},t),a?Hs.createElement("p",null,a):null),i)},function(e){var t=function(e){return e.map((function(e,t){return Hs.createElement("li",{key:t},e)}))};switch(e){case"free":return s("Free Account",t(["Watermark","1 User","100 MB storage","Support Portal"]));case"professional":return s("Professional Account",t(["No Watermark","1 Output","2 Users","1 GB storage","Support Portal","Up to 3 Custom Fonts"]),null,l);case"enterprise":return s("Enterprise Account",null,"Enterprise accounts are designed for users with bespoke requirements such as dedicated support, or a larger number of outputs or users. In addition, Enterprise accounts allow for unlimited custom fonts as well advanced features like client-side/on device rendering, interactivity and more.",r("enterprise"));case"nonprofit":return s("Schools and Nonprofit Account",t(["Non-commercial use","No Watermark","1 Output","1 GB storage"]),null,c);case"event":return s("Event",null,"An Event subscription is intended for use on a specific event over a pre-defined time period where a monthly account is not suitable. The number of users, outputs and other account limits are bespoke and defined as part of the Event account agreement.",r("event"));case"trial":return s("Trial",null,"A Enterprise Trial subscription provides access to the full advanced functionality of a Singular Enterprise License for a limited time. The number of users, outputs and other account limits are bespoke and defined as part of the trial.",r("trial"));default:return null}}(e.state.selectedPlan));return Hs.createElement("div",{className:"subscription-manager-wrapper"},Hs.createElement("div",{className:"developer-manager",style:{overflowX:"hidden",overfloY:"auto",height:"100%",width:"910px",margin:"auto"}},Hs.createElement("div",{className:"details-panel"},Hs.createElement("div",{className:"details-panel-header"},"Your current subscription"),Hs.createElement("div",{className:"details-panel-body"},o)),Hs.createElement("div",{className:"details-panel"},Hs.createElement("div",{className:"details-panel-header"},"Select your subscription"),Hs.createElement("div",{className:"details-panel-body",style:{padding:"5px 0px"}},$s.SubscriptionPlans.map((function(t,a){if(!e.state.startupBusy&&"unoplus"!=t.id&&"unoelite"!=t.id&&"event-3days"!=t.id&&"event-7days"!=t.id&&"event-30days"!=t.id&&("nonprofit"!=t.id||"nonprofit"==e.state.paymentInfo.selection)){var i=e.state.selectedPlan==t.id?"radio-button-icon selected":"radio-button-icon",n="nonprofit"==e.state.paymentInfo.selection||"enterprise"==e.state.paymentInfo.selection||"event"==e.state.paymentInfo.selection;"professional"==e.state.paymentInfo.selection&&"free"==t.id&&(n=!0),"professional"==e.state.paymentInfo.selection&&null==e.state.paymentInfo.subscription&&(n=!0),"unoplus"!=e.state.paymentInfo.selection&&"unoelite"!=e.state.paymentInfo.selection||(n=!0);var s=n?"singular-container-list-item-disabled":"singular-container-list-item";return Hs.createElement("div",{className:s,key:a,"data-value":t.id,onClick:n?function(e){return null}:e.onSelectSubscription,style:{paddingTop:"5px",paddingBottom:"5px"}},Hs.createElement("div",{className:i}),Hs.createElement("div",{style:{margin:"0px 10px"}},t.title))}})))),d),Hs.createElement(Qa(),{show:this.state.showSubscriptionInfo,title:"Subscription successful",text:"Please re-open or refresh any output URLs that were open before you upgraded your subscription to remove the watermark.",onConfirm:function(){e.setState({showSubscriptionInfo:!1})},onCancel:function(){e.setState({showSubscriptionInfo:!1})},onEscapeKey:function(){e.setState({showSubscriptionInfo:!1})},onOutsideClick:function(){e.setState({showSubscriptionInfo:!1})}}))}});var qs=a(9769);const Js=o().createClass({displayName:"StorageInfo",getInitialState:function(){return this.fetchStorageHandler=null,{assetStorageBusy:!1,assetStorageData:null}},componentDidMount:function(){this.fetchStorage(this.props.accountId)},componentWillUnmount:function(){this.fetchStorageHandler&&this.fetchStorageHandler.abort()},componentWillReceiveProps:function(e){e.account&&this.props.accountId!=e.accountId&&this.fetchStorage(e.accountId)},fetchStorage:function(e){var t=this;void 0!==e&&(this.setState({assetStorageBusy:!0,assetStorageData:null}),this.fetchStorageHandler&&this.fetchStorageHandler.abort(),this.fetchStorageHandler=S().get("/apiv1/status/getCurrentSize?account="+e).end((function(e,a){t.fetchStorageHandler=null,e?(t.setState({assetStorageBusy:!1}),t.props.onNotification&&t.props.onNotification("Cannot Fetch Account Storage Information","error",5,"tc")):t.setState({assetStorageBusy:!1,assetStorageData:a.body})})))},render:function(){return null==this.props.accountId?null:(this.state.assetStorageBusy?e=o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader",style:{width:"50px",height:"40px",margin:"auto",display:"block"}}):(t=this.state.assetStorageData?this.state.assetStorageData:{images:{count:0,size:0},audios:{count:0,size:0},jsons:{count:0,size:0},revisions:{count:0,size:0},compositions:{count:0,size:0},controlapps:{count:0,size:0},total:{count:0,size:0}},e=o().createElement("table",null,o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",null),o().createElement("th",null,"File Size"),o().createElement("th",null,"# items"),o().createElement("th",null))),o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,"Control App"),o().createElement("td",null,qs.humanFileSize(t.controlapps.size)),o().createElement("td",null,qs.numberWithCommas(t.controlapps.count)),o().createElement("td",null)),o().createElement("tr",null,o().createElement("td",null,"Composition"),o().createElement("td",null,qs.humanFileSize(t.compositions.size)),o().createElement("td",null,qs.numberWithCommas(t.compositions.count)),o().createElement("td",null)),o().createElement("tr",null,o().createElement("td",null,"Revision"),o().createElement("td",null,qs.humanFileSize(t.revisions.size)),o().createElement("td",null,qs.numberWithCommas(t.revisions.count)),o().createElement("td",null)),o().createElement("tr",null,o().createElement("td",null,"Image"),o().createElement("td",null,qs.humanFileSize(t.images.size)),o().createElement("td",null,qs.numberWithCommas(t.images.count)),o().createElement("td",null)),o().createElement("tr",null,o().createElement("td",null,"Audio"),o().createElement("td",null,qs.humanFileSize(t.audios.size)),o().createElement("td",null,qs.numberWithCommas(t.audios.count)),o().createElement("td",null)),o().createElement("tr",null,o().createElement("td",null,"JSON"),o().createElement("td",null,qs.humanFileSize(t.jsons.size)),o().createElement("td",null,qs.numberWithCommas(t.jsons.count)),o().createElement("td",null)),o().createElement("tr",null,o().createElement("td",null,o().createElement("b",null,"Total")),o().createElement("td",null,o().createElement("b",null,qs.humanFileSize(t.total.size))),o().createElement("td",null,o().createElement("b",null,qs.numberWithCommas(t.total.count))),o().createElement("td",null))))),o().createElement("div",{className:"group-body storage-info-wrapper"},e));var e,t}}),Xs=o().createClass({displayName:"AccountStorage",getInitialState:function(){return{}},componentWillMount:function(){},componentDidMount:function(){},render:function(){return o().createElement("div",{className:"developer-manager"},o().createElement("div",{className:"details-panel"},o().createElement("div",{className:"details-panel-header"},"Storage Stats"),o().createElement("div",{className:"details-panel-body"},o().createElement(Js,{accountId:window.singularUser.account.accountId}))))}});a(95093);var Zs=a(9769),Qs=a(62418);const eo=o().createClass({displayName:"AccountAuditLogInfoDialog",getInitialState:function(){return{}},componentWillMount:function(){},componentDidMount:function(){},shouldComponentUpdate:function(e,t){return!Zs.compareObject(e,this.props)||!Zs.compareObject(t,this.state)},componentWillReceiveProps:function(e){},componentWillUnmount:function(){},open:function(){this.refs.AuditLogEventDialog&&$(this.refs.AuditLogEventDialog).modal("show")},close:function(){this.refs.AuditLogEventDialog&&$(this.refs.AuditLogEventDialog).modal("hide")},onCopyClipboard:function(e){this.props.onNotification&&this.props.onNotification(e+" copied to clipboard","success",5,"tc")},render:function(){var e=this.props.logEvent,t="Audit Log Event";e&&e.id&&(t+=" - "+e.id);var a={};if(e){a=JSON.stringify(e);try{var i=JSON.parse(a);a=Qs.js(JSON.stringify(i),{indent_size:2,indent_char:" ",max_preserve_newlines:"5",preserve_newlines:!0,keep_array_indentation:!1,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1})}catch(e){}}return o().createElement("div",{id:"auditLogEvent",className:"modal fade u-displaynone singular-modal singular-modal-white",tabIndex:"-1",role:"dialog",ref:"AuditLogEventDialog"},o().createElement("div",{className:"modal-dialog modal-lg",role:"document",style:{width:"50%"}},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-header"},o().createElement("button",{tabIndex:"-1",type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},o().createElement("span",{"aria-hidden":"true"},o().createElement("i",{style:{width:"20px",height:"20px",position:"relative"},className:"fa fa-times"}))),o().createElement("h4",{className:"modal-title",id:"myModalLabel"},t),o().createElement(fn.A,{text:a,options:{format:"text/plain"},onCopy:this.onCopyClipboard.bind(this,"Audit Log Event")},o().createElement("button",{className:"tool-button",style:{position:"absolute",right:"50px",top:"17px"}},o().createElement("i",{className:"fa fa-clipboard"})))),o().createElement("div",{className:"modal-body"},o().createElement("div",null,o().createElement("table",{style:{width:"100%"}},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",{style:{width:"100%"}}))),o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,o().createElement("div",{style:{height:"500px",width:"100%"}},o().createElement(ea.A,{name:"dataStreamJson",id:"DataStream",className:"widget-version-json",width:"100%",height:"100%",value:a,disabled:!0,theme:"light"})))))))))))}});var to=[{id:"All",title:"All"},{id:"asset.",title:"Asset"},{id:"app.",title:"Control App"},{id:"connection.",title:"Connection"},{id:"datanode.",title:"Data Node"},{id:"composition.",title:"Composition"},{id:"login.",title:"Login"},{id:"output.",title:"Output"},{id:"user.",title:"User"}];const ao=o().createClass({displayName:"AccountAuditLog",getInitialState:function(){var e=this;return this.updateIntervalHandler=null,this.fetchAuditLogRequest=null,this.allUsers=[],S().get("/apiv1/users/simple",(function(t,a){t?e.props.onNotification("Error while reading users: "+t,"error",5,"tc"):(e.allUsers=a.body,e.allUsers.sort((function(e,t){return e.email.localeCompare(t.email)})),e.setState({redraw:Math.random()}))})),{searchString:"",loadingMoreBefore:!0,loadingMoreAfter:!1,auditLogs:[],selectedLogEvent:null,eventFilter:"All",userFilter:"All",gotoDate:ge()().utc()}},componentDidMount:function(){var e=this;this.fetchAuditLog("now"),this.updateIntervalHandler=setInterval((function(){e.setState({redraw:Math.random()})}),5e3)},componentWillUnmount:function(){this.fetchAuditLogRequest&&this.fetchAuditLogRequest.abort(),this.updateIntervalHandler&&clearInterval(this.updateIntervalHandler)},fetchAuditLogForDate:function(e){this.setState({loadingMoreBefore:!0,loadingMoreAfter:!0,auditLogs:[]}),this.fetchAuditLogRequest=S().get("/apiv1/auditlogs?limit=10&ending_before="+e).set("Content-Type","application/json").end(function(t,a){if(a.headers.location)window.location=a.headers.location;else if(t)this.props.onNotification("Error while reading audit logs: "+t,"error",5,"tc"),this.setState({loadingMoreBefore:!1,loadingMoreAfter:!1});else{var i=a.body.data;0===i.length?this.fetchAuditLogRequest=S().get("/apiv1/auditlogs?limit=10&starting_after="+e).set("Content-Type","application/json").end(function(e,t){t.headers.location?window.location=t.headers.location:(e?this.props.onNotification("Error while reading audit logs: "+e,"error",5,"tc"):((i=t.body.data).sort((function(e,t){return t.id-e.id})),this.setState({auditLogs:i})),this.setState({loadingMoreBefore:!1,loadingMoreAfter:!1}))}.bind(this)):(i.sort((function(e,t){return t.id-e.id})),this.setState({auditLogs:i}),this.setState({loadingMoreBefore:!1,loadingMoreAfter:!1}))}}.bind(this))},fetchAuditLog:function(e,t){this.fetchAuditLogRequest&&(this.fetchAuditLogRequest.abort(),this.fetchAuditLogRequest=null);var a="";switch(e){case"before":this.state.auditLogs.length&&(a="&starting_after="+this.state.auditLogs[0].id),this.setState({loadingMoreBefore:!0});break;case"after":this.state.auditLogs.length&&(a="&ending_before="+this.state.auditLogs[this.state.auditLogs.length-1].id),this.setState({loadingMoreAfter:!0});break;case"date":return void this.fetchAuditLogForDate(t)}this.fetchAuditLogRequest=S().get("/apiv1/auditlogs?limit=100"+a).set("Content-Type","application/json").end(function(e,a){var i;a.headers.location?window.location=a.headers.location:(e?this.props.onNotification("Error while reading audit logs: "+e,"error",5,"tc"):((i=t?a.body.data:this.state.auditLogs.concat(a.body.data)).sort((function(e,t){return t.id-e.id})),this.setState({auditLogs:i})),this.setState({loadingMoreBefore:!1,loadingMoreAfter:!1}))}.bind(this))},onSearchChange:function(e){this.setState({searchString:e})},OnLoadMore:function(e){this.fetchAuditLog(e)},OnShowLogInfo:function(e){this.setState({selectedLogEvent:e},this.refs.AccountAudioLogInfoDialog.open)},OnEventFilter:function(e){this.setState({eventFilter:e})},OnUserFilter:function(e){this.setState({userFilter:e})},OnGotoDateChanged:function(e){var t=ge()(e,"x").utc();this.fetchAuditLog("date",t.format("YYYY-MM-DDTHH:mm:ss.000Z")),this.setState({gotoDate:t})},render:function(){var e,t,a,i,n,s=this,l=function(e){var t=function(e){var t;try{t=JSON.parse(e)}catch(e){}return t?t.email+" with ID "+t.userId+" from account "+t.account:e},a=function(e){var t=s.allUsers.find((function(t){return t.id==e}));return t?t.email+" with ID "+e:" with ID "+e},i="";switch(e.event){case"login.success":i="User has successfully logged in";break;case"login.failed":i=e.value?"User login with invalid email "+e.value:"User login has failed";break;case"composition.created":i="Composition with ID "+e.target+" created";break;case"composition.deleted":i="Composition with ID "+e.target+" deleted";break;case"composition.viewed":i="Composition with ID "+e.target+" opened in composer";break;case"composition.duplicated":i="Composition with ID "+e.target+" copied to composition ID "+e.value;break;case"composition.script.viewed":i="Composition with ID "+e.target+" opened in the script editor";break;case"composition.sent":i="Composition with ID "+e.target+" sent to user "+t(e.value2)+" as composition ID "+e.value;break;case"composition.received":i="Composition with ID "+e.target+" received from user "+t(e.value2)+" who sent composition ID "+e.value;break;case"composition.snapshot.updated":i="The snapshot of composition with ID "+e.target+" was updated";break;case"composition.thumbnail.updated":i="The thumbnail of composition with ID "+e.target+" was updated";break;case"composition.revision.created":i="A revision with ID "+e.value+" of composition with ID "+e.target+" was created.";break;case"composition.revision.deleted":i="A revision with ID "+e.value+" of composition with ID "+e.target+" was deleted.";break;case"composition.revision.restored":i="A revision with ID "+e.value+" of composition with ID "+e.target+" was restored.";break;case"composition.token.created":i="A new access token for composition with ID "+e.target+" was created.";break;case"composition.downloaded":i="A composition with ID "+e.value2+" was created by downloading ID "+e.target+" from library ID "+e.value;break;case"app.created":i="App with ID "+e.target+" created";break;case"app.deleted":i="App with ID "+e.target+" deleted";break;case"app.viewed":i="App with ID "+e.target+" opened","access_token"==e.value&&(i+=" using access token "+e.value2);break;case"app.composition.imported":i="A composition with ID "+e.value+" imported into app with ID "+e.target;break;case"app.duplicated":i="App with ID "+e.target+" copied to app ID "+e.value;break;case"app.token.created":i="A new access token of app with ID "+e.target+" created";break;case"app.token.revoked":i="The access token of app with ID "+e.target+" revoked";break;case"app.sent":i="App with ID "+e.target+" sent to user "+t(e.value2)+" as app ID "+e.value;break;case"app.received":i="App with ID "+e.target+" received from user "+t(e.value2)+" who sent app ID "+e.value;break;case"app.thumbnail.updated":i="The thumbnail of app with ID "+e.target+" updated";break;case"app.downloaded":i="An app with ID "+e.value2+" was created by downloading ID "+e.target+" from library ID "+e.value;break;case"output.created":i="Output with ID "+e.target+" created";break;case"output.deleted":i="Output with ID "+e.target+" deleted";break;case"output.attached":i="Output with ID "+e.target+" was attached to app with ID "+e.value;break;case"output.detached":i="Output with ID "+e.target+" was detached from app with ID "+e.value;break;case"output.updated":i="Output with ID "+e.target+" updated";break;case"asset.created":i="Asset with ID "+e.target+" created";break;case"asset.deleted":i="Asset with ID "+e.target+" deleted";break;case"datanode.created":i="Data node with ID "+e.target+" created";break;case"datanode.deleted":i="Data node with ID "+e.target+" deleted";break;case"datanode.token.created":i="A new access token for data node with ID "+e.target+" was created.";break;case"datastream.created":i="Data stream with ID "+e.target+" created";break;case"datastream.deleted":i="Data stream with ID "+e.target+" deleted";break;case"datastream.token.updated":i="Data stream with ID "+e.target+" "+e.value.toLowerCase()+" token updated ";break;case"datastream.updated":i="Data stream with ID "+e.target+" updated";break;default:break;case"connection.deleted":i="Connection "+e.value+" has been deleted";break;case"connection.created":i="Connection "+e.value+" has been created";break;case"connection.updated":i="Connection "+e.value+" has been updated";break;case"user.created":i="User "+a(e.target)+" has been created";break;case"user.deleted":i="User "+a(e.target)+" has been deleted";break;case"user.active":i=e.value?"User "+a(e.target)+" has been activated":"User "+a(e.target)+"User has been de-activated";break;case"user.password":i="Password of user "+a(e.target)+" was changed";break;case"user.email":i="Email of user "+a(e.target)+" was changed from "+e.value+" to "+e.value2;break;case"user.permission.development":i=e.value?"Permission 'development' of user "+a(e.target)+" has been added":"Permission 'development' of user "+a(e.target)+" has been removed";break;case"user.permission.user_administration":i=e.value?"Permission 'user administration' of user "+a(e.target)+" has been added":"Permission 'user administration' of user "+a(e.target)+" has been removed"}return i},r=function(e){var t=e.split(",");return t&&0!=t.length?t[0]:"Unknown"},c=o().createElement("div",{className:"dropdown-group dropdown-white"},o().createElement("button",{className:"btn btn-white","data-toggle":"dropdown",style:{width:"200px",height:"33px"}},o().createElement("span",{style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",width:"150px",display:"inline-block"}},(e=to,t=this.state.eventFilter,(a=e.find((function(e){return e.id==t})))?a.title:"unknown")),o().createElement("i",{className:"fa fa-caret-down",style:{top:"0px",position:"relative"}})),o().createElement("ul",{className:"dropdown-menu",style:{overflowX:"hidden",overflowY:"auto",right:"0px",top:"43px",maxHeight:"493px"}},to.map((function(e,t){return o().createElement("li",{key:t},o().createElement("a",{href:"javascript:",onClick:s.OnEventFilter.bind(s,e.id)},e.title))})))),d=o().createElement("div",{className:"dropdown-group dropdown-white"},o().createElement("button",{className:"btn btn-white","data-toggle":"dropdown",style:{width:"200px",height:"33px"}},o().createElement("span",{style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",width:"150px",display:"inline-block"}},function(e){if("All"==e)return"All";var t=s.allUsers.find((function(t){return t.id==e.id}));return t?t.email:"unknown"}(this.state.userFilter)),o().createElement("i",{className:"fa fa-caret-down",style:{top:"0px",position:"relative"}})),o().createElement("ul",{className:"dropdown-menu",style:{overflowX:"hidden",overflowY:"auto",right:"0px",top:"43px",maxHeight:"493px"}},o().createElement("li",null,o().createElement("a",{href:"javascript:",onClick:this.OnUserFilter.bind(this,"All")},"All")),this.allUsers.map((function(e,t){return o().createElement("li",{key:t},o().createElement("a",{href:"javascript:",onClick:s.OnUserFilter.bind(s,e)},o().createElement("span",{style:{width:"100%",display:"inline-block",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}},e.email)))})))),p=o().createElement("div",{style:{width:"120px",fontSize:"12px"}},o().createElement(us(),{value:this.state.gotoDate,className:"singular-date-time",inputProps:{placeholder:"Expiration Date",readOnly:"false"},dateFormat:"YYYY-MM-DD",timeFormat:"HH:mm",onChange:this.OnGotoDateChanged})),m=this.state.auditLogs.filter((function(e,t){if(!("All"!==s.state.eventFilter&&0!==e.event.indexOf(s.state.eventFilter)||"All"!==s.state.userFilter&&e.actor!=s.state.userFilter.id)){var a=l(e),i=r(e.ip);if(""!==s.state.searchString){var n=s.state.searchString.toUpperCase(),o=s.allUsers.find((function(t){return e.actor==t.id})),c="",d="",p="",m="";if(o&&(m&&(m=String(e.actor)),o.firstName&&(c=o.firstName),o.lastName&&(d=o.lastName),o.email&&(p=o.email)),-1===e.event.toUpperCase().indexOf(n)&&-1===m.toUpperCase().indexOf(n)&&-1===c.toUpperCase().indexOf(n)&&-1===d.toUpperCase().indexOf(n)&&-1===p.toUpperCase().indexOf(n)&&-1===a.toUpperCase().indexOf(n)&&-1===i.toUpperCase().indexOf(n))return}return e}})),u=o().createElement("div",{style:{marginLeft:"100px"}},o().createElement(_s.A,{className:"btn btn-white",data:m,filename:"AuditLogs.csv",tabIndex:"-1",style:{marginLeft:"auto",marginRight:"20px",width:"100px"}},"Export")),h=o().createElement("table",{className:"widget-version-list",style:{border:"0px",flex:"0 0 auto",width:"calc(100% - 10px)",marginBottom:"15px"}},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",{style:{width:"51%",textAlign:"left"}},o().createElement("span",{className:"table-header"},"Event Description")),o().createElement("th",{style:{width:"25%",textAlign:"left"}},o().createElement("span",{className:"table-header"},"User")),o().createElement("th",{style:{width:"10%",textAlign:"center"}},o().createElement("span",{className:"table-header"},"Date")),o().createElement("th",{style:{width:"120px",textAlign:"center"}},o().createElement("span",{className:"table-header"},"IP Address")),o().createElement("th",{style:{width:"4%",textAlign:"center"}},o().createElement("span",{className:"table-header"}))))),f=o().createElement("table",{className:"widget-version-list",style:{border:"0px"}},o().createElement("thead",{style:{display:"none",overflowX:"hidden",overflowY:"scroll"}},o().createElement("tr",null,o().createElement("th",{style:{width:"51%",textAlign:"left"}}),o().createElement("th",{style:{width:"25%",textAlign:"left"}}),o().createElement("th",{style:{width:"10%",textAlign:"center"}}),o().createElement("th",{style:{width:"120px",textAlign:"center"}}),o().createElement("th",{style:{width:"4%",textAlign:"center"}}))),o().createElement("tbody",null,m.map((function(e,t){var a,i=l(e),n=r(e.ip);return i||(i=o().createElement("span",null," ")),o().createElement("tr",{key:t,style:{cursor:"default"}},o().createElement("td",{style:{width:"51%",textAlign:"left"}},o().createElement("span",null,o().createElement("b",null,e.event),o().createElement("br",null),o().createElement("span",{style:{fontSize:"11px"}},i))),o().createElement("td",{style:{width:"25%",textAlign:"left"}},function(e){var t=s.allUsers.find((function(t){return t.id==e}));if(t){var a="";return t.firstName&&(a+=t.firstName+" "),t.lastName&&(a+=t.lastName),o().createElement("span",null,o().createElement("span",null,o().createElement("b",null,t.email)),o().createElement("br",null),o().createElement("span",{style:{fontSize:"11px"}},a))}return e?"Id "+e:""}(e.actor)),o().createElement("td",{style:{width:"10%",textAlign:"center"}},(a=e.created_at,o().createElement("span",null,o().createElement("b",null,ge()(a).fromNow()),o().createElement("br",null),o().createElement("span",{style:{fontSize:"11px"}},ge()(a).utc().format("YYYY-MM-DD HH:mm:ss"))))),o().createElement("td",{style:{width:"120px",textAlign:"center"}},o().createElement("span",{style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"pre",maxWidth:"116px",display:"block"}}," ",o().createElement("br",null),o().createElement("span",{style:{fontSize:"11px"}},n))),o().createElement("td",{style:{width:"4%",textAlign:"center"}},o().createElement("button",{className:"btn btn-white icon-only",style:{height:"28px",margin:"0px",position:"relative",transform:"scale(0.6)",top:"2px",right:"2px"},tabIndex:"-1",onClick:function(){return s.OnShowLogInfo(e)}},o().createElement("i",{className:"fa fa-info fa-lg"}))))})))),g=o().createElement("button",{className:"btn btn-white disabled",style:{height:"25px",width:"120px"}},o().createElement("img",{style:{height:"100%",padding:"0px"},src:"/images/loading-bubbles-blue.svg"}));return i=this.state.loadingMoreBefore?g:o().createElement("button",{className:"btn btn-white",onClick:function(){return s.OnLoadMore("before")},style:{height:"25px",width:"120px",lineHeight:"1"}},o().createElement("i",{className:"fa fa-arrow-up",style:{float:"none",position:"relative",left:"-10px",top:"0px"}}),"Load More",o().createElement("i",{className:"fa fa-arrow-up",style:{float:"none",position:"relative",left:"10px",top:"0px"}})),n=this.state.loadingMoreAfter?g:o().createElement("button",{className:"btn btn-white",onClick:function(){return s.OnLoadMore("after")},style:{height:"25px",width:"120px",lineHeight:"1"}},o().createElement("i",{className:"fa fa-arrow-down",style:{float:"none",position:"relative",left:"-10px",top:"0px"}}),"Load More",o().createElement("i",{className:"fa fa-arrow-down",style:{float:"none",position:"relative",left:"10px",top:"0px"}})),o().createElement("div",{className:"profile-wrapper",style:{height:"100%"}},o().createElement("div",{className:"singular-browser-body-tools"},o().createElement("div",{className:"portal-search-wrapper",style:{padding:"10px"}},o().createElement(mn,{mode:"immediate",placeholder:"Full Text Search ...",onSearch:this.onSearchChange})),o().createElement("span",{style:{marginLeft:"auto",marginRight:"10px"}},"Filter Event"),c,o().createElement("span",{style:{marginLeft:"50px",marginRight:"10px"}},"Filter User"),d,o().createElement("span",{style:{marginLeft:"50px",marginRight:"10px"}},"Goto Date"),p,u),o().createElement("div",{className:"developer-manager",style:{height:"calc(100% - 60px)"}},o().createElement("div",{className:"details-panel",style:{height:"100%",maxWidth:"1400px"}},o().createElement("div",{className:"details-panel-body",style:{display:"flex",flexDirection:"column",justifyContent:"center",height:"100%"}},h,o().createElement("div",{style:{flex:"0 0 auto",margin:"auto"}},i),o().createElement("div",{style:{flex:"1 1 auto",overflowX:"hidden",overflowY:"scroll"}},f),o().createElement("div",{style:{flex:"0 0 auto",margin:"auto"}},n)))),o().createElement(eo,{logEvent:this.state.selectedLogEvent,onNotification:this.props.onNotification,ref:"AccountAudioLogInfoDialog"}))}});var io=a(86479),no=a(98534);function so(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a=oo?(t++,a+=e.MINUTES):(i++,n+=e.MINUTES):e.MINUTES>=oo?(s++,o+=e.MINUTES):(l++,r+=e.MINUTES)})),{numberOfCountedEventsGraphicsSDK:t,totalMinutesOfCountedEventsGraphicsSDK:a,numberOfIgnoredEventsGraphicsSDK:i,totalMinutesOfIgnoredEventsGraphicsSDK:n,numberOfCountedEventsControlApp:s,totalMinutesOfCountedEventsControlApp:o,numberOfIgnoredEventsControlApp:l,totalMinutesOfIgnoredEventsControlApp:r}},buildUniqueIpReport:function(e){var t,a=[],i="";e.forEach((function(e){i!=e.IP?(t&&a.push(Object.assign({},t)),t={IP:e.IP,duration:Number(e.TOTALMINUTES),appID:[e.APPID]}):(t.duration+=Number(e.TOTALMINUTES),0==t.appID.includes(e.APPID)&&t.appID.push(e.APPID)),i=e.IP})),t&&a.push(Object.assign({},t)),a=a.sort((function(e,t){return e.durationt.duration?1:0}));var n=0,s=0;return a.forEach((function(e){e.numApp=e.appID.length,s+=e.appID.length,e.appID=e.appID.join(", "),e.duration=60*e.duration,n+=e.duration})),{report:a,totalDuration:n,totalApps:s}},fetchData:function(){var e,t=this;this.setState({busy:!0,result:null,resultTotalDuration:0,resultTotalApps:0}),this.accountReportRequest&&this.accountReportRequest.abort(),e="uniqueIP"===this.state.report||"uniqueIPgraphicsSDK"===this.state.report?"/apiv1/analytics/p_report?":"/apiv1/analytics/p_report2?","all"!==this.state.month&&(e+="month="+this.state.month+"&"),this.state.year&&(e+="year="+this.state.year+"&"),this.state.accountId&&(e+="account_id="+this.state.accountId),"uniqueIPgraphicsSDK"===this.state.report&&(e+="&includesdk=1"),this.accountReportRequest=S().get(e,(function(e,a){if(e)t.props.onNotification("Failed to fetch analytics data","error",5,"tc"),t.setState({busy:!1,result:null});else{if("uniqueIP"===t.state.report||"uniqueIPgraphicsSDK"===t.state.report){var i=t.buildUniqueIpReport(a.body);t.setState({result:i.report,resultTotalDuration:i.totalDuration,resultTotalApps:i.totalApps})}else{var n=t.buildGraphicsSdkReport(a.body);t.setState({result:n,resultTotalDuration:0,resultTotalApps:0}),console.log(n)}t.setState({busy:!1})}t.accountReportRequest=null}))},OnValueChanged:function(e,t){var a={result:void 0,exportData:void 0,busy:!0};a[e]=t,this.setState(a,this.fetchData)},fetchAccountInfo:function(e){var t=this;this.setState({accountInfo:"fetching"}),this.accountInfoRequest&&this.accountInfoRequest.abort(),e||0===e?this.accountInfoRequest=S().get("/apiv1/accounts/"+e,(function(e,a){t.accountInfoRequest=null,e?t.setState({accountInfo:"error"}):t.setState({accountInfo:a.body.name})})):this.setState({accountInfo:"error"})},onAccountIdChange:function(e){var t=e.target.value;this.setState({accountId:t,accountInfo:"changed"})},exportCsvFile:function(){var e,t,a,i,n,s;if("graphicsSDK"===this.state.report)t=this.state.result,a=[],i=Object.keys(t),n=Object.values(t),a.push(i.join(",")),a.push(n.join(",")),e=a.join("\n");else{var o=this.state.result,l=function(e,t){return null===t?"":t},r=Object.keys(o[0]);e=[r.join(",")].concat((s=o.map((function(e){return r.map((function(t){return JSON.stringify(e[t],l)})).join(",")})),function(e){if(Array.isArray(e))return so(e)}(s)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(s)||function(e,t){if(e){if("string"==typeof e)return so(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?so(e,t):void 0}}(s)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())).join("\r\n")}var c=new Blob([e],{type:"text/plain;charset=utf-8"});Gt().saveAs(c,"AnalyticsData.csv")},onAccountIdKeyDown:function(e){switch(e.key){case"Escape":this.setState({accountId:"0"});break;case"Tab":this.fetchData(),this.fetchAccountInfo(this.state.accountId)}},onAccountIdKeyPress:function(e){"Enter"===e.key&&(this.fetchData(),this.fetchAccountInfo(this.state.accountId))},render:function(){var e,t,a,i;return"error"==this.state.accountInfo?(e="Account ID not found",t=o().createElement("i",{className:"fa fa-times fa-lg"}),a="red"):"changed"==this.state.accountInfo?(e="Hit enter or tab to fetch account name",t=o().createElement("i",{className:"fa fa-exclamation-circle fa-lg"}),a="#898989"):"fetching"==this.state.accountInfo?(e="Fetching account name",t=o().createElement("i",{className:"fa fa-circle-o-notch fa-spin fa-fw"}),a="#898989"):(e=this.state.accountInfo,t=o().createElement("i",{className:"fa fa-info-circle fa-lg"}),a="green"),i=this.state.busy?o().createElement("div",{className:"center-in-parent"},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"})):this.state.result?"graphicsSDK"===this.state.report?o().createElement("table",{className:"analytics-graphics-sdk"},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",null,"Type"),o().createElement("th",null,"#"),o().createElement("th",null,"Total Minutes"))),o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",null,"Graphics SDK events shorter than ",oo," ","minutes"),o().createElement("td",null,Un().numberWithCommas(this.state.result.numberOfIgnoredEventsGraphicsSDK)),o().createElement("td",null,Un().formatMinutes(this.state.result.totalMinutesOfIgnoredEventsGraphicsSDK))),o().createElement("tr",null,o().createElement("td",null,"Graphics SDK events at least ",oo," ","minutes long"),o().createElement("td",null,Un().numberWithCommas(this.state.result.numberOfCountedEventsGraphicsSDK)),o().createElement("td",null,Un().formatMinutes(this.state.result.totalMinutesOfCountedEventsGraphicsSDK))),o().createElement("tr",null,o().createElement("td",null,"Control app events shorter than ",oo," ","minutes"),o().createElement("td",null,Un().numberWithCommas(this.state.result.numberOfIgnoredEventsControlApp)),o().createElement("td",null,Un().formatMinutes(this.state.result.totalMinutesOfIgnoredEventsControlApp))),o().createElement("tr",null,o().createElement("td",null,"Control app events at least ",oo," minutes long"),o().createElement("td",null,Un().numberWithCommas(this.state.result.numberOfCountedEventsControlApp)),o().createElement("td",null,Un().formatMinutes(this.state.result.totalMinutesOfCountedEventsControlApp))),o().createElement("tr",null,o().createElement("td",{style:{fontWeight:"bold"}},"Total"),o().createElement("td",{style:{fontWeight:"bold"}},Un().numberWithCommas(this.state.result.numberOfCountedEventsGraphicsSDK+this.state.result.numberOfIgnoredEventsGraphicsSDK+this.state.result.numberOfCountedEventsControlApp+this.state.result.numberOfIgnoredEventsControlApp)),o().createElement("td",null,Un().formatMinutes(this.state.result.totalMinutesOfIgnoredEventsGraphicsSDK+this.state.result.totalMinutesOfCountedEventsGraphicsSDK+this.state.result.totalMinutesOfIgnoredEventsControlApp+this.state.result.totalMinutesOfCountedEventsControlApp))))):o().createElement("table",{className:"analytics-ip"},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",null,"#"),o().createElement("th",null,"IP"),o().createElement("th",null,"Duration"),o().createElement("th",null,"# App IDs"),o().createElement("th",null,"App IDs"))),o().createElement("tbody",null,this.state.result.map((function(e,t){return o().createElement("tr",{key:t},o().createElement("td",null,t+1),o().createElement("td",null,e.IP),o().createElement("td",null,Un().formatMinutes(Math.round(e.duration/60))),o().createElement("td",null,Un().numberWithCommas(e.numApp)),o().createElement("td",null,e.appID))})),o().createElement("tr",null,o().createElement("td",null),o().createElement("td",{style:{fontWeight:"bold"}},"Total"),o().createElement("td",{style:{fontWeight:"bold"}},Un().formatMinutes(Math.round(this.state.resultTotalDuration/60))),o().createElement("td",{style:{fontWeight:"bold"}},Un().numberWithCommas(this.state.resultTotalApps)),o().createElement("td",null)))):o().createElement("div",{className:"center-in-parent"},"Couldn't fetch info"),o().createElement("div",{className:"profile-wrapper account-analytics",style:{height:"100%"}},o().createElement("div",{className:"singular-browser-body-tools"},o().createElement(no.A,{title:"Report",id:"report",width:"250px",selection:lo,value:this.state.report,OnValueChanged:this.OnValueChanged}),o().createElement("div",{style:{width:"20px"}}),o().createElement(no.A,{title:"Year",id:"year",width:"150px",selection:ro,value:this.state.year,OnValueChanged:this.OnValueChanged}),o().createElement("div",{style:{width:"20px"}}),o().createElement(no.A,{title:"Month",id:"month",width:"150px",selection:co,value:this.state.month,OnValueChanged:this.OnValueChanged}),o().createElement("div",{style:{width:"20px"}}),o().createElement("div",null,"Account ID"),o().createElement("div",{style:{width:"100px",marginLeft:"10px",display:"flex",alignItems:"center"}},o().createElement("input",{type:"text",className:"form-control",onChange:this.onAccountIdChange,onKeyDown:this.onAccountIdKeyDown,onKeyPress:this.onAccountIdKeyPress,value:this.state.accountId,autoComplete:"off",style:{textAlign:"center",width:"80px",marginRight:"5px"}}),o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"AccountInfo"},e)},o().createElement("span",{style:{color:a,fontSize:"13px"}},t))),o().createElement("div",{style:{flexGrow:"1"}}),o().createElement("div",{style:{marginLeft:"50px"}},o().createElement("span",null," "),o().createElement("button",{className:"btn btn-white",disabled:!this.state.result,style:{height:"33px",display:"inline-block",padding:"5px 25px"},onClick:this.exportCsvFile},"Export"))),o().createElement("div",{className:"developer-manager",style:{height:"calc(100% - 60px)"}},o().createElement("div",{className:"details-panel",style:{height:"calc(100% - 20px)",maxWidth:"calc(100% - 10px)",marginLeft:"0px",overflowX:"hidden",overflowY:"scroll",padding:"10px"}},i)))}});var mo=a(21163),uo=o().createClass({displayName:"UserSettingsRouter",componentWillMount:function(){var e=this;this.unlisten=this.props.history.listen((function(t,a){e.props.onRouteChange&&e.props.onRouteChange(t,a)}))},componentWillUnmount:function(){this.unlisten()},render:function(){return o().createElement("div",{className:"singular-browser-content"},this.props.children)}});const ho=(0,mo.A)(uo);var fo=a(15734),go=a(95093),vo=(a(9769),a(59018)),bo=a(804);const yo=o().createClass({displayName:"MandrillReport",getInitialState:function(){return{webhookList:null,currentEvent:"All Events",availableEvents:["send","hard_bounce","soft_bounce","open","click","spam","unsub","reject"],fetchingDataBusy:!0,listData:null,utcOffset:go().utcOffset(),ranges:{Today:[go(),go()],Yesterday:[go().subtract(1,"days"),go().subtract(1,"days")],"Last 7 Days":[go().subtract(6,"days"),go()],"Last 30 Days":[go().subtract(29,"days"),go()],"This Month":[go().startOf("month"),go().endOf("month")],"Last Month":[go().subtract(1,"month").startOf("month"),go().subtract(1,"month").endOf("month")]},startDate:go().subtract(6,"days"),endDate:go(),chosenLabel:"Last 7 Days"}},onDateRangePicker:function(e,t){"apply"===e.type&&this.setState({startDate:t.startDate,endDate:t.endDate,chosenLabel:t.chosenLabel,fetchingDataBusy:!0},function(){this.loadMandrillInfo(function(e,t){console.log(t),this.setState({listData:t,fetchingDataBusy:!1})}.bind(this))}.bind(this))},setcurrentEvent:function(e){this.setState({currentEvent:e,fetchingDataBusy:!0},function(){this.loadMandrillInfo(function(e,t){this.setState({listData:t,fetchingDataBusy:!1})}.bind(this))}.bind(this))},componentWillMount:function(){this.loadMandrillInfo(function(e,t){this.setState({listData:t,fetchingDataBusy:!1})}.bind(this))},componentDidMount:function(){},loadMandrillInfo:function(e){fo.get("/mandrill/list/").query({event:this.state.currentEvent,startDate:this.state.startDate.format("X"),endDate:this.state.endDate.format("X")}).set("Content-Type","application/json").end((function(t,a){e(t,a.body)}))},render:function(){var e,t=this,a=this.state.currentEvent,i=this.state.availableEvents.map(function(e,t){var a=this;return o().createElement("li",{key:t},o().createElement("a",{href:"javascript:",onClick:function(){return a.setcurrentEvent(e)}},e))}.bind(this)),n=function(e,t){return o().createElement("tr",{key:t},o().createElement("td",{style:{width:"30%",textAlign:"left"}},e.webhook_id),o().createElement("td",{style:{width:"20%",textAlign:"center"}},e.event),o().createElement("td",{style:{width:"25%",textAlign:"center"}},e.email),o().createElement("td",{style:{width:"30%",textAlign:"right"}},go(e.ts).format("MMMM DD, YYYY HH:mm:ss")))}.bind(this);return e=1==this.state.fetchingDataBusy?o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{colSpan:"100%",style:{textAlign:"center"}},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader",style:{height:"20px"}})))):this.state.listData&&0!=this.state.listData.length?o().createElement("tbody",null,this.state.listData.map(n)):o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{colSpan:"100%",style:{textAlign:"center"}},o().createElement("div",{style:{height:"20px",lineHeight:"20px"}},"Nothing to display")))),o().createElement("div",{className:"profile-wrapper"},o().createElement("div",{className:"singular-browser-body-tools"},o().createElement("div",{className:"dashboard-toolbar",style:{float:"right",width:"432px",display:"flex",justifyContent:"right",alignItems:"center",height:"100%"}},o().createElement("div",{style:{width:"170px",margin:"20px"}},o().createElement(vo,{startDate:this.state.startDate,endDate:this.state.endDate,ranges:this.state.ranges,opens:"left",onEvent:this.onDateRangePicker},o().createElement(bo.Button,{bsClass:"selected-date-range-btn btn btn-secondary",style:{width:"100%"}},o().createElement("div",{className:"pull-left"},o().createElement("i",{className:"fa fa-calendar",style:{marginLeft:"10px"}})),o().createElement("div",null,o().createElement("span",{style:{marginRight:"10px"}},this.state.chosenLabel))))),o().createElement("div",{style:{width:"200px"}},o().createElement("div",{className:"dropdown-group dropdown-white",role:"group",style:{width:"100%"}},o().createElement("button",{className:"btn btn-secondary","data-toggle":"dropdown",style:{width:"100%"}},o().createElement("i",{className:"fa fa-hdd-o",style:{left:"10px",float:"left"}}),o().createElement("span",{style:{textOverflow:"ellipsis",overflow:"hidden",display:"inline-block",whiteSpace:"nowrap",width:"145px"}},a),o().createElement("i",{className:"fa fa-caret-down",style:{position:"relative",top:"0px"}})),o().createElement("ul",{className:"dropdown-menu",style:{overflow:"hidden",right:"0px",top:"53px"}},o().createElement("li",null,o().createElement("a",{href:"javascript:",onClick:function(){return t.setcurrentEvent("All Events")}},"All Events")),i))))),o().createElement("div",{className:"developer-manager",style:{height:"calc(100% - 75px)",overflow:"auto"}},o().createElement("div",{className:"cards-wrapper",style:{height:"100%",padding:"0px"}},o().createElement("div",{className:"details-panel",style:{maxWidth:"90%"}},o().createElement("div",{className:"details-panel-header"},"Mandrill Email Report"),o().createElement("div",{className:"details-panel-body"},o().createElement("table",{className:"widget-version-list",style:{tableLayout:"fixed",margin:"0px"}},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",{style:{width:"30%",textAlign:"left"}},"ID"),o().createElement("th",{style:{width:"25%",textAlign:"center"}},"Event"),o().createElement("th",{style:{width:"25%",textAlign:"center"}},"Email"),o().createElement("th",{style:{width:"20%",textAlign:"right"}},"Time"))),e))))))}});var Eo=a(40927),wo=a(15734);a(95093),a(9769),a(40961);const So=Eo.createClass({displayName:"CloudflareControl",getInitialState:function(){return{ClearAllCacheBusy:!1}},clearAllCache:function(e){wo.post("/cloudflare/clearall").send({clearall:!0}).set("Content-Type","application/json").end((function(t,a){e(t,a.body)}))},handleClearAllCache:function(){this.setState({ClearAllCacheBusy:!0}),this.clearAllCache(function(e,t){this.setState({ClearAllCacheBusy:!1})}.bind(this))},render:function(){var e;return e=1==this.state.ClearAllCacheBusy?Eo.createElement("div",null,Eo.createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader",style:{height:"20px"}})):Eo.createElement("div",null,Eo.createElement("input",{type:"submit",value:"Clear Cache",style:{color:"#000"},onClick:this.handleClearAllCache})),Eo.createElement("div",{className:"profile-wrapper"},Eo.createElement("div",{className:"developer-manager",style:{height:"calc(100% - 75px)",overflow:"auto"}},Eo.createElement("div",{className:"cards-wrapper",style:{height:"100%",padding:"0px"}},Eo.createElement("div",{className:"details-panel"},Eo.createElement("div",{className:"details-panel-header"},"Cloudflare CDN"),Eo.createElement("div",{className:"details-panel-body"},e)))))}});var No=a(40927),Co=a(15734);const xo=No.createClass({displayName:"BannerManagement",getInitialState:function(){return{showBusyIcon:!0}},componentDidMount:function(){this.loadBanners()},loadBanners:function(){var e=this;this.setState({showBusyIcon:!0}),Co.get("/banners/admin").end((function(t,a){e.setState({showBusyIcon:!1,banners:a.body})}))},onInputChanged:function(e,t){var a=this.state.banners;a[e]=t,this.setState({banners:a})},saveBanners:function(){var e=this,t=this.state.banners;this.setState({showBusyIcon:!0}),Co.put("/banners").send({url:t.url,end_datetime:t.end_datetime,active:t.active}).end((function(t,a){e.setState({showBusyIcon:!1}),t?(console.error(t),e.props.onNotification("Failed to update banners","error",5,"tc")):e.props.onNotification("Banners updated successfully","success",5,"tc")}))},render:function(){var e,t=this;if(1==this.state.showBusyIcon)e=No.createElement("div",{className:"loader-wrapper"},No.createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"}));else{var a=this.state.banners,i=a.url||"",n=a.end_datetime?ge()(a.end_datetime):ge()(),s="1"==a.active;e=No.createElement("div",{className:"profile-wrapper"},No.createElement("div",{className:"developer-manager",style:{height:"calc(100% - 75px)",overflow:"auto"}},No.createElement("div",{className:"cards-wrapper"},No.createElement("div",{className:"details-panel",style:{maxWidth:"90%"}},No.createElement("div",{className:"details-panel-header"},"Banners"),No.createElement("div",{className:"details-panel-body"},No.createElement("table",{className:"details-table"},No.createElement("thead",null,No.createElement("tr",null,No.createElement("th",{style:{width:"10%",padding:"0px 10px 10px 10px"}},"Location"),No.createElement("th",{style:{width:"10%",padding:"0px 10px 10px 10px"}},"Active"),No.createElement("th",{style:{width:"60%",padding:"0px 10px 10px 10px"}},"URL"),No.createElement("th",{style:{width:"20%",padding:"0px 10px 10px 10px",textAlign:"center"}},"Expires"))),No.createElement("tbody",null,No.createElement("tr",null,No.createElement("td",null,No.createElement("div",null,"Dashboard")),No.createElement("td",null,No.createElement("label",{className:"switch",style:{top:"4px"}},No.createElement("input",{type:"checkbox",className:"switch-input",id:"active",checked:s,onChange:function(e){return t.onInputChanged("active",e.target.checked?"1":"0")}}),No.createElement("span",{className:"switch-label","data-on":"ON","data-off":"OFF"}),No.createElement("span",{className:"switch-handle"}))),No.createElement("td",null,No.createElement("div",null,No.createElement("input",{type:"text",value:i,className:"form-control",onChange:function(e){t.onInputChanged("url",e.target.value)},disabled:!s}))),No.createElement("td",null,No.createElement("div",null,No.createElement(us(),{value:n,className:"singular-date-time",inputProps:{placeholder:"Date / Time",readOnly:"false"},dateFormat:"YYYY-MM-DD",timeFormat:"HH:mm",onChange:function(e){return t.onInputChanged("end_datetime",ge()(e))},onClose:function(e){return t.onInputChanged("end_datetime",ge()(e))}})))))),No.createElement("div",{style:{paddingTop:"100px"}},No.createElement("input",{type:"button",className:"btn btn-primary",value:"Save",onClick:function(e){t.saveBanners()}})))))))}return e}});function Io(e){return Io="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Io(e)}function ko(){ko=function(){return t};var e,t={},a=Object.prototype,i=a.hasOwnProperty,n=Object.defineProperty||function(e,t,a){e[t]=a.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",r=s.toStringTag||"@@toStringTag";function c(e,t,a){return Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,a){return e[t]=a}}function d(e,t,a,i){var s=t&&t.prototype instanceof v?t:v,o=Object.create(s.prototype),l=new R(i||[]);return n(o,"_invoke",{value:I(e,a,l)}),o}function p(e,t,a){try{return{type:"normal",arg:e.call(t,a)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var m="suspendedStart",u="suspendedYield",h="executing",f="completed",g={};function v(){}function b(){}function y(){}var E={};c(E,o,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(P([])));S&&S!==a&&i.call(S,o)&&(E=S);var N=y.prototype=v.prototype=Object.create(E);function C(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function a(n,s,o,l){var r=p(e[n],e,s);if("throw"!==r.type){var c=r.arg,d=c.value;return d&&"object"==Io(d)&&i.call(d,"__await")?t.resolve(d.__await).then((function(e){a("next",e,o,l)}),(function(e){a("throw",e,o,l)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return a("throw",e,o,l)}))}l(r.arg)}var s;n(this,"_invoke",{value:function(e,i){function n(){return new t((function(t,n){a(e,i,t,n)}))}return s=s?s.then(n,n):n()}})}function I(t,a,i){var n=m;return function(s,o){if(n===h)throw Error("Generator is already running");if(n===f){if("throw"===s)throw o;return{value:e,done:!0}}for(i.method=s,i.arg=o;;){var l=i.delegate;if(l){var r=k(l,i);if(r){if(r===g)continue;return r}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(n===m)throw n=f,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);n=h;var c=p(t,a,i);if("normal"===c.type){if(n=i.done?f:u,c.arg===g)continue;return{value:c.arg,done:i.done}}"throw"===c.type&&(n=f,i.method="throw",i.arg=c.arg)}}}function k(t,a){var i=a.method,n=t.iterator[i];if(n===e)return a.delegate=null,"throw"===i&&t.iterator.return&&(a.method="return",a.arg=e,k(t,a),"throw"===a.method)||"return"!==i&&(a.method="throw",a.arg=new TypeError("The iterator does not provide a '"+i+"' method")),g;var s=p(n,t.iterator,a.arg);if("throw"===s.type)return a.method="throw",a.arg=s.arg,a.delegate=null,g;var o=s.arg;return o?o.done?(a[t.resultName]=o.value,a.next=t.nextLoc,"return"!==a.method&&(a.method="next",a.arg=e),a.delegate=null,g):o:(a.method="throw",a.arg=new TypeError("iterator result is not an object"),a.delegate=null,g)}function D(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(D,this),this.reset(!0)}function P(t){if(t||""===t){var a=t[o];if(a)return a.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,s=function a(){for(;++n=0;--s){var o=this.tryEntries[s],l=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var r=i.call(o,"catchLoc"),c=i.call(o,"finallyLoc");if(r&&c){if(this.prev=0;--a){var n=this.tryEntries[a];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var a=this.tryEntries[t];if(a.finallyLoc===e)return this.complete(a.completion,a.afterLoc),A(a),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc===e){var i=a.completion;if("throw"===i.type){var n=i.arg;A(a)}return n}}throw Error("illegal catch attempt")},delegateYield:function(t,a,i){return this.delegate={iterator:P(t),resultName:a,nextLoc:i},"next"===this.method&&(this.arg=e),g}},t}function Do(e,t,a,i,n,s,o){try{var l=e[s](o),r=l.value}catch(e){return void a(e)}l.done?t(r):Promise.resolve(r).then(i,n)}function Ao(e){return function(){var t=this,a=arguments;return new Promise((function(i,n){var s=e.apply(t,a);function o(e){Do(s,i,n,o,l,"next",e)}function l(e){Do(s,i,n,o,l,"throw",e)}o(void 0)}))}}var Ro,Po,To,Mo,Oo,Lo=a(40927),Vo=a(15734),Fo=[{id:"email",title:"Send emails"},{id:"emailReport",title:"Email Report"},{id:"banner",title:"Manager banners"},{id:"bannerReport",title:"Banner Report"}],_o=[{id:"all",title:"All"},{id:"enterprise",title:"Enterprise"},{id:"professional",title:"Professional"}],Bo=[{id:"nobanner",title:"No banners defined"}];const Uo=Lo.createClass({displayName:"UserInteractionManagement",getInitialState:function(){return this.xhrBannerRequest=null,this.xhrVoteRequest=null,this.xhrDeleteVotesRequest=null,this.xhrEmailTemplatesRequest=null,this.xhrEmailReportRequest=null,{showBusyIcon:!0,function:Fo[0].id,banner:Bo[0].id,zendeskFilter:_o[0].id,emailString:"",emailObjects:[],bannerReport:{},bannerReportLoading:!1,voteReport:[],voteReportLoading:!1,emailReport:{},emailReportLoading:!1,progressText:"",emailTemplates:[],template:"",dialogCallback:null,dialogTitle:"",dialogText:""}},componentDidMount:function(){this.setState({showBusyIcon:!1}),this.loadBannerReport(),this.loadEmailTemplates(),this.loadEmailReport()},componentWillUnmount:function(){this.xhrBannerRequest&&this.xhrBannerRequest.abort(),this.xhrVoteRequest&&this.xhrVoteRequest.abort(),this.xhrDeleteVotesRequest&&this.xhrDeleteVotesRequest.abort(),this.xhrEmailTemplatesRequest&&this.xhrEmailTemplatesRequest.abort(),this.xhrEmailReportRequest&&this.xhrEmailReportRequest.abort()},loadEmailTemplates:function(){var e=this;this.setState({emailTemplatesLoading:!0,emailTemplates:[]}),this.xhrEmailTemplatesRequest&&this.xhrEmailTemplatesRequest.abort(),this.xhrEmailTemplatesRequest=Vo.get("/apiv2/campaigns/emailtemplates").end((function(t,a){e.xhrEmailTemplatesRequest=null,e.setState({emailTemplatesLoading:!1}),t?(console.error(t),e.props.onNotification("Failed to load email templates","error",5,"tc")):e.setState({emailTemplates:a.body,template:a.body[0].slug})}))},loadBannerReport:function(){var e=this;this.setState({bannerReportLoading:!0,bannerReport:{}}),this.xhrBannerRequest&&this.xhrBannerRequest.abort(),this.xhrBannerRequest=Vo.get("/apiv2/campaigns/banners").end((function(t,a){e.xhrBannerRequest=null,e.setState({bannerReportLoading:!1}),t?(console.error(t),e.props.onNotification("Failed to load banner report","error",5,"tc")):e.setState({bannerReport:a.body})}))},loadVoteReport:function(e){var t=this;this.setState({voteReportLoading:!0,voteReport:[]}),this.xhrVoteRequest&&this.xhrVoteRequest.abort();var a="https://service.singular.live/v1/library/answers/"+encodeURIComponent(e)+"/49f7483b-9ae4-4b81-9c7d-84038761e589";this.xhrVoteRequest=Vo.get(a).end((function(e,a){t.xhrVoteRequest=null,t.setState({voteReportLoading:!1}),e?(console.error(e),t.props.onNotification("Failed to load vote report","error",5,"tc")):t.setState({voteReport:a.body})}))},loadEmailReport:function(){var e=this;this.setState({emailReportLoading:!0,emailReport:{}}),this.xhrVoteRequest&&this.xhrVoteRequest.abort(),this.xhrEmailReportRequest=Vo.post("/apiv2/campaigns/sendstatus").end((function(t,a){if(e.xhrEmailReportRequest=null,e.setState({emailReportLoading:!1}),t)console.error(t),e.props.onNotification("Failed to load vote report","error",5,"tc");else{var i=a.body.reduce((function(e,t){return e[t.key]=(e[t.key]||0)+1,e}),{});e.setState({emailReport:i})}}))},deleteVotes:function(e){var t,a=this;this.setState({voteReportLoading:!0}),this.xhrDeleteVotesRequest&&this.xhrDeleteVotesRequest.abort(),e&&(t={questionId:e}),this.xhrDeleteVotesRequest=Vo.delete("https://service.singular.live/v1/library/answers/49f7483b-9ae4-4b81-9c7d-84038761e589").set("Content-Type","application/json").send(t).end((function(e,t){a.xhrDeleteVotesRequest=null,a.setState({voteReportLoading:!1}),e?(console.error(e),a.props.onNotification("Failed to delete votes","error",5,"tc")):a.loadVoteReport(a.state.banner)}))},functionChanged:function(e,t){this.setState({function:t}),"bannerReport"===t&&(this.loadBannerReport(),this.loadVoteReport(this.state.banner))},bannerChanged:function(e,t){this.setState({banner:t}),"bannerReport"===this.state.function&&(this.loadBannerReport(),this.loadVoteReport(t))},emailChanged:function(e,t){this.setState({template:t})},sendEmailBatch:(Oo=Ao(ko().mark((function e(t){var a,i=this;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=this.state.emailObjects.slice(),e.next=3,fetch("/apiv2/campaigns/emailstatus",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t})}).then((function(e){return e.json()})).then((function(e){a=a.concat(e)})).catch((function(e){i.props.onNotification("Failed to fetch email status","error",5,"tc")}));case 3:this.setState({emailObjects:a});case 4:case"end":return e.stop()}}),e,this)}))),function(e){return Oo.apply(this,arguments)}),addEmailAddresses:(Mo=Ao(ko().mark((function e(){var t,a,i,n=this;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t=this.state.emailString.match(/([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi))||0===t.length){e.next=10;break}if(a=[],t.forEach((function(e){-1===n.state.emailObjects.findIndex((function(t){return t.email===e}))&&-1===a.findIndex((function(t){return t===e}))&&a.push(e)})),!(a.length>0)){e.next=10;break}return this.setState({showBusyIcon:!0,progressText:"Processing emails ..."}),i=function(){var e=Ao(ko().mark((function e(){var t,i,s,o;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=100,i=0;case 2:if(!(i0)){e.next=13;break}if(s=a.users.filter((function(e){return!!e.email&&("all"===n.state.zendeskFilter||n.state.zendeskFilter===e.user_fields.subscription_plan)})),!((o=s.map((function(e){return e.email}))).length>0)){e.next=8;break}return e.next=6,n.sendEmailBatch(o);case 6:e.next=10;break;case 8:return e.next=10,new Promise((function(e){return setTimeout(e,500)}));case 10:(l=Math.round(100*i/t*100))>100&&(l=100),n.setState({progressText:"Loading emails ".concat(l,"% of ").concat(Un().numberWithCommas(t))});case 13:if(!a.meta||!a.meta.has_more){e.next=19;break}return i++,r=a.links.next.replace("https://singularlive.zendesk.com","/apiv2/campaigns/zendesk"),e.abrupt("return",r);case 19:return n.setState({showBusyIcon:!1,progressText:""}),e.abrupt("return",null);case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()).catch((function(e){return n.setState({showBusyIcon:!1,progressText:""}),n.props.onNotification("Failed to load emails from Zendesk","error",5,"tc"),null}));case 12:a=e.sent,e.next=9;break;case 15:case"end":return e.stop()}}),e,this)}))),function(){return To.apply(this,arguments)}),clearEmailAddresses:function(){this.setState({emailObjects:[]})},sendEmails:(Po=Ao(ko().mark((function e(){var t,a,i,n,s,o=this;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.state.template+" - "+Math.random().toString(36).substring(2,6),a=this.state.emailTemplates.find((function(e){return e.slug===o.state.template})),i="noreply@singular.live",a&&a.from_email&&(i=a.from_email),n=function(){var e=Ao(ko().mark((function e(a){var n;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.map((function(e){return e.email})),e.next=3,fetch("/apiv2/campaigns/sendemail",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,template:o.state.template,email:n,senderEmail:i})}).catch((function(e){o.props.onNotification("Failed to send emails","error",5,"tc")}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.setState({showBusyIcon:!0,progressText:"Activating banners..."}),s=function(){var e=Ao(ko().mark((function e(){var t,a,i,s,l;return ko().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=o.state.emailObjects.filter((function(e){return"ok"===e.status||"notfound"===e.status})),a=100,i=0;case 3:if(!(i0?Lo.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"25px"}},Lo.createElement("span",null,e("Valid","ok")),Lo.createElement("span",null,e("Deleted","deleted")),Lo.createElement("span",null,e("Opt Out","optout")),Lo.createElement("span",null,e("Not Found","notfound")),Lo.createElement("span",null,e("Not Verified","notverified"))):null)):null,Lo.createElement("div",{style:{flexGrow:"1"}}),i?Lo.createElement("div",{style:{display:"flex",gap:"10px"}},Lo.createElement("input",{type:"button",className:"btn btn-primary",value:"Send",style:{width:"120px",height:"35px",fontSize:"12px"},onClick:function(){return t.showDialog("Send Emails","Are you sure you want to send the emails?",t.sendEmails)},disabled:0===this.state.emailObjects.length})):null,a?Lo.createElement("div",{style:{display:"flex",gap:"10px"}},Lo.createElement("input",{type:"button",className:"btn btn-primary",value:"Activate",style:{width:"120px",height:"35px",fontSize:"12px"},onClick:function(){return t.showDialog("Activate Banners","Are you sure you want to activate the banners?",t.activateBanner)},disabled:0===this.state.emailObjects.length||"nobanner"===this.state.banner}),Lo.createElement("input",{type:"button",className:"btn btn-primary",value:"Deactivate",style:{width:"120px",height:"35px",fontSize:"12px"},onClick:function(){return t.showDialog("Deactivate Banner","Are you sure you want to deactivate the banner?",(function(){return t.deactivateBanner(t.state.banner)}))},disabled:"nobanner"===this.state.banner}),Lo.createElement("input",{type:"button",className:"btn btn-danger",value:"Deactivate all",style:{width:"120px",height:"35px",fontSize:"12px",marginLeft:"60px"},onClick:function(){return t.showDialog("Deactivate Banners","Are you sure you want to deactivate all banners?",t.deactivateBanner)}})):null,n?Lo.createElement("div",{style:{display:"flex",gap:"10px"}},Lo.createElement("input",{type:"button",className:"btn btn-primary",value:"Reload",style:{width:"120px",height:"35px",fontSize:"12px"},onClick:function(){t.loadBannerReport(),t.loadVoteReport(t.state.banner)}}),Lo.createElement("input",{type:"button",className:"btn btn-primary",value:"Delete votes",style:{width:"120px",height:"35px",fontSize:"12px"},onClick:function(){return t.showDialog("Delete votes","Are you sure you want to delete votes?",(function(){return t.deleteVotes(t.state.banner)}))}}),Lo.createElement("input",{type:"button",className:"btn btn-danger",value:"Delete all votes",style:{width:"120px",height:"35px",fontSize:"12px",marginLeft:"60px"},onClick:function(){return t.showDialog("Delete all votes","Are you sure you want to delete all votes?",t.deleteVotes)}})):null,s?Lo.createElement("div",{style:{display:"flex",gap:"10px"}},Lo.createElement("input",{type:"button",className:"btn btn-primary",value:"Reload",style:{width:"120px",height:"35px",fontSize:"12px"},onClick:function(){t.loadEmailReport()}})):null),Lo.createElement("div",{className:"developer-manager",style:{height:"calc(100% - 75px)"}},function(){if(!a&&!i)return null;var e,n,s=function(e,t,a,i,n){switch(i){case"ok":i="Valid";break;case"deleted":i="Deleted";break;case"optout":i="Opt Out";break;case"notfound":i="Not Found";break;case"notverified":i="Not Verified"}return Lo.createElement("div",{key:e,style:{display:"flex",gap:"20px"}},Lo.createElement("div",{className:"detail-label",style:{width:"50px",textAlign:"right"}},t),Lo.createElement("div",{className:"detail-label",style:{width:"50px"}},a),Lo.createElement("div",{className:"detail-label",style:{width:"100px"}},i),Lo.createElement("div",{className:"detail-label"},n))};return Lo.createElement("div",{className:"cards-wrapper",style:{height:"100%"}},Lo.createElement("div",{className:"details-panel",style:{height:"100%",maxWidth:"80%"}},Lo.createElement("div",{className:"details-panel-body user-interaction-wrapper",style:{height:"100%"}},Lo.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"10px",alignItems:"center"}},Lo.createElement("div",{className:"detail-label",style:{width:"110px"}},"Email addresses"),Lo.createElement("input",{type:"text",value:t.state.emailString,className:"form-control",style:{flex:"1 1 100px",maxWidth:"300px",height:"31px",position:"relative",top:"-1px"},onChange:function(e){t.setState({emailString:e.target.value})},onKeyPress:function(e){switch(e.key){case"Escape":t.setState({emailString:""});break;case"Enter":t.addEmailAddresses()}}}),Lo.createElement("input",{type:"button",className:"btn btn-primary",value:"Add",style:{position:"relative",top:"-1px"},onClick:function(e){t.addEmailAddresses()}}),Lo.createElement("div",{style:{marginLeft:"50px"}},"Zendesk Contacts"),Lo.createElement("div",null,Lo.createElement("div",{className:"btn-group"},Lo.createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{width:"170px",top:"-1px",height:"30px",margin:"2px 0px"}},(e=t.state.zendeskFilter,(n=_o.find((function(t){return t.id==e})))?n.title:0)),Lo.createElement("ul",{className:"dropdown-menu",style:{maxHeight:"none"}},_o.map((function(e,a){return Lo.createElement("li",{key:a},Lo.createElement("a",{onClick:function(){t.setState({zendeskFilter:e.id})}},e.title))}))))),Lo.createElement("input",{type:"button",className:"btn btn-primary",value:"Add",style:{position:"relative",top:"-1px"},onClick:function(e){t.addEmailAddressesFromZendesk()}}),Lo.createElement("div",{style:{flexGrow:"1"}}),Lo.createElement("input",{type:"button",className:"btn btn-primary",value:"Clear List",style:{position:"relative",top:"-1px"},onClick:function(e){t.clearEmailAddresses()}})),Lo.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"10px",alignItems:"flex-start",marginTop:"10px",height:"calc(100% - 25px)",overflowY:"scroll"}},Lo.createElement("div",{className:"detail-label",style:{width:"110px"}}),Lo.createElement("div",{style:{flex:"1 1 100px"}},0===t.state.emailObjects.length?Lo.createElement("div",{className:"detail-label"},"No email addresses"):null,t.state.emailObjects.length>0?Lo.createElement("div",{style:{display:"flex",flexDirection:"column"}},Lo.createElement("span",{style:{fontWeight:"bold"}},s("header","#","ID","Status","Email")),t.state.emailObjects.map((function(e,t){return s(t,t+1,e.id,e.status,e.email)}))):null)))))}(),function(){if(!n)return null;if(t.state.bannerReportLoading||t.state.voteReportLoading)return o();var e={};return t.state.voteReport.forEach((function(t){var a=t.answer;e[a]?e[a]+=1:e[a]=1})),e.close||(e.close=0),Lo.createElement("div",{className:"cards-wrapper",style:{height:"100%"}},Lo.createElement("div",{className:"details-panel",style:{height:"100%",maxWidth:"80%"}},Lo.createElement("div",{className:"details-panel-body",style:{height:"100%"}},Lo.createElement("div",{style:{display:"flex",flexDirection:"column"}},l("active","Active",Un().numberWithCommas(t.state.bannerReport[t.state.banner])),Lo.createElement("div",{style:{height:"20px"}}),e.close?l("close","Closed",Un().numberWithCommas(e.close)):null,Object.keys(e).map((function(t,a){return"close"===t?null:l(a,t,Un().numberWithCommas(e[t]))}))))))}(),function(){if(!s)return null;if(t.state.emailReportLoading)return o();var e=Object.keys(t.state.emailReport);return Lo.createElement("div",{className:"cards-wrapper",style:{height:"100%"}},Lo.createElement("div",{className:"details-panel",style:{height:"100%",maxWidth:"80%"}},Lo.createElement("div",{className:"details-panel-body",style:{height:"100%"}},Lo.createElement("div",{style:{display:"flex",flexDirection:"column"}},0===e.length?Lo.createElement("span",null,"All emails have been sent"):l("template","Email Template","# of emails left",!0),e.map((function(e,a){return l(a,e,Un().numberWithCommas(t.state.emailReport[e]))}))))))}(),Lo.createElement("div",{id:"userIneractionManagementConfirmationDialog",className:"modal fade u-displaynone singular-modal-white",tabIndex:"-1",role:"dialog"},Lo.createElement("div",{className:"vertical-alignment-helper"},Lo.createElement("div",{className:"modal-dialog vertical-align-center",role:"document"},Lo.createElement("div",{className:"modal-content"},Lo.createElement("div",{className:"modal-header"},Lo.createElement("button",{tabIndex:"-1",type:"button",className:"close","data-dismiss":"modal","aria-label":"Close",onClick:this.closeDialog},Lo.createElement("span",{"aria-hidden":"true"},Lo.createElement("i",{style:{width:"20px",height:"20px",position:"relative"},className:"fa fa-times"}))),Lo.createElement("h4",{className:"modal-title",id:"myModalLabel"},this.state.dialogTitle)),Lo.createElement("div",{className:"modal-body",style:{borderRadius:"0px"}},Lo.createElement("p",{style:{color:"#555",textAlign:"center"}},this.state.dialogText)),Lo.createElement("div",{className:"modal-footer"},Lo.createElement("button",{tabIndex:"-1",onClick:function(){t.state.dialogCallback&&t.state.dialogCallback(),t.closeDialog()},className:"btn btn-primary"},"Ok"),Lo.createElement("button",{tabIndex:"-1",onClick:this.closeDialog,className:"btn btn-secondary"},"Cancel"))))))))}});var Wo=a(40927),Yo=a(15734),jo=a(53209);const Ho=Wo.createClass({displayName:"CredentialsKey",getInitialState:function(){return{showBusyIcon:!0,userCredential:{}}},componentDidMount:function(){this.loadUserCredentialData()},loadUserCredentialData:function(){var e=this;this.setState({showBusyIcon:!0}),Yo.get("/apiv1/accounts/credentials").end((function(t,a){e.setState({showBusyIcon:!1,userCredential:a.body})}))},onInputChanged:function(e,t){var a=this.state.userCredential;a[e]=t,this.setState({userCredential:a})},saveCredentials:function(){var e=this,t=this.state.userCredential;this.setState({showBusyIcon:!0}),Yo.put("/apiv1/accounts/credentials").send({client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}).end((function(t,a){e.setState({showBusyIcon:!1}),t?(console.error(t),e.props.onNotification("Failed to update credentials","error",5,"tc")):e.props.onNotification("Credentials updated successfully","success",5,"tc")}))},generateClientSecretKey:function(){this.onInputChanged("client_secret",jo(48).toString("hex"))},render:function(){var e,t=this;if(window.singularUser.id==window.singularUser.account.accountAdminId||window.singularUser.account.permission.permDevTool){var a=this.state.userCredential,i=a.client_id||"",n=a.client_secret||"",s=a.redirect_uri||"",o=!0,l=null,r=null;""!=s&&0==(o=new RegExp(/^(?:http(s)?:\/\/)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/gm).test(s))&&(l={border:"solid 1px red"},r=Wo.createElement("span",{style:{color:"red",fontStyle:"italic"}},"( * Invalid URI format, URI need to start with (http:// OR https://) )"));var c=o;e=1==this.state.showBusyIcon?Wo.createElement("div",{className:"loader-wrapper"},Wo.createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"})):Wo.createElement("div",{className:"profile-wrapper"},Wo.createElement("div",{className:"developer-manager",style:{height:"calc(100% - 75px)",overflow:"auto"}},Wo.createElement("div",{className:"cards-wrapper"},Wo.createElement("div",{className:"details-panel",style:{maxWidth:"1000px"}},Wo.createElement("div",{className:"details-panel-header"},"OAuth Client Credentials"),Wo.createElement("div",{className:"details-panel-body"},Wo.createElement("table",{className:"details-table"},Wo.createElement("tbody",null,Wo.createElement("tr",null,Wo.createElement("td",null,Wo.createElement("div",null,Wo.createElement("div",{className:"detail-label"},"Client Id"),Wo.createElement("div",null,Wo.createElement("div",{className:"input-group",style:{width:"100%",borderCollapse:"unset"}},Wo.createElement("input",{type:"text",className:"form-control v2",readOnly:!0,value:i,disabled:!0}),Wo.createElement("span",{className:"input-group-btn"},Wo.createElement(Kt(),{className:"btn btn-white icon-only","data-clipboard-text":i,"button-tabIndex":"-1",style:{height:"30px"}},Wo.createElement("i",{className:"fa fa-clipboard fa-lg"})))))))),Wo.createElement("tr",null,Wo.createElement("td",null,Wo.createElement("div",null,Wo.createElement("div",{className:"detail-label"},"Client Secret"),Wo.createElement("div",null,Wo.createElement("div",{className:"input-group",style:{width:"100%",borderCollapse:"unset"}},Wo.createElement("input",{type:"text",className:"form-control v2",readOnly:!0,value:n,disabled:!0}),Wo.createElement("div",{className:"input-group-btn"},Wo.createElement(j(),{placement:"bottom",delayShow:500,overlay:Wo.createElement(z(),{id:"generate"},"Generate new client secret key")},Wo.createElement("button",{className:"btn btn-white icon-only",style:{height:"30px"},tabIndex:"-1",onClick:function(e){t.generateClientSecretKey()}},Wo.createElement("i",{className:"fa fa-repeat fa-lg"})))),Wo.createElement("div",{className:"input-group-btn"},Wo.createElement(Kt(),{className:"btn btn-white icon-only","data-clipboard-text":n,"button-tabIndex":"-1",style:{height:"30px"}},Wo.createElement("i",{className:"fa fa-clipboard fa-lg"})))))))),Wo.createElement("tr",null,Wo.createElement("td",{style:{paddingTop:"20px"}},Wo.createElement("div",null,Wo.createElement("div",{className:"detail-label"},"Callback URL ",r),Wo.createElement("div",{className:"section-caption",style:{paddingLeft:"0px",marginBottom:"10px"}},"Please enter the URL that the user will be redirected to once they have logged in."),Wo.createElement("div",null,Wo.createElement("input",{type:"text",value:s,className:"form-control",style:l,onChange:function(e){t.onInputChanged("redirect_uri",e.target.value)}}))))),Wo.createElement("tr",null,Wo.createElement("td",null,Wo.createElement("input",{type:"button",className:"btn btn-primary",value:"Save",disabled:!c,onClick:function(e){t.saveCredentials()}}))))))))))}else e=Wo.createElement("div",{className:"profile-wrapper"},Wo.createElement("div",{className:"developer-manager",style:{height:"calc(100% - 75px)",overflow:"auto"}},Wo.createElement("div",{className:"cards-wrapper"},Wo.createElement("div",{className:"details-panel",style:{maxWidth:"1000px"}},Wo.createElement("div",{className:"details-panel-header"},"OAuth Client Credentials"),Wo.createElement("div",{className:"details-panel-body"},Wo.createElement("span",{style:{color:"red"}},"Access Denied"))))));return e}});var zo=a(40927),Go=a(15734);const $o=zo.createClass({displayName:"AccountSSO",getInitialState:function(){return{showBusyIcon:!0,configuration:JSON.stringify({entryPoint:"",issuer:"",cert:""},null,2)}},componentDidMount:function(){this.load()},load:function(){var e=this;this.setState({showBusyIcon:!0}),Go.get("/apiv1/accounts/sso").end((function(t,a){e.setState({showBusyIcon:!1}),t?e.props.onNotification("Failed to load configuration","error",5,"tc"):a.body&&a.body.sso_config&&e.setState({configuration:a.body.sso_config})}))},onInputChanged:function(e,t){this.setState({configuration:t})},save:function(){var e=this;this.setState({showBusyIcon:!0}),Go.put("/apiv1/accounts/sso").send({sso_config:this.state.configuration}).end((function(t,a){e.setState({showBusyIcon:!1}),t?e.props.onNotification("Failed to save configuration","error",5,"tc"):e.props.onNotification("Configuration saved successfully","success",5,"tc")}))},render:function(){var e;if((window.singularUser.id==window.singularUser.account.accountAdminId||window.singularUser.account.permission.permDevTool)&&window.singularUser.account.is_sso)if(1==this.state.showBusyIcon)e=zo.createElement("div",{className:"loader-wrapper"},zo.createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"}));else{var t=this.state.configuration;e=zo.createElement("div",{className:"profile-wrapper"},zo.createElement("div",{className:"developer-manager",style:{height:"100%",overflow:"auto"}},zo.createElement("div",{className:"cards-wrapper"},zo.createElement("div",{className:"details-panel",style:{maxWidth:"1000px"}},zo.createElement("div",{className:"details-panel-header"},"Single sign-on settings"),zo.createElement("div",{className:"details-panel-body"},zo.createElement("table",{className:"details-table"},zo.createElement("tbody",null,zo.createElement("tr",null,zo.createElement("td",null,zo.createElement("div",{style:{position:"relative"}},zo.createElement("div",{className:"input-group",style:{width:"calc(100% - 43px)",borderCollapse:"unset",display:"inline-block"}},zo.createElement(ea.A,{name:"configuration",id:"configuration",className:"widget-version-json",width:"100%",height:"500px",value:t,disabled:!1,theme:"light",onValueChanged:this.onInputChanged})),zo.createElement("span",{className:"input-group-btn",style:{marginTop:"0px",marginLeft:"5px",position:"absolute"}},zo.createElement(Kt(),{className:"btn btn-white icon-only","data-clipboard-text":t,"button-tabIndex":"-1",style:{height:"30px"}},zo.createElement("i",{className:"fa fa-clipboard fa-lg"})))))),zo.createElement("tr",null,zo.createElement("td",null,zo.createElement("input",{type:"button",className:"btn btn-primary",value:"Save",disabled:!1,onClick:this.save}))))))))))}else e=zo.createElement("div",{className:"profile-wrapper"},zo.createElement("div",{className:"developer-manager",style:{height:"calc(100% - 75px)",overflow:"auto"}},zo.createElement("div",{className:"cards-wrapper"},zo.createElement("div",{className:"details-panel",style:{maxWidth:"1000px"}},zo.createElement("div",{className:"details-panel-header"},"SAML Configuration"),zo.createElement("div",{className:"details-panel-body"},zo.createElement("span",{style:{color:"red"}},"Access Denied"))))));return e}});var Ko=a(59577),qo=a(63533),Jo=a(29437),Xo=o().createClass({displayName:"UserSettings",getInitialState:function(){return{saveIconState:"Normal",createNewUser:!1}},componentWillMount:function(){"production"===window.processMode&&"https:"!=location.protocol&&(location.href="https:"+window.location.href.substring(window.location.protocol.length))},componentDidMount:function(){},onRouteChange:function(e,t){this.forceUpdate()},onNotification:function(e,t,a,i){this.refs.appHeader.onNotification(e,t,a,i)},render:function(){var e=this;if("production"===window.processMode&&"https:"!=location.protocol)return!1;var t,a,i,n,s,l=window.singularUser.id==window.singularUser.account.accountAdminId,r=0==window.singularUser.account.accountId,c=window.singularUser.isImpersonated,d=window.singularUser.account.is_sso,p="enterprise"==window.singularUser.account.subscription.subscription_plan,m=window.singularUser.account.permission.permDevTool,u={top:"9px",cursor:"default"},h={width:"20px",textAlign:"center",top:"8px"},f={display:"inline-block",top:"8px"};window.singularUser.account.permission.permUserManagement&&(t=o().createElement(Ko.A,{to:"/users/settings/useradmin",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-users",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"User Administration"))))),l&&(a=o().createElement(Ko.A,{to:"/users/settings/deleteaccount",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-eraser",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"Delete Account"))))),(c||(l||m)&&p)&&(i=o().createElement(Ko.A,{to:"/users/settings/accountAuditLog",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-archive",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"Audit Log"))))),(c||p||r)&&(n=o().createElement(Ko.A,{to:"/users/settings/analytics",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-line-chart",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"Analytics"))))),r&&(s=o().createElement(Ko.A,{to:"/users/settings/analyticsSpecial",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-laptop",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"Analytics Spécial")))));var g=!1;return(c||l||r)&&(g=!0),o().createElement(qo.A,{onChange:this.onRouteChange},o().createElement("div",{className:"height-100p"},o().createElement("div",{id:"singular-browser",className:"portal"},o().createElement(Ji,{ref:"appHeader"}),o().createElement("section",{className:"nav-bar"},o().createElement("div",{className:"left-area"},"Settings"),o().createElement("div",{className:"right-area"})),o().createElement("section",{className:"portal-content"},o().createElement("nav",{className:"singular-portal-nav"},o().createElement("div",{className:"navigator-wrapper"},o().createElement("ul",{className:"dashboard-tree"},o().createElement("ul",{id:"folder-tree-item-root"},o().createElement("li",{className:"subHeader",style:u},"Account"),o().createElement("ul",null,o().createElement(Ko.A,{to:"/users/settings/profile",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-user",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"My Profile")))),t,a,o().createElement(Ko.A,{to:"/users/settings/accountStatus",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-bar-chart",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"Usage")))),o().createElement(Ko.A,{to:"/users/settings/accountStorage",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-database",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"Storage")))),i,n,s),(l||m)&&o().createElement("li",{className:"subHeader",style:u},"Credentials"),(l||m)&&o().createElement("ul",null,o().createElement(Ko.A,{to:"/users/settings/credentialskey",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-key",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"OAuth Client")))),l&&d&&o().createElement(Ko.A,{to:"/users/settings/sso",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-user-secret",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"Single sign-on"))))),g&&o().createElement("li",{className:"subHeader",style:u},"Subscription"),g&&o().createElement("ul",null,o().createElement(Ko.A,{to:"/users/settings/subscription",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-envelope",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"Subscription Manager")))),o().createElement(Ko.A,{to:"/users/settings/billinghistory",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-usd",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"Billing History"))))),r&&o().createElement("li",{className:"subHeader",style:u},"Singular Admin"),r&&o().createElement("ul",null,o().createElement(Ko.A,{to:"/users/settings/mandrillreport",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-envelope-o",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"Mandrill Email Report"))))),r&&o().createElement("ul",null,o().createElement(Ko.A,{to:"/users/settings/cloudflare",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-external-link",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"Cloudflare CDN"))))),r&&o().createElement("ul",null,o().createElement(Ko.A,{to:"/users/settings/banners",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-envelope-open-o",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"Banners"))))),r&&o().createElement("ul",null,o().createElement(Ko.A,{to:"/users/settings/userinteraction",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-handshake-o",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"User Interaction"))))),o().createElement("li",{className:"subHeader",style:u},"Platform"),o().createElement("ul",null,o().createElement(Ko.A,{to:"/users/settings/about",activeClassName:"active"},o().createElement("li",null,o().createElement("i",{className:"fa fa-info",style:h}),o().createElement("span",{style:f},o().createElement("div",{className:"asset-label"},"About"))))))))),o().createElement(ho,{onRouteChange:this.onRouteChange},o().createElement(Jo.A,{path:"/users/settings/profile",component:function(){return o().createElement(Is,{onNotification:e.onNotification})}}),t&&o().createElement(Jo.A,{path:"/users/settings/useradmin",component:function(){return o().createElement(As,{onNotification:e.onNotification})}}),o().createElement(Jo.A,{path:"/users/settings/accountStatus",component:function(){return o().createElement(Bs,{onNotification:e.onNotification})}}),o().createElement(Jo.A,{path:"/users/settings/accountStorage",component:function(){return o().createElement(Xs,null)}}),i&&o().createElement(Jo.A,{path:"/users/settings/accountAuditLog",component:function(){return o().createElement(ao,{onNotification:e.onNotification})}}),n&&o().createElement(Jo.A,{path:"/users/settings/analytics",component:function(){return o().createElement(io.A,{mode:"settings",onNotification:e.onNotification})}}),r&&o().createElement(Jo.A,{path:"/users/settings/analyticsSpecial",component:function(){return o().createElement(po,{onNotification:e.onNotification})}}),(l||m)&&o().createElement(Jo.A,{path:"/users/settings/credentialskey",component:function(){return o().createElement(Ho,{onNotification:e.onNotification})}}),l&&d&&o().createElement(Jo.A,{path:"/users/settings/sso",component:function(){return o().createElement($o,{onNotification:e.onNotification})}}),a&&o().createElement(Jo.A,{path:"/users/settings/deleteaccount",component:function(){return o().createElement(Rs,{onNotification:e.onNotification})}}),g&&o().createElement(Jo.A,{path:"/users/settings/subscription",component:function(){return o().createElement(Ks,null)}}),g&&o().createElement(Jo.A,{path:"/users/settings/billinghistory",component:function(){return o().createElement(js,null)}}),r&&o().createElement(Jo.A,{path:"/users/settings/mandrillreport",component:function(){return o().createElement(yo,null)}}),r&&o().createElement(Jo.A,{path:"/users/settings/cloudflare",component:function(){return o().createElement(So,null)}}),r&&o().createElement(Jo.A,{path:"/users/settings/banners",component:function(){return o().createElement(xo,{onNotification:e.onNotification})}}),r&&o().createElement(Jo.A,{path:"/users/settings/userinteraction",component:function(){return o().createElement(Uo,{onNotification:e.onNotification})}}),o().createElement(Jo.A,{path:"/users/settings/about",component:function(){return o().createElement(Ys,null)}}))))))}});const Zo=Xo;function Qo(e){return Qo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qo(e)}function el(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,i)}return a}function tl(e){for(var t=1;ti?1:0})),t.setState({userBusy:!1,userData:i})}})),this.getLogHandler=S().get("/apiv1/accounts/"+e+"/metadatalogs").end((function(e,a){t.getLogHandler=null,e?(t.setState({logBusy:!1}),t.props.onNotification&&t.props.onNotification("Cannot Fetch Change Log","error",5,"tc")):t.setState({logBusy:!1,changeLog:a.body})}))},onShowViewLogsDialog:function(){$("#ShowLogModal").modal("show")},onShowEditNotesDialog:function(){$("#EditNotesModal").modal("show")},onSaveNotes:function(){var e=$(this.refs.accountNotes).val();this.setState({savingNotesBusy:!0}),S().put("/apiv1/accounts/"+this.props.account.id+"/metadata").send({info:e}).end(function(e,t){this.setState({savingNotesBusy:!1}),e?this.props.onNotification("Error while saving notes","error",5,"tc"):($("#EditNotesModal").modal("hide"),this.props.onRequestReload())}.bind(this))},onStripeIdClicked:function(e){e.target.select()},onCheckButtonChanged:function(e,t){var a=Object.assign({},this.state.mutatedAccount);t.target.checked?a[e]=1:a[e]=0,this.setState({mutatedAccount:a})},verifyAccountEmail:function(e){var t={account_id:this.props.account.id};S().post("/apiv1/accounts/verifyemail",t).end(function(e,t){e?this.props.onNotification("Error while verifying email","error",5,"tc"):this.props.onNotification("Email has been verified","success",5,"tc")}.bind(this))},onImpersonateUser:function(e,t){this.props.onNotification("Impersonating to '"+t+"'","info",5,"tc"),S().post("/apiv1/accounts/impersonate").send({account_id:this.props.account.id,user_id:e}).end(function(e,t){e?(console.error(e),this.props.onNotification("Impersonate Error","error",5,"tc")):"success"==t.body.message?(this.props.onNotification("Impersonate Sucess waiting to redirect","success",5,"tc"),window.location=window.location.origin):this.props.onNotification("Impersonate Error","error",5,"tc")}.bind(this))},onNumberChanged:function(e,t){var a=Object.assign({},this.state.mutatedAccount);a[e]=t,this.setState({mutatedAccount:a})},onDropDownChanged:function(e,t){var a=Object.assign({},this.state.mutatedAccount);a[e]=t,"subscription_plan"==e&&(a=nl.GetDefaultAccountValues(t,a),"event-3days"!=t&&"event-7days"!=t&&"event-30days"!=t||(a.subscription_plan="event")),this.setState({mutatedAccount:a})},onExpirationDateChanged:function(e){var t=Object.assign({},this.state.mutatedAccount);t.expires_on=ge()(e,"x").utc().format("YYYY-MM-DDTHH:mm:ss.000Z"),this.setState({mutatedAccount:t})},onExecuteFeaturesSave:function(){this.setState({updateAccountBusy:!0}),this.props.onActiveAccountPropertiesChanged&&this.props.onActiveAccountPropertiesChanged(this.state.mutatedAccount),S().put("/apiv1/accounts/"+this.props.account.id+"/metadata").send(this.state.mutatedAccount).end(function(e,t){if(e)console.log("cannot save account data");else if(t.headers.location)return void(window.location=t.headers.location);this.setState({updateAccountBusy:!1}),this.fetchAccount(this.props.account.id)}.bind(this))},OnCancelFeatureSave:function(){this.setState({mutatedAccount:Object.assign({},this.state.accountData)})},onToggleInfo:function(){this.setState({infoPanelLarge:!this.state.infoPanelLarge})},onToggleFeatures:function(){this.setState({featuresPanelLarge:!this.state.featuresPanelLarge})},onToggleStorage:function(){this.setState({storagePanelLarge:!this.state.storagePanelLarge})},getStorageLimitTitle:function(e){var t=this,a=nl.StorageLimits.find((function(e){return e.id==t.state.mutatedAccount.storage_limit}));return a?a.title:0},getDailyApiLimitTitle:function(e){var t=nl.DailyApiLimits.find((function(t){return t.id==e}));return t?t.title:0},getDailyDataLimitTitle:function(e){var t=nl.DailyDataLimits.find((function(t){return t.id==e}));return t?t.title:0},getBurstApiLimitTitle:function(e){var t=nl.BurstApiLimits.find((function(t){return t.id==e}));return t?t.title:0},getBurstDataLimitTitle:function(e){var t=nl.BurstDataLimits.find((function(t){return t.id==e}));return t?t.title:0},getSubscriptionTitle:function(e){var t=nl.SubscriptionPlans.find((function(t){return t.id==e}));return t?t.title:"free"},render:function(){var e=this;if(this.state.updateAccountBusy||this.state.accountBusy||this.state.userBusy)return o().createElement("div",{style:{width:"100px",margin:"0 auto"}},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"}));if(!this.props.account||!this.state.accountData||!this.state.userData)return null;var t,a,i=this.state.mutatedAccount;t=i.email_verified?o().createElement("td",{style:{height:"39px",color:"green"}},"Verified"):o().createElement("td",null,o().createElement("button",{className:"btn btn-white",tabIndex:"-1",onClick:this.verifyAccountEmail},"Manually Verify Email"));var n,s="fa fa-chevron-up";if(this.state.storagePanelLarge&&(a=o().createElement("div",{style:{width:"400px"}},o().createElement(Js,{accountId:this.props.account.id})),s="fa fa-chevron-down"),this.state.userBusy)n=o().createElement("div",null,o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader",style:{width:"50px",height:"40px"}}));else{var l=function(e){var t,a;return t=0==e.emailVerified?o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"pending"},"Email address is not verified yet")},o().createElement("i",{className:"fa fa-circle account-status pending"})):e.id==i.admin_user_id?o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"admin"},"This is the admin user")},o().createElement("i",{className:"fa fa-diamond account-status active"})):o().createElement("i",{className:"fa fa-circle account-status active"}),a=e.verified_email_link?o().createElement(Kt(),{className:"btn btn-white icon-only","data-clipboard-text":e.verified_email_link,"button-tabIndex":"-1",style:{height:"32px",margin:"0px",padding:"0px"}},o().createElement(j(),{placement:"top",delayShow:500,overlay:o().createElement(z(),{id:"verifyLink"},"Copy the verify link to the clipboard")},o().createElement("i",{className:"fa fa-clipboard fa-lg",style:{padding:"9px"}}))):o().createElement("button",{className:"btn btn-white",title:"impersonate",style:{height:"32px"},onClick:this.onImpersonateUser.bind(this,e.id,e.email)},o().createElement("i",{className:"fa fa-sign-in fa-lg",style:{left:"0px",top:"0px"}})),o().createElement("tr",{key:e.id},o().createElement("td",{style:{textAlign:"center"}},t),o().createElement("td",{style:{textAlign:"center"}},e.id),o().createElement("td",null,e.firstName," ",e.lastName),o().createElement("td",null,e.email),o().createElement("td",null,a))}.bind(this);n=o().createElement("div",{className:"property-group",style:{width:"100%",overflow:"hidden",margin:"0px",flexGrow:"1"}},o().createElement("div",{className:"group-title",style:{minHeight:"0px",padding:"5px 10px"}},"User List"),o().createElement("div",{className:"group-body",style:{height:"calc(100% - 35px)",width:"calc(100% - 10px)",overflowY:"scroll"}},o().createElement("table",{className:"widget-version-list"},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",{style:{width:"5%",textAlign:"center"}}),o().createElement("th",{style:{width:"10%",textAlign:"center"}},"ID"),o().createElement("th",{style:{width:"30%",textAlign:"left"}},"Name"),o().createElement("th",{style:{width:"45%",textAlign:"left"}},"Email"),o().createElement("th",{style:{width:"10%",textAlign:"center"}}))),o().createElement("tbody",null,this.state.userData.map(l)))))}var r,c,d=il.compareObject(this.state.accountData,i),p=o().createElement("div",null,o().createElement("button",{className:"btn btn-secondary",style:{width:"100px",fontSize:"11px",padding:"3.75px 10px"},onClick:this.onExecuteFeaturesSave,disabled:d},"Save"),o().createElement("button",{className:"btn btn-secondary",style:{width:"100px",marginLeft:"5px",fontSize:"11px",padding:"3.75px 10px"},onClick:this.OnCancelFeatureSave,disabled:d},"Cancel"));if("free"!==i.subscription_plan){var m,u=new Date;if(i.expires_on){u=ge()(i.expires_on).toDate();var h=ge()(i.expires_on).diff(ge()());m=h<0?o().createElement("span",{style:{marginLeft:"20px",alignSelf:"center",color:"red"}},"Expired "+il.millisecondsToString(-h,"short")+" ago"):o().createElement("span",{style:{marginLeft:"20px",alignSelf:"center"}},il.millisecondsToString(h,"short")+" left")}r=o().createElement("div",{style:{display:"flex",alignSelf:"center"}},o().createElement("span",{style:{marginLeft:"20px",marginRight:"10px",alignSelf:"center"}},"Expires on"," "),o().createElement("div",{style:{width:"120px"}},o().createElement(us(),{value:u,className:"singular-date-time",inputProps:{placeholder:"Expiration Date",readOnly:"false"},dateFormat:"YYYY-MM-DD",timeFormat:"HH:mm",onChange:this.onExpirationDateChanged})),m)}c=1==this.state.savingNotesBusy?o().createElement("div",{className:"modal-footer"},o().createElement("button",{className:"btn btn-secondary"},"Saving...")):o().createElement("div",{className:"modal-footer"},o().createElement("button",{className:"btn btn-primary",onClick:this.onSaveNotes},"OK"),o().createElement("button",{className:"btn btn-secondary","data-dismiss":"modal","aria-label":"Close"},"Cancel"));var f,g=function(t,a){return o().createElement("div",{key:a},o().createElement("div",{style:{display:"flex",justifyContent:"space-between",fontWeight:"bold",width:"100%"}},o().createElement("div",null,ge()(t.created_at).format("YYYY-MM-DD HH:mm:ss")),o().createElement("div",null,"User ID ",t.created_by_user)),o().createElement("table",{style:{marginTop:"10px",marginBottom:"20px",width:"100%"}},o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",{style:{width:"50%",textAlign:"left"}}),o().createElement("th",{style:{width:"50%",textAlign:"right"}}))),o().createElement("tbody",null,(n=JSON.parse(t.before),s=JSON.parse(t.request),i=Object.keys(s).reduce((function(e,t){return n[t]===s[t]?e:tl(tl({},e),{},al({},t,s[t]))}),{}),Object.keys(i).map((function(t,a){return o().createElement("tr",{key:a},o().createElement("td",null,function(e){switch(e){case"storage_limit":return"Storage Limit";case"daily_api_limit":return"Daily API Limit";case"burst_api_limit":return"Burst API Limit";case"daily_data_limit":return"Daily Data Limit";case"burst_data_limit":return"Burst Data Limit";case"subscription_plan":return"Subscription";case"expires_on":return"Expiration Date";case"user_limit":return"Number of users";case"weboutput_limit":return"Number of outputs";case"is_sso":return"Single Sign-on";case"noWatermark":return"Hide Watermark";case"app_concurrent_limit":return"Concurrent viewers";default:return e}}(t)),o().createElement("td",{style:{textAlign:"right"}},function(t,a){switch(t){case"storage_limit":return e.getStorageLimitTitle(a);case"daily_api_limit":return e.getDailyApiLimitTitle(a);case"burst_api_limit":return e.getBurstApiLimitTitle(a);case"daily_data_limit":return e.getDailyDataLimitTitle(a);case"burst_data_limit":return e.getBurstDataLimitTitle(a);case"subscription_plan":return e.getSubscriptionTitle(a);case"expires_on":return a?ge()(a).format("YYYY-MM-DD HH:mm:ss"):"No date defined";case"is_sso":case"noWatermark":return a?"On":"Off";default:return a}}(t,i[t])))}))))));var i,n,s};f=this.state.logBusy?o().createElement("div",{style:{width:"100px",margin:"0 auto"}},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"})):this.state.changeLog&&this.state.changeLog.length?o().createElement("div",{style:{maxWidth:"400px",margin:"0 auto"}},this.state.changeLog.map((function(e,t){return g(e,t)}))):o().createElement("div",{style:{width:"100%",textAlign:"center"}},"No log messages exist");var v,b="";i.info&&(b=i.info);var y,E="fa fa-chevron-up";if(this.state.infoPanelLarge){E="fa fa-chevron-down";var w,S,N="Never";i.lastloggedin_at&&(N=ge()(i.lastloggedin_at).format("YYYY-MM-DD HH:mm:ss")),w="uno"==i.brand?"Uno":"Singular",S=i.use_datastore?"Datastore":"Firebase",v=o().createElement("div",{className:"group-body"},o().createElement("table",{style:{width:"65%",display:"inline-block"}},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{className:"label-col",style:{width:"20%"}},"Name"),o().createElement("td",{style:{width:"80%"}},i.name)),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Stripe Id"),o().createElement("td",null,i.stripe_customer_id?i.stripe_customer_id:"not registered")),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"S3 Storage Id"),o().createElement("td",null,i.uniq_id?i.uniq_id:"not available")),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Status"),t))),o().createElement("table",{style:{width:"35%",float:"right"}},o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{className:"label-col",style:{width:"20%"}},"Created"),o().createElement("td",{style:{width:"80%"}},ge()(i.created_at).format("YYYY-MM-DD HH:mm:ss"))),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Changed"),o().createElement("td",null,ge()(i.updated_at).format("YYYY-MM-DD HH:mm:ss"))),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Last login"),o().createElement("td",null,N)),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Brand"),o().createElement("td",null,w)),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Storage"),o().createElement("td",null,S)))))}var C="fa fa-chevron-up";return this.state.featuresPanelLarge&&(C="fa fa-chevron-down",y=o().createElement("div",{className:"group-body"},o().createElement("table",{style:{width:"100%"}},o().createElement("tbody",null,o().createElement("tr",{style:{borderBottom:"1px solid #e3e3e3"}},o().createElement("td",{className:"label-col"},"Subscription"),o().createElement("td",{colSpan:"3"},o().createElement("div",{style:{display:"flex"}},o().createElement("div",{className:"form-group"},o().createElement("div",{className:"btn-group"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{width:"170px",top:"-2px",height:"30px",margin:"2px 0px"}},this.getSubscriptionTitle(i.subscription_plan)),o().createElement("ul",{className:"dropdown-menu",style:{maxHeight:"none"}},nl.SubscriptionPlans.map((function(t,a){return o().createElement("li",{key:a},o().createElement("a",{onClick:e.onDropDownChanged.bind(e,"subscription_plan",t.id)},t.title))}))))),r))),o().createElement("tr",{style:{height:"5px"}}),o().createElement("tr",null,o().createElement("td",{className:"label-col",style:{width:"10%"}},"Daily API Limit"),o().createElement("td",{style:{width:"40%"}},o().createElement("div",{className:"form-group"},o().createElement("div",{className:"btn-group"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{width:"170px",top:"-2px",height:"30px",margin:"2px 0px"}},this.getDailyApiLimitTitle(i.daily_api_limit)),o().createElement("ul",{className:"dropdown-menu",style:{maxHeight:"none"}},nl.DailyApiLimits.map((function(t,a){return o().createElement("li",{key:a},o().createElement("a",{onClick:e.onDropDownChanged.bind(e,"daily_api_limit",t.id)},t.title))})))))),o().createElement("td",{className:"label-col",style:{width:"10%"}},"Burst API Limit"),o().createElement("td",{style:{width:"40%"}},o().createElement("div",{className:"form-group"},o().createElement("div",{className:"btn-group"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{width:"170px",top:"-2px",height:"30px",margin:"2px 0px"}},this.getBurstApiLimitTitle(i.burst_api_limit)),o().createElement("ul",{className:"dropdown-menu",style:{maxHeight:"none"}},nl.BurstApiLimits.map((function(t,a){return o().createElement("li",{key:a},o().createElement("a",{onClick:e.onDropDownChanged.bind(e,"burst_api_limit",t.id)},t.title))}))))))),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Daily Data Limit"),o().createElement("td",null,o().createElement("div",{className:"form-group"},o().createElement("div",{className:"btn-group"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{width:"170px",top:"-2px",height:"30px",margin:"2px 0px"}},this.getDailyDataLimitTitle(i.daily_data_limit)),o().createElement("ul",{className:"dropdown-menu",style:{maxHeight:"none"}},nl.DailyDataLimits.map((function(t,a){return o().createElement("li",{key:a},o().createElement("a",{onClick:e.onDropDownChanged.bind(e,"daily_data_limit",t.id)},t.title))})))))),o().createElement("td",{className:"label-col"},"Burst Data Limit"),o().createElement("td",null,o().createElement("div",{className:"form-group"},o().createElement("div",{className:"btn-group"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{width:"170px",top:"-2px",height:"30px",margin:"2px 0px"}},this.getBurstDataLimitTitle(i.burst_data_limit)),o().createElement("ul",{className:"dropdown-menu",style:{maxHeight:"none"}},nl.BurstDataLimits.map((function(t,a){return o().createElement("li",{key:a},o().createElement("a",{onClick:e.onDropDownChanged.bind(e,"burst_data_limit",t.id)},t.title))}))))))),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Storage Limit"),o().createElement("td",null,o().createElement("div",{className:"form-group"},o().createElement("div",{className:"btn-group"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{width:"170px",top:"-2px",height:"30px",margin:"2px 0px"}},this.getStorageLimitTitle(i.storage_limit)),o().createElement("ul",{className:"dropdown-menu",style:{maxHeight:"none"}},nl.StorageLimits.map((function(t,a){return o().createElement("li",{key:a},o().createElement("a",{onClick:e.onDropDownChanged.bind(e,"storage_limit",t.id)},t.title))}))))))),o().createElement("tr",null,o().createElement("td",{className:"label-col"},"Number of Users"),o().createElement("td",null,o().createElement(te.A,{name:"user_limit",resetValue:"0",step:"1",format:"0",min:"0",max:"999999",value:i.user_limit,onValueChanged:this.onNumberChanged,theme:"light",width:"125px"})),o().createElement("td",{className:"label-col"},"Number of Outputs"),o().createElement("td",null,o().createElement(te.A,{name:"weboutput_limit",resetValue:"0",step:"1",format:"0",min:"0",max:"999999",value:i.weboutput_limit,onValueChanged:this.onNumberChanged,theme:"light",width:"125px"}))),o().createElement("tr",null,o().createElement("td",{className:"label-col",style:{height:"40px"}},"Hide Watermark"),o().createElement("td",null,o().createElement("div",{className:"checkbox"},o().createElement("div",{className:"bar",style:{position:"relative"}},o().createElement("input",{type:"checkbox",id:"chkWatermark",checked:i.noWatermark,onChange:function(t){e.onCheckButtonChanged("noWatermark",t)}}),o().createElement("label",{htmlFor:"chkWatermark",className:"checkbox-label"})))),o().createElement("td",{className:"label-col"},"Single sign-on"),o().createElement("td",null,o().createElement("div",{style:{display:"flex"}},o().createElement("div",{className:"checkbox"},o().createElement("div",{className:"bar",style:{position:"relative"}},o().createElement("input",{type:"checkbox",id:"chkIsSSO",checked:i.is_sso,onChange:function(t){e.onCheckButtonChanged("is_sso",t)}}),o().createElement("label",{htmlFor:"chkIsSSO",className:"checkbox-label"})))))),o().createElement("tr",null,o().createElement("td",null),o().createElement("td",{colSpan:"3"},p)))))),o().createElement("div",{style:{height:"100%"}},o().createElement("div",{className:"profile-properties",style:{margin:"0px"}},o().createElement("div",{className:"property-group",style:{width:"100%",margin:"0px"}},o().createElement("div",{className:"group-title",style:{minHeight:"0px",padding:"5px 10px"}},"Info",o().createElement("button",{className:"btn btn-white icon-only v2 pull-right",style:{position:"relative",top:"-1px",margin:"0px",padding:"3.75px 10px"},tabIndex:"-1",onClick:this.onToggleInfo},o().createElement("i",{className:E}))),v),o().createElement("div",{className:"property-group",style:{width:"100%",margin:"0px"}},o().createElement("div",{className:"group-title",style:{minHeight:"0px",padding:"5px 10px"}},"Features",o().createElement("button",{className:"btn btn-white icon-only v2 pull-right",style:{position:"relative",top:"-1px",margin:"0px",padding:"3.75px 10px"},tabIndex:"-1",onClick:this.onToggleFeatures},o().createElement("i",{className:C}))),y),o().createElement("div",{className:"property-group",style:{width:"100%",margin:"0px"}},o().createElement("div",{className:"group-title",style:{minHeight:"0px",padding:"5px 10px"}},"Dashboard Storage Stats",o().createElement("button",{className:"btn btn-white icon-only v2 pull-right",style:{position:"relative",top:"-1px",margin:"0px",padding:"3.75px 10px"},tabIndex:"-1",onClick:this.onToggleStorage},o().createElement("i",{className:s}))),a),n),o().createElement("div",{id:"EditNotesModal",className:"modal fade u-displaynone singular-modal singular-modal-white ",tabIndex:"-1",role:"dialog"},o().createElement("div",{className:"modal-dialog modal-lg",role:"document"},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-header"},o().createElement("button",{tabIndex:"-1",className:"close","data-dismiss":"modal","aria-label":"Close"},o().createElement("span",{"aria-hidden":"true"},o().createElement("i",{style:{width:"20px",height:"20px",position:"relative"},className:"fa fa-times"}))),o().createElement("h4",{className:"modal-title",id:"myModalLabel"},"Add notes to the account")),o().createElement("div",{className:"modal-body",style:{borderRadius:"0px"}},o().createElement("textarea",{ref:"accountNotes",className:"form-control align-left text-input",defaultValue:b,onChange:function(){},style:{height:"250px"}})),c))),o().createElement("div",{id:"ShowLogModal",className:"modal fade u-displaynone singular-modal singular-modal-white ",tabIndex:"-1",role:"dialog"},o().createElement("div",{className:"modal-dialog modal-lg",role:"document",style:{width:"50%",maxWidth:"800px"}},o().createElement("div",{className:"modal-content"},o().createElement("div",{className:"modal-header"},o().createElement("button",{tabIndex:"-1",className:"close","data-dismiss":"modal","aria-label":"Close"},o().createElement("span",{"aria-hidden":"true"},o().createElement("i",{style:{width:"20px",height:"20px",position:"relative"},className:"fa fa-times"}))),o().createElement("h4",{className:"modal-title",id:"myModalLabel"},"Change log of ",i.name)),o().createElement("div",{className:"modal-body",style:{height:"700px",minHeight:"700px",overflowY:"auto",color:"#808080"}},f)))))}});function ol(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a0?this.selectAccount(this.state.accounts[0]):this.selectAccount(null)},onActiveAccountPropertiesChanged:function(e){this.setState({mutateAccountData:Object.assign({},e)});var t=this.state.accounts.slice();for(var a in t)if(t[a].id==e.id){t[a]=e,this.setState({accounts:this.executeSortAccounts(t,this.state.sortList)});break}},onRequestReload:function(){this.loadAccounts(this.accountSearch,this.props.tenantFilter,this.props.filterBrand)},onSearchChange:function(e){this.loadAccounts(e,this.props.tenantFilter,this.props.filterBrand)},showEditNotesDialog:function(){this.refs.accountInfo.onShowEditNotesDialog&&this.refs.accountInfo.onShowEditNotesDialog()},showViewLogsDialog:function(){this.refs.accountInfo.onShowViewLogsDialog&&this.refs.accountInfo.onShowViewLogsDialog()},applyAccountFilter:function(e){switch(this.props.filterProperty){case"all":break;case"notConfirmed":if(e.email_verified)return!1;break;case"withWatermark":if(e.noWatermark)return!1;break;case"withoutWatermark":if(!e.noWatermark)return!1;break;case"storageDataStore":if(!e.use_datastore)return!1;break;case"storageFirebase":if(e.use_datastore)return!1;break;case"ssoEnabled":if(!e.is_sso)return!1;break;case"onDeviceEnabled":if(!e.enableOnDeviceGraphics)return!1;break;case"onDeviceDisabled":if(e.enableOnDeviceGraphics)return!1;break;case"withNotes":if(!e.info)return!1;break;case"subscriptionFree":if("free"!==e.subscription_plan)return!1;break;case"subscriptionProfessional":if("professional"!==e.subscription_plan)return!1;break;case"subscriptionEnterprise":if("enterprise"!==e.subscription_plan)return!1;break;case"subscriptionNonprofit":if("nonprofit"!==e.subscription_plan)return!1;break;case"subscriptionTrial":if("trial"!==e.subscription_plan)return!1;break;case"subscriptionEvent":if("event"!==e.subscription_plan)return!1;break;case"subscriptionUnoPlus":if("unoplus"!==e.subscription_plan)return!1;break;case"subscriptionUnoElite":if("unoelite"!==e.subscription_plan)return!1;break;case"login30days":if(!e.lastloggedin_at||ge()().diff(ge()(e.lastloggedin_at),"days")>30)return!1;break;case"login7days":if(!e.lastloggedin_at||ge()().diff(ge()(e.lastloggedin_at),"days")>7)return!1}return!0},exportAccountData:function(){var e=this,t=this.state.accounts.filter((function(t){return e.applyAccountFilter(t)})).slice();for(var a in t)delete t[a].tenant_id,delete t[a].enableOnDeviceGraphics,delete t[a].is_activated,delete t[a].info,delete t[a].is_sso,delete t[a].use_datastore;var i,n=function(e,t){return null===t?"":t},s=Object.keys(t[0]),o=[s.join(",")].concat((i=t.map((function(e){return s.map((function(t){return JSON.stringify(e[t],n)})).join(",")})),function(e){if(Array.isArray(e))return ol(e)}(i)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return ol(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?ol(e,t):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())).join("\r\n"),l=new Blob([o],{type:"text/plain;charset=utf-8"});Gt().saveAs(l,"Accounts.csv")},onSortList:function(e){this.setState({sortList:e,accounts:this.executeSortAccounts(this.state.accounts,e)})},executeSortAccounts:function(e,t){var a=e.slice();return a.sort((function(e,a){switch(t){case"subscription":return e.subscription_plan==a.subscription_plan?e.name.localeCompare(a.name):e.subscription_plan.localeCompare(a.subscription_plan);case"name":default:return e.name.localeCompare(a.name);case"id":return e.id>a.id?1:e.ida.lastloggedin_at?-1:e.lastloggedin_ata.created_at?-1:e.created_ata.expires_on?1:e.expires_on250&&!1===a.state.showAllAccounts)return null;n++;var m,u="";return a.state.activeAccount&&a.state.activeAccount.id==e.id&&(u=" active"),e.info&&(m=o().createElement(j(),{placement:"right",delayShow:500,overlay:o().createElement(z(),{id:"info"+e.id},e.info)},o().createElement("i",{className:"fa fa-sticky-note-o"}))),o().createElement("tr",{key:e.id,onMouseDown:a.selectAccount.bind(a,e),className:u},o().createElement("td",{style:{textAlign:"center"}},e.id),o().createElement("td",{style:{textAlign:"center"}},m),o().createElement("td",{style:{textAlign:"left"}},e.name),o().createElement("td",{style:{textAlign:"center"}},d),o().createElement("td",{style:{textAlign:"center"}},s),o().createElement("td",{style:{textAlign:"center"}},l),o().createElement("td",{style:{textAlign:"center"}},ge()(e.created_at).format("YYYY-MM-DD HH:mm:ss")),o().createElement("td",{style:{textAlign:"center"}},r))}));e=o().createElement("table",{className:"portal-table",style:{overflowY:"scroll",marginTop:"0px",marginBottom:"0px"}},s,o().createElement("tbody",null,l,function(){if(i>n)return o().createElement("tr",null,o().createElement("td",{colSpan:"100%",style:{textAlign:"center"}},o().createElement("button",{className:"btn btn-white",onClick:function(){a.setState({showAllAccounts:!0})}},"Show all accounts")))}())),this.props.onNumberOfAccountsInList&&this.props.onNumberOfAccountsInList(i),t=o().createElement(sl,{account:this.state.activeAccount,tenantAccounts:this.props.tenantAccounts,onActiveAccountPropertiesChanged:this.onActiveAccountPropertiesChanged,onRequestReload:this.onRequestReload,onNotification:this.props.onNotification,ref:"accountInfo"})}return o().createElement("div",{className:"profile-wrapper",style:{height:"100%",overflowY:"auto",width:"100%",position:"relative",top:"-11px"}},o().createElement("div",{className:"user-administration-wrapper",style:{marginRight:"-5px"}},o().createElement("div",{className:"user-list",style:{padding:"0px"}},e),o().createElement("div",{className:"profile-wrapper"},t)))}});var dl=[{id:"all",title:"All"},{id:"notConfirmed",title:"Email not confirmed"},{id:"withWatermark",title:"With Watermark"},{id:"withoutWatermark",title:"Without Watermark"},{id:"storageFirebase",title:"Storage Firebase"},{id:"storageDataStore",title:"Storage Datastore"},{id:"ssoEnabled",title:"Single sign-on Enabled"},{id:"subscriptionFree",title:"Subscription - Free"},{id:"subscriptionProfessional",title:"Subscription - Professional"},{id:"subscriptionEnterprise",title:"Subscription - Enterprise"},{id:"subscriptionNonprofit",title:"Subscription - Nonprofit / Schools"},{id:"subscriptionEvent",title:"Subscription - Event"},{id:"subscriptionTrial",title:"Subscription - Enterprise Trial"},{id:"subscriptionUnoPlus",title:"Subscription - Uno Plus"},{id:"subscriptionUnoElite",title:"Subscription - Uno Elite"},{id:"withNotes",title:"With Notes"},{id:"login30days",title:"Last 30 days login"},{id:"login7days",title:"Last 7 days login"}],pl=[{id:"all",title:"All"},{id:"singular",title:"Singular"},{id:"uno",title:"Uno"}];const ml=o().createClass({displayName:"AccountSettings",getInitialState:function(){return this.AccountSearch="",{tenantAccounts:[],tenantFilter:"none",filterProperty:"all",filterBrand:"singular",numberOfAccountsInList:void 0}},componentDidMount:function(){var e=this;S().get("/apiv1/tenants").set("Content-Type","application/json").end((function(t,a){if(a.headers.location)window.location=a.headers.location;else{var i=[];t?console.log("error while reading tenant accounts: "+t):i=a.body,i.sort((function(e,t){return e.name.localeCompare(t.name)})),e.setState({tenantAccounts:i})}}))},shouldComponentUpdate:function(e,t){return!Un().compareObject(e,this.props)||!Un().compareObject(t,this.state)},onAccountSearchChange:function(e){this.AccountSearch=e},onAccountSearchClick:function(e){this.setState({}),this.refs.accountadmin.onSearchChange&&this.refs.accountadmin.onSearchChange(this.AccountSearch)},onAccountClearSearchClick:function(){this.AccountSearch="",this.refs.accountadmin.onSearchChange&&this.refs.accountadmin.onSearchChange(this.AccountSearch)},onTenantFilterChanged:function(e){this.setState({tenantFilter:e})},onFilterPropertyChanged:function(e){this.setState({filterProperty:e})},onFilterBrandChanged:function(e){this.setState({filterBrand:e})},showEditNotesDialog:function(){this.refs.accountadmin.showEditNotesDialog&&this.refs.accountadmin.showEditNotesDialog()},showViewLogDialog:function(){this.refs.accountadmin.showViewLogsDialog&&this.refs.accountadmin.showViewLogsDialog()},exportAccountData:function(){this.refs.accountadmin.showViewLogsDialog&&this.refs.accountadmin.exportAccountData()},onNotification:function(e,t,a,i){this.refs.appHeader.onNotification(e,t,a,i)},onNumberOfAccountsInList:function(e){e!=this.state.numberOfAccountsInList&&this.setState({numberOfAccountsInList:e})},GetTenantMenuName:function(e){if("all"==e)return"All Accounts in all tenants";if("none"==e)return"Not in a tenant";var t=this.state.tenantAccounts.find((function(t){return t.id==e}));return t.name+" - "+t.account_id},render:function(){var e=this;return o().createElement("div",{style:{height:"100%"}},o().createElement(Ji,{useSearch:"true",onSearch:this.onAccountSearchChange,onSearchClick:this.onAccountSearchClick,onClearSearchClick:this.onAccountClearSearchClick,ref:"appHeader"}),o().createElement("div",{id:"singular-browser"},o().createElement("div",{className:"singular-browser-body"},o().createElement("div",{className:"singular-browser-content",style:{width:"100%",left:"0px",overflow:"hidden"}},o().createElement("div",{className:"singular-browser-body-tools",style:{height:"var(--nav-bar-height)",background:"var(--secondary-bg-color)",position:"relative",boxShadow:"inset rgba(0, 0, 0, 0.3) 0px 5px 10px 0px",textShadow:"none"}},o().createElement("ul",{className:"singular-browser-breadcrumb",style:{position:"relative",float:"left",top:"-8px"}},o().createElement("li",null,"Account Management")),o().createElement("div",{style:{float:"left",position:"relative",left:"20px",top:"16px",display:"none"}},o().createElement("div",{className:"form-group"},o().createElement("label",{style:{color:"white"}},"Tenant"),o().createElement("div",{className:"btn-group"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{width:"170px",top:"-2px",height:"30px"}},this.GetTenantMenuName(this.state.tenantFilter)),o().createElement("ul",{className:"dropdown-menu"},o().createElement("li",{key:"all"},o().createElement("a",{onClick:this.onTenantFilterChanged.bind(this,"all")},this.GetTenantMenuName("all"))),o().createElement("li",{key:"none"},o().createElement("a",{onClick:this.onTenantFilterChanged.bind(this,"none")},this.GetTenantMenuName("none"))),this.state.tenantAccounts.map((function(t,a){return o().createElement("li",{key:a},o().createElement("a",{onClick:e.onTenantFilterChanged.bind(e,t.id)},e.GetTenantMenuName(t.id)))})))))),o().createElement("div",{style:{float:"left",position:"relative",left:"20px",top:"16px"}},o().createElement("div",{className:"form-group"},o().createElement("label",{style:{color:"white"}},"Brand"),o().createElement("div",{className:"btn-group"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{width:"200px",top:"-2px",height:"30px"}},pl.find((function(t){return t.id==e.state.filterBrand})).title),o().createElement("ul",{className:"dropdown-menu",style:{maxHeight:"none"}},pl.map((function(t,a){return o().createElement("li",{key:a},o().createElement("a",{onClick:e.onFilterBrandChanged.bind(e,t.id)},t.title))})))))),o().createElement("div",{style:{float:"left",position:"relative",left:"50px",top:"16px"}},o().createElement("div",{className:"form-group"},o().createElement("label",{style:{color:"white"}},"Filter"),o().createElement("div",{className:"btn-group"},o().createElement("button",{type:"button",tabIndex:"-1",className:"btn btn-default dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",style:{width:"200px",top:"-2px",height:"30px"}},dl.find((function(t){return t.id==e.state.filterProperty})).title),o().createElement("ul",{className:"dropdown-menu",style:{maxHeight:"400px"}},dl.map((function(t,a){return o().createElement("li",{key:a},o().createElement("a",{onClick:e.onFilterPropertyChanged.bind(e,t.id)},t.title))})))))),void 0!==this.state.numberOfAccountsInList&&o().createElement("div",{style:{float:"left",position:"relative",left:"80px",top:"25px",color:"white"}},this.state.numberOfAccountsInList," accounts"),o().createElement("div",{className:"dashboard-toolbar",style:{float:"right"}},o().createElement("button",{className:"btn btn-white",tabIndex:"-1",style:{width:"120px",margin:"19px 7px 18px 0px",height:"30px"},onClick:this.exportAccountData},o().createElement("i",{className:"fa fa-download",style:{marginRight:"5px"}})," ","Export CVS"),o().createElement("button",{className:"btn btn-white",tabIndex:"-1",style:{width:"120px",margin:"19px 7px 18px 0px",height:"30px"},onClick:this.showViewLogDialog},o().createElement("i",{className:"fa fa-info",style:{marginRight:"5px"}})," ","View Log"),o().createElement("button",{className:"btn btn-white",tabIndex:"-1",style:{width:"120px",margin:"19px 7px 18px 0px",height:"30px"},onClick:this.showEditNotesDialog},o().createElement("i",{className:"fa fa-sticky-note-o",style:{marginRight:"5px"}})," ","Edit Notes"))),o().createElement("div",{style:{height:"100%"}},o().createElement(cl,{id:"AccountAdministration",ref:"accountadmin",tenantFilter:this.state.tenantFilter,filterProperty:this.state.filterProperty,filterBrand:this.state.filterBrand,onNotification:this.onNotification,tenantAccounts:this.state.tenantAccounts,onNumberOfAccountsInList:this.onNumberOfAccountsInList}))))))}}),ul=o().createClass({displayName:"VisitorHeader",getInitialState:function(){return{}},render:function(){return o().createElement("div",{className:"visitor-header"},o().createElement("div",{className:"top-bar"},o().createElement("div",{style:{width:"200px"}},o().createElement("a",{href:"/",tabIndex:"-1"},o().createElement("img",{src:"/images/logo-v2.png",style:{width:"80%"}})))),o().createElement("div",{className:"secondary-bar"}))}}),hl=o().createClass({displayName:"ForgotPassword",getInitialState:function(){return{status:"",failedStatus:"",validForm:!1,loading:!1}},recoverPassword:function(){this.setState({loading:!0});var e="";this.refs.inputEmail&&(e=this.refs.inputEmail.value),S().post("/users/forgotpassword").send({email:e}).end(function(e,t){if(e)this.setState({status:"",failedStatus:t.body.error.message,loading:!1});else{if(t.headers.location)return void(window.location=t.headers.location);this.setState({status:"Recover email has been sent. Please check your email",failedStatus:"",loading:!1})}}.bind(this))},checkFields:function(){var e=!1;if(this.refs.inputEmail){var t=this.refs.inputEmail.value;t&&Ds().email(t)&&(e=!0)}this.setState({validForm:e})},renderContent:function(){return this.state.status?o().createElement("div",null,o().createElement("div",{className:"large-icon"},o().createElement("i",{className:"fa fa-check"})),o().createElement("div",{className:"center-line"},o().createElement("span",{style:{maxWidth:"400px"}},"We have sent an email if the email exists in our system. Please check your inbox for instructions to recover your password")),o().createElement("div",{className:"login-area",style:{marginTop:"30px"}},o().createElement("button",{className:"btn btn-lg btn-primary btn-block",onClick:function(){return window.location.href="/users/login"}},"Login to your account"))):o().createElement("div",null,o().createElement("div",{className:"center-line",style:{textAlign:"center",marginBottom:"20px"}},"Instructions to recover your password will be sent to the email entered below"),o().createElement("div",{className:"field-list"},o().createElement("div",{className:"center-line"},o().createElement("div",{className:"form-field"},o().createElement("div",{className:"form-label"},"Email Address"),o().createElement("div",{className:"form-input-container"},o().createElement("input",{type:"email",className:"form-input",id:"email",name:"email",required:!0,autoFocus:!0,autoComplete:"off",onChange:this.checkFields,ref:"inputEmail"}))))),o().createElement("div",{className:"center-line"}),o().createElement("div",{className:"login-area",style:{marginBottom:"25px"}},this.state.loading&&o().createElement("img",{src:"/images/loading-bubbles-blue.svg",style:{height:"40px"}}),!this.state.loading&&o().createElement("button",{className:"btn btn-lg btn-primary btn-block",onClick:this.recoverPassword,disabled:!this.state.validForm},"Request new password")),o().createElement("div",{className:"center-line"},"Already have an account? ",o().createElement("a",{href:"/users/login"},"Login")),o().createElement("div",{className:"message-box"},this.state.failedStatus&&o().createElement("div",{className:"error-message"},this.state.failedStatus)))},render:function(){return o().createElement("div",{className:"singular-layout login-section"},o().createElement(ul,null),o().createElement("div",{className:"section-body"},o().createElement("div",{className:"login-inner",style:{width:"40%"}},o().createElement("div",{className:"section-title"},"Forgot Password"),this.renderContent())))}}),fl=o().createClass({displayName:"ResetPassword",getInitialState:function(){return{status:"",failedStatus:"",formValid:!1,passwordState:null,passwordValid:!1,revealPassword:!1}},handlePassword:function(e){var t,a=!1;e.target.value.length>0?(t="pass",a=!0):t="",this.setState({passwordState:t,passwordValid:a},function(){this.checkForm()}.bind(this))},checkForm:function(){var e=!1;this.state.passwordValid&&(e=!0),this.setState({formValid:e})},togglePasswordReveal:function(e){this.setState({revealPassword:!this.state.revealPassword})},render:function(){var e="password";return 1==this.state.revealPassword&&(e="text"),o().createElement("div",{className:"singular-layout login-section"},o().createElement(ul,null),o().createElement("div",{className:"section-body"},o().createElement("div",{className:"login-inner",style:{width:"40%"}},o().createElement("div",{className:"section-title"},"Reset password"),o().createElement("form",{method:"POST",action:"/users/recoverpassword/"+window.singularEmailToken},o().createElement("input",{type:"hidden",id:"token",name:"token",value:window.singularEmailToken}),o().createElement("div",{className:"form-field "+this.state.passwordState},o().createElement("div",{className:"form-label"},"Password"),o().createElement("div",{className:"form-input-container"},o().createElement("input",{type:e,className:"form-input",id:"password",name:"password",autoComplete:"off",required:!0,onChange:this.handlePassword,ref:"password"})),o().createElement("div",{className:"password-reveal",onClick:this.togglePasswordReveal},!this.state.revealPassword&&o().createElement("i",{className:"fa fa-eye"}),this.state.revealPassword&&o().createElement("i",{className:"fa fa-eye-slash"}),"Show")),o().createElement("div",{className:"login-area",style:{marginTop:"30px"}},o().createElement("button",{className:"btn btn-lg btn-primary btn-block",type:"submit",disabled:!this.state.formValid},"Continue"))),o().createElement("div",{className:"message-box"},window.recoverPwdMsg&&o().createElement("div",{className:"error-message"},window.recoverPwdMsg)))))}}),gl=o().createClass({displayName:"InviteSetPassword",getInitialState:function(){return{validForm:!1,revealPassword:!1}},checkForm:function(){var e=!1;this.refs.password&&this.refs.password.value&&this.refs.password.value.length>0&&(e=!0),this.setState({validForm:e})},togglePasswordReveal:function(e){this.setState({revealPassword:!this.state.revealPassword})},render:function(){var e=this,t="password";return 1==this.state.revealPassword&&(t="text"),o().createElement("div",{className:"singular-layout login-section"},o().createElement(ul,null),o().createElement("div",{className:"section-body"},o().createElement("div",{className:"login-inner",style:{width:"40%"}},o().createElement("div",{className:"section-title"},"Set Your Password"),o().createElement("form",{action:"/users/invitesetpassword",className:"",method:"post",ref:"form"},o().createElement("div",{className:"field-list"},o().createElement("div",{className:"form-field"},o().createElement("div",{className:"form-label"},"Password"),o().createElement("div",{className:"form-input-container"},o().createElement("input",{type:t,className:"form-input",id:"password",name:"password",autoFocus:!0,autoComplete:"off",required:!0,onChange:this.checkForm,ref:"password"})),o().createElement("div",{className:"password-reveal",onClick:this.togglePasswordReveal},!this.state.revealPassword&&o().createElement("i",{className:"fa fa-eye"}),this.state.revealPassword&&o().createElement("i",{className:"fa fa-eye-slash"}),"Show"))),o().createElement("div",{className:"login-area",style:{marginTop:"25px",marginBottom:"10px"}},this.state.loading&&o().createElement("img",{src:"/images/loading-bubbles-blue.svg",style:{height:"40px"}}),!this.state.loading&&o().createElement("button",{className:"btn btn-lg btn-primary btn-block",type:"submit",disabled:!this.state.validForm,onClick:function(){e.setState({loading:!0}),e.refs.form.submit()}},"Log in")),o().createElement("input",{type:"hidden",id:"token",name:"token",value:window.singularEmailToken})))))}}),vl=o().createClass({displayName:"Login",getInitialState:function(){return{emailDirtyClass:"",passwordDirtyClass:"",inValidForm:!1,revealPassword:!1,singleSignOn:!!window.singularLoginSSO,loading:!1}},componentDidMount:function(){sessionStorage.setItem("sendLoginAnalytics",!1)},checkFields:function(){var e="",t="",a=!0;this.refs.inputEmail&&this.refs.inputEmail.value.length>0&&(e=" dirty"),this.refs.inputPassword&&this.refs.inputPassword.value.length>0&&(t=" dirty"),0==this.state.singleSignOn?this.refs.inputEmail.value.length>0&&this.refs.inputPassword.value.length>0&&(a=!1):this.refs.inputEmail.value.length>0&&(a=!1),this.setState({emailDirtyClass:e,passwordDirtyClass:t,inValidForm:a})},onSingleSignOn:function(e){this.setState({singleSignOn:e})},togglePasswordReveal:function(e){this.setState({revealPassword:!this.state.revealPassword})},render:function(){var e=this;if(0==this.state.singleSignOn){var t="password";return 1==this.state.revealPassword&&(t="text"),o().createElement("div",{className:"singular-layout login-section"},o().createElement(ul,null),o().createElement("div",{className:"section-body"},o().createElement("div",{className:"login-inner",style:{width:"40%"}},o().createElement("div",{className:"section-title"},"Login"),o().createElement("form",{action:window.location.pathname+window.location.search,className:"",method:"post",ref:"form"},o().createElement("div",{className:"field-list"},o().createElement("div",{className:"form-field"},o().createElement("div",{className:"form-label"},"Email Address"),o().createElement("div",{className:"form-input-container"},o().createElement("input",{type:"email",className:"form-input",id:"email",name:"email",required:!0,autoFocus:!0,autoComplete:"off",onChange:this.checkFields,ref:"inputEmail"}))),o().createElement("div",{className:"form-field"},o().createElement("div",{className:"form-label"},"Password"),o().createElement("div",{className:"form-input-container"},o().createElement("input",{type:t,className:"form-input",id:"password",name:"password",autoComplete:"off",required:!0,onChange:this.checkFields,ref:"inputPassword"})),o().createElement("div",{className:"password-reveal",onClick:this.togglePasswordReveal},!this.state.revealPassword&&o().createElement("i",{className:"fa fa-eye"}),this.state.revealPassword&&o().createElement("i",{className:"fa fa-eye-slash"}),"Show"))),o().createElement("div",{className:"login-area",style:{marginTop:"25px",marginBottom:"10px"}},this.state.loading&&o().createElement("img",{src:"/images/loading-bubbles-blue.svg",style:{height:"40px"}}),!this.state.loading&&o().createElement("button",{className:"btn btn-lg btn-primary btn-block",type:"submit",disabled:this.state.inValidForm,onClick:function(){e.setState({loading:!0}),e.refs.form.submit()}},"Log in")),o().createElement("div",{className:"center-line",style:{marginBottom:"20px"}},o().createElement("div",{className:"checkbox",style:{position:"relative"}},o().createElement("div",{className:"bar"},o().createElement("input",{type:"checkbox",id:"remember",name:"remember"}),o().createElement("label",{htmlFor:"remember",className:"checkbox-label"}))),o().createElement("span",null,"Remember me")),o().createElement("div",{className:"center-line"},"Forgot Password?"," ",o().createElement("a",{href:"/users/forgotpassword"},"Click here")),o().createElement("div",{className:"center-line"},"Don't have an account? ",o().createElement("a",{href:"/users/signup"},"Sign up")),o().createElement("div",{className:"center-line"},o().createElement("a",{style:{cursor:"pointer"},onClick:this.onSingleSignOn.bind(this,!0)},"Login with Single sign-on"))),o().createElement("div",{className:"message-box"},window.singularLoginMessage&&o().createElement("div",{className:"error-message"},window.singularLoginMessage),window.singularLoginInfo&&o().createElement("span",{style:{color:"green"}},window.singularLoginInfo)),window.singularLoginClientId&&window.singularLoginRedirectUrl&&o().createElement("div",null,o().createElement("input",{type:"hidden",id:"client_id",name:"client_id",value:window.singularLoginClientId}),o().createElement("input",{type:"hidden",id:"redirect_uri",name:"redirect_uri",value:window.singularLoginRedirectUrl})))))}return o().createElement("div",{className:"singular-layout login-section"},o().createElement(ul,null),o().createElement("div",{className:"section-body"},o().createElement("div",{className:"login-inner",style:{width:"40%"}},o().createElement("div",{className:"section-title"},"Single sign-on"),o().createElement("div",{style:{maxWidth:"300px",margin:"auto"}},o().createElement("form",{name:"singleSignForm",action:"/users/login/saml"+window.location.search,method:"post",ref:"form"},o().createElement("div",{className:"field-list"},o().createElement("div",{className:"form-field"},o().createElement("div",{className:"form-label"},"Email Address"),o().createElement("div",{className:"form-input-container"},o().createElement("input",{type:"email",className:"form-input",id:"email",name:"email",required:!0,autoFocus:!0,autoComplete:"off",onChange:this.checkFields,ref:"inputEmail"})))),o().createElement("div",{className:"center-line"}),o().createElement("div",{className:"login-area",style:{marginBottom:"25px"}},this.state.loading&&o().createElement("img",{src:"/images/loading-bubbles-blue.svg",style:{height:"40px"}}),!this.state.loading&&o().createElement("button",{className:"btn btn-lg btn-primary btn-block",type:"submit",disabled:this.state.inValidForm,onClick:function(){e.setState({loading:!0}),e.refs.form.submit()}},"Log in"))),o().createElement("div",{className:"center-line"},o().createElement("a",{style:{cursor:"pointer"},onClick:this.onSingleSignOn.bind(this,!1)},"Login using email and password")),o().createElement("div",{className:"message-box"},window.singularLoginSSOMessage&&o().createElement("div",{className:"error-message"},window.singularLoginSSOMessage),window.singularLoginInfo&&o().createElement("span",{style:{color:"green"}},window.singularLoginInfo))))))}}),bl=o().createClass({displayName:"Signup",getInitialState:function(){return{emailState:"",emailMessage:null,emailValid:!1,firstNameState:"",firstNameValid:!1,lastNameState:"",lastNameValid:!1,passwordState:"",passwordValid:!1,revealPassword:!1,tos:!1,formValid:!1,creatingAccount:!1}},checkEmail:function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(e).toLowerCase())},handleBlurEmail:function(e){var t=this,a=e.target.value;0===a.length?this.setState({emailState:"",emailMessage:null,emailValid:!1},(function(){return t.checkForm()})):this.checkEmail(a)?(this.setState({emailState:"busy"}),S().post("/apiv1/accounts/availableemail").send({email:a}).end(function(e,t){var a=this;e?this.setState({emailState:"error",emailMessage:"Error while verifying email address",emailValid:!1},(function(){return a.checkForm()})):!0===t.body.result?this.setState({emailState:"error",emailMessage:"This email address is already in use",emailValid:!1},(function(){return a.checkForm()})):this.setState({emailState:"ok",emailMessage:null,emailValid:!0},(function(){return a.checkForm()}))}.bind(this))):this.setState({emailState:"error",emailMessage:"This email address is invalid",emailValid:!1},(function(){return t.checkForm()}))},handleBlurFirstname:function(e){var t,a=!1;e.target.value.length>0?(t="ok",a=!0):t="",this.setState({firstNameState:t,firstNameValid:a},function(){this.checkForm()}.bind(this))},handleBlurLastname:function(e){var t,a=!1;e.target.value.length>0?(t="ok",a=!0):t="",this.setState({lastNameState:t,lastNameValid:a},function(){this.checkForm()}.bind(this))},handleBlurPassword:function(e){var t,a=!1;e.target.value.length>0?(t="ok",a=!0):t="",this.setState({passwordState:t,passwordValid:a},function(){this.checkForm()}.bind(this))},togglePasswordReveal:function(e){this.setState({revealPassword:!this.state.revealPassword})},handleConfirmTos:function(){this.setState({tos:!this.state.tos},function(){this.checkForm()}.bind(this))},checkForm:function(){var e=!1;this.state.firstNameValid&&this.state.lastNameValid&&this.state.emailValid&&this.state.passwordValid&&this.state.tos&&(e=!0),this.setState({formValid:e})},onCreateAccountClick:function(){this.setState({creatingAccount:!0}),this.refs.form.submit()},render:function(){var e=this,t="password";1==this.state.revealPassword&&(t="text");var a=function(e){return"busy"==e?o().createElement("i",{className:"field-input-status busy fa fa-circle-o-notch fa-spin"}):"error"==e?o().createElement("i",{className:"field-input-status error fa fa-times"}):"ok"==e?o().createElement("i",{className:"field-input-status ok fa fa-check"}):null},i=a(this.state.firstNameState),n=a(this.state.lastNameState),s=a(this.state.emailState),l=a(this.state.passwordState);return o().createElement("div",{className:"singular-layout login-section"},o().createElement(ul,null),o().createElement("div",{className:"section-body"},o().createElement("div",{className:"login-inner"},o().createElement("div",{className:"section-title"},"Sign Up"),o().createElement("img",{className:"logo",src:"https://uploads-ssl.webflow.com/5e13cca706a3614f91004011/5fb6941223eddd42ee28ea20_Singular%20logo.png"}),o().createElement("div",{className:"info-message"},"Come join the live graphics revolution!"),o().createElement("div",{className:"join-account-message"},"Want to"," ",o().createElement("a",{href:"https://singularlive.zendesk.com/hc/en-us/articles/360020008571-How-do-I-invite-users-to-my-account-",target:"_blank"},"join an exisiting company account"),"?"),o().createElement("form",{id:"frmSignUP",className:"",method:"post",style:{maxWidth:"none"},ref:"form"},o().createElement("div",{className:"field-grid"},o().createElement("div",{className:"form-field "+this.state.firstNameState},o().createElement("div",{className:"form-label"},"First name"),o().createElement("div",{className:"form-input-container"},o().createElement("input",{type:"text",className:"form-input",id:"firstName",name:"firstName",required:!0,autoFocus:!0,onBlur:this.handleBlurFirstname}),i),o().createElement("div",{className:"form-error"},this.state.firstNameMessage)),o().createElement("div",{className:"form-field "+this.state.lastNameState},o().createElement("div",{className:"form-label"},"Last name"),o().createElement("div",{className:"form-input-container"},o().createElement("input",{type:"text",className:"form-input",id:"lastName",name:"lastName",required:!0,onChange:this.handleBlurLastname}),n),o().createElement("div",{className:"form-error"},this.state.lastNameMessage)),o().createElement("div",{className:"form-field "+this.state.emailState},o().createElement("div",{className:"form-label"},"Email Address"),o().createElement("div",{className:"form-input-container"},o().createElement("input",{type:"email",className:"form-input",id:"email",name:"email",required:!0,autoComplete:"off",onBlur:this.handleBlurEmail}),s),o().createElement("div",{className:"form-error"},this.state.emailMessage)),o().createElement("div",{className:"form-field "+this.state.passwordState},o().createElement("div",{className:"form-label"},"Password"),o().createElement("div",{className:"form-input-container"},o().createElement("input",{type:t,className:"form-input",id:"password",name:"password",autoComplete:"off",required:!0,onBlur:this.handleBlurPassword,ref:"password"}),l),o().createElement("div",{className:"form-error"}),o().createElement("div",{className:"password-reveal",onClick:this.togglePasswordReveal},!this.state.revealPassword&&o().createElement("i",{className:"fa fa-eye"}),this.state.revealPassword&&o().createElement("i",{className:"fa fa-eye-slash"}),"Show"))),o().createElement("div",{className:"terms-of-service"},o().createElement("div",{className:"checkbox",style:{position:"relative"}},o().createElement("div",{className:"bar"},o().createElement("input",{type:"checkbox",id:"termsAccepted",name:"termsAccepted",required:!0,onChange:this.handleConfirmTos}),o().createElement("label",{htmlFor:"termsAccepted",className:"checkbox-label"}))),o().createElement("span",{style:{marginLeft:"10px"}},"I agree to the Singular.Live"," ",o().createElement("a",{href:"http://www.singular.live/terms-of-service",target:"_blank"},"Terms of Service")," ")),window.singularLoginClientId&&window.singularLoginRedirectUrl&&o().createElement("div",null,o().createElement("input",{type:"hidden",id:"client_id",name:"client_id",value:window.singularLoginClientId}),o().createElement("input",{type:"hidden",id:"response_type",name:"response_type",value:window.singularLoginResponseType}),o().createElement("input",{type:"hidden",id:"redirect_uri",name:"redirect_uri",value:window.singularLoginRedirectUrl})),o().createElement("div",{className:"signup-area"},this.state.creatingAccount&&o().createElement("img",{src:"/images/loading-bubbles-blue.svg",style:{height:"40px",width:"175px"}}),!this.state.creatingAccount&&o().createElement("button",{className:"btn btn-lg btn-primary btn-block",onClick:function(){return e.onCreateAccountClick()},disabled:!this.state.formValid,style:{width:"175px"}},"Create Account"),o().createElement("div",{style:{marginLeft:"15px"}},"Already have an account? ",o().createElement("a",{href:"/users/login"},"Login here")))),o().createElement("div",{className:"message-box"},window.singularLoginMessage&&o().createElement("div",{className:"error-message"},window.singularLoginMessage),window.singularLoginInfo&&o().createElement("span",{style:{color:"green"}},window.singularLoginInfo)))))}}),yl=o().createClass({displayName:"SignupSuccess",componentDidMount:function(){window.singularEmail||(window.location.href="/users/login")},render:function(){return o().createElement("div",{className:"singular-layout login-section"},o().createElement(ul,null),o().createElement("div",{className:"section-body"},o().createElement("div",{className:"login-inner"},o().createElement("div",{className:"section-title"},"Email Verification"),o().createElement("div",{style:{fontSize:"16px",textAlign:"center"}},o().createElement("div",{style:{marginBottom:"15px"}},"A confirmation email has been sent to"),o().createElement("div",{style:{color:"#38a6e1"}},window.singularEmail),o().createElement("div",{style:{marginTop:"15px"}},"Please check your inbox and follow the link in the email to activate your Singular.live account")))))}});a(5556);var El=a(10611),wl=a(9769),Sl=a(83384);const Nl=o().createClass({displayName:"FontInfo",getInitialState:function(){return this.accountSearch="",this.uploadFontFaceSrc={},this.scCopyToPreviousInputValue="",this.scCopyToCurrentInputValue="",this.originalActiveFont=null,this.originalFontFaceList=[],this.nextAccount=null,this.nextActiveFont=null,this.turnOffForm=!1,this.processMode="",this.processId=null,{fontList:[],showBusyIcon:!0,showBusyIcon1:!1,showBusyIcon2:!1,activeFont:null,fontFaceList:[],hasUpdateFont:!1,accountNameValues:[]}},componentDidMount:function(){var e=this;$(document).mouseup((function(t){var a=n().findDOMNode(e.refs.dropdownMenu),i=$(a);wl.getMouseEventType(t)!=Sl.MOUSE_RIGHT_CLICK&&(i.is(t.target)||0!==i.has(t.target).length||i.removeClass("show"))}))},componentWillReceiveProps:function(e){e.account&&((this.props.account?this.props.account.id:-1)==e.account.id&&1!=this.turnOffForm||(this.nextAccount=null,this.turnOffForm=!1,this.loadFontList(e.account.id,!0,!0,!0)))},ensureToMoveOut:function(e){e.preventDefault();var t="You're navigating out of this page. Are you sure to discard change?";return(e||window.event).returnValue=t,t},componentWillUpdate:function(e,t){t.hasUpdateFont?window.addEventListener("beforeunload",this.ensureToMoveOut):window.removeEventListener("beforeunload",this.ensureToMoveOut)},checkHasUpdateFont:function(e,t){var a=!1;for(var i in t){var n=t[i];if(0==a&&(1==n.isNew||1==n.isEdit||1==n.isDelete)){a=!0;break}}return 0==a&&this.originalActiveFont.family!=e.family&&(a=!0),a},getHasUpdateFlag:function(){return this.state.hasUpdateFont},turnOffFontInfoForm:function(){this.turnOffForm=!0,this.setState({showBusyIcon:!0,showBusyIcon1:!0,showBusyIcon2:!0,hasUpdateFont:!1})},loadFontList:function(e,t,a,i){var n=this,s=this.state.fontList,o=this.state.activeFont,l=this.state.fontFaceList,r=this.state.hasUpdateFont,c=null;0==a&&(c={},Object.assign(c,o)),this.originalActiveFont=c,this.setState({fontList:t?[]:s,activeFont:a?null:o,showBusyIcon:t,showBusyIcon2:!1,fontFaceList:i?[]:l,hasUpdateFont:!i&&r});var d="/apiv1/fonts/list?account_id="+e;E().series([function(e){S().get(d).set("Content-Type","application/json").end((function(t,a){var i=[];t?e(t,i):(i=a.body,e(null,i))}))},function(e){0==a&&1==i?(n.loadFontFaceList(o.id),e(null,"done")):e(null,"done")}],(function(e,t){e&&console.log(e),n.setState({showBusyIcon:!1,showBusyIcon1:!1,fontList:t[0]})}))},selectFont:function(e,t){var a=!0,i=this.state.activeFont;if(i&&(a=i.id!=e.id),a)if(1==this.state.hasUpdateFont&&0==t)this.nextActiveFont=e,this.showWarningFontNotSaveModal(null);else{this.nextActiveFont=null,this.uploadFontFaceSrc={};var n={};Object.assign(n,e),this.originalActiveFont=n,this.setState({activeFont:e,hasUpdateFont:!1}),this.loadFontFaceList(e.id)}},setFontItemInBusy:function(e){var t=this.state.fontList;for(var a in t)t[a].id==e&&(t[a].is_busy=!0);this.setState({fontList:t})},setFontFaceItemInBusy:function(e){var t=this.state.fontFaceList;for(var a in t)t[a].id==e&&(t[a].is_busy=!0);this.setState({fontFaceList:t})},doPurgeCSSFont:function(e,t){S().delete("/apiv1/fonts/purge/"+e).send({family:t}).end((function(e,t){e&&console.warn("Purge Font CSS Error:",e)}))},onActiveFontInputChanged:function(e,t){var a=this.state.activeFont,i=this.state.fontFaceList;if("family"===e&&(a.family=t,i.length>0))for(var n in i){var s=i[n];if(s.family=t,s.isInDB){var o=this.originalFontFaceList.filter((function(e,t){return e.id.toLowerCase()==s.id.toLowerCase()}));if(o.length>0){var l=!1;(o[0].family||"")!=(s.family||"")&&(l=!0),s.isEdit=l}}}this.setState({activeFont:a,fontFaceList:i,hasUpdateFont:this.checkHasUpdateFont(a,i)})},onAddNewFont:function(){var e=this,t=this.state.fontList;t.unshift({id:El.v4(),is_busy:!0}),this.setState({fontList:t}),this.props.onNotification("Adding new font","info",5,"tc"),S().post("/apiv1/fonts").send({family:"New Font",account_id:this.props.account.id}).set("Content-Type","application/json").end((function(t,a){t?(console.error(t),e.props.onNotification("Can not add new font","error",5,"tc")):e.props.onNotification("New font was added","success",5,"tc");var i=a.body;e.doPurgeCSSFont(i.id,i.family),e.loadFontList(e.props.account.id,!1,!1,!1)}))},onUpdateFont:function(){var e=this,t=this.state.activeFont,a=this.state.fontFaceList,i=(t.family||"").trim();this.setFontItemInBusy(t.id),t.family=i,this.setState({activeFont:t,fontFaceList:[],showBusyIcon2:!0}),this.props.onNotification("Saving font","info",5,"tc"),E().series([function(e){S().put("/apiv1/fonts/"+t.id).send({family:i.trim()}).set("Content-Type","application/json").end((function(t,a){t?e(t):e(null,a)}))},function(t){var i=new FormData;for(var n in e.uploadFontFaceSrc){var s=e.uploadFontFaceSrc[n];s instanceof File&&i.append("file-"+n,s)}i.append("savedata",JSON.stringify(a)),S().put("/apiv1/fonts/faces/save").send(i).end((function(e,a){e?t(e):t(null,a)}))}],(function(a,n){a?(console.error(a),e.props.onNotification("ERROR cannot update font","error",5,"tc")):e.props.onNotification("Font has been saved","success",5,"tc"),e.doPurgeCSSFont(t.id,i.trim()),e.uploadFontFaceSrc={},e.loadFontList(e.props.account.id,!1,!1,!0)}))},doDeleteFont:function(e){var t=this;this.setFontItemInBusy(e);var a=!1,i="";this.state.activeFont&&(i=this.state.activeFont.family,(a=e==this.state.activeFont.id)&&this.setState({showBusyIcon2:!0})),this.props.onNotification("Deleting font","info",5,"tc"),S().delete("/apiv1/fonts/"+e).set("Content-Type","application/json").end((function(n,s){n?(console.error(n),t.props.onNotification("Can not delete font","error",5,"tc")):t.props.onNotification("Font has been deleted","success",5,"tc"),t.doPurgeCSSFont(e,i),t.loadFontList(t.props.account.id,!1,a,a)}))},loadFontFaceList:function(e){var t=this;this.setState({showBusyIcon2:!0,fontFaceList:[],hasUpdateFont:!1}),this.originalFontFaceList=[];var a="/apiv1/fonts/faces/"+e;E().waterfall([function(e){S().get(a).set("Content-Type","application/json").end((function(t,a){var i=[];t?e(t,i):(i=a.body,e(null,i))}))}],(function(e,a){var i=[];e?(console.error(e),t.props.onNotification("Error while loading font face list","error",5,"tc")):(i=a).forEach((function(e,a){e.url_type="upload";var i={};Object.assign(i,e),t.originalFontFaceList.push(i),e.isInDB=!0,e.isNew=!1,e.isEdit=!1,e.isDelete=!1})),t.setState({showBusyIcon2:!1,fontFaceList:i})}))},createNewFontFaceObject:function(e,t){var a=ge()().utc().format("YYYY-MM-DDTHH:mm:ss.000")+"Z";return{family:t,font_id:e,format:"WOFF",id:El.v4(),src:"",stretch:null,style:null,created_at:a,updated_at:a,weight:"400",isInDB:!1,isDelete:!1,isEdit:!1,isNew:!0,url_type:"upload"}},onFontFaceInputChanged:function(e,t,a){var i=this.state.fontFaceList;if(i.length>0)for(var n in i){var s=i[n];if(s.id==e){switch(t){case"style":s.style=a;break;case"stretch":s.stretch=a;break;case"weight":s.weight=a;break;case"format":s.format=a;break;case"urltype-upload":case"urltype-custom":s.url_type=a;break;case"src-custom":s.src=a;break;case"src-file":if(a&&a[0]){var o=a[0];s.src=o.name,s.file=o,this.uploadFontFaceSrc[e]=o}else this.uploadFontFaceSrc[e]=null}if(s.isInDB){var l=this.originalFontFaceList.filter((function(t,a){return t.id.toLowerCase()==e.toLowerCase()}));if(l.length>0){var r=l[0],c=!1,d=r.style||"",p=r.stretch||"",m=r.weight||"",u=r.format||"",h=r.url_type||"",f=r.src||"",g=s.style||"",v=s.stretch||"",b=s.weight||"",y=s.format||"",E=s.url_type||"",w=s.src||"";d==g&&p==v&&m==b&&u==y&&h==E&&f==w||(c=!0),s.isEdit=c}}break}}this.setState({fontFaceList:i,hasUpdateFont:this.checkHasUpdateFont(this.state.activeFont,i)})},onAddNewFontFace:function(){var e=this.state.activeFont,t=this.state.fontFaceList||[];e.family=e.family.trim(),t.forEach((function(e,t){var a=e.family.trim();e.family=a}));var a=this.createNewFontFaceObject(e.id,e.family);t.unshift(a),this.setState({activeFont:e,fontFaceList:t,hasUpdateFont:this.checkHasUpdateFont(e,t)})},doDeleteFontFace:function(e){var t=[],a=this.state.fontFaceList;for(var i in a){var n=a[i];n.isInDB?(n.id==e&&(n.isDelete=!0),t.push(n)):n.id==e?this.uploadFontFaceSrc[e]&&delete this.uploadFontFaceSrc[e]:t.push(n)}this.processId=null,this.processMode="",this.setState({fontFaceList:t,hasUpdateFont:this.checkHasUpdateFont(this.state.activeFont,t)})},contextMenu:function(e){n().findDOMNode(this.refs.dropdownTrigger);var t=$(n().findDOMNode(this.refs.dropdownMenu));$(".dropdown-menu").removeClass("show");var a=0,i=0;this.browserRect&&(a=-this.browserRect.left-15,i=-15);var s=t.width(),o=t.height();e.pageX+s>window.innerWidth?t.css("left",e.pageX-s-5+a+"px"):t.css("left",e.pageX+5+a+"px"),e.pageY+o>window.innerHeight?t.css("top",e.pageY-o+i+"px"):t.css("top",e.pageY+i+"px"),this.refs.contextMenuWrapper.classList.contains("open")||t.toggleClass("show"),e.stopPropagation(),e.preventDefault()},closeContextMenu:function(){var e=n().findDOMNode(this.refs.dropdownMenu);$(e).removeClass("show")},deleteFont:function(){var e=this.state.activeFont;e?this.showConfirmDeleteModal(e.id,"delete-font"):console.error("No active font in state")},handleAccountNameChange:function(e){var t=[];this.scCopyToPreviousInputValue="",this.scCopyToCurrentInputValue="";for(var a=0;a=0&&(a="valid",n=t.body.id);for(var s=[],o=0;o0?this.selectAccount(this.state.accounts[0],!1):this.selectAccount(null,!1)},loadAllAccounts:function(e){var t=this;this.accountSearch=e||"",this.setState({showBusyIcon:!0,accounts:[]}),E().series([function(e){var a=encodeURIComponent(t.accountSearch);S().get("/apiv1/accounts?brand=singular&q="+a).set("Content-Type","application/json").end((function(t,a){var i=[];t?e(t,i):((i=a.body).sort((function(e,t){return e.name.localeCompare(t.name)})),e(null,i))}))}],(function(e,a){e&&console.log(e),t.setState({showBusyIcon:!1,accounts:a[0]}),t.selectActiveAccountInList()}))},selectAccount:function(e,t){var a=this,i=function(e){a.setState({activeAccount:e})},n=this.state.activeAccount?this.state.activeAccount.id:-1;this.refs.refFontInfo&&n!=e.id?0==this.refs.refFontInfo.getHasUpdateFlag()||1==t?i(e):this.refs.refFontInfo.showWarningFontNotSaveModal(e):i(e)},onConfirmNoChangeFontData:function(e){null!=this.nextAccountSearch?(this.refs.refFontInfo.turnOffFontInfoForm(),this.onSearchChange(this.nextAccountSearch,!0)):this.selectAccount(e,!0)},render:function(){var e,t=this,a=o().createElement("thead",null,o().createElement("tr",null,o().createElement("th",{style:{width:"5%",textAlign:"center"}},o().createElement("span",{className:"table-header"},"Active")),o().createElement("th",{style:{width:"5%",textAlign:"center"}},o().createElement("span",{className:"table-header"},"ID")),o().createElement("th",{style:{width:"60%"}},o().createElement("span",{className:"table-header"},"Name")),o().createElement("th",{style:{width:"30%"}},o().createElement("span",{className:"table-header"},"Created"))));return e=this.state.showBusyIcon?o().createElement("table",{className:"widget-version-list",style:{overflowY:"scroll"}},a,o().createElement("tbody",null,o().createElement("tr",null,o().createElement("td",{colSpan:"100%",style:{textAlign:"center"}},o().createElement("img",{src:"/images/loading-bubbles-blue.svg",className:"loader"}))))):o().createElement("table",{className:"widget-version-list",style:{overflowY:"scroll"}},a,o().createElement("tbody",null,this.state.accounts.map((function(e,a){var i="";return t.state.activeAccount&&t.state.activeAccount.id==e.id&&(i=" active"),o().createElement("tr",{key:e.id,onMouseDown:t.selectAccount.bind(t,e,!1),className:i},o().createElement("td",{style:{textAlign:"center"}},o().createElement("i",{className:"fa fa-circle account-status active"})),o().createElement("td",{style:{textAlign:"center"}},e.id),o().createElement("td",null,e.name),o().createElement("td",null,ge()(e.created_at).format("MMMM DD, YYYY HH:mm:ss")))})))),o().createElement("div",{className:"profile-wrapper",style:{height:"calc(100% - 50px)",width:"100%"}},o().createElement("div",{className:"user-administration-wrapper",style:{height:"100%",overflowY:"hidden"}},o().createElement("div",{className:"user-list",style:{width:"49%"}},e),o().createElement("div",{className:"profile-wrapper",style:{width:"50%",height:"100%"}},o().createElement(Nl,{ref:"refFontInfo",account:this.state.activeAccount,fbRef:this.props.fbRef,onNotification:this.props.onNotification,onConfirmNoChangeFontData:function(e){t.onConfirmNoChangeFontData(e)}}))))}}),xl=o().createClass({displayName:"FontManager",getInitialState:function(){return this.search="",{page:"fontmanager",searchValue:""}},componentDidMount:function(){},showPage:function(e){this.setState({page:e,searchValue:""})},onInfoChanged:function(){"Armed"!=this.state.saveIconState&&this.setState({saveIconState:"Armed"})},onNotification:function(e,t,a,i){this.refs.applicationHeaderRef.onNotification(e,t,a,i)},onSearchChange:function(e){this.search=e,this.selectedRef.onSearchChange(this.search)},render:function(){var e,t=this;return this.state.mode,this.state.page,e="fontmanager"===this.state.page?o().createElement(Cl,{fbRef:this.fbRef,search:this.state.searchValue,onRowSelected:this.onRowSelected,onSaveProcessComplete:this.onSaveProcessComplete,onInfoChanged:this.onInfoChanged,ref:function(e){t.selectedRef=e},onNotification:this.onNotification}):o().createElement("div",null),o().createElement("div",{style:{height:"100%",overflow:"hidden"}},o().createElement(Ji,{ref:"applicationHeaderRef"}),o().createElement("div",{id:"singular-browser",className:"portal"},o().createElement("section",{className:"nav-bar"},o().createElement("div",{className:"left-area"},"Font Manager"),o().createElement("div",{className:"right-area"})),o().createElement("section",{className:"secondary nav-bar"},o().createElement("div",{className:"left-area"}),o().createElement("div",{className:"right-area"},o().createElement(mn,{onSearch:this.onSearchChange}),o().createElement(Mn,{configuration:[]}),void 0)),o().createElement("div",{className:"singular-browser-body"},o().createElement("nav",{className:"singular-browser-nav",style:{height:"100%"}},o().createElement("div",{className:"navigator-wrapper"},o().createElement("ul",{className:"dashboard-tree"},o().createElement("ul",{id:"folder-tree-item-root"},o().createElement("li",{className:"fontmanager"==this.state.page?"active":"",onClick:this.showPage.bind(this,"fontmanager")},o().createElement("i",{className:"fa fa-font",style:{width:"20px",textAlign:"center",top:"8px"}}),o().createElement("span",{style:{display:"inline-block",top:"8px"}},o().createElement("div",{className:"asset-label"},"Font Manager"))))))),o().createElement("div",{className:"singular-browser-content"},o().createElement("div",{style:{height:"calc(100% - 75px)"}},e)))))}});var Il=a(46642);const kl=o().createClass({displayName:"AnalyicsDemo",getInitialState:function(){return this.cubejsApi=(0,Il.Ay)(window.singularUser.analyticsToken,{apiUrl:"https://singular-analytics.herokuapp.com/cubejs-api/v1"}),{}},componentDidMount:function(){var e=this;this.cubejsApi.load({measures:[],timeDimensions:[{dimension:"SESSIONS.createdAt",granularity:"minute",dateRange:["2021-04-12T23:00:00.000","2021-04-12T24:00:00.000"]}],order:{"SESSIONS.count":"desc"},dimensions:["SESSIONS.createdAt","SESSIONS.count"],filters:[{member:"SESSIONS.elementId",operator:"equals",values:["414038"]},{member:"SESSIONS.domain",operator:"equals",values:["PROD"]}],ungrouped:"true"}).then((function(t){console.log(t.chartPivot()),e.setState({resultSet:t})})).catch((function(e){console.error(e.message)}))},render:function(){var e=this.state.resultSet;if(!e)return!1;var t=function(e){return M()(e).format("0,0")},a=function(e){return ge()(e).format("MMM DD")},i=["#7DB3FF","#49457B","#FF7C78","#FF0000"];return o().createElement(Ps.uf,{width:"100%",height:800},o().createElement(Ps.Es,{data:e.chartPivot()},o().createElement(Ps.WX,{tickFormatter:a,dataKey:"x"}),o().createElement(Ps.h8,{tickFormatter:t}),e.seriesNames().map((function(e,t){return o().createElement(Ps.yP,{stackId:"a",dataKey:e.key,name:e.key.split(",")[0],fill:i[t]})})),o().createElement(Ps.s$,null),o().createElement(Ps.m_,{labelFormatter:a,formatter:t})))}});var Dl=a(48287).Buffer;function Al(e){return Al="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Al(e)}function Rl(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a=0&&window.location.href.indexOf("/compositions/")>=0){var s=window.singularUser;n.userInfo=Pl({},s.id,s.name)}a.update(n),d(e,a),t.child(i).child(e).onDisconnect().remove(),a.child("activeKey").child(e).onDisconnect().remove()},d=function(e,t){if(!window.singularScene)return null;var a="script"==window.location.href.match(/\/([^\/]+)[\/]?$/)[1]?window.singularUser.id:window.singularUser.firstName,i=function(n,s,o){if(n===e){var l=s.timerId;t.child("activeKey").update(Pl({},e,a)),t.update({ts:m.A.database.ServerValue.TIMESTAMP}),l||(s.timerId=setInterval((function(e){return i(n,s)}),6e4)),o&&o(n,s)}},n=function(e,t){return i(e,t)};!function(e,t,i){t.child("activeKey").once("value",(function(n){var s=n.val();if(s){var o=Object.keys(s)[0];t.child("activeKey").set(Pl({},e,a),(function(a){return t.child("activeKey").child(e).onDisconnect().remove()})),i&&i(o)}else i&&i(null)}))}(e,t,(function(e){return i(e,s,n)}))},u=function(e){return!e||!e.ts||new Date-new Date(e.ts)>6e4};window.singularScene&&S().get("/dashboard/file/"+window.singularScene.fid+"/folders",(function(e,t){e||(i=t.body,window.singularScene.foldersToUpdateRecent=i)}));var f=p()((function(e,t,a,n){i.forEach((function(e){"favorties"!=e?t.child("notification_folders").child(e).child("ts").set(m.A.database.ServerValue.TIMESTAMP):t.child("users").child(window.singularUser.id).child("notification_folders").child(e).child("ts").set(m.A.database.ServerValue.TIMESTAMP)}));var s=e?Pl({},e,window.singularUser.firstName):null;a.update({activeKey:s,lastModifiedBy:window.singularUser.firstName,updated_at:m.A.database.ServerValue.TIMESTAMP})}),5e3);window.compEditorMessage=function(e){console.log(e)},document.getElementById("onairLive")||(document.body.style.overflow="hidden"),n().render(o().createElement(x.A,null),Ul);var v=document.getElementById("compositionEditor"),y=function(e){e.id;var t=e.off,a=s.timerId;t&&a&&clearInterval(a)};if(v){window.compEditorMessage=function(e){window.compEditorRef.onMessage(e)};var w,C={},I=new(c())(null,t.key);if(l.A.init(t,I,"preview",!0),window.singularScene.datastore){var k=new(c())(null);new(b())(k,window.singularScene.datastore,window.singularScene.pv).then((function(e){var t=e.update;w=t}))}var D=null,A=function(e,t,a,i){window.compEditorRef&&window.compEditorRef.onSaveToFirebase&&window.compEditorRef.onSaveToFirebase(e,t,a,i)},R=function(){var e=JSON.stringify(D);e=e.replace(/\s/g,"");var t=Dl.byteLength(e,"utf8");A("saving","",t),T(),window.singularScene.fid&&"0"!=window.singularScene.fid&&M>2&&(D.ts=Date.now(),f(a,H,P,t))},P=(H=t.root.child("accounts").child(window.singularScene.account_id).child("assets")).child("files").child(window.singularScene.fid),T=p()((function(){window.compEditorRef&&window.compEditorRef.saveCompositionDuration();var e={},t=(e=Ml.extend(!0,D)).reloadPageAfterWritten,a=e.saveScript;if(delete e.reloadPageAfterWritten,delete e.saveScript,delete e.restore,e&&!$.isEmptyObject(e))try{A("saving");var i=Date.now();Ll.uploadCompositionJSON(JSON.stringify(e),window.singularScene.id,null,(function(n,s){if(n)A("error",n),console.log(n);else{Ll.updateCompositionMetadata({id:window.singularScene.id,size:s.fileSize,s3_comp:1},(function(e,t){e&&console.error(e)}));var o=function(){A("done",void 0,void 0,Date.now()-i),t&&location.reload()};a?Ll.uploadCompositionJSON(JSON.stringify({overlayScript:e.script,subCompScripts:e.compositionProps.scripts}),window.singularScene.id,"script",(function(e,t){Ll.updateCompositionMetadata({id:window.singularScene.id,s3_script:1},(function(e,t){e&&console.error(e)})),o()})):o()}}));var n={};e.ts&&(n.ts=e.ts),e.mainComposition&&(e.compositions[e.mainComposition]&&e.compositions[e.mainComposition].settings&&e.compositions[e.mainComposition].settings.defaultAppID?n["compositions.".concat(e.mainComposition,".settings.defaultAppID")]=e.compositions[e.mainComposition].settings.defaultAppID:n["compositions.".concat(e.mainComposition,".settings.defaultAppID")]=null),Object.keys(n).length>0&&w&&w(n)}catch(e){N.A.add(N.A.TYPE.ERROR,{title:"Cannot save data to database",description:e.message}),A("error",e.message)}}),1e3),M=0;I.on("value",(function(e,t,a){if(M++,"editor-only"!=a&&(D=e.val())&&D.uiSettings){var i=!0===D.uiSettings.autoSaveEnabled||void 0===D.uiSettings.autoSaveEnabled,n=D.reloadPageAfterWritten;i||n?R():A("changed")}}));P.once("value",(function(e){var i=e.val(),s=u(i);if(i&&i.activeKey&&!i.dontAsk&&!s){var c=i.activeKey[Object.keys(i.activeKey)[0]];n().render(o().createElement(pi,{disableOutsideClick:!0,rtdbFileRef:P,activeUser:c}),v)}else{P.child("dontAsk").remove();var d={};d[a=Tl.v4()]=!0;var p="editingIds";t.child(p).set(d,(function(e){e?(alert("Cannot connect to realtime database."),window.location.href="/dashboard"):(function(e){window.singularMessage=function(e){if("processAction"==e.type){if(e.compId)switch(e.state){case"in":window.compEditorRef.compositionNavControl(e.compId,"In");break;case"out":window.compEditorRef.compositionNavControl(e.compId,"Out");break;case"toggle":"In"==I.child("compositionStates").child(e.compId).val()?window.compEditorRef.compositionNavControl(e.compId,"Out"):window.compEditorRef.compositionNavControl(e.compId,"In")}}else l.A.controlLib.OnairScript&&l.A.controlLib.OnairScript.handle_onSingularMessage(e),e&&e.params&&"background"==e.params.type||console.log("Message to JavaScript: ",e)},E().waterfall([function(e){Ol.readFromS3OrFirebase(t,e)},function(e,t){h.A.loadWidgetsFromCompositions(e.compositions,!0,(function(a){a&&alert("Error while initializing widgets: "+a),t(null,e)}))},function(a,i){try{!function(){try{var e=0,i=0,n=a.compositions;for(var s in n){var o=n[s];if(o.data&&o.tiles)for(var l in o.data)-1==Object.keys(o.tiles).indexOf(l)&&(e++,i+=Dl.byteLength(JSON.stringify(a.compositions[s].data[l]),"utf8"),t.child("compositions").child(s).child("data").child(l).remove(),delete a.compositions[s].data[l])}0!=i&&console.log("Found",e,"orphan elements, size",parseFloat(i/1024).toFixed(2),"Kb")}catch(e){console.error(e.message)}}(),function(){try{var e=0,i=0,n=a.compositions;for(var s in n){var o=n[s];if(o.groups&&o.tiles){var l={};for(var r in o.groups)if(o.groups[r].items)for(var c in o.groups[r].items)l[c]=c;for(var d in l)-1==Object.keys(o.tiles).indexOf(d)&&(e++,i+=Dl.byteLength(JSON.stringify(a.compositions[s].data[d]),"utf8"),i+=Dl.byteLength(JSON.stringify(a.compositions[s].tiles[d]),"utf8"),t.child("compositions").child(s).child("data").child(d).remove(),t.child("compositions").child(s).child("tiles").child(d).remove(),delete a.compositions[s].data[d],delete a.compositions[s].tiles[d])}}0!=i&&console.log("Found",e,"orphan tiles, size",parseFloat(i/1024).toFixed(2),"Kb")}catch(e){console.error(e.message)}}(),function(){try{var e=a.compositions,i=function(e,t){var a=[t],i=a.slice();do{var n=[];a.forEach((function(t){n=n.concat(Vl(e[t]))})),i=i.concat(n),a=n.slice(),n=[]}while(a.length>0);return i}(e,t.key);for(var n in e)-1==i.indexOf(n)&&(t.child("compositions").child(n).remove(),t.child("compositionStates").child(n).remove(),t.child("compositionProps").child("durations").child(n).remove(),t.child("compositionProps").child("logicLayers").child(n).remove(),t.child("compositionProps").child("scripts").child(n).remove(),t.child("compositionProps").child("timeline2Active").child(n).remove(),delete a.compositions[n],delete a.compositionStates[n],delete a.compositionProps.durations[n],delete a.compositionProps.logicLayers[n],delete a.compositionProps.scripts[n],delete a.compositionProps.timeline2Active[n])}catch(e){console.error(e.message)}}(),function(){var e=a.compositions;for(var t in e){var i=e[t];if(i.groups)for(var n in i.groups)if(null!=i.groups[n].effects){var s=i.groups[n].items;if(s)for(var o in s){var l=i.tiles[o];l&&"composition"==l.type&&null==e[o]&&delete i.groups[n].items[o]}}else delete i.groups[n];if(i.tiles)for(var n in i.tiles)null!=i.tiles[n].effects||delete i.tiles[n]}}()}catch(e){}!function(){try{var e=a.tempCompositions;for(var i in e)t.child("compositions").child(i).remove(),t.child("compositionStates").child(i).remove(),delete a.compositions[i],delete a.compositionStates[i];t.child("tempCompositions").remove()}catch(e){console.error(e.message)}}();var s=a,r=JSON.stringify(s);r=r.replace(/\s/g,"");var c=Dl.byteLength(r,"utf8");for(var d in I.update(s,!1,!1),Object.keys(I.child("compositionProps/scripts").val()))C[d]=!0;n().render(o().createElement(di,{editingId:e,rtdbRef:t,sbRef:I,rootTimelines:l.A.rootTimelines,onOff:y,onManualSave:R,initialCompositionSize:c,ref:function(e){window.compEditorRef=e}}),v),i()}],(function(e){e&&(alert(e),window.location.href="/dashboard")}))}(a),r(a,t,P,p),Bl())}))}}))}var O=document.getElementById("onairLive");if(O&&"compositionPreview"==window.onairMode){var L=new(c())(null,t.key);l.A.init(t,L,"preview"),Ol.readFromS3OrFirebase(t,(function(e,a){L.set(a,!1,!1),window.singularMessage=function(){},n().render(o().createElement(mi.A,{rtdbRef:t,rootRtdbRef:t,sbRef:L,windowAdaptationGlobals:window.singularAdaptationGlobals,displayVariant:window.singularDisplayVariant,onCompositionReady:function(e){return l.A.set({onAirRef:e,composition:L.val(),mainComposition:L.key})},mainComposition:t.key,interactiveMode:"composition",rootTimelines:l.A.rootTimelines}),O)}));try{var V,F=new URLSearchParams(window.location.search),_={},B=function(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=function(e,t){if(e){if("string"==typeof e)return Rl(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Rl(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,l=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return o=e.done,e},e:function(e){l=!0,s=e},f:function(){try{o||null==a.return||a.return()}finally{if(l)throw s}}}}(F.entries());try{for(B.s();!(V=B.n()).done;){var U=V.value;_[U[0]]=U[1]}}catch(e){B.e(e)}finally{B.f()}g().parseQuery(_)}catch(e){}}var W=document.getElementById("compositionScript");if(W){var Y,j=new(c())(null,t.key);l.A.init(t,j,"preview",!0),a=Tl.v4();var H,z=(H=t.root.child("accounts").child(window.singularScene.account_id).child("assets")).child("files").child(window.singularScene.fid).child("scriptEditor"),G=function(){f(a,H,P)},K=function(e){Y=j.val();var i,s={},l={};for(var c in Y.compositions)Y.compositions[c].dataSources&&Y.compositions[c].dataSources.composition&&Y.compositions[c].dataSources.composition.controlNode&&(s[c]=Y.compositions[c].dataSources.composition.controlNode.payload),l[c]=Y.compositionStates[c];for(var d in i=Y.adaptationGlobals)"string"==typeof i[d]&&""==i[d]&&delete i[d];Ol.readFromS3OrFirebase(t,(function(c,d){if(c)return alert(c),void(window.location.href="/dashboard");h.A.loadWidgetsFromCompositions(d.compositions,!1,(function(c){for(var p in j.set(d,!1,!1),d.compositions)d.compositions[p].settings&&d.compositions[p].settings.linkTimeline&&delete l[p];for(var p in window.singularMessage=function(e){if("processAction"==e.type)switch(console.log("Event Control Subcomp "+e.compId+". Command state "+e.state),e.state){case"in":window.scriptEditorReference.compositionNavControl(e.compId,"In");break;case"out":window.scriptEditorReference.compositionNavControl(e.compId,"Out");break;case"toggle":"In"==j.child("compositionStates").child(e.compId).val()?window.scriptEditorReference.compositionNavControl(e.compId,"Out"):window.scriptEditorReference.compositionNavControl(e.compId,"In")}else e&&e.params&&"background"==e.params.type||console.log("Message to JavaScript: ",e)},d.compositions)if(d.compositions[p].dataSources&&d.compositions[p].dataSources.composition&&d.compositions[p].dataSources.composition.controlNode)for(var h in s[p])void 0!==d.compositions[p].dataSources.composition.controlNode&&void 0!==d.compositions[p].dataSources.composition.controlNode.payload&&void 0!==d.compositions[p].dataSources.composition.controlNode.payload[h]||delete s[p][h];var f=function(e){n().render(o().createElement(ji,{editingId:e,onOff:y,forceReload:Math.random(),lastPayloads:s,lastStates:l,lastAdaptationGlobals:i,onReload:K,rtdbRef:t,rootRtdbRef:t,sbRef:j,mainComposition:t.key,interactiveMode:"composition",onSave:G,ref:function(e){window.scriptEditorReference=e}}),W);var a=window.singularUser.id,r=window.singularUser.firstName,c=e?Pl({},e,a):null;z.update({activeKey:c,userInfo:Pl({},a,r),lastModifiedBy:r,updated_at:m.A.database.ServerValue.TIMESTAMP})};z.once("value",(function(i){if(e)f(a);else{var s=i.val(),l=u(s);if(s&&s.activeKey&&!s.dontAsk&&!l){var c=s.activeKey,d=c[Object.keys(c)[0]],p=s.userInfo[d];n().render(o().createElement(pi,{disableOutsideClick:!0,rtdbFileRef:z,activeUser:p,isScriptEditor:!0}),W)}else{z.child("dontAsk").remove(),a=Tl.v4();var m="seEditingIds";t.child(m).set(Pl({},a,!0),(function(e){e?(alert("Cannot connect to realtime database."),window.location.href="/dashboard"):(r(a,t,z,m),f(a))}))}}}))}))}))};K(),Bl()}var q=document.getElementById("dashboardManager");q&&(n().render(o().createElement(en,{rtdbFolderRef:window.singularRtdbCoreRef.child("accounts").child(window.singularUser.account.accountId).child("assets")}),q),Bl(3e3));var J=document.getElementById("externalBrowser");J&&(n().render(o().createElement(nn,{rtdbFolderRef:window.singularRtdbCoreRef.child("accounts").child(window.singularUser.account.accountId).child("assets")}),J),_l=!0);var X=document.getElementById("outputManager");X&&(n().render(o().createElement(hn,{rtdbRef:t}),X),Bl());var Z=document.getElementById("datastreamManager");Z&&(n().render(o().createElement(In,{rtdbRef:t}),Z),Bl())})),Fl&&!1===_l&&(Wl(),_l=!0)},91605:(e,t,a)=>{"use strict";a.d(t,{A:()=>h});var i=a(40927),n=a.n(i),s=a(87195),o=a.n(s),l=a(58776),r=a.n(l),c=a(10036);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}var p=a(87021),m=a(10611),u=a(9769);const h=n().createClass({displayName:"SelectionInput",getInitialState:function(){return this.controller=null,this.signal=null,this.uuid=m.v4(),{dropDownOpen:!1,filterValue:"",fetchDataBusy:!1,fetchDataError:"",urlData:[]}},componentWillMount:function(){},componentDidMount:function(){var e=this;if("url"==this.props.source){var t=c.A.register(this.props.sourceUrl,this.uuid,this.onReceivedJsonUrlData);this.onReceivedJsonUrlData(t)}this.refs.dropdownInput&&($(this.refs.dropdownInput).on("show.bs.dropdown",(function(){e.setState({dropDownOpen:!0},(function(){var e=this;setTimeout((function(){$(e.refs.filterInputField).focus()}),250)}))})),$(this.refs.dropdownInput).on("hide.bs.dropdown",(function(){e.setState({dropDownOpen:!1,filterValue:""})})))},componentWillUnmount:function(){"url"==this.props.source&&c.A.unregister(this.props.sourceUrl,this.uuid)},shouldComponentUpdate:function(e,t){return!u.compareObject(e,this.props)||!u.compareObject(t,this.state)},componentWillReceiveProps:function(e){if((e.source!=this.props.source||e.sourceUrl!=this.props.sourceUrl)&&("url"==this.props.source&&c.A.unregister(this.props.sourceUrl,this.uuid),"url"==e.source)){var t=c.A.register(e.sourceUrl,this.uuid,this.onReceivedJsonUrlData);this.onReceivedJsonUrlData(t)}},onReceivedJsonUrlData:function(e){"fetching"===e.status?this.setState({fetchDataBusy:!0,urlData:[],fetchDataError:""}):"ok"===e.status?this.setState({fetchDataBusy:!1,urlData:e.data,fetchDataError:""}):"error"===e.status?this.setState({fetchDataBusy:!1,urlData:[],fetchDataError:e.message}):(console.log("onReceivedJsonUrlData. Should not happen",e),this.setState({fetchDataBusy:!1,urlData:[],fetchDataError:""}))},onClick:function(e){this.props.onValueChanged&&this.props.onValueChanged(this.props.name,e.id)},onFilterValueChanged:function(e){this.setState({filterValue:e.target.value})},onFilterKeyDown:function(e){return"Escape"==e.key?(this.setState({filterValue:""}),e.preventDefault(),void e.stopPropagation()):"Enter"!=e.key&&"Tab"!=e.key?" "==e.key?(this.setState({filterValue:this.state.filterValue+" "}),e.preventDefault(),void e.stopPropagation()):void 0:void(this.props.onEnterKey&&this.props.onEnterKey(this.props.name,this.state.filterValue))},render:function(){var e=this,t=this.props.format||"text",a=this.state.filterValue.trim().toLowerCase(),i=function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"left",i="auto",s="20px",o="80%";"left"===a&&(i="0px",s="30px",o="100%");var l=e.title;if(void 0===l&&(l=void 0===e.id?"invalid":e.id),"image"===t||e.icon)return n().createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:a,maxWidth:o,marginLeft:i,marginRight:i}},n().createElement("img",{style:{width:s,height:s,objectFit:"contain",visibility:"hidden"},src:e.icon?e.icon:e.id,onLoad:function(e){e.target.style.visibility="visible"},onError:function(e){e.target.style.visibility="hidden"},alt:"selection icon"}),n().createElement("div",{style:{marginLeft:"5px",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}},l));if("color"===t){var r=p(e.id);return r.isValid()||(r=p("transparent")),n().createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:a,maxWidth:o,marginLeft:i,marginRight:i}},n().createElement("div",{style:{width:"20px",height:"20px",backgroundColor:r}}),n().createElement("div",{style:{marginLeft:"5px",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}},l))}return n().createElement("div",{style:{maxWidth:o,marginLeft:i,marginRight:i,textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}},l)},s=this.props.selections;if(this.props.options&&(s=this.props.options),"string"==typeof s)try{s=JSON.parse(s)}catch(e){s=[]}"url"==this.props.source&&(s=this.state.urlData);var l,m="Selection empty",u="Selection empty",h=null,f=this.props.disabled,g=" dropdown-toggle",v={height:"28px",padding:"0px"};if(this.props.width&&(v.width=this.props.width),s&&s.length){var b=s.filter(function(e){return this.props.value==e.id}.bind(this));b.length?(u=this.props.valueRenderer?this.props.valueRenderer(b[0]):i(b[0],"center"),m=b[0].title):m=u=this.props.value||"empty";var y=this.props.dropDownStyle||{};this.props.width&&(y.minWidth=this.props.width),h=n().createElement("ul",{className:"dropdown-menu",style:y},s.map((function(t,s){var o,l=t.title;return""==a||-1!==l.toLowerCase().indexOf(a)&&"--divider--"!=l?"object"===d(o=e.props.valueRenderer?e.props.valueRenderer(t):i(t))&&"divider"==o.props.className||"--divider--"==l?n().createElement("li",{key:s,className:"divider"}):n().createElement("li",{key:s},n().createElement("a",{onClick:e.onClick.bind(e,t),style:{maxWidth:"350px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"pre"}},o)):null})))}else{f=!0,g="",this.props.width||(v.width="calc(100% - 10px)");var E=this.props.dropDownStyle||{};E.opacity=0,h=n().createElement("ul",{className:"dropdown-menu",style:E})}this.state.fetchDataBusy&&(u=n().createElement("div",{style:{width:"100%",textAlign:"center"}},n().createElement("img",{style:{position:"relative",height:"24px"},src:"/images/loading-bubbles.svg",className:"loader"}))),"url"==this.props.source&&this.state.fetchDataError&&(u=n().createElement(o(),{placement:"top",delayShow:500,overlay:n().createElement(r(),{id:"error-info"},this.state.fetchDataError)},n().createElement("div",{style:{display:"flex",textAlign:"center",justifyContent:"center",gap:"10px",width:"100%",color:"#f7892e"}},n().createElement("span",null,"Error"),n().createElement("i",{className:"fa fa-question-circle",style:{fontSize:"14px",position:"relative",top:"1px"}})))),l=this.props.useFilter&&this.state.dropDownOpen?n().createElement("input",{type:"text",className:"form-control",value:this.state.filterValue,placeholder:m,onChange:this.onFilterValueChanged,onKeyDown:this.onFilterKeyDown,style:{left:"0px",top:"0px",width:"calc(100% - 20px)",height:"20px",minHeight:"27px",position:"absolute",textAlign:"center"},ref:"filterInputField"}):n().createElement("div",{style:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",width:"calc(100% - 30px)",margin:"auto"}},u);var w="";w=this.props.dropup?" dropup":" dropdown";var S="btn-default";this.props.theme&&"light"==this.props.theme&&(w+=" dropdown-white",S="btn-white");var N,C,x="";if(this.props.dropDownDataDisplay&&(x=this.props.dropDownDataDisplay),"url"==this.props.source&&this.props.useReload&&!this.state.fetchDataBusy&&(N=n().createElement("button",{tabIndex:"-1",className:"btn btn-default dropdown-url-reload",onClick:function(){var t=c.A.get(e.props.sourceUrl,!1);e.onReceivedJsonUrlData(t)},disabled:f||this.state.fetchDataBusy},n().createElement("i",{className:"fa fa-refresh"}))),this.props.inline&&1==this.props.inline)C=n().createElement("span",{className:"inline-dropdown",ref:"dropdownInput"},n().createElement("button",{type:"button",className:"btn timeline-control"+g+" "+S,"data-toggle":"dropdown","data-display":x,"aria-haspopup":"true","aria-expanded":"false",disabled:f,tabIndex:"-1",style:v},l),N,h);else{var I=(this.props.className||"")+w;C=n().createElement("div",{className:I,style:{maxWidth:this.props.width?this.props.width:"140px"},ref:"dropdownInput"},n().createElement("button",{type:"button",className:"btn timeline-control"+g+" "+S,"data-toggle":"dropdown","data-display":x,"aria-haspopup":"true","aria-expanded":"false",disabled:f,tabIndex:"-1",style:v},l),N,h)}return C}})},92643:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>m});var i=a(40927),n=a.n(i),s=(a(31018),a(66828)),o=a(91605),l=a(94108),r=a(59862),c=a(99227),d=a.n(c),p=a(9769);const m=n().createClass({displayName:"MaskProperties",localData:{lockSizeFactor:0},getInitialState:function(){return{}},componentDidMount:function(){},shouldComponentUpdate:function(e,t){return!p.compareObject(this.props,e)||!p.compareObject(this.state,t)},render:function(){var e=this.props.value;null==e&&(e={}),0==e.hasOwnProperty("active")&&(e.active=!1),0==e.hasOwnProperty("image")&&(e.image=""),0==e.hasOwnProperty("imageType")&&(e.imageType="alpha"),0==e.hasOwnProperty("sizeMethod")&&(e.sizeMethod="fill"),0==e.hasOwnProperty("sizeX")&&(e.sizeX=100),0==e.hasOwnProperty("sizeY")&&(e.sizeY=100),0==e.hasOwnProperty("lockSize")&&(e.lockSize=!0),0==e.hasOwnProperty("centerX")&&(e.centerX=50),0==e.hasOwnProperty("centerY")&&(e.centerY=50),0==e.hasOwnProperty("repeat")&&(e.repeat="no-repeat");var t=!1;0==e.active&&(t=!0);var a="constrain-proportion-selector";return 1==e.lockSize&&(a+=" locked"),1==t&&(a+=" disabled"),n().createElement("div",{className:"panel-body"},n().createElement("div",null,n().createElement("h3",null,"Mask",n().createElement("div",{className:"group-panel-options pull-right"},n().createElement("span",null,"Active"),n().createElement(l.A,{name:"active",value:e.active,onValueChanged:this.onValueChanged})))),n().createElement("table",null,n().createElement("tbody",null,n().createElement("tr",null,n().createElement("td",{nowrap:!0},"Image"),n().createElement("td",null,n().createElement(r.A,{name:"image",value:e.image,onValueChanged:this.onValueChanged,disabled:t}))),null,n().createElement("tr",null,n().createElement("td",null,"Size Method"),n().createElement("td",null,n().createElement(o.A,{name:"sizeMethod",selections:[{id:"contain",title:"Contain"},{id:"cover",title:"Cover"},{id:"fill",title:"Fill"},{id:"percentage",title:"Percentage"}],value:e.sizeMethod,onValueChanged:this.onValueChanged,disabled:t}))),n().createElement("tr",null,n().createElement("td",null,"Size X"),n().createElement("td",null,n().createElement(s.A,{name:"sizeX",resetValue:100,step:.1,unit:"%",format:"0.0",min:0,max:1e4,value:e.sizeX,showSlider:!1,onValueChanged:this.SizeValueChanged,disabled:t||"percentage"!=e.sizeMethod}))),n().createElement("tr",null,n().createElement("td",null,"Size Y"),n().createElement("td",null,n().createElement(s.A,{name:"sizeY",resetValue:100,step:.1,unit:"%",format:"0.0",min:0,max:1e4,value:e.sizeY,showSlider:!1,onValueChanged:this.SizeValueChanged,disabled:t||"percentage"!=e.sizeMethod}),n().createElement("div",{onClick:this.lockSizeClicked,className:a}))),n().createElement("tr",null,n().createElement("td",null,"Repeat"),n().createElement("td",null,n().createElement(o.A,{name:"repeat",selections:[{id:"no-repeat",title:"None"},{id:"repeat-x",title:"X"},{id:"repeat-y",title:"Y"},{id:"repeat",title:"Both"}],value:e.repeat,onValueChanged:this.onValueChanged,disabled:t||"percentage"!=e.sizeMethod}))),n().createElement("tr",null,n().createElement("td",null,"Center X"),n().createElement("td",null,n().createElement(s.A,{name:"centerX",resetValue:50,step:.1,unit:"%",format:"0.0",min:0,max:100,value:e.centerX,showSlider:!1,onValueChanged:this.onValueChanged,disabled:t||"fill"==e.sizeMethod}))),n().createElement("tr",null,n().createElement("td",null,"Center Y"),n().createElement("td",null,n().createElement(s.A,{name:"centerY",resetValue:50,step:.1,unit:"%",format:"0.0",min:0,max:100,value:e.centerY,showSlider:!1,onValueChanged:this.onValueChanged,disabled:t||"fill"==e.sizeMethod}))))))},onValueChanged:function(e,t){this.props.onValueChanged&&this.props.onValueChanged(e,t)},SizeValueChanged:function(e,t,a){var i=this.props.value;if(1==i.lockSize&&("sizeX"==e||"sizeY"==e)){var n=Number(t);if(t===i[e])return;var s={};return"sizeX"==e?(0==this.localData.lockSizeFactor?s.sizeY=n:s.sizeY=d()(n/this.localData.lockSizeFactor).format(a.toString()),s.sizeX=t):(0==this.localData.lockSizeFactor?s.sizeX=n:s.sizeX=d()(n*this.localData.lockSizeFactor).format(a.toString()),s.sizeY=t),void(this.props.onValueChanged&&(void 0!==s.sizeX&&this.props.onValueChanged("sizeX",s.sizeX),void 0!==s.sizeY&&this.props.onValueChanged("sizeY",s.sizeY)))}this.props.onValueChanged&&this.props.onValueChanged(e,t)},lockSizeClicked:function(){if(0!=this.props.value.active&&"percentage"==this.props.value.sizeMethod){var e=!this.props.value.lockSize;this.props.onValueChanged&&this.props.onValueChanged("lockSize",e),this.calculateLockSizeFactor(e)}},calculateLockSizeFactor:function(e){0==e||0==Number(this.props.value.sizeY)?this.localData.lockSizeFactor=0:this.localData.lockSizeFactor=Number(this.props.value.sizeX)/Number(this.props.value.sizeY)*1}})},48766:e=>{e.exports={EffectSelections:[{id:"none",title:"None",property:[{id:"none",title:"None"}]},{id:"fade",title:"Fade",property:[{id:"none",title:"None"}]},{id:"translateNoFade",title:"Translate",property:[{id:"left",title:"Left"},{id:"right",title:"Right"},{id:"up",title:"Up"},{id:"down",title:"Down"}]},{id:"translate",title:"Translate & Fade",property:[{id:"left",title:"Left"},{id:"right",title:"Right"},{id:"up",title:"Up"},{id:"down",title:"Down"}]},{id:"rotate",title:"Rotate",property:[{id:"x+",title:"X+"},{id:"x-",title:"X-"},{id:"y+",title:"Y+"},{id:"y-",title:"Y-"}]},{id:"scale",title:"Scale",property:[{id:"xAndY",title:"X and Y"},{id:"x",title:"X"},{id:"y",title:"Y"}]},{id:"widget",title:"Widget",property:[{id:"none",title:"None"}]}],EffectSelectionsUpdateAnimation:[{id:"none",title:"None",property:[{id:"none",title:"None"}]},{id:"fade",title:"Fade",property:[{id:"none",title:"None"}]},{id:"translate",title:"Translate",property:[{id:"left",title:"Left"},{id:"right",title:"Right"},{id:"up",title:"Up"},{id:"down",title:"Down"}]},{id:"rotate",title:"Rotate",property:[{id:"x+",title:"X+"},{id:"x-",title:"X-"},{id:"y+",title:"Y+"},{id:"y-",title:"Y-"}]},{id:"scale",title:"Scale",property:[{id:"xAndY",title:"X and Y"},{id:"x",title:"X"},{id:"y",title:"Y"}]}]}},70782:e=>{e.exports=["#e53935","#5e35b1","#1e88e5","#8e24aa","#00897b","#d81b60","#3949ab","#c0ca33","#81c784","#00acc1","#fb8c00","#43a047","#7cb342","#c2185b","#fdd835","#ffb300","#303f9f","#f4511e","#d32f2f","#0097a7","#7b1fa2","#512da8","#689f38","#1976d2","#0288d1","#ffa000","#00796b","#388e3c","#c62828","#afb42b","#fbc02d","#4527a0","#f57c00","#e64a19","#00838f","#ad1457","#6a1b9a","#558b2f","#1565c0","#0277bd","#ff8f00","#00695c","#2e7d32","#b71c1c","#9e9d24","#f9a825","#311b92","#ef6c00","#d84315","#01579b","#880e4f","#4a148c","#1b5e20","#1a237e","#0d47a1","#006064","#004d40","#f57f17","#33691e","#827717","#bf360c","#ff6f00","#e65100"]},16524:(e,t,a)=>{var i=a(25499);e.exports=i({ANIMATION:null,CONTROL:null,TRANSFORM:null,EFFECT:null,UPDATE:null,BEHAVIOR:null,ADAPTIVE:null,EVENT:null})},88170:e=>{e.exports={CATEGORY_NAME_MAP:{spark:"Spark",studio:"Studio",dashboard:"Dashboard",composer:"Composer",api:"API"},STATUS_NAME_MAP:{draft:"Draft",published:"Published"},TYPE_NAME_MAP:{update:"Update","new-feature":"New Feature","bug-fix":"Bug Fix"}}},33738:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var i=a(40927),n=a.n(i),s=(a(15734),a(57453)),o=a(9769);const l=n().createClass({displayName:"ThumbnailWrapper",getInitialState:function(){return{status:""}},shouldComponentUpdate:function(e,t){return!o.compareObject(t,this.state)||!o.compareObject(e,this.props)},componentWillMount:function(){},componentDidMount:function(){},handleResizeThumbnail:function(){var e=this.refs.thumbnailIMG;e.displayImage.naturalWidth>e.displayImage.naturalHeight?this.setState({class:"thumbnail-image-wide"}):this.setState({class:"thumbnail-image"})},render:function(){var e=this.props.imageUrl;e||(e=this.props.defaultImageUrl);var t="/images/loading-bubbles.svg";return this.props.initialImage&&(t=this.props.initialImage),n().createElement(s.A,{src:e,fallbackImage:this.props.defaultImageUrl,initialImage:t,className:this.state.class,onLoad:this.handleResizeThumbnail,ref:"thumbnailIMG",style:this.props.style})}})},56027:(e,t,a)=>{"use strict";a.d(t,{A:()=>o});var i=a(25897),n=a(10611),s={};const o={COMPOSITION_PROPS:["logicLayers","timeline2Active","scripts","durations","snapshot"],importTile:function(e,t){var a=JSON.parse(JSON.stringify(e.tile));a.id=t,a.name=e.tile.name;var o={};e.data&&(o=JSON.parse(JSON.stringify(e.data)));var l={};e.dataLinks&&(l=JSON.parse(JSON.stringify(e.dataLinks)));var r={};e.nodeRefs&&(r=JSON.parse(JSON.stringify(e.nodeRefs)));var c={};if("composition"==e.tile.type&&e.comp){var d=this.importComposition2(e.comp,e.compositions,t,e.tile.id);$.extend(!0,c,d)}var p={},m={};for(var u in this.COMPOSITION_PROPS.forEach((function(e){m[e]={}})),c){var h;for(var f in s)if(s[f]==u){h=f;break}h&&e.compositionStates&&e.compositionStates[h]&&(p[u]=e.compositionStates[h]),this.COMPOSITION_PROPS.forEach((function(t){h&&e.compositionProps&&e.compositionProps[t]&&void 0!==e.compositionProps[t][h]&&(m[t][u]=e.compositionProps[t][h])}))}var g=[],v={},b={},y=i.A.getWidgetById(e.tile.widget,e.tile.version);for(var E in y&&y.model&&y.model.fields&&Array.isArray(y.model.fields)&&y.model.fields.forEach(function(t){if("composition"==t.type&&""!=e.data[t.id]){var a=e.data[t.id],i=n.v4();g.push(a),v[t.id]=i,b[a]=i}}.bind(this)),g.forEach(function(t){var a=b[t];if(e.compositions[t]){var i=this.importComposition2(e.compositions[t],e.compositions,a,t);$.extend(!0,c,i)}}.bind(this)),v)o[E]=v[E];return{tile:a,data:o,dataLinks:l,nodeRefs:r,compositions:c,compositionStates:p,compositionProps:m}},importGroup:function(e,t){var a=JSON.parse(JSON.stringify(e.group));a.id=t,a.name=e.group.name;var i={group:a,tiles:[],data:{},dataLinks:{},nodeRefs:{},compositions:{},compositionStates:{},compositionProps:{}},s=a.items;for(var o in a.items={},s){var l=e.tiles.filter((function(e){return e.id==o}))[0],r=n.v4(),c={tile:l,data:e.data[o],dataLinks:e.dataLinks[o],nodeRefs:e.nodeRefs[o],comp:e.compositions[o],compositions:e.compositions,compositionStates:e.compositionStates,compositionProps:e.compositionProps},d=this.importTile(c,r,!1);a.items[r]={id:r,priority:s[o].priority},i.tiles=i.tiles.concat(d.tile);var p={};p[r]=d.data,$.extend(!0,i.data,p);var m={};m[r]=d.dataLinks,$.extend(!0,i.dataLinks,m);var u={};u[r]=d.nodeRefs,$.extend(!0,i.nodeRefs,u),$.extend(!0,i.compositions,d.compositions),$.extend(!0,i.compositionStates,d.compositionStates),$.extend(!0,i.compositionProps,d.compositionProps)}return i},pasteTileTo:function(e,t,a,i,n,o){s={};var l=void 0,r=[];for(var c in t.items)r.push(t.items[c]);r.sort((function(e,t){return e.priority-t.priority-.5}));for(var d=0;d0);return this._remapParentComp(r),r},importComposition:function(e,t,a){a||console.error("importComposition: oldId must be vaild"),s[a]=t;var i={},n=[],o=this._importComposition(i,e),l={};l[t]=i,i={},e.tiles||o.push(a);do{o.forEach(function(t){if(e.compositions[t]){n=n.concat(this._importComposition(i,e.compositions[t]));var a=s[t];l[a]=i,i={}}}.bind(this)),o=n.slice(),n=[]}while(o.length>0);return this._remapParentComp(l),l},_remapParentComp:function(e){for(var t in e)if((i=e[t]).settings&&i.settings.linkTimeline&&i.settings.parentTimeline){var a=s[i.settings.parentTimeline];a&&(i.settings.parentTimeline=a)}for(var t in e){var i;if((i=e[t])&&i.dataLinks)for(var n in i.dataLinks){var o=i.dataLinks[n];for(var l in o)(c=o[l])&&("root"==c.locationId||"self"==c.locationId||(p=s[c.locationId])&&(c.locationId=p))}if(i&&i.nodeRefs)for(var n in i.nodeRefs){var r=i.nodeRefs[n];for(var l in r){var c;if((c=r[l])&&c.sourceLocation&&c.sourceLocation.length){var d=c.sourceLocation[0];if(""==d);else if(""==d);else{var p;(p=s[d])&&(c.sourceLocation[0]=p)}}}}}},_importComposition:function(e,t){var a={};$.extend(!0,a,t);var o=e,l=[];if(a.tiles)for(var r in a.tiles)"composition"==a.tiles[r].type&&l.push(a.tiles[r].id);var c=function(e){if(o[e]||(o[e]={}),a[e])for(var t in a[e]){var r;s[t]?r=s[t]:(r=n.v4(),s[t]=r);var c=JSON.parse(JSON.stringify(a[e][t]));if("tiles"!=e&&"groups"!=e&&"data"!=e||(c.id=r),"groups"==e){var d={};for(var p in c.items)d[s[p]]={id:s[p],priority:c.items[p].priority};c.items=d}var m,u=[];if("tiles"==e&&a.data){var h=a.tiles[t],f=a.data[t];h&&f&&(m=i.A.getWidgetById(h.widget,h.version))&&m.model&&m.model.fields&&Array.isArray(m.model.fields)&&m.model.fields.forEach((function(e){if("composition"==e.type){var t=s[f[e.id]];t||(t=n.v4(),s[f[e.id]]=t),u.push(f[e.id])}})),l=l.concat(u)}if("data"==e&&a.tiles)h=a.tiles[t],f=a.data[t],h&&f&&(m=i.A.getWidgetById(h.widget,h.version))&&m.model&&m.model.fields&&Array.isArray(m.model.fields)&&m.model.fields.forEach((function(e){if("composition"==e.type){var t=s[f[e.id]];t||(t=n.v4(),s[f[e.id]]=t),c[e.id]=t}}));o[e][r]=c}},d=function(e){a[e]&&(o[e]=JSON.parse(JSON.stringify(a[e])))};return c("tiles"),c("data"),c("dataLinks"),c("groups"),c("nodeRefs"),d("selections"),d("settings"),d("dataSources"),l},getCompositionChildren:function(e,t,a,n){var s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(t[e]){var o=t[e].tiles,l=t[e].data;o&&Object.keys(o).forEach(function(e){var r=o[e];"composition"==r.type&&(a.push(r.id),s||this.getCompositionChildren(r.id,t,a,n));var c=i.A.getWidgetById(r.widget,r.version);c&&c.model&&c.model.fields&&Array.isArray(c.model.fields)&&c.model.fields.forEach(function(i){"composition"==i.type&&""!=l[e][i.id]&&(a.push(l[e][i.id]),s||this.getCompositionChildren(l[e][i.id],t,a,n),n&&(n[l[e][i.id]]=[r.name,c,r.id,i.id]))}.bind(this))}.bind(this))}},getCompositionTree:function(e,t){var a={},i=[];return this.getCompositionChildren(e,t,i,void 0,!0),i.forEach(function(e){a[e]=this.getCompositionTree(e,t)}.bind(this)),a},getParentChildren:function(e,t){var a={},i=[e],n={};do{var s=[];i.forEach(function(e){var i=[];this.getCompositionChildren(e,t,i,n,!0),a[e]=i.slice(),s=s.concat(i.slice())}.bind(this)),i=s.slice()}while(i.length>0);return[a,n]},copyCompositionStatesWithIdMapping:function(e){var t={};if(e)for(var a in e){var i=s[a];i&&(t[i]=e[a])}return t},copyCompositionPropsWithIdMapping:function(e){var t={};return e&&this.COMPOSITION_PROPS.forEach((function(a){for(var i in t[a]={},e[a]){var n=s[i];n&&(t[a][n]=e[a][i])}})),t}}},94151:function(e,t,a){function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}e.exports=function(e,t){var a=function(a,n,s){if(this.parentEl="body",this.element=t(a),this.startDate=e().startOf("day"),this.endDate=e().endOf("day"),this.minDate=!1,this.maxDate=!1,this.dateLimit=!1,this.autoApply=!1,this.singleDatePicker=!1,this.showDropdowns=!1,this.showWeekNumbers=!1,this.showISOWeekNumbers=!1,this.showCustomRangeLabel=!0,this.timePicker=!1,this.timePicker24Hour=!1,this.timePickerIncrement=1,this.timePickerSeconds=!1,this.linkedCalendars=!0,this.autoUpdateInput=!0,this.alwaysShowCalendars=!1,this.ranges={},this.opens="right",this.element.hasClass("pull-right")&&(this.opens="left"),this.drops="down",this.element.hasClass("dropup")&&(this.drops="up"),this.buttonClasses="btn btn-sm",this.applyClass="btn-success",this.cancelClass="btn-default",this.locale={direction:"ltr",format:e.localeData().longDateFormat("L"),separator:" - ",applyLabel:"Apply",cancelLabel:"Cancel",weekLabel:"W",customRangeLabel:"Custom Range",daysOfWeek:e.weekdaysMin(),monthNames:e.monthsShort(),firstDay:e.localeData().firstDayOfWeek()},this.callback=function(){},this.isShowing=!1,this.leftCalendar={},this.rightCalendar={},"object"===i(n)&&null!==n||(n={}),"string"==typeof(n=t.extend(this.element.data(),n)).template||n.template instanceof t||(n.template=''),this.parentEl=n.parentEl&&t(n.parentEl).length?t(n.parentEl):t(this.parentEl),this.container=t(n.template).appendTo(this.parentEl),"object"===i(n.locale)&&("string"==typeof n.locale.direction&&(this.locale.direction=n.locale.direction),"string"==typeof n.locale.format&&(this.locale.format=n.locale.format),"string"==typeof n.locale.separator&&(this.locale.separator=n.locale.separator),"object"===i(n.locale.daysOfWeek)&&(this.locale.daysOfWeek=n.locale.daysOfWeek.slice()),"object"===i(n.locale.monthNames)&&(this.locale.monthNames=n.locale.monthNames.slice()),"number"==typeof n.locale.firstDay&&(this.locale.firstDay=n.locale.firstDay),"string"==typeof n.locale.applyLabel&&(this.locale.applyLabel=n.locale.applyLabel),"string"==typeof n.locale.cancelLabel&&(this.locale.cancelLabel=n.locale.cancelLabel),"string"==typeof n.locale.weekLabel&&(this.locale.weekLabel=n.locale.weekLabel),"string"==typeof n.locale.customRangeLabel)){(u=document.createElement("textarea")).innerHTML=n.locale.customRangeLabel;var o=u.value;this.locale.customRangeLabel=o}if(this.container.addClass(this.locale.direction),"string"==typeof n.startDate&&(this.startDate=e(n.startDate,this.locale.format)),"string"==typeof n.endDate&&(this.endDate=e(n.endDate,this.locale.format)),"string"==typeof n.minDate&&(this.minDate=e(n.minDate,this.locale.format)),"string"==typeof n.maxDate&&(this.maxDate=e(n.maxDate,this.locale.format)),"object"===i(n.startDate)&&(this.startDate=e(n.startDate)),"object"===i(n.endDate)&&(this.endDate=e(n.endDate)),"object"===i(n.minDate)&&(this.minDate=e(n.minDate)),"object"===i(n.maxDate)&&(this.maxDate=e(n.maxDate)),this.minDate&&this.startDate.isBefore(this.minDate)&&(this.startDate=this.minDate.clone()),this.maxDate&&this.endDate.isAfter(this.maxDate)&&(this.endDate=this.maxDate.clone()),"string"==typeof n.applyClass&&(this.applyClass=n.applyClass),"string"==typeof n.cancelClass&&(this.cancelClass=n.cancelClass),"object"===i(n.dateLimit)&&(this.dateLimit=n.dateLimit),"string"==typeof n.opens&&(this.opens=n.opens),"string"==typeof n.drops&&(this.drops=n.drops),"boolean"==typeof n.showWeekNumbers&&(this.showWeekNumbers=n.showWeekNumbers),"boolean"==typeof n.showISOWeekNumbers&&(this.showISOWeekNumbers=n.showISOWeekNumbers),"string"==typeof n.buttonClasses&&(this.buttonClasses=n.buttonClasses),"object"===i(n.buttonClasses)&&(this.buttonClasses=n.buttonClasses.join(" ")),"boolean"==typeof n.showDropdowns&&(this.showDropdowns=n.showDropdowns),"boolean"==typeof n.showCustomRangeLabel&&(this.showCustomRangeLabel=n.showCustomRangeLabel),"boolean"==typeof n.singleDatePicker&&(this.singleDatePicker=n.singleDatePicker,this.singleDatePicker&&(this.endDate=this.startDate.clone())),"boolean"==typeof n.timePicker&&(this.timePicker=n.timePicker),"boolean"==typeof n.timePickerSeconds&&(this.timePickerSeconds=n.timePickerSeconds),"number"==typeof n.timePickerIncrement&&(this.timePickerIncrement=n.timePickerIncrement),"boolean"==typeof n.timePicker24Hour&&(this.timePicker24Hour=n.timePicker24Hour),"boolean"==typeof n.autoApply&&(this.autoApply=n.autoApply),"boolean"==typeof n.autoUpdateInput&&(this.autoUpdateInput=n.autoUpdateInput),"boolean"==typeof n.linkedCalendars&&(this.linkedCalendars=n.linkedCalendars),"function"==typeof n.isInvalidDate&&(this.isInvalidDate=n.isInvalidDate),"function"==typeof n.isCustomDate&&(this.isCustomDate=n.isCustomDate),"boolean"==typeof n.alwaysShowCalendars&&(this.alwaysShowCalendars=n.alwaysShowCalendars),0!=this.locale.firstDay)for(var l=this.locale.firstDay;l>0;)this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift()),l--;var r,c,d;if(void 0===n.startDate&&void 0===n.endDate&&t(this.element).is("input[type=text]")){var p=t(this.element).val(),m=p.split(this.locale.separator);r=c=null,2==m.length?(r=e(m[0],this.locale.format),c=e(m[1],this.locale.format)):this.singleDatePicker&&""!==p&&(r=e(p,this.locale.format),c=e(p,this.locale.format)),null!==r&&null!==c&&(this.setStartDate(r),this.setEndDate(c))}if("object"===i(n.ranges)){for(d in n.ranges){r="string"==typeof n.ranges[d][0]?e(n.ranges[d][0],this.locale.format):e(n.ranges[d][0]),c="string"==typeof n.ranges[d][1]?e(n.ranges[d][1],this.locale.format):e(n.ranges[d][1]),this.minDate&&r.isBefore(this.minDate)&&(r=this.minDate.clone());var u,h=this.maxDate;this.dateLimit&&h&&r.clone().add(this.dateLimit).isAfter(h)&&(h=r.clone().add(this.dateLimit)),h&&c.isAfter(h)&&(c=h.clone()),this.minDate&&c.isBefore(this.minDate,this.timepicker?"minute":"day")||h&&r.isAfter(h,this.timepicker?"minute":"day")||((u=document.createElement("textarea")).innerHTML=d,o=u.value,this.ranges[o]=[r,c])}var f="
    ";for(d in this.ranges)f+='
  • '+d+"
  • ";this.showCustomRangeLabel&&(f+='
  • '+this.locale.customRangeLabel+"
  • "),f+="
",this.container.find(".ranges").prepend(f)}"function"==typeof s&&(this.callback=s),this.timePicker||(this.startDate=this.startDate.startOf("day"),this.endDate=this.endDate.endOf("day"),this.container.find(".calendar-time").hide()),this.timePicker&&this.autoApply&&(this.autoApply=!1),this.autoApply&&"object"!==i(n.ranges)?this.container.find(".ranges").hide():this.autoApply&&this.container.find(".applyBtn, .cancelBtn").addClass("hide"),this.singleDatePicker&&(this.container.addClass("single"),this.container.find(".calendar.left").addClass("single"),this.container.find(".calendar.left").show(),this.container.find(".calendar.right").hide(),this.container.find(".daterangepicker_input input, .daterangepicker_input > i").hide(),this.timePicker?this.container.find(".ranges ul").hide():this.container.find(".ranges").hide()),(void 0===n.ranges&&!this.singleDatePicker||this.alwaysShowCalendars)&&this.container.addClass("show-calendar"),this.container.addClass("opens"+this.opens),void 0!==n.ranges&&"right"==this.opens&&this.container.find(".ranges").prependTo(this.container.find(".calendar.left").parent()),this.container.find(".applyBtn, .cancelBtn").addClass(this.buttonClasses),this.applyClass.length&&this.container.find(".applyBtn").addClass(this.applyClass),this.cancelClass.length&&this.container.find(".cancelBtn").addClass(this.cancelClass),this.container.find(".applyBtn").html(this.locale.applyLabel),this.container.find(".cancelBtn").html(this.locale.cancelLabel),this.container.find(".calendar").on("click.daterangepicker",".prev",t.proxy(this.clickPrev,this)).on("click.daterangepicker",".next",t.proxy(this.clickNext,this)).on("mousedown.daterangepicker","td.available",t.proxy(this.clickDate,this)).on("mouseenter.daterangepicker","td.available",t.proxy(this.hoverDate,this)).on("mouseleave.daterangepicker","td.available",t.proxy(this.updateFormInputs,this)).on("change.daterangepicker","select.yearselect",t.proxy(this.monthOrYearChanged,this)).on("change.daterangepicker","select.monthselect",t.proxy(this.monthOrYearChanged,this)).on("change.daterangepicker","select.hourselect,select.minuteselect,select.secondselect,select.ampmselect",t.proxy(this.timeChanged,this)).on("click.daterangepicker",".daterangepicker_input input",t.proxy(this.showCalendars,this)).on("focus.daterangepicker",".daterangepicker_input input",t.proxy(this.formInputsFocused,this)).on("blur.daterangepicker",".daterangepicker_input input",t.proxy(this.formInputsBlurred,this)).on("change.daterangepicker",".daterangepicker_input input",t.proxy(this.formInputsChanged,this)),this.container.find(".ranges").on("click.daterangepicker","button.applyBtn",t.proxy(this.clickApply,this)).on("click.daterangepicker","button.cancelBtn",t.proxy(this.clickCancel,this)).on("click.daterangepicker","li",t.proxy(this.clickRange,this)).on("mouseenter.daterangepicker","li",t.proxy(this.hoverRange,this)).on("mouseleave.daterangepicker","li",t.proxy(this.updateFormInputs,this)),this.element.is("input")||this.element.is("button")?this.element.on({"click.daterangepicker":t.proxy(this.show,this),"focus.daterangepicker":t.proxy(this.show,this),"keyup.daterangepicker":t.proxy(this.elementChanged,this),"keydown.daterangepicker":t.proxy(this.keydown,this)}):this.element.on("click.daterangepicker",t.proxy(this.toggle,this)),this.element.is("input")&&!this.singleDatePicker&&this.autoUpdateInput?(this.element.val(this.startDate.format(this.locale.format)+this.locale.separator+this.endDate.format(this.locale.format)),this.element.trigger("change")):this.element.is("input")&&this.autoUpdateInput&&(this.element.val(this.startDate.format(this.locale.format)),this.element.trigger("change"))};return a.prototype={constructor:a,setStartDate:function(t){"string"==typeof t&&(this.startDate=e(t,this.locale.format)),"object"===i(t)&&(this.startDate=e(t)),this.timePicker||(this.startDate=this.startDate.startOf("day")),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.round(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement),this.minDate&&this.startDate.isBefore(this.minDate)&&(this.startDate=this.minDate.clone(),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.round(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement)),this.maxDate&&this.startDate.isAfter(this.maxDate)&&(this.startDate=this.maxDate.clone(),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.floor(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement)),this.isShowing||this.updateElement(),this.updateMonthsInView()},setEndDate:function(t){"string"==typeof t&&(this.endDate=e(t,this.locale.format)),"object"===i(t)&&(this.endDate=e(t)),this.timePicker||(this.endDate=this.endDate.endOf("day")),this.timePicker&&this.timePickerIncrement&&this.endDate.minute(Math.round(this.endDate.minute()/this.timePickerIncrement)*this.timePickerIncrement),this.endDate.isBefore(this.startDate)&&(this.endDate=this.startDate.clone()),this.maxDate&&this.endDate.isAfter(this.maxDate)&&(this.endDate=this.maxDate.clone()),this.dateLimit&&this.startDate.clone().add(this.dateLimit).isBefore(this.endDate)&&(this.endDate=this.startDate.clone().add(this.dateLimit)),this.previousRightTime=this.endDate.clone(),this.isShowing||this.updateElement(),this.updateMonthsInView()},isInvalidDate:function(){return!1},isCustomDate:function(){return!1},updateView:function(){this.timePicker&&(this.renderTimePicker("left"),this.renderTimePicker("right"),this.endDate?this.container.find(".right .calendar-time select").removeAttr("disabled").removeClass("disabled"):this.container.find(".right .calendar-time select").attr("disabled","disabled").addClass("disabled")),this.endDate?(this.container.find('input[name="daterangepicker_end"]').removeClass("active"),this.container.find('input[name="daterangepicker_start"]').addClass("active")):(this.container.find('input[name="daterangepicker_end"]').addClass("active"),this.container.find('input[name="daterangepicker_start"]').removeClass("active")),this.updateMonthsInView(),this.updateCalendars(),this.updateFormInputs()},updateMonthsInView:function(){if(this.endDate){if(!this.singleDatePicker&&this.leftCalendar.month&&this.rightCalendar.month&&(this.startDate.format("YYYY-MM")==this.leftCalendar.month.format("YYYY-MM")||this.startDate.format("YYYY-MM")==this.rightCalendar.month.format("YYYY-MM"))&&(this.endDate.format("YYYY-MM")==this.leftCalendar.month.format("YYYY-MM")||this.endDate.format("YYYY-MM")==this.rightCalendar.month.format("YYYY-MM")))return;this.leftCalendar.month=this.startDate.clone().date(2),this.linkedCalendars||this.endDate.month()==this.startDate.month()&&this.endDate.year()==this.startDate.year()?this.rightCalendar.month=this.startDate.clone().date(2).add(1,"month"):this.rightCalendar.month=this.endDate.clone().date(2)}else this.leftCalendar.month.format("YYYY-MM")!=this.startDate.format("YYYY-MM")&&this.rightCalendar.month.format("YYYY-MM")!=this.startDate.format("YYYY-MM")&&(this.leftCalendar.month=this.startDate.clone().date(2),this.rightCalendar.month=this.startDate.clone().date(2).add(1,"month"));this.maxDate&&this.linkedCalendars&&!this.singleDatePicker&&this.rightCalendar.month>this.maxDate&&(this.rightCalendar.month=this.maxDate.clone().date(2),this.leftCalendar.month=this.maxDate.clone().date(2).subtract(1,"month"))},updateCalendars:function(){var e,t,a,i;this.timePicker&&(this.endDate?(e=parseInt(this.container.find(".left .hourselect").val(),10),t=parseInt(this.container.find(".left .minuteselect").val(),10),a=this.timePickerSeconds?parseInt(this.container.find(".left .secondselect").val(),10):0,this.timePicker24Hour||("PM"===(i=this.container.find(".left .ampmselect").val())&&e<12&&(e+=12),"AM"===i&&12===e&&(e=0))):(e=parseInt(this.container.find(".right .hourselect").val(),10),t=parseInt(this.container.find(".right .minuteselect").val(),10),a=this.timePickerSeconds?parseInt(this.container.find(".right .secondselect").val(),10):0,this.timePicker24Hour||("PM"===(i=this.container.find(".right .ampmselect").val())&&e<12&&(e+=12),"AM"===i&&12===e&&(e=0))),this.leftCalendar.month.hour(e).minute(t).second(a),this.rightCalendar.month.hour(e).minute(t).second(a)),this.renderCalendar("left"),this.renderCalendar("right"),this.container.find(".ranges li").removeClass("active"),null!=this.endDate&&this.calculateChosenLabel()},renderCalendar:function(a){var i,n=(i="left"==a?this.leftCalendar:this.rightCalendar).month.month(),s=i.month.year(),o=i.month.hour(),l=i.month.minute(),r=i.month.second(),c=e([s,n]).daysInMonth(),d=e([s,n,1]),p=e([s,n,c]),m=e(d).subtract(1,"month").month(),u=e(d).subtract(1,"month").year(),h=e([u,m]).daysInMonth(),f=d.day();(i=[]).firstDay=d,i.lastDay=p;for(var g=0;g<6;g++)i[g]=[];var v=h-f+this.locale.firstDay+1;v>h&&(v-=7),f==this.locale.firstDay&&(v=h-6);for(var b=e([u,m,v,12,l,r]),y=(g=0,0),E=0;g<42;g++,y++,b=e(b).add(24,"hour"))g>0&&y%7==0&&(y=0,E++),i[E][y]=b.clone().hour(o).minute(l).second(r),b.hour(12),this.minDate&&i[E][y].format("YYYY-MM-DD")==this.minDate.format("YYYY-MM-DD")&&i[E][y].isBefore(this.minDate)&&"left"==a&&(i[E][y]=this.minDate.clone()),this.maxDate&&i[E][y].format("YYYY-MM-DD")==this.maxDate.format("YYYY-MM-DD")&&i[E][y].isAfter(this.maxDate)&&"right"==a&&(i[E][y]=this.maxDate.clone());"left"==a?this.leftCalendar.calendar=i:this.rightCalendar.calendar=i;var w="left"==a?this.minDate:this.startDate,S=this.maxDate,N=("left"==a?this.startDate:this.endDate,"ltr"==this.locale.direction?{left:"chevron-left",right:"chevron-right"}:{left:"chevron-right",right:"chevron-left"}),C='';C+="",C+="",(this.showWeekNumbers||this.showISOWeekNumbers)&&(C+=""),w&&!w.isBefore(i.firstDay)||this.linkedCalendars&&"left"!=a?C+="":C+='';var x=this.locale.monthNames[i[1][1].month()]+i[1][1].format(" YYYY");if(this.showDropdowns){for(var I=i[1][1].month(),k=i[1][1].year(),D=S&&S.year()||k+5,A=w&&w.year()||k-50,R=k==A,P=k==D,T='";for(var O='")}if(C+='",S&&!S.isAfter(i.lastDay)||this.linkedCalendars&&"right"!=a&&!this.singleDatePicker?C+="":C+='',C+="",C+="",(this.showWeekNumbers||this.showISOWeekNumbers)&&(C+='"),t.each(this.locale.daysOfWeek,(function(e,t){C+=""})),C+="",C+="",C+="",null==this.endDate&&this.dateLimit){var V=this.startDate.clone().add(this.dateLimit).endOf("day");S&&!V.isBefore(S)||(S=V)}for(E=0;E<6;E++){for(C+="",this.showWeekNumbers?C+='":this.showISOWeekNumbers&&(C+='"),y=0;y<7;y++){var F=[];i[E][y].isSame(new Date,"day")&&F.push("today"),i[E][y].isoWeekday()>5&&F.push("weekend"),i[E][y].month()!=i[1][1].month()&&F.push("off"),this.minDate&&i[E][y].isBefore(this.minDate,"day")&&F.push("off","disabled"),S&&i[E][y].isAfter(S,"day")&&F.push("off","disabled"),this.isInvalidDate(i[E][y])&&F.push("off","disabled"),i[E][y].format("YYYY-MM-DD")==this.startDate.format("YYYY-MM-DD")&&F.push("active","start-date"),null!=this.endDate&&i[E][y].format("YYYY-MM-DD")==this.endDate.format("YYYY-MM-DD")&&F.push("active","end-date"),null!=this.endDate&&i[E][y]>this.startDate&&i[E][y]'+i[E][y].date()+""}C+=""}C+="",C+="
'+x+"
'+this.locale.weekLabel+""+t+"
'+i[E][0].week()+"'+i[E][0].isoWeek()+"
",this.container.find(".calendar."+a+" .calendar-table").html(C)},renderTimePicker:function(e){if("right"!=e||this.endDate){var t,a,i,n=this.maxDate;if(!this.dateLimit||this.maxDate&&!this.startDate.clone().add(this.dateLimit).isAfter(this.maxDate)||(n=this.startDate.clone().add(this.dateLimit)),"left"==e)a=this.startDate.clone(),i=this.minDate;else if("right"==e){a=this.endDate.clone(),i=this.startDate;var s=this.container.find(".calendar.right .calendar-time div");if(""!=s.html()&&(a.hour(s.find(".hourselect option:selected").val()||a.hour()),a.minute(s.find(".minuteselect option:selected").val()||a.minute()),a.second(s.find(".secondselect option:selected").val()||a.second()),!this.timePicker24Hour)){var o=s.find(".ampmselect option:selected").val();"PM"===o&&a.hour()<12&&a.hour(a.hour()+12),"AM"===o&&12===a.hour()&&a.hour(0)}a.isBefore(this.startDate)&&(a=this.startDate.clone()),n&&a.isAfter(n)&&(a=n.clone())}t=' ",t+=': ",this.timePickerSeconds){for(t+=': "}if(!this.timePicker24Hour){t+='"}this.container.find(".calendar."+e+" .calendar-time div").html(t)}},updateFormInputs:function(){this.container.find("input[name=daterangepicker_start]").is(":focus")||this.container.find("input[name=daterangepicker_end]").is(":focus")||(this.container.find("input[name=daterangepicker_start]").val(this.startDate.format(this.locale.format)),this.endDate&&this.container.find("input[name=daterangepicker_end]").val(this.endDate.format(this.locale.format)),this.singleDatePicker||this.endDate&&(this.startDate.isBefore(this.endDate)||this.startDate.isSame(this.endDate))?this.container.find("button.applyBtn").removeAttr("disabled"):this.container.find("button.applyBtn").attr("disabled","disabled"))},move:function(){var e,a={top:0,left:0},i=t(window).width();this.parentEl.is("body")||(a={top:this.parentEl.offset().top-this.parentEl.scrollTop(),left:this.parentEl.offset().left-this.parentEl.scrollLeft()},i=this.parentEl[0].clientWidth+this.parentEl.offset().left),e="up"==this.drops?this.element.offset().top-this.container.outerHeight()-a.top:this.element.offset().top+this.element.outerHeight()-a.top,this.container["up"==this.drops?"addClass":"removeClass"]("dropup"),"left"==this.opens?(this.container.css({top:e,right:i-this.element.offset().left-this.element.outerWidth(),left:"auto"}),this.container.offset().left<0&&this.container.css({right:"auto",left:9})):"center"==this.opens?(this.container.css({top:e,left:this.element.offset().left-a.left+this.element.outerWidth()/2-this.container.outerWidth()/2,right:"auto"}),this.container.offset().left<0&&this.container.css({right:"auto",left:9})):(this.container.css({top:e,left:this.element.offset().left-a.left,right:"auto"}),this.container.offset().left+this.container.outerWidth()>t(window).width()&&this.container.css({left:"auto",right:0}))},show:function(e){this.isShowing||(this._outsideClickProxy=t.proxy((function(e){this.outsideClick(e)}),this),t(document).on("mousedown.daterangepicker",this._outsideClickProxy).on("touchend.daterangepicker",this._outsideClickProxy).on("click.daterangepicker","[data-toggle=dropdown]",this._outsideClickProxy).on("focusin.daterangepicker",this._outsideClickProxy),t(window).on("resize.daterangepicker",t.proxy((function(e){this.move(e)}),this)),this.oldStartDate=this.startDate.clone(),this.oldEndDate=this.endDate.clone(),this.previousRightTime=this.endDate.clone(),this.updateView(),this.container.show(),this.move(),this.element.trigger("show.daterangepicker",this),this.isShowing=!0)},hide:function(e){this.isShowing&&(this.endDate||(this.startDate=this.oldStartDate.clone(),this.endDate=this.oldEndDate.clone()),this.startDate.isSame(this.oldStartDate)&&this.endDate.isSame(this.oldEndDate)||this.callback(this.startDate,this.endDate,this.chosenLabel),this.updateElement(),t(document).off(".daterangepicker"),t(window).off(".daterangepicker"),this.container.hide(),this.element.trigger("hide.daterangepicker",this),this.isShowing=!1)},toggle:function(e){this.isShowing?this.hide():this.show()},outsideClick:function(e){var a=t(e.target);"focusin"==e.type||a.closest(this.element).length||a.closest(this.container).length||a.closest(".calendar-table").length||(this.hide(),this.element.trigger("outsideClick.daterangepicker",this))},showCalendars:function(){this.container.addClass("show-calendar"),this.move(),this.element.trigger("showCalendar.daterangepicker",this)},hideCalendars:function(){this.container.removeClass("show-calendar"),this.element.trigger("hideCalendar.daterangepicker",this)},hoverRange:function(e){if(!this.container.find("input[name=daterangepicker_start]").is(":focus")&&!this.container.find("input[name=daterangepicker_end]").is(":focus")){var t=e.target.getAttribute("data-range-key");if(t==this.locale.customRangeLabel)this.updateView();else{var a=this.ranges[t];this.container.find("input[name=daterangepicker_start]").val(a[0].format(this.locale.format)),this.container.find("input[name=daterangepicker_end]").val(a[1].format(this.locale.format))}}},clickRange:function(e){var t=e.target.getAttribute("data-range-key");if(this.chosenLabel=t,t==this.locale.customRangeLabel)this.showCalendars();else{var a=this.ranges[t];this.startDate=a[0],this.endDate=a[1],this.timePicker||(this.startDate.startOf("day"),this.endDate.endOf("day")),this.alwaysShowCalendars||this.hideCalendars(),this.clickApply()}},clickPrev:function(e){t(e.target).parents(".calendar").hasClass("left")?(this.leftCalendar.month.subtract(1,"month"),this.linkedCalendars&&this.rightCalendar.month.subtract(1,"month")):this.rightCalendar.month.subtract(1,"month"),this.updateCalendars()},clickNext:function(e){t(e.target).parents(".calendar").hasClass("left")?this.leftCalendar.month.add(1,"month"):(this.rightCalendar.month.add(1,"month"),this.linkedCalendars&&this.leftCalendar.month.add(1,"month")),this.updateCalendars()},hoverDate:function(e){if(t(e.target).hasClass("available")){var a=t(e.target).attr("data-title"),i=a.substr(1,1),n=a.substr(3,1),s=t(e.target).parents(".calendar").hasClass("left")?this.leftCalendar.calendar[i][n]:this.rightCalendar.calendar[i][n];this.endDate&&!this.container.find("input[name=daterangepicker_start]").is(":focus")?this.container.find("input[name=daterangepicker_start]").val(s.format(this.locale.format)):this.endDate||this.container.find("input[name=daterangepicker_end]").is(":focus")||this.container.find("input[name=daterangepicker_end]").val(s.format(this.locale.format));var o=this.leftCalendar,l=this.rightCalendar,r=this.startDate;this.endDate||this.container.find(".calendar tbody td").each((function(e,a){if(!t(a).hasClass("week")){var i=t(a).attr("data-title"),n=i.substr(1,1),c=i.substr(3,1),d=t(a).parents(".calendar").hasClass("left")?o.calendar[n][c]:l.calendar[n][c];d.isAfter(r)&&d.isBefore(s)||d.isSame(s,"day")?t(a).addClass("in-range"):t(a).removeClass("in-range")}}))}},clickDate:function(e){if(t(e.target).hasClass("available")){var a=t(e.target).attr("data-title"),i=a.substr(1,1),n=a.substr(3,1),s=t(e.target).parents(".calendar").hasClass("left")?this.leftCalendar.calendar[i][n]:this.rightCalendar.calendar[i][n];if(this.endDate||s.isBefore(this.startDate,"day")){if(this.timePicker){var o=parseInt(this.container.find(".left .hourselect").val(),10);this.timePicker24Hour||("PM"===(c=this.container.find(".left .ampmselect").val())&&o<12&&(o+=12),"AM"===c&&12===o&&(o=0));var l=parseInt(this.container.find(".left .minuteselect").val(),10),r=this.timePickerSeconds?parseInt(this.container.find(".left .secondselect").val(),10):0;s=s.clone().hour(o).minute(l).second(r)}this.endDate=null,this.setStartDate(s.clone())}else if(!this.endDate&&s.isBefore(this.startDate))this.setEndDate(this.startDate.clone());else{var c;this.timePicker&&(o=parseInt(this.container.find(".right .hourselect").val(),10),this.timePicker24Hour||("PM"===(c=this.container.find(".right .ampmselect").val())&&o<12&&(o+=12),"AM"===c&&12===o&&(o=0)),l=parseInt(this.container.find(".right .minuteselect").val(),10),r=this.timePickerSeconds?parseInt(this.container.find(".right .secondselect").val(),10):0,s=s.clone().hour(o).minute(l).second(r)),this.setEndDate(s.clone()),this.autoApply&&(this.calculateChosenLabel(),this.clickApply())}this.singleDatePicker&&(this.setEndDate(this.startDate),this.timePicker||this.clickApply()),this.updateView(),e.stopPropagation()}},calculateChosenLabel:function(){var e=!0,t=0;for(var a in this.ranges){if(this.timePicker){if(this.startDate.isSame(this.ranges[a][0])&&this.endDate.isSame(this.ranges[a][1])){e=!1,this.chosenLabel=this.container.find(".ranges li:eq("+t+")").addClass("active").html();break}}else if(this.startDate.format("YYYY-MM-DD")==this.ranges[a][0].format("YYYY-MM-DD")&&this.endDate.format("YYYY-MM-DD")==this.ranges[a][1].format("YYYY-MM-DD")){e=!1,this.chosenLabel=this.container.find(".ranges li:eq("+t+")").addClass("active").html();break}t++}e&&(this.showCustomRangeLabel?this.chosenLabel=this.container.find(".ranges li:last").addClass("active").html():this.chosenLabel=null,this.showCalendars())},clickApply:function(e){this.hide(),this.element.trigger("apply.daterangepicker",this)},clickCancel:function(e){this.startDate=this.oldStartDate,this.endDate=this.oldEndDate,this.hide(),this.element.trigger("cancel.daterangepicker",this)},monthOrYearChanged:function(e){var a=t(e.target).closest(".calendar").hasClass("left"),i=a?"left":"right",n=this.container.find(".calendar."+i),s=parseInt(n.find(".monthselect").val(),10),o=n.find(".yearselect").val();a||(othis.maxDate.year()||o==this.maxDate.year()&&s>this.maxDate.month())&&(s=this.maxDate.month(),o=this.maxDate.year()),a?(this.leftCalendar.month.month(s).year(o),this.linkedCalendars&&(this.rightCalendar.month=this.leftCalendar.month.clone().add(1,"month"))):(this.rightCalendar.month.month(s).year(o),this.linkedCalendars&&(this.leftCalendar.month=this.rightCalendar.month.clone().subtract(1,"month"))),this.updateCalendars()},timeChanged:function(e){var a=t(e.target).closest(".calendar"),i=a.hasClass("left"),n=parseInt(a.find(".hourselect").val(),10),s=parseInt(a.find(".minuteselect").val(),10),o=this.timePickerSeconds?parseInt(a.find(".secondselect").val(),10):0;if(!this.timePicker24Hour){var l=a.find(".ampmselect").val();"PM"===l&&n<12&&(n+=12),"AM"===l&&12===n&&(n=0)}if(i){var r=this.startDate.clone();r.hour(n),r.minute(s),r.second(o),this.setStartDate(r),this.singleDatePicker?this.endDate=this.startDate.clone():this.endDate&&this.endDate.format("YYYY-MM-DD")==r.format("YYYY-MM-DD")&&this.endDate.isBefore(r)&&this.setEndDate(r.clone())}else if(this.endDate){var c=this.endDate.clone();c.hour(n),c.minute(s),c.second(o),this.setEndDate(c)}this.updateCalendars(),this.updateFormInputs(),this.renderTimePicker("left"),this.renderTimePicker("right")},formInputsChanged:function(a){var i=t(a.target).closest(".calendar").hasClass("right"),n=e(this.container.find('input[name="daterangepicker_start"]').val(),this.locale.format),s=e(this.container.find('input[name="daterangepicker_end"]').val(),this.locale.format);n.isValid()&&s.isValid()&&(i&&s.isBefore(n)&&(n=s.clone()),this.setStartDate(n),this.setEndDate(s),i?this.container.find('input[name="daterangepicker_start"]').val(this.startDate.format(this.locale.format)):this.container.find('input[name="daterangepicker_end"]').val(this.endDate.format(this.locale.format))),this.updateView()},formInputsFocused:function(e){this.container.find('input[name="daterangepicker_start"], input[name="daterangepicker_end"]').removeClass("active"),t(e.target).addClass("active"),t(e.target).closest(".calendar").hasClass("right")&&(this.endDate=null,this.setStartDate(this.startDate.clone()),this.updateView())},formInputsBlurred:function(t){if(!this.endDate){var a=this.container.find('input[name="daterangepicker_end"]').val(),i=e(a,this.locale.format);i.isValid()&&(this.setEndDate(i),this.updateView())}},elementChanged:function(){if(this.element.is("input")&&this.element.val().length&&!(this.element.val().length{"use strict";e.exports=function(){return["","alwaysShowCalendars","applyClass","autoApply","autoUpdateInput","buttonClasses","cancelClass","dateLimit","drops","endDate","isCustomDate","isInvalidDate","linkedCalendars","locale","maxDate","minDate","opens","parentEl","ranges","showCustomRangeLabel","showDropdowns","showISOWeekNumbers","showWeekNumbers","singleDatePicker","startDate","template","timePicker","timePicker24Hour","timePickerIncrement","timePickerSeconds"]}},59018:(e,t,a)=>{"use strict";a(94151);var i=a(40927),n=a(40961),s=a(45228),o=a(38057),l=a(5556),r=a(52306);e.exports=r({displayName:"exports",$picker:null,options:o(),makeEventHandler:function(e){return function(t,a){"function"==typeof this.props.onEvent&&this.props.onEvent(t,a),"function"==typeof this.props[e]&&this.props[e](t,a)}.bind(this)},getOptionsFromProps:function(e){var t;return e=e||this.props,this.options.forEach((function(a){e.hasOwnProperty(a)&&((t=t||{})[a]=e[a])})),t||{}},setOptionsFromProps:function(e){var t=Object.keys(e),a=this;a.$picker&&e&&t.forEach((function(t){"startDate"===t?a.$picker.data("daterangepicker").setStartDate(e[t]):"endDate"===t?a.$picker.data("daterangepicker").setEndDate(e[t]):"locale"===t?$.extend(a.$picker.data("daterangepicker")[t],e[t]):a.$picker.data("daterangepicker")[t]=e[t]}))},componentWillReceiveProps:function(e){var t=this;if(t.$picker){var a=t.getOptionsFromProps(),i=t.getOptionsFromProps(e),n={};t.options.forEach((function(e){a[e]!==i[e]&&(n[e]=i[e])})),t.setOptionsFromProps(n)}},componentDidMount:function(){this.initializeDateRangePicker()},componentWillUnmount:function(){this.removeDateRangePicker()},removeDateRangePicker:function(){this.$picker.data("daterangepicker").remove()},initializeDateRangePicker:function(){var e=this;$=window.jQuery&&window.jQuery.fn.daterangepicker?window.jQuery:$,e.$picker=$(n.findDOMNode(this.refs.picker)),e.$picker.daterangepicker(this.getOptionsFromProps()),["Show","Hide","ShowCalendar","HideCalendar","Apply","Cancel"].forEach((function(t){var a=t.toLowerCase();e.$picker.on(a+".daterangepicker",e.makeEventHandler("on"+t))}))},propTypes:{"":l.any,alwaysShowCalendars:l.bool,applyClass:l.string,autoApply:l.bool,autoUpdateInput:l.bool,buttonClasses:l.array,cancelClass:l.string,dateLimit:l.object,drops:l.oneOf(["down","up"]),endDate:l.oneOfType([l.object,l.string]),isCustomDate:l.func,isInvalidDate:l.func,linkedCalendars:l.bool,locale:l.object,maxDate:l.oneOfType([l.object,l.string]),minDate:l.oneOfType([l.object,l.string]),onApply:l.func,onCancel:l.func,onEvent:l.func,onHide:l.func,onHideCalendar:l.func,onShow:l.func,onShowCalendar:l.func,opens:l.oneOf(["left","right","center"]),parentEl:l.any,ranges:l.object,showCustomRangeLabel:l.bool,showDropdowns:l.bool,showISOWeekNumbers:l.bool,showWeekNumbers:l.bool,singleDatePicker:l.bool,startDate:l.oneOfType([l.object,l.string]),template:l.any,timePicker:l.bool,timePickerIncrement:l.number,timePicker24Hour:l.bool,timePickerSeconds:l.bool},render:function(){var e=s({ref:"picker"},this.props);return Object.keys(this.constructor.propTypes).forEach((function(t){delete e[t]})),i.cloneElement(this.props.children,{ref:"picker"})}})},71906:(e,t,a)=>{"use strict";"undefined"==typeof window?e.exports=function(){return null}:e.exports=a(10062)},28866:(e,t,a)=>{"use strict";a.r(t)},228:(e,t,a)=>{"use strict";a.r(t)}},a={};function i(e){var n=a[e];if(void 0!==n)return n.exports;var s=a[e]={id:e,loaded:!1,exports:{}};return t[e].call(s.exports,s,s.exports,i),s.loaded=!0,s.exports}i.m=t,i.c=a,i.amdD=function(){throw new Error("define cannot be used indirect")},i.amdO={},e=[],i.O=(t,a,n,s)=>{if(!a){var o=1/0;for(d=0;d=s)&&Object.keys(i.O).every((e=>i.O[e](a[r])))?a.splice(r--,1):(l=!1,s0&&e[d-1][2]>s;d--)e[d]=e[d-1];e[d]=[a,n,s]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e={524:0,27:0};i.O.j=t=>0===e[t];var t=(t,a)=>{var n,s,[o,l,r]=a,c=0;if(o.some((t=>0!==e[t]))){for(n in l)i.o(l,n)&&(i.m[n]=l[n]);if(r)var d=r(i)}for(t&&t(a);ci(i.s=85553)));n=i.O(n)})();