23 lines
459 KiB
JavaScript
23 lines
459 KiB
JavaScript
|
|
/**
|
||
|
|
* 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<i.length;r++)n(i[r]);return n}({1:[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("path"),a=e("jibo"),r=e("../atom-react/core/react-editor"),s=e("./views/editor"),l=e("./models/animation-model"),d=e("../common/tree-view-helper"),c=e("./audio/multi-audio-playback"),u=e("jibo-analytics"),h=function(t){function o(e){var o=t.call(this,"AnimationEditor",e,!1)||this,i=o.getUiState();o.layout=i?i:[];var n=a.utils.PathUtils.findRoot(e);return o.animationModel=new l.default(o,n),o.animationModel.audio=new c.default(o.animationModel,n),o}return i(o,t),o.createNewFile=function(){var t=d.default.getFolderPathWithDirectory(d.default.getFolderPathOfSelection(),"animations");if(!t)return void alert("You must have a valid project loaded in order to create a new animation.");var i=atom.getCurrentWindow(),n=e("remote"),a=n.dialog||n.require("dialog");a.showSaveDialog(i,{title:"New Animation",defaultPath:t,filters:o.getDialogFilter()},function(e){e&&(o.isValidDirectory(e)?(l.default.createNewFile(e),atom.workspace.open(e),u.default.event("animation-editor","new",{})):alert('You must save animations under the "animations" folder.'))})},o.isValidDirectory=function(e){var t=n.normalize("/animations/");return!!e.includes(t)},o.getDialogFilter=function(){return[{name:"Animation",extensions:["keys"]}]},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),this.animationModel.dispose(),this.animationModel.audio.dispose()},o.prototype.onPaneActivated=function(){var e=this;setTimeout(function(){e.container.childNodes[0]&&e.container.childNodes[0].focus()},1)},o.prototype.focus=function(){this.container.childNodes[0]&&this.container.childNodes[0].focus()},o.prototype.onPaneDeactivated=function(){},o.prototype.getReactClass=function(){return s.default},o.prototype.saveFile=function(e){return o.isValidDirectory(e)?(this.animationModel.saveFile(e),this.animationModel.backup(),u.default.event("animation-editor","saved",{}),!0):(alert('You must save animations under the "animations" folder.'),!1)},o.prototype.reload=function(){this.animationModel.reloadFile(this.uri)},o.prototype.getSaveDialogOptions=function(){return{title:"Animation Save As",filters:o.getDialogFilter()}},o}(r.default);atom.deserializers.add({deserialize:r.default.deserialize.bind(h),name:"AnimationEditor"}),Object.defineProperty(o,"__esModule",{value:!0}),o.default=h},{"../atom-react/core/react-editor":55,"../common/tree-view-helper":109,"./audio/multi-audio-playback":4,"./models/animation-model":9,"./views/editor":12,jibo:void 0,"jibo-analytics":void 0,path:void 0,remote:void 0}],2:[function(e,t,o){"use strict";function i(e){for(var t=2*r+e.length,o=a.createBuffer(e.numberOfChannels,t,e.sampleRate),i=0;i<e.numberOfChannels;i++){for(var n=e.getChannelData(i),s=new Float32Array(2*r+n.length),l=0,d=0;d<r;d++)s[l]=0,l++;for(var d=0;d<n.length;d++)s[l]=n[d],l++;for(var d=0;d<r;d++)s[l]=0,l++;o.copyToChannel(s,i)}return o}function n(e){for(var t=new Float32Array(e.length),o=a.createBuffer(1,e.length,e.sampleRate),i=-r,n=0;n<e.length;n++)t[n]=i,i++;return o.getChannelData(0).set(t),o}va
|
||
|
|
n-=1)}}),this.emit("ondatachanged"),this.emit("onpropertieschanged")},t.prototype.setSelection=function(e){this.state.selection.layers[0]=e,this.keyframeSelection.validateSelection(),this.emit("ondatachanged"),this.emit("layerselected")},t.prototype.getSelectedLayer=function(){for(var e=this.state.selection.layers[0],t=0;t<this.state.keyframes.layers.length;t++)if(this.state.keyframes.layers[t].id===e)return this.state.keyframes.layers[t];return null},t.prototype.getSelectedLayerProperties=function(){var e=this.getSelectedLayer();return this.state.overrides[e.id]},t.prototype.reorderToBeforeLayer=function(e,t){var o=this.getLayer(e),i=l.indexOf(this.state.keyframes.layers,o);this.state.keyframes.layers.splice(i,1);var n=this.getLayer(t),a=l.indexOf(this.state.keyframes.layers,n);this.state.keyframes.layers.splice(a,0,o),this.emit("ondatachanged")},t.prototype.reorderToAfterLayer=function(e,t){var o=this.getLayer(e),i=l.indexOf(this.state.keyframes.layers,o);this.state.keyframes.layers.splice(i,1);var n=this.getLayer(t),a=l.indexOf(this.state.keyframes.layers,n);this.state.keyframes.layers.splice(a+1,0,o),this.emit("ondatachanged")},t.prototype.getLayerIndex=function(e){return l.indexOf(this.state.keyframes.layers,this.getLayer(e))},t.prototype.getLayerCount=function(){return this.state.keyframes.layers.length},t.prototype.getLayerByIndex=function(e){return this.state.keyframes.layers[e]},t.prototype.getLayerByName=function(e){var t=l.findIndex(this.state.keyframes.layers,function(t){return t.name===e});return t!==-1?this.state.keyframes.layers[t]:null},t.prototype.isPreviousLayer=function(e,t){var o=this.getLayerIndex(e),i=this.getLayerIndex(t);return o===i-1},t.prototype.isNextLayer=function(e,t){var o=this.getLayerIndex(e),i=this.getLayerIndex(t);return o===i+1},t.prototype.updateSelectedLayerProperties=function(e){var t=this.getSelectedLayer(),o=t.id;this.state.overrides[o]=l.merge({},this.getOverridesOrDefaults(t),l.cloneDeep(e)),this.emit("ondatachanged")},t.prototype.updateSelectedLayerPropertiesRelative=function(e){var t=this.getDefaultPropsForLayerType(this.getSelectedLayer().type);e=r.runtime.computeRelativePropValues(this.getSelectedLayer(),this.state.keyframes,s,this.uiState.currentTime,e,t),this.updateSelectedLayerProperties(e)},t.prototype.getOverridesOrDefaults=function(e){return l.cloneDeep(this.state.overrides[e.id])||this.getDefaultPropsForLayerType(e.type)},t.prototype.addRedoUndoEntry=function(){},t.prototype.backup=function(){var e=f.createHash("md5");e.update(this.editor.uri);var t=e.digest("hex"),o=m.basename(t),i=b+"/"+o+".backup";this.saveFile(i)},t.prototype.toggleLayerVisibility=function(e){var t=this.getLayer(e);t.visible=!t.visible,this.emit("ondatachanged"),this.emit("onpropertieschanged"),this.addRedoUndoEntry()},t.prototype.toggleLayerLocked=function(e){var t=this.getLayer(e);t.locked=!t.locked,this.emit("ondatachanged"),this.emit("onpropertieschanged"),this.addRedoUndoEntry()},t.prototype.updateAnimationDBData=function(e,t){this.state.keyframes.animdb||(this.state.keyframes.animdb={}),this.state.keyframes.animdb[e]=t,this.emit("ondatachanged"),this.emit("onpropertieschanged"),this.addRedoUndoEntry()},t.prototype.deleteKeyByTime=function(e,t){var o=this.getLayer(e),i=l.find(o.keyframes,function(e){return e.time===t});this._deleteKeyframe(o,i)&&(this.syncOverrides(),this.emit("ondatachanged"),this.emit("onpropertieschanged"))},t.prototype._deleteKeyByTime=function(e,t){var o=this,i=this.getLayer(e);l.remove(i.keyframes,function(e){return o.syncOverrides(),o.emit("ondatachanged"),o.emit("onpropertieschanged"),e.time===t})},t.prototype._deleteKeyframe=function(e,t){return!!t&&(l.remove(e.keyframes,function(e){return e===t}),!0)},t.prototype.deleteKeysByLayerId=function(e){var t=this.getLayer(e),o=0!==t.keyframes.length;t.keyframes=[],o&&(this.syncOverrides(),this.emit("ondatachanged"),this.emit("onpropertieschanged"))},t.prototype.upsertKeyframes=function(e){var t=this,o=e?this.state.keyframes.layers:[this.getLayer(this.state.selection.layers[0])],i=[];o.forEach(function(e){var o=e.id;if(!e.l
|
||
|
|
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){o<e&&(e=o)}),this.props.editor.animationModel.insertBlankFrame(e)},deleteFrame:function(){var e=1e4;this.props.editor.animationModel.keyframeSelection.forEachSelected(!0,!0,function(t,o){o<e&&(e=o)}),this.props.editor.animationModel.deleteFrame(e)},setEditorFocus:function(){this.getDOMNode().focus()},componentWillUnmount:function(){this.cleanupPaneResizeEventMixin(),this.disposables.dispose(),this.getDOMNode().removeEventListener("focusout",this.onFocusOutCB),this.getDOMNode().removeEventListener("focusin",this.onFocusInCB)},onInnerHLayoutResize:function(e){this.setState({visualizerWidth:e[0],timelineWidth:this.state.timelineWidth})},onHLayoutResize:function(e){this.setState({visualizerWidth:e[0],timelineWidth:e[0]})},onVLayoutResize:function(e){this.setState({visualizerHeight:e[0],timelineHeight:e[1]})},onCreated:function(e){this.setState({face:e})},render:function(){var e=f.utils.PathUtils.findRoot(this.props.editor.uri);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,{onLayoutResize:this.onHLayoutResize},i.createElement(d.default,{onLayoutResize:this.onVLayoutResize},i.createElement(l.default,{onLayoutResize:this.onInnerHLayoutResize},i.createElement(n.default,{animationModel:this.props.editor.animationModel,width:this.state.visualizerWidth,height:this.state.visualizerHeight,onCreated:this.onCreated}),i.createElement(u.default,{face:this.state.face,projectRoot:e,animationModel:this.props.editor.animationModel})),i.createElement(a.default,{playbackTime:this.props.editor.animationModel.uiState.currentKeyframe,onLabelonDoubleClick:this.onLabelonDoubleClick,animationModel:this.props.editor.animationModel,width:this.state.timelineWidth,height:this.state.timelineHeight,visualizerWidth:this.state.visualizerWidth,visualizerHeight:this.state.visualizerHeight})),i.createElement(c.default,{paneHeight:this.props.paneHeight,animationModel:this.props.editor.animationModel}))))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=y},{"../../atom-react/mixins/pane-resize-event-mixin":58,"../../common/layout/h-layout":103,"../../common/layout/layout":104,"../../common/layout/v-layout":105,"./pixi/pixi-view":25,"./properties":27,"./timeline":47,"./visualizer":48,atom:void 0,fs:void 0,jibo:void 0,"jibo-keyframes":void 0,lodash:void 0,react:void 0}],13:[function(e,t,o){"use strict";function i(e){var t,o,i,n,a=0,r=e[2];e[2]=e[3],e[3]=r;for(var s=0;s<e.length;s++)t=e[s].x,o=e[s].y,s===e.length-1?(i=e[0].x,n=e[0].y):(i=e[s+1].x,n=e[s+1].y),a+=t*n-i*o;return a<0}function n(e,t,o,i){var n=.5*parseInt(i.offsetWidth),a=.5*parseInt(i.offsetHeight);t.updateMatrixWorld(),t.geometry.boundingBox||t.geometry.computeBoundingBox();for(var r,s=[new e.Vector3(t.geometry.boundingBox.max.x,t.geometry.boundingBox.max.y,t.geometry.boundingBox.max.z),new e.Vector3(t.geometry.boundingBox.min.x,t.geometry.boundingBox.max.y,t.geometry.boundingBox.max.z),new e.Vector3(t.geometry.boundingBox.max.x,t.geometry.b
|
||
|
|
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
|
||
|
|
e.setState({file:o}),e.props.onChange({file:o})},onClose:function(){e.destroyModal()}}))},componentDidMount:function(){this.subs=new l.CompositeDisposable,this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.chooseAudio),{title:"Choose Audio"}))},componentWillUnmount:function(){this.subs.dispose()}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o){return i.createElement(c,{onChange:e,content:t,projectRoot:o})}},{"../../../atom-react/mixins/modal-mixin":57,"../../../common/atom-editor":96,"../../../common/modals/choose-file-modal":107,atom:void 0,fs:void 0,path:void 0,react:void 0}],29:[function(e,t,o){"use strict";var i=e("react"),n=e("region"),a=e("./utils/common"),r=e("./utils/validate"),s=e("./defaultColor"),l=e("./utils/toStringValue"),d=e("atom");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass(Object.assign({displayName:"HueSpectrum",getDefaultProps:function(){return{height:300,width:30,pointerSize:3,defaultColor:s.default}},getInitialState:function(){return{h:0}},componentDidUpdate:function(){},componentDidMount:function(){this.updateDragPositionIf(),this.subs=new d.CompositeDisposable,this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.huePicker),{title:"Hue Picker"}))},componentWillUnmount:function(){this.subs.dispose()},updateDragPositionIf:function(){this.props.height||this.setState({})},render:function(){this.hsv=this.toColorValue(this.state.value||this.props.value||this.props.defaultValue||this.props.defaultColor),360!==this.state.h||this.hsv.h||(this.hsv.h=360);var e=Object.assign({},this.props.style);this.props.height&&(e.height=this.props.height),this.props.width&&(e.width=this.props.width);var t={height:this.props.pointerSize},o=this.getDragPosition();return null!==o&&(t.top=o,t.display="block"),i.createElement("div",{ref:"huePicker",className:"cp-hue-spectrum",style:e,onMouseDown:this.onMouseDown},i.createElement("div",{className:"cp-hue-drag",style:t},i.createElement("div",{className:"inner"})))},getDragPosition:function(e){if(e=e||this.hsv,!this.props.height&&!this.isMounted())return null;var t=this.props.height||n.fromDOM(this.getDOMNode()).getHeight(),o=this.props.pointerSize,i=Math.round(e.h*t/360),a=Math.round(o/2);return i-a},updateColor:function(e){e=r.default(e),this.hsv.h=360*e.y/e.height,0!==this.hsv.h&&(this.state.h=this.hsv.h),this.state.h=0!==this.hsv.h?this.hsv.h:0},toStringValue:l.default},a.default))},{"./defaultColor":31,"./utils/common":34,"./utils/toStringValue":35,"./utils/validate":36,atom:void 0,react:void 0,region:void 0}],30:[function(e,t,o){"use strict";var i=e("react"),n=e("region"),a=e("./utils/color"),r=a.default.fromRatio,s=e("./utils/common"),l=e("./utils/validate"),d=e("./defaultColor"),c=e("./utils/toStringValue"),u=e("atom");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass(Object.assign({displayName:"SaturationSpectrum",getDefaultProps:function(){return{height:300,width:300,pointerSize:7,defaultColor:d.default}},getInitialState:function(){return{pointerTop:null,pointerLeft:null}},componentDidUpdate:function(){},componentDidMount:function(){this.updateDragPositionIf(),this.subs=new u.CompositeDisposable,this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.saturationPicker),{title:"Saturation Picker"}))},componentWillUnmount:function(){this.subs.dispose()},updateDragPositionIf:function(){this.props.height&&this.props.width||this.setState({})},getDragPosition:function(e){e=e||this.hsv;var t=this.props.width,o=this.props.height,i=t&&o;if(!i&&!this.isMounted())return null;var a;i||(a=n.fromDOM(this.getDOMNode()),o=o||a.getHeight(),t=t||a.getWidth());var r=e.s*t,s=o-e.v*o,l=this.props.pointerSize,d=Math.floor(l/2);return this.props.value&&this.state.mouseDown,{left:r-d,top:s-d}},prepareBackgroundColor:function(e){var t=e,o=r({h:t.h%360/360,s:1,v:1});return o.toRgbString()},prepareProps:function(e,t){var o=Object.assign({},e),i=t.value||o.value||o.defaultValue||o.defaultColor;return o.color=i,this.hsv=this.toColorValue(i),o.style=this.prepareStyle(o),o.className=this.prepareClassName(o),o},pr
|
||
|
|
this.addByName(e,n)}catch(e){console.log("edges error: "+e)}},e.prototype.clear=function(){for(var e in this.debugObjects)this.scene.remove(this.debugObjects[e]);this.debugObjects={}},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=n},{"animation-utilities":void 0}],46:[function(e,t,o){"use strict";var i=e("react"),n=e("../../atom-react/components/jibo-combo-box"),a=e("atom"),r=i.createClass({displayName:"time-notches",onNewLayer:function(e){this.props.animationModel.addLayer(e.value),document.querySelector(".active .animation-editor").childNodes[0].focus()},componentDidMount:function(){this.subs=new a.CompositeDisposable,this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.addLayer),{title:"Add Layer"})),this.subs.add(atom.tooltips.add(i.findDOMNode(this.refs.scrubber),{title:"Scrubber"}))},componentWillUnmount:function(){this.subs.dispose()},render:function(){for(var e=this.props.animationModel.state.keyframes.duration,t=this.props.animationModel.state.keyframes.framerate,o=this.props.animationModel.state.keyframes.duration/t,a=this.props.animationModel.uiState.currentKeyframe,r=[],s=Math.floor(this.props.totalFrames/5)+1,l=0;l<s;l++)r.push(i.createElement("span",{key:l,className:"animation-timeline-notch"},5*l));var d=22,c={container:{width:Math.max(5*s*18+this.props.labelWidth+20,this.props.width),height:d,position:"absolute",marginTop:this.props.offset.y,background:"#363636",borderBottom:"thin solid #444444",zIndex:10},indicator:{marginLeft:18*a,height:20,display:null===this.props.animationModel.getSelectedLayer()?"none":"inline-block"},displayAnchor:{width:this.props.labelWidth-13,marginRight:13,height:d,float:"left",position:"relative"},display:{width:this.props.labelWidth,paddingRight:13,height:d-1,position:"absolute",marginLeft:this.props.offset.x,background:"#363636",zIndex:2},notches:{width:18*s*5,height:d,float:"left",marginLeft:270},miniLine:{height:4,width:2,opacity:.7,position:"absolute",marginTop:18,marginLeft:7,background:"red"}},u=this.props.animationModel.getKeyframeInfo(),h=Object.keys(u.layerTypes),p=[];h.forEach(function(e){p.push({label:e,display:function(){return i.createElement("i",{className:"fa fa-plus-square",style:{fontSize:17}})},value:e})});var m=p[0];return i.createElement("div",{style:c.container,className:"animation-timeline-notches-container"},i.createElement("div",{style:this.displayAnchor},i.createElement("div",{style:c.display,className:"time-display"},i.createElement("div",{ref:"addLayer",style:{float:"left"},className:"new-layer"},i.createElement(n.default,{hideButton:!0,data:p,init:m,onSelected:this.onNewLayer})),i.createElement("span",{className:"frames"},a," of ",e,", "),i.createElement("span",{className:"frame-rate"},t,"fps, "),i.createElement("span",{className:"seconds"},o.toFixed(1),"s"))),i.createElement("div",{style:c.notches,className:"animation-timeline-notches"},i.createElement("div",{ref:"scrubber",style:c.indicator,className:"animation-timeline-indicator",onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},i.createElement("div",{className:"animation-timeline-indicator-handle"},i.createElement("div",{style:c.miniLine}))),r))},onMouseDown:function(){this.props.animationModel.emit("toggle-time-scrub",!0),this.onMouseUpBind=this.onMouseUp.bind(this),document.addEventListener("mouseup",this.onMouseUpBind)},onMouseUp:function(){this.props.animationModel.emit("toggle-time-scrub",!1),document.removeEventListener("mouseup",this.onMouseUpBind)}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=r},{"../../atom-react/components/jibo-combo-box":53,atom:void 0,react:void 0}],47:[function(e,t,o){"use strict";var i=e("react"),n=e("./layer"),a=e("./layer-label"),r=e("./time-notches"),s=e("fs"),l=e("path"),d=e("jquery"),c=e("lodash"),u=e("jibo-keyframes"),h=e("jibo-keyframes").JiboKeyframeInfo,p=e("./playback-controls"),m=i.createClass({displayName:"layout-child",getInitialState:function(){var e=this;return this.props.animationModel.on("onpropertieschanged",function(){e.setLimits(),e.markReferences(),e.forceUpdate()}),{headerOffset:{x:0,y:0},labelsOffse
|
||
|
|
e.prototype.getViewClass=function(){return n.default(this.getReactClass(),this.__displayName)},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=a},{"./atom-view-react-bridge":54,fs:void 0}],57:[function(e,t,o){"use strict";var i=e("jquery"),n=e("react"),a=[],r={createModal:function(e,t){this._modalContainer=i("<div/>"),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;o<i;o++){t=arguments[o];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},n=e("react"),a=e("../../atom-react/mixins/modal-mixin"),r=e("path"),s=e("fs"),l=e("../../common/animation/animation-visualizer"),d=e("../modals/choose-animation-name-modal"),c=e("../../common/atom-editor"),u=e("jibo"),h=n.createClass({getInitialState:function(){return{uri:this.props.uri}},render:function(){return n.createElement("div",{className:"block"},n.createElement("div",{className:"panel-heading"},n.createElement("h1",{style:{textAlign:"center"}},r.parse(this.props.uri).base)),n.createElement(l.default,{style:{width:"100%",height:300},uri:this.state.uri}),n.createElement("button",{className:"btn",onClick:this.props.onClose},"Close"))}}),p=n.createClass({displayName:"animation-view",mixins:[a.default],getInitialState:function(){return{content:this.props.content}},render:function(){var e=this,t=this.getUri(),o=t&&s.existsSync(t)?{}:{disabled:!0},a=o.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.onPreview}),"Preview"))))},getRoot:function(){var e=r.resolve(this.props.projectRoot,"animations");return e},getAnimPath:function(e){var t=u.animDB.getAnimByName(e);return t?r.join(t.resourceRoot,t.meta.path):void 0},getUri:function(){return this.getAnimPath(this.state.content)},onPreview:function(){var e=this;this.createModal(n.createElement(h,{uri:this.getUri(),onClose:function(){e.destroyModal()}}))},onChoose:function(){var e=this;this.createModal(n.createElement(d.default,{onChoose:function(t){e.props.onChange(t),e.setState({content:t})},onClose:function(){e.destroyModal()}}))}});Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o,i){return n.createElement(p,{key:t,content:e,onChange:o,projectRoot:i})}},{"../../
|
||
|
|
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<l.length;d++)for(var u=t[l[d]],h=0;h<u.args.length;h++)"string"==typeof u.args[h]&&(0===u.args[h].indexOf("function")||
|
||
|
|
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 t<o.children.length-1},t.prototype.moveRow=function(e,t,o){var i=e.parent,n=this.data[i],a=n.children.indexOf(e.id);n.id===t.id&&a<o&&o--,n.children.splice(a,1),t.children=t.children?t.children:[],t.children.splice(o,0,e.id),e.parent=t.id,this.addRedoUndoEntry(),this.emit("ondatachanged")},t.prototype.canPaste=function(){return void 0!==d.default.behaviorData},t.prototype._getTreeRoot=function(e){var t,o=Object.keys(e);if(1===o.length)return e[o[0]];for(var i=0;i<o.length;i++){var n=o[i],a=e[n],r=this.getSchemaByElement(a).type;if("decorator"!==r){t=a;break}}for(;e[t.parent];)t=e[t.parent];return t},t.prototype.paste=function(){if(d.default.behaviorData){var e=JSON.parse(d.default.behaviorData),t=Object.keys(e),o=this.getSchemaByElement(this._getTreeRoot(e)).type;"decorator"!==o?this._pasteBehavior(e):this._pasteDecorator(e,t),this.addRedoUndoEntry()}},t.prototype._pasteBehavior=function(e){var t,o=this.getSchemaByElement(this.selectedElement).type,i=0;"leaf"===o?(t=this.getParent(this.selectedElement),i=t.children.indexOf(this.selectedElement.id)+1):"composite"===o&&(t=this.selectedE
|
||
|
|
d.push(r.createFile(a));break}}else r.props.extension&&i.extname(t)===r.props.extension.toLowerCase()&&d.push(r.createFile(a))}),o&&!t){for(var c=!0,u=0;u<d.length;++u)if(d[u]){c=!1;break}if(c)return null}var h=this.state.collapsedDirectoried[e]?"list-nested-item collapsed":"list-nested-item";return t?a.createElement("ul",{className:"list-group"},d):a.createElement("ul",{className:"list-tree has-collapsable-children"},a.createElement("li",{className:h},a.createElement("div",{onClick:this.onCollapsed.bind(this,e),className:"list-item"},a.createElement("span",{className:"icon icon-file-directory"},s)),d))},render:function(){var e=null;try{n.statSync(this.props.uri),e=this.createDirectory(this.props.uri,!0,!!this.props.hideEmpty)}catch(t){e=null}return a.createElement("div",{className:"jibo-list-tree"},e)}})},{fs:void 0,path:void 0,react:void 0}],99:[function(e,t,o){"use strict";function i(e,t){if(!e||!e.nodeType||"string"!=typeof t)return null;t=t.split("."),1===t.length?t.push(null):t[0]||(t[0]=null);do{if(!t[0]&&!t[1])break;var o=!t[0]||t[0].toLowerCase()===e.nodeName.toLowerCase(),i=!t[1]||e.className.toLowerCase().search(t[1].toLowerCase())!==-1;if(o&&i)break;e=e.parentNode}while(e);return e}Object.defineProperty(o,"__esModule",{value:!0}),o.default={getAncestor:i}},{}],100:[function(e,t,o){"use strict";function i(e,t){if(void 0===t&&(t=""),""===e)return"";var o=e.split("/");if("node_modules"===o[0]){var i=o[1],n=d.join("node_modules",i,t);return n=c(d.relative(n,e)),i+"://"+n}var n=d.normalize(t);return n=d.relative(n,e),c(n)}function n(e,t){void 0===t&&(t="");var o=e.split("://");if(1===o.length){var i=d.join(t,e);return c(i)}if(2===o.length){var i=d.join("node_modules",o[0],t,o[1]);return c(i)}return""}function a(e){for(var t=r(e),o={},i=0,n=t;i<n.length;i++){var a=n[i];o[a.id]=a}return o}function r(t){var o=[],i=s.default.getProjectRoot(t);i||(i=s.default.getProjectRoot("")),o.push({root:i,id:"project",name:"Project"});for(var n=d.resolve(i,"node_modules"),a=l.readdirSync(n),r=0;r<a.length;r++){var c=void 0;try{c=e(d.resolve(n,a[r],"package.json"))}catch(e){continue}if(c.jibo&&"asset-pack"===c.jibo.type){var u=d.resolve(n,a[r]);o.push({root:u,id:c.name,name:c.jibo["display-name"]})}}return o}var s=e("../atom-react/core/react-editor"),l=e("fs"),d=e("path"),c=e("normalize-path");o.relativeUriToAssetPackUri=i,o.assetPackUriToRelativeUri=n,o.getAssetPackDictionary=a,o.getAssetPacks=r,Object.defineProperty(o,"__esModule",{value:!0}),o.default=r},{"../atom-react/core/react-editor":55,fs:void 0,"normalize-path":void 0,path:void 0}],101:[function(e,t,o){"use strict";function i(){var e=a.default.getFilePathOfSelection();return e?(r=!1,void atom.workspace.open(e)):void alert("Can't Open Folders as JSON")}function n(){var e=r;return r=!0,e}var a=e("./tree-view-helper"),r=!0;Object.defineProperty(o,"__esModule",{value:!0}),o.default={open:i,useDefaultEditor:n}},{"./tree-view-helper":109}],102:[function(e,t,o){"use strict";function i(){return{handleSize:8,propTypes:{onLayoutResize:n.PropTypes.func},getDefaultProps:function(){return{supportedChildren:{HLayout:!0,VLayout:!0,TreeView:!0,"layout-child":!0}}},handleResize:function(){this.forceUpdate()},getInitialState:function(){var e=this.props.serialized,t=[];if(e.length>0)for(var o=0;o<e.length;o++)t[o]=e[o].size;else if(Array.isArray(this.props.children))for(var i=this.props.children.length,n=this.handleSize*(i-1),a=this.getSize()-n,o=0;o<i;o++){var r=a/i;this.props.serialized[o]={size:r,children:[]},t.push(r)}else{var r=this.getSize();this.props.serialized[0]={size:r,children:[]},t.push(r)}return{sizes:t,serialized:this.props.serialized}},componentDidMount:function(){},onMouseMove:function(e,t){t.preventDefault(),t.stopPropagation();var o=this.getEventPosition(t)-this.start,i=this.startSizes[0]+this.startSizes[1];this.state.sizes[e]=s(this.startSizes[0]+o,0,i),this.state.sizes[e+1]=s(this.startSizes[1]-o,0,i),this.state.serialized[e].size=this.state.sizes[e],this.state.serialized[e+1].size=this.state.sizes[e+1],this.props.onLayoutResize&&this.props.onLayoutResize(this.state.si
|
||
|
|
},e.prototype.getFlowSchemas=function(){var e=[];for(var t in this.schema)for(var o in this.schema[t].schema){var i=this.schema[t].schema[o];i.paletteInfo&&i.paletteInfo.uses&&i.paletteInfo.uses.indexOf("flow")!==-1&&e.push(i)}return e},e.prototype.setSurface=function(e,t){this.surface=e,void 0===global.jiboFlowEditorTabs&&(global.jiboFlowEditorTabs={}),global.jiboFlowEditorTabs[this.uri]={palette:t,diagram:e}},e.prototype.navigateToShapeOnLine=function(e,t){var o,n=i.readFileSync(e,"utf8").split("\n");for(o=t;o>=0&&!(n[o].indexOf('"class": ')>=0);o--);if(o>=0)for(var a=o;a<n.length;a++)if(n[a].indexOf('"id": ')>=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<t.length;o++){var i=t[o];if(i.options)for(var n=Object.keys(i.options),a=0;a<n.length;a++){var r=n[a];"string"==typeof i.options[r]&&(0===i.options[r].indexOf("function")||i.options[r].indexOf("=>")>=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<o.length;s++){var c=o[s],u="list-item";this.state.currentAssetPack.id===c.id&&(this.state.currentAssetPack=c,e=c,u+=" selected"),n.push(i.createElement("li",{className:u,onClick:this.onAssetPackSelected.bind(this,c)},i.createElement("span",null,c.name)))}var h="";return this.state.currentFlow,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 a Flow File")),i.createElement("label",{style:{marginLeft:10}},"Search"),i.createElement(d.default,{ref:"editor",style:{marginLeft:10,marginRight:10,marginBottom:10},min
|
||
|
|
"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.defau
|
||
|
|
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<u.length;c++){var h=u[c];l(h)}0!==r.length&&e.push(i.createElement("div",null,i.createElement("div",{className:"panel-heading",style:{padding:"0px"}},i.createElement("h2",{style:{color:n.default.Tennis,textAlign:"center",marginTop:"6px",marginBottom:"6px"}},t)),i.createElement("div",{className:"arguments-scroll-container"},i.createElement("table",{key:this.state.key++},r))))},findReferences:function(e,t){var o=RegExp(e+"[\\.a-zA-Z_0-9]*"),i=RegExp(e+"\\.([a-zA-Z_0-9]*)"),n=t?RegExp(t):/NeverToBeMatchedPisan!/,a=[],r=[];this.props.diagram.nodes.each(function(e){r.push(e)});for(var s=0,l=r;s<l.length;s++){var d=l[s];if(d.data&&d.data.options)for(var c=0,u=Object.keys(d.data.options);c<u.length;c++){var h=u[c],p=d.data.options[h];if("string"==typeof p)for(var m=p.split("\n"),f=0,v=m;f<v.length;f++){var y=v[f],g=y.match(o);if(g&&!y.match(n)){var b=y.match(i),k="";b&&b[1]&&(k=b[1]),a.push({node:d,line:y,varName:k,sortKey:y.substr(g.index),isAssignment:this.isAssignment(g,y)})}}}}return a.sort(function(e,t){return e.sortKey.localeCompare(t.sortKey)}),a},isAssignment:function(e,t){var o=t.substr(e.index+e[0].length),i=o.trim();return i.startsWith("=")&&!i.startsWith("==")}})},{"./JiboColors":119,react:void 0}],127:[function(e,t,o){"use strict";var i=e("child_process"),n=e("../get-base-path"),a=e("jibo-cli"),r=e("crypto"),s=a.getElectronPath(),l="cmajghqmadhnadjcjhamajdhda";Object.defineProperty(o,"__esModule",{value:!0}),o.default={isUserLoggedIn:function(){var e=!0;return!e||"true"===localStorage.getItem(l)},showDialog:function(e){var t=this;r.randomBytes(48,function(o,a){var r=a.toString("hex"),d=i.spawn(s,[n.default("resources/gating/m.js")],{cwd:n.default("resources/gating"),env:{token:r}});d.stdout.on("data",function(e){var t=e.toString();t===r&&localStorage.setItem(l,"true")}),d.on("close",function(){e(null,t.isUserLoggedIn())})})}}},{"../get-base-path":128,child_process:void 0,crypto:void 0,"jibo-cli":void 0}],128:[function(e,t,o){"use strict";function i(e,t){var o=n.sep+"jibo-sdk",i=__dirname.substr(0,__dirname.indexOf(o)+o.length);return n.join(i,e||"",t||"")}var n=e("path");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i},{path:void 0}],129:[function(e,t,o){"use strict";function i(e){var t=d.parse(e);return null!==t.port?t.host.slice(0,-(t.port.length+1)):t.host}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=
|
||
|
|
className:"btn-group"},i.createElement("button",{className:"btn",onClick:this.onDone},"Done"),i.createElement("button",{className:"btn",onClick:this.onCancel},"Cancel")))},componentDidMount:function(){var e=this;setTimeout(function(){for(var t=i.findDOMNode(e.refs.editor),o=t.getModel(),a=atom.grammars.getGrammars(),r=0;r<a.length;r++){var s=a[r];if("source.js"===s.scopeName){o.setGrammar(s);break}}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.onDone}))},100)},componentWillUnmount:function(){this.disposable.dispose()}})},{atom:void 0,react:void 0}],142:[function(e,t,o){"use strict";var i=function(){function e(e,t){this.data=e,this.parentModel=t}return e.generateDefaultData=function(){return{label:"",color:"default",icon:"",utterance:"",notes:""}},e.prototype.getProperty=function(e){return this.data[e]},e.prototype.updateProperty=function(e,t){this.data[e]=t},e.prototype.delete=function(){this.parentModel.removeButton(this)},e}();Object.defineProperty(o,"__esModule",{value:!0}),o.default=i},{}],143:[function(e,t,o){"use strict";var i=e("react"),n=e("../../options/mim-string"),a=e("./texture-input"),r=e("./color-selector");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({displayName:"ButtonOption",getInitialState:function(){return{}},render:function(){var e=this,t=this.props.option,o=t.dataName,s=t.displayName,l=null,d=t.type;"string"===d?l=i.createElement(n.default,{content:this.props.model.getProperty(o),grammar:null,onChange:function(t){e.props.model.updateProperty(o,t)}}):"image"===d?l=i.createElement(a.default,{content:this.props.model.getProperty(o),projectRoot:this.props.projectRoot,onChange:function(t){e.props.model.updateProperty(o,t)}}):"gradient"===d&&(l=i.createElement(r.default,{content:this.props.model.getProperty(o),onChange:function(t){e.props.model.updateProperty(o,t)}}));var c="button-option",u="option-title";return i.createElement("div",{className:c},i.createElement("div",{ref:"name",className:u},s),i.createElement("div",{className:"option"},l))},componentDidMount:function(){if(this.props.option.description){var e=i.findDOMNode(this.refs.name);this.tooltip=atom.tooltips.add(e,{title:this.props.option.description})}},componentWillUnmount:function(){this.tooltip&&(this.tooltip.dispose(),this.tooltip=null)}})},{"../../options/mim-string":155,"./color-selector":145,"./texture-input":149,react:void 0}],144:[function(e,t,o){"use strict";var i=e("react"),n=e("../../../atom-react/components/float-input-view"),a=e("../../../animation-editor/views/properties/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");Object.defineProperty(o,"__esModule",{value:!0}),o.default=i.createClass({getInitialState:function(){var e=l.getRgb(this.props.value);return{color:this.props.value,value:{r:e[0],g:e[1],b:e[2]}}},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])};this.updateColor(e,i)},updateFromHexString:function(e){var t=l.getRgb(e);t?this.setState({color:e,value:{r:t[0],g:t[1],b:t[2]}}):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])};this.updateColor(l.hexString(t),o)},_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={r:this._clamp(e,0,255),g:this.state.value.g,b:this.state.value.b},o=l.hexString([t.r,t.g,t.b]);this.updateColor(o,t)},onGChange:function(e){var t={r:this.state.value.r,g:this._clamp(e,0,255),b:this.state.value.b},o=l.hexString([t.r,t.g,t.b]);this.updateColor(o,t)},onBChange:function(e){var t={r:this.state.value.r,g:this.state.value.g,b:this._clamp(e,0,255)},o=l.hexString([t.r,t.g,t.b]);this.updateColor(o,t)},onHChange:function(e){var t=this._hsvFromSta
|
||
|
|
},"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;o<e.length;o++){var i=e[o];t=t&&this.fields[i]}return t},onUpdate:function(){var e=this;if(0===this.state.step){var t=this.state.type.fields[0].ref,o=this.refs[t];o.focus(),this.fields={};var n=i.findDOMNode(this.refs.generateButton);this.state.type.fields.forEach(function(t){e.fields[t.ref]=!1}),n.disabled=!0}},componentDidUpdate:function(){this.onUpdate()},componentDidMount:function(){var e=this;this.onUpdate(),this.disposable=new l.CompositeDisposable,this.disposable.add(atom.commands.add(this.getDOMNode(),{"jibo-sdk:escape":this.props.onClose})),this.disposable.add(atom.commands.add(this.getDOMNode(),{"core:confirm":function(){e.areFieldsFilledIn()&&e.onChoose()}}))},componentWillUnmount:function(){this.disposable.dispose()},onChoose:function(){var e=this;this.state.step++;var t=this.getPackagesDirectory(),o=this.getFieldValue("packageName");o=r.normalize(o);var i=this.getFieldValue("titleName"),a=r.resolve(t,o),s=o.split(r.sep),l=s.length>0?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("<div/>"),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(){t
|