/** * jibo-sdk - Jibo's SDK plugin for Atom * @version v3.9.10 * @license Copyright (c) 2017, Jibo, Inc. All rights reserved. * All use of the Jibo SDK is subject to the Jibo SDK End User License Agreement (EULA) * distributed herewith. If you did not receive a copy of the EULA, you may view a * copy at https://developers.jibo.com/license. */ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.jiboSdk=e()}}(function(){return function e(t,o,i){function n(r,s){if(!o[r]){if(!t[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(a)return a(r,!0);var d=new Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}var c=o[r]={exports:{}};t[r][0].call(c.exports,function(e){var o=t[r][1][e];return n(o?o:e)},c,c.exports,e,t,o,i)}return o[r].exports}for(var a="function"==typeof require&&require,r=0;r-.5&&this.targetthis.target&&this.audio.playAtTime(this.target),this.lastTarget=this.target,this.wasInRange=e}},e.prototype.update=function(){if(this.doUpdate){requestAnimationFrame(this.update.bind(this));var e=(new Date).getTime();if(e-this.lastUpdate<100)return;this.lastUpdate=e,this.handleDown&&this.isInRange&&this.wasInRange?this.audio.target=this.target:this.audio&&this.audio.reset()}},e.prototype.dispose=function(){this.stopUpdateLoop(),this.audio.dispose(),this.audio=null,this.model=null},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=a},{"./pid-audio-controller":5,path:void 0}],4:[function(e,t,o){"use strict";var i=e("./audio-playback"),n=function(){function e(e,t){this.model=e,this.root=t,this.playbacks=[],this.rebuild(),this.onPropsChanged=this.onPropsChanged.bind(this),this.onDataChanged=this.onDataChanged.bind(this),this.onTogglePlay=this.onTogglePlay.bind(this),this.onToggleTimeScrub=this.onToggleTimeScrub.bind(this),this.onTimeScrub=this.onTimeScrub.bind(this),this.model.on("onpropertieschanged",this.onPropsChanged),this.model.on("ondatachanged",this.onDataChanged),this.model.on("toggle-play",this.onTogglePlay),this.model.on("toggle-time-scrub",this.onToggleTimeScrub),this.model.on("drag-keyframe",this.onTimeScrub)}return e.prototype.onToggleTimeScrub=function(e){this.playbacks.forEach(function(t){t.onToggleTimeScrub(e)})},e.prototype.onTogglePlay=function(e){this.playbacks.forEach(function(t){t.onTogglePlay(e)})},e.prototype.onTimeScrub=function(){this.playbacks.forEach(function(e){e.onTimeScrub()})},e.prototype.onDataChanged=function(){this.playbacks.forEach(function(e){e.onDataChanged()})},e.prototype.rebuild=function(){var e=this;this.playbacks.forEach(function(e){e.dispose()}),this.playbacks=[],this.map={};var t=this.model.getLayersOfType("Audio Event");t.forEach(function(t){t.visible&&!t.locked&&(e.map[t.id]=[],t.keyframes.forEach(function(o){if(o.value.AudioEvent.file&&o.value.AudioEvent.file.length>0){var n=new i.default(e.model,e.root,o);e.playbacks.push(n),e.map[t.id][o.time]=n}}))})},e.prototype.onPropsChanged=function(){this.rebuild()},e.prototype.dispose=function(){this.playbacks.forEach(function(e){e.dispose()}),this.model.removeListener("ondatachanged",this.onDataChanged),this.model.removeListener("toggle-play",this.onTogglePlay),this.model.removeListener("toggle-time-scrub",this.onToggleTimeScrub),this.model.removeListener("time-scrub",this.onTimeScrub),this.playbacks=[]},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=n},{"./audio-playback":3}],5:[function(e,t,o){"use strict";var i=e("node-pid-controller"),n=e("./two-way-controller"),a=function(){function e(e){this.pid=new i(5,1,.02,!1),this._target=0,this.pid.setTarget(this._target),this.audio=new n.default(e),this.isPlaying=!1}return e.prototype.load=function(e){var t=this;this.audio.load(function(){t.isPlaying=!0,e()})},e.prototype.playAtTime=function(e,t){void 0===t&&(t=1),this.audio.playAtTime(e,t)},e.prototype.stop=function(){this.isPlaying=!1,this.audio.stop()},Object.defineProperty(e.prototype,"target",{set:function(e){var t=this.audio.currentTime-e,o=this.pid.update(t);this.audio.playbackRate=o},enumerable:!0,configurable:!0}),e.prototype.zeroPid=function(){this.pid.update(0)},Object.defineProperty(e.prototype,"currentTime",{get:function(){return this.audio.currentTime},set:function(e){this.audio.currentTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this.audio.duration},enumerable:!0,configurable:!0}),e.prototype.getSamples=function(e){return this.audio.getSamples(e)},e.prototype.reset=function(){this.pid.reset()},e.prototype.dispose=function(){this.audio.dispose(),this.audio=null,this.pid=null},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=a},{"./two-way-controller":6,"node-pid-controller":void 0}],6:[function(e,t,o){"use strict";var i=e("./audio-controller"),n=e("async"),a={FORWARD:0,REVERSE:1},r=function(){function e(e){this.forward=new i.default(e),this.reverse=new i.default(e,!0),this.direction=a.FORWARD,this.forward.onCurrentTime=this.onCurrentTime.bind(this),this._currentTime=0}return Object.defineProperty(e.prototype,"duration",{get:function(){return this.forward.duration},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._currentTime},set:function(e){this._currentTime=e,this.reverse.currentTime=this.forward.duration-e,this.forward.currentTime=e,this.direction===a.REVERSE?this.forward.stop():this.reverse.stop()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(e){this._playbackRate=e,e>=0&&this.direction===a.REVERSE?(this.direction=a.FORWARD,this.forward.currentTime=this._currentTime,this.forward.onCurrentTime=this.onCurrentTime.bind(this),this.reverse.onCurrentTime=null,this.reverse.stop()):e<0&&this.direction===a.FORWARD&&(this.direction=a.REVERSE,this.reverse.currentTime=this.forward.duration-this._currentTime,this.reverse.onCurrentTime=this.onCurrentTime.bind(this),this.forward.onCurrentTime=null,this.forward.stop()),this.direction===a.FORWARD?this.forward.playbackRate=e:this.direction===a.REVERSE&&(this.reverse.playbackRate=-e)},enumerable:!0,configurable:!0}),e.prototype.load=function(e){var t=this;n.parallel([function(e){t.forward.load(e)},function(e){t.reverse.load(e)}],e)},e.prototype.stop=function(e){void 0===e&&(e=0),this.currentTime=e,this.forward.stop(),this.reverse.stop()},e.prototype.onCurrentTime=function(e){this.direction===a.REVERSE?this._currentTime=this.forward.duration-e:this._currentTime=e},e.prototype.playAtTime=function(e,t){void 0===t&&(t=1),this._currentTime=e||0,this._playbackRate=t,this.direction===a.REVERSE&&(this.direction=a.FORWARD,this.forward.onCurrentTime=this.onCurrentTime.bind(this),this.reverse.onCurrentTime=null,this.reverse.stop()),this.forward.currentTime=this._currentTime,this.forward.playbackRate=this._playbackRate},e.prototype.dispose=function(){this.forward.onCurrentTime=null,this.forward.dispose(),this.reverse.onCurrentTime=null,this.reverse.dispose(),this.forward=null,this.reverse=null},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=r},{"./audio-controller":2,async:void 0}],7:[function(e,t,o){"use strict";var i=e("animation-utilities"),n=e("atom"),a=e("animation-utilities"),r=e("./dof-controller"),s=e("../views/three-debug"),l=new a.JiboConfig,d=function(){function e(e){this.animationModel=e,this.disposable=new n.CompositeDisposable}return e.prototype.dispose=function(){this.disposable.dispose()},e.prototype.onMouseDown=function(e){this.container.focus(),this.onMouseChange(e)},e.prototype.onMouseChange=function(e){this.renderer&&(this.animationModel.keyframeSelection.isMultiSelect()||!this.animationModel.isLayerOfTypeSelected("Body")?(this.container.childNodes[1].pointerEvents="none",this.container.childNodes[1].style.cursor="not-allowed"):(this.container.childNodes[1].pointerEvents="",this.container.childNodes[1].style.cursor="pointer"))},e.prototype._getThreeColorFromConfig=function(e){var t=atom.config.get("jibo-sdk."+e);return new i.THREE.Color(t.red/255,t.green/255,t.blue/255)},e.prototype._updateBackgroundColor=function(){var e=this._getThreeColorFromConfig("AnimationEditorBackgroundColor");this.renderer.setBackgroundColor(e.r,e.g,e.b,1)},e.prototype._updateGridColor=function(){this.renderer.setGrid(.05,6,this._getThreeColorFromConfig("AnimationEditorGridColor"))},e.prototype.getPaddedValueString=function(e){var t=e<10?"0":"";return t+e},e.prototype.setCamera=function(e){var t=this,o=.35,n=.5,a=new i.THREE.Vector3(0,0,.15);this.renderer.scene._controls.reset();var r={front:function(){t.renderer.setCamera(new i.THREE.Vector3(n,0,o),a,45)},back:function(){t.renderer.setCamera(new i.THREE.Vector3(-n,0,o),a,45)},left:function(){t.renderer.setCamera(new i.THREE.Vector3(0,n,o),a,45)},right:function(){t.renderer.setCamera(new i.THREE.Vector3(0,-n,o),a,45)}};r[e]()},e.prototype.initialize=function(e,t){var o=this;this.container=e,e.addEventListener("mousemove",this.onMouseChange.bind(this),!0),e.addEventListener("mousedown",this.onMouseDown.bind(this),!0),e.addEventListener("mouseup",this.onMouseChange.bind(this),!0),a.RobotInfo.createInfo(l,function(n){a.visualize.createRobotRenderer(n,e,a.visualize.DisplayType.BODY,function(a){a&&(o.renderer=a,o.robotInfo=n,o.dofValues=n.getDefaultDOFValues(),o.debug=new s.default(o.renderer.scene.getScene()),a.setCamera(new i.THREE.Vector3(.5,0,.35),new i.THREE.Vector3(0,0,.15),45),o.dofController=r.default.createWithRenderer(o.renderer,e,r.default.ControllerType.BODY,n),o.dofController.setDOFValues(o.dofValues),o.listenForChanges(),o._updateBackgroundColor(),o.disposable.add(atom.config.observe("jibo-sdk.AnimationEditorBackgroundColor",function(){o._updateBackgroundColor()})),o._updateGridColor(),o.disposable.add(atom.config.observe("jibo-sdk.AnimationEditorGridColor",function(){o._updateGridColor()})),t(null))})})},e.prototype.listenForChanges=function(){var e=this,t=this;this.dofController.on(r.default.EventType.DOF_VALUES_CHANGED,function(o,i){var n=e.animationModel.getLayersOfType("Body");0!==n.length&&"Body"===e.animationModel.getSelectedLayer().type&&(i.topSection_r&&t.animationModel.updateSelectedLayerPropertiesRelative({Head:i.topSection_r/Math.PI*180}),i.middleSection_r&&t.animationModel.updateSelectedLayerPropertiesRelative({Torso:i.middleSection_r/Math.PI*180}),i.bottomSection_r&&t.animationModel.updateSelectedLayerPropertiesRelative({Pelvis:i.bottomSection_r/Math.PI*180}))}),this.dofController.on(r.default.EventType.DOF_SELECTION_CHANGED,function(e,t){1!==t.length}),this.dofController.on(r.default.EventType.DOF_MANIPULATION_ENDED,function(){t.animationModel.addRedoUndoEntry()})},e.prototype.updateDofValues=function(e){this.dofValues=e,this.dofController&&this.dofController.setDOFValues(this.dofValues)},e.prototype.update=function(){this.renderer&&this.renderer.display(this.dofValues)},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=d},{"../views/three-debug":45,"./dof-controller":8,"animation-utilities":void 0,atom:void 0}],8:[function(e,t,o){"use strict";var i=e("animation-utilities"),n={DOF_VALUES_CHANGED:"DOF_VALUES_CHANGED",DOF_SELECTION_CHANGED:"DOF_SELECTION_CHANGED",DOF_MANIPULATION_ENDED:"DOF_MANIPULATION_ENDED"},a={BODY:"BODY"},r=function(e,t,o,i){if(o!==a.BODY)throw new Error("DOFController: unsupported controller type: "+o);return new c(e,t,o,i)},s="topSection_r",l="middleSection_r",d="bottomSection_r",c=function(e,t,o,a){this.renderer=e,this.scene=e.scene,this.controllerType=o,this.robotInfo=a,e.setGrid(.1,4,new i.THREE.Color(.2,.2,.2)),this.dofValues={};for(var r=a.getDOFNames(),c=0;c0){o=u.getSelectedDOFs()[0],v=!0;var i=.5*e.movementX*Math.PI/180,a=u.dofValues[o]+i,r={};r[o]=a,e.shiftKey&&(o===l&&(r[s]=u.dofValues[s]-i),o===d&&(r[l]=u.dofValues[l]-i)),u.setDOFValues(r),u._fireEvent(n.DOF_VALUES_CHANGED,r)}}else o=p(e,m,u.scene.getScene(),u.scene.getCamera()),o&&(u.setSelectedDOFs([o]),u._fireEvent(n.DOF_SELECTION_CHANGED,u.getSelectedDOFs()))},k=function(e){y&&f&&g(e)&&b(e,!0)},S=function(){y&&(y=!1,f&&(v&&(v=!1,u._fireEvent(n.DOF_MANIPULATION_ENDED)),null!==u.getSelectedDOFs()&&u.getSelectedDOFs().length>0&&(u.setSelectedDOFs([]),u._fireEvent(n.DOF_SELECTION_CHANGED,u.getSelectedDOFs()))))},w=function(e){y=!0,f&&g(e)&&b(e,!1)};this.detachFromContainer=function(e){void 0!==e&&e!==!0||u.renderer.detachFromContainer(),null!==m&&(m.removeEventListener("mousemove",k,h),m.removeEventListener("mouseup",S,h),m.removeEventListener("mouseleave",S,h),m.removeEventListener("mousedown",w,h),v&&(v=!1,u._fireEvent(n.DOF_MANIPULATION_ENDED)),null!==u.getSelectedDOFs()&&u.getSelectedDOFs().length>0&&(u.setSelectedDOFs([]),u._fireEvent(n.DOF_SELECTION_CHANGED,u.getSelectedDOFs())),f=!1,m=null)},this.attachToContainer=function(e,t){u.detachFromContainer(t),m=void 0!==e?e:null,null!==m&&(void 0!==t&&t!==!0||u.renderer.attachToContainer(m),m.addEventListener("mousemove",k,h),m.addEventListener("mouseup",S,h),m.addEventListener("mouseleave",S,h),m.addEventListener("mousedown",w,h),f=!0)},this.dispose=function(e){u.detachFromContainer(!1),null!==u.renderer&&(void 0!==e&&e!==!0||u.renderer.dispose(),u.renderer=null),u.scene=null,u.robotInfo=null,u.eventListeners=null},this.attachToContainer(t,!1)};c.prototype.getDOFValues=function(){return this.dofValues},c.prototype.setDOFValues=function(e){for(var t=Object.keys(e),o=0;o0){var l=h[s[0].object.name];return l||null}return null};Object.defineProperty(o,"__esModule",{value:!0}),o.default={EventType:n,ControllerType:a,createWithRenderer:r}},{"animation-utilities":void 0}],9:[function(e,t,o){"use strict";function i(e,t,o){var i=[t,0];return w.apply(i,E.call(arguments,2)),M.apply(e,i),e}var n=this&&this.__extends||function(e,t){function o(){this.constructor=e}for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)},a=e("events"),r=e("jibo-keyframes"),s=r.JiboKeyframeInfo,l=e("lodash"),d=e("../../common/undo-redo"),c=e("../../common/clipboard"),u=e("animation-utilities"),h=e("./keyframe-selection"),p=e("fs"),m=e("path"),f=e("crypto"),v=e("./keyframes-compositer"),y="win32"===process.platform?process.env.HOMEPATH:process.env.HOME,g=m.resolve(y,".jibo");p.existsSync(g)||p.mkdirSync(g);var b=m.resolve(g,"temp");p.existsSync(b)||p.mkdirSync(b);var k=function(e){function t(t,o){var i=e.call(this)||this;i.setMaxListeners(100),i.limits={},i.editor=t,i.projectRoot=o,i.compositer=new v.default(m.dirname(i.editor.uri)),i.state={selection:{layers:[null]}},i.keyframeSelection=new h.default(i),i.uiState={currentTime:0,currentKeyframe:0,isPlaying:!1},i.getDofLimits(),i._reloadFile(t.uri);var n=f.createHash("md5");n.update(t.uri);var a=n.digest("hex"),r=m.basename(a),s=b+"/"+r+".backup";return p.existsSync(s)||i.backup(),i.undoRedo=new d.default(i),i}return n(t,e),t.createNewFile=function(e){var t=r.runtime.create(s);r.runtime.save(e,t)},t.prototype.dispose=function(){delete this.state,delete this.uiState,this.requestAnimationID&&window.cancelAnimationFrame(this.requestAnimationID)},t.prototype.getCompositedKeyframes=function(){return this.compositer.compositeKeyframes(this.state.keyframes)},t.prototype.getDofLimits=function(){var e=this,t=new u.JiboConfig;u.RobotInfo.createInfo(t,function(t){t.getBodyDOFNames().forEach(function(o){var i=r.channels.dofNameToDisplayName(o);e.limits[i]={};var n=t.getDOFInfo(o),a=n.getLimit("velocity"),s=n.getLimit("acceleration");e.limits[i].velocityLimit=a,e.limits[i].accelerationLimit=s}),e.robotInfo=t,e.emit("onpropertieschanged")})},t.prototype.setLimit=function(e,t){this.limits.exceedsVelLimit=e,this.limits.exceedsAccelLimit=t},t.prototype.getKeyframeInfo=function(){return s},t.prototype.getLayer=function(e){for(var t=0;t=this.state.keyframes.duration&&this.setKeyframe(this.state.keyframes.duration-1),this.isPlaying()&&this.togglePlay(),t!==this.state.selection.layers[0]&&this.emit("layerselected")},t.prototype.reloadFile=function(){this._reloadFile(this.editor.uri)},t.prototype._reloadFile=function(e){var t=this;return this.state?(this.state.keyframes=r.runtime.load(e,s),this.state.overrides={},this.state.keyframes.layers.forEach(function(e){t.state.overrides[e.id]={}}),this.syncOverrides(),this.reload(this.state),this.emit("ondatachanged"),void this.emit("onpropertieschanged")):(console.warn("attempting to reload destroyed AM for ",this),"")},t.prototype.getDuration=function(){return this.state.keyframes.duration},t.prototype.setDuration=function(e,t,o){return this.state.keyframes.duration=this.multiplier&&!t?Math.ceil(e*this.multiplier):e,o&&(this.state.keyframes.layers.forEach(function(t){var o=l.findIndex(t.keyframes,function(t){return t.time>=e});o!==-1&&(t.keyframes=t.keyframes.slice(0,o))}),this.uiState.currentKeyframe>=this.state.keyframes.duration&&this.setKeyframe(this.state.keyframes.duration-1),this.keyframeSelection.validateSelection()),this.emit("ondatachanged"),this.emit("onpropertieschanged"),this.state.keyframes.duration},t.prototype.setKeyframes=function(){var e=this;this.multiplier&&(this.state.keyframes.layers.forEach(function(t){t.keyframes.forEach(function(t){t.time=Math.floor(t.time*e.multiplier)})}),this.syncOverrides(),this.emit("ondatachanged"),this.emit("onpropertieschanged"))},t.prototype.setScale=function(e){e!==this.state.keyframes.scale&&(this.state.keyframes.scale&&(this.multiplier=e/this.state.keyframes.scale),this.state.keyframes.scale=e)},t.prototype.insertBlankFrame=function(e){var t=this,o=[];this.keyframeSelection.forEachLayerSelected(!0,function(e){o.push(t.getLayer(e))});var i=this.keyframeSelection.getLengthSelected();this.setDuration(this.state.keyframes.duration+i,!0,!0),o.forEach(function(t){t.keyframes.forEach(function(t){t.time>=e&&(t.time+=i)})}),this.emit("ondatachanged"),this.emit("onpropertieschanged")},t.prototype.deleteFrame=function(e){var t=this,o=[];this.keyframeSelection.forEachLayerSelected(!0,function(e){o.push(t.getLayer(e))});var i=this.keyframeSelection.getLengthSelected();o.forEach(function(o){for(var n=0;ne+i?a.time-=i:a.time>=e&&a.timet){e.keyframes=i(e.keyframes,a,n),o=!0;break}o||e.keyframes.push(n),this.addRedoUndoEntry()},t.prototype.keyframeExists=function(e,t){var o=this.getLayer(e);return!!o&&l.findIndex(o.keyframes,function(e){return t===e.time})!==-1},t.prototype.getKeyframe=function(e,t){var o=this.getLayer(e);if(o){var i=l.findIndex(o.keyframes,function(e){return t===e.time});if(t!==-1)return o.keyframes[i]}return null},t.prototype.moveKeyframe=function(e,t,o,i,n,a){var r=this.getLayer(e),s=this.getLayer(o),d=l.findIndex(r.keyframes,function(e){return e.time===t}),c=r.keyframes[d];a||r.keyframes.splice(d,1),this.upsertKeyframe(s,i,c.value),this.syncOverrides(),n!==!1&&(this.emit("ondatachanged"),this.emit("onpropertieschanged"))},t.prototype.upsertKeyframe=function(e,t,o){var n=l.findIndex(e.keyframes,function(e){return e.time===t}),a={value:l.cloneDeep(o),time:t};if(n!==-1)e.keyframes[n]=a;else if(0===e.keyframes.length||e.keyframes[e.keyframes.length-1].timet});e.keyframes=i(e.keyframes,r,a)}},t.prototype.resetKeyframes=function(){for(var e in this.state.overrides)this.state.overrides[e]=this.getDefaultPropsForLayerType(this.getLayer(e).type)},t.prototype.syncOverrides=function(){var e=this;this.state.overrides={},this.state.keyframes.layers.forEach(function(t){var o=r.runtime.evaluateLayer(t,e.state.keyframes,s,e.uiState.currentTime);e.state.overrides[t.id]=o})},t.prototype.evaluateAllDOFLayers=function(){var e=this.getCompositedKeyframes(),t=r.runtime.evaluateAllDOFLayers(e,s,this.uiState.currentTime,this.state.overrides);return t},t.prototype.evaluateAllLayersFiltered=function(e){var t=r.runtime.evaluateAllLayersFiltered(this.state.keyframes,s,this.uiState.currentTime,e,!0,this.state.overrides);return t},t.prototype.getDefaultPropsForLayerType=function(e){var t=s.layerTypes[e].getInfo(),o={};for(var i in t.properties)o[i]=l.cloneDeep(t.properties[i].defaultValue);return o},t.prototype.saveFile=function(e){this.state?(r.runtime.save(e,this.state.keyframes),this.emit("save")):console.error("Attempting to save destroyed AM for uri ",this.editor.uri)},t.prototype.isLayerSelected=function(e){for(var t=0;tthis.state.keyframes.duration/this.state.keyframes.framerate;)this.uiState.currentTime-=this.state.keyframes.duration/this.state.keyframes.framerate;var o=Math.floor(this.uiState.currentTime*this.state.keyframes.framerate);this.uiState.currentKeyframe!==o&&this.setKeyframe(o,!0),this.requestAnimationID=window.requestAnimationFrame(this.playLoop.bind(this))},t.prototype.togglePlay=function(){this.isPlaying()?(window.cancelAnimationFrame(this.requestAnimationID),this.requestAnimationID=void 0):(this.lastLoopTime=(new Date).getTime(),this.requestAnimationID=window.requestAnimationFrame(this.playLoop.bind(this))),this.uiState.isPlaying=!this.uiState.isPlaying,this.emit("ondatachanged"),this.emit("toggle-play",this.uiState.isPlaying)},t.prototype.getCurrentTime=function(){return this.uiState.currentTime},t.prototype.stepTimeForward=function(){this.isPlaying()&&this.togglePlay(),this.setKeyframe((this.uiState.currentKeyframe+1)%this.state.keyframes.duration)},t.prototype.stepTimeBackward=function(){this.isPlaying()&&this.togglePlay(),0===this.uiState.currentKeyframe?this.setKeyframe(this.state.keyframes.duration-1):this.setKeyframe(this.uiState.currentKeyframe-1)},t.prototype.nextLayer=function(){if(!(this.state.keyframes.layers.length<2))for(var e=0;e0?e-1:this.state.keyframes.layers.length-1;return this.setSelection(this.state.keyframes.layers[t].id),void this.addRedoUndoEntry()}},t.prototype.canMoveUp=function(e){if(this.state.keyframes.layers.length<2)return!1;var t=this.getLayerIndex(e),o=t>0?t-1:t;return t!==o},t.prototype.canMoveDown=function(e){if(this.state.keyframes.layers.length<2)return!1;var t=this.getLayerIndex(e),o=tt||(t=o.time)}),t===Number.MAX_SAFE_INTEGER?this.setKeyframe(0):this.setKeyframe(t))},t.prototype.goToPrevKeyframe=function(){var e=this,t=-1,o=this.state.selection.layers[0],i=this.getLayer(o);0!==i.keyframes.length&&(i.keyframes.forEach(function(o){o.time>=e.uiState.currentKeyframe||o.time=0?"an":"a";a+="\n "+d+" "+l.type+" layer called "+l.name}a+="\nWhat should we do?";var c=n.showMessageBox(o,{type:"question",buttons:["Cancel the Paste","Add the Extra Layers","Ignore the Extra Layers"],defaultId:1,title:"Clipboard has Extra Layers",message:a});if(0===c)return!1;if(1===c)for(var u=0,h=t;ue?e=i:i=2)return!0;return!1},t.prototype.isAnchor=function(e,t){return this.animationModel.getLayerIndex(e)===this.getState().anchor.layerIndex&&t===this.getState().anchor.keyframeIndex},t.prototype.isSelected=function(e,t){return"undefined"!=typeof this.getState().selected[e]&&i.findIndex(this.getState().selected[e],function(e){return e===t})!==-1},t.prototype.onClick=function(e,t,o){this.onMouseDown(e,t,o)},t.prototype.onMouseDown=function(e,t,o,i){void 0===i&&(i=!1),1!==e.nativeEvent.which&&(e.preventDefault(),e.stopPropagation());var n=a.NORMAL;if("win32"===process.platform?e.nativeEvent.ctrlKey&&(n=a.TOGGLE):e.nativeEvent.metaKey&&(n=a.TOGGLE),"click"!==e.type||!this.isSingleSelect()&&n!==a.TOGGLE){var r=this.isSelected(t,o);if("click"===e.type||n!==a.NORMAL||e.nativeEvent.shiftKey!==!1||!r){n===a.NORMAL&&("click"===e.type||e.nativeEvent.shiftKey===!0||r===!1&&"click"!==e.type&&e.nativeEvent.shiftKey!==!0)&&(this.animationModel.setKeyframe(o),this.animationModel.setSelection(t),this._clearSelection(),i=!0);var s=this.animationModel.getLayerIndex(t);if(e.nativeEvent.shiftKey===!1)this._addKeyframe(t,o,n)&&(i=!0);else for(var l=Math.min(this.anchor.layerIndex,s),d=Math.max(this.anchor.layerIndex,s),c=l;c<=d;c++)for(var u=Math.min(this.anchor.keyframeIndex,o),h=Math.max(this.anchor.keyframeIndex,o),p=u;p<=h;p++)this._addKeyframe(this.animationModel.getLayerByIndex(c).id,p,n)&&(i=!0);e.nativeEvent.shiftKey===!1&&(this.anchor.layerIndex=s,this.anchor.keyframeIndex=o);var m=this.animationModel.getLayerByIndex(s);m!==this.animationModel.getSelectedLayer()&&(this.animationModel.setSelection(t),i=!0),i&&(this.animationModel.addRedoUndoEntry(),this.animationModel.emit("ondatachanged"))}}},t.prototype.clearSelection=function(){this._clearSelection()&&(this.animationModel.addRedoUndoEntry(),this.animationModel.emit("ondatachanged"))},t.prototype.selectAll=function(){this._clearSelection();for(var e=0;e=i.animationModel.getLayerCount()?void(l[e]=!0):void(i.animationModel.getLayerByIndex(t).type!==i.animationModel.getLayerByIndex(o).type&&(s=!0))}),!s){var d=a<0,c=r<0;if(this.forEachSelected(c,d,function(e,t,s){var l=i.animationModel.getLayerIndex(e)+r,d=i.animationModel.getLayerByIndex(l).id,c=t+a;i.animationModel.keyframeExists(e,t)&&(l>=0&&l<=n.animationModel.getLayerCount()-1&&c>=0&&c<=n.animationModel.getDuration()-1?n.animationModel.moveKeyframe(e,t,d,c,!0,o):o||n.animationModel._deleteKeyByTime(e,t));var u=i.getState().selected[e];u[s]=u[s]+a}),t.layerId!==e.layerId){for(var u in l)delete this.getState().selected[u];var h={};for(var u in this.getState().selected){var p=this.animationModel.getLayerIndex(u);h[this.animationModel.getLayerByIndex(p+r).id]=this.getState().selected[u]}this.getState().selected=h}this.animationModel.setSelection(t.layerId),this.animationModel.addRedoUndoEntry(),this.animationModel.emit("ondatachanged"),this.animationModel.emit("onpropertieschanged")}},t.prototype.cutSelectedKeyframes=function(){this.copySelectedKeyframes(),this.deleteKeyframes()},t.prototype.copySelectedKeyframes=function(){var e,t=this;if(this.isMultiSelect())e=this.getState().selected;else{var o=this.getCurrentKeyframe();if(void 0===o.layerId)return;e={},e[o.layerId]=[o.keyframeIndex]}var a=this.animationModel.getDuration()-1,r=this.animationModel.getLayerCount()-1;for(var s in e)r=Math.min(r,this.animationModel.getLayerIndex(s)),e[s].forEach(function(e){a=Math.min(a,e)});var l=[],d=function(o){var n=c.animationModel.getLayer(o),s={layerType:n.type,type:n.type,name:n.name,layerIndex:c.animationModel.getLayerIndex(o)-r,keyframes:[]};e[o].forEach(function(e){var n=t.animationModel.getKeyframe(o,e);n?s.keyframes.push({keyframeIndex:e-a,value:i.cloneDeep(n.value)}):s.keyframes.push({keyframeIndex:e-a,value:null})}),l.push(s)},c=this;for(var s in e)d(s);if(l=i.sortBy(l,function(e){return e.layerIndex}),l.length){var u={type:"keyframes",value:l};n.default.animationData=JSON.stringify(u)}},t.prototype.pasteKeyframes=function(e,t){var o=this.animationModel.getLayerByIndex(0).id;if(this.canPasteKeyframes(o,!0)!==!1){var i=this._clearSelection(),n=this.getLayerMaps(o),r=n.srcMap,s=n.dstMap,l=this.getFinalDurationOfCopy(r,s,t)+1;this.possiblyExtendDuration(l);var d=this.animationModel.getDuration(),c=[];for(var u in r){var h=r[u],p=s[u]||{};for(var m in h)if(m in p)for(var f=h[m],v=p[m],y=0,g=f.keyframes;y=d)break;null!==b.value&&this.animationModel.upsertKeyframe(v,k,b.value),i=!0,c.push({id:v.id,index:k})}}i&&(this.animationModel.syncOverrides(),this.animationModel.emit("ondatachanged"),this.animationModel.emit("onpropertieschanged"),this.animationModel.addRedoUndoEntry());for(var S=0,w=c;S=l)break;null!==m.value&&this.animationModel.upsertKeyframe(u,f,m.value),o=!0,d.push({id:u.id,index:f})}o&&(this.animationModel.syncOverrides(),this.animationModel.emit("ondatachanged"),this.animationModel.emit("onpropertieschanged"),this.animationModel.addRedoUndoEntry());for(var v=0,y=d;vo){var i=atom.getCurrentWindow(),n=e("remote"),a=n.dialog||n.require("dialog"),r=t-o,s="You are pasting keyframes beyond the end of your animation. Would you like to extend the animation by "+r+" frames to make it fit?",l=a.showMessageBox(i,{type:"question",buttons:["No","Yes"],defaultId:1,title:"Paste Duration Exceeds Model",message:s});if(0===l)return!1;this.animationModel.setDuration(t,!0,!0)}},t.prototype.getFinalDurationOfCopy=function(e,t,o){var i=0;for(var n in e){var a=e[n],r=t[n]||{};for(var s in a)if(s in r){var l=a[s],d=l.keyframes[l.keyframes.length-1];i=Math.max(i,d.keyframeIndex)}}return i+o},t.prototype.getFinalDurationOfSingleLayer=function(e,t){var o=e[0],i=o.keyframes[o.keyframes.length-1].keyframeIndex;return i+t},t.prototype._clearSelection=function(){var e=!1;for(var t in this.getState().selected)this.getState().selected[t].length&&(e=!0);return this.getState().selected={},e},t.prototype._addKeyframe=function(e,t,o){var n,r=o===a.TOGGLE&&this.isSelected(e,t);if(r){if("undefined"==typeof this.getState().selected[e])return!1;n=this.getState().selected[e].length,i.remove(this.getState().selected[e],function(e){return e===t})}else{if("undefined"==typeof this.getState().selected[e])return this.getState().selected[e]=[t],!0;n=this.getState().selected[e].length,this.getState().selected[e].push(t),this.getState().selected[e].sort(function(e,t){return e-t}),this.getState().selected[e]=i.uniq(this.getState().selected[e])}return n!==this.getState().selected[e].length},t.prototype.hasLockedLayer=function(e){for(var t=e?[e]:Object.keys(this.getState().selected),o=0,i=t;o=0;t--){var o=e.layers[t];"Reference"===o.type&&e.layers.splice(t,1)}},e.prototype.timeshift=function(e,t,o,i){for(var n=0,a=e.layers;no&&(r.validUpto=o),r.holdAfter>i&&(r.holdAfter=i);for(var s=0,l=r.keyframes;s=0;i--)t.layers.splice(e,0,o.layers[i])},e.prototype.fixLayerIds=function(e,t){for(var o=0,i=0,n=e.layers;i=0},e.prototype.hasCircularReference=function(e,t){for(var o=0,i=e.layers;o=0)return!0}return!1},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=s},{fs:void 0,"jibo-keyframes":void 0,path:void 0}],12:[function(e,t,o){"use strict";var i=e("react"),n=e("./visualizer"),a=e("./timeline"),r=e("../../atom-react/mixins/pane-resize-event-mixin"),s=e("../../common/layout/layout"),l=e("../../common/layout/h-layout"),d=e("../../common/layout/v-layout"),c=e("./properties"),u=e("./pixi/pixi-view"),h=e("atom"),p=e("lodash"),m=e("fs"),f=e("jibo"),v=e("jibo-keyframes").JiboKeyframeInfo,y=i.createClass({displayName:"editor",mixins:[r.default],getInitialState:function(){return{visualizerWidth:0,visualizerHeight:0,timelineWidth:0,timelineHeight:0,focusOnProps:!0}},componentWillMount:function(){var e=this,t=this;this.props.editor.animationModel.on("ondatachanged",function(){t.forceUpdate()}),this.props.editor.animationModel.on("onpropertieschanged",function(){e.checkModified()}),this.props.editor.animationModel.on("save",function(){e.checkModified()})},checkModified:function(){var e=this;try{m.readFile(this.props.editor.uri,"utf8",function(t,o){var i=JSON.parse(o);v.onLoad(i),e.props.editor.animationModel.state&&(p.isEqual(i,e.props.editor.animationModel.state.keyframes)?e.props.editor.setModifiedStatus(!1):e.props.editor.setModifiedStatus(!0))})}catch(e){console.warn("error reading keyframes file, ",e)}},componentDidMount:function(){var e=this;this.setupPaneResizeEventMixin(),this.disposables=new h.CompositeDisposable,this.disposables.add(atom.commands.add(this.getDOMNode(),{"jibo-sdk:select-all-keyframes":this.selectAllKeyframes,"jibo-sdk:clear-keyframe-selection":this.clearKeyframeSelection,"jibo-sdk:upsert-keyframe":this.ifAllowed(this.upsertKeyframe),"jibo-sdk:upsert-all":this.upsertAllKeyframes,"jibo-sdk:reset-keyframes":this.ifAllowed(this.resetKeyframes),"jibo-sdk:delete":this.ifAllowed(this.deletePressed),"jibo-sdk:insert-blank-frame":this.ifAllowed(this.insertBlankFrame),"jibo-sdk:delete-frame":this.ifAllowed(this.deleteFrame),"jibo-sdk:start-playing":this.startPlaying,"jibo-sdk:stop-playing":this.stopPlaying,"jibo-sdk:step-backward":this.stepBackward,"jibo-sdk:step-forward":this.stepForward,"jibo-sdk:next-layer":this.nextLayer,"jibo-sdk:previous-layer":this.previousLayer,"core:undo":this.undo,"core:redo":this.redo,"core:cut":this.ifAllowed(this.cut),"core:copy":this.copy,"core:paste":this.ifAllowed(this.paste),"jibo-sdk:lose-focus":this.setEditorFocus,"jibo-sdk:upsert-and-save":this.ifAllowed(this.upsertAndSave)}));var t=this;requestAnimationFrame(function(){t.setState({visualizerWidth:Math.floor(e.props.paneWidth/2)-4,visualizerHeight:Math.floor(e.props.paneHeight/2)-4,timelineWidth:Math.floor(e.props.paneWidth/2)-4,timelineHeight:Math.floor(e.props.paneHeight/2)-20})}),this.onFocusInCB=this.onFocusIn.bind(this),this.getDOMNode().addEventListener("focusin",this.onFocusInCB,!0),this.onFocusOutCB=this.onFocusOut.bind(this),this.getDOMNode().addEventListener("focusout",this.onFocusOutCB,!0)},ifAllowed:function(e){var t=this;return function(o){t.props.editor.animationModel.keyframeSelection.hasLockedLayer()||e(o)}},onFocusIn:function(){},onFocusOut:function(e){this.props.editor.isPaneActive()!==!1&&(null!==e.relatedTarget&&e.relatedTarget!==document.getElementsByClassName("workspace")[0]||this.getDOMNode().focus())},startPlaying:function(){this.props.editor.animationModel.togglePlay()},stopPlaying:function(){this.props.editor.animationModel.isPlaying()&&this.props.editor.animationModel.togglePlay()},stepBackward:function(){this.props.editor.animationModel.stepTimeBackward(),this.props.editor.animationModel.keyframeSelection.clearSelection()},stepForward:function(){this.props.editor.animationModel.stepTimeForward(),this.props.editor.animationModel.keyframeSelection.clearSelection()},nextLayer:function(){this.props.editor.animationModel.nextLayer()},previousLayer:function(){this.props.editor.animationModel.previousLayer()},undo:function(){this.props.editor.animationModel.undo()},redo:function(){this.props.editor.animationModel.redo()},cut:function(){this.props.editor.animationModel.keyframeSelection.cutSelectedKeyframes()},copy:function(){this.props.editor.animationModel.keyframeSelection.copySelectedKeyframes()},paste:function(){if(this.props.editor.animationModel.keyframeSelection.isSingleSelect()){var e=this.props.editor.animationModel.keyframeSelection.getCurrentKeyframe();this.props.editor.animationModel.keyframeSelection.pasteKeyframes(e.layerId,e.keyframeIndex)}},deletePressed:function(){ this.props.editor.animationModel.keyframeSelection.deleteKeyframes()},selectAllKeyframes:function(){this.props.editor.animationModel.keyframeSelection.selectAll()},clearKeyframeSelection:function(){this.props.editor.animationModel.keyframeSelection.clearSelection()},upsertKeyframe:function(){this.props.editor.animationModel.keyframeSelection.isSingleSelect()&&this.props.editor.animationModel.upsertKeyframes()},upsertAllKeyframes:function(){this.props.editor.animationModel.keyframeSelection.isSingleSelect()&&this.props.editor.animationModel.upsertKeyframes(!0)},resetKeyframes:function(){this.props.editor.animationModel.keyframeSelection.isSingleSelect()&&this.props.editor.animationModel.resetKeyframes()},upsertAndSave:function(){this.props.editor.animationModel.keyframeSelection.isSingleSelect()&&this.upsertKeyframe(),atom.commands.dispatch(this.getDOMNode(),"core:save")},insertBlankFrame:function(){var e=1e4;this.props.editor.animationModel.keyframeSelection.forEachSelected(!0,!0,function(t,o){o0))return;if(d===this.file)return;this.file=d;var c=p.resolve(l,"audio",d);this.clearCanvas();var u=new XMLHttpRequest;u.open("GET",c,!0),u.responseType="arraybuffer",u.onload=function(){h.decodeAudioData(u.response,function(e){var i=e.getChannelData(0),n=s.findDOMNode(t.refs.canvas),a=Math.min(o.state.keyframes.duration/o.state.keyframes.framerate-r,e.length/e.sampleRate);n.width=18*a*30,n.height=40;var l=n.getContext("2d");l.beginPath(),l.moveTo(0,20);for(var d=1/540,c=0,u=0;u=o.props.animationModel.getDuration()||l<0||l>=o.props.animationModel.getLayerCount()||(t.props.animationModel.getLayerByIndex(a).type!==t.props.animationModel.getLayerByIndex(l).type?o.getDOMNode().parentNode.parentNode.parentNode.childNodes[1+l].childNodes[0].childNodes[n].classList.add("drag-over-mismatched"):t.props.animationModel.keyframeExists(e,i)?o.getDOMNode().parentNode.parentNode.parentNode.childNodes[1+l].childNodes[0].childNodes[n].classList.add("drag-over"):o.getDOMNode().parentNode.parentNode.parentNode.childNodes[1+l].childNodes[0].childNodes[n].classList.add("drag-over-empty"))}),n={layerId:this.props.layerId,keyframeIndex:this.props.keyframeIndex}}},onDragLeave:function(){delete this.getDOMNode().style.background},clearDragOverClasses:function(){for(var e=document.getElementsByClassName("animation-channel-keyframes"),t=0;t120||r<-120?(this.lastAngle=(this.tempInitialRotation+a)/Math.PI*180-r,this.tempInitialRotation=this.lastAngle*Math.PI/180,this.tempInitialAngle=o):this.lastAngle=(this.tempInitialRotation+a)/Math.PI*180,this.animationModel.updateSelectedLayerPropertiesRelative({ Rotate:this.lastAngle})},e.prototype.dispose=function(){this.renderer.view.removeEventListener("mousedown",this.onMouseDown),document.removeEventListener("mouseup",this.onMouseUp),this.disposed=!0},e.prototype.scaleSpheres=function(){},e.prototype.display=function(){},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=a},{"../pixi-view":25,"animation-utilities":void 0}],19:[function(e,t,o){"use strict";var i=e("jibo-keyframes"),n=e("animation-utilities"),a=e("../pixi-view"),r=function(){function e(e,t,o,a){var r=this;this.matrix=new PIXI.Matrix,this.matrix.identity(),this.renderer=e,this.robotInfo=t,this.screenWidth=this.robotInfo.getEyeScreenInfo().getWidth(),this.screenHeight=this.robotInfo.getEyeScreenInfo().getHeight(),this.animationModel=o,this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onEyeDown=this.onEyeDown.bind(this),this.onEyeMove=this.onEyeMove.bind(this),this.onEyeUp=this.onEyeUp.bind(this),this.stage=new PIXI.Container,this.renderToTop(),this.spheres=[],this.prefix=a?"overlay_vertexJoint":"vertexJoint",this.defaultVertexPositions=n.EyeKinematicsHelper.verticesForDOFValues(t.getDefaultDOFValues(),t);var s=0;Object.keys(this.defaultVertexPositions).forEach(function(e){if(0===e.indexOf(r.prefix)){if(e===r.prefix+"8"&&(r.defaultHeight=i.conversion.toPixelsY(r.defaultVertexPositions[e].y)),e===r.prefix+"6"&&(r.defaultWidth=i.conversion.toPixelsX(r.defaultVertexPositions[e].x)),e!==r.prefix+"5"){var t=r.defaultVertexPositions[e];t.x=i.conversion.toPixelsX(t.x),t.y=i.conversion.toPixelsY(t.y),r.createSphere(t,e,s)}s++}}),this.eye=a?this.renderer.eye.eyeOverlay:this.renderer.eye.eye,this.eye.interactive=!0,this.eye.on("mousedown",this.onEyeDown)}return e.prototype.onEyeDown=function(e){var t=a.WIDTH*e.data.originalEvent.offsetX/this.renderer.view.offsetWidth,o=a.HEIGHT*e.data.originalEvent.offsetY/this.renderer.view.offsetHeight;t/=this.renderer.eye.zoom,o/=this.renderer.eye.zoom,this.delta=new PIXI.Point(t-this.stage.x,o-this.stage.y),this.renderer.view.addEventListener("mousemove",this.onEyeMove),document.addEventListener("mouseup",this.onEyeUp)},e.prototype.onEyeMove=function(e){var t=a.WIDTH*e.offsetX/this.renderer.view.offsetWidth,o=a.HEIGHT*e.offsetY/this.renderer.view.offsetHeight;t/=this.renderer.eye.zoom,o/=this.renderer.eye.zoom,t-=.5*a.WIDTH+this.delta.x,o-=.5*a.HEIGHT+this.delta.y;var i={};i.Translate={x:t,y:o},this.animationModel.updateSelectedLayerPropertiesRelative(i)},e.prototype.onEyeUp=function(){this.renderer.view.removeEventListener("mousemove",this.onEyeMove),document.removeEventListener("mouseup",this.onEyeUp)},e.prototype.refresh=function(){var e=this;this.spheres.forEach(function(t){t.scale.x=1/e.renderer.eye.zoom/e.stage.scale.x,t.scale.y=1/e.renderer.eye.zoom/e.stage.scale.y})},e.prototype.renderToTop=function(){this.renderer.eye.addChild(this.stage)},e.prototype.createSphere=function(e,t,o){var i=17,n=new PIXI.Graphics;n.beginFill(10027008),n.drawCircle(0,0,i),n.name=t,n.interactive=!0,n.x=e.x,n.y=e.y;var a;switch(o){case 3:case 5:a="";break;case 1:case 7:a="";break;case 0:case 2:case 6:case 8:a=""}var r=new PIXI.Text(a,{fontFamily:"fontawesome",fontSize:24,fill:"#aaaaaa"});r.x=-.5*r.width,r.y=-.5*r.height,n.addChild(r),n.scale.x=1/this.renderer.eye.zoom,n.scale.y=1/this.renderer.eye.zoom,this.stage.addChild(n),this.spheres.push(n);var s=this.spheres.length-1;n.on("mousedown",this.onMouseDown.bind(this,s))},e.prototype.onMouseMove=function(e){var t=a.WIDTH*e.offsetX/this.renderer.view.offsetWidth,o=a.HEIGHT*e.offsetY/this.renderer.view.offsetHeight,i=this.renderer.eye.toLocal(new PIXI.Point(t,o));i.x-=this.stage.x,i.y-=this.stage.y,this.matrix.identity(),this.matrix.rotate(-this.stage.rotation),i=this.matrix.apply(i);var n=Math.abs(i.x)/this.defaultWidth,r=Math.abs(i.y)/this.defaultHeight,s=this.animationModel.getSelectedLayerProperties(),l={};switch(this.index){case 0:case 2:case 5:case 7:this.shiftKey&&(n>r?r=n/this.originalScaleRatio:n=r*this.originalScaleRatio),l.Scale={x:n,y:r};break;case 1:case 6:l.Scale={x:s.Scale.x,y:r};break;default:l.Scale={x:n,y:s.Scale.y}}this.animationModel.updateSelectedLayerPropertiesRelative(l)},e.prototype.onMouseDown=function(e,t){if(this.shiftKey=t.data.originalEvent.shiftKey,this.shiftKey){var o=this.animationModel.getSelectedLayerProperties();this.originalScaleRatio=o.Scale.x/o.Scale.y}t.stopPropagation(),this.index=e,this.renderer.view.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)},e.prototype.onMouseUp=function(){this.renderer.view.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)},e.prototype.dispose=function(){var e=this;this.stage.parent.removeChild(this.stage),this.spheres.forEach(function(t){t.removeListener("mousedown",e.onMouseDown)}),this.eye.removeListener("mousedown",this.onEyeDown)},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=r},{"../pixi-view":25,"animation-utilities":void 0,"jibo-keyframes":void 0}],20:[function(e,t,o){"use strict";var i=this&&this.__extends||function(e,t){function o(){this.constructor=e}for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)},n=e("jibo-keyframes"),a=e("./scale-translate-controller-base"),r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.display=function(e){this.dofValues=e,this.stage.x=n.conversion.toPixelsX(e.overlay_textureSubRootBn_t+.5*this.screenWidth),this.stage.y=-n.conversion.toPixelsX(e.overlay_textureSubRootBn_t_2-.5*this.screenHeight),this.stage.rotation=-e.overlay_textureSubRootBn_r,this.stage.rotation=-e.overlay_textureSubRootBn_r;var t=this.animationModel.getSelectedLayerProperties();void 0!==t&&(this.stage.scale.x=t.Scale.x,this.stage.scale.y=t.Scale.y),this.refresh()},t}(a.default);Object.defineProperty(o,"__esModule",{value:!0}),o.default=r},{"./scale-translate-controller-base":19,"jibo-keyframes":void 0}],21:[function(e,t,o){"use strict";var i=this&&this.__extends||function(e,t){function o(){this.constructor=e}for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)},n=e("jibo-keyframes"),a=e("./scale-translate-controller-base"),r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.display=function(e){this.dofValues=e,this.stage.x=n.conversion.toPixelsX(e.eyeSubRootBn_t+.5*this.screenWidth),this.stage.y=-n.conversion.toPixelsX(e.eyeSubRootBn_t_2-.5*this.screenHeight),this.stage.rotation=-e.eyeSubRootBn_r,this.stage.rotation=-e.eyeSubRootBn_r;var t=this.animationModel.getSelectedLayerProperties();this.stage.scale.x=t.Scale.x,this.stage.scale.y=t.Scale.y,this.refresh()},t}(a.default);Object.defineProperty(o,"__esModule",{value:!0}),o.default=r},{"./scale-translate-controller-base":19,"jibo-keyframes":void 0}],22:[function(e,t,o){"use strict";var i=e("../pixi-view"),n=function(){function e(e,t,o,i){this.renderer=e,this.robotInfo=t,this.screenWidth=this.robotInfo.getEyeScreenInfo().getWidth(),this.screenHeight=this.robotInfo.getEyeScreenInfo().getHeight(),this.animationModel=o,this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.prefix=i?"overlay_vertexJoint":"vertexJoint",this.spheres=[],this.vertexToPropMap={},this.stage=new PIXI.Container,this.renderToTop();for(var n=1;n<10;n++){var a=""+this.prefix+n;this.vertexToPropMap[a]="Vertex "+n,this.createSphere(a,n)}}return e.prototype.refresh=function(){var e=this;this.spheres.forEach(function(t){t.scale.x=1/e.renderer.eye.zoom,t.scale.y=1/e.renderer.eye.zoom})},e.prototype.renderToTop=function(){this.renderer.eye.addChild(this.stage)},e.prototype.createSphere=function(e,t){var o=new PIXI.Graphics;o.beginFill(10027008),o.drawCircle(0,0,17),o.name=e,o.interactive=!0;var i=new PIXI.Text(t,{fontFamily:"Lucida Grande",fontSize:24,fontWeight:"bold",fill:"#aaaaaa"});i.x=-.5*i.width,i.y=-.5*i.height,o.addChild(i),o.scale.x=1/this.renderer.eye.zoom,o.scale.y=1/this.renderer.eye.zoom,this.stage.addChild(o),this.spheres.push(o),o.on("mousedown",this.onMouseDown)},e.prototype.onMouseMove=function(e){var t=i.WIDTH*e.offsetX/this.renderer.view.offsetWidth,o=i.HEIGHT*e.offsetY/this.renderer.view.offsetHeight,n=this.stage.toLocal(new PIXI.Point(t,o)),a=this.vertexToPropMap[this.currentTarget.name],r=this.animationModel.getSelectedLayerProperties(),s={};s[a]={x:n.x/r.Scale.x,y:n.y/r.Scale.y},this.animationModel.updateSelectedLayerPropertiesRelative(s)},e.prototype.onMouseDown=function(e){this.currentTarget=e.target,this.downPosition=this.currentTarget.position,this.renderer.view.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)},e.prototype.onMouseUp=function(){document.removeEventListener("mouseup",this.onMouseUp),this.renderer.view.removeEventListener("mousemove",this.onMouseMove)},e.prototype.dispose=function(){var e=this;this.stage.parent.removeChild(this.stage),this.spheres.forEach(function(t){t.removeListener("mousedown",e.onMouseDown)})},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=n},{"../pixi-view":25}],23:[function(e,t,o){"use strict";var i=this&&this.__extends||function(e,t){function o(){this.constructor=e}for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)},n=e("jibo-keyframes"),a=e("./vertex-controller-base"),r=function(e){function t(t,o,i){return e.call(this,t,o,i,!1)||this}return i(t,e),t.prototype.display=function(e){this.dofValues=e,this.stage.x=n.conversion.toPixelsX(e.eyeSubRootBn_t+.5*this.screenWidth),this.stage.y=-n.conversion.toPixelsX(e.eyeSubRootBn_t_2-.5*this.screenHeight),this.stage.rotation=-e.eyeSubRootBn_r,this.spheres[0].x=n.conversion.toPixelsX(e.vertexJoint1_t),this.spheres[0].y=n.conversion.toPixelsY(e.vertexJoint1_t_2),this.spheres[1].x=n.conversion.toPixelsX(e.vertexJoint2_t),this.spheres[1].y=n.conversion.toPixelsY(e.vertexJoint2_t_2),this.spheres[2].x=n.conversion.toPixelsX(e.vertexJoint3_t),this.spheres[2].y=n.conversion.toPixelsY(e.vertexJoint3_t_2),this.spheres[3].x=n.conversion.toPixelsX(e.vertexJoint4_t),this.spheres[3].y=n.conversion.toPixelsY(e.vertexJoint4_t_2),this.spheres[4].x=n.conversion.toPixelsX(e.vertexJoint5_t),this.spheres[4].y=n.conversion.toPixelsY(e.vertexJoint5_t_2),this.spheres[5].x=n.conversion.toPixelsX(e.vertexJoint6_t),this.spheres[5].y=n.conversion.toPixelsY(e.vertexJoint6_t_2),this.spheres[6].x=n.conversion.toPixelsX(e.vertexJoint7_t),this.spheres[6].y=n.conversion.toPixelsY(e.vertexJoint7_t_2),this.spheres[7].x=n.conversion.toPixelsX(e.vertexJoint8_t),this.spheres[7].y=n.conversion.toPixelsY(e.vertexJoint8_t_2),this.spheres[8].x=n.conversion.toPixelsX(e.vertexJoint9_t),this.spheres[8].y=n.conversion.toPixelsY(e.vertexJoint9_t_2),this.refresh()},t}(a.default);Object.defineProperty(o,"__esModule",{value:!0}),o.default=r},{"./vertex-controller-base":22,"jibo-keyframes":void 0}],24:[function(e,t,o){"use strict";var i=this&&this.__extends||function(e,t){function o(){this.constructor=e}for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)},n=e("jibo-keyframes"),a=e("./vertex-controller-base"),r=function(e){function t(t,o,i){return e.call(this,t,o,i,!0)||this}return i(t,e),t.prototype.display=function(e){this.dofValues=e,this.stage.x=n.conversion.toPixelsX(e.overlay_textureSubRootBn_t+.5*this.screenWidth),this.stage.y=-n.conversion.toPixelsX(e.overlay_textureSubRootBn_t_2-.5*this.screenHeight),this.stage.rotation=-e.overlay_textureSubRootBn_r,this.spheres[0].x=n.conversion.toPixelsX(e.overlay_vertexJoint1_t),this.spheres[0].y=n.conversion.toPixelsY(e.overlay_vertexJoint1_t_2),this.spheres[1].x=n.conversion.toPixelsX(e.overlay_vertexJoint2_t),this.spheres[1].y=n.conversion.toPixelsY(e.overlay_vertexJoint2_t_2),this.spheres[2].x=n.conversion.toPixelsX(e.overlay_vertexJoint3_t),this.spheres[2].y=n.conversion.toPixelsY(e.overlay_vertexJoint3_t_2),this.spheres[3].x=n.conversion.toPixelsX(e.overlay_vertexJoint4_t),this.spheres[3].y=n.conversion.toPixelsY(e.overlay_vertexJoint4_t_2),this.spheres[4].x=n.conversion.toPixelsX(e.overlay_vertexJoint5_t),this.spheres[4].y=n.conversion.toPixelsY(e.overlay_vertexJoint5_t_2),this.spheres[5].x=n.conversion.toPixelsX(e.overlay_vertexJoint6_t),this.spheres[5].y=n.conversion.toPixelsY(e.overlay_vertexJoint6_t_2),this.spheres[6].x=n.conversion.toPixelsX(e.overlay_vertexJoint7_t),this.spheres[6].y=n.conversion.toPixelsY(e.overlay_vertexJoint7_t_2),this.spheres[7].x=n.conversion.toPixelsX(e.overlay_vertexJoint8_t),this.spheres[7].y=n.conversion.toPixelsY(e.overlay_vertexJoint8_t_2),this.spheres[8].x=n.conversion.toPixelsX(e.overlay_vertexJoint9_t),this.spheres[8].y=n.conversion.toPixelsY(e.overlay_vertexJoint9_t_2),this.refresh()},t}(a.default);Object.defineProperty(o,"__esModule",{value:!0}),o.default=r},{"./vertex-controller-base":22,"jibo-keyframes":void 0}],25:[function(e,t,o){"use strict";var i=e("react"),n=e("path"),a=e("fs"),r=e("module"),s=e("deep-diff").diff,l=e("lodash"),d=e("jibo"),c=e("jibo"),u=c.FaceRenderer,h=c.timer,p=e("animation-utilities"),m=e("../face/mode-select"),f=e("./controllers/vertex-controller-eye"),v=e("./controllers/vertex-controller-overlay"),y=e("./controllers/scale-translate-controller-eye"),g=e("./controllers/scale-translate-controller-eye-overlay"),b=e("./controllers/rotation-controller"),k=e("jibo-keyframes"),S=1280,w=720,E=S/w,M=new p.JiboConfig,C={vertex:v.default,str:g.default,rotation:b.default},x={vertex:f.default,str:y.default,rotation:b.default};o.WIDTH=S,o.HEIGHT=w,Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({displayName:"layout-child",getInitialState:function(){return this.updateFace=this.updateFace.bind(this),this.face=null,this.currentScale=1,this.doUpdate=!0,this.onDataChanged=this.onDataChanged.bind(this),this.previousLayers=[],this.instances={},this.animations={},this.watchers={},{disabled:!0,mode:"str"}},render:function(){var e={width:this.props.width,height:this.props.height};return this.pixiRenderer&&this.setCanvasStyle(this.pixiRenderer.view),i.createElement("div",{ref:"container",className:"pixi-container",style:e,onWheel:this.onWheel},i.createElement(m.default,{disabled:this.state.disabled,onSelect:this.onSelectMode}))},onWheel:function(e){var t=e.nativeEvent.wheelDelta/2400;this.currentScale-=t,this.currentScale>1&&(this.currentScale=1),this.currentScale<.1&&(this.currentScale=.1),this.pixiRenderer.eye.zoom=this.currentScale,this.controller&&this.controller.refresh()},onSelectMode:function(e){this.controller&&(this.controller.dispose(),this.controller=null),this.state.mode=e,this.props.animationModel.isLayerOfTypeSelected("Eye")?this.controller=new x[e](this.pixiRenderer,this.robotInfo,this.props.animationModel,!1):this.controller=new C[e](this.pixiRenderer,this.robotInfo,this.props.animationModel,!0),this.lastLayerType=this.props.animationModel.keyframeSelection.getSelectionLayerType(),this.controller.display(this.getDOFs())},setCanvasStyle:function(e){e.style.position="relative";var t=this.props.height-40;if(E1&&(t/=100),e=i(e).toRgb(),e.a=t,i(e)}function s(e){return i(e).toHsv()}var l=e("tinycolor2");"undefined"!=typeof window&&(window.tinycolor=l),o.toColor=i,o.toPure=n,o.fromRatio=a,o.toAlpha=r,o.toHsv=s;var d={toColor:i,toPure:n,fromRatio:a,toAlpha:r,toHsv:s};"undefined"!=typeof window&&(window.color=d),Object.defineProperty(o,"__esModule",{value:!0}),o.default=d},{tinycolor2:void 0}],34:[function(e,t,o){"use strict";function i(){}var n=e("region"),a=e("drag-helper"),r=e("./color");Object.defineProperty(o,"__esModule",{value:!0}),o.default={toColorValue:function(e){return"string"==typeof e?r.toHsv(e):{h:e.h,s:e.s,v:e.v,a:e.a}},onMouseDown:function(e){e.preventDefault();var t=n.fromDOM(this.getDOMNode()),o=this.getEventInfo(e,t);a(e,{scope:this,constrainTo:t,onDragStart:function(e,i){i.initialPoint=o,i.minLeft=0,i.maxLeft=t.width,this.handleDragStart(e)},onDrag:function(e,o){var i=this.getEventInfo(e,t);this.updateColor(i),this.handleDrag(e,o)},onDrop:function(e,o){var i=this.getEventInfo(e,t);this.updateColor(i),this.handleDrop(e,o)}}),this.updateColor(o),this.handleMouseDown(e,{initialPoint:o})},handleMouseDown:function(e,t){(this.props.onMouseDown||i).apply(this,this.getColors()),this.handleDrag(e,t)},handleUpdate:function(e,t){var o=t.diff||{top:0,left:0},i=t.initialPoint;if(i){var n,a=void 0;a=i.x+o.left,n=i.y+o.top,a=Math.max(a,t.minLeft),a=Math.min(a,t.maxLeft),this.state.top=n,this.state.left=a,this.state.mouseDown={x:a,y:n,width:i.width,height:i.height}}this.props.inPicker||this.props.value||this.setState({value:this.hsv})},handleDragStart:function(){},handleDrag:function(e,t){this.handleUpdate(e,t),(this.props.onDrag||i).apply(this,this.getColors())},handleDrop:function(e,t){this.handleUpdate(e,t),this.state.mouseDown=!1,(this.props.onChange||i).apply(this,this.getColors())},getColors:function(){var e=this.props.inPicker?this.hsv:this.toStringValue(this.hsv),t=[e];return this.props.inPicker||t.push(Object.assign({},this.hsv)),t},getEventInfo:function(e,t){t=t||n.fromDOM(this.getDOMNode());var o=e.clientX-t.left,i=e.clientY-t.top;return{x:o,y:i,width:t.getWidth(),height:t.getHeight()}}}},{"./color":33,"drag-helper":void 0,region:void 0}],35:[function(e,t,o){"use strict";var i=e("tinycolor2");Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return e=i(Object.assign({},e)),1===e.toRgb().a?e.toHexString():e.toRgbString()}},{tinycolor2:void 0}],36:[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){var t=e.height,o=e.width;return e.x<0&&(e.x=0),e.x>=o&&(e.x=o),e.y<0&&(e.y=0),e.y>=t&&(e.y=t),e}},{}],37:[function(e,t,o){"use strict";var i=e("react"),n=e("atom"),a=e("../../../common/atom-editor"),r=i.createClass({getInitialState:function(){var e={name:this.props.content.name,payload:this.props.content.payload};return e},componentWillReceiveProps:function(e){e.content.name===this.state.name&&e.content.payload===this.state.payload||this.setState({payload:e.content.payload,name:e.content.name})},componentDidMount:function(){this.subs=new n.CompositeDisposable,this.subs.add(atom.tooltips.add(this.refs.nameEditor.getDOM(),{title:"Event Name"})),this.subs.add(atom.tooltips.add(this.refs.payloadEditor.getDOM(),{title:"Event Payload"}))},componentWillUnmount:function(){this.subs.dispose()},render:function(){var e=this,t="";if(this.state.payload.length>0)try{JSON.parse(this.state.payload)}catch(e){t="Not valid JSON:\n"+e}return i.createElement("div",{className:"event-editor",style:{width:"100%"}},i.createElement("div",{style:{display:"flex",clear:"both",marginTop:15,marginBottom:15}},i.createElement("div",{style:{fontSize:14,marginRight:15}},"Name"),i.createElement(a.default,{mini:!0,ref:"nameEditor",style:{width:"100%"},content:this.state.name,onDidChange:function(t){e.state.name=t,e.props.onChange({name:e.state.name,payload:e.state.payload})}})),i.createElement("div",{style:{fontSize:14,marginRight:15,marginBottom:5}},"Payload"),i.createElement(a.default,{ref:"payloadEditor",style:{height:250,width:"100%"},content:this.state.payload,grammar:"source.json",onDidChange:function(t){e.state.payload=t,e.props.onChange({name:e.state.name,payload:e.state.payload})}}),i.createElement("div",{className:"error-messages"},t))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){return i.createElement(r,{onChange:e,content:t})}},{"../../../common/atom-editor":96,atom:void 0,react:void 0}],38:[function(e,t,o){"use strict";var i=e("react"),n=e("fs"),a=e("path"),r=e("normalize-path"),s=e("../../../behavior-editor/modals/choose-animation-modal"),l=e("../../../atom-react/mixins/modal-mixin"),d=e("atom"),c=e("../../../common/atom-editor"),u=i.createClass({mixins:[l.default],getInitialState:function(){var e={file:this.props.content.file};return e},componentWillReceiveProps:function(e){e.content.file!==this.state.file&&this.setState({file:e.content.file})},getRoot:function(){return a.resolve(this.props.projectRoot,"animations")},getUri:function(){var e=this.state.file.split("://");if(1===e.length){var t=a.resolve(this.props.sourceFileDir,this.state.file);return t}if(2===e.length){var t=a.resolve(this.props.projectRoot,"node_modules",e[0],"animations",e[1]);return t}},render:function(){var e=this,t={};try{n.statSync(this.getUri())}catch(e){t={disabled:!0}}var o=t.disabled?i.createElement("div",{className:"error-messages"},"No keys file by that name"):null;return i.createElement("div",{style:{width:"100%"}},i.createElement("div",{className:"block"},i.createElement("div",{className:"fileBlock"},i.createElement("button",{ref:"chooseKeys",style:{float:"right"},className:"btn",onClick:this.onChoose},"..."),i.createElement(c.default,{ref:"keyrefsEditor",mini:!0,content:this.state.file,tooltip:{title:"Current Keys File"},onDidChange:function(t){e.state.file=t},onConfirm:function(){e.props.onChange({file:e.state.file})}})),o,i.createElement("br",null)))},onChoose:function(){var e=this;this.createModal(i.createElement(s.default,{root:this.getRoot(),uri:this.getUri(),onChoose:function(t){var o=a.resolve(e.props.projectRoot,"animations",r(t));t=r(a.relative(e.props.sourceFileDir,o)),e.setState({file:t}),e.props.onChange({file:t})},onClose:function(){e.destroyModal()}}))},componentDidMount:function(){this.subs=new d.CompositeDisposable,this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.chooseKeys),{title:"Choose Keys File"}))},componentWillUnmount:function(){this.subs.dispose()}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o,n){return i.createElement(u,{onChange:e,content:t,projectRoot:o,sourceFileDir:n})}},{"../../../atom-react/mixins/modal-mixin":57,"../../../behavior-editor/modals/choose-animation-modal":82,"../../../common/atom-editor":96,atom:void 0,fs:void 0,"normalize-path":void 0,path:void 0,react:void 0}],39:[function(e,t,o){"use strict";var i=e("react"),n=e("../../../common/atom-editor"),a=i.createClass({getInitialState:function(){return{offset:this.props.offset}},componentWillReceiveProps:function(e){e.offset!==this.state.offset&&this.setState({offset:e.offset})},render:function(){var e=this;return i.createElement("div",{className:"event-editor",style:{width:"100%"}},i.createElement(n.default,{mini:!0,ref:"offsetEditor",style:{width:"100%"},content:this.state.offset,tooltip:{title:"Frame Offset"},onDidChange:function(t){e.state.offset=t,e.props.onChange(e.state.text)}}))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){return i.createElement(a,{onChange:e,offset:t})}},{"../../../common/atom-editor":96,react:void 0}],40:[function(e,t,o){"use strict";var i=e("react"),n=e("fs"),a=e("path"),r=e("normalize-path"),s=e("../../../common/modals/choose-pixi-modal"),l=e("../../../atom-react/mixins/modal-mixin"),d=e("atom"),c=e("../../../common/atom-editor"),u=i.createClass({mixins:[l.default],getInitialState:function(){var e={file:this.props.content};return e},componentWillReceiveProps:function(e){e.content!==this.state.file&&this.setState({file:e.content})},getRoot:function(){return a.resolve(this.props.projectRoot,"timelines")},getUri:function(){var e=this.state.file.split("://");if(1===e.length){var t=a.resolve(this.props.projectRoot,"timelines",this.state.file);return t}if(2===e.length){var t=a.resolve(this.props.projectRoot,"node_modules",e[0],"timelines",e[1]);return t}},render:function(){var e=this,t={};try{n.statSync(this.getUri())}catch(e){t={disabled:!0}}var o=t.disabled?i.createElement("div",{className:"error-messages"},"No pixi file by that name"):null;return i.createElement("div",{style:{width:"100%"}},i.createElement("div",{className:"block"},i.createElement("div",{className:"fileBlock"},i.createElement("button",{ref:"chooseAudio",style:{float:"right"},className:"btn",onClick:this.onChoose},"..."),i.createElement(c.default,{ref:"pixiEditor",mini:!0,content:this.state.file,onDidChange:function(t){e.state.file=t},tooltip:{title:"Choose Pixi File"},onConfirm:function(){e.props.onChange({file:e.state.file})}})),o,i.createElement("br",null)))},onChoose:function(){var e=this;this.createModal(i.createElement(s.default,{root:this.getRoot(),uri:this.getUri(),onChoose:function(t){t=r(t),e.setState({file:t}),e.props.onChange(t)},onClose:function(){e.destroyModal()}}))},componentDidMount:function(){this.subs=new d.CompositeDisposable,this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.chooseAudio),{title:"Choose Pixi File"}))},componentWillUnmount:function(){this.subs.dispose()}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o){return i.createElement(u,{onChange:e,content:t,projectRoot:o})}},{"../../../atom-react/mixins/modal-mixin":57,"../../../common/atom-editor":96,"../../../common/modals/choose-pixi-modal":108,atom:void 0,fs:void 0,"normalize-path":void 0,path:void 0,react:void 0}],41:[function(e,t,o){"use strict";var i=e("react"),n=e("../../../atom-react/components/float-input-view"),a=e("./color-picker/index"),r=e("color-space/rgb"),s=e("color-space/hsv"),l=e("color-string"),d=e("atom"),c=e("../../../common/atom-editor"),u=i.createClass({getInitialState:function(){var e=[Math.floor(this.props.value.r),Math.floor(this.props.value.g),Math.floor(this.props.value.b)];return{color:l.hexString(e),value:this.props.value}},updateFromDrag:function(e,t){var o=s.rgb([Math.round(t.h),Math.round(100*t.s),Math.round(100*t.v)]),i={r:Math.round(o[0]),g:Math.round(o[1]),b:Math.round(o[2])},n={};n[this.props.propName]=i,this.props.animationModel.updateSelectedLayerProperties(n)},updateFromHexString:function(e){var t=l.getRgb(e);if(t){var o={};o[this.props.propName]={r:t[0],g:t[1],b:t[2]},this.props.animationModel.updateSelectedLayerProperties(o)}else this.refs.editor.setText(this.state.color)},updateFromHsv:function(e){var t=s.rgb(e),o={r:Math.round(t[0]),g:Math.round(t[1]),b:Math.round(t[2])},i={};i[this.props.propName]=o,this.props.animationModel.updateSelectedLayerProperties(i)},_hsvFromState:function(){var e=r.hsv([this.state.value.r,this.state.value.g,this.state.value.b]);return e},_clamp:function(e){return e},onRChange:function(e){var t={};t[this.props.propName]={r:this._clamp(e,0,255),g:this.state.g,b:this.state.b},this.props.animationModel.updateSelectedLayerProperties(t)},onGChange:function(e){var t={};t[this.props.propName]={r:this.state.r,g:this._clamp(e,0,255),b:this.state.b},this.props.animationModel.updateSelectedLayerProperties(t)},onBChange:function(e){var t={};t[this.props.propName]={r:this.state.r,g:this.state.g,b:this._clamp(e,0,255)},this.props.animationModel.updateSelectedLayerProperties(t)},onHChange:function(e){var t=this._hsvFromState();t[0]=this._clamp(Math.round(e),0,360),this.updateFromHsv(t)},onSChange:function(e){var t=this._hsvFromState();t[1]=this._clamp(Math.round(e),0,100),this.updateFromHsv(t)},onVChange:function(e){var t=this._hsvFromState();t[2]=this._clamp(Math.round(e),0,100),this.updateFromHsv(t)},componentWillReceiveProps:function(e){var t=[Math.round(e.value.r),Math.round(e.value.g),Math.round(e.value.b)],o=l.hexString(t);this.setState({color:o,value:{r:t[0],g:t[1],b:t[2]}})},componentWillUnmount:function(){this.subs.dispose()},componentDidMount:function(){this.subs=new d.CompositeDisposable,this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.reset),{title:"Reset Color"})),this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.rgb),{title:"RGB Color"})),this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.hsv),{title:"HSV Color"}))},onRgbConfirm:function(){var e=this.refs.editor.getText();this.updateFromHexString(e)},render:function(){var e=this,t=this.props.propName,o=this.props.tabIndex,r=this.props.defaultValue,s=this._hsvFromState();return i.createElement("div",{className:"hsv-input",style:{float:"right"}},i.createElement(a.default,{saturationWidth:150,saturationHeight:150,value:this.state.color,width:150,onDrag:this.updateFromDrag}),i.createElement("div",{style:{display:"flex",float:"right",clear:"both",marginTop:15}},i.createElement("div",{style:{fontSize:14,margin:2}},"rgb"),i.createElement(c.default,{mini:!0,ref:"editor",tooltip:{title:"RGB Color"},onBlur:this.onRgbConfirm,style:{width:150,float:"left"},content:this.state.color,onConfirm:function(){e.refs.editor.blur()}})),i.createElement("div",{style:{display:"flex",float:"right",clear:"both",marginTop:15}},i.createElement("div",{ref:"reset",className:"btn",style:{marginRight:5},onClick:function(){var o={};o[t]=r,e.props.animationModel.updateSelectedLayerProperties(o),e.props.animationModel.addRedoUndoEntry()}},i.createElement("i",{className:"fa fa-refresh"})),i.createElement("div",{style:{float:"left"}},[i.createElement("div",{ref:"rgb"},i.createElement("div",{style:{display:"flex"}},i.createElement("div",{style:{fontSize:14,margin:2,width:10}},"r"),i.createElement(n.default,{step:1,style:{clear:"both",maxWidth:150},onChange:this.onRChange,value:this.state.value.r,precision:0,tabIndex:o})),i.createElement("div",{style:{display:"flex"}},i.createElement("div",{style:{fontSize:14,margin:2,width:10}},"g"),i.createElement(n.default,{step:1,style:{clear:"both",maxWidth:150},onChange:this.onGChange,value:this.state.value.g,precision:0,tabIndex:o+1})),i.createElement("div",{style:{display:"flex"}},i.createElement("div",{style:{fontSize:14,margin:2,width:10}},"b"),i.createElement(n.default,{step:1,style:{clear:"both",maxWidth:150},onChange:this.onBChange,value:this.state.value.b,precision:0,tabIndex:o+2}))),i.createElement("div",{style:{height:10}}),i.createElement("div",{ref:"hsv"},i.createElement("div",{style:{display:"flex"}},i.createElement("div",{style:{fontSize:14,margin:2,width:10}},"h"),i.createElement(n.default,{step:1,style:{clear:"both",maxWidth:150},onChange:this.onHChange,value:s[0],precision:0,tabIndex:o+3})),i.createElement("div",{style:{display:"flex"}},i.createElement("div",{style:{fontSize:14,margin:2,width:10}},"s"),i.createElement(n.default,{step:1,style:{clear:"both",maxWidth:150},onChange:this.onSChange,value:s[1],precision:0,tabIndex:o+4})),i.createElement("div",{style:{display:"flex"}},i.createElement("div",{style:{fontSize:14,margin:2,width:10}},"v"),i.createElement(n.default,{step:1,style:{clear:"both",maxWidth:150},onChange:this.onVChange,value:s[2],precision:0,tabIndex:o+5})))])))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o,n,a){return i.createElement(u,{propName:e,value:t,tabIndex:o,defaultValue:n,animationModel:a})}},{"../../../atom-react/components/float-input-view":50,"../../../common/atom-editor":96,"./color-picker/index":32,atom:void 0,"color-space/hsv":void 0,"color-space/rgb":void 0,"color-string":void 0,react:void 0}],42:[function(e,t,o){"use strict";var i=e("react"),n=e("../../../atom-react/mixins/modal-mixin"),a=e("path"),r=e("fs"),s=e("../../../common/modals/choose-file-modal"),l=e("normalize-path"),d=e("atom"),c=e("../../../common/atom-editor"),u=i.createClass({mixins:[n.default],getInitialState:function(){var e=this.getDisplayValue(this.props.content);return{content:this.props.content,displayValue:e}},componentWillReceiveProps:function(e){var t=e.content,o=this.getDisplayValue(t);this.setState({content:t,displayValue:o})},render:function(){var e=this,t={};try{r.statSync(this.getUri())}catch(e){t={disabled:!0}}var o=t.disabled?i.createElement("div",{className:"error-messages"},"No texture file by that name"):null;return i.createElement("div",{style:{width:"100%"}},i.createElement("div",{className:"block"},i.createElement("div",{className:"fileBlock"},i.createElement("button",{ref:"chooseTexture",style:{float:"right"},className:"btn",onClick:this.onChoose},"..."),i.createElement(c.default,{onBlur:this.onBlur,ref:"editor",mini:!0,content:this.state.displayValue,onDidChange:function(t){e.state.content=e.getDataValue(t),e.state.displayValue=t},onConfirm:function(){e.props.onChange(e.state.content),document.querySelector("atom-pane.pane.active .animation-editor").childNodes[0].focus()}})),o,i.createElement("br",null)))},getUri:function(){return a.resolve(this.props.projectRoot,this.state.content)},getDisplayValue:function(e){var t=e.split("/");if("node_modules"===t[0]){var o=t[1],i=a.join("node_modules",o,"animations","textures");return i=l(a.relative(i,e)),o+"://"+i}if(""===e)return"";var i=a.join("animations","textures");return i=a.relative(i,e),l(i)},getDataValue:function(e){var t=e.split("://");if(1===t.length){var o=a.join("animations","textures",e);return l(o)}if(2===t.length){var o=a.join("node_modules",t[0],"animations","textures",t[1]);return l(o)}return""},onChoose:function(){var e=this;this.createModal(i.createElement(s.default,{root:this.props.projectRoot,uri:this.getUri(),settings:Object.assign({},s.TextureSettings,{restrictPath:"animations/textures"}),onChoose:function(t){var o=l(t),i=e.getDisplayValue(o);e.setState({content:o,displayValue:i}),e.props.onChange(o),document.querySelector("atom-pane.pane.active .animation-editor").childNodes[0].focus()},onClose:function(){e.destroyModal()}}))},onBlur:function(){this.props.onChange(this.state.content),document.querySelector("atom-pane.pane.active .animation-editor").childNodes[0].focus()},componentWillUnmount:function(){this.subs.dispose()},componentDidMount:function(){this.subs=new d.CompositeDisposable,this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.chooseTexture),{title:"Change Texture"})),this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.editor),{title:"Current Texture"}))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o,n){return i.createElement(u,{key:100,content:t,onChange:e,projectRoot:o,animationPath:n})}},{"../../../atom-react/mixins/modal-mixin":57,"../../../common/atom-editor":96,"../../../common/modals/choose-file-modal":107,atom:void 0,fs:void 0,"normalize-path":void 0,path:void 0,react:void 0}],43:[function(e,t,o){"use strict";var i=e("react"),n=e("atom"),a=i.createClass({displayName:"settings-item",onFocus:function(){this.refs.input.getDOMNode().select()},componentDidMount:function(){var e=this;this.disposables=new n.CompositeDisposable,this.disposables.add(atom.commands.add(this.refs.input.getDOMNode(),{"jibo-sdk:confirm":function(){e.props.onConfirm()},"jibo-sdk:escape":function(){e.props.onCancel()}}))},componentWillUnmount:function(){this.disposables.dispose()},render:function(){return i.createElement("div",null,i.createElement("label",null,this.props.label),i.createElement("br",null),i.createElement("input",{ref:"input",style:{width:122},onFocus:this.onFocus,className:"native-key-bindings",tabIndex:this.props.tabIndex,type:this.props.type,step:this.props.step,onMouseDown:this.props.onMouseDown,onChange:this.props.onChange,value:this.props.value,min:this.props.min}))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=a},{atom:void 0,react:void 0}],44:[function(e,t,o){"use strict";var i=e("react"),n=e("./settings-item"),a=i.createClass({displayName:"settings",getInitialState:function(){return{duration:this.props.animationModel.state.keyframes.duration,scale:this.props.animationModel.state.keyframes.scale,lastScale:this.props.animationModel.state.keyframes.scale}},componentDidMount:function(){this.getDOMNode().childNodes[1].childNodes[0].childNodes[2].focus()},onFinished:function(){if(this.state.duration!==this.props.animationModel.state.keyframes.duration)this.props.animationModel.setDuration(this.state.duration,!0,!0),this.props.animationModel.addRedoUndoEntry(),this.props.onFinished();else if(this.state.scale!==this.props.animationModel.state.keyframes.scale){if(0===this.state.scale)return this.setState({scale:this.state.lastScale}),void this.props.onFinished();this.setState({lastScale:this.state.scale}),this.props.animationModel.setScale(this.state.scale),this.props.animationModel.setDuration(this.state.duration,!1,!0),this.props.animationModel.setKeyframes(),this.props.animationModel.addRedoUndoEntry(),this.props.onFinished()}else this.props.onFinished()},onDurationChange:function(e){if(/^\d+$/.test(e.target.value)){var t=parseInt(e.target.value);this.setState({duration:t})}},onScaleChange:function(e){var t=e.target.value;this.setState({scale:t})},onMouseDown:function(){if(this.state.duration!==this.props.animationModel.state.keyframes.duration)this.props.animationModel.setDuration(this.state.duration,!0,!0),this.props.animationModel.addRedoUndoEntry();else if(this.state.scale!==this.props.animationModel.state.keyframes.scale){if(0===this.state.scale)return void this.setState({scale:this.state.lastScale});this.setState({lastScale:this.state.scale}),this.props.animationModel.setScale(this.state.scale);var e=this.props.animationModel.setDuration(this.state.duration,!1,!0);this.props.animationModel.setKeyframes(),this.props.animationModel.addRedoUndoEntry(),this.setState({duration:e})}},onConfirm:function(){this.onFinished()},onCancel:function(){this.props.onFinished()},render:function(){var e=i.createElement(n.default,{label:"Animation Duration",type:"number",step:"0.01",tabIndex:1,onCancel:this.onCancel,onConfirm:this.onConfirm,onMouseDown:this.onMouseDown,onChange:this.onDurationChange,value:this.state.duration,min:1}),t=i.createElement(n.default,{label:"Scale",type:"number",step:"0.01",tabIndex:2,onCancel:this.onCancel,onConfirm:this.onConfirm,onMouseDown:this.onMouseDown,onChange:this.onScaleChange,value:this.state.scale,min:0});return i.createElement("div",{className:"animation-settings native-key-bindings"},i.createElement("div",{onMouseDown:this.onFinished,className:"settings-mousetrap"}),i.createElement("div",{className:"settings-container",onKeyUp:this.onKeyPress,style:{height:"auto"}},e,t))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=a},{"./settings-item":43,react:void 0}],45:[function(e,t,o){"use strict";var i=e("animation-utilities"),n=function(){function e(e){this.scene=e,this.debugObjects={}}return e.prototype.removeIfExists=function(e){this.debugObjects[e]&&(this.scene.remove(this.debugObjects[e]),delete this.debugObjects[e])},e.prototype.addByName=function(e,t){this.removeIfExists(e),this.debugObjects[e]=t,this.scene.add(t)},e.prototype.coerceIfMatrix=function(e){return e instanceof i.THREE.Matrix4?(new i.THREE.Vector3).setFromMatrixPosition(e):e.clone()},e.prototype.info=function(e,t){t=t||"",console.log(t+" name: "+e.name+" ( "+e.position.x+", "+e.position.y+", "+e.position.z+" )");for(var o=0;othis.props.playbackTime?this.getDOMNode().scrollLeft+this.getDOMNode().offsetWidtht&&(this.getDOMNode().scrollLeft=t-this.getDOMNode().offsetWidth)}},onScroll:function(){this.setState({labelsOffset:this.getDOMNode().scrollLeft,headerOffset:{x:this.getDOMNode().scrollLeft,y:this.getDOMNode().scrollTop}})},onMouseMove:function(e){return 0===e.buttons?void this.onMouseUp():(this.setTimeFromMousePosition({nativeEvent:e}),void this.props.animationModel.emit("drag-keyframe"))},onMouseUp:function(){document.removeEventListener("mousemove",this.onMouseMoveBind),document.removeEventListener("mouseup",this.onMouseUpBind)},onMouseDown:function(e){1===e.nativeEvent.which&&(this.onMouseMoveBind=this.onMouseMove.bind(this),this.onMouseUpBind=this.onMouseUp.bind(this),document.addEventListener("mousemove",this.onMouseMoveBind),document.addEventListener("mouseup",this.onMouseUpBind),this.setTimeFromMousePosition(e))},setTimeFromMousePosition:function(e){var t=d(this.getDOMNode()).find(".animation-timeline-notch").offset(),o=Math.floor((e.nativeEvent.clientX-t.left)/18);o=Math.max(o,0),o=Math.min(o,this.props.animationModel.state.keyframes.duration-1),this.props.animationModel.setKeyframe(o)},onKeyframeUpsert:function(e){this.keyframesUpserted=e},evaluateFiltered:function(e,t){return u.runtime.evaluateAllLayersFiltered(e,h,t,function(e){return"Body"===e.type})},toRadians:function(e){return Math.PI*e/180},markReferences:function(){this.referenceMarks={};for(var e=0,t=this.props.animationModel.state.keyframes.layers;e0&&si[h].velocityLimit&&(a=!0,l=!0),i[h]&&Math.abs(m)>i[h].accelerationLimit&&(r=!0,l=!0)}this.keyframesExceeded.push(l),o+=t}this.props.animationModel.setLimit(a,r)},render:function(){var e=this,t=this.props.animationModel.state.keyframes.duration,o=18*(t+1),s=40*this.props.animationModel.state.keyframes.layers.length,l=Math.floor(t/5)+1,d=270,u={timeline:{width:this.props.width,height:this.props.height,background:"#404040"},container:{width:d+5*l*18+20,height:s+22},headerAnchor:{position:"relative",width:d+5*l*18+20,height:22},labelsAnchor:{position:"relative",width:d,height:s,float:"left",zIndex:2},labels:{position:"absolute",marginLeft:this.state.labelsOffset},channelsContainer:{width:o,height:s,float:"left",zIndex:1},channels:{width:o},indicator:{position:"absolute",marginLeft:18*this.props.animationModel.uiState.currentKeyframe+9-this.state.labelsOffset,height:this.props.height-22,zIndex:1,display:null===this.props.animationModel.getSelectedLayer()?"none":"inline-block"}},h=this.props.animationModel,m=this,f=[],v=[],y=0,g=this.props.animationModel.state.keyframes;return g.layers.forEach(function(r){var s;void 0!==m.keyframesUpserted&&c.indexOf(m.keyframesUpserted.layers,r)!==-1&&(s=m.keyframesUpserted.keyframeTime),f.push(i.createElement(n.default,{key:r.id,type:r.type,keyframesExceeded:e.keyframesExceeded,upserted:s,referenceMarks:e.referenceMarks,totalWidth:o,layerId:r.id,animationModel:h,totalFrames:t,keyframes:r.keyframes,latestHash:e.props.animationModel.undoRedo.latestHash})),v.push(i.createElement(a.default,{tabIndex:200+y,animationModel:h,odd:y++%2===0,key:r.id,layerId:r.id}))}),this.keyframesUpserted=void 0,i.createElement("div",{style:u.timeline,className:"animation-timeline"},i.createElement(p.default,{animationModel:this.props.animationModel,timelineWidth:this.props.width,timelineHeight:this.props.height}),i.createElement("div",{ref:"timeline",style:u.container,className:"animation-timeline-container"},i.createElement("div",{style:u.headerAnchor,onMouseDownCapture:this.onMouseDown},i.createElement(r.default,{offset:this.state.headerOffset,channelWidth:o,width:this.props.width,height:this.props.height+22,labelWidth:d,totalFrames:t,animationModel:this.props.animationModel})),i.createElement("div",{style:u.labelsAnchor},i.createElement("div",{ref:"layerContainer",style:u.labels,className:"animation-channel-labels-container"},v)),i.createElement("div",{style:u.channelsContainer},i.createElement("div",{style:u.channels,className:"animation-timeline-channels"},i.createElement("div",{style:u.indicator,className:"animation-timeline-indicator-line"}),f))))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=m},{"./layer":17,"./layer-label":16,"./playback-controls":26,"./time-notches":46,fs:void 0,"jibo-keyframes":void 0,jquery:void 0,lodash:void 0,path:void 0,react:void 0}],48:[function(e,t,o){"use strict";var i=e("react"),n=e("../controllers/animation-controller"),a=e("lodash"),r=e("path"),s=e("../../atom-react/components/jibo-combo-box"),l=e("atom"),d=e("../../atom-react/mixins/modal-mixin"),c=e("./face-on-body"),u=e("../../atom-react/components/float-input-view"),h=e("../../common/atom-editor"),p=i.createClass({getInitialState:function(){return this.props.model.state.keyframes.animdb||(this.props.model.state.keyframes.animdb={}),this.props.name=this.props.model.state.keyframes.animdb.name||"",this.props.scaleMin=this.props.model.state.keyframes.animdb.scaleMin||1,this.props.scaleMax=this.props.model.state.keyframes.animdb.scaleMax||1,this.props.speedMin=this.props.model.state.keyframes.animdb.speedMin||1,this.props.speedMax=this.props.model.state.keyframes.animdb.speedMax||1,this.props.categories=this.props.model.state.keyframes.animdb.categories||"",this.props.meta=this.props.model.state.keyframes.animdb.meta||"",{name:this.props.name,scaleMin:this.props.scaleMin,scaleMax:this.props.scaleMax,speedMin:this.props.speedMin,speedMax:this.props.speedMax,categories:this.props.categories,meta:this.props.meta}},onPropertyChange:function(e,t){this.props[e]=t,this.props.model.updateAnimationDBData(e,t)},render:function(){var e=this,t=i.createElement("div",{className:"block"},i.createElement("div",{className:"panel-heading"},i.createElement("h1",null,"Animation DB Settings")),i.createElement("div",{style:{align:"right"}},i.createElement("h2",null,"Name (default is key file name)"),i.createElement(h.default,{ref:"nameEditor",mini:!0,content:this.props.name,onDidChange:function(t){e.props.name=t,e.props.model.updateAnimationDBData("name",e.props.name)},onConfirm:function(){e.props.onChange(e.props.name),document.querySelector("atom-pane.pane.active .animation-editor").childNodes[0].focus()}}),i.createElement("h2",null,"Scale Bounds (max/min)"),i.createElement(u.default,{style:{clear:"both",maxWidth:150},onChange:function(t){e.onPropertyChange("scaleMax",t)},value:this.props.scaleMax,precision:4,tabIndex:1}),i.createElement(u.default,{style:{clear:"both",maxWidth:150},onChange:function(t){e.onPropertyChange("scaleMin",t)},value:this.props.scaleMin,precision:4,tabIndex:2}),i.createElement("h2",null,"Speed Bounds (max/min)"),i.createElement(u.default,{style:{clear:"both",maxWidth:150},onChange:function(t){e.onPropertyChange("speedMax",t)},value:this.props.speedMax,precision:4,tabIndex:1}),i.createElement(u.default,{style:{clear:"both",maxWidth:150},onChange:function(t){e.onPropertyChange("speedMin",t)},value:this.props.speedMin,precision:4,tabIndex:2}),i.createElement("h2",null,"Categories (comma separated list)"),i.createElement(h.default,{ref:"categoriesEditor",mini:!0,content:this.props.categories,onDidChange:function(t){e.props.categories=t,e.props.model.updateAnimationDBData("categories",e.props.categories)},onConfirm:function(){e.props.onChange(e.props.categories),document.querySelector("atom-pane.pane.active .animation-editor").childNodes[0].focus()}}),i.createElement("h2",null,"Meta tags (comma separated list)"),i.createElement(h.default,{ref:"metaEditor",mini:!0,content:this.props.meta,onDidChange:function(t){e.props.meta=t,e.props.model.updateAnimationDBData("meta",e.props.meta)}})),i.createElement("div",{style:{align:"center"}},i.createElement("button",{className:"btn",onClick:this.props.onClose},"Close")));return t}}),m=[{label:"Front",display:"front",value:"front"},{label:"Back",display:"back",value:"back"},{label:"Left",display:"left",value:"left"},{label:"Right",display:"right",value:"right"}],f=i.createClass({displayName:"layout-child",mixins:[d.default],componentWillMount:function(){var e=this;this.controller=new n.default(this.props.animationModel),this.lastWidth=this.props.width,this.lastHeight=this.props.height,this.requestAnimationID=window.requestAnimationFrame(function(){e.updateLoop()})},updateLoop:function(){var e=this;if(this.controller.renderer){var t=this.props.animationModel.evaluateAllDOFLayers();t=a.extend({},a.cloneDeep(this.controller.robotInfo.getDefaultDOFValues()),a.cloneDeep(t)),this.resolveTexture(t,"eyeTextureInfixBn_r"),this.resolveTexture(t,"overlayTextureInfixBn_r"),this.resolveTexture(t,"screenBGTextureInfixBn_r"),this.controller.updateDofValues(t),this.controller.update()}this.requestAnimationID=window.requestAnimationFrame(function(){e.updateLoop()})},resolveTexture:function(e,t){e[t]="file://"+r.resolve(this.props.animationModel.projectRoot,e[t])},componentDidMount:function(){var e=this,t=i.findDOMNode(this.refs.preview);this.controller.initialize(t,function(){e.faceOnBody=new c.default(e.refs.faceContainer.getDOMNode(),e.controller.renderer,e.face)}),t.addEventListener("contextmenu",function(e){return"CANVAS"!==e.target.tagName||(e.preventDefault(),e.stopPropagation(),!1)},!1),this.subs=new l.CompositeDisposable,this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.viewAngle),{title:"Body View Angle"})),this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.reset),{title:"Reset Body View"})),this.face=document.createElement("canvas"),this.face.width=1280,this.face.height=720,this.refs.faceContainer.getDOMNode().appendChild(this.face),this.props.onCreated(this.face)},componentWillUnmount:function(){this.requestAnimationID&&window.cancelAnimationFrame(this.requestAnimationID),this.controller.dispose(),this.subs.dispose()},onMouseDown:function(){return!1},onMouseDownCapture:function(){return!1},onChangeCamera:function(e){this.controller.setCamera(e.value)},onBackgroundColor:function(){},onReset:function(){this.controller.setCamera(m[0].value)},onAnimDBProperties:function(){var e=this,t=this.props.animationModel.editor.animationModel;this.createModal(i.createElement(p,{model:t,onClose:function(){e.destroyModal()}}))},render:function(){this.controller&&this.controller.renderer&&(this.lastWidth!==this.props.width||this.lastHeight!==this.props.height)&&(this.controller.renderer.scene.handleResize(),this.lastWidth=this.props.width,this.lastHeight=this.props.height);var e={preview:{width:this.props.width,height:this.props.height},reset:{position:"absolute",marginLeft:90,marginTop:10},comboBox:{position:"absolute",margin:10},animdb:{position:"absolute",marginLeft:170,marginTop:10},face:{width:this.props.width,height:this.props.height,overflow:"hidden",position:"absolute",pointerEvents:"none"}},t=null;return i.createElement("div",{style:e.preview,tabIndex:1,ref:"preview",className:"animation-preview"},i.createElement("div",{style:e.face,ref:"faceContainer"}),i.createElement("div",{className:"block",style:e.reset},i.createElement("button",{ref:"reset",className:"btn icon icon-sync inline-block-tight",onClick:this.onReset},"Reset")),i.createElement("div",{style:e.comboBox},i.createElement(s.default,{ref:"viewAngle",data:m,init:m[0],onSelected:this.onChangeCamera})),t)}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=f},{"../../atom-react/components/float-input-view":50,"../../atom-react/components/jibo-combo-box":53,"../../atom-react/mixins/modal-mixin":57,"../../common/atom-editor":96,"../controllers/animation-controller":7,"./face-on-body":13,atom:void 0,lodash:void 0,path:void 0,react:void 0}],49:[function(e,t,o){"use strict";var i=e("react/lib/ReactInjection"),n={isCustomAttribute:function(e){return-1!==["mini","gutter-hidden","placeholder-text"].indexOf(e)},Properties:{mini:null,"gutter-hidden":null,"placeholder-text":null},DOMAttributeNames:{},DOMPropertyNames:{}};i.DOMProperty.injectDOMPropertyConfig(n),Object.defineProperty(o,"__esModule",{value:!0}),o.default={activate:function(){},deactivate:function(){}}},{"react/lib/ReactInjection":void 0}],50:[function(e,t,o){"use strict";var i=e("react"),n=i.createClass({displayName:"float-input-view",getDefaultProps:function(){return{style:{width:"100%"},tabIndex:-1,min:-Number.MAX_VALUE,max:Number.MAX_VALUE,defaultValue:0,value:0,precision:20,onChange:function(){}}},getInitialState:function(){return{value:this.toPrecision(this.props.value)}},componentWillMount:function(){this.textValue=this.props.value},componentWillReceiveProps:function(e){var t=this.toPrecision(e.value),o=this.getDOMNode().childNodes[0];this.textValue!==t&&(this.textValue=t,o.value=t,this.setState({value:t}))},toPrecision:function(e){return"number"!=typeof e?0:parseFloat(e.toFixed(this.props.precision))},onFocus:function(){this.getDOMNode().childNodes[0].select(),this.becameSelected=!0},onMouseUp:function(e){this.becameSelected===!0&&(this.becameSelected=!1,e.preventDefault(),e.stopPropagation())},render:function(){var e={width:"100%"};return i.createElement("div",{className:"native-key-bindings",tabIndex:-1},i.createElement("input",{onFocus:this.onFocus,onKeyPress:this.onKeyPress,className:"native-key-bindings",style:Object.assign({},e,this.props.style),tabIndex:this.props.tabIndex,type:"number",onMouseUpCapture:this.onMouseUp,onChange:this.onChange,defaultValue:this.state.value,min:this.props.min,max:this.props.max,onKeyDown:this.onKeyDown,step:"any"}))},onKeyDown:function(){},onKeyPress:function(e){13===e.nativeEvent.keyCode&&(this.getDOMNode().childNodes[0].value=this.state.value)},onChange:function(e){var t=e.target.value;0!==t.length&&(t=parseFloat(t),t=Math.max(this.props.min,t),t=Math.min(this.props.max,t),t=this.toPrecision(t),t!==this.state.value&&(this.setState({value:t}),this.textValue=t,this.props.onChange(t)))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=n},{react:void 0}],51:[function(e,t,o){"use strict";var i=e("react"),n=i.createClass({getDefaultProps:function(){return{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,tabIndex:-1,defaultValue:0,value:0,precision:0,onChange:function(){}}},getInitialState:function(){return{value:this.toPrecision(this.props.value)}},componentWillMount:function(){this.textValue=this.props.value},componentWillReceiveProps:function(e){var t=this.toPrecision(e.value),o=this.getDOMNode().childNodes[0];this.textValue!==t&&(this.textValue=t,o.value=t,this.setState({value:t}))},toPrecision:function(e){return"number"!=typeof e?0:parseFloat(e.toFixed(this.props.precision))},render:function(){var e={width:"100%"};return i.createElement("div",{className:"native-key-bindings",tabIndex:-1},i.createElement("input",{onKeyPress:this.onKeyPress,className:"native-key-bindings",style:Object.assign({},e,this.props.style),tabIndex:this.props.tabIndex,type:"number",onChange:this.onChange,defaultValue:this.state.value,min:this.props.min,max:this.props.max,step:"any"}))},onKeyPress:function(e){13===e.nativeEvent.keyCode&&(this.getDOMNode().childNodes[0].value=this.state.value)},onChange:function(e){var t=e.target.value;0!==t.length&&(t=parseFloat(t),t=Math.max(this.props.min,t),t=Math.min(this.props.max,t),t=this.toPrecision(t),t!==this.state.value&&(this.setState({value:t}),this.textValue=t,this.props.onChange(t)))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=n},{react:void 0}],52:[function(e,t,o){"use strict";var i=e("react"),n=e("jquery"),a=i.createClass({getInitialState:function(){return{hoveredElement:void 0}},onMouseOver:function(e){this.state.hoveredElement=e,this.setState(this.state)},onMouseOut:function(){this.state.hoveredElement=void 0,this.setState(this.state)},onClick:function(e){this.props.onSelect(e)},render:function(){var e=this,t=[];return this.props.data.forEach(function(o,n){var a="list-item";o===e.state.hoveredElement&&(a+=" selected");var r={},s=null;"string"==typeof o.label?(r={marginLeft:0},s=o.label):s=o.label(),t.push(i.createElement("li",{key:n,className:a,onMouseOver:e.onMouseOver.bind(e,o),onMouseOut:e.onMouseOut.bind(e,o),onClick:e.onClick.bind(e,o)},i.createElement("span",{style:r},s)))}),i.createElement("ul",{className:"list-group"},t)}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({getInitialState:function(){return{clickHandler:this.clickHandler.bind(this)}},render:function(){var e=null;if(this.props.current.display)if("function"==typeof this.props.current.display)e=this.props.current.display();else{var t=null;t=this.props.titleDisplay?this.props.titleDisplay:this.props.current.display,e="  "+t,e=[i.createElement("i",{className:"fa fa-caret-down",style:{fontSize:20}}),e]}var o="combo-box btn";return this.props.hideButton&&(o="combo-box"),i.createElement("div",null,i.createElement("div",{ref:"button",className:o,onClick:this.onClick},e))},removeList:function(){n(document).off("click",this.state.clickHandler),this.node.remove(),this.node=null},onSelect:function(e){this.props.keepFocusAfterClick||this.removeList(),this.props.onSelected(e)},clickHandler:function(e){0===n(e.target).closest(this.node).length&&this.removeList()},onClick:function(e){if(e.preventDefault(),e.stopPropagation(),this.node)this.removeList();else{var t=i.findDOMNode(this.refs.button),o=t.getBoundingClientRect();this.node=n("
").addClass("combo-box-list").css({left:o.left+"px",top:o.bottom+"px"}).appendTo(document.body),n(document).on("click",this.state.clickHandler),i.render(i.createElement(a,{data:this.props.data,onSelect:this.onSelect}),this.node[0])}}})},{jquery:void 0,react:void 0}],53:[function(e,t,o){"use strict";var i=e("react"),n=e("jquery"),a=i.createClass({getInitialState:function(){return{hoveredElement:void 0}},onMouseOver:function(e){this.state.hoveredElement=e,this.setState(this.state)},onMouseOut:function(){this.state.hoveredElement=void 0,this.setState(this.state)},onClick:function(e){this.props.onSelect(e)},render:function(){var e=this,t=[];return this.props.data.forEach(function(o,n){var a="list-item";o===e.state.hoveredElement&&(a+=" selected");var r={},s=null;"string"==typeof o.label?(r={marginLeft:5},s=o.label):s=o.label(),t.push(i.createElement("li",{key:n,className:a,onMouseOver:e.onMouseOver.bind(e,o),onMouseOut:e.onMouseOut.bind(e,o),onClick:e.onClick.bind(e,o)},i.createElement("span",{style:r},s)))}),i.createElement("ul",{className:"list-group"},t)}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({getInitialState:function(){return{clickHandler:this.clickHandler.bind(this),current:this.props.init}},render:function(){var e=null;if(this.state.current.display)if("function"==typeof this.state.current.display)e=this.state.current.display();else{var t=null;t=this.props.titleDisplay?this.props.titleDisplay:this.state.current.display,e="  "+t,e=[i.createElement("i",{className:"fa fa-caret-down",style:{fontSize:20}}),e]}var o="combo-box btn";return this.props.hideButton&&(o="combo-box"),i.createElement("div",null,i.createElement("div",{ref:"button",className:o,onClick:this.onClick},e))},removeList:function(){n(document).off("click",this.state.clickHandler),this.node.remove(),this.node=null},onSelect:function(e){this.state.current=e,this.setState(this.state),this.props.keepFocusAfterClick||this.removeList(),this.props.onSelected(e)},clickHandler:function(e){0===n(e.target).closest(this.node).length&&this.removeList()},onClick:function(e){if(e.preventDefault(),e.stopPropagation(),this.node)this.removeList();else{var t=i.findDOMNode(this.refs.button),o=t.getBoundingClientRect();this.node=n("
").addClass("combo-box-list").css({left:o.left+"px",top:o.bottom+"px"}).appendTo(document.body),n(document).on("click",this.state.clickHandler),i.render(i.createElement(a,{data:this.props.data,onSelect:this.onSelect}),this.node[0])}}})},{jquery:void 0,react:void 0}],54:[function(e,t,o){"use strict";function i(e,t){var o={};if(o[t])return o[t];var i=function(o){function i(){return null!==o&&o.apply(this,arguments)||this}return n(i,o),i.content=function(){return this.div({class:t.match(/[A-Z][a-z]+/g).map(function(e){return e.toLowerCase()}).join("-")})},i.prototype.detached=function(){return s.unmountComponentAtNode(this[0]),this.editor.dispose(),this.disposables.dispose()},i.prototype.initialize=function(t){this.disposables=new r.CompositeDisposable,this.editor=t,t.shouldScroll&&(this[0].style.overflow="auto");var o=s.createElement(e,{parent:this[0],editor:t,paneWidth:this[0].offsetWidth,paneHeight:this[0].offsetHeight});if(this.editor.container=this[0],s.render(o,this[0]),this.disposables.add(atom.workspace.onDidChangeActivePaneItem(this.onActivePaneChange.bind(this))),atom.workspace.getActivePaneItem()===this.editor)return this.onActivePaneChange(null)},i.prototype.onActivePaneChange=function(e){var o=null;return e&&(o=e.__displayName||e.constructor.name),e&&o!==t?this.editor.active===!0?(this.editor.active=!1,this.editor.onPaneDeactivated()):void 0:(this.editor.active=!0,this.editor.onPaneActivated())},i}(a.View);return o[t]=i,i}var n=this&&this.__extends||function(e,t){function o(){this.constructor=e}for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)},a=e("atom-space-pen-views"),r=e("atom"),s=e("react");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i},{atom:void 0,"atom-space-pen-views":void 0,react:void 0}],55:[function(e,t,o){"use strict";var i=e("path"),n=e("fs"),a=e("./atom-view-react-bridge"),r=e("atom"),s=e("atom"),l=function(){function e(e,t,o){var n=this;this.__displayName=e,this.emitter=new s.Emitter,this.modifiedStatus=!1,this.shouldScroll=o,this.uri=i.normalize(t),this.tabTitle=i.parse(t).base,this.file=new r.File(this.uri),this.ignoreFirstReload=!0,this.onDidChangeDisposable=this.file.onDidChange(function(){return n.ignoreFirstReload?void(n.ignoreFirstReload=!1):n.shouldPromptToSave()?void(n.ignoreFirstReload=!0):(n.reload(),void(n.ignoreFirstReload=!0))}),this.onDidRenameDisposable=this.file.onDidRename(function(){n.uri=n.file.getPath(),n.tabTitle=i.parse(n.uri).base,n.emitter.emit("did-change-title",{})}),this.active=!1,this.container=null}return e.prototype.dispose=function(){this.onDidChangeDisposable.dispose(),this.onDidRenameDisposable.dispose()},e.prototype.isPaneActive=function(){return this.active},e.prototype.onPaneActivated=function(){},e.prototype.onPaneDeactivated=function(){},e.prototype.getTitle=function(){return this.tabTitle},e.prototype.isModified=function(){return this.modifiedStatus},e.prototype.shouldPromptToSave=function(){return this.modifiedStatus},e.prototype.onDidChangeModified=function(e){return this.emitter.on("did-change-modified",e)},e.prototype.getReactClass=function(){throw new Error("Override "+this.__displayName+".getReactClass()")},e.prototype.getViewClass=function(){return a.default(this.getReactClass(),this.__displayName)},e.prototype.getURI=function(){return this.uri},e.prototype.getPath=function(){return this.uri},e.getProjectRoot=function(e){e=i.normalize(e).toLowerCase();for(var t=atom.project.getPaths(),o=0;o"),t&&(this._modalContainer.width(t),this._modalContainer.addClass("modal-background")),n.render(e,this._modalContainer[0]),this.state=this.state?this.state:{},this.state.modalPanel=atom.workspace.addModalPanel({item:this._modalContainer}),a.push(this.state.modalPanel)},destroyModal:function(){if(n.unmountComponentAtNode(this._modalContainer[0]),this.state.modalPanel){for(var e=a.length-1;e>=0;--e)if(a[e]===this.state.modalPanel){a.splice(e,1);break}this.state.modalPanel.destroy(),this.state.modalPanel=void 0,a.length&&a[a.length-1].show()}}};Object.defineProperty(o,"__esModule",{value:!0}),o.default=r},{jquery:void 0,react:void 0}],58:[function(e,t,o){"use strict";function i(e){var t=a(e).parents(".pane");return 0===t.size()&&(t=a(".item-views")),{width:t.width(),height:t.height()}}function n(e){var t=i(e.getDOMNode());e.setProps({paneWidth:t.width,paneHeight:t.height})}var a=e("jquery"),r={setupPaneResizeEventMixin:function(){function e(t){try{var o=i(t.getDOMNode());o.width===t.props.paneWidth&&o.height===t.props.paneHeight||n(t),t.requestID=window.requestAnimationFrame(function(){e(t)})}catch(e){console.log(e)}}e(this)},cleanupPaneResizeEventMixin:function(){window.cancelAnimationFrame(this.requestID)}};Object.defineProperty(o,"__esModule",{value:!0}),o.default=r},{jquery:void 0}],59:[function(e,t,o){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,o=1,i=arguments.length;o1?{disabled:!0}:{});var a=t.disabled?n.createElement("div",{className:"error-messages"},"No animation by that name"):null;return n.createElement("div",{style:{width:"100%"}},n.createElement("div",{className:"block"},n.createElement("div",{className:"fileBlock"},n.createElement("button",{style:{float:"right"},className:"btn",onClick:this.onChoose},"..."),n.createElement(c.default,{ref:"editor",mini:!0,content:this.state.content,onDidChange:function(t){e.state.content=t,e.props.onChange(t),e.setState(e.state)}})),a,n.createElement("div",{className:"btn-group",style:{marginTop:5}},n.createElement("button",i({},o,{className:"btn",onClick:this.onEdit}),"Edit"),n.createElement("button",i({},t,{className:"btn",onClick:this.onPreview}),"Preview"))))},onEdit:function(){atom.workspace.open(this.getUri().replace(".anim",".keys"))},getUri:function(){var e=this.state.content.split("://");if(1===e.length){var t=r.resolve(this.props.projectRoot,"animations",this.state.content);return t}if(2===e.length){var t=r.resolve(this.props.projectRoot,"node_modules",e[0],"animations",e[1]);return t}},onPreview:function(){var e=this;this.createModal(n.createElement(u,{uri:this.getUri(),onClose:function(){e.destroyModal()}}))},onChoose:function(){var e=this;this.createModal(n.createElement(d.default,{root:this.props.projectRoot,uri:this.getUri(),settings:Object.assign({},d.AnimationSettings,{restrictPath:"animations"}),onChoose:function(t,o){e.props.onChange(o),e.setState({content:o})},onClose:function(){e.destroyModal()}}))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o,i){return n.createElement(h,{key:t,content:e,onChange:o,projectRoot:i})}},{"../../atom-react/mixins/modal-mixin":57,"../../common/animation/animation-visualizer":94,"../../common/atom-editor":96,"../../common/modals/choose-file-modal":107,fs:void 0,path:void 0,react:void 0}],61:[function(e,t,o){"use strict";var i=e("react"),n=e("../../atom-react/mixins/modal-mixin"),a=e("path"),r=e("fs"),s=e("../../common/modals/choose-file-modal"),l=e("../../common/atom-editor"),d=i.createClass({mixins:[n.default],getInitialState:function(){return{key:0,content:this.props.content}},render:function(){var e=this,t={};try{var o=r.statSync(this.getUri()).isFile();o||(t.disabled=!0)}catch(e){t={disabled:!0}}var n=t.disabled?i.createElement("div",{className:"error-messages"},"No audio file by that name"):null;return i.createElement("div",{style:{width:"100%"}},i.createElement("div",{className:"block"},i.createElement("div",{className:"fileBlock"},i.createElement("button",{style:{float:"right"},className:"btn",onClick:this.onChoose},"..."),i.createElement(l.default,{ref:"editor",mini:!0,content:this.state.content,onDidChange:function(t){e.state.content=t,e.props.onChange(t),e.setState(e.state)}})),n,i.createElement("audio",{key:this.state.key++,controls:!0,style:{width:"100%",marginTop:5,marginBottom:5}},i.createElement("source",{src:this.getUri(),type:"audio/mpeg"})),i.createElement("br",null)))},getRoot:function(){return a.resolve(this.props.projectRoot)},getUri:function(){var e=this.state.content.split("://");if(1===e.length){var t=a.resolve(this.props.projectRoot,"audio",this.state.content);return t}if(2===e.length){var t=a.resolve(this.props.projectRoot,"node_modules",e[0],"audio",e[1]);return t}},onChoose:function(){var e=this;this.createModal(i.createElement(s.default,{root:this.getRoot(),uri:this.getUri(),settings:Object.assign({},s.AudioSettings,{restrictPath:"audio"}),onChoose:function(t,o){e.props.onChange(o),e.state.content=o,e.setState(e.state)},onClose:function(){e.destroyModal()}}))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o,n){return i.createElement(d,{key:t,content:e,onChange:o,projectRoot:n})}},{"../../atom-react/mixins/modal-mixin":57,"../../common/atom-editor":96,"../../common/modals/choose-file-modal":107,fs:void 0,path:void 0,react:void 0}],62:[function(e,t,o){"use strict";var i=e("react"),n=i.createClass({displayName:"boolean-view",getInitialState:function(){return{content:this.props.content}},render:function(){var e="btn selected",t="btn";return i.createElement("div",{className:"block"},i.createElement("div",{className:"btn-group"},i.createElement("button",{className:this.state.content?e:t,onClick:this.toggle},"True"),i.createElement("button",{className:this.state.content?t:e,onClick:this.toggle},"False")))},toggle:function(){this.state.content=!this.state.content,this.setState(this.state),this.props.onChange(this.state.content)}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o){return i.createElement(n,{key:t,content:e,onChange:o})}},{react:void 0}],63:[function(e,t,o){"use strict";var i=e("react"),n=e("../../atom-react/components/jibo-combo-box");Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o){for(var a=[],r={label:"None",display:"None",value:""},s=0;s1?{disabled:!0}:{}),n.createElement("div",{style:{width:"100%"}},n.createElement("div",{className:"block"},n.createElement("div",{className:"fileBlock"},n.createElement("button",{style:{float:"right"},className:"btn",onClick:this.onChoose},"..."),n.createElement(u.default,{ref:"editor",mini:!0,content:this.state.content,onDidChange:function(t){e.state.content=t,e.props.onChange(t),e.setState(e.state)}})),o,n.createElement("div",{className:"btn-group",style:{marginTop:5}},n.createElement("button",i({},t,{className:"btn",onClick:this.onOpen}),"Edit"),n.createElement("button",{className:"btn",onClick:this.onNew},"New"))))},createNewTree:function(e,t){var o=this.props.model.createNewElement(this.props.model.schema[t]),i=r.resolve(this.props.projectRoot,"behaviors",e),n={};n[o.id]=o,l.sync(r.dirname(i)),s.writeFileSync(i,JSON.stringify(n,null," "),"utf8"),atom.workspace.open(i)},onNew:function(){var e=this;c.default.createNewFile(function(t){t=e.props.model.findRelativePathToUri(t,{dropExtension:!0}),e.refs.editor.setText(t)})},getUri:function(){var e,t=this.state.content.split("://");return 1===t.length?e=r.resolve(r.dirname(this.props.model.uri),this.state.content):2===t.length&&(e=r.resolve(this.props.projectRoot,"node_modules",t[0],"behaviors",t[1])),r.extname(e)||(e+=".bt"),s.existsSync(e)||(e=r.resolve(this.props.projectRoot,"src/behaviors",this.state.content),r.extname(e)||(e+=".bt")),e},onOpen:function(){atom.workspace.open(this.getUri())},onChoose:function(){var e=this;this.createModal(n.createElement(d.default,{root:this.props.root,uri:this.getUri(),settings:d.BTSettings,onChoose:function(t,o){var i=e.props.model.findRelativePathToUri(t,{dropExtension:!0});e.props.onChange(i),e.state.content=i,e.setState(e.state)},onCancel:function(){},onClose:function(){e.destroyModal()}}))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o,i,a){return n.createElement(h,{key:t,content:e,onChange:o,projectRoot:i,model:a})}},{"../../atom-react/mixins/modal-mixin":57,"../../common/atom-editor":96,"../../common/modals/choose-file-modal":107,"../behavior-editor":76,fs:void 0,mkdirp:void 0,path:void 0,react:void 0}],74:[function(e,t,o){"use strict";var i=e("react"),n=e("./arguments");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({propTypes:{behavior:i.PropTypes.object.isRequired,schema:i.PropTypes.object.isRequired},getDefaultProps:function(){return{}},getInitialState:function(){return{key:0}},onChange:function(e,t,o){e[t]=o},onChangeState:function(e,t,o){this.onChange(e,t,o),this.state.key++,this.setState(this.state)},render:function(){var e=[];if(this.props.behavior&&this.props.behavior.options){var t=this.props.model.getSchemaByElement(this.props.behavior);t&&this.render_options(e,t.options)}var o=this.props.isBehaviorArgs?"Behavior Arguments":"Decorator Arguments";return i.createElement("div",{className:"right-pane",ref:"rightPane"},i.createElement("div",{className:"panel-heading",style:{padding:"0px"}},i.createElement("h2",{style:{textAlign:"center",marginTop:"6px",marginBottom:"6px"}},o)),i.createElement("div",{className:"arguments-scroll-container"},e))},render_options:function(e,t){if(void 0!==t)for(var o=0,i=t;o0||p.length>0){var m=null;if(h.length){var f=[];h.forEach(function(e){f.push(i.createElement("li",{style:{paddingLeft:15},className:"list-item"},i.createElement("span",{className:"icon icon-file-submodule"},e)))}),m=[i.createElement("h1",null,"Missing Asset Packs"),i.createElement("h2",null,"Make sure these following asset packs are in the package.json and have been installed"),{assetPacksList:f}]}var v=null;if(p.length){var y=[];p.forEach(function(e){y.push(i.createElement("li",{style:{paddingLeft:15},className:"list-item"},i.createElement("span",{className:"icon icon-file-text"},e)))}),v=[i.createElement("h1",null,"Missing Behaviors"),i.createElement("h2",null,"Make sure the following behaviors are included in your schemas folder"),{behaviorList:y}]}return i.createElement("div",null,i.createElement("ul",{className:"list-group",style:{paddingLeft:20}},m,v))}return i.createElement("div",{tabIndex:-1},i.createElement(s.default,{ref:"topLevel",width:this.props.paneWidth,height:this.props.paneHeight-40,serialized:this.props.editor.layout},i.createElement(l.default,null,i.createElement(d.default,null,i.createElement(n.default,{showRoot:!0,model:this.state.model,onRowSelected:this.onBehaviorRowSelected,onRowDoubleClicked:this.onRowDoubleClicked,onRowHover:this.onBehaviorRowHover,onRowHoverLeave:this.onBehaviorRowHoverLeave,rowClassName:"behavior",isBehavior:!0}),i.createElement(n.default,{key:this.state.decoratorTreeKey,showRoot:!1,model:this.state.decoratorModel,onRowSelected:this.onDecoratorRowSelected,onRowDoubleClicked:this.onDecoratorRowDoubleClicked,onRowHover:this.onDecoratorRowHover,onRowHoverLeave:this.onDecoratorRowHoverLeave,rowClassName:"decorator",isBehavior:!1})),i.createElement(d.default,null,i.createElement(c.default,{schema:this.state.schema,model:this.state.model,behavior:this.state.model.getSelectedBehavior(),isBehaviorArgs:!0,projectRoot:this.props.editor.projectRoot}),i.createElement(c.default,{schema:this.state.schema,model:this.state.model,behavior:this.state.model.getSelectedDecorator(),isBehaviorArgs:!1,projectRoot:this.props.editor.projectRoot})))))},chooseBehavior:function(e){ var t=this;this.createModal(i.createElement(f.default,{schema:this.state.schema,types:["leaf","composite"],onChoose:function(t,o){e(t,o)},onClose:function(){t.destroyModal()}}))},chooseDecorator:function(e){var t=this;this.createModal(i.createElement(f.default,{schema:this.state.schema,types:["decorator"],onChoose:function(t,o){e(t,o)},onClose:function(){t.destroyModal()}}))},undo:function(){this.undoredo.undo()},redo:function(){this.undoredo.redo()},componentDidMount:function(){var e=this;this.setupPaneResizeEventMixin(),this.disposable=new p.CompositeDisposable,this.disposable.add(atom.commands.add(this.getDOMNode(),{"jibo-sdk:add-decorator":this.addDecorator,"jibo-sdk:add-sibling-above":this.addSiblingAbove,"jibo-sdk:add-sibling-below":this.addSiblingBelow,"jibo-sdk:add-child":this.addChild,"jibo-sdk:swap-behavior":this.swap,"jibo-sdk:move-up-behavior":this.moveUp,"jibo-sdk:move-down-behavior":this.moveDown,"jibo-sdk:edit-description":this.editDescription,"core:undo":this.undo,"core:redo":this.redo})),this.modifiedInterval=setInterval(function(){e.props.editor.checkModified()},100),this.state.model.setSelectedElement(this.state.model.getRoot())},componentWillUnmount:function(){clearInterval(this.modifiedInterval),this.disposable.dispose(),this.cleanupPaneResizeEventMixin()}})},{"../atom-react/mixins/modal-mixin":57,"../atom-react/mixins/pane-resize-event-mixin":58,"../common/layout/h-layout":103,"../common/layout/layout":104,"../common/layout/v-layout":105,"../common/undo-redo":110,"./behavior-arguments-view":74,"./decorator-model":78,"./modals/behavior-selector-modal":81,"./tree-view":91,atom:void 0,marked:void 0,react:void 0}],76:[function(e,t,o){"use strict";var i=this&&this.__extends||function(e,t){function o(){this.constructor=e}for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)},n=e("fs"),a=e("path"),r=e("../atom-react/core/react-editor"),s=e("./behavior-editor-view"),l=e("./tree-model"),d=e("../common/tree-view-helper"),c=e("lodash"),u=e("./schema-reader"),h=e("./behavior-reader"),p=e("../common/get-asset-packs"),m=e("jibo"),f=e("crypto"),v=e("jibo-analytics"),y="win32"===process.platform?process.env.HOMEPATH:process.env.HOME,g=a.resolve(y,".jibo");n.existsSync(g)||n.mkdirSync(g);var b=a.resolve(g,"temp");n.existsSync(b)||n.mkdirSync(b);var k=function(t){function o(e){var o=t.call(this,"BehaviorEditor",e,!1)||this;o.projectRoot=m.utils.PathUtils.findRoot(e),o.ignoreNextSave=!1,o.schema=(new u.default).getNewSchema(e),o.data=new h.default(o.schema).read(e);var i=o.getUiState();return o.layout=i?i:[],o.model=new l.default(o.data,o.schema,e),o.lastSaved=JSON.stringify(o.model.data),o.onReload=o.onReload.bind(o),o.loadAnimDB(o.projectRoot),o}return i(o,t),o.createNewFile=function(t){var i=d.default.getFolderPathWithDirectory(d.default.getFolderPathOfSelection(),"src/behaviors");if(!i)return void alert("You must have a valid project loaded in order to create a new behavior tree file.");var n=atom.getCurrentWindow(),a=e("remote"),r=a.dialog||a.require("dialog");r.showSaveDialog(n,{title:"New Behavior Tree",defaultPath:i,filters:o.getDialogFilter()},function(e){if(e){if(o.isValidDirectory(e)){var i=(new u.default).getNewSchema(e);l.default.createNewFile(e,i.core.schema.Sequence),atom.workspace.open(e),v.default.event("behavior-editor","new",{})}else alert('You must save behavior trees under the "src/behaviors" folder.');t&&t(e)}})},o.isValidDirectory=function(e){var t=a.normalize("/src/behaviors/");return!!e.includes(t)},o.getDialogFilter=function(){return[{name:"Behavior Tree",extensions:["bt"]}]},o.prototype.loadAnimDB=function(e){var t=p.getAssetPackDictionary(e)["jibo-anim-db-animations"];m.animDB._animDB||m.animDB.init(m,t&&t.root+"/animdb.json")},o.prototype.backup=function(e){var t=c.cloneDeep(this.model.data),o=f.createHash("md5");o.update(e);for(var i=o.digest("hex"),r=a.basename(i),s=b+"/"+r+".backup",l=Object.keys(t),d=0;d")>=0)&&(u.args[h]=u.args[h].split("\n"));n.writeFileSync(s,JSON.stringify(t,null," "),"utf8")},o.prototype.saveFile=function(e){if(!o.isValidDirectory(e))return alert('You must save behavior trees under the "src/behaviors" folder.'),!1;this.ignoreNextSave=!0,this.lastSaved=JSON.stringify(this.model.data);for(var t=c.cloneDeep(this.model.data),i=Object.keys(t),a=0;a")>=0)&&(r.options[d]=r.options[d].split("\n"))}return n.writeFileSync(e,JSON.stringify(t,null," "),"utf8"),v.default.event("behavior-editor","saved",{}),!0},o.prototype.checkModified=function(){var e=JSON.stringify(this.model.data);return e!==this.lastSaved?(this.setModifiedStatus(!0),!0):(this.setModifiedStatus(!1),!1)},o.prototype.serialize=function(){return this.saveUiState(this.layout),t.prototype.serialize.call(this)},o.prototype.dispose=function(){this.saveUiState(this.layout),t.prototype.dispose.call(this)},o.prototype.getReactClass=function(){return s.default},o.prototype.getNewSchema=function(e){return(new u.default).getNewSchema(e)},o.prototype.onReload=function(){this.reload()},o.prototype.reload=function(e){return void 0===e&&(e=this.uri),this.ignoreNextSave?void(this.ignoreNextSave=!1):(this.data=new h.default(this.schema).read(e),this.model.reload(this.data),void this.model.emit("ondatachanged"))},o.prototype.getSaveDialogOptions=function(){return{title:"Behavior Save As",filters:o.getDialogFilter()}},o}(r.default);Object.defineProperty(o,"__esModule",{value:!0}),o.default=k,atom.deserializers.add({deserialize:r.default.deserialize.bind(k),name:"BehaviorEditor"})},{"../atom-react/core/react-editor":55,"../common/get-asset-packs":100,"../common/tree-view-helper":109,"./behavior-editor-view":75,"./behavior-reader":77,"./schema-reader":84,"./tree-model":85,crypto:void 0,fs:void 0,jibo:void 0,"jibo-analytics":void 0,lodash:void 0,path:void 0,remote:void 0}],77:[function(e,t,o){"use strict";var i=e("fs"),n=function(){function t(e){this.schema=e}return t.prototype._getSchemaByElement=function(e){if(!e["asset-pack"]){var t=this.schema.core.schema[e.class];return t||(t=this.schema.project.schema[e.class]),t}var o=e["asset-pack"];return this.schema[o].schema[e.class]},t.prototype._update01=function(t){var o=this;if(!t.meta){var i=e("behaviorify/lib/core");t.meta={version:1},Object.keys(t).forEach(function(e){if("meta"!==e){var n=t[e],a=o._getSchemaByElement(n),r={};a.options.forEach(function(t,o){i[e]?r[i[e][o]]=n.args[o]:r[t.field]=n.args[o]}),delete n.args,n.options=r}})}},t.prototype._update=function(e){this._update01(e)},t.prototype.read=function(e){var t;try{t=JSON.parse(i.readFileSync(e,"utf8"))}catch(e){return void console.error(e)}return this._update(t),Object.keys(t).forEach(function(e){if("meta"!==e){var o=t[e];Object.keys(o.options).forEach(function(e){Array.isArray(o.options[e])&&(o.options[e]=o.options[e].join("\n"))})}}),t},t}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=n},{"behaviorify/lib/core":void 0,fs:void 0}],78:[function(e,t,o){"use strict";var i=this&&this.__extends||function(e,t){function o(){this.constructor=e}for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)},n=this&&this.__assign||Object.assign||function(e){for(var t,o=1,i=arguments.length;o-1&&(k="Decorator");var S="Choose a "+k;return i.createElement("div",{className:"behavior-selector-modal asset-selector-modal",ref:"modal"},i.createElement("div",{className:"panel-heading",style:{padding:"0px"}},i.createElement("h2",{style:{textAlign:"center",marginTop:"6px",marginBottom:"6px"}},S)),i.createElement("label",{style:{marginLeft:10}},"Search"),i.createElement(r.default,{ref:"editor",style:{marginLeft:10,marginRight:10,marginBottom:10},mini:!0,content:this.state.filter,onDidChange:function(t){e.setState({filter:t})}}),i.createElement("div",{className:"contents"},i.createElement("div",{className:"list-contents"},this.getPanelHeading("Asset Pack"),i.createElement("div",{className:"list-group asset-pack",ref:"assetPackList"},t)),i.createElement("div",{className:"list-contents"},this.getPanelHeading(k),i.createElement("ul",{className:"list-group schema-list",ref:"schemaList"},n)),i.createElement("div",{className:"description-contents"},this.getPanelHeading("Description"),i.createElement("div",{className:"behavior-description"},i.createElement("div",{dangerouslySetInnerHTML:{__html:b}})))),i.createElement("div",{className:"btn-group"},i.createElement("button",{className:"btn",onClick:this.onChoose},"Choose"),i.createElement("button",{className:"btn",onClick:this.onCancel},"Cancel")))},onLeft:function(){var e=i.findDOMNode(this.refs.assetPackList);e.focus()},onRight:function(){var e=i.findDOMNode(this.refs.schemaList);e.focus()},componentDidMount:function(){var e=this,t=this.refs.editor,o=i.findDOMNode(this.refs.schemaList),a=i.findDOMNode(this.refs.assetPackList);setTimeout(function(){t.focus(),o.setAttribute("tabIndex","0"),a.setAttribute("tabIndex","1"),e.disposable=new n.CompositeDisposable,e.disposable.add(atom.commands.add(o,{"jibo-sdk:up":e._moveUp,"jibo-sdk:down":e._moveDown,"jibo-sdk:confirm":e.onChoose,"jibo-sdk:left":e.onLeft})),e.disposable.add(atom.commands.add(a,{"jibo-sdk:right":e.onRight})),e.disposable.add(atom.commands.add(e.getDOMNode(),{"jibo-sdk:escape":e.onCancel})),e.disposable.add(atom.commands.add(t.getDOM(),"jibo-sdk:confirm",function(){e.onChoose()}))},100)},componentWillUnmount:function(){this.disposable.dispose()}})},{"../../common/atom-editor":96,atom:void 0,marked:void 0,react:void 0}],82:[function(e,t,o){"use strict";var i=e("react"),n=e("atom"),a=e("../../common/directory-tree-view"),r=e("path"),s=e("normalize-path"),l=e("../../common/get-asset-packs"),d=e("../../common/animation/animation-visualizer"),c=e("../../common/atom-editor");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({onChoose:function(){var e=this.state.currentAssetPack,t=r.join(e.root,"animations"),o=r.relative(t,this.state.currentAnimation);o=s(o),"project"!==this.state.currentAssetPack.id&&(o=e.id+"://"+o),this.props.onChoose(o),this.props.onClose()},onCancel:function(){this.props.onClose()},getLength:function(){return Object.keys(this.behaviorToIndexMap).length},getInitialState:function(){return{currentAssetPack:{id:"project"},currentAnimation:"",filter:""}},onAssetPackSelected:function(e){this.setState({currentAssetPack:e})},onSelected:function(e){this.setState({currentAnimation:e})},getPanelHeading:function(e){return i.createElement("div",{className:"panel-heading",style:{padding:"0px",width:"100%",height:30}},i.createElement("p",{style:{textAlign:"center",marginTop:"4px",marginBottom:"4px"}},e))},render:function(){for(var e,t=this,o=l.default(this.props.root),n=[],s=0;s=0)&&(this.state.currentName===n&&(a+=" selected"),e.push(i.createElement("li",{className:a,onDoubleClick:this.onChoose.bind(this),onClick:this.onNameSelected.bind(this,n)},i.createElement("span",null,n))))}return e},render:function(){var e=this,t=this.getAnimationList();return i.createElement("div",{className:"asset-selector-modal",ref:"modal"},i.createElement("div",{className:"panel-heading",style:{padding:"0px"}},i.createElement("h2",{style:{textAlign:"center",marginTop:"6px",marginBottom:"6px"}},"Choose an Animation")),i.createElement("label",{style:{marginLeft:10}},"Search"),i.createElement(l.default,{ref:"editor",style:{marginLeft:10,marginRight:10,marginBottom:10},mini:!0,content:this.state.filter,onDidChange:function(t){e.setState({filter:t})}}),i.createElement("div",{className:"contents"},i.createElement("div",{className:"name-list-contents"},this.getPanelHeading("Animation Name"),i.createElement("div",{className:"list-group asset-pack",ref:"assetPackList"},t)),i.createElement("div",{className:"preview-contents"},this.getPanelHeading("Preview"),i.createElement("div",{className:"asset-preview"},i.createElement(r.default,{uri:this.state.currentAnimation,style:{width:"100%",height:"100%"}})))),i.createElement("div",{className:"btn-group"},i.createElement("button",{className:"btn",onClick:this.onChoose},"Choose"),i.createElement("button",{className:"btn",onClick:this.onCancel},"Cancel")))},componentWillMount:function(){this.animationNames=s.animDB.getAnimationNames()},componentDidMount:function(){var e=this,t=this.refs.editor;setTimeout(function(){t.focus(),e.getDOMNode().setAttribute("tabIndex","0"),e.disposable=new n.CompositeDisposable,e.disposable.add(atom.commands.add(e.getDOMNode(),{"jibo-sdk:escape":e.onCancel,"jibo-sdk:confirm":e.onChoose}))},100)},componentWillUnmount:function(){this.disposable.dispose()}})},{"../../common/animation/animation-visualizer":94,"../../common/atom-editor":96,atom:void 0,jibo:void 0,path:void 0,react:void 0}],84:[function(e,t,o){"use strict";function i(t){if(!t.meta){var o=e("behaviorify/lib/core"),i=Object.keys(t);i.forEach(function(e){var i=t[e],n=i.meta&&i.meta.length>0?i.meta:[];n.forEach(function(e,t){e.type=i.args[t]}),i.options=n,delete i.meta,delete i.args,o[e]&&i.options.forEach(function(t,n){i.options[n].field=o[e][n]})})}}function n(e){i(e)}var a=e("../atom-react/core/react-editor"),r=e("fs"),s=e("path"),l=function(){function t(e){this.SchemaPaths=["node_modules/jibo/schema/schema.json","node_modules/jibo/schema/schema-base.json"],e&&(this.SchemaPaths=this.SchemaPaths.concat(e))}return t.prototype._requireWithDescriptions=function(e){var t;try{t=JSON.parse(r.readFileSync(e,"utf8")),n(t),delete t.meta,Object.keys(t).forEach(function(o){var i=t[o];if(i.description&&i.description.url){var n=s.resolve(s.dirname(e),i.description.url);try{i.description=r.readFileSync(n,"utf8")}catch(e){i.description=""}}})}catch(t){console.warn("Could not read "+e),console.warn(t)}return t},t.prototype._generateSchemaObject=function(e,t){var o={};return e.forEach(function(e){o=Object.assign(o,e)}),Object.keys(o).forEach(function(e){o[e].class=e,o[e].assetPack=t}),o},t.prototype._addProjectSchema=function(e,t,o){var i=s.resolve(o,"schemas"),n=[];try{r.lstatSync(i);for(var a=r.readdirSync(i),l=0;l {\n}",string:"null",boolean:!1,enum:"null"};return t?t:o[e]},t.createNewFile=function(e,o){var i={id:1,class:o.class,name:""};i.args=[],o.args&&o.args.forEach(function(e,n){var a=o.meta[n].defaultValue;if(Array.isArray(e)){var r=e;e=e[0],"enum"===e&&void 0===a&&(a=r[1].value)}i.args.push(t.getDefaultValueForType(e.toLowerCase(),a))});var n={};n[i.id]=i,l.writeFileSync(e,JSON.stringify(n,null," "),"utf8")},t.prototype.findRelativePathToUri=function(e,t){var o=c.relative(c.dirname(this.uri),e);if("."!==o[0]&&(o="./"+o),t&&t.dropExtension===!0){var i=c.extname(o);""!==i&&(o=o.replace(RegExp("\\"+i+"$"),""))}return h(o)},t.prototype.getSchemaByElement=function(e){if(!e["asset-pack"]){var t=this.schema.core.schema[e.class];return t||(t=this.schema.project.schema[e.class]),t}var o=e["asset-pack"];return this.schema[o].schema[e.class]},t.prototype.addRedoUndoEntry=function(){},t.prototype.getMutationFunctionNames=function(){return["moveUp","moveDown","addRedoUndoEntry"]},t.prototype.reload=function(e){var t=this;this.data=e,this.projectRoot=r.default.getProjectRoot(this.uri);var o=c.join(this.projectRoot,"node_modules","jibo");if(!l.existsSync(o))return void(this.installJibo=!0);this.installJibo=!1,this.nextId=0;var i=void 0===e?[]:Object.keys(e);i.forEach(function(o){if("meta"!==o){var i=e[o];t.nextId=Math.max(t.nextId,i.id)}});for(var n=0;n0){var o=this.data[e.id].decorators[0];t=this.data[o]}return t}},t.prototype._setSelectionState=function(e,t){return void 0!==e&&this.selectionState[e.id]!==t&&(this.selectionState[e.id]=t,!0)},t.prototype.setRenderDescription=function(e){this._setAndClearDescriptionElement(),this.description.element=e,this.description.newValue=void 0},t.prototype._setAndClearDescriptionElement=function(){this.description.element&&"string"==typeof this.description.newValue&&(this.description.element.name=this.description.newValue,this.addRedoUndoEntry()),this._clearDescription()},t.prototype._clearDescription=function(){this.description={element:void 0,newValue:void 0}},t.prototype.isSelected=function(e){return this.selectedElement&&e.id===this.selectedElement.id},t.prototype.createNewElement=function(e,o,i){var n={id:u.v4(),class:o.class,name:"",options:{}};return n["asset-pack"]=e,i&&(n.parent=i.id),o.options&&o.options.forEach(function(e){var o=e.defaultValue,i=e.field,a=e.type;if(Array.isArray(a)){var r=a; a=a[0],"enum"===a&&void 0===o&&(o=r[1].value)}n.options[i]=t.getDefaultValueForType(a.toLowerCase(),o)}),n},t.prototype.deleteRow=function(e,t){var o=this;if("undefined"==typeof e&&(e=this.selectedElement),"undefined"==typeof t){var i=this.data[e.parent];t=i.children.indexOf(e.id)}var n=e.parent,a=this.data[n],r=this.isSelected(e);this.selectionState[e.id]=void 0;for(var s=[a.children.splice(t,1)[0]];s.length>0;){var l=s.pop();r||(r=this.isSelected(this.data[l])),this.data[l].decorators&&this.data[l].decorators.forEach(function(e){delete o.data[e]}),this.data[l].children&&(s=s.concat(this.data[l].children)),delete this.data[l]}r&&this.setSelectedElement(a),this.addRedoUndoEntry(),this.emit("ondatachanged")},t.prototype.addDecoratorAbove=function(e,t,o,i){e.decorators=e.decorators?e.decorators:[];var n=this.createNewElement(o,i);e.decorators.splice(t,0,n.id),this.data[n.id]=n,this.selectedElement===e&&this.setSelectedDecorator(n),this.addRedoUndoEntry(),this.emit("ondatachanged")},t.prototype.addDecoratorBelow=function(e,t,o,i){this.addDecoratorAbove(e,t+1,o,i)},t.prototype.deleteDecorator=function(e,t){if("undefined"==typeof e&&(e=this.selectedElement),"undefined"==typeof t){var o=this.data[e.parent];t=o.children.indexOf(e.id)}var i=e.decorators.splice(t,1)[0];this.selectedDecorator&&i===this.selectedDecorator.id&&(this.selectedDecorator=void 0),delete this.data[i];var n=this._getFirstDecorator(e);this.setSelectedDecorator(n),this.addRedoUndoEntry(),this.emit("ondatachanged")},t.prototype.addSiblingAbove=function(e,t,o,i){var n=this.getParent(e),a=this.createNewElement(o,i,n);this.data[a.id]=a,n.children.splice(t,0,a.id),this.addRedoUndoEntry(),this.setSelectedElement(a)},t.prototype.addSiblingBelow=function(e,t,o,i){this.addSiblingAbove(e,t+1,o,i)},t.prototype.addChild=function(e,t,o){var i=this.createNewElement(t,o,e);e.children=e.children?e.children:[],e.children.unshift(i.id),this.data[i.id]=i,this.setSelectedElement(i),this.addRedoUndoEntry(),this.emit("ondatachanged")},t.prototype.skip=function(e){e.skipped=!e.skipped,this.addRedoUndoEntry(),this.getParent(e)?this.emit("ondatachanged"):e.skipped=!1,this.addRedoUndoEntry()},t.prototype.swap=function(e,t,o){var i=this.getParent(e),n=this.getRoot()===e,a=this.createNewElement(t,o,i);a.parent=void 0===i?void 0:i.id,a.id=e.id,a.children=e.children,a.decorators=e.decorators,this.data[a.id]=a,n&&(this.root=a),this.setSelectedElement(a),this.addRedoUndoEntry(),this.emit("ondatachanged")},t.prototype.moveUp=function(e,t){var o=t-1,i=this.data[e.parent];i.children.splice(t,1),i.children.splice(o,0,e.id),this.addRedoUndoEntry(),this.emit("ondatachanged")},t.prototype.canMoveUp=function(e,t){return 0!==t},t.prototype.isSkipped=function(e){return e.skipped},t.prototype.moveDown=function(e,t){if(this.canMoveDown(e,t)){var o=t+1,i=this.data[e.parent];i.children.splice(t,1),i.children.splice(o,0,e.id),this.emit("ondatachanged")}},t.prototype.canMoveDown=function(e,t){var o=this.data[e.parent];return t0;)i();d.default.behaviorData=JSON.stringify(t)}},t.prototype.copyDecorator=function(){if(void 0!==this.selectedDecorator){var e=this.selectedDecorator.id,t=this.data[e],o={};o[e]=t,d.default.behaviorData=JSON.stringify(o)}},t.prototype.cut=function(){if(void 0!==this.selectedElement){this.copy();var e=this.selectedElement,t=this.data[e.parent],o=t.children.indexOf(e.id),i=t;if(this.deleteRow(e,o),t.children.length>0){o=Math.max(0,o-1);var n=t.children[o];i=this.data[n]}this.addRedoUndoEntry(),this.setSelectedElement(i)}},t.prototype.cutDecorator=function(){if(void 0!==this.selectedDecorator&&void 0!==this.selectedElement){this.copyDecorator();var e=this.selectedDecorator,t=this.selectedElement.decorators.indexOf(e.id);this.addRedoUndoEntry(),this.deleteDecorator(this.selectedElement,t)}},t.prototype.skipDecorator=function(){if(void 0!==this.selectedDecorator&&void 0!==this.selectedElement){var e=this.selectedDecorator;e.skipped=!e.skipped,this.emit("ondatachanged"),this.addRedoUndoEntry()}},t.prototype.up=function(){if(void 0!==this.selectedElement){var e=this.selectedElement,t=this.data[e.parent];if(t){var o=t.children.indexOf(e.id);if(0===o)this.setSelectedElement(t);else{for(o--,e=this.data[t.children[o]];e.children&&0!==e.children.length;)e=this.data[e.children[e.children.length-1]];this.setSelectedElement(e)}this.emit("ondatachanged")}}},t.prototype.upDecorator=function(){if(this.selectedDecorator){var e=this.selectedElement.decorators.indexOf(this.selectedDecorator.id);e>0&&(e--,this.setSelectedDecorator(this.data[this.selectedElement.decorators[e]]),this.emit("ondatachanged"))}},t.prototype.down=function(){if(void 0!==this.selectedElement){var e,t=!1,o=this.selectedElement,i=this.data[o.parent];if(i&&(e=i.children.indexOf(o.id)),o.children&&o.children.length>0)this.setSelectedElement(this.data[o.children[0]]),t=!0;else if(i&&e0},t.prototype.getChildElement=function(e,t){return this.data[e.children[t]]},t.prototype.shouldNotIndent=function(e){return 0===e},t.prototype.getLabel=function(e,t,o,i){var a=this;switch(t){case 0:return String(i);case 1:return"";case 2:var r=[];r.push(e.class),e.decorators&&e.decorators.length>0&&(r.push(" *("),e.decorators.forEach(function(t,o){var i={};a.data[t].skipped&&(i={"font-style":"italic",color:"#555555"}),r.push(p.createElement("span",{style:i},a.data[t].class)),o!==e.decorators.length-1&&r.push(", ")}),r.push(")"));var l="";this.isSelected(e)&&(l="row-selected-text");var d={},c="";"leaf"===this.getSchemaByElement(e).type?(d.className="icon-stack-base fa fa-leaf",c="green"):"composite"===this.getSchemaByElement(e).type&&(d.className="fa fa-sitemap",c="lightblue"),this.shouldSkip(e)&&(d.className="fa fa-eye-slash",c="#555555"),d.style={color:c};var u=this.shouldSkip(e)?{"font-style":"italic",color:"#555555"}:{};return p.createElement("p",{className:l,style:u},p.createElement("i",n({},d))," ",r);case 3:return e===this.description.element?p.createElement(s.default,{content:e.name,onChange:function(e){a.description.newValue=e},width:o,onConfirm:function(){a._setAndClearDescriptionElement(),a.emit("ondatachanged")}}):e.name}},t.prototype.getRoot=function(){return this.root},t}(a.default);Object.defineProperty(o,"__esModule",{value:!0}),o.default=m},{"../atom-react/core/react-editor":55,"../common/clipboard":97,"./description-editor":79,"./event-emitter":80,fs:void 0,"node-uuid":void 0,path:void 0,react:void 0,slash:void 0}],86:[function(e,t,o){"use strict";var i=e("react");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({displayName:"TreeViewHeader",onMouseDown:function(e,t){t.preventDefault(),this.props.parentReact.onSeparatorDown(e,t)},render:function(){for(var e=[],t=0;t1?n=i.createElement("div",{onMouseDown:this.onMouseDown.bind(this,t),className:"separator"}):a.width=20):(a.width="100%",n=i.createElement("div",null)),e.push(i.createElement("div",{key:t,style:a,className:"cell"},i.createElement("h1",{style:{display:"inline-block"}},o),n))}return i.createElement("div",{className:"row-wrapper-header"},e)}})},{react:void 0}],87:[function(e,t,o){"use strict";var i=e("react"),n=e("./tree-view-row"),a=e("./tree-view-parent"),r=i.createClass({getInitialState:function(){return{isExpanded:!0}},onToggleExpanded:function(){this.state.isExpanded=!this.state.isExpanded,this.setState(this.state)},render:function(){var e=[];if(this.props.showRoot&&e.push(i.createElement(a.default,{row:this.props.row,isRoot:this.props.isRoot,key:0,columnWidths:this.props.columnWidths,element:this.props.element,model:this.props.model,depth:this.props.depth,treeView:this.props.treeView,onToggleExpanded:this.onToggleExpanded,isExpanded:this.state.isExpanded,rowClassName:this.props.rowClassName,isBehavior:this.props.isBehavior})),this.props.model.hasChildren(this.props.element))for(var t=0;t0)return this.props.model.data[t.children[o-1]]},getTotalChildren:function(e){var t=this;if(e.children!==[]&&e.children){var o=0;return e.children.forEach(function(e){e=t.props.model.data[e],o+=1+t.getTotalChildren(e)}),o}return 0},getDecoratorLine:function(e){for(var t=this.props.model.owner.decorators,o=0;o=0},createFile:function(e){var t=i.parse(e).base;if(this.props.filter&&!t.toLowerCase().includes(this.props.filter.toLowerCase()))return null;if(this.props.contentFilter&&!this.uriContains(e,this.props.contentFilter))return null;var o=this.state.selectedItem===e?"list-item selected-item":"list-item";return a.createElement("ul",{className:"list-tree"},a.createElement("li",{onClick:this.onSelected.bind(this,e),onDoubleClick:this.onChosen.bind(this,e),className:o},a.createElement("span",{className:"icon icon-file-text"},t)))},onSelected:function(e){this.props.onSelected(e),this.state.selectedItem=e,this.setState(this.state)},onChosen:function(e){this.state.selectedItem=e,this.setState(this.state),this.props.onChosen(e)},onCollapsed:function(e){this.state.collapsedDirectoried[e]?delete this.state.collapsedDirectoried[e]:this.state.collapsedDirectoried[e]=!0,this.setState(this.state)},createDirectory:function(e,t,o){var r=this;void 0===t&&(t=!1),void 0===o&&(o=!1);var s=i.parse(e).base;if(".git"===s||"node_modules"===s)return null;var l=n.readdirSync(e),d=[];if(l.forEach(function(t){var a=i.resolve(e,t),s=n.lstatSync(a);if(s.isDirectory())d.push(r.createDirectory(a,!1,o));else if(r.props.extension instanceof Array)for(var l=0;l0)for(var o=0;o0){var i=this.props.uri.split("://");e=i[0],t=s.resolve(this.props.root,"node_modules",i[0]),o=s.resolve(this.props.root,l.assetPackUriToRelativeUri(o,this.props.settings.restrictPath||""))}else{var i=s.relative(this.props.root,o).split(s.sep);"node_modules"===i[0]&&(e=i[1],t=s.resolve(this.props.root,i[0],i[1]),o=s.resolve(this.props.root,o))}return{currentAssetPack:{id:e,root:t},currentFile:o,filter:"",key:0}},onAssetPackSelected:function(e){this.setState({currentAssetPack:e})},onSelected:function(e){this.setState({currentFile:e})},getPanelHeading:function(e){return i.createElement("div",{className:"panel-heading",style:{padding:"0px",width:"100%",height:30}},i.createElement("p",{style:{textAlign:"center",marginTop:"4px",marginBottom:"4px"}},e))},getPreview:function(){var e=this,t=function(t){return i.createElement("div",{className:"preview-contents"},e.getPanelHeading("Preview"),i.createElement("div",{className:"asset-preview"},t))},o=null,n=this.props.settings.previewType;if(n){switch(n){case"text":var a="";if(this.state.currentFile)try{if(c.sync(this.state.currentFile))return t("No Preview Available");a=d.readFileSync(this.state.currentFile,"utf8")}catch(e){}o=i.createElement("pre",null,a);break;case"image":o=i.createElement("img",{key:this.state.key++,controls:!0,style:{width:"100%",padding:15},src:this.state.currentFile});break;case"audio":o=i.createElement("audio",{key:this.state.key++,controls:!0,style:{width:"100%",marginTop:"auto",marginBottom:"auto"}},i.createElement("source",{src:this.state.currentFile,type:"audio/mpeg"}));break;case"jiboAnim":o=i.createElement(r.default,{uri:this.state.currentFile,style:{width:"100%",height:"100%"}});break;default:o="No Preview Available"}o=t(o)}return o},render:function(){for(var e,t=this,o=l.default(this.props.root),n=[],r=0;r span");if(1!==e.length)return null;var t=e[0].getAttribute("data-path");return t?t:null},getFolderPathOfSelection:function(){var e=this.getFilePathOfSelection();if(e)return n.dirname(e);var t=i(".tree-view-scroller .directory.selected > .list-item > span.icon");if(1!==t.length)return null;var o=t[0].getAttribute("data-path");return o?o:null},getFolderPathWithDirectory:function(e,t){e&&(e=n.normalize(e));var o=n.normalize("/"+t+"/");if(e)e.includes(o)||(e=n.resolve(a.default.getProjectRoot(e),t));else{var i=a.default.getProjectRoot("");if(!i)return null;e=n.resolve(i,t)}return e}}},{"../atom-react/core/react-editor":55,jquery:void 0,path:void 0}],110:[function(e,t,o){"use strict";var i=e("crypto"),n=function(){function e(e,t){this.model=e,this.debugMode=t,this.debugMode=t,this.model=e;var o=[],i=[];this.undoStack=o,this.redoStack=i;var n=e.getMutationFunctionNames(),a=this.copy;this.latestHash="";var r=this;n.forEach(function(n){var s=e[n];e[n]=function(){s.apply(e,arguments);var n=a(e.getData());r.hashData(n),o[o.length-1]!==n&&(t&&(console.log("added entry"),console.log(JSON.stringify(e.getData(),null,"\t"))),o.push(n),this.emit("ondatachanged")),i.length=0}});var s=a(e.getData());o.push(s),this.hashData(s)}return e.prototype.restore=function(){this.undoStack.length>0&&this.model.reload(JSON.parse(this.undoStack[this.undoStack.length-1]))},e.prototype.undo=function(){if(this.undoStack.length>1){var e=this.undoStack.pop();this.redoStack.push(e);var t=JSON.parse(this.undoStack[this.undoStack.length-1]);this.hashData(this.undoStack[this.undoStack.length-1]),this.model.reload(t),this.debugMode&&(console.log("undone"),console.log(JSON.stringify(t,null,"\t"))),this.model.emit("ondatachanged")}},e.prototype.redo=function(){if(this.redoStack.length>0){var e=this.redoStack.pop();this.undoStack.push(e),this.hashData(e);var t=JSON.parse(e);this.model.reload(t),this.debugMode&&(console.log("redone"),console.log(JSON.stringify(t,null,"\t"))),this.model.emit("ondatachanged")}},e.prototype.hashData=function(e){if(void 0!==e){var t=i.createHash("sha1");t.update(e),this.latestHash=t.digest("hex")}},e.prototype.isSame=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},e.prototype.copy=function(e){return JSON.stringify(e)},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=n},{crypto:void 0}],111:[function(e,t,o){"use strict";var i=e("./subflow-view"),n=e("./picture-view");Object.defineProperty(o,"__esModule",{value:!0}),o.default={subflow:i.default,image:n.default}},{"./picture-view":112,"./subflow-view":113}],112:[function(e,t,o){"use strict";var i=this&&this.__assign||Object.assign||function(e){for(var t,o=1,i=arguments.length;o1?{disabled:!0}:{}),n.createElement("div",{style:{width:"100%"}},n.createElement("div",{className:"block"},n.createElement("div",{className:"fileBlock"},n.createElement("button",{style:{float:"right"},className:"btn",onClick:this.onChoose},"..."),n.createElement(u.default,{ref:"editor",mini:!0,content:this.state.content,onDidChange:function(t){e.state.content=t,e.props.onChange(t),e.setState(e.state)}})),o,n.createElement("div",{className:"btn-group",style:{marginTop:5}},n.createElement("button",i({},t,{className:"btn",onClick:this.onOpen}),"Edit"),n.createElement("button",{className:"btn",onClick:this.onNew},"New"))))},createNewTree:function(e,t){var o=this.props.model.createNewElement(this.props.model.schema[t]),i=r.resolve(this.props.projectRoot,"flows",e),n={};n[o.id]=o,l.sync(r.dirname(i)),s.writeFileSync(i,JSON.stringify(n,null," "),"utf8"),atom.workspace.open(i)},onNew:function(){var e=this;c.default.createNewFile(function(t){var o=n.findDOMNode(e.refs.editor);t=e.props.model.findRelativePathToUri(t,{dropExtension:!0}),o.getModel().setText(t)})},getRoot:function(){var e=r.resolve(this.props.projectRoot,"flows");return e},getUri:function(){var e,t=this.state.content.split("://");return 1===t.length?e=r.resolve(r.dirname(this.props.model.uri),this.state.content):2===t.length&&(e=r.resolve(this.props.projectRoot,"node_modules",t[0],"flows",t[1])),r.extname(e)||(e+=".flow"),s.existsSync(e)||(e=r.resolve(this.props.projectRoot,"src/flows",this.state.content),r.extname(e)||(e+=".flow")),e},onOpen:function(){atom.workspace.open(this.getUri())},onChoose:function(){var e=this;this.createModal(n.createElement(d.default,{root:this.getRoot(),uri:this.getUri(),onChoose:function(t,o){var i=e.props.model.findRelativePathToUri(o,{dropExtension:!0});e.props.onChange(i),e.state.content=i,e.setState(e.state)},onCancel:function(){},onClose:function(){e.destroyModal()}}))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o,i,a){return n.createElement(h,{key:t,content:e,onChange:o,projectRoot:i,model:a})}},{"../../atom-react/mixins/modal-mixin":57,"../../common/atom-editor":96,"../flow-editor":114,"../modals/choose-flow-modal":117,fs:void 0,mkdirp:void 0,path:void 0,react:void 0}],114:[function(e,t,o){"use strict";var i=this&&this.__extends||function(e,t){function o(){this.constructor=e}for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)},n=e("../atom-react/core/react-editor"),a=e("./views/flow-editor-view"),r=e("../common/tree-view-helper"),s=e("./flow-model"),l=e("jibo"),d={},c=function(t){function o(e){var o=t.call(this,"FlowEditor",e,!1)||this;o.uri=e,o.projectRoot=l.utils.PathUtils.findRoot(e);var i=o.getUiState();return o.layout=i?i:[],o.model=new s.default(e,o.projectRoot),o.lastSaved=JSON.stringify(o.model.data),d[e]=o,o}return i(o,t),o.getProcedureParameters=function(e){for(var t in d)if(t===e&&d[t].model.surface){for(var o in d[t].model.surface.model.nodeDataArray){var i=d[t].model.surface.model.nodeDataArray[o];if("Flow.Begin"===i.class)return i.options.inputParameters}return""}var n,a=l.flow.FlowRootFactory.create(e);try{n=a.getStartActivity()}catch(e){console.warn(e)}return n?n.options.inputParameters.join("\n"):""},o.createNewFile=function(t){var i=r.default.getFolderPathWithDirectory(r.default.getFolderPathOfSelection(),"src/flows"),n=atom.getCurrentWindow(),a=e("remote"),l=a.dialog||a.require("dialog");l.showSaveDialog(n,{title:"New Flow",defaultPath:i,filters:o.getDialogFilter()},function(e){e&&(o.isValidDirectory()?(s.default.createNewFile(e),atom.workspace.open(e)):alert('You must save flows under the "src/flows" folder.'),t&&t(e))})},o.isValidDirectory=function(){return!0},o.getDialogFilter=function(){return[{name:"Flows",extensions:["flow"]}]},o.prototype.showModified=function(e){this.setModifiedStatus(e)},o.prototype.serialize=function(){return this.saveUiState(this.layout),t.prototype.serialize.call(this)},o.prototype.dispose=function(){this.saveUiState(this.layout),t.prototype.dispose.call(this);for(var e in d)if(this===d[e]){delete d[e];break}},o.prototype.onPaneDeactivated=function(){this.model.onPaneDeactivated()},o.prototype.getReactClass=function(){return a.default},o.prototype.setSelectedShape=function(e){this.editor.setState({selectedShape:e})},o.prototype.saveFile=function(e){return o.isValidDirectory()?(this.model.saveToFile(e),!0):(alert('You must save flows under the "flows" folder.'),!1)},o.prototype.reload=function(){},o.prototype.getSaveDialogOptions=function(){return{title:"Save Flow As",filters:o.getDialogFilter()}},o.prototype.setSelectedBufferRange=function(e){var t=e[0][0];this.model.navigateToShapeOnLine(this.uri,t)},o}(n.default);atom.deserializers.add({deserialize:n.default.deserialize.bind(c),name:"FlowEditor"}),Object.defineProperty(o,"__esModule",{value:!0}),o.default=c},{"../atom-react/core/react-editor":55,"../common/tree-view-helper":109,"./flow-model":115,"./views/flow-editor-view":124,jibo:void 0,remote:void 0}],115:[function(e,t,o){"use strict";var i=e("fs"),n=e("path"),a=e("../behavior-editor/schema-reader"),r=e("slash"),s=e("glob"),l=e("find-root"),d=e("../common/get-asset-packs"),c=e("jibo"),u='\n{\n "class": "go.GraphLinksModel",\n "dataFormat": "flow-1",\n "nodeKeyProperty": "id",\n "nodeCategoryProperty": "class",\n "linkFromPortIdProperty": "fromPort",\n "linkToPortIdProperty": "toPort",\n "nodeDataArray": [],\n "linkDataArray": []}\n',h=function(){function e(e,t){this.uri=e,this.projectRoot=t,this.schema=this.loadSchemas(e),this.loadAnimDB(t)}return e.createNewFile=function(e){var t=JSON.parse(u),o=JSON.stringify(t,null," ");i.writeFileSync(e,o)},e.prototype.loadAnimDB=function(e){var t=d.getAssetPackDictionary(e)["jibo-anim-db-animations"];c.animDB._animDB||c.animDB.init(c,t&&t.root+"/animdb.json")},e.prototype.findRelativePathToUri=function(e,t){var o=n.relative(n.dirname(this.uri),e);if("."!==o[0]&&(o="./"+o),t&&t.dropExtension===!0){var i=n.extname(o);""!==i&&(o=o.replace(RegExp("\\"+i+"$"),""))}return r(o)},e.prototype.clearObsoleteOptions=function(e,t){for(var o=this.getSchemaByElement(e).options,i=0,n=o;i=0&&!(n[o].indexOf('"class": ')>=0);o--);if(o>=0)for(var a=o;a=0){var r=n[a],s=r.split(":"),l=s[1].replace(/[ ",]/g,""),d=this.surface.findNodeForKey(l);this.surface.select(d),this.surface.commandHandler.scrollToPart(d),this.surface.select(d);break}},e.prototype.onPaneDeactivated=function(){},e.prototype.listifyOptions=function(e){for(var t=e.nodeDataArray,o=0;o")>=0)&&(i.options[r]=i.options[r].split("\n"))}}return e},e.prototype.saveToFile=function(e){var t=this.surface.model.toJson(),o=JSON.parse(t);o=this.listifyOptions(o),i.writeFileSync(e,JSON.stringify(o,null," "),"utf8"),this.surface.isModified=!1},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=h},{"../behavior-editor/schema-reader":84,"../common/get-asset-packs":100,"find-root":void 0,fs:void 0,glob:void 0,jibo:void 0,path:void 0,slash:void 0}],116:[function(e,t,o){"use strict";var i=e("../atom-react/core/react-editor"),n=e("../common/tree-view-helper"),a=e("jibo-dev"),r=e("path"),s=function(){function e(){}return e.preflight=function(){var e=i.default.getProjectRoot(""),t=n.default.getFilePathOfSelection();if(!t||!t.endsWith(".flow"))return void alert("Cannot preflight "+t);var o=new a.FlowLint(e,t);o.run();var s=r.resolve(e,"preflight.log");o.writeReportToFile(s),atom.workspace.open(s)},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=s},{"../atom-react/core/react-editor":55,"../common/tree-view-helper":109,"jibo-dev":void 0,path:void 0}],117:[function(e,t,o){"use strict";var i=e("react"),n=e("atom"),a=e("../../common/directory-tree-view"),r=e("path"),s=e("normalize-path"),l=e("../../common/get-asset-packs"),d=e("../../common/atom-editor");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({onChoose:function(){var e=this.state.currentAssetPack,t=r.join(e.root,"src/flows"),o=r.relative(t,this.state.currentFlow);o=s(o),"project"!==this.state.currentAssetPack.id&&(o=e.id+"://"+o),this.props.onChoose(o,this.state.currentFlow),this.props.onClose()},onCancel:function(){this.props.onCancel(),this.props.onClose()},getLength:function(){return Object.keys(this.behaviorToIndexMap).length},getInitialState:function(){return{currentAssetPack:{id:"project"},currentFlow:"",filter:""}},onAssetPackSelected:function(e){this.setState({currentAssetPack:e})},onSelected:function(e){this.setState({currentFlow:e})},getPanelHeading:function(e){return i.createElement("div",{className:"panel-heading",style:{padding:"0px",width:"100%",height:30}},i.createElement("p",{style:{textAlign:"center",marginTop:"4px",marginBottom:"4px"}},e))},render:function(){for(var e,t=this,o=l.default(this.props.root),n=[],s=0;s=a){var r=t.midPoint,s=new i.default.Point(o.x-this._offset.x-r.x,o.y-this._offset.y-r.y);e.segmentOffset=s.rotate(-t.midAngle)}else{var l=e.segmentFraction,d=void 0,c=void 0;if(n>=0)d=t.getPoint(n),c=n0?t.getPoint(u-1):d}var h=d.x+(c.x-d.x)*l,p=d.y+(c.y-d.y)*l,s=new i.default.Point(o.x-this._offset.x-h,o.y-this._offset.y-p),m=n>=0?d.directionPoint(c):c.directionPoint(d);e.segmentOffset=s.rotate(-m)}}}}},{"./go":125}],121:[function(e,t,o){"use strict";var i=e("./go");o.LinkShiftingTool=function(){i.default.Tool.call(this),this.name="LinkShifting";var e=new i.default.Shape;e.geometryString="F1 M0 0 L8 0 M8 4 L0 4",e.fill=null,e.stroke="dodgerblue",e.background="lightblue",e.cursor="pointer",e.segmentIndex=0,e.segmentFraction=1,e.segmentOrientation=i.default.Link.OrientAlong,this._fromHandleArchetype=e,e=new i.default.Shape,e.geometryString="F1 M0 0 L8 0 M8 4 L0 4",e.fill=null,e.stroke="dodgerblue",e.background="lightblue",e.cursor="pointer",e.segmentIndex=-1,e.segmentFraction=1,e.segmentOrientation=i.default.Link.OrientAlong,this._toHandleArchetype=e,this._handle=null,this._originalPoints=null},i.default.Diagram.inherit(o.LinkShiftingTool,i.default.Tool),o.LinkShiftingTool.prototype.updateAdornments=function(e){if(null!==e&&e instanceof i.default.Link){var t=e,o="LinkShiftingFrom",n=null;if(t.isSelected&&this.diagram&&!this.diagram.isReadOnly){var a=t.selectionObject;if(null!==a&&t.actualBounds.isReal()&&t.isVisible()&&a.actualBounds.isReal()&&a.isVisibleObject()){var r=t.computeSpot(!0);(r.isSide()||r.isSpot())&&(n=t.findAdornment(o),null===n&&(n=this.makeAdornment(a,!1),n.category=o,t.addAdornment(o,n)))}}if(null===n&&t.removeAdornment(o),o="LinkShiftingTo",n=null,t.isSelected&&this.diagram&&!this.diagram.isReadOnly){var a=t.selectionObject;if(null!==a&&t.actualBounds.isReal()&&t.isVisible()&&a.actualBounds.isReal()&&a.isVisibleObject()){var r=t.computeSpot(!1);(r.isSide()||r.isSpot())&&(n=t.findAdornment(o),null===n&&(n=this.makeAdornment(a,!0),n.category=o,t.addAdornment(o,n)))}}null===n&&t.removeAdornment(o)}},o.LinkShiftingTool.prototype.makeAdornment=function(e,t){var o=new i.default.Adornment;o.type=i.default.Panel.Link;var n=t?this._toHandleArchetype:this._fromHandleArchetype;return null!==n&&o.add(n.copy()),o.adornedObject=e,o},o.LinkShiftingTool.prototype.canStart=function(){if(!this.isEnabled)return!1;var e=this.diagram;if(null===e||e.isReadOnly||e.isModelReadOnly)return!1;if(!e.lastInput.left)return!1;var t=this.findToolHandleAt(e.firstInput.documentPoint,"LinkShiftingFrom");return null===t&&(t=this.findToolHandleAt(e.firstInput.documentPoint,"LinkShiftingTo")),null!==t},o.LinkShiftingTool.prototype.doActivate=function(){var e=this.diagram;if(null!==e){var t=this.findToolHandleAt(e.firstInput.documentPoint,"LinkShiftingFrom");if(null===t&&(t=this.findToolHandleAt(e.firstInput.documentPoint,"LinkShiftingTo")),null!==t){var o=t.part,n=o.adornedObject.part;n instanceof i.default.Link&&(this._handle=t,this._originalPoints=n.points.copy(),this.startTransaction(this.name),e.isMouseCaptured=!0,e.currentCursor="pointer",this.isActive=!0)}}},o.LinkShiftingTool.prototype.doDeactivate=function(){this.isActive=!1;var e=this.diagram;null!==e&&(e.isMouseCaptured=!1,e.currentCursor="",this.stopTransaction())},o.LinkShiftingTool.prototype.doStop=function(){this._handle=null,this._originalPoints=null},o.LinkShiftingTool.prototype.doCancel=function(){var e=this._handle.part,t=e.adornedObject.part;t.points=this._originalPoints,this.stopTool()},o.LinkShiftingTool.prototype.doMouseMove=function(){this.isActive&&this.doReshape(this.diagram.lastInput.documentPoint)},o.LinkShiftingTool.prototype.doMouseUp=function(){this.isActive&&(this.doReshape(this.diagram.lastInput.documentPoint),this.transactionResult=this.name),this.stopTool()},o.LinkShiftingTool.prototype.doReshape=function(e){var t=this._handle.part,o=t.adornedObject.part,n="LinkShiftingFrom"===t.category,a=null;a=n?o.fromPort:o.toPort;var r=new i.default.Rect(a.getDocumentPoint(i.default.Spot.TopLeft),a.getDocumentPoint(i.default.Spot.BottomRight)),s=r.width>0?(e.x-r.x)/r.width:0,l=r.height>0?(e.y-r.y)/r.height:0,d=void 0,c=void 0;s<=0?(d=0,c=l<=0?0:l>=1?1:l):s>=1?(d=1,c=l<=0?0:l>=1?1:l):l<=0?(d=s,c=0):l>=1?(d=s,c=1):s>l?s>1-l?(d=1,c=l):(d=s,c=0):s>1-l?(d=s,c=1):(d=0,c=l),void 0!==d&&void 0!==c&&(n?o.fromSpot=new i.default.Spot(d,c):o.toSpot=new i.default.Spot(d,c))}},{"./go":125}],122:[function(e,t,o){"use strict";var i=e("./go");o.ResizeMultipleTool=function(){i.default.ResizingTool.call(this),this.name="ResizeMultiple"},i.default.Diagram.inherit(o.ResizeMultipleTool,i.default.ResizingTool),o.ResizeMultipleTool.prototype.resize=function(e){var t=this.diagram;null!==t&&t.selection.each(function(t){if(!(t instanceof i.default.Link||t instanceof i.default.Group||t.data&&t.data.clazz.startsWith("Flow.Begin"))){var o=t.resizeObject,n=t.position.copy(),a=o.getDocumentAngle(),r=o.getDocumentScale(),s=Math.PI*a/180,l=Math.cos(s),d=Math.sin(s),c=e.width-o.naturalBounds.width,u=e.height-o.naturalBounds.height,h=a>0&&a<180?1:0,p=a>90&&a<270?1:0,m=a>180&&a<360?1:0;n.x+=r*((e.x+c*p)*l-(e.y+u*h)*d),n.y+=r*((e.x+c*m)*d+(e.y+u*p)*l),o.desiredSize=e.size,t.position=n}})}},{"./go":125}],123:[function(e,t,o){"use strict";var i=e("react"),n=e("../../behavior-editor/arguments"),a=e("../arguments"),r=e("./JiboColors"),s=e("./go");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({displayName:"layout-child",propTypes:{shape:i.PropTypes.object.isRequired,schema:i.PropTypes.object.isRequired},getDefaultProps:function(){return{}},getInitialState:function(){return{key:0}},onChange:function(e,t,o){var i=this.props.model.surface.model;i.startTransaction("field value change"),i.setDataProperty(e,t,o),i.commitTransaction("field value change")},onChangeState:function(e,t,o){this.onChange(e,t,o),this.state.key++,this.setState(this.state)},getObject:function(e){var t=this.props.shape.data;if(t._isPaletteNode)return{};void 0===e&&(e="options");for(var o=0,i=e.split(".");o=0&&(t+="// "+a+"\n")}return t}function v(e,t,o,i,n){n.data.options.inputParameters=H.default.getProcedureParameters(t),n.data.options.subflowId=e.model.findRelativePathToUri(t,{dropExtension:!0}),o.startTransaction("set-name"),o.setDataProperty(n.data,"name",j.basename(i,".flow")),o.commitTransaction("set-name")}function y(e,t,o,i,n){n.data.options.behaviorPath=e.model.findRelativePathToUri(i,{dropExtension:!0}),o.startTransaction("set-name"),o.setDataProperty(n.data,"name",j.basename(i,".bt")),o.commitTransaction("set-name")}function g(e,t,o,i,n){o.startTransaction("set-name"),o.setDataProperty(n.data,"url",i),o.commitTransaction("set-name")}function b(e,t,o,i,n){var a=j.resolve(t,i);e.getSchemaByElementField(n.data,"getMimPath")?n.data.options.getMimPath=k(e,j.relative(t,a),n):(n.data.options.mimPath=R(j.relative(t,a)),L.existsSync(a)&&L.statSync(a).isFile()&&(n.data.options.getPromptData=S(e,a,n),"Mim.Announcement"!==n.data.class&&(n.data.options.onSuccess=w(e,a,n)),o.startTransaction("set-name"),o.setDataProperty(n.data,"name",E(i)),o.commitTransaction("set-name")))}function k(e,t,o){var i=e.getSchemaByElementField(o.data,"getMimPath").defaultValue;return i.replace(/return ['"][^'"]+['"];?/,"return '"+R(t)+"';")}function S(e,t,o){var i=e.getSchemaByElementField(o.data,"getPromptData").defaultValue,n=f(t);return i+"\n"+n+"\n"}function w(e,t,o){var i=e.getSchemaByElementField(o.data,"onSuccess").defaultValue,n=M(t,"rule_slots");return i+"\n//Transitions: "+n+"\n"}function E(e){var t=j.basename(e,".mim");return m(t)}function M(e,t){var o=L.readFileSync(e,"utf8");return C(o,t)}function C(e,t){for(var o,i=e.split("\n"),n=0;n",e.style.display="none",document.body.appendChild(e)}var O=e("react"),T=e("../../atom-react/mixins/pane-resize-event-mixin"),L=e("fs"),j=e("path"),R=e("normalize-path"),I=e("node-uuid"),B=e("../../common/modals/choose-file-modal"),A=e("../modals/choose-flow-modal"),F=e("jquery"),H=e("../flow-editor"),U=e("./JiboColors"),z=e("./go");_();var W=z.default.GraphObject.make,V=e("./LinkLabelDraggingTool"),K=e("./LinkShiftingTool"),G=e("./GuidedDraggingTool"),J=e("./ResizeMultipleTool"),q=e("../../common/layout/layout"),X=e("../../common/layout/h-layout"),Y=e("./flow-arguments-view"),Q=e("./procedure-view"),$=e("atom"),Z=O.createClass({displayName:"FlowEditorView",mixins:[T.default],versionUpModified:!1,shapeProperties:{},paletteIconWidth:140,getInitialState:function(){return{selectedShape:null,tempSelectedShape:null,diagram:null,key:0}},componentDidMount:function(){this.setupPaneResizeEventMixin(),this.disposables=new $.CompositeDisposable,this.disposables.add(atom.commands.add(this.getDOMNode(),{"jibo-sdk:align-shape-tops":this.alignShapeTops,"jibo-sdk:align-shape-middles":this.alignShapeMiddles,"jibo-sdk:align-shape-bottoms":this.alignShapeBottoms, "jibo-sdk:align-shape-lefts":this.alignShapeLefts,"jibo-sdk:align-shape-centers":this.alignShapeCenters,"jibo-sdk:align-shape-rights":this.alignShapeRights,"jibo-sdk:align-shape-widths":this.alignShapeWidths,"jibo-sdk:align-shape-heights":this.alignShapeHeights,"jibo-sdk:distribute-shapes-vertically":this.distributeShapesVertically,"jibo-sdk:distribute-shapes-horizontally":this.distributeShapesHorizontally,"jibo-sdk:distribute-shapes-tops":this.distributeShapesTops,"jibo-sdk:distribute-shapes-middles":this.distributeShapesMiddles,"jibo-sdk:distribute-shapes-bottoms":this.distributeShapesBottoms,"jibo-sdk:distribute-shapes-lefts":this.distributeShapesLefts,"jibo-sdk:distribute-shapes-centers":this.distributeShapesCenters,"jibo-sdk:distribute-shapes-rights":this.distributeShapesRights,"jibo-sdk:toggle-grid":this.toggleGrid,"jibo-sdk:toggle-alignment-guide":this.toggleAlignmentGuide,"jibo-sdk:toggle-snap-into-position":this.toggleSnapIntoPosition,"core:undo":this.undo,"core:redo":this.redo,"core:cut":this.cut,"core:copy":this.copy,"core:paste":this.paste}));var e=O.findDOMNode(this.refs.palette),t=O.findDOMNode(this.refs.diagram);this.initializeSurface(e,t)},componentWillUnmount:function(){this.cleanupPaneResizeEventMixin(),this.disposables.dispose()},componentWillReceiveProps:function(){this.requestDiagramUpdate()},dispose:function(){this.saveUiState(this.layout)},serialize:function(){this.saveUiState(this.layout)},onInnerHLayoutResize:function(){},onHLayoutResize:function(){},onVLayoutResize:function(){},undo:function(){},redo:function(){},cut:function(){},copy:function(){},paste:function(){},render:function(){var e=this,t={border:"solid 1px gray",height:"100%"},o=this.state.diagram,i=[],n=this.state.selectedShape||this.state.tempSelectedShape,a=this.state.selectedShape instanceof z.default.Node||this.state.selectedShape instanceof z.default.Link,r=this.state.tempSelectedShape instanceof z.default.Node;return!o||a&&!r||i.push(O.createElement(Q.default,{model:this.props.editor.model,setParentsSelectedShape:function(t){e.setState({tempSelectedShape:t,selectedShape:null})},diagram:o,projectRoot:this.props.editor.projectRoot})),(a||r)&&(0!==i.length&&i.push(O.createElement("hr",{key:this.state.key++})),i.push(O.createElement(Y.default,{title:n?n.data.name:"",subtitle:n?n.data.class:"",model:this.props.editor.model,shape:n,projectRoot:this.props.editor.projectRoot}))),O.createElement("div",{tabIndex:-1},O.createElement(q.default,{width:this.props.paneWidth,height:this.props.paneHeight-40,ref:"topLevel",serialized:this.props.editor.layout},O.createElement(X.default,{onLayoutResize:this.onLayoutResize},O.createElement("div",{style:t,ref:"palette"}),O.createElement("div",{className:"native-key-bindings",style:t,ref:"diagram"}),O.createElement("div",{className:"right-pane",ref:"rightPane"},O.createElement("div",{className:"arguments-scroll-container"},i)))))},onLayoutResize:function(){this.requestDiagramUpdate()},initializeSurface:function(e,t){this.loadShapeProperties();var o=this.setupDiagram(t),i=this.setupPalette(e);this.setupNodeTemplates(o,!1),this.setupNodeTemplates(i,!0),this.loadPalette(i),this.setupLinkTemplates(o);var n=this.loadFromFile(this.props.editor.uri);this.versionUpModified=D(n),o.model=n,this.props.editor.model.setSurface(o,i),this.setState({selectedShape:void 0,diagram:o}),this.requestDiagramUpdate=function(){o.requestUpdate(),i.requestUpdate()},this.requestDiagramUpdate()},requestDiagramUpdate:function(){},setupDiagram:function(e){var t=this,o=W(z.default.Diagram,e,{allowDrop:!0,allowResize:!0,initialContentAlignment:z.default.Spot.Center,LinkDrawn:this.showLinkLabel,LinkRelinked:this.showLinkLabel,"animationManager.isEnabled":!1,"undoManager.isEnabled":!0,resizingTool:new J.ResizeMultipleTool,draggingTool:new G.GuidedDraggingTool,"draggingTool.horizontalGuidelineColor":"blue","draggingTool.verticalGuidelineColor":"blue","draggingTool.centerGuidelineColor":"green","draggingTool.guidelineWidth":1}),n="#2B3856",a="#151B54";return o.grid=W(z.default.Panel,"Grid",{name:"GRID",visible:!1,gridCellSize:new z.default.Size(10,10),gridOrigin:new z.default.Point(0,0)},W(z.default.Shape,"LineH",{stroke:a,strokeWidth:.5,interval:1}),W(z.default.Shape,"LineH",{stroke:a,strokeWidth:.5,interval:5}),W(z.default.Shape,"LineH",{stroke:n,strokeWidth:1,interval:10}),W(z.default.Shape,"LineV",{stroke:a,strokeWidth:.5,interval:1}),W(z.default.Shape,"LineV",{stroke:a,strokeWidth:.5,interval:5}),W(z.default.Shape,"LineV",{stroke:n,strokeWidth:1,interval:10})),e.style.position="relative",o.addDiagramListener("ObjectDoubleClicked",function(e){var i=e.subject.part;if(i instanceof z.default.Node){var n=i.data,a=void 0,r=j.parse(t.props.editor.getURI()).dir;"Flow.Subflow"===n.class?a=j.resolve(r,n.options.subflowId+".flow"):n.class.startsWith("Mim")&&n.options.mimPath?a=j.resolve(t.props.editor.projectRoot,n.options.mimPath):"Subtree"!==n.class&&"Flow.Subtree"!==n.class||(a=j.resolve(r,n.options.behaviorPath+".bt")),a&&L.existsSync(a)&&atom.workspace.open(a)}else if(i instanceof z.default.Link){var s=i.findObject("link-label");s&&o.commandHandler.editTextBlock(s)}}),o.addDiagramListener("Modified",function(){var e=o.isModified||t.versionUpModified;t.versionUpModified=!1,t.props.editor.showModified(e)}),o.addDiagramListener("ExternalObjectsDropped",function(e){var i=[];e.subject.each(function(e){i.push(e)}),o.toolManager.draggingTool.clearGuidelines();for(var n=function(e){return e.data._deleteOnDrop?(e.diagram.commandHandler.deleteSelection(),"continue"):(delete e.data.key,delete e.data.paletteOrdering,delete e.data._isPaletteNode,e.data.options={},t.displayShape(e.part),void t.chooseNameOrTargetOfActivity(o,e.part,function(){},function(){e.diagram.commandHandler.deleteSelection()}))},a=0,r=i;a");var t=O.createElement(A.default,{root:this.root,onChoose:this.onChoose,onCancel:this.onCancel,onClose:function(){e.destroyModal()}});O.render(t,this._modalContainer[0]),this.state.modalPanel=atom.workspace.addModalPanel({item:this._modalContainer})},e.prototype.destroyModal=function(){O.unmountComponentAtNode(this._modalContainer[0]),this.state.modalPanel&&(this.state.modalPanel.destroy(),this.state.modalPanel=void 0)},e}(),te=function(){function e(e,t,o){this.root=e,this.onChoose=t,this.onCancel=o,this.state={}}return e.prototype.createModal=function(){var e=this;this._modalContainer=F("
");var t=O.createElement(B.default,{root:this.root,settings:B.BTSettings,onChoose:this.onChoose,onCancel:this.onCancel,onClose:function(){e.destroyModal()}});O.render(t,this._modalContainer[0]),this.state.modalPanel=atom.workspace.addModalPanel({item:this._modalContainer})},e.prototype.destroyModal=function(){O.unmountComponentAtNode(this._modalContainer[0]),this.state.modalPanel&&(this.state.modalPanel.destroy(),this.state.modalPanel=void 0)},e}(),oe=function(){function e(e,t,o){this.root=e,this.onChoose=t,this.onCancel=o,this.state={}}return e.prototype.createModal=function(e){var t=this;this._modalContainer=F("
");var o=O.createElement(B.default,{root:this.root,settings:Object.assign({},B.MimSettings,{contentFilter:e}),onChoose:this.onChoose,onCancel:this.onCancel,onClose:function(){t.destroyModal()}});O.render(o,this._modalContainer[0]),this.state.modalPanel=atom.workspace.addModalPanel({item:this._modalContainer})},e.prototype.destroyModal=function(){O.unmountComponentAtNode(this._modalContainer[0]),this.state.modalPanel&&(this.state.modalPanel.destroy(),this.state.modalPanel=void 0)},e}(),ie=function(){function e(e,t,o){this.root=e,this.onChoose=t,this.onCancel=o,this.state={}}return e.prototype.createModal=function(){var e=this;this._modalContainer=F("
");var t=O.createElement(B.default,{root:this.root,settings:B.ImageSettings,onChoose:this.onChoose,onCancel:this.onCancel,onClose:function(){e.destroyModal()}});O.render(t,this._modalContainer[0]),this.state.modalPanel=atom.workspace.addModalPanel({item:this._modalContainer})},e.prototype.destroyModal=function(){O.unmountComponentAtNode(this._modalContainer[0]),this.state.modalPanel&&(this.state.modalPanel.destroy(),this.state.modalPanel=void 0)},e}(),ne=[{key:"control-M",method:c},{key:"control-N",method:u},{key:"control-L",method:h},{key:"control-T",method:p},{key:"Up",method:d},{key:"Down",method:d},{key:"Left",method:d},{key:"Right",method:d},{key:"meta-Up",method:d},{key:"meta-Down",method:d},{key:"meta-Left",method:d},{key:"meta-Right",method:d}];Object.defineProperty(o,"__esModule",{value:!0}),o.default=Z},{"../../atom-react/mixins/pane-resize-event-mixin":58,"../../common/layout/h-layout":103,"../../common/layout/layout":104,"../../common/modals/choose-file-modal":107,"../flow-editor":114,"../modals/choose-flow-modal":117,"./GuidedDraggingTool":118,"./JiboColors":119,"./LinkLabelDraggingTool":120,"./LinkShiftingTool":121,"./ResizeMultipleTool":122,"./flow-arguments-view":123,"./go":125,"./procedure-view":126,atom:void 0,fs:void 0,jquery:void 0,"node-uuid":void 0,"normalize-path":void 0,path:void 0,react:void 0}],125:[function(e,t,o){"use strict";var i,n=e("path"),a=e("find-root");i=e(n.join(a(__dirname),"resources/externals/go")),Object.defineProperty(o,"__esModule",{value:!0}),o.default=i},{"find-root":void 0,path:void 0}],126:[function(e,t,o){"use strict";var i=e("react"),n=e("./JiboColors");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({displayName:"layout-child",currentScale:1,propTypes:{diagram:i.PropTypes.object.isRequired},getDefaultProps:function(){return{}},getInitialState:function(){return{key:0}},onChange:function(e,t,o){var i=this.props.model.surface.model;i.startTransaction("field value change"),i.setDataProperty(e,t,o),i.commitTransaction("field value change")},handleMouseOver:function(){},handleMouseEnter:function(e){this.currentScale=this.props.diagram.scale,this.props.diagram.scrollToRect(e.actualBounds),this.props.diagram.scale=this.currentScale;var t=this.props.model.surface.model; t.startTransaction("highlight change"),e.isHighlighted=!0},handleMouseLeave:function(e){this.props.diagram.scale=this.currentScale,e.diagram.undoManager.rollbackTransaction();var t=[];this.props.diagram.selection.each(function(e){t.push(e)}),0!==t.length&&this.props.diagram.scrollToRect(t[0].actualBounds)},handleClick:function(e){this.props.setParentsSelectedShape(e)},handleDoubleClick:function(e){this.props.diagram.scale=this.currentScale,e.diagram.undoManager.rollbackTransaction(),this.props.diagram.clearSelection(),this.props.diagram.select(e)},refCallback:function(e,t){var o=this;e&&(e.getDOMNode().ondblclick=function(){return o.handleDoubleClick(t)})},render:function(){var e=[],t=this.findReferences("blackboard"),o=this.findReferences("notepad\\.params"),n=this.findReferences("notepad","notepad\\.params");return this.populate(e,"Blackboard",t),this.populate(e,"Input Parameters",o),this.populate(e,"Notepad",n),i.createElement("div",null,e)},populate:function(e,t,o){for(var a=this,r=[],s="",l=function(e){var t=e.node,o={width:"100%"};e.isAssignment&&(o.color="white");var l="";e.varName!==s&&(s=l=e.varName);var c={padding:"2px"},u=i.createElement("tr",{key:d.state.key++},i.createElement("td",{key:d.state.key++,style:Object.assign({},c,{color:n.default.Limeade})},l),i.createElement("td",{key:d.state.key++,style:c},i.createElement("div",{onMouseEnter:function(){a.handleMouseEnter(t)},onMouseLeave:function(){a.handleMouseLeave(t)},ref:function(e){return a.refCallback(e,t)},onClick:function(){a.handleClick(t)},style:o},e.line)));r.push(u)},d=this,c=0,u=o;c=0){var r=l[t][this.state.prompt_category];o").addClass("combo-box-list").css({left:o.left+"px",top:o.bottom+"px"}).appendTo(document.body),n(document).on("click",this.state.clickHandler),i.render(i.createElement(a,{data:this.props.data,onSelect:this.onSelect}),this.node[0])}}})},{jquery:void 0,react:void 0}],154:[function(e,t,o){"use strict";var i=e("react"),n=e("../../atom-react/components/float-input-view"),a=e("../../atom-react/components/integer-input-view");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({getInitialState:function(){return{value:this.props.value}},componentWillReceiveProps:function(e){this.setState({value:e.value})},render:function(){var e={marginTop:4,height:20,width:50,display:"inline"},t="number"===this.props.type?i.createElement(n.default,{min:this.props.min,max:this.props.max,value:this.state.value,onChange:this.props.onChange,style:e}):i.createElement(a.default,{min:this.props.min,max:this.props.max,value:this.state.value,onChange:this.props.onChange,style:e});return t}})},{"../../atom-react/components/float-input-view":50,"../../atom-react/components/integer-input-view":51,react:void 0}],155:[function(e,t,o){"use strict";var i=e("react"),n=e("../../common/atom-editor");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({render:function(){return i.createElement("div",{style:{width:"100%"}},i.createElement(n.default,{ref:"editor",mini:!0,content:this.props.content,grammar:this.props.grammar,advanced:{softWrap:!0},onDidStopChanging:this.props.onChange}))},componentWillReceiveProps:function(e){var t=this.refs.editor;t.setText(e.content),t.props.onDidStopChanging=e.onChange}})},{"../../common/atom-editor":96,react:void 0}],156:[function(e,t,o){"use strict";var i=e("react"),n=e("../../common/atom-editor");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({render:function(){return i.createElement("div",{style:{width:"100%"}},i.createElement(n.default,{ref:"editor",hideGutter:!0,style:{minHeight:this.props.height},content:this.props.content,grammar:this.props.grammar,advanced:{softWrap:!0,hideInvisibles:!0},onDidStopChanging:this.props.onChange}))},componentWillReceiveProps:function(e){var t=this.refs.editor;t.setText(e.content),t.props.onDidStopChanging=e.onChange}})},{"../../common/atom-editor":96,react:void 0}],157:[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=[[{displayName:"Prompt ID",dataName:"prompt_id",type:"string",description:"Unique identifier for this prompt, to assist error messages in telling you where something went wrong when debugging."},{dataName:"delete"}],[{displayName:"Prompt Category",dataName:"prompt_category",type:"dropdown",params:{data:"promptCategories"},description:"The main category for the prompt"},{displayName:"Prompt Subcategory",dataName:"prompt_sub_category",type:"dropdown",params:{data:"promptSubCategories"},description:"The sub category for the prompt. Some main categories will only have one sub category."}],[{displayName:"Weight",dataName:"weight",type:"number",params:{min:0},description:"Weighting for randomization - larger numbers will be picked more than smaller numbers. 0 disables the prompt."},{displayName:"Index",dataName:"index",type:"integer",params:{min:1},description:"Index of the prompt. Represents order in which prompts should be used, given repetitions of MIM errors.",promptCat:"prompt-cat-error-only",short:!0},{displayName:"Media",dataName:"media",type:"dropdown",params:{data:"mediaTypes"},description:"The type of media. TTS handles all SFX, animations, and TTS. If you are sure you want nothing to happen, Silence is available.",short:!0}],[{displayName:"Condition",dataName:"condition",type:"string",description:"Condition for which the prompt should be usable. This is standard Javascript, as though in an if() expression.",params:{grammar:"source.js"}}],[{displayName:"Prompt",dataName:"prompt",type:"string",params:{grammar:"text.mim-esml"},description:"The prompt text. Standard text, with optional ESML tags and ${} wrapping Javascript for dynamic insertion."}]]},{}],158:[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default={mim_type:{type:"string",default:"announcement",values:["announcement","question","optional-response"]},rule_name:{type:"string",default:""},gui:{type:"object",default:null},timeout:{type:"number",default:6},no_matches_for_gui:{type:"number",default:0},no_inputs_for_gui:{type:"number",default:0},ignore_no_match:{type:"boolean",default:!1},barge_in:{type:"boolean",default:!0},es_auto_tagging:{type:"boolean",default:!0},parse_all_asr:{type:"boolean",default:!1},thanks_handling:{type:"string",default:"ignore",values:["ignore","respondAndListen","respondAndEnd"]},notes:{type:"string",default:""}}},{}],159:[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default={prompt_category:{type:"string",default:"Entry-Core",values:["Entry-Core","Error"]},prompt_sub_category:{type:"string",default:"AN",values:["AN","Q","NI","NM","HoldReturn","Truncated","Verbose","Thanks"]},index:{type:"number",default:1},condition:{type:"string",default:""},prompt:{type:"string",default:""},media:{type:"string",default:"TTS",values:["TTS","silence"]},prompt_id:{type:"string",default:""},weight:{type:"number",default:1}}},{}],160:[function(e,t,o){"use strict";var i=e("react"),n=e("jibo-cli"),a=e("jquery"),r=e("path"),s=e("fs"),l=e("atom"),d=e("../atom-react/components/jibo-combo-box"),c=e("jibo-analytics"),u=e("../common/atom-editor"),h=i.createClass({getInitialState:function(){return this.data=[{label:"Create Skill",display:"Skill",value:{template:"behavior-template",fields:[{label:"Package.json name",ref:"packageName"}]}},{label:"Create Asset Pack",display:"Asset Pack",value:{template:"asset-pack-template",fields:[{label:"Package.json name",ref:"packageName"},{label:"Asset Pack Title",ref:"titleName"}]}}],{step:0,type:this.data[0].value}},onChangeConfiguration:function(e){this.setState({type:e.value})},getFieldValue:function(e){var t=this.refs[e];return t?t.getText():""},createInputField:function(e,t,o){var n=this;return i.createElement("div",{className:"block"},i.createElement("label",null,e),i.createElement(u.default,{ref:t,tabIndex:o,mini:!0,content:"",onDidChange:function(e){var o=i.findDOMNode(n.refs.generateButton);n.fields[t]=e.length>0,o.disabled=!n.areFieldsFilledIn()}}))},render:function(){var e=this;switch(this.state.step){case 0:var t=[];return this.state.type.fields.forEach(function(o,i){t.push(e.createInputField(o.label,o.ref,i))}),i.createElement("div",{className:"block package-generator"},i.createElement("div",{className:"panel-heading"},i.createElement("h1",{style:{textAlign:"center"}},"New Jibo Skill")),i.createElement("div",{className:"block"},i.createElement("label",null,"Type"),i.createElement(d.default,{data:this.data,init:this.data[0],onSelected:this.onChangeConfiguration})),t,i.createElement("hr",null),i.createElement("div",{className:"btn-group"},i.createElement("button",{className:"btn",ref:"generateButton",onClick:this.onChoose},"Generate"),i.createElement("button",{className:"btn",onClick:this.props.onClose },"Cancel")));case 1:return i.createElement("div",{className:"inline-block",style:{display:"flex"}},i.createElement("i",{className:"fa fa-cog fa-spin fa-5x"}),i.createElement("label",{style:{margin:"auto",fontSize:23}},"Installing node dependencies"))}},areFieldsFilledIn:function(){for(var e=Object.keys(this.fields),t=!0,o=0;o0?s[s.length-1]:o;this.setState(this.state),n.packageGenerator(this.state.type.template,a,l,i,function(){e.props.onClose(),atom.open({pathsToOpen:[a]}),c.default.event("new-project",e.state.type.template,{})})},getPackagesDirectory:function(){return atom.config.get("core.projectHome")||process.env.ATOM_REPOS_HOME||r.join(s.getHomeDirectory(),"github")}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(){var e=a("
"),t=atom.workspace.addModalPanel({item:e});i.render(i.createElement(h,{onClose:function(){t.destroy()}}),e[0])}},{"../atom-react/components/jibo-combo-box":53,"../common/atom-editor":96,atom:void 0,fs:void 0,"jibo-analytics":void 0,"jibo-cli":void 0,jquery:void 0,path:void 0,react:void 0}],161:[function(e,t,o){"use strict";function i(e){var t=r.normalize("/rules/");return!!e.includes(t)}function n(){var t=s.default.getFolderPathWithDirectory(s.default.getFolderPathOfSelection(),"src/rules");if(!t)return void alert("You must have a valid project loaded in order to create a new .rule file.");var o=atom.getCurrentWindow(),n=e("remote"),r=n.dialog||n.require("dialog");r.showSaveDialog(o,{title:"New Rule",defaultPath:t,filters:[{name:"Rules",extensions:["rule"]}]},function(e){if(e)if(i(e)){var t="TopRule = $* (hello world){what='hello'} $*;";a.writeFileSync(e,t,"utf8"),atom.workspace.open(e),l.default.event("rules-editor","new",{})}else alert('You must save rule files under the "src/rules" folder.')})}var a=e("fs"),r=e("path"),s=e("../common/tree-view-helper"),l=e("jibo-analytics");Object.defineProperty(o,"__esModule",{value:!0}),o.default=n},{"../common/tree-view-helper":109,fs:void 0,"jibo-analytics":void 0,path:void 0,remote:void 0}],162:[function(e,t,o){"use strict";var i=e("react");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({getInitialState:function(){return{hover:!1}},render:function(){var e={marginTop:-20,width:10,height:20},t=null;return this.state.hover&&(t=i.createElement("span",{className:"badge badge-info",style:{fontSize:15}},this.props.message)),i.createElement("div",null,i.createElement("div",{onMouseOver:this.onMouseOver,onMouseOut:this.onMouseOut,style:e}),t)},onMouseOver:function(){this.setState({hover:!0})},onMouseOut:function(){this.setState({hover:!1})}})},{react:void 0}],163:[function(e,t,o){"use strict";var i=e("react");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({getInitialState:function(){return{hover:!1}},render:function(){var e={marginLeft:-50,marginTop:-25,width:30,height:25},t=null;return this.state.hover&&(t=i.createElement("span",{className:"badge badge-info",style:{fontSize:15}},this.props.message)),i.createElement("div",null,i.createElement("div",{onMouseOver:this.onMouseOver,onMouseOut:this.onMouseOut,style:e}),t)},onMouseOver:function(){this.setState({hover:!0})},onMouseOut:function(){this.setState({hover:!1})}})},{react:void 0}],164:[function(e,t,o){"use strict";function i(){var t=r(__dirname),o=a.join(t,"parser/build/Release/jsjibonlu.jibo"),i=a.join(t,"parser/build/Release/jsjibonlu.node");n.existsSync(o)&&n.renameSync(o,i);var s;try{s=e(i);var l=a.join(t,"parser","deps","data");s.set_data_dir(l);var d=a.join(t,"resources/crew/dummy-crew.rule"),c=n.readFileSync(d,"utf8");s.compile_fst_from_text(c,"handle:crew")}catch(e){console.warn("Error importing jibo-parser. The Rule Tester Panel will not work.")}return s}var n=e("fs"),a=e("path"),r=e("find-root");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i},{"find-root":void 0,fs:void 0,path:void 0}],165:[function(e,t,o){"use strict";var i=e("path"),n=e("react"),a=e("./error-popup"),r=e("./gutter-popup"),s=e("./jibo-parser"),l=function(){function e(){this.start(),this.nlu=s.default()}return e.prototype.onChange=function(){this.marker&&(this.marker.destroy(),this.lineNumber&&this.lineNumber.parentNode&&this.lineNumber.parentNode.removeChild(this.lineNumber));var e=this.editor.getText();try{this.nlu&&this.nlu.syntax_check(e)}catch(e){var t=JSON.parse(e.message);if(t.info.line){var o=[[t.info.line-1,t.info.column-1],[t.info.line-1,t.info.column]];this.marker=this.editor.markBufferRange(o,{invalidate:"never"}),this.editor.decorateMarker(this.marker,{type:"highlight",class:"jibo-highlight-red"}),this.editor.decorateMarker(this.marker,{type:"line-number",class:"jibo-line-number-red"});var i=document.createElement("div");n.render(n.createElement(a.default,{message:t.info.msg,marker:this.marker}),i),this.editor.decorateMarker(this.marker,{type:"overlay",item:i})}else{var o=[[0,0],[0,1]];this.marker=this.editor.markBufferRange(o,{invalidate:"never"}),this.editor.decorateMarker(this.marker,{type:"line-number",class:"jibo-line-number-red"});var i=document.createElement("div");n.render(n.createElement(r.default,{message:t.info.msg,marker:this.marker}),i),this.editor.decorateMarker(this.marker,{type:"overlay",item:i})}console.log(t)}},e.prototype.start=function(){var e=this;atom.workspace.observeActivePaneItem(function(t){if(t&&t.constructor&&"TextEditor"===t.constructor.name){var o=i.extname(t.getPath());e.dispoable&&e.dispoable.dispose(),".nli"!==o&&".rule"!==o&&".grm"!==o||(e.editor=t,e.dispoable=t.onDidStopChanging(e.onChange.bind(e)))}})},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=new l},{"./error-popup":162,"./gutter-popup":163,"./jibo-parser":164,path:void 0,react:void 0}],166:[function(e,t,o){"use strict";var i=e("react"),n=e("parser-download"),a=e("./jibo-parser"),r=e("path"),s=e("find-root"),l=a.default(),d={};Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({addDisposable:function(e){this.disposables.push(e)},getInitialState:function(){return this.disposables=[],{result:"",compileTime:0,parseTime:0}},compile:function(){if(l){var e=i.findDOMNode(this.refs.json);this.parser=null,l.remove_from_memory("handle:1");try{var t=performance.now(),o=l.compile_fst_from_text(this.props.editor.getText(),"handle:1"),n=performance.now();this.parser=l.build_sentence_parser(o),this.setState({compileTime:n-t})}catch(t){e.getModel().setText("[]"),this.setState({compileTime:0,parseTime:0})}}},onDownload:function(){var e=this,t={force32:!0,version:"2.0.0",type:process.versions.modules,temp:r.join(s(__dirname),"tmp"),dir:r.join(s(__dirname),"parser"),rename:!0,logger:function(e){console.log("[parser-download]",e)}};n(t,function(t){t&&console.error(t),l=a.default(),e.setState({})})},parse:function(){var e=i.findDOMNode(this.refs.json),t=i.findDOMNode(this.refs.editor);if(this.parser){var o=performance.now();try{var n=this.parser.parse_sentence(t.getModel().getText()),a=performance.now();this.setState({parseTime:a-o}),n=JSON.parse(n),n=JSON.stringify(n,null,4),e.getModel().setText(n)}catch(t){e.getModel().setText("[]"),this.setState({compileTime:0,parseTime:0})}}else e.getModel().setText("[]"),this.setState({compileTime:0,parseTime:0})},render:function(){var e={width:"100%",height:"100%",display:"flex",flexDirection:"column"};return l?i.createElement("div",{style:e,ref:"container"},i.createElement("div",{className:"panel-heading",style:{padding:"0px"}},i.createElement("h2",{style:{textAlign:"center",marginTop:"6px",marginBottom:"6px"}},"Test ",this.props.editor.getTitle())),i.createElement("atom-text-editor",{ref:"editor",style:{marginLeft:10,marginRight:10,marginBottom:10,marginTop:20},mini:!0,"placeholder-text":"Enter test sentence here"}),i.createElement("div",{className:"text-info",style:{margin:10}},i.createElement("span",{className:"icon icon-graph"})," ","compile time: "+this.state.compileTime.toFixed(2)+"ms, parse time: "+this.state.parseTime.toFixed(2)+"ms"),i.createElement("div",{className:"json-container"},i.createElement("atom-text-editor",{"gutter-hidden":!0,ref:"json",style:{height:"100%"}})),i.createElement("div",{style:{height:26}})):i.createElement("div",{style:e,ref:"container"},i.createElement("div",{className:"panel-heading",style:{padding:"0px"}},i.createElement("h2",{style:{textAlign:"center",marginTop:"6px",marginBottom:"6px"}},"Test ",this.props.editor.getTitle())),i.createElement("div",{className:"text-center highlight-warning",style:{margin:"10px"}},"The Rule Tester Panel is currently disabled because the NLU Parser module is out of date. This can happen when updating to a newer version of Atom."),i.createElement("div",{className:"text-center"},i.createElement("button",{className:"btn btn-lg",style:{marginBottom:"6px"},onClick:this.onDownload},"Click To Update"),i.createElement("p",null,i.createElement("em",null,"Please refresh current .rule file after updating"))),i.createElement("div",{style:{height:26}}))},componentDidMount:function(){var e=this;if(l){var t=i.findDOMNode(this.refs.editor),o=i.findDOMNode(this.refs.json),n=i.findDOMNode(this.refs.container);n.addResizeListener=function(){console.log(n.clientWidth,n.clientHeight)};for(var a=!1,r=atom.grammars.getGrammars(),s=0;s");i.addClass("toolbar"),v.render(v.createElement(y.default,null),i[0]),t.toolbarPanel=atom.workspace.addTopPanel({item:i});var n=function(e){var o=null;if(e&&(o=e.__displayName||(e.constructor?e.constructor.name:null)),"TextEditor"===o){var i=r.extname(e.getPath());if(".nli"===i||".rule"===i||".grm"===i)return t.editor=e,void t.toggleRulePane(!0,e)}t.toggleRulePane(!1)};atom.workspace.observeActivePaneItem(function(e){n(e)}),n(atom.workspace.getActiveTextEditor()),e("./rules/rule-grammar"),o=!0},a=function(){return w.default.isUserLoggedIn()?void n():(i=!0,void w.default.showDialog(function(e,t){return i=!1,e?void console.log(e):void(t&&n())}))};a(),this.disposable.add(atom.commands.add("atom-workspace",{"jibo-sdk:login":function(){return o?void alert("You are already logged in"):void(i||a())}}))},t.prototype.deactivate=function(){this.toolbarPanel&&this.toolbarPanel.destroy(),this.disposable.dispose(),g.default.deactivate()},t.prototype.openURI=function(e){if(h.default.useDefaultEditor()!==!1){if("atom://jibo-cheat-sheet"===e)return new b.default(e,!0);var t={".keys":s.default,".bt":l.default,".mim":d.default,".flow":c.default},o=r.extname(e).toLowerCase();if(a.has(t,o)){var i={".anim":"animation-preview",".keys":"animation-editor",".bt":"behavior-editor",".mim":"mim-editor",".flow":"flow-editor"};return M.default.event(i[o],"opened",{}),new t[o](e)}}},t}();t.exports=new C},{"./animation-editor/animation-editor":1,"./atom-react/atom-integration":49,"./behavior-editor/behavior-editor":76,"./cheat-sheet/cheat-sheat-tab":92,"./common/json-opener":101,"./flow-editor/flow-editor":114,"./flow-editor/flow-preflight-runner":116,"./gating/login":127,"./launcher/launcher":129,"./mim-editor/mim-editor":137,"./package-generator/package-generator-modal":160,"./rules/create-new-rule":161,"./rules/rule-grammar":165,"./rules/rule-tester-panel":166,"./toolbar/toolbar":168,atom:void 0,"jibo-analytics":void 0,jquery:void 0,lodash:void 0,loophole:void 0,path:void 0,react:void 0}]},{},[169])(169)});